[PATCH] Add a --{enable,disable}-progs configure option

2020-10-01 Thread Fabrice Fontaine via Elfutils-devel
From: Thomas Petazzoni 

Add a --{enable,disable}-progs configuration option to elfutils. This
allows to selectively disable the compilation of the elfutils programs
(in which case only the libraries are built and installed). This is
useful because the programs are often not needed, and also because
building the programs against uClibc causes several issues (lack of
obstack_printf() in uClibc for example).

Based on the former patch by Thomas Petazzoni.

[Vincent: tweak patch for 0.166]
[Bernd: rebased patch for 0.177]

Signed-off-by: Thomas Petazzoni 
Signed-off-by: Vicente Olivert Riera 
Signed-off-by: Bernd Kuhls 
---
 Makefile.am  | 6 +-
 configure.ac | 6 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 2ff444e7bf1d..70443abb4fb6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,8 +26,12 @@ AM_MAKEFLAGS = --no-print-directory

 pkginclude_HEADERS = version.h

+if ENABLE_PROGS
+PROGS_SUBDIR = src
+endif
+
 SUBDIRS = config m4 lib libelf libcpu backends libebl libdwelf libdwfl libdw \
- libasm debuginfod src po doc tests
+ libasm debuginfod $(PROGS_SUBDIR) po doc tests

 EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
 COPYING COPYING-GPLV2 COPYING-LGPLV3
diff --git a/configure.ac b/configure.ac
index c2c1d90b2133..7b4c38381cca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -390,6 +390,12 @@
   [tests_use_rpath=$enableval], [tests_use_rpath=no])
 AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes)

+AC_ARG_ENABLE([progs],
+   AS_HELP_STRING([--enable-progs], [enable progs]),
+   enable_progs=$enableval,
+   enable_progs=yes)
+AM_CONDITIONAL(ENABLE_PROGS, test "$enable_progs" = yes)
+
 dnl zlib is mandatory.
 save_LIBS="$LIBS"
 LIBS=
--
2.11.0



Re: [PATCH] Add a --{enable,disable}-progs configure option

2020-10-03 Thread Fabrice Fontaine via Elfutils-devel
Hi Mark,
Le sam. 3 oct. 2020 à 00:03, Mark Wielaard  a écrit :
>
> Hi,
>
> On Thu, Oct 01, 2020 at 08:34:47PM +0200, Fabrice Fontaine via Elfutils-devel 
> wrote:
> > From: Thomas Petazzoni 
> >
> > Add a --{enable,disable}-progs configuration option to elfutils. This
> > allows to selectively disable the compilation of the elfutils programs
> > (in which case only the libraries are built and installed). This is
> > useful because the programs are often not needed, and also because
> > building the programs against uClibc causes several issues (lack of
> > obstack_printf() in uClibc for example).
>
> I understand why you might want this and it seems to do as described.
> But I am slightly reluctant to apply this because it totally breaks
> make check. How do you check the build is really correct? Would it be
> possible to use a small subset of the testsuite with --disable-progs?
In the context of buildroot, we're not running make check as we're
"only" interested in cross-compiling a minimal Linux system for
embedded targets.
It should be noted that this patch is keeping the current behavior
unchanged (i.e. enable_progs is set to yes by default).
>
> Thanks,
>
> Mark
Best Regards,

Fabrice