Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. # LOL_CHECK_OPENGL()
  2. # ------------------
  3. AC_DEFUN([LOL_CHECK_OPENGL],
  4. [
  5. dnl Find which version of OpenGL to use
  6. ac_cv_my_have_gl="no"
  7. ac_cv_my_stop_looking_for_gl="no"
  8. if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
  9. LIBS_save="$LIBS"
  10. LIBS="$LIBS -Wl,-framework -Wl,OpenGL"
  11. AC_MSG_CHECKING(for -framework OpenGL)
  12. AC_TRY_LINK([], [],
  13. [AC_MSG_RESULT(yes)
  14. ac_cv_my_have_gl="yes"
  15. GL_LIBS="${GL_LIBS} -framework OpenGL"
  16. LOL_TRY_CXXFLAGS(-ObjC++, [CXXFLAGS="${CXXFLAGS} -ObjC++"])
  17. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available)],
  18. [AC_MSG_RESULT(no)])
  19. LIBS="$LIBS_save"
  20. fi
  21. if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
  22. LIBS_save="$LIBS"
  23. LIBS="$LIBS -Wl,-framework -Wl,OpenGLES"
  24. AC_MSG_CHECKING(for -framework OpenGLES)
  25. AC_TRY_LINK([], [],
  26. [AC_MSG_RESULT(yes)
  27. ac_cv_my_have_gl="yes"
  28. GL_LIBS="${GL_LIBS} -framework OpenGLES"
  29. LOL_TRY_CXXFLAGS(-ObjC++, [CXXFLAGS="${CXXFLAGS} -ObjC++"])
  30. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)],
  31. [AC_MSG_RESULT(no)])
  32. LIBS="$LIBS_save"
  33. fi
  34. dnl Use the Raspberry Pi libraries?
  35. if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
  36. AC_CHECK_HEADERS(bcm_host.h,
  37. [AC_CHECK_LIB(vcos, main,
  38. [ac_cv_my_have_gl="yes"
  39. ac_cv_my_stop_looking_for_gl="yes"
  40. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  41. dnl FIXME: -lEGL does not belong here but the configure test fails
  42. dnl when cross-compiling, so we add it manually here.
  43. GL_LIBS="${GL_LIBS} -lGLESv2 -lEGL -lvcos -lvchiq_arm -lbcm_host"])])
  44. fi
  45. dnl Use the PS3 PSGL?
  46. if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
  47. AC_CHECK_HEADERS(PSGL/psgl.h,
  48. [ac_cv_my_have_gl="yes"
  49. ac_cv_my_stop_looking_for_gl="yes"])
  50. fi
  51. if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
  52. PKG_CHECK_MODULES(GLES2, glesv2,
  53. [ac_cv_my_have_gl="yes"
  54. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  55. GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
  56. GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
  57. [:])
  58. fi
  59. if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
  60. AC_CHECK_HEADER(GLES2/gl2.h,
  61. [ac_cv_my_have_gl="yes"
  62. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  63. AC_CHECK_LIB(GLESv2, glEnable,
  64. [GL_LIBS="${GL_LIBS} -lGLESv2"])])
  65. fi
  66. if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
  67. PKG_CHECK_MODULES(GL, gl,
  68. [ac_cv_my_have_gl="yes"
  69. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available)],
  70. [:])
  71. fi
  72. if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
  73. AC_CHECK_LIB(GL, glEnable,
  74. [ac_cv_my_have_gl="yes"
  75. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
  76. GL_LIBS="-lGL"])
  77. fi
  78. if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
  79. AC_CHECK_HEADER(GL/gl.h,
  80. [LIBS_save="$LIBS"
  81. LIBS="$LIBS -lopengl32"
  82. AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
  83. AC_TRY_LINK([#include <GL/gl.h>],
  84. [glLoadIdentity();],
  85. [ac_cv_my_have_gl="yes"
  86. AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
  87. AC_MSG_RESULT(yes)
  88. GL_LIBS="-lopengl32"],
  89. [AC_MSG_RESULT(no)])
  90. LIBS="$LIBS_save"])
  91. fi
  92. dnl Use Glew?
  93. ac_cv_my_have_glew="no"
  94. PKG_CHECK_MODULES(GLEW, glew,
  95. [ac_cv_my_have_glew="yes"
  96. GL_CFLAGS="${GLEW_CFLAGS} ${GL_CFLAGS}"
  97. GL_LIBS="${GLEW_LIBS} ${GL_LIBS}"],
  98. [:])
  99. AC_CHECK_HEADER(glew.h,
  100. [LIBS_save="${LIBS}"
  101. LIBS="${LIBS} -lglew32s ${GL_LIBS}"
  102. AC_MSG_CHECKING(for glewInit in -lglew32s)
  103. AC_TRY_LINK(
  104. [#include <glew.h>],
  105. [glewInit();],
  106. [ac_cv_my_have_glew="yes"
  107. GL_LIBS="-lglew32s ${GL_LIBS}"
  108. AC_MSG_RESULT(yes)],
  109. [AC_MSG_RESULT(no)])
  110. LIBS="${LIBS_save}"])
  111. if test "${ac_cv_my_have_glew}" != "no"; then
  112. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  113. AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
  114. fi
  115. AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
  116. dnl Poor man's GL feature detection if all else failed.
  117. save_LIBS="${LIBS}"
  118. LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
  119. AC_CHECK_FUNCS(glBegin)
  120. LIBS="${save_LIBS}"
  121. dnl Warn if we couldn't find an OpenGL-like API
  122. if test "${ac_cv_my_have_gl}" = "no"; then
  123. AC_MSG_WARN([[No OpenGL or OpenGL ES implementation found]])
  124. fi
  125. ])# LOL_CHECK_OPENGL