summaryrefslogtreecommitdiff
path: root/cmake/ConfigureChecks.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Support /proc in _dbus_file_get_contentLuca Boccassi2023-05-151-0/+3
| | | | | | | | | procfs has special semantics: most files are 0 size, only one read can be done on a file, and they are not larger than 4MB. Enhance _dbus_file_get_content() so that we can read files from /proc with it. Signed-off-by: Luca Boccassi <bluca@debian.org>
* dbus-message.c: skip 1.10 layout compatibility test on new architecturesAlex Richardson2022-09-211-0/+2
| | | | | | | These static assertions fail on CHERI-enabled architectures such as Arm Morello, where pointers are 128 bits. Architectures with 128-bit pointers were not supported in DBus 1.10, so we can skip the checks for DBus 1.10 structure layout compatibility for architectures with pointer size > 64 bit.
* dbus-sysdeps-util-unix.c: Avoid including sys/syslimits.hAlex Richardson2022-08-101-1/+0
| | | | | | | This header is GCC specific header that on my system just contains `#include_next <limits.h>`. FreeBSD also provides this header but it contains a `#warning` that it should not be used. Replace the one use with `#include <limit.h>` and drop the configure checks.
* build: Assume stdint.h is providedSimon McVittie2022-07-191-1/+0
| | | | | | | We now require a (mostly-)C99 compiler, meaning we can rely on having Standard C stdint.h. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Remove fallback implementation of strtoll(), strtoull()Simon McVittie2022-07-191-2/+0
| | | | | | | We now require a (mostly-)C99 compiler, which guarantees the presence of these functions. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Remove emulation of va_copy() in non-C99 compilersSimon McVittie2022-07-191-45/+0
| | | | | | | dbus now requires a (mostly-)C99 compiler, which guarantees the presence of Standard C va_copy(). Signed-off-by: Simon McVittie <smcv@collabora.com>
* build-sys: check for afunix.hMarc-André Lureau2022-07-151-0/+1
| | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake: drop unused HAVE_VASPRINTF/HAVE_VSNPRINTF checksMarc-André Lureau2022-07-131-2/+0
| | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake/autotools: remove HAVE_DIRFD/HAVE_DDFDMarc-André Lureau2022-07-131-26/+0
| | | | | | dirfd() is assumed to be present on Linux, dd_fd is never used. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake: drop needless headers checksMarc-André Lureau2022-07-131-13/+0
| | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake: Check for setresuid and getresuidAlex Richardson2022-05-251-0/+2
| | | | | This was not being checked, so the codepaths using the define were never included.
* cmake: Fix definition of DBUS_USE_SYNCAlex Richardson2022-05-161-1/+1
| | | | | | | 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.
* sysdeps: On Linux, wrap close_range syscall directly if necessarySimon McVittie2022-04-211-0/+1
| | | | | | | | | This was added to the Linux kernel in version 5.9, but the wrapper wasn't added to glibc until 2.34. Adding our own wrapper for the system call means we can use close_range() on Debian 11 and contemporary distributions. Signed-off-by: Simon McVittie <smcv@collabora.com>
* sysdeps: Include <linux/close_range.h> if availableSimon McVittie2022-04-211-0/+1
| | | | | | | This lets us use CLOSE_RANGE_CLOEXEC whenever the kernel headers support it, even if glibc doesn't include this header via unistd.h yet. Signed-off-by: Simon McVittie <smcv@collabora.com>
* sysdeps: Use close_range() if availableSimon McVittie2022-04-211-0/+1
| | | | | | | | | The version with no flags set, which is a slight generalization of closefrom(), is available on recent Linux and FreeBSD. The version with CLOSE_RANGE_CLOEXEC is Linux-specific. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Use closefrom() to not loop over all possible file descriptorsrim2022-04-211-0/+1
| | | | Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/278
* build: Define DBUS_INT64_MODIFIER, analogous to G_GINT64_MODIFIERSimon McVittie2022-04-191-0/+9
| | | | | | | | | | | | | | | | | | | Using PRId64, etc. to print dbus_int64_t or dbus_uint64_t is not 100% portable. On platforms where both long and long long are 64-bit (such as Linux and macOS), we will prefer to define dbus_int64_t as long. If the operating system has chosen to define int64_t as long long, which is apparently the case on macOS, then the compiler can warn that we are passing a long argument to PRId64, which is "lld" and therefore expects a long long argument (even though that ends up with the same bit-pattern being used). We can't necessarily just use int64_t and uint64_t directly, even if all our supported platforms have them available now, because swapping dbus_int64_t between long and long long might change C++ name mangling, causing ABI breaks in third-party libraries if they define C++ functions that take a dbus_int64_t argument. Signed-off-by: Simon McVittie <smcv@collabora.com>
* cmake: Detect backtrace() support on platforms such as FreeBSDAlex Richardson2022-03-241-1/+3
| | | | | | | | On FreeBSD use of backtrace requires linking libexecinfo. The current check_symbol_exists() will fail due to that missing library. Fortunately, CMake ships with a FindBacktrace module (at least since 3.0) that can be used to correctly handle platforms such as FreeBSD (and OpenBSD according to the FindBacktrace source).
* Add HAVE_DECL_xxx checks to cmake build systemRalf Habacker2021-11-181-0/+3
| | | | | | | The first two definitions are required to fix cmake build error when compiling with -Werror=undef on Windows. The last one completes having HAVE_DECL_xxx definitions.
* Fix definition of HAVE_SOCKLEN_TRalf Habacker2021-11-181-1/+1
|
* Add configure checks for vsnprintf and vasprintf to cmake build systemRalf Habacker2021-11-181-0/+2
|
* Merge branch 'fix-poll-header' into 'master'Simon McVittie2020-04-011-1/+1
|\ | | | | | | | | sysdeps: use POSIX poll.h instead of sys/poll.h See merge request dbus/dbus!148
| * sysdeps: use POSIX poll.h instead of sys/poll.hNatanael Copa2020-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | POSIX.1-2001 and POSIX.1-2008 specifies include <poll.h> so use that rather than the non-standard/legacy include <sys/poll.h>. This fixes the following warnings when building with musl libc: 1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h> | ^~~~~~~ Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
* | _dbus_generate_random_bytes: use getrandom(2)Natanael Copa2020-03-261-0/+2
|/ | | | | | | | | | Use getrandom(2) and fall back to /dev/urandom if it is missing or if it fails some any reason. This solves problem where dbus-uuidgen is called from a chroot which lacks /dev/urandom. Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
* Merge branch 'non-posix-getwpnam-r' into 'master'Simon McVittie2020-03-111-1/+1
|\ | | | | | | | | Remove support for non-POSIX getpwnam_r() See merge request dbus/dbus!11
| * build: Drop support for non-POSIX getpwnam_r(), getgrnam_r()Simon McVittie2018-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Solaris 2.3 and 2.4 took their getpwnam_r() signature from draft 6 of the POSIX threads standard. Since Solaris 2.5 (1995), defining _POSIX_PTHREAD_SEMANTICS opts-in to the non-draft version of getpwnam_r(), and since Solaris 11.4 (2018), the non-draft version is the default. We already use AC_USE_SYSTEM_EXTENSIONS, which defines _POSIX_PTHREAD_SEMANTICS, among other useful macros. Thanks to Alan Coopersmith for assistance with Solaris history. Signed-off-by: Simon McVittie <smcv@collabora.com>
* | Remove obsolete parameter in end... cmake keywordsRalf Habacker2019-01-231-3/+3
| |
* | Remove spaces between cmake command and opening bracketRalf Habacker2019-01-231-18/+18
| |
* | build: Require va_copy() or __va_copy() on non-MSVC compilersSimon McVittie2018-11-191-19/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Only use _DBUS_VA_COPY_ASSIGN to implement va_copy() on MSVCSimon McVittie2018-11-191-2/+2
| | | | | | | | | | | | | | | | 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>
* | Don't check how to copy a va_list if we already have va_copy()Simon McVittie2018-11-191-19/+19
|/ | | | | | | | | | | | 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>
* internals: Assume compiler supports a subset of ISO varargs syntaxSimon McVittie2018-11-151-22/+0
| | | | | | | | | | | | | 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>
* Refactor cmake checks for DBUS_VA_COPY and DBUS_VA_COPY_ARRAYRalf Habacker2018-11-151-51/+64
| | | | | | | | | | | | 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.
* Revert "Refactor cmake checks for DBUS_VA_COPY and DBUS_VA_COPY_ARRAY"Ralf Habacker2018-10-251-63/+51
| | | | | This reverts commit bd6ece893a45e8103a696ee64adc1baa2096c422, which was added without a final review.
* Remove todo(s) for cmake build systemRalf Habacker2018-10-241-3/+0
| | | | Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
* Add cmake support for HAVE_GNUC_VARARGS and HAVE_ISO_VARARGSRalf Habacker2018-10-241-0/+22
| | | | | Reviewed-by: Simon McVittie <smcv@collabora.com> Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
* Add cmake check for HAVE_DDFDRalf Habacker2018-10-241-0/+15
| | | | | Reviewed-by: Simon McVittie <smcv@collabora.com> Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
* Add cmake check for HAVE_DIRFDRalf Habacker2018-10-241-1/+11
| | | | | Reviewed-by: Simon McVittie <smcv@collabora.com> Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
* Add cmake check for DBUS_USE_SYNCRalf Habacker2018-10-241-0/+8
| | | | | Reviewed-by: Simon McVittie <smcv@collabora.com> Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
* Refactor cmake checks for DBUS_VA_COPY and DBUS_VA_COPY_ARRAYRalf Habacker2018-10-241-51/+63
| | | | | | | | | | | | | | | 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
* Add cmake support for DBUS_HAVE_LINUX_EPOLLRalf Habacker2018-10-241-0/+10
| | | | | Reviewed-by: Simon McVittie <smcv@collabora.com> Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
* cmake: Fix incorrect header list separator in configure checksRalf Habacker2018-10-221-2/+2
| | | | | | | | 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>
* cmake: Add comment to configure checks explaining why we are not specifying ↵Ralf Habacker2018-10-201-1/+1
| | | | | | | HAVE_SOCKLEN_T Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/117 Reviewed-by: Simon McVittie <smcv@collabora.com>
* Add missing setup of DBUS_BUS_ENABLE_INOTIFYRalf Habacker2018-10-201-0/+1
| | | | | Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/117 Reviewed-by: Simon McVittie <smcv@collabora.com>
* Add a unit test for the dbus-daemon resetting its fd limitSimon McVittie2018-02-201-0/+1
| | | | | | | 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
* cmake: Check for getrlimit, setrlimitSimon McVittie2018-02-201-0/+2
| | | | | | | | | 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
* unix: Condition Linux-specific abstract sockets on __linux__Simon McVittie2017-09-291-10/+0
| | | | | | | | | | | 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>
* build: Remove unused substitution DBUS_PATH_OR_ABSTRACTSimon McVittie2017-09-291-7/+0
| | | | | | | | | | 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>
* Add missing include file for cmake function check_include_files() (commit ↵Ralf Habacker2015-03-051-0/+1
| | | | 2d2b5af)
* Move include file checks to ConfigureChecks.cmake for cmake build system.Ralf Habacker2015-03-051-0/+1
| | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85418 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>