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
This commit is contained in:
parent
a58dea0f76
commit
710da3b0ba
3 changed files with 150 additions and 25 deletions
18
configure.in
18
configure.in
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue