configure.in revision 136644
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.
7AC_REVISION([for Readline 5.0, version 2.52, from autoconf version] AC_ACVERSION)
8
9AC_INIT(readline, 5.0-rc1, bug-readline@gnu.org)
10
11dnl make sure we are using a recent autoconf version
12AC_PREREQ(2.50)
13
14AC_CONFIG_SRCDIR(readline.h)
15AC_CONFIG_AUX_DIR(./support)
16AC_CONFIG_HEADERS(config.h)
17
18dnl update the value of RL_READLINE_VERSION in readline.h when this changes
19LIBVERSION=5.0
20
21AC_CANONICAL_HOST
22
23dnl configure defaults
24opt_curses=no
25
26dnl arguments to configure
27AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
28
29if test "$opt_curses" = "yes"; then
30	prefer_curses=yes
31fi
32
33dnl option parsing for optional features
34opt_multibyte=yes
35opt_static_libs=yes
36opt_shared_libs=yes
37
38AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
39AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
40AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
41
42if test $opt_multibyte = no; then
43AC_DEFINE(NO_MULTIBYTE_SUPPORT)
44fi
45
46echo ""
47echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
48echo ""
49
50# We want these before the checks, so the checks can modify their values.
51test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
52
53AC_PROG_MAKE_SET
54AC_PROG_CC
55dnl AC_AIX
56AC_MINIX
57
58# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
59test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
60
61AC_PROG_GCC_TRADITIONAL
62AC_PROG_INSTALL
63AC_CHECK_PROG(AR, ar, , ar)
64dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
65dnl This allows people to set it when running configure or make
66test -n "$ARFLAGS" || ARFLAGS="cr"
67AC_PROG_RANLIB
68
69MAKE_SHELL=/bin/sh
70AC_SUBST(MAKE_SHELL)
71
72AC_C_CONST
73AC_C_PROTOTYPES
74AC_C_CHAR_UNSIGNED
75
76AC_TYPE_SIGNAL
77
78AC_TYPE_SIZE_T
79AC_CHECK_TYPE(ssize_t, int)
80
81AC_HEADER_STDC
82
83AC_HEADER_STAT
84AC_HEADER_DIRENT
85
86AC_CHECK_FUNCS(lstat memmove putenv select setenv setlocale \
87		strcasecmp strpbrk tcgetattr vsnprintf isascii isxdigit)
88
89AC_FUNC_STRCOLL
90
91AC_CHECK_HEADERS(unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
92		limits.h sys/ptem.h sys/pte.h sys/stream.h sys/select.h \
93		termcap.h termios.h termio.h sys/file.h locale.h memory.h )
94
95BASH_SYS_SIGNAL_VINTAGE
96BASH_SYS_REINSTALL_SIGHANDLERS
97
98BASH_FUNC_POSIX_SETJMP
99BASH_FUNC_LSTAT
100BASH_FUNC_STRCOLL
101BASH_FUNC_CTYPE_NONASCII
102
103BASH_CHECK_GETPW_FUNCS
104
105AC_HEADER_TIOCGWINSZ
106
107BASH_TYPE_SIGHANDLER
108BASH_HAVE_TIOCSTAT
109BASH_HAVE_FIONREAD
110BASH_CHECK_SPEED_T
111BASH_STRUCT_WINSIZE
112BASH_STRUCT_DIRENT_D_INO
113BASH_STRUCT_DIRENT_D_FILENO
114
115dnl yuck
116case "$host_os" in
117aix*)   prefer_curses=yes ;;
118esac
119BASH_CHECK_LIB_TERMCAP
120if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
121	if test "$prefer_curses" = yes; then
122		TERMCAP_LIB=-lcurses
123	else
124		TERMCAP_LIB=-ltermcap	#default
125	fi
126fi
127
128BASH_CHECK_MULTIBYTE
129
130case "$host_cpu" in
131*cray*)	LOCAL_CFLAGS=-DCRAY ;;
132*s390*) LOCAL_CFLAGS=-fsigned-char ;;
133esac
134
135case "$host_os" in
136isc*)	LOCAL_CFLAGS=-Disc386 ;;
137esac
138
139# shared library configuration section
140#
141# Shared object configuration section.  These values are generated by
142# ${srcdir}/support/shobj-conf
143#
144if test -f ${srcdir}/support/shobj-conf; then
145        AC_MSG_CHECKING(configuration for building shared libraries)
146        eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
147        AC_SUBST(SHOBJ_CC)
148        AC_SUBST(SHOBJ_CFLAGS)
149        AC_SUBST(SHOBJ_LD)
150        AC_SUBST(SHOBJ_LDFLAGS)
151	AC_SUBST(SHOBJ_XLDFLAGS)
152        AC_SUBST(SHOBJ_LIBS)
153        AC_SUBST(SHOBJ_STATUS)
154	AC_SUBST(SHLIB_STATUS)
155	AC_SUBST(SHLIB_XLDFLAGS)
156	AC_SUBST(SHLIB_LIBSUFF)
157	AC_SUBST(SHLIB_LIBVERSION)
158	AC_SUBST(SHLIB_LIBS)
159        AC_MSG_RESULT($SHLIB_STATUS)
160
161	# SHLIB_STATUS is either `supported' or `unsupported'.  If it's
162	# `unsupported', turn off any default shared library building
163	if test "$SHLIB_STATUS" = 'unsupported'; then
164		opt_shared_libs=no
165	fi
166
167	# shared library versioning
168	# quoted for m4 so I can use character classes
169	SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
170	SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
171	AC_SUBST(SHLIB_MAJOR)
172	AC_SUBST(SHLIB_MINOR)
173fi
174
175if test "$opt_static_libs" = "yes"; then
176	STATIC_TARGET=static
177	STATIC_INSTALL_TARGET=install-static
178fi
179if test "$opt_shared_libs" = "yes"; then
180	SHARED_TARGET=shared
181	SHARED_INSTALL_TARGET=install-shared
182fi
183
184AC_SUBST(STATIC_TARGET)
185AC_SUBST(SHARED_TARGET)
186AC_SUBST(STATIC_INSTALL_TARGET)
187AC_SUBST(SHARED_INSTALL_TARGET)
188
189case "$host_os" in
190msdosdjgpp*)	BUILD_DIR=`pwd.exe` ;;	# to prevent //d/path/file
191*)		BUILD_DIR=`pwd` ;;
192esac
193
194AC_SUBST(BUILD_DIR)
195
196AC_SUBST(CFLAGS)
197AC_SUBST(LOCAL_CFLAGS)
198AC_SUBST(LOCAL_LDFLAGS)
199AC_SUBST(LOCAL_DEFS)
200
201AC_SUBST(AR)
202AC_SUBST(ARFLAGS)
203
204AC_SUBST(host_cpu)
205AC_SUBST(host_os)
206
207AC_SUBST(LIBVERSION)
208
209AC_SUBST(TERMCAP_LIB)
210
211AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile],
212[
213# Makefile uses this timestamp file to record whether config.h is up to date.
214echo > stamp-h
215])
216