shithub: sox

Download patch

ref: 367f1ee690609d7173ba2e51d74d17fd3182b350
parent: 375fdbf982bc4b40adbafcc3c24e020d399186e7
author: cbagwell <cbagwell>
date: Sun Aug 5 22:34:57 EDT 2007

Allow disabling llibltdl even when building shared libraries.

--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,7 @@
 ACLOCAL_AMFLAGS = -I m4
 
 SUBDIRS = lpc10 @LIBGSM_SUBDIR@ src
-if USE_LIBLTDL
+if HAVE_LIBLTDL
 SUBDIRS += libltdl
 endif
 DIST_SUBDIRS = libltdl lpc10 src
--- a/configure.ac
+++ b/configure.ac
@@ -18,8 +18,21 @@
 AM_PROG_CC_C_O
 AC_PROG_INSTALL
 AC_PROG_LN_S
-# Disable libltdl support when building only static libraries
-if test "$enable_shared" != "no"; then
+
+AC_ARG_WITH(libltdl,
+    AC_HELP_STRING([--without-libltdl],
+        [Don't try to use libltdl for external dynamic library support]),
+        [with_libltdl=$withval])
+
+using_libltdl=no
+if test "$with_libltdl" != "no"; then
+    # Disable libltdl support when building only static libraries
+    if test "$enable_shared" != "no"; then
+        using_libltdl=yes
+    fi
+fi
+
+if test "$using_libltdl" != "no"; then
   AC_LIBLTDL_INSTALLABLE
   AC_LIBTOOL_DLOPEN
 fi
@@ -26,12 +39,13 @@
 AC_PROG_LIBTOOL
 AC_SUBST(LIBTOOL_DEPS)
 AC_CONFIG_SUBDIRS(libltdl)
-if test "$enable_shared" != "no"; then
+if test "$using_libltdl" != "no"; then
   AC_SUBST(LIBLTDL)
   AC_SUBST(LTDLINCL)
-  AC_CHECK_HEADERS(ltdl.h)
+  AC_CHECK_HEADERS(ltdl.h, AC_DEFINE([HAVE_LIBLTDL], 1, [Define to 1 if you have LIBLTDL.]), [using_libltdl=no])
+
 fi
-AM_CONDITIONAL(USE_LIBLTDL, test x$enable_shared = xyes)
+AM_CONDITIONAL(HAVE_LIBLTDL, test x$using_libltdl = xyes)
 
 m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG])
 
@@ -51,10 +65,11 @@
 dnl Extra CFLAGS if we have gcc
 if test "$GCC" = yes; then
     CFLAGS="$CFLAGS -Wall -W -Wmissing-prototypes -Wstrict-prototypes -pedantic"
-    dnl Stricter policy on GNU/Linux, all symbols must be resolved
+    dnl Define stricter policy on GNU/Linux, all symbols must be resolved
     case $target in
       *linux*)
-        LDFLAGS="$LDFLAGS -Wl,-z,defs";;
+        LDFLAGS="$LDFLAGS -Wl,-z,defs"
+        ;;
     esac
 fi
 
@@ -338,7 +353,7 @@
 dnl Report configuration.
 echo
 echo "Debugging build................... $enable_debug"
-echo "Support dynamic modules........... $enable_shared"
+echo "External module support........... $using_libltdl"
 echo "ALSA driver....................... $enable_alsa"
 echo "libao driver...................... $enable_libao"
 echo "OSS driver........................ $enable_oss"
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,7 +23,7 @@
 # libsox Dynamic Libraries for File Formats #
 #############################################
 
-if USE_LIBLTDL
+if HAVE_LIBLTDL
 # Format modules; listed first so optional ones can be added later
 pkglib_LTLIBRARIES = libsox_fmt_auto.la libsox_fmt_raw.la libsox_fmt_s1.la \
 	  libsox_fmt_s2.la libsox_fmt_s3.la libsox_fmt_s4.la libsox_fmt_u1.la \
@@ -208,7 +208,7 @@
 	  soxconfig.h
 libsox_la_CFLAGS = 
 
-if USE_LIBLTDL
+if HAVE_LIBLTDL
 else
   libsox_la_SOURCES += auto.c raw-fmt.c s1-fmt.c s2-fmt.c s3-fmt.c \
     s4-fmt.c u1-fmt.c u2-fmt.c u3-fmt.c u4-fmt.c al-fmt.c la-fmt.c ul-fmt.c \
@@ -216,6 +216,8 @@
     dvms-fmt.c dat.c gsm.c hcom.c lpc10.c maud.c prc.c sf.c sfircam.h smp.c \
     sndrtool.c sphere.c tx16w.c voc.c vox-fmt.c ima-fmt.c adpcm.c adpcm.h \
     ima_rw.c ima_rw.h wav.c wav.h wve.c xa.c nulfile.c
