Import GNU Readline 8.1
[deliverable/binutils-gdb.git] / readline / readline / configure.ac
CommitLineData
6999161a
TT
1dnl
2dnl Configure script for readline library
3dnl
4dnl report bugs to chet@po.cwru.edu
5dnl
6dnl Process this file with autoconf to produce a configure script.
7
b4f26d54 8# Copyright (C) 1987-2020 Free Software Foundation, Inc.
6999161a
TT
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 3 of the License, or
13# (at your option) 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, see <http://www.gnu.org/licenses/>.
22
b4f26d54 23AC_REVISION([for Readline 8.1, version 2.90])
6999161a
TT
24
25m4_include([../../config/override.m4])
26
b4f26d54 27AC_INIT(readline, 8.1, bug-readline@gnu.org)
6999161a
TT
28
29dnl make sure we are using a recent autoconf version
30AC_PREREQ(2.50)
31
32AC_CONFIG_SRCDIR(readline.h)
33dnl GDB LOCAL
34dnl AC_CONFIG_AUX_DIR(./support)
35AC_CONFIG_AUX_DIR(../..)
36AC_CONFIG_HEADERS(config.h)
37
38dnl update the value of RL_READLINE_VERSION in readline.h when this changes
b4f26d54 39LIBVERSION=8.1
6999161a
TT
40
41AC_CANONICAL_HOST
42AC_CANONICAL_BUILD
43
44dnl configure defaults
45opt_curses=no
46
47dnl arguments to configure
48AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
49
50if test "$opt_curses" = "yes"; then
51 prefer_curses=yes
52fi
53
54dnl option parsing for optional features
55opt_multibyte=yes
56opt_static_libs=yes
57opt_shared_libs=no
58opt_install_examples=no
b4f26d54 59opt_bracketed_paste_default=yes
6999161a
TT
60
61AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
62dnl AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
63AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
64AC_ARG_ENABLE(install-examples, AC_HELP_STRING([--disable-install-examples], [don't install examples [[default=install]]]), opt_install_examples=$enableval)
65
b4f26d54
TT
66AC_ARG_ENABLE(bracketed-paste-default, AC_HELP_STRING([--disable-bracketed-paste-default], [disable bracketed paste by default [[default=enable]]]), opt_bracketed_paste_default=$enableval)
67
6999161a
TT
68if test $opt_multibyte = no; then
69AC_DEFINE(NO_MULTIBYTE_SUPPORT)
70fi
71
b4f26d54
TT
72if test $opt_bracketed_paste_default = yes; then
73 BRACKETED_PASTE='-DBRACKETED_PASTE_DEFAULT=1'
74else
75 BRACKETED_PASTE='-DBRACKETED_PASTE_DEFAULT=0'
76fi
77AC_SUBST(BRACKETED_PASTE)
78
6999161a
TT
79dnl load up the cross-building cache file -- add more cases and cache
80dnl files as necessary
81
82dnl Note that host and target machine are the same, and different than the
83dnl build machine.
84
85CROSS_COMPILE=
86if test "x$cross_compiling" = "xyes"; then
87 case "${host}" in
88 *-cygwin*)
89 cross_cache=${srcdir}/cross-build/cygwin.cache
90 ;;
91 *-mingw*)
92 cross_cache=${srcdir}/cross-build/mingw.cache
93 ;;
94 i[[3456]]86-*-beos*)
95 cross_cache=${srcdir}/cross-build/x86-beos.cache
96 ;;
97 *) echo "configure: cross-compiling for $host is not supported" >&2
98 ;;
99 esac
100 if test -n "${cross_cache}" && test -r "${cross_cache}"; then
101 echo "loading cross-build cache file ${cross_cache}"
102 . ${cross_cache}
103 fi
104 unset cross_cache
105 CROSS_COMPILE='-DCROSS_COMPILING'
106 AC_SUBST(CROSS_COMPILE)
107fi
108
109echo ""
110echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
111echo ""
112
113# We want these before the checks, so the checks can modify their values.
b4f26d54 114test -z "$CFLAGS" && want_auto_cflags=1
6999161a
TT
115
116AC_PROG_MAKE_SET
117AC_PROG_CC
118dnl AC_AIX
119AC_MINIX
120
b4f26d54
TT
121# If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS
122if test -n "$want_auto_cflags" ; then
123 AUTO_CFLAGS="-g ${GCC+-O2}"
124 STYLE_CFLAGS="${GCC+-Wno-parentheses} ${GCC+-Wno-format-security}"
125fi
6999161a
TT
126
127AC_PROG_GCC_TRADITIONAL
128AC_PROG_INSTALL
129AC_CHECK_TOOL(AR, ar)
130dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
131dnl This allows people to set it when running configure or make
132test -n "$ARFLAGS" || ARFLAGS="cr"
133AC_PROG_RANLIB
134
135MAKE_SHELL=/bin/sh
136AC_SUBST(MAKE_SHELL)
137
138AC_C_CONST
139AC_C_PROTOTYPES
140AC_C_CHAR_UNSIGNED
141AC_C_VOLATILE
142
143AC_TYPE_SIGNAL
144
145AC_TYPE_SIZE_T
146AC_CHECK_TYPE(ssize_t, int)
147
148AC_HEADER_STDC
149
150AC_HEADER_STAT
151AC_HEADER_DIRENT
152
153AC_CHECK_FUNCS(fcntl kill lstat readlink)
154AC_CHECK_FUNCS(fnmatch memmove pselect putenv select setenv setlocale \
155 strcasecmp strpbrk tcgetattr vsnprintf)
156AC_CHECK_FUNCS(isascii isxdigit)
157AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
158
159AC_FUNC_CHOWN
160AC_FUNC_STRCOLL
161
162AC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h varargs.h stdarg.h stdbool.h \
163 string.h strings.h \
164 limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h)
165AC_CHECK_HEADERS(sys/ioctl.h sys/pte.h sys/stream.h sys/select.h sys/file.h)
166
167AC_CHECK_HEADERS(sys/ptem.h,,,
168[[
169#if HAVE_SYS_STREAM_H
170# include <sys/stream.h>
171#endif
172]])
173
174AC_SYS_LARGEFILE
175
176BASH_SYS_SIGNAL_VINTAGE
177BASH_SYS_REINSTALL_SIGHANDLERS
178
179BASH_FUNC_POSIX_SETJMP
180BASH_FUNC_LSTAT
181BASH_FUNC_STRCOLL
182BASH_FUNC_CTYPE_NONASCII
183
184BASH_CHECK_GETPW_FUNCS
185
186AC_HEADER_TIOCGWINSZ
187
188BASH_TYPE_SIG_ATOMIC_T
189BASH_TYPE_SIGHANDLER
190
191BASH_HAVE_TIOCSTAT
192BASH_HAVE_FIONREAD
193BASH_CHECK_SPEED_T
194BASH_STRUCT_WINSIZE
195BASH_STRUCT_DIRENT_D_INO
196BASH_STRUCT_DIRENT_D_FILENO
197
198AC_CHECK_HEADERS(libaudit.h)
199AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
200
201dnl yuck
202case "$host_os" in
203aix*) prefer_curses=yes ;;
204esac
205BASH_CHECK_LIB_TERMCAP
206if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
207 if test "$prefer_curses" = yes; then
208 TERMCAP_LIB=-lcurses
209 else
210 TERMCAP_LIB=-ltermcap #default
211 fi
212fi
213# Windows ncurses installation
214if test "$TERMCAP_LIB" = "-lncurses"; then
215 AC_CHECK_HEADERS(ncurses/termcap.h)
216fi
217
218case "$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 ;;
224esac
225
226BASH_CHECK_MULTIBYTE
227
228case "$host_cpu" in
229*cray*) LOCAL_CFLAGS=-DCRAY ;;
230*s390*) LOCAL_CFLAGS=-fsigned-char ;;
231esac
232
233case "$host_os" in
234isc*) LOCAL_CFLAGS=-Disc386 ;;
b4f26d54 235hpux*) LOCAL_CFLAGS="-DTGETENT_BROKEN -DTGETFLAG_BROKEN" ;;
6999161a
TT
236esac
237
238# shared library configuration section
239#
240# Shared object configuration section. These values are generated by
241# ${srcdir}/support/shobj-conf
242#
243if 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}`
246
247# case "$SHLIB_LIBS" in
248# *curses*|*termcap*|*termlib*) ;;
249# *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
250# esac
251
252 AC_SUBST(SHOBJ_CC)
253 AC_SUBST(SHOBJ_CFLAGS)
254 AC_SUBST(SHOBJ_LD)
255 AC_SUBST(SHOBJ_LDFLAGS)
256 AC_SUBST(SHOBJ_XLDFLAGS)
257 AC_SUBST(SHOBJ_LIBS)
258 AC_SUBST(SHOBJ_STATUS)
259 AC_SUBST(SHLIB_STATUS)
260 AC_SUBST(SHLIB_XLDFLAGS)
261 AC_SUBST(SHLIB_DOT)
262 AC_SUBST(SHLIB_LIBPREF)
263 AC_SUBST(SHLIB_LIBSUFF)
264 AC_SUBST(SHLIB_LIBVERSION)
265 AC_SUBST(SHLIB_DLLVERSION)
266 AC_SUBST(SHLIB_LIBS)
267 AC_MSG_RESULT($SHLIB_STATUS)
268
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
272 opt_shared_libs=no
273 fi
274
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)
281fi
282
283if test "$opt_static_libs" = "yes"; then
284 STATIC_TARGET=static
285 STATIC_INSTALL_TARGET=install-static
286fi
287if test "$opt_shared_libs" = "yes"; then
288 SHARED_TARGET=shared
289 SHARED_INSTALL_TARGET=install-shared
290fi
291
292AC_SUBST(STATIC_TARGET)
293AC_SUBST(SHARED_TARGET)
294AC_SUBST(STATIC_INSTALL_TARGET)
295AC_SUBST(SHARED_INSTALL_TARGET)
296
297if test "$opt_install_examples" = "yes"; then
298 EXAMPLES_INSTALL_TARGET=install-examples
299fi
300AC_SUBST(EXAMPLES_INSTALL_TARGET)
301
302case "$build_os" in
303msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
304*) BUILD_DIR=`pwd` ;;
305esac
306
307case "$BUILD_DIR" in
308*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
309*) ;;
310esac
311
312AC_SUBST(BUILD_DIR)
313
b4f26d54
TT
314if test -n "$want_auto_cflags"; then
315 CFLAGS="$AUTO_CFLAGS"
316fi
317CFLAGS="$CFLAGS $STYLE_CFLAGS"
318
6999161a
TT
319AC_SUBST(CFLAGS)
320AC_SUBST(LOCAL_CFLAGS)
321AC_SUBST(LOCAL_LDFLAGS)
322AC_SUBST(LOCAL_DEFS)
323
324AC_SUBST(AR)
325AC_SUBST(ARFLAGS)
326
327AC_SUBST(host_cpu)
328AC_SUBST(host_os)
329
330AC_SUBST(LIBVERSION)
331
332AC_SUBST(TERMCAP_LIB)
333AC_SUBST(TERMCAP_PKG_CONFIG_LIB)
334
335AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile readline.pc],
336[
337# Makefile uses this timestamp file to record whether config.h is up to date.
338echo > stamp-h
339])
This page took 0.162463 seconds and 4 git commands to generate.