source: trunk/third/bash/configure.in @ 18545

Revision 18545, 28.6 KB checked in by ghudson, 22 years ago (diff)
Use gettext if it's installed.
Line 
1dnl
2dnl Configure script for bash-2.05
3dnl
4dnl report bugs to chet@po.cwru.edu
5dnl
6dnl Process this file with autoconf to produce a configure script.
7
8# Copyright (C) 1987-2002 Free Software Foundation, Inc.
9
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2, or (at your option)
13# any later version.
14
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU General Public License for more details.
19
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23# 02111-1307, USA.
24
25AC_REVISION([for Bash 2.05b, version 2.144, from autoconf version] AC_ACVERSION)dnl
26
27AC_INIT(bash, 2.05b, bug-bash@gnu.org)
28
29dnl make sure we are using a recent autoconf version
30AC_PREREQ(2.50)
31
32AC_CONFIG_SRCDIR(shell.h)
33dnl where to find install.sh, config.sub, and config.guess
34AC_CONFIG_AUX_DIR(./support)
35AC_CONFIG_HEADERS(config.h)
36
37dnl checks for version info
38BASHVERS=2.05b
39RELSTATUS=release
40
41dnl defaults for debug settings
42case "$RELSTATUS" in
43alp*|bet*|dev*|rc*)     DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
44*)      DEBUG= MALLOC_DEBUG= ;;
45esac
46
47dnl canonicalize the host and os so we can do some tricky things before
48dnl parsing options
49AC_CANONICAL_HOST
50
51dnl configure defaults
52opt_bash_malloc=yes
53opt_purify=no
54opt_purecov=no
55opt_afs=no
56opt_curses=no
57opt_with_installed_readline=no
58
59#htmldir=
60
61dnl some systems should be configured without the bash malloc by default
62dnl and some need a special compiler or loader
63dnl look in the NOTES file for more
64case "${host_cpu}-${host_os}" in
65alpha*-*)       opt_bash_malloc=no ;;   # alpha running osf/1 or linux
66*[[Cc]]ray*-*)  opt_bash_malloc=no ;;   # Crays
67*-osf1*)        opt_bash_malloc=no ;;   # other osf/1 machines
68sparc-svr4*)    opt_bash_malloc=no ;;   # sparc SVR4, SVR4.2
69sparc-netbsd*)  opt_bash_malloc=no ;;   # needs 8-byte alignment
70mips-irix6*)    opt_bash_malloc=no ;;   # needs 8-byte alignment
71m68k-sysv)      opt_bash_malloc=no ;;   # fixes file descriptor leak in closedir
72sparc-linux*)   opt_bash_malloc=no ;;   # sparc running linux; requires ELF
73#*-freebsd*)    opt_bash_malloc=no ;;   # they claim it's better; I disagree
74*-openbsd*)     opt_bash_malloc=no ;;   # they claim it needs eight-bit alignment
75*-aix*)         opt_bash_malloc=no ;;   # AIX machines
76*-nextstep*)    opt_bash_malloc=no ;;   # NeXT machines running NeXTstep
77*-macos*)       opt_bash_malloc=no ;;   # Apple MacOS X
78*-rhapsody*)    opt_bash_malloc=no ;;   # Apple Rhapsody (MacOS X)
79*-darwin*)      opt_bash_malloc=no ;;   # Apple Darwin (MacOS X)
80*-dgux*)        opt_bash_malloc=no ;;   # DG/UX machines
81*-qnx*)         opt_bash_malloc=no ;;   # QNX 4.2
82*-machten4)     opt_bash_malloc=no ;;   # MachTen 4.x
83*-bsdi2.1|*-bsdi3.?)    opt_bash_malloc=no ; : ${CC:=shlicc2} ;; # for loadable builtins
84*-beos*)        opt_bash_malloc=no ;;   # they say it's suitable
85*-cygwin*)      opt_bash_malloc=no ;;   # Cygnus's CYGWIN environment
86*-opennt*|*-interix*)   opt_bash_malloc=no ;;   # Interix, now owned by Microsoft
87esac
88
89# memory scrambling on free()
90case "${host_os}" in
91sco3.2v5*|sco3.2v4*)    opt_memscramble=no ;;
92*)                      opt_memscramble=yes ;;
93esac
94
95dnl arguments to configure
96dnl packages
97AC_ARG_WITH(afs, AC_HELP_STRING([--with-afs], [if you are running AFS]), opt_afs=$withval)
98AC_ARG_WITH(bash-malloc, AC_HELP_STRING([--with-bash-malloc], [use the Bash version of malloc]), opt_bash_malloc=$withval)
99AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
100AC_ARG_WITH(gnu-malloc, AC_HELP_STRING([--with-gnu-malloc], [synonym for --with-bash-malloc]), opt_bash_malloc=$withval)
101AC_ARG_WITH(installed-readline, AC_HELP_STRING([--with-installed-readline], [use a version of the readline library that is already installed]), opt_with_installed_readline=$withval)
102AC_ARG_WITH(purecov, AC_HELP_STRING([--with-purecov], [configure to postprocess with pure coverage]), opt_purecov=$withval)
103AC_ARG_WITH(purify, AC_HELP_STRING([--with-purify], [configure to postprocess with purify]), opt_purify=$withval)
104
105if test "$opt_bash_malloc" = yes; then
106        MALLOC_TARGET=malloc
107        MALLOC_SRC=malloc.c
108
109        MALLOC_LIB='-lmalloc'
110        MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
111        MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
112        MALLOC_DEP='$(MALLOC_LIBRARY)'
113
114        AC_DEFINE(USING_BASH_MALLOC)
115else
116        MALLOC_LIB=
117        MALLOC_LIBRARY=
118        MALLOC_LDFLAGS=
119        MALLOC_DEP=     
120fi
121
122if test "$opt_purify" = yes; then
123        PURIFY="purify "
124        AC_DEFINE(DISABLE_MALLOC_WRAPPERS)
125else
126        PURIFY=
127fi
128
129if test "$opt_purecov" = yes; then
130        PURIFY="${PURIFY}purecov"
131fi
132
133if test "$opt_afs" = yes; then
134        AC_DEFINE(AFS)
135fi
136
137if test "$opt_curses" = yes; then
138        prefer_curses=yes
139fi
140
141dnl optional shell features in config.h.in
142opt_minimal_config=no
143
144opt_job_control=yes
145opt_alias=yes
146opt_readline=yes
147opt_history=yes
148opt_bang_history=yes
149opt_dirstack=yes
150opt_restricted=yes
151opt_process_subst=yes
152opt_prompt_decoding=yes
153opt_select=yes
154opt_help=yes
155opt_array_variables=yes
156opt_dparen_arith=yes
157opt_extended_glob=yes
158opt_brace_expansion=yes
159opt_disabled_builtins=no
160opt_command_timing=yes
161opt_xpg_echo=no
162opt_cond_command=yes
163opt_arith_for_command=yes
164opt_net_redirs=yes
165opt_progcomp=yes
166opt_separate_help=no
167
168dnl options that affect how bash is compiled and linked
169opt_static_link=no
170opt_profiling=no
171
172dnl argument parsing for optional features
173AC_ARG_ENABLE(minimal-config, AC_HELP_STRING([--enable-minimal-config], [a minimal sh-like configuration]), opt_minimal_config=$enableval)
174
175dnl a minimal configuration turns everything off, but features can be
176dnl added individually
177if test $opt_minimal_config = yes; then
178        opt_job_control=no opt_alias=no opt_readline=no
179        opt_history=no opt_bang_history=no opt_dirstack=no
180        opt_restricted=no opt_process_subst=no opt_prompt_decoding=no
181        opt_select=no opt_help=no opt_array_variables=no opt_dparen_arith=no
182        opt_brace_expansion=no opt_disabled_builtins=no opt_command_timing=no
183        opt_extended_glob=no opt_cond_command=no opt_arith_for_command=no
184        opt_net_redirs=no opt_progcomp=no opt_separate_help=no
185fi
186
187AC_ARG_ENABLE(alias, AC_HELP_STRING([--enable-alias], [enable shell aliases]), opt_alias=$enableval)
188AC_ARG_ENABLE(arith-for-command, AC_HELP_STRING([--enable-arith-for-command], [enable arithmetic for command]), opt_arith_for_command=$enableval)
189AC_ARG_ENABLE(array-variables, AC_HELP_STRING([--enable-array-variables], [include shell array variables]), opt_array_variables=$enableval)
190AC_ARG_ENABLE(bang-history, AC_HELP_STRING([--enable-bang-history], [turn on csh-style history substitution]), opt_bang_history=$enableval)
191AC_ARG_ENABLE(brace-expansion, AC_HELP_STRING([--enable-brace-expansion], [include brace expansion]), opt_brace_expansion=$enableval)
192AC_ARG_ENABLE(command-timing, AC_HELP_STRING([--enable-command-timing], [enable the time reserved word and command timing]), opt_command_timing=$enableval)
193AC_ARG_ENABLE(cond-command, AC_HELP_STRING([--enable-cond-command], [enable the conditional command]), opt_cond_command=$enableval)
194AC_ARG_ENABLE(directory-stack, AC_HELP_STRING([--enable-directory-stack], [enable builtins pushd/popd/dirs]), opt_dirstack=$enableval)
195AC_ARG_ENABLE(disabled-builtins, AC_HELP_STRING([--enable-disabled-builtins], [allow disabled builtins to still be invoked]), opt_disabled_builtins=$enableval)
196AC_ARG_ENABLE(dparen-arithmetic, AC_HELP_STRING([--enable-dparen-arithmetic], [include ((...)) command]), opt_dparen_arith=$enableval)
197AC_ARG_ENABLE(extended-glob, AC_HELP_STRING([--enable-extended-glob], [include ksh-style extended pattern matching]), opt_extended_glob=$enableval)
198AC_ARG_ENABLE(help-builtin, AC_HELP_STRING([--enable-help-builtin], [include the help builtin]), opt_help=$enableval)
199AC_ARG_ENABLE(history, AC_HELP_STRING([--enable-history], [turn on command history]), opt_history=$enableval)
200AC_ARG_ENABLE(job-control, AC_HELP_STRING([--enable-job-control], [enable job control features]), opt_job_control=$enableval)
201AC_ARG_ENABLE(net-redirections, AC_HELP_STRING([--enable-net-redirections], [enable /dev/tcp/host/port redirection]), opt_net_redirs=$enableval)
202AC_ARG_ENABLE(process-substitution, AC_HELP_STRING([--enable-process-substitution], [enable process substitution]), opt_process_subst=$enableval)
203AC_ARG_ENABLE(progcomp, AC_HELP_STRING([--enable-progcomp], [enable programmable completion and the complete builtin]), opt_progcomp=$enableval)
204AC_ARG_ENABLE(prompt-string-decoding, AC_HELP_STRING([--enable-prompt-string-decoding], [turn on escape character decoding in prompts]), opt_prompt_decoding=$enableval)
205AC_ARG_ENABLE(readline, AC_HELP_STRING([--enable-readline], [turn on command line editing]), opt_readline=$enableval)
206AC_ARG_ENABLE(restricted, AC_HELP_STRING([--enable-restricted], [enable a restricted shell]), opt_restricted=$enableval)
207AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select], [include select command]), opt_select=$enableval)
208AC_ARG_ENABLE(separate-helpfiles, AC_HELP_STRING([--enable-separate-helpfiles], [use external files for help builtin documentation]), opt_separate_help=$enableval)
209AC_ARG_ENABLE(usg-echo-default, AC_HELP_STRING([--enable-usg-echo-default], [a synonym for --enable-xpg-echo-default]), opt_xpg_echo=$enableval)
210AC_ARG_ENABLE(xpg-echo-default, AC_HELP_STRING([--enable-xpg-echo-default], [make the echo builtin expand escape sequences by default]), opt_xpg_echo=$enableval)
211
212dnl options that alter how bash is compiled and linked
213AC_ARG_ENABLE(mem-scramble, AC_HELP_STRING([--enable-mem-scramble], [scramble memory on calls to malloc and free]), opt_memscramble=$enableval)
214AC_ARG_ENABLE(profiling, AC_HELP_STRING([--enable-profiling], [allow profiling with gprof]), opt_profiling=$enableval)
215AC_ARG_ENABLE(static-link, AC_HELP_STRING([--enable-static-link], [link bash statically, for use as a root shell]), opt_static_link=$enableval)
216
217dnl opt_job_control is handled later, after BASH_JOB_CONTROL_MISSING runs
218
219dnl opt_readline and opt_history are handled later, because AC_PROG_CC needs
220dnl to be run before we can check the version of an already-installed readline
221dnl library
222
223if test $opt_alias = yes; then
224AC_DEFINE(ALIAS)
225fi
226if test $opt_dirstack = yes; then
227AC_DEFINE(PUSHD_AND_POPD)
228fi
229if test $opt_restricted = yes; then
230AC_DEFINE(RESTRICTED_SHELL)
231fi
232if test $opt_process_subst = yes; then
233AC_DEFINE(PROCESS_SUBSTITUTION)
234fi
235if test $opt_prompt_decoding = yes; then
236AC_DEFINE(PROMPT_STRING_DECODE)
237fi
238if test $opt_select = yes; then
239AC_DEFINE(SELECT_COMMAND)
240fi
241if test $opt_help = yes; then
242AC_DEFINE(HELP_BUILTIN)
243fi
244if test $opt_array_variables = yes; then
245AC_DEFINE(ARRAY_VARS)
246fi
247if test $opt_dparen_arith = yes; then
248AC_DEFINE(DPAREN_ARITHMETIC)
249fi
250if test $opt_brace_expansion = yes; then
251AC_DEFINE(BRACE_EXPANSION)
252fi
253if test $opt_disabled_builtins = yes; then
254AC_DEFINE(DISABLED_BUILTINS)
255fi
256if test $opt_command_timing = yes; then
257AC_DEFINE(COMMAND_TIMING)
258fi
259if test $opt_xpg_echo = yes ; then
260AC_DEFINE(DEFAULT_ECHO_TO_XPG)
261fi
262if test $opt_extended_glob = yes ; then
263AC_DEFINE(EXTENDED_GLOB)
264fi
265if test $opt_cond_command = yes ; then
266AC_DEFINE(COND_COMMAND)
267fi
268if test $opt_arith_for_command = yes; then
269AC_DEFINE(ARITH_FOR_COMMAND)
270fi
271if test $opt_net_redirs = yes; then
272AC_DEFINE(NETWORK_REDIRECTIONS)
273fi
274if test $opt_progcomp = yes; then
275AC_DEFINE(PROGRAMMABLE_COMPLETION)
276fi
277
278if test $opt_memscramble = yes; then
279AC_DEFINE(MEMSCRAMBLE)
280fi
281
282if test "$opt_minimal_config" = yes; then
283        TESTSCRIPT=run-minimal
284else
285        TESTSCRIPT=run-all
286fi
287
288HELPDIR= HELPDIRDEFINE= HELPINSTALL=
289if test "$opt_separate_help" != no; then
290        if test "$opt_separate_help" = "yes" ; then
291                HELPDIR='${datadir}/bash'
292        else
293                HELPDIR=$opt_separate_help
294        fi
295        HELPDIRDEFINE='-H ${HELPDIR}'
296        HELPINSTALL='install-help'
297fi
298
299dnl now substitute in the values generated by arguments
300AC_SUBST(TESTSCRIPT)
301AC_SUBST(PURIFY)
302AC_SUBST(MALLOC_TARGET)
303AC_SUBST(MALLOC_SRC)
304
305AC_SUBST(MALLOC_LIB)
306AC_SUBST(MALLOC_LIBRARY)
307AC_SUBST(MALLOC_LDFLAGS)
308AC_SUBST(MALLOC_DEP)
309
310AC_SUBST(htmldir)
311
312AC_SUBST(HELPDIR)
313AC_SUBST(HELPDIRDEFINE)
314AC_SUBST(HELPINSTALL)
315
316echo ""
317echo "Beginning configuration for bash-$BASHVERS-$RELSTATUS for ${host_cpu}-${host_vendor}-${host_os}"
318echo ""
319
320dnl compilation checks
321dnl AC_PROG_CC sets $cross_compiling to `yes' if cross-compiling for a
322dnl different environment
323AC_PROG_CC
324
325dnl test for Unix variants
326AC_ISC_POSIX
327AC_MINIX
328
329dnl test for non-Unix variants
330AC_CYGWIN
331AC_MINGW32
332
333AC_SYS_LARGEFILE
334
335dnl BEGIN changes for cross-building for cygwin and BeOS
336
337SIGNAMES_H=lsignames.h
338
339dnl load up the cross-building cache file -- add more cases and cache
340dnl files as necessary
341
342dnl Note that host and target machine are the same, and different than the
343dnl build machine.
344dnl Set SIGNAMES_H based on whether or not we're cross-compiling.
345
346if test "x$cross_compiling" = "xyes"; then
347    case "${host}" in
348    *-cygwin*)
349        cross_cache=${srcdir}/cross-build/cygwin32.cache
350        SIGNAMES_H='$(srcdir)/cross-build/win32sig.h'
351        ;;
352    i[[3456]]86-*-beos*)
353        cross_cache=${srcdir}/cross-build/x86-beos.cache
354        SIGNAMES_H='${srcdir}/cross-build/beos-sig.h'
355        ;;
356    *)  echo "configure: cross-compiling for $host is not supported" >&2
357        ;;
358    esac
359    if test -n "${cross_cache}" && test -r "${cross_cache}"; then
360        echo "loading cross-build cache file ${cross_cache}"
361        . ${cross_cache}
362    fi
363    unset cross_cache
364fi
365AC_SUBST(SIGNAMES_H)
366
367if test -z "$CC_FOR_BUILD"; then
368    if test "x$cross_compiling" = "xno"; then
369        CC_FOR_BUILD='$(CC)'
370    else
371        CC_FOR_BUILD=gcc
372    fi
373fi
374AC_SUBST(CC_FOR_BUILD)
375
376dnl END changes for cross-building
377
378dnl We want these before the checks, so the checks can modify their values.
379test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
380
381dnl If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS.
382test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
383
384dnl handle options that alter how bash is compiled and linked
385dnl these must come after the test for cc/gcc
386if test "$opt_profiling" = "yes"; then
387        PROFILE_FLAGS=-pg
388        case "$host_os" in
389        solaris2*)      ;;
390        *)              opt_static_link=yes ;;
391        esac
392        DEBUG= MALLOC_DEBUG=
393fi
394
395if test "$opt_static_link" = yes; then
396        # if we're using gcc, add `-static' to LDFLAGS, except on Solaris >= 2
397        if test -n "$GCC" || test "$ac_cv_prog_gcc" = "yes"; then
398                STATIC_LD="-static"
399                case "$host_os" in
400                solaris2*)      ;;
401                *)              LDFLAGS="$LDFLAGS -static" ;;   # XXX experimental
402                esac
403        fi
404fi
405
406test -z "$CPPFLAGS_FOR_BUILD" && CPPFLAGS_FOR_BUILD="$CPPFLAGS"
407test -z "$CFLAGS_FOR_BUILD" && CFLAGS_FOR_BUILD="-g"
408
409AC_SUBST(CFLAGS)
410AC_SUBST(CPPFLAGS)
411AC_SUBST(LDFLAGS)
412AC_SUBST(STATIC_LD)
413
414AC_SUBST(CFLAGS_FOR_BUILD)
415AC_SUBST(CPPFLAGS_FOR_BUILD)
416AC_SUBST(LDFLAGS_FOR_BUILD)
417
418AC_PROG_GCC_TRADITIONAL
419
420dnl BEGIN READLINE and HISTORY LIBRARY SECTION
421dnl prepare to allow bash to be linked against an already-installed readline
422
423dnl first test that the readline version is new enough to link bash against
424if test "$opt_readline" = yes && test "$opt_with_installed_readline" != "no"
425then
426        # If the user specified --with-installed-readline=PREFIX and PREFIX
427        # is not `yes', set ac_cv_rl_prefix to PREFIX
428        test $opt_with_installed_readline != "yes" && ac_cv_rl_prefix=$opt_with_installed_readline
429
430        RL_LIB_READLINE_VERSION
431
432        case "$ac_cv_rl_version" in
433        4.[[3-9]]*|5*|6*|7*|8*|9*)      ;;
434        *)      opt_with_installed_readline=no
435                AC_MSG_WARN(installed readline library is too old to be linked with bash)
436                AC_MSG_WARN(using private bash version)
437                ;;
438        esac
439fi
440
441if test $opt_readline = yes; then
442        AC_DEFINE(READLINE)
443        READLINE_LIB=-lreadline
444        if test "$opt_with_installed_readline" != "no" ; then
445                case "$RL_INCLUDEDIR" in
446                /usr/include)   ;;
447                *)              RL_INCLUDE='-I${RL_INCLUDEDIR}'
448                esac
449                READLINE_DEP=
450        else
451                RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
452                READLINE_DEP='$(READLINE_LIBRARY)'
453        fi
454else
455        RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
456        READLINE_LIB= READLINE_DEP=
457fi
458if test $opt_history = yes || test $opt_bang_history = yes; then
459        if test $opt_history = yes; then
460                AC_DEFINE(HISTORY)
461        fi
462        if test $opt_bang_history = yes; then
463                AC_DEFINE(BANG_HISTORY)
464        fi
465        HISTORY_LIB=-lhistory
466        if test "$opt_with_installed_readline" != "no"; then
467                HIST_LIBDIR=$RL_LIBDIR
468                HISTORY_DEP=
469                case "$RL_INCLUDEDIR" in
470                /usr/include)   ;;
471                *)              RL_INCLUDE='-I${RL_INCLUDEDIR}'
472                esac
473        else
474                HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
475                HISTORY_DEP='$(HISTORY_LIBRARY)'
476        fi
477else
478        HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
479        HISTORY_LIB= HISTORY_DEP=
480fi
481AC_SUBST(READLINE_LIB)
482AC_SUBST(READLINE_DEP)
483AC_SUBST(RL_LIBDIR)
484AC_SUBST(RL_INCLUDEDIR)
485AC_SUBST(RL_INCLUDE)
486AC_SUBST(HISTORY_LIB)
487AC_SUBST(HISTORY_DEP)
488AC_SUBST(HIST_LIBDIR)
489
490dnl END READLINE and HISTORY LIBRARY SECTION
491
492dnl programs needed by the build and install process
493AC_PROG_INSTALL
494AC_CHECK_PROG(AR, ar, , ar)
495dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
496dnl This allows people to set it when running configure or make
497test -n "$ARFLAGS" || ARFLAGS="cr"
498AC_PROG_RANLIB
499AC_PROG_YACC
500AC_PROG_MAKE_SET
501
502case "$host_os" in
503opennt*|interix*)       MAKE_SHELL="$INTERIX_ROOT/bin/sh" ;;
504*)                      MAKE_SHELL=/bin/sh ;;
505esac
506AC_SUBST(MAKE_SHELL)
507
508dnl Turn on any extensions available in the GNU C library.
509AC_DEFINE(_GNU_SOURCE, 1)
510
511dnl C compiler characteristics
512AC_C_CONST
513AC_C_INLINE
514AC_C_BIGENDIAN
515AC_C_STRINGIZE
516AC_C_LONG_DOUBLE
517AC_C_PROTOTYPES
518AC_C_CHAR_UNSIGNED
519
520dnl header files
521AC_HEADER_DIRENT
522AC_HEADER_TIME
523
524BASH_HEADER_INTTYPES
525
526AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
527                 memory.h locale.h termcap.h termio.h termios.h dlfcn.h \
528                 stddef.h stdint.h netdb.h grp.h strings.h)
529AC_CHECK_HEADERS(sys/ptem.h sys/pte.h sys/stream.h sys/select.h sys/file.h \
530                 sys/resource.h sys/param.h sys/socket.h \
531                 sys/time.h sys/times.h sys/wait.h)
532AC_CHECK_HEADERS(netinet/in.h arpa/inet.h)
533
534dnl special checks for libc functions
535AC_FUNC_ALLOCA
536AC_FUNC_GETPGRP
537AC_FUNC_SETVBUF_REVERSED
538AC_FUNC_VPRINTF
539AC_FUNC_STRCOLL
540
541dnl if we're not using the bash malloc but require the C alloca, set things
542dnl up to build a libmalloc.a containing only alloca.o
543
544if test "$ac_cv_func_alloca_works" = "no" && test "$opt_bash_malloc" = "no"; then
545        MALLOC_TARGET=alloca
546        MALLOC_SRC=alloca.c
547
548        MALLOC_LIB='-lmalloc'
549        MALLOC_LIBRARY='$(ALLOC_LIBDIR)/libmalloc.a'
550        MALLOC_LDFLAGS='-L$(ALLOC_LIBDIR)'
551        MALLOC_DEP='$(MALLOC_LIBRARY)'
552fi
553
554dnl if vprintf is not in libc, see if it's defined in stdio.h
555if test "$ac_cv_func_vprintf" = no; then
556    AC_MSG_CHECKING(for declaration of vprintf in stdio.h)
557    AC_EGREP_HEADER([[int[      ]*vprintf[^a-zA-Z0-9]]],stdio.h,ac_cv_func_vprintf=yes)
558    AC_MSG_RESULT($ac_cv_func_vprintf)
559    if test $ac_cv_func_vprintf = yes; then
560        AC_DEFINE(HAVE_VPRINTF)
561    fi
562fi
563
564if test "$ac_cv_func_vprintf" = no && test "$ac_cv_func__doprnt" = "yes"; then
565  AC_LIBOBJ(vprint)
566fi
567
568dnl signal stuff
569AC_TYPE_SIGNAL
570
571dnl checks for certain version-specific system calls and libc functions
572AC_CHECK_FUNC(__setostype, AC_DEFINE(HAVE_SETOSTYPE))
573AC_CHECK_FUNC(wait3, AC_DEFINE(HAVE_WAIT3))
574AC_CHECK_FUNC(isinf, AC_DEFINE(HAVE_ISINF_IN_LIBC))
575
576dnl checks for missing libc functions
577AC_CHECK_FUNC(mkfifo,AC_DEFINE(HAVE_MKFIFO),AC_DEFINE(MKFIFO_MISSING))
578
579dnl checks for system calls
580AC_CHECK_FUNCS(dup2 select getdtablesize getgroups gethostname \
581                setdtablesize getpagesize killpg lstat getpeername sbrk \
582                getrlimit getrusage gettimeofday waitpid tcgetpgrp \
583                readlink)
584AC_REPLACE_FUNCS(rename)
585
586dnl checks for c library functions
587AC_CHECK_FUNCS(bcopy bzero confstr sysconf pathconf setenv putenv unsetenv \
588                setlinebuf setvbuf setlocale strchr tcgetattr uname \
589                ulimit tzset siginterrupt memmove ttyname times \
590                getaddrinfo gethostbyname getservbyname getservent inet_aton \
591                vsnprintf snprintf vasprintf asprintf fnmatch)
592AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit)
593AC_REPLACE_FUNCS(getcwd strcasecmp strerror strftime strpbrk memset)
594AC_REPLACE_FUNCS(strtod strtol strtoul strtoll strtoull strtoimax strtoumax)
595
596AC_CHECK_DECLS([confstr])
597AC_CHECK_DECLS([printf])
598AC_CHECK_DECLS([sbrk])
599AC_CHECK_DECLS([strcpy])
600AC_CHECK_DECLS([strsignal])
601AC_CHECK_DECLS([strtold])
602
603BASH_CHECK_DECL(strtoimax)
604BASH_CHECK_DECL(strtol)
605BASH_CHECK_DECL(strtoll)
606BASH_CHECK_DECL(strtoul)
607BASH_CHECK_DECL(strtoull)
608BASH_CHECK_DECL(strtoumax)
609
610AC_FUNC_MKTIME
611
612dnl checks for locale functions
613AC_CHECK_HEADERS(libintl.h)
614AC_CHECK_FUNCS(gettext textdomain bindtextdomain)
615
616dnl check for GNU libintl if gettext/textdomain/bindtextdomain
617dnl are not found in libc
618if test :; then
619    AC_CHECK_LIB(intl,bindtextdomain)
620    if test "$ac_cv_lib_intl" = "yes"; then
621        AC_CHECK_FUNCS(gettext textdomain bindtextdomain)
622    fi
623fi
624
625BASH_CHECK_MULTIBYTE
626
627dnl checks for the dynamic loading library functions in libc and libdl
628if test "$opt_static_link" != yes; then
629AC_CHECK_LIB(dl, dlopen)
630AC_CHECK_FUNCS(dlopen dlclose dlsym)
631fi
632
633dnl this defines SYS_SIGLIST_DECLARED
634AC_DECL_SYS_SIGLIST
635
636dnl network functions -- check for inet_aton again
637if test "$ac_cv_func_inet_aton" != 'yes'; then
638BASH_FUNC_INET_ATON
639fi
640
641dnl libraries
642dnl this is reportedly no longer necessary for irix[56].?
643case "$host_os" in
644irix4*) AC_CHECK_LIB(sun, getpwent) ;;
645esac
646
647dnl check for getpeername in the socket library only if it's not in libc
648if test "$ac_cv_func_getpeername" = no; then
649        BASH_CHECK_LIB_SOCKET
650fi
651dnl check for gethostbyname in socket libraries if it's not in libc
652if test "$ac_cv_func_gethostbyname" = no; then
653        BASH_FUNC_GETHOSTBYNAME
654fi
655
656dnl system types
657AC_TYPE_GETGROUPS
658AC_TYPE_OFF_T
659AC_TYPE_MODE_T
660AC_TYPE_UID_T
661AC_TYPE_PID_T
662AC_TYPE_SIZE_T
663AC_CHECK_TYPE(ssize_t, int)
664AC_CHECK_TYPE(time_t, long)
665
666BASH_TYPE_LONG_LONG
667BASH_TYPE_UNSIGNED_LONG_LONG
668
669AC_TYPE_SIGNAL
670
671AC_CHECK_SIZEOF(char, 1)
672AC_CHECK_SIZEOF(short, 2)
673AC_CHECK_SIZEOF(int, 4)
674AC_CHECK_SIZEOF(long, 4)
675AC_CHECK_SIZEOF(char *, 4)
676AC_CHECK_SIZEOF(double, 8)
677AC_CHECK_SIZEOF([long long], 8)
678
679AC_CHECK_TYPE(u_int, [unsigned int])
680AC_CHECK_TYPE(u_long, [unsigned long])
681
682BASH_TYPE_BITS16_T
683BASH_TYPE_U_BITS16_T
684BASH_TYPE_BITS32_T
685BASH_TYPE_U_BITS32_T
686BASH_TYPE_BITS64_T
687
688BASH_TYPE_PTRDIFF_T
689
690dnl structures
691AC_HEADER_STAT
692
693dnl system services
694AC_SYS_INTERPRETER
695if test $ac_cv_sys_interpreter = yes; then
696AC_DEFINE(HAVE_HASH_BANG_EXEC)
697fi
698
699dnl Miscellaneous Bash tests
700if test "$ac_cv_func_lstat" = "no"; then
701BASH_FUNC_LSTAT
702fi
703
704dnl behavior of system calls and library functions
705BASH_FUNC_DUP2_CLOEXEC_CHECK
706BASH_SYS_PGRP_SYNC
707BASH_SYS_SIGNAL_VINTAGE
708
709dnl checking for the presence of certain library symbols
710BASH_SYS_ERRLIST
711BASH_SYS_SIGLIST
712BASH_UNDER_SYS_SIGLIST
713
714dnl various system types
715BASH_TYPE_SIGHANDLER
716BASH_CHECK_TYPE(clock_t, [#include <sys/times.h>], long)
717BASH_CHECK_TYPE(sigset_t, [#include <signal.h>], int)
718BASH_CHECK_TYPE(quad_t, , long, HAVE_QUAD_T)
719BASH_CHECK_TYPE(intmax_t, , $bash_cv_type_long_long)
720BASH_CHECK_TYPE(uintmax_t, , $bash_cv_type_unsigned_long_long)
721if test "$ac_cv_header_sys_socket_h" = "yes"; then
722BASH_CHECK_TYPE(socklen_t, [#include <sys/socket.h>], int, HAVE_SOCKLEN_T)
723fi
724BASH_TYPE_RLIMIT
725
726dnl presence and contents of structures used by system calls
727BASH_STRUCT_TERMIOS_LDISC
728BASH_STRUCT_TERMIO_LDISC
729BASH_STRUCT_DIRENT_D_INO
730BASH_STRUCT_DIRENT_D_FILENO
731BASH_STRUCT_WINSIZE
732BASH_STRUCT_TIMEVAL
733AC_CHECK_MEMBERS([struct stat.st_blocks])
734AC_STRUCT_TM
735AC_STRUCT_TIMEZONE
736
737dnl presence and behavior of C library functions
738BASH_FUNC_STRSIGNAL
739BASH_FUNC_OPENDIR_CHECK
740BASH_FUNC_ULIMIT_MAXFDS
741BASH_FUNC_GETENV
742if test "$ac_cv_func_getcwd" = "yes"; then
743BASH_FUNC_GETCWD
744fi
745BASH_FUNC_POSIX_SETJMP
746BASH_FUNC_STRCOLL
747
748dnl If putenv or unsetenv is not present, set the right define so the
749dnl prototype and declaration in lib/sh/getenv.c will be standard-conformant
750
751if test "$ac_cv_func_putenv" = "yes"; then
752BASH_FUNC_STD_PUTENV
753else
754AC_DEFINE(HAVE_STD_PUTENV)
755fi
756if test "$ac_cv_func_unsetenv" = "yes"; then
757BASH_FUNC_STD_UNSETENV
758else
759AC_DEFINE(HAVE_STD_UNSETENV)
760fi
761
762dnl I have removed this check.  The existing libc FNM_EXTMATCH implementation
763dnl (glibc-2.2.4) disagrees with bash on the matching of incorrectly-formed
764dnl patterns (bash treats them as strings or characters to be matched without
765dnl any special meaning) and has one outright bug:  a[X-]b should match
766dnl both a-b and aXb.
767dnl
768dnl Once Ulrich and I get together on this, the check can return
769dnl
770dnl chet 10/31/2001
771dnl
772dnl BASH_FUNC_FNMATCH_EXTMATCH
773
774BASH_FUNC_PRINTF_A_FORMAT
775
776dnl presence and behavior of OS functions
777BASH_SYS_REINSTALL_SIGHANDLERS
778BASH_SYS_JOB_CONTROL_MISSING
779BASH_SYS_NAMED_PIPES
780
781dnl presence of certain CPP defines
782AC_HEADER_TIOCGWINSZ
783BASH_HAVE_TIOCSTAT
784BASH_HAVE_FIONREAD
785
786dnl miscellaneous
787BASH_CHECK_SPEED_T
788BASH_CHECK_GETPW_FUNCS
789BASH_CHECK_RTSIGS
790BASH_CHECK_SYS_SIGLIST
791
792dnl special checks
793case "$host_os" in
794hpux*)  BASH_CHECK_KERNEL_RLIMIT ;;
795esac
796
797if test "$opt_readline" = yes; then
798dnl yuck
799case "$host_os" in
800aix*)   prefer_curses=yes ;;
801esac
802BASH_CHECK_LIB_TERMCAP
803fi
804AC_SUBST(TERMCAP_LIB)
805AC_SUBST(TERMCAP_DEP)
806
807BASH_CHECK_DEV_FD
808BASH_CHECK_DEV_STDIN
809BASH_SYS_DEFAULT_MAIL_DIR
810
811if test "$bash_cv_job_control_missing" = missing; then
812        opt_job_control=no
813fi
814
815if test "$opt_job_control" = yes; then
816AC_DEFINE(JOB_CONTROL)
817JOBS_O=jobs.o
818else
819JOBS_O=nojobs.o
820fi
821
822AC_SUBST(JOBS_O)
823
824dnl Defines that we want to propagate to the Makefiles in subdirectories,
825dnl like glob and readline
826
827LOCAL_DEFS=-DSHELL
828
829dnl use this section to possibly define more cpp variables, specify local
830dnl libraries, and specify any additional local cc flags
831dnl
832dnl this should really go away someday
833
834case "${host_os}" in
835sysv4.2*)       AC_DEFINE(SVR4_2)
836                AC_DEFINE(SVR4) ;;
837sysv4*)         AC_DEFINE(SVR4) ;;
838sysv5*)         AC_DEFINE(SVR5) ;;
839hpux9*)         LOCAL_CFLAGS="-DHPUX9 -DHPUX" ;;
840hpux*)          LOCAL_CFLAGS=-DHPUX ;;
841dgux*)          LOCAL_CFLAGS=-D_DGUX_SOURCE; LOCAL_LIBS=-ldgc ;;
842isc*)           LOCAL_CFLAGS=-Disc386 ;;
843rhapsody*)      LOCAL_CFLAGS=-DRHAPSODY ;;
844darwin*)        LOCAL_CFLAGS=-DMACOSX ;;
845sco3.2v5*)      LOCAL_CFLAGS="-b elf -DWAITPID_BROKEN -DPATH_MAX=1024" ;;
846sco3.2v4*)      LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
847sco3.2*)        LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;;
848sunos4*)        LOCAL_CFLAGS=-DSunOS4 ;;
849solaris2.5*)    LOCAL_CFLAGS=-DSunOS5 ;;
850lynxos*)        LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
851linux*)         LOCAL_LDFLAGS=-rdynamic ;;       # allow dynamic loading
852*qnx*)          LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
853powerux*)       LOCAL_LIBS="-lgen" ;;
854cygwin*)        LOCAL_LIBS="-luser32" ;;
855opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO" ;;
856esac
857
858dnl Stanza for OS/compiler pair-specific flags
859case "${host_os}-${CC}" in
860aix4.2*-*gcc*)  LOCAL_LDFLAGS="-Xlinker -bexpall -Xlinker -brtl" ;;
861aix4.2*)        LOCAL_LDFLAGS="-bexpall -brtl" ;;
862bsdi4*-*gcc*)   LOCAL_LDFLAGS="-rdynamic" ;;    # allow dynamic loading, like Linux
863esac
864
865dnl FreeBSD-3.x can have either a.out or ELF
866case "${host_os}" in
867freebsd[[3-9]]*)
868                if test -x /usr/bin/objformat && test "`/usr/bin/objformat`" = "elf" ; then
869                        LOCAL_LDFLAGS=-rdynamic # allow dynamic loading
870                fi ;;
871freebsdelf*)    LOCAL_LDFLAGS=-rdynamic ;;      # allow dynamic loading
872esac
873
874case "$host_cpu" in
875*cray*)         LOCAL_CFLAGS="-DCRAY" ;; # shell var so config.h can use it
876esac
877
878case "$host_cpu-$host_os" in
879ibmrt-*bsd4*)   LOCAL_CFLAGS="-ma -U__STDC__" ;;
880esac
881
882case "$host_cpu-$host_vendor-$host_os" in
883m88k-motorola-sysv3)    LOCAL_CFLAGS=-DWAITPID_BROKEN ;;
884mips-pyramid-sysv4)     LOCAL_CFLAGS=-Xa ;;
885esac
886
887#
888# Shared object configuration section.  These values are generated by
889# ${srcdir}/support/shobj-conf
890#
891if test "$ac_cv_func_dlopen" = "yes" && test -f ${srcdir}/support/shobj-conf
892then
893        AC_MSG_CHECKING(shared object configuration for loadable builtins)
894        eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c "${host_cpu}" -o "${host_os}" -v "${host_vendor}"`
895        AC_SUBST(SHOBJ_CC)
896        AC_SUBST(SHOBJ_CFLAGS)
897        AC_SUBST(SHOBJ_LD)
898        AC_SUBST(SHOBJ_LDFLAGS)
899        AC_SUBST(SHOBJ_XLDFLAGS)
900        AC_SUBST(SHOBJ_LIBS)
901        AC_SUBST(SHOBJ_STATUS)
902        AC_MSG_RESULT($SHOBJ_STATUS)
903fi
904
905# try to create a directory tree if the source is elsewhere
906# this should be packaged into a script accessible via ${srcdir}/support
907case "$srcdir" in
908.)      ;;
909*)      for d in doc tests support lib examples; do     # dirs
910                test -d $d || mkdir $d
911        done
912        for ld in readline glob tilde malloc sh termcap; do     # libdirs
913                test -d lib/$ld || mkdir lib/$ld
914        done
915        test -d examples/loadables || mkdir examples/loadables  # loadable builtins
916        test -d examples/loadables/perl || mkdir examples/loadables/perl
917        ;;
918esac
919
920BUILD_DIR=`pwd`
921
922AC_SUBST(PROFILE_FLAGS)
923
924AC_SUBST(incdir)
925AC_SUBST(BUILD_DIR)
926
927AC_SUBST(YACC)
928AC_SUBST(AR)
929AC_SUBST(ARFLAGS)
930
931AC_SUBST(BASHVERS)
932AC_SUBST(RELSTATUS)
933AC_SUBST(DEBUG)
934AC_SUBST(MALLOC_DEBUG)
935
936AC_SUBST(host_cpu)
937AC_SUBST(host_vendor)
938AC_SUBST(host_os)
939
940AC_SUBST(LOCAL_LIBS)
941AC_SUBST(LOCAL_CFLAGS)
942AC_SUBST(LOCAL_LDFLAGS)
943AC_SUBST(LOCAL_DEFS)
944
945#AC_SUBST(ALLOCA_SOURCE)
946#AC_SUBST(ALLOCA_OBJECT)
947
948AC_OUTPUT([Makefile builtins/Makefile lib/readline/Makefile lib/glob/Makefile \
949          lib/malloc/Makefile lib/sh/Makefile lib/termcap/Makefile \
950          lib/tilde/Makefile doc/Makefile support/Makefile \
951          examples/loadables/Makefile examples/loadables/perl/Makefile],
952[
953# Makefile uses this timestamp file to record whether config.h is up to date.
954echo timestamp > stamp-h
955])
Note: See TracBrowser for help on using the repository browser.