Update to version 2.2.2
Make subdir build work
Use new freetype include scheme
diff --git a/ChangeLog b/ChangeLog
index 4342455..3a52b91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2004-03-10  Keith Packard  <keithp@keithp.com>
+
+	* README:
+	* fontconfig/fontconfig.h:
+	* configure.in:
+	Update to version 2.2.2
+
+	* doc/Makefile.am:
+	* fc-lang/Makefile.am:
+	Make subdir build work
+	
+	* fontconfig/fcfreetype.h:
+	* src/fcfreetype.c:
+	Use new freetype include scheme
+
 2003-11-10  Roozbeh Pournader  <roozbeh@sharif.edu>
 
 	* src/fcxml.c:
diff --git a/README b/README
index 5fceba8..8f7d257 100644
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
 			Fontconfig
 	Font configuration and customization library
-		      Version 2.2
-		        2003-3-1
+		      Version 2.2.2
+		         2004-3-10
 
 This is the third public release of fontconfig, a font configuration and
 customization library.  Fontconfig is designed to locate fonts within the
@@ -11,5 +11,25 @@
 rasterization library on the application.  The X-specific library
 'Xft' uses fontconfig along with freetype to specify and rasterize fonts.
 
+Version 2.2.2
+
+Update #includes for newer versions of FreeType
+
+Version 2.2.1
+
+Allows executable names for autotools to be specified in environment
+variables.
+
+Close some SGML tags in the documentation.
+
+Fix a catastrophic bug in pattern editing code
+
+Fix a typo "bitsteam" -> "bitstream"
+
+Let FreeType compute slant for type1 fonts instead of poking at the
+italic_angle value.
+
+Fix language comparison function.
+
 Keith Packard
 keithp@keithp.com
diff --git a/configure.in b/configure.in
index 3badba3..21f3a0b 100644
--- a/configure.in
+++ b/configure.in
@@ -33,7 +33,7 @@
 dnl version.  This same version number must appear in fontconfig/fontconfig.h
 dnl Yes, it is a pain to synchronize version numbers.  Unfortunately, it's
 dnl not possible to extract the version number here from fontconfig.h
-AM_INIT_AUTOMAKE(fontconfig, 2.2.1)
+AM_INIT_AUTOMAKE(fontconfig, 2.2.2)
 
 dnl libtool versioning
 
@@ -320,7 +320,7 @@
 # Find out what language orthographies are included
 #
 
-ORTH_FILES=`cd fc-lang && echo *.orth`
+ORTH_FILES=`cd ${srcdir}/fc-lang && echo *.orth`
 AC_SUBST(ORTH_FILES)
 
 #
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 4a72f39..e3fe9e8 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,3 +1,4 @@
+DOC_SRC = $(srcdir)
 DOC_MODULE = fontconfig
 DOC2HTML = docbook2html
 DOC2TXT = docbook2txt
@@ -7,7 +8,7 @@
 HTML_FILES = fontconfig-user.html
 HTML_DIRS = fontconfig-devel
 SGML = fontconfig-user.sgml fontconfig-devel.sgml
-FNCS_TMPL = func.sgml
+FNCS_TMPL = ${DOC_SRC}/func.sgml
 
 DOC_FUNCS_FNCS=\
 	fcatomic.fncs \
@@ -97,43 +98,62 @@
 
 .fncs.sgml:
 	$(RM) $@
-	./edit-sgml $(FNCS_TMPL) < $*.fncs > $*.sgml
+	./edit-sgml $(FNCS_TMPL) < '$<' > $*.sgml
 
 .sgml.txt:
 	$(RM) $@
-	$(DOC2TXT) $*.sgml
+	$(DOC2TXT) $<
 
 $(man_MANS): func.refs
 
-func.refs: fontconfig-devel.sgml $(DOC_FUNCS_SGML) version.sgml
+func.refs: local-fontconfig-devel.sgml $(DOC_FUNCS_SGML) version.sgml
 	$(RM) func.refs
-	$(DOC2MAN) fontconfig-devel.sgml
+	$(DOC2MAN) local-fontconfig-devel.sgml
 	mv manpage.refs func.refs
 	$(RM) manpage.links
 
 $(DOC_FUNCS_SGML): edit-sgml $(FNCS_TMPL)
 
-fonts-conf.5: fontconfig-user.sgml version.sgml
+fonts-conf.5: local-fontconfig-user.sgml version.sgml
 	$(RM) file.refs
-	$(DOC2MAN) fontconfig-user.sgml
+	$(DOC2MAN) local-fontconfig-user.sgml
 	$(RM) manpage.refs manpage.links
 
+local-fontconfig-user.sgml: fontconfig-user.sgml
+	$(LN_S) $< $@
+
 all-local: $(LOCAL_DOCS)
 
 clean-local:
 	$(RM) $(man_MANS) $(DOC_FILES) $(DOC_FUNCS_SGML) func.refs
 	$(RM) -r $(DOC_DIRS)
 
