From a736568e68c9ffdc93dba3226fb2dee980caf51e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 29 Oct 2012 02:27:33 -0400 Subject: [PATCH] GnuTLS - Added GnuTLS discovery, linking. - Added '+/-tls' indicator to diagnostics command. - Added libgnutls version number to diagnostics command. - Renamed wcwidth6.c to wcwidth6.cpp, to eliminate a strange build error. --- CMakeLists.txt | 11 ++++++++++- cmake.h.in | 3 +++ src/CMakeLists.txt | 2 +- src/commands/CmdDiagnostics.cpp | 18 ++++++++++++++++++ src/text.cpp | 1 - src/text.h | 2 ++ src/{wcwidth6.c => wcwidth6.cpp} | 0 7 files changed, 34 insertions(+), 3 deletions(-) rename src/{wcwidth6.c => wcwidth6.cpp} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b0866fc7..1bb0f0fe5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,10 +48,19 @@ set (PACKAGE_TARNAME "${PACKAGE}") set (PACKAGE_VERSION "${VERSION}") set (PACKAGE_STRING "${PACKAGE} ${VERSION}") +message ("-- Looking for GnuTLS") +find_package (GnuTLS) +if (GNUTLS_FOUND) + message ("-- Found GnuTLS: ${GNUTLS_LIBRARIES}") + set (HAVE_LIBGNUTLS true) + set (TASK_INCLUDE_DIRS ${TASK_INCLUDE_DIRS} ${GNUTLS_INCLUDE_DIR}) + set (TASK_LIBRARIES ${TASK_LIBRARIES} ${GNUTLS_LIBRARIES}) +endif (GNUTLS_FOUND) + message ("-- Looking for Lua51") find_package (Lua51) if (LUA51_FOUND) - message ("-- Found Lua51: ${LUA_LIBRARIES}") + message ("-- Found Lua51: ${LUA_LIBRARIES}") set (HAVE_LIBLUA true) set (TASK_INCLUDE_DIRS ${TASK_INCLUDE_DIRS} ${LUA_INCLUDE_DIR}) set (TASK_LIBRARIES ${TASK_LIBRARIES} ${LUA_LIBRARIES}) diff --git a/cmake.h.in b/cmake.h.in index d2661ede5..c982c4f3c 100644 --- a/cmake.h.in +++ b/cmake.h.in @@ -42,6 +42,9 @@ Override PACKAGE_LANGUAGE, then #cmakedefine SOLARIS #cmakedefine UNKNOWN +/* Found the GnuTLS library */ +#cmakedefine HAVE_LIBGNUTLS + /* Found the lua library */ #cmakedefine HAVE_LIBLUA diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 222a9da7e..a166036b5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,7 +46,7 @@ set (task_SRCS A3.cpp A3.h text.cpp text.h utf8.cpp utf8.h util.cpp util.h - wcwidth6.c) + wcwidth6.cpp) add_library (task STATIC ${task_SRCS}) add_executable (task_executable main.cpp) diff --git a/src/commands/CmdDiagnostics.cpp b/src/commands/CmdDiagnostics.cpp index 40ec7232e..8f4c2dadc 100644 --- a/src/commands/CmdDiagnostics.cpp +++ b/src/commands/CmdDiagnostics.cpp @@ -46,6 +46,10 @@ extern "C" } #endif +#ifdef HAVE_LIBGNUTLS +#include +#endif + #include extern Context context; @@ -150,6 +154,14 @@ int CmdDiagnostics::execute (std::string& output) << "libuuid, no uuid_unparse_lower" #else << "n/a" +#endif + << "\n"; + + out << " libgnutls: " +#ifdef HAVE_LIBGNUTLS + << GNUTLS_VERSION +#else + << "n/a" #endif << "\n\n"; @@ -184,6 +196,12 @@ int CmdDiagnostics::execute (std::string& output) #else << " -uuid" #endif + +#ifdef HAVE_LIBGNUTLS + << " +tls" +#else + << " -tls" +#endif << "\n\n"; // Config: .taskrc found, readable, writable diff --git a/src/text.cpp b/src/text.cpp index c5e141e45..e31c9cb98 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -48,7 +48,6 @@ static const char* newline = "\n"; static const char* noline = ""; static void replace_positional (std::string&, const std::string&, const std::string&); -extern "C" int mk_wcwidth (wchar_t); /////////////////////////////////////////////////////////////////////////////// void wrapText ( diff --git a/src/text.h b/src/text.h index 1127c8063..cf90dbfc0 100644 --- a/src/text.h +++ b/src/text.h @@ -91,5 +91,7 @@ std::string rightJustifyZero (const int, const int); std::string rightJustify (const int, const int); std::string rightJustify (const std::string&, const int); +int mk_wcwidth (wchar_t); + #endif //////////////////////////////////////////////////////////////////////////////// diff --git a/src/wcwidth6.c b/src/wcwidth6.cpp similarity index 100% rename from src/wcwidth6.c rename to src/wcwidth6.cpp