[lldb][cmake] Fix build with GCC 4.8 and wchar-enabled libedit

Fixes PR43229.

Patch By:  Joseph Tremoulet

git-svn-id: https://llvm.org/svn/llvm-project/lldb/branches/release_90@374511 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
index 0dca557..e1a1337 100644
--- a/cmake/modules/LLDBConfig.cmake
+++ b/cmake/modules/LLDBConfig.cmake
@@ -1,3 +1,4 @@
+include(CheckIncludeFileCXX)
 include(CheckCXXSymbolExists)
 include(CheckTypeSize)
 
@@ -94,10 +95,14 @@
   find_package(LibEdit REQUIRED)
 
   # Check if we libedit capable of handling wide characters (built with
-  # '--enable-widec').
+  # '--enable-widec'), and have the <codecvt> standard library we use to
+  # process them.
   set(CMAKE_REQUIRED_LIBRARIES ${libedit_LIBRARIES})
   set(CMAKE_REQUIRED_INCLUDES ${libedit_INCLUDE_DIRS})
-  check_symbol_exists(el_winsertstr histedit.h LLDB_EDITLINE_USE_WCHAR)
+  check_symbol_exists(el_winsertstr histedit.h HAVE_WIDEC_LIBEDIT)
+  if (HAVE_WIDEC_LIBEDIT)
+    check_include_file_cxx(codecvt LLDB_EDITLINE_USE_WCHAR)
+  endif()
   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 "")