diff --git a/Makefile.am b/Makefile.am index a8797277a..b344b2d76 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = include @ZLIBDIR@ src @EXAMPLESDIR@ test +SUBDIRS = include @ZLIBDIR@ src @EXAMPLESDIR@ @TESTSDIR@ EXTRA_DIST = autotool.sh docs/manual.html docs/manual.rst docs/extension_protocol.rst \ docs/extension_protocol.html \ docs/projects.rst docs/projects.html \ diff --git a/configure.in b/configure.in index 4874cdba6..3cde7df3f 100644 --- a/configure.in +++ b/configure.in @@ -336,6 +336,36 @@ esac dnl make $examples visible to Makefiles AC_SUBST([EXAMPLESDIR]) +dnl Check whether the tests should be build +AC_ARG_ENABLE( + [tests], + AS_HELP_STRING([--enable-tests],[Build test files. Default is not to build them.]), + [[tests=$enableval]], + [[tests=no]] +) +dnl Check the value of the --with-tests switch +AC_MSG_CHECKING([if test files should be build]) +case "$tests" in + "yes") + AC_MSG_RESULT(yes) + TESTSDIR="test" + ;; + "no") + AC_MSG_RESULT(no) + TESTSDIR="" + ;; + "") + AC_MSG_RESULT(yes (default)) + TESTSDIR="test" + ;; + *) + AC_MSG_RESULT() + AC_MSG_ERROR([Unknown --enable-tests option "$examples". Use either "yes" or "no".]) + ;; +esac +dnl make $examples visible to Makefiles +AC_SUBST([TESTSDIR]) + dnl Set some defines if we are building a shared library if [[ "x$enable_shared" == "xyes" ]]; then AC_DEFINE(TORRENT_BUILDING_SHARED,,[Make sure the functions and classes are exported.]) @@ -368,8 +398,11 @@ AC_SUBST(DEBUGFLAGS) dnl Compile time options. AC_SUBST(COMPILETIME_OPTIONS) -AC_CONFIG_FILES(Makefile src/Makefile include/Makefile test/Makefile libtorrent-rasterbar.pc) +AC_CONFIG_FILES(Makefile src/Makefile include/Makefile libtorrent-rasterbar.pc) if [[ "x$examples" == "xyes" ]]; then AC_CONFIG_FILES(examples/Makefile) fi +if [[ "x$tests" == "xyes" ]]; then + AC_CONFIG_FILES(test/Makefile) +fi AC_OUTPUT