From: Trond Norbye Date: Wed, 10 Dec 2008 12:30:04 +0000 (+0100) Subject: Add --with-memcached to be able to specify the memcached binary to use for make test X-Git-Tag: 0.26~35 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=6bf9c46f8a54cba6cf0c6c78e88128e91b53779c;p=m6w6%2Flibmemcached Add --with-memcached to be able to specify the memcached binary to use for make test --- diff --git a/config/memcached.m4 b/config/memcached.m4 new file mode 100644 index 00000000..c0e457e7 --- /dev/null +++ b/config/memcached.m4 @@ -0,0 +1,32 @@ +AC_ARG_WITH(memcached, +[[ --with-memcached[=memcached binary] + Memcached binary to use for make test]], +[ + if test -n "$withval" + then + MEMC_BINARY="$withval" + fi + + if test x$withval == xyes + then + MEMC_BINARY=memcached + fi + + # just ignore the user if --without-memcached is passed.. it is + # only used by make test + if test x$withval == xno + then + MEMC_BINARY=memcached + fi +], +[ + AC_PATH_PROG([MEMC_BINARY], [memcached], "no", [$PATH]) +]) + +if test x$MEMC_BINARY == "xno" +then + AC_MSG_ERROR(["could not find memcached binary"]) +fi + +AC_DEFINE_UNQUOTED([MEMCACHED_BINARY], "$MEMC_BINARY", + [Name of the memcached binary used in make test]) diff --git a/configure.ac b/configure.ac index 5206a6a5..621ed0df 100644 --- a/configure.ac +++ b/configure.ac @@ -55,6 +55,7 @@ sinclude(config/dtrace.m4) sinclude(config/byteorder.m4) sinclude(config/64bit.m4) sinclude(config/protocol_binary.m4) +sinclude(config/memcached.m4) # We only support GCC and Sun's forte at the moment CFLAGS="-DMEMCACHED_INTERNAL $CFLAGS" diff --git a/tests/server.c b/tests/server.c index 29f6699d..5023188c 100644 --- a/tests/server.c +++ b/tests/server.c @@ -11,6 +11,7 @@ #include #include #include +#include "libmemcached/libmemcached_config.h" #include "server.h" void server_startup(server_startup_st *construct) @@ -39,16 +40,20 @@ void server_startup(server_startup_st *construct) if (construct->udp){ if(x == 0) { - sprintf(buffer, "memcached -d -P /tmp/%umemc.pid -t 1 -U %u -m 128", x, x+ TEST_PORT_BASE); + sprintf(buffer, "%s -d -P /tmp/%umemc.pid -t 1 -U %u -m 128", + MEMCACHED_BINARY, x, x+ TEST_PORT_BASE); } else { - sprintf(buffer, "memcached -d -P /tmp/%umemc.pid -t 1 -U %u", x, x+ TEST_PORT_BASE); + sprintf(buffer, "%s -d -P /tmp/%umemc.pid -t 1 -U %u", + MEMCACHED_BINARY, x, x+ TEST_PORT_BASE); } } else{ if(x == 0) { - sprintf(buffer, "memcached -d -P /tmp/%umemc.pid -t 1 -p %u -m 128", x, x+ TEST_PORT_BASE); + sprintf(buffer, "%s -d -P /tmp/%umemc.pid -t 1 -p %u -m 128", + MEMCACHED_BINARY, x, x+ TEST_PORT_BASE); } else { - sprintf(buffer, "memcached -d -P /tmp/%umemc.pid -t 1 -p %u", x, x+ TEST_PORT_BASE); + sprintf(buffer, "%s -d -P /tmp/%umemc.pid -t 1 -p %u", + MEMCACHED_BINARY, x, x+ TEST_PORT_BASE); } } status= system(buffer);