]> git.ipfire.org Git - thirdparty/bash.git/blame - configure.in
Bash-4.1 distribution source
[thirdparty/bash.git] / configure.in
CommitLineData
ccc6cda3 1dnl
0001803f 2dnl Configure script for bash-4.1
ccc6cda3
JA
3dnl
4dnl report bugs to chet@po.cwru.edu
5dnl
6dnl Process this file with autoconf to produce a configure script.
d166f048 7
3185942a 8# Copyright (C) 1987-2009 Free Software Foundation, Inc.
f73dda09 9
3185942a
JA
10#
11# This program is free software: you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation, either version 3 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program. If not, see <http://www.gnu.org/licenses/>.
ccc6cda3 23
0001803f 24AC_REVISION([for Bash 4.1, version 4.019])dnl
f73dda09 25
0001803f 26define(bashvers, 4.1)
17345e5a 27define(relstatus, release)
b80f6443 28
0628567a 29AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
ccc6cda3
JA
30
31dnl make sure we are using a recent autoconf version
f73dda09 32AC_PREREQ(2.50)
ccc6cda3 33
f73dda09 34AC_CONFIG_SRCDIR(shell.h)
ccc6cda3
JA
35dnl where to find install.sh, config.sub, and config.guess
36AC_CONFIG_AUX_DIR(./support)
f73dda09
JA
37AC_CONFIG_HEADERS(config.h)
38
39dnl checks for version info
b80f6443
JA
40BASHVERS=bashvers
41RELSTATUS=relstatus
7117c2d2
JA
42
43dnl defaults for debug settings
44case "$RELSTATUS" in
3185942a 45alp*|bet*|dev*|rc*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
7117c2d2
JA
46*) DEBUG= MALLOC_DEBUG= ;;
47esac
ccc6cda3
JA
48
49dnl canonicalize the host and os so we can do some tricky things before
50dnl parsing options
51AC_CANONICAL_HOST
52
53dnl configure defaults
bb70624e 54opt_bash_malloc=yes
ccc6cda3 55opt_purify=no
d166f048 56opt_purecov=no
ccc6cda3 57opt_afs=no
d166f048 58opt_curses=no
b72432fd 59opt_with_installed_readline=no
ccc6cda3 60
bb70624e
JA
61#htmldir=
62
28ef6c31 63dnl some systems should be configured without the bash malloc by default
ccc6cda3
JA
64dnl and some need a special compiler or loader
65dnl look in the NOTES file for more
66case "${host_cpu}-${host_os}" in
bb70624e 67alpha*-*) opt_bash_malloc=no ;; # alpha running osf/1 or linux
28ef6c31 68*[[Cc]]ray*-*) opt_bash_malloc=no ;; # Crays
bb70624e
JA
69*-osf1*) opt_bash_malloc=no ;; # other osf/1 machines
70sparc-svr4*) opt_bash_malloc=no ;; # sparc SVR4, SVR4.2
71sparc-netbsd*) opt_bash_malloc=no ;; # needs 8-byte alignment
72mips-irix6*) opt_bash_malloc=no ;; # needs 8-byte alignment
73m68k-sysv) opt_bash_malloc=no ;; # fixes file descriptor leak in closedir
74sparc-linux*) opt_bash_malloc=no ;; # sparc running linux; requires ELF
95732b49 75#*-freebsd*-gnu) opt_bash_malloc=no ;; # there's some undetermined problem here
7117c2d2 76#*-freebsd*) opt_bash_malloc=no ;; # they claim it's better; I disagree
f73dda09 77*-openbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
bb70624e
JA
78*-aix*) opt_bash_malloc=no ;; # AIX machines
79*-nextstep*) opt_bash_malloc=no ;; # NeXT machines running NeXTstep
28ef6c31
JA
80*-macos*) opt_bash_malloc=no ;; # Apple MacOS X
81*-rhapsody*) opt_bash_malloc=no ;; # Apple Rhapsody (MacOS X)
82*-darwin*) opt_bash_malloc=no ;; # Apple Darwin (MacOS X)
bb70624e 83*-dgux*) opt_bash_malloc=no ;; # DG/UX machines
95732b49 84*-qnx*) opt_bash_malloc=no ;; # QNX 4.2, QNX 6.x
bb70624e
JA
85*-machten4) opt_bash_malloc=no ;; # MachTen 4.x
86*-bsdi2.1|*-bsdi3.?) opt_bash_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
87*-beos*) opt_bash_malloc=no ;; # they say it's suitable
28ef6c31
JA
88*-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
89*-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft
ccc6cda3
JA
90esac
91
7117c2d2
JA
92# memory scrambling on free()
93case "${host_os}" in
94sco3.2v5*|sco3.2v4*) opt_memscramble=no ;;
95*) opt_memscramble=yes ;;
96esac
97
b80f6443
JA
98dnl
99dnl macros for the bash debugger
100dnl
101AM_PATH_LISPDIR
102AC_ARG_VAR(DEBUGGER_START_FILE, [location of bash debugger initialization file])
103
ccc6cda3
JA
104dnl arguments to configure
105dnl packages
7117c2d2
JA
106AC_ARG_WITH(afs, AC_HELP_STRING([--with-afs], [if you are running AFS]), opt_afs=$withval)
107AC_ARG_WITH(bash-malloc, AC_HELP_STRING([--with-bash-malloc], [use the Bash version of malloc]), opt_bash_malloc=$withval)
108AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
109AC_ARG_WITH(gnu-malloc, AC_HELP_STRING([--with-gnu-malloc], [synonym for --with-bash-malloc]), opt_bash_malloc=$withval)
110AC_ARG_WITH(installed-readline, AC_HELP_STRING([--with-installed-readline], [use a version of the readline library that is already installed]), opt_with_installed_readline=$withval)
111AC_ARG_WITH(purecov, AC_HELP_STRING([--with-purecov], [configure to postprocess with pure coverage]), opt_purecov=$withval)
112AC_ARG_WITH(purify, AC_HELP_STRING([--with-purify], [configure to postprocess with purify]), opt_purify=$withval)
ccc6cda3 113
f73dda09 114if test "$opt_bash_malloc" = yes; then
d166f048
JA
115 MALLOC_TARGET=malloc
116 MALLOC_SRC=malloc.c
f73dda09
JA
117
118 MALLOC_LIB='-lmalloc'
119 MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
120 MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
121 MALLOC_DEP='$(MALLOC_LIBRARY)'
122
bb70624e 123 AC_DEFINE(USING_BASH_MALLOC)
ccc6cda3 124else
f73dda09
JA
125 MALLOC_LIB=
126 MALLOC_LIBRARY=
127 MALLOC_LDFLAGS=
128 MALLOC_DEP=
ccc6cda3
JA
129fi
130
131if test "$opt_purify" = yes; then
d166f048 132 PURIFY="purify "
7117c2d2 133 AC_DEFINE(DISABLE_MALLOC_WRAPPERS)
ccc6cda3
JA
134else
135 PURIFY=
136fi
137
d166f048
JA
138if test "$opt_purecov" = yes; then
139 PURIFY="${PURIFY}purecov"
140fi
141
ccc6cda3
JA
142if test "$opt_afs" = yes; then
143 AC_DEFINE(AFS)
144fi
145
d166f048
JA
146if test "$opt_curses" = yes; then
147 prefer_curses=yes
148fi
149
b80f6443 150if test -z "${DEBUGGER_START_FILE}"; then
3185942a 151 DEBUGGER_START_FILE='${datadir}/bashdb/bashdb-main.inc'
b80f6443
JA
152fi
153
ccc6cda3
JA
154dnl optional shell features in config.h.in
155opt_minimal_config=no
156
157opt_job_control=yes
158opt_alias=yes
159opt_readline=yes
160opt_history=yes
161opt_bang_history=yes
162opt_dirstack=yes
163opt_restricted=yes
164opt_process_subst=yes
165opt_prompt_decoding=yes
166opt_select=yes
167opt_help=yes
168opt_array_variables=yes
169opt_dparen_arith=yes
cce855bc 170opt_extended_glob=yes
ccc6cda3
JA
171opt_brace_expansion=yes
172opt_disabled_builtins=no
173opt_command_timing=yes
bb70624e 174opt_xpg_echo=no
95732b49 175opt_strict_posix=no
cce855bc 176opt_cond_command=yes
b80f6443 177opt_cond_regexp=yes
3185942a 178opt_coproc=yes
bb70624e
JA
179opt_arith_for_command=yes
180opt_net_redirs=yes
181opt_progcomp=yes
7117c2d2 182opt_separate_help=no
b80f6443
JA
183opt_multibyte=yes
184opt_debugger=yes
95732b49 185opt_single_longdoc_strings=yes
3185942a
JA
186opt_casemod_attrs=yes
187opt_casemod_expansions=yes
0001803f 188opt_extglob_default=no
cce855bc
JA
189
190dnl options that affect how bash is compiled and linked
191opt_static_link=no
192opt_profiling=no
ccc6cda3
JA
193
194dnl argument parsing for optional features
7117c2d2 195AC_ARG_ENABLE(minimal-config, AC_HELP_STRING([--enable-minimal-config], [a minimal sh-like configuration]), opt_minimal_config=$enableval)
ccc6cda3
JA
196
197dnl a minimal configuration turns everything off, but features can be
198dnl added individually
199if test $opt_minimal_config = yes; then
200 opt_job_control=no opt_alias=no opt_readline=no
201 opt_history=no opt_bang_history=no opt_dirstack=no
202 opt_restricted=no opt_process_subst=no opt_prompt_decoding=no
203 opt_select=no opt_help=no opt_array_variables=no opt_dparen_arith=no
204 opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
bb70624e 205 opt_extended_glob=no opt_cond_command=no opt_arith_for_command=no
7117c2d2 206 opt_net_redirs=no opt_progcomp=no opt_separate_help=no
3185942a 207 opt_multibyte=yes opt_cond_regexp=no opt_coproc=no
0001803f 208 opt_casemod_attrs=no opt_casemod_expansions=no opt_extglob_default=no
7117c2d2
JA
209fi
210
211AC_ARG_ENABLE(alias, AC_HELP_STRING([--enable-alias], [enable shell aliases]), opt_alias=$enableval)
212AC_ARG_ENABLE(arith-for-command, AC_HELP_STRING([--enable-arith-for-command], [enable arithmetic for command]), opt_arith_for_command=$enableval)
213AC_ARG_ENABLE(array-variables, AC_HELP_STRING([--enable-array-variables], [include shell array variables]), opt_array_variables=$enableval)
214AC_ARG_ENABLE(bang-history, AC_HELP_STRING([--enable-bang-history], [turn on csh-style history substitution]), opt_bang_history=$enableval)
215AC_ARG_ENABLE(brace-expansion, AC_HELP_STRING([--enable-brace-expansion], [include brace expansion]), opt_brace_expansion=$enableval)
3185942a
JA
216AC_ARG_ENABLE(casemod-attributes, AC_HELP_STRING([--enable-casemod-attributes], [include case-modifying variable attributes]), opt_casemod_attrs=$enableval)
217AC_ARG_ENABLE(casemod-expansions, AC_HELP_STRING([--enable-casemod-expansions], [include case-modifying word expansions]), opt_casemod_expansions=$enableval)
7117c2d2
JA
218AC_ARG_ENABLE(command-timing, AC_HELP_STRING([--enable-command-timing], [enable the time reserved word and command timing]), opt_command_timing=$enableval)
219AC_ARG_ENABLE(cond-command, AC_HELP_STRING([--enable-cond-command], [enable the conditional command]), opt_cond_command=$enableval)
3185942a
JA
220AC_ARG_ENABLE(cond-regexp, AC_HELP_STRING([--enable-cond-regexp], [enable extended regular expression matching in conditional commands]), opt_cond_regexp=$enableval)
221AC_ARG_ENABLE(coprocesses, AC_HELP_STRING([--enable-coprocesses], [enable coprocess support and the coproc reserved word]), opt_coproc=$enableval)
b80f6443 222AC_ARG_ENABLE(debugger, AC_HELP_STRING([--enable-debugger], [enable support for bash debugger]), opt_debugger=$enableval)
7117c2d2
JA
223AC_ARG_ENABLE(directory-stack, AC_HELP_STRING([--enable-directory-stack], [enable builtins pushd/popd/dirs]), opt_dirstack=$enableval)
224AC_ARG_ENABLE(disabled-builtins, AC_HELP_STRING([--enable-disabled-builtins], [allow disabled builtins to still be invoked]), opt_disabled_builtins=$enableval)
225AC_ARG_ENABLE(dparen-arithmetic, AC_HELP_STRING([--enable-dparen-arithmetic], [include ((...)) command]), opt_dparen_arith=$enableval)
226AC_ARG_ENABLE(extended-glob, AC_HELP_STRING([--enable-extended-glob], [include ksh-style extended pattern matching]), opt_extended_glob=$enableval)
0001803f 227AC_ARG_ENABLE(extended-glob-default, AC_HELP_STRING([--enable-extended-glob-default], [force extended pattern matching to be enabled by default]), opt_extglob_default=$enableval)
7117c2d2
JA
228AC_ARG_ENABLE(help-builtin, AC_HELP_STRING([--enable-help-builtin], [include the help builtin]), opt_help=$enableval)
229AC_ARG_ENABLE(history, AC_HELP_STRING([--enable-history], [turn on command history]), opt_history=$enableval)
230AC_ARG_ENABLE(job-control, AC_HELP_STRING([--enable-job-control], [enable job control features]), opt_job_control=$enableval)
b80f6443 231AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
7117c2d2
JA
232AC_ARG_ENABLE(net-redirections, AC_HELP_STRING([--enable-net-redirections], [enable /dev/tcp/host/port redirection]), opt_net_redirs=$enableval)
233AC_ARG_ENABLE(process-substitution, AC_HELP_STRING([--enable-process-substitution], [enable process substitution]), opt_process_subst=$enableval)
234AC_ARG_ENABLE(progcomp, AC_HELP_STRING([--enable-progcomp], [enable programmable completion and the complete builtin]), opt_progcomp=$enableval)
235AC_ARG_ENABLE(prompt-string-decoding, AC_HELP_STRING([--enable-prompt-string-decoding], [turn on escape character decoding in prompts]), opt_prompt_decoding=$enableval)
236AC_ARG_ENABLE(readline, AC_HELP_STRING([--enable-readline], [turn on command line editing]), opt_readline=$enableval)
237AC_ARG_ENABLE(restricted, AC_HELP_STRING([--enable-restricted], [enable a restricted shell]), opt_restricted=$enableval)
238AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select], [include select command]), opt_select=$enableval)
239AC_ARG_ENABLE(separate-helpfiles, AC_HELP_STRING([--enable-separate-helpfiles], [use external files for help builtin documentation]), opt_separate_help=$enableval)
95732b49
JA
240AC_ARG_ENABLE(single-help-strings, AC_HELP_STRING([--enable-single-help-strings], [store help documentation as a single string to ease translation]), opt_single_longdoc_strings=$enableval)
241AC_ARG_ENABLE(strict-posix-default, AC_HELP_STRING([--enable-strict-posix-default], [configure bash to be posix-conformant by default]), opt_strict_posix=$enableval)
7117c2d2
JA
242AC_ARG_ENABLE(usg-echo-default, AC_HELP_STRING([--enable-usg-echo-default], [a synonym for --enable-xpg-echo-default]), opt_xpg_echo=$enableval)
243AC_ARG_ENABLE(xpg-echo-default, AC_HELP_STRING([--enable-xpg-echo-default], [make the echo builtin expand escape sequences by default]), opt_xpg_echo=$enableval)
ccc6cda3 244
cce855bc 245dnl options that alter how bash is compiled and linked
7117c2d2
JA
246AC_ARG_ENABLE(mem-scramble, AC_HELP_STRING([--enable-mem-scramble], [scramble memory on calls to malloc and free]), opt_memscramble=$enableval)
247AC_ARG_ENABLE(profiling, AC_HELP_STRING([--enable-profiling], [allow profiling with gprof]), opt_profiling=$enableval)
248AC_ARG_ENABLE(static-link, AC_HELP_STRING([--enable-static-link], [link bash statically, for use as a root shell]), opt_static_link=$enableval)
cce855bc 249
ccc6cda3
JA
250dnl opt_job_control is handled later, after BASH_JOB_CONTROL_MISSING runs
251
b72432fd
JA
252dnl opt_readline and opt_history are handled later, because AC_PROG_CC needs
253dnl to be run before we can check the version of an already-installed readline
254dnl library
255
ccc6cda3
JA
256if test $opt_alias = yes; then
257AC_DEFINE(ALIAS)
258fi
ccc6cda3
JA
259if test $opt_dirstack = yes; then
260AC_DEFINE(PUSHD_AND_POPD)
261fi
262if test $opt_restricted = yes; then
263AC_DEFINE(RESTRICTED_SHELL)
264fi
265if test $opt_process_subst = yes; then
266AC_DEFINE(PROCESS_SUBSTITUTION)
267fi
268if test $opt_prompt_decoding = yes; then
269AC_DEFINE(PROMPT_STRING_DECODE)
270fi
271if test $opt_select = yes; then
272AC_DEFINE(SELECT_COMMAND)
273fi
274if test $opt_help = yes; then
275AC_DEFINE(HELP_BUILTIN)
276fi
277if test $opt_array_variables = yes; then
278AC_DEFINE(ARRAY_VARS)
279fi
280if test $opt_dparen_arith = yes; then
281AC_DEFINE(DPAREN_ARITHMETIC)
282fi
283if test $opt_brace_expansion = yes; then
284AC_DEFINE(BRACE_EXPANSION)
285fi
286if test $opt_disabled_builtins = yes; then
287AC_DEFINE(DISABLED_BUILTINS)
288fi
289if test $opt_command_timing = yes; then
290AC_DEFINE(COMMAND_TIMING)
291fi
bb70624e
JA
292if test $opt_xpg_echo = yes ; then
293AC_DEFINE(DEFAULT_ECHO_TO_XPG)
ccc6cda3 294fi
95732b49
JA
295if test $opt_strict_posix = yes; then
296AC_DEFINE(STRICT_POSIX)
297fi
cce855bc
JA
298if test $opt_extended_glob = yes ; then
299AC_DEFINE(EXTENDED_GLOB)
300fi
0001803f
CR
301if test $opt_extglob_default = yes; then
302AC_DEFINE(EXTGLOB_DEFAULT, 1)
303else
304AC_DEFINE(EXTGLOB_DEFAULT, 0)
305fi
cce855bc
JA
306if test $opt_cond_command = yes ; then
307AC_DEFINE(COND_COMMAND)
308fi
b80f6443
JA
309if test $opt_cond_regexp = yes ; then
310AC_DEFINE(COND_REGEXP)
311fi
3185942a
JA
312if test $opt_coproc = yes; then
313AC_DEFINE(COPROCESS_SUPPORT)
314fi
bb70624e
JA
315if test $opt_arith_for_command = yes; then
316AC_DEFINE(ARITH_FOR_COMMAND)
317fi
318if test $opt_net_redirs = yes; then
319AC_DEFINE(NETWORK_REDIRECTIONS)
320fi
321if test $opt_progcomp = yes; then
322AC_DEFINE(PROGRAMMABLE_COMPLETION)
323fi
b80f6443
JA
324if test $opt_multibyte = no; then
325AC_DEFINE(NO_MULTIBYTE_SUPPORT)
326fi
327if test $opt_debugger = yes; then
328AC_DEFINE(DEBUGGER)
329fi
3185942a
JA
330if test $opt_casemod_attrs = yes; then
331AC_DEFINE(CASEMOD_ATTRS)
332fi
333if test $opt_casemod_expansions = yes; then
334AC_DEFINE(CASEMOD_EXPANSIONS)
335fi
ccc6cda3 336
7117c2d2
JA
337if test $opt_memscramble = yes; then
338AC_DEFINE(MEMSCRAMBLE)
339fi
340
d166f048
JA
341if test "$opt_minimal_config" = yes; then
342 TESTSCRIPT=run-minimal
343else
344 TESTSCRIPT=run-all
345fi
346
7117c2d2
JA
347HELPDIR= HELPDIRDEFINE= HELPINSTALL=
348if test "$opt_separate_help" != no; then
349 if test "$opt_separate_help" = "yes" ; then
350 HELPDIR='${datadir}/bash'
351 else
352 HELPDIR=$opt_separate_help
353 fi
354 HELPDIRDEFINE='-H ${HELPDIR}'
355 HELPINSTALL='install-help'
356fi
95732b49
JA
357HELPSTRINGS=
358if test "$opt_single_longdoc_strings" != "yes"; then
359 HELPSTRINGS='-S'
360fi
7117c2d2 361
ccc6cda3 362dnl now substitute in the values generated by arguments
d166f048 363AC_SUBST(TESTSCRIPT)
ccc6cda3 364AC_SUBST(PURIFY)
d166f048 365AC_SUBST(MALLOC_TARGET)
ccc6cda3 366AC_SUBST(MALLOC_SRC)
ccc6cda3 367
f73dda09
JA
368AC_SUBST(MALLOC_LIB)
369AC_SUBST(MALLOC_LIBRARY)
370AC_SUBST(MALLOC_LDFLAGS)
371AC_SUBST(MALLOC_DEP)
bb70624e 372
f73dda09 373AC_SUBST(htmldir)
d166f048 374
7117c2d2
JA
375AC_SUBST(HELPDIR)
376AC_SUBST(HELPDIRDEFINE)
377AC_SUBST(HELPINSTALL)
95732b49 378AC_SUBST(HELPSTRINGS)
7117c2d2 379
f73dda09 380echo ""
7117c2d2 381echo "Beginning configuration for bash-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}"
f73dda09 382echo ""
ccc6cda3
JA
383
384dnl compilation checks
cce855bc
JA
385dnl AC_PROG_CC sets $cross_compiling to `yes' if cross-compiling for a
386dnl different environment
ccc6cda3 387AC_PROG_CC
bb70624e
JA
388
389dnl test for Unix variants
ccc6cda3
JA
390AC_ISC_POSIX
391AC_MINIX
392
f73dda09 393AC_SYS_LARGEFILE
bb70624e 394
95732b49
JA
395dnl BEGIN changes for cross-building (currently cygwin, minGW, and
396dnl (obsolete) BeOS)
b72432fd 397
0628567a 398SIGNAMES_O=
b72432fd 399SIGNAMES_H=lsignames.h
cce855bc
JA
400
401dnl load up the cross-building cache file -- add more cases and cache
402dnl files as necessary
b72432fd
JA
403
404dnl Note that host and target machine are the same, and different than the
405dnl build machine.
406dnl Set SIGNAMES_H based on whether or not we're cross-compiling.
407
0628567a 408CROSS_COMPILE=
cce855bc
JA
409if test "x$cross_compiling" = "xyes"; then
410 case "${host}" in
28ef6c31 411 *-cygwin*)
cce855bc 412 cross_cache=${srcdir}/cross-build/cygwin32.cache
cce855bc 413 ;;
95732b49
JA
414 *-mingw*)
415 cross_cache=${srcdir}/cross-build/cygwin32.cache
416 ;;
b72432fd
JA
417 i[[3456]]86-*-beos*)
418 cross_cache=${srcdir}/cross-build/x86-beos.cache
b72432fd
JA
419 ;;
420 *) echo "configure: cross-compiling for $host is not supported" >&2
cce855bc
JA
421 ;;
422 esac
b72432fd
JA
423 if test -n "${cross_cache}" && test -r "${cross_cache}"; then
424 echo "loading cross-build cache file ${cross_cache}"
425 . ${cross_cache}
426 fi
427 unset cross_cache
0628567a 428 SIGNAMES_O='signames.o'
95732b49
JA
429 CROSS_COMPILE='-DCROSS_COMPILING'
430 AC_SUBST(CROSS_COMPILE)
cce855bc 431fi
b72432fd 432AC_SUBST(SIGNAMES_H)
0628567a 433AC_SUBST(SIGNAMES_O)
cce855bc
JA
434
435if test -z "$CC_FOR_BUILD"; then
436 if test "x$cross_compiling" = "xno"; then
437 CC_FOR_BUILD='$(CC)'
438 else
439 CC_FOR_BUILD=gcc
440 fi
441fi
442AC_SUBST(CC_FOR_BUILD)
443
b72432fd 444dnl END changes for cross-building
cce855bc 445
ccc6cda3
JA
446dnl We want these before the checks, so the checks can modify their values.
447test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
448
449dnl If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS.
450test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
451
cce855bc
JA
452dnl handle options that alter how bash is compiled and linked
453dnl these must come after the test for cc/gcc
454if test "$opt_profiling" = "yes"; then
455 PROFILE_FLAGS=-pg
b72432fd
JA
456 case "$host_os" in
457 solaris2*) ;;
458 *) opt_static_link=yes ;;
459 esac
7117c2d2 460 DEBUG= MALLOC_DEBUG=
cce855bc
JA
461fi
462
463if test "$opt_static_link" = yes; then
f73dda09 464 # if we're using gcc, add `-static' to LDFLAGS, except on Solaris >= 2
cce855bc 465 if test -n "$GCC" || test "$ac_cv_prog_gcc" = "yes"; then
f73dda09
JA
466 STATIC_LD="-static"
467 case "$host_os" in
468 solaris2*) ;;
469 *) LDFLAGS="$LDFLAGS -static" ;; # XXX experimental
470 esac
cce855bc
JA
471 fi
472fi
473
b80f6443
JA
474if test "X$cross_compiling" = "Xno"; then
475 CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-"$CPPFLAGS"}
476 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-'$(LDFLAGS)'}
477else
478 CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-""}
479 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-""}
480fi
481
7117c2d2
JA
482test -z "$CFLAGS_FOR_BUILD" && CFLAGS_FOR_BUILD="-g"
483
ccc6cda3
JA
484AC_SUBST(CFLAGS)
485AC_SUBST(CPPFLAGS)
486AC_SUBST(LDFLAGS)
b72432fd 487AC_SUBST(STATIC_LD)
ccc6cda3 488
7117c2d2
JA
489AC_SUBST(CFLAGS_FOR_BUILD)
490AC_SUBST(CPPFLAGS_FOR_BUILD)
491AC_SUBST(LDFLAGS_FOR_BUILD)
492
ccc6cda3
JA
493AC_PROG_GCC_TRADITIONAL
494
b72432fd
JA
495dnl BEGIN READLINE and HISTORY LIBRARY SECTION
496dnl prepare to allow bash to be linked against an already-installed readline
497
498dnl first test that the readline version is new enough to link bash against
f73dda09 499if test "$opt_readline" = yes && test "$opt_with_installed_readline" != "no"
b72432fd 500then
f73dda09
JA
501 # If the user specified --with-installed-readline=PREFIX and PREFIX
502 # is not `yes', set ac_cv_rl_prefix to PREFIX
503 test $opt_with_installed_readline != "yes" && ac_cv_rl_prefix=$opt_with_installed_readline
b72432fd 504
f73dda09 505 RL_LIB_READLINE_VERSION
b72432fd 506
f73dda09 507 case "$ac_cv_rl_version" in
b80f6443 508 5*|6*|7*|8*|9*) ;;
b72432fd 509 *) opt_with_installed_readline=no
0001803f
CR
510 AC_MSG_WARN([installed readline library is too old to be linked with bash])
511 AC_MSG_WARN([using private bash version])
b72432fd
JA
512 ;;
513 esac
b72432fd
JA
514fi
515
95732b49 516TILDE_LIB=-ltilde
b72432fd
JA
517if test $opt_readline = yes; then
518 AC_DEFINE(READLINE)
f73dda09 519 if test "$opt_with_installed_readline" != "no" ; then
b80f6443
JA
520 case "$opt_with_installed_readline" in
521 yes) RL_INCLUDE= ;;
522 *) case "$RL_INCLUDEDIR" in
523 /usr/include) ;;
524 *) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;;
525 esac
526 ;;
f73dda09 527 esac
b72432fd 528 READLINE_DEP=
95732b49
JA
529 READLINE_LIB=-lreadline
530 # section for OS versions that don't allow unresolved symbols
531 # to be compiled into dynamic libraries.
532 case "$host_os" in
533 cygwin*) TILDE_LIB= ;;
534 esac
b72432fd
JA
535 else
536 RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
537 READLINE_DEP='$(READLINE_LIBRARY)'
95732b49
JA
538 # section for OS versions that ship an older/broken version of
539 # readline as a standard dynamic library and don't allow a
540 # static version specified as -llibname to override the
541 # dynamic version
542 case "${host_os}" in
89a92869 543 darwin[[89]]*|darwin10*) READLINE_LIB='${READLINE_LIBRARY}' ;;
95732b49
JA
544 *) READLINE_LIB=-lreadline ;;
545 esac
b72432fd
JA
546 fi
547else
548 RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
549 READLINE_LIB= READLINE_DEP=
550fi
551if test $opt_history = yes || test $opt_bang_history = yes; then
552 if test $opt_history = yes; then
553 AC_DEFINE(HISTORY)
554 fi
555 if test $opt_bang_history = yes; then
556 AC_DEFINE(BANG_HISTORY)
557 fi
f73dda09
JA
558 if test "$opt_with_installed_readline" != "no"; then
559 HIST_LIBDIR=$RL_LIBDIR
b72432fd 560 HISTORY_DEP=
95732b49 561 HISTORY_LIB=-lhistory
b80f6443
JA
562 case "$opt_with_installed_readline" in
563 yes) RL_INCLUDE= ;;
564 *) case "$RL_INCLUDEDIR" in
565 /usr/include) ;;
566 *) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;;
567 esac
568 ;;
f73dda09 569 esac
b72432fd
JA
570 else
571 HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
572 HISTORY_DEP='$(HISTORY_LIBRARY)'
95732b49
JA
573 # section for OS versions that ship an older version of
574 # readline as a standard dynamic library and don't allow a
575 # static version specified as -llibname to override the
576 # dynamic version
577 case "${host_os}" in
89a92869 578 darwin[[89]]*|darwin10*) HISTORY_LIB='${HISTORY_LIBRARY}' ;;
95732b49
JA
579 *) HISTORY_LIB=-lhistory ;;
580 esac
b72432fd
JA
581 fi
582else
583 HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
584 HISTORY_LIB= HISTORY_DEP=
585fi
586AC_SUBST(READLINE_LIB)
587AC_SUBST(READLINE_DEP)
588AC_SUBST(RL_LIBDIR)
f73dda09 589AC_SUBST(RL_INCLUDEDIR)
b72432fd
JA
590AC_SUBST(RL_INCLUDE)
591AC_SUBST(HISTORY_LIB)
592AC_SUBST(HISTORY_DEP)
593AC_SUBST(HIST_LIBDIR)
95732b49 594AC_SUBST(TILDE_LIB)
b72432fd
JA
595
596dnl END READLINE and HISTORY LIBRARY SECTION
597
ccc6cda3
JA
598dnl programs needed by the build and install process
599AC_PROG_INSTALL
f73dda09 600AC_CHECK_PROG(AR, ar, , ar)
b72432fd
JA
601dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
602dnl This allows people to set it when running configure or make
603test -n "$ARFLAGS" || ARFLAGS="cr"
ccc6cda3
JA
604AC_PROG_RANLIB
605AC_PROG_YACC
606AC_PROG_MAKE_SET
607
b72432fd 608case "$host_os" in
bb70624e 609opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
b72432fd
JA
610*) MAKE_SHELL=/bin/sh ;;
611esac
612AC_SUBST(MAKE_SHELL)
613
95732b49
JA
614dnl this is similar to the expanded AC_PROG_RANLIB
615if test x$SIZE = x; then
616 if test x$ac_tool_prefix = x; then
617 SIZE=size
618 else
619 SIZE=${ac_tool_prefix}size
620 save_IFS=$IFS ; IFS=:
621 size_found=0
622 for dir in $PATH; do
623 if test -x $dir/$SIZE ; then
624 size_found=1
625 break
626 fi
627 done
628 if test $size_found -eq 0; then
629 SIZE=:
630 fi
631 IFS=$save_IFS
632 fi
633fi
634AC_SUBST(SIZE)
635
f73dda09
JA
636dnl Turn on any extensions available in the GNU C library.
637AC_DEFINE(_GNU_SOURCE, 1)
638
639dnl C compiler characteristics
640AC_C_CONST
641AC_C_INLINE
642AC_C_BIGENDIAN
643AC_C_STRINGIZE
644AC_C_LONG_DOUBLE
645AC_C_PROTOTYPES
646AC_C_CHAR_UNSIGNED
17345e5a
JA
647AC_C_VOLATILE
648AC_C_RESTRICT
f73dda09 649
b80f6443
JA
650dnl initialize GNU gettext
651AM_GNU_GETTEXT([no-libtool], [need-ngettext], [lib/intl])
652
f73dda09
JA
653dnl header files
654AC_HEADER_DIRENT
655AC_HEADER_TIME
656
657BASH_HEADER_INTTYPES
658
659AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
660 memory.h locale.h termcap.h termio.h termios.h dlfcn.h \
0001803f
CR
661 stddef.h stdint.h netdb.h pwd.h grp.h strings.h regex.h \
662 syslog.h)
95732b49 663AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h \
b80f6443
JA
664 sys/resource.h sys/param.h sys/socket.h sys/stat.h \
665 sys/time.h sys/times.h sys/types.h sys/wait.h)
f73dda09
JA
666AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)
667
95732b49
JA
668dnl sys/ptem.h requires definitions from sys/stream.h on systems where it
669dnl exists
670AC_CHECK_HEADER(sys/ptem.h, , ,[[
671#if HAVE_SYS_STREAM_H
672# include <sys/stream.h>
673#endif
674]])
675
ccc6cda3
JA
676dnl special checks for libc functions
677AC_FUNC_ALLOCA
678AC_FUNC_GETPGRP
679AC_FUNC_SETVBUF_REVERSED
680AC_FUNC_VPRINTF
ccc6cda3
JA
681AC_FUNC_STRCOLL
682
f73dda09
JA
683dnl if we're not using the bash malloc but require the C alloca, set things
684dnl up to build a libmalloc.a containing only alloca.o
685
686if test "$ac_cv_func_alloca_works" = "no" && test "$opt_bash_malloc" = "no"; then
687 MALLOC_TARGET=alloca
688 MALLOC_SRC=alloca.c
689
690 MALLOC_LIB='-lmalloc'
691 MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
692 MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
693 MALLOC_DEP='$(MALLOC_LIBRARY)'
694fi
695
ccc6cda3
JA
696dnl if vprintf is not in libc, see if it's defined in stdio.h
697if test "$ac_cv_func_vprintf" = no; then
698 AC_MSG_CHECKING(for declaration of vprintf in stdio.h)
699 AC_EGREP_HEADER([[int[ ]*vprintf[^a-zA-Z0-9]]],stdio.h,ac_cv_func_vprintf=yes)
700 AC_MSG_RESULT($ac_cv_func_vprintf)
701 if test $ac_cv_func_vprintf = yes; then
702 AC_DEFINE(HAVE_VPRINTF)
703 fi
704fi
705
f73dda09
JA
706if test "$ac_cv_func_vprintf" = no && test "$ac_cv_func__doprnt" = "yes"; then
707 AC_LIBOBJ(vprint)
708fi
709
ccc6cda3 710dnl signal stuff
f73dda09 711AC_TYPE_SIGNAL
ccc6cda3
JA
712
713dnl checks for certain version-specific system calls and libc functions
714AC_CHECK_FUNC(__setostype, AC_DEFINE(HAVE_SETOSTYPE))
715AC_CHECK_FUNC(wait3, AC_DEFINE(HAVE_WAIT3))
7117c2d2 716AC_CHECK_FUNC(isinf, AC_DEFINE(HAVE_ISINF_IN_LIBC))
0628567a 717AC_CHECK_FUNC(isnan, AC_DEFINE(HAVE_ISNAN_IN_LIBC))
ccc6cda3
JA
718
719dnl checks for missing libc functions
720AC_CHECK_FUNC(mkfifo,AC_DEFINE(HAVE_MKFIFO),AC_DEFINE(MKFIFO_MISSING))
721
722dnl checks for system calls
0628567a
JA
723AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getgroups gethostname \
724 getpagesize getpeername getrlimit getrusage gettimeofday \
725 kill killpg lstat readlink sbrk select setdtablesize \
3185942a 726 setitimer tcgetpgrp uname ulimit waitpid)
f73dda09 727AC_REPLACE_FUNCS(rename)
ccc6cda3
JA
728
729dnl checks for c library functions
95732b49 730AC_CHECK_FUNCS(bcopy bzero confstr fnmatch \
7117c2d2 731 getaddrinfo gethostbyname getservbyname getservent inet_aton \
95732b49
JA
732 memmove pathconf putenv raise regcomp regexec \
733 setenv setlinebuf setlocale setvbuf siginterrupt strchr \
0001803f 734 sysconf syslog tcgetattr times ttyname tzset unsetenv)
95732b49 735
0001803f 736AC_CHECK_FUNCS(vasprintf asprintf)
f73dda09 737AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
95732b49 738AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
0001803f
CR
739AC_REPLACE_FUNCS(getcwd memset)
740AC_REPLACE_FUNCS(strcasecmp strcasestr strerror strftime strnlen strpbrk strstr)
7117c2d2 741AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoimax strtoumax)
3185942a 742AC_REPLACE_FUNCS(fdprintf)
f73dda09 743
f73dda09 744AC_CHECK_DECLS([confstr])
f73dda09 745AC_CHECK_DECLS([printf])
7117c2d2 746AC_CHECK_DECLS([sbrk])
0628567a 747AC_CHECK_DECLS([setregid])
7117c2d2 748AC_CHECK_DECLS([strcpy])
f73dda09 749AC_CHECK_DECLS([strsignal])
b80f6443
JA
750
751dnl Extra test to detect the horribly broken HP/UX 11.00 strtold(3)
752AC_CHECK_DECLS([strtold], [
753 AC_MSG_CHECKING([for broken strtold])
754 AC_CACHE_VAL(bash_cv_strtold_broken,
755 [AC_TRY_COMPILE(
756 [#include <stdlib.h>],
757 [int main() { long double r; char *foo, bar; r = strtold(foo, &bar);}],
758 bash_cv_strtold_broken=no, bash_cv_strtold_broken=yes,
759 [AC_MSG_WARN(cannot check for broken strtold if cross-compiling, defaulting to no)])
760 ]
761 )
762 AC_MSG_RESULT($bash_cv_strtold_broken)
763 if test "$bash_cv_strtold_broken" = "yes" ; then
764 AC_DEFINE(STRTOLD_BROKEN)
765 fi
766])
767
f73dda09
JA
768
769BASH_CHECK_DECL(strtoimax)
770BASH_CHECK_DECL(strtol)
771BASH_CHECK_DECL(strtoll)
772BASH_CHECK_DECL(strtoul)
773BASH_CHECK_DECL(strtoull)
774BASH_CHECK_DECL(strtoumax)
ccc6cda3 775
7117c2d2
JA
776AC_FUNC_MKTIME
777
b80f6443
JA
778dnl
779dnl Checks for lib/intl and related code (uses some of the output from
780dnl AM_GNU_GETTEXT)
781dnl
ccc6cda3 782
b80f6443
JA
783AC_CHECK_HEADERS([argz.h errno.h fcntl.h malloc.h stdio_ext.h])
784
785dnl AC_FUNC_MALLOC
786AC_FUNC_MMAP
787AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify dcgettext mempcpy \
788 munmap stpcpy strcspn strdup])
789
790INTL_DEP= INTL_INC= LIBINTL_H=
791if test "x$USE_INCLUDED_LIBINTL" = "xyes"; then
792 INTL_DEP='${INTL_LIBDIR}/libintl.a'
793 INTL_INC='-I${INTL_LIBSRC} -I${INTL_BUILDDIR}'
794 LIBINTL_H='${INTL_BUILDDIR}/libintl.h'
ccc6cda3 795fi
b80f6443
JA
796AC_SUBST(INTL_DEP)
797AC_SUBST(INTL_INC)
798AC_SUBST(LIBINTL_H)
799
800dnl
801dnl End of checks needed by files in lib/intl
802dnl
ccc6cda3 803
7117c2d2
JA
804BASH_CHECK_MULTIBYTE
805
ccc6cda3 806dnl checks for the dynamic loading library functions in libc and libdl
cce855bc 807if test "$opt_static_link" != yes; then
ccc6cda3
JA
808AC_CHECK_LIB(dl, dlopen)
809AC_CHECK_FUNCS(dlopen dlclose dlsym)
cce855bc 810fi
ccc6cda3 811
3185942a 812dnl this defines HAVE_DECL_SYS_SIGLIST
ccc6cda3
JA
813AC_DECL_SYS_SIGLIST
814
bb70624e
JA
815dnl network functions -- check for inet_aton again
816if test "$ac_cv_func_inet_aton" != 'yes'; then
817BASH_FUNC_INET_ATON
818fi
ccc6cda3
JA
819
820dnl libraries
821dnl this is reportedly no longer necessary for irix[56].?
bb70624e
JA
822case "$host_os" in
823irix4*) AC_CHECK_LIB(sun, getpwent) ;;
824esac
825
d166f048
JA
826dnl check for getpeername in the socket library only if it's not in libc
827if test "$ac_cv_func_getpeername" = no; then
f73dda09 828 BASH_CHECK_LIB_SOCKET
d166f048 829fi
bb70624e
JA
830dnl check for gethostbyname in socket libraries if it's not in libc
831if test "$ac_cv_func_gethostbyname" = no; then
832 BASH_FUNC_GETHOSTBYNAME
833fi
ccc6cda3
JA
834
835dnl system types
836AC_TYPE_GETGROUPS
837AC_TYPE_OFF_T
838AC_TYPE_MODE_T
839AC_TYPE_UID_T
840AC_TYPE_PID_T
841AC_TYPE_SIZE_T
f73dda09 842AC_CHECK_TYPE(ssize_t, int)
ccc6cda3
JA
843AC_CHECK_TYPE(time_t, long)
844
f73dda09
JA
845BASH_TYPE_LONG_LONG
846BASH_TYPE_UNSIGNED_LONG_LONG
847
ccc6cda3 848AC_TYPE_SIGNAL
17345e5a 849BASH_TYPE_SIG_ATOMIC_T
ccc6cda3 850
bb70624e
JA
851AC_CHECK_SIZEOF(char, 1)
852AC_CHECK_SIZEOF(short, 2)
b72432fd
JA
853AC_CHECK_SIZEOF(int, 4)
854AC_CHECK_SIZEOF(long, 4)
855AC_CHECK_SIZEOF(char *, 4)
856AC_CHECK_SIZEOF(double, 8)
f73dda09 857AC_CHECK_SIZEOF([long long], 8)
cce855bc 858
f73dda09
JA
859AC_CHECK_TYPE(u_int, [unsigned int])
860AC_CHECK_TYPE(u_long, [unsigned long])
bb70624e
JA
861
862BASH_TYPE_BITS16_T
863BASH_TYPE_U_BITS16_T
864BASH_TYPE_BITS32_T
865BASH_TYPE_U_BITS32_T
b72432fd 866BASH_TYPE_BITS64_T
cce855bc 867
bb70624e
JA
868BASH_TYPE_PTRDIFF_T
869
ccc6cda3
JA
870dnl structures
871AC_HEADER_STAT
ccc6cda3 872
ccc6cda3
JA
873dnl system services
874AC_SYS_INTERPRETER
875if test $ac_cv_sys_interpreter = yes; then
876AC_DEFINE(HAVE_HASH_BANG_EXEC)
877fi
ccc6cda3
JA
878
879dnl Miscellaneous Bash tests
880if test "$ac_cv_func_lstat" = "no"; then
881BASH_FUNC_LSTAT
882fi
883
d166f048 884dnl behavior of system calls and library functions
b80f6443 885BASH_FUNC_CTYPE_NONASCII
f73dda09
JA
886BASH_FUNC_DUP2_CLOEXEC_CHECK
887BASH_SYS_PGRP_SYNC
888BASH_SYS_SIGNAL_VINTAGE
cce855bc 889
d166f048 890dnl checking for the presence of certain library symbols
ccc6cda3
JA
891BASH_SYS_ERRLIST
892BASH_SYS_SIGLIST
893BASH_UNDER_SYS_SIGLIST
d166f048
JA
894
895dnl various system types
ccc6cda3
JA
896BASH_TYPE_SIGHANDLER
897BASH_CHECK_TYPE(clock_t, [#include <sys/times.h>], long)
898BASH_CHECK_TYPE(sigset_t, [#include <signal.h>], int)
899BASH_CHECK_TYPE(quad_t, , long, HAVE_QUAD_T)
f73dda09
JA
900BASH_CHECK_TYPE(intmax_t, , $bash_cv_type_long_long)
901BASH_CHECK_TYPE(uintmax_t, , $bash_cv_type_unsigned_long_long)
902if test "$ac_cv_header_sys_socket_h" = "yes"; then
903BASH_CHECK_TYPE(socklen_t, [#include <sys/socket.h>], int, HAVE_SOCKLEN_T)
904fi
905BASH_TYPE_RLIMIT
d166f048
JA
906
907dnl presence and contents of structures used by system calls
ccc6cda3
JA
908BASH_STRUCT_TERMIOS_LDISC
909BASH_STRUCT_TERMIO_LDISC
910BASH_STRUCT_DIRENT_D_INO
d166f048 911BASH_STRUCT_DIRENT_D_FILENO
b80f6443 912BASH_STRUCT_DIRENT_D_NAMLEN
d166f048 913BASH_STRUCT_WINSIZE
bb70624e 914BASH_STRUCT_TIMEVAL
f73dda09 915AC_CHECK_MEMBERS([struct stat.st_blocks])
7117c2d2
JA
916AC_STRUCT_TM
917AC_STRUCT_TIMEZONE
b80f6443 918BASH_STRUCT_TIMEZONE
d166f048
JA
919
920dnl presence and behavior of C library functions
ccc6cda3
JA
921BASH_FUNC_STRSIGNAL
922BASH_FUNC_OPENDIR_CHECK
ccc6cda3 923BASH_FUNC_ULIMIT_MAXFDS
3185942a 924BASH_FUNC_FPURGE
ccc6cda3 925BASH_FUNC_GETENV
7117c2d2 926if test "$ac_cv_func_getcwd" = "yes"; then
ccc6cda3 927BASH_FUNC_GETCWD
f73dda09 928fi
ccc6cda3 929BASH_FUNC_POSIX_SETJMP
d166f048 930BASH_FUNC_STRCOLL
0001803f
CR
931BASH_FUNC_SNPRINTF
932BASH_FUNC_VSNPRINTF
d166f048 933
7117c2d2
JA
934dnl If putenv or unsetenv is not present, set the right define so the
935dnl prototype and declaration in lib/sh/getenv.c will be standard-conformant
936
937if test "$ac_cv_func_putenv" = "yes"; then
938BASH_FUNC_STD_PUTENV
939else
940AC_DEFINE(HAVE_STD_PUTENV)
941fi
942if test "$ac_cv_func_unsetenv" = "yes"; then
943BASH_FUNC_STD_UNSETENV
944else
945AC_DEFINE(HAVE_STD_UNSETENV)
946fi
947
f73dda09
JA
948BASH_FUNC_PRINTF_A_FORMAT
949
d166f048 950dnl presence and behavior of OS functions
f73dda09
JA
951BASH_SYS_REINSTALL_SIGHANDLERS
952BASH_SYS_JOB_CONTROL_MISSING
ccc6cda3 953BASH_SYS_NAMED_PIPES
d166f048
JA
954
955dnl presence of certain CPP defines
f73dda09 956AC_HEADER_TIOCGWINSZ
ccc6cda3
JA
957BASH_HAVE_TIOCSTAT
958BASH_HAVE_FIONREAD
d166f048 959
95732b49
JA
960BASH_CHECK_WCONTINUED
961
d166f048 962dnl miscellaneous
f73dda09 963BASH_CHECK_SPEED_T
ccc6cda3 964BASH_CHECK_GETPW_FUNCS
28ef6c31 965BASH_CHECK_RTSIGS
f73dda09 966BASH_CHECK_SYS_SIGLIST
ccc6cda3 967
d166f048 968dnl special checks
ccc6cda3 969case "$host_os" in
f73dda09 970hpux*) BASH_CHECK_KERNEL_RLIMIT ;;
ccc6cda3
JA
971esac
972
973if test "$opt_readline" = yes; then
d166f048
JA
974dnl yuck
975case "$host_os" in
976aix*) prefer_curses=yes ;;
977esac
ccc6cda3
JA
978BASH_CHECK_LIB_TERMCAP
979fi
980AC_SUBST(TERMCAP_LIB)
981AC_SUBST(TERMCAP_DEP)
982
d166f048 983BASH_CHECK_DEV_FD
bb70624e 984BASH_CHECK_DEV_STDIN
f73dda09 985BASH_SYS_DEFAULT_MAIL_DIR
ccc6cda3
JA
986
987if test "$bash_cv_job_control_missing" = missing; then
988 opt_job_control=no
989fi
990
991if test "$opt_job_control" = yes; then
992AC_DEFINE(JOB_CONTROL)
993JOBS_O=jobs.o
994else
995JOBS_O=nojobs.o
996fi
997
998AC_SUBST(JOBS_O)
999
d166f048
JA
1000dnl Defines that we want to propagate to the Makefiles in subdirectories,
1001dnl like glob and readline
1002
1003LOCAL_DEFS=-DSHELL
1004
ccc6cda3 1005dnl use this section to possibly define more cpp variables, specify local
3185942a 1006dnl libraries, and specify any additional local cc or ld flags
ccc6cda3
JA
1007dnl
1008dnl this should really go away someday
1009
b72432fd 1010case "${host_os}" in
e8ce775d 1011sysv4.2*) AC_DEFINE(SVR4_2)
ccc6cda3
JA
1012 AC_DEFINE(SVR4) ;;
1013sysv4*) AC_DEFINE(SVR4) ;;
b72432fd
JA
1014sysv5*) AC_DEFINE(SVR5) ;;
1015hpux9*) LOCAL_CFLAGS="-DHPUX9 -DHPUX" ;;
ccc6cda3
JA
1016hpux*) LOCAL_CFLAGS=-DHPUX ;;
1017dgux*) LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
bb70624e
JA
1018isc*) LOCAL_CFLAGS=-Disc386 ;;
1019rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
f73dda09 1020darwin*) LOCAL_CFLAGS=-DMACOSX ;;
7117c2d2
JA
1021sco3.2v5*) LOCAL_CFLAGS="-b elf -DWAITPID_BROKEN -DPATH_MAX=1024" ;;
1022sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
ccc6cda3 1023sco3.2*) LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
d166f048 1024sunos4*) LOCAL_CFLAGS=-DSunOS4 ;;
f1be666c 1025solaris2.5*) LOCAL_CFLAGS="-DSunOS5 -DSOLARIS" ;;
17345e5a
JA
1026solaris2.8*) LOCAL_CFLAGS=-DSOLARIS ;;
1027solaris2.9*) LOCAL_CFLAGS=-DSOLARIS ;;
1028solaris2.10*) LOCAL_CFLAGS=-DSOLARIS ;;
f1be666c 1029solaris2*) LOCAL_CFLAGS=-DSOLARIS ;;
b72432fd 1030lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
95732b49
JA
1031linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
1032 case "`uname -r`" in
1033 2.[[456789]]*|3*) AC_DEFINE(PGRP_PIPE) ;;
1034 esac ;;
1035*qnx6*) LOCAL_CFLAGS="-Dqnx -Dqnx6" LOCAL_LIBS="-lncurses" ;;
7117c2d2 1036*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
b72432fd 1037powerux*) LOCAL_LIBS="-lgen" ;;
b80f6443 1038cygwin*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
0001803f 1039opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO -D_POSIX_SOURCE -D_ALL_SOURCE" ;;
b72432fd
JA
1040esac
1041
1042dnl Stanza for OS/compiler pair-specific flags
1043case "${host_os}-${CC}" in
1044aix4.2*-*gcc*) LOCAL_LDFLAGS="-Xlinker -bexpall -Xlinker -brtl" ;;
1045aix4.2*) LOCAL_LDFLAGS="-bexpall -brtl" ;;
1046bsdi4*-*gcc*) LOCAL_LDFLAGS="-rdynamic" ;; # allow dynamic loading, like Linux
ccc6cda3
JA
1047esac
1048
bb70624e
JA
1049dnl FreeBSD-3.x can have either a.out or ELF
1050case "${host_os}" in
28ef6c31
JA
1051freebsd[[3-9]]*)
1052 if test -x /usr/bin/objformat && test "`/usr/bin/objformat`" = "elf" ; then
bb70624e
JA
1053 LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
1054 fi ;;
28ef6c31 1055freebsdelf*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
95732b49 1056dragonfly*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
bb70624e
JA
1057esac
1058
ccc6cda3
JA
1059case "$host_cpu" in
1060*cray*) LOCAL_CFLAGS="-DCRAY" ;; # shell var so config.h can use it
1061esac
1062
1063case "$host_cpu-$host_os" in
1064ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
1065esac
1066
1067case "$host_cpu-$host_vendor-$host_os" in
1068m88k-motorola-sysv3) LOCAL_CFLAGS=-DWAITPID_BROKEN ;;
1069mips-pyramid-sysv4) LOCAL_CFLAGS=-Xa ;;
1070esac
1071
b72432fd
JA
1072#
1073# Shared object configuration section. These values are generated by
1074# ${srcdir}/support/shobj-conf
1075#
1076if test "$ac_cv_func_dlopen" = "yes" && test -f ${srcdir}/support/shobj-conf
1077then
1078 AC_MSG_CHECKING(shared object configuration for loadable builtins)
28ef6c31 1079 eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c "${host_cpu}" -o "${host_os}" -v "${host_vendor}"`
b72432fd
JA
1080 AC_SUBST(SHOBJ_CC)
1081 AC_SUBST(SHOBJ_CFLAGS)
1082 AC_SUBST(SHOBJ_LD)
1083 AC_SUBST(SHOBJ_LDFLAGS)
1084 AC_SUBST(SHOBJ_XLDFLAGS)
1085 AC_SUBST(SHOBJ_LIBS)
1086 AC_SUBST(SHOBJ_STATUS)
1087 AC_MSG_RESULT($SHOBJ_STATUS)
1088fi
1089
ccc6cda3
JA
1090# try to create a directory tree if the source is elsewhere
1091# this should be packaged into a script accessible via ${srcdir}/support
1092case "$srcdir" in
1093.) ;;
cce855bc 1094*) for d in doc tests support lib examples; do # dirs
ccc6cda3
JA
1095 test -d $d || mkdir $d
1096 done
cce855bc 1097 for ld in readline glob tilde malloc sh termcap; do # libdirs
ccc6cda3
JA
1098 test -d lib/$ld || mkdir lib/$ld
1099 done
cce855bc 1100 test -d examples/loadables || mkdir examples/loadables # loadable builtins
bb70624e 1101 test -d examples/loadables/perl || mkdir examples/loadables/perl
ccc6cda3
JA
1102 ;;
1103esac
1104
1105BUILD_DIR=`pwd`
95732b49
JA
1106case "$BUILD_DIR" in
1107*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
1108*) ;;
1109esac
ccc6cda3 1110
3185942a
JA
1111if test -z "$localedir"; then
1112 localedir='${datarootdir}/locale'
1113fi
1114if test -z "$datarootdir"; then
1115 datarootdir='${prefix}/share'
1116fi
1117
cce855bc
JA
1118AC_SUBST(PROFILE_FLAGS)
1119
ccc6cda3
JA
1120AC_SUBST(incdir)
1121AC_SUBST(BUILD_DIR)
1122
3185942a
JA
1123# Some versions of autoconf don't substitute these automatically
1124AC_SUBST(datarootdir)
1125AC_SUBST(localedir)
1126
ccc6cda3
JA
1127AC_SUBST(YACC)
1128AC_SUBST(AR)
b72432fd 1129AC_SUBST(ARFLAGS)
ccc6cda3 1130
d166f048 1131AC_SUBST(BASHVERS)
7117c2d2
JA
1132AC_SUBST(RELSTATUS)
1133AC_SUBST(DEBUG)
1134AC_SUBST(MALLOC_DEBUG)
d166f048 1135
ccc6cda3 1136AC_SUBST(host_cpu)
b72432fd 1137AC_SUBST(host_vendor)
ccc6cda3
JA
1138AC_SUBST(host_os)
1139
1140AC_SUBST(LOCAL_LIBS)
1141AC_SUBST(LOCAL_CFLAGS)
1142AC_SUBST(LOCAL_LDFLAGS)
d166f048 1143AC_SUBST(LOCAL_DEFS)
ccc6cda3 1144
d166f048
JA
1145#AC_SUBST(ALLOCA_SOURCE)
1146#AC_SUBST(ALLOCA_OBJECT)
ccc6cda3
JA
1147
1148AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
b80f6443 1149 lib/intl/Makefile \
cce855bc 1150 lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \
b80f6443 1151 lib/tilde/Makefile doc/Makefile support/Makefile po/Makefile.in \
3185942a 1152 examples/loadables/Makefile examples/loadables/perl/Makefile],
ccc6cda3
JA
1153[
1154# Makefile uses this timestamp file to record whether config.h is up to date.
1155echo timestamp > stamp-h
1156])