Store latest of libtest
authorBrian Aker <brian@tangent.org>
Tue, 9 Aug 2011 08:13:21 +0000 (01:13 -0700)
committerBrian Aker <brian@tangent.org>
Tue, 9 Aug 2011 08:13:21 +0000 (01:13 -0700)
config/autorun.sh
configure.ac
libtest/include.am
m4/ax_with_prog.m4 [new file with mode: 0644]
m4/memcached.m4

index 3b076d1a12c71eba41bb1e392c1d56f1ed53092f..79d6629edb06c92ef7e97ef69bc9be6beb5cee66 100755 (executable)
@@ -1,2 +1,2 @@
 #!/bin/sh
-autoreconf -ivf
+autoreconf -ivf -Wall
index a71e3369c23bf5e537edb5c57cf999a4e25d3c2c..9853913028461b9c641b1aa40e370635f456f899 100644 (file)
@@ -53,11 +53,13 @@ HASHKIT_LIBRARY_VERSION=1:0:0
 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)
index ab846b75e1e24584446ada328730712ad0ecff34..d65c416974b12273b4ff38d44b60c34a663c1bab 100644 (file)
@@ -82,14 +82,6 @@ libtest_libtest_la_SOURCES= \
                            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
@@ -98,7 +90,9 @@ libtest_libtest_la_LIBADD=
 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
@@ -107,10 +101,19 @@ libtest_libtest_la_DEPENDENCIES+= libmemcached/libmemcachedutil.la
 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
@@ -120,7 +123,14 @@ libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
 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)
@@ -128,6 +138,12 @@ libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
 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
@@ -145,9 +161,8 @@ tests/var/run: tests/var
        @$(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
diff --git a/m4/ax_with_prog.m4 b/m4/ax_with_prog.m4
new file mode 100644 (file)
index 0000000..f337c05
--- /dev/null
@@ -0,0 +1,70 @@
+# ===========================================================================
+#       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])
+])
index 010fb42900de16b05c07b0572a062b4e74d29ed6..0b8592fe546f14657c9d7081d90faa4b63b6a3a4 100644 (file)
@@ -1,31 +1,8 @@
-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])
+      ])