]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
Enable link with external libspeex
authorTakashi Iwai <tiwai@suse.de>
Thu, 24 May 2007 13:28:22 +0000 (15:28 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 24 May 2007 13:28:22 +0000 (15:28 +0200)
- Add --with-speex configure option to specify the build of speex rate
  plugin.  As default, it's linked to external library.  If not available,
  defaults to builtin code.
- Show build conditions at the end of configure script
- Use AS_HELP_TEXT()

Makefile.am
configure.in
pph/Makefile.am
pph/rate_speexrate.c

index 0f68336dc12dd4b59c0dde1a14f4e04d3e17315e..0433bca55f0a5352cc598c51c2dfc31445ec26d1 100644 (file)
@@ -14,8 +14,11 @@ endif
 if HAVE_DBUS
 MAEMODIR = maemo
 endif
+if HAVE_PPH
+PPHDIR = pph
+endif
 
-SUBDIRS = oss mix pph $(JACKDIR) $(PULSEDIR) $(SAMPLERATEDIR) $(A52DIR) $(LAVCRATEDIR) $(MAEMODIR) doc
+SUBDIRS = oss mix $(PPHDIR) $(JACKDIR) $(PULSEDIR) $(SAMPLERATEDIR) $(A52DIR) $(LAVCRATEDIR) $(MAEMODIR) doc
 EXTRA_DIST = hgcompile version COPYING.GPL
 AUTOMAKE_OPTIONS = foreign
 
index 9313b0f5ea957f275e58224eb64f2abbf81bb0dc..9875a6ff1e5a5cbf16ad56ff446dd3b0b026c479 100644 (file)
@@ -32,10 +32,12 @@ if test "$HAVE_DBUS" = "yes"; then
 fi
 
 AC_ARG_WITH([avcodec-includedir],
-       [--with-avcodec-includedir=dir    AVcodec include directory],
+       AS_HELP_STRING([--with-avcodec-includedir=dir],
+               [AVcodec include directory]),
        [AVCODEC_CFLAGS="-I$withval"], [AVCODEC_CFLAGS=""])
 AC_ARG_WITH([avcodec-libdir],
-       [--with-avcodec-libdir=dir        AVcodec library directory],
+       AS_HELP_STRING([--with-avcodec-libdir=dir],
+               [AVcodec library directory]),
        [AVCODEC_LIBS="-L$withval"], [AVCODEC_LIBS=""])
 CFLAGS_saved="$CFLAGS"
 LDFLAGS_saved="$LDFLAGS"
@@ -52,6 +54,29 @@ AM_CONDITIONAL(HAVE_AVCODEC, test x$HAVE_AVCODEC = xyes)
 CFLAGS="$CFLAGS_saved"
 LDFLAGS="$LDFLAGS_saved"
 
+USE_LIBSPEEX=""
+AC_ARG_WITH([speex],
+       AS_HELP_STRING([--with-speex={builtin|lib|no}],
+               [build speex resampler (built-in code, link with external lib, or no build)]),
+       [PPH=$withval], [PPH="lib"])
+
+if test "$PPH" = "lib"; then
+       PKG_CHECK_MODULES(speex, [speex >= 1.2], [USE_LIBSPEEX="yes"], [USE_LIBSPEEX=""])
+       if test "$USE_LIBSPEEX" = "yes"; then
+               AC_CHECK_LIB([speex], [speex_resampler_init],
+                       [USE_LIBSPEEX="yes"], [USE_LIBSPEEX=""])
+       fi
+       if test "$USE_LIBSPEEX" = "yes"; then
+               AC_DEFINE(USE_LIBSPEEX, 1, "Link with libspeex for resampler")
+       else
+               echo "No libspeex with resampler unit; use built-in code"
+               PPH="builtin"
+       fi
+fi
+
+AM_CONDITIONAL(HAVE_PPH, test "$PPH" = "builtin" -o "$PPH" = "lib")
+AM_CONDITIONAL(USE_LIBSPEEX, test "$PPH" = "lib")
+
 dnl ALSA plugin directory
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
@@ -87,3 +112,40 @@ AC_OUTPUT([
        maemo/Makefile
        doc/Makefile
 ])
+
+dnl Show the build conditions
+
+echo
+echo "Plugin directory: $ALSA_PLUGIN_DIR"
+echo "ALSA_CFLAGS: $ALSA_CFLAGS"
+echo "ALSA_LIBS: $ALSA_LIBS"
+echo "JACK plugin:        $HAVE_JACK"
+if test "$HAVE_JACK" = "yes"; then
+  echo "  JACK_CFLAGS: $JACK_CFLAGS"
+  echo "  JACK_LIBS: $JACK_LIBS"
+fi
+echo "Pulseaudio plugin:  $HAVE_PULSE"
+if test "$HAVE_PULSE" = "yes"; then
+  echo "  pulseaudio_CFLAGS: $pulseaudio_CFLAGS"
+  echo "  pulseaudio_LIBS: $pulseaudio_LIBS"
+fi
+echo "Samplerate plugin:  $HAVE_SAMPLERATE"
+if test "$HAVE_SAMPLERATE" = "yes"; then
+  echo "  samplerate_CFLAGS: $samplerate_CFLAGS"
+  echo "  samplerate_LIBS: $samplerate_LIBS"
+fi
+echo "Maemo plugin:       $HAVE_DBUS"
+if test "$HAVE_DBUS" = "yes"; then
+  echo "  DBUS_CFLAGS: $DBUS_CFLAGS"
+  echo "  DBUS_LIBS: $DBUS_LIBS"
+fi
+echo "A52, lavc plugins:  $HAVE_AVCODEC"
+if test "$HAVE_AVCODEC" = "yes"; then
+  echo "  AVCODEC_CFLAGS: $AVCODEC_CFLAGS"
+  echo "  AVCODEC_LIBS: $AVCODEC_LIBS"
+fi
+echo "Speex rate plugin:  $PPH"
+if test "$PPH" = "lib"; then
+  echo "  speex_CFLAGS: $speex_CFLAGS"
+  echo "  speex_LIBS: $speex_LIBS"
+fi
index 8fd5098119272eb948623e053efc3fd537c36528..ee630cd1bb932d0f0338c8e131ba8eca19088ec6 100644 (file)
@@ -5,8 +5,14 @@ asound_module_rate_speexratedir = @ALSA_PLUGIN_DIR@
 AM_CFLAGS = -DVAR_ARRAYS -DRANDOM_PREFIX=alsa_lib -DOUTSIDE_SPEEX -Wall -g @ALSA_CFLAGS@
 AM_LDFLAGS = -module -avoid-version -export-dynamic
 
-libasound_module_rate_speexrate_la_SOURCES = rate_speexrate.c resample.c
+libasound_module_rate_speexrate_la_SOURCES = rate_speexrate.c
 libasound_module_rate_speexrate_la_LIBADD = @ALSA_LIBS@
+if USE_LIBSPEEX
+AM_CFLAGS += @speex_CFLAGS@
+libasound_module_rate_speexrate_la_LIBADD += @speex_LIBS@
+else
+libasound_module_rate_speexrate_la_SOURCES += resample.c
+endif
 
 install-exec-hook:
        rm -f $(DESTDIR)@ALSA_PLUGIN_DIR@/libasound_module_rate_speexrate_*.so
index 195b16d9f6f42f226110edbccf60888995afdf97..9eb33b98a4938ee786050f2fac91c1f98002ff01 100644 (file)
 #include <alsa/asoundlib.h>
 #include <alsa/pcm_rate.h>
 
+#ifdef USE_LIBSPEEX
+#include <speex/speex_resampler.h>
+#else
 #include "speex_resampler.h"
+#endif
 
 struct rate_src {
        int quality;