Hash :
d4047e1a
Author :
Date :
2008-05-04T03:13:43
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 102 103 104 105 106 107 108 109 110
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 "$no_x" != "yes"; then
GLUT_CFLAGS="$X_CFLAGS"
GLUT_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu $X_EXTRA_LIBS"
fi
if test "$with_glut_inc" != "none"; 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
# Check for GLUT headers
CPPFLAGS="$GLUT_CFLAGS"
AC_CHECK_HEADERS([GL/glut.h], [ac_cv_have_glut=yes],
[AC_CHECK_HEADERS([GLUT/glut.h], [ac_cv_have_glut=yes],
[ac_cv_have_glut=no])])
# Check for GLUT libraries
if test "$ac_cv_have_glut" = "yes"; then
AC_MSG_CHECKING([for GLUT library])
if test "$with_glut_lib" != ""; 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])],
[ac_cv_have_glut=yes],
[ac_cv_have_glut=no])
if test "$ac_cv_have_glut" = "no"; then
# Try again with the GL libs
LIBS="-lglut $GL_LIBS"
AC_LINK_IFELSE(
[AC_LANG_CALL([],[glutInit])],
[ac_cv_have_glut=yes],
[ac_cv_have_glut=no])
fi
if test "$ac_cv_have_glut" = "no" && test "$GLUT_X_LIBS" != ""; then
# Try again with the GL and X11 libs
LIBS="-lglut $GL_LIBS $GLUT_X_LIBS"
AC_LINK_IFELSE(
[AC_LANG_CALL([],[glutInit])],
[ac_cv_have_glut=yes],
[ac_cv_have_glut=no])
fi
if test "$ac_cv_have_glut" = "no"; then
# Try again with GLUT framework
LIBS="-framework GLUT"
AC_LINK_IFELSE(
[AC_LANG_CALL([],[glutInit])],
[ac_cv_have_glut=yes],
[ac_cv_have_glut=no])
fi
if test "$ac_cv_have_glut" = "yes"; then
AC_MSG_RESULT([yes])
GLUT_LIBS="$LIBS"
else
AC_MSG_RESULT([no])
fi
fi
if test "$ac_cv_have_glut" = "no"; then
AC_MSG_WARN([GLUT headers not available, example program won't be compiled.])
fi
AM_CONDITIONAL(HAVE_GLUT, [test "$ac_cv_have_glut" = "yes"])
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=
])