]> git.ipfire.org Git - thirdparty/bash.git/blame - configure.in
Imported from ../bash-2.05.tar.gz.
[thirdparty/bash.git] / configure.in
CommitLineData
ccc6cda3 1dnl
28ef6c31 2dnl Configure script for bash-2.05
ccc6cda3
JA
3dnl
4dnl report bugs to chet@po.cwru.edu
5dnl
6dnl Process this file with autoconf to produce a configure script.
d166f048 7
bb70624e 8dnl checks for version info
28ef6c31 9AC_REVISION([for Bash 2.05, version 2.90, from autoconf version] AC_ACVERSION)dnl
ccc6cda3
JA
10
11AC_INIT(shell.h)
12AC_CONFIG_HEADER(config.h)
13
14dnl make sure we are using a recent autoconf version
bb70624e 15AC_PREREQ(2.12)
ccc6cda3
JA
16
17dnl where to find install.sh, config.sub, and config.guess
18AC_CONFIG_AUX_DIR(./support)
19
20dnl canonicalize the host and os so we can do some tricky things before
21dnl parsing options
22AC_CANONICAL_HOST
23
24dnl configure defaults
bb70624e 25opt_bash_malloc=yes
ccc6cda3
JA
26opt_glibc_malloc=no
27opt_purify=no
d166f048 28opt_purecov=no
ccc6cda3 29opt_afs=no
d166f048 30opt_curses=no
b72432fd 31opt_with_installed_readline=no
ccc6cda3 32
bb70624e
JA
33#htmldir=
34
28ef6c31 35dnl some systems should be configured without the bash malloc by default
ccc6cda3
JA
36dnl and some need a special compiler or loader
37dnl look in the NOTES file for more
38case "${host_cpu}-${host_os}" in
bb70624e 39alpha*-*) opt_bash_malloc=no ;; # alpha running osf/1 or linux
28ef6c31 40*[[Cc]]ray*-*) opt_bash_malloc=no ;; # Crays
bb70624e
JA
41*-osf1*) opt_bash_malloc=no ;; # other osf/1 machines
42sparc-svr4*) opt_bash_malloc=no ;; # sparc SVR4, SVR4.2
43sparc-netbsd*) opt_bash_malloc=no ;; # needs 8-byte alignment
44mips-irix6*) opt_bash_malloc=no ;; # needs 8-byte alignment
45m68k-sysv) opt_bash_malloc=no ;; # fixes file descriptor leak in closedir
46sparc-linux*) opt_bash_malloc=no ;; # sparc running linux; requires ELF
47#*-freebsd*) opt_bash_malloc=no ;; # they claim it's better
48*-aix*) opt_bash_malloc=no ;; # AIX machines
49*-nextstep*) opt_bash_malloc=no ;; # NeXT machines running NeXTstep
28ef6c31
JA
50*-macos*) opt_bash_malloc=no ;; # Apple MacOS X
51*-rhapsody*) opt_bash_malloc=no ;; # Apple Rhapsody (MacOS X)
52*-darwin*) opt_bash_malloc=no ;; # Apple Darwin (MacOS X)
bb70624e
JA
53*-dgux*) opt_bash_malloc=no ;; # DG/UX machines
54*-qnx*) opt_bash_malloc=no ;; # QNX 4.2
55*-machten4) opt_bash_malloc=no ;; # MachTen 4.x
56*-bsdi2.1|*-bsdi3.?) opt_bash_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
57*-beos*) opt_bash_malloc=no ;; # they say it's suitable
28ef6c31
JA
58*-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
59*-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft
ccc6cda3
JA
60esac
61
62dnl arguments to configure
63dnl packages
d166f048 64AC_ARG_WITH(afs, --with-afs if you are running AFS, opt_afs=$withval)
bb70624e 65AC_ARG_WITH(bash-malloc, --with-bash-malloc use the Bash version of malloc,opt_bash_malloc=$withval)
d166f048 66AC_ARG_WITH(curses, --with-curses use the curses library instead of the termcap library,opt_curses=$withval)
ccc6cda3 67AC_ARG_WITH(glibc-malloc, --with-glibc-malloc use the GNU C library version of malloc,opt_glibc_malloc=$withval)
bb70624e 68AC_ARG_WITH(gnu-malloc, --with-gnu-malloc synonym for --with-bash-malloc,opt_bash_malloc=$withval)
b72432fd 69AC_ARG_WITH(installed-readline, --with-installed-readline use a version of the readline library that is already installed, opt_with_installed_readline=$withval)
d166f048 70AC_ARG_WITH(purecov, --with-purecov configure to postprocess with pure coverage, opt_purecov=$withval)
ccc6cda3 71AC_ARG_WITH(purify, --with-purify configure to postprocess with purify, opt_purify=$withval)
ccc6cda3
JA
72
73dnl test for glibc malloc first because it can override the default
74if test "$opt_glibc_malloc" = yes; then
d166f048
JA
75 MALLOC_TARGET=gmalloc
76 MALLOC_SRC=gmalloc.c
bb70624e 77elif test "$opt_bash_malloc" = yes; then
d166f048
JA
78 MALLOC_TARGET=malloc
79 MALLOC_SRC=malloc.c
bb70624e 80 AC_DEFINE(USING_BASH_MALLOC)
ccc6cda3 81else
d166f048
JA
82 MALLOC_TARGET=stubmalloc
83 MALLOC_SRC=stub.c
ccc6cda3
JA
84fi
85
86if test "$opt_purify" = yes; then
d166f048 87 PURIFY="purify "
ccc6cda3
JA
88else
89 PURIFY=
90fi
91
d166f048
JA
92if test "$opt_purecov" = yes; then
93 PURIFY="${PURIFY}purecov"
94fi
95
ccc6cda3
JA
96if test "$opt_afs" = yes; then
97 AC_DEFINE(AFS)
98fi
99
d166f048
JA
100if test "$opt_curses" = yes; then
101 prefer_curses=yes
102fi
103
ccc6cda3
JA
104dnl optional shell features in config.h.in
105opt_minimal_config=no
106
107opt_job_control=yes
108opt_alias=yes
109opt_readline=yes
110opt_history=yes
111opt_bang_history=yes
112opt_dirstack=yes
113opt_restricted=yes
114opt_process_subst=yes
115opt_prompt_decoding=yes
116opt_select=yes
117opt_help=yes
118opt_array_variables=yes
119opt_dparen_arith=yes
cce855bc 120opt_extended_glob=yes
ccc6cda3
JA
121opt_brace_expansion=yes
122opt_disabled_builtins=no
123opt_command_timing=yes
bb70624e 124opt_xpg_echo=no
cce855bc 125opt_cond_command=yes
bb70624e
JA
126opt_arith_for_command=yes
127opt_net_redirs=yes
128opt_progcomp=yes
cce855bc
JA
129
130dnl options that affect how bash is compiled and linked
131opt_static_link=no
132opt_profiling=no
ccc6cda3
JA
133
134dnl argument parsing for optional features
135AC_ARG_ENABLE(minimal-config, --enable-minimal-config a minimal sh-like configuration, opt_minimal_config=$enableval)
136
137dnl a minimal configuration turns everything off, but features can be
138dnl added individually
139if test $opt_minimal_config = yes; then
140 opt_job_control=no opt_alias=no opt_readline=no
141 opt_history=no opt_bang_history=no opt_dirstack=no
142 opt_restricted=no opt_process_subst=no opt_prompt_decoding=no
143 opt_select=no opt_help=no opt_array_variables=no opt_dparen_arith=no
144 opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
bb70624e
JA
145 opt_extended_glob=no opt_cond_command=no opt_arith_for_command=no
146 opt_net_redirs=no opt_progcomp=no
ccc6cda3
JA
147fi
148
ccc6cda3 149AC_ARG_ENABLE(alias, --enable-alias enable shell aliases, opt_alias=$enableval)
bb70624e 150AC_ARG_ENABLE(arith-for-command, --enable-arith-for-command enable arithmetic for command, opt_arith_for_command=$enableval)
d166f048 151AC_ARG_ENABLE(array-variables, --enable-array-variables include shell array variables, opt_array_variables=$enableval)
ccc6cda3 152AC_ARG_ENABLE(bang-history, --enable-bang-history turn on csh-style history substitution, opt_bang_history=$enableval)
d166f048
JA
153AC_ARG_ENABLE(brace-expansion, --enable-brace-expansion include brace expansion, opt_brace_expansion=$enableval)
154AC_ARG_ENABLE(command-timing, --enable-command-timing enable the time reserved word and command timing, opt_command_timing=$enableval)
cce855bc 155AC_ARG_ENABLE(cond-command, --enable-cond-command enable the conditional command, opt_cond_command=$enableval)
ccc6cda3 156AC_ARG_ENABLE(directory-stack, --enable-directory-stack enable builtins pushd/popd/dirs, opt_dirstack=$enableval)
d166f048
JA
157AC_ARG_ENABLE(disabled-builtins, --enable-disabled-builtins allow disabled builtins to still be invoked, opt_disabled_builtins=$enableval)
158AC_ARG_ENABLE(dparen-arithmetic, [--enable-dparen-arithmetic include ((...)) command], opt_dparen_arith=$enableval)
cce855bc 159AC_ARG_ENABLE(extended-glob, --enable-extended-glob include ksh-style extended pattern matching, opt_extended_glob=$enableval)
d166f048
JA
160AC_ARG_ENABLE(help-builtin, --enable-help-builtin include the help builtin, opt_help=$enableval)
161AC_ARG_ENABLE(history, --enable-history turn on command history, opt_history=$enableval)
162AC_ARG_ENABLE(job-control, --enable-job-control enable job control features, opt_job_control=$enableval)
bb70624e 163AC_ARG_ENABLE(net-redirections, --enable-net-redirections enable /dev/tcp/host/port redirection, opt_net_redirs=$enableval)
ccc6cda3 164AC_ARG_ENABLE(process-substitution, --enable-process-substitution enable process substitution, opt_process_subst=$enableval)
bb70624e 165AC_ARG_ENABLE(progcomp, --enable-progcomp enable programmable completion and the complete builtin, opt_progcomp=$enableval)
ccc6cda3 166AC_ARG_ENABLE(prompt-string-decoding, --enable-prompt-string-decoding turn on escape character decoding in prompts, opt_prompt_decoding=$enableval)
d166f048
JA
167AC_ARG_ENABLE(readline, --enable-readline turn on command line editing, opt_readline=$enableval)
168AC_ARG_ENABLE(restricted, --enable-restricted enable a restricted shell, opt_restricted=$enableval)
ccc6cda3 169AC_ARG_ENABLE(select, --enable-select include select command, opt_select=$enableval)
bb70624e
JA
170AC_ARG_ENABLE(usg-echo-default, --enable-usg-echo-default a synonym for --enable-xpg-echo-default, opt_xpg_echo=$enableval)
171AC_ARG_ENABLE(xpg-echo-default, --enable-xpg-echo-default make the echo builtin expand escape sequences by default, opt_xpg_echo=$enableval)
ccc6cda3 172
cce855bc
JA
173dnl options that alter how bash is compiled and linked
174AC_ARG_ENABLE(profiling, --enable-profiling allow profiling with gprof, opt_profiling=$enableval)
175AC_ARG_ENABLE(static-link, --enable-static-link [link bash statically, for use as a root shell], opt_static_link=$enableval)
176
ccc6cda3
JA
177dnl opt_job_control is handled later, after BASH_JOB_CONTROL_MISSING runs
178
b72432fd
JA
179dnl opt_readline and opt_history are handled later, because AC_PROG_CC needs
180dnl to be run before we can check the version of an already-installed readline
181dnl library
182
ccc6cda3
JA
183if test $opt_alias = yes; then
184AC_DEFINE(ALIAS)
185fi
ccc6cda3
JA
186if test $opt_dirstack = yes; then
187AC_DEFINE(PUSHD_AND_POPD)
188fi
189if test $opt_restricted = yes; then
190AC_DEFINE(RESTRICTED_SHELL)
191fi
192if test $opt_process_subst = yes; then
193AC_DEFINE(PROCESS_SUBSTITUTION)
194fi
195if test $opt_prompt_decoding = yes; then
196AC_DEFINE(PROMPT_STRING_DECODE)
197fi
198if test $opt_select = yes; then
199AC_DEFINE(SELECT_COMMAND)
200fi
201if test $opt_help = yes; then
202AC_DEFINE(HELP_BUILTIN)
203fi
204if test $opt_array_variables = yes; then
205AC_DEFINE(ARRAY_VARS)
206fi
207if test $opt_dparen_arith = yes; then
208AC_DEFINE(DPAREN_ARITHMETIC)
209fi
210if test $opt_brace_expansion = yes; then
211AC_DEFINE(BRACE_EXPANSION)
212fi
213if test $opt_disabled_builtins = yes; then
214AC_DEFINE(DISABLED_BUILTINS)
215fi
216if test $opt_command_timing = yes; then
217AC_DEFINE(COMMAND_TIMING)
218fi
bb70624e
JA
219if test $opt_xpg_echo = yes ; then
220AC_DEFINE(DEFAULT_ECHO_TO_XPG)
ccc6cda3 221fi
cce855bc
JA
222if test $opt_extended_glob = yes ; then
223AC_DEFINE(EXTENDED_GLOB)
224fi
225if test $opt_cond_command = yes ; then
226AC_DEFINE(COND_COMMAND)
227fi
bb70624e
JA
228if test $opt_arith_for_command = yes; then
229AC_DEFINE(ARITH_FOR_COMMAND)
230fi
231if test $opt_net_redirs = yes; then
232AC_DEFINE(NETWORK_REDIRECTIONS)
233fi
234if test $opt_progcomp = yes; then
235AC_DEFINE(PROGRAMMABLE_COMPLETION)
236fi
ccc6cda3 237
d166f048
JA
238if test "$opt_minimal_config" = yes; then
239 TESTSCRIPT=run-minimal
240else
241 TESTSCRIPT=run-all
242fi
243
ccc6cda3 244dnl now substitute in the values generated by arguments
d166f048 245AC_SUBST(TESTSCRIPT)
ccc6cda3 246AC_SUBST(PURIFY)
d166f048 247AC_SUBST(MALLOC_TARGET)
ccc6cda3 248AC_SUBST(MALLOC_SRC)
ccc6cda3 249
bb70624e
JA
250AC_SUBST(htmldir)
251
d166f048
JA
252dnl Use GNU m4 macros to get the distribution and patchlevel information
253dnl into configure without requiring the files to be distributed
254[BASHVERS=]dnl
255esyscmd(cat _distribution)dnl
256[BASHPATCH=]dnl
257esyscmd(cat _patchlevel)dnl
258
cce855bc 259echo "Beginning configuration for bash-$BASHVERS for ${host_cpu}-${host_vendor}-${host_os}"
ccc6cda3
JA
260
261dnl compilation checks
cce855bc
JA
262dnl AC_PROG_CC sets $cross_compiling to `yes' if cross-compiling for a
263dnl different environment
ccc6cda3 264AC_PROG_CC
cce855bc 265BASH_LARGE_FILE_SUPPORT
bb70624e
JA
266
267dnl test for Unix variants
ccc6cda3
JA
268AC_ISC_POSIX
269AC_MINIX
270
bb70624e
JA
271dnl test for non-Unix variants
272AC_CYGWIN
273AC_MINGW32
274AC_EXEEXT
275
28ef6c31 276dnl BEGIN changes for cross-building for cygwin and BeOS
b72432fd
JA
277
278SIGNAMES_H=lsignames.h
cce855bc
JA
279
280dnl load up the cross-building cache file -- add more cases and cache
281dnl files as necessary
b72432fd
JA
282
283dnl Note that host and target machine are the same, and different than the
284dnl build machine.
285dnl Set SIGNAMES_H based on whether or not we're cross-compiling.
286
cce855bc
JA
287if test "x$cross_compiling" = "xyes"; then
288 case "${host}" in
28ef6c31 289 *-cygwin*)
cce855bc 290 cross_cache=${srcdir}/cross-build/cygwin32.cache
b72432fd 291 SIGNAMES_H='$(srcdir)/cross-build/win32sig.h'
cce855bc 292 ;;
b72432fd
JA
293 i[[3456]]86-*-beos*)
294 cross_cache=${srcdir}/cross-build/x86-beos.cache
295 SIGNAMES_H='${srcdir}/cross-build/beos-sig.h'
296 ;;
297 *) echo "configure: cross-compiling for $host is not supported" >&2
cce855bc
JA
298 ;;
299 esac
b72432fd
JA
300 if test -n "${cross_cache}" && test -r "${cross_cache}"; then
301 echo "loading cross-build cache file ${cross_cache}"
302 . ${cross_cache}
303 fi
304 unset cross_cache
cce855bc 305fi
b72432fd 306AC_SUBST(SIGNAMES_H)
cce855bc
JA
307
308if test -z "$CC_FOR_BUILD"; then
309 if test "x$cross_compiling" = "xno"; then
310 CC_FOR_BUILD='$(CC)'
311 else
312 CC_FOR_BUILD=gcc
313 fi
314fi
315AC_SUBST(CC_FOR_BUILD)
316
b72432fd 317dnl END changes for cross-building
cce855bc 318
ccc6cda3
JA
319dnl We want these before the checks, so the checks can modify their values.
320test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
321
322dnl If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS.
323test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
324
cce855bc
JA
325dnl handle options that alter how bash is compiled and linked
326dnl these must come after the test for cc/gcc
327if test "$opt_profiling" = "yes"; then
328 PROFILE_FLAGS=-pg
b72432fd
JA
329 case "$host_os" in
330 solaris2*) ;;
331 *) opt_static_link=yes ;;
332 esac
cce855bc
JA
333fi
334
335if test "$opt_static_link" = yes; then
336 # if we're using gcc, add `-static' to LDFLAGS
337 if test -n "$GCC" || test "$ac_cv_prog_gcc" = "yes"; then
b72432fd 338 STATIC_LD="-static"
28ef6c31 339 LDFLAGS="$LDFLAGS -static" # XXX experimental
cce855bc
JA
340 fi
341fi
342
ccc6cda3
JA
343AC_SUBST(CFLAGS)
344AC_SUBST(CPPFLAGS)
345AC_SUBST(LDFLAGS)
b72432fd 346AC_SUBST(STATIC_LD)
ccc6cda3
JA
347
348AC_PROG_GCC_TRADITIONAL
349
b72432fd
JA
350dnl BEGIN READLINE and HISTORY LIBRARY SECTION
351dnl prepare to allow bash to be linked against an already-installed readline
352
353dnl first test that the readline version is new enough to link bash against
354if test "$opt_readline" = yes && test "$opt_with_installed_readline" = "yes"
355then
356
357dnl we duplicate some work that's done later here so we can look in
358dnl the correct directory for the readline library
359
bb70624e
JA
360 if test -z "$TERMCAP_LIB" ; then
361 BASH_CHECK_LIB_TERMCAP
362 fi
363
b72432fd
JA
364 test "x$prefix" = xNONE && _rl_prefix=$ac_default_prefix || _rl_prefix=${prefix}
365 test "x$exec_prefix" = xNONE && _rl_exec_prefix=${_rl_prefix} || _rl_exec_prefix=${exec_prefix}
366
367 AC_MSG_CHECKING(version of installed readline library)
28ef6c31 368 _rl_version=`exec_prefix=${_rl_exec_prefix} ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/rlvers.sh -C "${CC}" -L ${libdir} -I ${includedir} -T ${TERMCAP_LIB}`
b72432fd
JA
369 AC_MSG_RESULT($_rl_version)
370
371 case "$_rl_version" in
28ef6c31 372 4.[[2-9]]*|5*|6*|7*|8*|9*) ;;
b72432fd
JA
373 *) opt_with_installed_readline=no
374 AC_MSG_WARN(installed readline library is too old to be linked with bash)
375 AC_MSG_WARN(using private bash version)
376 ;;
377 esac
378 unset _rl_version _rl_prefix _rl_exec_prefix
379fi
380
381if test $opt_readline = yes; then
382 AC_DEFINE(READLINE)
383 READLINE_LIB=-lreadline
384 if test "$opt_with_installed_readline" = "yes" ; then
385 RL_LIBDIR='$(libdir)'
386 READLINE_DEP=
387 RL_INCLUDE='-I$(includedir)'
388 else
389 RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
390 READLINE_DEP='$(READLINE_LIBRARY)'
391 fi
392else
393 RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
394 READLINE_LIB= READLINE_DEP=
395fi
396if test $opt_history = yes || test $opt_bang_history = yes; then
397 if test $opt_history = yes; then
398 AC_DEFINE(HISTORY)
399 fi
400 if test $opt_bang_history = yes; then
401 AC_DEFINE(BANG_HISTORY)
402 fi
403 HISTORY_LIB=-lhistory
404 if test "$opt_with_installed_readline" = "yes"; then
405 HIST_LIBDIR='$(libdir)'
406 HISTORY_DEP=
407 RL_INCLUDE='-I$(includedir)'
408 else
409 HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
410 HISTORY_DEP='$(HISTORY_LIBRARY)'
411 fi
412else
413 HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
414 HISTORY_LIB= HISTORY_DEP=
415fi
416AC_SUBST(READLINE_LIB)
417AC_SUBST(READLINE_DEP)
418AC_SUBST(RL_LIBDIR)
419AC_SUBST(RL_INCLUDE)
420AC_SUBST(HISTORY_LIB)
421AC_SUBST(HISTORY_DEP)
422AC_SUBST(HIST_LIBDIR)
423
424dnl END READLINE and HISTORY LIBRARY SECTION
425
ccc6cda3
JA
426dnl programs needed by the build and install process
427AC_PROG_INSTALL
428AC_CHECK_PROG(AR, ar, ar)
b72432fd
JA
429dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
430dnl This allows people to set it when running configure or make
431test -n "$ARFLAGS" || ARFLAGS="cr"
ccc6cda3
JA
432AC_PROG_RANLIB
433AC_PROG_YACC
434AC_PROG_MAKE_SET
435
b72432fd 436case "$host_os" in
bb70624e 437opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
b72432fd
JA
438*) MAKE_SHELL=/bin/sh ;;
439esac
440AC_SUBST(MAKE_SHELL)
441
ccc6cda3
JA
442dnl special checks for libc functions
443AC_FUNC_ALLOCA
444AC_FUNC_GETPGRP
445AC_FUNC_SETVBUF_REVERSED
446AC_FUNC_VPRINTF
447AC_FUNC_WAIT3
448AC_FUNC_STRCOLL
449
450dnl if vprintf is not in libc, see if it's defined in stdio.h
451if test "$ac_cv_func_vprintf" = no; then
452 AC_MSG_CHECKING(for declaration of vprintf in stdio.h)
453 AC_EGREP_HEADER([[int[ ]*vprintf[^a-zA-Z0-9]]],stdio.h,ac_cv_func_vprintf=yes)
454 AC_MSG_RESULT($ac_cv_func_vprintf)
455 if test $ac_cv_func_vprintf = yes; then
456 AC_DEFINE(HAVE_VPRINTF)
457 fi
458fi
459
460dnl signal stuff
461AC_RETSIGTYPE
462
463dnl checks for certain version-specific system calls and libc functions
464AC_CHECK_FUNC(__setostype, AC_DEFINE(HAVE_SETOSTYPE))
465AC_CHECK_FUNC(wait3, AC_DEFINE(HAVE_WAIT3))
466
467dnl checks for missing libc functions
468AC_CHECK_FUNC(mkfifo,AC_DEFINE(HAVE_MKFIFO),AC_DEFINE(MKFIFO_MISSING))
469
470dnl checks for system calls
471AC_CHECK_FUNCS(dup2 select getdtablesize getgroups gethostname \
b72432fd 472 setdtablesize getpagesize killpg lstat getpeername sbrk \
28ef6c31
JA
473 getrlimit getrusage gettimeofday waitpid tcgetpgrp \
474 readlink rename)
ccc6cda3
JA
475
476dnl checks for c library functions
477AC_CHECK_FUNCS(bcopy bzero confstr getcwd strcasecmp setenv putenv \
cce855bc
JA
478 setlinebuf setlocale strchr strerror strtod strtol \
479 strtoul tcgetattr uname sysconf ulimit times tzset \
28ef6c31
JA
480 siginterrupt memmove ttyname gethostbyname getservbyname \
481 inet_aton strpbrk setvbuf pathconf)
ccc6cda3
JA
482
483dnl checks for locale functions
484AC_CHECK_HEADERS(libintl.h)
485AC_CHECK_FUNCS(gettext textdomain bindtextdomain)
486
487dnl check for GNU libintl if gettext/textdomain/bindtextdomain
488dnl are not found in libc
489if test "$ac_cv_func_bindtextdomain" = "no"; then
490 AC_CHECK_LIB(intl,bindtextdomain)
491 if test "$ac_cv_lib_intl" = "yes"; then
492 AC_CHECK_FUNCS(gettext textdomain bindtextdomain)
493 fi
494fi
495
496dnl checks for the dynamic loading library functions in libc and libdl
cce855bc 497if test "$opt_static_link" != yes; then
ccc6cda3
JA
498AC_CHECK_LIB(dl, dlopen)
499AC_CHECK_FUNCS(dlopen dlclose dlsym)
cce855bc 500fi
ccc6cda3
JA
501
502dnl this defines SYS_SIGLIST_DECLARED
503AC_DECL_SYS_SIGLIST
504
505dnl header files
506AC_HEADER_DIRENT
507AC_HEADER_TIME
508
509AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
cce855bc 510 memory.h locale.h termcap.h termio.h termios.h dlfcn.h \
bb70624e 511 stddef.h netdb.h)
ccc6cda3
JA
512AC_CHECK_HEADERS(sys/ptem.h sys/pte.h sys/stream.h sys/select.h sys/file.h \
513 sys/resource.h sys/param.h sys/socket.h \
514 sys/time.h sys/times.h sys/wait.h)
bb70624e
JA
515AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)
516
517dnl network functions -- check for inet_aton again
518if test "$ac_cv_func_inet_aton" != 'yes'; then
519BASH_FUNC_INET_ATON
520fi
ccc6cda3
JA
521
522dnl libraries
523dnl this is reportedly no longer necessary for irix[56].?
bb70624e
JA
524case "$host_os" in
525irix4*) AC_CHECK_LIB(sun, getpwent) ;;
526esac
527
d166f048
JA
528dnl check for getpeername in the socket library only if it's not in libc
529if test "$ac_cv_func_getpeername" = no; then
530 BASH_CHECK_SOCKLIB
531fi
bb70624e
JA
532dnl check for gethostbyname in socket libraries if it's not in libc
533if test "$ac_cv_func_gethostbyname" = no; then
534 BASH_FUNC_GETHOSTBYNAME
535fi
ccc6cda3
JA
536
537dnl system types
538AC_TYPE_GETGROUPS
539AC_TYPE_OFF_T
540AC_TYPE_MODE_T
541AC_TYPE_UID_T
542AC_TYPE_PID_T
543AC_TYPE_SIZE_T
544AC_CHECK_TYPE(time_t, long)
545
546AC_TYPE_SIGNAL
547
bb70624e
JA
548AC_CHECK_SIZEOF(char, 1)
549AC_CHECK_SIZEOF(short, 2)
b72432fd
JA
550AC_CHECK_SIZEOF(int, 4)
551AC_CHECK_SIZEOF(long, 4)
552AC_CHECK_SIZEOF(char *, 4)
553AC_CHECK_SIZEOF(double, 8)
cce855bc 554
bb70624e
JA
555AC_CHECK_TYPE(u_int, unsigned int)
556AC_CHECK_TYPE(u_long, unsigned long)
557
558BASH_TYPE_BITS16_T
559BASH_TYPE_U_BITS16_T
560BASH_TYPE_BITS32_T
561BASH_TYPE_U_BITS32_T
b72432fd 562BASH_TYPE_BITS64_T
cce855bc 563
bb70624e
JA
564BASH_TYPE_PTRDIFF_T
565
ccc6cda3
JA
566dnl structures
567AC_HEADER_STAT
ccc6cda3
JA
568
569dnl C compiler characteristics
570AC_C_BIGENDIAN
571
572dnl system services
573AC_SYS_INTERPRETER
574if test $ac_cv_sys_interpreter = yes; then
575AC_DEFINE(HAVE_HASH_BANG_EXEC)
576fi
577dnl we use NO_READ_RESTART_ON_SIGNAL
578AC_SYS_RESTARTABLE_SYSCALLS
579
580dnl Miscellaneous Bash tests
581if test "$ac_cv_func_lstat" = "no"; then
582BASH_FUNC_LSTAT
583fi
584
d166f048 585dnl behavior of system calls and library functions
ccc6cda3
JA
586BASH_DUP2_CLOEXEC_CHECK
587BASH_PGRP_SYNC
d166f048
JA
588BASH_SIGNAL_CHECK
589
cce855bc
JA
590if test "$ac_cv_sys_restartable_syscalls" = "no"; then
591BASH_SYS_RESTARTABLE_SYSCALLS
592fi
593
d166f048 594dnl checking for the presence of certain library symbols
ccc6cda3
JA
595BASH_SYS_ERRLIST
596BASH_SYS_SIGLIST
597BASH_UNDER_SYS_SIGLIST
d166f048
JA
598
599dnl various system types
ccc6cda3
JA
600BASH_TYPE_SIGHANDLER
601BASH_CHECK_TYPE(clock_t, [#include <sys/times.h>], long)
602BASH_CHECK_TYPE(sigset_t, [#include <signal.h>], int)
603BASH_CHECK_TYPE(quad_t, , long, HAVE_QUAD_T)
604BASH_RLIMIT_TYPE
d166f048
JA
605
606dnl presence and contents of structures used by system calls
ccc6cda3
JA
607BASH_STRUCT_TERMIOS_LDISC
608BASH_STRUCT_TERMIO_LDISC
609BASH_STRUCT_DIRENT_D_INO
d166f048
JA
610BASH_STRUCT_DIRENT_D_FILENO
611BASH_STRUCT_WINSIZE
bb70624e 612BASH_STRUCT_TIMEVAL
d166f048
JA
613
614dnl presence and behavior of C library functions
ccc6cda3
JA
615BASH_FUNC_STRSIGNAL
616BASH_FUNC_OPENDIR_CHECK
617BASH_FUNC_PRINTF
618BASH_FUNC_ULIMIT_MAXFDS
619BASH_FUNC_GETENV
620BASH_FUNC_GETCWD
621BASH_FUNC_SBRK_DECLARED
622BASH_FUNC_POSIX_SETJMP
d166f048
JA
623BASH_FUNC_STRCOLL
624
625dnl presence and behavior of OS functions
ccc6cda3
JA
626BASH_REINSTALL_SIGHANDLERS
627BASH_JOB_CONTROL_MISSING
628BASH_SYS_NAMED_PIPES
d166f048
JA
629
630dnl presence of certain CPP defines
ccc6cda3
JA
631BASH_HAVE_TIOCGWINSZ
632BASH_HAVE_TIOCSTAT
633BASH_HAVE_FIONREAD
d166f048
JA
634
635dnl miscellaneous
636BASH_MISC_SPEED_T
ccc6cda3 637BASH_CHECK_GETPW_FUNCS
28ef6c31 638BASH_CHECK_RTSIGS
ccc6cda3 639
d166f048 640dnl special checks
ccc6cda3
JA
641case "$host_os" in
642hpux*) BASH_KERNEL_RLIMIT_CHECK ;;
643esac
644
645if test "$opt_readline" = yes; then
d166f048
JA
646dnl yuck
647case "$host_os" in
648aix*) prefer_curses=yes ;;
649esac
ccc6cda3
JA
650BASH_CHECK_LIB_TERMCAP
651fi
652AC_SUBST(TERMCAP_LIB)
653AC_SUBST(TERMCAP_DEP)
654
d166f048 655BASH_CHECK_DEV_FD
bb70624e 656BASH_CHECK_DEV_STDIN
ccc6cda3
JA
657BASH_DEFAULT_MAIL_DIR
658
659if test "$bash_cv_job_control_missing" = missing; then
660 opt_job_control=no
661fi
662
663if test "$opt_job_control" = yes; then
664AC_DEFINE(JOB_CONTROL)
665JOBS_O=jobs.o
666else
667JOBS_O=nojobs.o
668fi
669
670AC_SUBST(JOBS_O)
671
d166f048
JA
672dnl Defines that we want to propagate to the Makefiles in subdirectories,
673dnl like glob and readline
674
675LOCAL_DEFS=-DSHELL
676
ccc6cda3
JA
677dnl use this section to possibly define more cpp variables, specify local
678dnl libraries, and specify any additional local cc flags
679dnl
680dnl this should really go away someday
681
b72432fd 682case "${host_os}" in
e8ce775d 683sysv4.2*) AC_DEFINE(SVR4_2)
ccc6cda3
JA
684 AC_DEFINE(SVR4) ;;
685sysv4*) AC_DEFINE(SVR4) ;;
b72432fd
JA
686sysv5*) AC_DEFINE(SVR5) ;;
687hpux9*) LOCAL_CFLAGS="-DHPUX9 -DHPUX" ;;
ccc6cda3
JA
688hpux*) LOCAL_CFLAGS=-DHPUX ;;
689dgux*) LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
bb70624e
JA
690isc*) LOCAL_CFLAGS=-Disc386 ;;
691rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
b72432fd 692sco3.2v5*) LOCAL_CFLAGS="-b elf -DWAITPID_BROKEN -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
ccc6cda3
JA
693sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
694sco3.2*) LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
d166f048
JA
695sunos4*) LOCAL_CFLAGS=-DSunOS4 ;;
696solaris2.5*) LOCAL_CFLAGS=-DSunOS5 ;;
b72432fd 697lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
d166f048 698linux*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
d166f048 699*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s -lunix -lncurses" ;;
b72432fd 700powerux*) LOCAL_LIBS="-lgen" ;;
28ef6c31 701cygwin*) LOCAL_LIBS="-luser32" ;;
b72432fd
JA
702opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG" ;;
703esac
704
705dnl Stanza for OS/compiler pair-specific flags
706case "${host_os}-${CC}" in
707aix4.2*-*gcc*) LOCAL_LDFLAGS="-Xlinker -bexpall -Xlinker -brtl" ;;
708aix4.2*) LOCAL_LDFLAGS="-bexpall -brtl" ;;
709bsdi4*-*gcc*) LOCAL_LDFLAGS="-rdynamic" ;; # allow dynamic loading, like Linux
ccc6cda3
JA
710esac
711
bb70624e
JA
712dnl FreeBSD-3.x can have either a.out or ELF
713case "${host_os}" in
28ef6c31
JA
714freebsd[[3-9]]*)
715 if test -x /usr/bin/objformat && test "`/usr/bin/objformat`" = "elf" ; then
bb70624e
JA
716 LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
717 fi ;;
28ef6c31 718freebsdelf*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
bb70624e
JA
719esac
720
ccc6cda3
JA
721case "$host_cpu" in
722*cray*) LOCAL_CFLAGS="-DCRAY" ;; # shell var so config.h can use it
723esac
724
725case "$host_cpu-$host_os" in
726ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
727esac
728
729case "$host_cpu-$host_vendor-$host_os" in
730m88k-motorola-sysv3) LOCAL_CFLAGS=-DWAITPID_BROKEN ;;
731mips-pyramid-sysv4) LOCAL_CFLAGS=-Xa ;;
732esac
733
b72432fd
JA
734#
735# Shared object configuration section. These values are generated by
736# ${srcdir}/support/shobj-conf
737#
738if test "$ac_cv_func_dlopen" = "yes" && test -f ${srcdir}/support/shobj-conf
739then
740 AC_MSG_CHECKING(shared object configuration for loadable builtins)
28ef6c31 741 eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c "${host_cpu}" -o "${host_os}" -v "${host_vendor}"`
b72432fd
JA
742 AC_SUBST(SHOBJ_CC)
743 AC_SUBST(SHOBJ_CFLAGS)
744 AC_SUBST(SHOBJ_LD)
745 AC_SUBST(SHOBJ_LDFLAGS)
746 AC_SUBST(SHOBJ_XLDFLAGS)
747 AC_SUBST(SHOBJ_LIBS)
748 AC_SUBST(SHOBJ_STATUS)
749 AC_MSG_RESULT($SHOBJ_STATUS)
750fi
751
ccc6cda3
JA
752# try to create a directory tree if the source is elsewhere
753# this should be packaged into a script accessible via ${srcdir}/support
754case "$srcdir" in
755.) ;;
cce855bc 756*) for d in doc tests support lib examples; do # dirs
ccc6cda3
JA
757 test -d $d || mkdir $d
758 done
cce855bc 759 for ld in readline glob tilde malloc sh termcap; do # libdirs
ccc6cda3
JA
760 test -d lib/$ld || mkdir lib/$ld
761 done
cce855bc 762 test -d examples/loadables || mkdir examples/loadables # loadable builtins
bb70624e 763 test -d examples/loadables/perl || mkdir examples/loadables/perl
ccc6cda3
JA
764 ;;
765esac
766
767BUILD_DIR=`pwd`
768
cce855bc
JA
769AC_SUBST(PROFILE_FLAGS)
770
ccc6cda3
JA
771AC_SUBST(incdir)
772AC_SUBST(BUILD_DIR)
773
774AC_SUBST(YACC)
775AC_SUBST(AR)
b72432fd 776AC_SUBST(ARFLAGS)
ccc6cda3 777
d166f048
JA
778AC_SUBST(BASHVERS)
779AC_SUBST(BASHPATCH)
780
ccc6cda3 781AC_SUBST(host_cpu)
b72432fd 782AC_SUBST(host_vendor)
ccc6cda3
JA
783AC_SUBST(host_os)
784
785AC_SUBST(LOCAL_LIBS)
786AC_SUBST(LOCAL_CFLAGS)
787AC_SUBST(LOCAL_LDFLAGS)
d166f048 788AC_SUBST(LOCAL_DEFS)
ccc6cda3 789
d166f048
JA
790#AC_SUBST(ALLOCA_SOURCE)
791#AC_SUBST(ALLOCA_OBJECT)
ccc6cda3
JA
792
793AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
cce855bc
JA
794 lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \
795 lib/tilde/Makefile doc/Makefile support/Makefile \
bb70624e 796 examples/loadables/Makefile examples/loadables/perl/Makefile],
ccc6cda3
JA
797[
798# Makefile uses this timestamp file to record whether config.h is up to date.
799echo timestamp > stamp-h
800])