From: Ralf Habacker Date: Mon, 22 Oct 2018 11:27:46 +0000 (+0200) Subject: Add cmake check for HAVE_DIRFD X-Git-Tag: dbus-1.13.8~43^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ba8a5e509c34aadd0097b29144ba4dd8c65412ed;p=thirdparty%2Fdbus.git Add cmake check for HAVE_DIRFD Reviewed-by: Simon McVittie Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18 --- diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 39c2ed5b3..cee6a9270 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -59,7 +59,6 @@ check_symbol_exists(strtoull "stdlib.h" HAVE_STRTOULL) # set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) check_symbol_exists(pipe2 "fcntl.h;unistd.h" HAVE_PIPE2) check_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4) -check_symbol_exists(dirfd "dirent.h" HAVE_DIRFD) check_symbol_exists(inotify_init1 "sys/inotify.h" HAVE_INOTIFY_INIT1) check_symbol_exists(SCM_RIGHTS "sys/types.h;sys/socket.h;sys/un.h" HAVE_UNIX_FD_PASSING) check_symbol_exists(prctl "sys/prctl.h" HAVE_PRCTL) @@ -150,6 +149,17 @@ int main() { } " DBUS_USE_SYNC) +CHECK_C_SOURCE_COMPILES(" +#include +#include +int main( + DIR *dirp; + dirp = opendir(\".\"); + dirfd(dirp); + closedir(dirp); +) +" HAVE_DIRFD) + # missing: # DBUS_HAVE_GCC33_GCOV diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 1235a4504..531bc8355 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -204,7 +204,10 @@ #cmakedefine HAVE_PIPE2 1 #cmakedefine HAVE_ACCEPT4 1 + +/* Have dirfd function */ #cmakedefine HAVE_DIRFD 1 + #cmakedefine HAVE_INOTIFY_INIT1 1 #cmakedefine HAVE_GETRLIMIT 1 #cmakedefine HAVE_PRCTL 1