[banshee] build: enable tests by default if nunit dep is found (bgo#690010)



commit 1d4860272c2d174cdea78829d308dcdd82b3bb46
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Wed Jan 8 23:16:17 2014 +0100

    build: enable tests by default if nunit dep is found (bgo#690010)
    
    Instead of disabling tests by default (which is not a good habit
    towards newcomers), or the too optimistic approach of enabling
    them by default, there can be something in between: enable them
    by default if the NUnit dependency is found (allowing the flag
    --disable-tests too), and disable them by default if they are
    not found (allowing --enable-tests flag, which would fail by
    informing the user about what is the dependency and version
    required).

 build/m4/shamrock/nunit.m4 |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/build/m4/shamrock/nunit.m4 b/build/m4/shamrock/nunit.m4
index 3cd1ef1..6aeaad9 100644
--- a/build/m4/shamrock/nunit.m4
+++ b/build/m4/shamrock/nunit.m4
@@ -2,21 +2,26 @@ AC_DEFUN([SHAMROCK_CHECK_NUNIT],
 [
        NUNIT_REQUIRED=2.5
 
-       AC_ARG_ENABLE(tests, AC_HELP_STRING([--enable-tests], [Enable NUnit tests]),
-               enable_tests=$enableval, enable_tests="no")
+       do_tests=no
+       PKG_CHECK_MODULES(NUNIT, nunit >= $NUNIT_REQUIRED,
+               have_nunit="yes", have_nunit="no")
 
-       if test "x$enable_tests" = "xno"; then
-               do_tests=no
-               AM_CONDITIONAL(ENABLE_TESTS, false)
-       else
-               PKG_CHECK_MODULES(NUNIT, nunit >= $NUNIT_REQUIRED,
-                       do_tests="yes", do_tests="no")
+       if test "x$have_nunit" = "xyes"; then
+               AC_ARG_ENABLE(tests,
+                       AS_HELP_STRING([--disable-tests], [Disable NUnit tests]))
 
-               AC_SUBST(NUNIT_LIBS)
-               AM_CONDITIONAL(ENABLE_TESTS, test "x$do_tests" = "xyes")
+               AS_IF([test "x$enable_tests" != "xno"], [
+                       do_tests=yes
+                       AC_SUBST(NUNIT_LIBS)
+               ])
+       else
+               AC_ARG_ENABLE(tests,
+                       AS_HELP_STRING([--enable-tests], [Enable NUnit tests]))
 
-               if test "x$do_tests" = "xno"; then
+               AS_IF([test "x$enable_tests" = "xyes"], [
                        AC_MSG_ERROR([nunit was not found or is not up to date. Please install nunit 
$NUNIT_REQUIRED or higher.])
-               fi
+               ])
+
        fi
+       AM_CONDITIONAL(ENABLE_TESTS, test "x$do_tests" = "xyes")
 ])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]