diff mbox

[libdrm] meson: use pkg-config to detect libatomic_ops

Message ID 20180207142433.11640-1-eric.engestrom@imgtec.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Engestrom Feb. 7, 2018, 2:24 p.m. UTC
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 amdgpu/meson.build    | 2 +-
 etnaviv/meson.build   | 2 +-
 freedreno/meson.build | 2 +-
 intel/meson.build     | 2 +-
 meson.build           | 3 ++-
 nouveau/meson.build   | 2 +-
 omap/meson.build      | 2 +-
 radeon/meson.build    | 2 +-
 tegra/meson.build     | 2 +-
 9 files changed, 10 insertions(+), 9 deletions(-)

Comments

Eric Engestrom March 5, 2018, 12:03 p.m. UTC | #1
Ping? :)
Both for this patch and the equivalent autotools patch it replies to.

On Wednesday, 2018-02-07 14:24:33 +0000, Eric Engestrom wrote:
> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> ---
>  amdgpu/meson.build    | 2 +-
>  etnaviv/meson.build   | 2 +-
>  freedreno/meson.build | 2 +-
>  intel/meson.build     | 2 +-
>  meson.build           | 3 ++-
>  nouveau/meson.build   | 2 +-
>  omap/meson.build      | 2 +-
>  radeon/meson.build    | 2 +-
>  tegra/meson.build     | 2 +-
>  9 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/amdgpu/meson.build b/amdgpu/meson.build
> index 8b0452056e2513892c2c..7040ebab86e271022323 100644
> --- a/amdgpu/meson.build
> +++ b/amdgpu/meson.build
> @@ -37,7 +37,7 @@ libdrm_amdgpu = shared_library(
>    ],
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
> -  dependencies : dep_pthread_stubs,
> +  dependencies : [dep_pthread_stubs, dep_atomic_ops],
>    version : '1.0.0',
>    install : true,
>  )
> diff --git a/etnaviv/meson.build b/etnaviv/meson.build
> index 1767733bd510efdaad86..ca2aa544c58924a15d8b 100644
> --- a/etnaviv/meson.build
> +++ b/etnaviv/meson.build
> @@ -31,7 +31,7 @@ libdrm_etnaviv = shared_library(
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
>    c_args : warn_c_args,
> -  dependencies : [dep_pthread_stubs, dep_rt],
> +  dependencies : [dep_pthread_stubs, dep_rt, dep_atomic_ops],
>    version : '1.0.0',
>    install : true,
>  )
> diff --git a/freedreno/meson.build b/freedreno/meson.build
> index de6a413fa93e63c0ad4a..da993c10355578838f29 100644
> --- a/freedreno/meson.build
> +++ b/freedreno/meson.build
> @@ -44,7 +44,7 @@ libdrm_freedreno = shared_library(
>    [files_freedreno, config_file],
>    c_args : warn_c_args,
>    include_directories : [inc_root, inc_drm],
> -  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt],
> +  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt, dep_atomic_ops],
>    link_with : libdrm,
>    version : '1.0.0',
>    install : true,
> diff --git a/intel/meson.build b/intel/meson.build
> index ad877274f8d488a80d54..42402f60e38cd5e7359f 100644
> --- a/intel/meson.build
> +++ b/intel/meson.build
> @@ -29,7 +29,7 @@ libdrm_intel = shared_library(
>    ],
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
> -  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind],
> +  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind, dep_atomic_ops],
>    c_args : warn_c_args,
>    version : '1.0.0',
>    install : true,
> diff --git a/meson.build b/meson.build
> index a19e600c7475b2578e2d..f45c14a70baa2456582d 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -51,6 +51,7 @@ cc = meson.get_compiler('c')
>  intel_atomics = false
>  lib_atomics = false
>  
> +dep_atomic_ops = dependency('atomic_ops', required : false)
>  if cc.compiles('''
>      int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
>      int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
> @@ -58,7 +59,7 @@ if cc.compiles('''
>      name : 'Intel Atomics')
>    intel_atomics = true
>    with_atomics = true

