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 if test "x${opengl_dir}" = "x/usr"
56 OGL_LIBS="-L${opengl_dir}/lib"
58 AC_MSG_RESULT(select OpenGL distribution in ${opengl_dir})
60 AC_MSG_RESULT(no gl.h header file in ${opengl_dir}/include/GL)
64 if test "x$OpenGL_ok" = "xno"
66 AC_CHECK_HEADERS(GL/gl.h, [OpenGL_ok=yes])
69 if test "x$OpenGL_ok" = "xno"
72 AC_CHECK_HEADERS(/usr/openwin/share/include/GL/glxmd.h,
74 OGL_INCLUDES="-I/usr/openwin/share/include/")
77 if test "x$OpenGL_ok" = "xno"
80 AC_CHECK_HEADERS(/opt/graphics/OpenGL/include/GL/glxmd.h,
82 OGL_INCLUDES="-I/opt/graphics/OpenGL/include")
84 if test "x$OpenGL_ok" = "xno"
86 # some linux OpenGL servers hide the includes in /usr/X11R6/include/GL
87 AC_CHECK_HEADERS(/usr/X11R6/include/GL/gl.h,
89 OGL_INCLUDES="-I/usr/X11R6/include")
92 if test "x$OpenGL_ok" = "xyes"
94 AC_CHECKING(for OpenGL library)
97 if test -r "$i/libGL.so"; then
98 dnl AC_MSG_RESULT(in $i)
99 if test "x$i" = "x/usr/lib"
108 if test -r "$i/libGL.sl"; then
109 dnl AC_MSG_RESULT(in $i)
110 if test "x$i" = "x/usr/lib"
119 LDFLAGS_old="$LDFLAGS"
120 LDFLAGS="$LDFLAGS $OGL_LIBS"
121 AC_CHECK_LIB(GL,glBegin,OpenGL_ok=yes,OpenGL_ok=no)
122 LDFLAGS="$LDFLAGS_old"
125 if test "x$OpenGL_ok" = "xyes" ; then
126 OGL_LIBS="$OGL_LIBS -lGL"
131 LDFLAGS_old="$LDFLAGS"
132 LDFLAGS="$LDFLAGS $OGL_LIBS"
133 AC_CHECK_LIB(GLU,gluBeginSurface,OpenGLU_ok=yes,OpenGLU_ok=no)
134 LDFLAGS="$LDFLAGS_old"
136 if test "x$OpenGLU_ok" = "xyes" ; then
137 OGL_LIBS="$OGL_LIBS -lGLU"