Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- configure.ac | 3 --- m4/virt-macvtap.m4 | 56 ---------------------------------------------- meson.build | 20 +++++++++++++++++ meson_options.txt | 1 + 4 files changed, 21 insertions(+), 59 deletions(-) delete mode 100644 m4/virt-macvtap.m4 diff --git a/configure.ac b/configure.ac index b74cb72db4a..456e60e62bc 100644 --- a/configure.ac +++ b/configure.ac @@ -113,7 +113,6 @@ fi LIBVIRT_ARG_LIBPCAP LIBVIRT_ARG_LIBSSH LIBVIRT_ARG_LIBXML -LIBVIRT_ARG_MACVTAP LIBVIRT_ARG_NETCF LIBVIRT_ARG_NLS LIBVIRT_ARG_NSS @@ -136,7 +135,6 @@ LIBVIRT_CHECK_LIBPARTED LIBVIRT_CHECK_LIBPCAP LIBVIRT_CHECK_LIBSSH LIBVIRT_CHECK_LIBXML -LIBVIRT_CHECK_MACVTAP LIBVIRT_CHECK_NETCF LIBVIRT_CHECK_NLS LIBVIRT_CHECK_NUMACTL @@ -439,7 +437,6 @@ LIBVIRT_RESULT_LIBPCAP LIBVIRT_RESULT_LIBSSH LIBVIRT_RESULT_LIBXL LIBVIRT_RESULT_LIBXML -LIBVIRT_RESULT_MACVTAP LIBVIRT_RESULT_NETCF LIBVIRT_RESULT_NLS LIBVIRT_RESULT_NSS diff --git a/m4/virt-macvtap.m4 b/m4/virt-macvtap.m4 deleted file mode 100644 index c5da96ecf2f..00000000000 --- a/m4/virt-macvtap.m4 +++ /dev/null @@ -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]) -]) diff --git a/meson.build b/meson.build index 9d43be1375c..ce3dbca83e0 100644 --- a/meson.build +++ b/meson.build @@ -1068,6 +1068,25 @@ endif libiscsi_version = '1.18.0' 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_version = '7.0' readline_dep = dependency('readline', version: '>=' + readline_version, required: false) @@ -1209,6 +1228,7 @@ libs_summary = { 'gnutls': gnutls_dep.found(), 'hal': hal_dep.found(), 'libiscsi': libiscsi_dep.found(), + 'macvtap': conf.has('WITH_MACVTAP'), 'readline': readline_dep.found(), } summary(libs_summary, section: 'Libraries', bool_yn: true) diff --git a/meson_options.txt b/meson_options.txt index c06e6ee9256..44e756bdcf3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -24,4 +24,5 @@ option('fuse', type: 'feature', value: 'auto', description: 'fuse support') option('glusterfs', type: 'feature', value: 'auto', description: 'glusterfs support') option('hal', type: 'feature', value: 'auto', description: 'hal 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') -- 2.26.2