[mathicgb] 195/393: configure now has a --with-gtest option that defaults to downloading gtest if it is not found. If --with-gtest=no then configure will succeed without gtest though then make check won't do anything other than to report that gtest was not found. The --with-tbb option now defaults to disabling tbb if it is not found. autogen.sh no longer downloads gtest. Hence a fresh git clone of mathicgb can now build out of the box with no options given even without tbb and without an internet connection. gtest is looked for at GTEST_PATH, so memtailor, mathic and mathicgb can now share the same download of gtest.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:58:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch upstream
in repository mathicgb.

commit dc5c9bfa69cf557172cecc620dee0e08e190bd74
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date:   Thu Mar 21 17:25:50 2013 +0100

    configure now has a --with-gtest option that defaults to downloading gtest if it is not found. If --with-gtest=no then configure will succeed without gtest though then make check won't do anything other than to report that gtest was not found. The --with-tbb option now defaults to disabling tbb if it is not found. autogen.sh no longer downloads gtest. Hence a fresh git clone of mathicgb can now build out of the box with no options given even without tbb and without an internet connect [...]
---
 Makefile.am  |  9 +++++++++
 autogen.sh   | 22 --------------------
 configure.ac | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------
 3 files changed, 66 insertions(+), 30 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 422a002..d32ab93 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -90,6 +90,8 @@ mgb_SOURCES = src/cli/GBMain.cpp src/cli/CommonParams.hpp				\
 mgb_LDADD = $(top_builddir)/libmathicgb.la $(DEPS_LIBS)
 
 # set up tests to run on "make check"
+if with_gtest
+
 TESTS=unittest
 check_PROGRAMS=$(TESTS)
 
@@ -107,3 +109,10 @@ unittest_SOURCES=src/test/FreeModuleOrderTest.cpp						\
   src/test/SparseMatrix.cpp src/test/QuadMatrixBuilder.cpp				\
   src/test/F4MatrixBuilder.cpp src/test/F4MatrixReducer.cpp             \
   src/test/mathicgb.cpp
+
+else
+
+check:
+	echo "configure did not locate gtest, so unittests cannot be run."
+
+endif
\ No newline at end of file
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 6f50e8d..ede60d9 100755
--- a/configure.ac
+++ b/configure.ac
@@ -5,18 +5,67 @@ AC_INIT([mathicgb], [1.0]) # package, version, bug-report-email
 PKG_CHECK_MODULES([MEMTAILOR], [memtailor-1.0])
 PKG_CHECK_MODULES([MATHIC], [mathic-1.0])
 
-AC_ARG_WITH([tbb],
-  AS_HELP_STRING(
-    [--disable-tbb],
-	[Do not use TBB. Removes support for parallel execution and precise timing.]
-  )
+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")
 
+dnl ----- The TBB dependency
+AC_ARG_WITH([tbb], AS_HELP_STRING(
+    [--with-tbb], [use TBB, which is required for multithreading. The value
+      detect, which is the default, enables TBB if it can be found and
+      otherwise prints a warning and continues the build without
+      multithreading support. TBB is not available for Cygwin (last checked
+      March 2013).]
+))
+AS_IF([test "x$with_tbb" == "x"], [with_tbb="detect"])
+AS_IF([test "x$with_tbb" == "xdetect"],
+    [PKG_CHECK_MODULES([TBB], [tbb], [with_tbb="yes"], [with_tbb="no";
+      AC_MSG_WARN([TBB not detected. Compiling without multithreading and without precise timing.])
+    ])])
 AS_IF(
-  [test "x$with_tbb" == "xno"], [TBB_CFLAGS=-DMATHICGB_NO_TBB],
-  [PKG_CHECK_MODULES([TBB], [tbb])]
+  [test "x$with_tbb" == "xyes"], [PKG_CHECK_MODULES([TBB], [tbb])],
+  [test "x$with_tbb" == "xno"], [TBB_CFLAGS="-DMATHICGB_NO_TBB"],
+  [AC_MSG_ERROR([invalid value $with_tbb for with_tbb.])]
 )
-
+ 
 DEPS_CFLAGS="$MEMTAILOR_CFLAGS $MATHIC_CFLAGS $TBB_CFLAGS"
 DEPS_LIBS="$MEMTAILOR_LIBS $MATHIC_LIBS $TBB_LIBS -lrt"
 AC_SUBST(DEPS_CFLAGS)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mathicgb.git



More information about the debian-science-commits mailing list