1 # ----------- freetype.m4 ----------------
4 # * freetype library (-lfreetype)
5 # * freetype headers (freetype2/freetype/freetype.h)
6 # * whether a freetype test program can be compiled
18 AC_DEFUN(RFX_CHECK_FREETYPE,
20 AC_CHECK_PROGS(FREETYPE_CONFIG, freetype-config,)
21 OLDCPPFLAGS="${CPPFLAGS}"
23 if test "x${FREETYPE_CONFIG}" '!=' "x"; then
24 CPPFLAGS="$CPPFLAGS "`freetype-config --cflags`
25 else if test -d /usr/include/freetype2; then
26 CPPFLAGS="$CPPFLAGS -I/usr/include/freetype2"
27 else if test -d /usr/local/include/freetype2; then
28 CPPFLAGS="$CPPFLAGS -I/usr/local/include/freetype2"
33 AC_CHECK_LIB(freetype, FT_Init_FreeType,HAVE_LIB_FREETYPE=1,)
34 AC_CHECK_HEADERS(freetype/freetype.h,HAVE_FREETYPE_FREETYPE_H=1)
35 AC_CHECK_HEADERS(ft2build.h,HAVE_FT2BUILD_H=1)
37 if test "x${HAVE_LIB_FREETYPE}" '!=' "x";then
38 if test "x${HAVE_FREETYPE_FREETYPE_H}" '!=' "x";then
41 if test "x${HAVE_FT2BUILD_H}" '!=' "x";then
46 if test "x${HAVE_FREETYPE}" = "x1"; then
47 if test "x{$FREETYPE_CONFIG}" '!=' "x"; then
48 LIBS="$LIBS "`freetype-config --libs`
50 LIBS="$LIBS -lfreetype"
53 if test "x${HAVE_FT2BUILD_H}" = "x1"; then
54 HAVE_FT2BUILD_H_DEFINE='#define HAVE_FT2BUILD_H'
57 AC_MSG_CHECKING([whether we can compile the freetype test program])
59 cat > conftest.c << EOF
60 $HAVE_FT2BUILD_H_DEFINE
62 #ifdef HAVE_FT2BUILD_H
64 #include FT_FREETYPE_H
67 #include FT_SFNT_NAMES_H
68 #include FT_TRUETYPE_IDS_H
71 #include <freetype/freetype.h>
72 #include <freetype/ftglyph.h>
73 #include <freetype/ftsizes.h>
74 #include <freetype/ftsnames.h>
75 #include <freetype/ttnameid.h>
76 #include <freetype/ftoutln.h>
93 FT_Init_FreeType(&ftlibrary);
94 FT_New_Face(ftlibrary, "filename", 0, &face);
95 i = face->num_glyphs - 1;
96 italic = face->style_flags&FT_STYLE_FLAG_ITALIC;
97 bold = face->style_flags&FT_STYLE_FLAG_BOLD;
98 FT_Get_Postscript_Name(face);
99 FT_Get_Char_Index(face, 33);
100 FT_Get_First_Char(face, &i);
101 FT_Get_Next_Char(face, 33, &i);
102 if(FT_HAS_GLYPH_NAMES(face)) {
103 FT_Get_Glyph_Name(face, 33, name, 127);
105 FT_Load_Glyph(face, 33, FT_LOAD_NO_BITMAP|FT_LOAD_NO_SCALE);
106 FT_Get_Glyph(face->glyph, &glyph);
107 FT_Glyph_Get_CBox(glyph, ft_glyph_bbox_unscaled, &bbox);
108 FT_Done_Glyph(glyph);
110 FT_Done_FreeType(ftlibrary);
115 ac_link='$CC $CPPFLAGS $CFLAGS conftest.c $LDFLAGS $LIBS -o conftest${ac_exeext}'
116 if { (eval echo freetype.m4:71: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
118 AC_DEFINE_UNQUOTED(HAVE_FREETYPE, 1)
119 AC_DEFINE_UNQUOTED(USE_FREETYPE, 1) # for ttf2tp1
121 echo "configure: failed program was:" >&5
129 # if the above didn't work out, reset all changes to the compiler variables.
130 if test "x${HAVE_FREETYPE}" '!=' "x1"; then
131 CPPFLAGS=$OLDCPPFLAGS