]> arthur.barton.de Git - netatalk.git/blob - macros/db3-check.m4
Change all references to db3/DB3 to BDB. We now support Berkeley DB
[netatalk.git] / macros / db3-check.m4
1 dnl $Id: db3-check.m4,v 1.8 2003-01-04 21:41:49 jmarcus Exp $
2 dnl Autoconf macro to check for the Berkeley DB library
3
4 AC_DEFUN([AC_PATH_BDB], [
5         trybdbdir=""
6         AC_ARG_WITH(bdb,
7                 [  --with-bdb=PATH         specify path to Berkeley DB installation],
8                 if test "x$withval" != "xno"; then
9                         trybdbdir="$withval"
10                 fi
11         )
12
13         bdbfound=no
14         for bdbdir in "" "$trybdbdir" "$trybdbdir/include" "$trybdbdir/include/db3" "/usr/local/BerkeleyDB.3.3/include" "/usr/local/include/db3" "/usr/local/include" "/usr/include/db3" "/usr/include" ; do
15                 if test -f "$bdbdir/db.h" ; then
16                         bdblibdir="`echo $bdbdir | sed 's/include\/db3$/lib/'`"
17                         bdblibdir="`echo $bdblibdir | sed 's/include$/lib/'`"
18
19                         savedcflags="$CFLAGS"
20                         savedldflags="$LDFLAGS"
21                         CFLAGS="$CFLAGS -I$bdbdir"
22                         LDFLAGS="-L$bdblibdir $LDFLAGS"
23                         AC_CHECK_LIB(db, main, [
24                                 bdbfound=yes
25                                 BDB_CFLAGS="-I$bdbdir"
26                                 BDB_LIBS="-L$bdblibdir -ldb"
27                                 BDB_PATH="`echo $bdbdir | sed 's,include/db3$,,'`"
28                         ])
29                         CFLAGS="$savedcflags"
30                         LDFLAGS="$savedldflags"
31                         break;
32                 fi
33         done
34
35         if test "x$bdbfound" = "xyes"; then
36                 ifelse([$1], , :, [$1])
37         else
38                 ifelse([$2], , :, [$2])     
39         fi
40
41         AC_SUBST(BDB_CFLAGS)
42         AC_SUBST(BDB_LIBS)
43         AC_SUBST(BDB_PATH)
44 ])