Rewritten the readline test, hopefully it's okay now.
This commit is contained in:
parent
591bbb1572
commit
8c4ed9ae5d
87
configure.in
87
configure.in
@ -243,38 +243,67 @@ AC_MSG_RESULT($withval)
|
|||||||
LIBS="$withval $LIBS"
|
LIBS="$withval $LIBS"
|
||||||
], AC_MSG_RESULT(no))
|
], AC_MSG_RESULT(no))
|
||||||
|
|
||||||
AC_MSG_CHECKING(for --with-readline)
|
AC_MSG_CHECKING(for --with(out)-readline)
|
||||||
AC_ARG_WITH(readline, [--with-readline[=DIRECTORY] use GNU readline library], [
|
use_readline="yes"
|
||||||
AC_MSG_RESULT($withval)
|
AC_ARG_WITH(readline,
|
||||||
AC_DEFINE(WITH_READLINE)
|
[--with-readline=DIRECTORY search GNU readline library in DIRECTORY
|
||||||
if test -d "$withval"
|
--without-readline do not use GNU readline library],
|
||||||
then LDFLAGS="$LDFLAGS -L$withval"
|
[AC_MSG_RESULT($withval); use_readline="$withval"],
|
||||||
|
[AC_MSG_RESULT((default) yes)])
|
||||||
|
if test "$use_readline" != "no"
|
||||||
|
then
|
||||||
|
if test "$use_readline" != "yes"
|
||||||
|
then add_ldflags="-L$use_readline"
|
||||||
|
else add_ldflags=""
|
||||||
fi
|
fi
|
||||||
# first check if we can compile without lib termcap
|
# See where the termcap interface could be hiding...
|
||||||
AC_MSG_CHECKING(for -lreadline without -ltermcap)
|
AC_MSG_CHECKING(for readline and termcap libraries)
|
||||||
# check if a libreadline exists
|
AC_CACHE_VAL(ac_cv_readline_termcap,
|
||||||
LIBS="$LIBS -lreadline"
|
[
|
||||||
AC_TRY_LINK(extern char *readline();,char *line=readline();,[
|
AC_MSG_RESULT(have to find out)
|
||||||
AC_MSG_RESULT(yes)],[
|
save_libs="$LIBS"
|
||||||
AC_MSG_RESULT(no)
|
save_ldflags="$LDFLAGS"
|
||||||
AC_CHECKING(for -lreadline that needs -ltermcap)
|
LDFLAGS="$save_ldflags $add_ldflags"
|
||||||
termcap=
|
rl="-lreadline"
|
||||||
AC_CHECK_LIB(termcap, tgetent, [termcap=termcap], [
|
first=""
|
||||||
AC_CHECK_LIB(termlib, tgetent, [termcap=termlib], [
|
# Hack for SGI IRIX 5.x.
|
||||||
AC_ERROR(no working -ltermcap/termlib found -- do not use --with-readline)])])
|
# Both termcap and gl have an entry point clear().
|
||||||
# Avoid possible conflict between shared libraries termcap and gl
|
# When linking with both shared libraries, we're in trouble.
|
||||||
# on IRIX 5: both contain a routine called clear.
|
# We don't need the one in termcap.
|
||||||
if test -f /usr/lib/lib$termcap.a
|
# By forcing a static link for termcap, we avoid
|
||||||
then LIBS="$LIBS /usr/lib/lib$termcap.a"
|
# linking its clear() entry point.
|
||||||
else LIBS="$LIBS -l$termcap"
|
if test -f /usr/lib/libgl.so -a -f /usr/lib/libtermcap.a
|
||||||
|
then first="/usr/lib/libtermcap.a"
|
||||||
fi
|
fi
|
||||||
AC_MSG_CHECKING(for -lreadline)
|
for add_lib in \
|
||||||
AC_TRY_LINK(extern char *readline();, char *line=readline();,[
|
"$first" "-ltermcap" "-ltermlib" "-lcurses" "-lncurses"
|
||||||
AC_MSG_RESULT(yes)],[
|
do
|
||||||
AC_ERROR(no working GNU readline library found -- do not use --with-readline)])
|
AC_MSG_CHECKING(for $rl $add_lib)
|
||||||
|
LIBS="$save_libs $rl $add_lib"
|
||||||
|
AC_TRY_LINK([extern char *readline();],
|
||||||
|
[char *line=readline();],
|
||||||
|
[AC_MSG_RESULT(yes);
|
||||||
|
ac_cv_readline_termcap="$rl $add_lib"],
|
||||||
|
[AC_MSG_RESULT(no)])
|
||||||
|
if test "$ac_cv_readline_termcap" != ""
|
||||||
|
then break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
LIBS="$save_libs"
|
||||||
|
LDFLAGS="$save_ldflags"
|
||||||
|
AC_MSG_CHECKING(result from check for readline and termcap)
|
||||||
])
|
])
|
||||||
],
|
if test "$ac_cv_readline_termcap" = ""
|
||||||
AC_MSG_RESULT(no))
|
then
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
AC_MSG_WARN(cannot link with GNU readline -- see config.log)
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT($ac_cv_readline_termcap)
|
||||||
|
LIBS="$LIBS $ac_cv_readline_termcap"
|
||||||
|
LDFLAGS="$LDFLAGS $add_ldflags"
|
||||||
|
AC_DEFINE(WITH_READLINE)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING(for --with-thread)
|
AC_MSG_CHECKING(for --with-thread)
|
||||||
AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
|
AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user