diff --git a/Makefile b/Makefile index 17e03e38..7cdd05c2 100644 --- a/Makefile +++ b/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 diff --git a/readline/Makefile b/readline/Makefile index 8e8f7af0..1d517c7a 100644 --- a/readline/Makefile +++ b/readline/Makefile @@ -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 ; \ diff --git a/scripts/configure.in b/scripts/configure.in index f5003a9c..a9fea5a8 100644 --- a/scripts/configure.in +++ b/scripts/configure.in @@ -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 diff --git a/textio/txMain.c b/textio/txMain.c index 6fb6cdae..aa8a52a7 100644 --- a/textio/txMain.c +++ b/textio/txMain.c @@ -51,8 +51,8 @@ global bool TxStdoutIsatty; #include #include #else -#include "readline/readline.h" -#include "readline/history.h" +#include "readline/readline/readline.h" +#include "readline/readline/history.h" #endif int TxPrefix(void);