Change added here locally; there's no need to link again `dep_atomic_ops`
in this branch, although it doesn't hurt:

+	dep_atomic_ops = []

> -elif cc.has_header('atomic_ops.h')
> +elif dep_atomic_ops.found()
>    lib_atomics = true
>    with_atomics = true
>  elif cc.has_function('atomic_cas_uint')
> diff --git a/nouveau/meson.build b/nouveau/meson.build
> index f031cd63b71bab9f7e7a..b8affd9ef776c99ba896 100644
> --- a/nouveau/meson.build
> +++ b/nouveau/meson.build
> @@ -25,7 +25,7 @@ libdrm_nouveau = shared_library(
>    c_args : warn_c_args,
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
> -  dependencies : dep_threads,
> +  dependencies : [dep_threads, dep_atomic_ops],
>    version : '2.0.0',
>    install : true,
>  )
> diff --git a/omap/meson.build b/omap/meson.build
> index 1881087fb0d180b668d3..f89436f0e99970b381aa 100644
> --- a/omap/meson.build
> +++ b/omap/meson.build
> @@ -24,7 +24,7 @@ libdrm_omap = shared_library(
>    include_directories : [inc_root, inc_drm],
>    c_args : warn_c_args,
>    link_with : libdrm,
> -  dependencies : [dep_pthread_stubs],
> +  dependencies : [dep_pthread_stubs, dep_atomic_ops],
>    version : '1.0.0',
>    install : true,
>  )
> diff --git a/radeon/meson.build b/radeon/meson.build
> index b02166fe87ea27470e4b..557a878042bb78df4096 100644
> --- a/radeon/meson.build
> +++ b/radeon/meson.build
> @@ -31,7 +31,7 @@ libdrm_radeon = shared_library(
>    c_args : warn_c_args,
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
> -  dependencies : [dep_pthread_stubs],
> +  dependencies : [dep_pthread_stubs, dep_atomic_ops],
>    version : '1.0.1',
>    install : true,
>  )
> diff --git a/tegra/meson.build b/tegra/meson.build
> index 99fdd194f50aceb6858b..7ac815177718d301b76c 100644
> --- a/tegra/meson.build
> +++ b/tegra/meson.build
> @@ -23,7 +23,7 @@ libdrm_tegra = shared_library(
>    [files('tegra.c'), config_file],
>    include_directories : [inc_root, inc_drm],
>    link_with : libdrm,
> -  dependencies : [dep_pthread_stubs],
> +  dependencies : [dep_pthread_stubs, dep_atomic_ops],
>    c_args : warn_c_args,
>    version : '0.0.0',
>    install : true,
> -- 
> Cheers,
>   Eric
>
Emil Velikov March 8, 2018, 6:10 p.m. UTC | #2
On 5 March 2018 at 12:03, Eric Engestrom <eric.engestrom@imgtec.com> wrote:
> Ping? :)
> Both for this patch and the equivalent autotools patch it replies to.
>
The autotools one needs the CFLAGS added - meson does it automatically for us.

