Release 2.33.1
[external/binutils.git] / readline / configure.ac
1 dnl
2 dnl Configure script for readline library
3 dnl
4 dnl report bugs to chet@po.cwru.edu
5 dnl
6 dnl 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
23 AC_REVISION([for Readline 8.0, version 2.85])
24
25 m4_include([../config/override.m4])
26
27 AC_INIT(readline, 8.0, bug-readline@gnu.org)
28
29 dnl make sure we are using a recent autoconf version
30 AC_PREREQ(2.50)
31
32 AC_CONFIG_SRCDIR(readline.h)
33 dnl GDB LOCAL
34 dnl AC_CONFIG_AUX_DIR(./support)
35 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
36 AC_CONFIG_HEADERS(config.h)
37
38 dnl update the value of RL_READLINE_VERSION in readline.h when this changes
39 LIBVERSION=8.0
40
41 AC_CANONICAL_HOST
42 AC_CANONICAL_BUILD
43
44 dnl configure defaults
45 opt_curses=no
46
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)
49
50 if test "$opt_curses" = "yes"; then
51         prefer_curses=yes
52 fi
53
54 dnl option parsing for optional features
55 opt_multibyte=yes
56 opt_static_libs=yes
57 opt_shared_libs=no
58 opt_install_examples=no
59
60 AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
61 dnl AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
62 AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
63 AC_ARG_ENABLE(install-examples, AC_HELP_STRING([--disable-install-examples], [don't install examples [[default=install]]]), opt_install_examples=$enableval)
64
65 if test $opt_multibyte = no; then
66 AC_DEFINE(NO_MULTIBYTE_SUPPORT)
67 fi
68
69 dnl load up the cross-building cache file -- add more cases and cache
70 dnl files as necessary
71
72 dnl Note that host and target machine are the same, and different than the
73 dnl build machine.
74
75 CROSS_COMPILE=
76 if 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)
97 fi
98
99 echo ""
100 echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
101 echo ""
102
103 # We want these before the checks, so the checks can modify their values.
104 test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
105
106 AC_PROG_MAKE_SET
107 AC_PROG_CC
108 dnl AC_AIX
109 AC_MINIX
110
111 # If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
112 test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
113
114 AC_PROG_GCC_TRADITIONAL
115 AC_PROG_INSTALL
116 AC_CHECK_TOOL(AR, ar)
117 dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
118 dnl This allows people to set it when running configure or make
119 test -n "$ARFLAGS" || ARFLAGS="cr"
120 AC_PROG_RANLIB
121
122 MAKE_SHELL=/bin/sh
123 AC_SUBST(MAKE_SHELL)
124
125 AC_C_CONST
126 AC_C_PROTOTYPES
127 AC_C_CHAR_UNSIGNED
128 AC_C_VOLATILE
129
130 AC_TYPE_SIGNAL
131
132 AC_TYPE_SIZE_T
133 AC_CHECK_TYPE(ssize_t, int)
134
135 AC_HEADER_STDC
136
137 AC_HEADER_STAT
138 AC_HEADER_DIRENT
139
140 AC_CHECK_FUNCS(fcntl kill lstat readlink)
141 AC_CHECK_FUNCS(fnmatch memmove pselect putenv select setenv setlocale \
142                 strcasecmp strpbrk tcgetattr vsnprintf)
143 AC_CHECK_FUNCS(isascii isxdigit)
144 AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
145
146 AC_FUNC_CHOWN
147 AC_FUNC_STRCOLL
148
149 AC_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)
152 AC_CHECK_HEADERS(sys/ioctl.h sys/pte.h sys/stream.h sys/select.h sys/file.h)
153
154 AC_CHECK_HEADERS(sys/ptem.h,,,
155 [[
156 #if HAVE_SYS_STREAM_H
157 #  include <sys/stream.h>
158 #endif
159 ]])
160
161 AC_SYS_LARGEFILE
162
163 BASH_SYS_SIGNAL_VINTAGE
164 BASH_SYS_REINSTALL_SIGHANDLERS
165
166 BASH_FUNC_POSIX_SETJMP
167 BASH_FUNC_LSTAT
168 BASH_FUNC_STRCOLL
169 BASH_FUNC_CTYPE_NONASCII
170
171 BASH_CHECK_GETPW_FUNCS
172
173 AC_HEADER_TIOCGWINSZ
174
175 BASH_TYPE_SIG_ATOMIC_T
176 BASH_TYPE_SIGHANDLER
177
178 BASH_HAVE_TIOCSTAT
179 BASH_HAVE_FIONREAD
180 BASH_CHECK_SPEED_T
181 BASH_STRUCT_WINSIZE
182 BASH_STRUCT_DIRENT_D_INO
183 BASH_STRUCT_DIRENT_D_FILENO
184
185 AC_CHECK_HEADERS(libaudit.h)
186 AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]])
187
188 dnl yuck
189 case "$host_os" in
190 aix*)   prefer_curses=yes ;;
191 esac
192 BASH_CHECK_LIB_TERMCAP
193 if 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
199 fi
200 # Windows ncurses installation
201 if test "$TERMCAP_LIB" = "-lncurses"; then
202         AC_CHECK_HEADERS(ncurses/termcap.h)
203 fi
204
205 case "$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 ;;
211 esac
212
213 BASH_CHECK_MULTIBYTE
214
215 case "$host_cpu" in
216 *cray*) LOCAL_CFLAGS=-DCRAY ;;
217 *s390*) LOCAL_CFLAGS=-fsigned-char ;;
218 esac
219
220 case "$host_os" in
221 isc*)   LOCAL_CFLAGS=-Disc386 ;;
222 esac
223
224 # shared library configuration section
225 #
226 # Shared object configuration section.  These values are generated by
227 # ${srcdir}/support/shobj-conf
228 #
229 if 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)
267 fi
268
269 if test "$opt_static_libs" = "yes"; then
270         STATIC_TARGET=static
271         STATIC_INSTALL_TARGET=install-static
272 fi
273 if test "$opt_shared_libs" = "yes"; then
274         SHARED_TARGET=shared
275         SHARED_INSTALL_TARGET=install-shared
276 fi
277
278 AC_SUBST(STATIC_TARGET)
279 AC_SUBST(SHARED_TARGET)
280 AC_SUBST(STATIC_INSTALL_TARGET)
281 AC_SUBST(SHARED_INSTALL_TARGET)
282
283 if test "$opt_install_examples" = "yes"; then
284         EXAMPLES_INSTALL_TARGET=install-examples
285 fi
286 AC_SUBST(EXAMPLES_INSTALL_TARGET)
287
288 case "$build_os" in
289 msdosdjgpp*)    BUILD_DIR=`pwd.exe` ;;  # to prevent //d/path/file
290 *)              BUILD_DIR=`pwd` ;;
291 esac
292
293 case "$BUILD_DIR" in
294 *\ *)   BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
295 *)      ;;
296 esac
297
298 AC_SUBST(BUILD_DIR)
299
300 AC_SUBST(CFLAGS)
301 AC_SUBST(LOCAL_CFLAGS)
302 AC_SUBST(LOCAL_LDFLAGS)
303 AC_SUBST(LOCAL_DEFS)
304
305 AC_SUBST(AR)
306 AC_SUBST(ARFLAGS)
307
308 AC_SUBST(host_cpu)
309 AC_SUBST(host_os)
310
311 AC_SUBST(LIBVERSION)
312
313 AC_SUBST(TERMCAP_LIB)
314 AC_SUBST(TERMCAP_PKG_CONFIG_LIB)
315
316 AC_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.
319 echo > stamp-h
320 ])