default_cflags = machine_args
-# specify -D_GNU_SOURCE unconditionally
-default_cflags += '-D_GNU_SOURCE'
-
foreach app:apps
build = true
name = app
# enable VFIO only if it is linux OS
dpdk_conf.set('RTE_EAL_VFIO', is_linux)
+
+# specify -D_GNU_SOURCE unconditionally
+add_project_arguments('-D_GNU_SOURCE', language: 'c')
+
+# specify -D__BSD_VISIBLE for FreeBSD
+if is_freebsd
+ add_project_arguments('-D__BSD_VISIBLE', language: 'c')
+endif
default_cflags += '-Wno-format-truncation'
endif
-# specify -D_GNU_SOURCE unconditionally
-default_cflags += '-D_GNU_SOURCE'
-
foreach class:dpdk_driver_classes
drivers = []
std_deps = []
default_cflags += '-Wno-format-truncation'
endif
-# specify -D_GNU_SOURCE unconditionally
-default_cflags += '-D_GNU_SOURCE'
-
foreach example: examples
name = example.split('/')[-1]
build = true
enabled_libs = [] # used to print summary at the end
-# -D_GNU_SOURCE unconditionally
-default_cflags += '-D_GNU_SOURCE'
-
foreach l:libraries
build = true
name = l
dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
pkg = import('pkgconfig')
+pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args
+if is_freebsd
+ pkg_extra_cflags += ['-D__BSD_VISIBLE']
+endif
pkg.generate(name: meson.project_name(),
filebase: 'lib' + meson.project_name().to_lower(),
version: meson.project_version(),
Note that CFLAGS might contain an -march flag higher than typical baseline.
This is required for a number of static inline functions in the public headers.''',
subdirs: [get_option('include_subdir_arch'), '.'],
- extra_cflags: ['-include', 'rte_config.h'] + machine_args
+ extra_cflags: pkg_extra_cflags
)
# final output, list all the libs and drivers to be built
# always define _GNU_SOURCE
CFLAGS += -D_GNU_SOURCE
+# define __BSD_VISIBLE when building for FreeBSD
+ifeq ($(CONFIG_RTE_EXEC_ENV_FREEBSD),y)
+CFLAGS += -D__BSD_VISIBLE
+endif
+
export CFLAGS
export LDFLAGS