> On Wednesday, 2018-02-07 14:24:33 +0000, Eric Engestrom wrote:
>> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
>> ---
>>  amdgpu/meson.build    | 2 +-
>>  etnaviv/meson.build   | 2 +-
>>  freedreno/meson.build | 2 +-
>>  intel/meson.build     | 2 +-
>>  meson.build           | 3 ++-
>>  nouveau/meson.build   | 2 +-
>>  omap/meson.build      | 2 +-
>>  radeon/meson.build    | 2 +-
>>  tegra/meson.build     | 2 +-
>>  9 files changed, 10 insertions(+), 9 deletions(-)
>>
>> diff --git a/amdgpu/meson.build b/amdgpu/meson.build
>> index 8b0452056e2513892c2c..7040ebab86e271022323 100644
>> --- a/amdgpu/meson.build
>> +++ b/amdgpu/meson.build
>> @@ -37,7 +37,7 @@ libdrm_amdgpu = shared_library(
>>    ],
>>    include_directories : [inc_root, inc_drm],
>>    link_with : libdrm,
>> -  dependencies : dep_pthread_stubs,
>> +  dependencies : [dep_pthread_stubs, dep_atomic_ops],
>>    version : '1.0.0',
>>    install : true,
>>  )
>> diff --git a/etnaviv/meson.build b/etnaviv/meson.build
>> index 1767733bd510efdaad86..ca2aa544c58924a15d8b 100644
>> --- a/etnaviv/meson.build
>> +++ b/etnaviv/meson.build
>> @@ -31,7 +31,7 @@ libdrm_etnaviv = shared_library(
>>    include_directories : [inc_root, inc_drm],
>>    link_with : libdrm,
>>    c_args : warn_c_args,
>> -  dependencies : [dep_pthread_stubs, dep_rt],
>> +  dependencies : [dep_pthread_stubs, dep_rt, dep_atomic_ops],
>>    version : '1.0.0',
>>    install : true,
>>  )
>> diff --git a/freedreno/meson.build b/freedreno/meson.build
>> index de6a413fa93e63c0ad4a..da993c10355578838f29 100644
>> --- a/freedreno/meson.build
>> +++ b/freedreno/meson.build
>> @@ -44,7 +44,7 @@ libdrm_freedreno = shared_library(
>>    [files_freedreno, config_file],
>>    c_args : warn_c_args,
>>    include_directories : [inc_root, inc_drm],
>> -  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt],
>> +  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt, dep_atomic_ops],
>>    link_with : libdrm,
>>    version : '1.0.0',
>>    install : true,
>> diff --git a/intel/meson.build b/intel/meson.build
>> index ad877274f8d488a80d54..42402f60e38cd5e7359f 100644
>> --- a/intel/meson.build
>> +++ b/intel/meson.build
>> @@ -29,7 +29,7 @@ libdrm_intel = shared_library(
>>    ],
>>    include_directories : [inc_root, inc_drm],
>>    link_with : libdrm,
>> -  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind],
>> +  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind, dep_atomic_ops],
>>    c_args : warn_c_args,
>>    version : '1.0.0',
>>    install : true,
>> diff --git a/meson.build b/meson.build
>> index a19e600c7475b2578e2d..f45c14a70baa2456582d 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -51,6 +51,7 @@ cc = meson.get_compiler('c')
>>  intel_atomics = false
>>  lib_atomics = false
>>
>> +dep_atomic_ops = dependency('atomic_ops', required : false)
>>  if cc.compiles('''
>>      int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
>>      int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
>> @@ -58,7 +59,7 @@ if cc.compiles('''
>>      name : 'Intel Atomics')
>>    intel_atomics = true
>>    with_atomics = true
>
> Change added here locally; there's no need to link again `dep_atomic_ops`
> in this branch, although it doesn't hurt:
>
> +       dep_atomic_ops = []
>
The dummy dep_atomic_ops is needed for almost all cases in the if/else
ladder. The exception being the .found() case.

With that
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

-Emil
Eric Engestrom March 9, 2018, 11:47 a.m. UTC | #3
On Thursday, 2018-03-08 18:10:03 +0000, Emil Velikov wrote:
> On 5 March 2018 at 12:03, Eric Engestrom <eric.engestrom@imgtec.com> wrote:
> > Ping? :)
> > Both for this patch and the equivalent autotools patch it replies to.
> >
> The autotools one needs the CFLAGS added - meson does it automatically for us.

I'll let Peter re-spin his patch, but I might push the meson one before
his lands.

