From 6a2e30b4bdb1e069475e3ce506479734a45020a2 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Tue, 14 Feb 2017 21:04:07 +0100 Subject: [PATCH] Let autotools generate a relocatable dbus-1.pc in standard cases. For simplicity, we're not relocatable if libdir is something more complicated (e.g. Debian multiarch); we don't want to have to compute how many ../ to add. Related cmake changes are included. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99721 --- cmake/CMakeLists.txt | 4 ++-- configure.ac | 6 ++++++ dbus-1.pc.in | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index e05dc3c..f7dbf95 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -666,10 +666,10 @@ if(UNIX) set(LIBDBUS_LIBS "${LIBDBUS_LIBS} -l${LIB}") endforeach() if(DBUS_RELOCATABLE_LIBDIR) - set(prefix "\${pcfiledir}/../../") + set(pkgconfig_prefix "\${pcfiledir}/../../") else() message("Unusual CMAKE_INSTALL_PREFIX: the generated package will not be relocatable.") - set(prefix "${CMAKE_INSTALL_PREFIX}") + set(pkgconfig_prefix "${CMAKE_INSTALL_PREFIX}") endif() set(exec_prefix "\${prefix}") set(bindir "\${prefix}/${CMAKE_INSTALL_BINDIR}") diff --git a/configure.ac b/configure.ac index 190b42b..cf5aac1 100644 --- a/configure.ac +++ b/configure.ac @@ -1530,6 +1530,12 @@ AS_AC_EXPAND(EXPANDED_LIBDIR, "$libdir") AS_AC_EXPAND(EXPANDED_LIBEXECDIR, "$libexecdir") AS_AC_EXPAND(EXPANDED_DATADIR, "$datadir") +AS_IF([test "x$EXPANDED_LIBDIR" = "x$EXPANDED_PREFIX/lib" || + test "x$EXPANDED_LIBDIR" = "x$EXPANDED_PREFIX/lib64"], + [pkgconfig_prefix='${pcfiledir}/../..'], + [pkgconfig_prefix="$prefix"]) +AC_SUBST([pkgconfig_prefix]) + #### Check our operating system operating_system=unknown if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then diff --git a/dbus-1.pc.in b/dbus-1.pc.in index f93d156..26fc970 100644 --- a/dbus-1.pc.in +++ b/dbus-1.pc.in @@ -1,4 +1,4 @@ -prefix=@prefix@ +prefix=@pkgconfig_prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ libdir=@libdir@ -- 2.6.6