0001-select-platforms-based-on-configuration-results.patch 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. From 7eff2bf8e27599c1c94217b2bb1b73d4b7d18e59 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
  3. Date: Wed, 6 May 2015 10:45:22 +0200
  4. Subject: [PATCH 1/4] select platforms based on configuration results
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
  9. Fetched from pull #81 on github for libepoxy:
  10. https://github.com/anholt/libepoxy/pull/81/commits
  11. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  12. ---
  13. configure.ac | 13 +++++--------
  14. src/dispatch_common.c | 9 ++++++---
  15. src/dispatch_common.h | 9 +++++----
  16. 3 files changed, 16 insertions(+), 15 deletions(-)
  17. diff --git a/configure.ac b/configure.ac
  18. index 2d67726..225ab73 100644
  19. --- a/configure.ac
  20. +++ b/configure.ac
  21. @@ -58,6 +58,10 @@ AC_CHECK_HEADER([KHR/khrplatform.h],
  22. # uintptr_t to a void *") by default. Kill that.
  23. XORG_TESTSET_CFLAG(CWARNFLAGS, [-Wno-int-conversion])
  24. +PKG_CHECK_MODULES(X11, [x11], [x11=yes], [x11=no])
  25. +
  26. +AM_CONDITIONAL(HAVE_X11, test x$x11 = xyes)
  27. +
  28. has_znow=yes
  29. case $host_os in
  30. @@ -86,7 +90,7 @@ case $host_os in
  31. ;;
  32. *)
  33. build_egl=yes
  34. - build_glx=yes
  35. + build_glx=$x11
  36. build_wgl=no
  37. # On platforms with dlopen, we load everything dynamically and
  38. # don't link against a specific window system or GL implementation.
  39. @@ -144,13 +148,6 @@ esac
  40. AC_SUBST([VISIBILITY_CFLAGS])
  41. -PKG_CHECK_MODULES(X11, [x11], [x11=yes], [x11=no])
  42. -if test x$x11 = xno -a x$build_glx = xyes; then
  43. - AC_MSG_ERROR([libX11 headers (libx11-dev) required to build with GLX support])
  44. -fi
  45. -
  46. -AM_CONDITIONAL(HAVE_X11, test x$x11 = xyes)
  47. -
  48. PKG_CHECK_MODULES(GL, [gl], [gl=yes], [gl=no])
  49. AC_CONFIG_FILES([
  50. diff --git a/src/dispatch_common.c b/src/dispatch_common.c
  51. index 013027f..163d348 100644
  52. --- a/src/dispatch_common.c
  53. +++ b/src/dispatch_common.c
  54. @@ -656,10 +656,13 @@ epoxy_get_proc_address(const char *name)
  55. #elif defined(__APPLE__)
  56. return epoxy_gl_dlsym(name);
  57. #else
  58. +#if PLATFORM_HAS_GLX
  59. if (epoxy_current_context_is_glx()) {
  60. return glXGetProcAddressARB((const GLubyte *)name);
  61. - } else {
  62. + } else
  63. +#endif /* PLATFORM_HAS_GLX */
  64. #if PLATFORM_HAS_EGL
  65. + {
  66. GLenum egl_api = epoxy_egl_get_current_gl_context_api();
  67. switch (egl_api) {
  68. @@ -669,10 +672,10 @@ epoxy_get_proc_address(const char *name)
  69. case EGL_NONE:
  70. break;
  71. }
  72. -#endif
  73. }
  74. +#endif /* PLATFORM_HAS_EGL */
  75. errx(1, "Couldn't find current GLX or EGL context.\n");
  76. -#endif
  77. +#endif /* _WIN32 | __APPLE__*/
  78. }
  79. WRAPPER_VISIBILITY (void)
  80. diff --git a/src/dispatch_common.h b/src/dispatch_common.h
  81. index 676a4d5..2728b45 100644
  82. --- a/src/dispatch_common.h
  83. +++ b/src/dispatch_common.h
  84. @@ -21,12 +21,13 @@
  85. * IN THE SOFTWARE.
  86. */
  87. +#include <config.h>
  88. #include <stdbool.h>
  89. #ifdef _WIN32
  90. #define PLATFORM_HAS_EGL 0
  91. #define PLATFORM_HAS_GLX 0
  92. -#define PLATFORM_HAS_WGL 1
  93. +#define PLATFORM_HAS_WGL BUILD_WGL
  94. #define EPOXY_IMPORTEXPORT __declspec(dllexport)
  95. #elif defined(__APPLE__)
  96. #define PLATFORM_HAS_EGL 0
  97. @@ -34,13 +35,13 @@
  98. #define PLATFORM_HAS_WGL 0
  99. #define EPOXY_IMPORTEXPORT
  100. #elif defined(ANDROID)
  101. -#define PLATFORM_HAS_EGL 1
  102. +#define PLATFORM_HAS_EGL BUILD_EGL
  103. #define PLATFORM_HAS_GLX 0
  104. #define PLATFORM_HAS_WGL 0
  105. #define EPOXY_IMPORTEXPORT
  106. #else
  107. -#define PLATFORM_HAS_EGL 1
  108. -#define PLATFORM_HAS_GLX 1
  109. +#define PLATFORM_HAS_EGL BUILD_EGL
  110. +#define PLATFORM_HAS_GLX BUILD_GLX
  111. #define PLATFORM_HAS_WGL 0
  112. #define EPOXY_IMPORTEXPORT
  113. #endif