cmake: reorder include header and function checks to match meson build system

This commit is contained in:
Ralf Habacker 2023-08-07 15:46:52 +02:00
parent fcf889e7bd
commit dbb4e0ea90
2 changed files with 34 additions and 31 deletions

View file

@ -8,6 +8,7 @@ include(CheckCSourceRuns)
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
# keep in sync with check_headers in meson.build
check_include_files("winsock2.h;afunix.h" HAVE_AFUNIX_H)
check_include_file(alloca.h HAVE_ALLOCA_H)
check_include_file(byteswap.h HAVE_BYTESWAP_H)
@ -21,53 +22,54 @@ check_include_file(linux/magic.h HAVE_LINUX_MAGIC_H)
check_include_file(locale.h HAVE_LOCALE_H)
check_include_file(signal.h HAVE_SIGNAL_H)
check_include_file(stdio.h HAVE_STDIO_H) # dbus-sysdeps.h
check_include_file(syslog.h HAVE_SYSLOG_H)
check_include_files("stdint.h;sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
check_include_file(sys/inotify.h HAVE_SYS_INOTIFY_H)
check_include_file(sys/inotify.h DBUS_BUS_ENABLE_INOTIFY)
check_include_file(sys/prctl.h HAVE_SYS_PRCTL_H)
check_include_file(sys/random.h HAVE_SYS_RANDOM_H)
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
check_include_file(sys/syscall.h HAVE_SYS_SYSCALL_H)
check_include_file(sys/prctl.h HAVE_SYS_PRCTL_H)
check_include_file(sys/time.h HAVE_SYS_TIME_H)# dbus-sysdeps-win.c
check_include_file(sys/vfs.h HAVE_SYS_VFS_H)
check_include_file(ws2tcpip.h HAVE_WS2TCPIP_H)# dbus-sysdeps-win.c
check_include_file(syslog.h HAVE_SYSLOG_H)
check_include_file(unistd.h HAVE_UNISTD_H) # dbus-sysdeps-util-win.c
check_include_file(sys/inotify.h DBUS_BUS_ENABLE_INOTIFY)
check_include_file(ws2tcpip.h HAVE_WS2TCPIP_H)# dbus-sysdeps-win.c
find_package(Backtrace) # dbus-sysdeps.c, dbus-sysdeps-win.c
set(HAVE_BACKTRACE ${Backtrace_FOUND})
# keep in sync with check_functions in meson.build
check_symbol_exists(LOG_PERROR "syslog.h" HAVE_DECL_LOG_PERROR)
check_symbol_exists(MSG_NOSIGNAL "sys/socket.h" HAVE_DECL_MSG_NOSIGNAL)
check_symbol_exists(SCM_RIGHTS "sys/types.h;sys/socket.h;sys/un.h" HAVE_UNIX_FD_PASSING)
check_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)
check_symbol_exists(clearenv "stdlib.h" HAVE_CLEARENV) # dbus-sysdeps.c
check_symbol_exists(close_range "unistd.h" HAVE_CLOSE_RANGE) # dbus-sysdeps-unix.c
check_symbol_exists(closefrom "unistd.h" HAVE_CLOSEFROM) # dbus-sysdeps-unix.c
check_symbol_exists(environ "unistd.h" HAVE_DECL_ENVIRON)
check_symbol_exists(fstatfs "sys/vfs.h" HAVE_FSTATFS)
check_symbol_exists(getgrouplist "grp.h" HAVE_GETGROUPLIST) # dbus-sysdeps.c
check_symbol_exists(getpeerucred "ucred.h" HAVE_GETPEERUCRED) # dbus-sysdeps.c, dbus-sysdeps-win.c
check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP) # dbus-sysdeps.c
check_symbol_exists(getpwnam_r "errno.h;pwd.h" HAVE_GETPWNAM_R) # dbus-sysdeps-util-unix.c
check_symbol_exists(setenv "stdlib.h" HAVE_SETENV) # dbus-sysdeps.c
check_symbol_exists(unsetenv "stdlib.h" HAVE_UNSETENV) # dbus-sysdeps.c
check_symbol_exists(clearenv "stdlib.h" HAVE_CLEARENV) # dbus-sysdeps.c
check_symbol_exists(closefrom "unistd.h" HAVE_CLOSEFROM) # dbus-sysdeps-unix.c
check_symbol_exists(close_range "unistd.h" HAVE_CLOSE_RANGE) # dbus-sysdeps-unix.c
check_symbol_exists(writev "sys/uio.h" HAVE_WRITEV) # dbus-sysdeps.c, dbus-sysdeps-win.c
check_symbol_exists(setrlimit "sys/resource.h" HAVE_SETRLIMIT) # dbus-sysdeps.c, dbus-sysdeps-win.c, test/test-segfault.c
check_symbol_exists(socketpair "sys/socket.h" HAVE_SOCKETPAIR) # dbus-sysdeps.c
check_symbol_exists(setlocale "locale.h" HAVE_SETLOCALE) # dbus-test-main.c
check_symbol_exists(localeconv "locale.h" HAVE_LOCALECONV) # dbus-sysdeps.c
check_symbol_exists(poll "poll.h" HAVE_POLL) # dbus-sysdeps-unix.c
check_symbol_exists(pipe2 "fcntl.h;unistd.h" HAVE_PIPE2)
check_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)
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)
check_symbol_exists(raise "signal.h" HAVE_RAISE)
check_symbol_exists(getrandom "sys/random.h" HAVE_GETRANDOM)
check_symbol_exists(getrlimit "sys/resource.h;sys/time.h" HAVE_GETRLIMIT)
check_symbol_exists(prlimit "sys/resource.h;sys/time.h" HAVE_PRLIMIT)
check_symbol_exists(setrlimit "sys/resource.h;sys/time.h" HAVE_SETRLIMIT)
check_symbol_exists(MSG_NOSIGNAL "sys/socket.h" HAVE_DECL_MSG_NOSIGNAL)
check_symbol_exists(environ "unistd.h" HAVE_DECL_ENVIRON)
check_symbol_exists(LOG_PERROR "syslog.h" HAVE_DECL_LOG_PERROR)
check_symbol_exists(setresuid "unistd.h" HAVE_SETRESUID)
check_symbol_exists(getresuid "unistd.h" HAVE_GETRESUID)
check_symbol_exists(fstatfs "sys/vfs.h" HAVE_FSTATFS)
check_symbol_exists(getrlimit "sys/resource.h;sys/time.h" HAVE_GETRLIMIT)
check_symbol_exists(inotify_init1 "sys/inotify.h" HAVE_INOTIFY_INIT1)
check_symbol_exists(localeconv "locale.h" HAVE_LOCALECONV) # dbus-sysdeps.c
check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP) # dbus-sysdeps.c
check_symbol_exists(pipe2 "fcntl.h;unistd.h" HAVE_PIPE2)
check_symbol_exists(poll "poll.h" HAVE_POLL) # dbus-sysdeps-unix.c
check_symbol_exists(prctl "sys/prctl.h" HAVE_PRCTL)
check_symbol_exists(prlimit "sys/resource.h;sys/time.h" HAVE_PRLIMIT)
check_symbol_exists(raise "signal.h" HAVE_RAISE)
check_symbol_exists(setenv "stdlib.h" HAVE_SETENV) # dbus-sysdeps.c
check_symbol_exists(setlocale "locale.h" HAVE_SETLOCALE) # dbus-test-main.c
check_symbol_exists(setresuid "unistd.h" HAVE_SETRESUID)
check_symbol_exists(setrlimit "sys/resource.h" HAVE_SETRLIMIT) # dbus-sysdeps.c, dbus-sysdeps-win.c, test/test-segfault.c
check_symbol_exists(setrlimit "sys/resource.h;sys/time.h" HAVE_SETRLIMIT)
check_symbol_exists(socketpair "sys/socket.h" HAVE_SOCKETPAIR) # dbus-sysdeps.c
check_symbol_exists(unsetenv "stdlib.h" HAVE_UNSETENV) # dbus-sysdeps.c
check_symbol_exists(writev "sys/uio.h" HAVE_WRITEV) # dbus-sysdeps.c, dbus-sysdeps-win.c
check_struct_member(cmsgcred cmcred_pid "sys/types.h;sys/socket.h" HAVE_CMSGCRED) # dbus-sysdeps.c

View file

@ -624,7 +624,7 @@ endif
config.set('DBUS_BUILD_X11', use_x11_autolaunch)
config.set('DBUS_ENABLE_X11_AUTOLAUNCH', use_x11_autolaunch)
# keep CMakeLists.txt in sync
check_functions = [
'accept4',
'clearenv',
@ -661,6 +661,7 @@ foreach function : check_functions
config.set(macro, cc.has_function(function, args: compile_args_c) ? 1 : false)
endforeach
# keep CMakeLists.txt in sync
check_headers = [
'afunix.h',
'alloca.h',