conditionally build the sound format support files

Rather than using an ifdef around the entire code, get autoconf to do the work
for us. For one thing, this allows doxygen to produce decent docs. It also
makes for less compalation when building without support for various formats.
This commit is contained in:
Bill Currie 2010-08-11 23:42:42 +00:00 committed by Jeff Teunissen
parent d045045693
commit d0906f1453
5 changed files with 43 additions and 28 deletions

View file

@ -579,6 +579,17 @@ case "$target_os" in
;;
esac
AC_ARG_ENABLE(flac,
[ --disable-flac disable flac support],
)
HAVE_FLAC=no
if test "x$enable_flac" != "xno"; then
AM_PATH_LIBFLAC(HAVE_FLAC=yes, HAVE_FLAC=no)
if test "x$HAVE_FLAC" = xyes; then
AC_DEFINE(HAVE_FLAC, 1, [define this if you have flac libs])
fi
fi
AC_ARG_ENABLE(wildmidi,
[ --disable-wildmidi disable libWildMidi support],
)
@ -594,13 +605,11 @@ if test "x$enable_wildmidi" != "xno"; then
fi
fi
fi
AC_SUBST(WM_LIBS)
AC_ARG_ENABLE(vorbis,
[ --disable-vorbis disable ogg vorbis support],
)
HAVE_VORBIS=no
if test "x$enable_vorbis" != "xno"; then
XIPH_PATH_OGG(HAVE_OGG=yes, HAVE_OGG=no)
@ -612,17 +621,9 @@ if test "x$enable_vorbis" != "xno"; then
fi
fi
AC_ARG_ENABLE(flac,
[ --disable-flac disable flac support],
)
HAVE_FLAC=no
if test "x$enable_flac" != "xno"; then
AM_PATH_LIBFLAC(HAVE_FLAC=yes, HAVE_FLAC=no)
if test "x$HAVE_FLAC" = xyes; then
AC_DEFINE(HAVE_FLAC, 1, [define this if you have flac libs])
fi
fi
AM_CONDITIONAL(HAVE_FLAC, test "x$HAVE_FLAC" = "xyes")
AM_CONDITIONAL(HAVE_MIDI, test "x$HAVE_MIDI" = "xyes")
AM_CONDITIONAL(HAVE_VORBIS, test "x$HAVE_VORBIS" = "xyes")
AC_ARG_ENABLE(zlib,
[ --disable-zlib disable zlib support],

View file

@ -12,15 +12,40 @@ EXTRA_LTLIBRARIES= snd_render_default.la snd_render_jack.la
noinst_LTLIBRARIES= @SND_REND_STATIC@
snd_common=snd_channels.c snd_mem.c snd_mix.c snd_resample.c snd_sfx.c \
flac.c vorbis.c wav.c midi.c
flac_src=flac.c
midi_src=midi.c
vorbis_src=vorbis.c
wav_src=wav.c
if HAVE_FLAC
have_flac_src=$(flac_src)
else
have_flac_src=
endif
if HAVE_MIDI
have_midi_src=$(midi_src)
else
have_midi_src=
endif
if HAVE_VORBIS
have_vorbis_src=$(vorbis_src)
else
have_vorbis_src=
endif
have_wav_src=$(wav_src)
format_src=$(have_flac_src) $(have_midi_src) $(have_vorbis_src) $(have_wav_src)
extra_format_src=flac.c midi.c vorbis.c wav.c
snd_common=snd_channels.c snd_mem.c snd_mix.c snd_resample.c snd_sfx.c
snd_render_default_la_LDFLAGS= $(plugin_ldflags)
snd_render_default_la_SOURCES= snd_dma.c $(snd_common)
snd_render_default_la_SOURCES= snd_dma.c $(snd_common) $(format_src)
snd_render_default_la_LIBADD= $(VORBISFILE_LIBS) $(VORBIS_LIBS) $(LIBFLAC_LIBS) $(OGG_LIBS) $(WM_LIBS) $(top_builddir)/libs/util/libQFutil.la $(top_builddir)/libs/models/libQFmodels.la
snd_render_default_la_DEPENDENCIES=
EXTRA_snd_render_default_la_SOURCES= $(extra_format_src)
snd_render_jack_la_LDFLAGS= $(plugin_ldflags)
snd_render_jack_la_SOURCES= snd_jack.c $(snd_common)
snd_render_jack_la_SOURCES= snd_jack.c $(snd_common) $(format_src)
snd_render_jack_la_LIBADD= $(VORBISFILE_LIBS) $(VORBIS_LIBS) $(LIBFLAC_LIBS) $(OGG_LIBS) $(WM_LIBS) $(JACK_LIBS) $(top_builddir)/libs/util/libQFutil.la $(top_builddir)/libs/models/libQFmodels.la
snd_render_jack_la_DEPENDENCIES=
EXTRA_snd_render_jack_la_SOURCES= $(extra_format_src)

View file

@ -34,8 +34,6 @@
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#ifdef HAVE_FLAC
#ifdef HAVE_STRING_H
# include "string.h"
#endif
@ -503,5 +501,3 @@ SND_LoadFLAC (QFile *file, sfx_t *sfx, char *realname)
}
return 0;
}
#endif//HAVE_FLAC

View file

@ -31,8 +31,6 @@
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#ifdef HAVE_WILDMIDI
#ifdef HAVE_STRING_H
# include <string.h>
#endif
@ -184,4 +182,3 @@ SND_LoadMidi (QFile *file, sfx_t *sfx, char *realname)
SND_SFX_Stream (sfx, realname, info, midi_stream_open);
return 0;
}
#endif // HAVE_WILDMIDI

View file

@ -34,8 +34,6 @@
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#ifdef HAVE_VORBIS
#ifdef HAVE_STRING_H
# include "string.h"
#endif
@ -296,5 +294,3 @@ SND_LoadOgg (QFile *file, sfx_t *sfx, char *realname)
}
return 0;
}
#endif//HAVE_VORBIS