summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOneric <oneric@oneric.stub>2020-11-05 23:04:04 +0100
committerOneric <oneric@oneric.stub>2020-11-13 22:14:32 +0100
commitc38fe27cb9d8894791fd6428bf5d888dd1870dd2 (patch)
treecb9db26229470a0d7cf54175fa108e94c17b4150
parent51b6ef0b4cee57c29aca01d0b7002bdd2ebca412 (diff)
downloadlibass-c38fe27cb9d8894791fd6428bf5d888dd1870dd2.tar.bz2
libass-c38fe27cb9d8894791fd6428bf5d888dd1870dd2.tar.xz
configure: Reoder configuration logic
This should make this a bit easier to understand and more readable. Apart from comments nothing was removed or added, just reodered.
-rw-r--r--configure.ac287
1 files changed, 150 insertions, 137 deletions
diff --git a/configure.ac b/configure.ac
index bbe803a..497e1b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,18 +21,7 @@ AC_CHECK_HEADERS([stdint.h iconv.h])
# Checks for library functions.
AC_CHECK_FUNCS([strdup strndup])
-# Checks for libraries.
-# Add them to pkg-config for static linking.
-OLDLIBS="$LIBS"
-LIBS=
-use_libiconv=false
-AC_SEARCH_LIBS([libiconv_open], [iconv], use_libiconv=true)
-AC_SEARCH_LIBS([iconv_open], [iconv], use_libiconv=true)
-AC_CHECK_LIB([m], [fabs])
-pkg_libs="$LIBS"
-LIBS="$OLDLIBS $LIBS"
-
-# Check for libraries via pkg-config
+# Query configuration parameters and set their description
AC_ARG_ENABLE([test], AS_HELP_STRING([--enable-test],
[enable test program (requires libpng) @<:@default=no@:>@]))
AC_ARG_ENABLE([compare], AS_HELP_STRING([--enable-compare],
@@ -52,98 +41,18 @@ AC_ARG_ENABLE([asm], AS_HELP_STRING([--disable-asm],
AC_ARG_ENABLE([large-tiles], AS_HELP_STRING([--enable-large-tiles],
[use larger tiles in the rasterizer (better performance, slightly worse quality) @<:@default=disabled@:>@]))
-AS_IF([test x$enable_asm != xno], [
- AS_CASE([$host],
- [i?86-*], [
- INTEL=true
- AS=nasm
- X86=true
- BITS=32
- BITTYPE=32
- ASFLAGS="$ASFLAGS -DARCH_X86_64=0" ],
- [x86_64-*-gnux32|amd64-*-gnux32], [
- AS=nasm
- INTEL=true
- X64=true
- BITS=64
- BITTYPE=x32
- ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -DPIC" ],
- [x86_64-*|amd64-*], [
- AS=nasm
- INTEL=true
- X64=true
- BITS=64
- BITTYPE=64
- ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -DPIC" ],
- )
- AS_IF([test x$INTEL = xtrue], [
- AC_CHECK_PROG([nasm_check], [$AS], [yes])
- AS_IF([test x$nasm_check != xyes], [
- AC_MSG_WARN(nasm was not found; ASM functions are disabled.)
- AC_MSG_WARN(Install nasm for a significantly faster libass build.)
- enable_asm=no
- ], [
- AS_CASE([$host],
- [*darwin*], [
- ASFLAGS="$ASFLAGS -f macho$BITTYPE -DPREFIX -DHAVE_ALIGNED_STACK=1" ],
- [*linux*|*dragonfly*|*bsd*|*solaris*|*haiku*], [
- ASFLAGS="$ASFLAGS -f elf$BITTYPE -DHAVE_ALIGNED_STACK=1" ],
- [*cygwin*|*mingw*], [
- ASFLAGS="$ASFLAGS -f win$BITTYPE"
- AS_IF([test x$BITS = x64], [
- ASFLAGS="$ASFLAGS -DHAVE_ALIGNED_STACK=1"
- ], [
- ASFLAGS="$ASFLAGS -DHAVE_ALIGNED_STACK=0 -DPREFIX"
- ])
- ],
- [ #default
- AC_MSG_ERROR(m4_text_wrap(m4_normalize([
- Please contact libass upstream to figure out if ASM
- support for your platform can be added.
- In the meantime you will need to use --disable-asm.]),
- [ ],
- [could not identify NASM format for $host !],
- [78])
- )
- ]
- )
- ASFLAGS="$ASFLAGS -DHAVE_CPUNOP=0 -Dprivate_prefix=ass"
- AC_MSG_CHECKING([if $AS supports vpmovzxwd])
- echo "vpmovzxwd ymm0, xmm0" > conftest.asm
- AS_IF([$AS conftest.asm $ASFLAGS -o conftest.o >conftest.log 2>&1], [
- AC_MSG_RESULT([yes])
- ], [
- AC_MSG_RESULT([no])
- VER=`($AS --version || echo no assembler) 2>/dev/null | head -n 1`
- AC_MSG_WARN([nasm is too old (found $VER); ASM functions are disabled.])
- AC_MSG_WARN([Install nasm-2.10 or later for a significantly faster libass build.])
- enable_asm=no
- ])
- rm conftest.asm conftest.o > /dev/null 2>&1
- ])
- ])
-])
-
-AC_SUBST([ASFLAGS], ["$ASFLAGS"])
-AC_SUBST([AS], ["$AS"])
-
-AM_CONDITIONAL([ASM], [test x$enable_asm != xno])
-AM_CONDITIONAL([INTEL], [test x$INTEL = xtrue])
-AM_CONDITIONAL([X86], [test x$X86 = xtrue])
-AM_CONDITIONAL([X64], [test x$X64 = xtrue])
-
-AM_COND_IF([ASM],
- [AC_DEFINE(CONFIG_ASM, 1, [ASM enabled])],
- [AC_DEFINE(CONFIG_ASM, 0, [ASM enabled])]
- )
-
-AM_CONDITIONAL([ENABLE_LARGE_TILES], [test x$enable_large_tiles = xyes])
-
-AM_COND_IF([ENABLE_LARGE_TILES],
- [AC_DEFINE(CONFIG_LARGE_TILES, 1, [use large tiles])]
- [AC_DEFINE(CONFIG_LARGE_TILES, 0, [use small tiles])],
- )
+# Checks for available libraries and define corresponding C Macros
+# and add packages to pkg-config for static linking
+OLDLIBS="$LIBS"
+LIBS=
+use_libiconv=false
+AC_SEARCH_LIBS([libiconv_open], [iconv], use_libiconv=true)
+AC_SEARCH_LIBS([iconv_open], [iconv], use_libiconv=true)
+AC_CHECK_LIB([m], [fabs])
+pkg_libs="$LIBS"
+LIBS="$OLDLIBS $LIBS"
+## Check for libraries via pkg-config
PKG_CHECK_MODULES([FREETYPE], freetype2 >= 9.10.3, [
CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
CXXFLAGS="$CFLAGS $FREETYPE_CFLAGS"
@@ -157,6 +66,22 @@ PKG_CHECK_MODULES([FRIBIDI], fribidi >= 0.19.0, [
AC_DEFINE(CONFIG_FRIBIDI, 1, [found fribidi via pkg-config])
])
+PKG_CHECK_MODULES([HARFBUZZ], harfbuzz >= 1.2.3, [
+ CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
+ LIBS="$LIBS $HARFBUZZ_LIBS"
+ AC_DEFINE(CONFIG_HARFBUZZ, 1, [found harfbuzz via pkg-config])
+ ])
+
+libpng=false
+if test x$enable_test = xyes || test x$enable_compare = xyes; then
+PKG_CHECK_MODULES([LIBPNG], libpng >= 1.2.0, [
+ CFLAGS="$CFLAGS $LIBPNG_CFLAGS"
+ AC_DEFINE(CONFIG_LIBPNG, 1, [found libpng via pkg-config])
+ libpng=true])
+fi
+
+## Check for system font providers
+### Fontconfig
if test x$enable_fontconfig != xno; then
PKG_CHECK_MODULES([FONTCONFIG], fontconfig >= 2.10.92, [
CFLAGS="$CFLAGS $FONTCONFIG_CFLAGS"
@@ -165,8 +90,8 @@ PKG_CHECK_MODULES([FONTCONFIG], fontconfig >= 2.10.92, [
fontconfig=true
], [fontconfig=false])
fi
-AM_CONDITIONAL([FONTCONFIG], [test x$fontconfig = xtrue])
+### Coretext
if test x$enable_coretext != xno; then
# Linking to CoreText directly only works from Mountain Lion and iOS.
# In earlier OS X releases CoreText was part of the ApplicationServices
@@ -197,10 +122,8 @@ AC_COMPILE_IFELSE([
])
])
fi
-AM_CONDITIONAL([CORETEXT], [test x$coretext = xtrue])
-
-
+### DirectWrite
if test x$enable_directwrite != xno; then
# Linking to DirectWrite directly only works from Windows
AC_MSG_CHECKING([for DIRECTWRITE])
@@ -217,28 +140,20 @@ AC_LINK_IFELSE([
AC_MSG_RESULT([no])
])
fi
-AM_CONDITIONAL([DIRECTWRITE], [test x$directwrite = xtrue])
-
-PKG_CHECK_MODULES([HARFBUZZ], harfbuzz >= 1.2.3, [
- CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
- LIBS="$LIBS $HARFBUZZ_LIBS"
- AC_DEFINE(CONFIG_HARFBUZZ, 1, [found harfbuzz via pkg-config])
- ])
-libpng=false
-if test x$enable_test = xyes || test x$enable_compare = xyes; then
-PKG_CHECK_MODULES([LIBPNG], libpng >= 1.2.0, [
- CFLAGS="$CFLAGS $LIBPNG_CFLAGS"
- AC_DEFINE(CONFIG_LIBPNG, 1, [found libpng via pkg-config])
- libpng=true])
+## Require at least one system font provider by default
+if test x$enable_require_system_font_provider != xno &&
+ test x$fontconfig != xtrue &&
+ test x$directwrite != xtrue &&
+ test x$coretext != xtrue
+then
+ AC_MSG_ERROR([\
+Either DirectWrite (on Windows), CoreText (on OSX), or Fontconfig \
+(Linux, other) is required. If you really want to compile without \
+a system font provider, add --disable-require-system-font-provider])
fi
-AM_CONDITIONAL([ENABLE_TEST], [test x$enable_test = xyes && test x$libpng = xtrue])
-AM_CONDITIONAL([ENABLE_COMPARE], [test x$enable_compare = xyes && test x$libpng = xtrue])
-
-AM_CONDITIONAL([ENABLE_PROFILE], [test x$enable_profile = xyes])
-
-# add packages to pkg-config for static linking
+## Now add packages to pkg-config for static linking
if test "$use_libiconv" = true; then
AC_DEFINE(CONFIG_ICONV, 1, [use iconv])
if test x"$ac_cv_search_libiconv_open" != x"none required" &&
@@ -253,23 +168,121 @@ if test x$fontconfig = xtrue; then
pkg_requires="fontconfig >= 2.10.92, ${pkg_requires}"
fi
-if test x$enable_require_system_font_provider != xno &&
- test x$fontconfig != xtrue &&
- test x$directwrite != xtrue &&
- test x$coretext != xtrue
-then
- AC_MSG_ERROR([\
-Either DirectWrite (on Windows), CoreText (on OSX), or Fontconfig \
-(Linux, other) is required. If you really want to compile without \
-a system font provider, add --disable-require-system-font-provider])
-fi
+# Locate and configure Assembler appropriately
+AS_IF([test x$enable_asm != xno], [
+ AS_CASE([$host],
+ [i?86-*], [
+ INTEL=true
+ AS=nasm
+ X86=true
+ BITS=32
+ BITTYPE=32
+ ASFLAGS="$ASFLAGS -DARCH_X86_64=0" ],
+ [x86_64-*-gnux32|amd64-*-gnux32], [
+ AS=nasm
+ INTEL=true
+ X64=true
+ BITS=64
+ BITTYPE=x32
+ ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -DPIC" ],
+ [x86_64-*|amd64-*], [
+ AS=nasm
+ INTEL=true
+ X64=true
+ BITS=64
+ BITTYPE=64
+ ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -DPIC" ],
+ )
+ AS_IF([test x$INTEL = xtrue], [
+ AC_CHECK_PROG([nasm_check], [$AS], [yes])
+ AS_IF([test x$nasm_check != xyes], [
+ AC_MSG_WARN(nasm was not found; ASM functions are disabled.)
+ AC_MSG_WARN(Install nasm for a significantly faster libass build.)
+ enable_asm=no
+ ], [
+ AS_CASE([$host],
+ [*darwin*], [
+ ASFLAGS="$ASFLAGS -f macho$BITTYPE -DPREFIX -DHAVE_ALIGNED_STACK=1" ],
+ [*linux*|*dragonfly*|*bsd*|*solaris*|*haiku*], [
+ ASFLAGS="$ASFLAGS -f elf$BITTYPE -DHAVE_ALIGNED_STACK=1" ],
+ [*cygwin*|*mingw*], [
+ ASFLAGS="$ASFLAGS -f win$BITTYPE"
+ AS_IF([test x$BITS = x64], [
+ ASFLAGS="$ASFLAGS -DHAVE_ALIGNED_STACK=1"
+ ], [
+ ASFLAGS="$ASFLAGS -DHAVE_ALIGNED_STACK=0 -DPREFIX"
+ ])
+ ],
+ [ #default
+ AC_MSG_ERROR(m4_text_wrap(m4_normalize([
+ Please contact libass upstream to figure out if ASM
+ support for your platform can be added.
+ In the meantime you will need to use --disable-asm.]),
+ [ ],
+ [could not identify NASM format for $host !],
+ [78])
+ )
+ ]
+ )
+ ASFLAGS="$ASFLAGS -DHAVE_CPUNOP=0 -Dprivate_prefix=ass"
+ AC_MSG_CHECKING([if $AS supports vpmovzxwd])
+ echo "vpmovzxwd ymm0, xmm0" > conftest.asm
+ AS_IF([$AS conftest.asm $ASFLAGS -o conftest.o >conftest.log 2>&1], [
+ AC_MSG_RESULT([yes])
+ ], [
+ AC_MSG_RESULT([no])
+ VER=`($AS --version || echo no assembler) 2>/dev/null | head -n 1`
+ AC_MSG_WARN([nasm is too old (found $VER); ASM functions are disabled.])
+ AC_MSG_WARN([Install nasm-2.10 or later for a significantly faster libass build.])
+ enable_asm=no
+ ])
+ rm conftest.asm conftest.o > /dev/null 2>&1
+ ])
+ ])
+])
+
+
+# Relay config results to output files
+
+## Tell Makefiles which assembler and flags to use
+AC_SUBST([ASFLAGS], ["$ASFLAGS"])
+AC_SUBST([AS], ["$AS"])
+
+## Relay package configuration to Makefiles
AC_SUBST([PKG_LIBS_DEFAULT], [$(test x$enable_shared = xno && echo ${pkg_libs})])
AC_SUBST([PKG_REQUIRES_DEFAULT], [$(test x$enable_shared = xno && echo ${pkg_requires})])
AC_SUBST([PKG_LIBS_PRIVATE], [$(test x$enable_shared = xno || echo ${pkg_libs})])
AC_SUBST([PKG_REQUIRES_PRIVATE], [$(test x$enable_shared = xno || echo ${pkg_requires})])
-# Setup output beautifier.
+## Setup conditionals for use in Makefiles
+AM_CONDITIONAL([ASM], [test x$enable_asm != xno])
+AM_CONDITIONAL([INTEL], [test x$INTEL = xtrue])
+AM_CONDITIONAL([X86], [test x$X86 = xtrue])
+AM_CONDITIONAL([X64], [test x$X64 = xtrue])
+
+AM_CONDITIONAL([ENABLE_LARGE_TILES], [test x$enable_large_tiles = xyes])
+
+AM_CONDITIONAL([ENABLE_COMPARE], [test x$enable_compare = xyes && test x$libpng = xtrue])
+AM_CONDITIONAL([ENABLE_TEST], [test x$enable_test = xyes && test x$libpng = xtrue])
+AM_CONDITIONAL([ENABLE_PROFILE], [test x$enable_profile = xyes])
+
+AM_CONDITIONAL([FONTCONFIG], [test x$fontconfig = xtrue])
+AM_CONDITIONAL([CORETEXT], [test x$coretext = xtrue])
+AM_CONDITIONAL([DIRECTWRITE], [test x$directwrite = xtrue])
+
+## Define C Macros not relating to libraries
+AM_COND_IF([ASM],
+ [AC_DEFINE(CONFIG_ASM, 1, [ASM enabled])],
+ [AC_DEFINE(CONFIG_ASM, 0, [ASM enabled])]
+ )
+
+AM_COND_IF([ENABLE_LARGE_TILES],
+ [AC_DEFINE(CONFIG_LARGE_TILES, 1, [use large tiles])]
+ [AC_DEFINE(CONFIG_LARGE_TILES, 0, [use small tiles])],
+ )
+
+## Setup output beautifier.
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_FILES([Makefile libass/Makefile test/Makefile compare/Makefile profile/Makefile libass.pc])