[mathic] 53/62: configure now downloads gtest if necessary based on --with-gtest. autogen.sh no longer downloads gtest. gtest path can be controlled with GTEST_PATH as a parameter to configure. It is now possible to build without gtest.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Wed Apr 1 11:36:24 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository mathic.
commit 4fc8d808bac029c663ab9cdd81ba0ffaff19bc49
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date: Thu Mar 21 17:35:14 2013 +0100
configure now downloads gtest if necessary based on --with-gtest. autogen.sh no longer downloads gtest. gtest path can be controlled with GTEST_PATH as a parameter to configure. It is now possible to build without gtest.
---
Makefile.am | 10 ++++++++++
autogen.sh | 22 ----------------------
configure.ac | 42 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 52 insertions(+), 22 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index d942ec5..92de34b 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -83,6 +83,8 @@ pqsim_LDADD = $(top_builddir)/libmathic-$(MATHIC_API_VERSION).la
# set up tests to run on "make check"
+if with_gtest
+
TESTS=unittest
check_PROGRAMS=$(TESTS)
@@ -99,3 +101,11 @@ unittest_SOURCES=src/test/DivFinder.cpp src/test/gtestInclude.cpp \
src/test/testMain.cpp src/test/BitTriangle.cpp \
src/test/PairQueue.cpp \
src/test/HashTable.cpp
+
+else
+
+check:
+ @echo
+ @echo "Configure did not locate gtest, so unittests cannot be run."
+
+endif
diff --git a/autogen.sh b/autogen.sh
index aac2d0b..43090bc 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -2,25 +2,3 @@
srcdir="`dirname '$0'`"
autoreconf --verbose --install --force $srcdir
-
-# Download gtest into libs/gtest if it does not already exist. If you
-# changed gtest and need to get the original version back, just delete
-# the directory libs/gtest and run this script again.
-GTEST_DIR=$srcdir/libs/
-GTEST_TMP_DIR=$srcdir/libs/
-GTEST_VERSION=1.6.0
-GTEST_DOWNLOAD_FILE=gtest-$GTEST_VERSION.zip
-if [ ! -d libs/gtest ]; then
- mkdir -p $GTEST_TMP_DIR;
- rm -rf $GTEST_TMP_DIR/$GTEST_DOWNLOAD_FILE;
- rm -rf $GTEST_TMP_DIR/gtest-$GTEST_VERSION;
- rm -rf $GTEST_TMP_DIR/gtest;
- ( \
- cd $GTEST_TMP_DIR; \
- wget http://googletest.googlecode.com/files/$GTEST_DOWNLOAD_FILE; \
- unzip $GTEST_DOWNLOAD_FILE; \
- rm $GTEST_DOWNLOAD_FILE \
- )
- rm -rf $GTEST_DIR/gtest;
- mv $GTEST_TMP_DIR/gtest-$GTEST_VERSION $GTEST_DIR/gtest;
-fi
diff --git a/configure.ac b/configure.ac
index cd1d269..5991eb9 100755
--- a/configure.ac
+++ b/configure.ac
@@ -4,6 +4,48 @@ AC_INIT([mathic], [1.0]) # package, version, bug-report-email
# Check that memtailor is installed and locate it
PKG_CHECK_MODULES([DEPS], [memtailor-1.0])
+dnl ----- The gtest dependency
+
+AC_ARG_WITH([gtest], AS_HELP_STRING(
+ [--with-gtest], [use gtest, which is required for running the unit tests
+ with make check. The value download, which is the default, downloads
+ gtest if a gtest source directory cannot be found. Per the recommendation
+ of the gtest documentation, gtest is compiled with the tests, so an
+ installed gtest is not usable - you need the gtest source. GTEST_PATH
+ indicates where to look for gtest and it is also where GTEST_PATH
+ will be downloaded to if not found. The default path is \$srcdir/libs so
+ that gtest needs to be at \$srcdir/libs/gtest/ where \$srcdir is the
+ directory that contains configure.ac.]
+))
+
+AC_MSG_CHECKING([for gtest])
+AS_IF([test "x$GTEST_PATH" == "x"], [GTEST_PATH="$srcdir/libs"])
+AS_IF([test "x$GTEST_VERSION" == "x"], [GTEST_VERSION="1.6.0"])
+AS_IF([test "x$with_gtest" == "x"], [with_gtest="download"])
+
+AS_IF([test "x$with_gtest" == "xdownload"],
+ [with_gtest="yes"; AC_CHECK_FILE([$GTEST_PATH/gtest/src/gtest-all.cc], [], [
+ mkdir -p "$GTEST_PATH";
+ (
+ cd $GTEST_PATH;
+ rm -rf gtest-$GTEST_VERSION.zip
+ wget http://googletest.googlecode.com/files/gtest-$GTEST_VERSION.zip;
+ unzip gtest-$GTEST_VERSION.zip;
+ rm gtest-$GTEST_VERSION.zip
+ rm -rf gtest/
+ mv gtest-$GTEST_VERSION/ gtest/
+ );
+ ])],
+ [test "x$with_gtest" == "xyes"], [
+ AC_CHECK_FILE([$GTEST_PATH/gtest/src/gtest-all.cc], [], [
+ AC_MSG_ERROR([could not find gtest source at path $GTEST_PATH.])
+ ])
+ ],
+ [test "x$with_gtest" == "xno"], [],
+ [AC_MSG_ERROR([invalid value $with_gtest for with_gtest.])]
+)
+AM_CONDITIONAL(with_gtest, test "x$with_gtest" != "xno")
+
# set up information about directories
AC_CONFIG_MACRO_DIR([build/autotools/m4]) # directory of extra autoconf macroes
AC_CONFIG_AUX_DIR([build/autotools]) # directory for auxiliary build tools (install-sh etc)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mathic.git
More information about the debian-science-commits
mailing list