AC_INIT([globster],[0.0],[projects@yorhel.nl]) AC_CONFIG_SRCDIR([.]) AC_CONFIG_HEADER([config.h]) m4_include([deps/lean.m4]) AM_INIT_AUTOMAKE([foreign subdir-objects]) PKG_PROG_PKG_CONFIG([0.18]) AC_PROG_CC AC_PROG_INSTALL AC_PROG_RANLIB # Don't use AC_GNU_SOURCE, it pulls in a lot of pointless header file checks. AC_DEFINE(_GNU_SOURCE, 1, [Expose some potentially-unportable symbols]) AC_SYS_LARGEFILE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # Check for pod2man AC_CHECK_PROG([have_pod2man],[pod2man],[yes],[no]) AM_CONDITIONAL([USE_POD2MAN], [test "x$have_pod2man" = "xyes"]) AC_SEARCH_LIBS([clock_gettime],[rt]) AC_SEARCH_LIBS([inet_ntop], [nsl]) AC_SEARCH_LIBS([socket], [socket], [], [ AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"], [], [-lnsl])]) AC_CHECK_HEADERS([zlib.h],[],[AC_MSG_ERROR([zlib header file not found])]) AC_CHECK_LIB([z], [deflate], [AC_SUBST([Z_LIBS],[-lz])], [AC_MSG_ERROR(zlib library not found)]) # Libev (4.0+) can either be provided by the system or by using the version in # deps/. AC_ARG_WITH(system-libev, AS_HELP_STRING([--with-system-libev], [Use the system-provided libev instead of the embedded version.]), [usesysev=$withval], [usesysev=auto]) if test "x$usesysev" != "xno"; then havesysev=no AC_CHECK_LIB([ev], [ev_depth], [AC_CHECK_HEADERS([ev.h],[havesysev=yes],[])], []) if test "x$havesysev" = "xno" -a "x$usesysev" = "xyes"; then AC_MSG_ERROR([System-provided libev requested, but library or header could not be found.]) fi usesysev=$havesysev fi if test "x$usesysev" = "xno"; then # Since we have our own libev, let's disable EV_MULTIPLICITY. Decreases # binary size a bit. AC_DEFINE(EV_MULTIPLICITY, 0, [Define to disable support for multiple event loops.]) m4_include([deps/ev/libev.m4]) fi AM_CONDITIONAL([HAVE_SYSEV], [test "x$usesysev" = "xyes"]) # We require 4.0+ and don't want the compatibility macros AC_DEFINE(EV_COMPAT3, 0, [Define to disable compatibility with pre-4.0 libev.]) # Check for SQLite3 PKG_CHECK_EXISTS([sqlite3],[ PKG_CHECK_MODULES([SQLITE],[sqlite3]) ],[ AC_CHECK_HEADERS([sqlite3.h],[], [AC_MSG_ERROR([sqlite3 header file not found])]) AC_CHECK_LIB([sqlite3], [sqlite3_open], [AC_SUBST([SQLITE_LIBS],[-lsqlite3])], [AC_MSG_ERROR([sqlite3 library is required])]) ] ) PKG_CHECK_MODULES([DBUS], [dbus-1]) PKG_CHECK_MODULES([GNUTLS], [gnutls >= 2.4]) # Note that, GnuTLS 2.12 also supports the nettle backend, and already provides # an API to the low-level crypto functions. However, if GnuTLS uses the gcrypt # backend, we still need to initialize gcrypt for threading. Since we have no # reliable way to detect which backend is used, let's just assume gcrypt. And # while we're linking against gcrypt anyway, we might as well use it for # crypto, too. PKG_CHECK_EXISTS([gnutls >= 3.0], [], [ AC_CHECK_LIB([gcrypt], [gcry_control], [AC_SUBST([GCRYPT_LIBS], [-lgcrypt])], [AC_MSG_ERROR([GnuTLS version is older than 3.0, but no libgcrypt found])]) AC_DEFINE(USE_GCRYPT, 1, [Define to use libgcrypt for crypto]) ]) AC_ARG_ENABLE(git-version, AS_HELP_STRING([--enable-git-version], [enable use of git version if available]), [wantgitver=$enableval], [wantgitver=yes]) usegitver=no if test "x$wantgitver" = "xyes" ; then AC_CHECK_PROGS([GIT], [git], [no]) test "x$GIT" != "xno" -a -d "$srcdir/.git" && usegitver=yes fi AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes") # To make logging output more sensible. fnprefix='src/' test "$srcdir" != '.' && fnprefix="$srcdir/$fnprefix" AC_DEFINE_UNQUOTED(GLOBSTER_FN_PREFIX, ["$fnprefix"], [Define to the path of the source directory as seen by __FILE__]) AC_OUTPUT([Makefile])