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} 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 DIST_SUBDIRS = $(SUBDIRS) build
if BUILD_MODULAR_TESTS
SUBDIRS += tests
else
DIST_SUBDIRS += tests
endif
bin_SCRIPTS = glib-gettextize bin_SCRIPTS = glib-gettextize

View File

@ -247,6 +247,11 @@ AC_ARG_ENABLE(rebuilds,
[AC_HELP_STRING([--disable-rebuilds], [AC_HELP_STRING([--disable-rebuilds],
[disable all source autogeneration rules])],, [disable all source autogeneration rules])],,
[enable_rebuilds=yes]) [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]) AC_MSG_CHECKING([whether to enable garbage collector friendliness])
if test "x$enable_gc_friendly" = "xyes"; then 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 # Check for libdbus1 - Optional - is only used in the GDBus test cases
# #
# 1.2.14 required for dbus_message_set_serial # 1.2.14 required for dbus_message_set_serial
PKG_CHECK_MODULES(DBUS1, if test x$enable_modular_tests = xyes; then
PKG_CHECK_MODULES(DBUS1,
dbus-1 >= 1.2.14, dbus-1 >= 1.2.14,
[AC_DEFINE(HAVE_DBUS1, 1, [Define if dbus-1 is available]) have_dbus1=yes], [AC_DEFINE(HAVE_DBUS1, 1, [Define if dbus-1 is available]) have_dbus1=yes],
have_dbus1=no) have_dbus1=no)
AC_SUBST(DBUS1_CFLAGS) AC_SUBST(DBUS1_CFLAGS)
AC_SUBST(DBUS1_LIBS) AC_SUBST(DBUS1_LIBS)
fi
AM_CONDITIONAL(HAVE_DBUS1, [test "x$have_dbus1" = "xyes"]) AM_CONDITIONAL(HAVE_DBUS1, [test "x$have_dbus1" = "xyes"])
dnl dnl

View File

@ -2,6 +2,7 @@ include $(top_srcdir)/Makefile.decl
NULL = NULL =
DIST_SUBDIRS =
SUBDIRS = gdbus-2.0/codegen SUBDIRS = gdbus-2.0/codegen
if OS_UNIX if OS_UNIX
@ -302,7 +303,11 @@ giowin32include_HEADERS = \
endif endif
if BUILD_MODULAR_TESTS
SUBDIRS += tests SUBDIRS += tests
else
DIST_SUBDIRS += tests
endif
libgio_2_0_la_SOURCES = \ libgio_2_0_la_SOURCES = \
gappinfo.c \ gappinfo.c \

View File

@ -35,7 +35,13 @@ else
MAYBE_PCRE = pcre MAYBE_PCRE = pcre
endif 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 DIST_SUBDIRS = libcharset gnulib pcre update-pcre tests

View File

@ -4,7 +4,13 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
include $(top_srcdir)/Makefile.decl include $(top_srcdir)/Makefile.decl
SUBDIRS = . tests SUBDIRS = .
DIST_SUBDIRS =
if BUILD_MODULAR_TESTS
SUBDIRS += tests
else
DIST_SUBDIRS += tests
endif
BUILT_SOURCES= BUILT_SOURCES=
CLEANFILES= CLEANFILES=