pandora_have_libtokyocabinet.m4 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. dnl Copyright (C) 2009 Sun Microsystems, Inc.
  2. dnl This file is free software; Sun Microsystems, Inc.
  3. dnl gives unlimited permission to copy and/or distribute it,
  4. dnl with or without modifications, as long as this notice is preserved.
  5. dnl Provides support for finding libtokyocabinet.
  6. dnl LIBTOKYOCABINET_CFLAGS will be set, in addition to LIBTOKYOCABINET and LTLIBTOKYOCABINET
  7. AC_DEFUN([_PANDORA_SEARCH_LIBTOKYOCABINET],[
  8. AC_REQUIRE([AC_LIB_PREFIX])
  9. dnl --------------------------------------------------------------------
  10. dnl Check for libtokyocabinet
  11. dnl --------------------------------------------------------------------
  12. AC_ARG_ENABLE([libtokyocabinet],
  13. [AS_HELP_STRING([--disable-libtokyocabinet],
  14. [Build with libtokyocabinet support @<:@default=on@:>@])],
  15. [ac_enable_libtokyocabinet="$enableval"],
  16. [ac_enable_libtokyocabinet="yes"])
  17. AS_IF([test "x$ac_enable_libtokyocabinet" = "xyes"],[
  18. AC_LIB_HAVE_LINKFLAGS(tokyocabinet,,[
  19. #include <tcutil.h>
  20. #include <tcadb.h>
  21. ],[
  22. const char *test= tcversion;
  23. bool ret= tcadboptimize(NULL, "params");
  24. ])
  25. ],[
  26. ac_cv_libtokyocabinet="no"
  27. ])
  28. AS_IF([test "${ac_cv_libtokyocabinet}" = "no" -a "${ac_enable_libtokyocabinet}" = "yes"],[
  29. PKG_CHECK_MODULES([LIBTOKYOCABINET], [libtokyocabinet >= 1.4.15], [
  30. ac_cv_libtokyocabinet=yes
  31. LTLIBTOKYOCABINET=${LIBTOKYOCABINET_LIBS}
  32. LIBTOKYOCABINET=${LIBTOKYOCABINET_LIBS}
  33. ],[test x = y])
  34. ])
  35. AM_CONDITIONAL(HAVE_LIBTOKYOCABINET, [test "${ac_cv_libtokyocabinet}" = "yes"])
  36. ])
  37. AC_DEFUN([PANDORA_HAVE_LIBTOKYOCABINET],[
  38. AC_REQUIRE([_PANDORA_SEARCH_LIBTOKYOCABINET])
  39. ])
  40. AC_DEFUN([PANDORA_REQUIRE_LIBTOKYOCABINET],[
  41. AC_REQUIRE([_PANDORA_SEARCH_LIBTOKYOCABINET])
  42. AS_IF([test "x${ac_cv_libtokyocabinet}" = "xno"],
  43. PANDORA_MSG_ERROR([libtokyocabinet is required for ${PACKAGE}. On Debian systems this is found in libtokyocabinet-dev. On RedHat, in tokyocabinet-devel.]))
  44. ])