0001-autotools-make-example-build-optional.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From 874d9605aa9cd028aed149c2dd1bb410856477fb Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Sun, 21 Jun 2020 23:28:37 +0200
  4. Subject: [PATCH] autotools: make example build optional
  5. This patch makes example build optional for autotools build system.
  6. In order to keep the former behavior, example build is enabled by default.
  7. Signed-off-by: Samuel Martin <s.martin49@gmail.com>
  8. [Retrieved (and slightly updated to remove CMakeLists.txt) from:
  9. https://git.buildroot.net/buildroot/tree/package/libnfc/0001-build-systems-make-example-build-optional.patch]
  10. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  11. [Retrieved from:
  12. https://github.com/nfc-tools/libnfc/commit/874d9605aa9cd028aed149c2dd1bb410856477fb]
  13. ---
  14. Makefile.am | 8 +++++++-
  15. configure.ac | 11 +++++++++++
  16. 2 files changed, 18 insertions(+), 1 deletion(-)
  17. diff --git a/Makefile.am b/Makefile.am
  18. index d2f6fc8e..516ebee2 100644
  19. --- a/Makefile.am
  20. +++ b/Makefile.am
  21. @@ -2,7 +2,13 @@ ACLOCAL_AMFLAGS = -I m4
  22. AM_CFLAGS = $(LIBNFC_CFLAGS)
  23. -SUBDIRS = libnfc utils examples include contrib cmake test
  24. +SUBDIRS = libnfc utils
  25. +
  26. +if EXAMPLE_ENABLED
  27. +SUBDIRS += examples
  28. +endif
  29. +
  30. +SUBDIRS += include contrib cmake test
  31. pkgconfigdir = $(libdir)/pkgconfig
  32. pkgconfig_DATA = libnfc.pc
  33. diff --git a/configure.ac b/configure.ac
  34. index 280a6d08..46b65d33 100644
  35. --- a/configure.ac
  36. +++ b/configure.ac
  37. @@ -157,6 +157,14 @@ then
  38. fi
  39. AM_CONDITIONAL(DOC_ENABLED, [test x"$enable_doc" = xyes])
  40. +# Example build (default: yes)
  41. +AC_ARG_ENABLE([example],AS_HELP_STRING([--enable-example],[Enable example build.]),[enable_example=$enableval],[enable_example="yes"])
  42. +
  43. +AC_MSG_CHECKING(for example build)
  44. +AC_MSG_RESULT($enable_example)
  45. +
  46. +AM_CONDITIONAL(EXAMPLE_ENABLED, [test x"$enable_example" = xyes])
  47. +
  48. # Dependencies
  49. PKG_CONFIG_REQUIRES=""
  50. @@ -175,7 +183,10 @@ if test x$ac_cv_with_cutter = xyes -a x$ac_cv_use_cutter = xno; then
  51. fi
  52. AM_CONDITIONAL([WITH_CUTTER], [test "$ac_cv_use_cutter" != "no"])
  53. +if test x"$enable_example" = "xyes"
  54. +then
  55. AC_CHECK_READLINE
  56. +fi
  57. # Help us to write great code ;-)
  58. CFLAGS="$CFLAGS -Wall -pedantic -Wextra"