Newer
Older
Handbook / configuration / include / ac_check_junit.m4
  1. dnl @synopsis AC_CHECK_JUNIT
  2. dnl
  3. dnl AC_CHECK_JUNIT tests the availability of the Junit testing
  4. dnl framework, and set some variables for conditional compilation of
  5. dnl the test suite by automake.
  6. dnl
  7. dnl If available, JUNIT is set to a command launching the text based
  8. dnl user interface of Junit, @JAVA_JUNIT@ is set to $JAVA_JUNIT and
  9. dnl @TESTS_JUNIT@ is set to $TESTS_JUNIT, otherwise they are set to
  10. dnl empty values.
  11. dnl
  12. dnl You can use these variables in your Makefile.am file like this :
  13. dnl
  14. dnl # Some of the following classes are built only if junit is available
  15. dnl JAVA_JUNIT = Class1Test.java Class2Test.java AllJunitTests.java
  16. dnl
  17. dnl noinst_JAVA = Example1.java Example2.java @JAVA_JUNIT@
  18. dnl
  19. dnl EXTRA_JAVA = $(JAVA_JUNIT)
  20. dnl
  21. dnl TESTS_JUNIT = AllJunitTests
  22. dnl
  23. dnl TESTS = StandaloneTest1 StandaloneTest2 @TESTS_JUNIT@
  24. dnl
  25. dnl EXTRA_TESTS = $(TESTS_JUNIT)
  26. dnl
  27. dnl AllJunitTests :
  28. dnl echo "#! /bin/sh" > $@
  29. dnl echo "exec @JUNIT@ my.package.name.AllJunitTests" >> $@
  30. dnl chmod +x $@
  31. dnl
  32. dnl @category Java
  33. dnl @author Luc Maisonobe <luc@spaceroots.org>
  34. dnl @version 2001-03-02
  35. dnl @license AllPermissive
  36.  
  37. AC_DEFUN([AC_CHECK_JUNIT],[
  38. AC_CACHE_VAL(ac_cv_prog_JUNIT,[
  39. AC_CHECK_CLASS(junit.textui.TestRunner)
  40. if test x"`eval 'echo $ac_cv_class_junit_textui_TestRunner'`" != xno ; then
  41. ac_cv_prog_JUNIT='$(CLASSPATH_ENV) $(JAVA) $(JAVAFLAGS) junit.textui.TestRunner'
  42. fi])
  43. AC_MSG_CHECKING([for junit])
  44. if test x"`eval 'echo $ac_cv_prog_JUNIT'`" != x ; then
  45. JUNIT="$ac_cv_prog_JUNIT"
  46. JAVA_JUNIT='$(JAVA_JUNIT)'
  47. TESTS_JUNIT='$(TESTS_JUNIT)'
  48. else
  49. JUNIT=
  50. JAVA_JUNIT=
  51. TESTS_JUNIT=
  52. fi
  53. AC_MSG_RESULT($JAVA_JUNIT)
  54. AC_SUBST(JUNIT)
  55. AC_SUBST(JAVA_JUNIT)
  56. AC_SUBST(TESTS_JUNIT)])