0002-Add-option-to-disable-unit-tests.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From 19db6244200b870317382294f14b7d561d55a64e Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Sat, 29 Aug 2015 12:05:53 +0200
  4. Subject: [PATCH] Add option to disable unit tests
  5. The unittests require C++, while the rest of the library does not, so
  6. this commit implements a --{enable,disable}-unittests option to
  7. selectively enable the build of the unit tests. When not provided, the
  8. option defaults to yes so that the existing behavior is preserved.
  9. Based on initial work by Bernd Kuhls.
  10. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  11. ---
  12. Makefile.am | 6 +++++-
  13. configure.ac | 5 +++++
  14. 2 files changed, 10 insertions(+), 1 deletion(-)
  15. diff --git a/Makefile.am b/Makefile.am
  16. index bd3ce01..1da250b 100644
  17. --- a/Makefile.am
  18. +++ b/Makefile.am
  19. @@ -95,4 +95,8 @@ src/codebook/lsp8.txt \
  20. src/codebook/lsp9.txt \
  21. src/codebook/lsp10.txt
  22. -SUBDIRS = src unittest
  23. +SUBDIRS = src
  24. +
  25. +if UNITTESTS
  26. +SUBDIRS += unittest
  27. +endif
  28. diff --git a/configure.ac b/configure.ac
  29. index 7520af6..55b7215 100644
  30. --- a/configure.ac
  31. +++ b/configure.ac
  32. @@ -24,5 +24,10 @@ AC_CHECK_HEADERS([stdlib.h string.h])
  33. AC_FUNC_MALLOC
  34. AC_CHECK_FUNCS([floor pow sqrt])
  35. +AC_ARG_ENABLE([unittests],
  36. + AS_HELP_STRING([--disable-unittests], [Disable unittests]),
  37. + [], [enable_unittests=yes])
  38. +AM_CONDITIONAL([UNITTESTS], [test "${enable_unittests}" = "yes"])
  39. +
  40. AC_CONFIG_FILES([Makefile src/Makefile unittest/Makefile codec2.pc])
  41. AC_OUTPUT
  42. --
  43. 2.5.0