[Ltrace-devel] [PATCH] Fix building with libelf in a non-standard location

Роман Донченко dpb at corrigendum.ru
Sat Mar 28 17:13:09 UTC 2015


The default action for AC_CHECK_LIB adds -lelf to LIBS. If libelf.so
is in a non-standard location, this causes all subsequent link operations
to fail, including all of the function presence tests.

Change the action to set libelf_LIBS instead, like for every other library.
Makefile.am already uses that variable, so no change required there.
---
 configure.ac | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index c39fd9f..b9c39fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,11 +94,12 @@ LDFLAGS="${LDFLAGS} ${AM_LDFLAGS}"
 AC_CHECK_HEADERS([elf.h gelf.h],,
 	[AC_MSG_ERROR([*** libelf.h or gelf.h not found on your system])]
 )
-AC_CHECK_LIB([elf], [elf_begin],,
+AC_CHECK_LIB([elf], [elf_begin], [libelf_LIBS="-lelf"],
 	[AC_MSG_ERROR([*** libelf not found on your system])]
 )
 CPPFLAGS="${saved_CPPFLAGS}"
 LDFLAGS="${saved_LDFLAGS}"
+AC_SUBST(libelf_LIBS)
 
 
 # HAVE_LIBIBERTY
-- 
1.8.5.6




More information about the Ltrace-devel mailing list