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@xxxxxxxxx> --- 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