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