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