Add support for an 'internal' libass, with this we can chase changes to the

libass in MPlayer which is more up-to-date than the external library that's
available.

Originally committed to SVN as r2096.
This commit is contained in:
Amar Takhar 2008-03-21 21:01:03 +00:00
parent 9a7bbc9b93
commit 04e9ff224f
5 changed files with 74 additions and 39 deletions

View File

@ -9,10 +9,15 @@ if HAVE_AUTO3_LUA
auto3 = auto3 auto3 = auto3
endif endif
if WITH_INTERNAL_LIBASS
libass = libass
endif
SUBDIRS = \ SUBDIRS = \
$(univchardet) \ $(univchardet) \
$(auto3) \ $(auto3) \
$(libass) \
aegisub \ aegisub \
automation \ automation \
po \ po \

View File

@ -9,8 +9,12 @@ AM_CXXFLAGS = -DAEGISUB -Iposix -include posix/defines.h -Iinclude @WX_CPPFLAGS@
bin_PROGRAMS = aegisub bin_PROGRAMS = aegisub
aegisub_LDADD = posix/libposix.a aegisub_LDADD = posix/libposix.a
aegisub_CPPFLAGS = @FREETYPE_CFLAGS@ aegisub_CPPFLAGS = @FREETYPE_CFLAGS@
aegisub_LDFLAGS = @GL_LIBS@ @FREETYPE_LIBS@ @PTHREAD_LIBS@ @WX_LIBS@ aegisub_LDFLAGS = @GL_LIBS@ @PTHREAD_LIBS@ @WX_LIBS@
LIBS += @FREETYPE_LIBS@ @FONTCONFIG_LIBS@
if WITH_INTERNAL_LIBASS
aegisub_LDFLAGS += @FONTCONFIG_LIBS@
endif
#XXX: fix this so it's generated by configure and put into acconf.h #XXX: fix this so it's generated by configure and put into acconf.h
#BUILDINFO := -DBUILD_CREDIT=verm -DBUILD_SVN_REVISION=0 #BUILDINFO := -DBUILD_CREDIT=verm -DBUILD_SVN_REVISION=0
@ -57,7 +61,7 @@ if HAVE_LIBASS
noinst_LIBRARIES += libsubtitle_ass.a noinst_LIBRARIES += libsubtitle_ass.a
libsubtitle_ass_a_SOURCES = subtitles_provider_libass.cpp libsubtitle_ass_a_SOURCES = subtitles_provider_libass.cpp
libsubtitle_ass_a_CPPFLAGS = @LIBASS_CFLAGS@ libsubtitle_ass_a_CPPFLAGS = @LIBASS_CFLAGS@
aegisub_LDFLAGS += @LIBASS_LIBS@ LIBS += @LIBASS_LIBS@
aegisub_LDADD += libsubtitle_ass.a aegisub_LDADD += libsubtitle_ass.a
endif endif

View File

