Preliminary, but functional, autotoolsification
[proto.git] / config / glut.m4
blob000214410ce0a4b7d3b39c713f80a5f088fc3429
1 AC_DEFUN([PROTO_WITH_GLUT], [
2     AC_REQUIRE([AX_CHECK_GLUT])
4     AC_ARG_WITH([glut],  dnl funny spacing here gets the output formatting right
5 [AS_HELP_STRING([--with-glut], [use GLUT])
6 AS_HELP_STRING([--without-glut], [do not use GLUT, even if available])],
7                 [use_glut=$withval],
8                 [use_glut=meh])
10     if test "$no_glut" = "yes"; then
11         # no GLUT support
12         case "$use_glut" in
13             yes)
14                 case "$target" in
15                     *-apple-darwin*)
16                         AC_MSG_ERROR([No glut support found; consider --with-apple-opengl-framework])
17                         ;;
18                     *)
19                         AC_MSG_ERROR([No glut support found])
20                         ;;
21                 esac
22                 ;;
23             meh)
24                 WANT_GLUT=false
25                 AC_MSG_WARN([No glut support found])
26                 ;;
27             no)
28                 WANT_GLUT=false # everyone's happy
29                 ;;
30         esac
31     else
32         # GLUT support found
33         case "$use_glut" in
34             yes|meh)
35                 WANT_GLUT=true # everyone's happy
36                 ;;
37             no)
38                 # reset the vars that AX_CHECK_GLUT so carefully discovered
39                 GLUT_LIBS=
40                 GLUT_CFLAGS=
41                 WANT_GLUT=false
42                 ;;
43         esac
44     fi
46     if $WANT_GLUT; then
47         AC_CHECK_HEADERS([windows.h GL/gl.h OpenGL/gl.h])
48     fi
50     AM_CONDITIONAL(WANT_GLUT, $WANT_GLUT)
51     if $WANT_GLUT; then
52         AC_DEFINE([WANT_GLUT], 1,
53                   [Define if you have a GLUT library available])
54     fi
56     # FIXME: only include this for the simulator
57     CFLAGS="${CFLAGS} ${GLUT_CFLAGS}"
58     LIBS="${GLUT_LIBS} ${LIBS}"