Commit graph

45 commits

Author SHA1 Message Date
Simon McVittie
f33038bc1b build: Require va_copy() or __va_copy() on non-MSVC compilers
va_copy() is a C99 feature, and should be widely supported by now.
gcc in strict C89 mode implements an equivalent __va_copy() instead.

MSVC 2013 implements va_copy(), but at the moment we still aim to support
MSVC 2010 and 2012, which don't have it. However, we know that in
Windows ABIs, va_list is a pointer, so we can use
_DBUS_VA_COPY_ASSIGN. We do not support MSVC for Autotools builds, only
CMake, due to its non-Unixish command-line interface.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-11-19 11:27:25 +00:00
Simon McVittie
38e4d72fdc Only use _DBUS_VA_COPY_ASSIGN to implement va_copy() on MSVC
We don't know that _DBUS_VA_COPY_ASSIGN is always the right choice.
However, we do know that it's OK on MSVC versions too old to support
va_copy().

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-11-19 11:27:25 +00:00
Simon McVittie
6278951f6d Don't check how to copy a va_list if we already have va_copy()
If we already have ISO C va_copy() or its non-standard counterpart
__va_copy(), then there's no need to do an AC_RUN_IFELSE or its
CMake equivalent to detect whether "args2 = args1" or "*args2 = *args1"
works. AC_RUN_IFELSE is problematic during cross-compilation, where the
program cannot be run (you have to know in advance that the test program
will be run and what its result will be), so we want to avoid it whenever
possible.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-11-19 11:27:25 +00:00
Simon McVittie
f93b63587f internals: Assume compiler supports a subset of ISO varargs syntax
We have considerable anecdotal evidence that every relevant compiler
supports at least the small part of ISO varargs syntax that we need
here, because tools/tool-common.h has contained

    #define VERBOSE(...) do {} while (0)

since dbus 1.9.2 (2014) and nobody has complained yet. With that in
mind, let's simplify.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-11-15 18:55:57 +00:00
Ralf Habacker
a0503f0c99 Refactor cmake checks for DBUS_VA_COPY and DBUS_VA_COPY_ARRAY
For test case execution, CheckCSourceCompiles is now used instead
of try_compile and the determination of DBUS_VA_AS_ARRAY is
performed with a separate test instead of evaluating the result
of HAVE_VA_COPY and HAVE___VA_COPY.

The tests are performed for all supported compilers. Since older
MSVC compilers (< 2013) do not support va_copy(), the macro
_DBUS_VA_ASSIGN(a1,a2) with the implementation { a1 = a2; } is used
as a fallback.
2018-11-15 15:18:22 +00:00
Ralf Habacker
f7e9b8a737 Revert "Refactor cmake checks for DBUS_VA_COPY and DBUS_VA_COPY_ARRAY"
This reverts commit bd6ece893a,
which was added without a final review.
2018-10-25 20:13:17 +02:00
Ralf Habacker
7bba42587b Remove todo(s) for cmake build system
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
2018-10-24 10:03:30 +02:00
Ralf Habacker
fd00c5fdef Add cmake support for HAVE_GNUC_VARARGS and HAVE_ISO_VARARGS
Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
2018-10-24 10:03:30 +02:00
Ralf Habacker
72b0aebb6e Add cmake check for HAVE_DDFD
Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
2018-10-24 10:03:30 +02:00
Ralf Habacker
ba8a5e509c Add cmake check for HAVE_DIRFD
Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
2018-10-24 10:03:30 +02:00
Ralf Habacker
6c95c7e395 Add cmake check for DBUS_USE_SYNC
Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
2018-10-24 10:03:30 +02:00
Ralf Habacker
bd6ece893a Refactor cmake checks for DBUS_VA_COPY and DBUS_VA_COPY_ARRAY
For test case execution, CheckCSourceCompiles is now used instead
of try_compile and the determination of DBUS_VA_AS_ARRAY is
performed with a separate test instead of evaluating the result
of HAVE_VA_COPY and HAVE___VA_COPY.

The tests are performed for all supported compilers. Since older
MSVC compilers (< 2013) do not support va_copy(), the macro
_DBUS_VA_ASSIGN(a1,a2) with the implementation { a1 = a2; } is used
as a fallback.

Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
2018-10-24 10:03:30 +02:00
Ralf Habacker
2934dedd1c Add cmake support for DBUS_HAVE_LINUX_EPOLL
Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
2018-10-24 10:03:29 +02:00
Ralf Habacker
8cd1c21552 cmake: Fix incorrect header list separator in configure checks
CMake expects a semicolon-separated list of headers, not a
space-separated list. In particular, this meant we failed to detect
getpwnam_r() on Linux, and fell back to getpwnam().

