shithub: sox

Download patch

ref: 4b6a44c0da56efeddf5fe12f72a0e19cc7b2d3b9
parent: 38ee09740775bfbd25280edd4c41cbe30d383333
author: cbagwell <cbagwell>
date: Mon May 18 22:21:44 EDT 2009

Enable libltdl on cygwin to allow dlopen() MP3 libraries.

--- a/INSTALL
+++ b/INSTALL
@@ -25,6 +25,7 @@
 LADSPA            http://www.ladspa.org                 LGPL + plugins' licence
 Lame MP3 encoder  http://lame.sourceforge.net           LGPL
 MAD MP3 decoder   http://www.underbit.com/products/mad  GPL
+MP3 ID3 tags      http://www.underbit.com/products/mad  GPL
 Magic             http://www.darwinsys.com/file         GPL
 Ogg Vorbis        http://www.vorbis.com                 BSD
 PNG               http://www.libpng.org/pub/png         zlib (BSD-like)
@@ -123,14 +124,27 @@
 dynamic DLL's will be required to be distributed with the cygwin
 executable.
 
+Alternatively, you can make use of the "cygbuild" script distributed
+with SoX source that is used to automate all steps of building
+a win32 package.
+
 Newer versions of SoX include support for loading libraries for
-file formats at runtime.  If you experience problems with this
-then you may wish to revert back to the older compile-time support.
-To stick with old behavior use:
+file formats at runtime.  The main usage of this feature is to
+allow shipping SoX without dependencies on external libraries
+that are not globally used or have redistribution restrictions.
+If you experience problems with this then you may wish to disable
+this feature:
 
 ./configure --without-libltdl
 
+Also, the default behavior even when libltdl is used is to link
+all file format handlers into libsox as there is a performance
+hit when dynamically loading external libraries.  To force a format
+handler to be built as a dynamically loaded module, pass "dyn" to
+its --with-* option.  For example, to build pulseaudio handler as
+an external dynamic library:
 
+./configure --with-pulseaudio=dyn
 
 Testing
 -------
--- a/configure.ac
+++ b/configure.ac
@@ -27,18 +27,26 @@
 
 AC_ARG_WITH(libltdl,
     AC_HELP_STRING([--without-libltdl],
-        [Don't try to use libltdl for external dynamic library support]))
+        [Don't try to use libltdl for external dynamic library support]),
+    with_libltdl=$withval, with_libltdl=default)
 
-using_libltdl=no
-if test "$with_libltdl" != "no"; then
-    dnl Disable libltdl support when building only static libraries
+if test "$with_libltdl" = "default"; then
+    dnl Default to no libltdl support when building only static libraries
     if test "$enable_shared" != "no"; then
         using_libltdl=yes
+    else
+        using_libltdl=no
     fi
+    with_libltdl="yes"
+else
+    using_libltdl=$with_libltdl
+fi
+
+if test "$with_libltdl" != "no"; then
     dnl Force off using libltdl on targets that are know to have
     dnl problems.
     case $target in
-      *cygwin* | *mingw* | *os2*)
+      *mingw32* | *os2*)
         using_libltdl=no
         ;;
     esac
@@ -278,7 +286,7 @@
       AC_HELP_STRING([--enable-dl-mad], [Dlopen mad instead of linking in.]),
       enable_dl_mad=$enableval, enable_dl_mad=no)
     AC_MSG_RESULT($enable_dl_mad)
-    if test "x$enable_dl_mad" = "xyes"; then
+    if test "x$using_libltdl" = "xyes" -a "x$enable_dl_mad" = "xyes"; then
       AC_DEFINE(DL_MAD, 1, [Define if to dlopen() mad.])
     else
       AC_CHECK_LIB(mad, mad_stream_buffer, MP3_LIBS="$MP3_LIBS -lmad",using_mad=no)
@@ -325,7 +333,7 @@
       AC_HELP_STRING([--enable-dl-lame], [Dlopen lame instead of linking in.]),
       enable_dl_lame=$enableval, enable_dl_lame=no)
     AC_MSG_RESULT($enable_dl_lame)
-    if test "x$enable_dl_lame" = "xyes"; then
+    if test "x$using_libltdl" = "xyes" -a "x$enable_dl_lame" = "xyes"; then
       AC_DEFINE(DL_LAME, 1, [Define if to dlopen() lame.])
     else
       AC_CHECK_LIB(mp3lame, lame_init, MP3_LIBS="$MP3_LIBS -lmp3lame",using_lame=no)
--- a/cygbuild
+++ b/cygbuild
@@ -7,9 +7,6 @@
 # requires to already have several external libraries already installed
 # under /usr/local.
 #
-# Since directory name in package is based on current directory name,
-# it should be ran from that *.tar.gz distribution.
-#
 # And last, it will optional package a wget compiled with VC++ instead
 # of cygwin version (which has no DLL's to distribute) if found
 # in wget-1.11.4 directory.  If not found, it will distribute the
@@ -53,7 +50,8 @@
 if [ $# -ne 0 -o ! -r Makefile ]; then
   ./configure \
     --disable-shared \
-    --without-mp3 \
+    --with-libltdl \
+    --enable-dl-lame --enable-dl-mad \
     CC=gcc-4 CPP=cpp\
     CPPFLAGS=-I/usr/local/include \
     LDFLAGS="-static -L/usr/local/lib" \
@@ -60,9 +58,10 @@
     $*
 fi
 
-make -s all pdf
+make -s all pdf txt || exit 1
 
-dir="$(basename $(pwd))"
+#dir="$(basename $(pwd))"
+dir=sox-`grep Version: sox.pc | cut -d ' ' -f 2`
 rm -rf $dir $dir.zip
 mkdir -p $dir