File tree Expand file tree Collapse file tree 5 files changed +31
-8
lines changed Expand file tree Collapse file tree 5 files changed +31
-8
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/llvm-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 ) {
Original file line number Diff line number Diff line change 50
50
don't. */
51
51
#cmakedefine01 HAVE_DECL_STRERROR_S
52
52
53
+ /* Define to 1 if you have the <dlfcn.h> header file . */
54
+ #cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H}
55
+
53
56
/* Define if dlopen () is available on this platform. */
54
57
#cmakedefine HAVE_DLOPEN ${HAVE_DLOPEN}
55
58
59
+ /* Define if dladdr () is available on this platform. */
60
+ #cmakedefine HAVE_DLADDR ${HAVE_DLADDR}
61
+
56
62
/* Define to 1 if we can register EH frames on this platform. */
57
63
#cmakedefine HAVE_REGISTER_FRAME ${HAVE_REGISTER_FRAME}
58
64
Original file line number Diff line number Diff line change 198
198
/* Define if plugins enabled */
199
199
#cmakedefine LLVM_ENABLE_PLUGINS
200
200
201
- /* Define to 1 if you have the <dlfcn.h> header file. */
202
- #cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H}
203
-
204
- /* Define if dladdr() is available on this platform. */
205
- #cmakedefine HAVE_DLADDR ${HAVE_DLADDR}
206
-
207
201
#endif
You can’t perform that action at this time.
0 commit comments