Commit 17e3b7f8 authored by Ralph Giles's avatar Ralph Giles

Fix the conditional build stuff.

First, do configure substitution on the top-level subdirs, with DIST_SUBDIRS backup to include everything in 'make dist'. This is cleaner than the previous method of conditionalizing the program-specific makefiles.

Second, switch to configure addition of conditional obj files for optional codec support in ogg123. the AM_CONDITIONAL source method is cleaner for this since the build details are all in the Makefile. However, this only really works in automake 1.7; earlier versions require the matching object files to be in the _LDADD and _DEPENDENCIES lines. If configure is generating these anyway, we might as well simplify the Makefile.am's to rely entirely on substitution.

Also, check for the OggFLAC library as well as FLAC, since these can be installed independently on some distributions.

svn path=/trunk/vorbis-tools/; revision=4995
parent 0feaaf21
......@@ -2,7 +2,9 @@
AUTOMAKE_OPTIONS = foreign dist-zip
SUBDIRS = po intl include share oggenc ogg123 vorbiscomment vcut oggdec ogginfo debian win32
SUBDIRS = po intl include share debian win32 @OPT_SUBDIRS@
DIST_SUBDIRS = po intl include share debian win32 ogg123 oggenc oggdec ogginfo \
vcut vorbiscomment
EXTRA_DIST = README AUTHORS COPYING vorbis-tools.spec acinclude.m4 config.h
......
......@@ -32,7 +32,7 @@ dnl --------------------------------------------------
AC_CANONICAL_HOST
casecflags_save="$CFLAGS"
cflags_save="$CFLAGS"
ldflags_save="$LDFLAGS"
if test -z "$GCC"; then
case $host in
......@@ -110,6 +110,7 @@ SOCKET_LIBS=
AC_CHECK_LIB(socket, socket, SOCKET_LIBS="-lsocket")
AC_CHECK_LIB(nsl, gethostbyname, SOCKET_LIBS="-lnsl $SOCKET_LIBS")
dnl --------------------------------------------------
dnl Check for ogg123 critical libraries and other optional libraries
dnl --------------------------------------------------
......@@ -128,12 +129,17 @@ fi
dnl -------------------- FLAC ----------------------
FLAC_LIBS=
AC_CHECK_LIB(m,log,FLAC_EXTRA_LIBS="-lm")
AC_CHECK_LIB(FLAC, FLAC__stream_decoder_process_single,have_libFLAC=yes,
AC_MSG_WARN(libFLAC missing)
have_libFLAC=no, $FLAC_EXTRA_LIBS
FLAC_LIBS=""
AC_CHECK_LIB(m,log,FLAC_LIBS="-lm")
AC_CHECK_LIB(FLAC, [FLAC__stream_decoder_process_single],
[have_libFLAC=yes; FLAC_LIBS="-lFLAC $FLAC_LIBS"],
AC_MSG_WARN([libFLAC missing])
have_libFLAC=no, [$FLAC_LIBS]
)
AC_CHECK_LIB(OggFLAC, [OggFLAC__stream_decoder_new],
[FLAC_LIBS="-lOggFLAC $FLAC_LIBS"],
AC_MSG_WARN([libOggFLAC missing])
have_libFLAC=no, [$FLAC_LIBS]
)
AC_CHECK_HEADER(FLAC/stream_decoder.h,,
AC_MSG_WARN(libFLAC headers missing)
......@@ -142,22 +148,21 @@ AC_CHECK_HEADER(FLAC/stream_decoder.h,,
if test "x$have_libFLAC" = xyes; then
if test "x$build_flac" = xyes; then
AC_DEFINE(HAVE_LIBFLAC)
FLAC_LIBS="$FLAC_EXTRA_LIBS -lFLAC -lOggFLAC"
fi
else
build_flac="no"
FLAC_LIBS=""
fi
AM_CONDITIONAL(HAVE_LIBFLAC, test "x$build_flac" = xyes)
AC_SUBST(FLAC_LIBS)
dnl ------------------- Speex ------------------------
SPEEX_LIBS=
AC_CHECK_LIB(m,log,SPEEX_EXTRA_LIBS="-lm")
AC_CHECK_LIB(speex, speex_decoder_init,have_libspeex=yes,
SPEEX_LIBS=""
AC_CHECK_LIB(m,log,SPEEX_LIBS="-lm")
AC_CHECK_LIB(speex, [speex_decoder_init],
[have_libspeex=yes; SPEEX_LIBS="-lspeex $SPEEX_LIBS"],
AC_MSG_WARN(libspeex missing)
have_libspeex=no, $SPEEX_EXTRA_LIBS
have_libspeex=no, [$SPEEX_LIBS]
)
AC_CHECK_HEADER(speex.h,,
AC_MSG_WARN(libspeex headers missing)
......@@ -166,15 +171,13 @@ AC_CHECK_HEADER(speex.h,,
if test "x$have_libspeex" = xyes; then
if test "x$build_speex" = xyes; then
AC_DEFINE(HAVE_LIBSPEEX)
SPEEX_LIBS="$SPEEX_EXTRA_LIBS -lspeex"
fi
else
build_speex="no"
SPEEX_LIBS=""
fi
AM_CONDITIONAL(HAVE_LIBSPEEX, test "x$build_speex" = xyes)
AC_SUBST(SPEEX_LIBS)
dnl --------------------------------------------------
dnl Check for library functions
dnl --------------------------------------------------
......@@ -204,12 +207,39 @@ dnl --------------------------------------------------
dnl Do substitutions
dnl --------------------------------------------------
AM_CONDITIONAL(BUILD_OGG123, test "x$build_ogg123" = xyes)
AM_CONDITIONAL(BUILD_OGGDEC, test "x$build_oggdec" = xyes)
AM_CONDITIONAL(BUILD_OGGENC, test "x$build_oggenc" = xyes)
AM_CONDITIONAL(BUILD_OGGINFO, test "x$build_ogginfo" = xyes)
AM_CONDITIONAL(BUILD_VCUT, test "x$build_vcut" = xyes)
AM_CONDITIONAL(BUILD_VORBISCOMMENT, test "x$build_vorbiscomment" = xyes)
# add optional subdirs to the build
OPT_SUBDIRS=""
if test "x$build_ogg123" = xyes; then
OPT_SUBDIRS="$OPT_SUBDIRS ogg123"
if test "x$have_libFLAC" = xyes; then
OGG123_FLAC_OBJS='flac_format.$(OBJEXT) easyflac.$(OBJEXT)'
else
OGG123_FLAC_OBJS=''
fi
AC_SUBST(OGG123_FLAC_OBJS)
if test "x$have_libspeex" = xyes; then
OGG123_SPEEX_OBJS='speex_format.$(OBJEXT)'
else
OGG123_SPEEX_OBJS=''
fi
AC_SUBST(OGG123_SPEEX_OBJS)
fi
if test "x$build_oggenc" = xyes; then
OPT_SUBDIRS="$OPT_SUBDIRS oggenc"
fi
if test "x$build_oggdec" = xyes; then
OPT_SUBDIRS="$OPT_SUBDIRS oggdec"
fi
if test "x$build_ogginfo" = xyes; then
OPT_SUBDIRS="$OPT_SUBDIRS ogginfo"
fi
if test "x$build_vcut" = xyes; then
OPT_SUBDIRS="$OPT_SUBDIRS vcut"
fi
if test "x$build_vorbiscomment" = xyes; then
OPT_SUBDIRS="$OPT_SUBDIRS vorbiscomment"
fi
AC_SUBST(OPT_SUBDIRS)
AC_SUBST(DEBUG)
AC_SUBST(PROFILE)
......
......@@ -2,66 +2,37 @@
AUTOMAKE_OPTIONS = foreign
mans = ogg123.1
docs = ogg123rc-example
ogg123sources = audio.c buffer.c callbacks.c \
cfgfile_options.c cmdline_options.c \
file_transport.c format.c http_transport.c \
ogg123.c oggvorbis_format.c playlist.c \
status.c transport.c vorbis_comments.c \
audio.h buffer.h callbacks.h compat.h \
cfgfile_options.h cmdline_options.h \
format.h ogg123.h playlist.h status.h \
transport.h vorbis_comments.h
flacsources = flac_format.c easyflac.c easyflac.h
speexsources = speex_format.c
if HAVE_LIBFLAC
flaccompile = $(flacsources)
flaclibs = @FLAC_LIBS@
else
flaccompile =
flaclibs =
endif
if HAVE_LIBSPEEX
speexcompile = $(speexsources)
speexlibs = @SPEEX_LIBS@
else
speexcompile =
speexlibs =
endif
if BUILD_OGG123
datadir = @datadir@
localedir = $(datadir)/locale
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
bin_PROGRAMS = ogg123
docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION)
mandir = @MANDIR@
INCLUDES = @OGG_CFLAGS@ @VORBIS_CFLAGS@ @AO_CFLAGS@ @CURL_CFLAGS@ \
bin_PROGRAMS = ogg123
CFLAGS = @OGG_CFLAGS@ @VORBIS_CFLAGS@ @AO_CFLAGS@ @CURL_CFLAGS@ \
@PTHREAD_CFLAGS@ @SHARE_CFLAGS@ @I18N_CFLAGS@
ogg123_LDADD = @SHARE_LIBS@ \
ogg123_LDADD = @OGG123_FLAC_OBJS@ @OGG123_SPEEX_OBJS@ @SHARE_LIBS@ \
@VORBISFILE_LIBS@ @VORBIS_LIBS@ @OGG_LIBS@ @AO_LIBS@ \
@SOCKET_LIBS@ @LIBICONV@ @CURL_LIBS@ @PTHREAD_CFLAGS@ \
@PTHREAD_LIBS@ @I18N_LIBS@ $(flaclibs) $(speexlibs)
ogg123_DEPENDENCIES = @SHARE_LIBS@
ogg123_SOURCES = $(ogg123sources) $(speexcompile) $(flaccompile)
@PTHREAD_LIBS@ @I18N_LIBS@ @FLAC_LIBS@ @SPEEX_LIBS@
man_MANS = $(mans)
doc_DATA = $(docs)
endif
EXTRA_DIST = $(ogg123sources) $(flacsources) $(speexsources) $(mans) $(docs)
ogg123_DEPENDENCIES = @OGG123_FLAC_OBJS@ @OGG123_SPEEX_OBJS@ @SHARE_LIBS@
ogg123_SOURCES = audio.c buffer.c callbacks.c \
cfgfile_options.c cmdline_options.c \
file_transport.c format.c http_transport.c \
ogg123.c oggvorbis_format.c playlist.c \
status.c transport.c vorbis_comments.c \
audio.h buffer.h callbacks.h compat.h \
cfgfile_options.h cmdline_options.h \
format.h ogg123.h playlist.h status.h \
transport.h vorbis_comments.h
EXTRA_ogg123_SOURCES = flac_format.c easyflac.c easyflac.h speex_format.c
man_MANS = ogg123.1
doc_DATA = ogg123rc-example
debug:
$(MAKE) all CFLAGS="@DEBUG@"
......
......@@ -5,8 +5,6 @@ AUTOMAKE_OPTIONS = foreign
mans = oggdec.1
oggdecsources = oggdec.c
if BUILD_OGGDEC
datadir = @datadir@
localedir = $(datadir)/locale
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
......@@ -23,10 +21,6 @@ oggdec_SOURCES = $(oggdecsources)
man_MANS = $(mans)
mandir = @MANDIR@
endif
EXTRA_DIST = $(oggdecsources) $(mans)
debug:
$(MAKE) all CFLAGS="@DEBUG@"
......
......@@ -7,8 +7,6 @@ SUBDIRS = man
oggencsources = oggenc.c audio.c encode.c platform.c \
audio.h encode.h platform.h resample.c resample.h
if BUILD_OGGENC
datadir = @datadir@
localedir = $(datadir)/locale
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
......@@ -24,9 +22,6 @@ oggenc_DEPENDENCIES = @SHARE_LIBS@
oggenc_SOURCES = $(oggencsources)
endif
EXTRA_DIST = $(oggencsources)
debug:
$(MAKE) all CFLAGS="@DEBUG@"
......
......@@ -4,11 +4,5 @@ AUTOMAKE_OPTIONS = foreign
mans = oggenc.1
if BUILD_OGGENC
mandir = @MANDIR@
man_MANS = $(mans)
endif
EXTRA_DIST = $(mans)
......@@ -5,8 +5,6 @@ AUTOMAKE_OPTIONS = foreign
mans = ogginfo.1
ogginfosources = ogginfo2.c
if BUILD_OGGINFO
datadir = @datadir@
localedir = $(datadir)/locale
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
......@@ -22,9 +20,6 @@ ogginfo_DEPENDENCIES = @SHARE_LIBS@
ogginfo_SOURCES = $(ogginfosources)
endif
EXTRA_DIST = $(ogginfosources) $(mans)
debug:
$(MAKE) all CFLAGS="@DEBUG@"
......
......@@ -5,8 +5,6 @@ AUTOMAKE_OPTIONS = foreign
mans = vcut.1
vcutsources = vcut.c vcut.h
if BUILD_VCUT
datadir = @datadir@
localedir = $(datadir)/locale
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
......@@ -21,10 +19,6 @@ vcut_LDADD = @VORBIS_LIBS@ @OGG_LIBS@ @I18N_LIBS@
vcut_SOURCES = $(vcutsources)
endif
EXTRA_DIST = $(vcutsources) $(mans)
debug:
$(MAKE) all CFLAGS="@DEBUG@"
......
......@@ -5,8 +5,6 @@ AUTOMAKE_OPTIONS = foreign
mans = vorbiscomment.1
vorbiscommentsources = vcedit.c vcedit.h vcomment.c
if BUILD_VORBISCOMMENT
datadir = @datadir@
localedir = $(datadir)/locale
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
......@@ -22,10 +20,6 @@ vorbiscomment_DEPENDENCIES = @SHARE_LIBS@
vorbiscomment_SOURCES = $(vorbiscommentsources)
endif
EXTRA_DIST = $(vorbiscommentsources) $(mans)
debug:
$(MAKE) all CFLAGS="@DEBUG@"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment