Hash :
9f978b91
Author :
Date :
2008-04-04T12:21:46
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
dnl FTGL_CHECK_GLUT()
dnl Check for GLUT development environment
dnl
AC_DEFUN([FTGL_CHECK_GLUT],
[dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PATH_X])dnl
AC_REQUIRE([AC_PATH_XTRA])dnl
AC_REQUIRE([FTGL_CHECK_GL])dnl
AC_ARG_WITH([--with-glut-inc],
AC_HELP_STRING([--with-glut-inc=DIR],[Directory where GL/glut.h is installed (optional)]))
AC_ARG_WITH([--with-glut-lib],
AC_HELP_STRING([--with-glut-lib=DIR],[Directory where GLUT libraries are installed (optional)]))
AC_LANG_SAVE
AC_LANG_C
GLUT_SAVE_CPPFLAGS="$CPPFLAGS"
GLUT_SAVE_LIBS="$LIBS"
if test "x$no_x" != xyes ; then
GLUT_CFLAGS="$X_CFLAGS"
GLUT_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu $X_EXTRA_LIBS"
fi
if test "x$with_glut_inc" != "xnone" ; then
if test -d "$with_glut_inc" ; then
GLUT_CFLAGS="-I$with_glut_inc"
else
GLUT_CFLAGS="$with_glut_inc"
fi
else
GLUT_CFLAGS=
fi
CPPFLAGS="$GLUT_CFLAGS"
AC_CHECK_HEADER([GL/glut.h], [HAVE_GLUT=yes], [HAVE_GLUT=no])
AM_CONDITIONAL(HAVE_GLUT, [test "$HAVE_GLUT" = "yes"])
if test "x$HAVE_GLUT" = xno ; then
AC_MSG_WARN([GLUT headers not availabe, example program won't be compiled.])
else
# Check for GLUT libraries
AC_MSG_CHECKING([for GLUT library])
if test "x$with_glut_lib" != "x" ; then
if test -d "$with_glut_lib" ; then
LIBS="-L$with_glut_lib -lglut"
else
LIBS="$with_glut_lib"
fi
else
LIBS="-lglut"
fi
AC_LINK_IFELSE(
[AC_LANG_CALL([],[glutInit])],
[HAVE_GLUT=yes],
[HAVE_GLUT=no])
if test "x$HAVE_GLUT" = xno ; then
# Try again with the GL libs
LIBS="-lglut $GL_LIBS"
AC_LINK_IFELSE(
[AC_LANG_CALL([],[glutInit])],
[HAVE_GLUT=yes],
[HAVE_GLUT=no])
fi
if test "x$HAVE_GLUT" = xno && test "x$GLUT_X_LIBS" != x ; then
# Try again with the GL and X11 libs
LIBS="-lglut $GL_LIBS $GLUT_X_LIBS"
AC_LINK_IFELSE(
[AC_LANG_CALL([],[glutInit])],
[HAVE_GLUT=yes],
[HAVE_GLUT=no])
fi
if test "x$HAVE_GLUT" = xyes ; then
AC_MSG_RESULT([yes])
GLUT_LIBS=$LIBS
else
AC_MSG_RESULT([no])
AC_MSG_WARN([GLUT libraries not availabe, example program won't be compiled.])
fi
# End check for GLUT libraries
fi
AC_SUBST(HAVE_GLUT)
AC_SUBST(GLUT_CFLAGS)
AC_SUBST(GLUT_LIBS)
AC_LANG_RESTORE
CPPFLAGS="$GLUT_SAVE_CPPFLAGS"
LIBS="$GLUT_SAVE_LIBS"
GLUT_X_CFLAGS=
GLUT_X_LIBS=
])