--- /dev/null
+From 6cf7a9d9e34b6cce202d1286d8c1b5738238bb02 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.cz>
+Date: Tue, 27 Sep 2011 09:34:59 +0200
+Subject: [PATCH] Update configure to avoid automagicness.
+
+Fixes also some missing definitions from configure.ac/am about libtool
+Removes redundant defines. And their conditionals in code.
+Updates gitignore to ingore all autotools produced code.
+---
+ .gitignore | 53 +++++++++++++++
+ Makefile.am | 2 +
+ configure.ac | 189 ++++++++++++++++++++++++++++--------------------------
+ src/Makefile.am | 47 +++++--------
+ src/hb-shape.cc | 6 +--
+ test/Makefile.am | 12 +---
+ test/test-c.c | 2 -
+ util/Makefile.am | 5 +-
+ 8 files changed, 176 insertions(+), 140 deletions(-)
+ create mode 100644 .gitignore
+
+diff --git a/.gitignore b/.gitignore
+new file mode 100644
+index 0000000..22d4d21
+--- /dev/null
++++ b/.gitignore
+@@ -0,0 +1,53 @@
++/*.bak
++/*.lo
++/*.o
++/*.orig
++/*.rej
++/*.tab.c
++/*.tar.*
++/*~
++/.*.sw[nop]
++/.deps
++/.libs
++/ChangeLog
++/GPATH
++/GRTAGS
++/GSYMS
++/GTAGS
++/ID
++/INSTALL
++/Makefile
++/Makefile.in
++/TAGS
++/_libs
++/aclocal.m4
++/autom4te.cache
++/autoscan.log
++/compile
++/config.cache
++/config.guess
++/config.h
++/config.h.in
++/config.log
++/config.lt
++/config.status
++/config.status.lineno
++/config.sub
++/configure
++/configure.lineno
++/configure.scan
++/depcomp
++/harfbuzz.pc
++/install-sh
++/libtool
++/ltmain.sh
++/m4/
++/missing
++/mkinstalldirs
++/so_locations
++/src/Makefile.in
++/src/hb-gobject-enums.cc
++/stamp-h1
++/tags
++/test/Makefile.in
++/util/Makefile.in
+diff --git a/Makefile.am b/Makefile.am
+index 8b69c2d..4fc7c66 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,5 +1,7 @@
+ # Process this file with automake to produce Makefile.in
+
++ACLOCAL_AMFLAGS = -I m4
++
+ NULL =
+
+ SUBDIRS = src util test
+diff --git a/configure.ac b/configure.ac
+index 856fb98..98e0670 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,20 +1,26 @@
+-AC_PREREQ([2.64])
++AC_PREREQ([2.65])
+ AC_INIT([harfbuzz],
+- [0.7.0],
+- [http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz],
+- [harfbuzz],
+- [http://harfbuzz.org/])
++ [0.7.0],
++ [http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz],
++ [harfbuzz],
++ [http://harfbuzz.org/])
+
++AC_CONFIG_MACRO_DIR([m4])
+ AC_CONFIG_SRCDIR([harfbuzz.pc.in])
+ AC_CONFIG_HEADERS([config.h])
+
+-AM_INIT_AUTOMAKE([1.11.1 gnu dist-bzip2 no-dist-gzip -Wall no-define])
++AM_INIT_AUTOMAKE([1.11 gnu dist-xz dist-bzip2 no-dist-gzip -Wall no-define])
+ AM_SILENT_RULES([yes])
++AC_LANG([C++])
+
+ # Check for programs
+ AC_PROG_CC
+ AM_PROG_CC_C_O
+ AC_PROG_CXX
++AC_PROG_INSTALL
++AC_PROG_LN_S
++AC_PROG_LIBTOOL
++PKG_PROG_PKG_CONFIG([0.20])
+
+ # Initialize libtool
+ LT_PREREQ([2.2])
+@@ -57,113 +63,101 @@ AC_CHECK_HEADERS(unistd.h sys/mman.h io.h)
+
+ # Compiler flags
+ AC_CANONICAL_HOST
+-if test "x$GCC" = "xyes"; then
+-
++AS_IF([test "x$GCC" = "xyes"], [
+ # Make symbols link locally
+- LDFLAGS="$LDFLAGS -Bsymbolic-functions"
++ LDFLAGS="$LDFLAGS -Bsymbolic-functions -Wl,--as-needed -no-undefined"
+
+ # Make sure we don't link to libstdc++
+ CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions"
+-
+- case "$host" in
+- arm-*-*)
++ AS_CASE([$host],
++ [arm-*-*], [
+ # Request byte alignment on arm
+ CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
+- ;;
+- esac
+-fi
++ ]
++ )
++])
+
+ dnl ==========================================================================
+-
+-PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, have_glib=false)
+-if $have_glib; then
++AC_ARG_WITH([glib],
++ [AS_HELP_STRING([--without-glib], [Build with glib library])]
++)
++AS_IF([test "x$with_glib" != "xno"], [
++ PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16 gthread-2.0 gobject-2.0, have_glib=yes, have_glib=no)
++], [
++ have_glib=no
++])
++AS_IF([test "x$have_glib" = "xyes"], [
+ AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
+-fi
+-AM_CONDITIONAL(HAVE_GLIB, $have_glib)
+-
+-PKG_CHECK_MODULES(GTHREAD, gthread-2.0, have_gthread=true, have_gthread=false)
+-if $have_gthread; then
+- AC_DEFINE(HAVE_GTHREAD, 1, [Have gthread2 library])
+-fi
+-AM_CONDITIONAL(HAVE_GTHREAD, $have_gthread)
+-
+-PKG_CHECK_MODULES(GOBJECT, gobject-2.0, have_gobject=true, have_gobject=false)
+-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)
++], [
++ AS_IF([test "x$with_glib" = "xyes"], [AC_MSG_ERROR([glib requested but not found])])
++])
++AM_CONDITIONAL([HAVE_GLIB], [test "x$have_glib" != "xno"])
+
+ dnl ==========================================================================
+-
+-PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, have_cairo=false)
+-if $have_cairo; then
++AC_ARG_WITH([cairo],
++ [AS_HELP_STRING([--without-cairo], [Build with cairo library])]
++)
++AS_IF([test "x$with_cairo" != "xno"], [
++ PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0 cairo-ft, have_cairo=yes, have_cairo=no)
++], [
++ have_cairo=no
++])
++AS_IF([test "x$have_cairo" = "xyes"], [
+ AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
+-fi
+-AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
+-
+-PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, have_cairo_ft=false)
+-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)
++], [
++ AS_IF([test "x$with_cairo" = "xyes"], [AC_MSG_ERROR([cairo requested but not found])])
++])
++AM_CONDITIONAL([HAVE_CAIRO], [test "x$have_cairo" != "xno"])
+
+ dnl ==========================================================================
+-
+-PKG_CHECK_MODULES(ICU, icu, have_icu=true, [
+- have_icu=true
+- AC_CHECK_HEADERS(unicode/uchar.h,, have_icu=false)
+- AC_MSG_CHECKING([for libicuuc])
+- LIBS_old=$LIBS
+- LIBS="$LIBS -licuuc"
+- AC_TRY_LINK([#include <unicode/uchar.h>],
+- [u_getIntPropertyValue (0, (UProperty)0);],
+- AC_MSG_RESULT(yes),
+- AC_MSG_RESULT(no);have_icu=false)
+- LIBS=$LIBS_old
+- if $have_icu; then
+- ICU_CFLAGS=-D_REENTRANT
+- ICU_LIBS="-licuuc"
+- AC_SUBST(ICU_CFLAGS)
+- AC_SUBST(ICU_LIBS)
+- fi
++AC_ARG_WITH([icu],
++ [AS_HELP_STRING([--without-icu], [Build with icu library])]
++)
++AS_IF([test "x$with_icu" != "xno"], [
++ PKG_CHECK_MODULES(ICU, icu-uc, have_icu=yes, have_icu=no)
++], [
++ have_icu=no
+ ])
+-if $have_icu; then
+- AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
+-fi
+-AM_CONDITIONAL(HAVE_ICU, $have_icu)
++AS_IF([test "x$have_cairo" = "xyes"], [
++ AC_DEFINE(HAVE_ICU, 1, [Have icu library])
++], [
++ AS_IF([test "x$with_icu" = "xyes"], [AC_MSG_ERROR([icu requested but not found])])
++])
++AM_CONDITIONAL([HAVE_ICU], [test "x$have_icu" != "xno"])
+
+ dnl ==========================================================================
+-
+-PKG_CHECK_MODULES(GRAPHITE, graphite2, have_graphite=true, have_graphite=false)
+-if $have_graphite; then
+- AC_DEFINE(HAVE_GRAPHITE, 1, [Have Graphite library])
+-fi
+-AM_CONDITIONAL(HAVE_GRAPHITE, $have_graphite)
++AC_ARG_WITH([graphite],
++ [AS_HELP_STRING([--without-graphite], [Build with graphite2 library])]
++)
++AS_IF([test "x$with_graphite" != "xno"], [
++ PKG_CHECK_MODULES(GRAPHITE, graphite, have_graphite=yes, have_graphite=no)
++], [
++ have_graphite=no
++])
++AS_IF([test "x$have_graphite" = "xyes"], [
++ AC_DEFINE(HAVE_GRAPHITE, 1, [Have graphite graphics library])
++], [
++ AS_IF([test "x$with_graphite" = "xyes"], [AC_MSG_ERROR([graphite requested but not found])])
++])
++AM_CONDITIONAL([HAVE_GRAPHITE], [test "x$have_graphite" != "xno"])
+
+ dnl ==========================================================================
+-
+-PKG_CHECK_MODULES(FREETYPE, freetype2 >= 2.3.8, have_freetype=true, have_freetype=false)
+-if $have_freetype; then
+- AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
+- _save_libs="$LIBS"
+- _save_cflags="$CFLAGS"
+- LIBS="$LIBS $FREETYPE_LIBS"
+- CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
+- AC_CHECK_FUNCS(FT_Face_GetCharVariantIndex)
+- LIBS="$_save_libs"
+- CFLAGS="$_save_cflags"
+-fi
+-AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
+-
+-dnl ===========================================================================
+-
+-have_ot=true;
+-if $have_ot; then
+- AC_DEFINE(HAVE_OT, 1, [Have native OpenType Layout backend])
+-fi
+-AM_CONDITIONAL(HAVE_OT, $have_ot)
++AC_ARG_WITH([freetype],
++ [AS_HELP_STRING([--without-freetype], [Build with freetype2 library])]
++)
++AS_IF([test "x$with_freetype" != "xno"], [
++ PKG_CHECK_MODULES(FREETYPE, freetype2 >= 2.3.8, have_freetype=yes, have_freetype=no)
++], [
++ have_freetype=no
++])
++AS_IF([test "x$have_freetype" = "xyes"], [
++ AC_DEFINE(HAVE_FREETYPE, 1, [Have freetype graphics library])
++], [
++ AS_IF([test "x$with_freetype" = "xyes"], [AC_MSG_ERROR([freetype requested but not found])])
++])
++AM_CONDITIONAL([HAVE_FREETYPE], [test "x$have_freetype" != "xno"])
+
+ dnl ===========================================================================
+
+@@ -187,3 +181,14 @@ test/Makefile
+ ])
+
+ AC_OUTPUT
++
++AC_MSG_NOTICE([
++==============================================================================
++Build configuration:
++ glib: ${have_glib}
++ cairo: ${have_cairo}
++ icu: ${have_icu}
++ graphite: ${have_graphite}
++ freetype: ${have_freetype}
++==============================================================================
++])
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 4170663..9d2dd1b 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -30,28 +30,6 @@ HBSOURCES = \
+ hb-ot-head-table.hh \
+ hb-ot-hhea-table.hh \
+ hb-ot-hmtx-table.hh \
+- hb-ot-maxp-table.hh \
+- hb-ot-name-table.hh \
+- hb-ot-tag.cc \
+- hb-private.hh \
+- hb-shape.cc \
+- hb-tt-font.cc \
+- hb-unicode-private.hh \
+- hb-unicode.cc \
+- $(NULL)
+-HBHEADERS = \
+- hb.h \
+- hb-blob.h \
+- hb-buffer.h \
+- hb-common.h \
+- hb-font.h \
+- hb-shape.h \
+- hb-unicode.h \
+- hb-version.h \
+- $(NULL)
+-
+-if HAVE_OT
+-HBSOURCES += \
+ hb-ot-layout.cc \
+ hb-ot-layout-common-private.hh \
+ hb-ot-layout-gdef-table.hh \
+@@ -61,6 +39,8 @@ HBSOURCES += \
+ hb-ot-layout-private.hh \
+ hb-ot-map.cc \
+ hb-ot-map-private.hh \
++ hb-ot-maxp-table.hh \
++ hb-ot-name-table.hh \
+ hb-ot-shape.cc \
+ hb-ot-shape-complex-arabic.cc \
+ hb-ot-shape-complex-arabic-table.hh \
+@@ -71,25 +51,34 @@ HBSOURCES += \
+ hb-ot-shape-complex-private.hh \
+ hb-ot-shape-normalize.cc \
+ hb-ot-shape-private.hh \
++ hb-ot-tag.cc \
++ hb-private.hh \
++ hb-shape.cc \
++ hb-tt-font.cc \
++ hb-unicode-private.hh \
++ hb-unicode.cc \
+ $(NULL)
+-HBHEADERS += \
++HBHEADERS = \
++ hb.h \
++ hb-blob.h \
++ hb-buffer.h \
++ hb-common.h \
++ hb-font.h \
+ hb-ot.h \
+ hb-ot-layout.h \
+ hb-ot-shape.h \
+ hb-ot-tag.h \
++ hb-shape.h \
++ hb-unicode.h \
++ hb-version.h \
+ $(NULL)
+-endif
+
+ if HAVE_GLIB
+-HBCFLAGS += $(GLIB_CFLAGS)
++HBCFLAGS += $(GLIB_CFLAGS)
+ HBLIBS += $(GLIB_LIBS)
+ HBSOURCES += hb-glib.cc
+ HBHEADERS += hb-glib.h
+-endif
+
+-if HAVE_GOBJECT
+-HBCFLAGS += $(GOBJECT_CFLAGS)
+-HBLIBS += $(GOBJECT_LIBS)
+ HBSOURCES += hb-gobject-structs.cc
+ nodist_HBSOURCES = hb-gobject-enums.cc
+ HBHEADERS += hb-gobject.h
+diff --git a/src/hb-shape.cc b/src/hb-shape.cc
+index 9357f81..25732b7 100644
+--- a/src/hb-shape.cc
++++ b/src/hb-shape.cc
+@@ -36,9 +36,7 @@
+ #ifdef HAVE_UNISCRIBE
+ # include "hb-uniscribe.h"
+ #endif
+-#ifdef HAVE_OT
+-# include "hb-ot-shape.h"
+-#endif
++#include "hb-ot-shape.h"
+ #include "hb-fallback-shape-private.hh"
+
+ typedef hb_bool_t (*hb_shape_func_t) (hb_font_t *font,
+@@ -59,9 +57,7 @@ static struct hb_shaper_pair_t {
+ #ifdef HAVE_UNISCRIBE
+ HB_SHAPER_IMPLEMENT (uniscribe),
+ #endif
+-#ifdef HAVE_OT
+ HB_SHAPER_IMPLEMENT (ot),
+-#endif
+ HB_SHAPER_IMPLEMENT (fallback) /* should be last */
+ };
+ #undef HB_SHAPER_IMPLEMENT
+diff --git a/test/Makefile.am b/test/Makefile.am
+index b3c8cc2..8e90483 100644
+--- a/test/Makefile.am
++++ b/test/Makefile.am
+@@ -7,13 +7,12 @@ DISTCLEANFILES =
+ MAINTAINERCLEANFILES =
+
+ if HAVE_GLIB
+-AM_CPPFLAGS = -DSRCDIR="\"$(srcdir)\"" -I$(top_srcdir)/src/ -I$(top_builddir)/src/ $(GLIB_CFLAGS) $(GTHREAD_CFLAGS)
+-LDADD = $(top_builddir)/src/libharfbuzz.la $(GLIB_LIBS) $(GTHREAD_LIBS)
++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
+
+ check_PROGRAMS = $(TEST_PROGS)
+-noinst_PROGRAMS = $(TEST_PROGS)
+
+ TEST_PROGS = \
+ test-blob \
+@@ -21,17 +20,12 @@ TEST_PROGS = \
+ test-common \
+ test-font \
+ test-object \
++ test-ot-tag \
+ test-shape \
+ test-unicode \
+ test-version \
+ $(NULL)
+
+-if HAVE_OT
+-TEST_PROGS += \
+- test-ot-tag \
+- $(NULL)
+-endif
+-
+ # Tests for header compilation
+ TEST_PROGS += \
+ test-c \
+diff --git a/test/test-c.c b/test/test-c.c
+index 7e7c502..0120744 100644
+--- a/test/test-c.c
++++ b/test/test-c.c
+@@ -43,9 +43,7 @@
+ #include <hb-ft.h>
+ #endif
+
+-#ifdef HAVE_OT
+ #include <hb-ot.h>
+-#endif
+
+ #ifdef HAVE_UNISCRIBE
+ #include <hb-uniscribe.h>
+diff --git a/util/Makefile.am b/util/Makefile.am
+index 223a59a..110d8ff 100644
+--- a/util/Makefile.am
++++ b/util/Makefile.am
+@@ -13,7 +13,7 @@ AM_CPPFLAGS = \
+ -I$(top_builddir)/src/ \
+ $(GLIB_CFLAGS) \
+ $(FREETYPE_CFLAGS) \
+- $(CAIRO_FT_CFLAGS) \
++ $(CAIRO_CFLAGS) \
+ $(NULL)
+ LDADD = \
+ $(top_builddir)/src/libharfbuzz.la \
+@@ -24,7 +24,7 @@ LDADD = \
+
+ if HAVE_GLIB
+ if HAVE_FREETYPE
+-if HAVE_CAIRO_FT
++if HAVE_CAIRO
+ hb_view_SOURCES = \
+ hb-view.cc \
+ hb-view.hh \
+@@ -38,7 +38,6 @@ hb_view_SOURCES = \
+ hb_view_LDADD = \
+ $(LDADD) \
+ $(CAIRO_LIBS) \
+- $(CAIRO_FT_LIBS) \
+ $(NULL)
+ bin_PROGRAMS += hb-view
+ endif
+--
+1.7.6.3
+