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 4.3, version 2.45, from autoconf version] AC_ACVERSION)
8
9AC_INIT(readline, 4.3, 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)
15dnl AC_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=4.3
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_static_libs=yes
35opt_shared_libs=no
36
37AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
38
39echo ""
40echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
41echo ""
42
43# We want these before the checks, so the checks can modify their values.
44test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
45
46AC_PROG_MAKE_SET
47AC_PROG_CC
48dnl AC_AIX
49AC_MINIX
50
51dnl BEGIN changes for CYGNUS cross-building for Cygwin
52
53dnl load up the cross-building cache file -- add more cases and cache
54dnl files as necessary
55if test "x$cross_compiling" = "xyes"; then
56    case "${host}" in
57    *-cygwin*)
58	cross_cache=${srcdir}/cross-build/cygwin.cache
59	if test -r "${cross_cache}"; then
60	    echo "loading cross-build cache file ${cross_cache}"
61	    . ${cross_cache}
62	fi
63	LOCAL_CFLAGS="$LOCAL_CFLAGS -I${srcdir}/../libtermcap"
64	unset cross_cache
65	;;
66    *)  echo "configure: cross-compiling for a non-cygwin target is not supported" >&2
67	;;
68    esac
69fi
70
71if test "x$cross_compiling" = "xyes"; then
72  CROSS_COMPILING_FLAG=-DCROSS_COMPILING
73else
74  CROSS_COMPILING_FLAG=
75fi
76AC_SUBST(CROSS_COMPILING_FLAG)
77
78if test -z "$CC_FOR_BUILD"; then
79    if test "x$cross_compiling" = "xno"; then
80        CC_FOR_BUILD='$(CC)'
81    else
82        CC_FOR_BUILD=gcc
83    fi
84fi
85AC_SUBST(CC_FOR_BUILD)
86
87dnl END changes for CYGNUS cross-building for Cygwin
88
89# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
90test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
91
92AC_PROG_GCC_TRADITIONAL
93AC_PROG_INSTALL
94AC_CHECK_PROG(AR, ar, , ar)
95dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
96dnl This allows people to set it when running configure or make
97test -n "$ARFLAGS" || ARFLAGS="cr"
98AC_PROG_RANLIB
99
100MAKE_SHELL=/bin/sh
101AC_SUBST(MAKE_SHELL)
102
103AC_C_CONST
104AC_C_PROTOTYPES
105AC_C_CHAR_UNSIGNED
106
107AC_TYPE_SIGNAL
108
109AC_TYPE_SIZE_T
110AC_CHECK_TYPE(ssize_t, int)
111
112AC_HEADER_STAT
113AC_HEADER_DIRENT
114
115AC_CHECK_FUNCS(lstat memmove putenv select setenv setlocale \
116		strcasecmp strpbrk tcgetattr vsnprintf isascii isxdigit)
117
118AC_FUNC_STRCOLL
119
120AC_CHECK_HEADERS(unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
121		limits.h sys/ptem.h sys/pte.h sys/stream.h sys/select.h \
122		termcap.h termios.h termio.h sys/file.h locale.h memory.h )
123
124BASH_SYS_SIGNAL_VINTAGE
125BASH_SYS_REINSTALL_SIGHANDLERS
126
127BASH_FUNC_POSIX_SETJMP
128BASH_FUNC_LSTAT
129BASH_FUNC_STRCOLL
130
131BASH_CHECK_GETPW_FUNCS
132
133AC_HEADER_TIOCGWINSZ
134
135BASH_TYPE_SIGHANDLER
136BASH_HAVE_TIOCSTAT
137BASH_HAVE_FIONREAD
138BASH_CHECK_SPEED_T
139BASH_STRUCT_WINSIZE
140BASH_STRUCT_DIRENT_D_INO
141BASH_STRUCT_DIRENT_D_FILENO
142
143dnl yuck
144case "$host_os" in
145aix*)   prefer_curses=yes ;;
146esac
147BASH_CHECK_LIB_TERMCAP
148if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
149	if test "$prefer_curses" = yes; then
150		TERMCAP_LIB=-lcurses
151	else
152		TERMCAP_LIB=-ltermcap	#default
153	fi
154fi
155
156BASH_CHECK_MULTIBYTE
157
158case "$host_cpu" in
159*cray*)	LOCAL_CFLAGS=-DCRAY ;;
160*s390*) LOCAL_CFLAGS=-fsigned-char ;;
161esac
162
163case "$host_os" in
164isc*)	LOCAL_CFLAGS=-Disc386 ;;
165esac
166
167# shared library configuration section
168#
169# Shared object configuration section.  These values are generated by
170# ${srcdir}/support/shobj-conf
171#
172if test -f ${srcdir}/support/shobj-conf; then
173        AC_MSG_CHECKING(configuration for building shared libraries)
174        eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
175        AC_SUBST(SHOBJ_CC)
176        AC_SUBST(SHOBJ_CFLAGS)
177        AC_SUBST(SHOBJ_LD)
178        AC_SUBST(SHOBJ_LDFLAGS)
179	AC_SUBST(SHOBJ_XLDFLAGS)
180        AC_SUBST(SHOBJ_LIBS)
181        AC_SUBST(SHOBJ_STATUS)
182	AC_SUBST(SHLIB_STATUS)
183	AC_SUBST(SHLIB_XLDFLAGS)
184	AC_SUBST(SHLIB_LIBSUFF)
185	AC_SUBST(SHLIB_LIBVERSION)
186	AC_SUBST(SHLIB_LIBS)
187        AC_MSG_RESULT($SHLIB_STATUS)
188
189	# SHLIB_STATUS is either `supported' or `unsupported'.  If it's
190	# `unsupported', turn off any default shared library building
191	if test "$SHLIB_STATUS" = 'unsupported'; then
192		opt_shared_libs=no
193	fi
194
195	# shared library versioning
196	# quoted for m4 so I can use character classes
197	SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
198	SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
199	AC_SUBST(SHLIB_MAJOR)
200	AC_SUBST(SHLIB_MINOR)
201fi
202
203if test "$opt_static_libs" = "yes"; then
204	STATIC_TARGET=static
205	STATIC_INSTALL_TARGET=install-static
206fi
207if test "$opt_shared_libs" = "yes"; then
208	SHARED_TARGET=shared
209	SHARED_INSTALL_TARGET=install-shared
210fi
211
212AC_SUBST(STATIC_TARGET)
213AC_SUBST(SHARED_TARGET)
214AC_SUBST(STATIC_INSTALL_TARGET)
215AC_SUBST(SHARED_INSTALL_TARGET)
216
217case "$host_os" in
218msdosdjgpp*)	BUILD_DIR=`pwd.exe` ;;	# to prevent //d/path/file
219*)		BUILD_DIR=`pwd` ;;
220esac
221
222AC_SUBST(BUILD_DIR)
223
224AC_SUBST(CFLAGS)
225AC_SUBST(LOCAL_CFLAGS)
226AC_SUBST(LOCAL_LDFLAGS)
227AC_SUBST(LOCAL_DEFS)
228
229AC_SUBST(AR)
230AC_SUBST(ARFLAGS)
231
232AC_SUBST(host_cpu)
233AC_SUBST(host_os)
234
235AC_SUBST(LIBVERSION)
236
237AC_SUBST(TERMCAP_LIB)
238
239AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile],
240[
241# Makefile uses this timestamp file to record whether config.h is up to date.
242echo > stamp-h
243])
244