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
25 AC_REQUIRE([AC_LINKER_OPTIONS])dnl
31 [AC_HELP_STRING([--with-opengl=DIR],[root directory path of OpenGL installation])],
32 [opengl_dir="$withval"],
33 [dirs="/usr/lib${LIB_LOCATION_SUFFIX} /usr/local/lib${LIB_LOCATION_SUFFIX} /opt/graphics/OpenGL/lib${LIB_LOCATION_SUFFIX} /usr/openwin/lib${LIB_LOCATION_SUFFIX} /usr/X11R6/lib${LIB_LOCATION_SUFFIX}"])dnl
35 AC_CHECKING(for OpenGL)
36 AC_CHECKING(for OpenGL headers)
50 if test "x${opengl_dir}" != "x" ; then
51 AC_MSG_RESULT(for opengl_dir: $opengl_dir)
52 AC_CHECK_HEADER([${opengl_dir}/include/GL/gl.h],
53 [OpenGL_headers_ok=yes; OGL_INCLUDES="-I${opengl_dir}/include"],
54 [OpenGL_headers_ok=no])
55 if test "x${OpenGL_headers_ok}" = "xyes" ; then
56 AC_CHECKING(for default OpenGL library)
57 if test "x${opengl_dir}" = "x/usr" ; then
60 OGL_LIBS="-L${opengl_dir}/lib"
62 LDFLAGS_old="$LDFLAGS"
63 LDFLAGS="$LDFLAGS $OGL_LIBS"
68 if test "x${OpenGL_libs_ok}" = "xyes" ; then
71 [OpenGL_libs_ok=yes ; OpenGL_ok=yes; OGL_LIBS="$OGL_LIBS -lGL"],
74 LDFLAGS="$LDFLAGS_old"
78 if test "x${OpenGL_headers_ok}" = "xno" ; then
79 AC_CHECK_HEADER(GL/gl.h,
80 [OpenGL_headers_ok=yes],
81 [OpenGL_headers_ok=no])
85 if test "x${OpenGL_headers_ok}" = "xno" ; then
86 AC_CHECK_HEADERS(/usr/openwin/share/include/GL/glxmd.h,
87 [OpenGL_headers_ok=yes; OGL_INCLUDES="-I/usr/openwin/share/include/"],
88 [OpenGL_headers_ok=no])
92 if test "x${OpenGL_headers_ok}" = "xno" ; then
93 AC_CHECK_HEADERS(/opt/graphics/OpenGL/include/GL/glxmd.h,
94 [OpenGL_headers_ok=yes; OGL_INCLUDES="-I/opt/graphics/OpenGL/include"],
95 [OpenGL_headers_ok=no])
98 # some linux OpenGL servers hide the includes in /usr/X11R6/include/GL
99 if test "x${OpenGL_headers_ok}" = "xno" ; then
100 AC_CHECK_HEADERS(/usr/X11R6/include/GL/gl.h,
101 [OpenGL_headers_ok=yes; OGL_INCLUDES="-I/usr/X11R6/include"],
102 [OpenGL_headers_ok=no])
105 if test "x${OpenGL_headers_ok}" = "xyes" ; then
106 AC_CHECKING(for OpenGL library)
107 for idir in $dirs; do
108 if test -r "${idir}/libGL.so"; then
109 AC_MSG_RESULT(in ${idir})
110 if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then
113 GL_LIB_PATH="-L${idir}"
118 if test -r "${idir}/libGL.sl"; then
119 AC_MSG_RESULT(in ${idir})
120 if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then
123 GL_LIB_PATH="-L${idir}"
128 LDFLAGS_old="${LDFLAGS}"
129 LDFLAGS="${LDFLAGS} ${GL_LIB_PATH}"
132 [OpenGL_libs_ok=yes],
134 if test "x${OpenGL_libs_ok}" = "xyes" ; then
137 [OpenGL_libs_ok=yes ; OGL_LIBS="${OGL_LIBS} ${GL_LIB_PATH} -lGL"],
140 LDFLAGS="$LDFLAGS_old"
143 if test "x${OpenGL_libs_ok}" = "xyes" ; then
144 for idir in $dirs; do
145 if test -r "${idir}/libGLU.so"; then
146 AC_MSG_RESULT(in ${idir})
147 if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then
150 GLU_LIB_PATH="-L${idir}"
155 if test -r "${idir}/libGLU.sl"; then
156 AC_MSG_RESULT(in ${idir})
157 if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then
160 GLU_LIB_PATH="-L${idir}"
165 LDFLAGS_old="${LDFLAGS}"
166 LDFLAGS="${LDFLAGS} ${OGL_LIBS} ${GLU_LIB_PATH}"
169 [OpenGL_libs_ok=yes],
171 if test "x${OpenGL_libs_ok}" = "xyes" ; then
174 [OpenGL_libs_ok=yes ; OGL_LIBS="${OGL_LIBS} ${GLU_LIB_PATH} -lGLU"],
177 LDFLAGS="$LDFLAGS_old"
180 if test "x${OpenGL_headers_ok}" = "xyes" ; then
181 if test "x${OpenGL_libs_ok}" = "xyes" ; then
186 AC_MSG_RESULT(for OpenGL_headers_ok: $OpenGL_headers_ok)
187 AC_MSG_RESULT(for OpenGL_libs_ok: $OpenGL_libs_ok)
188 AC_MSG_RESULT(for OpenGL_ok: $OpenGL_ok)
190 AC_SUBST(OGL_INCLUDES)