Import readline 8.0
[deliverable/binutils-gdb.git] / readline / configure.ac
... / ...
CommitLineData
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
8# Copyright (C) 1987-2018 Free Software Foundation, Inc.
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
23AC_REVISION([for Readline 8.0, version 2.85])
24
25m4_include([../config/override.m4])
26
27AC_INIT(readline, 8.0, bug-readline@gnu.org)
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(`cd $srcdir;pwd`/..)
36AC_CONFIG_HEADERS(config.h)
37
38dnl update the value of RL_READLINE_VERSION in readline.h when this changes
39LIBVERSION=8.0
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
59
60AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
61dnl AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
62AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
63AC_ARG_ENABLE(install-examples, AC_HELP_STRING([--disable-install-examples], [don't install examples [[default=install]]]), opt_install_examples=$enableval)
64
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
75CROSS_COMPILE=
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
99echo ""
100echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
101echo ""
102
103# We want these before the checks, so the checks can modify their values.
104test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
105
106AC_PROG_MAKE_SET
107AC_PROG_CC
108dnl AC_AIX
109AC_MINIX
110
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
116AC_CHECK_TOOL(AR, ar)
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"
120AC_PROG_RANLIB
121
122MAKE_SHELL=/bin/sh
123AC_SUBST(MAKE_SHELL)
124
125AC_C_CONST
126AC_C_PROTOTYPES
127AC_C_CHAR_UNSIGNED
128AC_C_VOLATILE
129
130AC_TYPE_SIGNAL
131
132AC_TYPE_SIZE_T
133AC_CHECK_TYPE(ssize_t, int)
134
135AC_HEADER_STDC
136
137AC_HEADER_STAT
138AC_HEADER_DIRENT
139
140AC_CHECK_FUNCS(fcntl kill lstat readlink)
141AC_CHECK_FUNCS(fnmatch memmove pselect putenv select setenv setlocale \
142 strcasecmp strpbrk tcgetattr vsnprintf)
143AC_CHECK_FUNCS(isascii isxdigit)
144AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
145
146AC_FUNC_CHOWN
147AC_FUNC_STRCOLL
148
149AC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h varargs.h stdarg.h stdbool.h \
150 string.h strings.h \
151 limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h)
152AC_CHECK_HEADERS(sys/ioctl.h sys/pte.h sys/stream.h sys/select.h sys/file.h)
153
154AC_CHECK_HEADERS(sys/ptem.h,,,
155[[
156#if HAVE_SYS_STREAM_H
157# include <sys/stream.h>
158#endif
159]])
160
161AC_SYS_LARGEFILE
162
163BASH_SYS_SIGNAL_VINTAGE
164BASH_SYS_REINSTALL_SIGHANDLERS
165
166BASH_FUNC_POSIX_SETJMP
167BASH_FUNC_LSTAT
168BASH_FUNC_STRCOLL
169BASH_FUNC_CTYPE_NONASCII
170
171BASH_CHECK_GETPW_FUNCS
172
173AC_HEADER_TIOCGWINSZ
174
175BASH_TYPE_SIG_ATOMIC_T
176BASH_TYPE_SIGHANDLER
177
178BASH_HAVE_TIOCSTAT
179BASH_HAVE_FIONREAD
180BASH_CHECK_SPEED_T
181BASH_STRUCT_WINSIZE
182BASH_STRUCT_DIRENT_D_INO
183BASH_STRUCT_DIRENT_D_FILENO
184
185AC_CHECK_HEADERS(libaudit.h)
186AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
187
188dnl yuck
189case "$host_os" in
190aix*) prefer_curses=yes ;;
191esac
192BASH_CHECK_LIB_TERMCAP
193if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
194 if test "$prefer_curses" = yes; then
195 TERMCAP_LIB=-lcurses
196 else
197 TERMCAP_LIB=-ltermcap #default
198 fi
199fi
200# Windows ncurses installation
201if test "$TERMCAP_LIB" = "-lncurses"; then
202 AC_CHECK_HEADERS(ncurses/termcap.h)
203fi
204
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
213BASH_CHECK_MULTIBYTE
214
215case "$host_cpu" in
216*cray*) LOCAL_CFLAGS=-DCRAY ;;
217*s390*) LOCAL_CFLAGS=-fsigned-char ;;
218esac
219
220case "$host_os" in
221isc*) LOCAL_CFLAGS=-Disc386 ;;
222esac
223
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)
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
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)
247 AC_SUBST(SHLIB_DOT)
248 AC_SUBST(SHLIB_LIBPREF)
249 AC_SUBST(SHLIB_LIBSUFF)
250 AC_SUBST(SHLIB_LIBVERSION)
251 AC_SUBST(SHLIB_DLLVERSION)
252 AC_SUBST(SHLIB_LIBS)
253 AC_MSG_RESULT($SHLIB_STATUS)
254
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
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)
267fi
268
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
283if test "$opt_install_examples" = "yes"; then
284 EXAMPLES_INSTALL_TARGET=install-examples
285fi
286AC_SUBST(EXAMPLES_INSTALL_TARGET)
287
288case "$build_os" in
289msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
290*) BUILD_DIR=`pwd` ;;
291esac
292
293case "$BUILD_DIR" in
294*\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
295*) ;;
296esac
297
298AC_SUBST(BUILD_DIR)
299
300AC_SUBST(CFLAGS)
301AC_SUBST(LOCAL_CFLAGS)
302AC_SUBST(LOCAL_LDFLAGS)
303AC_SUBST(LOCAL_DEFS)
304
305AC_SUBST(AR)
306AC_SUBST(ARFLAGS)
307
308AC_SUBST(host_cpu)
309AC_SUBST(host_os)
310
311AC_SUBST(LIBVERSION)
312
313AC_SUBST(TERMCAP_LIB)
314AC_SUBST(TERMCAP_PKG_CONFIG_LIB)
315
316AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile readline.pc],
317[
318# Makefile uses this timestamp file to record whether config.h is up to date.
319echo > stamp-h
320])
This page took 0.024289 seconds and 4 git commands to generate.