diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-12-05 20:34:12 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-12-05 20:34:12 +0100 |
commit | 3b0d9e0c9c5e08b2e449aa266617fb1db86b5a22 (patch) | |
tree | f203a59c944714925d73ae2d33ad9c67d5b17070 /configure.ac | |
parent | 29ec8552826f64bfa8cad01a433306886328c522 (diff) | |
parent | 2e7176bc558cb03d4e7c27769bab9cd45c703332 (diff) |
Merge branch 'resample'
Add resample support.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 83 |
1 files changed, 75 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac index 8900d50..641f2f7 100644 --- a/configure.ac +++ b/configure.ac @@ -317,16 +317,83 @@ dnl Check for sndfile dnl ====================== PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.20) -AC_ARG_WITH(resample, [ --with-resample Build with resample support]) -if test x$with_resample == xyes; then + +AC_ARG_ENABLE([resampler], +[ --enable-resampler[=lib] Enable resampler using either 'zita' or 'src' (libsamplerate). Use 'auto' for autodetect [default=auto]],, + [enable_resampler="auto"]) +if test "x$enable_resampler" = "xyes"; then + enable_resampler="auto" +fi + +has_src=no +has_zita=no +if test x$enable_resampler != xno; then AC_MSG_WARN([*** Building resample support!]) - AC_DEFINE(WITH_RESAMPLE, [], [Use resample]) + AC_DEFINE(WITH_RESAMPLER, [], [Use resample]) - dnl ====================== - dnl Check for libsamplerate - dnl ====================== - PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.1.7) -fi + if test x$enable_resampler == xauto || test x$enable_resampler == xsrc; then + dnl ====================== + dnl Check for libsamplerate + dnl ====================== + PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.1.7, has_src=yes, has_src=no) + fi + + if test x$enable_resampler == xauto || test x$enable_resampler == xzita; then + dnl ====================== + dnl Check for the zitaresampler library + dnl ====================== + AC_LANG_PUSH([C++]) + tmp_CXXFLAGS="$CXXFLAGS" + tmp_CPPFLAGS="$CPPFLAGS" + tmp_CFLAGS="$CFLAGS" + tmp_LDFLAGS="$LDFLAGS" + tmp_LIBS="$LIBS" + CXXFLAGS="" + CPPFLAGS="$ZITA_CPPFLAGS" + CFLAGS="" + LDFLAGS="$ZITA_LDFLAGS -lzita-resampler -lpthread" + LIBS="" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([#include <zita-resampler/resampler.h>], + [Resampler r] ) ], has_zita=yes, has_zita=no) + ZITA_CPPFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS" + ZITA_LIBS="$LDFLAGS $LIBS" + CXXFLAGS="$tmp_CXXFLAGS" + CPPFLAGS="$tmp_CPPFLAGS" + CFLAGS="$tmp_CFLAGS" + LDFLAGS="$tmp_LDFLAGS" + LIBS="$tmp_LIBS" + AC_SUBST(ZITA_CPPFLAGS) + AC_SUBST(ZITA_LIBS) + AC_LANG_POP([C++]) + fi +fi + +if test x$enable_resampler == xauto; then + if test x$has_zita == xyes; then + enable_resampler=zita + elif test x$has_src == xyes; then + enable_resampler=src + else + AC_MSG_ERROR([*** No resampler library present. Either libsamplerate or zita-resampler must be installed.]) + fi +fi + +if test x$enable_resampler == xzita; then + if test x$has_zita == xyes; then + AC_DEFINE(USE_ZITA, [], [zita-resampler is present]) + else + AC_MSG_ERROR([*** zita-resampler library or headers not found. Set ZITA_LDFLAGS or ZITA_CPPFLAGS to add searchpath.]) + fi +fi + +if test x$enable_resampler == xsrc; then + if test x$has_src == xyes; then + AC_DEFINE(USE_SRC, [], [libsamplerate is present]) + else + AC_MSG_ERROR([*** Missing libsamplerate.]) + fi +fi #dnl ====================== #dnl Check for zlib |