Update with current status
[gnash.git] / macros / agg.m4
blob9963b3bab3df3c497f1d14c8e79239bbee93423c
1 dnl  
2 dnl  Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl  2011 Free Software Foundation, Inc.
4 dnl  
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.
9 dnl  
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
19 dnl agg_rasterizer_compound_aa.h is a new file included in AGG 2.4,
20 dnl but not in AGG 2.3. As we need AGG 2.4, we use this as 
21 AC_DEFUN([GNASH_PATH_AGG],
23   dnl Lool for the header
24   AC_ARG_WITH(agg_incl, AC_HELP_STRING([--with-agg-incl], [directory where AGG headers are]), with_agg_incl=${withval})
25   AC_MSG_CHECKING([for AGG headers])
26   AC_CACHE_VAL(ac_cv_path_agg_incl, [
27     if test x"${with_agg_incl}" != x ; then
28       if test -f ${with_agg_incl}/agg_rasterizer_compound_aa.h ; then
29         agg_include_dir="`(cd ${with_agg_incl}; pwd)`"
30         ac_cv_path_agg_incl="-I${agg_include_dir}"
31         agg25=yes
32       else
33         AC_MSG_ERROR([${with_agg_incl} directory doesn't contain any headers])
34         agg25=no
35       fi
36     fi
37   ])
39   if test x$cross_compiling = xno; then
40     if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_agg_incl}" = x; then
41       if $PKG_CONFIG --exists libagg ; then
42         ac_cv_path_agg_incl="`$PKG_CONFIG --cflags libagg`"
43         $PKG_CONFIG --atleast-version 2.5.0 libagg && agg25=yes
45         dnl I think this setting of agg_include_dir is too error prone!
46         agg_include_dir="`$PKG_CONFIG --cflags-only-I libagg | cut -d ' ' -f 1 | sed -e 's/-I//g'`"
47         if test -f $agg_include_dir/agg_gradient_lut.h ; then
48           agg25=yes
49         fi
50       fi
51     fi
52   fi
54   if test x"${ac_cv_path_agg_incl}" = x; then
55     for i in $incllist; do
56       if test -f $i/agg2/agg_gradient_lut.h; then
57         ac_cv_path_agg_incl="-I$i/agg2"
58         agg_include_dir="$i/agg2"
59               agg25=yes
60         break
61       fi
62       dnl Haiku uses only agg as the directory, not agg2
63       if test -f $i/agg/agg_gradient_lut.h; then
64         ac_cv_path_agg_incl="-I$i/agg"
65         agg_include_dir="$i/agg"
66               agg25=yes
67         break
68       fi
69     done
70   fi
72   AC_MSG_RESULT(${ac_cv_path_agg_incl})
74   if test x"${ac_cv_path_agg_incl}" != x ; then
75     AGG_CFLAGS="${ac_cv_path_agg_incl}"
76   fi
78   AC_SUBST(AGG_CFLAGS)
81   dnl Look for the library
82   AC_ARG_WITH(agg_lib, AC_HELP_STRING([--with-agg-lib], [directory where AGG libraries are]), with_agg_lib=${withval})
83   AC_CACHE_VAL(ac_cv_path_agg_lib,[
84     if test x"${with_agg_lib}" != x ; then
85       if test -f ${with_agg_lib}/libagg.a -o -f ${with_agg_lib}/libagg.${shlibext}; then
86         ac_cv_path_agg_lib="-L`(cd ${with_agg_lib}; pwd)`"
87       else
88         AC_MSG_ERROR([${with_agg_lib} directory doesn't contain AGG libraries.])
89       fi
90     fi
91   ])
93   pkg=no
94   if test x$cross_compiling = xno; then
95     if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_agg_lib}" = x; then
96       $PKG_CONFIG --exists libagg && ac_cv_path_agg_lib="`$PKG_CONFIG --libs libagg`"
97       $PKG_CONFIG --exists libagg && pkg=yes
98     fi
99   fi
101   AC_LANG_PUSH(C++)
102   if test x"${ac_cv_path_agg_lib}" = x; then
103     for i in $libslist; do
104       if test -f $i/libagg.a -o -f $i/libagg.${shlibext}; then
105         if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
106           ac_cv_path_agg_lib="-L$i"
107           break
108         else
109           ac_cv_path_agg_lib=""
110           break
111         fi
112       fi
113     done
114   fi
115   
116   if test x"${ac_cv_path_agg_lib}" = x; then
117     AC_CHECK_LIB(agg, agg::gamma_ctrl_impl::calc_points, [ac_cv_path_agg_lib=""])
118   fi
119   AC_MSG_CHECKING([for libagg library])
120   AC_MSG_RESULT(${ac_cv_path_agg_lib})
121   AC_LANG_POP(C++)
123   if test x"${ac_cv_path_agg_lib}" != x -a x"$pkg" = x"yes"; then
124     AGG_LIBS="${ac_cv_path_agg_lib}"
125   else
126     if test x"$agg25" = x"yes"; then
127       AGG_LIBS="${ac_cv_path_agg_lib} -lagg"
128     else
129       AGG_LIBS=""
130     fi     
131   fi
133 dnl   AC_EGREP_HEADER(render_scanlines_compound_layered, 
134 dnl     ${agg_include_dir}/agg_renderer_scanline.h,
135 dnl     [ agg_need_compatibility_layer="no" ],
136 dnl     [ agg_need_compatibility_layer="yes" ] )
138 dnl   AC_SUBST(agg_need_compatibility_layer)
140 dnl   if test x"${agg_need_compatibility_layer}" = xyes; then
141 dnl     AC_DEFINE(HAVE_AGG_SCANLINES_COMPOUND_LAYERED, [0], [AGG headers include the render_scanlines_compound_layered templated function])
142 dnl   else
143 dnl     AC_DEFINE(HAVE_AGG_SCANLINES_COMPOUND_LAYERED, [1], [AGG headers include the render_scanlines_compound_layered templated function])
144 dnl   fi
146   AC_SUBST(AGG_LIBS)
149 # Local Variables:
150 # c-basic-offset: 2
151 # tab-width: 2
152 # indent-tabs-mode: nil
153 # End: