fix autotools for check

This commit is contained in:
c9s 2014-06-02 05:23:00 +08:00
parent 359d9df369
commit d4d1a59728
2 changed files with 15 additions and 17 deletions

View file

@ -100,14 +100,19 @@ AM_CONDITIONAL(ENABLE_JSON, test "x$enable_json" = "xyes")
# This does not work because configure does not look into /opt/local/include... # This does not work because configure does not look into /opt/local/include...
# AC_CHECK_HEADERS([check.h],[ enable_check=yes ],[ enable_check=unset ]) # AC_CHECK_HEADERS([check.h],[ enable_check=yes ],[ enable_check=unset ])
AC_ARG_ENABLE(check, AS_HELP_STRING([--enable-check], [enable unit testing]))
if test "$enable_check" = "xyes"; then
PKG_CHECK_MODULES(CHECK,[check >= 0.9.4],:,[ AC_ARG_ENABLE(check,
ifdef([AM_PATH_CHECK], AS_HELP_STRING([--enable-check],
[AM_PATH_CHECK(,[have_check="yes"])], [enable unit testing]),
AC_MSG_WARN([Check not found; cannot run unit tests!]) , enable_check=unset)
[have_check="no"])] if test "x$enable_check" != "xunset" ; then
]) PKG_CHECK_MODULES(CHECK,[check >= 0.9.4],:,[
ifdef([AM_PATH_CHECK],
[AM_PATH_CHECK(,[have_check="yes"])],
AC_MSG_WARN([Check not found; cannot run unit tests!])
[have_check="no"])]
])
fi fi
AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes") AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")

View file

@ -1,13 +1,7 @@
# INCLUDES = @CHECK_CFLAGS@
# if HAVE_CHECK
# TESTS = check_tree
# else
# TESTS =
# endif
TESTS = TESTS =
AM_CFLAGS=$(DEPS_CFLAGS) $(GVC_DEPS_CFLAGS) $(JSONC_CFLAGS) -I$(top_builddir) -I$(top_builddir)/include -I$(top_builddir)/src -I$(top_builddir)/3rdparty -Wall -std=c99 -ggdb -Wall AM_CFLAGS=$(DEPS_CFLAGS) $(GVC_DEPS_CFLAGS) $(JSONC_CFLAGS) @CHECK_CFLAGS@ -I$(top_builddir) -I$(top_builddir)/include -I$(top_builddir)/src -I$(top_builddir)/3rdparty -Wall -std=c99 -ggdb -Wall
AM_LDFLAGS=$(DEPS_LIBS) $(GVC_DEPS_LIBS) $(JSONC_LIBS) -L$(top_builddir) -lcheck @CHECK_LIBS@ $(top_builddir)/libr3.la AM_LDFLAGS=$(DEPS_LIBS) $(GVC_DEPS_LIBS) $(JSONC_LIBS) @CHECK_LIBS@ $(top_builddir)/libr3.la
if USE_JEMALLOC if USE_JEMALLOC
AM_CFLAGS += -ljemalloc AM_CFLAGS += -ljemalloc
@ -24,7 +18,6 @@ dist_noinst_DATA = \
TESTS += check_slug TESTS += check_slug
check_slug_SOURCES = check_slug.c check_slug_SOURCES = check_slug.c
TESTS += check_tree TESTS += check_tree
check_tree_SOURCES = check_tree.c check_tree_SOURCES = check_tree.c