public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] configure: Add new --enable-install-elfh option.
@ 2019-01-18 13:25 Mark Wielaard
  2019-01-18 14:03 ` Ulf Hermann
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Wielaard @ 2019-01-18 13:25 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark W. Krentel, Mark Wielaard

We explicitly test (with system-elf-libelf) that our include headers
work with the system elf.h header. But it might be helpful to install
the elf.h file for a private install. Our elf.h header really is just
a copy of the latest glibc elf.h. But it might be newer and include
more constants than the system installed elf.h.

Add a new configure option --enable-install-elfh to install elf.h.
But warn when it is enabled for the default /usr or /usr/local prefix
because it might clash with the glibc/system elf.h header in that case.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 ChangeLog          |  4 ++++
 configure.ac       | 12 ++++++++++++
 libelf/ChangeLog   |  5 +++++
 libelf/Makefile.am | 13 ++++++++++---
 4 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 45418a0..148ce77 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2019-01-18  Mark Wielaard  <mark@klomp.org>
+
+	* configure.ac: Add new --enable-install-elfh.
+
 2018-07-04  Ross Burton <ross.burton@intel.com>
 
 	* configure.ac: Check for gawk.
diff --git a/configure.ac b/configure.ac
index b89b867..7d4e69d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -323,6 +323,11 @@ if test "$use_valgrind" = yes; then
 fi
 AM_CONDITIONAL(USE_VALGRIND, test "$use_valgrind" = yes)
 
+AC_ARG_ENABLE([install-elfh],
+AS_HELP_STRING([--enable-install-elfh],[install elf.h in include dir]),
+               [install_elfh=$enableval], [install_elfh=no])
+AM_CONDITIONAL(INSTALL_ELFH, test "$install_elfh" = yes)
+
 AM_CONDITIONAL(BUILD_STATIC, [dnl
 test "$use_gprof" = yes -o "$use_gcov" = yes])
 
@@ -658,6 +663,7 @@ AC_MSG_NOTICE([
 
   NOT RECOMMENDED FEATURES (should all be no)
     Experimental thread safety         : ${use_locks}
+    install elf.h                      : ${install_elfh}
 
   OTHER FEATURES
     Deterministic archives by default  : ${default_ar_deterministic}
@@ -673,3 +679,9 @@ AC_MSG_NOTICE([
     use rpath in tests                 : ${tests_use_rpath}
     test biarch                        : ${utrace_cv_cc_biarch}
 ])
+
+if test "$install_elfh" = yes; then
+  if test "${prefix}" = "/usr/local" -o "${prefix}" = "/usr"; then
+    AC_MSG_WARN([installing elf.h in ${includedir} might conflict with glibc/system elf.h])
+  fi
+fi
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 5783f0c..b89e93f 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2019-01-18  Mark Wielaard  <mark@klomp.org>
+
+	* Makefile.am (INSTALL_ELFH): Add elf.h to include_HEADERS when
+	defined, otherwise (the default) add elf.h to noinst_HEADERS.
+
 2019-01-16  Mark Wielaard  <mark@klomp.org>
 
 	* note_xlate.h (elf_cvt_note): Check n_namesz and n_descsz don't
diff --git a/libelf/Makefile.am b/libelf/Makefile.am
index ddaeaa2..d5d63f7 100644
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -39,6 +39,16 @@ noinst_LIBRARIES = libelf_pic.a
 noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
 include_HEADERS = libelf.h gelf.h nlist.h
 
+noinst_HEADERS = abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
+		 version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h \
+		 chdr_xlate.h
+
+if INSTALL_ELFH
+include_HEADERS += elf.h
+else
+noinst_HEADERS += elf.h
+endif
+
 pkginclude_HEADERS = elf-knowledge.h
 
 libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
@@ -123,9 +133,6 @@ uninstall: uninstall-am
 	rm -f $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
 	rm -f $(DESTDIR)$(libdir)/libelf.so
 
-noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
-		 version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h \
-		 chdr_xlate.h
 EXTRA_DIST = libelf.map
 
 CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so.$(VERSION)
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] configure: Add new --enable-install-elfh option.
  2019-01-18 13:25 [PATCH] configure: Add new --enable-install-elfh option Mark Wielaard
@ 2019-01-18 14:03 ` Ulf Hermann
  2019-01-24 17:53   ` Mark Wielaard
  0 siblings, 1 reply; 6+ messages in thread
From: Ulf Hermann @ 2019-01-18 14:03 UTC (permalink / raw)
  To: elfutils-devel

I think you should also adapt tests/Makefile.am to use our own elf.h in 
this case. See https://codereview.qt-project.org/#/c/187812/25 for my 
solution to this.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] configure: Add new --enable-install-elfh option.
  2019-01-18 14:03 ` Ulf Hermann