@ -135,6 +135,31 @@ AM_CONDITIONAL([HAVE_OPENMP], [test "$with_openmp" != "no"])
AC_SUBST(OPENMP_CXXFLAGS) AC_SUBST(OPENMP_CXXFLAGS)
##############################
# Program Support and Features
##############################
AC_CHECK_HEADER([wchar.h],,[AC_MSG_FAILURE([aegisub requires wide character support])])
AX_CHECK_GL
if test ! "$GL_LIBS"; then
AC_MSG_FAILURE([aegisub requires GL support.])
fi
AC_SUBST(GL_CFLAGS)
AC_SUBST(GL_LIBS)
PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.7.0,
AC_DEFINE(WITH_FREETYPE2, 1, [Enable FreeType 2 support.]),
[AC_MSG_FAILURE([aegisub requires >= FreeType2 2.1.9])])
PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.4,
AC_DEFINE(WITH_FONTCONFIG, 1, [Enable FontConfig support.]),
[AC_MSG_FAILURE([aegisub requires >= fontconfig >= 2.4])])
AC_SUBST(FONTCONFIG_CFLAGS)
AC_SUBST(FONTCONFIG_LIBS)
################# #################
# Audio Providers # Audio Providers
################# #################
@ -250,54 +275,54 @@ AM_CONDITIONAL([HAVE_FFMPEG], [test "$with_ffmpeg" != "no"])
# Subtitle Provider # Subtitle Provider
################### ###################
AC_ARG_WITH(libass, [ --without-libass disable libass (default=autodetect)],libass_disabled="(disabled)") AC_ARG_WITH(libass, [ --without-libass disable libass (default=enable)],libass_disabled="(disabled)")
AC_ARG_ENABLE(libass, [ --disable-libass disable internal libass support (default=enabled)],libass_internal_disabled="(disabled)")
if test "x$with_libass" != xno; then AC_ARG_VAR([ICONV_CFLAGS], [CFLAGS to use for iconv (default: CPPFLAGS)])
PKG_CHECK_MODULES(LIBASS, libass >= 0.9.1) AC_ARG_VAR([ICONV_LDFLAGS], [LDFLAGS to use for iconv (default: LDFLAGS)])
aegisub_save_LDFLAGS="$LDFLAGS" if test "$with_libass" != "no"; then
LDFLAGS="$LIBASS_LIBS" if test "$enable_libass" = "no"; then
AC_CHECK_LIB([ass], [ass_read_styles],[LIBASS_LIBS="$LIBASS_LIBS]", with_libass=no) PKG_CHECK_MODULES(LIBASS, libass >= 0.9.1)
LDFLAGS="$aegisub_save_LDFLAGS"
aegisub_save_CPPFLAGS="$CPPFLAGS" aegisub_save_LDFLAGS="$LDFLAGS"
CPPFLAGS="$LIBASS_CFLAGS" LDFLAGS="$LIBASS_LIBS"
AC_CHECK_HEADER([ass/ass.h],[LIBASS_CFLAGS="$LIBASS_CFLAGS"],with_libass="no") AC_CHECK_LIB([ass], [ass_read_styles],[LIBASS_LIBS="$LIBASS_LIBS"; with_libass="yes"], with_libass=no)
CPPFLAGS="$aegisub_save_CPPFLAGS" LDFLAGS="$aegisub_save_LDFLAGS"
aegisub_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$LIBASS_CFLAGS"
AC_CHECK_HEADER([ass/ass.h], [LIBASS_CFLAGS="$LIBASS_CFLAGS"; with_libass="yes"], with_libass="no")
CPPFLAGS="$aegisub_save_CPPFLAGS"
with_internal_libass="no"
else
AC_CHECK_HEADER(iconv.h, [ICONV_CFLAGS="$ICONV_CFLAGS"; with_iconv="yes"], with_iconv="no")
AC_CHECK_LIB([iconv], [iconv_open],[ICONV_LDFLAGS="ICONV_LIBS"; with_iconv="yes"], with_iconv="no")
if test "$with_iconv" = "yes"; then
LIBASS_LIBS="-L../libass -lass_aegisub"
LIBASS_CFLAGS="-I../libass"
with_internal_libass="yes"
else
with_internal_libass="no"
fi
fi
fi fi
if test "$with_libass" != "no"; then if test "$with_libass" != "no"; then
AC_DEFINE(WITH_LIBASS, 1, [Enable libass Subtitle Provider]) AC_DEFINE(WITH_LIBASS, 1, [Enable libass Subtitle Provider])
with_libass="yes" with_libass="yes"
else
with_internal_libass="no"
fi fi
AC_SUBST(LIBASS_LIBS) AC_SUBST(LIBASS_LIBS)
AC_SUBST(LIBASS_CFLAGS) AC_SUBST(LIBASS_CFLAGS)
AM_CONDITIONAL([WITH_INTERNAL_LIBASS], [test "$with_libass" != "no" ])
AM_CONDITIONAL([HAVE_LIBASS], [test "$with_libass" != "no" ]) AM_CONDITIONAL([HAVE_LIBASS], [test "$with_libass" != "no" ])
##############################
# Program Support and Features
##############################
AC_CHECK_HEADER([wchar.h],,[AC_MSG_FAILURE([aegisub requires wide character support])])
AX_CHECK_GL
if test ! "$GL_LIBS"; then
AC_MSG_FAILURE([aegisub requires GL support.])
fi
AC_SUBST(GL_CFLAGS)
AC_SUBST(GL_LIBS)
PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.7.0,
AC_DEFINE(WITH_FREETYPE2, 1, [Enable FreeType 2 support.]),
[AC_MSG_FAILURE([aegisub requires >= FreeType2 2.1.9])])
PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.4,
AC_DEFINE(WITH_FONTCONFIG, 1, [Enable FontConfig support.]),
[AC_MSG_FAILURE([aegisub requires >= fontconfig >= 2.4])])
########### ###########
## Hunspell ## Hunspell
@ -621,6 +646,7 @@ aegisub/bitmaps/Makefile
aegisub/posix/Makefile aegisub/posix/Makefile
universalchardet/Makefile universalchardet/Makefile
auto3/Makefile auto3/Makefile
libass/Makefile
automation/Makefile automation/Makefile
po/Makefile.in po/Makefile.in
m4macros/Makefile m4macros/Makefile
@ -680,7 +706,7 @@ Video Providers
Subtitle Providers: Subtitle Providers:
asa: $with_asa asa: $with_asa
libass: $with_libass libass: $with_libass $libass_disabled (internal: $with_internal_libass)
Misc Packages: Misc Packages:
hunspell: $with_hunspell $hunspell_disabled hunspell: $with_hunspell $hunspell_disabled

View File

@ -1,7 +1,7 @@
noinst_LIBRARIES = libass.a noinst_LIBRARIES = libass_aegisub.a
libass_a_CPPFLAGS = @FREETYPE_CFLAGS@ -DHAVE_FONTCONFIG -DUSE_ICONV @FONTCONFIG_CFLAGS@ libass_aegisub_a_CPPFLAGS = @FREETYPE_CFLAGS@ -DHAVE_FONTCONFIG -DUSE_ICONV @FONTCONFIG_CFLAGS@
libass_a_SOURCES = ass.c ass_cache.c ass_font.c ass_fontconfig.c ass_render.c \ libass_aegisub_a_SOURCES = ass.c ass_cache.c ass_font.c ass_fontconfig.c ass_render.c \
ass_utils.c ass_bitmap.c ass_library.c mputils.c \ ass_utils.c ass_bitmap.c ass_library.c mputils.c \
ass_bitmap.h ass_cache.h ass_fontconfig.h ass_font.h ass.h \ ass_bitmap.h ass_cache.h ass_fontconfig.h ass_font.h ass.h \
ass_library.h ass_types.h ass_utils.h help_mp.h mputils.h ass_library.h ass_types.h ass_utils.h help_mp.h mputils.h

View File

@ -40,7 +40,7 @@
#include <fontconfig/fcfreetype.h> #include <fontconfig/fcfreetype.h>
#endif #endif
extern int font_fontconfig; int font_fontconfig = 1;
struct fc_instance_s { struct fc_instance_s {
#ifdef HAVE_FONTCONFIG #ifdef HAVE_FONTCONFIG