]> git.sommitrealweird.co.uk Git - onak.git/blob - configure.ac
Fix cleanup of statoverrides when purging package.
[onak.git] / configure.ac
1 AC_PREREQ(2.50)
2 AC_INIT([onak],[0.3.0],[noodles-onak@earth.li])
3 AC_CONFIG_SRCDIR(onak.c)
4 AC_CONFIG_HEADER(config.h)
5
6 AC_PROG_CC
7
8 AC_C_BIGENDIAN
9
10 AC_ARG_ENABLE(backend,AC_HELP_STRING([--enable-backend=<backend>],[Choose the backend database to use. Defaults to db4.]), [], [enable_backend="db4"])
11
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]))
15
16 if test "x$enable_backend" = "xdb4"
17 then
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"
22         AC_MSG_RESULT($v.$vv)
23         if test "$v" -ne 4; then
24                 AC_MSG_RESULT([   * onak requires libdb version 4])
25         fi
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)
28                 oldLIBS="$LIBS"
29                 LIBS="$LIBS -l$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
34                 LIBS="$oldLIBS"
35         done
36         if test "$have_libdb" = "no" -o "$have_db_h" = "no"; then
37                 AC_MSG_ERROR(libdb not found.)
38         fi
39         AC_DEFINE(HAVE_LIBDB, 1, [libdb found])
40 else if test "x$enable_backend" = "xpg"
41 then
42         AC_CHECK_LIB(pq, PQsetdbLogin,,
43                 AC_MSG_ERROR([cannot compile PostgreSQL backend without libpq]))
44 fi
45 fi
46
47 AC_SUBST(DBTYPE, $enable_backend)
48
49 AC_CONFIG_FILES(Makefile)
50
51 AC_OUTPUT