[PATCH] Fix libedit detection on *BSD OS's

Brad brad at comstyle.com
Mon Jan 2 20:03:46 CET 2012


The following patch allows the autoconf script to detect the presence of
libedit when there isn't a pkg-config file present and thus allowing
Varnish to detect libedit on OpenBSD/FreeBSD/NetBSD/DragonFly.

diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c
index bb5cc8e..90532a8 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -33,8 +33,12 @@
 
 #ifdef HAVE_LIBEDIT
 #include <stdio.h>
+#ifdef HAVE_READLINE_READLINE_H
+#include <readline/readline.h>
+#else
 #include <editline/readline.h>
 #endif
+#endif
 
 #include <errno.h>
 #include <fcntl.h>
diff --git a/configure.ac b/configure.ac
index 01eac28..7d33c32 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,9 +142,16 @@ fi
 AC_SUBST(PCRE_CFLAGS)
 AC_SUBST(PCRE_LIBS)
 
-PKG_CHECK_MODULES([LIBEDIT], [libedit], 
+PKG_CHECK_MODULES([LIBEDIT], [libedit],
 	[AC_DEFINE([HAVE_LIBEDIT], [1], [Define we have libedit])],
-	[AC_MSG_WARN([libedit not found, disabling libedit support])])
+	[AC_CHECK_HEADERS([readline/readline.h])
+	 AC_CHECK_LIB(edit, el_init,
+		[ AC_DEFINE([HAVE_LIBEDIT], [1], [Define we have libedit])
+		  LIBEDIT_CFLAGS=""
+		  LIBEDIT_LIBS="-ledit ${CURSES_LIBS}"
+		],
+		[AC_MSG_WARN([libedit not found, disabling libedit support])],
+		[${CURSES_LIBS}])])
 
 # Checks for header files.
 AC_HEADER_STDC

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the varnish-dev mailing list