> 
> > On Wednesday, 2018-02-07 14:24:33 +0000, Eric Engestrom wrote:
> >> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> >> ---
> >>  amdgpu/meson.build    | 2 +-
> >>  etnaviv/meson.build   | 2 +-
> >>  freedreno/meson.build | 2 +-
> >>  intel/meson.build     | 2 +-
> >>  meson.build           | 3 ++-
> >>  nouveau/meson.build   | 2 +-
> >>  omap/meson.build      | 2 +-
> >>  radeon/meson.build    | 2 +-
> >>  tegra/meson.build     | 2 +-
> >>  9 files changed, 10 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/amdgpu/meson.build b/amdgpu/meson.build
> >> index 8b0452056e2513892c2c..7040ebab86e271022323 100644
> >> --- a/amdgpu/meson.build
> >> +++ b/amdgpu/meson.build
> >> @@ -37,7 +37,7 @@ libdrm_amdgpu = shared_library(
> >>    ],
> >>    include_directories : [inc_root, inc_drm],
> >>    link_with : libdrm,
> >> -  dependencies : dep_pthread_stubs,
> >> +  dependencies : [dep_pthread_stubs, dep_atomic_ops],
> >>    version : '1.0.0',
> >>    install : true,
> >>  )
> >> diff --git a/etnaviv/meson.build b/etnaviv/meson.build
> >> index 1767733bd510efdaad86..ca2aa544c58924a15d8b 100644
> >> --- a/etnaviv/meson.build
> >> +++ b/etnaviv/meson.build
> >> @@ -31,7 +31,7 @@ libdrm_etnaviv = shared_library(
> >>    include_directories : [inc_root, inc_drm],
> >>    link_with : libdrm,
> >>    c_args : warn_c_args,
> >> -  dependencies : [dep_pthread_stubs, dep_rt],
> >> +  dependencies : [dep_pthread_stubs, dep_rt, dep_atomic_ops],
> >>    version : '1.0.0',
> >>    install : true,
> >>  )
> >> diff --git a/freedreno/meson.build b/freedreno/meson.build
> >> index de6a413fa93e63c0ad4a..da993c10355578838f29 100644
> >> --- a/freedreno/meson.build
> >> +++ b/freedreno/meson.build
> >> @@ -44,7 +44,7 @@ libdrm_freedreno = shared_library(
> >>    [files_freedreno, config_file],
> >>    c_args : warn_c_args,
> >>    include_directories : [inc_root, inc_drm],
> >> -  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt],
> >> +  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt, dep_atomic_ops],
> >>    link_with : libdrm,
> >>    version : '1.0.0',
> >>    install : true,
> >> diff --git a/intel/meson.build b/intel/meson.build
> >> index ad877274f8d488a80d54..42402f60e38cd5e7359f 100644
> >> --- a/intel/meson.build
> >> +++ b/intel/meson.build
> >> @@ -29,7 +29,7 @@ libdrm_intel = shared_library(
> >>    ],
> >>    include_directories : [inc_root, inc_drm],
> >>    link_with : libdrm,
> >> -  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind],
> >> +  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind, dep_atomic_ops],
> >>    c_args : warn_c_args,
> >>    version : '1.0.0',
> >>    install : true,
> >> diff --git a/meson.build b/meson.build
> >> index a19e600c7475b2578e2d..f45c14a70baa2456582d 100644
> >> --- a/meson.build
> >> +++ b/meson.build
> >> @@ -51,6 +51,7 @@ cc = meson.get_compiler('c')
> >>  intel_atomics = false
> >>  lib_atomics = false
> >>
> >> +dep_atomic_ops = dependency('atomic_ops', required : false)
> >>  if cc.compiles('''
> >>      int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
> >>      int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
> >> @@ -58,7 +59,7 @@ if cc.compiles('''
> >>      name : 'Intel Atomics')
> >>    intel_atomics = true
> >>    with_atomics = true
> >
> > Change added here locally; there's no need to link again `dep_atomic_ops`
> > in this branch, although it doesn't hurt:
> >
> > +       dep_atomic_ops = []
> >
> The dummy dep_atomic_ops is needed for almost all cases in the if/else
> ladder. The exception being the .found() case.

Actually, because of the way the `if` chain is written, the dep_atomic_ops
has to be created before the list; in the `if` cases before this one,
that dep might exist, but we don't need it. In the branch that uses it,
if we got in the branch then it exists, and we need it. In the branches
after that, it doesn't exist and we don't need it either.

