2 dnl Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl 2011 Free Software Foundation, Inc.
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.
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
20 AC_DEFUN([GNASH_PATH_GTK2],
23 if test x"$windows" = x"yes"; then
24 gtklib="libgtk-win32-2.0"
25 gdklib="libgdk-win32-2.0"
27 gtklib="libgtk-x11-2.0"
28 gdklib="libgdk-x11-2.0"
31 dnl Look for the header
32 AC_ARG_WITH(gtk2_incl, AC_HELP_STRING([--with-gtk2-incl], [directory where libgtk2 header is]), with_gtk2_incl=${withval})
33 AC_CACHE_VAL(ac_cv_path_gtk2_incl,[
34 if test x"${with_gtk2_incl}" != x ; then
35 if test -f ${with_gtk2_incl}/gtk/gtk.h; then
36 ac_cv_path_gtk2_incl="-I`(cd ${with_gtk2_incl}; pwd)`"
38 AC_MSG_ERROR([${with_gtk2_incl} directory doesn't contain gtk/gtk.h])
44 if test x$cross_compiling = xno; then
45 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_gtk2_incl}" = x; then
46 $PKG_CONFIG --exists gtk+-2.0 && ac_cv_path_gtk2_incl="`$PKG_CONFIG --cflags gtk+-2.0`"
47 $PKG_CONFIG --exists gtk+-2.0 && gnash_gtk2_version="`$PKG_CONFIG --modversion gtk+-2.0`"
51 dnl Attempt to find the top level directory, which unfortunately has a
52 dnl version number attached. At least on Debain based systems, this
53 dnl doesn't seem to get a directory that is unversioned.
55 AC_MSG_CHECKING([for the gtk2 header])
56 if test x"${gnash_gtk2_version}" = x; then
59 for i in $incllist; do
60 for j in `ls -dr $i/gtk-[[2-9]].[[0-9]] 2>/dev/null`; do
61 if test -f $j/gtk/gtk.h; then
62 gnash_gtk2_topdir="`basename $j`"
63 gnash_gtk2_version="`echo ${gnash_gtk2_topdir} | sed -e 's:gtk-::'`"
64 ac_cv_path_gtk2_incl="-I$i/${gnash_gtk2_topdir}"
68 if test x$gnash_gtk2_version != x; then
73 if test x"${ac_cv_path_gtk2_incl}" = x; then
74 AC_MSG_RESULT([not found, trying again])
75 AC_CHECK_HEADERS(gtk/gtk.h)
77 AC_MSG_RESULT($ac_cv_path_gtk2_incl)
80 dnl Look for the library
82 AC_HELP_STRING([--with-gtk2-lib], [directory where gtk2 library is]),
83 with_gtk2_lib=${withval})
85 AC_CACHE_VAL(ac_cv_path_gtk2_lib,[
86 if test x"${with_gtk2_lib}" != x ; then
87 if test -f ${with_gtk2_lib}/${gtklib}.${shlibext} -o -f ${with_gtk2_lib}/${gtklib}.a; then
88 if test -f ${with_gtk2_lib}/${gdklib}.${shlibext} -o -f ${with_gtk2_lib}/${gdklib}.a; then
89 ac_cv_path_gtk2_lib="-I`(cd ${with_gtk2_lib}; pwd)`"
91 AC_MSG_ERROR([${with_gtk2_lib} directory doesn't contain ${gdklib}.${shlibext}])
94 AC_MSG_ERROR([${with_gtk2_lib} directory doesn't contain ${gtklib}.${shlibext}])
99 if test x$cross_compiling = xno; then
100 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_gtk2_lib}" = x; then
101 $PKG_CONFIG --exists gtk+-2.0 && ac_cv_path_gtk2_lib="`$PKG_CONFIG --libs-only-l gtk+-2.0`"
105 dnl If the header doesn't exist, there is no point looking for
107 AC_MSG_CHECKING([for libgtk2 library])
108 if test x"${ac_cv_path_gtk2_incl}" != x -a x"${ac_cv_path_gtk2_lib}" = x; then
109 for i in $libslist; do
110 if test -f $i/${gtklib}.a -o -f $i/${gtklib}.${shlibext}; then
111 if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
112 if test x"$windows" = x"yes"; then
113 ac_cv_path_gtk2_lib="-L$i -lgtk-win32-2.0 -lgdk-win32-2.0 -lgobject-2.0 -lgmodule-2.0"
115 ac_cv_path_gtk2_lib="-L$i -lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0 -lgmodule-2.0"
119 if test x"$windows" = x"yes"; then
120 ac_cv_path_gtk2_lib="-lgtk-win32-2.0 -lgdk-win32-2.0 -lgobject-2.0 -lgmodule-2.0 "
122 ac_cv_path_gtk2_lib="-lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0 -lgmodule-2.0 "
130 if test x"${ac_cv_path_gtk2_lib}" = x; then
131 if test x"$windows" = x"yes"; then
132 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"])
134 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"])
137 AC_MSG_RESULT($ac_cv_path_gtk2_lib)
139 if test x"${ac_cv_path_gtk2_incl}" != x; then
140 for i in $libslist; do
141 if test -f $i/gtk-${gnash_gtk2_version}/include/gdkconfig.h; then
142 GTK2_CFLAGS="-I${i}/gtk-${gnash_gtk2_version}/include"
146 if test x"${ac_cv_path_gtk2_incl}" = x"yes"; then
147 GTK2_CFLAGS="$GTK2_CFLAGS"
149 GTK2_CFLAGS="${ac_cv_path_gtk2_incl} $GTK2_CFLAGS"
151 AC_DEFINE([HAVE_GTK2], [1], [Use GTK2 for windowing])
156 if test x"${ac_cv_path_gtk2_lib}" != x ; then
157 GTK2_LIBS="${ac_cv_path_gtk2_lib}"
164 AC_SUBST(GTK2_CFLAGS)
171 # indent-tabs-mode: nil