]> git.droids-corp.org - dpdk.git/commitdiff
build: detect and use libnuma
authorBruce Richardson <bruce.richardson@intel.com>
Thu, 12 Oct 2017 14:02:27 +0000 (15:02 +0100)
committerBruce Richardson <bruce.richardson@intel.com>
Tue, 30 Jan 2018 20:58:59 +0000 (21:58 +0100)
DPDK has an optional dependency on libnuma, so manage that through the
build system, by dynamically detecting the presence of the needed library
and header files. Since this library is used by both EAL and vhost, check
for the presence at the top level in the config directory.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Luca Boccassi <bluca@debian.org>
config/meson.build
lib/librte_eal/linuxapp/eal/meson.build
lib/librte_vhost/meson.build

index 2e0f581f87e80e89853cf22fe20189a91ff61f67..f0d74d4a3934c6dfec131d5415f267d25fe28cbb 100644 (file)
@@ -37,6 +37,16 @@ add_project_arguments('-march=@0@'.format(machine), language: 'c')
 add_project_link_arguments('-lm', language: 'c')
 dpdk_extra_ldflags += '-lm'
 
+# check for libraries used in multiple places in DPDK
+has_libnuma = 0
+numa_dep = cc.find_library('numa', required: false)
+if numa_dep.found() and cc.has_header('numaif.h')
+       dpdk_conf.set10('RTE_HAS_LIBNUMA', true)
+       has_libnuma = 1
+       add_project_link_arguments('-lnuma', language: 'c')
+       dpdk_extra_ldflags += '-lnuma'
+endif
+
 # add -include rte_config to cflags
 add_project_arguments('-include', 'rte_config.h', language: 'c')
 
index d4be55714df56c5023a2f0321aee11ef952fd4b1..9f1cbbfe0bf52df3ee83838409ad1d755b4eab87 100644 (file)
@@ -47,6 +47,9 @@ sources = ['eal_alarm.c',
 ]
 
 eal_extra_link_arg = '-ldl'
+if has_libnuma == 1
+       dpdk_conf.set10('RTE_EAL_NUMA_AWARE_HUGEPAGES', true)
+endif
 
 if get_option('per_library_versions')
        lib_version = '@0@.1'.format(version)
index 529b0aea3bf3f5e029cd111e002b7cf6b8f6e486..6ae4d36ba81107432dfd15c82efa5d15dd766293 100644 (file)
@@ -32,6 +32,9 @@
 if host_machine.system() != 'linux'
        build = false
 endif
+if has_libnuma == 1
+       dpdk_conf.set10('RTE_LIBRTE_VHOST_NUMA', true)
+endif
 version = 4
 allow_experimental_apis = true
 sources = files('fd_man.c', 'iotlb.c', 'socket.c', 'vhost.c', 'vhost_user.c',