Use __has_include() instead of check_include_file()

Allows removing some CMake checks config-kwin.h contents. This is
supported by all compilers and required for C++17. While touching those
lines I also cleaned up an unnecessary HAVE_UNISTD_H check (glibc always
has it and and incorrect use of HAVE_SYS_PROCCTL_H.
master
Alex Richardson 3 years ago committed by Vlad Zahorodnii
parent 994c5c24ae
commit 0a0a1fd330

@ -355,10 +355,6 @@ set(HAVE_X11_XCB ${X11_XCB_FOUND})
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckSymbolExists)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(malloc.h HAVE_MALLOC_H)
check_include_file("sys/sysmacros.h" HAVE_SYS_SYSMACROS_H)
check_symbol_exists(SCHED_RESET_ON_FORK "sched.h" HAVE_SCHED_RESET_ON_FORK)
add_feature_info("SCHED_RESET_ON_FORK"

@ -18,7 +18,6 @@
#cmakedefine01 HAVE_X11_XINPUT
#cmakedefine01 HAVE_GBM_BO_GET_FD_FOR_PLANE
#cmakedefine01 HAVE_WAYLAND_EGL
#cmakedefine01 HAVE_SYS_SYSMACROS_H
#cmakedefine01 HAVE_BREEZE_DECO
#cmakedefine01 HAVE_LIBCAP
#cmakedefine01 HAVE_SCHED_RESET_ON_FORK
@ -27,12 +26,6 @@
#define BREEZE_KDECORATION_PLUGIN_ID "${BREEZE_KDECORATION_PLUGIN_ID}"
#endif
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1
/* Define to 1 if you have the <malloc.h> header file. */
#cmakedefine HAVE_MALLOC_H 1
#cmakedefine XCB_ICCCM_FOUND 1
#ifndef XCB_ICCCM_FOUND
#define XCB_ICCCM_WM_STATE_WITHDRAWN 0

@ -47,13 +47,13 @@
#include <QLibraryInfo>
// system
#ifdef HAVE_UNISTD_H
#if __has_include(<unistd.h>)
#include <unistd.h>
#endif // HAVE_UNISTD_H
#endif
#ifdef HAVE_MALLOC_H
#ifdef __has_include(<malloc.h>)
#include <malloc.h>
#endif // HAVE_MALLOC_H
#endif
// xcb
#include <xcb/damage.h>
@ -255,11 +255,7 @@ void Application::setupMalloc()
// due to fragmentation especially if we use the raster graphicssystem. On the
// otherside if the threshold is too low, free() starts to permanently ask the kernel
// about shrinking the heap.
#ifdef HAVE_UNISTD_H
const int pagesize = sysconf(_SC_PAGESIZE);
#else
const int pagesize = 4*1024;
#endif // HAVE_UNISTD_H
mallopt(M_TRIM_THRESHOLD, 5*pagesize);
#endif // M_TRIM_THRESHOLD
}

@ -42,9 +42,9 @@
#include <QtDBus>
// system
#ifdef HAVE_UNISTD_H
#if __has_include(<unistd.h>)
#include <unistd.h>
#endif // HAVE_UNISTD_H
#endif
#include <iostream>
Q_LOGGING_CATEGORY(KWIN_CORE, "kwin_core", QtWarningMsg)

@ -21,7 +21,7 @@
#include <sys/stat.h>
#include <unistd.h>
#if HAVE_SYS_SYSMACROS_H
#if __has_include(<sys/sysmacros.h>)
#include <sys/sysmacros.h>
#endif

@ -21,7 +21,7 @@
#include <sys/stat.h>
#include <unistd.h>
#if HAVE_SYS_SYSMACROS_H
#if __has_include(<sys/sysmacros.h>)
#include <sys/sysmacros.h>
#endif

@ -43,10 +43,7 @@
#include <QtConcurrentRun>
// system
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_SYS_PROCCTL_H
#if __has_include(<unistd.h>)
#include <unistd.h>
#endif

Loading…
Cancel
Save