1
0
Fork 0
arangodb/m4/external.libev

120 lines
4.0 KiB
Plaintext

dnl -*- mode: Autoconf; -*-
dnl ----------------------------------------------------------------------------
dnl --SECTION-- LIBEV
dnl ----------------------------------------------------------------------------
AC_ARG_WITH(libev,
AS_HELP_STRING([--with-libev=DIR], [where the libev library and includes are located]),
[LIBEV_CPPFLAGS="-I$withval/include"
LIBEV_LDFLAGS="-L$withval/lib"
LIBEV="$withval"]
)
AC_ARG_WITH(libev-lib,
AS_HELP_STRING([--with-libev-lib=DIR], [where the libev library is located]),
[LIBEV_LDFLAGS="-L$withval"]
)
AC_MSG_NOTICE([--------------------------------------------------------------------------------])
AC_MSG_NOTICE([CHECKING FOR LIBEV])
AC_MSG_NOTICE([--------------------------------------------------------------------------------])
dnl ----------------------------------------------------------------------------
dnl checks for the LIBEV library
dnl ----------------------------------------------------------------------------
AC_LANG(C)
if test "x$LIBEV_CPPFLAGS" != x; then
TR_INCLUDE([LIBEV_CPPFLAGS])
LIBEV_CPPFLAGS="$LIBEV_CPPFLAGS -DEV_MINIMAL=0"
fi
dnl ----------------------------------------------------------------------------
dnl save flags
dnl ----------------------------------------------------------------------------
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $LIBEV_CPPFLAGS"
SAVE_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $LIBEV_LDFLAGS"
SAVE_LIBS="$LIBS"
dnl ----------------------------------------------------------------------------
dnl check for header and library
dnl ----------------------------------------------------------------------------
tr_LIBEV="yes"
AC_CHECK_HEADERS(ev.h, [], [tr_LIBEV="no"])
AC_CHECK_LIB([rt], [clock_gettime], [LIBEV_LIBS="-lrt" LIBS="-lrt $LIBS"], [tr_LIBEV="no"])
AC_CHECK_LIB([ev], [ev_now], [LIBEV_LIBS="-lev $LIBEV_LIBS" tr_LIBEV="yes"], [tr_LIBEV="no"])
if test "x$tr_LIBEV" != xyes; then
AC_MSG_ERROR([Please install libev from http://software.schmorp.de/pkg/libev.html])
fi
dnl ----------------------------------------------------------------------------
dnl add substitutions
dnl ----------------------------------------------------------------------------
AC_SUBST(LIBEV_CPPFLAGS)
AC_SUBST(LIBEV_LDFLAGS)
AC_SUBST(LIBEV_LIBS)
dnl ----------------------------------------------------------------------------
dnl grep libev version number
dnl ----------------------------------------------------------------------------
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <ev.h>
main () {
long sdnhg36ed = EV_VERSION_MAJOR EV_VERSION_MINOR ;
}
_ACEOF
AC_MSG_CHECKING([LIBEV version])
eval "$ac_cpp conftest.$ac_ext" | fgrep "long sdnhg36ed" | awk '{print $4 "." $5}' > conftest.output
TRI_LIBEV_VERSION=`cat conftest.output`
AC_MSG_RESULT([$TRI_LIBEV_VERSION])
rm -f conftest*
dnl ----------------------------------------------------------------------------
dnl restore flags
dnl ----------------------------------------------------------------------------
LIBS="$SAVE_LIBS"
LDFLAGS="$SAVE_LDFLAGS"
CPPFLAGS="$SAVE_CPPFLAGS"
LIBEV_CPPFLAGS="${LIBEV_CPPFLAGS} -DTRI_LIBEV_VERSION='\"${TRI_LIBEV_VERSION}\"'"
dnl ----------------------------------------------------------------------------
dnl informational output
dnl ----------------------------------------------------------------------------
LIB_INFO="$LIB_INFO|LIBEV: system version"
LIB_INFO="$LIB_INFO|LIBEV VERSION: ${TRI_LIBEV_VERSION}"
LIB_INFO="$LIB_INFO|LIBEV_CPPFLAGS: ${LIBEV_CPPFLAGS}"
LIB_INFO="$LIB_INFO|LIBEV_LDFLAGS: ${LIBEV_LDFLAGS}"
LIB_INFO="$LIB_INFO|LIBEV_LIBS: ${LIBEV_LIBS}"
LIB_INFO="$LIB_INFO|."
dnl ----------------------------------------------------------------------------
dnl --SECTION-- END-OF-FILE
dnl ----------------------------------------------------------------------------
dnl Local Variables:
dnl mode: outline-minor
dnl outline-regexp: "^\\(dnl --SECTION--\\)"
dnl End: