File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,23 @@ endif()
167
167
include (CheckIncludeFile )
168
168
check_include_file (sys/resource.h CLANG_HAVE_RLIMITS )
169
169
170
+ # This check requires _GNU_SOURCE on linux
171
+ check_include_file (dlfcn.h CLANG_HAVE_DLFCN_H )
172
+ if ( CLANG_HAVE_DLFCN_H )
173
+ include (CheckLibraryExists )
174
+ include (CheckSymbolExists )
175
+ check_library_exists (dl dlopen "" HAVE_LIBDL )
176
+ if ( HAVE_LIBDL )
177
+ list (APPEND CMAKE_REQUIRED_LIBRARIES dl )
178
+ endif ()
179
+ list (APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE )
180
+ check_symbol_exists (dladdr dlfcn.h CLANG_HAVE_DLADDR )
181
+ list (REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE )
182
+ if ( HAVE_LIBDL )
183
+ list (REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES dl )
184
+ endif ()
185
+ endif ()
186
+
170
187
set (CLANG_RESOURCE_DIR "" CACHE STRING
171
188
"Relative directory from the Clang binary to its resource files." )
172
189
Original file line number Diff line number Diff line change 57
57
/* Define if we have sys/resource.h (rlimits ) */
58
58
#cmakedefine CLANG_HAVE_RLIMITS ${CLANG_HAVE_RLIMITS}
59
59
60
+ /* Define if we have dlfcn.h */
61
+ #cmakedefine CLANG_HAVE_DLFCN_H ${CLANG_HAVE_DLFCN_H}
62
+
63
+ /* Define if dladdr () is available on this platform. */
64
+ #cmakedefine CLANG_HAVE_DLADDR ${CLANG_HAVE_DLADDR}
65
+
60
66
/* Linker version detected at compile time. */
61
67
#cmakedefine HOST_LINK_VERSION "${HOST_LINK_VERSION}"
62
68
Original file line number Diff line number Diff line change 14
14
#include " CXString.h"
15
15
#include " clang/Basic/LLVM.h"
16
16
#include " clang/Basic/Version.h"
17
+ #include " clang/Config/config.h"
17
18
#include " clang/Driver/Driver.h"
18
19
#include " llvm/ADT/STLExtras.h"
19
20
#include " llvm/ADT/SmallString.h"
20
- #include " llvm/Config/config.h"
21
21
#include " llvm/Support/FileSystem.h"
22
22
#include " llvm/Support/MD5.h"
23
23
#include " llvm/Support/Path.h"
@@ -127,7 +127,7 @@ const std::string &CIndexer::getClangResourcesPath() {
127
127
getClangResourcesPathImplAIX (LibClangPath);
128
128
#else
129
129
bool PathFound = false ;
130
- #if defined(HAVE_DLFCN_H ) && defined(HAVE_DLADDR )
130
+ #if defined(CLANG_HAVE_DLFCN_H ) && defined(CLANG_HAVE_DLADDR )
131
131
Dl_info info;
132
132
// This silly cast below avoids a C++ warning.
133
133
if (dladdr ((void *)(uintptr_t )clang_createTranslationUnit, &info) != 0 ) {
You can’t perform that action at this time.
0 commit comments