crypto/nitrox: support 3DES-CBC
[dpdk.git] / drivers / net / mlx4 / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright 2018 6WIND S.A.
3 # Copyright 2018 Mellanox Technologies, Ltd
4
5 if not is_linux
6         build = false
7         reason = 'only supported on Linux'
8         subdir_done()
9 endif
10
11 static_ibverbs = (get_option('ibverbs_link') == 'static')
12 dlopen_ibverbs = (get_option('ibverbs_link') == 'dlopen')
13 LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so'
14 LIB_GLUE_VERSION = '18.02.0'
15 LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
16 if dlopen_ibverbs
17         dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1)
18         cflags += [
19                 '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
20                 '-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
21         ]
22 endif
23
24 libnames = [ 'mlx4', 'ibverbs' ]
25 libs = []
26 foreach libname:libnames
27         lib = dependency('lib' + libname, static:static_ibverbs, required:false)
28         if not lib.found() and not static_ibverbs
29                 lib = cc.find_library(libname, required:false)
30         endif
31         if lib.found()
32                 libs += lib
33                 if not static_ibverbs and not dlopen_ibverbs
34                         ext_deps += lib
35                 endif
36         else
37                 build = false
38                 reason = 'missing dependency, "' + libname + '"'
39                 subdir_done()
40         endif
41 endforeach
42 if static_ibverbs or dlopen_ibverbs
43         # Build without adding shared libs to Requires.private
44         ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout()
45         ext_deps += declare_dependency(compile_args: ibv_cflags.split())
46 endif
47 if static_ibverbs
48         # Add static deps ldflags to internal apps and Libs.private
49         ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout()
50         ext_deps += declare_dependency(link_args:ibv_ldflags.split())
51 endif
52
53 allow_experimental_apis = true
54 sources = files(
55         'mlx4.c',
56         'mlx4_ethdev.c',
57         'mlx4_flow.c',
58         'mlx4_intr.c',
59         'mlx4_mp.c',
60         'mlx4_mr.c',
61         'mlx4_rxq.c',
62         'mlx4_rxtx.c',
63         'mlx4_txq.c',
64         'mlx4_utils.c',
65 )
66 if not dlopen_ibverbs
67         sources += files('mlx4_glue.c')
68 endif
69 cflags_options = [
70         '-std=c11',
71         '-Wno-strict-prototypes',
72         '-D_BSD_SOURCE',
73         '-D_DEFAULT_SOURCE',
74         '-D_XOPEN_SOURCE=600'
75 ]
76 foreach option:cflags_options
77         if cc.has_argument(option)
78                 cflags += option
79         endif
80 endforeach
81 if get_option('buildtype').contains('debug')
82         cflags += [ '-pedantic', '-DPEDANTIC' ]
83 else
84         cflags += [ '-UPEDANTIC' ]
85 endif
86 # To maintain the compatibility with the make build system
87 # mlx4_autoconf.h file is still generated.
88 # input array for meson member search:
89 # [ "MACRO to define if found", "header for the search",
90 #   "symbol to search", "struct member to search" ]
91 #
92 has_member_args = [
93         [ 'HAVE_IBV_MLX4_WQE_LSO_SEG', 'infiniband/mlx4dv.h',
94         'struct mlx4_wqe_lso_seg', 'mss_hdr_size' ],
95 ]
96 # input array for meson symbol search:
97 # [ "MACRO to define if found", "header for the search",
98 #   "symbol to search" ]
99 has_sym_args = [
100         [ 'HAVE_IBV_MLX4_BUF_ALLOCATORS', 'infiniband/mlx4dv.h',
101         'MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS' ],
102         [ 'HAVE_IBV_MLX4_UAR_MMAP_OFFSET', 'infiniband/mlx4dv.h',
103         'MLX4DV_QP_MASK_UAR_MMAP_OFFSET' ],
104 ]
105 config = configuration_data()
106 foreach arg:has_sym_args
107         config.set(arg[0], cc.has_header_symbol(arg[1], arg[2],
108                 dependencies: libs))
109 endforeach
110 foreach arg:has_member_args
111         file_prefix = '#include <' + arg[1] + '>'
112         config.set(arg[0], cc.has_member(arg[2], arg[3],
113                 prefix: file_prefix, dependencies: libs))
114 endforeach
115 configure_file(output : 'mlx4_autoconf.h', configuration : config)
116
117 # Build Glue Library
118 if dlopen_ibverbs
119         dlopen_name = 'mlx4_glue'
120         dlopen_lib_name = driver_name_fmt.format(dlopen_name)
121         dlopen_so_version = LIB_GLUE_VERSION
122         dlopen_sources = files('mlx4_glue.c')
123         dlopen_install_dir = [ eal_pmd_path + '-glue' ]
124         shared_lib = shared_library(
125                 dlopen_lib_name,
126                 dlopen_sources,
127                 include_directories: global_inc,
128                 c_args: cflags,
129                 dependencies: libs,
130                 link_args: [
131                 '-Wl,-export-dynamic',
132                 '-Wl,-h,@0@'.format(LIB_GLUE),
133                 ],
134                 soversion: dlopen_so_version,
135                 install: true,
136                 install_dir: dlopen_install_dir,
137         )
138 endif