Changed msg_style and msg_delim to be file static to m_getfld.c
[mmh] / m4 / ndbm.m4
1 dnl --------------
2 dnl CHECK FOR NDBM
3 dnl --------------
4 dnl
5 dnl NMH_CHECK_DBM(include,library,action-if-found,action-if-not)
6
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).
10
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.
13
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.
17
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.)
26
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
30 dnl expansion.
31
32 AC_DEFUN([NMH_CHECK_NDBM],
33 [
34 if test "x$2" = "x"; then
35   nmh_libs=
36   AC_MSG_CHECKING([for dbm in $1])
37 else
38   nmh_libs="-l$2 "
39   AC_MSG_CHECKING([for dbm in $1 and $2])
40 fi
41
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
44
45 nmh_saved_libs="$LIBS"
46 LIBS="$nmh_libs $5 $LIBS"
47 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
48 #define DB_DBM_HSEARCH 1
49 #include <$1>
50 ]],
51 [[dbm_open("",0,0);]])],[nmh_ndbm_found=yes],[nmh_ndbm_found=no])
52 LIBS="$nmh_saved_libs"
53
54 if test "$nmh_ndbm_found" = "yes"; then
55   AC_MSG_RESULT(yes)
56   nmh_ndbmheader="$1"
57   nmh_ndbm="$2"
58   $3
59 else
60   AC_MSG_RESULT(no)
61   $4
62   :
63 fi
64 ])dnl