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