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