This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
$^E is not Win32::GetLastError under Cygwin
[perl5.git] / Configure
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
dfe9444c
AD
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
2304df62 19#
5cadb3f3
MB
20#
21# Though this script was generated by metaconfig, it is OK to send
22# patches against it. It's up to the Configure pumpkin to backport
23# the patch to the metaunits if it is accepted.
24# See Porting/pumpkin.pod for more information on metaconfig.
25#
2304df62 26
dfe9444c 27# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 28#
2f88d857 29# Generated on Sun Sep 9 11:36:23 CEST 2007 [metaconfig 3.0 PL70]
7f2de2d2 30# (with additional metaconfig patches by perlbug@perl.org)
2304df62 31
283fdd21 32cat >c1$$ <<EOF
2304df62
AD
33ARGGGHHHH!!!!!
34
35SCO csh still thinks true is false. Write to SCO today and tell them that next
36year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
39we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41[End of diatribe. We now return you to your regularly scheduled programming...]
42EOF
283fdd21 43cat >c2$$ <<EOF
2304df62
AD
44
45OOPS! You naughty creature! You didn't run Configure with sh!
46I will attempt to remedy the situation by running sh for you...
47EOF
48
283fdd21 49true || cat c1$$ c2$$
2304df62
AD
50true || exec sh $0 $argv:q
51
283fdd21 52(exit $?0) || cat c2$$
2304df62 53(exit $?0) || exec sh $0 $argv:q
283fdd21 54rm -f c1$$ c2$$
2304df62 55
f6538904 56if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
57 cat >&4 <<EOF
58***
59*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
61*** Please read the README.plan9 for further instructions.
62*** Cannot continue, aborting.
63***
64EOF
65 exit 1
66fi
67
f8e2af1d
MC
68if test ! -c /dev/null ; then
69 cat >&4 <<EOF
70***
71*** I'm sorry, but /dev/null appears to be a file rather than a device.
72*** Please consult your operating sytem's notes for making a device
73*** in /dev.
74*** Cannot continue, aborting.
75***
76EOF
77 exit 1
78fi
79
a0d0e21e
LW
80: compute my invocation name
81me=$0
82case "$0" in
83*/*)
84 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
85 test "$me" || me=$0
86 ;;
87esac
88
dfe9444c 89: Proper separator for the PATH environment variable
8e07c86e
AD
90p_=:
91: On OS/2 this directory should exist if this is not floppy only system :-]
5c728af0 92if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
dfe9444c
AD
93 if test -n "$OS2_SHELL"; then
94 p_=\;
95 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
96 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 97 is_os2=yes
c4f23d77 98 elif test -n "$DJGPP"; then
495e2cbe
MB
99 case "X${MACHTYPE:-nonesuchmach}" in
100 *cygwin) ;;
101 *) p_=\; ;;
102 esac
dfe9444c 103 fi
39e571d4 104fi
a0d0e21e
LW
105
106: Proper PATH setting
107paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 108paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 109paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 110paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 111paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 112paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
113paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
114paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 115paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
116
117for p in $paths
118do
8e07c86e
AD
119 case "$p_$PATH$p_" in
120 *$p_$p$p_*) ;;
121 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
122 esac
123done
124
8e07c86e 125PATH=.$p_$PATH
2304df62
AD
126export PATH
127
dfe9444c
AD
128: shall we be using ksh?
129inksh=''
130needksh=''
131avoidksh=''
132newsh=/bin/ksh
133changesh=''
ff0cee69 134if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
135 inksh=true
136fi
137if test -f /hp-ux -a -f /bin/ksh; then
138 needksh='to avoid sh bug in "here document" expansion'
139fi
140if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
141 if test X`/usr/bin/uname -v` = X4; then
142 avoidksh="to avoid AIX 4's /bin/sh"
143 newsh=/usr/bin/bsh
2304df62 144 fi
dfe9444c 145fi
cf04f91f
JH
146if test -f /osf_boot -a -f /usr/sbin/setld; then
147 if test X`/usr/bin/uname -s` = XOSF1; then
148 avoidksh="to avoid Digital UNIX' ksh"
149 newsh=/bin/sh
150 unset BIN_SH # if this is 'xpg4' sh will start up ksh
151 fi
152fi
dfe9444c
AD
153case "$inksh/$needksh" in
154/[a-z]*)
c4f23d77 155 ENV=''
dfe9444c
AD
156 changesh=true
157 reason="$needksh"
158 ;;
159esac
160case "$inksh/$avoidksh" in
161true/[a-z]*)
162 changesh=true
163 reason="$avoidksh"
164 ;;
165esac
166case "$inksh/$needksh-$avoidksh-" in
167true/--)
a0d0e21e
LW
168 cat <<EOM
169(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 170mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 171EOM
dfe9444c
AD
172 ;;
173esac
174case "$changesh" in
175true)
2e2a97a6 176 export newsh
dfe9444c
AD
177 echo "(Feeding myself to $newsh $reason.)"
178 case "$0" in
179 Configure|*/Configure) exec $newsh $0 "$@";;
180 *) exec $newsh Configure "$@";;
181 esac
182 ;;
183esac
7730b9f4 184test -x "${newsh}" || unset newsh
2304df62 185
bfb7748a
AD
186: if needed set CDPATH to a harmless value that is not chatty
187: avoid bash 2.02 problems with empty CDPATH.
188case "$CDPATH" in
189'') ;;
190*) case "$SHELL" in
191 *bash*) CDPATH='.' ;;
192 *) CDPATH='' ;;
193 esac
194 ;;
195esac
2304df62
AD
196: Configure runs within the UU subdirectory
197test -d UU || mkdir UU
8e07c86e 198cd UU && rm -f ./*
2304df62 199
6b356c8e
JH
200ccname=''
201ccversion=''
b4eb6b3d
JH
202ccsymbols=''
203cppccsymbols=''
204cppsymbols=''
5440bc8e
JH
205from=''
206run=''
207targetarch=''
208to=''
209usecrosscompile=''
6b34ded5 210mistrustnm=''
9c839522 211perllibs=''
b4eb6b3d
JH
212dynamic_ext=''
213extensions=''
214known_extensions=''
215nonxs_ext=''
216static_ext=''
217useopcode=''
218useposix=''
6fcddf3b 219extras=''
ecfc5424 220d_bsd=''
40a7a20a 221d_eunice=''
2304df62
AD
222d_xenix=''
223eunicefix=''
224Mcc=''
dfe9444c 225ar=''
2304df62
AD
226awk=''
227bash=''
228bison=''
229byacc=''
230cat=''
231chgrp=''
232chmod=''
233chown=''
ecfc5424 234comm=''
2304df62
AD
235compress=''
236cp=''
237cpio=''
238cpp=''
239csh=''
240date=''
241echo=''
242egrep=''
243emacs=''
244expr=''
245find=''
246flex=''
3c728e00 247gmake=''
2304df62 248grep=''
8ff267be 249gzip=''
2304df62
AD
250inews=''
251ksh=''
252less=''
253line=''
254lint=''
255ln=''
256lp=''
257lpr=''
258ls=''
259mail=''
260mailx=''
dfe9444c 261make=''
2304df62
AD
262mkdir=''
263more=''
264mv=''
693762b4 265nm=''
2304df62
AD
266nroff=''
267perl=''
268pg=''
269pmake=''
270pr=''
271rm=''
272rmail=''
273sed=''
274sendmail=''
2304df62
AD
275shar=''
276sleep=''
277smail=''
278sort=''
279submit=''
280tail=''
281tar=''
282tbl=''
693762b4 283tee=''
2304df62
AD
284test=''
285touch=''
286tr=''
287troff=''
288uname=''
289uniq=''
290uuname=''
291vi=''
292zcat=''
8ff267be 293zip=''
b4eb6b3d
JH
294full_ar=''
295full_sed=''
a0d0e21e 296libswanted=''
2304df62
AD
297hint=''
298myuname=''
85e6fe83
LW
299osname=''
300osvers=''
2304df62
AD
301Author=''
302Date=''
303Header=''
304Id=''
305Locker=''
306Log=''
307RCSfile=''
308Revision=''
309Source=''
310State=''
dfe9444c
AD
311_a=''
312_exe=''
313_o=''
4633a7c4
LW
314archobjs=''
315exe_ext=''
316firstmakefile=''
317lib_ext=''
318obj_ext=''
319path_sep=''
5b813a60 320rm_try=''
b4eb6b3d 321afs=''
a6d26a0d 322afsroot=''
b4eb6b3d
JH
323alignbytes=''
324ansi2knr=''
325archlib=''
326archlibexp=''
327d_archlib=''
328installarchlib=''
329archname=''
330myarchname=''
331d_atolf=''
332d_atoll=''
333baserev=''
334bin=''
335binexp=''
f3f1a2d8 336initialinstalllocation=''
b4eb6b3d 337installbin=''
f3f1a2d8 338userelocatableinc=''
b4eb6b3d 339byteorder=''
2304df62 340cc=''
2304df62
AD
341ccflags=''
342cppflags=''
343ldflags=''
344lkflags=''
8e07c86e 345locincpth=''
2304df62 346optimize=''
b4eb6b3d 347cf_email=''
2304df62
AD
348cf_by=''
349cf_time=''
350contains=''
b4eb6b3d 351cpp_stuff=''
2304df62
AD
352cpplast=''
353cppminus=''
354cpprun=''
355cppstdin=''
74cac757 356d__fwalk=''
b4eb6b3d
JH
357d_access=''
358d_accessx=''
55954f19 359d_aintl=''
b4eb6b3d 360d_alarm=''
10bc17b6
JH
361asctime_r_proto=''
362d_asctime_r=''
0dbb1585
AL
363d_attribute_format=''
364d_attribute_malloc=''
365d_attribute_nonnull=''
366d_attribute_noreturn=''
367d_attribute_pure=''
368d_attribute_unused=''
369d_attribute_warn_unused_result=''
dcb594bc 370d_printf_format_null=''
b4eb6b3d
JH
371d_bcmp=''
372d_bcopy=''
635aebb7
AL
373d_builtin_choose_expr=''
374d_builtin_expect=''
b4eb6b3d 375d_bzero=''
a2d23ec2 376d_c99_variadic_macros=''
b4eb6b3d
JH
377d_casti32=''
378castflags=''
379d_castneg=''
380d_chown=''
381d_chroot=''
382d_chsize=''
758a5d79 383d_class=''
b0a2e8e6 384d_clearenv=''
b4eb6b3d
JH
385d_closedir=''
386d_void_closedir=''
4e0554ec 387d_cmsghdr_s=''
b4eb6b3d 388d_const=''
36adc09b 389d_copysignl=''
666ea192 390d_cplusplus=''
b4eb6b3d
JH
391cryptlib=''
392d_crypt=''
10bc17b6
JH
393crypt_r_proto=''
394d_crypt_r=''
b4eb6b3d
JH
395d_csh=''
396full_csh=''
13cfc98d 397d_ctermid=''
10bc17b6
JH
398ctermid_r_proto=''
399d_ctermid_r=''
400ctime_r_proto=''
401d_ctime_r=''
b4eb6b3d
JH
402d_cuserid=''
403d_dbl_dig=''
2ef53570 404d_dbminitproto=''
b4eb6b3d 405d_difftime=''
de52168c 406d_dir_dd_fd=''
ae0e3d3b 407d_dirfd=''
b4eb6b3d 408d_dlerror=''
a0d0e21e 409d_dlopen=''
b4eb6b3d
JH
410d_dlsymun=''
411d_dosuid=''
412d_suidsafe=''
10bc17b6
JH
413d_drand48_r=''
414drand48_r_proto=''
b4eb6b3d
JH
415d_drand48proto=''
416d_dup2=''
417d_eaccess=''
418d_endgrent=''
10bc17b6
JH
419d_endgrent_r=''
420endgrent_r_proto=''
b4eb6b3d 421d_endhent=''
10bc17b6
JH
422d_endhostent_r=''
423endhostent_r_proto=''
b4eb6b3d 424d_endnent=''
10bc17b6
JH
425d_endnetent_r=''
426endnetent_r_proto=''
b4eb6b3d 427d_endpent=''
10bc17b6
JH
428d_endprotoent_r=''
429endprotoent_r_proto=''
b4eb6b3d 430d_endpwent=''
10bc17b6
JH
431d_endpwent_r=''
432endpwent_r_proto=''
b4eb6b3d 433d_endsent=''
10bc17b6
JH
434d_endservent_r=''
435endservent_r_proto=''
15b61c98 436d_faststdio=''
b363b713 437d_fchdir=''
b4eb6b3d
JH
438d_fchmod=''
439d_fchown=''
440d_fcntl=''
9d9004a9 441d_fcntl_can_lock=''
b4eb6b3d
JH
442d_fd_macros=''
443d_fd_set=''
444d_fds_bits=''
445d_fgetpos=''
758a5d79
JH
446d_finite=''
447d_finitel=''
b4eb6b3d
JH
448d_flexfnam=''
449d_flock=''
2ef53570 450d_flockproto=''
b4eb6b3d 451d_fork=''
758a5d79
JH
452d_fp_class=''
453d_fpclass=''
454d_fpclassify=''
455d_fpclassl=''
b4eb6b3d
JH
456d_fpos64_t=''
457d_frexpl=''
458d_fs_data_s=''
459d_fseeko=''
460d_fsetpos=''
461d_fstatfs=''
411ab01c 462d_fsync=''
b4eb6b3d
JH
463d_ftello=''
464d_ftime=''
465d_gettimeod=''
dc814df1 466d_futimes=''
b4eb6b3d
JH
467d_Gconvert=''
468d_getcwd=''
469d_getespwnam=''
470d_getfsstat=''
471d_getgrent=''
10bc17b6
JH
472d_getgrent_r=''
473getgrent_r_proto=''
474d_getgrgid_r=''
475getgrgid_r_proto=''
476d_getgrnam_r=''
477getgrnam_r_proto=''
b4eb6b3d
JH
478d_getgrps=''
479d_gethbyaddr=''
480d_gethbyname=''
481d_gethent=''
482aphostname=''
483d_gethname=''
484d_phostname=''
485d_uname=''
10bc17b6
JH
486d_gethostbyaddr_r=''
487gethostbyaddr_r_proto=''
488d_gethostbyname_r=''
489gethostbyname_r_proto=''
490d_gethostent_r=''
491gethostent_r_proto=''
b4eb6b3d 492d_gethostprotos=''
4e0554ec 493d_getitimer=''
b4eb6b3d 494d_getlogin=''
10bc17b6
JH
495d_getlogin_r=''
496getlogin_r_proto=''
b4eb6b3d
JH
497d_getmnt=''
498d_getmntent=''
499d_getnbyaddr=''
500d_getnbyname=''
501d_getnent=''
10bc17b6
JH
502d_getnetbyaddr_r=''
503getnetbyaddr_r_proto=''
504d_getnetbyname_r=''
505getnetbyname_r_proto=''
506d_getnetent_r=''
507getnetent_r_proto=''
b4eb6b3d 508d_getnetprotos=''
0c0643d0 509d_getpagsz=''
b4eb6b3d
JH
510d_getpent=''
511d_getpgid=''
512d_getpgrp2=''
513d_bsdgetpgrp=''
514d_getpgrp=''
515d_getppid=''
516d_getprior=''
517d_getpbyname=''
518d_getpbynumber=''
10bc17b6
JH
519d_getprotobyname_r=''
520getprotobyname_r_proto=''
521d_getprotobynumber_r=''
522getprotobynumber_r_proto=''
523d_getprotoent_r=''
524getprotoent_r_proto=''
b4eb6b3d
JH
525d_getprotoprotos=''
526d_getprpwnam=''
527d_getpwent=''
10bc17b6
JH
528d_getpwent_r=''
529getpwent_r_proto=''
530d_getpwnam_r=''
531getpwnam_r_proto=''
532d_getpwuid_r=''
533getpwuid_r_proto=''
b4eb6b3d 534d_getsent=''
10bc17b6
JH
535d_getservbyname_r=''
536getservbyname_r_proto=''
537d_getservbyport_r=''
538getservbyport_r_proto=''
539d_getservent_r=''
540getservent_r_proto=''
b4eb6b3d
JH
541d_getservprotos=''
542d_getspnam=''
10bc17b6
JH
543d_getspnam_r=''
544getspnam_r_proto=''
b4eb6b3d
JH
545d_getsbyname=''
546d_getsbyport=''
10bc17b6
JH
547d_gmtime_r=''
548gmtime_r_proto=''
a4f3eea9 549d_gnulibc=''
5f6e0ee4 550gnulibc_version=''
b4eb6b3d
JH
551d_hasmntopt=''
552d_htonl=''
55954f19 553d_ilogbl=''
b4eb6b3d
JH
554d_inetaton=''
555d_int64_t=''
556d_isascii=''
758a5d79
JH
557d_isfinite=''
558d_isinf=''
b4eb6b3d
JH
559d_isnan=''
560d_isnanl=''
561d_killpg=''
562d_lchown=''
563d_ldbl_dig=''
0a0abfba 564d_libm_lib_version=''
b4eb6b3d 565d_link=''
10bc17b6 566d_localtime_r=''
8572b25d 567d_localtime_r_needs_tzset=''
10bc17b6 568localtime_r_proto=''
b4eb6b3d
JH
569d_locconv=''
570d_lockf=''
571d_longdbl=''
572longdblsize=''
573d_longlong=''
574longlongsize=''
575d_lseekproto=''
576d_lstat=''
577d_madvise=''
7dd121ae
MB
578d_malloc_good_size=''
579d_malloc_size=''
b4eb6b3d
JH
580d_mblen=''
581d_mbstowcs=''
582d_mbtowc=''
583d_memchr=''
584d_memcmp=''
585d_memcpy=''
586d_memmove=''
587d_memset=''
588d_mkdir=''
589d_mkdtemp=''
590d_mkfifo=''
591d_mkstemp=''
592d_mkstemps=''
593d_mktime=''
594d_mmap=''
595mmaptype=''
596d_modfl=''
e67aeab1 597d_modfl_pow32_bug=''
bc9a1b2c 598d_modflproto=''
b4eb6b3d
JH
599d_mprotect=''
600d_msg=''
601d_msgctl=''
602d_msgget=''
4e0554ec 603d_msghdr_s=''
b4eb6b3d
JH
604d_msgrcv=''
605d_msgsnd=''
606d_msync=''
607d_munmap=''
608d_nice=''
2765b840 609d_nl_langinfo=''
b4eb6b3d
JH
610d_off64_t=''
611d_open3=''
612d_fpathconf=''
613d_pathconf=''
614d_pause=''
615d_pipe=''
616d_poll=''
2304df62 617d_portable=''
a33c94aa 618d_procselfexe=''
f24dbf84 619procselfexe=''
b4eb6b3d
JH
620d_old_pthread_create_joinable=''
621old_pthread_create_joinable=''
d6483fcc 622d_pthread_atfork=''
58d975c3 623d_pthread_attr_setscope=''
b4eb6b3d
JH
624d_pthread_yield=''
625d_sched_yield=''
626sched_yield=''
627d_qgcvt=''
10bc17b6
JH
628d_random_r=''
629random_r_proto=''
630d_readdir64_r=''
631readdir64_r_proto=''
b4eb6b3d
JH
632d_readdir=''
633d_rewinddir=''
634d_seekdir=''
635d_telldir=''
10bc17b6
JH
636d_readdir_r=''
637readdir_r_proto=''
b4eb6b3d 638d_readlink=''
4e0554ec
JH
639d_readv=''
640d_recvmsg=''
b4eb6b3d
JH
641d_rename=''
642d_rmdir=''
643d_safebcpy=''
644d_safemcpy=''
645d_sanemcmp=''
ef9f17be 646d_sbrkproto=''
55954f19 647d_scalbnl=''
b4eb6b3d
JH
648d_select=''
649d_sem=''
650d_semctl=''
651d_semget=''
652d_semop=''
4e0554ec 653d_sendmsg=''
b4eb6b3d
JH
654d_setegid=''
655d_seteuid=''
656d_setgrent=''
10bc17b6
JH
657d_setgrent_r=''
658setgrent_r_proto=''
b4eb6b3d
JH
659d_setgrps=''
660d_sethent=''
10bc17b6
JH
661d_sethostent_r=''
662sethostent_r_proto=''
4e0554ec 663d_setitimer=''
b4eb6b3d
JH
664d_setlinebuf=''
665d_setlocale=''
10bc17b6
JH
666d_setlocale_r=''
667setlocale_r_proto=''
b4eb6b3d 668d_setnent=''
10bc17b6
JH
669d_setnetent_r=''
670setnetent_r_proto=''
b4eb6b3d
JH
671d_setpent=''
672d_setpgid=''
673d_setpgrp2=''
674d_bsdsetpgrp=''
675d_setpgrp=''
676d_setprior=''
677d_setproctitle=''
10bc17b6
JH
678d_setprotoent_r=''
679setprotoent_r_proto=''
b4eb6b3d 680d_setpwent=''
10bc17b6
JH
681d_setpwent_r=''
682setpwent_r_proto=''
b4eb6b3d
JH
683d_setregid=''
684d_setresgid=''
685d_setresuid=''
686d_setreuid=''
687d_setrgid=''
688d_setruid=''
689d_setsent=''
10bc17b6
JH
690d_setservent_r=''
691setservent_r_proto=''
b4eb6b3d
JH
692d_setsid=''
693d_setvbuf=''
694d_sfio=''
695usesfio=''
696d_shm=''
697d_shmat=''
698d_shmatprototype=''
699shmattype=''
700d_shmctl=''
701d_shmdt=''
702d_shmget=''
703d_sigaction=''
ed140128 704d_signbit=''
983dbef6 705d_sigprocmask=''
b4eb6b3d 706d_sigsetjmp=''
5f106f9c 707usesitecustomize=''
4f5da3e9
SP
708d_snprintf=''
709d_vsnprintf=''
49a78c82 710d_sockatmark=''
2ef53570 711d_sockatmarkproto=''
b4eb6b3d
JH
712d_msg_ctrunc=''
713d_msg_dontroute=''
714d_msg_oob=''
715d_msg_peek=''
716d_msg_proxy=''
717d_oldsock=''
718d_scm_rights=''
719d_socket=''
720d_sockpair=''
721sockethdr=''
722socketlib=''
723d_socklen_t=''
724d_socks5_init=''
360321b3 725d_sprintf_returns_strlen=''
b4eb6b3d 726d_sqrtl=''
10bc17b6
JH
727d_srand48_r=''
728srand48_r_proto=''
729d_srandom_r=''
730srandom_r_proto=''
eef837ea 731d_sresgproto=''
640374d0 732d_sresuproto=''
b4eb6b3d
JH
733d_statblks=''
734d_statfs_f_flags=''
735d_statfs_s=''
736d_fstatvfs=''
737d_statvfs=''
738d_stdio_cnt_lval=''
739d_stdio_ptr_lval=''
a7ffa9b9
NC
740d_stdio_ptr_lval_nochange_cnt=''
741d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
742d_stdiobase=''
743d_stdstdio=''
744stdio_base=''
745stdio_bufsiz=''
746stdio_cnt=''
747stdio_filbuf=''
748stdio_ptr=''
749d_index=''
750d_strchr=''
751d_strcoll=''
752d_strctcpy=''
753d_strerrm=''
754d_strerror=''
755d_sysernlst=''
756d_syserrlst=''
10bc17b6
JH
757d_strerror_r=''
758strerror_r_proto=''
b3c85772 759d_strftime=''
08c92000
MB
760d_strlcat=''
761d_strlcpy=''
b4eb6b3d
JH
762d_strtod=''
763d_strtol=''
764d_strtold=''
765d_strtoll=''
28e5dec8 766d_strtoq=''
b4eb6b3d
JH
767d_strtoul=''
768d_strtoull=''
769d_strtouq=''
770d_strxfrm=''
771d_symlink=''
772d_syscall=''
2ef53570 773d_syscallproto=''
b4eb6b3d
JH
774d_sysconf=''
775d_system=''
776d_tcgetpgrp=''
777d_tcsetpgrp=''
778d_telldirproto=''
779d_time=''
780timetype=''
781clocktype=''
782d_times=''
10bc17b6
JH
783d_tmpnam_r=''
784tmpnam_r_proto=''
b4eb6b3d 785d_truncate=''
10bc17b6
JH
786d_ttyname_r=''
787ttyname_r_proto=''
b4eb6b3d 788d_tzname=''
4e0554ec
JH
789d_u32align=''
790d_ualarm=''
b4eb6b3d
JH
791d_umask=''
792d_semctl_semid_ds=''
793d_semctl_semun=''
794d_union_semun=''
758a5d79 795d_unordered=''
bdf33aa7 796d_unsetenv=''
4e0554ec 797d_usleep=''
2ef53570 798d_usleepproto=''
b4eb6b3d 799d_ustat=''
233e16ce 800d_pseudofork=''
b4eb6b3d
JH
801d_vfork=''
802usevfork=''
803d_voidsig=''
804signal_t=''
805d_volatile=''
806d_charvspr=''
807d_vprintf=''
808d_wait4=''
809d_waitpid=''
810d_wcstombs=''
811d_wctomb=''
4e0554ec 812d_writev=''
b4eb6b3d 813dlext=''
85e6fe83
LW
814cccdlflags=''
815ccdlflags=''
2304df62 816dlsrc=''
232e078e 817ld=''
85e6fe83 818lddlflags=''
2304df62 819usedl=''
b4eb6b3d
JH
820doublesize=''
821ebcdic=''
822fflushNULL=''
823fflushall=''
824fpossize=''
825fpostype=''
2d736872 826gccansipedantic=''
5b463ca7 827gccosandvers=''
8a27cf78 828gccversion=''
b4eb6b3d
JH
829gidformat=''
830gidsign=''
831gidsize=''
832gidtype=''
833groupstype=''
834h_fcntl=''
835h_sysfile=''
6e1038e0
MB
836html1dir=''
837html1direxp=''
838installhtml1dir=''
839html3dir=''
840html3direxp=''
841installhtml3dir=''
b4eb6b3d 842i_arpainet=''
10bc17b6 843i_crypt=''
b4eb6b3d
JH
844db_hashtype=''
845db_prefixtype=''
640374d0
JH
846db_version_major=''
847db_version_minor=''
848db_version_patch=''
b4eb6b3d
JH
849i_db=''
850i_dbm=''
851i_rpcsvcdbm=''
852d_dirnamlen=''
853direntrytype=''
854i_dirent=''
a0d0e21e 855i_dld=''
b4eb6b3d
JH
856i_dlfcn=''
857i_fcntl=''
858i_float=''
758a5d79
JH
859i_fp=''
860i_fp_class=''
b4eb6b3d
JH
861i_gdbm=''
862d_grpasswd=''
863i_grp=''
b4eb6b3d
JH
864i_ieeefp=''
865i_inttypes=''
2765b840 866i_langinfo=''
b4eb6b3d
JH
867i_libutil=''
868i_limits=''
869i_locale=''
870i_machcthr=''
871i_malloc=''
872i_math=''
873i_memory=''
874i_mntent=''
875i_ndbm=''
876i_netdb=''
877i_neterrno=''
878i_netinettcp=''
879i_niin=''
880i_sysin=''
881i_poll=''
882i_prot=''
883i_pthread=''
884d_pwage=''
885d_pwchange=''
886d_pwclass=''
887d_pwcomment=''
888d_pwexpire=''
889d_pwgecos=''
890d_pwpasswd=''
891d_pwquota=''
892i_pwd=''
893i_sfio=''
894i_shadow=''
895i_socks=''
896i_stddef=''
897i_stdlib=''
898i_string=''
899strings=''
900i_sunmath=''
901i_sysaccess=''
902i_sysdir=''
903i_sysfile=''
904d_voidtty=''
905i_bsdioctl=''
906i_sysfilio=''
907i_sysioctl=''
908i_syssockio=''
909i_syslog=''
910i_sysmman=''
911i_sysmode=''
912i_sysmount=''
913i_sysndir=''
914i_sysparam=''
915i_sysresrc=''
916i_syssecrt=''
917i_sysselct=''
918i_sysstat=''
919i_sysstatfs=''
920i_sysstatvfs=''
921i_systimes=''
922i_systypes=''
923i_sysuio=''
924i_sysun=''
925i_sysutsname=''
926i_sysvfs=''
927i_syswait=''
928i_sgtty=''
929i_termio=''
930i_termios=''
14b90194
JH
931d_tm_tm_gmtoff=''
932d_tm_tm_zone=''
b4eb6b3d
JH
933i_systime=''
934i_systimek=''
935i_time=''
936timeincl=''
937i_unistd=''
938i_ustat=''
939i_utime=''
940i_values=''
941i_stdarg=''
942i_varargs=''
943i_varhdr=''
944i_vfork=''
f3f1a2d8 945d_inc_version_list=''
b4eb6b3d
JH
946inc_version_list=''
947inc_version_list_init=''
948installprefix=''
949installprefixexp=''
950installstyle=''
951installusrbinperl=''
952intsize=''
953longsize=''
954shortsize=''
4b661809 955issymlink=''
2304df62 956libc=''
b4eb6b3d
JH
957ldlibpthname=''
958libperl=''
959shrpenv=''
960useshrplib=''
a0d0e21e 961glibpth=''
2304df62 962libpth=''
8e07c86e 963loclibpth=''
2304df62
AD
964plibpth=''
965xlibpth=''
1cfa4ec7 966ignore_versioned_solibs=''
2304df62 967libs=''
43999f95
JH
968libsdirs=''
969libsfiles=''
970libsfound=''
13b3f787 971libspath=''
85e6fe83 972lns=''
b4eb6b3d
JH
973d_PRIEUldbl=''
974d_PRIFUldbl=''
975d_PRIGUldbl=''
976d_PRIeldbl=''
977d_PRIfldbl=''
978d_PRIgldbl=''
979d_SCNfldbl=''
980sPRIEUldbl=''
981sPRIFUldbl=''
982sPRIGUldbl=''
983sPRIeldbl=''
984sPRIfldbl=''
985sPRIgldbl=''
986sSCNfldbl=''
987lseeksize=''
988lseektype=''
d620c7b3 989mad=''
00e74f14
NC
990madlyh=''
991madlyobj=''
992madlysrc=''
f3f1a2d8
MB
993make_set_make=''
994d_mymalloc=''
995freetype=''
b4eb6b3d
JH
996mallocobj=''
997mallocsrc=''
998malloctype=''
9df442c2 999usemallocwrap=''
b4eb6b3d
JH
1000usemymalloc=''
1001installman1dir=''
1002man1dir=''
1003man1direxp=''
1004man1ext=''
1005installman3dir=''
1006man3dir=''
1007man3direxp=''
1008man3ext=''
1009modetype=''
1010multiarch=''
1011mydomain=''
1012myhostname=''
1013phostname=''
2304df62
AD
1014c=''
1015n=''
b4eb6b3d
JH
1016d_eofnblk=''
1017eagain=''
1018o_nonblock=''
1019rd_nodata=''
2cc61e15 1020need_va_copy=''
b4eb6b3d
JH
1021netdb_hlen_type=''
1022netdb_host_type=''
1023netdb_name_type=''
1024netdb_net_type=''
1025groupcat=''
1026hostcat=''
1027passcat=''
1028orderlib=''
1029ranlib=''
1030d_perl_otherlibdirs=''
1031otherlibdirs=''
2304df62
AD
1032package=''
1033spackage=''
b4eb6b3d
JH
1034pager=''
1035api_revision=''
1036api_subversion=''
1037api_version=''
1038api_versionstring=''
1039patchlevel=''
151e6568 1040perl_patchlevel=''
b4eb6b3d
JH
1041revision=''
1042subversion=''
1043version=''
861eb78d 1044version_patchlevel_string=''
b4eb6b3d
JH
1045perl5=''
1046perladmin=''
1047perlpath=''
1048d_nv_preserves_uv=''
f607920a 1049d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1050i16size=''
1051i16type=''
1052i32size=''
1053i32type=''
1054i64size=''
1055i64type=''
1056i8size=''
1057i8type=''
1058ivsize=''
1059ivtype=''
53133ed1 1060nv_preserves_uv_bits=''
b4eb6b3d
JH
1061nvsize=''
1062nvtype=''
1063u16size=''
1064u16type=''
1065u32size=''
1066u32type=''
1067u64size=''
1068u64type=''
1069u8size=''
1070u8type=''
1071uvsize=''
1072uvtype=''
1073ivdformat=''
1074nvEUformat=''
1075nvFUformat=''
1076nvGUformat=''
1077nveformat=''
1078nvfformat=''
1079nvgformat=''
1080uvXUformat=''
1081uvoformat=''
1082uvuformat=''
1083uvxformat=''
1084pidtype=''
1085prefix=''
1086prefixexp=''
1087installprivlib=''
1088privlib=''
1089privlibexp=''
1090prototype=''
1091ptrsize=''
1092d_PRIXU64=''
1093d_PRId64=''
1094d_PRIi64=''
1095d_PRIo64=''
1096d_PRIu64=''
1097d_PRIx64=''
1098sPRIXU64=''
1099sPRId64=''
1100sPRIi64=''
1101sPRIo64=''
1102sPRIu64=''
1103sPRIx64=''
1104d_quad=''
1105quadkind=''
1106quadtype=''
1107uquadtype=''
1108drand01=''
1109randbits=''
1110randfunc=''
1111randseedtype=''
1112seedfunc=''
1113installscript=''
1114scriptdir=''
1115scriptdirexp=''
1116selectminbits=''
1117selecttype=''
8ff267be 1118sh=''
b4eb6b3d
JH
1119sig_count=''
1120sig_name=''
1121sig_name_init=''
1122sig_num=''
1123sig_num_init=''
76d3c696 1124sig_size=''
f3f1a2d8 1125d_sitearch=''
b4eb6b3d
JH
1126installsitearch=''
1127sitearch=''
1128sitearchexp=''
1129installsitebin=''
1130sitebin=''
1131sitebinexp=''
8d2cbf27
JH
1132installsitehtml1dir=''
1133sitehtml1dir=''
1134sitehtml1direxp=''
1135installsitehtml3dir=''
1136sitehtml3dir=''
1137sitehtml3direxp=''
b4eb6b3d
JH
1138installsitelib=''
1139sitelib=''
1140sitelib_stem=''
1141sitelibexp=''
91e123a8
JH
1142installsiteman1dir=''
1143siteman1dir=''
1144siteman1direxp=''
1145installsiteman3dir=''
1146siteman3dir=''
1147siteman3direxp=''
b4eb6b3d
JH
1148siteprefix=''
1149siteprefixexp=''
6e1038e0
MB
1150installsitescript=''
1151sitescript=''
1152sitescriptexp=''
b4eb6b3d
JH
1153sizesize=''
1154sizetype=''
a0d0e21e 1155so=''
b4eb6b3d 1156socksizetype=''
2304df62
AD
1157sharpbang=''
1158shsharp=''
1159spitshell=''
dfe9444c 1160src=''
b4eb6b3d
JH
1161ssizetype=''
1162startperl=''
2304df62 1163startsh=''
b4eb6b3d
JH
1164stdchar=''
1165d_stdio_stream_array=''
1166stdio_stream_array=''
1167sysman=''
5ff3f7a4 1168trnl=''
b4eb6b3d
JH
1169uidformat=''
1170uidsign=''
1171uidsize=''
1172uidtype=''
1173archname64=''
1174use64bitall=''
1175use64bitint=''
15b61c98 1176usefaststdio=''
b4eb6b3d
JH
1177ccflags_uselargefiles=''
1178ldflags_uselargefiles=''
1179libswanted_uselargefiles=''
1180uselargefiles=''
1181uselongdouble=''
1182usemorebits=''
1183usemultiplicity=''
2304df62 1184nm_opt=''
40a7a20a 1185nm_so_opt=''
2304df62
AD
1186runnm=''
1187usenm=''
b4eb6b3d 1188useperlio=''
29209bc5 1189usesocks=''
b4eb6b3d
JH
1190d_oldpthreads=''
1191use5005threads=''
1192useithreads=''
9514c62b 1193usereentrant=''
b4eb6b3d 1194usethreads=''
2304df62 1195incpath=''
2304df62
AD
1196mips_type=''
1197usrinc=''
b4eb6b3d
JH
1198d_vendorarch=''
1199installvendorarch=''
1200vendorarch=''
1201vendorarchexp=''
1202d_vendorbin=''
1203installvendorbin=''
1204vendorbin=''
1205vendorbinexp=''
8d2cbf27
JH
1206installvendorhtml1dir=''
1207vendorhtml1dir=''
1208vendorhtml1direxp=''
1209installvendorhtml3dir=''
1210vendorhtml3dir=''
1211vendorhtml3direxp=''
b4eb6b3d
JH
1212d_vendorlib=''
1213installvendorlib=''
1214vendorlib=''
1215vendorlib_stem=''
1216vendorlibexp=''
91e123a8
JH
1217installvendorman1dir=''
1218vendorman1dir=''
1219vendorman1direxp=''
1220installvendorman3dir=''
1221vendorman3dir=''
1222vendorman3direxp=''
b4eb6b3d
JH
1223usevendorprefix=''
1224vendorprefix=''
1225vendorprefixexp=''
6e1038e0
MB
1226d_vendorscript=''
1227installvendorscript=''
1228vendorscript=''
1229vendorscriptexp=''
d56c5707 1230versiononly=''
b4eb6b3d
JH
1231defvoidused=''
1232voidflags=''
3659ebf1
JH
1233yacc=''
1234yaccflags=''
2304df62
AD
1235CONFIG=''
1236
ecfc5424
AD
1237define='define'
1238undef='undef'
1239smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1240rmlist=''
1241
1242: We must find out about Eunice early
1243eunicefix=':'
1244if test -f /etc/unixtovms; then
1245 eunicefix=/etc/unixtovms
1246fi
1247if test -f /etc/unixtovms.exe; then
1248 eunicefix=/etc/unixtovms.exe
1249fi
1250
cfb04860 1251: Set executable suffix now -- needed before hints available
6153ba32
PG
1252if test -f "/libs/version.library"; then
1253: Amiga OS
1254 _exe=""
1255elif test -f "/system/gnu_library/bin/ar.pm"; then
1256: Stratus VOS
cfb04860 1257 _exe=".pm"
6153ba32
PG
1258elif test -n "$DJGPP"; then
1259: DOS DJGPP
cfb04860 1260 _exe=".exe"
5c728af0 1261elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1262: OS/2 or cygwin
ba863942
JH
1263 _exe=".exe"
1264fi
868439a2 1265
b4eb6b3d 1266i_whoami=''
9da7673b
MB
1267: Trailing extension. Override this in a hint file, if needed.
1268: Extra object files, if any, needed on this platform.
1269archobjs=''
1270archname=''
b4eb6b3d 1271groupstype=''
64615a5e 1272libnames=''
732c9516
JH
1273: change the next line if compiling for Xenix/286 on Xenix/386
1274xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1275: Possible local library directories to search.
1276loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1277loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1278
1279: general looking path for locating libraries
5869b1f1 1280glibpth="/lib /usr/lib $xlibpth"
732c9516 1281glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1282test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1283test -f /shlib/libc.so && glibpth="/shlib $glibpth"
faae14e6 1284test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
732c9516
JH
1285
1286: Private path used by Configure to find libraries. Its value
1287: is prepended to libpth. This variable takes care of special
1288: machines, like the mips. Usually, it should be empty.
1289plibpth=''
1290
1cfa4ec7
GS
1291: default library list
1292libswanted=''
921b2963 1293: some systems want to use only the non-versioned libso:s
1cfa4ec7 1294ignore_versioned_solibs=''
9da7673b
MB
1295siteman1dir=''
1296siteman3dir=''
1297sitescript=''
ed140128
AD
1298: set usethreads on the Configure command line to enable threads.
1299usereentrant='undef'
1300: full support for void wanted by default
1301defvoidused=15
1302
1303: Possible local include directories to search.
1304: Set locincpth to "" in a hint file to defeat local include searches.
1305locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1306locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1307:
1308: no include file wanted by default
1309inclwanted=''
1310
1311: Enable -DEBUGGING and -DDEBUGGING from the command line
1312EBUGGING=''
1313DEBUGGING=old
1314
1315ccname=''
1316ccversion=''
1317perllibs=''
1318: set useposix=false in your hint file to disable the POSIX extension.
1319useposix=true
1320: set useopcode=false in your hint file to disable the Opcode extension.
1321useopcode=true
b4eb6b3d
JH
1322archname64=''
1323ccflags_uselargefiles=''
1324ldflags_uselargefiles=''
1325libswanted_uselargefiles=''
1326: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1327: set usesocks on the Configure command line to enable socks.
ecfc5424 1328: List of libraries we want.
15431986 1329: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1330libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1331libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1332: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1333: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1334glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1335glibpth="/usr/shlib $glibpth"
1336: Do not use vfork unless overridden by a hint file.
1337usevfork=false
1338
8ff267be 1339: Find the basic shell for Bourne shell scripts
1340case "$sh" in
1341'')
8ff267be 1342 case "$SYSTYPE" in
1343 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1344 *) xxx='/bin/sh';;
1345 esac
1346 if test -f "$xxx"; then
1347 sh="$xxx"
1348 else
1349 : Build up a list and do a single loop so we can 'break' out.
1350 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1351 for xxx in sh bash ksh pdksh ash; do
1352 for p in $pth; do
1353 try="$try ${p}/${xxx}"
1354 done
1355 done
1356 for xxx in $try; do
1357 if test -f "$xxx"; then
1358 sh="$xxx";
8ff267be 1359 break
a5a94ea5
JH
1360 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1361 sh="$xxx";
1362 break
8ff267be 1363 elif test -f "$xxx.exe"; then
1364 sh="$xxx";
8ff267be 1365 break
1366 fi
1367 done
1368 fi
1369 ;;
1370esac
1371
1372case "$sh" in
a33c94aa 1373'') cat >&2 <<EOM
8ff267be 1374$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1375
8ff267be 1376Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1377Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1378we'll try to straighten this all out.
8ff267be 1379EOM
1380 exit 1
1381 ;;
1382esac
1383
760ac839 1384: see if sh knows # comments
73614538 1385if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1386 shsharp=true
1387 spitshell=cat
760ac839 1388 xcat=/bin/cat
a931254c
JH
1389 test -f $xcat$_exe || xcat=/usr/bin/cat
1390 if test ! -f $xcat$_exe; then
4bdb8fb5 1391 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1392 if test -f $p/cat$_exe; then
1deb0a86 1393 xcat=$p/cat
3c728e00
JH
1394 break
1395 fi
1396 done
1deb0a86
JH
1397 if test ! -f $xcat$_exe; then
1398 echo "Can't find cat anywhere!"
3c728e00
JH
1399 exit 1
1400 fi
1401 fi
5440bc8e
JH
1402 echo "#!$xcat" >sharp
1403 $eunicefix sharp
1404 chmod +x sharp
1405 ./sharp > today
760ac839 1406 if test -s today; then
760ac839
LW
1407 sharpbang='#!'
1408 else
5440bc8e
JH
1409 echo "#! $xcat" > sharp
1410 $eunicefix sharp
1411 chmod +x sharp
1412 ./sharp > today
760ac839 1413 if test -s today; then
760ac839
LW
1414 sharpbang='#! '
1415 else
760ac839
LW
1416 sharpbang=': use '
1417 fi
1418 fi
1419else
dfe9444c 1420 echo " "
8ff267be 1421 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1422 shsharp=false
1423 cd ..
1424 echo "exec grep -v '^[ ]*#'" >spitshell
1425 chmod +x spitshell
1426 $eunicefix spitshell
1427 spitshell=`pwd`/spitshell
1428 cd UU
1429 echo "I presume that if # doesn't work, #! won't work either!"
1430 sharpbang=': use '
1431fi
5440bc8e 1432rm -f sharp today
760ac839
LW
1433
1434: figure out how to guarantee sh startup
8ff267be 1435case "$startsh" in
1436'') startsh=${sharpbang}${sh} ;;
1437*)
760ac839 1438esac
5440bc8e 1439cat >sharp <<EOSS
760ac839
LW
1440$startsh
1441set abc
1442test "$?abc" != 1
1443EOSS
1444
5440bc8e
JH
1445chmod +x sharp
1446$eunicefix sharp
1447if ./sharp; then
8ff267be 1448 : echo "Yup, it does."
760ac839 1449else
dfe9444c
AD
1450 echo "Hmm... '$startsh' does not guarantee sh startup..."
1451 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1452fi
5440bc8e 1453rm -f sharp
760ac839 1454
aebf16e7
AD
1455
1456: Save command line options in file UU/cmdline.opt for later use in
1457: generating config.sh.
1458cat > cmdline.opt <<EOSH
1459# Configure command line arguments.
1460config_arg0='$0'
1461config_args='$*'
1462config_argc=$#
1463EOSH
1464argn=1
ee45ea83
IZ
1465args_exp=''
1466args_sep=''
aebf16e7
AD
1467for arg in "$@"; do
1468 cat >>cmdline.opt <<EOSH
1469config_arg$argn='$arg'
1470EOSH
ee45ea83
IZ
1471 # Extreme backslashitis: replace each ' by '"'"'
1472 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1473$arg
1474EOC
1475 arg_exp=`cat cmdl.opt`
1476 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1477 argn=`expr $argn + 1`
ee45ea83 1478 args_sep=' '
aebf16e7 1479done
ee45ea83
IZ
1480# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1481# used by ./hints/os2.sh
1482rm -f cmdl.opt
aebf16e7 1483
2304df62
AD
1484: produce awk script to parse command line options
1485cat >options.awk <<'EOF'
1486BEGIN {
02e93a22 1487 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1488
1489 len = length(optstr);
1490 for (i = 1; i <= len; i++) {
1491 c = substr(optstr, i, 1);
1492 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1493 if (a == ":") {
1494 arg[c] = 1;
1495 i++;
1496 }
1497 opt[c] = 1;
1498 }
1499}
1500{
1501 expect = 0;
1502 str = $0;
1503 if (substr(str, 1, 1) != "-") {
1504 printf("'%s'\n", str);
1505 next;
1506 }
1507 len = length($0);
1508 for (i = 2; i <= len; i++) {
1509 c = substr(str, i, 1);
1510 if (!opt[c]) {
1511 printf("-%s\n", substr(str, i));
1512 next;
1513 }
1514 printf("-%s\n", c);
1515 if (arg[c]) {
1516 if (i < len)
1517 printf("'%s'\n", substr(str, i + 1));
1518 else
1519 expect = 1;
1520 next;
1521 }
1522 }
1523}
1524END {
1525 if (expect)
1526 print "?";
1527}
1528EOF
1529
1530: process the command line options
4633a7c4
LW
1531set X `for arg in "$@"; do echo "X$arg"; done |
1532 sed -e s/X// | awk -f options.awk`
2304df62
AD
1533eval "set $*"
1534shift
1535rm -f options.awk
1536
1537: set up default values
1538fastread=''
1539reuseval=false
1540config_sh=''
1541alldone=''
1542error=''
1543silent=''
1544extractsh=''
ecfc5424 1545override=''
16d20bd9 1546knowitall=''
02e93a22 1547rm -f optdef.sh posthint.sh
28757baa 1548cat >optdef.sh <<EOS
1549$startsh
1550EOS
2304df62 1551
dfe9444c 1552
2304df62
AD
1553: option parsing
1554while test $# -gt 0; do
1555 case "$1" in
1556 -d) shift; fastread=yes;;
1557 -e) shift; alldone=cont;;
1558 -f)
1559 shift
1560 cd ..
1561 if test -r "$1"; then
1562 config_sh="$1"
1563 else
a0d0e21e 1564 echo "$me: cannot read config file $1." >&2
2304df62
AD
1565 error=true
1566 fi
1567 cd UU
1568 shift;;
3f30fabf 1569 --help|\
2304df62
AD
1570 -h) shift; error=true;;
1571 -r) shift; reuseval=true;;
dfe9444c 1572 -s) shift; silent=true; realsilent=true;;
2304df62 1573 -E) shift; alldone=exit;;
16d20bd9 1574 -K) shift; knowitall=true;;
ecfc5424 1575 -O) shift; override=true;;
dfe9444c 1576 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1577 -D)
1578 shift
1579 case "$1" in
1580 *=)
1581 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1582 echo "$me: ignoring -D $1" >&2
1583 ;;
ecfc5424 1584 *=*) echo "$1" | \
1aef975c
AD
1585 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1586 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1587 esac
1588 shift
1589 ;;
1590 -U)
1591 shift
1592 case "$1" in
1aef975c 1593 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1594 *=*)
1595 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1596 echo "$me: ignoring -U $1" >&2
1597 ;;
1aef975c 1598 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1599 esac
1600 shift
1601 ;;
02e93a22
JH
1602 -A)
1603 shift
1604 xxx=''
1605 yyy="$1"
02e93a22 1606 zzz=''
5f83a3e9 1607 uuu=undef
02e93a22 1608 case "$yyy" in
f7c31117 1609 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1610 case "$zzz" in
1611 *:*) zzz='' ;;
1612 *) xxx=append
f7c31117
JH
1613 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1614 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1615 esac
1616 ;;
1617 esac
1618 case "$xxx" in
1619 '') case "$yyy" in
f7c31117
JH
1620 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1621 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1622 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1623 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1624 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1625 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1626 esac
1627 ;;
1628 esac
02e93a22
JH
1629 case "$xxx" in
1630 append)
5f83a3e9 1631 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1632 clear)
5f83a3e9 1633 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1634 define)
1635 case "$zzz" in
1636 '') zzz=define ;;
1637 esac
5f83a3e9 1638 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1639 eval)
5f83a3e9 1640 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1641 prepend)
5f83a3e9 1642 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1643 undef)
1644 case "$zzz" in
1645 '') zzz="$uuu" ;;
1646 esac
5f83a3e9
JH
1647 echo "$yyy=$zzz" >> posthint.sh ;;
1648 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1649 esac
bde6b06b 1650 shift
02e93a22 1651 ;;
dfe9444c 1652 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1653 exit 0;;
2304df62 1654 --) break;;
a0d0e21e 1655 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1656 *) break;;
1657 esac
1658done
1659
1660case "$error" in
1661true)
1662 cat >&2 <<EOM
2afac517 1663Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1664 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1665 -d : use defaults for all answers.
1666 -e : go on without questioning past the production of config.sh.
1667 -f : specify an alternate default configuration file.
1668 -h : print this help message and exit (with an error status).
1669 -r : reuse C symbols value if possible (skips costly nm extraction).
1670 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1671 -D : define symbol to have some value:
1672 -D symbol symbol gets the value 'define'
1673 -D symbol=value symbol gets the value 'value'
3f30fabf
MB
1674 common used examples (see INSTALL for more info):
1675 -Duse64bitint use 64bit integers
b79e0b55 1676 -Duse64bitall use 64bit integers and pointers
3f30fabf 1677 -Dusethreads use thread support
b79e0b55 1678 -Dinc_version_list=none do not include older perl trees in @INC
3f30fabf
MB
1679 -DEBUGGING=none DEBUGGING options
1680 -Dcc=gcc choose your compiler
1681 -Dprefix=/opt/perl5 choose your destination
2304df62 1682 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1683 -K : do not use unless you know what you are doing.
ecfc5424 1684 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1685 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1686 -U : undefine symbol:
1687 -U symbol symbol gets the value 'undef'
1688 -U symbol= symbol gets completely empty
3f30fabf 1689 e.g.: -Uversiononly
02e93a22 1690 -A : manipulate symbol after the platform specific hints have been applied:
2ac814f3
MB
1691 -A append:symbol=value append value to symbol
1692 -A symbol=value like append:, but with a separating space
1693 -A define:symbol=value define symbol to have value
1694 -A clear:symbol define symbol to be ''
1695 -A define:symbol define symbol to be 'define'
1696 -A eval:symbol=value define symbol to be eval of value
1697 -A prepend:symbol=value prepend value to symbol
1698 -A undef:symbol define symbol to be 'undef'
1699 -A undef:symbol= define symbol to be ''
3f30fabf 1700 e.g.: -A prepend:libswanted='cl pthread '
2ac814f3 1701 -A ccflags=-DSOME_MACRO
2304df62
AD
1702 -V : print version number and exit (with a zero status).
1703EOM
1704 exit 1
1705 ;;
1706esac
1707
dfe9444c
AD
1708: Sanity checks
1709case "$fastread$alldone" in
1710yescont|yesexit) ;;
1711*)
aaeb8e51
GS
1712 case "$extractsh" in
1713 true) ;;
1714 *)
1715 if test ! -t 0; then
1716 echo "Say 'sh Configure', not 'sh <Configure'"
1717 exit 1
1718 fi
1719 ;;
1720 esac
dfe9444c
AD
1721 ;;
1722esac
1723
2304df62
AD
1724exec 4>&1
1725case "$silent" in
1726true) exec 1>/dev/null;;
1727esac
1728
ecfc5424 1729: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1730touch optdef.sh
1731. ./optdef.sh
02e93a22
JH
1732: create the posthint manipulation script and leave the file out there...
1733touch posthint.sh
a0d0e21e 1734
2304df62 1735: set package name
85e6fe83 1736package=perl5
b4eb6b3d
JH
1737first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1738last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1739case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1740ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1741*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1742esac
2304df62 1743
2304df62
AD
1744: Some greps do not return status, grrr.
1745echo "grimblepritz" >grimble
1746if grep blurfldyick grimble >/dev/null 2>&1 ; then
1747 contains=contains
1748elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1749 contains=grep
1750else
1751 contains=contains
1752fi
1753rm -f grimble
1754: the following should work in any shell
1755case "$contains" in
1756contains*)
1757 echo " "
1758 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1759 cat >contains <<'EOSS'
1760grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1761EOSS
1762chmod +x contains
1763esac
1764
dfe9444c
AD
1765: Find the path to the source tree
1766case "$src" in
1767'') case "$0" in
b233458b
JH
1768 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1769 case "$src" in
1770 /*) ;;
8504afb7 1771 .) ;;
b233458b
JH
1772 *) src=`cd ../$src && pwd` ;;
1773 esac
1774 ;;
dfe9444c
AD
1775 *) src='.';;
1776 esac;;
1777esac
1778case "$src" in
1779'') src=/
1780 rsrc=/
1781 ;;
1782/*) rsrc="$src";;
1783*) rsrc="../$src";;
1784esac
1785if test -f $rsrc/Configure && \
1786 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1787then
1788 : found it, so we are ok.
1789else
1790 rsrc=''
1791 for src in . .. ../.. ../../.. ../../../..; do
1792 if test -f ../$src/Configure && \
1793 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1794 then
1795 rsrc=../$src
1796 break
1797 fi
1798 done
1799fi
1800case "$rsrc" in
1801'')
1802 cat <<EOM >&4
1803
1804Sorry, I can't seem to locate the source dir for $package. Please start
1805Configure with an explicit path -- i.e. /some/path/Configure.
1806
1807EOM
1808 exit 1
1809 ;;
1810../.) rsrc='..';;
1811*)
1812 echo " "
1813 echo "Sources for $package found in \"$src\"." >&4
1814 ;;
1815esac
1816
1817: script used to extract .SH files with variable substitutions
1818cat >extract <<'EOS'
a02608de 1819PERL_CONFIG_SH=true
dfe9444c 1820echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1821if test -f MANIFEST; then
1822 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1823else
1824 echo "(Looking for .SH files under the source directory.)"
6904989c 1825 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1826fi
1827shift
1828case $# in
6904989c 18290) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1830esac
6904989c 1831if test ! -f "$src/$1"; then
dfe9444c
AD
1832 shift
1833fi
1834mkdir_p='
1835name=$1;
1836create="";
1837while test $name; do
1838 if test ! -d "$name"; then
1839 create="$name $create";
1840 name=`echo $name | sed -e "s|^[^/]*$||"`;
1841 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1842 else
1843 name="";
1844 fi;
1845done;
1846for file in $create; do
1847 mkdir $file;
1848done
1849'
1850for file in $*; do
1851 case "$src" in
1852 ".")
1853 case "$file" in
1854 */*)
1855 dir=`expr X$file : 'X\(.*\)/'`
1856 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1857 (cd "$dir" && . ./$file)
dfe9444c
AD
1858 ;;
1859 *)
1860 . ./$file
1861 ;;
1862 esac
1863 ;;
1864 *)
1865 case "$file" in
1866 */*)
1867 dir=`expr X$file : 'X\(.*\)/'`
1868 file=`expr X$file : 'X.*/\(.*\)'`
1869 (set x $dir; shift; eval $mkdir_p)
6904989c 1870 sh <"$src/$dir/$file"
dfe9444c
AD
1871 ;;
1872 *)
6904989c 1873 sh <"$src/$file"
dfe9444c
AD
1874 ;;
1875 esac
1876 ;;
1877 esac
1878done
6904989c 1879if test -f "$src/config_h.SH"; then
dfe9444c
AD
1880 if test ! -f config.h; then
1881 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1882 . "$src/config_h.SH"
dfe9444c
AD
1883 fi
1884fi
1885EOS
1886
1887: extract files and exit if asked to do so
1888case "$extractsh" in
1889true)
1890 case "$realsilent" in
1891 true) ;;
1892 *) exec 1>&4;;
1893 esac
1894 case "$config_sh" in
1895 '') config_sh='config.sh';;
1896 esac
1897 echo " "
1898 echo "Fetching answers from $config_sh..."
1899 cd ..
1900 . $config_sh
1901 test "$override" && . ./optdef.sh
1902 echo " "
1903 . UU/extract
1904 rm -rf UU
24ccb310 1905 echo "Extraction done."
dfe9444c
AD
1906 exit 0
1907 ;;
1908esac
1909
1910: Eunice requires " " instead of "", can you believe it
1911echo " "
1912: Here we go...
1913echo "Beginning of configuration questions for $package."
1914
1915trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1916
2304df62
AD
1917: first determine how to suppress newline on echo command
1918echo " "
1919echo "Checking echo to see how to suppress newlines..."
1920(echo "hi there\c" ; echo " ") >.echotmp
1921if $contains c .echotmp >/dev/null 2>&1 ; then
1922 echo "...using -n."
1923 n='-n'
1924 c=''
1925else
1926 cat <<'EOM'
1927...using \c
1928EOM
1929 n=''
1930 c='\c'
1931fi
1932echo $n "The star should be here-->$c"
1933echo '*'
1934rm -f .echotmp
1935
1936: Now test for existence of everything in MANIFEST
1937echo " "
6904989c 1938if test -f "$rsrc/MANIFEST"; then
2304df62 1939 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1940 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1941 rm -f missing
dfe9444c 1942 tmppwd=`pwd`
2304df62 1943 for filelist in x??; do
6904989c 1944 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1945 done
1946 if test -s missing; then
1947 cat missing >&4
1948 cat >&4 <<'EOM'
1949
1950THIS PACKAGE SEEMS TO BE INCOMPLETE.
1951
1952You have the option of continuing the configuration process, despite the
1953distinct possibility that your kit is damaged, by typing 'y'es. If you
1954do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1955and contact the author (perlbug@perl.org).
2304df62
AD
1956
1957EOM
1958 echo $n "Continue? [n] $c" >&4
1959 read ans
1960 case "$ans" in
1961 y*)
1962 echo "Continuing..." >&4
1963 rm -f missing
1964 ;;
1965 *)
1966 echo "ABORTING..." >&4
1967 kill $$
1968 ;;
1969 esac
1970 else
dfe9444c 1971 echo "Looks good..."
2304df62
AD
1972 fi
1973else
1974 echo "There is no MANIFEST file. I hope your kit is complete !"
1975fi
1976rm -f missing x??
1977
5ff3f7a4
GS
1978echo " "
1979: Find the appropriate value for a newline for tr
1980if test -n "$DJGPP"; then
1981 trnl='\012'
1982fi
1983if test X"$trnl" = X; then
1984 case "`echo foo|tr '\n' x 2>/dev/null`" in
1985 foox) trnl='\n' ;;
1986 esac
1987fi
1988if test X"$trnl" = X; then
1989 case "`echo foo|tr '\012' x 2>/dev/null`" in
1990 foox) trnl='\012' ;;
1991 esac
1992fi
1993if test X"$trnl" = X; then
8be2c24c
JH
1994 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1995 fooxy) trnl='\n\r' ;;
1996 esac
1997fi
1998if test X"$trnl" = X; then
5ff3f7a4
GS
1999 cat <<EOM >&2
2000
2001$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2002
2003EOM
2004 exit 1
2005fi
2006
2304df62
AD
2007: compute the number of columns on the terminal for proper question formatting
2008case "$COLUMNS" in
2009'') COLUMNS='80';;
2010esac
2011
2012: set up the echo used in my read
2013myecho="case \"\$xxxm\" in
2014'') echo $n \"\$rp $c\" >&4;;
2015*) case \"\$rp\" in
2016 '') echo $n \"[\$xxxm] $c\";;
2017 *)
2018 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2019 echo \"\$rp\" >&4
2020 echo $n \"[\$xxxm] $c\" >&4
2021 else
2022 echo $n \"\$rp [\$xxxm] $c\" >&4
2023 fi
2024 ;;
2025 esac;;
2026esac"
2027
2028: now set up to do reads with possible shell escape and default assignment
2029cat <<EOSC >myread
28757baa 2030$startsh
2304df62
AD
2031xxxm=\$dflt
2032$myecho
2033ans='!'
2034case "\$fastread" in
2035yes) case "\$dflt" in
2036 '') ;;
2037 *) ans='';
2038 case "\$silent-\$rp" in
2039 true-) ;;
2040 *) echo " " >&4;;
2041 esac;;
2042 esac;;
2043*) case "\$silent" in
2044 true) case "\$rp" in
2045 '') ans='';;
2046 esac;;
2047 esac;;
2048esac
2049while expr "X\$ans" : "X!" >/dev/null; do
2050 read answ
2051 set x \$xxxm
2052 shift
dfe9444c 2053 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2054 case "\$answ" in
dfe9444c
AD
2055 "!")
2056 sh 1>&4
2057 echo " "
2058 $myecho
2059 ;;
2060 !*)
2061 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2062 shift
2063 sh 1>&4 -c "\$*"
2064 echo " "
2065 $myecho
2066 ;;
2304df62
AD
2067 "\$ans")
2068 case "\$ans" in
ecfc5424
AD
2069 \\&*)
2070 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2071 shift
2072 case "\$1" in
2073 -d)
2074 fastread=yes
40a7a20a 2075 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2076 ;;
2077 -*)
40a7a20a 2078 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2079 ;;
2080 esac
2081 $myecho
2082 ans=!
2083 ;;
2304df62
AD
2084 esac;;
2085 *)
2086 case "\$aok" in
2087 y)
2088 echo "*** Substitution done -- please confirm."
2089 xxxm="\$ans"
c9795ab7 2090 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2091 xxxm="\$ans"
2092 ans=!
2093 ;;
2094 *)
2095 echo "*** Error -- try again."
2096 ans=!
2097 ;;
2098 esac
2099 $myecho
2100 ;;
2101 esac
2102 case "\$ans\$xxxm\$nostick" in
2103 '')
2104 ans=!
2105 $myecho
2106 ;;
2107 esac
2108done
2109case "\$ans" in
2110'') ans="\$xxxm";;
2111esac
2112EOSC
2113
2114: create .config dir to save info across Configure sessions
2115test -d ../.config || mkdir ../.config
2116cat >../.config/README <<EOF
2117This directory created by Configure to save information that should
dfe9444c 2118persist across sessions for $package.
2304df62
AD
2119
2120You may safely delete it if you wish.
2121EOF
2122
9507cadf 2123xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2124case "$usedevel" in
0107c034 2125$define|true|[yY]*) ;;
9507cadf 2126*) case "$xversion" in
0107c034
JH
2127 *[13579])
2128 cat >&4 <<EOH
2129*** WHOA THERE!!! ***
2130
2131 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2132 The version of this $package distribution is $xversion, that is, odd,
2133 (as opposed to even) and that signifies a development release.
3d5d58b1 2134 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2135
2136 Do ***NOT*** install this into production use.
2137 Data corruption and crashes are possible.
2138
2139 It is most seriously suggested that you do not continue any further
2140 unless you want to help in developing and debugging Perl.
2141
6adc6a45
JH
2142 If you *still* want to build perl, you can answer 'y' now,
2143 or pass -Dusedevel to Configure.
2144
0107c034
JH
2145EOH
2146 rp='Do you really want to continue?'
2147 dflt='n'
2148 . ./myread
2149 case "$ans" in
8feeef0e
JH
2150 [yY]) echo >&4 "Okay, continuing."
2151 usedevel="$define" ;;
0107c034
JH
2152 *) echo >&4 "Okay, bye."
2153 exit 1
2154 ;;
2155 esac
2156 ;;
2157 esac
2158 ;;
2159esac
8feeef0e
JH
2160case "$usedevel" in
2161$define|true|[yY]*)
2162 case "$versiononly" in
2163 '') versiononly="$define" ;;
2164 esac
2165 case "$installusrbinperl" in
2166 '') installusrbinperl="$undef" ;;
2167 esac
2168 ;;
2169esac
0107c034 2170
2304df62
AD
2171: general instructions
2172needman=true
2173firsttime=true
760ac839 2174user=`(logname) 2>/dev/null`
dfe9444c
AD
2175case "$user" in
2176'') user=`whoami 2>&1`;;
760ac839 2177esac
2304df62
AD
2178if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2179 firsttime=false
2180 echo " "
2181 rp='Would you like to see the instructions?'
2182 dflt=n
2183 . ./myread
2184 case "$ans" in
2185 [yY]*) ;;
2186 *) needman=false;;
2187 esac
2188fi
2189if $needman; then
2190 cat <<EOH
4e2a5f63 2191
2304df62 2192This installation shell script will examine your system and ask you questions
a0d0e21e 2193to determine how the perl5 package should be installed. If you get
2304df62
AD
2194stuck on a question, you may use a ! shell escape to start a subshell or
2195execute a command. Many of the questions will have default answers in square
2196brackets; typing carriage return will give you the default.
2197
2198On some of the questions which ask for file or directory names you are allowed
2199to use the ~name construct to specify the login directory belonging to "name",
2200even if you don't have a shell which knows about that. Questions where this is
2201allowed will be marked "(~name ok)".
2202
2203EOH
2204 rp=''
2205 dflt='Type carriage return to continue'
2206 . ./myread
2207 cat <<'EOH'
2208
2209The prompter used in this script allows you to use shell variables and
2210backticks in your answers. You may use $1, $2, etc... to refer to the words
2211in the default answer, as if the default line was a set of arguments given to a
2212script shell. This means you may also use $* to repeat the whole default line,
2213so you do not have to re-type everything to add something to the default.
2214
2215Everytime there is a substitution, you will have to confirm. If there is an
2216error (e.g. an unmatched backtick), the default answer will remain unchanged
2217and you will be prompted again.
2218
2219If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2220the questions and use the computed defaults (or the previous answers if there
2221was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2222You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2223on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2224
2225EOH
2226 . ./myread
2227 cat <<EOH
2228
2229Much effort has been expended to ensure that this shell script will run on any
2230Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2231Configure and run it again. If you can't run Configure for some reason,
2232you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2233have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2234
2235This installation script affects things in two ways:
2236
22371) it may do direct variable substitutions on some of the files included
2238 in this kit.
22392) it builds a config.h file for inclusion in C programs. You may edit
2240 any of these files as the need arises after running this script.
2241
2242If you make a mistake on a question, there is no easy way to back up to it
2243currently. The easiest thing to do is to edit config.sh and rerun all the SH
2244files. Configure will offer to let you do this before it runs the SH files.
2245
2246EOH
2247 dflt='Type carriage return to continue'
2248 . ./myread
2249 case "$firsttime" in
2250 true) echo $user >>../.config/instruct;;
2251 esac
2252fi
2253
2304df62
AD
2254: find out where common programs are
2255echo " "
2256echo "Locating common programs..." >&4
2257cat <<EOSC >loc
2258$startsh
2259case \$# in
22600) exit 1;;
2261esac
2262thing=\$1
2263shift
2264dflt=\$1
2265shift
2266for dir in \$*; do
2267 case "\$thing" in
2268 .)
2269 if test -d \$dir/\$thing; then
2270 echo \$dir
2271 exit 0
2272 fi
2273 ;;
2274 *)
a0d0e21e 2275 for thisthing in \$dir/\$thing; do
ecfc5424 2276 : just loop through to pick last item
a0d0e21e 2277 done
25f94b33 2278 if test -f \$thisthing; then
a0d0e21e 2279 echo \$thisthing
2304df62 2280 exit 0
a5a94ea5
JH
2281 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2282 echo \$thisthing
2283 exit 0
2304df62 2284 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2285 if test -n "$DJGPP"; then
2286 echo \$dir/\$thing.exe
b921d661 2287 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2288 : on Eunice apparently
2289 echo \$dir/\$thing
b921d661 2290 exit 0
c4f23d77 2291 fi
2d736872 2292 exit 0
2304df62
AD
2293 fi
2294 ;;
2295 esac
2296done
2297echo \$dflt
2298exit 1
2299EOSC
2300chmod +x loc
2301$eunicefix loc
2302loclist="
2303awk
2304cat
f8006fac 2305chmod
b4eb6b3d
JH
2306comm
2307cp
2304df62
AD
2308echo
2309expr
2310grep
a0d0e21e 2311ls
b4eb6b3d 2312mkdir
2304df62
AD
2313rm
2314sed
b4eb6b3d 2315sort
85e6fe83 2316touch
2304df62 2317tr
b4eb6b3d 2318uniq
2304df62
AD
2319"
2320trylist="
2321Mcc
dfe9444c 2322ar
3659ebf1 2323bison
b4eb6b3d 2324byacc
2304df62 2325cpp
b4eb6b3d 2326csh
2304df62
AD
2327date
2328egrep
1fef16b3 2329gmake
8ff267be 2330gzip
b4eb6b3d 2331less
8ff267be 2332ln
3c728e00 2333make
b4eb6b3d 2334more
693762b4 2335nm
b4eb6b3d
JH
2336nroff
2337pg
2304df62
AD
2338test
2339uname
8ff267be 2340zip
2304df62 2341"
8e07c86e 2342pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2343pth="$pth /lib /usr/lib"
2344for file in $loclist; do
dfe9444c
AD
2345 eval xxx=\$$file
2346 case "$xxx" in
2347 /*|?:[\\/]*)
2348 if test -f "$xxx"; then
2349 : ok
2350 else
2351 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352 xxx=`./loc $file $file $pth`
2353 fi
2354 ;;
2355 '') xxx=`./loc $file $file $pth`;;
2356 *) xxx=`./loc $xxx $xxx $pth`;;
2357 esac
a5a94ea5 2358 eval $file=$xxx$_exe
2304df62
AD
2359 eval _$file=$xxx
2360 case "$xxx" in
2361 /*)
2362 echo $file is in $xxx.
2363 ;;
8e07c86e
AD
2364 ?:[\\/]*)
2365 echo $file is in $xxx.
2366 ;;
2304df62 2367 *)
25f94b33
AD
2368 echo "I don't know where '$file' is, and my life depends on it." >&4
2369 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2370 exit 1
2304df62
AD
2371 ;;
2372 esac
2373done
2374echo " "
2375echo "Don't worry if any of the following aren't found..."
2376say=offhand
2377for file in $trylist; do
dfe9444c
AD
2378 eval xxx=\$$file
2379 case "$xxx" in
2380 /*|?:[\\/]*)
2381 if test -f "$xxx"; then
2382 : ok
2383 else
2384 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2385 xxx=`./loc $file $file $pth`
2386 fi
2387 ;;
2388 '') xxx=`./loc $file $file $pth`;;
2389 *) xxx=`./loc $xxx $xxx $pth`;;
2390 esac
306a8474 2391 eval $file=$xxx$_exe
2304df62
AD
2392 eval _$file=$xxx
2393 case "$xxx" in
2394 /*)
2395 echo $file is in $xxx.
2396 ;;
8e07c86e
AD
2397 ?:[\\/]*)
2398 echo $file is in $xxx.
2399 ;;
2304df62
AD
2400 *)
2401 echo "I don't see $file out there, $say."
2402 say=either
2403 ;;
2404 esac
2405done
2406case "$egrep" in
1fef16b3 2407egrep)
2304df62
AD
2408 echo "Substituting grep for egrep."
2409 egrep=$grep
868439a2 2410 _egrep=$grep
2304df62
AD
2411 ;;
2412esac
8ff267be 2413case "$ln" in
1fef16b3 2414ln)
8ff267be 2415 echo "Substituting cp for ln."
2416 ln=$cp
868439a2 2417 _ln=$cp
8ff267be 2418 ;;
2419esac
2e26f1d5
JH
2420case "$make" in
2421make)
2422 case "$gmake" in
2423 gmake)
2424 echo "I can't find make or gmake, and my life depends on it." >&4
2425 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2426 exit 1
2427 ;;
2428 esac
2429 ;;
2430esac
2431case "$gmake" in
2432gmake) ;;
2433*) # We can't have osname yet.
1fef16b3
JH
2434 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2435 # Assume that gmake, if found, is definitely GNU make
2436 # and prefer it over the system make.
2437 echo "Substituting gmake for make."
2438 make=$gmake
868439a2 2439 _make=$gmake
1fef16b3
JH
2440 fi
2441 ;;
a5a94ea5 2442esac
2304df62
AD
2443case "$test" in
2444test)
2445 echo "Hopefully test is built into your sh."
2446 ;;
2447*)
73614538 2448 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2449 echo "Using the test built into your sh."
2304df62
AD
2450 test=test
2451 _test=test
2452 fi
2453 ;;
2454esac
2455case "$echo" in
2456echo)
2457 echo "Hopefully echo is built into your sh."
2458 ;;
2459'') ;;
2460*)
2461 echo " "
2462echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2463 $echo $n "hi there$c" >foo1
2464 echo $n "hi there$c" >foo2
2465 if cmp foo1 foo2 >/dev/null 2>&1; then
2466 echo "They are compatible. In fact, they may be identical."
2467 else
2468 case "$n" in
2469 '-n') n='' c='\c';;
2470 *) n='-n' c='';;
2471 esac
2472 cat <<FOO
2473They are not compatible! You are probably running ksh on a non-USG system.
2474I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2475have echo built in and we may have to run some Bourne shell scripts. That
2476means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2477
2478FOO
2479 $echo $n "The star should be here-->$c"
2480 $echo "*"
2481 fi
2482 $rm -f foo1 foo2
2483 ;;
2484esac
2485
2f88d857
MB
2486# This question was auctioned at YAPC::Europe-2007 in Vienna
2487# I never promised you could answer it. I only auctioned the question.
2488cat <<FOO
2489The following message is sponsored by
2490
2491 Dresden.pm<--The stars should be here.
2492
2493Dear Perl user, system administrator or package
2494maintainer, the Perl community sends greetings to
2495you. Do you (emblematical) greet back [Y/n]? n
2496
2497FOO
2498
6b769f8f 2499cat <<EOS >trygcc
2573c5f9
JH
2500$startsh
2501EOS
6b769f8f 2502cat <<'EOSC' >>trygcc
2573c5f9
JH
2503case "$cc" in
2504'') ;;
2505*) $rm -f try try.*
2506 $cat >try.c <<EOM
2507int main(int argc, char *argv[]) {
2508 return 0;
2509}
2510EOM
e4778687 2511 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2512 :
2513 else
2514 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2515 despair=yes
2516 trygcc=yes
2517 case "$cc" in
2518 *gcc*) trygcc=no ;;
2519 esac
dce40316
AD
2520 # Skip this test because it gives a false match on output like:
2521 # ./trygcc: line 23: cc: command not found
2522 # case "`$cc -v -c try.c 2>&1`" in
2523 # *gcc*) trygcc=no ;;
2524 # esac
2573c5f9
JH
2525 if $test X"$trygcc" = Xyes; then
2526 if gcc -o try -c try.c; then
2527 echo " "
2528 echo "You seem to have a working gcc, though." >&4
dce40316
AD
2529 # Switching compilers may undo the work of hints files.
2530 # The most common problem is -D_REENTRANT for threads.
2531 # This heuristic catches that case, but gets false positives
2532 # if -Dusethreads was not actually specified. Better to
2533 # bail out here with a useful message than fail
2534 # mysteriously later. Should we perhaps just try to
2535 # re-invoke Configure -Dcc=gcc config_args ?
2536 if $test -f usethreads.cbu; then
2537 $cat >&4 <<EOM
2538
2539*** However, any setting of the C compiler flags (e.g. for thread support)
2540*** will be lost. It may be necessary for you to restart Configure and
2541*** add -Dcc=gcc to your Configure command line.
2542
2543EOM
2544 rp="Would you like to go ahead and try gcc anyway?"
2545 dflt=n
2546 else
2547 rp="Would you like to use it?"
2548 dflt=y
2549 fi
2573c5f9
JH
2550 if $test -f myread; then
2551 . ./myread
2552 else
2553 if $test -f UU/myread; then
2554 . ./UU/myread
2555 else
2556 echo "Cannot find myread, sorry. Aborting." >&2
2557 exit 1
2558 fi
2559 fi
2560 case "$ans" in
6371411c 2561 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2573c5f9
JH
2562 esac
2563 fi
2564 fi
6b769f8f
RB
2565 fi
2566 $rm -f try try.*
2567 ;;
2568esac
2569EOSC
2570
2571cat <<EOS >checkcc
2572$startsh
2573EOS
2574cat <<'EOSC' >>checkcc
2575case "$cc" in
2576'') ;;
2577*) $rm -f try try.*
2578 $cat >try.c <<EOM
2579int main(int argc, char *argv[]) {
2580 return 0;
2581}
2582EOM
2583 if $cc -o try $ccflags $ldflags try.c; then
2584 :
2585 else
2573c5f9 2586 if $test X"$despair" = Xyes; then
6b769f8f
RB
2587 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2588 fi
2589 $cat >&4 <<EOM
5dd4fbdf
MB
2590You need to find a working C compiler.
2591Either (purchase and) install the C compiler supplied by your OS vendor,
2592or for a free C compiler try http://gcc.gnu.org/
2593I cannot continue any further, aborting.
2594EOM
6b769f8f 2595 exit 1
2573c5f9
JH
2596 fi
2597 $rm -f try try.*
2598 ;;
2599esac
2600EOSC
2601
a0d0e21e
LW
2602: determine whether symbolic links are supported
2603echo " "
2604$touch blurfl
2605if $ln -s blurfl sym > /dev/null 2>&1 ; then
2606 echo "Symbolic links are supported." >&4
818f00be 2607 lns="$ln -s"
a0d0e21e
LW
2608else
2609 echo "Symbolic links are NOT supported." >&4
2610 lns="$ln"
2611fi
2612$rm -f blurfl sym
2613
dafca956
JH
2614: determine whether symbolic links are supported
2615echo " "
2616case "$lns" in
18ea2752 2617*"ln"*" -s")
dafca956
JH
2618 echo "Checking how to test for symbolic links..." >&4
2619 $lns blurfl sym
4b661809 2620 if $test "X$issymlink" = X; then
2e2a97a6
JH
2621 case "$newsh" in
2622 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2623 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2624 esac
5d644a95
MB
2625 if test $? = 0; then
2626 issymlink="test -h"
2e2a97a6
JH
2627 else
2628 echo "Your builtin 'test -h' may be broken." >&4
2629 case "$test" in
2630 /*) ;;
2631 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2632 for p in $pth
2633 do
2634 if test -f "$p/$test"; then
2635 test="$p/$test"
2636 break
2637 fi
2638 done
2639 ;;
2640 esac
2641 case "$test" in
2642 /*)
2643 echo "Trying external '$test -h'." >&4
2644 issymlink="$test -h"
2645 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2646 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2647 issymlink=''
2648 fi
2649 ;;
2650 *) issymlink='' ;;
2651 esac
5d644a95
MB
2652 fi
2653 fi
4b661809 2654 if $test "X$issymlink" = X; then
dafca956 2655 if $test -L sym 2>/dev/null; then
5d644a95 2656 issymlink="$test -L"
2e2a97a6 2657 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2658 fi
2659 fi
4b661809 2660 if $test "X$issymlink" != X; then
5d644a95 2661 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2662 else
2663 echo "I do not know how you can test for symbolic links." >&4
2664 fi
2665 $rm -f blurfl sym
2666 ;;
2667*) echo "No symbolic links, so not testing for their testing..." >&4
2668 ;;
2669esac
2670echo " "
2671
2672
2673case "$mksymlinks" in
2674$define|true|[yY]*)
2675 case "$src" in
2676 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2677 exit 1
2678 ;;
4b661809 2679 *) case "$lns:$issymlink" in
f314eb9f 2680 *"ln"*" -s:"*"test -"?)
dafca956
JH
2681 echo "Creating the symbolic links..." >&4
2682 echo "(First creating the subdirectories...)" >&4
2683 cd ..
2684 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2685 read directory
2686 test -z "$directory" && break
2687 mkdir -p $directory
2688 done
2689 # Sanity check 1.
2690 if test ! -d t/base; then
2691 echo "Failed to create the subdirectories. Aborting." >&4
2692 exit 1
2693 fi
2694 echo "(Then creating the symlinks...)" >&4
2695 awk '{print $1}' $src/MANIFEST | while true; do
2696 read filename
2697 test -z "$filename" && break
2698 if test -f $filename; then
5d644a95 2699 if $issymlink $filename; then
dafca956
JH
2700 rm -f $filename
2701 fi
2702 fi
2703 if test -f $filename; then
2704 echo "$filename already exists, not symlinking."
2705 else
2706 ln -s $src/$filename $filename
2707 fi
2708 done
2709 # Sanity check 2.
a0d24b8a
JH
2710 if test ! -f t/base/lex.t; then
2711 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2712 exit 1
2713 fi
2714 cd UU
2715 ;;
2716 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2717 ;;
2718 esac
2719 ;;
2720 esac
2721 ;;
2722esac
2723
5440bc8e
JH
2724
2725case "$usecrosscompile" in
2726$define|true|[yY]*)
93bc48fa 2727 $echo "Cross-compiling..."
5440bc8e
JH
2728 croak=''
2729 case "$cc" in
2730 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2731 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2732 ar=$targetarch-ar
2733 # leave out ld, choosing it is more complex
2734 nm=$targetarch-nm
2735 ranlib=$targetarch-ranlib
93bc48fa 2736 $echo 'extern int foo;' > try.c
f8006fac 2737 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2738 shift
2739 if $test $# -gt 0; then
2740 incpth="$incpth $*"
f8006fac
JH
2741 incpth="`$echo $incpth|$sed 's/^ //'`"
2742 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2743 for i in $*; do
f8006fac 2744 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2745 if $test -d $j; then
2746 libpth="$libpth $j"
2747 fi
2748 done
f8006fac
JH
2749 libpth="`$echo $libpth|$sed 's/^ //'`"
2750 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2751 fi
2752 $rm -f try.c
5440bc8e
JH
2753 ;;
2754 esac
2755 case "$targetarch" in
93bc48fa
JH
2756 '') echo "Targetarch not defined." >&4; croak=y ;;
2757 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2758 esac
2759 case "$incpth" in
93bc48fa 2760 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2761 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2762 esac
2763 case "$libpth" in
93bc48fa 2764 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2765 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2766 esac
93bc48fa
JH
2767 case "$usrinc" in
2768 '') for i in $incpth; do
2769 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2770 usrinc=$i
2771 echo "Guessing usrinc $usrinc." >&4
2772 break
2773 fi
2774 done
2775 case "$usrinc" in
2776 '') echo "Usrinc not defined." >&4; croak=y ;;
2777 esac
2778 ;;
2779 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2780 esac
93bc48fa
JH
2781 case "$targethost" in
2782 '') echo "Targethost not defined." >&4; croak=y ;;
2783 *) echo "Using targethost $targethost." >&4
5440bc8e 2784 esac
93bc48fa
JH
2785 locincpth=' '
2786 loclibpth=' '
5440bc8e 2787 case "$croak" in
93bc48fa 2788 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2789 esac
2790 case "$src" in
2791 /*) run=$src/Cross/run
93c0359c 2792 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2793 to=$src/Cross/to
2794 from=$src/Cross/from
2795 ;;
93bc48fa 2796 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2797 run=$pwd/Cross/run
f8006fac 2798 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2799 to=$pwd/Cross/to
2800 from=$pwd/Cross/from
2801 ;;
2802 esac
2803 case "$targetrun" in
2804 '') targetrun=ssh ;;
2805 esac
2806 case "$targetto" in
2807 '') targetto=scp ;;
2808 esac
2809 case "$targetfrom" in
2810 '') targetfrom=scp ;;
2811 esac
2812 run=$run-$targetrun
2813 to=$to-$targetto
2814 from=$from-$targetfrom
93bc48fa
JH
2815 case "$targetdir" in
2816 '') targetdir=/tmp
2817 echo "Guessing targetdir $targetdir." >&4
2818 ;;
2819 esac
5440bc8e 2820 case "$targetuser" in
93bc48fa
JH
2821 '') targetuser=root
2822 echo "Guessing targetuser $targetuser." >&4
2823 ;;
5440bc8e
JH
2824 esac
2825 case "$targetfrom" in
2826 scp) q=-q ;;
2827 *) q='' ;;
2828 esac
2829 case "$targetrun" in
2830 ssh|rsh)
2831 cat >$run <<EOF
2832#!/bin/sh
93c0359c
JH
2833case "\$1" in
2834-cwd)
2835 shift
2836 cwd=\$1
2837 shift
2838 ;;
2839esac
2840case "\$cwd" in
2841'') cwd=$targetdir ;;
2842esac
5440bc8e
JH
2843exe=\$1
2844shift
93c0359c
JH
2845if $test ! -f \$exe.xok; then
2846 $to \$exe
2847 $touch \$exe.xok
2848fi
2849$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2850EOF
2851 ;;
93bc48fa 2852 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2853 exit 1
2854 ;;
2855 esac
93c0359c
JH
2856 case "$targetmkdir" in
2857 */Cross/mkdir)
2858 cat >$targetmkdir <<EOF
2859#!/bin/sh
2860$targetrun -l $targetuser $targethost "mkdir -p \$@"
2861EOF
f8006fac 2862 $chmod a+rx $targetmkdir
93c0359c
JH
2863 ;;
2864 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2865 exit 1
2866 ;;
2867 esac
5440bc8e
JH
2868 case "$targetto" in
2869 scp|rcp)
2870 cat >$to <<EOF
2871#!/bin/sh
2872for f in \$@
2873do
93c0359c
JH
2874 case "\$f" in
2875 /*)
2876 $targetmkdir \`dirname \$f\`
2877 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2878 ;;
2879 *)
2880 $targetmkdir $targetdir/\`dirname \$f\`
2881 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2882 ;;
2883 esac
5440bc8e
JH
2884done
2885exit 0
2886EOF
2887 ;;
2888 cp) cat >$to <<EOF
2889#!/bin/sh
93c0359c
JH
2890for f in \$@
2891do
2892 case "\$f" in
2893 /*)
2894 $mkdir -p $targetdir/\`dirname \$f\`
2895 $cp \$f $targetdir/\$f || exit 1
2896 ;;
2897 *)
2898 $targetmkdir $targetdir/\`dirname \$f\`
2899 $cp \$f $targetdir/\$f || exit 1
2900 ;;
2901 esac
2902done
2903exit 0
5440bc8e
JH
2904EOF
2905 ;;
93bc48fa 2906 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2907 exit 1
2908 ;;
2909 esac
2910 case "$targetfrom" in
2911 scp|rcp)
2912 cat >$from <<EOF
2913#!/bin/sh
2914for f in \$@
2915do
93c0359c 2916 $rm -f \$f
5440bc8e
JH
2917 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2918done
2919exit 0
2920EOF
2921 ;;
2922 cp) cat >$from <<EOF
2923#!/bin/sh
2924for f in \$@
2925do
93c0359c 2926 $rm -f \$f
5440bc8e
JH
2927 cp $targetdir/\$f . || exit 1
2928done
2929exit 0
2930EOF
2931 ;;
93bc48fa 2932 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2933 exit 1
2934 ;;
2935 esac
93bc48fa
JH
2936 if $test ! -f $run; then
2937 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2938 else
f8006fac 2939 $chmod a+rx $run
5440bc8e 2940 fi
93bc48fa
JH
2941 if $test ! -f $to; then
2942 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2943 else
f8006fac 2944 $chmod a+rx $to
5440bc8e 2945 fi
93bc48fa
JH
2946 if $test ! -f $from; then
2947 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2948 else
f8006fac 2949 $chmod a+rx $from
5440bc8e 2950 fi
93bc48fa 2951 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2952 exit 1
2953 fi
2954 cat >&4 <<EOF
f8006fac
JH
2955Using '$run' for remote execution,
2956and '$from' and '$to'
93bc48fa 2957for remote file transfer.
5440bc8e
JH
2958EOF
2959 ;;
2960*) run=''
2961 to=:
2962 from=:
2963 usecrosscompile='undef'
2964 targetarch=''
2965 ;;
2966esac
2967
ecfc5424
AD
2968: see whether [:lower:] and [:upper:] are supported character classes
2969echo " "
ecfc5424
AD
2970case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2971ABYZ)
2972 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2973 up='[:upper:]'
2974 low='[:lower:]'
2975 ;;
416d0bea
MB
2976*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2977 # (0xd9 and 0xe2), therefore that is a nice testing point.
2978 if test "X$up" = X -o "X$low" = X; then
2979 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2980 rs) up='[A-Z]'
2981 low='[a-z]'
28e8609d
JH
2982 ;;
2983 esac
416d0bea 2984 fi
28e8609d 2985 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2986 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2987 rs) up='A-Z'
28e8609d
JH
2988 low='a-z'
2989 ;;
2990 esac
416d0bea 2991 fi
28e8609d 2992 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2993 case "`echo RS | od -x 2>/dev/null`" in
2994 *D9E2*|*d9e2*)
28e8609d
JH
2995 echo "Hey, this might be EBCDIC." >&4
2996 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2997 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2998 rs) up='[A-IJ-RS-Z]'
2999 low='[a-ij-rs-z]'
28e8609d
JH
3000 ;;
3001 esac
3002 fi
3003 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3004 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3005 rs) up='A-IJ-RS-Z'
3006 low='a-ij-rs-z'
28e8609d
JH
3007 ;;
3008 esac
3009 fi
3010 ;;
3011 esac
3012 fi
3013esac
416d0bea
MB
3014case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3015rs)
28e8609d
JH
3016 echo "Using $up and $low to convert case." >&4
3017 ;;
ecfc5424 3018*)
28e8609d
JH
3019 echo "I don't know how to translate letters from upper to lower case." >&4
3020 echo "Your tr is not acting any way I know of." >&4
3021 exit 1
3022 ;;
ecfc5424
AD
3023esac
3024: set up the translation script tr, must be called with ./tr of course
3025cat >tr <<EOSC
3026$startsh
3027case "\$1\$2" in
3028'[A-Z][a-z]') exec $tr '$up' '$low';;
3029'[a-z][A-Z]') exec $tr '$low' '$up';;
3030esac
3031exec $tr "\$@"
3032EOSC
3033chmod +x tr
3034$eunicefix tr
3035
2304df62
AD
3036: Try to determine whether config.sh was made on this system
3037case "$config_sh" in
3038'')
43999f95
JH
3039myuname=`$uname -a 2>/dev/null`
3040$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3041# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3042# because the A-Z/a-z are not consecutive.
34e09935 3043myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3eaeeeae 3044 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3045newmyuname="$myuname"
2304df62 3046dflt=n
16d20bd9
AD
3047case "$knowitall" in
3048'')
3049 if test -f ../config.sh; then
3050 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3051 eval "`grep myuname= ../config.sh`"
3052 fi
3053 if test "X$myuname" = "X$newmyuname"; then
3054 dflt=y
3055 fi
2304df62 3056 fi
16d20bd9
AD
3057 ;;
3058*) dflt=y;;
3059esac
2304df62
AD
3060
3061: Get old answers from old config file if Configure was run on the
3062: same system, otherwise use the hints.
3063hint=default
3064cd ..
3065if test -f config.sh; then
16d20bd9
AD
3066 echo " "
3067 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3068 . UU/myread
3069 case "$ans" in
f83701cd
AD
3070 n*|N*) echo "OK, I'll ignore it."
3071 mv config.sh config.sh.old
3072 myuname="$newmyuname"
3073 ;;
2304df62 3074 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3075 tmp_n="$n"
3076 tmp_c="$c"
85cad39c 3077 tmp_sh="$sh"
2304df62
AD
3078 . ./config.sh
3079 cp config.sh UU
ecfc5424
AD
3080 n="$tmp_n"
3081 c="$tmp_c"
85cad39c 3082 : Older versions did not always set $sh. Catch re-use of such
3083 : an old config.sh.
3084 case "$sh" in
3085 '') sh="$tmp_sh" ;;
3086 esac
2304df62
AD
3087 hint=previous
3088 ;;
3089 esac
3090fi
2573c5f9 3091. ./UU/checkcc
2304df62
AD
3092if test ! -f config.sh; then
3093 $cat <<EOM
3094
4e2a5f63
AD
3095First time through, eh? I have some defaults handy for some systems
3096that need some extra help getting the Configure answers right:
2304df62
AD
3097
3098EOM
dfe9444c 3099 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3100 dflt=''
3101 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3102 : tests or hints, please send them to perlbug@perl.org
2304df62 3103 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3104 $test -f /irix && osname=irix
85e6fe83
LW
3105 $test -f /xenix && osname=sco_xenix
3106 $test -f /dynix && osname=dynix
3107 $test -f /dnix && osname=dnix
5f05dabc 3108 $test -f /lynx.os && osname=lynxos
3109 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3110 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3111 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3112 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3113 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3114 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3115 $test -d /usr/apollo/bin && osname=apollo
3116 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3117 $test -d /usr/include/minix && osname=minix
d54344fc 3118 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3119 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3120 osname=machten
4633a7c4 3121 if $test -x /sbin/version; then
dfe9444c 3122 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3123 $sed -e 's/[A-Za-z]$//'`
3124 elif $test -x /usr/etc/version; then
dfe9444c 3125 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3126 $sed -e 's/[A-Za-z]$//'`
3127 else
3128 osvers="$2.$3"
3129 fi
3130 fi
aaacdc8b
GS
3131
3132 $test -f /sys/posix.dll &&
3133 $test -f /usr/bin/what &&
3134 set X `/usr/bin/what /sys/posix.dll` &&
3135 $test "$3" = UWIN &&
3136 osname=uwin &&
3137 osvers="$5"
3138
2304df62
AD
3139 if $test -f $uname; then
3140 set X $myuname
3141 shift
3142
2304df62 3143 case "$5" in
85e6fe83 3144 fps*) osname=fps ;;
2304df62
AD
3145 mips*)
3146 case "$4" in
85e6fe83
LW
3147 umips) osname=umips ;;
3148 *) osname=mips ;;
2304df62 3149 esac;;
85e6fe83
LW
3150 [23]100) osname=mips ;;
3151 next*) osname=next ;;
ecfc5424 3152 i386*)
c6912327
JH
3153 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3154 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3155 osname='sco'
3156 osvers=$tmp
3157 elif $test -f /etc/kconfig; then
ecfc5424 3158 osname=isc
bd628c73 3159 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3160 osvers=4
3161 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3162 osvers=3
2304df62 3163 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3164 osvers=2
ecfc5424
AD
3165 fi
3166 fi
2000072c 3167 tmp=''
ecfc5424 3168 ;;
c4f23d77
AD
3169 pc*)
3170 if test -n "$DJGPP"; then
3171 osname=dos
3172 osvers=djgpp
3173 fi
3174 ;;
2304df62
AD
3175 esac
3176
3177 case "$1" in
a0d0e21e
LW
3178 aix) osname=aix
3179 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3180 case "$tmp" in
e81c5c2a
NC
3181 # oslevel can fail with:
3182 # oslevel: Unable to acquire lock.
3183 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3184 '<3240'|'<>3240') osvers=3.2.0 ;;
3185 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3186 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3187 *) osvers=$tmp;;
a0d0e21e
LW
3188 esac
3189 ;;
aaacdc8b
GS
3190 bsd386) osname=bsd386
3191 osvers=`$uname -r`
3192 ;;
3193 cygwin*) osname=cygwin
3194 osvers="$3"
3195 ;;
23f87696
SZ
3196 *dc.osx) osname=dcosx
3197 osvers="$3"
3198 ;;
a0d0e21e
LW
3199 dnix) osname=dnix
3200 osvers="$3"
3201 ;;
3202 domainos) osname=apollo
3203 osvers="$3"
3204 ;;
a774dfe6
RSG
3205 dgux) osname=dgux
3206 osvers="$3"
3207 ;;
3208 dragonfly) osname=dragonfly
a0d0e21e
LW
3209 osvers="$3"
3210 ;;
760ac839 3211 dynixptx*) osname=dynixptx
e58e581d 3212 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3213 ;;
a774dfe6 3214 freebsd) osname=freebsd
a0d0e21e 3215 osvers="$3" ;;
761ee4e8
BD
3216 genix) osname=genix ;;
3217 gnu) osname=gnu
3218 osvers="$3" ;;
a774dfe6 3219 hp*) osname=hpux
bfb7748a 3220 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3221 ;;
761ee4e8 3222 irix*) osname=irix
a0d0e21e
LW
3223 case "$3" in
3224 4*) osvers=4 ;;
3225 5*) osvers=5 ;;
ecfc5424 3226 *) osvers="$3" ;;
a0d0e21e
LW
3227 esac
3228 ;;
761ee4e8 3229 linux) osname=linux
a0d0e21e 3230 case "$3" in
a0d0e21e
LW
3231 *) osvers="$3" ;;
3232 esac
3233 ;;
761ee4e8 3234 MiNT) osname=mint
28e8609d
JH
3235 ;;
3236 netbsd*) osname=netbsd
ecfc5424
AD
3237 osvers="$3"
3238 ;;
4e81affe
MM
3239 news-os) osvers="$3"
3240 case "$3" in
3241 4*) osname=newsos4 ;;
3242 *) osname=newsos ;;
3243 esac
3244 ;;
aaacdc8b 3245 next*) osname=next ;;
28bb1e2c 3246 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3247 openbsd) osname=openbsd
3248 osvers="$3"
3249 ;;
5c728af0
IZ
3250 os2) osname=os2
3251 osvers="$4"
3252 ;;
aaacdc8b
GS
3253 POSIX-BC | posix-bc ) osname=posix-bc
3254 osvers="$3"
a0d0e21e 3255 ;;
ae3afa4e
TH
3256 powerux | power_ux | powermax_os | powermaxos | \
3257 powerunix | power_unix) osname=powerux
3258 osvers="$3"
3259 ;;
aaacdc8b
GS
3260 qnx) osname=qnx
3261 osvers="$4"
3262 ;;
a0d0e21e
LW
3263 solaris) osname=solaris
3264 case "$3" in
3265 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3266 *) osvers="$3" ;;
a0d0e21e
LW
3267 esac
3268 ;;
85e6fe83
LW
3269 sunos) osname=sunos
3270 case "$3" in
85e6fe83
LW
3271 5*) osname=solaris
3272 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3273 *) osvers="$3" ;;
2304df62
AD
3274 esac
3275 ;;
a0d0e21e 3276 titanos) osname=titanos
85e6fe83 3277 case "$3" in
a0d0e21e
LW
3278 1*) osvers=1 ;;
3279 2*) osvers=2 ;;
3280 3*) osvers=3 ;;
3281 4*) osvers=4 ;;
ecfc5424 3282 *) osvers="$3" ;;
2304df62
AD
3283 esac
3284 ;;
85e6fe83 3285 ultrix) osname=ultrix
ecfc5424 3286 osvers="$3"
2304df62 3287 ;;
28757baa 3288 osf1|mls+) case "$5" in
fed7345c
AD
3289 alpha)
3290 osname=dec_osf
fdd85a03 3291 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3292 case "$osvers" in
3293 [1-9].[0-9]*) ;;
3294 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3295 esac
ecfc5424
AD
3296 ;;
3297 hp*) osname=hp_osf1 ;;
3298 mips) osname=mips_osf1 ;;
85e6fe83
LW
3299 esac
3300 ;;
af1ff193 3301 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3302 openunix|unixware) osname=svr5
0337d152
BG
3303 osvers="$4"
3304 ;;
3c728e00 3305 uts) osname=uts
a0d0e21e
LW
3306 osvers="$3"
3307 ;;
3c728e00
JH
3308 vos) osvers="$3"
3309 ;;
85e6fe83 3310 $2) case "$osname" in
2304df62 3311 *isc*) ;;
a0d0e21e 3312 *freebsd*) ;;
5f05dabc 3313 svr*)
a0d0e21e 3314 : svr4.x or possibly later
a774dfe6 3315 case "svr$3" in
a0d0e21e
LW
3316 ${osname}*)
3317 osname=svr$3
3318 osvers=$4
3319 ;;
3320 esac
3321 case "$osname" in
3322 svr4.0)
3323 : Check for ESIX
3324 if test -f /stand/boot ; then
3325 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3326 if test -n "$INITPROG" -a -f "$INITPROG"; then
3327 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3328 if test -n "$isesix"; then
a0d0e21e
LW
3329 osname=esix4
3330 fi
3331 fi
3332 fi
3333 ;;
3334 esac
3335 ;;
2304df62 3336 *) if test -f /etc/systemid; then
a0d0e21e
LW
3337 osname=sco
3338 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3339 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3340 osvers=$1.$2.$3
c4f23d77 3341 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3342 osvers=$1.$2
c4f23d77 3343 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3344 osvers=$1
2304df62 3345 fi
a0d0e21e
LW
3346 else
3347 case "$osname" in
3348 '') : Still unknown. Probably a generic Sys V.
3349 osname="sysv"
3350 osvers="$3"
3351 ;;
3352 esac
2304df62
AD
3353 fi
3354 ;;
3355 esac
3356 ;;
a0d0e21e
LW
3357 *) case "$osname" in
3358 '') : Still unknown. Probably a generic BSD.
3359 osname="$1"
3360 osvers="$3"
3361 ;;
3362 esac
3363 ;;
2304df62
AD
3364 esac
3365 else
dfe9444c
AD
3366 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3367 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3368 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3369 osname=news_os
2304df62 3370 fi
dfe9444c 3371 $rm -f UU/kernel.what
5c728af0 3372 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3373 set X $myuname
3374 osname=os2
3375 osvers="$5"
2304df62
AD
3376 fi
3377 fi
a774dfe6 3378
5440bc8e
JH
3379 case "$targetarch" in
3380 '') ;;
3381 *) hostarch=$osname
3382 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3383 osvers=''
3384 ;;
3385 esac
3386
a0d0e21e
LW
3387 : Now look for a hint file osname_osvers, unless one has been
3388 : specified already.
3389 case "$hintfile" in
3390 ''|' ')
1e127011 3391 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3392 : Also try without trailing minor version numbers.
1e127011
DD
3393 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3394 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3395 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3396 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3397 case "$file" in
3398 '') dflt=none ;;
3399 *) case "$osvers" in
3400 '') dflt=$file
3401 ;;
dfe9444c 3402 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3403 dflt=$file
dfe9444c 3404 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3405 dflt=$xfile
dfe9444c 3406 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3407 dflt=$xxfile
dfe9444c 3408 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3409 dflt=$xxxfile
dfe9444c 3410 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3411 dflt=$xxxxfile
dfe9444c 3412 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3413 dflt="${osname}"
3414 else
3415 dflt=none
3416 fi
3417 ;;
3418 esac
85e6fe83
LW
3419 ;;
3420 esac
4e2a5f63
AD
3421 if $test -f Policy.sh ; then
3422 case "$dflt" in
3423 *Policy*) ;;
3424 none) dflt="Policy" ;;
3425 *) dflt="Policy $dflt" ;;
3426 esac
3427 fi
85e6fe83 3428 ;;
a0d0e21e 3429 *)
ecfc5424 3430 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3431 ;;
2304df62 3432 esac
1aef975c 3433
4e2a5f63
AD
3434 if $test -f Policy.sh ; then
3435 $cat <<EOM
3436
3437There's also a Policy hint file available, which should make the
3438site-specific (policy) questions easier to answer.
3439EOM
3440
3441 fi
3442
2304df62
AD
3443 $cat <<EOM
3444
3445You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3446If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3447previous run of Configure, you may specify it as well as or instead of
3448OS-specific hints. If hints are provided for your OS, you should use them:
3449although Perl can probably be built without hints on many platforms, using
3450hints often improve performance and may enable features that Configure can't
3451set up on its own. If there are no hints that match your OS, specify "none";
3452DO NOT give a wrong version or a wrong OS.
2304df62
AD
3453
3454EOM
4e2a5f63 3455
2304df62 3456 rp="Which of these apply, if any?"
dfe9444c 3457 . UU/myread
85e6fe83
LW
3458 tans=$ans
3459 for file in $tans; do
4e2a5f63
AD
3460 if $test X$file = XPolicy -a -f Policy.sh; then
3461 . Policy.sh
3462 $cat Policy.sh >> UU/config.sh
3463 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3464 . $src/hints/$file.sh
3465 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3466 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3467 : nothing
3468 else
85e6fe83
LW
3469 : Give one chance to correct a possible typo.
3470 echo "$file.sh does not exist"
3471 dflt=$file
3472 rp="hint to use instead?"
dfe9444c 3473 . UU/myread
85e6fe83 3474 for file in $ans; do
dfe9444c
AD
3475 if $test -f "$src/hints/$file.sh"; then
3476 . $src/hints/$file.sh
3477 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3478 elif $test X$ans = X -o X$ans = Xnone ; then
3479 : nothing
3480 else
3481 echo "$file.sh does not exist -- ignored."
3482 fi
3483 done
2304df62
AD
3484 fi
3485 done
85e6fe83 3486
2304df62 3487 hint=recommended
85e6fe83 3488 : Remember our hint file for later.
dfe9444c 3489 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3490 hintfile="$file"
85e6fe83 3491 else
a0d0e21e 3492 hintfile=''
85e6fe83 3493 fi
2304df62
AD
3494fi
3495cd UU
3496;;
3497*)
3498 echo " "
3499 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3500 tmp_n="$n"
3501 tmp_c="$c"
2304df62
AD
3502 cd ..
3503 cp $config_sh config.sh 2>/dev/null
a78b0d02 3504 chmod +w config.sh
2304df62
AD
3505 . ./config.sh
3506 cd UU
3507 cp ../config.sh .
ecfc5424
AD
3508 n="$tmp_n"
3509 c="$tmp_c"
2304df62
AD
3510 hint=previous
3511 ;;
3512esac
1aef975c 3513test "$override" && . ./optdef.sh
2304df62
AD
3514
3515: Restore computed paths
3516for file in $loclist $trylist; do
3517 eval $file="\$_$file"
3518done
3519
85e6fe83 3520cat << EOM
a0d0e21e 3521
85e6fe83 3522Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3523The default value is probably right if the name rings a bell. Otherwise,
3524since spelling matters for me, either accept the default or answer "none"
3525to leave it blank.
a0d0e21e 3526
85e6fe83 3527EOM
85e6fe83 3528case "$osname" in
a0d0e21e 3529 ''|' ')
85e6fe83 3530 case "$hintfile" in
a0d0e21e 3531 ''|' '|none) dflt=none ;;
ecfc5424 3532 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3533 esac
3534 ;;
3535 *) dflt="$osname" ;;
3536esac
3537rp="Operating system name?"
3538. ./myread
3539case "$ans" in
ecfc5424
AD
3540none) osname='' ;;
3541*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3542esac
8ff267be 3543echo " "
3544case "$osvers" in
3545 ''|' ')
3546 case "$hintfile" in
3547 ''|' '|none) dflt=none ;;
3548 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3549 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3550 case "$dflt" in
3551 ''|' ') dflt=none ;;
3552 esac
3553 ;;
3554 esac
3555 ;;
3556 *) dflt="$osvers" ;;
3557esac
3558rp="Operating system version?"
3559. ./myread
3560case "$ans" in
3561none) osvers='' ;;
3562*) osvers="$ans" ;;
3563esac
3564
02e93a22
JH
3565
3566. ./posthint.sh
3567
2304df62 3568: who configured the system
59b83a6f 3569cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3570case "$cf_by" in
3571"")
7c04078e 3572 cf_by=`(logname) 2>/dev/null`
dfe9444c 3573 case "$cf_by" in
7c04078e
GA
3574 "")
3575 cf_by=`(whoami) 2>/dev/null`
3576 case "$cf_by" in
3577 "") cf_by=unknown ;;
3578 esac ;;
8ff267be 3579 esac ;;
3580esac
2304df62 3581
f3f1a2d8
MB
3582: decide how portable to be. Allow command line overrides.
3583case "$d_portable" in
3584"$undef") ;;
3585*) d_portable="$define" ;;
b4eb6b3d 3586esac
b4eb6b3d 3587
f3f1a2d8
MB
3588: set up shell script to do ~ expansion
3589cat >filexp <<EOSS
3590$startsh
3591: expand filename
3592case "\$1" in
3593 ~/*|~)
3594 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3595 ;;
3596 ~*)
3597 if $test -f /bin/csh; then
3598 /bin/csh -f -c "glob \$1"
3599 failed=\$?
3600 echo ""
3601 exit \$failed
3602 else
3603 name=\`$expr x\$1 : '..\([^/]*\)'\`
3604 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3605 if $test ! -d "\$dir"; then
3606 me=\`basename \$0\`
3607 echo "\$me: can't locate home directory for: \$name" >&2
3608 exit 1
3609 fi
3610 case "\$1" in
3611 */*)
3612 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3613 ;;
3614 *)
3615 echo \$dir
3616 ;;
3617 esac
3618 fi
3619 ;;
3620*)
3621 echo \$1
3622 ;;
b29b105d 3623esac
f3f1a2d8
MB
3624EOSS
3625chmod +x filexp
3626$eunicefix filexp
b29b105d 3627
f3f1a2d8
MB
3628: now set up to get a file name
3629cat <<EOS >getfile
3630$startsh
3631EOS
3632cat <<'EOSC' >>getfile
3633tilde=''
3634fullpath=''
3635already=''
3636skip=''
3637none_ok=''
3638exp_file=''
3639nopath_ok=''
3640orig_rp="$rp"
3641orig_dflt="$dflt"
3642case "$gfpth" in
3643'') gfpth='.' ;;
b29b105d 3644esac
b29b105d 3645
f3f1a2d8
MB
3646case "$fn" in
3647*\(*)
3648 : getfile will accept an answer from the comma-separated list
3649 : enclosed in parentheses even if it does not meet other criteria.
3650 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3651 fn=`echo $fn | sed 's/(.*)//'`
3652 ;;
b29b105d
JH
3653esac
3654
f3f1a2d8
MB
3655case "$fn" in
3656*:*)
3657 loc_file=`expr $fn : '.*:\(.*\)'`
3658 fn=`expr $fn : '\(.*\):.*'`
3659 ;;
b29b105d 3660esac
b29b105d 3661
f3f1a2d8
MB
3662case "$fn" in
3663*~*) tilde=true;;
3664esac
3665case "$fn" in
3666*/*) fullpath=true;;
3667esac
3668case "$fn" in
3669*+*) skip=true;;
3670esac
3671case "$fn" in
3672*n*) none_ok=true;;
3673esac
3674case "$fn" in
3675*e*) exp_file=true;;
3676esac
3677case "$fn" in
3678*p*) nopath_ok=true;;
b29b105d 3679esac
b29b105d 3680
f3f1a2d8
MB
3681case "$fn" in
3682*f*) type='File';;
3683*d*) type='Directory';;
3684*l*) type='Locate';;
3685esac
b29b105d 3686
f3f1a2d8
MB
3687what="$type"
3688case "$what" in
3689Locate) what='File';;
3690esac
b29b105d 3691
f3f1a2d8
MB
3692case "$exp_file" in
3693'')
3694 case "$d_portable" in
3695 "$define") ;;
3696 *) exp_file=true;;
b29b105d
JH
3697 esac
3698 ;;
3699esac
3700
f3f1a2d8
MB
3701cd ..
3702while test "$type"; do
3703 redo=''
3704 rp="$orig_rp"
3705 dflt="$orig_dflt"
3706 case "$tilde" in
3707 true) rp="$rp (~name ok)";;
3708 esac
3709 . UU/myread
3710 if test -f UU/getfile.ok && \
3711 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3712 then
3713 value="$ans"
3714 ansexp="$ans"
3715 break
3716 fi
3717 case "$ans" in
3718 none)
3719 value=''
3720 ansexp=''
3721 case "$none_ok" in
3722 true) type='';;
b29b105d
JH
3723 esac
3724 ;;
f3f1a2d8
MB
3725 *)
3726 case "$tilde" in
3727 '') value="$ans"
3728 ansexp="$ans";;
3729 *)
3730 value=`UU/filexp $ans`
3731 case $? in
3732 0)
3733 if test "$ans" != "$value"; then
3734 echo "(That expands to $value on this system.)"
3735 fi
3736 ;;
3737 *) value="$ans";;
3738 esac
3739 ansexp="$value"
3740 case "$exp_file" in
3741 '') value="$ans";;
3742 esac
3743 ;;
3744 esac
3745 case "$fullpath" in
3746 true)
3747 case "$ansexp" in
3748 /*) value="$ansexp" ;;
3749 [a-zA-Z]:/*) value="$ansexp" ;;
3750 *)
3751 redo=true
3752 case "$already" in
3753 true)
3754 echo "I shall only accept a full path name, as in /bin/ls." >&4
3755 echo "Use a ! shell escape if you wish to check pathnames." >&4
3756 ;;
3757 *)
3758 echo "Please give a full path name, starting with slash." >&4
3759 case "$tilde" in
3760 true)
3761 echo "Note that using ~name is ok provided it expands well." >&4
3762 already=true
3763 ;;
3764 esac
3765 esac
3766 ;;
3767 esac
3768 ;;
3769 esac
3770 case "$redo" in
3771 '')
3772 case "$type" in
3773 File)
3774 for fp in $gfpth; do
3775 if test "X$fp" = X.; then
3776 pf="$ansexp"
3777 else
3778 pf="$fp/$ansexp"
3779 fi
3780 if test -f "$pf"; then
3781 type=''
3782 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3783 then
3784 echo "($value is not a plain file, but that's ok.)"
3785 type=''
3786 fi
3787 if test X"$type" = X; then
3788 value="$pf"
3789 break
3790 fi
3791 done
3792 ;;
3793 Directory)
3794 for fp in $gfpth; do
3795 if test "X$fp" = X.; then
3796 dir="$ans"
3797 direxp="$ansexp"
3798 else
3799 dir="$fp/$ansexp"
3800 direxp="$fp/$ansexp"
3801 fi
3802 if test -d "$direxp"; then
3803 type=''
3804 value="$dir"
3805 break
3806 fi
3807 done
3808 ;;
3809 Locate)
3810 if test -d "$ansexp"; then
3811 echo "(Looking for $loc_file in directory $value.)"
3812 value="$value/$loc_file"
3813 ansexp="$ansexp/$loc_file"
3814 fi
3815 if test -f "$ansexp"; then
3816 type=''
3817 fi
3818 case "$nopath_ok" in
3819 true) case "$value" in
3820 */*) ;;
3821 *) echo "Assuming $value will be in people's path."
3822 type=''
3823 ;;
3824 esac
3825 ;;
3826 esac
3827 ;;
3828 esac
b4eb6b3d 3829
f3f1a2d8
MB
3830 case "$skip" in
3831 true) type='';
3832 esac
3833
3834 case "$type" in
3835 '') ;;
3836 *)
3837 if test "$fastread" = yes; then
3838 dflt=y
3839 else
3840 dflt=n
3841 fi
3842 rp="$what $value doesn't exist. Use that name anyway?"
3843 . UU/myread
3844 dflt=''
3845 case "$ans" in
3846 y*) type='';;
3847 *) echo " ";;
3848 esac
3849 ;;
3850 esac
3851 ;;
3852 esac
3853 ;;
b4eb6b3d 3854 esac
f3f1a2d8
MB
3855done
3856cd UU
3857ans="$value"
3858rp="$orig_rp"
3859dflt="$orig_dflt"
3860rm -f getfile.ok
3861test "X$gfpthkeep" != Xy && gfpth=""
3862EOSC
3863
3864: determine root of directory hierarchy where package will be installed.
3865case "$prefix" in
3866'')
3867 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3868 ;;
3869*?/)
3870 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3871 ;;
3872*)
f3f1a2d8 3873 dflt="$prefix"
b4eb6b3d
JH
3874 ;;
3875esac
f3f1a2d8 3876$cat <<EOM
b4eb6b3d 3877
f3f1a2d8
MB
3878By default, $package will be installed in $dflt/bin, manual pages
3879under $dflt/man, etc..., i.e. with $dflt as prefix for all
3880installation directories. Typically this is something like /usr/local.
3881If you wish to have binaries under /usr/bin but other parts of the
3882installation under /usr/local, that's ok: you will be prompted
3883separately for each of the installation directories, the prefix being
3884only used to set the defaults.
c915ce7f
JH
3885
3886EOM
f3f1a2d8
MB
3887fn=d~
3888rp='Installation prefix to use?'
3889. ./getfile
3890oldprefix=''
3891case "$prefix" in
3892'') ;;
3893*)
3894 case "$ans" in
3895 "$prefix") ;;
3896 *) oldprefix="$prefix";;
3897 esac
c915ce7f
JH
3898 ;;
3899esac
f3f1a2d8
MB
3900prefix="$ans"
3901prefixexp="$ansexp"
c915ce7f 3902
f3f1a2d8
MB
3903case "$afsroot" in
3904'') afsroot=/afs ;;
3905*) afsroot=$afsroot ;;
b4eb6b3d 3906esac
b4eb6b3d 3907
f3f1a2d8
MB
3908: is AFS running?
3909echo " "
3910case "$afs" in
3911$define|true) afs=true ;;
3912$undef|false) afs=false ;;
3913*) if test -d $afsroot; then
3914 afs=true
3915 else
3916 afs=false
3917 fi
b4eb6b3d 3918 ;;
f3f1a2d8
MB
3919esac
3920if $afs; then
3921 echo "AFS may be running... I'll be extra cautious then..." >&4
3922else
3923 echo "AFS does not seem to be running..." >&4
9da7673b 3924fi
b4eb6b3d 3925
f3f1a2d8
MB
3926: determine installation prefix for where package is to be installed.
3927if $afs; then
3928$cat <<EOM
3929
3930Since you are running AFS, I need to distinguish the directory in which
3931files will reside from the directory in which they are installed (and from
3932which they are presumably copied to the former directory by occult means).
b4eb6b3d 3933
b4eb6b3d 3934EOM
f3f1a2d8
MB
3935 case "$installprefix" in
3936 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3937 *) dflt="$installprefix";;
3938 esac
3939else
3940$cat <<EOM
b4eb6b3d 3941
f3f1a2d8
MB
3942In some special cases, particularly when building $package for distribution,
3943it is convenient to distinguish the directory in which files should be
3944installed from the directory ($prefix) in which they will
3945eventually reside. For most users, these two directories are the same.
3946
3947EOM
3948 case "$installprefix" in
3949 '') dflt=$prefix ;;
3950 *) dflt=$installprefix;;
3951 esac
3952fi
3953fn=d~
3954rp='What installation prefix should I use for installing files?'
3955. ./getfile
3956installprefix="$ans"
3957installprefixexp="$ansexp"
3958
3959: Perform the prefixexp/installprefixexp correction if necessary
3960cat <<EOS >installprefix
3961$startsh
3962EOS
3963cat <<'EOSC' >>installprefix
3964: Change installation prefix, if necessary.
3965if $test X"$prefix" != X"$installprefix"; then
3966 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3967else
3968 eval "install${prefixvar}=\"\$${prefixvar}exp\""
3969fi
3970EOSC
3971chmod +x installprefix
3972$eunicefix installprefix
3973
3974: Set variables such as privlib and privlibexp from the output of ./getfile
3975: performing the prefixexp/installprefixexp correction if necessary.
3976cat <<EOS >setprefixvar
3977$startsh
3978EOS
3979cat <<'EOSC' >>setprefixvar
3980eval "${prefixvar}=\"\$ans\""
3981eval "${prefixvar}exp=\"\$ansexp\""
3982. ./installprefix
3983EOSC
3984chmod +x setprefixvar
3985$eunicefix setprefixvar
3986
3987: set up the script used to warn in case of inconsistency
3988cat <<EOS >whoa
3989$startsh
3990EOS
3991cat <<'EOSC' >>whoa
3992dflt=y
dcb594bc
MB
3993case "$hint" in
3994 recommended)
3995 case "$hintfile" in
3996 '') echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3997 ;;
3998 *) echo "Hmm. Based on the hints in hints/$hintfile.sh, " >&4
3999 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4000 ;;
4001 esac
4002 ;;
4003 *) echo " "
4004 echo "*** WHOA THERE!!! ***" >&4
4005 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
4006 ;;
4007esac
f3f1a2d8
MB
4008rp=" Keep the $hint value?"
4009. ./myread
4010case "$ans" in
4011y) td=$was; tu=$was;;
4012esac
4013EOSC
4014
4015: function used to set $1 to $val
4016setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4017case "$val$was" in
4018$define$undef) . ./whoa; eval "$var=\$td";;
4019$undef$define) . ./whoa; eval "$var=\$tu";;
4020*) eval "$var=$val";;
4021esac'
4022
4023case "$usesocks" in
4024$define|true|[yY]*) dflt='y';;
4025*) dflt='n';;
4026esac
4027cat <<EOM
4028
4029Perl can be built to use the SOCKS proxy protocol library. To do so,
4030Configure must be run with -Dusesocks. If you use SOCKS you also need
4031to use the PerlIO abstraction layer, this will be implicitly selected.
4032
4033If this doesn't make any sense to you, just accept the default '$dflt'.
4034EOM
4035rp='Build Perl for SOCKS?'
4036. ./myread
4037case "$ans" in
4038y|Y) val="$define" ;;
4039*) val="$undef" ;;
4040esac
4041set usesocks
4042eval $setvar
4043
4044case "$usesocks" in
4045$define|true|[yY]*) useperlio="$define";;
4046esac
4047
4048case "$useperlio" in
4049$define|true|[yY]*|'') dflt='y';;
4050*) dflt='n';;
4051esac
4052cat <<EOM
4053
4054Previous version of $package used the standard IO mechanisms as
4055defined in <stdio.h>. Versions 5.003_02 and later of $package allow
4056alternate IO mechanisms via the PerlIO abstraction layer, but the
4057stdio mechanism is still available if needed. The abstraction layer
4058can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4059Using PerlIO with sfio may cause problems with some extension modules.
4060
4061If this doesn't make any sense to you, just accept the default '$dflt'.
b4eb6b3d 4062EOM
f3f1a2d8
MB
4063rp='Use the PerlIO abstraction layer?'
4064. ./myread
4065case "$ans" in
4066y|Y)
b4eb6b3d
JH
4067 val="$define"
4068 ;;
f3f1a2d8
MB
4069*)
4070 echo "Ok, doing things the stdio way."
4071 val="$undef"
4072 ;;
4073esac
4074set useperlio
4075eval $setvar
4076
4077case "$usesocks" in
4078$define|true|[yY]*)
4079 case "$useperlio" in
4080 $define|true|[yY]*) ;;
4081 *) cat >&4 <<EOM
4082
4083You are using the SOCKS proxy protocol library which means that you
4084should also use the PerlIO layer. You may be headed for trouble.
4085
4086EOM
4087 ;;
b4eb6b3d 4088 esac
f3f1a2d8
MB
4089 ;;
4090esac
4091
4092
5c40187f
MB
4093: get the patchlevel
4094echo " "
4095echo "Getting the current patchlevel..." >&4
4096if $test -r $rsrc/patchlevel.h;then
4097 revision=`awk '/define[ ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4098 patchlevel=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4099 subversion=`awk '/define[ ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4100 api_revision=`awk '/define[ ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4101 api_version=`awk '/define[ ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4102 api_subversion=`awk '/define[ ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
ff803615 4103 perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
5c40187f
MB
4104else
4105 revision=0
4106 patchlevel=0
4107 subversion=0
4108 api_revision=0
4109 api_version=0
4110 api_subversion=0
4111 perl_patchlevel=0
4112 $echo "(You do not have patchlevel.h. Eek.)"
4113fi
4114if $test -r $rsrc/.patch ; then
4115 if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4116 perl_patchlevel=`cat $rsrc/.patch`
4117 fi
4118fi
4119: Define a handy string here to avoid duplication in myconfig.SH and configpm.
4120version_patchlevel_string="version $patchlevel subversion $subversion"
4121case "$perl_patchlevel" in
41220|'') ;;
4123*) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4124esac
4125
4126$echo "(You have $package $version_patchlevel_string.)"
4127
4128case "$osname" in
4129dos|vms)
4130 : XXX Should be a Configure test for double-dots in filenames.
4131 version=`echo $revision $patchlevel $subversion | \
4132 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4133 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4134 $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4135 ;;
4136*)
4137 version=`echo $revision $patchlevel $subversion | \
4138 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4139 api_versionstring=`echo $api_revision $api_version $api_subversion | \
4140 $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4141 ;;
4142esac
4143: Special case the 5.005_xx maintenance series, which used 5.005
4144: without any subversion label as a subdirectory in $sitelib
4145if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4146 api_versionstring='5.005'
4147fi
4148
f3f1a2d8
MB
4149case "$usethreads" in
4150$define|true|[yY]*) dflt='y';;
4151*) # Catch case where user specified ithreads or 5005threads but
4152 # forgot -Dusethreads (A.D. 4/2002)
4153 case "$useithreads$use5005threads" in
4154 *$define*)
4155 case "$useperlio" in
4156 "$define") dflt='y' ;;
4157 *) dflt='n' ;;
4158 esac
4159 ;;
4160 *) dflt='n';;
4161 esac
4162 ;;
4163esac
4164cat <<EOM
4165
4166Perl can be built to take advantage of threads on some systems.
4167To do so, Configure can be run with -Dusethreads.
4168
4169Note that Perl built with threading support runs slightly slower
4170and uses more memory than plain Perl. The current implementation
4171is believed to be stable, but it is fairly new, and so should be
4172treated with caution.
4173
4174If this doesn't make any sense to you, just accept the default '$dflt'.
4175EOM
4176rp='Build a threading Perl?'
4177. ./myread
4178case "$ans" in
4179y|Y) val="$define" ;;
4180*) val="$undef" ;;
4181esac
4182set usethreads
4183eval $setvar
4184
5c40187f
MB
4185if $test $patchlevel -lt 9; then
4186 case "$usethreads" in
4187 $define)
f3f1a2d8
MB
4188 $cat <<EOM
4189
4190Since release 5.6, Perl has had two different threading implementations,
4191the newer interpreter-based version (ithreads) with one interpreter per
4192thread, and the older 5.005 version (5005threads).
4193The 5005threads version is effectively unmaintained and will probably be
4194removed in Perl 5.10, so there should be no need to build a Perl using it
4195unless needed for backwards compatibility with some existing 5.005threads
4196code.
4197
4198EOM
4199 : Default to ithreads unless overridden on command line or with
4200 : old config.sh
4201 dflt='y'
4202 case "$use5005threads" in
4203 $define|true|[yY]*) dflt='n';;
4204 esac
4205 case "$useithreads" in
4206 $undef|false|[nN]*) dflt='n';;
4207 esac
4208 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
4209 . ./myread
4210 case "$ans" in
f3f1a2d8 4211 y|Y) val="$define" ;;
b4eb6b3d
JH
4212 *) val="$undef" ;;
4213 esac
f3f1a2d8
MB
4214 set useithreads
4215 eval $setvar
4216 : Now set use5005threads to the opposite value.
4217 case "$useithreads" in
4218 $define) val="$undef" ;;
4219 *) val="$define" ;;
4220 esac
4221 set use5005threads
4222 eval $setvar
4223 ;;
5c40187f 4224 *)
f3f1a2d8
MB
4225 useithreads="$undef"
4226 use5005threads="$undef"
b4eb6b3d 4227 ;;
5c40187f 4228 esac
b4eb6b3d 4229
5c40187f
MB
4230 case "$useithreads$use5005threads" in
4231 "$define$define")
f3f1a2d8 4232 $cat >&4 <<EOM
96056487 4233
f3f1a2d8
MB
4234You cannot have both the ithreads and the 5.005 threads enabled
4235at the same time. Disabling the 5.005 threads since they are
4236much less stable than the ithreads.
4237
4238EOM
4239 use5005threads="$undef"
96056487 4240 ;;
5c40187f
MB
4241 esac
4242
4243else
4244: perl-5.9.x and later
4245
47f9f84c 4246 if test X"$usethreads" = "X$define"; then
3f30fabf
MB
4247 case "$use5005threads" in
4248 $define|true|[yY]*)
4249 $cat >&4 <<EOM
47f9f84c
JH
4250
42515.005 threads has been removed for 5.10. Perl will be built using ithreads.
5c40187f 4252
47f9f84c 4253EOM
3f30fabf
MB
4254 ;;
4255 esac
47f9f84c 4256 fi
3f30fabf 4257
47f9f84c
JH
4258 use5005threads="$undef"
4259 useithreads="$usethreads"
5c40187f 4260fi
96056487 4261
f3f1a2d8
MB
4262if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4263 cat >&4 <<EOF
4264***
4265*** To build with ithreads you must also use the PerlIO layer.
4266*** Cannot continue, aborting.
4267***
4268EOF
4269 exit 1
4270fi
4271
4272case "$d_oldpthreads" in
4273'') : Configure tests would be welcome here. For now, assume undef.
4274 val="$undef" ;;
4275*) val="$d_oldpthreads" ;;
4276esac
4277set d_oldpthreads
4278eval $setvar
4279
4280
4281: Look for a hint-file generated 'call-back-unit'. If the
4282: user has specified that a threading perl is to be built,
4283: we may need to set or change some other defaults.
4284if $test -f usethreads.cbu; then
4285 echo "Your platform has some specific hints regarding threaded builds, using them..."
4286 . ./usethreads.cbu
4287else
4288 case "$usethreads" in
4289 "$define"|true|[yY]*)
4290 $cat <<EOM
4291(Your platform does not have any specific hints for threaded builds.
4292 Assuming POSIX threads, then.)
4293EOM
4294 ;;
4295 esac
4296fi
4297
4298cat <<EOM
4299
4300Perl can be built so that multiple Perl interpreters can coexist
4301within the same Perl executable.
4302EOM
4303
4304case "$useithreads" in
4305$define)
4306 cat <<EOM
4307This multiple interpreter support is required for interpreter-based threads.
4308EOM
4309 val="$define"
4310 ;;
4311*) case "$usemultiplicity" in
4312 $define|true|[yY]*) dflt='y';;
4313 *) dflt='n';;
4314 esac
4315 echo " "
4316 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4317 rp='Build Perl for multiplicity?'
4318 . ./myread
4319 case "$ans" in
4320 y|Y) val="$define" ;;
4321 *) val="$undef" ;;
4322 esac
4323 ;;
4324esac
4325set usemultiplicity
4326eval $setvar
4327
4328
4329case "$usemorebits" in
4330"$define"|true|[yY]*)
4331 use64bitint="$define"
4332 uselongdouble="$define"
4333 usemorebits="$define"
4334 ;;
4335*) usemorebits="$undef"
4336 ;;
4337esac
4338
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
5869b1f1
JH
4434case "$cc" in
4435'') dflt=cc;;
4436*) dflt="$cc";;
4437esac
4438rp="Use which C compiler?"
4439. ./myread
4440cc="$ans"
6b769f8f
RB
4441
4442: See if they have not cc but they do have gcc
4443. ./trygcc
e5e20432
JH
4444: Look for a hint-file generated 'call-back-unit'. Now that the
4445: user has specified the compiler, we may need to set or change some
4446: other defaults.
4447if $test -f cc.cbu; then
4448 . ./cc.cbu
4449fi
2573c5f9 4450. ./checkcc
8a27cf78 4451
e5e20432
JH
4452echo " "
4453echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 4454$cat >try.c <<EOM
e5e20432
JH
4455#include <stdio.h>
4456int main() {
7686528e 4457#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
e5e20432
JH
4458#ifdef __VERSION__
4459 printf("%s\n", __VERSION__);
4460#else
4461 printf("%s\n", "1");
4462#endif
4463#endif
073b6de5 4464 return(0);
e5e20432
JH
4465}
4466EOM
5440bc8e
JH
4467if $cc -o try $ccflags $ldflags try.c; then
4468 gccversion=`$run ./try`
f3f1a2d8
MB
4469 case "$gccversion" in
4470 '') echo "You are not using GNU cc." ;;
4471 *) echo "You are using GNU cc $gccversion."
4472 ccname=gcc
4473 ;;
4474 esac
4475else
4476 echo " "
4477 echo "*** WHOA THERE!!! ***" >&4
4478 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
4479 case "$knowitall" in
4480 '')
4481 echo " You'd better start hunting for one and let me know about it." >&4
4482 exit 1
2304df62
AD
4483 ;;
4484 esac
f3f1a2d8
MB
4485fi
4486$rm -f try try.*
4487case "$gccversion" in
44881*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4489esac
4490case "$gccversion" in
4491'') gccosandvers='' ;;
4492*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4493 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4494 gccshortvers=''
4495 case "$gccosandvers" in
4496 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4497 $osname$osvers) ;; # looking good
4498 $osname*) cat <<EOM >&4
4499
4500*** WHOA THERE!!! ***
4501
4502 Your gcc has not been compiled for the exact release of
4503 your operating system ($gccosandvers versus $osname$osvers).
4504
4505 In general it is a good idea to keep gcc synchronized with
4506 the operating system because otherwise serious problems
4507 may ensue when trying to compile software, like Perl.
4508
4509 I'm trying to be optimistic here, though, and will continue.
4510 If later during the configuration and build icky compilation
4511 problems appear (headerfile conflicts being the most common
4512 manifestation), I suggest reinstalling the gcc to match
4513 your operating system release.
4514
4515EOM
4516 ;;
4517 *) gccosandvers='' ;; # failed to parse, better be silent
4518 esac
4519 ;;
4520esac
4521case "$ccname" in
4522'') ccname="$cc" ;;
4523esac
4524
4525# gcc 3.* complain about adding -Idirectories that they already know about,
4526# so we will take those off from locincpth.
4527case "$gccversion" in
45283*)
4529 echo "main(){}">try.c
4530 for incdir in $locincpth; do
4531 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4532 grep '^c[cp]p*[01]: warning: changing search order '`
4533 if test "X$warn" != X; then
4534 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4535 fi
4536 done
4537 $rm -f try try.*
4538esac
2304df62 4539
bd9b35c9
JH
4540: What should the include directory be ?
4541echo " "
4542$echo $n "Hmm... $c"
4543dflt='/usr/include'
4544incpath=''
4545mips_type=''
4546if $test -f /bin/mips && /bin/mips; then
4547 echo "Looks like a MIPS system..."
4548 $cat >usr.c <<'EOCP'
4549#ifdef SYSTYPE_BSD43
4550/bsd43
4551#endif
4552EOCP
8a27cf78 4553 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
bd9b35c9
JH
4554 dflt='/bsd43/usr/include'
4555 incpath='/bsd43'
4556 mips_type='BSD 4.3'
4557 else
4558 mips_type='System V'
4559 fi
4560 $rm -f usr.c usr.out
4561 echo "and you're compiling with the $mips_type compiler and libraries."
4562 xxx_prompt=y
4563 echo "exit 0" >mips
4564else
4565 echo "Doesn't look like a MIPS system."
4566 xxx_prompt=n
4567 echo "exit 1" >mips
4568fi
4569chmod +x mips
4570$eunicefix mips
4571case "$usrinc" in
4572'') ;;
4573*) dflt="$usrinc";;
4574esac
4575case "$xxx_prompt" in
4576y) fn=d/
4577 echo " "
4578 rp='Where are the include files you want to use?'
4579 . ./getfile
4580 usrinc="$ans"
8e07c86e 4581 ;;
bd9b35c9 4582*) usrinc="$dflt"
8e07c86e
AD
4583 ;;
4584esac
2304df62 4585
96056487
JH
4586: see how we invoke the C preprocessor
4587echo " "
4588echo "Now, how can we feed standard input to your C preprocessor..." >&4
4589cat <<'EOT' >testcpp.c
4590#define ABC abc
4591#define XYZ xyz
4592ABC.XYZ
4593EOT
4594cd ..
4595if test ! -f cppstdin; then
4596 if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4597 # AIX cc -E doesn't show the absolute headerfile
4598 # locations but we'll cheat by using the -M flag.
4599 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
4600 else
4601 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4602 fi
4603else
4604 echo "Keeping your $hint cppstdin wrapper."
4605fi
4606chmod 755 cppstdin
4607wrapper=`pwd`/cppstdin
4608ok='false'
4609cd UU
4610
4611if $test "X$cppstdin" != "X" && \
4612 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4613 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4614then
4615 echo "You used to use $cppstdin $cppminus so we'll use that again."
4616 case "$cpprun" in
4617 '') echo "But let's see if we can live without a wrapper..." ;;
4618 *)
4619 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4620 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4621 then
4622 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4623 ok='true'
4624 else
4625 echo "(However, $cpprun $cpplast does not work, let's see...)"
4626 fi
4627 ;;
4628 esac
4629else
4630 case "$cppstdin" in
4631 '') ;;
4632 *)
4633 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4634 ;;
4635 esac
4636fi
4637
4638if $ok; then
4639 : nothing
4640elif echo 'Maybe "'"$cc"' -E" will work...'; \
4641 $cc -E <testcpp.c >testcpp.out 2>&1; \
4642 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4643 echo "Yup, it does."
4644 x_cpp="$cc -E"
4645 x_minus='';
4646elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4647 $cc -E - <testcpp.c >testcpp.out 2>&1; \
4648 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4649 echo "Yup, it does."
4650 x_cpp="$cc -E"
4651 x_minus='-';
4652elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4653 $cc -P <testcpp.c >testcpp.out 2>&1; \
4654 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4655 echo "Yipee, that works!"
4656 x_cpp="$cc -P"
4657 x_minus='';
4658elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4659 $cc -P - <testcpp.c >testcpp.out 2>&1; \
4660 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4661 echo "At long last!"
4662 x_cpp="$cc -P"
4663 x_minus='-';
4664elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4665 $cpp <testcpp.c >testcpp.out 2>&1; \
4666 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4667 echo "It works!"
4668 x_cpp="$cpp"
4669 x_minus='';
4670elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4671 $cpp - <testcpp.c >testcpp.out 2>&1; \
4672 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4673 echo "Hooray, it works! I was beginning to wonder."
4674 x_cpp="$cpp"
4675 x_minus='-';
4676elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
4677 $wrapper <testcpp.c >testcpp.out 2>&1; \
4678 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4679 x_cpp="$wrapper"
4680 x_minus=''
4681 echo "Eureka!"
4682else
4683 dflt=''
4684 rp="No dice. I can't find a C preprocessor. Name one:"
4685 . ./myread
4686 x_cpp="$ans"
4687 x_minus=''
4688 $x_cpp <testcpp.c >testcpp.out 2>&1
4689 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4690 echo "OK, that will do." >&4
4691 else
4692echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
4693 exit 1
4694 fi
4695fi
4696
4697case "$ok" in
4698false)
4699 cppstdin="$x_cpp"
4700 cppminus="$x_minus"
4701 cpprun="$x_cpp"
4702 cpplast="$x_minus"
4703 set X $x_cpp
4704 shift
4705 case "$1" in
4706 "$cpp")
4707 echo "Perhaps can we force $cc -E using a wrapper..."
4708 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4709 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4710 then
4711 echo "Yup, we can."
4712 cppstdin="$wrapper"
4713 cppminus='';
4714 else
4715 echo "Nope, we'll have to live without it..."
4716 fi
4717 ;;
4718 esac
4719 case "$cpprun" in
4720 "$wrapper")
4721 cpprun=''
4722 cpplast=''
4723 ;;
4724 esac
4725 ;;
4726esac
4727
4728case "$cppstdin" in
4729"$wrapper"|'cppstdin') ;;
4730*) $rm -f $wrapper;;
4731esac
4732$rm -f testcpp.c testcpp.out
4733
bd9b35c9
JH
4734: Set private lib path
4735case "$plibpth" in
4736'') if ./mips; then
4737 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4738 fi;;
4739esac
4740case "$libpth" in
4741' ') dlist='';;
4742'') dlist="$loclibpth $plibpth $glibpth";;
4743*) dlist="$libpth";;
4744esac
4745
4746: Now check and see which directories actually exist, avoiding duplicates
4747libpth=''
4748for xxx in $dlist
4749do
4750 if $test -d $xxx; then
4751 case " $libpth " in
4752 *" $xxx "*) ;;
4753 *) libpth="$libpth $xxx";;
4754 esac
4755 fi
4756done
4757$cat <<'EOM'
4758
4759Some systems have incompatible or broken versions of libraries. Among
4760the directories listed in the question below, please remove any you
4761know not to be holding relevant libraries, and add any that are needed.
4762Say "none" for none.
8e07c86e
AD
4763
4764EOM
bd9b35c9
JH
4765case "$libpth" in
4766'') dflt='none';;
8e07c86e 4767*)
bd9b35c9
JH
4768 set X $libpth
4769 shift
4770 dflt=${1+"$@"}
8e07c86e 4771 ;;
a0d0e21e 4772esac
bd9b35c9
JH
4773rp="Directories to use for library searches?"
4774. ./myread
4775case "$ans" in
4776none) libpth=' ';;
4777*) libpth="$ans";;
4778esac
a0d0e21e 4779
bd9b35c9
JH
4780: compute shared library extension
4781case "$so" in
4782'')
4783 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4784 dflt='sl'
dd4e71fd 4785 else
bd9b35c9 4786 dflt='so'
dd4e71fd
JH
4787 fi
4788 ;;
bd9b35c9 4789*) dflt="$so";;
dd4e71fd 4790esac
dd4e71fd
JH
4791$cat <<EOM
4792
bd9b35c9 4793On some systems, shared libraries may be available. Answer 'none' if
7f95ee77 4794you want to suppress searching of shared libraries for the remainder
bd9b35c9 4795of this configuration.
dd4e71fd
JH
4796
4797EOM
bd9b35c9
JH
4798rp='What is the file extension used for shared libraries?'
4799. ./myread
4800so="$ans"
dd4e71fd 4801
bd9b35c9
JH
4802: Define several unixisms.
4803: Hints files or command line option can be used to override them.
4804: The convoluted testing is in case hints files set either the old
4805: or the new name.
4806case "$_exe" in
4807'') case "$exe_ext" in
1fef16b3 4808 '') ;;
bd9b35c9 4809 *) _exe="$exe_ext" ;;
dd4e71fd 4810 esac
bd9b35c9 4811 ;;
bfb7748a 4812esac
bd9b35c9
JH
4813case "$_a" in
4814'') case "$lib_ext" in
4815 '') _a='.a';;
4816 *) _a="$lib_ext" ;;
dd4e71fd
JH
4817 esac
4818 ;;
dd4e71fd 4819esac
bd9b35c9
JH
4820case "$_o" in
4821'') case "$obj_ext" in
4822 '') _o='.o';;
4823 *) _o="$obj_ext";;
4824 esac
4825 ;;
4826esac
4827case "$p_" in
4828'') case "$path_sep" in
4829 '') p_=':';;
4830 *) p_="$path_sep";;
4831 esac
4832 ;;
4833esac
4834exe_ext=$_exe
4835lib_ext=$_a
4836obj_ext=$_o
4837path_sep=$p_
dd4e71fd 4838
5b813a60
MB
4839rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4840
b4eb6b3d
JH
4841: Which makefile gets called first. This is used by make depend.
4842case "$firstmakefile" in
4843'') firstmakefile='makefile';;
4633a7c4 4844esac
4633a7c4 4845
1f603089
JH
4846case "$ccflags" in
4847*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4848esac
4849
4850case "$uselongdouble" in
4851$define|true|[yY]*) dflt='y';;
4852*) dflt='n';;
4853esac
4854cat <<EOM
4855
4856Perl can be built to take advantage of long doubles which
4857(if available) may give more accuracy and range for floating point numbers.
4858
4859If this doesn't make any sense to you, just accept the default '$dflt'.
4860EOM
4861rp='Try to use long doubles if available?'
4862. ./myread
4863case "$ans" in
4864y|Y) val="$define" ;;
4865*) val="$undef" ;;
4866esac
4867set uselongdouble
4868eval $setvar
4869
4870case "$uselongdouble" in
4871true|[yY]*) uselongdouble="$define" ;;
4872esac
4873
1f603089
JH
4874: Look for a hint-file generated 'call-back-unit'. If the
4875: user has specified that long doubles should be used,
4876: we may need to set or change some other defaults.
9da7673b
MB
4877if $test -f uselongdouble.cbu; then
4878 echo "Your platform has some specific hints regarding long doubles, using them..."
4879 . ./uselongdouble.cbu
4880else
4881 case "$uselongdouble" in
4882 $define)
1f603089 4883 $cat <<EOM
9da7673b 4884(Your platform does not have any specific hints for long doubles.)
1f603089 4885EOM
1f603089 4886 ;;
9da7673b
MB
4887 esac
4888fi
1f603089 4889
bd9b35c9
JH
4890: Looking for optional libraries
4891echo " "
4892echo "Checking for optional libraries..." >&4
4893case "$libs" in
4894' '|'') dflt='';;
4895*) dflt="$libs";;
4896esac
4897case "$libswanted" in
4898'') libswanted='c_s';;
4899esac
4900case "$usesocks" in
923fc586 4901"$define") libswanted="$libswanted socks5 socks5_sh" ;;
8e07c86e 4902esac
68435ea7
JH
4903libsfound=''
4904libsfiles=''
4905libsdirs=''
13b3f787
JH
4906libspath=''
4907for thisdir in $libpth $xlibpth; do
4908 test -d $thisdir && libspath="$libspath $thisdir"
4909done
bd9b35c9 4910for thislib in $libswanted; do
13b3f787 4911 for thisdir in $libspath; do
f7dd4e7f
JH
4912 xxx=''
4913 if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
eade9b71 4914 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
f7dd4e7f
JH
4915 $test -f "$xxx" && eval $libscheck
4916 $test -f "$xxx" && libstyle=shared
4917 fi
4918 if test ! -f "$xxx"; then
4919 xxx=$thisdir/lib$thislib.$so
4920 $test -f "$xxx" && eval $libscheck
4921 $test -f "$xxx" && libstyle=shared
4922 fi
4923 if test ! -f "$xxx"; then
4924 xxx=$thisdir/lib$thislib$_a
4925 $test -f "$xxx" && eval $libscheck
4926 $test -f "$xxx" && libstyle=static
4927 fi
4928 if test ! -f "$xxx"; then
4929 xxx=$thisdir/$thislib$_a
4930 $test -f "$xxx" && eval $libscheck
4931 $test -f "$xxx" && libstyle=static
4932 fi
4933 if test ! -f "$xxx"; then
4934 xxx=$thisdir/lib${thislib}_s$_a
4935 $test -f "$xxx" && eval $libscheck
4936 $test -f "$xxx" && libstyle=static
09ea5ba9 4937 $test -f "$xxx" && thislib=${thislib}_s
f7dd4e7f
JH
4938 fi
4939 if test ! -f "$xxx"; then
4940 xxx=$thisdir/Slib$thislib$_a
4941 $test -f "$xxx" && eval $libscheck
4942 $test -f "$xxx" && libstyle=static
4943 fi
4944 if $test -f "$xxx"; then
43999f95 4945 case "$libstyle" in
f7dd4e7f
JH
4946 shared) echo "Found -l$thislib (shared)." ;;
4947 static) echo "Found -l$thislib." ;;
4948 *) echo "Found -l$thislib ($libstyle)." ;;
43999f95 4949 esac
bd9b35c9
JH
4950 case " $dflt " in
4951 *"-l$thislib "*);;
f7dd4e7f 4952 *) dflt="$dflt -l$thislib"
43999f95
JH
4953 libsfound="$libsfound $xxx"
4954 yyy=`basename $xxx`
4955 libsfiles="$libsfiles $yyy"
1e127011 4956 yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
43999f95
JH
4957 case " $libsdirs " in
4958 *" $yyy "*) ;;
4959 *) libsdirs="$libsdirs $yyy" ;;
4960 esac
4961 ;;
bd9b35c9 4962 esac
f7dd4e7f
JH
4963 break
4964 fi
4965 done
4966 if $test ! -f "$xxx"; then
4967 echo "No -l$thislib."
bd9b35c9
JH
4968 fi
4969done
4970set X $dflt
4971shift
4972dflt="$*"
4973case "$libs" in
4974'') dflt="$dflt";;
4975*) dflt="$libs";;
4976esac
4977case "$dflt" in
4978' '|'') dflt='none';;
4979esac
4633a7c4 4980
bd9b35c9 4981$cat <<EOM
4633a7c4 4982
bd9b35c9
JH
4983In order to compile $package on your machine, a number of libraries
4984are usually needed. Include any other special libraries here as well.
4985Say "none" for none. The default list is almost always right.
8e07c86e 4986EOM
8e07c86e 4987
bd9b35c9
JH
4988echo " "
4989rp="What libraries to use?"
4990. ./myread
4991case "$ans" in
4992none) libs=' ';;
4993*) libs="$ans";;
4994esac
d71b2b6b 4995
bd9b35c9
JH
4996: determine optimization, if desired, or use for debug flag also
4997case "$optimize" in
4998' '|$undef) dflt='none';;
4999'') dflt='-O';;
5000*) dflt="$optimize";;
5001esac
5002$cat <<EOH
d71b2b6b 5003
bd9b35c9
JH
5004By default, $package compiles with the -O flag to use the optimizer.
5005Alternately, you might want to use the symbolic debugger, which uses
5006the -g flag (on traditional Unix systems). Either flag can be
5007specified here. To use neither flag, specify the word "none".
d71b2b6b 5008
bd9b35c9
JH
5009EOH
5010rp="What optimizer/debugger flag should be used?"
5011. ./myread
5012optimize="$ans"
5013case "$optimize" in
5014'none') optimize=" ";;
5015esac
5016
eaf812ae
MB
5017: Check what DEBUGGING is required from the command line
5018: -DEBUGGING or -DDEBUGGING or
5019: -DEBUGGING=both = -g + -DDEBUGGING
5020: -DEBUGGING=-g or -Doptimize=-g = -g
5021: -DEBUGGING=none or -UDEBUGGING =
5022: -DEBUGGING=old or -DEBUGGING=default = ? $optimize
5023case "$EBUGGING" in
5024'') ;;
5025*) DEBUGGING=$EBUGGING ;;
5026esac
5027
5028case "$DEBUGGING" in
5a7c70d6 5029-g|both|$define)
eaf812ae
MB
5030 case "$optimize" in
5031 *-g*) ;;
5032 *) optimize="$optimize -g" ;;
5033 esac ;;
5034none|$undef)
5035 case "$optimize" in
5036 *-g*) set `echo "X $optimize " | sed 's/ -g / /'`
5037 shift
5038 optimize="$*"
5039 ;;
5040 esac ;;
5041esac
5042
bd9b35c9 5043dflt=''
eaf812ae
MB
5044case "$DEBUGGING" in
5045both|$define) dflt='-DDEBUGGING'
5046esac
5047
bd9b35c9
JH
5048: We will not override a previous value, but we might want to
5049: augment a hint file
5050case "$hint" in
5051default|recommended)
5052 case "$gccversion" in
eaf812ae 5053 1*) dflt="$dflt -fpcc-struct-return" ;;
d71b2b6b 5054 esac
eaf812ae
MB
5055 case "$optimize:$DEBUGGING" in
5056 *-g*:old) dflt="$dflt -DDEBUGGING";;
d71b2b6b 5057 esac
bd9b35c9
JH
5058 case "$gccversion" in
5059 2*) if test -d /etc/conf/kconfig.d &&
5060 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5061 then
00e89ad4 5062 # Interactive Systems (ISC) POSIX mode.
bd9b35c9
JH
5063 dflt="$dflt -posix"
5064 fi
f0d04425 5065 ;;
bd9b35c9
JH
5066 esac
5067 case "$gccversion" in
5068 1*) ;;
5069 2.[0-8]*) ;;
5070 ?*) echo " "
5071 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5072 echo 'int main(void) { return 0; }' > gcctest.c
5073 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5074 echo "Yes, it does." 2>&1
5075 case "$ccflags" in
00e89ad4 5076 *strict-aliasing*)
bd9b35c9
JH
5077 echo "Leaving current flags $ccflags alone." 2>&1
5078 ;;
5079 *) dflt="$dflt -fno-strict-aliasing" ;;
5080 esac
5081 else
5082 echo "Nope, it doesn't, but that's ok." 2>&1
5083 fi
f0d04425 5084 ;;
e5e20432 5085 esac
00e89ad4
AD
5086 # For gcc, adding -pipe speeds up compilations for some, but apparently
5087 # some assemblers can't read from stdin. (It also slows down compilations
5088 # in other cases, but those are apparently rarer these days.) AD 5/2004.
5089 case "$gccversion" in
5090 ?*) echo " "
5091 echo "Checking if your compiler accepts -pipe" 2>&1
5092 echo 'int main(void) { return 0; }' > gcctest.c
6347b5be 5093 if $cc -pipe -o gcctest gcctest.c; then
00e89ad4
AD
5094 echo "Yes, it does." 2>&1
5095 case "$ccflags" in
5096 *-pipe*)
5097 echo "Leaving current flags $ccflags alone." 2>&1
5098 ;;
5099 *) dflt="$dflt -pipe" ;;
5100 esac
5101 else
5102 echo "Nope, it doesn't, but that's ok." 2>&1
5103 fi
5104 ;;
5105 esac
e5e20432
JH
5106 ;;
5107esac
5108
bd9b35c9
JH
5109case "$mips_type" in
5110*BSD*|'') inclwanted="$locincpth $usrinc";;
5111*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5112esac
5113for thisincl in $inclwanted; do
5114 if $test -d $thisincl; then
5115 if $test x$thisincl != x$usrinc; then
5116 case "$dflt" in
00e89ad4
AD
5117 *" -I$thisincl "*);;
5118 *) dflt="$dflt -I$thisincl ";;
bd9b35c9
JH
5119 esac
5120 fi
5121 fi
5122done
40a7a20a 5123
bd9b35c9
JH
5124inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5125 xxx=true;
5126elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5127 xxx=true;
5128else
5129 xxx=false;
5130fi;
5131if $xxx; then
5132 case "$dflt" in
5133 *$2*);;
5134 *) dflt="$dflt -D$2";;
5135 esac;
5136fi'
40a7a20a 5137
bd9b35c9 5138set signal.h LANGUAGE_C; eval $inctest
40a7a20a 5139
bd9b35c9
JH
5140case "$usesocks" in
5141$define)
5142 ccflags="$ccflags -DSOCKS"
5143 ;;
5144esac
40a7a20a 5145
bd9b35c9
JH
5146case "$hint" in
5147default|recommended) dflt="$ccflags $dflt" ;;
5148*) dflt="$ccflags";;
5149esac
40a7a20a 5150
bd9b35c9
JH
5151case "$dflt" in
5152''|' ') dflt=none;;
5153esac
422af00a 5154
bd9b35c9 5155$cat <<EOH
40a7a20a 5156
bd9b35c9
JH
5157Your C compiler may want other flags. For this question you should include
5158-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5159but you should NOT include libraries or ld flags like -lwhatever. If you
5160want $package to honor its debug switch, you should include -DDEBUGGING here.
5161Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
40a7a20a 5162
bd9b35c9 5163To use no flags, specify the word "none".
40a7a20a 5164
bd9b35c9
JH
5165EOH
5166set X $dflt
5167shift
5168dflt=${1+"$@"}
5169rp="Any additional cc flags?"
5170. ./myread
5171case "$ans" in
5172none) ccflags='';;
5173*) ccflags="$ans";;
5174esac
8e07c86e 5175
bd9b35c9 5176: the following weeds options from ccflags that are of no interest to cpp
58e77565
JH
5177case "$cppflags" in
5178'') cppflags="$ccflags" ;;
5179*) cppflags="$cppflags $ccflags" ;;
5180esac
bd9b35c9
JH
5181case "$gccversion" in
51821*) cppflags="$cppflags -D__GNUC__"
4633a7c4 5183esac
bd9b35c9
JH
5184case "$mips_type" in
5185'');;
5186*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5187esac
5188case "$cppflags" in
5189'');;
5190*)
5191 echo " "
5192 echo "Let me guess what the preprocessor flags are..." >&4
5193 set X $cppflags
5194 shift
5195 cppflags=''
5196 $cat >cpp.c <<'EOM'
5197#define BLURFL foo
8e07c86e 5198
bd9b35c9
JH
5199BLURFL xx LFRULB
5200EOM
5201 previous=''
5202 for flag in $*
5203 do
5204 case "$flag" in
5205 -*) ftry="$flag";;
5206 *) ftry="$previous $flag";;
5207 esac
5208 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5209 >cpp1.out 2>/dev/null && \
5210 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5211 >cpp2.out 2>/dev/null && \
5212 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5213 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5214 then
5215 cppflags="$cppflags $ftry"
5216 previous=''
5217 else
5218 previous="$flag"
5219 fi
5220 done
5221 set X $cppflags
5222 shift
5223 cppflags=${1+"$@"}
5224 case "$cppflags" in
5225 *-*) echo "They appear to be: $cppflags";;
5226 esac
5227 $rm -f cpp.c cpp?.out
2afac517 5228 ;;
5229esac
8e07c86e 5230
bd9b35c9
JH
5231: flags used in final linking phase
5232case "$ldflags" in
5233'') if ./venix; then
5234 dflt='-i -z'
10a23457 5235 else
bd9b35c9 5236 dflt=''
10a23457 5237 fi
bd9b35c9
JH
5238 case "$ccflags" in
5239 *-posix*) dflt="$dflt -posix" ;;
c4f23d77 5240 esac
bd9b35c9
JH
5241 ;;
5242*) dflt="$ldflags";;
5243esac
5244
5245: Try to guess additional flags to pick up local libraries.
5246for thislibdir in $libpth; do
5247 case " $loclibpth " in
5248 *" $thislibdir "*)
00e89ad4 5249 case "$dflt " in
bd9b35c9
JH
5250 *"-L$thislibdir "*) ;;
5251 *) dflt="$dflt -L$thislibdir" ;;
5252 esac
c4f23d77
AD
5253 ;;
5254 esac
bd9b35c9 5255done
c4f23d77 5256
bd9b35c9
JH
5257case "$dflt" in
5258'') dflt='none' ;;
5259esac
c4f23d77 5260
bd9b35c9
JH
5261$cat <<EOH
5262
5263Your C linker may need flags. For this question you should
5264include -L/whatever and any other flags used by the C linker, but you
5265should NOT include libraries like -lwhatever.
5266
5267Make sure you include the appropriate -L/path flags if your C linker
5268does not normally search all of the directories you specified above,
5269namely
5270 $libpth
5271To use no flags, specify the word "none".
5272
5273EOH
5274
5275rp="Any additional ld flags (NOT including libraries)?"
5276. ./myread
5277case "$ans" in
5278none) ldflags='';;
5279*) ldflags="$ans";;
5280esac
5281rmlist="$rmlist pdp11"
5282
5283: coherency check
5284echo " "
5285echo "Checking your choice of C compiler and flags for coherency..." >&4
5286$cat > try.c <<'EOF'
5287#include <stdio.h>
55954f19 5288int main() { printf("Ok\n"); return(0); }
bd9b35c9 5289EOF
7a282f6d 5290set X $cc -o try $optimize $ccflags $ldflags try.c $libs
bd9b35c9
JH
5291shift
5292$cat >try.msg <<'EOM'
5293I've tried to compile and run the following simple program:
5294
5295EOM
5296$cat try.c >> try.msg
5297
5298$cat >> try.msg <<EOM
5299
5300I used the command:
5301
5302 $*
5440bc8e 5303 $run ./try
bd9b35c9
JH
5304
5305and I got the following output:
5306
5307EOM
5308dflt=y
73614538 5309if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5440bc8e
JH
5310 if $sh -c "$run ./try" >>try.msg 2>&1; then
5311 xxx=`$run ./try`
bd9b35c9
JH
5312 case "$xxx" in
5313 "Ok") dflt=n ;;
5314 *) echo 'The program compiled OK, but produced no output.' >> try.msg
5315 case " $libs " in
5316 *" -lsfio "*)
5317 cat >> try.msg <<'EOQS'
5318If $libs contains -lsfio, and sfio is mis-configured, then it
5319sometimes (apparently) runs and exits with a 0 status, but with no
5320output! It may have to do with sfio's use of _exit vs. exit.
5321
5322EOQS
5323 rp="You have a big problem. Shall I abort Configure"
5324 dflt=y
5325 ;;
5326 esac
5327 ;;
5328 esac
5329 else
5330 echo "The program compiled OK, but exited with status $?." >>try.msg
5331 rp="You have a problem. Shall I abort Configure"
5332 dflt=y
5333 fi
5334else
5335 echo "I can't compile the test program." >>try.msg
5336 rp="You have a BIG problem. Shall I abort Configure"
5337 dflt=y
5338fi
5339case "$dflt" in
5340y)
5341 $cat try.msg >&4
5342 case "$knowitall" in
5343 '')
5344 echo "(The supplied flags or libraries might be incorrect.)"
c4f23d77 5345 ;;
bd9b35c9 5346 *) dflt=n;;
c4f23d77 5347 esac
bd9b35c9
JH
5348 echo " "
5349 . ./myread
5350 case "$ans" in
5351 n*|N*) ;;
5352 *) echo "Ok. Stopping Configure." >&4
5353 exit 1
c4f23d77
AD
5354 ;;
5355 esac
5356 ;;
bd9b35c9 5357n) echo "OK, that should do.";;
c4f23d77 5358esac
5b813a60 5359$rm_try
c4f23d77 5360
bd9b35c9
JH
5361: define a shorthand compile call
5362compile='
5363mc_file=$1;
5364shift;
08413ebc 5365$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
bd9b35c9
JH
5366: define a shorthand compile call for compilations that should be ok.
5367compile_ok='
5368mc_file=$1;
5369shift;
7a282f6d 5370$cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
8e07c86e 5371
8dfa8df9
JH
5372: determine filename position in cpp output
5373echo " "
5374echo "Computing filename position in cpp output for #include directives..." >&4
a5a94ea5
JH
5375case "$osname" in
5376vos) testaccess=-e ;;
5377*) testaccess=-r ;;
5378esac
8dfa8df9
JH
5379echo '#include <stdio.h>' > foo.c
5380$cat >fieldn <<EOF
5381$startsh
5382$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5383$grep '^[ ]*#.*stdio\.h' | \
5384while read cline; do
5385 pos=1
5386 set \$cline
5387 while $test \$# -gt 0; do
a5a94ea5 5388 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
8dfa8df9
JH
5389 echo "\$pos"
5390 exit 0
5391 fi
5392 shift
5393 pos=\`expr \$pos + 1\`
5394 done
5395done
5396EOF
5397chmod +x fieldn
5398fieldn=`./fieldn`
5399$rm -f foo.c fieldn
5400case $fieldn in
5401'') pos='???';;
54021) pos=first;;
54032) pos=second;;
54043) pos=third;;
5405*) pos="${fieldn}th";;
5406esac
5407echo "Your cpp writes the filename in the $pos field of the line."
5408
3c728e00
JH
5409case "$osname" in
5410vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5c728af0 5411os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
3c728e00
JH
5412*) cppfilter='' ;;
5413esac
8dfa8df9
JH
5414: locate header file
5415$cat >findhdr <<EOF
5416$startsh
5417wanted=\$1
5418name=''
5419for usrincdir in $usrinc
5420do
5421 if test -f \$usrincdir/\$wanted; then
5422 echo "\$usrincdir/\$wanted"
5423 exit 0
5424 fi
5425done
5426awkprg='{ print \$$fieldn }'
5427echo "#include <\$wanted>" > foo\$\$.c
5428$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3c728e00 5429$cppfilter $grep "^[ ]*#.*\$wanted" | \
8dfa8df9
JH
5430while read cline; do
5431 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5432 case "\$name" in
5433 *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5434 *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5435 *) exit 2;;
5436 esac;
5437done;
5438#
5439# status = 0: grep returned 0 lines, case statement not executed
5440# status = 1: headerfile found
5441# status = 2: while loop executed, no headerfile found
5442#
5443status=\$?
5444$rm -f foo\$\$.c;
5445if test \$status -eq 1; then
5446 exit 0;
5447fi
5448exit 1
5449EOF
5450chmod +x findhdr
5451
5452: define an alternate in-header-list? function
5453inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5454cont=true; xxf="echo \"<\$1> found.\" >&4";
5455case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5456*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5457esac;
5458case $# in 4) instead=instead;; *) instead="at last";; esac;
5459while $test "$cont"; do
5460 xxx=`./findhdr $1`
5461 var=$2; eval "was=\$$2";
5462 if $test "$xxx" && $test -r "$xxx";
5463 then eval $xxf;
5464 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5465 cont="";
5466 else eval $xxnf;
5467 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5468 set $yyy; shift; shift; yyy=$@;
5469 case $# in 0) cont="";;
5470 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5471 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5472 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5473 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5474 esac;
5475done;
5476while $test "$yyy";
5477do set $yyy; var=$2; eval "was=\$$2";
5478 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5479 set $yyy; shift; shift; yyy=$@;
5480done'
5481
d1daaddf
JH
5482: see if stdlib is available
5483set stdlib.h i_stdlib
5484eval $inhdr
5485
5486: check for lengths of integral types
5487echo " "
5488case "$intsize" in
5489'')
5490 echo "Checking to see how big your integers are..." >&4
c63dfae1 5491 $cat >try.c <<EOCP
d1daaddf
JH
5492#include <stdio.h>
5493#$i_stdlib I_STDLIB
5494#ifdef I_STDLIB
5495#include <stdlib.h>
5496#endif
5497int main()
5498{
5499 printf("intsize=%d;\n", (int)sizeof(int));
5500 printf("longsize=%d;\n", (int)sizeof(long));
5501 printf("shortsize=%d;\n", (int)sizeof(short));
5502 exit(0);
5503}
5504EOCP
5505 set try
5506 if eval $compile_ok && $run ./try > /dev/null; then
5507 eval `$run ./try`
5508 echo "Your integers are $intsize bytes long."
5509 echo "Your long integers are $longsize bytes long."
5510 echo "Your short integers are $shortsize bytes long."
5511 else
5512 $cat >&4 <<EOM
5513!
5514Help! I can't compile and run the intsize test program: please enlighten me!
5515(This is probably a misconfiguration in your system or libraries, and
5516you really ought to fix it. Still, I'll try anyway.)
5517!
5518EOM
5519 dflt=4
5520 rp="What is the size of an integer (in bytes)?"
5521 . ./myread
5522 intsize="$ans"
5523 dflt=$intsize
5524 rp="What is the size of a long integer (in bytes)?"
5525 . ./myread
5526 longsize="$ans"
5527 dflt=2
5528 rp="What is the size of a short integer (in bytes)?"
5529 . ./myread
5530 shortsize="$ans"
5531 fi
5532 ;;
5533esac
5b813a60 5534$rm_try
d1daaddf
JH
5535
5536: check for long long
5537echo " "
5538echo "Checking to see if you have long long..." >&4
5539echo 'int main() { long long x = 7; return 0; }' > try.c
5540set try
5541if eval $compile; then
5542 val="$define"
5543 echo "You have long long."
5544else
5545 val="$undef"
5546 echo "You do not have long long."
5547fi
5b813a60 5548$rm_try
d1daaddf
JH
5549set d_longlong
5550eval $setvar
5551
5552: check for length of long long
5553case "${d_longlong}${longlongsize}" in
5554$define)
5555 echo " "
5556 echo "Checking to see how big your long longs are..." >&4
5557 $cat >try.c <<'EOCP'
5558#include <stdio.h>
5559int main()
5560{
5561 printf("%d\n", (int)sizeof(long long));
5562 return(0);
5563}
5564EOCP
5565 set try
5566 if eval $compile_ok; then
5567 longlongsize=`$run ./try`
5568 echo "Your long longs are $longlongsize bytes long."
5569 else
5570 dflt='8'
5571 echo " "
5572 echo "(I can't seem to compile the test program. Guessing...)"
5573 rp="What is the size of a long long (in bytes)?"
5574 . ./myread
5575 longlongsize="$ans"
5576 fi
5577 if $test "X$longsize" = "X$longlongsize"; then
5578 echo "(That isn't any different from an ordinary long.)"
5b813a60 5579 fi
d1daaddf
JH
5580 ;;
5581esac
5b813a60 5582$rm_try
d1daaddf 5583
8dfa8df9
JH
5584: see if inttypes.h is available
5585: we want a real compile instead of Inhdr because some systems
5586: have an inttypes.h which includes non-existent headers
5587echo " "
5588$cat >try.c <<EOCP
5589#include <inttypes.h>
5590int main() {
5591 static int32_t foo32 = 0x12345678;
5592}
5593EOCP
5594set try
5595if eval $compile; then
5596 echo "<inttypes.h> found." >&4
5597 val="$define"
5598else
5599 echo "<inttypes.h> NOT found." >&4
5600 val="$undef"
5601fi
5b813a60 5602$rm_try
8dfa8df9
JH
5603set i_inttypes
5604eval $setvar
5605
5606: check for int64_t
5607echo " "
5608echo "Checking to see if you have int64_t..." >&4
5609$cat >try.c <<EOCP
5610#include <sys/types.h>
5611#$i_inttypes I_INTTYPES
5612#ifdef I_INTTYPES
5613#include <inttypes.h>
5614#endif
5615int main() { int64_t x = 7; }
5616EOCP
5617set try
5618if eval $compile; then
5619 val="$define"
5620 echo "You have int64_t."
5621else
5622 val="$undef"
5623 echo "You do not have int64_t."
5624fi
5b813a60 5625$rm_try
8dfa8df9
JH
5626set d_int64_t
5627eval $setvar
5628
5629
5630echo " "
5631echo "Checking which 64-bit integer type we could use..." >&4
5632
5633case "$intsize" in
56348) val=int
5635 set quadtype
5636 eval $setvar
5637 val='"unsigned int"'
5638 set uquadtype
5639 eval $setvar
5640 quadkind=1
5641 ;;
5642*) case "$longsize" in
5643 8) val=long
5644 set quadtype
5645 eval $setvar
5646 val='"unsigned long"'
5647 set uquadtype
5648 eval $setvar
5649 quadkind=2
5650 ;;
5651 *) case "$d_longlong:$longlongsize" in
5652 define:8)
5653 val='"long long"'
5654 set quadtype
5655 eval $setvar
5656 val='"unsigned long long"'
5657 set uquadtype
5658 eval $setvar
5659 quadkind=3
5660 ;;
5661 *) case "$d_int64_t" in
5662 define)
5663 val=int64_t
5664 set quadtype
5665 eval $setvar
5666 val=uint64_t
5667 set uquadtype
5668 eval $setvar
5669 quadkind=4
5670 ;;
5671 esac
5672 ;;
5673 esac
5674 ;;
5675 esac
5676 ;;
5677esac
5678
5679case "$quadtype" in
5680'') echo "Alas, no 64-bit integer types in sight." >&4
5681 d_quad="$undef"
5682 ;;
5683*) echo "We could use '$quadtype' for 64-bit integers." >&4
5684 d_quad="$define"
5685 ;;
5686esac
5687
b4eb6b3d
JH
5688
5689case "$uselonglong" in
5690"$define"|true|[yY]*)
5691 cat <<EOM >&4
5692
5693*** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5694EOM
5695 use64bitint="$define"
5696 ;;
5697esac
5698case "$use64bits" in
5699"$define"|true|[yY]*)
5700 cat <<EOM >&4
5701
5702*** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5703EOM
5704 use64bitint="$define"
5705 ;;
5706esac
5707case "$use64bitints" in
5708"$define"|true|[yY]*)
5709 cat <<EOM >&4
5710
5711*** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5712EOM
5713 use64bitint="$define"
5714 ;;
5715esac
5716case "$use64bitsint" in
5717"$define"|true|[yY]*)
5718 cat <<EOM >&4
5719
5720*** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5721EOM
5722 use64bitint="$define"
5723 ;;
5724esac
5725case "$uselonglongs" in
5726"$define"|true|[yY]*)
5727 cat <<EOM >&4
5728
5729*** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5730EOM
5731 use64bitint="$define"
5732 ;;
5733esac
5734case "$use64bitsall" in
5735"$define"|true|[yY]*)
5736 cat <<EOM >&4
5737
5738*** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5739EOM
5740 use64bitall="$define"
5741 ;;
5742esac
5743
5744case "$ccflags" in
5745*-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5746esac
5747case "$use64bitall" in
5748"$define"|true|[yY]*) use64bitint="$define" ;;
5749esac
5750
5751case "$longsize" in
57528) cat <<EOM
5753
5754You have natively 64-bit long integers.
5755EOM
5756 val="$define"
5757 ;;
5758*) case "$use64bitint" in
5759 "$define"|true|[yY]*) dflt='y';;
5760 *) dflt='n';;
5761 esac
8dfa8df9
JH
5762 case "$d_quad" in
5763 "$define") ;;
5764 *) dflt='n' ;;
5765 esac
b4eb6b3d
JH
5766 cat <<EOM
5767
5768Perl can be built to take advantage of 64-bit integer types
5769on some systems. To do so, Configure can be run with -Duse64bitint.
5770Choosing this option will most probably introduce binary incompatibilities.
5771
5772If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5773(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5774EOM
5775 rp='Try to use 64-bit integers, if available?'
5776 . ./myread
5777 case "$ans" in
5778 [yY]*) val="$define" ;;
5779 *) val="$undef" ;;
5780 esac
5781 ;;
5782esac
5783set use64bitint
5784eval $setvar
5785
5786case "$use64bitall" in
5787"$define"|true|[yY]*) dflt='y' ;;
5788*) case "$longsize" in
5789 8) dflt='y' ;;
5790 *) dflt='n' ;;
5791 esac
5792 ;;
5793esac
5794cat <<EOM
5795
5796You may also choose to try maximal 64-bitness. It means using as much
579764-bitness as possible on the platform. This in turn means even more
5798binary incompatibilities. On the other hand, your platform may not
5799have any more 64-bitness available than what you already have chosen.
5800
5801If this doesn't make any sense to you, just accept the default '$dflt'.
8dfa8df9 5802(The default has been chosen based on your configuration.)
b4eb6b3d
JH
5803EOM
5804rp='Try to use maximal 64-bit support, if available?'
5805. ./myread
5806case "$ans" in
5807[yY]*) val="$define" ;;
5808*) val="$undef" ;;
5809esac
5810set use64bitall
5811eval $setvar
5812case "$use64bitall" in
5813"$define")
5814 case "$use64bitint" in
5815 "$undef")
5816 cat <<EOM
5817
5818Since you have chosen a maximally 64-bit build, I'm also turning on
5819the use of 64-bit integers.
5820EOM
5821 use64bitint="$define" ;;
5822 esac
5823 ;;
5824esac
5825
b4eb6b3d
JH
5826: Look for a hint-file generated 'call-back-unit'. If the
5827: user has specified that a 64-bit perl is to be built,
5828: we may need to set or change some other defaults.
19a100ff 5829if $test -f use64bitint.cbu; then
9da7673b 5830 echo "Your platform has some specific hints regarding 64-bit integers, using them..."
19a100ff
MB
5831 . ./use64bitint.cbu
5832fi
9da7673b
MB
5833case "$use64bitint" in
5834"$define"|true|[yY]*)
b4eb6b3d
JH
5835 case "$longsize" in
5836 4) case "$archname64" in
5837 '') archname64=64int ;;
5838 esac
5839 ;;
5840 esac
5841 ;;
5842esac
5843
b4eb6b3d
JH
5844: Look for a hint-file generated 'call-back-unit'. If the
5845: user has specified that a maximally 64-bit perl is to be built,
5846: we may need to set or change some other defaults.
19a100ff 5847if $test -f use64bitall.cbu; then
9da7673b 5848 echo "Your platform has some specific hints regarding 64-bit builds, using them..."
19a100ff
MB
5849 . ./use64bitall.cbu
5850fi
9da7673b
MB
5851case "$use64bitall" in
5852"$define"|true|[yY]*)
b4eb6b3d
JH
5853 case "$longsize" in
5854 4) case "$archname64" in
5855 ''|64int) archname64=64all ;;
5856 esac
5857 ;;
5858 esac
5859 ;;
5860esac
5861
1911a026
JH
5862case "$d_quad:$use64bitint" in
5863$undef:$define)
5864 cat >&4 <<EOF
5865
5866*** You have chosen to use 64-bit integers,
19a100ff 5867*** but none can be found.
09b58c7b 5868*** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
1911a026
JH
5869*** Cannot continue, aborting.
5870
5871EOF
5872 exit 1
5873 ;;
5874esac
5875
36adc09b
JH
5876: check for length of double
5877echo " "
5878case "$doublesize" in
5879'')
5880 echo "Checking to see how big your double precision numbers are..." >&4
5881 $cat >try.c <<EOCP
5882#include <stdio.h>
1911a026
JH
5883#$i_stdlib I_STDLIB
5884#ifdef I_STDLIB
5885#include <stdlib.h>
5886#endif
36adc09b
JH
5887int main()
5888{
5889 printf("%d\n", (int)sizeof(double));
1911a026 5890 exit(0);
36adc09b
JH
5891}
5892EOCP
5893 set try
5894 if eval $compile_ok; then
5895 doublesize=`$run ./try`
5896 echo "Your double is $doublesize bytes long."
5897 else
5898 dflt='8'
5899 echo "(I can't seem to compile the test program. Guessing...)"
5900 rp="What is the size of a double precision number (in bytes)?"
5901 . ./myread
5902 doublesize="$ans"
5903 fi
5904 ;;
5905esac
5b813a60 5906$rm_try
36adc09b
JH
5907
5908: check for long doubles
5909echo " "
5910echo "Checking to see if you have long double..." >&4
5911echo 'int main() { long double x = 7.0; }' > try.c
5912set try
5913if eval $compile; then
5914 val="$define"
5915 echo "You have long double."
5916else
5917 val="$undef"
5918 echo "You do not have long double."
5919fi
5b813a60 5920$rm_try
36adc09b
JH
5921set d_longdbl
5922eval $setvar
5923
5924: check for length of long double
5925case "${d_longdbl}${longdblsize}" in
5926$define)
5927 echo " "
5928 echo "Checking to see how big your long doubles are..." >&4
5929 $cat >try.c <<'EOCP'
5930#include <stdio.h>
5931int main()
5932{
5933 printf("%d\n", sizeof(long double));
5934}
5935EOCP
5936 set try
5937 set try
5938 if eval $compile; then
5939 longdblsize=`$run ./try`
5940 echo "Your long doubles are $longdblsize bytes long."
5941 else
5942 dflt='8'
5943 echo " "
5944 echo "(I can't seem to compile the test program. Guessing...)" >&4
5945 rp="What is the size of a long double (in bytes)?"
5946 . ./myread
5947 longdblsize="$ans"
5948 fi
5949 if $test "X$doublesize" = "X$longdblsize"; then
7ad90562
AD
5950 echo "That isn't any different from an ordinary double."
5951 echo "I'll keep your setting anyway, but you may see some"
5952 echo "harmless compilation warnings."
5b813a60 5953 fi
36adc09b
JH
5954 ;;
5955esac
5b813a60 5956$rm_try
36adc09b 5957
89ce900e 5958: determine the architecture name
b4eb6b3d 5959echo " "
89ce900e
JH
5960if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5961 tarch=`arch`"-$osname"
5962elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5963 if uname -m > tmparch 2>&1 ; then
5964 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5965 -e 's/$/'"-$osname/" tmparch`
5966 else
5967 tarch="$osname"
5968 fi
5969 $rm -f tmparch
b4eb6b3d 5970else
89ce900e 5971 tarch="$osname"
b4eb6b3d 5972fi
89ce900e
JH
5973case "$myarchname" in
5974''|"$tarch") ;;
5975*)
5976 echo "(Your architecture name used to be $myarchname.)"
5977 archname=''
5978 ;;
5979esac
5980case "$targetarch" in
5981'') ;;
5982*) archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5983esac
5984myarchname="$tarch"
5985case "$archname" in
5986'') dflt="$tarch";;
5987*) dflt="$archname";;
5988esac
5989rp='What is your architecture name'
5990. ./myread
5991archname="$ans"
5992case "$usethreads" in
5993$define)
5994 echo "Threads selected." >&4
5995 case "$archname" in
5996 *-thread*) echo "...and architecture name already has -thread." >&4
5997 ;;
5998 *) archname="$archname-thread"
5999 echo "...setting architecture name to $archname." >&4
6000 ;;
6001 esac
6002 ;;
6003esac
6004case "$usemultiplicity" in
6005$define)
6006 echo "Multiplicity selected." >&4
6007 case "$archname" in
6008 *-multi*) echo "...and architecture name already has -multi." >&4
6009 ;;
6010 *) archname="$archname-multi"
6011 echo "...setting architecture name to $archname." >&4
6012 ;;
6013 esac
6014 ;;
6015esac
6016case "$use64bitint$use64bitall" in
6017*"$define"*)
6018 case "$archname64" in
6019 '')
6020 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
bd9b35c9 6021 ;;
89ce900e
JH
6022 *)
6023 case "$use64bitint" in
6024 "$define") echo "64 bit integers selected." >&4 ;;
6025 esac
6026 case "$use64bitall" in
6027 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6028 esac
6029 case "$archname" in
6030 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6031 ;;
6032 *) archname="$archname-$archname64"
6033 echo "...setting architecture name to $archname." >&4
6034 ;;
6035 esac
c1a7f87b
JH
6036 ;;
6037 esac
89ce900e
JH
6038esac
6039case "$uselongdouble" in
6040$define)
6041 echo "Long doubles selected." >&4
6042 case "$longdblsize" in
6043 $doublesize)
6044 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6045 ;;
6046 *)
6047 case "$archname" in
6048 *-ld*) echo "...and architecture name already has -ld." >&4
6049 ;;
6050 *) archname="$archname-ld"
6051 echo "...setting architecture name to $archname." >&4
6052 ;;
6053 esac
bd9b35c9
JH
6054 ;;
6055 esac
bd9b35c9 6056 ;;
89ce900e
JH
6057esac
6058case "$useperlio" in
6059$define)
6060 echo "Perlio selected." >&4
6061 ;;
bd9b35c9 6062*)
89ce900e
JH
6063 echo "Perlio not selected, using stdio." >&4
6064 case "$archname" in
6065 *-stdio*) echo "...and architecture name already has -stdio." >&4
6066 ;;
6067 *) archname="$archname-stdio"
6068 echo "...setting architecture name to $archname." >&4
6069 ;;
6070 esac
bd9b35c9
JH
6071 ;;
6072esac
d2e0c6f7
JH
6073if $test -f archname.cbu; then
6074 echo "Your platform has some specific hints for architecture name, using them..."
6075 . ./archname.cbu
6076fi
bd9b35c9 6077
b4eb6b3d
JH
6078: set the prefixit variable, to compute a suitable default value
6079prefixit='case "$3" in
6080""|none)
6081 case "$oldprefix" in
6082 "") eval "$1=\"\$$2\"";;
6083 *)
6084 case "$3" in
6085 "") eval "$1=";;
6086 none)
6087 eval "tp=\"\$$2\"";
6088 case "$tp" in
6089 ""|" ") eval "$1=\"\$$2\"";;
6090 *) eval "$1=";;
6091 esac;;
6092 esac;;
6093 esac;;
6094*)
6095 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6096 case "$tp" in
6097 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6098 /*-$oldprefix/*|\~*-$oldprefix/*)
6099 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6100 *) eval "$1=\"\$$2\"";;
6101 esac;;
6102esac'
6103
f3f1a2d8
MB
6104: determine installation style
6105: For now, try to deduce it from prefix unless it is already set.
6106: Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6107case "$installstyle" in
6108'') case "$prefix" in
6109 *perl*) dflt='lib';;
6110 *) dflt='lib/perl5' ;;
6111 esac
6112 ;;
6113*) dflt="$installstyle" ;;
4d20abad 6114esac
f3f1a2d8
MB
6115: Probably not worth prompting for this since we prompt for all
6116: the directories individually, and the prompt would be too long and
6117: confusing anyway.
6118installstyle=$dflt
4d20abad 6119
eaf812ae
MB
6120: determine where public executables go
6121echo " "
6122set dflt bin bin
6123eval $prefixit
6124fn=d~
6125rp='Pathname where the public executables will reside?'
6126. ./getfile
6127if $test "X$ansexp" != "X$binexp"; then
6128 installbin=''
6129fi
6130prefixvar=bin
6131: XXX Bug? -- ignores Configure -Dinstallprefix setting.
d0e36aa9 6132: XXX If this is fixed, also fix the "start perl" hunk below, which relies on
a2d23ec2 6133: this via initialinstalllocation
eaf812ae
MB
6134. ./setprefixvar
6135
6136case "$userelocatableinc" in
6137$define|true|[yY]*) dflt='y' ;;
6138*) dflt='n' ;;
6139esac
6140cat <<EOM
6141
6142Would you like to build Perl so that the installation is relocatable, so that
6143library paths in @INC are determined relative to the path of the perl binary?
6144This is not advised for system Perl installs, or if you need to run setid
6145scripts or scripts under taint mode.
6146
6147If this doesn't make any sense to you, just accept the default '$dflt'.
6148EOM
6149rp='Use relocatable @INC?'
6150. ./myread
6151case "$ans" in
6152y|Y) val="$define" ;;
6153*) val="$undef" ;;
6154esac
6155set userelocatableinc
6156eval $setvar
6157
ea7d701d 6158initialinstalllocation="$binexp"
eaf812ae
MB
6159: Default prefix is now "up one level from where the binaries are"
6160case "$userelocatableinc" in
6161$define|true|[yY]*)
eaf812ae
MB
6162 bin=".../"
6163 binexp=".../"
6164 prefix=".../.."
6165 prefixexp=".../.."
6166 installprefixexp=".../.."
6167 ;;
6168esac
6169
b4eb6b3d
JH
6170: determine where private library files go
6171: Usual default is /usr/local/lib/perl5/$version.
f3f1a2d8 6172: Also allow things like /opt/perl/lib/$version, since
b4eb6b3d
JH
6173: /opt/perl/lib/perl5... would be redundant.
6174: The default "style" setting is made in installstyle.U
6175case "$installstyle" in
6176*lib/perl5*) set dflt privlib lib/$package/$version ;;
6177*) set dflt privlib lib/$version ;;
6178esac
6179eval $prefixit
6180$cat <<EOM
6181
6182There are some auxiliary files for $package that need to be put into a
6183private library directory that is accessible by everyone.
6184
6185EOM
eaf812ae 6186fn=$binexp
b4eb6b3d
JH
6187fn=d~+
6188rp='Pathname where the private library files will reside?'
6189. ./getfile
79522dd2
NC
6190prefixvar=privlib
6191. ./setprefixvar
b4eb6b3d
JH
6192
6193: set the prefixup variable, to restore leading tilda escape
6194prefixup='case "$prefixexp" in
6195"$prefix") ;;
6196*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6197esac'
6198
6199: determine where public architecture dependent libraries go
6200set archlib archlib
6201eval $prefixit
6202: privlib default is /usr/local/lib/$package/$version
6203: archlib default is /usr/local/lib/$package/$version/$archname
6204: privlib may have an optional trailing /share.
6205tdflt=`echo $privlib | $sed 's,/share$,,'`
6206tdflt=$tdflt/$archname
6207case "$archlib" in
6208'') dflt=$tdflt
6209 ;;
6210*) dflt="$archlib"
6211 ;;
6212esac
6213$cat <<EOM
6214
6215$spackage contains architecture-dependent library files. If you are
6216sharing libraries in a heterogeneous environment, you might store
6217these files in a separate location. Otherwise, you can just include
6218them with the rest of the public library files.
6219
6220EOM
eaf812ae 6221fn=$binexp
b4eb6b3d
JH
6222fn=d+~
6223rp='Where do you want to put the public architecture-dependent libraries?'
6224. ./getfile
79522dd2
NC
6225prefixvar=archlib
6226. ./setprefixvar
b4eb6b3d
JH
6227if $test X"$archlib" = X"$privlib"; then
6228 d_archlib="$undef"
6229else
6230 d_archlib="$define"
6231fi
b4eb6b3d 6232
b4eb6b3d
JH
6233: see if setuid scripts can be secure
6234$cat <<EOM
6235
6236Some kernels have a bug that prevents setuid #! scripts from being
6237secure. Some sites have disabled setuid #! scripts because of this.
6238
6239First let's decide if your kernel supports secure setuid #! scripts.
6240(If setuid #! scripts would be secure but have been disabled anyway,
6241don't say that they are secure if asked.)
6242
6243EOM
6244
6245val="$undef"
6246if $test -d /dev/fd; then
6247 echo "#!$ls" >reflect
6248 chmod +x,u+s reflect
6249 ./reflect >flect 2>&1
6250 if $contains "/dev/fd" flect >/dev/null; then
6251 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6252 val="$define"
6253 else
6254 $cat <<EOM
6255If you are not sure if they are secure, I can check but I'll need a
6256username and password different from the one you are using right now.
6257If you don't have such a username or don't want me to test, simply
6258enter 'none'.
6259
6260EOM
6261 rp='Other username to test security of setuid scripts with?'
6262 dflt='none'
6263 . ./myread
6264 case "$ans" in
6265 n|none)
6266 case "$d_suidsafe" in
6267 '') echo "I'll assume setuid scripts are *not* secure." >&4
6268 dflt=n;;
6269 "$undef")
6270 echo "Well, the $hint value is *not* secure." >&4
6271 dflt=n;;
6272 *) echo "Well, the $hint value *is* secure." >&4
6273 dflt=y;;
6274 esac
c1a7f87b 6275 ;;
b4eb6b3d
JH
6276 *)
6277 $rm -f reflect flect
6278 echo "#!$ls" >reflect
6279 chmod +x,u+s reflect
6280 echo >flect
6281 chmod a+w flect
6282 echo '"su" will (probably) prompt you for '"$ans's password."
6283 su $ans -c './reflect >flect'
6284 if $contains "/dev/fd" flect >/dev/null; then
6285 echo "Okay, it looks like setuid scripts are secure." >&4
6286 dflt=y
6287 else
6288 echo "I don't think setuid scripts are secure." >&4
6289 dflt=n
6290 fi
6291 ;;
6292 esac
6293 rp='Does your kernel have *secure* setuid scripts?'
6294 . ./myread
6295 case "$ans" in
6296 [yY]*) val="$define";;
6297 *) val="$undef";;
6298 esac
6299 fi
6300else
6301 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6302 echo "(That's for file descriptors, not floppy disks.)"
6303 val="$undef"
6304fi
6305set d_suidsafe
6306eval $setvar
6307
6308$rm -f reflect flect
6309
6310: now see if they want to do setuid emulation
6311echo " "
6312val="$undef"
6313case "$d_suidsafe" in
6314"$define")
6315 val="$undef"
3c728e00 6316 echo "No need to emulate SUID scripts since they are secure here." >&4
b4eb6b3d 6317 ;;
f3f1a2d8
MB
6318*)
6319 $cat <<EOM
6320Some systems have disabled setuid scripts, especially systems where
6321setuid scripts cannot be secure. On systems where setuid scripts have
6322been disabled, the setuid/setgid bits on scripts are currently
6323useless. It is possible for $package to detect those bits and emulate
6324setuid/setgid in a secure fashion. This emulation will only work if
6325setuid scripts have been disabled in your kernel.
6326
6327EOM
6328 case "$d_dosuid" in
6329 "$define") dflt=y ;;
6330 *) dflt=n ;;
6331 esac
6332 rp="Do you want to do setuid/setgid emulation?"
6333 . ./myread
6334 case "$ans" in
6335 [yY]*) val="$define";;
6336 *) val="$undef";;
6337 esac
6338 ;;
6339esac
6340set d_dosuid
6341eval $setvar
6342
f3f1a2d8
MB
6343: Find perl5.005 or later.
6344echo "Looking for a previously installed perl5.005 or later... "
6345case "$perl5" in
6346'') for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6347 : Check if this perl is recent and can load a simple module
6348 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6349 perl5=$tdir/perl
6350 break;
6351 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6352 perl5=$tdir/perl5
6353 break;
6354 fi
6355 done
6356 ;;
6357*) perl5="$perl5"
6358 ;;
6359esac
6360case "$perl5" in
6361'') echo "None found. That's ok.";;
6362*) echo "Using $perl5." ;;
6363esac
6364
6365$cat <<EOM
6366
6367After $package is installed, you may wish to install various
6368add-on modules and utilities. Typically, these add-ons will
6369be installed under $prefix with the rest
6370of this package. However, you may wish to install such add-ons
6371elsewhere under a different prefix.
6372
6373If you do not wish to put everything under a single prefix, that's
6374ok. You will be prompted for the individual locations; this siteprefix
6375is only used to suggest the defaults.
6376
6377The default should be fine for most people.
6378
6379EOM
6380fn=d~+
6381rp='Installation prefix to use for add-on modules and utilities?'
6382: XXX Here might be another good place for an installstyle setting.
6383case "$siteprefix" in
6384'') dflt=$prefix ;;
6385*) dflt=$siteprefix ;;
6386esac
6387. ./getfile
6388: XXX Prefixit unit does not yet support siteprefix and vendorprefix
6389oldsiteprefix=''
6390case "$siteprefix" in
6391'') ;;
6392*) case "$ans" in
6393 "$prefix") ;;
6394 *) oldsiteprefix="$prefix";;
6395 esac
6396 ;;
6397esac
6398siteprefix="$ans"
6399siteprefixexp="$ansexp"
6400
6401: determine where site specific libraries go.
6402: Usual default is /usr/local/lib/perl5/site_perl/$version
6403: The default "style" setting is made in installstyle.U
6404: XXX No longer works with Prefixit stuff.
6405prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6406case "$sitelib" in
6407'') case "$installstyle" in
6408 *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6409 *) dflt=$siteprefix/lib/site_$prog/$version ;;
6410 esac
6411 ;;
6412*) dflt="$sitelib"
6413 ;;
6414esac
6415$cat <<EOM
6416
6417The installation process will create a directory for
6418site-specific extensions and modules. Most users find it convenient
6419to place all site-specific files in this directory rather than in the
6420main distribution directory.
6421
6422EOM
6423fn=d~+
6424rp='Pathname for the site-specific library files?'
6425. ./getfile
6426prefixvar=sitelib
6427. ./setprefixvar
6428sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6429
6430: Determine list of previous versions to include in @INC
6431$cat > getverlist <<EOPL
6432#!$perl5 -w
6433use File::Basename;
6434\$api_versionstring = "$api_versionstring";
6435\$version = "$version";
6436\$stem = "$sitelib_stem";
6437\$archname = "$archname";
6438EOPL
6439 $cat >> getverlist <<'EOPL'
13cfc98d
MB
6440# The list found is store twice for each entry: the original name, and
6441# the binary broken down version as pack "sss", so sorting is easy and
6442# unambiguous. This will work for all versions that have a maximum of
6443# three digit groups, separate by '.'s or '_'s. Names are extended with
6444# ".0.0" to ensure at least three elements for the pack.
6445# -- H.Merijn Brand (m)'06 23-10-2006
6446
f3f1a2d8
MB
6447# Can't have leading @ because metaconfig interprets it as a command!
6448;@inc_version_list=();
6449# XXX Redo to do opendir/readdir?
6450if (-d $stem) {
6451 chdir($stem);
13cfc98d
MB
6452 ;@candidates = map {
6453 [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
f3f1a2d8
MB
6454}
6455else {
6456 ;@candidates = ();
6457}
6458
13cfc98d
MB
6459($pversion, $aversion, $vsn5005) = map {
6460 pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
f3f1a2d8 6461foreach $d (@candidates) {
13cfc98d
MB
6462 if ($d->[1] lt $pversion) {
6463 if ($d->[1] ge $aversion) {
6464 unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
f3f1a2d8 6465 }
13cfc98d
MB
6466 elsif ($d->[1] ge $vsn5005) {
6467 unshift(@inc_version_list, grep { -d } $d->[0]);
f3f1a2d8
MB
6468 }
6469 }
6470 else {
6471 # Skip newer version. I.e. don't look in
6472 # 5.7.0 if we're installing 5.6.1.
6473 }
6474}
6475
6476if (@inc_version_list) {
6477 print join(' ', @inc_version_list);
6478}
6479else {
6480 # Blank space to preserve value for next Configure run.
6481 print " ";
6482}
6483EOPL
6484chmod +x getverlist
6485case "$inc_version_list" in
6486'') if test -x "$perl5$exe_ext"; then
6487 dflt=`$perl5 getverlist`
6488 else
6489 dflt='none'
6490 fi
6491 ;;
6492$undef) dflt='none' ;;
6493*) eval dflt=\"$inc_version_list\" ;;
6494esac
6495case "$dflt" in
6496''|' ') dflt=none ;;
6497esac
6498case "$dflt" in
64995.005) dflt=none ;;
6500esac
6501$cat <<EOM
6502
6503In order to ease the process of upgrading, this version of perl
6504can be configured to use modules built and installed with earlier
6505versions of perl that were installed under $prefix. Specify here
6506the list of earlier versions that this version of perl should check.
6507If Configure detected no earlier versions of perl installed under
6508$prefix, then the list will be empty. Answer 'none' to tell perl
6509to not search earlier versions.
b4eb6b3d 6510
f3f1a2d8
MB
6511The default should almost always be sensible, so if you're not sure,
6512just accept the default.
b4eb6b3d 6513EOM
f3f1a2d8
MB
6514
6515rp='List of earlier versions to include in @INC?'
6516. ./myread
6517case "$ans" in
6518[Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6519*) inc_version_list="$ans" ;;
6520esac
6521case "$inc_version_list" in
6522''|' ')
6523 inc_version_list_init='0'
6524 d_inc_version_list="$undef"
6525 ;;
6526*) inc_version_list_init=`echo $inc_version_list |
6527 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6528 d_inc_version_list="$define"
b4eb6b3d
JH
6529 ;;
6530esac
f3f1a2d8 6531$rm -f getverlist
b4eb6b3d 6532
b4eb6b3d 6533: see if this is a malloc.h system
01d07975
YST
6534: we want a real compile instead of Inhdr because some systems have a
6535: malloc.h that just gives a compile error saying to use stdlib.h instead
6536echo " "
6537$cat >try.c <<EOCP
6538#include <stdlib.h>
6539#include <malloc.h>
6540int main () { return 0; }
6541EOCP
6542set try
6543if eval $compile; then
6544 echo "<malloc.h> found." >&4
6545 val="$define"
6546else
6547 echo "<malloc.h> NOT found." >&4
6548 val="$undef"
6549fi
5b813a60 6550$rm_try
01d07975
YST
6551set i_malloc
6552eval $setvar
b4eb6b3d 6553
c8b93cf9
JH
6554: check for void type
6555echo " "
6556echo "Checking to see how well your C compiler groks the void type..." >&4
6557case "$voidflags" in
6558'')
c727eafa 6559 $cat >try.c <<EOCP
d1daaddf
JH
6560#$i_stdlib I_STDLIB
6561#ifdef I_STDLIB
6562#include <stdlib.h>
6563#endif
c8b93cf9
JH
6564#if TRY & 1
6565void sub() {
6566#else
6567sub() {
6568#endif
6569 extern void moo(); /* function returning void */
6570 void (*goo)(); /* ptr to func returning void */
6571#if TRY & 8
6572 void *hue; /* generic ptr */
6573#endif
6574#if TRY & 2
6575 void (*foo[10])();
6576#endif
6577
6578#if TRY & 4
6579 if(goo == moo) {
6580 exit(0);
6581 }
6582#endif
6583 exit(0);
6584}
6585int main() { sub(); }
6586EOCP
6587 if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6588 voidflags=$defvoidused
6589 echo "Good. It appears to support void to the level $package wants.">&4
6590 if $contains warning .out >/dev/null 2>&1; then
6591 echo "However, you might get some warnings that look like this:"
6592 $cat .out
6593 fi
6594 else
6595echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6596 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6597 echo "It supports 1..."
6598 if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6599 echo "It also supports 2..."
6600 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6601 voidflags=7
6602 echo "And it supports 4 but not 8 definitely."
6603 else
6604 echo "It doesn't support 4..."
6605 if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6606 voidflags=11
6607 echo "But it supports 8."
6608 else
6609 voidflags=3
6610 echo "Neither does it support 8."
6611 fi
6612 fi
6613 else
6614 echo "It does not support 2..."
6615 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6616 voidflags=13
6617 echo "But it supports 4 and 8."
6618 else
6619 if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6620 voidflags=5
6621 echo "And it supports 4 but has not heard about 8."
6622 else
6623 echo "However it supports 8 but not 4."
6624 fi
6625 fi
6626 fi
6627 else
6628 echo "There is no support at all for void."
6629 voidflags=0
6630 fi
6631 fi
6632esac
6633case "$voidflags" in
6634"$defvoidused") ;;
6635*) $cat >&4 <<'EOM'
6636 Support flag bits are:
6637 1: basic void declarations.
6638 2: arrays of pointers to functions returning void.
6639 4: operations between pointers to and addresses of void functions.
6640 8: generic void pointers.
6641EOM
6642 dflt="$voidflags";
6643 rp="Your void support flags add up to what?"
6644 . ./myread
6645 voidflags="$ans"
6646 ;;
6647esac
5b813a60 6648$rm_try
c8b93cf9
JH
6649
6650: check for length of pointer
6651echo " "
6652case "$ptrsize" in
6653'')
6654 echo "Checking to see how big your pointers are..." >&4
6655 if test "$voidflags" -gt 7; then
6656 echo '#define VOID_PTR char *' > try.c
6657 else
6658 echo '#define VOID_PTR void *' > try.c
6659 fi
74d00865 6660 $cat >>try.c <<EOCP
c8b93cf9 6661#include <stdio.h>
d1daaddf
JH
6662#$i_stdlib I_STDLIB
6663#ifdef I_STDLIB
6664#include <stdlib.h>
6665#endif
c8b93cf9
JH
6666int main()
6667{
6668 printf("%d\n", (int)sizeof(VOID_PTR));
6669 exit(0);
6670}
6671EOCP
6672 set try
6673 if eval $compile_ok; then
6674 ptrsize=`$run ./try`
6675 echo "Your pointers are $ptrsize bytes long."
6676 else
6677 dflt='4'
6678 echo "(I can't seem to compile the test program. Guessing...)" >&4
6679 rp="What is the size of a pointer (in bytes)?"
6680 . ./myread
6681 ptrsize="$ans"
6682 fi
6683 ;;
6684esac
5b813a60 6685$rm_try
c8b93cf9
JH
6686case "$use64bitall" in
6687"$define"|true|[yY]*)
6688 case "$ptrsize" in
6689 4) cat <<EOM >&4
6690
1911a026
JH
6691*** You have chosen a maximally 64-bit build,
6692*** but your pointers are only 4 bytes wide.
09b58c7b
JH
6693*** Please rerun Configure without -Duse64bitall.
6694EOM
6695 case "$d_quad" in
6696 define)
6697 cat <<EOM >&4
6698*** Since you have quads, you could possibly try with -Duse64bitint.
6699EOM
6700 ;;
6701 esac
6702 cat <<EOM >&4
1911a026 6703*** Cannot continue, aborting.
c8b93cf9
JH
6704
6705EOM
09b58c7b 6706
1911a026 6707 exit 1
c8b93cf9
JH
6708 ;;
6709 esac
6710 ;;
6711esac
6712
19a100ff 6713
9df442c2
NC
6714: determine whether to use malloc wrapping
6715echo " "
6716case "$usemallocwrap" in
6717[yY]*|true|$define) dflt='y' ;;
6718[nN]*|false|$undef) dflt='n' ;;
6719*) case "$usedevel" in
6720 [yY]*|true|$define) dflt='y' ;;
6721 *) dflt='n' ;;
6722 esac
6723 ;;
6724esac
6725rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6726. ./myread
6727usemallocwrap="$ans"
6728case "$ans" in
6729y*|true)
6730 usemallocwrap="$define" ;;
6731*)
6732 usemallocwrap="$undef" ;;
6733esac
c8b93cf9 6734
b4eb6b3d
JH
6735: determine which malloc to compile in
6736echo " "
6737case "$usemymalloc" in
c4163172
JH
6738[yY]*|true|$define) dflt='y' ;;
6739[nN]*|false|$undef) dflt='n' ;;
6740*) case "$ptrsize" in
6741 4) dflt='y' ;;
6742 *) dflt='n' ;;
6743 esac
6744 ;;
8dfa8df9 6745esac
b4eb6b3d
JH
6746rp="Do you wish to attempt to use the malloc that comes with $package?"
6747. ./myread
6748usemymalloc="$ans"
6749case "$ans" in
6750y*|true)
6751 usemymalloc='y'
6752 mallocsrc='malloc.c'
6753 mallocobj="malloc$_o"
6754 d_mymalloc="$define"
6755 case "$libs" in
6756 *-lmalloc*)
6757 : Remove malloc from list of libraries to use
6758 echo "Removing unneeded -lmalloc from library list" >&4
6759 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6760 shift
6761 libs="$*"
6762 echo "libs = $libs" >&4
6763 ;;
6764 esac
6765 ;;
6766*)
6767 usemymalloc='n'
6768 mallocsrc=''
6769 mallocobj=''
6770 d_mymalloc="$undef"
6771 ;;
6772esac
6773
6774: compute the return types of malloc and free
6775echo " "
6776$cat >malloc.c <<END
6777#$i_malloc I_MALLOC
6778#$i_stdlib I_STDLIB
6779#include <stdio.h>
6780#include <sys/types.h>
6781#ifdef I_MALLOC
6782#include <malloc.h>
6783#endif
6784#ifdef I_STDLIB
6785#include <stdlib.h>
6786#endif
6787#ifdef TRY_MALLOC
6788void *malloc();
6789#endif
6790#ifdef TRY_FREE
6791void free();
6792#endif
6793END
6794case "$malloctype" in
6795'')
6796 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6797 malloctype='void *'
6798 else
6799 malloctype='char *'
6800 fi
6801 ;;
6802esac
6803echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6804
6805case "$freetype" in
6806'')
6807 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6808 freetype='void'
6809 else
6810 freetype='int'
6811 fi
6812 ;;
6813esac
6814echo "Your system uses $freetype free(), it would seem." >&4
6815$rm -f malloc.[co]
b4eb6b3d
JH
6816: determine where site specific architecture-dependent libraries go.
6817: sitelib default is /usr/local/lib/perl5/site_perl/$version
6818: sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6819: sitelib may have an optional trailing /share.
6820case "$sitearch" in
6821'') dflt=`echo $sitelib | $sed 's,/share$,,'`
6822 dflt="$dflt/$archname"
6823 ;;
6824*) dflt="$sitearch"
6825 ;;
6826esac
6827set sitearch sitearch none
6828eval $prefixit
6829$cat <<EOM
6830
6831The installation process will also create a directory for
6832architecture-dependent site-specific extensions and modules.
6833
6834EOM
6835fn=d~+
6836rp='Pathname for the site-specific architecture-dependent library files?'
6837. ./getfile
79522dd2
NC
6838prefixvar=sitearch
6839. ./setprefixvar
c95d0e17
GA
6840if $test X"$sitearch" = X"$sitelib"; then
6841 d_sitearch="$undef"
6842else
6843 d_sitearch="$define"
6844fi
b4eb6b3d
JH
6845
6846$cat <<EOM
6847
6848The installation process will also create a directory for
6849vendor-supplied add-ons. Vendors who supply perl with their system
6850may find it convenient to place all vendor-supplied files in this
6851directory rather than in the main distribution directory. This will
6852ease upgrades between binary-compatible maintenance versions of perl.
6853
6854Of course you may also use these directories in whatever way you see
6855fit. For example, you might use them to access modules shared over a
6856company-wide network.
6857
6858The default answer should be fine for most people.
6859This causes further questions about vendor add-ons to be skipped
6860and no vendor-specific directories will be configured for perl.
6861
6862EOM
6863rp='Do you want to configure vendor-specific add-on directories?'
6864case "$usevendorprefix" in
6865define|true|[yY]*) dflt=y ;;
6866*) : User may have set vendorprefix directly on Configure command line.
6867 case "$vendorprefix" in
6868 ''|' ') dflt=n ;;
6869 *) dflt=y ;;
6870 esac
6871 ;;
6872esac
6873. ./myread
6874case "$ans" in
6875[yY]*) fn=d~+
6876 rp='Installation prefix to use for vendor-supplied add-ons?'
6877 case "$vendorprefix" in
6878 '') dflt='' ;;
6879 *) dflt=$vendorprefix ;;
6880 esac
6881 . ./getfile
6882 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6883 oldvendorprefix=''
6884 case "$vendorprefix" in
6885 '') ;;
6886 *) case "$ans" in
6887 "$prefix") ;;
6888 *) oldvendorprefix="$prefix";;
6889 esac
6890 ;;
6891 esac
6892 usevendorprefix="$define"
6893 vendorprefix="$ans"
6894 vendorprefixexp="$ansexp"
6895 ;;
6896*) usevendorprefix="$undef"
6897 vendorprefix=''
6898 vendorprefixexp=''
6899 ;;
6900esac
6901
6902case "$vendorprefix" in
6903'') d_vendorlib="$undef"
6904 vendorlib=''
6905 vendorlibexp=''
6906 ;;
6907*) d_vendorlib="$define"
6908 : determine where vendor-supplied modules go.
6909 : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6910 case "$vendorlib" in
6911 '')
6912 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6913 case "$installstyle" in
6914 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6915 *) dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6916 esac
6917 ;;
6918 *) dflt="$vendorlib"
6919 ;;
6920 esac
6921 fn=d~+
6922 rp='Pathname for the vendor-supplied library files?'
6923 . ./getfile
6924 vendorlib="$ans"
6925 vendorlibexp="$ansexp"
6926 ;;
6927esac
6928vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
a092d240
NC
6929prefixvar=vendorlib
6930. ./installprefix
b4eb6b3d
JH
6931
6932case "$vendorprefix" in
6933'') d_vendorarch="$undef"
6934 vendorarch=''
6935 vendorarchexp=''
6936 ;;
6937*) d_vendorarch="$define"
6938 : determine where vendor-supplied architecture-dependent libraries go.
6939 : vendorlib default is /usr/local/lib/perl5/vendor_perl/$version
6940 : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6941 : vendorlib may have an optional trailing /share.
6942 case "$vendorarch" in
6943 '') dflt=`echo $vendorlib | $sed 's,/share$,,'`
6944 dflt="$dflt/$archname"
6945 ;;
6946 *) dflt="$vendorarch" ;;
6947 esac
6948 fn=d~+
6949 rp='Pathname for vendor-supplied architecture-dependent files?'
6950 . ./getfile
6951 vendorarch="$ans"
6952 vendorarchexp="$ansexp"
6953 ;;
6954esac
a092d240
NC
6955prefixvar=vendorarch
6956. ./installprefix
b4eb6b3d
JH
6957
6958: Final catch-all directories to search
6959$cat <<EOM
6960
6961Lastly, you can have perl look in other directories for extensions and
6962modules in addition to those already specified.
6963These directories will be searched after
6964 $sitearch
6965 $sitelib
6966EOM
6967test X"$vendorlib" != "X" && echo ' ' $vendorlib
6968test X"$vendorarch" != "X" && echo ' ' $vendorarch
6969echo ' '
6970case "$otherlibdirs" in
6971''|' ') dflt='none' ;;
6972*) dflt="$otherlibdirs" ;;
6973esac
6974$cat <<EOM
6975Enter a colon-separated set of extra paths to include in perl's @INC
6976search path, or enter 'none' for no extra paths.
6977
6978EOM
6979
6980rp='Colon-separated list of additional directories for perl to search?'
6981. ./myread
6982case "$ans" in
6983' '|''|none) otherlibdirs=' ' ;;
6984*) otherlibdirs="$ans" ;;
6985esac
6986case "$otherlibdirs" in
6987' ') val=$undef ;;
6988*) val=$define ;;
6989esac
6990set d_perl_otherlibdirs
6991eval $setvar
6992
6993: Cruising for prototypes
6994echo " "
6995echo "Checking out function prototypes..." >&4
55954f19
JH
6996$cat >prototype.c <<EOCP
6997#$i_stdlib I_STDLIB
6998#ifdef I_STDLIB
6999#include <stdlib.h>
7000#endif
b4eb6b3d
JH
7001int main(int argc, char *argv[]) {
7002 exit(0);}
7003EOCP
7004if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7005 echo "Your C compiler appears to support function prototypes."
7006 val="$define"
7007else
7008 echo "Your C compiler doesn't seem to understand function prototypes."
7009 val="$undef"
7010fi
7011set prototype
7012eval $setvar
7013$rm -f prototype*
7014
7015case "$prototype" in
7016"$define") ;;
7017*) ansi2knr='ansi2knr'
7018 echo " "
7019 cat <<EOM >&4
7020
7021$me: FATAL ERROR:
7022This version of $package can only be compiled by a compiler that
7023understands function prototypes. Unfortunately, your C compiler
7024 $cc $ccflags
7025doesn't seem to understand them. Sorry about that.
7026
7027If GNU cc is available for your system, perhaps you could try that instead.
7028
7029Eventually, we hope to support building Perl with pre-ANSI compilers.
7030If you would like to help in that effort, please contact <perlbug@perl.org>.
7031
7032Aborting Configure now.
7033EOM
7034 exit 2
7035 ;;
7036esac
7037
6fcddf3b 7038echo " "
6fcddf3b 7039case "$extras" in
bf35c3f6
JH
7040'') dflt='n';;
7041*) dflt='y';;
6fcddf3b
JH
7042esac
7043cat <<EOM
7044Perl can be built with extra modules or bundles of modules which
7045will be fetched from the CPAN and installed alongside Perl.
7046
7047Notice that you will need access to the CPAN; either via the Internet,
7048or a local copy, for example a CD-ROM or a local CPAN mirror. (You will
7049be asked later to configure the CPAN.pm module which will in turn do
7050the installation of the rest of the extra modules or bundles.)
7051
7052Notice also that if the modules require any external software such as
dd2de242
JH
7053libraries and headers (the libz library and the zlib.h header for the
7054Compress::Zlib module, for example) you MUST have any such software
7055already installed, this configuration process will NOT install such
7056things for you.
6fcddf3b
JH
7057
7058If this doesn't make any sense to you, just accept the default '$dflt'.
7059EOM
dd2de242 7060rp='Install any extra modules (y or n)?'
6fcddf3b
JH
7061. ./myread
7062case "$ans" in
7063y|Y)
7064 cat <<EOM
7065
7066Please list any extra modules or bundles to be installed from CPAN,
7067with spaces between the names. The names can be in any format the
dd2de242
JH
7068'install' command of CPAN.pm will understand. (Answer 'none',
7069without the quotes, to install no extra modules or bundles.)
6fcddf3b
JH
7070EOM
7071 rp='Extras?'
7072 dflt="$extras"
7073 . ./myread
7074 extras="$ans"
7075esac
7076case "$extras" in
7077''|'none')
7078 val=''
7079 $rm -f ../extras.lst
7080 ;;
7081*) echo "(Saving the list of extras for later...)"
dd2de242
JH
7082 echo "$extras" > ../extras.lst
7083 val="'$extras'"
6fcddf3b
JH
7084 ;;
7085esac
7086set extras
7087eval $setvar
7088echo " "
7089
6e1038e0
MB
7090: determine where html pages for programs go
7091set html1dir html1dir none
7092eval $prefixit
7093$cat <<EOM
7094
f3f1a2d8 7095If you wish to install html files for programs in $spackage, indicate
6e1038e0
MB
7096the appropriate directory here. To skip installing html files,
7097answer "none".
7098EOM
7099case "$html1dir" in
7100''|none|$undef|' ') dflt=none ;;
7101*) dflt=$html1dir ;;
7102esac
7103fn=dn+~
7104rp="Directory for the main $spackage html pages?"
7105. ./getfile
79522dd2
NC
7106prefixvar=html1dir
7107. ./setprefixvar
6e1038e0
MB
7108: Use ' ' for none so value is preserved next time through Configure
7109$test X"$html1dir" = "X" && html1dir=' '
6e1038e0
MB
7110
7111: determine where html pages for libraries and modules go
7112set html3dir html3dir none
7113eval $prefixit
7114$cat <<EOM
7115
7116If you wish to install html files for modules associated with $spackage,
7117indicate the appropriate directory here. To skip installing html files,
7118answer "none".
7119EOM
7120: There is no obvious default. If they have specified html1dir, then
7121: try to key off that, possibly changing .../html1 into .../html3.
7122case "$html3dir" in
7123'') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7124*) dflt=$html3dir ;;
7125esac
7126fn=dn+~
7127rp="Directory for the $spackage module html pages?"
7128. ./getfile
79522dd2
NC
7129prefixvar=html3dir
7130. ./setprefixvar
6e1038e0
MB
7131: Use ' ' for none so value is preserved next time through Configure
7132$test X"$html3dir" = "X" && html3dir=' '
6e1038e0 7133
89ce900e
JH
7134: determine whether to install perl also as /usr/bin/perl
7135
7136echo " "
7137if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7138 $cat <<EOM
7139Many scripts expect perl to be installed as /usr/bin/perl.
7140
7141If you want to, I can install the perl you are about to compile
7142as /usr/bin/perl (in addition to $bin/perl).
7143EOM
7144 if test -f /usr/bin/perl; then
7145 $cat <<EOM
7146
7147However, please note that because you already have a /usr/bin/perl,
7148overwriting that with a new Perl would very probably cause problems.
7149Therefore I'm assuming you don't want to do that (unless you insist).
7150
7151EOM
7152 case "$installusrbinperl" in
7153 "$define"|[yY]*) dflt='y';;
7154 *) dflt='n';;
7155 esac
7156 else
7157 $cat <<EOM
7158
7159Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7160
7161EOM
7162 case "$installusrbinperl" in
7163 "$undef"|[nN]*) dflt='n';;
7164 *) dflt='y';;
7165 esac
7166 fi
7167 rp="Do you want to install perl as /usr/bin/perl?"
7168 . ./myread
7169 case "$ans" in
7170 [yY]*) val="$define";;
7171 *) val="$undef" ;;
7172 esac
7173else
7174 val="$undef"
7175fi
7176set installusrbinperl
7177eval $setvar
7178
7179echo " "
7180echo "Checking for GNU C Library..." >&4
7181cat >try.c <<'EOCP'
7182/* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__
7183 alone are insufficient to distinguish different versions, such as
7184 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in
7185 libc version 2.1.0. A. Dougherty, June 3, 2002.
7186*/
7187#include <stdio.h>
7188int main(void)
7189{
7190#ifdef __GLIBC__
7191# ifdef __GLIBC_MINOR__
4fb7dc7d 7192# if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
89ce900e
JH
7193# include <gnu/libc-version.h>
7194 printf("%s\n", gnu_get_libc_version());
7195# else
7196 printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__);
7197# endif
7198# else
7199 printf("%d\n", __GLIBC__);
7200# endif
7201 return 0;
7202#else
7203 return 1;
7204#endif
7205}
7206EOCP
7207set try
7208if eval $compile_ok && $run ./try > glibc.ver; then
7209 val="$define"
7210 gnulibc_version=`$cat glibc.ver`
7211 echo "You are using the GNU C Library version $gnulibc_version"
7212else
7213 val="$undef"
7214 gnulibc_version=''
7215 echo "You are not using the GNU C Library"
7216fi
5b813a60 7217$rm_try glibc.ver
89ce900e
JH
7218set d_gnulibc
7219eval $setvar
7220
7221: see if nm is to be used to determine whether a symbol is defined or not
7222case "$usenm" in
7223'')
7224 dflt=''
7225 case "$d_gnulibc" in
7226 "$define")
7227 echo " "
7228 echo "nm probably won't work on the GNU C Library." >&4
7229 dflt=n
7230 ;;
7231 esac
7232 case "$dflt" in
7233 '')
7234 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7235 echo " "
7236 echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4
7237 echo "'nm' won't be sufficient on this sytem." >&4
7238 dflt=n
7239 fi
7240 ;;
7241 esac
7242 case "$dflt" in
7243 '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7244 if $test $dflt -gt 20; then
7245 dflt=y
7246 else
7247 dflt=n
7248 fi
7249 ;;
7250 esac
b4eb6b3d 7251 ;;
89ce900e
JH
7252*)
7253 case "$usenm" in
7254 true|$define) dflt=y;;
7255 *) dflt=n;;
7256 esac
b4eb6b3d
JH
7257 ;;
7258esac
89ce900e 7259$cat <<EOM
b4eb6b3d 7260
89ce900e
JH
7261I can use $nm to extract the symbols from your C libraries. This
7262is a time consuming task which may generate huge output on the disk (up
7263to 3 megabytes) but that should make the symbols extraction faster. The
7264alternative is to skip the 'nm' extraction part and to compile a small
7265test program instead to determine whether each symbol is present. If
7266you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7267this may be the best solution.
b4eb6b3d 7268
89ce900e 7269You probably shouldn't let me use 'nm' if you are using the GNU C Library.
b4eb6b3d 7270
89ce900e
JH
7271EOM
7272rp="Shall I use $nm to extract C symbols from the libraries?"
7273. ./myread
7274case "$ans" in
7275[Nn]*) usenm=false;;
7276*) usenm=true;;
b4eb6b3d 7277esac
89ce900e
JH
7278
7279runnm=$usenm
7280case "$reuseval" in
7281true) runnm=false;;
b4eb6b3d 7282esac
b4eb6b3d 7283
89ce900e
JH
7284: nm options which may be necessary
7285case "$nm_opt" in
7286'') if $test -f /mach_boot; then
7287 nm_opt='' # Mach
7288 elif $test -d /usr/ccs/lib; then
7289 nm_opt='-p' # Solaris (and SunOS?)
7290 elif $test -f /dgux; then
7291 nm_opt='-p' # DG-UX
7292 elif $test -f /lib64/rld; then
7293 nm_opt='-p' # 64-bit Irix
7294 else
7295 nm_opt=''
7296 fi;;
7297esac
b4eb6b3d 7298
89ce900e
JH
7299: nm options which may be necessary for shared libraries but illegal
7300: for archive libraries. Thank you, Linux.
7301case "$nm_so_opt" in
7302'') case "$myuname" in
fb2e1bc0 7303 *linux*|gnu*)
89ce900e
JH
7304 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7305 nm_so_opt='--dynamic'
7306 fi
7307 ;;
7308 esac
7309 ;;
7310esac
b4eb6b3d 7311
89ce900e
JH
7312case "$runnm" in
7313true)
7314: get list of predefined functions in a handy place
7315echo " "
7316case "$libc" in
7317'') libc=unknown
7318 case "$libs" in
7319 *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7320 esac
7321 ;;
b4eb6b3d 7322esac
89ce900e
JH
7323case "$libs" in
7324'') ;;
7325*) for thislib in $libs; do
7326 case "$thislib" in
7327 -lc|-lc_s)
7328 : Handle C library specially below.
7329 ;;
7330 -l*)
7331 thislib=`echo $thislib | $sed -e 's/^-l//'`
7332 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7333 :
7334 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7335 :
7336 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7337 :
7338 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7339 :
7340 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7341 :
7342 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7343 :
7344 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7345 :
7346 else
7347 try=''
7348 fi
7349 libnames="$libnames $try"
7350 ;;
7351 *) libnames="$libnames $thislib" ;;
7352 esac
7353 done
b4eb6b3d
JH
7354 ;;
7355esac
89ce900e
JH
7356xxx=normal
7357case "$libc" in
7358unknown)
7359 set /lib/libc.$so
7360 for xxx in $libpth; do
7361 $test -r $1 || set $xxx/libc.$so
7362 : The messy sed command sorts on library version numbers.
7363 $test -r $1 || \
7364 set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7365 tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7366 h
7367 s/[0-9][0-9]*/0000&/g
7368 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7369 G
7370 s/\n/ /' | \
7371 $sort | $sed -e 's/^.* //'`
7372 eval set \$$#
7373 done
7374 $test -r $1 || set /usr/ccs/lib/libc.$so
7375 $test -r $1 || set /lib/libsys_s$_a
7376 ;;
7377*)
7378 set blurfl
7379 ;;
7380esac
7381if $test -r "$1"; then
7382 echo "Your (shared) C library seems to be in $1."
7383 libc="$1"
7384elif $test -r /lib/libc && $test -r /lib/clib; then
7385 echo "Your C library seems to be in both /lib/clib and /lib/libc."
7386 xxx=apollo
7387 libc='/lib/clib /lib/libc'
7388 if $test -r /lib/syslib; then
7389 echo "(Your math library is in /lib/syslib.)"
7390 libc="$libc /lib/syslib"
7391 fi
7392elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7393 echo "Your C library seems to be in $libc, as you said before."
7394elif $test -r $incpath/usr/lib/libc$_a; then
7395 libc=$incpath/usr/lib/libc$_a;
7396 echo "Your C library seems to be in $libc. That's fine."
7397elif $test -r /lib/libc$_a; then
7398 libc=/lib/libc$_a;
7399 echo "Your C library seems to be in $libc. You're normal."
7400else
7401 if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7402 :
7403 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7404 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7405 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7406 :
7407 elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7408 :
7409 elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7410 :
7411 else
7412 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7413 fi
7414 if $test -r "$tans"; then
7415 echo "Your C library seems to be in $tans, of all places."
7416 libc=$tans
7417 else
7418 libc='blurfl'
7419 fi
7420fi
7421if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7422 dflt="$libc"
7423 cat <<EOM
b4eb6b3d 7424
89ce900e
JH
7425If the guess above is wrong (which it might be if you're using a strange
7426compiler, or your machine supports multiple models), you can override it here.
b4eb6b3d 7427
89ce900e
JH
7428EOM
7429else
7430 dflt=''
7431 echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7432 cat >&4 <<EOM
7433I can't seem to find your C library. I've looked in the following places:
5e366f65 7434
b4eb6b3d 7435EOM
89ce900e
JH
7436 $sed 's/^/ /' libpath
7437 cat <<EOM
5e366f65 7438
89ce900e 7439None of these seems to contain your C library. I need to get its name...
5e366f65
JH
7440
7441EOM
89ce900e
JH
7442fi
7443fn=f
7444rp='Where is your C library?'
7445. ./getfile
7446libc="$ans"
5e366f65 7447
89ce900e
JH
7448echo " "
7449echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7450set X `cat libnames`
7451shift
7452xxx=files
7453case $# in 1) xxx=file; esac
7454echo "Extracting names from the following $xxx for later perusal:" >&4
7455echo " "
7456$sed 's/^/ /' libnames >&4
7457echo " "
7458$echo $n "This may take a while...$c" >&4
5e366f65 7459
89ce900e
JH
7460for file in $*; do
7461 case $file in
7462 *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7463 *) $nm $nm_opt $file 2>/dev/null;;
b4eb6b3d 7464 esac
89ce900e
JH
7465done >libc.tmp
7466
7467$echo $n ".$c"
7468$grep fprintf libc.tmp > libc.ptf
7469xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7470xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7471xxx='[ADTSIW]'
ab900c53 7472if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *//p'";\
89ce900e
JH
7473 eval $xscan;\
7474 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7475 eval $xrun
7476elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7477 eval $xscan;\
7478 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7479 eval $xrun
7480elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7481 eval $xscan;\
7482 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7483 eval $xrun
7484elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7485 eval $xscan;\
7486 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7487 eval $xrun
7488elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7489 eval $xscan;\
7490 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7491 eval $xrun
7492elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7493 eval $xscan;\
7494 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7495 eval $xrun
7496elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7497 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
7498 eval $xscan;\
7499 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7500 eval $xrun
7501elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7502 eval $xscan;\
7503 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7504 eval $xrun
7505elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7506 eval $xscan;\
7507 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7508 eval $xrun
7509elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7510 eval $xscan;\
7511 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7512 eval $xrun
7513elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7514 eval $xscan;\
7515 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7516 eval $xrun
7517elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7518 eval $xscan;\
7519 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7520 eval $xrun
7521elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7522 eval $xscan;\
7523 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7524 eval $xrun
7525elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\
7526 eval $xscan;\
7527 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7528 eval $xrun
b4eb6b3d 7529else
89ce900e
JH
7530 $nm -p $* 2>/dev/null >libc.tmp
7531 $grep fprintf libc.tmp > libc.ptf
7532 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7533 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7534 then
7535 nm_opt='-p'
7536 eval $xrun
7537 else
7538 echo " "
7539 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7540 com=''
7541 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7542 for thisname in $libnames $libc; do
7543 $ar t $thisname >>libc.tmp
7544 done
7545 $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7546 echo "Ok." >&4
7547 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7548 # Repeat libc to extract forwarders to DLL entries too
7549 for thisname in $libnames $libc; do
7550 $ar tv $thisname >>libc.tmp
7551 # Revision 50 of EMX has bug in $ar.
7552 # it will not extract forwarders to DLL entries
7553 # Use emximp which will extract exactly them.
7554 emximp -o tmp.imp $thisname \
7555 2>/dev/null && \
7556 $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7557 < tmp.imp >>libc.tmp
7558 $rm tmp.imp
7559 done
7560 $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7561 echo "Ok." >&4
7562 else
7563 echo "$ar didn't seem to work right." >&4
7564 echo "Maybe this is a Cray...trying bld instead..." >&4
7565 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7566 then
7567 for thisname in $libnames; do
7568 bld t $libnames | \
7569 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7570 $ar t $thisname >>libc.tmp
7571 done
7572 echo "Ok." >&4
7573 else
7574 echo "That didn't work either. Giving up." >&4
7575 exit 1
7576 fi
7577 fi
7578 fi
b4eb6b3d 7579fi
89ce900e
JH
7580nm_extract="$com"
7581case "$PASE" in
7582define)
7583 echo " "
7584 echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7585 dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7586 ;;
7587*) if $test -f /lib/syscalls.exp; then
7588 echo " "
7589 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7590 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' /lib/syscalls.exp >>libc.list
7591 fi
7592 ;;
7593esac
7594;;
7595esac
7596$rm -f libnames libpath
b4eb6b3d
JH
7597
7598: see if dld is available
7599set dld.h i_dld
7600eval $inhdr
7601
43dddb59
MB
7602
7603echo " "
7604echo "Checking for C++..." >&4
20e87299 7605$cat >try.c <<'EOCP'
43dddb59
MB
7606#include <stdio.h>
7607int main(void)
7608{
7609#ifdef __cplusplus
20e87299 7610 return 0;
43dddb59 7611#else
20e87299 7612 return 1;
43dddb59 7613#endif
43dddb59
MB
7614}
7615EOCP
7616set try
20e87299
AD
7617if eval $compile_ok && $run ./try; then
7618 val="$define"
43dddb59
MB
7619 echo "You are using a C++ compiler."
7620else
7621 val="$undef"
7622 echo "You are not using a C++ compiler."
7623fi
5b813a60 7624$rm_try cplusplus$$
43dddb59
MB
7625set d_cplusplus
7626eval $setvar
7627
89ce900e
JH
7628: is a C symbol defined?
7629csym='tlook=$1;
7630case "$3" in
373dfab3
JH
7631-v) tf=libc.tmp; tdc="";;
7632-a) tf=libc.tmp; tdc="[]";;
7633*) tlook="^$1\$"; tf=libc.list; tdc="()";;
89ce900e
JH
7634esac;
7635tx=yes;
7636case "$reuseval-$4" in
7637true-) ;;
7638true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7639esac;
7640case "$tx" in
7641yes)
43dddb59 7642 tval=false;
328aef96
NC
7643 case "$d_cplusplus" in
7644 $define) extern_C=\"C\";;
7645 esac;
5129fff4
JH
7646 if $test "$runnm" = true; then
7647 if $contains $tlook $tf >/dev/null 2>&1; then
ab900c53 7648 tval=true;
5129fff4 7649 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
328aef96 7650 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7651 $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
373dfab3 7652 $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
5b813a60 7653 $rm_try;
89ce900e 7654 fi;
5129fff4 7655 else
328aef96 7656 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
5129fff4 7657 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
5b813a60 7658 $rm_try;
ab900c53
AB
7659 fi;
7660 ;;
89ce900e
JH
7661*)
7662 case "$tval" in
7663 $define) tval=true;;
7664 *) tval=false;;
ab900c53
AB
7665 esac;
7666 ;;
89ce900e
JH
7667esac;
7668eval "$2=$tval"'
7669
7670: define an is-in-libc? function
7671inlibc='echo " "; td=$define; tu=$undef;
7672sym=$1; var=$2; eval "was=\$$2";
7673tx=yes;
7674case "$reuseval$was" in
7675true) ;;
7676true*) tx=no;;
7677esac;
7678case "$tx" in
7679yes)
7680 set $sym tres -f;
7681 eval $csym;
7682 case "$tres" in
7683 true)
7684 echo "$sym() found." >&4;
7685 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7686 *)
7687 echo "$sym() NOT found." >&4;
7688 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7689 esac;;
7690*)
7691 case "$was" in
7692 $define) echo "$sym() found." >&4;;
7693 *) echo "$sym() NOT found." >&4;;
7694 esac;;
7695esac'
7696
b4eb6b3d
JH
7697: see if dlopen exists
7698xxx_runnm="$runnm"
666ea192 7699xxx_ccflags="$ccflags"
b4eb6b3d 7700runnm=false
666ea192
JH
7701: with g++ one needs -shared to get is-in-libc to work for dlopen
7702case "$gccversion" in
7703'') ;;
7704*) case "$d_cplusplus" in
7705 "$define") ccflags="$ccflags -shared" ;;
7706 esac
7707 ;;
7708esac
b4eb6b3d
JH
7709set dlopen d_dlopen
7710eval $inlibc
7711runnm="$xxx_runnm"
666ea192 7712ccflags="$xxx_ccflags"
b4eb6b3d 7713
4fb7dc7d
JH
7714: see if this is a unistd.h system
7715set unistd.h i_unistd
7716eval $inhdr
7717
b4eb6b3d
JH
7718: determine which dynamic loading, if any, to compile in
7719echo " "
7720dldir="ext/DynaLoader"
7721case "$usedl" in
7722$define|y|true)
7723 dflt='y'
7724 usedl="$define"
7725 ;;
7726$undef|n|false)
7727 dflt='n'
7728 usedl="$undef"
7729 ;;
5b813a60 7730*)
b4eb6b3d
JH
7731 dflt='n'
7732 case "$d_dlopen" in
7733 $define) dflt='y' ;;
7734 esac
7735 case "$i_dld" in
7736 $define) dflt='y' ;;
7737 esac
7738 : Does a dl_xxx.xs file exist for this operating system
7739 $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7740 ;;
7741esac
7742rp="Do you wish to use dynamic loading?"
7743. ./myread
7744usedl="$ans"
7745case "$ans" in
7746y*) usedl="$define"
7747 case "$dlsrc" in
7748 '')
7749 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7750 dflt="$dldir/dl_${osname}.xs"
7751 elif $test "$d_dlopen" = "$define" ; then
7752 dflt="$dldir/dl_dlopen.xs"
7753 elif $test "$i_dld" = "$define" ; then
7754 dflt="$dldir/dl_dld.xs"
7755 else
7756 dflt=''
7757 fi
7758 ;;
7759 *) dflt="$dldir/$dlsrc"
7760 ;;
7761 esac
7762 echo "The following dynamic loading files are available:"
7763 : Can not go over to $dldir because getfile has path hard-coded in.
6904989c 7764 tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
b4eb6b3d
JH
7765 rp="Source file to use for dynamic loading"
7766 fn="fne"
7767 gfpth="$src"
7768 . ./getfile
7769 usedl="$define"
7770 : emulate basename
7771 dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7772
7773 $cat << EOM
7774
7775Some systems may require passing special flags to $cc -c to
7776compile modules that will be used to create a shared library.
7777To use no flags, say "none".
7778
7779EOM
7780 case "$cccdlflags" in
7781 '') case "$gccversion" in
7782 '') case "$osname" in
7783 hpux) dflt='+z' ;;
7784 next) dflt='none' ;;
7785 irix*) dflt='-KPIC' ;;
48bcfe03 7786 svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
b4eb6b3d
JH
7787 sunos) dflt='-pic' ;;
7788 *) dflt='none' ;;
7789 esac
7790 ;;
7791 *) case "$osname" in
b6cc0f4c 7792 darwin) dflt='none' ;;
15fcae63 7793 linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
b4eb6b3d
JH
7794 *) dflt='-fpic' ;;
7795 esac ;;
7796 esac ;;
7797 ' ') dflt='none' ;;
7798 *) dflt="$cccdlflags" ;;
7799 esac
7800 rp="Any special flags to pass to $cc -c to compile shared library modules?"
7801 . ./myread
7802 case "$ans" in
7803 none) cccdlflags=' ' ;;
7804 *) cccdlflags="$ans" ;;
7805 esac
7806
7807 cat << EOM
7808
7809Some systems use ld to create libraries that can be dynamically loaded,
7810while other systems (such as those using ELF) use $cc.
7811
7812EOM
7813 case "$ld" in
55954f19 7814 '') $cat >try.c <<EOM
b4eb6b3d
JH
7815/* Test for whether ELF binaries are produced */
7816#include <fcntl.h>
55954f19
JH
7817#$i_stdlib I_STDLIB
7818#ifdef I_STDLIB
b4eb6b3d 7819#include <stdlib.h>
55954f19 7820#endif
4fb7dc7d
JH
7821#$i_unistd I_UNISTD
7822#ifdef I_UNISTD
7823#include <unistd.h>
7824#endif
b4eb6b3d
JH
7825int main() {
7826 char b[4];
7827 int i = open("a.out",O_RDONLY);
5b813a60 7828 if(i == -1)
b4eb6b3d
JH
7829 exit(1); /* fail */
7830 if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7831 exit(0); /* succeed (yes, it's ELF) */
7832 else
7833 exit(1); /* fail */
7834}
7835EOM
5440bc8e 7836 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
b4eb6b3d
JH
7837 cat <<EOM
7838You appear to have ELF support. I'll use $cc to build dynamic libraries.
7839EOM
7840 dflt="$cc"
7841 else
7842 echo "I'll use ld to build dynamic libraries."
7843 dflt='ld'
7844 fi
5b813a60 7845 $rm_try
b4eb6b3d
JH
7846 ;;
7847 *) dflt="$ld"
7848 ;;
7849 esac
7850
7851 rp="What command should be used to create dynamic libraries?"
7852 . ./myread
7853 ld="$ans"
7854
7855 cat << EOM
7856
7857Some systems may require passing special flags to $ld to create a
7858library that can be dynamically loaded. If your ld flags include
7859-L/other/path options to locate libraries outside your loader's normal
7860search path, you may need to specify those -L options here as well. To
7861use no flags, say "none".
7862
7863EOM
7864 case "$lddlflags" in
7865 '') case "$osname" in
7866 beos) dflt='-nostart' ;;
7867 hpux) dflt='-b';
7868 case "$gccversion" in
7869 '') dflt="$dflt +vnocompatwarnings" ;;
7870 esac
5b813a60 7871 ;;
15fcae63 7872 linux|irix*|gnu*) dflt="-shared $optimize" ;;
b4eb6b3d
JH
7873 next) dflt='none' ;;
7874 solaris) dflt='-G' ;;
7875 sunos) dflt='-assert nodefinitions' ;;
48bcfe03 7876 svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
b4eb6b3d
JH
7877 *) dflt='none' ;;
7878 esac
7879 ;;
7880 *) dflt="$lddlflags" ;;
7881 esac
7882
7883 : Try to guess additional flags to pick up local libraries.
7884 : Be careful not to append to a plain 'none'
7885 case "$dflt" in
7886 none) dflt='' ;;
7887 esac
7888 for thisflag in $ldflags; do
7889 case "$thisflag" in
b5b9f165 7890 -L*|-R*|-Wl,-R*)
b4eb6b3d
JH
7891 case " $dflt " in
7892 *" $thisflag "*) ;;
7893 *) dflt="$dflt $thisflag" ;;
7894 esac
7895 ;;
7896 esac
7897 done
7898
7899 case "$dflt" in
7900 ''|' ') dflt='none' ;;
7901 esac
7902
7903 rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7904 . ./myread
7905 case "$ans" in
7906 none) lddlflags=' ' ;;
7907 *) lddlflags="$ans" ;;
7908 esac
7909
7910 cat <<EOM
7911
7912Some systems may require passing special flags to $cc to indicate that
7913the resulting executable will use dynamic linking. To use no flags,
7914say "none".
7915
7916EOM
7917 case "$ccdlflags" in
7918 '') case "$osname" in
fb2e1bc0 7919 linux|hpux|gnu*) dflt='-Wl,-E' ;;
91fc0aa5
AH
7920 next|sunos) dflt='none' ;;
7921 *) dflt='none' ;;
b4eb6b3d
JH
7922 esac ;;
7923 ' ') dflt='none' ;;
7924 *) dflt="$ccdlflags" ;;
7925 esac
7926 rp="Any special flags to pass to $cc to use dynamic linking?"
7927 . ./myread
7928 case "$ans" in
7929 none) ccdlflags=' ' ;;
7930 *) ccdlflags="$ans" ;;
7931 esac
7932 ;;
7933*) usedl="$undef"
7934 ld='ld'
7935 dlsrc='dl_none.xs'
7936 lddlflags=''
7937 ccdlflags=''
7938 ;;
7939esac
7940
7941also=''
7942case "$usedl" in
7943$undef)
7944 # No dynamic loading being used, so don't bother even to prompt.
7945 useshrplib='false'
7946 ;;
7947*) case "$useshrplib" in
7948 '') case "$osname" in
48bcfe03 7949 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
b4eb6b3d
JH
7950 dflt=y
7951 also='Building a shared libperl is required for dynamic loading to work on your system.'
7952 ;;
7953 next*)
7954 case "$osvers" in
7955 4*) dflt=y
7956 also='Building a shared libperl is needed for MAB support.'
7957 ;;
7958 *) dflt=n
7959 ;;
7960 esac
7961 ;;
7962 *) dflt=n
7963 ;;
7964 esac
7965 ;;
7966 $define|true|[Yy]*)
7967 dflt=y
7968 ;;
7969 *) dflt=n
7970 ;;
7971 esac
7972 $cat << EOM
7973
7974The perl executable is normally obtained by linking perlmain.c with
7975libperl${_a}, any static extensions (usually just DynaLoader), and
7976any other libraries needed on this system (such as -lm, etc.). Since
7977your system supports dynamic loading, it is probably possible to build
7978a shared libperl.$so. If you will have more than one executable linked
7979to libperl.$so, this will significantly reduce the size of each
5cadb3f3 7980executable, but it may have a noticeable effect on performance. The
b4eb6b3d
JH
7981default is probably sensible for your system.
7982$also
7983
7984EOM
7985 rp="Build a shared libperl.$so (y/n)"
7986 . ./myread
7987 case "$ans" in
7988 true|$define|[Yy]*)
7989 useshrplib='true' ;;
7990 *) useshrplib='false' ;;
7991 esac
7992 ;;
7993esac
7994
7995case "$useshrplib" in
7996true)
7997 case "$libperl" in
7998 '')
7999 # Figure out a good name for libperl.so. Since it gets stored in
8000 # a version-specific architecture-dependent library, the version
8001 # number isn't really that important, except for making cc/ld happy.
8002 #
8003 # A name such as libperl.so.3.1
8004 majmin="libperl.$so.$patchlevel.$subversion"
8005 # A name such as libperl.so.301
8006 majonly=`echo $patchlevel $subversion |
8007 $awk '{printf "%d%02d", $1, $2}'`
8008 majonly=libperl.$so.$majonly
8009 # I'd prefer to keep the os-specific stuff here to a minimum, and
8010 # rely on figuring it out from the naming of libc.
8011 case "${osname}${osvers}" in
8012 next4*)
8013 dflt=libperl.5.$so
8014 # XXX How handle the --version stuff for MAB?
8015 ;;
fb2e1bc0 8016 linux*|gnu*) # ld won't link with a bare -lperl otherwise.
b4eb6b3d
JH
8017 dflt=libperl.$so
8018 ;;
b53432e4
GH
8019 cygwin*) # ld links against an importlib
8020 dflt=libperl$lib_ext
b4eb6b3d
JH
8021 ;;
8022 *) # Try to guess based on whether libc has major.minor.
8023 case "$libc" in
8024 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8025 *libc.$so.[0-9]*) dflt=$majonly ;;
8026 *) dflt=libperl.$so ;;
8027 esac
8028 ;;
8029 esac
8030 ;;
8031 *) dflt=$libperl
8032 ;;
8033 esac
8034 cat << EOM
8035
8036I need to select a good name for the shared libperl. If your system uses
8037library names with major and minor numbers, then you might want something
8038like $majmin. Alternatively, if your system uses a single version
8039number for shared libraries, then you might want to use $majonly.
8040Or, your system might be quite happy with a simple libperl.$so.
8041
8042Since the shared libperl will get installed into a version-specific
8043architecture-dependent directory, the version number of the shared perl
8044library probably isn't important, so the default should be o.k.
8045
8046EOM
8047 rp='What name do you want to give to the shared libperl?'
8048 . ./myread
8049 libperl=$ans
8050 echo "Ok, I'll use $libperl"
8051 ;;
8052*)
8053 libperl="libperl${_a}"
8054 ;;
8055esac
8056
8057# Detect old use of shrpdir via undocumented Configure -Dshrpdir
8058case "$shrpdir" in
8059'') ;;
8060*) $cat >&4 <<EOM
8061WARNING: Use of the shrpdir variable for the installation location of
8062the shared $libperl is not supported. It was never documented and
8063will not work in this version. Let me (perlbug@perl.org)
8064know of any problems this may cause.
8065
8066EOM
8067 case "$shrpdir" in
8068 "$archlibexp/CORE")
8069 $cat >&4 <<EOM
8070But your current setting of $shrpdir is
8071the default anyway, so it's harmless.
8072EOM
8073 ;;
8074 *)
8075 $cat >&4 <<EOM
8076Further, your current attempted setting of $shrpdir
8077conflicts with the value of $archlibexp/CORE
8078that installperl will use.
8079EOM
8080 ;;
8081 esac
8082 ;;
8083esac
8084
8085# How will the perl executable find the installed shared $libperl?
8086# Add $xxx to ccdlflags.
8087# If we can't figure out a command-line option, use $shrpenv to
8088# set env LD_RUN_PATH. The main perl makefile uses this.
8089shrpdir=$archlibexp/CORE
8090xxx=''
8091tmp_shrpenv=''
8092if "$useshrplib"; then
8093 case "$osname" in
8094 aix)
8095 # We'll set it in Makefile.SH...
8096 ;;
b5b9f165 8097 solaris)
b4eb6b3d
JH
8098 xxx="-R $shrpdir"
8099 ;;
a774dfe6 8100 freebsd|netbsd|openbsd|interix|dragonfly)
b4eb6b3d
JH
8101 xxx="-Wl,-R$shrpdir"
8102 ;;
fb2e1bc0 8103 bsdos|linux|irix*|dec_osf|gnu*)
b4eb6b3d
JH
8104 xxx="-Wl,-rpath,$shrpdir"
8105 ;;
8106 next)
8107 # next doesn't like the default...
8108 ;;
8109 beos)
8110 # beos doesn't like the default, either.
8111 ;;
8112 hpux*)
8113 # hpux doesn't like the default, either.
8114 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8115 ;;
8116 *)
8117 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8118 ;;
8119 esac
8120 case "$xxx" in
8121 '') ;;
8122 *)
8123 # Only add $xxx if it isn't already in ccdlflags.
8124 case " $ccdlflags " in
8125 *" $xxx "*) ;;
8126 *) ccdlflags="$ccdlflags $xxx"
8127 cat <<EOM >&4
8128
8129Adding $xxx to the flags
8130passed to $ld so that the perl executable will find the
8131installed shared $libperl.
8132
8133EOM
8134 ;;
8135 esac
8136 ;;
8137 esac
8138fi
8139# Fix ccdlflags in AIX for building external extensions.
8140# (For building Perl itself bare -bE:perl.exp is needed,
8141# Makefile.SH takes care of this.)
8142case "$osname" in
8143aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8144esac
8145# Respect a hint or command-line value.
8146case "$shrpenv" in
8147'') shrpenv="$tmp_shrpenv" ;;
8148esac
8149case "$ldlibpthname" in
8150'') ldlibpthname=LD_LIBRARY_PATH ;;
8151none) ldlibpthname='' ;;
8152esac
8153
8154: determine where manual pages are on this system
8155echo " "
8156case "$sysman" in
8157'')
4a0a3829
SD
8158 syspath='/usr/share/man/man1 /usr/man/man1'
8159 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8160 syspath="$syspath /usr/man/u_man/man1"
b4eb6b3d
JH
8161 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8162 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8163 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8164 sysman=`./loc . /usr/man/man1 $syspath`
8165 ;;
8166esac
8167if $test -d "$sysman"; then
8168 echo "System manual is in $sysman." >&4
8169else
8170 echo "Could not find manual pages in source form." >&4
8171fi
8172
8173: determine where manual pages go
8174set man1dir man1dir none
8175eval $prefixit
8176$cat <<EOM
8177
8178$spackage has manual pages available in source form.
8179EOM
8180case "$nroff" in
8181nroff)
8182 echo "However, you don't have nroff, so they're probably useless to you."
8183 case "$man1dir" in
8184 '') man1dir="none";;
8185 esac;;
8186esac
8187echo "If you don't want the manual sources installed, answer 'none'."
8188case "$man1dir" in
8189' ') dflt=none
8190 ;;
8191'')
4a0a3829
SD
8192 lookpath="$prefixexp/share/man/man1"
8193 lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
b4eb6b3d
JH
8194 lookpath="$lookpath $prefixexp/man/p_man/man1"
8195 lookpath="$lookpath $prefixexp/man/u_man/man1"
8196 lookpath="$lookpath $prefixexp/man/man.1"
8197 case "$sysman" in
8198 */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8199 *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8200 esac
8201 set dflt
8202 eval $prefixup
8203 ;;
8204*) dflt="$man1dir"
8205 ;;
8206esac
8207echo " "
8208fn=dn+~
8209rp="Where do the main $spackage manual pages (source) go?"
8210. ./getfile
8211if $test "X$man1direxp" != "X$ansexp"; then
8212 installman1dir=''
8213fi
79522dd2
NC
8214prefixvar=man1dir
8215. ./setprefixvar
8216
477140ee
NC
8217case "$man1dir" in
8218'') man1dir=' '
8219 installman1dir='';;
8220esac
b4eb6b3d
JH
8221
8222: What suffix to use on installed man pages
8223
8224case "$man1dir" in
8225' ')
8226 man1ext='0'
8227 ;;
8228*)
8229 rp="What suffix should be used for the main $spackage man pages?"
8230 case "$man1ext" in
8231 '') case "$man1dir" in
8232 *1) dflt=1 ;;
8233 *1p) dflt=1p ;;
8234 *1pm) dflt=1pm ;;
8235 *l) dflt=l;;
8236 *n) dflt=n;;
8237 *o) dflt=o;;
8238 *p) dflt=p;;
8239 *C) dflt=C;;
8240 *L) dflt=L;;
8241 *L1) dflt=L1;;
8242 *) dflt=1;;
8243 esac
8244 ;;
8245 *) dflt="$man1ext";;
8246 esac
8247 . ./myread
8248 man1ext="$ans"
8249 ;;
8250esac
8251
8252: see if we can have long filenames
8253echo " "
8254first=123456789abcdef
8255$rm -f $first
8256if (echo hi >$first) 2>/dev/null; then
8257 if $test -f 123456789abcde; then
8258 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
8259 val="$undef"
8260 else
8261 echo 'You can have filenames longer than 14 characters.'>&4
8262 val="$define"
8263 fi
8264else
8265 $cat <<'EOM'
8266You can't have filenames longer than 14 chars.
8267You can't even think about them!
8268EOM
8269 val="$undef"
8270fi
8271set d_flexfnam
8272eval $setvar
8273$rm -rf 123456789abcde*
8274
8275: determine where library module manual pages go
8276set man3dir man3dir none
8277eval $prefixit
8278$cat <<EOM
8279
8280$spackage has manual pages for many of the library modules.
8281EOM
8282
8283case "$nroff" in
8284nroff)
8285 $cat <<'EOM'
8286However, you don't have nroff, so they're probably useless to you.
8287EOM
8288 case "$man3dir" in
8289 '') man3dir="none";;
8290 esac;;
8291esac
8292
8293case "$d_flexfnam" in
8294undef)
8295 $cat <<'EOM'
f3f1a2d8 8296However, your system can't handle the long file names like File::Basename.3.
b4eb6b3d
JH
8297EOM
8298 case "$man3dir" in
8299 '') man3dir="none";;
8300 esac;;
8301esac
8302
8303echo "If you don't want the manual sources installed, answer 'none'."
8304prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8305case "$man3dir" in
8306'') dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8307 if $test -d "$privlib/man/man3"; then
8308 cat <<EOM >&4
8309
8310WARNING: Previous versions of perl installed man3 pages into
f3f1a2d8
MB
8311$privlib/man/man3. This version will suggest a
8312new default of $dflt.
b4eb6b3d
JH
8313EOM
8314 tdflt=$dflt
8315 dflt='n'
8316 rp='Do you wish to preserve the old behavior?(y/n)'
8317 . ./myread
8318 case "$ans" in
8319 y*) dflt="$privlib/man/man3" ;;
8320 *) dflt=$tdflt ;;
8321 esac
8322 fi
8323 ;;
8324*) dflt="$man3dir" ;;
8325esac
8326case "$dflt" in
8327' ') dflt=none ;;
8328esac
8329echo " "
8330fn=dn+~
8331rp="Where do the $package library man pages (source) go?"
8332. ./getfile
79522dd2
NC
8333prefixvar=man3dir
8334. ./setprefixvar
8335
477140ee
NC
8336case "$man3dir" in
8337'') man3dir=' '
8338 installman3dir='';;
8339esac
b4eb6b3d
JH
8340
8341: What suffix to use on installed man pages
8342case "$man3dir" in
8343' ')
8344 man3ext='0'
8345 ;;
8346*)
8347 rp="What suffix should be used for the $package library man pages?"
8348 case "$man3ext" in
8349 '') case "$man3dir" in
8350 *3) dflt=3 ;;
8351 *3p) dflt=3p ;;
8352 *3pm) dflt=3pm ;;
8353 *l) dflt=l;;
8354 *n) dflt=n;;
8355 *o) dflt=o;;
8356 *p) dflt=p;;
8357 *C) dflt=C;;
8358 *L) dflt=L;;
8359 *L3) dflt=L3;;
8360 *) dflt=3;;
8361 esac
8362 ;;
8363 *) dflt="$man3ext";;
8364 esac
8365 . ./myread
8366 man3ext="$ans"
8367 ;;
8368esac
8369
8370: see if we have to deal with yellow pages, now NIS.
0384a54a 8371if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
b4eb6b3d
JH
8372 if $test -f /usr/etc/nibindd; then
8373 echo " "
8374 echo "I'm fairly confident you're on a NeXT."
8375 echo " "
8376 rp='Do you get the hosts file via NetInfo?'
8377 dflt=y
8378 case "$hostcat" in
8379 nidump*) ;;
8380 '') ;;
8381 *) dflt=n;;
8382 esac
8383 . ./myread
8384 case "$ans" in
8385 y*) hostcat='nidump hosts .';;
8386 *) case "$hostcat" in
8387 nidump*) hostcat='';;
8388 esac
8389 ;;
8390 esac
8391 fi
8392 case "$hostcat" in
8393 nidump*) ;;
8394 *)
8395 case "$hostcat" in
8396 *ypcat*) dflt=y;;
8397 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8398 dflt=y
8399 else
8400 dflt=n
8401 fi;;
8402 *) dflt=n;;
8403 esac
8404 echo " "
8405 rp='Are you getting the hosts file via yellow pages?'
8406 . ./myread
8407 case "$ans" in
8408 y*) hostcat='ypcat hosts';;
8409 *) hostcat='cat /etc/hosts';;
8410 esac
8411 ;;
8412 esac
8413fi
8414case "$hostcat" in
8415'') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8416esac
8417case "$groupcat" in
8418'') test -f /etc/group && groupcat='cat /etc/group';;
8419esac
8420case "$passcat" in
8421'') test -f /etc/passwd && passcat='cat /etc/passwd';;
8422esac
8423
8424: now get the host name
8425echo " "
8426echo "Figuring out host name..." >&4
8427case "$myhostname" in
8428'') cont=true
8429 echo 'Maybe "hostname" will work...'
73614538 8430 if tans=`sh -c hostname 2>&1` ; then
b4eb6b3d
JH
8431 myhostname=$tans
8432 phostname=hostname
8433 cont=''
8434 fi
8435 ;;
8436*) cont='';;
8437esac
8438if $test "$cont"; then
8439 if ./xenix; then
8440 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
8441 if tans=`cat /etc/systemid 2>&1` ; then
8442 myhostname=$tans
8443 phostname='cat /etc/systemid'
8444 echo "Whadyaknow. Xenix always was a bit strange..."
8445 cont=''
8446 fi
8447 elif $test -r /etc/systemid; then
8448 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8449 fi
8450fi
8451if $test "$cont"; then
8452 echo 'No, maybe "uuname -l" will work...'
73614538 8453 if tans=`sh -c 'uuname -l' 2>&1` ; then
b4eb6b3d
JH
8454 myhostname=$tans
8455 phostname='uuname -l'
8456 else
8457 echo 'Strange. Maybe "uname -n" will work...'
73614538 8458 if tans=`sh -c 'uname -n' 2>&1` ; then
b4eb6b3d
JH
8459 myhostname=$tans
8460 phostname='uname -n'
8461 else
8462 echo 'Oh well, maybe I can mine it out of whoami.h...'
73614538 8463 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
b4eb6b3d
JH
8464 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8465 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8466 else
8467 case "$myhostname" in
8468 '') echo "Does this machine have an identity crisis or something?"
8469 phostname='';;
8470 *)
8471 echo "Well, you said $myhostname before..."
8472 phostname='echo $myhostname';;
8473 esac
8474 fi
8475 fi
8476 fi
8477fi
52a549d0
JH
8478case "$myhostname" in
8479'') myhostname=noname ;;
8480esac
b4eb6b3d
JH
8481: you do not want to know about this
8482set $myhostname
8483myhostname=$1
8484
8485: verify guess
8486if $test "$myhostname" ; then
8487 dflt=y
8488 rp='Your host name appears to be "'$myhostname'".'" Right?"
8489 . ./myread
8490 case "$ans" in
8491 y*) ;;
8492 *) myhostname='';;
8493 esac
8494fi
8495
8496: bad guess or no guess
8497while $test "X$myhostname" = X ; do
8498 dflt=''
8499 rp="Please type the (one word) name of your host:"
8500 . ./myread
8501 myhostname="$ans"
8502done
8503
8504: translate upper to lower if necessary
8505case "$myhostname" in
8506*[A-Z]*)
8507 echo "(Normalizing case in your host name)"
8508 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8509 ;;
8510esac
8511
8512case "$myhostname" in
8513*.*)
8514 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8515 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8516 echo "(Trimming domain name from host name--host name is now $myhostname)"
8517 ;;
8518*) case "$mydomain" in
8519 '')
8520 {
8521 test "X$hostcat" = "Xypcat hosts" &&
8522 ypmatch "$myhostname" hosts 2>/dev/null |\
8523 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
8524 $test -s hosts
8525 } || {
8526 test "X$hostcat" != "X" &&
8527 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
8528 /[ ]$myhostname[ . ]/p" > hosts
8529 }
8530 tmp_re="[ . ]"
f08cbdd1
PP
8531 if $test -f hosts; then
8532 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
b4eb6b3d 8533 END { print sum }" hosts` = x1 || tmp_re="[ ]"
f08cbdd1
PP
8534 dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8535 hosts | $sort | $uniq | \
8536 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8537 case `$echo X$dflt` in
8538 X*\ *) echo "(Several hosts in the database matched hostname)"
8539 dflt=.
8540 ;;
8541 X.) echo "(You do not have fully-qualified names in the hosts database)"
8542 ;;
8543 esac
8544 else
8545 echo "(I cannot locate a hosts database anywhere)"
b4eb6b3d 8546 dflt=.
f08cbdd1 8547 fi
b4eb6b3d
JH
8548 case "$dflt" in
8549 .)
8550 tans=`./loc resolv.conf X /etc /usr/etc`
8551 if $test -f "$tans"; then
8552 echo "(Attempting domain name extraction from $tans)"
8553 dflt=.`$sed -n -e 's/ / /g' \
8554 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
8555 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8556 case "$dflt" in
8557 .) dflt=.`$sed -n -e 's/ / /g' \
8558 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
8559 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8560 ;;
8561 esac
8562 fi
8563 ;;
8564 esac
8565 case "$dflt" in
8566 .) echo "(No help from resolv.conf either -- attempting clever guess)"
73614538 8567 dflt=.`sh -c domainname 2>/dev/null`
b4eb6b3d
JH
8568 case "$dflt" in
8569 '') dflt='.';;
8570 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8571 esac
8572 ;;
8573 esac
59c9e5d6
PP
8574 case "$dflt$osname" in
8575 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
caf85fe8 8576 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
59c9e5d6
PP
8577 ;;
8578 esac
b4eb6b3d
JH
8579 case "$dflt" in
8580 .) echo "(Lost all hope -- silly guess then)"
52a549d0 8581 dflt='.nonet'
b4eb6b3d
JH
8582 ;;
8583 esac
8584 $rm -f hosts
8585 ;;
8586 *) dflt="$mydomain";;
8587 esac;;
8588esac
8589echo " "
8590rp="What is your domain name?"
8591. ./myread
8592tans="$ans"
8593case "$ans" in
8594'') ;;
8595.*) ;;
8596*) tans=".$tans";;
8597esac
8598mydomain="$tans"
8599
8600: translate upper to lower if necessary
8601case "$mydomain" in
8602*[A-Z]*)
8603 echo "(Normalizing case in your domain name)"
8604 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8605 ;;
8606esac
8607
8608: a little sanity check here
8609case "$phostname" in
8610'') ;;
8611*)
8612 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8613 $myhostname$mydomain|$myhostname) ;;
8614 *)
8615 case "$phostname" in
8616 sed*)
8617 echo "(That doesn't agree with your whoami.h file, by the way.)"
8618 ;;
8619 *)
8620 echo "(That doesn't agree with your $phostname command, by the way.)"
8621 ;;
8622 esac
8623 ;;
8624 esac
8625 ;;
8626esac
8627
8628$cat <<EOM
8629
8630I need to get your e-mail address in Internet format if possible, i.e.
8631something like user@host.domain. Please answer accurately since I have
8632no easy means to double check it. The default value provided below
8633is most probably close to reality but may not be valid from outside
8634your organization...
8635
8636EOM
8637cont=x
8638while test "$cont"; do
8639 case "$cf_email" in
8640 '') dflt="$cf_by@$myhostname$mydomain";;
8641 *) dflt="$cf_email";;
8642 esac
8643 rp='What is your e-mail address?'
8644 . ./myread
8645 cf_email="$ans"
8646 case "$cf_email" in
8647 *@*.*) cont='' ;;
8648 *)
8649 rp='Address does not look like an Internet one. Use it anyway?'
8650 case "$fastread" in
8651 yes) dflt=y ;;
8652 *) dflt=n ;;
8653 esac
8654 . ./myread
8655 case "$ans" in
8656 y*) cont='' ;;
8657 *) echo " " ;;
8658 esac
8659 ;;
8660 esac
8661done
8662
8663$cat <<EOM
8664
8665If you or somebody else will be maintaining perl at your site, please
8666fill in the correct e-mail address here so that they may be contacted
8667if necessary. Currently, the "perlbug" program included with perl
8668will send mail to this address in addition to perlbug@perl.org. You may
8669enter "none" for no administrator.
8670
8671EOM
8672case "$perladmin" in
8673'') dflt="$cf_email";;
8674*) dflt="$perladmin";;
8675esac
8676rp='Perl administrator e-mail address'
8677. ./myread
8678perladmin="$ans"
8679
674912d7
RB
8680: determine whether to only install version-specific parts.
8681echo " "
8682$cat <<EOM
8683Do you want to install only the version-specific parts of the perl
8684distribution? Usually you do *not* want to do this.
8685EOM
8686case "$versiononly" in
8687"$define"|[Yy]*|true) dflt='y' ;;
8688*) dflt='n';
8689esac
8690rp="Do you want to install only the version-specific parts of perl?"
8691. ./myread
8692case "$ans" in
8693[yY]*) val="$define";;
8694*) val="$undef" ;;
8695esac
8696set versiononly
8697eval $setvar
8698
ad493445
MB
8699case "$versiononly" in
8700"$define") inc_version_list=''
8701 inc_version_list_init=0
8702 ;;
8703esac
8704
b4eb6b3d 8705: figure out how to guarantee perl startup
d0e36aa9 8706: XXX Note that this currently takes advantage of the bug that binexp ignores
a2d23ec2
MB
8707: the Configure -Dinstallprefix setting, which in turn means that under
8708: relocatable @INC, initialinstalllocation is what binexp started as.
b4eb6b3d
JH
8709case "$startperl" in
8710'')
8711 case "$sharpbang" in
8712 *!)
8713 $cat <<EOH
8714
8715I can use the #! construct to start perl on your system. This will
8716make startup of perl scripts faster, but may cause problems if you
8717want to share those scripts and perl is not in a standard place
a2d23ec2
MB
8718($initialinstalllocation/perl) on all your platforms. The alternative
8719is to force a shell by starting the script with a single ':' character.
b4eb6b3d
JH
8720
8721EOH
674912d7 8722 case "$versiononly" in
a2d23ec2 8723 "$define") dflt="$initialinstalllocation/perl$version";;
d0e36aa9 8724 *) dflt="$initialinstalllocation/perl";;
674912d7 8725 esac
b4eb6b3d
JH
8726 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8727 . ./myread
8728 case "$ans" in
8729 none) startperl=": # use perl";;
8730 *) startperl="#!$ans"
8731 if $test 30 -lt `echo "$ans" | wc -c`; then
8732 $cat >&4 <<EOM
8733
8734WARNING: Some systems limit the #! command to 32 characters.
8735If you experience difficulty running Perl scripts with #!, try
8736installing Perl in a directory with a shorter pathname.
8737
8738EOM
8739 fi ;;
8740 esac
8741 ;;
8742 *) startperl=": # use perl"
8743 ;;
8744 esac
8745 ;;
8746esac
8747echo "I'll use $startperl to start perl scripts."
8748
8749: figure best path for perl in scripts
8750case "$perlpath" in
8751'')
5e20a8ca 8752 case "$versiononly" in
d0e36aa9
NC
8753 "$define") perlpath="$initialinstalllocation/perl$version";;
8754 *) perlpath="$initialinstalllocation/perl";;
5e20a8ca 8755 esac
b4eb6b3d
JH
8756 case "$startperl" in
8757 *!*) ;;
8758 *)
8759 $cat <<EOH
8760
8761I will use the "eval 'exec'" idiom to start Perl on your system.
8762I can use the full path of your Perl binary for this purpose, but
8763doing so may cause problems if you want to share those scripts and
d0e36aa9 8764Perl is not always in a standard place ($initialinstalllocation/perl).
b4eb6b3d
JH
8765
8766EOH
d0e36aa9 8767 dflt="$initialinstalllocation/perl"
b4eb6b3d
JH
8768 rp="What path shall I use in \"eval 'exec'\"?"
8769 . ./myread
8770 perlpath="$ans"
8771 ;;
8772 esac
8773 ;;
8774esac
8775case "$startperl" in
8776*!*) ;;
8777*) echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8778esac
8779
8780: determine where public executable scripts go
8781set scriptdir scriptdir
8782eval $prefixit
8783case "$scriptdir" in
8784'')
8785 dflt="$bin"
8786 : guess some guesses
8787 $test -d /usr/share/scripts && dflt=/usr/share/scripts
8788 $test -d /usr/share/bin && dflt=/usr/share/bin
8789 $test -d /usr/local/script && dflt=/usr/local/script
8790 $test -d /usr/local/scripts && dflt=/usr/local/scripts
8791 $test -d $prefixexp/script && dflt=$prefixexp/script
8792 set dflt
8793 eval $prefixup
8794 ;;
8795*) dflt="$scriptdir"
8796 ;;
8797esac
8798$cat <<EOM
f3f1a2d8 8799
b4eb6b3d
JH
8800Some installations have a separate directory just for executable scripts so
8801that they can mount it across multiple architectures but keep the scripts in
8802one spot. You might, for example, have a subdirectory of /usr/share for this.
8803Or you might just lump your scripts in with all your other executables.
f3f1a2d8 8804
b4eb6b3d
JH
8805EOM
8806fn=d~
8807rp='Where do you keep publicly executable scripts?'
8808. ./getfile
8809if $test "X$ansexp" != "X$scriptdirexp"; then
8810 installscript=''
8811fi
f3f1a2d8 8812installscriptdir=''
79522dd2
NC
8813prefixvar=scriptdir
8814. ./setprefixvar
8815: A little fix up for an irregularly named variable.
8816installscript="$installscriptdir"
8817
b4eb6b3d
JH
8818: determine where add-on public executables go
8819case "$sitebin" in
8820'') dflt=$siteprefix/bin ;;
8821*) dflt=$sitebin ;;
8822esac
8823fn=d~
8824rp='Pathname where the add-on public executables should be installed?'
8825. ./getfile
79522dd2
NC
8826prefixvar=sitebin
8827. ./setprefixvar
b4eb6b3d 8828
6e1038e0 8829: determine where add-on html pages go
8d2cbf27 8830: There is no standard location, so try to copy the previously-selected
6e1038e0 8831: directory structure for the core html pages.
8d2cbf27
JH
8832case "$sitehtml1dir" in
8833'') dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8834*) dflt=$sitehtml1dir ;;
6e1038e0
MB
8835esac
8836case "$dflt" in
8837''|' ') dflt=none ;;
8838esac
8839fn=dn+~
8840rp='Pathname where the site-specific html pages should be installed?'
8841. ./getfile
79522dd2
NC
8842prefixvar=sitehtml1dir
8843. ./setprefixvar
6e1038e0
MB
8844
8845: determine where add-on library html pages go
8846: There is no standard location, so try to copy the previously-selected
8847: directory structure for the core html pages.
8d2cbf27
JH
8848case "$sitehtml3dir" in
8849'') dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8850*) dflt=$sitehtml3dir ;;
6e1038e0
MB
8851esac
8852case "$dflt" in
8853''|' ') dflt=none ;;
8854esac
8855fn=dn+~
8856rp='Pathname where the site-specific library html pages should be installed?'
8857. ./getfile
79522dd2
NC
8858prefixvar=sitehtml3dir
8859. ./setprefixvar
6e1038e0
MB
8860
8861: determine where add-on manual pages go
91e123a8
JH
8862case "$siteman1dir" in
8863'') dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8864*) dflt=$siteman1dir ;;
6e1038e0 8865esac
257059b5
JH
8866case "$dflt" in
8867''|' ') dflt=none ;;
8868esac
6e1038e0
MB
8869fn=dn+~
8870rp='Pathname where the site-specific manual pages should be installed?'
8871. ./getfile
79522dd2
NC
8872prefixvar=siteman1dir
8873. ./setprefixvar
6e1038e0
MB
8874
8875: determine where add-on library man pages go
91e123a8
JH
8876case "$siteman3dir" in
8877'') dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
f3f1a2d8 8878*) dflt=$siteman3dir ;;
6e1038e0 8879esac
257059b5
JH
8880case "$dflt" in
8881''|' ') dflt=none ;;
8882esac
6e1038e0
MB
8883fn=dn+~
8884rp='Pathname where the site-specific library manual pages should be installed?'
8885. ./getfile
79522dd2
NC
8886prefixvar=siteman3dir
8887. ./setprefixvar
6e1038e0
MB
8888
8889: determine where add-on public executable scripts go
8890case "$sitescript" in
8891'') dflt=$siteprefix/script
8892 $test -d $dflt || dflt=$sitebin ;;
8893*) dflt="$sitescript" ;;
8894esac
8895fn=d~+
8896rp='Pathname where add-on public executable scripts should be installed?'
8897. ./getfile
79522dd2
NC
8898prefixvar=sitescript
8899. ./setprefixvar
6e1038e0 8900
15b61c98
JH
8901case "$usefaststdio" in
8902$define|true|[yY]*|'')
8903 xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8904 case "$xversion" in
8905 [68]) dflt='y' ;;
8906 *) dflt='n' ;;
8907 esac
8908 ;;
8909*) dflt='n';;
8910esac
8911cat <<EOM
8912
8913Perl can be built to use 'fast stdio', which means using the stdio
8914library but also directly manipulating the stdio buffers to enable
8915faster I/O. Using stdio is better for backward compatibility (especially
8916for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8917interface has been preferred instead of stdio.
8918
8919If this doesn't make any sense to you, just accept the default '$dflt'.
8920EOM
8921rp='Use the "fast stdio" if available?'
8922. ./myread
8923case "$ans" in
8924y|Y) val="$define" ;;
8925*) val="$undef" ;;
8926esac
8927set usefaststdio
8928eval $setvar
8929
8930
96056487
JH
8931: define an is-a-typedef? function
8932typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8933case "$inclist" in
8934"") inclist="sys/types.h";;
8935esac;
8936eval "varval=\$$var";
8937case "$varval" in
8938"")
8939 $rm -f temp.c;
8940 for inc in $inclist; do
8941 echo "#include <$inc>" >>temp.c;
8942 done;
8943 echo "#ifdef $type" >> temp.c;
8944 echo "printf(\"We have $type\");" >> temp.c;
8945 echo "#endif" >> temp.c;
8946 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8947 if $contains $type temp.E >/dev/null 2>&1; then
8948 eval "$var=\$type";
8949 else
8950 eval "$var=\$def";
8951 fi;
8952 $rm -f temp.?;;
8953*) eval "$var=\$varval";;
8954esac'
8955
8956: define an is-a-typedef? function that prompts if the type is not available.
8957typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8958case "$inclist" in
8959"") inclist="sys/types.h";;
8960esac;
8961eval "varval=\$$var";
8962case "$varval" in
8963"")
8964 $rm -f temp.c;
8965 for inc in $inclist; do
8966 echo "#include <$inc>" >>temp.c;
8967 done;
8968 echo "#ifdef $type" >> temp.c;
8969 echo "printf(\"We have $type\");" >> temp.c;
8970 echo "#endif" >> temp.c;
8971 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8972 echo " " ;
8973 echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8974 if $contains $type temp.E >/dev/null 2>&1; then
8975 echo "$type found." >&4;
8976 eval "$var=\$type";
8977 else
8978 echo "$type NOT found." >&4;
8979 dflt="$def";
8980 . ./myread ;
8981 eval "$var=\$ans";
8982 fi;
8983 $rm -f temp.?;;
8984*) eval "$var=\$varval";;
8985esac'
8986
8987: see what type lseek is declared as in the kernel
8988rp="What is the type used for lseek's offset on this system?"
8989set off_t lseektype long stdio.h sys/types.h
8990eval $typedef_ask
8991
8992echo " "
8993echo "Checking to see how big your file offsets are..." >&4
8994$cat >try.c <<EOCP
8995#include <sys/types.h>
8996#include <stdio.h>
8997int main()
8998{
8999 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9000 return(0);
96056487
JH
9001}
9002EOCP
9003set try
9004if eval $compile_ok; then
9005 lseeksize=`$run ./try`
9006 echo "Your file offsets are $lseeksize bytes long."
9007else
9008 dflt=$longsize
9009 echo " "
9010 echo "(I can't seem to compile the test program. Guessing...)"
9011 rp="What is the size of your file offsets (in bytes)?"
9012 . ./myread
9013 lseeksize="$ans"
9014fi
5b813a60 9015$rm_try
96056487
JH
9016
9017: see what type file positions are declared as in the library
9018rp="What is the type for file position used by fsetpos()?"
9019set fpos_t fpostype long stdio.h sys/types.h
9020eval $typedef_ask
9021
9022echo " "
9023case "$fpostype" in
9024*_t) zzz="$fpostype" ;;
9025*) zzz="fpos_t" ;;
9026esac
9027echo "Checking the size of $zzz..." >&4
9028cat > try.c <<EOCP
9029#include <sys/types.h>
9030#include <stdio.h>
d1daaddf
JH
9031#$i_stdlib I_STDLIB
9032#ifdef I_STDLIB
9033#include <stdlib.h>
9034#endif
96056487
JH
9035int main() {
9036 printf("%d\n", (int)sizeof($fpostype));
9037 exit(0);
9038}
9039EOCP
9040set try
9041if eval $compile_ok; then
9042 yyy=`$run ./try`
9043 case "$yyy" in
9044 '') fpossize=4
9045 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9046 ;;
9047 *) fpossize=$yyy
9048 echo "Your $zzz is $fpossize bytes long."
9049 ;;
9050 esac
9051else
9052 dflt="$longsize"
9053 echo " " >&4
9054 echo "(I can't compile the test program. Guessing...)" >&4
9055 rp="What is the size of your file positions (in bytes)?"
9056 . ./myread
9057 fpossize="$ans"
9058fi
9059
96056487
JH
9060# Backward compatibility (uselfs is deprecated).
9061case "$uselfs" in
9062"$define"|true|[yY]*)
9063 cat <<EOM >&4
9064
9065*** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9066EOM
9067 uselargefiles="$define"
9068 ;;
5b813a60 9069esac
96056487
JH
9070
9071case "$lseeksize:$fpossize" in
90728:8) cat <<EOM
9073
9074You can have files larger than 2 gigabytes.
9075EOM
9076 val="$define" ;;
9077*) case "$uselargefiles" in
9078 "$undef"|false|[nN]*) dflt='n' ;;
9079 *) dflt='y' ;;
9080 esac
9081 cat <<EOM
9082
9083Perl can be built to understand large files (files larger than 2 gigabytes)
9084on some systems. To do so, Configure can be run with -Duselargefiles.
9085
9086If this doesn't make any sense to you, just accept the default '$dflt'.
9087EOM
9088 rp='Try to understand large files, if available?'
9089 . ./myread
9090 case "$ans" in
9091 y|Y) val="$define" ;;
9092 *) val="$undef" ;;
9093 esac
9094 ;;
9095esac
9096set uselargefiles
9097eval $setvar
96056487
JH
9098: Look for a hint-file generated 'call-back-unit'. If the
9099: user has specified that a large files perl is to be built,
9100: we may need to set or change some other defaults.
9da7673b
MB
9101if $test -f uselargefiles.cbu; then
9102 echo "Your platform has some specific hints regarding large file builds, using them..."
9103 . ./uselargefiles.cbu
9104fi
9105case "$uselargefiles" in
9106"$define")
96056487 9107 if $test -f uselargefiles.cbu; then
96056487
JH
9108 echo " "
9109 echo "Rechecking to see how big your file offsets are..." >&4
9110 $cat >try.c <<EOCP
9111#include <sys/types.h>
9112#include <stdio.h>
9113int main()
9114{
9115 printf("%d\n", (int)sizeof($lseektype));
5b813a60 9116 return(0);
96056487
JH
9117}
9118EOCP
9119 set try
9120 if eval $compile_ok; then
9121 lseeksize=`$run ./try`
9122 $echo "Your file offsets are now $lseeksize bytes long."
9123 else
9124 dflt="$lseeksize"
9125 echo " "
9126 echo "(I can't seem to compile the test program. Guessing...)"
9127 rp="What is the size of your file offsets (in bytes)?"
9128 . ./myread
9129 lseeksize="$ans"
9130 fi
9131 case "$fpostype" in
9132 *_t) zzz="$fpostype" ;;
9133 *) zzz="fpos_t" ;;
9134 esac
5b813a60 9135 $echo $n "Rechecking the size of $zzz...$c" >&4
96056487
JH
9136 $cat > try.c <<EOCP
9137#include <sys/types.h>
9138#include <stdio.h>
55954f19
JH
9139#$i_stdlib I_STDLIB
9140#ifdef I_STDLIB
9141#include <stdlib.h>
9142#endif
96056487
JH
9143int main() {
9144 printf("%d\n", (int)sizeof($fpostype));
073b6de5 9145 return(0);
96056487
JH
9146}
9147EOCP
9148 set try
9149 if eval $compile_ok; then
9150 yyy=`$run ./try`
9151 dflt="$lseeksize"
9152 case "$yyy" in
9153 '') echo " "
9154 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9155 ;;
9156 *) fpossize=$yyy
9157 echo " $fpossize bytes." >&4
9158 ;;
9159 esac
9160 else
9161 dflt="$fpossize"
9162 echo " "
9163 echo "(I can't compile the test program. Guessing...)" >&4
9164 rp="What is the size of your file positions (in bytes)?"
9165 . ./myread
9166 fpossize="$ans"
9167 fi
5b813a60 9168 $rm_try
96056487
JH
9169 fi
9170 ;;
9171esac
9172
b4eb6b3d
JH
9173case "$vendorprefix" in
9174'') d_vendorbin="$undef"
9175 vendorbin=''
9176 vendorbinexp=''
9177 ;;
9178*) d_vendorbin="$define"
9179 : determine where vendor-supplied executables go.
9180 case "$vendorbin" in
9181 '') dflt=$vendorprefix/bin ;;
9182 *) dflt="$vendorbin" ;;
9183 esac
9184 fn=d~+
9185 rp='Pathname for the vendor-supplied executables directory?'
9186 . ./getfile
9187 vendorbin="$ans"
9188 vendorbinexp="$ansexp"
9189 ;;
9190esac
a092d240
NC
9191prefixvar=vendorbin
9192. ./installprefix
b4eb6b3d 9193
6e1038e0 9194case "$vendorprefix" in
8d2cbf27
JH
9195'') vendorhtml1dir=''
9196 vendorhtml1direxp=''
6e1038e0
MB
9197 ;;
9198*) : determine where vendor-supplied html pages go.
9199 : There is no standard location, so try to copy the previously-selected
9200 : directory structure for the core html pages.
9201 : XXX Better default suggestions would be welcome.
8d2cbf27 9202 case "$vendorhtml1dir" in
6e1038e0 9203 '') dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9204 *) dflt=$vendorhtml1dir ;;
6e1038e0
MB
9205 esac
9206 case "$dflt" in
9207 ''|' ') dflt=none ;;
9208 esac
9209 fn=dn+~
9210 rp='Pathname for the vendor-supplied html pages?'
9211 . ./getfile
8d2cbf27
JH
9212 vendorhtml1dir="$ans"
9213 vendorhtml1direxp="$ansexp"
6e1038e0
MB
9214 ;;
9215esac
9216: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9217$test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
a092d240
NC
9218prefixvar=vendorhtml1dir
9219. ./installprefix
6e1038e0
MB
9220
9221case "$vendorprefix" in
8d2cbf27
JH
9222'') vendorhtml3dir=''
9223 vendorhtml3direxp=''
6e1038e0
MB
9224 ;;
9225*) : determine where vendor-supplied module html pages go.
9226 : There is no standard location, so try to copy the previously-selected
9227 : directory structure for the core html pages.
9228 : XXX Better default suggestions would be welcome.
8d2cbf27 9229 case "$vendorhtml3dir" in
6e1038e0 9230 '') dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8d2cbf27 9231 *) dflt=$vendorhtml3dir ;;
6e1038e0
MB
9232 esac
9233 case "$dflt" in
9234 ''|' ') dflt=none ;;
9235 esac
9236 fn=dn+~
9237 rp='Pathname for the vendor-supplied html pages?'
9238 . ./getfile
8d2cbf27
JH
9239 vendorhtml3dir="$ans"
9240 vendorhtml3direxp="$ansexp"
6e1038e0
MB
9241 ;;
9242esac
9243: Use ' ' for none so value is preserved next time through Configure
8d2cbf27 9244$test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
a092d240
NC
9245prefixvar=vendorhtml3dir
9246. ./installprefix
6e1038e0
MB
9247
9248case "$vendorprefix" in
91e123a8
JH
9249'') vendorman1dir=''
9250 vendorman1direxp=''
6e1038e0
MB
9251 ;;
9252*) : determine where vendor-supplied manual pages go.
91e123a8 9253 case "$vendorman1dir" in
6e1038e0 9254 '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9255 *) dflt=$vendorman1dir ;;
6e1038e0
MB
9256 esac
9257 case "$dflt" in
9258 ''|' ') dflt=none ;;
9259 esac
9260 fn=nd~+
9261 rp='Pathname for the vendor-supplied manual section 1 pages?'
9262 . ./getfile
91e123a8
JH
9263 vendorman1dir="$ans"
9264 vendorman1direxp="$ansexp"
6e1038e0
MB
9265 ;;
9266esac
9267: Use ' ' for none so value is preserved next time through Configure
91e123a8 9268$test X"$vendorman1dir" = "X" && vendorman1dir=' '
a092d240
NC
9269prefixvar=vendorman1dir
9270. ./installprefix
6e1038e0
MB
9271
9272case "$vendorprefix" in
91e123a8
JH
9273'') vendorman3dir=''
9274 vendorman3direxp=''
6e1038e0
MB
9275 ;;
9276*) : determine where vendor-supplied module manual pages go.
91e123a8 9277 case "$vendorman3dir" in
6e1038e0 9278 '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
91e123a8 9279 *) dflt=$vendorman3dir ;;
6e1038e0
MB
9280 esac
9281 case "$dflt" in
9282 ''|' ') dflt=none ;;
9283 esac
9284 fn=nd~+
9285 rp='Pathname for the vendor-supplied manual section 3 pages?'
9286 . ./getfile
91e123a8
JH
9287 vendorman3dir="$ans"
9288 vendorman3direxp="$ansexp"
6e1038e0
MB
9289 ;;
9290esac
9291: Use ' ' for none so value is preserved next time through Configure
91e123a8 9292$test X"$vendorman3dir" = "X" && vendorman3dir=' '
a092d240
NC
9293prefixvar=vendorman3dir
9294. ./installprefix
6e1038e0
MB
9295
9296case "$vendorprefix" in
9297'') d_vendorscript="$undef"
9298 vendorscript=''
9299 vendorscriptexp=''
9300 ;;
9301*) d_vendorscript="$define"
9302 : determine where vendor-supplied scripts go.
9303 case "$vendorscript" in
9304 '') dflt=$vendorprefix/script
9305 $test -d $dflt || dflt=$vendorbin ;;
9306 *) dflt="$vendorscript" ;;
9307 esac
9308 $cat <<EOM
9309
f3f1a2d8 9310The installation process will create a directory for
6e1038e0
MB
9311vendor-supplied scripts.
9312
9313EOM
9314 fn=d~+
9315 rp='Pathname for the vendor-supplied scripts directory?'
9316 . ./getfile
9317 vendorscript="$ans"
9318 vendorscriptexp="$ansexp"
9319 ;;
9320esac
a092d240
NC
9321prefixvar=vendorscript
9322. ./installprefix
6e1038e0 9323
b4eb6b3d
JH
9324: see if qgcvt exists
9325set qgcvt d_qgcvt
9326eval $inlibc
9327
89ce900e
JH
9328echo " "
9329
9330if $test X"$d_longdbl" = X"$define"; then
9331
9332echo "Checking how to print long doubles..." >&4
9333
9334if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9335 $cat >try.c <<'EOCP'
9336#include <sys/types.h>
9337#include <stdio.h>
9338int main() {
9339 double d = 123.456;
9340 printf("%.3f\n", d);
9341}
9342EOCP
9343 set try
9344 if eval $compile; then
9345 yyy=`$run ./try`
9346 case "$yyy" in
9347 123.456)
9348 sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9349 sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9350 echo "We will use %f."
9351 ;;
9352 esac
9353 fi
9354fi
9355
9356if $test X"$sPRIfldbl" = X; then
9357 $cat >try.c <<'EOCP'
9358#include <sys/types.h>
9359#include <stdio.h>
9360int main() {
9361 long double d = 123.456;
9362 printf("%.3Lf\n", d);
9363}
9364EOCP
9365 set try
9366 if eval $compile; then
9367 yyy=`$run ./try`
9368 case "$yyy" in
9369 123.456)
9370 sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9371 sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9372 echo "We will use %Lf."
9373 ;;
9374 esac
9375 fi
9376fi
9377
9378if $test X"$sPRIfldbl" = X; then
9379 $cat >try.c <<'EOCP'
9380#include <sys/types.h>
9381#include <stdio.h>
9382int main() {
9383 long double d = 123.456;
9384 printf("%.3llf\n", d);
9385}
9386EOCP
9387 set try
9388 if eval $compile; then
9389 yyy=`$run ./try`
9390 case "$yyy" in
9391 123.456)
9392 sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9393 sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9394 echo "We will use %llf."
9395 ;;
9396 esac
9397 fi
9398fi
9399
9400if $test X"$sPRIfldbl" = X; then
9401 $cat >try.c <<'EOCP'
9402#include <sys/types.h>
9403#include <stdio.h>
9404int main() {
9405 long double d = 123.456;
9406 printf("%.3lf\n", d);
9407}
9408EOCP
9409 set try
9410 if eval $compile; then
9411 yyy=`$run ./try`
9412 case "$yyy" in
9413 123.456)
9414 sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9415 sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9416 echo "We will use %lf."
9417 ;;
9418 esac
9419 fi
9420fi
9421
9422if $test X"$sPRIfldbl" = X; then
9423 echo "Cannot figure out how to print long doubles." >&4
9424else
9425 sSCNfldbl=$sPRIfldbl # expect consistency
9426fi
9427
5b813a60 9428$rm_try
89ce900e
JH
9429
9430fi # d_longdbl
9431
9432case "$sPRIfldbl" in
5b813a60
MB
9433'') d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9434 d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
89ce900e
JH
9435 d_SCNfldbl="$undef";
9436 ;;
5b813a60
MB
9437*) d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9438 d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
89ce900e
JH
9439 d_SCNfldbl="$define";
9440 ;;
9441esac
9442
b4eb6b3d 9443: Check how to convert floats to strings.
a5b10d80
YST
9444
9445if test "X$d_Gconvert" = X; then
9446
b4eb6b3d
JH
9447echo " "
9448echo "Checking for an efficient way to convert floats to strings."
9449echo " " > try.c
9450case "$uselongdouble" in
9451"$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9452esac
9453case "$d_longdbl" in
9454"$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9455esac
9456case "$d_PRIgldbl" in
9457"$define") echo "#define HAS_PRIgldbl" >>try.c ;;
9458esac
9459$cat >>try.c <<EOP
9460#ifdef TRY_gconvert
9461#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9462char *myname = "gconvert";
9463#endif
9464#ifdef TRY_gcvt
9465#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9466char *myname = "gcvt";
9467#endif
9468#ifdef TRY_qgcvt
9469#define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9470char *myname = "qgcvt";
9471#define DOUBLETYPE long double
9472#endif
9473#ifdef TRY_sprintf
a5b10d80
YST
9474#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9475#ifdef HAS_PRIgldbl
b4eb6b3d
JH
9476#define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9477#else
a5b10d80
YST
9478#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9479#endif
9480#else
b4eb6b3d
JH
9481#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9482#endif
9483char *myname = "sprintf";
9484#endif
9485
9486#ifndef DOUBLETYPE
9487#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9488#define DOUBLETYPE long double
9489#else
9490#define DOUBLETYPE double
9491#endif
9492#endif
9493
9494#include <stdio.h>
9495
9496#define I_STDLIB $i_stdlib
9497#ifdef I_STDLIB
9498#include <stdlib.h>
9499#endif
9500
9501int
9502checkit(expect, got)
9503char *expect;
9504char *got;
9505{
9506 if (strcmp(expect, got)) {
9507 printf("%s oddity: Expected %s, got %s\n",
9508 myname, expect, got);
9509 exit(1);
9510 }
9511}
9512
9513int main()
5b813a60
MB
9514{
9515 char buf[64];
b4eb6b3d
JH
9516 buf[63] = '\0';
9517
9518 /* This must be 1st test on (which?) platform */
9519 /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9520 Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9521 checkit("0.1", buf);
9522
5b813a60 9523 Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
a5b10d80
YST
9524 checkit("0.01", buf);
9525
5b813a60 9526 Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
a5b10d80
YST
9527 checkit("0.001", buf);
9528
5b813a60 9529 Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
a5b10d80
YST
9530 checkit("0.0001", buf);
9531
9532 Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9533 if (strlen(buf) > 5)
9534 checkit("9e-005", buf); /* for Microsoft ?? */
9535 else
9536 checkit("9e-05", buf);
9537
5b813a60 9538 Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
b4eb6b3d
JH
9539 checkit("1", buf);
9540
5b813a60 9541 Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
b4eb6b3d
JH
9542 checkit("1.1", buf);
9543
5b813a60 9544 Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
b4eb6b3d
JH
9545 checkit("1.01", buf);
9546
5b813a60 9547 Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
b4eb6b3d
JH
9548 checkit("1.001", buf);
9549
5b813a60 9550 Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
b4eb6b3d
JH
9551 checkit("1.0001", buf);
9552
5b813a60 9553 Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
b4eb6b3d
JH
9554 checkit("1.00001", buf);
9555
5b813a60 9556 Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
b4eb6b3d
JH
9557 checkit("1.000001", buf);
9558
5b813a60 9559 Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
b4eb6b3d
JH
9560 checkit("0", buf);
9561
5b813a60 9562 Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
b4eb6b3d
JH
9563 checkit("-1", buf);
9564
9565 /* Some Linux gcvt's give 1.e+5 here. */
5b813a60 9566 Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
b4eb6b3d 9567 checkit("100000", buf);
5b813a60 9568
b4eb6b3d 9569 /* Some Linux gcvt's give -1.e+5 here. */
5b813a60 9570 Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
b4eb6b3d
JH
9571 checkit("-100000", buf);
9572
5b813a60 9573 Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
b4eb6b3d
JH
9574 checkit("123.456", buf);
9575
ab6ca9f4 9576 /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
94b339ad
YST
9577 Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9578 /* 34 should be enough to scare even long double
9579 * places into using the e notation. */
ab6ca9f4 9580 if (strlen(buf) > 5)
94b339ad 9581 checkit("1e+034", buf); /* for Microsoft */
ab6ca9f4 9582 else
94b339ad 9583 checkit("1e+34", buf);
8e2a5ede 9584
d1eb8299
YST
9585 /* For Perl, if you add additional tests here, also add them to
9586 * t/base/num.t for benefit of platforms not using Configure or
9587 * overriding d_Gconvert */
9588
b4eb6b3d
JH
9589 exit(0);
9590}
9591EOP
ab6ca9f4 9592: first add preferred functions to our list
a5b10d80 9593xxx_list=""
ab6ca9f4 9594for xxx_convert in $gconvert_preference; do
a5b10d80
YST
9595 case $xxx_convert in
9596 gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
ab6ca9f4 9597 *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
5b813a60 9598 esac
a5b10d80
YST
9599done
9600: then add any others
9601for xxx_convert in gconvert gcvt sprintf; do
9602 case "$xxx_list" in
9603 *$xxx_convert*) ;;
9604 *) xxx_list="$xxx_list $xxx_convert" ;;
5b813a60 9605 esac
a5b10d80
YST
9606done
9607
9608case "$d_longdbl$uselongdouble" in
9609"$define$define")
9610 : again, add prefered functions to our list first
9611 xxx_ld_list=""
ab6ca9f4 9612 for xxx_convert in $gconvert_ld_preference; do
a5b10d80
YST
9613 case $xxx_convert in
9614 qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
ab6ca9f4 9615 *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
a5b10d80
YST
9616 esac
9617 done
9618 : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9619 for xxx_convert in qgcvt sprintf $xxx_list; do
9620 case "$xxx_ld_list" in
9621 $xxx_convert*|*" $xxx_convert"*) ;;
9622 *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9623 esac
9624 done
9625 : if sprintf cannot do long doubles, move it to the end
9626 if test "$d_PRIgldbl" != "$define"; then
9627 xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9628 fi
9629 : if no qgcvt, remove it
9630 if test "$d_qgcvt" != "$define"; then
9631 xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9632 fi
9633 : use the ld_list
9634 xxx_list="$xxx_ld_list"
b4eb6b3d
JH
9635 ;;
9636esac
9637
9638for xxx_convert in $xxx_list; do
9639 echo "Trying $xxx_convert..."
93451a0d 9640 $rm -f try try$_o core
b4eb6b3d
JH
9641 set try -DTRY_$xxx_convert
9642 if eval $compile; then
9643 echo "$xxx_convert() found." >&4
5440bc8e 9644 if $run ./try; then
b4eb6b3d
JH
9645 echo "I'll use $xxx_convert to convert floats into a string." >&4
9646 break;
9647 else
9648 echo "...But $xxx_convert didn't work as I expected."
a5b10d80 9649 xxx_convert=''
b4eb6b3d
JH
9650 fi
9651 else
9652 echo "$xxx_convert NOT found." >&4
9653 fi
9654done
ab6ca9f4 9655
a5b10d80
YST
9656if test X$xxx_convert = X; then
9657 echo "*** WHOA THERE!!! ***" >&4
9658 echo "None of ($xxx_list) seemed to work properly. I'll use sprintf." >&4
9659 xxx_convert=sprintf
9660fi
9661
b4eb6b3d
JH
9662case "$xxx_convert" in
9663gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9664gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9665qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9666*) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9667 "$define$define$define")
9668 d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
a5b10d80
YST
9669 "$define$define$undef")
9670 d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
b4eb6b3d
JH
9671 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9672 esac
5b813a60 9673 ;;
b4eb6b3d
JH
9674esac
9675
a5b10d80 9676fi
93451a0d 9677$rm_try
a5b10d80 9678
74cac757
JH
9679: see if _fwalk exists
9680set fwalk d__fwalk
9681eval $inlibc
9682
b4eb6b3d
JH
9683: Initialize h_fcntl
9684h_fcntl=false
9685
9686: Initialize h_sysfile
9687h_sysfile=false
9688
9689: access call always available on UNIX
9690set access d_access
9691eval $inlibc
9692
9693: locate the flags for 'access()'
9694case "$d_access" in
9695"$define")
9696 echo " "
55954f19 9697 $cat >access.c <<EOCP
b4eb6b3d
JH
9698#include <sys/types.h>
9699#ifdef I_FCNTL
9700#include <fcntl.h>
9701#endif
9702#ifdef I_SYS_FILE
9703#include <sys/file.h>
9704#endif
9705#ifdef I_UNISTD
9706#include <unistd.h>
9707#endif
55954f19
JH
9708#$i_stdlib I_STDLIB
9709#ifdef I_STDLIB
9710#include <stdlib.h>
9711#endif
b4eb6b3d
JH
9712int main() {
9713 exit(R_OK);
9714}
9715EOCP
9716 : check sys/file.h first, no particular reason here
9717 if $test `./findhdr sys/file.h` && \
7a282f6d 9718 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9719 h_sysfile=true;
9720 echo "<sys/file.h> defines the *_OK access constants." >&4
9721 elif $test `./findhdr fcntl.h` && \
7a282f6d 9722 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9723 h_fcntl=true;
9724 echo "<fcntl.h> defines the *_OK access constants." >&4
9725 elif $test `./findhdr unistd.h` && \
7a282f6d 9726 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
b4eb6b3d
JH
9727 echo "<unistd.h> defines the *_OK access constants." >&4
9728 else
9729 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9730 fi
9731 ;;
9732esac
9733$rm -f access*
9734
9735: see if accessx exists
9736set accessx d_accessx
9737eval $inlibc
9738
89ce900e
JH
9739: see if aintl exists
9740set aintl d_aintl
9741eval $inlibc
9742
b4eb6b3d
JH
9743: see if alarm exists
9744set alarm d_alarm
9745eval $inlibc
9746
a9dade78
JH
9747: see if POSIX threads are available
9748set pthread.h i_pthread
9749eval $inhdr
9750
10bc17b6
JH
9751: define a fucntion to check prototypes
9752$cat > protochk <<EOSH
9753$startsh
9754cc="$cc"
9755optimize="$optimize"
9756ccflags="$ccflags"
9757prototype="$prototype"
9758define="$define"
c944cfb9 9759rm_try="$rm_try"
a9dade78
JH
9760usethreads=$usethreads
9761i_pthread=$i_pthread
9762pthread_h_first=$pthread_h_first
10bc17b6
JH
9763EOSH
9764
9765$cat >> protochk <<'EOSH'
9766
5b813a60 9767$rm_try
10bc17b6
JH
9768foo="$1"
9769shift
9770while test $# -ge 2; do
9771 case "$1" in
9772 $define) echo "#include <$2>" >> try.c ;;
9773 literal) echo "$2" >> try.c ;;
9774 esac
cce6a207
MB
9775 # Extra magic for the benefit of systems that need pthread.h
9776 # to be included early to correctly detect threadsafe functions.
9777 # Such functions must guarantee themselves, though, that the usethreads
9778 # and i_pthread have been defined, before calling protochk.
9779 if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9780 echo "#include <pthread.h>" >> try.c
9781 pthread_h_done=yes
9782 fi
10bc17b6
JH
9783 shift 2
9784done
9785test "$prototype" = "$define" && echo '#define CAN_PROTOTYPE' >> try.c
9786cat >> try.c <<'EOCP'
9787#ifdef CAN_PROTOTYPE
9788#define _(args) args
9789#else
9790#define _(args) ()
9791#endif
9792EOCP
9793echo "$foo" >> try.c
9794echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9795$cc $optimize $ccflags -c try.c > /dev/null 2>&1
9796status=$?
5b813a60 9797$rm_try
10bc17b6
JH
9798exit $status
9799EOSH
9800chmod +x protochk
9801$eunicefix protochk
9802
89ce900e
JH
9803hasproto='varname=$1; func=$2; shift; shift;
9804while $test $# -ge 2; do
9805 case "$1" in
9806 $define) echo "#include <$2>";;
9807 esac ;
9808 shift 2;
9809done > try.c;
9810$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9811if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9812 echo "$func() prototype found.";
9813 val="$define";
9814else
9815 echo "$func() prototype NOT found.";
9816 val="$undef";
9817fi;
9818set $varname;
9819eval $setvar;
5b813a60 9820$rm_try tryout.c'
89ce900e 9821
10bc17b6
JH
9822: see if sys/types.h has to be included
9823set sys/types.h i_systypes
9824eval $inhdr
9825
9826: see if sys/select.h has to be included
9827set sys/select.h i_sysselct
9828eval $inhdr
9829
9830hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9831while $test $# -ge 2; do
9832 case "$1" in
9833 $define) echo "#include <$2>";;
9834 esac ;
9835 shift 2;
9836done > try.c;
9837echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9838set try;
9839if eval $compile; then
9840 val="$define";
9841else
9842 val="$undef";
9843fi;
9844set $varname;
9845eval $setvar;
5b813a60 9846$rm_try'
10bc17b6
JH
9847
9848: see if we should include time.h, sys/time.h, or both
9849echo " "
9850if test "X$timeincl" = X; then
9851 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9852 $echo $n "I'm now running the test program...$c"
55954f19 9853 $cat >try.c <<EOCP
10bc17b6
JH
9854#include <sys/types.h>
9855#ifdef I_TIME
9856#include <time.h>
9857#endif
9858#ifdef I_SYSTIME
9859#ifdef SYSTIMEKERNEL
9860#define KERNEL
9861#endif
9862#include <sys/time.h>
9863#endif
9864#ifdef I_SYSSELECT
9865#include <sys/select.h>
9866#endif
55954f19
JH
9867#$i_stdlib I_STDLIB
9868#ifdef I_STDLIB
9869#include <stdlib.h>
9870#endif
10bc17b6
JH
9871int main()
9872{
9873 struct tm foo;
9874#ifdef S_TIMEVAL
9875 struct timeval bar;
9876#endif
9877#ifdef S_TIMEZONE
9878 struct timezone tzp;
9879#endif
9880 if (foo.tm_sec == foo.tm_sec)
9881 exit(0);
9882#ifdef S_TIMEVAL
9883 if (bar.tv_sec == bar.tv_sec)
9884 exit(0);
9885#endif
9886 exit(1);
9887}
9888EOCP
9889 flags=''
9890 for s_timezone in '-DS_TIMEZONE' ''; do
9891 sysselect=''
9892 for s_timeval in '-DS_TIMEVAL' ''; do
9893 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9894 for i_time in '' '-DI_TIME'; do
9895 for i_systime in '-DI_SYSTIME' ''; do
9896 case "$flags" in
9897 '') $echo $n ".$c"
9898 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9899 if eval $compile; then
9900 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9901 shift
9902 flags="$*"
9903 echo " "
9904 $echo $n "Succeeded with $flags$c"
9905 fi
9906 ;;
9907 esac
9908 done
9909 done
9910 done
9911 done
9912 done
9913 timeincl=''
9914 echo " "
9915 case "$flags" in
9916 *SYSTIMEKERNEL*) i_systimek="$define"
9917 timeincl=`./findhdr sys/time.h`
9918 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9919 *) i_systimek="$undef";;
9920 esac
9921 case "$flags" in
9922 *I_TIME*) i_time="$define"
9923 timeincl=`./findhdr time.h`" $timeincl"
9924 echo "We'll include <time.h>." >&4;;
9925 *) i_time="$undef";;
9926 esac
9927 case "$flags" in
9928 *I_SYSTIME*) i_systime="$define"
9929 timeincl=`./findhdr sys/time.h`" $timeincl"
9930 echo "We'll include <sys/time.h>." >&4;;
9931 *) i_systime="$undef";;
9932 esac
5b813a60 9933 $rm_try
10bc17b6
JH
9934fi
9935: see if struct tm knows about tm_zone
9936case "$i_systime$i_time" in
5b813a60 9937*$define*)
10bc17b6
JH
9938 echo " "
9939 echo "Checking to see if your struct tm has tm_zone field..." >&4
9940 set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9941 eval $hasfield
9942 ;;
9943*) val="$undef"
9944 set d_tm_tm_zone
9945 eval $setvar
9946 ;;
9947esac
9948case "$d_tm_tm_zone" in
9949"$define") echo "Yes, it does." ;;
9950*) echo "No, it doesn't." ;;
9951esac
9952: see if struct tm knows about tm_gmtoff
9953case "$i_systime$i_time" in
5b813a60 9954*$define*)
10bc17b6
JH
9955 echo " "
9956 echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9957 set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9958 eval $hasfield
9959 ;;
9960*) val="$undef"
9961 set d_tm_tm_gmtoff
9962 eval $setvar
9963 ;;
9964esac
9965case "$d_tm_tm_gmtoff" in
9966"$define") echo "Yes, it does." ;;
9967*) echo "No, it doesn't." ;;
9968esac
9969
9970: see if asctime_r exists
9971set asctime_r d_asctime_r
9972eval $inlibc
9973case "$d_asctime_r" in
9974"$define")
d63eadf0 9975 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
9976 case "$d_asctime_r_proto:$usethreads" in
9977 ":define") d_asctime_r_proto=define
a48ec845
JH
9978 set d_asctime_r_proto asctime_r $hdrs
9979 eval $hasproto ;;
9980 *) ;;
9981 esac
9982 case "$d_asctime_r_proto" in
9983 define)
10bc17b6
JH
9984 case "$asctime_r_proto" in
9985 ''|0) try='char* asctime_r(const struct tm*, char*);'
9986 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9987 esac
9988 case "$asctime_r_proto" in
9989 ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9990 ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9991 esac
9992 case "$asctime_r_proto" in
9993 ''|0) try='int asctime_r(const struct tm*, char*);'
9994 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9995 esac
9996 case "$asctime_r_proto" in
9997 ''|0) try='int asctime_r(const struct tm*, char*, int);'
9998 ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9999 esac
10000 case "$asctime_r_proto" in
90e831dc 10001 ''|0) d_asctime_r=undef
10bc17b6 10002 asctime_r_proto=0
a48ec845 10003 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
10004 * ) case "$asctime_r_proto" in
10005 REENTRANT_PROTO*) ;;
10006 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10007 esac
10008 echo "Prototype: $try" ;;
10009 esac
10010 ;;
c18e646a
JH
10011 *) case "$usethreads" in
10012 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10013 esac
90e831dc
SB
10014 d_asctime_r=undef
10015 asctime_r_proto=0
c18e646a 10016 ;;
a48ec845
JH
10017 esac
10018 ;;
10bc17b6
JH
10019*) asctime_r_proto=0
10020 ;;
10021esac
10022
b4eb6b3d
JH
10023: see if atolf exists
10024set atolf d_atolf
10025eval $inlibc
10026
10027: see if atoll exists
10028set atoll d_atoll
10029eval $inlibc
10030
0dbb1585
AL
10031: Look for GCC-style attribute format
10032case "$d_attribute_format" in
bde30f85 10033'')
b4eb6b3d 10034echo " "
0dbb1585 10035echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
b4eb6b3d
JH
10036$cat >attrib.c <<'EOCP'
10037#include <stdio.h>
0dbb1585 10038void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
b4eb6b3d
JH
10039EOCP
10040if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10041 if $contains 'warning' attrib.out >/dev/null 2>&1; then
0dbb1585 10042 echo "Your C compiler doesn't support __attribute__((format))."
b4eb6b3d
JH
10043 val="$undef"
10044 else
0dbb1585 10045 echo "Your C compiler supports __attribute__((format))."
b4eb6b3d
JH
10046 val="$define"
10047 fi
10048else
10049 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10050 val="$undef"
10051fi
bde30f85 10052;;
0dbb1585 10053*) val="$d_attribute_format" ;;
bde30f85 10054esac
0dbb1585
AL
10055set d_attribute_format
10056eval $setvar
10057$rm -f attrib*
10058
dcb594bc
MB
10059: Look for GCC-style attribute format with null format allowed
10060case "$d_printf_format_null" in
10061'') case "$d_attribute_format" in
10062 $define)
10063 echo " "
10064 echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10065$cat >attrib.c <<EOCP
10066#include <stdio.h>
10067#$i_stdlib I_STDLIB
10068#ifdef I_STDLIB
10069#include <stdlib.h>
10070#endif
10071int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10072int null_printf (char* pat,...) { return (int)pat; }
10073int main () { exit(null_printf(NULL)); }
10074EOCP
10075 if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10076 : run the executable in case it produces a run-time warning
10077 if $run ./attrib >>attrib.out 2>&1; then
10078 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10079 echo "Your C compiler doesn't allow __printf__ format to be null."
10080 val="$undef"
10081 else
10082 echo "Your C compiler allows __printf__ format to be null."
10083 val="$define"
10084 fi
10085 else
10086 echo "Your C compiler executable failed with __printf__ format null."
10087 val="$undef"
10088 fi
10089 else
10090 echo "Your C compiler fails with __printf__ format null."
10091 val="$undef"
10092 fi
10093 ;;
10094 *) val="$undef" ;;
10095 esac
10096;;
10097*) val="$d_printf_format_null" ;;
10098esac
10099set d_printf_format_null
10100eval $setvar
10101$rm -f attrib*
10102
0dbb1585
AL
10103: Look for GCC-style attribute malloc
10104case "$d_attribute_malloc" in
10105'')
10106echo " "
10107echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10108$cat >attrib.c <<'EOCP'
10109#include <stdio.h>
10110char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10111EOCP
10112if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10113 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10114 echo "Your C compiler doesn't support __attribute__((malloc))."
10115 val="$undef"
10116 else
10117 echo "Your C compiler supports __attribute__((malloc))."
10118 val="$define"
10119 fi
10120else
10121 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10122 val="$undef"
10123fi
10124;;
10125*) val="$d_attribute_malloc" ;;
10126esac
10127set d_attribute_malloc
10128eval $setvar
10129$rm -f attrib*
10130
10131: Look for GCC-style attribute nonnull
10132case "$d_attribute_nonnull" in
10133'')
10134echo " "
10135echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10136$cat >attrib.c <<'EOCP'
10137#include <stdio.h>
10138void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10139EOCP
10140if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10141 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10142 echo "Your C compiler doesn't support __attribute__((nonnull))."
10143 val="$undef"
10144 else
10145 echo "Your C compiler supports __attribute__((nonnull))."
10146 val="$define"
10147 fi
10148else
10149 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10150 val="$undef"
10151fi
10152;;
10153*) val="$d_attribute_nonnull" ;;
10154esac
10155set d_attribute_nonnull
10156eval $setvar
10157$rm -f attrib*
10158
10159: Look for GCC-style attribute noreturn
10160case "$d_attribute_noreturn" in
10161'')
10162echo " "
10163echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10164$cat >attrib.c <<'EOCP'
10165#include <stdio.h>
10166void fall_over_dead( void ) __attribute__((noreturn));
10167EOCP
10168if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10169 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10170 echo "Your C compiler doesn't support __attribute__((noreturn))."
10171 val="$undef"
10172 else
10173 echo "Your C compiler supports __attribute__((noreturn))."
10174 val="$define"
10175 fi
10176else
10177 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10178 val="$undef"
10179fi
10180;;
10181*) val="$d_attribute_noreturn" ;;
10182esac
10183set d_attribute_noreturn
10184eval $setvar
10185$rm -f attrib*
10186
10187: Look for GCC-style attribute pure
10188case "$d_attribute_pure" in
10189'')
10190echo " "
10191echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10192$cat >attrib.c <<'EOCP'
10193#include <stdio.h>
10194int square( int n ) __attribute__((pure));
10195EOCP
10196if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10197 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10198 echo "Your C compiler doesn't support __attribute__((pure))."
10199 val="$undef"
10200 else
10201 echo "Your C compiler supports __attribute__((pure))."
10202 val="$define"
10203 fi
10204else
10205 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10206 val="$undef"
10207fi
10208;;
10209*) val="$d_attribute_pure" ;;
10210esac
10211set d_attribute_pure
10212eval $setvar
10213$rm -f attrib*
10214
10215: Look for GCC-style attribute unused
10216case "$d_attribute_unused" in
10217'')
10218echo " "
10219echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10220$cat >attrib.c <<'EOCP'
10221#include <stdio.h>
10222int do_something( int dummy __attribute__((unused)), int n );
10223EOCP
10224if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10225 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10226 echo "Your C compiler doesn't support __attribute__((unused))."
10227 val="$undef"
10228 else
10229 echo "Your C compiler supports __attribute__((unused))."
10230 val="$define"
10231 fi
10232else
10233 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10234 val="$undef"
10235fi
10236;;
10237*) val="$d_attribute_unused" ;;
10238esac
10239set d_attribute_unused
10240eval $setvar
10241$rm -f attrib*
10242
10243: Look for GCC-style attribute warn_unused_result
10244case "$d_attribute_warn_unused_result" in
10245'')
10246echo " "
10247echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10248$cat >attrib.c <<'EOCP'
10249#include <stdio.h>
10250int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10251EOCP
10252if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10253 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10254 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10255 val="$undef"
10256 else
10257 echo "Your C compiler supports __attribute__((warn_unused_result))."
10258 val="$define"
10259 fi
10260else
10261 echo "Your C compiler doesn't seem to understand __attribute__ at all."
10262 val="$undef"
10263fi
10264;;
10265*) val="$d_attribute_warn_unused_result" ;;
10266esac
10267set d_attribute_warn_unused_result
b4eb6b3d
JH
10268eval $setvar
10269$rm -f attrib*
10270
10271: see if bcmp exists
10272set bcmp d_bcmp
10273eval $inlibc
10274
10275: see if bcopy exists
10276set bcopy d_bcopy
10277eval $inlibc
10278
b4eb6b3d
JH
10279: see if getpgrp exists
10280set getpgrp d_getpgrp
10281eval $inlibc
10282
10283case "$d_getpgrp" in
10284"$define")
10285 echo " "
10286 echo "Checking to see which flavor of getpgrp is in use..."
5440bc8e 10287 $cat >try.c <<EOP
b4eb6b3d
JH
10288#$i_unistd I_UNISTD
10289#include <sys/types.h>
10290#ifdef I_UNISTD
10291# include <unistd.h>
10292#endif
55954f19
JH
10293#$i_stdlib I_STDLIB
10294#ifdef I_STDLIB
10295#include <stdlib.h>
10296#endif
b4eb6b3d
JH
10297int main()
10298{
10299 if (getuid() == 0) {
10300 printf("(I see you are running Configure as super-user...)\n");
10301 setuid(1);
10302 }
10303#ifdef TRY_BSD_PGRP
10304 if (getpgrp(1) == 0)
10305 exit(0);
10306#else
10307 if (getpgrp() > 0)
10308 exit(0);
10309#endif
10310 exit(1);
10311}
10312EOP
5440bc8e 10313 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10314 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10315 val="$define"
5440bc8e 10316 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10317 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10318 val="$undef"
10319 else
10320 echo "I can't seem to compile and run the test program."
10321 if ./usg; then
10322 xxx="a USG one, i.e. you use getpgrp()."
10323 else
10324 # SVR4 systems can appear rather BSD-ish.
10325 case "$i_unistd" in
10326 $undef)
10327 xxx="a BSD one, i.e. you use getpgrp(pid)."
10328 val="$define"
10329 ;;
10330 $define)
10331 xxx="probably a USG one, i.e. you use getpgrp()."
10332 val="$undef"
10333 ;;
10334 esac
10335 fi
10336 echo "Assuming your getpgrp is $xxx" >&4
10337 fi
10338 ;;
10339*) val="$undef";;
10340esac
10341set d_bsdgetpgrp
10342eval $setvar
5b813a60 10343$rm_try
b4eb6b3d
JH
10344
10345: see if setpgrp exists
10346set setpgrp d_setpgrp
10347eval $inlibc
10348
10349case "$d_setpgrp" in
10350"$define")
10351 echo " "
10352 echo "Checking to see which flavor of setpgrp is in use..."
5440bc8e 10353 $cat >try.c <<EOP
b4eb6b3d
JH
10354#$i_unistd I_UNISTD
10355#include <sys/types.h>
10356#ifdef I_UNISTD
10357# include <unistd.h>
10358#endif
55954f19
JH
10359#$i_stdlib I_STDLIB
10360#ifdef I_STDLIB
10361#include <stdlib.h>
10362#endif
b4eb6b3d
JH
10363int main()
10364{
10365 if (getuid() == 0) {
10366 printf("(I see you are running Configure as super-user...)\n");
10367 setuid(1);
10368 }
10369#ifdef TRY_BSD_PGRP
10370 if (-1 == setpgrp(1, 1))
10371 exit(0);
10372#else
10373 if (setpgrp() != -1)
10374 exit(0);
10375#endif
10376 exit(1);
10377}
10378EOP
5440bc8e 10379 if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10380 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10381 val="$define"
5440bc8e 10382 elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
b4eb6b3d
JH
10383 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10384 val="$undef"
10385 else
10386 echo "(I can't seem to compile and run the test program.)"
10387 if ./usg; then
10388 xxx="a USG one, i.e. you use setpgrp()."
10389 else
10390 # SVR4 systems can appear rather BSD-ish.
10391 case "$i_unistd" in
10392 $undef)
10393 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10394 val="$define"
10395 ;;
10396 $define)
10397 xxx="probably a USG one, i.e. you use setpgrp()."
10398 val="$undef"
10399 ;;
10400 esac
10401 fi
10402 echo "Assuming your setpgrp is $xxx" >&4
10403 fi
10404 ;;
10405*) val="$undef";;
10406esac
10407set d_bsdsetpgrp
10408eval $setvar
5b813a60
MB
10409$rm_try
10410
635aebb7
AL
10411: Look for GCC-style __builtin_choose_expr
10412case "$d_builtin_choose_expr" in
10413'')
10414 echo " "
10415 echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10416 $cat >try.c <<'EOCP'
10417#include <assert.h>
10418#include <stdlib.h>
10419#include <stdio.h>
10420
10421#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10422
10423int main(void) {
10424 assert( SYRINX(1) == 2112 );
10425 assert( SYRINX(1) != 5150 );
10426 assert( SYRINX(0) == 5150 );
10427 assert( SYRINX(0) != 2112 );
10428 puts( "All good!" );
10429 exit(0);
10430}
10431
10432EOCP
10433 set try
10434 if eval $compile; then
10435 echo "Your C compiler supports __builtin_choose_expr."
10436 val="$define"
10437 else
10438 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10439 val="$undef"
10440 fi
10441;;
10442*) val="$d_builtin_choose_expr" ;;
10443esac
10444
10445set d_builtin_choose_expr
10446eval $setvar
5b813a60 10447$rm_try
635aebb7
AL
10448
10449: Look for GCC-style __builtin_expect
10450case "$d_builtin_expect" in
10451'')
10452 echo " "
10453 echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10454 $cat >builtin.c <<'EOCP'
10455int main(void) {
10456 int n = 50;
10457 if ( __builtin_expect(n, 0) ) n = 1;
10458}
10459EOCP
10460 set try
10461 if eval $compile; then
10462 echo "Your C compiler supports __builtin_choose_expr."
10463 val="$define"
10464 else
10465 echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10466 val="$undef"
10467 fi
10468 ;;
10469*) val="$d_builtin_expect" ;;
10470esac
10471
10472set d_builtin_expect
10473eval $setvar
5b813a60 10474$rm_try
635aebb7 10475
b4eb6b3d
JH
10476: see if bzero exists
10477set bzero d_bzero
10478eval $inlibc
10479
a2d23ec2
MB
10480: see if stdarg is available
10481echo " "
10482if $test `./findhdr stdarg.h`; then
10483 echo "<stdarg.h> found." >&4
10484 valstd="$define"
10485else
10486 echo "<stdarg.h> NOT found." >&4
10487 valstd="$undef"
10488fi
10489
10490: see if varags is available
10491echo " "
10492if $test `./findhdr varargs.h`; then
10493 echo "<varargs.h> found." >&4
10494else
10495 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10496fi
10497
10498: set up the varargs testing programs
10499$cat > varargs.c <<EOP
10500#ifdef I_STDARG
10501#include <stdarg.h>
10502#endif
10503#ifdef I_VARARGS
10504#include <varargs.h>
10505#endif
10506
10507#ifdef I_STDARG
10508int f(char *p, ...)
10509#else
10510int f(va_alist)
10511va_dcl
10512#endif
10513{
10514 va_list ap;
10515#ifndef I_STDARG
10516 char *p;
10517#endif
10518#ifdef I_STDARG
10519 va_start(ap,p);
10520#else
10521 va_start(ap);
10522 p = va_arg(ap, char *);
10523#endif
10524 va_end(ap);
4fb7dc7d 10525 return 0;
a2d23ec2
MB
10526}
10527EOP
10528$cat > varargs <<EOP
10529$startsh
10530if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10531 echo "true"
10532else
10533 echo "false"
10534fi
10535$rm -f varargs$_o
10536EOP
10537chmod +x varargs
10538
10539: now check which varargs header should be included
10540echo " "
10541i_varhdr=''
10542case "$valstd" in
10543"$define")
10544 if `./varargs I_STDARG`; then
10545 val='stdarg.h'
10546 elif `./varargs I_VARARGS`; then
10547 val='varargs.h'
10548 fi
10549 ;;
10550*)
10551 if `./varargs I_VARARGS`; then
10552 val='varargs.h'
10553 fi
10554 ;;
10555esac
10556case "$val" in
10557'')
10558echo "I could not find the definition for va_dcl... You have problems..." >&4
10559 val="$undef"; set i_stdarg; eval $setvar
10560 val="$undef"; set i_varargs; eval $setvar
10561 ;;
10562*)
10563 set i_varhdr
10564 eval $setvar
10565 case "$i_varhdr" in
10566 stdarg.h)
10567 val="$define"; set i_stdarg; eval $setvar
10568 val="$undef"; set i_varargs; eval $setvar
10569 ;;
10570 varargs.h)
10571 val="$undef"; set i_stdarg; eval $setvar
10572 val="$define"; set i_varargs; eval $setvar
10573 ;;
10574 esac
10575 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10576esac
10577$rm -f varargs*
10578
10579: see if the Compiler supports C99 variadic macros
10580case "$i_stdarg$i_stdlib" in
10581 "$define$define")
10582 echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10583 $cat >try.c <<EOCP
10584#include <stdio.h>
10585#include <stdarg.h>
10586
10587#define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10588
10589int main() {
10590 char buf[20];
10591 foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10592 puts(buf);
10593 return 0;
10594}
10595EOCP
10596 set try
10597 if eval $compile && $run ./try 2>&1 >/dev/null; then
10598 case "`$run ./try`" in
10599 "123 456 789")
10600 echo "You have C99 variadic macros." >&4
10601 d_c99_variadic_macros="$define"
10602 ;;
10603 *)
10604 echo "You don't have functional C99 variadic macros." >&4
10605 d_c99_variadic_macros="$undef"
10606 ;;
10607 esac
10608 else
10609 echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10610 d_c99_variadic_macros="$undef"
10611 fi
5b813a60 10612 $rm_try
a2d23ec2
MB
10613 ;;
10614 *)
10615 echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10616 d_c99_variadic_macros="$undef"
10617 ;;
10618esac
10619
b4eb6b3d
JH
10620: see if signal is declared as pointer to function returning int or void
10621echo " "
10622xxx=`./findhdr signal.h`
10623$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10624if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10625 echo "You have int (*signal())() instead of void." >&4
10626 val="$undef"
10627elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
10628 echo "You have void (*signal())()." >&4
10629 val="$define"
10630elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10631 echo "You have int (*signal())() instead of void." >&4
10632 val="$undef"
10633elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10634 echo "You have void (*signal())()." >&4
10635 val="$define"
10636else
10637 case "$d_voidsig" in
10638 '')
10639 echo "I can't determine whether signal handler returns void or int..." >&4
10640 dflt=void
10641 rp="What type does your signal handler return?"
10642 . ./myread
10643 case "$ans" in
10644 v*) val="$define";;
10645 *) val="$undef";;
10646 esac;;
10647 "$define")
10648 echo "As you already told me, signal handler returns void." >&4
10649 val="$define"
10650 ;;
10651 *) echo "As you already told me, signal handler returns int." >&4
10652 val="$undef"
10653 ;;
10654 esac
10655fi
10656set d_voidsig
10657eval $setvar
10658case "$d_voidsig" in
10659"$define") signal_t="void";;
10660*) signal_t="int";;
10661esac
10662$rm -f $$.tmp
10663
10664: check for ability to cast large floats to 32-bit ints.
10665echo " "
10666echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10667if $test "$intsize" -ge 4; then
10668 xxx=int
10669else
10670 xxx=long
10671fi
10672$cat >try.c <<EOCP
10673#include <stdio.h>
d1daaddf
JH
10674#$i_stdlib I_STDLIB
10675#ifdef I_STDLIB
10676#include <stdlib.h>
10677#endif
b4eb6b3d
JH
10678#include <sys/types.h>
10679#include <signal.h>
7090f861 10680$signal_t blech(int s) { exit(3); }
b4eb6b3d
JH
10681int main()
10682{
10683 $xxx i32;
10684 double f, g;
10685 int result = 0;
10686 char str[16];
10687 signal(SIGFPE, blech);
10688
5b813a60 10689 /* Don't let compiler optimize the test away. Store the number
b4eb6b3d
JH
10690 in a writable string for gcc to pass to sscanf under HP/UX.
10691 */
10692 sprintf(str, "2147483647");
10693 sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10694 g = 10 * f;
10695 i32 = ($xxx) g;
10696
10697 /* x86 processors will probably give 0x8000 0000, which is a
4a39fcde 10698 sign change. We don't want that. We want to mimic SPARC
b4eb6b3d
JH
10699 behavior here, which is to preserve the sign and give
10700 back 0x7fff ffff.
10701 */
10702 if (i32 != ($xxx) f)
10703 result |= 1;
10704 exit(result);
10705}
10706EOCP
10707set try
10708if eval $compile_ok; then
5440bc8e 10709 $run ./try
b4eb6b3d
JH
10710 yyy=$?
10711else
10712 echo "(I can't seem to compile the test program--assuming it can't)"
10713 yyy=1
10714fi
10715case "$yyy" in
107160) val="$define"
10717 echo "Yup, it can."
10718 ;;
10719*) val="$undef"
10720 echo "Nope, it can't."
10721 ;;
10722esac
10723set d_casti32
10724eval $setvar
5b813a60 10725$rm_try
b4eb6b3d
JH
10726
10727: check for ability to cast negative floats to unsigned
10728echo " "
10729echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10730$cat >try.c <<EOCP
10731#include <stdio.h>
d1daaddf
JH
10732#$i_stdlib I_STDLIB
10733#ifdef I_STDLIB
10734#include <stdlib.h>
10735#endif
b4eb6b3d
JH
10736#include <sys/types.h>
10737#include <signal.h>
7090f861
JH
10738$signal_t blech(int s) { exit(7); }
10739$signal_t blech_in_list(int s) { exit(4); }
10740unsigned long dummy_long(unsigned long p) { return p; }
10741unsigned int dummy_int(unsigned int p) { return p; }
10742unsigned short dummy_short(unsigned short p) { return p; }
b4eb6b3d
JH
10743int main()
10744{
10745 double f;
10746 unsigned long along;
10747 unsigned int aint;
10748 unsigned short ashort;
10749 int result = 0;
10750 char str[16];
5b813a60 10751
b4eb6b3d
JH
10752 /* Frustrate gcc-2.7.2's optimizer which failed this test with
10753 a direct f = -123. assignment. gcc-2.8.0 reportedly
10754 optimized the whole file away
10755 */
5b813a60 10756 /* Store the number in a writable string for gcc to pass to
b4eb6b3d
JH
10757 sscanf under HP/UX.
10758 */
10759 sprintf(str, "-123");
10760 sscanf(str, "%lf", &f); /* f = -123.; */
10761
10762 signal(SIGFPE, blech);
10763 along = (unsigned long)f;
10764 aint = (unsigned int)f;
10765 ashort = (unsigned short)f;
10766 if (along != (unsigned long)-123)
10767 result |= 1;
10768 if (aint != (unsigned int)-123)
10769 result |= 1;
10770 if (ashort != (unsigned short)-123)
10771 result |= 1;
10772 sprintf(str, "1073741824.");
10773 sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10774 f = f + f;
10775 along = 0;
10776 along = (unsigned long)f;
10777 if (along != 0x80000000)
10778 result |= 2;
10779 f -= 1.;
10780 along = 0;
10781 along = (unsigned long)f;
10782 if (along != 0x7fffffff)
10783 result |= 1;
10784 f += 2.;
10785 along = 0;
10786 along = (unsigned long)f;
10787 if (along != 0x80000001)
10788 result |= 2;
10789 if (result)
10790 exit(result);
10791 signal(SIGFPE, blech_in_list);
10792 sprintf(str, "123.");
10793 sscanf(str, "%lf", &f); /* f = 123.; */
10794 along = dummy_long((unsigned long)f);
10795 aint = dummy_int((unsigned int)f);
10796 ashort = dummy_short((unsigned short)f);
10797 if (along != (unsigned long)123)
10798 result |= 4;
10799 if (aint != (unsigned int)123)
10800 result |= 4;
10801 if (ashort != (unsigned short)123)
10802 result |= 4;
10803 exit(result);
10804
10805}
10806EOCP
10807set try
10808if eval $compile_ok; then
5440bc8e 10809 $run ./try
b4eb6b3d
JH
10810 castflags=$?
10811else
10812 echo "(I can't seem to compile the test program--assuming it can't)"
10813 castflags=7
10814fi
10815case "$castflags" in
108160) val="$define"
10817 echo "Yup, it can."
10818 ;;
10819*) val="$undef"
10820 echo "Nope, it can't."
10821 ;;
10822esac
10823set d_castneg
10824eval $setvar
5b813a60 10825$rm_try
b4eb6b3d
JH
10826
10827: see if vprintf exists
10828echo " "
10829if set vprintf val -f d_vprintf; eval $csym; $val; then
10830 echo 'vprintf() found.' >&4
10831 val="$define"
55954f19 10832 $cat >try.c <<EOF
d0bc9cc8
AD
10833#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
10834#$i_varargs I_VARARGS
10835
55954f19 10836#$i_stdlib I_STDLIB
d0bc9cc8
AD
10837#$i_unistd I_UNISTD
10838
10839#ifdef I_STDARG
10840# include <stdarg.h>
10841#else /* I_VARARGS */
10842# include <varargs.h>
10843#endif
10844
10845#ifdef I_UNISTD
10846# include <unistd.h>
10847#endif
10848
55954f19 10849#ifdef I_STDLIB
d0bc9cc8 10850# include <stdlib.h>
55954f19 10851#endif
b4eb6b3d 10852
d0bc9cc8
AD
10853#include <stdio.h> /* vsprintf prototype */
10854
10855#ifdef I_STDARG
10856void xxx(int n, ...)
10857{
10858 va_list args;
10859 char buf[10];
10860 va_start(args, n);
10861 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10862}
10863int main() { xxx(1, "foo"); }
10864
10865#else /* I_VARARGS */
b4eb6b3d
JH
10866
10867xxx(va_alist)
10868va_dcl
10869{
d0bc9cc8
AD
10870 va_list args;
10871 char buf[10];
10872 va_start(args);
10873 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
b4eb6b3d 10874}
d0bc9cc8
AD
10875int main() { xxx("foo"); }
10876
10877#endif
10878
b4eb6b3d 10879EOF
5440bc8e 10880 set try
d0bc9cc8
AD
10881 if eval $compile_ok; then
10882 if $run ./try; then
10883 echo "Your vsprintf() returns (int)." >&4
10884 val2="$undef"
10885 else
10886 echo "Your vsprintf() returns (char*)." >&4
10887 val2="$define"
10888 fi
b4eb6b3d 10889 else
d0bc9cc8
AD
10890 echo 'I am unable to compile the vsprintf() test program.' >&4
10891 # We shouldn't get here. If we do, assume the standard signature,
10892 # not the old BSD one.
10893 echo 'Guessing that vsprintf() returns (int).' >&4
10894 val2="$undef"
b4eb6b3d
JH
10895 fi
10896else
10897 echo 'vprintf() NOT found.' >&4
d0bc9cc8
AD
10898 val="$undef"
10899 val2="$undef"
b4eb6b3d 10900fi
5b813a60 10901$rm_try
b4eb6b3d
JH
10902set d_vprintf
10903eval $setvar
10904val=$val2
10905set d_charvspr
10906eval $setvar
10907
10908: see if chown exists
10909set chown d_chown
10910eval $inlibc
10911
10912: see if chroot exists
10913set chroot d_chroot
10914eval $inlibc
10915
10916: see if chsize exists
10917set chsize d_chsize
10918eval $inlibc
10919
758a5d79
JH
10920: see if class exists
10921set class d_class
10922eval $inlibc
10923
b0a2e8e6
MB
10924: see if clearenv exists
10925set clearenv d_clearenv
10926eval $inlibc
10927
4e0554ec
JH
10928hasstruct='varname=$1; struct=$2; shift; shift;
10929while $test $# -ge 2; do
10930 case "$1" in
10931 $define) echo "#include <$2>";;
10932 esac ;
10933 shift 2;
10934done > try.c;
10935echo "int main () { struct $struct foo; }" >> try.c;
10936set try;
10937if eval $compile; then
10938 val="$define";
10939else
10940 val="$undef";
10941fi;
10942set $varname;
10943eval $setvar;
5b813a60 10944$rm_try'
4e0554ec 10945
4e0554ec
JH
10946socketlib=''
10947sockethdr=''
10948: see whether socket exists
10949echo " "
10950$echo $n "Hmm... $c" >&4
10951if set socket val -f d_socket; eval $csym; $val; then
10952 echo "Looks like you have Berkeley networking support." >&4
10953 d_socket="$define"
10954 if set setsockopt val -f; eval $csym; $val; then
10955 d_oldsock="$undef"
10956 else
10957 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10958 d_oldsock="$define"
10959 fi
10960else
10961 if $contains socklib libc.list >/dev/null 2>&1; then
10962 echo "Looks like you have Berkeley networking support." >&4
10963 d_socket="$define"
10964 : we will have to assume that it supports the 4.2 BSD interface
10965 d_oldsock="$undef"
10966 else
10967 echo "You don't have Berkeley networking in libc$_a..." >&4
10968 if test "X$d_socket" = "X$define"; then
10969 echo "...but you seem to believe that you have sockets." >&4
10970 else
10971 for net in net socket
10972 do
10973 if test -f /usr/lib/lib$net$_a; then
10974 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
10975 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10976 if $contains socket libc.list >/dev/null 2>&1; then
10977 d_socket="$define"
10978 socketlib="-l$net"
10979 case "$net" in
10980 net)
10981 echo "...but the Wollongong group seems to have hacked it in." >&4
10982 sockethdr="-I/usr/netinclude"
10983 ;;
10984 esac
5b813a60 10985 echo "Found Berkeley sockets interface in lib$net." >&4
4e0554ec
JH
10986 if $contains setsockopt libc.list >/dev/null 2>&1; then
10987 d_oldsock="$undef"
10988 else
10989 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10990 d_oldsock="$define"
10991 fi
10992 break
10993 fi
10994 fi
10995 done
10996 if test "X$d_socket" != "X$define"; then
10997 echo "or anywhere else I see." >&4
10998 d_socket="$undef"
10999 d_oldsock="$undef"
11000 fi
11001 fi
11002 fi
11003fi
11004
11005: see if socketpair exists
11006set socketpair d_sockpair
11007eval $inlibc
11008
11009
11010echo " "
3c728e00 11011echo "Checking the availability of certain socket constants..." >&4
4e0554ec
JH
11012for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11013 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11014 $cat >try.c <<EOF
11015#include <sys/types.h>
11016#include <sys/socket.h>
11017int main() {
11018 int i = $ENUM;
11019}
11020EOF
11021 val="$undef"
11022 set try; if eval $compile; then
11023 val="$define"
11024 fi
11025 set d_${enum}; eval $setvar
5b813a60 11026 $rm_try
4e0554ec
JH
11027done
11028
11029: see if this is a sys/uio.h system
11030set sys/uio.h i_sysuio
11031eval $inhdr
11032
11033
11034echo " "
11035echo "Checking to see if your system supports struct cmsghdr..." >&4
11036set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11037eval $hasstruct
11038case "$d_cmsghdr_s" in
11039"$define") echo "Yes, it does." ;;
11040*) echo "No, it doesn't." ;;
11041esac
11042
11043
b4eb6b3d
JH
11044: check for const keyword
11045echo " "
11046echo 'Checking to see if your C compiler knows about "const"...' >&4
11047$cat >const.c <<'EOCP'
11048typedef struct spug { int drokk; } spug;
76f47787 11049int main()
b4eb6b3d
JH
11050{
11051 const char *foo;
666ea192 11052 const spug y = { 0 };
b4eb6b3d
JH
11053}
11054EOCP
11055if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11056 val="$define"
11057 echo "Yup, it does."
11058else
11059 val="$undef"
11060 echo "Nope, it doesn't."
11061fi
11062set d_const
11063eval $setvar
11064
89ce900e
JH
11065: see if copysignl exists
11066set copysignl d_copysignl
11067eval $inlibc
11068
b4eb6b3d
JH
11069: see if crypt exists
11070echo " "
a5a94ea5
JH
11071set crypt d_crypt
11072eval $inlibc
11073case "$d_crypt" in
11074$define) cryptlib='' ;;
11075*) if set crypt val -f d_crypt; eval $csym; $val; then
11076 echo 'crypt() found.' >&4
b4eb6b3d 11077 val="$define"
a5a94ea5
JH
11078 cryptlib=''
11079 else
11080 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11081 if $test -z "$cryptlib"; then
11082 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11083 else
11084 cryptlib=-lcrypt
11085 fi
11086 if $test -z "$cryptlib"; then
11087 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11088 else
11089 cryptlib=-lcrypt
11090 fi
11091 if $test -z "$cryptlib"; then
11092 cryptlib=`./loc libcrypt$_a "" $libpth`
11093 else
11094 cryptlib=-lcrypt
11095 fi
11096 if $test -z "$cryptlib"; then
11097 echo 'crypt() NOT found.' >&4
11098 val="$undef"
11099 else
11100 val="$define"
11101 fi
b4eb6b3d 11102 fi
a5a94ea5
JH
11103 set d_crypt
11104 eval $setvar
11105 ;;
11106esac
b4eb6b3d 11107
10bc17b6
JH
11108: see if this is a crypt.h system
11109set crypt.h i_crypt
11110eval $inhdr
11111
11112: see if crypt_r exists
11113set crypt_r d_crypt_r
11114eval $inlibc
11115case "$d_crypt_r" in
11116"$define")
11117 hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
c18e646a
JH
11118 case "$d_crypt_r_proto:$usethreads" in
11119 ":define") d_crypt_r_proto=define
a48ec845
JH
11120 set d_crypt_r_proto crypt_r $hdrs
11121 eval $hasproto ;;
11122 *) ;;
11123 esac
11124 case "$d_crypt_r_proto" in
11125 define)
10bc17b6
JH
11126 case "$crypt_r_proto" in
11127 ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11128 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11129 esac
11130 case "$crypt_r_proto" in
b430fd04
JH
11131 ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11132 ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11133 esac
11134 case "$crypt_r_proto" in
90e831dc 11135 ''|0) d_crypt_r=undef
10bc17b6 11136 crypt_r_proto=0
a48ec845 11137 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11138 * ) case "$crypt_r_proto" in
11139 REENTRANT_PROTO*) ;;
11140 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11141 esac
11142 echo "Prototype: $try" ;;
11143 esac
11144 ;;
c18e646a
JH
11145 *) case "$usethreads" in
11146 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11147 esac
90e831dc
SB
11148 d_crypt_r=undef
11149 crypt_r_proto=0
c18e646a 11150 ;;
a48ec845
JH
11151 esac
11152 ;;
10bc17b6
JH
11153*) crypt_r_proto=0
11154 ;;
11155esac
11156
b4eb6b3d
JH
11157: get csh whereabouts
11158case "$csh" in
11159'csh') val="$undef" ;;
11160*) val="$define" ;;
11161esac
11162set d_csh
11163eval $setvar
11164: Respect a hint or command line value for full_csh.
11165case "$full_csh" in
11166'') full_csh=$csh ;;
11167esac
11168
13cfc98d
MB
11169: see if ctermid exists
11170set ctermid d_ctermid
11171eval $inlibc
11172
10bc17b6
JH
11173: see if ctermid_r exists
11174set ctermid_r d_ctermid_r
11175eval $inlibc
11176case "$d_ctermid_r" in
11177"$define")
31ee0cb7 11178 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
11179 case "$d_ctermid_r_proto:$usethreads" in
11180 ":define") d_ctermid_r_proto=define
a48ec845
JH
11181 set d_ctermid_r_proto ctermid_r $hdrs
11182 eval $hasproto ;;
11183 *) ;;
11184 esac
11185 case "$d_ctermid_r_proto" in
11186 define)
10bc17b6
JH
11187 case "$ctermid_r_proto" in
11188 ''|0) try='char* ctermid_r(char*);'
11189 ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11190 esac
11191 case "$ctermid_r_proto" in
90e831dc 11192 ''|0) d_ctermid_r=undef
10bc17b6 11193 ctermid_r_proto=0
a48ec845 11194 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11195 * ) case "$ctermid_r_proto" in
11196 REENTRANT_PROTO*) ;;
11197 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11198 esac
11199 echo "Prototype: $try" ;;
11200 esac
11201 ;;
c18e646a
JH
11202 *) case "$usethreads" in
11203 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11204 esac
90e831dc
SB
11205 d_ctermid_r=undef
11206 ctermid_r_proto=0
c18e646a 11207 ;;
a48ec845
JH
11208 esac
11209 ;;
10bc17b6
JH
11210*) ctermid_r_proto=0
11211 ;;
11212esac
11213
11214: see if ctime_r exists
11215set ctime_r d_ctime_r
11216eval $inlibc
11217case "$d_ctime_r" in
11218"$define")
d63eadf0 11219 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
11220 case "$d_ctime_r_proto:$usethreads" in
11221 ":define") d_ctime_r_proto=define
a48ec845
JH
11222 set d_ctime_r_proto ctime_r $hdrs
11223 eval $hasproto ;;
11224 *) ;;
11225 esac
11226 case "$d_ctime_r_proto" in
11227 define)
10bc17b6
JH
11228 case "$ctime_r_proto" in
11229 ''|0) try='char* ctime_r(const time_t*, char*);'
11230 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11231 esac
11232 case "$ctime_r_proto" in
11233 ''|0) try='char* ctime_r(const time_t*, char*, int);'
11234 ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11235 esac
11236 case "$ctime_r_proto" in
11237 ''|0) try='int ctime_r(const time_t*, char*);'
11238 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11239 esac
11240 case "$ctime_r_proto" in
11241 ''|0) try='int ctime_r(const time_t*, char*, int);'
11242 ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11243 esac
11244 case "$ctime_r_proto" in
90e831dc 11245 ''|0) d_ctime_r=undef
10bc17b6 11246 ctime_r_proto=0
a48ec845 11247 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11248 * ) case "$ctime_r_proto" in
11249 REENTRANT_PROTO*) ;;
11250 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11251 esac
11252 echo "Prototype: $try" ;;
11253 esac
11254 ;;
c18e646a
JH
11255 *) case "$usethreads" in
11256 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11257 esac
90e831dc
SB
11258 d_ctime_r=undef
11259 ctime_r_proto=0
c18e646a 11260 ;;
a48ec845
JH
11261 esac
11262 ;;
10bc17b6
JH
11263*) ctime_r_proto=0
11264 ;;
11265esac
11266
b4eb6b3d
JH
11267: see if cuserid exists
11268set cuserid d_cuserid
11269eval $inlibc
11270
11271: see if this is a limits.h system
11272set limits.h i_limits
11273eval $inhdr
11274
11275: see if this is a float.h system
11276set float.h i_float
11277eval $inhdr
11278
11279: See if number of significant digits in a double precision number is known
11280echo " "
11281$cat >dbl_dig.c <<EOM
11282#$i_limits I_LIMITS
11283#$i_float I_FLOAT
11284#ifdef I_LIMITS
11285#include <limits.h>
11286#endif
11287#ifdef I_FLOAT
11288#include <float.h>
11289#endif
11290#ifdef DBL_DIG
11291printf("Contains DBL_DIG");
11292#endif
11293EOM
11294$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11295if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11296 echo "DBL_DIG found." >&4
11297 val="$define"
11298else
11299 echo "DBL_DIG NOT found." >&4
11300 val="$undef"
11301fi
11302$rm -f dbl_dig.?
11303set d_dbl_dig
11304eval $setvar
11305
2ef53570
JH
11306: see if dbm.h is available
11307: see if dbmclose exists
11308set dbmclose d_dbmclose
11309eval $inlibc
11310
11311case "$d_dbmclose" in
11312$define)
11313 set dbm.h i_dbm
11314 eval $inhdr
11315 case "$i_dbm" in
11316 $define)
11317 val="$undef"
11318 set i_rpcsvcdbm
11319 eval $setvar
11320 ;;
11321 *) set rpcsvc/dbm.h i_rpcsvcdbm
11322 eval $inhdr
11323 ;;
11324 esac
11325 ;;
11326*) echo "We won't be including <dbm.h>"
11327 val="$undef"
11328 set i_dbm
11329 eval $setvar
11330 val="$undef"
11331 set i_rpcsvcdbm
11332 eval $setvar
11333 ;;
11334esac
11335
11336: see if prototype for dbminit is available
11337echo " "
11338set d_dbminitproto dbminit $i_dbm dbm.h
11339eval $hasproto
11340
b4eb6b3d
JH
11341: see if difftime exists
11342set difftime d_difftime
11343eval $inlibc
11344
11345: see if this is a dirent system
11346echo " "
11347if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11348 val="$define"
11349 echo "<dirent.h> found." >&4
11350else
11351 val="$undef"
11352 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11353 echo "<sys/dir.h> found." >&4
11354 echo " "
11355 else
11356 xinc=`./findhdr sys/ndir.h`
11357 fi
11358 echo "<dirent.h> NOT found." >&4
11359fi
11360set i_dirent
11361eval $setvar
11362
11363: Look for type of directory structure.
11364echo " "
11365$cppstdin $cppflags $cppminus < "$xinc" > try.c
11366
11367case "$direntrytype" in
11368''|' ')
11369 case "$i_dirent" in
11370 $define) guess1='struct dirent' ;;
11371 *) guess1='struct direct' ;;
11372 esac
11373 ;;
11374*) guess1="$direntrytype"
11375 ;;
11376esac
11377
11378case "$guess1" in
11379'struct dirent') guess2='struct direct' ;;
11380*) guess2='struct dirent' ;;
11381esac
5b813a60 11382
b4eb6b3d
JH
11383if $contains "$guess1" try.c >/dev/null 2>&1; then
11384 direntrytype="$guess1"
11385 echo "Your directory entries are $direntrytype." >&4
11386elif $contains "$guess2" try.c >/dev/null 2>&1; then
11387 direntrytype="$guess2"
11388 echo "Your directory entries seem to be $direntrytype." >&4
11389else
11390 echo "I don't recognize your system's directory entries." >&4
11391 rp="What type is used for directory entries on this system?"
11392 dflt="$guess1"
11393 . ./myread
11394 direntrytype="$ans"
11395fi
5b813a60 11396$rm_try
b4eb6b3d
JH
11397
11398: see if the directory entry stores field length
11399echo " "
11400$cppstdin $cppflags $cppminus < "$xinc" > try.c
11401if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11402 echo "Good, your directory entry keeps length information in d_namlen." >&4
11403 val="$define"
11404else
11405 echo "Your directory entry does not know about the d_namlen field." >&4
11406 val="$undef"
11407fi
11408set d_dirnamlen
11409eval $setvar
5b813a60 11410$rm_try
b4eb6b3d 11411
de52168c
SP
11412: Look for DIR.dd_fd
11413case "$i_dirent" in
11414"$define")
11415 echo "Checking to see if DIR has a dd_fd member variable" >&4
11416 $cat >try.c <<EOCP
11417#$i_stdlib I_STDLIB
11418#ifdef I_STDLIB
11419#include <stdlib.h>
11420#endif
11421#include <dirent.h>
11422
11423int main() {
11424 DIR dir;
11425 dir.dd_fd = 1;
11426 return 0;
11427}
11428EOCP
11429 val=$undef
11430 set try
11431 if eval $compile; then
11432 echo "Yes, it does."
11433 val="$define"
11434 else
11435 echo "No, it does not."
11436 val="$undef"
11437 fi
11438 ;;
11439*)
11440 echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11441 val="$undef"
11442 ;;
11443esac
11444set d_dir_dd_fd
11445eval $setvar
5b813a60 11446$rm_try
de52168c 11447
ae0e3d3b
JH
11448: see if this is an sysdir system
11449set sys/dir.h i_sysdir
11450eval $inhdr
11451
11452: see if this is an sysndir system
11453set sys/ndir.h i_sysndir
11454eval $inhdr
11455
11456: Look for dirfd
11457echo " "
11458$cat >dirfd.c <<EOM
11459#include <stdio.h>
55954f19
JH
11460#$i_stdlib I_STDLIB
11461#ifdef I_STDLIB
11462#include <stdlib.h>
11463#endif
ae0e3d3b
JH
11464#$i_dirent I_DIRENT /**/
11465#$i_sysdir I_SYS_DIR /**/
11466#$i_sysndir I_SYS_NDIR /**/
11467#$i_systypes I_SYS_TYPES /**/
11468#if defined(I_SYS_TYPES)
11469#include <sys/types.h>
11470#endif
11471#if defined(I_DIRENT)
11472#include <dirent.h>
11473#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11474#include <sys/dir.h>
11475#endif
11476#else
11477#ifdef I_SYS_NDIR
11478#include <sys/ndir.h>
11479#else
11480#ifdef I_SYS_DIR
11481#ifdef hp9000s500
11482#include <ndir.h> /* may be wrong in the future */
11483#else
11484#include <sys/dir.h>
11485#endif
11486#endif
11487#endif
11488#endif
11489int main() {
11490 DIR *dirp = opendir(".");
11491 if (dirfd(dirp) >= 0)
11492 exit(0);
11493 else
11494 exit(1);
11495}
11496EOM
5cadb3f3 11497val=$undef
ae0e3d3b
JH
11498set dirfd
11499if eval $compile; then
11500 val="$define"
11501fi
11502case "$val" in
11503$define) echo "dirfd() found." >&4 ;;
11504*) echo "dirfd() NOT found." >&4 ;;
11505esac
11506set d_dirfd
11507eval $setvar
11508$rm -f dirfd*
11509
b4eb6b3d
JH
11510: see if dlerror exists
11511xxx_runnm="$runnm"
11512runnm=false
11513set dlerror d_dlerror
11514eval $inlibc
11515runnm="$xxx_runnm"
11516
11517: see if dlfcn is available
11518set dlfcn.h i_dlfcn
11519eval $inhdr
11520
11521case "$usedl" in
11522$define|y|true)
11523 $cat << EOM
11524
11525On a few systems, the dynamically loaded modules that perl generates and uses
11526will need a different extension than shared libs. The default will probably
11527be appropriate.
11528
11529EOM
11530 case "$dlext" in
11531 '') dflt="$so" ;;
11532 *) dflt="$dlext" ;;
11533 esac
11534 rp='What is the extension of dynamically loaded modules'
11535 . ./myread
11536 dlext="$ans"
11537 ;;
11538*)
11539 dlext="none"
11540 ;;
11541esac
11542
11543: Check if dlsym need a leading underscore
11544echo " "
11545val="$undef"
11546
11547case "$dlsrc" in
11548dl_dlopen.xs)
11549 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11550 $cat >dyna.c <<'EOM'
11551fred () { }
11552EOM
11553
11554$cat >fred.c<<EOM
11555
11556#include <stdio.h>
55954f19
JH
11557#$i_stdlib I_STDLIB
11558#ifdef I_STDLIB
11559#include <stdlib.h>
11560#endif
b4eb6b3d
JH
11561#$i_dlfcn I_DLFCN
11562#ifdef I_DLFCN
5440bc8e 11563#include <dlfcn.h> /* the dynamic linker include file for SunOS/Solaris */
b4eb6b3d
JH
11564#else
11565#include <sys/types.h>
11566#include <nlist.h>
11567#include <link.h>
11568#endif
11569
11570extern int fred() ;
11571
11572int main()
11573{
11574 void * handle ;
11575 void * symbol ;
11576#ifndef RTLD_LAZY
11577 int mode = 1 ;
11578#else
11579 int mode = RTLD_LAZY ;
11580#endif
11581 handle = dlopen("./dyna.$dlext", mode) ;
11582 if (handle == NULL) {
11583 printf ("1\n") ;
11584 fflush (stdout) ;
11585 exit(0);
11586 }
11587 symbol = dlsym(handle, "fred") ;
11588 if (symbol == NULL) {
11589 /* try putting a leading underscore */
11590 symbol = dlsym(handle, "_fred") ;
11591 if (symbol == NULL) {
11592 printf ("2\n") ;
11593 fflush (stdout) ;
11594 exit(0);
11595 }
11596 printf ("3\n") ;
11597 }
11598 else
11599 printf ("4\n") ;
11600 fflush (stdout) ;
11601 exit(0);
11602}
11603EOM
11604 : Call the object file tmp-dyna.o in case dlext=o.
11605 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11606 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
e4778687 11607 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
5440bc8e
JH
11608 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11609 xxx=`$run ./fred`
b4eb6b3d
JH
11610 case $xxx in
11611 1) echo "Test program failed using dlopen." >&4
11612 echo "Perhaps you should not use dynamic loading." >&4;;
11613 2) echo "Test program failed using dlsym." >&4
11614 echo "Perhaps you should not use dynamic loading." >&4;;
11615 3) echo "dlsym needs a leading underscore" >&4
11616 val="$define" ;;
11617 4) echo "dlsym doesn't need a leading underscore." >&4;;
11618 esac
11619 else
11620 echo "I can't compile and run the test program." >&4
11621 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11622 fi
11623 ;;
11624esac
11625
3c728e00 11626$rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
b4eb6b3d
JH
11627
11628set d_dlsymun
11629eval $setvar
11630
10bc17b6
JH
11631: see if drand48_r exists
11632set drand48_r d_drand48_r
11633eval $inlibc
11634case "$d_drand48_r" in
11635"$define")
11636 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
11637 case "$d_drand48_r_proto:$usethreads" in
11638 ":define") d_drand48_r_proto=define
a48ec845
JH
11639 set d_drand48_r_proto drand48_r $hdrs
11640 eval $hasproto ;;
11641 *) ;;
11642 esac
11643 case "$d_drand48_r_proto" in
11644 define)
10bc17b6
JH
11645 case "$drand48_r_proto" in
11646 ''|0) try='int drand48_r(struct drand48_data*, double*);'
11647 ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11648 esac
11649 case "$drand48_r_proto" in
90e831dc 11650 ''|0) d_drand48_r=undef
10bc17b6 11651 drand48_r_proto=0
a48ec845 11652 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11653 * ) case "$drand48_r_proto" in
11654 REENTRANT_PROTO*) ;;
11655 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11656 esac
11657 echo "Prototype: $try" ;;
11658 esac
11659 ;;
c18e646a
JH
11660 *) case "$usethreads" in
11661 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11662 esac
90e831dc
SB
11663 d_drand48_r=undef
11664 drand48_r_proto=0
c18e646a 11665 ;;
a48ec845
JH
11666 esac
11667 ;;
10bc17b6
JH
11668*) drand48_r_proto=0
11669 ;;
11670esac
11671
11672: see if prototype for drand48 is available
11673echo " "
11674set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11675eval $hasproto
11676
b4eb6b3d
JH
11677: see if dup2 exists
11678set dup2 d_dup2
11679eval $inlibc
11680
11681: see if eaccess exists
11682set eaccess d_eaccess
11683eval $inlibc
11684
11685: see if endgrent exists
11686set endgrent d_endgrent
11687eval $inlibc
11688
10bc17b6
JH
11689: see if this is an grp system
11690set grp.h i_grp
11691eval $inhdr
11692
11693case "$i_grp" in
11694$define)
11695 xxx=`./findhdr grp.h`
11696 $cppstdin $cppflags $cppminus < $xxx >$$.h
11697
11698 if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11699 val="$define"
11700 else
11701 val="$undef"
11702 fi
11703 set d_grpasswd
11704 eval $setvar
11705
11706 $rm -f $$.h
11707 ;;
11708*)
11709 val="$undef";
11710 set d_grpasswd; eval $setvar
11711 ;;
11712esac
11713
11714: see if endgrent_r exists
11715set endgrent_r d_endgrent_r
11716eval $inlibc
11717case "$d_endgrent_r" in
11718"$define")
11719 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
11720 case "$d_endgrent_r_proto:$usethreads" in
11721 ":define") d_endgrent_r_proto=define
a48ec845
JH
11722 set d_endgrent_r_proto endgrent_r $hdrs
11723 eval $hasproto ;;
11724 *) ;;
11725 esac
11726 case "$d_endgrent_r_proto" in
11727 define)
10bc17b6
JH
11728 case "$endgrent_r_proto" in
11729 ''|0) try='int endgrent_r(FILE**);'
11730 ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11731 esac
11732 case "$endgrent_r_proto" in
11733 ''|0) try='void endgrent_r(FILE**);'
11734 ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11735 esac
11736 case "$endgrent_r_proto" in
90e831dc 11737 ''|0) d_endgrent_r=undef
10bc17b6 11738 endgrent_r_proto=0
a48ec845 11739 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11740 * ) case "$endgrent_r_proto" in
11741 REENTRANT_PROTO*) ;;
11742 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11743 esac
11744 echo "Prototype: $try" ;;
11745 esac
11746 ;;
c18e646a
JH
11747 *) case "$usethreads" in
11748 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11749 esac
90e831dc
SB
11750 d_endgrent_r=undef
11751 endgrent_r_proto=0
c18e646a 11752 ;;
a48ec845
JH
11753 esac
11754 ;;
10bc17b6
JH
11755*) endgrent_r_proto=0
11756 ;;
11757esac
11758
b4eb6b3d
JH
11759: see if endhostent exists
11760set endhostent d_endhent
11761eval $inlibc
11762
10bc17b6
JH
11763: see if this is a netdb.h system
11764set netdb.h i_netdb
11765eval $inhdr
11766
11767: see if endhostent_r exists
11768set endhostent_r d_endhostent_r
11769eval $inlibc
11770case "$d_endhostent_r" in
11771"$define")
11772 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11773 case "$d_endhostent_r_proto:$usethreads" in
11774 ":define") d_endhostent_r_proto=define
a48ec845
JH
11775 set d_endhostent_r_proto endhostent_r $hdrs
11776 eval $hasproto ;;
11777 *) ;;
11778 esac
11779 case "$d_endhostent_r_proto" in
11780 define)
10bc17b6
JH
11781 case "$endhostent_r_proto" in
11782 ''|0) try='int endhostent_r(struct hostent_data*);'
31ee0cb7 11783 ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10bc17b6
JH
11784 esac
11785 case "$endhostent_r_proto" in
11786 ''|0) try='void endhostent_r(struct hostent_data*);'
31ee0cb7 11787 ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10bc17b6
JH
11788 esac
11789 case "$endhostent_r_proto" in
90e831dc 11790 ''|0) d_endhostent_r=undef
10bc17b6 11791 endhostent_r_proto=0
a48ec845 11792 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11793 * ) case "$endhostent_r_proto" in
11794 REENTRANT_PROTO*) ;;
11795 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11796 esac
11797 echo "Prototype: $try" ;;
11798 esac
11799 ;;
c18e646a
JH
11800 *) case "$usethreads" in
11801 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11802 esac
90e831dc
SB
11803 d_endhostent_r=undef
11804 endhostent_r_proto=0
c18e646a 11805 ;;
a48ec845
JH
11806 esac
11807 ;;
10bc17b6
JH
11808*) endhostent_r_proto=0
11809 ;;
11810esac
11811
b4eb6b3d
JH
11812: see if endnetent exists
11813set endnetent d_endnent
11814eval $inlibc
11815
10bc17b6
JH
11816: see if endnetent_r exists
11817set endnetent_r d_endnetent_r
11818eval $inlibc
11819case "$d_endnetent_r" in
11820"$define")
11821 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11822 case "$d_endnetent_r_proto:$usethreads" in
11823 ":define") d_endnetent_r_proto=define
a48ec845
JH
11824 set d_endnetent_r_proto endnetent_r $hdrs
11825 eval $hasproto ;;
11826 *) ;;
11827 esac
11828 case "$d_endnetent_r_proto" in
11829 define)
10bc17b6
JH
11830 case "$endnetent_r_proto" in
11831 ''|0) try='int endnetent_r(struct netent_data*);'
31ee0cb7 11832 ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10bc17b6
JH
11833 esac
11834 case "$endnetent_r_proto" in
11835 ''|0) try='void endnetent_r(struct netent_data*);'
31ee0cb7 11836 ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10bc17b6
JH
11837 esac
11838 case "$endnetent_r_proto" in
90e831dc 11839 ''|0) d_endnetent_r=undef
10bc17b6 11840 endnetent_r_proto=0
a48ec845 11841 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11842 * ) case "$endnetent_r_proto" in
11843 REENTRANT_PROTO*) ;;
11844 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11845 esac
11846 echo "Prototype: $try" ;;
11847 esac
11848 ;;
c18e646a
JH
11849 *) case "$usethreads" in
11850 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11851 esac
90e831dc
SB
11852 d_endnetent_r=undef
11853 endnetent_r_proto=0
c18e646a 11854 ;;
a48ec845
JH
11855 esac
11856 ;;
10bc17b6
JH
11857*) endnetent_r_proto=0
11858 ;;
11859esac
11860
b4eb6b3d
JH
11861: see if endprotoent exists
11862set endprotoent d_endpent
11863eval $inlibc
11864
10bc17b6
JH
11865: see if endprotoent_r exists
11866set endprotoent_r d_endprotoent_r
11867eval $inlibc
11868case "$d_endprotoent_r" in
11869"$define")
11870 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
11871 case "$d_endprotoent_r_proto:$usethreads" in
11872 ":define") d_endprotoent_r_proto=define
a48ec845
JH
11873 set d_endprotoent_r_proto endprotoent_r $hdrs
11874 eval $hasproto ;;
11875 *) ;;
11876 esac
11877 case "$d_endprotoent_r_proto" in
11878 define)
10bc17b6
JH
11879 case "$endprotoent_r_proto" in
11880 ''|0) try='int endprotoent_r(struct protoent_data*);'
31ee0cb7 11881 ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10bc17b6
JH
11882 esac
11883 case "$endprotoent_r_proto" in
11884 ''|0) try='void endprotoent_r(struct protoent_data*);'
31ee0cb7 11885 ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10bc17b6
JH
11886 esac
11887 case "$endprotoent_r_proto" in
90e831dc 11888 ''|0) d_endprotoent_r=undef
10bc17b6 11889 endprotoent_r_proto=0
a48ec845 11890 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
11891 * ) case "$endprotoent_r_proto" in
11892 REENTRANT_PROTO*) ;;
11893 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11894 esac
11895 echo "Prototype: $try" ;;
11896 esac
11897 ;;
c18e646a
JH
11898 *) case "$usethreads" in
11899 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11900 esac
90e831dc
SB
11901 d_endprotoent_r=undef
11902 endprotoent_r_proto=0
c18e646a 11903 ;;
a48ec845
JH
11904 esac
11905 ;;
10bc17b6
JH
11906*) endprotoent_r_proto=0
11907 ;;
11908esac
11909
b4eb6b3d
JH
11910: see if endpwent exists
11911set endpwent d_endpwent
11912eval $inlibc
11913
10bc17b6
JH
11914: see if this is a pwd.h system
11915set pwd.h i_pwd
11916eval $inhdr
11917
11918case "$i_pwd" in
11919$define)
11920 xxx=`./findhdr pwd.h`
11921 $cppstdin $cppflags $cppminus < $xxx >$$.h
11922
11923 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11924 val="$define"
11925 else
11926 val="$undef"
11927 fi
11928 set d_pwquota
11929 eval $setvar
11930
11931 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11932 val="$define"
11933 else
11934 val="$undef"
11935 fi
11936 set d_pwage
11937 eval $setvar
11938
11939 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11940 val="$define"
11941 else
11942 val="$undef"
11943 fi
11944 set d_pwchange
11945 eval $setvar
11946
11947 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11948 val="$define"
11949 else
11950 val="$undef"
11951 fi
11952 set d_pwclass
11953 eval $setvar
11954
11955 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11956 val="$define"
11957 else
11958 val="$undef"
11959 fi
11960 set d_pwexpire
11961 eval $setvar
11962
11963 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11964 val="$define"
11965 else
11966 val="$undef"
11967 fi
11968 set d_pwcomment
11969 eval $setvar
11970
11971 if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11972 val="$define"
11973 else
11974 val="$undef"
11975 fi
11976 set d_pwgecos
11977 eval $setvar
11978
11979 if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11980 val="$define"
11981 else
11982 val="$undef"
11983 fi
11984 set d_pwpasswd
11985 eval $setvar
11986
11987 $rm -f $$.h
11988 ;;
11989*)
11990 val="$undef";
11991 set d_pwquota; eval $setvar
11992 set d_pwage; eval $setvar
11993 set d_pwchange; eval $setvar
11994 set d_pwclass; eval $setvar
11995 set d_pwexpire; eval $setvar
11996 set d_pwcomment; eval $setvar
11997 set d_pwgecos; eval $setvar
11998 set d_pwpasswd; eval $setvar
11999 ;;
12000esac
12001
12002: see if endpwent_r exists
12003set endpwent_r d_endpwent_r
12004eval $inlibc
12005case "$d_endpwent_r" in
12006"$define")
12007 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
12008 case "$d_endpwent_r_proto:$usethreads" in
12009 ":define") d_endpwent_r_proto=define
a48ec845
JH
12010 set d_endpwent_r_proto endpwent_r $hdrs
12011 eval $hasproto ;;
12012 *) ;;
12013 esac
12014 case "$d_endpwent_r_proto" in
12015 define)
10bc17b6
JH
12016 case "$endpwent_r_proto" in
12017 ''|0) try='int endpwent_r(FILE**);'
12018 ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12019 esac
12020 case "$endpwent_r_proto" in
12021 ''|0) try='void endpwent_r(FILE**);'
12022 ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12023 esac
12024 case "$endpwent_r_proto" in
90e831dc 12025 ''|0) d_endpwent_r=undef
10bc17b6 12026 endpwent_r_proto=0
a48ec845 12027 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12028 * ) case "$endpwent_r_proto" in
12029 REENTRANT_PROTO*) ;;
12030 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12031 esac
12032 echo "Prototype: $try" ;;
12033 esac
12034 ;;
c18e646a
JH
12035 *) case "$usethreads" in
12036 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12037 esac
90e831dc
SB
12038 d_endpwent_r=undef
12039 endpwent_r_proto=0
c18e646a 12040 ;;
a48ec845
JH
12041 esac
12042 ;;
10bc17b6
JH
12043*) endpwent_r_proto=0
12044 ;;
12045esac
12046
b4eb6b3d
JH
12047: see if endservent exists
12048set endservent d_endsent
12049eval $inlibc
12050
10bc17b6
JH
12051: see if endservent_r exists
12052set endservent_r d_endservent_r
12053eval $inlibc
12054case "$d_endservent_r" in
12055"$define")
12056 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
12057 case "$d_endservent_r_proto:$usethreads" in
12058 ":define") d_endservent_r_proto=define
a48ec845
JH
12059 set d_endservent_r_proto endservent_r $hdrs
12060 eval $hasproto ;;
12061 *) ;;
12062 esac
12063 case "$d_endservent_r_proto" in
12064 define)
10bc17b6
JH
12065 case "$endservent_r_proto" in
12066 ''|0) try='int endservent_r(struct servent_data*);'
31ee0cb7 12067 ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10bc17b6
JH
12068 esac
12069 case "$endservent_r_proto" in
12070 ''|0) try='void endservent_r(struct servent_data*);'
31ee0cb7 12071 ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10bc17b6
JH
12072 esac
12073 case "$endservent_r_proto" in
90e831dc 12074 ''|0) d_endservent_r=undef
10bc17b6 12075 endservent_r_proto=0
a48ec845 12076 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
12077 * ) case "$endservent_r_proto" in
12078 REENTRANT_PROTO*) ;;
12079 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12080 esac
12081 echo "Prototype: $try" ;;
12082 esac
12083 ;;
c18e646a
JH
12084 *) case "$usethreads" in
12085 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12086 esac
90e831dc
SB
12087 d_endservent_r=undef
12088 endservent_r_proto=0
c18e646a 12089 ;;
a48ec845
JH
12090 esac
12091 ;;
10bc17b6
JH
12092*) endservent_r_proto=0
12093 ;;
12094esac
12095
b4eb6b3d
JH
12096: Locate the flags for 'open()'
12097echo " "
55954f19 12098$cat >try.c <<EOCP
b4eb6b3d
JH
12099#include <sys/types.h>
12100#ifdef I_FCNTL
12101#include <fcntl.h>
12102#endif
12103#ifdef I_SYS_FILE
12104#include <sys/file.h>
12105#endif
55954f19
JH
12106#$i_stdlib I_STDLIB
12107#ifdef I_STDLIB
12108#include <stdlib.h>
12109#endif
b4eb6b3d
JH
12110int main() {
12111 if(O_RDONLY);
12112#ifdef O_TRUNC
12113 exit(0);
12114#else
12115 exit(1);
12116#endif
12117}
12118EOCP
12119: check sys/file.h first to get FREAD on Sun
12120if $test `./findhdr sys/file.h` && \
5440bc8e 12121 set try -DI_SYS_FILE && eval $compile; then
b4eb6b3d
JH
12122 h_sysfile=true;
12123 echo "<sys/file.h> defines the O_* constants..." >&4
5440bc8e 12124 if $run ./try; then
b4eb6b3d
JH
12125 echo "and you have the 3 argument form of open()." >&4
12126 val="$define"
12127 else
12128 echo "but not the 3 argument form of open(). Oh, well." >&4
12129 val="$undef"
12130 fi
12131elif $test `./findhdr fcntl.h` && \
5440bc8e 12132 set try -DI_FCNTL && eval $compile; then
b4eb6b3d
JH
12133 h_fcntl=true;
12134 echo "<fcntl.h> defines the O_* constants..." >&4
5440bc8e 12135 if $run ./try; then
b4eb6b3d
JH
12136 echo "and you have the 3 argument form of open()." >&4
12137 val="$define"
12138 else
12139 echo "but not the 3 argument form of open(). Oh, well." >&4
12140 val="$undef"
12141 fi
12142else
12143 val="$undef"
12144 echo "I can't find the O_* constant definitions! You got problems." >&4
12145fi
12146set d_open3
12147eval $setvar
5b813a60 12148$rm_try
b4eb6b3d
JH
12149
12150: see which of string.h or strings.h is needed
12151echo " "
12152strings=`./findhdr string.h`
12153if $test "$strings" && $test -r "$strings"; then
12154 echo "Using <string.h> instead of <strings.h>." >&4
12155 val="$define"
12156else
12157 val="$undef"
12158 strings=`./findhdr strings.h`
12159 if $test "$strings" && $test -r "$strings"; then
12160 echo "Using <strings.h> instead of <string.h>." >&4
12161 else
12162 echo "No string header found -- You'll surely have problems." >&4
12163 fi
12164fi
12165set i_string
12166eval $setvar
12167case "$i_string" in
12168"$undef") strings=`./findhdr strings.h`;;
12169*) strings=`./findhdr string.h`;;
12170esac
12171
3c728e00
JH
12172: see if this is a sys/file.h system
12173val=''
12174set sys/file.h val
12175eval $inhdr
12176
12177: do we need to include sys/file.h ?
12178case "$val" in
12179"$define")
12180 echo " "
12181 if $h_sysfile; then
12182 val="$define"
12183 echo "We'll be including <sys/file.h>." >&4
12184 else
12185 val="$undef"
12186 echo "We won't be including <sys/file.h>." >&4
12187 fi
12188 ;;
12189*)
12190 h_sysfile=false
12191 ;;
12192esac
12193set i_sysfile
12194eval $setvar
12195
12196: see if fcntl.h is there
12197val=''
12198set fcntl.h val
12199eval $inhdr
12200
12201: see if we can include fcntl.h
12202case "$val" in
12203"$define")
12204 echo " "
12205 if $h_fcntl; then
12206 val="$define"
12207 echo "We'll be including <fcntl.h>." >&4
12208 else
12209 val="$undef"
12210 if $h_sysfile; then
12211 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12212 else
12213 echo "We won't be including <fcntl.h>." >&4
12214 fi
12215 fi
12216 ;;
12217*)
12218 h_fcntl=false
12219 val="$undef"
12220 ;;
12221esac
12222set i_fcntl
12223eval $setvar
12224
4dd8f9b3
JH
12225: see if fork exists
12226set fork d_fork
12227eval $inlibc
12228
12229: see if pipe exists
12230set pipe d_pipe
12231eval $inlibc
12232
b4eb6b3d
JH
12233: check for non-blocking I/O stuff
12234case "$h_sysfile" in
a0acbdc3
JH
12235true) echo "#include <sys/file.h>" > head.c;;
12236*)
12237 case "$h_fcntl" in
12238 true) echo "#include <fcntl.h>" > head.c;;
12239 *) echo "#include <sys/fcntl.h>" > head.c;;
12240 esac
12241 ;;
b4eb6b3d
JH
12242esac
12243echo " "
12244echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12245case "$o_nonblock" in
12246'')
12247 $cat head.c > try.c
3c728e00 12248 $cat >>try.c <<EOCP
b4eb6b3d 12249#include <stdio.h>
55954f19
JH
12250#$i_stdlib I_STDLIB
12251#ifdef I_STDLIB
80b3ef99 12252#include <stdlib.h>
55954f19 12253#endif
3c728e00
JH
12254#$i_fcntl I_FCNTL
12255#ifdef I_FCNTL
12256#include <fcntl.h>
12257#endif
b4eb6b3d
JH
12258int main() {
12259#ifdef O_NONBLOCK
12260 printf("O_NONBLOCK\n");
12261 exit(0);
12262#endif
12263#ifdef O_NDELAY
12264 printf("O_NDELAY\n");
12265 exit(0);
12266#endif
12267#ifdef FNDELAY
12268 printf("FNDELAY\n");
12269 exit(0);
12270#endif
12271 exit(0);
12272}
12273EOCP
12274 set try
12275 if eval $compile_ok; then
5440bc8e 12276 o_nonblock=`$run ./try`
b4eb6b3d
JH
12277 case "$o_nonblock" in
12278 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12279 *) echo "Seems like we can use $o_nonblock.";;
12280 esac
12281 else
12282 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12283 fi
12284 ;;
12285*) echo "Using $hint value $o_nonblock.";;
12286esac
5b813a60 12287$rm_try
b4eb6b3d
JH
12288
12289echo " "
12290echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12291case "$eagain" in
12292'')
4dd8f9b3
JH
12293 case "$d_fork:$d_pipe" in
12294 define:define)
b4eb6b3d
JH
12295 $cat head.c > try.c
12296 $cat >>try.c <<EOCP
12297#include <errno.h>
12298#include <sys/types.h>
12299#include <signal.h>
5b813a60 12300#include <stdio.h>
55954f19
JH
12301#$i_stdlib I_STDLIB
12302#ifdef I_STDLIB
12303#include <stdlib.h>
12304#endif
1deb0a86
JH
12305#$i_fcntl I_FCNTL
12306#ifdef I_FCNTL
12307#include <fcntl.h>
12308#endif
b4eb6b3d
JH
12309#define MY_O_NONBLOCK $o_nonblock
12310#ifndef errno /* XXX need better Configure test */
12311extern int errno;
12312#endif
12313#$i_unistd I_UNISTD
12314#ifdef I_UNISTD
12315#include <unistd.h>
12316#endif
12317#$i_string I_STRING
12318#ifdef I_STRING
12319#include <string.h>
12320#else
12321#include <strings.h>
12322#endif
7090f861 12323$signal_t blech(int x) { exit(3); }
b4eb6b3d
JH
12324EOCP
12325 $cat >> try.c <<'EOCP'
12326int main()
12327{
12328 int pd[2];
12329 int pu[2];
12330 char buf[1];
12331 char string[100];
12332
12333 pipe(pd); /* Down: child -> parent */
12334 pipe(pu); /* Up: parent -> child */
12335 if (0 != fork()) {
12336 int ret;
12337 close(pd[1]); /* Parent reads from pd[0] */
12338 close(pu[0]); /* Parent writes (blocking) to pu[1] */
a0acbdc3 12339#ifdef F_SETFL
b4eb6b3d
JH
12340 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12341 exit(1);
a0acbdc3
JH
12342#else
12343 exit(4);
12344#endif
b4eb6b3d
JH
12345 signal(SIGALRM, blech);
12346 alarm(5);
12347 if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
12348 exit(2);
12349 sprintf(string, "%d\n", ret);
12350 write(2, string, strlen(string));
12351 alarm(0);
12352#ifdef EAGAIN
12353 if (errno == EAGAIN) {
12354 printf("EAGAIN\n");
12355 goto ok;
12356 }
12357#endif
12358#ifdef EWOULDBLOCK
12359 if (errno == EWOULDBLOCK)
12360 printf("EWOULDBLOCK\n");
12361#endif
12362 ok:
12363 write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
12364 sleep(2); /* Give it time to close our pipe */
12365 alarm(5);
12366 ret = read(pd[0], buf, 1); /* Should read EOF */
12367 alarm(0);
12368 sprintf(string, "%d\n", ret);
868439a2 12369 write(4, string, strlen(string));
b4eb6b3d
JH
12370 exit(0);
12371 }
12372
12373 close(pd[0]); /* We write to pd[1] */
12374 close(pu[1]); /* We read from pu[0] */
12375 read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
12376 close(pd[1]); /* Pipe pd is now fully closed! */
12377 exit(0); /* Bye bye, thank you for playing! */
12378}
12379EOCP
12380 set try
12381 if eval $compile_ok; then
12382 echo "$startsh" >mtry
868439a2 12383 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
b4eb6b3d
JH
12384 chmod +x mtry
12385 ./mtry >/dev/null 2>&1
12386 case $? in
12387 0) eagain=`$cat try.out`;;
12388 1) echo "Could not perform non-blocking setting!";;
12389 2) echo "I did a successful read() for something that was not there!";;
12390 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
a0acbdc3 12391 4) echo "Could not find F_SETFL!";;
b4eb6b3d
JH
12392 *) echo "Something terribly wrong happened during testing.";;
12393 esac
12394 rd_nodata=`$cat try.ret`
12395 echo "A read() system call with no data present returns $rd_nodata."
12396 case "$rd_nodata" in
12397 0|-1) ;;
12398 *)
12399 echo "(That's peculiar, fixing that to be -1.)"
12400 rd_nodata=-1
12401 ;;
12402 esac
12403 case "$eagain" in
12404 '')
12405 echo "Forcing errno EAGAIN on read() with no data available."
12406 eagain=EAGAIN
12407 ;;
12408 *)
12409 echo "Your read() sets errno to $eagain when no data is available."
12410 ;;
12411 esac
12412 status=`$cat try.err`
12413 case "$status" in
12414 0) echo "And it correctly returns 0 to signal EOF.";;
12415 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12416 *) echo "However, your read() returns '$status' on EOF??";;
12417 esac
12418 val="$define"
12419 if test "$status" = "$rd_nodata"; then
12420 echo "WARNING: you can't distinguish between EOF and no data!"
12421 val="$undef"
12422 fi
12423 else
12424 echo "I can't compile the test program--assuming errno EAGAIN will do."
12425 eagain=EAGAIN
12426 fi
4dd8f9b3
JH
12427 ;;
12428 *) echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12429 eagain=EAGAIN
12430 val="$define"
12431 ;;
12432 esac
b4eb6b3d
JH
12433 set d_eofnblk
12434 eval $setvar
12435 ;;
12436*)
12437 echo "Using $hint value $eagain."
12438 echo "Your read() returns $rd_nodata when no data is present."
12439 case "$d_eofnblk" in
12440 "$define") echo "And you can see EOF because read() returns 0.";;
12441 "$undef") echo "But you can't see EOF status from read() returned value.";;
12442 *)
12443 echo "(Assuming you can't see EOF status from read anyway.)"
12444 d_eofnblk=$undef
12445 ;;
12446 esac
12447 ;;
12448esac
5b813a60 12449$rm_try head.c mtry
b4eb6b3d 12450
15b61c98
JH
12451: see if _ptr and _cnt from stdio act std
12452echo " "
b4eb6b3d 12453
15b61c98
JH
12454if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12455 echo "(Looks like you have stdio.h from BSD.)"
12456 case "$stdio_ptr" in
12457 '') stdio_ptr='((fp)->_p)'
12458 ptr_lval=$define
12459 ;;
12460 *) ptr_lval=$d_stdio_ptr_lval;;
12461 esac
12462 case "$stdio_cnt" in
12463 '') stdio_cnt='((fp)->_r)'
12464 cnt_lval=$define
12465 ;;
12466 *) cnt_lval=$d_stdio_cnt_lval;;
12467 esac
12468 case "$stdio_base" in
12469 '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12470 esac
12471 case "$stdio_bufsiz" in
12472 '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12473 esac
12474elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12475 echo "(Looks like you have stdio.h from Linux.)"
12476 case "$stdio_ptr" in
12477 '') stdio_ptr='((fp)->_IO_read_ptr)'
12478 ptr_lval=$define
12479 ;;
12480 *) ptr_lval=$d_stdio_ptr_lval;;
12481 esac
12482 case "$stdio_cnt" in
12483 '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12484 cnt_lval=$undef
12485 ;;
12486 *) cnt_lval=$d_stdio_cnt_lval;;
12487 esac
12488 case "$stdio_base" in
12489 '') stdio_base='((fp)->_IO_read_base)';;
12490 esac
12491 case "$stdio_bufsiz" in
12492 '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12493 esac
12494else
12495 case "$stdio_ptr" in
12496 '') stdio_ptr='((fp)->_ptr)'
12497 ptr_lval=$define
12498 ;;
12499 *) ptr_lval=$d_stdio_ptr_lval;;
12500 esac
12501 case "$stdio_cnt" in
12502 '') stdio_cnt='((fp)->_cnt)'
12503 cnt_lval=$define
12504 ;;
12505 *) cnt_lval=$d_stdio_cnt_lval;;
12506 esac
12507 case "$stdio_base" in
12508 '') stdio_base='((fp)->_base)';;
12509 esac
12510 case "$stdio_bufsiz" in
12511 '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12512 esac
12513fi
b4eb6b3d 12514
15b61c98
JH
12515: test whether _ptr and _cnt really work
12516echo "Checking how std your stdio is..." >&4
12517$cat >try.c <<EOP
12518#include <stdio.h>
55954f19
JH
12519#$i_stdlib I_STDLIB
12520#ifdef I_STDLIB
9d9004a9 12521#include <stdlib.h>
55954f19 12522#endif
15b61c98
JH
12523#define FILE_ptr(fp) $stdio_ptr
12524#define FILE_cnt(fp) $stdio_cnt
9d9004a9 12525int main() {
15b61c98
JH
12526 FILE *fp = fopen("try.c", "r");
12527 char c = getc(fp);
12528 if (
12529 18 <= FILE_cnt(fp) &&
12530 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12531 )
12532 exit(0);
12533 exit(1);
9d9004a9 12534}
15b61c98
JH
12535EOP
12536val="$undef"
12537set try
12538if eval $compile && $to try.c; then
12539 if $run ./try; then
12540 echo "Your stdio acts pretty std."
12541 val="$define"
9d9004a9 12542 else
15b61c98 12543 echo "Your stdio isn't very std."
9d9004a9 12544 fi
15b61c98
JH
12545else
12546 echo "Your stdio doesn't appear very std."
12547fi
5b813a60 12548$rm_try
15b61c98
JH
12549
12550# glibc 2.2.90 and above apparently change stdio streams so Perl's
12551# direct buffer manipulation no longer works. The Configure tests
12552# should be changed to correctly detect this, but until then,
12553# the following check should at least let perl compile and run.
12554# (This quick fix should be updated before 5.8.1.)
12555# To be defensive, reject all unknown versions, and all versions > 2.2.9.
12556# A. Dougherty, June 3, 2002.
12557case "$d_gnulibc" in
12558$define)
12559 case "$gnulibc_version" in
12560 2.[01]*) ;;
12561 2.2) ;;
12562 2.2.[0-9]) ;;
12563 *) echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12564 val="$undef"
12565 ;;
12566 esac
9d9004a9
AD
12567 ;;
12568esac
15b61c98 12569set d_stdstdio
9d9004a9 12570eval $setvar
9d9004a9 12571
15b61c98
JH
12572: Can _ptr be used as an lvalue?
12573case "$d_stdstdio$ptr_lval" in
12574$define$define) val=$define ;;
12575*) val=$undef ;;
12576esac
12577set d_stdio_ptr_lval
12578eval $setvar
9d9004a9 12579
15b61c98
JH
12580: Can _cnt be used as an lvalue?
12581case "$d_stdstdio$cnt_lval" in
12582$define$define) val=$define ;;
12583*) val=$undef ;;
12584esac
12585set d_stdio_cnt_lval
12586eval $setvar
b4eb6b3d 12587
15b61c98
JH
12588
12589: test whether setting _ptr sets _cnt as a side effect
12590d_stdio_ptr_lval_sets_cnt="$undef"
12591d_stdio_ptr_lval_nochange_cnt="$undef"
12592case "$d_stdio_ptr_lval$d_stdstdio" in
12593$define$define)
12594 echo "Checking to see what happens if we set the stdio ptr..." >&4
12595$cat >try.c <<EOP
12596#include <stdio.h>
12597/* Can we scream? */
12598/* Eat dust sed :-) */
12599/* In the buffer space, no one can hear you scream. */
55954f19
JH
12600#$i_stdlib I_STDLIB
12601#ifdef I_STDLIB
12602#include <stdlib.h>
12603#endif
15b61c98
JH
12604#define FILE_ptr(fp) $stdio_ptr
12605#define FILE_cnt(fp) $stdio_cnt
b4eb6b3d 12606#include <sys/types.h>
b4eb6b3d 12607int main() {
15b61c98
JH
12608 FILE *fp = fopen("try.c", "r");
12609 int c;
12610 char *ptr;
12611 size_t cnt;
12612 if (!fp) {
12613 puts("Fail even to read");
12614 exit(1);
12615 }
12616 c = getc(fp); /* Read away the first # */
12617 if (c == EOF) {
12618 puts("Fail even to read");
12619 exit(1);
12620 }
12621 if (!(
12622 18 <= FILE_cnt(fp) &&
12623 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12624 )) {
12625 puts("Fail even to read");
12626 exit (1);
12627 }
12628 ptr = (char*) FILE_ptr(fp);
12629 cnt = (size_t)FILE_cnt(fp);
12630
12631 FILE_ptr(fp) += 42;
12632
12633 if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12634 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12635 exit (1);
12636 }
12637 if (FILE_cnt(fp) <= 20) {
12638 printf ("Fail (<20 chars to test)");
12639 exit (1);
12640 }
12641 if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12642 puts("Fail compare");
12643 exit (1);
12644 }
12645 if (cnt == FILE_cnt(fp)) {
12646 puts("Pass_unchanged");
12647 exit (0);
5b813a60 12648 }
15b61c98
JH
12649 if (FILE_cnt(fp) == (cnt - 42)) {
12650 puts("Pass_changed");
12651 exit (0);
12652 }
12653 printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12654 return 1;
12655
12656}
12657EOP
12658 set try
12659 if eval $compile && $to try.c; then
12660 case `$run ./try` in
12661 Pass_changed)
12662 echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
12663 d_stdio_ptr_lval_sets_cnt="$define" ;;
12664 Pass_unchanged)
12665 echo "Increasing ptr in your stdio leaves cnt unchanged. Good." >&4
12666 d_stdio_ptr_lval_nochange_cnt="$define" ;;
12667 Fail*)
12668 echo "Increasing ptr in your stdio didn't do exactly what I expected. We'll not be doing that then." >&4 ;;
12669 *)
12670 echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12671 esac
12672 else
12673 echo "It seems we can't set ptr in your stdio. Nevermind." >&4
12674 fi
5b813a60 12675 $rm_try
15b61c98
JH
12676 ;;
12677esac
12678
12679: see if _base is also standard
12680val="$undef"
12681case "$d_stdstdio" in
12682$define)
12683 $cat >try.c <<EOP
12684#include <stdio.h>
12685#$i_stdlib I_STDLIB
12686#ifdef I_STDLIB
12687#include <stdlib.h>
12688#endif
12689#define FILE_base(fp) $stdio_base
12690#define FILE_bufsiz(fp) $stdio_bufsiz
12691int main() {
12692 FILE *fp = fopen("try.c", "r");
12693 char c = getc(fp);
12694 if (
12695 19 <= FILE_bufsiz(fp) &&
12696 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12697 )
12698 exit(0);
12699 exit(1);
12700}
12701EOP
12702 set try
12703 if eval $compile && $to try.c; then
12704 if $run ./try; then
12705 echo "And its _base field acts std."
12706 val="$define"
12707 else
12708 echo "But its _base field isn't std."
12709 fi
12710 else
12711 echo "However, it seems to be lacking the _base field."
12712 fi
5b813a60 12713 $rm_try
15b61c98
JH
12714 ;;
12715esac
12716set d_stdiobase
12717eval $setvar
12718
12719: see if fast_stdio exists
12720val="$undef"
12721case "$d_stdstdio:$d_stdio_ptr_lval" in
12722"$define:$define")
12723 case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12724 *$define*)
12725 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12726 val="$define"
12727 ;;
12728 esac
12729 ;;
12730esac
12731set d_faststdio
12732eval $setvar
12733
12734
12735
12736: see if fchdir exists
12737set fchdir d_fchdir
12738eval $inlibc
12739
12740: see if fchmod exists
12741set fchmod d_fchmod
12742eval $inlibc
12743
12744: see if fchown exists
12745set fchown d_fchown
12746eval $inlibc
12747
12748: see if this is an fcntl system
12749set fcntl d_fcntl
12750eval $inlibc
12751
12752echo " "
12753: See if fcntl-based locking works.
12754$cat >try.c <<EOCP
12755#$i_stdlib I_STDLIB
12756#ifdef I_STDLIB
12757#include <stdlib.h>
12758#endif
12759#include <unistd.h>
12760#include <fcntl.h>
12761#include <signal.h>
7090f861 12762$signal_t blech(int x) { exit(3); }
15b61c98
JH
12763int main() {
12764#if defined(F_SETLK) && defined(F_SETLKW)
12765 struct flock flock;
12766 int retval, fd;
12767 fd = open("try.c", O_RDONLY);
12768 flock.l_type = F_RDLCK;
12769 flock.l_whence = SEEK_SET;
12770 flock.l_start = flock.l_len = 0;
12771 signal(SIGALRM, blech);
12772 alarm(10);
12773 retval = fcntl(fd, F_SETLK, &flock);
12774 close(fd);
12775 (retval < 0 ? exit(2) : exit(0));
12776#else
12777 exit(2);
12778#endif
12779}
12780EOCP
12781echo "Checking if fcntl-based file locking works... "
12782case "$d_fcntl" in
12783"$define")
12784 set try
12785 if eval $compile_ok; then
12786 if $run ./try; then
12787 echo "Yes, it seems to work."
12788 val="$define"
12789 else
12790 echo "Nope, it didn't work."
12791 val="$undef"
12792 case "$?" in
12793 3) $cat >&4 <<EOM
12794***
12795*** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12796*** This is (almost) impossible.
12797*** If your NFS lock daemons are not feeling well, something like
12798*** this may happen, please investigate. Cannot continue, aborting.
12799***
12800EOM
12801 exit 1
12802 ;;
12803 esac
12804 fi
12805 else
12806 echo "I'm unable to compile the test program, so I'll assume not."
12807 val="$undef"
12808 fi
12809 ;;
12810*) val="$undef";
12811 echo "Nope, since you don't even have fcntl()."
12812 ;;
12813esac
12814set d_fcntl_can_lock
12815eval $setvar
5b813a60 12816$rm_try
15b61c98
JH
12817
12818: check for fd_set items
12819$cat <<EOM
12820
12821Checking to see how well your C compiler handles fd_set and friends ...
12822EOM
12823$cat >try.c <<EOCP
12824#$i_stdlib I_STDLIB
12825#ifdef I_STDLIB
12826#include <stdlib.h>
12827#endif
12828#$i_systime I_SYS_TIME
12829#$i_sysselct I_SYS_SELECT
12830#$d_socket HAS_SOCKET
12831#include <sys/types.h>
12832#ifdef HAS_SOCKET
12833#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12834#endif
12835#ifdef I_SYS_TIME
12836#include <sys/time.h>
12837#endif
12838#ifdef I_SYS_SELECT
12839#include <sys/select.h>
12840#endif
12841int main() {
12842 fd_set fds;
12843
12844#ifdef TRYBITS
12845 if(fds.fds_bits);
12846#endif
12847
12848#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12849 exit(0);
12850#else
12851 exit(1);
12852#endif
12853}
12854EOCP
12855set try -DTRYBITS
12856if eval $compile; then
12857 d_fds_bits="$define"
12858 d_fd_set="$define"
12859 echo "Well, your system knows about the normal fd_set typedef..." >&4
12860 if $run ./try; then
b4eb6b3d
JH
12861 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12862 d_fd_macros="$define"
12863 else
12864 $cat >&4 <<'EOM'
12865but not the normal fd_set macros! Gaaack! I'll have to cover for you.
12866EOM
12867 d_fd_macros="$undef"
12868 fi
12869else
12870 $cat <<'EOM'
12871Hmm, your compiler has some difficulty with fd_set. Checking further...
12872EOM
5440bc8e 12873 set try
b4eb6b3d
JH
12874 if eval $compile; then
12875 d_fds_bits="$undef"
12876 d_fd_set="$define"
12877 echo "Well, your system has some sort of fd_set available..." >&4
5440bc8e 12878 if $run ./try; then
b4eb6b3d
JH
12879 echo "and you have the normal fd_set macros." >&4
12880 d_fd_macros="$define"
12881 else
12882 $cat <<'EOM'
12883but not the normal fd_set macros! Gross! More work for me...
12884EOM
12885 d_fd_macros="$undef"
12886 fi
12887 else
12888 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
12889 d_fd_set="$undef"
12890 d_fds_bits="$undef"
12891 d_fd_macros="$undef"
12892 fi
12893fi
5b813a60 12894$rm_try
b4eb6b3d
JH
12895
12896: see if fgetpos exists
12897set fgetpos d_fgetpos
12898eval $inlibc
12899
758a5d79
JH
12900: see if finite exists
12901set finite d_finite
12902eval $inlibc
12903
12904: see if finitel exists
12905set finitel d_finitel
12906eval $inlibc
12907
b4eb6b3d
JH
12908: see if flock exists
12909set flock d_flock
12910eval $inlibc
12911
2ef53570
JH
12912: see if prototype for flock is available
12913echo " "
12914set d_flockproto flock $i_sysfile sys/file.h
12915eval $hasproto
12916
758a5d79
JH
12917: see if fp_class exists
12918set fp_class d_fp_class
12919eval $inlibc
12920
b4eb6b3d
JH
12921: see if pathconf exists
12922set pathconf d_pathconf
12923eval $inlibc
12924
12925: see if fpathconf exists
12926set fpathconf d_fpathconf
12927eval $inlibc
12928
758a5d79
JH
12929: see if fpclass exists
12930set fpclass d_fpclass
12931eval $inlibc
12932
12933: see if fpclassify exists
12934set fpclassify d_fpclassify
12935eval $inlibc
12936
12937: see if fpclassl exists
12938set fpclassl d_fpclassl
12939eval $inlibc
12940
b4eb6b3d
JH
12941
12942: check for fpos64_t
12943echo " "
12944echo "Checking to see if you have fpos64_t..." >&4
12945$cat >try.c <<EOCP
12946#include <stdio.h>
12947int main() { fpos64_t x = 7; }
12948EOCP
12949set try
12950if eval $compile; then
12951 val="$define"
12952 echo "You have fpos64_t."
12953else
12954 val="$undef"
12955 echo "You do not have fpos64_t."
12956 case "$fpossize" in
12957 8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12958 esac
12959fi
5b813a60 12960$rm_try
b4eb6b3d
JH
12961set d_fpos64_t
12962eval $setvar
12963
12964: see if frexpl exists
12965set frexpl d_frexpl
12966eval $inlibc
12967
b4eb6b3d
JH
12968: see if this is a sys/param system
12969set sys/param.h i_sysparam
12970eval $inhdr
12971
12972: see if this is a sys/mount.h system
12973set sys/mount.h i_sysmount
12974eval $inhdr
12975
b4eb6b3d
JH
12976
12977echo " "
12978echo "Checking to see if your system supports struct fs_data..." >&4
12979set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12980eval $hasstruct
12981case "$d_fs_data_s" in
12982"$define") echo "Yes, it does." ;;
12983*) echo "No, it doesn't." ;;
12984esac
12985
12986: see if fseeko exists
12987set fseeko d_fseeko
12988eval $inlibc
12989case "$longsize" in
129908) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12991esac
12992
12993: see if fsetpos exists
12994set fsetpos d_fsetpos
12995eval $inlibc
12996
12997
12998: see if fstatfs exists
12999set fstatfs d_fstatfs
13000eval $inlibc
13001
13002
13003: see if statvfs exists
13004set statvfs d_statvfs
13005eval $inlibc
13006
13007: see if fstatvfs exists
13008set fstatvfs d_fstatvfs
13009eval $inlibc
13010
13011
411ab01c
JH
13012: see if fsync exists
13013set fsync d_fsync
13014eval $inlibc
13015
b4eb6b3d
JH
13016: see if ftello exists
13017set ftello d_ftello
13018eval $inlibc
13019case "$longsize" in
130208) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13021esac
13022
bff98e24
SP
13023d_futimes="$undef"
13024: check for a working futimes
13025echo " "
5b813a60 13026echo "Checking if you have a working futimes()" >&4
bff98e24
SP
13027$cat >try.c <<EOCP
13028#include <stdio.h>
13029#include <sys/time.h>
13030#include <errno.h>
13031#include <fcntl.h>
13032
13033int main ()
13034{
13035 int fd, rv;
13036 fd = open ("try.c", O_RDWR);
13037 if (-1 == fd) exit (1);
13038 rv = futimes (fd, NULL);
13039 exit (rv == -1 ? errno : 0);
13040}
13041EOCP
13042set try
13043if eval $compile; then
13044 `$run ./try`
13045 rc=$?
13046 case "$rc" in
5b813a60 13047 0) echo "Yes, you have" >&4
bff98e24
SP
13048 d_futimes="$define"
13049 ;;
5b813a60 13050 *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
bff98e24
SP
13051 ;;
13052 esac
13053else
43dddb59 13054 echo "No, it does not (probably harmless)" >&4
bff98e24 13055fi
5b813a60 13056$rm_try
dc814df1 13057
b4eb6b3d
JH
13058: see if getcwd exists
13059set getcwd d_getcwd
13060eval $inlibc
13061
13062: see if getespwnam exists
13063set getespwnam d_getespwnam
13064eval $inlibc
13065
13066
13067: see if getfsstat exists
13068set getfsstat d_getfsstat
13069eval $inlibc
13070
13071: see if getgrent exists
13072set getgrent d_getgrent
13073eval $inlibc
13074
10bc17b6
JH
13075: see if getgrent_r exists
13076set getgrent_r d_getgrent_r
13077eval $inlibc
13078case "$d_getgrent_r" in
13079"$define")
13080 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13081 case "$d_getgrent_r_proto:$usethreads" in
13082 ":define") d_getgrent_r_proto=define
a48ec845
JH
13083 set d_getgrent_r_proto getgrent_r $hdrs
13084 eval $hasproto ;;
13085 *) ;;
13086 esac
13087 case "$d_getgrent_r_proto" in
13088 define)
10bc17b6
JH
13089 case "$getgrent_r_proto" in
13090 ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13091 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13092 esac
13093 case "$getgrent_r_proto" in
13094 ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13095 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13096 esac
13097 case "$getgrent_r_proto" in
13098 ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13099 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13100 esac
13101 case "$getgrent_r_proto" in
13102 ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13103 ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13104 esac
13105 case "$getgrent_r_proto" in
13106 ''|0) try='int getgrent_r(struct group*, char*, int);'
13107 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13108 esac
13109 case "$getgrent_r_proto" in
13110 ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13111 ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13112 esac
13113 case "$getgrent_r_proto" in
90e831dc 13114 ''|0) d_getgrent_r=undef
10bc17b6 13115 getgrent_r_proto=0
a48ec845 13116 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13117 * ) case "$getgrent_r_proto" in
13118 REENTRANT_PROTO*) ;;
13119 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13120 esac
13121 echo "Prototype: $try" ;;
13122 esac
13123 ;;
c18e646a
JH
13124 *) case "$usethreads" in
13125 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13126 esac
90e831dc
SB
13127 d_getgrent_r=undef
13128 getgrent_r_proto=0
c18e646a 13129 ;;
a48ec845
JH
13130 esac
13131 ;;
10bc17b6
JH
13132*) getgrent_r_proto=0
13133 ;;
13134esac
13135
13136: see if getgrgid_r exists
13137set getgrgid_r d_getgrgid_r
13138eval $inlibc
13139case "$d_getgrgid_r" in
13140"$define")
13141 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13142 case "$d_getgrgid_r_proto:$usethreads" in
13143 ":define") d_getgrgid_r_proto=define
a48ec845
JH
13144 set d_getgrgid_r_proto getgrgid_r $hdrs
13145 eval $hasproto ;;
13146 *) ;;
13147 esac
13148 case "$d_getgrgid_r_proto" in
13149 define)
10bc17b6
JH
13150 case "$getgrgid_r_proto" in
13151 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13152 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13153 esac
13154 case "$getgrgid_r_proto" in
13155 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13156 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13157 esac
13158 case "$getgrgid_r_proto" in
13159 ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13160 ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13161 esac
13162 case "$getgrgid_r_proto" in
13163 ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13164 ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13165 esac
13166 case "$getgrgid_r_proto" in
90e831dc 13167 ''|0) d_getgrgid_r=undef
10bc17b6 13168 getgrgid_r_proto=0
a48ec845 13169 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13170 * ) case "$getgrgid_r_proto" in
13171 REENTRANT_PROTO*) ;;
13172 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13173 esac
13174 echo "Prototype: $try" ;;
13175 esac
13176 ;;
c18e646a
JH
13177 *) case "$usethreads" in
13178 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13179 esac
90e831dc
SB
13180 d_getgrgid_r=undef
13181 getgrgid_r_proto=0
c18e646a 13182 ;;
a48ec845
JH
13183 esac
13184 ;;
10bc17b6
JH
13185*) getgrgid_r_proto=0
13186 ;;
13187esac
13188
13189: see if getgrnam_r exists
13190set getgrnam_r d_getgrnam_r
13191eval $inlibc
13192case "$d_getgrnam_r" in
13193"$define")
13194 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
13195 case "$d_getgrnam_r_proto:$usethreads" in
13196 ":define") d_getgrnam_r_proto=define
a48ec845
JH
13197 set d_getgrnam_r_proto getgrnam_r $hdrs
13198 eval $hasproto ;;
13199 *) ;;
13200 esac
13201 case "$d_getgrnam_r_proto" in
13202 define)
10bc17b6
JH
13203 case "$getgrnam_r_proto" in
13204 ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13205 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13206 esac
13207 case "$getgrnam_r_proto" in
13208 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13209 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13210 esac
13211 case "$getgrnam_r_proto" in
13212 ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13213 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13214 esac
13215 case "$getgrnam_r_proto" in
13216 ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13217 ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13218 esac
13219 case "$getgrnam_r_proto" in
13220 ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13221 ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13222 esac
13223 case "$getgrnam_r_proto" in
90e831dc 13224 ''|0) d_getgrnam_r=undef
10bc17b6 13225 getgrnam_r_proto=0
a48ec845 13226 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13227 * ) case "$getgrnam_r_proto" in
13228 REENTRANT_PROTO*) ;;
13229 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13230 esac
13231 echo "Prototype: $try" ;;
13232 esac
13233 ;;
c18e646a
JH
13234 *) case "$usethreads" in
13235 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13236 esac
90e831dc
SB
13237 d_getgrnam_r=undef
13238 getgrnam_r_proto=0
c18e646a 13239 ;;
a48ec845
JH
13240 esac
13241 ;;
10bc17b6
JH
13242*) getgrnam_r_proto=0
13243 ;;
13244esac
13245
b4eb6b3d
JH
13246: see if gethostbyaddr exists
13247set gethostbyaddr d_gethbyaddr
13248eval $inlibc
13249
13250: see if gethostbyname exists
13251set gethostbyname d_gethbyname
13252eval $inlibc
13253
13254: see if gethostent exists
13255set gethostent d_gethent
13256eval $inlibc
13257
13258: see how we will look up host name
13259echo " "
13260call=''
13261if set gethostname val -f d_gethname; eval $csym; $val; then
13262 echo 'gethostname() found.' >&4
13263 d_gethname="$define"
13264 call=gethostname
13265fi
13266if set uname val -f d_uname; eval $csym; $val; then
13267 if ./xenix; then
13268 $cat <<'EOM'
13269uname() was found, but you're running xenix, and older versions of xenix
13270have a broken uname(). If you don't really know whether your xenix is old
13271enough to have a broken system call, use the default answer.
13272
13273EOM
13274 dflt=y
13275 case "$d_uname" in
13276 "$define") dflt=n;;
13277 esac
13278 rp='Is your uname() broken?'
13279 . ./myread
13280 case "$ans" in
13281 n*) d_uname="$define"; call=uname;;
13282 esac
13283 else
13284 echo 'uname() found.' >&4
13285 d_uname="$define"
13286 case "$call" in
13287 '') call=uname ;;
13288 esac
13289 fi
13290fi
13291case "$d_gethname" in
13292'') d_gethname="$undef";;
13293esac
13294case "$d_uname" in
13295'') d_uname="$undef";;
13296esac
13297case "$d_uname$d_gethname" in
13298*define*)
13299 dflt=n
13300 cat <<EOM
13301
13302Every now and then someone has a $call() that lies about the hostname
13303but can't be fixed for political or economic reasons. If you wish, I can
13304pretend $call() isn't there and maybe compute hostname at run-time
13305thanks to the '$phostname' command.
13306
13307EOM
13308 rp="Shall I ignore $call() from now on?"
13309 . ./myread
13310 case "$ans" in
13311 y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13312 esac;;
13313esac
13314case "$phostname" in
13315'') aphostname='';;
13316*) case "$aphostname" in
13317 /*) ;;
13318 *) set X $phostname
13319 shift
13320 file=$1
13321 shift
13322 file=`./loc $file $file $pth`
13323 aphostname=`echo $file $*`
13324 ;;
13325 esac
13326 ;;
13327esac
13328case "$d_uname$d_gethname" in
13329*define*) ;;
13330*)
13331 case "$phostname" in
13332 '')
13333 echo "There will be no way for $package to get your hostname." >&4;;
13334 *)
13335 echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13336 ;;
13337 esac;;
13338esac
13339case "$d_phostname" in
13340'') d_phostname="$undef";;
13341esac
13342
10bc17b6
JH
13343: see if gethostbyaddr_r exists
13344set gethostbyaddr_r d_gethostbyaddr_r
13345eval $inlibc
13346case "$d_gethostbyaddr_r" in
13347"$define")
13348 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13349 case "$d_gethostbyaddr_r_proto:$usethreads" in
13350 ":define") d_gethostbyaddr_r_proto=define
a48ec845
JH
13351 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13352 eval $hasproto ;;
13353 *) ;;
13354 esac
13355 case "$d_gethostbyaddr_r_proto" in
13356 define)
10bc17b6
JH
13357 case "$gethostbyaddr_r_proto" in
13358 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13359 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13360 esac
13361 case "$gethostbyaddr_r_proto" in
13362 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13363 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13364 esac
13365 case "$gethostbyaddr_r_proto" in
13366 ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13367 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13368 esac
13369 case "$gethostbyaddr_r_proto" in
13370 ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13371 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13372 esac
13373 case "$gethostbyaddr_r_proto" in
13374 ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13375 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13376 esac
13377 case "$gethostbyaddr_r_proto" in
13378 ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13379 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13380 esac
13381 case "$gethostbyaddr_r_proto" in
13382 ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13383 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13384 esac
13385 case "$gethostbyaddr_r_proto" in
13386 ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13387 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13388 esac
13389 case "$gethostbyaddr_r_proto" in
13390 ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13391 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13392 esac
13393 case "$gethostbyaddr_r_proto" in
13394 ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13395 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13396 esac
13397 case "$gethostbyaddr_r_proto" in
a845a0d4
JH
13398 ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13399 ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13400 esac
13401 case "$gethostbyaddr_r_proto" in
90e831dc 13402 ''|0) d_gethostbyaddr_r=undef
10bc17b6 13403 gethostbyaddr_r_proto=0
a48ec845 13404 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13405 * ) case "$gethostbyaddr_r_proto" in
13406 REENTRANT_PROTO*) ;;
13407 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13408 esac
13409 echo "Prototype: $try" ;;
13410 esac
13411 ;;
c18e646a
JH
13412 *) case "$usethreads" in
13413 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13414 esac
90e831dc
SB
13415 d_gethostbyaddr_r=undef
13416 gethostbyaddr_r_proto=0
c18e646a 13417 ;;
a48ec845
JH
13418 esac
13419 ;;
10bc17b6
JH
13420*) gethostbyaddr_r_proto=0
13421 ;;
13422esac
13423
13424: see if gethostbyname_r exists
13425set gethostbyname_r d_gethostbyname_r
13426eval $inlibc
13427case "$d_gethostbyname_r" in
13428"$define")
13429 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13430 case "$d_gethostbyname_r_proto:$usethreads" in
13431 ":define") d_gethostbyname_r_proto=define
a48ec845
JH
13432 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13433 eval $hasproto ;;
13434 *) ;;
13435 esac
13436 case "$d_gethostbyname_r_proto" in
13437 define)
10bc17b6
JH
13438 case "$gethostbyname_r_proto" in
13439 ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13440 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13441 esac
13442 case "$gethostbyname_r_proto" in
13443 ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13444 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13445 esac
13446 case "$gethostbyname_r_proto" in
13447 ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13448 ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13449 esac
13450 case "$gethostbyname_r_proto" in
90e831dc 13451 ''|0) d_gethostbyname_r=undef
10bc17b6 13452 gethostbyname_r_proto=0
a48ec845 13453 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13454 * ) case "$gethostbyname_r_proto" in
13455 REENTRANT_PROTO*) ;;
13456 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13457 esac
13458 echo "Prototype: $try" ;;
13459 esac
13460 ;;
c18e646a
JH
13461 *) case "$usethreads" in
13462 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13463 esac
90e831dc
SB
13464 d_gethostbyname_r=undef
13465 gethostbyname_r_proto=0
c18e646a 13466 ;;
a48ec845
JH
13467 esac
13468 ;;
10bc17b6
JH
13469*) gethostbyname_r_proto=0
13470 ;;
13471esac
13472
13473: see if gethostent_r exists
13474set gethostent_r d_gethostent_r
13475eval $inlibc
13476case "$d_gethostent_r" in
13477"$define")
13478 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13479 case "$d_gethostent_r_proto:$usethreads" in
13480 ":define") d_gethostent_r_proto=define
a48ec845
JH
13481 set d_gethostent_r_proto gethostent_r $hdrs
13482 eval $hasproto ;;
13483 *) ;;
13484 esac
13485 case "$d_gethostent_r_proto" in
13486 define)
10bc17b6
JH
13487 case "$gethostent_r_proto" in
13488 ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13489 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13490 esac
13491 case "$gethostent_r_proto" in
13492 ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13493 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13494 esac
13495 case "$gethostent_r_proto" in
13496 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13497 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13498 esac
13499 case "$gethostent_r_proto" in
13500 ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13501 ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13502 esac
13503 case "$gethostent_r_proto" in
13504 ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13505 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13506 esac
13507 case "$gethostent_r_proto" in
13508 ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13509 ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13510 esac
13511 case "$gethostent_r_proto" in
90e831dc 13512 ''|0) d_gethostent_r=undef
10bc17b6 13513 gethostent_r_proto=0
a48ec845 13514 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13515 * ) case "$gethostent_r_proto" in
13516 REENTRANT_PROTO*) ;;
13517 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13518 esac
13519 echo "Prototype: $try" ;;
13520 esac
13521 ;;
c18e646a
JH
13522 *) case "$usethreads" in
13523 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13524 esac
90e831dc
SB
13525 d_gethostent_r=undef
13526 gethostent_r_proto=0
c18e646a 13527 ;;
a48ec845
JH
13528 esac
13529 ;;
10bc17b6
JH
13530*) gethostent_r_proto=0
13531 ;;
13532esac
b4eb6b3d
JH
13533
13534: see if prototypes for various gethostxxx netdb.h functions are available
13535echo " "
13536set d_gethostprotos gethostent $i_netdb netdb.h
13537eval $hasproto
13538
4e0554ec
JH
13539: see if getitimer exists
13540set getitimer d_getitimer
13541eval $inlibc
13542
b4eb6b3d
JH
13543: see if getlogin exists
13544set getlogin d_getlogin
13545eval $inlibc
13546
10bc17b6
JH
13547: see if getlogin_r exists
13548set getlogin_r d_getlogin_r
13549eval $inlibc
13550case "$d_getlogin_r" in
13551"$define")
13552 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
13553 case "$d_getlogin_r_proto:$usethreads" in
13554 ":define") d_getlogin_r_proto=define
a48ec845
JH
13555 set d_getlogin_r_proto getlogin_r $hdrs
13556 eval $hasproto ;;
13557 *) ;;
13558 esac
13559 case "$d_getlogin_r_proto" in
13560 define)
10bc17b6
JH
13561 case "$getlogin_r_proto" in
13562 ''|0) try='int getlogin_r(char*, size_t);'
13563 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13564 esac
13565 case "$getlogin_r_proto" in
13566 ''|0) try='int getlogin_r(char*, int);'
13567 ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13568 esac
13569 case "$getlogin_r_proto" in
13570 ''|0) try='char* getlogin_r(char*, size_t);'
13571 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13572 esac
13573 case "$getlogin_r_proto" in
13574 ''|0) try='char* getlogin_r(char*, int);'
13575 ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13576 esac
13577 case "$getlogin_r_proto" in
90e831dc 13578 ''|0) d_getlogin_r=undef
10bc17b6 13579 getlogin_r_proto=0
a48ec845 13580 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13581 * ) case "$getlogin_r_proto" in
13582 REENTRANT_PROTO*) ;;
13583 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13584 esac
13585 echo "Prototype: $try" ;;
13586 esac
13587 ;;
c18e646a
JH
13588 *) case "$usethreads" in
13589 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13590 esac
90e831dc
SB
13591 d_getlogin_r=undef
13592 getlogin_r_proto=0
c18e646a 13593 ;;
a48ec845
JH
13594 esac
13595 ;;
10bc17b6
JH
13596*) getlogin_r_proto=0
13597 ;;
13598esac
13599
b4eb6b3d
JH
13600: see if getmnt exists
13601set getmnt d_getmnt
13602eval $inlibc
13603
13604: see if getmntent exists
13605set getmntent d_getmntent
13606eval $inlibc
13607
13608: see if getnetbyaddr exists
13609set getnetbyaddr d_getnbyaddr
13610eval $inlibc
13611
13612: see if getnetbyname exists
13613set getnetbyname d_getnbyname
13614eval $inlibc
13615
13616: see if getnetent exists
13617set getnetent d_getnent
13618eval $inlibc
13619
10bc17b6
JH
13620: see if getnetbyaddr_r exists
13621set getnetbyaddr_r d_getnetbyaddr_r
13622eval $inlibc
13623case "$d_getnetbyaddr_r" in
13624"$define")
13625 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13626 case "$d_getnetbyaddr_r_proto:$usethreads" in
13627 ":define") d_getnetbyaddr_r_proto=define
a48ec845
JH
13628 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13629 eval $hasproto ;;
13630 *) ;;
13631 esac
13632 case "$d_getnetbyaddr_r_proto" in
13633 define)
10bc17b6
JH
13634 case "$getnetbyaddr_r_proto" in
13635 ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13636 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13637 esac
13638 case "$getnetbyaddr_r_proto" in
13639 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13640 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13641 esac
13642 case "$getnetbyaddr_r_proto" in
13643 ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13644 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13645 esac
13646 case "$getnetbyaddr_r_proto" in
13647 ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13648 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13649 esac
13650 case "$getnetbyaddr_r_proto" in
13651 ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13652 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13653 esac
13654 case "$getnetbyaddr_r_proto" in
13655 ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13656 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13657 esac
13658 case "$getnetbyaddr_r_proto" in
13659 ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13660 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13661 esac
13662 case "$getnetbyaddr_r_proto" in
a845a0d4
JH
13663 ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13664 ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13665 esac
13666 case "$getnetbyaddr_r_proto" in
90e831dc 13667 ''|0) d_getnetbyaddr_r=undef
10bc17b6 13668 getnetbyaddr_r_proto=0
a48ec845 13669 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13670 * ) case "$getnetbyaddr_r_proto" in
13671 REENTRANT_PROTO*) ;;
13672 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13673 esac
13674 echo "Prototype: $try" ;;
13675 esac
13676 ;;
c18e646a
JH
13677 *) case "$usethreads" in
13678 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13679 esac
90e831dc
SB
13680 d_getnetbyaddr_r=undef
13681 getnetbyaddr_r_proto=0
c18e646a 13682 ;;
a48ec845
JH
13683 esac
13684 ;;
10bc17b6
JH
13685*) getnetbyaddr_r_proto=0
13686 ;;
13687esac
13688
13689: see if getnetbyname_r exists
13690set getnetbyname_r d_getnetbyname_r
13691eval $inlibc
13692case "$d_getnetbyname_r" in
13693"$define")
13694 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13695 case "$d_getnetbyname_r_proto:$usethreads" in
13696 ":define") d_getnetbyname_r_proto=define
a48ec845
JH
13697 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13698 eval $hasproto ;;
13699 *) ;;
13700 esac
13701 case "$d_getnetbyname_r_proto" in
13702 define)
10bc17b6
JH
13703 case "$getnetbyname_r_proto" in
13704 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13705 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13706 esac
13707 case "$getnetbyname_r_proto" in
13708 ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13709 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13710 esac
13711 case "$getnetbyname_r_proto" in
13712 ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13713 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13714 esac
13715 case "$getnetbyname_r_proto" in
13716 ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13717 ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13718 esac
13719 case "$getnetbyname_r_proto" in
90e831dc 13720 ''|0) d_getnetbyname_r=undef
10bc17b6 13721 getnetbyname_r_proto=0
a48ec845 13722 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13723 * ) case "$getnetbyname_r_proto" in
13724 REENTRANT_PROTO*) ;;
13725 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13726 esac
13727 echo "Prototype: $try" ;;
13728 esac
13729 ;;
c18e646a
JH
13730 *) case "$usethreads" in
13731 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13732 esac
90e831dc
SB
13733 d_getnetbyname_r=undef
13734 getnetbyname_r_proto=0
c18e646a 13735 ;;
a48ec845
JH
13736 esac
13737 ;;
10bc17b6
JH
13738*) getnetbyname_r_proto=0
13739 ;;
13740esac
13741
13742: see if getnetent_r exists
13743set getnetent_r d_getnetent_r
13744eval $inlibc
13745case "$d_getnetent_r" in
13746"$define")
13747 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13748 case "$d_getnetent_r_proto:$usethreads" in
13749 ":define") d_getnetent_r_proto=define
a48ec845
JH
13750 set d_getnetent_r_proto getnetent_r $hdrs
13751 eval $hasproto ;;
13752 *) ;;
13753 esac
13754 case "$d_getnetent_r_proto" in
13755 define)
10bc17b6
JH
13756 case "$getnetent_r_proto" in
13757 ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13758 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13759 esac
13760 case "$getnetent_r_proto" in
13761 ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13762 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13763 esac
13764 case "$getnetent_r_proto" in
13765 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13766 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13767 esac
13768 case "$getnetent_r_proto" in
13769 ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13770 ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13771 esac
13772 case "$getnetent_r_proto" in
13773 ''|0) try='int getnetent_r(struct netent*, char*, int);'
13774 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13775 esac
13776 case "$getnetent_r_proto" in
13777 ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13778 ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13779 esac
13780 case "$getnetent_r_proto" in
90e831dc 13781 ''|0) d_getnetent_r=undef
10bc17b6 13782 getnetent_r_proto=0
a48ec845 13783 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13784 * ) case "$getnetent_r_proto" in
13785 REENTRANT_PROTO*) ;;
13786 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13787 esac
13788 echo "Prototype: $try" ;;
13789 esac
13790 ;;
c18e646a
JH
13791 *) case "$usethreads" in
13792 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13793 esac
90e831dc
SB
13794 d_getnetent_r=undef
13795 getnetent_r_proto=0
c18e646a 13796 ;;
a48ec845
JH
13797 esac
13798 ;;
10bc17b6
JH
13799*) getnetent_r_proto=0
13800 ;;
13801esac
13802
b4eb6b3d
JH
13803: see if prototypes for various getnetxxx netdb.h functions are available
13804echo " "
13805set d_getnetprotos getnetent $i_netdb netdb.h
13806eval $hasproto
13807
0c0643d0
JH
13808: see if getpagesize exists
13809set getpagesize d_getpagsz
13810eval $inlibc
13811
b4eb6b3d
JH
13812
13813: see if getprotobyname exists
13814set getprotobyname d_getpbyname
13815eval $inlibc
13816
13817: see if getprotobynumber exists
13818set getprotobynumber d_getpbynumber
13819eval $inlibc
13820
13821: see if getprotoent exists
13822set getprotoent d_getpent
13823eval $inlibc
13824
13825: see if getpgid exists
13826set getpgid d_getpgid
13827eval $inlibc
13828
13829: see if getpgrp2 exists
13830set getpgrp2 d_getpgrp2
13831eval $inlibc
13832
13833: see if getppid exists
13834set getppid d_getppid
13835eval $inlibc
13836
13837: see if getpriority exists
13838set getpriority d_getprior
13839eval $inlibc
13840
10bc17b6
JH
13841: see if getprotobyname_r exists
13842set getprotobyname_r d_getprotobyname_r
13843eval $inlibc
13844case "$d_getprotobyname_r" in
13845"$define")
13846 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13847 case "$d_getprotobyname_r_proto:$usethreads" in
13848 ":define") d_getprotobyname_r_proto=define
a48ec845
JH
13849 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13850 eval $hasproto ;;
13851 *) ;;
13852 esac
13853 case "$d_getprotobyname_r_proto" in
13854 define)
10bc17b6
JH
13855 case "$getprotobyname_r_proto" in
13856 ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13857 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13858 esac
13859 case "$getprotobyname_r_proto" in
13860 ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13861 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13862 esac
13863 case "$getprotobyname_r_proto" in
13864 ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13865 ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13866 esac
13867 case "$getprotobyname_r_proto" in
90e831dc 13868 ''|0) d_getprotobyname_r=undef
10bc17b6 13869 getprotobyname_r_proto=0
a48ec845 13870 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13871 * ) case "$getprotobyname_r_proto" in
13872 REENTRANT_PROTO*) ;;
13873 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13874 esac
13875 echo "Prototype: $try" ;;
13876 esac
13877 ;;
c18e646a
JH
13878 *) case "$usethreads" in
13879 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13880 esac
90e831dc
SB
13881 d_getprotobyname_r=undef
13882 getprotobyname_r_proto=0
c18e646a 13883 ;;
a48ec845
JH
13884 esac
13885 ;;
10bc17b6
JH
13886*) getprotobyname_r_proto=0
13887 ;;
13888esac
13889
13890: see if getprotobynumber_r exists
13891set getprotobynumber_r d_getprotobynumber_r
13892eval $inlibc
13893case "$d_getprotobynumber_r" in
13894"$define")
13895 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13896 case "$d_getprotobynumber_r_proto:$usethreads" in
13897 ":define") d_getprotobynumber_r_proto=define
a48ec845
JH
13898 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13899 eval $hasproto ;;
13900 *) ;;
13901 esac
13902 case "$d_getprotobynumber_r_proto" in
13903 define)
10bc17b6
JH
13904 case "$getprotobynumber_r_proto" in
13905 ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13906 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13907 esac
13908 case "$getprotobynumber_r_proto" in
13909 ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13910 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13911 esac
13912 case "$getprotobynumber_r_proto" in
13913 ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13914 ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13915 esac
13916 case "$getprotobynumber_r_proto" in
90e831dc 13917 ''|0) d_getprotobynumber_r=undef
10bc17b6 13918 getprotobynumber_r_proto=0
a48ec845 13919 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13920 * ) case "$getprotobynumber_r_proto" in
13921 REENTRANT_PROTO*) ;;
13922 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13923 esac
13924 echo "Prototype: $try" ;;
13925 esac
13926 ;;
c18e646a
JH
13927 *) case "$usethreads" in
13928 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13929 esac
90e831dc
SB
13930 d_getprotobynumber_r=undef
13931 getprotobynumber_r_proto=0
c18e646a 13932 ;;
a48ec845
JH
13933 esac
13934 ;;
10bc17b6
JH
13935*) getprotobynumber_r_proto=0
13936 ;;
13937esac
13938
13939: see if getprotoent_r exists
13940set getprotoent_r d_getprotoent_r
13941eval $inlibc
13942case "$d_getprotoent_r" in
13943"$define")
13944 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
13945 case "$d_getprotoent_r_proto:$usethreads" in
13946 ":define") d_getprotoent_r_proto=define
a48ec845
JH
13947 set d_getprotoent_r_proto getprotoent_r $hdrs
13948 eval $hasproto ;;
13949 *) ;;
13950 esac
13951 case "$d_getprotoent_r_proto" in
13952 define)
10bc17b6
JH
13953 case "$getprotoent_r_proto" in
13954 ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13955 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13956 esac
13957 case "$getprotoent_r_proto" in
13958 ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13959 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13960 esac
13961 case "$getprotoent_r_proto" in
13962 ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13963 ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13964 esac
13965 case "$getprotoent_r_proto" in
13966 ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13967 ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13968 esac
13969 case "$getprotoent_r_proto" in
90e831dc 13970 ''|0) d_getprotoent_r=undef
10bc17b6 13971 getprotoent_r_proto=0
a48ec845 13972 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
13973 * ) case "$getprotoent_r_proto" in
13974 REENTRANT_PROTO*) ;;
13975 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13976 esac
13977 echo "Prototype: $try" ;;
13978 esac
13979 ;;
c18e646a
JH
13980 *) case "$usethreads" in
13981 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13982 esac
90e831dc
SB
13983 d_getprotoent_r=undef
13984 getprotoent_r_proto=0
c18e646a 13985 ;;
a48ec845
JH
13986 esac
13987 ;;
10bc17b6
JH
13988*) getprotoent_r_proto=0
13989 ;;
13990esac
13991
b4eb6b3d
JH
13992: see if prototypes for various getprotoxxx netdb.h functions are available
13993echo " "
13994set d_getprotoprotos getprotoent $i_netdb netdb.h
13995eval $hasproto
13996
13997: see if getprpwnam exists
13998set getprpwnam d_getprpwnam
13999eval $inlibc
14000
14001: see if getpwent exists
14002set getpwent d_getpwent
14003eval $inlibc
14004
10bc17b6
JH
14005: see if getpwent_r exists
14006set getpwent_r d_getpwent_r
14007eval $inlibc
14008case "$d_getpwent_r" in
14009"$define")
14010 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14011 case "$d_getpwent_r_proto:$usethreads" in
14012 ":define") d_getpwent_r_proto=define
a48ec845
JH
14013 set d_getpwent_r_proto getpwent_r $hdrs
14014 eval $hasproto ;;
14015 *) ;;
14016 esac
14017 case "$d_getpwent_r_proto" in
14018 define)
10bc17b6
JH
14019 case "$getpwent_r_proto" in
14020 ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14021 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14022 esac
14023 case "$getpwent_r_proto" in
14024 ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14025 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14026 esac
14027 case "$getpwent_r_proto" in
14028 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14029 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14030 esac
14031 case "$getpwent_r_proto" in
14032 ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14033 ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14034 esac
14035 case "$getpwent_r_proto" in
14036 ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14037 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14038 esac
14039 case "$getpwent_r_proto" in
14040 ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14041 ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14042 esac
14043 case "$getpwent_r_proto" in
90e831dc 14044 ''|0) d_getpwent_r=undef
10bc17b6 14045 getpwent_r_proto=0
a48ec845 14046 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14047 * ) case "$getpwent_r_proto" in
14048 REENTRANT_PROTO*) ;;
14049 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14050 esac
14051 echo "Prototype: $try" ;;
14052 esac
14053 ;;
c18e646a
JH
14054 *) case "$usethreads" in
14055 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14056 esac
90e831dc
SB
14057 d_getpwent_r=undef
14058 getpwent_r_proto=0
c18e646a 14059 ;;
a48ec845
JH
14060 esac
14061 ;;
10bc17b6
JH
14062*) getpwent_r_proto=0
14063 ;;
14064esac
14065
14066: see if getpwnam_r exists
14067set getpwnam_r d_getpwnam_r
14068eval $inlibc
14069case "$d_getpwnam_r" in
14070"$define")
14071 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14072 case "$d_getpwnam_r_proto:$usethreads" in
14073 ":define") d_getpwnam_r_proto=define
a48ec845
JH
14074 set d_getpwnam_r_proto getpwnam_r $hdrs
14075 eval $hasproto ;;
14076 *) ;;
14077 esac
14078 case "$d_getpwnam_r_proto" in
14079 define)
10bc17b6
JH
14080 case "$getpwnam_r_proto" in
14081 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14082 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14083 esac
14084 case "$getpwnam_r_proto" in
14085 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14086 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14087 esac
14088 case "$getpwnam_r_proto" in
14089 ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14090 ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14091 esac
14092 case "$getpwnam_r_proto" in
14093 ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14094 ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14095 esac
14096 case "$getpwnam_r_proto" in
90e831dc 14097 ''|0) d_getpwnam_r=undef
10bc17b6 14098 getpwnam_r_proto=0
a48ec845 14099 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14100 * ) case "$getpwnam_r_proto" in
14101 REENTRANT_PROTO*) ;;
14102 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14103 esac
14104 echo "Prototype: $try" ;;
14105 esac
14106 ;;
c18e646a
JH
14107 *) case "$usethreads" in
14108 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14109 esac
90e831dc
SB
14110 d_getpwnam_r=undef
14111 getpwnam_r_proto=0
c18e646a 14112 ;;
a48ec845
JH
14113 esac
14114 ;;
10bc17b6
JH
14115*) getpwnam_r_proto=0
14116 ;;
14117esac
14118
14119: see if getpwuid_r exists
14120set getpwuid_r d_getpwuid_r
14121eval $inlibc
14122case "$d_getpwuid_r" in
14123"$define")
14124 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
14125 case "$d_getpwuid_r_proto:$usethreads" in
14126 ":define") d_getpwuid_r_proto=define
a48ec845
JH
14127 set d_getpwuid_r_proto getpwuid_r $hdrs
14128 eval $hasproto ;;
14129 *) ;;
14130 esac
14131 case "$d_getpwuid_r_proto" in
14132 define)
10bc17b6
JH
14133 case "$getpwuid_r_proto" in
14134 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14135 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14136 esac
14137 case "$getpwuid_r_proto" in
14138 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14139 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14140 esac
14141 case "$getpwuid_r_proto" in
14142 ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14143 ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14144 esac
14145 case "$getpwuid_r_proto" in
14146 ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14147 ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14148 esac
14149 case "$getpwuid_r_proto" in
90e831dc 14150 ''|0) d_getpwuid_r=undef
10bc17b6 14151 getpwuid_r_proto=0
a48ec845 14152 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14153 * ) case "$getpwuid_r_proto" in
14154 REENTRANT_PROTO*) ;;
14155 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14156 esac
14157 echo "Prototype: $try" ;;
14158 esac
14159 ;;
c18e646a
JH
14160 *) case "$usethreads" in
14161 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14162 esac
90e831dc
SB
14163 d_getpwuid_r=undef
14164 getpwuid_r_proto=0
c18e646a 14165 ;;
a48ec845
JH
14166 esac
14167 ;;
10bc17b6
JH
14168*) getpwuid_r_proto=0
14169 ;;
14170esac
14171
b4eb6b3d
JH
14172
14173: see if getservbyname exists
14174set getservbyname d_getsbyname
14175eval $inlibc
14176
14177: see if getservbyport exists
14178set getservbyport d_getsbyport
14179eval $inlibc
14180
14181: see if getservent exists
14182set getservent d_getsent
14183eval $inlibc
14184
10bc17b6
JH
14185: see if getservbyname_r exists
14186set getservbyname_r d_getservbyname_r
14187eval $inlibc
14188case "$d_getservbyname_r" in
14189"$define")
14190 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14191 case "$d_getservbyname_r_proto:$usethreads" in
14192 ":define") d_getservbyname_r_proto=define
a48ec845
JH
14193 set d_getservbyname_r_proto getservbyname_r $hdrs
14194 eval $hasproto ;;
14195 *) ;;
14196 esac
14197 case "$d_getservbyname_r_proto" in
14198 define)
10bc17b6
JH
14199 case "$getservbyname_r_proto" in
14200 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14201 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14202 esac
14203 case "$getservbyname_r_proto" in
14204 ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14205 ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14206 esac
14207 case "$getservbyname_r_proto" in
14208 ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14209 ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14210 esac
14211 case "$getservbyname_r_proto" in
90e831dc 14212 ''|0) d_getservbyname_r=undef
10bc17b6 14213 getservbyname_r_proto=0
a48ec845 14214 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14215 * ) case "$getservbyname_r_proto" in
14216 REENTRANT_PROTO*) ;;
14217 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14218 esac
14219 echo "Prototype: $try" ;;
14220 esac
14221 ;;
c18e646a
JH
14222 *) case "$usethreads" in
14223 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14224 esac
90e831dc
SB
14225 d_getservbyname_r=undef
14226 getservbyname_r_proto=0
c18e646a 14227 ;;
a48ec845
JH
14228 esac
14229 ;;
10bc17b6
JH
14230*) getservbyname_r_proto=0
14231 ;;
14232esac
14233
14234: see if getservbyport_r exists
14235set getservbyport_r d_getservbyport_r
14236eval $inlibc
14237case "$d_getservbyport_r" in
14238"$define")
14239 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14240 case "$d_getservbyport_r_proto:$usethreads" in
14241 ":define") d_getservbyport_r_proto=define
a48ec845
JH
14242 set d_getservbyport_r_proto getservbyport_r $hdrs
14243 eval $hasproto ;;
14244 *) ;;
14245 esac
14246 case "$d_getservbyport_r_proto" in
14247 define)
10bc17b6
JH
14248 case "$getservbyport_r_proto" in
14249 ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14250 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14251 esac
14252 case "$getservbyport_r_proto" in
14253 ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14254 ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14255 esac
14256 case "$getservbyport_r_proto" in
14257 ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14258 ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14259 esac
14260 case "$getservbyport_r_proto" in
90e831dc 14261 ''|0) d_getservbyport_r=undef
10bc17b6 14262 getservbyport_r_proto=0
a48ec845 14263 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14264 * ) case "$getservbyport_r_proto" in
14265 REENTRANT_PROTO*) ;;
14266 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14267 esac
14268 echo "Prototype: $try" ;;
14269 esac
14270 ;;
c18e646a
JH
14271 *) case "$usethreads" in
14272 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14273 esac
90e831dc
SB
14274 d_getservbyport_r=undef
14275 getservbyport_r_proto=0
c18e646a 14276 ;;
a48ec845
JH
14277 esac
14278 ;;
10bc17b6
JH
14279*) getservbyport_r_proto=0
14280 ;;
14281esac
14282
14283: see if getservent_r exists
14284set getservent_r d_getservent_r
14285eval $inlibc
14286case "$d_getservent_r" in
14287"$define")
14288 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
14289 case "$d_getservent_r_proto:$usethreads" in
14290 ":define") d_getservent_r_proto=define
a48ec845
JH
14291 set d_getservent_r_proto getservent_r $hdrs
14292 eval $hasproto ;;
14293 *) ;;
14294 esac
14295 case "$d_getservent_r_proto" in
14296 define)
10bc17b6
JH
14297 case "$getservent_r_proto" in
14298 ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14299 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14300 esac
14301 case "$getservent_r_proto" in
14302 ''|0) try='int getservent_r(struct servent*, char*, int);'
14303 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14304 esac
14305 case "$getservent_r_proto" in
14306 ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14307 ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14308 esac
14309 case "$getservent_r_proto" in
14310 ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14311 ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14312 esac
14313 case "$getservent_r_proto" in
90e831dc 14314 ''|0) d_getservent_r=undef
10bc17b6 14315 getservent_r_proto=0
a48ec845 14316 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14317 * ) case "$getservent_r_proto" in
14318 REENTRANT_PROTO*) ;;
14319 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14320 esac
14321 echo "Prototype: $try" ;;
14322 esac
14323 ;;
c18e646a
JH
14324 *) case "$usethreads" in
14325 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14326 esac
90e831dc
SB
14327 d_getservent_r=undef
14328 getservent_r_proto=0
c18e646a 14329 ;;
a48ec845
JH
14330 esac
14331 ;;
10bc17b6
JH
14332*) getservent_r_proto=0
14333 ;;
14334esac
14335
b4eb6b3d
JH
14336: see if prototypes for various getservxxx netdb.h functions are available
14337echo " "
14338set d_getservprotos getservent $i_netdb netdb.h
14339eval $hasproto
14340
14341: see if getspnam exists
14342set getspnam d_getspnam
14343eval $inlibc
14344
10bc17b6
JH
14345: see if this is a shadow.h system
14346set shadow.h i_shadow
14347eval $inhdr
14348
14349: see if getspnam_r exists
14350set getspnam_r d_getspnam_r
14351eval $inlibc
14352case "$d_getspnam_r" in
14353"$define")
14354 hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
c18e646a
JH
14355 case "$d_getspnam_r_proto:$usethreads" in
14356 ":define") d_getspnam_r_proto=define
a48ec845
JH
14357 set d_getspnam_r_proto getspnam_r $hdrs
14358 eval $hasproto ;;
14359 *) ;;
14360 esac
14361 case "$d_getspnam_r_proto" in
14362 define)
10bc17b6
JH
14363 case "$getspnam_r_proto" in
14364 ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14365 ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14366 esac
14367 case "$getspnam_r_proto" in
14368 ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14369 ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14370 esac
14371 case "$getspnam_r_proto" in
90e831dc 14372 ''|0) d_getspnam_r=undef
10bc17b6 14373 getspnam_r_proto=0
a48ec845 14374 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14375 * ) case "$getspnam_r_proto" in
14376 REENTRANT_PROTO*) ;;
14377 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14378 esac
14379 echo "Prototype: $try" ;;
14380 esac
14381 ;;
c18e646a
JH
14382 *) case "$usethreads" in
14383 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14384 esac
90e831dc
SB
14385 d_getspnam_r=undef
14386 getspnam_r_proto=0
c18e646a 14387 ;;
a48ec845
JH
14388 esac
14389 ;;
10bc17b6
JH
14390*) getspnam_r_proto=0
14391 ;;
14392esac
14393
b4eb6b3d
JH
14394: see if gettimeofday or ftime exists
14395set gettimeofday d_gettimeod
14396eval $inlibc
14397case "$d_gettimeod" in
14398"$undef")
14399 set ftime d_ftime
14400 eval $inlibc
14401 ;;
14402*)
14403 val="$undef"; set d_ftime; eval $setvar
14404 ;;
14405esac
14406case "$d_gettimeod$d_ftime" in
14407"$undef$undef")
14408 echo " "
14409 echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14410 ;;
14411esac
14412
10bc17b6
JH
14413: see if gmtime_r exists
14414set gmtime_r d_gmtime_r
14415eval $inlibc
14416case "$d_gmtime_r" in
14417"$define")
d63eadf0 14418 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14419 case "$d_gmtime_r_proto:$usethreads" in
14420 ":define") d_gmtime_r_proto=define
a48ec845
JH
14421 set d_gmtime_r_proto gmtime_r $hdrs
14422 eval $hasproto ;;
14423 *) ;;
14424 esac
14425 case "$d_gmtime_r_proto" in
14426 define)
10bc17b6
JH
14427 case "$gmtime_r_proto" in
14428 ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14429 ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14430 esac
14431 case "$gmtime_r_proto" in
14432 ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14433 ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14434 esac
14435 case "$gmtime_r_proto" in
90e831dc 14436 ''|0) d_gmtime_r=undef
10bc17b6 14437 gmtime_r_proto=0
a48ec845 14438 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14439 * ) case "$gmtime_r_proto" in
14440 REENTRANT_PROTO*) ;;
14441 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14442 esac
14443 echo "Prototype: $try" ;;
14444 esac
b4eb6b3d 14445 ;;
c18e646a
JH
14446 *) case "$usethreads" in
14447 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14448 esac
90e831dc
SB
14449 d_gmtime_r=undef
14450 gmtime_r_proto=0
c18e646a 14451 ;;
a48ec845
JH
14452 esac
14453 ;;
10bc17b6 14454*) gmtime_r_proto=0
b4eb6b3d
JH
14455 ;;
14456esac
14457
14458: see if hasmntopt exists
14459set hasmntopt d_hasmntopt
14460eval $inlibc
14461
14462: see if this is a netinet/in.h or sys/in.h system
14463set netinet/in.h i_niin sys/in.h i_sysin
14464eval $inhdr
14465
14466: see if arpa/inet.h has to be included
14467set arpa/inet.h i_arpainet
14468eval $inhdr
14469
14470: see if htonl --and friends-- exists
14471val=''
14472set htonl val
14473eval $inlibc
14474
14475: Maybe they are macros.
14476case "$val" in
14477$undef)
14478 $cat >htonl.c <<EOM
14479#include <stdio.h>
14480#include <sys/types.h>
14481#$i_niin I_NETINET_IN
14482#$i_sysin I_SYS_IN
14483#$i_arpainet I_ARPA_INET
14484#ifdef I_NETINET_IN
14485#include <netinet/in.h>
14486#endif
14487#ifdef I_SYS_IN
14488#include <sys/in.h>
14489#endif
14490#ifdef I_ARPA_INET
14491#include <arpa/inet.h>
14492#endif
14493#ifdef htonl
14494printf("Defined as a macro.");
14495#endif
14496EOM
14497 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14498 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14499 val="$define"
14500 echo "But it seems to be defined as a macro." >&4
14501 fi
14502 $rm -f htonl.?
14503 ;;
14504esac
14505set d_htonl
14506eval $setvar
14507
36adc09b
JH
14508: see if ilogbl exists
14509set ilogbl d_ilogbl
14510eval $inlibc
14511
b4eb6b3d
JH
14512: index or strchr
14513echo " "
14514if set index val -f; eval $csym; $val; then
14515 if set strchr val -f d_strchr; eval $csym; $val; then
14516 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14517 val="$define"
14518 vali="$undef"
14519 echo "strchr() found." >&4
14520 else
14521 val="$undef"
14522 vali="$define"
14523 echo "index() found." >&4
14524 fi
14525 else
14526 val="$undef"
14527 vali="$define"
8dfa8df9
JH
14528 echo "index() found." >&4
14529 fi
b4eb6b3d 14530else
8dfa8df9
JH
14531 if set strchr val -f d_strchr; eval $csym; $val; then
14532 val="$define"
14533 vali="$undef"
14534 echo "strchr() found." >&4
14535 else
14536 echo "No index() or strchr() found!" >&4
14537 val="$undef"
14538 vali="$undef"
14539 fi
b4eb6b3d 14540fi
8dfa8df9
JH
14541set d_strchr; eval $setvar
14542val="$vali"
14543set d_index; eval $setvar
14544
14545: check whether inet_aton exists
14546set inet_aton d_inetaton
14547eval $inlibc
b4eb6b3d
JH
14548
14549: Look for isascii
14550echo " "
36adc09b 14551$cat >isascii.c <<EOCP
b4eb6b3d
JH
14552#include <stdio.h>
14553#include <ctype.h>
55954f19
JH
14554#$i_stdlib I_STDLIB
14555#ifdef I_STDLIB
14556#include <stdlib.h>
14557#endif
b4eb6b3d
JH
14558int main() {
14559 int c = 'A';
14560 if (isascii(c))
14561 exit(0);
14562 else
14563 exit(1);
14564}
14565EOCP
14566set isascii
14567if eval $compile; then
14568 echo "isascii() found." >&4
14569 val="$define"
14570else
14571 echo "isascii() NOT found." >&4
14572 val="$undef"
14573fi
14574set d_isascii
14575eval $setvar
14576$rm -f isascii*
14577
758a5d79
JH
14578: see if isfinite exists
14579set isfinite d_isfinite
14580eval $inlibc
14581
14582: see if isinf exists
14583set isinf d_isinf
14584eval $inlibc
14585
b4eb6b3d
JH
14586: see if isnan exists
14587set isnan d_isnan
14588eval $inlibc
14589
14590: see if isnanl exists
14591set isnanl d_isnanl
14592eval $inlibc
14593
14594: see if killpg exists
14595set killpg d_killpg
14596eval $inlibc
14597
14598: see if lchown exists
14599echo " "
14600$cat > try.c <<'EOCP'
14601/* System header to define __stub macros and hopefully few prototypes,
14602 which can conflict with char lchown(); below. */
14603#include <assert.h>
14604/* Override any gcc2 internal prototype to avoid an error. */
14605/* We use char because int might match the return type of a gcc2
14606 builtin and then its argument prototype would still apply. */
14607char lchown();
14608int main() {
14609 /* The GNU C library defines this for functions which it implements
14610 to always fail with ENOSYS. Some functions are actually named
14611 something starting with __ and the normal name is an alias. */
14612#if defined (__stub_lchown) || defined (__stub___lchown)
14613choke me
14614#else
14615lchown();
14616#endif
14617; return 0; }
14618EOCP
14619set try
14620if eval $compile; then
14621 $echo "lchown() found." >&4
14622 val="$define"
14623else
14624 $echo "lchown() NOT found." >&4
14625 val="$undef"
14626fi
14627set d_lchown
14628eval $setvar
14629
14630: See if number of significant digits in a double precision number is known
14631echo " "
14632$cat >ldbl_dig.c <<EOM
14633#$i_limits I_LIMITS
14634#$i_float I_FLOAT
14635#ifdef I_LIMITS
14636#include <limits.h>
14637#endif
14638#ifdef I_FLOAT
14639#include <float.h>
14640#endif
14641#ifdef LDBL_DIG
14642printf("Contains LDBL_DIG");
14643#endif
14644EOM
14645$cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14646if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14647 echo "LDBL_DIG found." >&4
14648 val="$define"
14649else
14650 echo "LDBL_DIG NOT found." >&4
14651 val="$undef"
14652fi
14653$rm -f ldbl_dig.?
14654set d_ldbl_dig
14655eval $setvar
14656
0a0abfba
MB
14657: see if this is a math.h system
14658set math.h i_math
14659eval $inhdr
14660
14661d_libm_lib_version="$undef"
14662case $i_math in
14663 $define)
14664 : check to see if math.h defines _LIB_VERSION
14665 echo " "
14666 echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14667 $cat >try.c <<EOCP
14668#include <unistd.h>
14669#include <math.h>
14670int main (int argc, char *argv[])
14671{
14672 printf ("%d\n", _LIB_VERSION);
14673 return (0);
14674 } /* main */
14675EOCP
14676 set try
14677 if eval $compile; then
14678 foo=`$run ./try`
14679 echo "Yes, it does ($foo)" >&4
14680 d_libm_lib_version="$define"
14681 else
4dd8f9b3 14682 echo "No, it does not (probably harmless)" >&4
0a0abfba 14683 fi
5b813a60 14684 $rm_try
0a0abfba
MB
14685 ;;
14686
14687 esac
14688
b4eb6b3d
JH
14689: see if link exists
14690set link d_link
14691eval $inlibc
14692
10bc17b6
JH
14693: see if localtime_r exists
14694set localtime_r d_localtime_r
14695eval $inlibc
14696case "$d_localtime_r" in
14697"$define")
d63eadf0 14698 hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
c18e646a
JH
14699 case "$d_localtime_r_proto:$usethreads" in
14700 ":define") d_localtime_r_proto=define
a48ec845
JH
14701 set d_localtime_r_proto localtime_r $hdrs
14702 eval $hasproto ;;
14703 *) ;;
14704 esac
14705 case "$d_localtime_r_proto" in
14706 define)
10bc17b6
JH
14707 case "$localtime_r_proto" in
14708 ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14709 ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14710 esac
14711 case "$localtime_r_proto" in
14712 ''|0) try='int localtime_r(const time_t*, struct tm*);'
14713 ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14714 esac
14715 case "$localtime_r_proto" in
90e831dc 14716 ''|0) d_localtime_r=undef
10bc17b6 14717 localtime_r_proto=0
a48ec845 14718 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
14719 * ) case "$localtime_r_proto" in
14720 REENTRANT_PROTO*) ;;
14721 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14722 esac
14723 echo "Prototype: $try" ;;
14724 esac
14725 ;;
c18e646a
JH
14726 *) case "$usethreads" in
14727 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14728 esac
90e831dc
SB
14729 d_localtime_r=undef
14730 localtime_r_proto=0
c18e646a 14731 ;;
a48ec845
JH
14732 esac
14733 ;;
10bc17b6
JH
14734*) localtime_r_proto=0
14735 ;;
14736esac
14737
8572b25d
BH
14738: see if localtime_r calls tzset
14739case "$localtime_r_proto" in
14740REENTRANT_PROTO*)
14741 $cat >try.c <<EOCP
14742/* Does our libc's localtime_r call tzset ?
14743 * return 0 if so, 1 otherwise.
14744 */
14745#include <sys/types.h>
14746#include <unistd.h>
14747#include <time.h>
14748#include <string.h>
14749#include <malloc.h>
14750int main()
14751{
14752 time_t t = time(0L);
14753 char w_tz[]="TZ" "=GMT+5",
14754 e_tz[]="TZ" "=GMT-5",
14755 *tz_e = (char*)malloc(16),
14756 *tz_w = (char*)malloc(16);
14757 struct tm tm_e, tm_w;
14758 memset(&tm_e,'\0',sizeof(struct tm));
14759 memset(&tm_w,'\0',sizeof(struct tm));
14760 strcpy(tz_e,e_tz);
14761 strcpy(tz_w,w_tz);
14762
14763 putenv(tz_e);
14764 localtime_r(&t, &tm_e);
14765
14766 putenv(tz_w);
14767 localtime_r(&t, &tm_w);
14768
14769 if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14770 return 1;
14771 return 0;
14772}
14773EOCP
14774 set try
14775 if eval $compile; then
43dddb59 14776 if $run ./try; then
8572b25d
BH
14777 d_localtime_r_needs_tzset=undef;
14778 else
14779 d_localtime_r_needs_tzset=define;
14780 fi;
14781 else
14782 d_localtime_r_needs_tzset=undef;
14783 fi;
14784 ;;
14785 *)
14786 d_localtime_r_needs_tzset=undef;
14787 ;;
14788esac
5b813a60 14789$rm_try
8572b25d 14790
b4eb6b3d
JH
14791: see if localeconv exists
14792set localeconv d_locconv
14793eval $inlibc
14794
14795: see if lockf exists
14796set lockf d_lockf
14797eval $inlibc
14798
b4eb6b3d
JH
14799: see if prototype for lseek is available
14800echo " "
4786929f 14801set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
b4eb6b3d
JH
14802eval $hasproto
14803
14804: see if lstat exists
14805set lstat d_lstat
14806eval $inlibc
14807
14808: see if madvise exists
14809set madvise d_madvise
14810eval $inlibc
14811
7dd121ae
MB
14812: see if malloc_size exists
14813set malloc_size d_malloc_size
14814eval $inlibc
14815
14816: see if malloc_size_good exists
14817set malloc_good_size d_malloc_good_size
14818eval $inlibc
14819
b4eb6b3d
JH
14820: see if mblen exists
14821set mblen d_mblen
14822eval $inlibc
14823
14824: see if mbstowcs exists
14825set mbstowcs d_mbstowcs
14826eval $inlibc
14827
14828: see if mbtowc exists
14829set mbtowc d_mbtowc
14830eval $inlibc
14831
14832: see if memchr exists
14833set memchr d_memchr
14834eval $inlibc
14835
14836: see if memcmp exists
14837set memcmp d_memcmp
14838eval $inlibc
14839
14840: see if memcpy exists
14841set memcpy d_memcpy
14842eval $inlibc
14843
14844: see if memmove exists
14845set memmove d_memmove
14846eval $inlibc
14847
14848: see if memset exists
14849set memset d_memset
14850eval $inlibc
14851
14852: see if mkdir exists
14853set mkdir d_mkdir
14854eval $inlibc
14855
14856: see if mkdtemp exists
14857set mkdtemp d_mkdtemp
14858eval $inlibc
14859
14860: see if mkfifo exists
14861set mkfifo d_mkfifo
14862eval $inlibc
14863
14864: see if mkstemp exists
14865set mkstemp d_mkstemp
14866eval $inlibc
14867
14868: see if mkstemps exists
14869set mkstemps d_mkstemps
14870eval $inlibc
14871
14872: see if mktime exists
14873set mktime d_mktime
14874eval $inlibc
14875
14876: see if this is a sys/mman.h system
14877set sys/mman.h i_sysmman
14878eval $inhdr
14879
14880: see if mmap exists
14881set mmap d_mmap
14882eval $inlibc
14883: see what shmat returns
14884: default to something harmless
14885mmaptype='void *'
14886case "$i_sysmman$d_mmap" in
14887"$define$define")
14888 $cat >mmap.c <<'END'
14889#include <sys/mman.h>
14890void *mmap();
14891END
14892 if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14893 mmaptype='void *'
14894 else
14895 mmaptype='caddr_t'
14896 fi
14897 echo "and it returns ($mmaptype)." >&4
14898 ;;
14899esac
14900
14901
14902
89ce900e
JH
14903: see if sqrtl exists
14904set sqrtl d_sqrtl
14905eval $inlibc
14906
af1ff193
JH
14907: see if scalbnl exists
14908set scalbnl d_scalbnl
14909eval $inlibc
14910
89ce900e
JH
14911: see if modfl exists
14912set modfl d_modfl
14913eval $inlibc
14914
14915: see if prototype for modfl is available
14916echo " "
3a794506 14917set d_modflproto modfl $i_math math.h
89ce900e
JH
14918eval $hasproto
14919
14920d_modfl_pow32_bug="$undef"
14921
14922case "$d_longdbl$d_modfl" in
14923$define$define)
14924 $cat <<EOM
14925Checking to see whether your modfl() is okay for large values...
14926EOM
14927$cat >try.c <<EOCP
5b813a60 14928#include <math.h>
89ce900e
JH
14929#include <stdio.h>
14930EOCP
14931if $test "X$d_modflproto" != "X$define"; then
14932 $cat >>try.c <<EOCP
5b813a60 14933/* Sigh. many current glibcs provide the function, but do not prototype it. */
89ce900e
JH
14934long double modfl (long double, long double *);
14935EOCP
14936fi
14937$cat >>try.c <<EOCP
14938int main() {
14939 long double nv = 4294967303.15;
14940 long double v, w;
5b813a60 14941 v = modfl(nv, &w);
89ce900e
JH
14942#ifdef __GLIBC__
14943 printf("glibc");
14944#endif
14945 printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14946 return 0;
14947}
14948EOCP
14949 case "$osname:$gccversion" in
14950 aix:) saveccflags="$ccflags"
14951 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14952 esac
14953 set try
14954 if eval $compile; then
14955 foo=`$run ./try`
14956 case "$foo" in
14957 *" 4294967303.150000 1.150000 4294967302.000000")
14958 echo >&4 "Your modfl() is broken for large values."
14959 d_modfl_pow32_bug="$define"
14960 case "$foo" in
14961 glibc) echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14962 ;;
14963 esac
14964 ;;
14965 *" 4294967303.150000 0.150000 4294967303.000000")
14966 echo >&4 "Your modfl() seems okay for large values."
14967 ;;
14968 *) echo >&4 "I don't understand your modfl() at all."
14969 d_modfl="$undef"
14970 ;;
14971 esac
5b813a60 14972 $rm_try
89ce900e
JH
14973 else
14974 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14975 d_modfl="$undef"
14976 fi
14977 case "$osname:$gccversion" in
14978 aix:) ccflags="$saveccflags" ;; # restore
14979 esac
14980 ;;
14981esac
14982
14983if $test "$uselongdouble" = "$define"; then
af1ff193
JH
14984 message=""
14985 if $test "$d_sqrtl" != "$define"; then
14986 message="$message sqrtl"
14987 fi
14988 if $test "$d_modfl" != "$define"; then
89ce900e
JH
14989 if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14990 echo "You have both aintl and copysignl, so I can emulate modfl."
14991 else
af1ff193 14992 message="$message modfl"
89ce900e 14993 fi
af1ff193
JH
14994 fi
14995 if $test "$d_frexpl" != "$define"; then
14996 if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14997 echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14998 else
14999 message="$message frexpl"
15000 fi
15001 fi
89ce900e 15002
af1ff193 15003 if $test "$message" != ""; then
89ce900e
JH
15004 $cat <<EOM >&4
15005
15006*** You requested the use of long doubles but you do not seem to have
af1ff193
JH
15007*** the following mathematical functions needed for long double support:
15008*** $message
fe63a0b4
JH
15009*** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15010*** Cannot continue, aborting.
89ce900e
JH
15011
15012EOM
15013
fe63a0b4 15014 exit 1
89ce900e
JH
15015 fi
15016fi
15017
b4eb6b3d
JH
15018: see if mprotect exists
15019set mprotect d_mprotect
15020eval $inlibc
15021
15022: see if msgctl exists
15023set msgctl d_msgctl
15024eval $inlibc
15025
15026: see if msgget exists
15027set msgget d_msgget
15028eval $inlibc
15029
15030: see if msgsnd exists
15031set msgsnd d_msgsnd
15032eval $inlibc
15033
15034: see if msgrcv exists
15035set msgrcv d_msgrcv
15036eval $inlibc
15037
15038: see how much of the 'msg*(2)' library is present.
15039h_msg=true
15040echo " "
15041case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15042*"$undef"*) h_msg=false;;
15043esac
15044case "$osname" in
15045freebsd)
15046 case "`ipcs 2>&1`" in
15047 "SVID messages"*"not configured"*)
15048 echo "Your $osname does not have the msg*(2) configured." >&4
15049 h_msg=false
15050 val="$undef"
15051 set msgctl d_msgctl
15052 eval $setvar
15053 set msgget d_msgget
15054 eval $setvar
15055 set msgsnd d_msgsnd
15056 eval $setvar
15057 set msgrcv d_msgrcv
15058 eval $setvar
15059 ;;
15060 esac
15061 ;;
15062esac
15063: we could also check for sys/ipc.h ...
15064if $h_msg && $test `./findhdr sys/msg.h`; then
15065 echo "You have the full msg*(2) library." >&4
15066 val="$define"
15067else
15068 echo "You don't have the full msg*(2) library." >&4
15069 val="$undef"
15070fi
15071set d_msg
15072eval $setvar
15073
4e0554ec
JH
15074
15075echo " "
15076echo "Checking to see if your system supports struct msghdr..." >&4
15077set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15078eval $hasstruct
15079case "$d_msghdr_s" in
15080"$define") echo "Yes, it does." ;;
15081*) echo "No, it doesn't." ;;
15082esac
15083
15084
b4eb6b3d
JH
15085: see if msync exists
15086set msync d_msync
15087eval $inlibc
15088
15089: see if munmap exists
15090set munmap d_munmap
15091eval $inlibc
15092
15093: see if nice exists
15094set nice d_nice
15095eval $inlibc
15096
2765b840
JH
15097: see if this is a langinfo.h system
15098set langinfo.h i_langinfo
15099eval $inhdr
15100
15101: see if nl_langinfo exists
15102set nl_langinfo d_nl_langinfo
15103eval $inlibc
15104
1d1be0dc
NC
15105: check for volatile keyword
15106echo " "
15107echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15108$cat >try.c <<'EOCP'
76f47787 15109int main()
1d1be0dc
NC
15110{
15111 typedef struct _goo_struct goo_struct;
15112 goo_struct * volatile goo = ((goo_struct *)0);
15113 struct _goo_struct {
15114 long long_int;
15115 int reg_int;
15116 char char_var;
15117 };
15118 typedef unsigned short foo_t;
15119 char *volatile foo;
15120 volatile int bar;
15121 volatile foo_t blech;
15122 foo = foo;
15123}
15124EOCP
15125if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15126 val="$define"
15127 echo "Yup, it does."
15128else
15129 val="$undef"
15130 echo "Nope, it doesn't."
15131fi
15132set d_volatile
15133eval $setvar
5b813a60 15134$rm_try
1d1be0dc 15135
b4eb6b3d
JH
15136
15137echo " "
15138$echo "Choosing the C types to be used for Perl's internal types..." >&4
15139
15140case "$use64bitint:$d_quad:$quadtype" in
15141define:define:?*)
15142 ivtype="$quadtype"
15143 uvtype="$uquadtype"
15144 ivsize=8
15145 uvsize=8
15146 ;;
15147*) ivtype="long"
15148 uvtype="unsigned long"
15149 ivsize=$longsize
15150 uvsize=$longsize
15151 ;;
15152esac
15153
15154case "$uselongdouble:$d_longdbl" in
15155define:define)
15156 nvtype="long double"
15157 nvsize=$longdblsize
15158 ;;
15159*) nvtype=double
15160 nvsize=$doublesize
15161 ;;
15162esac
15163
15164$echo "(IV will be "$ivtype", $ivsize bytes)"
15165$echo "(UV will be "$uvtype", $uvsize bytes)"
15166$echo "(NV will be "$nvtype", $nvsize bytes)"
15167
15168$cat >try.c <<EOCP
15169#$i_inttypes I_INTTYPES
15170#ifdef I_INTTYPES
15171#include <inttypes.h>
15172#endif
15173#include <stdio.h>
15174int main() {
15175#ifdef INT8
15176 int8_t i = INT8_MAX;
15177 uint8_t u = UINT8_MAX;
15178 printf("int8_t\n");
15179#endif
15180#ifdef INT16
15181 int16_t i = INT16_MAX;
15182 uint16_t i = UINT16_MAX;
15183 printf("int16_t\n");
15184#endif
15185#ifdef INT32
15186 int32_t i = INT32_MAX;
15187 uint32_t u = UINT32_MAX;
15188 printf("int32_t\n");
15189#endif
15190}
15191EOCP
15192
0ab0821a
MB
15193i8type=char
15194u8type="unsigned char"
15195i8size=1
15196u8size=1
b4eb6b3d
JH
15197
15198case "$i16type" in
15199'') case "$shortsize" in
15200 2) i16type=short
15201 u16type="unsigned short"
15202 i16size=$shortsize
15203 u16size=$shortsize
15204 ;;
15205 esac
15206 ;;
15207esac
15208case "$i16type" in
15209'') set try -DINT16
15210 if eval $compile; then
5440bc8e 15211 case "`$run ./try`" in
b4eb6b3d
JH
15212 int16_t)
15213 i16type=int16_t
15214 u16type=uint16_t
15215 i16size=2
15216 u16size=2
15217 ;;
15218 esac
15219 fi
15220 ;;
15221esac
15222case "$i16type" in
15223'') if $test $shortsize -ge 2; then
15224 i16type=short
15225 u16type="unsigned short"
15226 i16size=$shortsize
15227 u16size=$shortsize
15228 fi
15229 ;;
15230esac
15231
15232case "$i32type" in
15233'') case "$longsize" in
15234 4) i32type=long
15235 u32type="unsigned long"
15236 i32size=$longsize
15237 u32size=$longsize
15238 ;;
15239 *) case "$intsize" in
15240 4) i32type=int
15241 u32type="unsigned int"
15242 i32size=$intsize
15243 u32size=$intsize
15244 ;;
15245 esac
15246 ;;
15247 esac
15248 ;;
15249esac
15250case "$i32type" in
15251'') set try -DINT32
15252 if eval $compile; then
5440bc8e 15253 case "`$run ./try`" in
b4eb6b3d
JH
15254 int32_t)
15255 i32type=int32_t
15256 u32type=uint32_t
15257 i32size=4
15258 u32size=4
15259 ;;
15260 esac
15261 fi
15262 ;;
15263esac
15264case "$i32type" in
15265'') if $test $intsize -ge 4; then
15266 i32type=int
15267 u32type="unsigned int"
15268 i32size=$intsize
15269 u32size=$intsize
15270 fi
15271 ;;
15272esac
15273
15274case "$i64type" in
15275'') case "$d_quad:$quadtype" in
15276 define:?*)
15277 i64type="$quadtype"
15278 u64type="$uquadtype"
15279 i64size=8
15280 u64size=8
15281 ;;
15282 esac
15283 ;;
15284esac
15285
1d1be0dc
NC
15286$echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15287: volatile so that the compiler has to store it out to memory.
15288if test X"$d_volatile" = X"$define"; then
15289 volatile=volatile
15290fi
b4eb6b3d
JH
15291$cat <<EOP >try.c
15292#include <stdio.h>
55954f19
JH
15293#$i_stdlib I_STDLIB
15294#ifdef I_STDLIB
15295#include <stdlib.h>
15296#endif
1d1be0dc
NC
15297#include <sys/types.h>
15298#include <signal.h>
15299#ifdef SIGFPE
15300$volatile int bletched = 0;
7090f861 15301$signal_t blech(int s) { bletched = 1; }
1d1be0dc 15302#endif
b4eb6b3d
JH
15303int main() {
15304 $uvtype u = 0;
1d1be0dc 15305 $nvtype d;
b4eb6b3d
JH
15306 int n = 8 * $uvsize;
15307 int i;
1d1be0dc
NC
15308#ifdef SIGFPE
15309 signal(SIGFPE, blech);
15310#endif
15311
b4eb6b3d
JH
15312 for (i = 0; i < n; i++) {
15313 u = u << 1 | ($uvtype)1;
1d1be0dc
NC
15314 d = ($nvtype)u;
15315 if (($uvtype)d != u)
b4eb6b3d 15316 break;
1d1be0dc
NC
15317 if (d <= 0)
15318 break;
15319 d = ($nvtype)(u - 1);
15320 if (($uvtype)d != (u - 1))
15321 break;
15322#ifdef SIGFPE
22676560 15323 if (bletched)
1d1be0dc
NC
15324 break;
15325#endif
b4eb6b3d 15326 }
efd1522b 15327 printf("%d\n", ((i == n) ? -n : i));
b4eb6b3d
JH
15328 exit(0);
15329}
15330EOP
1d1be0dc
NC
15331set try
15332
15333d_nv_preserves_uv="$undef"
15334if eval $compile; then
53133ed1 15335 nv_preserves_uv_bits="`$run ./try`"
1d1be0dc 15336fi
53133ed1 15337case "$nv_preserves_uv_bits" in
5b813a60 15338\-[1-9]*)
53133ed1
NC
15339 nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15340 $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc 15341 d_nv_preserves_uv="$define"
b4eb6b3d 15342 ;;
53133ed1 15343[1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs." 2>&1
1d1be0dc
NC
15344 d_nv_preserves_uv="$undef" ;;
15345*) $echo "Can't figure out how many bits your NVs preserve." 2>&1
d6cc064f 15346 nv_preserves_uv_bits="0" ;;
b4eb6b3d 15347esac
5b813a60 15348$rm_try
1d1be0dc 15349
f607920a
CB
15350$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15351: volatile so that the compiler has to store it out to memory.
15352if test X"$d_volatile" = X"$define"; then
15353 volatile=volatile
15354fi
15355$cat <<EOP >try.c
15356#include <stdio.h>
15357#$i_stdlib I_STDLIB
15358#ifdef I_STDLIB
15359#include <stdlib.h>
15360#endif
15361#$i_string I_STRING
15362#ifdef I_STRING
15363# include <string.h>
15364#else
15365# include <strings.h>
15366#endif
15367#include <sys/types.h>
15368#include <signal.h>
15369#ifdef SIGFPE
15370$volatile int bletched = 0;
7090f861 15371$signal_t blech(int s) { bletched = 1; }
f607920a
CB
15372#endif
15373
15374int checkit($nvtype d, char *where) {
15375 unsigned char *p = (char *)&d;
15376 unsigned char *end = p + sizeof(d);
15377 int fail = 0;
15378
15379 while (p < end)
15380 fail += *p++;
15381
15382 if (!fail)
17f6277d 15383 return 0;
f607920a
CB
15384
15385 p = (char *)&d;
15386 printf("No - %s: 0x", where);
15387 while (p < end)
15388 printf ("%02X", *p++);
15389 printf("\n");
15390 return 1;
15391}
15392
15393int main(int argc, char **argv) {
15394 $nvtype d = 0.0;
15395 int fail = 0;
15396 fail += checkit(d, "0.0");
15397
15398 /* The compiler shouldn't be assuming that bletched is 0 */
15399 d = bletched;
15400
15401 fail += checkit(d, "bleched");
15402
15403#ifdef SIGFPE
15404 signal(SIGFPE, blech);
15405#endif
15406
15407 /* Paranoia - the compiler should have no way of knowing that ANSI says
15408 that argv[argc] will always be NULL. Actually, if it did assume this it
15409 would be buggy, as this is C and main() can be called from elsewhere in
15410 the program. */
15411 d = argv[argc] ? 1 : 0;
15412
15413 if (d) {
15414 printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15415 }
15416
15417 fail += checkit(d, "ternary");
15418
15419 memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15420
15421 if (d != 0.0) {
15422 printf("No - memset doesn't give 0.0\n");
15423 /* This might just blow up: */
15424 printf("(gives %g)\n", d);
15425 return 1;
15426 }
5b813a60 15427
f607920a
CB
15428#ifdef SIGFPE
15429 if (bletched) {
15430 printf("No - something bleched\n");
15431 return 1;
15432 }
15433#endif
15434 if (fail) {
15435 printf("No - %d fail(s)\n", fail);
15436 return 1;
15437 }
15438 printf("Yes\n");
15439 return 0;
15440}
15441EOP
15442set try
15443
15444d_nv_zero_is_allbits_zero="$undef"
15445if eval $compile; then
15446 xxx="`$run ./try`"
15447 case "$?" in
15448 0)
15449 case "$xxx" in
15450 Yes) cat >&4 <<EOM
154510.0 is represented as all bits zero in memory
15452EOM
15453 d_nv_zero_is_allbits_zero="$define"
15454 ;;
15455 *) cat >&4 <<EOM
154560.0 is not represented as all bits zero in memory
15457EOM
15458 d_nv_zero_is_allbits_zero="$undef"
15459 ;;
15460 esac
15461 ;;
15462 *) cat >&4 <<EOM
154630.0 is not represented as all bits zero in memory
15464EOM
15465 d_nv_zero_is_allbits_zero="$undef"
15466 ;;
15467 esac
15468fi
5b813a60 15469$rm_try
b4eb6b3d
JH
15470
15471: check for off64_t
15472echo " "
15473echo "Checking to see if you have off64_t..." >&4
15474$cat >try.c <<EOCP
15475#include <sys/types.h>
15476#include <unistd.h>
15477int main() { off64_t x = 7; }
15478EOCP
15479set try
15480if eval $compile; then
15481 val="$define"
15482 echo "You have off64_t."
15483else
15484 val="$undef"
15485 echo "You do not have off64_t."
15486 case "$lseeksize" in
15487 8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15488 esac
15489fi
5b813a60 15490$rm_try
b4eb6b3d
JH
15491set d_off64_t
15492eval $setvar
15493
b4eb6b3d
JH
15494: how to create joinable pthreads
15495if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15496 echo " "
5b813a60 15497 echo "Checking what constant to use for creating joinable pthreads..." >&4
b4eb6b3d
JH
15498 $cat >try.c <<'EOCP'
15499#include <pthread.h>
15500int main() {
15501 int detachstate = JOINABLE;
15502}
15503EOCP
15504 set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15505 if eval $compile; then
15506 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15507 val="$undef" # Yes, undef.
15508 set d_old_pthread_create_joinable
15509 eval $setvar
15510 val=""
15511 set old_pthread_create_joinable
15512 eval $setvar
15513 else
15514 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15515 if eval $compile; then
15516 echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15517 val="$define"
15518 set d_old_pthread_create_joinable
15519 eval $setvar
15520 val=PTHREAD_CREATE_UNDETACHED
15521 set old_pthread_create_joinable
15522 eval $setvar
5b813a60 15523 else
b4eb6b3d
JH
15524 set try -DJOINABLE=__UNDETACHED
15525 if eval $compile; then
15526 echo "You seem to use __UNDETACHED." >&4
15527 val="$define"
15528 set d_old_pthread_create_joinable
15529 eval $setvar
15530 val=__UNDETACHED
15531 set old_pthread_create_joinable
15532 eval $setvar
15533 else
15534 echo "Egads, nothing obvious found. Guessing that you use 0." >&4
15535 val="$define"
15536 set d_old_pthread_create_joinable
15537 eval $setvar
15538 val=0
15539 set old_pthread_create_joinable
15540 eval $setvar
15541 fi
15542 fi
15543 fi
5b813a60 15544 $rm_try
b4eb6b3d
JH
15545else
15546 d_old_pthread_create_joinable="$undef"
15547 old_pthread_create_joinable=""
15548fi
15549
15550: see if pause exists
15551set pause d_pause
15552eval $inlibc
15553
b4eb6b3d
JH
15554: see if poll exists
15555set poll d_poll
15556eval $inlibc
15557
c7aff470
NIS
15558: see if readlink exists
15559set readlink d_readlink
15560eval $inlibc
15561
15562echo " "
f24dbf84 15563procselfexe=''
c7aff470 15564val="$undef"
a33c94aa
JH
15565case "$d_readlink" in
15566"$define")
c7aff470
NIS
15567 if $issymlink /proc/self/exe ; then
15568 $ls -l /proc/self/exe > reflect
51660ed5 15569 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
a33c94aa 15570 echo "You have Linux-like /proc/self/exe."
92236451 15571 procselfexe='"/proc/self/exe"'
f24dbf84 15572 val="$define"
f24dbf84
JH
15573 fi
15574 fi
15575 if $issymlink /proc/curproc/file ; then
15576 $ls -l /proc/curproc/file > reflect
15577 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15578 echo "You have BSD-like /proc/curproc/file."
92236451 15579 procselfexe='"/proc/curproc/file"'
f24dbf84 15580 val="$define"
c7aff470 15581 fi
c7aff470 15582 fi
a33c94aa
JH
15583 ;;
15584esac
428dc699 15585$rm -f reflect
c7aff470
NIS
15586set d_procselfexe
15587eval $setvar
15588
233e16ce
MB
15589: backward compatibility for d_hvfork
15590if test X$d_hvfork != X; then
15591 d_vfork="$d_hvfork"
15592 d_hvfork=''
15593fi
15594: see if there is a vfork
15595val=''
15596set vfork val
15597eval $inlibc
15598
15599d_pseudofork=$undef
15600
15601: Ok, but do we want to use it. vfork is reportedly unreliable in
15602: perl on Solaris 2.x, and probably elsewhere.
15603case "$val" in
15604$define)
15605 echo " "
15606 case "$usevfork" in
15607 false) dflt='n';;
15608 *) dflt='y';;
15609 esac
15610 cat <<'EOM'
15611
15612Perl can only use a vfork() that doesn't suffer from strict
15613restrictions on calling functions or modifying global data in
15614the child. For example, glibc-2.1 contains such a vfork()
15615that is unsuitable. If your system provides a proper fork()
15616call, chances are that you do NOT want perl to use vfork().
15617
15618EOM
15619 rp="Do you still want to use vfork()?"
15620 . ./myread
15621 case "$ans" in
15622 y|Y) ;;
15623 *)
15624 echo "Ok, we won't use vfork()."
15625 val="$undef"
15626 ;;
15627 esac
15628 ;;
15629esac
15630set d_vfork
15631eval $setvar
15632case "$d_vfork" in
15633$define) usevfork='true';;
15634*) usevfork='false';;
15635esac
15636
263fee3f
JH
15637: see whether the pthread_atfork exists
15638$cat >try.c <<EOP
15639#include <pthread.h>
15640#include <stdio.h>
15641int main() {
15642#ifdef PTHREAD_ATFORK
15643 pthread_atfork(NULL,NULL,NULL);
15644#endif
15645}
15646EOP
15647
d6483fcc 15648: see if pthread_atfork exists
263fee3f
JH
15649set try -DPTHREAD_ATFORK
15650if eval $compile; then
15651 val="$define"
15652else
15653 val="$undef"
15654fi
15655case "$usethreads" in
15656$define)
15657 case "$val" in
15658 $define) echo 'pthread_atfork found.' >&4 ;;
15659 *) echo 'pthread_atfork NOT found.' >&4 ;;
15660 esac
15661esac
15662set d_pthread_atfork
15663eval $setvar
d6483fcc 15664
58d975c3
JH
15665: see if pthread_attr_setscope exists
15666set pthread_attr_setscope d_pthread_attr_setscope
15667eval $inlibc
15668
b4eb6b3d
JH
15669
15670: see whether the various POSIXish _yields exist
15671$cat >try.c <<EOP
15672#include <pthread.h>
15673#include <stdio.h>
15674int main() {
15675#ifdef SCHED_YIELD
15676 sched_yield();
15677#else
15678#ifdef PTHREAD_YIELD
15679 pthread_yield();
15680#else
15681#ifdef PTHREAD_YIELD_NULL
15682 pthread_yield(NULL);
15683#endif
15684#endif
15685#endif
15686}
15687EOP
15688: see if sched_yield exists
15689set try -DSCHED_YIELD
15690if eval $compile; then
15691 val="$define"
15692 sched_yield='sched_yield()'
15693else
15694 val="$undef"
15695fi
15696case "$usethreads" in
15697$define)
15698 case "$val" in
15699 $define) echo 'sched_yield() found.' >&4 ;;
15700 *) echo 'sched_yield() NOT found.' >&4 ;;
15701 esac
15702esac
10bc17b6
JH
15703set d_sched_yield
15704eval $setvar
b4eb6b3d 15705
10bc17b6
JH
15706: see if pthread_yield exists
15707set try -DPTHREAD_YIELD
15708if eval $compile; then
15709 val="$define"
15710 case "$sched_yield" in
15711 '') sched_yield='pthread_yield()' ;;
15712 esac
15713else
15714 set try -DPTHREAD_YIELD_NULL
15715 if eval $compile; then
15716 val="$define"
15717 case "$sched_yield" in
15718 '') sched_yield='pthread_yield(NULL)' ;;
15719 esac
15720 else
15721 val="$undef"
15722 fi
15723fi
15724case "$usethreads" in
15725$define)
15726 case "$val" in
15727 $define) echo 'pthread_yield() found.' >&4 ;;
15728 *) echo 'pthread_yield() NOT found.' >&4 ;;
15729 esac
15730 ;;
15731esac
15732set d_pthread_yield
15733eval $setvar
10bc17b6
JH
15734case "$sched_yield" in
15735'') sched_yield=undef ;;
15736esac
5b813a60 15737$rm_try
10bc17b6
JH
15738
15739: see if random_r exists
15740set random_r d_random_r
15741eval $inlibc
15742case "$d_random_r" in
15743"$define")
15744 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
15745 case "$d_random_r_proto:$usethreads" in
15746 ":define") d_random_r_proto=define
a48ec845
JH
15747 set d_random_r_proto random_r $hdrs
15748 eval $hasproto ;;
15749 *) ;;
15750 esac
15751 case "$d_random_r_proto" in
15752 define)
10bc17b6
JH
15753 case "$random_r_proto" in
15754 ''|0) try='int random_r(int*, struct random_data*);'
a845a0d4
JH
15755 ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15756 esac
15757 case "$random_r_proto" in
15758 ''|0) try='int random_r(long*, struct random_data*);'
15759 ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15760 esac
15761 case "$random_r_proto" in
15762 ''|0) try='int random_r(struct random_data*, int32_t*);'
15763 ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
10bc17b6
JH
15764 esac
15765 case "$random_r_proto" in
90e831dc 15766 ''|0) d_random_r=undef
10bc17b6 15767 random_r_proto=0
a48ec845 15768 echo "Disabling random_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15769 * ) case "$random_r_proto" in
15770 REENTRANT_PROTO*) ;;
15771 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15772 esac
15773 echo "Prototype: $try" ;;
15774 esac
b4eb6b3d 15775 ;;
c18e646a
JH
15776 *) case "$usethreads" in
15777 define) echo "random_r has no prototype, not using it." >&4 ;;
15778 esac
90e831dc
SB
15779 d_random_r=undef
15780 random_r_proto=0
c18e646a 15781 ;;
a48ec845
JH
15782 esac
15783 ;;
10bc17b6 15784*) random_r_proto=0
b4eb6b3d
JH
15785 ;;
15786esac
15787
15788: see if readdir and friends exist
15789set readdir d_readdir
15790eval $inlibc
15791set seekdir d_seekdir
15792eval $inlibc
15793set telldir d_telldir
15794eval $inlibc
15795set rewinddir d_rewinddir
15796eval $inlibc
15797
10bc17b6
JH
15798: see if readdir64_r exists
15799set readdir64_r d_readdir64_r
15800eval $inlibc
15801case "$d_readdir64_r" in
15802"$define")
15803 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15804 case "$d_readdir64_r_proto:$usethreads" in
15805 ":define") d_readdir64_r_proto=define
a48ec845
JH
15806 set d_readdir64_r_proto readdir64_r $hdrs
15807 eval $hasproto ;;
15808 *) ;;
15809 esac
15810 case "$d_readdir64_r_proto" in
15811 define)
10bc17b6
JH
15812 case "$readdir64_r_proto" in
15813 ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15814 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15815 esac
15816 case "$readdir64_r_proto" in
15817 ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15818 ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15819 esac
15820 case "$readdir64_r_proto" in
90e831dc 15821 ''|0) d_readdir64_r=undef
10bc17b6 15822 readdir64_r_proto=0
a48ec845 15823 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15824 * ) case "$readdir64_r_proto" in
15825 REENTRANT_PROTO*) ;;
15826 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15827 esac
15828 echo "Prototype: $try" ;;
15829 esac
15830 ;;
c18e646a
JH
15831 *) case "$usethreads" in
15832 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15833 esac
90e831dc
SB
15834 d_readdir64_r=undef
15835 readdir64_r_proto=0
c18e646a 15836 ;;
a48ec845
JH
15837 esac
15838 ;;
10bc17b6
JH
15839*) readdir64_r_proto=0
15840 ;;
15841esac
15842
15843: see if readdir_r exists
15844set readdir_r d_readdir_r
15845eval $inlibc
15846case "$d_readdir_r" in
15847"$define")
15848 hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
c18e646a
JH
15849 case "$d_readdir_r_proto:$usethreads" in
15850 ":define") d_readdir_r_proto=define
a48ec845
JH
15851 set d_readdir_r_proto readdir_r $hdrs
15852 eval $hasproto ;;
15853 *) ;;
15854 esac
15855 case "$d_readdir_r_proto" in
15856 define)
10bc17b6
JH
15857 case "$readdir_r_proto" in
15858 ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15859 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15860 esac
15861 case "$readdir_r_proto" in
15862 ''|0) try='int readdir_r(DIR*, struct dirent*);'
15863 ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15864 esac
15865 case "$readdir_r_proto" in
90e831dc 15866 ''|0) d_readdir_r=undef
10bc17b6 15867 readdir_r_proto=0
a48ec845 15868 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
15869 * ) case "$readdir_r_proto" in
15870 REENTRANT_PROTO*) ;;
15871 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15872 esac
15873 echo "Prototype: $try" ;;
15874 esac
15875 ;;
c18e646a
JH
15876 *) case "$usethreads" in
15877 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15878 esac
90e831dc
SB
15879 d_readdir_r=undef
15880 readdir_r_proto=0
c18e646a 15881 ;;
a48ec845
JH
15882 esac
15883 ;;
10bc17b6
JH
15884*) readdir_r_proto=0
15885 ;;
15886esac
15887
4e0554ec
JH
15888: see if readv exists
15889set readv d_readv
15890eval $inlibc
15891
15892: see if recvmsg exists
15893set recvmsg d_recvmsg
15894eval $inlibc
15895
b4eb6b3d
JH
15896: see if rename exists
15897set rename d_rename
15898eval $inlibc
15899
15900: see if rmdir exists
15901set rmdir d_rmdir
15902eval $inlibc
15903
15904: see if memory.h is available.
15905val=''
15906set memory.h val
15907eval $inhdr
15908
15909: See if it conflicts with string.h
15910case "$val" in
15911$define)
15912 case "$strings" in
15913 '') ;;
15914 *)
15915 $cppstdin $cppflags $cppminus < $strings > mem.h
15916 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15917 echo " "
15918 echo "We won't be including <memory.h>."
15919 val="$undef"
15920 fi
15921 $rm -f mem.h
15922 ;;
15923 esac
15924esac
15925set i_memory
15926eval $setvar
15927
15928: can bcopy handle overlapping blocks?
b6cc3bc4 15929echo " "
b4eb6b3d 15930val="$undef"
b6cc3bc4
AD
15931case "$d_memmove" in
15932"$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15933*) case "$d_bcopy" in
15934 "$define")
15935 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15936 $cat >try.c <<EOCP
b4eb6b3d
JH
15937#$i_memory I_MEMORY
15938#$i_stdlib I_STDLIB
15939#$i_string I_STRING
15940#$i_unistd I_UNISTD
15941EOCP
15942 $cat >>try.c <<'EOCP'
15943#include <stdio.h>
15944#ifdef I_MEMORY
15945# include <memory.h>
15946#endif
15947#ifdef I_STDLIB
15948# include <stdlib.h>
15949#endif
15950#ifdef I_STRING
15951# include <string.h>
15952#else
15953# include <strings.h>
15954#endif
15955#ifdef I_UNISTD
15956# include <unistd.h> /* Needed for NetBSD */
15957#endif
15958int main()
15959{
15960char buf[128], abc[128];
15961char *b;
15962int len;
15963int off;
15964int align;
15965
b6cc3bc4
AD
15966/* Copy "abcde..." string to char abc[] so that gcc doesn't
15967 try to store the string in read-only memory. */
b4eb6b3d
JH
15968bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15969
15970for (align = 7; align >= 0; align--) {
15971 for (len = 36; len; len--) {
15972 b = buf+align;
15973 bcopy(abc, b, len);
15974 for (off = 1; off <= len; off++) {
15975 bcopy(b, b+off, len);
15976 bcopy(b+off, b, len);
15977 if (bcmp(b, abc, len))
15978 exit(1);
15979 }
15980 }
15981}
15982exit(0);
15983}
15984EOCP
b6cc3bc4
AD
15985 set try
15986 if eval $compile_ok; then
43dddb59 15987 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
15988 echo "Yes, it can."
15989 val="$define"
15990 else
15991 echo "It can't, sorry."
15992 fi
b4eb6b3d 15993 else
b6cc3bc4 15994 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 15995 fi
b6cc3bc4
AD
15996 ;;
15997 esac
5b813a60 15998 $rm_try
b4eb6b3d
JH
15999 ;;
16000esac
b4eb6b3d
JH
16001set d_safebcpy
16002eval $setvar
16003
16004: can memcpy handle overlapping blocks?
b6cc3bc4 16005echo " "
b4eb6b3d 16006val="$undef"
b6cc3bc4
AD
16007case "$d_memmove" in
16008"$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16009*) case "$d_memcpy" in
16010 "$define")
16011 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16012 $cat >try.c <<EOCP
b4eb6b3d
JH
16013#$i_memory I_MEMORY
16014#$i_stdlib I_STDLIB
16015#$i_string I_STRING
16016#$i_unistd I_UNISTD
16017EOCP
16018 $cat >>try.c <<'EOCP'
16019#include <stdio.h>
16020#ifdef I_MEMORY
16021# include <memory.h>
16022#endif
16023#ifdef I_STDLIB
16024# include <stdlib.h>
16025#endif
16026#ifdef I_STRING
16027# include <string.h>
16028#else
16029# include <strings.h>
16030#endif
16031#ifdef I_UNISTD
16032# include <unistd.h> /* Needed for NetBSD */
16033#endif
16034int main()
16035{
16036char buf[128], abc[128];
16037char *b;
16038int len;
16039int off;
16040int align;
16041
16042/* Copy "abcde..." string to char abc[] so that gcc doesn't
16043 try to store the string in read-only memory. */
16044memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16045
16046for (align = 7; align >= 0; align--) {
16047 for (len = 36; len; len--) {
16048 b = buf+align;
16049 memcpy(b, abc, len);
16050 for (off = 1; off <= len; off++) {
16051 memcpy(b+off, b, len);
16052 memcpy(b, b+off, len);
16053 if (memcmp(b, abc, len))
16054 exit(1);
16055 }
16056 }
16057}
16058exit(0);
16059}
16060EOCP
b6cc3bc4
AD
16061 set try
16062 if eval $compile_ok; then
43dddb59 16063 if $run ./try 2>/dev/null; then
b6cc3bc4
AD
16064 echo "Yes, it can."
16065 val="$define"
16066 else
16067 echo "It can't, sorry."
16068 fi
b4eb6b3d 16069 else
b6cc3bc4 16070 echo "(I can't compile the test program, so we'll assume not...)"
b4eb6b3d 16071 fi
b6cc3bc4
AD
16072 ;;
16073 esac
5b813a60 16074 $rm_try
b4eb6b3d
JH
16075 ;;
16076esac
b4eb6b3d
JH
16077set d_safemcpy
16078eval $setvar
16079
16080: can memcmp be trusted to compare relative magnitude?
16081val="$undef"
16082case "$d_memcmp" in
16083"$define")
16084 echo " "
16085 echo "Checking if your memcmp() can compare relative magnitude..." >&4
16086 $cat >try.c <<EOCP
16087#$i_memory I_MEMORY
16088#$i_stdlib I_STDLIB
16089#$i_string I_STRING
16090#$i_unistd I_UNISTD
16091EOCP
16092 $cat >>try.c <<'EOCP'
16093#include <stdio.h>
16094#ifdef I_MEMORY
16095# include <memory.h>
16096#endif
16097#ifdef I_STDLIB
36adc09b 16098# include <stdlib.h>
b4eb6b3d
JH
16099#endif
16100#ifdef I_STRING
16101# include <string.h>
16102#else
16103# include <strings.h>
16104#endif
16105#ifdef I_UNISTD
16106# include <unistd.h> /* Needed for NetBSD */
16107#endif
16108int main()
16109{
16110char a = -1;
16111char b = 0;
16112if ((a < b) && memcmp(&a, &b, 1) < 0)
16113 exit(1);
16114exit(0);
16115}
16116EOCP
16117 set try
16118 if eval $compile_ok; then
5440bc8e 16119 if $run ./try 2>/dev/null; then
b4eb6b3d
JH
16120 echo "Yes, it can."
16121 val="$define"
16122 else
16123 echo "No, it can't (it uses signed chars)."
16124 fi
16125 else
16126 echo "(I can't compile the test program, so we'll assume not...)"
16127 fi
16128 ;;
16129esac
5b813a60 16130$rm_try
b4eb6b3d
JH
16131set d_sanemcmp
16132eval $setvar
16133
ef9f17be
JH
16134: see if prototype for sbrk is available
16135echo " "
16136set d_sbrkproto sbrk $i_unistd unistd.h
16137eval $hasproto
16138
b4eb6b3d
JH
16139: see if select exists
16140set select d_select
16141eval $inlibc
16142
16143: see if semctl exists
16144set semctl d_semctl
16145eval $inlibc
16146
16147: see if semget exists
16148set semget d_semget
16149eval $inlibc
16150
16151: see if semop exists
16152set semop d_semop
16153eval $inlibc
16154
16155: see how much of the 'sem*(2)' library is present.
16156h_sem=true
16157echo " "
16158case "$d_semctl$d_semget$d_semop" in
16159*"$undef"*) h_sem=false;;
16160esac
16161case "$osname" in
16162freebsd)
16163 case "`ipcs 2>&1`" in
16164 "SVID messages"*"not configured"*)
16165 echo "Your $osname does not have the sem*(2) configured." >&4
16166 h_sem=false
16167 val="$undef"
16168 set semctl d_semctl
16169 eval $setvar
16170 set semget d_semget
16171 eval $setvar
16172 set semop d_semop
16173 eval $setvar
16174 ;;
16175 esac
16176 ;;
16177esac
16178: we could also check for sys/ipc.h ...
16179if $h_sem && $test `./findhdr sys/sem.h`; then
16180 echo "You have the full sem*(2) library." >&4
16181 val="$define"
16182else
16183 echo "You don't have the full sem*(2) library." >&4
16184 val="$undef"
16185fi
16186set d_sem
16187eval $setvar
16188
16189: see whether sys/sem.h defines union semun
16190echo " "
16191$cat > try.c <<'END'
16192#include <sys/types.h>
16193#include <sys/ipc.h>
16194#include <sys/sem.h>
16195int main () { union semun semun; semun.buf = 0; }
16196END
16197set try
16198if eval $compile; then
16199 echo "You have union semun in <sys/sem.h>." >&4
16200 val="$define"
16201else
16202 echo "You do not have union semun in <sys/sem.h>." >&4
16203 val="$undef"
16204fi
5b813a60 16205$rm_try
b4eb6b3d
JH
16206set d_union_semun
16207eval $setvar
16208
16209: see how to do semctl IPC_STAT
16210case "$d_sem" in
16211$define)
b4eb6b3d 16212 echo " "
93451a0d 16213 $cat > tryh.h <<END
b4eb6b3d
JH
16214#ifndef S_IRUSR
16215# ifdef S_IREAD
16216# define S_IRUSR S_IREAD
16217# define S_IWUSR S_IWRITE
16218# define S_IXUSR S_IEXEC
16219# else
16220# define S_IRUSR 0400
16221# define S_IWUSR 0200
16222# define S_IXUSR 0100
16223# endif
16224# define S_IRGRP (S_IRUSR>>3)
16225# define S_IWGRP (S_IWUSR>>3)
16226# define S_IXGRP (S_IXUSR>>3)
16227# define S_IROTH (S_IRUSR>>6)
16228# define S_IWOTH (S_IWUSR>>6)
16229# define S_IXOTH (S_IXUSR>>6)
16230#endif
16231#ifndef S_IRWXU
16232# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16233# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16234# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16235#endif
16236END
2fad75a1 16237 : see whether semctl IPC_STAT can use union semun
2fad75a1
JH
16238 case "$d_semctl_semun" in
16239 '')
35918792 16240 val="$undef"
2fad75a1 16241 $cat > try.c <<END
b4eb6b3d
JH
16242#include <sys/types.h>
16243#include <sys/ipc.h>
16244#include <sys/sem.h>
16245#include <sys/stat.h>
16246#include <stdio.h>
16247#include <errno.h>
93451a0d 16248#include "tryh.h"
b4eb6b3d
JH
16249#ifndef errno
16250extern int errno;
16251#endif
16252#$d_union_semun HAS_UNION_SEMUN
16253int main() {
16254 union semun
16255#ifndef HAS_UNION_SEMUN
16256 {
16257 int val;
16258 struct semid_ds *buf;
16259 unsigned short *array;
16260 }
16261#endif
16262 arg;
16263 int sem, st;
16264
16265#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16266 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16267 if (sem > -1) {
16268 struct semid_ds argbuf;
16269 arg.buf = &argbuf;
16270# ifdef IPC_STAT
16271 st = semctl(sem, 0, IPC_STAT, arg);
16272 if (st == 0)
16273 printf("semun\n");
16274 else
16275# endif /* IPC_STAT */
16276 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16277# ifdef IPC_RMID
16278 if (semctl(sem, 0, IPC_RMID, arg) != 0)
35918792 16279# endif /* IPC_RMID */
b4eb6b3d
JH
16280 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16281 } else
16282#endif /* IPC_PRIVATE && ... */
16283 printf("semget failed: errno = %d\n", errno);
16284 return 0;
16285}
16286END
2fad75a1
JH
16287 set try
16288 if eval $compile; then
16289 xxx=`$run ./try`
16290 case "$xxx" in
16291 semun) val="$define" ;;
16292 esac
16293 fi
5b813a60 16294 $rm_try
35918792
YST
16295 set d_semctl_semun
16296 eval $setvar
2fad75a1
JH
16297 ;;
16298 esac
b4eb6b3d
JH
16299 case "$d_semctl_semun" in
16300 $define)
16301 echo "You can use union semun for semctl IPC_STAT." >&4
16302 also='also'
16303 ;;
16304 *) echo "You cannot use union semun for semctl IPC_STAT." >&4
16305 also=''
16306 ;;
16307 esac
16308
16309 : see whether semctl IPC_STAT can use struct semid_ds pointer
2fad75a1
JH
16310 case "$d_semctl_semid_ds" in
16311 '')
35918792 16312 val="$undef"
2fad75a1 16313 $cat > try.c <<'END'
b4eb6b3d
JH
16314#include <sys/types.h>
16315#include <sys/ipc.h>
16316#include <sys/sem.h>
16317#include <sys/stat.h>
93451a0d 16318#include "tryh.h"
b4eb6b3d
JH
16319#include <stdio.h>
16320#include <errno.h>
16321#ifndef errno
16322extern int errno;
16323#endif
16324int main() {
16325 struct semid_ds arg;
16326 int sem, st;
16327
16328#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16329 sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16330 if (sem > -1) {
16331# ifdef IPC_STAT
16332 st = semctl(sem, 0, IPC_STAT, &arg);
16333 if (st == 0)
16334 printf("semid_ds\n");
16335 else
16336# endif /* IPC_STAT */
16337 printf("semctl IPC_STAT failed: errno = %d\n", errno);
16338# ifdef IPC_RMID
16339 if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16340# endif /* IPC_RMID */
16341 printf("semctl IPC_RMID failed: errno = %d\n", errno);
16342 } else
16343#endif /* IPC_PRIVATE && ... */
16344 printf("semget failed: errno = %d\n", errno);
16345
16346 return 0;
16347}
16348END
2fad75a1
JH
16349 set try
16350 if eval $compile; then
16351 xxx=`$run ./try`
16352 case "$xxx" in
16353 semid_ds) val="$define" ;;
16354 esac
16355 fi
5b813a60 16356 $rm_try
35918792
YST
16357 set d_semctl_semid_ds
16358 eval $setvar
2fad75a1
JH
16359 ;;
16360 esac
b4eb6b3d
JH
16361 case "$d_semctl_semid_ds" in
16362 $define)
16363 echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16364 ;;
16365 *) echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16366 ;;
16367 esac
b4eb6b3d
JH
16368 ;;
16369*) val="$undef"
16370
16371 # We do not have the full sem*(2) library, so assume we can not
16372 # use either.
16373
16374 set d_semctl_semun
16375 eval $setvar
16376
16377 set d_semctl_semid_ds
16378 eval $setvar
16379 ;;
16380esac
93451a0d 16381$rm_try tryh.h
b4eb6b3d 16382
4e0554ec
JH
16383: see if sendmsg exists
16384set sendmsg d_sendmsg
16385eval $inlibc
16386
b4eb6b3d
JH
16387: see if setegid exists
16388set setegid d_setegid
16389eval $inlibc
16390
16391: see if seteuid exists
16392set seteuid d_seteuid
16393eval $inlibc
16394
16395: see if setgrent exists
16396set setgrent d_setgrent
16397eval $inlibc
16398
10bc17b6
JH
16399: see if setgrent_r exists
16400set setgrent_r d_setgrent_r
16401eval $inlibc
16402case "$d_setgrent_r" in
16403"$define")
16404 hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
c18e646a
JH
16405 case "$d_setgrent_r_proto:$usethreads" in
16406 ":define") d_setgrent_r_proto=define
a48ec845
JH
16407 set d_setgrent_r_proto setgrent_r $hdrs
16408 eval $hasproto ;;
16409 *) ;;
16410 esac
16411 case "$d_setgrent_r_proto" in
16412 define)
10bc17b6
JH
16413 case "$setgrent_r_proto" in
16414 ''|0) try='int setgrent_r(FILE**);'
16415 ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16416 esac
16417 case "$setgrent_r_proto" in
16418 ''|0) try='void setgrent_r(FILE**);'
16419 ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16420 esac
16421 case "$setgrent_r_proto" in
90e831dc 16422 ''|0) d_setgrent_r=undef
10bc17b6 16423 setgrent_r_proto=0
a48ec845 16424 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16425 * ) case "$setgrent_r_proto" in
16426 REENTRANT_PROTO*) ;;
16427 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16428 esac
16429 echo "Prototype: $try" ;;
16430 esac
16431 ;;
c18e646a
JH
16432 *) case "$usethreads" in
16433 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16434 esac
90e831dc
SB
16435 d_setgrent_r=undef
16436 setgrent_r_proto=0
c18e646a 16437 ;;
a48ec845
JH
16438 esac
16439 ;;
10bc17b6
JH
16440*) setgrent_r_proto=0
16441 ;;
16442esac
16443
b4eb6b3d
JH
16444: see if sethostent exists
16445set sethostent d_sethent
16446eval $inlibc
16447
10bc17b6
JH
16448: see if sethostent_r exists
16449set sethostent_r d_sethostent_r
16450eval $inlibc
16451case "$d_sethostent_r" in
16452"$define")
16453 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16454 case "$d_sethostent_r_proto:$usethreads" in
16455 ":define") d_sethostent_r_proto=define
a48ec845
JH
16456 set d_sethostent_r_proto sethostent_r $hdrs
16457 eval $hasproto ;;
16458 *) ;;
16459 esac
16460 case "$d_sethostent_r_proto" in
16461 define)
10bc17b6
JH
16462 case "$sethostent_r_proto" in
16463 ''|0) try='int sethostent_r(int, struct hostent_data*);'
16464 ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16465 esac
16466 case "$sethostent_r_proto" in
16467 ''|0) try='void sethostent_r(int, struct hostent_data*);'
16468 ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16469 esac
16470 case "$sethostent_r_proto" in
90e831dc 16471 ''|0) d_sethostent_r=undef
10bc17b6 16472 sethostent_r_proto=0
a48ec845 16473 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16474 * ) case "$sethostent_r_proto" in
16475 REENTRANT_PROTO*) ;;
16476 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16477 esac
16478 echo "Prototype: $try" ;;
16479 esac
16480 ;;
c18e646a
JH
16481 *) case "$usethreads" in
16482 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16483 esac
90e831dc
SB
16484 d_sethostent_r=undef
16485 sethostent_r_proto=0
c18e646a 16486 ;;
a48ec845
JH
16487 esac
16488 ;;
10bc17b6
JH
16489*) sethostent_r_proto=0
16490 ;;
16491esac
16492
4e0554ec
JH
16493: see if setitimer exists
16494set setitimer d_setitimer
16495eval $inlibc
16496
b4eb6b3d
JH
16497: see if setlinebuf exists
16498set setlinebuf d_setlinebuf
16499eval $inlibc
16500
16501: see if setlocale exists
16502set setlocale d_setlocale
16503eval $inlibc
16504
10bc17b6
JH
16505: see if locale.h is available
16506set locale.h i_locale
16507eval $inhdr
16508
16509: see if setlocale_r exists
16510set setlocale_r d_setlocale_r
16511eval $inlibc
16512case "$d_setlocale_r" in
16513"$define")
16514 hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
c18e646a
JH
16515 case "$d_setlocale_r_proto:$usethreads" in
16516 ":define") d_setlocale_r_proto=define
a48ec845
JH
16517 set d_setlocale_r_proto setlocale_r $hdrs
16518 eval $hasproto ;;
16519 *) ;;
16520 esac
16521 case "$d_setlocale_r_proto" in
16522 define)
10bc17b6
JH
16523 case "$setlocale_r_proto" in
16524 ''|0) try='int setlocale_r(int, const char*, char*, int);'
16525 ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16526 esac
16527 case "$setlocale_r_proto" in
90e831dc 16528 ''|0) d_setlocale_r=undef
10bc17b6 16529 setlocale_r_proto=0
a48ec845 16530 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16531 * ) case "$setlocale_r_proto" in
16532 REENTRANT_PROTO*) ;;
16533 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16534 esac
16535 echo "Prototype: $try" ;;
16536 esac
16537 ;;
c18e646a
JH
16538 *) case "$usethreads" in
16539 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16540 esac
90e831dc
SB
16541 d_setlocale_r=undef
16542 setlocale_r_proto=0
c18e646a 16543 ;;
a48ec845
JH
16544 esac
16545 ;;
10bc17b6
JH
16546*) setlocale_r_proto=0
16547 ;;
16548esac
16549
b4eb6b3d
JH
16550: see if setnetent exists
16551set setnetent d_setnent
16552eval $inlibc
16553
10bc17b6
JH
16554: see if setnetent_r exists
16555set setnetent_r d_setnetent_r
16556eval $inlibc
16557case "$d_setnetent_r" in
16558"$define")
16559 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16560 case "$d_setnetent_r_proto:$usethreads" in
16561 ":define") d_setnetent_r_proto=define
a48ec845
JH
16562 set d_setnetent_r_proto setnetent_r $hdrs
16563 eval $hasproto ;;
16564 *) ;;
16565 esac
16566 case "$d_setnetent_r_proto" in
16567 define)
10bc17b6
JH
16568 case "$setnetent_r_proto" in
16569 ''|0) try='int setnetent_r(int, struct netent_data*);'
16570 ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16571 esac
16572 case "$setnetent_r_proto" in
16573 ''|0) try='void setnetent_r(int, struct netent_data*);'
16574 ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16575 esac
16576 case "$setnetent_r_proto" in
90e831dc 16577 ''|0) d_setnetent_r=undef
10bc17b6 16578 setnetent_r_proto=0
a48ec845 16579 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16580 * ) case "$setnetent_r_proto" in
16581 REENTRANT_PROTO*) ;;
16582 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16583 esac
16584 echo "Prototype: $try" ;;
16585 esac
16586 ;;
c18e646a
JH
16587 *) case "$usethreads" in
16588 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16589 esac
90e831dc
SB
16590 d_setnetent_r=undef
16591 setnetent_r_proto=0
c18e646a 16592 ;;
a48ec845
JH
16593 esac
16594 ;;
10bc17b6
JH
16595*) setnetent_r_proto=0
16596 ;;
16597esac
16598
b4eb6b3d
JH
16599: see if setprotoent exists
16600set setprotoent d_setpent
16601eval $inlibc
16602
16603: see if setpgid exists
16604set setpgid d_setpgid
16605eval $inlibc
16606
16607: see if setpgrp2 exists
16608set setpgrp2 d_setpgrp2
16609eval $inlibc
16610
16611: see if setpriority exists
16612set setpriority d_setprior
16613eval $inlibc
16614
16615: see if setproctitle exists
16616set setproctitle d_setproctitle
16617eval $inlibc
16618
10bc17b6
JH
16619: see if setprotoent_r exists
16620set setprotoent_r d_setprotoent_r
16621eval $inlibc
16622case "$d_setprotoent_r" in
16623"$define")
16624 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16625 case "$d_setprotoent_r_proto:$usethreads" in
16626 ":define") d_setprotoent_r_proto=define
a48ec845
JH
16627 set d_setprotoent_r_proto setprotoent_r $hdrs
16628 eval $hasproto ;;
16629 *) ;;
16630 esac
16631 case "$d_setprotoent_r_proto" in
16632 define)
10bc17b6
JH
16633 case "$setprotoent_r_proto" in
16634 ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16635 ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16636 esac
16637 case "$setprotoent_r_proto" in
16638 ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16639 ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16640 esac
16641 case "$setprotoent_r_proto" in
90e831dc 16642 ''|0) d_setprotoent_r=undef
10bc17b6 16643 setprotoent_r_proto=0
a48ec845 16644 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16645 * ) case "$setprotoent_r_proto" in
16646 REENTRANT_PROTO*) ;;
16647 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16648 esac
16649 echo "Prototype: $try" ;;
16650 esac
16651 ;;
c18e646a
JH
16652 *) case "$usethreads" in
16653 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16654 esac
90e831dc
SB
16655 d_setprotoent_r=undef
16656 setprotoent_r_proto=0
c18e646a 16657 ;;
a48ec845
JH
16658 esac
16659 ;;
10bc17b6
JH
16660*) setprotoent_r_proto=0
16661 ;;
16662esac
16663
b4eb6b3d
JH
16664: see if setpwent exists
16665set setpwent d_setpwent
16666eval $inlibc
16667
10bc17b6
JH
16668: see if setpwent_r exists
16669set setpwent_r d_setpwent_r
16670eval $inlibc
16671case "$d_setpwent_r" in
16672"$define")
16673 hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
c18e646a
JH
16674 case "$d_setpwent_r_proto:$usethreads" in
16675 ":define") d_setpwent_r_proto=define
a48ec845
JH
16676 set d_setpwent_r_proto setpwent_r $hdrs
16677 eval $hasproto ;;
16678 *) ;;
16679 esac
16680 case "$d_setpwent_r_proto" in
16681 define)
10bc17b6
JH
16682 case "$setpwent_r_proto" in
16683 ''|0) try='int setpwent_r(FILE**);'
16684 ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16685 esac
16686 case "$setpwent_r_proto" in
16687 ''|0) try='void setpwent_r(FILE**);'
16688 ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16689 esac
16690 case "$setpwent_r_proto" in
90e831dc 16691 ''|0) d_setpwent_r=undef
10bc17b6 16692 setpwent_r_proto=0
a48ec845 16693 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16694 * ) case "$setpwent_r_proto" in
16695 REENTRANT_PROTO*) ;;
16696 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16697 esac
16698 echo "Prototype: $try" ;;
16699 esac
16700 ;;
c18e646a
JH
16701 *) case "$usethreads" in
16702 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16703 esac
90e831dc
SB
16704 d_setpwent_r=undef
16705 setpwent_r_proto=0
c18e646a 16706 ;;
a48ec845
JH
16707 esac
16708 ;;
10bc17b6
JH
16709*) setpwent_r_proto=0
16710 ;;
16711esac
16712
b4eb6b3d
JH
16713: see if setregid exists
16714set setregid d_setregid
16715eval $inlibc
16716set setresgid d_setresgid
16717eval $inlibc
16718
16719: see if setreuid exists
16720set setreuid d_setreuid
16721eval $inlibc
16722set setresuid d_setresuid
16723eval $inlibc
16724
16725: see if setrgid exists
16726set setrgid d_setrgid
16727eval $inlibc
16728
16729: see if setruid exists
16730set setruid d_setruid
16731eval $inlibc
16732
16733: see if setservent exists
16734set setservent d_setsent
16735eval $inlibc
16736
10bc17b6
JH
16737: see if setservent_r exists
16738set setservent_r d_setservent_r
16739eval $inlibc
16740case "$d_setservent_r" in
16741"$define")
16742 hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
c18e646a
JH
16743 case "$d_setservent_r_proto:$usethreads" in
16744 ":define") d_setservent_r_proto=define
a48ec845
JH
16745 set d_setservent_r_proto setservent_r $hdrs
16746 eval $hasproto ;;
16747 *) ;;
16748 esac
16749 case "$d_setservent_r_proto" in
16750 define)
10bc17b6
JH
16751 case "$setservent_r_proto" in
16752 ''|0) try='int setservent_r(int, struct servent_data*);'
16753 ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16754 esac
16755 case "$setservent_r_proto" in
16756 ''|0) try='void setservent_r(int, struct servent_data*);'
16757 ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16758 esac
16759 case "$setservent_r_proto" in
90e831dc 16760 ''|0) d_setservent_r=undef
10bc17b6 16761 setservent_r_proto=0
a48ec845 16762 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
16763 * ) case "$setservent_r_proto" in
16764 REENTRANT_PROTO*) ;;
16765 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16766 esac
16767 echo "Prototype: $try" ;;
16768 esac
16769 ;;
c18e646a
JH
16770 *) case "$usethreads" in
16771 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16772 esac
90e831dc
SB
16773 d_setservent_r=undef
16774 setservent_r_proto=0
c18e646a 16775 ;;
a48ec845
JH
16776 esac
16777 ;;
10bc17b6
JH
16778*) setservent_r_proto=0
16779 ;;
16780esac
16781
b4eb6b3d
JH
16782: see if setsid exists
16783set setsid d_setsid
16784eval $inlibc
16785
16786: see if setvbuf exists
16787set setvbuf d_setvbuf
16788eval $inlibc
16789
16790: see if sfio.h is available
16791set sfio.h i_sfio
16792eval $inhdr
16793
16794
16795: see if sfio library is available
16796case "$i_sfio" in
16797$define)
16798 val=''
16799 set sfreserve val
16800 eval $inlibc
16801 ;;
16802*)
16803 val="$undef"
16804 ;;
16805esac
16806: Ok, but do we want to use it.
16807case "$val" in
16808$define)
16809 case "$usesfio" in
16810 true|$define|[yY]*) dflt='y';;
16811 *) dflt='n';;
16812 esac
16813 echo "$package can use the sfio library, but it is experimental."
16814 case "$useperlio" in
16815 "$undef")
16816 echo "For sfio also the PerlIO abstraction layer is needed."
16817 echo "Earlier you said you wouldn't want that."
16818 ;;
16819 esac
16820 rp="You seem to have sfio available, do you want to try using it?"
16821 . ./myread
16822 case "$ans" in
16823 y|Y) echo "Ok, turning on both sfio and PerlIO, then."
16824 useperlio="$define"
16825 val="$define"
16826 ;;
16827 *) echo "Ok, avoiding sfio this time. I'll use stdio instead."
16828 val="$undef"
b4eb6b3d
JH
16829 ;;
16830 esac
16831 ;;
16832*) case "$usesfio" in
16833 true|$define|[yY]*)
16834 echo "Sorry, cannot find sfio on this machine." >&4
16835 echo "Ignoring your setting of usesfio=$usesfio." >&4
16836 val="$undef"
16837 ;;
16838 esac
16839 ;;
16840esac
16841set d_sfio
16842eval $setvar
16843case "$d_sfio" in
16844$define) usesfio='true';;
16845*) usesfio='false';;
16846esac
3659ebf1
JH
16847case "$d_sfio" in
16848$define) ;;
16849*) : Remove sfio from list of libraries to use
7483f793
JH
16850 case "$libs" in
16851 *-lsfio*)
16852 echo "Removing unneeded -lsfio from library list" >&4
16853 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16854 shift
16855 libs="$*"
16856 echo "libs = $libs" >&4
16857 ;;
16858 esac
3659ebf1
JH
16859;;
16860esac
16861
b4eb6b3d
JH
16862
16863: see if shmctl exists
16864set shmctl d_shmctl
16865eval $inlibc
16866
16867: see if shmget exists
16868set shmget d_shmget
16869eval $inlibc
16870
16871: see if shmat exists
16872set shmat d_shmat
16873eval $inlibc
16874: see what shmat returns
16875case "$d_shmat" in
16876"$define")
16877 $cat >shmat.c <<'END'
16878#include <sys/shm.h>
16879void *shmat();
16880END
16881 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16882 shmattype='void *'
16883 else
16884 shmattype='char *'
16885 fi
16886 echo "and it returns ($shmattype)." >&4
16887 : see if a prototype for shmat is available
16888 xxx=`./findhdr sys/shm.h`
16889 $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16890 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16891 val="$define"
16892 else
16893 val="$undef"
16894 fi
16895 $rm -f shmat.[co]
16896 ;;
16897*)
16898 val="$undef"
16899 ;;
16900esac
16901set d_shmatprototype
16902eval $setvar
16903
16904: see if shmdt exists
16905set shmdt d_shmdt
16906eval $inlibc
16907
16908: see how much of the 'shm*(2)' library is present.
16909h_shm=true
16910echo " "
16911case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16912*"$undef"*) h_shm=false;;
16913esac
16914case "$osname" in
16915freebsd)
16916 case "`ipcs 2>&1`" in
16917 "SVID shared memory"*"not configured"*)
16918 echo "Your $osname does not have the shm*(2) configured." >&4
16919 h_shm=false
16920 val="$undef"
16921 set shmctl d_shmctl
16922 evat $setvar
16923 set shmget d_shmget
16924 evat $setvar
16925 set shmat d_shmat
16926 evat $setvar
16927 set shmdt d_shmdt
16928 evat $setvar
16929 ;;
16930 esac
16931 ;;
16932esac
16933: we could also check for sys/ipc.h ...
16934if $h_shm && $test `./findhdr sys/shm.h`; then
16935 echo "You have the full shm*(2) library." >&4
16936 val="$define"
16937else
16938 echo "You don't have the full shm*(2) library." >&4
16939 val="$undef"
16940fi
16941set d_shm
16942eval $setvar
16943
16944echo " "
16945: see if we have sigaction
16946if set sigaction val -f d_sigaction; eval $csym; $val; then
16947 echo 'sigaction() found.' >&4
073b6de5 16948 $cat > try.c <<EOP
b4eb6b3d
JH
16949#include <stdio.h>
16950#include <sys/types.h>
16951#include <signal.h>
073b6de5
JH
16952#$i_stdlib I_STDLIB
16953#ifdef I_STDLIB
16954#include <stdlib.h>
16955#endif
b4eb6b3d
JH
16956int main()
16957{
16958 struct sigaction act, oact;
16959 act.sa_flags = 0;
16960 oact.sa_handler = 0;
16961 /* so that act and oact are used */
16962 exit(act.sa_flags == 0 && oact.sa_handler == 0);
16963}
16964EOP
16965 set try
16966 if eval $compile_ok; then
16967 val="$define"
16968 else
16969 echo "But you don't seem to have a useable struct sigaction." >&4
16970 val="$undef"
16971 fi
16972else
16973 echo 'sigaction NOT found.' >&4
16974 val="$undef"
16975fi
16976set d_sigaction; eval $setvar
5b813a60 16977$rm_try
b4eb6b3d 16978
ed140128
AD
16979: see if this is a sunmath.h system
16980set sunmath.h i_sunmath
16981eval $inhdr
16982
16983: see if signbit exists
16984$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
16985$cat >try.c <<EOCP
16986#$i_math I_MATH
16987#$i_sunmath I_SUNMATH
16988#ifdef I_MATH
16989# include <math.h>
16990#endif
16991#ifdef I_SUNMATH /* Solaris special math library */
16992# include <sunmath.h>
16993#endif
16994#define NV $nvtype
16995int main(int argc, char **argv)
16996{
16997 NV x = 0.0;
16998 NV y = -0.0;
16999 if ((signbit(x) == 0) && (signbit(y) != 0))
17000 return 0;
17001 else
17002 return 1;
17003}
17004EOCP
17005val="$undef"
17006set try
17007if eval $compile; then
17008 if $run ./try; then
17009 $echo "Yes." >&4
17010 val="$define"
17011 else
17012 $echo "Signbit seems to be available, but doesn't work as I expected."
17013 $echo "I won't use it." >&4
17014 val="$undef"
17015 fi
17016else
17017 $echo "Nope." >&4
17018 dflt="$undef"
17019fi
17020set d_signbit
17021eval $setvar
5b813a60 17022$rm_try
ed140128 17023
983dbef6
JH
17024: see if sigprocmask exists
17025set sigprocmask d_sigprocmask
17026eval $inlibc
17027
b4eb6b3d
JH
17028: see if sigsetjmp exists
17029echo " "
17030case "$d_sigsetjmp" in
17031'')
c727eafa 17032 $cat >try.c <<EOP
b4eb6b3d 17033#include <setjmp.h>
d1daaddf
JH
17034#$i_stdlib I_STDLIB
17035#ifdef I_STDLIB
17036#include <stdlib.h>
17037#endif
b4eb6b3d
JH
17038sigjmp_buf env;
17039int set = 1;
17040int main()
17041{
17042 if (sigsetjmp(env,1))
17043 exit(set);
17044 set = 0;
17045 siglongjmp(env, 1);
17046 exit(1);
17047}
17048EOP
17049 set try
17050 if eval $compile; then
5440bc8e 17051 if $run ./try >/dev/null 2>&1; then
b4eb6b3d
JH
17052 echo "POSIX sigsetjmp found." >&4
17053 val="$define"
17054 else
17055 $cat >&4 <<EOM
17056Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17057I'll ignore them.
17058EOM
17059 val="$undef"
17060 fi
17061 else
17062 echo "sigsetjmp not found." >&4
17063 val="$undef"
17064 fi
17065 ;;
17066*) val="$d_sigsetjmp"
17067 case "$d_sigsetjmp" in
17068 $define) echo "POSIX sigsetjmp found." >&4;;
17069 $undef) echo "sigsetjmp not found." >&4;;
17070 esac
17071 ;;
17072esac
17073set d_sigsetjmp
17074eval $setvar
5b813a60 17075$rm_try
b4eb6b3d 17076
4f5da3e9
SP
17077: see if snprintf exists
17078set snprintf d_snprintf
17079eval $inlibc
17080
17081: see if vsnprintf exists
17082set vsnprintf d_vsnprintf
17083eval $inlibc
17084
2478f7a0
MB
17085case "$d_snprintf-$d_vsnprintf" in
17086"$define-$define")
17087 $cat <<EOM
17088Checking whether your snprintf() and vsnprintf() work okay...
17089EOM
17090 $cat >try.c <<'EOCP'
17091/* v?snprintf testing logic courtesy of Russ Allbery.
17092 * According to C99:
17093 * - if the buffer is too short it still must be \0-terminated
17094 * - if the buffer is too short the potentially required length
17095 * must be returned and not -1
17096 * - if the buffer is NULL the potentially required length
17097 * must be returned and not -1 or core dump
17098 */
17099#include <stdio.h>
17100#include <stdarg.h>
17101
17102char buf[2];
17103
17104int test (char *format, ...)
17105{
17106 va_list args;
17107 int count;
17108
17109 va_start (args, format);
17110 count = vsnprintf (buf, sizeof buf, format, args);
17111 va_end (args);
17112 return count;
17113}
17114
17115int main ()
17116{
17117 return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17118 && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17119}
17120EOCP
17121 set try
17122 if eval $compile; then
17123 `$run ./try`
17124 case "$?" in
17125 0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17126 *) cat <<EOM >&4
17127Your snprintf() and snprintf() don't seem to be working okay.
17128EOM
17129 d_snprintf="$undef"
17130 d_vsnprintf="$undef"
17131 ;;
17132 esac
17133 else
17134 echo "(I can't seem to compile the test program--assuming they don't)"
17135 d_snprintf="$undef"
17136 d_vsnprintf="$undef"
17137 fi
5b813a60 17138 $rm_try
2478f7a0
MB
17139 ;;
17140esac
17141
49a78c82
JH
17142: see if sockatmark exists
17143set sockatmark d_sockatmark
17144eval $inlibc
17145
2ef53570
JH
17146: see if prototype for sockatmark is available
17147echo " "
17148set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17149eval $hasproto
17150
b4eb6b3d
JH
17151: see if socks5_init exists
17152set socks5_init d_socks5_init
17153eval $inlibc
17154
360321b3
YST
17155: see if sprintf returns the length of the string in the buffer as per ANSI
17156$echo "Checking whether sprintf returns the length of the string..." >&4
17157$cat <<EOP >try.c
17158#include <stdio.h>
17159#$i_stdlib I_STDLIB
17160#ifdef I_STDLIB
17161#include <stdlib.h>
17162#endif
17163#$i_string I_STRING
17164#ifdef I_STRING
17165# include <string.h>
17166#else
17167# include <strings.h>
17168#endif
17169#$i_math I_MATH
17170#ifdef I_MATH
17171#include <math.h>
17172#endif
17173
17174char buffer[256];
17175
17176int check (size_t expect, int test) {
17177 size_t got = strlen(buffer);
17178 if (expect == got)
17179 return 0;
17180
17181 printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17182 test, buffer);
17183 exit (test);
17184}
17185
17186int main(int argc, char **argv) {
17187 int test = 0;
17188
17189 check(sprintf(buffer, ""), ++test);
17190 check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17191 check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17192
17193 return 0;
17194}
17195EOP
17196set try
17197
17198d_sprintf_returns_strlen="$undef"
17199if eval $compile; then
17200 xxx="`$run ./try`"
17201 case "$?" in
17202 0) cat >&4 <<EOM
17203sprintf returns the length of the string (as ANSI says it should)
17204EOM
17205 d_sprintf_returns_strlen="$define"
17206 ;;
17207 *) cat >&4 <<EOM
17208sprintf does not return the length of the string (how old is this system?)
17209EOM
17210 d_sprintf_returns_strlen="$undef"
17211 ;;
17212 esac
17213fi
5b813a60 17214$rm_try
360321b3 17215
10bc17b6
JH
17216: see if srand48_r exists
17217set srand48_r d_srand48_r
17218eval $inlibc
17219case "$d_srand48_r" in
17220"$define")
17221 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17222 case "$d_srand48_r_proto:$usethreads" in
17223 ":define") d_srand48_r_proto=define
a48ec845
JH
17224 set d_srand48_r_proto srand48_r $hdrs
17225 eval $hasproto ;;
17226 *) ;;
17227 esac
17228 case "$d_srand48_r_proto" in
17229 define)
10bc17b6
JH
17230 case "$srand48_r_proto" in
17231 ''|0) try='int srand48_r(long, struct drand48_data*);'
17232 ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17233 esac
17234 case "$srand48_r_proto" in
90e831dc 17235 ''|0) d_srand48_r=undef
10bc17b6 17236 srand48_r_proto=0
a48ec845 17237 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17238 * ) case "$srand48_r_proto" in
17239 REENTRANT_PROTO*) ;;
17240 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17241 esac
17242 echo "Prototype: $try" ;;
17243 esac
17244 ;;
c18e646a
JH
17245 *) case "$usethreads" in
17246 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17247 esac
90e831dc
SB
17248 d_srand48_r=undef
17249 srand48_r_proto=0
c18e646a 17250 ;;
a48ec845
JH
17251 esac
17252 ;;
10bc17b6
JH
17253*) srand48_r_proto=0
17254 ;;
17255esac
17256
17257: see if srandom_r exists
17258set srandom_r d_srandom_r
17259eval $inlibc
17260case "$d_srandom_r" in
17261"$define")
17262 hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
c18e646a
JH
17263 case "$d_srandom_r_proto:$usethreads" in
17264 ":define") d_srandom_r_proto=define
a48ec845
JH
17265 set d_srandom_r_proto srandom_r $hdrs
17266 eval $hasproto ;;
17267 *) ;;
17268 esac
17269 case "$d_srandom_r_proto" in
17270 define)
10bc17b6
JH
17271 case "$srandom_r_proto" in
17272 ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17273 ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17274 esac
17275 case "$srandom_r_proto" in
90e831dc 17276 ''|0) d_srandom_r=undef
10bc17b6 17277 srandom_r_proto=0
a48ec845 17278 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17279 * ) case "$srandom_r_proto" in
17280 REENTRANT_PROTO*) ;;
17281 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17282 esac
17283 echo "Prototype: $try" ;;
17284 esac
17285 ;;
c18e646a
JH
17286 *) case "$usethreads" in
17287 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17288 esac
90e831dc
SB
17289 d_srandom_r=undef
17290 srandom_r_proto=0
c18e646a 17291 ;;
a48ec845
JH
17292 esac
17293 ;;
10bc17b6
JH
17294*) srandom_r_proto=0
17295 ;;
17296esac
17297
eef837ea
JH
17298: see if prototype for setresgid is available
17299echo " "
17300set d_sresgproto setresgid $i_unistd unistd.h
17301eval $hasproto
17302
640374d0
JH
17303: see if prototype for setresuid is available
17304echo " "
17305set d_sresuproto setresuid $i_unistd unistd.h
17306eval $hasproto
17307
b4eb6b3d
JH
17308: see if sys/stat.h is available
17309set sys/stat.h i_sysstat
17310eval $inhdr
17311
17312
17313: see if stat knows about block sizes
17314echo " "
17315echo "Checking to see if your struct stat has st_blocks field..." >&4
17316set d_statblks stat st_blocks $i_sysstat sys/stat.h
17317eval $hasfield
17318
17319
17320: see if this is a sys/vfs.h system
17321set sys/vfs.h i_sysvfs
17322eval $inhdr
17323
17324
17325: see if this is a sys/statfs.h system
17326set sys/statfs.h i_sysstatfs
17327eval $inhdr
17328
17329
17330echo " "
17331echo "Checking to see if your system supports struct statfs..." >&4
17332set 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
17333eval $hasstruct
17334case "$d_statfs_s" in
17335"$define") echo "Yes, it does." ;;
17336*) echo "No, it doesn't." ;;
17337esac
17338
17339
17340
17341: see if struct statfs knows about f_flags
17342case "$d_statfs_s" in
17343define)
17344 echo " "
17345 echo "Checking to see if your struct statfs has f_flags field..." >&4
17346 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
17347 eval $hasfield
17348 ;;
17349*) val="$undef"
17350 set d_statfs_f_flags
17351 eval $setvar
17352 ;;
17353esac
17354case "$d_statfs_f_flags" in
17355"$define") echo "Yes, it does." ;;
17356*) echo "No, it doesn't." ;;
17357esac
17358
b4eb6b3d
JH
17359$cat >&4 <<EOM
17360Checking how to access stdio streams by file descriptor number...
17361EOM
17362case "$stdio_stream_array" in
17363'') $cat >try.c <<EOCP
17364#include <stdio.h>
17365int main() {
17366 if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17367 printf("yes\n");
17368}
17369EOCP
17370 for s in _iob __iob __sF
17371 do
17372 set try -DSTDIO_STREAM_ARRAY=$s
17373 if eval $compile; then
5440bc8e 17374 case "`$run ./try`" in
b4eb6b3d
JH
17375 yes) stdio_stream_array=$s; break ;;
17376 esac
17377 fi
17378 done
5b813a60 17379 $rm_try
b4eb6b3d
JH
17380esac
17381case "$stdio_stream_array" in
17382'') $cat >&4 <<EOM
17383I can't figure out how to access stdio streams by file descriptor number.
17384EOM
17385 d_stdio_stream_array="$undef"
17386 ;;
17387*) $cat >&4 <<EOM
17388You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17389EOM
17390 d_stdio_stream_array="$define"
17391 ;;
17392esac
17393
17394: see if strcoll exists
17395set strcoll d_strcoll
17396eval $inlibc
17397
17398: check for structure copying
17399echo " "
17400echo "Checking to see if your C compiler can copy structs..." >&4
17401$cat >try.c <<'EOCP'
76f47787 17402int main()
b4eb6b3d
JH
17403{
17404 struct blurfl {
17405 int dyick;
17406 } foo, bar;
17407
17408 foo = bar;
17409}
17410EOCP
17411if $cc -c try.c >/dev/null 2>&1 ; then
17412 val="$define"
17413 echo "Yup, it can."
17414else
17415 val="$undef"
17416 echo "Nope, it can't."
17417fi
17418set d_strctcpy
17419eval $setvar
5b813a60 17420$rm_try
b4eb6b3d
JH
17421
17422: see if strerror and/or sys_errlist[] exist
17423echo " "
17424if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17425 if set strerror val -f d_strerror; eval $csym; $val; then
17426 echo 'strerror() found.' >&4
17427 d_strerror="$define"
17428 d_strerrm='strerror(e)'
17429 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17430 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
17431 d_syserrlst="$define"
17432 else
17433 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17434 d_syserrlst="$undef"
17435 fi
17436 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17437 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17438 echo 'strerror() found in string header.' >&4
17439 d_strerror="$define"
17440 d_strerrm='strerror(e)'
17441 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17442 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17443 d_syserrlst="$define"
17444 else
17445 echo "(You don't appear to have any sys_errlist[], how can this be?)"
17446 d_syserrlst="$undef"
17447 fi
17448 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17449 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17450 d_strerror="$undef"
17451 d_syserrlst="$define"
17452 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17453 else
17454 echo 'strerror() and sys_errlist[] NOT found.' >&4
17455 d_strerror="$undef"
17456 d_syserrlst="$undef"
17457 d_strerrm='"unknown"'
17458 fi
17459fi
17460
10bc17b6
JH
17461: see if strerror_r exists
17462set strerror_r d_strerror_r
17463eval $inlibc
17464case "$d_strerror_r" in
17465"$define")
17466 hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
c18e646a
JH
17467 case "$d_strerror_r_proto:$usethreads" in
17468 ":define") d_strerror_r_proto=define
a48ec845
JH
17469 set d_strerror_r_proto strerror_r $hdrs
17470 eval $hasproto ;;
17471 *) ;;
17472 esac
17473 case "$d_strerror_r_proto" in
17474 define)
10bc17b6
JH
17475 case "$strerror_r_proto" in
17476 ''|0) try='int strerror_r(int, char*, size_t);'
17477 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17478 esac
17479 case "$strerror_r_proto" in
17480 ''|0) try='int strerror_r(int, char*, int);'
17481 ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17482 esac
17483 case "$strerror_r_proto" in
17484 ''|0) try='char* strerror_r(int, char*, size_t);'
17485 ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17486 esac
17487 case "$strerror_r_proto" in
90e831dc 17488 ''|0) d_strerror_r=undef
10bc17b6 17489 strerror_r_proto=0
a48ec845 17490 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17491 * ) case "$strerror_r_proto" in
17492 REENTRANT_PROTO*) ;;
17493 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17494 esac
17495 echo "Prototype: $try" ;;
17496 esac
17497 ;;
c18e646a
JH
17498 *) case "$usethreads" in
17499 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17500 esac
90e831dc
SB
17501 d_strerror_r=undef
17502 strerror_r_proto=0
c18e646a 17503 ;;
a48ec845
JH
17504 esac
17505 ;;
10bc17b6
JH
17506*) strerror_r_proto=0
17507 ;;
17508esac
17509
b3c85772
JH
17510: see if strftime exists
17511set strftime d_strftime
17512eval $inlibc
17513
08c92000
MB
17514: see if strlcat exists
17515set strlcat d_strlcat
17516eval $inlibc
17517
17518: see if strlcpy exists
17519set strlcpy d_strlcpy
17520eval $inlibc
17521
b4eb6b3d
JH
17522: see if strtod exists
17523set strtod d_strtod
17524eval $inlibc
17525
17526: see if strtol exists
17527set strtol d_strtol
17528eval $inlibc
17529
17530: see if strtold exists
17531set strtold d_strtold
17532eval $inlibc
17533
17534: see if strtoll exists
17535set strtoll d_strtoll
17536eval $inlibc
17537
17538case "$d_longlong-$d_strtoll" in
17539"$define-$define")
17540 $cat <<EOM
17541Checking whether your strtoll() works okay...
17542EOM
17543 $cat >try.c <<'EOCP'
17544#include <errno.h>
17545#ifdef __hpux
17546#define strtoll __strtoll
17547#endif
e75931a7
YST
17548#ifdef __EMX__
17549#define strtoll _strtoll
17550#endif
b4eb6b3d
JH
17551#include <stdio.h>
17552extern long long int strtoll(char *s, char **, int);
17553static int bad = 0;
17554int check(char *s, long long ell, int een) {
17555 long long gll;
17556 errno = 0;
17557 gll = strtoll(s, 0, 10);
17558 if (!((gll == ell) && (errno == een)))
17559 bad++;
17560}
17561int main() {
17562 check(" 1", 1LL, 0);
17563 check(" 0", 0LL, 0);
17564 check("-1", -1LL, 0);
17565 check("-9223372036854775808", -9223372036854775808LL, 0);
17566 check("-9223372036854775808", -9223372036854775808LL, 0);
17567 check(" 9223372036854775807", 9223372036854775807LL, 0);
17568 check("-9223372036854775808", -9223372036854775808LL, 0);
17569 check(" 9223372036854775808", 9223372036854775807LL, ERANGE);
17570 check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17571 if (!bad)
17572 printf("ok\n");
17573}
17574EOCP
17575 set try
17576 if eval $compile; then
5440bc8e 17577 yyy=`$run ./try`
e75931a7 17578 case "$yyy" in
b4eb6b3d
JH
17579 ok) echo "Your strtoll() seems to be working okay." ;;
17580 *) cat <<EOM >&4
17581Your strtoll() doesn't seem to be working okay.
17582EOM
17583 d_strtoll="$undef"
17584 ;;
69eadf66 17585 esac
e75931a7
YST
17586 else
17587 echo "(I can't seem to compile the test program--assuming it doesn't)"
17588 d_strtoll="$undef"
b4eb6b3d
JH
17589 fi
17590 ;;
17591esac
17592
28e5dec8
JH
17593: see if strtoq exists
17594set strtoq d_strtoq
17595eval $inlibc
17596
b4eb6b3d
JH
17597: see if strtoul exists
17598set strtoul d_strtoul
17599eval $inlibc
17600
d0e6d399
NC
17601case "$d_strtoul" in
17602"$define")
17603 $cat <<EOM
17604Checking whether your strtoul() works okay...
17605EOM
17606 $cat >try.c <<'EOCP'
17607#include <errno.h>
17608#include <stdio.h>
17609extern unsigned long int strtoul(char *s, char **, int);
17610static int bad = 0;
17611void check(char *s, unsigned long eul, int een) {
17612 unsigned long gul;
17613 errno = 0;
17614 gul = strtoul(s, 0, 10);
17615 if (!((gul == eul) && (errno == een)))
17616 bad++;
17617}
17618int main() {
17619 check(" 1", 1L, 0);
17620 check(" 0", 0L, 0);
17621EOCP
17622 case "$longsize" in
17623 8)
17624 $cat >>try.c <<'EOCP'
09c0d2c4
JH
17625 check("18446744073709551615", 18446744073709551615UL, 0);
17626 check("18446744073709551616", 18446744073709551615UL, ERANGE);
c11ecd62 17627#if 0 /* strtoul() for /^-/ strings is undefined. */
09c0d2c4 17628 check("-1", 18446744073709551615UL, 0);
d0e6d399
NC
17629 check("-18446744073709551614", 2, 0);
17630 check("-18446744073709551615", 1, 0);
09c0d2c4
JH
17631 check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17632 check("-18446744073709551617", 18446744073709551615UL, ERANGE);
c11ecd62 17633#endif
d0e6d399
NC
17634EOCP
17635 ;;
17636 4)
17637 $cat >>try.c <<'EOCP'
17638 check("4294967295", 4294967295UL, 0);
17639 check("4294967296", 4294967295UL, ERANGE);
c11ecd62 17640#if 0 /* strtoul() for /^-/ strings is undefined. */
d0e6d399
NC
17641 check("-1", 4294967295UL, 0);
17642 check("-4294967294", 2, 0);
17643 check("-4294967295", 1, 0);
17644 check("-4294967296", 4294967295UL, ERANGE);
17645 check("-4294967297", 4294967295UL, ERANGE);
c11ecd62 17646#endif
d0e6d399
NC
17647EOCP
17648 ;;
17649 *)
17650: Should we write these tests to be more portable by sprintf-ing
17651: ~0 and then manipulating that char string as input for strtol?
17652 ;;
17653 esac
17654 $cat >>try.c <<'EOCP'
17655 if (!bad)
17656 printf("ok\n");
17657 return 0;
17658}
17659EOCP
17660 set try
17661 if eval $compile; then
5440bc8e 17662 case "`$run ./try`" in
d0e6d399
NC
17663 ok) echo "Your strtoul() seems to be working okay." ;;
17664 *) cat <<EOM >&4
17665Your strtoul() doesn't seem to be working okay.
17666EOM
17667 d_strtoul="$undef"
17668 ;;
17669 esac
9597a80f
NC
17670 else
17671 echo "(I can't seem to compile the test program--assuming it doesn't)"
17672 d_strtoul="$undef"
d0e6d399
NC
17673 fi
17674 ;;
17675esac
17676
b4eb6b3d
JH
17677: see if strtoull exists
17678set strtoull d_strtoull
17679eval $inlibc
17680
17681case "$d_longlong-$d_strtoull" in
17682"$define-$define")
17683 $cat <<EOM
17684Checking whether your strtoull() works okay...
17685EOM
17686 $cat >try.c <<'EOCP'
17687#include <errno.h>
17688#ifdef __hpux
17689#define strtoull __strtoull
17690#endif
17691#include <stdio.h>
17692extern unsigned long long int strtoull(char *s, char **, int);
17693static int bad = 0;
17694int check(char *s, long long eull, int een) {
17695 long long gull;
17696 errno = 0;
17697 gull = strtoull(s, 0, 10);
17698 if (!((gull == eull) && (errno == een)))
17699 bad++;
17700}
17701int main() {
d0e6d399
NC
17702 check(" 1", 1LL, 0);
17703 check(" 0", 0LL, 0);
17704 check("18446744073709551615", 18446744073709551615ULL, 0);
17705 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17706#if 0 /* strtoull() for /^-/ strings is undefined. */
d0e6d399
NC
17707 check("-1", 18446744073709551615ULL, 0);
17708 check("-18446744073709551614", 2LL, 0);
17709 check("-18446744073709551615", 1LL, 0);
17710 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17711 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17712#endif
b4eb6b3d
JH
17713 if (!bad)
17714 printf("ok\n");
17715}
17716EOCP
17717 set try
17718 if eval $compile; then
5440bc8e 17719 case "`$run ./try`" in
b4eb6b3d
JH
17720 ok) echo "Your strtoull() seems to be working okay." ;;
17721 *) cat <<EOM >&4
17722Your strtoull() doesn't seem to be working okay.
17723EOM
17724 d_strtoull="$undef"
17725 ;;
17726 esac
9597a80f
NC
17727 else
17728 echo "(I can't seem to compile the test program--assuming it doesn't)"
17729 d_strtoull="$undef"
b4eb6b3d
JH
17730 fi
17731 ;;
17732esac
17733
17734: see if strtouq exists
17735set strtouq d_strtouq
17736eval $inlibc
17737
d0e6d399
NC
17738case "$d_strtouq" in
17739"$define")
17740 $cat <<EOM
17741Checking whether your strtouq() works okay...
17742EOM
17743 $cat >try.c <<'EOCP'
17744#include <errno.h>
17745#include <stdio.h>
17746extern unsigned long long int strtouq(char *s, char **, int);
17747static int bad = 0;
17748void check(char *s, unsigned long long eull, int een) {
17749 unsigned long long gull;
17750 errno = 0;
17751 gull = strtouq(s, 0, 10);
17752 if (!((gull == eull) && (errno == een)))
17753 bad++;
17754}
17755int main() {
17756 check(" 1", 1LL, 0);
17757 check(" 0", 0LL, 0);
17758 check("18446744073709551615", 18446744073709551615ULL, 0);
17759 check("18446744073709551616", 18446744073709551615ULL, ERANGE);
c11ecd62 17760#if 0 /* strtouq() for /^-/ strings is undefined. */
d0e6d399
NC
17761 check("-1", 18446744073709551615ULL, 0);
17762 check("-18446744073709551614", 2LL, 0);
17763 check("-18446744073709551615", 1LL, 0);
17764 check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17765 check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
c11ecd62 17766#endif
d0e6d399
NC
17767 if (!bad)
17768 printf("ok\n");
17769 return 0;
17770}
17771EOCP
17772 set try
17773 if eval $compile; then
5440bc8e 17774 case "`$run ./try`" in
d0e6d399
NC
17775 ok) echo "Your strtouq() seems to be working okay." ;;
17776 *) cat <<EOM >&4
17777Your strtouq() doesn't seem to be working okay.
17778EOM
17779 d_strtouq="$undef"
17780 ;;
17781 esac
9597a80f
NC
17782 else
17783 echo "(I can't seem to compile the test program--assuming it doesn't)"
17784 d_strtouq="$undef"
d0e6d399
NC
17785 fi
17786 ;;
17787esac
17788
b4eb6b3d
JH
17789: see if strxfrm exists
17790set strxfrm d_strxfrm
17791eval $inlibc
17792
17793: see if symlink exists
17794set symlink d_symlink
17795eval $inlibc
17796
17797: see if syscall exists
17798set syscall d_syscall
17799eval $inlibc
17800
2ef53570
JH
17801: see if prototype for syscall is available
17802echo " "
17803set d_syscallproto syscall $i_unistd unistd.h
17804eval $hasproto
17805
b4eb6b3d
JH
17806: see if sysconf exists
17807set sysconf d_sysconf
17808eval $inlibc
17809
17810: see if system exists
17811set system d_system
17812eval $inlibc
17813
17814: see if tcgetpgrp exists
17815set tcgetpgrp d_tcgetpgrp
17816eval $inlibc
17817
17818: see if tcsetpgrp exists
17819set tcsetpgrp d_tcsetpgrp
17820eval $inlibc
17821
17822: see if prototype for telldir is available
17823echo " "
17824set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17825eval $hasproto
17826
ad493445
MB
17827: see if time exists
17828echo " "
17829if test "X$d_time" = X -o X"$timetype" = X; then
17830 if set time val -f d_time; eval $csym; $val; then
17831 echo 'time() found.' >&4
17832 val="$define"
17833 rp="What is the type returned by time() on this system?"
17834 set time_t timetype long stdio.h sys/types.h
17835 eval $typedef_ask
17836 else
17837 echo 'time() not found, hope that will do.' >&4
17838 val="$undef"
17839 timetype='int';
17840 fi
17841 set d_time
17842 eval $setvar
17843fi
17844
b4eb6b3d
JH
17845: see if this is a sys/times.h system
17846set sys/times.h i_systimes
17847eval $inhdr
17848
17849: see if times exists
17850echo " "
17851if set times val -f d_times; eval $csym; $val; then
17852 echo 'times() found.' >&4
17853 d_times="$define"
17854 inc=''
17855 case "$i_systimes" in
17856 "$define") inc='sys/times.h';;
17857 esac
17858 rp="What is the type returned by times() on this system?"
17859 set clock_t clocktype long stdio.h sys/types.h $inc
17860 eval $typedef_ask
17861else
17862 echo 'times() NOT found, hope that will do.' >&4
17863 d_times="$undef"
17864 clocktype='int'
17865fi
17866
10bc17b6
JH
17867: see if tmpnam_r exists
17868set tmpnam_r d_tmpnam_r
17869eval $inlibc
17870case "$d_tmpnam_r" in
17871"$define")
31ee0cb7 17872 hdrs="$i_systypes sys/types.h define stdio.h "
c18e646a
JH
17873 case "$d_tmpnam_r_proto:$usethreads" in
17874 ":define") d_tmpnam_r_proto=define
a48ec845
JH
17875 set d_tmpnam_r_proto tmpnam_r $hdrs
17876 eval $hasproto ;;
17877 *) ;;
17878 esac
17879 case "$d_tmpnam_r_proto" in
17880 define)
10bc17b6
JH
17881 case "$tmpnam_r_proto" in
17882 ''|0) try='char* tmpnam_r(char*);'
17883 ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17884 esac
17885 case "$tmpnam_r_proto" in
90e831dc 17886 ''|0) d_tmpnam_r=undef
10bc17b6 17887 tmpnam_r_proto=0
a48ec845 17888 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17889 * ) case "$tmpnam_r_proto" in
17890 REENTRANT_PROTO*) ;;
17891 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17892 esac
17893 echo "Prototype: $try" ;;
17894 esac
17895 ;;
c18e646a
JH
17896 *) case "$usethreads" in
17897 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17898 esac
90e831dc
SB
17899 d_tmpnam_r=undef
17900 tmpnam_r_proto=0
c18e646a 17901 ;;
a48ec845
JH
17902 esac
17903 ;;
10bc17b6
JH
17904*) tmpnam_r_proto=0
17905 ;;
17906esac
17907
b4eb6b3d
JH
17908: see if truncate exists
17909set truncate d_truncate
17910eval $inlibc
17911
10bc17b6
JH
17912: see if ttyname_r exists
17913set ttyname_r d_ttyname_r
17914eval $inlibc
17915case "$d_ttyname_r" in
17916"$define")
17917 hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
c18e646a
JH
17918 case "$d_ttyname_r_proto:$usethreads" in
17919 ":define") d_ttyname_r_proto=define
a48ec845
JH
17920 set d_ttyname_r_proto ttyname_r $hdrs
17921 eval $hasproto ;;
17922 *) ;;
17923 esac
17924 case "$d_ttyname_r_proto" in
17925 define)
10bc17b6
JH
17926 case "$ttyname_r_proto" in
17927 ''|0) try='int ttyname_r(int, char*, size_t);'
17928 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17929 esac
17930 case "$ttyname_r_proto" in
17931 ''|0) try='int ttyname_r(int, char*, int);'
17932 ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17933 esac
17934 case "$ttyname_r_proto" in
17935 ''|0) try='char* ttyname_r(int, char*, int);'
17936 ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17937 esac
17938 case "$ttyname_r_proto" in
90e831dc 17939 ''|0) d_ttyname_r=undef
10bc17b6 17940 ttyname_r_proto=0
a48ec845 17941 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
10bc17b6
JH
17942 * ) case "$ttyname_r_proto" in
17943 REENTRANT_PROTO*) ;;
17944 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17945 esac
17946 echo "Prototype: $try" ;;
17947 esac
17948 ;;
c18e646a
JH
17949 *) case "$usethreads" in
17950 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17951 esac
90e831dc
SB
17952 d_ttyname_r=undef
17953 ttyname_r_proto=0
c18e646a 17954 ;;
a48ec845
JH
17955 esac
17956 ;;
10bc17b6
JH
17957*) ttyname_r_proto=0
17958 ;;
17959esac
17960
b4eb6b3d
JH
17961: see if tzname[] exists
17962echo " "
17963if set tzname val -a d_tzname; eval $csym; $val; then
17964 val="$define"
17965 echo 'tzname[] found.' >&4
17966else
17967 val="$undef"
17968 echo 'tzname[] NOT found.' >&4
17969fi
17970set d_tzname
17971eval $setvar
17972
4e0554ec
JH
17973case "$osname" in
17974next|rhapsody|darwin) multiarch="$define" ;;
17975esac
17976case "$multiarch" in
17977''|[nN]*) multiarch="$undef" ;;
17978esac
17979
24412007 17980: check for ordering of bytes in a UV
4e0554ec 17981echo " "
5440bc8e 17982case "$usecrosscompile$multiarch" in
4e0554ec
JH
17983*$define*)
17984 $cat <<EOM
17985You seem to be either cross-compiling or doing a multiarchitecture build,
17986skipping the byteorder check.
17987
17988EOM
5440bc8e 17989 byteorder='ffff'
4e0554ec
JH
17990 ;;
17991*)
17992 case "$byteorder" in
17993 '')
17994 $cat <<'EOM'
17995In the following, larger digits indicate more significance. A big-endian
17996machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17997little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17998machines may have weird orders like 3412. A Cray will report 87654321,
17999an Alpha will report 12345678. If the test program works the default is
18000probably right.
18001I'm now running the test program...
18002EOM
24412007 18003 $cat >try.c <<EOCP
4e0554ec 18004#include <stdio.h>
55954f19
JH
18005#$i_stdlib I_STDLIB
18006#ifdef I_STDLIB
18007#include <stdlib.h>
18008#endif
24412007
JH
18009#include <sys/types.h>
18010typedef $uvtype UV;
4e0554ec
JH
18011int main()
18012{
18013 int i;
18014 union {
24412007
JH
18015 UV l;
18016 char c[$uvsize];
4e0554ec
JH
18017 } u;
18018
24412007 18019 if ($uvsize > 4)
b5ded3e5 18020 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
4e0554ec 18021 else
a4c53327 18022 u.l = (UV)0x04030201;
24412007 18023 for (i = 0; i < $uvsize; i++)
4e0554ec
JH
18024 printf("%c", u.c[i]+'0');
18025 printf("\n");
18026 exit(0);
18027}
18028EOCP
18029 xxx_prompt=y
18030 set try
43dddb59 18031 if eval $compile && $run ./try > /dev/null; then
5440bc8e 18032 dflt=`$run ./try`
4e0554ec
JH
18033 case "$dflt" in
18034 [1-4][1-4][1-4][1-4]|12345678|87654321)
18035 echo "(The test program ran ok.)"
18036 echo "byteorder=$dflt"
18037 xxx_prompt=n
18038 ;;
18039 ????|????????) echo "(The test program ran ok.)" ;;
18040 *) echo "(The test program didn't run right for some reason.)" ;;
18041 esac
18042 else
18043 dflt='4321'
18044 cat <<'EOM'
18045(I can't seem to compile the test program. Guessing big-endian...)
18046EOM
18047 fi
18048 case "$xxx_prompt" in
18049 y)
24412007 18050 rp="What is the order of bytes in $uvtype?"
4e0554ec
JH
18051 . ./myread
18052 byteorder="$ans"
18053 ;;
18054 *) byteorder=$dflt
18055 ;;
18056 esac
18057 ;;
18058 esac
5b813a60 18059 $rm_try
4e0554ec
JH
18060 ;;
18061esac
18062
4e0554ec
JH
18063$cat <<EOM
18064
18065Checking to see whether you can access character data unalignedly...
18066EOM
dc7b0a4f
JH
18067case "$d_u32align" in
18068'') $cat >try.c <<EOCP
4e0554ec 18069#include <stdio.h>
d1daaddf
JH
18070#$i_stdlib I_STDLIB
18071#ifdef I_STDLIB
18072#include <stdlib.h>
18073#endif
4e0554ec 18074#define U32 $u32type
d308175a
JH
18075#define BYTEORDER 0x$byteorder
18076#define U8 $u8type
9958dc3c
JH
18077#include <signal.h>
18078#ifdef SIGBUS
7090f861 18079$signal_t bletch(int s) { exit(4); }
9958dc3c 18080#endif
4e0554ec
JH
18081int main() {
18082#if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
8906a23e 18083 U8 buf[8];
4e0554ec
JH
18084 U32 *up;
18085 int i;
18086
18087 if (sizeof(U32) != 4) {
18088 printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18089 exit(1);
18090 }
18091
18092 fflush(stdout);
18093
9958dc3c
JH
18094#ifdef SIGBUS
18095 signal(SIGBUS, bletch);
18096#endif
18097
8906a23e
JH
18098 buf[0] = 0;
18099 buf[1] = 0;
18100 buf[2] = 0;
18101 buf[3] = 1;
7eac3fd6 18102 buf[4] = 0;
8906a23e
JH
18103 buf[5] = 0;
18104 buf[6] = 0;
7eac3fd6 18105 buf[7] = 1;
8906a23e 18106
4e0554ec
JH
18107 for (i = 0; i < 4; i++) {
18108 up = (U32*)(buf + i);
18109 if (! ((*up == 1 << (8*i)) || /* big-endian */
18110 (*up == 1 << (8*(3-i))) /* little-endian */
18111 )
18112 )
18113 {
18114 printf("read failed (%x)\n", *up);
18115 exit(2);
18116 }
18117 }
18118
18119 /* write test */
18120 for (i = 0; i < 4; i++) {
18121 up = (U32*)(buf + i);
18122 *up = 0xBeef;
18123 if (*up != 0xBeef) {
18124 printf("write failed (%x)\n", *up);
18125 exit(3);
18126 }
18127 }
18128
18129 exit(0);
18130#else
18131 printf("1\n");
18132 exit(1);
18133#endif
18134 return 0;
18135}
18136EOCP
18137set try
18138if eval $compile_ok; then
d308175a 18139 echo "(Testing for character data alignment may crash the test. That's okay.)" >&4
5440bc8e 18140 $run ./try 2>&1 >/dev/null
4e0554ec
JH
18141 case "$?" in
18142 0) cat >&4 <<EOM
18143You can access character data pretty unalignedly.
18144EOM
18145 d_u32align="$undef"
18146 ;;
18147 *) cat >&4 <<EOM
18148It seems that you must access character data in an aligned manner.
18149EOM
18150 d_u32align="$define"
18151 ;;
18152 esac
4e0554ec
JH
18153else
18154 rp='Can you access character data at unaligned addresses?'
18155 dflt='n'
18156 . ./myread
18157 case "$ans" in
18158 [yY]*) d_u32align="$undef" ;;
18159 *) d_u32align="$define" ;;
18160 esac
18161fi
5b813a60 18162$rm_try
dc7b0a4f
JH
18163;;
18164esac
4e0554ec
JH
18165
18166: see if ualarm exists
18167set ualarm d_ualarm
18168eval $inlibc
18169
b4eb6b3d
JH
18170: see if umask exists
18171set umask d_umask
18172eval $inlibc
18173
758a5d79
JH
18174: see if unordered exists
18175set unordered d_unordered
18176eval $inlibc
18177
bdf33aa7
SP
18178: see if unsetenv exists
18179set unsetenv d_unsetenv
18180eval $inlibc
18181
4e0554ec
JH
18182: see if usleep exists
18183set usleep d_usleep
18184eval $inlibc
18185
2ef53570
JH
18186: see if prototype for usleep is available
18187echo " "
18188set d_usleepproto usleep $i_unistd unistd.h
18189eval $hasproto
18190
b4eb6b3d
JH
18191: see if ustat exists
18192set ustat d_ustat
18193eval $inlibc
18194
b4eb6b3d
JH
18195: see if closedir exists
18196set closedir d_closedir
18197eval $inlibc
18198
18199case "$d_closedir" in
18200"$define")
18201 echo " "
18202 echo "Checking whether closedir() returns a status..." >&4
5440bc8e 18203 cat > try.c <<EOM
b4eb6b3d
JH
18204#$i_dirent I_DIRENT /**/
18205#$i_sysdir I_SYS_DIR /**/
18206#$i_sysndir I_SYS_NDIR /**/
18207#$i_systypes I_SYS_TYPES /**/
18208
18209#if defined(I_SYS_TYPES)
18210#include <sys/types.h>
18211#endif
18212#if defined(I_DIRENT)
18213#include <dirent.h>
18214#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18215#include <sys/dir.h>
18216#endif
18217#else
18218#ifdef I_SYS_NDIR
18219#include <sys/ndir.h>
18220#else
18221#ifdef I_SYS_DIR
18222#ifdef hp9000s500
18223#include <ndir.h> /* may be wrong in the future */
18224#else
18225#include <sys/dir.h>
18226#endif
18227#endif
18228#endif
5b813a60 18229#endif
b4eb6b3d
JH
18230int main() { return closedir(opendir(".")); }
18231EOM
5440bc8e 18232 set try
b4eb6b3d 18233 if eval $compile_ok; then
5440bc8e 18234 if $run ./try > /dev/null 2>&1 ; then
b4eb6b3d
JH
18235 echo "Yes, it does."
18236 val="$undef"
18237 else
18238 echo "No, it doesn't."
18239 val="$define"
18240 fi
18241 else
18242 echo "(I can't seem to compile the test program--assuming it doesn't)"
18243 val="$define"
18244 fi
18245 ;;
18246*)
18247 val="$undef";
18248 ;;
18249esac
18250set d_void_closedir
18251eval $setvar
5b813a60
MB
18252$rm_try
18253
b4eb6b3d
JH
18254: see if there is a wait4
18255set wait4 d_wait4
18256eval $inlibc
18257
18258: see if waitpid exists
18259set waitpid d_waitpid
18260eval $inlibc
18261
18262: see if wcstombs exists
18263set wcstombs d_wcstombs
18264eval $inlibc
18265
18266: see if wctomb exists
18267set wctomb d_wctomb
18268eval $inlibc
18269
4e0554ec
JH
18270: see if writev exists
18271set writev d_writev
18272eval $inlibc
18273
b4eb6b3d
JH
18274: preserve RCS keywords in files with variable substitution, grrr
18275Date='$Date'
18276Id='$Id'
18277Log='$Log'
18278RCSfile='$RCSfile'
18279Revision='$Revision'
18280
b4eb6b3d
JH
18281: check for alignment requirements
18282echo " "
5440bc8e 18283case "$usecrosscompile$multiarch" in
b4eb6b3d
JH
18284*$define*)
18285 $cat <<EOM
18286You seem to be either cross-compiling or doing a multiarchitecture build,
18287skipping the memory alignment check.
18288
18289EOM
18290 case "$alignbytes" in
18291 '') alignbytes=8 ;;
18292 esac
18293 ;;
18294*)
18295 case "$alignbytes" in
18296 '') echo "Checking alignment constraints..." >&4
18297 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18298 $cat >try.c <<'EOCP'
18299typedef long double NV;
18300EOCP
18301 else
18302 $cat >try.c <<'EOCP'
18303typedef double NV;
18304EOCP
18305 fi
18306 $cat >>try.c <<'EOCP'
18307#include <stdio.h>
18308struct foobar {
18309 char foo;
18310 NV bar;
18311} try_algn;
18312int main()
18313{
18314 printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18315 return(0);
18316}
18317EOCP
18318 set try
18319 if eval $compile_ok; then
5440bc8e 18320 dflt=`$run ./try`
b4eb6b3d
JH
18321 else
18322 dflt='8'
18323 echo "(I can't seem to compile the test program...)"
18324 fi
18325 ;;
18326 *) dflt="$alignbytes"
18327 ;;
18328 esac
18329 rp="Doubles must be aligned on a how-many-byte boundary?"
18330 . ./myread
18331 alignbytes="$ans"
5b813a60 18332 $rm_try
b4eb6b3d
JH
18333 ;;
18334esac
18335
18336
18337: set the base revision
18338baserev=5.0
18339
3099fc99 18340: how do we concatenate cpp tokens here?
b4eb6b3d 18341echo " "
3099fc99 18342echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
b4eb6b3d
JH
18343$cat >cpp_stuff.c <<'EOCP'
18344#define RCAT(a,b)a/**/b
18345#define ACAT(a,b)a ## b
18346RCAT(Rei,ser)
18347ACAT(Cir,cus)
18348EOCP
18349$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18350if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18351 echo "Oh! Smells like ANSI's been here." >&4
18352 echo "We can catify or stringify, separately or together!"
18353 cpp_stuff=42
18354elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18355 echo "Ah, yes! The good old days!" >&4
18356 echo "However, in the good old days we don't know how to stringify and"
18357 echo "catify at the same time."
18358 cpp_stuff=1
18359else
18360 $cat >&4 <<EOM
3099fc99
CW
18361Hmm, I don't seem to be able to concatenate tokens with your cpp.
18362You're going to have to edit the values of CAT[2-5] in config.h...
b4eb6b3d
JH
18363EOM
18364 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18365fi
18366$rm -f cpp_stuff.*
18367
18368: see if this is a db.h system
18369set db.h i_db
18370eval $inhdr
18371
18372case "$i_db" in
18373$define)
18374 : Check db version.
18375 echo " "
18376 echo "Checking Berkeley DB version ..." >&4
18377 $cat >try.c <<EOCP
18378#$d_const HASCONST
18379#ifndef HASCONST
18380#define const
18381#endif
18382#include <sys/types.h>
18383#include <stdio.h>
55954f19
JH
18384#$i_stdlib I_STDLIB
18385#ifdef I_STDLIB
18386#include <stdlib.h>
18387#endif
b4eb6b3d 18388#include <db.h>
640374d0 18389int main(int argc, char *argv[])
b4eb6b3d
JH
18390{
18391#ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18392 int Major, Minor, Patch ;
18393 unsigned long Version ;
18394 (void)db_version(&Major, &Minor, &Patch) ;
640374d0
JH
18395 if (argc == 2) {
18396 printf("%d %d %d %d %d %d\n",
18397 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18398 Major, Minor, Patch);
18399 exit(0);
18400 }
18401 printf("You have Berkeley DB Version 2 or greater.\n");
b4eb6b3d
JH
18402
18403 printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18404 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18405 printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18406 Major, Minor, Patch) ;
18407
18408 /* check that db.h & libdb are compatible */
18409 if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
640374d0 18410 printf("db.h and libdb are incompatible.\n") ;
5b813a60 18411 exit(3);
b4eb6b3d
JH
18412 }
18413
640374d0 18414 printf("db.h and libdb are compatible.\n") ;
b4eb6b3d
JH
18415
18416 Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18417 + DB_VERSION_PATCH ;
18418
18419 /* needs to be >= 2.3.4 */
18420 if (Version < 2003004) {
18421 /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
640374d0 18422 printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
5b813a60 18423 exit(2);
b4eb6b3d
JH
18424 }
18425
18426 exit(0);
18427#else
18428#if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
640374d0
JH
18429 if (argc == 2) {
18430 printf("1 0 0\n");
18431 exit(0);
18432 }
18433 printf("You have Berkeley DB Version 1.\n");
b4eb6b3d
JH
18434 exit(0); /* DB version < 2: the coast is clear. */
18435#else
18436 exit(1); /* <db.h> not Berkeley DB? */
18437#endif
18438#endif
18439}
18440EOCP
18441 set try
5440bc8e 18442 if eval $compile_ok && $run ./try; then
b4eb6b3d 18443 echo 'Looks OK.' >&4
5440bc8e 18444 set `$run ./try 1`
640374d0
JH
18445 db_version_major=$1
18446 db_version_minor=$2
18447 db_version_patch=$3
b4eb6b3d
JH
18448 else
18449 echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4
18450 i_db=$undef
18451 case " $libs " in
18452 *"-ldb "*)
18453 : Remove db from list of libraries to use
18454 echo "Removing unusable -ldb from library list" >&4
18455 set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18456 shift
18457 libs="$*"
18458 echo "libs = $libs" >&4
18459 ;;
18460 esac
18461 fi
5b813a60 18462 $rm_try
b4eb6b3d
JH
18463 ;;
18464esac
18465
18466case "$i_db" in
18467define)
5b813a60 18468 : Check the return type needed for hash
b4eb6b3d
JH
18469 echo " "
18470 echo "Checking return type needed for hash for Berkeley DB ..." >&4
18471 $cat >try.c <<EOCP
18472#$d_const HASCONST
18473#ifndef HASCONST
18474#define const
18475#endif
18476#include <sys/types.h>
18477#include <db.h>
18478
18479#ifndef DB_VERSION_MAJOR
18480u_int32_t hash_cb (ptr, size)
18481const void *ptr;
18482size_t size;
18483{
18484}
18485HASHINFO info;
18486int main()
18487{
18488 info.hash = hash_cb;
18489}
18490#endif
18491EOCP
18492 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18493 if $contains warning try.out >>/dev/null 2>&1 ; then
18494 db_hashtype='int'
18495 else
18496 db_hashtype='u_int32_t'
18497 fi
18498 else
18499 : XXX Maybe we should just give up here.
18500 db_hashtype=u_int32_t
18501 $cat try.out >&4
18502 echo "Help: I can't seem to compile the db test program." >&4
18503 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18504 fi
5b813a60 18505 $rm_try
b4eb6b3d
JH
18506 echo "Your version of Berkeley DB uses $db_hashtype for hash."
18507 ;;
18508*) db_hashtype=u_int32_t
18509 ;;
18510esac
18511case "$i_db" in
18512define)
5b813a60 18513 : Check the return type needed for prefix
b4eb6b3d
JH
18514 echo " "
18515 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18516 cat >try.c <<EOCP
18517#$d_const HASCONST
18518#ifndef HASCONST
18519#define const
18520#endif
18521#include <sys/types.h>
18522#include <db.h>
18523
18524#ifndef DB_VERSION_MAJOR
18525size_t prefix_cb (key1, key2)
18526const DBT *key1;
18527const DBT *key2;
18528{
18529}
18530BTREEINFO info;
18531int main()
18532{
18533 info.prefix = prefix_cb;
18534}
18535#endif
18536EOCP
18537 if $cc $ccflags -c try.c >try.out 2>&1 ; then
18538 if $contains warning try.out >>/dev/null 2>&1 ; then
18539 db_prefixtype='int'
18540 else
18541 db_prefixtype='size_t'
18542 fi
18543 else
18544 db_prefixtype='size_t'
18545 : XXX Maybe we should just give up here.
18546 $cat try.out >&4
18547 echo "Help: I can't seem to compile the db test program." >&4
18548 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18549 fi
5b813a60 18550 $rm_try
b4eb6b3d
JH
18551 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18552 ;;
18553*) db_prefixtype='size_t'
18554 ;;
18555esac
18556
b4eb6b3d
JH
18557: How can we generate normalized random numbers ?
18558echo " "
18559echo "Looking for a random number function..." >&4
18560case "$randfunc" in
18561'')
18562 if set drand48 val -f; eval $csym; $val; then
18563 dflt="drand48"
18564 echo "Good, found drand48()." >&4
18565 elif set random val -f; eval $csym; $val; then
18566 dflt="random"
18567 echo "OK, found random()." >&4
18568 else
18569 dflt="rand"
18570 echo "Yick, looks like I have to use rand()." >&4
18571 fi
18572 echo " "
18573 ;;
18574*)
18575 dflt="$randfunc"
18576 ;;
18577esac
18578cont=true
18579
18580case "$ccflags" in
18581*-Dmy_rand=*|*-Dmy_srand=*)
18582 echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18583 ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18584 ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18585 ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18586 ;;
18587esac
18588
18589while $test "$cont"; do
18590 rp="Use which function to generate random numbers?"
18591 . ./myread
18592 if $test "$ans" = "$dflt"; then
18593 : null
18594 else
18595 randbits=''
18596 fi
18597 randfunc="$ans"
18598 if set $ans val -f; eval $csym; $val; then
18599 cont=''
18600 else
18601 dflt=y
18602 rp="I cannot find function $ans. Use that name anyway?"
18603 . ./myread
18604 dflt=rand
18605 case "$ans" in
18606 [yY]*) cont='';;
18607 esac
18608 fi
18609 case "$cont" in
18610 '')
18611 case "$randfunc" in
18612 drand48)
18613 drand01="drand48()"
18614 seedfunc="srand48"
18615 randbits=48
18616 randseedtype=long
18617 ;;
18618 rand|random)
18619 case "$randbits" in
18620 '')
18621echo "Checking to see how many bits your $randfunc() function produces..." >&4
18622 $cat >try.c <<EOCP
18623#$i_unistd I_UNISTD
18624#$i_stdlib I_STDLIB
18625#include <stdio.h>
18626#ifdef I_UNISTD
18627# include <unistd.h>
18628#endif
18629#ifdef I_STDLIB
18630# include <stdlib.h>
18631#endif
18632int main()
18633{
18634 register int i;
18635 register unsigned long tmp;
18636 register unsigned long max = 0L;
18637
18638 for (i = 1000; i; i--) {
18639 tmp = (unsigned long) $randfunc();
18640 if (tmp > max) max = tmp;
18641 }
18642 for (i = 0; max; i++)
18643 max /= 2;
18644 printf("%d\n",i);
18645}
18646EOCP
18647 set try
18648 if eval $compile_ok; then
18649 dflt=`try`
18650 else
18651 dflt='?'
18652 echo "(I can't seem to compile the test program...)"
18653 fi
18654 ;;
18655 *)
18656 dflt="$randbits"
18657 ;;
18658 esac
18659 rp="How many bits does your $randfunc() function produce?"
18660 . ./myread
18661 randbits="$ans"
5b813a60 18662 $rm_try
b4eb6b3d
JH
18663 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18664 seedfunc="s$randfunc"
18665 randseedtype=unsigned
18666 ;;
18667 *)
18668 dflt="31"
18669 rp="How many bits does your $randfunc() function produce?"
18670 . ./myread
18671 randbits="$ans"
18672 seedfunc="s$randfunc"
18673 drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18674 if set $seedfunc val -f; eval $csym; $val; then
18675 echo "(Using $seedfunc() to seed random generator)"
18676 else
18677 echo "(Warning: no $seedfunc() to seed random generator)"
18678 seedfunc=rand
18679 fi
18680 randseedtype=unsigned
18681 ;;
18682 esac
18683 ;;
18684 esac
18685done
18686
18687echo " "
18688echo "Determining whether or not we are on an EBCDIC system..." >&4
5440bc8e 18689$cat >try.c <<'EOM'
b4eb6b3d
JH
18690int main()
18691{
18692 if ('M'==0xd4) return 0;
18693 return 1;
18694}
18695EOM
18696
18697val=$undef
5440bc8e 18698set try
b4eb6b3d 18699if eval $compile_ok; then
5440bc8e 18700 if $run ./try; then
b4eb6b3d
JH
18701 echo "You seem to speak EBCDIC." >&4
18702 val="$define"
18703 else
5440bc8e 18704 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
b4eb6b3d
JH
18705 fi
18706else
18707 echo "I'm unable to compile the test program." >&4
18708 echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18709fi
5b813a60 18710$rm_try
b4eb6b3d
JH
18711set ebcdic
18712eval $setvar
18713
18714echo " "
18715$cat >&4 <<EOM
18716Checking how to flush all pending stdio output...
18717EOM
18718# I only know how to find the first 32 possibly open files on SunOS.
18719# See also hints/sunos_4_1.sh and util.c --AD
18720case "$osname" in
18721sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18722esac
18723$cat >>try.c <<EOCP
18724#include <stdio.h>
55954f19
JH
18725#$i_stdlib I_STDLIB
18726#ifdef I_STDLIB
18727#include <stdlib.h>
18728#endif
b4eb6b3d
JH
18729#$i_unistd I_UNISTD
18730#ifdef I_UNISTD
18731# include <unistd.h>
18732#endif
18733#$d_sysconf HAS_SYSCONF
18734#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18735#ifdef HAS_STDIO_STREAM_ARRAY
18736# define STDIO_STREAM_ARRAY $stdio_stream_array
18737#endif
18738int main() {
5440bc8e
JH
18739 FILE* p;
18740 unlink("try.out");
18741 p = fopen("try.out", "w");
b4eb6b3d
JH
18742#ifdef TRY_FPUTC
18743 fputc('x', p);
18744#else
18745# ifdef TRY_FPRINTF
18746 fprintf(p, "x");
18747# endif
18748#endif
18749#ifdef TRY_FFLUSH_NULL
18750 fflush(NULL);
18751#endif
18752#ifdef TRY_FFLUSH_ALL
18753 {
18754 long open_max = -1;
18755# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18756 open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18757# else
18758# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18759 open_max = sysconf(_SC_OPEN_MAX);
18760# else
18761# ifdef FOPEN_MAX
18762 open_max = FOPEN_MAX;
18763# else
18764# ifdef OPEN_MAX
18765 open_max = OPEN_MAX;
18766# else
18767# ifdef _NFILE
18768 open_max = _NFILE;
18769# endif
18770# endif
18771# endif
18772# endif
5b813a60 18773# endif
b4eb6b3d
JH
18774# ifdef HAS_STDIO_STREAM_ARRAY
18775 if (open_max > 0) {
18776 long i;
18777 for (i = 0; i < open_max; i++)
18778 if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18779 STDIO_STREAM_ARRAY[i]._file < open_max &&
18780 STDIO_STREAM_ARRAY[i]._flag)
18781 fflush(&STDIO_STREAM_ARRAY[i]);
5b813a60 18782 }
b4eb6b3d
JH
18783 }
18784# endif
18785#endif
18786 _exit(42);
18787}
18788EOCP
18789: first we have to find out how _not_ to flush
5440bc8e 18790$to try.c
b4eb6b3d
JH
18791if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18792 output=''
18793 set try -DTRY_FPUTC
18794 if eval $compile; then
fbe73d74 18795 $run ./try 2>/dev/null
28f5ac64 18796 code="$?"
5440bc8e 18797 $from try.out
28f5ac64 18798 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18799 output=-DTRY_FPUTC
18800 fi
18801 fi
18802 case "$output" in
18803 '')
18804 set try -DTRY_FPRINTF
b4eb6b3d 18805 if eval $compile; then
fbe73d74 18806 $run ./try 2>/dev/null
28f5ac64 18807 code="$?"
5440bc8e 18808 $from try.out
28f5ac64 18809 if $test ! -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18810 output=-DTRY_FPRINTF
18811 fi
18812 fi
18813 ;;
18814 esac
18815fi
18816: check for fflush NULL behaviour
18817case "$fflushNULL" in
18818'') set try -DTRY_FFLUSH_NULL $output
18819 if eval $compile; then
5440bc8e 18820 $run ./try 2>/dev/null
b4eb6b3d 18821 code="$?"
5440bc8e 18822 $from try.out
b4eb6b3d
JH
18823 if $test -s try.out -a "X$code" = X42; then
18824 fflushNULL="`$cat try.out`"
18825 else
18826 if $test "X$code" != X42; then
18827 $cat >&4 <<EOM
18828(If this test failed, don't worry, we'll try another method shortly.)
18829EOM
18830 fi
18831 fi
18832 fi
5b813a60 18833 $rm_try
b4eb6b3d
JH
18834 case "$fflushNULL" in
18835 x) $cat >&4 <<EOM
18836Your fflush(NULL) works okay for output streams.
18837Let's see if it clobbers input pipes...
18838EOM
18839# As of mid-March 2000 all versions of Solaris appear to have a stdio
18840# bug that improperly flushes the input end of pipes. So we avoid the
18841# autoflush on fork/system/exec support for now. :-(
18842$cat >tryp.c <<EOCP
18843#include <stdio.h>
18844int
18845main(int argc, char **argv)
18846{
18847 char buf[1024];
18848 int i;
18849 char *bp = buf;
18850 while (1) {
18851 while ((i = getc(stdin)) != -1
18852 && (*bp++ = i) != '\n'
18853 && bp < &buf[1024])
18854 /* DO NOTHING */ ;
18855 *bp = '\0';
18856 fprintf(stdout, "%s", buf);
18857 fflush(NULL);
18858 if (i == -1)
18859 return 0;
18860 bp = buf;
18861 }
18862}
18863EOCP
18864 fflushNULL="$define"
18865 set tryp
18866 if eval $compile; then
18867 $rm -f tryp.out
5440bc8e 18868 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18869 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18870 $cat >&4 <<EOM
18871fflush(NULL) seems to behave okay with input streams.
18872EOM
18873 fflushNULL="$define"
18874 else
18875 $cat >&4 <<EOM
18876Ouch, fflush(NULL) clobbers input pipes! We will not use it.
18877EOM
18878 fflushNULL="$undef"
18879 fi
18880 fi
18881 $rm -f core tryp.c tryp.core core.tryp.*
18882 ;;
18883 '') $cat >&4 <<EOM
18884Your fflush(NULL) isn't working (contrary to ANSI C).
18885EOM
18886 fflushNULL="$undef"
18887 ;;
18888 *) $cat >&4 <<EOM
18889Cannot figure out whether your fflush(NULL) works or not.
18890I'm assuming it doesn't (contrary to ANSI C).
18891EOM
18892 fflushNULL="$undef"
18893 ;;
18894 esac
18895 ;;
18896$define|true|[yY]*)
18897 fflushNULL="$define"
18898 ;;
18899*)
18900 fflushNULL="$undef"
18901 ;;
18902esac
18903: check explicit looping only if NULL did not work, and if the pipe
18904: bug does not show up on an explicit flush too
18905case "$fflushNULL" in
18906"$undef")
18907 $cat >tryp.c <<EOCP
18908#include <stdio.h>
18909int
18910main(int argc, char **argv)
18911{
18912 char buf[1024];
18913 int i;
18914 char *bp = buf;
18915 while (1) {
18916 while ((i = getc(stdin)) != -1
18917 && (*bp++ = i) != '\n'
18918 && bp < &buf[1024])
18919 /* DO NOTHING */ ;
18920 *bp = '\0';
18921 fprintf(stdout, "%s", buf);
18922 fflush(stdin);
18923 if (i == -1)
18924 return 0;
18925 bp = buf;
18926 }
18927}
18928EOCP
18929 set tryp
18930 if eval $compile; then
18931 $rm -f tryp.out
5440bc8e 18932 $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
b4eb6b3d
JH
18933 if cmp tryp.c tryp.out >/dev/null 2>&1; then
18934 $cat >&4 <<EOM
18935Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18936EOM
18937 : now check for fflushall behaviour
18938 case "$fflushall" in
18939 '') set try -DTRY_FFLUSH_ALL $output
18940 if eval $compile; then
18941 $cat >&4 <<EOM
18942(Now testing the other method--but note that this also may fail.)
18943EOM
5440bc8e 18944 $run ./try 2>/dev/null
28f5ac64 18945 code=$?
fbe73d74 18946 $from try.out
28f5ac64 18947 if $test -s try.out -a "X$code" = X42; then
b4eb6b3d
JH
18948 fflushall="`$cat try.out`"
18949 fi
18950 fi
5b813a60 18951 $rm_try
b4eb6b3d
JH
18952 case "$fflushall" in
18953 x) $cat >&4 <<EOM
18954Whew. Flushing explicitly all the stdio streams works.
18955EOM
18956 fflushall="$define"
18957 ;;
18958 '') $cat >&4 <<EOM
18959Sigh. Flushing explicitly all the stdio streams doesn't work.
18960EOM
18961 fflushall="$undef"
18962 ;;
18963 *) $cat >&4 <<EOM
18964Cannot figure out whether flushing stdio streams explicitly works or not.
18965I'm assuming it doesn't.
18966EOM
18967 fflushall="$undef"
18968 ;;
18969 esac
18970 ;;
18971 "$define"|true|[yY]*)
18972 fflushall="$define"
18973 ;;
18974 *)
18975 fflushall="$undef"
18976 ;;
18977 esac
18978 else
18979 $cat >&4 <<EOM
18980All is futile. Even fflush(stdin) clobbers input pipes!
18981EOM
18982 fflushall="$undef"
18983 fi
18984 else
18985 fflushall="$undef"
18986 fi
18987 $rm -f core tryp.c tryp.core core.tryp.*
18988 ;;
18989*) fflushall="$undef"
18990 ;;
18991esac
18992
18993case "$fflushNULL$fflushall" in
18994undefundef)
18995 $cat <<EOM
18996OK, I give up. I cannot figure out how to flush pending stdio output.
18997We won't be flushing handles at all before fork/exec/popen.
18998EOM
18999 ;;
19000esac
5b813a60 19001$rm_try
b4eb6b3d
JH
19002
19003: Store the full pathname to the ar program for use in the C program
19004: Respect a hint or command line value for full_ar.
19005case "$full_ar" in
19006'') full_ar=$ar ;;
19007esac
19008
19009: Store the full pathname to the sed program for use in the C program
19010full_sed=$sed
19011
19012: see what type gids are declared as in the kernel
19013echo " "
19014echo "Looking for the type for group ids returned by getgid()."
19015set gid_t gidtype xxx stdio.h sys/types.h
19016eval $typedef
19017case "$gidtype" in
19018xxx)
19019 xxx=`./findhdr sys/user.h`
19020 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19021 case $1 in
19022 unsigned) dflt="$1 $2" ;;
19023 *) dflt="$1" ;;
19024 esac
19025 ;;
19026*) dflt="$gidtype";;
19027esac
19028case "$gidtype" in
19029gid_t) echo "gid_t found." ;;
19030*) rp="What is the type for group ids returned by getgid()?"
19031 . ./myread
19032 gidtype="$ans"
19033 ;;
19034esac
19035
19036echo " "
19037case "$gidtype" in
19038*_t) zzz="$gidtype" ;;
19039*) zzz="gid" ;;
19040esac
19041echo "Checking the size of $zzz..." >&4
19042cat > try.c <<EOCP
19043#include <sys/types.h>
19044#include <stdio.h>
d1daaddf
JH
19045#$i_stdlib I_STDLIB
19046#ifdef I_STDLIB
19047#include <stdlib.h>
19048#endif
b4eb6b3d
JH
19049int main() {
19050 printf("%d\n", (int)sizeof($gidtype));
19051 exit(0);
19052}
19053EOCP
19054set try
19055if eval $compile_ok; then
5440bc8e 19056 yyy=`$run ./try`
b4eb6b3d
JH
19057 case "$yyy" in
19058 '') gidsize=4
19059 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19060 ;;
19061 *) gidsize=$yyy
19062 echo "Your $zzz is $gidsize bytes long."
19063 ;;
19064 esac
19065else
19066 gidsize=4
19067 echo "(I can't compile the test program--guessing $gidsize.)" >&4
19068fi
19069
19070
19071echo " "
19072case "$gidtype" in
19073*_t) zzz="$gidtype" ;;
19074*) zzz="gid" ;;
19075esac
19076echo "Checking the sign of $zzz..." >&4
19077cat > try.c <<EOCP
19078#include <sys/types.h>
19079#include <stdio.h>
19080int main() {
19081 $gidtype foo = -1;
19082 if (foo < 0)
19083 printf("-1\n");
19084 else
19085 printf("1\n");
19086}
19087EOCP
19088set try
19089if eval $compile; then
5440bc8e 19090 yyy=`$run ./try`
b4eb6b3d
JH
19091 case "$yyy" in
19092 '') gidsign=1
19093 echo "(I can't execute the test program--guessing unsigned.)" >&4
19094 ;;
19095 *) gidsign=$yyy
19096 case "$gidsign" in
19097 1) echo "Your $zzz is unsigned." ;;
19098 -1) echo "Your $zzz is signed." ;;
19099 esac
19100 ;;
19101 esac
19102else
19103 gidsign=1
19104 echo "(I can't compile the test program--guessing unsigned.)" >&4
19105fi
19106
19107
19108echo " "
19109
19110if $test X"$quadtype" != X; then
19111
19112echo "Checking how to print 64-bit integers..." >&4
19113
19114if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19115 $cat >try.c <<'EOCP'
19116#include <sys/types.h>
19117#include <stdio.h>
19118int main() {
19119 int q = 12345678901;
19120 printf("%ld\n", q);
19121}
19122EOCP
19123 set try
19124 if eval $compile; then
5440bc8e 19125 yyy=`$run ./try`
b4eb6b3d
JH
19126 case "$yyy" in
19127 12345678901)
19128 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19129 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19130 echo "We will use %d."
19131 ;;
19132 esac
19133 fi
19134fi
19135
19136if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19137 $cat >try.c <<'EOCP'
19138#include <sys/types.h>
19139#include <stdio.h>
19140int main() {
19141 long q = 12345678901;
19142 printf("%ld\n", q);
19143}
19144EOCP
19145 set try
19146 if eval $compile; then
5440bc8e 19147 yyy=`$run ./try`
b4eb6b3d
JH
19148 case "$yyy" in
19149 12345678901)
19150 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19151 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19152 echo "We will use %ld."
19153 ;;
19154 esac
19155 fi
19156fi
19157
19158if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19159 $cat >try.c <<'EOCP'
19160#include <sys/types.h>
19161#include <inttypes.h>
19162#include <stdio.h>
19163int main() {
19164 int64_t q = 12345678901;
19165 printf("%" PRId64 "\n", q);
19166}
19167EOCP
19168 set try
19169 if eval $compile; then
5440bc8e 19170 yyy=`$run ./try`
b4eb6b3d
JH
19171 case "$yyy" in
19172 12345678901)
19173 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19174 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19175 echo "We will use the C9X style."
19176 ;;
19177 esac
19178 fi
19179fi
19180
2ef53570
JH
19181if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19182 $cat >try.c <<EOCP
b4eb6b3d
JH
19183#include <sys/types.h>
19184#include <stdio.h>
19185int main() {
2ef53570
JH
19186 $quadtype q = 12345678901;
19187 printf("%Ld\n", q);
b4eb6b3d
JH
19188}
19189EOCP
19190 set try
19191 if eval $compile; then
5440bc8e 19192 yyy=`$run ./try`
b4eb6b3d
JH
19193 case "$yyy" in
19194 12345678901)
2ef53570
JH
19195 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19196 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19197 echo "We will use %Ld."
b4eb6b3d
JH
19198 ;;
19199 esac
19200 fi
19201fi
19202
2ef53570
JH
19203if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19204 $cat >try.c <<'EOCP'
b4eb6b3d
JH
19205#include <sys/types.h>
19206#include <stdio.h>
19207int main() {
2ef53570
JH
19208 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19209 printf("%lld\n", q);
b4eb6b3d
JH
19210}
19211EOCP
19212 set try
19213 if eval $compile; then
5440bc8e 19214 yyy=`$run ./try`
b4eb6b3d
JH
19215 case "$yyy" in
19216 12345678901)
2ef53570
JH
19217 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19218 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19219 echo "We will use the %lld style."
b4eb6b3d
JH
19220 ;;
19221 esac
19222 fi
19223fi
19224
19225if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19226 $cat >try.c <<EOCP
19227#include <sys/types.h>
19228#include <stdio.h>
19229int main() {
19230 $quadtype q = 12345678901;
19231 printf("%qd\n", q);
19232}
19233EOCP
19234 set try
19235 if eval $compile; then
5440bc8e 19236 yyy=`$run ./try`
b4eb6b3d
JH
19237 case "$yyy" in
19238 12345678901)
19239 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19240 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19241 echo "We will use %qd."
19242 ;;
19243 esac
19244 fi
19245fi
19246
19247if $test X"$sPRId64" = X; then
19248 echo "Cannot figure out how to print 64-bit integers." >&4
19249fi
5b813a60 19250$rm_try
b4eb6b3d
JH
19251
19252fi
19253
19254case "$sPRId64" in
5b813a60
MB
19255'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19256 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
b4eb6b3d 19257 ;;
5b813a60
MB
19258*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19259 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
b4eb6b3d
JH
19260 ;;
19261esac
19262
19263
19264echo " "
19265$echo "Checking the format strings to be used for Perl's internal types..." >&4
19266
19267if $test X"$ivsize" = X8; then
19268 ivdformat="$sPRId64"
19269 uvuformat="$sPRIu64"
19270 uvoformat="$sPRIo64"
19271 uvxformat="$sPRIx64"
19272 uvXUformat="$sPRIXU64"
19273else
19274 if $test X"$ivsize" = X"$longsize"; then
19275 ivdformat='"ld"'
19276 uvuformat='"lu"'
19277 uvoformat='"lo"'
19278 uvxformat='"lx"'
19279 uvXUformat='"lX"'
19280 else
19281 if $test X"$ivsize" = X"$intsize"; then
19282 ivdformat='"d"'
19283 uvuformat='"u"'
19284 uvoformat='"o"'
19285 uvxformat='"x"'
19286 uvXUformat='"X"'
19287 else
19288 : far out
19289 if $test X"$ivsize" = X"$shortsize"; then
19290 ivdformat='"hd"'
19291 uvuformat='"hu"'
19292 uvoformat='"ho"'
19293 uvxformat='"hx"'
19294 uvXUformat='"hX"'
19295 fi
19296 fi
19297 fi
19298fi
19299
19300if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19301 nveformat="$sPRIeldbl"
19302 nvfformat="$sPRIfldbl"
19303 nvgformat="$sPRIgldbl"
19304 nvEUformat="$sPRIEUldbl"
19305 nvFUformat="$sPRIFUldbl"
19306 nvGUformat="$sPRIGUldbl"
19307else
19308 nveformat='"e"'
19309 nvfformat='"f"'
19310 nvgformat='"g"'
19311 nvEUformat='"E"'
19312 nvFUformat='"F"'
19313 nvGUformat='"G"'
19314fi
19315
19316case "$ivdformat" in
3c728e00 19317'') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
b4eb6b3d
JH
19318 exit 1
19319 ;;
19320esac
19321
19322
19323echo " "
19324$echo "Checking the format string to be used for gids..." >&4
19325
19326case "$gidsign" in
19327-1) if $test X"$gidsize" = X"$ivsize"; then
19328 gidformat="$ivdformat"
19329 else
19330 if $test X"$gidsize" = X"$longsize"; then
19331 gidformat='"ld"'
19332 else
19333 if $test X"$gidsize" = X"$intsize"; then
19334 gidformat='"d"'
19335 else
19336 if $test X"$gidsize" = X"$shortsize"; then
19337 gidformat='"hd"'
19338 fi
19339 fi
19340 fi
19341 fi
19342 ;;
19343*) if $test X"$gidsize" = X"$uvsize"; then
19344 gidformat="$uvuformat"
19345 else
19346 if $test X"$gidsize" = X"$longsize"; then
19347 gidformat='"lu"'
19348 else
19349 if $test X"$gidsize" = X"$intsize"; then
19350 gidformat='"u"'
19351 else
19352 if $test X"$gidsize" = X"$shortsize"; then
19353 gidformat='"hu"'
19354 fi
19355 fi
19356 fi
19357 fi
19358 ;;
19359esac
19360
19361: see if getgroups exists
19362set getgroups d_getgrps
19363eval $inlibc
19364
19365: see if setgroups exists
19366set setgroups d_setgrps
19367eval $inlibc
19368
19369
19370: Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19371echo " "
19372case "$d_getgrps$d_setgrps" in
19373*define*)
19374 case "$groupstype" in
19375 '') dflt="$gidtype" ;;
19376 *) dflt="$groupstype" ;;
19377 esac
19378 $cat <<EOM
19379What type of pointer is the second argument to getgroups() and setgroups()?
19380Usually this is the same as group ids, $gidtype, but not always.
19381
19382EOM
19383 rp='What type pointer is the second argument to getgroups() and setgroups()?'
19384 . ./myread
19385 groupstype="$ans"
19386 ;;
19387*) groupstype="$gidtype";;
19388esac
19389
d620c7b3 19390
fd655d33
NC
19391if $test $patchlevel -lt 9; then
19392: MAD is not available in 5.8.x or earlier.
19393 ans=n;
19394else
19395 case "$mad" in
19396 $define|true|[yY]*) dflt='y' ;;
19397 *) dflt='n' ;;
19398 esac
19399 cat <<EOM
d620c7b3
MB
19400
19401Would you like to build with Misc Attribute Decoration? This is development
19402work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19403overhead on the interpreter.
19404
19405If this doesn't make any sense to you, just accept the default '$dflt'.
19406EOM
fd655d33
NC
19407 rp='Build Perl with MAD?'
19408 . ./myread
19409fi
d620c7b3 19410case "$ans" in
00e74f14
NC
19411y|Y) val="$define"
19412 madlyh='madly.h madly.act madly.tab'
19413 madlysrc='madly.c'
19414 madlyobj="madly$_o" ;;
19415*) val="$undef"
19416 madlyh=''
19417 madlysrc=''
19418 madlyobj='' ;;
d620c7b3
MB
19419esac
19420set mad
19421eval $setvar
19422
b4eb6b3d
JH
19423echo " "
19424echo "Checking if your $make program sets \$(MAKE)..." >&4
19425case "$make_set_make" in
19426'')
19427 $sed 's/^X //' > testmake.mak << 'EOF'
19428Xall:
19429X @echo 'maketemp="$(MAKE)"'
19430EOF
19431 case "`$make -f testmake.mak 2>/dev/null`" in
19432 *maketemp=*) make_set_make='#' ;;
19433 *) make_set_make="MAKE=$make" ;;
19434 esac
19435 $rm -f testmake.mak
19436 ;;
19437esac
19438case "$make_set_make" in
19439'#') echo "Yup, it does.";;
19440*) echo "Nope, it doesn't.";;
19441esac
19442
19443: see what type is used for mode_t
19444rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19445set mode_t modetype int stdio.h sys/types.h
19446eval $typedef_ask
19447
2cc61e15
DD
19448: see if we need va_copy
19449echo " "
19450case "$i_stdarg" in
19451"$define")
19452 $cat >try.c <<EOCP
19453#include <stdarg.h>
19454#include <stdio.h>
85c8a686
DD
19455#$i_stdlib I_STDLIB
19456#ifdef I_STDLIB
19457#include <stdlib.h>
19458#endif
19459#include <signal.h>
2cc61e15
DD
19460
19461int
19462ivfprintf(FILE *f, const char *fmt, va_list *valp)
19463{
19464 return vfprintf(f, fmt, *valp);
19465}
5b813a60
MB
19466
19467int
2cc61e15
DD
19468myvfprintf(FILE *f, const char *fmt, va_list val)
19469{
19470 return ivfprintf(f, fmt, &val);
19471}
5b813a60 19472
2cc61e15 19473int
5b813a60 19474myprintf(char *fmt, ...)
2cc61e15
DD
19475{
19476 va_list val;
19477 va_start(val, fmt);
5b813a60
MB
19478 return myvfprintf(stdout, fmt, val);
19479}
2cc61e15
DD
19480
19481int
19482main(int ac, char **av)
19483{
85c8a686
DD
19484 signal(SIGSEGV, exit);
19485
5b813a60
MB
19486 myprintf("%s%cs all right, then\n", "that", '\'');
19487 exit(0);
2cc61e15
DD
19488}
19489EOCP
19490 set try
5440bc8e
JH
19491 if eval $compile && $run ./try 2>&1 >/dev/null; then
19492 case "`$run ./try`" in
2cc61e15
DD
19493 "that's all right, then")
19494 okay=yes
19495 ;;
19496 esac
19497 fi
19498 case "$okay" in
19499 yes) echo "It seems that you don't need va_copy()." >&4
19500 need_va_copy="$undef"
19501 ;;
19502 *) echo "It seems that va_copy() or similar will be needed." >&4
19503 need_va_copy="$define"
19504 ;;
19505 esac
5b813a60 19506 $rm_try
2cc61e15
DD
19507 ;;
19508*) echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19509 ;;
19510esac
19511
b4eb6b3d
JH
19512: see what type is used for size_t
19513rp="What is the type used for the length parameter for string functions?"
19514set size_t sizetype 'unsigned int' stdio.h sys/types.h
19515eval $typedef_ask
19516
19517: check for type of arguments to gethostbyaddr.
19518if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19519 case "$d_gethbyaddr" in
19520 $define)
19521 $cat <<EOM
19522
19523Checking to see what type of arguments are accepted by gethostbyaddr().
19524EOM
19525 hdrs="$define sys/types.h
19526 $d_socket sys/socket.h
19527 $i_niin netinet/in.h
19528 $i_netdb netdb.h
19529 $i_unistd unistd.h"
19530 : The first arg can 'char *' or 'void *'
19531 : The second arg is some of integral type
19532 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19533 for yyy in size_t long int; do
19534 case "$netdb_host_type" in
19535 '') try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19536 if ./protochk "$try" $hdrs; then
19537 echo "Your system accepts $xxx for the first arg."
19538 echo "...and $yyy for the second arg."
19539 netdb_host_type="$xxx"
19540 netdb_hlen_type="$yyy"
19541 fi
19542 ;;
19543 esac
19544 done
19545 done
19546 : In case none of those worked, prompt the user.
19547 case "$netdb_host_type" in
19548 '') rp='What is the type for the 1st argument to gethostbyaddr?'
19549 dflt='char *'
19550 . ./myread
19551 netdb_host_type=$ans
19552 rp='What is the type for the 2nd argument to gethostbyaddr?'
19553 dflt="$sizetype"
19554 . ./myread
19555 netdb_hlen_type=$ans
19556 ;;
19557 esac
19558 ;;
19559 *) : no gethostbyaddr, so pick harmless defaults
19560 netdb_host_type='char *'
19561 netdb_hlen_type="$sizetype"
19562 ;;
19563 esac
19564 # Remove the "const" if needed. -- but then we'll have a
19565 # prototype clash!
19566 # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19567fi
19568
19569: check for type of argument to gethostbyname.
19570if test "X$netdb_name_type" = X ; then
19571 case "$d_gethbyname" in
19572 $define)
19573 $cat <<EOM
19574
19575Checking to see what type of argument is accepted by gethostbyname().
19576EOM
19577 hdrs="$define sys/types.h
19578 $d_socket sys/socket.h
19579 $i_niin netinet/in.h
19580 $i_netdb netdb.h
19581 $i_unistd unistd.h"
19582 for xxx in "const char *" "char *"; do
19583 case "$netdb_name_type" in
19584 '') try="extern struct hostent *gethostbyname($xxx);"
19585 if ./protochk "$try" $hdrs; then
19586 echo "Your system accepts $xxx."
19587 netdb_name_type="$xxx"
19588 fi
19589 ;;
19590 esac
19591 done
19592 : In case none of those worked, prompt the user.
19593 case "$netdb_name_type" in
19594 '') rp='What is the type for the 1st argument to gethostbyname?'
19595 dflt='char *'
19596 . ./myread
19597 netdb_name_type=$ans
19598 ;;
19599 esac
19600 ;;
19601 *) : no gethostbyname, so pick harmless default
19602 netdb_name_type='char *'
19603 ;;
19604 esac
19605fi
19606
19607: check for type of 1st argument to getnetbyaddr.
19608if test "X$netdb_net_type" = X ; then
19609 case "$d_getnbyaddr" in
19610 $define)
19611 $cat <<EOM
19612
19613Checking to see what type of 1st argument is accepted by getnetbyaddr().
19614EOM
19615 hdrs="$define sys/types.h
19616 $d_socket sys/socket.h
19617 $i_niin netinet/in.h
19618 $i_netdb netdb.h
19619 $i_unistd unistd.h"
19620 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19621 case "$netdb_net_type" in
19622 '') try="extern struct netent *getnetbyaddr($xxx, int);"
19623 if ./protochk "$try" $hdrs; then
19624 echo "Your system accepts $xxx."
19625 netdb_net_type="$xxx"
19626 fi
19627 ;;
19628 esac
19629 done
19630 : In case none of those worked, prompt the user.
19631 case "$netdb_net_type" in
19632 '') rp='What is the type for the 1st argument to getnetbyaddr?'
19633 dflt='long'
19634 . ./myread
19635 netdb_net_type=$ans
19636 ;;
19637 esac
19638 ;;
19639 *) : no getnetbyaddr, so pick harmless default
19640 netdb_net_type='long'
19641 ;;
19642 esac
19643fi
19644: locate the preferred pager for this system
d604bb53 19645fn=f/
b4eb6b3d
JH
19646case "$pager" in
19647'')
19648 dflt=''
19649 case "$pg" in
19650 /*) dflt=$pg;;
19651 [a-zA-Z]:/*) dflt=$pg;;
19652 esac
19653 case "$more" in
19654 /*) dflt=$more;;
19655 [a-zA-Z]:/*) dflt=$more;;
19656 esac
19657 case "$less" in
19658 /*) dflt=$less;;
19659 [a-zA-Z]:/*) dflt=$less;;
19660 esac
19661 case "$dflt" in
19662 '') dflt=/usr/ucb/more;;
19663 esac
19664 ;;
d604bb53
JH
19665*) dflt="$pager"
19666 : Instruct ./getfile to trust the hinted or previous pager value,
19667 : even if it does not begin with a slash. For example, on os2,
19668 : pager might be cmd /c more. See comments in UU/getfile.
19669 fn="f/($pager)"
19670 ;;
b4eb6b3d
JH
19671esac
19672echo " "
b4eb6b3d
JH
19673rp='What pager is used on your system?'
19674. ./getfile
19675pager="$ans"
19676
19677: see what type pids are declared as in the kernel
19678rp="What is the type of process ids on this system?"
19679set pid_t pidtype int stdio.h sys/types.h
19680eval $typedef_ask
19681
b4eb6b3d
JH
19682: see if ar generates random libraries by itself
19683echo " "
19684echo "Checking how to generate random libraries on your machine..." >&4
19685echo 'int bar1() { return bar2(); }' > bar1.c
19686echo 'int bar2() { return 2; }' > bar2.c
55954f19
JH
19687$cat > foo.c <<EOP
19688#$i_stdlib I_STDLIB
19689#ifdef I_STDLIB
19690#include <stdlib.h>
19691#endif
b4eb6b3d
JH
19692int main() { printf("%d\n", bar1()); exit(0); }
19693EOP
19694$cc $ccflags -c bar1.c >/dev/null 2>&1
19695$cc $ccflags -c bar2.c >/dev/null 2>&1
19696$cc $ccflags -c foo.c >/dev/null 2>&1
19697$ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
7a282f6d 19698if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19699 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19700 echo "$ar appears to generate random libraries itself."
19701 orderlib=false
e39a9d84
LC
19702 if [ "X$ranlib" = "X" ]; then
19703 ranlib=":"
19704 fi
88d4d47b
PC
19705elif $ar s bar$_a >/dev/null 2>&1 &&
19706 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19707 $run ./foobar >/dev/null 2>&1; then
19708 echo "a table of contents needs to be added with '$ar s'."
19709 orderlib=false
19710 ranlib="$ar s"
b4eb6b3d 19711elif $ar ts bar$_a >/dev/null 2>&1 &&
7a282f6d 19712 $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
5440bc8e 19713 $run ./foobar >/dev/null 2>&1; then
b4eb6b3d
JH
19714 echo "a table of contents needs to be added with '$ar ts'."
19715 orderlib=false
19716 ranlib="$ar ts"
19717else
19718 case "$ranlib" in
19719 :) ranlib='';;
19720 '')
19721 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19722 $test -f $ranlib || ranlib=''
19723 ;;
19724 esac
19725 if $test -n "$ranlib"; then
19726 echo "your system has '$ranlib'; we'll use that."
19727 orderlib=false
19728 else
19729 echo "your system doesn't seem to support random libraries"
19730 echo "so we'll use lorder and tsort to order the libraries."
19731 orderlib=true
19732 ranlib=":"
19733 fi
19734fi
88d4d47b 19735$rm -f foo* bar*
b4eb6b3d
JH
19736
19737: check for type of arguments to select.
19738case "$selecttype" in
19739'') case "$d_select" in
19740 $define)
19741 echo " "
19742 $cat <<EOM
19743Checking to see what type of arguments are accepted by select().
19744EOM
19745 hdrs="$define sys/types.h
19746 $i_systime sys/time.h
19747 $i_sysselct sys/select.h
19748 $d_socket sys/socket.h"
19749 : The first arg can be int, unsigned, or size_t
19750 : The last arg may or may not be 'const'
19751 val=''
19752 : void pointer has been seen but using that
19753 : breaks the selectminbits test
19754 for xxx in 'fd_set *' 'int *'; do
19755 for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19756 for tmo in 'struct timeval *' 'const struct timeval *'; do
19757 case "$val" in
19758 '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19759 if ./protochk "$try" $hdrs; then
19760 echo "Your system accepts $xxx."
19761 val="$xxx"
19762 fi
19763 ;;
19764 esac
19765 done
19766 done
19767 done
19768 case "$val" in
19769 '') rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19770 case "$d_fd_set" in
19771 $define) dflt="fd_set *" ;;
19772 *) dflt="int *" ;;
19773 esac
19774 . ./myread
19775 val=$ans
19776 ;;
19777 esac
19778 selecttype="$val"
19779 ;;
19780 *) : no select, so pick a harmless default
19781 selecttype='int *'
19782 ;;
19783 esac
19784 ;;
19785esac
19786
19787: check for the select 'width'
19788case "$selectminbits" in
e6e7e605
JH
19789'') safebits=`expr $ptrsize \* 8`
19790 case "$d_select" in
b4eb6b3d
JH
19791 $define)
19792 $cat <<EOM
19793
19794Checking to see on how many bits at a time your select() operates...
19795EOM
19796 $cat >try.c <<EOCP
19797#include <sys/types.h>
19798#$i_time I_TIME
19799#$i_systime I_SYS_TIME
19800#$i_systimek I_SYS_TIME_KERNEL
19801#ifdef I_TIME
19802# include <time.h>
19803#endif
19804#ifdef I_SYS_TIME
19805# ifdef I_SYS_TIME_KERNEL
19806# define KERNEL
19807# endif
19808# include <sys/time.h>
19809# ifdef I_SYS_TIME_KERNEL
19810# undef KERNEL
19811# endif
19812#endif
19813#$i_sysselct I_SYS_SELECT
19814#ifdef I_SYS_SELECT
19815#include <sys/select.h>
19816#endif
19817#$d_socket HAS_SOCKET
19818#ifdef HAS_SOCKET
19819# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19820#endif
19821#include <stdio.h>
d1daaddf
JH
19822#$i_stdlib I_STDLIB
19823#ifdef I_STDLIB
19824#include <stdlib.h>
19825#endif
b4eb6b3d
JH
19826$selecttype b;
19827#define S sizeof(*(b))
19828#define MINBITS 64
19829#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19830#define NBITS (NBYTES * 8)
19831int main() {
7090f861 19832 char *s = (char *)malloc(NBYTES);
b4eb6b3d
JH
19833 struct timeval t;
19834 int i;
19835 FILE* fp;
19836 int fd;
19837
e6e7e605
JH
19838 if (!s)
19839 exit(1);
b4eb6b3d
JH
19840 fclose(stdin);
19841 fp = fopen("try.c", "r");
19842 if (fp == 0)
e6e7e605 19843 exit(2);
b4eb6b3d
JH
19844 fd = fileno(fp);
19845 if (fd < 0)
e6e7e605 19846 exit(3);
b4eb6b3d
JH
19847 b = ($selecttype)s;
19848 for (i = 0; i < NBITS; i++)
19849 FD_SET(i, b);
19850 t.tv_sec = 0;
19851 t.tv_usec = 0;
19852 select(fd + 1, b, 0, 0, &t);
19853 for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
e6e7e605 19854 free(s);
b4eb6b3d
JH
19855 printf("%d\n", i + 1);
19856 return 0;
19857}
19858EOCP
19859 set try
19860 if eval $compile_ok; then
5440bc8e 19861 selectminbits=`$run ./try`
b4eb6b3d
JH
19862 case "$selectminbits" in
19863 '') cat >&4 <<EOM
19864Cannot figure out on how many bits at a time your select() operates.
e6e7e605 19865I'll play safe and guess it is $safebits bits.
b4eb6b3d 19866EOM
e6e7e605
JH
19867 selectminbits=$safebits
19868 bits="$safebits bits"
b4eb6b3d
JH
19869 ;;
19870 1) bits="1 bit" ;;
19871 *) bits="$selectminbits bits" ;;
19872 esac
19873 echo "Your select() operates on $bits at a time." >&4
19874 else
19875 rp='What is the minimum number of bits your select() operates on?'
19876 case "$byteorder" in
e6e7e605
JH
19877 12345678) dflt=64 ;;
19878 1234) dflt=32 ;;
b4eb6b3d
JH
19879 *) dflt=1 ;;
19880 esac
19881 . ./myread
19882 val=$ans
19883 selectminbits="$val"
19884 fi
5b813a60 19885 $rm_try
b4eb6b3d
JH
19886 ;;
19887 *) : no select, so pick a harmless default
e6e7e605 19888 selectminbits=$safebits
b4eb6b3d
JH
19889 ;;
19890 esac
19891 ;;
19892esac
19893
19894: Trace out the files included by signal.h, then look for SIGxxx names.
19895: Remove SIGARRAYSIZE used by HPUX.
19896: Remove SIGSTKSIZE used by Linux.
19897: Remove SIGSTKSZ used by Posix.
19898: Remove SIGTYP void lines used by OS2.
19899: Some cpps, like os390, dont give the file name anywhere
19900if [ "X$fieldn" = X ]; then
19901 : Just make some guesses. We check them later.
19902 xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19903else
19904 xxx=`echo '#include <signal.h>' |
19905 $cppstdin $cppminus $cppflags 2>/dev/null |
19906 $grep '^[ ]*#.*include' |
a938a3bb 19907 $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
b4eb6b3d
JH
19908fi
19909: Check this list of files to be sure we have parsed the cpp output ok.
19910: This will also avoid potentially non-existent files, such
19911: as ../foo/bar.h
19912xxxfiles=''
19913for xx in $xxx /dev/null ; do
19914 $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19915done
19916: If we have found no files, at least try signal.h
19917case "$xxxfiles" in
19918'') xxxfiles=`./findhdr signal.h` ;;
19919esac
19920xxx=`awk '
19921$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19922 print substr($2, 4, 20)
19923}
19924$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19925 print substr($3, 4, 20)
19926}' $xxxfiles`
19927: Append some common names just in case the awk scan failed.
19928xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19929xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19930xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19931xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19932xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19933
19934: generate a few handy files for later
55954f19 19935$cat > signal.c <<EOCP
b4eb6b3d
JH
19936#include <sys/types.h>
19937#include <signal.h>
55954f19
JH
19938#$i_stdlib I_STDLIB
19939#ifdef I_STDLIB
19940#include <stdlib.h>
19941#endif
b4eb6b3d
JH
19942#include <stdio.h>
19943int main() {
19944
19945/* Strange style to avoid deeply-nested #if/#else/#endif */
19946#ifndef NSIG
19947# ifdef _NSIG
19948# define NSIG (_NSIG)
19949# endif
19950#endif
19951
19952#ifndef NSIG
19953# ifdef SIGMAX
19954# define NSIG (SIGMAX+1)
19955# endif
19956#endif
19957
19958#ifndef NSIG
19959# ifdef SIG_MAX
19960# define NSIG (SIG_MAX+1)
19961# endif
19962#endif
19963
19964#ifndef NSIG
3609ea0d
JH
19965# ifdef _SIG_MAX
19966# define NSIG (_SIG_MAX+1)
19967# endif
19968#endif
19969
19970#ifndef NSIG
b4eb6b3d
JH
19971# ifdef MAXSIG
19972# define NSIG (MAXSIG+1)
19973# endif
19974#endif
19975
19976#ifndef NSIG
19977# ifdef MAX_SIG
19978# define NSIG (MAX_SIG+1)
19979# endif
19980#endif
19981
19982#ifndef NSIG
19983# ifdef SIGARRAYSIZE
3609ea0d 19984# define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
b4eb6b3d
JH
19985# endif
19986#endif
19987
19988#ifndef NSIG
19989# ifdef _sys_nsig
19990# define NSIG (_sys_nsig) /* Solaris 2.5 */
19991# endif
19992#endif
19993
19994/* Default to some arbitrary number that's big enough to get most
19995 of the common signals.
19996*/
19997#ifndef NSIG
19998# define NSIG 50
19999#endif
20000
20001printf("NSIG %d\n", NSIG);
20002
20003#ifndef JUST_NSIG
20004
20005EOCP
20006
20007echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20008{
20009 printf "#ifdef SIG"; printf $1; printf "\n"
65197d93 20010 printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
b4eb6b3d
JH
20011 printf $1; printf ");\n"
20012 printf "#endif\n"
20013}
20014END {
20015 printf "#endif /* JUST_NSIG */\n";
20016 printf "exit(0);\n}\n";
20017}
20018' >>signal.c
20019$cat >signal.awk <<'EOP'
20020BEGIN { ndups = 0 }
65197d93 20021$1 ~ /^NSIG$/ { nsig = $2 }
1ebe1ffb 20022($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
65197d93
JH
20023 if ($2 > maxsig) { maxsig = $2 }
20024 if (sig_name[$2]) {
20025 dup_name[ndups] = $1
20026 dup_num[ndups] = $2
b4eb6b3d
JH
20027 ndups++
20028 }
1ebe1ffb 20029 else {
65197d93
JH
20030 sig_name[$2] = $1
20031 sig_num[$2] = $2
b4eb6b3d
JH
20032 }
20033}
20034END {
20035 if (nsig == 0) {
20036 nsig = maxsig + 1
20037 }
20038 printf("NSIG %d\n", nsig);
20039 for (n = 1; n < nsig; n++) {
20040 if (sig_name[n]) {
20041 printf("%s %d\n", sig_name[n], sig_num[n])
20042 }
20043 else {
20044 printf("NUM%d %d\n", n, n)
20045 }
20046 }
20047 for (n = 0; n < ndups; n++) {
20048 printf("%s %d\n", dup_name[n], dup_num[n])
20049 }
20050}
20051EOP
20052$cat >signal_cmd <<EOS
20053$startsh
20054if $test -s signal.lst; then
20055 echo "Using your existing signal.lst file"
20056 exit 0
20057fi
20058xxx="$xxx"
20059EOS
20060$cat >>signal_cmd <<'EOS'
20061
20062set signal
20063if eval $compile_ok; then
1eb9ad5b 20064 $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20065else
20066 echo "(I can't seem be able to compile the whole test program)" >&4
20067 echo "(I'll try it in little pieces.)" >&4
20068 set signal -DJUST_NSIG
20069 if eval $compile_ok; then
5440bc8e 20070 $run ./signal$_exe > signal.nsg
b4eb6b3d
JH
20071 $cat signal.nsg
20072 else
20073 echo "I can't seem to figure out how many signals you have." >&4
20074 echo "Guessing 50." >&4
20075 echo 'NSIG 50' > signal.nsg
20076 fi
20077 : Now look at all the signal names, one at a time.
20078 for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20079 $cat > signal.c <<EOCP
20080#include <sys/types.h>
20081#include <signal.h>
20082#include <stdio.h>
20083int main() {
20084printf("$xx %d\n", SIG${xx});
20085return 0;
20086}
20087EOCP
20088 set signal
20089 if eval $compile; then
20090 echo "SIG${xx} found."
5440bc8e 20091 $run ./signal$_exe >> signal.ls1
b4eb6b3d
JH
20092 else
20093 echo "SIG${xx} NOT found."
20094 fi
20095 done
20096 if $test -s signal.ls1; then
20097 $cat signal.nsg signal.ls1 |
65197d93 20098 $sort -n | $uniq | $awk -f signal.awk >signal.lst
b4eb6b3d
JH
20099 fi
20100
20101fi
20102if $test -s signal.lst; then
20103 :
20104else
20105 echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20106 echo 'kill -l' >signal
20107 set X `csh -f <signal`
20108 $rm -f signal
20109 shift
20110 case $# in
20111 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20112 esac
20113 echo $@ | $tr ' ' $trnl | \
20114 $awk '{ printf "%s %d\n", $1, ++s; }
20115 END { printf "NSIG %d\n", ++s }' >signal.lst
20116fi
20117$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20118EOS
20119chmod a+x signal_cmd
20120$eunicefix signal_cmd
20121
20122: generate list of signal names
20123echo " "
20124case "$sig_name_init" in
20125'') doinit=yes ;;
20126*) case "$sig_num_init" in
20127 ''|*,*) doinit=yes ;;
20128 esac ;;
20129esac
20130case "$doinit" in
20131yes)
20132 echo "Generating a list of signal names and numbers..." >&4
20133 . ./signal_cmd
20134 sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20135 sig_name=`$awk 'BEGIN { printf "ZERO " }
20136 !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20137 sig_num=`$awk 'BEGIN { printf "0 " }
20138 !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20139 sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
20140 !/^NSIG/ { printf "\"%s\", ", $1 }
20141 END { printf "0\n" }' signal.lst`
20142 sig_num_init=`$awk 'BEGIN { printf "0, " }
20143 !/^NSIG/ { printf "%d, ", $2}
20144 END { printf "0\n"}' signal.lst`
20145 ;;
20146esac
20147echo "The following $sig_count signals are available:"
20148echo " "
20149echo $sig_name | $awk \
20150'BEGIN { linelen = 0 }
20151{
20152 for (i = 1; i <= NF; i++) {
20153 name = "SIG" $i " "
20154 linelen = linelen + length(name)
20155 if (linelen > 70) {
20156 printf "\n"
20157 linelen = length(name)
20158 }
20159 printf "%s", name
20160 }
20161 printf "\n"
20162}'
76d3c696 20163sig_size=`echo $sig_name | awk '{print NF}'`
b4eb6b3d
JH
20164$rm -f signal signal.c signal.awk signal.lst signal_cmd
20165
20166echo " "
20167case "$sizetype" in
20168*_t) zzz="$sizetype" ;;
20169*) zzz="filesize" ;;
20170esac
20171echo "Checking the size of $zzz..." >&4
20172cat > try.c <<EOCP
20173#include <sys/types.h>
20174#include <stdio.h>
d1daaddf
JH
20175#$i_stdlib I_STDLIB
20176#ifdef I_STDLIB
20177#include <stdlib.h>
20178#endif
b4eb6b3d
JH
20179int main() {
20180 printf("%d\n", (int)sizeof($sizetype));
20181 exit(0);
20182}
20183EOCP
20184set try
20185if eval $compile_ok; then
5440bc8e 20186 yyy=`$run ./try`
b4eb6b3d
JH
20187 case "$yyy" in
20188 '') sizesize=4
20189 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20190 ;;
20191 *) sizesize=$yyy
20192 echo "Your $zzz size is $sizesize bytes."
20193 ;;
20194 esac
20195else
20196 sizesize=4
20197 echo "(I can't compile the test program--guessing $sizesize.)" >&4
20198fi
20199
20200
20201: check for socklen_t
20202echo " "
20203echo "Checking to see if you have socklen_t..." >&4
20204$cat >try.c <<EOCP
20205#include <sys/types.h>
20206#$d_socket HAS_SOCKET
20207#ifdef HAS_SOCKET
20208#include <sys/socket.h>
20209#endif
20210int main() { socklen_t x = 16; }
20211EOCP
20212set try
20213if eval $compile; then
20214 val="$define"
20215 echo "You have socklen_t."
20216else
20217 val="$undef"
20218 echo "You do not have socklen_t."
20219 case "$sizetype" in
20220 size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20221 esac
20222fi
5b813a60 20223$rm_try
b4eb6b3d
JH
20224set d_socklen_t
20225eval $setvar
20226
a7710f8d
JH
20227: see if this is a socks.h system
20228set socks.h i_socks
20229eval $inhdr
20230
b4eb6b3d
JH
20231: check for type of the size argument to socket calls
20232case "$d_socket" in
20233"$define")
20234 $cat <<EOM
20235
20236Checking to see what type is the last argument of accept().
20237EOM
b4eb6b3d
JH
20238 yyy=''
20239 case "$d_socklen_t" in
20240 "$define") yyy="$yyy socklen_t"
20241 esac
20242 yyy="$yyy $sizetype int long unsigned"
20243 for xxx in $yyy; do
20244 case "$socksizetype" in
20245 '') try="extern int accept(int, struct sockaddr *, $xxx *);"
a7710f8d
JH
20246 case "$usesocks" in
20247 "$define")
20248 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20249 echo "Your system accepts '$xxx *' for the last argument of accept()."
20250 socksizetype="$xxx"
20251 fi
20252 ;;
20253 *) if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h; then
20254 echo "Your system accepts '$xxx *' for the last argument of accept()."
20255 socksizetype="$xxx"
20256 fi
20257 ;;
20258 esac
b4eb6b3d
JH
20259 ;;
20260 esac
20261 done
20262: In case none of those worked, prompt the user.
20263 case "$socksizetype" in
20264 '') rp='What is the type for socket address structure sizes?'
20265 dflt='int'
20266 . ./myread
20267 socksizetype=$ans
20268 ;;
20269 esac
20270 ;;
20271*) : no sockets, so pick relatively harmless default
20272 socksizetype='int'
20273 ;;
20274esac
20275
20276: see what type is used for signed size_t
20277set ssize_t ssizetype int stdio.h sys/types.h
20278eval $typedef
20279dflt="$ssizetype"
5440bc8e 20280$cat > try.c <<EOM
b4eb6b3d 20281#include <stdio.h>
d1daaddf
JH
20282#$i_stdlib I_STDLIB
20283#ifdef I_STDLIB
20284#include <stdlib.h>
20285#endif
b4eb6b3d
JH
20286#include <sys/types.h>
20287#define Size_t $sizetype
20288#define SSize_t $dflt
20289int main()
20290{
20291 if (sizeof(Size_t) == sizeof(SSize_t))
20292 printf("$dflt\n");
20293 else if (sizeof(Size_t) == sizeof(int))
20294 printf("int\n");
5b813a60 20295 else
b4eb6b3d
JH
20296 printf("long\n");
20297 exit(0);
20298}
20299EOM
20300echo " "
5440bc8e
JH
20301set try
20302if eval $compile_ok && $run ./try > /dev/null; then
20303 ssizetype=`$run ./try`
b4eb6b3d
JH
20304 echo "I'll be using $ssizetype for functions returning a byte count." >&4
20305else
20306 $cat >&4 <<EOM
20307Help! I can't compile and run the ssize_t test program: please enlighten me!
20308(This is probably a misconfiguration in your system or libraries, and
20309you really ought to fix it. Still, I'll try anyway.)
20310
20311I need a type that is the same size as $sizetype, but is guaranteed to
20312be signed. Common values are ssize_t, int and long.
20313
20314EOM
20315 rp="What signed type is the same size as $sizetype?"
20316 . ./myread
20317 ssizetype="$ans"
20318fi
5b813a60 20319$rm_try
b4eb6b3d
JH
20320
20321: see what type of char stdio uses.
20322echo " "
359842a5
JH
20323echo '#include <stdio.h>' > stdio.c
20324$cppstdin $cppminus < stdio.c > stdioh
aa517f50 20325if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
b4eb6b3d
JH
20326 echo "Your stdio uses unsigned chars." >&4
20327 stdchar="unsigned char"
20328else
aa517f50
JH
20329 echo "Your stdio uses signed chars." >&4
20330 stdchar="char"
b4eb6b3d 20331fi
359842a5 20332$rm -f stdio.* stdioh
b4eb6b3d 20333
b4eb6b3d
JH
20334: see what type uids are declared as in the kernel
20335echo " "
20336echo "Looking for the type for user ids returned by getuid()."
20337set uid_t uidtype xxx stdio.h sys/types.h
20338eval $typedef
20339case "$uidtype" in
20340xxx)
20341 xxx=`./findhdr sys/user.h`
20342 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20343 case $1 in
20344 unsigned) dflt="$1 $2" ;;
20345 *) dflt="$1" ;;
20346 esac
20347 ;;
20348*) dflt="$uidtype";;
20349esac
20350case "$uidtype" in
20351uid_t) echo "uid_t found." ;;
20352*) rp="What is the type for user ids returned by getuid()?"
20353 . ./myread
20354 uidtype="$ans"
20355 ;;
20356esac
20357
20358echo " "
20359case "$uidtype" in
20360*_t) zzz="$uidtype" ;;
20361*) zzz="uid" ;;
20362esac
20363echo "Checking the size of $zzz..." >&4
20364cat > try.c <<EOCP
20365#include <sys/types.h>
20366#include <stdio.h>
d1daaddf
JH
20367#$i_stdlib I_STDLIB
20368#ifdef I_STDLIB
20369#include <stdlib.h>
20370#endif
b4eb6b3d
JH
20371int main() {
20372 printf("%d\n", (int)sizeof($uidtype));
20373 exit(0);
20374}
20375EOCP
20376set try
20377if eval $compile_ok; then
5440bc8e 20378 yyy=`$run ./try`
b4eb6b3d
JH
20379 case "$yyy" in
20380 '') uidsize=4
20381 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20382 ;;
20383 *) uidsize=$yyy
20384 echo "Your $zzz is $uidsize bytes long."
20385 ;;
20386 esac
20387else
20388 uidsize=4
20389 echo "(I can't compile the test program--guessing $uidsize.)" >&4
20390fi
20391
20392echo " "
20393case "$uidtype" in
20394*_t) zzz="$uidtype" ;;
20395*) zzz="uid" ;;
20396esac
20397echo "Checking the sign of $zzz..." >&4
20398cat > try.c <<EOCP
20399#include <sys/types.h>
20400#include <stdio.h>
20401int main() {
20402 $uidtype foo = -1;
20403 if (foo < 0)
20404 printf("-1\n");
20405 else
20406 printf("1\n");
20407}
20408EOCP
20409set try
20410if eval $compile; then
5440bc8e 20411 yyy=`$run ./try`
b4eb6b3d
JH
20412 case "$yyy" in
20413 '') uidsign=1
20414 echo "(I can't execute the test program--guessing unsigned.)" >&4
20415 ;;
20416 *) uidsign=$yyy
20417 case "$uidsign" in
20418 1) echo "Your $zzz is unsigned." ;;
20419 -1) echo "Your $zzz is signed." ;;
20420 esac
20421 ;;
20422 esac
20423else
20424 uidsign=1
20425 echo "(I can't compile the test program--guessing unsigned.)" >&4
20426fi
20427
20428
20429
20430echo " "
20431$echo "Checking the format string to be used for uids..." >&4
20432
20433case "$uidsign" in
20434-1) if $test X"$uidsize" = X"$ivsize"; then
20435 uidformat="$ivdformat"
20436 else
20437 if $test X"$uidsize" = X"$longsize"; then
20438 uidformat='"ld"'
20439 else
20440 if $test X"$uidsize" = X"$intsize"; then
20441 uidformat='"d"'
20442 else
20443 if $test X"$uidsize" = X"$shortsize"; then
20444 uidformat='"hd"'
20445 fi
20446 fi
20447 fi
20448 fi
20449 ;;
20450*) if $test X"$uidsize" = X"$uvsize"; then
20451 uidformat="$uvuformat"
20452 else
20453 if $test X"$uidsize" = X"$longsize"; then
20454 uidformat='"lu"'
20455 else
20456 if $test X"$uidsize" = X"$intsize"; then
20457 uidformat='"u"'
20458 else
20459 if $test X"$uidsize" = X"$shortsize"; then
20460 uidformat='"hu"'
20461 fi
20462 fi
20463 fi
20464 fi
20465 ;;
20466esac
20467
4afd418c
MB
20468
20469case "$usesitecustomize" in
20470 $define|true|[Yy]*)
20471 usesitecustomize="$define"
20472 ;;
20473 *)
20474 usesitecustomize="$undef"
20475 ;;
20476 esac
20477
3659ebf1
JH
20478: determine compiler compiler
20479case "$yacc" in
20480'')
20481 dflt=yacc;;
20482*)
20483 dflt="$yacc";;
20484esac
20485echo " "
20486comp='yacc'
3c728e00 20487if $test -f "$byacc$_exe"; then
3659ebf1
JH
20488 dflt="$byacc"
20489 comp="byacc or $comp"
20490fi
3c728e00 20491if $test -f "$bison$_exe"; then
3659ebf1
JH
20492 comp="$comp or bison -y"
20493fi
20494rp="Which compiler compiler ($comp) shall I use?"
20495. ./myread
20496yacc="$ans"
20497case "$yacc" in
20498*bis*)
20499 case "$yacc" in
20500 *-y*) ;;
20501 *)
20502 yacc="$yacc -y"
20503 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20504 ;;
20505 esac
20506 ;;
20507esac
20508
758a5d79
JH
20509: see if this is a fp.h system
20510set fp.h i_fp
20511eval $inhdr
20512
20513: see if this is a fp_class.h system
20514set fp_class.h i_fp_class
20515eval $inhdr
20516
13cfc98d
MB
20517: see if gdbm.h is available
20518set gdbm.h t_gdbm
20519eval $inhdr
20520case "$t_gdbm" in
20521$define)
20522 : see if gdbm_open exists
20523 set gdbm_open d_gdbm_open
20524 eval $inlibc
20525 case "$d_gdbm_open" in
20526 $undef)
20527 t_gdbm="$undef"
20528 echo "We won't be including <gdbm.h>"
20529 ;;
20530 esac
20531 ;;
20532esac
20533val="$t_gdbm"
20534set i_gdbm
20535eval $setvar
20536
b4eb6b3d 20537: see if this is a ieeefp.h system
b5b9f165
JH
20538case "$i_ieeefp" in
20539'' ) set ieeefp.h i_ieeefp
20540 eval $inhdr
20541 ;;
20542esac
b4eb6b3d
JH
20543
20544: see if this is a libutil.h system
20545set libutil.h i_libutil
20546eval $inhdr
20547
b4eb6b3d
JH
20548: see if mach cthreads are available
20549if test "X$usethreads" = "X$define"; then
20550 set mach/cthreads.h i_machcthr
20551 eval $inhdr
20552else
20553 i_machcthr="$undef"
20554fi
20555
20556
20557
b4eb6b3d
JH
20558: see if this is a mntent.h system
20559set mntent.h i_mntent
20560eval $inhdr
20561
20562: see if ndbm.h is available
20563set ndbm.h t_ndbm
20564eval $inhdr
1c6861ad
JS
20565
20566case "$t_ndbm" in
20567$undef)
20568 # Some Linux distributions such as RedHat 7.1 put the
20569 # ndbm.h header in /usr/include/gdbm/ndbm.h.
20570 if $test -f /usr/include/gdbm/ndbm.h; then
d11b91bf 20571 echo '<gdbm/ndbm.h> found.'
1c6861ad
JS
20572 ccflags="$ccflags -I/usr/include/gdbm"
20573 cppflags="$cppflags -I/usr/include/gdbm"
20574 t_ndbm=$define
20575 fi
20576 ;;
20577esac
20578
b4eb6b3d
JH
20579case "$t_ndbm" in
20580$define)
20581 : see if dbm_open exists
20582 set dbm_open d_dbm_open
20583 eval $inlibc
20584 case "$d_dbm_open" in
20585 $undef)
20586 t_ndbm="$undef"
20587 echo "We won't be including <ndbm.h>"
20588 ;;
20589 esac
20590 ;;
20591esac
20592val="$t_ndbm"
20593set i_ndbm
20594eval $setvar
20595
20596: see if net/errno.h is available
20597val=''
20598set net/errno.h val
20599eval $inhdr
20600
20601: Unfortunately, it causes problems on some systems. Arrgh.
20602case "$val" in
20603$define)
20604 cat > try.c <<'EOM'
20605#include <stdio.h>
20606#include <errno.h>
20607#include <net/errno.h>
20608int func()
20609{
20610 return ENOTSOCK;
20611}
20612EOM
20613 if $cc $ccflags -c try.c >/dev/null 2>&1; then
20614 echo "We'll be including <net/errno.h>." >&4
20615 else
20616 echo "We won't be including <net/errno.h>." >&4
20617 val="$undef"
20618 fi
5b813a60 20619 $rm_try
b4eb6b3d
JH
20620 ;;
20621esac
20622set i_neterrno
20623eval $setvar
20624
20625: see if netinet/tcp.h is available
20626set netinet/tcp.h i_netinettcp
20627eval $inhdr
20628
20629: see if this is a poll.h system
20630set poll.h i_poll
20631eval $inhdr
20632
20633: see if this is a prot.h system
20634set prot.h i_prot
20635eval $inhdr
20636
20637echo " "
ddfca5da 20638$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
b4eb6b3d
JH
20639$cat <<'EOSH' > Cppsym.know
20640a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20641AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
44c87379 20642alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
d46c9a2d
JH
20643ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20644BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
b4eb6b3d
JH
20645BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20646bull c cadmus clipper CMU COFF COMPILER_VERSION
20647concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
8b7d8421 20648CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
4f17444b
JH
20649Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20650FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20651GLIBC GLIBC_MINOR
20652GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
b4eb6b3d
JH
20653H3050R H3050RX hbullx20 hcx host_mips
20654hp200 hp300 hp700 HP700 hp800 hp9000
20655hp9000s200 hp9000s300 hp9000s400 hp9000s500
20656hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20657i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
d46c9a2d 20658IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
b4eb6b3d
JH
20659INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20660LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20661LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
9c12f1e5 20662LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
b4eb6b3d
JH
20663LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20664M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20665M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20666M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20667MATH_HAS_NO_SIDE_EFFECTS
20668mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20669mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20670mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20671MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20672mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20673NetBSD news1500 news1700 news1800 news1900 news3700
48bcfe03 20674news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
b4eb6b3d
JH
20675ns32016 ns32332 ns32k nsc32000
20676OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20677pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20678pc532 pdp11 PGC PIC plexus PORTAR posix
20679POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20680POSIX_C_SOURCE POSIX_SOURCE POWER
9c12f1e5 20681PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
d46c9a2d 20682riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
b4eb6b3d
JH
20683SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20684sony sony_news sonyrisc sparc sparclite spectrum
20685stardent stdc STDC_EXT stratos sun sun3 sun386
20686Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20687SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20688SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20689sysV68 sysV88 Tek4132 Tek4300 titan
d46c9a2d 20690TM3200 TM5400 TM5600
b4eb6b3d
JH
20691tower tower32 tower32_200 tower32_600 tower32_700
20692tower32_800 tower32_850 tss
20693u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20694ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
4f17444b
JH
20695unix UNIX95 UNIX99 unixpc unos
20696USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20697USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20698USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20699USGr4 USGr4_2
44c87379 20700Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
b4eb6b3d
JH
20701XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20702XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20703z8000
20704EOSH
20705# Maybe put other stuff here too.
20706cat <<EOSH >>Cppsym.know
20707$osname
20708EOSH
20709./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20710./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20711$cat Cppsym.know > Cppsym.c
381aa1ff 20712$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
b4eb6b3d
JH
20713$rm -f Cppsym.a Cppsym.b Cppsym.c
20714cat <<EOSH > Cppsym
20715$startsh
20716if $test \$# -gt 0; then
20717 echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20718 if $test -s Cppsym.got; then
20719 $rm -f Cppsym.got
20720 exit 0
20721 fi
20722 $rm -f Cppsym.got
20723 exit 1
20724else
20725 $tr " " "$trnl" | ./Cppsym.try
20726 exit 0
20727fi
20728EOSH
20729chmod +x Cppsym
20730$eunicefix Cppsym
20731cat <<EOSH > Cppsym.try
20732$startsh
20733cat <<'EOCP' > try.c
20734#include <stdio.h>
360321b3
YST
20735#if cpp_stuff == 1
20736#define STRINGIFY(a) "a"
20737#endif
20738#if cpp_stuff == 42
20739#define StGiFy(a) #a
20740#define STRINGIFY(a) StGiFy(a)
20741#endif
20742#if $cpp_stuff != 1 && $cpp_stuff != 42
20743# include "Bletch: How does this C preprocessor stringify macros?"
20744#endif
b4eb6b3d
JH
20745int main() {
20746EOCP
20747$awk \\
20748EOSH
20749cat <<'EOSH' >> Cppsym.try
20750'length($1) > 0 {
360321b3
YST
20751 printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20752 printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20753 printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20754 printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
b4eb6b3d 20755}' >> try.c
2ef53570 20756echo 'return 0;}' >> try.c
b4eb6b3d
JH
20757EOSH
20758cat <<EOSH >> Cppsym.try
20759ccflags="$ccflags"
20760case "$osname-$gccversion" in
20761irix-) ccflags="\$ccflags -woff 1178" ;;
20762os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20763esac
360321b3 20764$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
b4eb6b3d
JH
20765EOSH
20766chmod +x Cppsym.try
20767$eunicefix Cppsym.try
20768./Cppsym < Cppsym.know > Cppsym.true
ddfca5da 20769: Add in any linux cpp "predefined macros":
b6a7163e
MB
20770case "$osname::$gccversion" in
20771 *linux*::*.*)
20772 tHdrH=_tmpHdr
20773 rm -f $tHdrH'.h' $tHdrH
20774 touch $tHdrH'.h'
20775 if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20776 sed 's/#define[\ \ ]*//;s/[\ \ ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20777 if [ -s $tHdrH'_cppsym.real' ]; then
20778 cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20779 fi
20780 fi
20781 rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20782 ;;
20783esac
b4eb6b3d
JH
20784: now check the C compiler for additional symbols
20785postprocess_cc_v=''
20786case "$osname" in
20787aix) postprocess_cc_v="|$tr , ' '" ;;
20788esac
20789$cat >ccsym <<EOS
20790$startsh
20791$cat >tmp.c <<EOF
20792extern int foo;
20793EOF
20794for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20795do
20796 case "\$i" in
20797 -D*) echo "\$i" | $sed 's/^-D//';;
b2a76591 20798 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
b4eb6b3d
JH
20799 esac
20800done
5b813a60 20801$rm_try
b4eb6b3d
JH
20802EOS
20803postprocess_cc_v=''
20804chmod +x ccsym
20805$eunicefix ccsym
20806./ccsym > ccsym1.raw
20807if $test -s ccsym1.raw; then
20808 $sort ccsym1.raw | $uniq >ccsym.raw
20809else
20810 mv ccsym1.raw ccsym.raw
20811fi
20812
20813$awk '/\=/ { print $0; next }
20814 { print $0"=1" }' ccsym.raw >ccsym.list
360321b3
YST
20815$comm -13 Cppsym.true ccsym.list >ccsym.own
20816$comm -12 Cppsym.true ccsym.list >ccsym.com
20817$comm -23 Cppsym.true ccsym.list >ccsym.cpp
b4eb6b3d
JH
20818also=''
20819if $test -z ccsym.raw; then
20820 echo "Your C compiler doesn't seem to define any symbols!" >&4
20821 echo " "
20822 echo "However, your C preprocessor defines the following symbols:"
20823 $cat Cppsym.true
20824 ccsymbols=''
20825 cppsymbols=`$cat Cppsym.true`
20826 cppsymbols=`echo $cppsymbols`
20827 cppccsymbols="$cppsymbols"
20828else
20829 if $test -s ccsym.com; then
20830 echo "Your C compiler and pre-processor define these symbols:"
20831 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20832 also='also '
20833 symbols='ones'
20834 cppccsymbols=`$cat ccsym.com`
20835 cppccsymbols=`echo $cppccsymbols`
20836 $test "$silent" || sleep 1
20837 fi
20838 if $test -s ccsym.cpp; then
20839 $test "$also" && echo " "
20840 echo "Your C pre-processor ${also}defines the following symbols:"
20841 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20842 also='further '
20843 cppsymbols=`$cat ccsym.cpp`
20844 cppsymbols=`echo $cppsymbols`
20845 $test "$silent" || sleep 1
20846 fi
20847 if $test -s ccsym.own; then
20848 $test "$also" && echo " "
20849 echo "Your C compiler ${also}defines the following cpp symbols:"
20850 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20851 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20852 ccsymbols=`$cat ccsym.own`
20853 ccsymbols=`echo $ccsymbols`
20854 $test "$silent" || sleep 1
20855 fi
20856fi
b4eb6b3d
JH
20857
20858: see if this is a termio system
20859val="$undef"
20860val2="$undef"
20861val3="$undef"
20862if $test `./findhdr termios.h`; then
20863 set tcsetattr i_termios
20864 eval $inlibc
20865 val3="$i_termios"
20866fi
20867echo " "
20868case "$val3" in
20869"$define") echo "You have POSIX termios.h... good!" >&4;;
20870*) if ./Cppsym pyr; then
20871 case "`/bin/universe`" in
20872 ucb) if $test `./findhdr sgtty.h`; then
20873 val2="$define"
20874 echo "<sgtty.h> found." >&4
20875 else
20876 echo "System is pyramid with BSD universe."
20877 echo "<sgtty.h> not found--you could have problems." >&4
20878 fi;;
20879 *) if $test `./findhdr termio.h`; then
20880 val="$define"
20881 echo "<termio.h> found." >&4
20882 else
20883 echo "System is pyramid with USG universe."
20884 echo "<termio.h> not found--you could have problems." >&4
20885 fi;;
20886 esac
20887 elif ./usg; then
20888 if $test `./findhdr termio.h`; then
20889 echo "<termio.h> found." >&4
20890 val="$define"
20891 elif $test `./findhdr sgtty.h`; then
20892 echo "<sgtty.h> found." >&4
20893 val2="$define"
20894 else
20895echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20896 fi
20897 else
20898 if $test `./findhdr sgtty.h`; then
20899 echo "<sgtty.h> found." >&4
20900 val2="$define"
20901 elif $test `./findhdr termio.h`; then
20902 echo "<termio.h> found." >&4
20903 val="$define"
20904 else
20905echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20906 fi
20907 fi;;
20908esac
20909set i_termio; eval $setvar
20910val=$val2; set i_sgtty; eval $setvar
20911val=$val3; set i_termios; eval $setvar
20912
b4eb6b3d
JH
20913: see if stddef is available
20914set stddef.h i_stddef
20915eval $inhdr
923fc586 20916
b4eb6b3d
JH
20917: see if sys/access.h is available
20918set sys/access.h i_sysaccess
20919eval $inhdr
20920
20921: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20922set sys/filio.h i_sysfilio
20923eval $inhdr
20924echo " "
20925if $test `./findhdr sys/ioctl.h`; then
20926 val="$define"
20927 echo '<sys/ioctl.h> found.' >&4
20928else
20929 val="$undef"
20930 if $test $i_sysfilio = "$define"; then
20931 echo '<sys/ioctl.h> NOT found.' >&4
5f80c64f 20932 else
b4eb6b3d
JH
20933 $test $i_sgtty = "$define" && xxx="sgtty.h"
20934 $test $i_termio = "$define" && xxx="termio.h"
20935 $test $i_termios = "$define" && xxx="termios.h"
20936echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20937 fi
20938fi
20939set i_sysioctl
20940eval $setvar
20941
49a78c82
JH
20942: see if socket ioctl defs are in sys/sockio.h
20943echo " "
20944xxx=`./findhdr sys/sockio.h`
20945if $test "$xxx"; then
20946 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20947 val="$define"
20948 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20949 else
20950 val="$undef"
20951 echo "No socket ioctls found in <sys/sockio.h>." >&4
20952 fi
20953else
20954 val="$undef"
20955 $cat <<EOM
20956<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20957EOM
20958fi
20959set i_syssockio
20960eval $setvar
20961
b4eb6b3d
JH
20962
20963: see if this is a syslog.h system
20964set syslog.h i_syslog
20965eval $inhdr
20966
20967
20968: see if this is a sys/mode.h system
20969set sys/mode.h i_sysmode
20970eval $inhdr
20971
20972: see if sys/resource.h has to be included
20973set sys/resource.h i_sysresrc
20974eval $inhdr
20975
20976: see if sys/security.h is available
20977set sys/security.h i_syssecrt
20978eval $inhdr
20979
20980: see if this is a sys/statvfs.h system
20981set sys/statvfs.h i_sysstatvfs
20982eval $inhdr
20983
b4eb6b3d
JH
20984: see if this is a sys/un.h system
20985set sys/un.h i_sysun
20986eval $inhdr
20987
20988
20989: see if this is a sys/utsname.h system
20990set sys/utsname.h i_sysutsname
20991eval $inhdr
20992
20993: see if this is a syswait system
20994set sys/wait.h i_syswait
20995eval $inhdr
20996
20997: see if this is a ustat.h system
20998set ustat.h i_ustat
20999eval $inhdr
21000
21001: see if this is an utime system
21002set utime.h i_utime
21003eval $inhdr
21004
21005: see if this is a values.h system
21006set values.h i_values
21007eval $inhdr
21008
21009: see if this is a vfork system
21010case "$d_vfork" in
21011"$define")
21012 set vfork.h i_vfork
21013 eval $inhdr
21014 ;;
21015*)
21016 i_vfork="$undef"
21017 ;;
21018esac
21019
b4eb6b3d
JH
21020echo " "
21021echo "Looking for extensions..." >&4
21022: If we are using the old config.sh, known_extensions may contain
21023: old or inaccurate or duplicate values.
21024known_extensions=''
21025nonxs_extensions=''
21026: We do not use find because it might not be available.
21027: We do not just use MANIFEST because the user may have dropped
21028: some additional extensions into the source tree and expect them
21029: to be built.
21030
21031: Function to recursively find available extensions, ignoring DynaLoader
21032: NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21033find_extensions='
21034 for xxx in *; do
822a6ee0
MB
21035 case "$xxx" in
21036 DynaLoader|dynaload) ;;
21037 *)
78ff2d7b 21038 if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
822a6ee0
MB
21039 known_extensions="$known_extensions $1$xxx";
21040 elif $test -f $xxx/Makefile.PL; then
21041 nonxs_extensions="$nonxs_extensions $1$xxx";
21042 else
21043 if $test -d $xxx -a $# -lt 10; then
21044 set $1$xxx/ $*;
21045 cd "$xxx";
21046 eval $find_extensions;
21047 cd ..;
21048 shift;
21049 fi;
21050 fi
21051 ;;
21052 esac;
b4eb6b3d
JH
21053 done'
21054tdir=`pwd`
6904989c 21055cd "$rsrc/ext"
b4eb6b3d
JH
21056set X
21057shift
21058eval $find_extensions
4e1a6d26
AD
21059# Special case: Add in threads/shared since it is not picked up by the
21060# recursive find above (and adding in general recursive finding breaks
21061# SDBM_File/sdbm). A.D. 10/25/2001.
998b396c 21062known_extensions="$known_extensions threads/shared"
faae14e6
MB
21063set X $known_extensions
21064shift
21065known_extensions="$*"
b4eb6b3d
JH
21066set X $nonxs_extensions
21067shift
21068nonxs_extensions="$*"
6904989c 21069cd "$tdir"
b4eb6b3d
JH
21070
21071: Now see which are supported on this system.
21072avail_ext=''
21073for xxx in $known_extensions ; do
21074 case "$xxx" in
21075 DB_File|db_file)
21076 case "$i_db" in
21077 $define) avail_ext="$avail_ext $xxx" ;;
21078 esac
21079 ;;
21080 GDBM_File|gdbm_fil)
7c345082 21081 case "$i_gdbm" in
b4eb6b3d
JH
21082 $define) avail_ext="$avail_ext $xxx" ;;
21083 esac
21084 ;;
1d59c593 21085 I18N/Langinfo|i18n_lan)
7c345082 21086 case "$i_langinfo$d_nl_langinfo" in
4bbcc6e8
JH
21087 $define$define) avail_ext="$avail_ext $xxx" ;;
21088 esac
21089 ;;
7978b0db
JH
21090 IPC/SysV|ipc/sysv)
21091 : XXX Do we need a useipcsysv variable here
21092 case "${d_msg}${d_sem}${d_shm}" in
21093 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21094 esac
21095 ;;
b4eb6b3d
JH
21096 NDBM_File|ndbm_fil)
21097 case "$i_ndbm" in
21098 $define)
21099 case "$osname-$use64bitint" in
0be9fa5d 21100 hpux-define)
b4eb6b3d
JH
21101 case "$libs" in
21102 *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21103 esac
21104 ;;
21105 *) avail_ext="$avail_ext $xxx" ;;
21106 esac
21107 ;;
21108 esac
21109 ;;
7c345082 21110 ODBM_File|odbm_fil)
b4eb6b3d
JH
21111 case "${i_dbm}${i_rpcsvcdbm}" in
21112 *"${define}"*)
7978b0db
JH
21113 case "$d_cplusplus" in
21114 define) ;; # delete as a function name will not work
21115 *) case "$osname-$use64bitint" in
21116 hpux-define)
21117 case "$libs" in
21118 *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21119 esac
21120 ;;
21121 *) avail_ext="$avail_ext $xxx" ;;
b4eb6b3d
JH
21122 esac
21123 ;;
b4eb6b3d
JH
21124 esac
21125 ;;
21126 esac
21127 ;;
7978b0db
JH
21128 Opcode|opcode)
21129 case "$useopcode" in
b4eb6b3d
JH
21130 true|define|y) avail_ext="$avail_ext $xxx" ;;
21131 esac
21132 ;;
7978b0db
JH
21133 POSIX|posix)
21134 case "$useposix" in
b4eb6b3d
JH
21135 true|define|y) avail_ext="$avail_ext $xxx" ;;
21136 esac
21137 ;;
21138 Socket|socket)
7c345082 21139 case "$d_socket" in
4a9f028c
JH
21140 true|$define|y)
21141 case "$osname" in
21142 beos) ;; # not unless BONE
21143 *) avail_ext="$avail_ext $xxx" ;;
21144 esac
21145 ;;
b4eb6b3d
JH
21146 esac
21147 ;;
21148 Sys/Syslog|sys/syslog)
21149 : XXX syslog requires socket
7c345082 21150 case "$d_socket" in
b4eb6b3d
JH
21151 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21152 esac
21153 ;;
21154 Thread|thread)
b00ec89b
AB
21155 case "$usethreads" in
21156 true|$define|y)
47f9f84c 21157 case "$use5005threads" in
3f30fabf 21158 $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
b00ec89b 21159 esac
b4eb6b3d
JH
21160 esac
21161 ;;
7978b0db
JH
21162 threads|threads/shared)
21163 # threads and threads::shared are special cases.
21164 # To stop people from asking "Perl 5.8.0 was supposed
21165 # to have this new fancy threads implementation but my
21166 # perl doesn't have it" and from people trying to
21167 # (re)install the threads module using CPAN.pm and
21168 # CPAN.pm then offering to reinstall Perl 5.8.0,
21169 # the threads.pm and threads/shared.pm will always be
21170 # there, croaking informatively ("you need to rebuild
21171 # all of Perl with threads, sorry") when threads haven't
21172 # been compiled in.
21173 # --jhi
21174 avail_ext="$avail_ext $xxx"
21175 ;;
78ff2d7b 21176 Win32*)
b149d92d
JD
21177 case "$osname" in
21178 cygwin) avail_ext="$avail_ext $xxx" ;;
21179 esac
21180 ;;
f9b6ed1c
AD
21181 XS/APItest|xs/apitest)
21182 # This is just for testing. Skip it unless we have dynamic loading.
21183
21184 case "$usedl" in
21185 $define) avail_ext="$avail_ext $xxx" ;;
21186 esac
21187 ;;
21188 XS/Typemap|xs/typemap)
21189 # This is just for testing. Skip it unless we have dynamic loading.
21190 case "$usedl" in
21191 $define) avail_ext="$avail_ext $xxx" ;;
21192 esac
21193 ;;
b4eb6b3d 21194 *) avail_ext="$avail_ext $xxx"
5f80c64f
JH
21195 ;;
21196 esac
b4eb6b3d 21197done
5f80c64f 21198
b4eb6b3d
JH
21199set X $avail_ext
21200shift
21201avail_ext="$*"
5f80c64f 21202
ef0c5be8
JH
21203case "$onlyextensions" in
21204'') ;;
21205*) keepextensions=''
21206 echo "You have requested that only certains extensions be included..." >&4
21207 for i in $onlyextensions; do
21208 case " $avail_ext " in
21209 *" $i "*)
21210 echo "Keeping extension $i."
21211 keepextensions="$keepextensions $i"
21212 ;;
21213 *) echo "Ignoring extension $i." ;;
21214 esac
21215 done
21216 avail_ext="$keepextensions"
21217 ;;
21218esac
21219
21220case "$noextensions" in
21221'') ;;
21222*) keepextensions=''
21223 echo "You have requested that certain extensions be ignored..." >&4
21224 for i in $avail_ext; do
c3dadc13
AD
21225 case " $noextensions " in
21226 *" $i "*) echo "Ignoring extension $i." ;;
ef0c5be8
JH
21227 *) echo "Keeping extension $i.";
21228 keepextensions="$keepextensions $i"
21229 ;;
21230 esac
21231 done
21232 avail_ext="$keepextensions"
21233 ;;
21234esac
21235
b4eb6b3d
JH
21236: Now see which nonxs extensions are supported on this system.
21237: For now assume all are.
21238nonxs_ext=''
21239for xxx in $nonxs_extensions ; do
21240 case "$xxx" in
21241 *) nonxs_ext="$nonxs_ext $xxx"
21242 ;;
21243 esac
21244done
5f80c64f 21245
b4eb6b3d
JH
21246set X $nonxs_ext
21247shift
21248nonxs_ext="$*"
21249
21250case $usedl in
21251$define)
21252 $cat <<EOM
21253A number of extensions are supplied with $package. You may choose to
21254compile these extensions for dynamic loading (the default), compile
21255them into the $package executable (static loading), or not include
21256them at all. Answer "none" to include no extensions.
21257Note that DynaLoader is always built and need not be mentioned here.
5f80c64f
JH
21258
21259EOM
b4eb6b3d 21260 case "$dynamic_ext" in
736accd3
YST
21261 '')
21262 : Exclude those listed in static_ext
21263 dflt=''
21264 for xxx in $avail_ext; do
21265 case " $static_ext " in
21266 *" $xxx "*) ;;
21267 *) dflt="$dflt $xxx" ;;
21268 esac
21269 done
21270 set X $dflt
21271 shift
21272 dflt="$*"
21273 ;;
b4eb6b3d
JH
21274 *) dflt="$dynamic_ext"
21275 # Perhaps we are reusing an old out-of-date config.sh.
21276 case "$hint" in
21277 previous)
21278 if test X"$dynamic_ext" != X"$avail_ext"; then
21279 $cat <<EOM
7c345082
RGS
21280NOTICE: Your previous config.sh list may be incorrect.
21281The extensions now available to you are
b4eb6b3d
JH
21282 ${avail_ext}
21283but the default list from your previous config.sh is
7c345082 21284 ${dynamic_ext}
9c839522 21285
b4eb6b3d
JH
21286EOM
21287 fi
9c839522
PM
21288 ;;
21289 esac
b4eb6b3d
JH
21290 ;;
21291 esac
5f80c64f 21292 case "$dflt" in
b4eb6b3d
JH
21293 '') dflt=none;;
21294 esac
21295 rp="What extensions do you wish to load dynamically?"
21296 . ./myread
21297 case "$ans" in
21298 none) dynamic_ext=' ' ;;
21299 *) dynamic_ext="$ans" ;;
5f80c64f 21300 esac
5f80c64f 21301
b4eb6b3d
JH
21302 case "$static_ext" in
21303 '')
21304 : Exclude those already listed in dynamic linking
21305 dflt=''
21306 for xxx in $avail_ext; do
21307 case " $dynamic_ext " in
21308 *" $xxx "*) ;;
21309 *) dflt="$dflt $xxx" ;;
21310 esac
21311 done
21312 set X $dflt
21313 shift
21314 dflt="$*"
21315 ;;
7c345082 21316 *) dflt="$static_ext"
b4eb6b3d
JH
21317 ;;
21318 esac
9c839522 21319
b4eb6b3d
JH
21320 case "$dflt" in
21321 '') dflt=none;;
21322 esac
21323 rp="What extensions do you wish to load statically?"
21324 . ./myread
21325 case "$ans" in
21326 none) static_ext=' ' ;;
21327 *) static_ext="$ans" ;;
21328 esac
21329 ;;
21330*)
21331 $cat <<EOM
7c345082
RGS
21332A number of extensions are supplied with $package. Answer "none"
21333to include no extensions.
b4eb6b3d 21334Note that DynaLoader is always built and need not be mentioned here.
9c839522 21335
b4eb6b3d
JH
21336EOM
21337 case "$static_ext" in
21338 '') dflt="$avail_ext" ;;
21339 *) dflt="$static_ext"
21340 # Perhaps we are reusing an old out-of-date config.sh.
21341 case "$hint" in
21342 previous)
21343 if test X"$static_ext" != X"$avail_ext"; then
21344 $cat <<EOM
7c345082
RGS
21345NOTICE: Your previous config.sh list may be incorrect.
21346The extensions now available to you are
b4eb6b3d
JH
21347 ${avail_ext}
21348but the default list from your previous config.sh is
7c345082 21349 ${static_ext}
5f80c64f
JH
21350
21351EOM
b4eb6b3d
JH
21352 fi
21353 ;;
21354 esac
21355 ;;
21356 esac
21357 : Exclude those that are not xs extensions
21358 case "$dflt" in
21359 '') dflt=none;;
21360 esac
21361 rp="What extensions do you wish to include?"
21362 . ./myread
21363 case "$ans" in
21364 none) static_ext=' ' ;;
21365 *) static_ext="$ans" ;;
21366 esac
21367 ;;
5f80c64f 21368esac
7c345082 21369#
f1f6834f
AD
21370# Encode is a special case. If we are building Encode as a static
21371# extension, we need to explicitly list its subextensions as well.
21372# For other nested extensions, this is handled automatically by
21373# the appropriate Makefile.PL.
21374case " $static_ext " in
21375 *" Encode "*) # Add the subextensions of Encode
21376 cd "$rsrc/ext"
21377 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21378 static_ext="$static_ext Encode/$xxx"
21379 done
21380 cd "$tdir"
21381 ;;
21382esac
5f80c64f 21383
b4eb6b3d
JH
21384set X $dynamic_ext $static_ext $nonxs_ext
21385shift
21386extensions="$*"
21387
93a2cd18
AD
21388# Sanity check: We require an extension suitable for use with
21389# AnyDBM_File, as well as Fcntl and IO. (Failure to have these
21390# should show up as failures in the test suite, but it's helpful to
21391# catch them now.) The 'extensions' list is normally sorted
21392# alphabetically, so we need to accept either
21393# DB_File ... Fcntl ... IO ....
21394# or something like
21395# Fcntl ... NDBM_File ... IO ....
42fde7b2
JH
21396case " $extensions" in
21397*"_File "*" Fcntl "*" IO "*) ;; # DB_File
21398*" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21399*" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
7a8675bc
JH
21400*) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21401 echo "WARNING: The Perl you are building will be quite crippled." >& 4
21402 ;;
21403esac
21404
9c839522
PM
21405: Remove libraries needed only for extensions
21406: The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
eedaba54
PM
21407: The exception is SunOS 4.x, which needs them.
21408case "${osname}X${osvers}" in
21409sunos*X4*)
21410 perllibs="$libs"
21411 ;;
21412*) case "$usedl" in
21413 $define|true|[yY]*)
21414 set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
21415 shift
21416 perllibs="$*"
21417 ;;
21418 *) perllibs="$libs"
21419 ;;
21420 esac
21421 ;;
9c839522 21422esac
5f80c64f
JH
21423
21424: Remove build directory name from cppstdin so it can be used from
21425: either the present location or the final installed location.
21426echo " "
21427: Get out of the UU directory to get correct path name.
21428cd ..
21429case "$cppstdin" in
21430`pwd`/cppstdin)
21431 echo "Stripping down cppstdin path name"
21432 cppstdin=cppstdin
21433 ;;
21434esac
21435cd UU
21436
21437: end of configuration questions
21438echo " "
21439echo "End of configuration questions."
21440echo " "
21441
21442: back to where it started
21443if test -d ../UU; then
21444 cd ..
21445fi
21446
48370efc
JH
21447: configuration may be patched via a 'config.arch' file
21448if $test -f config.arch; then
21449 echo "I see a config.arch file, loading it."
21450 . ./config.arch
21451fi
21452
5f80c64f
JH
21453: configuration may be patched via a 'config.over' file
21454if $test -f config.over; then
21455 echo " "
21456 dflt=y
21457 rp='I see a config.over file. Do you wish to load it?'
21458 . UU/myread
21459 case "$ans" in
21460 n*) echo "OK, I'll ignore it.";;
21461 *) . ./config.over
21462 echo "Configuration override changes have been loaded."
21463 ;;
21464 esac
21465fi
21466
21467: in case they want portability, strip down executable paths
21468case "$d_portable" in
21469"$define")
21470 echo " "
21471 echo "Stripping down executable paths..." >&4
21472 for file in $loclist $trylist; do
534ac15a
JH
21473 eval temp=\$$file
21474 eval $file=`basename $temp`
5f80c64f
JH
21475 done
21476 ;;
21477esac
21478
21479: create config.sh file
21480echo " "
21481echo "Creating config.sh..." >&4
21482$spitshell <<EOT >config.sh
21483$startsh
21484#
21485# This file was produced by running the Configure script. It holds all the
21486# definitions figured out by Configure. Should you modify one of these values,
21487# do not forget to propagate your changes by running "Configure -der". You may
21488# instead choose to run each of the .SH files by yourself, or "Configure -S".
21489#
21490
21491# Package name : $package
21492# Source directory : $src
21493# Configuration time: $cf_time
21494# Configured by : $cf_by
21495# Target system : $myuname
21496
21497Author='$Author'
21498Date='$Date'
21499Header='$Header'
21500Id='$Id'
21501Locker='$Locker'
21502Log='$Log'
21503Mcc='$Mcc'
21504RCSfile='$RCSfile'
21505Revision='$Revision'
21506Source='$Source'
21507State='$State'
21508_a='$_a'
21509_exe='$_exe'
21510_o='$_o'
b4eb6b3d 21511afs='$afs'
a6d26a0d 21512afsroot='$afsroot'
b4eb6b3d
JH
21513alignbytes='$alignbytes'
21514ansi2knr='$ansi2knr'
21515aphostname='$aphostname'
21516api_revision='$api_revision'
21517api_subversion='$api_subversion'
21518api_version='$api_version'
21519api_versionstring='$api_versionstring'
5f80c64f 21520ar='$ar'
b4eb6b3d
JH
21521archlib='$archlib'
21522archlibexp='$archlibexp'
21523archname64='$archname64'
21524archname='$archname'
5f80c64f 21525archobjs='$archobjs'
10bc17b6 21526asctime_r_proto='$asctime_r_proto'
5f80c64f 21527awk='$awk'
b4eb6b3d 21528baserev='$baserev'
5f80c64f 21529bash='$bash'
b4eb6b3d 21530bin='$bin'
b4eb6b3d 21531binexp='$binexp'
5f80c64f
JH
21532bison='$bison'
21533byacc='$byacc'
b4eb6b3d 21534byteorder='$byteorder'
5f80c64f 21535c='$c'
b4eb6b3d 21536castflags='$castflags'
5f80c64f
JH
21537cat='$cat'
21538cc='$cc'
21539cccdlflags='$cccdlflags'
21540ccdlflags='$ccdlflags'
21541ccflags='$ccflags'
b4eb6b3d 21542ccflags_uselargefiles='$ccflags_uselargefiles'
e723fc21 21543ccname='$ccname'
b4eb6b3d 21544ccsymbols='$ccsymbols'
6b356c8e 21545ccversion='$ccversion'
5f80c64f 21546cf_by='$cf_by'
b4eb6b3d 21547cf_email='$cf_email'
5f80c64f
JH
21548cf_time='$cf_time'
21549chgrp='$chgrp'
21550chmod='$chmod'
21551chown='$chown'
b4eb6b3d 21552clocktype='$clocktype'
5f80c64f
JH
21553comm='$comm'
21554compress='$compress'
21555contains='$contains'
21556cp='$cp'
21557cpio='$cpio'
21558cpp='$cpp'
b4eb6b3d
JH
21559cpp_stuff='$cpp_stuff'
21560cppccsymbols='$cppccsymbols'
5f80c64f
JH
21561cppflags='$cppflags'
21562cpplast='$cpplast'
21563cppminus='$cppminus'
21564cpprun='$cpprun'
21565cppstdin='$cppstdin'
b4eb6b3d 21566cppsymbols='$cppsymbols'
10bc17b6 21567crypt_r_proto='$crypt_r_proto'
b4eb6b3d 21568cryptlib='$cryptlib'
5f80c64f 21569csh='$csh'
10bc17b6
JH
21570ctermid_r_proto='$ctermid_r_proto'
21571ctime_r_proto='$ctime_r_proto'
b4eb6b3d
JH
21572d_Gconvert='$d_Gconvert'
21573d_PRIEUldbl='$d_PRIEUldbl'
21574d_PRIFUldbl='$d_PRIFUldbl'
21575d_PRIGUldbl='$d_PRIGUldbl'
21576d_PRIXU64='$d_PRIXU64'
21577d_PRId64='$d_PRId64'
21578d_PRIeldbl='$d_PRIeldbl'
21579d_PRIfldbl='$d_PRIfldbl'
21580d_PRIgldbl='$d_PRIgldbl'
21581d_PRIi64='$d_PRIi64'
21582d_PRIo64='$d_PRIo64'
21583d_PRIu64='$d_PRIu64'
21584d_PRIx64='$d_PRIx64'
21585d_SCNfldbl='$d_SCNfldbl'
74cac757 21586d__fwalk='$d__fwalk'
b4eb6b3d
JH
21587d_access='$d_access'
21588d_accessx='$d_accessx'
55954f19 21589d_aintl='$d_aintl'
b4eb6b3d
JH
21590d_alarm='$d_alarm'
21591d_archlib='$d_archlib'
10bc17b6 21592d_asctime_r='$d_asctime_r'
b4eb6b3d
JH
21593d_atolf='$d_atolf'
21594d_atoll='$d_atoll'
0dbb1585
AL
21595d_attribute_format='$d_attribute_format'
21596d_attribute_malloc='$d_attribute_malloc'
21597d_attribute_nonnull='$d_attribute_nonnull'
21598d_attribute_noreturn='$d_attribute_noreturn'
21599d_attribute_pure='$d_attribute_pure'
21600d_attribute_unused='$d_attribute_unused'
21601d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
b4eb6b3d
JH
21602d_bcmp='$d_bcmp'
21603d_bcopy='$d_bcopy'
5f80c64f 21604d_bsd='$d_bsd'
b4eb6b3d
JH
21605d_bsdgetpgrp='$d_bsdgetpgrp'
21606d_bsdsetpgrp='$d_bsdsetpgrp'
635aebb7
AL
21607d_builtin_choose_expr='$d_builtin_choose_expr'
21608d_builtin_expect='$d_builtin_expect'
b4eb6b3d 21609d_bzero='$d_bzero'
a2d23ec2 21610d_c99_variadic_macros='$d_c99_variadic_macros'
b4eb6b3d
JH
21611d_casti32='$d_casti32'
21612d_castneg='$d_castneg'
21613d_charvspr='$d_charvspr'
21614d_chown='$d_chown'
21615d_chroot='$d_chroot'
21616d_chsize='$d_chsize'
758a5d79 21617d_class='$d_class'
b0a2e8e6 21618d_clearenv='$d_clearenv'
b4eb6b3d 21619d_closedir='$d_closedir'
4e0554ec 21620d_cmsghdr_s='$d_cmsghdr_s'
b4eb6b3d 21621d_const='$d_const'
55954f19 21622d_copysignl='$d_copysignl'
666ea192 21623d_cplusplus='$d_cplusplus'
b4eb6b3d 21624d_crypt='$d_crypt'
10bc17b6 21625d_crypt_r='$d_crypt_r'
b4eb6b3d 21626d_csh='$d_csh'
13cfc98d 21627d_ctermid='$d_ctermid'
10bc17b6
JH
21628d_ctermid_r='$d_ctermid_r'
21629d_ctime_r='$d_ctime_r'
b4eb6b3d
JH
21630d_cuserid='$d_cuserid'
21631d_dbl_dig='$d_dbl_dig'
2ef53570 21632d_dbminitproto='$d_dbminitproto'
b4eb6b3d 21633d_difftime='$d_difftime'
de52168c 21634d_dir_dd_fd='$d_dir_dd_fd'
ae0e3d3b 21635d_dirfd='$d_dirfd'
b4eb6b3d
JH
21636d_dirnamlen='$d_dirnamlen'
21637d_dlerror='$d_dlerror'
5f80c64f 21638d_dlopen='$d_dlopen'
b4eb6b3d
JH
21639d_dlsymun='$d_dlsymun'
21640d_dosuid='$d_dosuid'
10bc17b6 21641d_drand48_r='$d_drand48_r'
b4eb6b3d
JH
21642d_drand48proto='$d_drand48proto'
21643d_dup2='$d_dup2'
21644d_eaccess='$d_eaccess'
21645d_endgrent='$d_endgrent'
10bc17b6 21646d_endgrent_r='$d_endgrent_r'
b4eb6b3d 21647d_endhent='$d_endhent'
10bc17b6 21648d_endhostent_r='$d_endhostent_r'
b4eb6b3d 21649d_endnent='$d_endnent'
10bc17b6 21650d_endnetent_r='$d_endnetent_r'
b4eb6b3d 21651d_endpent='$d_endpent'
10bc17b6 21652d_endprotoent_r='$d_endprotoent_r'
b4eb6b3d 21653d_endpwent='$d_endpwent'
10bc17b6 21654d_endpwent_r='$d_endpwent_r'
b4eb6b3d 21655d_endsent='$d_endsent'
10bc17b6 21656d_endservent_r='$d_endservent_r'
b4eb6b3d 21657d_eofnblk='$d_eofnblk'
5f80c64f 21658d_eunice='$d_eunice'
15b61c98 21659d_faststdio='$d_faststdio'
b363b713 21660d_fchdir='$d_fchdir'
b4eb6b3d
JH
21661d_fchmod='$d_fchmod'
21662d_fchown='$d_fchown'
21663d_fcntl='$d_fcntl'
9d9004a9 21664d_fcntl_can_lock='$d_fcntl_can_lock'
b4eb6b3d
JH
21665d_fd_macros='$d_fd_macros'
21666d_fd_set='$d_fd_set'
21667d_fds_bits='$d_fds_bits'
21668d_fgetpos='$d_fgetpos'
758a5d79
JH
21669d_finite='$d_finite'
21670d_finitel='$d_finitel'
b4eb6b3d
JH
21671d_flexfnam='$d_flexfnam'
21672d_flock='$d_flock'
2ef53570 21673d_flockproto='$d_flockproto'
b4eb6b3d 21674d_fork='$d_fork'
758a5d79 21675d_fp_class='$d_fp_class'
b4eb6b3d 21676d_fpathconf='$d_fpathconf'
758a5d79
JH
21677d_fpclass='$d_fpclass'
21678d_fpclassify='$d_fpclassify'
21679d_fpclassl='$d_fpclassl'
b4eb6b3d
JH
21680d_fpos64_t='$d_fpos64_t'
21681d_frexpl='$d_frexpl'
21682d_fs_data_s='$d_fs_data_s'
21683d_fseeko='$d_fseeko'
21684d_fsetpos='$d_fsetpos'
21685d_fstatfs='$d_fstatfs'
21686d_fstatvfs='$d_fstatvfs'
411ab01c 21687d_fsync='$d_fsync'
b4eb6b3d
JH
21688d_ftello='$d_ftello'
21689d_ftime='$d_ftime'
dc814df1 21690d_futimes='$d_futimes'
b4eb6b3d
JH
21691d_getcwd='$d_getcwd'
21692d_getespwnam='$d_getespwnam'
21693d_getfsstat='$d_getfsstat'
21694d_getgrent='$d_getgrent'
10bc17b6
JH
21695d_getgrent_r='$d_getgrent_r'
21696d_getgrgid_r='$d_getgrgid_r'
21697d_getgrnam_r='$d_getgrnam_r'
b4eb6b3d
JH
21698d_getgrps='$d_getgrps'
21699d_gethbyaddr='$d_gethbyaddr'
21700d_gethbyname='$d_gethbyname'
21701d_gethent='$d_gethent'
21702d_gethname='$d_gethname'
10bc17b6
JH
21703d_gethostbyaddr_r='$d_gethostbyaddr_r'
21704d_gethostbyname_r='$d_gethostbyname_r'
21705d_gethostent_r='$d_gethostent_r'
b4eb6b3d 21706d_gethostprotos='$d_gethostprotos'
4e0554ec 21707d_getitimer='$d_getitimer'
b4eb6b3d 21708d_getlogin='$d_getlogin'
10bc17b6 21709d_getlogin_r='$d_getlogin_r'
b4eb6b3d
JH
21710d_getmnt='$d_getmnt'
21711d_getmntent='$d_getmntent'
21712d_getnbyaddr='$d_getnbyaddr'
21713d_getnbyname='$d_getnbyname'
21714d_getnent='$d_getnent'
10bc17b6
JH
21715d_getnetbyaddr_r='$d_getnetbyaddr_r'
21716d_getnetbyname_r='$d_getnetbyname_r'
21717d_getnetent_r='$d_getnetent_r'
b4eb6b3d 21718d_getnetprotos='$d_getnetprotos'
0c0643d0 21719d_getpagsz='$d_getpagsz'
b4eb6b3d
JH
21720d_getpbyname='$d_getpbyname'
21721d_getpbynumber='$d_getpbynumber'
21722d_getpent='$d_getpent'
21723d_getpgid='$d_getpgid'
21724d_getpgrp2='$d_getpgrp2'
21725d_getpgrp='$d_getpgrp'
21726d_getppid='$d_getppid'
21727d_getprior='$d_getprior'
10bc17b6
JH
21728d_getprotobyname_r='$d_getprotobyname_r'
21729d_getprotobynumber_r='$d_getprotobynumber_r'
21730d_getprotoent_r='$d_getprotoent_r'
b4eb6b3d
JH
21731d_getprotoprotos='$d_getprotoprotos'
21732d_getprpwnam='$d_getprpwnam'
21733d_getpwent='$d_getpwent'
10bc17b6
JH
21734d_getpwent_r='$d_getpwent_r'
21735d_getpwnam_r='$d_getpwnam_r'
21736d_getpwuid_r='$d_getpwuid_r'
b4eb6b3d
JH
21737d_getsbyname='$d_getsbyname'
21738d_getsbyport='$d_getsbyport'
21739d_getsent='$d_getsent'
10bc17b6
JH
21740d_getservbyname_r='$d_getservbyname_r'
21741d_getservbyport_r='$d_getservbyport_r'
21742d_getservent_r='$d_getservent_r'
b4eb6b3d
JH
21743d_getservprotos='$d_getservprotos'
21744d_getspnam='$d_getspnam'
10bc17b6 21745d_getspnam_r='$d_getspnam_r'
b4eb6b3d 21746d_gettimeod='$d_gettimeod'
10bc17b6 21747d_gmtime_r='$d_gmtime_r'
5f80c64f 21748d_gnulibc='$d_gnulibc'
b4eb6b3d
JH
21749d_grpasswd='$d_grpasswd'
21750d_hasmntopt='$d_hasmntopt'
21751d_htonl='$d_htonl'
55954f19 21752d_ilogbl='$d_ilogbl'
f3f1a2d8 21753d_inc_version_list='$d_inc_version_list'
b4eb6b3d
JH
21754d_index='$d_index'
21755d_inetaton='$d_inetaton'
21756d_int64_t='$d_int64_t'
21757d_isascii='$d_isascii'
758a5d79
JH
21758d_isfinite='$d_isfinite'
21759d_isinf='$d_isinf'
b4eb6b3d
JH
21760d_isnan='$d_isnan'
21761d_isnanl='$d_isnanl'
21762d_killpg='$d_killpg'
21763d_lchown='$d_lchown'
21764d_ldbl_dig='$d_ldbl_dig'
0a0abfba 21765d_libm_lib_version='$d_libm_lib_version'
b4eb6b3d 21766d_link='$d_link'
10bc17b6 21767d_localtime_r='$d_localtime_r'
8572b25d 21768d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
b4eb6b3d
JH
21769d_locconv='$d_locconv'
21770d_lockf='$d_lockf'
21771d_longdbl='$d_longdbl'
21772d_longlong='$d_longlong'
21773d_lseekproto='$d_lseekproto'
21774d_lstat='$d_lstat'
21775d_madvise='$d_madvise'
7dd121ae
MB
21776d_malloc_good_size='$d_malloc_good_size'
21777d_malloc_size='$d_malloc_size'
b4eb6b3d
JH
21778d_mblen='$d_mblen'
21779d_mbstowcs='$d_mbstowcs'
21780d_mbtowc='$d_mbtowc'
21781d_memchr='$d_memchr'
21782d_memcmp='$d_memcmp'
21783d_memcpy='$d_memcpy'
21784d_memmove='$d_memmove'
21785d_memset='$d_memset'
21786d_mkdir='$d_mkdir'
21787d_mkdtemp='$d_mkdtemp'
21788d_mkfifo='$d_mkfifo'
21789d_mkstemp='$d_mkstemp'
21790d_mkstemps='$d_mkstemps'
21791d_mktime='$d_mktime'
21792d_mmap='$d_mmap'
21793d_modfl='$d_modfl'
e67aeab1 21794d_modfl_pow32_bug='$d_modfl_pow32_bug'
bc9a1b2c 21795d_modflproto='$d_modflproto'
b4eb6b3d
JH
21796d_mprotect='$d_mprotect'
21797d_msg='$d_msg'
21798d_msg_ctrunc='$d_msg_ctrunc'
21799d_msg_dontroute='$d_msg_dontroute'
21800d_msg_oob='$d_msg_oob'
21801d_msg_peek='$d_msg_peek'
21802d_msg_proxy='$d_msg_proxy'
21803d_msgctl='$d_msgctl'
21804d_msgget='$d_msgget'
4e0554ec 21805d_msghdr_s='$d_msghdr_s'
b4eb6b3d
JH
21806d_msgrcv='$d_msgrcv'
21807d_msgsnd='$d_msgsnd'
21808d_msync='$d_msync'
21809d_munmap='$d_munmap'
21810d_mymalloc='$d_mymalloc'
21811d_nice='$d_nice'
2765b840 21812d_nl_langinfo='$d_nl_langinfo'
b4eb6b3d 21813d_nv_preserves_uv='$d_nv_preserves_uv'
f607920a 21814d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
b4eb6b3d
JH
21815d_off64_t='$d_off64_t'
21816d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21817d_oldpthreads='$d_oldpthreads'
21818d_oldsock='$d_oldsock'
21819d_open3='$d_open3'
21820d_pathconf='$d_pathconf'
21821d_pause='$d_pause'
21822d_perl_otherlibdirs='$d_perl_otherlibdirs'
21823d_phostname='$d_phostname'
21824d_pipe='$d_pipe'
21825d_poll='$d_poll'
5f80c64f 21826d_portable='$d_portable'
dcb594bc 21827d_printf_format_null='$d_printf_format_null'
c7aff470 21828d_procselfexe='$d_procselfexe'
233e16ce 21829d_pseudofork='$d_pseudofork'
d6483fcc 21830d_pthread_atfork='$d_pthread_atfork'
58d975c3 21831d_pthread_attr_setscope='$d_pthread_attr_setscope'
b4eb6b3d
JH
21832d_pthread_yield='$d_pthread_yield'
21833d_pwage='$d_pwage'
21834d_pwchange='$d_pwchange'
21835d_pwclass='$d_pwclass'
21836d_pwcomment='$d_pwcomment'
21837d_pwexpire='$d_pwexpire'
21838d_pwgecos='$d_pwgecos'
21839d_pwpasswd='$d_pwpasswd'
21840d_pwquota='$d_pwquota'
21841d_qgcvt='$d_qgcvt'
21842d_quad='$d_quad'
10bc17b6
JH
21843d_random_r='$d_random_r'
21844d_readdir64_r='$d_readdir64_r'
b4eb6b3d 21845d_readdir='$d_readdir'
10bc17b6 21846d_readdir_r='$d_readdir_r'
b4eb6b3d 21847d_readlink='$d_readlink'
4e0554ec
JH
21848d_readv='$d_readv'
21849d_recvmsg='$d_recvmsg'
b4eb6b3d
JH
21850d_rename='$d_rename'
21851d_rewinddir='$d_rewinddir'
21852d_rmdir='$d_rmdir'
21853d_safebcpy='$d_safebcpy'
21854d_safemcpy='$d_safemcpy'
21855d_sanemcmp='$d_sanemcmp'
ef9f17be 21856d_sbrkproto='$d_sbrkproto'
55954f19 21857d_scalbnl='$d_scalbnl'
b4eb6b3d
JH
21858d_sched_yield='$d_sched_yield'
21859d_scm_rights='$d_scm_rights'
21860d_seekdir='$d_seekdir'
21861d_select='$d_select'
21862d_sem='$d_sem'
21863d_semctl='$d_semctl'
21864d_semctl_semid_ds='$d_semctl_semid_ds'
21865d_semctl_semun='$d_semctl_semun'
21866d_semget='$d_semget'
21867d_semop='$d_semop'
4e0554ec 21868d_sendmsg='$d_sendmsg'
b4eb6b3d
JH
21869d_setegid='$d_setegid'
21870d_seteuid='$d_seteuid'
21871d_setgrent='$d_setgrent'
10bc17b6 21872d_setgrent_r='$d_setgrent_r'
b4eb6b3d
JH
21873d_setgrps='$d_setgrps'
21874d_sethent='$d_sethent'
10bc17b6 21875d_sethostent_r='$d_sethostent_r'
4e0554ec 21876d_setitimer='$d_setitimer'
b4eb6b3d
JH
21877d_setlinebuf='$d_setlinebuf'
21878d_setlocale='$d_setlocale'
10bc17b6 21879d_setlocale_r='$d_setlocale_r'
b4eb6b3d 21880d_setnent='$d_setnent'
10bc17b6 21881d_setnetent_r='$d_setnetent_r'
b4eb6b3d
JH
21882d_setpent='$d_setpent'
21883d_setpgid='$d_setpgid'
21884d_setpgrp2='$d_setpgrp2'
21885d_setpgrp='$d_setpgrp'
21886d_setprior='$d_setprior'
21887d_setproctitle='$d_setproctitle'
10bc17b6 21888d_setprotoent_r='$d_setprotoent_r'
b4eb6b3d 21889d_setpwent='$d_setpwent'
10bc17b6 21890d_setpwent_r='$d_setpwent_r'
b4eb6b3d
JH
21891d_setregid='$d_setregid'
21892d_setresgid='$d_setresgid'
21893d_setresuid='$d_setresuid'
21894d_setreuid='$d_setreuid'
21895d_setrgid='$d_setrgid'
21896d_setruid='$d_setruid'
21897d_setsent='$d_setsent'
10bc17b6 21898d_setservent_r='$d_setservent_r'
b4eb6b3d
JH
21899d_setsid='$d_setsid'
21900d_setvbuf='$d_setvbuf'
21901d_sfio='$d_sfio'
21902d_shm='$d_shm'
21903d_shmat='$d_shmat'
21904d_shmatprototype='$d_shmatprototype'
21905d_shmctl='$d_shmctl'
21906d_shmdt='$d_shmdt'
21907d_shmget='$d_shmget'
21908d_sigaction='$d_sigaction'
ed140128 21909d_signbit='$d_signbit'
983dbef6 21910d_sigprocmask='$d_sigprocmask'
b4eb6b3d 21911d_sigsetjmp='$d_sigsetjmp'
c95d0e17 21912d_sitearch='$d_sitearch'
4f5da3e9 21913d_snprintf='$d_snprintf'
49a78c82 21914d_sockatmark='$d_sockatmark'
2ef53570 21915d_sockatmarkproto='$d_sockatmarkproto'
b4eb6b3d
JH
21916d_socket='$d_socket'
21917d_socklen_t='$d_socklen_t'
21918d_sockpair='$d_sockpair'
21919d_socks5_init='$d_socks5_init'
360321b3 21920d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
b4eb6b3d 21921d_sqrtl='$d_sqrtl'
10bc17b6
JH
21922d_srand48_r='$d_srand48_r'
21923d_srandom_r='$d_srandom_r'
eef837ea 21924d_sresgproto='$d_sresgproto'
640374d0 21925d_sresuproto='$d_sresuproto'
b4eb6b3d
JH
21926d_statblks='$d_statblks'
21927d_statfs_f_flags='$d_statfs_f_flags'
21928d_statfs_s='$d_statfs_s'
21929d_statvfs='$d_statvfs'
21930d_stdio_cnt_lval='$d_stdio_cnt_lval'
21931d_stdio_ptr_lval='$d_stdio_ptr_lval'
a7ffa9b9
NC
21932d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21933d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
b4eb6b3d
JH
21934d_stdio_stream_array='$d_stdio_stream_array'
21935d_stdiobase='$d_stdiobase'
21936d_stdstdio='$d_stdstdio'
21937d_strchr='$d_strchr'
21938d_strcoll='$d_strcoll'
21939d_strctcpy='$d_strctcpy'
21940d_strerrm='$d_strerrm'
21941d_strerror='$d_strerror'
10bc17b6 21942d_strerror_r='$d_strerror_r'
b3c85772 21943d_strftime='$d_strftime'
08c92000
MB
21944d_strlcat='$d_strlcat'
21945d_strlcpy='$d_strlcpy'
b4eb6b3d
JH
21946d_strtod='$d_strtod'
21947d_strtol='$d_strtol'
21948d_strtold='$d_strtold'
21949d_strtoll='$d_strtoll'
28e5dec8 21950d_strtoq='$d_strtoq'
b4eb6b3d
JH
21951d_strtoul='$d_strtoul'
21952d_strtoull='$d_strtoull'
21953d_strtouq='$d_strtouq'
21954d_strxfrm='$d_strxfrm'
21955d_suidsafe='$d_suidsafe'
21956d_symlink='$d_symlink'
21957d_syscall='$d_syscall'
2ef53570 21958d_syscallproto='$d_syscallproto'
b4eb6b3d
JH
21959d_sysconf='$d_sysconf'
21960d_sysernlst='$d_sysernlst'
21961d_syserrlst='$d_syserrlst'
21962d_system='$d_system'
21963d_tcgetpgrp='$d_tcgetpgrp'
21964d_tcsetpgrp='$d_tcsetpgrp'
21965d_telldir='$d_telldir'
21966d_telldirproto='$d_telldirproto'
21967d_time='$d_time'
21968d_times='$d_times'
14b90194
JH
21969d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21970d_tm_tm_zone='$d_tm_tm_zone'
10bc17b6 21971d_tmpnam_r='$d_tmpnam_r'
b4eb6b3d 21972d_truncate='$d_truncate'
10bc17b6 21973d_ttyname_r='$d_ttyname_r'
b4eb6b3d 21974d_tzname='$d_tzname'
4e0554ec
JH
21975d_u32align='$d_u32align'
21976d_ualarm='$d_ualarm'
b4eb6b3d
JH
21977d_umask='$d_umask'
21978d_uname='$d_uname'
21979d_union_semun='$d_union_semun'
758a5d79 21980d_unordered='$d_unordered'
bdf33aa7 21981d_unsetenv='$d_unsetenv'
4e0554ec 21982d_usleep='$d_usleep'
2ef53570 21983d_usleepproto='$d_usleepproto'
b4eb6b3d
JH
21984d_ustat='$d_ustat'
21985d_vendorarch='$d_vendorarch'
21986d_vendorbin='$d_vendorbin'
21987d_vendorlib='$d_vendorlib'
6e1038e0 21988d_vendorscript='$d_vendorscript'
b4eb6b3d
JH
21989d_vfork='$d_vfork'
21990d_void_closedir='$d_void_closedir'
21991d_voidsig='$d_voidsig'
21992d_voidtty='$d_voidtty'
21993d_volatile='$d_volatile'
21994d_vprintf='$d_vprintf'
4f5da3e9 21995d_vsnprintf='$d_vsnprintf'
b4eb6b3d
JH
21996d_wait4='$d_wait4'
21997d_waitpid='$d_waitpid'
21998d_wcstombs='$d_wcstombs'
21999d_wctomb='$d_wctomb'
4e0554ec 22000d_writev='$d_writev'
5f80c64f
JH
22001d_xenix='$d_xenix'
22002date='$date'
b4eb6b3d
JH
22003db_hashtype='$db_hashtype'
22004db_prefixtype='$db_prefixtype'
640374d0
JH
22005db_version_major='$db_version_major'
22006db_version_minor='$db_version_minor'
22007db_version_patch='$db_version_patch'
b4eb6b3d
JH
22008defvoidused='$defvoidused'
22009direntrytype='$direntrytype'
22010dlext='$dlext'
5f80c64f 22011dlsrc='$dlsrc'
b4eb6b3d
JH
22012doublesize='$doublesize'
22013drand01='$drand01'
10bc17b6 22014drand48_r_proto='$drand48_r_proto'
b4eb6b3d
JH
22015dynamic_ext='$dynamic_ext'
22016eagain='$eagain'
22017ebcdic='$ebcdic'
5f80c64f
JH
22018echo='$echo'
22019egrep='$egrep'
22020emacs='$emacs'
10bc17b6
JH
22021endgrent_r_proto='$endgrent_r_proto'
22022endhostent_r_proto='$endhostent_r_proto'
22023endnetent_r_proto='$endnetent_r_proto'
22024endprotoent_r_proto='$endprotoent_r_proto'
22025endpwent_r_proto='$endpwent_r_proto'
22026endservent_r_proto='$endservent_r_proto'
5f80c64f
JH
22027eunicefix='$eunicefix'
22028exe_ext='$exe_ext'
22029expr='$expr'
b4eb6b3d 22030extensions='$extensions'
6fcddf3b 22031extras='$extras'
b4eb6b3d
JH
22032fflushNULL='$fflushNULL'
22033fflushall='$fflushall'
5f80c64f
JH
22034find='$find'
22035firstmakefile='$firstmakefile'
22036flex='$flex'
b4eb6b3d
JH
22037fpossize='$fpossize'
22038fpostype='$fpostype'
22039freetype='$freetype'
5440bc8e 22040from='$from'
b4eb6b3d
JH
22041full_ar='$full_ar'
22042full_csh='$full_csh'
22043full_sed='$full_sed'
2d736872 22044gccansipedantic='$gccansipedantic'
5b463ca7 22045gccosandvers='$gccosandvers'
5f80c64f 22046gccversion='$gccversion'
10bc17b6
JH
22047getgrent_r_proto='$getgrent_r_proto'
22048getgrgid_r_proto='$getgrgid_r_proto'
22049getgrnam_r_proto='$getgrnam_r_proto'
22050gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22051gethostbyname_r_proto='$gethostbyname_r_proto'
22052gethostent_r_proto='$gethostent_r_proto'
22053getlogin_r_proto='$getlogin_r_proto'
22054getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22055getnetbyname_r_proto='$getnetbyname_r_proto'
22056getnetent_r_proto='$getnetent_r_proto'
22057getprotobyname_r_proto='$getprotobyname_r_proto'
22058getprotobynumber_r_proto='$getprotobynumber_r_proto'
22059getprotoent_r_proto='$getprotoent_r_proto'
22060getpwent_r_proto='$getpwent_r_proto'
22061getpwnam_r_proto='$getpwnam_r_proto'
22062getpwuid_r_proto='$getpwuid_r_proto'
22063getservbyname_r_proto='$getservbyname_r_proto'
22064getservbyport_r_proto='$getservbyport_r_proto'
22065getservent_r_proto='$getservent_r_proto'
22066getspnam_r_proto='$getspnam_r_proto'
b4eb6b3d
JH
22067gidformat='$gidformat'
22068gidsign='$gidsign'
22069gidsize='$gidsize'
22070gidtype='$gidtype'
5f80c64f 22071glibpth='$glibpth'
3c728e00 22072gmake='$gmake'
10bc17b6 22073gmtime_r_proto='$gmtime_r_proto'
5f6e0ee4 22074gnulibc_version='$gnulibc_version'
5f80c64f 22075grep='$grep'
b4eb6b3d
JH
22076groupcat='$groupcat'
22077groupstype='$groupstype'
5f80c64f 22078gzip='$gzip'
b4eb6b3d
JH
22079h_fcntl='$h_fcntl'
22080h_sysfile='$h_sysfile'
5f80c64f 22081hint='$hint'
b4eb6b3d 22082hostcat='$hostcat'
6e1038e0
MB
22083html1dir='$html1dir'
22084html1direxp='$html1direxp'
22085html3dir='$html3dir'
22086html3direxp='$html3direxp'
b4eb6b3d
JH
22087i16size='$i16size'
22088i16type='$i16type'
22089i32size='$i32size'
22090i32type='$i32type'
22091i64size='$i64size'
22092i64type='$i64type'
22093i8size='$i8size'
22094i8type='$i8type'
22095i_arpainet='$i_arpainet'
22096i_bsdioctl='$i_bsdioctl'
10bc17b6 22097i_crypt='$i_crypt'
b4eb6b3d
JH
22098i_db='$i_db'
22099i_dbm='$i_dbm'
22100i_dirent='$i_dirent'
5f80c64f 22101i_dld='$i_dld'
b4eb6b3d
JH
22102i_dlfcn='$i_dlfcn'
22103i_fcntl='$i_fcntl'
22104i_float='$i_float'
758a5d79
JH
22105i_fp='$i_fp'
22106i_fp_class='$i_fp_class'
b4eb6b3d
JH
22107i_gdbm='$i_gdbm'
22108i_grp='$i_grp'
b4eb6b3d
JH
22109i_ieeefp='$i_ieeefp'
22110i_inttypes='$i_inttypes'
2765b840 22111i_langinfo='$i_langinfo'
b4eb6b3d
JH
22112i_libutil='$i_libutil'
22113i_limits='$i_limits'
22114i_locale='$i_locale'
22115i_machcthr='$i_machcthr'
22116i_malloc='$i_malloc'
22117i_math='$i_math'
22118i_memory='$i_memory'
22119i_mntent='$i_mntent'
22120i_ndbm='$i_ndbm'
22121i_netdb='$i_netdb'
22122i_neterrno='$i_neterrno'
22123i_netinettcp='$i_netinettcp'
22124i_niin='$i_niin'
22125i_poll='$i_poll'
22126i_prot='$i_prot'
22127i_pthread='$i_pthread'
22128i_pwd='$i_pwd'
22129i_rpcsvcdbm='$i_rpcsvcdbm'
22130i_sfio='$i_sfio'
22131i_sgtty='$i_sgtty'
22132i_shadow='$i_shadow'
22133i_socks='$i_socks'
22134i_stdarg='$i_stdarg'
22135i_stddef='$i_stddef'
22136i_stdlib='$i_stdlib'
22137i_string='$i_string'
22138i_sunmath='$i_sunmath'
22139i_sysaccess='$i_sysaccess'
22140i_sysdir='$i_sysdir'
22141i_sysfile='$i_sysfile'
22142i_sysfilio='$i_sysfilio'
22143i_sysin='$i_sysin'
22144i_sysioctl='$i_sysioctl'
22145i_syslog='$i_syslog'
22146i_sysmman='$i_sysmman'
22147i_sysmode='$i_sysmode'
22148i_sysmount='$i_sysmount'
22149i_sysndir='$i_sysndir'
22150i_sysparam='$i_sysparam'
22151i_sysresrc='$i_sysresrc'
22152i_syssecrt='$i_syssecrt'
22153i_sysselct='$i_sysselct'
22154i_syssockio='$i_syssockio'
22155i_sysstat='$i_sysstat'
22156i_sysstatfs='$i_sysstatfs'
22157i_sysstatvfs='$i_sysstatvfs'
22158i_systime='$i_systime'
22159i_systimek='$i_systimek'
22160i_systimes='$i_systimes'
22161i_systypes='$i_systypes'
22162i_sysuio='$i_sysuio'
22163i_sysun='$i_sysun'
22164i_sysutsname='$i_sysutsname'
22165i_sysvfs='$i_sysvfs'
22166i_syswait='$i_syswait'
22167i_termio='$i_termio'
22168i_termios='$i_termios'
22169i_time='$i_time'
22170i_unistd='$i_unistd'
22171i_ustat='$i_ustat'
22172i_utime='$i_utime'
22173i_values='$i_values'
22174i_varargs='$i_varargs'
22175i_varhdr='$i_varhdr'
22176i_vfork='$i_vfork'
5f80c64f 22177ignore_versioned_solibs='$ignore_versioned_solibs'
b4eb6b3d
JH
22178inc_version_list='$inc_version_list'
22179inc_version_list_init='$inc_version_list_init'
5f80c64f
JH
22180incpath='$incpath'
22181inews='$inews'
f3f1a2d8 22182initialinstalllocation='$initialinstalllocation'
b4eb6b3d
JH
22183installarchlib='$installarchlib'
22184installbin='$installbin'
6e1038e0
MB
22185installhtml1dir='$installhtml1dir'
22186installhtml3dir='$installhtml3dir'
b4eb6b3d
JH
22187installman1dir='$installman1dir'
22188installman3dir='$installman3dir'
22189installprefix='$installprefix'
22190installprefixexp='$installprefixexp'
22191installprivlib='$installprivlib'
22192installscript='$installscript'
22193installsitearch='$installsitearch'
22194installsitebin='$installsitebin'
8d2cbf27
JH
22195installsitehtml1dir='$installsitehtml1dir'
22196installsitehtml3dir='$installsitehtml3dir'
b4eb6b3d 22197installsitelib='$installsitelib'
91e123a8
JH
22198installsiteman1dir='$installsiteman1dir'
22199installsiteman3dir='$installsiteman3dir'
6e1038e0 22200installsitescript='$installsitescript'
b4eb6b3d
JH
22201installstyle='$installstyle'
22202installusrbinperl='$installusrbinperl'
22203installvendorarch='$installvendorarch'
22204installvendorbin='$installvendorbin'
8d2cbf27
JH
22205installvendorhtml1dir='$installvendorhtml1dir'
22206installvendorhtml3dir='$installvendorhtml3dir'
b4eb6b3d 22207installvendorlib='$installvendorlib'
91e123a8
JH
22208installvendorman1dir='$installvendorman1dir'
22209installvendorman3dir='$installvendorman3dir'
6e1038e0 22210installvendorscript='$installvendorscript'
b4eb6b3d 22211intsize='$intsize'
4b661809 22212issymlink='$issymlink'
b4eb6b3d
JH
22213ivdformat='$ivdformat'
22214ivsize='$ivsize'
22215ivtype='$ivtype'
22216known_extensions='$known_extensions'
5f80c64f 22217ksh='$ksh'
5f80c64f
JH
22218ld='$ld'
22219lddlflags='$lddlflags'
22220ldflags='$ldflags'
b4eb6b3d
JH
22221ldflags_uselargefiles='$ldflags_uselargefiles'
22222ldlibpthname='$ldlibpthname'
5f80c64f
JH
22223less='$less'
22224lib_ext='$lib_ext'
22225libc='$libc'
b4eb6b3d 22226libperl='$libperl'
5f80c64f
JH
22227libpth='$libpth'
22228libs='$libs'
43999f95
JH
22229libsdirs='$libsdirs'
22230libsfiles='$libsfiles'
22231libsfound='$libsfound'
13b3f787 22232libspath='$libspath'
5f80c64f 22233libswanted='$libswanted'
b4eb6b3d 22234libswanted_uselargefiles='$libswanted_uselargefiles'
5f80c64f
JH
22235line='$line'
22236lint='$lint'
22237lkflags='$lkflags'
22238ln='$ln'
22239lns='$lns'
10bc17b6 22240localtime_r_proto='$localtime_r_proto'
5f80c64f
JH
22241locincpth='$locincpth'
22242loclibpth='$loclibpth'
b4eb6b3d
JH
22243longdblsize='$longdblsize'
22244longlongsize='$longlongsize'
22245longsize='$longsize'
5f80c64f
JH
22246lp='$lp'
22247lpr='$lpr'
22248ls='$ls'
b4eb6b3d
JH
22249lseeksize='$lseeksize'
22250lseektype='$lseektype'
a724edfe 22251mad='$mad'
f3f1a2d8
MB
22252madlyh='$madlyh'
22253madlyobj='$madlyobj'
22254madlysrc='$madlysrc'
5f80c64f
JH
22255mail='$mail'
22256mailx='$mailx'
22257make='$make'
22258make_set_make='$make_set_make'
b4eb6b3d
JH
22259mallocobj='$mallocobj'
22260mallocsrc='$mallocsrc'
22261malloctype='$malloctype'
22262man1dir='$man1dir'
22263man1direxp='$man1direxp'
22264man1ext='$man1ext'
22265man3dir='$man3dir'
22266man3direxp='$man3direxp'
22267man3ext='$man3ext'
5f80c64f 22268mips_type='$mips_type'
5129fff4 22269mistrustnm='$mistrustnm'
5f80c64f 22270mkdir='$mkdir'
b4eb6b3d
JH
22271mmaptype='$mmaptype'
22272modetype='$modetype'
5f80c64f 22273more='$more'
b4eb6b3d 22274multiarch='$multiarch'
5f80c64f 22275mv='$mv'
b4eb6b3d
JH
22276myarchname='$myarchname'
22277mydomain='$mydomain'
22278myhostname='$myhostname'
5f80c64f
JH
22279myuname='$myuname'
22280n='$n'
2cc61e15 22281need_va_copy='$need_va_copy'
b4eb6b3d
JH
22282netdb_hlen_type='$netdb_hlen_type'
22283netdb_host_type='$netdb_host_type'
22284netdb_name_type='$netdb_name_type'
22285netdb_net_type='$netdb_net_type'
5f80c64f
JH
22286nm='$nm'
22287nm_opt='$nm_opt'
22288nm_so_opt='$nm_so_opt'
b4eb6b3d 22289nonxs_ext='$nonxs_ext'
5f80c64f 22290nroff='$nroff'
b4eb6b3d
JH
22291nvEUformat='$nvEUformat'
22292nvFUformat='$nvFUformat'
22293nvGUformat='$nvGUformat'
53133ed1 22294nv_preserves_uv_bits='$nv_preserves_uv_bits'
b4eb6b3d
JH
22295nveformat='$nveformat'
22296nvfformat='$nvfformat'
22297nvgformat='$nvgformat'
22298nvsize='$nvsize'
22299nvtype='$nvtype'
22300o_nonblock='$o_nonblock'
5f80c64f 22301obj_ext='$obj_ext'
b4eb6b3d 22302old_pthread_create_joinable='$old_pthread_create_joinable'
5f80c64f 22303optimize='$optimize'
b4eb6b3d 22304orderlib='$orderlib'
5f80c64f
JH
22305osname='$osname'
22306osvers='$osvers'
b4eb6b3d 22307otherlibdirs='$otherlibdirs'
5f80c64f 22308package='$package'
b4eb6b3d
JH
22309pager='$pager'
22310passcat='$passcat'
22311patchlevel='$patchlevel'
5f80c64f 22312path_sep='$path_sep'
b4eb6b3d 22313perl5='$perl5'
5f80c64f 22314perl='$perl'
151e6568 22315perl_patchlevel='$perl_patchlevel'
b4eb6b3d 22316perladmin='$perladmin'
9c839522 22317perllibs='$perllibs'
b4eb6b3d 22318perlpath='$perlpath'
5f80c64f 22319pg='$pg'
b4eb6b3d
JH
22320phostname='$phostname'
22321pidtype='$pidtype'
5f80c64f
JH
22322plibpth='$plibpth'
22323pmake='$pmake'
22324pr='$pr'
b4eb6b3d
JH
22325prefix='$prefix'
22326prefixexp='$prefixexp'
22327privlib='$privlib'
22328privlibexp='$privlibexp'
f24dbf84 22329procselfexe='$procselfexe'
b4eb6b3d
JH
22330prototype='$prototype'
22331ptrsize='$ptrsize'
22332quadkind='$quadkind'
22333quadtype='$quadtype'
22334randbits='$randbits'
22335randfunc='$randfunc'
10bc17b6 22336random_r_proto='$random_r_proto'
b4eb6b3d
JH
22337randseedtype='$randseedtype'
22338ranlib='$ranlib'
22339rd_nodata='$rd_nodata'
10bc17b6
JH
22340readdir64_r_proto='$readdir64_r_proto'
22341readdir_r_proto='$readdir_r_proto'
b4eb6b3d 22342revision='$revision'
5f80c64f 22343rm='$rm'
5b813a60 22344rm_try='$rm_try'
5f80c64f 22345rmail='$rmail'
5440bc8e 22346run='$run'
5f80c64f 22347runnm='$runnm'
b4eb6b3d
JH
22348sPRIEUldbl='$sPRIEUldbl'
22349sPRIFUldbl='$sPRIFUldbl'
22350sPRIGUldbl='$sPRIGUldbl'
22351sPRIXU64='$sPRIXU64'
22352sPRId64='$sPRId64'
22353sPRIeldbl='$sPRIeldbl'
22354sPRIfldbl='$sPRIfldbl'
22355sPRIgldbl='$sPRIgldbl'
22356sPRIi64='$sPRIi64'
22357sPRIo64='$sPRIo64'
22358sPRIu64='$sPRIu64'
22359sPRIx64='$sPRIx64'
22360sSCNfldbl='$sSCNfldbl'
22361sched_yield='$sched_yield'
22362scriptdir='$scriptdir'
22363scriptdirexp='$scriptdirexp'
5f80c64f 22364sed='$sed'
b4eb6b3d
JH
22365seedfunc='$seedfunc'
22366selectminbits='$selectminbits'
22367selecttype='$selecttype'
5f80c64f 22368sendmail='$sendmail'
10bc17b6
JH
22369setgrent_r_proto='$setgrent_r_proto'
22370sethostent_r_proto='$sethostent_r_proto'
22371setlocale_r_proto='$setlocale_r_proto'
22372setnetent_r_proto='$setnetent_r_proto'
22373setprotoent_r_proto='$setprotoent_r_proto'
22374setpwent_r_proto='$setpwent_r_proto'
22375setservent_r_proto='$setservent_r_proto'
5f80c64f
JH
22376sh='$sh'
22377shar='$shar'
22378sharpbang='$sharpbang'
b4eb6b3d
JH
22379shmattype='$shmattype'
22380shortsize='$shortsize'
22381shrpenv='$shrpenv'
5f80c64f 22382shsharp='$shsharp'
b4eb6b3d
JH
22383sig_count='$sig_count'
22384sig_name='$sig_name'
22385sig_name_init='$sig_name_init'
22386sig_num='$sig_num'
22387sig_num_init='$sig_num_init'
76d3c696 22388sig_size='$sig_size'
b4eb6b3d
JH
22389signal_t='$signal_t'
22390sitearch='$sitearch'
22391sitearchexp='$sitearchexp'
22392sitebin='$sitebin'
22393sitebinexp='$sitebinexp'
8d2cbf27
JH
22394sitehtml1dir='$sitehtml1dir'
22395sitehtml1direxp='$sitehtml1direxp'
22396sitehtml3dir='$sitehtml3dir'
22397sitehtml3direxp='$sitehtml3direxp'
b4eb6b3d
JH
22398sitelib='$sitelib'
22399sitelib_stem='$sitelib_stem'
22400sitelibexp='$sitelibexp'
91e123a8
JH
22401siteman1dir='$siteman1dir'
22402siteman1direxp='$siteman1direxp'
22403siteman3dir='$siteman3dir'
22404siteman3direxp='$siteman3direxp'
b4eb6b3d
JH
22405siteprefix='$siteprefix'
22406siteprefixexp='$siteprefixexp'
6e1038e0
MB
22407sitescript='$sitescript'
22408sitescriptexp='$sitescriptexp'
b4eb6b3d
JH
22409sizesize='$sizesize'
22410sizetype='$sizetype'
5f80c64f
JH
22411sleep='$sleep'
22412smail='$smail'
5f80c64f 22413so='$so'
b4eb6b3d
JH
22414sockethdr='$sockethdr'
22415socketlib='$socketlib'
22416socksizetype='$socksizetype'
5f80c64f
JH
22417sort='$sort'
22418spackage='$spackage'
22419spitshell='$spitshell'
10bc17b6
JH
22420srand48_r_proto='$srand48_r_proto'
22421srandom_r_proto='$srandom_r_proto'
5f80c64f 22422src='$src'
b4eb6b3d
JH
22423ssizetype='$ssizetype'
22424startperl='$startperl'
5f80c64f 22425startsh='$startsh'
b4eb6b3d
JH
22426static_ext='$static_ext'
22427stdchar='$stdchar'
22428stdio_base='$stdio_base'
22429stdio_bufsiz='$stdio_bufsiz'
22430stdio_cnt='$stdio_cnt'
22431stdio_filbuf='$stdio_filbuf'
22432stdio_ptr='$stdio_ptr'
22433stdio_stream_array='$stdio_stream_array'
10bc17b6 22434strerror_r_proto='$strerror_r_proto'
b4eb6b3d 22435strings='$strings'
5f80c64f 22436submit='$submit'
b4eb6b3d
JH
22437subversion='$subversion'
22438sysman='$sysman'
5f80c64f
JH
22439tail='$tail'
22440tar='$tar'
5440bc8e 22441targetarch='$targetarch'
5f80c64f
JH
22442tbl='$tbl'
22443tee='$tee'
22444test='$test'
b4eb6b3d
JH
22445timeincl='$timeincl'
22446timetype='$timetype'
10bc17b6 22447tmpnam_r_proto='$tmpnam_r_proto'
5440bc8e 22448to='$to'
5f80c64f
JH
22449touch='$touch'
22450tr='$tr'
22451trnl='$trnl'
22452troff='$troff'
10bc17b6 22453ttyname_r_proto='$ttyname_r_proto'
b4eb6b3d
JH
22454u16size='$u16size'
22455u16type='$u16type'
22456u32size='$u32size'
22457u32type='$u32type'
22458u64size='$u64size'
22459u64type='$u64type'
22460u8size='$u8size'
22461u8type='$u8type'
22462uidformat='$uidformat'
22463uidsign='$uidsign'
22464uidsize='$uidsize'
22465uidtype='$uidtype'
5f80c64f
JH
22466uname='$uname'
22467uniq='$uniq'
b4eb6b3d
JH
22468uquadtype='$uquadtype'
22469use5005threads='$use5005threads'
22470use64bitall='$use64bitall'
22471use64bitint='$use64bitint'
5440bc8e 22472usecrosscompile='$usecrosscompile'
5f80c64f 22473usedl='$usedl'
15b61c98 22474usefaststdio='$usefaststdio'
b4eb6b3d
JH
22475useithreads='$useithreads'
22476uselargefiles='$uselargefiles'
22477uselongdouble='$uselongdouble'
19a100ff 22478usemallocwrap='$usemallocwrap'
b4eb6b3d
JH
22479usemorebits='$usemorebits'
22480usemultiplicity='$usemultiplicity'
22481usemymalloc='$usemymalloc'
5f80c64f 22482usenm='$usenm'
b4eb6b3d
JH
22483useopcode='$useopcode'
22484useperlio='$useperlio'
22485useposix='$useposix'
9514c62b 22486usereentrant='$usereentrant'
d51aaa9d 22487userelocatableinc='$userelocatableinc'
b4eb6b3d
JH
22488usesfio='$usesfio'
22489useshrplib='$useshrplib'
5f106f9c 22490usesitecustomize='$usesitecustomize'
29209bc5 22491usesocks='$usesocks'
b4eb6b3d
JH
22492usethreads='$usethreads'
22493usevendorprefix='$usevendorprefix'
22494usevfork='$usevfork'
5f80c64f
JH
22495usrinc='$usrinc'
22496uuname='$uuname'
b4eb6b3d
JH
22497uvXUformat='$uvXUformat'
22498uvoformat='$uvoformat'
22499uvsize='$uvsize'
22500uvtype='$uvtype'
22501uvuformat='$uvuformat'
22502uvxformat='$uvxformat'
22503vendorarch='$vendorarch'
22504vendorarchexp='$vendorarchexp'
22505vendorbin='$vendorbin'
22506vendorbinexp='$vendorbinexp'
8d2cbf27
JH
22507vendorhtml1dir='$vendorhtml1dir'
22508vendorhtml1direxp='$vendorhtml1direxp'
22509vendorhtml3dir='$vendorhtml3dir'
22510vendorhtml3direxp='$vendorhtml3direxp'
b4eb6b3d
JH
22511vendorlib='$vendorlib'
22512vendorlib_stem='$vendorlib_stem'
22513vendorlibexp='$vendorlibexp'
91e123a8
JH
22514vendorman1dir='$vendorman1dir'
22515vendorman1direxp='$vendorman1direxp'
22516vendorman3dir='$vendorman3dir'
22517vendorman3direxp='$vendorman3direxp'
b4eb6b3d
JH
22518vendorprefix='$vendorprefix'
22519vendorprefixexp='$vendorprefixexp'
6e1038e0
MB
22520vendorscript='$vendorscript'
22521vendorscriptexp='$vendorscriptexp'
b4eb6b3d 22522version='$version'
861eb78d 22523version_patchlevel_string='$version_patchlevel_string'
d56c5707 22524versiononly='$versiononly'
5f80c64f 22525vi='$vi'
b4eb6b3d 22526voidflags='$voidflags'
5f80c64f 22527xlibpth='$xlibpth'
3659ebf1
JH
22528yacc='$yacc'
22529yaccflags='$yaccflags'
5f80c64f
JH
22530zcat='$zcat'
22531zip='$zip'
22532EOT
22533
22534: Add in command line options if available
22535$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22536
22537: add special variables
22538$test -f $src/patchlevel.h && \
d00b958f 22539awk '/^#define[ ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
151e6568 22540echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
a02608de 22541echo "PERL_CONFIG_SH=true" >>config.sh
5f80c64f
JH
22542
22543: propagate old symbols
22544if $test -f UU/config.sh; then
381aa1ff 22545 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
5f80c64f 22546 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
aef7654c 22547 $sort | $uniq -u >UU/oldsyms
5f80c64f
JH
22548 set X `cat UU/oldsyms`
22549 shift
22550 case $# in
22551 0) ;;
22552 *)
22553 cat <<EOM
22554Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22555EOM
22556 echo "# Variables propagated from previous config.sh file." >>config.sh
22557 for sym in `cat UU/oldsyms`; do
22558 echo " Propagating $hint variable "'$'"$sym..."
22559 eval 'tmp="$'"${sym}"'"'
22560 echo "$tmp" | \
22561 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22562 done
22563 ;;
22564 esac
22565fi
22566
22567: Finish up by extracting the .SH files
22568case "$alldone" in
22569exit)
22570 $rm -rf UU
24ccb310 22571 echo "Extraction done."
5f80c64f
JH
22572 exit 0
22573 ;;
22574cont)
22575 ;;
22576'')
22577 dflt=''
22578 nostick=true
22579 $cat <<EOM
22580
22581If you'd like to make any changes to the config.sh file before I begin
22582to configure things, do it as a shell escape now (e.g. !vi config.sh).
22583
22584EOM
22585 rp="Press return or use a shell escape to edit config.sh:"
22586 . UU/myread
22587 nostick=''
22588 case "$ans" in
22589 '') ;;
22590 *) : in case they cannot read
22591 sh 1>&4 -c "$ans";;
22592 esac
22593 ;;
22594esac
22595
22596: if this fails, just run all the .SH files by hand
22597. ./config.sh
22598
22599echo " "
22600exec 1>&4
a43e8593 22601pwd=`pwd`
5f80c64f 22602. ./UU/extract
6904989c 22603cd "$pwd"
5f80c64f
JH
22604
22605if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22606 dflt=y
22607 case "$silent" in
22608 true) ;;
22609 *)
22610 $cat <<EOM
22611
22612Now you need to generate make dependencies by running "$make depend".
22613You might prefer to run it in background: "$make depend > makedepend.out &"
22614It can take a while, so you might not want to run it right now.
22615
22616EOM
22617 ;;
22618 esac
22619 rp="Run $make depend now?"
22620 . UU/myread
22621 case "$ans" in
22622 y*)
3d5d58b1 22623 $make depend && echo "Now you must run '$make'."
5f80c64f
JH
22624 ;;
22625 *)
22626 echo "You must run '$make depend' then '$make'."
22627 ;;
22628 esac
22629elif test -f [Mm]akefile; then
22630 echo " "
22631 echo "Now you must run a $make."
22632else
24ccb310 22633 echo "Configure done."
5f80c64f
JH
22634fi
22635
22636if $test -f Policy.sh; then
22637 $cat <<EOM
22638
22639If you compile $package on a different machine or from a different object
22640directory, copy the Policy.sh file from this object directory to the
22641new one before you run Configure -- this will help you with most of
22642the policy defaults.
22643
22644EOM
22645fi
22646if $test -f config.msg; then
22647 echo "Hmm. I also noted the following information while running:"
22648 echo " "
22649 $cat config.msg >&4
22650 $rm -f config.msg
22651fi
22652$rm -f kit*isdone ark*isdone
22653$rm -rf UU
22654
22655: End of Configure
22656