summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorGaetan Nadon <memsize@videotron.ca>2011-03-17 19:26:36 -0400
committerKeith Packard <keithp@keithp.com>2011-03-18 11:36:19 -0700
commit6a5bf15fa99cf5b2358b3b3e2f29e5044aa8724a (patch)
tree2a2f5e1c54920863d279edf5a9295b1f0eebed63 /configure.ac
parentee583cb33423fa79beb22db20b30e10a677f9b5a (diff)
Add generalized unit test support using util-macros.
A handful of modules have begun adding unit test programs. These macros will help providing a consistent interface which will help package builders and developers to manage the functionality. XORG_ENABLE_UNIT_TESTS will turn on/off unit testing, regardless of how it is implemented. The default (yes/no) can be specified by each module. It can be used by itself if glib or -wrap support is not needed. XORG_WITH_GLIB will probe the system for glib-2.0. A different version can be specified in each module. It will consult XORG_ENABLE_UNIT_TESTS but can be used by itself in contexts other then unit testing. The default (yes/no) can be specified by each module. XORG_LD_WRAP will probe the linker for -wrap support. It will consult XORG_ENABLE_UNIT_TESTS but can be used by itself in contexts other then unit testing. configure options: --enable-unit-tests Enable building unit test cases (default: auto) --with-glib Use GLib library for unit testing (default: auto) Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac54
1 files changed, 5 insertions, 49 deletions
diff --git a/configure.ac b/configure.ac
index 345c1671f..b6811638d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,9 +32,9 @@ AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
-# Require xorg-macros minimum of 1.10 for XORG_CHECK_SGML_DOCTOOLS
+# Require xorg-macros minimum of 1.13 for XORG_ENABLE_UNIT_TESTS
m4_ifndef([XORG_MACROS_VERSION],
- [m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])])
+ [m4_fatal([must install xorg-macros 1.13 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.10)
XORG_DEFAULT_OPTIONS
XORG_WITH_DOXYGEN(1.6.1)
@@ -43,6 +43,9 @@ XORG_ENABLE_DOCS
XORG_ENABLE_DEVEL_DOCS
XORG_WITH_XMLTO(0.0.20)
XORG_WITH_FOP
+XORG_ENABLE_UNIT_TESTS
+XORG_WITH_GLIB
+XORG_LD_WRAP
m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or later before running autoconf/autogen])])
XORG_FONT_MACROS_VERSION(1.1)
@@ -458,9 +461,6 @@ AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror],
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
[Enable debugging (default: disabled)]),
[DEBUGGING=$enableval], [DEBUGGING=no])
-AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
- [Enable unit-tests (default: auto)]),
- [UNITTESTS=$enableval], [UNITTESTS=auto])
AC_ARG_ENABLE(use-sigio-by-default, AS_HELP_STRING([--enable-use-sigio-by-default]
[Enable SIGIO input handlers by default (default: $USE_SIGIO_BY_DEFAULT)]),
[USE_SIGIO_BY_DEFAULT=$enableval], [])
@@ -1270,50 +1270,6 @@ if test "x$DEBUGGING" = xyes; then
fi
AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
-# If unittests aren't explicitly disabled, check for required support
-if test "x$UNITTESTS" != xno ; then
- PKG_CHECK_MODULES([GLIB], $LIBGLIB,
- [HAVE_GLIB=yes], [HAVE_GLIB=no])
-
- # Check if linker supports -wrap, passed via compiler flags
- # When cross-compiling, reports no, since unit tests run from
- # "make check", so would be running on build machine, not target
- AC_MSG_CHECKING([whether the linker supports -wrap])
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -Wl,-wrap,exit"
- AC_RUN_IFELSE([AC_LANG_PROGRAM([[
- void __wrap_exit (int s)
- {
- __real_exit (0);
- }]],
- [[exit (1);]])],
- [linker_can_wrap="yes"],
- [linker_can_wrap="no"],
- [linker_can_wrap="no"])
- AC_MSG_RESULT([$linker_can_wrap])
- LDFLAGS="$save_LDFLAGS"
-fi
-
-if test "x$UNITTESTS" = xauto; then
- if test "x$HAVE_GLIB" = xyes && test "x$linker_can_wrap" = xyes; then
- UNITTESTS=yes
- else
- UNITTESTS=no
- fi
-fi
-if test "x$UNITTESTS" = xyes; then
- if test "x$HAVE_GLIB" = xno; then
- AC_MSG_ERROR([glib required to build unit tests])
- fi
- if test "x$linker_can_wrap" = xno; then
- AC_MSG_ERROR([ld -wrap support required to build unit tests])
- fi
- AC_DEFINE(UNITTESTS, 1, [Enable unit tests])
- AC_SUBST([GLIB_LIBS])
- AC_SUBST([GLIB_CFLAGS])
-fi
-AM_CONDITIONAL(UNITTESTS, [test "x$UNITTESTS" = xyes])
-
AC_DEFINE(XTEST, 1, [Support XTest extension])
AC_DEFINE(XSYNC, 1, [Support XSync extension])
AC_DEFINE(XCMISC, 1, [Support XCMisc extension])