summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-06-28 12:30:55 +0100
committerSimon McVittie <smcv@collabora.com>2022-07-13 20:36:13 +0100
commit35eca11708e2c511f54c7bfb4bc9b4eb34fc2c8d (patch)
tree99202421c957b66deb7ccb593f066722db86eb3b /meson.build
parentec3edd80a6536d1a8772377e889f5e4cdbeb33e0 (diff)
downloaddbus-35eca11708e2c511f54c7bfb4bc9b4eb34fc2c8d.tar.gz
meson: Replicate Autotools check for __sync_sub_and_fetch
The built-in atomic intrinsics are not exactly functions, so it's incorrect to use has_function to check for them. Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build15
1 files changed, 13 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 2ae2050c..16dcb67e 100644
--- a/meson.build
+++ b/meson.build
@@ -615,8 +615,19 @@ endif
config.set('DBUS_VA_COPY', va_copy)
-#### Atomic integers
-config.set10('DBUS_USE_SYNC', cc.has_function('__sync_sub_and_fetch') ? 1 : false)
+# Can't use cc.has_function here because atomic operations are not
+# exactly functions
+config.set10(
+ 'DBUS_USE_SYNC',
+ cc.links('''
+ int main(void)
+ {
+ int a = 4;
+ int b = __sync_sub_and_fetch (&a, 4);
+ return b;
+ }
+ ''')
+)
config.set10('HAVE_DECL_MSG_NOSIGNAL',
cc.has_header_symbol('sys/socket.h', 'MSG_NOSIGNAL')