shithub: sox

Download patch

ref: 88c963189b0322e9bd49dfa6bd337b25c69b96aa
parent: a5e16714a074879a88755d6fd17836e19d42eca1
author: cbagwell <cbagwell>
date: Sun Jan 13 22:40:06 EST 2008

Add in some missing libraries to links (required for static libraries).
Fix some compile bugs as well.

--- a/configure.ac
+++ b/configure.ac
@@ -222,10 +222,15 @@
     using_ogg=yes
     AC_CHECK_HEADER(vorbis/codec.h,
         [AC_CHECK_LIB(ogg, ogg_packet_clear, OGG_LIBS="$OGG_LIBS -logg", using_ogg=no)
-        AC_CHECK_LIB(vorbis, vorbis_analysis_headerout, OGG_LIBS="$OGG_LIBS -lvorbis", using_ogg=no)
-        AC_CHECK_LIB(vorbisfile, ov_clear, OGG_LIBS="$OGG_LIBS -lvorbisfile", using_ogg=no)
+        ac_save_LIBS=$LIBS
+        AC_CHECK_LIB(vorbis, vorbis_analysis_headerout, [], using_ogg=no, $OGG_LIBS)
+        dnl AC_CHECK_LIB appends library to LIBS which would mess
+        dnl up link order of -logg.  So manually remove it.
+        LIBS=$ac_save_LIBS
+        AC_CHECK_LIB(vorbisfile, ov_clear, [], using_ogg=no, $OGG_LIBS)
+        LIBS=$ac_save_LIBS
         AC_CHECK_LIB(vorbisenc, vorbis_encode_init_vbr, OGG_LIBS="$OGG_LIBS -lvorbisenc", using_ogg=no)],
-        using_ogg=no)
+        using_ogg=no, $OGG_LIBS)
     if test "$with_ogg" = "yes" -a "$using_ogg" = "no"; then
         AC_MSG_FAILURE([cannot find Ogg Vorbis])
     fi
@@ -287,7 +292,7 @@
     using_mad=yes
     AC_CHECK_HEADERS(mad.h,
         [AC_CHECK_LIB(mad, mad_stream_buffer, MP3_LIBS="$MP3_LIBS -lmad",using_mad=no)],
-        with_mad=no)
+        using_mad=no)
     if test "$with_mad" = "yes" -a "$using_mad" = "no"; then
         AC_MSG_FAILURE([cannot find libmad])
     fi
--- a/m4/samplerate.m4
+++ b/m4/samplerate.m4
@@ -41,6 +41,12 @@
   fi
   ])
 
+m4_ifndef([PKG_CHECK_MODULES],
+  [# PKG_CHECK_MODULES not available
+  # Best guess is that samplerate only needs to link against itself
+  SAMPLERATE_LIBS="-lsamplerate"
+  ])
+
 # Now try actually using libsamplerate
 if test "$have_samplerate" != "no"
 then
@@ -48,6 +54,7 @@
   ac_save_LIBS="$LIBS"
   CFLAGS="$CFLAGS $SAMPLERATE_CFLAGS"
   LIBS="$LIBS $SAMPLERATE_LIBS"
+  dnl Must hardcode samplerate library if we can not get it from pkg-config
   AC_CHECK_HEADER([samplerate.h], [
     AC_DEFINE([HAVE_SAMPLERATE_H], 1, [Define if you have <samplerate.h>])
     AC_CHECK_FUNC([src_new], [
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -288,7 +288,7 @@
 
 EXTRA_DIST = tests.sh testall.sh tests.bat testall.bat monkey.au monkey.wav sox_sample_test.c amr-wb-test CMakeLists.txt soxstdint.h.cmake soxconfig.h.cmake example1.c
 
-all: sox$(EXEEXT) play rec sox_sample_test example1
+all: sox$(EXEEXT) play rec sox_sample_test$(EXEEXT) example1$(EXEEXT)
 
 play rec: sox$(EXEEXT)
 	./sox --help > /dev/null