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