From: Monty Taylor Date: Thu, 21 May 2009 06:52:53 +0000 (-0700) Subject: Moved m4 stuff to m4 dir to match how we're doing it in the other projects. X-Git-Tag: 0.30~3^2~5 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=5a0dc3338c04b40a5d6f335ac6504e9d3f7fd90d;p=m6w6%2Flibmemcached Moved m4 stuff to m4 dir to match how we're doing it in the other projects. --- diff --git a/Makefile.am b/Makefile.am index 446e8ae8..33520339 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -ACLOCAL_AMFLAGS = -I config +ACLOCAL_AMFLAGS = -I m4 SUBDIRS = docs libmemcached libmemcachedutil tests support clients EXTRA_dist = README.FIRST diff --git a/config/64bit.m4 b/config/64bit.m4 deleted file mode 100644 index a704c655..00000000 --- a/config/64bit.m4 +++ /dev/null @@ -1,31 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: 64BIT -dnl --------------------------------------------------------------------------- -AC_ARG_ENABLE(64bit, - [ --enable-64bit Build 64bit library.], - [ - org_cflags=$CFLAGS - CFLAGS=-m64 - AC_LANG(C) - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([], [ if (sizeof(void*) != 8) return 1;]) - ],[ - CFLAGS="$CFLAGS $org_cflags" - ],[ - AC_MSG_ERROR([Don't know how to build a 64-bit object.]) - ]) - org_cxxflags=$CXXFLAGS - CXXFLAGS=-m64 - AC_LANG(C++) - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([], [ if (sizeof(void*) != 8) return 1;]) - ],[ - CXXFLAGS="$CXXFLAGS $org_cxxflags" - ],[ - AC_MSG_ERROR([Don't know how to build a 64-bit object.]) - ]) - - ]) -dnl --------------------------------------------------------------------------- -dnl End Macro: 64BIT -dnl --------------------------------------------------------------------------- diff --git a/config/bootstrap b/config/bootstrap index d252837a..d62ca6ba 100755 --- a/config/bootstrap +++ b/config/bootstrap @@ -7,7 +7,7 @@ die() { echo "$@"; exit 1; } # LIBTOOLIZE=${LIBTOOLIZE:-libtoolize} LIBTOOLIZE_FLAGS=" --automake --copy --force" # ACLOCAL=${ACLOCAL:-aclocal} -ACLOCAL_FLAGS="-I config" +ACLOCAL_FLAGS="-I m4" # AUTOHEADER=${AUTOHEADER:-autoheader} # AUTOMAKE=${AUTOMAKE:-automake} AUTOMAKE_FLAGS="--add-missing --copy --force" diff --git a/config/byteorder.m4 b/config/byteorder.m4 deleted file mode 100644 index b6bd84a8..00000000 --- a/config/byteorder.m4 +++ /dev/null @@ -1,41 +0,0 @@ -AC_DEFUN([DETECT_BYTEORDER], -[ - AC_MSG_CHECKING([for htonll]) - have_htoll="no" - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([ -#include -#include -#include - ], [ - return htonll(0); - ]) - ], [ - have_htoll="yes" - AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll]) - ]) - - AC_MSG_RESULT([$have_htoll]) - AM_CONDITIONAL([BUILD_BYTEORDER],[test "x$have_htoll" == "xno"]) - AC_MSG_CHECKING([byteorder]) - have_htoll="no" - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([ -#include -#include -#include - ], [ -if (htonl(5) != 5) { - return 1; -} - ]) - ], [ - AC_MSG_RESULT([big endian]) - AC_DEFINE([BYTEORDER_BIG_ENDIAN], [1], [Enable big endian byteorder]) - ], [ - AC_MSG_RESULT([little endian]) - AC_DEFINE([BYTEORDER_LITTLE_ENDIAN], [1], [Enable little endian byteorder]) - ]) -]) - -DETECT_BYTEORDER diff --git a/config/debug.m4 b/config/debug.m4 deleted file mode 100644 index 9b177810..00000000 --- a/config/debug.m4 +++ /dev/null @@ -1,20 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: DEBUG_TEST -dnl --------------------------------------------------------------------------- -AC_ARG_ENABLE(debug, - [ --enable-debug Build with support for the DEBUG.], - [ - AC_DEFINE([HAVE_DEBUG], [1], [Enables DEBUG Support]) - AC_CHECK_PROGS(DEBUG, debug) - ENABLE_DEBUG="yes" - AC_SUBST(DEBUGFLAGS) - AC_SUBST(HAVE_DEBUG) - ], - [ - ENABLE_DEBUG="no" - ] - ) -AM_CONDITIONAL([HAVE_DEBUG], [ test "$ENABLE_DEBUG" = "yes" ]) -dnl --------------------------------------------------------------------------- -dnl End Macro: DEBUG_TEST -dnl --------------------------------------------------------------------------- diff --git a/config/dtrace.m4 b/config/dtrace.m4 deleted file mode 100644 index ee39c69a..00000000 --- a/config/dtrace.m4 +++ /dev/null @@ -1,37 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: DTRACE_TEST -dnl --------------------------------------------------------------------------- -AC_ARG_ENABLE(dtrace, - [ --enable-dtrace Build with support for the DTRACE.], - [ - AC_PATH_PROG([DTRACE], [dtrace], "no", [/usr/sbin:$PATH]) - if test "x$DTRACE" != "xno"; then - AC_DEFINE([HAVE_DTRACE], [1], [Enables DTRACE Support]) - DTRACE_HEADER=dtrace_probes.h - - # DTrace on MacOSX does not use -G option - $DTRACE -G -o conftest.$$ -s libmemcached/libmemcached_probes.d 2>/dev/zero - if test $? -eq 0 - then - DTRACE_OBJ=libmemcached_probes.lo - rm conftest.$$ - fi - - ENABLE_DTRACE="yes" - AC_SUBST(HAVE_DTRACE) - else - AC_MSG_ERROR([Need dtrace binary and OS support.]) - fi - ], - [ - ENABLE_DTRACE="no" - ] - ) - -AC_SUBST(DTRACEFLAGS) -AC_SUBST(DTRACE_HEADER) -AC_SUBST(DTRACE_OBJ) -AM_CONDITIONAL([HAVE_DTRACE], [ test "$ENABLE_DTRACE" = "yes" ]) -dnl --------------------------------------------------------------------------- -dnl End Macro: DTRACE_TEST -dnl --------------------------------------------------------------------------- diff --git a/config/extensions.m4 b/config/extensions.m4 deleted file mode 100644 index 611fcfdb..00000000 --- a/config/extensions.m4 +++ /dev/null @@ -1,94 +0,0 @@ -# serial 6 -*- Autoconf -*- -# Enable extensions on systems that normally disable them. - -# Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS -# Autoconf. Perhaps we can remove this once we can assume Autoconf -# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly -# enough in this area it's likely we'll need to redefine -# AC_USE_SYSTEM_EXTENSIONS for quite some time. - -# AC_USE_SYSTEM_EXTENSIONS -# ------------------------ -# Enable extensions on systems that normally disable them, -# typically due to standards-conformance issues. -# Remember that #undef in AH_VERBATIM gets replaced with #define by -# AC_DEFINE. The goal here is to define all known feature-enabling -# macros, then, if reports of conflicts are made, disable macros that -# cause problems on some platforms (such as __EXTENSIONS__). -AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], -[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl -AC_BEFORE([$0], [AC_RUN_IFELSE])dnl - - AC_REQUIRE([AC_CANONICAL_HOST]) - - AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) - if test "$MINIX" = yes; then - AC_DEFINE([_POSIX_SOURCE], [1], - [Define to 1 if you need to in order for `stat' and other - things to work.]) - AC_DEFINE([_POSIX_1_SOURCE], [2], - [Define to 2 if the system does not provide POSIX.1 features - except with this defined.]) - AC_DEFINE([_MINIX], [1], - [Define to 1 if on MINIX.]) - fi - - dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, - dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already - dnl provided. - case "$host_os" in - hpux*) - AC_DEFINE([_XOPEN_SOURCE], [500], - [Define to 500 only on HP-UX.]) - ;; - esac - - AH_VERBATIM([__EXTENSIONS__], -[/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif -]) - AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], - [ac_cv_safe_to_define___extensions__], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ -# define __EXTENSIONS__ 1 - ]AC_INCLUDES_DEFAULT])], - [ac_cv_safe_to_define___extensions__=yes], - [ac_cv_safe_to_define___extensions__=no])]) - test $ac_cv_safe_to_define___extensions__ = yes && - AC_DEFINE([__EXTENSIONS__]) - AC_DEFINE([_ALL_SOURCE]) - AC_DEFINE([_GNU_SOURCE]) - AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) - AC_DEFINE([_TANDEM_SOURCE]) -])# AC_USE_SYSTEM_EXTENSIONS - -# gl_USE_SYSTEM_EXTENSIONS -# ------------------------ -# Enable extensions on systems that normally disable them, -# typically due to standards-conformance issues. -AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], - [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])]) diff --git a/config/hsieh.m4 b/config/hsieh.m4 deleted file mode 100644 index f958f469..00000000 --- a/config/hsieh.m4 +++ /dev/null @@ -1,22 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: HSIEH_HASH -dnl --------------------------------------------------------------------------- -AC_ARG_ENABLE(hsieh_hash, - [ --enable-hsieh_hash build with support for hsieh hashing.], - [ - if test "x$enableval" != "xno"; then - ENABLE_HSIEH="true" - AC_DEFINE([HAVE_HSIEH_HASH], [1], [Enables hsieh hashing support]) - else - ENABLE_HSIEH="false" - fi - ], - [ - ENABLE_HSIEH="false" - ] -) - -AM_CONDITIONAL([INCLUDE_HSIEH_SRC], [test "x$ENABLE_HSIEH" = "xtrue"]) -dnl --------------------------------------------------------------------------- -dnl End Macro: HSIEH_HASH -dnl --------------------------------------------------------------------------- diff --git a/config/memcached.m4 b/config/memcached.m4 deleted file mode 100644 index c0e457e7..00000000 --- a/config/memcached.m4 +++ /dev/null @@ -1,32 +0,0 @@ -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/config/pod2man.m4 b/config/pod2man.m4 deleted file mode 100644 index ef9f394b..00000000 --- a/config/pod2man.m4 +++ /dev/null @@ -1,5 +0,0 @@ -AC_PATH_PROG([POD2MAN], [pod2man], "no", [$PATH:/usr/bin:/usr/local/bin]) -if test "x$POD2MAN" == "xno"; then - AC_MSG_ERROR(["Could not find pod2man anywhere in path"]) -fi -AC_SUBST(POD2MAN) diff --git a/config/protocol_binary.m4 b/config/protocol_binary.m4 deleted file mode 100644 index 8b8f3f98..00000000 --- a/config/protocol_binary.m4 +++ /dev/null @@ -1,20 +0,0 @@ -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" - ], [ - 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" - -dnl --------------------------------------------------------------------------- -dnl End Macro: PROTOCOL_BINARY_TEST -dnl --------------------------------------------------------------------------- diff --git a/config/setsockopt.m4 b/config/setsockopt.m4 deleted file mode 100644 index 4ca7214c..00000000 --- a/config/setsockopt.m4 +++ /dev/null @@ -1,55 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: SETSOCKOPT_TEST -dnl --------------------------------------------------------------------------- -AC_LANG(C) -AC_RUN_IFELSE([ - AC_LANG_PROGRAM([ -#include -#include -#include -#include -#include - ], [ - int sock = socket(AF_INET, SOCK_STREAM, 0); - struct timeval waittime; - - waittime.tv_sec= 0; - waittime.tv_usec= 500; - - if (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, - &waittime, (socklen_t)sizeof(struct timeval)) == -1) { - if (errno == ENOPROTOOPT) { - return 1; - } - } - return 0; - ]) - ], AC_DEFINE(HAVE_SNDTIMEO, 1, [Define to 1 if you have a working SO_SNDTIMEO])) - -AC_RUN_IFELSE([ - AC_LANG_PROGRAM([ -#include -#include -#include -#include -#include - ], [ - int sock = socket(AF_INET, SOCK_STREAM, 0); - struct timeval waittime; - - waittime.tv_sec= 0; - waittime.tv_usec= 500; - - if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, - &waittime, (socklen_t)sizeof(struct timeval)) == -1) { - if (errno == ENOPROTOOPT) { - return 1; - } - } - return 0; - ]) - ], AC_DEFINE(HAVE_RCVTIMEO, 1, [Define to 1 if you have a working SO_RCVTIMEO])) - -dnl --------------------------------------------------------------------------- -dnl End Macro: SETSOCKOPT_TEST -dnl --------------------------------------------------------------------------- diff --git a/config/util.m4 b/config/util.m4 deleted file mode 100644 index e1fc17b4..00000000 --- a/config/util.m4 +++ /dev/null @@ -1,20 +0,0 @@ -BUILD_UTILLIB=yes - -AC_ARG_ENABLE(utils, - [ --enable-utils Build libmemcachedutils [[default=yes]]], - [ - if test "x$enableval" = "xno"; then - BUILD_UTILLIB="no" - fi - ] - ) - -if test "x$BUILD_UTILLIB" = "xyes"; then - AC_SEARCH_LIBS(pthread_create, pthread) - if test "x$ac_cv_search_pthread_create" = "xno"; then - AC_MSG_ERROR([Sorry you need POSIX thread library to build libmemcachedutil.]) - fi - AC_DEFINE([HAVE_LIBMEMCACHEDUTIL], [1], [Enables libmemcachedutil Support]) -fi - -AM_CONDITIONAL([BUILD_LIBMEMCACHEDUTIL],[test "x$BUILD_UTILLIB" = "xyes"]) diff --git a/configure.ac b/configure.ac index aa9cee55..a11f7dfe 100644 --- a/configure.ac +++ b/configure.ac @@ -71,16 +71,16 @@ LIBS="$save_LIBS" AC_SEARCH_LIBS(floorf, m) -sinclude(config/pod2man.m4) -sinclude(config/debug.m4) -sinclude(config/dtrace.m4) -sinclude(config/byteorder.m4) -sinclude(config/64bit.m4) -sinclude(config/protocol_binary.m4) -sinclude(config/memcached.m4) -sinclude(config/setsockopt.m4) -sinclude(config/hsieh.m4) -sinclude(config/util.m4) +sinclude(m4/pod2man.m4) +sinclude(m4/debug.m4) +sinclude(m4/dtrace.m4) +sinclude(m4/byteorder.m4) +sinclude(m4/64bit.m4) +sinclude(m4/protocol_binary.m4) +sinclude(m4/memcached.m4) +sinclude(m4/setsockopt.m4) +sinclude(m4/hsieh.m4) +sinclude(m4/util.m4) dnl This is likely subverted by vpath builds. How do we find the original dnl source dir in the configure step of a vpath build? diff --git a/m4/64bit.m4 b/m4/64bit.m4 new file mode 100644 index 00000000..a704c655 --- /dev/null +++ b/m4/64bit.m4 @@ -0,0 +1,31 @@ +dnl --------------------------------------------------------------------------- +dnl Macro: 64BIT +dnl --------------------------------------------------------------------------- +AC_ARG_ENABLE(64bit, + [ --enable-64bit Build 64bit library.], + [ + org_cflags=$CFLAGS + CFLAGS=-m64 + AC_LANG(C) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([], [ if (sizeof(void*) != 8) return 1;]) + ],[ + CFLAGS="$CFLAGS $org_cflags" + ],[ + AC_MSG_ERROR([Don't know how to build a 64-bit object.]) + ]) + org_cxxflags=$CXXFLAGS + CXXFLAGS=-m64 + AC_LANG(C++) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([], [ if (sizeof(void*) != 8) return 1;]) + ],[ + CXXFLAGS="$CXXFLAGS $org_cxxflags" + ],[ + AC_MSG_ERROR([Don't know how to build a 64-bit object.]) + ]) + + ]) +dnl --------------------------------------------------------------------------- +dnl End Macro: 64BIT +dnl --------------------------------------------------------------------------- diff --git a/m4/byteorder.m4 b/m4/byteorder.m4 new file mode 100644 index 00000000..b6bd84a8 --- /dev/null +++ b/m4/byteorder.m4 @@ -0,0 +1,41 @@ +AC_DEFUN([DETECT_BYTEORDER], +[ + AC_MSG_CHECKING([for htonll]) + have_htoll="no" + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([ +#include +#include +#include + ], [ + return htonll(0); + ]) + ], [ + have_htoll="yes" + AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll]) + ]) + + AC_MSG_RESULT([$have_htoll]) + AM_CONDITIONAL([BUILD_BYTEORDER],[test "x$have_htoll" == "xno"]) + AC_MSG_CHECKING([byteorder]) + have_htoll="no" + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([ +#include +#include +#include + ], [ +if (htonl(5) != 5) { + return 1; +} + ]) + ], [ + AC_MSG_RESULT([big endian]) + AC_DEFINE([BYTEORDER_BIG_ENDIAN], [1], [Enable big endian byteorder]) + ], [ + AC_MSG_RESULT([little endian]) + AC_DEFINE([BYTEORDER_LITTLE_ENDIAN], [1], [Enable little endian byteorder]) + ]) +]) + +DETECT_BYTEORDER diff --git a/m4/debug.m4 b/m4/debug.m4 new file mode 100644 index 00000000..9b177810 --- /dev/null +++ b/m4/debug.m4 @@ -0,0 +1,20 @@ +dnl --------------------------------------------------------------------------- +dnl Macro: DEBUG_TEST +dnl --------------------------------------------------------------------------- +AC_ARG_ENABLE(debug, + [ --enable-debug Build with support for the DEBUG.], + [ + AC_DEFINE([HAVE_DEBUG], [1], [Enables DEBUG Support]) + AC_CHECK_PROGS(DEBUG, debug) + ENABLE_DEBUG="yes" + AC_SUBST(DEBUGFLAGS) + AC_SUBST(HAVE_DEBUG) + ], + [ + ENABLE_DEBUG="no" + ] + ) +AM_CONDITIONAL([HAVE_DEBUG], [ test "$ENABLE_DEBUG" = "yes" ]) +dnl --------------------------------------------------------------------------- +dnl End Macro: DEBUG_TEST +dnl --------------------------------------------------------------------------- diff --git a/m4/dtrace.m4 b/m4/dtrace.m4 new file mode 100644 index 00000000..ee39c69a --- /dev/null +++ b/m4/dtrace.m4 @@ -0,0 +1,37 @@ +dnl --------------------------------------------------------------------------- +dnl Macro: DTRACE_TEST +dnl --------------------------------------------------------------------------- +AC_ARG_ENABLE(dtrace, + [ --enable-dtrace Build with support for the DTRACE.], + [ + AC_PATH_PROG([DTRACE], [dtrace], "no", [/usr/sbin:$PATH]) + if test "x$DTRACE" != "xno"; then + AC_DEFINE([HAVE_DTRACE], [1], [Enables DTRACE Support]) + DTRACE_HEADER=dtrace_probes.h + + # DTrace on MacOSX does not use -G option + $DTRACE -G -o conftest.$$ -s libmemcached/libmemcached_probes.d 2>/dev/zero + if test $? -eq 0 + then + DTRACE_OBJ=libmemcached_probes.lo + rm conftest.$$ + fi + + ENABLE_DTRACE="yes" + AC_SUBST(HAVE_DTRACE) + else + AC_MSG_ERROR([Need dtrace binary and OS support.]) + fi + ], + [ + ENABLE_DTRACE="no" + ] + ) + +AC_SUBST(DTRACEFLAGS) +AC_SUBST(DTRACE_HEADER) +AC_SUBST(DTRACE_OBJ) +AM_CONDITIONAL([HAVE_DTRACE], [ test "$ENABLE_DTRACE" = "yes" ]) +dnl --------------------------------------------------------------------------- +dnl End Macro: DTRACE_TEST +dnl --------------------------------------------------------------------------- diff --git a/m4/extensions.m4 b/m4/extensions.m4 new file mode 100644 index 00000000..611fcfdb --- /dev/null +++ b/m4/extensions.m4 @@ -0,0 +1,94 @@ +# serial 6 -*- Autoconf -*- +# Enable extensions on systems that normally disable them. + +# Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS +# Autoconf. Perhaps we can remove this once we can assume Autoconf +# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly +# enough in this area it's likely we'll need to redefine +# AC_USE_SYSTEM_EXTENSIONS for quite some time. + +# AC_USE_SYSTEM_EXTENSIONS +# ------------------------ +# Enable extensions on systems that normally disable them, +# typically due to standards-conformance issues. +# Remember that #undef in AH_VERBATIM gets replaced with #define by +# AC_DEFINE. The goal here is to define all known feature-enabling +# macros, then, if reports of conflicts are made, disable macros that +# cause problems on some platforms (such as __EXTENSIONS__). +AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], +[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl + + AC_REQUIRE([AC_CANONICAL_HOST]) + + AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) + if test "$MINIX" = yes; then + AC_DEFINE([_POSIX_SOURCE], [1], + [Define to 1 if you need to in order for `stat' and other + things to work.]) + AC_DEFINE([_POSIX_1_SOURCE], [2], + [Define to 2 if the system does not provide POSIX.1 features + except with this defined.]) + AC_DEFINE([_MINIX], [1], + [Define to 1 if on MINIX.]) + fi + + dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, + dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already + dnl provided. + case "$host_os" in + hpux*) + AC_DEFINE([_XOPEN_SOURCE], [500], + [Define to 500 only on HP-UX.]) + ;; + esac + + AH_VERBATIM([__EXTENSIONS__], +[/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +]) + AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], + [ac_cv_safe_to_define___extensions__], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +# define __EXTENSIONS__ 1 + ]AC_INCLUDES_DEFAULT])], + [ac_cv_safe_to_define___extensions__=yes], + [ac_cv_safe_to_define___extensions__=no])]) + test $ac_cv_safe_to_define___extensions__ = yes && + AC_DEFINE([__EXTENSIONS__]) + AC_DEFINE([_ALL_SOURCE]) + AC_DEFINE([_GNU_SOURCE]) + AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) + AC_DEFINE([_TANDEM_SOURCE]) +])# AC_USE_SYSTEM_EXTENSIONS + +# gl_USE_SYSTEM_EXTENSIONS +# ------------------------ +# Enable extensions on systems that normally disable them, +# typically due to standards-conformance issues. +AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], + [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])]) diff --git a/m4/hsieh.m4 b/m4/hsieh.m4 new file mode 100644 index 00000000..f958f469 --- /dev/null +++ b/m4/hsieh.m4 @@ -0,0 +1,22 @@ +dnl --------------------------------------------------------------------------- +dnl Macro: HSIEH_HASH +dnl --------------------------------------------------------------------------- +AC_ARG_ENABLE(hsieh_hash, + [ --enable-hsieh_hash build with support for hsieh hashing.], + [ + if test "x$enableval" != "xno"; then + ENABLE_HSIEH="true" + AC_DEFINE([HAVE_HSIEH_HASH], [1], [Enables hsieh hashing support]) + else + ENABLE_HSIEH="false" + fi + ], + [ + ENABLE_HSIEH="false" + ] +) + +AM_CONDITIONAL([INCLUDE_HSIEH_SRC], [test "x$ENABLE_HSIEH" = "xtrue"]) +dnl --------------------------------------------------------------------------- +dnl End Macro: HSIEH_HASH +dnl --------------------------------------------------------------------------- diff --git a/m4/memcached.m4 b/m4/memcached.m4 new file mode 100644 index 00000000..c0e457e7 --- /dev/null +++ b/m4/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/m4/pod2man.m4 b/m4/pod2man.m4 new file mode 100644 index 00000000..ef9f394b --- /dev/null +++ b/m4/pod2man.m4 @@ -0,0 +1,5 @@ +AC_PATH_PROG([POD2MAN], [pod2man], "no", [$PATH:/usr/bin:/usr/local/bin]) +if test "x$POD2MAN" == "xno"; then + AC_MSG_ERROR(["Could not find pod2man anywhere in path"]) +fi +AC_SUBST(POD2MAN) diff --git a/m4/protocol_binary.m4 b/m4/protocol_binary.m4 new file mode 100644 index 00000000..8b8f3f98 --- /dev/null +++ b/m4/protocol_binary.m4 @@ -0,0 +1,20 @@ +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" + ], [ + 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" + +dnl --------------------------------------------------------------------------- +dnl End Macro: PROTOCOL_BINARY_TEST +dnl --------------------------------------------------------------------------- diff --git a/m4/setsockopt.m4 b/m4/setsockopt.m4 new file mode 100644 index 00000000..4ca7214c --- /dev/null +++ b/m4/setsockopt.m4 @@ -0,0 +1,55 @@ +dnl --------------------------------------------------------------------------- +dnl Macro: SETSOCKOPT_TEST +dnl --------------------------------------------------------------------------- +AC_LANG(C) +AC_RUN_IFELSE([ + AC_LANG_PROGRAM([ +#include +#include +#include +#include +#include + ], [ + int sock = socket(AF_INET, SOCK_STREAM, 0); + struct timeval waittime; + + waittime.tv_sec= 0; + waittime.tv_usec= 500; + + if (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, + &waittime, (socklen_t)sizeof(struct timeval)) == -1) { + if (errno == ENOPROTOOPT) { + return 1; + } + } + return 0; + ]) + ], AC_DEFINE(HAVE_SNDTIMEO, 1, [Define to 1 if you have a working SO_SNDTIMEO])) + +AC_RUN_IFELSE([ + AC_LANG_PROGRAM([ +#include +#include +#include +#include +#include + ], [ + int sock = socket(AF_INET, SOCK_STREAM, 0); + struct timeval waittime; + + waittime.tv_sec= 0; + waittime.tv_usec= 500; + + if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, + &waittime, (socklen_t)sizeof(struct timeval)) == -1) { + if (errno == ENOPROTOOPT) { + return 1; + } + } + return 0; + ]) + ], AC_DEFINE(HAVE_RCVTIMEO, 1, [Define to 1 if you have a working SO_RCVTIMEO])) + +dnl --------------------------------------------------------------------------- +dnl End Macro: SETSOCKOPT_TEST +dnl --------------------------------------------------------------------------- diff --git a/m4/util.m4 b/m4/util.m4 new file mode 100644 index 00000000..e1fc17b4 --- /dev/null +++ b/m4/util.m4 @@ -0,0 +1,20 @@ +BUILD_UTILLIB=yes + +AC_ARG_ENABLE(utils, + [ --enable-utils Build libmemcachedutils [[default=yes]]], + [ + if test "x$enableval" = "xno"; then + BUILD_UTILLIB="no" + fi + ] + ) + +if test "x$BUILD_UTILLIB" = "xyes"; then + AC_SEARCH_LIBS(pthread_create, pthread) + if test "x$ac_cv_search_pthread_create" = "xno"; then + AC_MSG_ERROR([Sorry you need POSIX thread library to build libmemcachedutil.]) + fi + AC_DEFINE([HAVE_LIBMEMCACHEDUTIL], [1], [Enables libmemcachedutil Support]) +fi + +AM_CONDITIONAL([BUILD_LIBMEMCACHEDUTIL],[test "x$BUILD_UTILLIB" = "xyes"])