Improved integration of check library. Should do the same for benchmarks.

This commit is contained in:
Davi Reis 2012-06-05 00:27:17 -03:00
parent 688c382420
commit fba715aebb
2 changed files with 21 additions and 9 deletions

View File

@ -50,12 +50,20 @@ if test x$cxxmph = xtrue; then
AC_SUBST([CXXMPH], "cxxmph")
fi
PKG_CHECK_MODULES([CHECK], [check >= 0.9.8], [HAVE_LIBCHECK=1], [HAVE_LIBCHECK=])
if test "x$CHECK_LIBS" = "x" ; then
if test "x$cxxmph" = "xtrue"; then
AC_MSG_WARN([Testing library not found, make check will fail.])
fi
fi
# Unit tests based on the check library. Disabled by default.
# We do not use pkg-config because it is inconvenient for all developers to
# have check library installed.
AC_ARG_ENABLE(check, AS_HELP_STRING(
[--enable-check],
[Build unit tests depending on check library (default: disabled)]))
AS_IF([test "x$enable_check" = "xyes"],
[ AC_CHECK_LIB([check], [tcase_create])
AS_IF([test "$ac_cv_lib_check_tcase_create" = yes], [CHECK_LIBS="-lcheck"],
[AC_MSG_ERROR("Failed to find check library (http://check.sf.net).")])
AC_CHECK_HEADER(check.h,[],
[AC_MSG_ERROR("Failed to find check library header (http://check.sf.net).")])
])
AM_CONDITIONAL([USE_LIBCHECK], [test "$ac_cv_lib_check_tcase_create" = yes])
AC_SUBST(CHECK_LIBS)
AC_SUBST(CHECK_CFLAGS)

View File

@ -1,12 +1,16 @@
TESTS = $(check_PROGRAMS)
check_PROGRAMS = test_test seeded_hash_test mph_bits_test hollow_iterator_test mph_map_test mph_index_test trigraph_test map_tester_test string_util_test
noinst_PROGRAMS = bm_index bm_map
check_PROGRAMS = seeded_hash_test mph_bits_test hollow_iterator_test mph_index_test trigraph_test string_util_test
if USE_LIBCHECK
check_PROGRAMS += test_test map_tester_test mph_map_test
check_LTLIBRARIES = libcxxmph_test.la
endif
noinst_PROGRAMS = bm_map # bm_index - disabled because of cmph dependency
bin_PROGRAMS = cxxmph
cxxmph_includedir = $(includedir)/cxxmph/
cxxmph_include_HEADERS = mph_bits.h mph_map.h mph_index.h MurmurHash3.h trigraph.h seeded_hash.h stringpiece.h hollow_iterator.h string_util.h
check_LTLIBRARIES = libcxxmph_test.la
noinst_LTLIBRARIES = libcxxmph_bm.la
lib_LTLIBRARIES = libcxxmph.la
libcxxmph_la_SOURCES = MurmurHash3.cpp trigraph.cc mph_bits.cc mph_index.cc benchmark.h benchmark.cc string_util.cc