Commit 710da3b0 authored by Sam Lantinga's avatar Sam Lantinga

Date: Sun, 29 Feb 2004 15:14:22 +0200

From: Martin_Storsj
Subject: Dynamic loading of ALSA

I recently discovered that SDL can dynamically load ESD and aRts, and
made a patch which adds this same functionality to ALSA.

The update for configure.in isn't too good (it should e.g. look for
libasound.so in other directories than /usr/lib), because I'm not too
good at shellscripting and autoconf.

The reason for using dlfcn.h and dlopen instead of SDL_LoadLibrary and
SDL_LoadFunction is that libasound uses versioned symbols, and it is
necessary to load the correct version using dlvsym. This isn't probably
any real portability issue, because ALSA is linux-only.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40866
parent a58dea0f
......@@ -295,8 +295,22 @@ CheckALSA()
AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes)
])
if test x$have_alsa = xyes; then
CFLAGS="$CFLAGS -DALSA_SUPPORT"
SYSTEM_LIBS="$SYSTEM_LIBS -lasound"
AC_ARG_ENABLE(alsa-shared,
[ --enable-alsa-shared dynamically load ALSA audio support [default=yes]],
, enable_alsa_shared=yes)
alsa_lib=`ls /usr/lib/libasound.so.* | head -1 | sed 's/.*\/\(.*\)/\1/'`
if test x$use_dlopen != xyes && \
test x$enable_alsa_shared = xyes; then
AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
fi
if test x$use_dlopen = xyes && \
test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
CFLAGS="$CFLAGS -DALSA_SUPPORT -DALSA_DYNAMIC=\$(alsa_lib)"
AC_SUBST(alsa_lib)
else
CFLAGS="$CFLAGS -DALSA_SUPPORT"
SYSTEM_LIBS="$SYSTEM_LIBS -lasound"
fi
AUDIO_SUBDIRS="$AUDIO_SUBDIRS alsa"
AUDIO_DRIVERS="$AUDIO_DRIVERS alsa/libaudio_alsa.la"
else
......
......@@ -4,6 +4,8 @@
noinst_LTLIBRARIES = libaudio_alsa.la
libaudio_alsa_la_SOURCES = $(SRCS)
alsa_lib = \"@alsa_lib@\"
# The SDL audio driver sources
SRCS = SDL_alsa_audio.c \
SDL_alsa_audio.h
This diff is collapsed.
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