| 1 | dnl @synopsis AX_CHECK_BDB_V1 |
|---|
| 2 | dnl |
|---|
| 3 | dnl This macro find an installation of Berkeley DB version 1, or compatible. |
|---|
| 4 | dnl It will define the following macros on success: |
|---|
| 5 | dnl |
|---|
| 6 | dnl HAVE_DB - If Berkeley DB version 1 or compatible is available |
|---|
| 7 | dnl DB_HEADER - The relative path and filename of the header file |
|---|
| 8 | dnl LIBS - Updated for correct library |
|---|
| 9 | dnl |
|---|
| 10 | dnl @category C |
|---|
| 11 | dnl @author Martin Ebourne |
|---|
| 12 | dnl @version 2005/07/12 |
|---|
| 13 | dnl @license AllPermissive |
|---|
| 14 | |
|---|
| 15 | AC_DEFUN([AX_CHECK_BDB_V1], [ |
|---|
| 16 | ac_have_bdb=no |
|---|
| 17 | AC_CHECK_HEADERS([db_185.h db4/db_185.h db3/db_185.h db1/db.h db.h], |
|---|
| 18 | [ac_bdb_header=$ac_header; break], [ac_bdb_header=""]) |
|---|
| 19 | if test "x$ac_bdb_header" != x; then |
|---|
| 20 | AC_SEARCH_LIBS([__db185_open], |
|---|
| 21 | [db db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db4 db-3 db3], |
|---|
| 22 | [ac_have_bdb=yes], |
|---|
| 23 | [AC_SEARCH_LIBS([dbopen], [db-1 db1 db], [ac_have_bdb=yes])]) |
|---|
| 24 | fi |
|---|
| 25 | if test "x$ac_have_bdb" = "xyes"; then |
|---|
| 26 | AC_MSG_CHECKING([whether found db libraries work]) |
|---|
| 27 | AC_RUN_IFELSE([AC_LANG_PROGRAM([[ |
|---|
| 28 | $ac_includes_default |
|---|
| 29 | #include "$ac_bdb_header"]], [[ |
|---|
| 30 | DB *dbp = dbopen(0, 0, 0, DB_HASH, 0); |
|---|
| 31 | if(dbp) dbp->close(dbp); |
|---|
| 32 | return 0; |
|---|
| 33 | ]])], [ |
|---|
| 34 | AC_MSG_RESULT([yes]) |
|---|
| 35 | AC_DEFINE([HAVE_DB], 1, [Define to 1 if Berkeley DB is available]) |
|---|
| 36 | AC_DEFINE_UNQUOTED([DB_HEADER], ["$ac_bdb_header"], |
|---|
| 37 | [Define to the location of the Berkeley DB 1.85 header]) |
|---|
| 38 | ], [ |
|---|
| 39 | AC_MSG_RESULT([no]) |
|---|
| 40 | ac_have_bdb=no |
|---|
| 41 | ]) |
|---|
| 42 | fi |
|---|
| 43 | ])dnl |
|---|