From 519335783224e2cbfd8a4a5b9071216fe2b139b5 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Tue, 11 Aug 2020 23:51:59 +0430 Subject: [PATCH] Revert "Remove autotools build support" This reverts commit 01ac32aab2109681abc58bb2f96a4ef4a7f0c6df. --- .circleci/config.yml | 15 + Makefile.am | 96 ++ README | 15 + RELEASING.md | 2 +- autogen.sh | 48 + configure.ac | 540 ++++++++++ docs/Makefile.am | 126 +++ git.mk | 400 +++++++ m4/ax_check_link_flag.m4 | 74 ++ m4/ax_code_coverage.m4 | 264 +++++ m4/ax_cxx_compile_stdcxx.m4 | 982 ++++++++++++++++++ m4/ax_pthread.m4 | 485 +++++++++ src/Makefile.am | 476 +++++++++ src/Makefile.sources | 284 +++++ test/Makefile.am | 15 + test/api/Makefile.am | 222 ++++ test/fuzzing/Makefile.am | 86 ++ test/shaping/Makefile.am | 39 + test/shaping/data/Makefile.am | 14 + test/shaping/data/aots/Makefile.am | 27 + test/shaping/data/aots/Makefile.sources | 126 +++ test/shaping/data/in-house/Makefile.am | 26 + test/shaping/data/in-house/Makefile.sources | 66 ++ .../data/text-rendering-tests/Makefile.am | 32 + .../text-rendering-tests/Makefile.sources | 95 ++ test/subset/Makefile.am | 23 + test/subset/data/Makefile.am | 45 + test/subset/data/Makefile.sources | 31 + util/Makefile.am | 78 ++ util/Makefile.sources | 38 + 30 files changed, 4769 insertions(+), 1 deletion(-) create mode 100644 Makefile.am create mode 100644 README create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 docs/Makefile.am create mode 100644 git.mk create mode 100644 m4/ax_check_link_flag.m4 create mode 100644 m4/ax_code_coverage.m4 create mode 100644 m4/ax_cxx_compile_stdcxx.m4 create mode 100644 m4/ax_pthread.m4 create mode 100644 src/Makefile.am create mode 100644 src/Makefile.sources create mode 100644 test/Makefile.am create mode 100644 test/api/Makefile.am create mode 100644 test/fuzzing/Makefile.am create mode 100644 test/shaping/Makefile.am create mode 100644 test/shaping/data/Makefile.am create mode 100644 test/shaping/data/aots/Makefile.am create mode 100644 test/shaping/data/aots/Makefile.sources create mode 100644 test/shaping/data/in-house/Makefile.am create mode 100644 test/shaping/data/in-house/Makefile.sources create mode 100644 test/shaping/data/text-rendering-tests/Makefile.am create mode 100644 test/shaping/data/text-rendering-tests/Makefile.sources create mode 100644 test/subset/Makefile.am create mode 100644 test/subset/data/Makefile.am create mode 100644 test/subset/data/Makefile.sources create mode 100644 util/Makefile.am create mode 100644 util/Makefile.sources diff --git a/.circleci/config.yml b/.circleci/config.yml index 520fa1084..d7e360229 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,6 +46,20 @@ jobs: - run: meson compile -Cbuild - run: meson test -Cbuild --print-errorlogs + # will be dropped with autotools removal + distcheck: + docker: + - image: ubuntu:20.04 + steps: + - checkout + - run: apt update && DEBIAN_FRONTEND=noninteractive apt install -y git ninja-build binutils libtool autoconf automake make gcc g++ pkg-config ragel gtk-doc-tools libfontconfig1-dev libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python3 python3-pip + - run: pip3 install fonttools meson --upgrade + - run: ./autogen.sh + - run: make -j32 + - run: make distcheck + - run: rm harfbuzz-* && make distdir + - run: cd harfbuzz-* && meson build && ninja -Cbuild test + fedora-valgrind: docker: - image: fedora @@ -125,6 +139,7 @@ workflows: - macos-10.13.6-aat-fonts - macos-10.14.4-aat-fonts - macos-10.15.3-aat-fonts + - distcheck # will be dropped with autotools removal - fedora-valgrind - alpine - archlinux diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 000000000..15b4a80e3 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,96 @@ +# Process this file with automake to produce Makefile.in + +NULL = + +ACLOCAL_AMFLAGS = -I m4 + +SUBDIRS = src util test docs + +EXTRA_DIST = \ + autogen.sh \ + harfbuzz.doap \ + README.md \ + README.python.md \ + BUILD.md \ + CONFIG.md \ + RELEASING.md \ + TESTING.md \ + meson.build \ + meson_options.txt \ + subprojects/expat.wrap \ + subprojects/fontconfig.wrap \ + subprojects/freetype2.wrap \ + subprojects/glib.wrap \ + subprojects/libffi.wrap \ + subprojects/proxy-libintl.wrap \ + subprojects/zlib.wrap \ + subprojects/google-benchmark.wrap \ + perf/meson.build \ + perf/perf-draw.hh \ + perf/perf-extents.hh \ + perf/perf-shaping.hh \ + perf/perf.cc \ + perf/fonts/Amiri-Regular.ttf \ + perf/fonts/NotoNastaliqUrdu-Regular.ttf \ + perf/fonts/NotoSansDevanagari-Regular.ttf \ + perf/fonts/Roboto-Regular.ttf \ + perf/texts/en-thelittleprince.txt \ + perf/texts/en-words.txt \ + perf/texts/fa-monologue.txt \ + perf/texts/fa-thelittleprince.txt \ + meson-cc-tests/intel-atomic-primitives-test.c \ + meson-cc-tests/solaris-atomic-operations.c \ + $(NULL) + +MAINTAINERCLEANFILES = \ + $(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL) \ + $(GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL) \ + $(GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN) \ + $(srcdir)/INSTALL \ + $(srcdir)/ChangeLog \ + $(srcdir)/gtk-doc.make \ + $(srcdir)/m4/gtk-doc.m4 \ + $(NULL) + + +# +# ChangeLog generation +# +CHANGELOG_RANGE = +ChangeLog: $(srcdir)/ChangeLog +$(srcdir)/ChangeLog: + $(AM_V_GEN) if test -d "$(top_srcdir)/.git"; then \ + (GIT_DIR=$(top_srcdir)/.git \ + $(GIT) log $(CHANGELOG_RANGE) --stat) > $@.tmp \ + && mv -f $@.tmp "$(srcdir)/ChangeLog" \ + || ($(RM) $@.tmp; \ + echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \ + (test -f $@ || echo git-log is required to generate this file >> "$(srcdir)/$@")); \ + else \ + test -f $@ || \ + (echo A git checkout and git-log is required to generate ChangeLog >&2 && \ + echo A git checkout and git-log is required to generate this file >> "$(srcdir)/$@"); \ + fi +.PHONY: ChangeLog $(srcdir)/ChangeLog + + +# +# Release engineering +# + +DISTCHECK_CONFIGURE_FLAGS = \ + --enable-gtk-doc \ + --disable-doc-cross-references \ + --with-gobject \ + --enable-introspection \ + $(NULL) + +# TAR_OPTIONS is not set as env var for 'make dist'. How to fix that? +TAR_OPTIONS = --owner=0 --group=0 + +dist-hook: dist-clear-sticky-bits +# Clean up any sticky bits we may inherit from parent dir +dist-clear-sticky-bits: + chmod -R a-s $(distdir) + +-include $(top_srcdir)/git.mk diff --git a/README b/README new file mode 100644 index 000000000..f4d2294c9 --- /dev/null +++ b/README @@ -0,0 +1,15 @@ +This is HarfBuzz, a text shaping library. + +For bug reports, mailing list, and other information please visit: + + http://harfbuzz.org/ + +For license information, see https://github.com/harfbuzz/harfbuzz/blob/master/COPYING + +For build information, see https://github.com/harfbuzz/harfbuzz/blob/master/BUILD.md + +For custom configurations, see https://github.com/harfbuzz/harfbuzz/blob/master/CONFIG.md + +For test execution, see https://github.com/harfbuzz/harfbuzz/blob/master/TESTING.md + +Documentation: https://harfbuzz.github.io diff --git a/RELEASING.md b/RELEASING.md index 3a5a58161..e3ef7b66e 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -22,7 +22,7 @@ HarfBuzz release walk-through checklist: 4. Make sure you have correct date and new version at the top of NEWS file. -5. Bump version in line 3 of meson.build. +5. Bump version in line 3 of meson.build and configure.ac. Do a `meson test -Cbuild` so it both checks the tests and updates hb-version.h (use `git diff` to see if is really updated). diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 000000000..085b4d863 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +test -n "$srcdir" || srcdir=`dirname "$0"` +test -n "$srcdir" || srcdir=. + +olddir=`pwd` +cd $srcdir + +#printf "checking for ragel... " +#which ragel || { +# echo "You need to install ragel... See http://www.complang.org/ragel/" +# exit 1 +#} + +printf "checking for pkg-config... " +which pkg-config || { + echo "*** No pkg-config found, please install it ***" + exit 1 +} + +printf "checking for libtoolize... " +which glibtoolize || which libtoolize || { + echo "*** No libtoolize (libtool) found, please install it ***" + exit 1 +} +printf "checking for gtkdocize... " +if which gtkdocize ; then + gtkdocize --copy || exit 1 +else + echo "*** No gtkdocize (gtk-doc) found, skipping documentation ***" + echo "EXTRA_DIST = " > gtk-doc.make +fi + +printf "checking for autoreconf... " +which autoreconf || { + echo "*** No autoreconf (autoconf) found, please install it ***" + exit 1 +} + +echo "running autoreconf --force --install --verbose" +autoreconf --force --install --verbose || exit $? + +cd $olddir +test -n "$NOCONFIGURE" || { + echo "running configure $@" + "$srcdir/configure" "$@" +} diff --git a/configure.ac b/configure.ac new file mode 100644 index 000000000..7c0d857b1 --- /dev/null +++ b/configure.ac @@ -0,0 +1,540 @@ +AC_PREREQ([2.64]) +AC_INIT([HarfBuzz], + [2.7.0], + [https://github.com/harfbuzz/harfbuzz/issues/new], + [harfbuzz], + [http://harfbuzz.org/]) + +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_SRCDIR([src/harfbuzz.pc.in]) +AC_CONFIG_HEADERS([config.h]) + +AM_INIT_AUTOMAKE([1.13.0 gnits tar-ustar dist-xz no-dist-gzip -Wall no-define color-tests -Wno-portability]) +AM_SILENT_RULES([yes]) +AX_CODE_COVERAGE + +# Initialize libtool +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) +LT_PREREQ([2.2]) +LT_INIT([disable-static]) + +# Check for programs +AC_PROG_CC +AC_PROG_CC_C99 +AM_PROG_CC_C_O +AC_PROG_CXX +AX_CXX_COMPILE_STDCXX(11) +AC_SYS_LARGEFILE +PKG_PROG_PKG_CONFIG([0.20]) +AM_MISSING_PROG([RAGEL], [ragel]) +AM_MISSING_PROG([GIT], [git]) + +# Version +m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]])) +m4_define(hb_version_major,m4_argn(1,hb_version_triplet)) +m4_define(hb_version_minor,m4_argn(2,hb_version_triplet)) +m4_define(hb_version_micro,m4_argn(3,hb_version_triplet)) +HB_VERSION_MAJOR=hb_version_major +HB_VERSION_MINOR=hb_version_minor +HB_VERSION_MICRO=hb_version_micro +HB_VERSION=AC_PACKAGE_VERSION +AC_SUBST(HB_VERSION_MAJOR) +AC_SUBST(HB_VERSION_MINOR) +AC_SUBST(HB_VERSION_MICRO) +AC_SUBST(HB_VERSION) + +# Libtool version +m4_define([hb_version_int], + m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro)) +HB_LIBTOOL_VERSION_INFO=hb_version_int:0:hb_version_int +AC_SUBST(HB_LIBTOOL_VERSION_INFO) + +AC_ARG_WITH([libstdc++], + [AS_HELP_STRING([--with-libstdc++=@<:@yes/no@:>@], + [Allow linking with libstdc++ @<:@default=no@:>@])], + [with_libstdcxx=$withval], + [with_libstdcxx=no]) +AM_CONDITIONAL(WITH_LIBSTDCXX, [test "x$with_libstdcxx" = "xyes"]) + +# Documentation +have_gtk_doc=false +m4_ifdef([GTK_DOC_CHECK], [ +GTK_DOC_CHECK([1.15],[--flavour no-tmpl]) + if test "x$enable_gtk_doc" = xyes; then + have_gtk_doc=true + fi +], [ + AM_CONDITIONAL([ENABLE_GTK_DOC], false) +]) + +# Functions and headers +AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty) +AC_CHECK_HEADERS(unistd.h sys/mman.h stdbool.h) + +# Compiler flags +AC_CANONICAL_HOST +AC_CHECK_ALIGNOF([struct{char;}]) +if test "x$GCC" = "xyes"; then + + # Make symbols link locally + AX_CHECK_LINK_FLAG([[-Bsymbolic-functions]], [LDFLAGS="$LDFLAGS -Bsymbolic-functions"]) + + # Make it possible to not link to libstdc++ + # No threadsafe statics in C++ as we do it ourselves. + # We don't use these features, so it's safe to disable them + # even in the cases where we DO link to libstdc++. + # Put -fno-rtti before $CXXFLAGS such that users can re-enable it + # by overriding CXXFLAGS. + CXXFLAGS="-fno-rtti $CXXFLAGS -fno-exceptions -fno-threadsafe-statics" + + case "$host" in + *-*-mingw*) + ;; + *) + # Hide inline methods + CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden" + ;; + esac + + case "$host" in + arm-*-*) + if test "x$ac_cv_alignof_struct_char__" != x1; then + # Request byte alignment + CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8" + fi + ;; + esac +fi + +AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes") + +hb_os_win32=no +AC_MSG_CHECKING([for native Win32]) +case "$host" in + *-*-mingw*) + hb_os_win32=yes + ;; +esac +AC_MSG_RESULT([$hb_os_win32]) +AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes") + +have_pthread=false +AX_PTHREAD([have_pthread=true]) +if $have_pthread; then + AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads]) +fi +AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread) + +dnl ========================================================================== + +AC_ARG_WITH(glib, + [AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@], + [Use glib @<:@default=auto@:>@])],, + [with_glib=auto]) +have_glib=false +GLIB_DEPS="glib-2.0 >= 2.19.1" +AC_SUBST(GLIB_DEPS) +if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then + PKG_CHECK_MODULES(GLIB, $GLIB_DEPS, have_glib=true, :) +fi +if test "x$with_glib" = "xyes" -a "x$have_glib" != "xtrue"; then + AC_MSG_ERROR([glib support requested but glib-2.0 not found]) +fi +if $have_glib; then + AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library]) +fi +AM_CONDITIONAL(HAVE_GLIB, $have_glib) + +dnl =========================================================================== + +AC_ARG_WITH(gobject, + [AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@], + [Use gobject @<:@default=no@:>@])],, + [with_gobject=no]) +have_gobject=false +if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then + PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :) +fi +if test "x$with_gobject" = "xyes" -a "x$have_gobject" != "xtrue"; then + AC_MSG_ERROR([gobject support requested but gobject-2.0 / glib-2.0 not found]) +fi +if $have_gobject; then + AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library]) + GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` + AC_SUBST(GLIB_MKENUMS) +fi +AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject) +AC_SUBST(have_gobject) + +dnl =========================================================================== + + +dnl =========================================================================== +# Gobject-Introspection +have_introspection=false +m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [ + if $have_gobject; then + GOBJECT_INTROSPECTION_CHECK([1.34.0]) + if test "x$found_introspection" = xyes; then + have_introspection=true + fi + else + AM_CONDITIONAL([HAVE_INTROSPECTION], false) + fi +], [ + AM_CONDITIONAL([HAVE_INTROSPECTION], false) +]) + +dnl ========================================================================== + +AC_ARG_WITH(cairo, + [AS_HELP_STRING([--with-cairo=@<:@yes/no/auto@:>@], + [Use cairo @<:@default=auto@:>@])],, + [with_cairo=auto]) +have_cairo=false +if test "x$with_cairo" = "xyes" -o "x$with_cairo" = "xauto"; then + PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, :) +fi +if test "x$with_cairo" = "xyes" -a "x$have_cairo" != "xtrue"; then + AC_MSG_ERROR([cairo support requested but not found]) +fi +if $have_cairo; then + AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library]) +fi +AM_CONDITIONAL(HAVE_CAIRO, $have_cairo) + +have_cairo_ft=false +if $have_cairo; then + PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, :) +fi +if $have_cairo_ft; then + AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library]) +fi +AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft) + +dnl ========================================================================== + +AC_ARG_WITH(fontconfig, + [AS_HELP_STRING([--with-fontconfig=@<:@yes/no/auto@:>@], + [Use fontconfig @<:@default=auto@:>@])],, + [with_fontconfig=auto]) +have_fontconfig=false +if test "x$with_fontconfig" = "xyes" -o "x$with_fontconfig" = "xauto"; then + PKG_CHECK_MODULES(FONTCONFIG, fontconfig, have_fontconfig=true, :) +fi +if test "x$with_fontconfig" = "xyes" -a "x$have_fontconfig" != "xtrue"; then + AC_MSG_ERROR([fontconfig support requested but not found]) +fi +if $have_fontconfig; then + AC_DEFINE(HAVE_FONTCONFIG, 1, [Have fontconfig library]) +fi +AM_CONDITIONAL(HAVE_FONTCONFIG, $have_fontconfig) + +dnl ========================================================================== + +AC_ARG_WITH(icu, + [AS_HELP_STRING([--with-icu=@<:@yes/no/builtin/auto@:>@], + [Use ICU @<:@default=auto@:>@])],, + [with_icu=auto]) +have_icu=false +if test "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" -o "x$with_icu" = "xauto"; then + PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :) + + dnl Fallback to icu-config if ICU pkg-config files could not be found + if test "$have_icu" != "true"; then + AC_CHECK_TOOL(ICU_CONFIG, icu-config, no) + AC_MSG_CHECKING([for ICU by using icu-config fallback]) + if test "$ICU_CONFIG" != "no" && "$ICU_CONFIG" --version >/dev/null; then + have_icu=true + # We don't use --cflags as this gives us a lot of things that we don't + # necessarily want, like debugging and optimization flags + # See man (1) icu-config for more info. + ICU_CFLAGS=`$ICU_CONFIG --cppflags` + ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath --ldflags-libsonly` + AC_SUBST(ICU_CFLAGS) + AC_SUBST(ICU_LIBS) + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi +fi +if test \( "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" \) -a "x$have_icu" != "xtrue"; then + AC_MSG_ERROR([icu support requested but icu-uc not found]) +fi + +if $have_icu; then + CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`" + AC_DEFINE(HAVE_ICU, 1, [Have ICU library]) + if test "x$with_icu" = "xbuiltin"; then + AC_DEFINE(HAVE_ICU_BUILTIN, 1, [Use hb-icu Unicode callbacks]) + fi +fi +AM_CONDITIONAL(HAVE_ICU, $have_icu) +AM_CONDITIONAL(HAVE_ICU_BUILTIN, $have_icu && test "x$with_icu" = "xbuiltin") + +dnl =========================================================================== + +AC_ARG_WITH(graphite2, + [AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@], + [Use the graphite2 library @<:@default=no@:>@])],, + [with_graphite2=no]) +have_graphite2=false +GRAPHITE2_DEPS="graphite2 >= 1.2.0" +AC_SUBST(GRAPHITE2_DEPS) +if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then + PKG_CHECK_MODULES(GRAPHITE2, $GRAPHITE2_DEPS, have_graphite2=true, :) + if test "x$have_graphite2" != "xtrue"; then + # If pkg-config is not available, graphite2 can still be there + ac_save_CFLAGS="$CFLAGS" + ac_save_CPPFLAGS="$CPPFLAGS" + CFLAGS="$CFLAGS $GRAPHITE2_CFLAGS" + CPPFLAGS="$CPPFLAGS $GRAPHITE2_CFLAGS" + AC_CHECK_HEADER(graphite2/Segment.h, have_graphite2=true, :) + CPPFLAGS="$ac_save_CPPFLAGS" + CFLAGS="$ac_save_CFLAGS" + fi +fi +if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then + AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found]) +fi +if $have_graphite2; then + AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library]) +fi +AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2) + +dnl ========================================================================== + +AC_ARG_WITH(freetype, + [AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@], + [Use the FreeType library @<:@default=auto@:>@])],, + [with_freetype=auto]) +have_freetype=false +FREETYPE_DEPS="freetype2 >= 12.0.6" +AC_SUBST(FREETYPE_DEPS) +if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then + # See freetype/docs/VERSION.DLL; 12.0.6 means freetype-2.4.2 + PKG_CHECK_MODULES(FREETYPE, $FREETYPE_DEPS, have_freetype=true, :) +fi +if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then + AC_MSG_ERROR([FreeType support requested but libfreetype2 not found]) +fi +if $have_freetype; then + AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library]) + save_libs=$LIBS + LIBS="$LIBS $FREETYPE_LIBS" + AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates FT_Done_MM_Var) + LIBS=$save_libs +fi +AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype) + +dnl =========================================================================== + +AC_ARG_WITH(uniscribe, + [AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@], + [Use the Uniscribe library @<:@default=no@:>@])],, + [with_uniscribe=no]) +have_uniscribe=false +if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then + AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true) +fi +if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then + AC_MSG_ERROR([uniscribe support requested but not found]) +fi +if $have_uniscribe; then + UNISCRIBE_CFLAGS= + UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4" + AC_SUBST(UNISCRIBE_CFLAGS) + AC_SUBST(UNISCRIBE_LIBS) + AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library]) +fi +AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe) + +dnl =========================================================================== + +AC_ARG_WITH(gdi, + [AS_HELP_STRING([--with-gdi=@<:@yes/no/auto@:>@], + [Provide GDI integration helpers @<:@default=no@:>@])],, + [with_gdi=no]) +have_gdi=false +if test "x$with_gdi" = "xyes" -o "x$with_gdi" = "xauto"; then + AC_CHECK_HEADERS(windows.h, have_gdi=true) +fi +if test "x$with_gdi" = "xyes" -a "x$have_gdi" != "xtrue"; then + AC_MSG_ERROR([gdi support requested but not found]) +fi +if $have_gdi; then + GDI_CFLAGS= + GDI_LIBS="-lgdi32" + AC_SUBST(GDI_CFLAGS) + AC_SUBST(GDI_LIBS) + AC_DEFINE(HAVE_GDI, 1, [Have GDI library]) +fi +AM_CONDITIONAL(HAVE_GDI, $have_gdi) + +dnl =========================================================================== + +AC_ARG_WITH(directwrite, + [AS_HELP_STRING([--with-directwrite=@<:@yes/no/auto@:>@], + [Use the DirectWrite library (experimental) @<:@default=no@:>@])],, + [with_directwrite=no]) +have_directwrite=false +AC_LANG_PUSH([C++]) +if test "x$with_directwrite" = "xyes" -o "x$with_directwrite" = "xauto"; then + AC_CHECK_HEADERS(dwrite.h, have_directwrite=true) +fi +AC_LANG_POP([C++]) +if test "x$with_directwrite" = "xyes" -a "x$have_directwrite" != "xtrue"; then + AC_MSG_ERROR([directwrite support requested but not found]) +fi +if $have_directwrite; then + DIRECTWRITE_CXXFLAGS= + DIRECTWRITE_LIBS= + AC_SUBST(DIRECTWRITE_CXXFLAGS) + AC_SUBST(DIRECTWRITE_LIBS) + AC_DEFINE(HAVE_DIRECTWRITE, 1, [Have DirectWrite library]) +fi +AM_CONDITIONAL(HAVE_DIRECTWRITE, $have_directwrite) + +dnl =========================================================================== + +AC_ARG_WITH(coretext, + [AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@], + [Use CoreText @<:@default=no@:>@])],, + [with_coretext=no]) +have_coretext=false +if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then + AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include ]) + + if $have_coretext; then + CORETEXT_CFLAGS= + CORETEXT_LIBS="-framework ApplicationServices" + AC_SUBST(CORETEXT_CFLAGS) + AC_SUBST(CORETEXT_LIBS) + else + # On iOS CoreText and CoreGraphics are stand-alone frameworks + if test "x$have_coretext" != "xtrue"; then + # Check for a different symbol to avoid getting cached result. + AC_CHECK_TYPE(CTRunRef, have_coretext=true,, [#include ]) + fi + + if $have_coretext; then + CORETEXT_CFLAGS= + CORETEXT_LIBS="-framework CoreText -framework CoreGraphics -framework CoreFoundation" + AC_SUBST(CORETEXT_CFLAGS) + AC_SUBST(CORETEXT_LIBS) + fi + fi +fi +if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then + AC_MSG_ERROR([CoreText support requested but libcoretext not found]) +fi +if $have_coretext; then + AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend]) +fi +AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext) + +dnl =========================================================================== + +AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [ + hb_cv_have_intel_atomic_primitives=false + AC_TRY_LINK([ + void memory_barrier (void) { __sync_synchronize (); } + int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); } + int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); } + void mutex_unlock (int *m) { __sync_lock_release (m); } + ], [], hb_cv_have_intel_atomic_primitives=true + ) +]) +if $hb_cv_have_intel_atomic_primitives; then + AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives]) +fi + +dnl =========================================================================== + +AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [ + hb_cv_have_solaris_atomic_ops=false + AC_TRY_LINK([ + #include + /* This requires Solaris Studio 12.2 or newer: */ + #include + void memory_barrier (void) { __machine_rw_barrier (); } + int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); } + void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); } + ], [], hb_cv_have_solaris_atomic_ops=true + ) +]) +if $hb_cv_have_solaris_atomic_ops; then + AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations]) +fi + +if test "$os_win32" = no && ! $have_pthread; then + AC_CHECK_HEADERS(sched.h) + AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield])) +fi + +dnl =========================================================================== + +AC_CONFIG_FILES([ +Makefile +src/Makefile +util/Makefile +test/Makefile +test/api/Makefile +test/fuzzing/Makefile +test/shaping/Makefile +test/shaping/data/Makefile +test/shaping/data/aots/Makefile +test/shaping/data/in-house/Makefile +test/shaping/data/text-rendering-tests/Makefile +test/subset/Makefile +test/subset/data/Makefile +docs/Makefile +docs/version.xml +]) + +AC_OUTPUT + +echo +echo "C++ compiler version:" +$CXX --version +echo + +AC_MSG_NOTICE([ + +Autotools is no longer our supported build system for building the library +for *nix distributions, please migrate to meson. + +]) + + +AC_MSG_NOTICE([ + +Build configuration: + +Unicode callbacks (you want at least one): + Builtin true + Glib: ${have_glib} + ICU: ${have_icu} + +Font callbacks (the more the merrier): + FreeType: ${have_freetype} + +Tools used for command-line utilities: + Cairo: ${have_cairo} + Fontconfig: ${have_fontconfig} + +Additional shapers: + Graphite2: ${have_graphite2} + +Platform shapers (not normally needed): + CoreText: ${have_coretext} + DirectWrite: ${have_directwrite} + GDI: ${have_gdi} + Uniscribe: ${have_uniscribe} + +Other features: + Documentation: ${enable_gtk_doc} + GObject bindings: ${have_gobject} + Introspection: ${have_introspection} +]) diff --git a/docs/Makefile.am b/docs/Makefile.am new file mode 100644 index 000000000..987feb5f4 --- /dev/null +++ b/docs/Makefile.am @@ -0,0 +1,126 @@ +# Process this file with automake to produce Makefile.in + +# We require automake 1.6 at least. +AUTOMAKE_OPTIONS = 1.6 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE=harfbuzz + +# Uncomment for versioned docs and specify the version of the module, e.g. '2'. +#DOC_MODULE_VERSION=$(HB_VERSION_MAJOR) + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml + +# Directories containing the source code. +# gtk-doc will search all .c and .h files beneath these paths +# for inline comments documenting functions and macros. +# e.g. DOC_SOURCE_DIR=$(top_srcdir)/gtk $(top_srcdir)/gdk +DOC_SOURCE_DIR=$(top_srcdir)/src $(top_builddir)/src + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS= + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS=--rebuild-types --deprecated-guards="HB_DISABLE_DEPRECATED" \ + --ignore-decorators="HB_EXTERN" + +# Header files or dirs to ignore when scanning. Use base file/dir names +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code +IGNORE_HFILES=`cd $(top_srcdir)/src; find . -path './*/*.h' | sed 's@^.*/@@'` +if HAVE_GOBJECT +else +IGNORE_HFILES+=hb-gobject.h hb-gobject-enums.h hb-gobject-structs.h +endif + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--xml-mode --output-format=xml +MKDB_OPTIONS=--source-suffixes=h,cc --xml-mode --output-format=xml --ignore-files="$(IGNORE_HFILES)" + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS= + +# Extra options to supply to gtkdoc-mkhtml +MKHTML_OPTIONS= + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS= + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB=$(top_srcdir)/src/hb.h $(top_srcdir)/src/hb-*.h +CFILE_GLOB=$(top_srcdir)/src/hb-*.cc + +# Extra header to include when scanning, which are not under DOC_SOURCE_DIR +# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES= \ + HarfBuzz.png \ + HarfBuzz.svg + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files= \ + usermanual-what-is-harfbuzz.xml \ + usermanual-install-harfbuzz.xml \ + usermanual-getting-started.xml \ + usermanual-glyph-information.xml \ + usermanual-shaping-concepts.xml \ + usermanual-object-model.xml \ + usermanual-buffers-language-script-and-direction.xml \ + usermanual-fonts-and-faces.xml \ + usermanual-opentype-features.xml \ + usermanual-clusters.xml \ + usermanual-utilities.xml \ + usermanual-integration.xml \ + version.xml + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files= + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) +GTKDOC_CFLAGS= +GTKDOC_LIBS=$(top_builddir)/src/libharfbuzz.la +if HAVE_GOBJECT +GTKDOC_LIBS+=$(top_builddir)/src/libharfbuzz-gobject.la +endif + +# This includes the standard gtk-doc make rules, copied by gtkdocize. +include $(top_srcdir)/gtk-doc.make + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +EXTRA_DIST += version.xml.in meson.build + +# Files not to distribute +# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types +# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt +#DISTCLEANFILES += + +# Comment this out if you don't want 'make check' to test you doc status +# and run some sanity checks +if ENABLE_GTK_DOC +TESTS_ENVIRONMENT = cd $(srcdir) && \ + DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \ + SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir) +#TESTS = $(GTKDOC_CHECK) +endif + +-include $(top_srcdir)/git.mk diff --git a/git.mk b/git.mk new file mode 100644 index 000000000..6e2708f2d --- /dev/null +++ b/git.mk @@ -0,0 +1,400 @@ +# git.mk, a small Makefile to autogenerate .gitignore files +# for autotools-based projects. +# +# Copyright 2009, Red Hat, Inc. +# Copyright 2010,2011,2012,2013 Behdad Esfahbod +# Written by Behdad Esfahbod +# +# Copying and distribution of this file, with or without modification, +# is permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. +# +# The latest version of this file can be downloaded from: +GIT_MK_URL = https://raw.githubusercontent.com/behdad/git.mk/master/git.mk +# +# Bugs, etc, should be reported upstream at: +# https://github.com/behdad/git.mk +# +# To use in your project, import this file in your git repo's toplevel, +# then do "make -f git.mk". This modifies all Makefile.am files in +# your project to -include git.mk. Remember to add that line to new +# Makefile.am files you create in your project, or just rerun the +# "make -f git.mk". +# +# This enables automatic .gitignore generation. If you need to ignore +# more files, add them to the GITIGNOREFILES variable in your Makefile.am. +# But think twice before doing that. If a file has to be in .gitignore, +# chances are very high that it's a generated file and should be in one +# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES. +# +# The only case that you need to manually add a file to GITIGNOREFILES is +# when remove files in one of mostlyclean-local, clean-local, distclean-local, +# or maintainer-clean-local make targets. +# +# Note that for files like editor backup, etc, there are better places to +# ignore them. See "man gitignore". +# +# If "make maintainer-clean" removes the files but they are not recognized +# by this script (that is, if "git status" shows untracked files still), send +# me the output of "git status" as well as your Makefile.am and Makefile for +# the directories involved and I'll diagnose. +# +# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see +# Makefile.am.sample in the git.mk git repo. +# +# Don't EXTRA_DIST this file. It is supposed to only live in git clones, +# not tarballs. It serves no useful purpose in tarballs and clutters the +# build dir. +# +# This file knows how to handle autoconf, automake, libtool, gtk-doc, +# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu, appdata, +# appstream, hotdoc. +# +# This makefile provides the following targets: +# +# - all: "make all" will build all gitignore files. +# - gitignore: makes all gitignore files in the current dir and subdirs. +# - .gitignore: make gitignore file for the current dir. +# - gitignore-recurse: makes all gitignore files in the subdirs. +# +# KNOWN ISSUES: +# +# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the +# submodule doesn't find us. If you have configure.{in,ac} files in +# subdirs, add a proxy git.mk file in those dirs that simply does: +# "include $(top_srcdir)/../git.mk". Add more ..'s to your taste. +# And add those files to git. See vte/gnome-pty-helper/git.mk for +# example. +# + + + +############################################################################### +# Variables user modules may want to add to toplevel MAINTAINERCLEANFILES: +############################################################################### + +# +# Most autotools-using modules should be fine including this variable in their +# toplevel MAINTAINERCLEANFILES: +GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL = \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/autoscan.log \ + $(srcdir)/configure.scan \ + `AUX_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_AUX_DIR:$$1' ./configure.ac); \ + test "x$$AUX_DIR" = "x$(srcdir)/" && AUX_DIR=$(srcdir); \ + for x in \ + ar-lib \ + compile \ + config.guess \ + config.rpath \ + config.sub \ + depcomp \ + install-sh \ + ltmain.sh \ + missing \ + mkinstalldirs \ + test-driver \ + ylwrap \ + ; do echo "$$AUX_DIR/$$x"; done` \ + `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_HEADERS:$$1' ./configure.ac | \ + head -n 1 | while read f; do echo "$(srcdir)/$$f.in"; done` +# +# All modules should also be fine including the following variable, which +# removes automake-generated Makefile.in files: +GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN = \ + `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_FILES:$$1' ./configure.ac | \ + while read f; do \ + case $$f in Makefile|*/Makefile) \ + test -f "$(srcdir)/$$f.am" && echo "$(srcdir)/$$f.in";; esac; \ + done` +# +# Modules that use libtool and use AC_CONFIG_MACRO_DIR() may also include this, +# though it's harmless to include regardless. +GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL = \ + `MACRO_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_MACRO_DIR:$$1' ./configure.ac); \ + if test "x$$MACRO_DIR" != "x$(srcdir)/"; then \ + for x in \ + libtool.m4 \ + ltoptions.m4 \ + ltsugar.m4 \ + ltversion.m4 \ + lt~obsolete.m4 \ + ; do echo "$$MACRO_DIR/$$x"; done; \ + fi` +# +# Modules that use gettext and use AC_CONFIG_MACRO_DIR() may also include this, +# though it's harmless to include regardless. +GITIGNORE_MAINTAINERCLEANFILES_M4_GETTEXT = \ + `MACRO_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_MACRO_DIR:$$1' ./configure.ac); \ + if test "x$$MACRO_DIR" != "x$(srcdir)/"; then \ + for x in \ + codeset.m4 \ + extern-inline.m4 \ + fcntl-o.m4 \ + gettext.m4 \ + glibc2.m4 \ + glibc21.m4 \ + iconv.m4 \ + intdiv0.m4 \ + intl.m4 \ + intldir.m4 \ + intlmacosx.m4 \ + intmax.m4 \ + inttypes-pri.m4 \ + inttypes_h.m4 \ + lcmessage.m4 \ + lib-ld.m4 \ + lib-link.m4 \ + lib-prefix.m4 \ + lock.m4 \ + longlong.m4 \ + nls.m4 \ + po.m4 \ + printf-posix.m4 \ + progtest.m4 \ + size_max.m4 \ + stdint_h.m4 \ + threadlib.m4 \ + uintmax_t.m4 \ + visibility.m4 \ + wchar_t.m4 \ + wint_t.m4 \ + xsize.m4 \ + ; do echo "$$MACRO_DIR/$$x"; done; \ + fi` + + + +############################################################################### +# Default rule is to install ourselves in all Makefile.am files: +############################################################################### + +git-all: git-mk-install + +git-mk-install: + @echo "Installing git makefile" + @any_failed=; \ + find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \ + if grep 'include .*/git.mk' $$x >/dev/null; then \ + echo "$$x already includes git.mk"; \ + else \ + failed=; \ + echo "Updating $$x"; \ + { cat $$x; \ + echo ''; \ + echo '-include $$(top_srcdir)/git.mk'; \ + } > $$x.tmp || failed=1; \ + if test x$$failed = x; then \ + mv $$x.tmp $$x || failed=1; \ + fi; \ + if test x$$failed = x; then : else \ + echo "Failed updating $$x"; >&2 \ + any_failed=1; \ + fi; \ + fi; done; test -z "$$any_failed" + +git-mk-update: + wget $(GIT_MK_URL) -O $(top_srcdir)/git.mk + +.PHONY: git-all git-mk-install git-mk-update + + + +############################################################################### +# Actual .gitignore generation: +############################################################################### + +$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk + @echo "git.mk: Generating $@" + @{ \ + if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \ + for x in \ + $(DOC_MODULE)-decl-list.txt \ + $(DOC_MODULE)-decl.txt \ + tmpl/$(DOC_MODULE)-unused.sgml \ + "tmpl/*.bak" \ + $(REPORT_FILES) \ + $(DOC_MODULE).pdf \ + xml html \ + ; do echo "/$$x"; done; \ + FLAVOR=$$(cd $(top_srcdir); $(AUTOCONF) --trace 'GTK_DOC_CHECK:$$2' ./configure.ac); \ + case $$FLAVOR in *no-tmpl*) echo /tmpl;; esac; \ + if echo "$(SCAN_OPTIONS)" | grep -q "\-\-rebuild-types"; then \ + echo "/$(DOC_MODULE).types"; \ + fi; \ + if echo "$(SCAN_OPTIONS)" | grep -q "\-\-rebuild-sections"; then \ + echo "/$(DOC_MODULE)-sections.txt"; \ + fi; \ + if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ + for x in \ + $(SETUP_FILES) \ + $(DOC_MODULE).types \ + ; do echo "/$$x"; done; \ + fi; \ + fi; \ + if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \ + for lc in $(DOC_LINGUAS); do \ + for x in \ + $(if $(DOC_MODULE),$(DOC_MODULE).xml) \ + $(DOC_PAGES) \ + $(DOC_INCLUDES) \ + ; do echo "/$$lc/$$x"; done; \ + done; \ + for x in \ + $(_DOC_OMF_ALL) \ + $(_DOC_DSK_ALL) \ + $(_DOC_HTML_ALL) \ + $(_DOC_MOFILES) \ + $(DOC_H_FILE) \ + "*/.xml2po.mo" \ + "*/*.omf.out" \ + ; do echo /$$x; done; \ + fi; \ + if test "x$(HOTDOC)" = x; then :; else \ + $(foreach project, $(HOTDOC_PROJECTS),echo "/$(call HOTDOC_TARGET,$(project))"; \ + echo "/$(shell $(call HOTDOC_PROJECT_COMMAND,$(project)) --get-conf-path output)" ; \ + echo "/$(shell $(call HOTDOC_PROJECT_COMMAND,$(project)) --get-private-folder)" ; \ + ) \ + for x in \ + .hotdoc.d \ + ; do echo "/$$x"; done; \ + fi; \ + if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \ + for lc in $(HELP_LINGUAS); do \ + for x in \ + $(HELP_FILES) \ + "$$lc.stamp" \ + "$$lc.mo" \ + ; do echo "/$$lc/$$x"; done; \ + done; \ + fi; \ + if test "x$(gsettings_SCHEMAS)" = x; then :; else \ + for x in \ + $(gsettings_SCHEMAS:.xml=.valid) \ + $(gsettings__enum_file) \ + ; do echo "/$$x"; done; \ + fi; \ + if test "x$(appdata_XML)" = x; then :; else \ + for x in \ + $(appdata_XML:.xml=.valid) \ + ; do echo "/$$x"; done; \ + fi; \ + if test "x$(appstream_XML)" = x; then :; else \ + for x in \ + $(appstream_XML:.xml=.valid) \ + ; do echo "/$$x"; done; \ + fi; \ + if test -f $(srcdir)/po/Makefile.in.in; then \ + for x in \ + ABOUT-NLS \ + po/Makefile.in.in \ + po/Makefile.in.in~ \ + po/Makefile.in \ + po/Makefile \ + po/Makevars.template \ + po/POTFILES \ + po/Rules-quot \ + po/stamp-it \ + po/stamp-po \ + po/.intltool-merge-cache \ + "po/*.gmo" \ + "po/*.header" \ + "po/*.mo" \ + "po/*.sed" \ + "po/*.sin" \ + po/$(GETTEXT_PACKAGE).pot \ + intltool-extract.in \ + intltool-merge.in \ + intltool-update.in \ + ; do echo "/$$x"; done; \ + fi; \ + if test -f $(srcdir)/configure; then \ + for x in \ + autom4te.cache \ + configure \ + config.h \ + stamp-h1 \ + libtool \ + config.lt \ + ; do echo "/$$x"; done; \ + fi; \ + if test "x$(DEJATOOL)" = x; then :; else \ + for x in \ + $(DEJATOOL) \ + ; do echo "/$$x.sum"; echo "/$$x.log"; done; \ + echo /site.exp; \ + fi; \ + if test "x$(am__dirstamp)" = x; then :; else \ + echo "$(am__dirstamp)"; \ + fi; \ + if test "x$(findstring libtool,$(LTCOMPILE))" = x -a "x$(findstring libtool,$(LTCXXCOMPILE))" = x -a "x$(GTKDOC_RUN)" = x; then :; else \ + for x in \ + "*.lo" \ + ".libs" "_libs" \ + ; do echo "$$x"; done; \ + fi; \ + for x in \ + .gitignore \ + $(GITIGNOREFILES) \ + $(CLEANFILES) \ + $(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \ + $(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \ + $(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \ + so_locations \ + $(MOSTLYCLEANFILES) \ + $(TEST_LOGS) \ + $(TEST_LOGS:.log=.trs) \ + $(TEST_SUITE_LOG) \ + $(TESTS:=.test) \ + "*.gcda" \ + "*.gcno" \ + $(DISTCLEANFILES) \ + $(am__CONFIG_DISTCLEAN_FILES) \ + $(CONFIG_CLEAN_FILES) \ + TAGS ID GTAGS GRTAGS GSYMS GPATH tags \ + "*.tab.c" \ + $(MAINTAINERCLEANFILES) \ + $(BUILT_SOURCES) \ + $(patsubst %.vala,%.c,$(filter %.vala,$(SOURCES))) \ + $(filter %_vala.stamp,$(DIST_COMMON)) \ + $(filter %.vapi,$(DIST_COMMON)) \ + $(filter $(addprefix %,$(notdir $(patsubst %.vapi,%.h,$(filter %.vapi,$(DIST_COMMON))))),$(DIST_COMMON)) \ + Makefile \ + Makefile.in \ + "*.orig" \ + "*.rej" \ + "*.bak" \ + "*~" \ + ".*.sw[nop]" \ + ".dirstamp" \ + ; do echo "/$$x"; done; \ + for x in \ + "*.$(OBJEXT)" \ + $(DEPDIR) \ + ; do echo "$$x"; done; \ + } | \ + sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \ + sed 's@/[.]/@/@g' | \ + LC_ALL=C sort | uniq > $@.tmp && \ + mv $@.tmp $@; + +all: $(srcdir)/.gitignore gitignore-recurse-maybe +gitignore: $(srcdir)/.gitignore gitignore-recurse + +gitignore-recurse-maybe: + @for subdir in $(DIST_SUBDIRS); do \ + case " $(SUBDIRS) " in \ + *" $$subdir "*) :;; \ + *) test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || echo "Skipping $$subdir");; \ + esac; \ + done +gitignore-recurse: + @for subdir in $(DIST_SUBDIRS); do \ + test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || echo "Skipping $$subdir"); \ + done + +maintainer-clean: gitignore-clean +gitignore-clean: + -rm -f $(srcdir)/.gitignore + +.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe diff --git a/m4/ax_check_link_flag.m4 b/m4/ax_check_link_flag.m4 new file mode 100644 index 000000000..819409a20 --- /dev/null +++ b/m4/ax_check_link_flag.m4 @@ -0,0 +1,74 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the linker or gives an error. +# (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the linker's default flags +# when the check is done. The check is thus made with the flags: "LDFLAGS +# EXTRA-FLAGS FLAG". This can for example be used to force the linker to +# issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_LINK_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 5 + +AC_DEFUN([AX_CHECK_LINK_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl +AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ + ax_check_save_flags=$LDFLAGS + LDFLAGS="$LDFLAGS $4 $1" + AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + LDFLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_LINK_FLAGS diff --git a/m4/ax_code_coverage.m4 b/m4/ax_code_coverage.m4 new file mode 100644 index 000000000..6484f0332 --- /dev/null +++ b/m4/ax_code_coverage.m4 @@ -0,0 +1,264 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CODE_COVERAGE() +# +# DESCRIPTION +# +# Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS, +# CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included +# in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every +# build target (program or library) which should be built with code +# coverage support. Also defines CODE_COVERAGE_RULES which should be +# substituted in your Makefile; and $enable_code_coverage which can be +# used in subsequent configure output. CODE_COVERAGE_ENABLED is defined +# and substituted, and corresponds to the value of the +# --enable-code-coverage option, which defaults to being disabled. +# +# Test also for gcov program and create GCOV variable that could be +# substituted. +# +# Note that all optimization flags in CFLAGS must be disabled when code +# coverage is enabled. +# +# Usage example: +# +# configure.ac: +# +# AX_CODE_COVERAGE +# +# Makefile.am: +# +# @CODE_COVERAGE_RULES@ +# my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ... +# my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ... +# my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ... +# my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ... +# +# This results in a "check-code-coverage" rule being added to any +# Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module +# has been configured with --enable-code-coverage). Running `make +# check-code-coverage` in that directory will run the module's test suite +# (`make check`) and build a code coverage report detailing the code which +# was touched, then print the URI for the report. +# +# In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined +# instead of CODE_COVERAGE_LIBS. They are both still defined, but use of +# CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is +# deprecated. They have the same value. +# +# This code was derived from Makefile.decl in GLib, originally licenced +# under LGPLv2.1+. +# +# LICENSE +# +# Copyright (c) 2012, 2016 Philip Withnall +# Copyright (c) 2012 Xan Lopez +# Copyright (c) 2012 Christian Persch +# Copyright (c) 2012 Paolo Borelli +# Copyright (c) 2012 Dan Winship +# Copyright (c) 2015 Bastien ROUCARIES +# +# This library is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This library is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . + +#serial 25 + +AC_DEFUN([AX_CODE_COVERAGE],[ + dnl Check for --enable-code-coverage + AC_REQUIRE([AC_PROG_SED]) + + # allow to override gcov location + AC_ARG_WITH([gcov], + [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])], + [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov], + [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov]) + + AC_MSG_CHECKING([whether to build with code coverage support]) + AC_ARG_ENABLE([code-coverage], + AS_HELP_STRING([--enable-code-coverage], + [Whether to enable code coverage support]),, + enable_code_coverage=no) + + AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes]) + AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage]) + AC_MSG_RESULT($enable_code_coverage) + + AS_IF([ test "$enable_code_coverage" = "yes" ], [ + # check for gcov + AC_CHECK_TOOL([GCOV], + [$_AX_CODE_COVERAGE_GCOV_PROG_WITH], + [:]) + AS_IF([test "X$GCOV" = "X:"], + [AC_MSG_ERROR([gcov is needed to do coverage])]) + AC_SUBST([GCOV]) + + dnl Check if gcc is being used + AS_IF([ test "$GCC" = "no" ], [ + AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage]) + ]) + + AC_CHECK_PROG([LCOV], [lcov], [lcov]) + AC_CHECK_PROG([GENHTML], [genhtml], [genhtml]) + + AS_IF([ test -z "$LCOV" ], [ + AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed]) + ]) + + AS_IF([ test -z "$GENHTML" ], [ + AC_MSG_ERROR([Could not find genhtml from the lcov package]) + ]) + + dnl Build the code coverage flags + dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility + CODE_COVERAGE_CPPFLAGS="-DNDEBUG" + CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" + CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" + CODE_COVERAGE_LIBS="-lgcov" + CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS" + + AC_SUBST([CODE_COVERAGE_CPPFLAGS]) + AC_SUBST([CODE_COVERAGE_CFLAGS]) + AC_SUBST([CODE_COVERAGE_CXXFLAGS]) + AC_SUBST([CODE_COVERAGE_LIBS]) + AC_SUBST([CODE_COVERAGE_LDFLAGS]) + + [CODE_COVERAGE_RULES_CHECK=' + -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check + $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture +'] + [CODE_COVERAGE_RULES_CAPTURE=' + $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) + $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) + -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp + $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) + @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" +'] + [CODE_COVERAGE_RULES_CLEAN=' +clean: code-coverage-clean +distclean: code-coverage-clean +code-coverage-clean: + -$(LCOV) --directory $(top_builddir) -z + -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY) + -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete +'] + ], [ + [CODE_COVERAGE_RULES_CHECK=' + @echo "Need to reconfigure with --enable-code-coverage" +'] + CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK" + CODE_COVERAGE_RULES_CLEAN='' + ]) + +[CODE_COVERAGE_RULES=' +# Code coverage +# +# Optional: +# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. +# Multiple directories may be specified, separated by whitespace. +# (Default: $(top_builddir)) +# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated +# by lcov for code coverage. (Default: +# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) +# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage +# reports to be created. (Default: +# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) +# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, +# set to 0 to disable it and leave empty to stay with the default. +# (Default: empty) +# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov +# instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) +# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov +# instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) +# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov +# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the +# collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) +# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov +# instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) +# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering +# lcov instance. (Default: empty) +# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov +# instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) +# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the +# genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) +# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml +# instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) +# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore +# +# The generated report will be titled using the $(PACKAGE_NAME) and +# $(PACKAGE_VERSION). In order to add the current git hash to the title, +# use the git-version-gen script, available online. + +# Optional variables +CODE_COVERAGE_DIRECTORY ?= $(top_builddir) +CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info +CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage +CODE_COVERAGE_BRANCH_COVERAGE ?= +CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ +--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) +CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) +CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" +CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) +CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) +CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= +CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) +CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\ +$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ +--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) +CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) +CODE_COVERAGE_IGNORE_PATTERN ?= + +GITIGNOREFILES ?= +GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) + +code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V)) +code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) +code_coverage_v_lcov_cap_0 = @echo " LCOV --capture"\ + $(CODE_COVERAGE_OUTPUT_FILE); +code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) +code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) +code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*"\ + $(CODE_COVERAGE_IGNORE_PATTERN); +code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) +code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) +code_coverage_v_genhtml_0 = @echo " GEN " $(CODE_COVERAGE_OUTPUT_DIRECTORY); +code_coverage_quiet = $(code_coverage_quiet_$(V)) +code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) +code_coverage_quiet_0 = --quiet + +# sanitizes the test-name: replaces with underscores: dashes and dots +code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1))) + +# Use recursive makes in order to ignore errors during check +check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"' + +# Capture code coverage data +code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"' + +# Hook rule executed before code-coverage-capture, overridable by the user +code-coverage-capture-hook: + +'"$CODE_COVERAGE_RULES_CLEAN"' + +A''M_DISTCHECK_CONFIGURE_FLAGS ?= +A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage + +.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean +'] + + AC_SUBST([CODE_COVERAGE_RULES]) + m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])]) +]) diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 new file mode 100644 index 000000000..8b6df5a5d --- /dev/null +++ b/m4/ax_cxx_compile_stdcxx.m4 @@ -0,0 +1,982 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the specified +# version of the C++ standard. If necessary, add switches to CXX and +# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) +# or '14' (for the C++14 standard). +# +# The second argument, if specified, indicates whether you insist on an +# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. +# -std=c++11). If neither is specified, you get whatever works, with +# preference for an extended mode. +# +# The third argument, if specified 'mandatory' or if left unspecified, +# indicates that baseline support for the specified C++ standard is +# required and that the macro should error out if no mode with that +# support is found. If specified 'optional', then configuration proceeds +# regardless, after defining HAVE_CXX${VERSION} if and only if a +# supporting mode is found. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov +# Copyright (c) 2015 Paul Norman +# Copyright (c) 2015 Moritz Klammler +# Copyright (c) 2016 Krzesimir Nowak +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 7 + +dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro +dnl (serial version number 13). + +AX_REQUIRE_DEFINED([AC_MSG_WARN]) +AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl + m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], + [$1], [14], [ax_cxx_compile_alternatives="14 1y"], + [$1], [17], [ax_cxx_compile_alternatives="17 1z"], + [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$2], [], [], + [$2], [ext], [], + [$2], [noext], [], + [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], + [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], + [$3], [optional], [ax_cxx_compile_cxx$1_required=false], + [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) + AC_LANG_PUSH([C++])dnl + ac_success=no + AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, + ax_cv_cxx_compile_cxx$1, + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [ax_cv_cxx_compile_cxx$1=yes], + [ax_cv_cxx_compile_cxx$1=no])]) + if test x$ax_cv_cxx_compile_cxx$1 = xyes; then + ac_success=yes + fi + + m4_if([$2], [noext], [], [dnl + if test x$ac_success = xno; then + for alternative in ${ax_cxx_compile_alternatives}; do + switch="-std=gnu++${alternative}" + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXX="$CXX" + CXX="$CXX $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + fi]) + + m4_if([$2], [ext], [], [dnl + if test x$ac_success = xno; then + dnl HP's aCC needs +std=c++11 according to: + dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf + dnl Cray's crayCC needs "-h std=c++11" + for alternative in ${ax_cxx_compile_alternatives}; do + for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXX="$CXX" + CXX="$CXX $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + if test x$ac_success = xyes; then + break + fi + done + fi]) + AC_LANG_POP([C++]) + if test x$ax_cxx_compile_cxx$1_required = xtrue; then + if test x$ac_success = xno; then + AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) + fi + fi + if test x$ac_success = xno; then + HAVE_CXX$1=0 + AC_MSG_NOTICE([No compiler with C++$1 support was found]) + else + HAVE_CXX$1=1 + AC_DEFINE(HAVE_CXX$1,1, + [define if the compiler supports basic C++$1 syntax]) + fi + AC_SUBST(HAVE_CXX$1) + m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])]) +]) + + +dnl Test body for checking C++11 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 +) + + +dnl Test body for checking C++14 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 +) + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 +) + +dnl Tests for new features in C++11 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201103L + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual void f() {} + }; + + struct Derived : public Base + { + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // https://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + +]]) + + +dnl Tests for new features in C++14 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_separators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + +]]) + + +dnl Tests for new features in C++17 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ + +// If the compiler admits that it is not ready for C++17, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus <= 201402L + +#error "This is not a C++17 compiler" + +#else + +#if defined(__clang__) + #define REALLY_CLANG +#else + #if defined(__GNUC__) + #define REALLY_GCC + #endif +#endif + +#include +#include +#include + +namespace cxx17 +{ + +#if !defined(REALLY_CLANG) + namespace test_constexpr_lambdas + { + + // TODO: test it with clang++ from git + + constexpr int foo = [](){return 42;}(); + + } +#endif // !defined(REALLY_CLANG) + + namespace test::nested_namespace::definitions + { + + } + + namespace test_fold_expression + { + + template + int multiply(Args... args) + { + return (args * ... * 1); + } + + template + bool all(Args... args) + { + return (args && ...); + } + + } + + namespace test_extended_static_assert + { + + static_assert (true); + + } + + namespace test_auto_brace_init_list + { + + auto foo = {5}; + auto bar {5}; + + static_assert(std::is_same, decltype(foo)>::value); + static_assert(std::is_same::value); + } + + namespace test_typename_in_template_template_parameter + { + + template typename X> struct D; + + } + + namespace test_fallthrough_nodiscard_maybe_unused_attributes + { + + int f1() + { + return 42; + } + + [[nodiscard]] int f2() + { + [[maybe_unused]] auto unused = f1(); + + switch (f1()) + { + case 17: + f1(); + [[fallthrough]]; + case 42: + f1(); + } + return f1(); + } + + } + + namespace test_extended_aggregate_initialization + { + + struct base1 + { + int b1, b2 = 42; + }; + + struct base2 + { + base2() { + b3 = 42; + } + int b3; + }; + + struct derived : base1, base2 + { + int d; + }; + + derived d1 {{1, 2}, {}, 4}; // full initialization + derived d2 {{}, {}, 4}; // value-initialized bases + + } + + namespace test_general_range_based_for_loop + { + + struct iter + { + int i; + + int& operator* () + { + return i; + } + + const int& operator* () const + { + return i; + } + + iter& operator++() + { + ++i; + return *this; + } + }; + + struct sentinel + { + int i; + }; + + bool operator== (const iter& i, const sentinel& s) + { + return i.i == s.i; + } + + bool operator!= (const iter& i, const sentinel& s) + { + return !(i == s); + } + + struct range + { + iter begin() const + { + return {0}; + } + + sentinel end() const + { + return {5}; + } + }; + + void f() + { + range r {}; + + for (auto i : r) + { + [[maybe_unused]] auto v = i; + } + } + + } + + namespace test_lambda_capture_asterisk_this_by_value + { + + struct t + { + int i; + int foo() + { + return [*this]() + { + return i; + }(); + } + }; + + } + + namespace test_enum_class_construction + { + + enum class byte : unsigned char + {}; + + byte foo {42}; + + } + + namespace test_constexpr_if + { + + template + int f () + { + if constexpr(cond) + { + return 13; + } + else + { + return 42; + } + } + + } + + namespace test_selection_statement_with_initializer + { + + int f() + { + return 13; + } + + int f2() + { + if (auto i = f(); i > 0) + { + return 3; + } + + switch (auto i = f(); i + 4) + { + case 17: + return 2; + + default: + return 1; + } + } + + } + +#if !defined(REALLY_CLANG) + namespace test_template_argument_deduction_for_class_templates + { + + // TODO: test it with clang++ from git + + template + struct pair + { + pair (T1 p1, T2 p2) + : m1 {p1}, + m2 {p2} + {} + + T1 m1; + T2 m2; + }; + + void f() + { + [[maybe_unused]] auto p = pair{13, 42u}; + } + + } +#endif // !defined(REALLY_CLANG) + + namespace test_non_type_auto_template_parameters + { + + template + struct B + {}; + + B<5> b1; + B<'a'> b2; + + } + +#if !defined(REALLY_CLANG) + namespace test_structured_bindings + { + + // TODO: test it with clang++ from git + + int arr[2] = { 1, 2 }; + std::pair pr = { 1, 2 }; + + auto f1() -> int(&)[2] + { + return arr; + } + + auto f2() -> std::pair& + { + return pr; + } + + struct S + { + int x1 : 2; + volatile double y1; + }; + + S f3() + { + return {}; + } + + auto [ x1, y1 ] = f1(); + auto& [ xr1, yr1 ] = f1(); + auto [ x2, y2 ] = f2(); + auto& [ xr2, yr2 ] = f2(); + const auto [ x3, y3 ] = f3(); + + } +#endif // !defined(REALLY_CLANG) + +#if !defined(REALLY_CLANG) + namespace test_exception_spec_type_system + { + + // TODO: test it with clang++ from git + + struct Good {}; + struct Bad {}; + + void g1() noexcept; + void g2(); + + template + Bad + f(T*, T*); + + template + Good + f(T1*, T2*); + + static_assert (std::is_same_v); + + } +#endif // !defined(REALLY_CLANG) + + namespace test_inline_variables + { + + template void f(T) + {} + + template inline T g(T) + { + return T{}; + } + + template<> inline void f<>(int) + {} + + template<> int g<>(int) + { + return 5; + } + + } + +} // namespace cxx17 + +#endif // __cplusplus <= 201402L + +]]) diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 new file mode 100644 index 000000000..5fbf9fe0d --- /dev/null +++ b/m4/ax_pthread.m4 @@ -0,0 +1,485 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_pthread.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC to any special C compiler that is needed for +# multi-threaded programs (defaults to the value of CC otherwise). (This +# is necessary on AIX to use the special cc_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also to link with them as well. For example, you might link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threaded programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC" +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to +# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# Updated for Autoconf 2.68 by Daniel Richard G. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2011 Daniel Richard G. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 24 + +AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) +AC_DEFUN([AX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_PROG_SED]) +AC_LANG_PUSH([C]) +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on Tru64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) + AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) + AC_MSG_RESULT([$ax_pthread_ok]) + if test "x$ax_pthread_ok" = "xno"; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 +# (Note: HP C rejects this with "bad form for `-t' option") +# -pthreads: Solaris/gcc (Note: HP C also rejects) +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads and +# -D_REENTRANT too), HP C (must be checked before -lpthread, which +# is present but should not be used directly; and before -mthreads, +# because the compiler interprets this as "-mt" + "-hreads") +# -mthreads: Mingw32/gcc, Lynx/gcc +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case $host_os in + + freebsd*) + + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; + + hpux*) + + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." + + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; + + openedition*) + + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) + + AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], + [ +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif + ], + [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) + ;; + + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # that too in a future libc.) So we'll check first for the + # standard Solaris way of linking pthreads (-mt -lpthread). + + ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" + ;; +esac + +# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) + +AS_IF([test "x$GCC" = "xyes"], + [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"]) + +# The presence of a feature test macro requesting re-entrant function +# definitions is, on some systems, a strong hint that pthreads support is +# correctly enabled + +case $host_os in + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" + ;; + + aix*) + ax_pthread_check_macro="_THREAD_SAFE" + ;; + + *) + ax_pthread_check_macro="--" + ;; +esac +AS_IF([test "x$ax_pthread_check_macro" = "x--"], + [ax_pthread_check_cond=0], + [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) + +# Are we compiling with Clang? + +AC_CACHE_CHECK([whether $CC is Clang], + [ax_cv_PTHREAD_CLANG], + [ax_cv_PTHREAD_CLANG=no + # Note that Autoconf sets GCC=yes for Clang as well as GCC + if test "x$GCC" = "xyes"; then + AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], + [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + ], + [ax_cv_PTHREAD_CLANG=yes]) + fi + ]) +ax_pthread_clang="$ax_cv_PTHREAD_CLANG" + +ax_pthread_clang_warning=no + +# Clang needs special handling, because older versions handle the -pthread +# option in a rather... idiosyncratic way + +if test "x$ax_pthread_clang" = "xyes"; then + + # Clang takes -pthread; it has never supported any other flag + + # (Note 1: This will need to be revisited if a system that Clang + # supports has POSIX threads in a separate library. This tends not + # to be the way of modern systems, but it's conceivable.) + + # (Note 2: On some systems, notably Darwin, -pthread is not needed + # to get POSIX threads support; the API is always present and + # active. We could reasonably leave PTHREAD_CFLAGS empty. But + # -pthread does define _REENTRANT, and while the Darwin headers + # ignore this macro, third-party headers might not.) + + PTHREAD_CFLAGS="-pthread" + PTHREAD_LIBS= + + ax_pthread_ok=yes + + # However, older versions of Clang make a point of warning the user + # that, in an invocation where only linking and no compilation is + # taking place, the -pthread option has no effect ("argument unused + # during compilation"). They expect -pthread to be passed in only + # when source code is being compiled. + # + # Problem is, this is at odds with the way Automake and most other + # C build frameworks function, which is that the same flags used in + # compilation (CFLAGS) are also used in linking. Many systems + # supported by AX_PTHREAD require exactly this for POSIX threads + # support, and in fact it is often not straightforward to specify a + # flag that is used only in the compilation phase and not in + # linking. Such a scenario is extremely rare in practice. + # + # Even though use of the -pthread flag in linking would only print + # a warning, this can be a nuisance for well-run software projects + # that build with -Werror. So if the active version of Clang has + # this misfeature, we search for an option to squash it. + + AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown + # Create an alternate version of $ac_link that compiles and + # links in two steps (.c -> .o, .o -> exe) instead of one + # (.c -> exe), because the warning occurs only in the second + # step + ax_pthread_save_ac_link="$ac_link" + ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' + ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` + ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" + ax_pthread_save_CFLAGS="$CFLAGS" + for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do + AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [ac_link="$ax_pthread_2step_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [break]) + ]) + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + ]) + + case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in + no | unknown) ;; + *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; + esac + +fi # $ax_pthread_clang = yes + +if test "x$ax_pthread_ok" = "xno"; then +for ax_pthread_try_flag in $ax_pthread_flags; do + + case $ax_pthread_try_flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -mt,pthread) + AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) + PTHREAD_CFLAGS="-mt" + PTHREAD_LIBS="-lpthread" + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) + PTHREAD_CFLAGS="$ax_pthread_try_flag" + ;; + + pthread-config) + AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) + AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) + PTHREAD_LIBS="-l$ax_pthread_try_flag" + ;; + esac + + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + AC_MSG_RESULT([$ax_pthread_ok]) + AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$ax_pthread_ok" = "xyes"; then + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_CACHE_CHECK([for joinable pthread attribute], + [ax_cv_PTHREAD_JOINABLE_ATTR], + [ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $ax_pthread_attr; return attr /* ; */])], + [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], + []) + done + ]) + AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes"], + [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], + [$ax_cv_PTHREAD_JOINABLE_ATTR], + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + ax_pthread_joinable_attr_defined=yes + ]) + + AC_CACHE_CHECK([whether more special flags are required for pthreads], + [ax_cv_PTHREAD_SPECIAL_FLAGS], + [ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $host_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac + ]) + AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes"], + [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes]) + + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + [ax_cv_PTHREAD_PRIO_INHERIT], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes"], + [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) + ax_pthread_prio_inherit_defined=yes + ]) + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + # More AIX lossage: compile with *_r variant + if test "x$GCC" != "xyes"; then + case $host_os in + aix*) + AS_CASE(["x/$CC"], + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], + [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + ;; + esac + fi +fi + +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + +AC_SUBST([PTHREAD_LIBS]) +AC_SUBST([PTHREAD_CFLAGS]) +AC_SUBST([PTHREAD_CC]) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test "x$ax_pthread_ok" = "xyes"; then + ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) + : +else + ax_pthread_ok=no + $2 +fi +AC_LANG_POP +])dnl AX_PTHREAD diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 000000000..60cfbb59e --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,476 @@ +# Process this file with automake to produce Makefile.in + +NULL = +SUBDIRS = +DIST_SUBDIRS = +BUILT_SOURCES = +EXTRA_DIST = +CLEANFILES = +DISTCLEANFILES = +MAINTAINERCLEANFILES = +DISTCHECK_CONFIGURE_FLAGS = --enable-introspection +TESTS = +check_PROGRAMS = + +EXTRA_DIST += harfbuzz.cc +EXTRA_DIST += meson.build +EXTRA_DIST += fix_get_types.py + +# Convenience targets: +lib: $(BUILT_SOURCES) libharfbuzz.la +libs: $(BUILT_SOURCES) $(lib_LTLIBRARIES) +tiny: + $(MAKE) $(AM_MAKEFLAGS) CPPFLAGS="-Os -DHB_TINY $(CPPFLAGS)" libs +tinyz: + $(MAKE) $(AM_MAKEFLAGS) CPPFLAGS="-Oz -DHB_TINY $(CPPFLAGS)" libs + +lib_LTLIBRARIES = libharfbuzz.la + +include Makefile.sources + +HBCFLAGS = +HBLIBS = +HBNONPCLIBS = +HBDEPS = +HBSOURCES = $(HB_BASE_sources) +HBSOURCES += $(HB_BASE_RAGEL_GENERATED_sources) +HBHEADERS = $(HB_BASE_headers) + +if HAVE_PTHREAD +HBCFLAGS += $(PTHREAD_CFLAGS) +HBNONPCLIBS += $(PTHREAD_LIBS) +endif + +if HAVE_GLIB +HBCFLAGS += $(GLIB_CFLAGS) +HBLIBS += $(GLIB_LIBS) +HBDEPS += $(GLIB_DEPS) +HBSOURCES += $(HB_GLIB_sources) +HBHEADERS += $(HB_GLIB_headers) +endif + +if HAVE_FREETYPE +HBCFLAGS += $(FREETYPE_CFLAGS) +HBLIBS += $(FREETYPE_LIBS) +HBDEPS += $(FREETYPE_DEPS) +HBSOURCES += $(HB_FT_sources) +HBHEADERS += $(HB_FT_headers) +endif + +if HAVE_GRAPHITE2 +HBCFLAGS += $(GRAPHITE2_CFLAGS) +HBLIBS += $(GRAPHITE2_LIBS) +HBDEPS += $(GRAPHITE2_DEPS) +HBSOURCES += $(HB_GRAPHITE2_sources) +HBHEADERS += $(HB_GRAPHITE2_headers) +endif + +if HAVE_UNISCRIBE +HBCFLAGS += $(UNISCRIBE_CFLAGS) +HBNONPCLIBS += $(UNISCRIBE_LIBS) +HBSOURCES += $(HB_UNISCRIBE_sources) +HBHEADERS += $(HB_UNISCRIBE_headers) +endif + +if HAVE_DIRECTWRITE +HBCFLAGS += $(DIRECTWRITE_CXXFLAGS) +HBNONPCLIBS += $(DIRECTWRITE_LIBS) +HBSOURCES += $(HB_DIRECTWRITE_sources) +HBHEADERS += $(HB_DIRECTWRITE_headers) +endif + +if HAVE_GDI +HBCFLAGS += $(GDI_CXXFLAGS) +HBNONPCLIBS += $(GDI_LIBS) +HBSOURCES += $(HB_GDI_sources) +HBHEADERS += $(HB_GDI_headers) +endif + +if HAVE_CORETEXT +HBCFLAGS += $(CORETEXT_CFLAGS) +HBNONPCLIBS += $(CORETEXT_LIBS) +HBSOURCES += $(HB_CORETEXT_sources) +HBHEADERS += $(HB_CORETEXT_headers) +endif + + +BUILT_SOURCES += \ + hb-version.h + +$(srcdir)/hb-version.h: hb-version.h.in $(top_srcdir)/configure.ac + $(AM_V_GEN) $(SED) \ + -e 's/[@]HB_VERSION_MAJOR@/$(HB_VERSION_MAJOR)/' \ + -e 's/[@]HB_VERSION_MINOR@/$(HB_VERSION_MINOR)/' \ + -e 's/[@]HB_VERSION_MICRO@/$(HB_VERSION_MICRO)/' \ + -e 's/[@]HB_VERSION@/$(HB_VERSION)/' \ + "$<" > "$@" || ($(RM) "$@"; false) + +# Put the library together + +HBLIBS += $(HBNONPCLIBS) + +if OS_WIN32 +export_symbols = -export-symbols harfbuzz.def +harfbuzz_def_dependency = harfbuzz.def +export_symbols_subset = -export-symbols harfbuzz-subset.def +harfbuzz_subset_def_dependency = harfbuzz-subset.def +export_symbols_icu = -export-symbols harfbuzz-icu.def +harfbuzz_icu_def_dependency = harfbuzz-icu.def +export_symbols_gobject = -export-symbols harfbuzz-gobject.def +harfbuzz_gobject_def_dependency = harfbuzz-gobject.def +chosen_linker = $(CXXLINK) +else +if WITH_LIBSTDCXX +chosen_linker = $(CXXLINK) +else +if HAVE_GCC +# Use a C linker for GCC, not C++; Don't link to libstdc++ +chosen_linker = $(LINK) +else +chosen_linker = $(CXXLINK) +endif +endif +endif + +@CODE_COVERAGE_RULES@ + +base_link_flags = $(AM_LDFLAGS) -lm -version-info $(HB_LIBTOOL_VERSION_INFO) -no-undefined +libharfbuzz_la_LINK = $(chosen_linker) $(libharfbuzz_la_LDFLAGS) +libharfbuzz_la_SOURCES = $(HBSOURCES) $(HBHEADERS) +libharfbuzz_la_CPPFLAGS = $(HBCFLAGS) $(CODE_COVERAGE_CFLAGS) +libharfbuzz_la_LDFLAGS = $(base_link_flags) $(export_symbols) $(CODE_COVERAGE_LDFLAGS) +libharfbuzz_la_LIBADD = $(HBLIBS) +EXTRA_libharfbuzz_la_DEPENDENCIES = $(harfbuzz_def_dependency) +pkginclude_HEADERS = $(HBHEADERS) +nodist_pkginclude_HEADERS = +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = harfbuzz.pc +EXTRA_DIST += hb-version.h.in harfbuzz.pc.in + +lib_LTLIBRARIES += libharfbuzz-subset.la +libharfbuzz_subset_la_LINK = $(chosen_linker) $(libharfbuzz_subset_la_LDFLAGS) +libharfbuzz_subset_la_SOURCES = $(HB_SUBSET_sources) +libharfbuzz_subset_la_CPPFLAGS = $(HBCFLAGS) $(CODE_COVERAGE_CFLAGS) +libharfbuzz_subset_la_LDFLAGS = $(base_link_flags) $(export_symbols_subset) $(CODE_COVERAGE_LDFLAGS) +libharfbuzz_subset_la_LIBADD = libharfbuzz.la +EXTRA_libharfbuzz_subset_la_DEPENDENCIES = $(harfbuzz_subset_def_dependency) +pkginclude_HEADERS += $(HB_SUBSET_headers) +pkgconfig_DATA += harfbuzz-subset.pc +EXTRA_DIST += harfbuzz-subset.pc.in + +if HAVE_ICU +if HAVE_ICU_BUILTIN +HBCFLAGS += $(ICU_CFLAGS) +HBLIBS += $(ICU_LIBS) +HBSOURCES += $(HB_ICU_sources) +HBHEADERS += $(HB_ICU_headers) +else +lib_LTLIBRARIES += libharfbuzz-icu.la +libharfbuzz_icu_la_SOURCES = $(HB_ICU_sources) +libharfbuzz_icu_la_CPPFLAGS = $(HBCFLAGS) $(ICU_CFLAGS) $(CODE_COVERAGE_CFLAGS) +libharfbuzz_icu_la_LDFLAGS = $(base_link_flags) $(export_symbols_icu) $(CODE_COVERAGE_LDFLAGS) +libharfbuzz_icu_la_LIBADD = $(ICU_LIBS) libharfbuzz.la +EXTRA_libharfbuzz_icu_la_DEPENDENCIES = $(harfbuzz_icu_def_dependency) +pkginclude_HEADERS += $(HB_ICU_headers) +pkgconfig_DATA += harfbuzz-icu.pc +endif +endif +EXTRA_DIST += harfbuzz-icu.pc.in + +if HAVE_GOBJECT +lib_LTLIBRARIES += libharfbuzz-gobject.la +libharfbuzz_gobject_la_LINK = $(chosen_linker) $(libharfbuzz_gobject_la_LDFLAGS) +libharfbuzz_gobject_la_SOURCES = $(HB_GOBJECT_DIST_sources) +nodist_libharfbuzz_gobject_la_SOURCES = $(HB_GOBJECT_NODIST_sources) +libharfbuzz_gobject_la_CPPFLAGS = $(HBCFLAGS) $(GOBJECT_CFLAGS) $(CODE_COVERAGE_CFLAGS) +libharfbuzz_gobject_la_LDFLAGS = $(base_link_flags) $(CODE_COVERAGE_LDFLAGS) +libharfbuzz_gobject_la_LIBADD = $(GOBJECT_LIBS) libharfbuzz.la +EXTRA_libharfbuzz_gobject_la_DEPENDENCIES = $(harfbuzz_gobject_def_dependency) +pkginclude_HEADERS += $(HB_GOBJECT_DIST_headers) +nodist_pkginclude_HEADERS += $(HB_GOBJECT_NODIST_headers) +pkgconfig_DATA += harfbuzz-gobject.pc + +BUILT_SOURCES += \ + $(HB_GOBJECT_ENUM_sources) \ + $(HB_GOBJECT_ENUM_headers) \ + $(NULL) +DISTCLEANFILES += \ + $(HB_GOBJECT_ENUM_sources) \ + $(HB_GOBJECT_ENUM_headers) \ + $(NULL) +hb-gobject-enums.%: hb-gobject-enums.%.tmpl $(HBHEADERS) + $(AM_V_GEN) PYTHONIOENCODING=UTF-8 $(GLIB_MKENUMS) \ + --identifier-prefix hb_ --symbol-prefix hb_gobject \ + --template $^ | \ + sed 's/_t_get_type/_get_type/g; s/_T (/ (/g' > "$@" \ + || ($(RM) "$@"; false) +endif +EXTRA_DIST += \ + harfbuzz-gobject.pc.in \ + hb-gobject-enums.cc.tmpl \ + hb-gobject-enums.h.tmpl \ + $(NULL) + + +%.pc: %.pc.in $(top_builddir)/config.status + $(AM_V_GEN) \ + $(SED) -e 's@%prefix%@$(prefix)@g' \ + -e 's@%exec_prefix%@$(exec_prefix)@g' \ + -e 's@%libdir%@$(libdir)@g' \ + -e 's@%includedir%@$(includedir)@g' \ + -e 's@%libs_private%@$(HBNONPCLIBS)@g' \ + -e 's@%requires_private%@$(HBDEPS)@g' \ + -e 's@%VERSION%@$(VERSION)@g' \ + "$<" > "$@" \ + || ($(RM) "$@"; false) + +CLEANFILES += $(pkgconfig_DATA) + + +DEF_FILES = harfbuzz.def harfbuzz-subset.def harfbuzz-icu.def harfbuzz-deprecated-symbols.txt +if HAVE_GOBJECT +DEF_FILES += harfbuzz-gobject.def +endif +check: $(DEF_FILES) # For check-symbols.sh +CLEANFILES += $(DEF_FILES) +harfbuzz.def: $(HBHEADERS) $(HBNODISTHEADERS) + $(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^ +harfbuzz-subset.def: $(HB_SUBSET_headers) + $(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^ +harfbuzz-icu.def: $(HB_ICU_headers) + $(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^ +harfbuzz-gobject.def: $(HB_GOBJECT_headers) + $(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^ +harfbuzz-deprecated-symbols.txt: $(srcdir)/hb-deprecated.h + $(AM_V_GEN) PLAIN_LIST=1 $(srcdir)/gen-def.py "$@" $^ + + +GENERATORS = \ + gen-arabic-table.py \ + gen-def.py \ + gen-emoji-table.py \ + gen-harfbuzzcc.py \ + gen-hb-version.py \ + gen-indic-table.py \ + gen-os2-unicode-ranges.py \ + gen-ragel-artifacts.py \ + gen-tag-table.py \ + gen-ucd-table.py \ + gen-use-table.py \ + gen-vowel-constraints.py \ + $(NULL) +EXTRA_DIST += $(GENERATORS) + +built-sources: $(BUILT_SOURCES) + +.PHONY: built-sources + +RAGEL_GENERATED = \ + $(patsubst %,$(srcdir)/%,$(HB_BASE_RAGEL_GENERATED_sources)) \ + $(NULL) +BUILT_SOURCES += $(RAGEL_GENERATED) +EXTRA_DIST += \ + $(HB_BASE_RAGEL_sources) \ + $(NULL) +# We decided to add ragel-generated files to git... +#MAINTAINERCLEANFILES += $(RAGEL_GENERATED) +$(srcdir)/%.hh: $(srcdir)/%.rl + $(AM_V_GEN)(cd $(srcdir) && $(RAGEL) -e -F1 -o "$*.hh" "$*.rl") \ + || ($(RM) "$@"; false) + +harfbuzz.cc: Makefile.sources + $(AM_V_GEN) \ + for f in \ + $(HB_BASE_sources) \ + $(HB_GLIB_sources) \ + $(HB_FT_sources) \ + $(HB_GRAPHITE2_sources) \ + $(HB_UNISCRIBE_sources) \ + $(HB_GDI_sources) \ + $(HB_DIRECTWRITE_sources) \ + $(HB_CORETEXT_sources) \ + ; do echo '#include "'$$f'"'; done | \ + grep '[.]cc"' > $(srcdir)/harfbuzz.cc \ + || ($(RM) $(srcdir)/harfbuzz.cc; false) +BUILT_SOURCES += harfbuzz.cc + +noinst_PROGRAMS = \ + main \ + test \ + test-buffer-serialize \ + test-ot-meta \ + test-ot-name \ + test-ot-glyphname \ + test-gpos-size-params \ + test-gsub-would-substitute \ + $(NULL) +bin_PROGRAMS = + +main_SOURCES = main.cc +main_CPPFLAGS = $(HBCFLAGS) +main_LDADD = libharfbuzz.la $(HBLIBS) + +test_SOURCES = test.cc +test_CPPFLAGS = $(HBCFLAGS) $(FREETYPE_CFLAGS) +test_LDADD = libharfbuzz.la $(HBLIBS) $(FREETYPE_LIBS) + +test_buffer_serialize_SOURCES = test-buffer-serialize.cc +test_buffer_serialize_CPPFLAGS = $(HBCFLAGS) +test_buffer_serialize_LDADD = libharfbuzz.la $(HBLIBS) + +test_ot_meta_SOURCES = test-ot-meta.cc +test_ot_meta_CPPFLAGS = $(HBCFLAGS) +test_ot_meta_LDADD = libharfbuzz.la $(HBLIBS) + +test_ot_name_SOURCES = test-ot-name.cc +test_ot_name_CPPFLAGS = $(HBCFLAGS) +test_ot_name_LDADD = libharfbuzz.la $(HBLIBS) + +test_ot_glyphname_SOURCES = test-ot-glyphname.cc +test_ot_glyphname_CPPFLAGS = $(HBCFLAGS) +test_ot_glyphname_LDADD = libharfbuzz.la $(HBLIBS) + +test_gpos_size_params_SOURCES = test-gpos-size-params.cc +test_gpos_size_params_CPPFLAGS = $(HBCFLAGS) +test_gpos_size_params_LDADD = libharfbuzz.la $(HBLIBS) + +test_gsub_would_substitute_SOURCES = test-gsub-would-substitute.cc +test_gsub_would_substitute_CPPFLAGS = $(HBCFLAGS) $(FREETYPE_CFLAGS) +test_gsub_would_substitute_LDADD = libharfbuzz.la $(HBLIBS) $(FREETYPE_LIBS) + +check_PROGRAMS += \ + dump-indic-data \ + dump-khmer-data \ + dump-myanmar-data \ + dump-use-data \ + $(NULL) +dump_indic_data_SOURCES = dump-indic-data.cc hb-ot-shape-complex-indic-table.cc +dump_indic_data_CPPFLAGS = $(HBCFLAGS) +dump_indic_data_LDADD = libharfbuzz.la $(HBLIBS) +dump_khmer_data_SOURCES = dump-khmer-data.cc hb-ot-shape-complex-indic-table.cc +dump_khmer_data_CPPFLAGS = $(HBCFLAGS) +dump_khmer_data_LDADD = libharfbuzz.la $(HBLIBS) +dump_myanmar_data_SOURCES = dump-myanmar-data.cc hb-ot-shape-complex-indic-table.cc +dump_myanmar_data_CPPFLAGS = $(HBCFLAGS) +dump_myanmar_data_LDADD = libharfbuzz.la $(HBLIBS) +dump_use_data_SOURCES = dump-use-data.cc hb-ot-shape-complex-use-table.cc +dump_use_data_CPPFLAGS = $(HBCFLAGS) +dump_use_data_LDADD = libharfbuzz.la $(HBLIBS) + +COMPILED_TESTS = test-algs test-array test-iter test-meta test-number test-ot-tag test-unicode-ranges test-bimap +COMPILED_TESTS_CPPFLAGS = $(HBCFLAGS) -DMAIN -UNDEBUG +COMPILED_TESTS_LDADD = libharfbuzz.la $(HBLIBS) +check_PROGRAMS += $(COMPILED_TESTS) +TESTS += $(COMPILED_TESTS) + +test_algs_SOURCES = test-algs.cc hb-static.cc +test_algs_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) +test_algs_LDADD = $(COMPILED_TESTS_LDADD) + +test_array_SOURCES = test-array.cc +test_array_CPPFLAGS = $(HBCFLAGS) +test_array_LDADD = libharfbuzz.la $(HBLIBS) + +test_iter_SOURCES = test-iter.cc hb-static.cc +test_iter_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) +test_iter_LDADD = $(COMPILED_TESTS_LDADD) + +test_meta_SOURCES = test-meta.cc hb-static.cc +test_meta_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) +test_meta_LDADD = $(COMPILED_TESTS_LDADD) + +test_number_SOURCES = test-number.cc hb-number.cc +test_number_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) +test_number_LDADD = $(COMPILED_TESTS_LDADD) + +test_ot_tag_SOURCES = hb-ot-tag.cc +test_ot_tag_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) +test_ot_tag_LDADD = $(COMPILED_TESTS_LDADD) + +test_unicode_ranges_SOURCES = test-unicode-ranges.cc +test_unicode_ranges_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) +test_unicode_ranges_LDADD = $(COMPILED_TESTS_LDADD) + +test_bimap_SOURCES = test-bimap.cc hb-static.cc +test_bimap_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS) +test_bimap_LDADD = $(COMPILED_TESTS_LDADD) + +dist_check_SCRIPTS = \ + check-c-linkage-decls.py \ + check-externs.py \ + check-header-guards.py \ + check-includes.py \ + check-static-inits.py \ + check-symbols.py \ + $(NULL) +TESTS += $(dist_check_SCRIPTS) + +if !WITH_LIBSTDCXX +dist_check_SCRIPTS += \ + check-libstdc++.py \ + $(NULL) +endif + +TESTS_ENVIRONMENT = \ + srcdir="$(srcdir)" \ + builddir="$(builddir)" \ + MAKE="$(MAKE) $(AM_MAKEFLAGS)" \ + HBSOURCES="$(HBSOURCES)" \ + HBHEADERS="$(HBHEADERS)" \ + $(NULL) + +if HAVE_INTROSPECTION + +-include $(INTROSPECTION_MAKEFILE) +INTROSPECTION_GIRS = HarfBuzz-0.0.gir # What does the 0 mean anyway?! +INTROSPECTION_SCANNER_ARGS = \ + -I$(srcdir) \ + --warn-all --verbose \ + --namespace=HarfBuzz \ + --nsversion=0.0 \ + --symbol-prefix=hb \ + --symbol-prefix=hb_gobject \ + --identifier-prefix=hb_ \ + --pkg-export=harfbuzz-gobject \ + --c-include=hb-gobject.h +INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) +INTROSPECTION_SCANNER_ENV = CC="$(CC)" + +HarfBuzz-0.0.gir: libharfbuzz.la libharfbuzz-gobject.la +HarfBuzz_0_0_gir_INCLUDES = GObject-2.0 +HarfBuzz_0_0_gir_CFLAGS = \ + $(INCLUDES) \ + $(HBCFLAGS) \ + -DHB_H \ + -DHB_H_IN \ + -DHB_OT_H \ + -DHB_OT_H_IN \ + -DHB_AAT_H \ + -DHB_AAT_H_IN \ + -DHB_GOBJECT_H \ + -DHB_GOBJECT_H_IN \ + -DHAVE_GOBJECT \ + -DHB_EXTERN= \ + $(NULL) +HarfBuzz_0_0_gir_LIBS = \ + libharfbuzz.la \ + libharfbuzz-gobject.la \ + $(NULL) +HarfBuzz_0_0_gir_FILES = \ + $(HBHEADERS) \ + $(HBSOURCES) \ + $(HB_GOBJECT_sources) \ + $(HB_GOBJECT_headers) \ + $(NULL) + +girdir = $(datadir)/gir-1.0 +gir_DATA = $(INTROSPECTION_GIRS) + +typelibdir = $(libdir)/girepository-1.0 +typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) + +CLEANFILES += $(gir_DATA) $(typelib_DATA) + +endif + +-include $(top_srcdir)/git.mk diff --git a/src/Makefile.sources b/src/Makefile.sources new file mode 100644 index 000000000..4ad11e2bc --- /dev/null +++ b/src/Makefile.sources @@ -0,0 +1,284 @@ +# Base and default-included sources and headers + +HB_BASE_sources = \ + hb-aat-layout-ankr-table.hh \ + hb-aat-layout-bsln-table.hh \ + hb-aat-layout-common.hh \ + hb-aat-layout-feat-table.hh \ + hb-aat-layout-just-table.hh \ + hb-aat-layout-kerx-table.hh \ + hb-aat-layout-morx-table.hh \ + hb-aat-layout-opbd-table.hh \ + hb-aat-layout-trak-table.hh \ + hb-aat-layout.cc \ + hb-aat-layout.hh \ + hb-aat-ltag-table.hh \ + hb-aat-map.cc \ + hb-aat-map.hh \ + hb-algs.hh \ + hb-array.hh \ + hb-atomic.hh \ + hb-bimap.hh \ + hb-blob.cc \ + hb-blob.hh \ + hb-buffer-serialize.cc \ + hb-buffer.cc \ + hb-buffer.hh \ + hb-cache.hh \ + hb-cff-interp-common.hh \ + hb-cff-interp-cs-common.hh \ + hb-cff-interp-dict-common.hh \ + hb-cff1-interp-cs.hh \ + hb-cff2-interp-cs.hh \ + hb-common.cc \ + hb-config.hh \ + hb-debug.hh \ + hb-dispatch.hh \ + hb-draw.cc \ + hb-draw.hh \ + hb-face.cc \ + hb-face.hh \ + hb-fallback-shape.cc \ + hb-font.cc \ + hb-font.hh \ + hb-iter.hh \ + hb-kern.hh \ + hb-machinery.hh \ + hb-map.cc \ + hb-map.hh \ + hb-meta.hh \ + hb-mutex.hh \ + hb-null.hh \ + hb-number.cc \ + hb-number.hh \ + hb-object.hh \ + hb-open-file.hh \ + hb-open-type.hh \ + hb-ot-cff-common.hh \ + hb-ot-cff1-std-str.hh \ + hb-ot-cff1-table.cc \ + hb-ot-cff1-table.hh \ + hb-ot-cff2-table.cc \ + hb-ot-cff2-table.hh \ + hb-ot-cmap-table.hh \ + hb-ot-color-cbdt-table.hh \ + hb-ot-color-colr-table.hh \ + hb-ot-color-cpal-table.hh \ + hb-ot-color-sbix-table.hh \ + hb-ot-color-svg-table.hh \ + hb-ot-color.cc \ + hb-ot-face-table-list.hh \ + hb-ot-face.cc \ + hb-ot-face.hh \ + hb-ot-font.cc \ + hb-ot-gasp-table.hh \ + hb-ot-glyf-table.hh \ + hb-ot-hdmx-table.hh \ + hb-ot-head-table.hh \ + hb-ot-hhea-table.hh \ + hb-ot-hmtx-table.hh \ + hb-ot-kern-table.hh \ + hb-ot-layout-base-table.hh \ + hb-ot-layout-common.hh \ + hb-ot-layout-gdef-table.hh \ + hb-ot-layout-gpos-table.hh \ + hb-ot-layout-gsub-table.hh \ + hb-ot-layout-gsubgpos.hh \ + hb-ot-layout-jstf-table.hh \ + hb-ot-layout.cc \ + hb-ot-layout.hh \ + hb-ot-map.cc \ + hb-ot-map.hh \ + hb-ot-math-table.hh \ + hb-ot-math.cc \ + hb-ot-maxp-table.hh \ + hb-ot-meta-table.hh \ + hb-ot-meta.cc \ + hb-ot-metrics.cc \ + hb-ot-metrics.hh \ + hb-ot-name-language-static.hh \ + hb-ot-name-language.hh \ + hb-ot-name-table.hh \ + hb-ot-name.cc \ + hb-ot-os2-table.hh \ + hb-ot-os2-unicode-ranges.hh \ + hb-ot-post-macroman.hh \ + hb-ot-post-table.hh \ + hb-ot-shape-complex-arabic-fallback.hh \ + hb-ot-shape-complex-arabic-table.hh \ + hb-ot-shape-complex-arabic-win1256.hh \ + hb-ot-shape-complex-arabic.cc \ + hb-ot-shape-complex-arabic.hh \ + hb-ot-shape-complex-default.cc \ + hb-ot-shape-complex-hangul.cc \ + hb-ot-shape-complex-hebrew.cc \ + hb-ot-shape-complex-indic-table.cc \ + hb-ot-shape-complex-indic.cc \ + hb-ot-shape-complex-indic.hh \ + hb-ot-shape-complex-khmer.cc \ + hb-ot-shape-complex-khmer.hh \ + hb-ot-shape-complex-myanmar.cc \ + hb-ot-shape-complex-myanmar.hh \ + hb-ot-shape-complex-thai.cc \ + hb-ot-shape-complex-use-table.cc \ + hb-ot-shape-complex-use.cc \ + hb-ot-shape-complex-use.hh \ + hb-ot-shape-complex-vowel-constraints.cc \ + hb-ot-shape-complex-vowel-constraints.hh \ + hb-ot-shape-complex.hh \ + hb-ot-shape-fallback.cc \ + hb-ot-shape-fallback.hh \ + hb-ot-shape-normalize.cc \ + hb-ot-shape-normalize.hh \ + hb-ot-shape.cc \ + hb-ot-shape.hh \ + hb-ot-stat-table.hh \ + hb-ot-tag-table.hh \ + hb-ot-tag.cc \ + hb-ot-var-avar-table.hh \ + hb-ot-var-fvar-table.hh \ + hb-ot-var-gvar-table.hh \ + hb-ot-var-hvar-table.hh \ + hb-ot-var-mvar-table.hh \ + hb-ot-var.cc \ + hb-ot-vorg-table.hh \ + hb-pool.hh \ + hb-sanitize.hh \ + hb-serialize.hh \ + hb-set-digest.hh \ + hb-set.cc \ + hb-set.hh \ + hb-shape-plan.cc \ + hb-shape-plan.hh \ + hb-shape.cc \ + hb-shaper-impl.hh \ + hb-shaper-list.hh \ + hb-shaper.cc \ + hb-shaper.hh \ + hb-static.cc \ + hb-string-array.hh \ + hb-style.cc \ + hb-ucd-table.hh \ + hb-ucd.cc \ + hb-unicode-emoji-table.hh \ + hb-unicode.cc \ + hb-unicode.hh \ + hb-utf.hh \ + hb-vector.hh \ + hb.hh \ + $(NULL) + +HB_BASE_RAGEL_GENERATED_sources = \ + hb-buffer-deserialize-json.hh \ + hb-buffer-deserialize-text.hh \ + hb-number-parser.hh \ + hb-ot-shape-complex-indic-machine.hh \ + hb-ot-shape-complex-khmer-machine.hh \ + hb-ot-shape-complex-myanmar-machine.hh \ + hb-ot-shape-complex-use-machine.hh \ + $(NULL) +HB_BASE_RAGEL_sources = \ + hb-buffer-deserialize-json.rl \ + hb-buffer-deserialize-text.rl \ + hb-number-parser.rl \ + hb-ot-shape-complex-indic-machine.rl \ + hb-ot-shape-complex-khmer-machine.rl \ + hb-ot-shape-complex-myanmar-machine.rl \ + hb-ot-shape-complex-use-machine.rl \ + $(NULL) + +HB_BASE_headers = \ + hb-aat-layout.h \ + hb-aat.h \ + hb-blob.h \ + hb-buffer.h \ + hb-common.h \ + hb-deprecated.h \ + hb-draw.h \ + hb-face.h \ + hb-font.h \ + hb-map.h \ + hb-ot-color.h \ + hb-ot-deprecated.h \ + hb-ot-font.h \ + hb-ot-layout.h \ + hb-ot-math.h \ + hb-ot-meta.h \ + hb-ot-metrics.h \ + hb-ot-name.h \ + hb-ot-shape.h \ + hb-ot-var.h \ + hb-ot.h \ + hb-set.h \ + hb-shape-plan.h \ + hb-shape.h \ + hb-style.h \ + hb-unicode.h \ + hb-version.h \ + hb.h \ + $(NULL) + +# Optional Sources and Headers with external deps + +HB_FT_sources = hb-ft.cc +HB_FT_headers = hb-ft.h + +HB_GLIB_sources = hb-glib.cc +HB_GLIB_headers = hb-glib.h + +HB_GRAPHITE2_sources = hb-graphite2.cc +HB_GRAPHITE2_headers = hb-graphite2.h + +# System-dependent sources and headers + +HB_CORETEXT_sources = hb-coretext.cc +HB_CORETEXT_headers = hb-coretext.h + +HB_DIRECTWRITE_sources = hb-directwrite.cc +HB_DIRECTWRITE_headers = hb-directwrite.h + +HB_GDI_sources = hb-gdi.cc +HB_GDI_headers = hb-gdi.h + +HB_UNISCRIBE_sources = hb-uniscribe.cc +HB_UNISCRIBE_headers = hb-uniscribe.h + +# Sources for libharfbuzz-gobject and libharfbuzz-icu +HB_ICU_sources = hb-icu.cc +HB_ICU_headers = hb-icu.h + +# Sources for libharfbuzz-subset +HB_SUBSET_sources = \ + hb-number.cc \ + hb-number.hh \ + hb-ot-cff1-table.cc \ + hb-ot-cff2-table.cc \ + hb-static.cc \ + hb-subset-cff-common.cc \ + hb-subset-cff-common.hh \ + hb-subset-cff1.cc \ + hb-subset-cff1.hh \ + hb-subset-cff2.cc \ + hb-subset-cff2.hh \ + hb-subset-input.cc \ + hb-subset-input.hh \ + hb-subset-plan.cc \ + hb-subset-plan.hh \ + hb-subset-plan.hh \ + hb-subset.cc \ + hb-subset.hh \ + hb-subset.hh \ + $(NULL) + +HB_SUBSET_headers = \ + hb-subset.h \ + $(NULL) + +HB_GOBJECT_DIST_sources = hb-gobject-structs.cc +HB_GOBJECT_DIST_headers = hb-gobject.h hb-gobject-structs.h +HB_GOBJECT_ENUM_sources = hb-gobject-enums.cc +HB_GOBJECT_ENUM_headers = hb-gobject-enums.h +HB_GOBJECT_NODIST_sources = $(HB_GOBJECT_ENUM_sources) +HB_GOBJECT_NODIST_headers = $(HB_GOBJECT_ENUM_headers) +HB_GOBJECT_sources = $(HB_GOBJECT_DIST_sources) $(HB_GOBJECT_NODIST_sources) +HB_GOBJECT_headers = $(HB_GOBJECT_DIST_headers) $(HB_GOBJECT_NODIST_headers) diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 000000000..b67d707b0 --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,15 @@ +# Process this file with automake to produce Makefile.in + +NULL = +EXTRA_DIST = +SUBDIRS = api shaping fuzzing subset + +EXTRA_DIST += \ + meson.build \ + $(NULL) + +# Convenience targets: +lib: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib + +-include $(top_srcdir)/git.mk diff --git a/test/api/Makefile.am b/test/api/Makefile.am new file mode 100644 index 000000000..bf29d2200 --- /dev/null +++ b/test/api/Makefile.am @@ -0,0 +1,222 @@ +# Process this file with automake to produce Makefile.in + +NULL = +EXTRA_DIST = +CLEANFILES = +DISTCLEANFILES = +MAINTAINERCLEANFILES = + +# Convenience targets: +lib: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib +libs: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libs + +EXTRA_DIST += meson.build + +EXTRA_DIST += fonts + +LINK = $(CXXLINK) + +if HAVE_GLIB +AM_CPPFLAGS = -DSRCDIR="\"$(srcdir)\"" -I$(top_srcdir)/src/ -I$(top_builddir)/src/ $(GLIB_CFLAGS) +LDADD = $(top_builddir)/src/libharfbuzz.la $(GLIB_LIBS) + +EXTRA_DIST += hb-test.h hb-subset-test.h + +check_PROGRAMS = $(TEST_PROGS) +noinst_PROGRAMS = $(TEST_PROGS) + +TEST_PROGS = \ + test-aat-layout \ + test-baseline \ + test-blob \ + test-buffer \ + test-c \ + test-collect-unicodes \ + test-cplusplus \ + test-common \ + test-draw \ + test-font \ + test-map \ + test-object \ + test-ot-alternates \ + test-ot-color \ + test-ot-face \ + test-ot-glyphname \ + test-ot-ligature-carets \ + test-ot-name \ + test-ot-meta \ + test-ot-metrics \ + test-ot-tag \ + test-ot-extents-cff \ + test-ot-metrics-tt-var \ + test-set \ + test-shape \ + test-style \ + test-subset \ + test-subset-cmap \ + test-subset-drop-tables \ + test-subset-glyf \ + test-subset-hdmx \ + test-subset-hmtx \ + test-subset-nameids \ + test-subset-os2 \ + test-subset-post \ + test-subset-vmtx \ + test-subset-cff1 \ + test-subset-cff2 \ + test-subset-gvar \ + test-subset-hvar \ + test-subset-vvar \ + test-subset-sbix \ + test-subset-gpos \ + test-subset-colr \ + test-subset-cbdt \ + test-unicode \ + test-var-coords \ + test-version \ + $(NULL) + +test_subset_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_cmap_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_drop_tables_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_glyf_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_hdmx_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_hmtx_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_os2_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_post_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_vmtx_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_cff1_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_cff2_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_gvar_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_hvar_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_vvar_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_sbix_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_cbdt_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_nameids_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_gpos_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la +test_subset_colr_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la + +test_unicode_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(GLIB_CFLAGS) \ + $(NULL) +test_unicode_LDADD = $(LDADD) +if HAVE_ICU +test_unicode_CPPFLAGS += $(ICU_CFLAGS) +test_unicode_LDADD += $(top_builddir)/src/libharfbuzz-icu.la $(ICU_LIBS) +endif + +if HAVE_PTHREAD +if HAVE_FREETYPE +TEST_PROGS += test-multithread +test_multithread_CFLAGS = $(CFLAGS) $(PTHREAD_CFLAGS) $(FREETYPE_CFLAGS) +test_multithread_LDADD = $(LDADD) $(PTHREAD_LIBS) $(FREETYPE_LIBS) +# The auto-generated link rule somehow includes CFLAGS as well. Without +# it, pthread link fails, because, who knows why, $PTHREAD_LIBS is empty. +test_multithread_LINK = $(LINK) $(PTHREAD_CFLAGS) +endif +endif + +if HAVE_FREETYPE +TEST_PROGS += \ + test-ot-math \ + $(NULL) +test_ot_math_LDADD = $(LDADD) $(FREETYPE_LIBS) +test_ot_math_CPPFLAGS = $(AM_CPPFLAGS) $(FREETYPE_CFLAGS) +endif # HAVE_FREETYPE + +# Tests for header compilation +test_cplusplus_SOURCES = test-cplusplus.cc +test_c_CPPFLAGS = $(AM_CPPFLAGS) +test_cplusplus_CPPFLAGS = $(AM_CPPFLAGS) +if HAVE_ICU +test_c_CPPFLAGS += $(ICU_CFLAGS) +test_cplusplus_CPPFLAGS += $(ICU_CFLAGS) +endif +if HAVE_FREETYPE +test_c_CPPFLAGS += $(FREETYPE_CFLAGS) +test_cplusplus_CPPFLAGS += $(FREETYPE_CFLAGS) +endif + +# Default test running environment +TESTS = $(TEST_PROGS) +TESTS_ENVIRONMENT = \ + MALLOC_CHECK_=2 \ + MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) \ + G_DEBUG=gc-friendly \ + G_SLICE=always-malloc \ + srcdir=$(srcdir) \ + G_TEST_SRCDIR=$(abs_srcdir) \ + G_TEST_BUILDDIR=$(abs_builddir) \ + $(NULL) + + +# check-tool: Run tests under $(TOOL) +check-tool: + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \ + TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_builddir)/libtool --mode=execute \ + env $(TOOL)' +# check-tool-raw: Run tests under $(TOOL), but don't run under libtool +check-tool-raw: + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \ + TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) \ + env $(TOOL)' + +# check-gtester: Run tests under gtester +GTESTER = gtester +check-gtester: + $(AM_V_at)$(MAKE) $(AM_MAKEFLGS) check-tool-raw TOOL="$(GTESTER) --verbose --keep-going" + + +# Check tests under valgrind. Saves log to log-valgrind.txt +VALGRIND_FLAGS = \ + --tool=memcheck \ + --track-origins=yes \ + --leak-check=yes \ + $(EXTRA_VALGRIND_FLAGS) +# Can't do for now: --show-reachable=yes +CLEANFILES += log-valgrind.txt +valgrind_verbose = $(valgrind_verbose_@AM_V@) +valgrind_verbose_ = $(valgrind_verbose_@AM_DEFAULT_V@) +valgrind_verbose_0 = | \ + grep '\(^[^=]\|ERROR SUMMARY\|definitely lost\|indirectly lost\)' | grep -v ': 0' +# TODO: The following check does not fail if valgrind finds error. It should. +check-valgrind: + $(AM_V_at)$(MAKE) $(AM_MAKEFLGS) check-tool TOOL="valgrind $(VALGRIND_FLAGS)" \ + 2>&1 | tee log-valgrind.txt $(valgrind_verbose) + + +# check-symbols: Finds untested API symbols +symbols-tested.txt: $(TEST_PROGS) + $(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \ + | grep ' U hb_' | sed 's/.* U hb_/hb_/' \ + | sort | uniq > $@.tmp && mv $@.tmp $@ +symbols-tested-or-deprecated.txt: symbols-tested.txt $(top_builddir)/src/harfbuzz-deprecated-symbols.txt + $(AM_V_GEN)cat $^ | sort | uniq > $@.tmp; mv $@.tmp $@ +symbols-exported.txt: $(top_builddir)/src/.libs/libharfbuzz.so + $(AM_V_GEN)$(top_builddir)/libtool --mode=execute nm $^ \ + | grep ' T ' | sed 's/.* T //' | grep -v '^\(_init\|_fini\)$$' \ + | sort | uniq > $@.tmp && mv $@.tmp $@ +symbols-untested.txt: symbols-tested-or-deprecated.txt symbols-exported.txt + $(AM_V_GEN)diff $^ > $@.tmp; mv $@.tmp $@ +CLEANFILES += symbols-tested.txt \ + symbols-exported.txt \ + symbols-untested.txt \ + symbols-tested-or-deprecated.txt +check-symbols: symbols-untested.txt + @! cat $^ | grep . + + + +else # !HAVE_GLIB +check-am: err-glib +err-glib: + @echo "You need to have glib support enabled to run the tests" + @exit 77 +endif # HAVE_GLIB + +.PHONY: check-symbols check-tool check-valgrind + +-include $(top_srcdir)/git.mk diff --git a/test/fuzzing/Makefile.am b/test/fuzzing/Makefile.am new file mode 100644 index 000000000..2e2b2c9ad --- /dev/null +++ b/test/fuzzing/Makefile.am @@ -0,0 +1,86 @@ +# Process this file with automake to produce Makefile.in + +NULL = +EXTRA_DIST = +CLEANFILES = +DISTCLEANFILES = +MAINTAINERCLEANFILES = + +# Convenience targets: +lib: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib +libs: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libs + +$(top_builddir)/src/libharfbuzz.la: lib +$(top_builddir)/src/libharfbuzz-subset.la: libs + +EXTRA_DIST += \ + README \ + run-shape-fuzzer-tests.py \ + run-subset-fuzzer-tests.py \ + run-draw-fuzzer-tests.py \ + meson.build \ + fonts \ + $(NULL) + +check_PROGRAMS = \ + hb-shape-fuzzer \ + hb-subset-fuzzer \ + hb-set-fuzzer \ + hb-draw-fuzzer \ + $(NULL) + +AM_CPPFLAGS = \ + -DHB_DISABLE_DEPRECATED \ + -I$(top_srcdir)/src/ \ + -I$(top_builddir)/src/ \ + $(NULL) + +hb_shape_fuzzer_SOURCES = \ + hb-fuzzer.hh \ + hb-shape-fuzzer.cc \ + main.cc \ + $(NULL) +hb_shape_fuzzer_LDADD = $(top_builddir)/src/libharfbuzz.la +hb_shape_fuzzer_CPPFLAGS = $(AM_CPPFLAGS) +hb_shape_fuzzer_DEPENDENCIES = $(top_builddir)/src/libharfbuzz.la + +hb_subset_fuzzer_SOURCES = \ + hb-fuzzer.hh \ + hb-subset-fuzzer.cc \ + main.cc \ + $(NULL) +hb_subset_fuzzer_LDADD = \ + $(top_builddir)/src/libharfbuzz.la \ + $(top_builddir)/src/libharfbuzz-subset.la +hb_subset_fuzzer_CPPFLAGS = $(AM_CPPFLAGS) +hb_subset_fuzzer_DEPENDENCIES = $(top_builddir)/src/libharfbuzz-subset.la + +hb_set_fuzzer_SOURCES = \ + hb-fuzzer.hh \ + hb-set-fuzzer.cc \ + main.cc \ + $(NULL) +hb_set_fuzzer_LDADD = $(top_builddir)/src/libharfbuzz.la +hb_set_fuzzer_CPPFLAGS = $(AM_CPPFLAGS) +hb_set_fuzzer_DEPENDENCIES = $(top_builddir)/src/libharfbuzz.la + +hb_draw_fuzzer_SOURCES = \ + hb-fuzzer.hh \ + hb-draw-fuzzer.cc \ + main.cc \ + $(NULL) +hb_draw_fuzzer_LDADD = $(top_builddir)/src/libharfbuzz.la +hb_draw_fuzzer_CPPFLAGS = $(AM_CPPFLAGS) +hb_draw_fuzzer_DEPENDENCIES = $(top_builddir)/src/libharfbuzz.la + + +check: + EXEEXT="$(EXEEXT)" srcdir="$(srcdir)" builddir="$(builddir)" LIBTOOL="$(LIBTOOL)" $(srcdir)/run-shape-fuzzer-tests.py + EXEEXT="$(EXEEXT)" srcdir="$(srcdir)" builddir="$(builddir)" LIBTOOL="$(LIBTOOL)" $(srcdir)/run-subset-fuzzer-tests.py + EXEEXT="$(EXEEXT)" srcdir="$(srcdir)" builddir="$(builddir)" LIBTOOL="$(LIBTOOL)" $(srcdir)/run-draw-fuzzer-tests.py +check-valgrind: + $(AM_V_at)RUN_VALGRIND=1 $(MAKE) $(AM_MAKEFLGS) check + +-include $(top_srcdir)/git.mk diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am new file mode 100644 index 000000000..316b173c8 --- /dev/null +++ b/test/shaping/Makefile.am @@ -0,0 +1,39 @@ +# Process this file with automake to produce Makefile.in + +NULL = +EXTRA_DIST = +CLEANFILES = +DISTCLEANFILES = +MAINTAINERCLEANFILES = +SUBDIRS = data + +# Convenience targets: +lib: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib +libs: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libs + +EXTRA_DIST += \ + README.md \ + meson.build \ + hb-diff \ + hb-diff-colorize \ + hb-diff-filter-failures \ + hb-diff-stat \ + hb-unicode-decode \ + hb-unicode-encode \ + hb-unicode-prettyname \ + record-test.sh \ + run-tests.py \ + texts/in-house \ + $(NULL) + +# TODO Figure out Python stuff +EXTRA_DIST += \ + hb_test_tools.py \ + $(NULL) +CLEANFILES += \ + hb_test_tools.py[co] \ + $(NULL) + +-include $(top_srcdir)/git.mk diff --git a/test/shaping/data/Makefile.am b/test/shaping/data/Makefile.am new file mode 100644 index 000000000..01f6c5a32 --- /dev/null +++ b/test/shaping/data/Makefile.am @@ -0,0 +1,14 @@ +# Process this file with automake to produce Makefile.in + +NULL = +SUBDIRS = \ + in-house \ + text-rendering-tests \ + aots \ + $(NULL) + +# Convenience targets: +lib: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib + +-include $(top_srcdir)/git.mk diff --git a/test/shaping/data/aots/Makefile.am b/test/shaping/data/aots/Makefile.am new file mode 100644 index 000000000..6b71d893b --- /dev/null +++ b/test/shaping/data/aots/Makefile.am @@ -0,0 +1,27 @@ +# Process this file with automake to produce Makefile.in + +NULL = + +# Convenience targets: +lib: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib + +EXTRA_DIST = \ + COPYING \ + fonts \ + update.py \ + meson.build \ + $(TESTS) \ + $(NULL) + +TEST_EXTENSIONS = .tests +if HAVE_FREETYPE +TESTS_ENVIRONMENT = HAVE_FREETYPE=1 +else +TESTS_ENVIRONMENT = HAVE_FREETYPE=0 +endif +TESTS_LOG_COMPILER = $(srcdir)/../../run-tests.py $(top_builddir)/util/hb-shape$(EXEEXT) + +include Makefile.sources + +-include $(top_srcdir)/git.mk diff --git a/test/shaping/data/aots/Makefile.sources b/test/shaping/data/aots/Makefile.sources new file mode 100644 index 000000000..93396824a --- /dev/null +++ b/test/shaping/data/aots/Makefile.sources @@ -0,0 +1,126 @@ +TESTS = \ + tests/classdef1_empty.tests \ + tests/classdef1_multiple.tests \ + tests/classdef1_single.tests \ + tests/classdef1.tests \ + tests/classdef2_empty.tests \ + tests/classdef2_multiple.tests \ + tests/classdef2_single.tests \ + tests/classdef2.tests \ + tests/gpos_chaining1_boundary.tests \ + tests/gpos_chaining1_lookupflag.tests \ + tests/gpos_chaining1_multiple_subrules.tests \ + tests/gpos_chaining1_next_glyph.tests \ + tests/gpos_chaining1_simple.tests \ + tests/gpos_chaining1_successive.tests \ + tests/gpos_chaining2_boundary.tests \ + tests/gpos_chaining2_lookupflag.tests \ + tests/gpos_chaining2_multiple_subrules.tests \ + tests/gpos_chaining2_next_glyph.tests \ + tests/gpos_chaining2_simple.tests \ + tests/gpos_chaining2_successive.tests \ + tests/gpos_chaining3_boundary.tests \ + tests/gpos_chaining3_lookupflag.tests \ + tests/gpos_chaining3_next_glyph.tests \ + tests/gpos_chaining3_simple.tests \ + tests/gpos_chaining3_successive.tests \ + tests/gpos_context1_boundary.tests \ + tests/gpos_context1_expansion.tests \ + tests/gpos_context1_lookupflag.tests \ + tests/gpos_context1_multiple_subrules.tests \ + tests/gpos_context1_next_glyph.tests \ + tests/gpos_context1_simple.tests \ + tests/gpos_context1_successive.tests \ + tests/gpos_context2_boundary.tests \ + tests/gpos_context2_classes.tests \ + tests/gpos_context2_expansion.tests \ + tests/gpos_context2_lookupflag.tests \ + tests/gpos_context2_multiple_subrules.tests \ + tests/gpos_context2_next_glyph.tests \ + tests/gpos_context2_simple.tests \ + tests/gpos_context2_successive.tests \ + tests/gpos_context3_boundary.tests \ + tests/gpos_context3_lookupflag.tests \ + tests/gpos_context3_next_glyph.tests \ + tests/gpos_context3_simple.tests \ + tests/gpos_context3_successive.tests \ + tests/gpos1_1_lookupflag.tests \ + tests/gpos1_1_simple.tests \ + tests/gpos1_2_lookupflag.tests \ + tests/gpos1_2.tests \ + tests/gpos2_1_lookupflag.tests \ + tests/gpos2_1_next_glyph.tests \ + tests/gpos2_1_simple.tests \ + tests/gpos2_1.tests \ + tests/gpos2_2.tests \ + tests/gpos3_lookupflag.tests \ + tests/gpos3.tests \ + tests/gpos4_lookupflag.tests \ + tests/gpos4_multiple_anchors.tests \ + tests/gpos4_simple.tests \ + tests/gpos5.tests \ + tests/gpos6.tests \ + tests/gpos7_1.tests \ + tests/gpos9.tests \ + tests/gsub_chaining1_boundary.tests \ + tests/gsub_chaining1_lookupflag.tests \ + tests/gsub_chaining1_multiple_subrules.tests \ + tests/gsub_chaining1_next_glyph.tests \ + tests/gsub_chaining1_simple.tests \ + tests/gsub_chaining1_successive.tests \ + tests/gsub_chaining2_boundary.tests \ + tests/gsub_chaining2_lookupflag.tests \ + tests/gsub_chaining2_multiple_subrules.tests \ + tests/gsub_chaining2_next_glyph.tests \ + tests/gsub_chaining2_simple.tests \ + tests/gsub_chaining2_successive.tests \ + tests/gsub_chaining3_boundary.tests \ + tests/gsub_chaining3_lookupflag.tests \ + tests/gsub_chaining3_next_glyph.tests \ + tests/gsub_chaining3_simple.tests \ + tests/gsub_chaining3_successive.tests \ + tests/gsub_context1_boundary.tests \ + tests/gsub_context1_expansion.tests \ + tests/gsub_context1_lookupflag.tests \ + tests/gsub_context1_multiple_subrules.tests \ + tests/gsub_context1_next_glyph.tests \ + tests/gsub_context1_simple.tests \ + tests/gsub_context1_successive.tests \ + tests/gsub_context2_boundary.tests \ + tests/gsub_context2_classes.tests \ + tests/gsub_context2_expansion.tests \ + tests/gsub_context2_lookupflag.tests \ + tests/gsub_context2_multiple_subrules.tests \ + tests/gsub_context2_next_glyph.tests \ + tests/gsub_context2_simple.tests \ + tests/gsub_context2_successive.tests \ + tests/gsub_context3_boundary.tests \ + tests/gsub_context3_lookupflag.tests \ + tests/gsub_context3_next_glyph.tests \ + tests/gsub_context3_simple.tests \ + tests/gsub_context3_successive.tests \ + tests/gsub1_1_lookupflag.tests \ + tests/gsub1_1_modulo.tests \ + tests/gsub1_1_simple.tests \ + tests/gsub1_2_lookupflag.tests \ + tests/gsub1_2_simple.tests \ + tests/gsub2_1_lookupflag.tests \ + tests/gsub2_1_multiple_sequences.tests \ + tests/gsub2_1_simple.tests \ + tests/gsub3_1_lookupflag.tests \ + tests/gsub3_1_multiple.tests \ + tests/gsub3_1_simple.tests \ + tests/gsub4_1_lookupflag.tests \ + tests/gsub4_1_multiple_ligatures.tests \ + tests/gsub4_1_multiple_ligsets.tests \ + tests/gsub4_1_simple.tests \ + tests/gsub7.tests \ + tests/lookupflag_ignore_attach.tests \ + tests/lookupflag_ignore_base.tests \ + tests/lookupflag_ignore_combination.tests \ + tests/lookupflag_ignore_ligatures.tests \ + tests/lookupflag_ignore_marks.tests \ + $(NULL) + +DISABLED_TESTS = \ + $(NULL) diff --git a/test/shaping/data/in-house/Makefile.am b/test/shaping/data/in-house/Makefile.am new file mode 100644 index 000000000..a2845785e --- /dev/null +++ b/test/shaping/data/in-house/Makefile.am @@ -0,0 +1,26 @@ +# Process this file with automake to produce Makefile.in + +NULL = + +# Convenience targets: +lib: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib + +EXTRA_DIST = \ + COPYING \ + fonts \ + meson.build \ + $(TESTS) \ + $(NULL) + +TEST_EXTENSIONS = .tests +if HAVE_FREETYPE +TESTS_ENVIRONMENT = HAVE_FREETYPE=1 +else +TESTS_ENVIRONMENT = HAVE_FREETYPE=0 +endif +TESTS_LOG_COMPILER = $(srcdir)/../../run-tests.py $(top_builddir)/util/hb-shape$(EXEEXT) + +include Makefile.sources + +-include $(top_srcdir)/git.mk diff --git a/test/shaping/data/in-house/Makefile.sources b/test/shaping/data/in-house/Makefile.sources new file mode 100644 index 000000000..93b212d10 --- /dev/null +++ b/test/shaping/data/in-house/Makefile.sources @@ -0,0 +1,66 @@ +TESTS = \ + tests/aat-morx.tests \ + tests/aat-trak.tests \ + tests/arabic-fallback-shaping.tests \ + tests/arabic-feature-order.tests \ + tests/arabic-like-joining.tests \ + tests/arabic-mark-attach.tests \ + tests/arabic-mark-order.tests \ + tests/arabic-stch.tests \ + tests/automatic-fractions.tests \ + tests/cluster.tests \ + tests/collections.tests \ + tests/color-fonts.tests \ + tests/context-matching.tests \ + tests/cursive-positioning.tests \ + tests/default-ignorables.tests \ + tests/emoji.tests \ + tests/fallback-positioning.tests \ + tests/hangul-jamo.tests \ + tests/hyphens.tests \ + tests/indic-consonant-with-stacker.tests \ + tests/indic-decompose.tests \ + tests/indic-init.tests \ + tests/indic-joiner-candrabindu.tests \ + tests/indic-joiners.tests \ + tests/indic-old-spec.tests \ + tests/indic-pref-blocking.tests \ + tests/indic-script-extensions.tests \ + tests/indic-special-cases.tests \ + tests/indic-syllable.tests \ + tests/indic-vowel-letter-spoofing.tests \ + tests/kern-format2.tests \ + tests/khmer-mark-order.tests \ + tests/khmer-misc.tests \ + tests/language-tags.tests \ + tests/ligature-id.tests \ + tests/macos.tests \ + tests/mark-attachment.tests \ + tests/mark-filtering-sets.tests \ + tests/mongolian-variation-selector.tests \ + tests/myanmar-syllable.tests \ + tests/myanmar-zawgyi.tests \ + tests/none-directional.tests \ + tests/positioning-features.tests \ + tests/rand.tests \ + tests/reverse-sub.tests \ + tests/rotation.tests \ + tests/simple.tests \ + tests/sinhala.tests \ + tests/spaces.tests \ + tests/tibetan-contractions-1.tests \ + tests/tibetan-contractions-2.tests \ + tests/tibetan-vowels.tests \ + tests/use-indic3.tests \ + tests/use-marchen.tests \ + tests/use-syllable.tests \ + tests/use.tests \ + tests/variations-rounding.tests \ + tests/variations-rvrn.tests \ + tests/variations-space.tests \ + tests/vertical.tests \ + tests/zero-width-marks.tests \ + $(NULL) + +DISABLED_TESTS = \ + $(NULL) diff --git a/test/shaping/data/text-rendering-tests/Makefile.am b/test/shaping/data/text-rendering-tests/Makefile.am new file mode 100644 index 000000000..19ac3b3a0 --- /dev/null +++ b/test/shaping/data/text-rendering-tests/Makefile.am @@ -0,0 +1,32 @@ +# Process this file with automake to produce Makefile.in + +NULL = + +# Convenience targets: +lib: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib + +update: + (cd $(srcdir) && ./update.sh) + +EXTRA_DIST = \ + README \ + COPYING \ + DISABLED \ + update.py \ + meson.build \ + fonts \ + $(TESTS) \ + $(NULL) + +TEST_EXTENSIONS = .tests +if HAVE_FREETYPE +TESTS_ENVIRONMENT = HAVE_FREETYPE=1 +else +TESTS_ENVIRONMENT = HAVE_FREETYPE=0 +endif +TESTS_LOG_COMPILER = $(srcdir)/../../run-tests.py $(top_builddir)/util/hb-shape$(EXEEXT) + +include Makefile.sources + +-include $(top_srcdir)/git.mk diff --git a/test/shaping/data/text-rendering-tests/Makefile.sources b/test/shaping/data/text-rendering-tests/Makefile.sources new file mode 100644 index 000000000..78d48ebe9 --- /dev/null +++ b/test/shaping/data/text-rendering-tests/Makefile.sources @@ -0,0 +1,95 @@ +TESTS = \ + tests/AVAR-1.tests \ + tests/CFF-1.tests \ + tests/CFF-2.tests \ + tests/CFF2-1.tests \ + tests/CMAP-1.tests \ + tests/CMAP-2.tests \ + tests/CVAR-1.tests \ + tests/CVAR-2.tests \ + tests/GLYF-1.tests \ + tests/GPOS-1.tests \ + tests/GPOS-2.tests \ + tests/GPOS-3.tests \ + tests/GPOS-4.tests \ + tests/GPOS-5.tests \ + tests/GSUB-1.tests \ + tests/GSUB-2.tests \ + tests/GSUB-3.tests \ + tests/GVAR-1.tests \ + tests/GVAR-2.tests \ + tests/GVAR-3.tests \ + tests/GVAR-4.tests \ + tests/GVAR-5.tests \ + tests/GVAR-6.tests \ + tests/GVAR-7.tests \ + tests/GVAR-8.tests \ + tests/GVAR-9.tests \ + tests/HVAR-1.tests \ + tests/HVAR-2.tests \ + tests/KERN-1.tests \ + tests/KERN-2.tests \ + tests/MORX-1.tests \ + tests/MORX-10.tests \ + tests/MORX-11.tests \ + tests/MORX-12.tests \ + tests/MORX-13.tests \ + tests/MORX-14.tests \ + tests/MORX-16.tests \ + tests/MORX-17.tests \ + tests/MORX-18.tests \ + tests/MORX-19.tests \ + tests/MORX-2.tests \ + tests/MORX-20.tests \ + tests/MORX-21.tests \ + tests/MORX-22.tests \ + tests/MORX-23.tests \ + tests/MORX-24.tests \ + tests/MORX-25.tests \ + tests/MORX-26.tests \ + tests/MORX-27.tests \ + tests/MORX-28.tests \ + tests/MORX-29.tests \ + tests/MORX-3.tests \ + tests/MORX-30.tests \ + tests/MORX-31.tests \ + tests/MORX-32.tests \ + tests/MORX-33.tests \ + tests/MORX-34.tests \ + tests/MORX-35.tests \ + tests/MORX-36.tests \ + tests/MORX-37.tests \ + tests/MORX-38.tests \ + tests/MORX-39.tests \ + tests/MORX-4.tests \ + tests/MORX-40.tests \ + tests/MORX-41.tests \ + tests/MORX-5.tests \ + tests/MORX-6.tests \ + tests/MORX-7.tests \ + tests/MORX-8.tests \ + tests/MORX-9.tests \ + tests/SFNT-1.tests \ + tests/SFNT-2.tests \ + tests/SHBALI-3.tests \ + tests/SHKNDA-1.tests \ + $(NULL) + +DISBALED_TESTS = \ + tests/CMAP-3.tests \ + tests/SHARAN-1.tests \ + tests/SHBALI-1.tests \ + tests/SHBALI-2.tests \ + tests/SHKNDA-2.tests \ + tests/SHKNDA-3.tests \ + tests/SHLANA-1.tests \ + tests/SHLANA-10.tests \ + tests/SHLANA-2.tests \ + tests/SHLANA-3.tests \ + tests/SHLANA-4.tests \ + tests/SHLANA-5.tests \ + tests/SHLANA-6.tests \ + tests/SHLANA-7.tests \ + tests/SHLANA-8.tests \ + tests/SHLANA-9.tests \ + $(NULL) diff --git a/test/subset/Makefile.am b/test/subset/Makefile.am new file mode 100644 index 000000000..47b003932 --- /dev/null +++ b/test/subset/Makefile.am @@ -0,0 +1,23 @@ +# Process this file with automake to produce Makefile.in + +NULL = +EXTRA_DIST = +CLEANFILES = +SUBDIRS = data + +# Convenience targets: +lib: libs # Always build subsetter lib in this subdir +libs: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libs + +EXTRA_DIST += \ + meson.build \ + run-tests.py \ + subset_test_suite.py \ + $(NULL) + +CLEANFILES += \ + subset_test_suite.py[co] \ + $(NULL) + +-include $(top_srcdir)/git.mk diff --git a/test/subset/data/Makefile.am b/test/subset/data/Makefile.am new file mode 100644 index 000000000..beb0a0411 --- /dev/null +++ b/test/subset/data/Makefile.am @@ -0,0 +1,45 @@ +# Process this file with automake to produce Makefile.in + +NULL = +EXTRA_DIST = +CLEANFILES = +SUBDIRS = + +EXTRA_DIST += \ + $(TESTS) \ + expected/basics \ + expected/full-font \ + expected/cff-full-font \ + expected/japanese \ + expected/cff-japanese \ + expected/layout \ + expected/layout.gpos \ + expected/layout.gpos2 \ + expected/layout.gpos3 \ + expected/layout.gpos4 \ + expected/layout.gpos6 \ + expected/layout.gpos8 \ + expected/layout.gsub3 \ + expected/layout.gsub6 \ + expected/layout.gdef \ + expected/layout.context \ + expected/layout.gdef-varstore \ + expected/layout.gdef-attachlist \ + expected/cmap \ + expected/cmap14 \ + expected/sbix \ + expected/colr \ + expected/cbdt \ + fonts \ + profiles \ + $(NULL) + +# Convenience targets: +lib: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib + +TEST_EXTENSIONS = .tests +TESTS_LOG_COMPILER = $(srcdir)/../run-tests.py $(top_builddir)/util/hb-subset$(EXEEXT) +include Makefile.sources + +-include $(top_srcdir)/git.mk diff --git a/test/subset/data/Makefile.sources b/test/subset/data/Makefile.sources new file mode 100644 index 000000000..bdc983552 --- /dev/null +++ b/test/subset/data/Makefile.sources @@ -0,0 +1,31 @@ +TESTS = \ + tests/basics.tests \ + tests/cbdt.tests \ + tests/cff-full-font.tests \ + tests/cff-japanese.tests \ + tests/cmap.tests \ + tests/cmap14.tests \ + tests/colr.tests \ + tests/full-font.tests \ + tests/japanese.tests \ + tests/layout.context.tests \ + tests/layout.gdef-attachlist.tests \ + tests/layout.gdef-varstore.tests \ + tests/layout.gdef.tests \ + tests/layout.gpos.tests \ + tests/layout.gpos2.tests \ + tests/layout.gpos3.tests \ + tests/layout.gpos4.tests \ + tests/layout.gpos6.tests \ + tests/layout.gpos8.tests \ + tests/layout.gsub3.tests \ + tests/layout.gsub6.tests \ + tests/layout.tests \ + tests/sbix.tests \ + $(NULL) + +XFAIL_TESTS = \ + $(NULL) + +DISABLED_TESTS = \ + $(NULL) diff --git a/util/Makefile.am b/util/Makefile.am new file mode 100644 index 000000000..29f690948 --- /dev/null +++ b/util/Makefile.am @@ -0,0 +1,78 @@ +# Process this file with automake to produce Makefile.in + +NULL = +EXTRA_DIST = +CLEANFILES = +DISTCLEANFILES = +MAINTAINERCLEANFILES = + +EXTRA_DIST += meson.build + +include Makefile.sources + +# Convenience targets: +lib: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib +libs: + @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libs + +bin_PROGRAMS = + +AM_CPPFLAGS = \ + -DHB_DISABLE_DEPRECATED \ + -I$(top_srcdir)/src/ \ + -I$(top_builddir)/src/ \ + $(GLIB_CFLAGS) \ + $(FREETYPE_CFLAGS) \ + $(CAIRO_FT_CFLAGS) \ + $(NULL) +LDADD = \ + $(top_builddir)/src/libharfbuzz.la \ + -lm \ + $(GLIB_LIBS) \ + $(FREETYPE_LIBS) \ + $(NULL) + +if HAVE_GLIB + +if HAVE_FREETYPE +if HAVE_CAIRO_FT +hb_view_SOURCES = $(HB_VIEW_sources) +hb_view_LDADD = \ + $(LDADD) \ + $(CAIRO_LIBS) \ + $(CAIRO_FT_LIBS) \ + $(NULL) +bin_PROGRAMS += hb-view +endif # HAVE_CAIRO_FT +endif # HAVE_FREETYPE + +hb_shape_SOURCES = $(HB_SHAPE_sources) +bin_PROGRAMS += hb-shape + +hb_subset_SOURCES = $(HB_SUBSET_CLI_sources) +hb_subset_LDADD = \ + $(top_builddir)/src/libharfbuzz-subset.la \ + $(LDADD) + +bin_PROGRAMS += hb-subset + +hb_ot_shape_closure_SOURCES = $(HB_OT_SHAPE_CLOSURE_sources) +bin_PROGRAMS += hb-ot-shape-closure + +endif # HAVE_GLIB + +#if HAVE_FONTCONFIG +#hb_fc_list_SOURCES = \ +# hb-fc.cc \ +# hb-fc.h \ +# hb-fc-list.c \ +# $(NULL) +#hb_fc_list_LDADD = \ +# $(LDADD) \ +# $(FONTCONFIG_LIBS) \ +# $(NULL) +#bin_PROGRAMS += hb-fc-list +#endif # HAVE_FONTCONFIG + +-include $(top_srcdir)/git.mk diff --git a/util/Makefile.sources b/util/Makefile.sources new file mode 100644 index 000000000..bcf85f562 --- /dev/null +++ b/util/Makefile.sources @@ -0,0 +1,38 @@ +HB_VIEW_sources = \ + hb-view.cc \ + options.cc \ + options.hh \ + main-font-text.hh \ + shape-consumer.hh \ + ansi-print.cc \ + ansi-print.hh \ + helper-cairo.cc \ + helper-cairo.hh \ + helper-cairo-ansi.cc \ + helper-cairo-ansi.hh \ + view-cairo.cc \ + view-cairo.hh \ + $(NULL) + +HB_SHAPE_sources = \ + hb-shape.cc \ + options.cc \ + options.hh \ + main-font-text.hh \ + shape-consumer.hh \ + $(NULL) + +HB_OT_SHAPE_CLOSURE_sources = \ + hb-ot-shape-closure.cc \ + options.cc \ + options.hh \ + main-font-text.hh \ + $(NULL) + +HB_SUBSET_CLI_sources = \ + hb-subset.cc \ + options.cc \ + options-subset.cc \ + options.hh \ + main-font-text.hh \ + $(NULL)