Include <ucred.h> if we have getpeerucred()
[heimdal.git] / cf / roken.m4
blobd4feddaa2b97050b41024a9d05df0f16127b7fb7
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
9 dnl AC_ROKEN(version,directory-to-try,roken-dir,fallback-library,fallback-cppflags)
10 AC_DEFUN([AC_ROKEN], [
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])
18 save_CPPFLAGS="${CPPFLAGS}"
20 case $with_roken in
21 yes|"")
22   dirs="$2" ;;
24   dirs="$with_roken" ;;
25 esac
27 roken_installed=no
29 for i in $dirs; do
31 AC_MSG_CHECKING(for roken in $i)
33 CPPFLAGS="-I$i/include ${CPPFLAGS}"
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])
43 AC_MSG_RESULT($roken_installed)
45 done
47 CPPFLAGS="$save_CPPFLAGS"
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"
59 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
61 AC_SUBST(LIB_roken)dnl
62 AC_SUBST(DIR_roken)dnl
63 AC_SUBST(CPPFLAGS_roken)dnl