[Intel-gfx] [PATCH i-g-t 2/3] configure.ac: Make glib dependency optional to preserve Android build
Paul Kocialkowski
paul.kocialkowski at linux.intel.com
Wed Jul 19 14:58:59 UTC 2017
This adds ifdef wrappers, with matching autoconf macros, to make the
dependency on glib (used for parsing configuration) optional.
This allows preserving the ability to build IGT on Android, where glib
support is lacking.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski at linux.intel.com>
---
configure.ac | 8 +++++++-
lib/igt_core.c | 9 +++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 690f73ef..20e5cf96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,7 +177,10 @@ AM_CONDITIONAL(HAVE_UDEV, [test "x$udev" = xyes])
if test x"$udev" = xyes; then
AC_DEFINE(HAVE_UDEV,1,[Enable udev-based monitor hotplug detection])
fi
-PKG_CHECK_MODULES(GLIB, glib-2.0)
+PKG_CHECK_MODULES(GLIB, [glib-2.0], [glib=yes], [glib=no])
+if test x"$glib" = xyes; then
+ AC_DEFINE(HAVE_GLIB,1,[Enable glib support])
+fi
PKG_CHECK_MODULES(GSL, gsl)
# for chamelium
@@ -190,6 +193,9 @@ if test "x$enable_chamelium" = xyes; then
[AC_MSG_ERROR([Failed to find xmlrpc, required by chamelium. Use --disable-chamelium to disable chamelium support.])])
PKG_CHECK_MODULES(PIXMAN, pixman-1, [],
[AC_MSG_ERROR([Failed to find pixman, required by chamelium. Use --disable-chamelium to disable chamelium support.])])
+ if test x"$glib" != xyes; then
+ AC_MSG_ERROR([Failed to find glib, required by chamelium. Use --disable-chamelium to disable chamelium support.])
+ fi
AC_DEFINE(HAVE_CHAMELIUM, 1, [Enable Chamelium support])
fi
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 5a3b00e8..028ef6bd 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -293,7 +293,10 @@ static struct {
} log_buffer;
static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
+#ifdef HAVE_GLIB
GKeyFile *igt_key_file;
+#endif
+
char *frame_dump_path;
const char *igt_test_name(void)
@@ -618,6 +621,7 @@ static void oom_adjust_for_doom(void)
}
+#ifdef HAVE_GLIB
static int config_parse(void)
{
GError *error = NULL;
@@ -643,6 +647,7 @@ static int config_parse(void)
return 0;
}
+#endif
static int common_init(int *argc, char **argv,
const char *extra_short_opts,
@@ -799,6 +804,7 @@ static int common_init(int *argc, char **argv,
snprintf(key_file_loc, 100, "%s/.igtrc", g_get_home_dir());
}
+#ifdef HAVE_GLIB
igt_key_file = g_key_file_new();
ret = g_key_file_load_from_file(igt_key_file, key_file_loc,
G_KEY_FILE_NONE, &error);
@@ -811,6 +817,7 @@ static int common_init(int *argc, char **argv,
}
ret = config_parse();
+#endif
out:
if (!key_file_env && key_file_loc)
@@ -1423,8 +1430,10 @@ void igt_exit(void)
{
igt_exit_called = true;
+#ifdef HAVE_GLIB
if (igt_key_file)
g_key_file_free(igt_key_file);
+#endif
if (run_single_subtest && !run_single_subtest_found) {
igt_warn("Unknown subtest: %s\n", run_single_subtest);
--
2.13.2
More information about the Intel-gfx
mailing list