Index: ChangeLog
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/ChangeLog,v
retrieving revision 1.281.2.72
diff -p -u -r1.281.2.72 ChangeLog
--- ChangeLog	6 May 2002 19:15:04 -0000	1.281.2.72
+++ ChangeLog	3 Jul 2002 15:40:16 -0000
@@ -1,3 +1,13 @@
+2002-07-03  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* autogen.sh: Only fix libltdl/configure.in if it exists.  Current
+	libtool CVS does not need this fix.
+
+	* configure.in (AC_LIBTOOL_WIN32_DLL): Add for shared Cygwin
+	build.
+	Add --with-cc-for-build option to re-enable cross building.
+	Add --with-guile-for-build option to re-enable cross building.
+
 2002-05-06  Marius Vollmer  <mvo@zagadka.ping.de>
 
 	* configure.in: Include <sys/types.h> before <netinet/in.h> when
Index: autogen.sh
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/autogen.sh,v
retrieving revision 1.11.2.10
diff -p -u -r1.11.2.10 autogen.sh
--- autogen.sh	1 May 2002 21:05:26 -0000	1.11.2.10
+++ autogen.sh	3 Jul 2002 15:40:16 -0000
@@ -47,11 +47,14 @@ $mscripts/render-bugs > BUGS
 rm -rf libltdl
 libtoolize --force --copy --automake --ltdl
 
+# Fix older versions of libtool.
 # Make sure we use a ./configure.in compatible autoconf in ./libltdl/
-mv libltdl/configure.in libltdl/configure.tmp
-echo 'AC_PREREQ(2.50)' > libltdl/configure.in
-cat libltdl/configure.tmp >> libltdl/configure.in
-rm libltdl/configure.tmp
+if [ -f libltdl/configure.in ]; then
+	mv libltdl/configure.in libltdl/configure.tmp
+	echo 'AC_PREREQ(2.50)' > libltdl/configure.in
+	cat libltdl/configure.tmp >> libltdl/configure.in
+	rm libltdl/configure.tmp
+fi
 ######################################################################
 
 autoheader
Index: configure.in
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/configure.in,v
retrieving revision 1.157.2.19
diff -p -u -r1.157.2.19 configure.in
--- configure.in	6 May 2002 19:11:00 -0000	1.157.2.19
+++ configure.in	3 Jul 2002 15:40:17 -0000
@@ -155,6 +155,9 @@ AC_ISC_POSIX
 AC_MINIX
 
 AM_PROG_CC_STDC
+
+## Needed for building DLLs on Cygwin, before AM_PROG_LIBTOOL
+AC_LIBTOOL_WIN32_DLL
 AM_PROG_LIBTOOL
 
 AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no)
@@ -621,6 +624,54 @@ if test "${THREAD_PACKAGE}" != "" ; then
   fi
 fi
 
+## Cross building	
+if test "$cross_compiling" = "yes"; then
+  AC_MSG_CHECKING(cc for build)
+  ## /usr/bin/cc still uses wrong assembler
+  ## CC_FOR_BUILD="${CC_FOR_BUILD-/usr/bincc}"
+  CC_FOR_BUILD="${CC_FOR_BUILD-PATH=/usr/bin:$PATH cc}"
+else
+  CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
+fi   
+AC_ARG_WITH(cc-for-build,
+  [  --with-cc-for-build=CC  native C compiler, to be used during build])
+test -n "$with_cc_for_build" && CC_FOR_BUILD="$with_cc_for_build"
+     
+## AC_MSG_CHECKING("if we are cross compiling")
+## AC_MSG_RESULT($cross_compiling)
+if test "$cross_compiling" = "yes"; then
+   AC_MSG_RESULT($CC_FOR_BUILD)
+fi
+
+## No need as yet to be more elaborate
+CCLD_FOR_BUILD="$CC_FOR_BUILD"
+
+AC_SUBST(cross_compiling)
+AC_SUBST(CC_FOR_BUILD)
+AC_SUBST(CCLD_FOR_BUILD)
+	
+## libtool erroneously calls CC_FOR_BUILD HOST_CC;
+## --HOST is the platform that PACKAGE is compiled for.
+HOST_CC="$CC_FOR_BUILD"
+AC_SUBST(HOST_CC)
+
+if test "$cross_compiling" = "yes"; then
+  AC_MSG_CHECKING(guile for build)
+  GUILE_FOR_BUILD="${GUILE_FOR_BUILD-guile}"
+else
+  GUILE_FOR_BUILD='$(top_builddir_absolute)/pre-inst-guile'
+fi   
+AC_ARG_WITH(guile-for-build,
+  [  --with-guile-for-build=CC  native guile executable, to be used during build])
+test -n "$with_guile_for_build" && GUILE_FOR_BUILD="$with_cc_for_build"
+
+## AC_MSG_CHECKING("if we are cross compiling")
+## AC_MSG_RESULT($cross_compiling)
+if test "$cross_compiling" = "yes"; then
+   AC_MSG_RESULT($GUILE_FOR_BUILD)
+fi
+AC_SUBST(GUILE_FOR_BUILD)
+  			
 ## If we're using GCC, ask for aggressive warnings.
 case "$GCC" in
   yes )
