ports/devel/ccache/files/extra-patch-memcached-configure.ac
Bryan Drewery 8b9537c122 MEMCACHED+STATIC: Fix not having HAVE_LIBMEMCACHED defined.
This was causing memcached functionality to not work.

Also flip around the link ordering for libmemcached and libsasl2 to
resolve link-time issues.

Sponsored by:	Dell EMC Isilon
2017-07-27 20:43:21 +00:00

59 lines
2 KiB
Text

--- configure.ac.orig 2017-07-27 13:36:38.827581000 -0700
+++ configure.ac 2017-07-27 13:39:10.856958000 -0700
@@ -28,6 +28,10 @@ AC_PROG_CC_C99
if test "$ac_cv_prog_cc_c99" = no; then
AC_MSG_ERROR(cannot find a C99-compatible compiler)
fi
+AC_PROG_CXX
+if test "$ac_cv_prog_cxx" = no; then
+ AC_MSG_ERROR(cannot find a C++-compatible compiler)
+fi
AC_PROG_CPP
AC_PROG_INSTALL
@@ -97,19 +101,39 @@ AC_ARG_ENABLE(memcached,
[AS_HELP_STRING([--enable-memcached],
[enable memcached as a cache backend])])
+# Need to use C++ compiler for linking -lmemcached as static, rather than
+# hacking in GCC's -lstdc++, since we may be using Clang.
+AC_LANG(C++)
dnl enable-memcached: Check if -lmemcached is needed.
if test x${enable_memcached} != x; then
- if test x${enable_static} != x; then
+ if false && test x${enable_static} != x; then
AC_CHECK_LIB(stdc++, __gxx_personality_v0,[])
fi
AC_CHECK_LIB(pthread, pthread_once)
- AC_CHECK_LIB(memcached, memcached,[],[
- echo ' WARNING: recent version libmemcached not found'
- echo ' please install libmemcached > 1.0 with development files'
- exit 1
- ])
+ if test x${enable_static} != x; then
+ AC_CHECK_LIB(sasl2, sasl_version, ac_cv_have_libsasl2=yes,
+ ac_cv_have_libsasl2=no, -lcrypto -lopie -lmd)
+ fi
+ if test x$ac_cv_have_libsasl2 = xyes; then
+ AC_CHECK_LIB(memcached, memcached,[
+ LIBS="${LIBS} -lmemcached -lsasl2 -lcrypto -lopie -lmd"
+ AC_DEFINE(HAVE_LIBMEMCACHED, 1)
+ ]
+ ,[
+ echo ' WARNING: recent version libmemcached not found'
+ echo ' please install libmemcached > 1.0 with development files'
+ exit 1
+ ], -lsasl2 -lcrypto -lopie -lmd)
+ else
+ AC_CHECK_LIB(memcached, memcached,[],[
+ echo ' WARNING: recent version libmemcached not found'
+ echo ' please install libmemcached > 1.0 with development files'
+ exit 1
+ ])
+ fi
ccache_memcached='CCACHE_MEMCACHED=1 '
fi
+AC_LANG(C)
dnl Check for zlib
AC_ARG_WITH(bundled-zlib,