From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: MinGW build fixes Date: Sat, 27 Jun 2009 00:38:59 +0100 Message-ID: <87my7uk1kc.fsf@arudy.ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1246059560 28472 80.91.229.12 (26 Jun 2009 23:39:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Jun 2009 23:39:20 +0000 (UTC) To: Guile Development Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jun 27 01:39:13 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MKL0i-0005FB-Rs for guile-devel@m.gmane.org; Sat, 27 Jun 2009 01:39:13 +0200 Original-Received: from localhost ([127.0.0.1]:56001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MKL0i-0001Hz-2K for guile-devel@m.gmane.org; Fri, 26 Jun 2009 19:39:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MKL0e-0001Fm-Qm for guile-devel@gnu.org; Fri, 26 Jun 2009 19:39:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MKL0a-0001AK-3P for guile-devel@gnu.org; Fri, 26 Jun 2009 19:39:08 -0400 Original-Received: from [199.232.76.173] (port=56027 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MKL0Z-0001AH-Rh for guile-devel@gnu.org; Fri, 26 Jun 2009 19:39:03 -0400 Original-Received: from mail3.uklinux.net ([80.84.72.33]:48668) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MKL0Z-0007XS-4F for guile-devel@gnu.org; Fri, 26 Jun 2009 19:39:03 -0400 Original-Received: from arudy (host86-152-99-133.range86-152.btcentralplus.com [86.152.99.133]) by mail3.uklinux.net (Postfix) with ESMTP id 4B8F91F9570 for ; Sat, 27 Jun 2009 00:39:01 +0100 (BST) Original-Received: from arudy.ossau.uklinux.net (arudy [127.0.0.1]) by arudy (Postfix) with ESMTP id DF0203801F for ; Sat, 27 Jun 2009 00:38:59 +0100 (BST) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:8779 Archived-At: --=-=-= 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-MinGW-build-fixes.patch >From ed7189a28292cd9ba8fcb5d18d2dcd817061935a Mon Sep 17 00:00:00 2001 From: Neil Jerram 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 +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 +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 +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 -#include /* for SCM_MIN */ #include +#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 --=-=-=--