summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac108
1 files changed, 73 insertions, 35 deletions
diff --git a/configure.ac b/configure.ac
index d8d45d4..68dffad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -346,44 +346,82 @@ 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)
+ 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
-# 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"
-# LIBS=""
-# AC_CHECK_HEADER(zita-resampler/resampler.h, ,
-# AC_MSG_ERROR([*** zita-resampler header files not found! Set ZITA_CPPFLAGS to add searchpath.]))
-# AC_CHECK_LIB(zita-resampler, _Z28zita_resampler_major_versionv, ,
-# AC_MSG_ERROR([*** zita-resampler library not found! Set ZITA_LDFLAGS to add searchpath.]))
-# 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++])
+ 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"
+ LIBS=""
+ AC_CHECK_HEADER(zita-resampler/resampler.h,
+ AC_CHECK_LIB(zita-resampler, _Z28zita_resampler_major_versionv, has_zita=yes, has_zita=no),
+ has_zita=no)
+ ZITA_CPPFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS"
+ ZITA_LIBS="$LDFLAGS $LIBS -lzita-resampler"
+ 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 ======================