That means that only up to that branch can it contain anything;
afterwards, it's empty anyway.

And like I said, it only has the effect of maybe on the branches before
adding unused flags to the compiler & linker, which shouldn't have any
effect anyway.

> 
> With that
> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

With the explanation, does your r-b stand for the current version?
Emil Velikov March 9, 2018, 3:48 p.m. UTC | #4
On 9 March 2018 at 11:47, Eric Engestrom <eric.engestrom@imgtec.com> wrote:

>> > +       dep_atomic_ops = []
>> >
>> The dummy dep_atomic_ops is needed for almost all cases in the if/else
>> ladder. The exception being the .found() case.
>
> Actually, because of the way the `if` chain is written, the dep_atomic_ops
> has to be created before the list; in the `if` cases before this one,
> that dep might exist, but we don't need it. In the branch that uses it,
> if we got in the branch then it exists, and we need it. In the branches
> after that, it doesn't exist and we don't need it either.
>
> That means that only up to that branch can it contain anything;
> afterwards, it's empty anyway.
>
> And like I said, it only has the effect of maybe on the branches before
> adding unused flags to the compiler & linker, which shouldn't have any
> effect anyway.
>
Let me see if I get this right:

You're saying that when dep_atomic_ops.found() == false, the
dep_atomic_ops dependency listed in the respective will expand to
no-op.
I wasn't quite sure if that's the case, hence my pedantic suggestion ;-)

Makes sense though, rb still stands.

Thanks Eric!

-Emil
Eric Engestrom March 9, 2018, 4:57 p.m. UTC | #5
On Friday, 2018-03-09 15:48:51 +0000, Emil Velikov wrote:
> On 9 March 2018 at 11:47, Eric Engestrom <eric.engestrom@imgtec.com> wrote:
> 
> >> > +       dep_atomic_ops = []
> >> >
> >> The dummy dep_atomic_ops is needed for almost all cases in the if/else
> >> ladder. The exception being the .found() case.
> >
> > Actually, because of the way the `if` chain is written, the dep_atomic_ops
> > has to be created before the list; in the `if` cases before this one,
> > that dep might exist, but we don't need it. In the branch that uses it,
> > if we got in the branch then it exists, and we need it. In the branches
> > after that, it doesn't exist and we don't need it either.
> >
> > That means that only up to that branch can it contain anything;
> > afterwards, it's empty anyway.
> >
> > And like I said, it only has the effect of maybe on the branches before
> > adding unused flags to the compiler & linker, which shouldn't have any
> > effect anyway.
> >
> Let me see if I get this right:
> 
> You're saying that when dep_atomic_ops.found() == false, the
> dep_atomic_ops dependency listed in the respective will expand to
> no-op.
> I wasn't quite sure if that's the case, hence my pedantic suggestion ;-)

Exactly :)

> 
> Makes sense though, rb still stands.

OK, pushing in a minute

> 
> Thanks Eric!
> 
> -Emil
diff mbox

Patch

diff --git a/amdgpu/meson.build b/amdgpu/meson.build
index 8b0452056e2513892c2c..7040ebab86e271022323 100644
--- a/amdgpu/meson.build
+++ b/amdgpu/meson.build
@@ -37,7 +37,7 @@  libdrm_amdgpu = shared_library(
   ],
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
-  dependencies : dep_pthread_stubs,
+  dependencies : [dep_pthread_stubs, dep_atomic_ops],
   version : '1.0.0',
   install : true,
 )
diff --git a/etnaviv/meson.build b/etnaviv/meson.build
index 1767733bd510efdaad86..ca2aa544c58924a15d8b 100644
--- a/etnaviv/meson.build
+++ b/etnaviv/meson.build
@@ -31,7 +31,7 @@  libdrm_etnaviv = shared_library(
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
   c_args : warn_c_args,
-  dependencies : [dep_pthread_stubs, dep_rt],
+  dependencies : [dep_pthread_stubs, dep_rt, dep_atomic_ops],
   version : '1.0.0',
   install : true,
 )
