1From 73e4da5ca780196d23db8029dcd28f87a0402711 Mon Sep 17 00:00:00 2001
2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3Date: Mon, 29 May 2017 23:03:48 +0300
4Subject: [PATCH] Add a --{enable,disable}-progs configure option
5
6Add a --{enable,disable}-progs configuration option to elfutils. This
7allows to selectively disable the compilation of the elfutils programs
8(in which case only the libraries are built and installed). This is
9useful because the programs are often not needed, and also because
10building the programs against uClibc causes several issues (lack of
11obstack_printf() in uClibc for example).
12
13Based on the former patch by Thomas Petazzoni.
14
15[Vincent: tweak patch for 0.166]
16[Bernd: rebased patch for 0.177]
17
18Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
19Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
20Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
21[Rebased on 0.183]
22Signed-off-by: Peter Seiderer <ps.report@gmx.net>
23[Fabrice: don't error out if obstack is not found]
24Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
25---
26 Makefile.am  | 6 +++++-
27 configure.ac | 6 ++++++
28 2 files changed, 11 insertions(+), 1 deletion(-)
29
30diff --git a/Makefile.am b/Makefile.am
31index 9c47afa..edf8dfc 100644
32--- a/Makefile.am
33+++ b/Makefile.am
34@@ -26,8 +26,12 @@ AM_MAKEFLAGS = --no-print-directory
35
36 pkginclude_HEADERS = version.h
37
38+if ENABLE_PROGS
39+PROGS_SUBDIR = src
40+endif
41+
42 SUBDIRS = config lib libelf libcpu backends libebl libdwelf libdwfl libdw \
43-	  libasm debuginfod src po doc tests
44+	  libasm debuginfod $(PROGS_SUBDIR) po doc tests
45
46 EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
47 	     COPYING COPYING-GPLV2 COPYING-LGPLV3
48diff --git a/configure.ac b/configure.ac
49index d345495..0dd4b1e 100644
50--- a/configure.ac
51+++ b/configure.ac
52@@ -393,6 +393,12 @@ AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
53 	       [tests_use_rpath=$enableval], [tests_use_rpath=no])
54 AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes)
55
56+AC_ARG_ENABLE([progs],
57+	AS_HELP_STRING([--enable-progs], [enable progs]),
58+	enable_progs=$enableval,
59+	enable_progs=yes)
60+AM_CONDITIONAL(ENABLE_PROGS, test "$enable_progs" = yes)
61+
62 dnl zlib is mandatory.
63 save_LIBS="$LIBS"
64 LIBS=
65@@ -579,7 +585,7 @@ saved_LIBS="$LIBS"
66 AC_SEARCH_LIBS([_obstack_free], [obstack])
67 LIBS="$saved_LIBS"
68 case "$ac_cv_search__obstack_free" in
69-        no) AC_MSG_FAILURE([failed to find _obstack_free]) ;;
70+        no) obstack_LIBS= ;;
71         -l*) obstack_LIBS="$ac_cv_search__obstack_free" ;;
72         *) obstack_LIBS= ;;
73 esac
74--
752.30.1
76
77