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