build: Add --disable-modular-tests build option

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
This commit is contained in:
Colin Walters 2012-01-13 10:09:10 -05:00
parent 366c39b642
commit f084b60377
5 changed files with 39 additions and 10 deletions

View 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

View 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

View 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 \

View 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

View 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=