From: Christopher Baines <m...@cbaines.net>

This enables cross-compiling for systems different than the build
machine.

* configure.ac (GUILE_TARGET): New variable.
* am/guile.mk (.scm.go): Use it.

Signed-off-by: Maxim Cournoyer <maxim.courno...@gmail.com>
---
 am/guile.mk  | 2 +-
 configure.ac | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/am/guile.mk b/am/guile.mk
index 6ab0750..11cd250 100644
--- a/am/guile.mk
+++ b/am/guile.mk
@@ -47,4 +47,4 @@ GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat
 SUFFIXES = .scm .go
 .scm.go:
        $(AM_V_GEN)$(top_builddir)/pre-inst-env \
-       $(GUILD) compile $(GUILE_WARNINGS) -o "$@" "$<"
+       $(GUILD) compile $(GUILE_WARNINGS) $(GUILE_TARGET) -o "$@" "$<"
diff --git a/configure.ac b/configure.ac
index 07be121..da741ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,6 +67,11 @@ GUILE_GLOBAL_SITE_DIR
 GUILE_SITE_CCACHE_DIR
 GUILE_FLAGS
 
+dnl This argument is passed to guild; it ensures cross-compiling uses
+dnl the right target.
+if test -n "$host_alias"; then
+   AC_SUBST([GUILE_TARGET], [--target=$host_alias])
+fi
 
 AC_ARG_WITH(
   [guile-site],
-- 
2.30.1


Reply via email to