@ 2019-01-24 17:53   ` Mark Wielaard
  2019-01-29 19:42     ` Mark Wielaard
  2019-01-30  9:54     ` Ulf Hermann
  0 siblings, 2 replies; 6+ messages in thread
From: Mark Wielaard @ 2019-01-24 17:53 UTC (permalink / raw)
  To: Ulf Hermann, elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 825 bytes --]

On Fri, 2019-01-18 at 14:03 +0000, Ulf Hermann wrote:
> I think you should also adapt tests/Makefile.am to use our own elf.h
> in 
> this case. See https://codereview.qt-project.org/#/c/187812/25 for
> my 
> solution to this.

Yes, it should indeed.
I used a slightly different solution though.
It relies on the default include flags already including the srcdirs.
Does that work for your use case too? (See revised patch attached.)

I looked at the features.h tweak also in your patch.
But I am not comfortable including something like that.
It feels like it needs a different test (whether we are actually on a
POSIX system or not). And I am not sure it really should define uid_t,
gid_t, mode_t, and pid_t. Those normally don't come from features.h
(they would come from sys/types.h).

Cheers,

Mark

[-- Attachment #2: 0001-configure-Add-new-enable-install-elfh-option.patch --]
[-- Type: text/x-patch, Size: 4932 bytes --]

From 86f9481187bccb78b2533674bb905a0de1a03abf Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Fri, 18 Jan 2019 14:18:22 +0100
Subject: [PATCH] configure: Add new --enable-install-elfh option.

We explicitly test (with system-elf-libelf) that our include headers
work with the system elf.h header. But it might be helpful to install
the elf.h file for a private install. Our elf.h header really is just
a copy of the latest glibc elf.h. But it might be newer and include
more constants than the system installed elf.h.

Add a new configure option --enable-install-elfh to install elf.h.
But warn when it is enabled for the default /usr or /usr/local prefix
because it might clash with the glibc/system elf.h header in that case.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 ChangeLog          |  4 ++++
 configure.ac       | 12 ++++++++++++
 libelf/ChangeLog   |  5 +++++
 libelf/Makefile.am | 13 ++++++++++---
 tests/ChangeLog    |  5 +++++
 tests/Makefile.am  |  4 +++-
 6 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 45418a0..148ce77 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2019-01-18  Mark Wielaard  <mark@klomp.org>
+
+	* configure.ac: Add new --enable-install-elfh.
+
 2018-07-04  Ross Burton <ross.burton@intel.com>
 
 	* configure.ac: Check for gawk.
diff --git a/configure.ac b/configure.ac
index b89b867..7d4e69d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -323,6 +323,11 @@ if test "$use_valgrind" = yes; then
 fi
 AM_CONDITIONAL(USE_VALGRIND, test "$use_valgrind" = yes)
 
+AC_ARG_ENABLE([install-elfh],
+AS_HELP_STRING([--enable-install-elfh],[install elf.h in include dir]),
+               [install_elfh=$enableval], [install_elfh=no])
+AM_CONDITIONAL(INSTALL_ELFH, test "$install_elfh" = yes)
+
 AM_CONDITIONAL(BUILD_STATIC, [dnl
 test "$use_gprof" = yes -o "$use_gcov" = yes])
 
@@ -658,6 +663,7 @@ AC_MSG_NOTICE([
 
   NOT RECOMMENDED FEATURES (should all be no)
     Experimental thread safety         : ${use_locks}
+    install elf.h                      : ${install_elfh}
 
   OTHER FEATURES
     Deterministic archives by default  : ${default_ar_deterministic}
@@ -673,3 +679,9 @@ AC_MSG_NOTICE([
     use rpath in tests                 : ${tests_use_rpath}
     test biarch                        : ${utrace_cv_cc_biarch}
 ])
+
+if test "$install_elfh" = yes; then
+  if test "${prefix}" = "/usr/local" -o "${prefix}" = "/usr"; then
+    AC_MSG_WARN([installing elf.h in ${includedir} might conflict with glibc/system elf.h])
+  fi
+fi
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 5783f0c..b89e93f 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2019-01-18  Mark Wielaard  <mark@klomp.org>
+
+	* Makefile.am (INSTALL_ELFH): Add elf.h to include_HEADERS when
+	defined, otherwise (the default) add elf.h to noinst_HEADERS.
+
 2019-01-16  Mark Wielaard  <mark@klomp.org>
 
 	* note_xlate.h (elf_cvt_note): Check n_namesz and n_descsz don't
diff --git a/libelf/Makefile.am b/libelf/Makefile.am
index ddaeaa2..d5d63f7 100644
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -39,6 +39,16 @@ noinst_LIBRARIES = libelf_pic.a
 noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
 include_HEADERS = libelf.h gelf.h nlist.h
 
+noinst_HEADERS = abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
+		 version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h \
+		 chdr_xlate.h
+
+if INSTALL_ELFH
+include_HEADERS += elf.h
+else
+noinst_HEADERS += elf.h
+endif
+
 pkginclude_HEADERS = elf-knowledge.h
 
 libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
@@ -123,9 +133,6 @@ uninstall: uninstall-am
 	rm -f $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
 	rm -f $(DESTDIR)$(libdir)/libelf.so
 
-noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
-		 version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h \
-		 chdr_xlate.h
 EXTRA_DIST = libelf.map
 
 CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so.$(VERSION)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 8c9e780..1a7bc81 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2019-01-24  Mark Wielaard  <mark@klomp.org>
+
+	* Makefile.am (system_elf_libelf_test_CPPFLAGS): Guard by
+	!INSTALL_ELFH.
+
 2019-01-09  Ulf Hermann <ulf.hermann@qt.io>
 
 	* run-readelf-compressed.sh: Skip if USE_BZIP2 not found.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bc8c19a..4c4af78 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -595,8 +595,10 @@ elfcopy_LDADD = $(libelf)
 addsections_LDADD = $(libelf)
 
 # We want to test the libelf header against the system elf.h header.
-# Don't include any -I CPPFLAGS.
+# Don't include any -I CPPFLAGS. Except when we install our own elf.h.
+if !INSTALL_ELFH
 system_elf_libelf_test_CPPFLAGS =
+endif
 system_elf_libelf_test_LDADD = $(libelf)
 
 # A lock file used to make sure only one test dumps core at a time
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] configure: Add new --enable-install-elfh option.
  2019-01-24 17:53   ` Mark Wielaard
