meson: add libssh build dependency

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-06-24 13:27:12 +02:00
parent ce6b9ef6eb
commit 5604e26f7a
4 changed files with 25 additions and 55 deletions

View 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

View File

@ -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])
])

View 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(),
}

View 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')