[v3,4/4] build: use dependency() for libbsd instead of manual append to ldflags

Message ID 20190111162608.13162-4-bluca@debian.org
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series
  • [v3,1/4] build: bump minimum Meson version to 0.47.1
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Luca Boccassi Jan. 11, 2019, 4:26 p.m.
Move libbsd inclusion to librte_eal, so that all other libraries and
PMDs will inherit it.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
v3: only add dependency to librte_eal and let it propagate from there

 config/meson.build         | 10 +++++-----
 lib/librte_eal/meson.build |  3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

Comments

Bruce Richardson Jan. 11, 2019, 5:24 p.m. | #1
On Fri, Jan 11, 2019 at 04:26:08PM +0000, Luca Boccassi wrote:
> Move libbsd inclusion to librte_eal, so that all other libraries and
> PMDs will inherit it.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> v3: only add dependency to librte_eal and let it propagate from there
> 
>  config/meson.build         | 10 +++++-----
>  lib/librte_eal/meson.build |  3 +++
>  2 files changed, 8 insertions(+), 5 deletions(-)
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Patch

diff --git a/config/meson.build b/config/meson.build
index db32499b3..e1af468ee 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -74,11 +74,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
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index a18f3a826..fa60736c9 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -25,6 +25,9 @@  version = 9  # the version of the EAL API
 allow_experimental_apis = true
 deps += 'compat'
 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