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