Patch for buildings hugs with pthreads
Antony Courtney
antony@apocalypse.org
Sat, 07 Jul 2001 18:08:38 -0400
This is a multi-part message in MIME format.
--------------0E4954E435724846075EB833
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi,
As I mentioned on the Haskell mailing list a few days ago, a few of us at Yale
are developing a system that allows Haskell code to invoke Java methods via
GreenCard and the Java Native Interface. The system works quite reliably at
this point, including integration of the Java and Haskell garbage collectors,
and we have succesfully run a number of interesting test programs under Hugs98
on both Windows and Linux. We are currently working on a novel mechanism for
mapping Java method names to Haskell function names; when that is complete, we
plan to make this system available to the community.
However, because the Java VM is multi-threaded, I had to rebuild Hugs from
sources under Linux to use the multi-threaded version of the C library. The
changes were very minor:
- Pass the -D_REENTRANT flag to CC
- Add -lpthread to LIBS for linking
- #define DONT_PANIC to avoid catching signals used by the user-space
LinuxThreads implementation.
To make it as painless as possible for users to be able to use the Java/Haskell
bridge, whilst minimizing the impact on others, I have made modified my local
copy of hugs so that the above changes only take effect if the --with-pthreads
option is given to configure.
Attached is a patch with the mods. to src/Makefile.in and src/unix/configure.in
to add the --with-pthreads option. Since this change is completely invisible
unless hugs is built from sources using --with-pthreads, I hope that you won't
object to including this in the hugs distribution.
The patch is in unified diff format. If you have any problems applying the
patch from the diff. file or there is anything I can do to make this patch more
acceptable, please let me know.
Thanks!
-Antony Courtney
--
Antony Courtney
Grad. Student, Dept. of Computer Science, Yale University
antony@apocalypse.org http://www.apocalypse.org/pub/u/antony
--------------0E4954E435724846075EB833
Content-Type: text/plain; charset=us-ascii;
name="mt.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="mt.patch"
diff -u -r src/Makefile.in /usr/local/src/hugs98-Feb2001-MT/hugs98-Feb2001/src/Makefile.in
--- src/Makefile.in Tue Jan 30 21:52:13 2001
+++ /usr/local/src/hugs98-Feb2001-MT/hugs98-Feb2001/src/Makefile.in Sat Jul 7 16:35:19 2001
@@ -25,7 +25,7 @@
default :: hugs@EXE@ runhugs@EXE@
CC = @CC@
-CFLAGS = @CFLAGS@ @DEBUGFLAGS@
+CFLAGS = @CFLAGS@ @DEBUGFLAGS@ @MTCFLAGS@
OPTFLAGS = @OPTFLAGS@
LD = @LD@
diff -u -r src/unix/configure.in /usr/local/src/hugs98-Feb2001-MT/hugs98-Feb2001/src/unix/configure.in
--- src/unix/configure.in Wed Jan 17 18:30:36 2001
+++ /usr/local/src/hugs98-Feb2001-MT/hugs98-Feb2001/src/unix/configure.in Sat Jul 7 16:51:57 2001
@@ -240,6 +240,7 @@
AC_ARG_ENABLE(tag-checks, [ --enable-tag-checks runtime tag checking (for debugging use)],AC_DEFINE(CHECK_TAGS))
AC_ARG_ENABLE(lint, [ --enable-lint enable "lint" flags (for debugging use)])
AC_ARG_ENABLE(only98, [ --enable-only98 make Hugs Haskell 98 only], AC_DEFINE(HASKELL_98_ONLY))
+AC_ARG_WITH(pthreads, [ --with-pthreads build Hugs using pthreads C library], AC_DEFINE(DONT_PANIC) MTCFLAGS="-D_REENTRANT"; LIBS="$LIBS -lpthread")
dnl Disabled for now because the plugin-code can't handle the change.
dnl If you're not using plugins, you could turn this on manually
@@ -343,6 +344,7 @@
AC_SUBST(OPTFLAGS)
AC_SUBST(DEBUGFLAGS)
AC_SUBST(LDDEBUGFLAGS)
+AC_SUBST(MTCFLAGS)
dnl Figure out sizes of objects and decide which version of Hugs to build
--------------0E4954E435724846075EB833--