summary refs log tree commit diff
path: root/gnu/packages/patches/guile-sqlite3-fix-cross-compilation.patch
blob: 9ea9a476777625a5a0472817401f1da1f96e6e71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From a6e9e62a77ecc5012929613e20da23b2636450a5 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <mathieu.othacehe@parrot.com>
Date: Mon, 25 Mar 2019 11:00:38 +0100
Subject: [PATCH] cross compile

---
 build-aux/guile.am |  2 +-
 configure.ac       | 19 ++++++++++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/build-aux/guile.am b/build-aux/guile.am
index dc1e63f..3126372 100644
--- a/build-aux/guile.am
+++ b/build-aux/guile.am
@@ -16,4 +16,4 @@ EXTRA_DIST = $(SOURCES) $(NOCOMP_SOURCES)
 GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat
 SUFFIXES = .scm .go
 .scm.go:
-	$(AM_V_GEN)$(top_builddir)/env $(GUILE_TOOLS) compile $(GUILE_WARNINGS) -o "$@" "$<"
+	$(AM_V_GEN)$(top_builddir)/env $(GUILE_TOOLS) compile $(GUILE_TARGET) $(GUILE_WARNINGS) -o "$@" "$<"
diff --git a/configure.ac b/configure.ac
index f648fcb..2d34d0a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,15 +21,20 @@ PKG_CHECK_MODULES([SQLITE], [sqlite3])
 SQLITE_LIBDIR="`"$PKG_CONFIG" sqlite3 --variable libdir`"
 AC_SUBST([SQLITE_LIBDIR])
 
-AC_MSG_CHECKING([whether '$SQLITE_LIBDIR/libsqlite3' is usable])
-GUILE_CHECK([retval],
-  [(dynamic-func \"sqlite3_open_v2\"
+if test "$cross_compiling" = "no"; then
+   AC_MSG_CHECKING([whether '$SQLITE_LIBDIR/libsqlite3' is usable])
+   GUILE_CHECK([retval],
+   [(dynamic-func \"sqlite3_open_v2\"
                  (dynamic-link \"$SQLITE_LIBDIR/libsqlite3\"))])
-if test "$retval" != 0; then
-  AC_MSG_RESULT([no])
-  AC_MSG_ERROR([failed to load '$SQLITE_LIBDIR/libsqlite3'])
+   if test "$retval" != 0; then
+      AC_MSG_RESULT([no])
+      AC_MSG_ERROR([failed to load '$SQLITE_LIBDIR/libsqlite3'])
+   else
+      AC_MSG_RESULT([yes])
+   fi
 else
-  AC_MSG_RESULT([yes])
+   GUILE_TARGET="--target=$host_alias"
+   AC_SUBST([GUILE_TARGET])
 fi
 
 AC_CONFIG_FILES([Makefile sqlite3.scm])
-- 
2.17.1