meson: use pkg-config to detect libatomic_ops
authorEric Engestrom <eric.engestrom@imgtec.com>
Wed, 7 Feb 2018 14:20:52 +0000 (14:20 +0000)
committerEric Engestrom <eric.engestrom@imgtec.com>
Fri, 9 Mar 2018 17:12:02 +0000 (17:12 +0000)
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
amdgpu/meson.build
etnaviv/meson.build
freedreno/meson.build
intel/meson.build
meson.build
nouveau/meson.build
omap/meson.build
radeon/meson.build
tegra/meson.build

index 518b850..f39d7bf 100644 (file)
@@ -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,
 )
index 1767733..ca2aa54 100644 (file)
@@ -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,
 )
index 741b3b6..015b7fb 100644 (file)
@@ -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,
index aa5a134..53c7fce 100644 (file)
@@ -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,
index c803f70..df6f2bd 100644 (file)
@@ -48,6 +48,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); }
@@ -55,7 +56,8 @@ if cc.compiles('''
     name : 'Intel Atomics')
   intel_atomics = true
   with_atomics = true
-elif cc.has_header('atomic_ops.h')
+  dep_atomic_ops = []
+elif dep_atomic_ops.found()
   lib_atomics = true
   with_atomics = true
 elif cc.has_function('atomic_cas_uint')
index 80a8678..51c9a71 100644 (file)
@@ -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,
 )
index 8adb221..e57b8f5 100644 (file)
@@ -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,
 )
index a4171b4..b08c744 100644 (file)
@@ -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,
 )
index 7c671cd..1f5c74b 100644 (file)
@@ -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,