build: Allow disabling all tests and examples
authorEmmanuele Bassi <ebassi@linux.intel.com>
Tue, 1 May 2012 17:51:19 +0000 (18:51 +0100)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Tue, 1 May 2012 18:09:47 +0000 (19:09 +0100)
This should allow nicer build automation and cross-compilation support.

The former --disable-conformance configure switch has been deprecated by
the --disable-tests one, which is more encompassing as it disables the
whole test suite.

Makefile.am
configure.ac
tests/Makefile.am

index c8b3de9..e8cd0ff 100644 (file)
@@ -2,7 +2,17 @@ include $(top_srcdir)/build/autotools/Makefile.am.silent
 
 NULL =
 
-SUBDIRS = clutter tests examples doc po build
+SUBDIRS = clutter doc po build
+
+if BUILD_TESTS
+SUBDIRS += tests
+endif
+
+if BUILD_EXAMPLES
+SUBDIRS += examples
+endif
+
+DIST_SUBDIRS = clutter tests examples doc po build
 
 # XXX - this is a massive hack to make autoreconf honour the ACLOCAL_FLAGS
 # that jhbuild sets while still retaining build/autotools as the authoritative
index 18b7923..fe9bbf0 100644 (file)
@@ -866,16 +866,6 @@ AS_CASE([$enable_deprecated],
 AC_SUBST([CLUTTER_DEPRECATED_CFLAGS])
 
 
-dnl === Conformance test suite ================================================
-
-AC_ARG_ENABLE([conformance],
-              [AS_HELP_STRING([--enable-conformance=@<:@no/yes@:>@],
-                              [Build conformance test suite @<:@default=yes@:>@])],
-              [],
-              [enable_conformance=yes])
-
-AM_CONDITIONAL([BUILD_TESTS], [test "x$enable_conformance" = "xyes"])
-
 dnl === Profiling =============================================================
 
 m4_define([profile_default], [no])
@@ -1088,6 +1078,27 @@ AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],
                    [The prefix for our gettext translation domains.])
 AS_ALL_LINGUAS
 
+dnl = Build optionals =========================================================
+
+dnl === Conformance test suite ================================================
+
+AC_ARG_ENABLE([conformance],
+              [AS_HELP_STRING([--disable-conformance], [Whether the conformance tests should be built])],
+              [],
+              [enable_conformance=yes])
+
+AC_ARG_ENABLE([tests],
+              [AS_HELP_STRING([--disable-tests], [Whether tests should be built])],
+              [],
+              [enable_tests=yes])
+AM_CONDITIONAL(BUILD_TESTS, [test "x$enable_tests" = "xyes" && "x$enable_conformance" = "xyes"])
+
+AC_ARG_ENABLE([examples],
+              [AS_HELP_STRING([--disable-examples], [Whether examples should be built])],
+              [],
+              [enable_examples=yes])
+AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = "xyes"])
+
 dnl ===========================================================================
 
 AC_CONFIG_FILES([
@@ -1170,9 +1181,12 @@ echo "        Build Additional Documentation: ${enable_docs} (Generate PDF: ${en
 echo ""
 echo " • Extra:"
 echo "        Build introspection data: ${enable_introspection}"
-echo "        Build conformance test suite: ${enable_conformance}"
+echo "        Build test suites: ${enable_tests}"
+if test "x$enable_tests" = "xyes"; then
 echo "        Build X11-specific tests: ${x11_tests}"
 echo "        Build tests using GDK-Pixbuf: ${pixbuf_tests}"
+fi
+echo "        Build examples: ${enable_examples}"
 
 # Clutter backend related flags
 echo ""
index 9eeba79..48f2531 100644 (file)
@@ -1,26 +1,12 @@
-SUBDIRS = accessibility data interactive micro-bench performance
-
-if BUILD_TESTS
-SUBDIRS += conform
-endif
-
-DIST_SUBDIRS = accessibility data conform interactive micro-bench performance
+SUBDIRS = accessibility data conform interactive micro-bench performance
 
 EXTRA_DIST = README
 
-if BUILD_TESTS
 test conform:
        ( cd ./conform && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $$?
 
 test-report full-report:
        ( cd ./conform && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $$?
-else
-test conform:
-       @true
-
-test-report full-report:
-       @true
-endif # BUILD_TESTS
 
 .PHONY: test conform test-report full-report