don't build the Framebuffer GUI for BSD when --enable-gui=all is used
[gnash.git] / macros / gtkglext.m4
blobffa8eec6d82d8811f64c3085d8922364d1e31c1a
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_GLEXT],
20   AC_ARG_ENABLE(glext, AC_HELP_STRING([--disable-glext], [Disable support for GTK OpenGL extension]),
21   [case "${enableval}" in
22     yes) glext=yes ;;
23     no)  glext=no ;;
24     *)   AC_MSG_ERROR([bad value ${enableval} for disable-glext option]) ;;
25   esac], glext=yes)
27 dnl if test x"$plugin" = x"no"; then
28 dnl glext=no
29 dnl fi
31 if test x"$glext" = x"yes"; then
32 dnl Look for the header
33 AC_ARG_WITH(glext_incl, AC_HELP_STRING([--with-glext-incl], [directory where libglext header is]), with_glext_incl=${withval})
34 AC_CACHE_VAL(ac_cv_path_glext_incl,[
35         if test x"${with_glext_incl}" != x ; then
36                 if test -f ${with_glext_incl}/gtk/gtkgl.h ; then
37                         ac_cv_path_glext_incl="-I`(cd ${with_glext_incl}; pwd)`"
38                 else
39                         AC_MSG_ERROR([${with_glext_incl} directory doesnt contain gtk/gtkgl.h])
40                 fi
41         fi     
45 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_glext_incl}" = x; then
46         $PKG_CONFIG --exists gtkglext-1.0 && ac_cv_path_glext_incl="`$PKG_CONFIG --cflags gtkglext-1.0`"
49 dnl Attempt to find the top level directory, which unfortunately has a
50 dnl version number attached. At least on Debain based systems, this
51 dnl doesnt seem to get a directory that is unversioned.
52 AC_MSG_CHECKING([for the Gtk GL Extensions Version])
54 if test x"$PKG_CONFIG" != x; then
55         $PKG_CONFIG --exists gtkglext-1.0 && gnash_glext_version="`$PKG_CONFIG --modversion gtkglext-1.0 | cut -d "." -f 1,3`"
58 if test x"${gnash_glext_version}" = x ; then
59         gnash_glext_topdir=""
60         gnash_glext_version=""
61         for i in $incllist; do
62                 for j in `ls -dr $i/gtkglext-[[0-9]].[[0-9]] 2>/dev/null`; do
63                         if test -f $j/gtk/gtkgl.h; then
64                                 gnash_glext_topdir="`basename $j`"
65                                 gnash_glext_version="`echo ${gnash_glext_topdir} | sed -e 's:gtkglext-::'`"
66                                 break
67                         fi
68                 done
69                 if test x$gnash_glext_version != x; then
70                         break;
71                 fi
72         done
75 AC_MSG_RESULT([${gnash_glext_version}])
77 dnl If the path hasnt been specified, go look for it.
78 if test x"${ac_cv_path_glext_incl}" = x; then
79         ac_cv_path_glext_incl=""
80         for i in $incllist; do
81                 if test -f $i/gtk/gtkgl.h; then
82                         if test x"$i" != x"/usr/include"; then
83                                 ac_cv_path_glext_incl="-I$i"
84                                 break
85                         fi
86                 else
87                         if test -f $i/${gnash_glext_topdir}/gtk/gtkgl.h; then
88                                 ac_cv_path_glext_incl="-I$i/${gnash_glext_topdir}"
89                                 break
90                         fi
91                 fi
92         done
94 AC_MSG_CHECKING([for gtk/gtkgl.h])
95 AC_MSG_RESULT([${ac_cv_path_glext_incl}])
97 dnl Look for the library
98 AC_ARG_WITH(glext_lib, AC_HELP_STRING([--with-glext-lib], [directory where gtkglext library is]), with_glext_lib=${withval})
99 AC_CACHE_VAL(ac_cv_path_glext_lib,[
100 if test x"${with_glext_lib}" != x ; then
101         if test -f ${with_glext_lib}/libgtkglext-x11-${gnash_glext_version}.a -o -f ${with_glext_lib}/libgtkglext-x11-${gnash_glext_version}.${shlibext}; then
102                 ac_cv_path_glext_lib="-L`(cd ${with_glext_lib}; pwd)`"
103         else
104                 AC_MSG_ERROR([${with_glext_lib} directory doesnt contain libgtkglext-x11-${gnash_glext_version}.[a|so]])
105         fi
109 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_glext_lib}" = x; then
110         $PKG_CONFIG --exists gtkglext-1.0 && ac_cv_path_glext_lib="`$PKG_CONFIG --libs-only-l gtkglext-1.0`"
113 ac_cv_path_glext_incl_config=""
114 if test x"${ac_cv_path_glext_lib}" = x; then
115         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}"],[
116         for i in $libslist; do
117                 if test -f $i/libgtkglext-x11-${gnash_glext_version}.a -o -f $i/libgtkglext-x11-${gnash_glext_version}.${shlibext}; then
118                 ac_cv_path_glext_incl_config="-I$i/gtkglext-${gnash_glext_version}/include"
119                         if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
120                                 ac_cv_path_glext_lib="-L$i -lgtkglext-x11-${gnash_glext_version} -lgdkglext-x11-${gnash_glext_version}"
121                                 break
122                         fi
123                 else
124                         if test -f $i/libgtkglext-x11-${gnash_glext_version}.a -o -f $i/libgtkglext-x11-${gnash_glext_version}.${shlibext}; then
125                                 ac_cv_path_glext_lib="-L$i/${gnash_glext_topdir} -lgtkglext-x11-${gnash_glext_version} -lgdkglext-x11-${gnash_glext_version}"
126                                 break
127                         fi
128                 fi
129           done
130           ])
132 AC_MSG_CHECKING([for GTK GL library])
133 AC_MSG_RESULT([${ac_cv_path_glext_incl}])
135 fi dnl glext=yes
137 if test x"${ac_cv_path_glext_incl}" != x ; then
138         AC_DEFINE(HAVE_GTK_GTKGL_H, [1], [GTKGLExt header])
139         GLEXT_CFLAGS="${ac_cv_path_glext_incl} ${ac_cv_path_glext_incl_config}"
140 else
141         GLEXT_CFLAGS=""
144 if test x"${ac_cv_path_glext_lib}" != x ; then
145         AC_DEFINE(USE_GTKGLEXT,[1], [Use GtkGLExt extension])
146         GLEXT_LIBS="${ac_cv_path_glext_lib}"
147 else
148         GLEXT_LIBS=""
150         
151 AC_SUBST(GLEXT_CFLAGS)
152 AC_SUBST(GLEXT_LIBS)
155 # Local Variables:
156 # c-basic-offset: 2
157 # tab-width: 2
158 # indent-tabs-mode: nil
159 # End: