xfstests: Incorrect check for gdbm/ndbm.h
[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         fi
32     fi
33
34     found=false
35     libgdbm=""
36
37     if test $have_db = true; then
38       AC_CHECK_LIB(gdbm,dbm_open,found=true,found=false)
39       AC_CHECK_LIB(gdbm,dbm_fetch,,found=false)
40       AC_CHECK_LIB(gdbm,dbm_store,,found=false)
41       AC_CHECK_LIB(gdbm,dbm_close,,found=false)
42
43       if test $found = true; then
44         libgdbm="${libgdbm} -lgdbm"
45       fi
46
47       found="no"
48       AC_CHECK_LIB(gdbm_compat,dbm_open,found=true,found=false)
49       AC_CHECK_LIB(gdbm_compat,dbm_fetch,,found=false)
50       AC_CHECK_LIB(gdbm_compat,dbm_store,,found=false)
51       AC_CHECK_LIB(gdbm_compat,dbm_close,,found="no")
52
53       if test $found = true ; then
54         libgdbm="${libgdbm} -lgdbm_compat"
55       fi
56     fi
57
58     AC_SUBST(libgdbm)
59     AC_SUBST(have_db)
60   ])
61