2 dnl Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
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.
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],
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)`"
28 AC_MSG_ERROR([${with_opengl_includes} directory doesn't contain GL/gl.h])
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"
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}"
42 if test -f $i/GL/gl.h -o -f $i/OpenGL.h; then
43 if test -f $i/OpenGL.h; then
45 AC_DEFINE(NOT_SGI_GL, [1], [Is not based on the SGI GL])
47 if test x"$i" != x"/usr/include"; then
48 ac_cv_path_opengl_includes="-I$i"
51 ac_cv_path_opengl_includes="default"
54 if test -f $i/GL/glu.h; then
55 AC_MSG_WARN([GL/glu.h not installed!])
62 if test x"${ac_cv_path_opengl_includes}" = x; then
63 AC_CHECK_HEADERS([GL/gl.h], [ac_cv_path_opengl_includes=""])
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}"
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"
80 if test -f ${with_opengl_lib}/libopengl32.a; then
81 ac_cv_path_opengl_lib="-L`(cd ${with_opengl_lib}; pwd)` -lopengl32 -lglu32"
83 AC_MSG_ERROR([${with_opengl_lib} directory doesn't contain libGL.])
89 if test x"${darwin}" = xyes; then
90 ac_cv_path_opengl_lib="-framework Carbon -framework ApplicationServices -framework OpenGL -framework AGL"
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}"
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"
100 ac_cv_path_opengl_lib="-lGL"
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"
109 AC_WARN([No GLU library found!])
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"
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"])
127 if test x"${ac_cv_path_opengl_lib}" != x ; then
128 OPENGL_LIBS="${ac_cv_path_opengl_lib}"
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"
138 AC_SUBST(OPENGL_CFLAGS)
139 AC_SUBST(OPENGL_LIBS)
145 # indent-tabs-mode: nil