diff --git a/Makefile.am b/Makefile.am index 4f560e9301b6ee5853915699cfe77c8c8ce34e5b..efee56afeb576fce061eb5fe05bc4b1fd1c0661a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,6 +34,11 @@ pkgconfig_DATA = data/libcapsule.pc data/libcapsule-tools.pc nobase_include_HEADERS = capsule/capsule.h dist_doc_DATA = $(foreach doc,$(static_docs),doc/$(doc).txt) +if ENABLE_TOOLS_RPATH +# Use -Wl to hide it from libtool +tools_ldflags = -Wl,-rpath,$(enable_tools_rpath) +endif + if ENABLE_HOST_PREFIX bin_SCRIPTS = data/$(HOST_PREFIX)capsule-mkstublib @@ -83,16 +88,20 @@ capsule_elf_dump_LDADD = utils/libutils.la -ldl # This looks redundant, but it forces Automake to build separate # instantiations of dump.o for elf-dump and libcapsule capsule_elf_dump_CFLAGS = $(AM_CFLAGS) +capsule_elf_dump_LDFLAGS = $(AM_LDFLAGS) $(tools_ldflags) capsule_capture_libs_SOURCES = utils/capture-libs.c capsule_capture_libs_LDADD = utils/libld.la +capsule_capture_libs_LDFLAGS = $(AM_LDFLAGS) $(tools_ldflags) # now the rules for building our installables: capsule_symbols_SOURCES = utils/print-libstubs.c capsule_symbols_LDADD = utils/libld.la +capsule_symbols_LDFLAGS = $(AM_LDFLAGS) $(tools_ldflags) capsule_version_SOURCES = utils/print-version.c capsule_version_LDADD = utils/libld.la +capsule_version_LDFLAGS = $(AM_LDFLAGS) $(tools_ldflags) libcapsule_la_SOURCES = capsule/capsule-dlmopen.c \ capsule/capsule-relocate.c \ diff --git a/configure.ac b/configure.ac index 8b9defb2cee136b651e709baf1293a353d47f758..0b15fdf4376078d5f8ea1507e82b6c85d2f5762c 100644 --- a/configure.ac +++ b/configure.ac @@ -82,6 +82,19 @@ AS_IF([test "x$enable_host_prefix" = xno], [enable_host_prefix=""]) AC_SUBST([HOST_PREFIX], [$enable_host_prefix]) +AC_ARG_ENABLE([tools-rpath], + [AS_HELP_STRING([--enable-tools-rpath=RPATH/yes/no], + [install link to tools with a RPATH ready to override with chrpath])], + [], + [enable_tools_rpath=no]) + +AS_IF([test "x$enable_tools_rpath" = xyes], + [enable_tools_rpath="/_ORIGIN_/__/lib/$host"]) +AS_IF([test "x$enable_tools_rpath" = xno], + [enable_tools_rpath=""]) +AC_SUBST([enable_tools_rpath]) +AM_CONDITIONAL([ENABLE_TOOLS_RPATH], [test "x$enable_tools_rpath" != x]) + AC_SEARCH_LIBS([dlmopen], [dl]) AC_PATH_PROG([XSLTPROC], [xsltproc]) GTK_DOC_CHECK