Skip to content

Commit 837b84b

Browse files
committed
configure, meson: move netmap detection to meson
Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent e172399 commit 837b84b

File tree

4 files changed

+27
-38
lines changed

4 files changed

+27
-38
lines changed

configure

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ iconv="auto"
292292
curses="auto"
293293
docs="auto"
294294
fdt="auto"
295-
netmap="no"
295+
netmap="auto"
296296
sdl="auto"
297297
sdl_image="auto"
298298
virtiofsd="auto"
@@ -701,7 +701,6 @@ FreeBSD)
701701
bsd_user="yes"
702702
make="${MAKE-gmake}"
703703
# needed for kinfo_getvmmap(3) in libutil.h
704-
netmap="" # enable netmap autodetect
705704
;;
706705
DragonFly)
707706
bsd="yes"
@@ -1026,9 +1025,9 @@ for opt do
10261025
;;
10271026
--enable-vde) vde="enabled"
10281027
;;
1029-
--disable-netmap) netmap="no"
1028+
--disable-netmap) netmap="disabled"
10301029
;;
1031-
--enable-netmap) netmap="yes"
1030+
--enable-netmap) netmap="enabled"
10321031
;;
10331032
--disable-xen) xen="disabled"
10341033
;;
@@ -2903,34 +2902,6 @@ EOF
29032902
fi
29042903
fi
29052904

2906-
##########################################
2907-
# netmap support probe
2908-
# Apart from looking for netmap headers, we make sure that the host API version
2909-
# supports the netmap backend (>=11). The upper bound (15) is meant to simulate
2910-
# a minor/major version number. Minor new features will be marked with values up
2911-
# to 15, and if something happens that requires a change to the backend we will
2912-
# move above 15, submit the backend fixes and modify this two bounds.
2913-
if test "$netmap" != "no" ; then
2914-
cat > $TMPC << EOF
2915-
#include <inttypes.h>
2916-
#include <net/if.h>
2917-
#include <net/netmap.h>
2918-
#include <net/netmap_user.h>
2919-
#if (NETMAP_API < 11) || (NETMAP_API > 15)
2920-
#error
2921-
#endif
2922-
int main(void) { return 0; }
2923-
EOF
2924-
if compile_prog "" "" ; then
2925-
netmap=yes
2926-
else
2927-
if test "$netmap" = "yes" ; then
2928-
feature_not_found "netmap"
2929-
fi
2930-
netmap=no
2931-
fi
2932-
fi
2933-
29342905
##########################################
29352906
# plugin linker support probe
29362907

@@ -4175,9 +4146,6 @@ if test "$slirp_smbd" = "yes" ; then
41754146
echo "CONFIG_SLIRP_SMBD=y" >> $config_host_mak
41764147
echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
41774148
fi
4178-
if test "$netmap" = "yes" ; then
4179-
echo "CONFIG_NETMAP=y" >> $config_host_mak
4180-
fi
41814149
if test "$l2tpv3" = "yes" ; then
41824150
echo "CONFIG_L2TPV3=y" >> $config_host_mak
41834151
fi
@@ -4724,7 +4692,7 @@ if test "$skip_meson" = no; then
47244692
-Dalsa=$alsa -Dcoreaudio=$coreaudio -Ddsound=$dsound -Djack=$jack -Doss=$oss \
47254693
-Dpa=$pa -Daudio_drv_list=$audio_drv_list -Dtcg_interpreter=$tcg_interpreter \
47264694
-Dtrace_backends=$trace_backends -Dtrace_file=$trace_file -Dlinux_aio=$linux_aio \
4727-
-Dvde=$vde \
4695+
-Dnetmap=$netmap -Dvde=$vde \
47284696
$cross_arg \
47294697
"$PWD" "$source_path"
47304698

meson.build

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,23 @@ config_host_data.set('HAVE_MLOCKALL', cc.links(gnu_source_prefix + '''
16561656
return mlockall(MCL_FUTURE);
16571657
}'''))
16581658

1659+
have_netmap = false
1660+
if not get_option('netmap').disabled() and have_system
1661+
have_netmap = cc.compiles('''
1662+
#include <inttypes.h>
1663+
#include <net/if.h>
1664+
#include <net/netmap.h>
1665+
#include <net/netmap_user.h>
1666+
#if (NETMAP_API < 11) || (NETMAP_API > 15)
1667+
#error
1668+
#endif
1669+
int main(void) { return 0; }''')
1670+
if not have_netmap and get_option('netmap').enabled()
1671+
error('Netmap headers not available')
1672+
endif
1673+
endif
1674+
config_host_data.set('CONFIG_NETMAP', have_netmap)
1675+
16591676
# Work around a system header bug with some kernel/XFS header
16601677
# versions where they both try to define 'struct fsxattr':
16611678
# xfs headers will not try to redefine structs from linux headers
@@ -3311,7 +3328,7 @@ endif
33113328
summary_info += {'JACK support': jack}
33123329
summary_info += {'brlapi support': brlapi}
33133330
summary_info += {'vde support': vde}
3314-
summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
3331+
summary_info += {'netmap support': have_netmap}
33153332
summary_info += {'Linux AIO support': libaio}
33163333
summary_info += {'Linux io_uring support': linux_io_uring}
33173334
summary_info += {'ATTR/XATTR support': libattr}

meson_options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ option('u2f', type : 'feature', value : 'auto',
129129
description: 'U2F emulation support')
130130
option('usb_redir', type : 'feature', value : 'auto',
131131
description: 'libusbredir support')
132+
option('netmap', type : 'feature', value : 'auto',
133+
description: 'netmap network backend support')
132134
option('vde', type : 'feature', value : 'auto',
133135
description: 'vde network backend support')
134136
option('virglrenderer', type : 'feature', value : 'auto',

net/meson.build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('filter-replay.c'))
2121
softmmu_ss.add(when: 'CONFIG_L2TPV3', if_true: files('l2tpv3.c'))
2222
softmmu_ss.add(when: slirp, if_true: files('slirp.c'))
2323
softmmu_ss.add(when: vde, if_true: files('vde.c'))
24-
softmmu_ss.add(when: 'CONFIG_NETMAP', if_true: files('netmap.c'))
24+
if have_netmap
25+
softmmu_ss.add(files('netmap.c'))
26+
endif
2527
vhost_user_ss = ss.source_set()
2628
vhost_user_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
2729
softmmu_ss.add_all(when: 'CONFIG_VHOST_NET_USER', if_true: vhost_user_ss)

0 commit comments

Comments
 (0)