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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
From 0511fc56e7017209ad18d16551ccaad05de9486c Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Mon, 8 May 2017 23:12:49 +0200
Subject: [PATCH] Make EGL support optional
It is perfectly possible to build Mesa3D with just OpenGL support, and
use with GLX in X.org, without having EGL/OpenGLES support.
However, libepoxy currently unconditionally requires EGL support in its
configure.ac, which causes a build failure when Mesa3D only provides
full OpenGL support:
checking for EGL... no
configure: error: Package requirements (egl) were not met:
Package egl was not found in the pkg-config search path.
Perhaps you should add the directory containing `egl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'egl', required by 'world', not found
This commit fixes that by:
- Adjusting the configure.ac to add a --{enable,disable}-egl option
handled in the exact same way as --{enable,disable}-glx
- Adjusting the meson build logic in the same way.
- Adjusting src/dispatch_common.h to define PLATFORM_HAS_EGL correctly,
which allows to not include any EGL related header file if EGL
support is not enabled.
Submitted-upstream: https://github.com/anholt/libepoxy/pull/123
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure.ac | 33 ++++++++++++++++++++++++++++-----
meson.build | 21 ++++++++++++++++++---
meson_options.txt | 5 +++++
src/dispatch_common.h | 8 ++++----
4 files changed, 55 insertions(+), 12 deletions(-)
diff --git a/configure.ac b/configure.ac
index 31b0985..2dbecd9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,11 +88,35 @@ AS_CASE([$enable_glx],
[AC_MSG_ERROR([Invalid value "$enable_glx" for option "--enable-glx"])]
])
-# The remaining platform specific API for GL/GLES are enabled
-# depending on the platform we're building for
+AC_ARG_ENABLE([egl],
+ [AC_HELP_STRING([--enable-egl=@<:@auto,yes,no@:>@], [Enable EGL support @<:@default=auto@:>@])],
+ [enable_egl=$enableval],
+ [enable_egl=auto])
+
+AS_CASE([$enable_egl],
+ [auto], [
+ AS_CASE([$host_os],
+ [mingw*], [build_egl=no],
+ [darwin*], [build_egl=no],
+ [android*], [build_egl=no],
+ [build_egl=yes])
+ ],
+
+ [yes], [
+ build_egl=yes
+ ],
+
+ [no], [
+ build_egl=no
+ ],
+
+ [AC_MSG_ERROR([Invalid value "$enable_egl" for option "--enable-egl"])]
+])
+
+# The remaining platform specific API are enabled depending on the
+# platform we're building for
AS_CASE([$host_os],
[mingw*], [
- build_egl=no
build_wgl=yes
has_znow=yes
# On windows, the DLL has to have all of its functions
@@ -108,7 +132,6 @@ AS_CASE([$host_os],
],
[darwin*], [
- build_egl=no
build_wgl=no
build_apple=yes
has_znow=no
@@ -116,7 +139,6 @@ AS_CASE([$host_os],
],
[
- build_egl=yes
build_wgl=no
has_znow=yes
# On platforms with dlopen, we load everything dynamically and
@@ -131,6 +153,7 @@ AM_CONDITIONAL(BUILD_EGL, test x$build_egl = xyes)
if test x$build_egl = xyes; then
PKG_CHECK_MODULES(EGL, [egl])
AC_DEFINE([BUILD_EGL], [1], [build EGL tests])
+ AC_DEFINE(ENABLE_EGL, [1], [Whether EGL support is enabled])
fi
AM_CONDITIONAL(BUILD_GLX, test x$build_glx = xyes)
diff --git a/meson.build b/meson.build
index 5435f45..226152e 100644
--- a/meson.build
+++ b/meson.build
@@ -51,26 +51,41 @@ elif enable_glx == 'no'
build_glx = false
endif
+enable_egl = get_option('enable-egl')
+if enable_egl == 'auto'
+ if host_system == 'windows'
+ build_egl = false
+ elif host_system == 'darwin'
+ build_egl = false
+ elif host_system == 'android'
+ build_egl = false
+ else
+ build_egl = true
+ endif
+elif enable_egl == 'yes'
+ build_egl = true
+elif enable_egl == 'no'
+ build_egl = false
+endif
+
# The remaining platform specific API for GL/GLES are enabled
# depending on the platform we're building for
if host_system == 'windows'
- build_egl = false
build_apple = false
build_wgl = true
has_znow = true
elif host_system == 'darwin'
- build_egl = false
build_apple = true
build_wgl = false
has_znow = false
else
- build_egl = true
build_apple = false
build_wgl = false
has_znow = true
endif
conf.set10('ENABLE_GLX', build_glx)
+conf.set10('ENABLE_EGL', build_egl)
# Compiler flags, taken from the Xorg macros
if cc.get_id() == 'msvc'
diff --git a/meson_options.txt b/meson_options.txt
index 18932f5..244476a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -6,3 +6,8 @@ option('enable-glx',
choices: [ 'auto', 'yes', 'no' ],
value: 'auto',
description: 'Enable GLX support')
+option('enable-egl',
+ type: 'combo',
+ choices: [ 'auto', 'yes', 'no' ],
+ value: 'auto',
+ description: 'Enable EGL support')
diff --git a/src/dispatch_common.h b/src/dispatch_common.h
index e3277f7..e16771f 100644
--- a/src/dispatch_common.h
+++ b/src/dispatch_common.h
@@ -24,19 +24,19 @@
#include "config.h"
#ifdef _WIN32
-#define PLATFORM_HAS_EGL 0
+#define PLATFORM_HAS_EGL ENABLE_EGL
#define PLATFORM_HAS_GLX ENABLE_GLX
#define PLATFORM_HAS_WGL 1
#elif defined(__APPLE__)
-#define PLATFORM_HAS_EGL 0
+#define PLATFORM_HAS_EGL ENABLE_EGL
#define PLATFORM_HAS_GLX ENABLE_GLX
#define PLATFORM_HAS_WGL 0
#elif defined(ANDROID)
-#define PLATFORM_HAS_EGL 1
+#define PLATFORM_HAS_EGL ENABLE_EGL
#define PLATFORM_HAS_GLX 0
#define PLATFORM_HAS_WGL 0
#else
-#define PLATFORM_HAS_EGL 1
+#define PLATFORM_HAS_EGL ENABLE_EGL
#define PLATFORM_HAS_GLX ENABLE_GLX
#define PLATFORM_HAS_WGL 0
#endif
--
2.7.4
|