diff --git a/freedreno/meson.build b/freedreno/meson.build
index de6a413fa93e63c0ad4a..da993c10355578838f29 100644
--- a/freedreno/meson.build
+++ b/freedreno/meson.build
@@ -44,7 +44,7 @@  libdrm_freedreno = shared_library(
   [files_freedreno, config_file],
   c_args : warn_c_args,
   include_directories : [inc_root, inc_drm],
-  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt],
+  dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt, dep_atomic_ops],
   link_with : libdrm,
   version : '1.0.0',
   install : true,
diff --git a/intel/meson.build b/intel/meson.build
index ad877274f8d488a80d54..42402f60e38cd5e7359f 100644
--- a/intel/meson.build
+++ b/intel/meson.build
@@ -29,7 +29,7 @@  libdrm_intel = shared_library(
   ],
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
-  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind],
+  dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind, dep_atomic_ops],
   c_args : warn_c_args,
   version : '1.0.0',
   install : true,
diff --git a/meson.build b/meson.build
index a19e600c7475b2578e2d..f45c14a70baa2456582d 100644
--- a/meson.build
+++ b/meson.build
@@ -51,6 +51,7 @@  cc = meson.get_compiler('c')
 intel_atomics = false
 lib_atomics = false
 
+dep_atomic_ops = dependency('atomic_ops', required : false)
 if cc.compiles('''
     int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); }
     int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); }
@@ -58,7 +59,7 @@  if cc.compiles('''
     name : 'Intel Atomics')
   intel_atomics = true
   with_atomics = true
-elif cc.has_header('atomic_ops.h')
+elif dep_atomic_ops.found()
   lib_atomics = true
   with_atomics = true
 elif cc.has_function('atomic_cas_uint')
diff --git a/nouveau/meson.build b/nouveau/meson.build
index f031cd63b71bab9f7e7a..b8affd9ef776c99ba896 100644
--- a/nouveau/meson.build
+++ b/nouveau/meson.build
@@ -25,7 +25,7 @@  libdrm_nouveau = shared_library(
   c_args : warn_c_args,
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
-  dependencies : dep_threads,
+  dependencies : [dep_threads, dep_atomic_ops],
   version : '2.0.0',
   install : true,
 )
diff --git a/omap/meson.build b/omap/meson.build
index 1881087fb0d180b668d3..f89436f0e99970b381aa 100644
--- a/omap/meson.build
+++ b/omap/meson.build
@@ -24,7 +24,7 @@  libdrm_omap = shared_library(
   include_directories : [inc_root, inc_drm],
   c_args : warn_c_args,
   link_with : libdrm,
-  dependencies : [dep_pthread_stubs],
+  dependencies : [dep_pthread_stubs, dep_atomic_ops],
   version : '1.0.0',
   install : true,
 )
diff --git a/radeon/meson.build b/radeon/meson.build
index b02166fe87ea27470e4b..557a878042bb78df4096 100644
--- a/radeon/meson.build
+++ b/radeon/meson.build
@@ -31,7 +31,7 @@  libdrm_radeon = shared_library(
   c_args : warn_c_args,
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
-  dependencies : [dep_pthread_stubs],
+  dependencies : [dep_pthread_stubs, dep_atomic_ops],
   version : '1.0.1',
   install : true,
 )
diff --git a/tegra/meson.build b/tegra/meson.build
index 99fdd194f50aceb6858b..7ac815177718d301b76c 100644
--- a/tegra/meson.build
+++ b/tegra/meson.build
@@ -23,7 +23,7 @@  libdrm_tegra = shared_library(
   [files('tegra.c'), config_file],
   include_directories : [inc_root, inc_drm],
   link_with : libdrm,
-  dependencies : [dep_pthread_stubs],
+  dependencies : [dep_pthread_stubs, dep_atomic_ops],
   c_args : warn_c_args,
   version : '0.0.0',
   install : true,