Commit | Line | Data |
---|---|---|
d60d9f65 SS |
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. | |
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 | 23 | AC_REVISION([for Readline 8.0, version 2.85]) |
5bdf8622 | 24 | |
5836a818 PP |
25 | m4_include([../config/override.m4]) |
26 | ||
cb41b9e7 | 27 | AC_INIT(readline, 8.0, bug-readline@gnu.org) |
d60d9f65 SS |
28 | |
29 | dnl make sure we are using a recent autoconf version | |
9255ee31 | 30 | AC_PREREQ(2.50) |
d60d9f65 | 31 | |
9255ee31 | 32 | AC_CONFIG_SRCDIR(readline.h) |
5836a818 PP |
33 | dnl GDB LOCAL |
34 | dnl AC_CONFIG_AUX_DIR(./support) | |
35 | AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) | |
9255ee31 EZ |
36 | AC_CONFIG_HEADERS(config.h) |
37 | ||
38 | dnl update the value of RL_READLINE_VERSION in readline.h when this changes | |
cb41b9e7 | 39 | LIBVERSION=8.0 |
d60d9f65 SS |
40 | |
41 | AC_CANONICAL_HOST | |
19ce2a29 | 42 | AC_CANONICAL_BUILD |
d60d9f65 SS |
43 | |
44 | dnl configure defaults | |
45 | opt_curses=no | |
d60d9f65 SS |
46 | |
47 | dnl arguments to configure | |
9255ee31 | 48 | AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval) |
d60d9f65 SS |
49 | |
50 | if test "$opt_curses" = "yes"; then | |
51 | prefer_curses=yes | |
52 | fi | |
53 | ||
9255ee31 | 54 | dnl option parsing for optional features |
5bdf8622 | 55 | opt_multibyte=yes |
9255ee31 | 56 | opt_static_libs=yes |
b558ff04 | 57 | opt_shared_libs=no |
cb41b9e7 | 58 | opt_install_examples=no |
9255ee31 | 59 | |
5bdf8622 | 60 | AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval) |
5836a818 | 61 | dnl AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval) |
9255ee31 | 62 | AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval) |
cb41b9e7 | 63 | AC_ARG_ENABLE(install-examples, AC_HELP_STRING([--disable-install-examples], [don't install examples [[default=install]]]), opt_install_examples=$enableval) |
9255ee31 | 64 | |
5bdf8622 DJ |
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 | ||
eeab5adb | 75 | CROSS_COMPILE= |
5bdf8622 DJ |
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 | ||
9255ee31 EZ |
99 | echo "" |
100 | echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}" | |
101 | echo "" | |
102 | ||
d60d9f65 SS |
103 | # We want these before the checks, so the checks can modify their values. |
104 | test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1 | |
105 | ||
9255ee31 | 106 | AC_PROG_MAKE_SET |
d60d9f65 | 107 | AC_PROG_CC |
1b17e766 | 108 | dnl AC_AIX |
d60d9f65 SS |
109 | AC_MINIX |
110 | ||
d60d9f65 SS |
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 | |
775e241e | 116 | AC_CHECK_TOOL(AR, ar) |
c862e87b JM |
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" | |
d60d9f65 SS |
120 | AC_PROG_RANLIB |
121 | ||
c862e87b JM |
122 | MAKE_SHELL=/bin/sh |
123 | AC_SUBST(MAKE_SHELL) | |
124 | ||
9255ee31 EZ |
125 | AC_C_CONST |
126 | AC_C_PROTOTYPES | |
127 | AC_C_CHAR_UNSIGNED | |
cc88a640 | 128 | AC_C_VOLATILE |
9255ee31 EZ |
129 | |
130 | AC_TYPE_SIGNAL | |
131 | ||
132 | AC_TYPE_SIZE_T | |
133 | AC_CHECK_TYPE(ssize_t, int) | |
d60d9f65 | 134 | |
5bdf8622 DJ |
135 | AC_HEADER_STDC |
136 | ||
d60d9f65 SS |
137 | AC_HEADER_STAT |
138 | AC_HEADER_DIRENT | |
139 | ||
775e241e | 140 | AC_CHECK_FUNCS(fcntl kill lstat readlink) |
cb41b9e7 | 141 | AC_CHECK_FUNCS(fnmatch memmove pselect putenv select setenv setlocale \ |
5bdf8622 DJ |
142 | strcasecmp strpbrk tcgetattr vsnprintf) |
143 | AC_CHECK_FUNCS(isascii isxdigit) | |
144 | AC_CHECK_FUNCS(getpwent getpwnam getpwuid) | |
d60d9f65 | 145 | |
775e241e | 146 | AC_FUNC_CHOWN |
d60d9f65 SS |
147 | AC_FUNC_STRCOLL |
148 | ||
775e241e TT |
149 | AC_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 | 152 | AC_CHECK_HEADERS(sys/ioctl.h sys/pte.h sys/stream.h sys/select.h sys/file.h) |
5bdf8622 DJ |
153 | |
154 | AC_CHECK_HEADERS(sys/ptem.h,,, | |
155 | [[ | |
156 | #if HAVE_SYS_STREAM_H | |
157 | # include <sys/stream.h> | |
158 | #endif | |
159 | ]]) | |
d60d9f65 | 160 | |
cc88a640 JK |
161 | AC_SYS_LARGEFILE |
162 | ||
9255ee31 EZ |
163 | BASH_SYS_SIGNAL_VINTAGE |
164 | BASH_SYS_REINSTALL_SIGHANDLERS | |
d60d9f65 SS |
165 | |
166 | BASH_FUNC_POSIX_SETJMP | |
167 | BASH_FUNC_LSTAT | |
d60d9f65 | 168 | BASH_FUNC_STRCOLL |
5bdf8622 | 169 | BASH_FUNC_CTYPE_NONASCII |
d60d9f65 | 170 | |
9255ee31 EZ |
171 | BASH_CHECK_GETPW_FUNCS |
172 | ||
173 | AC_HEADER_TIOCGWINSZ | |
174 | ||
cc88a640 | 175 | BASH_TYPE_SIG_ATOMIC_T |
d60d9f65 | 176 | BASH_TYPE_SIGHANDLER |
cc88a640 | 177 | |
d60d9f65 SS |
178 | BASH_HAVE_TIOCSTAT |
179 | BASH_HAVE_FIONREAD | |
9255ee31 | 180 | BASH_CHECK_SPEED_T |
d60d9f65 SS |
181 | BASH_STRUCT_WINSIZE |
182 | BASH_STRUCT_DIRENT_D_INO | |
183 | BASH_STRUCT_DIRENT_D_FILENO | |
184 | ||
775e241e TT |
185 | AC_CHECK_HEADERS(libaudit.h) |
186 | AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]]) | |
187 | ||
d60d9f65 SS |
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 | |
9255ee31 EZ |
194 | if test "$prefer_curses" = yes; then |
195 | TERMCAP_LIB=-lcurses | |
196 | else | |
197 | TERMCAP_LIB=-ltermcap #default | |
198 | fi | |
d60d9f65 | 199 | fi |
775e241e | 200 | # Windows ncurses installation |
7f3c5ec8 EZ |
201 | if test "$TERMCAP_LIB" = "-lncurses"; then |
202 | AC_CHECK_HEADERS(ncurses/termcap.h) | |
203 | fi | |
d60d9f65 | 204 | |
cb41b9e7 TT |
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 | ||
9255ee31 EZ |
213 | BASH_CHECK_MULTIBYTE |
214 | ||
d60d9f65 SS |
215 | case "$host_cpu" in |
216 | *cray*) LOCAL_CFLAGS=-DCRAY ;; | |
9255ee31 | 217 | *s390*) LOCAL_CFLAGS=-fsigned-char ;; |
d60d9f65 SS |
218 | esac |
219 | ||
220 | case "$host_os" in | |
221 | isc*) LOCAL_CFLAGS=-Disc386 ;; | |
222 | esac | |
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 | # | |
229 | if 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 |
267 | fi |
268 | ||
9255ee31 EZ |
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 | ||
cb41b9e7 TT |
283 | if test "$opt_install_examples" = "yes"; then |
284 | EXAMPLES_INSTALL_TARGET=install-examples | |
285 | fi | |
286 | AC_SUBST(EXAMPLES_INSTALL_TARGET) | |
287 | ||
19ce2a29 | 288 | case "$build_os" in |
1b17e766 EZ |
289 | msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file |
290 | *) BUILD_DIR=`pwd` ;; | |
291 | esac | |
292 | ||
5bdf8622 DJ |
293 | case "$BUILD_DIR" in |
294 | *\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;; | |
295 | *) ;; | |
296 | esac | |
297 | ||
d60d9f65 SS |
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 | ||
c862e87b JM |
305 | AC_SUBST(AR) |
306 | AC_SUBST(ARFLAGS) | |
307 | ||
d60d9f65 SS |
308 | AC_SUBST(host_cpu) |
309 | AC_SUBST(host_os) | |
310 | ||
311 | AC_SUBST(LIBVERSION) | |
312 | ||
313 | AC_SUBST(TERMCAP_LIB) | |
cb41b9e7 | 314 | AC_SUBST(TERMCAP_PKG_CONFIG_LIB) |
d60d9f65 | 315 | |
775e241e | 316 | AC_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. | |
319 | echo > stamp-h | |
320 | ]) |