blob: d7e09983c77b3f6a9bbf61b444c05b6c97805612 [file] [log] [blame]
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001dnl
Chet Ramey495aee42011-11-22 19:11:26 -05002dnl Configure script for bash-4.2
Jari Aaltoccc6cda1996-12-23 17:02:34 +00003dnl
4dnl report bugs to chet@po.cwru.edu
5dnl
6dnl Process this file with autoconf to produce a configure script.
Jari Aaltod166f041997-06-05 14:59:13 +00007
Chet Ramey495aee42011-11-22 19:11:26 -05008# Copyright (C) 1987-2011 Free Software Foundation, Inc.
Jari Aaltoccc6cda1996-12-23 17:02:34 +00009
Jari Aalto31859422009-01-12 13:36:28 +000010#
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/>.
Jari Aaltof73dda02001-11-13 17:56:06 +000023
Chet Ramey495aee42011-11-22 19:11:26 -050024AC_REVISION([for Bash 4.2, version 4.037])dnl
Jari Aaltof73dda02001-11-13 17:56:06 +000025
Chet Ramey495aee42011-11-22 19:11:26 -050026define(bashvers, 4.2)
Jari Aalto17345e52009-02-19 22:21:29 +000027define(relstatus, release)
Jari Aaltob80f6442004-07-27 13:29:18 +000028
Jari Aalto06285672006-10-10 14:15:34 +000029AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
Jari Aaltoccc6cda1996-12-23 17:02:34 +000030
31dnl make sure we are using a recent autoconf version
Jari Aaltof73dda02001-11-13 17:56:06 +000032AC_PREREQ(2.50)
Jari Aaltoccc6cda1996-12-23 17:02:34 +000033
Jari Aaltof73dda02001-11-13 17:56:06 +000034AC_CONFIG_SRCDIR(shell.h)
Jari Aaltoccc6cda1996-12-23 17:02:34 +000035dnl where to find install.sh, config.sub, and config.guess
36AC_CONFIG_AUX_DIR(./support)
Jari Aaltof73dda02001-11-13 17:56:06 +000037AC_CONFIG_HEADERS(config.h)
38
39dnl checks for version info
Jari Aaltob80f6442004-07-27 13:29:18 +000040BASHVERS=bashvers
41RELSTATUS=relstatus
Jari Aalto7117c2d2002-07-17 14:10:11 +000042
43dnl defaults for debug settings
44case "$RELSTATUS" in
Jari Aalto31859422009-01-12 13:36:28 +000045alp*|bet*|dev*|rc*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
Jari Aalto7117c2d2002-07-17 14:10:11 +000046*) DEBUG= MALLOC_DEBUG= ;;
47esac
Jari Aaltoccc6cda1996-12-23 17:02:34 +000048
49dnl canonicalize the host and os so we can do some tricky things before
50dnl parsing options
51AC_CANONICAL_HOST
52
53dnl configure defaults
Jari Aaltobb706242000-03-17 21:46:59 +000054opt_bash_malloc=yes
Jari Aaltoccc6cda1996-12-23 17:02:34 +000055opt_purify=no
Jari Aaltod166f041997-06-05 14:59:13 +000056opt_purecov=no
Jari Aaltoccc6cda1996-12-23 17:02:34 +000057opt_afs=no
Jari Aaltod166f041997-06-05 14:59:13 +000058opt_curses=no
Jari Aaltob72432f1999-02-19 17:11:39 +000059opt_with_installed_readline=no
Jari Aaltoccc6cda1996-12-23 17:02:34 +000060
Jari Aaltobb706242000-03-17 21:46:59 +000061#htmldir=
62
Jari Aalto28ef6c32001-04-06 19:14:31 +000063dnl some systems should be configured without the bash malloc by default
Jari Aaltoccc6cda1996-12-23 17:02:34 +000064dnl and some need a special compiler or loader
65dnl look in the NOTES file for more
66case "${host_cpu}-${host_os}" in
Jari Aaltobb706242000-03-17 21:46:59 +000067alpha*-*) opt_bash_malloc=no ;; # alpha running osf/1 or linux
Jari Aalto28ef6c32001-04-06 19:14:31 +000068*[[Cc]]ray*-*) opt_bash_malloc=no ;; # Crays
Jari Aaltobb706242000-03-17 21:46:59 +000069*-osf1*) opt_bash_malloc=no ;; # other osf/1 machines
70sparc-svr4*) opt_bash_malloc=no ;; # sparc SVR4, SVR4.2
71sparc-netbsd*) opt_bash_malloc=no ;; # needs 8-byte alignment
72mips-irix6*) opt_bash_malloc=no ;; # needs 8-byte alignment
73m68k-sysv) opt_bash_malloc=no ;; # fixes file descriptor leak in closedir
74sparc-linux*) opt_bash_malloc=no ;; # sparc running linux; requires ELF
Jari Aalto95732b42005-12-07 14:08:12 +000075#*-freebsd*-gnu) opt_bash_malloc=no ;; # there's some undetermined problem here
Jari Aalto7117c2d2002-07-17 14:10:11 +000076#*-freebsd*) opt_bash_malloc=no ;; # they claim it's better; I disagree
Jari Aaltof73dda02001-11-13 17:56:06 +000077*-openbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
Jari Aaltobb706242000-03-17 21:46:59 +000078*-aix*) opt_bash_malloc=no ;; # AIX machines
79*-nextstep*) opt_bash_malloc=no ;; # NeXT machines running NeXTstep
Jari Aalto28ef6c32001-04-06 19:14:31 +000080*-macos*) opt_bash_malloc=no ;; # Apple MacOS X
81*-rhapsody*) opt_bash_malloc=no ;; # Apple Rhapsody (MacOS X)
82*-darwin*) opt_bash_malloc=no ;; # Apple Darwin (MacOS X)
Jari Aaltobb706242000-03-17 21:46:59 +000083*-dgux*) opt_bash_malloc=no ;; # DG/UX machines
Jari Aalto95732b42005-12-07 14:08:12 +000084*-qnx*) opt_bash_malloc=no ;; # QNX 4.2, QNX 6.x
Jari Aaltobb706242000-03-17 21:46:59 +000085*-machten4) opt_bash_malloc=no ;; # MachTen 4.x
86*-bsdi2.1|*-bsdi3.?) opt_bash_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
87*-beos*) opt_bash_malloc=no ;; # they say it's suitable
Jari Aalto28ef6c32001-04-06 19:14:31 +000088*-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
89*-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft
Jari Aaltoccc6cda1996-12-23 17:02:34 +000090esac
91
Jari Aalto7117c2d2002-07-17 14:10:11 +000092# memory scrambling on free()
93case "${host_os}" in
94sco3.2v5*|sco3.2v4*) opt_memscramble=no ;;
95*) opt_memscramble=yes ;;
96esac
97
Jari Aaltob80f6442004-07-27 13:29:18 +000098dnl
99dnl macros for the bash debugger
100dnl
Chet Ramey495aee42011-11-22 19:11:26 -0500101dnl AM_PATH_LISPDIR
Jari Aaltob80f6442004-07-27 13:29:18 +0000102AC_ARG_VAR(DEBUGGER_START_FILE, [location of bash debugger initialization file])
103
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000104dnl arguments to configure
105dnl packages
Jari Aalto7117c2d2002-07-17 14:10:11 +0000106AC_ARG_WITH(afs, AC_HELP_STRING([--with-afs], [if you are running AFS]), opt_afs=$withval)
107AC_ARG_WITH(bash-malloc, AC_HELP_STRING([--with-bash-malloc], [use the Bash version of malloc]), opt_bash_malloc=$withval)
108AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
109AC_ARG_WITH(gnu-malloc, AC_HELP_STRING([--with-gnu-malloc], [synonym for --with-bash-malloc]), opt_bash_malloc=$withval)
110AC_ARG_WITH(installed-readline, AC_HELP_STRING([--with-installed-readline], [use a version of the readline library that is already installed]), opt_with_installed_readline=$withval)
111AC_ARG_WITH(purecov, AC_HELP_STRING([--with-purecov], [configure to postprocess with pure coverage]), opt_purecov=$withval)
112AC_ARG_WITH(purify, AC_HELP_STRING([--with-purify], [configure to postprocess with purify]), opt_purify=$withval)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000113
Jari Aaltof73dda02001-11-13 17:56:06 +0000114if test "$opt_bash_malloc" = yes; then
Jari Aaltod166f041997-06-05 14:59:13 +0000115 MALLOC_TARGET=malloc
116 MALLOC_SRC=malloc.c
Jari Aaltof73dda02001-11-13 17:56:06 +0000117
118 MALLOC_LIB='-lmalloc'
119 MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
120 MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
121 MALLOC_DEP='$(MALLOC_LIBRARY)'
122
Jari Aaltobb706242000-03-17 21:46:59 +0000123 AC_DEFINE(USING_BASH_MALLOC)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000124else
Jari Aaltof73dda02001-11-13 17:56:06 +0000125 MALLOC_LIB=
126 MALLOC_LIBRARY=
127 MALLOC_LDFLAGS=
128 MALLOC_DEP=
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000129fi
130
131if test "$opt_purify" = yes; then
Jari Aaltod166f041997-06-05 14:59:13 +0000132 PURIFY="purify "
Jari Aalto7117c2d2002-07-17 14:10:11 +0000133 AC_DEFINE(DISABLE_MALLOC_WRAPPERS)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000134else
135 PURIFY=
136fi
137
Jari Aaltod166f041997-06-05 14:59:13 +0000138if test "$opt_purecov" = yes; then
139 PURIFY="${PURIFY}purecov"
140fi
141
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000142if test "$opt_afs" = yes; then
143 AC_DEFINE(AFS)
144fi
145
Jari Aaltod166f041997-06-05 14:59:13 +0000146if test "$opt_curses" = yes; then
147 prefer_curses=yes
148fi
149
Jari Aaltob80f6442004-07-27 13:29:18 +0000150if test -z "${DEBUGGER_START_FILE}"; then
Jari Aalto31859422009-01-12 13:36:28 +0000151 DEBUGGER_START_FILE='${datadir}/bashdb/bashdb-main.inc'
Jari Aaltob80f6442004-07-27 13:29:18 +0000152fi
153
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000154dnl optional shell features in config.h.in
155opt_minimal_config=no
156
157opt_job_control=yes
158opt_alias=yes
159opt_readline=yes
160opt_history=yes
161opt_bang_history=yes
162opt_dirstack=yes
163opt_restricted=yes
164opt_process_subst=yes
165opt_prompt_decoding=yes
166opt_select=yes
167opt_help=yes
168opt_array_variables=yes
169opt_dparen_arith=yes
Jari Aaltocce855b1998-04-17 19:52:44 +0000170opt_extended_glob=yes
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000171opt_brace_expansion=yes
172opt_disabled_builtins=no
173opt_command_timing=yes
Jari Aaltobb706242000-03-17 21:46:59 +0000174opt_xpg_echo=no
Jari Aalto95732b42005-12-07 14:08:12 +0000175opt_strict_posix=no
Jari Aaltocce855b1998-04-17 19:52:44 +0000176opt_cond_command=yes
Jari Aaltob80f6442004-07-27 13:29:18 +0000177opt_cond_regexp=yes
Jari Aalto31859422009-01-12 13:36:28 +0000178opt_coproc=yes
Jari Aaltobb706242000-03-17 21:46:59 +0000179opt_arith_for_command=yes
180opt_net_redirs=yes
181opt_progcomp=yes
Jari Aalto7117c2d2002-07-17 14:10:11 +0000182opt_separate_help=no
Jari Aaltob80f6442004-07-27 13:29:18 +0000183opt_multibyte=yes
184opt_debugger=yes
Jari Aalto95732b42005-12-07 14:08:12 +0000185opt_single_longdoc_strings=yes
Jari Aalto31859422009-01-12 13:36:28 +0000186opt_casemod_attrs=yes
187opt_casemod_expansions=yes
Chet Ramey00018032011-11-21 20:51:19 -0500188opt_extglob_default=no
Jari Aaltocce855b1998-04-17 19:52:44 +0000189
190dnl options that affect how bash is compiled and linked
191opt_static_link=no
192opt_profiling=no
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000193
194dnl argument parsing for optional features
Jari Aalto7117c2d2002-07-17 14:10:11 +0000195AC_ARG_ENABLE(minimal-config, AC_HELP_STRING([--enable-minimal-config], [a minimal sh-like configuration]), opt_minimal_config=$enableval)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000196
197dnl a minimal configuration turns everything off, but features can be
198dnl added individually
199if test $opt_minimal_config = yes; then
200 opt_job_control=no opt_alias=no opt_readline=no
201 opt_history=no opt_bang_history=no opt_dirstack=no
202 opt_restricted=no opt_process_subst=no opt_prompt_decoding=no
203 opt_select=no opt_help=no opt_array_variables=no opt_dparen_arith=no
204 opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
Jari Aaltobb706242000-03-17 21:46:59 +0000205 opt_extended_glob=no opt_cond_command=no opt_arith_for_command=no
Jari Aalto7117c2d2002-07-17 14:10:11 +0000206 opt_net_redirs=no opt_progcomp=no opt_separate_help=no
Jari Aalto31859422009-01-12 13:36:28 +0000207 opt_multibyte=yes opt_cond_regexp=no opt_coproc=no
Chet Ramey00018032011-11-21 20:51:19 -0500208 opt_casemod_attrs=no opt_casemod_expansions=no opt_extglob_default=no
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000209fi
210
Jari Aalto7117c2d2002-07-17 14:10:11 +0000211AC_ARG_ENABLE(alias, AC_HELP_STRING([--enable-alias], [enable shell aliases]), opt_alias=$enableval)
212AC_ARG_ENABLE(arith-for-command, AC_HELP_STRING([--enable-arith-for-command], [enable arithmetic for command]), opt_arith_for_command=$enableval)
213AC_ARG_ENABLE(array-variables, AC_HELP_STRING([--enable-array-variables], [include shell array variables]), opt_array_variables=$enableval)
214AC_ARG_ENABLE(bang-history, AC_HELP_STRING([--enable-bang-history], [turn on csh-style history substitution]), opt_bang_history=$enableval)
215AC_ARG_ENABLE(brace-expansion, AC_HELP_STRING([--enable-brace-expansion], [include brace expansion]), opt_brace_expansion=$enableval)
Jari Aalto31859422009-01-12 13:36:28 +0000216AC_ARG_ENABLE(casemod-attributes, AC_HELP_STRING([--enable-casemod-attributes], [include case-modifying variable attributes]), opt_casemod_attrs=$enableval)
217AC_ARG_ENABLE(casemod-expansions, AC_HELP_STRING([--enable-casemod-expansions], [include case-modifying word expansions]), opt_casemod_expansions=$enableval)
Jari Aalto7117c2d2002-07-17 14:10:11 +0000218AC_ARG_ENABLE(command-timing, AC_HELP_STRING([--enable-command-timing], [enable the time reserved word and command timing]), opt_command_timing=$enableval)
219AC_ARG_ENABLE(cond-command, AC_HELP_STRING([--enable-cond-command], [enable the conditional command]), opt_cond_command=$enableval)
Jari Aalto31859422009-01-12 13:36:28 +0000220AC_ARG_ENABLE(cond-regexp, AC_HELP_STRING([--enable-cond-regexp], [enable extended regular expression matching in conditional commands]), opt_cond_regexp=$enableval)
221AC_ARG_ENABLE(coprocesses, AC_HELP_STRING([--enable-coprocesses], [enable coprocess support and the coproc reserved word]), opt_coproc=$enableval)
Jari Aaltob80f6442004-07-27 13:29:18 +0000222AC_ARG_ENABLE(debugger, AC_HELP_STRING([--enable-debugger], [enable support for bash debugger]), opt_debugger=$enableval)
Jari Aalto7117c2d2002-07-17 14:10:11 +0000223AC_ARG_ENABLE(directory-stack, AC_HELP_STRING([--enable-directory-stack], [enable builtins pushd/popd/dirs]), opt_dirstack=$enableval)
224AC_ARG_ENABLE(disabled-builtins, AC_HELP_STRING([--enable-disabled-builtins], [allow disabled builtins to still be invoked]), opt_disabled_builtins=$enableval)
225AC_ARG_ENABLE(dparen-arithmetic, AC_HELP_STRING([--enable-dparen-arithmetic], [include ((...)) command]), opt_dparen_arith=$enableval)
226AC_ARG_ENABLE(extended-glob, AC_HELP_STRING([--enable-extended-glob], [include ksh-style extended pattern matching]), opt_extended_glob=$enableval)
Chet Ramey00018032011-11-21 20:51:19 -0500227AC_ARG_ENABLE(extended-glob-default, AC_HELP_STRING([--enable-extended-glob-default], [force extended pattern matching to be enabled by default]), opt_extglob_default=$enableval)
Jari Aalto7117c2d2002-07-17 14:10:11 +0000228AC_ARG_ENABLE(help-builtin, AC_HELP_STRING([--enable-help-builtin], [include the help builtin]), opt_help=$enableval)
229AC_ARG_ENABLE(history, AC_HELP_STRING([--enable-history], [turn on command history]), opt_history=$enableval)
230AC_ARG_ENABLE(job-control, AC_HELP_STRING([--enable-job-control], [enable job control features]), opt_job_control=$enableval)
Jari Aaltob80f6442004-07-27 13:29:18 +0000231AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
Jari Aalto7117c2d2002-07-17 14:10:11 +0000232AC_ARG_ENABLE(net-redirections, AC_HELP_STRING([--enable-net-redirections], [enable /dev/tcp/host/port redirection]), opt_net_redirs=$enableval)
233AC_ARG_ENABLE(process-substitution, AC_HELP_STRING([--enable-process-substitution], [enable process substitution]), opt_process_subst=$enableval)
234AC_ARG_ENABLE(progcomp, AC_HELP_STRING([--enable-progcomp], [enable programmable completion and the complete builtin]), opt_progcomp=$enableval)
235AC_ARG_ENABLE(prompt-string-decoding, AC_HELP_STRING([--enable-prompt-string-decoding], [turn on escape character decoding in prompts]), opt_prompt_decoding=$enableval)
236AC_ARG_ENABLE(readline, AC_HELP_STRING([--enable-readline], [turn on command line editing]), opt_readline=$enableval)
237AC_ARG_ENABLE(restricted, AC_HELP_STRING([--enable-restricted], [enable a restricted shell]), opt_restricted=$enableval)
238AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select], [include select command]), opt_select=$enableval)
239AC_ARG_ENABLE(separate-helpfiles, AC_HELP_STRING([--enable-separate-helpfiles], [use external files for help builtin documentation]), opt_separate_help=$enableval)
Jari Aalto95732b42005-12-07 14:08:12 +0000240AC_ARG_ENABLE(single-help-strings, AC_HELP_STRING([--enable-single-help-strings], [store help documentation as a single string to ease translation]), opt_single_longdoc_strings=$enableval)
241AC_ARG_ENABLE(strict-posix-default, AC_HELP_STRING([--enable-strict-posix-default], [configure bash to be posix-conformant by default]), opt_strict_posix=$enableval)
Jari Aalto7117c2d2002-07-17 14:10:11 +0000242AC_ARG_ENABLE(usg-echo-default, AC_HELP_STRING([--enable-usg-echo-default], [a synonym for --enable-xpg-echo-default]), opt_xpg_echo=$enableval)
243AC_ARG_ENABLE(xpg-echo-default, AC_HELP_STRING([--enable-xpg-echo-default], [make the echo builtin expand escape sequences by default]), opt_xpg_echo=$enableval)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000244
Jari Aaltocce855b1998-04-17 19:52:44 +0000245dnl options that alter how bash is compiled and linked
Jari Aalto7117c2d2002-07-17 14:10:11 +0000246AC_ARG_ENABLE(mem-scramble, AC_HELP_STRING([--enable-mem-scramble], [scramble memory on calls to malloc and free]), opt_memscramble=$enableval)
247AC_ARG_ENABLE(profiling, AC_HELP_STRING([--enable-profiling], [allow profiling with gprof]), opt_profiling=$enableval)
248AC_ARG_ENABLE(static-link, AC_HELP_STRING([--enable-static-link], [link bash statically, for use as a root shell]), opt_static_link=$enableval)
Jari Aaltocce855b1998-04-17 19:52:44 +0000249
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000250dnl opt_job_control is handled later, after BASH_JOB_CONTROL_MISSING runs
251
Jari Aaltob72432f1999-02-19 17:11:39 +0000252dnl opt_readline and opt_history are handled later, because AC_PROG_CC needs
253dnl to be run before we can check the version of an already-installed readline
254dnl library
255
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000256if test $opt_alias = yes; then
257AC_DEFINE(ALIAS)
258fi
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000259if test $opt_dirstack = yes; then
260AC_DEFINE(PUSHD_AND_POPD)
261fi
262if test $opt_restricted = yes; then
263AC_DEFINE(RESTRICTED_SHELL)
264fi
265if test $opt_process_subst = yes; then
266AC_DEFINE(PROCESS_SUBSTITUTION)
267fi
268if test $opt_prompt_decoding = yes; then
269AC_DEFINE(PROMPT_STRING_DECODE)
270fi
271if test $opt_select = yes; then
272AC_DEFINE(SELECT_COMMAND)
273fi
274if test $opt_help = yes; then
275AC_DEFINE(HELP_BUILTIN)
276fi
277if test $opt_array_variables = yes; then
278AC_DEFINE(ARRAY_VARS)
279fi
280if test $opt_dparen_arith = yes; then
281AC_DEFINE(DPAREN_ARITHMETIC)
282fi
283if test $opt_brace_expansion = yes; then
284AC_DEFINE(BRACE_EXPANSION)
285fi
286if test $opt_disabled_builtins = yes; then
287AC_DEFINE(DISABLED_BUILTINS)
288fi
289if test $opt_command_timing = yes; then
290AC_DEFINE(COMMAND_TIMING)
291fi
Jari Aaltobb706242000-03-17 21:46:59 +0000292if test $opt_xpg_echo = yes ; then
293AC_DEFINE(DEFAULT_ECHO_TO_XPG)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000294fi
Jari Aalto95732b42005-12-07 14:08:12 +0000295if test $opt_strict_posix = yes; then
296AC_DEFINE(STRICT_POSIX)
297fi
Jari Aaltocce855b1998-04-17 19:52:44 +0000298if test $opt_extended_glob = yes ; then
299AC_DEFINE(EXTENDED_GLOB)
300fi
Chet Ramey00018032011-11-21 20:51:19 -0500301if test $opt_extglob_default = yes; then
302AC_DEFINE(EXTGLOB_DEFAULT, 1)
303else
304AC_DEFINE(EXTGLOB_DEFAULT, 0)
305fi
Jari Aaltocce855b1998-04-17 19:52:44 +0000306if test $opt_cond_command = yes ; then
307AC_DEFINE(COND_COMMAND)
308fi
Jari Aaltob80f6442004-07-27 13:29:18 +0000309if test $opt_cond_regexp = yes ; then
310AC_DEFINE(COND_REGEXP)
311fi
Jari Aalto31859422009-01-12 13:36:28 +0000312if test $opt_coproc = yes; then
313AC_DEFINE(COPROCESS_SUPPORT)
314fi
Jari Aaltobb706242000-03-17 21:46:59 +0000315if test $opt_arith_for_command = yes; then
316AC_DEFINE(ARITH_FOR_COMMAND)
317fi
318if test $opt_net_redirs = yes; then
319AC_DEFINE(NETWORK_REDIRECTIONS)
320fi
321if test $opt_progcomp = yes; then
322AC_DEFINE(PROGRAMMABLE_COMPLETION)
323fi
Jari Aaltob80f6442004-07-27 13:29:18 +0000324if test $opt_multibyte = no; then
325AC_DEFINE(NO_MULTIBYTE_SUPPORT)
326fi
327if test $opt_debugger = yes; then
328AC_DEFINE(DEBUGGER)
329fi
Jari Aalto31859422009-01-12 13:36:28 +0000330if test $opt_casemod_attrs = yes; then
331AC_DEFINE(CASEMOD_ATTRS)
332fi
333if test $opt_casemod_expansions = yes; then
334AC_DEFINE(CASEMOD_EXPANSIONS)
335fi
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000336
Jari Aalto7117c2d2002-07-17 14:10:11 +0000337if test $opt_memscramble = yes; then
338AC_DEFINE(MEMSCRAMBLE)
339fi
340
Jari Aaltod166f041997-06-05 14:59:13 +0000341if test "$opt_minimal_config" = yes; then
342 TESTSCRIPT=run-minimal
343else
344 TESTSCRIPT=run-all
345fi
346
Jari Aalto7117c2d2002-07-17 14:10:11 +0000347HELPDIR= HELPDIRDEFINE= HELPINSTALL=
348if test "$opt_separate_help" != no; then
349 if test "$opt_separate_help" = "yes" ; then
350 HELPDIR='${datadir}/bash'
351 else
352 HELPDIR=$opt_separate_help
353 fi
354 HELPDIRDEFINE='-H ${HELPDIR}'
355 HELPINSTALL='install-help'
356fi
Jari Aalto95732b42005-12-07 14:08:12 +0000357HELPSTRINGS=
358if test "$opt_single_longdoc_strings" != "yes"; then
359 HELPSTRINGS='-S'
360fi
Jari Aalto7117c2d2002-07-17 14:10:11 +0000361
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000362dnl now substitute in the values generated by arguments
Jari Aaltod166f041997-06-05 14:59:13 +0000363AC_SUBST(TESTSCRIPT)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000364AC_SUBST(PURIFY)
Jari Aaltod166f041997-06-05 14:59:13 +0000365AC_SUBST(MALLOC_TARGET)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000366AC_SUBST(MALLOC_SRC)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000367
Jari Aaltof73dda02001-11-13 17:56:06 +0000368AC_SUBST(MALLOC_LIB)
369AC_SUBST(MALLOC_LIBRARY)
370AC_SUBST(MALLOC_LDFLAGS)
371AC_SUBST(MALLOC_DEP)
372
Jari Aaltobb706242000-03-17 21:46:59 +0000373AC_SUBST(htmldir)
374
Jari Aalto7117c2d2002-07-17 14:10:11 +0000375AC_SUBST(HELPDIR)
376AC_SUBST(HELPDIRDEFINE)
377AC_SUBST(HELPINSTALL)
Jari Aalto95732b42005-12-07 14:08:12 +0000378AC_SUBST(HELPSTRINGS)
Jari Aalto7117c2d2002-07-17 14:10:11 +0000379
Jari Aaltof73dda02001-11-13 17:56:06 +0000380echo ""
Jari Aalto7117c2d2002-07-17 14:10:11 +0000381echo "Beginning configuration for bash-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}"
Jari Aaltof73dda02001-11-13 17:56:06 +0000382echo ""
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000383
384dnl compilation checks
Jari Aaltocce855b1998-04-17 19:52:44 +0000385dnl AC_PROG_CC sets $cross_compiling to `yes' if cross-compiling for a
386dnl different environment
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000387AC_PROG_CC
Jari Aaltobb706242000-03-17 21:46:59 +0000388
389dnl test for Unix variants
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000390AC_ISC_POSIX
391AC_MINIX
392
Jari Aaltof73dda02001-11-13 17:56:06 +0000393AC_SYS_LARGEFILE
Jari Aaltobb706242000-03-17 21:46:59 +0000394
Jari Aalto95732b42005-12-07 14:08:12 +0000395dnl BEGIN changes for cross-building (currently cygwin, minGW, and
396dnl (obsolete) BeOS)
Jari Aaltob72432f1999-02-19 17:11:39 +0000397
Jari Aalto06285672006-10-10 14:15:34 +0000398SIGNAMES_O=
Jari Aaltob72432f1999-02-19 17:11:39 +0000399SIGNAMES_H=lsignames.h
Jari Aaltocce855b1998-04-17 19:52:44 +0000400
401dnl load up the cross-building cache file -- add more cases and cache
402dnl files as necessary
Jari Aaltob72432f1999-02-19 17:11:39 +0000403
404dnl Note that host and target machine are the same, and different than the
405dnl build machine.
406dnl Set SIGNAMES_H based on whether or not we're cross-compiling.
407
Jari Aalto06285672006-10-10 14:15:34 +0000408CROSS_COMPILE=
Jari Aaltocce855b1998-04-17 19:52:44 +0000409if test "x$cross_compiling" = "xyes"; then
410 case "${host}" in
Jari Aalto28ef6c32001-04-06 19:14:31 +0000411 *-cygwin*)
Jari Aaltocce855b1998-04-17 19:52:44 +0000412 cross_cache=${srcdir}/cross-build/cygwin32.cache
Jari Aaltocce855b1998-04-17 19:52:44 +0000413 ;;
Jari Aalto95732b42005-12-07 14:08:12 +0000414 *-mingw*)
415 cross_cache=${srcdir}/cross-build/cygwin32.cache
416 ;;
Jari Aaltob72432f1999-02-19 17:11:39 +0000417 i[[3456]]86-*-beos*)
418 cross_cache=${srcdir}/cross-build/x86-beos.cache
Jari Aaltob72432f1999-02-19 17:11:39 +0000419 ;;
420 *) echo "configure: cross-compiling for $host is not supported" >&2
Jari Aaltocce855b1998-04-17 19:52:44 +0000421 ;;
422 esac
Jari Aaltob72432f1999-02-19 17:11:39 +0000423 if test -n "${cross_cache}" && test -r "${cross_cache}"; then
424 echo "loading cross-build cache file ${cross_cache}"
425 . ${cross_cache}
426 fi
427 unset cross_cache
Jari Aalto06285672006-10-10 14:15:34 +0000428 SIGNAMES_O='signames.o'
Jari Aalto95732b42005-12-07 14:08:12 +0000429 CROSS_COMPILE='-DCROSS_COMPILING'
430 AC_SUBST(CROSS_COMPILE)
Jari Aaltocce855b1998-04-17 19:52:44 +0000431fi
Jari Aaltob72432f1999-02-19 17:11:39 +0000432AC_SUBST(SIGNAMES_H)
Jari Aalto06285672006-10-10 14:15:34 +0000433AC_SUBST(SIGNAMES_O)
Jari Aaltocce855b1998-04-17 19:52:44 +0000434
435if test -z "$CC_FOR_BUILD"; then
436 if test "x$cross_compiling" = "xno"; then
437 CC_FOR_BUILD='$(CC)'
438 else
439 CC_FOR_BUILD=gcc
440 fi
441fi
442AC_SUBST(CC_FOR_BUILD)
443
Jari Aaltob72432f1999-02-19 17:11:39 +0000444dnl END changes for cross-building
Jari Aaltocce855b1998-04-17 19:52:44 +0000445
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000446dnl We want these before the checks, so the checks can modify their values.
447test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
448
449dnl If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS.
450test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
451
Jari Aaltocce855b1998-04-17 19:52:44 +0000452dnl handle options that alter how bash is compiled and linked
453dnl these must come after the test for cc/gcc
454if test "$opt_profiling" = "yes"; then
455 PROFILE_FLAGS=-pg
Jari Aaltob72432f1999-02-19 17:11:39 +0000456 case "$host_os" in
457 solaris2*) ;;
458 *) opt_static_link=yes ;;
459 esac
Jari Aalto7117c2d2002-07-17 14:10:11 +0000460 DEBUG= MALLOC_DEBUG=
Jari Aaltocce855b1998-04-17 19:52:44 +0000461fi
462
463if test "$opt_static_link" = yes; then
Jari Aaltof73dda02001-11-13 17:56:06 +0000464 # if we're using gcc, add `-static' to LDFLAGS, except on Solaris >= 2
Jari Aaltocce855b1998-04-17 19:52:44 +0000465 if test -n "$GCC" || test "$ac_cv_prog_gcc" = "yes"; then
Jari Aaltof73dda02001-11-13 17:56:06 +0000466 STATIC_LD="-static"
467 case "$host_os" in
468 solaris2*) ;;
469 *) LDFLAGS="$LDFLAGS -static" ;; # XXX experimental
470 esac
Jari Aaltocce855b1998-04-17 19:52:44 +0000471 fi
472fi
473
Jari Aaltob80f6442004-07-27 13:29:18 +0000474if test "X$cross_compiling" = "Xno"; then
475 CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-"$CPPFLAGS"}
476 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-'$(LDFLAGS)'}
477else
478 CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-""}
479 LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-""}
480fi
481
Jari Aalto7117c2d2002-07-17 14:10:11 +0000482test -z "$CFLAGS_FOR_BUILD" && CFLAGS_FOR_BUILD="-g"
483
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000484AC_SUBST(CFLAGS)
485AC_SUBST(CPPFLAGS)
486AC_SUBST(LDFLAGS)
Jari Aaltob72432f1999-02-19 17:11:39 +0000487AC_SUBST(STATIC_LD)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000488
Jari Aalto7117c2d2002-07-17 14:10:11 +0000489AC_SUBST(CFLAGS_FOR_BUILD)
490AC_SUBST(CPPFLAGS_FOR_BUILD)
491AC_SUBST(LDFLAGS_FOR_BUILD)
492
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000493AC_PROG_GCC_TRADITIONAL
494
Jari Aaltob72432f1999-02-19 17:11:39 +0000495dnl BEGIN READLINE and HISTORY LIBRARY SECTION
496dnl prepare to allow bash to be linked against an already-installed readline
497
498dnl first test that the readline version is new enough to link bash against
Jari Aaltof73dda02001-11-13 17:56:06 +0000499if test "$opt_readline" = yes && test "$opt_with_installed_readline" != "no"
Jari Aaltob72432f1999-02-19 17:11:39 +0000500then
Jari Aaltof73dda02001-11-13 17:56:06 +0000501 # If the user specified --with-installed-readline=PREFIX and PREFIX
502 # is not `yes', set ac_cv_rl_prefix to PREFIX
503 test $opt_with_installed_readline != "yes" && ac_cv_rl_prefix=$opt_with_installed_readline
Jari Aaltob72432f1999-02-19 17:11:39 +0000504
Jari Aaltof73dda02001-11-13 17:56:06 +0000505 RL_LIB_READLINE_VERSION
Jari Aaltob72432f1999-02-19 17:11:39 +0000506
Jari Aaltof73dda02001-11-13 17:56:06 +0000507 case "$ac_cv_rl_version" in
Jari Aaltob80f6442004-07-27 13:29:18 +0000508 5*|6*|7*|8*|9*) ;;
Jari Aaltob72432f1999-02-19 17:11:39 +0000509 *) opt_with_installed_readline=no
Chet Ramey00018032011-11-21 20:51:19 -0500510 AC_MSG_WARN([installed readline library is too old to be linked with bash])
511 AC_MSG_WARN([using private bash version])
Jari Aaltob72432f1999-02-19 17:11:39 +0000512 ;;
513 esac
Jari Aaltob72432f1999-02-19 17:11:39 +0000514fi
515
Jari Aalto95732b42005-12-07 14:08:12 +0000516TILDE_LIB=-ltilde
Jari Aaltob72432f1999-02-19 17:11:39 +0000517if test $opt_readline = yes; then
518 AC_DEFINE(READLINE)
Jari Aaltof73dda02001-11-13 17:56:06 +0000519 if test "$opt_with_installed_readline" != "no" ; then
Jari Aaltob80f6442004-07-27 13:29:18 +0000520 case "$opt_with_installed_readline" in
521 yes) RL_INCLUDE= ;;
522 *) case "$RL_INCLUDEDIR" in
523 /usr/include) ;;
524 *) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;;
525 esac
526 ;;
Jari Aaltof73dda02001-11-13 17:56:06 +0000527 esac
Jari Aaltob72432f1999-02-19 17:11:39 +0000528 READLINE_DEP=
Jari Aalto95732b42005-12-07 14:08:12 +0000529 READLINE_LIB=-lreadline
530 # section for OS versions that don't allow unresolved symbols
531 # to be compiled into dynamic libraries.
532 case "$host_os" in
533 cygwin*) TILDE_LIB= ;;
534 esac
Jari Aaltob72432f1999-02-19 17:11:39 +0000535 else
536 RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
537 READLINE_DEP='$(READLINE_LIBRARY)'
Jari Aalto95732b42005-12-07 14:08:12 +0000538 # section for OS versions that ship an older/broken version of
539 # readline as a standard dynamic library and don't allow a
540 # static version specified as -llibname to override the
541 # dynamic version
542 case "${host_os}" in
Chet Ramey89a92862011-11-21 20:49:12 -0500543 darwin[[89]]*|darwin10*) READLINE_LIB='${READLINE_LIBRARY}' ;;
Jari Aalto95732b42005-12-07 14:08:12 +0000544 *) READLINE_LIB=-lreadline ;;
545 esac
Jari Aaltob72432f1999-02-19 17:11:39 +0000546 fi
547else
548 RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
549 READLINE_LIB= READLINE_DEP=
550fi
551if test $opt_history = yes || test $opt_bang_history = yes; then
552 if test $opt_history = yes; then
553 AC_DEFINE(HISTORY)
554 fi
555 if test $opt_bang_history = yes; then
556 AC_DEFINE(BANG_HISTORY)
557 fi
Jari Aaltof73dda02001-11-13 17:56:06 +0000558 if test "$opt_with_installed_readline" != "no"; then
559 HIST_LIBDIR=$RL_LIBDIR
Jari Aaltob72432f1999-02-19 17:11:39 +0000560 HISTORY_DEP=
Jari Aalto95732b42005-12-07 14:08:12 +0000561 HISTORY_LIB=-lhistory
Jari Aaltob80f6442004-07-27 13:29:18 +0000562 case "$opt_with_installed_readline" in
563 yes) RL_INCLUDE= ;;
564 *) case "$RL_INCLUDEDIR" in
565 /usr/include) ;;
566 *) RL_INCLUDE='-I${RL_INCLUDEDIR}' ;;
567 esac
568 ;;
Jari Aaltof73dda02001-11-13 17:56:06 +0000569 esac
Jari Aaltob72432f1999-02-19 17:11:39 +0000570 else
571 HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
572 HISTORY_DEP='$(HISTORY_LIBRARY)'
Jari Aalto95732b42005-12-07 14:08:12 +0000573 # section for OS versions that ship an older version of
574 # readline as a standard dynamic library and don't allow a
575 # static version specified as -llibname to override the
576 # dynamic version
577 case "${host_os}" in
Chet Ramey89a92862011-11-21 20:49:12 -0500578 darwin[[89]]*|darwin10*) HISTORY_LIB='${HISTORY_LIBRARY}' ;;
Jari Aalto95732b42005-12-07 14:08:12 +0000579 *) HISTORY_LIB=-lhistory ;;
580 esac
Jari Aaltob72432f1999-02-19 17:11:39 +0000581 fi
582else
583 HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
584 HISTORY_LIB= HISTORY_DEP=
585fi
586AC_SUBST(READLINE_LIB)
587AC_SUBST(READLINE_DEP)
588AC_SUBST(RL_LIBDIR)
Jari Aaltof73dda02001-11-13 17:56:06 +0000589AC_SUBST(RL_INCLUDEDIR)
Jari Aaltob72432f1999-02-19 17:11:39 +0000590AC_SUBST(RL_INCLUDE)
591AC_SUBST(HISTORY_LIB)
592AC_SUBST(HISTORY_DEP)
593AC_SUBST(HIST_LIBDIR)
Jari Aalto95732b42005-12-07 14:08:12 +0000594AC_SUBST(TILDE_LIB)
Jari Aaltob72432f1999-02-19 17:11:39 +0000595
596dnl END READLINE and HISTORY LIBRARY SECTION
597
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000598dnl programs needed by the build and install process
599AC_PROG_INSTALL
Jari Aaltof73dda02001-11-13 17:56:06 +0000600AC_CHECK_PROG(AR, ar, , ar)
Jari Aaltob72432f1999-02-19 17:11:39 +0000601dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
602dnl This allows people to set it when running configure or make
603test -n "$ARFLAGS" || ARFLAGS="cr"
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000604AC_PROG_RANLIB
605AC_PROG_YACC
606AC_PROG_MAKE_SET
607
Jari Aaltob72432f1999-02-19 17:11:39 +0000608case "$host_os" in
Jari Aaltobb706242000-03-17 21:46:59 +0000609opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
Jari Aaltob72432f1999-02-19 17:11:39 +0000610*) MAKE_SHELL=/bin/sh ;;
611esac
612AC_SUBST(MAKE_SHELL)
613
Jari Aalto95732b42005-12-07 14:08:12 +0000614dnl this is similar to the expanded AC_PROG_RANLIB
615if test x$SIZE = x; then
616 if test x$ac_tool_prefix = x; then
617 SIZE=size
618 else
619 SIZE=${ac_tool_prefix}size
620 save_IFS=$IFS ; IFS=:
621 size_found=0
622 for dir in $PATH; do
623 if test -x $dir/$SIZE ; then
624 size_found=1
625 break
626 fi
627 done
628 if test $size_found -eq 0; then
629 SIZE=:
630 fi
631 IFS=$save_IFS
632 fi
633fi
634AC_SUBST(SIZE)
635
Jari Aaltof73dda02001-11-13 17:56:06 +0000636dnl Turn on any extensions available in the GNU C library.
637AC_DEFINE(_GNU_SOURCE, 1)
638
639dnl C compiler characteristics
640AC_C_CONST
641AC_C_INLINE
642AC_C_BIGENDIAN
643AC_C_STRINGIZE
644AC_C_LONG_DOUBLE
645AC_C_PROTOTYPES
646AC_C_CHAR_UNSIGNED
Jari Aalto17345e52009-02-19 22:21:29 +0000647AC_C_VOLATILE
648AC_C_RESTRICT
Jari Aaltof73dda02001-11-13 17:56:06 +0000649
Jari Aaltob80f6442004-07-27 13:29:18 +0000650dnl initialize GNU gettext
651AM_GNU_GETTEXT([no-libtool], [need-ngettext], [lib/intl])
652
Jari Aaltof73dda02001-11-13 17:56:06 +0000653dnl header files
654AC_HEADER_DIRENT
655AC_HEADER_TIME
656
657BASH_HEADER_INTTYPES
658
659AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
660 memory.h locale.h termcap.h termio.h termios.h dlfcn.h \
Chet Ramey00018032011-11-21 20:51:19 -0500661 stddef.h stdint.h netdb.h pwd.h grp.h strings.h regex.h \
Chet Ramey495aee42011-11-22 19:11:26 -0500662 syslog.h ulimit.h)
Jari Aalto95732b42005-12-07 14:08:12 +0000663AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h \
Jari Aaltob80f6442004-07-27 13:29:18 +0000664 sys/resource.h sys/param.h sys/socket.h sys/stat.h \
665 sys/time.h sys/times.h sys/types.h sys/wait.h)
Jari Aaltof73dda02001-11-13 17:56:06 +0000666AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)
667
Jari Aalto95732b42005-12-07 14:08:12 +0000668dnl sys/ptem.h requires definitions from sys/stream.h on systems where it
669dnl exists
670AC_CHECK_HEADER(sys/ptem.h, , ,[[
671#if HAVE_SYS_STREAM_H
672# include <sys/stream.h>
673#endif
674]])
675
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000676dnl special checks for libc functions
677AC_FUNC_ALLOCA
678AC_FUNC_GETPGRP
679AC_FUNC_SETVBUF_REVERSED
680AC_FUNC_VPRINTF
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000681AC_FUNC_STRCOLL
682
Jari Aaltof73dda02001-11-13 17:56:06 +0000683dnl if we're not using the bash malloc but require the C alloca, set things
684dnl up to build a libmalloc.a containing only alloca.o
685
686if test "$ac_cv_func_alloca_works" = "no" && test "$opt_bash_malloc" = "no"; then
687 MALLOC_TARGET=alloca
688 MALLOC_SRC=alloca.c
689
690 MALLOC_LIB='-lmalloc'
691 MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
692 MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
693 MALLOC_DEP='$(MALLOC_LIBRARY)'
694fi
695
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000696dnl if vprintf is not in libc, see if it's defined in stdio.h
697if test "$ac_cv_func_vprintf" = no; then
698 AC_MSG_CHECKING(for declaration of vprintf in stdio.h)
699 AC_EGREP_HEADER([[int[ ]*vprintf[^a-zA-Z0-9]]],stdio.h,ac_cv_func_vprintf=yes)
700 AC_MSG_RESULT($ac_cv_func_vprintf)
701 if test $ac_cv_func_vprintf = yes; then
702 AC_DEFINE(HAVE_VPRINTF)
703 fi
704fi
705
Jari Aaltof73dda02001-11-13 17:56:06 +0000706if test "$ac_cv_func_vprintf" = no && test "$ac_cv_func__doprnt" = "yes"; then
707 AC_LIBOBJ(vprint)
708fi
709
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000710dnl signal stuff
Jari Aaltof73dda02001-11-13 17:56:06 +0000711AC_TYPE_SIGNAL
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000712
713dnl checks for certain version-specific system calls and libc functions
714AC_CHECK_FUNC(__setostype, AC_DEFINE(HAVE_SETOSTYPE))
715AC_CHECK_FUNC(wait3, AC_DEFINE(HAVE_WAIT3))
Jari Aalto7117c2d2002-07-17 14:10:11 +0000716AC_CHECK_FUNC(isinf, AC_DEFINE(HAVE_ISINF_IN_LIBC))
Jari Aalto06285672006-10-10 14:15:34 +0000717AC_CHECK_FUNC(isnan, AC_DEFINE(HAVE_ISNAN_IN_LIBC))
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000718
719dnl checks for missing libc functions
720AC_CHECK_FUNC(mkfifo,AC_DEFINE(HAVE_MKFIFO),AC_DEFINE(MKFIFO_MISSING))
721
722dnl checks for system calls
Jari Aalto06285672006-10-10 14:15:34 +0000723AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getgroups gethostname \
724 getpagesize getpeername getrlimit getrusage gettimeofday \
725 kill killpg lstat readlink sbrk select setdtablesize \
Jari Aalto31859422009-01-12 13:36:28 +0000726 setitimer tcgetpgrp uname ulimit waitpid)
Jari Aaltof73dda02001-11-13 17:56:06 +0000727AC_REPLACE_FUNCS(rename)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000728
729dnl checks for c library functions
Chet Ramey495aee42011-11-22 19:11:26 -0500730AC_CHECK_FUNCS(bcopy bzero confstr faccessat fnmatch \
Jari Aalto7117c2d2002-07-17 14:10:11 +0000731 getaddrinfo gethostbyname getservbyname getservent inet_aton \
Jari Aalto95732b42005-12-07 14:08:12 +0000732 memmove pathconf putenv raise regcomp regexec \
733 setenv setlinebuf setlocale setvbuf siginterrupt strchr \
Chet Ramey00018032011-11-21 20:51:19 -0500734 sysconf syslog tcgetattr times ttyname tzset unsetenv)
Jari Aalto95732b42005-12-07 14:08:12 +0000735
Chet Ramey00018032011-11-21 20:51:19 -0500736AC_CHECK_FUNCS(vasprintf asprintf)
Jari Aaltof73dda02001-11-13 17:56:06 +0000737AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
Jari Aalto95732b42005-12-07 14:08:12 +0000738AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
Chet Ramey00018032011-11-21 20:51:19 -0500739AC_REPLACE_FUNCS(getcwd memset)
740AC_REPLACE_FUNCS(strcasecmp strcasestr strerror strftime strnlen strpbrk strstr)
Jari Aalto7117c2d2002-07-17 14:10:11 +0000741AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoimax strtoumax)
Chet Ramey495aee42011-11-22 19:11:26 -0500742AC_REPLACE_FUNCS(dprintf)
743AC_REPLACE_FUNCS(strchrnul)
Jari Aaltof73dda02001-11-13 17:56:06 +0000744
Jari Aaltof73dda02001-11-13 17:56:06 +0000745AC_CHECK_DECLS([confstr])
Jari Aaltof73dda02001-11-13 17:56:06 +0000746AC_CHECK_DECLS([printf])
Jari Aalto7117c2d2002-07-17 14:10:11 +0000747AC_CHECK_DECLS([sbrk])
Jari Aalto06285672006-10-10 14:15:34 +0000748AC_CHECK_DECLS([setregid])
Jari Aalto7117c2d2002-07-17 14:10:11 +0000749AC_CHECK_DECLS([strcpy])
Jari Aaltof73dda02001-11-13 17:56:06 +0000750AC_CHECK_DECLS([strsignal])
Jari Aaltob80f6442004-07-27 13:29:18 +0000751
752dnl Extra test to detect the horribly broken HP/UX 11.00 strtold(3)
753AC_CHECK_DECLS([strtold], [
754 AC_MSG_CHECKING([for broken strtold])
755 AC_CACHE_VAL(bash_cv_strtold_broken,
756 [AC_TRY_COMPILE(
757 [#include <stdlib.h>],
758 [int main() { long double r; char *foo, bar; r = strtold(foo, &bar);}],
759 bash_cv_strtold_broken=no, bash_cv_strtold_broken=yes,
760 [AC_MSG_WARN(cannot check for broken strtold if cross-compiling, defaulting to no)])
761 ]
762 )
763 AC_MSG_RESULT($bash_cv_strtold_broken)
764 if test "$bash_cv_strtold_broken" = "yes" ; then
765 AC_DEFINE(STRTOLD_BROKEN)
766 fi
767])
768
Jari Aaltof73dda02001-11-13 17:56:06 +0000769
770BASH_CHECK_DECL(strtoimax)
771BASH_CHECK_DECL(strtol)
772BASH_CHECK_DECL(strtoll)
773BASH_CHECK_DECL(strtoul)
774BASH_CHECK_DECL(strtoull)
775BASH_CHECK_DECL(strtoumax)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000776
Jari Aalto7117c2d2002-07-17 14:10:11 +0000777AC_FUNC_MKTIME
778
Jari Aaltob80f6442004-07-27 13:29:18 +0000779dnl
780dnl Checks for lib/intl and related code (uses some of the output from
781dnl AM_GNU_GETTEXT)
782dnl
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000783
Jari Aaltob80f6442004-07-27 13:29:18 +0000784AC_CHECK_HEADERS([argz.h errno.h fcntl.h malloc.h stdio_ext.h])
785
786dnl AC_FUNC_MALLOC
787AC_FUNC_MMAP
788AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify dcgettext mempcpy \
789 munmap stpcpy strcspn strdup])
790
791INTL_DEP= INTL_INC= LIBINTL_H=
792if test "x$USE_INCLUDED_LIBINTL" = "xyes"; then
793 INTL_DEP='${INTL_LIBDIR}/libintl.a'
794 INTL_INC='-I${INTL_LIBSRC} -I${INTL_BUILDDIR}'
795 LIBINTL_H='${INTL_BUILDDIR}/libintl.h'
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000796fi
Jari Aaltob80f6442004-07-27 13:29:18 +0000797AC_SUBST(INTL_DEP)
798AC_SUBST(INTL_INC)
799AC_SUBST(LIBINTL_H)
800
801dnl
802dnl End of checks needed by files in lib/intl
803dnl
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000804
Jari Aalto7117c2d2002-07-17 14:10:11 +0000805BASH_CHECK_MULTIBYTE
806
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000807dnl checks for the dynamic loading library functions in libc and libdl
Jari Aaltocce855b1998-04-17 19:52:44 +0000808if test "$opt_static_link" != yes; then
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000809AC_CHECK_LIB(dl, dlopen)
810AC_CHECK_FUNCS(dlopen dlclose dlsym)
Jari Aaltocce855b1998-04-17 19:52:44 +0000811fi
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000812
Jari Aalto31859422009-01-12 13:36:28 +0000813dnl this defines HAVE_DECL_SYS_SIGLIST
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000814AC_DECL_SYS_SIGLIST
815
Jari Aaltobb706242000-03-17 21:46:59 +0000816dnl network functions -- check for inet_aton again
817if test "$ac_cv_func_inet_aton" != 'yes'; then
818BASH_FUNC_INET_ATON
819fi
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000820
821dnl libraries
822dnl this is reportedly no longer necessary for irix[56].?
Jari Aaltobb706242000-03-17 21:46:59 +0000823case "$host_os" in
824irix4*) AC_CHECK_LIB(sun, getpwent) ;;
825esac
826
Jari Aaltod166f041997-06-05 14:59:13 +0000827dnl check for getpeername in the socket library only if it's not in libc
828if test "$ac_cv_func_getpeername" = no; then
Jari Aaltof73dda02001-11-13 17:56:06 +0000829 BASH_CHECK_LIB_SOCKET
Jari Aaltod166f041997-06-05 14:59:13 +0000830fi
Jari Aaltobb706242000-03-17 21:46:59 +0000831dnl check for gethostbyname in socket libraries if it's not in libc
832if test "$ac_cv_func_gethostbyname" = no; then
833 BASH_FUNC_GETHOSTBYNAME
834fi
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000835
836dnl system types
837AC_TYPE_GETGROUPS
838AC_TYPE_OFF_T
839AC_TYPE_MODE_T
840AC_TYPE_UID_T
841AC_TYPE_PID_T
842AC_TYPE_SIZE_T
Jari Aaltof73dda02001-11-13 17:56:06 +0000843AC_CHECK_TYPE(ssize_t, int)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000844AC_CHECK_TYPE(time_t, long)
845
Jari Aaltof73dda02001-11-13 17:56:06 +0000846BASH_TYPE_LONG_LONG
847BASH_TYPE_UNSIGNED_LONG_LONG
848
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000849AC_TYPE_SIGNAL
Jari Aalto17345e52009-02-19 22:21:29 +0000850BASH_TYPE_SIG_ATOMIC_T
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000851
Jari Aaltobb706242000-03-17 21:46:59 +0000852AC_CHECK_SIZEOF(char, 1)
853AC_CHECK_SIZEOF(short, 2)
Jari Aaltob72432f1999-02-19 17:11:39 +0000854AC_CHECK_SIZEOF(int, 4)
855AC_CHECK_SIZEOF(long, 4)
856AC_CHECK_SIZEOF(char *, 4)
857AC_CHECK_SIZEOF(double, 8)
Jari Aaltof73dda02001-11-13 17:56:06 +0000858AC_CHECK_SIZEOF([long long], 8)
Jari Aaltocce855b1998-04-17 19:52:44 +0000859
Jari Aaltof73dda02001-11-13 17:56:06 +0000860AC_CHECK_TYPE(u_int, [unsigned int])
861AC_CHECK_TYPE(u_long, [unsigned long])
Jari Aaltobb706242000-03-17 21:46:59 +0000862
863BASH_TYPE_BITS16_T
864BASH_TYPE_U_BITS16_T
865BASH_TYPE_BITS32_T
866BASH_TYPE_U_BITS32_T
Jari Aaltob72432f1999-02-19 17:11:39 +0000867BASH_TYPE_BITS64_T
Jari Aaltocce855b1998-04-17 19:52:44 +0000868
Jari Aaltobb706242000-03-17 21:46:59 +0000869BASH_TYPE_PTRDIFF_T
870
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000871dnl structures
872AC_HEADER_STAT
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000873
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000874dnl system services
875AC_SYS_INTERPRETER
876if test $ac_cv_sys_interpreter = yes; then
877AC_DEFINE(HAVE_HASH_BANG_EXEC)
878fi
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000879
880dnl Miscellaneous Bash tests
881if test "$ac_cv_func_lstat" = "no"; then
882BASH_FUNC_LSTAT
883fi
884
Jari Aaltod166f041997-06-05 14:59:13 +0000885dnl behavior of system calls and library functions
Jari Aaltob80f6442004-07-27 13:29:18 +0000886BASH_FUNC_CTYPE_NONASCII
Jari Aaltof73dda02001-11-13 17:56:06 +0000887BASH_FUNC_DUP2_CLOEXEC_CHECK
888BASH_SYS_PGRP_SYNC
889BASH_SYS_SIGNAL_VINTAGE
Jari Aaltocce855b1998-04-17 19:52:44 +0000890
Jari Aaltod166f041997-06-05 14:59:13 +0000891dnl checking for the presence of certain library symbols
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000892BASH_SYS_ERRLIST
893BASH_SYS_SIGLIST
894BASH_UNDER_SYS_SIGLIST
Jari Aaltod166f041997-06-05 14:59:13 +0000895
896dnl various system types
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000897BASH_TYPE_SIGHANDLER
898BASH_CHECK_TYPE(clock_t, [#include <sys/times.h>], long)
899BASH_CHECK_TYPE(sigset_t, [#include <signal.h>], int)
900BASH_CHECK_TYPE(quad_t, , long, HAVE_QUAD_T)
Jari Aaltof73dda02001-11-13 17:56:06 +0000901BASH_CHECK_TYPE(intmax_t, , $bash_cv_type_long_long)
902BASH_CHECK_TYPE(uintmax_t, , $bash_cv_type_unsigned_long_long)
903if test "$ac_cv_header_sys_socket_h" = "yes"; then
904BASH_CHECK_TYPE(socklen_t, [#include <sys/socket.h>], int, HAVE_SOCKLEN_T)
905fi
906BASH_TYPE_RLIMIT
Jari Aaltod166f041997-06-05 14:59:13 +0000907
Chet Ramey495aee42011-11-22 19:11:26 -0500908AC_CHECK_SIZEOF(intmax_t, 8)
909
Jari Aaltod166f041997-06-05 14:59:13 +0000910dnl presence and contents of structures used by system calls
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000911BASH_STRUCT_TERMIOS_LDISC
912BASH_STRUCT_TERMIO_LDISC
913BASH_STRUCT_DIRENT_D_INO
Jari Aaltod166f041997-06-05 14:59:13 +0000914BASH_STRUCT_DIRENT_D_FILENO
Jari Aaltob80f6442004-07-27 13:29:18 +0000915BASH_STRUCT_DIRENT_D_NAMLEN
Jari Aaltod166f041997-06-05 14:59:13 +0000916BASH_STRUCT_WINSIZE
Jari Aaltobb706242000-03-17 21:46:59 +0000917BASH_STRUCT_TIMEVAL
Jari Aaltof73dda02001-11-13 17:56:06 +0000918AC_CHECK_MEMBERS([struct stat.st_blocks])
Jari Aalto7117c2d2002-07-17 14:10:11 +0000919AC_STRUCT_TM
920AC_STRUCT_TIMEZONE
Jari Aaltob80f6442004-07-27 13:29:18 +0000921BASH_STRUCT_TIMEZONE
Jari Aaltod166f041997-06-05 14:59:13 +0000922
Chet Ramey495aee42011-11-22 19:11:26 -0500923BASH_STRUCT_WEXITSTATUS_OFFSET
924
Jari Aaltod166f041997-06-05 14:59:13 +0000925dnl presence and behavior of C library functions
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000926BASH_FUNC_STRSIGNAL
927BASH_FUNC_OPENDIR_CHECK
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000928BASH_FUNC_ULIMIT_MAXFDS
Jari Aalto31859422009-01-12 13:36:28 +0000929BASH_FUNC_FPURGE
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000930BASH_FUNC_GETENV
Jari Aalto7117c2d2002-07-17 14:10:11 +0000931if test "$ac_cv_func_getcwd" = "yes"; then
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000932BASH_FUNC_GETCWD
Jari Aaltof73dda02001-11-13 17:56:06 +0000933fi
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000934BASH_FUNC_POSIX_SETJMP
Jari Aaltod166f041997-06-05 14:59:13 +0000935BASH_FUNC_STRCOLL
Chet Ramey00018032011-11-21 20:51:19 -0500936BASH_FUNC_SNPRINTF
937BASH_FUNC_VSNPRINTF
Jari Aaltod166f041997-06-05 14:59:13 +0000938
Jari Aalto7117c2d2002-07-17 14:10:11 +0000939dnl If putenv or unsetenv is not present, set the right define so the
940dnl prototype and declaration in lib/sh/getenv.c will be standard-conformant
941
942if test "$ac_cv_func_putenv" = "yes"; then
943BASH_FUNC_STD_PUTENV
944else
945AC_DEFINE(HAVE_STD_PUTENV)
946fi
947if test "$ac_cv_func_unsetenv" = "yes"; then
948BASH_FUNC_STD_UNSETENV
949else
950AC_DEFINE(HAVE_STD_UNSETENV)
951fi
952
Jari Aaltof73dda02001-11-13 17:56:06 +0000953BASH_FUNC_PRINTF_A_FORMAT
954
Jari Aaltod166f041997-06-05 14:59:13 +0000955dnl presence and behavior of OS functions
Jari Aaltof73dda02001-11-13 17:56:06 +0000956BASH_SYS_REINSTALL_SIGHANDLERS
957BASH_SYS_JOB_CONTROL_MISSING
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000958BASH_SYS_NAMED_PIPES
Jari Aaltod166f041997-06-05 14:59:13 +0000959
960dnl presence of certain CPP defines
Jari Aaltof73dda02001-11-13 17:56:06 +0000961AC_HEADER_TIOCGWINSZ
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000962BASH_HAVE_TIOCSTAT
963BASH_HAVE_FIONREAD
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000964
Jari Aalto95732b42005-12-07 14:08:12 +0000965BASH_CHECK_WCONTINUED
966
Jari Aaltod166f041997-06-05 14:59:13 +0000967dnl miscellaneous
Jari Aaltof73dda02001-11-13 17:56:06 +0000968BASH_CHECK_SPEED_T
Jari Aaltod166f041997-06-05 14:59:13 +0000969BASH_CHECK_GETPW_FUNCS
Jari Aalto28ef6c32001-04-06 19:14:31 +0000970BASH_CHECK_RTSIGS
Jari Aaltof73dda02001-11-13 17:56:06 +0000971BASH_CHECK_SYS_SIGLIST
Jari Aaltod166f041997-06-05 14:59:13 +0000972
973dnl special checks
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000974case "$host_os" in
Jari Aaltof73dda02001-11-13 17:56:06 +0000975hpux*) BASH_CHECK_KERNEL_RLIMIT ;;
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000976esac
977
978if test "$opt_readline" = yes; then
Jari Aaltod166f041997-06-05 14:59:13 +0000979dnl yuck
980case "$host_os" in
981aix*) prefer_curses=yes ;;
982esac
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000983BASH_CHECK_LIB_TERMCAP
984fi
985AC_SUBST(TERMCAP_LIB)
986AC_SUBST(TERMCAP_DEP)
987
Jari Aaltod166f041997-06-05 14:59:13 +0000988BASH_CHECK_DEV_FD
Jari Aaltobb706242000-03-17 21:46:59 +0000989BASH_CHECK_DEV_STDIN
Jari Aaltof73dda02001-11-13 17:56:06 +0000990BASH_SYS_DEFAULT_MAIL_DIR
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000991
992if test "$bash_cv_job_control_missing" = missing; then
993 opt_job_control=no
994fi
995
996if test "$opt_job_control" = yes; then
997AC_DEFINE(JOB_CONTROL)
998JOBS_O=jobs.o
999else
1000JOBS_O=nojobs.o
1001fi
1002
1003AC_SUBST(JOBS_O)
1004
Jari Aaltod166f041997-06-05 14:59:13 +00001005dnl Defines that we want to propagate to the Makefiles in subdirectories,
1006dnl like glob and readline
1007
1008LOCAL_DEFS=-DSHELL
1009
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001010dnl use this section to possibly define more cpp variables, specify local
Jari Aalto31859422009-01-12 13:36:28 +00001011dnl libraries, and specify any additional local cc or ld flags
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001012dnl
1013dnl this should really go away someday
1014
Jari Aaltob72432f1999-02-19 17:11:39 +00001015case "${host_os}" in
Jari Aaltoe8ce7751997-09-22 20:22:27 +00001016sysv4.2*) AC_DEFINE(SVR4_2)
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001017 AC_DEFINE(SVR4) ;;
1018sysv4*) AC_DEFINE(SVR4) ;;
Jari Aaltob72432f1999-02-19 17:11:39 +00001019sysv5*) AC_DEFINE(SVR5) ;;
1020hpux9*) LOCAL_CFLAGS="-DHPUX9 -DHPUX" ;;
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001021hpux*) LOCAL_CFLAGS=-DHPUX ;;
1022dgux*) LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
Jari Aaltobb706242000-03-17 21:46:59 +00001023isc*) LOCAL_CFLAGS=-Disc386 ;;
1024rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
Jari Aaltof73dda02001-11-13 17:56:06 +00001025darwin*) LOCAL_CFLAGS=-DMACOSX ;;
Jari Aalto7117c2d2002-07-17 14:10:11 +00001026sco3.2v5*) LOCAL_CFLAGS="-b elf -DWAITPID_BROKEN -DPATH_MAX=1024" ;;
1027sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001028sco3.2*) LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
Jari Aaltod166f041997-06-05 14:59:13 +00001029sunos4*) LOCAL_CFLAGS=-DSunOS4 ;;
Jari Aaltof1be6662008-11-18 13:15:12 +00001030solaris2.5*) LOCAL_CFLAGS="-DSunOS5 -DSOLARIS" ;;
Jari Aalto17345e52009-02-19 22:21:29 +00001031solaris2.8*) LOCAL_CFLAGS=-DSOLARIS ;;
1032solaris2.9*) LOCAL_CFLAGS=-DSOLARIS ;;
1033solaris2.10*) LOCAL_CFLAGS=-DSOLARIS ;;
Jari Aaltof1be6662008-11-18 13:15:12 +00001034solaris2*) LOCAL_CFLAGS=-DSOLARIS ;;
Jari Aaltob72432f1999-02-19 17:11:39 +00001035lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
Jari Aalto95732b42005-12-07 14:08:12 +00001036linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
1037 case "`uname -r`" in
1038 2.[[456789]]*|3*) AC_DEFINE(PGRP_PIPE) ;;
1039 esac ;;
1040*qnx6*) LOCAL_CFLAGS="-Dqnx -Dqnx6" LOCAL_LIBS="-lncurses" ;;
Jari Aalto7117c2d2002-07-17 14:10:11 +00001041*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
Jari Aaltob72432f1999-02-19 17:11:39 +00001042powerux*) LOCAL_LIBS="-lgen" ;;
Jari Aaltob80f6442004-07-27 13:29:18 +00001043cygwin*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
Chet Ramey00018032011-11-21 20:51:19 -05001044opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO -D_POSIX_SOURCE -D_ALL_SOURCE" ;;
Jari Aaltob72432f1999-02-19 17:11:39 +00001045esac
1046
1047dnl Stanza for OS/compiler pair-specific flags
1048case "${host_os}-${CC}" in
1049aix4.2*-*gcc*) LOCAL_LDFLAGS="-Xlinker -bexpall -Xlinker -brtl" ;;
1050aix4.2*) LOCAL_LDFLAGS="-bexpall -brtl" ;;
1051bsdi4*-*gcc*) LOCAL_LDFLAGS="-rdynamic" ;; # allow dynamic loading, like Linux
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001052esac
1053
Jari Aaltobb706242000-03-17 21:46:59 +00001054dnl FreeBSD-3.x can have either a.out or ELF
1055case "${host_os}" in
Jari Aalto28ef6c32001-04-06 19:14:31 +00001056freebsd[[3-9]]*)
1057 if test -x /usr/bin/objformat && test "`/usr/bin/objformat`" = "elf" ; then
Jari Aaltobb706242000-03-17 21:46:59 +00001058 LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
1059 fi ;;
Jari Aalto28ef6c32001-04-06 19:14:31 +00001060freebsdelf*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
Jari Aalto95732b42005-12-07 14:08:12 +00001061dragonfly*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
Jari Aaltobb706242000-03-17 21:46:59 +00001062esac
1063
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001064case "$host_cpu" in
1065*cray*) LOCAL_CFLAGS="-DCRAY" ;; # shell var so config.h can use it
1066esac
1067
1068case "$host_cpu-$host_os" in
1069ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
1070esac
1071
1072case "$host_cpu-$host_vendor-$host_os" in
1073m88k-motorola-sysv3) LOCAL_CFLAGS=-DWAITPID_BROKEN ;;
1074mips-pyramid-sysv4) LOCAL_CFLAGS=-Xa ;;
1075esac
1076
Jari Aaltob72432f1999-02-19 17:11:39 +00001077#
1078# Shared object configuration section. These values are generated by
1079# ${srcdir}/support/shobj-conf
1080#
1081if test "$ac_cv_func_dlopen" = "yes" && test -f ${srcdir}/support/shobj-conf
1082then
1083 AC_MSG_CHECKING(shared object configuration for loadable builtins)
Jari Aalto28ef6c32001-04-06 19:14:31 +00001084 eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c "${host_cpu}" -o "${host_os}" -v "${host_vendor}"`
Jari Aaltob72432f1999-02-19 17:11:39 +00001085 AC_SUBST(SHOBJ_CC)
1086 AC_SUBST(SHOBJ_CFLAGS)
1087 AC_SUBST(SHOBJ_LD)
1088 AC_SUBST(SHOBJ_LDFLAGS)
1089 AC_SUBST(SHOBJ_XLDFLAGS)
1090 AC_SUBST(SHOBJ_LIBS)
1091 AC_SUBST(SHOBJ_STATUS)
1092 AC_MSG_RESULT($SHOBJ_STATUS)
1093fi
1094
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001095# try to create a directory tree if the source is elsewhere
1096# this should be packaged into a script accessible via ${srcdir}/support
1097case "$srcdir" in
1098.) ;;
Jari Aaltocce855b1998-04-17 19:52:44 +00001099*) for d in doc tests support lib examples; do # dirs
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001100 test -d $d || mkdir $d
1101 done
Jari Aaltocce855b1998-04-17 19:52:44 +00001102 for ld in readline glob tilde malloc sh termcap; do # libdirs
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001103 test -d lib/$ld || mkdir lib/$ld
1104 done
Jari Aaltocce855b1998-04-17 19:52:44 +00001105 test -d examples/loadables || mkdir examples/loadables # loadable builtins
Jari Aaltobb706242000-03-17 21:46:59 +00001106 test -d examples/loadables/perl || mkdir examples/loadables/perl
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001107 ;;
1108esac
1109
1110BUILD_DIR=`pwd`
Jari Aalto95732b42005-12-07 14:08:12 +00001111case "$BUILD_DIR" in
1112*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
1113*) ;;
1114esac
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001115
Jari Aalto31859422009-01-12 13:36:28 +00001116if test -z "$localedir"; then
1117 localedir='${datarootdir}/locale'
1118fi
1119if test -z "$datarootdir"; then
1120 datarootdir='${prefix}/share'
1121fi
1122
Jari Aaltocce855b1998-04-17 19:52:44 +00001123AC_SUBST(PROFILE_FLAGS)
1124
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001125AC_SUBST(incdir)
1126AC_SUBST(BUILD_DIR)
1127
Jari Aalto31859422009-01-12 13:36:28 +00001128# Some versions of autoconf don't substitute these automatically
1129AC_SUBST(datarootdir)
1130AC_SUBST(localedir)
1131
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001132AC_SUBST(YACC)
1133AC_SUBST(AR)
Jari Aaltob72432f1999-02-19 17:11:39 +00001134AC_SUBST(ARFLAGS)
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001135
Jari Aaltod166f041997-06-05 14:59:13 +00001136AC_SUBST(BASHVERS)
Jari Aalto7117c2d2002-07-17 14:10:11 +00001137AC_SUBST(RELSTATUS)
1138AC_SUBST(DEBUG)
1139AC_SUBST(MALLOC_DEBUG)
Jari Aaltod166f041997-06-05 14:59:13 +00001140
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001141AC_SUBST(host_cpu)
Jari Aaltob72432f1999-02-19 17:11:39 +00001142AC_SUBST(host_vendor)
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001143AC_SUBST(host_os)
1144
1145AC_SUBST(LOCAL_LIBS)
1146AC_SUBST(LOCAL_CFLAGS)
1147AC_SUBST(LOCAL_LDFLAGS)
Jari Aaltod166f041997-06-05 14:59:13 +00001148AC_SUBST(LOCAL_DEFS)
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001149
Jari Aaltod166f041997-06-05 14:59:13 +00001150#AC_SUBST(ALLOCA_SOURCE)
1151#AC_SUBST(ALLOCA_OBJECT)
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001152
1153AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
Jari Aaltob80f6442004-07-27 13:29:18 +00001154 lib/intl/Makefile \
Jari Aaltocce855b1998-04-17 19:52:44 +00001155 lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \
Jari Aaltob80f6442004-07-27 13:29:18 +00001156 lib/tilde/Makefile doc/Makefile support/Makefile po/Makefile.in \
Jari Aalto31859422009-01-12 13:36:28 +00001157 examples/loadables/Makefile examples/loadables/perl/Makefile],
Jari Aaltoccc6cda1996-12-23 17:02:34 +00001158[
1159# Makefile uses this timestamp file to record whether config.h is up to date.
1160echo timestamp > stamp-h
1161])