Index: am/ChangeLog
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/am/ChangeLog,v
retrieving revision 1.1.2.4
diff -p -u -r1.1.2.4 ChangeLog
--- am/ChangeLog	1 Apr 2002 20:02:29 -0000	1.1.2.4
+++ am/ChangeLog	3 Jul 2002 15:40:17 -0000
@@ -1,3 +1,8 @@
+2002-07-03  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* pre-inst-guile (preinstguile): Initialize with
+	$(GUILE_FOR_BUILD) configure parameter.
+
 2002-04-01  Thien-Thi Nguyen  <ttn@giblet.glug.org>
 
 	* maintainer-dirs: Remove "if MAINTAINER_MODE" conditional.
Index: am/pre-inst-guile
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/am/pre-inst-guile,v
retrieving revision 1.1.2.1
diff -p -u -r1.1.2.1 pre-inst-guile
--- am/pre-inst-guile	26 Feb 2002 11:12:18 -0000	1.1.2.1
+++ am/pre-inst-guile	3 Jul 2002 15:40:17 -0000
@@ -28,7 +28,7 @@
 
 ## Code:
 
-preinstguile     = $(top_builddir_absolute)/pre-inst-guile
+preinstguile     = $(GUILE_FOR_BUILD)
 preinstguiletool = GUILE="$(preinstguile)" $(top_srcdir)/scripts
 
 ## am/pre-inst-guile ends here
Index: libguile/ChangeLog
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/ChangeLog,v
retrieving revision 1.1465.2.92
diff -p -u -r1.1465.2.92 ChangeLog
--- libguile/ChangeLog	17 Jun 2002 23:22:45 -0000	1.1465.2.92
+++ libguile/ChangeLog	3 Jul 2002 15:40:20 -0000
@@ -1,3 +1,14 @@
+2002-07-03  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* Makefile.am: Override default rule for c-tokenize.$(OBJECT);
+	this should be compiled for BUILD host.
+	Override default rule for
+	guile_filter_doc_snarfage$(EEXECT); this should run on BUILD host.
+	Add missing $(EXEEXT) to guile_filter_doc_snarfage invocation.
+
+	* guile.c, iselect.h, net_db.c, posix.c, socket.c: Cygwin compile
+	fixes. 
+
 2002-06-18  Marius Vollmer  <mvo@zagadka.ping.de>
 
 	* print.c (scm_simple_format): Print missing part of format before
Index: libguile/Makefile.am
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/Makefile.am,v
retrieving revision 1.138.2.21
diff -p -u -r1.138.2.21 Makefile.am
--- libguile/Makefile.am	9 Apr 2002 17:24:41 -0000	1.138.2.21
+++ libguile/Makefile.am	3 Jul 2002 15:40:20 -0000
@@ -33,14 +33,33 @@ ETAGS_ARGS = --regex='/SCM_\(GLOBAL_\)?\
 
 lib_LTLIBRARIES = libguile.la
 bin_PROGRAMS = guile
+
 noinst_PROGRAMS = guile_filter_doc_snarfage
+guile_filter_doc_snarfage_SOURCES = c-tokenize.c
+
+## Override default rule; this should be compiled for BUILD host.
+## For some reason, OBJEXT does not include the dot
+c-tokenize.$(OBJEXT): c-tokenize.c
+	if [ "$(cross_compiling)" = "yes" ]; then \
+		$(CC_FOR_BUILD) -c -o $@ $<; \
+	else \
+		$(COMPILE) -c -o $@ $<; \
+	fi
+
+## Override default rule; this should run on BUILD host.
+guile_filter_doc_snarfage$(EXEEXT): $(guile_filter_doc_snarfage_OBJECTS) $(guile_filter_doc_snarfage_DEPENDENCIES) 
+	@rm -f guile_filter_doc_snarfage$(EXEEXT)
+	if [ "$(cross_compiling)" = "yes" ]; then \
+		$(CCLD_FOR_BUILD) -o $@ $(guile_filter_doc_snarfage_OBJECTS); \
+	else \
+		$(LINK) $(guile_filter_doc_snarfage_OBJECTS) $(LDADD) $(LIBS); \
+	fi
+
 
 guile_SOURCES = guile.c
 guile_LDADD = libguile.la
 guile_LDFLAGS = @DLPREOPEN@
 
