ccache-memcached: Fix STATIC build.
Libmemcached is a C++ library, thus we need to use a C++ linker to link to it.
This is only really a problem when building a static binary since we need to
bring in various libc++ and libcxxrt symbols. The upstream ccache+memcached
patch had support for this with --enable-static but only via a hack for
GCC to force addding -lstdc++. The method in these patches works
for either compiler by using CXX to check for -lmemcached, and later using
CXX to link ccache.