diff options
-rw-r--r-- | cmake/modules/FindLIBSSH.cmake | 1 | ||||
-rw-r--r-- | cmakeconfig.h.in | 1 | ||||
-rw-r--r-- | extcap/ssh-base.h | 19 |
3 files changed, 19 insertions, 2 deletions
diff --git a/cmake/modules/FindLIBSSH.cmake b/cmake/modules/FindLIBSSH.cmake index 29368bc1c5..9afec5d7a8 100644 --- a/cmake/modules/FindLIBSSH.cmake +++ b/cmake/modules/FindLIBSSH.cmake @@ -73,7 +73,6 @@ else () REGEX "#define[ ]+LIBSSH_VERSION_MICRO[ ]+[0-9]+") string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_PATCH ${LIBSSH_VERSION_PATCH}) set(LIBSSH_VERSION ${LIBSSH_VERSION_MAJOR}.${LIBSSH_VERSION_MINOR}.${LIBSSH_VERSION_PATCH}) - set(LIBSSH_VERSION_STRING "${LIBSSH_VERSION}") endif() # diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in index e671388fb7..b16baa11e3 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -60,7 +60,6 @@ /* Define if LIBSSH support is enabled */ #cmakedefine HAVE_LIBSSH 1 -#cmakedefine LIBSSH_VERSION_STRING "@LIBSSH_VERSION_STRING@" /* Define to 1 if you have the `ssh_version' function. */ #cmakedefine HAVE_SSH_VERSION 1 diff --git a/extcap/ssh-base.h b/extcap/ssh-base.h index 55565646d9..6a2f523a01 100644 --- a/extcap/ssh-base.h +++ b/extcap/ssh-base.h @@ -15,6 +15,25 @@ #include <libssh/libssh.h> +/* + * Sigh. + * + * libssh 1.0 and 2.0 define LIBSSH_VERSION as a string. + * + * libssh 3.0 and later define it as three numbers with periods + * between them, so that you have to do SSH_STRINGIFY(LIBSSH_VERSION) + * to get the SSH version as a string. + * + * Fortunately, "needs SSH_STRINGIFY()" is true iff SSH_STRINGIFY is + * defined, so we can define LIBSSH_VERSION_STRING differently, + * depending on whether SSH_STRINGIFY is defined. + */ +#ifdef SSH_STRINGIFY +#define LIBSSH_VERSION_STRING SSH_STRINGIFY(LIBSSH_VERSION) +#else +#define LIBSSH_VERSION_STRING LIBSSH_VERSION +#endif + #include <glib.h> #ifndef STDERR_FILENO |