From 9ce55be61047d685ccd0a141decf823fa68c62df Mon Sep 17 00:00:00 2001 From: Felipe Sateler Date: Mon, 28 Nov 2016 14:49:06 -0300 Subject: [PATCH] padsp: allow overriding library install location The current build script hardcodes the $pkglibdir in the padsp command. This works and is a reasonable default. However, distributions that know where they install, can override this path and thus make padsp work for any architecture that has the library installed by using the following configure argument: --with-pulsedsp-location='/usr/\\$$LIB/pulseaudio' This works because ld.so considers $LIB a variable that will expand to several location paths, depending on the architecture of the binary being executed. In debian, for example, this would work for libpulsedsp.so installed in /usr/lib/x86_64-linux-gnu/ for amd64 and /usr/lib/i386-linux-gnu/ for i386, with a single padsp command. --- configure.ac | 8 ++++++++ src/Makefile.am | 2 +- src/utils/padsp.in | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 7a87432f1..da0bfcd5d 100644 --- a/configure.ac +++ b/configure.ac @@ -759,6 +759,9 @@ AC_ARG_ENABLE([oss-output], AC_ARG_ENABLE([oss-wrapper], AS_HELP_STRING([--disable-oss-wrapper],[Disable optional OSS wrapper support])) +AC_ARG_WITH([pulsedsp-location], + AS_HELP_STRING([--with-pulsedsp-location],[Specify location where OSS wrapper will be installed])) + AS_IF([test "x$enable_oss_output" != "xno" -o "x$enable_oss_wrapper" != "xno"], [AC_CHECK_HEADERS([sys/soundcard.h], HAVE_OSS=1, HAVE_OSS=0)], HAVE_OSS=0) @@ -774,7 +777,12 @@ AS_IF([test "x$enable_oss_wrapper" != "xno"], [AS_IF([test "x$HAVE_OSS" = "x1"], HAVE_OSS_WRAPPER=1, HAVE_OSS_WRAPPER=0)], HAVE_OSS_WRAPPER=0) +AS_IF([test "x$with_pulsedsp_location" != "x"], + [PULSEDSP_LOCATION="$with_pulsedsp_location"], + [PULSEDSP_LOCATION="\$(pkglibdir)"]) + AC_SUBST(HAVE_OSS_OUTPUT) +AC_SUBST(PULSEDSP_LOCATION) AM_CONDITIONAL([HAVE_OSS_OUTPUT], [test "x$HAVE_OSS_OUTPUT" = "x1"]) AM_CONDITIONAL([HAVE_OSS_WRAPPER], [test "x$HAVE_OSS_WRAPPER" = "x1"]) AS_IF([test "x$HAVE_OSS_OUTPUT" = "x1"], AC_DEFINE([HAVE_OSS_OUTPUT], 1, [Have OSS output?])) diff --git a/src/Makefile.am b/src/Makefile.am index 498a3867a..558472801 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -923,7 +923,7 @@ padsplib_LTLIBRARIES = libpulsedsp.la bin_SCRIPTS += padsp edit = @SED@ \ - -e "s|@pkglibdir[@]|$(pkglibdir)|g" + -e 's|@PULSEDSP_LOCATION[@]|$(PULSEDSP_LOCATION)|g' padsp: utils/padsp.in $(edit) $< > $@ diff --git a/src/utils/padsp.in b/src/utils/padsp.in index 3430a6575..fea00d2ad 100644 --- a/src/utils/padsp.in +++ b/src/utils/padsp.in @@ -74,9 +74,9 @@ done shift $(( $OPTIND - 1 )) if [ x"$LD_PRELOAD" = x ] ; then - LD_PRELOAD="@pkglibdir@/libpulsedsp.so" + LD_PRELOAD="@PULSEDSP_LOCATION@/libpulsedsp.so" else - LD_PRELOAD="$LD_PRELOAD @pkglibdir@/libpulsedsp.so" + LD_PRELOAD="$LD_PRELOAD @PULSEDSP_LOCATION@/libpulsedsp.so" fi export LD_PRELOAD