From: Andy Wingo <wingo@pobox.com>
To: Volker Grabsch <vog@notjusthosting.com>
Cc: bug-guile@gnu.org, guile-devel@gnu.org, Mike Gran <spk121@yahoo.com>
Subject: Re: Guile with win32 cross compiling
Date: Tue, 12 Apr 2011 13:14:14 +0200 [thread overview]
Message-ID: <m3y63fiuwp.fsf@unquote.localdomain> (raw)
In-Reply-To: <20110401185020.GC13643@flap> (Volker Grabsch's message of "Fri, 1 Apr 2011 20:50:20 +0200")
[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]
Hi Volker,
On Fri 01 Apr 2011 20:50, Volker Grabsch <vog@notjusthosting.com> writes:
> "Portability fixes for win32 cross compiling"
> http://www.mail-archive.com/guile-devel@gnu.org/msg05308.html
Ah yes. Thanks for that link. And thank you for your ongoing patience
:-)
> Gen-scmconfig is a code generator, so it has to be built using
> the native toolchain. However, it is supposed to write take its
> values from the <uniconv.h> of the cross tool chain. Thus, the
> "/usr/include" equivalent of the cross tool chain is added to
> the include path when compiling gen-scmconfig. And here the
> trouble starts, because mixing headers of various toolchains
> is never a good idea. Among others, basic headers like <stdio.h>
> are now taken from the cross toolchain, referring to objects that
> don't even exist in the native toolchain, causing the build to
> fail with all kinds of strange error messages.
Hmmm. Well. We have other code generators in Guile's build system;
notably the configure script (via config.h and other output files).
What do folks think about the attached patch?
Regards,
Andy
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-check-for-iconveh-values-at-configure-time.patch --]
[-- Type: text/x-patch, Size: 6023 bytes --]
From b03f8337ea62091208680fab901606c9af360a5d Mon Sep 17 00:00:00 2001
From: Andy Wingo <wingo@pobox.com>
Date: Tue, 12 Apr 2011 13:12:56 +0200
Subject: [PATCH] check for iconveh values at configure-time
* configure.ac: Check for the iconveh values here, instead of relying on
gen-scmconfig to know them. That doesn't work in general because
gen-scmconfig runs on the build machine, not the target machine.
* libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Revert rule to the
revision before 533d8212.
* libguile/gen-scmconfig.h.in (SCM_I_GSC_ICONVEH_ERROR):
(SCM_I_GSC_ICONVEH_QUESTION_MARK):
(SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE):
* libguile/gen-scmconfig.c: Use configure-time substitutions to set
SCM_ICONVEH_ERROR_HANDLER et al.
---
configure.ac | 64 +++++++++++++++++++++++++++++++++++++++++++
libguile/Makefile.am | 12 +++-----
libguile/gen-scmconfig.c | 9 +++---
libguile/gen-scmconfig.h.in | 3 ++
4 files changed, 76 insertions(+), 12 deletions(-)
diff --git a/configure.ac b/configure.ac
index 45438c8..1f68e0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1188,6 +1188,70 @@ GUILE_STRUCT_UTIMBUF
#--------------------------------------------------------------------
#
+# What values do the iconv error handlers have?
+#
+# The only place that we need iconv in our public interfaces is for
+# the error handlers, which are just ints. So we weaken our
+# dependency by looking up those values at configure-time.
+#--------------------------------------------------------------------
+SCM_I_GSC_ICONVEH_ERROR=0
+SCM_I_GSC_ICONVEH_QUESTION_MARK=1
+SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE=2
+AC_MSG_CHECKING([for iconveh_error])
+AC_RUN_IFELSE([AC_LANG_SOURCE(
+[AC_INCLUDES_DEFAULT
+#include <uniconv.h>
+int
+main (int argc, char *argv[])
+{
+ if (argc > 1)
+ printf ("%d\n", (int)iconveh_error);
+ return 0;
+}])],
+ [SCM_I_GSC_ICONVEH_ERROR=`./conftest$EXEEXT pretty-please`
+ AC_MSG_RESULT([$SCM_I_GSC_ICONVEH_ERROR])],
+ [AC_MSG_FAILURE([failed to get iconveh_error])],
+ [AC_MSG_WARN([assuming $SCM_I_GSC_ICONVEH_ERROR for cross-compilation])])
+
+AC_MSG_CHECKING([for iconveh_question_mark])
+AC_RUN_IFELSE([AC_LANG_SOURCE(
+[AC_INCLUDES_DEFAULT
+#include <uniconv.h>
+int
+main (int argc, char *argv[])
+{
+ if (argc > 1)
+ printf ("%d\n", (int)iconveh_question_mark);
+ return 0;
+}])],
+ [SCM_I_GSC_ICONVEH_QUESTION_MARK=`./conftest$EXEEXT pretty-please`
+ AC_MSG_RESULT([$SCM_I_GSC_ICONVEH_QUESTION_MARK])],
+ [AC_MSG_FAILURE([failed to get iconveh_question_mark])],
+ [AC_MSG_WARN([assuming $SCM_I_GSC_ICONVEH_QUESTION_MARK for cross-compilation])])
+
+AC_MSG_CHECKING([for iconveh_escape_sequence])
+AC_RUN_IFELSE([AC_LANG_SOURCE(
+[AC_INCLUDES_DEFAULT
+#include <uniconv.h>
+int
+main (int argc, char *argv[])
+{
+ if (argc > 1)
+ printf ("%d\n", (int)iconveh_escape_sequence);
+ return 0;
+}])],
+ [SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE=`./conftest$EXEEXT pretty-please`
+ AC_MSG_RESULT([$SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE])],
+ [AC_MSG_FAILURE([failed to get iconveh_escape_sequence])],
+ [AC_MSG_WARN([assuming $SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE for cross-compilation])])
+
+AC_SUBST([SCM_I_GSC_ICONVEH_ERROR])
+AC_SUBST([SCM_I_GSC_ICONVEH_QUESTION_MARK])
+AC_SUBST([SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE])
+
+
+#--------------------------------------------------------------------
+#
# Which way does the stack grow?
#
# Following code comes from Autoconf 2.61's internal _AC_LIBOBJ_ALLOCA
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index ac27eb8..ffb4059 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -55,13 +55,11 @@ gen_scmconfig_SOURCES = gen-scmconfig.c
## Override default rule; this should be compiled for BUILD host.
## For some reason, OBJEXT does not include the dot
gen-scmconfig.$(OBJEXT): gen-scmconfig.c
- $(AM_V_GEN) \
- if [ "$(cross_compiling)" = "yes" ]; then \
- $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \
- -c -o $@ $<; \
- else \
- $(COMPILE) -c -o $@ $<; \
+ $(AM_V_GEN) \
+ if [ "$(cross_compiling)" = "yes" ]; then \
+ $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) -c -o $@ $<; \
+ else \
+ $(COMPILE) -c -o $@ $<; \
fi
## Override default rule; this should run on BUILD host.
diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c
index 5834346..176f25c 100644
--- a/libguile/gen-scmconfig.c
+++ b/libguile/gen-scmconfig.c
@@ -123,7 +123,6 @@
#include <stdio.h>
#include <string.h>
-#include <uniconv.h>
#define pf printf
@@ -397,11 +396,11 @@ main (int argc, char *argv[])
pf ("\n");
pf ("/* Constants from uniconv.h. */\n");
- pf ("#define SCM_ICONVEH_ERROR %d\n", (int) iconveh_error);
- pf ("#define SCM_ICONVEH_QUESTION_MARK %d\n",
- (int) iconveh_question_mark);
+ pf ("#define SCM_ICONVEH_ERROR %d\n", SCM_I_GSC_ICONVEH_ERROR);
+ pf ("#define SCM_ICONVEH_QUESTION_MARK %d\n",
+ SCM_I_GSC_ICONVEH_QUESTION_MARK);
pf ("#define SCM_ICONVEH_ESCAPE_SEQUENCE %d\n",
- (int) iconveh_escape_sequence);
+ SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE);
printf ("#endif\n");
diff --git a/libguile/gen-scmconfig.h.in b/libguile/gen-scmconfig.h.in
index 125720a..30f43d7 100644
--- a/libguile/gen-scmconfig.h.in
+++ b/libguile/gen-scmconfig.h.in
@@ -31,6 +31,9 @@
#define SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER @SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER@
#define SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS @SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS@
#define SCM_I_GSC_HAVE_STRUCT_DIRENT64 @SCM_I_GSC_HAVE_STRUCT_DIRENT64@
+#define SCM_I_GSC_ICONVEH_ERROR @SCM_I_GSC_ICONVEH_ERROR@
+#define SCM_I_GSC_ICONVEH_QUESTION_MARK @SCM_I_GSC_ICONVEH_QUESTION_MARK@
+#define SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE @SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE@
/*
Local Variables:
--
1.7.3.4
[-- Attachment #3: Type: text/plain, Size: 26 bytes --]
--
http://wingolog.org/
next prev parent reply other threads:[~2011-04-12 11:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-26 22:06 Guile with win32 cross compiling Volker Grabsch
2011-04-01 10:38 ` Andy Wingo
2011-04-01 18:50 ` Volker Grabsch
2011-04-12 11:14 ` Andy Wingo [this message]
2011-04-23 16:10 ` Volker Grabsch
2011-04-24 10:42 ` Andy Wingo
2011-05-16 23:01 ` Volker Grabsch
2011-05-20 10:32 ` Andy Wingo
2011-05-20 12:25 ` Volker Grabsch
2011-05-20 12:48 ` Jan Nieuwenhuizen
2011-05-20 13:25 ` Andy Wingo
2011-05-20 22:19 ` Volker Grabsch
2011-06-17 9:03 ` Andy Wingo
2011-07-01 13:52 ` Andy Wingo
2011-04-24 20:22 ` Ludovic Courtès
2011-04-28 21:03 ` Andy Wingo
2011-06-19 14:42 ` Ludovic Courtès
-- strict thread matches above, loose matches on Subject: below --
2011-04-05 19:43 Mike Gran
2011-04-06 1:38 ` Volker Grabsch
2011-04-06 12:46 ` Ludovic Courtès
2011-03-26 22:04 Volker Grabsch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3y63fiuwp.fsf@unquote.localdomain \
--to=wingo@pobox.com \
--cc=bug-guile@gnu.org \
--cc=guile-devel@gnu.org \
--cc=spk121@yahoo.com \
--cc=vog@notjusthosting.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).