@ 2019-01-29 19:42     ` Mark Wielaard
  2019-01-30  9:54     ` Ulf Hermann
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Wielaard @ 2019-01-29 19:42 UTC (permalink / raw)
  To: Ulf Hermann, elfutils-devel

Hi Ulf,

On Thu, Jan 24, 2019 at 06:53:15PM +0100, Mark Wielaard wrote:
> On Fri, 2019-01-18 at 14:03 +0000, Ulf Hermann wrote:
> > I think you should also adapt tests/Makefile.am to use our own elf.h
> > in 
> > this case. See https://codereview.qt-project.org/#/c/187812/25 for
> > my 
> > solution to this.
> 
> Yes, it should indeed.
> I used a slightly different solution though.
> It relies on the default include flags already including the srcdirs.
> Does that work for your use case too? (See revised patch attached.)

Please let me know if you have any more comments or suggestions.
I like to push this to master.

> I looked at the features.h tweak also in your patch.
> But I am not comfortable including something like that.
> It feels like it needs a different test (whether we are actually on a
> POSIX system or not). And I am not sure it really should define uid_t,
> gid_t, mode_t, and pid_t. Those normally don't come from features.h
> (they would come from sys/types.h).

Thanks,

Mark

> From 86f9481187bccb78b2533674bb905a0de1a03abf Mon Sep 17 00:00:00 2001
> From: Mark Wielaard <mark@klomp.org>
> Date: Fri, 18 Jan 2019 14:18:22 +0100
> Subject: [PATCH] configure: Add new --enable-install-elfh option.
> 
> We explicitly test (with system-elf-libelf) that our include headers
> work with the system elf.h header. But it might be helpful to install
> the elf.h file for a private install. Our elf.h header really is just
> a copy of the latest glibc elf.h. But it might be newer and include
> more constants than the system installed elf.h.
> 
> Add a new configure option --enable-install-elfh to install elf.h.
> But warn when it is enabled for the default /usr or /usr/local prefix
> because it might clash with the glibc/system elf.h header in that case.
> 
> Signed-off-by: Mark Wielaard <mark@klomp.org>
> ---
>  ChangeLog          |  4 ++++
>  configure.ac       | 12 ++++++++++++
>  libelf/ChangeLog   |  5 +++++
>  libelf/Makefile.am | 13 ++++++++++---
>  tests/ChangeLog    |  5 +++++
>  tests/Makefile.am  |  4 +++-
>  6 files changed, 39 insertions(+), 4 deletions(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index 45418a0..148ce77 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,7 @@
> +2019-01-18  Mark Wielaard  <mark@klomp.org>
> +
> +	* configure.ac: Add new --enable-install-elfh.
> +
>  2018-07-04  Ross Burton <ross.burton@intel.com>
>  
>  	* configure.ac: Check for gawk.
> diff --git a/configure.ac b/configure.ac
> index b89b867..7d4e69d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -323,6 +323,11 @@ if test "$use_valgrind" = yes; then
>  fi
>  AM_CONDITIONAL(USE_VALGRIND, test "$use_valgrind" = yes)
>  
> +AC_ARG_ENABLE([install-elfh],
> +AS_HELP_STRING([--enable-install-elfh],[install elf.h in include dir]),
> +               [install_elfh=$enableval], [install_elfh=no])
> +AM_CONDITIONAL(INSTALL_ELFH, test "$install_elfh" = yes)
> +
>  AM_CONDITIONAL(BUILD_STATIC, [dnl
>  test "$use_gprof" = yes -o "$use_gcov" = yes])
>  
> @@ -658,6 +663,7 @@ AC_MSG_NOTICE([
>  
>    NOT RECOMMENDED FEATURES (should all be no)
>      Experimental thread safety         : ${use_locks}
> +    install elf.h                      : ${install_elfh}
>  
>    OTHER FEATURES
>      Deterministic archives by default  : ${default_ar_deterministic}
> @@ -673,3 +679,9 @@ AC_MSG_NOTICE([
>      use rpath in tests                 : ${tests_use_rpath}
>      test biarch                        : ${utrace_cv_cc_biarch}
>  ])
> +
> +if test "$install_elfh" = yes; then
> +  if test "${prefix}" = "/usr/local" -o "${prefix}" = "/usr"; then
> +    AC_MSG_WARN([installing elf.h in ${includedir} might conflict with glibc/system elf.h])
> +  fi
> +fi
> diff --git a/libelf/ChangeLog b/libelf/ChangeLog
> index 5783f0c..b89e93f 100644
> --- a/libelf/ChangeLog
> +++ b/libelf/ChangeLog
> @@ -1,3 +1,8 @@
> +2019-01-18  Mark Wielaard  <mark@klomp.org>
> +
> +	* Makefile.am (INSTALL_ELFH): Add elf.h to include_HEADERS when
> +	defined, otherwise (the default) add elf.h to noinst_HEADERS.
> +
>  2019-01-16  Mark Wielaard  <mark@klomp.org>
>  
>  	* note_xlate.h (elf_cvt_note): Check n_namesz and n_descsz don't
> diff --git a/libelf/Makefile.am b/libelf/Makefile.am
> index ddaeaa2..d5d63f7 100644
> --- a/libelf/Makefile.am
> +++ b/libelf/Makefile.am
> @@ -39,6 +39,16 @@ noinst_LIBRARIES = libelf_pic.a
>  noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
>  include_HEADERS = libelf.h gelf.h nlist.h
>  
> +noinst_HEADERS = abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
> +		 version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h \
> +		 chdr_xlate.h
> +
> +if INSTALL_ELFH
> +include_HEADERS += elf.h
> +else
> +noinst_HEADERS += elf.h
> +endif
> +
>  pkginclude_HEADERS = elf-knowledge.h
>  
>  libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
> @@ -123,9 +133,6 @@ uninstall: uninstall-am
>  	rm -f $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
>  	rm -f $(DESTDIR)$(libdir)/libelf.so
>  
> -noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
> -		 version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h \
> -		 chdr_xlate.h
>  EXTRA_DIST = libelf.map
>  
>  CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so.$(VERSION)
> diff --git a/tests/ChangeLog b/tests/ChangeLog
> index 8c9e780..1a7bc81 100644
> --- a/tests/ChangeLog
> +++ b/tests/ChangeLog
> @@ -1,3 +1,8 @@
> +2019-01-24  Mark Wielaard  <mark@klomp.org>
> +
> +	* Makefile.am (system_elf_libelf_test_CPPFLAGS): Guard by
> +	!INSTALL_ELFH.
> +
>  2019-01-09  Ulf Hermann <ulf.hermann@qt.io>
>  
>  	* run-readelf-compressed.sh: Skip if USE_BZIP2 not found.
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index bc8c19a..4c4af78 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -595,8 +595,10 @@ elfcopy_LDADD = $(libelf)
>  addsections_LDADD = $(libelf)
>  
>  # We want to test the libelf header against the system elf.h header.
> -# Don't include any -I CPPFLAGS.
> +# Don't include any -I CPPFLAGS. Except when we install our own elf.h.
> +if !INSTALL_ELFH
>  system_elf_libelf_test_CPPFLAGS =
> +endif
>  system_elf_libelf_test_LDADD = $(libelf)
>  
>  # A lock file used to make sure only one test dumps core at a time
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] configure: Add new --enable-install-elfh option.
  2019-01-24 17:53   ` Mark Wielaard
  2019-01-29 19:42     ` Mark Wielaard
@ 2019-01-30  9:54     ` Ulf Hermann
  2019-01-31 22:51       ` Mark Wielaard
  1 sibling, 1 reply; 6+ messages in thread
From: Ulf Hermann @ 2019-01-30  9:54 UTC (permalink / raw)
  To: Mark Wielaard, elfutils-devel

> Yes, it should indeed.
> I used a slightly different solution though.
> It relies on the default include flags already including the srcdirs.
> Does that work for your use case too? (See revised patch attached.)

I'm not an expert in autotools. The reason I also have "else" case in my 
code is that I want to do "+=" in the USE_GNULIB case below. That only 
works if system_elf_libelf_test_CPPFLAGS is defined, which curiously it 
is not if you don't explicitly set it before (even though it is 
implicitly there somehow ... ?!?).

In particular I get the following error from autoconf if I naively merge 
your patch:

> Ulf@Ulf-PC MINGW64 /d/elfutils$ autoreconf -fi
> tests/Makefile.am:617: error: cannot apply '+=' because 'system_elf_libelf_test_CPPFLAGS' is not defined in
> tests/Makefile.am:617: the following conditions:
> tests/Makefile.am:617:   INSTALL_ELFH and USE_GNULIB
> tests/Makefile.am:617: either define 'system_elf_libelf_test_CPPFLAGS' in these conditions, or use
> tests/Makefile.am:617: '+=' in the same conditions as the definitions.
> autoreconf: automake failed with exit status: 1

As this only applies to my code, you are of course free to apply your 
version upstream. It probably makes no difference if the USE_GNULIB case 
isn't there. I will adapt my code then.

best,
Ulf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] configure: Add new --enable-install-elfh option.
  2019-01-30  9:54     ` Ulf Hermann
@ 2019-01-31 22:51       ` Mark Wielaard
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Wielaard @ 2019-01-31 22:51 UTC (permalink / raw)
  To: Ulf Hermann; +Cc: elfutils-devel

