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