From ca10d2e64d9630bb93507ac416c3f176d0df8a2b Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 18 Aug 2016 18:22:22 +0000 Subject: [PATCH] Use __has_include rather than a configure-time macro to determine if is available. This should fix out-of-tree builds, at the cost of not providing the higher rlimits to stage 1 clang when built with an old host compiler not implementing this feature yet (bootstrap builds should be fine, though). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279112 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/driver/cc1_main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index b44108e8ad..fff6ffe44c 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -37,9 +37,14 @@ #include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" #include -#if HAVE_SYS_RESOURCE_H + +#ifdef __has_include +#if __has_include() +#define HAVE_RLIMITS #include #endif +#endif + using namespace clang; using namespace llvm::opt; @@ -69,7 +74,7 @@ void initializePollyPasses(llvm::PassRegistry &Registry); } #endif -#if HAVE_SYS_RESOURCE_H && HAVE_GETRLIMIT && HAVE_SETRLIMIT +#ifdef 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. -- 2.50.1