From 73f75355c4222acb777f1cba18a4bdddf528eaa4 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Thu, 18 Jul 2013 06:28:37 -0400 Subject: [PATCH] Update ddm4 and fix OS symbols. --- libmemcached/io.cc | 8 +- libtest/cmdline.cc | 2 +- libtest/core.cc | 4 +- libtest/cpu.cc | 2 +- libtest/main.cc | 2 +- libtest/unittest.cc | 12 +-- m4/ax_debug.m4 | 2 + m4/ax_harden_compiler_flags.m4 | 154 +++++++++++++++++---------------- m4/ax_memcached.m4 | 31 +++---- m4/ax_platform.m4 | 30 +++---- m4/ax_prog_sphinx_build.m4 | 44 +++++----- m4/hiredis.m4 | 48 +++++----- 12 files changed, 163 insertions(+), 176 deletions(-) diff --git a/libmemcached/io.cc b/libmemcached/io.cc index cb8ed5c2..448cc325 100644 --- a/libmemcached/io.cc +++ b/libmemcached/io.cc @@ -99,7 +99,7 @@ static bool repack_input_buffer(memcached_instance_st* instance) case EWOULDBLOCK: #endif case EAGAIN: -#ifdef TARGET_OS_LINUX +#ifdef __linux case ERESTART: #endif break; // No IO is fine, we can just move on @@ -265,7 +265,7 @@ static memcached_return_t io_wait(memcached_instance_st* instance, assert_msg(active_fd == -1 , "poll() returned an unexpected value"); switch (local_errno) { -#ifdef TARGET_OS_LINUX +#ifdef __linux case ERESTART: #endif case EINTR: @@ -430,7 +430,7 @@ static memcached_return_t _io_fill(memcached_instance_st* instance) case EWOULDBLOCK: #endif case EAGAIN: -#ifdef TARGET_OS_LINUX +#ifdef __linux case ERESTART: #endif { @@ -568,7 +568,7 @@ memcached_return_t memcached_io_slurp(memcached_instance_st* instance) case EWOULDBLOCK: #endif case EAGAIN: -#ifdef TARGET_OS_LINUX +#ifdef __linux case ERESTART: #endif if (memcached_success(io_wait(instance, MEM_READ))) diff --git a/libtest/cmdline.cc b/libtest/cmdline.cc index 94c41814..e813eb59 100644 --- a/libtest/cmdline.cc +++ b/libtest/cmdline.cc @@ -359,7 +359,7 @@ bool Application::slurp() int error; switch ((error= errno)) { -#ifdef TARGET_OS_LINUX +#ifdef __linux case ERESTART: #endif case EINTR: diff --git a/libtest/core.cc b/libtest/core.cc index 8e887471..2542f43f 100644 --- a/libtest/core.cc +++ b/libtest/core.cc @@ -42,8 +42,8 @@ namespace libtest { void create_core(void) { -#if defined(TARGET_OS_OSX) && TARGET_OS_OSX - if (TARGET_OS_OSX) +#if defined(__APPLE__) && __APPLE__ + if (__APPLE__) { return; } diff --git a/libtest/cpu.cc b/libtest/cpu.cc index 838804d7..0ee8df60 100644 --- a/libtest/cpu.cc +++ b/libtest/cpu.cc @@ -50,7 +50,7 @@ namespace libtest { size_t number_of_cpus() { size_t number_of_cpu= 1; -#if defined(TARGET_OS_LINUX) && TARGET_OS_LINUX +#if defined(__linux) && __linux number_of_cpu= sysconf(_SC_NPROCESSORS_ONLN); #elif defined(HAVE_SYS_SYSCTL_H) && defined(CTL_HW) && defined(HW_NCPU) && defined(HW_AVAILCPU) && defined(HW_NCPU) int mib[4]; diff --git a/libtest/main.cc b/libtest/main.cc index 46429241..83e95cd6 100644 --- a/libtest/main.cc +++ b/libtest/main.cc @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) Valgrind does not currently work reliably, or sometimes at all, on OSX - Fri Jun 15 11:24:07 EDT 2012 */ -#if defined(TARGET_OS_OSX) && TARGET_OS_OSX +#if defined(__APPLE__) && __APPLE__ if (valgrind_is_caller()) { return EXIT_SKIP; diff --git a/libtest/unittest.cc b/libtest/unittest.cc index bbb56c66..c2143889 100644 --- a/libtest/unittest.cc +++ b/libtest/unittest.cc @@ -618,9 +618,9 @@ static test_return_t application_doesnotexist_BINARY(void *) true_app.will_fail(); const char *args[]= { "--fubar", 0 }; -#if defined(TARGET_OS_OSX) && TARGET_OS_OSX +#if defined(__APPLE__) && __APPLE__ ASSERT_EQ(Application::INVALID_POSIX_SPAWN, true_app.run(args)); -#elif defined(TARGET_OS_FREEBSD) && TARGET_OS_FREEBSD +#elif defined(__FreeBSD__) && __FreeBSD__ ASSERT_EQ(Application::INVALID_POSIX_SPAWN, true_app.run(args)); #else ASSERT_EQ(Application::SUCCESS, true_app.run(args)); @@ -818,8 +818,8 @@ static test_return_t wait_services_appliction_TEST(void *) static test_return_t gdb_wait_services_appliction_TEST(void *) { test_skip(true, false); -#if defined(TARGET_OS_OSX) && TARGET_OS_OSX - test_skip(0, TARGET_OS_OSX); +#if defined(__APPLE__) && __APPLE__ + test_skip(0, __APPLE__); #endif test_skip(0, access("/etc/services", R_OK )); @@ -842,8 +842,8 @@ static test_return_t gdb_abort_services_appliction_TEST(void *) test_skip(0, access("libtest/abort", X_OK )); test_skip(true, false); -#if defined(TARGET_OS_OSX) && TARGET_OS_OSX - test_skip(0, TARGET_OS_OSX); +#if defined(__APPLE__) && __APPLE__ + test_skip(0, __APPLE__); #endif libtest::Application abort_app("libtest/abort", true); diff --git a/m4/ax_debug.m4 b/m4/ax_debug.m4 index 4c72f276..c4b4d4c2 100644 --- a/m4/ax_debug.m4 +++ b/m4/ax_debug.m4 @@ -53,6 +53,8 @@ AC_DEFUN([AX_DEBUG], [ax_enable_debug=yes AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.]) AX_CHECK_LIBRARY([MCHECK],[mcheck.h],[mcheck],[AX_APPEND_LINK_FLAGS([-lmcheck])])], + AX_ADD_AM_MACRO([AM_YFLAGS+= --debug dnl Setting bison debugging + ]) [ax_enable_debug=no AC_SUBST([MCHECK]) AC_DEFINE([DEBUG],[0],[Define to 1 to enable debugging code.])]) diff --git a/m4/ax_harden_compiler_flags.m4 b/m4/ax_harden_compiler_flags.m4 index d4fccad6..b47f9afe 100644 --- a/m4/ax_harden_compiler_flags.m4 +++ b/m4/ax_harden_compiler_flags.m4 @@ -53,7 +53,39 @@ # -Wdeclaration-after-statement is counter to C99 # _APPEND_COMPILE_FLAGS_ERROR([-pedantic]) -#serial 10 +#serial 12 + +AC_DEFUN([_SET_SANITIZE_FLAGS], + [AS_IF([test "x$MINGW" != xyes],[ + AS_IF([test "x$enable_shared" = "xyes"], + [AS_CASE([$ax_harden_sanitize], + [thread],[ + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread])], + [address],[ + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address])], + [rest],[ + _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr])]) + ]) + ]) + ]) AC_DEFUN([_WARNINGS_AS_ERRORS], [AC_CACHE_CHECK([if all warnings into errors],[ac_cv_warnings_as_errors], @@ -64,13 +96,11 @@ AC_DEFUN([_WARNINGS_AS_ERRORS], # Note: Should this be LIBS or LDFLAGS? AC_DEFUN([_APPEND_LINK_FLAGS_ERROR], - [AC_REQUIRE([AX_APPEND_LINK_FLAGS]) - AX_APPEND_LINK_FLAGS([$1],[LDFLAGS],[-Werror]) + [AX_APPEND_LINK_FLAGS([$1],[LDFLAGS],[-Werror]) ]) AC_DEFUN([_APPEND_COMPILE_FLAGS_ERROR], - [AC_REQUIRE([AX_APPEND_COMPILE_FLAGS]) - AX_APPEND_COMPILE_FLAGS([$1],,[-Werror]) + [AX_APPEND_COMPILE_FLAGS([$1],,[-Werror]) ]) # Everything above this does the heavy lifting, while what follows does the specifics. @@ -79,19 +109,37 @@ AC_DEFUN([_HARDEN_LINKER_FLAGS], [AS_IF([test "$CC" != "clang"], [_APPEND_LINK_FLAGS_ERROR([-z relro -z now]) AS_IF([test "x$ac_cv_warnings_as_errors" = xyes],[AX_APPEND_LINK_FLAGS([-Werror])]) - AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[_APPEND_LINK_FLAGS_ERROR([-rdynamic])]) + AS_IF([test "x$ac_cv_vcs_checkout" = xyes], + [_APPEND_LINK_FLAGS_ERROR([-rdynamic]) +# AX_APPEND_LINK_FLAGS([--coverage])]) ]) ]) +AC_DEFUN([_AX_HARDEN_SANITIZE], + [AC_REQUIRE([AX_DEBUG]) + AC_ARG_WITH([sanitize], + [AS_HELP_STRING([--with-sanitize], + [Enable sanitize flag for compiler if it supports them @<:@default=no@:>@])], + [AS_CASE([$with_sanitize], + [thread],[ + ax_harden_sanitize='thread'], + [address],[ + ax_harden_sanitize='with_sanitize'], + [ax_harden_sanitize='rest']) + ], + [AS_IF([test "x$ax_enable_debug" = xyes],[ax_harden_sanitize='rest'])]) + ]) + AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], [AC_LANG_PUSH([C])dnl AS_IF([test "x$ax_enable_debug" = xyes], [CFLAGS='' _APPEND_COMPILE_FLAGS_ERROR([-H]) - _APPEND_COMPILE_FLAGS_ERROR([-ggdb]) _APPEND_COMPILE_FLAGS_ERROR([-g]) - _APPEND_COMPILE_FLAGS_ERROR([-O0]), + _APPEND_COMPILE_FLAGS_ERROR([-g3]) + _APPEND_COMPILE_FLAGS_ERROR([-fmudflapth]) + _APPEND_COMPILE_FLAGS_ERROR([-fno-eliminate-unused-debug-types]) _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) ],[ _APPEND_COMPILE_FLAGS_ERROR([-g]) @@ -100,6 +148,7 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], AS_IF([test "x$ac_cv_vcs_checkout" = xyes], [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) +# _APPEND_COMPILE_FLAGS_ERROR([--coverage]) _APPEND_COMPILE_FLAGS_ERROR([-Wpragmas]) _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])], [_APPEND_COMPILE_FLAGS_ERROR([-Wno-unknown-pragmas]) @@ -155,33 +204,7 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-Wundef]) _APPEND_COMPILE_FLAGS_ERROR([-Wunsafe-loop-optimizations]) _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations]) - AS_IF([test "x$MINGW" != xyes],[ - AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ - AS_IF([test "x$enable_shared" = "xyes"],[ - _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) - ]) - ]) - ]) + _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result]) @@ -197,7 +220,10 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-Wsizeof-pointer-memaccess]) _APPEND_COMPILE_FLAGS_ERROR([-Wpacked]) # _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) - _APPEND_COMPILE_FLAGS_ERROR([-Wunreachable-code]) +# GCC 4.5 removed this. +# _APPEND_COMPILE_FLAGS_ERROR([-Wunreachable-code]) + + _SET_SANITIZE_FLAGS AS_IF([test "x$ax_enable_debug" = xno], [AS_IF([test "x$ac_cv_vcs_checkout" = xyes], @@ -217,14 +243,14 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], [AC_LANG_PUSH([C++]) - AC_REQUIRE([_APPEND_COMPILE_FLAGS_ERROR]) - AS_IF([test "x$ax_enable_debug" = xyes], [CXXFLAGS='' _APPEND_COMPILE_FLAGS_ERROR([-H]) - _APPEND_COMPILE_FLAGS_ERROR([-ggdb]) _APPEND_COMPILE_FLAGS_ERROR([-g]) - _APPEND_COMPILE_FLAGS_ERROR([-O0]), + _APPEND_COMPILE_FLAGS_ERROR([-g3]) + _APPEND_COMPILE_FLAGS_ERROR([-fmudflapth]) + _APPEND_COMPILE_FLAGS_ERROR([-fno-inline]) + _APPEND_COMPILE_FLAGS_ERROR([-fno-eliminate-unused-debug-types]) _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) ],[ _APPEND_COMPILE_FLAGS_ERROR([-g]) @@ -233,6 +259,7 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], AS_IF([test "x$ac_cv_vcs_checkout" = xyes], [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) +# _APPEND_COMPILE_FLAGS_ERROR([--coverage]) _APPEND_COMPILE_FLAGS_ERROR([-Wpragmas]) _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])], [_APPEND_COMPILE_FLAGS_ERROR([-Wno-unknown-pragmas]) @@ -282,33 +309,6 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations]) _APPEND_COMPILE_FLAGS_ERROR([-Wc++11-compat]) # _APPEND_COMPILE_FLAGS_ERROR([-Weffc++]) - AS_IF([test "x$MINGW" != xyes],[ - AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ - AS_IF([test "x$enable_shared" = "xyes"],[ - _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) - ]) - ]) - ]) # _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-cast]) _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused]) @@ -326,7 +326,8 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-Wsizeof-pointer-memaccess]) _APPEND_COMPILE_FLAGS_ERROR([-Wpacked]) # _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) - _APPEND_COMPILE_FLAGS_ERROR([-Wunreachable-code]) +# GCC 4.5 removed this. +# _APPEND_COMPILE_FLAGS_ERROR([-Wunreachable-code]) AS_IF([test "x$ax_enable_debug" = xno], [AS_IF([test "x$ac_cv_vcs_checkout" = xyes], @@ -338,6 +339,8 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all]) ])])])]) + _SET_SANITIZE_FLAGS + AS_IF([test "x$ac_cv_warnings_as_errors" = xyes], [AX_APPEND_FLAG([-Werror])]) AC_LANG_POP([C++]) @@ -347,16 +350,17 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], # _HARDEN_CC_COMPILER_FLAGS, _HARDEN_CXX_COMPILER_FLAGS AC_DEFUN([AX_HARDEN_COMPILER_FLAGS], [AC_PREREQ([2.63])dnl - AC_REQUIRE([_WARNINGS_AS_ERRORS]) - AC_REQUIRE([AX_APPEND_LINK_FLAGS]) AC_REQUIRE([AX_COMPILER_VERSION]) - AC_REQUIRE([AX_DEBUG]) - AC_REQUIRE([AX_VCS_CHECKOUT]) + AC_REQUIRE([AX_ASSERT]) + _WARNINGS_AS_ERRORS + _AX_HARDEN_SANITIZE AC_REQUIRE([gl_VISIBILITY]) AS_IF([test -n "$CFLAG_VISIBILITY"],[CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"]) - AC_REQUIRE([_HARDEN_LINKER_FLAGS]) - AC_REQUIRE([_HARDEN_CC_COMPILER_FLAGS]) - AC_REQUIRE([_HARDEN_CXX_COMPILER_FLAGS]) + _WARNINGS_AS_ERRORS + _HARDEN_LINKER_FLAGS + _HARDEN_CC_COMPILER_FLAGS + _HARDEN_CXX_COMPILER_FLAGS ]) + diff --git a/m4/ax_memcached.m4 b/m4/ax_memcached.m4 index 160cfe32..21067c68 100644 --- a/m4/ax_memcached.m4 +++ b/m4/ax_memcached.m4 @@ -44,26 +44,15 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#serial 4 +#serial 3 AC_DEFUN([AX_PROG_MEMCACHED], - [AX_WITH_PROG([MEMCACHED_BINARY],[memcached],[unknown]) - ax_memcached_success= - AS_IF([test x"$MEMCACHED_BINARY" != xunknown], - [AS_IF([test -x "$MEMCACHED_BINARY"], - [ax_memcached_version=`$MEMCACHED_BINARY -h | sed 1q | awk '{print \$ 2 }' | sed 's|[\-a-z0-9]*$||' | awk -F. '{printf "%d.%d.%d", $[]1, $[]2, $[]3}'` - AS_IF([test -n "$ax_memcached_version"], - [ax_memcached_success='ok' - AC_MSG_RESULT([memcached version "$ax_memcached_version"]) - AC_DEFINE_UNQUOTED([MEMCACHED_VERSION],"$ax_memcached_version",[Memcached binary version])]) - ]) - ]) - - AS_IF([test -n "$ax_memcached_success"], - [AC_DEFINE([HAVE_MEMCACHED_BINARY], [1], [If Memcached binary is available]) - AC_DEFINE_UNQUOTED([MEMCACHED_BINARY],"$MEMCACHED_BINARY",[Name of the memcached binary used in make test]) - ], - [AC_DEFINE([HAVE_MEMCACHED_BINARY], [0], [If Memcached binary is available]) - MEMCACHED_BINARY= - ]) - ]) + [AX_WITH_PROG([MEMCACHED_BINARY],[memcached]) + AS_IF([test -f "$ac_cv_path_MEMCACHED_BINARY"], + [AC_DEFINE([HAVE_MEMCACHED_BINARY], [1], [If Memcached binary is available]) + AC_DEFINE_UNQUOTED([MEMCACHED_BINARY],"$ac_cv_path_MEMCACHED_BINARY",[Name of the memcached binary used in make test]) + ax_memcached_version=`$MEMCACHED_BINARY -h | sed 1q | awk '{print \$ 2 }' | sed 's|[\-a-z0-9]*$||' | awk -F. '{printf "%d.%d.%d", $[]1, $[]2, $[]3}'` + AC_MSG_RESULT([memcached version "$ax_memcached_version"]) + AC_DEFINE_UNQUOTED([MEMCACHED_VERSION],"$ax_memcached_version",[Memcached binary version]) + ]) + ]) diff --git a/m4/ax_platform.m4 b/m4/ax_platform.m4 index 01ff25d9..a09c6923 100644 --- a/m4/ax_platform.m4 +++ b/m4/ax_platform.m4 @@ -12,31 +12,26 @@ # # LICENSE # -# Copyright (c) 2012 Brian Aker +# Copyright (c) 2012-2013 Brian Aker # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 3 +#serial 4 # AC_DEFUN([AX_PLATFORM], [AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_CANONICAL_TARGET]) AC_DEFINE_UNQUOTED([HOST_VENDOR],["$host_vendor"],[Vendor of Build System]) AC_DEFINE_UNQUOTED([HOST_OS],["$host_os"], [OS of Build System]) AC_DEFINE_UNQUOTED([HOST_CPU],["$host_cpu"], [CPU of Build System]) - AC_DEFINE_UNQUOTED([TARGET_VENDOR],["$target_vendor"],[Vendor of Target System]) - AC_DEFINE_UNQUOTED([TARGET_OS],["$target_os"], [OS of Target System]) - AC_DEFINE_UNQUOTED([TARGET_CPU],["$target_cpu"], [CPU of Target System]) - AS_CASE([$target_os], [*mingw*], - [TARGET_WINDOWS="true" - AC_DEFINE([TARGET_OS_WINDOWS], [1], [Whether we are building for Windows]) + [HOST_WINDOWS="true" + AC_DEFINE([HOST_OS_WINDOWS], [1], [Whether we are building for Windows]) AC_DEFINE([EAI_SYSTEM], [11], [Another magical number]) AH_BOTTOM([ #ifndef HAVE_SYS_SOCKET_H @@ -45,16 +40,17 @@ # define SHUT_RDWR SD_BOTH #endif ])], - [*freebsd*],[AC_DEFINE([TARGET_OS_FREEBSD],[1],[Whether we are building for FreeBSD]) + [*freebsd*],[AC_DEFINE([HOST_OS_FREEBSD],[1],[Whether we are building for FreeBSD]) AC_DEFINE([__APPLE_CC__],[1],[Workaround for bug in FreeBSD headers])], - [*solaris*],[AC_DEFINE([TARGET_OS_SOLARIS],[1],[Whether we are building for Solaris])], + [*solaris*],[AC_DEFINE([HOST_OS_SOLARIS],[1],[Whether we are building for Solaris])], [*darwin*], - [TARGET_OSX="true"], + [HOST_OSX="true"], [*linux*], - [TARGET_LINUX="true" - AC_DEFINE([TARGET_OS_LINUX],[1],[Whether we build for Linux])]) + [HOST_LINUX="true" + AC_DEFINE([HOST_OS_LINUX],[1],[Whether we build for Linux])]) - AM_CONDITIONAL([BUILD_WIN32],[test "x${TARGET_WINDOWS}" = "xtrue"]) - AM_CONDITIONAL([TARGET_OSX],[test "x${TARGET_OSX}" = "xtrue"]) - AM_CONDITIONAL([TARGET_LINUX],[test "x${TARGET_LINUX}" = "xtrue"]) + AM_CONDITIONAL([BUILD_WIN32],[test "x${HOST_WINDOWS}" = "xtrue"]) + AM_CONDITIONAL([HOST_OSX],[test "x${HOST_OSX}" = "xtrue"]) + AM_CONDITIONAL([HOST_LINUX],[test "x${HOST_LINUX}" = "xtrue"]) + AM_CONDITIONAL([HOST_FREEBSD],[test "x${HOST_OS_FREEBSD}" = "xtrue"]) ]) diff --git a/m4/ax_prog_sphinx_build.m4 b/m4/ax_prog_sphinx_build.m4 index 3a89a331..653c7bce 100644 --- a/m4/ax_prog_sphinx_build.m4 +++ b/m4/ax_prog_sphinx_build.m4 @@ -19,26 +19,30 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 3 +#serial 5 AC_DEFUN([AX_PROG_SPHINX_BUILD], - [AX_WITH_PROG([SPHINXBUILD],[sphinx-build],[:]) - AS_IF([test x"SPHINXBUILD" = x":"], - [SPHINXBUILD=], - [AS_IF([test -x "$SPHINXBUILD"], - [AC_MSG_CHECKING([Checking to see if $SPHINXBUILD is recent]) - junk=`$SPHINXBUILD &> version_file` - ax_sphinx_build_version=`head -1 version_file` - rm version_file - AC_MSG_RESULT([$SPHINXBUILD is version "$ax_sphinx_build_version"]) - $SPHINXBUILD -Q -C -b man -d conftest.d . . >/dev/null 2>&1 - AS_IF([test $? -eq 0], ,[SPHINXBUILD=]) - rm -rf conftest.d - ]) - ]) + [AX_WITH_PROG([SPHINXBUILD],[sphinx-build],[:]) + AS_IF([test x"SPHINXBUILD" = x":"], + [SPHINXBUILD=], + [AS_IF([test -x "$SPHINXBUILD"], + [AC_MSG_CHECKING([Checking to see if $SPHINXBUILD is recent]) + junk=`$SPHINXBUILD --version &> version_file` + AS_IF([test $? -eq 0], + [ax_sphinx_build_version=`head -1 version_file`], + [junk=`$SPHINXBUILD &> version_file` + ax_sphinx_build_version=`head -1 version_file` + rm version_file + AC_MSG_RESULT([$SPHINXBUILD is version "$ax_sphinx_build_version"]) + $SPHINXBUILD -Q -C -b man -d conftest.d . . >/dev/null 2>&1 + AS_IF([test $? -eq 0], ,[SPHINXBUILD=]) + rm -rf conftest.d ]) + ]) + rm -f version_file + ]) - AS_IF([test -n "${SPHINXBUILD}"], - [AC_SUBST([SPHINXBUILD]) - ifelse([$1], , :, [$1])], - [ifelse([$2], , :, [$2])]) - ]) + AS_IF([test -n "${SPHINXBUILD}"], + [AC_SUBST([SPHINXBUILD]) + ifelse([$1], , :, [$1])], + [ifelse([$2], , :, [$2])]) + ]) diff --git a/m4/hiredis.m4 b/m4/hiredis.m4 index 06804178..6db09278 100644 --- a/m4/hiredis.m4 +++ b/m4/hiredis.m4 @@ -1,34 +1,26 @@ -dnl Copyright (C) 2011 Brian Aker (brian@tangent.org) +# Copyright (C) 2011 Brian Aker (brian@tangent.org) +# +# serial 2 -AC_DEFUN([_SEARCH_LIBHIREDIS],[ - AC_REQUIRE([AX_CHECK_LIBRARY]) +AC_DEFUN([_SEARCH_HIREDIS], + [AC_REQUIRE([AX_CHECK_LIBRARY]) - AS_IF([test "x$ac_enable_hires" = "xyes"],[ - AX_CHECK_LIBRARY([LIBHIREDIS], [hiredis/hiredis.h], [hiredis], - [ - LIBHIREDIS_LDFLAGS="-lhiredis" - AC_DEFINE([HAVE_HIREDIS], [1], [If Hiredis available]) - ], - [ - AC_DEFINE([HAVE_HIREDIS], [0], [If Hiredis is available]) - ac_enable_hires="no" - ]) + AS_IF([test "x$ac_enable_hiredis" = "xyes"], + [hiredis_header="hiredis/hiredis.h"], + [hiredis_header="does_not_exist"]) - ], - [ - AC_DEFINE([HAVE_HIREDIS], [0], [If Hiredis is available]) - ]) + AX_CHECK_LIBRARY([HIREDIS],[$hiredis_header],[hiredis],, + [AC_DEFINE([HAVE_HIREDIS],[0],[Define to 1 if HIREDIS is found])]) - AM_CONDITIONAL(HAVE_HIREDIS, [test "x$ac_cv_lib_hiredis_main" = "xyes"]) - ]) + AS_IF([test "x$ax_cv_have_HIREDIS" = xno],[ac_enable_hiredis="no"]) + ]) -AC_DEFUN([AX_HAVE_LIBHIREDIS],[ + AC_DEFUN([AX_ENABLE_LIBHIREDIS], + [AC_ARG_ENABLE([hiredis], + [AS_HELP_STRING([--disable-hiredis], + [Build with hiredis support @<:@default=on@:>@])], + [ac_enable_hiredis="$enableval"], + [ac_enable_hiredis="yes"]) - AC_ARG_ENABLE([hires], - [AS_HELP_STRING([--disable-hires], - [Build with hires support @<:@default=on@:>@])], - [ac_enable_hires="$enableval"], - [ac_enable_hires="yes"]) - - _SEARCH_LIBHIREDIS -]) + _SEARCH_HIREDIS + ]) -- 2.30.2