From a6235689a462404604d9d80ab5d9e8e24654d785 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 5 Jun 2009 13:45:21 +0000 Subject: [PATCH] (trunk) #2167 improve the autoconf libevent test: don't use the OS copy unless it's got evutil_vsnprintf() --- configure.ac | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index a427cd8ee..f7e3151ae 100644 --- a/configure.ac +++ b/configure.ac @@ -170,16 +170,29 @@ dnl build our copy of libevent whether we use it or not, dnl because "make dist" needs its Makefiles to exist, and dnl AM_CONDITIONAL + AC_CONFIG_SUBDIRS don't seem to play nice AC_CONFIG_SUBDIRS([third-party/libevent]) - +libevent_source=bundled +AC_CHECK_LIB([event],[evutil_vsnprintf], + [libevent_found=yes], + [libevent_found=no], + [-levent]) AC_CHECK_HEADER([event-config.h], - [libevent_source=system - LIBEVENT_CPPFLAGS="" - LIBEVENT_LIBS="-levent -lrt"], - [libevent_source=bundled - AC_MSG_NOTICE([couldn't find event-config.h, so using our own copy of libevent from third-party/libevent/.]) - AC_MSG_NOTICE([if you are cross-compiling this is probably NOT what you want.]) - LIBEVENT_CPPFLAGS="-I\$(top_srcdir)/third-party/libevent -I\$(top_builddir)/third-party/libevent" - LIBEVENT_LIBS="\$(top_builddir)/third-party/libevent/libevent.la"]) + [libevent_headers_found=yes], + [libevent_headers_found=no]) +libevent_source=bundled +if test "x$libevent_found" = "xyes" ; then + if test "x$libevent_headers_found" = "xyes"; then + libevent_source=system + fi +fi +if test "x$libevent_source" = "xbundled"; then + AC_MSG_NOTICE([couldn't find event-config.h, so using our own copy of libevent from third-party/libevent/.]) + AC_MSG_NOTICE([if you are cross-compiling this is probably NOT what you want.]) + LIBEVENT_CPPFLAGS="-I\$(top_srcdir)/third-party/libevent -I\$(top_builddir)/third-party/libevent" + LIBEVENT_LIBS="\$(top_builddir)/third-party/libevent/libevent.la" +else + LIBEVENT_CPPFLAGS="" + LIBEVENT_LIBS="-levent -lrt" +fi AC_SUBST(LIBEVENT_CPPFLAGS) AC_SUBST(LIBEVENT_LIBS)