]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: add libssh build dependency
authorPavel Hrdina <phrdina@redhat.com>
Wed, 24 Jun 2020 11:27:12 +0000 (13:27 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:26:59 +0000 (09:26 +0200)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
configure.ac
m4/virt-libssh.m4 [deleted file]
meson.build
meson_options.txt

index 0946a78336405682eeec3f7b06625147aff9a5de..e43abbe4dd790106ba71cb1f69edcf5ab359cffd 100644 (file)
@@ -98,7 +98,6 @@ if test "$with_remote" = "no" ; then
   with_libvirtd=no
   with_ssh2=no
   with_sasl=no
-  with_libssh=no
 fi
 # Stateful drivers are useful only when building the daemon.
 if test "$with_libvirtd" = "no" ; then
@@ -110,7 +109,6 @@ fi
 
 # Check for compiler and library settings.
 
-LIBVIRT_ARG_LIBSSH
 LIBVIRT_ARG_LIBXML
 LIBVIRT_ARG_NETCF
 LIBVIRT_ARG_NLS
@@ -129,7 +127,6 @@ LIBVIRT_ARG_VIRTUALPORT
 LIBVIRT_ARG_WIRESHARK
 LIBVIRT_ARG_YAJL
 
-LIBVIRT_CHECK_LIBSSH
 LIBVIRT_CHECK_LIBXML
 LIBVIRT_CHECK_NETCF
 LIBVIRT_CHECK_NLS
@@ -426,7 +423,6 @@ LIBVIRT_RESULT_DRIVER_MODULES
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Libraries])
 AC_MSG_NOTICE([])
-LIBVIRT_RESULT_LIBSSH
 LIBVIRT_RESULT_LIBXL
 LIBVIRT_RESULT_LIBXML
 LIBVIRT_RESULT_NETCF
diff --git a/m4/virt-libssh.m4 b/m4/virt-libssh.m4
deleted file mode 100644 (file)
index 132447d..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-dnl The libssh.so library
-dnl
-dnl Copyright (C) 2016 Red Hat, Inc.
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License, or (at your option) any later version.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library.  If not, see
-dnl <http://www.gnu.org/licenses/>.
-dnl
-
-AC_DEFUN([LIBVIRT_ARG_LIBSSH],[
-  LIBVIRT_ARG_WITH_FEATURE([LIBSSH], [libssh], [check], [0.7])
-])
-
-AC_DEFUN([LIBVIRT_CHECK_LIBSSH],[
-  LIBVIRT_CHECK_PKG([LIBSSH], [libssh], [0.7])
-
-  if test "$with_libssh" = "yes" ; then
-    old_CFLAGS="$CFLAGS"
-    old_LIBS="$LIBS"
-    CFLAGS="$CFLAGS $LIBSSH_CFLAGS"
-    LIBS="$LIBS $LIBSSH_LIBS"
-    AC_CHECK_FUNC([ssh_get_server_publickey],
-      [],
-      [AC_DEFINE_UNQUOTED([ssh_get_server_publickey], [ssh_get_publickey],
-            [ssh_get_publickey is deprecated and replaced by ssh_get_server_publickey.])])
-    AC_CHECK_FUNC([ssh_session_is_known_server],
-      [],
-      [AC_DEFINE_UNQUOTED([ssh_session_is_known_server], [ssh_is_server_known],
-            [ssh_is_server_known is deprecated and replaced by ssh_session_is_known_server.])])
-    AC_CHECK_FUNC([ssh_session_update_known_hosts],
-      [],
-      [AC_DEFINE_UNQUOTED([ssh_session_update_known_hosts], [ssh_write_knownhost],
-            [ssh_write_knownhost is deprecated and replaced by ssh_session_update_known_hosts.])])
-    CFLAGS="$old_CFLAGS"
-    LIBS="$old_LIBS"
-  fi
-])
-
-AC_DEFUN([LIBVIRT_RESULT_LIBSSH],[
-  LIBVIRT_RESULT_LIB([LIBSSH])
-])
index 809d76695ef02885d38c6c62168679d35be87926..5afbdd6a36cf311f09bf444c4fde5d579eba5c8b 100644 (file)
@@ -1127,6 +1127,29 @@ if libpcap_dep.found()
   conf.set('HAVE_LIBPCAP', 1)
 endif
 
+libssh_version = '0.7'
+if get_option('driver_remote').enabled()
+  libssh_dep = dependency('libssh', version: '>=' + libssh_version, required: get_option('libssh'))
+  if libssh_dep.found()
+    conf.set('WITH_LIBSSH', 1)
+
+    # Check if new functions exists, if not redefine them with old deprecated ones.
+    # List of [ new_function, deprecated_function ].
+    functions = [
+      [ 'ssh_get_server_publickey', 'ssh_get_publickey' ],
+      [ 'ssh_session_is_known_server', 'ssh_is_server_known' ],
+      [ 'ssh_session_update_known_hosts', 'ssh_write_knownhost' ],
+    ]
+    foreach name : functions
+      if not cc.has_function(name[0], dependencies: libssh_dep)
+        conf.set(name[0], name[1])
+      endif
+    endforeach
+  endif
+else
+  libssh_dep = dependency('', required: false)
+endif
+
 use_macvtap = false
 if not get_option('macvtap').disabled()
   if (cc.has_header_symbol('linux/if_link.h', 'MACVLAN_MODE_BRIDGE') and
@@ -1293,6 +1316,7 @@ libs_summary = {
   'libiscsi': libiscsi_dep.found(),
   'libnl': libnl_dep.found(),
   'libpcap': libpcap_dep.found(),
+  'libssh': libssh_dep.found(),
   'macvtap': conf.has('WITH_MACVTAP'),
   'readline': readline_dep.found(),
 }
index a47f8de6a39c3325119ed858280b9bdd1717111a..459c7b8a8def0da499c957ab5c7bb60775015860 100644 (file)
@@ -26,6 +26,7 @@ option('glusterfs', type: 'feature', value: 'auto', description: 'glusterfs supp
 option('hal', type: 'feature', value: 'auto', description: 'hal support')
 option('libiscsi', type: 'feature', value: 'auto', description: 'libiscsi support')
 option('libpcap', type: 'feature', value: 'auto', description: 'libpcap support')
+option('libssh', type: 'feature', value: 'auto', description: 'libssh support')
 option('macvtap', type: 'feature', value: 'auto', description: 'enable macvtap device')
 option('readline', type: 'feature', value: 'auto', description: 'readline support')