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