]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
build: Only define DBUS_TEST_SOCKET_DIR on Unix platforms
authorSimon McVittie <smcv@collabora.com>
Mon, 28 Apr 2025 12:26:56 +0000 (13:26 +0100)
committerSimon McVittie <smcv@collabora.com>
Fri, 16 May 2025 10:22:11 +0000 (10:22 +0000)
This makes it more obvious that it is currently only used on Unix,
and therefore it's OK for it to have a default that wouldn't work
on Windows.

The non-default CMake build system already didn't set the variable when
building for Windows.

Signed-off-by: Simon McVittie <smcv@collabora.com>
cmake/config.h.cmake
meson.build

index 54625bdc67f6adce571c42ec4dc613ac45f2de12..852021590a2773ed5fa9f089b423dd1fff68e8e6 100644 (file)
 #cmakedefine DBUS_USER "@DBUS_USER@"
 #cmakedefine DBUS_TEST_USER "@DBUS_TEST_USER@"
 #cmakedefine DBUS_TEST_EXEC "@DBUS_TEST_EXEC@"
-/* Where to put test sockets */
-#define DBUS_TEST_SOCKET_DIR "@TEST_SOCKET_DIR@"
 
 // system type defines
 #if defined(_WIN32) || defined(_WIN64) || defined (_WIN32_WCE)
 # define DBUS_UNIX
 #endif
 
+#ifdef DBUS_UNIX
+/* Where to put test sockets */
+#define DBUS_TEST_SOCKET_DIR "@TEST_SOCKET_DIR@"
+#endif
+
 #if defined(_WIN32) || defined(_WIN64)
 // mingw mode_t
 # ifdef HAVE_STDIO_H
index 7a4067a0511634880eb18d67fc5da6c88eb9877b..c11f1c5a80ec7e91695347af8ea7774d9852a57a 100644 (file)
@@ -1078,13 +1078,19 @@ values = run_command(python, '-c',
 values += '/tmp'
 default_socket_dir = values.strip().split('\n')[0]
 
-test_socket_dir = get_option('test_socket_dir')
-if test_socket_dir == ''
-    test_socket_dir = default_socket_dir
+if platform_unix
+    test_socket_dir = get_option('test_socket_dir')
+
+    if test_socket_dir == ''
+        test_socket_dir = default_socket_dir
+    endif
+
+    config.set_quoted('DBUS_TEST_SOCKET_DIR', test_socket_dir)
+    test_listen = 'unix:tmpdir=' + test_socket_dir
+else
+    test_listen = 'tcp:host=localhost'
 endif
-test_listen = platform_unix ? 'unix:tmpdir=' + test_socket_dir : 'tcp:host=localhost'
 config.set_quoted('TEST_LISTEN', test_listen)
-config.set_quoted('DBUS_TEST_SOCKET_DIR', test_socket_dir)
 data_config.set('TEST_LISTEN', test_listen)
 
 session_socket_dir = get_option('session_socket_dir')
@@ -1395,9 +1401,14 @@ summary_dict += {
     'System bus user':          dbus_user,
     'Session bus services dir':
         get_option('prefix') / get_option('datadir') / 'dbus-1' / 'services',
-    'Tests socket dir':         test_socket_dir,
 }
 
+if platform_unix
+    summary_dict += {
+        'Tests socket dir': test_socket_dir,
+    }
+endif
+
 if host_os.contains('solaris')
   summary_dict += {
       'Console owner file': console_owner_file,