tweak snapshot version for rc2
[gnash.git] / macros / gtkglext.m4
blobabd637e2235ca217e83fac587407b1e0af7875cc
1 dnl  
2 dnl  Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl  2011 Free Software Foundation, Inc.
4 dnl  
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.
9 dnl  
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
19 AC_DEFUN([GNASH_PATH_GLEXT],
21   AC_ARG_ENABLE(glext, AC_HELP_STRING([--disable-glext], [Disable support for GTK OpenGL extension]),
22   [case "${enableval}" in
23     yes) glext=yes ;;
24     no)  glext=no ;;
25     *)   AC_MSG_ERROR([bad value ${enableval} for disable-glext option]) ;;
26   esac], glext=yes)
28 dnl if test x"$plugin" = x"no"; then
29 dnl glext=no
30 dnl fi
32 if test x"$glext" = x"yes"; then
33 dnl Look for the header
34 AC_ARG_WITH(glext_incl, AC_HELP_STRING([--with-glext-incl], [directory where libglext header is]), with_glext_incl=${withval})
35 AC_CACHE_VAL(ac_cv_path_glext_incl,[
36         if test x"${with_glext_incl}" != x ; then
37                 if test -f ${with_glext_incl}/gtk/gtkgl.h ; then
38                         ac_cv_path_glext_incl="-I`(cd ${with_glext_incl}; pwd)`"
39                 else
40                         AC_MSG_ERROR([${with_glext_incl} directory doesnt contain gtk/gtkgl.h])
41                 fi
42         fi     
46 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_glext_incl}" = x; then
47         $PKG_CONFIG --exists gtkglext-1.0 && ac_cv_path_glext_incl="`$PKG_CONFIG --cflags gtkglext-1.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 doesnt seem to get a directory that is unversioned.
53 AC_MSG_CHECKING([for the Gtk GL Extensions Version])
55 if test x"$PKG_CONFIG" != x; then
56         $PKG_CONFIG --exists gtkglext-1.0 && gnash_glext_version="`$PKG_CONFIG --modversion gtkglext-1.0 | cut -d "." -f 1,3`"
59 if test x"${gnash_glext_version}" = x ; then
60         gnash_glext_topdir=""
61         gnash_glext_version=""
62         for i in $incllist; do
63                 for j in `ls -dr $i/gtkglext-[[0-9]].[[0-9]] 2>/dev/null`; do
64                         if test -f $j/gtk/gtkgl.h; then
65                                 gnash_glext_topdir="`basename $j`"
66                                 gnash_glext_version="`echo ${gnash_glext_topdir} | sed -e 's:gtkglext-::'`"
67                                 break
68                         fi
69                 done
70                 if test x$gnash_glext_version != x; then
71                         break;
72                 fi
73         done
76 AC_MSG_RESULT([${gnash_glext_version}])
78 dnl If the path hasnt been specified, go look for it.
79 if test x"${ac_cv_path_glext_incl}" = x; then
80         ac_cv_path_glext_incl=""
81         for i in $incllist; do
82                 if test -f $i/gtk/gtkgl.h; then
83                         if test x"$i" != x"/usr/include"; then
84                                 ac_cv_path_glext_incl="-I$i"
85                                 break
86                         fi
87                 else
88                         if test -f $i/${gnash_glext_topdir}/gtk/gtkgl.h; then
89                                 ac_cv_path_glext_incl="-I$i/${gnash_glext_topdir}"
90                                 break
91                         fi
92                 fi
93         done
95 AC_MSG_CHECKING([for gtk/gtkgl.h])
96 AC_MSG_RESULT([${ac_cv_path_glext_incl}])
98 dnl Look for the library
99 AC_ARG_WITH(glext_lib, AC_HELP_STRING([--with-glext-lib], [directory where gtkglext library is]), with_glext_lib=${withval})
100 AC_CACHE_VAL(ac_cv_path_glext_lib,[
101 if test x"${with_glext_lib}" != x ; then
102         if test -f ${with_glext_lib}/libgtkglext-x11-${gnash_glext_version}.a -o -f ${with_glext_lib}/libgtkglext-x11-${gnash_glext_version}.${shlibext}; then
103                 ac_cv_path_glext_lib="-L`(cd ${with_glext_lib}; pwd)`"
104         else
105                 AC_MSG_ERROR([${with_glext_lib} directory doesnt contain libgtkglext-x11-${gnash_glext_version}.[a|so]])
106         fi
110 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_glext_lib}" = x; then
111         $PKG_CONFIG --exists gtkglext-1.0 && ac_cv_path_glext_lib="`$PKG_CONFIG --libs-only-l gtkglext-1.0`"
114 ac_cv_path_glext_incl_config=""
115 if test x"${ac_cv_path_glext_lib}" = x; then
116         AC_CHECK_LIB(gtkglext-x11-${gnash_glext_version}, gtk_gl_init, [ac_cv_path_glext_lib="-lgtkglext-x11-${gnash_glext_version} -lgdkglext-x11-${gnash_glext_version}"],[
117         for i in $libslist; do
118                 if test -f $i/libgtkglext-x11-${gnash_glext_version}.a -o -f $i/libgtkglext-x11-${gnash_glext_version}.${shlibext}; then
119                 ac_cv_path_glext_incl_config="-I$i/gtkglext-${gnash_glext_version}/include"
120                         if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
121                                 ac_cv_path_glext_lib="-L$i -lgtkglext-x11-${gnash_glext_version} -lgdkglext-x11-${gnash_glext_version}"
122                                 break
123                         fi
124                 else
125                         if test -f $i/libgtkglext-x11-${gnash_glext_version}.a -o -f $i/libgtkglext-x11-${gnash_glext_version}.${shlibext}; then
126                                 ac_cv_path_glext_lib="-L$i/${gnash_glext_topdir} -lgtkglext-x11-${gnash_glext_version} -lgdkglext-x11-${gnash_glext_version}"
127                                 break
128                         fi
129                 fi
130           done
131           ])
133 AC_MSG_CHECKING([for GTK GL library])
134 AC_MSG_RESULT([${ac_cv_path_glext_incl}])
136 fi dnl glext=yes
138 if test x"${ac_cv_path_glext_incl}" != x ; then
139         AC_DEFINE(HAVE_GTK_GTKGL_H, [1], [GTKGLExt header])
140         GLEXT_CFLAGS="${ac_cv_path_glext_incl} ${ac_cv_path_glext_incl_config}"
141 else
142         GLEXT_CFLAGS=""
145 if test x"${ac_cv_path_glext_lib}" != x ; then
146         AC_DEFINE(USE_GTKGLEXT,[1], [Use GtkGLExt extension])
147         GLEXT_LIBS="${ac_cv_path_glext_lib}"
148 else
149         GLEXT_LIBS=""
151         
152 AC_SUBST(GLEXT_CFLAGS)
153 AC_SUBST(GLEXT_LIBS)
156 # Local Variables:
157 # c-basic-offset: 2
158 # tab-width: 2
159 # indent-tabs-mode: nil
160 # End: