shithub: sox

Download patch

ref: 1c381cce343037ce29453fdbc82edd0fe07c91ad
parent: 92bdeaa68646ce46d235a7c47a3124ddd03026b5
author: cbagwell <cbagwell>
date: Fri Nov 27 22:08:30 EST 2009

Add support for --enable-dl-sndfile to configure (dlopen libsndfile).

--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@
   ated in  [F(ormat)] [E(ffect)]   Replacement             due after
   -------  ----------------------  ----------------------  -------
   14.3.1   F mp3: lame 3.97        lame > 3.97             2010-xx-xx
+  14.3.1   F sndfile: sndfile 1.0.11 sndfile > 1.0.11      14.3.1
 
 Previously deprecated features (to be removed in future):
 
@@ -45,10 +46,12 @@
   o CVSD encode/decode speed-ups.  (Kimberly Rockwell, P. Chaintreuil)
   o Add ability to select MP3 compression parameters.  (Jim Harkins)
   o Now writes out ID3-tags in MP3 files.  (Doug Cook)
-  o Also can write VBR Tag ("XING Header") in MP3 files. 
-    (Jim Hark/Doug Cook)
+  o Also can write VBR Tag ("XING Header") in MP3 files. (Jim Hark /
+    Doug Cook)
   o Fix failed writing 24-bit PAF files (and possibly other libsndfile
     based formats).  (cbagwell)
+  o Allow libsndfile to be dlopen()'ed at runtime if --enable-dl-sndfile
+    is used. (Doug Cook)
 
 Audio device drivers:
 
@@ -83,6 +86,8 @@
   o Move bit-rot detection support files to sub-directory (could
     previously cause build problems).  (robs)
   o [2859244] Fixes to improve compatibility with MSVC.  (Doug Cook)
+  o Added utilities to help any format handler dlopen() external
+    libraries at run time instead of link time. (Doug Cook)
 
 
 sox-14.3.0	2009-06-14
--- a/INSTALL
+++ b/INSTALL
@@ -147,6 +147,16 @@
 
 ./configure --with-pulseaudio=dyn
 
+A subset of external libraries can be configured to be dlopen()'ed
+at run time instead of being linked in.  This will allow one to
+distribute a binary with optional features that only require
+a user to install the missing libraries into their system.  This
+can be enabled using:
+
+--enable-dl-lame
+--enable-dl-mad
+--enable-dl-sndfile
+
 Testing
 -------
 
--- a/configure.ac
+++ b/configure.ac
@@ -455,8 +455,16 @@
 AC_OPTIONAL_FORMAT(sndfile, SNDFILE, [SOX_PATH_SNDFILE(, using_sndfile=no)])
 AC_SUBST(SNDFILE_CFLAGS)
 
+AC_ARG_ENABLE(dl_sndfile,
+	      AC_HELP_STRING([--enable-dl-sndfile], 
+			     [Dlopen sndfile instead of linking in.]),
+			     enable_dl_sndfile=$enableval, enable_dl_sndfile=no)
+if test "x$using_sndfile" = "xyes"; then
+  if test "x$using_libltdl" = "xyes" -a "x$enable_dl_sndfile" = "xyes"; then
+    AC_DEFINE(DL_SNDFILE, 1, [Define if to dlopen() sndfile.])
+  fi
+fi
 
-
 AC_OPTIONAL_FORMAT(ffmpeg, FFMPEG, [SOX_PATH_FFMPEG(, using_ffmpeg=no)])
 
 
@@ -587,6 +595,9 @@
 fi
 echo "oggvorbis..................$using_oggvorbis"
 echo "sndfile....................$using_sndfile"
+if test "x$using_sndfile" = "xyes"; then
+echo " dlopen sndfile............$enable_dl_sndfile"
+fi
 echo "wavpack....................$using_wavpack"
 echo
 echo "OTHER OPTIONS"
--- a/cygbuild
+++ b/cygbuild
@@ -62,7 +62,7 @@
     --disable-shared \
     --with-libltdl \
     --enable-dl-lame --enable-dl-mad \
-    CC=gcc-4 CPP=cpp\
+    CC=gcc CPP=cpp\
     CPPFLAGS=-I/usr/local/include \
     LDFLAGS="-static -L/usr/local/lib" \
     $*
--- a/src/sndfile.c
+++ b/src/sndfile.c
@@ -37,6 +37,7 @@
 static const char* const sndfile_library_names[] =
 {
 #ifdef DL_SNDFILE
+  "libsndfile",
   "libsndfile-1",
   "cygsndfile-1",
 #endif