Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/gnash
[gnash.git] / macros / pango.m4
blob31e7456bbac5f5ded24f2b7e935f4c6de0714e3e
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 AC_DEFUN([GNASH_PATH_PANGO],
21   dnl Look for the header
22   AC_ARG_WITH(pango_incl, AC_HELP_STRING([--with-pango-incl], [directory where libpango header is]), with_pango_incl=${withval})
23   AC_CACHE_VAL(ac_cv_path_pango_incl,[
24     if test x"${with_pango_incl}" != x ; then
25       if test -f ${with_pango_incl}/pango/pango.h ; then
26         ac_cv_path_pango_incl="-I`(cd ${with_pango_incl}; pwd)`"
27       else
28         AC_MSG_ERROR([${with_pango_incl} directory doesn't contain pango/pango.h])
29       fi
30     fi
31   ])
33   if test x$windows = xyes; then
34     pango_pkg=pangowin32
35   else
36     pango_pkg=pangox
37   fi
39   if test x$cross_compiling = xno; then
40     if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_pango_incl}" = x; then
41       $PKG_CONFIG --exists $pango_pkg && ac_cv_path_pango_incl="`$PKG_CONFIG --cflags $pango_pkg`"
42     fi
43   fi
45   dnl Attempt to find the top level directory, which unfortunately has a
46   dnl version number attached. At least on Debain based systems, this
47   dnl doesn't seem to get a directory that is unversioned.
49   AC_MSG_CHECKING([for the Pango Version])
51   if test x$cross_compiling = xno; then
52     if test x"$PKG_CONFIG" != x; then
53       $PKG_CONFIG --exists $pango_pkg && gnash_pango_version=`$PKG_CONFIG --modversion $pango_pkg | cut -d "." -f 1 | awk '{print $'0'".0"}'`
54     fi
55   fi
57   if test x"${gnash_pango_version}" = x; then
58     gnash_pango_topdir=""
59     gnash_pango_version=""
60     for i in $incllist; do
61       for j in `ls -dr $i/pango-[[0-9]].[[0-9]] 2>/dev/null`; do
62         if test -f $j/pango/pango.h; then
63           gnash_pango_topdir=`basename $j`
64           gnash_pango_version=`echo ${gnash_pango_topdir} | sed -e 's:pango-::'`
65           ac_cv_path_pango_incl="-I$i/${gnash_pango_topdir}"
66           break
67         fi
68       done
69         if test x$gnash_pango_version != x; then
70           break;
71         fi
72     done
73   fi      
75   if test x"${gnash_pango_version}" = x; then
76     AC_MSG_RESULT(none)
77   else
78     AC_MSG_RESULT([${gnash_pango_version}])
79   fi
80   
81   AC_MSG_CHECKING([for libpango header])
82   AC_MSG_RESULT(${ac_cv_path_pango_incl}) 
84   dnl Look for the library
85   AC_ARG_WITH(pango_lib, AC_HELP_STRING([--with-pango-lib], [directory where pango library is]), with_pango_lib=${withval})
86   AC_CACHE_VAL(ac_cv_path_pango_lib,[
87     if test x"${with_pango_lib}" != x ; then
88       if test -f ${with_pango_lib}/libpangox-${gnash_pango_version}.a -o -f ${with_pango_lib}/libpangox-${gnash_pango_version}.${shlibext} -o -f ${with_pango_lib}/libpangox-${gnash_pango_version}.${shlibext}.a; then
89         ac_cv_path_pango_lib=-L`(cd ${with_pango_lib}; pwd)`
90       else
91         AC_MSG_ERROR([${with_pango_lib} directory doesn't contain libpango.])
92       fi
93     fi
94   ])
95   
96   if test x$cross_compiling = xno; then
97     if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_pango_lib}" = x; then
98       $PKG_CONFIG --exists $pango_pkg && ac_cv_path_pango_lib=`$PKG_CONFIG --libs-only-l $pango_pkg`
99     fi
100   fi
102   if test x"${ac_cv_path_pango_lib}" = x; then
103     for i in $libslist; do
104       if test -f $i/libpango-${gnash_pango_version}.a -o -f $i/libpango-${gnash_pango_version}.${shlibext} -o -f $i/libpango-${gnash_pango_version}.${shlibext}.a; then
105         if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
106           ac_cv_path_pango_lib="-L$i -lpango-${gnash_pango_version}"
107           break
108         else
109           ac_cv_path_pango_lib="-lpango-${gnash_pango_version}"
110           break
111         fi
112       fi
113     done
114   fi
115         
116   AC_MSG_CHECKING([for libpango library])
117   AC_MSG_RESULT(${ac_cv_path_pango_lib})
118   
119   if test x"${ac_cv_path_pango_lib}" = x; then
120     AC_CHECK_LIB(pango-${gnash_pango_version}, pango_engine_shape_class_init, [ac_cv_path_pango_lib="-lpango-${gnash_pango_version}"])
121   fi
123   if test x"${ac_cv_path_pango_incl}" != x; then
124     PANGO_CFLAGS="${ac_cv_path_pango_incl}"
125   else
126     PANGO_CFLAGS=""
127   fi
129   if test x"${ac_cv_path_pango_lib}" != x; then
130     PANGO_LIBS="${ac_cv_path_pango_lib}"
131   else
132     PANGO_LIBS=""
133   fi
135   AC_SUBST(PANGO_CFLAGS)
136   AC_SUBST(PANGO_LIBS)
139 # Local Variables:
140 # c-basic-offset: 2
141 # tab-width: 2
142 # indent-tabs-mode: nil
143 # End: