1 AC_INIT(libass, 0.12.3)
3 AC_CONFIG_MACRO_DIR([m4])
4 # Disable Fortran checks
5 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])
7 AC_CONFIG_SRCDIR([libass/ass.c])
8 AC_CONFIG_HEADER([config.h])
10 # Checks for programs.
16 # Checks for header files.
19 AC_CHECK_HEADERS([stdint.h unistd.h iconv.h])
21 # Checks for library functions.
22 AC_CHECK_FUNCS([strdup strndup])
24 # Checks for libraries.
25 AC_SEARCH_LIBS([libiconv_open], [iconv], AC_DEFINE(CONFIG_ICONV, 1, [use iconv]))
26 AC_SEARCH_LIBS([iconv_open], [iconv], AC_DEFINE(CONFIG_ICONV, 1, [use iconv]))
27 AC_CHECK_LIB([m], [fabs])
29 # Check for libraries via pkg-config
30 AC_ARG_ENABLE([test], AS_HELP_STRING([--enable-test],
31 [enable test program (requires libpng) @<:@default=no@:>@]))
32 AC_ARG_ENABLE([profile], AS_HELP_STRING([--enable-profile],
33 [enable profiling program @<:@default=no@:>@]))
34 AC_ARG_ENABLE([enca], AS_HELP_STRING([--disable-enca],
35 [disable enca (charset autodetect) support @<:@default=check@:>@]))
36 AC_ARG_ENABLE([fontconfig], AS_HELP_STRING([--disable-fontconfig],
37 [disable fontconfig support @<:@default=enabled@:>@]))
38 AC_ARG_ENABLE([directwrite], AS_HELP_STRING([--disable-directwrite],
39 [disable DirectWrite support (win32 only) @<:@default=check@:>@]))
40 AC_ARG_ENABLE([coretext], AS_HELP_STRING([--disable-coretext],
41 [disable CoreText support (OSX only) @<:@default=check@:>@]))
42 AC_ARG_ENABLE([require-system-font-provider], AS_HELP_STRING([--disable-require-system-font-provider],
43 [allow compilation even if no system font provider was found @<:@default=enabled:>@]))
44 AC_ARG_ENABLE([harfbuzz], AS_HELP_STRING([--disable-harfbuzz],
45 [disable HarfBuzz support @<:@default=check@:>@]))
46 AC_ARG_ENABLE([asm], AS_HELP_STRING([--disable-asm],
47 [disable compiling with ASM @<:@default=check@:>@]))
48 AC_ARG_ENABLE([rasterizer], AS_HELP_STRING([--disable-rasterizer],
49 [disable internal rasterizer @<:@default=enabled@:>@]))
50 AC_ARG_ENABLE([large-tiles], AS_HELP_STRING([--enable-large-tiles],
51 [use larger tiles in the rasterizer (better performance, slightly worse quality) @<:@default=disabled@:>@]))
53 AS_IF([test x$enable_asm != xno], [
60 ASFLAGS="$ASFLAGS -DARCH_X86_64=0 -m x86" ],
66 ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -m amd64" ],
70 ASFLAGS="$ASFLAGS -f macho$BITS -DPREFIX -DHAVE_ALIGNED_STACK=1" ],
71 [*linux*|*dragonfly*|*bsd*], [
72 ASFLAGS="$ASFLAGS -f elf -DHAVE_ALIGNED_STACK=1" ],
74 ASFLAGS="$ASFLAGS -f win$BITS"
75 AS_IF([test x$BITS = x64], [
76 ASFLAGS="$ASFLAGS -DHAVE_ALIGNED_STACK=1"
78 ASFLAGS="$ASFLAGS -DHAVE_ALIGNED_STACK=0 -DPREFIX"
81 AS_IF([test x$INTEL = xtrue], [
82 AC_CHECK_PROG([yasm_check], [$AS], [yes])
83 AS_IF([test x$yasm_check != xyes], [
84 AC_MSG_WARN(yasm was not found; ASM functions are disabled.)
85 AC_MSG_WARN(Install yasm for a significantly faster libass build.)
88 AC_MSG_CHECKING([if $AS supports vpmovzxwd])
89 echo "vpmovzxwd ymm0, xmm0" > conftest.asm
90 AS_IF([$AS conftest.asm $ASFLAGS -o conftest.o >conftest.log 2>&1], [
94 VER=`($AS --version || echo no assembler) 2>/dev/null | head -n 1`
95 AC_MSG_WARN([yasm is too old (found $VER); ASM functions are disabled.])
96 AC_MSG_WARN([Install yasm-1.2.0 or later for a significantly faster libass build.])
99 rm conftest.asm conftest.o > /dev/null 2>&1
104 AC_SUBST([ASFLAGS], ["$ASFLAGS"])
105 AC_SUBST([AS], ["$AS"])
107 AM_CONDITIONAL([ASM], [test x$enable_asm != xno])
108 AM_CONDITIONAL([INTEL], [test x$INTEL = xtrue])
109 AM_CONDITIONAL([X86], [test x$X86 = xtrue])
110 AM_CONDITIONAL([X64], [test x$X64 = xtrue])
113 [AC_DEFINE(CONFIG_ASM, 1, [ASM enabled])],
114 [AC_DEFINE(CONFIG_ASM, 0, [ASM enabled])]
117 AM_CONDITIONAL([RASTERIZER], [test x$enable_rasterizer != xno])
119 AM_COND_IF([RASTERIZER],
120 [AC_DEFINE(CONFIG_RASTERIZER, 1, [rasterizer enabled])],
121 [AC_DEFINE(CONFIG_RASTERIZER, 0, [rasterizer enabled])]
124 AM_CONDITIONAL([ENABLE_LARGE_TILES], [test x$enable_large_tiles = xyes])
126 AM_COND_IF([ENABLE_LARGE_TILES],
127 [AC_DEFINE(CONFIG_LARGE_TILES, 1, [use large tiles])]
128 [AC_DEFINE(CONFIG_LARGE_TILES, 0, [use small tiles])],
131 PKG_CHECK_MODULES([FREETYPE], freetype2 >= 9.10.3, [
132 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
133 CXXFLAGS="$CFLAGS $FREETYPE_CFLAGS"
134 LIBS="$LIBS $FREETYPE_LIBS"
135 AC_DEFINE(CONFIG_FREETYPE, 1, [found freetype2 via pkg-config])
138 PKG_CHECK_MODULES([FRIBIDI], fribidi >= 0.19.0, [
139 CFLAGS="$CFLAGS $FRIBIDI_CFLAGS"
140 LIBS="$LIBS $FRIBIDI_LIBS"
141 AC_DEFINE(CONFIG_FRIBIDI, 1, [found fribidi via pkg-config])
144 if test x$enable_fontconfig != xno; then
145 PKG_CHECK_MODULES([FONTCONFIG], fontconfig >= 2.4.2, [
146 CFLAGS="$CFLAGS $FONTCONFIG_CFLAGS"
147 LIBS="$LIBS $FONTCONFIG_LIBS"
148 AC_DEFINE(CONFIG_FONTCONFIG, 1, [found fontconfig via pkg-config])
150 ], [fontconfig=false])
153 if test x$enable_coretext != xno; then
155 # Linking to CoreText directly only works from Mountain Lion and iOS6. In
156 # earlier OS releases CoreText was part of the ApplicationServices umbrella
158 LIBS="$LIBS -framework CoreText -framework CoreFoundation -framework CoreGraphics"
159 AC_MSG_CHECKING([for CORETEXT])
162 [[#include <CoreText/CoreText.h>]],
163 [[CTFontCreateWithFontDescriptor(NULL, 0.0, NULL);]],)
165 AC_DEFINE(CONFIG_CORETEXT, 1, [found CoreText in System library])
174 AM_CONDITIONAL([CORETEXT], [test x$coretext = xtrue])
178 if test x$enable_directwrite != xno; then
179 # Linking to DirectWrite directly only works from Windows
180 AC_MSG_CHECKING([for DIRECTWRITE])
183 [[#include <windows.h>]],
186 AC_DEFINE(CONFIG_DIRECTWRITE, 1, [found DirectWrite])
194 AM_CONDITIONAL([DIRECTWRITE], [test x$directwrite = xtrue])
196 if test x$enable_harfbuzz != xno; then
197 PKG_CHECK_MODULES([HARFBUZZ], harfbuzz >= 0.9.5, [
198 CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
199 LIBS="$LIBS $HARFBUZZ_LIBS"
200 AC_DEFINE(CONFIG_HARFBUZZ, 1, [found harfbuzz-ng via pkg-config])
205 if test x$enable_enca != xno; then
206 PKG_CHECK_MODULES([ENCA], enca, [
207 CFLAGS="$CFLAGS $ENCA_CFLAGS"
208 LIBS="$LIBS $ENCA_LIBS"
209 AC_DEFINE(CONFIG_ENCA, 1, [found enca via pkg-config])
215 if test x$enable_test = xyes; then
216 PKG_CHECK_MODULES([LIBPNG], libpng >= 1.2.0, [
217 CFLAGS="$CFLAGS $LIBPNG_CFLAGS"
218 AC_DEFINE(CONFIG_LIBPNG, 1, [found libpng via pkg-config])
222 AM_CONDITIONAL([HAVE_LIBPNG], [test x$libpng = xtrue])
224 AM_CONDITIONAL([ENABLE_PROFILE], [test x$enable_profile = xyes])
226 # add libraries/packages to pkg-config for static linking
228 pkg_requires="freetype2 >= 9.10.3"
229 pkg_requires="fribidi >= 0.19.0, ${pkg_requires}"
230 if test x$enca = xtrue; then
231 pkg_requires="enca, ${pkg_requires}"
233 if test x$fontconfig = xtrue; then
234 pkg_requires="fontconfig >= 2.4.2, ${pkg_requires}"
236 if test x$harfbuzz = xtrue; then
237 pkg_requires="harfbuzz >= 0.9.5, ${pkg_requires}"
239 if test x$directwrite = xtrue; then
240 pkg_libs="${pkg_libs} -ldwrite"
243 if test x$enable_require_system_font_provider != xno &&
244 test x$fontconfig != xtrue &&
245 test x$directwrite != xtrue &&
246 test x$coretext != xtrue
249 Either DirectWrite (on Windows), CoreText (on OSX), or Fontconfig\
250 (Linux, other) is required. If you really want to compile without\
251 a system font provider, add --disable-require-system-font-provider])
254 AC_SUBST([PKG_LIBS_DEFAULT], [$(test x$enable_shared = xno && echo ${pkg_libs})])
255 AC_SUBST([PKG_REQUIRES_DEFAULT], [$(test x$enable_shared = xno && echo ${pkg_requires})])
256 AC_SUBST([PKG_LIBS_PRIVATE], [$(test x$enable_shared = xno || echo ${pkg_libs})])
257 AC_SUBST([PKG_REQUIRES_PRIVATE], [$(test x$enable_shared = xno || echo ${pkg_requires})])
259 # Setup output beautifier.
260 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
262 AC_CONFIG_FILES([Makefile libass/Makefile test/Makefile profile/Makefile libass.pc])