2 dnl Configure script for readline library
4 dnl report bugs to chet@po.cwru.edu
6 dnl Process this file with autoconf to produce a configure script.
8 # Copyright (C) 1987-2005 Free Software Foundation, Inc.
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)
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.
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
25 AC_REVISION([for Readline 5.1, version 2.59])
27 AC_INIT(readline, 5.1-release, bug-readline@gnu.org)
29 dnl make sure we are using a recent autoconf version
32 AC_CONFIG_SRCDIR(readline.h)
34 dnl AC_CONFIG_AUX_DIR(./support)
35 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
36 AC_CONFIG_HEADERS(config.h)
38 dnl update the value of RL_READLINE_VERSION in readline.h when this changes
43 dnl configure defaults
47 dnl arguments to configure
48 AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
49 AC_ARG_WITH(purify, AC_HELP_STRING([--with-purify], [configure to postprocess with purify]), opt_purify=$withval)
51 if test "$opt_curses" = "yes"; then
55 if test "$opt_purify" = yes; then
61 dnl option parsing for optional features
66 AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
67 dnl AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
68 AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
70 if test $opt_multibyte = no; then
71 AC_DEFINE(NO_MULTIBYTE_SUPPORT)
74 dnl load up the cross-building cache file -- add more cases and cache
75 dnl files as necessary
77 dnl Note that host and target machine are the same, and different than the
80 if test "x$cross_compiling" = "xyes"; then
83 cross_cache=${srcdir}/cross-build/cygwin.cache
86 cross_cache=${srcdir}/cross-build/mingw.cache
89 cross_cache=${srcdir}/cross-build/x86-beos.cache
91 *) echo "configure: cross-compiling for $host is not supported" >&2
94 if test -n "${cross_cache}" && test -r "${cross_cache}"; then
95 echo "loading cross-build cache file ${cross_cache}"
99 CROSS_COMPILE='-DCROSS_COMPILING'
100 AC_SUBST(CROSS_COMPILE)
104 echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
107 # We want these before the checks, so the checks can modify their values.
108 test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
115 dnl BEGIN changes for CYGNUS cross-building for Cygwin
116 dnl NOTE: Some of these changes may no longer be necessary.
118 dnl load up the cross-building cache file -- add more cases and cache
119 dnl files as necessary
120 if test "x$cross_compiling" = "xyes"; then
123 cross_cache=${srcdir}/cross-build/cygwin.cache
124 LOCAL_CFLAGS="$LOCAL_CFLAGS -I${srcdir}/../libtermcap"
127 cross_cache=${srcdir}/cross-build/mingw.cache
129 *) echo "configure: cross-compiling for a non-cygwin target is not supported" >&2
133 if test "x$cross_cache" != "x"; then
134 if test -r "${cross_cache}"; then
135 echo "loading cross-build cache file ${cross_cache}"
142 if test -z "$CC_FOR_BUILD"; then
143 if test "x$cross_compiling" = "xno"; then
149 AC_SUBST(CC_FOR_BUILD)
151 dnl END changes for CYGNUS cross-building for Cygwin
153 # If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
154 test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
156 AC_PROG_GCC_TRADITIONAL
158 AC_CHECK_PROG(AR, ar, , ar)
159 dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
160 dnl This allows people to set it when running configure or make
161 test -n "$ARFLAGS" || ARFLAGS="cr"
174 AC_CHECK_TYPE(ssize_t, int)
181 AC_CHECK_FUNCS(fcntl kill lstat)
182 AC_CHECK_FUNCS(memmove putenv select setenv setlocale \
183 strcasecmp strpbrk tcgetattr vsnprintf)
184 AC_CHECK_FUNCS(isascii isxdigit)
185 AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
189 AC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
190 limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h)
191 AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h)
193 AC_CHECK_HEADERS(sys/ptem.h,,,
195 #if HAVE_SYS_STREAM_H
196 # include <sys/stream.h>
200 BASH_SYS_SIGNAL_VINTAGE
201 BASH_SYS_REINSTALL_SIGHANDLERS
203 BASH_FUNC_POSIX_SETJMP
206 BASH_FUNC_CTYPE_NONASCII
208 BASH_CHECK_GETPW_FUNCS
217 BASH_STRUCT_DIRENT_D_INO
218 BASH_STRUCT_DIRENT_D_FILENO
222 aix*) prefer_curses=yes ;;
224 BASH_CHECK_LIB_TERMCAP
225 if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
226 if test "$prefer_curses" = yes; then
229 TERMCAP_LIB=-ltermcap #default
236 *cray*) LOCAL_CFLAGS=-DCRAY ;;
237 *s390*) LOCAL_CFLAGS=-fsigned-char ;;
241 isc*) LOCAL_CFLAGS=-Disc386 ;;
244 # shared library configuration section
246 # Shared object configuration section. These values are generated by
247 # ${srcdir}/support/shobj-conf
249 if test -f ${srcdir}/support/shobj-conf; then
250 AC_MSG_CHECKING(configuration for building shared libraries)
251 eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
253 # case "$SHLIB_LIBS" in
254 # *curses*|*termcap*|*termlib*) ;;
255 # *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
259 AC_SUBST(SHOBJ_CFLAGS)
261 AC_SUBST(SHOBJ_LDFLAGS)
262 AC_SUBST(SHOBJ_XLDFLAGS)
264 AC_SUBST(SHOBJ_STATUS)
265 AC_SUBST(SHLIB_STATUS)
266 AC_SUBST(SHLIB_XLDFLAGS)
268 AC_SUBST(SHLIB_LIBPREF)
269 AC_SUBST(SHLIB_LIBSUFF)
270 AC_SUBST(SHLIB_LIBVERSION)
271 AC_SUBST(SHLIB_DLLVERSION)
273 AC_MSG_RESULT($SHLIB_STATUS)
275 # SHLIB_STATUS is either `supported' or `unsupported'. If it's
276 # `unsupported', turn off any default shared library building
277 if test "$SHLIB_STATUS" = 'unsupported'; then
281 # shared library versioning
282 # quoted for m4 so I can use character classes
283 SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
284 SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
285 AC_SUBST(SHLIB_MAJOR)
286 AC_SUBST(SHLIB_MINOR)
289 if test "$opt_static_libs" = "yes"; then
291 STATIC_INSTALL_TARGET=install-static
293 if test "$opt_shared_libs" = "yes"; then
295 SHARED_INSTALL_TARGET=install-shared
298 AC_SUBST(STATIC_TARGET)
299 AC_SUBST(SHARED_TARGET)
300 AC_SUBST(STATIC_INSTALL_TARGET)
301 AC_SUBST(SHARED_INSTALL_TARGET)
304 msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
305 *) BUILD_DIR=`pwd` ;;
309 *\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
317 AC_SUBST(LOCAL_CFLAGS)
318 AC_SUBST(LOCAL_LDFLAGS)
329 AC_SUBST(TERMCAP_LIB)
331 AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile],
333 # Makefile uses this timestamp file to record whether config.h is up to date.