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