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
47 #include <fontconfig.h>
51 FcPattern *pattern, *match;
55 pattern = FcPatternBuild(0, FC_FAMILY, FcTypeString, "", 0);
56 FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
57 FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
58 FcConfigSubstitute(0, pattern, FcMatchPattern);
59 FcDefaultSubstitute(pattern);
60 match = FcFontMatch(0, pattern, &result);
61 FcPatternGetString(match, "family", 0, &v) == FcResultMatch;
62 FcPatternPrint(pattern);
63 FcPatternDestroy(pattern);
64 FcPatternDestroy(match);
69 ac_link='$CC $CPPFLAGS $CFLAGS conftest.c $LDFLAGS $LIBS -o conftest${ac_exeext}'
70 if { (eval echo freetype.m4:71: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
72 AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG, 1)
74 echo "configure: failed program was:" >&5
82 # if the above didn't work out, reset all changes to the compiler variables.
83 if test "x${HAVE_FREETYPE}" "!=" "x1"; then