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