[PATCH 1/1] build: extend configure option --enable-cli and install all cli programs

Thomas Haller thaller at redhat.com
Wed Mar 18 07:20:28 PDT 2015


Previously, some cli programs were installed to sbin/
and most were not installed at all.

Now, by default install all of them to bin/ directory.
But extend the configure option to allow specifying
'no-inst', 'bin', or 'sbin'.

Signed-off-by: Thomas Haller <thaller at redhat.com>
---
I wonder why some programs were not installed previously, but some were.
Also, it seems to me that bin/ directory is better suited then sbin/.

Not sure about this, as it changes behavior of installing more cli tools
and installing them to a different place (bin instead of sbin).
But it seems right to me.

What do you think?
Thomas


 configure.ac    | 12 ++++++++++--
 src/Makefile.am | 38 +++++++++++++++++++++++---------------
 2 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/configure.ac b/configure.ac
index 02453c3..3199956 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,9 +91,17 @@ AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
 AC_SUBST([pkgconfigdir])
 
 AC_ARG_ENABLE([cli],
-	AS_HELP_STRING([--disable-cli], [Do not build command line interface utils]),
+	AS_HELP_STRING([--enable-cli=yes|no|no-inst|bin|sbin], [Whether to build command line interface utils. Defaults to 'yes' which is a synonym for 'bin'. 'no-inst' means only build, not installing. 'bin'/'sbin' means installing to bin/sbin directory]),
 	[enable_cli="$enableval"], [enable_cli="yes"])
-AM_CONDITIONAL([ENABLE_CLI], [test "$enable_cli" = "yes"])
+if test "$enable_cli" != "no" &&
+   test "$enable_cli" != "no-inst" &&
+   test "$enable_cli" != "bin" &&
+   test "$enable_cli" != "sbin"; then
+	enable_cli="bin"
+fi
+AM_CONDITIONAL([ENABLE_CLI], [test "$enable_cli" != "no"])
+AM_CONDITIONAL([ENABLE_CLI_INSTALL_BIN], [test "$enable_cli" = "bin"])
+AM_CONDITIONAL([ENABLE_CLI_INSTALL_SBIN], [test "$enable_cli" = "sbin"])
 
 AC_ARG_ENABLE([pthreads],
 	AS_HELP_STRING([--disable-pthreads], [Disable pthreads support]),
diff --git a/src/Makefile.am b/src/Makefile.am
index aee1c48..a77b328 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,22 +19,8 @@ LDADD = \
 	${top_builddir}/lib/libnl-route-3.la \
 	${top_builddir}/lib/libnl-idiag-3.la
 
-sbin_PROGRAMS = \
+cli_programs = \
 	genl-ctrl-list \
-	nl-class-add \
-	nl-class-delete \
-	nl-classid-lookup \
-	nl-class-list \
-	nl-cls-add \
-	nl-cls-delete \
-	nl-cls-list \
-	nl-link-list \
-	nl-pktloc-lookup \
-	nl-qdisc-add \
-	nl-qdisc-delete \
-	nl-qdisc-list
-
-noinst_PROGRAMS = \
 	idiag-socket-details \
 	nf-ct-add \
 	nf-ct-list \
@@ -47,9 +33,17 @@ noinst_PROGRAMS = \
 	nl-addr-add \
 	nl-addr-delete \
 	nl-addr-list \
+	nl-class-add \
+	nl-class-delete \
+	nl-classid-lookup \
+	nl-class-list \
+	nl-cls-add \
+	nl-cls-delete \
+	nl-cls-list \
 	nl-fib-lookup \
 	nl-link-enslave \
 	nl-link-ifindex2name \
+	nl-link-list \
 	nl-link-name2ifindex \
 	nl-link-release \
 	nl-link-set \
@@ -61,6 +55,10 @@ noinst_PROGRAMS = \
 	nl-neigh-delete \
 	nl-neigh-list \
 	nl-neightbl-list \
+	nl-pktloc-lookup \
+	nl-qdisc-add \
+	nl-qdisc-delete \
+	nl-qdisc-list \
 	nl-route-add \
 	nl-route-delete \
 	nl-route-get \
@@ -69,6 +67,16 @@ noinst_PROGRAMS = \
 	nl-tctree-list \
 	nl-util-addr
 
+if ENABLE_CLI_INSTALL_BIN
+bin_PROGRAMS = $(cli_programs)
+else
+if ENABLE_CLI_INSTALL_SBIN
+sbin_PROGRAMS = $(cli_programs)
+else
+noinst_PROGRAMS = $(cli_programs)
+endif
+endif
+
 genl_ctrl_list_SOURCES = genl-ctrl-list.c 
 
 nf_ct_list_SOURCES = nf-ct-list.c 
-- 
1.9.3




More information about the libnl mailing list