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
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"
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)`"
37 AC_MSG_ERROR([${with_gtk2_incl} directory doesn't contain gtk/gtk.h])
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`"
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
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}"
67 if test x$gnash_gtk2_version != x; then
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)
76 AC_MSG_RESULT($ac_cv_path_gtk2_incl)
79 dnl Look for the library
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)`"
90 AC_MSG_ERROR([${with_gtk2_lib} directory doesn't contain ${gdklib}.${shlibext}])
93 AC_MSG_ERROR([${with_gtk2_lib} directory doesn't contain ${gtklib}.${shlibext}])
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`"
104 dnl If the header doesn't exist, there is no point looking for
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"
114 ac_cv_path_gtk2_lib="-L$i -lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0 -lgmodule-2.0"
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 "
121 ac_cv_path_gtk2_lib="-lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0 -lgmodule-2.0 "
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"])
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"])
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"
145 if test x"${ac_cv_path_gtk2_incl}" = x"yes"; then
146 GTK2_CFLAGS="$GTK2_CFLAGS"
148 GTK2_CFLAGS="${ac_cv_path_gtk2_incl} $GTK2_CFLAGS"
150 AC_DEFINE([HAVE_GTK2], [1], [Use GTK2 for windowing])
155 if test x"${ac_cv_path_gtk2_lib}" != x ; then
156 GTK2_LIBS="${ac_cv_path_gtk2_lib}"
163 AC_SUBST(GTK2_CFLAGS)
170 # indent-tabs-mode: nil