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