1dnl $Id$
2dnl
3dnl try to look for an installed roken library with sufficient stuff
4dnl
5dnl set LIB_roken to the what we should link with
6dnl set DIR_roken to if the directory should be built
7dnl set CPPFLAGS_roken to stuff to add to CPPFLAGS
8
9dnl AC_ROKEN(version,directory-to-try,roken-dir,fallback-library,fallback-cppflags)
10AC_DEFUN([AC_ROKEN], [
11
12AC_ARG_WITH(roken,
13	AS_HELP_STRING([--with-roken=dir],[use the roken library in dir]),
14[if test "$withval" = "no"; then
15  AC_MSG_ERROR(roken is required)
16fi])
17
18save_CPPFLAGS="${CPPFLAGS}"
19
20case $with_roken in
21yes|"")
22  dirs="$2" ;;
23*)
24  dirs="$with_roken" ;;
25esac
26
27roken_installed=no
28
29for i in $dirs; do
30
31AC_MSG_CHECKING(for roken in $i)
32
33CPPFLAGS="-I$i/include ${CPPFLAGS}"
34
35AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
36#include <roken.h>
37#if ROKEN_VERSION < $1
38#error old roken version, should be $1
39fail
40#endif
41]])],[roken_installed=yes; break])
42
43AC_MSG_RESULT($roken_installed)
44
45done
46
47CPPFLAGS="$save_CPPFLAGS"
48
49if test "$roken_installed" != "yes"; then
50  DIR_roken="roken"
51  LIB_roken='$4'
52  CPPFLAGS_roken='$5'
53  AC_CONFIG_SUBDIRS(lib/roken)
54else
55  LIB_roken="$i/lib/libroken.la"
56  CPPFLAGS_roken="-I$i/include"
57fi
58
59LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
60
61AC_SUBST(LIB_roken)dnl
62AC_SUBST(DIR_roken)dnl
63AC_SUBST(CPPFLAGS_roken)dnl
64])
65