This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
clarify SvPV* and SvPV_force* docs
[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#
613d6c3e 14# Note: this Configure script was generated automatically. Rather than
2304df62 15# working with this copy of Configure, you may wish to get metaconfig.
613d6c3e 16# The dist package (which contains metaconfig) is available via SVN:
7c1269c3 17# svn co https://svn.code.sf.net/p/dist/code/trunk/dist
2304df62 18#
6f5be6d1
MB
19# Though this script was generated by metaconfig from metaunits, it is
20# OK to send patches against Configure itself. It's up to the Configure
21# pumpkin to backport the patch to the metaunits if it is accepted.
4471067f
JV
22# For more information on patching Configure, see pod/perlhack.pod
23#
6f5be6d1
MB
24# The metaunits are also available from the public git repository:
25# http://perl5.git.perl.org/metaconfig.git/ or
26# $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
5cadb3f3 27#
5cadb3f3
MB
28# See Porting/pumpkin.pod for more information on metaconfig.
29#
2304df62 30
7c1269c3 31# Generated on Tue May 7 23:44:53 CEST 2013 [metaconfig 3.5 PL0]
7f2de2d2 32# (with additional metaconfig patches by perlbug@perl.org)
2304df62 33
283fdd21 34cat >c1$$ <<EOF
2304df62
AD
35ARGGGHHHH!!!!!
36
37SCO csh still thinks true is false. Write to SCO today and tell them that next
38year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
41we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43[End of diatribe. We now return you to your regularly scheduled programming...]
44EOF
283fdd21 45cat >c2$$ <<EOF
2304df62
AD
46
47OOPS! You naughty creature! You didn't run Configure with sh!
48I will attempt to remedy the situation by running sh for you...
49EOF
50
283fdd21 51true || cat c1$$ c2$$
2304df62
AD
52true || exec sh $0 $argv:q
53
283fdd21 54(exit $?0) || cat c2$$
2304df62 55(exit $?0) || exec sh $0 $argv:q
283fdd21 56rm -f c1$$ c2$$
2304df62 57
f6538904 58if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
d03b3b00 59 cat <<EOF
cbee2ce6
JH
60***
61*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
63*** Please read the README.plan9 for further instructions.
64*** Cannot continue, aborting.
65***
66EOF
67 exit 1
68fi
69
f8e2af1d 70if test ! -c /dev/null ; then
d03b3b00 71 cat <<EOF
f8e2af1d
MC
72***
73*** I'm sorry, but /dev/null appears to be a file rather than a device.
74*** Please consult your operating sytem's notes for making a device
75*** in /dev.
76*** Cannot continue, aborting.
77***
78EOF
79 exit 1
80fi
81
a0d0e21e
LW
82: compute my invocation name
83me=$0
84case "$0" in
85*/*)
86 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87 test "$me" || me=$0
88 ;;
89esac
90
dfe9444c 91: Proper separator for the PATH environment variable
8e07c86e 92p_=:
613d6c3e 93: On OS/2 this directory should exist if this is not floppy only system ":-]"
5c728af0 94if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
613d6c3e 95 if test -n "$OS2_SHELL"; then
dfe9444c
AD
96 p_=\;
97 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 99 is_os2=yes
c4f23d77 100 elif test -n "$DJGPP"; then
495e2cbe
MB
101 case "X${MACHTYPE:-nonesuchmach}" in
102 *cygwin) ;;
103 *) p_=\; ;;
104 esac
dfe9444c 105 fi
39e571d4 106fi
a0d0e21e
LW
107
108: Proper PATH setting
109paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 110paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 111paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 112paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 113paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 114paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
115paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 117paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
118
119for p in $paths
120do
8e07c86e
AD
121 case "$p_$PATH$p_" in
122 *$p_$p$p_*) ;;
123 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
124 esac
125done
126
8e07c86e 127PATH=.$p_$PATH
2304df62
AD
128export PATH
129
dfe9444c
AD
130: shall we be using ksh?
131inksh=''
132needksh=''
133avoidksh=''
134newsh=/bin/ksh
135changesh=''
ff0cee69 136if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
137 inksh=true
138fi
139if test -f /hp-ux -a -f /bin/ksh; then
140 needksh='to avoid sh bug in "here document" expansion'
141fi
142if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143 if test X`/usr/bin/uname -v` = X4; then
144 avoidksh="to avoid AIX 4's /bin/sh"
145 newsh=/usr/bin/bsh
2304df62 146 fi
dfe9444c 147fi
cf04f91f
JH
148if test -f /osf_boot -a -f /usr/sbin/setld; then
149 if test X`/usr/bin/uname -s` = XOSF1; then
613d6c3e
MB
150 avoidksh="to avoid Digital UNIX' ksh"
151 newsh=/bin/sh
152 unset BIN_SH
cf04f91f
JH
153 fi
154fi
dfe9444c
AD
155case "$inksh/$needksh" in
156/[a-z]*)
c4f23d77 157 ENV=''
dfe9444c
AD
158 changesh=true
159 reason="$needksh"
160 ;;
161esac
162case "$inksh/$avoidksh" in
163true/[a-z]*)
164 changesh=true
165 reason="$avoidksh"
166 ;;
167esac
168case "$inksh/$needksh-$avoidksh-" in
169true/--)
a0d0e21e
LW
170 cat <<EOM
171(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 172mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 173EOM
dfe9444c
AD
174 ;;
175esac
176case "$changesh" in
177true)
2e2a97a6 178 export newsh
dfe9444c
AD
179 echo "(Feeding myself to $newsh $reason.)"
180 case "$0" in
181 Configure|*/Configure) exec $newsh $0 "$@";;
182 *) exec $newsh Configure "$@";;
183 esac
184 ;;
185esac
7730b9f4 186test -x "${newsh}" || unset newsh
2304df62 187
613d6c3e 188: if needed, set CDPATH to a harmless value that is not chatty
bfb7748a
AD
189: avoid bash 2.02 problems with empty CDPATH.
190case "$CDPATH" in
191'') ;;
192*) case "$SHELL" in
613d6c3e
MB
193 *bash*) CDPATH='.' ;;
194 *) CDPATH='' ;;
bfb7748a
AD
195 esac
196 ;;
197esac
613d6c3e 198
2304df62
AD
199: Configure runs within the UU subdirectory
200test -d UU || mkdir UU
8e07c86e 201cd UU && rm -f ./*
2304df62 202
6b356c8e
JH
203ccname=''
204ccversion=''
b4eb6b3d
JH
205ccsymbols=''
206cppccsymbols=''
207cppsymbols=''
5440bc8e
JH
208from=''
209run=''
210targetarch=''
211to=''
212usecrosscompile=''
61c26d18 213extern_C=''
6b34ded5 214mistrustnm=''
1be1b388 215usedevel=''
9c839522 216perllibs=''
b4eb6b3d
JH
217dynamic_ext=''
218extensions=''
219known_extensions=''
220nonxs_ext=''
221static_ext=''
222useopcode=''
223useposix=''
6fcddf3b 224extras=''
ecfc5424 225d_bsd=''
40a7a20a 226d_eunice=''
2304df62
AD
227d_xenix=''
228eunicefix=''
dfe9444c 229ar=''
2304df62
AD
230awk=''
231bash=''
232bison=''
233byacc=''
234cat=''
235chgrp=''
236chmod=''
237chown=''
ecfc5424 238comm=''
2304df62
AD
239compress=''
240cp=''
241cpio=''
242cpp=''
243csh=''
244date=''
245echo=''
246egrep=''
247emacs=''
248expr=''
249find=''
250flex=''
3c728e00 251gmake=''
2304df62 252grep=''
8ff267be 253gzip=''
2304df62
AD
254inews=''
255ksh=''
256less=''
257line=''
258lint=''
259ln=''
260lp=''
261lpr=''
262ls=''
263mail=''
264mailx=''
dfe9444c 265make=''
2304df62
AD
266mkdir=''
267more=''
268mv=''
693762b4 269nm=''
2304df62
AD
270nroff=''
271perl=''
272pg=''
273pmake=''
274pr=''
275rm=''
276rmail=''
277sed=''
278sendmail=''
2304df62
AD
279shar=''
280sleep=''
281smail=''
282sort=''
283submit=''
284tail=''
285tar=''
286tbl=''
693762b4 287tee=''
2304df62
AD
288test=''
289touch=''
290tr=''
291troff=''
292uname=''
293uniq=''
294uuname=''
295vi=''
296zcat=''
8ff267be 297zip=''
b4eb6b3d
JH
298full_ar=''
299full_sed=''
a0d0e21e 300libswanted=''
2304df62
AD
301hint=''
302myuname=''
85e6fe83
LW
303osname=''
304osvers=''
2304df62
AD
305Author=''
306Date=''
307Header=''
308Id=''
309Locker=''
310Log=''
311RCSfile=''
312Revision=''
313Source=''
314State=''
dfe9444c
AD
315_a=''
316_exe=''
317_o=''
4633a7c4
LW
318archobjs=''
319exe_ext=''
320firstmakefile=''
321lib_ext=''
322obj_ext=''
323path_sep=''
5b813a60 324rm_try=''
b4eb6b3d 325afs=''
a6d26a0d 326afsroot=''
b4eb6b3d
JH
327alignbytes=''
328ansi2knr=''
329archlib=''
330archlibexp=''
331d_archlib=''
332installarchlib=''
333archname=''
334myarchname=''
1a1287f4 335useversionedarchname=''
b4eb6b3d
JH
336d_atolf=''
337d_atoll=''
338baserev=''
339bin=''
340binexp=''
f3f1a2d8 341initialinstalllocation=''
b4eb6b3d 342installbin=''
f3f1a2d8 343userelocatableinc=''
b4eb6b3d 344byteorder=''
2304df62 345cc=''
2304df62
AD
346ccflags=''
347cppflags=''
348ldflags=''
349lkflags=''
8e07c86e 350locincpth=''
2304df62 351optimize=''
b4eb6b3d 352cf_email=''
2304df62
AD
353cf_by=''
354cf_time=''
c193ef60
MB
355charbits=''
356charsize=''
2304df62 357contains=''
b4eb6b3d 358cpp_stuff=''
2304df62
AD
359cpplast=''
360cppminus=''
361cpprun=''
362cppstdin=''
74cac757 363d__fwalk=''
b4eb6b3d
JH
364d_access=''
365d_accessx=''
55954f19 366d_aintl=''
b4eb6b3d 367d_alarm=''
10bc17b6
JH
368asctime_r_proto=''
369d_asctime_r=''
fcdf39cf 370d_attribute_deprecated=''
0dbb1585
AL
371d_attribute_format=''
372d_attribute_malloc=''
373d_attribute_nonnull=''
374d_attribute_noreturn=''
375d_attribute_pure=''
376d_attribute_unused=''
377d_attribute_warn_unused_result=''
dcb594bc 378d_printf_format_null=''
b4eb6b3d
JH
379d_bcmp=''
380d_bcopy=''
635aebb7
AL
381d_builtin_choose_expr=''
382d_builtin_expect=''
b4eb6b3d 383d_bzero=''
a2d23ec2 384d_c99_variadic_macros=''
b4eb6b3d
JH
385d_casti32=''
386castflags=''
387d_castneg=''
388d_chown=''
389d_chroot=''
390d_chsize=''
758a5d79 391d_class=''
b0a2e8e6 392d_clearenv=''
b4eb6b3d
JH
393d_closedir=''
394d_void_closedir=''
4e0554ec 395d_cmsghdr_s=''
b4eb6b3d 396d_const=''
36adc09b 397d_copysignl=''
666ea192 398d_cplusplus=''
b4eb6b3d
JH
399cryptlib=''
400d_crypt=''
10bc17b6
JH
401crypt_r_proto=''
402d_crypt_r=''
b4eb6b3d
JH
403d_csh=''
404full_csh=''
13cfc98d 405d_ctermid=''
10bc17b6
JH
406ctermid_r_proto=''
407d_ctermid_r=''
408ctime_r_proto=''
409d_ctime_r=''
b4eb6b3d
JH
410d_cuserid=''
411d_dbl_dig=''
2ef53570 412d_dbminitproto=''
b4eb6b3d 413d_difftime=''
de52168c 414d_dir_dd_fd=''
ae0e3d3b 415d_dirfd=''
b4eb6b3d 416d_dlerror=''
a0d0e21e 417d_dlopen=''
b4eb6b3d
JH
418d_dlsymun=''
419d_dosuid=''
420d_suidsafe=''
10bc17b6
JH
421d_drand48_r=''
422drand48_r_proto=''
b4eb6b3d
JH
423d_drand48proto=''
424d_dup2=''
425d_eaccess=''
426d_endgrent=''
10bc17b6
JH
427d_endgrent_r=''
428endgrent_r_proto=''
b4eb6b3d 429d_endhent=''
10bc17b6
JH
430d_endhostent_r=''
431endhostent_r_proto=''
b4eb6b3d 432d_endnent=''
10bc17b6
JH
433d_endnetent_r=''
434endnetent_r_proto=''
b4eb6b3d 435d_endpent=''
10bc17b6
JH
436d_endprotoent_r=''
437endprotoent_r_proto=''
b4eb6b3d 438d_endpwent=''
10bc17b6
JH
439d_endpwent_r=''
440endpwent_r_proto=''
b4eb6b3d 441d_endsent=''
10bc17b6
JH
442d_endservent_r=''
443endservent_r_proto=''
15b61c98 444d_faststdio=''
b363b713 445d_fchdir=''
b4eb6b3d
JH
446d_fchmod=''
447d_fchown=''
448d_fcntl=''
9d9004a9 449d_fcntl_can_lock=''
b4eb6b3d
JH
450d_fd_macros=''
451d_fd_set=''
452d_fds_bits=''
453d_fgetpos=''
758a5d79
JH
454d_finite=''
455d_finitel=''
b4eb6b3d
JH
456d_flexfnam=''
457d_flock=''
2ef53570 458d_flockproto=''
b4eb6b3d 459d_fork=''
758a5d79
JH
460d_fp_class=''
461d_fpclass=''
462d_fpclassify=''
463d_fpclassl=''
b4eb6b3d
JH
464d_fpos64_t=''
465d_frexpl=''
466d_fs_data_s=''
467d_fseeko=''
468d_fsetpos=''
469d_fstatfs=''
411ab01c 470d_fsync=''
b4eb6b3d
JH
471d_ftello=''
472d_ftime=''
473d_gettimeod=''
dc814df1 474d_futimes=''
b4eb6b3d 475d_Gconvert=''
5086dff9 476d_getaddrinfo=''
b4eb6b3d
JH
477d_getcwd=''
478d_getespwnam=''
479d_getfsstat=''
480d_getgrent=''
10bc17b6
JH
481d_getgrent_r=''
482getgrent_r_proto=''
483d_getgrgid_r=''
484getgrgid_r_proto=''
485d_getgrnam_r=''
486getgrnam_r_proto=''
b4eb6b3d
JH
487d_getgrps=''
488d_gethbyaddr=''
489d_gethbyname=''
490d_gethent=''
491aphostname=''
492d_gethname=''
493d_phostname=''
494d_uname=''
10bc17b6
JH
495d_gethostbyaddr_r=''
496gethostbyaddr_r_proto=''
497d_gethostbyname_r=''
498gethostbyname_r_proto=''
499d_gethostent_r=''
500gethostent_r_proto=''
b4eb6b3d 501d_gethostprotos=''
4e0554ec 502d_getitimer=''
b4eb6b3d 503d_getlogin=''
10bc17b6
JH
504d_getlogin_r=''
505getlogin_r_proto=''
b4eb6b3d
JH
506d_getmnt=''
507d_getmntent=''
5086dff9 508d_getnameinfo=''
b4eb6b3d
JH
509d_getnbyaddr=''
510d_getnbyname=''
511d_getnent=''
10bc17b6
JH
512d_getnetbyaddr_r=''
513getnetbyaddr_r_proto=''
514d_getnetbyname_r=''
515getnetbyname_r_proto=''
516d_getnetent_r=''
517getnetent_r_proto=''
b4eb6b3d 518d_getnetprotos=''
0c0643d0 519d_getpagsz=''
b4eb6b3d
JH
520d_getpent=''
521d_getpgid=''
522d_getpgrp2=''
523d_bsdgetpgrp=''
524d_getpgrp=''
525d_getppid=''
526d_getprior=''
527d_getpbyname=''
528d_getpbynumber=''
10bc17b6
JH
529d_getprotobyname_r=''
530getprotobyname_r_proto=''
531d_getprotobynumber_r=''
532getprotobynumber_r_proto=''
533d_getprotoent_r=''
534getprotoent_r_proto=''
b4eb6b3d
JH
535d_getprotoprotos=''
536d_getprpwnam=''
537d_getpwent=''
10bc17b6
JH
538d_getpwent_r=''
539getpwent_r_proto=''
540d_getpwnam_r=''
541getpwnam_r_proto=''
542d_getpwuid_r=''
543getpwuid_r_proto=''
b4eb6b3d 544d_getsent=''
10bc17b6
JH
545d_getservbyname_r=''
546getservbyname_r_proto=''
547d_getservbyport_r=''
548getservbyport_r_proto=''
549d_getservent_r=''
550getservent_r_proto=''
b4eb6b3d
JH
551d_getservprotos=''
552d_getspnam=''
10bc17b6
JH
553d_getspnam_r=''
554getspnam_r_proto=''
b4eb6b3d
JH
555d_getsbyname=''
556d_getsbyport=''
10bc17b6
JH
557d_gmtime_r=''
558gmtime_r_proto=''
a4f3eea9 559d_gnulibc=''
5f6e0ee4 560gnulibc_version=''
b4eb6b3d
JH
561d_hasmntopt=''
562d_htonl=''
55954f19 563d_ilogbl=''
b4eb6b3d 564d_inetaton=''
5086dff9
MB
565d_inetntop=''
566d_inetpton=''
b4eb6b3d
JH
567d_int64_t=''
568d_isascii=''
269a7913 569d_isblank=''
758a5d79
JH
570d_isfinite=''
571d_isinf=''
b4eb6b3d
JH
572d_isnan=''
573d_isnanl=''
574d_killpg=''
575d_lchown=''
576d_ldbl_dig=''
0a0abfba 577d_libm_lib_version=''
b4eb6b3d 578d_link=''
10bc17b6 579d_localtime_r=''
8572b25d 580d_localtime_r_needs_tzset=''
10bc17b6 581localtime_r_proto=''
b4eb6b3d
JH
582d_locconv=''
583d_lockf=''
584d_longdbl=''
585longdblsize=''
586d_longlong=''
587longlongsize=''
588d_lseekproto=''
589d_lstat=''
590d_madvise=''
7dd121ae
MB
591d_malloc_good_size=''
592d_malloc_size=''
b4eb6b3d
JH
593d_mblen=''
594d_mbstowcs=''
595d_mbtowc=''
596d_memchr=''
597d_memcmp=''
598d_memcpy=''
599d_memmove=''
600d_memset=''
601d_mkdir=''
602d_mkdtemp=''
603d_mkfifo=''
604d_mkstemp=''
605d_mkstemps=''
606d_mktime=''
607d_mmap=''
608mmaptype=''
609d_modfl=''
e67aeab1 610d_modfl_pow32_bug=''
bc9a1b2c 611d_modflproto=''
b4eb6b3d
JH
612d_mprotect=''
613d_msg=''
614d_msgctl=''
615d_msgget=''
4e0554ec 616d_msghdr_s=''
b4eb6b3d
JH
617d_msgrcv=''
618d_msgsnd=''
619d_msync=''
620d_munmap=''
621d_nice=''
2765b840 622d_nl_langinfo=''
b4eb6b3d
JH
623d_off64_t=''
624d_open3=''
625d_fpathconf=''
626d_pathconf=''
627d_pause=''
628d_pipe=''
629d_poll=''
2304df62 630d_portable=''
c796e3db
MB
631d_prctl=''
632d_prctl_set_name=''
a33c94aa 633d_procselfexe=''
f24dbf84 634procselfexe=''
b4eb6b3d
JH
635d_old_pthread_create_joinable=''
636old_pthread_create_joinable=''
d6483fcc 637d_pthread_atfork=''
58d975c3 638d_pthread_attr_setscope=''
b4eb6b3d
JH
639d_pthread_yield=''
640d_sched_yield=''
641sched_yield=''
642d_qgcvt=''
10bc17b6
JH
643d_random_r=''
644random_r_proto=''
645d_readdir64_r=''
646readdir64_r_proto=''
b4eb6b3d
JH
647d_readdir=''
648d_rewinddir=''
649d_seekdir=''
650d_telldir=''
10bc17b6
JH
651d_readdir_r=''
652readdir_r_proto=''
b4eb6b3d 653d_readlink=''
4e0554ec
JH
654d_readv=''
655d_recvmsg=''
b4eb6b3d
JH
656d_rename=''
657d_rmdir=''
658d_safebcpy=''
659d_safemcpy=''
660d_sanemcmp=''
ef9f17be 661d_sbrkproto=''
55954f19 662d_scalbnl=''
b4eb6b3d
JH
663d_select=''
664d_sem=''
665d_semctl=''
666d_semget=''
667d_semop=''
4e0554ec 668d_sendmsg=''
b4eb6b3d
JH
669d_setegid=''
670d_seteuid=''
671d_setgrent=''
10bc17b6
JH
672d_setgrent_r=''
673setgrent_r_proto=''
b4eb6b3d
JH
674d_setgrps=''
675d_sethent=''
10bc17b6
JH
676d_sethostent_r=''
677sethostent_r_proto=''
4e0554ec 678d_setitimer=''
b4eb6b3d
JH
679d_setlinebuf=''
680d_setlocale=''
10bc17b6
JH
681d_setlocale_r=''
682setlocale_r_proto=''
b4eb6b3d 683d_setnent=''
10bc17b6
JH
684d_setnetent_r=''
685setnetent_r_proto=''
b4eb6b3d
JH
686d_setpent=''
687d_setpgid=''
688d_setpgrp2=''
689d_bsdsetpgrp=''
690d_setpgrp=''
691d_setprior=''
692d_setproctitle=''
10bc17b6
JH
693d_setprotoent_r=''
694setprotoent_r_proto=''
b4eb6b3d 695d_setpwent=''
10bc17b6
JH
696d_setpwent_r=''
697setpwent_r_proto=''
b4eb6b3d
JH
698d_setregid=''
699d_setresgid=''
700d_setresuid=''
701d_setreuid=''
702d_setrgid=''
703d_setruid=''
704d_setsent=''
10bc17b6
JH
705d_setservent_r=''
706setservent_r_proto=''
b4eb6b3d
JH
707d_setsid=''
708d_setvbuf=''
709d_sfio=''
710usesfio=''
711d_shm=''
712d_shmat=''
713d_shmatprototype=''
714shmattype=''
715d_shmctl=''
716d_shmdt=''
717d_shmget=''
718d_sigaction=''
ed140128 719d_signbit=''
983dbef6 720d_sigprocmask=''
b4eb6b3d 721d_sigsetjmp=''
5f106f9c 722usesitecustomize=''
4f5da3e9
SP
723d_snprintf=''
724d_vsnprintf=''
49a78c82 725d_sockatmark=''
2ef53570 726d_sockatmarkproto=''
122b9bf4 727d_ip_mreq=''
3e06601f 728d_ip_mreq_source=''
18126d98 729d_ipv6_mreq=''
3e06601f 730d_ipv6_mreq_source=''
b4eb6b3d
JH
731d_msg_ctrunc=''
732d_msg_dontroute=''
733d_msg_oob=''
734d_msg_peek=''
735d_msg_proxy=''
736d_oldsock=''
737d_scm_rights=''
f53580fe 738d_sin6_scope_id=''
18126d98 739d_sockaddr_in6=''
b8677e3b 740d_sockaddr_sa_len=''
b4eb6b3d
JH
741d_socket=''
742d_sockpair=''
743sockethdr=''
744socketlib=''
745d_socklen_t=''
746d_socks5_init=''
360321b3 747d_sprintf_returns_strlen=''
b4eb6b3d 748d_sqrtl=''
10bc17b6
JH
749d_srand48_r=''
750srand48_r_proto=''
751d_srandom_r=''
752srandom_r_proto=''
eef837ea 753d_sresgproto=''
640374d0 754d_sresuproto=''
b4eb6b3d
JH
755d_statblks=''
756d_statfs_f_flags=''
757d_statfs_s=''
17a6c8e3
AD
758d_static_inline=''
759perl_static_inline=''
b4eb6b3d
JH
760d_fstatvfs=''
761d_statvfs=''
762d_stdio_cnt_lval=''
763d_stdio_ptr_lval=''
a7ffa9b9
NC
764d_stdio_ptr_lval_nochange_cnt=''
765d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
766d_stdiobase=''
767d_stdstdio=''
768stdio_base=''
769stdio_bufsiz=''
770stdio_cnt=''
771stdio_filbuf=''
772stdio_ptr=''
773d_index=''
774d_strchr=''
775d_strcoll=''
776d_strctcpy=''
777d_strerrm=''
778d_strerror=''
779d_sysernlst=''
780d_syserrlst=''
10bc17b6
JH
781d_strerror_r=''
782strerror_r_proto=''
b3c85772 783d_strftime=''
08c92000
MB
784d_strlcat=''
785d_strlcpy=''
b4eb6b3d
JH
786d_strtod=''
787d_strtol=''
788d_strtold=''
789d_strtoll=''
28e5dec8 790d_strtoq=''
b4eb6b3d
JH
791d_strtoul=''
792d_strtoull=''
793d_strtouq=''
794d_strxfrm=''
795d_symlink=''
796d_syscall=''
2ef53570 797d_syscallproto=''
b4eb6b3d
JH
798d_sysconf=''
799d_system=''
800d_tcgetpgrp=''
801d_tcsetpgrp=''
802d_telldirproto=''
803d_time=''
804timetype=''
96938616
MB
805d_asctime64=''
806d_ctime64=''
807d_difftime64=''
808d_gmtime64=''
809d_localtime64=''
810d_mktime64=''
cbb9e8a7 811d_timegm=''
b4eb6b3d
JH
812clocktype=''
813d_times=''
10bc17b6
JH
814d_tmpnam_r=''
815tmpnam_r_proto=''
b4eb6b3d 816d_truncate=''
10bc17b6
JH
817d_ttyname_r=''
818ttyname_r_proto=''
b4eb6b3d 819d_tzname=''
4e0554ec
JH
820d_u32align=''
821d_ualarm=''
b4eb6b3d
JH
822d_umask=''
823d_semctl_semid_ds=''
824d_semctl_semun=''
825d_union_semun=''
758a5d79 826d_unordered=''
bdf33aa7 827d_unsetenv=''
4e0554ec 828d_usleep=''
2ef53570 829d_usleepproto=''
b4eb6b3d 830d_ustat=''
233e16ce 831d_pseudofork=''
b4eb6b3d
JH
832d_vfork=''
833usevfork=''
834d_voidsig=''
835signal_t=''
836d_volatile=''
837d_charvspr=''
838d_vprintf=''
839d_wait4=''
840d_waitpid=''
841d_wcstombs=''
842d_wctomb=''
4e0554ec 843d_writev=''
b4eb6b3d 844dlext=''
f1ce3bf1 845bin_ELF=''
85e6fe83
LW
846cccdlflags=''
847ccdlflags=''
2304df62 848dlsrc=''
232e078e 849ld=''
9ec4dadf 850ld_can_script=''
85e6fe83 851lddlflags=''
2304df62 852usedl=''
b4eb6b3d 853doublesize=''
9d1a8da0 854bootstrap_charset=''
b4eb6b3d
JH
855ebcdic=''
856fflushNULL=''
857fflushall=''
858fpossize=''
859fpostype=''
2d736872 860gccansipedantic=''
5b463ca7 861gccosandvers=''
8a27cf78 862gccversion=''
b4eb6b3d
JH
863gidformat=''
864gidsign=''
865gidsize=''
866gidtype=''
867groupstype=''
868h_fcntl=''
869h_sysfile=''
6e1038e0
MB
870html1dir=''
871html1direxp=''
872installhtml1dir=''
873html3dir=''
874html3direxp=''
875installhtml3dir=''
b4eb6b3d 876i_arpainet=''
c0bacbef 877i_assert=''
10bc17b6 878i_crypt=''
b4eb6b3d
JH
879db_hashtype=''
880db_prefixtype=''
640374d0
JH
881db_version_major=''
882db_version_minor=''
883db_version_patch=''
b4eb6b3d
JH
884i_db=''
885i_dbm=''
886i_rpcsvcdbm=''
887d_dirnamlen=''
888direntrytype=''
889i_dirent=''
a0d0e21e 890i_dld=''
b4eb6b3d
JH
891i_dlfcn=''
892i_fcntl=''
893i_float=''
758a5d79
JH
894i_fp=''
895i_fp_class=''
b4eb6b3d
JH
896i_gdbm=''
897d_grpasswd=''
898i_grp=''
b4eb6b3d
JH
899i_ieeefp=''
900i_inttypes=''
2765b840 901i_langinfo=''
b4eb6b3d
JH
902i_libutil=''
903i_limits=''
904i_locale=''
905i_machcthr=''
906i_malloc=''
1cd66f7c 907i_mallocmalloc=''
b4eb6b3d
JH
908i_math=''
909i_memory=''
910i_mntent=''
e74475c7
MHM
911d_gdbm_ndbm_h_uses_prototypes=''
912d_gdbmndbm_h_uses_prototypes=''
a33f2d9f 913d_ndbm=''
e74475c7 914d_ndbm_h_uses_prototypes=''
a33f2d9f
AD
915i_gdbm_ndbm=''
916i_gdbmndbm=''
b4eb6b3d
JH
917i_ndbm=''
918i_netdb=''
919i_neterrno=''
920i_netinettcp=''
921i_niin=''
922i_sysin=''
923i_poll=''
924i_prot=''
925i_pthread=''
926d_pwage=''
927d_pwchange=''
928d_pwclass=''
929d_pwcomment=''
930d_pwexpire=''
931d_pwgecos=''
932d_pwpasswd=''
933d_pwquota=''
934i_pwd=''
935i_sfio=''
936i_shadow=''
937i_socks=''
bd31be4b 938i_stdbool=''
b4eb6b3d
JH
939i_stddef=''
940i_stdlib=''
941i_string=''
942strings=''
943i_sunmath=''
944i_sysaccess=''
945i_sysdir=''
946i_sysfile=''
947d_voidtty=''
948i_bsdioctl=''
949i_sysfilio=''
950i_sysioctl=''
951i_syssockio=''
952i_syslog=''
953i_sysmman=''
954i_sysmode=''
955i_sysmount=''
956i_sysndir=''
957i_sysparam=''
216dac04 958i_syspoll=''
b4eb6b3d
JH
959i_sysresrc=''
960i_syssecrt=''
961i_sysselct=''
962i_sysstat=''
963i_sysstatfs=''
964i_sysstatvfs=''
965i_systimes=''
966i_systypes=''
967i_sysuio=''
968i_sysun=''
969i_sysutsname=''
970i_sysvfs=''
971i_syswait=''
972i_sgtty=''
973i_termio=''
974i_termios=''
14b90194
JH
975d_tm_tm_gmtoff=''
976d_tm_tm_zone=''
b4eb6b3d
JH
977i_systime=''
978i_systimek=''
979i_time=''
980timeincl=''
981i_unistd=''
982i_ustat=''
983i_utime=''
984i_values=''
985i_stdarg=''
986i_varargs=''
987i_varhdr=''
988i_vfork=''
f3f1a2d8 989d_inc_version_list=''
b4eb6b3d
JH
990inc_version_list=''
991inc_version_list_init=''
992installprefix=''
993installprefixexp=''
994installstyle=''
995installusrbinperl=''
996intsize=''
997longsize=''
998shortsize=''
4b661809 999issymlink=''
2304df62 1000libc=''
b4eb6b3d
JH
1001ldlibpthname=''
1002libperl=''
1003shrpenv=''
1004useshrplib=''
a0d0e21e 1005glibpth=''
2304df62 1006libpth=''
8e07c86e 1007loclibpth=''
2304df62
AD
1008plibpth=''
1009xlibpth=''
1cfa4ec7 1010ignore_versioned_solibs=''
2304df62 1011libs=''
43999f95
JH
1012libsdirs=''
1013libsfiles=''
1014libsfound=''
13b3f787 1015libspath=''
85e6fe83 1016lns=''
b4eb6b3d
JH
1017d_PRIEUldbl=''
1018d_PRIFUldbl=''
1019d_PRIGUldbl=''
1020d_PRIeldbl=''
1021d_PRIfldbl=''
1022d_PRIgldbl=''
1023d_SCNfldbl=''
1024sPRIEUldbl=''
1025sPRIFUldbl=''
1026sPRIGUldbl=''
1027sPRIeldbl=''
1028sPRIfldbl=''
1029sPRIgldbl=''
1030sSCNfldbl=''
1031lseeksize=''
1032lseektype=''
d620c7b3 1033mad=''
00e74f14
NC
1034madlyh=''
1035madlyobj=''
1036madlysrc=''
f3f1a2d8
MB
1037make_set_make=''
1038d_mymalloc=''
1039freetype=''
b4eb6b3d
JH
1040mallocobj=''
1041mallocsrc=''
1042malloctype=''
9df442c2 1043usemallocwrap=''
b4eb6b3d
JH
1044usemymalloc=''
1045installman1dir=''
1046man1dir=''
1047man1direxp=''
1048man1ext=''
1049installman3dir=''
1050man3dir=''
1051man3direxp=''
1052man3ext=''
1053modetype=''
1054multiarch=''
1055mydomain=''
1056myhostname=''
1057phostname=''
2304df62
AD
1058c=''
1059n=''
b4eb6b3d
JH
1060d_eofnblk=''
1061eagain=''
1062o_nonblock=''
1063rd_nodata=''
2cc61e15 1064need_va_copy=''
b4eb6b3d
JH
1065netdb_hlen_type=''
1066netdb_host_type=''
1067netdb_name_type=''
1068netdb_net_type=''
1069groupcat=''
1070hostcat=''
1071passcat=''
1072orderlib=''
1073ranlib=''
1074d_perl_otherlibdirs=''
1075otherlibdirs=''
2304df62
AD
1076package=''
1077spackage=''
b4eb6b3d
JH
1078pager=''
1079api_revision=''
1080api_subversion=''
1081api_version=''
1082api_versionstring=''
1083patchlevel=''
151e6568 1084perl_patchlevel=''
b4eb6b3d
JH
1085revision=''
1086subversion=''
1087version=''
861eb78d 1088version_patchlevel_string=''
b4eb6b3d
JH
1089perl5=''
1090perladmin=''
91f55cc7 1091perlpath=''
b4eb6b3d 1092d_nv_preserves_uv=''
f607920a 1093d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1094i16size=''
1095i16type=''
1096i32size=''
1097i32type=''
1098i64size=''
1099i64type=''
1100i8size=''
1101i8type=''
1102ivsize=''
1103ivtype=''
b68c599a 1104nv_overflows_integers_at=''
4137585d 1105nv_preserves_uv_bits=''
b4eb6b3d
JH
1106nvsize=''
1107nvtype=''
1108u16size=''
1109u16type=''
1110u32size=''
1111u32type=''
1112u64size=''
1113u64type=''
1114u8size=''
1115u8type=''
1116uvsize=''
1117uvtype=''
1118ivdformat=''
1119nvEUformat=''
1120nvFUformat=''
1121nvGUformat=''
1122nveformat=''
1123nvfformat=''
1124nvgformat=''
1125uvXUformat=''
1126uvoformat=''
1127uvuformat=''
1128uvxformat=''
1129pidtype=''
1130prefix=''
1131prefixexp=''
1132installprivlib=''
1133privlib=''
1134privlibexp=''
1135prototype=''
1136ptrsize=''
1137d_PRIXU64=''
1138d_PRId64=''
1139d_PRIi64=''
1140d_PRIo64=''
1141d_PRIu64=''
1142d_PRIx64=''
1143sPRIXU64=''
1144sPRId64=''
1145sPRIi64=''
1146sPRIo64=''
1147sPRIu64=''
1148sPRIx64=''
1149d_quad=''
1150quadkind=''
1151quadtype=''
1152uquadtype=''
1153drand01=''
1154randbits=''
1155randfunc=''
1156randseedtype=''
1157seedfunc=''
1158installscript=''
1159scriptdir=''
1160scriptdirexp=''
1161selectminbits=''
1162selecttype=''
8ff267be 1163sh=''
b4eb6b3d
JH
1164sig_count=''
1165sig_name=''
1166sig_name_init=''
1167sig_num=''
1168sig_num_init=''
76d3c696 1169sig_size=''
f3f1a2d8 1170d_sitearch=''
b4eb6b3d
JH
1171installsitearch=''
1172sitearch=''
1173sitearchexp=''
1174installsitebin=''
1175sitebin=''
1176sitebinexp=''
8d2cbf27
JH
1177installsitehtml1dir=''
1178sitehtml1dir=''
1179sitehtml1direxp=''
1180installsitehtml3dir=''
1181sitehtml3dir=''
1182sitehtml3direxp=''
b4eb6b3d
JH
1183installsitelib=''
1184sitelib=''
1185sitelib_stem=''
1186sitelibexp=''
91e123a8
JH
1187installsiteman1dir=''
1188siteman1dir=''
1189siteman1direxp=''
1190installsiteman3dir=''
1191siteman3dir=''
1192siteman3direxp=''
b4eb6b3d
JH
1193siteprefix=''
1194siteprefixexp=''
6e1038e0
MB
1195installsitescript=''
1196sitescript=''
1197sitescriptexp=''
b4eb6b3d
JH
1198sizesize=''
1199sizetype=''
a0d0e21e 1200so=''
b4eb6b3d 1201socksizetype=''
2304df62
AD
1202sharpbang=''
1203shsharp=''
1204spitshell=''
dfe9444c 1205src=''
b4eb6b3d 1206ssizetype=''
668fdbe1
MB
1207st_ino_sign=''
1208st_ino_size=''
b4eb6b3d 1209startperl=''
2304df62 1210startsh=''
b4eb6b3d
JH
1211stdchar=''
1212d_stdio_stream_array=''
1213stdio_stream_array=''
1214sysman=''
81c4fd9e
MB
1215sGMTIME_max=''
1216sGMTIME_min=''
73e6e416
MB
1217sLOCALTIME_max=''
1218sLOCALTIME_min=''
5ff3f7a4 1219trnl=''
b4eb6b3d
JH
1220uidformat=''
1221uidsign=''
1222uidsize=''
1223uidtype=''
1224archname64=''
1225use64bitall=''
1226use64bitint=''
34f1896b
MB
1227dtrace=''
1228usedtrace=''
15b61c98 1229usefaststdio=''
d78f9ffa 1230usekernprocpathname=''
b4eb6b3d
JH
1231ccflags_uselargefiles=''
1232ldflags_uselargefiles=''
1233libswanted_uselargefiles=''
1234uselargefiles=''
1235uselongdouble=''
1236usemorebits=''
1237usemultiplicity=''
2304df62 1238nm_opt=''
40a7a20a 1239nm_so_opt=''
2304df62
AD
1240runnm=''
1241usenm=''
ae60cb46 1242usensgetexecutablepath=''
b4eb6b3d 1243useperlio=''
29209bc5 1244usesocks=''
b4eb6b3d
JH
1245d_oldpthreads=''
1246use5005threads=''
1247useithreads=''
9514c62b 1248usereentrant=''
b4eb6b3d 1249usethreads=''
2304df62 1250incpath=''
2304df62
AD
1251mips_type=''
1252usrinc=''
d03b3b00 1253vaproto=''
b4eb6b3d
JH
1254d_vendorarch=''
1255installvendorarch=''
1256vendorarch=''
1257vendorarchexp=''
1258d_vendorbin=''
1259installvendorbin=''
1260vendorbin=''
1261vendorbinexp=''
8d2cbf27
JH
1262installvendorhtml1dir=''
1263vendorhtml1dir=''
1264vendorhtml1direxp=''
1265installvendorhtml3dir=''
1266vendorhtml3dir=''
1267vendorhtml3direxp=''
b4eb6b3d
JH
1268d_vendorlib=''
1269installvendorlib=''
1270vendorlib=''
1271vendorlib_stem=''
1272vendorlibexp=''
91e123a8
JH
1273installvendorman1dir=''
1274vendorman1dir=''
1275vendorman1direxp=''
1276installvendorman3dir=''
1277vendorman3dir=''
1278vendorman3direxp=''
b4eb6b3d
JH
1279usevendorprefix=''
1280vendorprefix=''
1281vendorprefixexp=''
6e1038e0
MB
1282d_vendorscript=''
1283installvendorscript=''
1284vendorscript=''
1285vendorscriptexp=''
d56c5707 1286versiononly=''
b4eb6b3d
JH
1287defvoidused=''
1288voidflags=''
3659ebf1
JH
1289yacc=''
1290yaccflags=''
2304df62
AD
1291CONFIG=''
1292
34f1896b 1293: Detect odd OSs
ecfc5424
AD
1294define='define'
1295undef='undef'
1296smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1297rmlist=''
1298
1299: We must find out about Eunice early
1300eunicefix=':'
1301if test -f /etc/unixtovms; then
1302 eunicefix=/etc/unixtovms
1303fi
1304if test -f /etc/unixtovms.exe; then
1305 eunicefix=/etc/unixtovms.exe
1306fi
1307
cfb04860 1308: Set executable suffix now -- needed before hints available
6153ba32
PG
1309if test -f "/libs/version.library"; then
1310: Amiga OS
1311 _exe=""
1312elif test -f "/system/gnu_library/bin/ar.pm"; then
1313: Stratus VOS
cfb04860 1314 _exe=".pm"
6153ba32
PG
1315elif test -n "$DJGPP"; then
1316: DOS DJGPP
cfb04860 1317 _exe=".exe"
5c728af0 1318elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1319: OS/2 or cygwin
ba863942
JH
1320 _exe=".exe"
1321fi
868439a2 1322
1d8eaf8c 1323groupstype=''
b4eb6b3d 1324i_whoami=''
06501368
MB
1325: Trailing extension. Override this in a hint file, if needed.
1326: Extra object files, if any, needed on this platform.
1327archobjs=''
b8677e3b
MB
1328archname=''
1329: Possible local include directories to search.
1330: Set locincpth to "" in a hint file to defeat local include searches.
1331locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1332locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1333:
1334: no include file wanted by default
1335inclwanted=''
1336
1337: Enable -DEBUGGING and -DDEBUGGING from the command line
1338EBUGGING=''
356123f1 1339DEBUGGING=''
b8677e3b 1340
64615a5e 1341libnames=''
732c9516
JH
1342: change the next line if compiling for Xenix/286 on Xenix/386
1343xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1344: Possible local library directories to search.
1345loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1346loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1347
1348: general looking path for locating libraries
5869b1f1 1349glibpth="/lib /usr/lib $xlibpth"
732c9516 1350glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1351test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1352test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1353test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1354
1355: Private path used by Configure to find libraries. Its value
1356: is prepended to libpth. This variable takes care of special
1357: machines, like the mips. Usually, it should be empty.
1358plibpth=''
1359
1cfa4ec7
GS
1360: default library list
1361libswanted=''
921b2963 1362: some systems want to use only the non-versioned libso:s
1cfa4ec7 1363ignore_versioned_solibs=''
06501368
MB
1364: set usethreads on the Configure command line to enable threads.
1365usereentrant='undef'
ed140128
AD
1366: full support for void wanted by default
1367defvoidused=15
1368
ed140128
AD
1369ccname=''
1370ccversion=''
1371perllibs=''
1372: set useposix=false in your hint file to disable the POSIX extension.
1373useposix=true
1374: set useopcode=false in your hint file to disable the Opcode extension.
1375useopcode=true
b4eb6b3d
JH
1376archname64=''
1377ccflags_uselargefiles=''
1378ldflags_uselargefiles=''
1379libswanted_uselargefiles=''
1380: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1381: set usesocks on the Configure command line to enable socks.
ecfc5424 1382: List of libraries we want.
15431986 1383: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef 1384libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
8119684f 1385libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1386: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1387: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1388glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1389glibpth="/usr/shlib $glibpth"
1390: Do not use vfork unless overridden by a hint file.
1391usevfork=false
1392
8ff267be 1393: Find the basic shell for Bourne shell scripts
1394case "$sh" in
1395'')
8ff267be 1396 case "$SYSTYPE" in
1397 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1398 *) xxx='/bin/sh';;
1399 esac
1400 if test -f "$xxx"; then
1401 sh="$xxx"
1402 else
1403 : Build up a list and do a single loop so we can 'break' out.
1404 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1405 for xxx in sh bash ksh pdksh ash; do
1406 for p in $pth; do
1407 try="$try ${p}/${xxx}"
1408 done
1409 done
1410 for xxx in $try; do
1411 if test -f "$xxx"; then
1412 sh="$xxx";
8ff267be 1413 break
a5a94ea5
JH
1414 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1415 sh="$xxx";
1416 break
8ff267be 1417 elif test -f "$xxx.exe"; then
1418 sh="$xxx";
8ff267be 1419 break
1420 fi
1421 done
1422 fi
1423 ;;
1424esac
1425
1426case "$sh" in
a33c94aa 1427'') cat >&2 <<EOM
8ff267be 1428$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1429
8ff267be 1430Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1431Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1432we'll try to straighten this all out.
8ff267be 1433EOM
1434 exit 1
1435 ;;
1436esac
1437
760ac839 1438: see if sh knows # comments
73614538 1439if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1440 shsharp=true
1441 spitshell=cat
760ac839 1442 xcat=/bin/cat
a931254c
JH
1443 test -f $xcat$_exe || xcat=/usr/bin/cat
1444 if test ! -f $xcat$_exe; then
4bdb8fb5 1445 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1446 if test -f $p/cat$_exe; then
1deb0a86 1447 xcat=$p/cat
3c728e00
JH
1448 break
1449 fi
1450 done
1deb0a86
JH
1451 if test ! -f $xcat$_exe; then
1452 echo "Can't find cat anywhere!"
3c728e00
JH
1453 exit 1
1454 fi
1455 fi
5440bc8e
JH
1456 echo "#!$xcat" >sharp
1457 $eunicefix sharp
1458 chmod +x sharp
1d8eaf8c 1459 ./sharp > today 2>/dev/null
760ac839 1460 if test -s today; then
760ac839
LW
1461 sharpbang='#!'
1462 else
5440bc8e
JH
1463 echo "#! $xcat" > sharp
1464 $eunicefix sharp
1465 chmod +x sharp
1d8eaf8c 1466 ./sharp > today 2>/dev/null
760ac839 1467 if test -s today; then
760ac839
LW
1468 sharpbang='#! '
1469 else
760ac839
LW
1470 sharpbang=': use '
1471 fi
1472 fi
1473else
dfe9444c 1474 echo " "
8ff267be 1475 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1476 shsharp=false
1477 cd ..
1478 echo "exec grep -v '^[ ]*#'" >spitshell
1479 chmod +x spitshell
1480 $eunicefix spitshell
1481 spitshell=`pwd`/spitshell
1482 cd UU
1483 echo "I presume that if # doesn't work, #! won't work either!"
1484 sharpbang=': use '
1485fi
5440bc8e 1486rm -f sharp today
760ac839
LW
1487
1488: figure out how to guarantee sh startup
8ff267be 1489case "$startsh" in
1490'') startsh=${sharpbang}${sh} ;;
1491*)
760ac839 1492esac
5440bc8e 1493cat >sharp <<EOSS
760ac839
LW
1494$startsh
1495set abc
1496test "$?abc" != 1
1497EOSS
1498
5440bc8e
JH
1499chmod +x sharp
1500$eunicefix sharp
1501if ./sharp; then
8ff267be 1502 : echo "Yup, it does."
760ac839 1503else
dfe9444c
AD
1504 echo "Hmm... '$startsh' does not guarantee sh startup..."
1505 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1506fi
5440bc8e 1507rm -f sharp
760ac839 1508
aebf16e7
AD
1509: Save command line options in file UU/cmdline.opt for later use in
1510: generating config.sh.
1511cat > cmdline.opt <<EOSH
613d6c3e 1512: Configure command line arguments.
aebf16e7
AD
1513config_arg0='$0'
1514config_args='$*'
1515config_argc=$#
1516EOSH
1517argn=1
ee45ea83
IZ
1518args_exp=''
1519args_sep=''
aebf16e7
AD
1520for arg in "$@"; do
1521 cat >>cmdline.opt <<EOSH
1522config_arg$argn='$arg'
1523EOSH
ee45ea83
IZ
1524 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1525$arg
1526EOC
1527 arg_exp=`cat cmdl.opt`
1528 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1529 argn=`expr $argn + 1`
ee45ea83 1530 args_sep=' '
aebf16e7 1531done
ee45ea83 1532rm -f cmdl.opt
aebf16e7 1533
2304df62
AD
1534: produce awk script to parse command line options
1535cat >options.awk <<'EOF'
1536BEGIN {
02e93a22 1537 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1538
1539 len = length(optstr);
1540 for (i = 1; i <= len; i++) {
1541 c = substr(optstr, i, 1);
1542 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1543 if (a == ":") {
1544 arg[c] = 1;
1545 i++;
1546 }
1547 opt[c] = 1;
1548 }
1549}
1550{
1551 expect = 0;
1552 str = $0;
1553 if (substr(str, 1, 1) != "-") {
1554 printf("'%s'\n", str);
1555 next;
1556 }
1557 len = length($0);
1558 for (i = 2; i <= len; i++) {
1559 c = substr(str, i, 1);
1560 if (!opt[c]) {
1561 printf("-%s\n", substr(str, i));
1562 next;
1563 }
1564 printf("-%s\n", c);
1565 if (arg[c]) {
1566 if (i < len)
1567 printf("'%s'\n", substr(str, i + 1));
1568 else
1569 expect = 1;
1570 next;
1571 }
1572 }
1573}
1574END {
1575 if (expect)
1576 print "?";
1577}
1578EOF
1579
1580: process the command line options
4633a7c4
LW
1581set X `for arg in "$@"; do echo "X$arg"; done |
1582 sed -e s/X// | awk -f options.awk`
2304df62
AD
1583eval "set $*"
1584shift
1585rm -f options.awk
1586
1587: set up default values
1588fastread=''
1589reuseval=false
1590config_sh=''
1591alldone=''
1592error=''
1593silent=''
1594extractsh=''
ecfc5424 1595override=''
16d20bd9 1596knowitall=''
02e93a22 1597rm -f optdef.sh posthint.sh
28757baa 1598cat >optdef.sh <<EOS
1599$startsh
1600EOS
2304df62 1601
dfe9444c 1602
2304df62
AD
1603: option parsing
1604while test $# -gt 0; do
1605 case "$1" in
1606 -d) shift; fastread=yes;;
1607 -e) shift; alldone=cont;;
1608 -f)
1609 shift
1610 cd ..
1611 if test -r "$1"; then
1612 config_sh="$1"
1613 else
a0d0e21e 1614 echo "$me: cannot read config file $1." >&2
2304df62
AD
1615 error=true
1616 fi
1617 cd UU
1618 shift;;
3f30fabf 1619 --help|\
2304df62
AD
1620 -h) shift; error=true;;
1621 -r) shift; reuseval=true;;
dfe9444c 1622 -s) shift; silent=true; realsilent=true;;
2304df62 1623 -E) shift; alldone=exit;;
16d20bd9 1624 -K) shift; knowitall=true;;
ecfc5424 1625 -O) shift; override=true;;
dfe9444c 1626 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1627 -D)
1628 shift
1629 case "$1" in
1630 *=)
1631 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1632 echo "$me: ignoring -D $1" >&2
1633 ;;
ecfc5424 1634 *=*) echo "$1" | \
1aef975c
AD
1635 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1636 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1637 esac
1638 shift
1639 ;;
1640 -U)
1641 shift
1642 case "$1" in
1aef975c 1643 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1644 *=*)
1645 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1646 echo "$me: ignoring -U $1" >&2
1647 ;;
1aef975c 1648 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1649 esac
1650 shift
1651 ;;
02e93a22
JH
1652 -A)
1653 shift
1654 xxx=''
1655 yyy="$1"
02e93a22 1656 zzz=''
5f83a3e9 1657 uuu=undef
02e93a22 1658 case "$yyy" in
f7c31117 1659 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1660 case "$zzz" in
1661 *:*) zzz='' ;;
1662 *) xxx=append
613d6c3e 1663 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
f7c31117 1664 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1665 esac
1666 ;;
1667 esac
1668 case "$xxx" in
1669 '') case "$yyy" in
f7c31117
JH
1670 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1671 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1672 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1673 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1674 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1675 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9 1676 esac
613d6c3e 1677 ;;
5f83a3e9 1678 esac
02e93a22
JH
1679 case "$xxx" in
1680 append)
5f83a3e9 1681 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1682 clear)
5f83a3e9 1683 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1684 define)
1685 case "$zzz" in
1686 '') zzz=define ;;
1687 esac
5f83a3e9 1688 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1689 eval)
5f83a3e9 1690 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1691 prepend)
5f83a3e9 1692 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1693 undef)
1694 case "$zzz" in
1695 '') zzz="$uuu" ;;
1696 esac
5f83a3e9
JH
1697 echo "$yyy=$zzz" >> posthint.sh ;;
1698 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1699 esac
bde6b06b 1700 shift
02e93a22 1701 ;;
216dac04 1702 -V) echo "$me generated by metaconfig 3.5 PL0." >&2
5f83a3e9 1703 exit 0;;
2304df62 1704 --) break;;
a0d0e21e 1705 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1706 *) break;;
1707 esac
1708done
1709
1710case "$error" in
1711true)
1712 cat >&2 <<EOM
2afac517 1713Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1714 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1715 -d : use defaults for all answers.
1716 -e : go on without questioning past the production of config.sh.
1717 -f : specify an alternate default configuration file.
1718 -h : print this help message and exit (with an error status).
1719 -r : reuse C symbols value if possible (skips costly nm extraction).
1720 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1721 -D : define symbol to have some value:
1722 -D symbol symbol gets the value 'define'
1723 -D symbol=value symbol gets the value 'value'
3f30fabf
MB
1724 common used examples (see INSTALL for more info):
1725 -Duse64bitint use 64bit integers
b79e0b55 1726 -Duse64bitall use 64bit integers and pointers
3f30fabf 1727 -Dusethreads use thread support
b79e0b55 1728 -Dinc_version_list=none do not include older perl trees in @INC
3f30fabf
MB
1729 -DEBUGGING=none DEBUGGING options
1730 -Dcc=gcc choose your compiler
1731 -Dprefix=/opt/perl5 choose your destination
2304df62 1732 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1733 -K : do not use unless you know what you are doing.
ecfc5424 1734 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1735 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1736 -U : undefine symbol:
1737 -U symbol symbol gets the value 'undef'
1738 -U symbol= symbol gets completely empty
3f30fabf 1739 e.g.: -Uversiononly
02e93a22 1740 -A : manipulate symbol after the platform specific hints have been applied:
2ac814f3
MB
1741 -A append:symbol=value append value to symbol
1742 -A symbol=value like append:, but with a separating space
1743 -A define:symbol=value define symbol to have value
1744 -A clear:symbol define symbol to be ''
1745 -A define:symbol define symbol to be 'define'
1746 -A eval:symbol=value define symbol to be eval of value
1747 -A prepend:symbol=value prepend value to symbol
1748 -A undef:symbol define symbol to be 'undef'
1749 -A undef:symbol= define symbol to be ''
3f30fabf 1750 e.g.: -A prepend:libswanted='cl pthread '
2ac814f3 1751 -A ccflags=-DSOME_MACRO
2304df62
AD
1752 -V : print version number and exit (with a zero status).
1753EOM
1754 exit 1
1755 ;;
1756esac
1757
dfe9444c
AD
1758: Sanity checks
1759case "$fastread$alldone" in
1760yescont|yesexit) ;;
1761*)
aaeb8e51
GS
1762 case "$extractsh" in
1763 true) ;;
1764 *)
1765 if test ! -t 0; then
1766 echo "Say 'sh Configure', not 'sh <Configure'"
1767 exit 1
1768 fi
1769 ;;
1770 esac
dfe9444c
AD
1771 ;;
1772esac
1773
2304df62
AD
1774exec 4>&1
1775case "$silent" in
1776true) exec 1>/dev/null;;
1777esac
1778
ecfc5424 1779: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1780touch optdef.sh
1781. ./optdef.sh
02e93a22
JH
1782: create the posthint manipulation script and leave the file out there...
1783touch posthint.sh
a0d0e21e 1784
2304df62 1785: set package name
34f1896b 1786package='perl5'
b4eb6b3d
JH
1787first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1788last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1789case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1790ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1791*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1792esac
2304df62 1793
2304df62
AD
1794: Some greps do not return status, grrr.
1795echo "grimblepritz" >grimble
1796if grep blurfldyick grimble >/dev/null 2>&1 ; then
1797 contains=contains
1798elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1799 contains=grep
1800else
1801 contains=contains
1802fi
1803rm -f grimble
1804: the following should work in any shell
1805case "$contains" in
1806contains*)
1807 echo " "
1808 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1809 cat >contains <<'EOSS'
1810grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1811EOSS
1812chmod +x contains
1813esac
1814
dfe9444c
AD
1815: Find the path to the source tree
1816case "$src" in
1817'') case "$0" in
b233458b
JH
1818 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1819 case "$src" in
1820 /*) ;;
8504afb7 1821 .) ;;
b233458b
JH
1822 *) src=`cd ../$src && pwd` ;;
1823 esac
1824 ;;
dfe9444c
AD
1825 *) src='.';;
1826 esac;;
1827esac
1828case "$src" in
1829'') src=/
1830 rsrc=/
1831 ;;
34f1896b
MB
1832/*) rsrc="$src";;
1833*) rsrc="../$src";;
dfe9444c
AD
1834esac
1835if test -f $rsrc/Configure && \
34f1896b 1836 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
dfe9444c
AD
1837then
1838 : found it, so we are ok.
1839else
1840 rsrc=''
1841 for src in . .. ../.. ../../.. ../../../..; do
1842 if test -f ../$src/Configure && \
1843 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1844 then
1845 rsrc=../$src
1846 break
1847 fi
1848 done
1849fi
1850case "$rsrc" in
1851'')
1852 cat <<EOM >&4
1853
1854Sorry, I can't seem to locate the source dir for $package. Please start
1855Configure with an explicit path -- i.e. /some/path/Configure.
1856
1857EOM
1858 exit 1
1859 ;;
1860../.) rsrc='..';;
1861*)
1862 echo " "
1863 echo "Sources for $package found in \"$src\"." >&4
1864 ;;
1865esac
1866
1867: script used to extract .SH files with variable substitutions
1868cat >extract <<'EOS'
a02608de 1869PERL_CONFIG_SH=true
dfe9444c 1870echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1871if test -f MANIFEST; then
1872 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1873else
1874 echo "(Looking for .SH files under the source directory.)"
6904989c 1875 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1876fi
1877shift
1878case $# in
6904989c 18790) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1880esac
6904989c 1881if test ! -f "$src/$1"; then
dfe9444c
AD
1882 shift
1883fi
1884mkdir_p='
1885name=$1;
1886create="";
1887while test $name; do
1888 if test ! -d "$name"; then
1889 create="$name $create";
1890 name=`echo $name | sed -e "s|^[^/]*$||"`;
1891 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1892 else
1893 name="";
1894 fi;
1895done;
1896for file in $create; do
1897 mkdir $file;
1898done
1899'
1900for file in $*; do
1901 case "$src" in
1902 ".")
1903 case "$file" in
1904 */*)
1905 dir=`expr X$file : 'X\(.*\)/'`
1906 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1907 (cd "$dir" && . ./$file)
dfe9444c
AD
1908 ;;
1909 *)
1910 . ./$file
1911 ;;
1912 esac
1913 ;;
1914 *)
1915 case "$file" in
1916 */*)
1917 dir=`expr X$file : 'X\(.*\)/'`
1918 file=`expr X$file : 'X.*/\(.*\)'`
1919 (set x $dir; shift; eval $mkdir_p)
6904989c 1920 sh <"$src/$dir/$file"
dfe9444c
AD
1921 ;;
1922 *)
6904989c 1923 sh <"$src/$file"
dfe9444c
AD
1924 ;;
1925 esac
1926 ;;
1927 esac
1928done
6904989c 1929if test -f "$src/config_h.SH"; then
dfe9444c
AD
1930 if test ! -f config.h; then
1931 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1932 . "$src/config_h.SH"
dfe9444c
AD
1933 fi
1934fi
1935EOS
1936
1937: extract files and exit if asked to do so
1938case "$extractsh" in
1939true)
1940 case "$realsilent" in
1941 true) ;;
1942 *) exec 1>&4;;
1943 esac
1944 case "$config_sh" in
1945 '') config_sh='config.sh';;
1946 esac
1947 echo " "
1948 echo "Fetching answers from $config_sh..."
1949 cd ..
1950 . $config_sh
1951 test "$override" && . ./optdef.sh
1952 echo " "
1953 . UU/extract
1954 rm -rf UU
24ccb310 1955 echo "Extraction done."
dfe9444c
AD
1956 exit 0
1957 ;;
1958esac
1959
1960: Eunice requires " " instead of "", can you believe it
1961echo " "
1962: Here we go...
1963echo "Beginning of configuration questions for $package."
1964
1965trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1966
2304df62
AD
1967: first determine how to suppress newline on echo command
1968echo " "
1969echo "Checking echo to see how to suppress newlines..."
1970(echo "hi there\c" ; echo " ") >.echotmp
1971if $contains c .echotmp >/dev/null 2>&1 ; then
1972 echo "...using -n."
1973 n='-n'
1974 c=''
1975else
1976 cat <<'EOM'
1977...using \c
1978EOM
1979 n=''
1980 c='\c'
1981fi
1982echo $n "The star should be here-->$c"
1983echo '*'
1984rm -f .echotmp
1985
1986: Now test for existence of everything in MANIFEST
1987echo " "
6904989c 1988if test -f "$rsrc/MANIFEST"; then
2304df62 1989 echo "First let's make sure your kit is complete. Checking..." >&4
1d8eaf8c 1990 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
776a38e3 1991 (split -l 50 2>/dev/null || split -50)
2304df62 1992 rm -f missing
dfe9444c 1993 tmppwd=`pwd`
2304df62 1994 for filelist in x??; do
776a38e3
MB
1995 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1996 >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1997 done
1998 if test -s missing; then
1999 cat missing >&4
2000 cat >&4 <<'EOM'
2001
2002THIS PACKAGE SEEMS TO BE INCOMPLETE.
2003
2004You have the option of continuing the configuration process, despite the
2005distinct possibility that your kit is damaged, by typing 'y'es. If you
2006do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 2007and contact the author (perlbug@perl.org).
2304df62
AD
2008
2009EOM
2010 echo $n "Continue? [n] $c" >&4
2011 read ans
2012 case "$ans" in
2013 y*)
2014 echo "Continuing..." >&4
2015 rm -f missing
2016 ;;
2017 *)
2018 echo "ABORTING..." >&4
2019 kill $$
2020 ;;
2021 esac
2022 else
dfe9444c 2023 echo "Looks good..."
2304df62
AD
2024 fi
2025else
2026 echo "There is no MANIFEST file. I hope your kit is complete !"
2027fi
2028rm -f missing x??
2029
5ff3f7a4 2030: Find the appropriate value for a newline for tr
613d6c3e 2031echo " "
5ff3f7a4
GS
2032if test -n "$DJGPP"; then
2033 trnl='\012'
2034fi
2035if test X"$trnl" = X; then
2036 case "`echo foo|tr '\n' x 2>/dev/null`" in
2037 foox) trnl='\n' ;;
2038 esac
2039fi
2040if test X"$trnl" = X; then
2041 case "`echo foo|tr '\012' x 2>/dev/null`" in
2042 foox) trnl='\012' ;;
2043 esac
2044fi
2045if test X"$trnl" = X; then
8be2c24c
JH
2046 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2047 fooxy) trnl='\n\r' ;;
2048 esac
2049fi
2050if test X"$trnl" = X; then
5ff3f7a4
GS
2051 cat <<EOM >&2
2052
2053$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2054
2055EOM
2056 exit 1
2057fi
2058
2304df62
AD
2059: compute the number of columns on the terminal for proper question formatting
2060case "$COLUMNS" in
2061'') COLUMNS='80';;
2062esac
2063
2064: set up the echo used in my read
2065myecho="case \"\$xxxm\" in
2066'') echo $n \"\$rp $c\" >&4;;
2067*) case \"\$rp\" in
2068 '') echo $n \"[\$xxxm] $c\";;
2069 *)
2070 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2071 echo \"\$rp\" >&4
2072 echo $n \"[\$xxxm] $c\" >&4
2073 else
2074 echo $n \"\$rp [\$xxxm] $c\" >&4
2075 fi
2076 ;;
2077 esac;;
2078esac"
2079
2080: now set up to do reads with possible shell escape and default assignment
2081cat <<EOSC >myread
28757baa 2082$startsh
2304df62
AD
2083xxxm=\$dflt
2084$myecho
2085ans='!'
2086case "\$fastread" in
2087yes) case "\$dflt" in
2088 '') ;;
2089 *) ans='';
2090 case "\$silent-\$rp" in
2091 true-) ;;
2092 *) echo " " >&4;;
2093 esac;;
2094 esac;;
2095*) case "\$silent" in
2096 true) case "\$rp" in
2097 '') ans='';;
2098 esac;;
2099 esac;;
2100esac
2101while expr "X\$ans" : "X!" >/dev/null; do
2102 read answ
2103 set x \$xxxm
2104 shift
dfe9444c 2105 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2106 case "\$answ" in
dfe9444c
AD
2107 "!")
2108 sh 1>&4
2109 echo " "
2110 $myecho
2111 ;;
2112 !*)
2113 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2114 shift
2115 sh 1>&4 -c "\$*"
2116 echo " "
2117 $myecho
2118 ;;
2304df62
AD
2119 "\$ans")
2120 case "\$ans" in
ecfc5424
AD
2121 \\&*)
2122 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2123 shift
2124 case "\$1" in
2125 -d)
2126 fastread=yes
40a7a20a 2127 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2128 ;;
2129 -*)
40a7a20a 2130 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2131 ;;
2132 esac
2133 $myecho
2134 ans=!
2135 ;;
2304df62
AD
2136 esac;;
2137 *)
2138 case "\$aok" in
2139 y)
2140 echo "*** Substitution done -- please confirm."
2141 xxxm="\$ans"
c9795ab7 2142 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2143 xxxm="\$ans"
2144 ans=!
2145 ;;
2146 *)
2147 echo "*** Error -- try again."
2148 ans=!
2149 ;;
2150 esac
2151 $myecho
2152 ;;
2153 esac
2154 case "\$ans\$xxxm\$nostick" in
2155 '')
2156 ans=!
2157 $myecho
2158 ;;
2159 esac
2160done
2161case "\$ans" in
2162'') ans="\$xxxm";;
2163esac
2164EOSC
2165
2166: create .config dir to save info across Configure sessions
2167test -d ../.config || mkdir ../.config
2168cat >../.config/README <<EOF
2169This directory created by Configure to save information that should
dfe9444c 2170persist across sessions for $package.
2304df62
AD
2171
2172You may safely delete it if you wish.
2173EOF
2174
613d6c3e 2175: See if we are using a devel version and want that
9507cadf 2176xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2177case "$usedevel" in
1be1b388
MB
2178$define|true|[yY]*)
2179 usedevel="$define" ;;
9507cadf 2180*) case "$xversion" in
0107c034
JH
2181 *[13579])
2182 cat >&4 <<EOH
2183*** WHOA THERE!!! ***
2184
2185 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2186 The version of this $package distribution is $xversion, that is, odd,
2187 (as opposed to even) and that signifies a development release.
3d5d58b1 2188 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2189
2190 Do ***NOT*** install this into production use.
2191 Data corruption and crashes are possible.
2192
2193 It is most seriously suggested that you do not continue any further
2194 unless you want to help in developing and debugging Perl.
2195
6adc6a45
JH
2196 If you *still* want to build perl, you can answer 'y' now,
2197 or pass -Dusedevel to Configure.
2198
0107c034
JH
2199EOH
2200 rp='Do you really want to continue?'
2201 dflt='n'
2202 . ./myread
2203 case "$ans" in
8feeef0e
JH
2204 [yY]) echo >&4 "Okay, continuing."
2205 usedevel="$define" ;;
0107c034
JH
2206 *) echo >&4 "Okay, bye."
2207 exit 1
2208 ;;
2209 esac
2210 ;;
2211 esac
1be1b388 2212 usedevel="$undef"
0107c034
JH
2213 ;;
2214esac
8feeef0e
JH
2215case "$usedevel" in
2216$define|true|[yY]*)
2217 case "$versiononly" in
2218 '') versiononly="$define" ;;
2219 esac
2220 case "$installusrbinperl" in
2221 '') installusrbinperl="$undef" ;;
2222 esac
2223 ;;
2224esac
0107c034 2225
2304df62
AD
2226: general instructions
2227needman=true
2228firsttime=true
760ac839 2229user=`(logname) 2>/dev/null`
dfe9444c
AD
2230case "$user" in
2231'') user=`whoami 2>&1`;;
760ac839 2232esac
2304df62
AD
2233if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2234 firsttime=false
2235 echo " "
2236 rp='Would you like to see the instructions?'
2237 dflt=n
2238 . ./myread
2239 case "$ans" in
2240 [yY]*) ;;
2241 *) needman=false;;
2242 esac
2243fi
2244if $needman; then
2245 cat <<EOH
4e2a5f63 2246
2304df62 2247This installation shell script will examine your system and ask you questions
a0d0e21e 2248to determine how the perl5 package should be installed. If you get
2304df62
AD
2249stuck on a question, you may use a ! shell escape to start a subshell or
2250execute a command. Many of the questions will have default answers in square
2251brackets; typing carriage return will give you the default.
2252
2253On some of the questions which ask for file or directory names you are allowed
2254to use the ~name construct to specify the login directory belonging to "name",
2255even if you don't have a shell which knows about that. Questions where this is
2256allowed will be marked "(~name ok)".
2257
2258EOH
2259 rp=''
2260 dflt='Type carriage return to continue'
2261 . ./myread
2262 cat <<'EOH'
2263
2264The prompter used in this script allows you to use shell variables and
2265backticks in your answers. You may use $1, $2, etc... to refer to the words
2266in the default answer, as if the default line was a set of arguments given to a
2267script shell. This means you may also use $* to repeat the whole default line,
2268so you do not have to re-type everything to add something to the default.
2269
cd95ead5 2270Every time there is a substitution, you will have to confirm. If there is an
2304df62
AD
2271error (e.g. an unmatched backtick), the default answer will remain unchanged
2272and you will be prompted again.
2273
2274If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2275the questions and use the computed defaults (or the previous answers if there
2276was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2277You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2278on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2279
2280EOH
2281 . ./myread
2282 cat <<EOH
2283
2284Much effort has been expended to ensure that this shell script will run on any
2285Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2286Configure and run it again. If you can't run Configure for some reason,
2287you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2288have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2289
2290This installation script affects things in two ways:
2291
22921) it may do direct variable substitutions on some of the files included
2293 in this kit.
22942) it builds a config.h file for inclusion in C programs. You may edit
2295 any of these files as the need arises after running this script.
2296
2297If you make a mistake on a question, there is no easy way to back up to it
2298currently. The easiest thing to do is to edit config.sh and rerun all the SH
2299files. Configure will offer to let you do this before it runs the SH files.
2300
2301EOH
2302 dflt='Type carriage return to continue'
2303 . ./myread
2304 case "$firsttime" in
2305 true) echo $user >>../.config/instruct;;
2306 esac
2307fi
2308
2304df62
AD
2309: find out where common programs are
2310echo " "
2311echo "Locating common programs..." >&4
2312cat <<EOSC >loc
2313$startsh
2314case \$# in
23150) exit 1;;
2316esac
2317thing=\$1
2318shift
2319dflt=\$1
2320shift
2321for dir in \$*; do
2322 case "\$thing" in
2323 .)
2324 if test -d \$dir/\$thing; then
2325 echo \$dir
2326 exit 0
2327 fi
2328 ;;
2329 *)
a0d0e21e 2330 for thisthing in \$dir/\$thing; do
ecfc5424 2331 : just loop through to pick last item
a0d0e21e 2332 done
25f94b33 2333 if test -f \$thisthing; then
a0d0e21e 2334 echo \$thisthing
2304df62 2335 exit 0
a5a94ea5
JH
2336 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2337 echo \$thisthing
776a38e3 2338 exit 0
2304df62 2339 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2340 if test -n "$DJGPP"; then
2341 echo \$dir/\$thing.exe
b921d661 2342 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2343 : on Eunice apparently
2344 echo \$dir/\$thing
2345 fi
2d736872 2346 exit 0
2304df62
AD
2347 fi
2348 ;;
2349 esac
2350done
2351echo \$dflt
2352exit 1
2353EOSC
2354chmod +x loc
2355$eunicefix loc
2356loclist="
2357awk
2358cat
f8006fac 2359chmod
b4eb6b3d
JH
2360comm
2361cp
2304df62
AD
2362echo
2363expr
2364grep
a0d0e21e 2365ls
b4eb6b3d 2366mkdir
2304df62
AD
2367rm
2368sed
b4eb6b3d 2369sort
85e6fe83 2370touch
2304df62 2371tr
b4eb6b3d 2372uniq
2304df62
AD
2373"
2374trylist="
dfe9444c 2375ar
3659ebf1 2376bison
b4eb6b3d 2377byacc
2304df62 2378cpp
b4eb6b3d 2379csh
2304df62
AD
2380date
2381egrep
1fef16b3 2382gmake
8ff267be 2383gzip
b4eb6b3d 2384less
8ff267be 2385ln
3c728e00 2386make
b4eb6b3d 2387more
693762b4 2388nm
b4eb6b3d 2389nroff
b8677e3b 2390perl
b4eb6b3d 2391pg
2304df62
AD
2392test
2393uname
8ff267be 2394zip
2304df62 2395"
8e07c86e 2396pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2397pth="$pth /lib /usr/lib"
2398for file in $loclist; do
dfe9444c
AD
2399 eval xxx=\$$file
2400 case "$xxx" in
2401 /*|?:[\\/]*)
2402 if test -f "$xxx"; then
2403 : ok
2404 else
2405 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2406 xxx=`./loc $file $file $pth`
2407 fi
2408 ;;
2409 '') xxx=`./loc $file $file $pth`;;
2410 *) xxx=`./loc $xxx $xxx $pth`;;
2411 esac
a5a94ea5 2412 eval $file=$xxx$_exe
2304df62
AD
2413 eval _$file=$xxx
2414 case "$xxx" in
2415 /*)
2416 echo $file is in $xxx.
2417 ;;
8e07c86e
AD
2418 ?:[\\/]*)
2419 echo $file is in $xxx.
2420 ;;
2304df62 2421 *)
25f94b33
AD
2422 echo "I don't know where '$file' is, and my life depends on it." >&4
2423 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2424 exit 1
2304df62
AD
2425 ;;
2426 esac
2427done
2428echo " "
2429echo "Don't worry if any of the following aren't found..."
2430say=offhand
2431for file in $trylist; do
dfe9444c
AD
2432 eval xxx=\$$file
2433 case "$xxx" in
2434 /*|?:[\\/]*)
2435 if test -f "$xxx"; then
2436 : ok
2437 else
2438 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2439 xxx=`./loc $file $file $pth`
2440 fi
2441 ;;
2442 '') xxx=`./loc $file $file $pth`;;
2443 *) xxx=`./loc $xxx $xxx $pth`;;
2444 esac
306a8474 2445 eval $file=$xxx$_exe
2304df62
AD
2446 eval _$file=$xxx
2447 case "$xxx" in
2448 /*)
2449 echo $file is in $xxx.
2450 ;;
8e07c86e
AD
2451 ?:[\\/]*)
2452 echo $file is in $xxx.
2453 ;;
2304df62
AD
2454 *)
2455 echo "I don't see $file out there, $say."
2456 say=either
2457 ;;
2458 esac
2459done
2460case "$egrep" in
1fef16b3 2461egrep)
2304df62
AD
2462 echo "Substituting grep for egrep."
2463 egrep=$grep
868439a2 2464 _egrep=$grep
2304df62
AD
2465 ;;
2466esac
3141af47
MB
2467case "$less" in
2468'') ;;
2469*) if $less -R </dev/null >/dev/null; then
2470 echo "Substituting less -R for less."
2471 less="$less -R"
2472 _less=$less
2473 fi
2474 ;;
2475esac
8ff267be 2476case "$ln" in
1fef16b3 2477ln)
8ff267be 2478 echo "Substituting cp for ln."
2479 ln=$cp
868439a2 2480 _ln=$cp
8ff267be 2481 ;;
2482esac
2e26f1d5 2483case "$make" in
613d6c3e 2484make)
2e26f1d5
JH
2485 case "$gmake" in
2486 gmake)
2487 echo "I can't find make or gmake, and my life depends on it." >&4
2488 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2489 exit 1
2490 ;;
2491 esac
2492 ;;
613d6c3e 2493esac
2e26f1d5
JH
2494case "$gmake" in
2495gmake) ;;
2496*) # We can't have osname yet.
1fef16b3
JH
2497 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2498 # Assume that gmake, if found, is definitely GNU make
2499 # and prefer it over the system make.
2500 echo "Substituting gmake for make."
2501 make=$gmake
868439a2 2502 _make=$gmake
1fef16b3
JH
2503 fi
2504 ;;
a5a94ea5 2505esac
2304df62
AD
2506case "$test" in
2507test)
2508 echo "Hopefully test is built into your sh."
2509 ;;
2510*)
73614538 2511 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2512 echo "Using the test built into your sh."
2304df62
AD
2513 test=test
2514 _test=test
2515 fi
2516 ;;
2517esac
2518case "$echo" in
2519echo)
2520 echo "Hopefully echo is built into your sh."
2521 ;;
2522'') ;;
2523*)
2524 echo " "
2525echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2526 $echo $n "hi there$c" >foo1
2527 echo $n "hi there$c" >foo2
2528 if cmp foo1 foo2 >/dev/null 2>&1; then
2529 echo "They are compatible. In fact, they may be identical."
2530 else
2531 case "$n" in
2532 '-n') n='' c='\c';;
2533 *) n='-n' c='';;
2534 esac
2535 cat <<FOO
2536They are not compatible! You are probably running ksh on a non-USG system.
2537I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2538have echo built in and we may have to run some Bourne shell scripts. That
2539means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2540
2541FOO
2542 $echo $n "The star should be here-->$c"
2543 $echo "*"
2544 fi
2545 $rm -f foo1 foo2
2546 ;;
2547esac
2548
2f88d857
MB
2549# This question was auctioned at YAPC::Europe-2007 in Vienna
2550# I never promised you could answer it. I only auctioned the question.
2551cat <<FOO
2552The following message is sponsored by
2553
2554 Dresden.pm<--The stars should be here.
2555
2556Dear Perl user, system administrator or package
2557maintainer, the Perl community sends greetings to
2558you. Do you (emblematical) greet back [Y/n]? n
2559
2560FOO
2561
613d6c3e 2562: Check what type of C compiler we use
6b769f8f 2563cat <<EOS >trygcc
2573c5f9
JH
2564$startsh
2565EOS
6b769f8f 2566cat <<'EOSC' >>trygcc
2573c5f9
JH
2567case "$cc" in
2568'') ;;
2569*) $rm -f try try.*
2570 $cat >try.c <<EOM
2571int main(int argc, char *argv[]) {
2572 return 0;
2573}
2574EOM
e4778687 2575 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2576 :
2577 else
2578 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2579 despair=yes
2580 trygcc=yes
2581 case "$cc" in
2582 *gcc*) trygcc=no ;;
2583 esac
dce40316
AD
2584 # Skip this test because it gives a false match on output like:
2585 # ./trygcc: line 23: cc: command not found
2586 # case "`$cc -v -c try.c 2>&1`" in
2587 # *gcc*) trygcc=no ;;
2588 # esac
2573c5f9
JH
2589 if $test X"$trygcc" = Xyes; then
2590 if gcc -o try -c try.c; then
2591 echo " "
2592 echo "You seem to have a working gcc, though." >&4
dce40316
AD
2593 # Switching compilers may undo the work of hints files.
2594 # The most common problem is -D_REENTRANT for threads.
2595 # This heuristic catches that case, but gets false positives
2596 # if -Dusethreads was not actually specified. Better to
2597 # bail out here with a useful message than fail
2598 # mysteriously later. Should we perhaps just try to
2599 # re-invoke Configure -Dcc=gcc config_args ?
2600 if $test -f usethreads.cbu; then
2601 $cat >&4 <<EOM
2602
2603*** However, any setting of the C compiler flags (e.g. for thread support)
2604*** will be lost. It may be necessary for you to restart Configure and
2605*** add -Dcc=gcc to your Configure command line.
2606
2607EOM
2608 rp="Would you like to go ahead and try gcc anyway?"
2609 dflt=n
2610 else
2611 rp="Would you like to use it?"
2612 dflt=y
2613 fi
2573c5f9
JH
2614 if $test -f myread; then
2615 . ./myread
2616 else
2617 if $test -f UU/myread; then
2618 . ./UU/myread
2619 else
2620 echo "Cannot find myread, sorry. Aborting." >&2
2621 exit 1
2622 fi
2623 fi
2624 case "$ans" in
6371411c 2625 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2573c5f9
JH
2626 esac
2627 fi
2628 fi
6b769f8f
RB
2629 fi
2630 $rm -f try try.*
2631 ;;
2632esac
2633EOSC
2634
2635cat <<EOS >checkcc
2636$startsh
2637EOS
2638cat <<'EOSC' >>checkcc
2639case "$cc" in
2640'') ;;
2641*) $rm -f try try.*
2642 $cat >try.c <<EOM
2643int main(int argc, char *argv[]) {
2644 return 0;
2645}
2646EOM
2647 if $cc -o try $ccflags $ldflags try.c; then
2648 :
2649 else
2573c5f9 2650 if $test X"$despair" = Xyes; then
6b769f8f
RB
2651 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2652 fi
2653 $cat >&4 <<EOM
5dd4fbdf
MB
2654You need to find a working C compiler.
2655Either (purchase and) install the C compiler supplied by your OS vendor,
2656or for a free C compiler try http://gcc.gnu.org/
2657I cannot continue any further, aborting.
2658EOM
6b769f8f 2659 exit 1
2573c5f9
JH
2660 fi
2661 $rm -f try try.*
2662 ;;
2663esac
2664EOSC
2665
a0d0e21e
LW
2666: determine whether symbolic links are supported
2667echo " "
2668$touch blurfl
2669if $ln -s blurfl sym > /dev/null 2>&1 ; then
2670 echo "Symbolic links are supported." >&4
818f00be 2671 lns="$ln -s"
a0d0e21e
LW
2672else
2673 echo "Symbolic links are NOT supported." >&4
2674 lns="$ln"
2675fi
2676$rm -f blurfl sym
2677
dafca956
JH
2678: determine whether symbolic links are supported
2679echo " "
2680case "$lns" in
18ea2752 2681*"ln"*" -s")
dafca956
JH
2682 echo "Checking how to test for symbolic links..." >&4
2683 $lns blurfl sym
4b661809 2684 if $test "X$issymlink" = X; then
2e2a97a6
JH
2685 case "$newsh" in
2686 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2687 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2688 esac
5d644a95
MB
2689 if test $? = 0; then
2690 issymlink="test -h"
2e2a97a6
JH
2691 else
2692 echo "Your builtin 'test -h' may be broken." >&4
2693 case "$test" in
2694 /*) ;;
2695 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2696 for p in $pth
2697 do
2698 if test -f "$p/$test"; then
2699 test="$p/$test"
2700 break
2701 fi
2702 done
2703 ;;
2704 esac
2705 case "$test" in
2706 /*)
2707 echo "Trying external '$test -h'." >&4
2708 issymlink="$test -h"
2709 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2710 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2711 issymlink=''
2712 fi
2713 ;;
2714 *) issymlink='' ;;
2715 esac
5d644a95
MB
2716 fi
2717 fi
4b661809 2718 if $test "X$issymlink" = X; then
dafca956 2719 if $test -L sym 2>/dev/null; then
5d644a95 2720 issymlink="$test -L"
2e2a97a6 2721 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2722 fi
2723 fi
4b661809 2724 if $test "X$issymlink" != X; then
5d644a95 2725 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2726 else
2727 echo "I do not know how you can test for symbolic links." >&4
2728 fi
2729 $rm -f blurfl sym
2730 ;;
2731*) echo "No symbolic links, so not testing for their testing..." >&4
2732 ;;
2733esac
2734echo " "
2735
34f1896b 2736: Make symlinks util
dafca956
JH
2737case "$mksymlinks" in
2738$define|true|[yY]*)
2739 case "$src" in
2740 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2741 exit 1
2742 ;;
4b661809 2743 *) case "$lns:$issymlink" in
f314eb9f 2744 *"ln"*" -s:"*"test -"?)
dafca956
JH
2745 echo "Creating the symbolic links..." >&4
2746 echo "(First creating the subdirectories...)" >&4
2747 cd ..
2748 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2749 read directory
2750 test -z "$directory" && break
2751 mkdir -p $directory
2752 done
2753 # Sanity check 1.
2754 if test ! -d t/base; then
2755 echo "Failed to create the subdirectories. Aborting." >&4
2756 exit 1
2757 fi
2758 echo "(Then creating the symlinks...)" >&4
2759 awk '{print $1}' $src/MANIFEST | while true; do
2760 read filename
2761 test -z "$filename" && break
2762 if test -f $filename; then
5d644a95 2763 if $issymlink $filename; then
dafca956
JH
2764 rm -f $filename
2765 fi
2766 fi
2767 if test -f $filename; then
2768 echo "$filename already exists, not symlinking."
2769 else
2770 ln -s $src/$filename $filename
2771 fi
2772 done
2773 # Sanity check 2.
a0d24b8a
JH
2774 if test ! -f t/base/lex.t; then
2775 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2776 exit 1
2777 fi
2778 cd UU
2779 ;;
2780 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2781 ;;
2782 esac
2783 ;;
2784 esac
2785 ;;
2786esac
2787
613d6c3e 2788: Check for Cross-Compilation
5440bc8e
JH
2789case "$usecrosscompile" in
2790$define|true|[yY]*)
93bc48fa 2791 $echo "Cross-compiling..."
5440bc8e
JH
2792 croak=''
2793 case "$cc" in
2794 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2795 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2796 ar=$targetarch-ar
2797 # leave out ld, choosing it is more complex
2798 nm=$targetarch-nm
2799 ranlib=$targetarch-ranlib
93bc48fa 2800 $echo 'extern int foo;' > try.c
f8006fac 2801 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2802 shift
2803 if $test $# -gt 0; then
2804 incpth="$incpth $*"
f8006fac
JH
2805 incpth="`$echo $incpth|$sed 's/^ //'`"
2806 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2807 for i in $*; do
f8006fac 2808 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2809 if $test -d $j; then
2810 libpth="$libpth $j"
2811 fi
2812 done
f8006fac
JH
2813 libpth="`$echo $libpth|$sed 's/^ //'`"
2814 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2815 fi
2816 $rm -f try.c
5440bc8e
JH
2817 ;;
2818 esac
2819 case "$targetarch" in
93bc48fa
JH
2820 '') echo "Targetarch not defined." >&4; croak=y ;;
2821 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2822 esac
2823 case "$incpth" in
93bc48fa 2824 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2825 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2826 esac
2827 case "$libpth" in
93bc48fa 2828 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2829 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2830 esac
93bc48fa
JH
2831 case "$usrinc" in
2832 '') for i in $incpth; do
2833 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2834 usrinc=$i
2835 echo "Guessing usrinc $usrinc." >&4
2836 break
2837 fi
2838 done
2839 case "$usrinc" in
2840 '') echo "Usrinc not defined." >&4; croak=y ;;
2841 esac
2842 ;;
2843 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2844 esac
93bc48fa
JH
2845 case "$targethost" in
2846 '') echo "Targethost not defined." >&4; croak=y ;;
2847 *) echo "Using targethost $targethost." >&4
5440bc8e 2848 esac
93bc48fa
JH
2849 locincpth=' '
2850 loclibpth=' '
5440bc8e 2851 case "$croak" in
93bc48fa 2852 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2853 esac
2854 case "$src" in
2855 /*) run=$src/Cross/run
93c0359c 2856 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2857 to=$src/Cross/to
2858 from=$src/Cross/from
2859 ;;
93bc48fa 2860 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2861 run=$pwd/Cross/run
f8006fac 2862 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2863 to=$pwd/Cross/to
2864 from=$pwd/Cross/from
2865 ;;
2866 esac
2867 case "$targetrun" in
2868 '') targetrun=ssh ;;
2869 esac
2870 case "$targetto" in
2871 '') targetto=scp ;;
2872 esac
2873 case "$targetfrom" in
2874 '') targetfrom=scp ;;
2875 esac
2876 run=$run-$targetrun
2877 to=$to-$targetto
2878 from=$from-$targetfrom
93bc48fa
JH
2879 case "$targetdir" in
2880 '') targetdir=/tmp
2881 echo "Guessing targetdir $targetdir." >&4
2882 ;;
2883 esac
5440bc8e 2884 case "$targetuser" in
93bc48fa
JH
2885 '') targetuser=root
2886 echo "Guessing targetuser $targetuser." >&4
2887 ;;
5440bc8e
JH
2888 esac
2889 case "$targetfrom" in
2890 scp) q=-q ;;
2891 *) q='' ;;
2892 esac
2893 case "$targetrun" in
2894 ssh|rsh)
2895 cat >$run <<EOF
2896#!/bin/sh
93c0359c
JH
2897case "\$1" in
2898-cwd)
2899 shift
2900 cwd=\$1
2901 shift
2902 ;;
2903esac
2904case "\$cwd" in
2905'') cwd=$targetdir ;;
2906esac
5440bc8e
JH
2907exe=\$1
2908shift
93c0359c
JH
2909if $test ! -f \$exe.xok; then
2910 $to \$exe
2911 $touch \$exe.xok
2912fi
2913$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2914EOF
2915 ;;
93bc48fa 2916 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2917 exit 1
2918 ;;
2919 esac
93c0359c
JH
2920 case "$targetmkdir" in
2921 */Cross/mkdir)
2922 cat >$targetmkdir <<EOF
2923#!/bin/sh
2924$targetrun -l $targetuser $targethost "mkdir -p \$@"
2925EOF
f8006fac 2926 $chmod a+rx $targetmkdir
93c0359c
JH
2927 ;;
2928 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2929 exit 1
2930 ;;
2931 esac
5440bc8e
JH
2932 case "$targetto" in
2933 scp|rcp)
2934 cat >$to <<EOF
2935#!/bin/sh
2936for f in \$@
2937do
93c0359c
JH
2938 case "\$f" in
2939 /*)
2940 $targetmkdir \`dirname \$f\`
2941 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2942 ;;
2943 *)
2944 $targetmkdir $targetdir/\`dirname \$f\`
2945 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2946 ;;
2947 esac
5440bc8e
JH
2948done
2949exit 0
2950EOF
2951 ;;
2952 cp) cat >$to <<EOF
2953#!/bin/sh
93c0359c
JH
2954for f in \$@
2955do
2956 case "\$f" in
2957 /*)
2958 $mkdir -p $targetdir/\`dirname \$f\`
2959 $cp \$f $targetdir/\$f || exit 1
2960 ;;
2961 *)
2962 $targetmkdir $targetdir/\`dirname \$f\`
2963 $cp \$f $targetdir/\$f || exit 1
2964 ;;
2965 esac
2966done
2967exit 0
5440bc8e
JH
2968EOF
2969 ;;
93bc48fa 2970 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2971 exit 1
2972 ;;
2973 esac
2974 case "$targetfrom" in
2975 scp|rcp)
2976 cat >$from <<EOF
2977#!/bin/sh
2978for f in \$@
2979do
93c0359c 2980 $rm -f \$f
5440bc8e
JH
2981 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2982done
2983exit 0
2984EOF
2985 ;;
2986 cp) cat >$from <<EOF
2987#!/bin/sh
2988for f in \$@
2989do
93c0359c 2990 $rm -f \$f
5440bc8e
JH
2991 cp $targetdir/\$f . || exit 1
2992done
2993exit 0
2994EOF
2995 ;;
93bc48fa 2996 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2997 exit 1
2998 ;;
2999 esac
93bc48fa
JH
3000 if $test ! -f $run; then
3001 echo "Target 'run' script '$run' not found." >&4
5440bc8e 3002 else
f8006fac 3003 $chmod a+rx $run
5440bc8e 3004 fi
93bc48fa
JH
3005 if $test ! -f $to; then
3006 echo "Target 'to' script '$to' not found." >&4
5440bc8e 3007 else
f8006fac 3008 $chmod a+rx $to
5440bc8e 3009 fi
93bc48fa
JH
3010 if $test ! -f $from; then
3011 echo "Target 'from' script '$from' not found." >&4
5440bc8e 3012 else
f8006fac 3013 $chmod a+rx $from
5440bc8e 3014 fi
93bc48fa 3015 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
3016 exit 1
3017 fi
3018 cat >&4 <<EOF
f8006fac
JH
3019Using '$run' for remote execution,
3020and '$from' and '$to'
93bc48fa 3021for remote file transfer.
5440bc8e
JH
3022EOF
3023 ;;
3024*) run=''
3025 to=:
3026 from=:
3027 usecrosscompile='undef'
3028 targetarch=''
3029 ;;
3030esac
3031
ecfc5424
AD
3032: see whether [:lower:] and [:upper:] are supported character classes
3033echo " "
ecfc5424
AD
3034case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3035ABYZ)
3036 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3037 up='[:upper:]'
3038 low='[:lower:]'
3039 ;;
416d0bea
MB
3040*) # There is a discontinuity in EBCDIC between 'R' and 'S'
3041 # (0xd9 and 0xe2), therefore that is a nice testing point.
3042 if test "X$up" = X -o "X$low" = X; then
3043 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3044 rs) up='[A-Z]'
3045 low='[a-z]'
28e8609d
JH
3046 ;;
3047 esac
416d0bea 3048 fi
28e8609d 3049 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3050 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3051 rs) up='A-Z'
28e8609d
JH
3052 low='a-z'
3053 ;;
3054 esac
416d0bea 3055 fi
28e8609d 3056 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3057 case "`echo RS | od -x 2>/dev/null`" in
3058 *D9E2*|*d9e2*)
28e8609d
JH
3059 echo "Hey, this might be EBCDIC." >&4
3060 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3061 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3062 rs) up='[A-IJ-RS-Z]'
3063 low='[a-ij-rs-z]'
28e8609d
JH
3064 ;;
3065 esac
3066 fi
3067 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3068 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3069 rs) up='A-IJ-RS-Z'
3070 low='a-ij-rs-z'
28e8609d
JH
3071 ;;
3072 esac
3073 fi
3074 ;;
3075 esac
3076 fi
3077esac
416d0bea
MB
3078case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3079rs)
28e8609d
JH
3080 echo "Using $up and $low to convert case." >&4
3081 ;;
ecfc5424 3082*)
28e8609d
JH
3083 echo "I don't know how to translate letters from upper to lower case." >&4
3084 echo "Your tr is not acting any way I know of." >&4
3085 exit 1
3086 ;;
ecfc5424
AD
3087esac
3088: set up the translation script tr, must be called with ./tr of course
3089cat >tr <<EOSC
3090$startsh
3091case "\$1\$2" in
3092'[A-Z][a-z]') exec $tr '$up' '$low';;
3093'[a-z][A-Z]') exec $tr '$low' '$up';;
3094esac
3095exec $tr "\$@"
3096EOSC
3097chmod +x tr
3098$eunicefix tr
3099
2304df62
AD
3100: Try to determine whether config.sh was made on this system
3101case "$config_sh" in
3102'')
43999f95
JH
3103myuname=`$uname -a 2>/dev/null`
3104$test -z "$myuname" && myuname=`hostname 2>/dev/null`
f4dc174a
AD
3105# Downcase everything to avoid ambiguity.
3106# Remove slashes and single quotes so we can use parts of this in
3107# directory and file names.
3108# Remove newlines so myuname is sane to use elsewhere.
28e8609d
JH
3109# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3110# because the A-Z/a-z are not consecutive.
f4dc174a 3111myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3eaeeeae 3112 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3113newmyuname="$myuname"
2304df62 3114dflt=n
16d20bd9
AD
3115case "$knowitall" in
3116'')
3117 if test -f ../config.sh; then
3118 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3119 eval "`grep myuname= ../config.sh`"
3120 fi
3121 if test "X$myuname" = "X$newmyuname"; then
3122 dflt=y
3123 fi
2304df62 3124 fi
16d20bd9
AD
3125 ;;
3126*) dflt=y;;
3127esac
2304df62
AD
3128
3129: Get old answers from old config file if Configure was run on the
3130: same system, otherwise use the hints.
3131hint=default
3132cd ..
3133if test -f config.sh; then
16d20bd9
AD
3134 echo " "
3135 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3136 . UU/myread
3137 case "$ans" in
f83701cd
AD
3138 n*|N*) echo "OK, I'll ignore it."
3139 mv config.sh config.sh.old
3140 myuname="$newmyuname"
3141 ;;
2304df62 3142 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3143 tmp_n="$n"
3144 tmp_c="$c"
85cad39c 3145 tmp_sh="$sh"
2304df62
AD
3146 . ./config.sh
3147 cp config.sh UU
ecfc5424
AD
3148 n="$tmp_n"
3149 c="$tmp_c"
85cad39c 3150 : Older versions did not always set $sh. Catch re-use of such
3151 : an old config.sh.
3152 case "$sh" in
3153 '') sh="$tmp_sh" ;;
3154 esac
2304df62
AD
3155 hint=previous
3156 ;;
3157 esac
3158fi
2573c5f9 3159. ./UU/checkcc
2304df62
AD
3160if test ! -f config.sh; then
3161 $cat <<EOM
3162
4e2a5f63
AD
3163First time through, eh? I have some defaults handy for some systems
3164that need some extra help getting the Configure answers right:
2304df62
AD
3165
3166EOM
dfe9444c 3167 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3168 dflt=''
3169 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3170 : tests or hints, please send them to perlbug@perl.org
2304df62 3171 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3172 $test -f /irix && osname=irix
85e6fe83
LW
3173 $test -f /xenix && osname=sco_xenix
3174 $test -f /dynix && osname=dynix
3175 $test -f /dnix && osname=dnix
5f05dabc 3176 $test -f /lynx.os && osname=lynxos
3177 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3178 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3179 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3180 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3181 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3182 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3183 $test -d /usr/apollo/bin && osname=apollo
3184 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3185 $test -d /usr/include/minix && osname=minix
d54344fc 3186 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3187 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3188 osname=machten
4633a7c4 3189 if $test -x /sbin/version; then
dfe9444c 3190 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3191 $sed -e 's/[A-Za-z]$//'`
3192 elif $test -x /usr/etc/version; then
dfe9444c 3193 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3194 $sed -e 's/[A-Za-z]$//'`
3195 else
3196 osvers="$2.$3"
3197 fi
3198 fi
aaacdc8b
GS
3199
3200 $test -f /sys/posix.dll &&
3201 $test -f /usr/bin/what &&
3202 set X `/usr/bin/what /sys/posix.dll` &&
3203 $test "$3" = UWIN &&
3204 osname=uwin &&
3205 osvers="$5"
3206
2304df62
AD
3207 if $test -f $uname; then
3208 set X $myuname
3209 shift
3210
2304df62 3211 case "$5" in
85e6fe83 3212 fps*) osname=fps ;;
2304df62
AD
3213 mips*)
3214 case "$4" in
85e6fe83
LW
3215 umips) osname=umips ;;
3216 *) osname=mips ;;
2304df62 3217 esac;;
85e6fe83
LW
3218 [23]100) osname=mips ;;
3219 next*) osname=next ;;
ecfc5424 3220 i386*)
c6912327
JH
3221 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3222 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3223 osname='sco'
3224 osvers=$tmp
3225 elif $test -f /etc/kconfig; then
ecfc5424 3226 osname=isc
bd628c73 3227 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3228 osvers=4
3229 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3230 osvers=3
2304df62 3231 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3232 osvers=2
ecfc5424
AD
3233 fi
3234 fi
2000072c 3235 tmp=''
ecfc5424 3236 ;;
c4f23d77
AD
3237 pc*)
3238 if test -n "$DJGPP"; then
3239 osname=dos
3240 osvers=djgpp
3241 fi
3242 ;;
2304df62
AD
3243 esac
3244
3245 case "$1" in
a0d0e21e
LW
3246 aix) osname=aix
3247 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3248 case "$tmp" in
e81c5c2a
NC
3249 # oslevel can fail with:
3250 # oslevel: Unable to acquire lock.
3251 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3252 '<3240'|'<>3240') osvers=3.2.0 ;;
3253 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3254 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3255 *) osvers=$tmp;;
a0d0e21e
LW
3256 esac
3257 ;;
aaacdc8b
GS
3258 bsd386) osname=bsd386
3259 osvers=`$uname -r`
3260 ;;
3261 cygwin*) osname=cygwin
3262 osvers="$3"
3263 ;;
23f87696
SZ
3264 *dc.osx) osname=dcosx
3265 osvers="$3"
3266 ;;
a0d0e21e
LW
3267 dnix) osname=dnix
3268 osvers="$3"
3269 ;;
3270 domainos) osname=apollo
3271 osvers="$3"
3272 ;;
a774dfe6
RSG
3273 dgux) osname=dgux
3274 osvers="$3"
3275 ;;
3276 dragonfly) osname=dragonfly
a0d0e21e
LW
3277 osvers="$3"
3278 ;;
760ac839 3279 dynixptx*) osname=dynixptx
e58e581d 3280 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3281 ;;
a774dfe6 3282 freebsd) osname=freebsd
a0d0e21e 3283 osvers="$3" ;;
761ee4e8
BD
3284 genix) osname=genix ;;
3285 gnu) osname=gnu
3286 osvers="$3" ;;
a774dfe6 3287 hp*) osname=hpux
bfb7748a 3288 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3289 ;;
761ee4e8 3290 irix*) osname=irix
a0d0e21e
LW
3291 case "$3" in
3292 4*) osvers=4 ;;
3293 5*) osvers=5 ;;
ecfc5424 3294 *) osvers="$3" ;;
a0d0e21e
LW
3295 esac
3296 ;;
761ee4e8 3297 linux) osname=linux
a0d0e21e 3298 case "$3" in
a0d0e21e
LW
3299 *) osvers="$3" ;;
3300 esac
3301 ;;
761ee4e8 3302 MiNT) osname=mint
28e8609d
JH
3303 ;;
3304 netbsd*) osname=netbsd
ecfc5424
AD
3305 osvers="$3"
3306 ;;
4e81affe
MM
3307 news-os) osvers="$3"
3308 case "$3" in
3309 4*) osname=newsos4 ;;
3310 *) osname=newsos ;;
3311 esac
3312 ;;
aaacdc8b 3313 next*) osname=next ;;
28bb1e2c 3314 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3315 openbsd) osname=openbsd
3316 osvers="$3"
3317 ;;
5c728af0
IZ
3318 os2) osname=os2
3319 osvers="$4"
3320 ;;
aaacdc8b
GS
3321 POSIX-BC | posix-bc ) osname=posix-bc
3322 osvers="$3"
a0d0e21e 3323 ;;
ae3afa4e
TH
3324 powerux | power_ux | powermax_os | powermaxos | \
3325 powerunix | power_unix) osname=powerux
3326 osvers="$3"
3327 ;;
aaacdc8b
GS
3328 qnx) osname=qnx
3329 osvers="$4"
3330 ;;
a0d0e21e
LW
3331 solaris) osname=solaris
3332 case "$3" in
3333 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3334 *) osvers="$3" ;;
a0d0e21e
LW
3335 esac
3336 ;;
85e6fe83
LW
3337 sunos) osname=sunos
3338 case "$3" in
85e6fe83
LW
3339 5*) osname=solaris
3340 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3341 *) osvers="$3" ;;
2304df62
AD
3342 esac
3343 ;;
a0d0e21e 3344 titanos) osname=titanos
85e6fe83 3345 case "$3" in
a0d0e21e
LW
3346 1*) osvers=1 ;;
3347 2*) osvers=2 ;;
3348 3*) osvers=3 ;;
3349 4*) osvers=4 ;;
ecfc5424 3350 *) osvers="$3" ;;
2304df62
AD
3351 esac
3352 ;;
85e6fe83 3353 ultrix) osname=ultrix
ecfc5424 3354 osvers="$3"
2304df62 3355 ;;
28757baa 3356 osf1|mls+) case "$5" in
fed7345c
AD
3357 alpha)
3358 osname=dec_osf
fdd85a03 3359 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3360 case "$osvers" in
3361 [1-9].[0-9]*) ;;
3362 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3363 esac
ecfc5424
AD
3364 ;;
3365 hp*) osname=hp_osf1 ;;
3366 mips) osname=mips_osf1 ;;
85e6fe83
LW
3367 esac
3368 ;;
af1ff193 3369 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3370 openunix|unixware) osname=svr5
0337d152
BG
3371 osvers="$4"
3372 ;;
3c728e00 3373 uts) osname=uts
a0d0e21e
LW
3374 osvers="$3"
3375 ;;
3c728e00
JH
3376 vos) osvers="$3"
3377 ;;
85e6fe83 3378 $2) case "$osname" in
2304df62 3379 *isc*) ;;
a0d0e21e 3380 *freebsd*) ;;
5f05dabc 3381 svr*)
a0d0e21e 3382 : svr4.x or possibly later
a774dfe6 3383 case "svr$3" in
a0d0e21e
LW
3384 ${osname}*)
3385 osname=svr$3
3386 osvers=$4
3387 ;;
3388 esac
3389 case "$osname" in
3390 svr4.0)
3391 : Check for ESIX
3392 if test -f /stand/boot ; then
3393 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3394 if test -n "$INITPROG" -a -f "$INITPROG"; then
3395 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3396 if test -n "$isesix"; then
a0d0e21e
LW
3397 osname=esix4
3398 fi
3399 fi
3400 fi
3401 ;;
3402 esac
3403 ;;
2304df62 3404 *) if test -f /etc/systemid; then
a0d0e21e
LW
3405 osname=sco
3406 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3407 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3408 osvers=$1.$2.$3
c4f23d77 3409 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3410 osvers=$1.$2
c4f23d77 3411 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3412 osvers=$1
2304df62 3413 fi
a0d0e21e
LW
3414 else
3415 case "$osname" in
3416 '') : Still unknown. Probably a generic Sys V.
3417 osname="sysv"
3418 osvers="$3"
3419 ;;
3420 esac
2304df62
AD
3421 fi
3422 ;;
3423 esac
3424 ;;
a0d0e21e
LW
3425 *) case "$osname" in
3426 '') : Still unknown. Probably a generic BSD.
3427 osname="$1"
3428 osvers="$3"
3429 ;;
3430 esac
3431 ;;
2304df62
AD
3432 esac
3433 else
dfe9444c
AD
3434 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3435 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3436 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3437 osname=news_os
2304df62 3438 fi
dfe9444c 3439 $rm -f UU/kernel.what
5c728af0 3440 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3441 set X $myuname
3442 osname=os2
3443 osvers="$5"
2304df62
AD
3444 fi
3445 fi
a774dfe6 3446
5440bc8e
JH
3447 case "$targetarch" in
3448 '') ;;
3449 *) hostarch=$osname
3450 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3451 osvers=''
3452 ;;
3453 esac
3454
a0d0e21e
LW
3455 : Now look for a hint file osname_osvers, unless one has been
3456 : specified already.
3457 case "$hintfile" in
3458 ''|' ')
1e127011 3459 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3460 : Also try without trailing minor version numbers.
1e127011
DD
3461 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3462 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3463 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3464 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3465 case "$file" in
3466 '') dflt=none ;;
3467 *) case "$osvers" in
3468 '') dflt=$file
3469 ;;
dfe9444c 3470 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3471 dflt=$file
dfe9444c 3472 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3473 dflt=$xfile
dfe9444c 3474 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3475 dflt=$xxfile
dfe9444c 3476 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3477 dflt=$xxxfile
dfe9444c 3478 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3479 dflt=$xxxxfile
dfe9444c 3480 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3481 dflt="${osname}"
3482 else
3483 dflt=none
3484 fi
3485 ;;
3486 esac
85e6fe83
LW
3487 ;;
3488 esac
4e2a5f63
AD
3489 if $test -f Policy.sh ; then
3490 case "$dflt" in
3491 *Policy*) ;;
3492 none) dflt="Policy" ;;
3493 *) dflt="Policy $dflt" ;;
3494 esac
3495 fi
85e6fe83 3496 ;;
a0d0e21e 3497 *)
ecfc5424 3498 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3499 ;;
2304df62 3500 esac
1aef975c 3501
4e2a5f63
AD
3502 if $test -f Policy.sh ; then
3503 $cat <<EOM
3504
3505There's also a Policy hint file available, which should make the
3506site-specific (policy) questions easier to answer.
3507EOM
3508
3509 fi
3510
2304df62
AD
3511 $cat <<EOM
3512
3513You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3514If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3515previous run of Configure, you may specify it as well as or instead of
3516OS-specific hints. If hints are provided for your OS, you should use them:
3517although Perl can probably be built without hints on many platforms, using
3518hints often improve performance and may enable features that Configure can't
3519set up on its own. If there are no hints that match your OS, specify "none";
3520DO NOT give a wrong version or a wrong OS.
2304df62
AD
3521
3522EOM
4e2a5f63 3523
2304df62 3524 rp="Which of these apply, if any?"
dfe9444c 3525 . UU/myread
85e6fe83
LW
3526 tans=$ans
3527 for file in $tans; do
4e2a5f63
AD
3528 if $test X$file = XPolicy -a -f Policy.sh; then
3529 . Policy.sh
3530 $cat Policy.sh >> UU/config.sh
3531 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3532 . $src/hints/$file.sh
3533 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3534 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3535 : nothing
3536 else
85e6fe83
LW
3537 : Give one chance to correct a possible typo.
3538 echo "$file.sh does not exist"
3539 dflt=$file
3540 rp="hint to use instead?"
dfe9444c 3541 . UU/myread
85e6fe83 3542 for file in $ans; do
dfe9444c
AD
3543 if $test -f "$src/hints/$file.sh"; then
3544 . $src/hints/$file.sh
3545 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3546 elif $test X$ans = X -o X$ans = Xnone ; then
3547 : nothing
3548 else
3549 echo "$file.sh does not exist -- ignored."
3550 fi
3551 done
2304df62
AD
3552 fi
3553 done
85e6fe83 3554
2304df62 3555 hint=recommended
85e6fe83 3556 : Remember our hint file for later.
dfe9444c 3557 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3558 hintfile="$file"
85e6fe83 3559 else
a0d0e21e 3560 hintfile=''
85e6fe83 3561 fi
2304df62
AD
3562fi
3563cd UU
3564;;
3565*)
3566 echo " "
3567 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3568 tmp_n="$n"
3569 tmp_c="$c"
2304df62
AD
3570 cd ..
3571 cp $config_sh config.sh 2>/dev/null
a78b0d02 3572 chmod +w config.sh
2304df62
AD
3573 . ./config.sh
3574 cd UU
3575 cp ../config.sh .
ecfc5424
AD
3576 n="$tmp_n"
3577 c="$tmp_c"
2304df62
AD
3578 hint=previous
3579 ;;
3580esac
1aef975c 3581test "$override" && . ./optdef.sh
2304df62
AD
3582
3583: Restore computed paths
3584for file in $loclist $trylist; do
3585 eval $file="\$_$file"
3586done
3587
85e6fe83 3588cat << EOM
a0d0e21e 3589
85e6fe83 3590Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3591The default value is probably right if the name rings a bell. Otherwise,
3592since spelling matters for me, either accept the default or answer "none"
3593to leave it blank.
a0d0e21e 3594
85e6fe83 3595EOM
85e6fe83 3596case "$osname" in
a0d0e21e 3597 ''|' ')
85e6fe83 3598 case "$hintfile" in
a0d0e21e 3599 ''|' '|none) dflt=none ;;
ecfc5424 3600 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3601 esac
3602 ;;
3603 *) dflt="$osname" ;;
3604esac
3605rp="Operating system name?"
3606. ./myread
3607case "$ans" in
ecfc5424
AD
3608none) osname='' ;;
3609*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3610esac
8ff267be 3611echo " "
3612case "$osvers" in
3613 ''|' ')
3614 case "$hintfile" in
3615 ''|' '|none) dflt=none ;;
3616 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3617 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3618 case "$dflt" in
3619 ''|' ') dflt=none ;;
3620 esac
3621 ;;
3622 esac
3623 ;;
3624 *) dflt="$osvers" ;;
3625esac
3626rp="Operating system version?"
3627. ./myread
3628case "$ans" in
3629none) osvers='' ;;
3630*) osvers="$ans" ;;
3631esac
3632
02e93a22
JH
3633
3634. ./posthint.sh
3635
2304df62 3636: who configured the system
59b83a6f 3637cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3638case "$cf_by" in
3639"")
7c04078e 3640 cf_by=`(logname) 2>/dev/null`
dfe9444c 3641 case "$cf_by" in
7c04078e
GA
3642 "")
3643 cf_by=`(whoami) 2>/dev/null`
3644 case "$cf_by" in
3645 "") cf_by=unknown ;;
3646 esac ;;
8ff267be 3647 esac ;;
3648esac
2304df62 3649
f3f1a2d8
MB
3650: decide how portable to be. Allow command line overrides.
3651case "$d_portable" in
3652"$undef") ;;
3653*) d_portable="$define" ;;
b4eb6b3d 3654esac
b4eb6b3d 3655
f3f1a2d8
MB
3656: set up shell script to do ~ expansion
3657cat >filexp <<EOSS
3658$startsh
3659: expand filename
3660case "\$1" in
f16e9d76 3661 \~/*|\~)
f3f1a2d8
MB
3662 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3663 ;;
4137585d 3664 \~*)
f3f1a2d8
MB
3665 if $test -f /bin/csh; then
3666 /bin/csh -f -c "glob \$1"
3667 failed=\$?
3668 echo ""
3669 exit \$failed
3670 else
3671 name=\`$expr x\$1 : '..\([^/]*\)'\`
3672 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3673 if $test ! -d "\$dir"; then
3674 me=\`basename \$0\`
3675 echo "\$me: can't locate home directory for: \$name" >&2
3676 exit 1
3677 fi
3678 case "\$1" in
3679 */*)
3680 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3681 ;;
3682 *)
3683 echo \$dir
3684 ;;
3685 esac
3686 fi
3687 ;;
3688*)
3689 echo \$1
3690 ;;
b29b105d 3691esac
f3f1a2d8
MB
3692EOSS
3693chmod +x filexp
3694$eunicefix filexp
b29b105d 3695
f3f1a2d8
MB
3696: now set up to get a file name
3697cat <<EOS >getfile
3698$startsh
3699EOS
3700cat <<'EOSC' >>getfile
3701tilde=''
3702fullpath=''
3703already=''
3704skip=''
3705none_ok=''
3706exp_file=''
3707nopath_ok=''
3708orig_rp="$rp"
3709orig_dflt="$dflt"
3710case "$gfpth" in
3711'') gfpth='.' ;;
b29b105d 3712esac
b29b105d 3713
f3f1a2d8
MB
3714case "$fn" in
3715*\(*)
3716 : getfile will accept an answer from the comma-separated list
3717 : enclosed in parentheses even if it does not meet other criteria.
3718 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3719 fn=`echo $fn | sed 's/(.*)//'`
3720 ;;
b29b105d
JH
3721esac
3722
f3f1a2d8
MB
3723case "$fn" in
3724*:*)
3725 loc_file=`expr $fn : '.*:\(.*\)'`
3726 fn=`expr $fn : '\(.*\):.*'`
3727 ;;
b29b105d 3728esac
b29b105d 3729
f3f1a2d8
MB
3730case "$fn" in
3731*~*) tilde=true;;
3732esac
3733case "$fn" in
3734*/*) fullpath=true;;
3735esac
3736case "$fn" in
3737*+*) skip=true;;
3738esac
3739case "$fn" in
3740*n*) none_ok=true;;
3741esac
3742case "$fn" in
3743*e*) exp_file=true;;
3744esac
3745case "$fn" in
3746*p*) nopath_ok=true;;
b29b105d 3747esac
b29b105d 3748
f3f1a2d8
MB
3749case "$fn" in
3750*f*) type='File';;
3751*d*) type='Directory';;
3752*l*) type='Locate';;
3753esac
b29b105d 3754
f3f1a2d8
MB
3755what="$type"
3756case "$what" in
3757Locate) what='File';;
3758esac
b29b105d 3759
f3f1a2d8
MB
3760case "$exp_file" in
3761'')
3762 case "$d_portable" in
3763 "$define") ;;
3764 *) exp_file=true;;
b29b105d
JH
3765 esac
3766 ;;
3767esac
3768
f3f1a2d8
MB
3769cd ..
3770while test "$type"; do
3771 redo=''
3772 rp="$orig_rp"
3773 dflt="$orig_dflt"
3774 case "$tilde" in
3775 true) rp="$rp (~name ok)";;
3776 esac
3777 . UU/myread
3778 if test -f UU/getfile.ok && \
3779 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3780 then
3781 value="$ans"
3782 ansexp="$ans"
3783 break
3784 fi
3785 case "$ans" in
3786 none)
3787 value=''
3788 ansexp=''
3789 case "$none_ok" in
3790 true) type='';;
b29b105d
JH
3791 esac
3792 ;;
f3f1a2d8
MB
3793 *)
3794 case "$tilde" in
3795 '') value="$ans"
3796 ansexp="$ans";;
3797 *)
3798 value=`UU/filexp $ans`
3799 case $? in
3800 0)
3801 if test "$ans" != "$value"; then
3802 echo "(That expands to $value on this system.)"
3803 fi
3804 ;;
3805 *) value="$ans";;
3806 esac
3807 ansexp="$value"
3808 case "$exp_file" in
3809 '') value="$ans";;
3810 esac
3811 ;;
3812 esac
3813 case "$fullpath" in
3814 true)
3815 case "$ansexp" in
3816 /*) value="$ansexp" ;;
3817 [a-zA-Z]:/*) value="$ansexp" ;;
3818 *)
3819 redo=true
3820 case "$already" in
3821 true)
3822 echo "I shall only accept a full path name, as in /bin/ls." >&4
3823 echo "Use a ! shell escape if you wish to check pathnames." >&4
3824 ;;
3825 *)
3826 echo "Please give a full path name, starting with slash." >&4
3827 case "$tilde" in
3828 true)
3829 echo "Note that using ~name is ok provided it expands well." >&4
3830 already=true
3831 ;;
3832 esac
3833 esac
3834 ;;
3835 esac
3836 ;;
3837 esac
3838 case "$redo" in
3839 '')
3840 case "$type" in
3841 File)
3842 for fp in $gfpth; do
3843 if test "X$fp" = X.; then
3844 pf="$ansexp"
3845 else
3846 pf="$fp/$ansexp"
3847 fi
3848 if test -f "$pf"; then
3849 type=''
3850 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3851 then
3852 echo "($value is not a plain file, but that's ok.)"
3853 type=''
3854 fi
3855 if test X"$type" = X; then
3856 value="$pf"
3857 break
3858 fi
3859 done
3860 ;;
3861 Directory)
3862 for fp in $gfpth; do
3863 if test "X$fp" = X.; then
3864 dir="$ans"
3865 direxp="$ansexp"
3866 else
3867 dir="$fp/$ansexp"
3868 direxp="$fp/$ansexp"
3869 fi
3870 if test -d "$direxp"; then
3871 type=''
3872 value="$dir"
3873 break
3874 fi
3875 done
3876 ;;
3877 Locate)
3878 if test -d "$ansexp"; then
3879 echo "(Looking for $loc_file in directory $value.)"
3880 value="$value/$loc_file"
3881 ansexp="$ansexp/$loc_file"
3882 fi
3883 if test -f "$ansexp"; then
3884 type=''
3885 fi
3886 case "$nopath_ok" in
3887 true) case "$value" in
3888 */*) ;;
3889 *) echo "Assuming $value will be in people's path."
3890 type=''
3891 ;;
3892 esac
3893 ;;
3894 esac
3895 ;;
3896 esac
b4eb6b3d 3897
f3f1a2d8
MB
3898 case "$skip" in
3899 true) type='';
3900 esac
3901
3902 case "$type" in
3903 '') ;;
3904 *)
3905 if test "$fastread" = yes; then
3906 dflt=y
3907 else
3908 dflt=n
3909 fi
3910 rp="$what $value doesn't exist. Use that name anyway?"
3911 . UU/myread
3912 dflt=''
3913 case "$ans" in
3914 y*) type='';;
3915 *) echo " ";;
3916 esac
3917 ;;
3918 esac
3919 ;;
3920 esac
3921 ;;
b4eb6b3d 3922 esac
f3f1a2d8
MB
3923done
3924cd UU
3925ans="$value"
3926rp="$orig_rp"
3927dflt="$orig_dflt"
3928rm -f getfile.ok
3929test "X$gfpthkeep" != Xy && gfpth=""
3930EOSC
3931
3932: determine root of directory hierarchy where package will be installed.
3933case "$prefix" in
3934'')
3935 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3936 ;;
3937*?/)
3938 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3939 ;;
3940*)
f3f1a2d8 3941 dflt="$prefix"
b4eb6b3d
JH
3942 ;;
3943esac
f3f1a2d8 3944$cat <<EOM
b4eb6b3d 3945
f3f1a2d8
MB
3946By default, $package will be installed in $dflt/bin, manual pages
3947under $dflt/man, etc..., i.e. with $dflt as prefix for all
3948installation directories. Typically this is something like /usr/local.
3949If you wish to have binaries under /usr/bin but other parts of the
3950installation under /usr/local, that's ok: you will be prompted
3951separately for each of the installation directories, the prefix being
3952only used to set the defaults.
c915ce7f
JH
3953
3954EOM
f3f1a2d8
MB
3955fn=d~
3956rp='Installation prefix to use?'
3957. ./getfile
3958oldprefix=''
3959case "$prefix" in
3960'') ;;
3961*)
3962 case "$ans" in
3963 "$prefix") ;;
3964 *) oldprefix="$prefix";;
3965 esac
c915ce7f
JH
3966 ;;
3967esac
f3f1a2d8
MB
3968prefix="$ans"
3969prefixexp="$ansexp"
c915ce7f 3970
776a38e3 3971: allow them to override the AFS root
f3f1a2d8
MB
3972case "$afsroot" in
3973'') afsroot=/afs ;;
3974*) afsroot=$afsroot ;;
b4eb6b3d 3975esac
b4eb6b3d 3976
776a38e3 3977: is AFS running?
f3f1a2d8
MB
3978echo " "
3979case "$afs" in
3980$define|true) afs=true ;;
3981$undef|false) afs=false ;;
776a38e3 3982*) if $test -d $afsroot; then
f3f1a2d8
MB
3983 afs=true
3984 else
3985 afs=false
3986 fi
b4eb6b3d 3987 ;;
f3f1a2d8
MB
3988esac
3989if $afs; then
3990 echo "AFS may be running... I'll be extra cautious then..." >&4
3991else
3992 echo "AFS does not seem to be running..." >&4
9da7673b 3993fi
b4eb6b3d 3994
f3f1a2d8
MB
3995: determine installation prefix for where package is to be installed.
3996if $afs; then
3997$cat <<EOM
3998
3999Since you are running AFS, I need to distinguish the directory in which
4000files will reside from the directory in which they are installed (and from
4001which they are presumably copied to the former directory by occult means).
b4eb6b3d 4002
b4eb6b3d 4003EOM
f3f1a2d8
MB
4004 case "$installprefix" in
4005 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4006 *) dflt="$installprefix";;
4007 esac
4008else
4009$cat <<EOM
b4eb6b3d 4010
f3f1a2d8
MB
4011In some special cases, particularly when building $package for distribution,
4012it is convenient to distinguish the directory in which files should be
4013installed from the directory ($prefix) in which they will
4014eventually reside. For most users, these two directories are the same.
4015
4016EOM
4017 case "$installprefix" in
4018 '') dflt=$prefix ;;
4019 *) dflt=$installprefix;;
4020 esac
4021fi
4022fn=d~
4023rp='What installation prefix should I use for installing files?'
4024. ./getfile
4025installprefix="$ans"
4026installprefixexp="$ansexp"
4027
4028: Perform the prefixexp/installprefixexp correction if necessary
4029cat <<EOS >installprefix
4030$startsh
4031EOS
4032cat <<'EOSC' >>installprefix
4033: Change installation prefix, if necessary.
4034if $test X"$prefix" != X"$installprefix"; then
4035 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4036else
4037 eval "install${prefixvar}=\"\$${prefixvar}exp\""
4038fi
4039EOSC
4040chmod +x installprefix
4041$eunicefix installprefix
4042
4043: Set variables such as privlib and privlibexp from the output of ./getfile
4044: performing the prefixexp/installprefixexp correction if necessary.
4045cat <<EOS >setprefixvar
4046$startsh
4047EOS
4048cat <<'EOSC' >>setprefixvar
4049eval "${prefixvar}=\"\$ans\""
4050eval "${prefixvar}exp=\"\$ansexp\""
4051. ./installprefix
4052EOSC
4053chmod +x setprefixvar
4054$eunicefix setprefixvar
4055
4056: set up the script used to warn in case of inconsistency
4057cat <<EOS >whoa
4058$startsh
4059EOS
4060cat <<'EOSC' >>whoa
4061dflt=y
dcb594bc
MB
4062case "$hint" in
4063 recommended)
4064 case "$hintfile" in
4065 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4066 ;;
4067 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
4068 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4069 ;;
4070 esac
4071 ;;
4072 *) echo " "
4073 echo "*** WHOA THERE!!! ***" >&4
4074 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4075 ;;
4076esac
f3f1a2d8
MB
4077rp=" Keep the $hint value?"
4078. ./myread
4079case "$ans" in
4080y) td=$was; tu=$was;;
4081esac
4082EOSC
4083
216dac04 4084: function used to set '$1' to '$val'
f3f1a2d8
MB
4085setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4086case "$val$was" in
4087$define$undef) . ./whoa; eval "$var=\$td";;
4088$undef$define) . ./whoa; eval "$var=\$tu";;
4089*) eval "$var=$val";;
4090esac'
4091
5c40187f
MB
4092: get the patchlevel
4093echo " "
4094echo "Getting the current patchlevel..." >&4
4095if $test -r $rsrc/patchlevel.h;then
4096 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4097 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4098 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4099 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4100 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4101 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff803615 4102 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
5c40187f
MB
4103else
4104 revision=0
4105 patchlevel=0
4106 subversion=0
4107 api_revision=0
4108 api_version=0
4109 api_subversion=0
4110 perl_patchlevel=0
4111 $echo "(You do not have patchlevel.h. Eek.)"
4112fi
5c40187f
MB
4113: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4114version_patchlevel_string="version $patchlevel subversion $subversion"
4115case "$perl_patchlevel" in
41160|'') ;;
0f04e85f
MB
4117*) perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4118 version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4119 ;;
5c40187f
MB
4120esac
4121
4122$echo "(You have $package $version_patchlevel_string.)"
4123
4124case "$osname" in
4125dos|vms)
4126 : XXX Should be a Configure test for double-dots in filenames.
4127 version=`echo $revision $patchlevel $subversion | \
4128 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4129 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4130 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4131 ;;
4132*)
4133 version=`echo $revision $patchlevel $subversion | \
4134 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4135 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4136 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4137 ;;
4138esac
4139: Special case the 5.005_xx maintenance series, which used 5.005
4140: without any subversion label as a subdirectory in $sitelib
4141if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4142 api_versionstring='5.005'
4143fi
4144
613d6c3e 4145: Do we want threads support and if so, what type
f3f1a2d8
MB
4146case "$usethreads" in
4147$define|true|[yY]*) dflt='y';;
4148*) # Catch case where user specified ithreads or 5005threads but
4149 # forgot -Dusethreads (A.D. 4/2002)
4150 case "$useithreads$use5005threads" in
dd35fa16
MB
4151 *$define*) dflt='y';;
4152 *) dflt='n';;
f3f1a2d8
MB
4153 esac
4154 ;;
4155esac
4156cat <<EOM
4157
4158Perl can be built to take advantage of threads on some systems.
4159To do so, Configure can be run with -Dusethreads.
4160
4161Note that Perl built with threading support runs slightly slower
4162and uses more memory than plain Perl. The current implementation
4163is believed to be stable, but it is fairly new, and so should be
4164treated with caution.
4165
4166If this doesn't make any sense to you, just accept the default '$dflt'.
4167EOM
4168rp='Build a threading Perl?'
4169. ./myread
4170case "$ans" in
4171y|Y) val="$define" ;;
4172*) val="$undef" ;;
4173esac
4174set usethreads
4175eval $setvar
4176
5c40187f
MB
4177if $test $patchlevel -lt 9; then
4178 case "$usethreads" in
4179 $define)
f3f1a2d8
MB
4180 $cat <<EOM
4181
4182Since release 5.6, Perl has had two different threading implementations,
4183the newer interpreter-based version (ithreads) with one interpreter per
4184thread, and the older 5.005 version (5005threads).
4185The 5005threads version is effectively unmaintained and will probably be
4186removed in Perl 5.10, so there should be no need to build a Perl using it
4187unless needed for backwards compatibility with some existing 5.005threads
4188code.
4189
4190EOM
4191 : Default to ithreads unless overridden on command line or with
4192 : old config.sh
4193 dflt='y'
4194 case "$use5005threads" in
4195 $define|true|[yY]*) dflt='n';;
4196 esac
4197 case "$useithreads" in
4198 $undef|false|[nN]*) dflt='n';;
4199 esac
4200 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4201 . ./myread
4202 case "$ans" in
f3f1a2d8 4203 y|Y) val="$define" ;;
b4eb6b3d
JH
4204 *) val="$undef" ;;
4205 esac
f3f1a2d8
MB
4206 set useithreads
4207 eval $setvar
4208 : Now set use5005threads to the opposite value.
4209 case "$useithreads" in
4210 $define) val="$undef" ;;
4211 *) val="$define" ;;
4212 esac
4213 set use5005threads
4214 eval $setvar
4215 ;;
5c40187f 4216 *)
f3f1a2d8
MB
4217 useithreads="$undef"
4218 use5005threads="$undef"
b4eb6b3d 4219 ;;
5c40187f 4220 esac
b4eb6b3d 4221
5c40187f
MB
4222 case "$useithreads$use5005threads" in
4223 "$define$define")
f3f1a2d8 4224 $cat >&4 <<EOM
96056487 4225
f3f1a2d8
MB
4226You cannot have both the ithreads and the 5.005 threads enabled
4227at the same time. Disabling the 5.005 threads since they are
4228much less stable than the ithreads.
4229
4230EOM
4231 use5005threads="$undef"
96056487 4232 ;;
5c40187f
MB
4233 esac
4234
4235else
4236: perl-5.9.x and later
4237
47f9f84c 4238 if test X"$usethreads" = "X$define"; then
3f30fabf
MB
4239 case "$use5005threads" in
4240 $define|true|[yY]*)
4241 $cat >&4 <<EOM
47f9f84c
JH
4242
42435.005 threads has been removed for 5.10. Perl will be built using ithreads.
5c40187f 4244
47f9f84c 4245EOM
3f30fabf
MB
4246 ;;
4247 esac
47f9f84c 4248 fi
3f30fabf 4249
47f9f84c
JH
4250 use5005threads="$undef"
4251 useithreads="$usethreads"
5c40187f 4252fi
96056487 4253
f3f1a2d8
MB
4254case "$d_oldpthreads" in
4255'') : Configure tests would be welcome here. For now, assume undef.
4256 val="$undef" ;;
4257*) val="$d_oldpthreads" ;;
4258esac
4259set d_oldpthreads
4260eval $setvar
4261
4262
4263: Look for a hint-file generated 'call-back-unit'. If the
4264: user has specified that a threading perl is to be built,
4265: we may need to set or change some other defaults.
4266if $test -f usethreads.cbu; then
4267 echo "Your platform has some specific hints regarding threaded builds, using them..."
4268 . ./usethreads.cbu
4269else
4270 case "$usethreads" in
4271 "$define"|true|[yY]*)
4272 $cat <<EOM
4273(Your platform does not have any specific hints for threaded builds.
4274 Assuming POSIX threads, then.)
4275EOM
4276 ;;
4277 esac
4278fi
4279
34f1896b 4280: Check if multiplicity is required
f3f1a2d8
MB
4281cat <<EOM
4282
4283Perl can be built so that multiple Perl interpreters can coexist
4284within the same Perl executable.
4285EOM
4286
4287case "$useithreads" in
4288$define)
4289 cat <<EOM
4290This multiple interpreter support is required for interpreter-based threads.
4291EOM
4292 val="$define"
4293 ;;
4294*) case "$usemultiplicity" in
4295 $define|true|[yY]*) dflt='y';;
4296 *) dflt='n';;
4297 esac
4298 echo " "
4299 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4300 rp='Build Perl for multiplicity?'
4301 . ./myread
4302 case "$ans" in
4303 y|Y) val="$define" ;;
4304 *) val="$undef" ;;
4305 esac
4306 ;;
4307esac
4308set usemultiplicity
4309eval $setvar
4310
34f1896b 4311: Check if morebits is requested
f3f1a2d8
MB
4312case "$usemorebits" in
4313"$define"|true|[yY]*)
4314 use64bitint="$define"
4315 uselongdouble="$define"
4316 usemorebits="$define"
4317 ;;
4318*) usemorebits="$undef"
4319 ;;
4320esac
4321
776a38e3
MB
4322: Determine the C compiler to be used
4323echo " "
4324case "$cc" in
4325'') dflt=cc;;
4326*) dflt="$cc";;
4327esac
4328rp="Use which C compiler?"
4329. ./myread
4330cc="$ans"
4331
4332: See whether they have no cc but they do have gcc
4333. ./trygcc
4334if $test -f cc.cbu; then
4335 . ./cc.cbu
4336fi
4337. ./checkcc
4338
f3f1a2d8
MB
4339: make some quick guesses about what we are up against
4340echo " "
4341$echo $n "Hmm... $c"
4342echo exit 1 >bsd
4343echo exit 1 >usg
4344echo exit 1 >v7
4345echo exit 1 >osf1
4346echo exit 1 >eunice
4347echo exit 1 >xenix
4348echo exit 1 >venix
4349echo exit 1 >os2
4350d_bsd="$undef"
4351$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4352if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
e5e20432
JH
4353then
4354 echo "Looks kind of like an OSF/1 system, but we'll see..."
4355 echo exit 0 >osf1
381aa1ff 4356elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
4357 xxx=`./loc addbib blurfl $pth`
4358 if $test -f $xxx; then
4359 echo "Looks kind of like a USG system with BSD features, but we'll see..."
4360 echo exit 0 >bsd
4361 echo exit 0 >usg
4362 else
4363 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4364 echo "Looks kind of like an extended USG system, but we'll see..."
4365 else
4366 echo "Looks kind of like a USG system, but we'll see..."
4367 fi
4368 echo exit 0 >usg
4369 fi
4370elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4371 echo "Looks kind of like a BSD system, but we'll see..."
4372 d_bsd="$define"
4373 echo exit 0 >bsd
4374else
4375 echo "Looks kind of like a Version 7 system, but we'll see..."
4376 echo exit 0 >v7
4377fi
4378case "$eunicefix" in
4379*unixtovms*)
4380 $cat <<'EOI'
4381There is, however, a strange, musty smell in the air that reminds me of
4382something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4383EOI
4384 echo exit 0 >eunice
4385 d_eunice="$define"
4386: it so happens the Eunice I know will not run shell scripts in Unix format
4387 ;;
4388*)
4389 echo " "
4390 echo "Congratulations. You aren't running Eunice."
4391 d_eunice="$undef"
4392 ;;
4393esac
4394: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
4395: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4396: semicolon as a patch separator
e5e20432
JH
4397case "$p_" in
4398:) ;;
4399*)
4400 $cat <<'EOI'
4401I have the feeling something is not exactly right, however...don't tell me...
4402lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 4403(Or you may be running DOS with DJGPP.)
e5e20432
JH
4404EOI
4405 echo exit 0 >os2
4406 ;;
4407esac
4408if test -f /xenix; then
4409 echo "Actually, this looks more like a XENIX system..."
4410 echo exit 0 >xenix
4411 d_xenix="$define"
4412else
4413 echo " "
4414 echo "It's not Xenix..."
4415 d_xenix="$undef"
4416fi
4417chmod +x xenix
4418$eunicefix xenix
4419if test -f /venix; then
4420 echo "Actually, this looks more like a VENIX system..."
4421 echo exit 0 >venix
4422else
4423 echo " "
4424 if ./xenix; then
4425 : null
4426 else
4427 echo "Nor is it Venix..."
4428 fi
4429fi
4430chmod +x bsd usg v7 osf1 eunice xenix venix os2
4431$eunicefix bsd usg v7 osf1 eunice xenix venix os2
4432$rm -f foo
4433
613d6c3e 4434: Check if we are using GNU gcc and what its version is
e5e20432
JH
4435echo " "
4436echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4437$cat >try.c <<EOM
e5e20432
JH
4438#include <stdio.h>
4439int main() {
7686528e 4440#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4441#ifdef __VERSION__
4442 printf("%s\n", __VERSION__);
4443#else
4444 printf("%s\n", "1");
4445#endif
4446#endif
073b6de5 4447 return(0);
e5e20432
JH
4448}
4449EOM
5440bc8e
JH
4450if $cc -o try $ccflags $ldflags try.c; then
4451 gccversion=`$run ./try`
f3f1a2d8
MB
4452 case "$gccversion" in
4453 '') echo "You are not using GNU cc." ;;
4454 *) echo "You are using GNU cc $gccversion."
4455 ccname=gcc
4456 ;;
4457 esac
4458else
4459 echo " "
4460 echo "*** WHOA THERE!!! ***" >&4
4461 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4462 case "$knowitall" in
4463 '')
4464 echo " You'd better start hunting for one and let me know about it." >&4
4465 exit 1
2304df62
AD
4466 ;;
4467 esac
f3f1a2d8
MB
4468fi
4469$rm -f try try.*
4470case "$gccversion" in
44711*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4472esac
4473case "$gccversion" in
4474'') gccosandvers='' ;;
4475*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4476 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4477 gccshortvers=''
4478 case "$gccosandvers" in
4479 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4480 $osname$osvers) ;; # looking good
4481 $osname*) cat <<EOM >&4
4482
4483*** WHOA THERE!!! ***
4484
4485 Your gcc has not been compiled for the exact release of
4486 your operating system ($gccosandvers versus $osname$osvers).
4487
4488 In general it is a good idea to keep gcc synchronized with
4489 the operating system because otherwise serious problems
4490 may ensue when trying to compile software, like Perl.
4491
4492 I'm trying to be optimistic here, though, and will continue.
4493 If later during the configuration and build icky compilation
4494 problems appear (headerfile conflicts being the most common
4495 manifestation), I suggest reinstalling the gcc to match
4496 your operating system release.
4497
4498EOM
4499 ;;
4500 *) gccosandvers='' ;; # failed to parse, better be silent
4501 esac
4502 ;;
4503esac
4504case "$ccname" in
4505'') ccname="$cc" ;;
4506esac
4507
4508# gcc 3.* complain about adding -Idirectories that they already know about,
4509# so we will take those off from locincpth.
4510case "$gccversion" in
45113*)
4512 echo "main(){}">try.c
4513 for incdir in $locincpth; do
4514 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4515 grep '^c[cp]p*[01]: warning: changing search order '`
4516 if test "X$warn" != X; then
4517 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4518 fi
4519 done
4520 $rm -f try try.*
4521esac
2304df62 4522
bd9b35c9
JH
4523: What should the include directory be ?
4524echo " "
4525$echo $n "Hmm... $c"
4526dflt='/usr/include'
4527incpath=''
4528mips_type=''
4529if $test -f /bin/mips && /bin/mips; then
4530 echo "Looks like a MIPS system..."
4531 $cat >usr.c <<'EOCP'
4532#ifdef SYSTYPE_BSD43
4533/bsd43
4534#endif
4535EOCP
8a27cf78 4536 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4537 dflt='/bsd43/usr/include'
4538 incpath='/bsd43'
4539 mips_type='BSD 4.3'
4540 else
4541 mips_type='System V'
4542 fi
4543 $rm -f usr.c usr.out
4544 echo "and you're compiling with the $mips_type compiler and libraries."
4545 xxx_prompt=y
4546 echo "exit 0" >mips
4547else
4548 echo "Doesn't look like a MIPS system."
4549 xxx_prompt=n
4550 echo "exit 1" >mips
4551fi
4552chmod +x mips
4553$eunicefix mips
4554case "$usrinc" in
4555'') ;;
4556*) dflt="$usrinc";;
4557esac
4558case "$xxx_prompt" in
4559y) fn=d/
4560 echo " "
4561 rp='Where are the include files you want to use?'
4562 . ./getfile
4563 usrinc="$ans"
8e07c86e 4564 ;;
bd9b35c9 4565*) usrinc="$dflt"
8e07c86e
AD
4566 ;;
4567esac
2304df62 4568
96056487
JH
4569: see how we invoke the C preprocessor
4570echo " "
4571echo "Now, how can we feed standard input to your C preprocessor..." >&4
4572cat <<'EOT' >testcpp.c
4573#define ABC abc
4574#define XYZ xyz
4575ABC.XYZ
4576EOT
4577cd ..
4578if test ! -f cppstdin; then
4579 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4580 # AIX cc -E doesn't show the absolute headerfile
4581 # locations but we'll cheat by using the -M flag.
4582 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
4583 else
4584 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4585 fi
4586else
4587 echo "Keeping your $hint cppstdin wrapper."
4588fi
4589chmod 755 cppstdin
4590wrapper=`pwd`/cppstdin
4591ok='false'
4592cd UU
4593
4594if $test "X$cppstdin" != "X" && \
4595 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4596 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4597then
4598 echo "You used to use $cppstdin $cppminus so we'll use that again."
4599 case "$cpprun" in
4600 '') echo "But let's see if we can live without a wrapper..." ;;
4601 *)
4602 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4603 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4604 then
4605 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4606 ok='true'
4607 else
4608 echo "(However, $cpprun $cpplast does not work, let's see...)"
4609 fi
4610 ;;
4611 esac
4612else
4613 case "$cppstdin" in
4614 '') ;;
4615 *)
4616 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4617 ;;
4618 esac
4619fi
4620
4621if $ok; then
4622 : nothing
4623elif echo 'Maybe "'"$cc"' -E" will work...'; \
4624 $cc -E <testcpp.c >testcpp.out 2>&1; \
4625 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4626 echo "Yup, it does."
4627 x_cpp="$cc -E"
4628 x_minus='';
4629elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4630 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4631 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632 echo "Yup, it does."
4633 x_cpp="$cc -E"
4634 x_minus='-';
4635elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4636 $cc -P <testcpp.c >testcpp.out 2>&1; \
4637 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4638 echo "Yipee, that works!"
4639 x_cpp="$cc -P"
4640 x_minus='';
4641elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4642 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4643 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644 echo "At long last!"
4645 x_cpp="$cc -P"
4646 x_minus='-';
4647elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4648 $cpp <testcpp.c >testcpp.out 2>&1; \
4649 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650 echo "It works!"
4651 x_cpp="$cpp"
4652 x_minus='';
4653elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4654 $cpp - <testcpp.c >testcpp.out 2>&1; \
4655 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4656 echo "Hooray, it works! I was beginning to wonder."
4657 x_cpp="$cpp"
4658 x_minus='-';
4659elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4660 $wrapper <testcpp.c >testcpp.out 2>&1; \
4661 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4662 x_cpp="$wrapper"
4663 x_minus=''
4664 echo "Eureka!"
4665else
4666 dflt=''
4667 rp="No dice. I can't find a C preprocessor. Name one:"
4668 . ./myread
4669 x_cpp="$ans"
4670 x_minus=''
4671 $x_cpp <testcpp.c >testcpp.out 2>&1
4672 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4673 echo "OK, that will do." >&4
4674 else
4675echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4676 exit 1
4677 fi
4678fi
4679
4680case "$ok" in
4681false)
4682 cppstdin="$x_cpp"
4683 cppminus="$x_minus"
4684 cpprun="$x_cpp"
4685 cpplast="$x_minus"
4686 set X $x_cpp
4687 shift
4688 case "$1" in
4689 "$cpp")
4690 echo "Perhaps can we force $cc -E using a wrapper..."
4691 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4692 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4693 then
4694 echo "Yup, we can."
4695 cppstdin="$wrapper"
4696 cppminus='';
4697 else
4698 echo "Nope, we'll have to live without it..."
4699 fi
4700 ;;
4701 esac
4702 case "$cpprun" in
4703 "$wrapper")
4704 cpprun=''
4705 cpplast=''
4706 ;;
4707 esac
4708 ;;
4709esac
4710
4711case "$cppstdin" in
4712"$wrapper"|'cppstdin') ;;
4713*) $rm -f $wrapper;;
4714esac
4715$rm -f testcpp.c testcpp.out
4716
bd9b35c9
JH
4717: Set private lib path
4718case "$plibpth" in
4719'') if ./mips; then
4720 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4721 fi;;
4722esac
4723case "$libpth" in
4724' ') dlist='';;
4725'') dlist="$loclibpth $plibpth $glibpth";;
4726*) dlist="$libpth";;
4727esac
4728
4729: Now check and see which directories actually exist, avoiding duplicates
4730libpth=''
4731for xxx in $dlist
4732do
4733 if $test -d $xxx; then
4734 case " $libpth " in
4735 *" $xxx "*) ;;
4736 *) libpth="$libpth $xxx";;
4737 esac
4738 fi
4739done
4740$cat <<'EOM'
4741
4742Some systems have incompatible or broken versions of libraries. Among
4743the directories listed in the question below, please remove any you
4744know not to be holding relevant libraries, and add any that are needed.
4745Say "none" for none.
8e07c86e
AD
4746
4747EOM
bd9b35c9
JH
4748case "$libpth" in
4749'') dflt='none';;
8e07c86e 4750*)
bd9b35c9
JH
4751 set X $libpth
4752 shift
4753 dflt=${1+"$@"}
8e07c86e 4754 ;;
a0d0e21e 4755esac
bd9b35c9
JH
4756rp="Directories to use for library searches?"
4757. ./myread
4758case "$ans" in
4759none) libpth=' ';;
4760*) libpth="$ans";;
4761esac
a0d0e21e 4762
bd9b35c9
JH
4763: compute shared library extension
4764case "$so" in
4765'')
4766 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4767 dflt='sl'
dd4e71fd 4768 else
bd9b35c9 4769 dflt='so'
dd4e71fd
JH
4770 fi
4771 ;;
bd9b35c9 4772*) dflt="$so";;
dd4e71fd 4773esac
dd4e71fd
JH
4774$cat <<EOM
4775
bd9b35c9 4776On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4777you want to suppress searching of shared libraries for the remainder
bd9b35c9 4778of this configuration.
dd4e71fd
JH
4779
4780EOM
bd9b35c9
JH
4781rp='What is the file extension used for shared libraries?'
4782. ./myread
4783so="$ans"
dd4e71fd 4784
bd9b35c9
JH
4785: Define several unixisms.
4786: Hints files or command line option can be used to override them.
4787: The convoluted testing is in case hints files set either the old
4788: or the new name.
4789case "$_exe" in
4790'') case "$exe_ext" in
1fef16b3 4791 '') ;;
bd9b35c9 4792 *) _exe="$exe_ext" ;;
dd4e71fd 4793 esac
bd9b35c9 4794 ;;
bfb7748a 4795esac
bd9b35c9
JH
4796case "$_a" in
4797'') case "$lib_ext" in
4798 '') _a='.a';;
4799 *) _a="$lib_ext" ;;
dd4e71fd
JH
4800 esac
4801 ;;
dd4e71fd 4802esac
bd9b35c9
JH
4803case "$_o" in
4804'') case "$obj_ext" in
4805 '') _o='.o';;
4806 *) _o="$obj_ext";;
4807 esac
4808 ;;
4809esac
4810case "$p_" in
4811'') case "$path_sep" in
4812 '') p_=':';;
4813 *) p_="$path_sep";;
4814 esac
4815 ;;
4816esac
4817exe_ext=$_exe
4818lib_ext=$_a
4819obj_ext=$_o
4820path_sep=$p_
dd4e71fd 4821
5b813a60
MB
4822rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4823
b4eb6b3d
JH
4824: Which makefile gets called first. This is used by make depend.
4825case "$firstmakefile" in
4826'') firstmakefile='makefile';;
4633a7c4 4827esac
4633a7c4 4828
dd35fa16
MB
4829: Check is we will use socks
4830case "$usesocks" in
4831$define|true|[yY]*) dflt='y';;
4832*) dflt='n';;
4833esac
4834cat <<EOM
4835
4836Perl can be built to use the SOCKS proxy protocol library. To do so,
4837Configure must be run with -Dusesocks. If you use SOCKS you also need
4838to use the PerlIO abstraction layer, this will be implicitly selected.
4839
4840If this doesn't make any sense to you, just accept the default '$dflt'.
4841EOM
4842rp='Build Perl for SOCKS?'
4843. ./myread
4844case "$ans" in
4845y|Y) val="$define" ;;
4846*) val="$undef" ;;
4847esac
4848set usesocks
4849eval $setvar
4850
34f1896b 4851: Check for uselongdouble support
1f603089
JH
4852case "$ccflags" in
4853*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4854esac
4855
4856case "$uselongdouble" in
4857$define|true|[yY]*) dflt='y';;
4858*) dflt='n';;
4859esac
4860cat <<EOM
4861
4862Perl can be built to take advantage of long doubles which
4863(if available) may give more accuracy and range for floating point numbers.
4864
4865If this doesn't make any sense to you, just accept the default '$dflt'.
4866EOM
4867rp='Try to use long doubles if available?'
4868. ./myread
4869case "$ans" in
4870y|Y) val="$define" ;;
4871*) val="$undef" ;;
4872esac
4873set uselongdouble
4874eval $setvar
4875
4876case "$uselongdouble" in
4877true|[yY]*) uselongdouble="$define" ;;
4878esac
4879
1f603089
JH
4880: Look for a hint-file generated 'call-back-unit'. If the
4881: user has specified that long doubles should be used,
4882: we may need to set or change some other defaults.
9da7673b
MB
4883if $test -f uselongdouble.cbu; then
4884 echo "Your platform has some specific hints regarding long doubles, using them..."
4885 . ./uselongdouble.cbu
4886else
4887 case "$uselongdouble" in
4888 $define)
1f603089 4889 $cat <<EOM
9da7673b 4890(Your platform does not have any specific hints for long doubles.)
1f603089 4891EOM
1f603089 4892 ;;
9da7673b
MB
4893 esac
4894fi
1f603089 4895
bd9b35c9
JH
4896: Looking for optional libraries
4897echo " "
4898echo "Checking for optional libraries..." >&4
4899case "$libs" in
4900' '|'') dflt='';;
4901*) dflt="$libs";;
4902esac
4903case "$libswanted" in
4904'') libswanted='c_s';;
4905esac
4906case "$usesocks" in
923fc586 4907"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4908esac
68435ea7
JH
4909libsfound=''
4910libsfiles=''
4911libsdirs=''
13b3f787
JH
4912libspath=''
4913for thisdir in $libpth $xlibpth; do
4914 test -d $thisdir && libspath="$libspath $thisdir"
4915done
bd9b35c9 4916for thislib in $libswanted; do
13b3f787 4917 for thisdir in $libspath; do
f7dd4e7f
JH
4918 xxx=''
4919 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4920 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4921 $test -f "$xxx" && eval $libscheck
4922 $test -f "$xxx" && libstyle=shared
4923 fi
4924 if test ! -f "$xxx"; then
4925 xxx=$thisdir/lib$thislib.$so
4926 $test -f "$xxx" && eval $libscheck
4927 $test -f "$xxx" && libstyle=shared
613d6c3e 4928 fi
f7dd4e7f
JH
4929 if test ! -f "$xxx"; then
4930 xxx=$thisdir/lib$thislib$_a
4931 $test -f "$xxx" && eval $libscheck
4932 $test -f "$xxx" && libstyle=static
4933 fi
4934 if test ! -f "$xxx"; then
4935 xxx=$thisdir/$thislib$_a
4936 $test -f "$xxx" && eval $libscheck
4937 $test -f "$xxx" && libstyle=static
4938 fi
4939 if test ! -f "$xxx"; then
4940 xxx=$thisdir/lib${thislib}_s$_a
4941 $test -f "$xxx" && eval $libscheck
4942 $test -f "$xxx" && libstyle=static
09ea5ba9 4943 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4944 fi
4945 if test ! -f "$xxx"; then
4946 xxx=$thisdir/Slib$thislib$_a
4947 $test -f "$xxx" && eval $libscheck
4948 $test -f "$xxx" && libstyle=static
4949 fi
4950 if $test -f "$xxx"; then
43999f95 4951 case "$libstyle" in
f7dd4e7f
JH
4952 shared) echo "Found -l$thislib (shared)." ;;
4953 static) echo "Found -l$thislib." ;;
4954 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4955 esac
bd9b35c9
JH
4956 case " $dflt " in
4957 *"-l$thislib "*);;
f7dd4e7f 4958 *) dflt="$dflt -l$thislib"
43999f95
JH
4959 libsfound="$libsfound $xxx"
4960 yyy=`basename $xxx`
4961 libsfiles="$libsfiles $yyy"
1e127011 4962 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4963 case " $libsdirs " in
4964 *" $yyy "*) ;;
4965 *) libsdirs="$libsdirs $yyy" ;;
4966 esac
4967 ;;
bd9b35c9 4968 esac
f7dd4e7f 4969 break
613d6c3e 4970 fi
f7dd4e7f
JH
4971 done
4972 if $test ! -f "$xxx"; then
4973 echo "No -l$thislib."
bd9b35c9
JH
4974 fi
4975done
4976set X $dflt
4977shift
4978dflt="$*"
4979case "$libs" in
4980'') dflt="$dflt";;
4981*) dflt="$libs";;
4982esac
4983case "$dflt" in
4984' '|'') dflt='none';;
4985esac
4633a7c4 4986
bd9b35c9 4987$cat <<EOM
4633a7c4 4988
bd9b35c9
JH
4989In order to compile $package on your machine, a number of libraries
4990are usually needed. Include any other special libraries here as well.
4991Say "none" for none. The default list is almost always right.
8e07c86e 4992EOM
8e07c86e 4993
bd9b35c9
JH
4994echo " "
4995rp="What libraries to use?"
4996. ./myread
4997case "$ans" in
4998none) libs=' ';;
4999*) libs="$ans";;
5000esac
d71b2b6b 5001
bd9b35c9
JH
5002: determine optimization, if desired, or use for debug flag also
5003case "$optimize" in
5004' '|$undef) dflt='none';;
5005'') dflt='-O';;
5006*) dflt="$optimize";;
5007esac
5008$cat <<EOH
d71b2b6b 5009
bd9b35c9
JH
5010By default, $package compiles with the -O flag to use the optimizer.
5011Alternately, you might want to use the symbolic debugger, which uses
5012the -g flag (on traditional Unix systems). Either flag can be
5013specified here. To use neither flag, specify the word "none".
d71b2b6b 5014
bd9b35c9
JH
5015EOH
5016rp="What optimizer/debugger flag should be used?"
5017. ./myread
5018optimize="$ans"
5019case "$optimize" in
5020'none') optimize=" ";;
5021esac
5022
eaf812ae
MB
5023: Check what DEBUGGING is required from the command line
5024: -DEBUGGING or -DDEBUGGING or
5025: -DEBUGGING=both = -g + -DDEBUGGING
5026: -DEBUGGING=-g or -Doptimize=-g = -g
5027: -DEBUGGING=none or -UDEBUGGING =
5028: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5029case "$EBUGGING" in
5030'') ;;
5031*) DEBUGGING=$EBUGGING ;;
5032esac
5033
5034case "$DEBUGGING" in
5a7c70d6 5035-g|both|$define)
eaf812ae
MB
5036 case "$optimize" in
5037 *-g*) ;;
5038 *) optimize="$optimize -g" ;;
5039 esac ;;
5040none|$undef)
5041 case "$optimize" in
5042 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5043 shift
5044 optimize="$*"
5045 ;;
5046 esac ;;
5047esac
5048
bd9b35c9 5049dflt=''
eaf812ae
MB
5050case "$DEBUGGING" in
5051both|$define) dflt='-DDEBUGGING'
5052esac
5053
c34316b3
NC
5054: argument order is deliberate, as the flag will start with - which set could
5055: think is an option
6682be1c 5056checkccflag='check=$1; flag=$2; callback=$3;
c34316b3
NC
5057echo " ";
5058echo "Checking if your compiler accepts $flag" 2>&1;
5059echo "int main(void) { return 0; }" > gcctest.c;
04b62921 5060if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
c34316b3 5061 echo "Yes, it does." 2>&1;
580e570e 5062 if $test -s gcctest.out ; then
04b62921
MB
5063 echo "But your platform does not like it:";
5064 cat gcctest.out;
5065 else
5066 case "$ccflags" in
5067 *$check*)
5068 echo "Leaving current flags $ccflags alone." 2>&1
5069 ;;
5070 *) dflt="$dflt $flag";
5071 eval $callback
5072 ;;
5073 esac
5074 fi
c34316b3
NC
5075else
5076 echo "Nope, it does not, but that is ok." 2>&1;
5077fi
5078'
5079
bd9b35c9
JH
5080: We will not override a previous value, but we might want to
5081: augment a hint file
5082case "$hint" in
5083default|recommended)
5084 case "$gccversion" in
eaf812ae 5085 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5086 esac
eaf812ae
MB
5087 case "$optimize:$DEBUGGING" in
5088 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5089 esac
bd9b35c9 5090 case "$gccversion" in
580e570e 5091 2*) if $test -d /etc/conf/kconfig.d &&
bd9b35c9
JH
5092 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5093 then
00e89ad4 5094 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5095 dflt="$dflt -posix"
5096 fi
f0d04425 5097 ;;
bd9b35c9
JH
5098 esac
5099 case "$gccversion" in
5100 1*) ;;
5101 2.[0-8]*) ;;
c0bacbef 5102 ?*) set strict-aliasing -fno-strict-aliasing
c34316b3 5103 eval $checkccflag
f0d04425 5104 ;;
e5e20432 5105 esac
00e89ad4
AD
5106 # For gcc, adding -pipe speeds up compilations for some, but apparently
5107 # some assemblers can't read from stdin. (It also slows down compilations
5108 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5109 case "$gccversion" in
c34316b3
NC
5110 ?*) set pipe -pipe
5111 eval $checkccflag
00e89ad4
AD
5112 ;;
5113 esac
6682be1c
NC
5114
5115 # on x86_64 (at least) we require an extra library (libssp) in the
5116 # link command line. This library is not named, so I infer that it is
5117 # an implementation detail that may change. Hence the safest approach
5118 # is to add the flag to the flags passed to the compiler at link time,
5119 # as that way the compiler can do the right implementation dependant
5120 # thing. (NWC)
5121 case "$gccversion" in
8f68b0e6 5122 ?*) set stack-protector -fstack-protector
6682be1c
NC
5123 eval $checkccflag
5124 ;;
5125 esac
e5e20432
JH
5126 ;;
5127esac
5128
bd9b35c9
JH
5129case "$mips_type" in
5130*BSD*|'') inclwanted="$locincpth $usrinc";;
5131*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5132esac
5133for thisincl in $inclwanted; do
5134 if $test -d $thisincl; then
5135 if $test x$thisincl != x$usrinc; then
5136 case "$dflt" in
00e89ad4
AD
5137 *" -I$thisincl "*);;
5138 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5139 esac
5140 fi
5141 fi
5142done
40a7a20a 5143
bd9b35c9
JH
5144inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5145 xxx=true;
5146elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5147 xxx=true;
5148else
5149 xxx=false;
5150fi;
5151if $xxx; then
5152 case "$dflt" in
5153 *$2*);;
5154 *) dflt="$dflt -D$2";;
5155 esac;
5156fi'
40a7a20a 5157
bd9b35c9 5158set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5159
bd9b35c9
JH
5160case "$usesocks" in
5161$define)
5162 ccflags="$ccflags -DSOCKS"
5163 ;;
5164esac
40a7a20a 5165
bd9b35c9
JH
5166case "$hint" in
5167default|recommended) dflt="$ccflags $dflt" ;;
5168*) dflt="$ccflags";;
5169esac
40a7a20a 5170
bd9b35c9
JH
5171case "$dflt" in
5172''|' ') dflt=none;;
5173esac
422af00a 5174
bd9b35c9 5175$cat <<EOH
40a7a20a 5176
bd9b35c9
JH
5177Your C compiler may want other flags. For this question you should include
5178-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5179but you should NOT include libraries or ld flags like -lwhatever. If you
5180want $package to honor its debug switch, you should include -DDEBUGGING here.
5181Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5182
bd9b35c9 5183To use no flags, specify the word "none".
40a7a20a 5184
bd9b35c9
JH
5185EOH
5186set X $dflt
5187shift
5188dflt=${1+"$@"}
5189rp="Any additional cc flags?"
5190. ./myread
5191case "$ans" in
5192none) ccflags='';;
5193*) ccflags="$ans";;
5194esac
8e07c86e 5195
bd9b35c9 5196: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5197case "$cppflags" in
5198'') cppflags="$ccflags" ;;
5199*) cppflags="$cppflags $ccflags" ;;
5200esac
bd9b35c9
JH
5201case "$gccversion" in
52021*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5203esac
bd9b35c9
JH
5204case "$mips_type" in
5205'');;
5206*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5207esac
5208case "$cppflags" in
5209'');;
5210*)
5211 echo " "
5212 echo "Let me guess what the preprocessor flags are..." >&4
5213 set X $cppflags
5214 shift
5215 cppflags=''
5216 $cat >cpp.c <<'EOM'
5217#define BLURFL foo
8e07c86e 5218
bd9b35c9
JH
5219BLURFL xx LFRULB
5220EOM
5221 previous=''
5222 for flag in $*
5223 do
5224 case "$flag" in
5225 -*) ftry="$flag";;
5226 *) ftry="$previous $flag";;
5227 esac
5228 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5229 >cpp1.out 2>/dev/null && \
5230 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5231 >cpp2.out 2>/dev/null && \
5232 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5233 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5234 then
5235 cppflags="$cppflags $ftry"
5236 previous=''
5237 else
5238 previous="$flag"
5239 fi
5240 done
5241 set X $cppflags
5242 shift
5243 cppflags=${1+"$@"}
5244 case "$cppflags" in
5245 *-*) echo "They appear to be: $cppflags";;
5246 esac
5247 $rm -f cpp.c cpp?.out
2afac517 5248 ;;
5249esac
8e07c86e 5250
bd9b35c9
JH
5251: flags used in final linking phase
5252case "$ldflags" in
5253'') if ./venix; then
5254 dflt='-i -z'
10a23457 5255 else
bd9b35c9 5256 dflt=''
10a23457 5257 fi
bd9b35c9
JH
5258 case "$ccflags" in
5259 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5260 esac
bd9b35c9
JH
5261 ;;
5262*) dflt="$ldflags";;
5263esac
b2f871ed
AD
5264# See note above about -fstack-protector
5265case "$ccflags" in
5266*-fstack-protector*)
5267 case "$dflt" in
5268 *-fstack-protector*) ;; # Don't add it again
5269 *) dflt="$dflt -fstack-protector" ;;
5270 esac
5271 ;;
5272esac
bd9b35c9
JH
5273
5274: Try to guess additional flags to pick up local libraries.
5275for thislibdir in $libpth; do
5276 case " $loclibpth " in
5277 *" $thislibdir "*)
00e89ad4 5278 case "$dflt " in
bd9b35c9
JH
5279 *"-L$thislibdir "*) ;;
5280 *) dflt="$dflt -L$thislibdir" ;;
5281 esac
c4f23d77
AD
5282 ;;
5283 esac
bd9b35c9 5284done
c4f23d77 5285
bd9b35c9
JH
5286case "$dflt" in
5287'') dflt='none' ;;
5288esac
c4f23d77 5289
bd9b35c9
JH
5290$cat <<EOH
5291
5292Your C linker may need flags. For this question you should
5293include -L/whatever and any other flags used by the C linker, but you
5294should NOT include libraries like -lwhatever.
5295
5296Make sure you include the appropriate -L/path flags if your C linker
5297does not normally search all of the directories you specified above,
5298namely
5299 $libpth
5300To use no flags, specify the word "none".
5301
5302EOH
5303
5304rp="Any additional ld flags (NOT including libraries)?"
5305. ./myread
5306case "$ans" in
5307none) ldflags='';;
5308*) ldflags="$ans";;
5309esac
5310rmlist="$rmlist pdp11"
5311
5312: coherency check
5313echo " "
5314echo "Checking your choice of C compiler and flags for coherency..." >&4
5315$cat > try.c <<'EOF'
5316#include <stdio.h>
55954f19 5317int main() { printf("Ok\n"); return(0); }
bd9b35c9 5318EOF
7a282f6d 5319set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5320shift
5321$cat >try.msg <<'EOM'
5322I've tried to compile and run the following simple program:
5323
5324EOM
5325$cat try.c >> try.msg
5326
5327$cat >> try.msg <<EOM
5328
5329I used the command:
5330
5331 $*
5440bc8e 5332 $run ./try
bd9b35c9
JH
5333
5334and I got the following output:
5335
5336EOM
5337dflt=y
73614538 5338if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
613d6c3e 5339 if $sh -c "$run ./try " >>try.msg 2>&1; then
5440bc8e 5340 xxx=`$run ./try`
bd9b35c9
JH
5341 case "$xxx" in
5342 "Ok") dflt=n ;;
5343 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5344 case " $libs " in
5345 *" -lsfio "*)
5346 cat >> try.msg <<'EOQS'
5347If $libs contains -lsfio, and sfio is mis-configured, then it
5348sometimes (apparently) runs and exits with a 0 status, but with no
5349output! It may have to do with sfio's use of _exit vs. exit.
5350
5351EOQS
5352 rp="You have a big problem. Shall I abort Configure"
5353 dflt=y
5354 ;;
5355 esac
5356 ;;
5357 esac
5358 else
5359 echo "The program compiled OK, but exited with status $?." >>try.msg
5360 rp="You have a problem. Shall I abort Configure"
5361 dflt=y
5362 fi
5363else
5364 echo "I can't compile the test program." >>try.msg
5365 rp="You have a BIG problem. Shall I abort Configure"
5366 dflt=y
5367fi
5368case "$dflt" in
5369y)
5370 $cat try.msg >&4
5371 case "$knowitall" in
5372 '')
5373 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5374 ;;
bd9b35c9 5375 *) dflt=n;;
c4f23d77 5376 esac
bd9b35c9
JH
5377 echo " "
5378 . ./myread
5379 case "$ans" in
5380 n*|N*) ;;
5381 *) echo "Ok. Stopping Configure." >&4
5382 exit 1
c4f23d77
AD
5383 ;;
5384 esac
5385 ;;
bd9b35c9 5386n) echo "OK, that should do.";;
c4f23d77 5387esac
613d6c3e 5388$rm_try gcctest gcctest.out
c4f23d77 5389
bd9b35c9
JH
5390: define a shorthand compile call
5391compile='
5392mc_file=$1;
5393shift;
08593cf4
NC
5394case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5395echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5396exit 1;
5397fi;
5398esac;
08413ebc 5399$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5400: define a shorthand compile call for compilations that should be ok.
5401compile_ok='
5402mc_file=$1;
5403shift;
7a282f6d 5404$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5405
8dfa8df9
JH
5406: determine filename position in cpp output
5407echo " "
5408echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5409case "$osname" in
5410vos) testaccess=-e ;;
5411*) testaccess=-r ;;
5412esac
8dfa8df9
JH
5413echo '#include <stdio.h>' > foo.c
5414$cat >fieldn <<EOF
5415$startsh
5416$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5417$grep '^[ ]*#.*stdio\.h' | \
5418while read cline; do
5419 pos=1
5420 set \$cline
5421 while $test \$# -gt 0; do
a5a94ea5 5422 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5423 echo "\$pos"
5424 exit 0
5425 fi
5426 shift
5427 pos=\`expr \$pos + 1\`
5428 done
5429done
5430EOF
5431chmod +x fieldn
5432fieldn=`./fieldn`
5433$rm -f foo.c fieldn
5434case $fieldn in
5435'') pos='???';;
54361) pos=first;;
54372) pos=second;;
54383) pos=third;;
5439*) pos="${fieldn}th";;
5440esac
5441echo "Your cpp writes the filename in the $pos field of the line."
5442
3c728e00
JH
5443case "$osname" in
5444vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5445os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5446*) cppfilter='' ;;
5447esac
8dfa8df9
JH
5448: locate header file
5449$cat >findhdr <<EOF
5450$startsh
5451wanted=\$1
5452name=''
5453for usrincdir in $usrinc
5454do
5455 if test -f \$usrincdir/\$wanted; then
5456 echo "\$usrincdir/\$wanted"
5457 exit 0
5458 fi
5459done
5460awkprg='{ print \$$fieldn }'
5461echo "#include <\$wanted>" > foo\$\$.c
5462$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5463$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5464while read cline; do
5465 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5466 case "\$name" in
5467 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5468 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5469 *) exit 2;;
5470 esac;
5471done;
5472#
5473# status = 0: grep returned 0 lines, case statement not executed
5474# status = 1: headerfile found
5475# status = 2: while loop executed, no headerfile found
5476#
5477status=\$?
5478$rm -f foo\$\$.c;
5479if test \$status -eq 1; then
5480 exit 0;
5481fi
5482exit 1
5483EOF
5484chmod +x findhdr
5485
5486: define an alternate in-header-list? function
5487inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5488cont=true; xxf="echo \"<\$1> found.\" >&4";
5489case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5490*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5491esac;
5492case $# in 4) instead=instead;; *) instead="at last";; esac;
5493while $test "$cont"; do
5494 xxx=`./findhdr $1`
5495 var=$2; eval "was=\$$2";
5496 if $test "$xxx" && $test -r "$xxx";
5497 then eval $xxf;
5498 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5499 cont="";
5500 else eval $xxnf;
5501 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5502 set $yyy; shift; shift; yyy=$@;
5503 case $# in 0) cont="";;
5504 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5505 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5506 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5507 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5508 esac;
5509done;
5510while $test "$yyy";
5511do set $yyy; var=$2; eval "was=\$$2";
5512 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5513 set $yyy; shift; shift; yyy=$@;
5514done'
5515
d1daaddf
JH
5516: see if stdlib is available
5517set stdlib.h i_stdlib
5518eval $inhdr
5519
5520: check for lengths of integral types
5521echo " "
5522case "$intsize" in
5523'')
5524 echo "Checking to see how big your integers are..." >&4
c63dfae1 5525 $cat >try.c <<EOCP
d1daaddf
JH
5526#include <stdio.h>
5527#$i_stdlib I_STDLIB
5528#ifdef I_STDLIB
5529#include <stdlib.h>
5530#endif
5531int main()
5532{
5533 printf("intsize=%d;\n", (int)sizeof(int));
5534 printf("longsize=%d;\n", (int)sizeof(long));
5535 printf("shortsize=%d;\n", (int)sizeof(short));
5536 exit(0);
5537}
5538EOCP
5539 set try
5540 if eval $compile_ok && $run ./try > /dev/null; then
5541 eval `$run ./try`
5542 echo "Your integers are $intsize bytes long."
5543 echo "Your long integers are $longsize bytes long."
5544 echo "Your short integers are $shortsize bytes long."
5545 else
5546 $cat >&4 <<EOM
5547!
5548Help! I can't compile and run the intsize test program: please enlighten me!
5549(This is probably a misconfiguration in your system or libraries, and
5550you really ought to fix it. Still, I'll try anyway.)
5551!
5552EOM
5553 dflt=4
5554 rp="What is the size of an integer (in bytes)?"
5555 . ./myread
5556 intsize="$ans"
5557 dflt=$intsize
5558 rp="What is the size of a long integer (in bytes)?"
5559 . ./myread
5560 longsize="$ans"
5561 dflt=2
5562 rp="What is the size of a short integer (in bytes)?"
5563 . ./myread
5564 shortsize="$ans"
5565 fi
5566 ;;
5567esac
5b813a60 5568$rm_try
d1daaddf
JH
5569
5570: check for long long
5571echo " "
5572echo "Checking to see if you have long long..." >&4
5573echo 'int main() { long long x = 7; return 0; }' > try.c
5574set try
5575if eval $compile; then
5576 val="$define"
5577 echo "You have long long."
5578else
5579 val="$undef"
5580 echo "You do not have long long."
5581fi
5b813a60 5582$rm_try
d1daaddf
JH
5583set d_longlong
5584eval $setvar
5585
5586: check for length of long long
5587case "${d_longlong}${longlongsize}" in
5588$define)
5589 echo " "
5590 echo "Checking to see how big your long longs are..." >&4
5591 $cat >try.c <<'EOCP'
5592#include <stdio.h>
5593int main()
5594{
5595 printf("%d\n", (int)sizeof(long long));
5596 return(0);
5597}
5598EOCP
5599 set try
5600 if eval $compile_ok; then
5601 longlongsize=`$run ./try`
5602 echo "Your long longs are $longlongsize bytes long."
5603 else
5604 dflt='8'
5605 echo " "
5606 echo "(I can't seem to compile the test program. Guessing...)"
5607 rp="What is the size of a long long (in bytes)?"
5608 . ./myread
5609 longlongsize="$ans"
5610 fi
5611 if $test "X$longsize" = "X$longlongsize"; then
5612 echo "(That isn't any different from an ordinary long.)"
5b813a60 5613 fi
d1daaddf
JH
5614 ;;
5615esac
5b813a60 5616$rm_try
d1daaddf 5617
8dfa8df9
JH
5618: see if inttypes.h is available
5619: we want a real compile instead of Inhdr because some systems
5620: have an inttypes.h which includes non-existent headers
5621echo " "
5622$cat >try.c <<EOCP
5623#include <inttypes.h>
5624int main() {
5625 static int32_t foo32 = 0x12345678;
5626}
5627EOCP
5628set try
5629if eval $compile; then
5630 echo "<inttypes.h> found." >&4
5631 val="$define"
5632else
5633 echo "<inttypes.h> NOT found." >&4
5634 val="$undef"
5635fi
5b813a60 5636$rm_try
8dfa8df9
JH
5637set i_inttypes
5638eval $setvar
5639
5640: check for int64_t
5641echo " "
5642echo "Checking to see if you have int64_t..." >&4
5643$cat >try.c <<EOCP
5644#include <sys/types.h>
5645#$i_inttypes I_INTTYPES
5646#ifdef I_INTTYPES
5647#include <inttypes.h>
5648#endif
5649int main() { int64_t x = 7; }
5650EOCP
5651set try
5652if eval $compile; then
5653 val="$define"
5654 echo "You have int64_t."
5655else
5656 val="$undef"
5657 echo "You do not have int64_t."
5658fi
5b813a60 5659$rm_try
8dfa8df9
JH
5660set d_int64_t
5661eval $setvar
5662
613d6c3e 5663: Check if 64bit ints have a quad type
8dfa8df9
JH
5664echo " "
5665echo "Checking which 64-bit integer type we could use..." >&4
5666
5667case "$intsize" in
56688) val=int
5669 set quadtype
5670 eval $setvar
5671 val='"unsigned int"'
5672 set uquadtype
5673 eval $setvar
5674 quadkind=1
5675 ;;
5676*) case "$longsize" in
5677 8) val=long
5678 set quadtype
5679 eval $setvar
5680 val='"unsigned long"'
5681 set uquadtype
5682 eval $setvar
5683 quadkind=2
5684 ;;
5685 *) case "$d_longlong:$longlongsize" in
5686 define:8)
5687 val='"long long"'
5688 set quadtype
5689 eval $setvar
5690 val='"unsigned long long"'
5691 set uquadtype
5692 eval $setvar
5693 quadkind=3
5694 ;;
5695 *) case "$d_int64_t" in
5696 define)
5697 val=int64_t
5698 set quadtype
5699 eval $setvar
5700 val=uint64_t
5701 set uquadtype
5702 eval $setvar
5703 quadkind=4
5704 ;;
5705 esac
5706 ;;
5707 esac
5708 ;;
5709 esac
5710 ;;
5711esac
5712
5713case "$quadtype" in
5714'') echo "Alas, no 64-bit integer types in sight." >&4
5715 d_quad="$undef"
5716 ;;
5717*) echo "We could use '$quadtype' for 64-bit integers." >&4
5718 d_quad="$define"
5719 ;;
5720esac
5721
34f1896b 5722: Do we want 64bit support
b4eb6b3d
JH
5723case "$uselonglong" in
5724"$define"|true|[yY]*)
5725 cat <<EOM >&4
5726
5727*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5728EOM
5729 use64bitint="$define"
5730 ;;
613d6c3e 5731esac
b4eb6b3d
JH
5732case "$use64bits" in
5733"$define"|true|[yY]*)
5734 cat <<EOM >&4
5735
5736*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5737EOM
5738 use64bitint="$define"
5739 ;;
613d6c3e 5740esac
b4eb6b3d
JH
5741case "$use64bitints" in
5742"$define"|true|[yY]*)
5743 cat <<EOM >&4
5744
5745*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5746EOM
5747 use64bitint="$define"
5748 ;;
613d6c3e 5749esac
b4eb6b3d
JH
5750case "$use64bitsint" in
5751"$define"|true|[yY]*)
5752 cat <<EOM >&4
5753
5754*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5755EOM
5756 use64bitint="$define"
5757 ;;
613d6c3e 5758esac
b4eb6b3d
JH
5759case "$uselonglongs" in
5760"$define"|true|[yY]*)
5761 cat <<EOM >&4
5762
5763*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5764EOM
5765 use64bitint="$define"
5766 ;;
613d6c3e 5767esac
b4eb6b3d
JH
5768case "$use64bitsall" in
5769"$define"|true|[yY]*)
5770 cat <<EOM >&4
5771
5772*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5773EOM
5774 use64bitall="$define"
5775 ;;
613d6c3e 5776esac
b4eb6b3d
JH
5777
5778case "$ccflags" in
5779*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5780esac
5781case "$use64bitall" in
5782"$define"|true|[yY]*) use64bitint="$define" ;;
5783esac
5784
5785case "$longsize" in
57868) cat <<EOM
5787
5788You have natively 64-bit long integers.
5789EOM
5790 val="$define"
5791 ;;
5792*) case "$use64bitint" in
5793 "$define"|true|[yY]*) dflt='y';;
5794 *) dflt='n';;
5795 esac
8dfa8df9
JH
5796 case "$d_quad" in
5797 "$define") ;;
5798 *) dflt='n' ;;
5799 esac
b4eb6b3d
JH
5800 cat <<EOM
5801
5802Perl can be built to take advantage of 64-bit integer types
5803on some systems. To do so, Configure can be run with -Duse64bitint.
5804Choosing this option will most probably introduce binary incompatibilities.
5805
5806If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5807(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5808EOM
5809 rp='Try to use 64-bit integers, if available?'
5810 . ./myread
5811 case "$ans" in
5812 [yY]*) val="$define" ;;
5813 *) val="$undef" ;;
5814 esac
5815 ;;
5816esac
5817set use64bitint
5818eval $setvar
5819
5820case "$use64bitall" in
5821"$define"|true|[yY]*) dflt='y' ;;
5822*) case "$longsize" in
5823 8) dflt='y' ;;
5824 *) dflt='n' ;;
5825 esac
5826 ;;
613d6c3e 5827esac
b4eb6b3d
JH
5828cat <<EOM
5829
5830You may also choose to try maximal 64-bitness. It means using as much
583164-bitness as possible on the platform. This in turn means even more
5832binary incompatibilities. On the other hand, your platform may not
5833have any more 64-bitness available than what you already have chosen.
5834
5835If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5836(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5837EOM
5838rp='Try to use maximal 64-bit support, if available?'
5839. ./myread
5840case "$ans" in
5841[yY]*) val="$define" ;;
5842*) val="$undef" ;;
5843esac
5844set use64bitall
5845eval $setvar
5846case "$use64bitall" in
5847"$define")
5848 case "$use64bitint" in
5849 "$undef")
5850 cat <<EOM
5851
5852Since you have chosen a maximally 64-bit build, I'm also turning on
5853the use of 64-bit integers.
5854EOM
5855 use64bitint="$define" ;;
5856 esac
5857 ;;
5858esac
5859
b4eb6b3d
JH
5860: Look for a hint-file generated 'call-back-unit'. If the
5861: user has specified that a 64-bit perl is to be built,
5862: we may need to set or change some other defaults.
19a100ff 5863if $test -f use64bitint.cbu; then
9da7673b 5864 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5865 . ./use64bitint.cbu
5866fi
9da7673b
MB
5867case "$use64bitint" in
5868"$define"|true|[yY]*)
b4eb6b3d
JH
5869 case "$longsize" in
5870 4) case "$archname64" in
5871 '') archname64=64int ;;
5872 esac
5873 ;;
5874 esac
5875 ;;
5876esac
5877
b4eb6b3d
JH
5878: Look for a hint-file generated 'call-back-unit'. If the
5879: user has specified that a maximally 64-bit perl is to be built,
5880: we may need to set or change some other defaults.
19a100ff 5881if $test -f use64bitall.cbu; then
9da7673b 5882 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5883 . ./use64bitall.cbu
5884fi
9da7673b
MB
5885case "$use64bitall" in
5886"$define"|true|[yY]*)
b4eb6b3d
JH
5887 case "$longsize" in
5888 4) case "$archname64" in
5889 ''|64int) archname64=64all ;;
5890 esac
5891 ;;
5892 esac
5893 ;;
5894esac
5895
1911a026
JH
5896case "$d_quad:$use64bitint" in
5897$undef:$define)
5898 cat >&4 <<EOF
5899
5900*** You have chosen to use 64-bit integers,
19a100ff 5901*** but none can be found.
09b58c7b 5902*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5903*** Cannot continue, aborting.
5904
5905EOF
5906 exit 1
5907 ;;
5908esac
5909
36adc09b
JH
5910: check for length of double
5911echo " "
5912case "$doublesize" in
5913'')
5914 echo "Checking to see how big your double precision numbers are..." >&4
5915 $cat >try.c <<EOCP
5916#include <stdio.h>
1911a026
JH
5917#$i_stdlib I_STDLIB
5918#ifdef I_STDLIB
5919#include <stdlib.h>
5920#endif
36adc09b
JH
5921int main()
5922{
5923 printf("%d\n", (int)sizeof(double));
1911a026 5924 exit(0);
36adc09b
JH
5925}
5926EOCP
5927 set try
5928 if eval $compile_ok; then
5929 doublesize=`$run ./try`
5930 echo "Your double is $doublesize bytes long."
5931 else
5932 dflt='8'
5933 echo "(I can't seem to compile the test program. Guessing...)"
5934 rp="What is the size of a double precision number (in bytes)?"
5935 . ./myread
5936 doublesize="$ans"
5937 fi
5938 ;;
5939esac
5b813a60 5940$rm_try
36adc09b
JH
5941
5942: check for long doubles
5943echo " "
5944echo "Checking to see if you have long double..." >&4
5945echo 'int main() { long double x = 7.0; }' > try.c
5946set try
5947if eval $compile; then
5948 val="$define"
5949 echo "You have long double."
5950else
5951 val="$undef"
5952 echo "You do not have long double."
5953fi
5b813a60 5954$rm_try
36adc09b
JH
5955set d_longdbl
5956eval $setvar
5957
5958: check for length of long double
5959case "${d_longdbl}${longdblsize}" in
5960$define)
5961 echo " "
5962 echo "Checking to see how big your long doubles are..." >&4
5963 $cat >try.c <<'EOCP'
5964#include <stdio.h>
5965int main()
5966{
5967 printf("%d\n", sizeof(long double));
5968}
5969EOCP
5970 set try
5971 set try
5972 if eval $compile; then
5973 longdblsize=`$run ./try`
5974 echo "Your long doubles are $longdblsize bytes long."
5975 else
5976 dflt='8'
5977 echo " "
5978 echo "(I can't seem to compile the test program. Guessing...)" >&4
5979 rp="What is the size of a long double (in bytes)?"
5980 . ./myread
5981 longdblsize="$ans"
5982 fi
5983 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5984 echo "That isn't any different from an ordinary double."
5985 echo "I'll keep your setting anyway, but you may see some"
5986 echo "harmless compilation warnings."
5b813a60 5987 fi
36adc09b
JH
5988 ;;
5989esac
5b813a60 5990$rm_try
36adc09b 5991
89ce900e 5992: determine the architecture name
b4eb6b3d 5993echo " "
89ce900e
JH
5994if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5995 tarch=`arch`"-$osname"
5996elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5997 if uname -m > tmparch 2>&1 ; then
5998 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5999 -e 's/$/'"-$osname/" tmparch`
6000 else
6001 tarch="$osname"
6002 fi
6003 $rm -f tmparch
b4eb6b3d 6004else
89ce900e 6005 tarch="$osname"
b4eb6b3d 6006fi
89ce900e
JH
6007case "$myarchname" in
6008''|"$tarch") ;;
6009*)
6010 echo "(Your architecture name used to be $myarchname.)"
6011 archname=''
6012 ;;
6013esac
6014case "$targetarch" in
6015'') ;;
6016*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6017esac
6018myarchname="$tarch"
6019case "$archname" in
6020'') dflt="$tarch";;
6021*) dflt="$archname";;
6022esac
6023rp='What is your architecture name'
6024. ./myread
6025archname="$ans"
ba95ddbf
DG
6026
6027: optionally add api version to the architecture for versioned archlibs
1a1287f4
MB
6028case "$useversionedarchname" in
6029$define|true|[yY]*) dflt='y';;
6030*) dflt='n';;
ba95ddbf
DG
6031esac
6032rp='Add the Perl API version to your archname?'
6033. ./myread
6034case "$ans" in
1a1287f4
MB
6035y|Y) useversionedarchname="$define" ;;
6036*) useversionedarchname="$undef" ;;
ba95ddbf 6037esac
1a1287f4 6038case "$useversionedarchname" in
ba95ddbf
DG
6039$define)
6040 case "$archname" in
6041 *-$api_versionstring)
6042 echo "...and architecture name already has -$api_versionstring" >&4
6043 ;;
6044 *)
6045 archname="$archname-$api_versionstring"
6046 echo "...setting architecture name to $archname." >&4
6047 ;;
6048 esac
6049 ;;
6050esac
6051
89ce900e
JH
6052case "$usethreads" in
6053$define)
6054 echo "Threads selected." >&4
6055 case "$archname" in
6056 *-thread*) echo "...and architecture name already has -thread." >&4
6057 ;;
6058 *) archname="$archname-thread"
6059 echo "...setting architecture name to $archname." >&4
6060 ;;
6061 esac
6062 ;;
6063esac
6064case "$usemultiplicity" in
6065$define)
6066 echo "Multiplicity selected." >&4
6067 case "$archname" in
6068 *-multi*) echo "...and architecture name already has -multi." >&4
6069 ;;
6070 *) archname="$archname-multi"
6071 echo "...setting architecture name to $archname." >&4
6072 ;;
6073 esac
6074 ;;
6075esac
6076case "$use64bitint$use64bitall" in
6077*"$define"*)
6078 case "$archname64" in
6079 '')
6080 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 6081 ;;
89ce900e
JH
6082 *)
6083 case "$use64bitint" in
6084 "$define") echo "64 bit integers selected." >&4 ;;
6085 esac
6086 case "$use64bitall" in
6087 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6088 esac
6089 case "$archname" in
6090 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6091 ;;
6092 *) archname="$archname-$archname64"
6093 echo "...setting architecture name to $archname." >&4
6094 ;;
6095 esac
c1a7f87b
JH
6096 ;;
6097 esac
89ce900e
JH
6098esac
6099case "$uselongdouble" in
6100$define)
6101 echo "Long doubles selected." >&4
6102 case "$longdblsize" in
6103 $doublesize)
6104 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6105 ;;
6106 *)
6107 case "$archname" in
6108 *-ld*) echo "...and architecture name already has -ld." >&4
6109 ;;
6110 *) archname="$archname-ld"
6111 echo "...setting architecture name to $archname." >&4
6112 ;;
6113 esac
bd9b35c9
JH
6114 ;;
6115 esac
bd9b35c9 6116 ;;
89ce900e 6117esac
d2e0c6f7
JH
6118if $test -f archname.cbu; then
6119 echo "Your platform has some specific hints for architecture name, using them..."
6120 . ./archname.cbu
6121fi
bd9b35c9 6122
b4eb6b3d
JH
6123: set the prefixit variable, to compute a suitable default value
6124prefixit='case "$3" in
6125""|none)
6126 case "$oldprefix" in
6127 "") eval "$1=\"\$$2\"";;
6128 *)
6129 case "$3" in
6130 "") eval "$1=";;
6131 none)
6132 eval "tp=\"\$$2\"";
6133 case "$tp" in
6134 ""|" ") eval "$1=\"\$$2\"";;
6135 *) eval "$1=";;
6136 esac;;
6137 esac;;
6138 esac;;
6139*)
6140 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6141 case "$tp" in
6142 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6143 /*-$oldprefix/*|\~*-$oldprefix/*)
6144 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6145 *) eval "$1=\"\$$2\"";;
6146 esac;;
6147esac'
6148
f3f1a2d8
MB
6149: determine installation style
6150: For now, try to deduce it from prefix unless it is already set.
6151: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6152case "$installstyle" in
6153'') case "$prefix" in
6154 *perl*) dflt='lib';;
6155 *) dflt='lib/perl5' ;;
6156 esac
6157 ;;
6158*) dflt="$installstyle" ;;
4d20abad 6159esac
f3f1a2d8
MB
6160: Probably not worth prompting for this since we prompt for all
6161: the directories individually, and the prompt would be too long and
6162: confusing anyway.
6163installstyle=$dflt
4d20abad 6164
eaf812ae
MB
6165: determine where public executables go
6166echo " "
6167set dflt bin bin
6168eval $prefixit
6169fn=d~
6170rp='Pathname where the public executables will reside?'
6171. ./getfile
6172if $test "X$ansexp" != "X$binexp"; then
6173 installbin=''
6174fi
6175prefixvar=bin
6176: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6177: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6178: this via initialinstalllocation
eaf812ae
MB
6179. ./setprefixvar
6180
6181case "$userelocatableinc" in
6182$define|true|[yY]*) dflt='y' ;;
6183*) dflt='n' ;;
6184esac
6185cat <<EOM
6186
6187Would you like to build Perl so that the installation is relocatable, so that
6188library paths in @INC are determined relative to the path of the perl binary?
6189This is not advised for system Perl installs, or if you need to run setid
6190scripts or scripts under taint mode.
6191
6192If this doesn't make any sense to you, just accept the default '$dflt'.
6193EOM
6194rp='Use relocatable @INC?'
6195. ./myread
6196case "$ans" in
6197y|Y) val="$define" ;;
6198*) val="$undef" ;;
6199esac
6200set userelocatableinc
6201eval $setvar
6202
ea7d701d 6203initialinstalllocation="$binexp"
eaf812ae
MB
6204: Default prefix is now "up one level from where the binaries are"
6205case "$userelocatableinc" in
6206$define|true|[yY]*)
eaf812ae
MB
6207 bin=".../"
6208 binexp=".../"
6209 prefix=".../.."
6210 prefixexp=".../.."
6211 installprefixexp=".../.."
6212 ;;
6213esac
6214
b4eb6b3d
JH
6215: determine where private library files go
6216: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6217: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6218: /opt/perl/lib/perl5... would be redundant.
6219: The default "style" setting is made in installstyle.U
6220case "$installstyle" in
6221*lib/perl5*) set dflt privlib lib/$package/$version ;;
6222*) set dflt privlib lib/$version ;;
6223esac
6224eval $prefixit
6225$cat <<EOM
6226
6227There are some auxiliary files for $package that need to be put into a
6228private library directory that is accessible by everyone.
6229
6230EOM
eaf812ae 6231fn=$binexp
b4eb6b3d
JH
6232fn=d~+
6233rp='Pathname where the private library files will reside?'
6234. ./getfile
79522dd2
NC
6235prefixvar=privlib
6236. ./setprefixvar
b4eb6b3d
JH
6237
6238: set the prefixup variable, to restore leading tilda escape
6239prefixup='case "$prefixexp" in
6240"$prefix") ;;
6241*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6242esac'
6243
6244: determine where public architecture dependent libraries go
6245set archlib archlib
6246eval $prefixit
6247: privlib default is /usr/local/lib/$package/$version
6248: archlib default is /usr/local/lib/$package/$version/$archname
6249: privlib may have an optional trailing /share.
6250tdflt=`echo $privlib | $sed 's,/share$,,'`
6251tdflt=$tdflt/$archname
6252case "$archlib" in
6253'') dflt=$tdflt
6254 ;;
6255*) dflt="$archlib"
6256 ;;
6257esac
6258$cat <<EOM
6259
6260$spackage contains architecture-dependent library files. If you are
6261sharing libraries in a heterogeneous environment, you might store
6262these files in a separate location. Otherwise, you can just include
6263them with the rest of the public library files.
6264
6265EOM
eaf812ae 6266fn=$binexp
b4eb6b3d
JH
6267fn=d+~
6268rp='Where do you want to put the public architecture-dependent libraries?'
6269. ./getfile
79522dd2
NC
6270prefixvar=archlib
6271. ./setprefixvar
b4eb6b3d
JH
6272if $test X"$archlib" = X"$privlib"; then
6273 d_archlib="$undef"
6274else
6275 d_archlib="$define"
6276fi
b4eb6b3d 6277
b4eb6b3d
JH
6278: see if setuid scripts can be secure
6279$cat <<EOM
6280
6281Some kernels have a bug that prevents setuid #! scripts from being
6282secure. Some sites have disabled setuid #! scripts because of this.
6283
6284First let's decide if your kernel supports secure setuid #! scripts.
6285(If setuid #! scripts would be secure but have been disabled anyway,
6286don't say that they are secure if asked.)
6287
6288EOM
6289
6290val="$undef"
6291if $test -d /dev/fd; then
6292 echo "#!$ls" >reflect
6293 chmod +x,u+s reflect
6294 ./reflect >flect 2>&1
6295 if $contains "/dev/fd" flect >/dev/null; then
6296 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6297 val="$define"
6298 else
6299 $cat <<EOM
6300If you are not sure if they are secure, I can check but I'll need a
6301username and password different from the one you are using right now.
6302If you don't have such a username or don't want me to test, simply
6303enter 'none'.
6304
6305EOM
6306 rp='Other username to test security of setuid scripts with?'
6307 dflt='none'
6308 . ./myread
6309 case "$ans" in
6310 n|none)
6311 case "$d_suidsafe" in
6312 '') echo "I'll assume setuid scripts are *not* secure." >&4
6313 dflt=n;;
6314 "$undef")
6315 echo "Well, the $hint value is *not* secure." >&4
6316 dflt=n;;
6317 *) echo "Well, the $hint value *is* secure." >&4
6318 dflt=y;;
6319 esac
c1a7f87b 6320 ;;
b4eb6b3d
JH
6321 *)
6322 $rm -f reflect flect
6323 echo "#!$ls" >reflect
6324 chmod +x,u+s reflect
6325 echo >flect
6326 chmod a+w flect
6327 echo '"su" will (probably) prompt you for '"$ans's password."
6328 su $ans -c './reflect >flect'
6329 if $contains "/dev/fd" flect >/dev/null; then
6330 echo "Okay, it looks like setuid scripts are secure." >&4
6331 dflt=y
6332 else
6333 echo "I don't think setuid scripts are secure." >&4
6334 dflt=n
6335 fi
6336 ;;
6337 esac
6338 rp='Does your kernel have *secure* setuid scripts?'
6339 . ./myread
6340 case "$ans" in
6341 [yY]*) val="$define";;
6342 *) val="$undef";;
6343 esac
6344 fi
6345else
6346 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6347 echo "(That's for file descriptors, not floppy disks.)"
6348 val="$undef"
6349fi
6350set d_suidsafe
6351eval $setvar
6352
6353$rm -f reflect flect
6354
6355: now see if they want to do setuid emulation
01614441 6356if $test $patchlevel -lt 11; then
b4eb6b3d
JH
6357echo " "
6358val="$undef"
6359case "$d_suidsafe" in
6360"$define")
6361 val="$undef"
3c728e00 6362 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6363 ;;
f3f1a2d8
MB
6364*)
6365 $cat <<EOM
6366Some systems have disabled setuid scripts, especially systems where
6367setuid scripts cannot be secure. On systems where setuid scripts have
6368been disabled, the setuid/setgid bits on scripts are currently
6369useless. It is possible for $package to detect those bits and emulate
6370setuid/setgid in a secure fashion. This emulation will only work if
6371setuid scripts have been disabled in your kernel.
6372
6373EOM
6374 case "$d_dosuid" in
6375 "$define") dflt=y ;;
6376 *) dflt=n ;;
6377 esac
6378 rp="Do you want to do setuid/setgid emulation?"
6379 . ./myread
6380 case "$ans" in
6381 [yY]*) val="$define";;
6382 *) val="$undef";;
6383 esac
6384 ;;
6385esac
6386set d_dosuid
6387eval $setvar
01614441
MB
6388else
6389 case "$d_dosuid" in
6390 "$define")
6391 cat >&4 <<EOH
6392
6393SUID emulation has been removed for 5.12
6394Please re-run Configure without -Dd_dosuid
6395
6396EOH
6397 exit 1;
6398 ;;
6399 esac
6400 d_dosuid=undef
6401fi
f3f1a2d8 6402
f3f1a2d8
MB
6403: Find perl5.005 or later.
6404echo "Looking for a previously installed perl5.005 or later... "
6405case "$perl5" in
6406'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6407 : Check if this perl is recent and can load a simple module
6408 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6409 perl5=$tdir/perl
6410 break;
6411 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6412 perl5=$tdir/perl5
6413 break;
6414 fi
6415 done
6416 ;;
6417*) perl5="$perl5"
6418 ;;
6419esac
6420case "$perl5" in
6421'') echo "None found. That's ok.";;
6422*) echo "Using $perl5." ;;
6423esac
6424
613d6c3e 6425: Set the siteprefix variables
f3f1a2d8
MB
6426$cat <<EOM
6427
6428After $package is installed, you may wish to install various
6429add-on modules and utilities. Typically, these add-ons will
6430be installed under $prefix with the rest
6431of this package. However, you may wish to install such add-ons
6432elsewhere under a different prefix.
6433
6434If you do not wish to put everything under a single prefix, that's
6435ok. You will be prompted for the individual locations; this siteprefix
6436is only used to suggest the defaults.
6437
6438The default should be fine for most people.
6439
6440EOM
6441fn=d~+
6442rp='Installation prefix to use for add-on modules and utilities?'
6443: XXX Here might be another good place for an installstyle setting.
6444case "$siteprefix" in
6445'') dflt=$prefix ;;
6446*) dflt=$siteprefix ;;
6447esac
6448. ./getfile
6449: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6450oldsiteprefix=''
6451case "$siteprefix" in
6452'') ;;
6453*) case "$ans" in
6454 "$prefix") ;;
6455 *) oldsiteprefix="$prefix";;
6456 esac
6457 ;;
6458esac
6459siteprefix="$ans"
6460siteprefixexp="$ansexp"
6461
6462: determine where site specific libraries go.
6463: Usual default is /usr/local/lib/perl5/site_perl/$version
6464: The default "style" setting is made in installstyle.U
6465: XXX No longer works with Prefixit stuff.
6466prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6467case "$sitelib" in
6468'') case "$installstyle" in
6469 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6470 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6471 esac
6472 ;;
6473*) dflt="$sitelib"
6474 ;;
6475esac
6476$cat <<EOM
6477
6478The installation process will create a directory for
6479site-specific extensions and modules. Most users find it convenient
6480to place all site-specific files in this directory rather than in the
6481main distribution directory.
6482
6483EOM
6484fn=d~+
6485rp='Pathname for the site-specific library files?'
6486. ./getfile
6487prefixvar=sitelib
6488. ./setprefixvar
6489sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6490
6491: Determine list of previous versions to include in @INC
6492$cat > getverlist <<EOPL
6493#!$perl5 -w
6494use File::Basename;
6495\$api_versionstring = "$api_versionstring";
6496\$version = "$version";
6497\$stem = "$sitelib_stem";
6498\$archname = "$archname";
6499EOPL
6500 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6501# The list found is store twice for each entry: the original name, and
6502# the binary broken down version as pack "sss", so sorting is easy and
6503# unambiguous. This will work for all versions that have a maximum of
6504# three digit groups, separate by '.'s or '_'s. Names are extended with
6505# ".0.0" to ensure at least three elements for the pack.
6506# -- H.Merijn Brand (m)'06 23-10-2006
6507
f3f1a2d8
MB
6508# Can't have leading @ because metaconfig interprets it as a command!
6509;@inc_version_list=();
6510# XXX Redo to do opendir/readdir?
6511if (-d $stem) {
6512 chdir($stem);
13cfc98d
MB
6513 ;@candidates = map {
6514 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
a71f1801 6515 ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
f3f1a2d8
MB
6516}
6517else {
6518 ;@candidates = ();
6519}
6520
13cfc98d
MB
6521($pversion, $aversion, $vsn5005) = map {
6522 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6523foreach $d (@candidates) {
13cfc98d
MB
6524 if ($d->[1] lt $pversion) {
6525 if ($d->[1] ge $aversion) {
6526 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6527 }
13cfc98d
MB
6528 elsif ($d->[1] ge $vsn5005) {
6529 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6530 }
6531 }
6532 else {
6533 # Skip newer version. I.e. don't look in
6534 # 5.7.0 if we're installing 5.6.1.
6535 }
6536}
6537
6538if (@inc_version_list) {
6539 print join(' ', @inc_version_list);
6540}
6541else {
6542 # Blank space to preserve value for next Configure run.
6543 print " ";
6544}
6545EOPL
6546chmod +x getverlist
6547case "$inc_version_list" in
6548'') if test -x "$perl5$exe_ext"; then
6549 dflt=`$perl5 getverlist`
6550 else
6551 dflt='none'
6552 fi
6553 ;;
6554$undef) dflt='none' ;;
6555*) eval dflt=\"$inc_version_list\" ;;
6556esac
6557case "$dflt" in
6558''|' ') dflt=none ;;
6559esac
6560case "$dflt" in
65615.005) dflt=none ;;
6562esac
6563$cat <<EOM
6564
6565In order to ease the process of upgrading, this version of perl
6566can be configured to use modules built and installed with earlier
6567versions of perl that were installed under $prefix. Specify here
6568the list of earlier versions that this version of perl should check.
6569If Configure detected no earlier versions of perl installed under
6570$prefix, then the list will be empty. Answer 'none' to tell perl
6571to not search earlier versions.
b4eb6b3d 6572
f3f1a2d8
MB
6573The default should almost always be sensible, so if you're not sure,
6574just accept the default.
b4eb6b3d 6575EOM
f3f1a2d8
MB
6576
6577rp='List of earlier versions to include in @INC?'
6578. ./myread
6579case "$ans" in
6580[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6581*) inc_version_list="$ans" ;;
6582esac
6583case "$inc_version_list" in
6584''|' ')
6585 inc_version_list_init='0'
6586 d_inc_version_list="$undef"
6587 ;;
6588*) inc_version_list_init=`echo $inc_version_list |
6589 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6590 d_inc_version_list="$define"
b4eb6b3d
JH
6591 ;;
6592esac
f3f1a2d8 6593$rm -f getverlist
b4eb6b3d 6594
1cd66f7c
DD
6595: see if malloc/malloc.h has to be included
6596set malloc/malloc.h i_mallocmalloc
6597eval $inhdr
6598
b4eb6b3d 6599: see if this is a malloc.h system
01d07975
YST
6600: we want a real compile instead of Inhdr because some systems have a
6601: malloc.h that just gives a compile error saying to use stdlib.h instead
6602echo " "
6603$cat >try.c <<EOCP
6604#include <stdlib.h>
6605#include <malloc.h>
f25eda10 6606#$i_mallocmalloc I_MALLOCMALLOC
1cd66f7c
DD
6607#ifdef I_MALLOCMALLOC
6608# include <malloc/malloc.h>
6609#endif
6610
01d07975
YST
6611int main () { return 0; }
6612EOCP
6613set try
6614if eval $compile; then
6615 echo "<malloc.h> found." >&4
6616 val="$define"
6617else
6618 echo "<malloc.h> NOT found." >&4
6619 val="$undef"
6620fi
5b813a60 6621$rm_try
01d07975
YST
6622set i_malloc
6623eval $setvar
b4eb6b3d 6624
c8b93cf9
JH
6625: check for void type
6626echo " "
6627echo "Checking to see how well your C compiler groks the void type..." >&4
6628case "$voidflags" in
6629'')
c727eafa 6630 $cat >try.c <<EOCP
d1daaddf
JH
6631#$i_stdlib I_STDLIB
6632#ifdef I_STDLIB
6633#include <stdlib.h>
6634#endif
c8b93cf9
JH
6635#if TRY & 1
6636void sub() {
6637#else
6638sub() {
6639#endif
6640 extern void moo(); /* function returning void */
6641 void (*goo)(); /* ptr to func returning void */
6642#if TRY & 8
6643 void *hue; /* generic ptr */
6644#endif
6645#if TRY & 2
6646 void (*foo[10])();
6647#endif
6648
6649#if TRY & 4
6650 if(goo == moo) {
6651 exit(0);
6652 }
6653#endif
6654 exit(0);
6655}
6656int main() { sub(); }
6657EOCP
6658 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6659 voidflags=$defvoidused
6660 echo "Good. It appears to support void to the level $package wants.">&4
6661 if $contains warning .out >/dev/null 2>&1; then
6662 echo "However, you might get some warnings that look like this:"
6663 $cat .out
6664 fi
6665 else
6666echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6667 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6668 echo "It supports 1..."
6669 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6670 echo "It also supports 2..."
6671 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6672 voidflags=7
6673 echo "And it supports 4 but not 8 definitely."
6674 else
6675 echo "It doesn't support 4..."
6676 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6677 voidflags=11
6678 echo "But it supports 8."
6679 else
6680 voidflags=3
6681 echo "Neither does it support 8."
6682 fi
6683 fi
6684 else
6685 echo "It does not support 2..."
6686 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6687 voidflags=13
6688 echo "But it supports 4 and 8."
6689 else
6690 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6691 voidflags=5
6692 echo "And it supports 4 but has not heard about 8."
6693 else
6694 echo "However it supports 8 but not 4."
6695 fi
6696 fi
6697 fi
6698 else
6699 echo "There is no support at all for void."
6700 voidflags=0
6701 fi
6702 fi
6703esac
6704case "$voidflags" in
6705"$defvoidused") ;;
6706*) $cat >&4 <<'EOM'
6707 Support flag bits are:
6708 1: basic void declarations.
6709 2: arrays of pointers to functions returning void.
6710 4: operations between pointers to and addresses of void functions.
6711 8: generic void pointers.
6712EOM
6713 dflt="$voidflags";
6714 rp="Your void support flags add up to what?"
6715 . ./myread
6716 voidflags="$ans"
6717 ;;
6718esac
5b813a60 6719$rm_try
c8b93cf9
JH
6720
6721: check for length of pointer
6722echo " "
6723case "$ptrsize" in
6724'')
6725 echo "Checking to see how big your pointers are..." >&4
6726 if test "$voidflags" -gt 7; then
6727 echo '#define VOID_PTR char *' > try.c
6728 else
6729 echo '#define VOID_PTR void *' > try.c
6730 fi
74d00865 6731 $cat >>try.c <<EOCP
c8b93cf9 6732#include <stdio.h>
d1daaddf
JH
6733#$i_stdlib I_STDLIB
6734#ifdef I_STDLIB
6735#include <stdlib.h>
6736#endif
c8b93cf9
JH
6737int main()
6738{
6739 printf("%d\n", (int)sizeof(VOID_PTR));
6740 exit(0);
6741}
6742EOCP
6743 set try
6744 if eval $compile_ok; then
6745 ptrsize=`$run ./try`
6746 echo "Your pointers are $ptrsize bytes long."
6747 else
6748 dflt='4'
6749 echo "(I can't seem to compile the test program. Guessing...)" >&4
6750 rp="What is the size of a pointer (in bytes)?"
6751 . ./myread
6752 ptrsize="$ans"
6753 fi
6754 ;;
6755esac
5b813a60 6756$rm_try
c8b93cf9
JH
6757case "$use64bitall" in
6758"$define"|true|[yY]*)
6759 case "$ptrsize" in
6760 4) cat <<EOM >&4
6761
1911a026
JH
6762*** You have chosen a maximally 64-bit build,
6763*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6764*** Please rerun Configure without -Duse64bitall.
6765EOM
6766 case "$d_quad" in
6767 define)
6768 cat <<EOM >&4
6769*** Since you have quads, you could possibly try with -Duse64bitint.
6770EOM
6771 ;;
6772 esac
6773 cat <<EOM >&4
1911a026 6774*** Cannot continue, aborting.
c8b93cf9
JH
6775
6776EOM
09b58c7b 6777
1911a026 6778 exit 1
c8b93cf9
JH
6779 ;;
6780 esac
6781 ;;
6782esac
6783
19a100ff 6784
9df442c2
NC
6785: determine whether to use malloc wrapping
6786echo " "
6787case "$usemallocwrap" in
6788[yY]*|true|$define) dflt='y' ;;
6789[nN]*|false|$undef) dflt='n' ;;
6790*) case "$usedevel" in
6791 [yY]*|true|$define) dflt='y' ;;
6792 *) dflt='n' ;;
6793 esac
6794 ;;
6795esac
6796rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6797. ./myread
6798usemallocwrap="$ans"
6799case "$ans" in
6800y*|true)
6801 usemallocwrap="$define" ;;
6802*)
6803 usemallocwrap="$undef" ;;
6804esac
c8b93cf9 6805
b4eb6b3d
JH
6806: determine which malloc to compile in
6807echo " "
6808case "$usemymalloc" in
c4163172
JH
6809[yY]*|true|$define) dflt='y' ;;
6810[nN]*|false|$undef) dflt='n' ;;
6811*) case "$ptrsize" in
6812 4) dflt='y' ;;
6813 *) dflt='n' ;;
6814 esac
d9298c1a 6815 if test "$useithreads" = "$define"; then dflt='n'; fi
c4163172 6816 ;;
8dfa8df9 6817esac
b4eb6b3d
JH
6818rp="Do you wish to attempt to use the malloc that comes with $package?"
6819. ./myread
6820usemymalloc="$ans"
6821case "$ans" in
6822y*|true)
6823 usemymalloc='y'
6824 mallocsrc='malloc.c'
6825 mallocobj="malloc$_o"
6826 d_mymalloc="$define"
6827 case "$libs" in
6828 *-lmalloc*)
6829 : Remove malloc from list of libraries to use
6830 echo "Removing unneeded -lmalloc from library list" >&4
6831 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6832 shift
6833 libs="$*"
6834 echo "libs = $libs" >&4
6835 ;;
6836 esac
6837 ;;
6838*)
6839 usemymalloc='n'
6840 mallocsrc=''
6841 mallocobj=''
6842 d_mymalloc="$undef"
6843 ;;
6844esac
6845
6846: compute the return types of malloc and free
6847echo " "
6848$cat >malloc.c <<END
6849#$i_malloc I_MALLOC
6850#$i_stdlib I_STDLIB
6851#include <stdio.h>
6852#include <sys/types.h>
6853#ifdef I_MALLOC
6854#include <malloc.h>
6855#endif
6856#ifdef I_STDLIB
6857#include <stdlib.h>
6858#endif
6859#ifdef TRY_MALLOC
6860void *malloc();
6861#endif
6862#ifdef TRY_FREE
6863void free();
6864#endif
6865END
6866case "$malloctype" in
6867'')
6868 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6869 malloctype='void *'
6870 else
6871 malloctype='char *'
6872 fi
6873 ;;
6874esac
6875echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6876
6877case "$freetype" in
6878'')
6879 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6880 freetype='void'
6881 else
6882 freetype='int'
6883 fi
6884 ;;
6885esac
6886echo "Your system uses $freetype free(), it would seem." >&4
6887$rm -f malloc.[co]
b4eb6b3d
JH
6888: determine where site specific architecture-dependent libraries go.
6889: sitelib default is /usr/local/lib/perl5/site_perl/$version
6890: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6891: sitelib may have an optional trailing /share.
6892case "$sitearch" in
6893'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6894 dflt="$dflt/$archname"
6895 ;;
6896*) dflt="$sitearch"
6897 ;;
6898esac
6899set sitearch sitearch none
6900eval $prefixit
6901$cat <<EOM
6902
6903The installation process will also create a directory for
6904architecture-dependent site-specific extensions and modules.
6905
6906EOM
6907fn=d~+
6908rp='Pathname for the site-specific architecture-dependent library files?'
6909. ./getfile
79522dd2
NC
6910prefixvar=sitearch
6911. ./setprefixvar
c95d0e17
GA
6912if $test X"$sitearch" = X"$sitelib"; then
6913 d_sitearch="$undef"
6914else
6915 d_sitearch="$define"
6916fi
b4eb6b3d 6917
613d6c3e 6918: Set the vendorprefix variables
b4eb6b3d
JH
6919$cat <<EOM
6920
6921The installation process will also create a directory for
6922vendor-supplied add-ons. Vendors who supply perl with their system
6923may find it convenient to place all vendor-supplied files in this
6924directory rather than in the main distribution directory. This will
6925ease upgrades between binary-compatible maintenance versions of perl.
6926
6927Of course you may also use these directories in whatever way you see
6928fit. For example, you might use them to access modules shared over a
6929company-wide network.
6930
6931The default answer should be fine for most people.
6932This causes further questions about vendor add-ons to be skipped
6933and no vendor-specific directories will be configured for perl.
6934
6935EOM
6936rp='Do you want to configure vendor-specific add-on directories?'
6937case "$usevendorprefix" in
6938define|true|[yY]*) dflt=y ;;
6939*) : User may have set vendorprefix directly on Configure command line.
6940 case "$vendorprefix" in
6941 ''|' ') dflt=n ;;
6942 *) dflt=y ;;
6943 esac
6944 ;;
6945esac
6946. ./myread
6947case "$ans" in
6948[yY]*) fn=d~+
6949 rp='Installation prefix to use for vendor-supplied add-ons?'
6950 case "$vendorprefix" in
6951 '') dflt='' ;;
6952 *) dflt=$vendorprefix ;;
6953 esac
6954 . ./getfile
6955 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6956 oldvendorprefix=''
6957 case "$vendorprefix" in
6958 '') ;;
6959 *) case "$ans" in
6960 "$prefix") ;;
6961 *) oldvendorprefix="$prefix";;
6962 esac
6963 ;;
6964 esac
6965 usevendorprefix="$define"
6966 vendorprefix="$ans"
6967 vendorprefixexp="$ansexp"
6968 ;;
6969*) usevendorprefix="$undef"
6970 vendorprefix=''
6971 vendorprefixexp=''
6972 ;;
6973esac
6974
613d6c3e 6975: Set the vendorlib variables
b4eb6b3d
JH
6976case "$vendorprefix" in
6977'') d_vendorlib="$undef"
6978 vendorlib=''
6979 vendorlibexp=''
6980 ;;
6981*) d_vendorlib="$define"
6982 : determine where vendor-supplied modules go.
6983 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6984 case "$vendorlib" in
6985 '')
6986 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6987 case "$installstyle" in
6988 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6989 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6990 esac
6991 ;;
6992 *) dflt="$vendorlib"
6993 ;;
6994 esac
6995 fn=d~+
6996 rp='Pathname for the vendor-supplied library files?'
6997 . ./getfile
6998 vendorlib="$ans"
6999 vendorlibexp="$ansexp"
7000 ;;
7001esac
7002vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
7003prefixvar=vendorlib
7004. ./installprefix
b4eb6b3d 7005
613d6c3e 7006: Set the vendorarch variables
b4eb6b3d
JH
7007case "$vendorprefix" in
7008'') d_vendorarch="$undef"
7009 vendorarch=''
7010 vendorarchexp=''
7011 ;;
7012*) d_vendorarch="$define"
7013 : determine where vendor-supplied architecture-dependent libraries go.
7014 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
7015 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7016 : vendorlib may have an optional trailing /share.
7017 case "$vendorarch" in
7018 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
7019 dflt="$dflt/$archname"
7020 ;;
7021 *) dflt="$vendorarch" ;;
7022 esac
7023 fn=d~+
7024 rp='Pathname for vendor-supplied architecture-dependent files?'
7025 . ./getfile
7026 vendorarch="$ans"
7027 vendorarchexp="$ansexp"
7028 ;;
7029esac
a092d240
NC
7030prefixvar=vendorarch
7031. ./installprefix
1be1b388
MB
7032if $test X"$vendorarch" = X"$vendorlib"; then
7033 d_vendorarch="$undef"
7034else
7035 d_vendorarch="$define"
7036fi
b4eb6b3d
JH
7037
7038: Final catch-all directories to search
7039$cat <<EOM
7040
7041Lastly, you can have perl look in other directories for extensions and
7042modules in addition to those already specified.
7043These directories will be searched after
7044 $sitearch
7045 $sitelib
7046EOM
7047test X"$vendorlib" != "X" && echo ' ' $vendorlib
7048test X"$vendorarch" != "X" && echo ' ' $vendorarch
7049echo ' '
7050case "$otherlibdirs" in
7051''|' ') dflt='none' ;;
7052*) dflt="$otherlibdirs" ;;
7053esac
7054$cat <<EOM
7055Enter a colon-separated set of extra paths to include in perl's @INC
7056search path, or enter 'none' for no extra paths.
7057
7058EOM
7059
7060rp='Colon-separated list of additional directories for perl to search?'
7061. ./myread
7062case "$ans" in
7063' '|''|none) otherlibdirs=' ' ;;
7064*) otherlibdirs="$ans" ;;
7065esac
7066case "$otherlibdirs" in
7067' ') val=$undef ;;
7068*) val=$define ;;
7069esac
7070set d_perl_otherlibdirs
7071eval $setvar
7072
7073: Cruising for prototypes
7074echo " "
7075echo "Checking out function prototypes..." >&4
55954f19
JH
7076$cat >prototype.c <<EOCP
7077#$i_stdlib I_STDLIB
7078#ifdef I_STDLIB
7079#include <stdlib.h>
7080#endif
b4eb6b3d
JH
7081int main(int argc, char *argv[]) {
7082 exit(0);}
7083EOCP
7084if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7085 echo "Your C compiler appears to support function prototypes."
7086 val="$define"
7087else
7088 echo "Your C compiler doesn't seem to understand function prototypes."
7089 val="$undef"
7090fi
7091set prototype
7092eval $setvar
7093$rm -f prototype*
7094
613d6c3e 7095: Check if ansi2knr is required
b4eb6b3d
JH
7096case "$prototype" in
7097"$define") ;;
7098*) ansi2knr='ansi2knr'
7099 echo " "
7100 cat <<EOM >&4
7101
7102$me: FATAL ERROR:
7103This version of $package can only be compiled by a compiler that
7104understands function prototypes. Unfortunately, your C compiler
7105 $cc $ccflags
7106doesn't seem to understand them. Sorry about that.
7107
7108If GNU cc is available for your system, perhaps you could try that instead.
7109
7110Eventually, we hope to support building Perl with pre-ANSI compilers.
7111If you would like to help in that effort, please contact <perlbug@perl.org>.
7112
7113Aborting Configure now.
7114EOM
7115 exit 2
7116 ;;
7117esac
7118
34f1896b
MB
7119: DTrace support
7120dflt_dtrace='/usr/sbin/dtrace'
6e3b7bfa
MB
7121$test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7122
34f1896b
MB
7123cat <<EOM
7124
7125Perl can be built to support DTrace on platforms that support it.
7126DTrace is a diagnosis and performance analysis tool from Sun.
7127
7128If this doesn't make any sense to you, just accept the default '$dflt'.
7129EOM
7130
7131while $test 1 ; do
7132 case "$usedtrace" in
7133 $define|true|[yY]*)
7134 dflt='y'
7135 ;;
7136 ?*)
7137 dflt='y'
7138 dflt_dtrace=$usedtrace
7139 ;;
7140 *)
7141 dflt='n'
7142 ;;
7143 esac
7144
7145 rp='Support DTrace if available?'
7146 . ./myread
7147 case "$ans" in
7148 y|Y) val="$define" ;;
7149 *) val="$undef" ;;
7150 esac
7151 set usedtrace
7152 eval $setvar
7153
7154 test "X$usedtrace" != "X$define" && break
7155
7156 echo " "
7157 rp='Where is the dtrace executable?'
7158 dflt=$dflt_dtrace
7159 . ./getfile
7160 val="$ans"
7161 set dtrace
7162 eval $setvar
7163
7164 if $test -f $dtrace
7165 then
7166 if $dtrace -h -s ../perldtrace.d \
7167 -o perldtrace.tmp >/dev/null 2>&1 \
7168 && rm -f perldtrace.tmp
7169 then
7170 echo " "
7171 echo "Good: your $dtrace knows about the -h flag."
7172 else
7173 cat >&2 <<EOM
7174
7175*** $me: Fatal Error: $dtrace doesn't support -h flag
7176***
7177*** Your installed dtrace doesn't support the -h switch to compile a D
7178*** program into a C header. Can't continue.
7179
7180EOM
7181 exit 1
7182 fi
7183 break;
7184 fi
7185
7186 case "$fastread" in
7187 yes)
7188 cat >&2 <<EOM
7189
7190*** $me: Fatal Error: $dtrace not found.
7191*** Can't continue.
7192
7193EOM
7194 exit 1
7195 ;;
7196 *)
7197 echo "*** $dtrace was not found."
7198 echo " "
7199 ;;
7200 esac
7201done
7202
613d6c3e 7203: See if we want extra modules installed
6fcddf3b 7204echo " "
6fcddf3b 7205case "$extras" in
bf35c3f6
JH
7206'') dflt='n';;
7207*) dflt='y';;
6fcddf3b
JH
7208esac
7209cat <<EOM
7210Perl can be built with extra modules or bundles of modules which
7211will be fetched from the CPAN and installed alongside Perl.
7212
7213Notice that you will need access to the CPAN; either via the Internet,
7214or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7215be asked later to configure the CPAN.pm module which will in turn do
7216the installation of the rest of the extra modules or bundles.)
7217
7218Notice also that if the modules require any external software such as
dd2de242
JH
7219libraries and headers (the libz library and the zlib.h header for the
7220Compress::Zlib module, for example) you MUST have any such software
7221already installed, this configuration process will NOT install such
7222things for you.
6fcddf3b
JH
7223
7224If this doesn't make any sense to you, just accept the default '$dflt'.
7225EOM
dd2de242 7226rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7227. ./myread
7228case "$ans" in
7229y|Y)
7230 cat <<EOM
7231
7232Please list any extra modules or bundles to be installed from CPAN,
7233with spaces between the names. The names can be in any format the
dd2de242
JH
7234'install' command of CPAN.pm will understand. (Answer 'none',
7235without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7236EOM
7237 rp='Extras?'
7238 dflt="$extras"
7239 . ./myread
7240 extras="$ans"
7241esac
7242case "$extras" in
7243''|'none')
7244 val=''
7245 $rm -f ../extras.lst
7246 ;;
7247*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7248 echo "$extras" > ../extras.lst
7249 val="'$extras'"
6fcddf3b
JH
7250 ;;
7251esac
7252set extras
7253eval $setvar
7254echo " "
7255
6e1038e0
MB
7256: determine where html pages for programs go
7257set html1dir html1dir none
7258eval $prefixit
7259$cat <<EOM
7260
f3f1a2d8 7261If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7262the appropriate directory here. To skip installing html files,
7263answer "none".
7264EOM
7265case "$html1dir" in
7266''|none|$undef|' ') dflt=none ;;
7267*) dflt=$html1dir ;;
7268esac
7269fn=dn+~
7270rp="Directory for the main $spackage html pages?"
7271. ./getfile
79522dd2
NC
7272prefixvar=html1dir
7273. ./setprefixvar
6e1038e0
MB
7274: Use ' ' for none so value is preserved next time through Configure
7275$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7276
7277: determine where html pages for libraries and modules go
7278set html3dir html3dir none
7279eval $prefixit
7280$cat <<EOM
7281
7282If you wish to install html files for modules associated with $spackage,
7283indicate the appropriate directory here. To skip installing html files,
7284answer "none".
7285EOM
7286: There is no obvious default. If they have specified html1dir, then
7287: try to key off that, possibly changing .../html1 into .../html3.
7288case "$html3dir" in
7289'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7290*) dflt=$html3dir ;;
7291esac
7292fn=dn+~
7293rp="Directory for the $spackage module html pages?"
7294. ./getfile
79522dd2
NC
7295prefixvar=html3dir
7296. ./setprefixvar
6e1038e0
MB
7297: Use ' ' for none so value is preserved next time through Configure
7298$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7299
89ce900e
JH
7300: determine whether to install perl also as /usr/bin/perl
7301
7302echo " "
7303if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7304 $cat <<EOM
7305Many scripts expect perl to be installed as /usr/bin/perl.
7306
7307If you want to, I can install the perl you are about to compile
7308as /usr/bin/perl (in addition to $bin/perl).
7309EOM
7310 if test -f /usr/bin/perl; then
7311 $cat <<EOM
7312
7313However, please note that because you already have a /usr/bin/perl,
7314overwriting that with a new Perl would very probably cause problems.
7315Therefore I'm assuming you don't want to do that (unless you insist).
7316
7317EOM
7318 case "$installusrbinperl" in
7319 "$define"|[yY]*) dflt='y';;
7320 *) dflt='n';;
7321 esac
7322 else
7323 $cat <<EOM
7324
7325Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7326
7327EOM
7328 case "$installusrbinperl" in
7329 "$undef"|[nN]*) dflt='n';;
7330 *) dflt='y';;
7331 esac
7332 fi
7333 rp="Do you want to install perl as /usr/bin/perl?"
7334 . ./myread
7335 case "$ans" in
7336 [yY]*) val="$define";;
7337 *) val="$undef" ;;
7338 esac
7339else
7340 val="$undef"
7341fi
7342set installusrbinperl
7343eval $setvar
7344
613d6c3e 7345: Check if we are using the GNU C library
89ce900e
JH
7346echo " "
7347echo "Checking for GNU C Library..." >&4
7348cat >try.c <<'EOCP'
7349/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7350 alone are insufficient to distinguish different versions, such as
7351 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7352 libc version 2.1.0. A. Dougherty, June 3, 2002.
7353*/
7354#include <stdio.h>
7355int main(void)
7356{
7357#ifdef __GLIBC__
7358# ifdef __GLIBC_MINOR__
4fb7dc7d 7359# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7360# include <gnu/libc-version.h>
7361 printf("%s\n", gnu_get_libc_version());
7362# else
7363 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7364# endif
7365# else
7366 printf("%d\n", __GLIBC__);
7367# endif
7368 return 0;
7369#else
7370 return 1;
7371#endif
7372}
7373EOCP
7374set try
7375if eval $compile_ok && $run ./try > glibc.ver; then
7376 val="$define"
7377 gnulibc_version=`$cat glibc.ver`
7378 echo "You are using the GNU C Library version $gnulibc_version"
7379else
7380 val="$undef"
7381 gnulibc_version=''
7382 echo "You are not using the GNU C Library"
7383fi
5b813a60 7384$rm_try glibc.ver
89ce900e
JH
7385set d_gnulibc
7386eval $setvar
7387
7388: see if nm is to be used to determine whether a symbol is defined or not
7389case "$usenm" in
7390'')
7391 dflt=''
7392 case "$d_gnulibc" in
7393 "$define")
7394 echo " "
7395 echo "nm probably won't work on the GNU C Library." >&4
7396 dflt=n
7397 ;;
7398 esac
7399 case "$dflt" in
7400 '')
7401 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7402 echo " "
7403 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7404 echo "'nm' won't be sufficient on this sytem." >&4
7405 dflt=n
7406 fi
7407 ;;
7408 esac
7409 case "$dflt" in
7410 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7411 if $test $dflt -gt 20; then
7412 dflt=y
7413 else
7414 dflt=n
7415 fi
7416 ;;
7417 esac
b4eb6b3d 7418 ;;
89ce900e
JH
7419*)
7420 case "$usenm" in
7421 true|$define) dflt=y;;
7422 *) dflt=n;;
7423 esac
b4eb6b3d
JH
7424 ;;
7425esac
89ce900e 7426$cat <<EOM
b4eb6b3d 7427
89ce900e
JH
7428I can use $nm to extract the symbols from your C libraries. This
7429is a time consuming task which may generate huge output on the disk (up
7430to 3 megabytes) but that should make the symbols extraction faster. The
7431alternative is to skip the 'nm' extraction part and to compile a small
7432test program instead to determine whether each symbol is present. If
7433you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7434this may be the best solution.
b4eb6b3d 7435
89ce900e 7436You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7437
89ce900e
JH
7438EOM
7439rp="Shall I use $nm to extract C symbols from the libraries?"
7440. ./myread
7441case "$ans" in
7442[Nn]*) usenm=false;;
7443*) usenm=true;;
b4eb6b3d 7444esac
89ce900e
JH
7445
7446runnm=$usenm
7447case "$reuseval" in
7448true) runnm=false;;
b4eb6b3d 7449esac
b4eb6b3d 7450
89ce900e
JH
7451: nm options which may be necessary
7452case "$nm_opt" in
7453'') if $test -f /mach_boot; then
7454 nm_opt='' # Mach
7455 elif $test -d /usr/ccs/lib; then
7456 nm_opt='-p' # Solaris (and SunOS?)
7457 elif $test -f /dgux; then
7458 nm_opt='-p' # DG-UX
7459 elif $test -f /lib64/rld; then
7460 nm_opt='-p' # 64-bit Irix
7461 else
7462 nm_opt=''
7463 fi;;
7464esac
b4eb6b3d 7465
89ce900e
JH
7466: nm options which may be necessary for shared libraries but illegal
7467: for archive libraries. Thank you, Linux.
7468case "$nm_so_opt" in
7469'') case "$myuname" in
fb2e1bc0 7470 *linux*|gnu*)
89ce900e
JH
7471 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7472 nm_so_opt='--dynamic'
7473 fi
7474 ;;
7475 esac
7476 ;;
7477esac
b4eb6b3d 7478
1d8eaf8c 7479: Figure out where the libc is located
89ce900e
JH
7480case "$runnm" in
7481true)
1d8eaf8c 7482: get list of predefined functions in a handy place
89ce900e
JH
7483echo " "
7484case "$libc" in
7485'') libc=unknown
7486 case "$libs" in
7487 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7488 esac
7489 ;;
b4eb6b3d 7490esac
89ce900e
JH
7491case "$libs" in
7492'') ;;
7493*) for thislib in $libs; do
7494 case "$thislib" in
7495 -lc|-lc_s)
7496 : Handle C library specially below.
7497 ;;
7498 -l*)
7499 thislib=`echo $thislib | $sed -e 's/^-l//'`
7500 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7501 :
7502 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7503 :
7504 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7505 :
7506 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7507 :
7508 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7509 :
7510 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7511 :
7512 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7513 :
7514 else
7515 try=''
7516 fi
7517 libnames="$libnames $try"
7518 ;;
7519 *) libnames="$libnames $thislib" ;;
7520 esac
7521 done
b4eb6b3d
JH
7522 ;;
7523esac
89ce900e
JH
7524xxx=normal
7525case "$libc" in
7526unknown)
7527 set /lib/libc.$so
7528 for xxx in $libpth; do
7529 $test -r $1 || set $xxx/libc.$so
7530 : The messy sed command sorts on library version numbers.
7531 $test -r $1 || \
7532 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7533 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7534 h
7535 s/[0-9][0-9]*/0000&/g
7536 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7537 G
7538 s/\n/ /' | \
7539 $sort | $sed -e 's/^.* //'`
7540 eval set \$$#
7541 done
7542 $test -r $1 || set /usr/ccs/lib/libc.$so
7543 $test -r $1 || set /lib/libsys_s$_a
7544 ;;
7545*)
7546 set blurfl
7547 ;;
7548esac
7549if $test -r "$1"; then
7550 echo "Your (shared) C library seems to be in $1."
7551 libc="$1"
7552elif $test -r /lib/libc && $test -r /lib/clib; then
7553 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7554 xxx=apollo
7555 libc='/lib/clib /lib/libc'
7556 if $test -r /lib/syslib; then
7557 echo "(Your math library is in /lib/syslib.)"
7558 libc="$libc /lib/syslib"
7559 fi
7560elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7561 echo "Your C library seems to be in $libc, as you said before."
7562elif $test -r $incpath/usr/lib/libc$_a; then
7563 libc=$incpath/usr/lib/libc$_a;
7564 echo "Your C library seems to be in $libc. That's fine."
7565elif $test -r /lib/libc$_a; then
7566 libc=/lib/libc$_a;
7567 echo "Your C library seems to be in $libc. You're normal."
7568else
7569 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7570 :
7571 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7572 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7573 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7574 :
7575 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7576 :
7577 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7578 :
7579 else
7580 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7581 fi
7582 if $test -r "$tans"; then
7583 echo "Your C library seems to be in $tans, of all places."
7584 libc=$tans
7585 else
7586 libc='blurfl'
7587 fi
7588fi
7589if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7590 dflt="$libc"
7591 cat <<EOM
b4eb6b3d 7592
89ce900e
JH
7593If the guess above is wrong (which it might be if you're using a strange
7594compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7595
89ce900e
JH
7596EOM
7597else
7598 dflt=''
7599 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7600 cat >&4 <<EOM
7601I can't seem to find your C library. I've looked in the following places:
5e366f65 7602
b4eb6b3d 7603EOM
89ce900e
JH
7604 $sed 's/^/ /' libpath
7605 cat <<EOM
5e366f65 7606
89ce900e 7607None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7608
7609EOM
89ce900e
JH
7610fi
7611fn=f
7612rp='Where is your C library?'
7613. ./getfile
7614libc="$ans"
5e366f65 7615
89ce900e
JH
7616echo " "
7617echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7618set X `cat libnames`
7619shift
7620xxx=files
7621case $# in 1) xxx=file; esac
7622echo "Extracting names from the following $xxx for later perusal:" >&4
7623echo " "
7624$sed 's/^/ /' libnames >&4
7625echo " "
7626$echo $n "This may take a while...$c" >&4
5e366f65 7627
89ce900e
JH
7628for file in $*; do
7629 case $file in
7630 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7631 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7632 esac
89ce900e
JH
7633done >libc.tmp
7634
7635$echo $n ".$c"
7636$grep fprintf libc.tmp > libc.ptf
7637xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7638xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
9e08e8f0 7639xxx='[ADTSIWi]'
ab900c53 7640if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7641 eval $xscan;\
7642 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643 eval $xrun
7644elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7645 eval $xscan;\
7646 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7647 eval $xrun
7648elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7649 eval $xscan;\
7650 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7651 eval $xrun
7652elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7653 eval $xscan;\
7654 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7655 eval $xrun
7656elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7657 eval $xscan;\
7658 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7659 eval $xrun
7660elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7661 eval $xscan;\
7662 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663 eval $xrun
7664elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7665 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7666 eval $xscan;\
7667 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7668 eval $xrun
7669elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7670 eval $xscan;\
7671 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7672 eval $xrun
7673elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7674 eval $xscan;\
7675 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7676 eval $xrun
7677elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7678 eval $xscan;\
7679 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7680 eval $xrun
7681elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7682 eval $xscan;\
7683 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7684 eval $xrun
7685elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7686 eval $xscan;\
7687 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7688 eval $xrun
7689elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7690 eval $xscan;\
7691 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7692 eval $xrun
7693elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7694 eval $xscan;\
7695 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7696 eval $xrun
b4eb6b3d 7697else
89ce900e
JH
7698 $nm -p $* 2>/dev/null >libc.tmp
7699 $grep fprintf libc.tmp > libc.ptf
7700 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7701 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7702 then
7703 nm_opt='-p'
7704 eval $xrun
7705 else
7706 echo " "
7707 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7708 com=''
1d8eaf8c
MB
7709 if $ar t $libc > libc.tmp && \
7710 $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7711 then
89ce900e
JH
7712 for thisname in $libnames $libc; do
7713 $ar t $thisname >>libc.tmp
7714 done
7715 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7716 echo "Ok." >&4
7717 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
89ce900e
JH
7718 for thisname in $libnames $libc; do
7719 $ar tv $thisname >>libc.tmp
89ce900e
JH
7720 emximp -o tmp.imp $thisname \
7721 2>/dev/null && \
7722 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7723 < tmp.imp >>libc.tmp
1d8eaf8c 7724 $rm -f tmp.imp
89ce900e
JH
7725 done
7726 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7727 echo "Ok." >&4
7728 else
7729 echo "$ar didn't seem to work right." >&4
7730 echo "Maybe this is a Cray...trying bld instead..." >&4
1d8eaf8c
MB
7731 if bld t $libc | \
7732 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7733 $test -s libc.list
89ce900e
JH
7734 then
7735 for thisname in $libnames; do
7736 bld t $libnames | \
7737 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7738 $ar t $thisname >>libc.tmp
7739 done
7740 echo "Ok." >&4
7741 else
7742 echo "That didn't work either. Giving up." >&4
7743 exit 1
7744 fi
7745 fi
7746 fi
b4eb6b3d 7747fi
89ce900e
JH
7748nm_extract="$com"
7749case "$PASE" in
7750define)
7751 echo " "
7752 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7753 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7754 ;;
7755*) if $test -f /lib/syscalls.exp; then
7756 echo " "
7757 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
1d8eaf8c
MB
7758 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \
7759 /lib/syscalls.exp >>libc.list
89ce900e
JH
7760 fi
7761 ;;
7762esac
7763;;
7764esac
7765$rm -f libnames libpath
b4eb6b3d
JH
7766
7767: see if dld is available
7768set dld.h i_dld
7769eval $inhdr
7770
613d6c3e 7771: Check if we are using C++
43dddb59
MB
7772echo " "
7773echo "Checking for C++..." >&4
20e87299 7774$cat >try.c <<'EOCP'
43dddb59
MB
7775#include <stdio.h>
7776int main(void)
7777{
7778#ifdef __cplusplus
20e87299 7779 return 0;
43dddb59 7780#else
20e87299 7781 return 1;
43dddb59 7782#endif
43dddb59
MB
7783}
7784EOCP
7785set try
20e87299
AD
7786if eval $compile_ok && $run ./try; then
7787 val="$define"
43dddb59
MB
7788 echo "You are using a C++ compiler."
7789else
7790 val="$undef"
7791 echo "You are not using a C++ compiler."
7792fi
5b813a60 7793$rm_try cplusplus$$
43dddb59
MB
7794set d_cplusplus
7795eval $setvar
7796
89ce900e
JH
7797: is a C symbol defined?
7798csym='tlook=$1;
7799case "$3" in
373dfab3
JH
7800-v) tf=libc.tmp; tdc="";;
7801-a) tf=libc.tmp; tdc="[]";;
7802*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e 7803esac;
61c26d18
MHM
7804case "$d_cplusplus" in
7805 $define) extern_C="extern \"C\"" ;;
7806 *) extern_C="extern" ;;
7807esac;
89ce900e
JH
7808tx=yes;
7809case "$reuseval-$4" in
7810true-) ;;
7811true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7812esac;
7813case "$tx" in
7814yes)
43dddb59 7815 tval=false;
5129fff4
JH
7816 if $test "$runnm" = true; then
7817 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7818 tval=true;
5129fff4 7819 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
9945eb56 7820 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7821 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3 7822 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
5b813a60 7823 $rm_try;
89ce900e 7824 fi;
5129fff4 7825 else
9945eb56 7826 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7827 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
5b813a60 7828 $rm_try;
ab900c53
AB
7829 fi;
7830 ;;
89ce900e
JH
7831*)
7832 case "$tval" in
7833 $define) tval=true;;
7834 *) tval=false;;
ab900c53
AB
7835 esac;
7836 ;;
89ce900e
JH
7837esac;
7838eval "$2=$tval"'
7839
7840: define an is-in-libc? function
7841inlibc='echo " "; td=$define; tu=$undef;
7842sym=$1; var=$2; eval "was=\$$2";
7843tx=yes;
7844case "$reuseval$was" in
7845true) ;;
7846true*) tx=no;;
7847esac;
7848case "$tx" in
7849yes)
7850 set $sym tres -f;
7851 eval $csym;
7852 case "$tres" in
7853 true)
7854 echo "$sym() found." >&4;
7855 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7856 *)
7857 echo "$sym() NOT found." >&4;
7858 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7859 esac;;
7860*)
7861 case "$was" in
7862 $define) echo "$sym() found." >&4;;
7863 *) echo "$sym() NOT found." >&4;;
7864 esac;;
7865esac'
7866
b4eb6b3d
JH
7867: see if dlopen exists
7868xxx_runnm="$runnm"
666ea192 7869xxx_ccflags="$ccflags"
b4eb6b3d 7870runnm=false
666ea192
JH
7871: with g++ one needs -shared to get is-in-libc to work for dlopen
7872case "$gccversion" in
7873'') ;;
7874*) case "$d_cplusplus" in
7875 "$define") ccflags="$ccflags -shared" ;;
7876 esac
7877 ;;
7878esac
b4eb6b3d
JH
7879set dlopen d_dlopen
7880eval $inlibc
7881runnm="$xxx_runnm"
666ea192 7882ccflags="$xxx_ccflags"
b4eb6b3d 7883
4fb7dc7d
JH
7884: see if this is a unistd.h system
7885set unistd.h i_unistd
7886eval $inhdr
7887
b4eb6b3d
JH
7888: determine which dynamic loading, if any, to compile in
7889echo " "
7890dldir="ext/DynaLoader"
7891case "$usedl" in
7892$define|y|true)
7893 dflt='y'
7894 usedl="$define"
7895 ;;
7896$undef|n|false)
7897 dflt='n'
7898 usedl="$undef"
7899 ;;
5b813a60 7900*)
b4eb6b3d
JH
7901 dflt='n'
7902 case "$d_dlopen" in
7903 $define) dflt='y' ;;
7904 esac
7905 case "$i_dld" in
7906 $define) dflt='y' ;;
7907 esac
7908 : Does a dl_xxx.xs file exist for this operating system
7909 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7910 ;;
7911esac
7912rp="Do you wish to use dynamic loading?"
7913. ./myread
7914usedl="$ans"
f1ce3bf1 7915bin_ELF="$undef"
b4eb6b3d
JH
7916case "$ans" in
7917y*) usedl="$define"
7918 case "$dlsrc" in
7919 '')
7920 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7921 dflt="$dldir/dl_${osname}.xs"
7922 elif $test "$d_dlopen" = "$define" ; then
7923 dflt="$dldir/dl_dlopen.xs"
7924 elif $test "$i_dld" = "$define" ; then
7925 dflt="$dldir/dl_dld.xs"
7926 else
7927 dflt=''
7928 fi
7929 ;;
7930 *) dflt="$dldir/$dlsrc"
7931 ;;
7932 esac
7933 echo "The following dynamic loading files are available:"
7934 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7935 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7936 rp="Source file to use for dynamic loading"
7937 fn="fne"
7938 gfpth="$src"
7939 . ./getfile
7940 usedl="$define"
7941 : emulate basename
7942 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7943
7944 $cat << EOM
7945
7946Some systems may require passing special flags to $cc -c to
7947compile modules that will be used to create a shared library.
7948To use no flags, say "none".
7949
7950EOM
7951 case "$cccdlflags" in
7952 '') case "$gccversion" in
7953 '') case "$osname" in
7954 hpux) dflt='+z' ;;
7955 next) dflt='none' ;;
7956 irix*) dflt='-KPIC' ;;
48bcfe03 7957 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7958 sunos) dflt='-pic' ;;
7959 *) dflt='none' ;;
7960 esac
7961 ;;
7962 *) case "$osname" in
b6cc0f4c 7963 darwin) dflt='none' ;;
15fcae63 7964 linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7965 *) dflt='-fpic' ;;
7966 esac ;;
7967 esac ;;
7968 ' ') dflt='none' ;;
7969 *) dflt="$cccdlflags" ;;
7970 esac
7971 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7972 . ./myread
7973 case "$ans" in
7974 none) cccdlflags=' ' ;;
7975 *) cccdlflags="$ans" ;;
7976 esac
7977
7978 cat << EOM
7979
7980Some systems use ld to create libraries that can be dynamically loaded,
7981while other systems (such as those using ELF) use $cc.
7982
7983EOM
8928fb82
MB
7984
7985: Determine if this is ELF
7986 $cat >try.c <<EOM
b4eb6b3d
JH
7987/* Test for whether ELF binaries are produced */
7988#include <fcntl.h>
55954f19
JH
7989#$i_stdlib I_STDLIB
7990#ifdef I_STDLIB
b4eb6b3d 7991#include <stdlib.h>
55954f19 7992#endif
4fb7dc7d
JH
7993#$i_unistd I_UNISTD
7994#ifdef I_UNISTD
7995#include <unistd.h>
7996#endif
b4eb6b3d
JH
7997int main() {
7998 char b[4];
7999 int i = open("a.out",O_RDONLY);
5b813a60 8000 if(i == -1)
b4eb6b3d
JH
8001 exit(1); /* fail */
8002 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8928fb82 8003 exit(0); /* succeed (yes, it is ELF) */
b4eb6b3d
JH
8004 else
8005 exit(1); /* fail */
8006}
8007EOM
8928fb82
MB
8008 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8009 bin_ELF="$define"
8010 fi
8011 $rm_try
8012
8013 case "$ld" in
8014 '') if $test $bin_ELF = "$define"; then
b4eb6b3d
JH
8015 cat <<EOM
8016You appear to have ELF support. I'll use $cc to build dynamic libraries.
8017EOM
8018 dflt="$cc"
8019 else
8020 echo "I'll use ld to build dynamic libraries."
8021 dflt='ld'
8022 fi
b4eb6b3d
JH
8023 ;;
8024 *) dflt="$ld"
8025 ;;
8026 esac
8027
8028 rp="What command should be used to create dynamic libraries?"
8029 . ./myread
8030 ld="$ans"
8031
8032 cat << EOM
8033
8034Some systems may require passing special flags to $ld to create a
8035library that can be dynamically loaded. If your ld flags include
8036-L/other/path options to locate libraries outside your loader's normal
8037search path, you may need to specify those -L options here as well. To
8038use no flags, say "none".
8039
8040EOM
8041 case "$lddlflags" in
8042 '') case "$osname" in
df00ff3b 8043 haiku) dflt='-shared' ;;
b4eb6b3d
JH
8044 hpux) dflt='-b';
8045 case "$gccversion" in
8046 '') dflt="$dflt +vnocompatwarnings" ;;
8047 esac
5b813a60 8048 ;;
15fcae63 8049 linux|irix*|gnu*) dflt="-shared $optimize" ;;
b4eb6b3d
JH
8050 next) dflt='none' ;;
8051 solaris) dflt='-G' ;;
8052 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 8053 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
8054 *) dflt='none' ;;
8055 esac
8056 ;;
8057 *) dflt="$lddlflags" ;;
8058 esac
8059
8060 : Try to guess additional flags to pick up local libraries.
8061 : Be careful not to append to a plain 'none'
8062 case "$dflt" in
8063 none) dflt='' ;;
8064 esac
8065 for thisflag in $ldflags; do
8066 case "$thisflag" in
b5b9f165 8067 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
8068 case " $dflt " in
8069 *" $thisflag "*) ;;
8070 *) dflt="$dflt $thisflag" ;;
8071 esac
8072 ;;
8073 esac
8074 done
8075
8076 case "$dflt" in
8077 ''|' ') dflt='none' ;;
8078 esac
8079
8f68b0e6
AD
8080 case "$ldflags" in
8081 *-fstack-protector*)
8082 case "$dflt" in
8083 *-fstack-protector*) ;; # Don't add it again
8084 *) dflt="$dflt -fstack-protector" ;;
8085 esac
8086 ;;
8087 esac
8088
8089
b4eb6b3d
JH
8090 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8091 . ./myread
8092 case "$ans" in
8093 none) lddlflags=' ' ;;
8094 *) lddlflags="$ans" ;;
8095 esac
8096
8097 cat <<EOM
8098
8099Some systems may require passing special flags to $cc to indicate that
8100the resulting executable will use dynamic linking. To use no flags,
8101say "none".
8102
8103EOM
8104 case "$ccdlflags" in
8105 '') case "$osname" in
fb2e1bc0 8106 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
8107 next|sunos) dflt='none' ;;
8108 *) dflt='none' ;;
b4eb6b3d
JH
8109 esac ;;
8110 ' ') dflt='none' ;;
8111 *) dflt="$ccdlflags" ;;
8112 esac
8113 rp="Any special flags to pass to $cc to use dynamic linking?"
8114 . ./myread
8115 case "$ans" in
8116 none) ccdlflags=' ' ;;
8117 *) ccdlflags="$ans" ;;
8118 esac
8119 ;;
8120*) usedl="$undef"
8121 ld='ld'
8122 dlsrc='dl_none.xs'
8123 lddlflags=''
8124 ccdlflags=''
8125 ;;
8126esac
8127
9ec4dadf
MB
8128ld_can_script="$undef"
8129case "$bin_ELF$usedl" in
8130$define$define)
8131 # Abuse try.h and a.out names for neat cleanup
8132 $cat >try.c <<EOM
8133void foo() {}
8134void bar() {}
8135EOM
8136 $cat >try.h <<EOM
8137LIBTEST_42 {
8138 global:
8139 foo;
8140 local: *;
8141 };
8142EOM
8143 if $cc $cccdlflags $ccdlflags $ccflags \
8144 $ldflags $lddlflags -o a.out try.c \
8145 -Wl,--version-script=try.h >/dev/null 2>&1 \
8146 && $test -s a.out ; then
8147 echo "ld supports scripting" >&4
8148 ld_can_script="$define"
8149 else
8150 echo "ld does not support scripting" >&4
8151 fi
8152 $rm_try
8153 ;;
8154esac
8155
34f1896b 8156: Do we want a shared libperl?
b4eb6b3d
JH
8157also=''
8158case "$usedl" in
8159$undef)
8160 # No dynamic loading being used, so don't bother even to prompt.
8161 useshrplib='false'
8162 ;;
8163*) case "$useshrplib" in
8164 '') case "$osname" in
232083c0 8165 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
b4eb6b3d
JH
8166 dflt=y
8167 also='Building a shared libperl is required for dynamic loading to work on your system.'
8168 ;;
8169 next*)
8170 case "$osvers" in
8171 4*) dflt=y
8172 also='Building a shared libperl is needed for MAB support.'
8173 ;;
8174 *) dflt=n
8175 ;;
8176 esac
8177 ;;
8178 *) dflt=n
8179 ;;
8180 esac
8181 ;;
8182 $define|true|[Yy]*)
8183 dflt=y
8184 ;;
8185 *) dflt=n
8186 ;;
8187 esac
8188 $cat << EOM
8189
8190The perl executable is normally obtained by linking perlmain.c with
8191libperl${_a}, any static extensions (usually just DynaLoader), and
8192any other libraries needed on this system (such as -lm, etc.). Since
8193your system supports dynamic loading, it is probably possible to build
8194a shared libperl.$so. If you will have more than one executable linked
8195to libperl.$so, this will significantly reduce the size of each
5cadb3f3 8196executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
8197default is probably sensible for your system.
8198$also
8199
8200EOM
8201 rp="Build a shared libperl.$so (y/n)"
8202 . ./myread
8203 case "$ans" in
8204 true|$define|[Yy]*)
8205 useshrplib='true' ;;
8206 *) useshrplib='false' ;;
8207 esac
8208 ;;
8209esac
8210
8211case "$useshrplib" in
8212true)
df31f9b1
MB
8213 case "$userelocatableinc" in
8214 true|define)
8215 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8216 echo "See INSTALL for an explanation why that won't work." >&4
8217 exit 4
8218 ;;
8219 esac
b4eb6b3d
JH
8220 case "$libperl" in
8221 '')
8222 # Figure out a good name for libperl.so. Since it gets stored in
8223 # a version-specific architecture-dependent library, the version
8224 # number isn't really that important, except for making cc/ld happy.
8225 #
56e771c1 8226 # A name such as libperl.so.10.1
b4eb6b3d 8227 majmin="libperl.$so.$patchlevel.$subversion"
56e771c1 8228 # A name such as libperl.so.100
b4eb6b3d
JH
8229 majonly=`echo $patchlevel $subversion |
8230 $awk '{printf "%d%02d", $1, $2}'`
8231 majonly=libperl.$so.$majonly
8232 # I'd prefer to keep the os-specific stuff here to a minimum, and
8233 # rely on figuring it out from the naming of libc.
8234 case "${osname}${osvers}" in
8235 next4*)
8236 dflt=libperl.5.$so
8237 # XXX How handle the --version stuff for MAB?
8238 ;;
fb2e1bc0 8239 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
8240 dflt=libperl.$so
8241 ;;
56e771c1
RU
8242 cygwin*) # ld links now against the dll directly
8243 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8244 majonly=`echo $patchlevel $subversion |
8245 $awk '{printf "%03d%03d", $1, $2}'`
8246 majonly=cygperl5.$majonly.$so
8247 dflt=$majmin
b4eb6b3d
JH
8248 ;;
8249 *) # Try to guess based on whether libc has major.minor.
8250 case "$libc" in
8251 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8252 *libc.$so.[0-9]*) dflt=$majonly ;;
8253 *) dflt=libperl.$so ;;
8254 esac
8255 ;;
8256 esac
8257 ;;
8258 *) dflt=$libperl
8259 ;;
8260 esac
8261 cat << EOM
8262
8263I need to select a good name for the shared libperl. If your system uses
8264library names with major and minor numbers, then you might want something
8265like $majmin. Alternatively, if your system uses a single version
8266number for shared libraries, then you might want to use $majonly.
8267Or, your system might be quite happy with a simple libperl.$so.
8268
8269Since the shared libperl will get installed into a version-specific
8270architecture-dependent directory, the version number of the shared perl
8271library probably isn't important, so the default should be o.k.
8272
8273EOM
8274 rp='What name do you want to give to the shared libperl?'
8275 . ./myread
8276 libperl=$ans
8277 echo "Ok, I'll use $libperl"
8278 ;;
8279*)
8280 libperl="libperl${_a}"
8281 ;;
8282esac
8283
8284# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8285case "$shrpdir" in
8286'') ;;
8287*) $cat >&4 <<EOM
8288WARNING: Use of the shrpdir variable for the installation location of
8289the shared $libperl is not supported. It was never documented and
8290will not work in this version. Let me (perlbug@perl.org)
8291know of any problems this may cause.
8292
8293EOM
8294 case "$shrpdir" in
8295 "$archlibexp/CORE")
8296 $cat >&4 <<EOM
8297But your current setting of $shrpdir is
8298the default anyway, so it's harmless.
8299EOM
8300 ;;
8301 *)
8302 $cat >&4 <<EOM
8303Further, your current attempted setting of $shrpdir
8304conflicts with the value of $archlibexp/CORE
8305that installperl will use.
8306EOM
8307 ;;
8308 esac
8309 ;;
8310esac
8311
8312# How will the perl executable find the installed shared $libperl?
8313# Add $xxx to ccdlflags.
8314# If we can't figure out a command-line option, use $shrpenv to
8315# set env LD_RUN_PATH. The main perl makefile uses this.
8316shrpdir=$archlibexp/CORE
8317xxx=''
8318tmp_shrpenv=''
8319if "$useshrplib"; then
34f1896b 8320 case "$osname" in
b4eb6b3d
JH
8321 aix)
8322 # We'll set it in Makefile.SH...
8323 ;;
b5b9f165 8324 solaris)
b4eb6b3d
JH
8325 xxx="-R $shrpdir"
8326 ;;
c5f63f38 8327 freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8328 xxx="-Wl,-R$shrpdir"
8329 ;;
fb2e1bc0 8330 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8331 xxx="-Wl,-rpath,$shrpdir"
8332 ;;
8333 next)
8334 # next doesn't like the default...
8335 ;;
df00ff3b
IW
8336 haiku)
8337 # Haiku doesn't like the default, either.
8338 ;;
b4eb6b3d
JH
8339 hpux*)
8340 # hpux doesn't like the default, either.
8341 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8342 ;;
56e771c1
RU
8343 cygwin)
8344 # cygwin needs only ldlibpth
8345 ;;
b4eb6b3d
JH
8346 *)
8347 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8348 ;;
8349 esac
8350 case "$xxx" in
8351 '') ;;
34f1896b 8352 *)
b4eb6b3d
JH
8353 # Only add $xxx if it isn't already in ccdlflags.
8354 case " $ccdlflags " in
8355 *" $xxx "*) ;;
8356 *) ccdlflags="$ccdlflags $xxx"
8357 cat <<EOM >&4
8358
8359Adding $xxx to the flags
34f1896b 8360passed to $ld so that the perl executable will find the
b4eb6b3d
JH
8361installed shared $libperl.
8362
8363EOM
8364 ;;
8365 esac
8366 ;;
8367 esac
8368fi
8369# Fix ccdlflags in AIX for building external extensions.
8370# (For building Perl itself bare -bE:perl.exp is needed,
8371# Makefile.SH takes care of this.)
8372case "$osname" in
8373aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8374esac
8375# Respect a hint or command-line value.
8376case "$shrpenv" in
8377'') shrpenv="$tmp_shrpenv" ;;
8378esac
8379case "$ldlibpthname" in
8380'') ldlibpthname=LD_LIBRARY_PATH ;;
8381none) ldlibpthname='' ;;
8382esac
8383
8384: determine where manual pages are on this system
8385echo " "
8386case "$sysman" in
8387'')
4a0a3829
SD
8388 syspath='/usr/share/man/man1 /usr/man/man1'
8389 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8390 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8391 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8392 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8393 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8394 sysman=`./loc . /usr/man/man1 $syspath`
8395 ;;
8396esac
8397if $test -d "$sysman"; then
8398 echo "System manual is in $sysman." >&4
8399else
8400 echo "Could not find manual pages in source form." >&4
8401fi
8402
8403: determine where manual pages go
8404set man1dir man1dir none
8405eval $prefixit
8406$cat <<EOM
8407
8408$spackage has manual pages available in source form.
8409EOM
8410case "$nroff" in
8411nroff)
8412 echo "However, you don't have nroff, so they're probably useless to you."
8413 case "$man1dir" in
8414 '') man1dir="none";;
8415 esac;;
8416esac
8417echo "If you don't want the manual sources installed, answer 'none'."
8418case "$man1dir" in
8419' ') dflt=none
8420 ;;
8421'')
4a0a3829
SD
8422 lookpath="$prefixexp/share/man/man1"
8423 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8424 lookpath="$lookpath $prefixexp/man/p_man/man1"
8425 lookpath="$lookpath $prefixexp/man/u_man/man1"
8426 lookpath="$lookpath $prefixexp/man/man.1"
8427 case "$sysman" in
8428 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8429 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8430 esac
8431 set dflt
8432 eval $prefixup
8433 ;;
8434*) dflt="$man1dir"
8435 ;;
8436esac
8437echo " "
8438fn=dn+~
8439rp="Where do the main $spackage manual pages (source) go?"
8440. ./getfile
8441if $test "X$man1direxp" != "X$ansexp"; then
8442 installman1dir=''
8443fi
79522dd2
NC
8444prefixvar=man1dir
8445. ./setprefixvar
8446
477140ee
NC
8447case "$man1dir" in
8448'') man1dir=' '
8449 installman1dir='';;
8450esac
b4eb6b3d
JH
8451
8452: What suffix to use on installed man pages
8453
8454case "$man1dir" in
8455' ')
8456 man1ext='0'
8457 ;;
8458*)
8459 rp="What suffix should be used for the main $spackage man pages?"
8460 case "$man1ext" in
8461 '') case "$man1dir" in
8462 *1) dflt=1 ;;
8463 *1p) dflt=1p ;;
8464 *1pm) dflt=1pm ;;
8465 *l) dflt=l;;
8466 *n) dflt=n;;
8467 *o) dflt=o;;
8468 *p) dflt=p;;
8469 *C) dflt=C;;
8470 *L) dflt=L;;
8471 *L1) dflt=L1;;
8472 *) dflt=1;;
8473 esac
8474 ;;
8475 *) dflt="$man1ext";;
8476 esac
8477 . ./myread
8478 man1ext="$ans"
8479 ;;
8480esac
8481
8482: see if we can have long filenames
8483echo " "
8484first=123456789abcdef
8485$rm -f $first
8486if (echo hi >$first) 2>/dev/null; then
8487 if $test -f 123456789abcde; then
8488 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8489 val="$undef"
8490 else
8491 echo 'You can have filenames longer than 14 characters.'>&4
8492 val="$define"
8493 fi
8494else
8495 $cat <<'EOM'
8496You can't have filenames longer than 14 chars.
8497You can't even think about them!
8498EOM
8499 val="$undef"
776a38e3 8500fi
b4eb6b3d
JH
8501set d_flexfnam
8502eval $setvar
8503$rm -rf 123456789abcde*
8504
8505: determine where library module manual pages go
8506set man3dir man3dir none
8507eval $prefixit
8508$cat <<EOM
8509
8510$spackage has manual pages for many of the library modules.
8511EOM
8512
8513case "$nroff" in
8514nroff)
8515 $cat <<'EOM'
8516However, you don't have nroff, so they're probably useless to you.
8517EOM
8518 case "$man3dir" in
8519 '') man3dir="none";;
8520 esac;;
8521esac
8522
8523case "$d_flexfnam" in
8524undef)
8525 $cat <<'EOM'
f3f1a2d8 8526However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8527EOM
8528 case "$man3dir" in
8529 '') man3dir="none";;
8530 esac;;
8531esac
8532
8533echo "If you don't want the manual sources installed, answer 'none'."
8534prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8535case "$man3dir" in
8536'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8537 if $test -d "$privlib/man/man3"; then
8538 cat <<EOM >&4
8539
8540WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8541$privlib/man/man3. This version will suggest a
8542new default of $dflt.
b4eb6b3d
JH
8543EOM
8544 tdflt=$dflt
8545 dflt='n'
8546 rp='Do you wish to preserve the old behavior?(y/n)'
8547 . ./myread
8548 case "$ans" in
8549 y*) dflt="$privlib/man/man3" ;;
8550 *) dflt=$tdflt ;;
8551 esac
8552 fi
8553 ;;
8554*) dflt="$man3dir" ;;
8555esac
8556case "$dflt" in
8557' ') dflt=none ;;
8558esac
8559echo " "
8560fn=dn+~
8561rp="Where do the $package library man pages (source) go?"
8562. ./getfile
79522dd2
NC
8563prefixvar=man3dir
8564. ./setprefixvar
8565
477140ee
NC
8566case "$man3dir" in
8567'') man3dir=' '
8568 installman3dir='';;
8569esac
b4eb6b3d
JH
8570
8571: What suffix to use on installed man pages
8572case "$man3dir" in
8573' ')
8574 man3ext='0'
8575 ;;
8576*)
8577 rp="What suffix should be used for the $package library man pages?"
8578 case "$man3ext" in
8579 '') case "$man3dir" in
8580 *3) dflt=3 ;;
8581 *3p) dflt=3p ;;
8582 *3pm) dflt=3pm ;;
8583 *l) dflt=l;;
8584 *n) dflt=n;;
8585 *o) dflt=o;;
8586 *p) dflt=p;;
8587 *C) dflt=C;;
8588 *L) dflt=L;;
8589 *L3) dflt=L3;;
8590 *) dflt=3;;
8591 esac
8592 ;;
8593 *) dflt="$man3ext";;
8594 esac
8595 . ./myread
8596 man3ext="$ans"
8597 ;;
8598esac
8599
8600: see if we have to deal with yellow pages, now NIS.
0384a54a 8601if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8602 if $test -f /usr/etc/nibindd; then
8603 echo " "
8604 echo "I'm fairly confident you're on a NeXT."
8605 echo " "
8606 rp='Do you get the hosts file via NetInfo?'
8607 dflt=y
8608 case "$hostcat" in
8609 nidump*) ;;
8610 '') ;;
8611 *) dflt=n;;
8612 esac
8613 . ./myread
8614 case "$ans" in
8615 y*) hostcat='nidump hosts .';;
8616 *) case "$hostcat" in
8617 nidump*) hostcat='';;
8618 esac
8619 ;;
8620 esac
8621 fi
8622 case "$hostcat" in
8623 nidump*) ;;
8624 *)
8625 case "$hostcat" in
8626 *ypcat*) dflt=y;;
8627 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8628 dflt=y
8629 else
8630 dflt=n
8631 fi;;
8632 *) dflt=n;;
8633 esac
8634 echo " "
8635 rp='Are you getting the hosts file via yellow pages?'
8636 . ./myread
8637 case "$ans" in
8638 y*) hostcat='ypcat hosts';;
8639 *) hostcat='cat /etc/hosts';;
8640 esac
8641 ;;
8642 esac
8643fi
8644case "$hostcat" in
8645'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8646esac
8647case "$groupcat" in
8648'') test -f /etc/group && groupcat='cat /etc/group';;
8649esac
8650case "$passcat" in
8651'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8652esac
8653
8654: now get the host name
8655echo " "
8656echo "Figuring out host name..." >&4
8657case "$myhostname" in
8658'') cont=true
8659 echo 'Maybe "hostname" will work...'
73614538 8660 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8661 myhostname=$tans
8662 phostname=hostname
8663 cont=''
8664 fi
8665 ;;
8666*) cont='';;
8667esac
8668if $test "$cont"; then
8669 if ./xenix; then
8670 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8671 if tans=`cat /etc/systemid 2>&1` ; then
8672 myhostname=$tans
8673 phostname='cat /etc/systemid'
8674 echo "Whadyaknow. Xenix always was a bit strange..."
8675 cont=''
8676 fi
8677 elif $test -r /etc/systemid; then
8678 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8679 fi
8680fi
8681if $test "$cont"; then
8682 echo 'No, maybe "uuname -l" will work...'
73614538 8683 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8684 myhostname=$tans
8685 phostname='uuname -l'
8686 else
8687 echo 'Strange. Maybe "uname -n" will work...'
73614538 8688 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8689 myhostname=$tans
8690 phostname='uname -n'
8691 else
8692 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8693 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8694 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8695 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8696 else
8697 case "$myhostname" in
8698 '') echo "Does this machine have an identity crisis or something?"
8699 phostname='';;
8700 *)
8701 echo "Well, you said $myhostname before..."
8702 phostname='echo $myhostname';;
8703 esac
8704 fi
8705 fi
8706 fi
8707fi
52a549d0
JH
8708case "$myhostname" in
8709'') myhostname=noname ;;
8710esac
b4eb6b3d
JH
8711: you do not want to know about this
8712set $myhostname
8713myhostname=$1
8714
8715: verify guess
8716if $test "$myhostname" ; then
8717 dflt=y
8718 rp='Your host name appears to be "'$myhostname'".'" Right?"
8719 . ./myread
8720 case "$ans" in
8721 y*) ;;
8722 *) myhostname='';;
8723 esac
8724fi
8725
8726: bad guess or no guess
8727while $test "X$myhostname" = X ; do
8728 dflt=''
8729 rp="Please type the (one word) name of your host:"
8730 . ./myread
8731 myhostname="$ans"
8732done
8733
8734: translate upper to lower if necessary
8735case "$myhostname" in
8736*[A-Z]*)
8737 echo "(Normalizing case in your host name)"
8738 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8739 ;;
8740esac
8741
8742case "$myhostname" in
8743*.*)
8744 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8745 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8746 echo "(Trimming domain name from host name--host name is now $myhostname)"
8747 ;;
8748*) case "$mydomain" in
8749 '')
8750 {
8751 test "X$hostcat" = "Xypcat hosts" &&
8752 ypmatch "$myhostname" hosts 2>/dev/null |\
8753 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8754 $test -s hosts
8755 } || {
8756 test "X$hostcat" != "X" &&
8757 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8758 /[ ]$myhostname[ . ]/p" > hosts
8759 }
8760 tmp_re="[ . ]"
f08cbdd1
PP
8761 if $test -f hosts; then
8762 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8763 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8764 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8765 hosts | $sort | $uniq | \
8766 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8767 case `$echo X$dflt` in
8768 X*\ *) echo "(Several hosts in the database matched hostname)"
8769 dflt=.
8770 ;;
8771 X.) echo "(You do not have fully-qualified names in the hosts database)"
8772 ;;
8773 esac
8774 else
8775 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8776 dflt=.
f08cbdd1 8777 fi
b4eb6b3d
JH
8778 case "$dflt" in
8779 .)
8780 tans=`./loc resolv.conf X /etc /usr/etc`
8781 if $test -f "$tans"; then
8782 echo "(Attempting domain name extraction from $tans)"
8783 dflt=.`$sed -n -e 's/ / /g' \
8784 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
1d40d392 8785 -e 1q 2>/dev/null`
b4eb6b3d
JH
8786 case "$dflt" in
8787 .) dflt=.`$sed -n -e 's/ / /g' \
8788 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
1d40d392 8789 -e 1q 2>/dev/null`
b4eb6b3d
JH
8790 ;;
8791 esac
8792 fi
8793 ;;
8794 esac
8795 case "$dflt" in
8796 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8797 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8798 case "$dflt" in
8799 '') dflt='.';;
8800 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8801 esac
8802 ;;
8803 esac
59c9e5d6
PP
8804 case "$dflt$osname" in
8805 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8806 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8807 ;;
8808 esac
b4eb6b3d
JH
8809 case "$dflt" in
8810 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8811 dflt='.nonet'
b4eb6b3d
JH
8812 ;;
8813 esac
8814 $rm -f hosts
8815 ;;
8816 *) dflt="$mydomain";;
8817 esac;;
8818esac
8819echo " "
8820rp="What is your domain name?"
8821. ./myread
8822tans="$ans"
8823case "$ans" in
8824'') ;;
8825.*) ;;
8826*) tans=".$tans";;
8827esac
8828mydomain="$tans"
8829
8830: translate upper to lower if necessary
8831case "$mydomain" in
8832*[A-Z]*)
8833 echo "(Normalizing case in your domain name)"
8834 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8835 ;;
8836esac
8837
8838: a little sanity check here
8839case "$phostname" in
8840'') ;;
8841*)
8842 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8843 $myhostname$mydomain|$myhostname) ;;
8844 *)
8845 case "$phostname" in
8846 sed*)
8847 echo "(That doesn't agree with your whoami.h file, by the way.)"
8848 ;;
8849 *)
8850 echo "(That doesn't agree with your $phostname command, by the way.)"
8851 ;;
8852 esac
8853 ;;
8854 esac
8855 ;;
8856esac
8857
776a38e3 8858: determine the e-mail address of the user who is running us
b4eb6b3d
JH
8859$cat <<EOM
8860
8861I need to get your e-mail address in Internet format if possible, i.e.
8862something like user@host.domain. Please answer accurately since I have
8863no easy means to double check it. The default value provided below
8864is most probably close to reality but may not be valid from outside
8865your organization...
8866
8867EOM
8868cont=x
8869while test "$cont"; do
a7cd2d38
MB
8870 case "$MAILDOMAIN" in
8871 '') maildomain="$myhostname$mydomain";;
8872 *) maildomain="$MAILDOMAIN";;
8873 esac
b4eb6b3d 8874 case "$cf_email" in
a7cd2d38
MB
8875 '') dflt="$cf_by@$maildomain";;
8876 *) dflt="$cf_email";;
b4eb6b3d
JH
8877 esac
8878 rp='What is your e-mail address?'
8879 . ./myread
8880 cf_email="$ans"
8881 case "$cf_email" in
8882 *@*.*) cont='' ;;
8883 *)
8884 rp='Address does not look like an Internet one. Use it anyway?'
8885 case "$fastread" in
8886 yes) dflt=y ;;
8887 *) dflt=n ;;
8888 esac
8889 . ./myread
8890 case "$ans" in
8891 y*) cont='' ;;
8892 *) echo " " ;;
8893 esac
8894 ;;
8895 esac
8896done
8897
34f1896b 8898: Ask e-mail of administrator
b4eb6b3d
JH
8899$cat <<EOM
8900
8901If you or somebody else will be maintaining perl at your site, please
8902fill in the correct e-mail address here so that they may be contacted
8903if necessary. Currently, the "perlbug" program included with perl
8904will send mail to this address in addition to perlbug@perl.org. You may
8905enter "none" for no administrator.
8906
8907EOM
8908case "$perladmin" in
8909'') dflt="$cf_email";;
8910*) dflt="$perladmin";;
8911esac
8912rp='Perl administrator e-mail address'
8913. ./myread
8914perladmin="$ans"
8915
91f55cc7
MB
8916: determine whether to only install version-specific parts.
8917echo " "
8918$cat <<EOM
8919Do you want to install only the version-specific parts of the perl
8920distribution? Usually you do *not* want to do this.
8921EOM
8922case "$versiononly" in
8923"$define"|[Yy]*|true) dflt='y' ;;
8924*) dflt='n';
8925esac
8926rp="Do you want to install only the version-specific parts of perl?"
8927. ./myread
8928case "$ans" in
8929[yY]*) val="$define";;
8930*) val="$undef" ;;
8931esac
8932set versiononly
8933eval $setvar
8934
8935case "$versiononly" in
8936"$define") inc_version_list=''
8937 inc_version_list_init=0
8938 ;;
8939esac
8940
8941: figure out how to guarantee perl startup
8942: XXX Note that this currently takes advantage of the bug that binexp ignores
8943: the Configure -Dinstallprefix setting, which in turn means that under
8944: relocatable @INC, initialinstalllocation is what binexp started as.
8945case "$startperl" in
8946'')
8947 case "$sharpbang" in
8948 *!)
8949 $cat <<EOH
8950
8951I can use the #! construct to start perl on your system. This will
8952make startup of perl scripts faster, but may cause problems if you
8953want to share those scripts and perl is not in a standard place
8954($initialinstalllocation/perl) on all your platforms. The alternative
8955is to force a shell by starting the script with a single ':' character.
8956
8957EOH
8958 case "$versiononly" in
8959 "$define") dflt="$initialinstalllocation/perl$version";;
8960 *) dflt="$initialinstalllocation/perl";;
8961 esac
8962 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8963 . ./myread
8964 case "$ans" in
8965 none) startperl=": # use perl";;
8966 *) startperl="#!$ans"
8967 if $test 30 -lt `echo "$ans" | wc -c`; then
8968 $cat >&4 <<EOM
8969
8970WARNING: Some systems limit the #! command to 32 characters.
8971If you experience difficulty running Perl scripts with #!, try
8972installing Perl in a directory with a shorter pathname.
8973
8974EOM
8975 fi ;;
8976 esac
8977 ;;
8978 *) startperl=": # use perl"
8979 ;;
8980 esac
8981 ;;
8982esac
8983echo "I'll use $startperl to start perl scripts."
8984
8985: figure best path for perl in scripts
8986case "$perlpath" in
8987'')
8988 case "$versiononly" in
8989 "$define") perlpath="$initialinstalllocation/perl$version";;
8990 *) perlpath="$initialinstalllocation/perl";;
8991 esac
8992 case "$startperl" in
8993 *!*) ;;
8994 *)
8995 $cat <<EOH
8996
8997I will use the "eval 'exec'" idiom to start Perl on your system.
8998I can use the full path of your Perl binary for this purpose, but
8999doing so may cause problems if you want to share those scripts and
9000Perl is not always in a standard place ($initialinstalllocation/perl).
9001
9002EOH
9003 dflt="$initialinstalllocation/perl"
9004 rp="What path shall I use in \"eval 'exec'\"?"
9005 . ./myread
9006 perlpath="$ans"
9007 ;;
9008 esac
9009 ;;
9010esac
9011case "$startperl" in
9012*!*) ;;
9013*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9014esac
9015
b4eb6b3d
JH
9016: determine where public executable scripts go
9017set scriptdir scriptdir
9018eval $prefixit
9019case "$scriptdir" in
9020'')
9021 dflt="$bin"
9022 : guess some guesses
9023 $test -d /usr/share/scripts && dflt=/usr/share/scripts
9024 $test -d /usr/share/bin && dflt=/usr/share/bin
9025 $test -d /usr/local/script && dflt=/usr/local/script
9026 $test -d /usr/local/scripts && dflt=/usr/local/scripts
9027 $test -d $prefixexp/script && dflt=$prefixexp/script
9028 set dflt
9029 eval $prefixup
9030 ;;
9031*) dflt="$scriptdir"
9032 ;;
9033esac
9034$cat <<EOM
f3f1a2d8 9035
b4eb6b3d
JH
9036Some installations have a separate directory just for executable scripts so
9037that they can mount it across multiple architectures but keep the scripts in
9038one spot. You might, for example, have a subdirectory of /usr/share for this.
9039Or you might just lump your scripts in with all your other executables.
f3f1a2d8 9040
b4eb6b3d
JH
9041EOM
9042fn=d~
9043rp='Where do you keep publicly executable scripts?'
9044. ./getfile
9045if $test "X$ansexp" != "X$scriptdirexp"; then
9046 installscript=''
9047fi
f3f1a2d8 9048installscriptdir=''
79522dd2
NC
9049prefixvar=scriptdir
9050. ./setprefixvar
9051: A little fix up for an irregularly named variable.
9052installscript="$installscriptdir"
9053
b4eb6b3d
JH
9054: determine where add-on public executables go
9055case "$sitebin" in
9056'') dflt=$siteprefix/bin ;;
9057*) dflt=$sitebin ;;
9058esac
9059fn=d~
9060rp='Pathname where the add-on public executables should be installed?'
9061. ./getfile
79522dd2
NC
9062prefixvar=sitebin
9063. ./setprefixvar
b4eb6b3d 9064
6e1038e0 9065: determine where add-on html pages go
8d2cbf27 9066: There is no standard location, so try to copy the previously-selected
6e1038e0 9067: directory structure for the core html pages.
8d2cbf27
JH
9068case "$sitehtml1dir" in
9069'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9070*) dflt=$sitehtml1dir ;;
6e1038e0
MB
9071esac
9072case "$dflt" in
9073''|' ') dflt=none ;;
9074esac
9075fn=dn+~
9076rp='Pathname where the site-specific html pages should be installed?'
9077. ./getfile
79522dd2
NC
9078prefixvar=sitehtml1dir
9079. ./setprefixvar
6e1038e0
MB
9080
9081: determine where add-on library html pages go
9082: There is no standard location, so try to copy the previously-selected
9083: directory structure for the core html pages.
8d2cbf27
JH
9084case "$sitehtml3dir" in
9085'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9086*) dflt=$sitehtml3dir ;;
6e1038e0
MB
9087esac
9088case "$dflt" in
9089''|' ') dflt=none ;;
9090esac
9091fn=dn+~
9092rp='Pathname where the site-specific library html pages should be installed?'
9093. ./getfile
79522dd2
NC
9094prefixvar=sitehtml3dir
9095. ./setprefixvar
6e1038e0
MB
9096
9097: determine where add-on manual pages go
91e123a8
JH
9098case "$siteman1dir" in
9099'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9100*) dflt=$siteman1dir ;;
6e1038e0 9101esac
257059b5
JH
9102case "$dflt" in
9103''|' ') dflt=none ;;
9104esac
6e1038e0
MB
9105fn=dn+~
9106rp='Pathname where the site-specific manual pages should be installed?'
9107. ./getfile
79522dd2
NC
9108prefixvar=siteman1dir
9109. ./setprefixvar
6e1038e0
MB
9110
9111: determine where add-on library man pages go
91e123a8
JH
9112case "$siteman3dir" in
9113'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 9114*) dflt=$siteman3dir ;;
6e1038e0 9115esac
257059b5
JH
9116case "$dflt" in
9117''|' ') dflt=none ;;
9118esac
6e1038e0
MB
9119fn=dn+~
9120rp='Pathname where the site-specific library manual pages should be installed?'
9121. ./getfile
79522dd2
NC
9122prefixvar=siteman3dir
9123. ./setprefixvar
6e1038e0
MB
9124
9125: determine where add-on public executable scripts go
9126case "$sitescript" in
9127'') dflt=$siteprefix/script
9128 $test -d $dflt || dflt=$sitebin ;;
9129*) dflt="$sitescript" ;;
9130esac
9131fn=d~+
9132rp='Pathname where add-on public executable scripts should be installed?'
9133. ./getfile
79522dd2
NC
9134prefixvar=sitescript
9135. ./setprefixvar
6e1038e0 9136
34f1896b 9137: Check if faststdio is requested and available
15b61c98
JH
9138case "$usefaststdio" in
9139$define|true|[yY]*|'')
9140 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9141 case "$xversion" in
9142 [68]) dflt='y' ;;
9143 *) dflt='n' ;;
9144 esac
9145 ;;
9146*) dflt='n';;
9147esac
9148cat <<EOM
9149
9150Perl can be built to use 'fast stdio', which means using the stdio
9151library but also directly manipulating the stdio buffers to enable
9152faster I/O. Using stdio is better for backward compatibility (especially
9153for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9154interface has been preferred instead of stdio.
9155
9156If this doesn't make any sense to you, just accept the default '$dflt'.
9157EOM
9158rp='Use the "fast stdio" if available?'
9159. ./myread
9160case "$ans" in
34f1896b 9161y|Y) val="$define" ;;
15b61c98
JH
9162*) val="$undef" ;;
9163esac
9164set usefaststdio
9165eval $setvar
9166
9167
96056487
JH
9168: define an is-a-typedef? function
9169typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9170case "$inclist" in
9171"") inclist="sys/types.h";;
9172esac;
9173eval "varval=\$$var";
9174case "$varval" in
9175"")
9176 $rm -f temp.c;
9177 for inc in $inclist; do
9178 echo "#include <$inc>" >>temp.c;
9179 done;
9180 echo "#ifdef $type" >> temp.c;
9181 echo "printf(\"We have $type\");" >> temp.c;
9182 echo "#endif" >> temp.c;
9183 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9184 if $contains $type temp.E >/dev/null 2>&1; then
9185 eval "$var=\$type";
9186 else
9187 eval "$var=\$def";
9188 fi;
9189 $rm -f temp.?;;
9190*) eval "$var=\$varval";;
9191esac'
9192
9193: define an is-a-typedef? function that prompts if the type is not available.
9194typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9195case "$inclist" in
9196"") inclist="sys/types.h";;
9197esac;
9198eval "varval=\$$var";
9199case "$varval" in
9200"")
9201 $rm -f temp.c;
9202 for inc in $inclist; do
9203 echo "#include <$inc>" >>temp.c;
9204 done;
9205 echo "#ifdef $type" >> temp.c;
9206 echo "printf(\"We have $type\");" >> temp.c;
9207 echo "#endif" >> temp.c;
9208 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9209 echo " " ;
9210 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9211 if $contains $type temp.E >/dev/null 2>&1; then
9212 echo "$type found." >&4;
9213 eval "$var=\$type";
9214 else
9215 echo "$type NOT found." >&4;
9216 dflt="$def";
9217 . ./myread ;
9218 eval "$var=\$ans";
9219 fi;
9220 $rm -f temp.?;;
9221*) eval "$var=\$varval";;
9222esac'
9223
9224: see what type lseek is declared as in the kernel
9225rp="What is the type used for lseek's offset on this system?"
9226set off_t lseektype long stdio.h sys/types.h
9227eval $typedef_ask
9228
9229echo " "
9230echo "Checking to see how big your file offsets are..." >&4
9231$cat >try.c <<EOCP
9232#include <sys/types.h>
9233#include <stdio.h>
9234int main()
9235{
9236 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9237 return(0);
96056487
JH
9238}
9239EOCP
9240set try
9241if eval $compile_ok; then
9242 lseeksize=`$run ./try`
9243 echo "Your file offsets are $lseeksize bytes long."
9244else
9245 dflt=$longsize
9246 echo " "
9247 echo "(I can't seem to compile the test program. Guessing...)"
9248 rp="What is the size of your file offsets (in bytes)?"
9249 . ./myread
9250 lseeksize="$ans"
9251fi
5b813a60 9252$rm_try
96056487
JH
9253
9254: see what type file positions are declared as in the library
9255rp="What is the type for file position used by fsetpos()?"
9256set fpos_t fpostype long stdio.h sys/types.h
9257eval $typedef_ask
9258
613d6c3e 9259: Check size for Fpos_t
96056487
JH
9260echo " "
9261case "$fpostype" in
9262*_t) zzz="$fpostype" ;;
9263*) zzz="fpos_t" ;;
9264esac
613d6c3e 9265echo "Checking the size of $zzz..." >&4
96056487
JH
9266cat > try.c <<EOCP
9267#include <sys/types.h>
9268#include <stdio.h>
d1daaddf
JH
9269#$i_stdlib I_STDLIB
9270#ifdef I_STDLIB
9271#include <stdlib.h>
9272#endif
96056487
JH
9273int main() {
9274 printf("%d\n", (int)sizeof($fpostype));
9275 exit(0);
9276}
9277EOCP
9278set try
9279if eval $compile_ok; then
9280 yyy=`$run ./try`
9281 case "$yyy" in
9282 '') fpossize=4
9283 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9284 ;;
9285 *) fpossize=$yyy
9286 echo "Your $zzz is $fpossize bytes long."
9287 ;;
9288 esac
9289else
9290 dflt="$longsize"
9291 echo " " >&4
9292 echo "(I can't compile the test program. Guessing...)" >&4
9293 rp="What is the size of your file positions (in bytes)?"
9294 . ./myread
9295 fpossize="$ans"
9296fi
9297
613d6c3e 9298: Check for large file support
96056487
JH
9299# Backward compatibility (uselfs is deprecated).
9300case "$uselfs" in
9301"$define"|true|[yY]*)
9302 cat <<EOM >&4
9303
9304*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9305EOM
9306 uselargefiles="$define"
9307 ;;
5b813a60 9308esac
96056487
JH
9309
9310case "$lseeksize:$fpossize" in
93118:8) cat <<EOM
9312
9313You can have files larger than 2 gigabytes.
9314EOM
9315 val="$define" ;;
9316*) case "$uselargefiles" in
9317 "$undef"|false|[nN]*) dflt='n' ;;
9318 *) dflt='y' ;;
9319 esac
9320 cat <<EOM
9321
9322Perl can be built to understand large files (files larger than 2 gigabytes)
9323on some systems. To do so, Configure can be run with -Duselargefiles.
9324
9325If this doesn't make any sense to you, just accept the default '$dflt'.
9326EOM
9327 rp='Try to understand large files, if available?'
9328 . ./myread
9329 case "$ans" in
9330 y|Y) val="$define" ;;
9331 *) val="$undef" ;;
9332 esac
9333 ;;
9334esac
9335set uselargefiles
9336eval $setvar
96056487
JH
9337: Look for a hint-file generated 'call-back-unit'. If the
9338: user has specified that a large files perl is to be built,
9339: we may need to set or change some other defaults.
9da7673b
MB
9340if $test -f uselargefiles.cbu; then
9341 echo "Your platform has some specific hints regarding large file builds, using them..."
9342 . ./uselargefiles.cbu
9343fi
9344case "$uselargefiles" in
9345"$define")
96056487 9346 if $test -f uselargefiles.cbu; then
96056487
JH
9347 echo " "
9348 echo "Rechecking to see how big your file offsets are..." >&4
9349 $cat >try.c <<EOCP
9350#include <sys/types.h>
9351#include <stdio.h>
9352int main()
9353{
9354 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9355 return(0);
96056487
JH
9356}
9357EOCP
9358 set try
9359 if eval $compile_ok; then
9360 lseeksize=`$run ./try`
9361 $echo "Your file offsets are now $lseeksize bytes long."
9362 else
9363 dflt="$lseeksize"
9364 echo " "
9365 echo "(I can't seem to compile the test program. Guessing...)"
9366 rp="What is the size of your file offsets (in bytes)?"
9367 . ./myread
9368 lseeksize="$ans"
9369 fi
9370 case "$fpostype" in
9371 *_t) zzz="$fpostype" ;;
9372 *) zzz="fpos_t" ;;
9373 esac
5b813a60 9374 $echo $n "Rechecking the size of $zzz...$c" >&4
96056487
JH
9375 $cat > try.c <<EOCP
9376#include <sys/types.h>
9377#include <stdio.h>
55954f19
JH
9378#$i_stdlib I_STDLIB
9379#ifdef I_STDLIB
9380#include <stdlib.h>
9381#endif
96056487
JH
9382int main() {
9383 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9384 return(0);
96056487
JH
9385}
9386EOCP
9387 set try
9388 if eval $compile_ok; then
9389 yyy=`$run ./try`
9390 dflt="$lseeksize"
9391 case "$yyy" in
9392 '') echo " "
9393 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9394 ;;
9395 *) fpossize=$yyy
9396 echo " $fpossize bytes." >&4
9397 ;;
9398 esac
9399 else
9400 dflt="$fpossize"
9401 echo " "
9402 echo "(I can't compile the test program. Guessing...)" >&4
9403 rp="What is the size of your file positions (in bytes)?"
9404 . ./myread
9405 fpossize="$ans"
9406 fi
5b813a60 9407 $rm_try
96056487
JH
9408 fi
9409 ;;
9410esac
9411
dd35fa16
MB
9412: Check if we want perlio
9413useperlio="$define"
9414
613d6c3e 9415: Set the vendorbin variables
b4eb6b3d
JH
9416case "$vendorprefix" in
9417'') d_vendorbin="$undef"
9418 vendorbin=''
9419 vendorbinexp=''
9420 ;;
9421*) d_vendorbin="$define"
9422 : determine where vendor-supplied executables go.
9423 case "$vendorbin" in
9424 '') dflt=$vendorprefix/bin ;;
9425 *) dflt="$vendorbin" ;;
9426 esac
9427 fn=d~+
9428 rp='Pathname for the vendor-supplied executables directory?'
9429 . ./getfile
9430 vendorbin="$ans"
9431 vendorbinexp="$ansexp"
9432 ;;
9433esac
a092d240
NC
9434prefixvar=vendorbin
9435. ./installprefix
b4eb6b3d 9436
613d6c3e 9437: Set the vendorhtml1dir variables
6e1038e0 9438case "$vendorprefix" in
8d2cbf27
JH
9439'') vendorhtml1dir=''
9440 vendorhtml1direxp=''
6e1038e0
MB
9441 ;;
9442*) : determine where vendor-supplied html pages go.
9443 : There is no standard location, so try to copy the previously-selected
9444 : directory structure for the core html pages.
9445 : XXX Better default suggestions would be welcome.
8d2cbf27 9446 case "$vendorhtml1dir" in
6e1038e0 9447 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9448 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9449 esac
9450 case "$dflt" in
9451 ''|' ') dflt=none ;;
9452 esac
9453 fn=dn+~
9454 rp='Pathname for the vendor-supplied html pages?'
9455 . ./getfile
8d2cbf27
JH
9456 vendorhtml1dir="$ans"
9457 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9458 ;;
9459esac
9460: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9461$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9462prefixvar=vendorhtml1dir
9463. ./installprefix
6e1038e0 9464
613d6c3e 9465: Set the vendorhtml3dir variables
6e1038e0 9466case "$vendorprefix" in
8d2cbf27
JH
9467'') vendorhtml3dir=''
9468 vendorhtml3direxp=''
6e1038e0
MB
9469 ;;
9470*) : determine where vendor-supplied module html pages go.
9471 : There is no standard location, so try to copy the previously-selected
9472 : directory structure for the core html pages.
9473 : XXX Better default suggestions would be welcome.
8d2cbf27 9474 case "$vendorhtml3dir" in
6e1038e0 9475 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9476 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9477 esac
9478 case "$dflt" in
9479 ''|' ') dflt=none ;;
9480 esac
9481 fn=dn+~
9482 rp='Pathname for the vendor-supplied html pages?'
9483 . ./getfile
8d2cbf27
JH
9484 vendorhtml3dir="$ans"
9485 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9486 ;;
9487esac
9488: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9489$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9490prefixvar=vendorhtml3dir
9491. ./installprefix
6e1038e0 9492
613d6c3e 9493: Set the vendorman1dir variables
6e1038e0 9494case "$vendorprefix" in
91e123a8
JH
9495'') vendorman1dir=''
9496 vendorman1direxp=''
6e1038e0
MB
9497 ;;
9498*) : determine where vendor-supplied manual pages go.
91e123a8 9499 case "$vendorman1dir" in
6e1038e0 9500 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9501 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9502 esac
9503 case "$dflt" in
9504 ''|' ') dflt=none ;;
9505 esac
9506 fn=nd~+
9507 rp='Pathname for the vendor-supplied manual section 1 pages?'
9508 . ./getfile
91e123a8
JH
9509 vendorman1dir="$ans"
9510 vendorman1direxp="$ansexp"
6e1038e0
MB
9511 ;;
9512esac
9513: Use ' ' for none so value is preserved next time through Configure
91e123a8 9514$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9515prefixvar=vendorman1dir
9516. ./installprefix
6e1038e0 9517
613d6c3e 9518: Set the vendorman3dir variables
6e1038e0 9519case "$vendorprefix" in
91e123a8
JH
9520'') vendorman3dir=''
9521 vendorman3direxp=''
6e1038e0
MB
9522 ;;
9523*) : determine where vendor-supplied module manual pages go.
91e123a8 9524 case "$vendorman3dir" in
6e1038e0 9525 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9526 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9527 esac
9528 case "$dflt" in
9529 ''|' ') dflt=none ;;
9530 esac
9531 fn=nd~+
9532 rp='Pathname for the vendor-supplied manual section 3 pages?'
9533 . ./getfile
91e123a8
JH
9534 vendorman3dir="$ans"
9535 vendorman3direxp="$ansexp"
6e1038e0
MB
9536 ;;
9537esac
9538: Use ' ' for none so value is preserved next time through Configure
91e123a8 9539$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9540prefixvar=vendorman3dir
9541. ./installprefix
6e1038e0 9542
613d6c3e 9543: Set the vendorscript variables
6e1038e0
MB
9544case "$vendorprefix" in
9545'') d_vendorscript="$undef"
9546 vendorscript=''
9547 vendorscriptexp=''
9548 ;;
9549*) d_vendorscript="$define"
9550 : determine where vendor-supplied scripts go.
9551 case "$vendorscript" in
9552 '') dflt=$vendorprefix/script
9553 $test -d $dflt || dflt=$vendorbin ;;
9554 *) dflt="$vendorscript" ;;
9555 esac
9556 $cat <<EOM
9557
f3f1a2d8 9558The installation process will create a directory for
6e1038e0
MB
9559vendor-supplied scripts.
9560
9561EOM
9562 fn=d~+
9563 rp='Pathname for the vendor-supplied scripts directory?'
9564 . ./getfile
9565 vendorscript="$ans"
9566 vendorscriptexp="$ansexp"
9567 ;;
9568esac
a092d240
NC
9569prefixvar=vendorscript
9570. ./installprefix
6e1038e0 9571
f47f1645
TC
9572: script used to emit important warnings
9573cat >warn <<EOS
9574$startsh
9575if test \$# -gt 0; then
9576 echo "\$@" >msg
9577else
9578 cat >msg
9579fi
9580echo "*** WARNING:" >&4
9581sed -e 's/^/*** /' <msg >&4
9582echo "*** " >&4
9583cat msg >>config.msg
9584echo " " >>config.msg
9585rm -f msg
9586EOS
9587chmod +x warn
9588$eunicefix warn
9589
9590: see which of string.h or strings.h is needed
9591echo " "
9592strings=`./findhdr string.h`
9593if $test "$strings" && $test -r "$strings"; then
9594 echo "Using <string.h> instead of <strings.h>." >&4
9595 val="$define"
9596else
9597 val="$undef"
9598 strings=`./findhdr strings.h`
9599 if $test "$strings" && $test -r "$strings"; then
9600 echo "Using <strings.h> instead of <string.h>." >&4
9601 else
9602 ./warn "No string header found -- You'll surely have problems."
9603 fi
9604fi
9605set i_string
9606eval $setvar
9607case "$i_string" in
9608"$undef") strings=`./findhdr strings.h`;;
9609*) strings=`./findhdr string.h`;;
9610esac
9611
b4eb6b3d
JH
9612: see if qgcvt exists
9613set qgcvt d_qgcvt
9614eval $inlibc
9615
613d6c3e 9616: Check print/scan long double stuff
89ce900e
JH
9617echo " "
9618
9619if $test X"$d_longdbl" = X"$define"; then
9620
9621echo "Checking how to print long doubles..." >&4
9622
9623if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9624 $cat >try.c <<'EOCP'
9625#include <sys/types.h>
9626#include <stdio.h>
9627int main() {
9628 double d = 123.456;
9629 printf("%.3f\n", d);
9630}
9631EOCP
9632 set try
9633 if eval $compile; then
9634 yyy=`$run ./try`
9635 case "$yyy" in
9636 123.456)
9637 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9638 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9639 echo "We will use %f."
9640 ;;
9641 esac
9642 fi
9643fi
9644
9645if $test X"$sPRIfldbl" = X; then
9646 $cat >try.c <<'EOCP'
9647#include <sys/types.h>
9648#include <stdio.h>
9649int main() {
9650 long double d = 123.456;
9651 printf("%.3Lf\n", d);
9652}
9653EOCP
9654 set try
9655 if eval $compile; then
9656 yyy=`$run ./try`
9657 case "$yyy" in
9658 123.456)
9659 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9660 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9661 echo "We will use %Lf."
9662 ;;
9663 esac
9664 fi
9665fi
9666
9667if $test X"$sPRIfldbl" = X; then
9668 $cat >try.c <<'EOCP'
9669#include <sys/types.h>
9670#include <stdio.h>
9671int main() {
9672 long double d = 123.456;
9673 printf("%.3llf\n", d);
9674}
9675EOCP
9676 set try
9677 if eval $compile; then
9678 yyy=`$run ./try`
9679 case "$yyy" in
9680 123.456)
9681 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9682 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9683 echo "We will use %llf."
9684 ;;
9685 esac
9686 fi
9687fi
9688
9689if $test X"$sPRIfldbl" = X; then
9690 $cat >try.c <<'EOCP'
9691#include <sys/types.h>
9692#include <stdio.h>
9693int main() {
9694 long double d = 123.456;
9695 printf("%.3lf\n", d);
9696}
9697EOCP
9698 set try
9699 if eval $compile; then
9700 yyy=`$run ./try`
9701 case "$yyy" in
9702 123.456)
9703 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9704 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9705 echo "We will use %lf."
9706 ;;
9707 esac
9708 fi
9709fi
9710
9711if $test X"$sPRIfldbl" = X; then
9712 echo "Cannot figure out how to print long doubles." >&4
9713else
9714 sSCNfldbl=$sPRIfldbl # expect consistency
9715fi
9716
5b813a60 9717$rm_try
89ce900e
JH
9718
9719fi # d_longdbl
9720
9721case "$sPRIfldbl" in
5b813a60
MB
9722'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9723 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
89ce900e
JH
9724 d_SCNfldbl="$undef";
9725 ;;
5b813a60
MB
9726*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9727 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
89ce900e
JH
9728 d_SCNfldbl="$define";
9729 ;;
9730esac
9731
b4eb6b3d 9732: Check how to convert floats to strings.
a5b10d80
YST
9733
9734if test "X$d_Gconvert" = X; then
9735
b4eb6b3d
JH
9736echo " "
9737echo "Checking for an efficient way to convert floats to strings."
9738echo " " > try.c
9739case "$uselongdouble" in
9740"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9741esac
9742case "$d_longdbl" in
9743"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9744esac
9745case "$d_PRIgldbl" in
9746"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9747esac
9748$cat >>try.c <<EOP
9749#ifdef TRY_gconvert
9750#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9751char *myname = "gconvert";
9752#endif
9753#ifdef TRY_gcvt
9754#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9755char *myname = "gcvt";
9756#endif
9757#ifdef TRY_qgcvt
9758#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9759char *myname = "qgcvt";
9760#define DOUBLETYPE long double
9761#endif
9762#ifdef TRY_sprintf
a5b10d80
YST
9763#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9764#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9765#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9766#else
a5b10d80
YST
9767#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9768#endif
9769#else
b4eb6b3d
JH
9770#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9771#endif
9772char *myname = "sprintf";
9773#endif
9774
9775#ifndef DOUBLETYPE
9776#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9777#define DOUBLETYPE long double
9778#else
9779#define DOUBLETYPE double
9780#endif
9781#endif
9782
9783#include <stdio.h>
9784
f47f1645 9785#$i_stdlib I_STDLIB
b4eb6b3d
JH
9786#ifdef I_STDLIB
9787#include <stdlib.h>
9788#endif
f47f1645
TC
9789#$i_string I_STRING
9790#ifdef I_STRING
9791# include <string.h>
9792#else
9793# include <strings.h>
9794#endif
b4eb6b3d 9795
f47f1645 9796int checkit(char *expect, char *got)
b4eb6b3d
JH
9797{
9798 if (strcmp(expect, got)) {
9799 printf("%s oddity: Expected %s, got %s\n",
9800 myname, expect, got);
9801 exit(1);
9802 }
9803}
9804
9805int main()
5b813a60
MB
9806{
9807 char buf[64];
b4eb6b3d
JH
9808 buf[63] = '\0';
9809
9810 /* This must be 1st test on (which?) platform */
9811 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9812 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9813 checkit("0.1", buf);
9814
5b813a60 9815 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
a5b10d80
YST
9816 checkit("0.01", buf);
9817
5b813a60 9818 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
a5b10d80
YST
9819 checkit("0.001", buf);
9820
5b813a60 9821 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
a5b10d80
YST
9822 checkit("0.0001", buf);
9823
9824 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9825 if (strlen(buf) > 5)
9826 checkit("9e-005", buf); /* for Microsoft ?? */
9827 else
9828 checkit("9e-05", buf);
9829
5b813a60 9830 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
b4eb6b3d
JH
9831 checkit("1", buf);
9832
5b813a60 9833 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
b4eb6b3d
JH
9834 checkit("1.1", buf);
9835
5b813a60 9836 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
b4eb6b3d
JH
9837 checkit("1.01", buf);
9838
5b813a60 9839 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
b4eb6b3d
JH
9840 checkit("1.001", buf);
9841
5b813a60 9842 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
b4eb6b3d
JH
9843 checkit("1.0001", buf);
9844
5b813a60 9845 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
b4eb6b3d
JH
9846 checkit("1.00001", buf);
9847
5b813a60 9848 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
b4eb6b3d
JH
9849 checkit("1.000001", buf);
9850
5b813a60 9851 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
b4eb6b3d
JH
9852 checkit("0", buf);
9853
5b813a60 9854 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
b4eb6b3d
JH
9855 checkit("-1", buf);
9856
9857 /* Some Linux gcvt's give 1.e+5 here. */
5b813a60 9858 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
b4eb6b3d 9859 checkit("100000", buf);
5b813a60 9860
b4eb6b3d 9861 /* Some Linux gcvt's give -1.e+5 here. */
5b813a60 9862 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
b4eb6b3d
JH
9863 checkit("-100000", buf);
9864
5b813a60 9865 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
b4eb6b3d
JH
9866 checkit("123.456", buf);
9867
ab6ca9f4 9868 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9869 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9870 /* 34 should be enough to scare even long double
9871 * places into using the e notation. */
ab6ca9f4 9872 if (strlen(buf) > 5)
94b339ad 9873 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9874 else
94b339ad 9875 checkit("1e+34", buf);
8e2a5ede 9876
d1eb8299
YST
9877 /* For Perl, if you add additional tests here, also add them to
9878 * t/base/num.t for benefit of platforms not using Configure or
9879 * overriding d_Gconvert */
9880
b4eb6b3d
JH
9881 exit(0);
9882}
9883EOP
ab6ca9f4 9884: first add preferred functions to our list
a5b10d80 9885xxx_list=""
ab6ca9f4 9886for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9887 case $xxx_convert in
9888 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9889 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
5b813a60 9890 esac
a5b10d80
YST
9891done
9892: then add any others
9893for xxx_convert in gconvert gcvt sprintf; do
9894 case "$xxx_list" in
9895 *$xxx_convert*) ;;
9896 *) xxx_list="$xxx_list $xxx_convert" ;;
5b813a60 9897 esac
a5b10d80
YST
9898done
9899
9900case "$d_longdbl$uselongdouble" in
9901"$define$define")
cd95ead5 9902 : again, add preferred functions to our list first
a5b10d80 9903 xxx_ld_list=""
ab6ca9f4 9904 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9905 case $xxx_convert in
9906 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9907 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9908 esac
9909 done
9910 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9911 for xxx_convert in qgcvt sprintf $xxx_list; do
9912 case "$xxx_ld_list" in
9913 $xxx_convert*|*" $xxx_convert"*) ;;
9914 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9915 esac
9916 done
9917 : if sprintf cannot do long doubles, move it to the end
9918 if test "$d_PRIgldbl" != "$define"; then
9919 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9920 fi
9921 : if no qgcvt, remove it
9922 if test "$d_qgcvt" != "$define"; then
9923 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9924 fi
9925 : use the ld_list
9926 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9927 ;;
9928esac
9929
9930for xxx_convert in $xxx_list; do
9931 echo "Trying $xxx_convert..."
93451a0d 9932 $rm -f try try$_o core
b4eb6b3d
JH
9933 set try -DTRY_$xxx_convert
9934 if eval $compile; then
9935 echo "$xxx_convert() found." >&4
5440bc8e 9936 if $run ./try; then
b4eb6b3d
JH
9937 echo "I'll use $xxx_convert to convert floats into a string." >&4
9938 break;
9939 else
9940 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9941 xxx_convert=''
b4eb6b3d
JH
9942 fi
9943 else
9944 echo "$xxx_convert NOT found." >&4
9945 fi
9946done
ab6ca9f4 9947
a5b10d80
YST
9948if test X$xxx_convert = X; then
9949 echo "*** WHOA THERE!!! ***" >&4
9950 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9951 xxx_convert=sprintf
9952fi
9953
b4eb6b3d
JH
9954case "$xxx_convert" in
9955gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9956gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9957qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9958*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9959 "$define$define$define")
9960 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9961 "$define$define$undef")
9962 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9963 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9964 esac
5b813a60 9965 ;;
b4eb6b3d
JH
9966esac
9967
a5b10d80 9968fi
93451a0d 9969$rm_try
a5b10d80 9970
74cac757
JH
9971: see if _fwalk exists
9972set fwalk d__fwalk
9973eval $inlibc
9974
b4eb6b3d
JH
9975: Initialize h_fcntl
9976h_fcntl=false
9977
9978: Initialize h_sysfile
9979h_sysfile=false
9980
9981: access call always available on UNIX
9982set access d_access
9983eval $inlibc
9984
9985: locate the flags for 'access()'
9986case "$d_access" in
9987"$define")
9988 echo " "
55954f19 9989 $cat >access.c <<EOCP
b4eb6b3d
JH
9990#include <sys/types.h>
9991#ifdef I_FCNTL
9992#include <fcntl.h>
9993#endif
9994#ifdef I_SYS_FILE
9995#include <sys/file.h>
9996#endif
9997#ifdef I_UNISTD
9998#include <unistd.h>
9999#endif
55954f19
JH
10000#$i_stdlib I_STDLIB
10001#ifdef I_STDLIB
10002#include <stdlib.h>
10003#endif
b4eb6b3d
JH
10004int main() {
10005 exit(R_OK);
10006}
10007EOCP
10008 : check sys/file.h first, no particular reason here
10009 if $test `./findhdr sys/file.h` && \
7a282f6d 10010 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10011 h_sysfile=true;
10012 echo "<sys/file.h> defines the *_OK access constants." >&4
10013 elif $test `./findhdr fcntl.h` && \
7a282f6d 10014 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10015 h_fcntl=true;
10016 echo "<fcntl.h> defines the *_OK access constants." >&4
10017 elif $test `./findhdr unistd.h` && \
7a282f6d 10018 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
10019 echo "<unistd.h> defines the *_OK access constants." >&4
10020 else
10021 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10022 fi
10023 ;;
10024esac
10025$rm -f access*
10026
10027: see if accessx exists
10028set accessx d_accessx
10029eval $inlibc
10030
89ce900e
JH
10031: see if aintl exists
10032set aintl d_aintl
10033eval $inlibc
10034
b4eb6b3d
JH
10035: see if alarm exists
10036set alarm d_alarm
10037eval $inlibc
10038
96938616
MB
10039: see if 64bit time functions exists
10040
10041set ctime64 d_ctime64
10042eval $inlibc
10043
10044set localtime64 d_localtime64
10045eval $inlibc
10046
10047set gmtime64 d_gmtime64
10048eval $inlibc
10049
10050set mktime64 d_mktime64
10051eval $inlibc
10052
10053set difftime64 d_difftime64
10054eval $inlibc
10055
10056set asctime64 d_asctime64
10057eval $inlibc
10058
a9dade78
JH
10059: see if POSIX threads are available
10060set pthread.h i_pthread
10061eval $inhdr
10062
cd95ead5 10063: define a function to check prototypes
10bc17b6
JH
10064$cat > protochk <<EOSH
10065$startsh
10066cc="$cc"
10067optimize="$optimize"
10068ccflags="$ccflags"
10069prototype="$prototype"
10070define="$define"
c944cfb9 10071rm_try="$rm_try"
a9dade78
JH
10072usethreads=$usethreads
10073i_pthread=$i_pthread
10074pthread_h_first=$pthread_h_first
10bc17b6
JH
10075EOSH
10076
10077$cat >> protochk <<'EOSH'
10078
5b813a60 10079$rm_try
10bc17b6
JH
10080foo="$1"
10081shift
10082while test $# -ge 2; do
10083 case "$1" in
10084 $define) echo "#include <$2>" >> try.c ;;
10085 literal) echo "$2" >> try.c ;;
10086 esac
cce6a207
MB
10087 # Extra magic for the benefit of systems that need pthread.h
10088 # to be included early to correctly detect threadsafe functions.
10089 # Such functions must guarantee themselves, though, that the usethreads
10090 # and i_pthread have been defined, before calling protochk.
10091 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10092 echo "#include <pthread.h>" >> try.c
10093 pthread_h_done=yes
10094 fi
10bc17b6
JH
10095 shift 2
10096done
10097test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
10098cat >> try.c <<'EOCP'
10099#ifdef CAN_PROTOTYPE
10100#define _(args) args
10101#else
10102#define _(args) ()
10103#endif
10104EOCP
10105echo "$foo" >> try.c
10106echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10107$cc $optimize $ccflags -c try.c > /dev/null 2>&1
10108status=$?
5b813a60 10109$rm_try
10bc17b6
JH
10110exit $status
10111EOSH
10112chmod +x protochk
10113$eunicefix protochk
10114
34f1896b 10115: Define hasproto macro for Configure internal use
89ce900e
JH
10116hasproto='varname=$1; func=$2; shift; shift;
10117while $test $# -ge 2; do
10118 case "$1" in
10119 $define) echo "#include <$2>";;
10120 esac ;
10121 shift 2;
10122done > try.c;
10123$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10124if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10125 echo "$func() prototype found.";
10126 val="$define";
10127else
10128 echo "$func() prototype NOT found.";
10129 val="$undef";
10130fi;
10131set $varname;
10132eval $setvar;
5b813a60 10133$rm_try tryout.c'
89ce900e 10134
10bc17b6
JH
10135: see if sys/types.h has to be included
10136set sys/types.h i_systypes
10137eval $inhdr
10138
10139: see if sys/select.h has to be included
10140set sys/select.h i_sysselct
10141eval $inhdr
10142
34f1896b 10143: Define hasfield macro for Configure internal use
10bc17b6
JH
10144hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10145while $test $# -ge 2; do
10146 case "$1" in
10147 $define) echo "#include <$2>";;
10148 esac ;
10149 shift 2;
10150done > try.c;
10151echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10152set try;
10153if eval $compile; then
10154 val="$define";
10155else
10156 val="$undef";
10157fi;
10158set $varname;
10159eval $setvar;
5b813a60 10160$rm_try'
10bc17b6
JH
10161
10162: see if we should include time.h, sys/time.h, or both
10163echo " "
10164if test "X$timeincl" = X; then
10165 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10166 $echo $n "I'm now running the test program...$c"
55954f19 10167 $cat >try.c <<EOCP
10bc17b6
JH
10168#include <sys/types.h>
10169#ifdef I_TIME
10170#include <time.h>
10171#endif
10172#ifdef I_SYSTIME
10173#ifdef SYSTIMEKERNEL
10174#define KERNEL
10175#endif
10176#include <sys/time.h>
10177#endif
10178#ifdef I_SYSSELECT
10179#include <sys/select.h>
10180#endif
55954f19
JH
10181#$i_stdlib I_STDLIB
10182#ifdef I_STDLIB
10183#include <stdlib.h>
10184#endif
10bc17b6
JH
10185int main()
10186{
10187 struct tm foo;
10188#ifdef S_TIMEVAL
10189 struct timeval bar;
10190#endif
10191#ifdef S_TIMEZONE
10192 struct timezone tzp;
10193#endif
10194 if (foo.tm_sec == foo.tm_sec)
10195 exit(0);
10196#ifdef S_TIMEVAL
10197 if (bar.tv_sec == bar.tv_sec)
10198 exit(0);
10199#endif
10200 exit(1);
10201}
10202EOCP
10203 flags=''
10204 for s_timezone in '-DS_TIMEZONE' ''; do
10205 sysselect=''
10206 for s_timeval in '-DS_TIMEVAL' ''; do
10207 for i_systimek in '' '-DSYSTIMEKERNEL'; do
10208 for i_time in '' '-DI_TIME'; do
10209 for i_systime in '-DI_SYSTIME' ''; do
10210 case "$flags" in
10211 '') $echo $n ".$c"
10212 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10213 if eval $compile; then
10214 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10215 shift
10216 flags="$*"
10217 echo " "
10218 $echo $n "Succeeded with $flags$c"
10219 fi
10220 ;;
10221 esac
10222 done
10223 done
10224 done
10225 done
10226 done
10227 timeincl=''
10228 echo " "
10229 case "$flags" in
10230 *SYSTIMEKERNEL*) i_systimek="$define"
10231 timeincl=`./findhdr sys/time.h`
10232 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10233 *) i_systimek="$undef";;
10234 esac
10235 case "$flags" in
10236 *I_TIME*) i_time="$define"
10237 timeincl=`./findhdr time.h`" $timeincl"
10238 echo "We'll include <time.h>." >&4;;
10239 *) i_time="$undef";;
10240 esac
10241 case "$flags" in
10242 *I_SYSTIME*) i_systime="$define"
10243 timeincl=`./findhdr sys/time.h`" $timeincl"
10244 echo "We'll include <sys/time.h>." >&4;;
10245 *) i_systime="$undef";;
10246 esac
5b813a60 10247 $rm_try
10bc17b6
JH
10248fi
10249: see if struct tm knows about tm_zone
10250case "$i_systime$i_time" in
5b813a60 10251*$define*)
10bc17b6
JH
10252 echo " "
10253 echo "Checking to see if your struct tm has tm_zone field..." >&4
10254 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10255 eval $hasfield
10256 ;;
10257*) val="$undef"
10258 set d_tm_tm_zone
10259 eval $setvar
10260 ;;
10261esac
10262case "$d_tm_tm_zone" in
10263"$define") echo "Yes, it does." ;;
10264*) echo "No, it doesn't." ;;
10265esac
10266: see if struct tm knows about tm_gmtoff
10267case "$i_systime$i_time" in
5b813a60 10268*$define*)
10bc17b6
JH
10269 echo " "
10270 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10271 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10272 eval $hasfield
10273 ;;
10274*) val="$undef"
10275 set d_tm_tm_gmtoff
10276 eval $setvar
10277 ;;
10278esac
10279case "$d_tm_tm_gmtoff" in
10280"$define") echo "Yes, it does." ;;
10281*) echo "No, it doesn't." ;;
10282esac
10283
10284: see if asctime_r exists
10285set asctime_r d_asctime_r
10286eval $inlibc
10287case "$d_asctime_r" in
10288"$define")
d63eadf0 10289 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
10290 case "$d_asctime_r_proto:$usethreads" in
10291 ":define") d_asctime_r_proto=define
a48ec845
JH
10292 set d_asctime_r_proto asctime_r $hdrs
10293 eval $hasproto ;;
10294 *) ;;
10295 esac
10296 case "$d_asctime_r_proto" in
10297 define)
10bc17b6
JH
10298 case "$asctime_r_proto" in
10299 ''|0) try='char* asctime_r(const struct tm*, char*);'
61c26d18 10300 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10bc17b6
JH
10301 esac
10302 case "$asctime_r_proto" in
10303 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
61c26d18 10304 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10bc17b6
JH
10305 esac
10306 case "$asctime_r_proto" in
10307 ''|0) try='int asctime_r(const struct tm*, char*);'
61c26d18 10308 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10bc17b6
JH
10309 esac
10310 case "$asctime_r_proto" in
10311 ''|0) try='int asctime_r(const struct tm*, char*, int);'
61c26d18 10312 ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10bc17b6
JH
10313 esac
10314 case "$asctime_r_proto" in
90e831dc 10315 ''|0) d_asctime_r=undef
10bc17b6 10316 asctime_r_proto=0
a48ec845 10317 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10318 * ) case "$asctime_r_proto" in
10319 REENTRANT_PROTO*) ;;
10320 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10321 esac
10322 echo "Prototype: $try" ;;
10323 esac
10324 ;;
c18e646a
JH
10325 *) case "$usethreads" in
10326 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10327 esac
90e831dc
SB
10328 d_asctime_r=undef
10329 asctime_r_proto=0
c18e646a 10330 ;;
a48ec845
JH
10331 esac
10332 ;;
10bc17b6
JH
10333*) asctime_r_proto=0
10334 ;;
10335esac
10336
b4eb6b3d
JH
10337: see if atolf exists
10338set atolf d_atolf
10339eval $inlibc
10340
10341: see if atoll exists
10342set atoll d_atoll
10343eval $inlibc
10344
0dbb1585
AL
10345: Look for GCC-style attribute format
10346case "$d_attribute_format" in
bde30f85 10347'')
b4eb6b3d 10348echo " "
0dbb1585 10349echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10350$cat >attrib.c <<'EOCP'
10351#include <stdio.h>
0dbb1585 10352void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10353EOCP
10354if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10355 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10356 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10357 val="$undef"
10358 else
0dbb1585 10359 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10360 val="$define"
10361 fi
10362else
10363 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10364 val="$undef"
10365fi
bde30f85 10366;;
0dbb1585 10367*) val="$d_attribute_format" ;;
bde30f85 10368esac
0dbb1585
AL
10369set d_attribute_format
10370eval $setvar
10371$rm -f attrib*
10372
dcb594bc
MB
10373: Look for GCC-style attribute format with null format allowed
10374case "$d_printf_format_null" in
10375'') case "$d_attribute_format" in
10376 $define)
10377 echo " "
10378 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10379$cat >attrib.c <<EOCP
10380#include <stdio.h>
10381#$i_stdlib I_STDLIB
10382#ifdef I_STDLIB
10383#include <stdlib.h>
10384#endif
10385int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10386int null_printf (char* pat,...) { return (int)pat; }
10387int main () { exit(null_printf(NULL)); }
10388EOCP
10389 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10390 : run the executable in case it produces a run-time warning
10391 if $run ./attrib >>attrib.out 2>&1; then
10392 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10393 echo "Your C compiler doesn't allow __printf__ format to be null."
10394 val="$undef"
10395 else
10396 echo "Your C compiler allows __printf__ format to be null."
10397 val="$define"
10398 fi
10399 else
10400 echo "Your C compiler executable failed with __printf__ format null."
10401 val="$undef"
10402 fi
10403 else
10404 echo "Your C compiler fails with __printf__ format null."
10405 val="$undef"
10406 fi
10407 ;;
10408 *) val="$undef" ;;
10409 esac
10410;;
10411*) val="$d_printf_format_null" ;;
10412esac
10413set d_printf_format_null
10414eval $setvar
10415$rm -f attrib*
10416
0dbb1585
AL
10417: Look for GCC-style attribute malloc
10418case "$d_attribute_malloc" in
10419'')
10420echo " "
10421echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10422$cat >attrib.c <<'EOCP'
10423#include <stdio.h>
10424char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10425EOCP
10426if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10427 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10428 echo "Your C compiler doesn't support __attribute__((malloc))."
10429 val="$undef"
10430 else
10431 echo "Your C compiler supports __attribute__((malloc))."
10432 val="$define"
10433 fi
10434else
10435 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10436 val="$undef"
10437fi
10438;;
10439*) val="$d_attribute_malloc" ;;
10440esac
10441set d_attribute_malloc
10442eval $setvar
10443$rm -f attrib*
10444
10445: Look for GCC-style attribute nonnull
10446case "$d_attribute_nonnull" in
10447'')
10448echo " "
10449echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10450$cat >attrib.c <<'EOCP'
10451#include <stdio.h>
10452void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10453EOCP
10454if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10455 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10456 echo "Your C compiler doesn't support __attribute__((nonnull))."
10457 val="$undef"
10458 else
10459 echo "Your C compiler supports __attribute__((nonnull))."
10460 val="$define"
10461 fi
10462else
10463 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10464 val="$undef"
10465fi
10466;;
10467*) val="$d_attribute_nonnull" ;;
10468esac
10469set d_attribute_nonnull
10470eval $setvar
10471$rm -f attrib*
10472
10473: Look for GCC-style attribute noreturn
10474case "$d_attribute_noreturn" in
10475'')
10476echo " "
10477echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10478$cat >attrib.c <<'EOCP'
10479#include <stdio.h>
10480void fall_over_dead( void ) __attribute__((noreturn));
10481EOCP
10482if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10483 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10484 echo "Your C compiler doesn't support __attribute__((noreturn))."
10485 val="$undef"
10486 else
10487 echo "Your C compiler supports __attribute__((noreturn))."
10488 val="$define"
10489 fi
10490else
10491 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10492 val="$undef"
10493fi
10494;;
10495*) val="$d_attribute_noreturn" ;;
10496esac
10497set d_attribute_noreturn
10498eval $setvar
10499$rm -f attrib*
10500
10501: Look for GCC-style attribute pure
10502case "$d_attribute_pure" in
10503'')
10504echo " "
10505echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10506$cat >attrib.c <<'EOCP'
10507#include <stdio.h>
10508int square( int n ) __attribute__((pure));
10509EOCP
10510if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10511 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10512 echo "Your C compiler doesn't support __attribute__((pure))."
10513 val="$undef"
10514 else
10515 echo "Your C compiler supports __attribute__((pure))."
10516 val="$define"
10517 fi
10518else
10519 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10520 val="$undef"
10521fi
10522;;
10523*) val="$d_attribute_pure" ;;
10524esac
10525set d_attribute_pure
10526eval $setvar
10527$rm -f attrib*
10528
10529: Look for GCC-style attribute unused
10530case "$d_attribute_unused" in
10531'')
10532echo " "
10533echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10534$cat >attrib.c <<'EOCP'
10535#include <stdio.h>
10536int do_something( int dummy __attribute__((unused)), int n );
10537EOCP
10538if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10539 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10540 echo "Your C compiler doesn't support __attribute__((unused))."
10541 val="$undef"
10542 else
10543 echo "Your C compiler supports __attribute__((unused))."
10544 val="$define"
10545 fi
10546else
10547 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10548 val="$undef"
10549fi
10550;;
10551*) val="$d_attribute_unused" ;;
10552esac
10553set d_attribute_unused
10554eval $setvar
10555$rm -f attrib*
10556
fcdf39cf
RGS
10557: Look for GCC-style attribute deprecated
10558case "$d_attribute_deprecated" in
10559'')
10560echo " "
10561echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10562$cat >attrib.c <<'EOCP'
10563#include <stdio.h>
10564int I_am_deprecated(void) __attribute__((deprecated));
10565EOCP
10566if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10567 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10568 echo "Your C compiler doesn't support __attribute__((deprecated))."
10569 val="$undef"
10570 else
10571 echo "Your C compiler supports __attribute__((deprecated))."
10572 val="$define"
10573 fi
10574else
10575 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10576 val="$undef"
10577fi
10578;;
10579*) val="$d_attribute_deprecated" ;;
10580esac
10581set d_attribute_deprecated
10582eval $setvar
10583$rm -f attrib*
10584
0dbb1585
AL
10585: Look for GCC-style attribute warn_unused_result
10586case "$d_attribute_warn_unused_result" in
10587'')
10588echo " "
10589echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10590$cat >attrib.c <<'EOCP'
10591#include <stdio.h>
10592int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10593EOCP
10594if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10595 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10596 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10597 val="$undef"
10598 else
10599 echo "Your C compiler supports __attribute__((warn_unused_result))."
10600 val="$define"
10601 fi
10602else
10603 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10604 val="$undef"
10605fi
10606;;
10607*) val="$d_attribute_warn_unused_result" ;;
10608esac
10609set d_attribute_warn_unused_result
b4eb6b3d
JH
10610eval $setvar
10611$rm -f attrib*
10612
10613: see if bcmp exists
10614set bcmp d_bcmp
10615eval $inlibc
10616
10617: see if bcopy exists
10618set bcopy d_bcopy
10619eval $inlibc
10620
b4eb6b3d
JH
10621: see if getpgrp exists
10622set getpgrp d_getpgrp
10623eval $inlibc
10624
10625case "$d_getpgrp" in
10626"$define")
10627 echo " "
10628 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10629 $cat >try.c <<EOP
b4eb6b3d
JH
10630#$i_unistd I_UNISTD
10631#include <sys/types.h>
10632#ifdef I_UNISTD
10633# include <unistd.h>
10634#endif
55954f19
JH
10635#$i_stdlib I_STDLIB
10636#ifdef I_STDLIB
10637#include <stdlib.h>
10638#endif
b4eb6b3d
JH
10639int main()
10640{
10641 if (getuid() == 0) {
10642 printf("(I see you are running Configure as super-user...)\n");
10643 setuid(1);
10644 }
10645#ifdef TRY_BSD_PGRP
10646 if (getpgrp(1) == 0)
10647 exit(0);
10648#else
10649 if (getpgrp() > 0)
10650 exit(0);
10651#endif
10652 exit(1);
10653}
10654EOP
5440bc8e 10655 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10656 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10657 val="$define"
5440bc8e 10658 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10659 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10660 val="$undef"
10661 else
10662 echo "I can't seem to compile and run the test program."
10663 if ./usg; then
10664 xxx="a USG one, i.e. you use getpgrp()."
10665 else
10666 # SVR4 systems can appear rather BSD-ish.
10667 case "$i_unistd" in
10668 $undef)
10669 xxx="a BSD one, i.e. you use getpgrp(pid)."
10670 val="$define"
10671 ;;
10672 $define)
10673 xxx="probably a USG one, i.e. you use getpgrp()."
10674 val="$undef"
10675 ;;
10676 esac
10677 fi
10678 echo "Assuming your getpgrp is $xxx" >&4
10679 fi
10680 ;;
10681*) val="$undef";;
10682esac
10683set d_bsdgetpgrp
10684eval $setvar
5b813a60 10685$rm_try
b4eb6b3d
JH
10686
10687: see if setpgrp exists
10688set setpgrp d_setpgrp
10689eval $inlibc
10690
10691case "$d_setpgrp" in
10692"$define")
10693 echo " "
10694 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10695 $cat >try.c <<EOP
b4eb6b3d
JH
10696#$i_unistd I_UNISTD
10697#include <sys/types.h>
10698#ifdef I_UNISTD
10699# include <unistd.h>
10700#endif
55954f19
JH
10701#$i_stdlib I_STDLIB
10702#ifdef I_STDLIB
10703#include <stdlib.h>
10704#endif
b4eb6b3d
JH
10705int main()
10706{
10707 if (getuid() == 0) {
10708 printf("(I see you are running Configure as super-user...)\n");
10709 setuid(1);
10710 }
10711#ifdef TRY_BSD_PGRP
10712 if (-1 == setpgrp(1, 1))
10713 exit(0);
10714#else
10715 if (setpgrp() != -1)
10716 exit(0);
10717#endif
10718 exit(1);
10719}
10720EOP
5440bc8e 10721 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10722 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10723 val="$define"
5440bc8e 10724 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10725 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10726 val="$undef"
10727 else
10728 echo "(I can't seem to compile and run the test program.)"
10729 if ./usg; then
10730 xxx="a USG one, i.e. you use setpgrp()."
10731 else
10732 # SVR4 systems can appear rather BSD-ish.
10733 case "$i_unistd" in
10734 $undef)
10735 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10736 val="$define"
10737 ;;
10738 $define)
10739 xxx="probably a USG one, i.e. you use setpgrp()."
10740 val="$undef"
10741 ;;
10742 esac
10743 fi
10744 echo "Assuming your setpgrp is $xxx" >&4
10745 fi
10746 ;;
10747*) val="$undef";;
10748esac
10749set d_bsdsetpgrp
10750eval $setvar
5b813a60
MB
10751$rm_try
10752
635aebb7
AL
10753: Look for GCC-style __builtin_choose_expr
10754case "$d_builtin_choose_expr" in
10755'')
10756 echo " "
10757 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10758 $cat >try.c <<'EOCP'
10759#include <assert.h>
10760#include <stdlib.h>
10761#include <stdio.h>
10762
10763#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10764
10765int main(void) {
10766 assert( SYRINX(1) == 2112 );
10767 assert( SYRINX(1) != 5150 );
10768 assert( SYRINX(0) == 5150 );
10769 assert( SYRINX(0) != 2112 );
10770 puts( "All good!" );
10771 exit(0);
10772}
10773
10774EOCP
10775 set try
70ceb34a 10776 if eval $compile && $run ./try; then
635aebb7
AL
10777 echo "Your C compiler supports __builtin_choose_expr."
10778 val="$define"
10779 else
10780 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10781 val="$undef"
10782 fi
10783;;
10784*) val="$d_builtin_choose_expr" ;;
10785esac
10786
10787set d_builtin_choose_expr
10788eval $setvar
5b813a60 10789$rm_try
635aebb7
AL
10790
10791: Look for GCC-style __builtin_expect
10792case "$d_builtin_expect" in
10793'')
10794 echo " "
10795 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
70ceb34a 10796 $cat >try.c <<'EOCP'
635aebb7
AL
10797int main(void) {
10798 int n = 50;
10799 if ( __builtin_expect(n, 0) ) n = 1;
70ceb34a
NC
10800 /* Remember shell exit code truth is 0, C truth is non-zero */
10801 return !(n == 1);
635aebb7
AL
10802}
10803EOCP
10804 set try
70ceb34a
NC
10805 if eval $compile && $run ./try; then
10806 echo "Your C compiler supports __builtin_expect."
635aebb7
AL
10807 val="$define"
10808 else
70ceb34a 10809 echo "Your C compiler doesn't seem to understand __builtin_expect."
635aebb7
AL
10810 val="$undef"
10811 fi
10812 ;;
10813*) val="$d_builtin_expect" ;;
10814esac
10815
10816set d_builtin_expect
10817eval $setvar
5b813a60 10818$rm_try
635aebb7 10819
b4eb6b3d
JH
10820: see if bzero exists
10821set bzero d_bzero
10822eval $inlibc
10823
a2d23ec2
MB
10824: see if stdarg is available
10825echo " "
10826if $test `./findhdr stdarg.h`; then
10827 echo "<stdarg.h> found." >&4
10828 valstd="$define"
10829else
10830 echo "<stdarg.h> NOT found." >&4
10831 valstd="$undef"
10832fi
10833
10834: see if varags is available
10835echo " "
10836if $test `./findhdr varargs.h`; then
10837 echo "<varargs.h> found." >&4
10838else
10839 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10840fi
10841
10842: set up the varargs testing programs
10843$cat > varargs.c <<EOP
10844#ifdef I_STDARG
10845#include <stdarg.h>
10846#endif
10847#ifdef I_VARARGS
10848#include <varargs.h>
10849#endif
10850
10851#ifdef I_STDARG
10852int f(char *p, ...)
10853#else
10854int f(va_alist)
10855va_dcl
10856#endif
10857{
10858 va_list ap;
10859#ifndef I_STDARG
10860 char *p;
10861#endif
10862#ifdef I_STDARG
10863 va_start(ap,p);
10864#else
10865 va_start(ap);
10866 p = va_arg(ap, char *);
10867#endif
10868 va_end(ap);
4fb7dc7d 10869 return 0;
a2d23ec2
MB
10870}
10871EOP
10872$cat > varargs <<EOP
10873$startsh
10874if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10875 echo "true"
10876else
10877 echo "false"
10878fi
10879$rm -f varargs$_o
10880EOP
10881chmod +x varargs
10882
10883: now check which varargs header should be included
10884echo " "
10885i_varhdr=''
282b912e 10886val=''
a2d23ec2
MB
10887case "$valstd" in
10888"$define")
10889 if `./varargs I_STDARG`; then
10890 val='stdarg.h'
10891 elif `./varargs I_VARARGS`; then
10892 val='varargs.h'
10893 fi
10894 ;;
10895*)
10896 if `./varargs I_VARARGS`; then
10897 val='varargs.h'
10898 fi
10899 ;;
10900esac
10901case "$val" in
10902'')
b95f969b
AC
10903 echo " "
10904 echo "*** WHOA THERE!!! ***" >&4
10905 echo " Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
10906 case "$knowitall" in
10907 '')
10908 echo " I'm giving up; maybe you can try again with a different compiler?" >&4
10909 exit 1
10910 ;;
10911 esac
a2d23ec2
MB
10912echo "I could not find the definition for va_dcl... You have problems..." >&4
10913 val="$undef"; set i_stdarg; eval $setvar
10914 val="$undef"; set i_varargs; eval $setvar
10915 ;;
613d6c3e 10916*)
a2d23ec2
MB
10917 set i_varhdr
10918 eval $setvar
10919 case "$i_varhdr" in
10920 stdarg.h)
10921 val="$define"; set i_stdarg; eval $setvar
10922 val="$undef"; set i_varargs; eval $setvar
10923 ;;
10924 varargs.h)
10925 val="$undef"; set i_stdarg; eval $setvar
10926 val="$define"; set i_varargs; eval $setvar
10927 ;;
10928 esac
10929 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10930esac
10931$rm -f varargs*
10932
10933: see if the Compiler supports C99 variadic macros
10934case "$i_stdarg$i_stdlib" in
10935 "$define$define")
10936 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10937 $cat >try.c <<EOCP
10938#include <stdio.h>
10939#include <stdarg.h>
10940
10941#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10942
10943int main() {
10944 char buf[20];
10945 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10946 puts(buf);
10947 return 0;
10948}
10949EOCP
10950 set try
10951 if eval $compile && $run ./try 2>&1 >/dev/null; then
10952 case "`$run ./try`" in
10953 "123 456 789")
10954 echo "You have C99 variadic macros." >&4
10955 d_c99_variadic_macros="$define"
10956 ;;
10957 *)
10958 echo "You don't have functional C99 variadic macros." >&4
10959 d_c99_variadic_macros="$undef"
10960 ;;
10961 esac
10962 else
10963 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10964 d_c99_variadic_macros="$undef"
10965 fi
5b813a60 10966 $rm_try
a2d23ec2
MB
10967 ;;
10968 *)
10969 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10970 d_c99_variadic_macros="$undef"
10971 ;;
10972esac
10973
b4eb6b3d
JH
10974: see if signal is declared as pointer to function returning int or void
10975echo " "
10976xxx=`./findhdr signal.h`
10977$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10978if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10979 echo "You have int (*signal())() instead of void." >&4
10980 val="$undef"
10981elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10982 echo "You have void (*signal())()." >&4
10983 val="$define"
10984elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10985 echo "You have int (*signal())() instead of void." >&4
10986 val="$undef"
10987elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10988 echo "You have void (*signal())()." >&4
10989 val="$define"
10990else
10991 case "$d_voidsig" in
10992 '')
10993 echo "I can't determine whether signal handler returns void or int..." >&4
10994 dflt=void
10995 rp="What type does your signal handler return?"
10996 . ./myread
10997 case "$ans" in
10998 v*) val="$define";;
10999 *) val="$undef";;
11000 esac;;
11001 "$define")
11002 echo "As you already told me, signal handler returns void." >&4
11003 val="$define"
11004 ;;
11005 *) echo "As you already told me, signal handler returns int." >&4
11006 val="$undef"
11007 ;;
11008 esac
11009fi
11010set d_voidsig
11011eval $setvar
11012case "$d_voidsig" in
11013"$define") signal_t="void";;
11014*) signal_t="int";;
11015esac
11016$rm -f $$.tmp
11017
11018: check for ability to cast large floats to 32-bit ints.
11019echo " "
11020echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11021if $test "$intsize" -ge 4; then
11022 xxx=int
11023else
11024 xxx=long
11025fi
11026$cat >try.c <<EOCP
11027#include <stdio.h>
d1daaddf
JH
11028#$i_stdlib I_STDLIB
11029#ifdef I_STDLIB
11030#include <stdlib.h>
11031#endif
b4eb6b3d
JH
11032#include <sys/types.h>
11033#include <signal.h>
7090f861 11034$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
11035int main()
11036{
11037 $xxx i32;
11038 double f, g;
11039 int result = 0;
11040 char str[16];
11041 signal(SIGFPE, blech);
11042
5b813a60 11043 /* Don't let compiler optimize the test away. Store the number
e237eb00 11044 in a writable string for gcc to pass to sscanf under HP-UX.
b4eb6b3d
JH
11045 */
11046 sprintf(str, "2147483647");
11047 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11048 g = 10 * f;
11049 i32 = ($xxx) g;
11050
11051 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 11052 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
11053 behavior here, which is to preserve the sign and give
11054 back 0x7fff ffff.
11055 */
11056 if (i32 != ($xxx) f)
11057 result |= 1;
11058 exit(result);
11059}
11060EOCP
11061set try
11062if eval $compile_ok; then
5440bc8e 11063 $run ./try
b4eb6b3d
JH
11064 yyy=$?
11065else
11066 echo "(I can't seem to compile the test program--assuming it can't)"
11067 yyy=1
11068fi
11069case "$yyy" in
110700) val="$define"
11071 echo "Yup, it can."
11072 ;;
11073*) val="$undef"
11074 echo "Nope, it can't."
11075 ;;
11076esac
11077set d_casti32
11078eval $setvar
5b813a60 11079$rm_try
b4eb6b3d
JH
11080
11081: check for ability to cast negative floats to unsigned
11082echo " "
11083echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11084$cat >try.c <<EOCP
11085#include <stdio.h>
d1daaddf
JH
11086#$i_stdlib I_STDLIB
11087#ifdef I_STDLIB
11088#include <stdlib.h>
11089#endif
b4eb6b3d
JH
11090#include <sys/types.h>
11091#include <signal.h>
7090f861
JH
11092$signal_t blech(int s) { exit(7); }
11093$signal_t blech_in_list(int s) { exit(4); }
11094unsigned long dummy_long(unsigned long p) { return p; }
11095unsigned int dummy_int(unsigned int p) { return p; }
11096unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
11097int main()
11098{
11099 double f;
11100 unsigned long along;
11101 unsigned int aint;
11102 unsigned short ashort;
11103 int result = 0;
11104 char str[16];
5b813a60 11105
b4eb6b3d
JH
11106 /* Frustrate gcc-2.7.2's optimizer which failed this test with
11107 a direct f = -123. assignment. gcc-2.8.0 reportedly
11108 optimized the whole file away
11109 */
5b813a60 11110 /* Store the number in a writable string for gcc to pass to
e237eb00 11111 sscanf under HP-UX.
b4eb6b3d
JH
11112 */
11113 sprintf(str, "-123");
11114 sscanf(str, "%lf", &f); /* f = -123.; */
11115
11116 signal(SIGFPE, blech);
11117 along = (unsigned long)f;
11118 aint = (unsigned int)f;
11119 ashort = (unsigned short)f;
11120 if (along != (unsigned long)-123)
11121 result |= 1;
11122 if (aint != (unsigned int)-123)
11123 result |= 1;
11124 if (ashort != (unsigned short)-123)
11125 result |= 1;
11126 sprintf(str, "1073741824.");
11127 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11128 f = f + f;
11129 along = 0;
11130 along = (unsigned long)f;
11131 if (along != 0x80000000)
11132 result |= 2;
11133 f -= 1.;
11134 along = 0;
11135 along = (unsigned long)f;
11136 if (along != 0x7fffffff)
11137 result |= 1;
11138 f += 2.;
11139 along = 0;
11140 along = (unsigned long)f;
11141 if (along != 0x80000001)
11142 result |= 2;
11143 if (result)
11144 exit(result);
11145 signal(SIGFPE, blech_in_list);
11146 sprintf(str, "123.");
11147 sscanf(str, "%lf", &f); /* f = 123.; */
11148 along = dummy_long((unsigned long)f);
11149 aint = dummy_int((unsigned int)f);
11150 ashort = dummy_short((unsigned short)f);
11151 if (along != (unsigned long)123)
11152 result |= 4;
11153 if (aint != (unsigned int)123)
11154 result |= 4;
11155 if (ashort != (unsigned short)123)
11156 result |= 4;
11157 exit(result);
11158
11159}
11160EOCP
11161set try
11162if eval $compile_ok; then
5440bc8e 11163 $run ./try
b4eb6b3d
JH
11164 castflags=$?
11165else
11166 echo "(I can't seem to compile the test program--assuming it can't)"
11167 castflags=7
11168fi
11169case "$castflags" in
111700) val="$define"
11171 echo "Yup, it can."
11172 ;;
11173*) val="$undef"
11174 echo "Nope, it can't."
11175 ;;
11176esac
11177set d_castneg
11178eval $setvar
5b813a60 11179$rm_try
b4eb6b3d
JH
11180
11181: see if vprintf exists
11182echo " "
11183if set vprintf val -f d_vprintf; eval $csym; $val; then
11184 echo 'vprintf() found.' >&4
11185 val="$define"
55954f19 11186 $cat >try.c <<EOF
d0bc9cc8
AD
11187#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
11188#$i_varargs I_VARARGS
11189
55954f19 11190#$i_stdlib I_STDLIB
d0bc9cc8
AD
11191#$i_unistd I_UNISTD
11192
11193#ifdef I_STDARG
11194# include <stdarg.h>
11195#else /* I_VARARGS */
11196# include <varargs.h>
11197#endif
11198
11199#ifdef I_UNISTD
11200# include <unistd.h>
11201#endif
11202
55954f19 11203#ifdef I_STDLIB
d0bc9cc8 11204# include <stdlib.h>
55954f19 11205#endif
b4eb6b3d 11206
d0bc9cc8
AD
11207#include <stdio.h> /* vsprintf prototype */
11208
11209#ifdef I_STDARG
11210void xxx(int n, ...)
11211{
11212 va_list args;
11213 char buf[10];
11214 va_start(args, n);
11215 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11216}
11217int main() { xxx(1, "foo"); }
11218
11219#else /* I_VARARGS */
b4eb6b3d
JH
11220
11221xxx(va_alist)
11222va_dcl
11223{
d0bc9cc8
AD
11224 va_list args;
11225 char buf[10];
11226 va_start(args);
11227 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
b4eb6b3d 11228}
d0bc9cc8
AD
11229int main() { xxx("foo"); }
11230
11231#endif
11232
b4eb6b3d 11233EOF
5440bc8e 11234 set try
d0bc9cc8
AD
11235 if eval $compile_ok; then
11236 if $run ./try; then
11237 echo "Your vsprintf() returns (int)." >&4
11238 val2="$undef"
11239 else
11240 echo "Your vsprintf() returns (char*)." >&4
11241 val2="$define"
11242 fi
b4eb6b3d 11243 else
d0bc9cc8
AD
11244 echo 'I am unable to compile the vsprintf() test program.' >&4
11245 # We shouldn't get here. If we do, assume the standard signature,
11246 # not the old BSD one.
11247 echo 'Guessing that vsprintf() returns (int).' >&4
11248 val2="$undef"
b4eb6b3d
JH
11249 fi
11250else
11251 echo 'vprintf() NOT found.' >&4
d0bc9cc8
AD
11252 val="$undef"
11253 val2="$undef"
b4eb6b3d 11254fi
5b813a60 11255$rm_try
b4eb6b3d
JH
11256set d_vprintf
11257eval $setvar
11258val=$val2
11259set d_charvspr
11260eval $setvar
11261
11262: see if chown exists
11263set chown d_chown
11264eval $inlibc
11265
11266: see if chroot exists
11267set chroot d_chroot
11268eval $inlibc
11269
11270: see if chsize exists
11271set chsize d_chsize
11272eval $inlibc
11273
758a5d79
JH
11274: see if class exists
11275set class d_class
11276eval $inlibc
11277
b0a2e8e6
MB
11278: see if clearenv exists
11279set clearenv d_clearenv
11280eval $inlibc
11281
34f1896b 11282: Define hasstruct macro for Configure internal use
4e0554ec
JH
11283hasstruct='varname=$1; struct=$2; shift; shift;
11284while $test $# -ge 2; do
11285 case "$1" in
11286 $define) echo "#include <$2>";;
11287 esac ;
11288 shift 2;
11289done > try.c;
11290echo "int main () { struct $struct foo; }" >> try.c;
11291set try;
11292if eval $compile; then
11293 val="$define";
11294else
11295 val="$undef";
11296fi;
11297set $varname;
11298eval $setvar;
5b813a60 11299$rm_try'
4e0554ec 11300
34f1896b 11301: see whether socket exists
4e0554ec
JH
11302socketlib=''
11303sockethdr=''
4e0554ec
JH
11304echo " "
11305$echo $n "Hmm... $c" >&4
11306if set socket val -f d_socket; eval $csym; $val; then
11307 echo "Looks like you have Berkeley networking support." >&4
11308 d_socket="$define"
11309 if set setsockopt val -f; eval $csym; $val; then
11310 d_oldsock="$undef"
11311 else
11312 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11313 d_oldsock="$define"
11314 fi
11315else
11316 if $contains socklib libc.list >/dev/null 2>&1; then
11317 echo "Looks like you have Berkeley networking support." >&4
11318 d_socket="$define"
11319 : we will have to assume that it supports the 4.2 BSD interface
11320 d_oldsock="$undef"
11321 else
11322 echo "You don't have Berkeley networking in libc$_a..." >&4
11323 if test "X$d_socket" = "X$define"; then
11324 echo "...but you seem to believe that you have sockets." >&4
11325 else
11326 for net in net socket
11327 do
11328 if test -f /usr/lib/lib$net$_a; then
11329 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
11330 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11331 if $contains socket libc.list >/dev/null 2>&1; then
11332 d_socket="$define"
11333 socketlib="-l$net"
11334 case "$net" in
11335 net)
11336 echo "...but the Wollongong group seems to have hacked it in." >&4
11337 sockethdr="-I/usr/netinclude"
11338 ;;
11339 esac
5b813a60 11340 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
11341 if $contains setsockopt libc.list >/dev/null 2>&1; then
11342 d_oldsock="$undef"
11343 else
11344 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11345 d_oldsock="$define"
11346 fi
11347 break
11348 fi
11349 fi
11350 done
11351 if test "X$d_socket" != "X$define"; then
11352 echo "or anywhere else I see." >&4
11353 d_socket="$undef"
11354 d_oldsock="$undef"
11355 fi
11356 fi
11357 fi
11358fi
11359
11360: see if socketpair exists
11361set socketpair d_sockpair
11362eval $inlibc
11363
11364
11365echo " "
b8677e3b
MB
11366echo "Checking the availability sa_len in the sock struct ..." >&4
11367$cat >try.c <<EOF
11368#include <sys/types.h>
11369#include <sys/socket.h>
11370int main() {
11371struct sockaddr sa;
11372return (sa.sa_len);
11373}
11374EOF
11375val="$undef"
11376set try; if eval $compile; then
11377 val="$define"
11378fi
11379set d_sockaddr_sa_len; eval $setvar
11380$rm_try
11381
11382echo " "
18126d98
MB
11383echo "Checking the availability struct sockaddr_in6 ..." >&4
11384$cat >try.c <<EOF
11385#include <sys/types.h>
11386#include <sys/socket.h>
11387#include <netinet/in.h>
11388int main() {
11389struct sockaddr_in6 sin6;
11390return (sin6.sin6_family);
11391}
11392EOF
11393val="$undef"
11394set try; if eval $compile; then
11395 val="$define"
11396fi
11397set d_sockaddr_in6; eval $setvar
11398$rm_try
11399
11400echo " "
f53580fe
MB
11401echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11402$cat >try.c <<EOF
11403#include <sys/types.h>
11404#include <sys/socket.h>
11405#include <netinet/in.h>
11406int main() {
11407struct sockaddr_in6 sin6;
11408return (sin6.sin6_scope_id);
11409}
11410EOF
11411val="$undef"
11412set try; if eval $compile; then
11413 val="$define"
11414fi
11415set d_sin6_scope_id; eval $setvar
11416$rm_try
11417
11418echo " "
122b9bf4
MB
11419echo "Checking the availability struct ip_mreq ..." >&4
11420$cat >try.c <<EOF
11421#include <sys/types.h>
11422#include <sys/socket.h>
11423#include <netinet/in.h>
11424int main() {
11425struct ip_mreq mreq;
11426return (mreq.imr_multiaddr.s_addr);
11427}
11428EOF
11429val="$undef"
11430set try; if eval $compile; then
11431 val="$define"
11432fi
11433set d_ip_mreq; eval $setvar
11434$rm_try
11435
11436echo " "
3e06601f
MB
11437echo "Checking the availability struct ip_mreq_source ..." >&4
11438$cat >try.c <<EOF
11439#include <sys/types.h>
11440#include <sys/socket.h>
11441#include <netinet/in.h>
11442int main() {
11443struct ip_mreq_source mreq;
11444return (mreq.imr_multiaddr.s_addr);
11445}
11446EOF
11447val="$undef"
11448set try; if eval $compile; then
11449 val="$define"
11450fi
11451set d_ip_mreq_source; eval $setvar
11452$rm_try
11453
11454echo " "
18126d98
MB
11455echo "Checking the availability struct ipv6_mreq ..." >&4
11456$cat >try.c <<EOF
11457#include <sys/types.h>
11458#include <sys/socket.h>
11459#include <netinet/in.h>
11460int main() {
11461struct ipv6_mreq mreq;
11462return (mreq.ipv6mr_interface);
11463}
11464EOF
11465val="$undef"
11466set try; if eval $compile; then
11467 val="$define"
11468fi
11469set d_ipv6_mreq; eval $setvar
11470$rm_try
11471
11472echo " "
3e06601f
MB
11473echo "Checking the availability struct ipv6_mreq_source ..." >&4
11474$cat >try.c <<EOF
11475#include <sys/types.h>
11476#include <sys/socket.h>
11477#include <netinet/in.h>
11478int main() {
11479struct ipv6_mreq_source mreq;
11480return (mreq.imr_multiaddr.s_addr);
11481}
11482EOF
11483val="$undef"
11484set try; if eval $compile; then
11485 val="$define"
11486fi
11487set d_ipv6_mreq_source; eval $setvar
11488$rm_try
11489
11490echo " "
3c728e00 11491echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
11492for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11493 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11494 $cat >try.c <<EOF
11495#include <sys/types.h>
11496#include <sys/socket.h>
11497int main() {
11498 int i = $ENUM;
11499}
11500EOF
11501 val="$undef"
11502 set try; if eval $compile; then
11503 val="$define"
11504 fi
11505 set d_${enum}; eval $setvar
5b813a60 11506 $rm_try
4e0554ec
JH
11507done
11508
11509: see if this is a sys/uio.h system
11510set sys/uio.h i_sysuio
11511eval $inhdr
11512
34f1896b 11513: Check for cmsghdr support
4e0554ec
JH
11514echo " "
11515echo "Checking to see if your system supports struct cmsghdr..." >&4
11516set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11517eval $hasstruct
11518case "$d_cmsghdr_s" in
11519"$define") echo "Yes, it does." ;;
11520*) echo "No, it doesn't." ;;
11521esac
11522
11523
b4eb6b3d
JH
11524: check for const keyword
11525echo " "
11526echo 'Checking to see if your C compiler knows about "const"...' >&4
11527$cat >const.c <<'EOCP'
11528typedef struct spug { int drokk; } spug;
76f47787 11529int main()
b4eb6b3d
JH
11530{
11531 const char *foo;
666ea192 11532 const spug y = { 0 };
b4eb6b3d
JH
11533}
11534EOCP
11535if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11536 val="$define"
11537 echo "Yup, it does."
11538else
11539 val="$undef"
11540 echo "Nope, it doesn't."
11541fi
11542set d_const
11543eval $setvar
11544
89ce900e
JH
11545: see if copysignl exists
11546set copysignl d_copysignl
11547eval $inlibc
11548
b4eb6b3d
JH
11549: see if crypt exists
11550echo " "
a5a94ea5
JH
11551set crypt d_crypt
11552eval $inlibc
11553case "$d_crypt" in
11554$define) cryptlib='' ;;
11555*) if set crypt val -f d_crypt; eval $csym; $val; then
11556 echo 'crypt() found.' >&4
b4eb6b3d 11557 val="$define"
a5a94ea5
JH
11558 cryptlib=''
11559 else
11560 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11561 if $test -z "$cryptlib"; then
11562 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11563 else
11564 cryptlib=-lcrypt
11565 fi
11566 if $test -z "$cryptlib"; then
11567 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11568 else
11569 cryptlib=-lcrypt
11570 fi
11571 if $test -z "$cryptlib"; then
11572 cryptlib=`./loc libcrypt$_a "" $libpth`
11573 else
11574 cryptlib=-lcrypt
11575 fi
11576 if $test -z "$cryptlib"; then
11577 echo 'crypt() NOT found.' >&4
11578 val="$undef"
11579 else
11580 val="$define"
11581 fi
b4eb6b3d 11582 fi
a5a94ea5
JH
11583 set d_crypt
11584 eval $setvar
11585 ;;
11586esac
b4eb6b3d 11587
10bc17b6
JH
11588: see if this is a crypt.h system
11589set crypt.h i_crypt
11590eval $inhdr
11591
11592: see if crypt_r exists
11593set crypt_r d_crypt_r
11594eval $inlibc
11595case "$d_crypt_r" in
11596"$define")
11597 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11598 case "$d_crypt_r_proto:$usethreads" in
11599 ":define") d_crypt_r_proto=define
a48ec845
JH
11600 set d_crypt_r_proto crypt_r $hdrs
11601 eval $hasproto ;;
11602 *) ;;
11603 esac
11604 case "$d_crypt_r_proto" in
11605 define)
10bc17b6
JH
11606 case "$crypt_r_proto" in
11607 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
61c26d18 11608 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
10bc17b6
JH
11609 esac
11610 case "$crypt_r_proto" in
b430fd04 11611 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
61c26d18 11612 ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
b430fd04
JH
11613 esac
11614 case "$crypt_r_proto" in
90e831dc 11615 ''|0) d_crypt_r=undef
10bc17b6 11616 crypt_r_proto=0
a48ec845 11617 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11618 * ) case "$crypt_r_proto" in
11619 REENTRANT_PROTO*) ;;
11620 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11621 esac
11622 echo "Prototype: $try" ;;
11623 esac
11624 ;;
c18e646a
JH
11625 *) case "$usethreads" in
11626 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11627 esac
90e831dc
SB
11628 d_crypt_r=undef
11629 crypt_r_proto=0
c18e646a 11630 ;;
a48ec845
JH
11631 esac
11632 ;;
10bc17b6
JH
11633*) crypt_r_proto=0
11634 ;;
11635esac
11636
b4eb6b3d
JH
11637: get csh whereabouts
11638case "$csh" in
11639'csh') val="$undef" ;;
11640*) val="$define" ;;
11641esac
11642set d_csh
11643eval $setvar
11644: Respect a hint or command line value for full_csh.
11645case "$full_csh" in
11646'') full_csh=$csh ;;
11647esac
11648
13cfc98d
MB
11649: see if ctermid exists
11650set ctermid d_ctermid
11651eval $inlibc
11652
10bc17b6
JH
11653: see if ctermid_r exists
11654set ctermid_r d_ctermid_r
11655eval $inlibc
11656case "$d_ctermid_r" in
11657"$define")
31ee0cb7 11658 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11659 case "$d_ctermid_r_proto:$usethreads" in
11660 ":define") d_ctermid_r_proto=define
a48ec845
JH
11661 set d_ctermid_r_proto ctermid_r $hdrs
11662 eval $hasproto ;;
11663 *) ;;
11664 esac
11665 case "$d_ctermid_r_proto" in
11666 define)
10bc17b6
JH
11667 case "$ctermid_r_proto" in
11668 ''|0) try='char* ctermid_r(char*);'
61c26d18 11669 ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
10bc17b6
JH
11670 esac
11671 case "$ctermid_r_proto" in
90e831dc 11672 ''|0) d_ctermid_r=undef
10bc17b6 11673 ctermid_r_proto=0
a48ec845 11674 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11675 * ) case "$ctermid_r_proto" in
11676 REENTRANT_PROTO*) ;;
11677 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11678 esac
11679 echo "Prototype: $try" ;;
11680 esac
11681 ;;
c18e646a
JH
11682 *) case "$usethreads" in
11683 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11684 esac
90e831dc
SB
11685 d_ctermid_r=undef
11686 ctermid_r_proto=0
c18e646a 11687 ;;
a48ec845
JH
11688 esac
11689 ;;
10bc17b6
JH
11690*) ctermid_r_proto=0
11691 ;;
11692esac
11693
11694: see if ctime_r exists
11695set ctime_r d_ctime_r
11696eval $inlibc
11697case "$d_ctime_r" in
11698"$define")
d63eadf0 11699 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11700 case "$d_ctime_r_proto:$usethreads" in
11701 ":define") d_ctime_r_proto=define
a48ec845
JH
11702 set d_ctime_r_proto ctime_r $hdrs
11703 eval $hasproto ;;
11704 *) ;;
11705 esac
11706 case "$d_ctime_r_proto" in
11707 define)
10bc17b6
JH
11708 case "$ctime_r_proto" in
11709 ''|0) try='char* ctime_r(const time_t*, char*);'
61c26d18 11710 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
10bc17b6
JH
11711 esac
11712 case "$ctime_r_proto" in
11713 ''|0) try='char* ctime_r(const time_t*, char*, int);'
61c26d18 11714 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
10bc17b6
JH
11715 esac
11716 case "$ctime_r_proto" in
11717 ''|0) try='int ctime_r(const time_t*, char*);'
61c26d18 11718 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
10bc17b6
JH
11719 esac
11720 case "$ctime_r_proto" in
11721 ''|0) try='int ctime_r(const time_t*, char*, int);'
61c26d18 11722 ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
10bc17b6
JH
11723 esac
11724 case "$ctime_r_proto" in
90e831dc 11725 ''|0) d_ctime_r=undef
10bc17b6 11726 ctime_r_proto=0
a48ec845 11727 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11728 * ) case "$ctime_r_proto" in
11729 REENTRANT_PROTO*) ;;
11730 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11731 esac
11732 echo "Prototype: $try" ;;
11733 esac
11734 ;;
c18e646a
JH
11735 *) case "$usethreads" in
11736 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11737 esac
90e831dc
SB
11738 d_ctime_r=undef
11739 ctime_r_proto=0
c18e646a 11740 ;;
a48ec845
JH
11741 esac
11742 ;;
10bc17b6
JH
11743*) ctime_r_proto=0
11744 ;;
11745esac
11746
b4eb6b3d
JH
11747: see if cuserid exists
11748set cuserid d_cuserid
11749eval $inlibc
11750
11751: see if this is a limits.h system
11752set limits.h i_limits
11753eval $inhdr
11754
11755: see if this is a float.h system
11756set float.h i_float
11757eval $inhdr
11758
11759: See if number of significant digits in a double precision number is known
11760echo " "
11761$cat >dbl_dig.c <<EOM
11762#$i_limits I_LIMITS
11763#$i_float I_FLOAT
11764#ifdef I_LIMITS
11765#include <limits.h>
11766#endif
11767#ifdef I_FLOAT
11768#include <float.h>
11769#endif
11770#ifdef DBL_DIG
11771printf("Contains DBL_DIG");
11772#endif
11773EOM
11774$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11775if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11776 echo "DBL_DIG found." >&4
11777 val="$define"
11778else
11779 echo "DBL_DIG NOT found." >&4
11780 val="$undef"
11781fi
11782$rm -f dbl_dig.?
11783set d_dbl_dig
11784eval $setvar
11785
2ef53570
JH
11786: see if dbm.h is available
11787: see if dbmclose exists
11788set dbmclose d_dbmclose
11789eval $inlibc
11790
11791case "$d_dbmclose" in
11792$define)
11793 set dbm.h i_dbm
11794 eval $inhdr
11795 case "$i_dbm" in
11796 $define)
11797 val="$undef"
11798 set i_rpcsvcdbm
11799 eval $setvar
11800 ;;
11801 *) set rpcsvc/dbm.h i_rpcsvcdbm
11802 eval $inhdr
11803 ;;
11804 esac
11805 ;;
11806*) echo "We won't be including <dbm.h>"
11807 val="$undef"
11808 set i_dbm
11809 eval $setvar
11810 val="$undef"
11811 set i_rpcsvcdbm
11812 eval $setvar
11813 ;;
11814esac
11815
11816: see if prototype for dbminit is available
11817echo " "
11818set d_dbminitproto dbminit $i_dbm dbm.h
11819eval $hasproto
11820
b4eb6b3d
JH
11821: see if difftime exists
11822set difftime d_difftime
11823eval $inlibc
11824
11825: see if this is a dirent system
11826echo " "
11827if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11828 val="$define"
11829 echo "<dirent.h> found." >&4
11830else
11831 val="$undef"
11832 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11833 echo "<sys/dir.h> found." >&4
11834 echo " "
11835 else
11836 xinc=`./findhdr sys/ndir.h`
11837 fi
11838 echo "<dirent.h> NOT found." >&4
11839fi
11840set i_dirent
11841eval $setvar
11842
11843: Look for type of directory structure.
11844echo " "
11845$cppstdin $cppflags $cppminus < "$xinc" > try.c
11846
11847case "$direntrytype" in
11848''|' ')
11849 case "$i_dirent" in
11850 $define) guess1='struct dirent' ;;
11851 *) guess1='struct direct' ;;
11852 esac
11853 ;;
11854*) guess1="$direntrytype"
11855 ;;
11856esac
11857
11858case "$guess1" in
11859'struct dirent') guess2='struct direct' ;;
11860*) guess2='struct dirent' ;;
11861esac
5b813a60 11862
b4eb6b3d
JH
11863if $contains "$guess1" try.c >/dev/null 2>&1; then
11864 direntrytype="$guess1"
11865 echo "Your directory entries are $direntrytype." >&4
11866elif $contains "$guess2" try.c >/dev/null 2>&1; then
11867 direntrytype="$guess2"
11868 echo "Your directory entries seem to be $direntrytype." >&4
11869else
11870 echo "I don't recognize your system's directory entries." >&4
11871 rp="What type is used for directory entries on this system?"
11872 dflt="$guess1"
11873 . ./myread
11874 direntrytype="$ans"
11875fi
5b813a60 11876$rm_try
b4eb6b3d
JH
11877
11878: see if the directory entry stores field length
11879echo " "
11880$cppstdin $cppflags $cppminus < "$xinc" > try.c
11881if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11882 echo "Good, your directory entry keeps length information in d_namlen." >&4
11883 val="$define"
11884else
11885 echo "Your directory entry does not know about the d_namlen field." >&4
11886 val="$undef"
11887fi
11888set d_dirnamlen
11889eval $setvar
5b813a60 11890$rm_try
b4eb6b3d 11891
de52168c
SP
11892: Look for DIR.dd_fd
11893case "$i_dirent" in
11894"$define")
11895 echo "Checking to see if DIR has a dd_fd member variable" >&4
11896 $cat >try.c <<EOCP
11897#$i_stdlib I_STDLIB
11898#ifdef I_STDLIB
11899#include <stdlib.h>
11900#endif
11901#include <dirent.h>
11902
11903int main() {
11904 DIR dir;
11905 dir.dd_fd = 1;
11906 return 0;
11907}
11908EOCP
11909 val=$undef
11910 set try
11911 if eval $compile; then
11912 echo "Yes, it does."
11913 val="$define"
11914 else
11915 echo "No, it does not."
11916 val="$undef"
11917 fi
11918 ;;
11919*)
11920 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11921 val="$undef"
11922 ;;
11923esac
11924set d_dir_dd_fd
11925eval $setvar
5b813a60 11926$rm_try
de52168c 11927
ae0e3d3b
JH
11928: see if this is an sysdir system
11929set sys/dir.h i_sysdir
11930eval $inhdr
11931
11932: see if this is an sysndir system
11933set sys/ndir.h i_sysndir
11934eval $inhdr
11935
11936: Look for dirfd
11937echo " "
11938$cat >dirfd.c <<EOM
11939#include <stdio.h>
55954f19
JH
11940#$i_stdlib I_STDLIB
11941#ifdef I_STDLIB
11942#include <stdlib.h>
11943#endif
ae0e3d3b
JH
11944#$i_dirent I_DIRENT /**/
11945#$i_sysdir I_SYS_DIR /**/
11946#$i_sysndir I_SYS_NDIR /**/
11947#$i_systypes I_SYS_TYPES /**/
11948#if defined(I_SYS_TYPES)
11949#include <sys/types.h>
11950#endif
11951#if defined(I_DIRENT)
11952#include <dirent.h>
11953#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11954#include <sys/dir.h>
11955#endif
11956#else
11957#ifdef I_SYS_NDIR
11958#include <sys/ndir.h>
11959#else
11960#ifdef I_SYS_DIR
11961#ifdef hp9000s500
11962#include <ndir.h> /* may be wrong in the future */
11963#else
11964#include <sys/dir.h>
11965#endif
11966#endif
11967#endif
11968#endif
11969int main() {
11970 DIR *dirp = opendir(".");
11971 if (dirfd(dirp) >= 0)
11972 exit(0);
11973 else
11974 exit(1);
11975}
11976EOM
5cadb3f3 11977val=$undef
ae0e3d3b
JH
11978set dirfd
11979if eval $compile; then
11980 val="$define"
11981fi
11982case "$val" in
11983$define) echo "dirfd() found." >&4 ;;
11984*) echo "dirfd() NOT found." >&4 ;;
11985esac
11986set d_dirfd
11987eval $setvar
11988$rm -f dirfd*
11989
b4eb6b3d
JH
11990: see if dlerror exists
11991xxx_runnm="$runnm"
11992runnm=false
11993set dlerror d_dlerror
11994eval $inlibc
11995runnm="$xxx_runnm"
11996
11997: see if dlfcn is available
11998set dlfcn.h i_dlfcn
11999eval $inhdr
12000
34f1896b 12001: Check what extension to use for shared libs
b4eb6b3d
JH
12002case "$usedl" in
12003$define|y|true)
12004 $cat << EOM
12005
12006On a few systems, the dynamically loaded modules that perl generates and uses
12007will need a different extension than shared libs. The default will probably
12008be appropriate.
12009
12010EOM
12011 case "$dlext" in
12012 '') dflt="$so" ;;
12013 *) dflt="$dlext" ;;
12014 esac
12015 rp='What is the extension of dynamically loaded modules'
12016 . ./myread
12017 dlext="$ans"
12018 ;;
12019*)
12020 dlext="none"
12021 ;;
12022esac
12023
12024: Check if dlsym need a leading underscore
12025echo " "
12026val="$undef"
12027
12028case "$dlsrc" in
12029dl_dlopen.xs)
12030 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12031 $cat >dyna.c <<'EOM'
12032fred () { }
12033EOM
12034
12035$cat >fred.c<<EOM
12036
12037#include <stdio.h>
55954f19
JH
12038#$i_stdlib I_STDLIB
12039#ifdef I_STDLIB
12040#include <stdlib.h>
12041#endif
b4eb6b3d
JH
12042#$i_dlfcn I_DLFCN
12043#ifdef I_DLFCN
5440bc8e 12044#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
12045#else
12046#include <sys/types.h>
12047#include <nlist.h>
12048#include <link.h>
12049#endif
12050
12051extern int fred() ;
12052
12053int main()
12054{
12055 void * handle ;
12056 void * symbol ;
12057#ifndef RTLD_LAZY
12058 int mode = 1 ;
12059#else
12060 int mode = RTLD_LAZY ;
12061#endif
12062 handle = dlopen("./dyna.$dlext", mode) ;
12063 if (handle == NULL) {
12064 printf ("1\n") ;
12065 fflush (stdout) ;
12066 exit(0);
12067 }
12068 symbol = dlsym(handle, "fred") ;
12069 if (symbol == NULL) {
12070 /* try putting a leading underscore */
12071 symbol = dlsym(handle, "_fred") ;
12072 if (symbol == NULL) {
12073 printf ("2\n") ;
12074 fflush (stdout) ;
12075 exit(0);
12076 }
12077 printf ("3\n") ;
12078 }
12079 else
12080 printf ("4\n") ;
12081 fflush (stdout) ;
12082 exit(0);
12083}
12084EOM
12085 : Call the object file tmp-dyna.o in case dlext=o.
613d6c3e
MB
12086 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12087 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12088 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
12089 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12090 xxx=`$run ./fred`
b4eb6b3d
JH
12091 case $xxx in
12092 1) echo "Test program failed using dlopen." >&4
12093 echo "Perhaps you should not use dynamic loading." >&4;;
12094 2) echo "Test program failed using dlsym." >&4
12095 echo "Perhaps you should not use dynamic loading." >&4;;
12096 3) echo "dlsym needs a leading underscore" >&4
12097 val="$define" ;;
12098 4) echo "dlsym doesn't need a leading underscore." >&4;;
12099 esac
12100 else
12101 echo "I can't compile and run the test program." >&4
12102 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12103 fi
12104 ;;
12105esac
613d6c3e 12106
3c728e00 12107$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
12108
12109set d_dlsymun
12110eval $setvar
12111
10bc17b6
JH
12112: see if drand48_r exists
12113set drand48_r d_drand48_r
12114eval $inlibc
12115case "$d_drand48_r" in
12116"$define")
12117 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
12118 case "$d_drand48_r_proto:$usethreads" in
12119 ":define") d_drand48_r_proto=define
a48ec845
JH
12120 set d_drand48_r_proto drand48_r $hdrs
12121 eval $hasproto ;;
12122 *) ;;
12123 esac
12124 case "$d_drand48_r_proto" in
12125 define)
10bc17b6
JH
12126 case "$drand48_r_proto" in
12127 ''|0) try='int drand48_r(struct drand48_data*, double*);'
61c26d18 12128 ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
10bc17b6
JH
12129 esac
12130 case "$drand48_r_proto" in
90e831dc 12131 ''|0) d_drand48_r=undef
10bc17b6 12132 drand48_r_proto=0
a48ec845 12133 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12134 * ) case "$drand48_r_proto" in
12135 REENTRANT_PROTO*) ;;
12136 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12137 esac
12138 echo "Prototype: $try" ;;
12139 esac
12140 ;;
c18e646a
JH
12141 *) case "$usethreads" in
12142 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12143 esac
90e831dc
SB
12144 d_drand48_r=undef
12145 drand48_r_proto=0
c18e646a 12146 ;;
a48ec845
JH
12147 esac
12148 ;;
10bc17b6
JH
12149*) drand48_r_proto=0
12150 ;;
12151esac
12152
12153: see if prototype for drand48 is available
12154echo " "
12155set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12156eval $hasproto
12157
b4eb6b3d
JH
12158: see if dup2 exists
12159set dup2 d_dup2
12160eval $inlibc
12161
12162: see if eaccess exists
12163set eaccess d_eaccess
12164eval $inlibc
12165
12166: see if endgrent exists
12167set endgrent d_endgrent
12168eval $inlibc
12169
10bc17b6
JH
12170: see if this is an grp system
12171set grp.h i_grp
12172eval $inhdr
12173
12174case "$i_grp" in
12175$define)
12176 xxx=`./findhdr grp.h`
12177 $cppstdin $cppflags $cppminus < $xxx >$$.h
12178
12179 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12180 val="$define"
12181 else
12182 val="$undef"
12183 fi
12184 set d_grpasswd
12185 eval $setvar
12186
12187 $rm -f $$.h
12188 ;;
12189*)
12190 val="$undef";
12191 set d_grpasswd; eval $setvar
12192 ;;
12193esac
12194
12195: see if endgrent_r exists
12196set endgrent_r d_endgrent_r
12197eval $inlibc
12198case "$d_endgrent_r" in
12199"$define")
12200 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
12201 case "$d_endgrent_r_proto:$usethreads" in
12202 ":define") d_endgrent_r_proto=define
a48ec845
JH
12203 set d_endgrent_r_proto endgrent_r $hdrs
12204 eval $hasproto ;;
12205 *) ;;
12206 esac
12207 case "$d_endgrent_r_proto" in
12208 define)
10bc17b6
JH
12209 case "$endgrent_r_proto" in
12210 ''|0) try='int endgrent_r(FILE**);'
61c26d18 12211 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
10bc17b6
JH
12212 esac
12213 case "$endgrent_r_proto" in
12214 ''|0) try='void endgrent_r(FILE**);'
61c26d18 12215 ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
10bc17b6
JH
12216 esac
12217 case "$endgrent_r_proto" in
90e831dc 12218 ''|0) d_endgrent_r=undef
10bc17b6 12219 endgrent_r_proto=0
a48ec845 12220 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12221 * ) case "$endgrent_r_proto" in
12222 REENTRANT_PROTO*) ;;
12223 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12224 esac
12225 echo "Prototype: $try" ;;
12226 esac
12227 ;;
c18e646a
JH
12228 *) case "$usethreads" in
12229 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12230 esac
90e831dc
SB
12231 d_endgrent_r=undef
12232 endgrent_r_proto=0
c18e646a 12233 ;;
a48ec845
JH
12234 esac
12235 ;;
10bc17b6
JH
12236*) endgrent_r_proto=0
12237 ;;
12238esac
12239
b4eb6b3d
JH
12240: see if endhostent exists
12241set endhostent d_endhent
12242eval $inlibc
12243
10bc17b6
JH
12244: see if this is a netdb.h system
12245set netdb.h i_netdb
12246eval $inhdr
12247
12248: see if endhostent_r exists
12249set endhostent_r d_endhostent_r
12250eval $inlibc
12251case "$d_endhostent_r" in
12252"$define")
12253 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12254 case "$d_endhostent_r_proto:$usethreads" in
12255 ":define") d_endhostent_r_proto=define
a48ec845
JH
12256 set d_endhostent_r_proto endhostent_r $hdrs
12257 eval $hasproto ;;
12258 *) ;;
12259 esac
12260 case "$d_endhostent_r_proto" in
12261 define)
10bc17b6
JH
12262 case "$endhostent_r_proto" in
12263 ''|0) try='int endhostent_r(struct hostent_data*);'
61c26d18 12264 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
12265 esac
12266 case "$endhostent_r_proto" in
12267 ''|0) try='void endhostent_r(struct hostent_data*);'
61c26d18 12268 ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
12269 esac
12270 case "$endhostent_r_proto" in
90e831dc 12271 ''|0) d_endhostent_r=undef
10bc17b6 12272 endhostent_r_proto=0
a48ec845 12273 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12274 * ) case "$endhostent_r_proto" in
12275 REENTRANT_PROTO*) ;;
12276 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12277 esac
12278 echo "Prototype: $try" ;;
12279 esac
12280 ;;
c18e646a
JH
12281 *) case "$usethreads" in
12282 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12283 esac
90e831dc
SB
12284 d_endhostent_r=undef
12285 endhostent_r_proto=0
c18e646a 12286 ;;
a48ec845
JH
12287 esac
12288 ;;
10bc17b6
JH
12289*) endhostent_r_proto=0
12290 ;;
12291esac
12292
b4eb6b3d
JH
12293: see if endnetent exists
12294set endnetent d_endnent
12295eval $inlibc
12296
10bc17b6
JH
12297: see if endnetent_r exists
12298set endnetent_r d_endnetent_r
12299eval $inlibc
12300case "$d_endnetent_r" in
12301"$define")
12302 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12303 case "$d_endnetent_r_proto:$usethreads" in
12304 ":define") d_endnetent_r_proto=define
a48ec845
JH
12305 set d_endnetent_r_proto endnetent_r $hdrs
12306 eval $hasproto ;;
12307 *) ;;
12308 esac
12309 case "$d_endnetent_r_proto" in
12310 define)
10bc17b6
JH
12311 case "$endnetent_r_proto" in
12312 ''|0) try='int endnetent_r(struct netent_data*);'
61c26d18 12313 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
12314 esac
12315 case "$endnetent_r_proto" in
12316 ''|0) try='void endnetent_r(struct netent_data*);'
61c26d18 12317 ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
12318 esac
12319 case "$endnetent_r_proto" in
90e831dc 12320 ''|0) d_endnetent_r=undef
10bc17b6 12321 endnetent_r_proto=0
a48ec845 12322 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12323 * ) case "$endnetent_r_proto" in
12324 REENTRANT_PROTO*) ;;
12325 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12326 esac
12327 echo "Prototype: $try" ;;
12328 esac
12329 ;;
c18e646a
JH
12330 *) case "$usethreads" in
12331 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12332 esac
90e831dc
SB
12333 d_endnetent_r=undef
12334 endnetent_r_proto=0
c18e646a 12335 ;;
a48ec845
JH
12336 esac
12337 ;;
10bc17b6
JH
12338*) endnetent_r_proto=0
12339 ;;
12340esac
12341
b4eb6b3d
JH
12342: see if endprotoent exists
12343set endprotoent d_endpent
12344eval $inlibc
12345
10bc17b6
JH
12346: see if endprotoent_r exists
12347set endprotoent_r d_endprotoent_r
12348eval $inlibc
12349case "$d_endprotoent_r" in
12350"$define")
12351 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12352 case "$d_endprotoent_r_proto:$usethreads" in
12353 ":define") d_endprotoent_r_proto=define
a48ec845
JH
12354 set d_endprotoent_r_proto endprotoent_r $hdrs
12355 eval $hasproto ;;
12356 *) ;;
12357 esac
12358 case "$d_endprotoent_r_proto" in
12359 define)
10bc17b6
JH
12360 case "$endprotoent_r_proto" in
12361 ''|0) try='int endprotoent_r(struct protoent_data*);'
61c26d18 12362 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
12363 esac
12364 case "$endprotoent_r_proto" in
12365 ''|0) try='void endprotoent_r(struct protoent_data*);'
61c26d18 12366 ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
12367 esac
12368 case "$endprotoent_r_proto" in
90e831dc 12369 ''|0) d_endprotoent_r=undef
10bc17b6 12370 endprotoent_r_proto=0
a48ec845 12371 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12372 * ) case "$endprotoent_r_proto" in
12373 REENTRANT_PROTO*) ;;
12374 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12375 esac
12376 echo "Prototype: $try" ;;
12377 esac
12378 ;;
c18e646a
JH
12379 *) case "$usethreads" in
12380 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12381 esac
90e831dc
SB
12382 d_endprotoent_r=undef
12383 endprotoent_r_proto=0
c18e646a 12384 ;;
a48ec845
JH
12385 esac
12386 ;;
10bc17b6
JH
12387*) endprotoent_r_proto=0
12388 ;;
12389esac
12390
b4eb6b3d
JH
12391: see if endpwent exists
12392set endpwent d_endpwent
12393eval $inlibc
12394
10bc17b6
JH
12395: see if this is a pwd.h system
12396set pwd.h i_pwd
12397eval $inhdr
12398
12399case "$i_pwd" in
12400$define)
12401 xxx=`./findhdr pwd.h`
12402 $cppstdin $cppflags $cppminus < $xxx >$$.h
12403
12404 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12405 val="$define"
12406 else
12407 val="$undef"
12408 fi
12409 set d_pwquota
12410 eval $setvar
12411
12412 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12413 val="$define"
12414 else
12415 val="$undef"
12416 fi
12417 set d_pwage
12418 eval $setvar
12419
12420 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12421 val="$define"
12422 else
12423 val="$undef"
12424 fi
12425 set d_pwchange
12426 eval $setvar
12427
12428 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12429 val="$define"
12430 else
12431 val="$undef"
12432 fi
12433 set d_pwclass
12434 eval $setvar
12435
12436 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12437 val="$define"
12438 else
12439 val="$undef"
12440 fi
12441 set d_pwexpire
12442 eval $setvar
12443
12444 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12445 val="$define"
12446 else
12447 val="$undef"
12448 fi
12449 set d_pwcomment
12450 eval $setvar
12451
12452 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12453 val="$define"
12454 else
12455 val="$undef"
12456 fi
12457 set d_pwgecos
12458 eval $setvar
12459
12460 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12461 val="$define"
12462 else
12463 val="$undef"
12464 fi
12465 set d_pwpasswd
12466 eval $setvar
12467
12468 $rm -f $$.h
12469 ;;
12470*)
12471 val="$undef";
12472 set d_pwquota; eval $setvar
12473 set d_pwage; eval $setvar
12474 set d_pwchange; eval $setvar
12475 set d_pwclass; eval $setvar
12476 set d_pwexpire; eval $setvar
12477 set d_pwcomment; eval $setvar
12478 set d_pwgecos; eval $setvar
12479 set d_pwpasswd; eval $setvar
12480 ;;
12481esac
12482
12483: see if endpwent_r exists
12484set endpwent_r d_endpwent_r
12485eval $inlibc
12486case "$d_endpwent_r" in
12487"$define")
12488 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12489 case "$d_endpwent_r_proto:$usethreads" in
12490 ":define") d_endpwent_r_proto=define
a48ec845
JH
12491 set d_endpwent_r_proto endpwent_r $hdrs
12492 eval $hasproto ;;
12493 *) ;;
12494 esac
12495 case "$d_endpwent_r_proto" in
12496 define)
10bc17b6
JH
12497 case "$endpwent_r_proto" in
12498 ''|0) try='int endpwent_r(FILE**);'
61c26d18 12499 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
10bc17b6
JH
12500 esac
12501 case "$endpwent_r_proto" in
12502 ''|0) try='void endpwent_r(FILE**);'
61c26d18 12503 ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
10bc17b6
JH
12504 esac
12505 case "$endpwent_r_proto" in
90e831dc 12506 ''|0) d_endpwent_r=undef
10bc17b6 12507 endpwent_r_proto=0
a48ec845 12508 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12509 * ) case "$endpwent_r_proto" in
12510 REENTRANT_PROTO*) ;;
12511 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12512 esac
12513 echo "Prototype: $try" ;;
12514 esac
12515 ;;
c18e646a
JH
12516 *) case "$usethreads" in
12517 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12518 esac
90e831dc
SB
12519 d_endpwent_r=undef
12520 endpwent_r_proto=0
c18e646a 12521 ;;
a48ec845
JH
12522 esac
12523 ;;
10bc17b6
JH
12524*) endpwent_r_proto=0
12525 ;;
12526esac
12527
b4eb6b3d
JH
12528: see if endservent exists
12529set endservent d_endsent
12530eval $inlibc
12531
10bc17b6
JH
12532: see if endservent_r exists
12533set endservent_r d_endservent_r
12534eval $inlibc
12535case "$d_endservent_r" in
12536"$define")
12537 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12538 case "$d_endservent_r_proto:$usethreads" in
12539 ":define") d_endservent_r_proto=define
a48ec845
JH
12540 set d_endservent_r_proto endservent_r $hdrs
12541 eval $hasproto ;;
12542 *) ;;
12543 esac
12544 case "$d_endservent_r_proto" in
12545 define)
10bc17b6
JH
12546 case "$endservent_r_proto" in
12547 ''|0) try='int endservent_r(struct servent_data*);'
61c26d18 12548 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
12549 esac
12550 case "$endservent_r_proto" in
12551 ''|0) try='void endservent_r(struct servent_data*);'
61c26d18 12552 ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12553 esac
12554 case "$endservent_r_proto" in
90e831dc 12555 ''|0) d_endservent_r=undef
10bc17b6 12556 endservent_r_proto=0
a48ec845 12557 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12558 * ) case "$endservent_r_proto" in
12559 REENTRANT_PROTO*) ;;
12560 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12561 esac
12562 echo "Prototype: $try" ;;
12563 esac
12564 ;;
c18e646a
JH
12565 *) case "$usethreads" in
12566 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12567 esac
90e831dc
SB
12568 d_endservent_r=undef
12569 endservent_r_proto=0
c18e646a 12570 ;;
a48ec845
JH
12571 esac
12572 ;;
10bc17b6
JH
12573*) endservent_r_proto=0
12574 ;;
12575esac
12576
b4eb6b3d
JH
12577: Locate the flags for 'open()'
12578echo " "
55954f19 12579$cat >try.c <<EOCP
b4eb6b3d
JH
12580#include <sys/types.h>
12581#ifdef I_FCNTL
12582#include <fcntl.h>
12583#endif
12584#ifdef I_SYS_FILE
12585#include <sys/file.h>
12586#endif
55954f19
JH
12587#$i_stdlib I_STDLIB
12588#ifdef I_STDLIB
12589#include <stdlib.h>
12590#endif
b4eb6b3d
JH
12591int main() {
12592 if(O_RDONLY);
12593#ifdef O_TRUNC
12594 exit(0);
12595#else
12596 exit(1);
12597#endif
12598}
12599EOCP
12600: check sys/file.h first to get FREAD on Sun
12601if $test `./findhdr sys/file.h` && \
5440bc8e 12602 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12603 h_sysfile=true;
12604 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12605 if $run ./try; then
b4eb6b3d
JH
12606 echo "and you have the 3 argument form of open()." >&4
12607 val="$define"
12608 else
12609 echo "but not the 3 argument form of open(). Oh, well." >&4
12610 val="$undef"
12611 fi
12612elif $test `./findhdr fcntl.h` && \
5440bc8e 12613 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12614 h_fcntl=true;
12615 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12616 if $run ./try; then
b4eb6b3d
JH
12617 echo "and you have the 3 argument form of open()." >&4
12618 val="$define"
12619 else
12620 echo "but not the 3 argument form of open(). Oh, well." >&4
12621 val="$undef"
12622 fi
12623else
12624 val="$undef"
12625 echo "I can't find the O_* constant definitions! You got problems." >&4
12626fi
12627set d_open3
12628eval $setvar
5b813a60 12629$rm_try
b4eb6b3d 12630
3c728e00
JH
12631: see if this is a sys/file.h system
12632val=''
12633set sys/file.h val
12634eval $inhdr
12635
12636: do we need to include sys/file.h ?
12637case "$val" in
12638"$define")
12639 echo " "
12640 if $h_sysfile; then
12641 val="$define"
12642 echo "We'll be including <sys/file.h>." >&4
12643 else
12644 val="$undef"
12645 echo "We won't be including <sys/file.h>." >&4
12646 fi
12647 ;;
12648*)
12649 h_sysfile=false
12650 ;;
12651esac
12652set i_sysfile
12653eval $setvar
12654
12655: see if fcntl.h is there
12656val=''
12657set fcntl.h val
12658eval $inhdr
12659
12660: see if we can include fcntl.h
12661case "$val" in
12662"$define")
12663 echo " "
12664 if $h_fcntl; then
12665 val="$define"
12666 echo "We'll be including <fcntl.h>." >&4
12667 else
12668 val="$undef"
12669 if $h_sysfile; then
12670 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12671 else
12672 echo "We won't be including <fcntl.h>." >&4
12673 fi
12674 fi
12675 ;;
12676*)
12677 h_fcntl=false
12678 val="$undef"
12679 ;;
12680esac
12681set i_fcntl
12682eval $setvar
12683
4dd8f9b3
JH
12684: see if fork exists
12685set fork d_fork
12686eval $inlibc
12687
12688: see if pipe exists
12689set pipe d_pipe
12690eval $inlibc
12691
b4eb6b3d
JH
12692: check for non-blocking I/O stuff
12693case "$h_sysfile" in
a0acbdc3
JH
12694true) echo "#include <sys/file.h>" > head.c;;
12695*)
12696 case "$h_fcntl" in
12697 true) echo "#include <fcntl.h>" > head.c;;
12698 *) echo "#include <sys/fcntl.h>" > head.c;;
12699 esac
12700 ;;
b4eb6b3d
JH
12701esac
12702echo " "
12703echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12704case "$o_nonblock" in
12705'')
12706 $cat head.c > try.c
3c728e00 12707 $cat >>try.c <<EOCP
b4eb6b3d 12708#include <stdio.h>
55954f19
JH
12709#$i_stdlib I_STDLIB
12710#ifdef I_STDLIB
80b3ef99 12711#include <stdlib.h>
55954f19 12712#endif
3c728e00
JH
12713#$i_fcntl I_FCNTL
12714#ifdef I_FCNTL
12715#include <fcntl.h>
12716#endif
b4eb6b3d
JH
12717int main() {
12718#ifdef O_NONBLOCK
12719 printf("O_NONBLOCK\n");
12720 exit(0);
12721#endif
12722#ifdef O_NDELAY
12723 printf("O_NDELAY\n");
12724 exit(0);
12725#endif
12726#ifdef FNDELAY
12727 printf("FNDELAY\n");
12728 exit(0);
12729#endif
12730 exit(0);
12731}
12732EOCP
12733 set try
12734 if eval $compile_ok; then
5440bc8e 12735 o_nonblock=`$run ./try`
b4eb6b3d
JH
12736 case "$o_nonblock" in
12737 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12738 *) echo "Seems like we can use $o_nonblock.";;
12739 esac
12740 else
12741 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12742 fi
12743 ;;
12744*) echo "Using $hint value $o_nonblock.";;
12745esac
5b813a60 12746$rm_try
b4eb6b3d
JH
12747
12748echo " "
12749echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12750case "$eagain" in
12751'')
4dd8f9b3
JH
12752 case "$d_fork:$d_pipe" in
12753 define:define)
b4eb6b3d
JH
12754 $cat head.c > try.c
12755 $cat >>try.c <<EOCP
12756#include <errno.h>
12757#include <sys/types.h>
12758#include <signal.h>
5b813a60 12759#include <stdio.h>
55954f19
JH
12760#$i_stdlib I_STDLIB
12761#ifdef I_STDLIB
12762#include <stdlib.h>
12763#endif
1deb0a86
JH
12764#$i_fcntl I_FCNTL
12765#ifdef I_FCNTL
12766#include <fcntl.h>
12767#endif
b4eb6b3d
JH
12768#define MY_O_NONBLOCK $o_nonblock
12769#ifndef errno /* XXX need better Configure test */
12770extern int errno;
12771#endif
12772#$i_unistd I_UNISTD
12773#ifdef I_UNISTD
12774#include <unistd.h>
12775#endif
12776#$i_string I_STRING
12777#ifdef I_STRING
12778#include <string.h>
12779#else
12780#include <strings.h>
12781#endif
7090f861 12782$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12783EOCP
12784 $cat >> try.c <<'EOCP'
12785int main()
12786{
12787 int pd[2];
12788 int pu[2];
12789 char buf[1];
12790 char string[100];
12791
12792 pipe(pd); /* Down: child -> parent */
12793 pipe(pu); /* Up: parent -> child */
12794 if (0 != fork()) {
12795 int ret;
12796 close(pd[1]); /* Parent reads from pd[0] */
12797 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12798#ifdef F_SETFL
b4eb6b3d
JH
12799 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12800 exit(1);
a0acbdc3
JH
12801#else
12802 exit(4);
12803#endif
b4eb6b3d
JH
12804 signal(SIGALRM, blech);
12805 alarm(5);
12806 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12807 exit(2);
12808 sprintf(string, "%d\n", ret);
12809 write(2, string, strlen(string));
12810 alarm(0);
12811#ifdef EAGAIN
12812 if (errno == EAGAIN) {
12813 printf("EAGAIN\n");
12814 goto ok;
12815 }
12816#endif
12817#ifdef EWOULDBLOCK
12818 if (errno == EWOULDBLOCK)
12819 printf("EWOULDBLOCK\n");
12820#endif
12821 ok:
12822 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12823 sleep(2); /* Give it time to close our pipe */
12824 alarm(5);
12825 ret = read(pd[0], buf, 1); /* Should read EOF */
12826 alarm(0);
12827 sprintf(string, "%d\n", ret);
868439a2 12828 write(4, string, strlen(string));
b4eb6b3d
JH
12829 exit(0);
12830 }
12831
12832 close(pd[0]); /* We write to pd[1] */
12833 close(pu[1]); /* We read from pu[0] */
12834 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12835 close(pd[1]); /* Pipe pd is now fully closed! */
12836 exit(0); /* Bye bye, thank you for playing! */
12837}
12838EOCP
12839 set try
12840 if eval $compile_ok; then
12841 echo "$startsh" >mtry
868439a2 12842 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12843 chmod +x mtry
12844 ./mtry >/dev/null 2>&1
12845 case $? in
12846 0) eagain=`$cat try.out`;;
12847 1) echo "Could not perform non-blocking setting!";;
12848 2) echo "I did a successful read() for something that was not there!";;
12849 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12850 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12851 *) echo "Something terribly wrong happened during testing.";;
12852 esac
12853 rd_nodata=`$cat try.ret`
12854 echo "A read() system call with no data present returns $rd_nodata."
12855 case "$rd_nodata" in
12856 0|-1) ;;
12857 *)
12858 echo "(That's peculiar, fixing that to be -1.)"
12859 rd_nodata=-1
12860 ;;
12861 esac
12862 case "$eagain" in
12863 '')
12864 echo "Forcing errno EAGAIN on read() with no data available."
12865 eagain=EAGAIN
12866 ;;
12867 *)
12868 echo "Your read() sets errno to $eagain when no data is available."
12869 ;;
12870 esac
12871 status=`$cat try.err`
12872 case "$status" in
12873 0) echo "And it correctly returns 0 to signal EOF.";;
12874 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12875 *) echo "However, your read() returns '$status' on EOF??";;
12876 esac
12877 val="$define"
12878 if test "$status" = "$rd_nodata"; then
12879 echo "WARNING: you can't distinguish between EOF and no data!"
12880 val="$undef"
12881 fi
12882 else
12883 echo "I can't compile the test program--assuming errno EAGAIN will do."
12884 eagain=EAGAIN
12885 fi
4dd8f9b3
JH
12886 ;;
12887 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12888 eagain=EAGAIN
12889 val="$define"
12890 ;;
12891 esac
b4eb6b3d
JH
12892 set d_eofnblk
12893 eval $setvar
12894 ;;
12895*)
12896 echo "Using $hint value $eagain."
12897 echo "Your read() returns $rd_nodata when no data is present."
12898 case "$d_eofnblk" in
12899 "$define") echo "And you can see EOF because read() returns 0.";;
12900 "$undef") echo "But you can't see EOF status from read() returned value.";;
12901 *)
12902 echo "(Assuming you can't see EOF status from read anyway.)"
12903 d_eofnblk=$undef
12904 ;;
12905 esac
12906 ;;
12907esac
5b813a60 12908$rm_try head.c mtry
b4eb6b3d 12909
15b61c98
JH
12910: see if _ptr and _cnt from stdio act std
12911echo " "
b4eb6b3d 12912
15b61c98
JH
12913if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12914 echo "(Looks like you have stdio.h from BSD.)"
12915 case "$stdio_ptr" in
12916 '') stdio_ptr='((fp)->_p)'
12917 ptr_lval=$define
12918 ;;
12919 *) ptr_lval=$d_stdio_ptr_lval;;
12920 esac
12921 case "$stdio_cnt" in
12922 '') stdio_cnt='((fp)->_r)'
12923 cnt_lval=$define
12924 ;;
12925 *) cnt_lval=$d_stdio_cnt_lval;;
12926 esac
12927 case "$stdio_base" in
12928 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12929 esac
12930 case "$stdio_bufsiz" in
12931 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12932 esac
12933elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12934 echo "(Looks like you have stdio.h from Linux.)"
12935 case "$stdio_ptr" in
12936 '') stdio_ptr='((fp)->_IO_read_ptr)'
12937 ptr_lval=$define
12938 ;;
12939 *) ptr_lval=$d_stdio_ptr_lval;;
12940 esac
12941 case "$stdio_cnt" in
12942 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12943 cnt_lval=$undef
12944 ;;
12945 *) cnt_lval=$d_stdio_cnt_lval;;
12946 esac
12947 case "$stdio_base" in
12948 '') stdio_base='((fp)->_IO_read_base)';;
12949 esac
12950 case "$stdio_bufsiz" in
12951 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12952 esac
12953else
12954 case "$stdio_ptr" in
12955 '') stdio_ptr='((fp)->_ptr)'
12956 ptr_lval=$define
12957 ;;
12958 *) ptr_lval=$d_stdio_ptr_lval;;
12959 esac
12960 case "$stdio_cnt" in
12961 '') stdio_cnt='((fp)->_cnt)'
12962 cnt_lval=$define
12963 ;;
12964 *) cnt_lval=$d_stdio_cnt_lval;;
12965 esac
12966 case "$stdio_base" in
12967 '') stdio_base='((fp)->_base)';;
12968 esac
12969 case "$stdio_bufsiz" in
12970 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12971 esac
12972fi
b4eb6b3d 12973
15b61c98
JH
12974: test whether _ptr and _cnt really work
12975echo "Checking how std your stdio is..." >&4
12976$cat >try.c <<EOP
12977#include <stdio.h>
55954f19
JH
12978#$i_stdlib I_STDLIB
12979#ifdef I_STDLIB
9d9004a9 12980#include <stdlib.h>
55954f19 12981#endif
15b61c98
JH
12982#define FILE_ptr(fp) $stdio_ptr
12983#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12984int main() {
15b61c98
JH
12985 FILE *fp = fopen("try.c", "r");
12986 char c = getc(fp);
12987 if (
12988 18 <= FILE_cnt(fp) &&
12989 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12990 )
12991 exit(0);
12992 exit(1);
9d9004a9 12993}
15b61c98
JH
12994EOP
12995val="$undef"
12996set try
12997if eval $compile && $to try.c; then
12998 if $run ./try; then
12999 echo "Your stdio acts pretty std."
13000 val="$define"
9d9004a9 13001 else
15b61c98 13002 echo "Your stdio isn't very std."
9d9004a9 13003 fi
15b61c98
JH
13004else
13005 echo "Your stdio doesn't appear very std."
13006fi
5b813a60 13007$rm_try
15b61c98
JH
13008
13009# glibc 2.2.90 and above apparently change stdio streams so Perl's
13010# direct buffer manipulation no longer works. The Configure tests
13011# should be changed to correctly detect this, but until then,
13012# the following check should at least let perl compile and run.
13013# (This quick fix should be updated before 5.8.1.)
13014# To be defensive, reject all unknown versions, and all versions > 2.2.9.
13015# A. Dougherty, June 3, 2002.
13016case "$d_gnulibc" in
13017$define)
13018 case "$gnulibc_version" in
13019 2.[01]*) ;;
13020 2.2) ;;
13021 2.2.[0-9]) ;;
13022 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13023 val="$undef"
13024 ;;
13025 esac
9d9004a9
AD
13026 ;;
13027esac
15b61c98 13028set d_stdstdio
9d9004a9 13029eval $setvar
9d9004a9 13030
15b61c98
JH
13031: Can _ptr be used as an lvalue?
13032case "$d_stdstdio$ptr_lval" in
13033$define$define) val=$define ;;
13034*) val=$undef ;;
13035esac
13036set d_stdio_ptr_lval
13037eval $setvar
9d9004a9 13038
15b61c98
JH
13039: Can _cnt be used as an lvalue?
13040case "$d_stdstdio$cnt_lval" in
13041$define$define) val=$define ;;
13042*) val=$undef ;;
13043esac
13044set d_stdio_cnt_lval
13045eval $setvar
b4eb6b3d 13046
15b61c98
JH
13047
13048: test whether setting _ptr sets _cnt as a side effect
13049d_stdio_ptr_lval_sets_cnt="$undef"
13050d_stdio_ptr_lval_nochange_cnt="$undef"
13051case "$d_stdio_ptr_lval$d_stdstdio" in
13052$define$define)
13053 echo "Checking to see what happens if we set the stdio ptr..." >&4
13054$cat >try.c <<EOP
13055#include <stdio.h>
13056/* Can we scream? */
13057/* Eat dust sed :-) */
13058/* In the buffer space, no one can hear you scream. */
55954f19
JH
13059#$i_stdlib I_STDLIB
13060#ifdef I_STDLIB
13061#include <stdlib.h>
13062#endif
15b61c98
JH
13063#define FILE_ptr(fp) $stdio_ptr
13064#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 13065#include <sys/types.h>
b4eb6b3d 13066int main() {
15b61c98
JH
13067 FILE *fp = fopen("try.c", "r");
13068 int c;
13069 char *ptr;
13070 size_t cnt;
13071 if (!fp) {
13072 puts("Fail even to read");
13073 exit(1);
13074 }
13075 c = getc(fp); /* Read away the first # */
13076 if (c == EOF) {
13077 puts("Fail even to read");
13078 exit(1);
13079 }
13080 if (!(
13081 18 <= FILE_cnt(fp) &&
13082 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13083 )) {
13084 puts("Fail even to read");
13085 exit (1);
13086 }
13087 ptr = (char*) FILE_ptr(fp);
13088 cnt = (size_t)FILE_cnt(fp);
13089
13090 FILE_ptr(fp) += 42;
13091
13092 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13093 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13094 exit (1);
13095 }
13096 if (FILE_cnt(fp) <= 20) {
13097 printf ("Fail (<20 chars to test)");
13098 exit (1);
13099 }
13100 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13101 puts("Fail compare");
13102 exit (1);
13103 }
13104 if (cnt == FILE_cnt(fp)) {
13105 puts("Pass_unchanged");
13106 exit (0);
5b813a60 13107 }
15b61c98
JH
13108 if (FILE_cnt(fp) == (cnt - 42)) {
13109 puts("Pass_changed");
13110 exit (0);
13111 }
13112 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13113 return 1;
13114
13115}
13116EOP
13117 set try
13118 if eval $compile && $to try.c; then
13119 case `$run ./try` in
13120 Pass_changed)
13121 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
13122 d_stdio_ptr_lval_sets_cnt="$define" ;;
13123 Pass_unchanged)
13124 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
13125 d_stdio_ptr_lval_nochange_cnt="$define" ;;
13126 Fail*)
13127 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
13128 *)
13129 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13130 esac
13131 else
13132 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
13133 fi
5b813a60 13134 $rm_try
15b61c98
JH
13135 ;;
13136esac
13137
13138: see if _base is also standard
13139val="$undef"
13140case "$d_stdstdio" in
13141$define)
13142 $cat >try.c <<EOP
13143#include <stdio.h>
13144#$i_stdlib I_STDLIB
13145#ifdef I_STDLIB
13146#include <stdlib.h>
13147#endif
13148#define FILE_base(fp) $stdio_base
13149#define FILE_bufsiz(fp) $stdio_bufsiz
13150int main() {
13151 FILE *fp = fopen("try.c", "r");
13152 char c = getc(fp);
13153 if (
13154 19 <= FILE_bufsiz(fp) &&
13155 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13156 )
13157 exit(0);
13158 exit(1);
13159}
13160EOP
13161 set try
13162 if eval $compile && $to try.c; then
13163 if $run ./try; then
13164 echo "And its _base field acts std."
13165 val="$define"
13166 else
13167 echo "But its _base field isn't std."
13168 fi
13169 else
13170 echo "However, it seems to be lacking the _base field."
13171 fi
5b813a60 13172 $rm_try
15b61c98
JH
13173 ;;
13174esac
13175set d_stdiobase
13176eval $setvar
13177
13178: see if fast_stdio exists
13179val="$undef"
13180case "$d_stdstdio:$d_stdio_ptr_lval" in
13181"$define:$define")
13182 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13183 *$define*)
13184 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13185 val="$define"
13186 ;;
13187 esac
13188 ;;
13189esac
13190set d_faststdio
13191eval $setvar
13192
13193
13194
13195: see if fchdir exists
13196set fchdir d_fchdir
13197eval $inlibc
13198
13199: see if fchmod exists
13200set fchmod d_fchmod
13201eval $inlibc
13202
13203: see if fchown exists
13204set fchown d_fchown
13205eval $inlibc
13206
13207: see if this is an fcntl system
13208set fcntl d_fcntl
13209eval $inlibc
13210
15b61c98 13211: See if fcntl-based locking works.
613d6c3e 13212echo " "
15b61c98
JH
13213$cat >try.c <<EOCP
13214#$i_stdlib I_STDLIB
13215#ifdef I_STDLIB
13216#include <stdlib.h>
13217#endif
13218#include <unistd.h>
13219#include <fcntl.h>
13220#include <signal.h>
7090f861 13221$signal_t blech(int x) { exit(3); }
15b61c98
JH
13222int main() {
13223#if defined(F_SETLK) && defined(F_SETLKW)
13224 struct flock flock;
13225 int retval, fd;
13226 fd = open("try.c", O_RDONLY);
13227 flock.l_type = F_RDLCK;
13228 flock.l_whence = SEEK_SET;
13229 flock.l_start = flock.l_len = 0;
13230 signal(SIGALRM, blech);
13231 alarm(10);
13232 retval = fcntl(fd, F_SETLK, &flock);
13233 close(fd);
13234 (retval < 0 ? exit(2) : exit(0));
13235#else
13236 exit(2);
13237#endif
13238}
13239EOCP
13240echo "Checking if fcntl-based file locking works... "
13241case "$d_fcntl" in
13242"$define")
13243 set try
13244 if eval $compile_ok; then
13245 if $run ./try; then
13246 echo "Yes, it seems to work."
13247 val="$define"
13248 else
13249 echo "Nope, it didn't work."
13250 val="$undef"
13251 case "$?" in
13252 3) $cat >&4 <<EOM
13253***
13254*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13255*** This is (almost) impossible.
13256*** If your NFS lock daemons are not feeling well, something like
13257*** this may happen, please investigate. Cannot continue, aborting.
13258***
13259EOM
13260 exit 1
13261 ;;
13262 esac
13263 fi
13264 else
13265 echo "I'm unable to compile the test program, so I'll assume not."
13266 val="$undef"
13267 fi
13268 ;;
13269*) val="$undef";
13270 echo "Nope, since you don't even have fcntl()."
13271 ;;
13272esac
13273set d_fcntl_can_lock
13274eval $setvar
5b813a60 13275$rm_try
15b61c98
JH
13276
13277: check for fd_set items
13278$cat <<EOM
13279
13280Checking to see how well your C compiler handles fd_set and friends ...
13281EOM
13282$cat >try.c <<EOCP
13283#$i_stdlib I_STDLIB
13284#ifdef I_STDLIB
13285#include <stdlib.h>
13286#endif
13287#$i_systime I_SYS_TIME
13288#$i_sysselct I_SYS_SELECT
13289#$d_socket HAS_SOCKET
13290#include <sys/types.h>
13291#ifdef HAS_SOCKET
13292#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13293#endif
13294#ifdef I_SYS_TIME
13295#include <sys/time.h>
13296#endif
13297#ifdef I_SYS_SELECT
13298#include <sys/select.h>
13299#endif
13300int main() {
13301 fd_set fds;
13302
13303#ifdef TRYBITS
13304 if(fds.fds_bits);
13305#endif
13306
13307#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13308 exit(0);
13309#else
13310 exit(1);
13311#endif
13312}
13313EOCP
13314set try -DTRYBITS
13315if eval $compile; then
13316 d_fds_bits="$define"
13317 d_fd_set="$define"
13318 echo "Well, your system knows about the normal fd_set typedef..." >&4
13319 if $run ./try; then
b4eb6b3d
JH
13320 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13321 d_fd_macros="$define"
13322 else
13323 $cat >&4 <<'EOM'
13324but not the normal fd_set macros! Gaaack! I'll have to cover for you.
13325EOM
13326 d_fd_macros="$undef"
13327 fi
13328else
13329 $cat <<'EOM'
13330Hmm, your compiler has some difficulty with fd_set. Checking further...
13331EOM
5440bc8e 13332 set try
b4eb6b3d
JH
13333 if eval $compile; then
13334 d_fds_bits="$undef"
13335 d_fd_set="$define"
13336 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 13337 if $run ./try; then
b4eb6b3d
JH
13338 echo "and you have the normal fd_set macros." >&4
13339 d_fd_macros="$define"
13340 else
13341 $cat <<'EOM'
13342but not the normal fd_set macros! Gross! More work for me...
13343EOM
13344 d_fd_macros="$undef"
13345 fi
13346 else
13347 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
13348 d_fd_set="$undef"
13349 d_fds_bits="$undef"
13350 d_fd_macros="$undef"
13351 fi
13352fi
5b813a60 13353$rm_try
b4eb6b3d
JH
13354
13355: see if fgetpos exists
13356set fgetpos d_fgetpos
13357eval $inlibc
13358
758a5d79
JH
13359: see if finite exists
13360set finite d_finite
13361eval $inlibc
13362
13363: see if finitel exists
13364set finitel d_finitel
13365eval $inlibc
13366
b4eb6b3d
JH
13367: see if flock exists
13368set flock d_flock
13369eval $inlibc
13370
2ef53570
JH
13371: see if prototype for flock is available
13372echo " "
13373set d_flockproto flock $i_sysfile sys/file.h
13374eval $hasproto
13375
758a5d79
JH
13376: see if fp_class exists
13377set fp_class d_fp_class
13378eval $inlibc
13379
b4eb6b3d
JH
13380: see if pathconf exists
13381set pathconf d_pathconf
13382eval $inlibc
13383
13384: see if fpathconf exists
13385set fpathconf d_fpathconf
13386eval $inlibc
13387
758a5d79
JH
13388: see if fpclass exists
13389set fpclass d_fpclass
13390eval $inlibc
13391
13392: see if fpclassify exists
13393set fpclassify d_fpclassify
13394eval $inlibc
13395
13396: see if fpclassl exists
13397set fpclassl d_fpclassl
13398eval $inlibc
13399
b4eb6b3d
JH
13400: check for fpos64_t
13401echo " "
13402echo "Checking to see if you have fpos64_t..." >&4
13403$cat >try.c <<EOCP
13404#include <stdio.h>
13405int main() { fpos64_t x = 7; }
13406EOCP
13407set try
13408if eval $compile; then
13409 val="$define"
13410 echo "You have fpos64_t."
13411else
13412 val="$undef"
13413 echo "You do not have fpos64_t."
13414 case "$fpossize" in
13415 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13416 esac
13417fi
5b813a60 13418$rm_try
b4eb6b3d
JH
13419set d_fpos64_t
13420eval $setvar
13421
13422: see if frexpl exists
13423set frexpl d_frexpl
13424eval $inlibc
13425
b4eb6b3d
JH
13426: see if this is a sys/param system
13427set sys/param.h i_sysparam
13428eval $inhdr
13429
13430: see if this is a sys/mount.h system
13431set sys/mount.h i_sysmount
13432eval $inhdr
13433
34f1896b 13434: Check for fs_data_s
b4eb6b3d
JH
13435echo " "
13436echo "Checking to see if your system supports struct fs_data..." >&4
13437set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13438eval $hasstruct
13439case "$d_fs_data_s" in
13440"$define") echo "Yes, it does." ;;
13441*) echo "No, it doesn't." ;;
13442esac
13443
13444: see if fseeko exists
13445set fseeko d_fseeko
13446eval $inlibc
13447case "$longsize" in
134488) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13449esac
13450
13451: see if fsetpos exists
13452set fsetpos d_fsetpos
13453eval $inlibc
13454
b4eb6b3d
JH
13455: see if fstatfs exists
13456set fstatfs d_fstatfs
13457eval $inlibc
13458
b4eb6b3d
JH
13459: see if statvfs exists
13460set statvfs d_statvfs
13461eval $inlibc
13462
13463: see if fstatvfs exists
13464set fstatvfs d_fstatvfs
13465eval $inlibc
13466
13467
411ab01c
JH
13468: see if fsync exists
13469set fsync d_fsync
13470eval $inlibc
13471
b4eb6b3d
JH
13472: see if ftello exists
13473set ftello d_ftello
13474eval $inlibc
13475case "$longsize" in
134768) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13477esac
13478
bff98e24 13479: check for a working futimes
613d6c3e 13480d_futimes="$undef"
bff98e24 13481echo " "
5b813a60 13482echo "Checking if you have a working futimes()" >&4
bff98e24
SP
13483$cat >try.c <<EOCP
13484#include <stdio.h>
13485#include <sys/time.h>
13486#include <errno.h>
13487#include <fcntl.h>
13488
13489int main ()
13490{
13491 int fd, rv;
13492 fd = open ("try.c", O_RDWR);
13493 if (-1 == fd) exit (1);
13494 rv = futimes (fd, NULL);
13495 exit (rv == -1 ? errno : 0);
13496}
13497EOCP
13498set try
13499if eval $compile; then
13500 `$run ./try`
13501 rc=$?
13502 case "$rc" in
5b813a60 13503 0) echo "Yes, you have" >&4
bff98e24
SP
13504 d_futimes="$define"
13505 ;;
5b813a60 13506 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
bff98e24
SP
13507 ;;
13508 esac
13509else
43dddb59 13510 echo "No, it does not (probably harmless)" >&4
bff98e24 13511fi
5b813a60 13512$rm_try
dc814df1 13513
e74475c7
MHM
13514: see if ndbm.h is available
13515set ndbm.h i_ndbm
13516eval $inhdr
13517: Compatibility location for RedHat 7.1
13518set gdbm/ndbm.h i_gdbmndbm
13519eval $inhdr
13520: Compatibility location for Debian 4.0
13521set gdbm-ndbm.h i_gdbm_ndbm
13522eval $inhdr
13523
13524val="$undef"
13525if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13526 : see if dbm_open exists
13527 set dbm_open d_dbm_open
13528 eval $inlibc
13529 case "$d_dbm_open" in
13530 $undef)
13531 i_ndbm="$undef"
13532 i_gdbmndbm="$undef"
13533 i_gdbm_ndbm="$undef"
13534 echo "We won't be including <ndbm.h>"
13535 val="$undef"
13536 ;;
13537 *) val="$define"
13538 ;;
13539 esac
13540fi
13541set d_ndbm
13542eval $setvar
13543
13544ndbm_hdr_protochk='name=$1; hdr=$2;
13545eval "ihdr=\$""i_$name";
13546val="$undef";
13547if $test "$ihdr" = "$define"; then
13548 $echo "Checking if your <$hdr> uses prototypes..." >&4;
13549 case "$d_cplusplus" in
13550 $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13551 *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13552 esac;
13553 case "$val" in
13554 $define) $echo "Your <$hdr> seems to have prototypes";;
13555 *) $echo "Your <$hdr> does not seem to have prototypes";;
13556 esac;
13557fi;
13558set "d_${name}_h_uses_prototypes";
13559eval $setvar'
13560
13561set ndbm ndbm.h
13562eval $ndbm_hdr_protochk
13563set gdbmndbm gdbm/ndbm.h
13564eval $ndbm_hdr_protochk
13565set gdbm_ndbm gdbm-ndbm.h
13566eval $ndbm_hdr_protochk
13567
5086dff9
MB
13568: see if getaddrinfo exists
13569set getaddrinfo d_getaddrinfo
13570eval $inlibc
13571
b4eb6b3d
JH
13572: see if getcwd exists
13573set getcwd d_getcwd
13574eval $inlibc
13575
13576: see if getespwnam exists
13577set getespwnam d_getespwnam
13578eval $inlibc
13579
b4eb6b3d
JH
13580: see if getfsstat exists
13581set getfsstat d_getfsstat
13582eval $inlibc
13583
13584: see if getgrent exists
13585set getgrent d_getgrent
13586eval $inlibc
13587
10bc17b6
JH
13588: see if getgrent_r exists
13589set getgrent_r d_getgrent_r
13590eval $inlibc
13591case "$d_getgrent_r" in
13592"$define")
13593 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13594 case "$d_getgrent_r_proto:$usethreads" in
13595 ":define") d_getgrent_r_proto=define
a48ec845
JH
13596 set d_getgrent_r_proto getgrent_r $hdrs
13597 eval $hasproto ;;
13598 *) ;;
13599 esac
13600 case "$d_getgrent_r_proto" in
13601 define)
10bc17b6
JH
13602 case "$getgrent_r_proto" in
13603 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
61c26d18 13604 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
10bc17b6
JH
13605 esac
13606 case "$getgrent_r_proto" in
13607 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
61c26d18 13608 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
10bc17b6
JH
13609 esac
13610 case "$getgrent_r_proto" in
13611 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
61c26d18 13612 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
10bc17b6
JH
13613 esac
13614 case "$getgrent_r_proto" in
13615 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
61c26d18 13616 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
10bc17b6
JH
13617 esac
13618 case "$getgrent_r_proto" in
13619 ''|0) try='int getgrent_r(struct group*, char*, int);'
61c26d18 13620 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
10bc17b6
JH
13621 esac
13622 case "$getgrent_r_proto" in
13623 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
61c26d18 13624 ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
10bc17b6
JH
13625 esac
13626 case "$getgrent_r_proto" in
90e831dc 13627 ''|0) d_getgrent_r=undef
10bc17b6 13628 getgrent_r_proto=0
a48ec845 13629 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13630 * ) case "$getgrent_r_proto" in
13631 REENTRANT_PROTO*) ;;
13632 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13633 esac
13634 echo "Prototype: $try" ;;
13635 esac
13636 ;;
c18e646a
JH
13637 *) case "$usethreads" in
13638 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13639 esac
90e831dc
SB
13640 d_getgrent_r=undef
13641 getgrent_r_proto=0
c18e646a 13642 ;;
a48ec845
JH
13643 esac
13644 ;;
10bc17b6
JH
13645*) getgrent_r_proto=0
13646 ;;
13647esac
13648
13649: see if getgrgid_r exists
13650set getgrgid_r d_getgrgid_r
13651eval $inlibc
13652case "$d_getgrgid_r" in
13653"$define")
13654 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13655 case "$d_getgrgid_r_proto:$usethreads" in
13656 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13657 set d_getgrgid_r_proto getgrgid_r $hdrs
13658 eval $hasproto ;;
13659 *) ;;
13660 esac
13661 case "$d_getgrgid_r_proto" in
13662 define)
10bc17b6
JH
13663 case "$getgrgid_r_proto" in
13664 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
61c26d18 13665 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
10bc17b6
JH
13666 esac
13667 case "$getgrgid_r_proto" in
13668 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
61c26d18 13669 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
10bc17b6
JH
13670 esac
13671 case "$getgrgid_r_proto" in
13672 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13673 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
10bc17b6
JH
13674 esac
13675 case "$getgrgid_r_proto" in
13676 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
61c26d18 13677 ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
10bc17b6
JH
13678 esac
13679 case "$getgrgid_r_proto" in
90e831dc 13680 ''|0) d_getgrgid_r=undef
10bc17b6 13681 getgrgid_r_proto=0
a48ec845 13682 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13683 * ) case "$getgrgid_r_proto" in
13684 REENTRANT_PROTO*) ;;
13685 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13686 esac
13687 echo "Prototype: $try" ;;
13688 esac
13689 ;;
c18e646a
JH
13690 *) case "$usethreads" in
13691 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13692 esac
90e831dc
SB
13693 d_getgrgid_r=undef
13694 getgrgid_r_proto=0
c18e646a 13695 ;;
a48ec845
JH
13696 esac
13697 ;;
10bc17b6
JH
13698*) getgrgid_r_proto=0
13699 ;;
13700esac
13701
13702: see if getgrnam_r exists
13703set getgrnam_r d_getgrnam_r
13704eval $inlibc
13705case "$d_getgrnam_r" in
13706"$define")
13707 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13708 case "$d_getgrnam_r_proto:$usethreads" in
13709 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13710 set d_getgrnam_r_proto getgrnam_r $hdrs
13711 eval $hasproto ;;
13712 *) ;;
13713 esac
13714 case "$d_getgrnam_r_proto" in
13715 define)
10bc17b6
JH
13716 case "$getgrnam_r_proto" in
13717 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
61c26d18 13718 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
10bc17b6
JH
13719 esac
13720 case "$getgrnam_r_proto" in
13721 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
61c26d18 13722 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
10bc17b6
JH
13723 esac
13724 case "$getgrnam_r_proto" in
13725 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
61c26d18 13726 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
10bc17b6
JH
13727 esac
13728 case "$getgrnam_r_proto" in
13729 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13730 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
10bc17b6
JH
13731 esac
13732 case "$getgrnam_r_proto" in
13733 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
61c26d18 13734 ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
10bc17b6
JH
13735 esac
13736 case "$getgrnam_r_proto" in
90e831dc 13737 ''|0) d_getgrnam_r=undef
10bc17b6 13738 getgrnam_r_proto=0
a48ec845 13739 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13740 * ) case "$getgrnam_r_proto" in
13741 REENTRANT_PROTO*) ;;
13742 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13743 esac
13744 echo "Prototype: $try" ;;
13745 esac
13746 ;;
c18e646a
JH
13747 *) case "$usethreads" in
13748 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13749 esac
90e831dc
SB
13750 d_getgrnam_r=undef
13751 getgrnam_r_proto=0
c18e646a 13752 ;;
a48ec845
JH
13753 esac
13754 ;;
10bc17b6
JH
13755*) getgrnam_r_proto=0
13756 ;;
13757esac
13758
b4eb6b3d
JH
13759: see if gethostbyaddr exists
13760set gethostbyaddr d_gethbyaddr
13761eval $inlibc
13762
13763: see if gethostbyname exists
13764set gethostbyname d_gethbyname
13765eval $inlibc
13766
13767: see if gethostent exists
13768set gethostent d_gethent
13769eval $inlibc
13770
13771: see how we will look up host name
13772echo " "
13773call=''
13774if set gethostname val -f d_gethname; eval $csym; $val; then
13775 echo 'gethostname() found.' >&4
13776 d_gethname="$define"
13777 call=gethostname
13778fi
13779if set uname val -f d_uname; eval $csym; $val; then
13780 if ./xenix; then
13781 $cat <<'EOM'
13782uname() was found, but you're running xenix, and older versions of xenix
13783have a broken uname(). If you don't really know whether your xenix is old
13784enough to have a broken system call, use the default answer.
13785
13786EOM
13787 dflt=y
13788 case "$d_uname" in
13789 "$define") dflt=n;;
13790 esac
13791 rp='Is your uname() broken?'
13792 . ./myread
13793 case "$ans" in
13794 n*) d_uname="$define"; call=uname;;
13795 esac
13796 else
13797 echo 'uname() found.' >&4
13798 d_uname="$define"
13799 case "$call" in
13800 '') call=uname ;;
13801 esac
13802 fi
13803fi
13804case "$d_gethname" in
13805'') d_gethname="$undef";;
13806esac
13807case "$d_uname" in
13808'') d_uname="$undef";;
13809esac
13810case "$d_uname$d_gethname" in
13811*define*)
13812 dflt=n
13813 cat <<EOM
613d6c3e 13814
b4eb6b3d
JH
13815Every now and then someone has a $call() that lies about the hostname
13816but can't be fixed for political or economic reasons. If you wish, I can
13817pretend $call() isn't there and maybe compute hostname at run-time
13818thanks to the '$phostname' command.
13819
13820EOM
13821 rp="Shall I ignore $call() from now on?"
13822 . ./myread
13823 case "$ans" in
13824 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13825 esac;;
13826esac
13827case "$phostname" in
13828'') aphostname='';;
13829*) case "$aphostname" in
13830 /*) ;;
13831 *) set X $phostname
13832 shift
13833 file=$1
13834 shift
13835 file=`./loc $file $file $pth`
13836 aphostname=`echo $file $*`
13837 ;;
13838 esac
13839 ;;
13840esac
13841case "$d_uname$d_gethname" in
13842*define*) ;;
13843*)
13844 case "$phostname" in
13845 '')
13846 echo "There will be no way for $package to get your hostname." >&4;;
13847 *)
13848 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13849 ;;
13850 esac;;
13851esac
13852case "$d_phostname" in
13853'') d_phostname="$undef";;
13854esac
13855
10bc17b6
JH
13856: see if gethostbyaddr_r exists
13857set gethostbyaddr_r d_gethostbyaddr_r
13858eval $inlibc
13859case "$d_gethostbyaddr_r" in
13860"$define")
13861 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13862 case "$d_gethostbyaddr_r_proto:$usethreads" in
13863 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13864 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13865 eval $hasproto ;;
13866 *) ;;
13867 esac
13868 case "$d_gethostbyaddr_r_proto" in
13869 define)
10bc17b6
JH
13870 case "$gethostbyaddr_r_proto" in
13871 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13872 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
10bc17b6
JH
13873 esac
13874 case "$gethostbyaddr_r_proto" in
13875 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
61c26d18 13876 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
10bc17b6
JH
13877 esac
13878 case "$gethostbyaddr_r_proto" in
13879 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13880 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
10bc17b6
JH
13881 esac
13882 case "$gethostbyaddr_r_proto" in
13883 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
61c26d18 13884 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
10bc17b6
JH
13885 esac
13886 case "$gethostbyaddr_r_proto" in
13887 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
61c26d18 13888 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
10bc17b6
JH
13889 esac
13890 case "$gethostbyaddr_r_proto" in
13891 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13892 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
10bc17b6
JH
13893 esac
13894 case "$gethostbyaddr_r_proto" in
13895 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
61c26d18 13896 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
10bc17b6
JH
13897 esac
13898 case "$gethostbyaddr_r_proto" in
13899 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
61c26d18 13900 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
10bc17b6
JH
13901 esac
13902 case "$gethostbyaddr_r_proto" in
13903 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
61c26d18 13904 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
10bc17b6
JH
13905 esac
13906 case "$gethostbyaddr_r_proto" in
13907 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
61c26d18 13908 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
10bc17b6
JH
13909 esac
13910 case "$gethostbyaddr_r_proto" in
a845a0d4 13911 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13912 ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
a845a0d4
JH
13913 esac
13914 case "$gethostbyaddr_r_proto" in
90e831dc 13915 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13916 gethostbyaddr_r_proto=0
a48ec845 13917 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13918 * ) case "$gethostbyaddr_r_proto" in
13919 REENTRANT_PROTO*) ;;
13920 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13921 esac
13922 echo "Prototype: $try" ;;
13923 esac
13924 ;;
c18e646a
JH
13925 *) case "$usethreads" in
13926 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13927 esac
90e831dc
SB
13928 d_gethostbyaddr_r=undef
13929 gethostbyaddr_r_proto=0
c18e646a 13930 ;;
a48ec845
JH
13931 esac
13932 ;;
10bc17b6
JH
13933*) gethostbyaddr_r_proto=0
13934 ;;
13935esac
13936
13937: see if gethostbyname_r exists
13938set gethostbyname_r d_gethostbyname_r
13939eval $inlibc
13940case "$d_gethostbyname_r" in
13941"$define")
13942 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13943 case "$d_gethostbyname_r_proto:$usethreads" in
13944 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13945 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13946 eval $hasproto ;;
13947 *) ;;
13948 esac
13949 case "$d_gethostbyname_r_proto" in
13950 define)
10bc17b6
JH
13951 case "$gethostbyname_r_proto" in
13952 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 13953 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
13954 esac
13955 case "$gethostbyname_r_proto" in
13956 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
61c26d18 13957 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
10bc17b6
JH
13958 esac
13959 case "$gethostbyname_r_proto" in
13960 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
61c26d18 13961 ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
10bc17b6
JH
13962 esac
13963 case "$gethostbyname_r_proto" in
90e831dc 13964 ''|0) d_gethostbyname_r=undef
10bc17b6 13965 gethostbyname_r_proto=0
a48ec845 13966 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13967 * ) case "$gethostbyname_r_proto" in
13968 REENTRANT_PROTO*) ;;
13969 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13970 esac
13971 echo "Prototype: $try" ;;
13972 esac
13973 ;;
c18e646a
JH
13974 *) case "$usethreads" in
13975 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13976 esac
90e831dc
SB
13977 d_gethostbyname_r=undef
13978 gethostbyname_r_proto=0
c18e646a 13979 ;;
a48ec845
JH
13980 esac
13981 ;;
10bc17b6
JH
13982*) gethostbyname_r_proto=0
13983 ;;
13984esac
13985
13986: see if gethostent_r exists
13987set gethostent_r d_gethostent_r
13988eval $inlibc
13989case "$d_gethostent_r" in
13990"$define")
13991 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13992 case "$d_gethostent_r_proto:$usethreads" in
13993 ":define") d_gethostent_r_proto=define
a48ec845
JH
13994 set d_gethostent_r_proto gethostent_r $hdrs
13995 eval $hasproto ;;
13996 *) ;;
13997 esac
13998 case "$d_gethostent_r_proto" in
13999 define)
10bc17b6
JH
14000 case "$gethostent_r_proto" in
14001 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
61c26d18 14002 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
10bc17b6
JH
14003 esac
14004 case "$gethostent_r_proto" in
14005 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 14006 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
10bc17b6
JH
14007 esac
14008 case "$gethostent_r_proto" in
14009 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
61c26d18 14010 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
10bc17b6
JH
14011 esac
14012 case "$gethostent_r_proto" in
14013 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
61c26d18 14014 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
10bc17b6
JH
14015 esac
14016 case "$gethostent_r_proto" in
14017 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
61c26d18 14018 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
10bc17b6
JH
14019 esac
14020 case "$gethostent_r_proto" in
14021 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
61c26d18 14022 ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
10bc17b6
JH
14023 esac
14024 case "$gethostent_r_proto" in
90e831dc 14025 ''|0) d_gethostent_r=undef
10bc17b6 14026 gethostent_r_proto=0
a48ec845 14027 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14028 * ) case "$gethostent_r_proto" in
14029 REENTRANT_PROTO*) ;;
14030 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14031 esac
14032 echo "Prototype: $try" ;;
14033 esac
14034 ;;
c18e646a
JH
14035 *) case "$usethreads" in
14036 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14037 esac
90e831dc
SB
14038 d_gethostent_r=undef
14039 gethostent_r_proto=0
c18e646a 14040 ;;
a48ec845
JH
14041 esac
14042 ;;
10bc17b6
JH
14043*) gethostent_r_proto=0
14044 ;;
14045esac
b4eb6b3d
JH
14046
14047: see if prototypes for various gethostxxx netdb.h functions are available
14048echo " "
14049set d_gethostprotos gethostent $i_netdb netdb.h
14050eval $hasproto
14051
4e0554ec
JH
14052: see if getitimer exists
14053set getitimer d_getitimer
14054eval $inlibc
14055
b4eb6b3d
JH
14056: see if getlogin exists
14057set getlogin d_getlogin
14058eval $inlibc
14059
10bc17b6
JH
14060: see if getlogin_r exists
14061set getlogin_r d_getlogin_r
14062eval $inlibc
14063case "$d_getlogin_r" in
14064"$define")
14065 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
14066 case "$d_getlogin_r_proto:$usethreads" in
14067 ":define") d_getlogin_r_proto=define
a48ec845
JH
14068 set d_getlogin_r_proto getlogin_r $hdrs
14069 eval $hasproto ;;
14070 *) ;;
14071 esac
14072 case "$d_getlogin_r_proto" in
14073 define)
10bc17b6
JH
14074 case "$getlogin_r_proto" in
14075 ''|0) try='int getlogin_r(char*, size_t);'
61c26d18 14076 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
10bc17b6
JH
14077 esac
14078 case "$getlogin_r_proto" in
14079 ''|0) try='int getlogin_r(char*, int);'
61c26d18 14080 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
10bc17b6
JH
14081 esac
14082 case "$getlogin_r_proto" in
14083 ''|0) try='char* getlogin_r(char*, size_t);'
61c26d18 14084 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
10bc17b6
JH
14085 esac
14086 case "$getlogin_r_proto" in
14087 ''|0) try='char* getlogin_r(char*, int);'
61c26d18 14088 ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
10bc17b6
JH
14089 esac
14090 case "$getlogin_r_proto" in
90e831dc 14091 ''|0) d_getlogin_r=undef
10bc17b6 14092 getlogin_r_proto=0
a48ec845 14093 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14094 * ) case "$getlogin_r_proto" in
14095 REENTRANT_PROTO*) ;;
14096 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14097 esac
14098 echo "Prototype: $try" ;;
14099 esac
14100 ;;
c18e646a
JH
14101 *) case "$usethreads" in
14102 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14103 esac
90e831dc
SB
14104 d_getlogin_r=undef
14105 getlogin_r_proto=0
c18e646a 14106 ;;
a48ec845
JH
14107 esac
14108 ;;
10bc17b6
JH
14109*) getlogin_r_proto=0
14110 ;;
14111esac
14112
b4eb6b3d
JH
14113: see if getmnt exists
14114set getmnt d_getmnt
14115eval $inlibc
14116
14117: see if getmntent exists
14118set getmntent d_getmntent
14119eval $inlibc
14120
5086dff9
MB
14121: see if getnameinfo exists
14122set getnameinfo d_getnameinfo
14123eval $inlibc
14124
b4eb6b3d
JH
14125: see if getnetbyaddr exists
14126set getnetbyaddr d_getnbyaddr
14127eval $inlibc
14128
14129: see if getnetbyname exists
14130set getnetbyname d_getnbyname
14131eval $inlibc
14132
14133: see if getnetent exists
14134set getnetent d_getnent
14135eval $inlibc
14136
10bc17b6
JH
14137: see if getnetbyaddr_r exists
14138set getnetbyaddr_r d_getnetbyaddr_r
14139eval $inlibc
14140case "$d_getnetbyaddr_r" in
14141"$define")
14142 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14143 case "$d_getnetbyaddr_r_proto:$usethreads" in
14144 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
14145 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14146 eval $hasproto ;;
14147 *) ;;
14148 esac
14149 case "$d_getnetbyaddr_r_proto" in
14150 define)
10bc17b6
JH
14151 case "$getnetbyaddr_r_proto" in
14152 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14153 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
10bc17b6
JH
14154 esac
14155 case "$getnetbyaddr_r_proto" in
14156 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14157 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
10bc17b6
JH
14158 esac
14159 case "$getnetbyaddr_r_proto" in
14160 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
61c26d18 14161 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
10bc17b6
JH
14162 esac
14163 case "$getnetbyaddr_r_proto" in
14164 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
61c26d18 14165 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
10bc17b6
JH
14166 esac
14167 case "$getnetbyaddr_r_proto" in
14168 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
61c26d18 14169 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
10bc17b6
JH
14170 esac
14171 case "$getnetbyaddr_r_proto" in
14172 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
61c26d18 14173 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
10bc17b6
JH
14174 esac
14175 case "$getnetbyaddr_r_proto" in
14176 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
61c26d18 14177 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
10bc17b6
JH
14178 esac
14179 case "$getnetbyaddr_r_proto" in
a845a0d4 14180 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14181 ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
a845a0d4
JH
14182 esac
14183 case "$getnetbyaddr_r_proto" in
90e831dc 14184 ''|0) d_getnetbyaddr_r=undef
10bc17b6 14185 getnetbyaddr_r_proto=0
a48ec845 14186 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14187 * ) case "$getnetbyaddr_r_proto" in
14188 REENTRANT_PROTO*) ;;
14189 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14190 esac
14191 echo "Prototype: $try" ;;
14192 esac
14193 ;;
c18e646a
JH
14194 *) case "$usethreads" in
14195 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14196 esac
90e831dc
SB
14197 d_getnetbyaddr_r=undef
14198 getnetbyaddr_r_proto=0
c18e646a 14199 ;;
a48ec845
JH
14200 esac
14201 ;;
10bc17b6
JH
14202*) getnetbyaddr_r_proto=0
14203 ;;
14204esac
14205
14206: see if getnetbyname_r exists
14207set getnetbyname_r d_getnetbyname_r
14208eval $inlibc
14209case "$d_getnetbyname_r" in
14210"$define")
14211 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14212 case "$d_getnetbyname_r_proto:$usethreads" in
14213 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
14214 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14215 eval $hasproto ;;
14216 *) ;;
14217 esac
14218 case "$d_getnetbyname_r_proto" in
14219 define)
10bc17b6
JH
14220 case "$getnetbyname_r_proto" in
14221 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14222 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
10bc17b6
JH
14223 esac
14224 case "$getnetbyname_r_proto" in
14225 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14226 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
10bc17b6
JH
14227 esac
14228 case "$getnetbyname_r_proto" in
14229 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
61c26d18 14230 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
10bc17b6
JH
14231 esac
14232 case "$getnetbyname_r_proto" in
14233 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
61c26d18 14234 ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
10bc17b6
JH
14235 esac
14236 case "$getnetbyname_r_proto" in
90e831dc 14237 ''|0) d_getnetbyname_r=undef
10bc17b6 14238 getnetbyname_r_proto=0
a48ec845 14239 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14240 * ) case "$getnetbyname_r_proto" in
14241 REENTRANT_PROTO*) ;;
14242 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14243 esac
14244 echo "Prototype: $try" ;;
14245 esac
14246 ;;
c18e646a
JH
14247 *) case "$usethreads" in
14248 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14249 esac
90e831dc
SB
14250 d_getnetbyname_r=undef
14251 getnetbyname_r_proto=0
c18e646a 14252 ;;
a48ec845
JH
14253 esac
14254 ;;
10bc17b6
JH
14255*) getnetbyname_r_proto=0
14256 ;;
14257esac
14258
14259: see if getnetent_r exists
14260set getnetent_r d_getnetent_r
14261eval $inlibc
14262case "$d_getnetent_r" in
14263"$define")
14264 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14265 case "$d_getnetent_r_proto:$usethreads" in
14266 ":define") d_getnetent_r_proto=define
a48ec845
JH
14267 set d_getnetent_r_proto getnetent_r $hdrs
14268 eval $hasproto ;;
14269 *) ;;
14270 esac
14271 case "$d_getnetent_r_proto" in
14272 define)
10bc17b6
JH
14273 case "$getnetent_r_proto" in
14274 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
61c26d18 14275 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
10bc17b6
JH
14276 esac
14277 case "$getnetent_r_proto" in
14278 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14279 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
10bc17b6
JH
14280 esac
14281 case "$getnetent_r_proto" in
14282 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
61c26d18 14283 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
10bc17b6
JH
14284 esac
14285 case "$getnetent_r_proto" in
14286 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
61c26d18 14287 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
10bc17b6
JH
14288 esac
14289 case "$getnetent_r_proto" in
14290 ''|0) try='int getnetent_r(struct netent*, char*, int);'
61c26d18 14291 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
10bc17b6
JH
14292 esac
14293 case "$getnetent_r_proto" in
14294 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
61c26d18 14295 ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
10bc17b6
JH
14296 esac
14297 case "$getnetent_r_proto" in
90e831dc 14298 ''|0) d_getnetent_r=undef
10bc17b6 14299 getnetent_r_proto=0
a48ec845 14300 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14301 * ) case "$getnetent_r_proto" in
14302 REENTRANT_PROTO*) ;;
14303 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14304 esac
14305 echo "Prototype: $try" ;;
14306 esac
14307 ;;
c18e646a
JH
14308 *) case "$usethreads" in
14309 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14310 esac
90e831dc
SB
14311 d_getnetent_r=undef
14312 getnetent_r_proto=0
c18e646a 14313 ;;
a48ec845
JH
14314 esac
14315 ;;
10bc17b6
JH
14316*) getnetent_r_proto=0
14317 ;;
14318esac
14319
b4eb6b3d
JH
14320: see if prototypes for various getnetxxx netdb.h functions are available
14321echo " "
14322set d_getnetprotos getnetent $i_netdb netdb.h
14323eval $hasproto
14324
0c0643d0
JH
14325: see if getpagesize exists
14326set getpagesize d_getpagsz
14327eval $inlibc
14328
34f1896b 14329: Optional checks for getprotobyname and getprotobynumber
b4eb6b3d
JH
14330
14331: see if getprotobyname exists
14332set getprotobyname d_getpbyname
14333eval $inlibc
14334
14335: see if getprotobynumber exists
14336set getprotobynumber d_getpbynumber
14337eval $inlibc
14338
14339: see if getprotoent exists
14340set getprotoent d_getpent
14341eval $inlibc
14342
14343: see if getpgid exists
14344set getpgid d_getpgid
14345eval $inlibc
14346
14347: see if getpgrp2 exists
14348set getpgrp2 d_getpgrp2
14349eval $inlibc
14350
14351: see if getppid exists
14352set getppid d_getppid
14353eval $inlibc
14354
14355: see if getpriority exists
14356set getpriority d_getprior
14357eval $inlibc
14358
10bc17b6
JH
14359: see if getprotobyname_r exists
14360set getprotobyname_r d_getprotobyname_r
14361eval $inlibc
14362case "$d_getprotobyname_r" in
14363"$define")
14364 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14365 case "$d_getprotobyname_r_proto:$usethreads" in
14366 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
14367 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14368 eval $hasproto ;;
14369 *) ;;
14370 esac
14371 case "$d_getprotobyname_r_proto" in
14372 define)
10bc17b6
JH
14373 case "$getprotobyname_r_proto" in
14374 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14375 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
10bc17b6
JH
14376 esac
14377 case "$getprotobyname_r_proto" in
14378 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
61c26d18 14379 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
10bc17b6
JH
14380 esac
14381 case "$getprotobyname_r_proto" in
14382 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
61c26d18 14383 ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
10bc17b6
JH
14384 esac
14385 case "$getprotobyname_r_proto" in
90e831dc 14386 ''|0) d_getprotobyname_r=undef
10bc17b6 14387 getprotobyname_r_proto=0
a48ec845 14388 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14389 * ) case "$getprotobyname_r_proto" in
14390 REENTRANT_PROTO*) ;;
14391 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14392 esac
14393 echo "Prototype: $try" ;;
14394 esac
14395 ;;
c18e646a
JH
14396 *) case "$usethreads" in
14397 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14398 esac
90e831dc
SB
14399 d_getprotobyname_r=undef
14400 getprotobyname_r_proto=0
c18e646a 14401 ;;
a48ec845
JH
14402 esac
14403 ;;
10bc17b6
JH
14404*) getprotobyname_r_proto=0
14405 ;;
14406esac
14407
14408: see if getprotobynumber_r exists
14409set getprotobynumber_r d_getprotobynumber_r
14410eval $inlibc
14411case "$d_getprotobynumber_r" in
14412"$define")
14413 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14414 case "$d_getprotobynumber_r_proto:$usethreads" in
14415 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
14416 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14417 eval $hasproto ;;
14418 *) ;;
14419 esac
14420 case "$d_getprotobynumber_r_proto" in
14421 define)
10bc17b6
JH
14422 case "$getprotobynumber_r_proto" in
14423 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14424 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
10bc17b6
JH
14425 esac
14426 case "$getprotobynumber_r_proto" in
14427 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
61c26d18 14428 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
10bc17b6
JH
14429 esac
14430 case "$getprotobynumber_r_proto" in
14431 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
61c26d18 14432 ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
10bc17b6
JH
14433 esac
14434 case "$getprotobynumber_r_proto" in
90e831dc 14435 ''|0) d_getprotobynumber_r=undef
10bc17b6 14436 getprotobynumber_r_proto=0
a48ec845 14437 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14438 * ) case "$getprotobynumber_r_proto" in
14439 REENTRANT_PROTO*) ;;
14440 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14441 esac
14442 echo "Prototype: $try" ;;
14443 esac
14444 ;;
c18e646a
JH
14445 *) case "$usethreads" in
14446 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14447 esac
90e831dc
SB
14448 d_getprotobynumber_r=undef
14449 getprotobynumber_r_proto=0
c18e646a 14450 ;;
a48ec845
JH
14451 esac
14452 ;;
10bc17b6
JH
14453*) getprotobynumber_r_proto=0
14454 ;;
14455esac
14456
14457: see if getprotoent_r exists
14458set getprotoent_r d_getprotoent_r
14459eval $inlibc
14460case "$d_getprotoent_r" in
14461"$define")
14462 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14463 case "$d_getprotoent_r_proto:$usethreads" in
14464 ":define") d_getprotoent_r_proto=define
a48ec845
JH
14465 set d_getprotoent_r_proto getprotoent_r $hdrs
14466 eval $hasproto ;;
14467 *) ;;
14468 esac
14469 case "$d_getprotoent_r_proto" in
14470 define)
10bc17b6
JH
14471 case "$getprotoent_r_proto" in
14472 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
61c26d18 14473 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
10bc17b6
JH
14474 esac
14475 case "$getprotoent_r_proto" in
14476 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
61c26d18 14477 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
10bc17b6
JH
14478 esac
14479 case "$getprotoent_r_proto" in
14480 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
61c26d18 14481 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
10bc17b6
JH
14482 esac
14483 case "$getprotoent_r_proto" in
14484 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
61c26d18 14485 ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
10bc17b6
JH
14486 esac
14487 case "$getprotoent_r_proto" in
90e831dc 14488 ''|0) d_getprotoent_r=undef
10bc17b6 14489 getprotoent_r_proto=0
a48ec845 14490 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14491 * ) case "$getprotoent_r_proto" in
14492 REENTRANT_PROTO*) ;;
14493 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14494 esac
14495 echo "Prototype: $try" ;;
14496 esac
14497 ;;
c18e646a
JH
14498 *) case "$usethreads" in
14499 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14500 esac
90e831dc
SB
14501 d_getprotoent_r=undef
14502 getprotoent_r_proto=0
c18e646a 14503 ;;
a48ec845
JH
14504 esac
14505 ;;
10bc17b6
JH
14506*) getprotoent_r_proto=0
14507 ;;
14508esac
14509
b4eb6b3d
JH
14510: see if prototypes for various getprotoxxx netdb.h functions are available
14511echo " "
14512set d_getprotoprotos getprotoent $i_netdb netdb.h
14513eval $hasproto
14514
14515: see if getprpwnam exists
14516set getprpwnam d_getprpwnam
14517eval $inlibc
14518
14519: see if getpwent exists
14520set getpwent d_getpwent
14521eval $inlibc
14522
10bc17b6
JH
14523: see if getpwent_r exists
14524set getpwent_r d_getpwent_r
14525eval $inlibc
14526case "$d_getpwent_r" in
14527"$define")
14528 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14529 case "$d_getpwent_r_proto:$usethreads" in
14530 ":define") d_getpwent_r_proto=define
a48ec845
JH
14531 set d_getpwent_r_proto getpwent_r $hdrs
14532 eval $hasproto ;;
14533 *) ;;
14534 esac
14535 case "$d_getpwent_r_proto" in
14536 define)
10bc17b6
JH
14537 case "$getpwent_r_proto" in
14538 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14539 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
10bc17b6
JH
14540 esac
14541 case "$getpwent_r_proto" in
14542 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
61c26d18 14543 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
10bc17b6
JH
14544 esac
14545 case "$getpwent_r_proto" in
14546 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
61c26d18 14547 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
10bc17b6
JH
14548 esac
14549 case "$getpwent_r_proto" in
14550 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
61c26d18 14551 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
10bc17b6
JH
14552 esac
14553 case "$getpwent_r_proto" in
14554 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
61c26d18 14555 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
10bc17b6
JH
14556 esac
14557 case "$getpwent_r_proto" in
14558 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
61c26d18 14559 ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
10bc17b6
JH
14560 esac
14561 case "$getpwent_r_proto" in
90e831dc 14562 ''|0) d_getpwent_r=undef
10bc17b6 14563 getpwent_r_proto=0
a48ec845 14564 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14565 * ) case "$getpwent_r_proto" in
14566 REENTRANT_PROTO*) ;;
14567 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14568 esac
14569 echo "Prototype: $try" ;;
14570 esac
14571 ;;
c18e646a
JH
14572 *) case "$usethreads" in
14573 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14574 esac
90e831dc
SB
14575 d_getpwent_r=undef
14576 getpwent_r_proto=0
c18e646a 14577 ;;
a48ec845
JH
14578 esac
14579 ;;
10bc17b6
JH
14580*) getpwent_r_proto=0
14581 ;;
14582esac
14583
14584: see if getpwnam_r exists
14585set getpwnam_r d_getpwnam_r
14586eval $inlibc
14587case "$d_getpwnam_r" in
14588"$define")
14589 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14590 case "$d_getpwnam_r_proto:$usethreads" in
14591 ":define") d_getpwnam_r_proto=define
a48ec845
JH
14592 set d_getpwnam_r_proto getpwnam_r $hdrs
14593 eval $hasproto ;;
14594 *) ;;
14595 esac
14596 case "$d_getpwnam_r_proto" in
14597 define)
10bc17b6
JH
14598 case "$getpwnam_r_proto" in
14599 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14600 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14601 esac
14602 case "$getpwnam_r_proto" in
14603 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
61c26d18 14604 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
10bc17b6
JH
14605 esac
14606 case "$getpwnam_r_proto" in
14607 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14608 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
10bc17b6
JH
14609 esac
14610 case "$getpwnam_r_proto" in
14611 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
61c26d18 14612 ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
10bc17b6
JH
14613 esac
14614 case "$getpwnam_r_proto" in
90e831dc 14615 ''|0) d_getpwnam_r=undef
10bc17b6 14616 getpwnam_r_proto=0
a48ec845 14617 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14618 * ) case "$getpwnam_r_proto" in
14619 REENTRANT_PROTO*) ;;
14620 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14621 esac
14622 echo "Prototype: $try" ;;
14623 esac
14624 ;;
c18e646a
JH
14625 *) case "$usethreads" in
14626 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14627 esac
90e831dc
SB
14628 d_getpwnam_r=undef
14629 getpwnam_r_proto=0
c18e646a 14630 ;;
a48ec845
JH
14631 esac
14632 ;;
10bc17b6
JH
14633*) getpwnam_r_proto=0
14634 ;;
14635esac
14636
14637: see if getpwuid_r exists
14638set getpwuid_r d_getpwuid_r
14639eval $inlibc
14640case "$d_getpwuid_r" in
14641"$define")
14642 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14643 case "$d_getpwuid_r_proto:$usethreads" in
14644 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14645 set d_getpwuid_r_proto getpwuid_r $hdrs
14646 eval $hasproto ;;
14647 *) ;;
14648 esac
14649 case "$d_getpwuid_r_proto" in
14650 define)
10bc17b6
JH
14651 case "$getpwuid_r_proto" in
14652 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
61c26d18 14653 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
10bc17b6
JH
14654 esac
14655 case "$getpwuid_r_proto" in
14656 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
61c26d18 14657 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
10bc17b6
JH
14658 esac
14659 case "$getpwuid_r_proto" in
14660 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14661 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
10bc17b6
JH
14662 esac
14663 case "$getpwuid_r_proto" in
14664 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
61c26d18 14665 ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
10bc17b6
JH
14666 esac
14667 case "$getpwuid_r_proto" in
90e831dc 14668 ''|0) d_getpwuid_r=undef
10bc17b6 14669 getpwuid_r_proto=0
a48ec845 14670 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14671 * ) case "$getpwuid_r_proto" in
14672 REENTRANT_PROTO*) ;;
14673 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14674 esac
14675 echo "Prototype: $try" ;;
14676 esac
14677 ;;
c18e646a
JH
14678 *) case "$usethreads" in
14679 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14680 esac
90e831dc
SB
14681 d_getpwuid_r=undef
14682 getpwuid_r_proto=0
c18e646a 14683 ;;
a48ec845
JH
14684 esac
14685 ;;
10bc17b6
JH
14686*) getpwuid_r_proto=0
14687 ;;
14688esac
14689
34f1896b 14690: Optional checks for getsbyname and getsbyport
b4eb6b3d
JH
14691
14692: see if getservbyname exists
14693set getservbyname d_getsbyname
14694eval $inlibc
14695
14696: see if getservbyport exists
14697set getservbyport d_getsbyport
14698eval $inlibc
14699
14700: see if getservent exists
14701set getservent d_getsent
14702eval $inlibc
14703
10bc17b6
JH
14704: see if getservbyname_r exists
14705set getservbyname_r d_getservbyname_r
14706eval $inlibc
14707case "$d_getservbyname_r" in
14708"$define")
14709 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14710 case "$d_getservbyname_r_proto:$usethreads" in
14711 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14712 set d_getservbyname_r_proto getservbyname_r $hdrs
14713 eval $hasproto ;;
14714 *) ;;
14715 esac
14716 case "$d_getservbyname_r_proto" in
14717 define)
10bc17b6
JH
14718 case "$getservbyname_r_proto" in
14719 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14720 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
10bc17b6
JH
14721 esac
14722 case "$getservbyname_r_proto" in
14723 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
61c26d18 14724 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
10bc17b6
JH
14725 esac
14726 case "$getservbyname_r_proto" in
14727 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
61c26d18 14728 ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
10bc17b6
JH
14729 esac
14730 case "$getservbyname_r_proto" in
90e831dc 14731 ''|0) d_getservbyname_r=undef
10bc17b6 14732 getservbyname_r_proto=0
a48ec845 14733 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14734 * ) case "$getservbyname_r_proto" in
14735 REENTRANT_PROTO*) ;;
14736 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14737 esac
14738 echo "Prototype: $try" ;;
14739 esac
14740 ;;
c18e646a
JH
14741 *) case "$usethreads" in
14742 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14743 esac
90e831dc
SB
14744 d_getservbyname_r=undef
14745 getservbyname_r_proto=0
c18e646a 14746 ;;
a48ec845
JH
14747 esac
14748 ;;
10bc17b6
JH
14749*) getservbyname_r_proto=0
14750 ;;
14751esac
14752
14753: see if getservbyport_r exists
14754set getservbyport_r d_getservbyport_r
14755eval $inlibc
14756case "$d_getservbyport_r" in
14757"$define")
14758 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14759 case "$d_getservbyport_r_proto:$usethreads" in
14760 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14761 set d_getservbyport_r_proto getservbyport_r $hdrs
14762 eval $hasproto ;;
14763 *) ;;
14764 esac
14765 case "$d_getservbyport_r_proto" in
14766 define)
10bc17b6
JH
14767 case "$getservbyport_r_proto" in
14768 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
61c26d18 14769 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
10bc17b6
JH
14770 esac
14771 case "$getservbyport_r_proto" in
14772 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
61c26d18 14773 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
10bc17b6
JH
14774 esac
14775 case "$getservbyport_r_proto" in
14776 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
61c26d18 14777 ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
10bc17b6
JH
14778 esac
14779 case "$getservbyport_r_proto" in
90e831dc 14780 ''|0) d_getservbyport_r=undef
10bc17b6 14781 getservbyport_r_proto=0
a48ec845 14782 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14783 * ) case "$getservbyport_r_proto" in
14784 REENTRANT_PROTO*) ;;
14785 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14786 esac
14787 echo "Prototype: $try" ;;
14788 esac
14789 ;;
c18e646a
JH
14790 *) case "$usethreads" in
14791 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14792 esac
90e831dc
SB
14793 d_getservbyport_r=undef
14794 getservbyport_r_proto=0
c18e646a 14795 ;;
a48ec845
JH
14796 esac
14797 ;;
10bc17b6
JH
14798*) getservbyport_r_proto=0
14799 ;;
14800esac
14801
14802: see if getservent_r exists
14803set getservent_r d_getservent_r
14804eval $inlibc
14805case "$d_getservent_r" in
14806"$define")
14807 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14808 case "$d_getservent_r_proto:$usethreads" in
14809 ":define") d_getservent_r_proto=define
a48ec845
JH
14810 set d_getservent_r_proto getservent_r $hdrs
14811 eval $hasproto ;;
14812 *) ;;
14813 esac
14814 case "$d_getservent_r_proto" in
14815 define)
10bc17b6
JH
14816 case "$getservent_r_proto" in
14817 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
61c26d18 14818 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
10bc17b6
JH
14819 esac
14820 case "$getservent_r_proto" in
14821 ''|0) try='int getservent_r(struct servent*, char*, int);'
61c26d18 14822 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
10bc17b6
JH
14823 esac
14824 case "$getservent_r_proto" in
14825 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
61c26d18 14826 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
10bc17b6
JH
14827 esac
14828 case "$getservent_r_proto" in
14829 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
61c26d18 14830 ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
10bc17b6
JH
14831 esac
14832 case "$getservent_r_proto" in
90e831dc 14833 ''|0) d_getservent_r=undef
10bc17b6 14834 getservent_r_proto=0
a48ec845 14835 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14836 * ) case "$getservent_r_proto" in
14837 REENTRANT_PROTO*) ;;
14838 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14839 esac
14840 echo "Prototype: $try" ;;
14841 esac
14842 ;;
c18e646a
JH
14843 *) case "$usethreads" in
14844 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14845 esac
90e831dc
SB
14846 d_getservent_r=undef
14847 getservent_r_proto=0
c18e646a 14848 ;;
a48ec845
JH
14849 esac
14850 ;;
10bc17b6
JH
14851*) getservent_r_proto=0
14852 ;;
14853esac
14854
b4eb6b3d
JH
14855: see if prototypes for various getservxxx netdb.h functions are available
14856echo " "
14857set d_getservprotos getservent $i_netdb netdb.h
14858eval $hasproto
14859
14860: see if getspnam exists
14861set getspnam d_getspnam
14862eval $inlibc
14863
10bc17b6
JH
14864: see if this is a shadow.h system
14865set shadow.h i_shadow
14866eval $inhdr
14867
14868: see if getspnam_r exists
14869set getspnam_r d_getspnam_r
14870eval $inlibc
14871case "$d_getspnam_r" in
14872"$define")
14873 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14874 case "$d_getspnam_r_proto:$usethreads" in
14875 ":define") d_getspnam_r_proto=define
a48ec845
JH
14876 set d_getspnam_r_proto getspnam_r $hdrs
14877 eval $hasproto ;;
14878 *) ;;
14879 esac
14880 case "$d_getspnam_r_proto" in
14881 define)
10bc17b6
JH
14882 case "$getspnam_r_proto" in
14883 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
61c26d18 14884 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
10bc17b6
JH
14885 esac
14886 case "$getspnam_r_proto" in
14887 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
61c26d18 14888 ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
10bc17b6
JH
14889 esac
14890 case "$getspnam_r_proto" in
90e831dc 14891 ''|0) d_getspnam_r=undef
10bc17b6 14892 getspnam_r_proto=0
a48ec845 14893 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14894 * ) case "$getspnam_r_proto" in
14895 REENTRANT_PROTO*) ;;
14896 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14897 esac
14898 echo "Prototype: $try" ;;
14899 esac
14900 ;;
c18e646a
JH
14901 *) case "$usethreads" in
14902 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14903 esac
90e831dc
SB
14904 d_getspnam_r=undef
14905 getspnam_r_proto=0
c18e646a 14906 ;;
a48ec845
JH
14907 esac
14908 ;;
10bc17b6
JH
14909*) getspnam_r_proto=0
14910 ;;
14911esac
14912
b4eb6b3d
JH
14913: see if gettimeofday or ftime exists
14914set gettimeofday d_gettimeod
14915eval $inlibc
14916case "$d_gettimeod" in
14917"$undef")
14918 set ftime d_ftime
14919 eval $inlibc
14920 ;;
14921*)
14922 val="$undef"; set d_ftime; eval $setvar
14923 ;;
14924esac
14925case "$d_gettimeod$d_ftime" in
14926"$undef$undef")
14927 echo " "
14928 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14929 ;;
14930esac
14931
10bc17b6
JH
14932: see if gmtime_r exists
14933set gmtime_r d_gmtime_r
14934eval $inlibc
14935case "$d_gmtime_r" in
14936"$define")
d63eadf0 14937 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14938 case "$d_gmtime_r_proto:$usethreads" in
14939 ":define") d_gmtime_r_proto=define
a48ec845
JH
14940 set d_gmtime_r_proto gmtime_r $hdrs
14941 eval $hasproto ;;
14942 *) ;;
14943 esac
14944 case "$d_gmtime_r_proto" in
14945 define)
10bc17b6
JH
14946 case "$gmtime_r_proto" in
14947 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
61c26d18 14948 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
10bc17b6
JH
14949 esac
14950 case "$gmtime_r_proto" in
14951 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
61c26d18 14952 ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
10bc17b6
JH
14953 esac
14954 case "$gmtime_r_proto" in
90e831dc 14955 ''|0) d_gmtime_r=undef
10bc17b6 14956 gmtime_r_proto=0
a48ec845 14957 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14958 * ) case "$gmtime_r_proto" in
14959 REENTRANT_PROTO*) ;;
14960 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14961 esac
14962 echo "Prototype: $try" ;;
14963 esac
b4eb6b3d 14964 ;;
c18e646a
JH
14965 *) case "$usethreads" in
14966 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14967 esac
90e831dc
SB
14968 d_gmtime_r=undef
14969 gmtime_r_proto=0
c18e646a 14970 ;;
a48ec845
JH
14971 esac
14972 ;;
10bc17b6 14973*) gmtime_r_proto=0
b4eb6b3d
JH
14974 ;;
14975esac
14976
14977: see if hasmntopt exists
14978set hasmntopt d_hasmntopt
14979eval $inlibc
14980
14981: see if this is a netinet/in.h or sys/in.h system
14982set netinet/in.h i_niin sys/in.h i_sysin
14983eval $inhdr
14984
14985: see if arpa/inet.h has to be included
14986set arpa/inet.h i_arpainet
14987eval $inhdr
14988
14989: see if htonl --and friends-- exists
14990val=''
14991set htonl val
14992eval $inlibc
14993
14994: Maybe they are macros.
14995case "$val" in
14996$undef)
14997 $cat >htonl.c <<EOM
14998#include <stdio.h>
14999#include <sys/types.h>
15000#$i_niin I_NETINET_IN
15001#$i_sysin I_SYS_IN
15002#$i_arpainet I_ARPA_INET
15003#ifdef I_NETINET_IN
15004#include <netinet/in.h>
15005#endif
15006#ifdef I_SYS_IN
15007#include <sys/in.h>
15008#endif
15009#ifdef I_ARPA_INET
15010#include <arpa/inet.h>
15011#endif
15012#ifdef htonl
15013printf("Defined as a macro.");
15014#endif
15015EOM
15016 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15017 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15018 val="$define"
15019 echo "But it seems to be defined as a macro." >&4
15020 fi
15021 $rm -f htonl.?
15022 ;;
15023esac
15024set d_htonl
15025eval $setvar
15026
36adc09b
JH
15027: see if ilogbl exists
15028set ilogbl d_ilogbl
15029eval $inlibc
15030
b4eb6b3d
JH
15031: index or strchr
15032echo " "
15033if set index val -f; eval $csym; $val; then
15034 if set strchr val -f d_strchr; eval $csym; $val; then
15035 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15036 val="$define"
15037 vali="$undef"
15038 echo "strchr() found." >&4
15039 else
15040 val="$undef"
15041 vali="$define"
15042 echo "index() found." >&4
15043 fi
15044 else
15045 val="$undef"
15046 vali="$define"
8dfa8df9
JH
15047 echo "index() found." >&4
15048 fi
b4eb6b3d 15049else
8dfa8df9
JH
15050 if set strchr val -f d_strchr; eval $csym; $val; then
15051 val="$define"
15052 vali="$undef"
15053 echo "strchr() found." >&4
15054 else
15055 echo "No index() or strchr() found!" >&4
15056 val="$undef"
15057 vali="$undef"
15058 fi
b4eb6b3d 15059fi
8dfa8df9
JH
15060set d_strchr; eval $setvar
15061val="$vali"
15062set d_index; eval $setvar
15063
15064: check whether inet_aton exists
15065set inet_aton d_inetaton
15066eval $inlibc
b4eb6b3d 15067
5086dff9
MB
15068: see if inet_ntop exists
15069set inet_ntop d_inetntop
15070eval $inlibc
15071
15072: see if inet_pton exists
15073set inet_pton d_inetpton
15074eval $inlibc
15075
b4eb6b3d
JH
15076: Look for isascii
15077echo " "
36adc09b 15078$cat >isascii.c <<EOCP
b4eb6b3d
JH
15079#include <stdio.h>
15080#include <ctype.h>
55954f19
JH
15081#$i_stdlib I_STDLIB
15082#ifdef I_STDLIB
15083#include <stdlib.h>
15084#endif
b4eb6b3d
JH
15085int main() {
15086 int c = 'A';
15087 if (isascii(c))
15088 exit(0);
15089 else
15090 exit(1);
15091}
15092EOCP
15093set isascii
15094if eval $compile; then
15095 echo "isascii() found." >&4
15096 val="$define"
15097else
15098 echo "isascii() NOT found." >&4
15099 val="$undef"
15100fi
15101set d_isascii
15102eval $setvar
15103$rm -f isascii*
15104
269a7913
MB
15105: Look for isblank
15106echo " "
15107$cat >isblank.c <<'EOCP'
15108#include <stdio.h>
15109#include <ctype.h>
15110int main() {
9f791ac6 15111 int c = ' ';
269a7913 15112 if (isblank(c))
1c6eef9a 15113 return 0 ;
269a7913 15114 else
1c6eef9a 15115 return 1 ;
269a7913
MB
15116}
15117EOCP
15118if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15119 echo "isblank() found." >&4
15120 val="$define"
15121else
15122 echo "isblank() NOT found." >&4
15123 val="$undef"
15124fi
15125set d_isblank
15126eval $setvar
15127$rm -f isblank*
15128
758a5d79
JH
15129: see if isfinite exists
15130set isfinite d_isfinite
15131eval $inlibc
15132
15133: see if isinf exists
15134set isinf d_isinf
15135eval $inlibc
15136
b4eb6b3d
JH
15137: see if isnan exists
15138set isnan d_isnan
15139eval $inlibc
15140
15141: see if isnanl exists
15142set isnanl d_isnanl
15143eval $inlibc
15144
15145: see if killpg exists
15146set killpg d_killpg
15147eval $inlibc
15148
15149: see if lchown exists
15150echo " "
15151$cat > try.c <<'EOCP'
15152/* System header to define __stub macros and hopefully few prototypes,
15153 which can conflict with char lchown(); below. */
15154#include <assert.h>
15155/* Override any gcc2 internal prototype to avoid an error. */
15156/* We use char because int might match the return type of a gcc2
15157 builtin and then its argument prototype would still apply. */
15158char lchown();
15159int main() {
15160 /* The GNU C library defines this for functions which it implements
15161 to always fail with ENOSYS. Some functions are actually named
15162 something starting with __ and the normal name is an alias. */
15163#if defined (__stub_lchown) || defined (__stub___lchown)
15164choke me
15165#else
15166lchown();
15167#endif
15168; return 0; }
15169EOCP
15170set try
15171if eval $compile; then
15172 $echo "lchown() found." >&4
15173 val="$define"
15174else
15175 $echo "lchown() NOT found." >&4
15176 val="$undef"
15177fi
15178set d_lchown
15179eval $setvar
15180
15181: See if number of significant digits in a double precision number is known
15182echo " "
15183$cat >ldbl_dig.c <<EOM
15184#$i_limits I_LIMITS
15185#$i_float I_FLOAT
15186#ifdef I_LIMITS
15187#include <limits.h>
15188#endif
15189#ifdef I_FLOAT
15190#include <float.h>
15191#endif
15192#ifdef LDBL_DIG
15193printf("Contains LDBL_DIG");
15194#endif
15195EOM
15196$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15197if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15198 echo "LDBL_DIG found." >&4
15199 val="$define"
15200else
15201 echo "LDBL_DIG NOT found." >&4
15202 val="$undef"
15203fi
15204$rm -f ldbl_dig.?
15205set d_ldbl_dig
15206eval $setvar
15207
0a0abfba
MB
15208: see if this is a math.h system
15209set math.h i_math
15210eval $inhdr
15211
613d6c3e 15212: check to see if math.h defines _LIB_VERSION
0a0abfba
MB
15213d_libm_lib_version="$undef"
15214case $i_math in
15215 $define)
0a0abfba
MB
15216 echo " "
15217 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15218 $cat >try.c <<EOCP
15219#include <unistd.h>
15220#include <math.h>
15221int main (int argc, char *argv[])
15222{
15223 printf ("%d\n", _LIB_VERSION);
15224 return (0);
15225 } /* main */
15226EOCP
15227 set try
15228 if eval $compile; then
15229 foo=`$run ./try`
15230 echo "Yes, it does ($foo)" >&4
15231 d_libm_lib_version="$define"
15232 else
4dd8f9b3 15233 echo "No, it does not (probably harmless)" >&4
0a0abfba 15234 fi
5b813a60 15235 $rm_try
0a0abfba
MB
15236 ;;
15237
15238 esac
15239
b4eb6b3d
JH
15240: see if link exists
15241set link d_link
15242eval $inlibc
15243
10bc17b6
JH
15244: see if localtime_r exists
15245set localtime_r d_localtime_r
15246eval $inlibc
15247case "$d_localtime_r" in
15248"$define")
d63eadf0 15249 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
15250 case "$d_localtime_r_proto:$usethreads" in
15251 ":define") d_localtime_r_proto=define
a48ec845
JH
15252 set d_localtime_r_proto localtime_r $hdrs
15253 eval $hasproto ;;
15254 *) ;;
15255 esac
15256 case "$d_localtime_r_proto" in
15257 define)
10bc17b6
JH
15258 case "$localtime_r_proto" in
15259 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
61c26d18 15260 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
10bc17b6
JH
15261 esac
15262 case "$localtime_r_proto" in
15263 ''|0) try='int localtime_r(const time_t*, struct tm*);'
61c26d18 15264 ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
10bc17b6
JH
15265 esac
15266 case "$localtime_r_proto" in
90e831dc 15267 ''|0) d_localtime_r=undef
10bc17b6 15268 localtime_r_proto=0
a48ec845 15269 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15270 * ) case "$localtime_r_proto" in
15271 REENTRANT_PROTO*) ;;
15272 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15273 esac
15274 echo "Prototype: $try" ;;
15275 esac
15276 ;;
c18e646a
JH
15277 *) case "$usethreads" in
15278 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15279 esac
90e831dc
SB
15280 d_localtime_r=undef
15281 localtime_r_proto=0
c18e646a 15282 ;;
a48ec845
JH
15283 esac
15284 ;;
10bc17b6
JH
15285*) localtime_r_proto=0
15286 ;;
15287esac
15288
8572b25d
BH
15289: see if localtime_r calls tzset
15290case "$localtime_r_proto" in
15291REENTRANT_PROTO*)
15292 $cat >try.c <<EOCP
15293/* Does our libc's localtime_r call tzset ?
15294 * return 0 if so, 1 otherwise.
15295 */
61c26d18
MHM
15296#$i_systypes I_SYS_TYPES
15297#$i_unistd I_UNISTD
15298#$i_time I_TIME
15299#$i_stdlib I_STDLIB
15300#$i_string I_STRING
15301#$i_malloc I_MALLOC
15302#ifdef I_SYS_TYPES
15303# include <sys/types.h>
15304#endif
15305#ifdef I_UNISTD
15306# include <unistd.h>
15307#endif
15308#ifdef I_TIME
15309# include <time.h>
15310#endif
15311#ifdef I_STDLIB
15312#include <stdlib.h>
15313#endif
15314#ifdef I_STRING
15315# include <string.h>
15316#else
15317# include <strings.h>
15318#endif
15319#ifdef I_MALLOC
15320# include <malloc.h>
15321#endif
8572b25d
BH
15322int main()
15323{
15324 time_t t = time(0L);
15325 char w_tz[]="TZ" "=GMT+5",
15326 e_tz[]="TZ" "=GMT-5",
15327 *tz_e = (char*)malloc(16),
15328 *tz_w = (char*)malloc(16);
15329 struct tm tm_e, tm_w;
15330 memset(&tm_e,'\0',sizeof(struct tm));
15331 memset(&tm_w,'\0',sizeof(struct tm));
15332 strcpy(tz_e,e_tz);
15333 strcpy(tz_w,w_tz);
15334
15335 putenv(tz_e);
15336 localtime_r(&t, &tm_e);
15337
15338 putenv(tz_w);
15339 localtime_r(&t, &tm_w);
15340
15341 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15342 return 1;
15343 return 0;
15344}
15345EOCP
15346 set try
15347 if eval $compile; then
43dddb59 15348 if $run ./try; then
8572b25d
BH
15349 d_localtime_r_needs_tzset=undef;
15350 else
15351 d_localtime_r_needs_tzset=define;
15352 fi;
15353 else
15354 d_localtime_r_needs_tzset=undef;
15355 fi;
15356 ;;
15357 *)
15358 d_localtime_r_needs_tzset=undef;
15359 ;;
15360esac
5b813a60 15361$rm_try
8572b25d 15362
b4eb6b3d
JH
15363: see if localeconv exists
15364set localeconv d_locconv
15365eval $inlibc
15366
15367: see if lockf exists
15368set lockf d_lockf
15369eval $inlibc
15370
b4eb6b3d
JH
15371: see if prototype for lseek is available
15372echo " "
4786929f 15373set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
15374eval $hasproto
15375
15376: see if lstat exists
15377set lstat d_lstat
15378eval $inlibc
15379
15380: see if madvise exists
15381set madvise d_madvise
15382eval $inlibc
15383
7dd121ae
MB
15384: see if malloc_size exists
15385set malloc_size d_malloc_size
15386eval $inlibc
15387
15388: see if malloc_size_good exists
15389set malloc_good_size d_malloc_good_size
15390eval $inlibc
15391
b4eb6b3d
JH
15392: see if mblen exists
15393set mblen d_mblen
15394eval $inlibc
15395
15396: see if mbstowcs exists
15397set mbstowcs d_mbstowcs
15398eval $inlibc
15399
15400: see if mbtowc exists
15401set mbtowc d_mbtowc
15402eval $inlibc
15403
15404: see if memchr exists
15405set memchr d_memchr
15406eval $inlibc
15407
15408: see if memcmp exists
15409set memcmp d_memcmp
15410eval $inlibc
15411
15412: see if memcpy exists
15413set memcpy d_memcpy
15414eval $inlibc
15415
15416: see if memmove exists
15417set memmove d_memmove
15418eval $inlibc
15419
15420: see if memset exists
15421set memset d_memset
15422eval $inlibc
15423
15424: see if mkdir exists
15425set mkdir d_mkdir
15426eval $inlibc
15427
15428: see if mkdtemp exists
15429set mkdtemp d_mkdtemp
15430eval $inlibc
15431
15432: see if mkfifo exists
15433set mkfifo d_mkfifo
15434eval $inlibc
15435
15436: see if mkstemp exists
15437set mkstemp d_mkstemp
15438eval $inlibc
15439
15440: see if mkstemps exists
15441set mkstemps d_mkstemps
15442eval $inlibc
15443
15444: see if mktime exists
15445set mktime d_mktime
15446eval $inlibc
15447
15448: see if this is a sys/mman.h system
15449set sys/mman.h i_sysmman
15450eval $inhdr
15451
15452: see if mmap exists
15453set mmap d_mmap
15454eval $inlibc
15455: see what shmat returns
15456: default to something harmless
15457mmaptype='void *'
15458case "$i_sysmman$d_mmap" in
15459"$define$define")
15460 $cat >mmap.c <<'END'
15461#include <sys/mman.h>
15462void *mmap();
15463END
15464 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15465 mmaptype='void *'
15466 else
15467 mmaptype='caddr_t'
15468 fi
15469 echo "and it returns ($mmaptype)." >&4
15470 ;;
15471esac
15472
15473
15474
89ce900e
JH
15475: see if sqrtl exists
15476set sqrtl d_sqrtl
15477eval $inlibc
15478
af1ff193
JH
15479: see if scalbnl exists
15480set scalbnl d_scalbnl
15481eval $inlibc
15482
89ce900e
JH
15483: see if modfl exists
15484set modfl d_modfl
15485eval $inlibc
15486
15487: see if prototype for modfl is available
15488echo " "
3a794506 15489set d_modflproto modfl $i_math math.h
89ce900e
JH
15490eval $hasproto
15491
15492d_modfl_pow32_bug="$undef"
15493
15494case "$d_longdbl$d_modfl" in
15495$define$define)
15496 $cat <<EOM
15497Checking to see whether your modfl() is okay for large values...
15498EOM
15499$cat >try.c <<EOCP
5b813a60 15500#include <math.h>
89ce900e
JH
15501#include <stdio.h>
15502EOCP
15503if $test "X$d_modflproto" != "X$define"; then
15504 $cat >>try.c <<EOCP
5b813a60 15505/* Sigh. many current glibcs provide the function, but do not prototype it. */
89ce900e
JH
15506long double modfl (long double, long double *);
15507EOCP
15508fi
15509$cat >>try.c <<EOCP
15510int main() {
15511 long double nv = 4294967303.15;
15512 long double v, w;
5b813a60 15513 v = modfl(nv, &w);
89ce900e
JH
15514#ifdef __GLIBC__
15515 printf("glibc");
15516#endif
15517 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15518 return 0;
15519}
15520EOCP
15521 case "$osname:$gccversion" in
15522 aix:) saveccflags="$ccflags"
15523 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15524 esac
15525 set try
15526 if eval $compile; then
15527 foo=`$run ./try`
15528 case "$foo" in
15529 *" 4294967303.150000 1.150000 4294967302.000000")
15530 echo >&4 "Your modfl() is broken for large values."
15531 d_modfl_pow32_bug="$define"
15532 case "$foo" in
15533 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15534 ;;
15535 esac
15536 ;;
15537 *" 4294967303.150000 0.150000 4294967303.000000")
15538 echo >&4 "Your modfl() seems okay for large values."
15539 ;;
15540 *) echo >&4 "I don't understand your modfl() at all."
15541 d_modfl="$undef"
15542 ;;
15543 esac
5b813a60 15544 $rm_try
89ce900e
JH
15545 else
15546 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15547 d_modfl="$undef"
15548 fi
15549 case "$osname:$gccversion" in
15550 aix:) ccflags="$saveccflags" ;; # restore
15551 esac
15552 ;;
15553esac
15554
15555if $test "$uselongdouble" = "$define"; then
af1ff193
JH
15556 message=""
15557 if $test "$d_sqrtl" != "$define"; then
15558 message="$message sqrtl"
15559 fi
15560 if $test "$d_modfl" != "$define"; then
89ce900e
JH
15561 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15562 echo "You have both aintl and copysignl, so I can emulate modfl."
15563 else
af1ff193 15564 message="$message modfl"
89ce900e 15565 fi
af1ff193
JH
15566 fi
15567 if $test "$d_frexpl" != "$define"; then
15568 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15569 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15570 else
15571 message="$message frexpl"
15572 fi
15573 fi
89ce900e 15574
af1ff193 15575 if $test "$message" != ""; then
89ce900e
JH
15576 $cat <<EOM >&4
15577
15578*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
15579*** the following mathematical functions needed for long double support:
15580*** $message
fe63a0b4
JH
15581*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15582*** Cannot continue, aborting.
89ce900e
JH
15583
15584EOM
15585
fe63a0b4 15586 exit 1
89ce900e
JH
15587 fi
15588fi
15589
b4eb6b3d
JH
15590: see if mprotect exists
15591set mprotect d_mprotect
15592eval $inlibc
15593
15594: see if msgctl exists
15595set msgctl d_msgctl
15596eval $inlibc
15597
15598: see if msgget exists
15599set msgget d_msgget
15600eval $inlibc
15601
15602: see if msgsnd exists
15603set msgsnd d_msgsnd
15604eval $inlibc
15605
15606: see if msgrcv exists
15607set msgrcv d_msgrcv
15608eval $inlibc
15609
15610: see how much of the 'msg*(2)' library is present.
15611h_msg=true
15612echo " "
15613case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15614*"$undef"*) h_msg=false;;
15615esac
15616case "$osname" in
15617freebsd)
15618 case "`ipcs 2>&1`" in
15619 "SVID messages"*"not configured"*)
15620 echo "Your $osname does not have the msg*(2) configured." >&4
15621 h_msg=false
15622 val="$undef"
15623 set msgctl d_msgctl
15624 eval $setvar
15625 set msgget d_msgget
15626 eval $setvar
15627 set msgsnd d_msgsnd
15628 eval $setvar
15629 set msgrcv d_msgrcv
15630 eval $setvar
15631 ;;
15632 esac
15633 ;;
15634esac
15635: we could also check for sys/ipc.h ...
15636if $h_msg && $test `./findhdr sys/msg.h`; then
15637 echo "You have the full msg*(2) library." >&4
15638 val="$define"
15639else
15640 echo "You don't have the full msg*(2) library." >&4
15641 val="$undef"
15642fi
15643set d_msg
15644eval $setvar
15645
34f1896b 15646: Check for msghdr_s
4e0554ec
JH
15647echo " "
15648echo "Checking to see if your system supports struct msghdr..." >&4
15649set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15650eval $hasstruct
15651case "$d_msghdr_s" in
15652"$define") echo "Yes, it does." ;;
15653*) echo "No, it doesn't." ;;
15654esac
15655
15656
b4eb6b3d
JH
15657: see if msync exists
15658set msync d_msync
15659eval $inlibc
15660
15661: see if munmap exists
15662set munmap d_munmap
15663eval $inlibc
15664
15665: see if nice exists
15666set nice d_nice
15667eval $inlibc
15668
2765b840
JH
15669: see if this is a langinfo.h system
15670set langinfo.h i_langinfo
15671eval $inhdr
15672
15673: see if nl_langinfo exists
15674set nl_langinfo d_nl_langinfo
15675eval $inlibc
15676
1d1be0dc
NC
15677: check for volatile keyword
15678echo " "
15679echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15680$cat >try.c <<'EOCP'
76f47787 15681int main()
1d1be0dc
NC
15682{
15683 typedef struct _goo_struct goo_struct;
15684 goo_struct * volatile goo = ((goo_struct *)0);
15685 struct _goo_struct {
15686 long long_int;
15687 int reg_int;
15688 char char_var;
15689 };
15690 typedef unsigned short foo_t;
15691 char *volatile foo;
15692 volatile int bar;
15693 volatile foo_t blech;
15694 foo = foo;
15695}
15696EOCP
15697if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15698 val="$define"
15699 echo "Yup, it does."
15700else
15701 val="$undef"
15702 echo "Nope, it doesn't."
15703fi
15704set d_volatile
15705eval $setvar
5b813a60 15706$rm_try
1d1be0dc 15707
613d6c3e 15708: Check basic sizes
b4eb6b3d
JH
15709echo " "
15710$echo "Choosing the C types to be used for Perl's internal types..." >&4
15711
15712case "$use64bitint:$d_quad:$quadtype" in
15713define:define:?*)
15714 ivtype="$quadtype"
15715 uvtype="$uquadtype"
15716 ivsize=8
15717 uvsize=8
15718 ;;
15719*) ivtype="long"
15720 uvtype="unsigned long"
15721 ivsize=$longsize
15722 uvsize=$longsize
15723 ;;
15724esac
15725
15726case "$uselongdouble:$d_longdbl" in
15727define:define)
15728 nvtype="long double"
15729 nvsize=$longdblsize
15730 ;;
15731*) nvtype=double
15732 nvsize=$doublesize
15733 ;;
15734esac
15735
15736$echo "(IV will be "$ivtype", $ivsize bytes)"
15737$echo "(UV will be "$uvtype", $uvsize bytes)"
15738$echo "(NV will be "$nvtype", $nvsize bytes)"
15739
15740$cat >try.c <<EOCP
15741#$i_inttypes I_INTTYPES
15742#ifdef I_INTTYPES
15743#include <inttypes.h>
15744#endif
15745#include <stdio.h>
15746int main() {
15747#ifdef INT8
15748 int8_t i = INT8_MAX;
15749 uint8_t u = UINT8_MAX;
15750 printf("int8_t\n");
15751#endif
15752#ifdef INT16
15753 int16_t i = INT16_MAX;
15754 uint16_t i = UINT16_MAX;
15755 printf("int16_t\n");
15756#endif
15757#ifdef INT32
15758 int32_t i = INT32_MAX;
15759 uint32_t u = UINT32_MAX;
15760 printf("int32_t\n");
15761#endif
15762}
15763EOCP
15764
13187456 15765i8type="signed char"
0ab0821a
MB
15766u8type="unsigned char"
15767i8size=1
15768u8size=1
b4eb6b3d
JH
15769
15770case "$i16type" in
15771'') case "$shortsize" in
15772 2) i16type=short
15773 u16type="unsigned short"
15774 i16size=$shortsize
15775 u16size=$shortsize
15776 ;;
15777 esac
15778 ;;
15779esac
15780case "$i16type" in
15781'') set try -DINT16
15782 if eval $compile; then
5440bc8e 15783 case "`$run ./try`" in
b4eb6b3d
JH
15784 int16_t)
15785 i16type=int16_t
15786 u16type=uint16_t
15787 i16size=2
15788 u16size=2
15789 ;;
15790 esac
15791 fi
15792 ;;
15793esac
15794case "$i16type" in
15795'') if $test $shortsize -ge 2; then
15796 i16type=short
15797 u16type="unsigned short"
15798 i16size=$shortsize
15799 u16size=$shortsize
15800 fi
15801 ;;
15802esac
15803
15804case "$i32type" in
15805'') case "$longsize" in
15806 4) i32type=long
15807 u32type="unsigned long"
15808 i32size=$longsize
15809 u32size=$longsize
15810 ;;
15811 *) case "$intsize" in
15812 4) i32type=int
15813 u32type="unsigned int"
15814 i32size=$intsize
15815 u32size=$intsize
15816 ;;
15817 esac
15818 ;;
15819 esac
15820 ;;
15821esac
15822case "$i32type" in
15823'') set try -DINT32
15824 if eval $compile; then
5440bc8e 15825 case "`$run ./try`" in
b4eb6b3d
JH
15826 int32_t)
15827 i32type=int32_t
15828 u32type=uint32_t
15829 i32size=4
15830 u32size=4
15831 ;;
15832 esac
15833 fi
15834 ;;
15835esac
15836case "$i32type" in
15837'') if $test $intsize -ge 4; then
15838 i32type=int
15839 u32type="unsigned int"
15840 i32size=$intsize
15841 u32size=$intsize
15842 fi
15843 ;;
15844esac
15845
15846case "$i64type" in
15847'') case "$d_quad:$quadtype" in
15848 define:?*)
15849 i64type="$quadtype"
15850 u64type="$uquadtype"
15851 i64size=8
15852 u64size=8
15853 ;;
15854 esac
15855 ;;
15856esac
15857
1d1be0dc
NC
15858$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15859: volatile so that the compiler has to store it out to memory.
15860if test X"$d_volatile" = X"$define"; then
15861 volatile=volatile
15862fi
b4eb6b3d
JH
15863$cat <<EOP >try.c
15864#include <stdio.h>
55954f19
JH
15865#$i_stdlib I_STDLIB
15866#ifdef I_STDLIB
15867#include <stdlib.h>
15868#endif
1d1be0dc
NC
15869#include <sys/types.h>
15870#include <signal.h>
15871#ifdef SIGFPE
15872$volatile int bletched = 0;
7090f861 15873$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15874#endif
b4eb6b3d
JH
15875int main() {
15876 $uvtype u = 0;
1d1be0dc 15877 $nvtype d;
b4eb6b3d
JH
15878 int n = 8 * $uvsize;
15879 int i;
1d1be0dc
NC
15880#ifdef SIGFPE
15881 signal(SIGFPE, blech);
15882#endif
15883
b4eb6b3d
JH
15884 for (i = 0; i < n; i++) {
15885 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15886 d = ($nvtype)u;
15887 if (($uvtype)d != u)
b4eb6b3d 15888 break;
1d1be0dc
NC
15889 if (d <= 0)
15890 break;
15891 d = ($nvtype)(u - 1);
15892 if (($uvtype)d != (u - 1))
15893 break;
15894#ifdef SIGFPE
22676560 15895 if (bletched)
1d1be0dc
NC
15896 break;
15897#endif
b4eb6b3d 15898 }
efd1522b 15899 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15900 exit(0);
15901}
15902EOP
1d1be0dc
NC
15903set try
15904
15905d_nv_preserves_uv="$undef"
15906if eval $compile; then
53133ed1 15907 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15908fi
53133ed1 15909case "$nv_preserves_uv_bits" in
5b813a60 15910\-[1-9]*)
53133ed1
NC
15911 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15912 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15913 d_nv_preserves_uv="$define"
b4eb6b3d 15914 ;;
53133ed1 15915[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15916 d_nv_preserves_uv="$undef" ;;
15917*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
d6cc064f 15918 nv_preserves_uv_bits="0" ;;
b4eb6b3d 15919esac
5b813a60 15920$rm_try
1d1be0dc 15921
b68c599a
NC
15922$echo "Checking to find the largest integer value your NVs can hold..." >&4
15923: volatile so that the compiler has to store it out to memory.
15924if test X"$d_volatile" = X"$define"; then
15925 volatile=volatile
15926fi
15927$cat <<EOP >try.c
15928#include <stdio.h>
15929
15930typedef $nvtype NV;
15931
15932int
15933main() {
15934 NV value = 2;
15935 int count = 1;
15936
15937 while(count < 256) {
15938 $volatile NV up = value + 1.0;
15939 $volatile NV negated = -value;
15940 $volatile NV down = negated - 1.0;
15941 $volatile NV got_up = up - value;
15942 int up_good = got_up == 1.0;
15943 int got_down = down - negated;
15944 int down_good = got_down == -1.0;
15945
15946 if (down_good != up_good) {
15947 fprintf(stderr,
15948 "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15949 up_good, (double) got_up, down_good, (double) got_down,
15950 count, (double) value);
15951 return 1;
15952 }
15953 if (!up_good) {
15954 while (1) {
15955 if (count > 8) {
15956 count -= 8;
15957 fputs("256.0", stdout);
15958 } else {
15959 count--;
15960 fputs("2.0", stdout);
15961 }
15962 if (!count) {
15963 puts("");
15964 return 0;
15965 }
15966 fputs("*", stdout);
15967 }
15968 }
15969 value *= 2;
15970 ++count;
15971 }
15972 fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15973 count, (double) value);
15974 return 1;
15975}
15976EOP
15977set try
15978
15979nv_overflows_integers_at='0'
15980if eval $compile; then
15981 xxx="`$run ./try`"
15982 case "$?" in
15983 0)
15984 case "$xxx" in
15985 2*) cat >&4 <<EOM
15986The largest integer your NVs can preserve is equal to $xxx
15987EOM
15988 nv_overflows_integers_at="$xxx"
15989 ;;
15990 *) cat >&4 <<EOM
15991Cannot determine the largest integer value your NVs can hold, unexpected output
15992'$xxx'
15993EOM
15994 ;;
15995 esac
15996 ;;
15997 *) cat >&4 <<EOM
15998Cannot determine the largest integer value your NVs can hold
15999EOM
16000 ;;
16001 esac
16002fi
16003$rm_try
16004
f607920a
CB
16005$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16006: volatile so that the compiler has to store it out to memory.
16007if test X"$d_volatile" = X"$define"; then
16008 volatile=volatile
16009fi
16010$cat <<EOP >try.c
16011#include <stdio.h>
16012#$i_stdlib I_STDLIB
16013#ifdef I_STDLIB
16014#include <stdlib.h>
16015#endif
16016#$i_string I_STRING
16017#ifdef I_STRING
16018# include <string.h>
16019#else
16020# include <strings.h>
16021#endif
16022#include <sys/types.h>
16023#include <signal.h>
16024#ifdef SIGFPE
16025$volatile int bletched = 0;
7090f861 16026$signal_t blech(int s) { bletched = 1; }
f607920a
CB
16027#endif
16028
16029int checkit($nvtype d, char *where) {
16030 unsigned char *p = (char *)&d;
16031 unsigned char *end = p + sizeof(d);
16032 int fail = 0;
16033
16034 while (p < end)
16035 fail += *p++;
16036
16037 if (!fail)
17f6277d 16038 return 0;
f607920a
CB
16039
16040 p = (char *)&d;
16041 printf("No - %s: 0x", where);
16042 while (p < end)
16043 printf ("%02X", *p++);
16044 printf("\n");
16045 return 1;
16046}
16047
16048int main(int argc, char **argv) {
16049 $nvtype d = 0.0;
16050 int fail = 0;
16051 fail += checkit(d, "0.0");
16052
16053 /* The compiler shouldn't be assuming that bletched is 0 */
16054 d = bletched;
16055
16056 fail += checkit(d, "bleched");
16057
16058#ifdef SIGFPE
16059 signal(SIGFPE, blech);
16060#endif
16061
16062 /* Paranoia - the compiler should have no way of knowing that ANSI says
16063 that argv[argc] will always be NULL. Actually, if it did assume this it
16064 would be buggy, as this is C and main() can be called from elsewhere in
16065 the program. */
16066 d = argv[argc] ? 1 : 0;
16067
16068 if (d) {
16069 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16070 }
16071
16072 fail += checkit(d, "ternary");
16073
16074 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16075
16076 if (d != 0.0) {
16077 printf("No - memset doesn't give 0.0\n");
16078 /* This might just blow up: */
16079 printf("(gives %g)\n", d);
16080 return 1;
16081 }
5b813a60 16082
f607920a
CB
16083#ifdef SIGFPE
16084 if (bletched) {
16085 printf("No - something bleched\n");
16086 return 1;
16087 }
16088#endif
16089 if (fail) {
16090 printf("No - %d fail(s)\n", fail);
16091 return 1;
16092 }
16093 printf("Yes\n");
16094 return 0;
16095}
16096EOP
16097set try
16098
16099d_nv_zero_is_allbits_zero="$undef"
16100if eval $compile; then
16101 xxx="`$run ./try`"
16102 case "$?" in
16103 0)
16104 case "$xxx" in
16105 Yes) cat >&4 <<EOM
161060.0 is represented as all bits zero in memory
16107EOM
16108 d_nv_zero_is_allbits_zero="$define"
16109 ;;
16110 *) cat >&4 <<EOM
161110.0 is not represented as all bits zero in memory
16112EOM
16113 d_nv_zero_is_allbits_zero="$undef"
16114 ;;
16115 esac
16116 ;;
16117 *) cat >&4 <<EOM
161180.0 is not represented as all bits zero in memory
16119EOM
16120 d_nv_zero_is_allbits_zero="$undef"
16121 ;;
16122 esac
16123fi
5b813a60 16124$rm_try
b4eb6b3d
JH
16125
16126: check for off64_t
16127echo " "
16128echo "Checking to see if you have off64_t..." >&4
16129$cat >try.c <<EOCP
16130#include <sys/types.h>
16131#include <unistd.h>
16132int main() { off64_t x = 7; }
16133EOCP
16134set try
16135if eval $compile; then
16136 val="$define"
16137 echo "You have off64_t."
16138else
16139 val="$undef"
16140 echo "You do not have off64_t."
16141 case "$lseeksize" in
16142 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16143 esac
16144fi
5b813a60 16145$rm_try
b4eb6b3d
JH
16146set d_off64_t
16147eval $setvar
16148
b4eb6b3d
JH
16149: how to create joinable pthreads
16150if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16151 echo " "
5b813a60 16152 echo "Checking what constant to use for creating joinable pthreads..." >&4
b4eb6b3d
JH
16153 $cat >try.c <<'EOCP'
16154#include <pthread.h>
16155int main() {
16156 int detachstate = JOINABLE;
16157}
16158EOCP
16159 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16160 if eval $compile; then
16161 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16162 val="$undef" # Yes, undef.
16163 set d_old_pthread_create_joinable
16164 eval $setvar
16165 val=""
16166 set old_pthread_create_joinable
16167 eval $setvar
16168 else
16169 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16170 if eval $compile; then
16171 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16172 val="$define"
16173 set d_old_pthread_create_joinable
16174 eval $setvar
16175 val=PTHREAD_CREATE_UNDETACHED
16176 set old_pthread_create_joinable
16177 eval $setvar
5b813a60 16178 else
b4eb6b3d
JH
16179 set try -DJOINABLE=__UNDETACHED
16180 if eval $compile; then
16181 echo "You seem to use __UNDETACHED." >&4
16182 val="$define"
16183 set d_old_pthread_create_joinable
16184 eval $setvar
16185 val=__UNDETACHED
16186 set old_pthread_create_joinable
16187 eval $setvar
16188 else
16189 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
16190 val="$define"
16191 set d_old_pthread_create_joinable
16192 eval $setvar
16193 val=0
16194 set old_pthread_create_joinable
16195 eval $setvar
16196 fi
16197 fi
16198 fi
5b813a60 16199 $rm_try
b4eb6b3d
JH
16200else
16201 d_old_pthread_create_joinable="$undef"
16202 old_pthread_create_joinable=""
16203fi
16204
16205: see if pause exists
16206set pause d_pause
16207eval $inlibc
16208
b4eb6b3d
JH
16209: see if poll exists
16210set poll d_poll
16211eval $inlibc
16212
c796e3db
MB
16213: see if prctl exists
16214set prctl d_prctl
16215eval $inlibc
16216
16217: see if prctl supports PR_SET_NAME
16218d_prctl_set_name=$undef
16219case $d_prctl in
16220 $define)
16221 $cat >try.c <<EOM
16222#include <sys/prctl.h>
16223
16224int main (int argc, char *argv[])
16225{
16226 return (prctl (PR_SET_NAME, "Test"));
16227 } /* main */
16228EOM
16229 set try
16230 if eval $compile_ok && $run ./try; then
16231 echo "Your prctl (PR_SET_NAME, ...) works"
16232 d_prctl_set_name=$define
16233 fi
16234 $rm_try
16235 ;;
16236 esac
16237
c7aff470
NIS
16238: see if readlink exists
16239set readlink d_readlink
16240eval $inlibc
16241
613d6c3e 16242: Check if exe is symlink to abs path of executing program
c7aff470 16243echo " "
f24dbf84 16244procselfexe=''
c7aff470 16245val="$undef"
a33c94aa 16246case "$d_readlink" in
698ca84c 16247 "$define")
9e68546f
NC
16248 : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16249 : more tidy to avoid an extra level of symlink
16250 set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
698ca84c
NC
16251 while test $# -gt 0; do
16252 type=$1; try=$2
16253 shift; shift
16254 if $issymlink $try; then
16255 $ls -l $try > reflect
f24dbf84 16256 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
698ca84c
NC
16257 echo "You have $type-like $try."
16258 procselfexe='"'$try'"'
16259 val="$define"
16260 : This will break out of the loop
16261 set X; shift
c7aff470 16262 fi
698ca84c
NC
16263 fi
16264 done
a33c94aa
JH
16265 ;;
16266esac
428dc699 16267$rm -f reflect
c7aff470
NIS
16268set d_procselfexe
16269eval $setvar
16270
233e16ce
MB
16271: backward compatibility for d_hvfork
16272if test X$d_hvfork != X; then
16273 d_vfork="$d_hvfork"
16274 d_hvfork=''
16275fi
16276: see if there is a vfork
16277val=''
16278set vfork val
16279eval $inlibc
16280
16281d_pseudofork=$undef
16282
16283: Ok, but do we want to use it. vfork is reportedly unreliable in
16284: perl on Solaris 2.x, and probably elsewhere.
16285case "$val" in
16286$define)
16287 echo " "
16288 case "$usevfork" in
16289 false) dflt='n';;
16290 *) dflt='y';;
16291 esac
16292 cat <<'EOM'
16293
16294Perl can only use a vfork() that doesn't suffer from strict
16295restrictions on calling functions or modifying global data in
16296the child. For example, glibc-2.1 contains such a vfork()
16297that is unsuitable. If your system provides a proper fork()
16298call, chances are that you do NOT want perl to use vfork().
16299
16300EOM
16301 rp="Do you still want to use vfork()?"
16302 . ./myread
16303 case "$ans" in
16304 y|Y) ;;
16305 *)
16306 echo "Ok, we won't use vfork()."
16307 val="$undef"
16308 ;;
16309 esac
16310 ;;
16311esac
16312set d_vfork
16313eval $setvar
16314case "$d_vfork" in
16315$define) usevfork='true';;
16316*) usevfork='false';;
16317esac
16318
263fee3f
JH
16319: see whether the pthread_atfork exists
16320$cat >try.c <<EOP
16321#include <pthread.h>
16322#include <stdio.h>
16323int main() {
16324#ifdef PTHREAD_ATFORK
16325 pthread_atfork(NULL,NULL,NULL);
16326#endif
16327}
16328EOP
16329
d6483fcc 16330: see if pthread_atfork exists
263fee3f
JH
16331set try -DPTHREAD_ATFORK
16332if eval $compile; then
16333 val="$define"
16334else
16335 val="$undef"
16336fi
16337case "$usethreads" in
16338$define)
16339 case "$val" in
16340 $define) echo 'pthread_atfork found.' >&4 ;;
16341 *) echo 'pthread_atfork NOT found.' >&4 ;;
16342 esac
16343esac
16344set d_pthread_atfork
16345eval $setvar
d6483fcc 16346
58d975c3
JH
16347: see if pthread_attr_setscope exists
16348set pthread_attr_setscope d_pthread_attr_setscope
16349eval $inlibc
16350
b4eb6b3d
JH
16351: see whether the various POSIXish _yields exist
16352$cat >try.c <<EOP
16353#include <pthread.h>
16354#include <stdio.h>
16355int main() {
16356#ifdef SCHED_YIELD
16357 sched_yield();
16358#else
16359#ifdef PTHREAD_YIELD
16360 pthread_yield();
16361#else
16362#ifdef PTHREAD_YIELD_NULL
16363 pthread_yield(NULL);
16364#endif
16365#endif
16366#endif
16367}
16368EOP
16369: see if sched_yield exists
16370set try -DSCHED_YIELD
16371if eval $compile; then
16372 val="$define"
16373 sched_yield='sched_yield()'
16374else
16375 val="$undef"
16376fi
16377case "$usethreads" in
16378$define)
16379 case "$val" in
16380 $define) echo 'sched_yield() found.' >&4 ;;
16381 *) echo 'sched_yield() NOT found.' >&4 ;;
16382 esac
16383esac
10bc17b6
JH
16384set d_sched_yield
16385eval $setvar
b4eb6b3d 16386
10bc17b6
JH
16387: see if pthread_yield exists
16388set try -DPTHREAD_YIELD
16389if eval $compile; then
16390 val="$define"
16391 case "$sched_yield" in
16392 '') sched_yield='pthread_yield()' ;;
16393 esac
16394else
16395 set try -DPTHREAD_YIELD_NULL
16396 if eval $compile; then
16397 val="$define"
16398 case "$sched_yield" in
16399 '') sched_yield='pthread_yield(NULL)' ;;
16400 esac
16401 else
16402 val="$undef"
16403 fi
16404fi
16405case "$usethreads" in
16406$define)
16407 case "$val" in
16408 $define) echo 'pthread_yield() found.' >&4 ;;
16409 *) echo 'pthread_yield() NOT found.' >&4 ;;
16410 esac
16411 ;;
16412esac
16413set d_pthread_yield
16414eval $setvar
10bc17b6
JH
16415case "$sched_yield" in
16416'') sched_yield=undef ;;
16417esac
5b813a60 16418$rm_try
10bc17b6
JH
16419
16420: see if random_r exists
16421set random_r d_random_r
16422eval $inlibc
16423case "$d_random_r" in
16424"$define")
16425 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
16426 case "$d_random_r_proto:$usethreads" in
16427 ":define") d_random_r_proto=define
a48ec845
JH
16428 set d_random_r_proto random_r $hdrs
16429 eval $hasproto ;;
16430 *) ;;
16431 esac
16432 case "$d_random_r_proto" in
16433 define)
10bc17b6
JH
16434 case "$random_r_proto" in
16435 ''|0) try='int random_r(int*, struct random_data*);'
61c26d18 16436 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
a845a0d4
JH
16437 esac
16438 case "$random_r_proto" in
16439 ''|0) try='int random_r(long*, struct random_data*);'
61c26d18 16440 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
a845a0d4
JH
16441 esac
16442 case "$random_r_proto" in
16443 ''|0) try='int random_r(struct random_data*, int32_t*);'
61c26d18 16444 ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
16445 esac
16446 case "$random_r_proto" in
90e831dc 16447 ''|0) d_random_r=undef
10bc17b6 16448 random_r_proto=0
a48ec845 16449 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16450 * ) case "$random_r_proto" in
16451 REENTRANT_PROTO*) ;;
16452 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16453 esac
16454 echo "Prototype: $try" ;;
16455 esac
b4eb6b3d 16456 ;;
c18e646a
JH
16457 *) case "$usethreads" in
16458 define) echo "random_r has no prototype, not using it." >&4 ;;
16459 esac
90e831dc
SB
16460 d_random_r=undef
16461 random_r_proto=0
c18e646a 16462 ;;
a48ec845
JH
16463 esac
16464 ;;
10bc17b6 16465*) random_r_proto=0
b4eb6b3d
JH
16466 ;;
16467esac
16468
16469: see if readdir and friends exist
16470set readdir d_readdir
16471eval $inlibc
16472set seekdir d_seekdir
16473eval $inlibc
16474set telldir d_telldir
16475eval $inlibc
16476set rewinddir d_rewinddir
16477eval $inlibc
16478
10bc17b6
JH
16479: see if readdir64_r exists
16480set readdir64_r d_readdir64_r
16481eval $inlibc
16482case "$d_readdir64_r" in
16483"$define")
16484 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16485 case "$d_readdir64_r_proto:$usethreads" in
16486 ":define") d_readdir64_r_proto=define
a48ec845
JH
16487 set d_readdir64_r_proto readdir64_r $hdrs
16488 eval $hasproto ;;
16489 *) ;;
16490 esac
16491 case "$d_readdir64_r_proto" in
16492 define)
10bc17b6
JH
16493 case "$readdir64_r_proto" in
16494 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
61c26d18 16495 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
10bc17b6
JH
16496 esac
16497 case "$readdir64_r_proto" in
16498 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
61c26d18 16499 ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
10bc17b6
JH
16500 esac
16501 case "$readdir64_r_proto" in
90e831dc 16502 ''|0) d_readdir64_r=undef
10bc17b6 16503 readdir64_r_proto=0
a48ec845 16504 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16505 * ) case "$readdir64_r_proto" in
16506 REENTRANT_PROTO*) ;;
16507 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16508 esac
16509 echo "Prototype: $try" ;;
16510 esac
16511 ;;
c18e646a
JH
16512 *) case "$usethreads" in
16513 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16514 esac
90e831dc
SB
16515 d_readdir64_r=undef
16516 readdir64_r_proto=0
c18e646a 16517 ;;
a48ec845
JH
16518 esac
16519 ;;
10bc17b6
JH
16520*) readdir64_r_proto=0
16521 ;;
16522esac
16523
16524: see if readdir_r exists
16525set readdir_r d_readdir_r
16526eval $inlibc
16527case "$d_readdir_r" in
16528"$define")
16529 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
16530 case "$d_readdir_r_proto:$usethreads" in
16531 ":define") d_readdir_r_proto=define
a48ec845
JH
16532 set d_readdir_r_proto readdir_r $hdrs
16533 eval $hasproto ;;
16534 *) ;;
16535 esac
16536 case "$d_readdir_r_proto" in
16537 define)
10bc17b6
JH
16538 case "$readdir_r_proto" in
16539 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
61c26d18 16540 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
10bc17b6
JH
16541 esac
16542 case "$readdir_r_proto" in
16543 ''|0) try='int readdir_r(DIR*, struct dirent*);'
61c26d18 16544 ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
10bc17b6
JH
16545 esac
16546 case "$readdir_r_proto" in
90e831dc 16547 ''|0) d_readdir_r=undef
10bc17b6 16548 readdir_r_proto=0
a48ec845 16549 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16550 * ) case "$readdir_r_proto" in
16551 REENTRANT_PROTO*) ;;
16552 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16553 esac
16554 echo "Prototype: $try" ;;
16555 esac
16556 ;;
c18e646a
JH
16557 *) case "$usethreads" in
16558 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16559 esac
90e831dc
SB
16560 d_readdir_r=undef
16561 readdir_r_proto=0
c18e646a 16562 ;;
a48ec845
JH
16563 esac
16564 ;;
10bc17b6
JH
16565*) readdir_r_proto=0
16566 ;;
16567esac
16568
4e0554ec
JH
16569: see if readv exists
16570set readv d_readv
16571eval $inlibc
16572
16573: see if recvmsg exists
16574set recvmsg d_recvmsg
16575eval $inlibc
16576
b4eb6b3d
JH
16577: see if rename exists
16578set rename d_rename
16579eval $inlibc
16580
16581: see if rmdir exists
16582set rmdir d_rmdir
16583eval $inlibc
16584
16585: see if memory.h is available.
16586val=''
16587set memory.h val
16588eval $inhdr
16589
16590: See if it conflicts with string.h
16591case "$val" in
16592$define)
16593 case "$strings" in
16594 '') ;;
16595 *)
16596 $cppstdin $cppflags $cppminus < $strings > mem.h
16597 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16598 echo " "
16599 echo "We won't be including <memory.h>."
16600 val="$undef"
16601 fi
16602 $rm -f mem.h
16603 ;;
16604 esac
16605esac
16606set i_memory
16607eval $setvar
16608
16609: can bcopy handle overlapping blocks?
b6cc3bc4 16610echo " "
b4eb6b3d 16611val="$undef"
b6cc3bc4
AD
16612case "$d_memmove" in
16613"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16614*) case "$d_bcopy" in
16615 "$define")
16616 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16617 $cat >try.c <<EOCP
b4eb6b3d
JH
16618#$i_memory I_MEMORY
16619#$i_stdlib I_STDLIB
16620#$i_string I_STRING
16621#$i_unistd I_UNISTD
16622EOCP
16623 $cat >>try.c <<'EOCP'
16624#include <stdio.h>
16625#ifdef I_MEMORY
16626# include <memory.h>
16627#endif
16628#ifdef I_STDLIB
16629# include <stdlib.h>
16630#endif
16631#ifdef I_STRING
16632# include <string.h>
16633#else
16634# include <strings.h>
16635#endif
16636#ifdef I_UNISTD
16637# include <unistd.h> /* Needed for NetBSD */
16638#endif
16639int main()
16640{
16641char buf[128], abc[128];
16642char *b;
16643int len;
16644int off;
16645int align;
16646
b6cc3bc4
AD
16647/* Copy "abcde..." string to char abc[] so that gcc doesn't
16648 try to store the string in read-only memory. */
b4eb6b3d
JH
16649bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16650
16651for (align = 7; align >= 0; align--) {
16652 for (len = 36; len; len--) {
16653 b = buf+align;
16654 bcopy(abc, b, len);
16655 for (off = 1; off <= len; off++) {
16656 bcopy(b, b+off, len);
16657 bcopy(b+off, b, len);
16658 if (bcmp(b, abc, len))
16659 exit(1);
16660 }
16661 }
16662}
16663exit(0);
16664}
16665EOCP
b6cc3bc4
AD
16666 set try
16667 if eval $compile_ok; then
43dddb59 16668 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16669 echo "Yes, it can."
16670 val="$define"
16671 else
16672 echo "It can't, sorry."
16673 fi
b4eb6b3d 16674 else
b6cc3bc4 16675 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16676 fi
b6cc3bc4
AD
16677 ;;
16678 esac
5b813a60 16679 $rm_try
b4eb6b3d
JH
16680 ;;
16681esac
b4eb6b3d
JH
16682set d_safebcpy
16683eval $setvar
16684
16685: can memcpy handle overlapping blocks?
b6cc3bc4 16686echo " "
b4eb6b3d 16687val="$undef"
b6cc3bc4
AD
16688case "$d_memmove" in
16689"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16690*) case "$d_memcpy" in
16691 "$define")
16692 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16693 $cat >try.c <<EOCP
b4eb6b3d
JH
16694#$i_memory I_MEMORY
16695#$i_stdlib I_STDLIB
16696#$i_string I_STRING
16697#$i_unistd I_UNISTD
16698EOCP
16699 $cat >>try.c <<'EOCP'
16700#include <stdio.h>
16701#ifdef I_MEMORY
16702# include <memory.h>
16703#endif
16704#ifdef I_STDLIB
16705# include <stdlib.h>
16706#endif
16707#ifdef I_STRING
16708# include <string.h>
16709#else
16710# include <strings.h>
16711#endif
16712#ifdef I_UNISTD
16713# include <unistd.h> /* Needed for NetBSD */
16714#endif
16715int main()
16716{
16717char buf[128], abc[128];
16718char *b;
16719int len;
16720int off;
16721int align;
16722
16723/* Copy "abcde..." string to char abc[] so that gcc doesn't
16724 try to store the string in read-only memory. */
16725memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16726
16727for (align = 7; align >= 0; align--) {
16728 for (len = 36; len; len--) {
16729 b = buf+align;
16730 memcpy(b, abc, len);
16731 for (off = 1; off <= len; off++) {
16732 memcpy(b+off, b, len);
16733 memcpy(b, b+off, len);
16734 if (memcmp(b, abc, len))
16735 exit(1);
16736 }
16737 }
16738}
16739exit(0);
16740}
16741EOCP
b6cc3bc4
AD
16742 set try
16743 if eval $compile_ok; then
43dddb59 16744 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16745 echo "Yes, it can."
16746 val="$define"
16747 else
16748 echo "It can't, sorry."
16749 fi
b4eb6b3d 16750 else
b6cc3bc4 16751 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16752 fi
b6cc3bc4
AD
16753 ;;
16754 esac
5b813a60 16755 $rm_try
b4eb6b3d
JH
16756 ;;
16757esac
b4eb6b3d
JH
16758set d_safemcpy
16759eval $setvar
16760
16761: can memcmp be trusted to compare relative magnitude?
16762val="$undef"
16763case "$d_memcmp" in
16764"$define")
16765 echo " "
16766 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16767 $cat >try.c <<EOCP
16768#$i_memory I_MEMORY
16769#$i_stdlib I_STDLIB
16770#$i_string I_STRING
16771#$i_unistd I_UNISTD
16772EOCP
16773 $cat >>try.c <<'EOCP'
16774#include <stdio.h>
16775#ifdef I_MEMORY
16776# include <memory.h>
16777#endif
16778#ifdef I_STDLIB
36adc09b 16779# include <stdlib.h>
b4eb6b3d
JH
16780#endif
16781#ifdef I_STRING
16782# include <string.h>
16783#else
16784# include <strings.h>
16785#endif
16786#ifdef I_UNISTD
16787# include <unistd.h> /* Needed for NetBSD */
16788#endif
16789int main()
16790{
16791char a = -1;
16792char b = 0;
16793if ((a < b) && memcmp(&a, &b, 1) < 0)
16794 exit(1);
16795exit(0);
16796}
16797EOCP
16798 set try
16799 if eval $compile_ok; then
5440bc8e 16800 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16801 echo "Yes, it can."
16802 val="$define"
16803 else
16804 echo "No, it can't (it uses signed chars)."
16805 fi
16806 else
16807 echo "(I can't compile the test program, so we'll assume not...)"
16808 fi
16809 ;;
16810esac
5b813a60 16811$rm_try
b4eb6b3d
JH
16812set d_sanemcmp
16813eval $setvar
16814
ef9f17be
JH
16815: see if prototype for sbrk is available
16816echo " "
16817set d_sbrkproto sbrk $i_unistd unistd.h
16818eval $hasproto
16819
b4eb6b3d
JH
16820: see if select exists
16821set select d_select
16822eval $inlibc
16823
16824: see if semctl exists
16825set semctl d_semctl
16826eval $inlibc
16827
16828: see if semget exists
16829set semget d_semget
16830eval $inlibc
16831
16832: see if semop exists
16833set semop d_semop
16834eval $inlibc
16835
16836: see how much of the 'sem*(2)' library is present.
16837h_sem=true
16838echo " "
16839case "$d_semctl$d_semget$d_semop" in
16840*"$undef"*) h_sem=false;;
16841esac
16842case "$osname" in
16843freebsd)
16844 case "`ipcs 2>&1`" in
16845 "SVID messages"*"not configured"*)
16846 echo "Your $osname does not have the sem*(2) configured." >&4
16847 h_sem=false
16848 val="$undef"
16849 set semctl d_semctl
16850 eval $setvar
16851 set semget d_semget
16852 eval $setvar
16853 set semop d_semop
16854 eval $setvar
16855 ;;
16856 esac
16857 ;;
16858esac
16859: we could also check for sys/ipc.h ...
16860if $h_sem && $test `./findhdr sys/sem.h`; then
16861 echo "You have the full sem*(2) library." >&4
16862 val="$define"
16863else
16864 echo "You don't have the full sem*(2) library." >&4
16865 val="$undef"
16866fi
16867set d_sem
16868eval $setvar
16869
16870: see whether sys/sem.h defines union semun
16871echo " "
16872$cat > try.c <<'END'
16873#include <sys/types.h>
16874#include <sys/ipc.h>
16875#include <sys/sem.h>
16876int main () { union semun semun; semun.buf = 0; }
16877END
16878set try
16879if eval $compile; then
16880 echo "You have union semun in <sys/sem.h>." >&4
16881 val="$define"
16882else
16883 echo "You do not have union semun in <sys/sem.h>." >&4
16884 val="$undef"
16885fi
5b813a60 16886$rm_try
b4eb6b3d
JH
16887set d_union_semun
16888eval $setvar
16889
16890: see how to do semctl IPC_STAT
16891case "$d_sem" in
16892$define)
b4eb6b3d 16893 echo " "
93451a0d 16894 $cat > tryh.h <<END
b4eb6b3d
JH
16895#ifndef S_IRUSR
16896# ifdef S_IREAD
16897# define S_IRUSR S_IREAD
16898# define S_IWUSR S_IWRITE
16899# define S_IXUSR S_IEXEC
16900# else
16901# define S_IRUSR 0400
16902# define S_IWUSR 0200
16903# define S_IXUSR 0100
16904# endif
16905# define S_IRGRP (S_IRUSR>>3)
16906# define S_IWGRP (S_IWUSR>>3)
16907# define S_IXGRP (S_IXUSR>>3)
16908# define S_IROTH (S_IRUSR>>6)
16909# define S_IWOTH (S_IWUSR>>6)
16910# define S_IXOTH (S_IXUSR>>6)
16911#endif
16912#ifndef S_IRWXU
16913# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16914# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16915# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16916#endif
16917END
2fad75a1 16918 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16919 case "$d_semctl_semun" in
16920 '')
35918792 16921 val="$undef"
2fad75a1 16922 $cat > try.c <<END
b4eb6b3d
JH
16923#include <sys/types.h>
16924#include <sys/ipc.h>
16925#include <sys/sem.h>
16926#include <sys/stat.h>
16927#include <stdio.h>
16928#include <errno.h>
93451a0d 16929#include "tryh.h"
b4eb6b3d
JH
16930#ifndef errno
16931extern int errno;
16932#endif
16933#$d_union_semun HAS_UNION_SEMUN
16934int main() {
16935 union semun
16936#ifndef HAS_UNION_SEMUN
16937 {
16938 int val;
16939 struct semid_ds *buf;
16940 unsigned short *array;
16941 }
16942#endif
16943 arg;
16944 int sem, st;
16945
16946#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16947 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16948 if (sem > -1) {
16949 struct semid_ds argbuf;
16950 arg.buf = &argbuf;
16951# ifdef IPC_STAT
16952 st = semctl(sem, 0, IPC_STAT, arg);
16953 if (st == 0)
16954 printf("semun\n");
16955 else
16956# endif /* IPC_STAT */
16957 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16958# ifdef IPC_RMID
16959 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16960# endif /* IPC_RMID */
b4eb6b3d
JH
16961 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16962 } else
16963#endif /* IPC_PRIVATE && ... */
16964 printf("semget failed: errno = %d\n", errno);
16965 return 0;
16966}
16967END
2fad75a1
JH
16968 set try
16969 if eval $compile; then
16970 xxx=`$run ./try`
16971 case "$xxx" in
16972 semun) val="$define" ;;
16973 esac
16974 fi
5b813a60 16975 $rm_try
35918792
YST
16976 set d_semctl_semun
16977 eval $setvar
2fad75a1
JH
16978 ;;
16979 esac
b4eb6b3d
JH
16980 case "$d_semctl_semun" in
16981 $define)
16982 echo "You can use union semun for semctl IPC_STAT." >&4
16983 also='also'
16984 ;;
16985 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16986 also=''
16987 ;;
16988 esac
16989
16990 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16991 case "$d_semctl_semid_ds" in
16992 '')
35918792 16993 val="$undef"
2fad75a1 16994 $cat > try.c <<'END'
b4eb6b3d
JH
16995#include <sys/types.h>
16996#include <sys/ipc.h>
16997#include <sys/sem.h>
16998#include <sys/stat.h>
93451a0d 16999#include "tryh.h"
b4eb6b3d
JH
17000#include <stdio.h>
17001#include <errno.h>
17002#ifndef errno
17003extern int errno;
17004#endif
17005int main() {
17006 struct semid_ds arg;
17007 int sem, st;
17008
17009#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17010 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17011 if (sem > -1) {
17012# ifdef IPC_STAT
17013 st = semctl(sem, 0, IPC_STAT, &arg);
17014 if (st == 0)
17015 printf("semid_ds\n");
17016 else
17017# endif /* IPC_STAT */
17018 printf("semctl IPC_STAT failed: errno = %d\n", errno);
17019# ifdef IPC_RMID
17020 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17021# endif /* IPC_RMID */
17022 printf("semctl IPC_RMID failed: errno = %d\n", errno);
17023 } else
17024#endif /* IPC_PRIVATE && ... */
17025 printf("semget failed: errno = %d\n", errno);
17026
17027 return 0;
17028}
17029END
2fad75a1
JH
17030 set try
17031 if eval $compile; then
17032 xxx=`$run ./try`
17033 case "$xxx" in
17034 semid_ds) val="$define" ;;
17035 esac
17036 fi
5b813a60 17037 $rm_try
35918792
YST
17038 set d_semctl_semid_ds
17039 eval $setvar
2fad75a1
JH
17040 ;;
17041 esac
b4eb6b3d
JH
17042 case "$d_semctl_semid_ds" in
17043 $define)
17044 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17045 ;;
17046 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17047 ;;
17048 esac
b4eb6b3d
JH
17049 ;;
17050*) val="$undef"
17051
17052 # We do not have the full sem*(2) library, so assume we can not
17053 # use either.
17054
17055 set d_semctl_semun
17056 eval $setvar
17057
17058 set d_semctl_semid_ds
17059 eval $setvar
17060 ;;
17061esac
93451a0d 17062$rm_try tryh.h
b4eb6b3d 17063
4e0554ec
JH
17064: see if sendmsg exists
17065set sendmsg d_sendmsg
17066eval $inlibc
17067
b4eb6b3d
JH
17068: see if setegid exists
17069set setegid d_setegid
17070eval $inlibc
17071
17072: see if seteuid exists
17073set seteuid d_seteuid
17074eval $inlibc
17075
17076: see if setgrent exists
17077set setgrent d_setgrent
17078eval $inlibc
17079
10bc17b6
JH
17080: see if setgrent_r exists
17081set setgrent_r d_setgrent_r
17082eval $inlibc
17083case "$d_setgrent_r" in
17084"$define")
17085 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
17086 case "$d_setgrent_r_proto:$usethreads" in
17087 ":define") d_setgrent_r_proto=define
a48ec845
JH
17088 set d_setgrent_r_proto setgrent_r $hdrs
17089 eval $hasproto ;;
17090 *) ;;
17091 esac
17092 case "$d_setgrent_r_proto" in
17093 define)
10bc17b6
JH
17094 case "$setgrent_r_proto" in
17095 ''|0) try='int setgrent_r(FILE**);'
61c26d18 17096 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
10bc17b6
JH
17097 esac
17098 case "$setgrent_r_proto" in
17099 ''|0) try='void setgrent_r(FILE**);'
61c26d18 17100 ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
10bc17b6
JH
17101 esac
17102 case "$setgrent_r_proto" in
90e831dc 17103 ''|0) d_setgrent_r=undef
10bc17b6 17104 setgrent_r_proto=0
a48ec845 17105 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17106 * ) case "$setgrent_r_proto" in
17107 REENTRANT_PROTO*) ;;
17108 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17109 esac
17110 echo "Prototype: $try" ;;
17111 esac
17112 ;;
c18e646a
JH
17113 *) case "$usethreads" in
17114 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17115 esac
90e831dc
SB
17116 d_setgrent_r=undef
17117 setgrent_r_proto=0
c18e646a 17118 ;;
a48ec845
JH
17119 esac
17120 ;;
10bc17b6
JH
17121*) setgrent_r_proto=0
17122 ;;
17123esac
17124
b4eb6b3d
JH
17125: see if sethostent exists
17126set sethostent d_sethent
17127eval $inlibc
17128
10bc17b6
JH
17129: see if sethostent_r exists
17130set sethostent_r d_sethostent_r
17131eval $inlibc
17132case "$d_sethostent_r" in
17133"$define")
17134 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17135 case "$d_sethostent_r_proto:$usethreads" in
17136 ":define") d_sethostent_r_proto=define
a48ec845
JH
17137 set d_sethostent_r_proto sethostent_r $hdrs
17138 eval $hasproto ;;
17139 *) ;;
17140 esac
17141 case "$d_sethostent_r_proto" in
17142 define)
10bc17b6
JH
17143 case "$sethostent_r_proto" in
17144 ''|0) try='int sethostent_r(int, struct hostent_data*);'
61c26d18 17145 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
10bc17b6
JH
17146 esac
17147 case "$sethostent_r_proto" in
17148 ''|0) try='void sethostent_r(int, struct hostent_data*);'
61c26d18 17149 ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
10bc17b6
JH
17150 esac
17151 case "$sethostent_r_proto" in
90e831dc 17152 ''|0) d_sethostent_r=undef
10bc17b6 17153 sethostent_r_proto=0
a48ec845 17154 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17155 * ) case "$sethostent_r_proto" in
17156 REENTRANT_PROTO*) ;;
17157 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17158 esac
17159 echo "Prototype: $try" ;;
17160 esac
17161 ;;
c18e646a
JH
17162 *) case "$usethreads" in
17163 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17164 esac
90e831dc
SB
17165 d_sethostent_r=undef
17166 sethostent_r_proto=0
c18e646a 17167 ;;
a48ec845
JH
17168 esac
17169 ;;
10bc17b6
JH
17170*) sethostent_r_proto=0
17171 ;;
17172esac
17173
4e0554ec
JH
17174: see if setitimer exists
17175set setitimer d_setitimer
17176eval $inlibc
17177
b4eb6b3d
JH
17178: see if setlinebuf exists
17179set setlinebuf d_setlinebuf
17180eval $inlibc
17181
17182: see if setlocale exists
17183set setlocale d_setlocale
17184eval $inlibc
17185
10bc17b6
JH
17186: see if locale.h is available
17187set locale.h i_locale
17188eval $inhdr
17189
17190: see if setlocale_r exists
17191set setlocale_r d_setlocale_r
17192eval $inlibc
17193case "$d_setlocale_r" in
17194"$define")
17195 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
17196 case "$d_setlocale_r_proto:$usethreads" in
17197 ":define") d_setlocale_r_proto=define
a48ec845
JH
17198 set d_setlocale_r_proto setlocale_r $hdrs
17199 eval $hasproto ;;
17200 *) ;;
17201 esac
17202 case "$d_setlocale_r_proto" in
17203 define)
10bc17b6
JH
17204 case "$setlocale_r_proto" in
17205 ''|0) try='int setlocale_r(int, const char*, char*, int);'
61c26d18 17206 ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
10bc17b6
JH
17207 esac
17208 case "$setlocale_r_proto" in
90e831dc 17209 ''|0) d_setlocale_r=undef
10bc17b6 17210 setlocale_r_proto=0
a48ec845 17211 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17212 * ) case "$setlocale_r_proto" in
17213 REENTRANT_PROTO*) ;;
17214 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17215 esac
17216 echo "Prototype: $try" ;;
17217 esac
17218 ;;
c18e646a
JH
17219 *) case "$usethreads" in
17220 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17221 esac
90e831dc
SB
17222 d_setlocale_r=undef
17223 setlocale_r_proto=0
c18e646a 17224 ;;
a48ec845
JH
17225 esac
17226 ;;
10bc17b6
JH
17227*) setlocale_r_proto=0
17228 ;;
17229esac
17230
b4eb6b3d
JH
17231: see if setnetent exists
17232set setnetent d_setnent
17233eval $inlibc
17234
10bc17b6
JH
17235: see if setnetent_r exists
17236set setnetent_r d_setnetent_r
17237eval $inlibc
17238case "$d_setnetent_r" in
17239"$define")
17240 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17241 case "$d_setnetent_r_proto:$usethreads" in
17242 ":define") d_setnetent_r_proto=define
a48ec845
JH
17243 set d_setnetent_r_proto setnetent_r $hdrs
17244 eval $hasproto ;;
17245 *) ;;
17246 esac
17247 case "$d_setnetent_r_proto" in
17248 define)
10bc17b6
JH
17249 case "$setnetent_r_proto" in
17250 ''|0) try='int setnetent_r(int, struct netent_data*);'
61c26d18 17251 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
10bc17b6
JH
17252 esac
17253 case "$setnetent_r_proto" in
17254 ''|0) try='void setnetent_r(int, struct netent_data*);'
61c26d18 17255 ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
10bc17b6
JH
17256 esac
17257 case "$setnetent_r_proto" in
90e831dc 17258 ''|0) d_setnetent_r=undef
10bc17b6 17259 setnetent_r_proto=0
a48ec845 17260 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17261 * ) case "$setnetent_r_proto" in
17262 REENTRANT_PROTO*) ;;
17263 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17264 esac
17265 echo "Prototype: $try" ;;
17266 esac
17267 ;;
c18e646a
JH
17268 *) case "$usethreads" in
17269 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17270 esac
90e831dc
SB
17271 d_setnetent_r=undef
17272 setnetent_r_proto=0
c18e646a 17273 ;;
a48ec845
JH
17274 esac
17275 ;;
10bc17b6
JH
17276*) setnetent_r_proto=0
17277 ;;
17278esac
17279
b4eb6b3d
JH
17280: see if setprotoent exists
17281set setprotoent d_setpent
17282eval $inlibc
17283
17284: see if setpgid exists
17285set setpgid d_setpgid
17286eval $inlibc
17287
17288: see if setpgrp2 exists
17289set setpgrp2 d_setpgrp2
17290eval $inlibc
17291
17292: see if setpriority exists
17293set setpriority d_setprior
17294eval $inlibc
17295
17296: see if setproctitle exists
17297set setproctitle d_setproctitle
17298eval $inlibc
17299
10bc17b6
JH
17300: see if setprotoent_r exists
17301set setprotoent_r d_setprotoent_r
17302eval $inlibc
17303case "$d_setprotoent_r" in
17304"$define")
17305 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17306 case "$d_setprotoent_r_proto:$usethreads" in
17307 ":define") d_setprotoent_r_proto=define
a48ec845
JH
17308 set d_setprotoent_r_proto setprotoent_r $hdrs
17309 eval $hasproto ;;
17310 *) ;;
17311 esac
17312 case "$d_setprotoent_r_proto" in
17313 define)
10bc17b6
JH
17314 case "$setprotoent_r_proto" in
17315 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
61c26d18 17316 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
10bc17b6
JH
17317 esac
17318 case "$setprotoent_r_proto" in
17319 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
61c26d18 17320 ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
10bc17b6
JH
17321 esac
17322 case "$setprotoent_r_proto" in
90e831dc 17323 ''|0) d_setprotoent_r=undef
10bc17b6 17324 setprotoent_r_proto=0
a48ec845 17325 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17326 * ) case "$setprotoent_r_proto" in
17327 REENTRANT_PROTO*) ;;
17328 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17329 esac
17330 echo "Prototype: $try" ;;
17331 esac
17332 ;;
c18e646a
JH
17333 *) case "$usethreads" in
17334 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17335 esac
90e831dc
SB
17336 d_setprotoent_r=undef
17337 setprotoent_r_proto=0
c18e646a 17338 ;;
a48ec845
JH
17339 esac
17340 ;;
10bc17b6
JH
17341*) setprotoent_r_proto=0
17342 ;;
17343esac
17344
b4eb6b3d
JH
17345: see if setpwent exists
17346set setpwent d_setpwent
17347eval $inlibc
17348
10bc17b6
JH
17349: see if setpwent_r exists
17350set setpwent_r d_setpwent_r
17351eval $inlibc
17352case "$d_setpwent_r" in
17353"$define")
17354 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
17355 case "$d_setpwent_r_proto:$usethreads" in
17356 ":define") d_setpwent_r_proto=define
a48ec845
JH
17357 set d_setpwent_r_proto setpwent_r $hdrs
17358 eval $hasproto ;;
17359 *) ;;
17360 esac
17361 case "$d_setpwent_r_proto" in
17362 define)
10bc17b6
JH
17363 case "$setpwent_r_proto" in
17364 ''|0) try='int setpwent_r(FILE**);'
61c26d18 17365 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
10bc17b6
JH
17366 esac
17367 case "$setpwent_r_proto" in
17368 ''|0) try='void setpwent_r(FILE**);'
61c26d18 17369 ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
10bc17b6
JH
17370 esac
17371 case "$setpwent_r_proto" in
90e831dc 17372 ''|0) d_setpwent_r=undef
10bc17b6 17373 setpwent_r_proto=0
a48ec845 17374 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17375 * ) case "$setpwent_r_proto" in
17376 REENTRANT_PROTO*) ;;
17377 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17378 esac
17379 echo "Prototype: $try" ;;
17380 esac
17381 ;;
c18e646a
JH
17382 *) case "$usethreads" in
17383 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17384 esac
90e831dc
SB
17385 d_setpwent_r=undef
17386 setpwent_r_proto=0
c18e646a 17387 ;;
a48ec845
JH
17388 esac
17389 ;;
10bc17b6
JH
17390*) setpwent_r_proto=0
17391 ;;
17392esac
17393
b4eb6b3d
JH
17394: see if setregid exists
17395set setregid d_setregid
17396eval $inlibc
17397set setresgid d_setresgid
17398eval $inlibc
17399
17400: see if setreuid exists
17401set setreuid d_setreuid
17402eval $inlibc
17403set setresuid d_setresuid
17404eval $inlibc
17405
17406: see if setrgid exists
17407set setrgid d_setrgid
17408eval $inlibc
17409
17410: see if setruid exists
17411set setruid d_setruid
17412eval $inlibc
17413
17414: see if setservent exists
17415set setservent d_setsent
17416eval $inlibc
17417
10bc17b6
JH
17418: see if setservent_r exists
17419set setservent_r d_setservent_r
17420eval $inlibc
17421case "$d_setservent_r" in
17422"$define")
17423 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
17424 case "$d_setservent_r_proto:$usethreads" in
17425 ":define") d_setservent_r_proto=define
a48ec845
JH
17426 set d_setservent_r_proto setservent_r $hdrs
17427 eval $hasproto ;;
17428 *) ;;
17429 esac
17430 case "$d_setservent_r_proto" in
17431 define)
10bc17b6
JH
17432 case "$setservent_r_proto" in
17433 ''|0) try='int setservent_r(int, struct servent_data*);'
61c26d18 17434 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
10bc17b6
JH
17435 esac
17436 case "$setservent_r_proto" in
17437 ''|0) try='void setservent_r(int, struct servent_data*);'
61c26d18 17438 ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
10bc17b6
JH
17439 esac
17440 case "$setservent_r_proto" in
90e831dc 17441 ''|0) d_setservent_r=undef
10bc17b6 17442 setservent_r_proto=0
a48ec845 17443 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17444 * ) case "$setservent_r_proto" in
17445 REENTRANT_PROTO*) ;;
17446 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17447 esac
17448 echo "Prototype: $try" ;;
17449 esac
17450 ;;
c18e646a
JH
17451 *) case "$usethreads" in
17452 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17453 esac
90e831dc
SB
17454 d_setservent_r=undef
17455 setservent_r_proto=0
c18e646a 17456 ;;
a48ec845
JH
17457 esac
17458 ;;
10bc17b6
JH
17459*) setservent_r_proto=0
17460 ;;
17461esac
17462
b4eb6b3d
JH
17463: see if setsid exists
17464set setsid d_setsid
17465eval $inlibc
17466
17467: see if setvbuf exists
17468set setvbuf d_setvbuf
17469eval $inlibc
17470
17471: see if sfio.h is available
17472set sfio.h i_sfio
17473eval $inhdr
17474
b4eb6b3d
JH
17475: see if sfio library is available
17476case "$i_sfio" in
17477$define)
17478 val=''
17479 set sfreserve val
17480 eval $inlibc
17481 ;;
17482*)
17483 val="$undef"
17484 ;;
17485esac
17486: Ok, but do we want to use it.
17487case "$val" in
17488$define)
17489 case "$usesfio" in
17490 true|$define|[yY]*) dflt='y';;
17491 *) dflt='n';;
17492 esac
17493 echo "$package can use the sfio library, but it is experimental."
b4eb6b3d
JH
17494 rp="You seem to have sfio available, do you want to try using it?"
17495 . ./myread
17496 case "$ans" in
dd35fa16 17497 y|Y) echo "Ok, turning on sfio then."
b4eb6b3d
JH
17498 val="$define"
17499 ;;
17500 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
17501 val="$undef"
b4eb6b3d
JH
17502 ;;
17503 esac
17504 ;;
17505*) case "$usesfio" in
17506 true|$define|[yY]*)
17507 echo "Sorry, cannot find sfio on this machine." >&4
17508 echo "Ignoring your setting of usesfio=$usesfio." >&4
17509 val="$undef"
17510 ;;
17511 esac
17512 ;;
17513esac
17514set d_sfio
17515eval $setvar
17516case "$d_sfio" in
17517$define) usesfio='true';;
17518*) usesfio='false';;
17519esac
3659ebf1
JH
17520case "$d_sfio" in
17521$define) ;;
17522*) : Remove sfio from list of libraries to use
7483f793
JH
17523 case "$libs" in
17524 *-lsfio*)
17525 echo "Removing unneeded -lsfio from library list" >&4
17526 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17527 shift
17528 libs="$*"
17529 echo "libs = $libs" >&4
17530 ;;
17531 esac
3659ebf1
JH
17532;;
17533esac
17534
b4eb6b3d
JH
17535
17536: see if shmctl exists
17537set shmctl d_shmctl
17538eval $inlibc
17539
17540: see if shmget exists
17541set shmget d_shmget
17542eval $inlibc
17543
17544: see if shmat exists
17545set shmat d_shmat
17546eval $inlibc
17547: see what shmat returns
17548case "$d_shmat" in
17549"$define")
17550 $cat >shmat.c <<'END'
17551#include <sys/shm.h>
17552void *shmat();
17553END
17554 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17555 shmattype='void *'
17556 else
17557 shmattype='char *'
17558 fi
17559 echo "and it returns ($shmattype)." >&4
17560 : see if a prototype for shmat is available
17561 xxx=`./findhdr sys/shm.h`
17562 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17563 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17564 val="$define"
17565 else
17566 val="$undef"
17567 fi
17568 $rm -f shmat.[co]
17569 ;;
17570*)
17571 val="$undef"
17572 ;;
17573esac
17574set d_shmatprototype
17575eval $setvar
17576
17577: see if shmdt exists
17578set shmdt d_shmdt
17579eval $inlibc
17580
17581: see how much of the 'shm*(2)' library is present.
17582h_shm=true
17583echo " "
17584case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17585*"$undef"*) h_shm=false;;
17586esac
17587case "$osname" in
17588freebsd)
17589 case "`ipcs 2>&1`" in
17590 "SVID shared memory"*"not configured"*)
17591 echo "Your $osname does not have the shm*(2) configured." >&4
17592 h_shm=false
17593 val="$undef"
17594 set shmctl d_shmctl
17595 evat $setvar
17596 set shmget d_shmget
17597 evat $setvar
17598 set shmat d_shmat
17599 evat $setvar
17600 set shmdt d_shmdt
17601 evat $setvar
17602 ;;
17603 esac
17604 ;;
17605esac
17606: we could also check for sys/ipc.h ...
17607if $h_shm && $test `./findhdr sys/shm.h`; then
17608 echo "You have the full shm*(2) library." >&4
17609 val="$define"
17610else
17611 echo "You don't have the full shm*(2) library." >&4
17612 val="$undef"
17613fi
17614set d_shm
17615eval $setvar
17616
b4eb6b3d 17617: see if we have sigaction
613d6c3e 17618echo " "
b4eb6b3d
JH
17619if set sigaction val -f d_sigaction; eval $csym; $val; then
17620 echo 'sigaction() found.' >&4
073b6de5 17621 $cat > try.c <<EOP
b4eb6b3d
JH
17622#include <stdio.h>
17623#include <sys/types.h>
17624#include <signal.h>
073b6de5
JH
17625#$i_stdlib I_STDLIB
17626#ifdef I_STDLIB
17627#include <stdlib.h>
17628#endif
b4eb6b3d
JH
17629int main()
17630{
17631 struct sigaction act, oact;
17632 act.sa_flags = 0;
17633 oact.sa_handler = 0;
17634 /* so that act and oact are used */
17635 exit(act.sa_flags == 0 && oact.sa_handler == 0);
17636}
17637EOP
17638 set try
17639 if eval $compile_ok; then
17640 val="$define"
17641 else
17642 echo "But you don't seem to have a useable struct sigaction." >&4
17643 val="$undef"
17644 fi
17645else
17646 echo 'sigaction NOT found.' >&4
17647 val="$undef"
17648fi
17649set d_sigaction; eval $setvar
5b813a60 17650$rm_try
b4eb6b3d 17651
ed140128
AD
17652: see if this is a sunmath.h system
17653set sunmath.h i_sunmath
17654eval $inhdr
17655
17656: see if signbit exists
17657$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17658$cat >try.c <<EOCP
17659#$i_math I_MATH
17660#$i_sunmath I_SUNMATH
17661#ifdef I_MATH
17662# include <math.h>
17663#endif
17664#ifdef I_SUNMATH /* Solaris special math library */
17665# include <sunmath.h>
17666#endif
17667#define NV $nvtype
17668int main(int argc, char **argv)
17669{
17670 NV x = 0.0;
17671 NV y = -0.0;
17672 if ((signbit(x) == 0) && (signbit(y) != 0))
17673 return 0;
17674 else
17675 return 1;
17676}
17677EOCP
17678val="$undef"
17679set try
17680if eval $compile; then
17681 if $run ./try; then
17682 $echo "Yes." >&4
17683 val="$define"
17684 else
17685 $echo "Signbit seems to be available, but doesn't work as I expected."
17686 $echo "I won't use it." >&4
17687 val="$undef"
17688 fi
17689else
17690 $echo "Nope." >&4
17691 dflt="$undef"
17692fi
17693set d_signbit
17694eval $setvar
5b813a60 17695$rm_try
ed140128 17696
983dbef6
JH
17697: see if sigprocmask exists
17698set sigprocmask d_sigprocmask
17699eval $inlibc
17700
b4eb6b3d
JH
17701: see if sigsetjmp exists
17702echo " "
17703case "$d_sigsetjmp" in
17704'')
c727eafa 17705 $cat >try.c <<EOP
b4eb6b3d 17706#include <setjmp.h>
d1daaddf
JH
17707#$i_stdlib I_STDLIB
17708#ifdef I_STDLIB
17709#include <stdlib.h>
17710#endif
b4eb6b3d
JH
17711sigjmp_buf env;
17712int set = 1;
17713int main()
17714{
17715 if (sigsetjmp(env,1))
17716 exit(set);
17717 set = 0;
17718 siglongjmp(env, 1);
17719 exit(1);
17720}
17721EOP
17722 set try
17723 if eval $compile; then
5440bc8e 17724 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
17725 echo "POSIX sigsetjmp found." >&4
17726 val="$define"
17727 else
17728 $cat >&4 <<EOM
17729Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17730I'll ignore them.
17731EOM
17732 val="$undef"
17733 fi
17734 else
17735 echo "sigsetjmp not found." >&4
17736 val="$undef"
17737 fi
17738 ;;
17739*) val="$d_sigsetjmp"
17740 case "$d_sigsetjmp" in
17741 $define) echo "POSIX sigsetjmp found." >&4;;
17742 $undef) echo "sigsetjmp not found." >&4;;
17743 esac
17744 ;;
17745esac
17746set d_sigsetjmp
17747eval $setvar
5b813a60 17748$rm_try
b4eb6b3d 17749
4f5da3e9
SP
17750: see if snprintf exists
17751set snprintf d_snprintf
17752eval $inlibc
17753
17754: see if vsnprintf exists
17755set vsnprintf d_vsnprintf
17756eval $inlibc
17757
2478f7a0
MB
17758case "$d_snprintf-$d_vsnprintf" in
17759"$define-$define")
17760 $cat <<EOM
17761Checking whether your snprintf() and vsnprintf() work okay...
17762EOM
17763 $cat >try.c <<'EOCP'
17764/* v?snprintf testing logic courtesy of Russ Allbery.
17765 * According to C99:
17766 * - if the buffer is too short it still must be \0-terminated
17767 * - if the buffer is too short the potentially required length
17768 * must be returned and not -1
17769 * - if the buffer is NULL the potentially required length
17770 * must be returned and not -1 or core dump
17771 */
17772#include <stdio.h>
17773#include <stdarg.h>
17774
17775char buf[2];
17776
17777int test (char *format, ...)
17778{
17779 va_list args;
17780 int count;
17781
17782 va_start (args, format);
17783 count = vsnprintf (buf, sizeof buf, format, args);
17784 va_end (args);
17785 return count;
17786}
17787
17788int main ()
17789{
17790 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17791 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17792}
17793EOCP
17794 set try
17795 if eval $compile; then
17796 `$run ./try`
17797 case "$?" in
17798 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17799 *) cat <<EOM >&4
17800Your snprintf() and snprintf() don't seem to be working okay.
17801EOM
17802 d_snprintf="$undef"
17803 d_vsnprintf="$undef"
17804 ;;
17805 esac
17806 else
17807 echo "(I can't seem to compile the test program--assuming they don't)"
17808 d_snprintf="$undef"
17809 d_vsnprintf="$undef"
17810 fi
5b813a60 17811 $rm_try
2478f7a0
MB
17812 ;;
17813esac
17814
49a78c82
JH
17815: see if sockatmark exists
17816set sockatmark d_sockatmark
17817eval $inlibc
17818
2ef53570
JH
17819: see if prototype for sockatmark is available
17820echo " "
17821set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17822eval $hasproto
17823
b4eb6b3d
JH
17824: see if socks5_init exists
17825set socks5_init d_socks5_init
17826eval $inlibc
17827
360321b3
YST
17828: see if sprintf returns the length of the string in the buffer as per ANSI
17829$echo "Checking whether sprintf returns the length of the string..." >&4
17830$cat <<EOP >try.c
17831#include <stdio.h>
17832#$i_stdlib I_STDLIB
17833#ifdef I_STDLIB
17834#include <stdlib.h>
17835#endif
17836#$i_string I_STRING
17837#ifdef I_STRING
17838# include <string.h>
17839#else
17840# include <strings.h>
17841#endif
17842#$i_math I_MATH
17843#ifdef I_MATH
17844#include <math.h>
17845#endif
17846
17847char buffer[256];
17848
17849int check (size_t expect, int test) {
17850 size_t got = strlen(buffer);
17851 if (expect == got)
17852 return 0;
17853
17854 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17855 test, buffer);
17856 exit (test);
17857}
17858
17859int main(int argc, char **argv) {
17860 int test = 0;
17861
17862 check(sprintf(buffer, ""), ++test);
17863 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17864 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17865
17866 return 0;
17867}
17868EOP
17869set try
17870
360321b3
YST
17871if eval $compile; then
17872 xxx="`$run ./try`"
17873 case "$?" in
17874 0) cat >&4 <<EOM
17875sprintf returns the length of the string (as ANSI says it should)
17876EOM
17877 d_sprintf_returns_strlen="$define"
17878 ;;
17879 *) cat >&4 <<EOM
17880sprintf does not return the length of the string (how old is this system?)
17881EOM
17882 d_sprintf_returns_strlen="$undef"
17883 ;;
17884 esac
d2821e72 17885else
36a30365
JH
17886 echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17887 d_sprintf_returns_strlen="$undef"
360321b3 17888fi
5b813a60 17889$rm_try
360321b3 17890
10bc17b6
JH
17891: see if srand48_r exists
17892set srand48_r d_srand48_r
17893eval $inlibc
17894case "$d_srand48_r" in
17895"$define")
17896 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17897 case "$d_srand48_r_proto:$usethreads" in
17898 ":define") d_srand48_r_proto=define
a48ec845
JH
17899 set d_srand48_r_proto srand48_r $hdrs
17900 eval $hasproto ;;
17901 *) ;;
17902 esac
17903 case "$d_srand48_r_proto" in
17904 define)
10bc17b6
JH
17905 case "$srand48_r_proto" in
17906 ''|0) try='int srand48_r(long, struct drand48_data*);'
61c26d18 17907 ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
10bc17b6
JH
17908 esac
17909 case "$srand48_r_proto" in
90e831dc 17910 ''|0) d_srand48_r=undef
10bc17b6 17911 srand48_r_proto=0
a48ec845 17912 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17913 * ) case "$srand48_r_proto" in
17914 REENTRANT_PROTO*) ;;
17915 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17916 esac
17917 echo "Prototype: $try" ;;
17918 esac
17919 ;;
c18e646a
JH
17920 *) case "$usethreads" in
17921 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17922 esac
90e831dc
SB
17923 d_srand48_r=undef
17924 srand48_r_proto=0
c18e646a 17925 ;;
a48ec845
JH
17926 esac
17927 ;;
10bc17b6
JH
17928*) srand48_r_proto=0
17929 ;;
17930esac
17931
17932: see if srandom_r exists
17933set srandom_r d_srandom_r
17934eval $inlibc
17935case "$d_srandom_r" in
17936"$define")
17937 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17938 case "$d_srandom_r_proto:$usethreads" in
17939 ":define") d_srandom_r_proto=define
a48ec845
JH
17940 set d_srandom_r_proto srandom_r $hdrs
17941 eval $hasproto ;;
17942 *) ;;
17943 esac
17944 case "$d_srandom_r_proto" in
17945 define)
10bc17b6
JH
17946 case "$srandom_r_proto" in
17947 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
61c26d18 17948 ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
10bc17b6
JH
17949 esac
17950 case "$srandom_r_proto" in
90e831dc 17951 ''|0) d_srandom_r=undef
10bc17b6 17952 srandom_r_proto=0
a48ec845 17953 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17954 * ) case "$srandom_r_proto" in
17955 REENTRANT_PROTO*) ;;
17956 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17957 esac
17958 echo "Prototype: $try" ;;
17959 esac
17960 ;;
c18e646a
JH
17961 *) case "$usethreads" in
17962 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17963 esac
90e831dc
SB
17964 d_srandom_r=undef
17965 srandom_r_proto=0
c18e646a 17966 ;;
a48ec845
JH
17967 esac
17968 ;;
10bc17b6
JH
17969*) srandom_r_proto=0
17970 ;;
17971esac
17972
eef837ea
JH
17973: see if prototype for setresgid is available
17974echo " "
17975set d_sresgproto setresgid $i_unistd unistd.h
17976eval $hasproto
17977
640374d0
JH
17978: see if prototype for setresuid is available
17979echo " "
17980set d_sresuproto setresuid $i_unistd unistd.h
17981eval $hasproto
17982
b4eb6b3d
JH
17983: see if sys/stat.h is available
17984set sys/stat.h i_sysstat
17985eval $inhdr
17986
b4eb6b3d
JH
17987: see if stat knows about block sizes
17988echo " "
17989echo "Checking to see if your struct stat has st_blocks field..." >&4
17990set d_statblks stat st_blocks $i_sysstat sys/stat.h
17991eval $hasfield
17992
b4eb6b3d
JH
17993: see if this is a sys/vfs.h system
17994set sys/vfs.h i_sysvfs
17995eval $inhdr
17996
b4eb6b3d
JH
17997: see if this is a sys/statfs.h system
17998set sys/statfs.h i_sysstatfs
17999eval $inhdr
18000
34f1896b 18001: Check for statfs_s
b4eb6b3d
JH
18002echo " "
18003echo "Checking to see if your system supports struct statfs..." >&4
18004set 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
18005eval $hasstruct
18006case "$d_statfs_s" in
18007"$define") echo "Yes, it does." ;;
18008*) echo "No, it doesn't." ;;
18009esac
18010
18011
b4eb6b3d
JH
18012: see if struct statfs knows about f_flags
18013case "$d_statfs_s" in
34f1896b 18014define)
b4eb6b3d
JH
18015 echo " "
18016 echo "Checking to see if your struct statfs has f_flags field..." >&4
18017 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
18018 eval $hasfield
18019 ;;
18020*) val="$undef"
18021 set d_statfs_f_flags
18022 eval $setvar
18023 ;;
18024esac
18025case "$d_statfs_f_flags" in
18026"$define") echo "Yes, it does." ;;
18027*) echo "No, it doesn't." ;;
18028esac
18029
17a6c8e3
AD
18030: see what flavor, if any, of static inline is supported
18031echo " "
18032echo "Checking to see if your system supports static inline..."
18033$cat > try.c <<'EOCP'
18034#include <stdlib.h>
18035extern int f_via_a(int x);
18036extern int f_via_b(int x);
18037int main(int argc, char **argv)
18038{
18039 int y;
18040
18041 y = f_via_a(0);
18042#ifdef USE_B
18043 y = f_via_b(0);
18044#endif
18045 if (y == 42) {
18046 return EXIT_SUCCESS;
18047 }
18048 else {
18049 return EXIT_FAILURE;
18050 }
18051}
18052EOCP
18053$cat > a.c <<'EOCP'
18054static INLINE int f(int x) {
18055 int y;
18056 y = x + 42;
18057 return y;
18058}
18059
18060int f_via_a(int x)
18061{
18062 return f(x);
18063}
18064EOCP
18065$cat > b.c <<'EOCP'
18066extern int f(int x);
18067
18068int f_via_b(int x)
18069{
18070 return f(x);
18071}
18072EOCP
18073
18074# Respect a hint (or previous) value for perl_static_inline, if there is one.
18075case "$perl_static_inline" in
18076'') # Check the various possibilities, and break out on success.
18077 # For gcc, prefer __inline__, which will still permit
18078 # cflags.SH to add in -ansi.
18079 case "$gccversion" in
18080 '') xxx="inline __inline__ __inline _inline";;
18081 *) xxx="__inline__ inline __inline _inline";;
18082 esac
18083 for inline in $xxx; do
18084 set try -DINLINE=$inline a.c
18085 if eval $compile && $run ./try; then
18086 # Now make sure there is no external linkage of static
18087 # functions
18088 set try -DINLINE=$inline -DUSE_B a.c b.c
18089 if eval $compile && $run ./try; then
18090 $echo "Your compiler supports static $inline, " >&4
18091 $echo "but it also creates an external definition," >&4
18092 $echo "so I won't use it." >&4
18093 val=$undef
18094 else
18095 $echo "Your compiler supports static $inline." >&4
18096 val=$define
18097 perl_static_inline="static $inline";
18098 break;
18099 fi
18100 else
18101 $echo "Your compiler does NOT support static $inline." >&4
18102 val="$undef"
18103 fi
18104 done
18105 ;;
18106*inline*) # Some variant of inline exists.
18107 echo "Keeping your $hint value of $perl_static_inline."
18108 val=$define
18109 ;;
18110static) # No inline capabilities
18111 echo "Keeping your $hint value of $perl_static_inline."
18112 val=$undef
18113 ;;
18114*) # Unrecognized previous value -- blindly trust the supplied
18115 # value and hope it makes sense. Use old value for
18116 # d_static_inline, if there is one.
18117 echo "Keeping your $hint value of $perl_static_inline."
18118 case "$d_static_inline" in
18119 '') val=$define ;;
18120 *) val=$d_static_inline ;;
18121 esac
18122 ;;
18123esac
18124# Fallback to plain 'static' if nothing worked.
18125case "$perl_static_inline" in
18126'')
18127 perl_static_inline="static"
18128 val=$undef
18129 ;;
18130esac
18131set d_static_inline
18132eval $setvar
18133$rm -f a.[co] b.[co]
18134$rm_try
18135
613d6c3e 18136: Check stream access
b4eb6b3d
JH
18137$cat >&4 <<EOM
18138Checking how to access stdio streams by file descriptor number...
18139EOM
18140case "$stdio_stream_array" in
18141'') $cat >try.c <<EOCP
18142#include <stdio.h>
18143int main() {
18144 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18145 printf("yes\n");
18146}
18147EOCP
18148 for s in _iob __iob __sF
18149 do
18150 set try -DSTDIO_STREAM_ARRAY=$s
18151 if eval $compile; then
5440bc8e 18152 case "`$run ./try`" in
b4eb6b3d
JH
18153 yes) stdio_stream_array=$s; break ;;
18154 esac
18155 fi
18156 done
5b813a60 18157 $rm_try
b4eb6b3d
JH
18158esac
18159case "$stdio_stream_array" in
18160'') $cat >&4 <<EOM
18161I can't figure out how to access stdio streams by file descriptor number.
18162EOM
18163 d_stdio_stream_array="$undef"
18164 ;;
18165*) $cat >&4 <<EOM
18166You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18167EOM
18168 d_stdio_stream_array="$define"
18169 ;;
18170esac
18171
18172: see if strcoll exists
18173set strcoll d_strcoll
18174eval $inlibc
18175
18176: check for structure copying
18177echo " "
18178echo "Checking to see if your C compiler can copy structs..." >&4
18179$cat >try.c <<'EOCP'
76f47787 18180int main()
b4eb6b3d
JH
18181{
18182 struct blurfl {
18183 int dyick;
18184 } foo, bar;
18185
18186 foo = bar;
18187}
18188EOCP
18189if $cc -c try.c >/dev/null 2>&1 ; then
18190 val="$define"
18191 echo "Yup, it can."
18192else
18193 val="$undef"
18194 echo "Nope, it can't."
18195fi
18196set d_strctcpy
18197eval $setvar
5b813a60 18198$rm_try
b4eb6b3d
JH
18199
18200: see if strerror and/or sys_errlist[] exist
18201echo " "
18202if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18203 if set strerror val -f d_strerror; eval $csym; $val; then
18204 echo 'strerror() found.' >&4
18205 d_strerror="$define"
18206 d_strerrm='strerror(e)'
18207 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18208 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18209 d_syserrlst="$define"
18210 else
18211 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18212 d_syserrlst="$undef"
18213 fi
18214 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18215 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18216 echo 'strerror() found in string header.' >&4
18217 d_strerror="$define"
18218 d_strerrm='strerror(e)'
18219 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18220 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18221 d_syserrlst="$define"
18222 else
18223 echo "(You don't appear to have any sys_errlist[], how can this be?)"
18224 d_syserrlst="$undef"
18225 fi
18226 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18227 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18228 d_strerror="$undef"
18229 d_syserrlst="$define"
18230 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18231 else
18232 echo 'strerror() and sys_errlist[] NOT found.' >&4
18233 d_strerror="$undef"
18234 d_syserrlst="$undef"
18235 d_strerrm='"unknown"'
18236 fi
18237fi
18238
10bc17b6
JH
18239: see if strerror_r exists
18240set strerror_r d_strerror_r
18241eval $inlibc
18242case "$d_strerror_r" in
18243"$define")
18244 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
18245 case "$d_strerror_r_proto:$usethreads" in
18246 ":define") d_strerror_r_proto=define
a48ec845
JH
18247 set d_strerror_r_proto strerror_r $hdrs
18248 eval $hasproto ;;
18249 *) ;;
18250 esac
18251 case "$d_strerror_r_proto" in
18252 define)
10bc17b6
JH
18253 case "$strerror_r_proto" in
18254 ''|0) try='int strerror_r(int, char*, size_t);'
61c26d18 18255 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
10bc17b6
JH
18256 esac
18257 case "$strerror_r_proto" in
18258 ''|0) try='int strerror_r(int, char*, int);'
61c26d18 18259 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
10bc17b6
JH
18260 esac
18261 case "$strerror_r_proto" in
18262 ''|0) try='char* strerror_r(int, char*, size_t);'
61c26d18 18263 ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
10bc17b6
JH
18264 esac
18265 case "$strerror_r_proto" in
90e831dc 18266 ''|0) d_strerror_r=undef
10bc17b6 18267 strerror_r_proto=0
a48ec845 18268 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18269 * ) case "$strerror_r_proto" in
18270 REENTRANT_PROTO*) ;;
18271 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18272 esac
18273 echo "Prototype: $try" ;;
18274 esac
18275 ;;
c18e646a
JH
18276 *) case "$usethreads" in
18277 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18278 esac
90e831dc
SB
18279 d_strerror_r=undef
18280 strerror_r_proto=0
c18e646a 18281 ;;
a48ec845
JH
18282 esac
18283 ;;
10bc17b6
JH
18284*) strerror_r_proto=0
18285 ;;
18286esac
18287
b3c85772
JH
18288: see if strftime exists
18289set strftime d_strftime
18290eval $inlibc
18291
08c92000
MB
18292: see if strlcat exists
18293set strlcat d_strlcat
18294eval $inlibc
18295
18296: see if strlcpy exists
18297set strlcpy d_strlcpy
18298eval $inlibc
18299
b4eb6b3d
JH
18300: see if strtod exists
18301set strtod d_strtod
18302eval $inlibc
18303
18304: see if strtol exists
18305set strtol d_strtol
18306eval $inlibc
18307
18308: see if strtold exists
18309set strtold d_strtold
18310eval $inlibc
18311
18312: see if strtoll exists
18313set strtoll d_strtoll
18314eval $inlibc
18315
18316case "$d_longlong-$d_strtoll" in
18317"$define-$define")
18318 $cat <<EOM
18319Checking whether your strtoll() works okay...
18320EOM
18321 $cat >try.c <<'EOCP'
18322#include <errno.h>
18323#ifdef __hpux
18324#define strtoll __strtoll
18325#endif
e75931a7
YST
18326#ifdef __EMX__
18327#define strtoll _strtoll
18328#endif
b4eb6b3d 18329#include <stdio.h>
613d6c3e 18330extern long long int strtoll(char *s, char **, int);
b4eb6b3d
JH
18331static int bad = 0;
18332int check(char *s, long long ell, int een) {
18333 long long gll;
18334 errno = 0;
18335 gll = strtoll(s, 0, 10);
18336 if (!((gll == ell) && (errno == een)))
18337 bad++;
18338}
18339int main() {
18340 check(" 1", 1LL, 0);
18341 check(" 0", 0LL, 0);
18342 check("-1", -1LL, 0);
18343 check("-9223372036854775808", -9223372036854775808LL, 0);
18344 check("-9223372036854775808", -9223372036854775808LL, 0);
18345 check(" 9223372036854775807", 9223372036854775807LL, 0);
18346 check("-9223372036854775808", -9223372036854775808LL, 0);
18347 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
18348 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18349 if (!bad)
18350 printf("ok\n");
18351}
18352EOCP
18353 set try
18354 if eval $compile; then
5440bc8e 18355 yyy=`$run ./try`
e75931a7 18356 case "$yyy" in
b4eb6b3d
JH
18357 ok) echo "Your strtoll() seems to be working okay." ;;
18358 *) cat <<EOM >&4
18359Your strtoll() doesn't seem to be working okay.
18360EOM
18361 d_strtoll="$undef"
18362 ;;
69eadf66 18363 esac
e75931a7
YST
18364 else
18365 echo "(I can't seem to compile the test program--assuming it doesn't)"
18366 d_strtoll="$undef"
b4eb6b3d
JH
18367 fi
18368 ;;
18369esac
18370
28e5dec8
JH
18371: see if strtoq exists
18372set strtoq d_strtoq
18373eval $inlibc
18374
b4eb6b3d
JH
18375: see if strtoul exists
18376set strtoul d_strtoul
18377eval $inlibc
18378
d0e6d399
NC
18379case "$d_strtoul" in
18380"$define")
18381 $cat <<EOM
18382Checking whether your strtoul() works okay...
18383EOM
18384 $cat >try.c <<'EOCP'
18385#include <errno.h>
18386#include <stdio.h>
613d6c3e 18387extern unsigned long int strtoul(char *s, char **, int);
d0e6d399
NC
18388static int bad = 0;
18389void check(char *s, unsigned long eul, int een) {
18390 unsigned long gul;
18391 errno = 0;
18392 gul = strtoul(s, 0, 10);
18393 if (!((gul == eul) && (errno == een)))
18394 bad++;
18395}
18396int main() {
18397 check(" 1", 1L, 0);
18398 check(" 0", 0L, 0);
18399EOCP
18400 case "$longsize" in
18401 8)
18402 $cat >>try.c <<'EOCP'
09c0d2c4
JH
18403 check("18446744073709551615", 18446744073709551615UL, 0);
18404 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 18405#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 18406 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
18407 check("-18446744073709551614", 2, 0);
18408 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
18409 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18410 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 18411#endif
d0e6d399
NC
18412EOCP
18413 ;;
18414 4)
18415 $cat >>try.c <<'EOCP'
18416 check("4294967295", 4294967295UL, 0);
18417 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 18418#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
18419 check("-1", 4294967295UL, 0);
18420 check("-4294967294", 2, 0);
18421 check("-4294967295", 1, 0);
18422 check("-4294967296", 4294967295UL, ERANGE);
18423 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 18424#endif
d0e6d399
NC
18425EOCP
18426 ;;
18427 *)
18428: Should we write these tests to be more portable by sprintf-ing
18429: ~0 and then manipulating that char string as input for strtol?
18430 ;;
18431 esac
18432 $cat >>try.c <<'EOCP'
18433 if (!bad)
18434 printf("ok\n");
18435 return 0;
18436}
18437EOCP
18438 set try
18439 if eval $compile; then
5440bc8e 18440 case "`$run ./try`" in
d0e6d399
NC
18441 ok) echo "Your strtoul() seems to be working okay." ;;
18442 *) cat <<EOM >&4
18443Your strtoul() doesn't seem to be working okay.
18444EOM
18445 d_strtoul="$undef"
18446 ;;
18447 esac
9597a80f
NC
18448 else
18449 echo "(I can't seem to compile the test program--assuming it doesn't)"
18450 d_strtoul="$undef"
d0e6d399
NC
18451 fi
18452 ;;
18453esac
18454
b4eb6b3d
JH
18455: see if strtoull exists
18456set strtoull d_strtoull
18457eval $inlibc
18458
18459case "$d_longlong-$d_strtoull" in
18460"$define-$define")
18461 $cat <<EOM
18462Checking whether your strtoull() works okay...
18463EOM
18464 $cat >try.c <<'EOCP'
18465#include <errno.h>
18466#ifdef __hpux
18467#define strtoull __strtoull
18468#endif
18469#include <stdio.h>
613d6c3e 18470extern unsigned long long int strtoull(char *s, char **, int);
b4eb6b3d
JH
18471static int bad = 0;
18472int check(char *s, long long eull, int een) {
18473 long long gull;
18474 errno = 0;
18475 gull = strtoull(s, 0, 10);
18476 if (!((gull == eull) && (errno == een)))
18477 bad++;
18478}
18479int main() {
d0e6d399
NC
18480 check(" 1", 1LL, 0);
18481 check(" 0", 0LL, 0);
18482 check("18446744073709551615", 18446744073709551615ULL, 0);
18483 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18484#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
18485 check("-1", 18446744073709551615ULL, 0);
18486 check("-18446744073709551614", 2LL, 0);
18487 check("-18446744073709551615", 1LL, 0);
18488 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18489 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18490#endif
b4eb6b3d
JH
18491 if (!bad)
18492 printf("ok\n");
18493}
18494EOCP
18495 set try
18496 if eval $compile; then
5440bc8e 18497 case "`$run ./try`" in
b4eb6b3d
JH
18498 ok) echo "Your strtoull() seems to be working okay." ;;
18499 *) cat <<EOM >&4
18500Your strtoull() doesn't seem to be working okay.
18501EOM
18502 d_strtoull="$undef"
18503 ;;
18504 esac
9597a80f
NC
18505 else
18506 echo "(I can't seem to compile the test program--assuming it doesn't)"
18507 d_strtoull="$undef"
b4eb6b3d
JH
18508 fi
18509 ;;
18510esac
18511
18512: see if strtouq exists
18513set strtouq d_strtouq
18514eval $inlibc
18515
d0e6d399
NC
18516case "$d_strtouq" in
18517"$define")
18518 $cat <<EOM
18519Checking whether your strtouq() works okay...
18520EOM
18521 $cat >try.c <<'EOCP'
18522#include <errno.h>
18523#include <stdio.h>
613d6c3e 18524extern unsigned long long int strtouq(char *s, char **, int);
d0e6d399
NC
18525static int bad = 0;
18526void check(char *s, unsigned long long eull, int een) {
18527 unsigned long long gull;
18528 errno = 0;
18529 gull = strtouq(s, 0, 10);
18530 if (!((gull == eull) && (errno == een)))
18531 bad++;
18532}
18533int main() {
18534 check(" 1", 1LL, 0);
18535 check(" 0", 0LL, 0);
18536 check("18446744073709551615", 18446744073709551615ULL, 0);
18537 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 18538#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
18539 check("-1", 18446744073709551615ULL, 0);
18540 check("-18446744073709551614", 2LL, 0);
18541 check("-18446744073709551615", 1LL, 0);
18542 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18543 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 18544#endif
d0e6d399
NC
18545 if (!bad)
18546 printf("ok\n");
18547 return 0;
18548}
18549EOCP
18550 set try
18551 if eval $compile; then
5440bc8e 18552 case "`$run ./try`" in
d0e6d399
NC
18553 ok) echo "Your strtouq() seems to be working okay." ;;
18554 *) cat <<EOM >&4
18555Your strtouq() doesn't seem to be working okay.
18556EOM
18557 d_strtouq="$undef"
18558 ;;
18559 esac
9597a80f
NC
18560 else
18561 echo "(I can't seem to compile the test program--assuming it doesn't)"
18562 d_strtouq="$undef"
d0e6d399
NC
18563 fi
18564 ;;
18565esac
18566
b4eb6b3d
JH
18567: see if strxfrm exists
18568set strxfrm d_strxfrm
18569eval $inlibc
18570
18571: see if symlink exists
18572set symlink d_symlink
18573eval $inlibc
18574
18575: see if syscall exists
18576set syscall d_syscall
18577eval $inlibc
18578
2ef53570
JH
18579: see if prototype for syscall is available
18580echo " "
18581set d_syscallproto syscall $i_unistd unistd.h
18582eval $hasproto
18583
b4eb6b3d
JH
18584: see if sysconf exists
18585set sysconf d_sysconf
18586eval $inlibc
18587
18588: see if system exists
18589set system d_system
18590eval $inlibc
18591
18592: see if tcgetpgrp exists
18593set tcgetpgrp d_tcgetpgrp
18594eval $inlibc
18595
18596: see if tcsetpgrp exists
18597set tcsetpgrp d_tcsetpgrp
18598eval $inlibc
18599
18600: see if prototype for telldir is available
18601echo " "
18602set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18603eval $hasproto
18604
ad493445
MB
18605: see if time exists
18606echo " "
18607if test "X$d_time" = X -o X"$timetype" = X; then
18608 if set time val -f d_time; eval $csym; $val; then
18609 echo 'time() found.' >&4
18610 val="$define"
18611 rp="What is the type returned by time() on this system?"
18612 set time_t timetype long stdio.h sys/types.h
18613 eval $typedef_ask
18614 else
18615 echo 'time() not found, hope that will do.' >&4
18616 val="$undef"
18617 timetype='int';
18618 fi
18619 set d_time
18620 eval $setvar
18621fi
18622
cbb9e8a7
MB
18623: see if timegm exists
18624set timegm d_timegm
18625eval $inlibc
18626
b4eb6b3d
JH
18627: see if this is a sys/times.h system
18628set sys/times.h i_systimes
18629eval $inhdr
18630
18631: see if times exists
18632echo " "
18633if set times val -f d_times; eval $csym; $val; then
18634 echo 'times() found.' >&4
18635 d_times="$define"
18636 inc=''
18637 case "$i_systimes" in
18638 "$define") inc='sys/times.h';;
18639 esac
18640 rp="What is the type returned by times() on this system?"
18641 set clock_t clocktype long stdio.h sys/types.h $inc
18642 eval $typedef_ask
18643else
18644 echo 'times() NOT found, hope that will do.' >&4
18645 d_times="$undef"
18646 clocktype='int'
18647fi
18648
10bc17b6
JH
18649: see if tmpnam_r exists
18650set tmpnam_r d_tmpnam_r
18651eval $inlibc
18652case "$d_tmpnam_r" in
18653"$define")
31ee0cb7 18654 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
18655 case "$d_tmpnam_r_proto:$usethreads" in
18656 ":define") d_tmpnam_r_proto=define
a48ec845
JH
18657 set d_tmpnam_r_proto tmpnam_r $hdrs
18658 eval $hasproto ;;
18659 *) ;;
18660 esac
18661 case "$d_tmpnam_r_proto" in
18662 define)
10bc17b6
JH
18663 case "$tmpnam_r_proto" in
18664 ''|0) try='char* tmpnam_r(char*);'
61c26d18 18665 ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
10bc17b6
JH
18666 esac
18667 case "$tmpnam_r_proto" in
90e831dc 18668 ''|0) d_tmpnam_r=undef
10bc17b6 18669 tmpnam_r_proto=0
a48ec845 18670 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18671 * ) case "$tmpnam_r_proto" in
18672 REENTRANT_PROTO*) ;;
18673 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18674 esac
18675 echo "Prototype: $try" ;;
18676 esac
18677 ;;
c18e646a
JH
18678 *) case "$usethreads" in
18679 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18680 esac
90e831dc
SB
18681 d_tmpnam_r=undef
18682 tmpnam_r_proto=0
c18e646a 18683 ;;
a48ec845
JH
18684 esac
18685 ;;
10bc17b6
JH
18686*) tmpnam_r_proto=0
18687 ;;
18688esac
18689
b4eb6b3d
JH
18690: see if truncate exists
18691set truncate d_truncate
18692eval $inlibc
18693
10bc17b6
JH
18694: see if ttyname_r exists
18695set ttyname_r d_ttyname_r
18696eval $inlibc
18697case "$d_ttyname_r" in
18698"$define")
18699 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
18700 case "$d_ttyname_r_proto:$usethreads" in
18701 ":define") d_ttyname_r_proto=define
a48ec845
JH
18702 set d_ttyname_r_proto ttyname_r $hdrs
18703 eval $hasproto ;;
18704 *) ;;
18705 esac
18706 case "$d_ttyname_r_proto" in
18707 define)
10bc17b6
JH
18708 case "$ttyname_r_proto" in
18709 ''|0) try='int ttyname_r(int, char*, size_t);'
61c26d18 18710 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
10bc17b6
JH
18711 esac
18712 case "$ttyname_r_proto" in
18713 ''|0) try='int ttyname_r(int, char*, int);'
61c26d18 18714 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
10bc17b6
JH
18715 esac
18716 case "$ttyname_r_proto" in
18717 ''|0) try='char* ttyname_r(int, char*, int);'
61c26d18 18718 ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
10bc17b6
JH
18719 esac
18720 case "$ttyname_r_proto" in
90e831dc 18721 ''|0) d_ttyname_r=undef
10bc17b6 18722 ttyname_r_proto=0
a48ec845 18723 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
18724 * ) case "$ttyname_r_proto" in
18725 REENTRANT_PROTO*) ;;
18726 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18727 esac
18728 echo "Prototype: $try" ;;
18729 esac
18730 ;;
c18e646a
JH
18731 *) case "$usethreads" in
18732 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18733 esac
90e831dc
SB
18734 d_ttyname_r=undef
18735 ttyname_r_proto=0
c18e646a 18736 ;;
a48ec845
JH
18737 esac
18738 ;;
10bc17b6
JH
18739*) ttyname_r_proto=0
18740 ;;
18741esac
18742
b4eb6b3d
JH
18743: see if tzname[] exists
18744echo " "
18745if set tzname val -a d_tzname; eval $csym; $val; then
18746 val="$define"
18747 echo 'tzname[] found.' >&4
18748else
18749 val="$undef"
18750 echo 'tzname[] NOT found.' >&4
18751fi
18752set d_tzname
18753eval $setvar
18754
613d6c3e 18755: Check if is a multiplatform env
4e0554ec 18756case "$osname" in
7eb35c03 18757next|darwin) multiarch="$define" ;;
4e0554ec
JH
18758esac
18759case "$multiarch" in
18760''|[nN]*) multiarch="$undef" ;;
18761esac
18762
24412007 18763: check for ordering of bytes in a UV
4e0554ec 18764echo " "
5440bc8e 18765case "$usecrosscompile$multiarch" in
4e0554ec
JH
18766*$define*)
18767 $cat <<EOM
18768You seem to be either cross-compiling or doing a multiarchitecture build,
18769skipping the byteorder check.
18770
18771EOM
5440bc8e 18772 byteorder='ffff'
4e0554ec
JH
18773 ;;
18774*)
18775 case "$byteorder" in
18776 '')
18777 $cat <<'EOM'
18778In the following, larger digits indicate more significance. A big-endian
18779machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18780little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18781machines may have weird orders like 3412. A Cray will report 87654321,
18782an Alpha will report 12345678. If the test program works the default is
18783probably right.
18784I'm now running the test program...
18785EOM
24412007 18786 $cat >try.c <<EOCP
4e0554ec 18787#include <stdio.h>
55954f19
JH
18788#$i_stdlib I_STDLIB
18789#ifdef I_STDLIB
18790#include <stdlib.h>
18791#endif
24412007
JH
18792#include <sys/types.h>
18793typedef $uvtype UV;
4e0554ec
JH
18794int main()
18795{
18796 int i;
18797 union {
24412007
JH
18798 UV l;
18799 char c[$uvsize];
4e0554ec
JH
18800 } u;
18801
24412007 18802 if ($uvsize > 4)
b5ded3e5 18803 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 18804 else
a4c53327 18805 u.l = (UV)0x04030201;
24412007 18806 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
18807 printf("%c", u.c[i]+'0');
18808 printf("\n");
18809 exit(0);
18810}
18811EOCP
18812 xxx_prompt=y
18813 set try
43dddb59 18814 if eval $compile && $run ./try > /dev/null; then
5440bc8e 18815 dflt=`$run ./try`
4e0554ec
JH
18816 case "$dflt" in
18817 [1-4][1-4][1-4][1-4]|12345678|87654321)
18818 echo "(The test program ran ok.)"
18819 echo "byteorder=$dflt"
18820 xxx_prompt=n
18821 ;;
18822 ????|????????) echo "(The test program ran ok.)" ;;
18823 *) echo "(The test program didn't run right for some reason.)" ;;
18824 esac
18825 else
18826 dflt='4321'
18827 cat <<'EOM'
18828(I can't seem to compile the test program. Guessing big-endian...)
18829EOM
18830 fi
18831 case "$xxx_prompt" in
18832 y)
24412007 18833 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
18834 . ./myread
18835 byteorder="$ans"
18836 ;;
18837 *) byteorder=$dflt
18838 ;;
18839 esac
18840 ;;
18841 esac
5b813a60 18842 $rm_try
4e0554ec
JH
18843 ;;
18844esac
18845
cd95ead5 18846: Checking 32bit alignedness
4e0554ec
JH
18847$cat <<EOM
18848
18849Checking to see whether you can access character data unalignedly...
18850EOM
dc7b0a4f
JH
18851case "$d_u32align" in
18852'') $cat >try.c <<EOCP
4e0554ec 18853#include <stdio.h>
d1daaddf
JH
18854#$i_stdlib I_STDLIB
18855#ifdef I_STDLIB
18856#include <stdlib.h>
18857#endif
4e0554ec 18858#define U32 $u32type
d308175a
JH
18859#define BYTEORDER 0x$byteorder
18860#define U8 $u8type
9958dc3c
JH
18861#include <signal.h>
18862#ifdef SIGBUS
7090f861 18863$signal_t bletch(int s) { exit(4); }
9958dc3c 18864#endif
4e0554ec
JH
18865int main() {
18866#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
f1c7503b
MB
18867 volatile U8 buf[8];
18868 volatile U32 *up;
4e0554ec
JH
18869 int i;
18870
18871 if (sizeof(U32) != 4) {
18872 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18873 exit(1);
18874 }
18875
18876 fflush(stdout);
18877
9958dc3c
JH
18878#ifdef SIGBUS
18879 signal(SIGBUS, bletch);
18880#endif
18881
8906a23e
JH
18882 buf[0] = 0;
18883 buf[1] = 0;
18884 buf[2] = 0;
18885 buf[3] = 1;
7eac3fd6 18886 buf[4] = 0;
8906a23e
JH
18887 buf[5] = 0;
18888 buf[6] = 0;
7eac3fd6 18889 buf[7] = 1;
8906a23e 18890
4e0554ec
JH
18891 for (i = 0; i < 4; i++) {
18892 up = (U32*)(buf + i);
18893 if (! ((*up == 1 << (8*i)) || /* big-endian */
18894 (*up == 1 << (8*(3-i))) /* little-endian */
18895 )
18896 )
18897 {
18898 printf("read failed (%x)\n", *up);
18899 exit(2);
18900 }
18901 }
18902
18903 /* write test */
18904 for (i = 0; i < 4; i++) {
18905 up = (U32*)(buf + i);
18906 *up = 0xBeef;
18907 if (*up != 0xBeef) {
18908 printf("write failed (%x)\n", *up);
18909 exit(3);
18910 }
18911 }
18912
18913 exit(0);
18914#else
18915 printf("1\n");
18916 exit(1);
18917#endif
18918 return 0;
18919}
18920EOCP
18921set try
18922if eval $compile_ok; then
d308175a 18923 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18924 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18925 case "$?" in
18926 0) cat >&4 <<EOM
18927You can access character data pretty unalignedly.
18928EOM
18929 d_u32align="$undef"
18930 ;;
18931 *) cat >&4 <<EOM
18932It seems that you must access character data in an aligned manner.
18933EOM
18934 d_u32align="$define"
18935 ;;
18936 esac
4e0554ec
JH
18937else
18938 rp='Can you access character data at unaligned addresses?'
18939 dflt='n'
18940 . ./myread
18941 case "$ans" in
18942 [yY]*) d_u32align="$undef" ;;
18943 *) d_u32align="$define" ;;
18944 esac
18945fi
5b813a60 18946$rm_try
dc7b0a4f
JH
18947;;
18948esac
4e0554ec
JH
18949
18950: see if ualarm exists
18951set ualarm d_ualarm
18952eval $inlibc
18953
b4eb6b3d
JH
18954: see if umask exists
18955set umask d_umask
18956eval $inlibc
18957
758a5d79
JH
18958: see if unordered exists
18959set unordered d_unordered
18960eval $inlibc
18961
bdf33aa7
SP
18962: see if unsetenv exists
18963set unsetenv d_unsetenv
18964eval $inlibc
18965
4e0554ec
JH
18966: see if usleep exists
18967set usleep d_usleep
18968eval $inlibc
18969
2ef53570
JH
18970: see if prototype for usleep is available
18971echo " "
18972set d_usleepproto usleep $i_unistd unistd.h
18973eval $hasproto
18974
b4eb6b3d
JH
18975: see if ustat exists
18976set ustat d_ustat
18977eval $inlibc
18978
b4eb6b3d
JH
18979: see if closedir exists
18980set closedir d_closedir
18981eval $inlibc
18982
18983case "$d_closedir" in
18984"$define")
18985 echo " "
18986 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18987 cat > try.c <<EOM
b4eb6b3d
JH
18988#$i_dirent I_DIRENT /**/
18989#$i_sysdir I_SYS_DIR /**/
18990#$i_sysndir I_SYS_NDIR /**/
18991#$i_systypes I_SYS_TYPES /**/
18992
18993#if defined(I_SYS_TYPES)
18994#include <sys/types.h>
18995#endif
18996#if defined(I_DIRENT)
18997#include <dirent.h>
18998#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18999#include <sys/dir.h>
19000#endif
19001#else
19002#ifdef I_SYS_NDIR
19003#include <sys/ndir.h>
19004#else
19005#ifdef I_SYS_DIR
19006#ifdef hp9000s500
19007#include <ndir.h> /* may be wrong in the future */
19008#else
19009#include <sys/dir.h>
19010#endif
19011#endif
19012#endif
5b813a60 19013#endif
b4eb6b3d
JH
19014int main() { return closedir(opendir(".")); }
19015EOM
5440bc8e 19016 set try
b4eb6b3d 19017 if eval $compile_ok; then
5440bc8e 19018 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
19019 echo "Yes, it does."
19020 val="$undef"
19021 else
19022 echo "No, it doesn't."
19023 val="$define"
19024 fi
19025 else
19026 echo "(I can't seem to compile the test program--assuming it doesn't)"
19027 val="$define"
19028 fi
19029 ;;
19030*)
19031 val="$undef";
19032 ;;
19033esac
19034set d_void_closedir
19035eval $setvar
5b813a60
MB
19036$rm_try
19037
b4eb6b3d
JH
19038: see if there is a wait4
19039set wait4 d_wait4
19040eval $inlibc
19041
19042: see if waitpid exists
19043set waitpid d_waitpid
19044eval $inlibc
19045
19046: see if wcstombs exists
19047set wcstombs d_wcstombs
19048eval $inlibc
19049
19050: see if wctomb exists
19051set wctomb d_wctomb
19052eval $inlibc
19053
4e0554ec
JH
19054: see if writev exists
19055set writev d_writev
19056eval $inlibc
19057
b4eb6b3d
JH
19058: preserve RCS keywords in files with variable substitution, grrr
19059Date='$Date'
19060Id='$Id'
19061Log='$Log'
19062RCSfile='$RCSfile'
19063Revision='$Revision'
19064
b4eb6b3d
JH
19065: check for alignment requirements
19066echo " "
588c1107 19067case "$usecrosscompile" in
b4eb6b3d
JH
19068*$define*)
19069 $cat <<EOM
588c1107 19070You seem to be cross-compiling. Skipping the memory alignment check.
b4eb6b3d
JH
19071
19072EOM
19073 case "$alignbytes" in
19074 '') alignbytes=8 ;;
19075 esac
19076 ;;
19077*)
19078 case "$alignbytes" in
19079 '') echo "Checking alignment constraints..." >&4
19080 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19081 $cat >try.c <<'EOCP'
19082typedef long double NV;
19083EOCP
19084 else
19085 $cat >try.c <<'EOCP'
19086typedef double NV;
19087EOCP
19088 fi
19089 $cat >>try.c <<'EOCP'
19090#include <stdio.h>
19091struct foobar {
19092 char foo;
19093 NV bar;
19094} try_algn;
19095int main()
19096{
19097 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19098 return(0);
19099}
19100EOCP
19101 set try
19102 if eval $compile_ok; then
5440bc8e 19103 dflt=`$run ./try`
b4eb6b3d
JH
19104 else
19105 dflt='8'
19106 echo "(I can't seem to compile the test program...)"
19107 fi
588c1107
AD
19108 case "$multiarch" in
19109 *$define*)
19110 : The usual safe value is 8, but Darwin with -Duselongdouble
19111 : needs 16. Hence, we will take 8 as a minimum, but allow
19112 : Configure to pick a larger value if needed.
19113 if $test "$dflt" -lt 8; then
19114 dflt='8'
19115 echo "Setting alignment to 8 for multiarch support.">&4
19116 fi
19117 ;;
19118 esac
b4eb6b3d
JH
19119 ;;
19120 *) dflt="$alignbytes"
19121 ;;
19122 esac
19123 rp="Doubles must be aligned on a how-many-byte boundary?"
19124 . ./myread
19125 alignbytes="$ans"
5b813a60 19126 $rm_try
b4eb6b3d
JH
19127 ;;
19128esac
19129
19130
19131: set the base revision
19132baserev=5.0
19133
9d1a8da0
MB
19134: Determine if this is an EBCDIC system
19135echo " "
19136echo "Determining whether or not we are on an EBCDIC system..." >&4
19137$cat >try.c <<'EOM'
19138int main()
19139{
19140 if ('M'==0xd4) return 0;
19141 return 1;
19142}
19143EOM
19144
19145case "$BOOTSTRAP_CHARSET" in
19146 Y|y|define) bootstrap_charset=$define ;;
19147 *) bootstrap_charset=$undef ;;
19148esac
19149
19150val=$undef
19151set try
19152if eval $compile_ok; then
19153 if $run ./try; then
19154 echo "You seem to speak EBCDIC." >&4
19155 val="$define"
19156 else
19157 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19158 fi
19159else
19160 echo "I'm unable to compile the test program." >&4
19161 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19162fi
19163$rm_try
19164set ebcdic
19165eval $setvar
19166
89c1d914
MB
19167: length of character in bytes. Is always 1, otherwise it isnt C
19168: This used to be a test using sizeof
19169charsize=1
c193ef60
MB
19170
19171: Check for the number of bits in a character
19172case "$charbits" in
19173'') echo "Checking how long a character is (in bits)..." >&4
19174 $cat >try.c <<EOCP
19175#include <stdio.h>
19176int main ()
19177{
19178 int n;
19179 unsigned char c;
19180 for (c = 1, n = 0; c; c <<= 1, n++) ;
19181 printf ("%d\n", n);
19182 return (0);
19183 }
19184EOCP
19185 set try
19186 if eval $compile_ok; then
19187 dflt=`$run ./try`
19188 else
19189 dflt='8'
19190 echo "(I can't seem to compile the test program. Guessing...)"
19191 fi
19192 ;;
19193*)
19194 dflt="$charbits"
19195 ;;
19196esac
19197rp="What is the length of a character (in bits)?"
19198. ./myread
19199charbits="$ans"
19200$rm_try
19201case "$charbits" in
192028) ;;
19203*) cat >&4 << EOM
19204Your system has an unsigned character size of $charbits bits, which
19205is rather unusual (normally it is 8 bits). Perl likely will not work
19206correctly on your system, with subtle bugs in various places.
19207EOM
19208 rp='Do you really want to continue?'
19209 dflt='n'
19210 . ./myread
19211 case "$ans" in
19212 [yY]) echo >&4 "Okay, continuing." ;;
19213 *) exit 1 ;;
19214 esac
19215esac
19216
3099fc99 19217: how do we concatenate cpp tokens here?
b4eb6b3d 19218echo " "
3099fc99 19219echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
19220$cat >cpp_stuff.c <<'EOCP'
19221#define RCAT(a,b)a/**/b
19222#define ACAT(a,b)a ## b
19223RCAT(Rei,ser)
19224ACAT(Cir,cus)
19225EOCP
19226$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19227if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19228 echo "Oh! Smells like ANSI's been here." >&4
19229 echo "We can catify or stringify, separately or together!"
19230 cpp_stuff=42
19231elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19232 echo "Ah, yes! The good old days!" >&4
19233 echo "However, in the good old days we don't know how to stringify and"
19234 echo "catify at the same time."
19235 cpp_stuff=1
19236else
19237 $cat >&4 <<EOM
3099fc99
CW
19238Hmm, I don't seem to be able to concatenate tokens with your cpp.
19239You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
19240EOM
19241 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19242fi
19243$rm -f cpp_stuff.*
19244
19245: see if this is a db.h system
19246set db.h i_db
19247eval $inhdr
19248
19249case "$i_db" in
19250$define)
19251 : Check db version.
19252 echo " "
19253 echo "Checking Berkeley DB version ..." >&4
19254 $cat >try.c <<EOCP
19255#$d_const HASCONST
19256#ifndef HASCONST
19257#define const
19258#endif
19259#include <sys/types.h>
19260#include <stdio.h>
55954f19
JH
19261#$i_stdlib I_STDLIB
19262#ifdef I_STDLIB
19263#include <stdlib.h>
19264#endif
b4eb6b3d 19265#include <db.h>
640374d0 19266int main(int argc, char *argv[])
b4eb6b3d
JH
19267{
19268#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19269 int Major, Minor, Patch ;
19270 unsigned long Version ;
19271 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
19272 if (argc == 2) {
19273 printf("%d %d %d %d %d %d\n",
19274 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19275 Major, Minor, Patch);
19276 exit(0);
19277 }
19278 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
19279
19280 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19281 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19282 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19283 Major, Minor, Patch) ;
19284
19285 /* check that db.h & libdb are compatible */
19286 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 19287 printf("db.h and libdb are incompatible.\n") ;
5b813a60 19288 exit(3);
b4eb6b3d
JH
19289 }
19290
640374d0 19291 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
19292
19293 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19294 + DB_VERSION_PATCH ;
19295
19296 /* needs to be >= 2.3.4 */
19297 if (Version < 2003004) {
19298 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 19299 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
5b813a60 19300 exit(2);
b4eb6b3d
JH
19301 }
19302
19303 exit(0);
19304#else
19305#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
19306 if (argc == 2) {
19307 printf("1 0 0\n");
19308 exit(0);
19309 }
19310 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
19311 exit(0); /* DB version < 2: the coast is clear. */
19312#else
19313 exit(1); /* <db.h> not Berkeley DB? */
19314#endif
19315#endif
19316}
19317EOCP
19318 set try
5440bc8e 19319 if eval $compile_ok && $run ./try; then
b4eb6b3d 19320 echo 'Looks OK.' >&4
5440bc8e 19321 set `$run ./try 1`
640374d0
JH
19322 db_version_major=$1
19323 db_version_minor=$2
19324 db_version_patch=$3
b4eb6b3d
JH
19325 else
19326 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
19327 i_db=$undef
19328 case " $libs " in
19329 *"-ldb "*)
19330 : Remove db from list of libraries to use
19331 echo "Removing unusable -ldb from library list" >&4
19332 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19333 shift
19334 libs="$*"
19335 echo "libs = $libs" >&4
19336 ;;
19337 esac
19338 fi
5b813a60 19339 $rm_try
b4eb6b3d
JH
19340 ;;
19341esac
19342
19343case "$i_db" in
19344define)
5b813a60 19345 : Check the return type needed for hash
b4eb6b3d
JH
19346 echo " "
19347 echo "Checking return type needed for hash for Berkeley DB ..." >&4
19348 $cat >try.c <<EOCP
19349#$d_const HASCONST
19350#ifndef HASCONST
19351#define const
19352#endif
19353#include <sys/types.h>
19354#include <db.h>
19355
19356#ifndef DB_VERSION_MAJOR
19357u_int32_t hash_cb (ptr, size)
19358const void *ptr;
19359size_t size;
19360{
19361}
19362HASHINFO info;
19363int main()
19364{
19365 info.hash = hash_cb;
19366}
19367#endif
19368EOCP
19369 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19370 if $contains warning try.out >>/dev/null 2>&1 ; then
19371 db_hashtype='int'
19372 else
19373 db_hashtype='u_int32_t'
19374 fi
19375 else
19376 : XXX Maybe we should just give up here.
19377 db_hashtype=u_int32_t
19378 $cat try.out >&4
19379 echo "Help: I can't seem to compile the db test program." >&4
19380 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19381 fi
5b813a60 19382 $rm_try
b4eb6b3d
JH
19383 echo "Your version of Berkeley DB uses $db_hashtype for hash."
19384 ;;
19385*) db_hashtype=u_int32_t
19386 ;;
19387esac
19388case "$i_db" in
19389define)
5b813a60 19390 : Check the return type needed for prefix
b4eb6b3d
JH
19391 echo " "
19392 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19393 cat >try.c <<EOCP
19394#$d_const HASCONST
19395#ifndef HASCONST
19396#define const
19397#endif
19398#include <sys/types.h>
19399#include <db.h>
19400
19401#ifndef DB_VERSION_MAJOR
19402size_t prefix_cb (key1, key2)
19403const DBT *key1;
19404const DBT *key2;
19405{
19406}
19407BTREEINFO info;
19408int main()
19409{
19410 info.prefix = prefix_cb;
19411}
19412#endif
19413EOCP
19414 if $cc $ccflags -c try.c >try.out 2>&1 ; then
19415 if $contains warning try.out >>/dev/null 2>&1 ; then
19416 db_prefixtype='int'
19417 else
19418 db_prefixtype='size_t'
19419 fi
19420 else
19421 db_prefixtype='size_t'
19422 : XXX Maybe we should just give up here.
19423 $cat try.out >&4
19424 echo "Help: I can't seem to compile the db test program." >&4
19425 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19426 fi
5b813a60 19427 $rm_try
b4eb6b3d
JH
19428 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19429 ;;
19430*) db_prefixtype='size_t'
19431 ;;
19432esac
19433
b4eb6b3d
JH
19434: How can we generate normalized random numbers ?
19435echo " "
19436echo "Looking for a random number function..." >&4
19437case "$randfunc" in
19438'')
19439 if set drand48 val -f; eval $csym; $val; then
19440 dflt="drand48"
19441 echo "Good, found drand48()." >&4
19442 elif set random val -f; eval $csym; $val; then
19443 dflt="random"
19444 echo "OK, found random()." >&4
19445 else
19446 dflt="rand"
19447 echo "Yick, looks like I have to use rand()." >&4
19448 fi
19449 echo " "
19450 ;;
19451*)
19452 dflt="$randfunc"
19453 ;;
19454esac
19455cont=true
19456
19457case "$ccflags" in
19458*-Dmy_rand=*|*-Dmy_srand=*)
19459 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19460 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19461 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19462 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19463 ;;
19464esac
19465
19466while $test "$cont"; do
19467 rp="Use which function to generate random numbers?"
19468 . ./myread
19469 if $test "$ans" = "$dflt"; then
19470 : null
19471 else
19472 randbits=''
19473 fi
19474 randfunc="$ans"
19475 if set $ans val -f; eval $csym; $val; then
19476 cont=''
19477 else
19478 dflt=y
19479 rp="I cannot find function $ans. Use that name anyway?"
19480 . ./myread
19481 dflt=rand
19482 case "$ans" in
19483 [yY]*) cont='';;
19484 esac
19485 fi
19486 case "$cont" in
19487 '')
19488 case "$randfunc" in
19489 drand48)
19490 drand01="drand48()"
19491 seedfunc="srand48"
19492 randbits=48
19493 randseedtype=long
19494 ;;
19495 rand|random)
19496 case "$randbits" in
19497 '')
19498echo "Checking to see how many bits your $randfunc() function produces..." >&4
19499 $cat >try.c <<EOCP
19500#$i_unistd I_UNISTD
19501#$i_stdlib I_STDLIB
19502#include <stdio.h>
19503#ifdef I_UNISTD
19504# include <unistd.h>
19505#endif
19506#ifdef I_STDLIB
19507# include <stdlib.h>
19508#endif
19509int main()
19510{
8a6214fb
MB
19511 int i;
19512 unsigned long tmp;
19513 unsigned long max = 0L;
b4eb6b3d
JH
19514
19515 for (i = 1000; i; i--) {
19516 tmp = (unsigned long) $randfunc();
19517 if (tmp > max) max = tmp;
19518 }
19519 for (i = 0; max; i++)
19520 max /= 2;
19521 printf("%d\n",i);
19522}
19523EOCP
19524 set try
19525 if eval $compile_ok; then
19526 dflt=`try`
19527 else
19528 dflt='?'
19529 echo "(I can't seem to compile the test program...)"
19530 fi
19531 ;;
19532 *)
19533 dflt="$randbits"
19534 ;;
19535 esac
19536 rp="How many bits does your $randfunc() function produce?"
19537 . ./myread
19538 randbits="$ans"
5b813a60 19539 $rm_try
b4eb6b3d
JH
19540 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19541 seedfunc="s$randfunc"
19542 randseedtype=unsigned
19543 ;;
19544 *)
19545 dflt="31"
19546 rp="How many bits does your $randfunc() function produce?"
19547 . ./myread
19548 randbits="$ans"
19549 seedfunc="s$randfunc"
19550 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19551 if set $seedfunc val -f; eval $csym; $val; then
19552 echo "(Using $seedfunc() to seed random generator)"
19553 else
19554 echo "(Warning: no $seedfunc() to seed random generator)"
19555 seedfunc=rand
19556 fi
19557 randseedtype=unsigned
19558 ;;
19559 esac
19560 ;;
19561 esac
19562done
19563
613d6c3e 19564: Check how to flush
b4eb6b3d
JH
19565echo " "
19566$cat >&4 <<EOM
19567Checking how to flush all pending stdio output...
19568EOM
19569# I only know how to find the first 32 possibly open files on SunOS.
19570# See also hints/sunos_4_1.sh and util.c --AD
19571case "$osname" in
19572sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19573esac
19574$cat >>try.c <<EOCP
19575#include <stdio.h>
55954f19
JH
19576#$i_stdlib I_STDLIB
19577#ifdef I_STDLIB
19578#include <stdlib.h>
19579#endif
b4eb6b3d
JH
19580#$i_unistd I_UNISTD
19581#ifdef I_UNISTD
19582# include <unistd.h>
19583#endif
19584#$d_sysconf HAS_SYSCONF
19585#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19586#ifdef HAS_STDIO_STREAM_ARRAY
19587# define STDIO_STREAM_ARRAY $stdio_stream_array
19588#endif
19589int main() {
5440bc8e
JH
19590 FILE* p;
19591 unlink("try.out");
19592 p = fopen("try.out", "w");
b4eb6b3d
JH
19593#ifdef TRY_FPUTC
19594 fputc('x', p);
19595#else
19596# ifdef TRY_FPRINTF
19597 fprintf(p, "x");
19598# endif
19599#endif
19600#ifdef TRY_FFLUSH_NULL
19601 fflush(NULL);
19602#endif
19603#ifdef TRY_FFLUSH_ALL
19604 {
19605 long open_max = -1;
19606# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19607 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19608# else
19609# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19610 open_max = sysconf(_SC_OPEN_MAX);
19611# else
19612# ifdef FOPEN_MAX
19613 open_max = FOPEN_MAX;
19614# else
19615# ifdef OPEN_MAX
19616 open_max = OPEN_MAX;
19617# else
19618# ifdef _NFILE
19619 open_max = _NFILE;
19620# endif
19621# endif
19622# endif
19623# endif
5b813a60 19624# endif
b4eb6b3d
JH
19625# ifdef HAS_STDIO_STREAM_ARRAY
19626 if (open_max > 0) {
19627 long i;
19628 for (i = 0; i < open_max; i++)
19629 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19630 STDIO_STREAM_ARRAY[i]._file < open_max &&
19631 STDIO_STREAM_ARRAY[i]._flag)
19632 fflush(&STDIO_STREAM_ARRAY[i]);
5b813a60 19633 }
b4eb6b3d
JH
19634 }
19635# endif
19636#endif
19637 _exit(42);
19638}
19639EOCP
19640: first we have to find out how _not_ to flush
5440bc8e 19641$to try.c
b4eb6b3d
JH
19642if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19643 output=''
19644 set try -DTRY_FPUTC
19645 if eval $compile; then
fbe73d74 19646 $run ./try 2>/dev/null
28f5ac64 19647 code="$?"
5440bc8e 19648 $from try.out
28f5ac64 19649 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19650 output=-DTRY_FPUTC
19651 fi
19652 fi
19653 case "$output" in
19654 '')
19655 set try -DTRY_FPRINTF
b4eb6b3d 19656 if eval $compile; then
fbe73d74 19657 $run ./try 2>/dev/null
28f5ac64 19658 code="$?"
5440bc8e 19659 $from try.out
28f5ac64 19660 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19661 output=-DTRY_FPRINTF
19662 fi
19663 fi
19664 ;;
19665 esac
19666fi
19667: check for fflush NULL behaviour
19668case "$fflushNULL" in
19669'') set try -DTRY_FFLUSH_NULL $output
19670 if eval $compile; then
5440bc8e 19671 $run ./try 2>/dev/null
b4eb6b3d 19672 code="$?"
5440bc8e 19673 $from try.out
b4eb6b3d
JH
19674 if $test -s try.out -a "X$code" = X42; then
19675 fflushNULL="`$cat try.out`"
19676 else
19677 if $test "X$code" != X42; then
19678 $cat >&4 <<EOM
19679(If this test failed, don't worry, we'll try another method shortly.)
19680EOM
19681 fi
19682 fi
19683 fi
2c476adc 19684 $rm -f core try.core core.try.*
b4eb6b3d
JH
19685 case "$fflushNULL" in
19686 x) $cat >&4 <<EOM
19687Your fflush(NULL) works okay for output streams.
19688Let's see if it clobbers input pipes...
19689EOM
19690# As of mid-March 2000 all versions of Solaris appear to have a stdio
19691# bug that improperly flushes the input end of pipes. So we avoid the
19692# autoflush on fork/system/exec support for now. :-(
19693$cat >tryp.c <<EOCP
19694#include <stdio.h>
19695int
19696main(int argc, char **argv)
19697{
19698 char buf[1024];
19699 int i;
19700 char *bp = buf;
19701 while (1) {
19702 while ((i = getc(stdin)) != -1
19703 && (*bp++ = i) != '\n'
19704 && bp < &buf[1024])
19705 /* DO NOTHING */ ;
19706 *bp = '\0';
19707 fprintf(stdout, "%s", buf);
19708 fflush(NULL);
19709 if (i == -1)
19710 return 0;
19711 bp = buf;
19712 }
19713}
19714EOCP
19715 fflushNULL="$define"
19716 set tryp
19717 if eval $compile; then
19718 $rm -f tryp.out
5440bc8e 19719 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19720 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19721 $cat >&4 <<EOM
19722fflush(NULL) seems to behave okay with input streams.
19723EOM
19724 fflushNULL="$define"
19725 else
19726 $cat >&4 <<EOM
19727Ouch, fflush(NULL) clobbers input pipes! We will not use it.
19728EOM
19729 fflushNULL="$undef"
19730 fi
19731 fi
19732 $rm -f core tryp.c tryp.core core.tryp.*
19733 ;;
19734 '') $cat >&4 <<EOM
19735Your fflush(NULL) isn't working (contrary to ANSI C).
19736EOM
19737 fflushNULL="$undef"
19738 ;;
19739 *) $cat >&4 <<EOM
19740Cannot figure out whether your fflush(NULL) works or not.
19741I'm assuming it doesn't (contrary to ANSI C).
19742EOM
19743 fflushNULL="$undef"
19744 ;;
19745 esac
19746 ;;
19747$define|true|[yY]*)
19748 fflushNULL="$define"
19749 ;;
19750*)
19751 fflushNULL="$undef"
19752 ;;
19753esac
19754: check explicit looping only if NULL did not work, and if the pipe
19755: bug does not show up on an explicit flush too
19756case "$fflushNULL" in
19757"$undef")
19758 $cat >tryp.c <<EOCP
19759#include <stdio.h>
19760int
19761main(int argc, char **argv)
19762{
19763 char buf[1024];
19764 int i;
19765 char *bp = buf;
19766 while (1) {
19767 while ((i = getc(stdin)) != -1
19768 && (*bp++ = i) != '\n'
19769 && bp < &buf[1024])
19770 /* DO NOTHING */ ;
19771 *bp = '\0';
19772 fprintf(stdout, "%s", buf);
19773 fflush(stdin);
19774 if (i == -1)
19775 return 0;
19776 bp = buf;
19777 }
19778}
19779EOCP
19780 set tryp
19781 if eval $compile; then
19782 $rm -f tryp.out
5440bc8e 19783 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
19784 if cmp tryp.c tryp.out >/dev/null 2>&1; then
19785 $cat >&4 <<EOM
19786Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19787EOM
19788 : now check for fflushall behaviour
19789 case "$fflushall" in
19790 '') set try -DTRY_FFLUSH_ALL $output
19791 if eval $compile; then
19792 $cat >&4 <<EOM
19793(Now testing the other method--but note that this also may fail.)
19794EOM
5440bc8e 19795 $run ./try 2>/dev/null
28f5ac64 19796 code=$?
fbe73d74 19797 $from try.out
28f5ac64 19798 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
19799 fflushall="`$cat try.out`"
19800 fi
19801 fi
5b813a60 19802 $rm_try
b4eb6b3d
JH
19803 case "$fflushall" in
19804 x) $cat >&4 <<EOM
19805Whew. Flushing explicitly all the stdio streams works.
19806EOM
19807 fflushall="$define"
19808 ;;
19809 '') $cat >&4 <<EOM
19810Sigh. Flushing explicitly all the stdio streams doesn't work.
19811EOM
19812 fflushall="$undef"
19813 ;;
19814 *) $cat >&4 <<EOM
19815Cannot figure out whether flushing stdio streams explicitly works or not.
19816I'm assuming it doesn't.
19817EOM
19818 fflushall="$undef"
19819 ;;
19820 esac
19821 ;;
19822 "$define"|true|[yY]*)
19823 fflushall="$define"
19824 ;;
19825 *)
19826 fflushall="$undef"
19827 ;;
19828 esac
19829 else
19830 $cat >&4 <<EOM
19831All is futile. Even fflush(stdin) clobbers input pipes!
19832EOM
19833 fflushall="$undef"
19834 fi
19835 else
19836 fflushall="$undef"
19837 fi
19838 $rm -f core tryp.c tryp.core core.tryp.*
19839 ;;
19840*) fflushall="$undef"
19841 ;;
19842esac
19843
19844case "$fflushNULL$fflushall" in
19845undefundef)
19846 $cat <<EOM
19847OK, I give up. I cannot figure out how to flush pending stdio output.
19848We won't be flushing handles at all before fork/exec/popen.
19849EOM
19850 ;;
19851esac
34f1896b 19852$rm_try tryp
b4eb6b3d
JH
19853
19854: Store the full pathname to the ar program for use in the C program
19855: Respect a hint or command line value for full_ar.
19856case "$full_ar" in
19857'') full_ar=$ar ;;
19858esac
19859
19860: Store the full pathname to the sed program for use in the C program
19861full_sed=$sed
19862
19863: see what type gids are declared as in the kernel
19864echo " "
19865echo "Looking for the type for group ids returned by getgid()."
19866set gid_t gidtype xxx stdio.h sys/types.h
19867eval $typedef
19868case "$gidtype" in
19869xxx)
19870 xxx=`./findhdr sys/user.h`
19871 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19872 case $1 in
19873 unsigned) dflt="$1 $2" ;;
19874 *) dflt="$1" ;;
19875 esac
19876 ;;
19877*) dflt="$gidtype";;
19878esac
19879case "$gidtype" in
19880gid_t) echo "gid_t found." ;;
19881*) rp="What is the type for group ids returned by getgid()?"
19882 . ./myread
19883 gidtype="$ans"
19884 ;;
19885esac
19886
613d6c3e 19887: Check the size of GID
b4eb6b3d
JH
19888echo " "
19889case "$gidtype" in
19890*_t) zzz="$gidtype" ;;
19891*) zzz="gid" ;;
19892esac
613d6c3e 19893echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
19894cat > try.c <<EOCP
19895#include <sys/types.h>
19896#include <stdio.h>
d1daaddf
JH
19897#$i_stdlib I_STDLIB
19898#ifdef I_STDLIB
19899#include <stdlib.h>
19900#endif
b4eb6b3d
JH
19901int main() {
19902 printf("%d\n", (int)sizeof($gidtype));
19903 exit(0);
19904}
19905EOCP
19906set try
19907if eval $compile_ok; then
5440bc8e 19908 yyy=`$run ./try`
b4eb6b3d
JH
19909 case "$yyy" in
19910 '') gidsize=4
19911 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19912 ;;
19913 *) gidsize=$yyy
19914 echo "Your $zzz is $gidsize bytes long."
19915 ;;
19916 esac
19917else
19918 gidsize=4
19919 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19920fi
19921
19922
613d6c3e 19923: Check if GID is signed
b4eb6b3d
JH
19924echo " "
19925case "$gidtype" in
19926*_t) zzz="$gidtype" ;;
19927*) zzz="gid" ;;
19928esac
613d6c3e 19929echo "Checking the sign of $zzz..." >&4
b4eb6b3d
JH
19930cat > try.c <<EOCP
19931#include <sys/types.h>
19932#include <stdio.h>
19933int main() {
19934 $gidtype foo = -1;
19935 if (foo < 0)
19936 printf("-1\n");
19937 else
19938 printf("1\n");
19939}
19940EOCP
19941set try
19942if eval $compile; then
5440bc8e 19943 yyy=`$run ./try`
b4eb6b3d
JH
19944 case "$yyy" in
19945 '') gidsign=1
19946 echo "(I can't execute the test program--guessing unsigned.)" >&4
19947 ;;
19948 *) gidsign=$yyy
19949 case "$gidsign" in
19950 1) echo "Your $zzz is unsigned." ;;
19951 -1) echo "Your $zzz is signed." ;;
19952 esac
19953 ;;
19954 esac
19955else
19956 gidsign=1
19957 echo "(I can't compile the test program--guessing unsigned.)" >&4
19958fi
19959
19960
613d6c3e 19961: Check 64bit sizes
b4eb6b3d
JH
19962echo " "
19963
19964if $test X"$quadtype" != X; then
19965
19966echo "Checking how to print 64-bit integers..." >&4
19967
19968if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19969 $cat >try.c <<'EOCP'
19970#include <sys/types.h>
19971#include <stdio.h>
19972int main() {
19973 int q = 12345678901;
19974 printf("%ld\n", q);
19975}
19976EOCP
19977 set try
19978 if eval $compile; then
5440bc8e 19979 yyy=`$run ./try`
b4eb6b3d
JH
19980 case "$yyy" in
19981 12345678901)
19982 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19983 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19984 echo "We will use %d."
19985 ;;
19986 esac
19987 fi
19988fi
19989
19990if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19991 $cat >try.c <<'EOCP'
19992#include <sys/types.h>
19993#include <stdio.h>
19994int main() {
19995 long q = 12345678901;
19996 printf("%ld\n", q);
19997}
19998EOCP
19999 set try
20000 if eval $compile; then
5440bc8e 20001 yyy=`$run ./try`
b4eb6b3d
JH
20002 case "$yyy" in
20003 12345678901)
20004 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20005 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20006 echo "We will use %ld."
20007 ;;
20008 esac
20009 fi
20010fi
20011
20012if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20013 $cat >try.c <<'EOCP'
20014#include <sys/types.h>
20015#include <inttypes.h>
20016#include <stdio.h>
20017int main() {
20018 int64_t q = 12345678901;
20019 printf("%" PRId64 "\n", q);
20020}
20021EOCP
20022 set try
20023 if eval $compile; then
5440bc8e 20024 yyy=`$run ./try`
b4eb6b3d
JH
20025 case "$yyy" in
20026 12345678901)
20027 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20028 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20029 echo "We will use the C9X style."
20030 ;;
20031 esac
20032 fi
20033fi
20034
2ef53570
JH
20035if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20036 $cat >try.c <<EOCP
b4eb6b3d
JH
20037#include <sys/types.h>
20038#include <stdio.h>
20039int main() {
2ef53570
JH
20040 $quadtype q = 12345678901;
20041 printf("%Ld\n", q);
b4eb6b3d
JH
20042}
20043EOCP
20044 set try
20045 if eval $compile; then
5440bc8e 20046 yyy=`$run ./try`
b4eb6b3d
JH
20047 case "$yyy" in
20048 12345678901)
2ef53570
JH
20049 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20050 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20051 echo "We will use %Ld."
b4eb6b3d
JH
20052 ;;
20053 esac
20054 fi
20055fi
20056
2ef53570
JH
20057if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20058 $cat >try.c <<'EOCP'
b4eb6b3d
JH
20059#include <sys/types.h>
20060#include <stdio.h>
20061int main() {
2ef53570
JH
20062 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20063 printf("%lld\n", q);
b4eb6b3d
JH
20064}
20065EOCP
20066 set try
20067 if eval $compile; then
5440bc8e 20068 yyy=`$run ./try`
b4eb6b3d
JH
20069 case "$yyy" in
20070 12345678901)
2ef53570
JH
20071 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20072 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20073 echo "We will use the %lld style."
b4eb6b3d
JH
20074 ;;
20075 esac
20076 fi
20077fi
20078
20079if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20080 $cat >try.c <<EOCP
20081#include <sys/types.h>
20082#include <stdio.h>
20083int main() {
20084 $quadtype q = 12345678901;
20085 printf("%qd\n", q);
20086}
20087EOCP
20088 set try
20089 if eval $compile; then
5440bc8e 20090 yyy=`$run ./try`
b4eb6b3d
JH
20091 case "$yyy" in
20092 12345678901)
20093 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20094 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20095 echo "We will use %qd."
20096 ;;
20097 esac
20098 fi
20099fi
20100
20101if $test X"$sPRId64" = X; then
20102 echo "Cannot figure out how to print 64-bit integers." >&4
20103fi
5b813a60 20104$rm_try
b4eb6b3d
JH
20105
20106fi
20107
20108case "$sPRId64" in
5b813a60
MB
20109'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20110 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
b4eb6b3d 20111 ;;
5b813a60
MB
20112*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20113 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
b4eb6b3d
JH
20114 ;;
20115esac
20116
34f1896b 20117: Check format strings for internal types
b4eb6b3d
JH
20118echo " "
20119$echo "Checking the format strings to be used for Perl's internal types..." >&4
20120
20121if $test X"$ivsize" = X8; then
20122 ivdformat="$sPRId64"
20123 uvuformat="$sPRIu64"
20124 uvoformat="$sPRIo64"
20125 uvxformat="$sPRIx64"
20126 uvXUformat="$sPRIXU64"
20127else
20128 if $test X"$ivsize" = X"$longsize"; then
20129 ivdformat='"ld"'
20130 uvuformat='"lu"'
20131 uvoformat='"lo"'
20132 uvxformat='"lx"'
20133 uvXUformat='"lX"'
20134 else
20135 if $test X"$ivsize" = X"$intsize"; then
20136 ivdformat='"d"'
20137 uvuformat='"u"'
20138 uvoformat='"o"'
20139 uvxformat='"x"'
20140 uvXUformat='"X"'
20141 else
20142 : far out
20143 if $test X"$ivsize" = X"$shortsize"; then
20144 ivdformat='"hd"'
20145 uvuformat='"hu"'
20146 uvoformat='"ho"'
20147 uvxformat='"hx"'
20148 uvXUformat='"hX"'
20149 fi
20150 fi
20151 fi
20152fi
20153
20154if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20155 nveformat="$sPRIeldbl"
20156 nvfformat="$sPRIfldbl"
20157 nvgformat="$sPRIgldbl"
20158 nvEUformat="$sPRIEUldbl"
20159 nvFUformat="$sPRIFUldbl"
20160 nvGUformat="$sPRIGUldbl"
20161else
20162 nveformat='"e"'
20163 nvfformat='"f"'
20164 nvgformat='"g"'
20165 nvEUformat='"E"'
20166 nvFUformat='"F"'
20167 nvGUformat='"G"'
20168fi
20169
20170case "$ivdformat" in
3c728e00 20171'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
20172 exit 1
20173 ;;
20174esac
20175
34f1896b 20176: Check format string for GID
b4eb6b3d
JH
20177
20178echo " "
20179$echo "Checking the format string to be used for gids..." >&4
20180
20181case "$gidsign" in
20182-1) if $test X"$gidsize" = X"$ivsize"; then
20183 gidformat="$ivdformat"
20184 else
20185 if $test X"$gidsize" = X"$longsize"; then
20186 gidformat='"ld"'
20187 else
20188 if $test X"$gidsize" = X"$intsize"; then
20189 gidformat='"d"'
20190 else
20191 if $test X"$gidsize" = X"$shortsize"; then
20192 gidformat='"hd"'
20193 fi
20194 fi
20195 fi
20196 fi
20197 ;;
20198*) if $test X"$gidsize" = X"$uvsize"; then
20199 gidformat="$uvuformat"
20200 else
20201 if $test X"$gidsize" = X"$longsize"; then
20202 gidformat='"lu"'
20203 else
20204 if $test X"$gidsize" = X"$intsize"; then
20205 gidformat='"u"'
20206 else
20207 if $test X"$gidsize" = X"$shortsize"; then
20208 gidformat='"hu"'
20209 fi
20210 fi
20211 fi
20212 fi
20213 ;;
20214esac
20215
20216: see if getgroups exists
20217set getgroups d_getgrps
20218eval $inlibc
20219
20220: see if setgroups exists
20221set setgroups d_setgrps
20222eval $inlibc
20223
b4eb6b3d
JH
20224: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20225echo " "
20226case "$d_getgrps$d_setgrps" in
20227*define*)
20228 case "$groupstype" in
20229 '') dflt="$gidtype" ;;
20230 *) dflt="$groupstype" ;;
20231 esac
20232 $cat <<EOM
20233What type of pointer is the second argument to getgroups() and setgroups()?
20234Usually this is the same as group ids, $gidtype, but not always.
20235
20236EOM
20237 rp='What type pointer is the second argument to getgroups() and setgroups()?'
20238 . ./myread
20239 groupstype="$ans"
20240 ;;
20241*) groupstype="$gidtype";;
20242esac
20243
613d6c3e 20244: MAD = Misc Attribute Definition
d620c7b3 20245
fd655d33
NC
20246if $test $patchlevel -lt 9; then
20247: MAD is not available in 5.8.x or earlier.
20248 ans=n;
20249else
20250 case "$mad" in
20251 $define|true|[yY]*) dflt='y' ;;
20252 *) dflt='n' ;;
20253 esac
20254 cat <<EOM
d620c7b3
MB
20255
20256Would you like to build with Misc Attribute Decoration? This is development
20257work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20258overhead on the interpreter.
20259
20260If this doesn't make any sense to you, just accept the default '$dflt'.
20261EOM
fd655d33
NC
20262 rp='Build Perl with MAD?'
20263 . ./myread
20264fi
d620c7b3 20265case "$ans" in
00e74f14
NC
20266y|Y) val="$define"
20267 madlyh='madly.h madly.act madly.tab'
20268 madlysrc='madly.c'
20269 madlyobj="madly$_o" ;;
20270*) val="$undef"
20271 madlyh=''
20272 madlysrc=''
20273 madlyobj='' ;;
d620c7b3
MB
20274esac
20275set mad
20276eval $setvar
20277
216dac04 20278: check whether make sets MAKE
b4eb6b3d
JH
20279echo " "
20280echo "Checking if your $make program sets \$(MAKE)..." >&4
20281case "$make_set_make" in
20282'')
20283 $sed 's/^X //' > testmake.mak << 'EOF'
20284Xall:
20285X @echo 'maketemp="$(MAKE)"'
20286EOF
20287 case "`$make -f testmake.mak 2>/dev/null`" in
20288 *maketemp=*) make_set_make='#' ;;
20289 *) make_set_make="MAKE=$make" ;;
20290 esac
20291 $rm -f testmake.mak
20292 ;;
20293esac
20294case "$make_set_make" in
20295'#') echo "Yup, it does.";;
20296*) echo "Nope, it doesn't.";;
20297esac
20298
20299: see what type is used for mode_t
20300rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20301set mode_t modetype int stdio.h sys/types.h
20302eval $typedef_ask
20303
2cc61e15
DD
20304: see if we need va_copy
20305echo " "
20306case "$i_stdarg" in
20307"$define")
20308 $cat >try.c <<EOCP
20309#include <stdarg.h>
20310#include <stdio.h>
85c8a686
DD
20311#$i_stdlib I_STDLIB
20312#ifdef I_STDLIB
20313#include <stdlib.h>
20314#endif
20315#include <signal.h>
2cc61e15
DD
20316
20317int
20318ivfprintf(FILE *f, const char *fmt, va_list *valp)
20319{
20320 return vfprintf(f, fmt, *valp);
20321}
5b813a60
MB
20322
20323int
2cc61e15
DD
20324myvfprintf(FILE *f, const char *fmt, va_list val)
20325{
20326 return ivfprintf(f, fmt, &val);
20327}
5b813a60 20328
2cc61e15 20329int
5b813a60 20330myprintf(char *fmt, ...)
2cc61e15
DD
20331{
20332 va_list val;
20333 va_start(val, fmt);
5b813a60
MB
20334 return myvfprintf(stdout, fmt, val);
20335}
2cc61e15
DD
20336
20337int
20338main(int ac, char **av)
20339{
85c8a686
DD
20340 signal(SIGSEGV, exit);
20341
5b813a60
MB
20342 myprintf("%s%cs all right, then\n", "that", '\'');
20343 exit(0);
2cc61e15
DD
20344}
20345EOCP
20346 set try
5440bc8e
JH
20347 if eval $compile && $run ./try 2>&1 >/dev/null; then
20348 case "`$run ./try`" in
2cc61e15
DD
20349 "that's all right, then")
20350 okay=yes
20351 ;;
20352 esac
20353 fi
20354 case "$okay" in
20355 yes) echo "It seems that you don't need va_copy()." >&4
20356 need_va_copy="$undef"
20357 ;;
20358 *) echo "It seems that va_copy() or similar will be needed." >&4
20359 need_va_copy="$define"
20360 ;;
20361 esac
5b813a60 20362 $rm_try
2cc61e15
DD
20363 ;;
20364*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
282b912e 20365 need_va_copy="$undef"
2cc61e15
DD
20366 ;;
20367esac
20368
b4eb6b3d
JH
20369: see what type is used for size_t
20370rp="What is the type used for the length parameter for string functions?"
20371set size_t sizetype 'unsigned int' stdio.h sys/types.h
20372eval $typedef_ask
20373
20374: check for type of arguments to gethostbyaddr.
20375if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20376 case "$d_gethbyaddr" in
20377 $define)
20378 $cat <<EOM
20379
20380Checking to see what type of arguments are accepted by gethostbyaddr().
20381EOM
20382 hdrs="$define sys/types.h
20383 $d_socket sys/socket.h
20384 $i_niin netinet/in.h
20385 $i_netdb netdb.h
20386 $i_unistd unistd.h"
20387 : The first arg can 'char *' or 'void *'
20388 : The second arg is some of integral type
20389 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20390 for yyy in size_t long int; do
20391 case "$netdb_host_type" in
61c26d18 20392 '') try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
b4eb6b3d
JH
20393 if ./protochk "$try" $hdrs; then
20394 echo "Your system accepts $xxx for the first arg."
20395 echo "...and $yyy for the second arg."
20396 netdb_host_type="$xxx"
20397 netdb_hlen_type="$yyy"
20398 fi
20399 ;;
20400 esac
20401 done
20402 done
20403 : In case none of those worked, prompt the user.
20404 case "$netdb_host_type" in
20405 '') rp='What is the type for the 1st argument to gethostbyaddr?'
20406 dflt='char *'
20407 . ./myread
20408 netdb_host_type=$ans
20409 rp='What is the type for the 2nd argument to gethostbyaddr?'
20410 dflt="$sizetype"
20411 . ./myread
20412 netdb_hlen_type=$ans
20413 ;;
20414 esac
20415 ;;
20416 *) : no gethostbyaddr, so pick harmless defaults
20417 netdb_host_type='char *'
20418 netdb_hlen_type="$sizetype"
20419 ;;
20420 esac
20421 # Remove the "const" if needed. -- but then we'll have a
20422 # prototype clash!
20423 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20424fi
20425
20426: check for type of argument to gethostbyname.
20427if test "X$netdb_name_type" = X ; then
20428 case "$d_gethbyname" in
20429 $define)
20430 $cat <<EOM
20431
20432Checking to see what type of argument is accepted by gethostbyname().
20433EOM
20434 hdrs="$define sys/types.h
20435 $d_socket sys/socket.h
20436 $i_niin netinet/in.h
20437 $i_netdb netdb.h
20438 $i_unistd unistd.h"
20439 for xxx in "const char *" "char *"; do
20440 case "$netdb_name_type" in
61c26d18 20441 '') try="$extern_C struct hostent *gethostbyname($xxx);"
b4eb6b3d
JH
20442 if ./protochk "$try" $hdrs; then
20443 echo "Your system accepts $xxx."
20444 netdb_name_type="$xxx"
20445 fi
20446 ;;
20447 esac
20448 done
20449 : In case none of those worked, prompt the user.
20450 case "$netdb_name_type" in
20451 '') rp='What is the type for the 1st argument to gethostbyname?'
20452 dflt='char *'
20453 . ./myread
20454 netdb_name_type=$ans
20455 ;;
20456 esac
20457 ;;
20458 *) : no gethostbyname, so pick harmless default
20459 netdb_name_type='char *'
20460 ;;
20461 esac
20462fi
20463
20464: check for type of 1st argument to getnetbyaddr.
20465if test "X$netdb_net_type" = X ; then
20466 case "$d_getnbyaddr" in
20467 $define)
20468 $cat <<EOM
20469
20470Checking to see what type of 1st argument is accepted by getnetbyaddr().
20471EOM
20472 hdrs="$define sys/types.h
20473 $d_socket sys/socket.h
20474 $i_niin netinet/in.h
20475 $i_netdb netdb.h
20476 $i_unistd unistd.h"
20477 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20478 case "$netdb_net_type" in
61c26d18 20479 '') try="$extern_C struct netent *getnetbyaddr($xxx, int);"
b4eb6b3d
JH
20480 if ./protochk "$try" $hdrs; then
20481 echo "Your system accepts $xxx."
20482 netdb_net_type="$xxx"
20483 fi
20484 ;;
20485 esac
20486 done
20487 : In case none of those worked, prompt the user.
20488 case "$netdb_net_type" in
20489 '') rp='What is the type for the 1st argument to getnetbyaddr?'
20490 dflt='long'
20491 . ./myread
20492 netdb_net_type=$ans
20493 ;;
20494 esac
20495 ;;
20496 *) : no getnetbyaddr, so pick harmless default
20497 netdb_net_type='long'
20498 ;;
20499 esac
20500fi
20501: locate the preferred pager for this system
d604bb53 20502fn=f/
b4eb6b3d
JH
20503case "$pager" in
20504'')
20505 dflt=''
20506 case "$pg" in
20507 /*) dflt=$pg;;
20508 [a-zA-Z]:/*) dflt=$pg;;
20509 esac
20510 case "$more" in
20511 /*) dflt=$more;;
20512 [a-zA-Z]:/*) dflt=$more;;
20513 esac
20514 case "$less" in
20515 /*) dflt=$less;;
20516 [a-zA-Z]:/*) dflt=$less;;
20517 esac
20518 case "$dflt" in
20519 '') dflt=/usr/ucb/more;;
20520 esac
20521 ;;
d604bb53 20522*) dflt="$pager"
d604bb53 20523 ;;
b4eb6b3d 20524esac
38ab64ac 20525fn="f/($dflt)"
b4eb6b3d 20526echo " "
b4eb6b3d
JH
20527rp='What pager is used on your system?'
20528. ./getfile
20529pager="$ans"
20530
20531: see what type pids are declared as in the kernel
20532rp="What is the type of process ids on this system?"
20533set pid_t pidtype int stdio.h sys/types.h
20534eval $typedef_ask
20535
b4eb6b3d
JH
20536: see if ar generates random libraries by itself
20537echo " "
20538echo "Checking how to generate random libraries on your machine..." >&4
20539echo 'int bar1() { return bar2(); }' > bar1.c
20540echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
20541$cat > foo.c <<EOP
20542#$i_stdlib I_STDLIB
20543#ifdef I_STDLIB
20544#include <stdlib.h>
20545#endif
b4eb6b3d
JH
20546int main() { printf("%d\n", bar1()); exit(0); }
20547EOP
20548$cc $ccflags -c bar1.c >/dev/null 2>&1
20549$cc $ccflags -c bar2.c >/dev/null 2>&1
20550$cc $ccflags -c foo.c >/dev/null 2>&1
20551$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 20552if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20553 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20554 echo "$ar appears to generate random libraries itself."
20555 orderlib=false
e39a9d84
LC
20556 if [ "X$ranlib" = "X" ]; then
20557 ranlib=":"
20558 fi
88d4d47b
PC
20559elif $ar s bar$_a >/dev/null 2>&1 &&
20560 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20561 $run ./foobar >/dev/null 2>&1; then
20562 echo "a table of contents needs to be added with '$ar s'."
20563 orderlib=false
20564 ranlib="$ar s"
b4eb6b3d 20565elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 20566 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 20567 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
20568 echo "a table of contents needs to be added with '$ar ts'."
20569 orderlib=false
20570 ranlib="$ar ts"
20571else
20572 case "$ranlib" in
20573 :) ranlib='';;
20574 '')
20575 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20576 $test -f $ranlib || ranlib=''
20577 ;;
20578 esac
20579 if $test -n "$ranlib"; then
20580 echo "your system has '$ranlib'; we'll use that."
20581 orderlib=false
20582 else
20583 echo "your system doesn't seem to support random libraries"
20584 echo "so we'll use lorder and tsort to order the libraries."
20585 orderlib=true
20586 ranlib=":"
20587 fi
20588fi
88d4d47b 20589$rm -f foo* bar*
b4eb6b3d 20590
92a3ac59
MB
20591: see if this is a values.h system
20592set values.h i_values
20593eval $inhdr
20594
73e6e416 20595: Check the max offset that gmtime and localtime accept
92a3ac59 20596echo "Checking max offsets that gmtime () accepts"
81c4fd9e 20597
92a3ac59
MB
20598case $i_values in
20599 define) yyy="#include <values.h>" ;;
20600 *) yyy="" ;;
20601 esac
20602
690aedd1
MB
20603case "$sGMTIME_min/$sGMTIME_max" in
20604 0/0|/)
20605 $cat >try.c <<EOCP
81c4fd9e
MB
20606#include <sys/types.h>
20607#include <stdio.h>
20608#include <time.h>
92a3ac59 20609$yyy
81c4fd9e 20610
92a3ac59
MB
20611int i;
20612struct tm *tmp;
20613time_t pt;
20614
1b289682 20615void gm_check (time_t t, int min_year, int max_year)
92a3ac59 20616{
81c4fd9e 20617 tmp = gmtime (&t);
1b289682
MB
20618 if ( tmp == NULL ||
20619 /* Check tm_year overflow */
20620 tmp->tm_year < min_year || tmp->tm_year > max_year)
92a3ac59
MB
20621 tmp = NULL;
20622 else
20623 pt = t;
20624 } /* gm_check */
81c4fd9e 20625
92a3ac59
MB
20626int check_max ()
20627{
73e6e416
MB
20628 tmp = NULL;
20629 pt = 0;
92a3ac59 20630#ifdef MAXLONG
1b289682 20631 gm_check (MAXLONG, 69, 0x7fffffff);
92a3ac59 20632#endif
73e6e416
MB
20633 if (tmp == NULL || tmp->tm_year < 0) {
20634 for (i = 63; i >= 0; i--) {
20635 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20636 if (x < 0 || x < pt) continue;
20637 gm_check (x, 69, 0x7fffffff);
73e6e416
MB
20638 }
20639 }
20640 printf ("sGMTIME_max=%ld\n", pt);
20641 return (0);
1b289682 20642 } /* check_max */
81c4fd9e 20643
92a3ac59
MB
20644int check_min ()
20645{
73e6e416
MB
20646 tmp = NULL;
20647 pt = 0;
92a3ac59 20648#ifdef MINLONG
1b289682 20649 gm_check (MINLONG, -1900, 70);
92a3ac59 20650#endif
73e6e416
MB
20651 if (tmp == NULL) {
20652 for (i = 36; i >= 0; i--) {
20653 time_t x = pt - ((time_t)1 << i);
20654 if (x > 0) continue;
1b289682 20655 gm_check (x, -1900, 70);
73e6e416
MB
20656 }
20657 }
20658 printf ("sGMTIME_min=%ld\n", pt);
20659 return (0);
20660 } /* check_min */
92a3ac59
MB
20661
20662int main (int argc, char *argv[])
20663{
73e6e416
MB
20664 fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20665 check_max ();
20666 check_min ();
20667 return (0);
20668 } /* main */
81c4fd9e 20669EOCP
690aedd1
MB
20670 set try
20671 if eval $compile; then
20672 eval `$run ./try`
20673 else
20674 echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20675 fi
20676 $rm_try
20677 ;;
20678 esac
81c4fd9e 20679
73e6e416
MB
20680echo "Checking max offsets that localtime () accepts"
20681
690aedd1
MB
20682case "$sLOCALTIME_min/$sLOCALTIME_max" in
20683 0/0|/)
20684 $cat >try.c <<EOCP
73e6e416
MB
20685#include <sys/types.h>
20686#include <stdio.h>
20687#include <time.h>
20688$yyy
20689
20690int i;
20691struct tm *tmp;
20692time_t pt;
20693
1b289682 20694void local_check (time_t t, int min_year, int max_year)
73e6e416 20695{
5bca5c48
MB
20696 if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20697 tmp = NULL;
20698 else
20699 tmp = localtime (&t);
1b289682
MB
20700 if ( tmp == NULL ||
20701 /* Check tm_year overflow */
20702 tmp->tm_year < min_year || tmp->tm_year > max_year)
73e6e416
MB
20703 tmp = NULL;
20704 else
20705 pt = t;
20706 } /* local_check */
20707
20708int check_max ()
20709{
20710 tmp = NULL;
20711 pt = 0;
20712#ifdef MAXLONG
1b289682 20713 local_check (MAXLONG, 69, 0x7fffffff);
73e6e416
MB
20714#endif
20715 if (tmp == NULL || tmp->tm_year < 0) {
20716 for (i = 63; i >= 0; i--) {
20717 time_t x = pt | ((time_t)1 << i);
1b289682
MB
20718 if (x < 0 || x < pt) continue;
20719 local_check (x, 69, 0x7fffffff);
73e6e416
MB
20720 }
20721 }
20722 printf ("sLOCALTIME_max=%ld\n", pt);
20723 return (0);
1b289682 20724 } /* check_max */
73e6e416
MB
20725
20726int check_min ()
20727{
20728 tmp = NULL;
20729 pt = 0;
20730#ifdef MINLONG
1b289682 20731 local_check (MINLONG, -1900, 70);
73e6e416
MB
20732#endif
20733 if (tmp == NULL) {
20734 for (i = 36; i >= 0; i--) {
20735 time_t x = pt - ((time_t)1 << i);
20736 if (x > 0) continue;
1b289682 20737 local_check (x, -1900, 70);
73e6e416
MB
20738 }
20739 }
20740 printf ("sLOCALTIME_min=%ld\n", pt);
20741 return (0);
20742 } /* check_min */
20743
20744int main (int argc, char *argv[])
20745{
20746 check_max ();
20747 check_min ();
20748 return (0);
20749 } /* main */
20750EOCP
690aedd1
MB
20751 set try
20752 if eval $compile; then
20753 eval `$run ./try`
20754 else
20755 echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20756 fi
20757 $rm_try
20758 ;;
20759 esac
73e6e416 20760
c0bacbef 20761: check for type of arguments to select.
b4eb6b3d
JH
20762case "$selecttype" in
20763'') case "$d_select" in
20764 $define)
20765 echo " "
20766 $cat <<EOM
20767Checking to see what type of arguments are accepted by select().
20768EOM
20769 hdrs="$define sys/types.h
c0bacbef 20770 $i_systime sys/time.h
b4eb6b3d
JH
20771 $i_sysselct sys/select.h
20772 $d_socket sys/socket.h"
20773 : The first arg can be int, unsigned, or size_t
20774 : The last arg may or may not be 'const'
20775 val=''
20776 : void pointer has been seen but using that
20777 : breaks the selectminbits test
20778 for xxx in 'fd_set *' 'int *'; do
20779 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20780 for tmo in 'struct timeval *' 'const struct timeval *'; do
20781 case "$val" in
61c26d18 20782 '') try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
b4eb6b3d
JH
20783 if ./protochk "$try" $hdrs; then
20784 echo "Your system accepts $xxx."
20785 val="$xxx"
20786 fi
20787 ;;
20788 esac
20789 done
20790 done
20791 done
20792 case "$val" in
20793 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20794 case "$d_fd_set" in
20795 $define) dflt="fd_set *" ;;
20796 *) dflt="int *" ;;
20797 esac
20798 . ./myread
20799 val=$ans
20800 ;;
20801 esac
20802 selecttype="$val"
20803 ;;
20804 *) : no select, so pick a harmless default
20805 selecttype='int *'
20806 ;;
20807 esac
20808 ;;
20809esac
20810
20811: check for the select 'width'
20812case "$selectminbits" in
e6e7e605
JH
20813'') safebits=`expr $ptrsize \* 8`
20814 case "$d_select" in
b4eb6b3d
JH
20815 $define)
20816 $cat <<EOM
20817
20818Checking to see on how many bits at a time your select() operates...
20819EOM
20820 $cat >try.c <<EOCP
20821#include <sys/types.h>
20822#$i_time I_TIME
20823#$i_systime I_SYS_TIME
20824#$i_systimek I_SYS_TIME_KERNEL
20825#ifdef I_TIME
20826# include <time.h>
20827#endif
20828#ifdef I_SYS_TIME
20829# ifdef I_SYS_TIME_KERNEL
20830# define KERNEL
20831# endif
20832# include <sys/time.h>
20833# ifdef I_SYS_TIME_KERNEL
20834# undef KERNEL
20835# endif
20836#endif
20837#$i_sysselct I_SYS_SELECT
20838#ifdef I_SYS_SELECT
20839#include <sys/select.h>
20840#endif
20841#$d_socket HAS_SOCKET
20842#ifdef HAS_SOCKET
20843# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20844#endif
20845#include <stdio.h>
d1daaddf
JH
20846#$i_stdlib I_STDLIB
20847#ifdef I_STDLIB
20848#include <stdlib.h>
20849#endif
b4eb6b3d
JH
20850$selecttype b;
20851#define S sizeof(*(b))
20852#define MINBITS 64
20853#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20854#define NBITS (NBYTES * 8)
20855int main() {
7090f861 20856 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
20857 struct timeval t;
20858 int i;
20859 FILE* fp;
20860 int fd;
20861
e6e7e605
JH
20862 if (!s)
20863 exit(1);
b4eb6b3d
JH
20864 fclose(stdin);
20865 fp = fopen("try.c", "r");
20866 if (fp == 0)
e6e7e605 20867 exit(2);
b4eb6b3d
JH
20868 fd = fileno(fp);
20869 if (fd < 0)
e6e7e605 20870 exit(3);
b4eb6b3d
JH
20871 b = ($selecttype)s;
20872 for (i = 0; i < NBITS; i++)
20873 FD_SET(i, b);
20874 t.tv_sec = 0;
20875 t.tv_usec = 0;
20876 select(fd + 1, b, 0, 0, &t);
20877 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 20878 free(s);
b4eb6b3d
JH
20879 printf("%d\n", i + 1);
20880 return 0;
20881}
20882EOCP
20883 set try
20884 if eval $compile_ok; then
5440bc8e 20885 selectminbits=`$run ./try`
b4eb6b3d
JH
20886 case "$selectminbits" in
20887 '') cat >&4 <<EOM
20888Cannot figure out on how many bits at a time your select() operates.
e6e7e605 20889I'll play safe and guess it is $safebits bits.
b4eb6b3d 20890EOM
e6e7e605
JH
20891 selectminbits=$safebits
20892 bits="$safebits bits"
b4eb6b3d
JH
20893 ;;
20894 1) bits="1 bit" ;;
20895 *) bits="$selectminbits bits" ;;
20896 esac
20897 echo "Your select() operates on $bits at a time." >&4
20898 else
20899 rp='What is the minimum number of bits your select() operates on?'
20900 case "$byteorder" in
e6e7e605
JH
20901 12345678) dflt=64 ;;
20902 1234) dflt=32 ;;
b4eb6b3d
JH
20903 *) dflt=1 ;;
20904 esac
20905 . ./myread
20906 val=$ans
20907 selectminbits="$val"
20908 fi
5b813a60 20909 $rm_try
b4eb6b3d
JH
20910 ;;
20911 *) : no select, so pick a harmless default
e6e7e605 20912 selectminbits=$safebits
b4eb6b3d
JH
20913 ;;
20914 esac
20915 ;;
20916esac
20917
20918: Trace out the files included by signal.h, then look for SIGxxx names.
b4eb6b3d
JH
20919if [ "X$fieldn" = X ]; then
20920 : Just make some guesses. We check them later.
20921 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20922else
20923 xxx=`echo '#include <signal.h>' |
20924 $cppstdin $cppminus $cppflags 2>/dev/null |
613d6c3e 20925 $grep '^[ ]*#.*include' |
776a38e3
MB
20926 $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20927 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d 20928fi
b4eb6b3d
JH
20929xxxfiles=''
20930for xx in $xxx /dev/null ; do
20931 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20932done
b4eb6b3d
JH
20933case "$xxxfiles" in
20934'') xxxfiles=`./findhdr signal.h` ;;
20935esac
20936xxx=`awk '
20937$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20938 print substr($2, 4, 20)
20939}
20940$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20941 print substr($3, 4, 20)
20942}' $xxxfiles`
20943: Append some common names just in case the awk scan failed.
20944xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20945xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20946xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20947xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20948xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20949
20950: generate a few handy files for later
55954f19 20951$cat > signal.c <<EOCP
b4eb6b3d
JH
20952#include <sys/types.h>
20953#include <signal.h>
55954f19
JH
20954#$i_stdlib I_STDLIB
20955#ifdef I_STDLIB
20956#include <stdlib.h>
20957#endif
b4eb6b3d
JH
20958#include <stdio.h>
20959int main() {
20960
20961/* Strange style to avoid deeply-nested #if/#else/#endif */
20962#ifndef NSIG
20963# ifdef _NSIG
20964# define NSIG (_NSIG)
20965# endif
20966#endif
20967
20968#ifndef NSIG
20969# ifdef SIGMAX
20970# define NSIG (SIGMAX+1)
20971# endif
20972#endif
20973
20974#ifndef NSIG
20975# ifdef SIG_MAX
20976# define NSIG (SIG_MAX+1)
20977# endif
20978#endif
20979
20980#ifndef NSIG
3609ea0d
JH
20981# ifdef _SIG_MAX
20982# define NSIG (_SIG_MAX+1)
20983# endif
20984#endif
20985
20986#ifndef NSIG
b4eb6b3d
JH
20987# ifdef MAXSIG
20988# define NSIG (MAXSIG+1)
20989# endif
20990#endif
20991
20992#ifndef NSIG
20993# ifdef MAX_SIG
20994# define NSIG (MAX_SIG+1)
20995# endif
20996#endif
20997
20998#ifndef NSIG
20999# ifdef SIGARRAYSIZE
3609ea0d 21000# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
21001# endif
21002#endif
21003
21004#ifndef NSIG
21005# ifdef _sys_nsig
21006# define NSIG (_sys_nsig) /* Solaris 2.5 */
21007# endif
21008#endif
21009
21010/* Default to some arbitrary number that's big enough to get most
21011 of the common signals.
21012*/
21013#ifndef NSIG
21014# define NSIG 50
21015#endif
21016
21017printf("NSIG %d\n", NSIG);
21018
21019#ifndef JUST_NSIG
21020
21021EOCP
21022
21023echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21024{
21025 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 21026 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
21027 printf $1; printf ");\n"
21028 printf "#endif\n"
21029}
21030END {
21031 printf "#endif /* JUST_NSIG */\n";
21032 printf "exit(0);\n}\n";
21033}
21034' >>signal.c
21035$cat >signal.awk <<'EOP'
21036BEGIN { ndups = 0 }
65197d93 21037$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 21038($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
21039 if ($2 > maxsig) { maxsig = $2 }
21040 if (sig_name[$2]) {
21041 dup_name[ndups] = $1
21042 dup_num[ndups] = $2
613d6c3e 21043 ndups++
b4eb6b3d 21044 }
1ebe1ffb 21045 else {
65197d93
JH
21046 sig_name[$2] = $1
21047 sig_num[$2] = $2
b4eb6b3d
JH
21048 }
21049}
613d6c3e 21050END {
b4eb6b3d
JH
21051 if (nsig == 0) {
21052 nsig = maxsig + 1
21053 }
21054 printf("NSIG %d\n", nsig);
21055 for (n = 1; n < nsig; n++) {
21056 if (sig_name[n]) {
21057 printf("%s %d\n", sig_name[n], sig_num[n])
21058 }
21059 else {
613d6c3e 21060 printf("NUM%d %d\n", n, n)
b4eb6b3d
JH
21061 }
21062 }
21063 for (n = 0; n < ndups; n++) {
21064 printf("%s %d\n", dup_name[n], dup_num[n])
21065 }
21066}
21067EOP
21068$cat >signal_cmd <<EOS
21069$startsh
21070if $test -s signal.lst; then
21071 echo "Using your existing signal.lst file"
21072 exit 0
21073fi
21074xxx="$xxx"
21075EOS
21076$cat >>signal_cmd <<'EOS'
21077
21078set signal
21079if eval $compile_ok; then
776a38e3
MB
21080 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21081 $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
21082else
21083 echo "(I can't seem be able to compile the whole test program)" >&4
21084 echo "(I'll try it in little pieces.)" >&4
21085 set signal -DJUST_NSIG
21086 if eval $compile_ok; then
5440bc8e 21087 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
21088 $cat signal.nsg
21089 else
21090 echo "I can't seem to figure out how many signals you have." >&4
21091 echo "Guessing 50." >&4
21092 echo 'NSIG 50' > signal.nsg
21093 fi
21094 : Now look at all the signal names, one at a time.
21095 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21096 $cat > signal.c <<EOCP
21097#include <sys/types.h>
21098#include <signal.h>
21099#include <stdio.h>
21100int main() {
21101printf("$xx %d\n", SIG${xx});
21102return 0;
21103}
21104EOCP
21105 set signal
21106 if eval $compile; then
21107 echo "SIG${xx} found."
5440bc8e 21108 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
21109 else
21110 echo "SIG${xx} NOT found."
21111 fi
21112 done
21113 if $test -s signal.ls1; then
21114 $cat signal.nsg signal.ls1 |
65197d93 21115 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
21116 fi
21117
21118fi
21119if $test -s signal.lst; then
21120 :
21121else
21122 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21123 echo 'kill -l' >signal
21124 set X `csh -f <signal`
21125 $rm -f signal
21126 shift
21127 case $# in
21128 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21129 esac
21130 echo $@ | $tr ' ' $trnl | \
21131 $awk '{ printf "%s %d\n", $1, ++s; }
21132 END { printf "NSIG %d\n", ++s }' >signal.lst
21133fi
21134$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21135EOS
21136chmod a+x signal_cmd
21137$eunicefix signal_cmd
21138
21139: generate list of signal names
21140echo " "
21141case "$sig_name_init" in
21142'') doinit=yes ;;
21143*) case "$sig_num_init" in
21144 ''|*,*) doinit=yes ;;
21145 esac ;;
21146esac
21147case "$doinit" in
21148yes)
21149 echo "Generating a list of signal names and numbers..." >&4
21150 . ./signal_cmd
21151 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21152 sig_name=`$awk 'BEGIN { printf "ZERO " }
21153 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21154 sig_num=`$awk 'BEGIN { printf "0 " }
21155 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21156 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
21157 !/^NSIG/ { printf "\"%s\", ", $1 }
21158 END { printf "0\n" }' signal.lst`
21159 sig_num_init=`$awk 'BEGIN { printf "0, " }
21160 !/^NSIG/ { printf "%d, ", $2}
21161 END { printf "0\n"}' signal.lst`
21162 ;;
21163esac
21164echo "The following $sig_count signals are available:"
21165echo " "
21166echo $sig_name | $awk \
21167'BEGIN { linelen = 0 }
21168{
21169 for (i = 1; i <= NF; i++) {
21170 name = "SIG" $i " "
21171 linelen = linelen + length(name)
21172 if (linelen > 70) {
21173 printf "\n"
21174 linelen = length(name)
21175 }
21176 printf "%s", name
21177 }
21178 printf "\n"
21179}'
76d3c696 21180sig_size=`echo $sig_name | awk '{print NF}'`
c0bacbef 21181$rm -f signal signal.c signal.awk signal.lst signal_cmd
b4eb6b3d 21182
613d6c3e 21183: Check size of size
b4eb6b3d
JH
21184echo " "
21185case "$sizetype" in
21186*_t) zzz="$sizetype" ;;
21187*) zzz="filesize" ;;
21188esac
613d6c3e 21189echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21190cat > try.c <<EOCP
21191#include <sys/types.h>
21192#include <stdio.h>
d1daaddf
JH
21193#$i_stdlib I_STDLIB
21194#ifdef I_STDLIB
21195#include <stdlib.h>
21196#endif
b4eb6b3d
JH
21197int main() {
21198 printf("%d\n", (int)sizeof($sizetype));
21199 exit(0);
21200}
21201EOCP
21202set try
21203if eval $compile_ok; then
5440bc8e 21204 yyy=`$run ./try`
b4eb6b3d
JH
21205 case "$yyy" in
21206 '') sizesize=4
21207 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21208 ;;
21209 *) sizesize=$yyy
21210 echo "Your $zzz size is $sizesize bytes."
21211 ;;
21212 esac
21213else
21214 sizesize=4
21215 echo "(I can't compile the test program--guessing $sizesize.)" >&4
21216fi
21217
21218
21219: check for socklen_t
21220echo " "
21221echo "Checking to see if you have socklen_t..." >&4
21222$cat >try.c <<EOCP
21223#include <sys/types.h>
21224#$d_socket HAS_SOCKET
21225#ifdef HAS_SOCKET
21226#include <sys/socket.h>
21227#endif
21228int main() { socklen_t x = 16; }
21229EOCP
21230set try
21231if eval $compile; then
21232 val="$define"
21233 echo "You have socklen_t."
21234else
21235 val="$undef"
21236 echo "You do not have socklen_t."
21237 case "$sizetype" in
21238 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21239 esac
21240fi
5b813a60 21241$rm_try
b4eb6b3d
JH
21242set d_socklen_t
21243eval $setvar
21244
a7710f8d
JH
21245: see if this is a socks.h system
21246set socks.h i_socks
21247eval $inhdr
21248
b4eb6b3d
JH
21249: check for type of the size argument to socket calls
21250case "$d_socket" in
21251"$define")
21252 $cat <<EOM
21253
21254Checking to see what type is the last argument of accept().
21255EOM
b4eb6b3d
JH
21256 yyy=''
21257 case "$d_socklen_t" in
21258 "$define") yyy="$yyy socklen_t"
21259 esac
21260 yyy="$yyy $sizetype int long unsigned"
21261 for xxx in $yyy; do
21262 case "$socksizetype" in
61c26d18 21263 '') try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
21264 case "$usesocks" in
21265 "$define")
21266 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21267 echo "Your system accepts '$xxx *' for the last argument of accept()."
21268 socksizetype="$xxx"
21269 fi
21270 ;;
21271 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
21272 echo "Your system accepts '$xxx *' for the last argument of accept()."
21273 socksizetype="$xxx"
21274 fi
21275 ;;
21276 esac
b4eb6b3d
JH
21277 ;;
21278 esac
21279 done
21280: In case none of those worked, prompt the user.
21281 case "$socksizetype" in
21282 '') rp='What is the type for socket address structure sizes?'
21283 dflt='int'
21284 . ./myread
21285 socksizetype=$ans
21286 ;;
21287 esac
21288 ;;
21289*) : no sockets, so pick relatively harmless default
21290 socksizetype='int'
21291 ;;
21292esac
21293
21294: see what type is used for signed size_t
21295set ssize_t ssizetype int stdio.h sys/types.h
21296eval $typedef
21297dflt="$ssizetype"
5440bc8e 21298$cat > try.c <<EOM
b4eb6b3d 21299#include <stdio.h>
d1daaddf
JH
21300#$i_stdlib I_STDLIB
21301#ifdef I_STDLIB
21302#include <stdlib.h>
21303#endif
b4eb6b3d
JH
21304#include <sys/types.h>
21305#define Size_t $sizetype
21306#define SSize_t $dflt
21307int main()
21308{
21309 if (sizeof(Size_t) == sizeof(SSize_t))
21310 printf("$dflt\n");
21311 else if (sizeof(Size_t) == sizeof(int))
21312 printf("int\n");
5b813a60 21313 else
b4eb6b3d
JH
21314 printf("long\n");
21315 exit(0);
21316}
21317EOM
21318echo " "
5440bc8e
JH
21319set try
21320if eval $compile_ok && $run ./try > /dev/null; then
21321 ssizetype=`$run ./try`
b4eb6b3d
JH
21322 echo "I'll be using $ssizetype for functions returning a byte count." >&4
21323else
21324 $cat >&4 <<EOM
21325Help! I can't compile and run the ssize_t test program: please enlighten me!
21326(This is probably a misconfiguration in your system or libraries, and
21327you really ought to fix it. Still, I'll try anyway.)
21328
21329I need a type that is the same size as $sizetype, but is guaranteed to
21330be signed. Common values are ssize_t, int and long.
21331
21332EOM
21333 rp="What signed type is the same size as $sizetype?"
21334 . ./myread
21335 ssizetype="$ans"
21336fi
5b813a60 21337$rm_try
b4eb6b3d 21338
668fdbe1
MB
21339: Check the size of st_ino
21340$echo " "
21341$echo "Checking the size of st_ino..." >&4
21342$cat > try.c <<EOCP
21343#include <sys/stat.h>
21344#include <stdio.h>
21345#$i_stdlib I_STDLIB
21346#ifdef I_STDLIB
21347#include <stdlib.h>
21348#endif
21349int main() {
21350 struct stat st;
21351 printf("%d\n", (int)sizeof(st.st_ino));
21352 exit(0);
21353}
21354EOCP
21355set try
21356if eval $compile_ok; then
21357 val=`$run ./try`
21358 case "$val" in
21359 '') st_ino_size=4
21360 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21361 ;;
21362 *) st_ino_size=$val
21363 $echo "Your st_ino is $st_ino_size bytes long."
21364 ;;
21365 esac
21366else
21367 st_ino_size=4
21368 $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21369fi
21370$rm_try
21371
21372: Check if st_ino is signed
21373$echo " "
21374$echo "Checking the sign of st_ino..." >&4
21375$cat > try.c <<EOCP
21376#include <sys/stat.h>
21377#include <stdio.h>
21378int main() {
21379 struct stat foo;
21380 foo.st_ino = -1;
21381 if (foo.st_ino < 0)
21382 printf("-1\n");
21383 else
21384 printf("1\n");
21385}
21386EOCP
21387set try
21388if eval $compile; then
21389 val=`$run ./try`
21390 case "$val" in
21391 '') st_ino_sign=1
21392 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21393 ;;
21394 *) st_ino_sign=$val
21395 case "$st_ino_sign" in
21396 1) $echo "Your st_ino is unsigned." ;;
21397 -1) $echo "Your st_ino is signed." ;;
21398 esac
21399 ;;
21400 esac
21401else
21402 st_ino_sign=1
21403 $echo "(I can't compile the test program--guessing unsigned.)" >&4
21404fi
21405$rm_try
21406
b4eb6b3d
JH
21407: see what type of char stdio uses.
21408echo " "
1d8eaf8c 21409echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
aa517f50 21410if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
21411 echo "Your stdio uses unsigned chars." >&4
21412 stdchar="unsigned char"
21413else
aa517f50
JH
21414 echo "Your stdio uses signed chars." >&4
21415 stdchar="char"
b4eb6b3d 21416fi
1d8eaf8c 21417$rm -f stdioh
b4eb6b3d 21418
b4eb6b3d
JH
21419: see what type uids are declared as in the kernel
21420echo " "
21421echo "Looking for the type for user ids returned by getuid()."
21422set uid_t uidtype xxx stdio.h sys/types.h
21423eval $typedef
21424case "$uidtype" in
21425xxx)
21426 xxx=`./findhdr sys/user.h`
21427 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21428 case $1 in
21429 unsigned) dflt="$1 $2" ;;
21430 *) dflt="$1" ;;
21431 esac
21432 ;;
21433*) dflt="$uidtype";;
21434esac
21435case "$uidtype" in
21436uid_t) echo "uid_t found." ;;
21437*) rp="What is the type for user ids returned by getuid()?"
21438 . ./myread
21439 uidtype="$ans"
21440 ;;
21441esac
21442
613d6c3e 21443: Check size of UID
b4eb6b3d
JH
21444echo " "
21445case "$uidtype" in
21446*_t) zzz="$uidtype" ;;
21447*) zzz="uid" ;;
21448esac
613d6c3e 21449echo "Checking the size of $zzz..." >&4
b4eb6b3d
JH
21450cat > try.c <<EOCP
21451#include <sys/types.h>
21452#include <stdio.h>
d1daaddf
JH
21453#$i_stdlib I_STDLIB
21454#ifdef I_STDLIB
21455#include <stdlib.h>
21456#endif
b4eb6b3d
JH
21457int main() {
21458 printf("%d\n", (int)sizeof($uidtype));
21459 exit(0);
21460}
21461EOCP
21462set try
21463if eval $compile_ok; then
5440bc8e 21464 yyy=`$run ./try`
b4eb6b3d
JH
21465 case "$yyy" in
21466 '') uidsize=4
21467 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21468 ;;
21469 *) uidsize=$yyy
21470 echo "Your $zzz is $uidsize bytes long."
21471 ;;
21472 esac
21473else
21474 uidsize=4
21475 echo "(I can't compile the test program--guessing $uidsize.)" >&4
21476fi
21477
613d6c3e 21478: Check if UID is signed
b4eb6b3d
JH
21479echo " "
21480case "$uidtype" in
21481*_t) zzz="$uidtype" ;;
21482*) zzz="uid" ;;
21483esac
21484echo "Checking the sign of $zzz..." >&4
21485cat > try.c <<EOCP
21486#include <sys/types.h>
21487#include <stdio.h>
21488int main() {
21489 $uidtype foo = -1;
21490 if (foo < 0)
21491 printf("-1\n");
21492 else
21493 printf("1\n");
21494}
21495EOCP
21496set try
21497if eval $compile; then
5440bc8e 21498 yyy=`$run ./try`
b4eb6b3d
JH
21499 case "$yyy" in
21500 '') uidsign=1
21501 echo "(I can't execute the test program--guessing unsigned.)" >&4
21502 ;;
21503 *) uidsign=$yyy
21504 case "$uidsign" in
21505 1) echo "Your $zzz is unsigned." ;;
21506 -1) echo "Your $zzz is signed." ;;
21507 esac
21508 ;;
21509 esac
21510else
21511 uidsign=1
21512 echo "(I can't compile the test program--guessing unsigned.)" >&4
21513fi
21514
21515
34f1896b 21516: Check format string for UID
b4eb6b3d
JH
21517echo " "
21518$echo "Checking the format string to be used for uids..." >&4
21519
21520case "$uidsign" in
21521-1) if $test X"$uidsize" = X"$ivsize"; then
21522 uidformat="$ivdformat"
21523 else
21524 if $test X"$uidsize" = X"$longsize"; then
21525 uidformat='"ld"'
21526 else
21527 if $test X"$uidsize" = X"$intsize"; then
21528 uidformat='"d"'
21529 else
21530 if $test X"$uidsize" = X"$shortsize"; then
21531 uidformat='"hd"'
21532 fi
21533 fi
21534 fi
21535 fi
21536 ;;
21537*) if $test X"$uidsize" = X"$uvsize"; then
21538 uidformat="$uvuformat"
21539 else
21540 if $test X"$uidsize" = X"$longsize"; then
21541 uidformat='"lu"'
21542 else
21543 if $test X"$uidsize" = X"$intsize"; then
21544 uidformat='"u"'
21545 else
21546 if $test X"$uidsize" = X"$shortsize"; then
21547 uidformat='"hu"'
21548 fi
21549 fi
21550 fi
21551 fi
21552 ;;
21553esac
21554
d78f9ffa
MB
21555: Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21556echo " "
21557echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21558$cat >try.c <<'EOM'
21559/* Intentionally a long probe as I'd like to sanity check that the exact
21560 approach is going to work, as thinking it will work, but only having it
21561 part working at runtime is worse than not having it. */
21562
21563#include <sys/types.h>
21564#include <sys/sysctl.h>
21565#include <sys/param.h>
21566#include <stdio.h>
21567#include <string.h>
21568#include <stdlib.h>
21569#include <unistd.h>
21570
21571int
21572main(int argc, char **argv) {
21573 char *buffer;
21574 char *argv_leaf = strrchr(argv[0], '/');
21575 char *buffer_leaf;
21576 size_t size = 0;
21577 int mib[4];
21578
21579 mib[0] = CTL_KERN;
21580 mib[1] = KERN_PROC;
21581 mib[2] = KERN_PROC_PATHNAME;
21582 mib[3] = -1;
21583
21584 if (!argv_leaf) {
21585 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21586 return 1;
21587 }
21588
21589 if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21590 perror("sysctl");
21591 return 2;
21592 }
21593
21594 if (size < strlen(argv_leaf) + 1) {
21595 fprintf(stderr, "size %lu is too short for a path\n",
21596 (unsigned long) size);
21597 return 3;
21598 }
21599
21600 if (size > MAXPATHLEN * MAXPATHLEN) {
21601 fprintf(stderr, "size %lu is too long for a path\n",
21602 (unsigned long) size);
21603 return 4;
21604 }
21605
21606 buffer = malloc(size);
21607 if (!buffer) {
21608 perror("malloc");
21609 return 5;
21610 }
21611
21612 if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21613 perror("sysctl");
21614 return 6;
21615 }
21616
21617 if (strlen(buffer) + 1 != size) {
21618 fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21619 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21620 return 7;
21621 }
21622
21623
21624 if (*buffer != '/') {
21625 fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21626 return 8;
21627 }
21628
21629 if (strstr(buffer, "/./")) {
21630 fprintf(stderr, "Contains /./: '%s'\n", buffer);
21631 return 9;
21632 }
21633
21634 if (strstr(buffer, "/../")) {
21635 fprintf(stderr, "Contains /../: '%s'\n", buffer);
21636 return 10;
21637 }
21638
21639 buffer_leaf = strrchr(buffer, '/');
21640 if (strcmp(buffer_leaf, argv_leaf) != 0) {
21641 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21642 return 11;
21643 }
21644
21645 free(buffer);
21646
21647 return 0;
21648}
21649EOM
21650
21651val=$undef
21652set try
9e477c13 21653if eval $compile; then
d78f9ffa
MB
21654 if $run ./try; then
21655 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21656 val="$define"
21657 else
21658 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21659 val="$undef"
21660 fi
21661else
21662 echo "I'm unable to compile the test program." >&4
21663 echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21664 val="$undef"
21665fi
21666$rm_try
21667set usekernprocpathname
21668eval $setvar
21669
21670: Determine if we can use _NSGetExecutablePath to find executing program
21671echo " "
21672echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21673$cat >try.c <<'EOM'
21674/* Intentionally a long probe as I'd like to sanity check that the exact
21675 approach is going to work, as thinking it will work, but only having it
21676 part working at runtime is worse than not having it. */
21677#include <mach-o/dyld.h>
21678#include <stdio.h>
21679#include <stdlib.h>
21680#include <sys/param.h>
21681#include <string.h>
21682
21683int
21684main(int argc, char **argv) {
21685 char buf[1];
21686 uint32_t size = sizeof(buf);
21687 int result;
21688 char *buffer;
21689 char *tidied;
21690 char *argv_leaf = strrchr(argv[0], '/');
21691 char *tidied_leaf;
21692
21693 if (!argv_leaf) {
21694 fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21695 return 1;
21696 }
21697
21698 _NSGetExecutablePath(buf, &size);
21699 if (size > MAXPATHLEN * MAXPATHLEN) {
21700 fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21701 (unsigned int) size);
21702 return 2;
21703 }
21704
21705 buffer = malloc(size);
21706 if (!buffer) {
21707 perror("malloc");
21708 return 3;
21709 }
21710
21711 result = _NSGetExecutablePath(buffer, &size);
21712 if (result != 0) {
21713 fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21714 result, (unsigned int) size);
21715 return 4;
21716 }
21717
21718 tidied = realpath(buffer, NULL);
21719 if (!tidied) {
21720 perror("realpath");
21721 return 5;
21722 }
21723
21724 free(buffer);
21725
21726 if (*tidied != '/') {
21727 fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21728 return 6;
21729 }
21730
21731 if (strstr(tidied, "/./")) {
21732 fprintf(stderr, "Contains /./: '%s'\n", tidied);
21733 return 7;
21734 }
21735
21736 if (strstr(tidied, "/../")) {
21737 fprintf(stderr, "Contains /../: '%s'\n", tidied);
21738 return 8;
21739 }
21740
21741 tidied_leaf = strrchr(tidied, '/');
21742 if (strcmp(tidied_leaf, argv_leaf) != 0) {
21743 fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21744 return 9;
21745 }
21746
21747 free(tidied);
21748
21749 return 0;
21750}
21751EOM
21752
21753val=$undef
21754set try
9e477c13 21755if eval $compile; then
d78f9ffa
MB
21756 if $run ./try; then
21757 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21758 val="$define"
21759 else
21760 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21761 fi
21762else
21763 echo "I'm unable to compile the test program." >&4
21764 echo "I'll assume no _NSGetExecutablePath here." >&4
21765fi
21766$rm_try
21767set usensgetexecutablepath
21768eval $setvar
21769
34f1896b 21770: Check if site customization support was requested
4afd418c
MB
21771case "$usesitecustomize" in
21772 $define|true|[Yy]*)
21773 usesitecustomize="$define"
21774 ;;
21775 *)
21776 usesitecustomize="$undef"
21777 ;;
21778 esac
21779
d03b3b00
MB
21780: see if prototypes support variable argument declarations
21781echo " "
21782case "$prototype$i_stdarg" in
21783$define$define)
21784 echo "It appears we'll be able to prototype varargs functions." >&4
21785 val="$define"
21786 ;;
21787*)
21788 echo "Too bad... We won't be using prototyped varargs functions..." >&4
21789 val="$undef"
21790 ;;
21791esac
21792set vaproto
21793eval $setvar
21794
3659ebf1
JH
21795: determine compiler compiler
21796case "$yacc" in
21797'')
21798 dflt=yacc;;
21799*)
21800 dflt="$yacc";;
21801esac
21802echo " "
21803comp='yacc'
3c728e00 21804if $test -f "$byacc$_exe"; then
3659ebf1
JH
21805 dflt="$byacc"
21806 comp="byacc or $comp"
21807fi
3c728e00 21808if $test -f "$bison$_exe"; then
3659ebf1
JH
21809 comp="$comp or bison -y"
21810fi
21811rp="Which compiler compiler ($comp) shall I use?"
21812. ./myread
21813yacc="$ans"
21814case "$yacc" in
21815*bis*)
21816 case "$yacc" in
21817 *-y*) ;;
21818 *)
21819 yacc="$yacc -y"
21820 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21821 ;;
21822 esac
21823 ;;
21824esac
21825
c0bacbef
MB
21826: see if this is a assert.h system
21827set assert.h i_assert
21828eval $inhdr
21829
758a5d79
JH
21830: see if this is a fp.h system
21831set fp.h i_fp
21832eval $inhdr
21833
21834: see if this is a fp_class.h system
21835set fp_class.h i_fp_class
21836eval $inhdr
21837
13cfc98d
MB
21838: see if gdbm.h is available
21839set gdbm.h t_gdbm
21840eval $inhdr
21841case "$t_gdbm" in
21842$define)
21843 : see if gdbm_open exists
21844 set gdbm_open d_gdbm_open
21845 eval $inlibc
21846 case "$d_gdbm_open" in
21847 $undef)
21848 t_gdbm="$undef"
21849 echo "We won't be including <gdbm.h>"
21850 ;;
21851 esac
21852 ;;
21853esac
21854val="$t_gdbm"
21855set i_gdbm
21856eval $setvar
21857
b2f871ed
AD
21858: see if this is a ieeefp.h system
21859case "$i_ieeefp" in
21860'' ) set ieeefp.h i_ieeefp
21861 eval $inhdr
21862 ;;
21863esac
21864
21865: see if this is a libutil.h system
21866set libutil.h i_libutil
21867eval $inhdr
21868
21869: see if mach cthreads are available
21870if test "X$usethreads" = "X$define"; then
21871 set mach/cthreads.h i_machcthr
21872 eval $inhdr
21873else
21874 i_machcthr="$undef"
21875fi
21876
21877: see if this is a mntent.h system
21878set mntent.h i_mntent
21879eval $inhdr
21880
b4eb6b3d
JH
21881: see if net/errno.h is available
21882val=''
21883set net/errno.h val
21884eval $inhdr
21885
21886: Unfortunately, it causes problems on some systems. Arrgh.
21887case "$val" in
21888$define)
21889 cat > try.c <<'EOM'
21890#include <stdio.h>
21891#include <errno.h>
21892#include <net/errno.h>
21893int func()
21894{
21895 return ENOTSOCK;
21896}
21897EOM
21898 if $cc $ccflags -c try.c >/dev/null 2>&1; then
21899 echo "We'll be including <net/errno.h>." >&4
21900 else
21901 echo "We won't be including <net/errno.h>." >&4
21902 val="$undef"
21903 fi
5b813a60 21904 $rm_try
b4eb6b3d
JH
21905 ;;
21906esac
21907set i_neterrno
21908eval $setvar
21909
21910: see if netinet/tcp.h is available
21911set netinet/tcp.h i_netinettcp
21912eval $inhdr
21913
21914: see if this is a poll.h system
21915set poll.h i_poll
21916eval $inhdr
21917
21918: see if this is a prot.h system
21919set prot.h i_prot
21920eval $inhdr
21921
613d6c3e 21922: Preprocessor symbols
b4eb6b3d 21923echo " "
ddfca5da 21924$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
21925$cat <<'EOSH' > Cppsym.know
21926a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21927AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 21928alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
21929ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21930BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
21931BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21932bull c cadmus clipper CMU COFF COMPILER_VERSION
21933concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 21934CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
21935Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21936FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21937GLIBC GLIBC_MINOR
21938GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
21939H3050R H3050RX hbullx20 hcx host_mips
21940hp200 hp300 hp700 HP700 hp800 hp9000
21941hp9000s200 hp9000s300 hp9000s400 hp9000s500
21942hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21943i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 21944IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
21945INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21946LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21947LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
9c12f1e5 21948LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
b4eb6b3d
JH
21949LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21950M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21951M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21952M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21953MATH_HAS_NO_SIDE_EFFECTS
21954mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21955mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21956mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21957MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21958mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21959NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 21960news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
21961ns32016 ns32332 ns32k nsc32000
21962OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21963pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21964pc532 pdp11 PGC PIC plexus PORTAR posix
21965POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21966POSIX_C_SOURCE POSIX_SOURCE POWER
9c12f1e5 21967PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 21968riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
21969SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21970sony sony_news sonyrisc sparc sparclite spectrum
21971stardent stdc STDC_EXT stratos sun sun3 sun386
21972Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21973SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21974SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21975sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 21976TM3200 TM5400 TM5600
b4eb6b3d
JH
21977tower tower32 tower32_200 tower32_600 tower32_700
21978tower32_800 tower32_850 tss
21979u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21980ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
21981unix UNIX95 UNIX99 unixpc unos
21982USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21983USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21984USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21985USGr4 USGr4_2
44c87379 21986Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
21987XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21988XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21989z8000
21990EOSH
21991# Maybe put other stuff here too.
21992cat <<EOSH >>Cppsym.know
21993$osname
21994EOSH
21995./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21996./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21997$cat Cppsym.know > Cppsym.c
381aa1ff 21998$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
21999$rm -f Cppsym.a Cppsym.b Cppsym.c
22000cat <<EOSH > Cppsym
22001$startsh
22002if $test \$# -gt 0; then
22003 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22004 if $test -s Cppsym.got; then
22005 $rm -f Cppsym.got
22006 exit 0
22007 fi
22008 $rm -f Cppsym.got
22009 exit 1
22010else
22011 $tr " " "$trnl" | ./Cppsym.try
22012 exit 0
22013fi
22014EOSH
22015chmod +x Cppsym
22016$eunicefix Cppsym
22017cat <<EOSH > Cppsym.try
22018$startsh
22019cat <<'EOCP' > try.c
22020#include <stdio.h>
360321b3
YST
22021#if cpp_stuff == 1
22022#define STRINGIFY(a) "a"
22023#endif
22024#if cpp_stuff == 42
22025#define StGiFy(a) #a
22026#define STRINGIFY(a) StGiFy(a)
22027#endif
22028#if $cpp_stuff != 1 && $cpp_stuff != 42
22029# include "Bletch: How does this C preprocessor stringify macros?"
22030#endif
b4eb6b3d
JH
22031int main() {
22032EOCP
22033$awk \\
22034EOSH
22035cat <<'EOSH' >> Cppsym.try
22036'length($1) > 0 {
360321b3
YST
22037 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22038 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22039 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22040 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 22041}' >> try.c
2ef53570 22042echo 'return 0;}' >> try.c
b4eb6b3d
JH
22043EOSH
22044cat <<EOSH >> Cppsym.try
22045ccflags="$ccflags"
22046case "$osname-$gccversion" in
22047irix-) ccflags="\$ccflags -woff 1178" ;;
22048os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22049esac
360321b3 22050$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
22051EOSH
22052chmod +x Cppsym.try
22053$eunicefix Cppsym.try
6f87f404 22054./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
ddfca5da 22055: Add in any linux cpp "predefined macros":
b6a7163e 22056case "$osname::$gccversion" in
eeb92b76 22057 *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
b6a7163e
MB
22058 tHdrH=_tmpHdr
22059 rm -f $tHdrH'.h' $tHdrH
22060 touch $tHdrH'.h'
6f87f404 22061 # Filter out macro arguments, such as Linux's __INT8_C(c)
6f5be6d1 22062 if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
6f87f404 22063 sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
b6a7163e
MB
22064 if [ -s $tHdrH'_cppsym.real' ]; then
22065 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22066 fi
22067 fi
22068 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22069 ;;
22070esac
b4eb6b3d
JH
22071: now check the C compiler for additional symbols
22072postprocess_cc_v=''
22073case "$osname" in
22074aix) postprocess_cc_v="|$tr , ' '" ;;
22075esac
22076$cat >ccsym <<EOS
22077$startsh
22078$cat >tmp.c <<EOF
22079extern int foo;
22080EOF
22081for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22082do
22083 case "\$i" in
22084 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 22085 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
22086 esac
22087done
5b813a60 22088$rm_try
b4eb6b3d
JH
22089EOS
22090postprocess_cc_v=''
22091chmod +x ccsym
22092$eunicefix ccsym
22093./ccsym > ccsym1.raw
22094if $test -s ccsym1.raw; then
22095 $sort ccsym1.raw | $uniq >ccsym.raw
22096else
22097 mv ccsym1.raw ccsym.raw
22098fi
22099
22100$awk '/\=/ { print $0; next }
22101 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
22102$comm -13 Cppsym.true ccsym.list >ccsym.own
22103$comm -12 Cppsym.true ccsym.list >ccsym.com
22104$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
22105also=''
22106if $test -z ccsym.raw; then
22107 echo "Your C compiler doesn't seem to define any symbols!" >&4
22108 echo " "
22109 echo "However, your C preprocessor defines the following symbols:"
22110 $cat Cppsym.true
22111 ccsymbols=''
22112 cppsymbols=`$cat Cppsym.true`
22113 cppsymbols=`echo $cppsymbols`
22114 cppccsymbols="$cppsymbols"
22115else
22116 if $test -s ccsym.com; then
22117 echo "Your C compiler and pre-processor define these symbols:"
22118 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22119 also='also '
22120 symbols='ones'
22121 cppccsymbols=`$cat ccsym.com`
22122 cppccsymbols=`echo $cppccsymbols`
22123 $test "$silent" || sleep 1
22124 fi
22125 if $test -s ccsym.cpp; then
22126 $test "$also" && echo " "
22127 echo "Your C pre-processor ${also}defines the following symbols:"
22128 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22129 also='further '
22130 cppsymbols=`$cat ccsym.cpp`
22131 cppsymbols=`echo $cppsymbols`
22132 $test "$silent" || sleep 1
22133 fi
22134 if $test -s ccsym.own; then
22135 $test "$also" && echo " "
22136 echo "Your C compiler ${also}defines the following cpp symbols:"
22137 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22138 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22139 ccsymbols=`$cat ccsym.own`
22140 ccsymbols=`echo $ccsymbols`
22141 $test "$silent" || sleep 1
22142 fi
22143fi
b4eb6b3d
JH
22144
22145: see if this is a termio system
22146val="$undef"
22147val2="$undef"
22148val3="$undef"
22149if $test `./findhdr termios.h`; then
22150 set tcsetattr i_termios
22151 eval $inlibc
22152 val3="$i_termios"
22153fi
22154echo " "
22155case "$val3" in
22156"$define") echo "You have POSIX termios.h... good!" >&4;;
22157*) if ./Cppsym pyr; then
22158 case "`/bin/universe`" in
22159 ucb) if $test `./findhdr sgtty.h`; then
22160 val2="$define"
22161 echo "<sgtty.h> found." >&4
22162 else
22163 echo "System is pyramid with BSD universe."
216dac04 22164 ./warn "<sgtty.h> not found--you could have problems."
b4eb6b3d
JH
22165 fi;;
22166 *) if $test `./findhdr termio.h`; then
22167 val="$define"
22168 echo "<termio.h> found." >&4
22169 else
22170 echo "System is pyramid with USG universe."
216dac04 22171 ./warn "<termio.h> not found--you could have problems."
b4eb6b3d
JH
22172 fi;;
22173 esac
22174 elif ./usg; then
22175 if $test `./findhdr termio.h`; then
22176 echo "<termio.h> found." >&4
22177 val="$define"
22178 elif $test `./findhdr sgtty.h`; then
22179 echo "<sgtty.h> found." >&4
22180 val2="$define"
22181 else
216dac04 22182 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
b4eb6b3d
JH
22183 fi
22184 else
22185 if $test `./findhdr sgtty.h`; then
22186 echo "<sgtty.h> found." >&4
22187 val2="$define"
22188 elif $test `./findhdr termio.h`; then
22189 echo "<termio.h> found." >&4
22190 val="$define"
22191 else
216dac04 22192 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
b4eb6b3d
JH
22193 fi
22194 fi;;
22195esac
22196set i_termio; eval $setvar
22197val=$val2; set i_sgtty; eval $setvar
22198val=$val3; set i_termios; eval $setvar
22199
bd31be4b 22200: see if stdbool is available
0dcb3d88
MB
22201: we want a real compile instead of Inhdr because some Solaris systems
22202: have stdbool.h, but it can only be used if the compiler indicates it
22203: is sufficiently c99-compliant.
22204echo " "
22205$cat >try.c <<EOCP
22206#include <stdio.h>
22207#include <stdbool.h>
22208int func(bool x)
22209{
22210 return x ? 1 : 0;
22211}
22212int main(int argc, char **argv)
22213{
22214 return func(0);
22215}
22216EOCP
22217set try
22218if eval $compile; then
22219 echo "<stdbool.h> found." >&4
22220 val="$define"
22221else
22222 echo "<stdbool.h> NOT found." >&4
22223 val="$undef"
22224fi
22225$rm_try
22226set i_stdbool
22227eval $setvar
bd31be4b 22228
b4eb6b3d
JH
22229: see if stddef is available
22230set stddef.h i_stddef
22231eval $inhdr
923fc586 22232
b4eb6b3d
JH
22233: see if sys/access.h is available
22234set sys/access.h i_sysaccess
22235eval $inhdr
22236
22237: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22238set sys/filio.h i_sysfilio
22239eval $inhdr
22240echo " "
22241if $test `./findhdr sys/ioctl.h`; then
22242 val="$define"
22243 echo '<sys/ioctl.h> found.' >&4
22244else
22245 val="$undef"
22246 if $test $i_sysfilio = "$define"; then
22247 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 22248 else
b4eb6b3d
JH
22249 $test $i_sgtty = "$define" && xxx="sgtty.h"
22250 $test $i_termio = "$define" && xxx="termio.h"
22251 $test $i_termios = "$define" && xxx="termios.h"
22252echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22253 fi
22254fi
22255set i_sysioctl
22256eval $setvar
22257
49a78c82
JH
22258: see if socket ioctl defs are in sys/sockio.h
22259echo " "
22260xxx=`./findhdr sys/sockio.h`
22261if $test "$xxx"; then
22262 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22263 val="$define"
22264 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22265 else
22266 val="$undef"
22267 echo "No socket ioctls found in <sys/sockio.h>." >&4
22268 fi
22269else
22270 val="$undef"
22271 $cat <<EOM
22272<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22273EOM
22274fi
22275set i_syssockio
22276eval $setvar
22277
b4eb6b3d
JH
22278: see if this is a syslog.h system
22279set syslog.h i_syslog
22280eval $inhdr
22281
b4eb6b3d
JH
22282: see if this is a sys/mode.h system
22283set sys/mode.h i_sysmode
22284eval $inhdr
22285
216dac04
MB
22286: see if there is a sys/poll.h file
22287set sys/poll.h i_syspoll
22288eval $inhdr
22289
b4eb6b3d
JH
22290: see if sys/resource.h has to be included
22291set sys/resource.h i_sysresrc
22292eval $inhdr
22293
22294: see if sys/security.h is available
22295set sys/security.h i_syssecrt
22296eval $inhdr
22297
22298: see if this is a sys/statvfs.h system
22299set sys/statvfs.h i_sysstatvfs
22300eval $inhdr
22301
b4eb6b3d
JH
22302: see if this is a sys/un.h system
22303set sys/un.h i_sysun
22304eval $inhdr
22305
b4eb6b3d
JH
22306: see if this is a sys/utsname.h system
22307set sys/utsname.h i_sysutsname
22308eval $inhdr
22309
22310: see if this is a syswait system
22311set sys/wait.h i_syswait
22312eval $inhdr
22313
22314: see if this is a ustat.h system
22315set ustat.h i_ustat
22316eval $inhdr
22317
22318: see if this is an utime system
22319set utime.h i_utime
22320eval $inhdr
22321
b4eb6b3d
JH
22322: see if this is a vfork system
22323case "$d_vfork" in
22324"$define")
22325 set vfork.h i_vfork
22326 eval $inhdr
22327 ;;
22328*)
22329 i_vfork="$undef"
22330 ;;
22331esac
22332
613d6c3e 22333: Check extensions
b4eb6b3d
JH
22334echo " "
22335echo "Looking for extensions..." >&4
22336: If we are using the old config.sh, known_extensions may contain
22337: old or inaccurate or duplicate values.
22338known_extensions=''
22339nonxs_extensions=''
22340: We do not use find because it might not be available.
22341: We do not just use MANIFEST because the user may have dropped
22342: some additional extensions into the source tree and expect them
22343: to be built.
22344
38fddf8b
MB
22345: Function to recursively find available extensions, ignoring DynaLoader
22346: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
4cc80fc4 22347: In 5.10.1 and later, extensions are stored in directories
88a6f4fc 22348: like File-Glob instead of the older File/Glob/.
b4eb6b3d
JH
22349find_extensions='
22350 for xxx in *; do
822a6ee0
MB
22351 case "$xxx" in
22352 DynaLoader|dynaload) ;;
22353 *)
238a6851
NC
22354 this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22355 leaf=`echo $xxx | $sed -e s/.*-//`;
dd6c21be 22356 if $test -d File; then
38fddf8b
MB
22357 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22358 known_extensions="$known_extensions $1$this_ext";
22359 elif $test -f $xxx/Makefile.PL; then
22360 nonxs_extensions="$nonxs_extensions $1$this_ext";
22361 else
22362 if $test -d $xxx -a $# -lt 10; then
22363 set $1$xxx/ $*;
22364 cd "$xxx";
22365 eval $find_extensions;
22366 cd ..;
22367 shift;
22368 fi;
22369 fi;
dd6c21be 22370 else
86429348
NC
22371 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22372 if $contains " $this_ext " $$.tmp; then
01db32e2 22373 echo >&4;
86429348
NC
22374 echo "Duplicate directories detected for extension $xxx" >&4;
22375 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22376 case "$knowitall" in
22377 "") dflt=y;;
22378 *) dflt=n;;
22379 esac;
22380 . ../UU/myread;
22381 case "$ans" in
22382 n*|N*) ;;
01db32e2
NC
22383 *) echo >&4;
22384 echo "Ok. Stopping Configure." >&4;
86429348
NC
22385 echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
22386 exit 1;;
22387 esac;
22388 echo "Ok. You will need to correct config.sh before running make." >&4;
22389 fi;
dd6c21be
NC
22390 $ls -1 $xxx > $$.tmp;
22391 if $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22392 known_extensions="$known_extensions $this_ext";
22393 elif $contains "\.c$" $$.tmp > /dev/null 2>&1; then
22394 known_extensions="$known_extensions $this_ext";
dd6c21be
NC
22395 elif $test -d $xxx; then
22396 nonxs_extensions="$nonxs_extensions $this_ext";
22397 fi;
22398 $rm -f $$.tmp;
822a6ee0
MB
22399 fi
22400 ;;
22401 esac;
b4eb6b3d
JH
22402 done'
22403tdir=`pwd`
dd6c21be
NC
22404cd "$rsrc/cpan"
22405set X
22406shift
22407eval $find_extensions
a193a2db
NC
22408cd "$rsrc/dist"
22409set X
22410shift
22411eval $find_extensions
6904989c 22412cd "$rsrc/ext"
b4eb6b3d
JH
22413set X
22414shift
22415eval $find_extensions
38fddf8b
MB
22416if $test -d File-Glob; then
22417 : All ext/ flattened
22418else
22419 # Special case: Add in modules that nest beyond the first level.
22420 # Currently threads/shared and Hash/Util/FieldHash, since they are
22421 # not picked up by the recursive find above (and adding in general
22422 # recursive finding breaks SDBM_File/sdbm).
22423 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22424 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22425fi
faae14e6
MB
22426set X $known_extensions
22427shift
a32b3e13 22428known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
b4eb6b3d
JH
22429set X $nonxs_extensions
22430shift
a32b3e13 22431nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
6904989c 22432cd "$tdir"
b4eb6b3d
JH
22433
22434: Now see which are supported on this system.
22435avail_ext=''
22436for xxx in $known_extensions ; do
22437 case "$xxx" in
22438 DB_File|db_file)
22439 case "$i_db" in
22440 $define) avail_ext="$avail_ext $xxx" ;;
22441 esac
22442 ;;
22443 GDBM_File|gdbm_fil)
7c345082 22444 case "$i_gdbm" in
b4eb6b3d
JH
22445 $define) avail_ext="$avail_ext $xxx" ;;
22446 esac
22447 ;;
1d59c593 22448 I18N/Langinfo|i18n_lan)
7c345082 22449 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
22450 $define$define) avail_ext="$avail_ext $xxx" ;;
22451 esac
22452 ;;
7978b0db
JH
22453 IPC/SysV|ipc/sysv)
22454 : XXX Do we need a useipcsysv variable here
22455 case "${d_msg}${d_sem}${d_shm}" in
22456 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22457 esac
22458 ;;
b4eb6b3d 22459 NDBM_File|ndbm_fil)
7894ad66 22460 case "$d_ndbm" in
b4eb6b3d
JH
22461 $define)
22462 case "$osname-$use64bitint" in
0be9fa5d 22463 hpux-define)
b4eb6b3d
JH
22464 case "$libs" in
22465 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22466 esac
22467 ;;
22468 *) avail_ext="$avail_ext $xxx" ;;
22469 esac
22470 ;;
22471 esac
22472 ;;
7c345082 22473 ODBM_File|odbm_fil)
b4eb6b3d
JH
22474 case "${i_dbm}${i_rpcsvcdbm}" in
22475 *"${define}"*)
7978b0db
JH
22476 case "$d_cplusplus" in
22477 define) ;; # delete as a function name will not work
22478 *) case "$osname-$use64bitint" in
22479 hpux-define)
22480 case "$libs" in
22481 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22482 esac
22483 ;;
22484 *) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
22485 esac
22486 ;;
b4eb6b3d
JH
22487 esac
22488 ;;
22489 esac
22490 ;;
7978b0db
JH
22491 Opcode|opcode)
22492 case "$useopcode" in
b4eb6b3d
JH
22493 true|define|y) avail_ext="$avail_ext $xxx" ;;
22494 esac
22495 ;;
7978b0db
JH
22496 POSIX|posix)
22497 case "$useposix" in
b4eb6b3d
JH
22498 true|define|y) avail_ext="$avail_ext $xxx" ;;
22499 esac
22500 ;;
22501 Socket|socket)
7c345082 22502 case "$d_socket" in
232083c0 22503 true|$define|y) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
22504 esac
22505 ;;
22506 Sys/Syslog|sys/syslog)
22507 : XXX syslog requires socket
7c345082 22508 case "$d_socket" in
b4eb6b3d
JH
22509 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22510 esac
22511 ;;
22512 Thread|thread)
b00ec89b
AB
22513 case "$usethreads" in
22514 true|$define|y)
47f9f84c 22515 case "$use5005threads" in
3f30fabf 22516 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
b00ec89b 22517 esac
b4eb6b3d
JH
22518 esac
22519 ;;
7978b0db
JH
22520 threads|threads/shared)
22521 # threads and threads::shared are special cases.
22522 # To stop people from asking "Perl 5.8.0 was supposed
22523 # to have this new fancy threads implementation but my
22524 # perl doesn't have it" and from people trying to
22525 # (re)install the threads module using CPAN.pm and
22526 # CPAN.pm then offering to reinstall Perl 5.8.0,
22527 # the threads.pm and threads/shared.pm will always be
22528 # there, croaking informatively ("you need to rebuild
22529 # all of Perl with threads, sorry") when threads haven't
22530 # been compiled in.
22531 # --jhi
22532 avail_ext="$avail_ext $xxx"
22533 ;;
aefe3e7e
NC
22534 VMS*)
22535 ;;
78ff2d7b 22536 Win32*)
b149d92d
JD
22537 case "$osname" in
22538 cygwin) avail_ext="$avail_ext $xxx" ;;
22539 esac
22540 ;;
f9b6ed1c
AD
22541 XS/APItest|xs/apitest)
22542 # This is just for testing. Skip it unless we have dynamic loading.
88e1f1a2
JV
22543
22544 case "$usedl" in
22545 $define) avail_ext="$avail_ext $xxx" ;;
22546 esac
22547 ;;
f9b6ed1c
AD
22548 XS/Typemap|xs/typemap)
22549 # This is just for testing. Skip it unless we have dynamic loading.
22550 case "$usedl" in
22551 $define) avail_ext="$avail_ext $xxx" ;;
22552 esac
22553 ;;
b4eb6b3d 22554 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
22555 ;;
22556 esac
b4eb6b3d 22557done
5f80c64f 22558
b4eb6b3d
JH
22559set X $avail_ext
22560shift
22561avail_ext="$*"
5f80c64f 22562
ef0c5be8
JH
22563case "$onlyextensions" in
22564'') ;;
22565*) keepextensions=''
cd95ead5 22566 echo "You have requested that only certain extensions be included..." >&4
ef0c5be8
JH
22567 for i in $onlyextensions; do
22568 case " $avail_ext " in
22569 *" $i "*)
22570 echo "Keeping extension $i."
22571 keepextensions="$keepextensions $i"
22572 ;;
22573 *) echo "Ignoring extension $i." ;;
22574 esac
22575 done
22576 avail_ext="$keepextensions"
22577 ;;
22578esac
22579
22580case "$noextensions" in
22581'') ;;
22582*) keepextensions=''
22583 echo "You have requested that certain extensions be ignored..." >&4
22584 for i in $avail_ext; do
c3dadc13
AD
22585 case " $noextensions " in
22586 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
22587 *) echo "Keeping extension $i.";
22588 keepextensions="$keepextensions $i"
22589 ;;
22590 esac
22591 done
22592 avail_ext="$keepextensions"
22593 ;;
22594esac
22595
b4eb6b3d
JH
22596: Now see which nonxs extensions are supported on this system.
22597: For now assume all are.
22598nonxs_ext=''
22599for xxx in $nonxs_extensions ; do
22600 case "$xxx" in
22601 *) nonxs_ext="$nonxs_ext $xxx"
22602 ;;
22603 esac
22604done
5f80c64f 22605
b4eb6b3d
JH
22606set X $nonxs_ext
22607shift
22608nonxs_ext="$*"
22609
22610case $usedl in
22611$define)
22612 $cat <<EOM
22613A number of extensions are supplied with $package. You may choose to
22614compile these extensions for dynamic loading (the default), compile
22615them into the $package executable (static loading), or not include
22616them at all. Answer "none" to include no extensions.
22617Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
22618
22619EOM
b4eb6b3d 22620 case "$dynamic_ext" in
736accd3
YST
22621 '')
22622 : Exclude those listed in static_ext
22623 dflt=''
22624 for xxx in $avail_ext; do
22625 case " $static_ext " in
22626 *" $xxx "*) ;;
22627 *) dflt="$dflt $xxx" ;;
22628 esac
22629 done
22630 set X $dflt
22631 shift
22632 dflt="$*"
22633 ;;
b4eb6b3d
JH
22634 *) dflt="$dynamic_ext"
22635 # Perhaps we are reusing an old out-of-date config.sh.
22636 case "$hint" in
22637 previous)
22638 if test X"$dynamic_ext" != X"$avail_ext"; then
22639 $cat <<EOM
7c345082
RGS
22640NOTICE: Your previous config.sh list may be incorrect.
22641The extensions now available to you are
b4eb6b3d
JH
22642 ${avail_ext}
22643but the default list from your previous config.sh is
7c345082 22644 ${dynamic_ext}
9c839522 22645
b4eb6b3d
JH
22646EOM
22647 fi
9c839522
PM
22648 ;;
22649 esac
b4eb6b3d
JH
22650 ;;
22651 esac
5f80c64f 22652 case "$dflt" in
b4eb6b3d
JH
22653 '') dflt=none;;
22654 esac
22655 rp="What extensions do you wish to load dynamically?"
22656 . ./myread
22657 case "$ans" in
22658 none) dynamic_ext=' ' ;;
22659 *) dynamic_ext="$ans" ;;
5f80c64f 22660 esac
5f80c64f 22661
b4eb6b3d
JH
22662 case "$static_ext" in
22663 '')
22664 : Exclude those already listed in dynamic linking
22665 dflt=''
22666 for xxx in $avail_ext; do
22667 case " $dynamic_ext " in
22668 *" $xxx "*) ;;
22669 *) dflt="$dflt $xxx" ;;
22670 esac
22671 done
22672 set X $dflt
22673 shift
22674 dflt="$*"
22675 ;;
7c345082 22676 *) dflt="$static_ext"
b4eb6b3d
JH
22677 ;;
22678 esac
9c839522 22679
b4eb6b3d
JH
22680 case "$dflt" in
22681 '') dflt=none;;
22682 esac
22683 rp="What extensions do you wish to load statically?"
22684 . ./myread
22685 case "$ans" in
22686 none) static_ext=' ' ;;
22687 *) static_ext="$ans" ;;
22688 esac
22689 ;;
22690*)
22691 $cat <<EOM
7c345082
RGS
22692A number of extensions are supplied with $package. Answer "none"
22693to include no extensions.
b4eb6b3d 22694Note that DynaLoader is always built and need not be mentioned here.
9c839522 22695
b4eb6b3d
JH
22696EOM
22697 case "$static_ext" in
22698 '') dflt="$avail_ext" ;;
22699 *) dflt="$static_ext"
22700 # Perhaps we are reusing an old out-of-date config.sh.
22701 case "$hint" in
22702 previous)
22703 if test X"$static_ext" != X"$avail_ext"; then
22704 $cat <<EOM
7c345082
RGS
22705NOTICE: Your previous config.sh list may be incorrect.
22706The extensions now available to you are
b4eb6b3d
JH
22707 ${avail_ext}
22708but the default list from your previous config.sh is
7c345082 22709 ${static_ext}
5f80c64f
JH
22710
22711EOM
b4eb6b3d
JH
22712 fi
22713 ;;
22714 esac
22715 ;;
22716 esac
22717 : Exclude those that are not xs extensions
22718 case "$dflt" in
22719 '') dflt=none;;
22720 esac
22721 rp="What extensions do you wish to include?"
22722 . ./myread
22723 case "$ans" in
22724 none) static_ext=' ' ;;
22725 *) static_ext="$ans" ;;
22726 esac
22727 ;;
5f80c64f 22728esac
7c345082 22729#
f1f6834f
AD
22730# Encode is a special case. If we are building Encode as a static
22731# extension, we need to explicitly list its subextensions as well.
22732# For other nested extensions, this is handled automatically by
22733# the appropriate Makefile.PL.
22734case " $static_ext " in
22735 *" Encode "*) # Add the subextensions of Encode
d9a4b459 22736 cd "$rsrc/cpan"
f1f6834f
AD
22737 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22738 static_ext="$static_ext Encode/$xxx"
22739 done
22740 cd "$tdir"
22741 ;;
22742esac
5f80c64f 22743
b4eb6b3d
JH
22744set X $dynamic_ext $static_ext $nonxs_ext
22745shift
22746extensions="$*"
22747
93a2cd18
AD
22748# Sanity check: We require an extension suitable for use with
22749# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
22750# should show up as failures in the test suite, but it's helpful to
22751# catch them now.) The 'extensions' list is normally sorted
22752# alphabetically, so we need to accept either
22753# DB_File ... Fcntl ... IO ....
22754# or something like
22755# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
22756case " $extensions" in
22757*"_File "*" Fcntl "*" IO "*) ;; # DB_File
22758*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22759*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
22760*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22761 echo "WARNING: The Perl you are building will be quite crippled." >& 4
22762 ;;
22763esac
22764
9c839522
PM
22765: Remove libraries needed only for extensions
22766: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
22767: The exception is SunOS 4.x, which needs them.
22768case "${osname}X${osvers}" in
22769sunos*X4*)
22770 perllibs="$libs"
22771 ;;
22772*) case "$usedl" in
22773 $define|true|[yY]*)
a33f2d9f 22774 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
eedaba54
PM
22775 shift
22776 perllibs="$*"
22777 ;;
22778 *) perllibs="$libs"
22779 ;;
22780 esac
22781 ;;
9c839522 22782esac
5f80c64f
JH
22783
22784: Remove build directory name from cppstdin so it can be used from
22785: either the present location or the final installed location.
22786echo " "
22787: Get out of the UU directory to get correct path name.
22788cd ..
22789case "$cppstdin" in
22790`pwd`/cppstdin)
22791 echo "Stripping down cppstdin path name"
22792 cppstdin=cppstdin
22793 ;;
22794esac
22795cd UU
22796
22797: end of configuration questions
22798echo " "
22799echo "End of configuration questions."
22800echo " "
22801
22802: back to where it started
22803if test -d ../UU; then
22804 cd ..
22805fi
22806
776a38e3 22807: configuration may be unconditionally patched via a 'config.arch' file
48370efc 22808if $test -f config.arch; then
776a38e3 22809 echo "I see a config.arch file, loading it." >&4
48370efc
JH
22810 . ./config.arch
22811fi
22812
5f80c64f
JH
22813: configuration may be patched via a 'config.over' file
22814if $test -f config.over; then
22815 echo " "
22816 dflt=y
22817 rp='I see a config.over file. Do you wish to load it?'
22818 . UU/myread
22819 case "$ans" in
22820 n*) echo "OK, I'll ignore it.";;
22821 *) . ./config.over
22822 echo "Configuration override changes have been loaded."
22823 ;;
22824 esac
22825fi
22826
22827: in case they want portability, strip down executable paths
22828case "$d_portable" in
22829"$define")
22830 echo " "
22831 echo "Stripping down executable paths..." >&4
22832 for file in $loclist $trylist; do
534ac15a
JH
22833 eval temp=\$$file
22834 eval $file=`basename $temp`
5f80c64f
JH
22835 done
22836 ;;
22837esac
22838
22839: create config.sh file
22840echo " "
22841echo "Creating config.sh..." >&4
22842$spitshell <<EOT >config.sh
22843$startsh
22844#
22845# This file was produced by running the Configure script. It holds all the
22846# definitions figured out by Configure. Should you modify one of these values,
22847# do not forget to propagate your changes by running "Configure -der". You may
22848# instead choose to run each of the .SH files by yourself, or "Configure -S".
22849#
22850
22851# Package name : $package
22852# Source directory : $src
22853# Configuration time: $cf_time
22854# Configured by : $cf_by
22855# Target system : $myuname
22856
776a38e3 22857EOT
94a9a4bc 22858: Add in command line options if available
776a38e3 22859$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
94a9a4bc 22860
776a38e3
MB
22861$spitshell <<EOT >>config.sh
22862
5f80c64f
JH
22863Author='$Author'
22864Date='$Date'
22865Header='$Header'
22866Id='$Id'
22867Locker='$Locker'
22868Log='$Log'
5f80c64f
JH
22869RCSfile='$RCSfile'
22870Revision='$Revision'
22871Source='$Source'
22872State='$State'
22873_a='$_a'
22874_exe='$_exe'
22875_o='$_o'
b4eb6b3d 22876afs='$afs'
a6d26a0d 22877afsroot='$afsroot'
b4eb6b3d
JH
22878alignbytes='$alignbytes'
22879ansi2knr='$ansi2knr'
22880aphostname='$aphostname'
22881api_revision='$api_revision'
22882api_subversion='$api_subversion'
22883api_version='$api_version'
22884api_versionstring='$api_versionstring'
5f80c64f 22885ar='$ar'
b4eb6b3d
JH
22886archlib='$archlib'
22887archlibexp='$archlibexp'
22888archname64='$archname64'
22889archname='$archname'
5f80c64f 22890archobjs='$archobjs'
10bc17b6 22891asctime_r_proto='$asctime_r_proto'
5f80c64f 22892awk='$awk'
b4eb6b3d 22893baserev='$baserev'
5f80c64f 22894bash='$bash'
b4eb6b3d 22895bin='$bin'
f1ce3bf1 22896bin_ELF='$bin_ELF'
b4eb6b3d 22897binexp='$binexp'
5f80c64f 22898bison='$bison'
9d1a8da0 22899bootstrap_charset='$bootstrap_charset'
5f80c64f 22900byacc='$byacc'
b4eb6b3d 22901byteorder='$byteorder'
5f80c64f 22902c='$c'
b4eb6b3d 22903castflags='$castflags'
5f80c64f
JH
22904cat='$cat'
22905cc='$cc'
22906cccdlflags='$cccdlflags'
22907ccdlflags='$ccdlflags'
22908ccflags='$ccflags'
b4eb6b3d 22909ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 22910ccname='$ccname'
b4eb6b3d 22911ccsymbols='$ccsymbols'
6b356c8e 22912ccversion='$ccversion'
5f80c64f 22913cf_by='$cf_by'
b4eb6b3d 22914cf_email='$cf_email'
5f80c64f 22915cf_time='$cf_time'
c193ef60
MB
22916charbits='$charbits'
22917charsize='$charsize'
5f80c64f
JH
22918chgrp='$chgrp'
22919chmod='$chmod'
22920chown='$chown'
b4eb6b3d 22921clocktype='$clocktype'
5f80c64f
JH
22922comm='$comm'
22923compress='$compress'
22924contains='$contains'
22925cp='$cp'
22926cpio='$cpio'
22927cpp='$cpp'
b4eb6b3d
JH
22928cpp_stuff='$cpp_stuff'
22929cppccsymbols='$cppccsymbols'
5f80c64f
JH
22930cppflags='$cppflags'
22931cpplast='$cpplast'
22932cppminus='$cppminus'
22933cpprun='$cpprun'
22934cppstdin='$cppstdin'
b4eb6b3d 22935cppsymbols='$cppsymbols'
10bc17b6 22936crypt_r_proto='$crypt_r_proto'
b4eb6b3d 22937cryptlib='$cryptlib'
5f80c64f 22938csh='$csh'
10bc17b6
JH
22939ctermid_r_proto='$ctermid_r_proto'
22940ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
22941d_Gconvert='$d_Gconvert'
22942d_PRIEUldbl='$d_PRIEUldbl'
22943d_PRIFUldbl='$d_PRIFUldbl'
22944d_PRIGUldbl='$d_PRIGUldbl'
22945d_PRIXU64='$d_PRIXU64'
22946d_PRId64='$d_PRId64'
22947d_PRIeldbl='$d_PRIeldbl'
22948d_PRIfldbl='$d_PRIfldbl'
22949d_PRIgldbl='$d_PRIgldbl'
22950d_PRIi64='$d_PRIi64'
22951d_PRIo64='$d_PRIo64'
22952d_PRIu64='$d_PRIu64'
22953d_PRIx64='$d_PRIx64'
22954d_SCNfldbl='$d_SCNfldbl'
74cac757 22955d__fwalk='$d__fwalk'
b4eb6b3d
JH
22956d_access='$d_access'
22957d_accessx='$d_accessx'
55954f19 22958d_aintl='$d_aintl'
b4eb6b3d
JH
22959d_alarm='$d_alarm'
22960d_archlib='$d_archlib'
96938616 22961d_asctime64='$d_asctime64'
10bc17b6 22962d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
22963d_atolf='$d_atolf'
22964d_atoll='$d_atoll'
fcdf39cf 22965d_attribute_deprecated='$d_attribute_deprecated'
0dbb1585
AL
22966d_attribute_format='$d_attribute_format'
22967d_attribute_malloc='$d_attribute_malloc'
22968d_attribute_nonnull='$d_attribute_nonnull'
22969d_attribute_noreturn='$d_attribute_noreturn'
22970d_attribute_pure='$d_attribute_pure'
22971d_attribute_unused='$d_attribute_unused'
22972d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
22973d_bcmp='$d_bcmp'
22974d_bcopy='$d_bcopy'
5f80c64f 22975d_bsd='$d_bsd'
b4eb6b3d
JH
22976d_bsdgetpgrp='$d_bsdgetpgrp'
22977d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
22978d_builtin_choose_expr='$d_builtin_choose_expr'
22979d_builtin_expect='$d_builtin_expect'
b4eb6b3d 22980d_bzero='$d_bzero'
a2d23ec2 22981d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
22982d_casti32='$d_casti32'
22983d_castneg='$d_castneg'
22984d_charvspr='$d_charvspr'
22985d_chown='$d_chown'
22986d_chroot='$d_chroot'
22987d_chsize='$d_chsize'
758a5d79 22988d_class='$d_class'
b0a2e8e6 22989d_clearenv='$d_clearenv'
b4eb6b3d 22990d_closedir='$d_closedir'
4e0554ec 22991d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 22992d_const='$d_const'
55954f19 22993d_copysignl='$d_copysignl'
666ea192 22994d_cplusplus='$d_cplusplus'
b4eb6b3d 22995d_crypt='$d_crypt'
10bc17b6 22996d_crypt_r='$d_crypt_r'
b4eb6b3d 22997d_csh='$d_csh'
13cfc98d 22998d_ctermid='$d_ctermid'
10bc17b6 22999d_ctermid_r='$d_ctermid_r'
96938616 23000d_ctime64='$d_ctime64'
10bc17b6 23001d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
23002d_cuserid='$d_cuserid'
23003d_dbl_dig='$d_dbl_dig'
2ef53570 23004d_dbminitproto='$d_dbminitproto'
96938616 23005d_difftime64='$d_difftime64'
b4eb6b3d 23006d_difftime='$d_difftime'
de52168c 23007d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 23008d_dirfd='$d_dirfd'
b4eb6b3d
JH
23009d_dirnamlen='$d_dirnamlen'
23010d_dlerror='$d_dlerror'
5f80c64f 23011d_dlopen='$d_dlopen'
b4eb6b3d
JH
23012d_dlsymun='$d_dlsymun'
23013d_dosuid='$d_dosuid'
10bc17b6 23014d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
23015d_drand48proto='$d_drand48proto'
23016d_dup2='$d_dup2'
23017d_eaccess='$d_eaccess'
23018d_endgrent='$d_endgrent'
10bc17b6 23019d_endgrent_r='$d_endgrent_r'
b4eb6b3d 23020d_endhent='$d_endhent'
10bc17b6 23021d_endhostent_r='$d_endhostent_r'
b4eb6b3d 23022d_endnent='$d_endnent'
10bc17b6 23023d_endnetent_r='$d_endnetent_r'
b4eb6b3d 23024d_endpent='$d_endpent'
10bc17b6 23025d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 23026d_endpwent='$d_endpwent'
10bc17b6 23027d_endpwent_r='$d_endpwent_r'
b4eb6b3d 23028d_endsent='$d_endsent'
10bc17b6 23029d_endservent_r='$d_endservent_r'
b4eb6b3d 23030d_eofnblk='$d_eofnblk'
5f80c64f 23031d_eunice='$d_eunice'
15b61c98 23032d_faststdio='$d_faststdio'
b363b713 23033d_fchdir='$d_fchdir'
b4eb6b3d
JH
23034d_fchmod='$d_fchmod'
23035d_fchown='$d_fchown'
23036d_fcntl='$d_fcntl'
9d9004a9 23037d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
23038d_fd_macros='$d_fd_macros'
23039d_fd_set='$d_fd_set'
23040d_fds_bits='$d_fds_bits'
23041d_fgetpos='$d_fgetpos'
758a5d79
JH
23042d_finite='$d_finite'
23043d_finitel='$d_finitel'
b4eb6b3d
JH
23044d_flexfnam='$d_flexfnam'
23045d_flock='$d_flock'
2ef53570 23046d_flockproto='$d_flockproto'
b4eb6b3d 23047d_fork='$d_fork'
758a5d79 23048d_fp_class='$d_fp_class'
b4eb6b3d 23049d_fpathconf='$d_fpathconf'
758a5d79
JH
23050d_fpclass='$d_fpclass'
23051d_fpclassify='$d_fpclassify'
23052d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
23053d_fpos64_t='$d_fpos64_t'
23054d_frexpl='$d_frexpl'
23055d_fs_data_s='$d_fs_data_s'
23056d_fseeko='$d_fseeko'
23057d_fsetpos='$d_fsetpos'
23058d_fstatfs='$d_fstatfs'
23059d_fstatvfs='$d_fstatvfs'
411ab01c 23060d_fsync='$d_fsync'
b4eb6b3d
JH
23061d_ftello='$d_ftello'
23062d_ftime='$d_ftime'
dc814df1 23063d_futimes='$d_futimes'
e74475c7
MHM
23064d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23065d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
5086dff9 23066d_getaddrinfo='$d_getaddrinfo'
b4eb6b3d
JH
23067d_getcwd='$d_getcwd'
23068d_getespwnam='$d_getespwnam'
23069d_getfsstat='$d_getfsstat'
23070d_getgrent='$d_getgrent'
10bc17b6
JH
23071d_getgrent_r='$d_getgrent_r'
23072d_getgrgid_r='$d_getgrgid_r'
23073d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
23074d_getgrps='$d_getgrps'
23075d_gethbyaddr='$d_gethbyaddr'
23076d_gethbyname='$d_gethbyname'
23077d_gethent='$d_gethent'
23078d_gethname='$d_gethname'
10bc17b6
JH
23079d_gethostbyaddr_r='$d_gethostbyaddr_r'
23080d_gethostbyname_r='$d_gethostbyname_r'
23081d_gethostent_r='$d_gethostent_r'
b4eb6b3d 23082d_gethostprotos='$d_gethostprotos'
4e0554ec 23083d_getitimer='$d_getitimer'
b4eb6b3d 23084d_getlogin='$d_getlogin'
10bc17b6 23085d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
23086d_getmnt='$d_getmnt'
23087d_getmntent='$d_getmntent'
5086dff9 23088d_getnameinfo='$d_getnameinfo'
b4eb6b3d
JH
23089d_getnbyaddr='$d_getnbyaddr'
23090d_getnbyname='$d_getnbyname'
23091d_getnent='$d_getnent'
10bc17b6
JH
23092d_getnetbyaddr_r='$d_getnetbyaddr_r'
23093d_getnetbyname_r='$d_getnetbyname_r'
23094d_getnetent_r='$d_getnetent_r'
b4eb6b3d 23095d_getnetprotos='$d_getnetprotos'
0c0643d0 23096d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
23097d_getpbyname='$d_getpbyname'
23098d_getpbynumber='$d_getpbynumber'
23099d_getpent='$d_getpent'
23100d_getpgid='$d_getpgid'
23101d_getpgrp2='$d_getpgrp2'
23102d_getpgrp='$d_getpgrp'
23103d_getppid='$d_getppid'
23104d_getprior='$d_getprior'
10bc17b6
JH
23105d_getprotobyname_r='$d_getprotobyname_r'
23106d_getprotobynumber_r='$d_getprotobynumber_r'
23107d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
23108d_getprotoprotos='$d_getprotoprotos'
23109d_getprpwnam='$d_getprpwnam'
23110d_getpwent='$d_getpwent'
10bc17b6
JH
23111d_getpwent_r='$d_getpwent_r'
23112d_getpwnam_r='$d_getpwnam_r'
23113d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
23114d_getsbyname='$d_getsbyname'
23115d_getsbyport='$d_getsbyport'
23116d_getsent='$d_getsent'
10bc17b6
JH
23117d_getservbyname_r='$d_getservbyname_r'
23118d_getservbyport_r='$d_getservbyport_r'
23119d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
23120d_getservprotos='$d_getservprotos'
23121d_getspnam='$d_getspnam'
10bc17b6 23122d_getspnam_r='$d_getspnam_r'
b4eb6b3d 23123d_gettimeod='$d_gettimeod'
96938616 23124d_gmtime64='$d_gmtime64'
10bc17b6 23125d_gmtime_r='$d_gmtime_r'
5f80c64f 23126d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
23127d_grpasswd='$d_grpasswd'
23128d_hasmntopt='$d_hasmntopt'
23129d_htonl='$d_htonl'
55954f19 23130d_ilogbl='$d_ilogbl'
f3f1a2d8 23131d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
23132d_index='$d_index'
23133d_inetaton='$d_inetaton'
5086dff9
MB
23134d_inetntop='$d_inetntop'
23135d_inetpton='$d_inetpton'
b4eb6b3d 23136d_int64_t='$d_int64_t'
122b9bf4 23137d_ip_mreq='$d_ip_mreq'
3e06601f 23138d_ip_mreq_source='$d_ip_mreq_source'
18126d98 23139d_ipv6_mreq='$d_ipv6_mreq'
3e06601f 23140d_ipv6_mreq_source='$d_ipv6_mreq_source'
b4eb6b3d 23141d_isascii='$d_isascii'
269a7913 23142d_isblank='$d_isblank'
758a5d79
JH
23143d_isfinite='$d_isfinite'
23144d_isinf='$d_isinf'
b4eb6b3d
JH
23145d_isnan='$d_isnan'
23146d_isnanl='$d_isnanl'
23147d_killpg='$d_killpg'
23148d_lchown='$d_lchown'
23149d_ldbl_dig='$d_ldbl_dig'
0a0abfba 23150d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 23151d_link='$d_link'
96938616 23152d_localtime64='$d_localtime64'
10bc17b6 23153d_localtime_r='$d_localtime_r'
8572b25d 23154d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
23155d_locconv='$d_locconv'
23156d_lockf='$d_lockf'
23157d_longdbl='$d_longdbl'
23158d_longlong='$d_longlong'
23159d_lseekproto='$d_lseekproto'
23160d_lstat='$d_lstat'
23161d_madvise='$d_madvise'
7dd121ae
MB
23162d_malloc_good_size='$d_malloc_good_size'
23163d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
23164d_mblen='$d_mblen'
23165d_mbstowcs='$d_mbstowcs'
23166d_mbtowc='$d_mbtowc'
23167d_memchr='$d_memchr'
23168d_memcmp='$d_memcmp'
23169d_memcpy='$d_memcpy'
23170d_memmove='$d_memmove'
23171d_memset='$d_memset'
23172d_mkdir='$d_mkdir'
23173d_mkdtemp='$d_mkdtemp'
23174d_mkfifo='$d_mkfifo'
23175d_mkstemp='$d_mkstemp'
23176d_mkstemps='$d_mkstemps'
96938616 23177d_mktime64='$d_mktime64'
b4eb6b3d
JH
23178d_mktime='$d_mktime'
23179d_mmap='$d_mmap'
23180d_modfl='$d_modfl'
e67aeab1 23181d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 23182d_modflproto='$d_modflproto'
b4eb6b3d
JH
23183d_mprotect='$d_mprotect'
23184d_msg='$d_msg'
23185d_msg_ctrunc='$d_msg_ctrunc'
23186d_msg_dontroute='$d_msg_dontroute'
23187d_msg_oob='$d_msg_oob'
23188d_msg_peek='$d_msg_peek'
23189d_msg_proxy='$d_msg_proxy'
23190d_msgctl='$d_msgctl'
23191d_msgget='$d_msgget'
4e0554ec 23192d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
23193d_msgrcv='$d_msgrcv'
23194d_msgsnd='$d_msgsnd'
23195d_msync='$d_msync'
23196d_munmap='$d_munmap'
23197d_mymalloc='$d_mymalloc'
a33f2d9f 23198d_ndbm='$d_ndbm'
e74475c7 23199d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
b4eb6b3d 23200d_nice='$d_nice'
2765b840 23201d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 23202d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 23203d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
23204d_off64_t='$d_off64_t'
23205d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23206d_oldpthreads='$d_oldpthreads'
23207d_oldsock='$d_oldsock'
23208d_open3='$d_open3'
23209d_pathconf='$d_pathconf'
23210d_pause='$d_pause'
23211d_perl_otherlibdirs='$d_perl_otherlibdirs'
23212d_phostname='$d_phostname'
23213d_pipe='$d_pipe'
23214d_poll='$d_poll'
5f80c64f 23215d_portable='$d_portable'
c796e3db
MB
23216d_prctl='$d_prctl'
23217d_prctl_set_name='$d_prctl_set_name'
dcb594bc 23218d_printf_format_null='$d_printf_format_null'
c7aff470 23219d_procselfexe='$d_procselfexe'
233e16ce 23220d_pseudofork='$d_pseudofork'
d6483fcc 23221d_pthread_atfork='$d_pthread_atfork'
58d975c3 23222d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
23223d_pthread_yield='$d_pthread_yield'
23224d_pwage='$d_pwage'
23225d_pwchange='$d_pwchange'
23226d_pwclass='$d_pwclass'
23227d_pwcomment='$d_pwcomment'
23228d_pwexpire='$d_pwexpire'
23229d_pwgecos='$d_pwgecos'
23230d_pwpasswd='$d_pwpasswd'
23231d_pwquota='$d_pwquota'
23232d_qgcvt='$d_qgcvt'
23233d_quad='$d_quad'
10bc17b6
JH
23234d_random_r='$d_random_r'
23235d_readdir64_r='$d_readdir64_r'
b4eb6b3d 23236d_readdir='$d_readdir'
10bc17b6 23237d_readdir_r='$d_readdir_r'
b4eb6b3d 23238d_readlink='$d_readlink'
4e0554ec
JH
23239d_readv='$d_readv'
23240d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
23241d_rename='$d_rename'
23242d_rewinddir='$d_rewinddir'
23243d_rmdir='$d_rmdir'
23244d_safebcpy='$d_safebcpy'
23245d_safemcpy='$d_safemcpy'
23246d_sanemcmp='$d_sanemcmp'
ef9f17be 23247d_sbrkproto='$d_sbrkproto'
55954f19 23248d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
23249d_sched_yield='$d_sched_yield'
23250d_scm_rights='$d_scm_rights'
23251d_seekdir='$d_seekdir'
23252d_select='$d_select'
23253d_sem='$d_sem'
23254d_semctl='$d_semctl'
23255d_semctl_semid_ds='$d_semctl_semid_ds'
23256d_semctl_semun='$d_semctl_semun'
23257d_semget='$d_semget'
23258d_semop='$d_semop'
4e0554ec 23259d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
23260d_setegid='$d_setegid'
23261d_seteuid='$d_seteuid'
23262d_setgrent='$d_setgrent'
10bc17b6 23263d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
23264d_setgrps='$d_setgrps'
23265d_sethent='$d_sethent'
10bc17b6 23266d_sethostent_r='$d_sethostent_r'
4e0554ec 23267d_setitimer='$d_setitimer'
b4eb6b3d
JH
23268d_setlinebuf='$d_setlinebuf'
23269d_setlocale='$d_setlocale'
10bc17b6 23270d_setlocale_r='$d_setlocale_r'
b4eb6b3d 23271d_setnent='$d_setnent'
10bc17b6 23272d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
23273d_setpent='$d_setpent'
23274d_setpgid='$d_setpgid'
23275d_setpgrp2='$d_setpgrp2'
23276d_setpgrp='$d_setpgrp'
23277d_setprior='$d_setprior'
23278d_setproctitle='$d_setproctitle'
10bc17b6 23279d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 23280d_setpwent='$d_setpwent'
10bc17b6 23281d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
23282d_setregid='$d_setregid'
23283d_setresgid='$d_setresgid'
23284d_setresuid='$d_setresuid'
23285d_setreuid='$d_setreuid'
23286d_setrgid='$d_setrgid'
23287d_setruid='$d_setruid'
23288d_setsent='$d_setsent'
10bc17b6 23289d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
23290d_setsid='$d_setsid'
23291d_setvbuf='$d_setvbuf'
23292d_sfio='$d_sfio'
23293d_shm='$d_shm'
23294d_shmat='$d_shmat'
23295d_shmatprototype='$d_shmatprototype'
23296d_shmctl='$d_shmctl'
23297d_shmdt='$d_shmdt'
23298d_shmget='$d_shmget'
23299d_sigaction='$d_sigaction'
ed140128 23300d_signbit='$d_signbit'
983dbef6 23301d_sigprocmask='$d_sigprocmask'
b4eb6b3d 23302d_sigsetjmp='$d_sigsetjmp'
f53580fe 23303d_sin6_scope_id='$d_sin6_scope_id'
c95d0e17 23304d_sitearch='$d_sitearch'
4f5da3e9 23305d_snprintf='$d_snprintf'
18126d98 23306d_sockaddr_in6='$d_sockaddr_in6'
b8677e3b 23307d_sockaddr_sa_len='$d_sockaddr_sa_len'
49a78c82 23308d_sockatmark='$d_sockatmark'
2ef53570 23309d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
23310d_socket='$d_socket'
23311d_socklen_t='$d_socklen_t'
23312d_sockpair='$d_sockpair'
23313d_socks5_init='$d_socks5_init'
360321b3 23314d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 23315d_sqrtl='$d_sqrtl'
10bc17b6
JH
23316d_srand48_r='$d_srand48_r'
23317d_srandom_r='$d_srandom_r'
eef837ea 23318d_sresgproto='$d_sresgproto'
640374d0 23319d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
23320d_statblks='$d_statblks'
23321d_statfs_f_flags='$d_statfs_f_flags'
23322d_statfs_s='$d_statfs_s'
17a6c8e3 23323d_static_inline='$d_static_inline'
b4eb6b3d
JH
23324d_statvfs='$d_statvfs'
23325d_stdio_cnt_lval='$d_stdio_cnt_lval'
23326d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
23327d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23328d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
23329d_stdio_stream_array='$d_stdio_stream_array'
23330d_stdiobase='$d_stdiobase'
23331d_stdstdio='$d_stdstdio'
23332d_strchr='$d_strchr'
23333d_strcoll='$d_strcoll'
23334d_strctcpy='$d_strctcpy'
23335d_strerrm='$d_strerrm'
23336d_strerror='$d_strerror'
10bc17b6 23337d_strerror_r='$d_strerror_r'
b3c85772 23338d_strftime='$d_strftime'
08c92000
MB
23339d_strlcat='$d_strlcat'
23340d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
23341d_strtod='$d_strtod'
23342d_strtol='$d_strtol'
23343d_strtold='$d_strtold'
23344d_strtoll='$d_strtoll'
28e5dec8 23345d_strtoq='$d_strtoq'
b4eb6b3d
JH
23346d_strtoul='$d_strtoul'
23347d_strtoull='$d_strtoull'
23348d_strtouq='$d_strtouq'
23349d_strxfrm='$d_strxfrm'
23350d_suidsafe='$d_suidsafe'
23351d_symlink='$d_symlink'
23352d_syscall='$d_syscall'
2ef53570 23353d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
23354d_sysconf='$d_sysconf'
23355d_sysernlst='$d_sysernlst'
23356d_syserrlst='$d_syserrlst'
23357d_system='$d_system'
23358d_tcgetpgrp='$d_tcgetpgrp'
23359d_tcsetpgrp='$d_tcsetpgrp'
23360d_telldir='$d_telldir'
23361d_telldirproto='$d_telldirproto'
23362d_time='$d_time'
cbb9e8a7 23363d_timegm='$d_timegm'
b4eb6b3d 23364d_times='$d_times'
14b90194
JH
23365d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23366d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 23367d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 23368d_truncate='$d_truncate'
10bc17b6 23369d_ttyname_r='$d_ttyname_r'
b4eb6b3d 23370d_tzname='$d_tzname'
4e0554ec
JH
23371d_u32align='$d_u32align'
23372d_ualarm='$d_ualarm'
b4eb6b3d
JH
23373d_umask='$d_umask'
23374d_uname='$d_uname'
23375d_union_semun='$d_union_semun'
758a5d79 23376d_unordered='$d_unordered'
bdf33aa7 23377d_unsetenv='$d_unsetenv'
4e0554ec 23378d_usleep='$d_usleep'
2ef53570 23379d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
23380d_ustat='$d_ustat'
23381d_vendorarch='$d_vendorarch'
23382d_vendorbin='$d_vendorbin'
23383d_vendorlib='$d_vendorlib'
6e1038e0 23384d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
23385d_vfork='$d_vfork'
23386d_void_closedir='$d_void_closedir'
23387d_voidsig='$d_voidsig'
23388d_voidtty='$d_voidtty'
23389d_volatile='$d_volatile'
23390d_vprintf='$d_vprintf'
4f5da3e9 23391d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
23392d_wait4='$d_wait4'
23393d_waitpid='$d_waitpid'
23394d_wcstombs='$d_wcstombs'
23395d_wctomb='$d_wctomb'
4e0554ec 23396d_writev='$d_writev'
5f80c64f
JH
23397d_xenix='$d_xenix'
23398date='$date'
b4eb6b3d
JH
23399db_hashtype='$db_hashtype'
23400db_prefixtype='$db_prefixtype'
640374d0
JH
23401db_version_major='$db_version_major'
23402db_version_minor='$db_version_minor'
23403db_version_patch='$db_version_patch'
b4eb6b3d
JH
23404defvoidused='$defvoidused'
23405direntrytype='$direntrytype'
23406dlext='$dlext'
5f80c64f 23407dlsrc='$dlsrc'
b4eb6b3d
JH
23408doublesize='$doublesize'
23409drand01='$drand01'
10bc17b6 23410drand48_r_proto='$drand48_r_proto'
5ac1e9b2 23411dtrace='$dtrace'
b4eb6b3d
JH
23412dynamic_ext='$dynamic_ext'
23413eagain='$eagain'
23414ebcdic='$ebcdic'
5f80c64f
JH
23415echo='$echo'
23416egrep='$egrep'
23417emacs='$emacs'
10bc17b6
JH
23418endgrent_r_proto='$endgrent_r_proto'
23419endhostent_r_proto='$endhostent_r_proto'
23420endnetent_r_proto='$endnetent_r_proto'
23421endprotoent_r_proto='$endprotoent_r_proto'
23422endpwent_r_proto='$endpwent_r_proto'
23423endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
23424eunicefix='$eunicefix'
23425exe_ext='$exe_ext'
23426expr='$expr'
b4eb6b3d 23427extensions='$extensions'
61c26d18 23428extern_C='$extern_C'
6fcddf3b 23429extras='$extras'
b4eb6b3d
JH
23430fflushNULL='$fflushNULL'
23431fflushall='$fflushall'
5f80c64f
JH
23432find='$find'
23433firstmakefile='$firstmakefile'
23434flex='$flex'
b4eb6b3d
JH
23435fpossize='$fpossize'
23436fpostype='$fpostype'
23437freetype='$freetype'
5440bc8e 23438from='$from'
b4eb6b3d
JH
23439full_ar='$full_ar'
23440full_csh='$full_csh'
23441full_sed='$full_sed'
2d736872 23442gccansipedantic='$gccansipedantic'
5b463ca7 23443gccosandvers='$gccosandvers'
5f80c64f 23444gccversion='$gccversion'
10bc17b6
JH
23445getgrent_r_proto='$getgrent_r_proto'
23446getgrgid_r_proto='$getgrgid_r_proto'
23447getgrnam_r_proto='$getgrnam_r_proto'
23448gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23449gethostbyname_r_proto='$gethostbyname_r_proto'
23450gethostent_r_proto='$gethostent_r_proto'
23451getlogin_r_proto='$getlogin_r_proto'
23452getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23453getnetbyname_r_proto='$getnetbyname_r_proto'
23454getnetent_r_proto='$getnetent_r_proto'
23455getprotobyname_r_proto='$getprotobyname_r_proto'
23456getprotobynumber_r_proto='$getprotobynumber_r_proto'
23457getprotoent_r_proto='$getprotoent_r_proto'
23458getpwent_r_proto='$getpwent_r_proto'
23459getpwnam_r_proto='$getpwnam_r_proto'
23460getpwuid_r_proto='$getpwuid_r_proto'
23461getservbyname_r_proto='$getservbyname_r_proto'
23462getservbyport_r_proto='$getservbyport_r_proto'
23463getservent_r_proto='$getservent_r_proto'
23464getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
23465gidformat='$gidformat'
23466gidsign='$gidsign'
23467gidsize='$gidsize'
23468gidtype='$gidtype'
5f80c64f 23469glibpth='$glibpth'
3c728e00 23470gmake='$gmake'
10bc17b6 23471gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 23472gnulibc_version='$gnulibc_version'
5f80c64f 23473grep='$grep'
b4eb6b3d
JH
23474groupcat='$groupcat'
23475groupstype='$groupstype'
5f80c64f 23476gzip='$gzip'
b4eb6b3d
JH
23477h_fcntl='$h_fcntl'
23478h_sysfile='$h_sysfile'
5f80c64f 23479hint='$hint'
b4eb6b3d 23480hostcat='$hostcat'
6e1038e0
MB
23481html1dir='$html1dir'
23482html1direxp='$html1direxp'
23483html3dir='$html3dir'
23484html3direxp='$html3direxp'
b4eb6b3d
JH
23485i16size='$i16size'
23486i16type='$i16type'
23487i32size='$i32size'
23488i32type='$i32type'
23489i64size='$i64size'
23490i64type='$i64type'
23491i8size='$i8size'
23492i8type='$i8type'
23493i_arpainet='$i_arpainet'
2a0de2c5 23494i_assert='$i_assert'
b4eb6b3d 23495i_bsdioctl='$i_bsdioctl'
10bc17b6 23496i_crypt='$i_crypt'
b4eb6b3d
JH
23497i_db='$i_db'
23498i_dbm='$i_dbm'
23499i_dirent='$i_dirent'
5f80c64f 23500i_dld='$i_dld'
b4eb6b3d
JH
23501i_dlfcn='$i_dlfcn'
23502i_fcntl='$i_fcntl'
23503i_float='$i_float'
758a5d79
JH
23504i_fp='$i_fp'
23505i_fp_class='$i_fp_class'
b4eb6b3d 23506i_gdbm='$i_gdbm'
a33f2d9f
AD
23507i_gdbm_ndbm='$i_gdbm_ndbm'
23508i_gdbmndbm='$i_gdbmndbm'
b4eb6b3d 23509i_grp='$i_grp'
b4eb6b3d
JH
23510i_ieeefp='$i_ieeefp'
23511i_inttypes='$i_inttypes'
2765b840 23512i_langinfo='$i_langinfo'
b4eb6b3d
JH
23513i_libutil='$i_libutil'
23514i_limits='$i_limits'
23515i_locale='$i_locale'
23516i_machcthr='$i_machcthr'
23517i_malloc='$i_malloc'
1cd66f7c 23518i_mallocmalloc='$i_mallocmalloc'
b4eb6b3d
JH
23519i_math='$i_math'
23520i_memory='$i_memory'
23521i_mntent='$i_mntent'
23522i_ndbm='$i_ndbm'
23523i_netdb='$i_netdb'
23524i_neterrno='$i_neterrno'
23525i_netinettcp='$i_netinettcp'
23526i_niin='$i_niin'
23527i_poll='$i_poll'
23528i_prot='$i_prot'
23529i_pthread='$i_pthread'
23530i_pwd='$i_pwd'
23531i_rpcsvcdbm='$i_rpcsvcdbm'
23532i_sfio='$i_sfio'
23533i_sgtty='$i_sgtty'
23534i_shadow='$i_shadow'
23535i_socks='$i_socks'
23536i_stdarg='$i_stdarg'
bd31be4b 23537i_stdbool='$i_stdbool'
b4eb6b3d
JH
23538i_stddef='$i_stddef'
23539i_stdlib='$i_stdlib'
23540i_string='$i_string'
23541i_sunmath='$i_sunmath'
23542i_sysaccess='$i_sysaccess'
23543i_sysdir='$i_sysdir'
23544i_sysfile='$i_sysfile'
23545i_sysfilio='$i_sysfilio'
23546i_sysin='$i_sysin'
23547i_sysioctl='$i_sysioctl'
23548i_syslog='$i_syslog'
23549i_sysmman='$i_sysmman'
23550i_sysmode='$i_sysmode'
23551i_sysmount='$i_sysmount'
23552i_sysndir='$i_sysndir'
23553i_sysparam='$i_sysparam'
216dac04 23554i_syspoll='$i_syspoll'
b4eb6b3d
JH
23555i_sysresrc='$i_sysresrc'
23556i_syssecrt='$i_syssecrt'
23557i_sysselct='$i_sysselct'
23558i_syssockio='$i_syssockio'
23559i_sysstat='$i_sysstat'
23560i_sysstatfs='$i_sysstatfs'
23561i_sysstatvfs='$i_sysstatvfs'
23562i_systime='$i_systime'
23563i_systimek='$i_systimek'
23564i_systimes='$i_systimes'
23565i_systypes='$i_systypes'
23566i_sysuio='$i_sysuio'
23567i_sysun='$i_sysun'
23568i_sysutsname='$i_sysutsname'
23569i_sysvfs='$i_sysvfs'
23570i_syswait='$i_syswait'
23571i_termio='$i_termio'
23572i_termios='$i_termios'
23573i_time='$i_time'
23574i_unistd='$i_unistd'
23575i_ustat='$i_ustat'
23576i_utime='$i_utime'
23577i_values='$i_values'
23578i_varargs='$i_varargs'
23579i_varhdr='$i_varhdr'
23580i_vfork='$i_vfork'
5f80c64f 23581ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
23582inc_version_list='$inc_version_list'
23583inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
23584incpath='$incpath'
23585inews='$inews'
f3f1a2d8 23586initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
23587installarchlib='$installarchlib'
23588installbin='$installbin'
6e1038e0
MB
23589installhtml1dir='$installhtml1dir'
23590installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
23591installman1dir='$installman1dir'
23592installman3dir='$installman3dir'
23593installprefix='$installprefix'
23594installprefixexp='$installprefixexp'
23595installprivlib='$installprivlib'
23596installscript='$installscript'
23597installsitearch='$installsitearch'
23598installsitebin='$installsitebin'
8d2cbf27
JH
23599installsitehtml1dir='$installsitehtml1dir'
23600installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 23601installsitelib='$installsitelib'
91e123a8
JH
23602installsiteman1dir='$installsiteman1dir'
23603installsiteman3dir='$installsiteman3dir'
6e1038e0 23604installsitescript='$installsitescript'
b4eb6b3d
JH
23605installstyle='$installstyle'
23606installusrbinperl='$installusrbinperl'
23607installvendorarch='$installvendorarch'
23608installvendorbin='$installvendorbin'
8d2cbf27
JH
23609installvendorhtml1dir='$installvendorhtml1dir'
23610installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 23611installvendorlib='$installvendorlib'
91e123a8
JH
23612installvendorman1dir='$installvendorman1dir'
23613installvendorman3dir='$installvendorman3dir'
6e1038e0 23614installvendorscript='$installvendorscript'
b4eb6b3d 23615intsize='$intsize'
4b661809 23616issymlink='$issymlink'
b4eb6b3d
JH
23617ivdformat='$ivdformat'
23618ivsize='$ivsize'
23619ivtype='$ivtype'
23620known_extensions='$known_extensions'
5f80c64f 23621ksh='$ksh'
5f80c64f 23622ld='$ld'
9ec4dadf 23623ld_can_script='$ld_can_script'
5f80c64f
JH
23624lddlflags='$lddlflags'
23625ldflags='$ldflags'
b4eb6b3d
JH
23626ldflags_uselargefiles='$ldflags_uselargefiles'
23627ldlibpthname='$ldlibpthname'
5f80c64f
JH
23628less='$less'
23629lib_ext='$lib_ext'
23630libc='$libc'
b4eb6b3d 23631libperl='$libperl'
5f80c64f
JH
23632libpth='$libpth'
23633libs='$libs'
43999f95
JH
23634libsdirs='$libsdirs'
23635libsfiles='$libsfiles'
23636libsfound='$libsfound'
13b3f787 23637libspath='$libspath'
5f80c64f 23638libswanted='$libswanted'
b4eb6b3d 23639libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
23640line='$line'
23641lint='$lint'
23642lkflags='$lkflags'
23643ln='$ln'
23644lns='$lns'
10bc17b6 23645localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
23646locincpth='$locincpth'
23647loclibpth='$loclibpth'
b4eb6b3d
JH
23648longdblsize='$longdblsize'
23649longlongsize='$longlongsize'
23650longsize='$longsize'
5f80c64f
JH
23651lp='$lp'
23652lpr='$lpr'
23653ls='$ls'
b4eb6b3d
JH
23654lseeksize='$lseeksize'
23655lseektype='$lseektype'
a724edfe 23656mad='$mad'
f3f1a2d8
MB
23657madlyh='$madlyh'
23658madlyobj='$madlyobj'
23659madlysrc='$madlysrc'
5f80c64f
JH
23660mail='$mail'
23661mailx='$mailx'
23662make='$make'
23663make_set_make='$make_set_make'
b4eb6b3d
JH
23664mallocobj='$mallocobj'
23665mallocsrc='$mallocsrc'
23666malloctype='$malloctype'
23667man1dir='$man1dir'
23668man1direxp='$man1direxp'
23669man1ext='$man1ext'
23670man3dir='$man3dir'
23671man3direxp='$man3direxp'
23672man3ext='$man3ext'
5f80c64f 23673mips_type='$mips_type'
5129fff4 23674mistrustnm='$mistrustnm'
5f80c64f 23675mkdir='$mkdir'
b4eb6b3d
JH
23676mmaptype='$mmaptype'
23677modetype='$modetype'
5f80c64f 23678more='$more'
b4eb6b3d 23679multiarch='$multiarch'
5f80c64f 23680mv='$mv'
b4eb6b3d
JH
23681myarchname='$myarchname'
23682mydomain='$mydomain'
23683myhostname='$myhostname'
5f80c64f
JH
23684myuname='$myuname'
23685n='$n'
2cc61e15 23686need_va_copy='$need_va_copy'
b4eb6b3d
JH
23687netdb_hlen_type='$netdb_hlen_type'
23688netdb_host_type='$netdb_host_type'
23689netdb_name_type='$netdb_name_type'
23690netdb_net_type='$netdb_net_type'
5f80c64f
JH
23691nm='$nm'
23692nm_opt='$nm_opt'
23693nm_so_opt='$nm_so_opt'
b4eb6b3d 23694nonxs_ext='$nonxs_ext'
5f80c64f 23695nroff='$nroff'
b4eb6b3d
JH
23696nvEUformat='$nvEUformat'
23697nvFUformat='$nvFUformat'
23698nvGUformat='$nvGUformat'
b68c599a 23699nv_overflows_integers_at='$nv_overflows_integers_at'
53133ed1 23700nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
23701nveformat='$nveformat'
23702nvfformat='$nvfformat'
23703nvgformat='$nvgformat'
23704nvsize='$nvsize'
23705nvtype='$nvtype'
23706o_nonblock='$o_nonblock'
5f80c64f 23707obj_ext='$obj_ext'
b4eb6b3d 23708old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 23709optimize='$optimize'
b4eb6b3d 23710orderlib='$orderlib'
5f80c64f
JH
23711osname='$osname'
23712osvers='$osvers'
b4eb6b3d 23713otherlibdirs='$otherlibdirs'
5f80c64f 23714package='$package'
b4eb6b3d
JH
23715pager='$pager'
23716passcat='$passcat'
23717patchlevel='$patchlevel'
5f80c64f 23718path_sep='$path_sep'
b4eb6b3d 23719perl5='$perl5'
5f80c64f 23720perl='$perl'
151e6568 23721perl_patchlevel='$perl_patchlevel'
17a6c8e3 23722perl_static_inline='$perl_static_inline'
b4eb6b3d 23723perladmin='$perladmin'
9c839522 23724perllibs='$perllibs'
91f55cc7 23725perlpath='$perlpath'
5f80c64f 23726pg='$pg'
b4eb6b3d
JH
23727phostname='$phostname'
23728pidtype='$pidtype'
5f80c64f
JH
23729plibpth='$plibpth'
23730pmake='$pmake'
23731pr='$pr'
b4eb6b3d
JH
23732prefix='$prefix'
23733prefixexp='$prefixexp'
23734privlib='$privlib'
23735privlibexp='$privlibexp'
f24dbf84 23736procselfexe='$procselfexe'
b4eb6b3d
JH
23737prototype='$prototype'
23738ptrsize='$ptrsize'
23739quadkind='$quadkind'
23740quadtype='$quadtype'
23741randbits='$randbits'
23742randfunc='$randfunc'
10bc17b6 23743random_r_proto='$random_r_proto'
b4eb6b3d
JH
23744randseedtype='$randseedtype'
23745ranlib='$ranlib'
23746rd_nodata='$rd_nodata'
10bc17b6
JH
23747readdir64_r_proto='$readdir64_r_proto'
23748readdir_r_proto='$readdir_r_proto'
b4eb6b3d 23749revision='$revision'
5f80c64f 23750rm='$rm'
5b813a60 23751rm_try='$rm_try'
5f80c64f 23752rmail='$rmail'
5440bc8e 23753run='$run'
5f80c64f 23754runnm='$runnm'
81c4fd9e
MB
23755sGMTIME_max='$sGMTIME_max'
23756sGMTIME_min='$sGMTIME_min'
73e6e416
MB
23757sLOCALTIME_max='$sLOCALTIME_max'
23758sLOCALTIME_min='$sLOCALTIME_min'
b4eb6b3d
JH
23759sPRIEUldbl='$sPRIEUldbl'
23760sPRIFUldbl='$sPRIFUldbl'
23761sPRIGUldbl='$sPRIGUldbl'
23762sPRIXU64='$sPRIXU64'
23763sPRId64='$sPRId64'
23764sPRIeldbl='$sPRIeldbl'
23765sPRIfldbl='$sPRIfldbl'
23766sPRIgldbl='$sPRIgldbl'
23767sPRIi64='$sPRIi64'
23768sPRIo64='$sPRIo64'
23769sPRIu64='$sPRIu64'
23770sPRIx64='$sPRIx64'
23771sSCNfldbl='$sSCNfldbl'
23772sched_yield='$sched_yield'
23773scriptdir='$scriptdir'
23774scriptdirexp='$scriptdirexp'
5f80c64f 23775sed='$sed'
b4eb6b3d
JH
23776seedfunc='$seedfunc'
23777selectminbits='$selectminbits'
23778selecttype='$selecttype'
5f80c64f 23779sendmail='$sendmail'
10bc17b6
JH
23780setgrent_r_proto='$setgrent_r_proto'
23781sethostent_r_proto='$sethostent_r_proto'
23782setlocale_r_proto='$setlocale_r_proto'
23783setnetent_r_proto='$setnetent_r_proto'
23784setprotoent_r_proto='$setprotoent_r_proto'
23785setpwent_r_proto='$setpwent_r_proto'
23786setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
23787sh='$sh'
23788shar='$shar'
23789sharpbang='$sharpbang'
b4eb6b3d
JH
23790shmattype='$shmattype'
23791shortsize='$shortsize'
23792shrpenv='$shrpenv'
5f80c64f 23793shsharp='$shsharp'
b4eb6b3d
JH
23794sig_count='$sig_count'
23795sig_name='$sig_name'
23796sig_name_init='$sig_name_init'
23797sig_num='$sig_num'
23798sig_num_init='$sig_num_init'
76d3c696 23799sig_size='$sig_size'
b4eb6b3d
JH
23800signal_t='$signal_t'
23801sitearch='$sitearch'
23802sitearchexp='$sitearchexp'
23803sitebin='$sitebin'
23804sitebinexp='$sitebinexp'
8d2cbf27
JH
23805sitehtml1dir='$sitehtml1dir'
23806sitehtml1direxp='$sitehtml1direxp'
23807sitehtml3dir='$sitehtml3dir'
23808sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
23809sitelib='$sitelib'
23810sitelib_stem='$sitelib_stem'
23811sitelibexp='$sitelibexp'
91e123a8
JH
23812siteman1dir='$siteman1dir'
23813siteman1direxp='$siteman1direxp'
23814siteman3dir='$siteman3dir'
23815siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
23816siteprefix='$siteprefix'
23817siteprefixexp='$siteprefixexp'
6e1038e0
MB
23818sitescript='$sitescript'
23819sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
23820sizesize='$sizesize'
23821sizetype='$sizetype'
5f80c64f
JH
23822sleep='$sleep'
23823smail='$smail'
5f80c64f 23824so='$so'
b4eb6b3d
JH
23825sockethdr='$sockethdr'
23826socketlib='$socketlib'
23827socksizetype='$socksizetype'
5f80c64f
JH
23828sort='$sort'
23829spackage='$spackage'
23830spitshell='$spitshell'
10bc17b6
JH
23831srand48_r_proto='$srand48_r_proto'
23832srandom_r_proto='$srandom_r_proto'
5f80c64f 23833src='$src'
b4eb6b3d 23834ssizetype='$ssizetype'
668fdbe1
MB
23835st_ino_sign='$st_ino_sign'
23836st_ino_size='$st_ino_size'
b4eb6b3d 23837startperl='$startperl'
5f80c64f 23838startsh='$startsh'
b4eb6b3d
JH
23839static_ext='$static_ext'
23840stdchar='$stdchar'
23841stdio_base='$stdio_base'
23842stdio_bufsiz='$stdio_bufsiz'
23843stdio_cnt='$stdio_cnt'
23844stdio_filbuf='$stdio_filbuf'
23845stdio_ptr='$stdio_ptr'
23846stdio_stream_array='$stdio_stream_array'
10bc17b6 23847strerror_r_proto='$strerror_r_proto'
b4eb6b3d 23848strings='$strings'
5f80c64f 23849submit='$submit'
b4eb6b3d
JH
23850subversion='$subversion'
23851sysman='$sysman'
5f80c64f
JH
23852tail='$tail'
23853tar='$tar'
5440bc8e 23854targetarch='$targetarch'
5f80c64f
JH
23855tbl='$tbl'
23856tee='$tee'
23857test='$test'
b4eb6b3d
JH
23858timeincl='$timeincl'
23859timetype='$timetype'
10bc17b6 23860tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 23861to='$to'
5f80c64f
JH
23862touch='$touch'
23863tr='$tr'
23864trnl='$trnl'
23865troff='$troff'
10bc17b6 23866ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
23867u16size='$u16size'
23868u16type='$u16type'
23869u32size='$u32size'
23870u32type='$u32type'
23871u64size='$u64size'
23872u64type='$u64type'
23873u8size='$u8size'
23874u8type='$u8type'
23875uidformat='$uidformat'
23876uidsign='$uidsign'
23877uidsize='$uidsize'
23878uidtype='$uidtype'
5f80c64f
JH
23879uname='$uname'
23880uniq='$uniq'
b4eb6b3d
JH
23881uquadtype='$uquadtype'
23882use5005threads='$use5005threads'
23883use64bitall='$use64bitall'
23884use64bitint='$use64bitint'
5440bc8e 23885usecrosscompile='$usecrosscompile'
1be1b388 23886usedevel='$usedevel'
5f80c64f 23887usedl='$usedl'
5ac1e9b2 23888usedtrace='$usedtrace'
15b61c98 23889usefaststdio='$usefaststdio'
b4eb6b3d 23890useithreads='$useithreads'
2982a345 23891usekernprocpathname='$usekernprocpathname'
b4eb6b3d
JH
23892uselargefiles='$uselargefiles'
23893uselongdouble='$uselongdouble'
19a100ff 23894usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
23895usemorebits='$usemorebits'
23896usemultiplicity='$usemultiplicity'
23897usemymalloc='$usemymalloc'
5f80c64f 23898usenm='$usenm'
ae60cb46 23899usensgetexecutablepath='$usensgetexecutablepath'
b4eb6b3d
JH
23900useopcode='$useopcode'
23901useperlio='$useperlio'
23902useposix='$useposix'
9514c62b 23903usereentrant='$usereentrant'
d51aaa9d 23904userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
23905usesfio='$usesfio'
23906useshrplib='$useshrplib'
5f106f9c 23907usesitecustomize='$usesitecustomize'
29209bc5 23908usesocks='$usesocks'
b4eb6b3d
JH
23909usethreads='$usethreads'
23910usevendorprefix='$usevendorprefix'
1a1287f4 23911useversionedarchname='$useversionedarchname'
b4eb6b3d 23912usevfork='$usevfork'
5f80c64f
JH
23913usrinc='$usrinc'
23914uuname='$uuname'
b4eb6b3d
JH
23915uvXUformat='$uvXUformat'
23916uvoformat='$uvoformat'
23917uvsize='$uvsize'
23918uvtype='$uvtype'
23919uvuformat='$uvuformat'
23920uvxformat='$uvxformat'
d03b3b00 23921vaproto='$vaproto'
b4eb6b3d
JH
23922vendorarch='$vendorarch'
23923vendorarchexp='$vendorarchexp'
23924vendorbin='$vendorbin'
23925vendorbinexp='$vendorbinexp'
8d2cbf27
JH
23926vendorhtml1dir='$vendorhtml1dir'
23927vendorhtml1direxp='$vendorhtml1direxp'
23928vendorhtml3dir='$vendorhtml3dir'
23929vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
23930vendorlib='$vendorlib'
23931vendorlib_stem='$vendorlib_stem'
23932vendorlibexp='$vendorlibexp'
91e123a8
JH
23933vendorman1dir='$vendorman1dir'
23934vendorman1direxp='$vendorman1direxp'
23935vendorman3dir='$vendorman3dir'
23936vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
23937vendorprefix='$vendorprefix'
23938vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
23939vendorscript='$vendorscript'
23940vendorscriptexp='$vendorscriptexp'
b4eb6b3d 23941version='$version'
861eb78d 23942version_patchlevel_string='$version_patchlevel_string'
d56c5707 23943versiononly='$versiononly'
5f80c64f 23944vi='$vi'
b4eb6b3d 23945voidflags='$voidflags'
5f80c64f 23946xlibpth='$xlibpth'
3659ebf1
JH
23947yacc='$yacc'
23948yaccflags='$yaccflags'
5f80c64f
JH
23949zcat='$zcat'
23950zip='$zip'
23951EOT
23952
5f80c64f
JH
23953: add special variables
23954$test -f $src/patchlevel.h && \
d9421656 23955awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
0f04e85f 23956echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
a02608de 23957echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
23958
23959: propagate old symbols
23960if $test -f UU/config.sh; then
381aa1ff 23961 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
776a38e3
MB
23962 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23963 config.sh config.sh UU/oldconfig.sh |\
23964 $sort | $uniq -u >UU/oldsyms
dd35fa16 23965 set X `$cat UU/oldsyms`
5f80c64f
JH
23966 shift
23967 case $# in
23968 0) ;;
23969 *)
dd35fa16 23970 $cat <<EOM
5f80c64f
JH
23971Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23972EOM
776a38e3 23973 echo ": Variables propagated from previous config.sh file." >>config.sh
dd35fa16 23974 for sym in `$cat UU/oldsyms`; do
5f80c64f
JH
23975 echo " Propagating $hint variable "'$'"$sym..."
23976 eval 'tmp="$'"${sym}"'"'
23977 echo "$tmp" | \
23978 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23979 done
23980 ;;
23981 esac
23982fi
23983
23984: Finish up by extracting the .SH files
23985case "$alldone" in
23986exit)
23987 $rm -rf UU
24ccb310 23988 echo "Extraction done."
5f80c64f
JH
23989 exit 0
23990 ;;
23991cont)
23992 ;;
23993'')
23994 dflt=''
23995 nostick=true
23996 $cat <<EOM
23997
23998If you'd like to make any changes to the config.sh file before I begin
23999to configure things, do it as a shell escape now (e.g. !vi config.sh).
24000
24001EOM
24002 rp="Press return or use a shell escape to edit config.sh:"
24003 . UU/myread
24004 nostick=''
24005 case "$ans" in
24006 '') ;;
24007 *) : in case they cannot read
24008 sh 1>&4 -c "$ans";;
24009 esac
24010 ;;
24011esac
24012
24013: if this fails, just run all the .SH files by hand
24014. ./config.sh
24015
24016echo " "
24017exec 1>&4
a43e8593 24018pwd=`pwd`
5f80c64f 24019. ./UU/extract
6904989c 24020cd "$pwd"
5f80c64f
JH
24021
24022if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24023 dflt=y
24024 case "$silent" in
24025 true) ;;
24026 *)
24027 $cat <<EOM
24028
24029Now you need to generate make dependencies by running "$make depend".
24030You might prefer to run it in background: "$make depend > makedepend.out &"
24031It can take a while, so you might not want to run it right now.
24032
24033EOM
24034 ;;
24035 esac
24036 rp="Run $make depend now?"
24037 . UU/myread
24038 case "$ans" in
24039 y*)
3d5d58b1 24040 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
24041 ;;
24042 *)
24043 echo "You must run '$make depend' then '$make'."
24044 ;;
24045 esac
24046elif test -f [Mm]akefile; then
24047 echo " "
24048 echo "Now you must run a $make."
24049else
24ccb310 24050 echo "Configure done."
5f80c64f
JH
24051fi
24052
24053if $test -f Policy.sh; then
24054 $cat <<EOM
24055
24056If you compile $package on a different machine or from a different object
24057directory, copy the Policy.sh file from this object directory to the
24058new one before you run Configure -- this will help you with most of
24059the policy defaults.
24060
24061EOM
24062fi
24063if $test -f config.msg; then
24064 echo "Hmm. I also noted the following information while running:"
24065 echo " "
24066 $cat config.msg >&4
24067 $rm -f config.msg
24068fi
24069$rm -f kit*isdone ark*isdone
24070$rm -rf UU
24071
24072: End of Configure
24073