From 6bf9c46f8a54cba6cf0c6c78e88128e91b53779c Mon Sep 17 00:00:00 2001 From: Trond Norbye Date: Wed, 10 Dec 2008 13:30:04 +0100 Subject: [PATCH] Add --with-memcached to be able to specify the memcached binary to use for make test --- config/memcached.m4 | 32 ++++++++++++++++++++++++++++++++ configure.ac | 1 + tests/server.c | 13 +++++++++---- 3 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 config/memcached.m4 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); -- 2.30.2