1 dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 dnl This library is free software; you can redistribute it and/or
5 dnl modify it under the terms of the GNU Lesser General Public
6 dnl License as published by the Free Software Foundation; either
7 dnl version 2.1 of the License.
9 dnl This library 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 GNU
12 dnl Lesser General Public License for more details.
14 dnl You should have received a copy of the GNU Lesser General Public
15 dnl License along with this library; if not, write to the Free Software
16 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 AC_DEFUN([CHECK_OPENGL],[
23 AC_REQUIRE([AC_PROG_CC])dnl
24 AC_REQUIRE([AC_PROG_CPP])dnl
26 [ --with-opengl=DIR root directory path of OpenGL installation ],
31 dirs="/usr/lib /usr/local/lib /opt/graphics/OpenGL/lib /usr/openwin/lib /usr/X11R6/lib"
34 AC_CHECKING(for OpenGL)
36 AC_SUBST(OGL_INCLUDES)
48 if test "x$local_opengl" = "xyes" ; then
49 if test -f "${opengl_dir}/include/GL/gl.h" ; then
51 OGL_INCLUDES="-I${opengl_dir}/include"
52 OGL_LIBS="-L${opengl_dir}/lib"
53 AC_MSG_RESULT(select OpenGL distribution in ${opengl_dir})
55 AC_MSG_RESULT(no gl.h header file in ${opengl_dir}/include/GL)
59 if test "x$OpenGL_ok" = "xno"
61 AC_CHECK_HEADERS(GL/gl.h, [OpenGL_ok=yes])
64 if test "x$OpenGL_ok" = "xno"
67 AC_CHECK_HEADERS(/usr/openwin/share/include/GL/glxmd.h,
69 OGL_INCLUDES="-I/usr/openwin/share/include/")
72 if test "x$OpenGL_ok" = "xno"
75 AC_CHECK_HEADERS(/opt/graphics/OpenGL/include/GL/glxmd.h,
77 OGL_INCLUDES="-I/opt/graphics/OpenGL/include")
79 if test "x$OpenGL_ok" = "xno"
81 # some linux OpenGL servers hide the includes in /usr/X11R6/include/GL
82 AC_CHECK_HEADERS(/usr/X11R6/include/GL/gl.h,
84 OGL_INCLUDES="-I/usr/X11R6/include")
87 if test "x$OpenGL_ok" = "xyes"
89 AC_CHECKING(for OpenGL library)
92 if test -r "$i/libGL.so"; then
93 dnl AC_MSG_RESULT(in $i)
98 if test -r "$i/libGL.sl"; then
99 dnl AC_MSG_RESULT(in $i)
104 LDFLAGS_old="$LDFLAGS"
105 LDFLAGS="$LDFLAGS $OGL_LIBS"
106 AC_CHECK_LIB(GL,glBegin,OpenGL_ok=yes,OpenGL_ok=no)
107 LDFLAGS="$LDFLAGS_old"
110 if test "x$OpenGL_ok" = "xyes" ; then
111 OGL_LIBS="$OGL_LIBS -lGL"
116 LDFLAGS_old="$LDFLAGS"
117 LDFLAGS="$LDFLAGS $OGL_LIBS"
118 AC_CHECK_LIB(GLU,gluBeginSurface,OpenGLU_ok=yes,OpenGLU_ok=no)
119 LDFLAGS="$LDFLAGS_old"
121 if test "x$OpenGLU_ok" = "xyes" ; then
122 OGL_LIBS="$OGL_LIBS -lGLU"