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.
This commit is contained in:
Felipe Sateler 2016-11-28 14:49:06 -03:00 committed by Tanu Kaskinen
parent 4bc753238f
commit 9ce55be610
3 changed files with 11 additions and 3 deletions

View file

@ -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?]))

View file

@ -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) $< > $@

View file

@ -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