unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* patch to build guile CVS on Mac OS X
@ 2004-01-06 10:17 Richard Todd
  2004-01-06 21:53 ` Kevin Ryde
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Richard Todd @ 2004-01-06 10:17 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1268 bytes --]

Hi all, 

These changes made guile CVS build for me on Mac OS X.  Non-scientific
testing (ran some of my programs) seems to show that it's working.

I'd appreciate it if this, or something like it, could get applied.

BTW, on 12/30 I submitted a patch to bug-guile for a problem with
ice-9/q.scm and haven't gotten an ACK from anyone about it.  Should I
re-submit after a while, or ...?

Summary of changes: 

1) Mac OS X has a funny quirk about getting to the
environment from shared libs.  Patches exactly like what I'm
submitting were applied to many other programs (like python and tcl)
for this exact issue.  posix.c and stime.c were hit.

2) The SCM_MUTEX_MAX_SIZE was too small.  I also added to the error
message in threads-plugin.c, so that it tells you what the size should
be.  This was faster than getting to that point in a debugger!  It may
be that you'd want to just raise the size for all platforms, but I
took the conservative approach and just raised it for __APPLE__.

3) numbers.c defined s_bignum but did not use it, and guile compiles
such that this was an error.  Maybe it'd be right to just get rid of
it...but to get this to work I just #ifdef'ed it out for __APPLE__

Richard Todd
richardt at vzavenue dot net


[-- Attachment #2: mac_osx.patch --]
[-- Type: text/plain, Size: 3827 bytes --]

Index: libguile/numbers.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/numbers.c,v
retrieving revision 1.220
diff -u -r1.220 numbers.c
--- libguile/numbers.c	3 Jan 2004 21:38:38 -0000	1.220
+++ libguile/numbers.c	6 Jan 2004 09:49:32 -0000
@@ -153,7 +153,9 @@
 
 \f
 
+#ifndef __APPLE__
 static const char s_bignum[] = "bignum";
+#endif
 
 SCM_C_INLINE_KEYWORD SCM
 scm_i_mkbig ()
Index: libguile/posix.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/posix.c,v
retrieving revision 1.120
diff -u -r1.120 posix.c
--- libguile/posix.c	15 Sep 2003 12:36:57 -0000	1.120
+++ libguile/posix.c	6 Jan 2004 09:49:34 -0000
@@ -97,7 +97,12 @@
 
 #include <signal.h>
 
+#if defined(__APPLE__) && defined(__DYNAMIC__)
+#include<crt_externs.h>
+static char ** environ;
+#else
 extern char ** environ;
+#endif 
 
 #ifdef HAVE_GRP_H
 #include <grp.h>
@@ -1735,6 +1740,10 @@
 void 
 scm_init_posix ()
 {
+#if defined(__APPLE__) && defined(__DYNAMIC__)
+  environ = *_NSGetEnviron();
+#endif
+
   scm_add_feature ("posix");
 #ifdef HAVE_GETEUID
   scm_add_feature ("EIDs");
Index: libguile/stime.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/stime.c,v
retrieving revision 1.82
diff -u -r1.82 stime.c
--- libguile/stime.c	3 Jan 2004 22:25:24 -0000	1.82
+++ libguile/stime.c	6 Jan 2004 09:49:34 -0000
@@ -260,7 +260,12 @@
 }
 
 static char tzvar[3] = "TZ";
+#if defined(__APPLE__) && defined(__DYNAMIC__)
+#include<crt_externs.h>
+static char ** environ;
+#else
 extern char ** environ;
+#endif
 
 /* if zone is set, create a temporary environment with only a TZ
    string.  other threads or interrupt handlers shouldn't be allowed
@@ -671,6 +676,10 @@
 void
 scm_init_stime()
 {
+#if defined(__APPLE__) && defined(__DYNAMIC__)
+  environ = *_NSGetEnviron();
+#endif
+
   scm_c_define ("internal-time-units-per-second",
 		scm_long2num((long) SCM_TIME_UNITS_PER_SECOND));
 
Index: libguile/threads-plugin.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/threads-plugin.c,v
retrieving revision 1.4
diff -u -r1.4 threads-plugin.c
--- libguile/threads-plugin.c	5 Apr 2003 19:10:22 -0000	1.4
+++ libguile/threads-plugin.c	6 Jan 2004 09:49:35 -0000
@@ -181,6 +181,16 @@
       || scm_i_plugin_rec_mutex_size > SCM_REC_MUTEX_MAXSIZE)
     {
       fprintf (stderr, "Internal error: Need to upgrade mutex size\n");
+      fprintf (stderr, 
+               "Mutex Size: %d\tCurrent Max: %ld\n",
+               scm_i_plugin_mutex_size, 
+               SCM_MUTEX_MAXSIZE);
+      fprintf (stderr, 
+               "Recursive Mutex Size: %d\tCurrent Max: %ld\n",
+               scm_i_plugin_rec_mutex_size, 
+               SCM_REC_MUTEX_MAXSIZE);
+
+                         
       abort ();
     }
 }
Index: libguile/threads-plugin.h
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/threads-plugin.h,v
retrieving revision 1.3
diff -u -r1.3 threads-plugin.h
--- libguile/threads-plugin.h	5 Apr 2003 19:10:22 -0000	1.3
+++ libguile/threads-plugin.h	6 Jan 2004 09:49:35 -0000
@@ -24,7 +24,11 @@
 #include <pthread.h> /* This file should *not* need to include pthread.h */
 
 /* Size is checked in scm_init_threads_plugin */
+#ifdef __APPLE__
+#define SCM_MUTEX_MAXSIZE (12 * sizeof (long))
+#else
 #define SCM_MUTEX_MAXSIZE (9 * sizeof (long))
+#endif
 typedef struct { char _[SCM_MUTEX_MAXSIZE]; } scm_t_mutex;
 
 /*fixme* Should be defined similarly to scm_t_mutex. */

[-- Attachment #3: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-01-07  0:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-06 10:17 patch to build guile CVS on Mac OS X Richard Todd
2004-01-06 21:53 ` Kevin Ryde
2004-01-06 22:00 ` Kevin Ryde
2004-01-06 23:16   ` Richard Todd
2004-01-06 23:30     ` Kevin Ryde
2004-01-07  0:06       ` Richard Todd
2004-01-07  0:37         ` Kevin Ryde
2004-01-06 23:02 ` Kevin Ryde
2004-01-06 23:30   ` Richard Todd
2004-01-06 23:44     ` Kevin Ryde

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).