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