mesa: Upgrade Mesa for Raspberry Pi 4
[AGL/meta-agl.git] / meta-agl-bsp / meta-raspberrypi / recipes-graphics / mesa / mesa-demos / 0003-configure-Allow-to-disable-demos-which-require-GLEW-.patch
1 From 779438770bedf3d53e6ad8f7cd6889b7f50daf3b Mon Sep 17 00:00:00 2001
2 From: Martin Jansa <Martin.Jansa@gmail.com>
3 Date: Wed, 9 Jul 2014 14:23:41 +0200
4 Subject: [PATCH] configure: Allow to disable demos which require GLEW or GLU
5
6 * in some systems without X11 support we don't have GLEW, but
7   mesa-demos are still useful
8
9 Upstream-Status: Pending
10
11 Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
12
13 Port to 8.3.0
14 Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
15 ---
16  configure.ac                  | 49 ++++++++++++++++++++---------
17  src/Makefile.am               | 18 ++++++++---
18  src/demos/Makefile.am         | 73 ++++++++++++++++++++++++-------------------
19  src/egl/Makefile.am           |  8 +++--
20  src/egl/opengles1/Makefile.am | 10 ++++--
21  src/egl/opengles2/Makefile.am | 29 ++++++++---------
22  6 files changed, 117 insertions(+), 70 deletions(-)
23
24 diff --git a/configure.ac b/configure.ac
25 index 0525b09..28834cd 100644
26 --- a/configure.ac
27 +++ b/configure.ac
28 @@ -93,25 +93,44 @@ AC_EGREP_HEADER([glutInitContextProfile],
29                 [AC_DEFINE(HAVE_FREEGLUT)],
30                 [])
31  
32 -dnl Check for GLEW
33 -PKG_CHECK_MODULES(GLEW, [glew >= 1.5.4])
34 -DEMO_CFLAGS="$DEMO_CFLAGS $GLEW_CFLAGS"
35 -DEMO_LIBS="$DEMO_LIBS $GLEW_LIBS"
36 +AC_ARG_ENABLE([glew],
37 +    [AS_HELP_STRING([--enable-glew],
38 +        [build demos which require glew @<:@default=yes@:>@])],
39 +    [enable_glew="$enableval"],
40 +    [enable_glew=yes]
41 +)
42 +
43 +if test "x$enable_glew" = xyes; then
44 +    dnl Check for GLEW
45 +    PKG_CHECK_MODULES(GLEW, [glew >= 1.5.4], [glew_enabled=yes], [glew_enabled=no])
46 +    DEMO_CFLAGS="$DEMO_CFLAGS $GLEW_CFLAGS"
47 +    DEMO_LIBS="$DEMO_LIBS $GLEW_LIBS"
48 +fi
49  
50  # LIBS was set by AC_CHECK_LIB above
51  LIBS=""
52  
53 -PKG_CHECK_MODULES(GLU, [glu], [],
54 -                 [AC_CHECK_HEADER([GL/glu.h],
55 -                                  [],
56 -                                  AC_MSG_ERROR([GLU not found]))
57 -                  AC_CHECK_LIB([GLU],
58 -                               [gluBeginCurve],
59 -                               [GLU_LIBS=-lGLU],
60 -                               AC_MSG_ERROR([GLU required])) ])
61 +AC_ARG_ENABLE([glu],
62 +    [AS_HELP_STRING([--enable-glu],
63 +        [build demos which require glu @<:@default=yes@:>@])],
64 +    [enable_glu="$enableval"],
65 +    [enable_glu=yes]
66 +)
67  
68 -DEMO_CFLAGS="$DEMO_CFLAGS $GLU_CFLAGS"
69 -DEMO_LIBS="$DEMO_LIBS $GLU_LIBS"
70 +if test "x$enable_glu" = xyes; then
71 +    PKG_CHECK_MODULES(GLU, [glu], [glu_enabled=yes],
72 +                     [AC_CHECK_HEADER([GL/glu.h],
73 +                                      [],
74 +                                      AC_MSG_ERROR([GLU not found]))
75 +                      AC_CHECK_LIB([GLU],
76 +                                   [gluBeginCurve],
77 +                                   [GLU_LIBS=-lGLU
78 +                                   glu_enabled=yes],
79 +                                   AC_MSG_ERROR([GLU required])) ])
80 +
81 +    DEMO_CFLAGS="$DEMO_CFLAGS $GLU_CFLAGS"
82 +    DEMO_LIBS="$DEMO_LIBS $GLU_LIBS"
83 +fi
84  
85  AC_ARG_ENABLE([egl],
86      [AS_HELP_STRING([--enable-egl],
87 @@ -304,6 +323,8 @@ AC_SUBST([WAYLAND_CFLAGS])
88  AC_SUBST([WAYLAND_LIBS])
89  
90  
91 +AM_CONDITIONAL(HAVE_GLU, test "x$glu_enabled" = "xyes")
92 +AM_CONDITIONAL(HAVE_GLEW, test "x$glew_enabled" = "xyes")
93  AM_CONDITIONAL(HAVE_EGL, test "x$egl_enabled" = "xyes")
94  AM_CONDITIONAL(HAVE_GLESV1, test "x$glesv1_enabled" = "xyes")
95  AM_CONDITIONAL(HAVE_GLESV2, test "x$glesv2_enabled" = "xyes")
96 diff --git a/src/Makefile.am b/src/Makefile.am
97 index 1647d64..8b89dee 100644
98 --- a/src/Makefile.am
99 +++ b/src/Makefile.am
100 @@ -22,15 +22,19 @@
101  # Authors:
102  #    Eric Anholt <eric@anholt.net>
103  
104 +if HAVE_GLEW
105 +UTIL = util
106 +endif
107 +
108  SUBDIRS = \
109 -       util \
110 +       $(UTIL) \
111         data \
112         demos \
113         egl \
114         fp \
115         fpglsl \
116         glsl \
117 -        gs \
118 +       gs \
119         objviewer \
120         osdemos \
121         perf \
122 @@ -40,8 +44,12 @@ SUBDIRS = \
123         slang \
124         tests \
125         tools \
126 -       trivial \
127 -       vp \
128 -       vpglsl \
129         wgl \
130         xdemos
131 +
132 +if HAVE_GLEW
133 +SUBDIRS += \
134 +       vp \
135 +       vpglsl \
136 +       trivial
137 +endif
138 diff --git a/src/demos/Makefile.am b/src/demos/Makefile.am
139 index 41603fa..ab1e3ab 100644
140 --- a/src/demos/Makefile.am
141 +++ b/src/demos/Makefile.am
142 @@ -30,91 +30,100 @@ AM_LDFLAGS = \
143         $(DEMO_LIBS) \
144         $(GLUT_LIBS)
145  
146 +bin_PROGRAMS =
147 +
148  if HAVE_GLUT
149 -bin_PROGRAMS = \
150 +if HAVE_GLEW
151 +bin_PROGRAMS += \
152         arbfplight \
153         arbfslight \
154         arbocclude \
155         arbocclude2 \
156 -       bounce \
157 -       clearspd \
158         copypix \
159         cubemap \
160         cuberender \
161         dinoshade \
162 -       dissolve \
163 -       drawpix \
164         engine \
165         fbo_firecube \
166         fbotexture \
167 -       fire \
168         fogcoord \
169         fplight \
170         fslight \
171 +       gloss \
172 +       isosurf \
173 +       multiarb \
174 +       paltex \
175 +       pointblast \
176 +       projtex \
177 +       shadowtex \
178 +       spriteblast \
179 +       stex3d \
180 +       textures \
181 +       vao_demo \
182 +       winpos
183 +
184 +copypix_LDADD = ../util/libutil.la
185 +cubemap_LDADD = ../util/libutil.la
186 +cuberender_LDADD = ../util/libutil.la
187 +engine_LDADD = ../util/libutil.la
188 +fbo_firecube_LDADD = ../util/libutil.la
189 +gloss_LDADD = ../util/libutil.la
190 +isosurf_LDADD = ../util/libutil.la
191 +multiarb_LDADD = ../util/libutil.la
192 +projtex_LDADD = ../util/libutil.la
193 +textures_LDADD = ../util/libutil.la
194 +winpos_LDADD = ../util/libutil.la
195 +endif
196 +
197 +if HAVE_GLU
198 +bin_PROGRAMS += \
199 +       bounce \
200 +       clearspd \
201 +       dissolve \
202 +       drawpix \
203 +       fire \
204         gamma \
205         gearbox \
206         gears \
207         geartrain \
208         glinfo \
209 -       gloss \
210         gltestperf \
211         ipers \
212 -       isosurf \
213         lodbias \
214         morph3d \
215 -       multiarb \
216 -       paltex \
217         pixeltest \
218 -       pointblast \
219 -       projtex \
220         ray \
221         readpix \
222         reflect \
223         renormal \
224 -       shadowtex \
225         singlebuffer \
226         spectex \
227 -       spriteblast \
228 -       stex3d \
229         teapot \
230         terrain \
231         tessdemo \
232         texcyl \
233         texenv \
234 -       textures \
235         trispd \
236         tunnel2 \
237 -       tunnel \
238 -       vao_demo \
239 -       winpos
240 -endif
241 +       tunnel
242  
243  tunnel_SOURCES = \
244         tunnel.c \
245         tunneldat.h
246  
247 -copypix_LDADD = ../util/libutil.la
248 -cubemap_LDADD = ../util/libutil.la
249 -cuberender_LDADD = ../util/libutil.la
250 -drawpix_LDADD = ../util/libutil.la
251  dissolve_LDADD = ../util/libutil.la
252 -engine_LDADD = ../util/libutil.la
253 -fbo_firecube_LDADD = ../util/libutil.la
254 +drawpix_LDADD = ../util/libutil.la
255  fire_LDADD = ../util/libutil.la
256 -gloss_LDADD = ../util/libutil.la
257  ipers_LDADD = ../util/libutil.la
258 -isosurf_LDADD = ../util/libutil.la
259  lodbias_LDADD = ../util/libutil.la
260 -multiarb_LDADD = ../util/libutil.la
261 -projtex_LDADD = ../util/libutil.la
262  readpix_LDADD = ../util/libutil.la
263  reflect_LDADD = ../util/libutil.la
264  teapot_LDADD = ../util/libutil.la
265  texcyl_LDADD = ../util/libutil.la
266 -textures_LDADD = ../util/libutil.la
267  tunnel_LDADD = ../util/libutil.la
268  tunnel2_LDADD = ../util/libutil.la
269 -winpos_LDADD = ../util/libutil.la
270 +endif
271 +endif
272  
273  EXTRA_DIST = \
274         README
275 diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
276 index d64a49e..4fe1ca8 100644
277 --- a/src/egl/Makefile.am
278 +++ b/src/egl/Makefile.am
279 @@ -24,8 +24,12 @@
280  
281  SUBDIRS = \
282         eglut \
283 -       opengl \
284 -       openvg \
285         opengles1 \
286         opengles2 \
287         oes_vg
288 +
289 +if HAVE_GLU
290 +SUBDIRS += \
291 +       opengl \
292 +       openvg
293 +endif
294 diff --git a/src/egl/opengles1/Makefile.am b/src/egl/opengles1/Makefile.am
295 index fa397c2..21853e8 100644
296 --- a/src/egl/opengles1/Makefile.am
297 +++ b/src/egl/opengles1/Makefile.am
298 @@ -36,9 +36,12 @@ AM_LDFLAGS = \
299         $(EGL_LIBS) \
300         -lm
301  
302 +noinst_PROGRAMS =
303 +
304  if HAVE_EGL
305  if HAVE_GLESV1
306 -noinst_PROGRAMS = \
307 +if HAVE_X11
308 +bin_PROGRAMS = \
309         bindtex \
310         clear \
311         drawtex_x11 \
312 @@ -52,8 +55,6 @@ noinst_PROGRAMS = \
313         torus_x11 \
314         tri_x11 \
315         two_win
316 -endif
317 -endif
318  
319  bindtex_LDADD = $(X11_LIBS)
320  es1_info_LDADD = $(X11_LIBS)
321 @@ -76,3 +77,6 @@ drawtex_x11_LDADD = ../eglut/libeglut_x11.la
322  gears_x11_LDADD = ../eglut/libeglut_x11.la
323  torus_x11_LDADD = ../eglut/libeglut_x11.la
324  tri_x11_LDADD = ../eglut/libeglut_x11.la
325 +endif
326 +endif
327 +endif
328 diff --git a/src/egl/opengles2/Makefile.am b/src/egl/opengles2/Makefile.am
329 index b80ba50..17f8d49 100644
330 --- a/src/egl/opengles2/Makefile.am
331 +++ b/src/egl/opengles2/Makefile.am
332 @@ -33,27 +33,28 @@ AM_LDFLAGS = \
333         $(EGL_LIBS) \
334         -lm
335  
336 +bin_PROGRAMS =
337 +
338  if HAVE_EGL
339  if HAVE_GLESV2
340 -bin_PROGRAMS =
341 -if HAVE_X11
342 -bin_PROGRAMS += \
343 -       es2_info \
344 -       es2gears_x11 \
345 -       es2tri
346 -endif
347  if HAVE_WAYLAND
348  bin_PROGRAMS += es2gears_wayland
349 -endif
350 -endif
351 +
352 +es2gears_wayland_SOURCES = es2gears.c
353 +es2gears_wayland_LDADD = ../eglut/libeglut_wayland.la
354  endif
355  
356 -es2_info_LDADD = $(X11_LIBS)
357 -es2tri_LDADD = $(X11_LIBS)
358 +if HAVE_X11
359 +bin_PROGRAMS += \
360 +       es2tri \
361 +       es2_info \
362 +       es2gears_x11
363  
364 +es2_info_LDADD = $(X11_LIBS)
365  es2gears_x11_SOURCES = es2gears.c
366 -
367  es2gears_x11_LDADD = ../eglut/libeglut_x11.la
368 +es2tri_LDADD = $(X11_LIBS)
369 +endif
370 +endif
371 +endif
372  
373 -es2gears_wayland_SOURCES = es2gears.c
374 -es2gears_wayland_LDADD = ../eglut/libeglut_wayland.la
375 -- 
376 2.1.4
377