1From bb0ffae7164d296d32da24fa5499534de259169a Mon Sep 17 00:00:00 2001
2From: Spenser Gilliland <spenser@gillilanding.com>
3Date: Sat, 24 Feb 2018 11:36:17 +0100
4Subject: [PATCH] demos: makes opengl an optional component
5
6Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
7[Romain: convert to git patch, rebase on 8.4.0]
8Signed-off-by: Romain Naour <romain.naour@gmail.com>
9---
10 configure.ac               | 12 +++++++++++-
11 src/egl/opengl/Makefile.am |  2 ++
12 src/util/Makefile.am       |  2 ++
13 3 files changed, 15 insertions(+), 1 deletion(-)
14
15diff --git a/configure.ac b/configure.ac
16index 0b5e9a76..24298c44 100644
17--- a/configure.ac
18+++ b/configure.ac
19@@ -51,6 +51,14 @@ m4_ifndef([PKG_PROG_PKG_CONFIG],
20   ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
21 PKG_PROG_PKG_CONFIG()
22
23+AC_ARG_ENABLE([gl],
24+    [AS_HELP_STRING([--enable-gl],
25+        [enable GL library @<:@default=no@:>@])],
26+    [gl_enabled="$enableval"],
27+    [gl_enabled=auto])
28+
29+if test "x$gl_enabled" != "xno"; then
30+
31 dnl Get the pkg-config definitions for libGL.  We include a fallback
32 dnl path for GL implementation that don't provide a .pc file
33 PKG_CHECK_MODULES(GL, [gl], [], [
34@@ -112,6 +120,8 @@ PKG_CHECK_MODULES(GLU, [glu], [],
35 DEMO_CFLAGS="$DEMO_CFLAGS $GLU_CFLAGS"
36 DEMO_LIBS="$DEMO_LIBS $GLU_LIBS"
37
38+fi
39+
40 AC_ARG_ENABLE([egl],
41     [AS_HELP_STRING([--enable-egl],
42         [enable EGL library @<:@default=auto@:>@])],
43@@ -302,7 +312,7 @@ AC_SUBST([MESA_GLAPI])
44 AC_SUBST([WAYLAND_CFLAGS])
45 AC_SUBST([WAYLAND_LIBS])
46
47-
48+AM_CONDITIONAL(HAVE_GL, test "x$gl_enabled" = "xyes")
49 AM_CONDITIONAL(HAVE_EGL, test "x$egl_enabled" = "xyes")
50 AM_CONDITIONAL(HAVE_GLESV1, test "x$glesv1_enabled" = "xyes")
51 AM_CONDITIONAL(HAVE_GLESV2, test "x$glesv2_enabled" = "xyes")
52diff --git a/src/egl/opengl/Makefile.am b/src/egl/opengl/Makefile.am
53index 6d184ff6..219ab850 100644
54--- a/src/egl/opengl/Makefile.am
55+++ b/src/egl/opengl/Makefile.am
56@@ -56,6 +56,7 @@ endif
57 endif
58
59 if HAVE_EGL
60+if HAVE_GL
61 bin_PROGRAMS = \
62 	eglinfo
63 noinst_PROGRAMS = \
64@@ -64,6 +65,7 @@ noinst_PROGRAMS = \
65 	$(EGL_X11_DEMOS) \
66 	$(EGL_WL_DEMOS)
67 endif
68+endif
69
70 egltri_x11_SOURCES = egltri.c
71 eglgears_x11_SOURCES = eglgears.c
72diff --git a/src/util/Makefile.am b/src/util/Makefile.am
73index 759a293a..012b9c75 100644
74--- a/src/util/Makefile.am
75+++ b/src/util/Makefile.am
76@@ -27,7 +27,9 @@ AM_CFLAGS = \
77 AM_LDFLAGS = \
78 	$(DEMO_LIBS)
79
80+if HAVE_GL
81 noinst_LTLIBRARIES = libutil.la
82+endif
83
84 if HAVE_GLUT
85 AM_CFLAGS += \
86--
872.14.3
88
89