All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Binacchi <dariobin@libero.it>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, Dario Binacchi <dariobin@libero.it>
Subject: [PATCH 1/1] configure: add an option to compile the examples
Date: Mon, 25 Apr 2022 18:05:13 +0200	[thread overview]
Message-ID: <20220425160513.5343-1-dariobin@libero.it> (raw)

Using a configure option to compile the examples is a more common
practice. This can also increase library usage (e.g. buildroot would
now be able to install such applications on the created rootfs).

Signed-off-by: Dario Binacchi <dariobin@libero.it>
---
 Makefile.am               | 7 ++++++-
 README                    | 2 +-
 configure.ac              | 8 +++++++-
 examples/rtnl/Makefile.am | 2 +-
 4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 94e6935..7f8ae56 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,9 +2,14 @@ include $(top_srcdir)/Make_global.am
 
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = src include examples doxygen
+SUBDIRS = src include doxygen
 DIST_SUBDIRS = src include examples doxygen
 
+if ENABLE_EXAMPLES
+SUBDIRS += examples
+DIST_SUBDIRS += examples
+endif
+
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libmnl.pc
 
diff --git a/README b/README
index fbac9d2..b5f917e 100644
--- a/README
+++ b/README
@@ -21,7 +21,7 @@ forced to use them.
 = Example files =
 
 You can find several example files under examples/ that you can compile by
-invoking `make check'.
+invoking `./configure --enable-examples && make'.
 
 --
 08/sep/2010
diff --git a/configure.ac b/configure.ac
index 314481d..8c88c9b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,6 +21,11 @@ case "$host" in
 *) AC_MSG_ERROR([Linux only, dude!]);;
 esac
 
+AC_ARG_ENABLE([examples],
+	AS_HELP_STRING([--enable-examples], [Build examples]),
+	[enable_examples="$enableval"], [enable_examples="no"])
+AM_CONDITIONAL([ENABLE_EXAMPLES], [test "$enable_examples" = "yes"])
+
 regular_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_REENTRANT"
 regular_CFLAGS="-Wall -Waggregate-return -Wmissing-declarations \
 	-Wmissing-prototypes -Wshadow -Wstrict-prototypes \
@@ -53,4 +58,5 @@ AC_OUTPUT
 
 echo "
 libmnl configuration:
-  doxygen:          ${with_doxygen}"
+  doxygen:          ${with_doxygen}
+  examples:         ${enable_examples}"
diff --git a/examples/rtnl/Makefile.am b/examples/rtnl/Makefile.am
index dd8a77d..017468f 100644
--- a/examples/rtnl/Makefile.am
+++ b/examples/rtnl/Makefile.am
@@ -1,6 +1,6 @@
 include $(top_srcdir)/Make_global.am
 
-check_PROGRAMS = rtnl-addr-add \
+bin_PROGRAMS = rtnl-addr-add \
 		 rtnl-addr-dump \
 		 rtnl-link-dump rtnl-link-dump2 rtnl-link-dump3 \
 		 rtnl-link-event \
-- 
2.17.1


             reply	other threads:[~2022-04-25 16:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25 16:05 Dario Binacchi [this message]
2022-04-26 12:58 ` [PATCH 1/1] configure: add an option to compile the examples Pablo Neira Ayuso
2022-04-26 13:08   ` Dario Binacchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220425160513.5343-1-dariobin@libero.it \
    --to=dariobin@libero.it \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.