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-2016 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 3 of the License, or
13 # (at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
23 AC_REVISION([for Readline 7.0, version 2.81])
25 m4_include([../config/override.m4])
27 AC_INIT(readline, 7.0, 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
44 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)
50 if test "$opt_curses" = "yes"; then
54 dnl option parsing for optional features
59 AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
60 dnl AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
61 AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
63 if test $opt_multibyte = no; then
64 AC_DEFINE(NO_MULTIBYTE_SUPPORT)
67 dnl load up the cross-building cache file -- add more cases and cache
68 dnl files as necessary
70 dnl Note that host and target machine are the same, and different than the
74 if test "x$cross_compiling" = "xyes"; then
77 cross_cache=${srcdir}/cross-build/cygwin.cache
80 cross_cache=${srcdir}/cross-build/mingw.cache
83 cross_cache=${srcdir}/cross-build/x86-beos.cache
85 *) echo "configure: cross-compiling for $host is not supported" >&2
88 if test -n "${cross_cache}" && test -r "${cross_cache}"; then
89 echo "loading cross-build cache file ${cross_cache}"
93 CROSS_COMPILE='-DCROSS_COMPILING'
94 AC_SUBST(CROSS_COMPILE)
98 echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
101 # We want these before the checks, so the checks can modify their values.
102 test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
109 # If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
110 test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
112 AC_PROG_GCC_TRADITIONAL
114 AC_CHECK_TOOL(AR, ar)
115 dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
116 dnl This allows people to set it when running configure or make
117 test -n "$ARFLAGS" || ARFLAGS="cr"
131 AC_CHECK_TYPE(ssize_t, int)
138 AC_CHECK_FUNCS(fcntl kill lstat readlink)
139 AC_CHECK_FUNCS(memmove pselect putenv select setenv setlocale \
140 strcasecmp strpbrk tcgetattr vsnprintf)
141 AC_CHECK_FUNCS(isascii isxdigit)
142 AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
147 AC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h varargs.h stdarg.h stdbool.h \
149 limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h)
150 AC_CHECK_HEADERS(sys/ioctl.h sys/pte.h sys/stream.h sys/select.h sys/file.h)
152 AC_CHECK_HEADERS(sys/ptem.h,,,
154 #if HAVE_SYS_STREAM_H
155 # include <sys/stream.h>
161 BASH_SYS_SIGNAL_VINTAGE
162 BASH_SYS_REINSTALL_SIGHANDLERS
164 BASH_FUNC_POSIX_SETJMP
167 BASH_FUNC_CTYPE_NONASCII
169 BASH_CHECK_GETPW_FUNCS
173 BASH_TYPE_SIG_ATOMIC_T
180 BASH_STRUCT_DIRENT_D_INO
181 BASH_STRUCT_DIRENT_D_FILENO
183 AC_CHECK_HEADERS(libaudit.h)
184 AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
188 aix*) prefer_curses=yes ;;
190 BASH_CHECK_LIB_TERMCAP
191 if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
192 if test "$prefer_curses" = yes; then
195 TERMCAP_LIB=-ltermcap #default
198 # Windows ncurses installation
199 if test "$TERMCAP_LIB" = "-lncurses"; then
200 AC_CHECK_HEADERS(ncurses/termcap.h)
206 *cray*) LOCAL_CFLAGS=-DCRAY ;;
207 *s390*) LOCAL_CFLAGS=-fsigned-char ;;
211 isc*) LOCAL_CFLAGS=-Disc386 ;;
214 # shared library configuration section
216 # Shared object configuration section. These values are generated by
217 # ${srcdir}/support/shobj-conf
219 if test -f ${srcdir}/support/shobj-conf; then
220 AC_MSG_CHECKING(configuration for building shared libraries)
221 eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
223 # case "$SHLIB_LIBS" in
224 # *curses*|*termcap*|*termlib*) ;;
225 # *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
229 AC_SUBST(SHOBJ_CFLAGS)
231 AC_SUBST(SHOBJ_LDFLAGS)
232 AC_SUBST(SHOBJ_XLDFLAGS)
234 AC_SUBST(SHOBJ_STATUS)
235 AC_SUBST(SHLIB_STATUS)
236 AC_SUBST(SHLIB_XLDFLAGS)
238 AC_SUBST(SHLIB_LIBPREF)
239 AC_SUBST(SHLIB_LIBSUFF)
240 AC_SUBST(SHLIB_LIBVERSION)
241 AC_SUBST(SHLIB_DLLVERSION)
243 AC_MSG_RESULT($SHLIB_STATUS)
245 # SHLIB_STATUS is either `supported' or `unsupported'. If it's
246 # `unsupported', turn off any default shared library building
247 if test "$SHLIB_STATUS" = 'unsupported'; then
251 # shared library versioning
252 # quoted for m4 so I can use character classes
253 SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
254 SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
255 AC_SUBST(SHLIB_MAJOR)
256 AC_SUBST(SHLIB_MINOR)
259 if test "$opt_static_libs" = "yes"; then
261 STATIC_INSTALL_TARGET=install-static
263 if test "$opt_shared_libs" = "yes"; then
265 SHARED_INSTALL_TARGET=install-shared
268 AC_SUBST(STATIC_TARGET)
269 AC_SUBST(SHARED_TARGET)
270 AC_SUBST(STATIC_INSTALL_TARGET)
271 AC_SUBST(SHARED_INSTALL_TARGET)
274 msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
275 *) BUILD_DIR=`pwd` ;;
279 *\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
286 AC_SUBST(LOCAL_CFLAGS)
287 AC_SUBST(LOCAL_LDFLAGS)
298 AC_SUBST(TERMCAP_LIB)
300 AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile readline.pc],
302 # Makefile uses this timestamp file to record whether config.h is up to date.