From: Brian Aker Date: Tue, 9 Oct 2012 05:01:35 +0000 (-0400) Subject: Update with job builder. X-Git-Tag: 1.0.12~3 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=27bed94f9adf2d67670daf8a237be68f5bb7a076;p=m6w6%2Flibmemcached Update with job builder. --- diff --git a/.bzrignore b/.bzrignore index 866ad779..ed1adb82 100644 --- a/.bzrignore +++ b/.bzrignore @@ -155,3 +155,4 @@ tests/testudp tests/var/ tmp_chroot unittests/unittests +aminclude.am diff --git a/Makefile.am b/Makefile.am index 5b1fcd21..aaebd1c3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ # vim:ft=automake -ACLOCAL_AMFLAGS = -I m4 -I libtest/m4 +ACLOCAL_AMFLAGS = -I m4 -I libtest/m4 --install -Wall -Werror # includes append to these: SUFFIXES = @@ -21,6 +21,9 @@ EXTRA_HEADERS = BUILT_SOURCES= EXTRA_DIST= +#includes additional rules from aminclude.am +@INC_AMINCLUDE@ + EXTRA_DIST+= ${srcdir}/m4/pandora_*.m4 EXTRA_DIST+= .quickly EXTRA_DIST+= README.FIRST diff --git a/bootstrap.sh b/bootstrap.sh index 9c46ab79..b6da38cd 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -76,8 +76,8 @@ configure_target_platform () { setup_gdb_command () { GDB_TMPFILE=$(mktemp /tmp/gdb.XXXXXXXXXX) - echo "set logging on" > $GDB_TMPFILE - echo "set logging overwrite on" >> $GDB_TMPFILE + echo "set logging overwrite on" > $GDB_TMPFILE + echo "set logging on" >> $GDB_TMPFILE echo "set environment LIBTEST_IN_GDB=1" >> $GDB_TMPFILE echo "run" >> $GDB_TMPFILE echo "thread apply all bt" >> $GDB_TMPFILE @@ -246,7 +246,7 @@ make_target () { fi MAKE_TARGET=$1 - run $MAKE $MAKE_J $MAKE_TARGET || die "Cannot execute $MAKE $MAKE_TARGET" + run $MAKE $MAKE_TARGET || die "Cannot execute $MAKE $MAKE_TARGET" if [ -n "$MAKE_TARGET" ]; then MAKE_TARGET=$OLD_MAKE_TARGET @@ -265,6 +265,10 @@ make_distclean () { make_target distclean } +make_maintainer_clean () { + make_target maintainer-clean +} + make_check () { make_target check } @@ -355,18 +359,15 @@ bootstrap() { MAKE="make" fi - # Set ENV MAKE_J in order to override "-j2" - if [ -z "$MAKE_J" ]; then - MAKE_J="-j2" - fi - # Set ENV PREFIX in order to set --prefix for ./configure if [ -n "$PREFIX" ]; then PREFIX_ARG="--prefix=$PREFIX" fi if [ -f Makefile ]; then - $MAKE $MAKE_J maintainer-clean + make_maintainer_clean + rm -f Makefile.in + rm -f aminclude.am fi run $LIBTOOLIZE $LIBTOOLIZE_FLAGS || die "Cannot execute $LIBTOOLIZE $LIBTOOLIZE_FLAGS" diff --git a/configure.ac b/configure.ac index dc7b8ca7..ee2d417c 100644 --- a/configure.ac +++ b/configure.ac @@ -177,6 +177,7 @@ AC_C_RESTRICT AX_CXX_GCC_ABI_DEMANGLE AX_SASL_CHECK +AX_LIBEVENT dnl dnl The sasl functions should only be visible if we build with sasl support @@ -249,11 +250,6 @@ AS_IF(test "x$ac_cv_header_winsock2_h" = "xyes", ]) SOCKET_SEND_FLAGS -AX_CHECK_LIBRARY([LIBEVENT], [event.h], [event], - [LIBEVENT_LDFLAGS="-levent"], - [AC_MSG_WARN([Unable to find libevent])]) -AM_CONDITIONAL(HAVE_LIBEVENT, test "x${ax_cv_have_LIBEVENT}" = "xyes") - AX_UUID_GENERATE_TIME_SAFE @@ -267,6 +263,8 @@ AX_ASSERT AX_CXX_COMPILER_VERSION AX_HARDEN_COMPILER_FLAGS +AX_AM_JOBSERVER([yes]) + AC_CONFIG_FILES([ Makefile docs/conf.py @@ -290,8 +288,8 @@ echo " * C Flags: $CFLAGS" echo " * C++ Compiler: $CXX_VERSION" echo " * C++ Flags: $CXXFLAGS" echo " * CPP Flags: $CPPFLAGS" -echo " * Assertions enabled: $ac_cv_assert" -echo " * Debug enabled: $with_debug" +echo " * Assertions enabled: $ax_enable_assert" +echo " * Debug enabled: $ax_enable_debug" echo " * Warnings as failure: $ac_cv_warnings_as_errors" echo " * SASL support: $ac_enable_sasl" echo "" diff --git a/example/include.am b/example/include.am index 80e446eb..8dfa5f4a 100644 --- a/example/include.am +++ b/example/include.am @@ -12,6 +12,7 @@ noinst_HEADERS+= example/storage.h example_memcached_light_SOURCES= example_memcached_light_LDADD= +example_memcached_light_LDFLAGS= example_memcached_light_SOURCES+= example/byteorder.cc example_memcached_light_SOURCES+= example/interface_v0.cc @@ -22,6 +23,6 @@ example_memcached_light_SOURCES+= util/daemon.cc example_memcached_light_SOURCES+= util/pidfile.cc example_memcached_light_LDADD+= libmemcached/libmemcachedprotocol.la -example_memcached_light_LDADD+= $(LIBEVENT_LDFLAGS) +example_memcached_light_LDFLAGS+= @LIBEVENT_LDFLAGS@ include example/t/include.am diff --git a/m4/ax_add_am_macro.m4 b/m4/ax_add_am_macro.m4 new file mode 100644 index 00000000..51ce0d0c --- /dev/null +++ b/m4/ax_add_am_macro.m4 @@ -0,0 +1,29 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_add_am_macro.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_ADD_AM_MACRO([RULE]) +# +# DESCRIPTION +# +# Adds the specified rule to $AMINCLUDE. This macro will only work +# properly with implementations of Make which allow include statements. +# See also AX_ADD_AM_MACRO_STATIC. +# +# LICENSE +# +# Copyright (c) 2009 Tom Howard +# +# 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 9 + +AC_DEFUN([AX_ADD_AM_MACRO],[ + AC_REQUIRE([AX_AM_MACROS]) + AX_APPEND_TO_FILE([$AMINCLUDE],[$1]) +]) diff --git a/m4/ax_am_jobserver.m4 b/m4/ax_am_jobserver.m4 new file mode 100644 index 00000000..0bee7ab6 --- /dev/null +++ b/m4/ax_am_jobserver.m4 @@ -0,0 +1,55 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_am_jobserver.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_AM_JOBSERVER([default_value]) +# +# DESCRIPTION +# +# Enables the use of make's jobserver for the purpose of parallel building +# by passing the -j option to make. +# +# The option --enable-jobserver is added to configure which can accept a +# yes, no, or an integer. The integer is the number of separate jobs to +# allow. If 'yes' is given, then the is assumed to be one more than the +# number of CPUs (determined through AX_COUNT_CPUS). If the value of no is +# given, then the jobserver is disabled. The default value is given by the +# first argument of the macro, or 'yes' if the argument is omitted. +# +# This macro makes use of AX_AM_MACROS, so you must add the following line +# +# @INC_AMINCLUDE@ +# +# to your Makefile.am files. +# +# LICENSE +# +# Copyright (c) 2008 Michael Paul Bailey +# +# 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 7 + +AC_DEFUN([AX_AM_JOBSERVER], [ + AC_REQUIRE([AX_COUNT_CPUS]) + AC_REQUIRE([AX_AM_MACROS]) + AC_ARG_ENABLE( jobserver, + [ --enable-jobserver@<:@=no/yes/@%:@@:>@ default=m4_ifval([$1],[$1],[yes]) + Enable up to @%:@ make jobs + yes: enable one more than CPU count + ],, [enable_jobserver=m4_ifval([$1],[$1],[yes])]) + if test "x$enable_jobserver" = "xyes"; then + enable_jobserver=$CPU_COUNT + ((enable_jobserver++)) + fi + m4_pattern_allow(AM_MAKEFLAGS) + if test "x$enable_jobserver" != "xno"; then + AC_MSG_NOTICE([added jobserver support to make for $enable_jobserver jobs]) + AX_ADD_AM_MACRO( AM_MAKEFLAGS += -j$enable_jobserver ) + fi +]) diff --git a/m4/ax_am_macros.m4 b/m4/ax_am_macros.m4 new file mode 100644 index 00000000..6b4bd223 --- /dev/null +++ b/m4/ax_am_macros.m4 @@ -0,0 +1,44 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_am_macros.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_AM_MACROS +# +# DESCRIPTION +# +# Adds support for macros that create Make rules. You must manually add +# the following line +# +# @INC_AMINCLUDE@ +# +# to your Makefile.in (or Makefile.am if you use Automake) files. +# +# LICENSE +# +# Copyright (c) 2009 Tom Howard +# +# 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 9 + +AC_DEFUN([AX_AM_MACROS], +[ +AC_MSG_NOTICE([adding automake macro support]) +AMINCLUDE="aminclude.am" +AC_SUBST(AMINCLUDE) +AC_MSG_NOTICE([creating $AMINCLUDE]) +AMINCLUDE_TIME=`date` +AX_PRINT_TO_FILE([$AMINCLUDE],[[ +# generated automatically by configure from AX_AUTOMAKE_MACROS +# on $AMINCLUDE_TIME + +]]) + +INC_AMINCLUDE="include \$(top_builddir)/$AMINCLUDE" +AC_SUBST(INC_AMINCLUDE) +]) diff --git a/m4/ax_append_to_file.m4 b/m4/ax_append_to_file.m4 new file mode 100644 index 00000000..c88affb4 --- /dev/null +++ b/m4/ax_append_to_file.m4 @@ -0,0 +1,27 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_append_to_file.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_TO_FILE([FILE],[DATA]) +# +# DESCRIPTION +# +# Appends the specified data to the specified file. +# +# LICENSE +# +# Copyright (c) 2008 Tom Howard +# +# 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 7 + +AC_DEFUN([AX_APPEND_TO_FILE],[ +AC_REQUIRE([AX_FILE_ESCAPES]) +printf "$2" >> "$1" +]) diff --git a/m4/ax_count_cpus.m4 b/m4/ax_count_cpus.m4 new file mode 100644 index 00000000..d4f3d290 --- /dev/null +++ b/m4/ax_count_cpus.m4 @@ -0,0 +1,57 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_count_cpus.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COUNT_CPUS +# +# DESCRIPTION +# +# Attempt to count the number of processors present on the machine. If the +# detection fails, then a value of 1 is assumed. +# +# The value is placed in the CPU_COUNT variable. +# +# LICENSE +# +# Copyright (c) 2012 Brian Aker +# Copyright (c) 2008 Michael Paul Bailey +# Copyright (c) 2008 Christophe Tournayre +# +# 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 10 + + AC_DEFUN([AX_COUNT_CPUS],[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_PROG_EGREP]) + AC_MSG_CHECKING([the number of available CPUs]) + CPU_COUNT="0" + + AS_CASE([$host_os],[ + *darwin*],[ + AS_IF([test -x /usr/sbin/sysctl],[ + sysctl_a=`/usr/sbin/sysctl -a 2>/dev/null| grep -c hw.cpu` + AS_IF([test sysctl_a],[ + CPU_COUNT=`/usr/sbin/sysctl -n hw.ncpu` + ]) + ])],[ + *linux*],[ + AS_IF([test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo],[ + AS_IF([test "x$CPU_COUNT" = "x0" -a -e /proc/cpuinfo],[ + CPU_COUNT=`$EGREP -c '^processor' /proc/cpuinfo` + ]) + ]) + ]) + + AS_IF([test "x$CPU_COUNT" = "x0"],[ + CPU_COUNT="1" + AC_MSG_RESULT( [unable to detect (assuming 1)] ) + ],[ + AC_MSG_RESULT( $CPU_COUNT ) + ]) + ]) diff --git a/m4/ax_file_escapes.m4 b/m4/ax_file_escapes.m4 new file mode 100644 index 00000000..f4c6a06a --- /dev/null +++ b/m4/ax_file_escapes.m4 @@ -0,0 +1,30 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_file_escapes.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_FILE_ESCAPES +# +# DESCRIPTION +# +# Writes the specified data to the specified file. +# +# LICENSE +# +# Copyright (c) 2008 Tom Howard +# +# 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 7 + +AC_DEFUN([AX_FILE_ESCAPES],[ +AX_DOLLAR="\$" +AX_SRB="\\135" +AX_SLB="\\133" +AX_BS="\\\\" +AX_DQ="\"" +]) diff --git a/m4/ax_libevent.m4 b/m4/ax_libevent.m4 new file mode 100644 index 00000000..79999ef7 --- /dev/null +++ b/m4/ax_libevent.m4 @@ -0,0 +1,49 @@ +# https://github.com/BrianAker/ddm4 +# =========================================================================== +# +# SYNOPSIS +# +# AX_LIBEVENT() +# +# DESCRIPTION +# +# libevent library +# +# LICENSE +# +# Copyright (c) 2012 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 1 + + AC_DEFUN([AX_LIBEVENT],[ + AC_CACHE_CHECK([test for a working libevent], [ax_cv_libevent], [ + AX_SAVE_FLAGS + LIBS="-levent $LIBS" + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([#include ], [ + struct event_base *tmp_event= event_init(); + event_base_free(tmp_event); + ])], + [ax_cv_libevent=yes], + [ax_cv_libevent=no], + [AC_MSG_WARN([test program execution failed])]) + AC_LANG_POP + AX_RESTORE_FLAGS + ]) + + AS_IF([test "x$ax_cv_libevent" = "xyes"],[ + LIBEVENT_LDFLAGS="-levent" + AC_SUBST(LIBEVENT_LDFLAGS) + AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])],[ + AC_DEFINE([HAVE_LIBEVENT],[0],[Define if event_init is present in event_init.h.]) + ]) + + AM_CONDITIONAL(HAVE_LIBEVENT, test "x$ax_cv_libevent" = "xyes") + ]) + diff --git a/m4/ax_print_to_file.m4 b/m4/ax_print_to_file.m4 new file mode 100644 index 00000000..5b9d1c39 --- /dev/null +++ b/m4/ax_print_to_file.m4 @@ -0,0 +1,27 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_print_to_file.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PRINT_TO_FILE([FILE],[DATA]) +# +# DESCRIPTION +# +# Writes the specified data to the specified file. +# +# LICENSE +# +# Copyright (c) 2008 Tom Howard +# +# 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 7 + +AC_DEFUN([AX_PRINT_TO_FILE],[ +AC_REQUIRE([AX_FILE_ESCAPES]) +printf "$2" > "$1" +]) diff --git a/m4/ax_restore_flags.m4 b/m4/ax_restore_flags.m4 new file mode 100644 index 00000000..cf03cae7 --- /dev/null +++ b/m4/ax_restore_flags.m4 @@ -0,0 +1,31 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_restore_flags.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_RESTORE_FLAGS() +# +# DESCRIPTION +# +# Restore common compilation flags from temporary variables +# +# LICENSE +# +# Copyright (c) 2009 Filippo Giunchedi +# +# 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 + +AC_DEFUN([AX_RESTORE_FLAGS], [ + CPPFLAGS="${CPPFLAGS_save}" + CFLAGS="${CFLAGS_save}" + CXXFLAGS="${CXXFLAGS_save}" + OBJCFLAGS="${OBJCFLAGS_save}" + LDFLAGS="${LDFLAGS_save}" + LIBS="${LIBS_save}" +]) diff --git a/m4/ax_save_flags.m4 b/m4/ax_save_flags.m4 new file mode 100644 index 00000000..d2a05422 --- /dev/null +++ b/m4/ax_save_flags.m4 @@ -0,0 +1,31 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_save_flags.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_SAVE_FLAGS() +# +# DESCRIPTION +# +# Save common compilation flags into temporary variables +# +# LICENSE +# +# Copyright (c) 2009 Filippo Giunchedi +# +# 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 + +AC_DEFUN([AX_SAVE_FLAGS], [ + CPPFLAGS_save="${CPPFLAGS}" + CFLAGS_save="${CFLAGS}" + CXXFLAGS_save="${CXXFLAGS}" + OBJCFLAGS_save="${OBJCFLAGS}" + LDFLAGS_save="${LDFLAGS}" + LIBS_save="${LIBS}" +])