[pulseaudio-commits] configure.ac src/Makefile.am

Tanu Kaskinen tanuk at kemper.freedesktop.org
Thu Oct 4 06:49:16 PDT 2012


 configure.ac    |   17 +++++++++++++++--
 src/Makefile.am |   14 ++++++++++++++
 2 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 67602d8743e8e529919bb9fbb956aa77724a8e50
Author: Deng Zhengrong <dzrongg at gmail.com>
Date:   Mon Aug 13 15:34:05 2012 +0800

    tests: make 'check' optional

diff --git a/configure.ac b/configure.ac
index 19f6089..546fcb0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -583,12 +583,23 @@ fi
 
 AC_CHECK_HEADERS_ONCE([valgrind/memcheck.h])
 
-#### check test framework ####
+#### check unit tests ####
+
+AC_ARG_ENABLE([tests],
+    AS_HELP_STRING([--disable-tests],[Disable unit tests]))
+
+AS_IF([test "x$enable_tests" != "xno"],
+    [PKG_CHECK_MODULES(LIBCHECK, [ check ], HAVE_LIBCHECK=1, HAVE_LIBCHECK=0)],
+    HAVE_LIBCHECK=0)
 
-PKG_CHECK_MODULES(LIBCHECK, [ check ])
 AC_SUBST(LIBCHECK_CFLAGS)
 AC_SUBST(LIBCHECK_LIBS)
 
+AS_IF([test "x$enable_tests" = "xyes" && test "x$HAVE_LIBCHECK" = "x0"],
+    [AC_MSG_ERROR([*** check library not found])])
+
+AM_CONDITIONAL([HAVE_TESTS], [test "x$HAVE_LIBCHECK" = x1])
+
 #### json parsing ####
 
 PKG_CHECK_MODULES(LIBJSON, [ json >= 0.9 ])
@@ -1400,6 +1411,7 @@ AS_IF([test "x$HAVE_SIMPLEDB" = "x1"], ENABLE_SIMPLEDB=yes, ENABLE_SIMPLEDB=no)
 AS_IF([test "x$HAVE_ESOUND" = "x1"], ENABLE_ESOUND=yes, ENABLE_ESOUND=no)
 AS_IF([test "x$HAVE_ESOUND" = "x1" -a "x$USE_PER_USER_ESOUND_SOCKET" = "x1"], ENABLE_PER_USER_ESOUND_SOCKET=yes, ENABLE_PER_USER_ESOUND_SOCKET=no)
 AS_IF([test "x$HAVE_GCOV" = "x1"], ENABLE_GCOV=yes, ENABLE_GCOV=no)
+AS_IF([test "x$HAVE_LIBCHECK" = "x1"], ENABLE_TESTS=yes, ENABLE_TESTS=no)
 AS_IF([test "x$enable_legacy_database_entry_format" != "xno"], ENABLE_LEGACY_DATABASE_ENTRY_FORMAT=yes, ENABLE_LEGACY_DATABASE_ENTRY_FORMAT=no)
 
 echo "
@@ -1447,6 +1459,7 @@ echo "
     Enable speex (resampler, AEC): ${ENABLE_SPEEX}
     Enable WebRTC echo canceller:  ${ENABLE_WEBRTC}
     Enable gcov coverage:          ${ENABLE_GCOV}
+    Enable unit tests:             ${ENABLE_TESTS}
     Database
       tdb:                         ${ENABLE_TDB}
       gdbm:                        ${ENABLE_GDBM}
diff --git a/src/Makefile.am b/src/Makefile.am
index 5690766..6212c74 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -297,6 +297,7 @@ TESTS_norun += \
 		alsa-time-test
 endif
 
+if HAVE_TESTS
 TESTS_ENVIRONMENT=MAKE_CHECK=1
 TESTS = $(TESTS_default)
 
@@ -309,6 +310,19 @@ endif
 check-daemon: $(TESTS_daemon)
 	PATH=$(builddir):${PATH} $(top_srcdir)/src/tests/test-daemon.sh $(TESTS_daemon)
 
+else
+TESTS_ENVIRONMENT=
+TESTS =
+noinst_PROGRAMS =
+check_PROGRAMS =
+
+check-daemon:
+	@echo "Tests are disabled!"
+	@echo "Pass option \"--enable-tests\" to configure and install \"check\" library properly!"
+	false
+
+endif
+
 mainloop_test_SOURCES = tests/mainloop-test.c
 mainloop_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
 mainloop_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon- at PA_MAJORMINOR@.la



More information about the pulseaudio-commits mailing list