summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAlex Richardson <arichardson.kde@gmail.com>2022-05-15 11:28:51 +0100
committerSimon McVittie <smcv@collabora.com>2022-05-16 18:39:26 +0000
commitb932c343c4965023b0fd0a16be76840755ff6434 (patch)
treefe2ee21c693b77a764e2c40932c83bd27803ff28 /cmake
parent146f48ba0b462e1aa18680c21ef65ed6f716e844 (diff)
downloaddbus-b932c343c4965023b0fd0a16be76840755ff6434.tar.gz
cmake: Fix definition of DBUS_USE_SYNC
dbus-sysdeps-unix.c checks for DBUS_USE_SYNC using 0/1 checks not defined checks, so we should be using #cmakedefine01. This fixes lots of -Wundef warnings when compiling for FreeBSD and ensures that we actually use atomics instead of the pthread fallback there.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/ConfigureChecks.cmake2
-rw-r--r--cmake/config.h.cmake2
2 files changed, 2 insertions, 2 deletions
diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake
index ce8f4f9d..f2450333 100644
--- a/cmake/ConfigureChecks.cmake
+++ b/cmake/ConfigureChecks.cmake
@@ -141,7 +141,7 @@ CHECK_C_SOURCE_COMPILES("
int main() {
int a = 4;
int b = __sync_sub_and_fetch(&a, 4);
- exit(b);
+ return b;
}
" DBUS_USE_SYNC)
diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
index 74299d1e..358f9d82 100644
--- a/cmake/config.h.cmake
+++ b/cmake/config.h.cmake
@@ -252,7 +252,7 @@
#cmakedefine DBUS_HAVE_LINUX_EPOLL 1
/* Use the gcc __sync extension */
-#cmakedefine DBUS_USE_SYNC 1
+#cmakedefine01 DBUS_USE_SYNC
#cmakedefine HAVE_VASPRINTF 1
#cmakedefine HAVE_VSNPRINTF 1