Index: llvm/cmake/config-ix.cmake =================================================================== --- llvm/cmake/config-ix.cmake +++ llvm/cmake/config-ix.cmake @@ -63,7 +63,6 @@ check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT) check_include_file(mach/mach.h HAVE_MACH_MACH_H) -check_include_file(histedit.h HAVE_HISTEDIT_H) check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H) if(APPLE) include(CheckCSourceCompiles) @@ -186,9 +185,18 @@ # Don't look for these libraries on Windows. if (NOT PURE_WINDOWS) # Skip libedit if using ASan as it contains memory leaks. - if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*") - check_library_exists(edit el_init "" HAVE_LIBEDIT) + if (LLVM_ENABLE_LIBEDIT AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*") + # If histedit.h is in a non-standard path, find it in CMAKE_INCLUDE_PATH + find_file(HISTEDIT_FILE histedit.h) + get_filename_component(HISTEDIT_DIR "${HISTEDIT_FILE}" DIRECTORY CACHE) + check_include_file(histedit.h HAVE_HISTEDIT_H "-I${HISTEDIT_DIR}") + + # If libedit.a is in a non-standard path, find it in CMAKE_LIBRARY_PATH + find_library(LIBEDIT_LIBRARY libedit.a) + get_filename_component(LIBEDIT_DIR "${LIBEDIT_LIBRARY}" DIRECTORY CACHE) + check_library_exists(edit el_init "${LIBEDIT_DIR}" HAVE_LIBEDIT) else() + set(HAVE_HISTEDIT_H 0) set(HAVE_LIBEDIT 0) endif() if(LLVM_ENABLE_TERMINFO) Index: llvm/lib/LineEditor/CMakeLists.txt =================================================================== --- llvm/lib/LineEditor/CMakeLists.txt +++ llvm/lib/LineEditor/CMakeLists.txt @@ -1,5 +1,8 @@ if(HAVE_LIBEDIT) - set(link_libs edit) + set(link_libs ${LIBEDIT_LIBRARY}) +endif() +if(HAVE_HISTEDIT_H) + include_directories(${HISTEDIT_DIR}) endif() add_llvm_component_library(LLVMLineEditor