Moved warning message out of necessary condition.
[freeradius.git] / src / modules / rlm_dbm / configure.in
index 881a714..250e4f8 100644 (file)
@@ -7,23 +7,63 @@ if test x$with_[]modname != xno; then
        AC_PROG_CC
        AC_PROG_CPP
 
+       dnl extra argument: --with-rlm-dbm-lib-dir
+       rlm_dbm_lib_dir=
+       AC_ARG_WITH(rlm-dbm-lib-dir,
+       [  --with-rlm-dbm-lib-dir=DIR       Directory for DBM library files []],
+       [ case "$withval" in
+           no)
+               AC_MSG_ERROR(Need rlm-dbm-lib-dir)
+               ;;
+           yes)
+               ;;
+           *)
+               rlm_dbm_lib_dir="$withval"
+               ;;
+         esac ]
+       )
+
+       dnl extra argument: --with-rlm-dbm-include-dir
+       rlm_dbm_inc_dir=
+       AC_ARG_WITH(rlm-dbm-include-dir,
+       [  --with-rlm-dbm-include-dir=DIR   Directory for DBM include files []],
+       [ case "$withval" in
+           no)
+               AC_MSG_ERROR(Need rlm-dbm-include-dir)
+               ;;
+           yes)
+               ;;
+           *)
+               rlm_dbm_include_dir="$withval"
+               ;;
+         esac ]
+       )
+
+       smart_try_dir=$rlm_dbm_include_dir
        AC_SMART_CHECK_INCLUDE(ndbm.h)
        if test "x$ac_cv_header_ndbm_h" = "xyes"; then
           SMART_CFLAGS="${SMART_CFLAGS} -DHAVE_NDBM_H"
        else
                AC_SMART_CHECK_INCLUDE(gdbm/ndbm.h)
                if test "x$ac_cv_header_gdbm_ndbm_h" = "xyes"; then
-                 SMART_CFLAGS="${SMART_CFLAGS} -DHAVE_GDBM_NDBM_H"
-               else
-                 fail="$fail ndbm.h or gdbm/ndbm.h"
+                       SMART_CFLAGS="${SMART_CFLAGS} -DHAVE_GDBM_NDBM_H"
+               else
+                       ac_cv_header_gdbm_ndbm_h="bad autoconf assumption"
+                       AC_SMART_CHECK_INCLUDE(gdbm-ndbm.h)
+                       if test "x$ac_cv_header_gdbm_ndbm_h" = "xyes"; then
+                               SMART_CFLAGS="${SMART_CFLAGS} -DHAVE_GDBMNDBM_H"
+                       else
+                               fail="$fail (ndbm.h or gdbm/ndbm.h or gdbm-ndbm.h)"
+                       fi
                fi
        fi
 
+       smart_try_dir=$rlm_dbm_lib_dir
        AC_SMART_CHECK_LIB(ndbm, dbm_open)
        if test "x$ac_cv_lib_ndbm_dbm_open" != "xyes"; then
                AC_SMART_CHECK_LIB(gdbm, dbm_open)
                if test "x$ac_cv_lib_gdbm_dbm_open" != "xyes"; then
-                       fail="$fail libndbm or libgdm   "
+                       fail="$fail (libndbm or libgdm)"
                fi
        fi
 
@@ -34,11 +74,11 @@ else
 fi
 
 if test x"$fail" != x""; then
+       AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
        if test x"${enable_strict_dependencies}" = x"yes"; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
                targetname=""
        fi
 fi