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. if test "${ac_cv_my_have_gl}" = "no"; then
  93. AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
  94. fi
  95. dnl Use Glew?
  96. ac_cv_my_have_glew="no"
  97. PKG_CHECK_MODULES(GLEW, glew,
  98. [ac_cv_my_have_glew="yes"
  99. GL_CFLAGS="${GLEW_CFLAGS} ${GL_CFLAGS}"
  100. GL_LIBS="${GLEW_LIBS} ${GL_LIBS}"],
  101. [:])
  102. AC_CHECK_HEADER(glew.h,
  103. [LIBS_save="${LIBS}"
  104. LIBS="${LIBS} -lglew32s ${GL_LIBS}"
  105. AC_MSG_CHECKING(for glewInit in -lglew32s)
  106. AC_TRY_LINK(
  107. [#include <glew.h>],
  108. [glewInit();],
  109. [ac_cv_my_have_glew="yes"
  110. GL_LIBS="-lglew32s ${GL_LIBS}"
  111. AC_MSG_RESULT(yes)],
  112. [AC_MSG_RESULT(no)])
  113. LIBS="${LIBS_save}"])
  114. if test "${ac_cv_my_have_glew}" != "no"; then
  115. AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
  116. AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
  117. fi
  118. AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")
  119. dnl Poor man's GL feature detection if all else failed.
  120. save_LIBS="${LIBS}"
  121. LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
  122. AC_CHECK_FUNCS(glBegin)
  123. LIBS="${save_LIBS}"
  124. ])# LOL_CHECK_OPENGL