configure.in revision 157184
126497Sachednl
226497Sachednl Configure script for readline library
326497Sachednl
426497Sachednl report bugs to chet@po.cwru.edu
526497Sachednl
626497Sachednl Process this file with autoconf to produce a configure script.
726497Sache
8157184Sache# Copyright (C) 1987-2005 Free Software Foundation, Inc.
926497Sache
10157184Sache# This program is free software; you can redistribute it and/or modify
11157184Sache# it under the terms of the GNU General Public License as published by
12157184Sache# the Free Software Foundation; either version 2, or (at your option)
13157184Sache# any later version.
14157184Sache
15157184Sache# This program is distributed in the hope that it will be useful,
16157184Sache# but WITHOUT ANY WARRANTY; without even the implied warranty of
17157184Sache# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18157184Sache# GNU General Public License for more details.
19157184Sache
20157184Sache# You should have received a copy of the GNU General Public License
21157184Sache# along with this program; if not, write to the Free Software
22157184Sache# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23157184Sache# 02111-1307, USA.
24157184Sache
25157184SacheAC_REVISION([for Readline 5.1, version 2.59])
26157184Sache
27157184SacheAC_INIT(readline, 5.1-release, bug-readline@gnu.org)
28157184Sache
2926497Sachednl make sure we are using a recent autoconf version
30119610SacheAC_PREREQ(2.50)
3126497Sache
32119610SacheAC_CONFIG_SRCDIR(readline.h)
3326497SacheAC_CONFIG_AUX_DIR(./support)
34119610SacheAC_CONFIG_HEADERS(config.h)
3526497Sache
36119610Sachednl update the value of RL_READLINE_VERSION in readline.h when this changes
37157184SacheLIBVERSION=5.1
38119610Sache
3926497SacheAC_CANONICAL_HOST
4026497Sache
4135486Sachednl configure defaults
4235486Sacheopt_curses=no
43157184Sacheopt_purify=no
4435486Sache
4535486Sachednl arguments to configure
46119610SacheAC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
47157184SacheAC_ARG_WITH(purify, AC_HELP_STRING([--with-purify], [configure to postprocess with purify]), opt_purify=$withval)
4835486Sache
4935486Sacheif test "$opt_curses" = "yes"; then
5035486Sache	prefer_curses=yes
5135486Sachefi
5235486Sache
53157184Sacheif test "$opt_purify" = yes; then
54157184Sache	PURIFY="purify"
55157184Sacheelse
56157184Sache	PURIFY=
57157184Sachefi
58157184Sache
59119610Sachednl option parsing for optional features
60136644Sacheopt_multibyte=yes
61119610Sacheopt_static_libs=yes
62119610Sacheopt_shared_libs=yes
63119610Sache
64136644SacheAC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
65119610SacheAC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
66119610SacheAC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
67119610Sache
68136644Sacheif test $opt_multibyte = no; then
69136644SacheAC_DEFINE(NO_MULTIBYTE_SUPPORT)
70136644Sachefi
71136644Sache
72157184Sachednl load up the cross-building cache file -- add more cases and cache
73157184Sachednl files as necessary
74157184Sache
75157184Sachednl Note that host and target machine are the same, and different than the
76157184Sachednl build machine.
77157184Sache
78157184Sacheif test "x$cross_compiling" = "xyes"; then
79157184Sache    case "${host}" in
80157184Sache    *-cygwin*)
81157184Sache        cross_cache=${srcdir}/cross-build/cygwin.cache
82157184Sache        ;;
83157184Sache    *-mingw*)
84157184Sache        cross_cache=${srcdir}/cross-build/mingw.cache
85157184Sache        ;;
86157184Sache    i[[3456]]86-*-beos*)
87157184Sache        cross_cache=${srcdir}/cross-build/x86-beos.cache
88157184Sache        ;;
89157184Sache    *)  echo "configure: cross-compiling for $host is not supported" >&2
90157184Sache        ;;
91157184Sache    esac
92157184Sache    if test -n "${cross_cache}" && test -r "${cross_cache}"; then
93157184Sache        echo "loading cross-build cache file ${cross_cache}"
94157184Sache        . ${cross_cache}
95157184Sache    fi
96157184Sache    unset cross_cache
97157184Sache    CROSS_COMPILE='-DCROSS_COMPILING'
98157184Sache    AC_SUBST(CROSS_COMPILE)
99157184Sachefi
100157184Sache
101119610Sacheecho ""
102119610Sacheecho "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
103119610Sacheecho ""
104119610Sache
10526497Sache# We want these before the checks, so the checks can modify their values.
10626497Sachetest -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
10726497Sache
10875406SacheAC_PROG_MAKE_SET
10926497SacheAC_PROG_CC
11058310Sachednl AC_AIX
11135486SacheAC_MINIX
11226497Sache
11326497Sache# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
11426497Sachetest -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
11526497Sache
11626497SacheAC_PROG_GCC_TRADITIONAL
11726497SacheAC_PROG_INSTALL
118119610SacheAC_CHECK_PROG(AR, ar, , ar)
11947558Sachednl Set default for ARFLAGS, since autoconf does not have a macro for it.
12047558Sachednl This allows people to set it when running configure or make
12147558Sachetest -n "$ARFLAGS" || ARFLAGS="cr"
12226497SacheAC_PROG_RANLIB
12326497Sache
12447558SacheMAKE_SHELL=/bin/sh
12547558SacheAC_SUBST(MAKE_SHELL)
12647558Sache
127119610SacheAC_C_CONST
128119610SacheAC_C_PROTOTYPES
129119610SacheAC_C_CHAR_UNSIGNED
13026497Sache
131119610SacheAC_TYPE_SIGNAL
132119610Sache
133119610SacheAC_TYPE_SIZE_T
134119610SacheAC_CHECK_TYPE(ssize_t, int)
135119610Sache
136136644SacheAC_HEADER_STDC
137136644Sache
13826497SacheAC_HEADER_STAT
13926497SacheAC_HEADER_DIRENT
14026497Sache
141157184SacheAC_CHECK_FUNCS(fcntl kill lstat)
142157184SacheAC_CHECK_FUNCS(memmove putenv select setenv setlocale \
143157184Sache		strcasecmp strpbrk tcgetattr vsnprintf)
144157184SacheAC_CHECK_FUNCS(isascii isxdigit)
145157184SacheAC_CHECK_FUNCS(getpwent getpwnam getpwuid)
14626497Sache
14726497SacheAC_FUNC_STRCOLL
14826497Sache
149157184SacheAC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
150157184Sache		limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h)
151157184SacheAC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h)
15226497Sache
153157184SacheAC_CHECK_HEADERS(sys/ptem.h,,,
154157184Sache[[
155157184Sache#if HAVE_SYS_STREAM_H
156157184Sache#  include <sys/stream.h>
157157184Sache#endif
158157184Sache]])
159157184Sache
160119610SacheBASH_SYS_SIGNAL_VINTAGE
161119610SacheBASH_SYS_REINSTALL_SIGHANDLERS
16226497Sache
16326497SacheBASH_FUNC_POSIX_SETJMP
16426497SacheBASH_FUNC_LSTAT
16526497SacheBASH_FUNC_STRCOLL
166136644SacheBASH_FUNC_CTYPE_NONASCII
16726497Sache
168119610SacheBASH_CHECK_GETPW_FUNCS
169119610Sache
170119610SacheAC_HEADER_TIOCGWINSZ
171119610Sache
17226497SacheBASH_TYPE_SIGHANDLER
17326497SacheBASH_HAVE_TIOCSTAT
17426497SacheBASH_HAVE_FIONREAD
175119610SacheBASH_CHECK_SPEED_T
17635486SacheBASH_STRUCT_WINSIZE
17726497SacheBASH_STRUCT_DIRENT_D_INO
17826497SacheBASH_STRUCT_DIRENT_D_FILENO
17926497Sache
18035486Sachednl yuck
18135486Sachecase "$host_os" in
18235486Sacheaix*)   prefer_curses=yes ;;
18335486Sacheesac
18435486SacheBASH_CHECK_LIB_TERMCAP
18535486Sacheif test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
186119610Sache	if test "$prefer_curses" = yes; then
187119610Sache		TERMCAP_LIB=-lcurses
188119610Sache	else
189119610Sache		TERMCAP_LIB=-ltermcap	#default
190119610Sache	fi
19135486Sachefi
19235486Sache
193119610SacheBASH_CHECK_MULTIBYTE
194119610Sache
19526497Sachecase "$host_cpu" in
19626497Sache*cray*)	LOCAL_CFLAGS=-DCRAY ;;
19775406Sache*s390*) LOCAL_CFLAGS=-fsigned-char ;;
19826497Sacheesac
19926497Sache
20026497Sachecase "$host_os" in
20126497Sacheisc*)	LOCAL_CFLAGS=-Disc386 ;;
20226497Sacheesac
20326497Sache
20447558Sache# shared library configuration section
20547558Sache#
20647558Sache# Shared object configuration section.  These values are generated by
20747558Sache# ${srcdir}/support/shobj-conf
20847558Sache#
20947558Sacheif test -f ${srcdir}/support/shobj-conf; then
21047558Sache        AC_MSG_CHECKING(configuration for building shared libraries)
211157184Sache        eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
212157184Sache
213157184Sache#	case "$SHLIB_LIBS" in
214157184Sache#	*curses*|*termcap*|*termlib*)	;;
215157184Sache#	*)			SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
216157184Sache#	esac
217157184Sache	
21847558Sache        AC_SUBST(SHOBJ_CC)
21947558Sache        AC_SUBST(SHOBJ_CFLAGS)
22047558Sache        AC_SUBST(SHOBJ_LD)
22147558Sache        AC_SUBST(SHOBJ_LDFLAGS)
22247558Sache	AC_SUBST(SHOBJ_XLDFLAGS)
22347558Sache        AC_SUBST(SHOBJ_LIBS)
22447558Sache        AC_SUBST(SHOBJ_STATUS)
22547558Sache	AC_SUBST(SHLIB_STATUS)
22647558Sache	AC_SUBST(SHLIB_XLDFLAGS)
227157184Sache	AC_SUBST(SHLIB_DOT)
228157184Sache	AC_SUBST(SHLIB_LIBPREF)
22947558Sache	AC_SUBST(SHLIB_LIBSUFF)
23047558Sache	AC_SUBST(SHLIB_LIBVERSION)
231157184Sache	AC_SUBST(SHLIB_DLLVERSION)
23247558Sache	AC_SUBST(SHLIB_LIBS)
23347558Sache        AC_MSG_RESULT($SHLIB_STATUS)
23458310Sache
235119610Sache	# SHLIB_STATUS is either `supported' or `unsupported'.  If it's
236119610Sache	# `unsupported', turn off any default shared library building
237119610Sache	if test "$SHLIB_STATUS" = 'unsupported'; then
238119610Sache		opt_shared_libs=no
239119610Sache	fi
240119610Sache
24158310Sache	# shared library versioning
24258310Sache	# quoted for m4 so I can use character classes
24358310Sache	SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
24458310Sache	SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
24558310Sache	AC_SUBST(SHLIB_MAJOR)
24658310Sache	AC_SUBST(SHLIB_MINOR)
24747558Sachefi
24847558Sache
249119610Sacheif test "$opt_static_libs" = "yes"; then
250119610Sache	STATIC_TARGET=static
251119610Sache	STATIC_INSTALL_TARGET=install-static
252119610Sachefi
253119610Sacheif test "$opt_shared_libs" = "yes"; then
254119610Sache	SHARED_TARGET=shared
255119610Sache	SHARED_INSTALL_TARGET=install-shared
256119610Sachefi
257119610Sache
258119610SacheAC_SUBST(STATIC_TARGET)
259119610SacheAC_SUBST(SHARED_TARGET)
260119610SacheAC_SUBST(STATIC_INSTALL_TARGET)
261119610SacheAC_SUBST(SHARED_INSTALL_TARGET)
262119610Sache
26358310Sachecase "$host_os" in
26458310Sachemsdosdjgpp*)	BUILD_DIR=`pwd.exe` ;;	# to prevent //d/path/file
26558310Sache*)		BUILD_DIR=`pwd` ;;
26658310Sacheesac
26758310Sache
268157184Sachecase "$BUILD_DIR" in
269157184Sache*\ *)	BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
270157184Sache*)	;;
271157184Sacheesac
272157184Sache
273157184SacheAC_SUBST(PURIFY)
27435486SacheAC_SUBST(BUILD_DIR)
27535486Sache
27626497SacheAC_SUBST(CFLAGS)
27726497SacheAC_SUBST(LOCAL_CFLAGS)
27835486SacheAC_SUBST(LOCAL_LDFLAGS)
27926497SacheAC_SUBST(LOCAL_DEFS)
28026497Sache
28147558SacheAC_SUBST(AR)
28247558SacheAC_SUBST(ARFLAGS)
28347558Sache
28426497SacheAC_SUBST(host_cpu)
28526497SacheAC_SUBST(host_os)
28626497Sache
28726497SacheAC_SUBST(LIBVERSION)
28826497Sache
28935486SacheAC_SUBST(TERMCAP_LIB)
29035486Sache
29147558SacheAC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile],
29226497Sache[
29326497Sache# Makefile uses this timestamp file to record whether config.h is up to date.
29426497Sacheecho > stamp-h
29526497Sache])
296