-guile_filter_doc_snarfage_SOURCES = c-tokenize.c
-
 libguile_la_SOURCES = alist.c arbiters.c async.c backtrace.c boolean.c	    \
     chars.c continuations.c debug.c deprecation.c dynl.c dynwind.c	    \
     environments.c eq.c error.c eval.c evalext.c extensions.c		    \
@@ -197,7 +216,7 @@ SUFFIXES = .x .doc
 .c.doc:
 	-(test -n "${AWK+set}" || AWK="@AWK@"; ${AWK} -f ./guile-func-name-check $<)
 	(./guile-snarf-docs $(snarfcppopts) $< | \
-	./guile_filter_doc_snarfage --filter-snarfage) > $@ || { rm $@; false; }
+	./guile_filter_doc_snarfage$(EXEEXT) --filter-snarfage) > $@ || { rm $@; false; }
 
 $(DOT_X_FILES) $(EXTRA_DOT_DOC_FILES): snarf.h guile-snarf.in
 
Index: libguile/guile.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/guile.c,v
retrieving revision 1.8
diff -p -u -r1.8 guile.c
--- libguile/guile.c	26 Jun 2001 17:53:09 -0000	1.8
+++ libguile/guile.c	3 Jul 2002 15:40:21 -0000
@@ -55,7 +55,8 @@
 #include <libltdl/ltdl.h>
 #endif
 
-#ifdef HAVE_WINSOCK2_H
+#if defined (HAVE_WINSOCK2_H) \
+  && !(defined (__CYGWIN32__) || defined (__CYGWIN__))
 #include <winsock2.h>
 #endif
 
Index: libguile/iselect.h
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/iselect.h,v
retrieving revision 1.9.2.1
diff -p -u -r1.9.2.1 iselect.h
--- libguile/iselect.h	19 Jul 2001 21:28:54 -0000	1.9.2.1
+++ libguile/iselect.h	3 Jul 2002 15:40:21 -0000
@@ -67,7 +67,8 @@
 #include <sys/select.h>
 #endif
 
-#ifdef HAVE_WINSOCK2_H
+#if defined (HAVE_WINSOCK2_H) \
+  && !(defined (__CYGWIN32__) || defined (__CYGWIN__))
 #include <winsock2.h>
 #endif
 
Index: libguile/net_db.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/net_db.c,v
retrieving revision 1.62.2.3
diff -p -u -r1.62.2.3 net_db.c
--- libguile/net_db.c	15 Mar 2002 09:23:19 -0000	1.62.2.3
+++ libguile/net_db.c	3 Jul 2002 15:40:21 -0000
@@ -65,7 +65,8 @@
 
 #include <sys/types.h>
 
-#ifdef HAVE_WINSOCK2_H
+#if defined (HAVE_WINSOCK2_H) \
+  && !(defined (__CYGWIN32__) || defined (__CYGWIN__))
 #include <winsock2.h>
 #else
 #include <sys/socket.h>
Index: libguile/posix.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/posix.c,v
retrieving revision 1.92.2.5
diff -p -u -r1.92.2.5 posix.c
--- libguile/posix.c	15 Mar 2002 10:33:37 -0000	1.92.2.5
+++ libguile/posix.c	3 Jul 2002 15:40:22 -0000
@@ -95,7 +95,8 @@ extern char *ttyname();
 #ifdef HAVE_IO_H
 #include <io.h>
 #endif
-#ifdef HAVE_WINSOCK2_H
+#if defined (HAVE_WINSOCK2_H) \
+  && !(defined (__CYGWIN32__) || defined (__CYGWIN__))
 #include <winsock2.h>
 #endif
 
Index: libguile/socket.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/socket.c,v
retrieving revision 1.80.2.3
diff -p -u -r1.80.2.3 socket.c
--- libguile/socket.c	15 Mar 2002 09:23:19 -0000	1.80.2.3
+++ libguile/socket.c	3 Jul 2002 15:40:22 -0000
@@ -61,7 +61,8 @@
 #include <unistd.h>
 #endif
 #include <sys/types.h>
-#ifdef HAVE_WINSOCK2_H
+#if defined (HAVE_WINSOCK2_H) \
+  && !(defined (__CYGWIN32__) || defined (__CYGWIN__))
 #include <winsock2.h>
 #else
 #include <sys/socket.h>

