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-2020 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 8.1, version 2.90])
25 m4_include([../../config/override.m4])
27 AC_INIT(readline, 8.1, 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(../..)
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
58 opt_install_examples=no
59 opt_bracketed_paste_default=yes
61 AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
62 dnl AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
63 AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
64 AC_ARG_ENABLE(install-examples, AC_HELP_STRING([--disable-install-examples], [don't install examples [[default=install]]]), opt_install_examples=$enableval)
66 AC_ARG_ENABLE(bracketed-paste-default, AC_HELP_STRING([--disable-bracketed-paste-default], [disable bracketed paste by default [[default=enable]]]), opt_bracketed_paste_default=$enableval)
68 if test $opt_multibyte = no; then
69 AC_DEFINE(NO_MULTIBYTE_SUPPORT)
72 if test $opt_bracketed_paste_default = yes; then
73 BRACKETED_PASTE='-DBRACKETED_PASTE_DEFAULT=1'
75 BRACKETED_PASTE='-DBRACKETED_PASTE_DEFAULT=0'
77 AC_SUBST(BRACKETED_PASTE)
79 dnl load up the cross-building cache file -- add more cases and cache
80 dnl files as necessary
82 dnl Note that host and target machine are the same, and different than the
86 if test "x$cross_compiling" = "xyes"; then
89 cross_cache=${srcdir}/cross-build/cygwin.cache
92 cross_cache=${srcdir}/cross-build/mingw.cache
95 cross_cache=${srcdir}/cross-build/x86-beos.cache
97 *) echo "configure: cross-compiling for $host is not supported" >&2
100 if test -n "${cross_cache}" && test -r "${cross_cache}"; then
101 echo "loading cross-build cache file ${cross_cache}"
105 CROSS_COMPILE='-DCROSS_COMPILING'
106 AC_SUBST(CROSS_COMPILE)
110 echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
113 # We want these before the checks, so the checks can modify their values.
114 test -z "$CFLAGS" && want_auto_cflags=1
121 # If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS
122 if test -n "$want_auto_cflags" ; then
123 AUTO_CFLAGS="-g ${GCC+-O2}"
124 STYLE_CFLAGS="${GCC+-Wno-parentheses} ${GCC+-Wno-format-security}"
127 AC_PROG_GCC_TRADITIONAL
129 AC_CHECK_TOOL(AR, ar)
130 dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
131 dnl This allows people to set it when running configure or make
132 test -n "$ARFLAGS" || ARFLAGS="cr"
146 AC_CHECK_TYPE(ssize_t, int)
153 AC_CHECK_FUNCS(fcntl kill lstat readlink)
154 AC_CHECK_FUNCS(fnmatch memmove pselect putenv select setenv setlocale \
155 strcasecmp strpbrk tcgetattr vsnprintf)
156 AC_CHECK_FUNCS(isascii isxdigit)
157 AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
162 AC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h varargs.h stdarg.h stdbool.h \
164 limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h)
165 AC_CHECK_HEADERS(sys/ioctl.h sys/pte.h sys/stream.h sys/select.h sys/file.h)
167 AC_CHECK_HEADERS(sys/ptem.h,,,
169 #if HAVE_SYS_STREAM_H
170 # include <sys/stream.h>
176 BASH_SYS_SIGNAL_VINTAGE
177 BASH_SYS_REINSTALL_SIGHANDLERS
179 BASH_FUNC_POSIX_SETJMP
182 BASH_FUNC_CTYPE_NONASCII
184 BASH_CHECK_GETPW_FUNCS
188 BASH_TYPE_SIG_ATOMIC_T
195 BASH_STRUCT_DIRENT_D_INO
196 BASH_STRUCT_DIRENT_D_FILENO
198 AC_CHECK_HEADERS(libaudit.h)
199 AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
203 aix*) prefer_curses=yes ;;
205 BASH_CHECK_LIB_TERMCAP
206 if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
207 if test "$prefer_curses" = yes; then
210 TERMCAP_LIB=-ltermcap #default
213 # Windows ncurses installation
214 if test "$TERMCAP_LIB" = "-lncurses"; then
215 AC_CHECK_HEADERS(ncurses/termcap.h)
218 case "$TERMCAP_LIB" in
219 -ltinfo) TERMCAP_PKG_CONFIG_LIB=tinfo ;;
220 -lcurses) TERMCAP_PKG_CONFIG_LIB=ncurses ;;
221 -lncurses) TERMCAP_PKG_CONFIG_LIB=ncurses ;;
222 -ltermcap) TERMCAP_PKG_CONFIG_LIB=termcap ;;
223 *) TERMCAP_PKG_CONFIG_LIB=termcap ;;
229 *cray*) LOCAL_CFLAGS=-DCRAY ;;
230 *s390*) LOCAL_CFLAGS=-fsigned-char ;;
234 isc*) LOCAL_CFLAGS=-Disc386 ;;
235 hpux*) LOCAL_CFLAGS="-DTGETENT_BROKEN -DTGETFLAG_BROKEN" ;;
238 # shared library configuration section
240 # Shared object configuration section. These values are generated by
241 # ${srcdir}/support/shobj-conf
243 if test -f ${srcdir}/support/shobj-conf; then
244 AC_MSG_CHECKING(configuration for building shared libraries)
245 eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
247 # case "$SHLIB_LIBS" in
248 # *curses*|*termcap*|*termlib*) ;;
249 # *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
253 AC_SUBST(SHOBJ_CFLAGS)
255 AC_SUBST(SHOBJ_LDFLAGS)
256 AC_SUBST(SHOBJ_XLDFLAGS)
258 AC_SUBST(SHOBJ_STATUS)
259 AC_SUBST(SHLIB_STATUS)
260 AC_SUBST(SHLIB_XLDFLAGS)
262 AC_SUBST(SHLIB_LIBPREF)
263 AC_SUBST(SHLIB_LIBSUFF)
264 AC_SUBST(SHLIB_LIBVERSION)
265 AC_SUBST(SHLIB_DLLVERSION)
267 AC_MSG_RESULT($SHLIB_STATUS)
269 # SHLIB_STATUS is either `supported' or `unsupported'. If it's
270 # `unsupported', turn off any default shared library building
271 if test "$SHLIB_STATUS" = 'unsupported'; then
275 # shared library versioning
276 # quoted for m4 so I can use character classes
277 SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
278 SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
279 AC_SUBST(SHLIB_MAJOR)
280 AC_SUBST(SHLIB_MINOR)
283 if test "$opt_static_libs" = "yes"; then
285 STATIC_INSTALL_TARGET=install-static
287 if test "$opt_shared_libs" = "yes"; then
289 SHARED_INSTALL_TARGET=install-shared
292 AC_SUBST(STATIC_TARGET)
293 AC_SUBST(SHARED_TARGET)
294 AC_SUBST(STATIC_INSTALL_TARGET)
295 AC_SUBST(SHARED_INSTALL_TARGET)
297 if test "$opt_install_examples" = "yes"; then
298 EXAMPLES_INSTALL_TARGET=install-examples
300 AC_SUBST(EXAMPLES_INSTALL_TARGET)
303 msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
304 *) BUILD_DIR=`pwd` ;;
308 *\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
314 if test -n "$want_auto_cflags"; then
315 CFLAGS="$AUTO_CFLAGS"
317 CFLAGS="$CFLAGS $STYLE_CFLAGS"
320 AC_SUBST(LOCAL_CFLAGS)
321 AC_SUBST(LOCAL_LDFLAGS)
332 AC_SUBST(TERMCAP_LIB)
333 AC_SUBST(TERMCAP_PKG_CONFIG_LIB)
335 AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile readline.pc],
337 # Makefile uses this timestamp file to record whether config.h is up to date.