]> git.ipfire.org Git - thirdparty/bash.git/blame - configure.ac
fix for fdflags loadable builtin; new strptime loadable builtin; enable -f doesn...
[thirdparty/bash.git] / configure.ac
CommitLineData
a7ad477f 1dnl
50ffbc9d 2dnl Configure script for bash-5.3
a7ad477f
CR
3dnl
4dnl report bugs to chet@po.cwru.edu
5dnl
6dnl Process this file with autoconf to produce a configure script.
7
315095ad 8# Copyright (C) 1987-2023 Free Software Foundation, Inc.
a7ad477f
CR
9
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/>.
23
55a224da 24AC_REVISION([for Bash 5.3, version 5.059])dnl
a7ad477f 25
b91488b5
CR
26define(bashvers, 5.3)
27define(relstatus, devel)
a7ad477f
CR
28
29AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
30
31dnl make sure we are using a recent autoconf version
44107840 32AC_PREREQ(2.69)
a7ad477f
CR
33
34AC_CONFIG_SRCDIR(shell.h)
35dnl where to find install.sh, config.sub, and config.guess
36AC_CONFIG_AUX_DIR(./support)
37AC_CONFIG_HEADERS(config.h)
38
39dnl checks for version info
40BASHVERS=bashvers
41RELSTATUS=relstatus
42
43dnl defaults for debug settings
44case "$RELSTATUS" in
79eedac4 45alp*|bet*|dev*|rc*|releng*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
a7ad477f
CR
46*) DEBUG= MALLOC_DEBUG= ;;
47esac
48
49dnl canonicalize the host and os so we can do some tricky things before
50dnl parsing options
51AC_CANONICAL_HOST
52AC_CANONICAL_BUILD
53
54dnl configure defaults
55opt_bash_malloc=yes
a7ad477f
CR
56opt_afs=no
57opt_curses=no
58opt_with_installed_readline=no
59
60#htmldir=
61
62dnl some systems should be configured without the bash malloc by default
63dnl and some need a special compiler or loader
64dnl look in the NOTES file for more
65case "${host_cpu}-${host_os}" in
a078e04c 66# mostly obsolete platforms
a7ad477f
CR
67alpha*-*) opt_bash_malloc=no ;; # alpha running osf/1 or linux
68*[[Cc]]ray*-*) opt_bash_malloc=no ;; # Crays
69*-osf1*) opt_bash_malloc=no ;; # other osf/1 machines
a078e04c 70*-dgux*) opt_bash_malloc=no ;; # DG/UX machines
a7ad477f 71sparc-svr4*) opt_bash_malloc=no ;; # sparc SVR4, SVR4.2
a7ad477f 72m68k-sysv) opt_bash_malloc=no ;; # fixes file descriptor leak in closedir
a078e04c
CR
73*-bsdi2.1|*-bsdi3.?) opt_bash_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
74*-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft
75*-beos*) opt_bash_malloc=no ;; # they say it's suitable
76# These need additional investigation
a7ad477f 77sparc-linux*) opt_bash_malloc=no ;; # sparc running linux; requires ELF
a7ad477f 78*-aix*) opt_bash_malloc=no ;; # AIX machines
a078e04c 79*-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
dd4e3abc
CR
80# These lack a working sbrk(2)
81aarch64-freebsd*) opt_bash_malloc=no ;;
82riscv*-freebsd*) opt_bash_malloc=no ;;
a078e04c 83# Mach-derived systems have a ton of extra malloc functions and lack sbrk(2)
a7ad477f 84*-nextstep*) opt_bash_malloc=no ;; # NeXT machines running NeXTstep
10e78433 85*-openstep*) opt_bash_malloc=no ;; # i386/Sparc/HP machines running Openstep
a7ad477f
CR
86*-macos*) opt_bash_malloc=no ;; # Apple MacOS X
87*-rhapsody*) opt_bash_malloc=no ;; # Apple Rhapsody (MacOS X)
88*-darwin*) opt_bash_malloc=no ;; # Apple Darwin (MacOS X)
a7ad477f 89*-machten4) opt_bash_malloc=no ;; # MachTen 4.x
a078e04c
CR
90# Niche or non-mainstream-shell-user systems
91*-qnx*) opt_bash_malloc=no ;; # QNX 4.2, QNX [67].x
f14388d3 92*-nsk*) opt_bash_malloc=no ;; # HP NonStop
c51b384f 93*-haiku*) opt_bash_malloc=no ;; # Haiku OS
fc94d474 94*-genode*) opt_bash_malloc=no ;; # Genode has no sbrk
a629483b
CR
95i370-openedition*) opt_bash_malloc=no LOCAL_LIBS=-lzoslib LIBS_FOR_BUILD=-lzoslib ;; # IBM z/OS machines
96i370-*) opt_bash_malloc=no ;; # generic (?) IBM 370 machines
a7ad477f
CR
97esac
98
99# memory scrambling on free()
100case "${host_os}" in
101sco3.2v5*|sco3.2v4*) opt_memscramble=no ;;
102*) opt_memscramble=yes ;;
103esac
104
105dnl
106dnl macros for the bash debugger
107dnl
108dnl AM_PATH_LISPDIR
109AC_ARG_VAR(DEBUGGER_START_FILE, [location of bash debugger initialization file])
110
111dnl arguments to configure
112dnl packages
a67031fe
CR
113AC_ARG_WITH(afs, AS_HELP_STRING([--with-afs], [if you are running AFS]), opt_afs=$withval)
114AC_ARG_WITH(bash-malloc, AS_HELP_STRING([--with-bash-malloc], [use the Bash version of malloc]), opt_bash_malloc=$withval)
115AC_ARG_WITH(curses, AS_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
116AC_ARG_WITH(gnu-malloc, AS_HELP_STRING([--with-gnu-malloc], [synonym for --with-bash-malloc]), opt_bash_malloc=$withval)
117AC_ARG_WITH(installed-readline, AS_HELP_STRING([--with-installed-readline], [use a version of the readline library that is already installed]), opt_with_installed_readline=$withval)
a7ad477f
CR
118
119if test "$opt_bash_malloc" = yes; then
120 MALLOC_TARGET=malloc
121 MALLOC_SRC=malloc.c
122
123 MALLOC_LIB='-lmalloc'
124 MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
125 MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
126 MALLOC_DEP='$(MALLOC_LIBRARY)'
127
128 AC_DEFINE(USING_BASH_MALLOC)
129else
130 MALLOC_LIB=
131 MALLOC_LIBRARY=
132 MALLOC_LDFLAGS=
133 MALLOC_DEP=
134fi
135
a7ad477f
CR
136if test "$opt_afs" = yes; then
137 AC_DEFINE(AFS)
138fi
139
140if test "$opt_curses" = yes; then
141 prefer_curses=yes
142fi
143
144if test -z "${DEBUGGER_START_FILE}"; then
145 DEBUGGER_START_FILE='${datadir}/bashdb/bashdb-main.inc'
146fi
147
148dnl optional shell features in config.h.in
149opt_minimal_config=no
150
151opt_job_control=yes
152opt_alias=yes
153opt_readline=yes
154opt_history=yes
155opt_bang_history=yes
156opt_dirstack=yes
157opt_restricted=yes
158opt_process_subst=yes
159opt_prompt_decoding=yes
160opt_select=yes
161opt_help=yes
162opt_array_variables=yes
163opt_dparen_arith=yes
164opt_extended_glob=yes
165opt_brace_expansion=yes
166opt_disabled_builtins=no
167opt_command_timing=yes
168opt_xpg_echo=no
169opt_strict_posix=no
170opt_cond_command=yes
171opt_cond_regexp=yes
172opt_coproc=yes
173opt_arith_for_command=yes
174opt_net_redirs=yes
175opt_progcomp=yes
176opt_separate_help=no
177opt_multibyte=yes
178opt_debugger=yes
179opt_single_longdoc_strings=yes
180opt_casemod_attrs=yes
181opt_casemod_expansions=yes
182opt_extglob_default=no
f14388d3 183opt_dircomplete_expand_default=no
07f38782 184opt_globascii_default=yes
f3aad56d 185opt_function_import=yes
a57ed9e9 186opt_dev_fd_stat_broken=no
a67031fe 187opt_alt_array_impl=no
006856ed 188opt_translatable_strings=yes
a7ad477f 189
72206eb2
CR
190dnl modified by alternate array implementation option
191ARRAY_O=array.o
192
a7ad477f
CR
193dnl options that affect how bash is compiled and linked
194opt_static_link=no
195opt_profiling=no
196
197dnl argument parsing for optional features
a67031fe 198AC_ARG_ENABLE(minimal-config, AS_HELP_STRING([--enable-minimal-config], [a minimal sh-like configuration]), opt_minimal_config=$enableval)
a7ad477f
CR
199
200dnl a minimal configuration turns everything off, but features can be
201dnl added individually
202if test $opt_minimal_config = yes; then
203 opt_job_control=no opt_alias=no opt_readline=no
204 opt_history=no opt_bang_history=no opt_dirstack=no
205 opt_restricted=no opt_process_subst=no opt_prompt_decoding=no
206 opt_select=no opt_help=no opt_array_variables=no opt_dparen_arith=no
207 opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
208 opt_extended_glob=no opt_cond_command=no opt_arith_for_command=no
209 opt_net_redirs=no opt_progcomp=no opt_separate_help=no
210 opt_multibyte=yes opt_cond_regexp=no opt_coproc=no
211 opt_casemod_attrs=no opt_casemod_expansions=no opt_extglob_default=no
006856ed 212 opt_translatable_strings=no
07f38782 213 opt_globascii_default=yes
a7ad477f
CR
214fi
215
a67031fe
CR
216AC_ARG_ENABLE(alias, AS_HELP_STRING([--enable-alias], [enable shell aliases]), opt_alias=$enableval)
217AC_ARG_ENABLE(alt-array-implementation, AS_HELP_STRING([--enable-alt-array-implementation], [enable an alternate array implementation that optimizes speed at the cost of space]), opt_alt_array_impl=$enableval)
218AC_ARG_ENABLE(arith-for-command, AS_HELP_STRING([--enable-arith-for-command], [enable arithmetic for command]), opt_arith_for_command=$enableval)
219AC_ARG_ENABLE(array-variables, AS_HELP_STRING([--enable-array-variables], [include shell array variables]), opt_array_variables=$enableval)
220AC_ARG_ENABLE(bang-history, AS_HELP_STRING([--enable-bang-history], [turn on csh-style history substitution]), opt_bang_history=$enableval)
221AC_ARG_ENABLE(brace-expansion, AS_HELP_STRING([--enable-brace-expansion], [include brace expansion]), opt_brace_expansion=$enableval)
222AC_ARG_ENABLE(casemod-attributes, AS_HELP_STRING([--enable-casemod-attributes], [include case-modifying variable attributes]), opt_casemod_attrs=$enableval)
223AC_ARG_ENABLE(casemod-expansions, AS_HELP_STRING([--enable-casemod-expansions], [include case-modifying word expansions]), opt_casemod_expansions=$enableval)
224AC_ARG_ENABLE(command-timing, AS_HELP_STRING([--enable-command-timing], [enable the time reserved word and command timing]), opt_command_timing=$enableval)
225AC_ARG_ENABLE(cond-command, AS_HELP_STRING([--enable-cond-command], [enable the conditional command]), opt_cond_command=$enableval)
226AC_ARG_ENABLE(cond-regexp, AS_HELP_STRING([--enable-cond-regexp], [enable extended regular expression matching in conditional commands]), opt_cond_regexp=$enableval)
227AC_ARG_ENABLE(coprocesses, AS_HELP_STRING([--enable-coprocesses], [enable coprocess support and the coproc reserved word]), opt_coproc=$enableval)
228AC_ARG_ENABLE(debugger, AS_HELP_STRING([--enable-debugger], [enable support for bash debugger]), opt_debugger=$enableval)
229AC_ARG_ENABLE(dev-fd-stat-broken, AS_HELP_STRING([--enable-dev-fd-stat-broken], [enable this option if stat on /dev/fd/N and fstat on file descriptor N don't return the same results]), opt_dev_fd_stat_broken=$enableval)
230AC_ARG_ENABLE(direxpand-default, AS_HELP_STRING([--enable-direxpand-default], [enable the direxpand shell option by default]), opt_dircomplete_expand_default=$enableval)
231AC_ARG_ENABLE(directory-stack, AS_HELP_STRING([--enable-directory-stack], [enable builtins pushd/popd/dirs]), opt_dirstack=$enableval)
232AC_ARG_ENABLE(disabled-builtins, AS_HELP_STRING([--enable-disabled-builtins], [allow disabled builtins to still be invoked]), opt_disabled_builtins=$enableval)
233AC_ARG_ENABLE(dparen-arithmetic, AS_HELP_STRING([--enable-dparen-arithmetic], [include ((...)) command]), opt_dparen_arith=$enableval)
234AC_ARG_ENABLE(extended-glob, AS_HELP_STRING([--enable-extended-glob], [include ksh-style extended pattern matching]), opt_extended_glob=$enableval)
235AC_ARG_ENABLE(extended-glob-default, AS_HELP_STRING([--enable-extended-glob-default], [force extended pattern matching to be enabled by default]), opt_extglob_default=$enableval)
236AC_ARG_ENABLE(function-import, AS_HELP_STRING([--enable-function-import], [allow bash to import exported function definitions by default]), opt_function_import=$enableval)
237AC_ARG_ENABLE(glob-asciiranges-default, AS_HELP_STRING([--enable-glob-asciiranges-default], [force bracket range expressions in pattern matching to use the C locale by default]), opt_globascii_default=$enableval)
238AC_ARG_ENABLE(help-builtin, AS_HELP_STRING([--enable-help-builtin], [include the help builtin]), opt_help=$enableval)
239AC_ARG_ENABLE(history, AS_HELP_STRING([--enable-history], [turn on command history]), opt_history=$enableval)
240AC_ARG_ENABLE(job-control, AS_HELP_STRING([--enable-job-control], [enable job control features]), opt_job_control=$enableval)
241AC_ARG_ENABLE(multibyte, AS_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
242AC_ARG_ENABLE(net-redirections, AS_HELP_STRING([--enable-net-redirections], [enable /dev/tcp/host/port redirection]), opt_net_redirs=$enableval)
243AC_ARG_ENABLE(process-substitution, AS_HELP_STRING([--enable-process-substitution], [enable process substitution]), opt_process_subst=$enableval)
244AC_ARG_ENABLE(progcomp, AS_HELP_STRING([--enable-progcomp], [enable programmable completion and the complete builtin]), opt_progcomp=$enableval)
245AC_ARG_ENABLE(prompt-string-decoding, AS_HELP_STRING([--enable-prompt-string-decoding], [turn on escape character decoding in prompts]), opt_prompt_decoding=$enableval)
246AC_ARG_ENABLE(readline, AS_HELP_STRING([--enable-readline], [turn on command line editing]), opt_readline=$enableval)
247AC_ARG_ENABLE(restricted, AS_HELP_STRING([--enable-restricted], [enable a restricted shell]), opt_restricted=$enableval)
248AC_ARG_ENABLE(select, AS_HELP_STRING([--enable-select], [include select command]), opt_select=$enableval)
249AC_ARG_ENABLE(separate-helpfiles, AS_HELP_STRING([--enable-separate-helpfiles], [use external files for help builtin documentation]), opt_separate_help=$enableval)
250AC_ARG_ENABLE(single-help-strings, AS_HELP_STRING([--enable-single-help-strings], [store help documentation as a single string to ease translation]), opt_single_longdoc_strings=$enableval)
251AC_ARG_ENABLE(strict-posix-default, AS_HELP_STRING([--enable-strict-posix-default], [configure bash to be posix-conformant by default]), opt_strict_posix=$enableval)
006856ed 252AC_ARG_ENABLE(translatable-strings, AS_HELP_STRING([--enable-translatable-strings], [include support for $"..." translatable strings]), opt_translatable_strings=$enableval)
a67031fe
CR
253AC_ARG_ENABLE(usg-echo-default, AS_HELP_STRING([--enable-usg-echo-default], [a synonym for --enable-xpg-echo-default]), opt_xpg_echo=$enableval)
254AC_ARG_ENABLE(xpg-echo-default, AS_HELP_STRING([--enable-xpg-echo-default], [make the echo builtin expand escape sequences by default]), opt_xpg_echo=$enableval)
a7ad477f
CR
255
256dnl options that alter how bash is compiled and linked
a67031fe
CR
257AC_ARG_ENABLE(mem-scramble, AS_HELP_STRING([--enable-mem-scramble], [scramble memory on calls to malloc and free]), opt_memscramble=$enableval)
258AC_ARG_ENABLE(profiling, AS_HELP_STRING([--enable-profiling], [allow profiling with gprof]), opt_profiling=$enableval)
259AC_ARG_ENABLE(static-link, AS_HELP_STRING([--enable-static-link], [link bash statically, for use as a root shell]), opt_static_link=$enableval)
a7ad477f
CR
260
261dnl So-called `precious' variables
262AC_ARG_VAR([CC_FOR_BUILD], [C compiler used when compiling binaries used only at build time])
f886015a 263AC_ARG_VAR([CFLAGS_FOR_BUILD], [Compilation options (CFLAGS) used when compiling binaries used only at build time])
a7ad477f
CR
264AC_ARG_VAR([LDFLAGS_FOR_BUILD], [Linker options (LDFLAGS) used when compiling binaries used only at build time])
265AC_ARG_VAR([CPPFLAGS_FOR_BUILD], [C preprocessor options (CPPFLAGS) used when compiling binaries used only at build time])
266
267dnl opt_job_control is handled later, after BASH_JOB_CONTROL_MISSING runs
268
269dnl opt_readline and opt_history are handled later, because AC_PROG_CC needs
270dnl to be run before we can check the version of an already-installed readline
271dnl library
272
273if test $opt_alias = yes; then
274AC_DEFINE(ALIAS)
275fi
276if test $opt_dirstack = yes; then
277AC_DEFINE(PUSHD_AND_POPD)
278fi
279if test $opt_restricted = yes; then
280AC_DEFINE(RESTRICTED_SHELL)
281fi
282if test $opt_process_subst = yes; then
283AC_DEFINE(PROCESS_SUBSTITUTION)
284fi
285if test $opt_prompt_decoding = yes; then
286AC_DEFINE(PROMPT_STRING_DECODE)
287fi
288if test $opt_select = yes; then
289AC_DEFINE(SELECT_COMMAND)
290fi
291if test $opt_help = yes; then
292AC_DEFINE(HELP_BUILTIN)
293fi
294if test $opt_array_variables = yes; then
295AC_DEFINE(ARRAY_VARS)
296fi
297if test $opt_dparen_arith = yes; then
298AC_DEFINE(DPAREN_ARITHMETIC)
299fi
300if test $opt_brace_expansion = yes; then
301AC_DEFINE(BRACE_EXPANSION)
302fi
303if test $opt_disabled_builtins = yes; then
304AC_DEFINE(DISABLED_BUILTINS)
305fi
306if test $opt_command_timing = yes; then
307AC_DEFINE(COMMAND_TIMING)
308fi
309if test $opt_xpg_echo = yes ; then
310AC_DEFINE(DEFAULT_ECHO_TO_XPG)
311fi
312if test $opt_strict_posix = yes; then
313AC_DEFINE(STRICT_POSIX)
314fi
315if test $opt_extended_glob = yes ; then
316AC_DEFINE(EXTENDED_GLOB)
317fi
318if test $opt_extglob_default = yes; then
319AC_DEFINE(EXTGLOB_DEFAULT, 1)
320else
321AC_DEFINE(EXTGLOB_DEFAULT, 0)
322fi
323if test $opt_cond_command = yes ; then
324AC_DEFINE(COND_COMMAND)
325fi
326if test $opt_cond_regexp = yes ; then
327AC_DEFINE(COND_REGEXP)
328fi
329if test $opt_coproc = yes; then
330AC_DEFINE(COPROCESS_SUPPORT)
331fi
332if test $opt_arith_for_command = yes; then
333AC_DEFINE(ARITH_FOR_COMMAND)
334fi
335if test $opt_net_redirs = yes; then
336AC_DEFINE(NETWORK_REDIRECTIONS)
337fi
338if test $opt_progcomp = yes; then
339AC_DEFINE(PROGRAMMABLE_COMPLETION)
340fi
341if test $opt_multibyte = no; then
342AC_DEFINE(NO_MULTIBYTE_SUPPORT)
343fi
344if test $opt_debugger = yes; then
345AC_DEFINE(DEBUGGER)
346fi
347if test $opt_casemod_attrs = yes; then
348AC_DEFINE(CASEMOD_ATTRS)
349fi
350if test $opt_casemod_expansions = yes; then
351AC_DEFINE(CASEMOD_EXPANSIONS)
352fi
f14388d3
CR
353if test $opt_dircomplete_expand_default = yes; then
354AC_DEFINE(DIRCOMPLETE_EXPAND_DEFAULT)
355fi
c111d992
CR
356if test $opt_globascii_default = yes; then
357AC_DEFINE(GLOBASCII_DEFAULT, 1)
358else
359AC_DEFINE(GLOBASCII_DEFAULT, 0)
360fi
f3aad56d
CR
361if test $opt_function_import = yes; then
362AC_DEFINE(FUNCTION_IMPORT)
363fi
a57ed9e9
CR
364if test $opt_dev_fd_stat_broken = yes; then
365AC_DEFINE(DEV_FD_STAT_BROKEN)
366fi
a67031fe
CR
367if test $opt_alt_array_impl = yes; then
368AC_DEFINE(ALT_ARRAY_IMPLEMENTATION)
72206eb2 369ARRAY_O=array2.o
a67031fe 370fi
006856ed
CR
371if test $opt_translatable_strings = yes; then
372AC_DEFINE(TRANSLATABLE_STRINGS)
373fi
a7ad477f
CR
374
375if test $opt_memscramble = yes; then
376AC_DEFINE(MEMSCRAMBLE)
377fi
378
379if test "$opt_minimal_config" = yes; then
380 TESTSCRIPT=run-minimal
381else
382 TESTSCRIPT=run-all
383fi
384
385HELPDIR= HELPDIRDEFINE= HELPINSTALL= HELPFILES_TARGET=
386if test "$opt_separate_help" != no; then
387 if test "$opt_separate_help" = "yes" ; then
08871a77 388 HELPDIR='${datadir}/bash/helpfiles'
a7ad477f
CR
389 else
390 HELPDIR=$opt_separate_help
391 fi
392 HELPDIRDEFINE='-H ${HELPDIR}'
393 HELPINSTALL='install-help'
394 HELPFILES_TARGET='helpdoc'
395fi
396HELPSTRINGS=
397if test "$opt_single_longdoc_strings" != "yes"; then
398 HELPSTRINGS='-S'
399fi
400
401dnl now substitute in the values generated by arguments
402AC_SUBST(TESTSCRIPT)
a7ad477f
CR
403AC_SUBST(MALLOC_TARGET)
404AC_SUBST(MALLOC_SRC)
405
406AC_SUBST(MALLOC_LIB)
407AC_SUBST(MALLOC_LIBRARY)
408AC_SUBST(MALLOC_LDFLAGS)
409AC_SUBST(MALLOC_DEP)
410
72206eb2
CR
411AC_SUBST(ARRAY_O)
412
a7ad477f
CR
413AC_SUBST(htmldir)
414
415AC_SUBST(HELPDIR)
416AC_SUBST(HELPDIRDEFINE)
417AC_SUBST(HELPINSTALL)
418AC_SUBST(HELPFILES_TARGET)
419AC_SUBST(HELPSTRINGS)
420
8f50a023
CR
421dnl We want these before the checks, so the checks can modify their values.
422if test -z "$CFLAGS"; then
46305251 423 want_auto_cflags=1
8f50a023
CR
424fi
425
a7ad477f
CR
426echo ""
427echo "Beginning configuration for bash-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}"
428echo ""
429
430dnl compilation checks
431dnl AC_PROG_CC sets $cross_compiling to `yes' if cross-compiling for a
432dnl different environment
433AC_PROG_CC
434
46305251 435if test -n "$want_auto_cflags"; then
5a0e5b7b
CR
436 AUTO_CFLAGS="-g ${GCC:+-O2}"
437 AUTO_LDFLAGS="-g ${GCC:+-O2}"
a67031fe 438# STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security} ${GCC:+-Wno-tautological-constant-out-of-range-compare}"
5a0e5b7b 439 STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security}"
46305251
CR
440else
441 AUTO_CFLAGS= AUTO_LDFLAGS= STYLE_CFLAGS=
442fi
443
a7ad477f 444dnl test for Unix variants
a67031fe 445AC_USE_SYSTEM_EXTENSIONS
a7ad477f
CR
446AC_SYS_LARGEFILE
447
448dnl BEGIN changes for cross-building (currently cygwin, minGW, and
449dnl (obsolete) BeOS)
450
451SIGNAMES_O=
452SIGNAMES_H=lsignames.h
453
454dnl load up the cross-building cache file -- add more cases and cache
455dnl files as necessary
456
457dnl Note that host and target machine are the same, and different than the
458dnl build machine.
459dnl Set SIGNAMES_H based on whether or not we're cross-compiling.
460
461CROSS_COMPILE=
462if test "x$cross_compiling" = "xyes"; then
463 case "${host}" in
464 *-cygwin*)
465 cross_cache=${srcdir}/cross-build/cygwin32.cache
466 ;;
467 *-mingw*)
468 cross_cache=${srcdir}/cross-build/cygwin32.cache
469 ;;
470 i[[3456]]86-*-beos*)
471 cross_cache=${srcdir}/cross-build/x86-beos.cache
472 ;;
89149ec0
CR
473 *-qnx*)
474 cross_cache=${srcdir}/cross-build/qnx.cache
475 ;;
a7ad477f
CR
476 *) echo "configure: cross-compiling for $host is not supported" >&2
477 ;;
478 esac
479 if test -n "${cross_cache}" && test -r "${cross_cache}"; then
480 echo "loading cross-build cache file ${cross_cache}"
481 . ${cross_cache}
482 fi
483 unset cross_cache
484 SIGNAMES_O='signames.o'
485 CROSS_COMPILE='-DCROSS_COMPILING'
486 AC_SUBST(CROSS_COMPILE)
487fi
488AC_SUBST(SIGNAMES_H)
489AC_SUBST(SIGNAMES_O)
490
491dnl END changes for cross-building
492
a7ad477f
CR
493dnl default values
494CFLAGS=${CFLAGS-"$AUTO_CFLAGS"}
495# LDFLAGS=${LDFLAGS="$AUTO_LDFLAGS"} # XXX
496
497dnl handle options that alter how bash is compiled and linked
498dnl these must come after the test for cc/gcc
499if test "$opt_profiling" = "yes"; then
500 PROFILE_FLAGS=-pg
501 case "$host_os" in
eb2d46d7 502 solaris2*|linux*|darwin*) ;;
a7ad477f
CR
503 *) opt_static_link=yes ;;
504 esac
505 DEBUG= MALLOC_DEBUG=
506fi
507
508prefer_shared=yes
509prefer_static=no
510
511if test "$opt_static_link" = yes; then
512 prefer_static=yes
513 prefer_shared=no
514 # if we're using gcc, add `-static' to LDFLAGS, except on Solaris >= 2
a67031fe 515 if test "$GCC" = "yes"; then
a7ad477f
CR
516 STATIC_LD="-static"
517 case "$host_os" in
6a9e77e8
CR
518 solaris2*) ;;
519 linux*) test "$opt_profiling" = "no" && LDFLAGS="$LDFLAGS -static" ;;
a7ad477f
CR
520 *) LDFLAGS="$LDFLAGS -static" ;; # XXX experimental
521 esac
522 fi
523fi
524
525# set the appropriate make variables for building the "build tools"
526# modify defaults based on whether or not we are cross compiling, since the
527# options for the target host may not be appropriate for the build host
528if test "X$cross_compiling" = "Xno"; then
529 CC_FOR_BUILD=${CC_FOR_BUILD-'$(CC)'}
530 CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-"$CPPFLAGS"} # XXX - should it be '$(CPPFLAGS)'
216e2e9b
CR
531 if test X"$opt_profiling" = Xyes; then
532 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-'$(BASE_LDFLAGS)'}
533 else
534 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-'$(LDFLAGS)'}
535 fi
a7ad477f 536 # CFLAGS set above to default value if not passed in environment
46305251 537 if test -n "$want_auto_cflags" ; then
5a0e5b7b
CR
538 CFLAGS_FOR_BUILD="${CFLAGS}"
539 BASE_CFLAGS_FOR_BUILD="${CFLAGS}"
46305251 540 else
5a0e5b7b 541 # passed in environment
46305251 542 CFLAGS_FOR_BUILD=${CFLAGS-'$(CFLAGS)'}
5a0e5b7b 543 BASE_CFLAGS_FOR_BUILD=${CFLAGS-'$(CFLAGS)'}
46305251 544 fi
a7ad477f
CR
545 LIBS_FOR_BUILD=${LIBS_FOR_BUILD-'$(LIBS)'}
546else
547 CC_FOR_BUILD=${CC_FOR_BUILD-"gcc"}
548 CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-""}
549 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-""}
550 CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD="-g"}
5a0e5b7b 551 BASE_CFLAGS_FOR_BUILD=${BASE_CFLAGS_FOR_BUILD="-g"}
a7ad477f
CR
552 LIBS_FOR_BUILD=${LIBS_FOR_BUILD-""}
553fi
554
555AC_SUBST(CFLAGS)
556AC_SUBST(CPPFLAGS)
557AC_SUBST(LDFLAGS)
558AC_SUBST(STATIC_LD)
559
560AC_SUBST(CC_FOR_BUILD)
561AC_SUBST(CFLAGS_FOR_BUILD)
5a0e5b7b
CR
562AC_SUBST(BASE_CFLAGS_FOR_BUILD)
563AC_SUBST(STYLE_CFLAGS)
a7ad477f
CR
564AC_SUBST(CPPFLAGS_FOR_BUILD)
565AC_SUBST(LDFLAGS_FOR_BUILD)
566AC_SUBST(LIBS_FOR_BUILD)
567
568AC_PROG_GCC_TRADITIONAL
569
570dnl BEGIN READLINE and HISTORY LIBRARY SECTION
571dnl prepare to allow bash to be linked against an already-installed readline
572
573dnl first test that the readline version is new enough to link bash against
574if test "$opt_readline" = yes && test "$opt_with_installed_readline" != "no"
575then
576 # If the user specified --with-installed-readline=PREFIX and PREFIX
577 # is not `yes', set ac_cv_rl_prefix to PREFIX
578 test $opt_with_installed_readline != "yes" && ac_cv_rl_prefix=$opt_with_installed_readline
579
580 RL_LIB_READLINE_VERSION
581
582 case "$ac_cv_rl_version" in
12beeabf 583 8*|9*) ;;
a7ad477f
CR
584 *) opt_with_installed_readline=no
585 AC_MSG_WARN([installed readline library is too old to be linked with bash])
586 AC_MSG_WARN([using private bash version])
587 ;;
588 esac
589fi
590
591TILDE_LIB=-ltilde
592if test $opt_readline = yes; then
593 AC_DEFINE(READLINE)
594 if test "$opt_with_installed_readline" != "no" ; then
595 case "$opt_with_installed_readline" in
596 yes) RL_INCLUDE= ;;
597 *) case "$RL_INCLUDEDIR" in
598 /usr/include) ;;
599 *) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;;
600 esac
601 ;;
602 esac
603 READLINE_DEP=
604 READLINE_LIB=-lreadline
605 # section for OS versions that don't allow unresolved symbols
606 # to be compiled into dynamic libraries.
607 case "$host_os" in
608 cygwin*) TILDE_LIB= ;;
609 esac
610 else
611 RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
612 READLINE_DEP='$(READLINE_LIBRARY)'
613 # section for OS versions that ship an older/broken version of
614 # readline as a standard dynamic library and don't allow a
615 # static version specified as -llibname to override the
616 # dynamic version
617 case "${host_os}" in
618 darwin[[89]]*|darwin10*) READLINE_LIB='${READLINE_LIBRARY}' ;;
619 *) READLINE_LIB=-lreadline ;;
620 esac
621 fi
622else
623 RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
624 READLINE_LIB= READLINE_DEP=
625fi
626if test $opt_history = yes || test $opt_bang_history = yes; then
627 if test $opt_history = yes; then
628 AC_DEFINE(HISTORY)
629 fi
630 if test $opt_bang_history = yes; then
631 AC_DEFINE(BANG_HISTORY)
632 fi
633 if test "$opt_with_installed_readline" != "no"; then
634 HIST_LIBDIR=$RL_LIBDIR
635 HISTORY_DEP=
636 HISTORY_LIB=-lhistory
637 case "$opt_with_installed_readline" in
638 yes) RL_INCLUDE= ;;
639 *) case "$RL_INCLUDEDIR" in
640 /usr/include) ;;
641 *) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;;
642 esac
643 ;;
644 esac
645 else
646 HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
647 HISTORY_DEP='$(HISTORY_LIBRARY)'
648 # section for OS versions that ship an older version of
649 # readline as a standard dynamic library and don't allow a
650 # static version specified as -llibname to override the
651 # dynamic version
652 case "${host_os}" in
653 darwin[[89]]*|darwin10*) HISTORY_LIB='${HISTORY_LIBRARY}' ;;
654 *) HISTORY_LIB=-lhistory ;;
655 esac
656 fi
657else
658 HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
659 HISTORY_LIB= HISTORY_DEP=
660fi
661AC_SUBST(READLINE_LIB)
662AC_SUBST(READLINE_DEP)
663AC_SUBST(RL_LIBDIR)
664AC_SUBST(RL_INCLUDEDIR)
665AC_SUBST(RL_INCLUDE)
666AC_SUBST(HISTORY_LIB)
667AC_SUBST(HISTORY_DEP)
668AC_SUBST(HIST_LIBDIR)
669AC_SUBST(TILDE_LIB)
670
671dnl END READLINE and HISTORY LIBRARY SECTION
672
673dnl programs needed by the build and install process
674AC_PROG_INSTALL
208fdb50 675AC_CHECK_TOOL(AR, ar)
a7ad477f
CR
676dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
677dnl This allows people to set it when running configure or make
678test -n "$ARFLAGS" || ARFLAGS="cr"
679AC_PROG_RANLIB
680AC_PROG_YACC
681AC_PROG_MAKE_SET
682
41d203e2
CR
683case "$ac_cv_prog_YACC" in
684*bison*) ;;
685*) AC_MSG_WARN([bison not available; needed to process parse.y]) ;;
686esac
687
a7ad477f
CR
688case "$host_os" in
689opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
690*) MAKE_SHELL=/bin/sh ;;
691esac
692AC_SUBST(MAKE_SHELL)
693
694dnl this is similar to the expanded AC_PROG_RANLIB
695if test x$SIZE = x; then
696 if test x$ac_tool_prefix = x; then
697 SIZE=size
698 else
699 SIZE=${ac_tool_prefix}size
700 save_IFS=$IFS ; IFS=:
701 size_found=0
702 for dir in $PATH; do
703 if test -x $dir/$SIZE ; then
704 size_found=1
705 break
706 fi
707 done
708 if test $size_found -eq 0; then
709 SIZE=:
710 fi
711 IFS=$save_IFS
712 fi
713fi
714AC_SUBST(SIZE)
715
716m4_include([m4/stat-time.m4])
717m4_include([m4/timespec.m4])
718
3be2a2ca
CR
719m4_include([m4/strtoimax.m4])
720
be4078d2
CR
721dnl include files for gettext
722
723m4_include([m4/codeset.m4])
724m4_include([m4/extern-inline.m4])
50ffbc9d
CR
725
726m4_include([m4/bison.m4])
be4078d2 727m4_include([m4/fcntl-o.m4])
50ffbc9d 728m4_include([m4/flexmember.m4])
be4078d2
CR
729m4_include([m4/gettext.m4])
730m4_include([m4/glibc2.m4])
be4078d2
CR
731m4_include([m4/iconv.m4])
732m4_include([m4/intdiv0.m4])
733m4_include([m4/intl.m4])
734m4_include([m4/intlmacosx.m4])
735m4_include([m4/intl-thread-locale.m4])
736m4_include([m4/intmax.m4])
737m4_include([m4/inttypes-pri.m4])
738m4_include([m4/inttypes.m4])
739m4_include([m4/inttypes_h.m4])
740m4_include([m4/lcmessage.m4])
741m4_include([m4/lib-ld.m4])
742m4_include([m4/lib-link.m4])
743m4_include([m4/lib-prefix.m4])
50ffbc9d 744m4_include([m4/locale_h.m4])
be4078d2
CR
745m4_include([m4/lock.m4])
746m4_include([m4/nls.m4])
747m4_include([m4/po.m4])
748m4_include([m4/printf-posix.m4])
749m4_include([m4/progtest.m4])
9e48f856 750m4_include([m4/pthread_rwlock_rdlock.m4])
be4078d2
CR
751m4_include([m4/size_max.m4])
752m4_include([m4/stdint_h.m4])
753m4_include([m4/threadlib.m4])
754m4_include([m4/uintmax_t.m4])
755m4_include([m4/ulonglong.m4])
756m4_include([m4/visibility.m4])
757m4_include([m4/wchar_t.m4])
758m4_include([m4/wint_t.m4])
759m4_include([m4/xsize.m4])
760
50ffbc9d
CR
761m4_include([m4/glibc21.m4])
762m4_include([m4/host-cpu-c-abi.m4])
763
a7ad477f
CR
764dnl C compiler characteristics
765AC_C_CONST
766AC_C_INLINE
767AC_C_BIGENDIAN
768AC_C_STRINGIZE
a67031fe 769AC_TYPE_LONG_DOUBLE
a7ad477f
CR
770AC_C_CHAR_UNSIGNED
771AC_C_VOLATILE
772AC_C_RESTRICT
773
774dnl initialize GNU gettext
50ffbc9d
CR
775dnl the use-libtool is a lie, we just use the standard Unix tools
776BASH_GNU_GETTEXT([use-libtool], [need-ngettext], [lib/intl])
a7ad477f
CR
777
778dnl header files
779AC_HEADER_DIRENT
5e061bb0 780AC_HEADER_MAJOR
a7ad477f
CR
781
782BASH_HEADER_INTTYPES
783
d267701a 784AC_CHECK_HEADERS(unistd.h stdlib.h varargs.h limits.h string.h \
a7ad477f
CR
785 memory.h locale.h termcap.h termio.h termios.h dlfcn.h \
786 stdbool.h stddef.h stdint.h netdb.h pwd.h grp.h strings.h \
787 regex.h syslog.h ulimit.h)
48abf0fd 788AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h sys/ioctl.h \
e76c7327 789 sys/mman.h sys/param.h sys/random.h sys/socket.h sys/stat.h \
a7ad477f
CR
790 sys/time.h sys/times.h sys/types.h sys/wait.h)
791AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)
792
793dnl sys/ptem.h requires definitions from sys/stream.h on systems where it
794dnl exists
795AC_CHECK_HEADER(sys/ptem.h, , ,[[
796#if HAVE_SYS_STREAM_H
797# include <sys/stream.h>
798#endif
799]])
800
07357ec2
CR
801dnl SunOS 4 needs to include <sys/time.h> before <sys/resource.h> to compile
802dnl autoconf complains about presence but inability to compile
803AC_CHECK_HEADER(sys/resource.h, AC_DEFINE(HAVE_SYS_RESOURCE_H), [], [[
804#if HAVE_SYS_TIME_H
805# include <sys/time.h>
806#endif
807]])
808
a7ad477f
CR
809dnl special checks for libc functions
810AC_FUNC_ALLOCA
03d922b1 811AC_FUNC_CHOWN
a7ad477f 812AC_FUNC_GETPGRP
a7ad477f
CR
813AC_FUNC_VPRINTF
814AC_FUNC_STRCOLL
815
816dnl if we're not using the bash malloc but require the C alloca, set things
817dnl up to build a libmalloc.a containing only alloca.o
818
819if test "$ac_cv_func_alloca_works" = "no" && test "$opt_bash_malloc" = "no"; then
820 MALLOC_TARGET=alloca
821 MALLOC_SRC=alloca.c
822
823 MALLOC_LIB='-lmalloc'
824 MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
825 MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
826 MALLOC_DEP='$(MALLOC_LIBRARY)'
827fi
828
829dnl if vprintf is not in libc, see if it's defined in stdio.h
830if test "$ac_cv_func_vprintf" = no; then
831 AC_MSG_CHECKING(for declaration of vprintf in stdio.h)
832 AC_EGREP_HEADER([[int[ ]*vprintf[^a-zA-Z0-9]]],stdio.h,ac_cv_func_vprintf=yes)
833 AC_MSG_RESULT($ac_cv_func_vprintf)
834 if test $ac_cv_func_vprintf = yes; then
835 AC_DEFINE(HAVE_VPRINTF)
836 fi
837fi
838
839if test "$ac_cv_func_vprintf" = no && test "$ac_cv_func__doprnt" = "yes"; then
840 AC_LIBOBJ(vprint)
841fi
842
a7ad477f
CR
843dnl checks for certain version-specific system calls and libc functions
844AC_CHECK_FUNC(__setostype, AC_DEFINE(HAVE_SETOSTYPE))
845AC_CHECK_FUNC(wait3, AC_DEFINE(HAVE_WAIT3))
846
847dnl checks for missing libc functions
44107840 848AC_CHECK_FUNC(mkfifo, AC_DEFINE(HAVE_MKFIFO), AC_DEFINE(MKFIFO_MISSING))
a7ad477f
CR
849
850dnl checks for system calls
e76c7327
CR
851AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getentropy getgroups \
852 gethostname getpagesize getpeername getrandom getrlimit \
6a9e77e8
CR
853 getrusage gettimeofday kill killpg lstat nanosleep \
854 pselect readlink \
e76c7327 855 select setdtablesize setitimer tcgetpgrp uname ulimit waitpid)
a7ad477f
CR
856AC_REPLACE_FUNCS(rename)
857
858dnl checks for c library functions
fc29a024 859AC_CHECK_FUNCS(bcopy bzero clock_gettime confstr faccessat fnmatch \
a7ad477f 860 getaddrinfo gethostbyname getservbyname getservent inet_aton \
e6f5e0c8 861 imaxdiv memmove pathconf putenv raise random regcomp regexec \
a7ad477f
CR
862 setenv setlinebuf setlocale setvbuf siginterrupt strchr \
863 sysconf syslog tcgetattr times ttyname tzset unsetenv)
864
865AC_CHECK_FUNCS(vasprintf asprintf)
866AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
867AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
befdddcb 868AC_CHECK_FUNCS(mkstemp mkdtemp)
376c9fe5 869AC_CHECK_FUNCS(arc4random)
d06fefb2
CR
870AC_CHECK_FUNCS(strlcat)
871
872AC_CHECK_FUNCS(memfd_create shm_open shm_mkstemp)
376c9fe5 873
a7ad477f
CR
874AC_REPLACE_FUNCS(getcwd memset)
875AC_REPLACE_FUNCS(strcasecmp strcasestr strerror strftime strnlen strpbrk strstr)
3be2a2ca 876AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoumax)
a7ad477f
CR
877AC_REPLACE_FUNCS(dprintf)
878AC_REPLACE_FUNCS(strchrnul)
67440bc5 879AC_REPLACE_FUNCS(strdup)
d06fefb2 880AC_REPLACE_FUNCS(strlcpy)
a7ad477f 881
dcb2f448 882AC_CHECK_HEADERS(libaudit.h)
a7ad477f
CR
883AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
884
885AC_CHECK_DECLS([confstr])
886AC_CHECK_DECLS([printf])
55a224da 887AC_CHECK_DECLS([brk])
a7ad477f
CR
888AC_CHECK_DECLS([sbrk])
889AC_CHECK_DECLS([setregid])
890AC_CHECK_DECLS([strcpy])
891AC_CHECK_DECLS([strsignal])
892
db26b1cf
CR
893AC_CHECK_FUNCS(setresuid setresgid)
894
a7ad477f
CR
895dnl Extra test to detect the horribly broken HP/UX 11.00 strtold(3)
896AC_CHECK_DECLS([strtold], [
897 AC_MSG_CHECKING([for broken strtold])
898 AC_CACHE_VAL(bash_cv_strtold_broken,
44107840
CR
899 [AC_COMPILE_IFELSE(
900 [AC_LANG_PROGRAM(
901 [[#include <stdlib.h>]],
55a224da 902 [[long double r; char *foo, *bar; r = strtold(foo, &bar);]]
44107840
CR
903 )],
904 [bash_cv_strtold_broken=no],[bash_cv_strtold_broken=yes])
905 ]
a7ad477f
CR
906 )
907 AC_MSG_RESULT($bash_cv_strtold_broken)
908 if test "$bash_cv_strtold_broken" = "yes" ; then
909 AC_DEFINE(STRTOLD_BROKEN)
910 fi
911])
912
44107840
CR
913AC_CHECK_DECLS(strtol)
914AC_CHECK_DECLS(strtoll)
915AC_CHECK_DECLS(strtoul)
916AC_CHECK_DECLS(strtoull)
917AC_CHECK_DECLS(strtoumax)
a7ad477f
CR
918
919AC_FUNC_MKTIME
920
921dnl
922dnl Checks for lib/intl and related code (uses some of the output from
70a158ed 923dnl BASH_GNU_GETTEXT)
a7ad477f
CR
924dnl
925
926AC_CHECK_HEADERS([argz.h errno.h fcntl.h malloc.h stdio_ext.h])
927
928dnl AC_FUNC_MALLOC
50ffbc9d 929AC_DEFINE([HAVE_MALLOC])
a7ad477f 930AC_FUNC_MMAP
b64a7d8c
CR
931AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify dcgettext \
932 locale_charset mempcpy \
d58f7f88 933 munmap mremap stpcpy strcspn])
a7ad477f
CR
934
935INTL_DEP= INTL_INC= LIBINTL_H=
936if test "x$USE_INCLUDED_LIBINTL" = "xyes"; then
937 INTL_DEP='${INTL_LIBDIR}/libintl.a'
938 INTL_INC='-I${INTL_LIBSRC} -I${INTL_BUILDDIR}'
939 LIBINTL_H='${INTL_BUILDDIR}/libintl.h'
b64a7d8c
CR
940
941 AC_DEFINE([HAVE_LOCALE_CHARSET], 1)
a7ad477f
CR
942fi
943AC_SUBST(INTL_DEP)
944AC_SUBST(INTL_INC)
945AC_SUBST(LIBINTL_H)
946
947dnl
948dnl End of checks needed by files in lib/intl
949dnl
950
951BASH_CHECK_MULTIBYTE
952
953dnl checks for the dynamic loading library functions in libc and libdl
954if test "$opt_static_link" != yes; then
955AC_CHECK_LIB(dl, dlopen)
956AC_CHECK_FUNCS(dlopen dlclose dlsym)
957fi
958
a7ad477f
CR
959dnl network functions -- check for inet_aton again
960if test "$ac_cv_func_inet_aton" != 'yes'; then
961BASH_FUNC_INET_ATON
962fi
963
964dnl libraries
965dnl this is reportedly no longer necessary for irix[56].?
966case "$host_os" in
967irix4*) AC_CHECK_LIB(sun, getpwent) ;;
968esac
969
970dnl check for getpeername in the socket library only if it's not in libc
971if test "$ac_cv_func_getpeername" = no; then
972 BASH_CHECK_LIB_SOCKET
973fi
974dnl check for gethostbyname in socket libraries if it's not in libc
975if test "$ac_cv_func_gethostbyname" = no; then
976 BASH_FUNC_GETHOSTBYNAME
977fi
978
979dnl system types
980AC_TYPE_GETGROUPS
981AC_TYPE_OFF_T
982AC_TYPE_MODE_T
983AC_TYPE_UID_T
984AC_TYPE_PID_T
985AC_TYPE_SIZE_T
727e92c8 986AC_TYPE_INTPTR_T
f8c5768e
CR
987AC_TYPE_UINTPTR_T
988
a7ad477f
CR
989AC_CHECK_TYPE(ssize_t, int)
990AC_CHECK_TYPE(time_t, long)
991
44107840
CR
992AC_TYPE_LONG_LONG_INT
993AC_TYPE_UNSIGNED_LONG_LONG_INT
a7ad477f 994
a7ad477f
CR
995BASH_TYPE_SIG_ATOMIC_T
996
997AC_CHECK_SIZEOF(char, 1)
998AC_CHECK_SIZEOF(short, 2)
999AC_CHECK_SIZEOF(int, 4)
1000AC_CHECK_SIZEOF(long, 4)
1001AC_CHECK_SIZEOF(char *, 4)
220a95cd 1002AC_CHECK_SIZEOF(size_t, 4)
a7ad477f
CR
1003AC_CHECK_SIZEOF(double, 8)
1004AC_CHECK_SIZEOF([long long], 8)
1005
1006AC_CHECK_TYPE(u_int, [unsigned int])
1007AC_CHECK_TYPE(u_long, [unsigned long])
1008
1009BASH_TYPE_BITS16_T
1010BASH_TYPE_U_BITS16_T
1011BASH_TYPE_BITS32_T
1012BASH_TYPE_U_BITS32_T
1013BASH_TYPE_BITS64_T
1014
1015BASH_TYPE_PTRDIFF_T
1016
1017dnl structures
1018AC_HEADER_STAT
1019
1020dnl system services
1021AC_SYS_INTERPRETER
1022if test $ac_cv_sys_interpreter = yes; then
1023AC_DEFINE(HAVE_HASH_BANG_EXEC)
1024fi
1025
1026dnl Miscellaneous Bash tests
1027if test "$ac_cv_func_lstat" = "no"; then
1028BASH_FUNC_LSTAT
1029fi
1030
1031dnl behavior of system calls and library functions
a7ad477f
CR
1032BASH_FUNC_DUP2_CLOEXEC_CHECK
1033BASH_SYS_PGRP_SYNC
1034BASH_SYS_SIGNAL_VINTAGE
1035
1036dnl checking for the presence of certain library symbols
1037BASH_SYS_ERRLIST
1038BASH_SYS_SIGLIST
1039BASH_UNDER_SYS_SIGLIST
1040
1041dnl various system types
a7ad477f
CR
1042BASH_CHECK_TYPE(clock_t, [#include <sys/times.h>], long)
1043BASH_CHECK_TYPE(sigset_t, [#include <signal.h>], int)
a7ad477f 1044if test "$ac_cv_header_sys_socket_h" = "yes"; then
c2fa6583 1045BASH_CHECK_TYPE(socklen_t, [#include <sys/socket.h>], [unsigned int], HAVE_SOCKLEN_T)
a7ad477f 1046fi
44107840
CR
1047
1048AC_CHECK_TYPE(quad_t, AC_DEFINE([HAVE_QUAD_T], [1]), [], )
a7ad477f
CR
1049BASH_TYPE_RLIMIT
1050
44107840
CR
1051AC_TYPE_INTMAX_T
1052AC_TYPE_UINTMAX_T
1053
a7ad477f
CR
1054AC_CHECK_SIZEOF(intmax_t, 8)
1055
1056dnl presence and contents of structures used by system calls
1057BASH_STRUCT_TERMIOS_LDISC
1058BASH_STRUCT_TERMIO_LDISC
1059BASH_STRUCT_DIRENT_D_INO
1060BASH_STRUCT_DIRENT_D_FILENO
1061BASH_STRUCT_DIRENT_D_NAMLEN
1062BASH_STRUCT_WINSIZE
1063BASH_STRUCT_TIMEVAL
1064AC_CHECK_MEMBERS([struct stat.st_blocks])
1065AC_STRUCT_TM
1066AC_STRUCT_TIMEZONE
1067BASH_STRUCT_TIMEZONE
1068
1069BASH_STRUCT_WEXITSTATUS_OFFSET
1070
1071BASH_CHECK_TYPE_STRUCT_TIMESPEC
1072BASH_STAT_TIME
1073
216e2e9b
CR
1074dnl checks for system calls
1075BASH_FUNC_SBRK
55a224da 1076BASH_FUNC_BRK
216e2e9b 1077
a7ad477f
CR
1078dnl presence and behavior of C library functions
1079BASH_FUNC_STRSIGNAL
1080BASH_FUNC_OPENDIR_CHECK
1081BASH_FUNC_ULIMIT_MAXFDS
1082BASH_FUNC_FPURGE
1083BASH_FUNC_GETENV
1084if test "$ac_cv_func_getcwd" = "yes"; then
1085BASH_FUNC_GETCWD
1086fi
50ffbc9d
CR
1087dnl either way this is correct
1088AC_DEFINE([HAVE_GETCWD])
a7ad477f
CR
1089BASH_FUNC_POSIX_SETJMP
1090BASH_FUNC_STRCOLL
1091BASH_FUNC_SNPRINTF
1092BASH_FUNC_VSNPRINTF
1093
3be2a2ca
CR
1094BASH_FUNC_STRTOIMAX
1095
a7ad477f
CR
1096dnl If putenv or unsetenv is not present, set the right define so the
1097dnl prototype and declaration in lib/sh/getenv.c will be standard-conformant
1098
1099if test "$ac_cv_func_putenv" = "yes"; then
1100BASH_FUNC_STD_PUTENV
1101else
1102AC_DEFINE(HAVE_STD_PUTENV)
1103fi
1104if test "$ac_cv_func_unsetenv" = "yes"; then
1105BASH_FUNC_STD_UNSETENV
1106else
1107AC_DEFINE(HAVE_STD_UNSETENV)
1108fi
1109
1110BASH_FUNC_PRINTF_A_FORMAT
1111
3669b0ba
CR
1112BASH_FUNC_FNMATCH_EQUIV_FALLBACK
1113
a7ad477f
CR
1114dnl presence and behavior of OS functions
1115BASH_SYS_REINSTALL_SIGHANDLERS
1116BASH_SYS_JOB_CONTROL_MISSING
1117BASH_SYS_NAMED_PIPES
1118
1119dnl presence of certain CPP defines
1120AC_HEADER_TIOCGWINSZ
1121BASH_HAVE_TIOCSTAT
1122BASH_HAVE_FIONREAD
1123
1124BASH_CHECK_WCONTINUED
1125
1126dnl miscellaneous
1127BASH_CHECK_SPEED_T
1128BASH_CHECK_GETPW_FUNCS
1129BASH_CHECK_RTSIGS
1130BASH_CHECK_SYS_SIGLIST
1131
1132dnl special checks
1133case "$host_os" in
1134hpux*) BASH_CHECK_KERNEL_RLIMIT ;;
1135esac
1136
1137if test "$opt_readline" = yes; then
1138dnl yuck
1139case "$host_os" in
1140aix*) prefer_curses=yes ;;
1141esac
1142BASH_CHECK_LIB_TERMCAP
1143fi
1144AC_SUBST(TERMCAP_LIB)
1145AC_SUBST(TERMCAP_DEP)
1146
1147BASH_CHECK_DEV_FD
1148BASH_CHECK_DEV_STDIN
1149BASH_SYS_DEFAULT_MAIL_DIR
1150
1151if test "$bash_cv_job_control_missing" = missing; then
1152 opt_job_control=no
1153fi
1154
1155if test "$opt_job_control" = yes; then
1156AC_DEFINE(JOB_CONTROL)
1157JOBS_O=jobs.o
1158else
1159JOBS_O=nojobs.o
1160fi
1161
1162AC_SUBST(JOBS_O)
1163
1164dnl Defines that we want to propagate to the Makefiles in subdirectories,
1165dnl like glob and readline
1166
1167LOCAL_DEFS=-DSHELL
1168
1169dnl use this section to possibly define more cpp variables, specify local
1170dnl libraries, and specify any additional local cc or ld flags
1171dnl
d37a4722 1172dnl most of these are really old; this should really go away someday
a7ad477f
CR
1173
1174case "${host_os}" in
1175sysv4.2*) AC_DEFINE(SVR4_2)
1176 AC_DEFINE(SVR4) ;;
1177sysv4*) AC_DEFINE(SVR4) ;;
1178sysv5*) AC_DEFINE(SVR5) ;;
969496e5
CR
1179hpux9*) LOCAL_CFLAGS="-DHPUX9 -DHPUX -DTGETENT_BROKEN -DTGETFLAG_BROKEN" ;;
1180hpux*) LOCAL_CFLAGS="-DHPUX -DTGETENT_BROKEN -DTGETFLAG_BROKEN" ;;
a7ad477f
CR
1181dgux*) LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
1182isc*) LOCAL_CFLAGS=-Disc386 ;;
1183rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
1184darwin*) LOCAL_CFLAGS=-DMACOSX ;;
1185sco3.2v5*) LOCAL_CFLAGS="-b elf -DWAITPID_BROKEN -DPATH_MAX=1024" ;;
1186sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
1187sco3.2*) LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
1188sunos4*) LOCAL_CFLAGS=-DSunOS4 ;;
1189solaris2.5*) LOCAL_CFLAGS="-DSunOS5 -DSOLARIS" ;;
1190solaris2.8*) LOCAL_CFLAGS=-DSOLARIS ;;
1191solaris2.9*) LOCAL_CFLAGS=-DSOLARIS ;;
1192solaris2.10*) LOCAL_CFLAGS=-DSOLARIS ;;
1193solaris2*) LOCAL_CFLAGS=-DSOLARIS ;;
1194lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
1195linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
1196 case "`uname -r`" in
e297b059
CR
1197 1.*|2.[[0123]]*) : ;;
1198 *) AC_DEFINE(PGRP_PIPE) ;;
a7ad477f 1199 esac ;;
9282e182 1200netbsd*|openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
e58dc557 1201freebsd*|midnightbsd*) LOCAL_CFLAGS='-DHEREDOC_PIPESIZE=4096' ;;
89149ec0 1202*qnx[[67]]*) LOCAL_LIBS="-lncurses" ;;
a7ad477f
CR
1203*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
1204powerux*) LOCAL_LIBS="-lgen" ;;
1205cygwin*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
1206opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO -D_POSIX_SOURCE -D_ALL_SOURCE -DRECYCLES_PIDS" ;;
10e78433 1207*openstep*) LOCAL_CFLAGS="-D__APPLE_CC__" ;;
a7ad477f
CR
1208esac
1209
1210dnl Stanza for OS/compiler pair-specific flags
1211case "${host_os}-${CC}" in
1212aix4.2*-*gcc*) LOCAL_LDFLAGS="-Xlinker -bexpall -Xlinker -brtl" ;;
1213aix4.2*) LOCAL_LDFLAGS="-bexpall -brtl" ;;
1214bsdi4*-*gcc*) LOCAL_LDFLAGS="-rdynamic" ;; # allow dynamic loading, like Linux
f542be5d
CR
1215bsdi5*-*gcc*) LOCAL_LDFLAGS="-rdynamic" ;; # allow dynamic loading, like Linux
1216hpux11*-gcc*) LOCAL_LDFLAGS="-Wl,-E" ;; # allow dynamic loading
a7ad477f
CR
1217esac
1218
1219dnl FreeBSD-3.x can have either a.out or ELF
1220case "${host_os}" in
1221freebsd[[3-9]]*)
1222 if test -x /usr/bin/objformat && test "`/usr/bin/objformat`" = "elf" ; then
1223 LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
1224 fi ;;
49918d90
CR
1225freebsd*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
1226openbsd*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
1227netbsd*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
a7ad477f 1228dragonfly*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
e58dc557 1229midnightbsd*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
a7ad477f
CR
1230esac
1231
1232case "$host_cpu" in
1233*cray*) LOCAL_CFLAGS="-DCRAY" ;; # shell var so config.h can use it
1234esac
1235
1236case "$host_cpu-$host_os" in
1237ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
1238esac
1239
1240case "$host_cpu-$host_vendor-$host_os" in
1241m88k-motorola-sysv3) LOCAL_CFLAGS=-DWAITPID_BROKEN ;;
1242mips-pyramid-sysv4) LOCAL_CFLAGS=-Xa ;;
1243esac
1244
9d80be9a 1245# turn off paren warnings in gcc
5a0e5b7b 1246#CFLAGS="$CFLAGS ${STYLE_CFLAGS}"
9d80be9a 1247
a7ad477f
CR
1248#
1249# Shared object configuration section. These values are generated by
1250# ${srcdir}/support/shobj-conf
1251#
1252if test "$ac_cv_func_dlopen" = "yes" && test -f ${srcdir}/support/shobj-conf
1253then
1254 AC_MSG_CHECKING(shared object configuration for loadable builtins)
1255 eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c "${host_cpu}" -o "${host_os}" -v "${host_vendor}"`
1256 AC_SUBST(SHOBJ_CC)
1257 AC_SUBST(SHOBJ_CFLAGS)
1258 AC_SUBST(SHOBJ_LD)
1259 AC_SUBST(SHOBJ_LDFLAGS)
1260 AC_SUBST(SHOBJ_XLDFLAGS)
1261 AC_SUBST(SHOBJ_LIBS)
1262 AC_SUBST(SHOBJ_STATUS)
1263 AC_MSG_RESULT($SHOBJ_STATUS)
ff293129
CR
1264else
1265 SHOBJ_STATUS=unsupported
1266 AC_SUBST(SHOBJ_STATUS)
a7ad477f
CR
1267fi
1268
1269# try to create a directory tree if the source is elsewhere
1270# this should be packaged into a script accessible via ${srcdir}/support
1271case "$srcdir" in
1272.) ;;
1273*) for d in doc tests support lib examples; do # dirs
1274 test -d $d || mkdir $d
1275 done
1276 for ld in readline glob tilde malloc sh termcap; do # libdirs
1277 test -d lib/$ld || mkdir lib/$ld
1278 done
1279 test -d examples/loadables || mkdir examples/loadables # loadable builtins
1280 test -d examples/loadables/perl || mkdir examples/loadables/perl
1281 ;;
1282esac
1283
1284BUILD_DIR=`pwd`
1285case "$BUILD_DIR" in
1286*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
1287*) ;;
1288esac
1289
1290if test -z "$localedir"; then
1291 localedir='${datarootdir}/locale'
1292fi
1293if test -z "$datarootdir"; then
1294 datarootdir='${prefix}/share'
1295fi
1296
1297AC_SUBST(PROFILE_FLAGS)
1298
1299AC_SUBST(incdir)
1300AC_SUBST(BUILD_DIR)
1301
1302# Some versions of autoconf don't substitute these automatically
1303AC_SUBST(datarootdir)
1304AC_SUBST(localedir)
1305
f2d7e1a3
CR
1306# directory where we install dynamically loadable builtins
1307if test -z "$loadablesdir"; then
1308 loadablesdir='${libdir}/bash'
1309fi
1310AC_SUBST(loadablesdir)
4eb81d59
CR
1311if test -z "$headersdir"; then
1312 headersdir='$(includedir)/$(PACKAGE_NAME)'
1313fi
1314AC_SUBST(headersdir)
f2d7e1a3 1315
a7ad477f
CR
1316AC_SUBST(YACC)
1317AC_SUBST(AR)
1318AC_SUBST(ARFLAGS)
1319
1320AC_SUBST(BASHVERS)
1321AC_SUBST(RELSTATUS)
1322AC_SUBST(DEBUG)
1323AC_SUBST(MALLOC_DEBUG)
1324
1325AC_SUBST(host_cpu)
1326AC_SUBST(host_vendor)
1327AC_SUBST(host_os)
1328
1329AC_SUBST(LOCAL_LIBS)
1330AC_SUBST(LOCAL_CFLAGS)
1331AC_SUBST(LOCAL_LDFLAGS)
1332AC_SUBST(LOCAL_DEFS)
1333
1334#AC_SUBST(ALLOCA_SOURCE)
1335#AC_SUBST(ALLOCA_OBJECT)
1336
a67031fe
CR
1337AC_CONFIG_FILES([Makefile builtins/Makefile lib/readline/Makefile \
1338 lib/glob/Makefile lib/intl/Makefile \
1339 lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \
1340 lib/tilde/Makefile doc/Makefile support/Makefile \
1341 po/Makefile.in examples/loadables/Makefile \
1342 examples/loadables/Makefile.inc \
f9ed510a 1343 examples/loadables/Makefile.sample \
a67031fe
CR
1344 examples/loadables/perl/Makefile \
1345 support/bash.pc support/bashbug.sh])
1346
1347dnl Makefile uses this timestamp file to record whether config.h is up to date.
1348AC_CONFIG_COMMANDS([stamp-h], [echo timestamp > stamp-h])
1349
1350AC_OUTPUT