process Invoke messages from the standalone player. GetURL and FSCommand now also...
[gnash.git] / macros / gtk2.m4
blob6f6aa04fb0275df8a4316f15f2d8bffbca014d64
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
19 AC_DEFUN([GNASH_PATH_GTK2],
22 if test x"$windows" = x"yes"; then
23   gtklib="libgtk-win32-2.0"
24   gdklib="libgdk-win32-2.0"
25 else
26   gtklib="libgtk-x11-2.0"
27   gdklib="libgdk-x11-2.0"
30   dnl Look for the header
31   AC_ARG_WITH(gtk2_incl, AC_HELP_STRING([--with-gtk2-incl], [directory where libgtk2 header is]), with_gtk2_incl=${withval})
32     AC_CACHE_VAL(ac_cv_path_gtk2_incl,[
33     if test x"${with_gtk2_incl}" != x ; then
34       if test -f ${with_gtk2_incl}/gtk/gtk.h; then
35         ac_cv_path_gtk2_incl="-I`(cd ${with_gtk2_incl}; pwd)`"
36       else
37         AC_MSG_ERROR([${with_gtk2_incl} directory doesn't contain gtk/gtk.h])
38       fi
39     fi
40   ])
43   if test x$cross_compiling = xno; then
44     if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_gtk2_incl}" = x; then
45       $PKG_CONFIG --exists gtk+-2.0 && ac_cv_path_gtk2_incl="`$PKG_CONFIG --cflags gtk+-2.0`"
46       $PKG_CONFIG --exists gtk+-2.0 && gnash_gtk2_version="`$PKG_CONFIG --modversion gtk+-2.0`"
47     fi
48   fi
50   dnl Attempt to find the top level directory, which unfortunately has a
51   dnl version number attached. At least on Debain based systems, this
52   dnl doesn't seem to get a directory that is unversioned.
54   AC_MSG_CHECKING([for the gtk2 header])
55   if test x"${gnash_gtk2_version}" = x; then
56     gnash_gtk2_topdir=""
57     gnash_gtk2_version=""
58     for i in $incllist; do
59       for j in `ls -dr $i/gtk-[[2-9]].[[0-9]] 2>/dev/null`; do
60         if test -f $j/gtk/gtk.h; then
61           gnash_gtk2_topdir="`basename $j`"
62           gnash_gtk2_version="`echo ${gnash_gtk2_topdir} | sed -e 's:gtk-::'`"
63           ac_cv_path_gtk2_incl="-I$i/${gnash_gtk2_topdir}"
64           break
65         fi
66       done
67       if test x$gnash_gtk2_version != x; then
68         break;
69       fi
70     done
71   fi
72   if test x"${ac_cv_path_gtk2_incl}" = x; then
73     AC_MSG_RESULT([not found, trying again])
74     AC_CHECK_HEADERS(gtk/gtk.h)
75   else
76     AC_MSG_RESULT($ac_cv_path_gtk2_incl)
77   fi
79   dnl Look for the library
80   AC_ARG_WITH(gtk2_lib,
81         AC_HELP_STRING([--with-gtk2-lib], [directory where gtk2 library is]),
82         with_gtk2_lib=${withval})
84     AC_CACHE_VAL(ac_cv_path_gtk2_lib,[
85     if test x"${with_gtk2_lib}" != x ; then
86       if test -f ${with_gtk2_lib}/${gtklib}.${shlibext} -o -f ${with_gtk2_lib}/${gtklib}.a; then
87         if test -f ${with_gtk2_lib}/${gdklib}.${shlibext} -o -f ${with_gtk2_lib}/${gdklib}.a; then
88                 ac_cv_path_gtk2_lib="-I`(cd ${with_gtk2_lib}; pwd)`"
89         else
90                 AC_MSG_ERROR([${with_gtk2_lib} directory doesn't contain ${gdklib}.${shlibext}])
91         fi
92       else
93         AC_MSG_ERROR([${with_gtk2_lib} directory doesn't contain ${gtklib}.${shlibext}])
94       fi
95     fi
96   ])
98   if test x$cross_compiling = xno; then
99     if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_gtk2_lib}" = x; then
100       $PKG_CONFIG --exists gtk+-2.0 && ac_cv_path_gtk2_lib="`$PKG_CONFIG --libs-only-l gtk+-2.0`"
101     fi
102   fi
104 dnl If the header doesn't exist, there is no point looking for
105 dnl the library. 
106   AC_MSG_CHECKING([for libgtk2 library])
107   if test x"${ac_cv_path_gtk2_incl}" != x -a x"${ac_cv_path_gtk2_lib}" = x; then
108     for i in $libslist; do
109       if test -f $i/${gtklib}.a -o -f $i/${gtklib}.${shlibext}; then
110         if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
111           if test x"$windows" = x"yes"; then
112             ac_cv_path_gtk2_lib="-L$i -lgtk-win32-2.0 -lgdk-win32-2.0 -lgobject-2.0 -lgmodule-2.0"
113           else
114             ac_cv_path_gtk2_lib="-L$i -lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0 -lgmodule-2.0"
115           fi
116           break
117         else
118           if test x"$windows" = x"yes"; then
119             ac_cv_path_gtk2_lib="-lgtk-win32-2.0 -lgdk-win32-2.0 -lgobject-2.0 -lgmodule-2.0 "
120           else
121             ac_cv_path_gtk2_lib="-lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0 -lgmodule-2.0 "
122           fi
123           break
124         fi
125       fi
126     done
127   fi
129   if test x"${ac_cv_path_gtk2_lib}" = x; then
130     if test x"$windows" = x"yes"; then
131       AC_CHECK_LIB([gtk-win32-2.0], [gtk_init], [ac_cv_path_gtk2_lib="-lgtk-win32-2.0 -lgdk-win32-2.0 -lgobject-2.0 -lgmodule-2.0"])
132     else
133       AC_CHECK_LIB([gtk-x11-2.0], [gtk_init], [ac_cv_path_gtk2_lib="-lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0 -lgmodule-2.0"])
134     fi
135   fi
136   AC_MSG_RESULT($ac_cv_path_gtk2_lib)
138   if test x"${ac_cv_path_gtk2_incl}" != x; then
139     for i in $libslist; do
140       if test -f $i/gtk-${gnash_gtk2_version}/include/gdkconfig.h; then
141          GTK2_CFLAGS="-I${i}/gtk-${gnash_gtk2_version}/include"
142          break
143       fi
144     done
145     if test x"${ac_cv_path_gtk2_incl}" = x"yes"; then
146       GTK2_CFLAGS="$GTK2_CFLAGS"
147     else
148       GTK2_CFLAGS="${ac_cv_path_gtk2_incl} $GTK2_CFLAGS"
149     fi
150     AC_DEFINE([HAVE_GTK2], [1], [Use GTK2 for windowing])
151   else
152     GTK2_CFLAGS=""
153   fi
155   if test x"${ac_cv_path_gtk2_lib}" != x ; then
156     GTK2_LIBS="${ac_cv_path_gtk2_lib}"
157     has_gtk2=yes
158   else
159     GTK2_LIBS=""
160     has_gtk2=no
161   fi
163   AC_SUBST(GTK2_CFLAGS)
164   AC_SUBST(GTK2_LIBS)
167 # Local Variables:
168 # c-basic-offset: 2
169 # tab-width: 2
170 # indent-tabs-mode: nil
171 # End: