2 dnl Configure script for bash-2.01
4 dnl report bugs to chet@po.cwru.edu
6 dnl Process this file with autoconf to produce a configure script.
7 dnl checks for version info
9 AC_REVISION([for Bash 2.01, version 1.26, from autoconf version] AC_ACVERSION)dnl
12 AC_CONFIG_HEADER(config.h)
14 dnl make sure we are using a recent autoconf version
17 dnl where to find install.sh, config.sub, and config.guess
18 AC_CONFIG_AUX_DIR(./support)
20 dnl canonicalize the host and os so we can do some tricky things before
24 dnl configure defaults
32 dnl some systems should be configured without gnu malloc by default
33 dnl and some need a special compiler or loader
34 dnl look in the NOTES file for more
35 case "${host_cpu}-${host_os}" in
36 alpha-*) opt_gnu_malloc=no ;; # alpha running osf/1 or linux
37 *cray*-*) opt_gnu_malloc=no ;; # Crays
38 *-osf1*) opt_gnu_malloc=no ;; # other osf/1 machines
39 sparc-svr4*) opt_gnu_malloc=no ;; # sparc SVR4, SVR4.2
40 sparc-netbsd*) opt_gnu_malloc=no ;; # needs 8-byte alignment
41 *-sgi-irix6*) opt_gnu_malloc=no ;; # needs 8-byte alignment
42 sparc-linux*) opt_gnu_malloc=no ;; # sparc running linux; requires ELF
43 *-freebsd*) opt_gnu_malloc=no ;; # they claim it's better
44 *-aix*) opt_gnu_malloc=no ;; # AIX machines
45 *-nextstep*) opt_gnu_malloc=no ;; # NeXT machines running NeXTstep
46 *-dgux*) opt_gnu_malloc=no ;; # DG/UX machines
47 *-qnx*) opt_gnu_malloc=no ;; # QNX 4.2
48 *-machten4) opt_gnu_malloc=no ;; # MachTen 4.x
49 *-bsdi2.1) opt_gnu_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
52 dnl arguments to configure
54 AC_ARG_WITH(afs, --with-afs if you are running AFS, opt_afs=$withval)
55 AC_ARG_WITH(curses, --with-curses use the curses library instead of the termcap library,opt_curses=$withval)
56 AC_ARG_WITH(glibc-malloc, --with-glibc-malloc use the GNU C library version of malloc,opt_glibc_malloc=$withval)
57 AC_ARG_WITH(gnu-malloc, --with-gnu-malloc use the GNU version of malloc,opt_gnu_malloc=$withval)
58 AC_ARG_WITH(purecov, --with-purecov configure to postprocess with pure coverage, opt_purecov=$withval)
59 AC_ARG_WITH(purify, --with-purify configure to postprocess with purify, opt_purify=$withval)
61 dnl test for glibc malloc first because it can override the default
62 if test "$opt_glibc_malloc" = yes; then
65 elif test "$opt_gnu_malloc" = yes; then
69 MALLOC_TARGET=stubmalloc
73 if test "$opt_purify" = yes; then
79 if test "$opt_purecov" = yes; then
80 PURIFY="${PURIFY}purecov"
83 if test "$opt_afs" = yes; then
87 if test "$opt_curses" = yes; then
91 dnl optional shell features in config.h.in
101 opt_process_subst=yes
102 opt_prompt_decoding=yes
105 opt_array_variables=yes
107 opt_brace_expansion=yes
108 opt_disabled_builtins=no
109 opt_command_timing=yes
112 dnl argument parsing for optional features
113 AC_ARG_ENABLE(minimal-config, --enable-minimal-config a minimal sh-like configuration, opt_minimal_config=$enableval)
115 dnl a minimal configuration turns everything off, but features can be
116 dnl added individually
117 if test $opt_minimal_config = yes; then
118 opt_job_control=no opt_alias=no opt_readline=no
119 opt_history=no opt_bang_history=no opt_dirstack=no
120 opt_restricted=no opt_process_subst=no opt_prompt_decoding=no
121 opt_select=no opt_help=no opt_array_variables=no opt_dparen_arith=no
122 opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
125 AC_ARG_ENABLE(alias, --enable-alias enable shell aliases, opt_alias=$enableval)
126 AC_ARG_ENABLE(array-variables, --enable-array-variables include shell array variables, opt_array_variables=$enableval)
127 AC_ARG_ENABLE(bang-history, --enable-bang-history turn on csh-style history substitution, opt_bang_history=$enableval)
128 AC_ARG_ENABLE(brace-expansion, --enable-brace-expansion include brace expansion, opt_brace_expansion=$enableval)
129 AC_ARG_ENABLE(command-timing, --enable-command-timing enable the time reserved word and command timing, opt_command_timing=$enableval)
130 AC_ARG_ENABLE(directory-stack, --enable-directory-stack enable builtins pushd/popd/dirs, opt_dirstack=$enableval)
131 AC_ARG_ENABLE(disabled-builtins, --enable-disabled-builtins allow disabled builtins to still be invoked, opt_disabled_builtins=$enableval)
132 AC_ARG_ENABLE(dparen-arithmetic, [--enable-dparen-arithmetic include ((...)) command], opt_dparen_arith=$enableval)
133 AC_ARG_ENABLE(help-builtin, --enable-help-builtin include the help builtin, opt_help=$enableval)
134 AC_ARG_ENABLE(history, --enable-history turn on command history, opt_history=$enableval)
135 AC_ARG_ENABLE(job-control, --enable-job-control enable job control features, opt_job_control=$enableval)
136 AC_ARG_ENABLE(process-substitution, --enable-process-substitution enable process substitution, opt_process_subst=$enableval)
137 AC_ARG_ENABLE(prompt-string-decoding, --enable-prompt-string-decoding turn on escape character decoding in prompts, opt_prompt_decoding=$enableval)
138 AC_ARG_ENABLE(readline, --enable-readline turn on command line editing, opt_readline=$enableval)
139 AC_ARG_ENABLE(restricted, --enable-restricted enable a restricted shell, opt_restricted=$enableval)
140 AC_ARG_ENABLE(select, --enable-select include select command, opt_select=$enableval)
141 AC_ARG_ENABLE(usg-echo-default, --enable-usg-echo-default make the echo builtin expand escape sequences by default, opt_usg_echo=$enableval)
143 dnl opt_job_control is handled later, after BASH_JOB_CONTROL_MISSING runs
145 if test $opt_alias = yes; then
148 if test $opt_readline = yes; then
150 READLINE_LIB=-lreadline
151 READLINE_DEP='$(READLINE_LIBRARY)'
153 READLINE_LIB= READLINE_DEP=
155 if test $opt_history = yes; then
157 HISTORY_LIB=-lhistory
158 HISTORY_DEP='$(HISTORY_LIBRARY)'
160 HISTORY_LIB= HISTORY_DEP=
162 if test $opt_bang_history = yes; then
163 AC_DEFINE(BANG_HISTORY)
164 HISTORY_LIB=-lhistory
165 HISTORY_DEP='$(HISTORY_LIBRARY)'
167 HISTORY_LIB= HISTORY_DEP=
169 if test $opt_dirstack = yes; then
170 AC_DEFINE(PUSHD_AND_POPD)
172 if test $opt_restricted = yes; then
173 AC_DEFINE(RESTRICTED_SHELL)
175 if test $opt_process_subst = yes; then
176 AC_DEFINE(PROCESS_SUBSTITUTION)
178 if test $opt_prompt_decoding = yes; then
179 AC_DEFINE(PROMPT_STRING_DECODE)
181 if test $opt_select = yes; then
182 AC_DEFINE(SELECT_COMMAND)
184 if test $opt_help = yes; then
185 AC_DEFINE(HELP_BUILTIN)
187 if test $opt_array_variables = yes; then
188 AC_DEFINE(ARRAY_VARS)
190 if test $opt_dparen_arith = yes; then
191 AC_DEFINE(DPAREN_ARITHMETIC)
193 if test $opt_brace_expansion = yes; then
194 AC_DEFINE(BRACE_EXPANSION)
196 if test $opt_disabled_builtins = yes; then
197 AC_DEFINE(DISABLED_BUILTINS)
199 if test $opt_command_timing = yes; then
200 AC_DEFINE(COMMAND_TIMING)
202 if test $opt_usg_echo = yes ; then
203 AC_DEFINE(DEFAULT_ECHO_TO_USG)
206 if test "$opt_minimal_config" = yes; then
207 TESTSCRIPT=run-minimal
212 dnl now substitute in the values generated by arguments
215 AC_SUBST(MALLOC_TARGET)
217 AC_SUBST(READLINE_LIB)
218 AC_SUBST(READLINE_DEP)
219 AC_SUBST(HISTORY_LIB)
220 AC_SUBST(HISTORY_DEP)
222 dnl Use GNU m4 macros to get the distribution and patchlevel information
223 dnl into configure without requiring the files to be distributed
225 esyscmd(cat _distribution)dnl
227 esyscmd(cat _patchlevel)dnl
229 echo "Beginning configuration for bash-$BASHVERS"
231 dnl compilation checks
236 dnl We want these before the checks, so the checks can modify their values.
237 test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
239 dnl If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS.
240 test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
246 AC_PROG_GCC_TRADITIONAL
248 dnl programs needed by the build and install process
250 AC_CHECK_PROG(AR, ar, ar)
255 dnl special checks for libc functions
258 AC_FUNC_SETVBUF_REVERSED
263 dnl if vprintf is not in libc, see if it's defined in stdio.h
264 if test "$ac_cv_func_vprintf" = no; then
265 AC_MSG_CHECKING(for declaration of vprintf in stdio.h)
266 AC_EGREP_HEADER([[int[ ]*vprintf[^a-zA-Z0-9]]],stdio.h,ac_cv_func_vprintf=yes)
267 AC_MSG_RESULT($ac_cv_func_vprintf)
268 if test $ac_cv_func_vprintf = yes; then
269 AC_DEFINE(HAVE_VPRINTF)
276 dnl checks for certain version-specific system calls and libc functions
277 AC_CHECK_FUNC(__setostype, AC_DEFINE(HAVE_SETOSTYPE))
278 AC_CHECK_FUNC(wait3, AC_DEFINE(HAVE_WAIT3))
280 dnl checks for missing libc functions
281 AC_CHECK_FUNC(mkfifo,AC_DEFINE(HAVE_MKFIFO),AC_DEFINE(MKFIFO_MISSING))
283 dnl checks for system calls
284 AC_CHECK_FUNCS(dup2 select getdtablesize getgroups gethostname \
285 setdtablesize getpagesize killpg lstat getpeername \
286 getrlimit getrusage gettimeofday waitpid tcgetpgrp)
288 dnl checks for c library functions
289 AC_CHECK_FUNCS(bcopy bzero confstr getcwd strcasecmp setenv putenv \
290 setlinebuf setlocale strchr strerror tcgetattr uname \
291 sysconf ulimit times tzset siginterrupt memmove)
293 dnl checks for locale functions
294 AC_CHECK_HEADERS(libintl.h)
295 AC_CHECK_FUNCS(gettext textdomain bindtextdomain)
297 dnl check for GNU libintl if gettext/textdomain/bindtextdomain
298 dnl are not found in libc
299 if test "$ac_cv_func_bindtextdomain" = "no"; then
300 AC_CHECK_LIB(intl,bindtextdomain)
301 if test "$ac_cv_lib_intl" = "yes"; then
302 AC_CHECK_FUNCS(gettext textdomain bindtextdomain)
306 dnl checks for the dynamic loading library functions in libc and libdl
307 AC_CHECK_LIB(dl, dlopen)
308 AC_CHECK_FUNCS(dlopen dlclose dlsym)
310 dnl this defines SYS_SIGLIST_DECLARED
317 AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
318 memory.h locale.h termcap.h termio.h termios.h dlfcn.h)
319 AC_CHECK_HEADERS(sys/ptem.h sys/pte.h sys/stream.h sys/select.h sys/file.h \
320 sys/resource.h sys/param.h sys/socket.h \
321 sys/time.h sys/times.h sys/wait.h)
324 dnl this is reportedly no longer necessary for irix[56].?
325 dnl AC_CHECK_LIB(sun, getpwent)
326 dnl check for getpeername in the socket library only if it's not in libc
327 if test "$ac_cv_func_getpeername" = no; then
338 AC_CHECK_TYPE(time_t, long)
344 AC_HEADER_EGREP(struct timeval, sys/time.h, bash_cv_struct_timeval=yes, )
345 if test -z "$bash_cv_struct_timeval"; then
346 AC_HEADER_EGREP(struct timeval, time.h, bash_cv_struct_timeval=yes, bash_cv_struct_timeval=no)
348 if test $bash_cv_struct_timeval = yes; then
349 AC_DEFINE(HAVE_TIMEVAL)
352 dnl C compiler characteristics
357 if test $ac_cv_sys_interpreter = yes; then
358 AC_DEFINE(HAVE_HASH_BANG_EXEC)
360 dnl we use NO_READ_RESTART_ON_SIGNAL
361 AC_SYS_RESTARTABLE_SYSCALLS
363 dnl Miscellaneous Bash tests
364 if test "$ac_cv_func_lstat" = "no"; then
368 dnl behavior of system calls and library functions
369 BASH_DUP2_CLOEXEC_CHECK
373 dnl checking for the presence of certain library symbols
376 BASH_UNDER_SYS_SIGLIST
378 dnl various system types
380 BASH_CHECK_TYPE(clock_t, [#include <sys/times.h>], long)
381 BASH_CHECK_TYPE(sigset_t, [#include <signal.h>], int)
382 BASH_CHECK_TYPE(quad_t, , long, HAVE_QUAD_T)
385 dnl presence and contents of structures used by system calls
386 BASH_STRUCT_TERMIOS_LDISC
387 BASH_STRUCT_TERMIO_LDISC
388 BASH_STRUCT_DIRENT_D_INO
389 BASH_STRUCT_DIRENT_D_FILENO
392 dnl presence and behavior of C library functions
394 BASH_FUNC_OPENDIR_CHECK
396 BASH_FUNC_ULIMIT_MAXFDS
399 BASH_FUNC_SBRK_DECLARED
400 BASH_FUNC_POSIX_SETJMP
403 dnl presence and behavior of OS functions
404 BASH_REINSTALL_SIGHANDLERS
405 BASH_JOB_CONTROL_MISSING
408 dnl presence of certain CPP defines
415 BASH_CHECK_GETPW_FUNCS
419 hpux*) BASH_KERNEL_RLIMIT_CHECK ;;
422 if test "$opt_readline" = yes; then
425 aix*) prefer_curses=yes ;;
427 BASH_CHECK_LIB_TERMCAP
429 AC_SUBST(TERMCAP_LIB)
430 AC_SUBST(TERMCAP_DEP)
433 BASH_DEFAULT_MAIL_DIR
435 if test "$bash_cv_job_control_missing" = missing; then
439 if test "$opt_job_control" = yes; then
440 AC_DEFINE(JOB_CONTROL)
448 dnl Defines that we want to propagate to the Makefiles in subdirectories,
449 dnl like glob and readline
453 dnl use this section to possibly define more cpp variables, specify local
454 dnl libraries, and specify any additional local cc flags
456 dnl this should really go away someday
459 sysv4.2) AC_DEFINE(SVR4_2)
461 sysv4*) AC_DEFINE(SVR4) ;;
462 hpux*) LOCAL_CFLAGS=-DHPUX ;;
463 dgux*) LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
464 isc*) LOCAL_CFLAGS=-Disc386;;
465 sco3.2v5*) LOCAL_CFLAGS="-DWAITPID_BROKEN -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
466 sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
467 sco3.2*) LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
468 sunos4*) LOCAL_CFLAGS=-DSunOS4 ;;
469 solaris2.5*) LOCAL_CFLAGS=-DSunOS5 ;;
470 linux*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
471 aix4.2*) LOCAL_LDFLAGS="-bexpall -brtl" ;;# allow dynamic loading
472 *qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s -lunix -lncurses" ;;
473 powerux) LOCAL_LIBS="-lgen" ;;
477 *cray*) LOCAL_CFLAGS="-DCRAY" ;; # shell var so config.h can use it
480 case "$host_cpu-$host_os" in
481 ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
484 case "$host_cpu-$host_vendor-$host_os" in
485 m88k-motorola-sysv3) LOCAL_CFLAGS=-DWAITPID_BROKEN ;;
486 mips-pyramid-sysv4) LOCAL_CFLAGS=-Xa ;;
489 # try to create a directory tree if the source is elsewhere
490 # this should be packaged into a script accessible via ${srcdir}/support
493 *) for d in doc tests support lib ; do # dirs
494 test -d $d || mkdir $d
496 for ld in readline glob tilde malloc termcap; do # libdirs
497 test -d lib/$ld || mkdir lib/$ld
517 AC_SUBST(LOCAL_CFLAGS)
518 AC_SUBST(LOCAL_LDFLAGS)
521 #AC_SUBST(ALLOCA_SOURCE)
522 #AC_SUBST(ALLOCA_OBJECT)
524 AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
525 lib/malloc/Makefile lib/termcap/Makefile lib/tilde/Makefile \
528 # Makefile uses this timestamp file to record whether config.h is up to date.
529 echo timestamp > stamp-h