Reviewed-by: Simon McVittie <smcv@collabora.com>
2018-10-22 14:58:26 +01:00
Ralf Habacker
195c843b7b cmake: Add comment to configure checks explaining why we are not specifying HAVE_SOCKLEN_T
Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/117
Reviewed-by: Simon McVittie <smcv@collabora.com>
2018-10-20 13:53:52 +02:00
Ralf Habacker
e70b4213f6 Add missing setup of DBUS_BUS_ENABLE_INOTIFY
Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/117
Reviewed-by: Simon McVittie <smcv@collabora.com>
2018-10-20 13:53:14 +02:00
Simon McVittie
49ca421997 Add a unit test for the dbus-daemon resetting its fd limit
Reviewed-by: David King <dking@redhat.com>
[smcv: Fix typo in cmake macro name]
Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105165
2018-02-20 18:37:30 +00:00
Simon McVittie
a146724f2f cmake: Check for getrlimit, setrlimit
This gives us feature parity with the Autotools build system for this
particular area, and in particular means a system dbus-daemon built
with cmake can expand its fd limit.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105165
2018-02-20 18:34:17 +00:00
Simon McVittie
6a6521746b unix: Condition Linux-specific abstract sockets on __linux__
This is nicer for cross-compiling, because AC_RUN_IFELSE can't work
there. In practice abstract sockets are supported on Linux since
2.2 (so, all relevant versions), and on no other platform; so it
seems futile to keep this complexity.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34905
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
2017-09-29 14:04:57 +01:00
Simon McVittie
633a208ce7 build: Remove unused substitution DBUS_PATH_OR_ABSTRACT
This was presumably once used in constructs like
"unix:" DBUS_PATH_OR_ABSTRACT "=/var/run/dbus/foo", but git grep says
there are no remaining uses, so it can go.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34905
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
2017-09-29 14:04:38 +01:00
Ralf Habacker
ee9c52ca33 Add missing include file for cmake function check_include_files() (commit 2d2b5af) 2015-03-05 14:45:18 +01:00
Ralf Habacker
cd8524ce00 Move include file checks to ConfigureChecks.cmake for cmake build system.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85418
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-05 13:54:15 +01:00
Ralf Habacker
add6b4f554 Keep include file checks in sync with autotools.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85418
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-05 13:54:04 +01:00
Ralf Habacker
8696bfdf07 Fix broken cmake HAVE_SOCKLEN_T type finding check.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=17289
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-05 08:14:24 +01:00
Simon McVittie
be55374fb5 cmake: check for the necessary symbols for test-segfault.c
If we don't check for them, and you have core dumps enabled, then
running this test under cmake is really annoying, because it leaves
lots of core dumps none of which are actually a problem.

The equivalent Autotools change (which added the actual code that
this relies on) is commit ae50d46, from fd.o#83772.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83115
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-02-20 20:50:17 +00:00
Ralf Habacker
4564754a2f Add configure checks for accept4, dirfd, inotify_init1 and unix_fd_passing to cmake build system.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73689
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-24 16:45:07 +02:00
Ralf Habacker
e8c5817a5b Add configure check for pipe2 to cmake build system.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73689
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-17 14:45:30 +02:00
Ralf Habacker
d1699118c9 CMake warning--.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17 12:09:33 +01:00
Simon McVittie
b47d50623b Remove support for platforms with no 64-bit integer type
This has been a soft requirement since 1.5.0; anyone on such platforms
would have had to configure --without-64-bit, provoking a warning that
instructed them to report a D-Bus bug with details of their platform.
Nobody has done so, so if anyone still lacks a 64-bit integer type,
they're on their own.

(Also, I tried the build with --without-64-bit and it's full of
fatal compiler warnings, so it's not clear that we're actually
losing anything by removing this "feature".)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65429
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
2013-09-16 15:31:02 +01:00
Simon McVittie
3b9c2817e9 dbus-sysdeps-win: don't include wspiapi.h
This block provoked a warning on mingw-w64 because we were redefining
_inline. According to Ralf's research, it was introduced in 452ff68a:
Windows 2000 doesn't have getaddrinfo and related functions in
ws2tcpip.h, but does have a shim implementation in wspiapi.h.

