2 dnl Configure script for bash-2.0
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
8 AC_REVISION([for Bash 2.0, version 1.14, from autoconf version] AC_ACVERSION)dnl
11 AC_CONFIG_HEADER(config.h)
13 dnl make sure we are using a recent autoconf version
16 dnl where to find install.sh, config.sub, and config.guess
17 AC_CONFIG_AUX_DIR(./support)
19 dnl canonicalize the host and os so we can do some tricky things before
23 dnl configure defaults
29 dnl some systems should be configured without gnu malloc by default
30 dnl and some need a special compiler or loader
31 dnl look in the NOTES file for more
32 case "${host_cpu}-${host_os}" in
33 alpha-*) opt_gnu_malloc=no ;; # alpha running osf/1 or linux
34 *cray*-*) opt_gnu_malloc=no ;; # Crays
35 *-osf1*) opt_gnu_malloc=no ;; # other osf/1 machines
36 sparc-svr4*) opt_gnu_malloc=no ;; # sparc SVR4, SVR4.2
37 sparc-netbsd*) opt_gnu_malloc=no ;; # needs 8-byte alignment
38 sparc-linux*) opt_gnu_malloc=no ;; # sparc running linux; requires ELF
39 *-aix*) opt_gnu_malloc=no ;; # AIX machines
40 *-nextstep*) opt_gnu_malloc=no ;; # NeXT machines running NeXTstep
41 *-dgux*) opt_gnu_malloc=no ;; # DG/UX machines
42 *-qnx) opt_gnu_malloc=no ;; # QNX 4.2
43 *-bsdi2.1) opt_gnu_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
46 dnl arguments to configure
48 AC_ARG_WITH(gnu-malloc, --with-gnu-malloc use the GNU version of malloc,opt_gnu_malloc=$withval)
49 AC_ARG_WITH(glibc-malloc, --with-glibc-malloc use the GNU C library version of malloc,opt_glibc_malloc=$withval)
50 AC_ARG_WITH(purify, --with-purify configure to postprocess with purify, opt_purify=$withval)
51 AC_ARG_WITH(afs, --with-afs if you are running AFS, opt_afs=$withval)
53 dnl test for glibc malloc first because it can override the default
54 if test "$opt_glibc_malloc" = yes; then
55 MALLOC=gmalloc.o MALLOC_SRC='$(ALLOC_LIBSRC)/gmalloc.c'
56 elif test "$opt_gnu_malloc" = yes; then
57 MALLOC=malloc.o MALLOC_SRC='$(ALLOC_LIBSRC)/malloc.c'
62 if test "$opt_purify" = yes; then
68 if test "$opt_afs" = yes; then
72 dnl optional shell features in config.h.in
83 opt_prompt_decoding=yes
86 opt_array_variables=yes
88 opt_brace_expansion=yes
89 opt_disabled_builtins=no
90 opt_command_timing=yes
93 dnl argument parsing for optional features
94 AC_ARG_ENABLE(minimal-config, --enable-minimal-config a minimal sh-like configuration, opt_minimal_config=$enableval)
96 dnl a minimal configuration turns everything off, but features can be
97 dnl added individually
98 if test $opt_minimal_config = yes; then
99 opt_job_control=no opt_alias=no opt_readline=no
100 opt_history=no opt_bang_history=no opt_dirstack=no
101 opt_restricted=no opt_process_subst=no opt_prompt_decoding=no
102 opt_select=no opt_help=no opt_array_variables=no opt_dparen_arith=no
103 opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
106 AC_ARG_ENABLE(job-control, --enable-job-control enable job control features, opt_job_control=$enableval)
107 AC_ARG_ENABLE(alias, --enable-alias enable shell aliases, opt_alias=$enableval)
108 AC_ARG_ENABLE(readline, --enable-readline turn on command line editing, opt_readline=$enableval)
109 AC_ARG_ENABLE(history, --enable-history turn on command history, opt_history=$enableval)
110 AC_ARG_ENABLE(bang-history, --enable-bang-history turn on csh-style history substitution, opt_bang_history=$enableval)
111 AC_ARG_ENABLE(directory-stack, --enable-directory-stack enable builtins pushd/popd/dirs, opt_dirstack=$enableval)
112 AC_ARG_ENABLE(restricted, --enable-restricted enable a restricted shell, opt_restricted=$enableval)
113 AC_ARG_ENABLE(process-substitution, --enable-process-substitution enable process substitution, opt_process_subst=$enableval)
114 AC_ARG_ENABLE(prompt-string-decoding, --enable-prompt-string-decoding turn on escape character decoding in prompts, opt_prompt_decoding=$enableval)
115 AC_ARG_ENABLE(select, --enable-select include select command, opt_select=$enableval)
116 AC_ARG_ENABLE(help-builtin, --enable-help-builtin include the help builtin, opt_help=$enableval)
117 AC_ARG_ENABLE(array-variables, --enable-array-variables include shell array variables, opt_array_variables=$enableval)
118 AC_ARG_ENABLE(dparen-arithmetic, [--enable-dparen-arithmetic include ((...)) command], opt_dparen_arith=$enableval)
119 AC_ARG_ENABLE(brace-expansion, --enable-brace-expansion include brace expansion, opt_brace_expansion=$enableval)
120 AC_ARG_ENABLE(disabled-builtins, --enable-disabled-builtins allow disabled builtins to still be invoked, opt_disabled_builtins=$enableval)
121 AC_ARG_ENABLE(command-timing, --enable-command-timing enable the time reserved word and command timing, opt_command_timing=$enableval)
122 AC_ARG_ENABLE(usg-echo-default, --enable-usg-echo-default make the echo builtin expand escape sequences by default, opt_usg_echo=$enableval)
124 dnl opt_job_control is handled later, after BASH_JOB_CONTROL_MISSING runs
126 if test $opt_alias = yes; then
129 if test $opt_readline = yes; then
131 READLINE_LIB=-lreadline
132 READLINE_DEP='$(READLINE_LIBRARY)'
134 READLINE_LIB= READLINE_DEP=
136 if test $opt_history = yes; then
138 HISTORY_LIB=-lhistory
139 HISTORY_DEP='$(HISTORY_LIBRARY)'
141 HISTORY_LIB= HISTORY_DEP=
143 if test $opt_bang_history = yes; then
144 AC_DEFINE(BANG_HISTORY)
145 HISTORY_LIB=-lhistory
146 HISTORY_DEP='$(HISTORY_LIBRARY)'
148 HISTORY_LIB= HISTORY_DEP=
150 if test $opt_dirstack = yes; then
151 AC_DEFINE(PUSHD_AND_POPD)
153 if test $opt_restricted = yes; then
154 AC_DEFINE(RESTRICTED_SHELL)
156 if test $opt_process_subst = yes; then
157 AC_DEFINE(PROCESS_SUBSTITUTION)
159 if test $opt_prompt_decoding = yes; then
160 AC_DEFINE(PROMPT_STRING_DECODE)
162 if test $opt_select = yes; then
163 AC_DEFINE(SELECT_COMMAND)
165 if test $opt_help = yes; then
166 AC_DEFINE(HELP_BUILTIN)
168 if test $opt_array_variables = yes; then
169 AC_DEFINE(ARRAY_VARS)
171 if test $opt_dparen_arith = yes; then
172 AC_DEFINE(DPAREN_ARITHMETIC)
174 if test $opt_brace_expansion = yes; then
175 AC_DEFINE(BRACE_EXPANSION)
177 if test $opt_disabled_builtins = yes; then
178 AC_DEFINE(DISABLED_BUILTINS)
180 if test $opt_command_timing = yes; then
181 AC_DEFINE(COMMAND_TIMING)
183 if test $opt_usg_echo = yes ; then
184 AC_DEFINE(DEFAULT_ECHO_TO_USG)
187 dnl now substitute in the values generated by arguments
191 AC_SUBST(READLINE_LIB)
192 AC_SUBST(READLINE_DEP)
193 AC_SUBST(HISTORY_LIB)
194 AC_SUBST(HISTORY_DEP)
196 echo "Beginning configuration for bash-2.0"
198 dnl compilation checks
203 dnl See whether cc works at all
206 dnl We want these before the checks, so the checks can modify their values.
207 test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
209 dnl If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS.
210 test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
216 AC_PROG_GCC_TRADITIONAL
218 dnl programs needed by the build and install process
220 AC_CHECK_PROG(AR, ar, ar)
225 dnl special checks for libc functions
228 AC_FUNC_SETVBUF_REVERSED
233 dnl if vprintf is not in libc, see if it's defined in stdio.h
234 if test "$ac_cv_func_vprintf" = no; then
235 AC_MSG_CHECKING(for declaration of vprintf in stdio.h)
236 AC_EGREP_HEADER([[int[ ]*vprintf[^a-zA-Z0-9]]],stdio.h,ac_cv_func_vprintf=yes)
237 AC_MSG_RESULT($ac_cv_func_vprintf)
238 if test $ac_cv_func_vprintf = yes; then
239 AC_DEFINE(HAVE_VPRINTF)
246 dnl checks for certain version-specific system calls and libc functions
247 AC_CHECK_FUNC(__setostype, AC_DEFINE(HAVE_SETOSTYPE))
248 AC_CHECK_FUNC(wait3, AC_DEFINE(HAVE_WAIT3))
250 dnl checks for missing libc functions
251 AC_CHECK_FUNC(mkfifo,AC_DEFINE(HAVE_MKFIFO),AC_DEFINE(MKFIFO_MISSING))
253 dnl checks for system calls
254 AC_CHECK_FUNCS(dup2 select getdtablesize getgroups gethostname \
255 setdtablesize getpagesize killpg lstat getpeername \
256 getrlimit getrusage gettimeofday waitpid tcgetpgrp)
258 dnl checks for c library functions
259 AC_CHECK_FUNCS(bcopy bzero confstr getcwd strcasecmp setenv putenv \
260 setlinebuf setlocale strchr strerror tcgetattr uname \
261 sysconf ulimit times tzset siginterrupt memmove)
263 dnl checks for locale functions
264 AC_CHECK_HEADERS(libintl.h)
265 AC_CHECK_FUNCS(gettext textdomain bindtextdomain)
267 dnl check for GNU libintl if gettext/textdomain/bindtextdomain
268 dnl are not found in libc
269 if test "$ac_cv_func_bindtextdomain" = "no"; then
270 AC_CHECK_LIB(intl,bindtextdomain)
271 if test "$ac_cv_lib_intl" = "yes"; then
272 AC_CHECK_FUNCS(gettext textdomain bindtextdomain)
276 dnl checks for the dynamic loading library functions in libc and libdl
277 AC_CHECK_LIB(dl, dlopen)
278 AC_CHECK_FUNCS(dlopen dlclose dlsym)
280 dnl this defines SYS_SIGLIST_DECLARED
287 AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
288 memory.h locale.h termcap.h termio.h termios.h)
289 AC_CHECK_HEADERS(sys/ptem.h sys/pte.h sys/stream.h sys/select.h sys/file.h \
290 sys/resource.h sys/param.h sys/socket.h \
291 sys/time.h sys/times.h sys/wait.h)
294 dnl this is reportedly no longer necessary for irix[56].?
295 dnl AC_CHECK_LIB(sun, getpwent)
305 AC_CHECK_TYPE(time_t, long)
311 AC_HEADER_EGREP(struct timeval, sys/time.h, bash_cv_struct_timeval=yes, )
312 if test -z "$bash_cv_struct_timeval"; then
313 AC_HEADER_EGREP(struct timeval, time.h, bash_cv_struct_timeval=yes, bash_cv_struct_timeval=no)
315 if test $bash_cv_struct_timeval = yes; then
316 AC_DEFINE(HAVE_TIMEVAL)
319 dnl C compiler characteristics
324 if test $ac_cv_sys_interpreter = yes; then
325 AC_DEFINE(HAVE_HASH_BANG_EXEC)
327 dnl we use NO_READ_RESTART_ON_SIGNAL
328 AC_SYS_RESTARTABLE_SYSCALLS
330 dnl Miscellaneous Bash tests
331 if test "$ac_cv_func_lstat" = "no"; then
335 BASH_DUP2_CLOEXEC_CHECK
339 BASH_UNDER_SYS_SIGLIST
342 BASH_CHECK_TYPE(clock_t, [#include <sys/times.h>], long)
343 BASH_CHECK_TYPE(sigset_t, [#include <signal.h>], int)
344 BASH_CHECK_TYPE(quad_t, , long, HAVE_QUAD_T)
346 BASH_STRUCT_TERMIOS_LDISC
347 BASH_STRUCT_TERMIO_LDISC
348 BASH_STRUCT_DIRENT_D_INO
350 BASH_FUNC_OPENDIR_CHECK
352 BASH_FUNC_ULIMIT_MAXFDS
355 BASH_FUNC_SBRK_DECLARED
356 BASH_FUNC_POSIX_SETJMP
357 BASH_REINSTALL_SIGHANDLERS
358 BASH_JOB_CONTROL_MISSING
363 BASH_CHECK_GETPW_FUNCS
367 hpux*) BASH_KERNEL_RLIMIT_CHECK ;;
370 if test "$opt_readline" = yes; then
371 BASH_CHECK_LIB_TERMCAP
373 AC_SUBST(TERMCAP_LIB)
374 AC_SUBST(TERMCAP_DEP)
377 BASH_DEFAULT_MAIL_DIR
379 if test "$bash_cv_job_control_missing" = missing; then
383 if test "$opt_job_control" = yes; then
384 AC_DEFINE(JOB_CONTROL)
392 dnl use this section to possibly define more cpp variables, specify local
393 dnl libraries, and specify any additional local cc flags
395 dnl this should really go away someday
398 sysv4.2) AC_DEFINE(SVR4_2)
400 sysv4*) AC_DEFINE(SVR4) ;;
401 hpux*) LOCAL_CFLAGS=-DHPUX ;;
402 dgux*) LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
403 isc*) LOCAL_CFLAGS=-Disc386;;
404 sco3.2v5*) LOCAL_CFLAGS="-DWAITPID_BROKEN -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
405 sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DNO_MEMSCRAMBLE -DPATH_MAX=1024" ;;
406 sco3.2*) LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
407 sunos4*) LOCAL_CFLAGS=-DSunOS4;;
408 linux*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
409 aix4.2*) LOCAL_LDFLAGS="-bexpall -brtl";;# allow dynamic loading
413 *cray*) LOCAL_CFLAGS="-DCRAY" ;; # shell var so config.h can use it
416 case "$host_cpu-$host_os" in
417 ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
420 case "$host_cpu-$host_vendor-$host_os" in
421 m88k-motorola-sysv3) LOCAL_CFLAGS=-DWAITPID_BROKEN ;;
422 mips-pyramid-sysv4) LOCAL_CFLAGS=-Xa ;;
425 # try to create a directory tree if the source is elsewhere
426 # this should be packaged into a script accessible via ${srcdir}/support
429 *) for d in doc tests support lib ; do # dirs
430 test -d $d || mkdir $d
432 for ld in readline glob tilde malloc termcap; do # libdirs
433 test -d lib/$ld || mkdir lib/$ld
450 AC_SUBST(LOCAL_CFLAGS)
451 AC_SUBST(LOCAL_LDFLAGS)
453 AC_SUBST(ALLOCA_SOURCE)
454 AC_SUBST(ALLOCA_OBJECT)
456 AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
457 lib/malloc/Makefile lib/termcap/Makefile lib/tilde/Makefile \
460 # Makefile uses this timestamp file to record whether config.h is up to date.
461 echo timestamp > stamp-h