common/rc: factor out _scratch_xfs_[get|set]_sb_field
[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_HEADER(gdbm-ndbm.h, [ gdbm_ndbm=true; have_db=true ], [ gdbm_ndbm=false; have_db=false ])
23
24     if test $gdbm_ndbm = true; then
25         AC_DEFINE(HAVE_GDBM_NDBM_H, [1], [Define to 1 if you have the <gdbm-ndbm.h> header file.])
26     else
27         AS_UNSET([ac_cv_header_gdbm_ndbm_h])
28         AC_CHECK_HEADER(gdbm/ndbm.h, [ gdbm_ndbm_=true; have_db=true ], [ gdbm_ndbm_=false; have_db=false ])
29         if test $gdbm_ndbm_ = true; then
30             AC_DEFINE(HAVE_GDBM_NDBM_H_, [1], [Define to 1 if you have the <gdbm/ndbm.h> header file.])
31         else
32             AC_CHECK_HEADER(gdbm.h, [ gdbm_ndbm_=true; have_db=true ], [ gdbm_ndbm_=false; have_db=false ])
33             AC_CHECK_HEADER(ndbm.h, [ ndbm_=true ], [ ndbm_=false ])
34                 if test $gdbm_ndbm_ = true; then
35                     if test $ndbm_ = true; then
36                         AC_DEFINE(HAVE_GDBM_H, [1], [Define to 1 if you have both <gdbm.h> and <ndbm.h> header files.])
37                     fi
38                 fi
39         fi
40     fi
41
42     found=false
43     libgdbm=""
44
45     if test $have_db = true; then
46       AC_CHECK_LIB(gdbm,dbm_open,found=true,found=false)
47       AC_CHECK_LIB(gdbm,dbm_fetch,,found=false)
48       AC_CHECK_LIB(gdbm,dbm_store,,found=false)
49       AC_CHECK_LIB(gdbm,dbm_close,,found=false)
50
51       if test $found = true; then
52         libgdbm="${libgdbm} -lgdbm"
53       fi
54
55       found="no"
56       AC_CHECK_LIB(gdbm_compat,dbm_open,found=true,found=false,-lgdbm)
57       AC_CHECK_LIB(gdbm_compat,dbm_fetch,,found=false,-lgdbm)
58       AC_CHECK_LIB(gdbm_compat,dbm_store,,found=false,-lgdbm)
59       AC_CHECK_LIB(gdbm_compat,dbm_close,,found="no",-lgdbm)
60
61       if test $found = true ; then
62         libgdbm="${libgdbm} -lgdbm_compat -lgdbm"
63       fi
64     fi
65
66     AC_SUBST(libgdbm)
67     AC_SUBST(have_db)
68   ])
69