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") "make sure that you install it")
endif() endif()
set(WITH_READLINE True CACHE BOOL "Use readline library")
if (WITH_READLINE)
find_path(READLINE_INCLUDE_DIR readline/readline.h) find_path(READLINE_INCLUDE_DIR readline/readline.h)
find_library(READLINE_LIBRARY NAMES readline) find_library(READLINE_LIBRARY NAMES readline)
if (READLINE_INCLUDE_DIR AND READLINE_LIBRARY) if (NOT (READLINE_INCLUDE_DIR AND READLINE_LIBRARY))
set(WITH_READLINE True) set(WITH_READLINE False CACHE FORCE)
endif () endif ()
endif (WITH_READLINE)
option(ENABLE_NLS "Enable NLS support" True) option(ENABLE_NLS "Enable NLS support" True)

View File

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