1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-18 10:03:48 +03:00

meson: properly handle libpcap if it's explicitly disabled

If libpcap is detected using pkg-config it would ignore the libpcap
option.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Pavel Hrdina 2020-10-08 13:09:45 +02:00
parent 87e855a4e9
commit c8be9ccc36

View File

@ -1101,17 +1101,22 @@ if libparted_dep.found()
endif endif
libpcap_version = '1.5.0' libpcap_version = '1.5.0'
libpcap_dep = dependency('libpcap', version: '>=' + libpcap_version, required: false) if not get_option('libpcap').disabled()
if not libpcap_dep.found() libpcap_dep = dependency('libpcap', version: '>=' + libpcap_version, required: false)
pcap_config_prog = find_program('pcap-config', required: get_option('libpcap'))
if pcap_config_prog.found() if not libpcap_dep.found()
pcap_args = run_command(pcap_config_prog, '--cflags').stdout().strip().split() pcap_config_prog = find_program('pcap-config', required: get_option('libpcap'))
pcap_libs = run_command(pcap_config_prog, '--libs').stdout().strip().split() if pcap_config_prog.found()
libpcap_dep = declare_dependency( pcap_args = run_command(pcap_config_prog, '--cflags').stdout().strip().split()
compile_args: pcap_args, pcap_libs = run_command(pcap_config_prog, '--libs').stdout().strip().split()
link_args: pcap_libs, libpcap_dep = declare_dependency(
) compile_args: pcap_args,
link_args: pcap_libs,
)
endif
endif endif
else
libpcap_dep = dependency('', required: false)
endif endif
if libpcap_dep.found() if libpcap_dep.found()
conf.set('WITH_LIBPCAP', 1) conf.set('WITH_LIBPCAP', 1)