From be854357189b6a3bd7e846b4e7914877f0deaf9f Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Sat, 25 Jan 2020 21:28:52 +0000
Subject: [PATCH] make executables optional

---
 Makefile.am  | 6 +++++-
 configure.ac | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index bd8926b..1733937 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,7 +29,11 @@
 pkginclude_HEADERS = version.h
 
 SUBDIRS = config lib libelf libcpu backends libebl libdwelf libdwfl \
-	  libdwfl_stacktrace libdw libasm debuginfod src po doc tests
+	  libdwfl_stacktrace libdw libasm debuginfod po doc tests
+
+if BUILD_PROGRAMS
+  SUBDIRS += src
+endif
 
 EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING SECURITY \
 	     COPYING COPYING-GPLV2 COPYING-LGPLV3 CONDUCT
diff --git a/configure.ac b/configure.ac
index 5a2dc37..a1e856a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,6 +82,11 @@
 
 AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
 
+AC_ARG_ENABLE([programs],
+AS_HELP_STRING([--enable-programs], [Build and install programs when enabled (default: disabled)]),
+               [build_programs=$enableval], [build_programs=no])
+AM_CONDITIONAL(BUILD_PROGRAMS, test "$build_programs" = yes)
+
 # Provided by gnulib's m4/std-gnu11.m4 for autoconf pre 2.70
 AC_PROG_CC
 AS_IF([test "x$ac_cv_prog_cc_c11" = "xno"],
-- 
2.7.4

