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