2 AC_REVISION($Revision$)
3 AC_DEFUN(modname,[rlm_dbm])
5 if test x$with_[]modname != xno; then
10 dnl extra argument: --with-rlm-dbm-lib-dir
12 AC_ARG_WITH(rlm-dbm-lib-dir,
13 [ --with-rlm-dbm-lib-dir=DIR Directory for DBM library files []],
16 AC_MSG_ERROR(Need rlm-dbm-lib-dir)
21 rlm_dbm_lib_dir="$withval"
26 dnl extra argument: --with-rlm-dbm-include-dir
28 AC_ARG_WITH(rlm-dbm-include-dir,
29 [ --with-rlm-dbm-include-dir=DIR Directory for DBM include files []],
32 AC_MSG_ERROR(Need rlm-dbm-include-dir)
37 rlm_dbm_include_dir="$withval"
42 smart_try_dir=$rlm_dbm_include_dir
43 AC_SMART_CHECK_INCLUDE(ndbm.h)
44 if test "x$ac_cv_header_ndbm_h" = "xyes"; then
45 SMART_CFLAGS="${SMART_CFLAGS} -DHAVE_NDBM_H"
47 AC_SMART_CHECK_INCLUDE(gdbm/ndbm.h)
48 if test "x$ac_cv_header_gdbm_ndbm_h" = "xyes"; then
49 SMART_CFLAGS="${SMART_CFLAGS} -DHAVE_GDBM_NDBM_H"
51 ac_cv_header_gdbm_ndbm_h="bad autoconf assumption"
52 AC_SMART_CHECK_INCLUDE(gdbm-ndbm.h)
53 if test "x$ac_cv_header_gdbmmndbm_h" = "xyes"; then
54 SMART_CFLAGS="${SMART_CFLAGS} -DHAVE_GDBMNDBM_H"
56 fail="$fail (ndbm.h or gdbm/ndbm.h or gdbm-ndbm.h)"
60 AC_MSG_CHECKING([for dbm in default lib])
61 AC_TRY_LINK([extern void* dbm_open();],dbm_open(),[ac_cv_lib_default_dbm_open=yes
62 AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
63 if test "x$ac_cv_lib_default_dbm_open" != "xyes"; then
64 smart_try_dir=$rlm_dbm_lib_dir
65 AC_SMART_CHECK_LIB(ndbm, dbm_open)
66 if test "x$ac_cv_lib_ndbm_dbm_open" != "xyes"; then
68 AC_SMART_CHECK_LIB(gdbm, dbm_open)
69 if test "x$ac_cv_lib_gdbm_dbm_open" != "xyes"; then
71 AC_SMART_CHECK_LIB(gdbm_compat, dbm_open)
72 if test "x$ac_cv_lib_gdbm_compat_dbm_open" != "xyes"; then
73 fail="$fail (libndbm or libgdbm or libgdbm_compat)"
82 echo \*\*\* module modname is disabled.
85 if test x"$fail" != x""; then
86 AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
87 if test x"${enable_strict_dependencies}" = x"yes"; then
88 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
90 AC_MSG_WARN([silently not building ]modname[.])
95 if test "x$targetname" != "x"; then
96 dbm_utils="rlm_dbm_parser rlm_dbm_cat"
97 dbm_install="rlm_dbm_install"
100 dbm_ldflags=$SMART_LIBS
101 dbm_cflags=$SMART_CFLAGS
102 AC_SUBST(dbm_ldflags)
106 AC_SUBST(dbm_install)