readline: add configure --enable-readline-bundled option
Cleanup autoconf handling, should always work as expected. Use of --enable-readline-bundled when readline is needed will use copy in subdir.
This commit is contained in:
parent
2b62123459
commit
8b0616eaf5
4
Makefile
4
Makefile
|
|
@ -58,13 +58,15 @@ LIBS_SUBDIR := $(shell for i in ${MODULES}; do echo "$${i}/lib$${i}.a"; done)
|
|||
${MODULES_SUBDIR}: FORCE
|
||||
@${MAKE} -C $(dir $@) module
|
||||
|
||||
.PHONY: modules
|
||||
modules: database/database.h depend ${MODULES_SUBDIR}
|
||||
|
||||
${LIBS_SUBDIR}: FORCE
|
||||
@${MAKE} -C $(dir $@) lib
|
||||
|
||||
# Force the tiles/utils modules to exist first for libdatabase.a
|
||||
libs: database/database.h tiles/libtiles.o utils/libutils.o depend ${LIBS_SUBDIR}
|
||||
.PHONY: libs
|
||||
libs: database/database.h depend tiles/libtiles.o utils/libutils.o ${LIBS_SUBDIR}
|
||||
|
||||
#
|
||||
# extcheck - utility tool
|
||||
|
|
|
|||
|
|
@ -2,9 +2,18 @@ MAGICDIR = ..
|
|||
|
||||
include ${MAGICDIR}/defs.mak
|
||||
|
||||
module: readline-create-symlinks libreadline.a libhistory.a
|
||||
|
||||
lib: libreadline.a libhistory.a
|
||||
ifeq ($(MAKE_READLINE),1)
|
||||
TARGETS = libreadline.a libhistory.a
|
||||
else
|
||||
TARGETS =
|
||||
endif
|
||||
|
||||
# We don't make a libreadline.o
|
||||
module:
|
||||
|
||||
# We do make a libreadline.a
|
||||
lib: $(TARGETS)
|
||||
|
||||
depend:
|
||||
|
||||
|
|
@ -48,7 +57,7 @@ libreadline.a: build-readline/libreadline.a
|
|||
build-readline/libreadline.a build-readline/libhistory.a: readline-create-symlinks build-readline
|
||||
|
||||
.PHONY: build-readline
|
||||
build-readline:
|
||||
build-readline: readline-create-symlinks
|
||||
@if ! test -e build-readline/Makefile ; then \
|
||||
echo --- building GNU readline ; \
|
||||
$(MKDIR) -p build-readline ; \
|
||||
|
|
|
|||
|
|
@ -1100,33 +1100,57 @@ AC_ARG_ENABLE(readline,
|
|||
fi
|
||||
])
|
||||
|
||||
use_system_readline=yes
|
||||
use_bundled_readline=auto
|
||||
|
||||
AC_ARG_ENABLE(readline-bundled,
|
||||
[ --enable-readline-bundled enable readline bundled package],
|
||||
[ use_bundled_readline=yes
|
||||
], [
|
||||
use_bundled_readline=no
|
||||
])
|
||||
|
||||
if test "x$enable_readline" = "xyes" ; then
|
||||
AC_DEFINE(USE_READLINE)
|
||||
use_system_readline=yes
|
||||
AC_CHECK_LIB(readline, rl_pre_input_hook,,
|
||||
if test $use_bundled_readline != yes ; then
|
||||
AC_CHECK_LIB(readline, rl_pre_input_hook,[
|
||||
dnl noop, prevent default action LIBS+=-lreadline
|
||||
],
|
||||
use_system_readline=no)
|
||||
AC_CHECK_LIB(readline, rl_username_completion_function,,
|
||||
AC_CHECK_LIB(readline, rl_username_completion_function,[
|
||||
dnl noop, prevent default action LIBS+=-lreadline
|
||||
],
|
||||
use_system_readline=no)
|
||||
AC_CHECK_LIB(readline, rl_filename_completion_function,,
|
||||
AC_CHECK_LIB(readline, rl_filename_completion_function,[
|
||||
dnl noop, prevent default action LIBS+=-lreadline
|
||||
],
|
||||
use_system_readline=no)
|
||||
AC_CHECK_LIB(readline, rl_attempted_completion_over,,
|
||||
AC_CHECK_LIB(readline, rl_attempted_completion_over,[
|
||||
dnl noop, prevent default action LIBS+=-lreadline
|
||||
],
|
||||
use_system_readline=no)
|
||||
if test $use_system_readline = yes ; then
|
||||
fi
|
||||
if test $use_system_readline = yes && test $use_bundled_readline != yes; then
|
||||
AC_DEFINE(HAVE_READLINE)
|
||||
rl_libs="-lreadline"
|
||||
use_bundled_readline=
|
||||
else
|
||||
rl_libs="\${MAGICDIR}/readline/readline/libreadline.a"
|
||||
echo "Using bundled readline"
|
||||
AC_DEFINE(NEED_READLINE)
|
||||
# not readline/libhistory.a (seems subset of libreadline.a)
|
||||
rl_libs="\${MAGICDIR}/readline/libreadline.a"
|
||||
CPPFLAGS="$CPPFLAGS -I\${MAGICDIR}/readline"
|
||||
use_bundled_readline=1
|
||||
fi
|
||||
AC_CHECK_LIB(termcap, tgetent, [
|
||||
|
||||
AC_CHECK_LIB(termcap, tgetent, [
|
||||
rl_libs="$rl_libs -ltermcap"
|
||||
], [
|
||||
AC_CHECK_LIB(ncurses, tgetent, [
|
||||
rl_libs="$rl_libs -lncurses"
|
||||
], )
|
||||
], )
|
||||
modules="$modules readline"
|
||||
modules="$modules readline"
|
||||
fi
|
||||
else
|
||||
unused="$unused readline"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ global bool TxStdoutIsatty;
|
|||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
#else
|
||||
#include "readline/readline.h"
|
||||
#include "readline/history.h"
|
||||
#include "readline/readline/readline.h"
|
||||
#include "readline/readline/history.h"
|
||||
#endif
|
||||
|
||||
int TxPrefix(void);
|
||||
|
|
|
|||
Loading…
Reference in New Issue