diff --git a/configure.ac b/configure.ac index fcf9cb0ee..d8d7cc736 100644 --- a/configure.ac +++ b/configure.ac @@ -161,6 +161,15 @@ AC_TRY_LINK([#include ], [va_list ap1, ap2; va_copy(ap1, ap2);], ]) +dnl libevent likes to link against librt if possible +dnl for clock_gettime() and clock_settime() +dnl TODO(libevent2): this can probably be removed after +dnl we switch to libevent2, since it will have PKG_CONFIG +AC_CHECK_LIB([rt], + [clock_gettime], + [libevent_extra_libs="-lrt"], + [libevent_extra_libs=""]) + 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 @@ -169,7 +178,7 @@ libevent_source=bundled AC_CHECK_LIB([event],[evutil_vsnprintf], [libevent_found=yes], [libevent_found=no], - [-levent]) + [$libevent_extra_libs]) AC_CHECK_HEADER([event-config.h], [libevent_headers_found=yes], [libevent_headers_found=no]) @@ -186,7 +195,7 @@ if test "x$libevent_source" = "xbundled"; then LIBEVENT_LIBS="\$(top_builddir)/third-party/libevent/libevent.la" else LIBEVENT_CFLAGS="" - LIBEVENT_LIBS="-levent -lrt" + LIBEVENT_LIBS="-levent $libevent_extra_libs" fi AC_SUBST(LIBEVENT_CFLAGS) AC_SUBST(LIBEVENT_LIBS)