On Wed, Jan 30, 2019 at 09:54:53AM +0000, Ulf Hermann wrote:
> > Yes, it should indeed.
> > I used a slightly different solution though.
> > It relies on the default include flags already including the srcdirs.
> > Does that work for your use case too? (See revised patch attached.)
> 
> I'm not an expert in autotools. The reason I also have "else" case in my 
> code is that I want to do "+=" in the USE_GNULIB case below. That only 
> works if system_elf_libelf_test_CPPFLAGS is defined, which curiously it 
> is not if you don't explicitly set it before (even though it is 
> implicitly there somehow ... ?!?).
> 
> In particular I get the following error from autoconf if I naively merge 
> your patch:
> 
> > Ulf@Ulf-PC MINGW64 /d/elfutils$ autoreconf -fi
> > tests/Makefile.am:617: error: cannot apply '+=' because 'system_elf_libelf_test_CPPFLAGS' is not defined in
> > tests/Makefile.am:617: the following conditions:
> > tests/Makefile.am:617:   INSTALL_ELFH and USE_GNULIB
> > tests/Makefile.am:617: either define 'system_elf_libelf_test_CPPFLAGS' in these conditions, or use
> > tests/Makefile.am:617: '+=' in the same conditions as the definitions.
> > autoreconf: automake failed with exit status: 1
> 
> As this only applies to my code, you are of course free to apply your 
> version upstream. It probably makes no difference if the USE_GNULIB case 
> isn't there. I will adapt my code then.

That makes sense. I added the else to explicitly set it:

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4c4af7843..1b0c7d333 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -598,6 +598,8 @@ addsections_LDADD = $(libelf)
 # Don't include any -I CPPFLAGS. Except when we install our own elf.h.
 if !INSTALL_ELFH
 system_elf_libelf_test_CPPFLAGS =
+else
+system_elf_libelf_test_CPPFLAGS = -I$(top_srcdir)/libelf
 endif
 system_elf_libelf_test_LDADD = $(libelf)

Pushed with that change.

Thanks,

Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-01-31 22:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-18 13:25 [PATCH] configure: Add new --enable-install-elfh option Mark Wielaard
2019-01-18 14:03 ` Ulf Hermann
2019-01-24 17:53   ` Mark Wielaard
2019-01-29 19:42     ` Mark Wielaard
2019-01-30  9:54     ` Ulf Hermann
2019-01-31 22:51       ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).