build: Add --disable-modular-tests build option
authorColin Walters <walters@verbum.org>
Fri, 13 Jan 2012 15:09:10 +0000 (10:09 -0500)
committerColin Walters <walters@verbum.org>
Sun, 15 Apr 2012 15:15:54 +0000 (11:15 -0400)
This patch solves two problems:

First, it allows builders to optionally cut the circular dependency
between dbus and glib by disabling the modular tests (just like how
the tests can be disabled in dbus).

Second, the tests are entirely pointless to build if cross-compiling.

It also moves us slightly closer to the long term future we want where
the tests are a separate ./configure invocation and run against the
INSTALLED glib, not the one in the source tree. This would allow us to
run the tests constantly, not just when glib is built.

https://bugzilla.gnome.org/show_bug.cgi?id=667806

Makefile.am
configure.ac
gio/Makefile.am
glib/Makefile.am
gobject/Makefile.am

index f5c510d..55be9d2 100644 (file)
@@ -6,8 +6,13 @@ include $(top_srcdir)/Makefile.decl
 
 ACLOCAL_AMFLAGS = -I m4macros ${ACLOCAL_FLAGS}
 
-SUBDIRS = . m4macros glib gmodule gthread gobject gio tests po docs
+SUBDIRS = . m4macros glib gmodule gthread gobject gio po docs
 DIST_SUBDIRS = $(SUBDIRS) build
+if BUILD_MODULAR_TESTS
+SUBDIRS += tests 
+else
+DIST_SUBDIRS += tests
+endif
 
 bin_SCRIPTS = glib-gettextize
 
index 0c4e645..c93fcec 100644 (file)
@@ -247,6 +247,11 @@ AC_ARG_ENABLE(rebuilds,
               [AC_HELP_STRING([--disable-rebuilds],
                               [disable all source autogeneration rules])],,
               [enable_rebuilds=yes])
+AC_ARG_ENABLE(modular_tests,
+              AC_HELP_STRING([--disable-modular-tests],
+                             [Disable build of test programs (default: no)]),,
+              [enable_modular_tests=yes])
+AM_CONDITIONAL(BUILD_MODULAR_TESTS, test x$enable_modular_tests = xyes)
 
 AC_MSG_CHECKING([whether to enable garbage collector friendliness])
 if test "x$enable_gc_friendly" = "xyes"; then
@@ -3449,12 +3454,14 @@ AC_CHECK_ALIGNOF([unsigned long])
 # Check for libdbus1 - Optional - is only used in the GDBus test cases
 #
 # 1.2.14 required for dbus_message_set_serial
-PKG_CHECK_MODULES(DBUS1,
-                  dbus-1 >= 1.2.14,
-                  [AC_DEFINE(HAVE_DBUS1, 1, [Define if dbus-1 is available]) have_dbus1=yes],
-                  have_dbus1=no)
-AC_SUBST(DBUS1_CFLAGS)
-AC_SUBST(DBUS1_LIBS)
+if test x$enable_modular_tests = xyes; then
+   PKG_CHECK_MODULES(DBUS1,
+                     dbus-1 >= 1.2.14,
+                     [AC_DEFINE(HAVE_DBUS1, 1, [Define if dbus-1 is available]) have_dbus1=yes],
+                     have_dbus1=no)
+   AC_SUBST(DBUS1_CFLAGS)
+   AC_SUBST(DBUS1_LIBS)
+fi
 AM_CONDITIONAL(HAVE_DBUS1, [test "x$have_dbus1" = "xyes"])
 
 dnl
index b0ae4de..edb534a 100644 (file)
@@ -2,6 +2,7 @@ include $(top_srcdir)/Makefile.decl
 
 NULL =
 
+DIST_SUBDIRS =
 SUBDIRS = gdbus-2.0/codegen
 
 if OS_UNIX
@@ -302,7 +303,11 @@ giowin32include_HEADERS = \
 
 endif
 
-SUBDIRS += tests
+if BUILD_MODULAR_TESTS
+SUBDIRS += tests 
+else
+DIST_SUBDIRS += tests
+endif
 
 libgio_2_0_la_SOURCES =                \
        gappinfo.c              \
index ac73a8c..ac232d2 100644 (file)
@@ -35,7 +35,13 @@ else
 MAYBE_PCRE = pcre 
 endif
 
-SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . tests
+SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre .
+DIST_SUBDIRS =
+if BUILD_MODULAR_TESTS
+SUBDIRS += tests 
+else
+DIST_SUBDIRS += tests
+endif
 
 DIST_SUBDIRS = libcharset gnulib pcre update-pcre tests
 
index cc265b4..3dc277f 100644 (file)
@@ -4,7 +4,13 @@
 ## Process this file with automake to produce Makefile.in
 include $(top_srcdir)/Makefile.decl
 
-SUBDIRS = . tests
+SUBDIRS = .
+DIST_SUBDIRS =
+if BUILD_MODULAR_TESTS
+SUBDIRS += tests 
+else
+DIST_SUBDIRS += tests
+endif
 
 BUILT_SOURCES=
 CLEANFILES=