+libsox_la_LIBADD = @GSM_LIBS@ @LIBGSM_LIBADD@
+libsox_la_LIBADD += ../lpc10/liblpc10.la
 
 sox_LDADD += @GSM_LIBS@ @LIBGSM_LIBADD@
 sox_LDADD += ../lpc10/liblpc10.la
@@ -222,43 +224,53 @@
 
 if HAVE_FLAC
     libsox_la_SOURCES += flac.c
+    libsox_la_LIBADD += @FLAC_LIBS@
     sox_LDADD += @FLAC_LIBS@
 endif
 if HAVE_FFMPEG
     libsox_la_SOURCES += ffmpeg.c
+    libsox_la_LIBADD += @FFMPEG_LIBS@
     sox_LDADD += @FFMPEG_LIBS@
 endif
 if HAVE_SNDFILE
     libsox_la_SOURCES += sndfile.c
     libsox_la_CFLAGS += @SNDFILE_CFLAGS@
+    libsox_la_LIBADD += @SNDFILE_LIBS@
     sox_LDADD += @SNDFILE_LIBS@
 endif
 if HAVE_AMR_WB
     libsox_la_SOURCES += amr-wb.c
+    libsox_la_LIBADD += @AMR_WB_LIBS@
     sox_LDADD += @AMR_WB_LIBS@
 endif
 if HAVE_AMR_NB
     libsox_la_SOURCES += amr-nb.c
+    libsox_la_LIBADD += @AMR_NB_LIBS@
     sox_LDADD += @AMR_NB_LIBS@
 endif
 if HAVE_MP3
     libsox_la_SOURCES += mp3.c
+    libsox_la_LIBADD += @MP3_LIBS@
     sox_LDADD += @MP3_LIBS@
 endif
 if HAVE_OGG_VORBIS
     libsox_la_SOURCES += vorbis.c
+    libsox_la_LIBADD += @OGG_LIBS@
     sox_LDADD += @OGG_LIBS@
 endif
 if HAVE_ALSA
     libsox_la_SOURCES += alsa.c
+    libsox_la_LIBADD += @ALSA_LIBS@
     sox_LDADD += @ALSA_LIBS@
 endif
 if HAVE_LIBAO
     libsox_la_SOURCES += ao.c
+    libsox_la_LIBADD += @AO_LIBS@
     sox_LDADD += @AO_LIBS@
 endif
 if HAVE_OSS
     libsox_la_SOURCES += oss.c
+    libsox_la_LIBADD += @OSS_LIBS@
     sox_LDADD += @OSS_LIBS@
 endif
 if HAVE_SUN_AUDIO
@@ -265,7 +277,7 @@
     libsox_la_SOURCES += sunaudio.c
 endif
 
-#end !USE_LIBLTDL
+#end !HAVE_LIBLTDL
 endif
 
 EXTRA_DIST = tests.sh testall.sh tests.bat testall.bat monkey.au monkey.wav libgsm
--- a/src/formats.c
+++ b/src/formats.c
@@ -12,7 +12,7 @@
 
 /* File format handlers. */
 
-#ifdef HAVE_LTDL_H
+#ifdef HAVE_LIBLTDL
 /* FIXME: Use a vector, not a fixed-size array */
   #define MAX_FORMATS 256
   unsigned sox_formats = 0;
--- a/src/sox.c
+++ b/src/sox.c
@@ -39,7 +39,7 @@
   #include <io.h>
 #endif
 
-#ifdef HAVE_LTDL_H
+#ifdef HAVE_LIBLTDL
   #include <ltdl.h>
 #endif
 
@@ -147,7 +147,7 @@
 
 /* Plugins */
 
-#ifdef HAVE_LTDL_H
+#ifdef HAVE_LIBLTDL
 static sox_bool plugins_initted = sox_false;
 #endif
 
@@ -358,7 +358,7 @@
     free(ofile);
   }
 
-#ifdef HAVE_LTDL_H
+#ifdef HAVE_LIBLTDL
   {
     int ret;
     if (plugins_initted && (ret = lt_dlexit()) != 0) {
@@ -619,7 +619,7 @@
 }
 
 /* FIXME: Use vasprintf */
-#ifdef HAVE_LTDL_H
+#ifdef HAVE_LIBLTDL
 #define MAX_NAME_LEN 1024
 static int init_format(const char *file, lt_ptr data)
 {
@@ -646,7 +646,7 @@
 
 static void find_formats(void)
 {
-#ifdef HAVE_LTDL_H
+#ifdef HAVE_LIBLTDL
   int ret;
 
   if ((ret = lt_dlinit()) != 0) {