Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #334 from theuni/alsa-optional
Browse files Browse the repository at this point in the history
linux: build without alsa if libasound is not present
  • Loading branch information
theuni committed Aug 7, 2011
2 parents 6912252 + bce0622 commit 6a8845a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
15 changes: 13 additions & 2 deletions configure.in
Expand Up @@ -92,6 +92,7 @@ librtmp_not_found="== Could not find libRTMP. RTMP support disabled. =="
librtmp_disabled="== RTMP support disabled. =="
libnfs_not_found="== Could not find libnfs. NFS support disabled. =="
libnfs_disabled="== NFS support disabled. =="
alsa_not_found="== Could not find ALSA. ALSA support disabled. =="


# External library message strings
Expand Down Expand Up @@ -668,8 +669,8 @@ else
AC_CHECK_LIB([SDL_image], [main],, AC_MSG_ERROR($missing_library))

PKG_CHECK_MODULES([ALSA], [alsa],
[INCLUDES="$INCLUDES $ALSA_CFLAGS"; LIBS="$LIBS $ALSA_LIBS"],
AC_MSG_ERROR($missing_library))
[INCLUDES="$INCLUDES $ALSA_CFLAGS"; LIBS="$LIBS $ALSA_LIBS"; use_alsa=yes],
AC_MSG_NOTICE($alsa_not_found); use_alsa=no)
PKG_CHECK_MODULES([ENCA], [enca],
[INCLUDES="$INCLUDES $ENCA_CFLAGS"; LIBS="$LIBS $ENCA_LIBS"],
AC_MSG_ERROR($missing_library))
Expand Down Expand Up @@ -1199,6 +1200,15 @@ else
fi
fi

if test "$use_alsa" = "yes"; then
USE_ALSA=1
AC_DEFINE([USE_ALSA],[1],["Define to 1 if alsa is installed"])
final_message="$final_message\n ALSA:\t\tYes"
else
USE_ALSA=0
final_message="$final_message\n ALSA:\t\tNo"
fi

if test "x$use_vdpau" != "xno"; then
final_message="$final_message\n VDPAU:\tYes"
else
Expand Down Expand Up @@ -1510,6 +1520,7 @@ AC_SUBST(USE_VDA)
AC_SUBST(USE_OPENMAX)
AC_SUBST(USE_PULSE)
AC_SUBST(USE_XRANDR)
AC_SUBST(USE_ALSA)
AC_SUBST(USE_TEXTUREPACKER)
AC_SUBST(USE_TEXTUREPACKER_NATIVE)
AC_SUBST(USE_TEXTUREPACKER_NATIVE_ROOT)
Expand Down
2 changes: 0 additions & 2 deletions xbmc/cores/AudioRenderers/ALSADirectSound.cpp
@@ -1,4 +1,3 @@
#ifndef __APPLE__
/*
* XBMC Media Center
* Copyright (c) 2002 d7o3g4q and RUNTiME
Expand Down Expand Up @@ -718,4 +717,3 @@ void CALSADirectSound::GenSoundLabel(AudioSinkList& vAudioSinks, CStdString sink
vAudioSinks.push_back(AudioSink(label, finalSink));
}
}
#endif
8 changes: 4 additions & 4 deletions xbmc/cores/AudioRenderers/AudioRendererFactory.cpp
Expand Up @@ -39,7 +39,7 @@
#else
#include "CoreAudioRenderer.h"
#endif
#elif defined(_LINUX)
#elif defined(USE_ALSA)
#include "ALSADirectSound.h"
#endif

Expand Down Expand Up @@ -151,7 +151,7 @@ IAudioRenderer* CAudioRendererFactory::Create(IAudioCallback* pCallback, int iCh
#else
CreateAndReturnOnValidInitialize(CCoreAudioRenderer);
#endif
#elif defined(_LINUX)
#elif defined(USE_ALSA)
CreateAndReturnOnValidInitialize(CALSADirectSound);
#endif

Expand All @@ -176,7 +176,7 @@ void CAudioRendererFactory::EnumerateAudioSinks(AudioSinkList& vAudioSinks, bool
#if !defined(__arm__)
CCoreAudioRenderer::EnumerateAudioSinks(vAudioSinks, passthrough);
#endif
#elif defined(_LINUX)
#elif defined(USE_ALSA)
CALSADirectSound::EnumerateAudioSinks(vAudioSinks, passthrough);
#endif
}
Expand All @@ -203,7 +203,7 @@ IAudioRenderer *CAudioRendererFactory::CreateFromUri(const CStdString &soundsyst
if (soundsystem.Equals("coreaudio"))
ReturnNewRenderer(CCoreAudioRenderer);
#endif
#elif defined(_LINUX)
#elif defined(USE_ALSA)
if (soundsystem.Equals("alsa"))
ReturnNewRenderer(CALSADirectSound);
#endif
Expand Down
5 changes: 4 additions & 1 deletion xbmc/cores/AudioRenderers/Makefile.in
Expand Up @@ -10,10 +10,13 @@ else
SRCS = \
NullDirectSound.cpp \
AudioRendererFactory.cpp \
ALSADirectSound.cpp \

endif

ifeq (@USE_ALSA@,1)
SRCS+= ALSADirectSound.cpp
endif

ifeq (@USE_PULSE@,1)
SRCS+= PulseAudioDirectSound.cpp \

Expand Down
2 changes: 1 addition & 1 deletion xbmc/settings/GUIWindowSettingsCategory.cpp
Expand Up @@ -67,7 +67,7 @@
#include "LinuxTimezone.h"
#include <dlfcn.h>
#include "cores/AudioRenderers/AudioRendererFactory.h"
#ifndef __APPLE__
#if defined(USE_ALSA)
#include "cores/AudioRenderers/ALSADirectSound.h"
#endif
#ifdef HAS_HAL
Expand Down

0 comments on commit 6a8845a

Please sign in to comment.