net/mlx: fix library search in meson build
authorYongseok Koh <yskoh@mellanox.com>
Thu, 18 Apr 2019 11:49:02 +0000 (04:49 -0700)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 18 Apr 2019 16:22:42 +0000 (18:22 +0200)
If MLNX_OFED is installed, there's no .pc file installed for libraries and
dependency() can't find libraries by pkg-config. By adding fallback of
using cc.find_library(), libraries are properly located.

Fixes: e30b4e566f47 ("build: improve dependency handling")
Cc: stable@dpdk.org
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Luca Boccassi <bluca@debian.org>
drivers/net/mlx4/meson.build
drivers/net/mlx5/meson.build

index de02070..2540489 100644 (file)
@@ -13,14 +13,17 @@ if pmd_dlopen
                '-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
        ]
 endif
-libs = [
-       dependency('libmnl', required:false),
-       dependency('libmlx4', required:false),
-       dependency('libibverbs', required:false),
-]
+libnames = [ 'mnl', 'mlx4', 'ibverbs' ]
+libs = []
 build = true
-foreach lib:libs
+foreach libname:libnames
+       lib = dependency('lib' + libname, required:false)
        if not lib.found()
+               lib = cc.find_library(libname, required:false)
+       endif
+       if lib.found()
+               libs += [ lib ]
+       else
                build = false
        endif
 endforeach
index a4c684e..1a65c3a 100644 (file)
@@ -13,14 +13,17 @@ if pmd_dlopen
                '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
        ]
 endif
-libs = [
-       dependency('libmnl', required:false),
-       dependency('libmlx5', required:false),
-       dependency('libibverbs', required:false),
-]
+libnames = [ 'mnl', 'mlx5', 'ibverbs' ]
+libs = []
 build = true
-foreach lib:libs
+foreach libname:libnames
+       lib = dependency('lib' + libname, required:false)
        if not lib.found()
+               lib = cc.find_library(libname, required:false)
+       endif
+       if lib.found()
+               libs += [ lib ]
+       else
                build = false
        endif
 endforeach