On Sun, Mar 29, 2020 at 08:13:10PM +0530, jer...@marvell.com wrote:
> From: Pavan Nikhilesh <pbhagavat...@marvell.com>
> 
> Add libatomic as a global dependency when compiling for 32-bit using
> clang. As we need libatomic for 64-bit atomic ops.
> 
> Cc: bruce.richard...@intel.com
> Signed-off-by: Pavan Nikhilesh <pbhagavat...@marvell.com>
> ---
>  config/meson.build                  | 10 ++++++++++
>  drivers/event/octeontx/meson.build  |  5 -----
>  drivers/event/octeontx2/meson.build |  5 -----
>  drivers/event/opdl/meson.build      |  5 -----
>  examples/l2fwd-event/meson.build    |  5 -----
>  lib/librte_distributor/meson.build  |  5 -----
>  lib/librte_rcu/meson.build          |  5 -----
>  7 files changed, 10 insertions(+), 30 deletions(-)
> 
> diff --git a/config/meson.build b/config/meson.build
> index abedd76f2..6e5530110 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -173,6 +173,16 @@ if pcap_dep.found() and cc.has_header('pcap.h', 
> dependencies: pcap_dep)
>       dpdk_extra_ldflags += '-lpcap'
>  endif
>  
> +
> +# for clang 32-bit compiles we need libatomic for 64-bit atomic ops
> +if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false
> +     atomic_dep = cc.find_library('atomic', required: true)
> +     if atomic_dep.found()
> +             add_project_link_arguments('-latomic', language: 'c')
> +             dpdk_extra_ldflags += '-latomic'
> +     endif
> +endif
> +

Minor nit, you don't need to check for .found(), since the configure will
fail if it's not found, since "required" is set to true.

For cleanliness, you may also be able to use get_pkgconfig_variable() or
get_configtool_variable() to get -latomic, rather than hard-coding it,
though in this case I suspect hard-coding is fine.

With the superfluous if removed

Acked-by: Bruce Richardson <bruce.richard...@intel.com>

Reply via email to