5 dnl NMH_CHECK_DBM(include,library,action-if-found,action-if-not)
7 dnl Check for presence of dbm_open() in the specified library
8 dnl and with the specified include file (if libname is the empty
9 dnl string then don't try to link against any particular library).
11 dnl We set nmh_ndbm_found to 'yes' or 'no'; if found we set
12 dnl nmh_ndbmheader to the first arg and nmh_ndbm to the second.
14 dnl If this macro accepted a list of include,library tuples
15 dnl to test in order that would be cleaner than the current
16 dnl nest of calls in configure.in.
18 dnl We try to link our own code fragment (which includes the
19 dnl headers in the same way slocal.c does) rather than
20 dnl using AC_CHECK_LIB because on later versions of libdb
21 dnl the dbm_open() function is provided via a #define and
22 dnl we don't want to hardcode searching for the internal
23 dnl function that lies behind it. (AC_CHECK_LIB works by
24 dnl defining its own bogus prototype rather than pulling in
25 dnl the right header files.)
27 dnl An oddity (bug) of this macro is that if you haven't
28 dnl done AC_PROG_CC or something that implies it before
29 dnl using this macro autoconf complains about a recursive
32 AC_DEFUN([NMH_CHECK_NDBM],
34 if test "x$2" = "x"; then
36 AC_MSG_CHECKING([for dbm in $1])
39 AC_MSG_CHECKING([for dbm in $1 and $2])
42 dnl We don't try to cache the result, because that exceeds
43 dnl my autoconf skills -- feel free to put it in :-> -- PMM
45 nmh_saved_libs="$LIBS"
46 LIBS="$nmh_libs $5 $LIBS"
47 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
48 #define DB_DBM_HSEARCH 1
51 [[dbm_open("",0,0);]])],[nmh_ndbm_found=yes],[nmh_ndbm_found=no])
52 LIBS="$nmh_saved_libs"
54 if test "$nmh_ndbm_found" = "yes"; then