2 AC_INIT([onak],[0.3.0+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_MSG_CHECKING([which key database backend to use])
13 AC_MSG_RESULT([$enable_backend])
14 AC_CHECK_FILE([$srcdir/keydb_$enable_backend.c], ,AC_MSG_ERROR([non existent key database backend $enable_backend]))
16 if test "x$enable_backend" = "xdb4"
18 AC_CHECK_HEADER(db.h, have_db_h="yes", have_db_h="no")
19 AC_MSG_CHECKING(for libdb version in db.h)
20 printf "#include <db.h>\nDB_VERSION_MAJOR DB_VERSION_MINOR\n" >conftest.c
21 set `eval $ac_cpp conftest.c | egrep '^ *[[0-9]] *'`; v="$1"; vv="$2"
23 if test "$v" -ne 4; then
24 AC_MSG_ERROR([ * onak requires libdb version 4])
26 for db in "db-$v.$vv" "db$v.$vv" "db-$v" "db$v" "db"; do
27 AC_MSG_CHECKING(for db_create in lib$db)
30 AC_TRY_LINK([#include <db.h>], db_create(0, 0, 0),
31 have_libdb="yes", have_libdb="no")
32 AC_MSG_RESULT($have_libdb)
33 if test "$have_libdb" != "no"; then break; fi
36 if test "$have_libdb" = "no" -o "$have_db_h" = "no"; then
37 AC_MSG_ERROR(libdb not found.)
39 AC_DEFINE(HAVE_LIBDB, 1, [libdb found])
40 else if test "x$enable_backend" = "xpg"
42 AC_CHECK_LIB(pq, PQsetdbLogin,,
43 AC_MSG_ERROR([cannot compile PostgreSQL backend without libpq]))
47 AC_SUBST(DBTYPE, $enable_backend)
49 AC_CONFIG_FILES(Makefile)