From: Adam Dickmeiss Date: Tue, 10 Jun 2014 11:43:03 +0000 (+0000) Subject: Use pkg-config for getting libmemcached CFLAGS/LIBS X-Git-Tag: v5.2.0~25 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=94da887fdc444b624e4736e860e9a1777c92e847;p=yaz-moved-to-github.git Use pkg-config for getting libmemcached CFLAGS/LIBS Also, require version 1.0 or later of libmemcached. This is because older versions of libmemcached have a different API and because we have stability issues with version 0.31 on CentOS 6.5. --- diff --git a/configure.ac b/configure.ac index b9a0398..f10df06 100644 --- a/configure.ac +++ b/configure.ac @@ -96,20 +96,25 @@ dnl ------ memcached memcached=default AC_SUBST([MEMCACHED_LIBS]) AC_ARG_WITH([memcached], [ --with-memcached Memcached library], [memcached=$withval]) -if test "$memcached" != "no" -a -n "$libgcryptversion"; then - AC_CHECK_LIB([memcached],[memcached_get], [MEMCACHED_LIBS="-lmemcached"]) - if test "$ac_cv_lib_memcached_memcached_get" = "yes"; then - AC_CHECK_HEADERS([libmemcached/memcached.h]) - if test "$ac_cv_header_libmemcached_memcached_h" = "yes"; then - AC_CHECK_LIB([memcached],[memcached], [ - AC_DEFINE([HAVE_MEMCACHED_FUNC],[1],[Define to 1 if memcached function is defined])]) - AC_TRY_COMPILE( - [ -#include - ],[ - memcached_return_t x; - ],[AC_DEFINE([HAVE_MEMCACHED_RETURN_T],[1],[Define to 1 if memcached_return_t is defined])] - ) +if test "$memcached" != "no" -a -n "$libgcryptversion" -a "$pkgconfigpath" != "NONE"; then + AC_MSG_CHECKING([for libmemcached]) + if $pkgconfigpath --cflags libmemcached >/dev/null 2>&1 ; then + if $pkgconfigpath --atleast-version 1.0 libmemcached; then + AC_MSG_RESULT([yes]) + CFLAGS="$CFLAGS `$pkgconfigpath --cflags libmemcached`" + MEMCACHED_LIBS="`$pkgconfigpath --libs libmemcached`" + AC_DEFINE([HAVE_MEMCACHED_FUNC],[1],[Define to 1 if memcached function is defined]) + AC_DEFINE([HAVE_MEMCACHED_RETURN_T],[1],[Define to 1 if memcached_return_t is defined]) + else + AC_MSG_RESULT([no. Version 1.0 required]) + if test "$memcached" != "default"; then + AC_MSG_ERROR([libmemcached libraries missing]) + fi + fi + else + AC_MSG_RESULT([no]) + if test "$memcached" != "default"; then + AC_MSG_ERROR([libmemcached libraries missing]) fi fi fi