Commit 6fc5ee1f authored by Simon McVittie's avatar Simon McVittie

tools: Add a build option to add a -rpath

We have to do this in two stages, because passing ${ORIGIN} through
Autoconf, Automake and Make is a massive pain: first write in a
dummy rpath that starts with /_ORIGIN_ (implemented here), then
rewrite it to start with ${ORIGIN} with chrpath (to be done
externally).
Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
parent 90a21b5d
......@@ -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 \
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment