summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/CMakeLists.txt3
-rw-r--r--clang/include/clang/Config/config.h.cmake3
-rw-r--r--clang/tools/driver/cc1_main.cpp8
3 files changed, 9 insertions, 5 deletions
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index e6dde85bc2d..aee0d0a2426 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -177,6 +177,9 @@ if (LIBXML2_FOUND)
set(CLANG_HAVE_LIBXML 1)
endif()
+include(CheckIncludeFile)
+check_include_file(sys/resource.h CLANG_HAVE_RLIMITS)
+
set(CLANG_RESOURCE_DIR "" CACHE STRING
"Relative directory from the Clang binary to its resource files.")
diff --git a/clang/include/clang/Config/config.h.cmake b/clang/include/clang/Config/config.h.cmake
index 9200ed93247..9bf9ea5d8a7 100644
--- a/clang/include/clang/Config/config.h.cmake
+++ b/clang/include/clang/Config/config.h.cmake
@@ -35,6 +35,9 @@
/* Define if we have libxml2 */
#cmakedefine CLANG_HAVE_LIBXML ${CLANG_HAVE_LIBXML}
+/* Define if we have sys/resource.h (rlimits) */
+#cmakedefine CLANG_HAVE_RLIMITS ${CLANG_HAVE_RLIMITS}
+
/* The LLVM product name and version */
#define BACKEND_PACKAGE_STRING "${BACKEND_PACKAGE_STRING}"
diff --git a/clang/tools/driver/cc1_main.cpp b/clang/tools/driver/cc1_main.cpp
index b8cea41e3ea..45d44a015ee 100644
--- a/clang/tools/driver/cc1_main.cpp
+++ b/clang/tools/driver/cc1_main.cpp
@@ -15,6 +15,7 @@
#include "llvm/Option/Arg.h"
#include "clang/CodeGen/ObjectFilePCHContainerOperations.h"
+#include "clang/Config/config.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Driver/Options.h"
#include "clang/Frontend/CompilerInstance.h"
@@ -37,12 +38,9 @@
#include "llvm/Support/raw_ostream.h"
#include <cstdio>
-#ifdef __has_include
-#if __has_include(<sys/resource.h>)
-#define HAVE_RLIMITS
+#ifdef CLANG_HAVE_RLIMITS
#include <sys/resource.h>
#endif
-#endif
using namespace clang;
using namespace llvm::opt;
@@ -73,7 +71,7 @@ void initializePollyPasses(llvm::PassRegistry &Registry);
}
#endif
-#ifdef HAVE_RLIMITS
+#ifdef CLANG_HAVE_RLIMITS
// The amount of stack we think is "sufficient". If less than this much is
// available, we may be unable to reach our template instantiation depth
// limit and other similar limits.
OpenPOWER on IntegriCloud