Add automated test on delayed return value handling in ExternalInterface.call().
[gnash.git] / macros / opengl.m4
blobedb25201cc34b4234ba0a819cb38e8ec8bd1284a
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
18 AC_DEFUN([GNASH_PATH_OPENGL],
20   opengl=yes
21   if test x"$opengl" = x"yes"; then
22     dnl Look for the headers.
23     AC_ARG_WITH(opengl_includes, AC_HELP_STRING([--with-opengl-includes], [directory where OpenGL headers are]), with_opengl_includes=${withval})
24     AC_CACHE_VAL(ac_cv_path_opengl_includes,[
25       if test x"${with_opengl_includes}" != x ; then
26         if test -f ${with_opengl_includes}/GL/gl.h -a -f ${with_opengl_includes}/GL/glu.h ; then
27           ac_cv_path_opengl_includes="`(cd ${with_opengl_includes}; pwd)`"
28         else
29           AC_MSG_ERROR([${with_opengl_includes} directory doesn't contain GL/gl.h])
30         fi
31       fi
32     ])
34     dnl If the include path hasn't been specified, go look for it.
35     if test x"${darwin}" = xyes; then
36       ac_cv_path_opengl_includes="-framework Carbon -framework ApplicationServices -framework OpenGL -framework AGL -I/System/Library/Frameworks/OpenGL.framework/Headers"
37     else
38       notsgigl=no
39       if test x"${ac_cv_path_opengl_includes}" = x; then
40         AC_MSG_CHECKING([for OpenGL headers])
41         newlist="/System/Library/Frameworks/OpenGL.framework/Headers ${incllist}"
42         for i in $newlist; do
43           if test -f $i/GL/gl.h -o -f $i/OpenGL.h; then
44             if test -f $i/OpenGL.h; then
45               notsgigl=yes
46               AC_DEFINE(NOT_SGI_GL, [1], [Is not based on the SGI GL])
47             fi
48             if test x"$i" != x"/usr/include"; then
49               ac_cv_path_opengl_includes="-I$i"
50               break
51             else
52               ac_cv_path_opengl_includes="default"
53               break
54             fi
55                   if test -f $i/GL/glu.h; then
56                     AC_MSG_WARN([GL/glu.h not installed!])
57                   fi
58           fi
59         done
60       fi
61     fi
63     if test x"${ac_cv_path_opengl_includes}" = x; then
64       AC_CHECK_HEADERS([GL/gl.h], [ac_cv_path_opengl_includes=""])
65     fi
67     if test x"${ac_cv_path_opengl_includes}" != x -a x"${ac_cv_path_opengl_includes}" != x"default"; then
68       OPENGL_CFLAGS="${ac_cv_path_opengl_includes}"
69     else
70       OPENGL_CFLAGS=""
71     fi
72     AC_MSG_RESULT(${ac_cv_path_opengl_includes})
74     dnl Look for the libraries.
75     AC_ARG_WITH(opengl_lib, AC_HELP_STRING([--with-opengl-lib], [directory where OpenGL libraries are]), with_opengl_lib=${withval})
76     AC_CACHE_VAL(ac_cv_path_opengl_lib,[
77       if test x"${with_opengl_lib}" != x ; then
78         if test -f ${with_opengl_lib}/libGL.a -o -f ${with_opengl_lib}/libGL.${shlibext}; then
79           ac_cv_path_opengl_lib="-L`(cd ${with_opengl_lib}; pwd)` -lGL -lGLU"
80         else
81           if test -f ${with_opengl_lib}/libopengl32.a; then
82             ac_cv_path_opengl_lib="-L`(cd ${with_opengl_lib}; pwd)` -lopengl32 -lglu32"
83           else
84             AC_MSG_ERROR([${with_opengl_lib} directory doesn't contain libGL.])
85           fi
86         fi
87       fi
88     ])
90     if test x"${darwin}" = xyes; then
91       ac_cv_path_opengl_lib="-framework Carbon -framework ApplicationServices -framework OpenGL -framework AGL"
92     else
93       if test x"${ac_cv_path_opengl_lib}" = x; then
94         newlist="/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries /System/Library/Frameworks/OpenGL.framework/Libraries ${libslist}"
95         for i in $newlist; do
96           if test -f $i/libGL.${shlibext} -o -f $i/libGL.a; then
97             if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
98               ac_cv_path_opengl_lib="-L$i -lGL"
99               break
100                   else
101               ac_cv_path_opengl_lib="-lGL"
102               break
103                   fi
104           fi
105         done
106         if test x"${ac_cv_path_opengl_lib}" != x; then
107           if test -f $i/libGLU.${shlibext} -o -f $i/libGLU.a; then
108             ac_cv_path_opengl_lib="${ac_cv_path_opengl_lib} -lGLU"
109           else
110             AC_WARN([No GLU library found!])
111           fi
112         else                      dnl nothing found, check for the win32 names
113           for i in $newliblist; do
114             if test -f $i/libopengl32.${shlibext} -o -f $i/libopengl32.a; then
115               ac_cv_path_opengl_lib="-L$i -lopengl32 =lopenglu32"
116               break
117             fi
118           done
119         fi
120       fi                        dnl end of if ac_cv_path_opengl_lib
121     fi                          dnl end of if darwin
122   fi                            dnl end of if $opengl
124   if test x"${ac_cv_path_opengl_lib}" = x; then
125     AC_CHECK_LIB([GL], [glBegin], [ac_cv_path_opengl_lib="-lGL -lGLU"])
126   fi
128   if test x"${ac_cv_path_opengl_lib}" != x ; then
129       OPENGL_LIBS="${ac_cv_path_opengl_lib}"
130       has_opengl="yes"
131   else
132       OPENGL_LIBS=""
133   fi
134   
135   if test x"${darwin}" = xyes; then
136           OPENGL_LIBS="${OPENGL_LIBS} -dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
137   fi
139   AC_SUBST(OPENGL_CFLAGS)
140   AC_SUBST(OPENGL_LIBS)
143 # Local Variables:
144 # c-basic-offset: 2
145 # tab-width: 2
146 # indent-tabs-mode: nil
147 # End: