shithub: sox

Download patch

ref: 0ab7230f60d5e5767d41509d416947e634dee1d0
parent: 334287d880b9248feb636cad2172d18f0b795cc9
author: cbagwell <cbagwell>
date: Sat Nov 28 10:48:18 EST 2009

Don't link in sndfile with --enable-dl-sndfile.

--- a/configure.ac
+++ b/configure.ac
@@ -287,7 +287,7 @@
       enable_dl_mad=$enableval, enable_dl_mad=no)
     AC_MSG_RESULT($enable_dl_mad)
     if test "x$using_libltdl" = "xyes" -a "x$enable_dl_mad" = "xyes"; then
-      AC_DEFINE(DL_MAD, 1, [Define if to dlopen() mad.])
+      AC_DEFINE(DL_MAD, 1, [Define to dlopen() mad.])
     else
       AC_CHECK_LIB(mad, mad_stream_buffer, MP3_LIBS="$MP3_LIBS -lmad",using_mad=no)
       if test "$with_mad" = "yes" -a "$using_mad" = "no"; then
@@ -334,7 +334,7 @@
       enable_dl_lame=$enableval, enable_dl_lame=no)
     AC_MSG_RESULT($enable_dl_lame)
     if test "x$using_libltdl" = "xyes" -a "x$enable_dl_lame" = "xyes"; then
-      AC_DEFINE(DL_LAME, 1, [Define if to dlopen() lame.])
+      AC_DEFINE(DL_LAME, 1, [Define to dlopen() lame.])
     else
       AC_CHECK_LIB(mp3lame, lame_init, MP3_LIBS="$MP3_LIBS -lmp3lame",using_lame=no)
       AC_CHECK_LIB(mp3lame, lame_get_lametag_frame)
@@ -455,10 +455,10 @@
 
 AC_OPTIONAL_FORMAT(waveaudio, WAVEAUDIO, [AC_CHECK_HEADER(mmsystem.h, [WAVEAUDIO_LIBS="$WAVEAUDIO_LIBS -lwinmm"], using_waveaudio=no, [[#include <windows.h>]])])
 
-
-AC_OPTIONAL_FORMAT(sndfile, SNDFILE, [SOX_PATH_SNDFILE(, using_sndfile=no)])
-AC_SUBST(SNDFILE_CFLAGS)
-
+dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
+dnl to be linked in (since they will be dlopen()'ed instead).
+ac_sox_save_SNDFILE_LIBS="$SNDFILE_LIBS"
+SOX_PATH_SNDFILE(using_sndfile=no)
 AC_ARG_ENABLE(dl_sndfile,
 	      AC_HELP_STRING([--enable-dl-sndfile], 
 			     [Dlopen sndfile instead of linking in.]),
@@ -465,9 +465,13 @@
 			     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.])
+    AC_DEFINE(DL_SNDFILE, 1, [Define to dlopen() sndfile.]) 
+    dnl When enable_dl_sndfile, do not let SOX_PATH_SNDFILE add libraries
+    dnl to be linked in (since they will be dlopen()'ed instead).
+    SNDFILE_LIBS="$ac_sox_save_SNDFILE_LIBS"
   fi
 fi
+AC_OPTIONAL_FORMAT(sndfile, SNDFILE)
 
 AC_OPTIONAL_FORMAT(ffmpeg, FFMPEG, [SOX_PATH_FFMPEG(, using_ffmpeg=no)])
 
--- a/cygbuild
+++ b/cygbuild
@@ -40,8 +40,8 @@
 # cd ../libvorbis-1.2.0
 #./configure --disable-shared --enable-static;make;make install
 #
-# cd ../libsndfile-1.0.19
-#./configure --disable-shared --enable-static;make;make install
+# cd ../libsndfile-1.0.20
+#./configure --disable-shared --enable-static --disable-external-libs;make;make install
 #
 # To get MP3 header files used to enable MP3 support (no libraries used):
 #
@@ -57,6 +57,8 @@
 # CPP variable. If you see warning messages about header files
 # rejected by preprocessor then its most likely from that.
 # Force the value of CPP=cpp works around that bug.
+# static versions of libsndfile do not advertise when they have
+# FLAC or ogg vorbis support.  Need to force the link ourselves.
 if [ $# -ne 0 -o ! -r Makefile ]; then
   ./configure \
     --disable-shared \
--- a/m4/sndfile.m4
+++ b/m4/sndfile.m4
@@ -20,8 +20,8 @@
   AC_PATH_PROG([PKGCONFIG], [pkg-config], [none])
   if test "$PKGCONFIG" != "none" && `$PKGCONFIG --exists sndfile`
   then
-    SNDFILE_CFLAGS=`$PKGCONFIG --cflags sndfile`
-    SNDFILE_LIBS=`$PKGCONFIG --libs sndfile`
+    SNDFILE_CFLAGS=`$PKGCONFIG --cflags sndfile`" $ac_save_SNDFILE_CFLAGS $SNDFILE_CFLAGS"
+    SNDFILE_LIBS=`$PKGCONFIG --libs sndfile`" $ac_save_SNDFILE_LIBS $SNDFILE_LIBS"
     have_sndfile="maybe"
   else
     have_sndfile="no"
@@ -35,7 +35,7 @@
   # As a last resort, just hope that header and ilbrary can
   # be found in default paths and that it doesn't need
   # to link against any other libraries.
-  SNDFILE_LIBS="-lsndfile"
+  SNDFILE_LIBS="-lsndfile $SNDFILE_LIBS"
   have_sndfile="maybe"
 fi