Commit d1d9eb17 authored by Jehan's avatar Jehan

configure: GLIB_COMPILE_RESOURCES is wrong when cross-compiling.

AM_PATH_GLIB_2_0 m4 macro actually computes this value using
$PKG_CONFIG. Yet $PKG_CONFIG variable is the pkg-config tool looking for
target libraries (not host), hence it would return the executable
`glib-compile-resources` built for the target.

Also using the same variable name invalidates our test: our own
AC_PATH_PROG was never run as the variable was already set. And no
environment variable could override this test anymore either. This is
why I rename the test variable to HOST_GLIB_COMPILE_RESOURCES.
parent 2587b85a
......@@ -741,11 +741,27 @@ WARNING: Test for glib-networking cannot be performed while cross-compiling.
optional anymore."
fi
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources, no)
if test "x$GLIB_COMPILE_RESOURCES" = xno; then
add_deps_error([glib-compile-resources],
[Could not find glib-compile-resources in your PATH.])
# AM_PATH_GLIB_2_0 already fills in the variable GLIB_COMPILE_RESOURCES.
# Unfortunately it looks it up using $PKG_CONFIG, which search in
# target-installed libraries, hence it would return a tool for the
# target architecture in case of cross-compilation (which can't be run
# during build, unless there is some compatibility layer in the OS).
# Therefore we make our own check.
AC_MSG_CHECKING([for native glib-compile-resources])
if test -z "$HOST_GLIB_COMPILE_RESOURCES"; then
# Do not use $PKG_CONFIG as it will search target files.
HOST_GLIB_COMPILE_RESOURCES=`pkg-config --variable=glib_compile_resources gio-2.0`
if test -z "$HOST_GLIB_COMPILE_RESOURCES"; then
# As fallback, search in path.
AC_PATH_PROG(HOST_GLIB_COMPILE_RESOURCES, glib-compile-resources, no)
if test "x$HOST_GLIB_COMPILE_RESOURCES" = xno; then
add_deps_error([glib-compile-resources],
[Could not find glib-compile-resources in your PATH.])
fi
fi
fi
AC_MSG_RESULT($HOST_GLIB_COMPILE_RESOURCES)
AC_SUBST(HOST_GLIB_COMPILE_RESOURCES)
AC_PATH_PROG(GDBUS_CODEGEN, gdbus-codegen, no)
if test "x$GDBUS_CODEGEN" = xno; then
......
......@@ -109,7 +109,7 @@ gimp-tool-cursors.gresource.xml: $(CURSOR_IMAGES) Makefile.am
echo '</gresources>' >> $@ )
gimp-tool-cursors.c: gimp-tool-cursors.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) \
$(AM_V_GEN) $(HOST_GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) --generate-source \
--target=$@ gimp-tool-cursors.gresource.xml
......@@ -131,6 +131,6 @@ gimp-color-picker-cursors.gresource.xml: $(CURSOR_IMAGES) Makefile.am
echo '</gresources>' >> $@ )
gimp-color-picker-cursors.c: gimp-color-picker-cursors.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) \
$(AM_V_GEN) $(HOST_GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) --generate-source \
--target=$@ gimp-color-picker-cursors.gresource.xml
......@@ -65,7 +65,7 @@ gimp-core-pixbufs.gresource.xml: $(CORE_IMAGES) Makefile.am
echo '</gresources>' >> $@ )
gimp-core-pixbufs.c: gimp-core-pixbufs.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) \
$(AM_V_GEN) $(HOST_GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) --generate-source \
--target=$@ gimp-core-pixbufs.gresource.xml
......@@ -82,6 +82,6 @@ gimp-icon-pixbufs.gresource.xml: $(ICON_IMAGES) Makefile.am
echo '</gresources>' >> $@ )
gimp-icon-pixbufs.c: gimp-icon-pixbufs.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) \
$(AM_V_GEN) $(HOST_GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) --generate-source \
--target=$@ gimp-icon-pixbufs.gresource.xml
......@@ -548,7 +548,7 @@ gimp-core-pixbufs.gresource.xml: $(CORE_IMAGES) Makefile.am
echo '</gresources>' >> $@ )
gimp-core-pixbufs.c: gimp-core-pixbufs.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) \
$(AM_V_GEN) $(HOST_GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) --generate-source \
--target=$@ gimp-core-pixbufs.gresource.xml
......@@ -565,6 +565,6 @@ gimp-icon-pixbufs.gresource.xml: $(ICON_IMAGES) Makefile.am
echo '</gresources>' >> $@ )
gimp-icon-pixbufs.c: gimp-icon-pixbufs.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) \
$(AM_V_GEN) $(HOST_GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) --generate-source \
--target=$@ gimp-icon-pixbufs.gresource.xml
......@@ -67,7 +67,7 @@ gimp-core-pixbufs.gresource.xml: $(CORE_IMAGES) Makefile.am
echo '</gresources>' >> $@ )
gimp-core-pixbufs.c: gimp-core-pixbufs.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) \
$(AM_V_GEN) $(HOST_GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) --generate-source \
--target=$@ gimp-core-pixbufs.gresource.xml
......@@ -84,6 +84,6 @@ gimp-icon-pixbufs.gresource.xml: $(ICON_IMAGES) Makefile.am
echo '</gresources>' >> $@ )
gimp-icon-pixbufs.c: gimp-icon-pixbufs.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) \
$(AM_V_GEN) $(HOST_GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) --generate-source \
--target=$@ gimp-icon-pixbufs.gresource.xml
......@@ -77,6 +77,6 @@ pagecurl-icons.gresource.xml: $(PAGECURL_IMAGES) Makefile.am
echo '</gresources>' >> $@ )
pagecurl-icons.c: pagecurl-icons.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) \
$(AM_V_GEN) $(HOST_GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) --generate-source \
--target=$@ pagecurl-icons.gresource.xml
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment