2 dnl Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl 2011 Free Software Foundation, Inc.
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3 of the License, or
8 dnl (at your option) any later version.
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 AC_DEFUN([GNASH_PATH_FREETYPE2],
20 dnl Look for the header
21 AC_ARG_WITH(freetype_incl, AC_HELP_STRING([--with-freetype-incl], [directory where libfreetype header is (w/out the freetype/ prefix)]), with_freetype_incl=${withval})
22 AC_CACHE_VAL(ac_cv_path_freetype_incl,[
23 if test x"${with_freetype_incl}" != x ; then
24 if test -f ${with_freetype_incl}/freetype/freetype.h ; then
25 ac_cv_path_freetype_incl="-I`(cd ${with_freetype_incl}; pwd)`"
27 AC_MSG_ERROR([${with_freetype_incl} directory doesn't contain freetype/freetype.h])
32 if test x$cross_compiling = xno; then
33 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_freetype_incl}" = x; then
34 $PKG_CONFIG --exists freetype2 && ac_cv_path_freetype_incl="`$PKG_CONFIG --cflags freetype2`"
38 dnl If the path hasn't been specified, go look for it.
39 if test x"${ac_cv_path_freetype_incl}" = x; then
40 for i in $incllist; do
41 if test -f $i/freetype2/freetype/freetype.h; then
42 ac_cv_path_freetype_incl="-I$i/freetype2"
45 dnl Haiku uses only freetype as the directory, not freetype2
46 if test x"${haiku}" = xyes; then
47 if test -f $i/freetype/freetype/freetype.h; then
48 ac_cv_path_freetype_incl="-I$i/freetype"
54 if test x"${ac_cv_path_freetype_incl}" = x ; then
55 AC_CHECK_HEADERS(freetype2/freetype/freetype.h)
58 AC_MSG_CHECKING([for libfreetype header])
59 if test x"${ac_cv_path_freetype_incl}" != x ; then
67 dnl This check is bogus, ac_cv_path_freetype_incl will have -I too, and possibly multiple things too
68 dnl so at most we can try to *strip* any -I/usr/include
69 if test x"${ac_cv_path_freetype_incl}" != x"/usr/include"; then
70 ac_cv_path_freetype_incl="${ac_cv_path_freetype_incl}"
72 ac_cv_path_freetype_incl=""
75 dnl if test x"${darwin}" = xyes; then
80 AC_ARG_WITH(freetype_lib, AC_HELP_STRING([--with-freetype-lib], [directory where freetype library is]), with_freetype_lib=${withval})
81 AC_CACHE_VAL(ac_cv_path_freetype_lib,[
82 if test x"${with_freetype_lib}" != x ; then
83 if test -f ${with_freetype_lib}/lib${libname}.a -o -f ${with_freetype_lib}/lib${libname}.${shlibext}; then
84 ac_cv_path_freetype_lib="-L`(cd ${with_freetype_lib}; pwd)` -l${libname}"
86 AC_MSG_ERROR([${with_freetype_lib} directory doesn't contain libfreetype.])
91 dnl Look for the library
92 if test x$cross_compiling = xno; then
93 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_freetype_lib}" = x; then
94 $PKG_CONFIG --exists freetype2 && ac_cv_path_freetype_lib="`$PKG_CONFIG --libs freetype2`"
98 dnl If the path hasn't been specified, go look for it.
99 if test x"${ac_cv_path_freetype_lib}" = x; then
100 dnl freetype-config gives us way too many libraries, which create nasty linking
101 dnl dependancy issues, so we strip them off here. The real dependencies are
102 dnl are taken care of by other config tests.
103 AC_MSG_CHECKING([for ${libname} library])
104 for i in $libslist; do
105 if test -f $i/lib${libname}.a -o -f $i/lib${libname}.${shlibext}; then
106 if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
107 ac_cv_path_freetype_lib="-L$i -l${libname}"
108 AC_MSG_RESULT(${ac_cv_path_freetype_lib})
111 ac_cv_path_freetype_lib="-l${libname}"
119 if test x"${ac_cv_path_freetype_incl}" != x ; then
120 FREETYPE2_CFLAGS="${ac_cv_path_freetype_incl}"
125 if test x"${ac_cv_path_freetype_lib}" != x ; then
126 FREETYPE2_LIBS="${ac_cv_path_freetype_lib}"
131 AM_CONDITIONAL(FREETYPE, [test -n "$FREETYPE_LIBS"])
133 if test -n "$FREETYPE2_LIBS"; then
134 AC_DEFINE(USE_FREETYPE, [1], [Define this if you want to enable freetype usage])
137 dnl Look for fontconfig's fc-match to set a hard-coded font path.
138 dnl If fontconfig is available, gnash should always manage to find a
139 dnl suitable system font in run time, so will never need this hard-coded
140 dnl default (unless fontconfig is removed after building gnash, for instance).
141 AC_PATH_PROG(FC_MATCH, fc-match, ,[${pathlist}])
142 if test x"$FC_MATCH" != x; then
143 DEFAULT_FONT="`$FC_MATCH -v 'Sans' | grep '^.file:' | sed 's/\(.*\"\)\(.*\)\(\".*\)/\2/g'`"
146 dnl Hard-coded last resort, which is only likely to work
147 dnl on UNIX-like systems.
148 if test -z "$DEFAULT_FONT"; then
149 DEFAULT_FONT="/usr/share/fonts/truetype/freefont/FreeSans.ttf"
152 AC_DEFINE_UNQUOTED(DEFAULT_FONTFILE, ["$DEFAULT_FONT"], [Path to default font])
154 AC_SUBST(FREETYPE2_CFLAGS)
155 AC_SUBST(FREETYPE2_LIBS)
161 # indent-tabs-mode: nil