summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-04-01 12:02:05 +0200
committerraveit65 <[email protected]>2020-04-03 16:28:59 +0200
commit29e0bc21994b0ff836eac8e669c769dc0aeec526 (patch)
tree21467221c6f9bd63cdb8f3dd70b23f4fe7b55cdb /tools
parentf26fca53e4e394c4271eb91080de0caab6dd5b8f (diff)
downloadmate-session-manager-29e0bc21994b0ff836eac8e669c769dc0aeec526.tar.bz2
mate-session-manager-29e0bc21994b0ff836eac8e669c769dc0aeec526.tar.xz
build: make libglesv2 optional
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am7
-rw-r--r--tools/mate-session-check-accelerated.c18
2 files changed, 21 insertions, 4 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 3948006..92222ff 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,8 +1,7 @@
bin_PROGRAMS = mate-session-save mate-session-inhibit
libexec_PROGRAMS = \
mate-session-check-accelerated \
- mate-session-check-accelerated-gl-helper \
- mate-session-check-accelerated-gles-helper
+ mate-session-check-accelerated-gl-helper
AM_CPPFLAGS = \
$(MATE_SESSION_CFLAGS) \
@@ -31,6 +30,9 @@ mate_session_inhibit_CPPFLAGS = \
mate_session_inhibit_LDADD = \
$(MATE_SESSION_LIBS)
+if HAVE_GLESV2
+libexec_PROGRAMS += mate-session-check-accelerated-gles-helper
+
mate_session_check_accelerated_gles_helper_SOURCES = \
mate-session-check-accelerated-common.h \
mate-session-check-accelerated-gles-helper.c
@@ -46,6 +48,7 @@ mate_session_check_accelerated_gles_helper_LDADD = \
$(GLES_TEST_LIBS) \
$(GTK3_LIBS) \
$(X11_LIBS)
+endif
mate_session_check_accelerated_gl_helper_SOURCES = \
mate-session-check-accelerated-common.h \
diff --git a/tools/mate-session-check-accelerated.c b/tools/mate-session-check-accelerated.c
index 3c0d4bd..d264953 100644
--- a/tools/mate-session-check-accelerated.c
+++ b/tools/mate-session-check-accelerated.c
@@ -21,6 +21,8 @@
* Colin Walters <[email protected]>
*/
+#include <config.h>
+
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
@@ -131,13 +133,17 @@ main (int argc, char **argv)
GdkDisplay *display = NULL;
int estatus;
char *gl_helper_argv[] = { LIBEXECDIR "/mate-session-check-accelerated-gl-helper", "--print-renderer", NULL };
+#ifdef HAVE_GLESV2
char *gles_helper_argv[] = { LIBEXECDIR "/mate-session-check-accelerated-gles-helper", "--print-renderer", NULL };
+ GError *gles_error = NULL;
+ char *gles_renderer_string = NULL;
+#endif
char *renderer_string = NULL;
- char *gl_renderer_string = NULL, *gles_renderer_string = NULL;
+ char *gl_renderer_string = NULL;
gboolean gl_software_rendering = FALSE, gles_software_rendering = FALSE;
Window rootwin;
glong is_accelerated, is_software_rendering;
- GError *gl_error = NULL, *gles_error = NULL;
+ GError *gl_error = NULL;
gtk_init (NULL, NULL);
@@ -241,6 +247,7 @@ main (int argc, char **argv)
g_printerr ("mate-session-check-accelerated: GL Helper exited with code %d\n", estatus);
}
+#ifdef HAVE_GLESV2
/* Then, try the GLES helper */
if (g_spawn_sync (NULL, (char **) gles_helper_argv, NULL, 0,
NULL, NULL, &gles_renderer_string, NULL, &estatus, &gles_error)) {
@@ -253,6 +260,7 @@ main (int argc, char **argv)
g_printerr ("mate-session-check-accelerated: GLES Helper exited with code %d\n", estatus);
}
+#endif
/* If we got here, GL software rendering is our best bet */
if (gl_software_rendering || gles_software_rendering) {
@@ -261,8 +269,10 @@ main (int argc, char **argv)
if (gl_software_rendering)
renderer_string = gl_renderer_string;
+#ifdef HAVE_GLESV2
else if (gles_software_rendering)
renderer_string = gles_renderer_string;
+#endif
goto finish;
}
@@ -273,10 +283,12 @@ main (int argc, char **argv)
g_clear_error (&gl_error);
}
+#ifdef HAVE_GLESV2
if (gles_error != NULL) {
g_printerr ("mate-session-check-accelerated: Failed to run GLES helper: %s\n", gles_error->message);
g_clear_error (&gles_error);
}
+#endif
finish:
if (is_accelerated) {
@@ -306,7 +318,9 @@ main (int argc, char **argv)
gdk_display_sync (display);
g_free (gl_renderer_string);
+#ifdef HAVE_GLESV2
g_free (gles_renderer_string);
+#endif
return is_accelerated ? 0 : 1;
}