[libvirt PATCH 058/351] meson: add libssh build dependency

Pavel Hrdina phrdina at redhat.com
Thu Jul 16 09:54:54 UTC 2020


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 configure.ac      |  4 ----
 m4/virt-libssh.m4 | 51 -----------------------------------------------
 meson.build       | 22 ++++++++++++++++++++
 meson_options.txt |  1 +
 4 files changed, 23 insertions(+), 55 deletions(-)
 delete mode 100644 m4/virt-libssh.m4

diff --git a/configure.ac b/configure.ac
index 6d5e4e034fb..1709f56a8b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
@@ -428,7 +425,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
index 132447da163..00000000000
--- a/m4/virt-libssh.m4
+++ /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])
-])
diff --git a/meson.build b/meson.build
index 2346ae31d5a..2ab3aa87dea 100644
--- a/meson.build
+++ b/meson.build
@@ -1111,6 +1111,27 @@ 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)
+
+    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
@@ -1277,6 +1298,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(),
 }
diff --git a/meson_options.txt b/meson_options.txt
index 9e4e3f66429..9588db5b835 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -25,5 +25,6 @@ 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')
-- 
2.26.2




More information about the libvir-list mailing list