From: Brian Aker Date: Thu, 4 Aug 2011 01:24:04 +0000 (-0700) Subject: Update build bits. X-Git-Tag: 0.52~32 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=7dcb622a0e97c227db598b8b50767bf9e0eaa6bd;p=awesomized%2Flibmemcached Update build bits. --- diff --git a/.bzrignore b/.bzrignore index 8e38d30d..27188105 100644 --- a/.bzrignore +++ b/.bzrignore @@ -46,6 +46,7 @@ clients/memslap clients/memstat config.h config.h.in +config.in config.log config.status config/compile diff --git a/clients/memcapable.cc b/clients/memcapable.cc index 99ca5ea7..9dff427e 100644 --- a/clients/memcapable.cc +++ b/clients/memcapable.cc @@ -12,25 +12,32 @@ /* -*- Mode: C; tab-width: 2; c-basic-offset: 2; indent-tabs-mode: nil -*- */ #undef NDEBUG -#include "config.h" -#include -#include +#include + +#ifdef HAVE_POLL_H +#include +#else +#include "poll/poll.h" +#endif + +#include +#include +#include #include +#include +#include #include +#include #include #include -#include -#include #include -#include -#include +#include #include -#include #include #include #include -#include "utilities.h" +#include #ifdef linux /* /usr/include/netinet/in.h defines macros from ntohs() to _bswap_nn to diff --git a/clients/memparse.cc b/clients/memparse.cc index 4576b7a0..f9a2dcf2 100644 --- a/clients/memparse.cc +++ b/clients/memparse.cc @@ -37,6 +37,7 @@ #include +#include #include #include diff --git a/configure.ac b/configure.ac index 3fc5871f..0a77aae2 100644 --- a/configure.ac +++ b/configure.ac @@ -7,12 +7,25 @@ # Use and distribution licensed under the BSD license. See # the COPYING file in this directory for full text. -AC_PREREQ([2.61]) -AC_INIT([libmemcached],[0.51],[http://libmemcached.org/]) -AC_CONFIG_SRCDIR([libmemcached/memcached.cc]) +AC_INIT([libmemcached],[0.52],[http://libmemcached.org/]) + AC_CONFIG_AUX_DIR(config) + +AC_CANONICAL_TARGET + +AM_INIT_AUTOMAKE + +AC_CANONICAL_HOST +AC_CANONICAL_BUILD + +AC_PREREQ([2.61]) + AC_CONFIG_MACRO_DIR(m4) +AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS. + +AC_CONFIG_SRCDIR([libmemcached/memcached.cc]) + PANDORA_CANONICAL_TARGET(no-vc-changelog) AC_CHECK_PROGS([YACC], ['bison'], [:]) AC_CHECK_PROGS([LEX], ['flex'], [:]) @@ -44,66 +57,6 @@ AC_SUBST(HAVE_LIBMEMCACHED, 1) AM_CONDITIONAL(HAVE_LIBMEMCACHED, true) LT_INIT -AH_TOP([ -#ifndef CONFIG_H -#define CONFIG_H - -#ifdef _SYS_FEATURE_TESTS_H -#error "You should include config.h as your first include file" -#endif - -#ifdef WIN32 -#define _WIN32_WINNT 0x0501 -#endif -]) - -AH_BOTTOM([ -#ifdef HAVE_SYS_WAIT_H -#include -#endif - -#ifdef HAVE_FNMATCH_H -#include -#endif - -#ifdef HAVE_POLL_H -#include -#else -#include "poll/poll.h" -#endif - -/* To hide the platform differences between MS Windows and Unix, I am - * going to use the Microsoft way and #define the Microsoft-specific - * functions to the unix way. Microsoft use a separate subsystem for sockets, - * but Unix normally just use a filedescriptor on the same functions. It is - * a lot easier to map back to the unix way with macros than going the other - * way without side effect ;-) - */ -#ifdef WIN32 -#include "win32/wrappers.h" -#define get_socket_errno() WSAGetLastError() -#else -#define INVALID_SOCKET -1 -#define SOCKET_ERROR -1 -#define closesocket(a) close(a) -#define get_socket_errno() errno -#endif - -#ifndef HAVE_MSG_NOSIGNAL -#define MSG_NOSIGNAL 0 -#endif - -#ifndef HAVE_MSG_DONTWAIT -#define MSG_DONTWAIT 0 -#endif - -#ifndef HAVE_MSG_MORE -#define MSG_MORE 0 -#endif - -#endif -]) - AC_SEARCH_LIBS(getopt_long, gnugetopt) AC_SEARCH_LIBS(gethostbyname, nsl) @@ -116,6 +69,7 @@ PANDORA_REQUIRE_PTHREAD LIBS="$my_saved_libs" dnl Specialty checks +CONFIG_EXTRA DETECT_BYTEORDER ENABLE_UTILLIB SETSOCKOPT_SANITY diff --git a/libhashkit/fnv.cc b/libhashkit/fnv.cc index fffb94a4..7a22cee0 100644 --- a/libhashkit/fnv.cc +++ b/libhashkit/fnv.cc @@ -9,8 +9,8 @@ #include /* FNV hash'es lifted from Dustin Sallings work */ -static uint64_t FNV_64_INIT= UINT64_C(0xcbf29ce484222325); -static uint64_t FNV_64_PRIME= UINT64_C(0x100000001b3); +static uint64_t FNV_64_INIT= uint64_t(0xcbf29ce484222325); +static uint64_t FNV_64_PRIME= uint64_t(0x100000001b3); static uint32_t FNV_32_INIT= 2166136261UL; static uint32_t FNV_32_PRIME= 16777619; diff --git a/libmemcached/common.h b/libmemcached/common.h index 469ef3e2..62a2b1c6 100644 --- a/libmemcached/common.h +++ b/libmemcached/common.h @@ -70,6 +70,13 @@ #include +#ifdef HAVE_POLL_H +#include +#else +#include "poll/poll.h" +#endif + + #ifdef __cplusplus extern "C" { #endif diff --git a/m4/bottom.m4 b/m4/bottom.m4 new file mode 100644 index 00000000..55591be4 --- /dev/null +++ b/m4/bottom.m4 @@ -0,0 +1,55 @@ +AC_DEFUN([CONFIG_EXTRA], [ + +AH_BOTTOM([ + +#if defined(__cplusplus) +#include CSTDINT_H +#include CINTTYPES_H +#else +#include +#include +#endif + +#if !defined(HAVE_ULONG) && !defined(__USE_MISC) +# define HAVE_ULONG 1 +typedef unsigned long int ulong; +#endif + +]) + +AH_BOTTOM([ +#ifdef WIN32 +#define _WIN32_WINNT 0x0501 +#endif + +/* To hide the platform differences between MS Windows and Unix, I am + * going to use the Microsoft way and #define the Microsoft-specific + * functions to the unix way. Microsoft use a separate subsystem for sockets, + * but Unix normally just use a filedescriptor on the same functions. It is + * a lot easier to map back to the unix way with macros than going the other + * way without side effect ;-) + */ +#ifdef WIN32 +#include "win32/wrappers.h" +#define get_socket_errno() WSAGetLastError() +#else +#define INVALID_SOCKET -1 +#define SOCKET_ERROR -1 +#define closesocket(a) close(a) +#define get_socket_errno() errno +#endif + +#ifndef HAVE_MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif + +#ifndef HAVE_MSG_DONTWAIT +#define MSG_DONTWAIT 0 +#endif + +#ifndef HAVE_MSG_MORE +#define MSG_MORE 0 +#endif + +]) +])dnl CONFIG_EXTRA diff --git a/m4/pandora_canonical.m4 b/m4/pandora_canonical.m4 index ceb859af..2af1f190 100644 --- a/m4/pandora_canonical.m4 +++ b/m4/pandora_canonical.m4 @@ -69,14 +69,6 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[ ]) ]) - AC_CONFIG_MACRO_DIR([m4]) - - m4_if(m4_substr(m4_esyscmd(test -d src && echo 0),0,1),0,[ - AC_CONFIG_HEADERS([src/config.h]) - ],[ - AC_CONFIG_HEADERS([config.h]) - ]) - PANDORA_BLOCK_BAD_OPTIONS # We need to prevent canonical target @@ -87,8 +79,6 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[ AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"], [CXXFLAGS=""]) - AC_CANONICAL_TARGET - m4_if(PCT_DONT_SUPRESS_INCLUDE,yes,[ AM_INIT_AUTOMAKE(-Wall -Werror -Wno-portability subdir-objects foreign tar-ustar) ],[ @@ -320,93 +310,6 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[ PANDORA_USE_PIPE - AH_TOP([ -#ifndef __CONFIG_H__ -#define __CONFIG_H__ - -/* _SYS_FEATURE_TESTS_H is Solaris, _FEATURES_H is GCC */ -#if defined( _SYS_FEATURE_TESTS_H) || defined(_FEATURES_H) -#error "You should include config.h as your first include file" -#endif - -#include -]) - mkdir -p config - cat > config/top.h.stamp </dev/null 2>&1 || mv config/top.h.stamp config/top.h - rm -f config/top.h.stamp - - AH_BOTTOM([ -#if defined(__cplusplus) -# include CSTDINT_H -# include CINTTYPES_H -#else -# include -# include -#endif - -#if !defined(HAVE_ULONG) && !defined(__USE_MISC) -# define HAVE_ULONG 1 -typedef unsigned long int ulong; -#endif - -/* To hide the platform differences between MS Windows and Unix, I am - * going to use the Microsoft way and #define the Microsoft-specific - * functions to the unix way. Microsoft use a separate subsystem for sockets, - * but Unix normally just use a filedescriptor on the same functions. It is - * a lot easier to map back to the unix way with macros than going the other - * way without side effect ;-) - */ -#ifdef TARGET_OS_WINDOWS -#define random() rand() -#define srandom(a) srand(a) -#define get_socket_errno() WSAGetLastError() -#else -#define INVALID_SOCKET -1 -#define SOCKET_ERROR -1 -#define closesocket(a) close(a) -#define get_socket_errno() errno -#endif - -#if defined(__cplusplus) -# if defined(DEBUG) -# include -# include -# endif -template -inline To implicit_cast(From const &f) { - return f; -} -template // use like this: down_cast(foo); -inline To down_cast(From* f) { // so we only accept pointers - // Ensures that To is a sub-type of From *. This test is here only - // for compile-time type checking, and has no overhead in an - // optimized build at run-time, as it will be optimized away - // completely. - if (false) { - implicit_cast(0); - } - -#if defined(DEBUG) - assert(f == NULL || dynamic_cast(f) != NULL); // RTTI: debug mode only! -#endif - return static_cast(f); -} -#endif /* defined(__cplusplus) */ - -#endif /* __CONFIG_H__ */ - ]) - AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}" AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}" diff --git a/m4/pandora_print_callstack.m4 b/m4/pandora_print_callstack.m4 deleted file mode 100644 index 93faa83d..00000000 --- a/m4/pandora_print_callstack.m4 +++ /dev/null @@ -1,61 +0,0 @@ -dnl Copyright (C) 2009 Sun Microsystems, Inc. -dnl This file is free software; Sun Microsystems, Inc. -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl Try to define a macro to dump the current callstack. -AC_DEFUN([PANDORA_PRINT_CALLSTACK],[ - AC_CHECK_HEADERS([ucontext.h]) - AS_IF([test "x$ac_cv_header_ucontext_h" = "xyes"], - [ AC_CHECK_FUNCS([printstack]) ]) - - - AS_IF([ test "x$ac_cv_func_printstack" != "xyes"], - [ AC_CHECK_HEADERS([dlfcn.h]) - AC_CHECK_HEADERS([execinfo.h]) - AC_CHECK_FUNCS([backtrace]) - AC_CHECK_FUNCS([backtrace_symbols_fd]) ]) - - AH_BOTTOM([ -#ifdef __cplusplus -#include -#define PANDORA_PRINTSTACK_STD_PREFIX std:: -#else -#include -#define PANDORA_PRINTSTACK_STD_PREFIX -#endif - -#if defined(HAVE_UCONTEXT_H) && defined(HAVE_PRINTSTACK) -#include -#define pandora_print_callstack(a) \ -printstack(PANDORA_PRINTSTACK_STD_PREFIX fileno(a)) -#elif defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS_FD) - -#include - -#define pandora_print_callstack(a) \ -{ \ - void *stack[100]; \ - int depth = backtrace(stack, 100); \ - backtrace_symbols_fd(stack, depth, PANDORA_PRINTSTACK_STD_PREFIX fileno(a)); \ -} -#elif defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS) && !defined(HAVE_BACKTRACE_SYMBOLS_FD) - -#include - -#define pandora_print_callstack(a) \ -{ \ - void *stack[100]; \ - int depth= backtrace(stack, 100); \ - char **symbol= backtrace_symbols(stack, depth); \ - for (int x= 0; x < size; ++x) \ - PANDORA_PRINTSTACK_STD_PREFIX fprintf(a, "%s\n", symbol[x]); \ -} -#else -#define pandora_print_callstack(a) \ - PANDORA_PRINTSTACK_STD_PREFIX fprintf(a, \ - "Stackdump not supported for this platform\n"); -#endif - ]) - -]) diff --git a/tests/c_test.c b/tests/c_test.c index 066eb6c1..e8960f4c 100644 --- a/tests/c_test.c +++ b/tests/c_test.c @@ -48,6 +48,9 @@ int main(void) (void)memcached_failed(MEMCACHED_SUCCESS); (void)memcached_continue(MEMCACHED_SUCCESS); + memcached_st *memc= memcached_create(NULL); + memcached_free(memc); + return EXIT_SUCCESS; } diff --git a/tests/include.am b/tests/include.am index 98e06b27..18dbdb6b 100644 --- a/tests/include.am +++ b/tests/include.am @@ -146,7 +146,8 @@ noinst_PROGRAMS+= tests/memslap # Test linking with C application tests_c_test_SOURCES= tests/c_test.c -tests_c_test_LDADD= ${CLIENT_LDADD} +tests_c_test_LDADD= libmemcached/libmemcached.la +tests_c_test_DEPENDENCIES= libmemcached/libmemcached.la check_PROGRAMS+=tests/c_test noinst_PROGRAMS+=tests/c_test