Skip to content

Commit

Permalink
Make libvorbis/libmpg123 optional in autotools
Browse files Browse the repository at this point in the history
  • Loading branch information
bnnm committed Aug 20, 2018
1 parent 1294f51 commit bb07299
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 12 deletions.
2 changes: 1 addition & 1 deletion BUILD.md
Expand Up @@ -85,7 +85,7 @@ Requires the dev version of Audacious (and dependencies), automake/autoconf, and

The plugin needs Audacious 3.5 or higher. New Audacious releases can break plugin compatibility so it may not work with the latest version unless adapted first.

FFmpeg and other external libraries aren't enabled, thus some formats are not supported. libvorbis and libmpg123 can be disabled with -DVGM_DISABLE_VORBIS and -DVGM_DISABLE_MPEG.
libvorbis and libmpg123 will be used if found, while FFmpeg and other external libraries aren't enabled, thus some formats won't work.

Windows builds aren't supported at the moment (should be possible but there are complex dependency chains).

Expand Down
26 changes: 16 additions & 10 deletions configure.ac
@@ -1,8 +1,8 @@
dnl audacious-vgmstream m4 script
dnl automake-vgmstream m4 script
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.53)
AC_INIT(audacious-vgmstream,1.3.0)
AC_INIT(automake-vgmstream,1.3.0)
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_HEADERS(audacious/config.h)
AM_DISABLE_STATIC
Expand All @@ -17,20 +17,26 @@ AM_PROG_LIBTOOL
AC_PATH_X
AC_PATH_XTRA

PKG_CHECK_MODULES(AUDACIOUS, [audacious >= 3.5.0],,
[AC_MSG_ERROR([Cannot find audacious >= 3.5.0 correctly installed])]
have_vorbis=no
PKG_CHECK_MODULES(VORBIS, [vorbis], have_vorbis=yes,
[AC_MSG_WARN([Cannot find libvorbis - will not enable Vorbis formats])]
)
AM_CONDITIONAL(HAVE_VORBIS, test "$have_vorbis" = yes)

PKG_CHECK_MODULES(VORBIS, [vorbis],,
[AC_MSG_ERROR([Cannot find libvorbis])]
have_vorbisfile=no
PKG_CHECK_MODULES(VORBISFILE, [vorbisfile], have_vorbisfile=yes,
[AC_MSG_WARN([Cannot find libvorbisfile - will not enable Vorbis formats])]
)
AM_CONDITIONAL(HAVE_VORBISFILE, test "$have_vorbisfile" = yes)

PKG_CHECK_MODULES(VORBISFILE, [vorbisfile],,
[AC_MSG_ERROR([Cannot find libvorbisfile])]
have_libmpg123=no
PKG_CHECK_MODULES(MPG123, [libmpg123], have_libmpg123=yes,
[AC_MSG_WARN([Cannot find libmpg123 - will not enable MPEG formats])]
)
AM_CONDITIONAL(HAVE_LIBMPG123, test "$have_libmpg123" = yes)

PKG_CHECK_MODULES(MPG123, [libmpg123],,
[AC_MSG_ERROR([Cannot find libmpg123])]
PKG_CHECK_MODULES(AUDACIOUS, [audacious >= 3.5.0],,
[AC_MSG_ERROR([Cannot find audacious >= 3.5.0 correctly installed])]
)

PKG_CHECK_MODULES(GTK, [glib-2.0 >= 2.6.0 gtk+-2.0 >= 2.6.0 gthread-2.0 pango],
Expand Down
13 changes: 12 additions & 1 deletion src/Makefile.autotools.am
Expand Up @@ -11,6 +11,17 @@ SUBDIRS = coding layout meta
libvgmstream_la_LDFLAGS = coding/libcoding.la layout/liblayout.la meta/libmeta.la
libvgmstream_la_SOURCES = (auto-updated)
libvgmstream_la_SOURCES += ../ext_libs/clHCA.c
libvgmstream_la_LIBADD = $(AUDACIOUS_LIBS) $(GTK_LIBS) $(VORBISFILE_LIBS) $(VORBIS_LIBS) $(MPG123_LIBS) -lm
libvgmstream_la_LIBADD = $(AUDACIOUS_LIBS) $(GTK_LIBS) -lm
EXTRA_DIST = (auto-updated)
EXTRA_DIST += ../ext_includes/clHCA.h

if HAVE_VORBIS
if HAVE_VORBISFILE
AM_CFLAGS += -DVGM_USE_VORBIS
libvgmstream_la_LIBADD += $(VORBISFILE_LIBS) $(VORBIS_LIBS)
endif
endif
if HAVE_LIBMPG123
AM_CFLAGS += -DVGM_USE_MPEG
libvgmstream_la_LIBADD += $(MPG123_LIBS)
endif
9 changes: 9 additions & 0 deletions src/layout/Makefile.autotools.am
Expand Up @@ -9,3 +9,12 @@ AM_MAKEFLAGS=-f Makefile.autotools
liblayout_la_LDFLAGS =
liblayout_la_SOURCES = (auto-updated)
EXTRA_DIST = (auto-updated)

if HAVE_VORBIS
if HAVE_VORBISFILE
AM_CFLAGS += -DVGM_USE_VORBIS
endif
endif
if HAVE_LIBMPG123
AM_CFLAGS += -DVGM_USE_MPEG
endif
9 changes: 9 additions & 0 deletions src/meta/Makefile.autotools.am
Expand Up @@ -9,3 +9,12 @@ AM_MAKEFLAGS=-f Makefile.autotools
libmeta_la_LDFLAGS =
libmeta_la_SOURCES = (auto-updated)
EXTRA_DIST = (auto-updated)

if HAVE_VORBIS
if HAVE_VORBISFILE
AM_CFLAGS += -DVGM_USE_VORBIS
endif
endif
if HAVE_LIBMPG123
AM_CFLAGS += -DVGM_USE_MPEG
endif

0 comments on commit bb07299

Please sign in to comment.