From 363cd08c16bee4812cc5408b469e22d2bcd3b942 Mon Sep 17 00:00:00 2001 From: 11rcombs Date: Sun, 23 Feb 2014 19:39:45 -0600 Subject: Redesigned configure/Makefile setup Adds yasm version check and handles Free/OpenBSD/win32 correctly. Signed-off-by: Grigori Goronzy --- configure.ac | 104 +++++++++++++++++++++++++++++------------------------ libass/Makefile.am | 32 +++-------------- 2 files changed, 62 insertions(+), 74 deletions(-) diff --git a/configure.ac b/configure.ac index 5feeb68..66a89a7 100644 --- a/configure.ac +++ b/configure.ac @@ -46,62 +46,72 @@ AC_ARG_ENABLE([fontconfig], AS_HELP_STRING([--disable-fontconfig], AC_ARG_ENABLE([harfbuzz], AS_HELP_STRING([--disable-harfbuzz], [disable HarfBuzz support @<:@default=check@:>@])) AC_ARG_ENABLE([asm], AS_HELP_STRING([--disable-asm], - [disable compiling with ASM @<:@default=check@:>@]), - [asm=false], - [asm=true]) - -test "${ASFLAGS+set}" = set || ASFLAGS="" + [disable compiling with ASM @<:@default=check@:>@])) + +AS_IF([test x$enable_asm != xno], [ + AS_CASE([$host], + [i?86-*], [ + INTEL=true + AS=yasm + X86=true + BITS=32 + ASFLAGS="$ASFLAGS -DARCH_X86_64=0 -m x86" ], + [x86_64-*|amd64-*], [ + AS=yasm + INTEL=true + X64=true + BITS=64 + ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -m amd64" ], + ) + AS_CASE([$host], + [*darwin*], [ + ASFLAGS="$ASFLAGS -f macho$BITS -DPREFIX -DHAVE_ALIGNED_STACK=1" ], + [*linux*|*bsd*], [ + ASFLAGS="$ASFLAGS -f elf -DHAVE_ALIGNED_STACK=1" ], + [*cygwin*|*mingw*], [ + ASFLAGS="$ASFLAGS -f win$BITS" + AS_IF([test x$BITS = x64], [ + ASFLAGS="$ASFLAGS -DHAVE_ALIGNED_STACK=1" + ], [ + ASFLAGS="$ASFLAGS -DHAVE_ALIGNED_STACK=0 -DPREFIX" + ]) + ]) + AS_IF([test x$INTEL = xtrue], [ + AC_CHECK_PROG([yasm_check], [$AS], [yes]) + AS_IF([test x$yasm_check != xyes], [ + AC_MSG_WARN(yasm was not found; ASM functions are disabled.) + AC_MSG_WARN(Install yasm for a significantly faster libass build.) + enable_asm=no + ], [ + 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([yasm is too old (found $VER); ASM functions are disabled.]) + AC_MSG_WARN([Install yasm-1.2.0 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"]) -case $host in - i?86-*) - INTEL=true - X86=true ;; - x86_64-*) - INTEL=true - X64=true ;; - arm-*) - ARM=true ;; -esac - -case $host in - *darwin*) - MACHO=true ;; - *linux*) - ELF=true ;; - *cygwin*) - WIN32=true ;; - *mingw*) - WIN32=true ;; -esac - -if test x$INTEL = xtrue ; then - if test x$asm = xtrue ; then - AC_CHECK_PROG(YASM_CHECK,yasm,yes) - if test x$YASM_CHECK != xyes ; then - AC_MSG_WARN(YASM was not found; ASM functions are disabled.) - AC_MSG_WARN(Install yasm for a significantly faster libass build.) - asm=false - fi - fi -fi - -AM_CONDITIONAL([ASM], [test x$asm = xtrue]) +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([INTEL], [test x$INTEL = xtrue]) -AM_CONDITIONAL([X86], [test x$X86 = xtrue]) -AM_CONDITIONAL([X64], [test x$X64 = xtrue]) -AM_CONDITIONAL([ARM], [test x$ARM = xtrue]) -AM_CONDITIONAL([MACHO], [test x$MACHO = xtrue]) -AM_CONDITIONAL([ELF], [test x$ELF = xtrue]) -AM_CONDITIONAL([WIN32], [test x$WIN32 = xtrue]) - PKG_CHECK_MODULES([FREETYPE], freetype2 >= 9.10.3, [ CFLAGS="$CFLAGS $FREETYPE_CFLAGS" LIBS="$LIBS $FREETYPE_LIBS" diff --git a/libass/Makefile.am b/libass/Makefile.am index 079b9d2..7b4a0bf 100644 --- a/libass/Makefile.am +++ b/libass/Makefile.am @@ -6,11 +6,12 @@ LIBASS_LT_CURRENT = 5 LIBASS_LT_REVISION = 0 LIBASS_LT_AGE = 0 -.asm.lo: - $(LIBTOOL) --quiet --mode=compile $(AS) $(ASFLAGS) -o $@ $< -prefer-non-pic +yasm_verbose = $(yasm_verbose_$(V)) +yasm_verbose_ = $(yasm_verbose_$(AM_DEFAULT_VERBOSITY)) +yasm_verbose_0 = @echo " YASM " $@; -.S.lo: - $(LIBTOOL) --quiet --mode=compile $(AS) $(ASFLAGS)-o $@ $< -prefer-non-pic +.asm.lo: + $(yasm_verbose)$(LIBTOOL) $(AM_V_lt) --mode=compile $(AS) $(ASFLAGS) -o $@ $< -prefer-non-pic SRC_INTEL = x86/blend_bitmaps.asm x86/cpuid.asm x86/blend_bitmaps.h x86/cpuid.h SRC_INTEL64 = x86/be_blur.asm x86/be_blur.h @@ -29,32 +30,9 @@ libass_la_LDFLAGS += -export-symbols $(srcdir)/libass.sym if ASM if INTEL -AS = "yasm" libass_la_SOURCES += $(SRC_INTEL) -if X86 -ASFLAGS += -DARCH_X86_64=0 -m x86 -if MACHO -ASFLAGS += -f macho32 -DPREFIX -DHAVE_ALIGNED_STACK=1 -endif -if ELF -ASFLAGS += -f elf -DHAVE_ALIGNED_STACK=1 -endif -if WIN32 -ASFLAGS += -f win32 -DPREFIX -DHAVE_ALIGNED_STACK=0 -endif -endif if X64 libass_la_SOURCES += $(SRC_INTEL64) -ASFLAGS += -DARCH_X86_64=1 -m amd64 -if MACHO -ASFLAGS += -f macho64 -DPREFIX -DHAVE_ALIGNED_STACK=1 -endif -if ELF -ASFLAGS += -f elf -DHAVE_ALIGNED_STACK=1 -endif -if WIN32 -ASFLAGS += -f win64 -DHAVE_ALIGNED_STACK=1 -endif endif endif endif -- cgit v1.2.3