[sword-svn] r1774 - in trunk: . m4 tests/cppunit
dglassey at crosswire.org
dglassey at crosswire.org
Mon Apr 11 11:48:28 MST 2005
Author: dglassey
Date: 2005-04-11 11:48:28 -0700 (Mon, 11 Apr 2005)
New Revision: 1774
Added:
trunk/m4/
trunk/m4/cppunit.m4
Modified:
trunk/autogen.sh
trunk/configure.ac
trunk/tests/cppunit/Makefile.am
Log:
allow cppunit tests to build
detect cppunit, if it isn't there, it just won't run the tests
Modified: trunk/autogen.sh
===================================================================
--- trunk/autogen.sh 2005-04-11 18:45:34 UTC (rev 1773)
+++ trunk/autogen.sh 2005-04-11 18:48:28 UTC (rev 1774)
@@ -10,7 +10,7 @@
ACLOCAL="$AUTODIR""aclocal"
echo "*** Recreating aclocal.m4"
echo "$ACLOCAL"
- $ACLOCAL;
+ $ACLOCAL -I m4;
echo "*** Recreating configure"
AUTOCONF="$AUTODIR""autoconf"
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2005-04-11 18:45:34 UTC (rev 1773)
+++ trunk/configure.ac 2005-04-11 18:48:28 UTC (rev 1774)
@@ -81,11 +81,11 @@
# Find CppUnit
# ---------------------------------------------------------------------
# Locate CppUnit (minimum version 1.8.0) for testing.
-#AM_PATH_CPPUNIT(1.8.0)
+AM_PATH_CPPUNIT(1.8.0)
# You can set up an automake conditional and use it to conditionally
# build cppunit-using test programs.
-#AM_CONDITIONAL(HAVE_CPPUNIT, test "$CPPUNIT_LIBS")
+AM_CONDITIONAL(HAVE_CPPUNIT, test "$CPPUNIT_LIBS")
# ---------------------------------------------------------------------
Added: trunk/m4/cppunit.m4
===================================================================
--- trunk/m4/cppunit.m4 2005-04-11 18:45:34 UTC (rev 1773)
+++ trunk/m4/cppunit.m4 2005-04-11 18:48:28 UTC (rev 1774)
@@ -0,0 +1,80 @@
+dnl
+dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl
+AC_DEFUN(AM_PATH_CPPUNIT,
+[
+
+AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)],
+ cppunit_config_prefix="$withval", cppunit_config_prefix="")
+AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)],
+ cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="")
+
+ if test x$cppunit_config_exec_prefix != x ; then
+ cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
+ if test x${CPPUNIT_CONFIG+set} != xset ; then
+ CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
+ fi
+ fi
+ if test x$cppunit_config_prefix != x ; then
+ cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
+ if test x${CPPUNIT_CONFIG+set} != xset ; then
+ CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
+ fi
+ fi
+
+ AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
+ cppunit_version_min=$1
+
+ AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
+ no_cppunit=""
+ if test "$CPPUNIT_CONFIG" = "no" ; then
+ no_cppunit=yes
+ else
+ CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
+ CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
+ cppunit_version=`$CPPUNIT_CONFIG --version`
+
+ cppunit_major_version=`echo $cppunit_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ cppunit_minor_version=`echo $cppunit_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ cppunit_micro_version=`echo $cppunit_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+
+ cppunit_major_min=`echo $cppunit_version_min | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ cppunit_minor_min=`echo $cppunit_version_min | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ cppunit_micro_min=`echo $cppunit_version_min | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+
+ cppunit_version_proper=`expr \
+ $cppunit_major_version \> $cppunit_major_min \| \
+ $cppunit_major_version \= $cppunit_major_min \& \
+ $cppunit_minor_version \> $cppunit_minor_min \| \
+ $cppunit_major_version \= $cppunit_major_min \& \
+ $cppunit_minor_version \= $cppunit_minor_min \& \
+ $cppunit_micro_version \>= $cppunit_micro_min `
+
+ if test "$cppunit_version_proper" = "1" ; then
+ AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
+ else
+ AC_MSG_RESULT(no)
+ no_cppunit=yes
+ fi
+ fi
+
+ if test "x$no_cppunit" = x ; then
+ ifelse([$2], , :, [$2])
+ else
+ CPPUNIT_CFLAGS=""
+ CPPUNIT_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+
+ AC_SUBST(CPPUNIT_CFLAGS)
+ AC_SUBST(CPPUNIT_LIBS)
+])
+
+
+
Modified: trunk/tests/cppunit/Makefile.am
===================================================================
--- trunk/tests/cppunit/Makefile.am 2005-04-11 18:45:34 UTC (rev 1773)
+++ trunk/tests/cppunit/Makefile.am 2005-04-11 18:48:28 UTC (rev 1774)
@@ -1,12 +1,16 @@
LDADD = $(top_builddir)/lib/libsword.la
# Rules for the test code (use `make check` to execute)
+if HAVE_CPPUNIT
TESTS = LibSword
+else
+TESTS =
+endif
check_PROGRAMS = $(TESTS)
LibSword_SOURCES = main.cpp stringmgr_test.cpp swbuf_test.cpp url_test.cpp versekey_test.cpp
-LibSword_CXXFLAGS = $(CPPUNIT_CFLAGS)
-LibSword_LDFLAGS = -lcppunit -ldl
+LibSword_CXXFLAGS = $(CPPUNIT_CFLAGS) -I$(top_srcdir)/include
+LibSword_LDFLAGS = $(CPPUNIT_LIBS)
swcppunitpdir = $(top_srcdir)/tests/cppunit
-#all: check
\ No newline at end of file
+#all: check
More information about the sword-cvs
mailing list