From 168a8eb936003cdff5e1c502bbd14688019da4d0 Mon Sep 17 00:00:00 2001
From: Treeve Jelbert <treeve@sourcemage.org>
Date: Thu, 7 Jan 2016 15:59:12 +0100
Subject: [PATCH 1/9] use system libedit

---
 CMakeLists.txt                  |  2 +-
 builds/cmake/Configure.cmake    |  2 +-
 src/include/gen/autoconfig.h.in |  4 ++--
 src/isql/isql.epp               | 10 ++++------
 4 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 26a419d36b..86fed29d4e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -216,7 +216,7 @@ if (UNIX)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -msse4")
 
     if (NOT CMAKE_CROSSCOMPILING)
-        set(LIB_readline readline)
+        set(LIB_readline edit)
     endif()
     if (NOT FREEBSD)
         set(LIB_dl dl)
diff --git a/builds/cmake/Configure.cmake b/builds/cmake/Configure.cmake
index 9faa0e50eb..81a057583f 100644
--- a/builds/cmake/Configure.cmake
+++ b/builds/cmake/Configure.cmake
@@ -124,7 +124,7 @@ set(include_files_list
     ctype.h
     dirent.h
     dlfcn.h
-    editline.h
+    editline/readline.h
     errno.h
     fcntl.h
     float.h
diff --git a/src/include/gen/autoconfig.h.in b/src/include/gen/autoconfig.h.in
index 0229681a40..3e4b331266 100644
--- a/src/include/gen/autoconfig.h.in
+++ b/src/include/gen/autoconfig.h.in
@@ -195,8 +195,8 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #cmakedefine HAVE_DLFCN_H 1
 
-/* Define to 1 if you have the <editline.h> header file. */
-#cmakedefine HAVE_EDITLINE_H 1
+/* Define to 1 if you have the <editline/readline.h> header file. */
+#cmakedefine HAVE_EDITLINE_READLINE_H 1
 
 /* Define to 1 if you have the <errno.h> header file. */
 #cmakedefine HAVE_ERRNO_H 1
diff --git a/src/isql/isql.epp b/src/isql/isql.epp
index 4b4db43596..007b2e23b0 100644
--- a/src/isql/isql.epp
+++ b/src/isql/isql.epp
@@ -77,10 +77,8 @@
 #include <locale.h>
 #endif
 
-#ifdef HAVE_EDITLINE_H
-// This is a local file included in our distribution - but not always
-// compiled into the system
-#include "editline.h"
+#ifdef HAVE_EDITLINE_READLINE_H
+#include <editline/readline.h>
 #endif
 
 enum literal_string_type
@@ -636,7 +634,7 @@ int ISQL_main(int argc, char* argv[])
  *
  **************************************/
 
-#if defined(HAVE_EDITLINE_H) && defined(HAVE_LOCALE_H)
+#if defined(HAVE_EDITLINE_READLINE_H) && defined(HAVE_LOCALE_H)
 	setlocale(LC_CTYPE, "");
 #endif
 	atexit(&atexit_fb_shutdown);
@@ -865,7 +863,7 @@ static void readNextInputLine(const char* prompt)
 
 	getColumn = 0;
 
-#ifdef HAVE_EDITLINE_H
+#ifdef HAVE_EDITLINE_READLINE_H
 	if (Filelist->readingStdin())
 	{
 		// CVC: On 2005-04-02, use an empty prompt when not working in
-- 
2.28.0

