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
18 AC_DEFUN([GNASH_PATH_OPENGL],
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)`"
29 AC_MSG_ERROR([${with_opengl_includes} directory doesn't contain GL/gl.h])
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"
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}"
43 if test -f $i/GL/gl.h -o -f $i/OpenGL.h; then
44 if test -f $i/OpenGL.h; then
46 AC_DEFINE(NOT_SGI_GL, [1], [Is not based on the SGI GL])
48 if test x"$i" != x"/usr/include"; then
49 ac_cv_path_opengl_includes="-I$i"
52 ac_cv_path_opengl_includes="default"
55 if test -f $i/GL/glu.h; then
56 AC_MSG_WARN([GL/glu.h not installed!])
63 if test x"${ac_cv_path_opengl_includes}" = x; then
64 AC_CHECK_HEADERS([GL/gl.h], [ac_cv_path_opengl_includes=""])
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}"
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"
81 if test -f ${with_opengl_lib}/libopengl32.a; then
82 ac_cv_path_opengl_lib="-L`(cd ${with_opengl_lib}; pwd)` -lopengl32 -lglu32"
84 AC_MSG_ERROR([${with_opengl_lib} directory doesn't contain libGL.])
90 if test x"${darwin}" = xyes; then
91 ac_cv_path_opengl_lib="-framework Carbon -framework ApplicationServices -framework OpenGL -framework AGL"
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}"
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"
101 ac_cv_path_opengl_lib="-lGL"
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"
110 AC_WARN([No GLU library found!])
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"
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"])
128 if test x"${ac_cv_path_opengl_lib}" != x ; then
129 OPENGL_LIBS="${ac_cv_path_opengl_lib}"
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"
139 AC_SUBST(OPENGL_CFLAGS)
140 AC_SUBST(OPENGL_LIBS)
146 # indent-tabs-mode: nil