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
25165670SacheAC_REVISION([for Readline 5.2, version 2.61])
26157184Sache
27165670SacheAC_INIT(readline, 5.2, 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
37165670SacheLIBVERSION=5.2
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
78165670SacheCROSS_COMPILE=
79157184Sacheif test "x$cross_compiling" = "xyes"; then
80157184Sache    case "${host}" in
81157184Sache    *-cygwin*)
82157184Sache        cross_cache=${srcdir}/cross-build/cygwin.cache
83157184Sache        ;;
84157184Sache    *-mingw*)
85157184Sache        cross_cache=${srcdir}/cross-build/mingw.cache
86157184Sache        ;;
87157184Sache    i[[3456]]86-*-beos*)
88157184Sache        cross_cache=${srcdir}/cross-build/x86-beos.cache
89157184Sache        ;;
90157184Sache    *)  echo "configure: cross-compiling for $host is not supported" >&2
91157184Sache        ;;
92157184Sache    esac
93157184Sache    if test -n "${cross_cache}" && test -r "${cross_cache}"; then
94157184Sache        echo "loading cross-build cache file ${cross_cache}"
95157184Sache        . ${cross_cache}
96157184Sache    fi
97157184Sache    unset cross_cache
98157184Sache    CROSS_COMPILE='-DCROSS_COMPILING'
99157184Sache    AC_SUBST(CROSS_COMPILE)
100157184Sachefi
101157184Sache
102119610Sacheecho ""
103119610Sacheecho "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
104119610Sacheecho ""
105119610Sache
10626497Sache# We want these before the checks, so the checks can modify their values.
10726497Sachetest -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
10826497Sache
10975406SacheAC_PROG_MAKE_SET
11026497SacheAC_PROG_CC
11158310Sachednl AC_AIX
11235486SacheAC_MINIX
11326497Sache
11426497Sache# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
11526497Sachetest -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
11626497Sache
11726497SacheAC_PROG_GCC_TRADITIONAL
11826497SacheAC_PROG_INSTALL
119119610SacheAC_CHECK_PROG(AR, ar, , ar)
12047558Sachednl Set default for ARFLAGS, since autoconf does not have a macro for it.
12147558Sachednl This allows people to set it when running configure or make
12247558Sachetest -n "$ARFLAGS" || ARFLAGS="cr"
12326497SacheAC_PROG_RANLIB
12426497Sache
12547558SacheMAKE_SHELL=/bin/sh
12647558SacheAC_SUBST(MAKE_SHELL)
12747558Sache
128119610SacheAC_C_CONST
129119610SacheAC_C_PROTOTYPES
130119610SacheAC_C_CHAR_UNSIGNED
13126497Sache
132119610SacheAC_TYPE_SIGNAL
133119610Sache
134119610SacheAC_TYPE_SIZE_T
135119610SacheAC_CHECK_TYPE(ssize_t, int)
136119610Sache
137136644SacheAC_HEADER_STDC
138136644Sache
13926497SacheAC_HEADER_STAT
14026497SacheAC_HEADER_DIRENT
14126497Sache
142157184SacheAC_CHECK_FUNCS(fcntl kill lstat)
143157184SacheAC_CHECK_FUNCS(memmove putenv select setenv setlocale \
144157184Sache		strcasecmp strpbrk tcgetattr vsnprintf)
145157184SacheAC_CHECK_FUNCS(isascii isxdigit)
146157184SacheAC_CHECK_FUNCS(getpwent getpwnam getpwuid)
14726497Sache
14826497SacheAC_FUNC_STRCOLL
14926497Sache
150157184SacheAC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
151157184Sache		limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h)
152157184SacheAC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h)
15326497Sache
154157184SacheAC_CHECK_HEADERS(sys/ptem.h,,,
155157184Sache[[
156157184Sache#if HAVE_SYS_STREAM_H
157157184Sache#  include <sys/stream.h>
158157184Sache#endif
159157184Sache]])
160157184Sache
161119610SacheBASH_SYS_SIGNAL_VINTAGE
162119610SacheBASH_SYS_REINSTALL_SIGHANDLERS
16326497Sache
16426497SacheBASH_FUNC_POSIX_SETJMP
16526497SacheBASH_FUNC_LSTAT
16626497SacheBASH_FUNC_STRCOLL
167136644SacheBASH_FUNC_CTYPE_NONASCII
16826497Sache
169119610SacheBASH_CHECK_GETPW_FUNCS
170119610Sache
171119610SacheAC_HEADER_TIOCGWINSZ
172119610Sache
17326497SacheBASH_TYPE_SIGHANDLER
17426497SacheBASH_HAVE_TIOCSTAT
17526497SacheBASH_HAVE_FIONREAD
176119610SacheBASH_CHECK_SPEED_T
17735486SacheBASH_STRUCT_WINSIZE
17826497SacheBASH_STRUCT_DIRENT_D_INO
17926497SacheBASH_STRUCT_DIRENT_D_FILENO
18026497Sache
18135486Sachednl yuck
18235486Sachecase "$host_os" in
18335486Sacheaix*)   prefer_curses=yes ;;
18435486Sacheesac
18535486SacheBASH_CHECK_LIB_TERMCAP
18635486Sacheif test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
187119610Sache	if test "$prefer_curses" = yes; then
188119610Sache		TERMCAP_LIB=-lcurses
189119610Sache	else
190119610Sache		TERMCAP_LIB=-ltermcap	#default
191119610Sache	fi
19235486Sachefi
19335486Sache
194119610SacheBASH_CHECK_MULTIBYTE
195119610Sache
19626497Sachecase "$host_cpu" in
19726497Sache*cray*)	LOCAL_CFLAGS=-DCRAY ;;
19875406Sache*s390*) LOCAL_CFLAGS=-fsigned-char ;;
19926497Sacheesac
20026497Sache
20126497Sachecase "$host_os" in
20226497Sacheisc*)	LOCAL_CFLAGS=-Disc386 ;;
20326497Sacheesac
20426497Sache
20547558Sache# shared library configuration section
20647558Sache#
20747558Sache# Shared object configuration section.  These values are generated by
20847558Sache# ${srcdir}/support/shobj-conf
20947558Sache#
21047558Sacheif test -f ${srcdir}/support/shobj-conf; then
21147558Sache        AC_MSG_CHECKING(configuration for building shared libraries)
212157184Sache        eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
213157184Sache
214157184Sache#	case "$SHLIB_LIBS" in
215157184Sache#	*curses*|*termcap*|*termlib*)	;;
216157184Sache#	*)			SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
217157184Sache#	esac
218157184Sache	
21947558Sache        AC_SUBST(SHOBJ_CC)
22047558Sache        AC_SUBST(SHOBJ_CFLAGS)
22147558Sache        AC_SUBST(SHOBJ_LD)
22247558Sache        AC_SUBST(SHOBJ_LDFLAGS)
22347558Sache	AC_SUBST(SHOBJ_XLDFLAGS)
22447558Sache        AC_SUBST(SHOBJ_LIBS)
22547558Sache        AC_SUBST(SHOBJ_STATUS)
22647558Sache	AC_SUBST(SHLIB_STATUS)
22747558Sache	AC_SUBST(SHLIB_XLDFLAGS)
228157184Sache	AC_SUBST(SHLIB_DOT)
229157184Sache	AC_SUBST(SHLIB_LIBPREF)
23047558Sache	AC_SUBST(SHLIB_LIBSUFF)
23147558Sache	AC_SUBST(SHLIB_LIBVERSION)
232157184Sache	AC_SUBST(SHLIB_DLLVERSION)
23347558Sache	AC_SUBST(SHLIB_LIBS)
23447558Sache        AC_MSG_RESULT($SHLIB_STATUS)
23558310Sache
236119610Sache	# SHLIB_STATUS is either `supported' or `unsupported'.  If it's
237119610Sache	# `unsupported', turn off any default shared library building
238119610Sache	if test "$SHLIB_STATUS" = 'unsupported'; then
239119610Sache		opt_shared_libs=no
240119610Sache	fi
241119610Sache
24258310Sache	# shared library versioning
24358310Sache	# quoted for m4 so I can use character classes
24458310Sache	SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
24558310Sache	SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
24658310Sache	AC_SUBST(SHLIB_MAJOR)
24758310Sache	AC_SUBST(SHLIB_MINOR)
24847558Sachefi
24947558Sache
250119610Sacheif test "$opt_static_libs" = "yes"; then
251119610Sache	STATIC_TARGET=static
252119610Sache	STATIC_INSTALL_TARGET=install-static
253119610Sachefi
254119610Sacheif test "$opt_shared_libs" = "yes"; then
255119610Sache	SHARED_TARGET=shared
256119610Sache	SHARED_INSTALL_TARGET=install-shared
257119610Sachefi
258119610Sache
259119610SacheAC_SUBST(STATIC_TARGET)
260119610SacheAC_SUBST(SHARED_TARGET)
261119610SacheAC_SUBST(STATIC_INSTALL_TARGET)
262119610SacheAC_SUBST(SHARED_INSTALL_TARGET)
263119610Sache
26458310Sachecase "$host_os" in
26558310Sachemsdosdjgpp*)	BUILD_DIR=`pwd.exe` ;;	# to prevent //d/path/file
26658310Sache*)		BUILD_DIR=`pwd` ;;
26758310Sacheesac
26858310Sache
269157184Sachecase "$BUILD_DIR" in
270157184Sache*\ *)	BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;;
271157184Sache*)	;;
272157184Sacheesac
273157184Sache
274157184SacheAC_SUBST(PURIFY)
27535486SacheAC_SUBST(BUILD_DIR)
27635486Sache
27726497SacheAC_SUBST(CFLAGS)
27826497SacheAC_SUBST(LOCAL_CFLAGS)
27935486SacheAC_SUBST(LOCAL_LDFLAGS)
28026497SacheAC_SUBST(LOCAL_DEFS)
28126497Sache
28247558SacheAC_SUBST(AR)
28347558SacheAC_SUBST(ARFLAGS)
28447558Sache
28526497SacheAC_SUBST(host_cpu)
28626497SacheAC_SUBST(host_os)
28726497Sache
28826497SacheAC_SUBST(LIBVERSION)
28926497Sache
29035486SacheAC_SUBST(TERMCAP_LIB)
29135486Sache
29247558SacheAC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile],
29326497Sache[
29426497Sache# Makefile uses this timestamp file to record whether config.h is up to date.
29526497Sacheecho > stamp-h
29626497Sache])
297