From: Neil Jerram <neil@ossau.uklinux.net>
To: Guile Development <guile-devel@gnu.org>
Subject: MinGW build fixes
Date: Sat, 27 Jun 2009 00:38:59 +0100 [thread overview]
Message-ID: <87my7uk1kc.fsf@arudy.ossau.uklinux.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 177 bytes --]
The patch below allows a complete MinGW build of branch_release-1-8; I
haven't tried actually running the built .exe and .dlls yet.
Comments appreciated as usual!
Neil
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-MinGW-build-fixes.patch --]
[-- Type: text/x-diff, Size: 7419 bytes --]
From ed7189a28292cd9ba8fcb5d18d2dcd817061935a Mon Sep 17 00:00:00 2001
From: Neil Jerram <neil@ossau.uklinux.net>
Date: Sat, 27 Jun 2009 00:33:06 +0100
Subject: [PATCH] MinGW build fixes
- Need to use GUILE_FOR_BUILD for autogeneration steps during the
build.
- MinGW can't export/import struct variables from/to a DLL, so wrap
the ones needed by inline.h in exported/imported pointer variables.
- The dummy scm_init_* and scm_c_init_* functions in the empty
libraries for SRFIs 4, 13 and 14 clash with declarations with the
same names in libguile.h that are marked (in the MinGW build) with
__declspec (dllimport). These libraries are empty because their
content was moved into libguile some time ago, and I think these
functions are needed only so that the libraries appear to contain
something. They used also to be needed for the (load-extension ...)
forms in the corresponding .scm modules, but those forms were not
needed anymore, and so were removed, when everything moved into
libguile.
* doc/ref/Makefile.am (autoconf-macros.texi): Use GUILE_FOR_BUILD to
generate this.
* libguile/gc-freelist.c (scm_i_master_freelist_ptr,
scm_i_master_freelist2_ptr): New API variables.
* libguile/gc.h (scm_i_freelist_ptr, scm_i_freelist2_ptr,
scm_i_master_freelist_ptr, scm_i_master_freelist2_ptr): New global
variable declarations.
* libguile/inline.h (scm_cell): Use scm_i_freelist_ptr and
scm_i_master_freelist_ptr instead of scm_i_freelist and
scm_i_master_freelist.
(scm_double_cell): Use scm_i_freelist2_ptr and
scm_i_master_freelist2_ptr instead of scm_i_freelist2 and
scm_i_master_freelist2.
* libguile/threads.c (scm_i_freelist_ptr, scm_i_freelist2_ptr): New
global variables.
* srfi/srfi-13.c (scm_init_srfi_13_no_clash_with_libguile): Renamed
from scm_init_srfi_13.
(scm_init_srfi_13_14_no_clash_with_libguile): Same.
* srfi/srfi-14.c (scm_init_srfi_14_no_clash_with_libguile): Same.
(scm_c_init_srfi_14_no_clash_with_libguile): Same.
* srfi/srfi-4.c (scm_init_srfi_4_no_clash_with_libguile): Same.
* srfi/srfi-60.c (SCM_MIN): Define here instead of including
private-gc.h.
---
doc/ref/Makefile.am | 2 +-
libguile/gc-freelist.c | 2 ++
libguile/gc.h | 4 ++++
libguile/inline.h | 8 ++++----
libguile/threads.c | 2 ++
srfi/srfi-13.c | 7 +++++--
srfi/srfi-14.c | 7 +++++--
srfi/srfi-4.c | 4 +++-
srfi/srfi-60.c | 2 +-
9 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/doc/ref/Makefile.am b/doc/ref/Makefile.am
index b60f2ff..46958b6 100644
--- a/doc/ref/Makefile.am
+++ b/doc/ref/Makefile.am
@@ -86,7 +86,7 @@ include $(top_srcdir)/am/pre-inst-guile
autoconf.texi: autoconf-macros.texi
autoconf-macros.texi: $(top_srcdir)/guile-config/guile.m4
- $(preinstguiletool)/snarf-guile-m4-docs $(top_srcdir)/guile-config/guile.m4 \
+ GUILE="$(GUILE_FOR_BUILD)" $(top_srcdir)/scripts/snarf-guile-m4-docs $(top_srcdir)/guile-config/guile.m4 \
> $(srcdir)/$@
MAINTAINERCLEANFILES = autoconf-macros.texi
diff --git a/libguile/gc-freelist.c b/libguile/gc-freelist.c
index c8824df..4b38992 100644
--- a/libguile/gc-freelist.c
+++ b/libguile/gc-freelist.c
@@ -29,6 +29,8 @@
scm_t_cell_type_statistics scm_i_master_freelist;
scm_t_cell_type_statistics scm_i_master_freelist2;
+scm_t_cell_type_statistics *scm_i_master_freelist_ptr = &scm_i_master_freelist;
+scm_t_cell_type_statistics *scm_i_master_freelist2_ptr = &scm_i_master_freelist2;
diff --git a/libguile/gc.h b/libguile/gc.h
index 3cedeb4..3b60689 100644
--- a/libguile/gc.h
+++ b/libguile/gc.h
@@ -273,9 +273,13 @@ SCM_API size_t scm_max_segment_size;
#define SCM_SET_FREELIST_LOC(key,ptr) scm_i_pthread_setspecific ((key), (ptr))
#define SCM_FREELIST_LOC(key) ((SCM *) scm_i_pthread_getspecific (key))
SCM_API scm_i_pthread_key_t scm_i_freelist;
+SCM_API scm_i_pthread_key_t *scm_i_freelist_ptr;
SCM_API scm_i_pthread_key_t scm_i_freelist2;
+SCM_API scm_i_pthread_key_t *scm_i_freelist2_ptr;
SCM_API struct scm_t_cell_type_statistics scm_i_master_freelist;
+SCM_API struct scm_t_cell_type_statistics *scm_i_master_freelist_ptr;
SCM_API struct scm_t_cell_type_statistics scm_i_master_freelist2;
+SCM_API struct scm_t_cell_type_statistics *scm_i_master_freelist2_ptr;
SCM_API unsigned long scm_gc_cells_swept;
diff --git a/libguile/inline.h b/libguile/inline.h
index eae1e22..de2a50a 100644
--- a/libguile/inline.h
+++ b/libguile/inline.h
@@ -109,10 +109,10 @@ SCM
scm_cell (scm_t_bits car, scm_t_bits cdr)
{
SCM z;
- SCM *freelist = SCM_FREELIST_LOC (scm_i_freelist);
+ SCM *freelist = SCM_FREELIST_LOC (*scm_i_freelist_ptr);
if (scm_is_null (*freelist))
- z = scm_gc_for_newcell (&scm_i_master_freelist, freelist);
+ z = scm_gc_for_newcell (scm_i_master_freelist_ptr, freelist);
else
{
z = *freelist;
@@ -180,10 +180,10 @@ scm_double_cell (scm_t_bits car, scm_t_bits cbr,
scm_t_bits ccr, scm_t_bits cdr)
{
SCM z;
- SCM *freelist = SCM_FREELIST_LOC (scm_i_freelist2);
+ SCM *freelist = SCM_FREELIST_LOC (*scm_i_freelist2_ptr);
if (scm_is_null (*freelist))
- z = scm_gc_for_newcell (&scm_i_master_freelist2, freelist);
+ z = scm_gc_for_newcell (scm_i_master_freelist2_ptr, freelist);
else
{
z = *freelist;
diff --git a/libguile/threads.c b/libguile/threads.c
index 3d6df11..ff8771d 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -1680,6 +1680,8 @@ scm_dynwind_critical_section (SCM mutex)
/*** Initialization */
scm_i_pthread_key_t scm_i_freelist, scm_i_freelist2;
+scm_i_pthread_key_t *scm_i_freelist_ptr = &scm_i_freelist;
+scm_i_pthread_key_t *scm_i_freelist2_ptr = &scm_i_freelist2;
scm_i_pthread_mutex_t scm_i_misc_mutex;
#if SCM_USE_PTHREAD_THREADS
diff --git a/srfi/srfi-13.c b/srfi/srfi-13.c
index dd5ce9b..8655885 100644
--- a/srfi/srfi-13.c
+++ b/srfi/srfi-13.c
@@ -29,12 +29,15 @@
#include <srfi/srfi-13.h>
+void scm_init_srfi_13_no_clash_with_libguile (void);
+void scm_init_srfi_13_14_no_clash_with_libguile (void);
+
void
-scm_init_srfi_13 (void)
+scm_init_srfi_13_no_clash_with_libguile (void)
{
}
void
-scm_init_srfi_13_14 (void)
+scm_init_srfi_13_14_no_clash_with_libguile (void)
{
}
diff --git a/srfi/srfi-14.c b/srfi/srfi-14.c
index 1a7297b..76cea87 100644
--- a/srfi/srfi-14.c
+++ b/srfi/srfi-14.c
@@ -23,12 +23,15 @@
#include <srfi/srfi-14.h>
+void scm_init_srfi_14_no_clash_with_libguile (void);
+void scm_c_init_srfi_14_no_clash_with_libguile (void);
+
void
-scm_init_srfi_14 (void)
+scm_init_srfi_14_no_clash_with_libguile (void)
{
}
void
-scm_c_init_srfi_14 (void)
+scm_c_init_srfi_14_no_clash_with_libguile (void)
{
}
diff --git a/srfi/srfi-4.c b/srfi/srfi-4.c
index f40c6b3..f2e29e2 100644
--- a/srfi/srfi-4.c
+++ b/srfi/srfi-4.c
@@ -28,8 +28,10 @@
#include <srfi/srfi-4.h>
+void scm_init_srfi_4_no_clash_with_libguile (void);
+
void
-scm_init_srfi_4 (void)
+scm_init_srfi_4_no_clash_with_libguile (void)
{
}
diff --git a/srfi/srfi-60.c b/srfi/srfi-60.c
index e173369..a91cb50 100644
--- a/srfi/srfi-60.c
+++ b/srfi/srfi-60.c
@@ -22,9 +22,9 @@
#endif
#include <libguile.h>
-#include <libguile/private-gc.h> /* for SCM_MIN */
#include <srfi/srfi-60.h>
+#define SCM_MIN(A, B) ((A) < (B) ? (A) : (B))
SCM_DEFINE (scm_srfi60_log2_binary_factors, "log2-binary-factors", 1, 0, 0,
(SCM n),
--
1.5.6.5
next reply other threads:[~2009-06-26 23:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-26 23:38 Neil Jerram [this message]
2009-06-27 0:03 ` MinGW build fixes Ludovic Courtès
2009-06-27 9:29 ` Neil Jerram
-- strict thread matches above, loose matches on Subject: below --
2009-06-27 10:22 carlo.bramix
2009-06-27 17:21 ` Neil Jerram
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=87my7uk1kc.fsf@arudy.ossau.uklinux.net \
--to=neil@ossau.uklinux.net \
--cc=guile-devel@gnu.org \
/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).