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