AC_SUBST(GMODULE_CFLAGS)
AC_SUBST(GMODULE_LIBS)
+AC_ARG_VAR([GI_GIRDIR],[Set an alternative system location of gir files])
+AC_MSG_CHECKING([for GI_GIRDIR])
+PKG_CHECK_VAR([GI_GIRDIR], [gobject-introspection-1.0], [girdir], [], [AC_MSG_ERROR([Unable to retrieve girdir from gobject-introspection-1.0.pc])])
+AC_MSG_RESULT([$GI_GIRDIR])
+AC_DEFINE_UNQUOTED(GI_GIRDIR, "$GI_GIRDIR", [Define to system location of gir files])
+
AC_ARG_WITH(cgraph, AS_HELP_STRING([--with-cgraph], [Required flag for cross-compilation to define capability of graphviz]), [], with_cgraph=check)
AC_ARG_ENABLE(valadoc, AS_HELP_STRING([--disable-valadoc], [Disable valadoc]), enable_valadoc=$enableval, enable_valadoc=yes)
AS_IF([test "$VALAC" != :], [FOUND_VALAC_VERION=`$VALAC --version | sed 's/Vala *//'`
}
public string? get_gir_path (string gir) {
- return get_file_path (gir + ".gir", "gir-1.0", null, gir_directories);
+ const string GIR_SUFFIX = "gir-1.0";
+ string girname = gir + ".gir";
+ string path = null;
+
+ foreach (unowned string dir in gir_directories) {
+ path = Path.build_path ("/", dir, girname);
+ if (FileUtils.test (path, FileTest.EXISTS | FileTest.IS_REGULAR)) {
+ return path;
+ }
+ }
+
+ // Search $GI_GIR_PATH
+ unowned string? gi_gir_path = Environment.get_variable ("GI_GIR_PATH");
+ if (gi_gir_path != null) {
+ var gir_dirs = gi_gir_path.split (Path.SEARCHPATH_SEPARATOR_S);
+ foreach (unowned string dir in gir_dirs) {
+ path = Path.build_path ("/", dir, girname);
+ if (FileUtils.test (path, FileTest.EXISTS | FileTest.IS_REGULAR)) {
+ return path;
+ }
+ }
+ }
+
+ // Search $XDG_DATA_HOME
+ path = Path.build_path ("/", Environment.get_user_data_dir (), GIR_SUFFIX, girname);
+ if (FileUtils.test (path, FileTest.EXISTS | FileTest.IS_REGULAR)) {
+ return path;
+ }
+
+ // Search $XDG_DATA_DIRS
+ foreach (unowned string dir in Environment.get_system_data_dirs ()) {
+ path = Path.build_path ("/", dir, GIR_SUFFIX, girname);
+ if (FileUtils.test (path, FileTest.EXISTS | FileTest.IS_REGULAR)) {
+ return path;
+ }
+ }
+
+ // Search $GI_GIRDIR set by user or retrieved from gobject-introspection-1.0.pc
+ path = Path.build_path (Config.GI_GIRDIR, girname);
+ if (FileUtils.test (path, FileTest.EXISTS | FileTest.IS_REGULAR)) {
+ return path;
+ }
+
+ // Search /usr/share
+ path = Path.build_path ("/", "usr", "share", GIR_SUFFIX, girname);
+ if (FileUtils.test (path, FileTest.EXISTS | FileTest.IS_REGULAR)) {
+ return path;
+ }
+
+ return null;
}
public string? get_gresource_path (string gresource, string resource) {