2 AC_INIT([onak],[0.3.2+arch],[noodles-onak@earth.li])
3 AC_CONFIG_SRCDIR(onak.c)
4 AC_CONFIG_HEADER(config.h)
10 AC_ARG_ENABLE(backend,AC_HELP_STRING([--enable-backend=<backend>],[Choose the backend database to use. Defaults to db4.]), [], [enable_backend="db4"])
12 AC_ARG_ENABLE(keyd,AC_HELP_STRING([--enable-keyd],[Use keyd as the DB backend.]), [], [])
14 AC_MSG_CHECKING([which key database backend to use])
15 AC_MSG_RESULT([$enable_backend])
16 AC_CHECK_FILE([$srcdir/keydb_$enable_backend.c], ,AC_MSG_ERROR([non existent key database backend $enable_backend]))
18 if test "x$enable_backend" = "xdb4"
20 AC_CHECK_HEADER(db.h, have_db_h="yes", have_db_h="no")
21 AC_MSG_CHECKING(for libdb version in db.h)
22 printf "#include <db.h>\nDB_VERSION_MAJOR DB_VERSION_MINOR\n" >conftest.c
23 set `eval $ac_cpp conftest.c | egrep '^ *[[0-9]] *'`; v="$1"; vv="$2"
25 if test "$v" -ne 4; then
26 AC_MSG_ERROR([ * onak requires libdb version 4])
28 for db in "db-$v.$vv" "db$v.$vv" "db-$v" "db$v" "db"; do
29 AC_MSG_CHECKING(for db_create in lib$db)
32 AC_TRY_LINK([#include <db.h>], db_create(0, 0, 0),
33 have_libdb="yes", have_libdb="no")
34 AC_MSG_RESULT($have_libdb)
35 if test "$have_libdb" != "no"; then break; fi
38 if test "$have_libdb" = "no" -o "$have_db_h" = "no"; then
39 AC_MSG_ERROR(libdb not found.)
41 AC_DEFINE(HAVE_LIBDB, 1, [libdb found])
42 else if test "x$enable_backend" = "xpg"
44 AC_CHECK_LIB(pq, PQsetdbLogin,,
45 AC_MSG_ERROR([cannot compile PostgreSQL backend without libpq]))
49 AC_SUBST(DBTYPE, $enable_backend)
51 AC_SUBST(KEYD, $enable_keyd)
53 AC_CONFIG_FILES(Makefile)