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