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_FONTCONFIG,
20 OLDCPPFLAGS="${CPPFLAGS}"
23 if test -d /usr/include/fontconfig; then
24 CPPFLAGS="$CPPFLAGS -I/usr/include/fontconfig"
27 AC_CHECK_LIB(fontconfig, FcInit,HAVE_LIB_FONTCONFIG=1,)
28 AC_CHECK_HEADERS(fontconfig.h,HAVE_FONTCONFIG_H=1)
30 if test "x${HAVE_LIB_FONTCONFIG}" != "x";then
31 if test "x${HAVE_FONTCONFIG_H}" != "x";then
36 if test "x${HAVE_FONTCONFIG}" = "x1"; then
37 LIBS="$LIBS -lfontconfig"
38 AC_MSG_CHECKING([whether we can compile the fontconfig test program])
40 if (echo $LIBS | grep lfreetype >/dev/null 2>&1); then
41 #move freetype library to the end of libraries, otherwise fontconfig
43 LIBS=`echo $LIBS | sed -e 's/-lfreetype//g' -e 's/$/ -lfreetype/'`
46 cat > conftest.c << EOF
48 #include <fontconfig.h>
52 FcPattern *pattern, *match;
55 char*s1="abc",*s2="ABC";
58 pattern = FcPatternBuild(0, FC_FAMILY, FcTypeString, "", 0);
59 FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
60 FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
61 FcConfigSubstitute(0, pattern, FcMatchPattern);
62 FcDefaultSubstitute(pattern);
63 match = FcFontMatch(0, pattern, &result);
64 FcPatternGetString(match, "family", 0, &v) == FcResultMatch;
65 FcPatternPrint(pattern);
66 FcPatternDestroy(pattern);
67 FcPatternDestroy(match);
72 ac_link='$CC $CPPFLAGS $CFLAGS conftest.c $LDFLAGS $LIBS -o conftest${ac_exeext}'
73 if { (eval echo freetype.m4:71: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
75 AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG, 1)
77 echo "configure: failed program was:" >&5
85 # if the above didn't work out, reset all changes to the compiler variables.
86 if test "x${HAVE_FREETYPE}" "!=" "x1"; then