-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathopengl.m4
55 lines (48 loc) · 1.47 KB
/
opengl.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
AC_DEFUN([RFX_CHECK_OPENGL],
[
OLDCPPFLAGS="${CPPFLAGS}"
OLDLIBS="${LIBS}"
AC_CHECK_LIB(GL, glBegin)
AC_CHECK_LIB(GLU, gluBeginSurface)
AC_CHECK_LIB(glut, glutInit)
AC_CHECK_HEADERS(GL/gl.h GL/glut.h)
cat > conftest.c << EOF
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
int main(int argc, char*argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(320,200);
glutInitWindowPosition(0,0);
glutCreateWindow("main");
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glShadeModel(GL_SMOOTH);
glEnable (GL_LINE_SMOOTH);
glEnable (GL_POLYGON_SMOOTH);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
glHint (GL_POLYGON_SMOOTH_HINT, GL_DONT_CARE);
}
EOF
AC_MSG_CHECKING([whether we can compile the opengl test program])
ac_link='$CC $CPPFLAGS $CFLAGS conftest.c $LDFLAGS $LIBS -o conftest${ac_exeext}'
if { (eval echo opengl.m4:71: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
AC_MSG_RESULT(yes)
HAVE_OPENGL=1
AC_DEFINE([HAVE_OPENGL], [1], [Defined if opengl is available])
else
echo "configure: failed program was:" >&5
cat conftest.c >&5
HAVE_OPENGL=
AC_MSG_RESULT(no)
fi
rm -f conftest*
# if the above didn't work out, reset all changes to the compiler variables.
if test "x${HAVE_OPENGL}" "!=" "x1"; then
CPPFLAGS=$OLDCPPFLAGS
LIBS=$OLDLIBS
fi
])