fix build without readline

This commit is contained in:
Evgeniy A. Dushistov
2017-02-17 17:38:57 +03:00
parent a1a614b81f
commit 7df514e117
2 changed files with 10 additions and 6 deletions

View File

@@ -27,11 +27,15 @@ if (NOT GLIB2_FOUND)
"make sure that you install it")
endif()
find_path(READLINE_INCLUDE_DIR readline/readline.h)
find_library(READLINE_LIBRARY NAMES readline)
if (READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
set(WITH_READLINE True)
endif ()
set(WITH_READLINE True CACHE BOOL "Use readline library")
if (WITH_READLINE)
find_path(READLINE_INCLUDE_DIR readline/readline.h)
find_library(READLINE_LIBRARY NAMES readline)
if (NOT (READLINE_INCLUDE_DIR AND READLINE_LIBRARY))
set(WITH_READLINE False CACHE FORCE)
endif ()
endif (WITH_READLINE)
option(ENABLE_NLS "Enable NLS support" True)

View File

@@ -48,7 +48,7 @@ namespace {
class dummy_readline : public IReadLine {
public:
bool read(const string& banner, string& line) override {
bool read(const std::string &banner, std::string &line) override {
printf("%s", banner.c_str());
return stdio_getline(stdin, line);
}