Skip to content

Commit c5b36c2

Browse files
committed
configure, meson: convert libxml2 detection to meson
Reviewed-by: Daniel P. Berrangé <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 53c22b6 commit c5b36c2

File tree

3 files changed

+10
-29
lines changed

3 files changed

+10
-29
lines changed

configure

+4-25
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ vdi=${default_feature:-yes}
425425
vvfat=${default_feature:-yes}
426426
qed=${default_feature:-yes}
427427
parallels=${default_feature:-yes}
428-
libxml2="$default_feature"
428+
libxml2="auto"
429429
debug_mutex="no"
430430
libpmem="auto"
431431
default_devices="true"
@@ -1419,9 +1419,9 @@ for opt do
14191419
;;
14201420
--enable-numa) numa="yes"
14211421
;;
1422-
--disable-libxml2) libxml2="no"
1422+
--disable-libxml2) libxml2="disabled"
14231423
;;
1424-
--enable-libxml2) libxml2="yes"
1424+
--enable-libxml2) libxml2="enabled"
14251425
;;
14261426
--disable-tcmalloc) tcmalloc="no"
14271427
;;
@@ -3409,21 +3409,6 @@ EOF
34093409
fi
34103410
fi
34113411

3412-
##########################################
3413-
# libxml2 probe
3414-
if test "$libxml2" != "no" ; then
3415-
if $pkg_config --exists libxml-2.0; then
3416-
libxml2="yes"
3417-
libxml2_cflags=$($pkg_config --cflags libxml-2.0)
3418-
libxml2_libs=$($pkg_config --libs libxml-2.0)
3419-
else
3420-
if test "$libxml2" = "yes"; then
3421-
feature_not_found "libxml2" "Install libxml2 devel"
3422-
fi
3423-
libxml2="no"
3424-
fi
3425-
fi
3426-
34273412
# Check for inotify functions when we are building linux-user
34283413
# emulator. This is done because older glibc versions don't
34293414
# have syscall stubs for these implemented. In that case we
@@ -5636,12 +5621,6 @@ if test "$have_rtnetlink" = "yes" ; then
56365621
echo "CONFIG_RTNETLINK=y" >> $config_host_mak
56375622
fi
56385623

5639-
if test "$libxml2" = "yes" ; then
5640-
echo "CONFIG_LIBXML2=y" >> $config_host_mak
5641-
echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak
5642-
echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak
5643-
fi
5644-
56455624
if test "$replication" = "yes" ; then
56465625
echo "CONFIG_REPLICATION=y" >> $config_host_mak
56475626
fi
@@ -6050,7 +6029,7 @@ if test "$skip_meson" = no; then
60506029
-Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
60516030
-Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
60526031
-Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
6053-
-Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \
6032+
-Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse -Dlibxml2=$libxml2 \
60546033
-Dlibdaxctl=$libdaxctl -Dlibpmem=$libpmem -Dlinux_io_uring=$linux_io_uring \
60556034
-Dgnutls=$gnutls -Dnettle=$nettle -Dgcrypt=$gcrypt -Dauth_pam=$auth_pam \
60566035
-Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \

meson.build

+4-4
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,9 @@ if not get_option('linux_io_uring').auto() or have_block
334334
method: 'pkg-config', kwargs: static_kwargs)
335335
endif
336336
libxml2 = not_found
337-
if 'CONFIG_LIBXML2' in config_host
338-
libxml2 = declare_dependency(compile_args: config_host['LIBXML2_CFLAGS'].split(),
339-
link_args: config_host['LIBXML2_LIBS'].split())
337+
if not get_option('libxml2').auto() or have_block
338+
libxml2 = dependency('libxml-2.0', required: get_option('libxml2'),
339+
method: 'pkg-config', kwargs: static_kwargs)
340340
endif
341341
libnfs = not_found
342342
if not get_option('libnfs').auto() or have_block
@@ -2821,7 +2821,7 @@ summary_info += {'bzip2 support': libbzip2.found()}
28212821
summary_info += {'lzfse support': liblzfse.found()}
28222822
summary_info += {'zstd support': zstd.found()}
28232823
summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
2824-
summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')}
2824+
summary_info += {'libxml2': libxml2.found()}
28252825
summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt}
28262826
summary_info += {'libpmem support': libpmem.found()}
28272827
summary_info += {'libdaxctl support': libdaxctl.found()}

meson_options.txt

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ option('libudev', type : 'feature', value : 'auto',
9292
description: 'Use libudev to enumerate host devices')
9393
option('libusb', type : 'feature', value : 'auto',
9494
description: 'libusb support for USB passthrough')
95+
option('libxml2', type : 'feature', value : 'auto',
96+
description: 'libxml2 support for Parallels image format')
9597
option('linux_io_uring', type : 'feature', value : 'auto',
9698
description: 'Linux io_uring support')
9799
option('lzfse', type : 'feature', value : 'auto',

0 commit comments

Comments
 (0)