From: Monty Taylor Date: Mon, 15 Jun 2009 00:30:12 +0000 (-0700) Subject: Converted final two m4 files into macros. No more direce sincludes! Yay! X-Git-Tag: 0.31~14^2~10 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=fdfbb3939ecacfcc15d5c0a95a7d9cd99e146ea1;p=awesomized%2Flibmemcached Converted final two m4 files into macros. No more direce sincludes! Yay! --- diff --git a/configure.ac b/configure.ac index 249289a3..422a41d1 100644 --- a/configure.ac +++ b/configure.ac @@ -148,15 +148,15 @@ LIBS="$save_LIBS" AC_SEARCH_LIBS(floorf, m) +dnl Specialty checks DETECT_BYTEORDER ENABLE_UTILLIB ENABLE_DTRACE SETSOCKOPT_SANITY ENABLE_HSIEH_HASH REQUIRE_POD2MAN - -sinclude(m4/protocol_binary.m4) -sinclude(m4/memcached.m4) +PROTOCOL_BINARY_TEST +WITH_MEMCACHED dnl TODO: Remove this define once we are using 2.61 across the board. # AX_HEADER_ASSERT diff --git a/m4/memcached.m4 b/m4/memcached.m4 index 0916bb69..0efa589d 100644 --- a/m4/memcached.m4 +++ b/m4/memcached.m4 @@ -1,32 +1,20 @@ -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 +AC_DEFUN([WITH_MEMCACHED], + [AC_ARG_WITH([memcached], + [AS_HELP_STRING([--with-memcached], + [Memcached binary to use for make test])], + [ac_cv_with_memcached="$withval"], + [ac_cv_with_memcached=memcached]) # 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]) -]) + AS_IF([test "x$withval" = "xno"], + [ac_cv_with_memcached=memcached]) -if test x$MEMC_BINARY = "xno" -then - AC_MSG_ERROR(["could not find memcached binary"]) -fi + AC_PATH_PROG([MEMC_BINARY], [$ac_cv_with_memcached], "no") -AC_DEFINE_UNQUOTED([MEMCACHED_BINARY], "$MEMC_BINARY", + AS_IF([test "x$MEMC_BINARY" = "xno"], + AC_MSG_ERROR(["could not find memcached binary"])) + + AC_DEFINE_UNQUOTED([MEMCACHED_BINARY], "$MEMC_BINARY", [Name of the memcached binary used in make test]) +]) diff --git a/m4/protocol_binary.m4 b/m4/protocol_binary.m4 index 8b8f3f98..d31bcb04 100644 --- a/m4/protocol_binary.m4 +++ b/m4/protocol_binary.m4 @@ -1,19 +1,22 @@ dnl --------------------------------------------------------------------------- dnl Macro: PROTOCOL_BINARY_TEST dnl --------------------------------------------------------------------------- -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -I${srcdir}" -AC_RUN_IFELSE([ - AC_LANG_PROGRAM([ - #include "libmemcached/memcached/protocol_binary.h" - ], [ +AC_DEFUN([PROTOCOL_BINARY_TEST], + [AC_LANG_PUSH([C]) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I${srcdir}" + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ +#include "libmemcached/memcached/protocol_binary.h" + ]],[[ protocol_binary_request_set request; if (sizeof(request) != sizeof(request.bytes)) { return 1; } - ]) -],, AC_MSG_ERROR([Unsupported struct padding done by compiler.])) -CFLAGS="$save_CFLAGS" + ]])],, AC_MSG_ERROR([Unsupported struct padding done by compiler.])) + CFLAGS="$save_CFLAGS" + AC_LANG_POP +]) dnl --------------------------------------------------------------------------- dnl End Macro: PROTOCOL_BINARY_TEST