This revision was automatically updated to reflect the committed changes.
Closed by commit rL334393: [cmake] Detect presence of wide-char libedit at
build time (authored by labath, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D47625?vs=149429&id=150692#toc
Repository:
rL LLVM
https://reviews.llvm.org/D47625
Files:
lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
lldb/trunk/include/lldb/Host/Config.h
lldb/trunk/include/lldb/Host/Config.h.cmake
lldb/trunk/include/lldb/Host/Editline.h
Index: lldb/trunk/include/lldb/Host/Config.h.cmake
===================================================================
--- lldb/trunk/include/lldb/Host/Config.h.cmake
+++ lldb/trunk/include/lldb/Host/Config.h.cmake
@@ -12,6 +12,10 @@
#cmakedefine LLDB_CONFIG_TERMIOS_SUPPORTED
+#cmakedefine01 LLDB_EDITLINE_USE_WCHAR
+
+#cmakedefine01 LLDB_HAVE_EL_RFUNC_T
+
#cmakedefine LLDB_DISABLE_POSIX
#define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
Index: lldb/trunk/include/lldb/Host/Editline.h
===================================================================
--- lldb/trunk/include/lldb/Host/Editline.h
+++ lldb/trunk/include/lldb/Host/Editline.h
@@ -33,23 +33,11 @@
#define liblldb_Editline_h_
#if defined(__cplusplus)
+#include <codecvt>
#include <locale>
#include <sstream>
#include <vector>
-// components needed to handle wide characters ( <codecvt>, codecvt_utf8,
-// libedit built with '--enable-widec' ) are available on some platforms. The
-// wchar_t versions of libedit functions will only be used in cases where this
-// is true. This is a compile time dependecy, for now selected per target
-// Platform
-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
- defined(__OpenBSD__)
-#define LLDB_EDITLINE_USE_WCHAR 1
-#include <codecvt>
-#else
-#define LLDB_EDITLINE_USE_WCHAR 0
-#endif
-
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/lldb-private.h"
@@ -81,7 +69,11 @@
using EditLineCharType = char;
#endif
-#ifdef EL_CLIENTDATA /* editline with wide support + wide char read function */
+// At one point the callback type of el_set getchar callback changed from char
+// to wchar_t. It is not possible to detect differentiate between the two
+// versions exactly, but this is a pretty good approximation and allows us to
+// build against almost any editline version out there.
+#if LLDB_EDITLINE_USE_WCHAR || defined(EL_CLIENTDATA) || LLDB_HAVE_EL_RFUNC_T
using EditLineGetCharType = wchar_t;
#else
using EditLineGetCharType = char;
Index: lldb/trunk/include/lldb/Host/Config.h
===================================================================
--- lldb/trunk/include/lldb/Host/Config.h
+++ lldb/trunk/include/lldb/Host/Config.h
@@ -16,6 +16,10 @@
// absence of a configuration step.
#define LLDB_CONFIG_TERMIOS_SUPPORTED 1
+#define LLDB_EDITLINE_USE_WCHAR 1
+
+#define LLDB_HAVE_EL_RFUNC_T 1
+
#define HAVE_SYS_EVENT_H 1
#define HAVE_PPOLL 0
Index: lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
===================================================================
--- lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
+++ lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake
@@ -4,6 +4,7 @@
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckLibraryExists)
+include(CheckTypeSize)
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
check_symbol_exists(ppoll poll.h HAVE_PPOLL)
@@ -27,6 +28,24 @@
set(LLDB_DISABLE_POSIX 1)
endif()
+if (NOT LLDB_DISABLE_LIBEDIT)
+ # Check if we libedit capable of handling wide characters (built with
+ # '--enable-widec').
+ set(CMAKE_REQUIRED_LIBRARIES ${libedit_LIBRARIES})
+ set(CMAKE_REQUIRED_INCLUDES ${libedit_INCLUDE_DIRS})
+ check_symbol_exists(el_winsertstr histedit.h LLDB_EDITLINE_USE_WCHAR)
+ set(CMAKE_EXTRA_INCLUDE_FILES histedit.h)
+ check_type_size(el_rfunc_t LLDB_EL_RFUNC_T_SIZE)
+ if (LLDB_EL_RFUNC_T_SIZE STREQUAL "")
+ set(LLDB_HAVE_EL_RFUNC_T 0)
+ else()
+ set(LLDB_HAVE_EL_RFUNC_T 1)
+ endif()
+ set(CMAKE_REQUIRED_LIBRARIES)
+ set(CMAKE_REQUIRED_INCLUDES)
+ set(CMAKE_EXTRA_INCLUDE_FILES)
+endif()
+
if(NOT LLDB_CONFIG_HEADER_INPUT)
set(LLDB_CONFIG_HEADER_INPUT ${LLDB_INCLUDE_ROOT}/lldb/Host/Config.h.cmake)
endif()
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits