From: Brian Aker Date: Mon, 4 Feb 2013 07:38:04 +0000 (-0500) Subject: Adding missing windows file. X-Git-Tag: 1.0.17~6^2~10^2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=d45f11704fb49ecf50bed77d681cccf171d1befd;p=awesomized%2Flibmemcached Adding missing windows file. --- diff --git a/bootstrap.sh b/bootstrap.sh index 194dd695..42c2157b 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -407,7 +407,7 @@ function restore_BUILD () fi if [[ -n "$OLD_PREFIX" ]]; then - CONFIGURE_ARG=$OLD_PREFIX + PREFIX_ARG=$OLD_PREFIX fi if [[ -n "$OLD_MAKE" ]]; then @@ -427,53 +427,6 @@ function restore_BUILD () export -n CC CXX } -function push_PREFIX_ARG () -{ - if [[ -n "$OLD_PREFIX_ARG" ]]; then - die "OLD_PREFIX_ARG was set on push, programmer error!" - fi - - if [[ -n "$PREFIX_ARG" ]]; then - OLD_PREFIX_ARG=$PREFIX_ARG - PREFIX_ARG= - fi - - if [[ -n "$1" ]]; then - PREFIX_ARG="--prefix=$1" - fi -} - -function pop_PREFIX_ARG () -{ - if [[ -n "$OLD_PREFIX_ARG" ]]; then - PREFIX_ARG=$OLD_PREFIX_ARG - OLD_PREFIX_ARG= - else - PREFIX_ARG= - fi -} - -function push_TESTS_ENVIRONMENT () -{ - if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then - die "OLD_TESTS_ENVIRONMENT was set on push, programmer error!" - fi - - if [[ -n "$TESTS_ENVIRONMENT" ]]; then - OLD_TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT - TESTS_ENVIRONMENT= - fi -} - -function pop_TESTS_ENVIRONMENT () -{ - TESTS_ENVIRONMENT= - if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then - TESTS_ENVIRONMENT=$OLD_TESTS_ENVIRONMENT - OLD_TESTS_ENVIRONMENT= - fi -} - function safe_pushd () { pushd $1 &> /dev/null ; @@ -522,11 +475,11 @@ function make_valgrind () return 1 fi + save_BUILD + # If we are required to run configure, do so now run_configure_if_required - push_TESTS_ENVIRONMENT - # If we don't have a configure, then most likely we will be missing libtool assert_file 'configure' if [[ -f 'libtool' ]]; then @@ -537,13 +490,15 @@ function make_valgrind () make_target 'check' || return 1 - pop_TESTS_ENVIRONMENT + restore_BUILD } function make_install_system () { local INSTALL_LOCATION=$(mktemp -d /tmp/XXXXXXXXXX) - push_PREFIX_ARG $INSTALL_LOCATION + + save_BUILD + PREFIX_ARG="--prefix=$INSTALL_LOCATION" if [ ! -d $INSTALL_LOCATION ] ; then die "ASSERT temp directory not found '$INSTALL_LOCATION'" @@ -551,17 +506,12 @@ function make_install_system () run_configure #install_buid_dir - push_TESTS_ENVIRONMENT - make_target 'install' make_target 'installcheck' make_target 'uninstall' - pop_TESTS_ENVIRONMENT - pop_PREFIX_ARG - rm -r -f $INSTALL_LOCATION make 'distclean' @@ -569,6 +519,7 @@ function make_install_system () die "ASSERT Makefile should not exist" fi + restore_BUILD safe_popd } @@ -909,11 +860,11 @@ function make_install_html () function make_gdb () { + save_BUILD + if command_exists 'gdb'; then run_configure_if_required - push_TESTS_ENVIRONMENT - # Set ENV GDB_COMMAND if [[ -z "$GDB_COMMAND" ]]; then setup_gdb_command @@ -933,8 +884,6 @@ function make_gdb () rm 'gdb.txt' fi - pop_TESTS_ENVIRONMENT - if [ -f '.gdb_history' ]; then rm '.gdb_history' fi @@ -946,6 +895,8 @@ function make_gdb () echo 'gdb was not present' return 1 fi + + restore_BUILD } # $1 target to compile @@ -1477,7 +1428,7 @@ function bootstrap () # Set ENV PREFIX in order to set --prefix for ./configure if [[ -n "$PREFIX" ]]; then - push_PREFIX_ARG $PREFIX + PREFIX_ARG="--prefix=$PREFIX" fi # We should always have a target by this point @@ -1738,11 +1689,13 @@ export AUTOHEADER export AUTOM4TE export AUTOMAKE export AUTORECONF +export CONFIGURE_ARG export DEBUG export GNU_BUILD_FLAGS export LIBTOOLIZE export LIBTOOLIZE_OPTIONS export MAKE +export PREFIX_ARG export TESTS_ENVIRONMENT export VERBOSE export WARNINGS diff --git a/configure.ac b/configure.ac index 9923d888..8808ad26 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ # LibmemcacheD -# Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ +# Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/ # Copyright (C) 2006-2010 Brian Aker, Monty Taylor, Trond Norbye # All rights reserved. # @@ -287,10 +287,12 @@ AC_DEFUN([CHECK_FOR_PTHREAD_AND_SASL], ]) CHECK_FOR_PTHREAD_AND_SASL - # backtrace(), others require shared builds -AS_IF([test "x$enable_shared" = "xyes"], - [AC_DEFINE([HAVE_SHARED_ENABLED],[1],[Enable code which requires shared library support. Like backtrace().])]) +AC_DEFUN([__ENABLE_SHARED], + [AC_REQUIRE([AX_PLATFORM]) + AS_IF([test "x${TARGET_WINDOWS}" = "xtrue"],[enable_shared=no]) + AS_IF([test "x$enable_shared" = "xyes"], + [AC_DEFINE([HAVE_SHARED_ENABLED],[1],[Enable code which requires shared library support. Like backtrace().])])]) AM_CONDITIONAL([SHARED_ENABLED],[test "x$enable_shared" = "xyes"]) PANDORA_ENABLE_DTRACE diff --git a/libmemcached/include.am b/libmemcached/include.am index 9eb1942c..0aabc248 100644 --- a/libmemcached/include.am +++ b/libmemcached/include.am @@ -50,6 +50,7 @@ noinst_HEADERS+= libmemcached/udp.hpp noinst_HEADERS+= libmemcached/version.hpp noinst_HEADERS+= libmemcached/virtual_bucket.h noinst_HEADERS+= libmemcached/watchpoint.h +noinst_HEADERS+= libmemcached/windows.hpp lib_LTLIBRARIES+= libmemcached/libmemcached.la EXTRA_libmemcached_libmemcached_la_DEPENDENCIES= diff --git a/libmemcached/windows.hpp b/libmemcached/windows.hpp new file mode 100644 index 00000000..40564b1d --- /dev/null +++ b/libmemcached/windows.hpp @@ -0,0 +1,125 @@ +/* + * Libmemcached library + * + * Copyright (C) 2012 Data Differential, http://datadifferential.com/ + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +#ifdef __cplusplus +# include +#else +# include +#endif + +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif + +#ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +#endif + +#ifdef __MINGW32__ +# if(_WIN32_WINNT >= 0x0501) +# else +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0501 +# endif /* _WIN32_WINNT >= 0x0501 */ +#endif /* __MINGW32__ */ + +#if defined(HAVE_WINSOCK2_H) && HAVE_WINSOCK2_H +# include +#endif + +#if defined(HAVE_WS2TCPIP_H) && HAVE_WS2TCPIP_H +# include +#endif + +#if defined(HAVE_IO_H) && HAVE_IO_H +# include +#endif + +struct sockaddr_un +{ + short int sun_family; + char sun_path[108]; +}; + +static inline int translate_windows_error() +{ + int local_errno= WSAGetLastError(); + + switch(local_errno) { + case WSAEINVAL: + local_errno= EINPROGRESS; + break; + case WSAEALREADY: + case WSAEWOULDBLOCK: + local_errno= EAGAIN; + break; + + case WSAECONNREFUSED: + local_errno= ECONNREFUSED; + break; + + case WSAENETUNREACH: + local_errno= ENETUNREACH; + break; + + case WSAETIMEDOUT: + local_errno= ETIMEDOUT; + break; + + case WSAECONNRESET: + local_errno= ECONNRESET; + break; + + case WSAEADDRINUSE: + local_errno= EADDRINUSE; + break; + + case WSAEOPNOTSUPP: + local_errno= EOPNOTSUPP; + break; + + case WSAENOPROTOOPT: + local_errno= ENOPROTOOPT; + break; + + default: + break; + } + + return local_errno; +}