ref: b9e77a7ff0997a63ed568b9573e3725eb69c87d3
parent: 867e2c23d814b664cea10acae920a3fb698c3656
author: cbagwell <cbagwell>
date: Sun Nov 29 20:08:14 EST 2009
Only link in external libraries once. For shared libsox, link into libsox. For static libsox, link into sox application. Prevents duplicate symbols.
--- a/configure.ac
+++ b/configure.ac
@@ -589,7 +589,7 @@
pkgconfig_option="$with_pkgconfigdir"
fi
-
+AM_CONDITIONAL(STATIC_LIBSOX_ONLY, test "$enable_shared" = "no" -a "$enable_static" = "yes")
# Report configuration.
echo
--- a/src/optional-fmts.am
+++ b/src/optional-fmts.am
@@ -3,9 +3,12 @@
if HAVE_ALSA
if STATIC_ALSA
libsox_la_SOURCES += alsa.c
- libsox_la_LIBADD += @ALSA_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @ALSA_LIBS@
else
+ libsox_la_LIBADD += @ALSA_LIBS@
+endif
+else
libsox_fmt_alsa_la_SOURCES = alsa.c
libsox_fmt_alsa_la_LIBADD = libsox.la @ALSA_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_alsa.la
@@ -15,9 +18,12 @@
if HAVE_AMRNB
if STATIC_AMRNB
libsox_la_SOURCES += amr-nb.c amr.h amr1.h amr2.h
- libsox_la_LIBADD += @AMRNB_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @AMRNB_LIBS@
else
+ libsox_la_LIBADD += @AMRNB_LIBS@
+endif
+else
libsox_fmt_amr_nb_la_SOURCES = amr-nb.c amr.h amr1.h amr2.h
libsox_fmt_amr_nb_la_LIBADD = libsox.la @AMRNB_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_amr_nb.la
@@ -27,9 +33,12 @@
if HAVE_AMRWB
if STATIC_AMRWB
libsox_la_SOURCES += amr-wb.c amr.h amr1.h amr2.h
- libsox_la_LIBADD += @AMRWB_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @AMRWB_LIBS@
else
+ libsox_la_LIBADD += @AMRWB_LIBS@
+endif
+else
libsox_fmt_amr_wb_la_SOURCES = amr-wb.c amr.h amr1.h amr2.h
libsox_fmt_amr_wb_la_LIBADD = libsox.la @AMRWB_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_amr_wb.la
@@ -39,9 +48,12 @@
if HAVE_AO
if STATIC_AO
libsox_la_SOURCES += ao.c
- libsox_la_LIBADD += @AO_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @AO_LIBS@
else
+ libsox_la_LIBADD += @AO_LIBS@
+endif
+else
libsox_fmt_ao_la_SOURCES = ao.c
libsox_fmt_ao_la_LIBADD = libsox.la @AO_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_ao.la
@@ -51,9 +63,12 @@
if HAVE_COREAUDIO
if STATIC_COREAUDIO
libsox_la_SOURCES += coreaudio.c
- libsox_la_LIBADD += @COREAUDIO_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @COREAUDIO_LIBS@
else
+ libsox_la_LIBADD += @COREAUDIO_LIBS@
+endif
+else
libsox_fmt_coreaudio_la_SOURCES = coreaudio.c
libsox_fmt_coreaudio_la_LIBADD = libsox.la @COREAUDIO_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_coreaudio.la
@@ -63,9 +78,12 @@
if HAVE_FFMPEG
if STATIC_FFMPEG
libsox_la_SOURCES += ffmpeg.c ffmpeg.h
- libsox_la_LIBADD += @FFMPEG_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @FFMPEG_LIBS@
else
+ libsox_la_LIBADD += @FFMPEG_LIBS@
+endif
+else
libsox_fmt_ffmpeg_la_SOURCES = ffmpeg.c ffmpeg.h
libsox_fmt_ffmpeg_la_LIBADD = libsox.la @FFMPEG_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_ffmpeg.la
@@ -75,9 +93,12 @@
if HAVE_FLAC
if STATIC_FLAC
libsox_la_SOURCES += flac.c
- libsox_la_LIBADD += @FLAC_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @FLAC_LIBS@
else
+ libsox_la_LIBADD += @FLAC_LIBS@
+endif
+else
libsox_fmt_flac_la_SOURCES = flac.c
libsox_fmt_flac_la_LIBADD = libsox.la @FLAC_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_flac.la
@@ -87,9 +108,12 @@
if HAVE_GSM
if STATIC_GSM
libsox_la_SOURCES += gsm.c
- libsox_la_LIBADD += @GSM_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @GSM_LIBS@
else
+ libsox_la_LIBADD += @GSM_LIBS@
+endif
+else
libsox_fmt_gsm_la_SOURCES = gsm.c
libsox_fmt_gsm_la_LIBADD = libsox.la @GSM_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_gsm.la
@@ -99,9 +123,12 @@
if HAVE_LPC10
if STATIC_LPC10
libsox_la_SOURCES += lpc10.c
- libsox_la_LIBADD += @LPC10_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @LPC10_LIBS@
else
+ libsox_la_LIBADD += @LPC10_LIBS@
+endif
+else
libsox_fmt_lpc10_la_SOURCES = lpc10.c
libsox_fmt_lpc10_la_LIBADD = libsox.la @LPC10_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_lpc10.la
@@ -111,9 +138,12 @@
if HAVE_MP3
if STATIC_MP3
libsox_la_SOURCES += mp3.c mp3-util.h
- libsox_la_LIBADD += @MP3_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @MP3_LIBS@
else
+ libsox_la_LIBADD += @MP3_LIBS@
+endif
+else
libsox_fmt_mp3_la_SOURCES = mp3.c mp3-util.h
libsox_fmt_mp3_la_LIBADD = libsox.la @MP3_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_mp3.la
@@ -123,9 +153,12 @@
if HAVE_OSS
if STATIC_OSS
libsox_la_SOURCES += oss.c
- libsox_la_LIBADD += @OSS_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @OSS_LIBS@
else
+ libsox_la_LIBADD += @OSS_LIBS@
+endif
+else
libsox_fmt_oss_la_SOURCES = oss.c
libsox_fmt_oss_la_LIBADD = libsox.la @OSS_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_oss.la
@@ -135,9 +168,12 @@
if HAVE_PULSEAUDIO
if STATIC_PULSEAUDIO
libsox_la_SOURCES += pulseaudio.c
- libsox_la_LIBADD += @PULSEAUDIO_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @PULSEAUDIO_LIBS@
else
+ libsox_la_LIBADD += @PULSEAUDIO_LIBS@
+endif
+else
libsox_fmt_pulseaudio_la_SOURCES = pulseaudio.c
libsox_fmt_pulseaudio_la_LIBADD = libsox.la @PULSEAUDIO_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_pulseaudio.la
@@ -147,9 +183,12 @@
if HAVE_WAVEAUDIO
if STATIC_WAVEAUDIO
libsox_la_SOURCES += waveaudio.c
- libsox_la_LIBADD += @WAVEAUDIO_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @WAVEAUDIO_LIBS@
else
+ libsox_la_LIBADD += @WAVEAUDIO_LIBS@
+endif
+else
libsox_fmt_waveaudio_la_SOURCES = waveaudio.c
libsox_fmt_waveaudio_la_LIBADD = libsox.la @WAVEAUDIO_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_waveaudio.la
@@ -160,8 +199,12 @@
if STATIC_SNDIO
libsox_la_SOURCES += sndio.c
libsox_la_LIBADD += @SNDIO_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @SNDIO_LIBS@
else
+ libsox_la_LIBADD += @SNDIO_LIBS@
+endif
+else
libsox_fmt_sndio_la_SOURCES = sndio.c
libsox_fmt_sndio_la_LIBADD = libsox.la @SNDIO_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_sndio.la
@@ -171,9 +214,12 @@
if HAVE_SUN_AUDIO
if STATIC_SUN_AUDIO
libsox_la_SOURCES += sunaudio.c
- libsox_la_LIBADD += @SUN_AUDIO_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @SUN_AUDIO_LIBS@
else
+ libsox_la_LIBADD += @SUN_AUDIO_LIBS@
+endif
+else
libsox_fmt_sunau_la_SOURCES = sunaudio.c
libsox_fmt_sunau_la_LIBADD = libsox.la @SUN_AUDIO_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_sunau.la
@@ -183,9 +229,12 @@
if HAVE_OGG_VORBIS
if STATIC_OGG_VORBIS
libsox_la_SOURCES += vorbis.c
- libsox_la_LIBADD += @OGG_VORBIS_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @OGG_VORBIS_LIBS@
else
+ libsox_la_LIBADD += @OGG_VORBIS_LIBS@
+endif
+else
libsox_fmt_vorbis_la_SOURCES = vorbis.c
libsox_fmt_vorbis_la_LIBADD = libsox.la @OGG_VORBIS_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_vorbis.la
@@ -195,9 +244,12 @@
if HAVE_WAVPACK
if STATIC_WAVPACK
libsox_la_SOURCES += wavpack.c
- libsox_la_LIBADD += @WAVPACK_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @WAVPACK_LIBS@
else
+ libsox_la_LIBADD += @WAVPACK_LIBS@
+endif
+else
libsox_fmt_wavpack_la_SOURCES = wavpack.c
libsox_fmt_wavpack_la_LIBADD = libsox.la @WAVPACK_LIBS@
pkglib_LTLIBRARIES += libsox_fmt_wavpack.la
@@ -209,8 +261,11 @@
if STATIC_SNDFILE
libsox_la_SOURCES += sndfile.c caf.c mat4.c mat5.c paf.c fap.c w64.c xi.c pvf.c sd2.c
libsox_la_CFLAGS += @SNDFILE_CFLAGS@
- libsox_la_LIBADD += @SNDFILE_LIBS@
+if STATIC_LIBSOX_ONLY
sox_LDADD += @SNDFILE_LIBS@
+else
+ libsox_la_LIBADD += @SNDFILE_LIBS@
+endif
else
libsox_fmt_sndfile_la_SOURCES = sndfile.c
libsox_fmt_sndfile_la_CFLAGS = @WARN_CFLAGS@ @SNDFILE_CFLAGS@