]> granicus.if.org Git - curl/commitdiff
libssh2: detect features based on version, not configure checks
authorDaniel Stenberg <daniel@haxx.se>
Sun, 9 Nov 2014 14:42:12 +0000 (15:42 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 9 Nov 2014 14:43:27 +0000 (15:43 +0100)
... so that non-configure builds get the correct functions too based on
the libssh2 version used.

configure.ac
lib/easy.c
lib/ssh.c
lib/ssh.h

index d37fd92fbdbf29ecfe8e2d3fb481ad0c12af8767..0ad8fc9646d32cc747d4eeeb9e04128e7cf8612c 100644 (file)
@@ -2332,12 +2332,6 @@ if test X"$OPT_LIBSSH2" != Xno; then
        dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
        dnl to prevent further configure tests to fail due to this
 
-       dnl libssh2_version is a post 1.0 addition
-       dnl libssh2_init and libssh2_exit were added in 1.2.5
-       dnl libssh2_scp_send64 was added in 1.2.6
-       dnl libssh2_session_handshake was added in 1.2.8
-       AC_CHECK_FUNCS( libssh2_version libssh2_init libssh2_exit \
-                       libssh2_scp_send64 libssh2_session_handshake)
        if test "x$cross_compiling" != "xyes"; then
          LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
          export LD_LIBRARY_PATH
index 5ce2d5827cf0a08ea2056fa7f0e384d75afc4736..5f14fede3217d98575f38eb63608a04bc473399a 100644 (file)
@@ -74,6 +74,7 @@
 #include "conncache.h"
 #include "multiif.h"
 #include "sigpipe.h"
+#include "ssh.h"
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
index 6fefe8aee2bd54e990420caf00e57f281dd61434..ba26eef72eee6a73cf24fe48cdbcf37126bce84f 100644 (file)
--- a/lib/ssh.c
+++ b/lib/ssh.c
 #  endif
 #endif
 
-/* Feature detection based on version numbers to better work with
-   non-configure platforms */
-#if LIBSSH2_VERSION_NUM >= 0x010206
-/* libssh2_knownhost_checkp was added in 1.2.6 */
-#define HAVE_LIBSSH2_KNOWNHOST_CHECKP
-#endif
-
 #ifndef PATH_MAX
 #define PATH_MAX 1024 /* just an extra precaution since there are systems that
                          have their definition hidden well */
index ff2e16be941ea62e235429dafd473a845e03cc66..1bc334857c29dbc62e35e8ee861d4726701edf6d 100644 (file)
--- a/lib/ssh.h
+++ b/lib/ssh.h
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -158,22 +158,34 @@ struct ssh_conn {
 
 #ifdef USE_LIBSSH2
 
+/* Feature detection based on version numbers to better work with
+   non-configure platforms */
+
 #if !defined(LIBSSH2_VERSION_NUM) || (LIBSSH2_VERSION_NUM < 0x001000)
 #  error "SCP/SFTP protocols require libssh2 0.16 or later"
 #endif
 
-#if defined(LIBSSH2_VERSION_NUM) && (LIBSSH2_VERSION_NUM >= 0x010000)
-#  define HAVE_LIBSSH2_SFTP_SEEK64 1
-#else
-#  undef HAVE_LIBSSH2_SFTP_SEEK64
+#if LIBSSH2_VERSION_NUM >= 0x010000
+#define HAVE_LIBSSH2_SFTP_SEEK64 1
+#endif
+
+#if LIBSSH2_VERSION_NUM >= 0x010100
+#define HAVE_LIBSSH2_VERSION 1
 #endif
 
-#if defined(LIBSSH2_VERSION_NUM) && (LIBSSH2_VERSION_NUM >= 0x010206)
-#  define HAVE_LIBSSH2_SCP_SEND64 1
-#else
-#  undef HAVE_LIBSSH2_SCP_SEND64
+#if LIBSSH2_VERSION_NUM >= 0x010205
+#define HAVE_LIBSSH2_INIT 1
+#define HAVE_LIBSSH2_EXIT 1
 #endif
 
+#if LIBSSH2_VERSION_NUM >= 0x010206
+#define HAVE_LIBSSH2_KNOWNHOST_CHECKP 1
+#define HAVE_LIBSSH2_SCP_SEND64 1
+#endif
+
+#if LIBSSH2_VERSION_NUM >= 0x010208
+#define HAVE_LIBSSH2_SESSION_HANDSHAKE 1
+#endif
 
 extern const struct Curl_handler Curl_handler_scp;
 extern const struct Curl_handler Curl_handler_sftp;