#!/bin/sh
-autoreconf -ivf
+autoreconf -ivf -Wall
AC_SUBST(HASHKIT_LIBRARY_VERSION)
LT_INIT
+m4_include([m4/memcached.m4])
AM_CONDITIONAL(BUILDING_LIBMEMCACHED, true)
AM_CONDITIONAL(HAVE_LIBMEMCACHED, false)
AM_CONDITIONAL(BUILDING_GEARMAN, false)
AM_CONDITIONAL(HAVE_LIBGEARMAN, false)
+AC_DEFINE([GEARMAN_BINARY], [0], [dummy variable])
AC_SEARCH_LIBS(getopt_long, gnugetopt)
AC_SEARCH_LIBS(gethostbyname, nsl)
libtest/signal.cc \
libtest/test.cc
-libtest_libtest_la_CFLAGS= ${AM_CFLAGS}
-libtest_libtest_la_CFLAGS+= ${NO_CONVERSION}
-libtest_libtest_la_CFLAGS+= $(PTHREAD_CFLAGS)
-libtest_libtest_la_CFLAGS+= -DBUILDING_LIBTEST
-libtest_libtest_la_CPPFLAGS= ${AM_CPPFLAGS}
-libtest_libtest_la_CPPFLAGS+= ${NO_CONVERSION}
-libtest_libtest_la_CPPFLAGS+= $(PTHREAD_LIBS)
-libtest_libtest_la_CPPFLAGS+= -DBUILDING_LIBTEST
libtest_libtest_la_CXXFLAGS= ${AM_CXXFLAGS}
libtest_libtest_la_CXXFLAGS+= ${NO_CONVERSION}
libtest_libtest_la_CXXFLAGS+= -DBUILDING_LIBTEST
libtest_libtest_la_LIBADD+= $(PTHREAD_LIBS)
libtest_libtest_la_DEPENDENCIES=
-LIBTEST_LDADD= libtest/libtest.la
+libtest_unittest_CXXFLAGS= ${AM_CXXFLAGS}
+libtest_unittest_LDADD=
+libtest_unittest_DEPENDENCIES=
# We are either building in tree, or with
if BUILDING_LIBMEMCACHED
libtest_libtest_la_LIBADD+= libmemcached/libmemcached.la
libtest_libtest_la_LIBADD+= libmemcached/libmemcachedutil.la
libtest_libtest_la_SOURCES+= libtest/memcached.cc
-endif
+libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED
+
+libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED
+libtest_unittest_LDADD+= libmemcached/libmemcached.la
+libtest_unittest_LDADD+= libmemcached/libmemcachedutil.la
+else
if HAVE_LIBMEMCACHED
libtest_libtest_la_LIBADD+= $(libmemcached_LIBS) -lmemcachedutil
libtest_libtest_la_SOURCES+= libtest/memcached.cc
+else
+libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
+libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
+endif
endif
if BUILDING_GEARMAN
libtest_libtest_la_SOURCES+= libtest/gearmand.cc
libtest_libtest_la_SOURCES+= util/instance.cc
libtest_libtest_la_SOURCES+= util/operation.cc
-endif
+libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBGEARMAN
+libtest_libtest_la_CXXFLAGS+= -DGEARMAND_BINARY="gearmand/gearmand"
+
+libtest_unittest_CXXFLAGS+= -DHAVE_LIBGEARMAN
+libtest_unittest_CXXFLAGS+= -DGEARMAND_BINARY="gearmand/gearmand"
+libtest_unittest_LDADD+= libgearman/libgearman.la
+libtest_unittest_DEPENDENCIES+= libgearman/libgearman.la
+else
if HAVE_LIBGEARMAN
libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
libtest_libtest_la_LIBADD+= $(libgearman_LIBS)
libtest_libtest_la_SOURCES+= libtest/gearmand.cc
libtest_libtest_la_SOURCES+= util/instance.cc
libtest_libtest_la_SOURCES+= util/operation.cc
+else
+libtest_libtest_la_CXXFLAGS+= -DGEARMAND_BINARY=0
+libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBGEARMAN=0
+libtest_unittest_CXXFLAGS+= -DGEARMAND_BINARY=0
+libtest_unittest_CXXFLAGS+= -DHAVE_LIBGEARMAN=0
+endif
endif
libtest_tmp_dir: tests/var/log tests/var/tmp tests/var/run
@$(mkdir_p) tests/var/run
-libtest_unittest_CFLAGS=
-libtest_unittest_LDADD= ${LIBTEST_LDADD}
-libtest_unittest_DEPENDENCIES= ${LIBTEST_LDADD} libtest_tmp_dir
+libtest_unittest_DEPENDENCIES+= libtest/libtest.la libtest_tmp_dir
+libtest_unittest_LDADD+= libtest/libtest.la
libtest_unittest_SOURCES= libtest/unittest.cc
check_PROGRAMS+= libtest/unittest
noinst_PROGRAMS+= libtest/unittest
--- /dev/null
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_with_prog.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_WITH_PROG([VARIABLE],[program],[VALUE-IF-NOT-FOUND],[PATH])
+#
+# DESCRIPTION
+#
+# Locates an installed program binary, placing the result in the precious
+# variable VARIABLE. Accepts a present VARIABLE, then --with-program, and
+# failing that searches for program in the given path (which defaults to
+# the system path). If program is found, VARIABLE is set to the full path
+# of the binary; if it is not found VARIABLE is set to VALUE-IF-NOT-FOUND
+# if provided, unchanged otherwise.
+#
+# A typical example could be the following one:
+#
+# AX_WITH_PROG(PERL,perl)
+#
+# NOTE: This macro is based upon the original AX_WITH_PYTHON macro from
+# Dustin J. Mitchell <dustin@cs.uchicago.edu>.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
+# Copyright (c) 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu>
+#
+# 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 16
+
+AC_DEFUN([AX_WITH_PROG],[
+ AC_PREREQ([2.61])
+
+ pushdef([VARIABLE],$1)
+ pushdef([EXECUTABLE],$2)
+ pushdef([VALUE_IF_NOT_FOUND],$3)
+ pushdef([PATH_PROG],$4)
+
+ AC_ARG_VAR(VARIABLE,Absolute path to EXECUTABLE executable)
+
+ AS_IF(test -z "$VARIABLE",[
+ AC_MSG_CHECKING(whether EXECUTABLE executable path has been provided)
+ AC_ARG_WITH(EXECUTABLE,AS_HELP_STRING([--with-EXECUTABLE=[[[PATH]]]],absolute path to EXECUTABLE executable), [
+ AS_IF([test "$withval" != yes && test "$withval" != no],[
+ VARIABLE="$withval"
+ AC_MSG_RESULT($VARIABLE)
+ ],[
+ VARIABLE=""
+ AC_MSG_RESULT([no])
+ AS_IF([test "$withval" != no], [
+ AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[])
+ ])
+ ])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[])
+ ])
+ ])
+
+ popdef([PATH_PROG])
+ popdef([VALUE_IF_NOT_FOUND])
+ popdef([EXECUTABLE])
+ popdef([VARIABLE])
+])
-AC_DEFUN([WITH_MEMCACHED],
- [AC_ARG_WITH([memcached],
- [AS_HELP_STRING([--with-memcached],
- [Memcached binary to use for make test])],
- [ac_cv_with_memcached="$withval"],
- [ac_cv_with_memcached=memcached])
-
- # just ignore the user if --without-memcached is passed.. it is
- # only used by make test
- AS_IF([test "x$withval" = "xno"],
- [
- ac_cv_with_memcached=memcached
- MEMC_BINARY=memcached
- ],
- [
- AS_IF([test -f "$withval"],
- [
- ac_cv_with_memcached=$withval
- MEMC_BINARY=$withval
- ],
- [
- AC_PATH_PROG([MEMC_BINARY], [$ac_cv_with_memcached], "no")
- AS_IF([test "x$MEMC_BINARY" = "xno"],
- AC_MSG_ERROR(["could not find memcached binary"]))
- ])
- ])
-
- AC_DEFINE_UNQUOTED([MEMCACHED_BINARY], "$MEMC_BINARY",
- [Name of the memcached binary used in make test])
- AC_SUBST(MEMC_BINARY)
-])
+AX_WITH_PROG(MEMCACHED_BINARY,memcached)
+AS_IF([test -f "$ac_cv_path_MEMCACHED_BINARY"],
+ [
+ AC_DEFINE_UNQUOTED([MEMCACHED_BINARY], "$ac_cv_path_MEMCACHED_BINARY", [Name of the memcached binary used in make test])
+ ],
+ [
+ AC_DEFINE([MEMCACHED_BINARY], [0], [Name of the memcached binary used in make test])
+ ])