]> git.ipfire.org Git - thirdparty/bash.git/blame - configure.in
Bash-4.3 patch 32
[thirdparty/bash.git] / configure.in
CommitLineData
ccc6cda3 1dnl
495aee44 2dnl Configure script for bash-4.2
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
495aee44 8# Copyright (C) 1987-2011 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
495aee44 24AC_REVISION([for Bash 4.2, version 4.037])dnl
f73dda09 25
495aee44 26define(bashvers, 4.2)
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
495aee44 101dnl AM_PATH_LISPDIR
b80f6443
JA
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 661 stddef.h stdint.h netdb.h pwd.h grp.h strings.h regex.h \
495aee44 662 syslog.h ulimit.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
495aee44 730AC_CHECK_FUNCS(bcopy bzero confstr faccessat 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)
495aee44
CR
742AC_REPLACE_FUNCS(dprintf)
743AC_REPLACE_FUNCS(strchrnul)
f73dda09 744
f73dda09 745AC_CHECK_DECLS([confstr])
f73dda09 746AC_CHECK_DECLS([printf])
7117c2d2 747AC_CHECK_DECLS([sbrk])
0628567a 748AC_CHECK_DECLS([setregid])
7117c2d2 749AC_CHECK_DECLS([strcpy])
f73dda09 750AC_CHECK_DECLS([strsignal])
b80f6443
JA
751
752dnl Extra test to detect the horribly broken HP/UX 11.00 strtold(3)
753AC_CHECK_DECLS([strtold], [
754 AC_MSG_CHECKING([for broken strtold])
755 AC_CACHE_VAL(bash_cv_strtold_broken,
756 [AC_TRY_COMPILE(
757 [#include <stdlib.h>],
758 [int main() { long double r; char *foo, bar; r = strtold(foo, &bar);}],
759 bash_cv_strtold_broken=no, bash_cv_strtold_broken=yes,
760 [AC_MSG_WARN(cannot check for broken strtold if cross-compiling, defaulting to no)])
761 ]
762 )
763 AC_MSG_RESULT($bash_cv_strtold_broken)
764 if test "$bash_cv_strtold_broken" = "yes" ; then
765 AC_DEFINE(STRTOLD_BROKEN)
766 fi
767])
768
f73dda09
JA
769
770BASH_CHECK_DECL(strtoimax)
771BASH_CHECK_DECL(strtol)
772BASH_CHECK_DECL(strtoll)
773BASH_CHECK_DECL(strtoul)
774BASH_CHECK_DECL(strtoull)
775BASH_CHECK_DECL(strtoumax)
ccc6cda3 776
7117c2d2
JA
777AC_FUNC_MKTIME
778
b80f6443
JA
779dnl
780dnl Checks for lib/intl and related code (uses some of the output from
781dnl AM_GNU_GETTEXT)
782dnl
ccc6cda3 783
b80f6443
JA
784AC_CHECK_HEADERS([argz.h errno.h fcntl.h malloc.h stdio_ext.h])
785
786dnl AC_FUNC_MALLOC
787AC_FUNC_MMAP
788AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify dcgettext mempcpy \
789 munmap stpcpy strcspn strdup])
790
791INTL_DEP= INTL_INC= LIBINTL_H=
792if test "x$USE_INCLUDED_LIBINTL" = "xyes"; then
793 INTL_DEP='${INTL_LIBDIR}/libintl.a'
794 INTL_INC='-I${INTL_LIBSRC} -I${INTL_BUILDDIR}'
795 LIBINTL_H='${INTL_BUILDDIR}/libintl.h'
ccc6cda3 796fi
b80f6443
JA
797AC_SUBST(INTL_DEP)
798AC_SUBST(INTL_INC)
799AC_SUBST(LIBINTL_H)
800
801dnl
802dnl End of checks needed by files in lib/intl
803dnl
ccc6cda3 804
7117c2d2
JA
805BASH_CHECK_MULTIBYTE
806
ccc6cda3 807dnl checks for the dynamic loading library functions in libc and libdl
cce855bc 808if test "$opt_static_link" != yes; then
ccc6cda3
JA
809AC_CHECK_LIB(dl, dlopen)
810AC_CHECK_FUNCS(dlopen dlclose dlsym)
cce855bc 811fi
ccc6cda3 812
3185942a 813dnl this defines HAVE_DECL_SYS_SIGLIST
ccc6cda3
JA
814AC_DECL_SYS_SIGLIST
815
bb70624e
JA
816dnl network functions -- check for inet_aton again
817if test "$ac_cv_func_inet_aton" != 'yes'; then
818BASH_FUNC_INET_ATON
819fi
ccc6cda3
JA
820
821dnl libraries
822dnl this is reportedly no longer necessary for irix[56].?
bb70624e
JA
823case "$host_os" in
824irix4*) AC_CHECK_LIB(sun, getpwent) ;;
825esac
826
d166f048
JA
827dnl check for getpeername in the socket library only if it's not in libc
828if test "$ac_cv_func_getpeername" = no; then
f73dda09 829 BASH_CHECK_LIB_SOCKET
d166f048 830fi
bb70624e
JA
831dnl check for gethostbyname in socket libraries if it's not in libc
832if test "$ac_cv_func_gethostbyname" = no; then
833 BASH_FUNC_GETHOSTBYNAME
834fi
ccc6cda3
JA
835
836dnl system types
837AC_TYPE_GETGROUPS
838AC_TYPE_OFF_T
839AC_TYPE_MODE_T
840AC_TYPE_UID_T
841AC_TYPE_PID_T
842AC_TYPE_SIZE_T
f73dda09 843AC_CHECK_TYPE(ssize_t, int)
ccc6cda3
JA
844AC_CHECK_TYPE(time_t, long)
845
f73dda09
JA
846BASH_TYPE_LONG_LONG
847BASH_TYPE_UNSIGNED_LONG_LONG
848
ccc6cda3 849AC_TYPE_SIGNAL
17345e5a 850BASH_TYPE_SIG_ATOMIC_T
ccc6cda3 851
bb70624e
JA
852AC_CHECK_SIZEOF(char, 1)
853AC_CHECK_SIZEOF(short, 2)
b72432fd
JA
854AC_CHECK_SIZEOF(int, 4)
855AC_CHECK_SIZEOF(long, 4)
856AC_CHECK_SIZEOF(char *, 4)
857AC_CHECK_SIZEOF(double, 8)
f73dda09 858AC_CHECK_SIZEOF([long long], 8)
cce855bc 859
f73dda09
JA
860AC_CHECK_TYPE(u_int, [unsigned int])
861AC_CHECK_TYPE(u_long, [unsigned long])
bb70624e
JA
862
863BASH_TYPE_BITS16_T
864BASH_TYPE_U_BITS16_T
865BASH_TYPE_BITS32_T
866BASH_TYPE_U_BITS32_T
b72432fd 867BASH_TYPE_BITS64_T
cce855bc 868
bb70624e
JA
869BASH_TYPE_PTRDIFF_T
870
ccc6cda3
JA
871dnl structures
872AC_HEADER_STAT
ccc6cda3 873
ccc6cda3
JA
874dnl system services
875AC_SYS_INTERPRETER
876if test $ac_cv_sys_interpreter = yes; then
877AC_DEFINE(HAVE_HASH_BANG_EXEC)
878fi
ccc6cda3
JA
879
880dnl Miscellaneous Bash tests
881if test "$ac_cv_func_lstat" = "no"; then
882BASH_FUNC_LSTAT
883fi
884
d166f048 885dnl behavior of system calls and library functions
b80f6443 886BASH_FUNC_CTYPE_NONASCII
f73dda09
JA
887BASH_FUNC_DUP2_CLOEXEC_CHECK
888BASH_SYS_PGRP_SYNC
889BASH_SYS_SIGNAL_VINTAGE
cce855bc 890
d166f048 891dnl checking for the presence of certain library symbols
ccc6cda3
JA
892BASH_SYS_ERRLIST
893BASH_SYS_SIGLIST
894BASH_UNDER_SYS_SIGLIST
d166f048
JA
895
896dnl various system types
ccc6cda3
JA
897BASH_TYPE_SIGHANDLER
898BASH_CHECK_TYPE(clock_t, [#include <sys/times.h>], long)
899BASH_CHECK_TYPE(sigset_t, [#include <signal.h>], int)
900BASH_CHECK_TYPE(quad_t, , long, HAVE_QUAD_T)
f73dda09
JA
901BASH_CHECK_TYPE(intmax_t, , $bash_cv_type_long_long)
902BASH_CHECK_TYPE(uintmax_t, , $bash_cv_type_unsigned_long_long)
903if test "$ac_cv_header_sys_socket_h" = "yes"; then
904BASH_CHECK_TYPE(socklen_t, [#include <sys/socket.h>], int, HAVE_SOCKLEN_T)
905fi
906BASH_TYPE_RLIMIT
d166f048 907
495aee44
CR
908AC_CHECK_SIZEOF(intmax_t, 8)
909
d166f048 910dnl presence and contents of structures used by system calls
ccc6cda3
JA
911BASH_STRUCT_TERMIOS_LDISC
912BASH_STRUCT_TERMIO_LDISC
913BASH_STRUCT_DIRENT_D_INO
d166f048 914BASH_STRUCT_DIRENT_D_FILENO
b80f6443 915BASH_STRUCT_DIRENT_D_NAMLEN
d166f048 916BASH_STRUCT_WINSIZE
bb70624e 917BASH_STRUCT_TIMEVAL
f73dda09 918AC_CHECK_MEMBERS([struct stat.st_blocks])
7117c2d2
JA
919AC_STRUCT_TM
920AC_STRUCT_TIMEZONE
b80f6443 921BASH_STRUCT_TIMEZONE
d166f048 922
495aee44
CR
923BASH_STRUCT_WEXITSTATUS_OFFSET
924
d166f048 925dnl presence and behavior of C library functions
ccc6cda3
JA
926BASH_FUNC_STRSIGNAL
927BASH_FUNC_OPENDIR_CHECK
ccc6cda3 928BASH_FUNC_ULIMIT_MAXFDS
3185942a 929BASH_FUNC_FPURGE
ccc6cda3 930BASH_FUNC_GETENV
7117c2d2 931if test "$ac_cv_func_getcwd" = "yes"; then
ccc6cda3 932BASH_FUNC_GETCWD
f73dda09 933fi
ccc6cda3 934BASH_FUNC_POSIX_SETJMP
d166f048 935BASH_FUNC_STRCOLL
0001803f
CR
936BASH_FUNC_SNPRINTF
937BASH_FUNC_VSNPRINTF
d166f048 938
7117c2d2
JA
939dnl If putenv or unsetenv is not present, set the right define so the
940dnl prototype and declaration in lib/sh/getenv.c will be standard-conformant
941
942if test "$ac_cv_func_putenv" = "yes"; then
943BASH_FUNC_STD_PUTENV
944else
945AC_DEFINE(HAVE_STD_PUTENV)
946fi
947if test "$ac_cv_func_unsetenv" = "yes"; then
948BASH_FUNC_STD_UNSETENV
949else
950AC_DEFINE(HAVE_STD_UNSETENV)
951fi
952
f73dda09
JA
953BASH_FUNC_PRINTF_A_FORMAT
954
d166f048 955dnl presence and behavior of OS functions
f73dda09
JA
956BASH_SYS_REINSTALL_SIGHANDLERS
957BASH_SYS_JOB_CONTROL_MISSING
ccc6cda3 958BASH_SYS_NAMED_PIPES
d166f048
JA
959
960dnl presence of certain CPP defines
f73dda09 961AC_HEADER_TIOCGWINSZ
ccc6cda3
JA
962BASH_HAVE_TIOCSTAT
963BASH_HAVE_FIONREAD
d166f048 964
95732b49
JA
965BASH_CHECK_WCONTINUED
966
d166f048 967dnl miscellaneous
f73dda09 968BASH_CHECK_SPEED_T
ccc6cda3 969BASH_CHECK_GETPW_FUNCS
28ef6c31 970BASH_CHECK_RTSIGS
f73dda09 971BASH_CHECK_SYS_SIGLIST
ccc6cda3 972
d166f048 973dnl special checks
ccc6cda3 974case "$host_os" in
f73dda09 975hpux*) BASH_CHECK_KERNEL_RLIMIT ;;
ccc6cda3
JA
976esac
977
978if test "$opt_readline" = yes; then
d166f048
JA
979dnl yuck
980case "$host_os" in
981aix*) prefer_curses=yes ;;
982esac
ccc6cda3
JA
983BASH_CHECK_LIB_TERMCAP
984fi
985AC_SUBST(TERMCAP_LIB)
986AC_SUBST(TERMCAP_DEP)
987
d166f048 988BASH_CHECK_DEV_FD
bb70624e 989BASH_CHECK_DEV_STDIN
f73dda09 990BASH_SYS_DEFAULT_MAIL_DIR
ccc6cda3
JA
991
992if test "$bash_cv_job_control_missing" = missing; then
993 opt_job_control=no
994fi
995
996if test "$opt_job_control" = yes; then
997AC_DEFINE(JOB_CONTROL)
998JOBS_O=jobs.o
999else
1000JOBS_O=nojobs.o
1001fi
1002
1003AC_SUBST(JOBS_O)
1004
d166f048
JA
1005dnl Defines that we want to propagate to the Makefiles in subdirectories,
1006dnl like glob and readline
1007
1008LOCAL_DEFS=-DSHELL
1009
ccc6cda3 1010dnl use this section to possibly define more cpp variables, specify local
3185942a 1011dnl libraries, and specify any additional local cc or ld flags
ccc6cda3
JA
1012dnl
1013dnl this should really go away someday
1014
b72432fd 1015case "${host_os}" in
e8ce775d 1016sysv4.2*) AC_DEFINE(SVR4_2)
ccc6cda3
JA
1017 AC_DEFINE(SVR4) ;;
1018sysv4*) AC_DEFINE(SVR4) ;;
b72432fd
JA
1019sysv5*) AC_DEFINE(SVR5) ;;
1020hpux9*) LOCAL_CFLAGS="-DHPUX9 -DHPUX" ;;
ccc6cda3
JA
1021hpux*) LOCAL_CFLAGS=-DHPUX ;;
1022dgux*) LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
bb70624e
JA
1023isc*) LOCAL_CFLAGS=-Disc386 ;;
1024rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
f73dda09 1025darwin*) LOCAL_CFLAGS=-DMACOSX ;;
7117c2d2
JA
1026sco3.2v5*) LOCAL_CFLAGS="-b elf -DWAITPID_BROKEN -DPATH_MAX=1024" ;;
1027sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
ccc6cda3 1028sco3.2*) LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
d166f048 1029sunos4*) LOCAL_CFLAGS=-DSunOS4 ;;
f1be666c 1030solaris2.5*) LOCAL_CFLAGS="-DSunOS5 -DSOLARIS" ;;
17345e5a
JA
1031solaris2.8*) LOCAL_CFLAGS=-DSOLARIS ;;
1032solaris2.9*) LOCAL_CFLAGS=-DSOLARIS ;;
1033solaris2.10*) LOCAL_CFLAGS=-DSOLARIS ;;
f1be666c 1034solaris2*) LOCAL_CFLAGS=-DSOLARIS ;;
b72432fd 1035lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
95732b49
JA
1036linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
1037 case "`uname -r`" in
1038 2.[[456789]]*|3*) AC_DEFINE(PGRP_PIPE) ;;
1039 esac ;;
1040*qnx6*) LOCAL_CFLAGS="-Dqnx -Dqnx6" LOCAL_LIBS="-lncurses" ;;
7117c2d2 1041*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
b72432fd 1042powerux*) LOCAL_LIBS="-lgen" ;;
b80f6443 1043cygwin*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
0001803f 1044opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO -D_POSIX_SOURCE -D_ALL_SOURCE" ;;
b72432fd
JA
1045esac
1046
1047dnl Stanza for OS/compiler pair-specific flags
1048case "${host_os}-${CC}" in
1049aix4.2*-*gcc*) LOCAL_LDFLAGS="-Xlinker -bexpall -Xlinker -brtl" ;;
1050aix4.2*) LOCAL_LDFLAGS="-bexpall -brtl" ;;
1051bsdi4*-*gcc*) LOCAL_LDFLAGS="-rdynamic" ;; # allow dynamic loading, like Linux
ccc6cda3
JA
1052esac
1053
bb70624e
JA
1054dnl FreeBSD-3.x can have either a.out or ELF
1055case "${host_os}" in
28ef6c31
JA
1056freebsd[[3-9]]*)
1057 if test -x /usr/bin/objformat && test "`/usr/bin/objformat`" = "elf" ; then
bb70624e
JA
1058 LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
1059 fi ;;
28ef6c31 1060freebsdelf*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
95732b49 1061dragonfly*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
bb70624e
JA
1062esac
1063
ccc6cda3
JA
1064case "$host_cpu" in
1065*cray*) LOCAL_CFLAGS="-DCRAY" ;; # shell var so config.h can use it
1066esac
1067
1068case "$host_cpu-$host_os" in
1069ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
1070esac
1071
1072case "$host_cpu-$host_vendor-$host_os" in
1073m88k-motorola-sysv3) LOCAL_CFLAGS=-DWAITPID_BROKEN ;;
1074mips-pyramid-sysv4) LOCAL_CFLAGS=-Xa ;;
1075esac
1076
b72432fd
JA
1077#
1078# Shared object configuration section. These values are generated by
1079# ${srcdir}/support/shobj-conf
1080#
1081if test "$ac_cv_func_dlopen" = "yes" && test -f ${srcdir}/support/shobj-conf
1082then
1083 AC_MSG_CHECKING(shared object configuration for loadable builtins)
28ef6c31 1084 eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c "${host_cpu}" -o "${host_os}" -v "${host_vendor}"`
b72432fd
JA
1085 AC_SUBST(SHOBJ_CC)
1086 AC_SUBST(SHOBJ_CFLAGS)
1087 AC_SUBST(SHOBJ_LD)
1088 AC_SUBST(SHOBJ_LDFLAGS)
1089 AC_SUBST(SHOBJ_XLDFLAGS)
1090 AC_SUBST(SHOBJ_LIBS)
1091 AC_SUBST(SHOBJ_STATUS)
1092 AC_MSG_RESULT($SHOBJ_STATUS)
1093fi
1094
ccc6cda3
JA
1095# try to create a directory tree if the source is elsewhere
1096# this should be packaged into a script accessible via ${srcdir}/support
1097case "$srcdir" in
1098.) ;;
cce855bc 1099*) for d in doc tests support lib examples; do # dirs
ccc6cda3
JA
1100 test -d $d || mkdir $d
1101 done
cce855bc 1102 for ld in readline glob tilde malloc sh termcap; do # libdirs
ccc6cda3
JA
1103 test -d lib/$ld || mkdir lib/$ld
1104 done
cce855bc 1105 test -d examples/loadables || mkdir examples/loadables # loadable builtins
bb70624e 1106 test -d examples/loadables/perl || mkdir examples/loadables/perl
ccc6cda3
JA
1107 ;;
1108esac
1109
1110BUILD_DIR=`pwd`
95732b49
JA
1111case "$BUILD_DIR" in
1112*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
1113*) ;;
1114esac
ccc6cda3 1115
3185942a
JA
1116if test -z "$localedir"; then
1117 localedir='${datarootdir}/locale'
1118fi
1119if test -z "$datarootdir"; then
1120 datarootdir='${prefix}/share'
1121fi
1122
cce855bc
JA
1123AC_SUBST(PROFILE_FLAGS)
1124
ccc6cda3
JA
1125AC_SUBST(incdir)
1126AC_SUBST(BUILD_DIR)
1127
3185942a
JA
1128# Some versions of autoconf don't substitute these automatically
1129AC_SUBST(datarootdir)
1130AC_SUBST(localedir)
1131
ccc6cda3
JA
1132AC_SUBST(YACC)
1133AC_SUBST(AR)
b72432fd 1134AC_SUBST(ARFLAGS)
ccc6cda3 1135
d166f048 1136AC_SUBST(BASHVERS)
7117c2d2
JA
1137AC_SUBST(RELSTATUS)
1138AC_SUBST(DEBUG)
1139AC_SUBST(MALLOC_DEBUG)
d166f048 1140
ccc6cda3 1141AC_SUBST(host_cpu)
b72432fd 1142AC_SUBST(host_vendor)
ccc6cda3
JA
1143AC_SUBST(host_os)
1144
1145AC_SUBST(LOCAL_LIBS)
1146AC_SUBST(LOCAL_CFLAGS)
1147AC_SUBST(LOCAL_LDFLAGS)
d166f048 1148AC_SUBST(LOCAL_DEFS)
ccc6cda3 1149
d166f048
JA
1150#AC_SUBST(ALLOCA_SOURCE)
1151#AC_SUBST(ALLOCA_OBJECT)
ccc6cda3
JA
1152
1153AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
b80f6443 1154 lib/intl/Makefile \
cce855bc 1155 lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \
b80f6443 1156 lib/tilde/Makefile doc/Makefile support/Makefile po/Makefile.in \
3185942a 1157 examples/loadables/Makefile examples/loadables/perl/Makefile],
ccc6cda3
JA
1158[
1159# Makefile uses this timestamp file to record whether config.h is up to date.
1160echo timestamp > stamp-h
1161])