build: add a configure option for tools
authorBartosz Golaszewski <bartekgola@gmail.com>
Fri, 13 Jan 2017 16:41:53 +0000 (17:41 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Fri, 13 Jan 2017 16:41:53 +0000 (17:41 +0100)
This allows to build the tools conditionally, depending
on the configuration.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Makefile.am
configure.ac

index e509eb9d5a6276c5d84a216eae9801dd86495843..e2503695b0628c8f2f85e50943a40181a8b7c621 100644 (file)
@@ -20,6 +20,8 @@ libgpiod_la_SOURCES = core.c
 libgpiod_la_CFLAGS = -g
 libgpiod_la_LDFLAGS = -version-number $(VERSION_MAJOR):$(VERSION_MINOR):$(VERSION_RELEASE)
 
+if WITH_TOOLS
+
 bin_PROGRAMS = gpiodetect gpioinfo gpioget gpioset gpiomon gpiofind
 
 gpiodetect_SOURCES = gpiodetect.c tools-common.c
@@ -46,6 +48,8 @@ gpiofind_SOURCES = gpiofind.c tools-common.c
 gpiofind_LDFLAGS = -lgpiod
 gpiofind_DEPENDENCIES = libgpiod.la
 
+endif
+
 doc:
        doxygen
 .PHONY: doc
index 95b99ce737fd6385df8b6ca8b36de19a5f2c8efa..9f8b7aaae1e36d7dd522eba77b5a07dd0442ceea 100644 (file)
@@ -20,6 +20,20 @@ AC_SUBST(VERSION_RELEASE, 0)
 
 AC_CONFIG_HEADER([config.h])
 
+AC_ARG_ENABLE([tools],
+       [AC_HELP_STRING([--enable-tools],
+               [enable libgpiod command-line tools [default=no]])],
+       [
+               if test "x$enableval" = xyes
+               then
+                       with_tools=true
+               else
+                       with_tools=false
+               fi
+       ],
+       [with_tools = false])
+AM_CONDITIONAL([WITH_TOOLS], [test x$with_tools = xtrue])
+
 AC_PROG_CC
 AC_PROG_LIBTOOL
 AC_PROG_INSTALL