2 dnl Configure script for bash-2.05
4 dnl report bugs to chet@po.cwru.edu
6 dnl Process this file with autoconf to produce a configure script.
8 # Copyright (C) 1987-2002 Free Software Foundation, Inc.
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)
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.
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
25 AC_REVISION([for Bash 2.05b, version 2.144, from autoconf version] AC_ACVERSION)dnl
27 AC_INIT(bash, 2.05b, bug-bash@gnu.org)
29 dnl make sure we are using a recent autoconf version
32 AC_CONFIG_SRCDIR(shell.h)
33 dnl where to find install.sh, config.sub, and config.guess
34 AC_CONFIG_AUX_DIR(./support)
35 AC_CONFIG_HEADERS(config.h)
37 dnl checks for version info
41 dnl defaults for debug settings
43 alp*|bet*|dev*|rc*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
44 *) DEBUG= MALLOC_DEBUG= ;;
47 dnl canonicalize the host and os so we can do some tricky things before
51 dnl configure defaults
57 opt_with_installed_readline=no
61 dnl some systems should be configured without the bash malloc by default
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
65 alpha*-*) opt_bash_malloc=no ;; # alpha running osf/1 or linux
66 *[[Cc]]ray*-*) opt_bash_malloc=no ;; # Crays
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
73 #*-freebsd*) opt_bash_malloc=no ;; # they claim it's better; I disagree
74 *-openbsd*) opt_bash_malloc=no ;; # they claim it needs eight-bit alignment
75 *-aix*) opt_bash_malloc=no ;; # AIX machines
76 *-nextstep*) opt_bash_malloc=no ;; # NeXT machines running NeXTstep
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)
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
85 *-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
86 *-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft
89 # memory scrambling on free()
91 sco3.2v5*|sco3.2v4*) opt_memscramble=no ;;
92 *) opt_memscramble=yes ;;
95 dnl arguments to configure
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)
105 if test "$opt_bash_malloc" = yes; then
109 MALLOC_LIB='-lmalloc'
110 MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
111 MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
112 MALLOC_DEP='$(MALLOC_LIBRARY)'
114 AC_DEFINE(USING_BASH_MALLOC)
122 if test "$opt_purify" = yes; then
124 AC_DEFINE(DISABLE_MALLOC_WRAPPERS)
129 if test "$opt_purecov" = yes; then
130 PURIFY="${PURIFY}purecov"
133 if test "$opt_afs" = yes; then
137 if test "$opt_curses" = yes; then
141 dnl optional shell features in config.h.in
142 opt_minimal_config=no
151 opt_process_subst=yes
152 opt_prompt_decoding=yes
155 opt_array_variables=yes
157 opt_extended_glob=yes
158 opt_brace_expansion=yes
159 opt_disabled_builtins=no
160 opt_command_timing=yes
163 opt_arith_for_command=yes
168 dnl options that affect how bash is compiled and linked
172 dnl argument parsing for optional features
173 AC_ARG_ENABLE(minimal-config, AC_HELP_STRING([--enable-minimal-config], [a minimal sh-like configuration]), opt_minimal_config=$enableval)
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
183 opt_extended_glob=no opt_cond_command=no opt_arith_for_command=no
184 opt_net_redirs=no opt_progcomp=no opt_separate_help=no
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)
212 dnl options that alter how bash is compiled and linked
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)
217 dnl opt_job_control is handled later, after BASH_JOB_CONTROL_MISSING runs
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
223 if test $opt_alias = yes; then
226 if test $opt_dirstack = yes; then
227 AC_DEFINE(PUSHD_AND_POPD)
229 if test $opt_restricted = yes; then
230 AC_DEFINE(RESTRICTED_SHELL)
232 if test $opt_process_subst = yes; then
233 AC_DEFINE(PROCESS_SUBSTITUTION)
235 if test $opt_prompt_decoding = yes; then
236 AC_DEFINE(PROMPT_STRING_DECODE)
238 if test $opt_select = yes; then
239 AC_DEFINE(SELECT_COMMAND)
241 if test $opt_help = yes; then
242 AC_DEFINE(HELP_BUILTIN)
244 if test $opt_array_variables = yes; then
245 AC_DEFINE(ARRAY_VARS)
247 if test $opt_dparen_arith = yes; then
248 AC_DEFINE(DPAREN_ARITHMETIC)
250 if test $opt_brace_expansion = yes; then
251 AC_DEFINE(BRACE_EXPANSION)
253 if test $opt_disabled_builtins = yes; then
254 AC_DEFINE(DISABLED_BUILTINS)
256 if test $opt_command_timing = yes; then
257 AC_DEFINE(COMMAND_TIMING)
259 if test $opt_xpg_echo = yes ; then
260 AC_DEFINE(DEFAULT_ECHO_TO_XPG)
262 if test $opt_extended_glob = yes ; then
263 AC_DEFINE(EXTENDED_GLOB)
265 if test $opt_cond_command = yes ; then
266 AC_DEFINE(COND_COMMAND)
268 if test $opt_arith_for_command = yes; then
269 AC_DEFINE(ARITH_FOR_COMMAND)
271 if test $opt_net_redirs = yes; then
272 AC_DEFINE(NETWORK_REDIRECTIONS)
274 if test $opt_progcomp = yes; then
275 AC_DEFINE(PROGRAMMABLE_COMPLETION)
278 if test $opt_memscramble = yes; then
279 AC_DEFINE(MEMSCRAMBLE)
282 if test "$opt_minimal_config" = yes; then
283 TESTSCRIPT=run-minimal
288 HELPDIR= HELPDIRDEFINE= HELPINSTALL=
289 if test "$opt_separate_help" != no; then
290 if test "$opt_separate_help" = "yes" ; then
291 HELPDIR='${datadir}/bash'
293 HELPDIR=$opt_separate_help
295 HELPDIRDEFINE='-H ${HELPDIR}'
296 HELPINSTALL='install-help'
299 dnl now substitute in the values generated by arguments
302 AC_SUBST(MALLOC_TARGET)
306 AC_SUBST(MALLOC_LIBRARY)
307 AC_SUBST(MALLOC_LDFLAGS)
313 AC_SUBST(HELPDIRDEFINE)
314 AC_SUBST(HELPINSTALL)
317 echo "Beginning configuration for bash-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}"
320 dnl compilation checks
321 dnl AC_PROG_CC sets $cross_compiling to `yes' if cross-compiling for a
322 dnl different environment
325 dnl test for Unix variants
329 dnl test for non-Unix variants
335 dnl BEGIN changes for cross-building for cygwin and BeOS
337 SIGNAMES_H=lsignames.h
339 dnl load up the cross-building cache file -- add more cases and cache
340 dnl files as necessary
342 dnl Note that host and target machine are the same, and different than the
344 dnl Set SIGNAMES_H based on whether or not we're cross-compiling.
346 if test "x$cross_compiling" = "xyes"; then
349 cross_cache=${srcdir}/cross-build/cygwin32.cache
350 SIGNAMES_H='$(srcdir)/cross-build/win32sig.h'
353 cross_cache=${srcdir}/cross-build/x86-beos.cache
354 SIGNAMES_H='${srcdir}/cross-build/beos-sig.h'
356 *) echo "configure: cross-compiling for $host is not supported" >&2
359 if test -n "${cross_cache}" && test -r "${cross_cache}"; then
360 echo "loading cross-build cache file ${cross_cache}"
367 if test -z "$CC_FOR_BUILD"; then
368 if test "x$cross_compiling" = "xno"; then
374 AC_SUBST(CC_FOR_BUILD)
376 dnl END changes for cross-building
378 dnl We want these before the checks, so the checks can modify their values.
379 test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
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"
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
390 *) opt_static_link=yes ;;
395 if test "$opt_static_link" = yes; then
396 # if we're using gcc, add `-static' to LDFLAGS, except on Solaris >= 2
397 if test -n "$GCC" || test "$ac_cv_prog_gcc" = "yes"; then
401 *) LDFLAGS="$LDFLAGS -static" ;; # XXX experimental
406 test -z "$CPPFLAGS_FOR_BUILD" && CPPFLAGS_FOR_BUILD="$CPPFLAGS"
407 test -z "$CFLAGS_FOR_BUILD" && CFLAGS_FOR_BUILD="-g"
414 AC_SUBST(CFLAGS_FOR_BUILD)
415 AC_SUBST(CPPFLAGS_FOR_BUILD)
416 AC_SUBST(LDFLAGS_FOR_BUILD)
418 AC_PROG_GCC_TRADITIONAL
420 dnl BEGIN READLINE and HISTORY LIBRARY SECTION
421 dnl prepare to allow bash to be linked against an already-installed readline
423 dnl first test that the readline version is new enough to link bash against
424 if test "$opt_readline" = yes && test "$opt_with_installed_readline" != "no"
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
430 RL_LIB_READLINE_VERSION
432 case "$ac_cv_rl_version" in
433 4.[[3-9]]*|5*|6*|7*|8*|9*) ;;
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)
441 if test $opt_readline = yes; then
443 READLINE_LIB=-lreadline
444 if test "$opt_with_installed_readline" != "no" ; then
445 case "$RL_INCLUDEDIR" in
447 *) RL_INCLUDE='-I${RL_INCLUDEDIR}'
451 RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
452 READLINE_DEP='$(READLINE_LIBRARY)'
455 RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
456 READLINE_LIB= READLINE_DEP=
458 if test $opt_history = yes || test $opt_bang_history = yes; then
459 if test $opt_history = yes; then
462 if test $opt_bang_history = yes; then
463 AC_DEFINE(BANG_HISTORY)
465 HISTORY_LIB=-lhistory
466 if test "$opt_with_installed_readline" != "no"; then
467 HIST_LIBDIR=$RL_LIBDIR
469 case "$RL_INCLUDEDIR" in
471 *) RL_INCLUDE='-I${RL_INCLUDEDIR}'
474 HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
475 HISTORY_DEP='$(HISTORY_LIBRARY)'
478 HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
479 HISTORY_LIB= HISTORY_DEP=
481 AC_SUBST(READLINE_LIB)
482 AC_SUBST(READLINE_DEP)
484 AC_SUBST(RL_INCLUDEDIR)
486 AC_SUBST(HISTORY_LIB)
487 AC_SUBST(HISTORY_DEP)
488 AC_SUBST(HIST_LIBDIR)
490 dnl END READLINE and HISTORY LIBRARY SECTION
492 dnl programs needed by the build and install process
494 AC_CHECK_PROG(AR, ar, , ar)
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"
503 opennt*|interix*) MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
504 *) MAKE_SHELL=/bin/sh ;;
508 dnl Turn on any extensions available in the GNU C library.
509 AC_DEFINE(_GNU_SOURCE, 1)
511 dnl C compiler characteristics
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)
534 dnl special checks for libc functions
537 AC_FUNC_SETVBUF_REVERSED
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
544 if test "$ac_cv_func_alloca_works" = "no" && test "$opt_bash_malloc" = "no"; then
548 MALLOC_LIB='-lmalloc'
549 MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
550 MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
551 MALLOC_DEP='$(MALLOC_LIBRARY)'
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)
564 if test "$ac_cv_func_vprintf" = no && test "$ac_cv_func__doprnt" = "yes"; then
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))
574 AC_CHECK_FUNC(isinf, AC_DEFINE(HAVE_ISINF_IN_LIBC))
576 dnl checks for missing libc functions
577 AC_CHECK_FUNC(mkfifo,AC_DEFINE(HAVE_MKFIFO),AC_DEFINE(MKFIFO_MISSING))
579 dnl checks for system calls
580 AC_CHECK_FUNCS(dup2 select getdtablesize getgroups gethostname \
581 setdtablesize getpagesize killpg lstat getpeername sbrk \
582 getrlimit getrusage gettimeofday waitpid tcgetpgrp \
584 AC_REPLACE_FUNCS(rename)
586 dnl checks for c library functions
587 AC_CHECK_FUNCS(bcopy bzero confstr sysconf pathconf setenv putenv unsetenv \
588 setlinebuf setvbuf setlocale strchr tcgetattr uname \
589 ulimit tzset siginterrupt memmove ttyname times \
590 getaddrinfo gethostbyname getservbyname getservent inet_aton \
591 vsnprintf snprintf vasprintf asprintf fnmatch)
592 AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
593 AC_REPLACE_FUNCS(getcwd strcasecmp strerror strftime strpbrk memset)
594 AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoimax strtoumax)
596 AC_CHECK_DECLS([confstr])
597 AC_CHECK_DECLS([printf])
598 AC_CHECK_DECLS([sbrk])
599 AC_CHECK_DECLS([strcpy])
600 AC_CHECK_DECLS([strsignal])
601 AC_CHECK_DECLS([strtold])
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)
612 dnl checks for locale functions
613 AC_CHECK_HEADERS(libintl.h)
614 AC_CHECK_FUNCS(gettext textdomain bindtextdomain)
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)
627 dnl checks for the dynamic loading library functions in libc and libdl
628 if test "$opt_static_link" != yes; then
629 AC_CHECK_LIB(dl, dlopen)
630 AC_CHECK_FUNCS(dlopen dlclose dlsym)
633 dnl this defines SYS_SIGLIST_DECLARED
636 dnl network functions -- check for inet_aton again
637 if test "$ac_cv_func_inet_aton" != 'yes'; then
642 dnl this is reportedly no longer necessary for irix[56].?
644 irix4*) AC_CHECK_LIB(sun, getpwent) ;;
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
649 BASH_CHECK_LIB_SOCKET
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
663 AC_CHECK_TYPE(ssize_t, int)
664 AC_CHECK_TYPE(time_t, long)
667 BASH_TYPE_UNSIGNED_LONG_LONG
671 AC_CHECK_SIZEOF(char, 1)
672 AC_CHECK_SIZEOF(short, 2)
673 AC_CHECK_SIZEOF(int, 4)
674 AC_CHECK_SIZEOF(long, 4)
675 AC_CHECK_SIZEOF(char *, 4)
676 AC_CHECK_SIZEOF(double, 8)
677 AC_CHECK_SIZEOF([long long], 8)
679 AC_CHECK_TYPE(u_int, [unsigned int])
680 AC_CHECK_TYPE(u_long, [unsigned long])
695 if test $ac_cv_sys_interpreter = yes; then
696 AC_DEFINE(HAVE_HASH_BANG_EXEC)
699 dnl Miscellaneous Bash tests
700 if test "$ac_cv_func_lstat" = "no"; then
704 dnl behavior of system calls and library functions
705 BASH_FUNC_DUP2_CLOEXEC_CHECK
707 BASH_SYS_SIGNAL_VINTAGE
709 dnl checking for the presence of certain library symbols
712 BASH_UNDER_SYS_SIGLIST
714 dnl various system types
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)
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)
726 dnl presence and contents of structures used by system calls
727 BASH_STRUCT_TERMIOS_LDISC
728 BASH_STRUCT_TERMIO_LDISC
729 BASH_STRUCT_DIRENT_D_INO
730 BASH_STRUCT_DIRENT_D_FILENO
733 AC_CHECK_MEMBERS([struct stat.st_blocks])
737 dnl presence and behavior of C library functions
739 BASH_FUNC_OPENDIR_CHECK
740 BASH_FUNC_ULIMIT_MAXFDS
742 if test "$ac_cv_func_getcwd" = "yes"; then
745 BASH_FUNC_POSIX_SETJMP
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
751 if test "$ac_cv_func_putenv" = "yes"; then
754 AC_DEFINE(HAVE_STD_PUTENV)
756 if test "$ac_cv_func_unsetenv" = "yes"; then
757 BASH_FUNC_STD_UNSETENV
759 AC_DEFINE(HAVE_STD_UNSETENV)
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.
768 dnl Once Ulrich and I get together on this, the check can return
772 dnl BASH_FUNC_FNMATCH_EXTMATCH
774 BASH_FUNC_PRINTF_A_FORMAT
776 dnl presence and behavior of OS functions
777 BASH_SYS_REINSTALL_SIGHANDLERS
778 BASH_SYS_JOB_CONTROL_MISSING
781 dnl presence of certain CPP defines
788 BASH_CHECK_GETPW_FUNCS
790 BASH_CHECK_SYS_SIGLIST
794 hpux*) BASH_CHECK_KERNEL_RLIMIT ;;
797 if test "$opt_readline" = yes; then
800 aix*) prefer_curses=yes ;;
802 BASH_CHECK_LIB_TERMCAP
804 AC_SUBST(TERMCAP_LIB)
805 AC_SUBST(TERMCAP_DEP)
809 BASH_SYS_DEFAULT_MAIL_DIR
811 if test "$bash_cv_job_control_missing" = missing; then
815 if test "$opt_job_control" = yes; then
816 AC_DEFINE(JOB_CONTROL)
824 dnl Defines that we want to propagate to the Makefiles in subdirectories,
825 dnl like glob and readline
829 dnl use this section to possibly define more cpp variables, specify local
830 dnl libraries, and specify any additional local cc flags
832 dnl this should really go away someday
835 sysv4.2*) AC_DEFINE(SVR4_2)
837 sysv4*) AC_DEFINE(SVR4) ;;
838 sysv5*) AC_DEFINE(SVR5) ;;
839 hpux9*) LOCAL_CFLAGS="-DHPUX9 -DHPUX" ;;
840 hpux*) LOCAL_CFLAGS=-DHPUX ;;
841 dgux*) LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
842 isc*) LOCAL_CFLAGS=-Disc386 ;;
843 rhapsody*) LOCAL_CFLAGS=-DRHAPSODY ;;
844 darwin*) LOCAL_CFLAGS=-DMACOSX ;;
845 sco3.2v5*) LOCAL_CFLAGS="-b elf -DWAITPID_BROKEN -DPATH_MAX=1024" ;;
846 sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
847 sco3.2*) LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
848 sunos4*) LOCAL_CFLAGS=-DSunOS4 ;;
849 solaris2.5*) LOCAL_CFLAGS=-DSunOS5 ;;
850 lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
851 linux*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
852 *qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
853 powerux*) LOCAL_LIBS="-lgen" ;;
854 cygwin*) LOCAL_LIBS="-luser32" ;;
855 opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO" ;;
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
865 dnl FreeBSD-3.x can have either a.out or ELF
868 if test -x /usr/bin/objformat && test "`/usr/bin/objformat`" = "elf" ; then
869 LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
871 freebsdelf*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
875 *cray*) LOCAL_CFLAGS="-DCRAY" ;; # shell var so config.h can use it
878 case "$host_cpu-$host_os" in
879 ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
882 case "$host_cpu-$host_vendor-$host_os" in
883 m88k-motorola-sysv3) LOCAL_CFLAGS=-DWAITPID_BROKEN ;;
884 mips-pyramid-sysv4) LOCAL_CFLAGS=-Xa ;;
888 # Shared object configuration section. These values are generated by
889 # ${srcdir}/support/shobj-conf
891 if test "$ac_cv_func_dlopen" = "yes" && test -f ${srcdir}/support/shobj-conf
893 AC_MSG_CHECKING(shared object configuration for loadable builtins)
894 eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c "${host_cpu}" -o "${host_os}" -v "${host_vendor}"`
896 AC_SUBST(SHOBJ_CFLAGS)
898 AC_SUBST(SHOBJ_LDFLAGS)
899 AC_SUBST(SHOBJ_XLDFLAGS)
901 AC_SUBST(SHOBJ_STATUS)
902 AC_MSG_RESULT($SHOBJ_STATUS)
905 # try to create a directory tree if the source is elsewhere
906 # this should be packaged into a script accessible via ${srcdir}/support
909 *) for d in doc tests support lib examples; do # dirs
910 test -d $d || mkdir $d
912 for ld in readline glob tilde malloc sh termcap; do # libdirs
913 test -d lib/$ld || mkdir lib/$ld
915 test -d examples/loadables || mkdir examples/loadables # loadable builtins
916 test -d examples/loadables/perl || mkdir examples/loadables/perl
922 AC_SUBST(PROFILE_FLAGS)
934 AC_SUBST(MALLOC_DEBUG)
937 AC_SUBST(host_vendor)
941 AC_SUBST(LOCAL_CFLAGS)
942 AC_SUBST(LOCAL_LDFLAGS)
945 #AC_SUBST(ALLOCA_SOURCE)
946 #AC_SUBST(ALLOCA_OBJECT)
948 AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
949 lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \
950 lib/tilde/Makefile doc/Makefile support/Makefile \
951 examples/loadables/Makefile examples/loadables/perl/Makefile],
953 # Makefile uses this timestamp file to record whether config.h is up to date.
954 echo timestamp > stamp-h