Add cmake check for HAVE_DIRFD

Reviewed-by: Simon McVittie <smcv@collabora.com>
Bug: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/18
This commit is contained in:
Ralf Habacker 2018-10-22 13:27:46 +02:00
parent 6c95c7e395
commit ba8a5e509c
2 changed files with 14 additions and 1 deletions

View file

@ -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 <sys/types.h>
#include <dirent.h>
int main(
DIR *dirp;
dirp = opendir(\".\");
dirfd(dirp);
closedir(dirp);
)
" HAVE_DIRFD)
# missing:
# DBUS_HAVE_GCC33_GCOV

View file

@ -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