-fontconfig-devel: fontconfig-devel.sgml $(DOCS_FUNCS_SGML) version.sgml
+fontconfig-devel: local-fontconfig-devel.sgml $(DOCS_FUNCS_SGML) version.sgml
 	$(RM) -r fontconfig-devel
-	$(DOC2HTML) -o fontconfig-devel fontconfig-devel.sgml
+	$(DOC2HTML) -o fontconfig-devel local-fontconfig-devel.sgml
 
-fontconfig-devel.txt: fontconfig-devel.sgml version.sgml
+local-fontconfig-devel.sgml: fontconfig-devel.sgml
+	$(LN_S) $< $@
 
-fontconfig-user.html: fontconfig-user.sgml version.sgml
-	$(DOC2HTML) -u fontconfig-user.sgml
+fontconfig-devel.txt: local-fontconfig-devel.sgml version.sgml
+	$(RM) $@
+	$(DOC2TXT) local-fontconfig-devel.sgml
+	mv local-fontconfig-devel.txt $@
 
-fontconfig-user.txt:  fontconfig-user.sgml version.sgml
+fontconfig-user.html: local-fontconfig-user.sgml version.sgml
+	$(RM) $@ local-$@ $@.tmp
+	$(DOC2HTML) -u local-fontconfig-user.sgml > $@.tmp
+	-test -f local-$@ && mv local-$@ $@
+	-test -f $@ || mv $@.tmp $@
+	-test -f $@.tmp && $(RM) $@.tmp
+
+fontconfig-user.txt:  local-fontconfig-user.sgml version.sgml
+	$(RM) $@
+	$(DOC2TXT) local-fontconfig-user.sgml
+	mv local-fontconfig-user.txt $@
+
+CLEANFILES=confdir.sgml local-fontconfig-user.sgml local-fontconfig-devel.sgml
+
 else
 all-local:
 clean-local:
diff --git a/fc-lang/Makefile.am b/fc-lang/Makefile.am
index fd4ba0e..beef9af 100644
--- a/fc-lang/Makefile.am
+++ b/fc-lang/Makefile.am
@@ -22,9 +22,10 @@
 # PERFORMANCE OF THIS SOFTWARE.
 #
 
-INCLUDES=-I../src $(FREETYPE_CFLAGS)
+INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(FREETYPE_CFLAGS)
 
 TMPL=fclang.tmpl.h
+STMPL=${top_srcdir}/fc-lang/fclang.tmpl.h
 TARG=fclang.h
 
 noinst_PROGRAMS=fc-lang
@@ -37,6 +38,8 @@
 
 EXTRA_DIST=$(TMPL) $(ORTH)
 
-$(TARG): $(TMPL) fc-lang $(ORTH)
+$(TARG): $(STMPL) fc-lang $(ORTH)
 	rm -f $(TARG)
-	./fc-lang $(ORTH) < $(TMPL) > $(TARG)
+	dir=`pwd`; (cd ${srcdir} && $${dir}/fc-lang $(ORTH)) < $(STMPL) > $(TARG)
+
+CLEANFILES=$(TARG)
diff --git a/fontconfig/fcfreetype.h b/fontconfig/fcfreetype.h
index d300e79..f016936 100644
--- a/fontconfig/fcfreetype.h
+++ b/fontconfig/fcfreetype.h
@@ -24,7 +24,8 @@
 
 #ifndef _FCFREETYPE_H_
 #define _FCFREETYPE_H_
-#include <freetype/freetype.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H
 
 FT_UInt
 FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4);
diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h
index 8c1acd5..4988848 100644
--- a/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig.h
@@ -40,7 +40,7 @@
 
 #define FC_MAJOR	2
 #define FC_MINOR	2
-#define FC_REVISION	1
+#define FC_REVISION	2
 
 #define FC_VERSION	((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION))
 
diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index 4d5c861..1211dc6 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -48,16 +48,17 @@
 #include <stdio.h>
 #include <string.h>
 #include "fcint.h"
-#include <freetype/freetype.h>
-#include <freetype/internal/ftobjs.h>
-#include <freetype/tttables.h>
-#include <freetype/ftsnames.h>
-#include <freetype/ttnameid.h>
-#include <freetype/t1tables.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include FT_TRUETYPE_TABLES_H
+#include FT_SFNT_NAMES_H
+#include FT_TRUETYPE_IDS_H
+#include FT_TYPE1_TABLES_H
 
 #if (FREETYPE_MINOR > 1 || (FREETYPE_MINOR == 1 && FREETYPE_PATCH >= 4))
-#include <freetype/ftbdf.h>
-#include <freetype/ftmodule.h>
+#include FT_BDF_H
+#include FT_MODULE_H
 #define USE_FTBDF
 #define HAS_BDF_PROPERTY(f) ((f) && (f)->driver && \
 			     (f)->driver->root.clazz->get_interface)