c07f75d82d3486ca5b1ae815468657e344777ee3
[xfstests-dev.git] / m4 / package_gdbmdev.m4
1 AC_DEFUN([AC_PACKAGE_WANT_NDBM],
2   [ AC_CHECK_HEADERS(ndbm.h, [ have_db=true ], [ have_db=false ])
3     found=false
4     libgdbm=""
5
6     if test $have_db = true; then
7       AC_CHECK_LIB(ndbm,dbm_open,found=true,found=false)
8       AC_CHECK_LIB(ndbm,dbm_fetch,,found=false)
9       AC_CHECK_LIB(ndbm,dbm_store,,found=false)
10       AC_CHECK_LIB(ndbm,dbm_close,,found=false)
11
12       if test $found = true; then
13         libgdbm="$ndbm"
14       fi
15     fi
16
17     AC_SUBST(libgdbm)
18     AC_SUBST(have_db)
19   ])
20
21 AC_DEFUN([AC_PACKAGE_WANT_GDBM],
22   [ AC_CHECK_HEADERS([gdbm/ndbm.h, gdbm-ndbm.h], [ have_db=true ], [ have_db=false ])
23     found=false
24     libgdbm=""
25
26     if test $have_db = true; then
27       AC_CHECK_LIB(gdbm,dbm_open,found=true,found=false)
28       AC_CHECK_LIB(gdbm,dbm_fetch,,found=false)
29       AC_CHECK_LIB(gdbm,dbm_store,,found=false)
30       AC_CHECK_LIB(gdbm,dbm_close,,found=false)
31
32       if test $found = true; then
33         libgdbm="${libgdbm} -lgdbm"
34       fi
35
36       found="no"
37       AC_CHECK_LIB(gdbm_compat,dbm_open,found=true,found=false)
38       AC_CHECK_LIB(gdbm_compat,dbm_fetch,,found=false)
39       AC_CHECK_LIB(gdbm_compat,dbm_store,,found=false)
40       AC_CHECK_LIB(gdbm_compat,dbm_close,,found="no")
41
42       if test $found = true ; then
43         libgdbm="${libgdbm} -lgdbm_compat"
44       fi
45     fi
46
47     AC_SUBST(libgdbm)
48     AC_SUBST(have_db)
49   ])
50