At the time of 452ff68a, mingw32 didn't have wspiapi.h, so it's unclear
why there was a __GNUC__ code path here. The "#define _inline" on that
code path looks likely to be some sort of workaround for a faulty version
of wspiapi.h? Current mingw-w64 does have wspiapi.h, so we enter the
__GNUC__ code path and get the redefinition.

dbus no longer supports Windows 2000, so we no longer need wspiapi.h
at all, and can rely on XP or later. (Ralf's policy is to only support
versions of Windows that are still supported by Microsoft, and Windows 2000
reached the end of its life-cycle in 2010.)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Ralf Habacker
2013-09-16 12:35:35 +01:00
Ralf Habacker
ff3f4860ef Use dbus/dbus-arch-deps.h.in as source for cmake too
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41033
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-09-23 15:38:12 +02:00
Romain Pokrzywka
3222b64d4a fix {u}intptr_t usage on wince with msvc 2010-05-05 07:57:28 +02:00
Fridrich Štrba
c096c5cb9a Don't truncate pointers on Windows x64 platform 2010-05-03 10:48:38 +02:00
Marcus Brinkmann
abb81eb446 Fix warnings on Windows CE target. 2010-04-14 08:26:47 +02:00
Romain Pokrzywka
9e034bd5b3 add missing HAVE_ macros to cmake 2010-04-13 20:17:14 +02:00
Ralf Habacker
a8dad42954 Added signal.h and locale.h detection for cmake build system. 2010-03-22 17:28:56 +01:00
Romain Pokrzywka
deb7e5a9aa apply remaining unapplied parts of eeedba5b2f5b008819619764943caddd52441adf in dbus4win 2010-02-07 00:32:50 +01:00
Frank Osterfeld
4806504180 with msvc, replace va_copy by assigning the va_lists (cherry picked from commit 42d613fc9284afaa9543549be26f32e503a58348) 2009-12-01 09:20:25 +01:00
Frank Osterfeld
2feb3e2e65 add check for abstract sockets (cherry picked from commit 5b657984f4bc5544a8df560adcd224ed243972f1) 2009-11-30 10:54:32 +01:00
Frank Osterfeld
ff92d15f94 fix configure check and VA_COPY usage
* fix configure check: set DBUS_VA_COPY_FUNC correctly, and DBUS_VA_COPY_AS_ARRAY if no usable one was found
* add DBUS_VA_COPY_AS_ARRAY
* define DBUS_VA_COPY indirectly, cmakedefine plus variable does not work for me on windows, and is the wrong thing to do according to Allen. The undef seems unnecessary now, the address parsing test passes on windows, using mingw
(cherry picked from commit e6680d78d943be4ee2d85e9d82cd8aa1350db882)
2009-11-30 10:50:20 +01:00
Christian Ehrlicher
452ff68a2d mingw compile++ , w2k-support++
dbus/dbus-sysdeps-win.c: Don't unconditionally #include <wspiapi.h>

 * cmake/ConfigureChecks.cmake, cmake/config.h.cmake, configure.in:
   check for wspiapi.h presence which isn't available (and unneeded) in mingw32
 * dbus/dbus-sysdeps-win.c: use HAVE_WSPIAPI_H
2009-11-29 19:06:22 +01:00
Ralf Habacker
d9b9b45554 * cmake/ConfigureChecks.cmake,cmake/config.h.cmake: added check for HAVE_ERRNO_H
* cmake/dbus/CMakeLists.txt: added missing files
* dbus/dbus-transport-win.c/.h: new files
* dbus/dbus-sysdeps-win.c,.h: added required _unix functions to make dbus compilable on win32
* dbus/dbus-sysdeps-win-utils.c,.h: moved some functions to dbus-sysdeps-win.c
* dbus-win.patch: removed applied or obsolate patches
Note: dbus-win32 is now compilable, no guarantee that it runs without any problems
2007-06-15 21:04:43 +00:00
Ralf Habacker
dee80a284a * cmake: added cygwin compile support 2007-06-03 14:15:57 +00:00
Ralf Habacker
5f5a1a3366 * cmake/ConfigureChecks.cmake: fixed socketpair check, added setrlimit check really 2007-03-08 08:36:47 +00:00
Ralf Habacker
36ebfd411b * cmake: new directory, contains cmake build support.
See http://www.cmake.org for more informations.
Currently only unix will be buildable because some
win32 required files are still missing.
2007-03-03 14:32:17 +00:00