Hey!

Following patch adds optional support for system-wide libedit library
instead of bundled one...


From dbaeba79be1292a43c50e0b9cf29a0e96a1994ad Mon Sep 17 00:00:00 2001
From: Priit Laes <pl...@plaes.org>
Date: Sun, 21 Feb 2010 16:58:26 +0200
Subject: [PATCH 3/6] Add optional support for system libedit.

---
 configure.in                              |   14 +++++++++++++-
 frontend/libedit/Makefile.am              |   11 +++++++++--
 frontend/libedit/mono-debugger-readline.h |   10 +++++++++-
 3 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/configure.in b/configure.in
index 6be6bd1..f88e706 100644
--- a/configure.in
+++ b/configure.in
@@ -262,7 +262,19 @@ AC_HEADER_DIRENT
 AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid)
 AC_CHECK_FUNCS(strlcpy strlcat fgetln)
 
-CHECK_READLINE
+AC_ARG_WITH([system-libedit],
+   AS_HELP_STRING([--with-system-libedit], [Use the system copy of libedit.]))
+
+AS_IF([test "x$with_system_libedit" = "xyes"],
+  [
+     AC_CHECK_HEADERS([editline/readline.h libedit/readline.h], [found_libedit_header=yes; break;])
+     AS_IF([test "$found_libedit_header" != "yes"], [AC_MSG_ERROR([Missing libedit/readline.h header])])
+     AC_CHECK_LIB([edit], [el_init], [:], [AC_MSG_ERROR([Missing libedit library])])
+  ], [
+     CHECK_READLINE
+  ])
+
+AM_CONDITIONAL([SYSTEM_LIBEDIT], [test "x$with_system_libedit" = "xyes"])
 
 min_mono_version=72
 symfile_major_version=50
diff --git a/frontend/libedit/Makefile.am b/frontend/libedit/Makefile.am
index 9e03757..100cb88 100644
--- a/frontend/libedit/Makefile.am
+++ b/frontend/libedit/Makefile.am
@@ -1,14 +1,21 @@
 lib_LTLIBRARIES = libmonodebuggerreadline.la
 
 libmonodebuggerreadline_la_SOURCES = \
-	mono-debugger-readline.c mono-debugger-readline.h readline.c readline.h \
+	mono-debugger-readline.c mono-debugger-readline.h
+
+if SYSTEM_LIBEDIT
+libedit_libs = -ledit
+else
+libedit_libs = @READLINE_DEPLIBS@
+libmonodebuggerreadline_la_SOURCES += readline.c readline.h \
 	chared.c common.c el.c emacs.c fcns.c help.c hist.c history.c key.c map.c \
 	parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c vis.c unvis.c \
 	strlcpy.c strlcat.c chared.h common.h el.h emacs.h fcns.h help.h histedit.h hist.h \
 	key.h map.h parse.h prompt.h read.h refresh.h search.h sig.h sys.h term.h tty.h \
 	vi.h vis.h el_term.h filecomplete.h tokenizer.c filecomplete.c
+endif
 
-libmonodebuggerreadline_la_LIBADD = @BASE_DEPENDENCIES_LIBS@ @READLINE_DEPLIBS@
+libmonodebuggerreadline_la_LIBADD = @BASE_DEPENDENCIES_LIBS@ $(libedit_libs)
 if PLATFORM_X86_DARWIN
 libmonodebuggerreadline_la_LDFLAGS = -no-undefined -shared -Wl
 else
diff --git a/frontend/libedit/mono-debugger-readline.h b/frontend/libedit/mono-debugger-readline.h
index c547c75..1a854cc 100644
--- a/frontend/libedit/mono-debugger-readline.h
+++ b/frontend/libedit/mono-debugger-readline.h
@@ -1,9 +1,17 @@
 #ifndef __MONO_DEBUGGER_READLINE_H__
 #define __MONO_DEBUGGER_READLINE_H__
 
+#include <config.h>
+
 #include <glib.h>
 #include <stdio.h>
-#include <readline.h>
+#if defined(HAVE_LIBEDIT_READLINE_H)
+# include <libedit/readline.h>
+#elif defined(HAVE_LIBEDIT_READLINE_H)
+# include <libedit/readline.h>
+#else
+# include "readline.h"
+#endif
 
 G_BEGIN_DECLS
 
-- 
1.7.0

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to