build: improve libbsd dependency handling
authorLuca Boccassi <bluca@debian.org>
Tue, 26 Feb 2019 17:46:35 +0000 (17:46 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 27 Feb 2019 11:28:03 +0000 (12:28 +0100)
Use dependency() instead of manual append to ldflags.

Move libbsd inclusion to librte_eal, so that all other libraries and
PMDs will inherit it.

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

index b91778e..0419607 100644 (file)
@@ -76,11 +76,11 @@ if numa_dep.found() and cc.has_header('numaif.h')
 endif
 
 # check for strlcpy
-if host_machine.system() == 'linux' and cc.find_library('bsd',
-               required: false).found() and cc.has_header('bsd/string.h')
-       dpdk_conf.set('RTE_USE_LIBBSD', 1)
-       add_project_link_arguments('-lbsd', language: 'c')
-       dpdk_extra_ldflags += '-lbsd'
+if host_machine.system() == 'linux'
+       libbsd = dependency('libbsd', required: false)
+       if libbsd.found()
+               dpdk_conf.set('RTE_USE_LIBBSD', 1)
+       endif
 endif
 
 # add -include rte_config to cflags
index 64d857a..98c1d1f 100644 (file)
@@ -24,6 +24,9 @@ endif
 version = 9  # the version of the EAL API
 allow_experimental_apis = true
 deps += 'kvargs'
+if dpdk_conf.has('RTE_USE_LIBBSD')
+       ext_deps += libbsd
+endif
 sources = common_sources + env_sources
 objs = common_objs + env_objs
 headers = common_headers + env_headers