meson: add macvtap build option

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-04-29 10:52:38 +02:00
parent 86a7ffb0a2
commit edd227afa5
4 changed files with 21 additions and 59 deletions

View File

@ -113,7 +113,6 @@ fi
LIBVIRT_ARG_LIBPCAP LIBVIRT_ARG_LIBPCAP
LIBVIRT_ARG_LIBSSH LIBVIRT_ARG_LIBSSH
LIBVIRT_ARG_LIBXML LIBVIRT_ARG_LIBXML
LIBVIRT_ARG_MACVTAP
LIBVIRT_ARG_NETCF LIBVIRT_ARG_NETCF
LIBVIRT_ARG_NLS LIBVIRT_ARG_NLS
LIBVIRT_ARG_NSS LIBVIRT_ARG_NSS
@ -136,7 +135,6 @@ LIBVIRT_CHECK_LIBPARTED
LIBVIRT_CHECK_LIBPCAP LIBVIRT_CHECK_LIBPCAP
LIBVIRT_CHECK_LIBSSH LIBVIRT_CHECK_LIBSSH
LIBVIRT_CHECK_LIBXML LIBVIRT_CHECK_LIBXML
LIBVIRT_CHECK_MACVTAP
LIBVIRT_CHECK_NETCF LIBVIRT_CHECK_NETCF
LIBVIRT_CHECK_NLS LIBVIRT_CHECK_NLS
LIBVIRT_CHECK_NUMACTL LIBVIRT_CHECK_NUMACTL
@ -437,7 +435,6 @@ LIBVIRT_RESULT_LIBPCAP
LIBVIRT_RESULT_LIBSSH LIBVIRT_RESULT_LIBSSH
LIBVIRT_RESULT_LIBXL LIBVIRT_RESULT_LIBXL
LIBVIRT_RESULT_LIBXML LIBVIRT_RESULT_LIBXML
LIBVIRT_RESULT_MACVTAP
LIBVIRT_RESULT_NETCF LIBVIRT_RESULT_NETCF
LIBVIRT_RESULT_NLS LIBVIRT_RESULT_NLS
LIBVIRT_RESULT_NSS LIBVIRT_RESULT_NSS

View File

@ -1,56 +0,0 @@
dnl The macvtap support
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_MACVTAP], [
LIBVIRT_ARG_WITH([MACVTAP], [enable macvtap device], [check])
])
AC_DEFUN([LIBVIRT_CHECK_MACVTAP], [
AC_MSG_CHECKING([whether to compile with macvtap support])
if test "$with_macvtap" != "no" ; then
AC_TRY_COMPILE([ #include <sys/socket.h>
#include <linux/rtnetlink.h> ],
[ int x = MACVLAN_MODE_BRIDGE;
int y = IFLA_VF_MAX; ],
[ with_macvtap=yes ],
[ if test "$with_macvtap" = "yes" ; then
AC_MSG_ERROR([Installed linux headers don't show support for macvtap device.])
fi
with_macvtap=no ])
if test "$with_macvtap" = "yes" ; then
val=1
else
val=0
fi
AC_DEFINE_UNQUOTED([WITH_MACVTAP], $val, [whether macvtap support is enabled])
fi
AM_CONDITIONAL([WITH_MACVTAP], [test "$with_macvtap" = "yes"])
AC_MSG_RESULT([$with_macvtap])
if test "$with_macvtap" = yes; then
AC_CHECK_DECLS([MACVLAN_MODE_PASSTHRU], [], [], [[
#include <sys/socket.h>
#include <linux/if_link.h>
]])
fi
])
AC_DEFUN([LIBVIRT_RESULT_MACVTAP], [
LIBVIRT_RESULT_LIB([MACVTAP])
])

View File

@ -1084,6 +1084,25 @@ endif
libiscsi_version = '1.18.0' libiscsi_version = '1.18.0'
libiscsi_dep = dependency('libiscsi', version: '>=' + libiscsi_version, required: get_option('libiscsi')) libiscsi_dep = dependency('libiscsi', version: '>=' + libiscsi_version, required: get_option('libiscsi'))
use_macvtap = false
if not get_option('macvtap').disabled()
if (cc.has_header_symbol('linux/if_link.h', 'MACVLAN_MODE_BRIDGE') and
cc.has_header_symbol('linux/if_link.h', 'IFLA_VF_MAX'))
use_macvtap = true
endif
if get_option('macvtap').enabled() and not use_macvtap
error('Installed linux headers don\'t show support for macvtap device.')
endif
endif
if use_macvtap
conf.set('WITH_MACVTAP', 1)
if cc.has_header_symbol('linux/if_link.h', 'MACVLAN_MODE_PASSTHRU')
conf.set('HAVE_DECL_MACVLAN_MODE_PASSTHRU', 1)
endif
endif
# readline 7.0 is the first version which includes pkg-config support # readline 7.0 is the first version which includes pkg-config support
readline_version = '7.0' readline_version = '7.0'
readline_dep = dependency('readline', version: '>=' + readline_version, required: false) readline_dep = dependency('readline', version: '>=' + readline_version, required: false)
@ -1225,6 +1244,7 @@ libs_summary = {
'gnutls': gnutls_dep.found(), 'gnutls': gnutls_dep.found(),
'hal': hal_dep.found(), 'hal': hal_dep.found(),
'libiscsi': libiscsi_dep.found(), 'libiscsi': libiscsi_dep.found(),
'macvtap': conf.has('WITH_MACVTAP'),
'readline': readline_dep.found(), 'readline': readline_dep.found(),
} }
summary(libs_summary, section: 'Libraries', bool_yn: true) summary(libs_summary, section: 'Libraries', bool_yn: true)

View File

@ -25,6 +25,7 @@ option('fuse', type: 'feature', value: 'auto', description: 'fuse support')
option('glusterfs', type: 'feature', value: 'auto', description: 'glusterfs support') option('glusterfs', type: 'feature', value: 'auto', description: 'glusterfs support')
option('hal', type: 'feature', value: 'auto', description: 'hal support') option('hal', type: 'feature', value: 'auto', description: 'hal support')
option('libiscsi', type: 'feature', value: 'auto', description: 'libiscsi support') option('libiscsi', type: 'feature', value: 'auto', description: 'libiscsi support')
option('macvtap', type: 'feature', value: 'auto', description: 'enable macvtap device')
option('readline', type: 'feature', value: 'auto', description: 'readline support') option('readline', type: 'feature', value: 'auto', description: 'readline support')