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