build: replace header checks with __has_include

See https://en.cppreference.com/w/cpp/preprocessor/include.
This commit is contained in:
fanquake
2025-05-02 14:24:14 +01:00
parent 5b8046a6e8
commit e1f543823b
4 changed files with 4 additions and 24 deletions

View File

@@ -108,18 +108,6 @@
/* Define to 1 if std::system or ::wsystem is available. */
#cmakedefine HAVE_SYSTEM 1
/* Define to 1 if you have the <sys/prctl.h> header file. */
#cmakedefine HAVE_SYS_PRCTL_H 1
/* Define to 1 if you have the <sys/resources.h> header file. */
#cmakedefine HAVE_SYS_RESOURCES_H 1
/* Define to 1 if you have the <sys/vmmeter.h> header file. */
#cmakedefine HAVE_SYS_VMMETER_H 1
/* Define to 1 if you have the <vm/vm_param.h> header file. */
#cmakedefine HAVE_VM_VM_PARAM_H 1
/* Define to the address where bug reports for this package should be sent. */
#define CLIENT_BUGREPORT "@CLIENT_BUGREPORT@"

View File

@@ -6,12 +6,6 @@ include(CheckCXXSourceCompiles)
include(CheckCXXSymbolExists)
include(CheckIncludeFileCXX)
# The following HAVE_{HEADER}_H variables go to the bitcoin-build-config.h header.
check_include_file_cxx(sys/prctl.h HAVE_SYS_PRCTL_H)
check_include_file_cxx(sys/resources.h HAVE_SYS_RESOURCES_H)
check_include_file_cxx(sys/vmmeter.h HAVE_SYS_VMMETER_H)
check_include_file_cxx(vm/vm_param.h HAVE_VM_VM_PARAM_H)
check_cxx_symbol_exists(O_CLOEXEC "fcntl.h" HAVE_O_CLOEXEC)
check_cxx_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC)
check_cxx_symbol_exists(fork "unistd.h" HAVE_DECL_FORK)

View File

@@ -43,13 +43,13 @@
#endif
#ifdef HAVE_SYSCTL
#include <sys/sysctl.h>
#ifdef HAVE_VM_VM_PARAM_H
#if __has_include(<vm/vm_param.h>)
#include <vm/vm_param.h>
#endif
#ifdef HAVE_SYS_RESOURCES_H
#if __has_include(<sys/resources.h>)
#include <sys/resources.h>
#endif
#ifdef HAVE_SYS_VMMETER_H
#if __has_include(<sys/vmmeter.h>)
#include <sys/vmmeter.h>
#endif
#endif

View File

@@ -2,8 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bitcoin-build-config.h> // IWYU pragma: keep
#include <cstring>
#include <string>
#include <thread>
@@ -16,7 +14,7 @@
#include <util/threadnames.h>
#ifdef HAVE_SYS_PRCTL_H
#if __has_include(<sys/prctl.h>)
#include <sys/prctl.h>
#endif