diff -purNX .cvsignore ../mknetrel.cvs/.cvsignore ./.cvsignore
--- ../mknetrel.cvs/.cvsignore	Thu Jan  1 01:00:00 1970
+++ ./.cvsignore	Mon Jul  8 02:54:17 2002
@@ -0,0 +1,5 @@
+CVS
+*~
+#*
+.#*
+.bash_mknetrel
diff -purNX .cvsignore ../mknetrel.cvs/ChangeLog ./ChangeLog
--- ../mknetrel.cvs/ChangeLog	Mon Jul  8 01:41:27 2002
+++ ./ChangeLog	Mon Jul  8 02:25:43 2002
@@ -1,3 +1,33 @@
+2002-07-08  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* bin/mknetrel (lib_name):
+	(devel_name):
+	(doc_name): New function: Return name of subpackage.
+	(lib_split):
+	(devel_split):
+	(doc_split): New function: Attempt at splitting a subpacke by name.
+	(domkdist): Support for packaging subpackages.
+	
+2002-07-07  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* patch/guile-1.5.6-3.patch: New file.  The patch directory
+	contains patches for packages that have not yet been officially
+	packaged for Cygwin, but can probably be built.
+	
+	* bin/mknetrel: Add -f function to force downloading.  Adapt usage
+	message.
+	(die):
+	(drop):
+	(tarball_sort):
+	(split):
+	(setvars2):
+	(download):
+	(untar): New function.  These functions are taken and adapted from
+	the cygwin-cross tools and support downloading of latest pristine
+	tarball, untarring and patching.
+
+	* extra/guile: New file.
+
 2002-07-06  Christopher Faylor  <cgf@redhat.com>
 
 	* mknetrel (doconfig): Export CC_FOR_TARGET and CXX_FOR_TARGET.
diff -purNX .cvsignore ../mknetrel.cvs/bin/mknetrel ./bin/mknetrel
--- ../mknetrel.cvs/bin/mknetrel	Sun Jul  7 04:49:10 2002
+++ ./bin/mknetrel	Mon Jul  8 03:05:38 2002
@@ -1,54 +1,120 @@
 #!/bin/bash
 
+# Exit upon error
+set -e
+
+# Interactive shell with state of bash at exit upon failure
+# todo: optional 'dodrop' etc.
+function drop ()
+{
+    [ "$?" -eq 0 ] && trap - 0 9 15 && exit 0 || true
+    echo "$0: dropping to shell..."
+    set | sed -e 's/^\(BASH_VERSINFO=\)/#\1/' \
+	-e 's/^\(EUID=\)/#\1/' \
+	-e 's/^\(PPID=\)/#\1/' \
+	-e 's/^\(SHELLOPTS=\)/#\1/' \
+	-e 's/^\(UID=\)/#\1/' > .bash_mknetrel
+    echo "PS1='mknetrel-debug \w$ '" >> .bash_mknetrel
+    exec bash --rcfile .bash_mknetrel
+}
+
+# Call drop at exit
+trap drop 0 9 15
+
+error ()
+{
+	msg=${1:-$0:aborted}
+	code=${2:-1}
+	echo "error: $msg"
+	# Make sure we drop
+	false
+	drop
+	exit $code
+}
+
 read_user_config() {
     [ -r "$HOME/.mknetrel" ] && . "$HOME/.mknetrel"
     : ${netrel_root=/netrel}
-    : ${build_cxx='i686-pc-cygwin-g++'}
-    : ${build_cc='i686-pc-cygwin-gcc'}
-    : ${build_ranlib='i686-pc-cygwin-ranlib'}
-    : ${build_dllwrap='i686-pc-cygwin-dllwrap'}
-    : ${build_ar='i686-pc-cygwin-ar'}
-    : ${build_nm='i686-pc-cygwin-nm'}
-    : ${build_strip='i686-pc-cygwin-strip'}
-    : ${build_config_opts='--build=i686-pc-linux --host=i686-pc-cygwin --target=i686-pc-cygwin'}
+    : ${cygwin_root=/cygwin}
+    : ${cygwin_prefix=/cygwin/usr}
+    : ${archive=ftp://sunsite.auc.dk/mirrors/cygwin/release}
+    : ${local_archive=file:/tmp}
+    : ${wget=wget}
+#    : ${cbuild="$(gcc -dumpmachine)"}
+    : ${cbuild='i686-pc-linux'}
+    : ${chost='i686-pc-cygwin'}
+    : ${ctarget=$chost}
+    : ${build_cxx="$chost-g++"}
+    : ${build_cc="$chost-gcc"}
+    : ${build_ld="$chost-ld"}
+    : ${build_ranlib="$chost-ranlib"}
+    : ${build_dllwrap="$chost-dllwrap"}
+    : ${build_ar="$chost-ar"}
+    : ${build_nm="$chost-nm"}
+    : ${build_strip="$chost-strip"}
+    : ${build_config_opts="--build=$cbuild --host=$chost --target=$ctarget"}
+}
+
+function makedir () {
+    mkdir -p "$1" || error "can't mkdir \`$1'"
 }
 
 setvars() {
+    #
+    verbose
+
+    here=$(pwd)
+    mknetrel=$here
+    
+    downloads=$netrel_root/src
+    uploads=$netrel_root/uploads
+    extra=$mknetrel/extra
+    patch=$mknetrel/patch
+
+    makedir $netrel_root/download
+
+    package=$what
+    base=`expr "$package" : '\([^-]*\)-*.*$'`
+    BUILD=-1
+    archive_dir=$base
+    cygtargz=.tar.bz2
+    xzf=-xjf
+    tzf=-tjf
+    tarball=$(ls -1 $downloads/$base*$cygtargz | tarball_sort)
+    prefix=/usr
+}
+
+setvars2() {
     cd $netrel_root || exit 1
-    here=`pwd`
     if newest; then
-	cd src
-	for f in $1-[0-9]*; do
-	    package=$f
-	done
-	cd ..
+	tarball=$(ls -1 $downloads/$base*$cygtargz | tarball_sort)
+	split $tarball
     else
-	package=`cd src; echo $1-*/.`
+	packagesd=`cd src; echo $package-*/.`
 	newest
-	case "$package" in
-	  *\**) echo "mknetrel: no $1 found" 1>&2
+	case "$packagesd" in
+	    *\**) echo "mknetrel: no $package found" 1>&2
+            exit 1 ;;
+	    *' '*) echo "mknetrel: too many $package""s - $packagesd" 1>&2
 		exit 1 ;;
-	  *' '*) echo "mknetrel: too many $1""s - $package" 1>&2
-		exit 1 ;;
-	  *) package=`expr "$package" : "\(.*\)/."`
+	    *) package=`expr "$packagesd" : "\(.*\)/."`
 	esac
     fi
-
+    
     package_name="$package"
     package_src="$package"
     base=`expr "$package" : '\([^-]*\)-.*$'`
     ver=`expr "$package" : '[^-]*-\(.*\)$'`
-    src="$here/src/$package"
-    build=$here/build/$package
-    inst=$here/inst/$package
-    uploads=$here/uploads
-    extra=$here/extra
+    src="$netrel_root/src/$package"
+    build=$netrel_root/build/$package
+    inst=$netrel_root/inst/$package
     tarstem=$uploads/$package
     src_exclude='>>>InExPlIbAbLe<<<'
 }
 
 setup() {
     background() { return 1; }
+    patchsrc() { :; }
     config() { :; }
     first() { :; }
     newest() { :; }
@@ -74,21 +140,22 @@ setup() {
     read_user_config
     clean=false
     opt="-O2"
-    export knownpath='/cygwin/bin:'
-    while getopts 'itbcCgNnxSoB' o; do
+    export knownpath="$cygwin_root/bin:"
+    while getopts 'itbcCfgNnxSoB' o; do
 	case "$o" in
 	    't') tag() { dotag; } ;;
 	    'b') rebuild() { dorebuild; } ;;
 	    'B') background() { return 0;}; output() { return 0;} ;;
 	    'c') config() { doconfig; }; rebuild() { dorebuild; } ;;
 	    'C') clean=: ;;
+	    'f') download() { dodownload; } ;;
 	    'g') opt="-O2 -g"; rebuild() { dorebuild; } ;;
 	    'i') knownpath= ;;
 	    'n') mkdist() { :; } ;;
 	    'N') newest() { return 1; } ;;
 	    'o') output() { return 0; } ;;
 	    'S') stripbins() { return 1; } ;;
-	    'x') verbose() { set -x; } ;;
+	    'x') verbose() { set -x; verbose=$((verbose+1)); } ;;
 	    '?') exit 1 ;;
 	esac
     done
@@ -100,9 +167,11 @@ setup() {
 	exit 1
     fi
     setvars $what
-
     [ -r "$extra/$what" ] && . "$extra/$what"
-    output && { mkdir -p $netrel_root/log; exec > $netrel_root/log/$what.out 2>&1; }
+    download
+    setvars2 $what
+    
+    output && { mkdir -p $netrel_root/log; exec > $netrel_root/log/$what.out 2>&1; } || true
 }
 
 setup1() {
@@ -119,6 +188,9 @@ setup1() {
     [ -d "$build" ] || clean=:
     [ -d "$build" -a -d "$inst" ] || rebuild() { dorebuild; }
     [ -f "$build"/config.status ] || config() { doconfig; }
+
+    untar
+    
     $clean && { config() { doconfig; }; rebuild() { dorebuild; }; }
 
     mkdir -p $uploads || exit 1
@@ -142,9 +214,9 @@ mystrip() {
 }
 
 doconfig() {
-    CONFIGOPTS="${build_config_opts} "'--enable-haifa --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecdir=/usr/sbin --disable-version-specific-runtime-libs'
+    CONFIGOPTS="${config_opts} ${build_config_opts} "'--enable-haifa --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecdir=/usr/sbin --disable-version-specific-runtime-libs'
     preconfig || exit 1
-    CXX="${build_cxx}" CXX_FOR_TARGET="${build_cc}" CC="${build_cc}" CC_FOR_TARGET="${build_cc}"  GCC_FOR_TARGET="${build_cc}" RANLIB="${build_ranlib}" DLLWRAP="${build_dllwrap}" AR="${build_ar}" NM="${build_nm}" $src/configure $CONFIGOPTS || exit 1
+    CXX="${build_cxx}" CXX_FOR_TARGET="${build_cc}" CC="${build_cc}" CC_FOR_TARGET="${build_cc}"  GCC_FOR_TARGET="${build_cc}" LD="${build_ld}" RANLIB="${build_ranlib}" DLLWRAP="${build_dllwrap}" AR="${build_ar}" NM="${build_nm}" $src/configure $CONFIGOPTS || exit 1
     postconfig || exit 1
 }
 
@@ -155,8 +227,140 @@ addmakeflags() {
     done
 }
 
+function split ()
+{
+	path=$1
+	if [ -z "$path" ]; then
+		true
+		return
+	fi
+	dir=$(dirname $path)
+	file=$(basename $path)
+	x=$file
+	ext=$(expr "$x" : ".*\(-src.tar.gz\)") ||
+		ext=$(expr "$x" : ".*\(-src.tar.bz2\)") ||
+		ext=$(expr "$x" : ".*\(-orig.tar.bz2\)") ||
+		ext=$(expr "$x" : ".*\(-orig.tar.gz\)") ||
+		ext=$(expr "$x" : ".*\(.tar.gz\)") ||
+		ext=$(expr "$x" : ".*\(.tgz\)") ||
+		ext=$(expr "$x" : ".*\(.tar.bz2\)") ||
+		ext=$(expr "$x" : ".*\(.tbz\)") || true
+	x=$(basename $x $ext)
+	cygver=$(expr "$x" : ".*-\([0-9][0-9]*\)$") ||
+		cygver=$BUILD || true
+	x=$(basename $x -$cygver)
+	origver=$(expr "$x" : "[a-zA-Z][-a-zA-Z0-9]*[a-zA-Z][0-9]*-\([0-9][^-/]*\)$") ||
+		if [ $cygver != $BUILD ]; then
+			origver=$cygver
+			cygver=$BUILD
+		else
+			origver=0.0
+		fi
+	name=$(basename $x -$origver)
+	[ -n "$name" ] || error "$package: can't determine version of: $path"
+	
+	package=$name-$origver-$cygver
+}
+
+
+function tarball_sort ()
+{
+	tr '[:space:]' '\n' |
+		sed -e 's/\(.*[-a-zA-Z0-9]*[a-zA-Z]-\)\([0-9][^-/]*\)\(\.tar.*\)/\2.%.%.%.%.%:\1\2\3/' |
+		tr '.' ' ' |
+		sort -nk1 -nk2 -nk3 -nk4 -nk5 |
+		sed -e 's/.*://' |
+		tr ' ' '.'
+}
+
+_download ()
+{
+	expr=$1
+	regexp=$(echo "$expr" | sed -e 's/\.*\*/[-_.+a-zA-Z0-9]*/g')
+	dest_ext=$2
+	localdir=$(expr "$archive" : 'file:\(.*\)') || true
+	[ -z "$localdir" ] && localdir=$downloads
+	www=$(expr "$archive" : 'http:\(.*\)') || true
+	[ -z "$www" ] && dexpr="$expr"
+	ball=$(ls -utr1 $(echo $localdir/$expr) 2>/dev/null | tail -1)
+	opts=" --directory-prefix=$downloads --accept=.listing --dont-remove-listing"
+	[ $verbose -lt 1 ] && opts="$opts --non-verbose"
+	rm -f $downloads/.listing $downloads/index.html
+	if $wget $opts $archive/$archive_dir/$dexpr; then :; else
+		rm -f $downloads/.listing $downloads/index.html
+		$wget $opts $archive/$dexpr ||
+			error "$package: can't download $archive/[$archive_dir/]$expr"
+	fi
+	listing=.listing
+	[ ! -f $downloads/$listing ] && listing=index.html
+	if [ -f $downloads/$listing ]; then
+		get=$(grep "$regexp" $downloads/$listing | sed -e "s@.*\($regexp\).*@\1@" | tarball_sort | tail -1)
+		expr="$get"
+		opts="--timestamping --directory-prefix=$downloads"
+		[ $verbose -lt 1 ] && opts="$opts --non-verbose"
+		if $wget $opts $archive/$archive_dir/$expr; then :; else
+			$wget< $opts $archive/$expr ||
+				error "$package: can't download $archive/[$archive_dir/]/$expr"
+		fi
+	fi
+	ball=$(ls -utr1 $(echo $localdir/$expr) 2>/dev/null | tail -1)
+	[ -n "$ball" ] ||
+		error "$package: can't find or download $expr from $archive"
+	split $ball
+	tarball=$downloads/$package$dest_ext
+	rm -f $tarball
+	e=$(expr $ball : ".*\($cygtargz\)") || true
+	if [ "$e" = "$cygtargz" ]; then
+		ln $ball $tarball || cp -p $ball $tarball
+	elif [ "$cygtargz" = ".tar.gz" ]; then
+		bzip2 -dc $ball | gzip > $tarball
+	else
+		gzip -dc $ball | bzip2 > $tarball
+	fi
+}
+
+dodownload()
+{
+    _download $package*-src.tar.bz2 -orig$cygtargz
+}
+
+download() {
+    [ -r "$tarball" ] || dodownload
+}
+
+_untar ()
+{(
+	tarball=$1
+	dest=$2
+
+	first_dir=$(tar $tzf $tarball | head -1)
+	src_dir=$(dirname $first_dir.)
+
+	dest_base=$(basename $dest)
+	dest_dir=$(cd $(dirname $dest); pwd)
+	cd $dest_dir
+	
+	rm -rf $dest_name =untar
+	mkdir =untar
+	cd =untar
+	tar $xzf $tarball
+
+	mv $src_dir $dest_dir/$dest_base
+	cd $dest_dir
+	rm -rf =untar
+)
+}
+
+dountar() {
+    _untar $tarball $netrel_root/src/$package
+}
+
+untar() {
+    [ -d "$netrel_root/src/$package" ] || { dountar; patchsrc; }
+}
+
 dorebuild() {
-    cd $here || exit 1
+    cd $netrel_root || exit 1
     rm -rf $inst
     if $clean; then
 	rm -rf $build
@@ -196,7 +400,7 @@ dorebuild() {
     needinstall_info && gcc_tooldir=$inst/usr make -i prefix=$inst/usr exec_prefix=$inst/usr bindir=$inst/usr/bin libdir=$inst/usr/lib tcl_libdir=$inst/usr/lib sysconfdir=$inst/etc includedir=$inst/usr/include tooldir=$inst/usr gcc_tooldir=$inst/usr libexecdir=$inst/sbin \
 AM_MAKEFLAGS="prefix=$inst/usr exec_prefix=$inst/usr bindir=$inst/usr/bin libdir=$inst/usr/lib tcl_libdir=$inst/usr/lib sysconfdir=$inst/etc includedir=$inst/usr/include tooldir=$inst/usr gcc_tooldir=$inst/usr libexecdir=$inst/usr/sbin" install-info || :
     postinstall
-    cd $here || exit 1
+    cd $netrel_root || exit 1
 }
 
 readlink() {
@@ -278,6 +482,50 @@ dousrstuff() {
     hard2soft
 }
 
+lib_name () {
+    echo lib$base$sover
+}
+
+devel_name () {
+    echo $base-devel
+}
+
+doc_name () {
+    echo $base-doc
+}
+
+lib_split () {
+
+  # libguileX
+
+  makedir ./$prefix/bin
+  mv $inst/$prefix/bin/*.dll ./$prefix/bin
+  makedir ./$prefix/share
+  mv $inst/$prefix/share/$base ./$prefix/share
+}
+   
+devel_split () {
+
+  # libguile-devel
+
+  makedir ./$prefix/bin
+  mv $inst/$prefix/bin/guile-* ./$prefix/bin
+  mv $inst/$prefix/include ./$prefix/include
+  makedir ./$prefix/lib
+  mv $inst/$prefix/lib/*.a ./$prefix/lib
+  mv $inst/$prefix/lib/*.la ./$prefix/lib
+  makedir ./$prefix/share
+  mv $inst/$prefix/share/aclocal ./$prefix/share
+}
+
+doc_split () {
+
+  # guile-doc
+  
+  makedir ./$prefix
+  mv $inst/$prefix/info ./$prefix
+}
+
 domkdist() {
     #
     # Fix up installation slightly
@@ -288,14 +536,45 @@ domkdist() {
 
     cd $inst || exit 1
     prepackage
-    cd $inst || exit 1
 
+    for i in $subpackages; do
+	subname=$(${i}_name)
+        rm -rf $inst-$i
+	makedir $inst-$i
+  	cd $inst-$i
+	${i}_split || exit 1
+    done
+    
     #
     # Make tar balls
     #
+
+    # The base package
     echo creating $tarstem.tar.bz2
+    cd $inst || exit 1
+
+    # We need som standardization for these hint file names,
+    # and we'll certainly will never get a directory named
+    # CYGWIN-PATCHES merged upstream.
+    # What about checking for `./cygwin/changelog', or something that
+    # should most probably be unique?
+    f=$src/CYGWIN-PATCHES/setup.hint test -r $f && cp $f $uploads/$base || true
+    f=$src/CYGWIN-PATCHES/$base.hint test -r $f && cp $f $uploads/$base/setup.hint  || true
     find * -print | sort | tar -T - --no-recursion -cjf $tarstem.tar.bz2
 
+    # The sub packages
+    for i in $subpackages; do
+	subname=$(${i}_name)
+	subload=$uploads/$subname
+	subtarstem=$subload/$subname-$ver
+	makedir $subload
+	echo creating $subtarstem.tar.bz2
+	f=$src/CYGWIN-PATCHES/$subname.hint test -r $f && cp $f $subload/setup.hint || true
+  	cd $inst-$i
+	find * -print | sort | tar -T - --no-recursion -cjf $subtarstem.tar.bz2
+    done
+
+    # The source package
     cd $src/.. || exit 1
     echo creating "$tarstem"-src.tar.bz2
     find $package_src/* -print -follow | egrep -v '\.cvsignore|\.bak$|\.orig$|\.o$|~$|^.#|CVS|%redact|/tags$' | egrep -v "$src_exclude" | sort | tar -T - --no-recursion -cjf "$tarstem"-src.tar.bz2
@@ -306,22 +585,27 @@ dotag() {
     cd $src || exit 1
     cygtag=`echo $package | sed 's/\./_/g'`
     cvs -q tag -c "$cygtag"
-    cd $here || exit 1
+    cd $netrel_root || exit 1
 }
 
 usage() {
     echo "mknetrel: $*
-usage:
-mknetrel -t what	Tag sourceware with release info
-mknetrel -b what	Do a rebuild/install
-mknetrel -c what	Do a configure prior to rebuild
-mknetrel -C what	Do a clean prior to rebuild/install
-mknetrel -g what	Add -g option when compiling with gcc
-mknetrel -n what	Don't build the distribution tar files
-mknetrel -x what	Verbose shell output
+Usage: mknetrel [OPTION]... [PACKAGE]
 
-what = the name of something in $here/src, like 'gdb'" 1>&2
-    exit 1
+Options:
+  -t    Tag sourceware with release info
+  -b    Rebuild/install
+  -c    Configure prior to rebuild
+  -C    Clean prior to rebuild/install
+  -f    Force download of latest version
+  -g    Add -g option when compiling with gcc
+  -n    Don't build the distribution tar files
+  -x    Verbose shell output
+
+Available packages:
+  $(cd $(dirname $0)/../extra && echo *[a-z])
+" 1>&2
+    trap - 0 9 15 && exit 1
 }
 
 rest() {
diff -purNX .cvsignore ../mknetrel.cvs/extra/bc ./extra/bc
--- ../mknetrel.cvs/extra/bc	Mon Apr 22 16:32:26 2002
+++ ./extra/bc	Sun Jul  7 14:09:54 2002
@@ -3,7 +3,7 @@ needdevoflags() {
 }
 
 preconfig() {
-    LIBS=`i686-pc-cygwin-gcc --print-file-name=textmode.o`
+    LIBS=`$build_cc --print-file-name=textmode.o`
     export LIBS
     cat <<'EOF' >config.cache
 ac_cv_func_setvbuf=${ac_cv_func_setvbuf=yes}
diff -purNX .cvsignore ../mknetrel.cvs/extra/guile ./extra/guile
--- ../mknetrel.cvs/extra/guile	Thu Jan  1 01:00:00 1970
+++ ./extra/guile	Mon Jul  8 02:59:11 2002
@@ -0,0 +1,143 @@
+# -*- shell-script -*-
+
+# guile specific mknetrel overrides
+
+# stable Guile releases: guile-1.4.1
+# archive=ftp://ftp.gnu.org/pub/gnu
+
+# development releases
+# archive=ftp://alpha.gnu.org/pub/gnu
+
+# alpha is off line...
+archive=$local_archive
+BUILD=3
+sover=14
+
+subpackages="lib devel doc"
+
+needdevoflags () {
+    return 1
+}
+
+dodownload ()
+{
+    _download $package*.tar.gz -orig$cygtargz
+}
+
+patchsrc () {
+    cd $src
+    patch -p1 < $patch/$package.patch
+    aclocal
+    rm -rf libltdl
+    libtoolize --force --copy --automake --ltdl
+    autoheader
+    autoconf
+    
+    # automake --add-missing
+    # Nicholas sez:
+ 
+    rm -f depcomp install-sh mkinstalldirs missing # etc, must look
+    automake --add-missing --copy --include-deps
+}
+
+# do I have a broken setup, do the Guile developers not know how to
+# write configure.in and Makefile.am, or are automake/libtool broken?
+preconfig () { # aka libtool_woes ()
+
+    # what's this? docme
+    # LIBS=`i686-pc-cygwin-gcc --print-file-name=binmode.o`
+    # LIBS=`i686-pc-cygwin-gcc --print-file-name=textmode.o`
+    # export LIBS
+
+    # Help automake with confusing EXEEXT variable.
+    # In our case, we actually have: BUILD_EXEXT= HOST_EXEEXT=.exe
+    EXTRABUILDARGS="EXEEXT="
+    EXTRAINSTALLARGS="EXEEXT="
+
+    # Convince libtool that 'SED=' won't work.
+    export SED=sed
+
+    # can't add these to CFLAGS/LDFLAGS, would end up in libguile.*
+    # and thus show in guile-config script
+
+    # libtoolflags="-I$PREFIX/include -L$PREFIX/lib -L$PREFIX/lib/w32api -L$PREFIX/bin"
+    libtoolflags="-I$cygwin_prefix/include -L$cygwin_prefix/lib -L$cygwin_prefix/lib/w32api -L$cygwin_prefix/bin"
+    # libtoolflags=$("$build_cc" -print-search-dirs  | grep '^libraries:' | sed -e 's/^libraries: */ :/' -e 's/:/ -L/g' -e 's/  */ /g' -e 's/ *$//')
+    guileflags="-L../libguile/.libs" 
+    build_cc="${build_cc} $libtoolflags $guileflags"
+    build_cxx="${build_cxx} $libtoolflags $guileflags"
+    
+    # FIX libtool's -rpath detection
+    export CC="${build_cc}"
+    export CXX="${build_cxx}"
+
+    # another libtool fix
+    mkdir -p libguile/.libs
+
+    # anyway, Libtool doesn't like it
+    # libtool: link: cannot build libtool library `libguile.la' from non-libtool objects on this host: /home/cygwin/cygwin-1.3.10/usr/lib/textmode.o
+
+    ## config_opts="--config-cache"
+    ## cat < <'EOF' > config.cache
+    
+    config_opts="--cache-file=/dev/null"
+    export CONFIG_SITE=$(pwd)/config.site
+    cat <<'EOF' > config.site
+libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path=/home/cygwin/cygwin-1.3.10/usr/lib} ## ugh, quick workaround
+ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
+ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p=4}
+ac_cv_sizeof_char=${ac_cv_sizeof_char=1}
+ac_cv_sizeof_int=${ac_cv_sizeof_int=4}
+ac_cv_sizeof_long=${ac_cv_sizeof_long=4}
+ac_cv_sizeof_float=${ac_cv_sizeof_float=4}
+ac_cv_sizeof_double=${ac_cv_sizeof_double=8}
+ac_cv_c_long_size_t=${ac_cv_c_long_size_t=no}
+ac_cv_c_long_time_t=${ac_cv_c_long_time_t=yes}
+ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls=no}
+ac_cv_sprintf_count=${ac_cv_sprintf_count=yes}
+ac_cv_spinlocks=${ac_cv_spinlocks=no}
+ac_cv_func_getpgrp_void=${ac_cv_func_getpgrp_void=yes}
+ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed=no}
+ac_cv_func_mkfifo=yes
+guile_cv_func_usleep_declared=${guile_cv_func_usleep_declared=yes}
+
+# Try at preventing to break make rules while crosscompiling.  This
+# used work, but nowadays ./configure thinks it knows better than me.
+
+# But what ./configure doesn't know, is that automake and libtool are
+# broken wrt cross-building, and wrt cc_for_build.  See new
+# workarounds above.
+
+ac_exeext=${ac_exeext=}
+ac_cv_exeext=${ac_cv_exeext=}
+guile_cv_exeext=${guile_cv_exeext=}
+EOF
+}
+
+
+postconfig () {
+    # Here's another lib for you, libtool 
+    cp -f libtool guile-readline
+}
+
+#prebuild () {
+#    false # shell here
+#}
+
+
+prepackage () {
+  ## Cygwin doesn't adhere to FHS (and why should they?)
+  ##docdir=$prefix/share/doc/$name-$version
+  docdir=$prefix/doc/$name-$ver
+
+  cd $src
+  makedir $inst/$docdir
+   ## cp -p ANON-CVS AUTHORS BUGS COPYING ChangeLog HACKING INSTALL LICENSE NEWS README SNAPSHOTS THANKS $inst/$docdir
+  cp -p ANON-CVS AUTHORS BUGS COPYING ChangeLog HACKING INSTALL NEWS README SNAPSHOTS THANKS $inst/$docdir
+  cp -p CYGWIN-PATCHES/README $inst/$docdir/README.Cygwin
+  cp -p CYGWIN-PATCHES/changelog $inst/$docdir/changelog.Cygwin
+  makedir $inst/$prefix/doc/Cygwin
+  cp -p CYGWIN-PATCHES/README $inst/$prefix/doc/Cygwin/$package.README
+  makedir $inst/$prefix/man/man1
+  cp -p doc/guile.1 $inst/$prefix/man/man1
+}
\ No newline at end of file
diff -purNX .cvsignore ../mknetrel.cvs/extra/texinfo ./extra/texinfo
--- ../mknetrel.cvs/extra/texinfo	Thu May 30 22:08:30 2002
+++ ./extra/texinfo	Sun Jul  7 14:10:14 2002
@@ -15,7 +15,7 @@ prebuild() {
     echo '******* NOTICE: Using makeinfo in /usr/local/bin *******'
     addmakeflags MAKEDOC=/usr/local/bin/makedoc
     addmakeflags MAKEINFO=/usr/local/bin/makeinfo
-    addmakeflags LIBS=`i686-pc-cygwin-gcc --print-file-name=automode.o`
+    addmakeflags LIBS=`$build_cc --print-file-name=automode.o`
 }
 
 needdevoflags() {
diff -purNX .cvsignore ../mknetrel.cvs/patch/guile-1.5.6-3.patch ./patch/guile-1.5.6-3.patch
--- ../mknetrel.cvs/patch/guile-1.5.6-3.patch	Thu Jan  1 01:00:00 1970
+++ ./patch/guile-1.5.6-3.patch	Sun Jul  7 19:23:59 2002
@@ -0,0 +1,1274 @@
+diff -purN /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/README ./CYGWIN-PATCHES/README
+--- /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/README	Thu Jan  1 01:00:00 1970
++++ ./CYGWIN-PATCHES/README	Fri Jul  5 11:15:29 2002
+@@ -0,0 +1,61 @@
++Guile
++------------------------------------------
++The GNU extension language and Scheme interpreter.
++
++Runtime requirements:
++  cygwin-1.3.10 or newer
++  libguile14
++
++Build requirements:
++  cygwin-1.3.10 or newer
++  binutils-20011102 or newer
++  gcc-2.95.3-5 or newer
++  autoconf CVS (20020703) or newer,
++    autoconf-devel-2.53a-1 should be ok.
++  automake CVS (20020703) or newer,
++    automake-devel-1.6.1-3 should be ok.
++  libtool CVS (20020703) or newer,
++    libtool-devel-20020502-2 should be ok.
++
++Canonical homepage:
++  http://www.gnu.org/software/guile/
++
++Canonical download:
++  ftp://ftp.gnu.org/pub/gnu/guile/
++  
++------------------------------------
++
++Build instructions:
++
++  unpack guile-1.5.6-3-src.tar.bz2
++    if you use setup to install this src package, it will be
++	 unpacked under /usr/src automatically
++  cd /usr/src
++  DISTDIR=/usr/src ./guile-1.5.6-3.sh all
++
++This will create:
++  $DISTDIR/guile/guile-1.5.6-3-orig.tar.bz2
++  $DISTDIR/guile/guile-1.5.6-3-src.tar.bz2
++  $DISTDIR/guile/guile-1.5.6-3.tar.bz2
++  $DISTDIR/guile/guile-doc/guile-doc-1.5.6-3.tar.bz2
++  $DISTDIR/guile/libguile-devel/libguile-devel-1.5.6-3.tar.bz2
++  $DISTDIR/guile/libguile14/libguile14-1.5.6-3.tar.bz2
++
++------------------
++
++Port notes:
++
++  Patches with Cygwin compile fixes and cross building fixes have
++  been sent upstream.
++
++  These packages were built on GNU/Linux using cross building and
++  packaging scripts:
++
++      http://lilypond.org/cygwin/cygwin-cross.tar.gz
++
++  that process has been captured in cross-guile-1.5.6-3.sh
++
++  Jan Nieuwenhuizen
++  janneke@gnu.org
++
++Cygwin port maintained by: Jan Nieuwenhuizen  <janneke@gnu.org> 
+diff -purN /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/changelog ./CYGWIN-PATCHES/changelog
+--- /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/changelog	Thu Jan  1 01:00:00 1970
++++ ./CYGWIN-PATCHES/changelog	Fri Jul  5 11:17:21 2002
+@@ -0,0 +1,36 @@
++guile (1.5.6-3) unstable; urgency=low
++
++  * Bugfix for native buildscript.
++
++ -- Jan Nieuwenhuizen <janneke@gnu.org>  Fri,  5 Jul 2002 11:17:21 +0200
++
++guile (1.5.6-2) unstable; urgency=low
++
++  * Fix srfi library names.
++  * Development package now named libguile-devel (previously
++    libguile14-dev.
++  * Import libs *.dll.a now in libguile-devel package.
++  * Add external-source: to all subpackage's .hint files.
++  * Fix permissions (sticky bit) and ownership of tarball contents.
++  * guile.m4 now in libguile-devel:/usr/share/aclocal (previously
++    erroneoulsy in libguile14:/usr/aclocal).
++  * Strip /usr/bin/guile.exe; upstream install apparently doesn't do
++    this.
++  * Prefix generated cross build script with 'cross-'.
++  * Add a native Cygwin buildscript, the generic build script at
++    http://cygwin.com/setup.html, modified by pasting splitting and
++    (sub)packaging from the cross build scripts.  Somewhat tested, runs
++    fine on GNU/Linux.
++  * Fix install of guile.1 manual for guile-1.5.6-release.
++
++ -- Jan Nieuwenhuizen <janneke@gnu.org>  Fri,  5 Jul 2002 02:06:38 +0200
++
++Guile (1.5.6-1) unstable; urgency=low
++
++  * Initial Release.
++
++ -- Jan Nieuwenhuizen <janneke@gnu.org>  Thu,  3 Jul 2002 04:28:07 +0200
++
++Local variables:
++mode: debian-changelog
++End:
+diff -purN /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/guile-doc.hint ./CYGWIN-PATCHES/guile-doc.hint
+--- /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/guile-doc.hint	Thu Jan  1 01:00:00 1970
++++ ./CYGWIN-PATCHES/guile-doc.hint	Thu Jul  4 18:25:25 2002
+@@ -0,0 +1,9 @@
++sdesc: "The GNU extension language and Scheme interpreter (documentation)"
++category: doc
++requires: cygwin
++external-source: guile
++ldesc: "The GNU extension language and Scheme interpreter (documentation)
++This package contains the documentation for guile, including both
++a reference manual (via `info guile'), and a tutorial (via `info
++guile-tut')."
++
+diff -purN /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/guile.hint ./CYGWIN-PATCHES/guile.hint
+--- /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/guile.hint	Thu Jan  1 01:00:00 1970
++++ ./CYGWIN-PATCHES/guile.hint	Thu Jul  4 12:11:15 2002
+@@ -0,0 +1,12 @@
++sdesc: "The GNU extension language and Scheme interpreter (executable)"
++category: interpreters
++requires: cygwin libguile14 
++ldesc: "The GNU extension language and Scheme interpreter (executable)
++Guile, the GNU Ubiquitous Intelligent Language for Extension, is a scheme
++implementation designed for real world programming, supporting a
++rich Unix interface, a module system, and undergoing rapid development.
++
++`guile' is a scheme interpreter that can execute scheme scripts (with a
++#! line at the top of the file), or run as an inferior scheme
++process inside Emacs."
++
+diff -purN /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/guile.sh ./CYGWIN-PATCHES/guile.sh
+--- /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/guile.sh	Thu Jan  1 01:00:00 1970
++++ ./CYGWIN-PATCHES/guile.sh	Fri Jul  5 11:08:31 2002
+@@ -0,0 +1,339 @@
++#!/bin/sh
++
++# Generic Cygwin build script -- modified for guile-1.5.6
++# Jan Nieuwenhuizen <janneke@gnu.org>
++#
++# Note: guile-1.5.6 has not been built using this script,
++#       but rather using the cross build scripts at:
++#
++#           http://lilypond.org/cygwin/cygwin-cross.tar.gz
++#
++#       that process has been captured in cross-guile-1.5.6-2.sh
++#
++# TODO:
++# 
++#  * Shell scripts should start with: set -e
++#  * More generic sub-package handling
++
++
++# find out where the build script is located
++tdir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
++test "x$tdir" = "x$0" && tdir=.
++scriptdir=`cd $tdir; pwd`
++# find src directory.  
++# If scriptdir ends in SPECS, then topdir is $scriptdir/.. 
++# If scriptdir ends in CYGWIN-PATCHES, then topdir is $scriptdir/../..
++# Otherwise, we assume that topdir = scriptdir
++topdir1=`echo ${scriptdir} | sed 's%/SPECS$%%'`
++topdir2=`echo ${scriptdir} | sed 's%/CYGWIN-PATCHES$%%'`
++if [ "x$topdir1" != "x$scriptdir" ] ; then # SPECS
++  topdir=`cd ${scriptdir}/..; pwd`
++else
++  if [ "x$topdir2" != "x$scriptdir" ] ; then # CYGWIN-PATCHES
++    topdir=`cd ${scriptdir}/../..; pwd`
++  else
++    topdir=`cd ${scriptdir}; pwd`
++  fi
++fi
++
++tscriptname=`basename $0 .sh`
++export PKG=`echo $tscriptname | sed -e 's/\-[^\-]*\-[^\-]*$//'`
++export VER=`echo $tscriptname | sed -e 's/^[^\-]*\-//' -e 's/\-[^\-]*$//'`
++export REL=`echo $tscriptname | sed -e 's/^[^\-]*\-[^\-]*\-//'`
++export FULLPKG=${PKG}-${VER}-${REL}
++# if the orig src package is bzip2'ed, remember to
++# change 'z' to 'j' in the 'tar xvzf' commands in the
++# prep) and mkpatch) sections
++export src_orig_pkg_name=${FULLPKG}-orig.tar.bz2
++export src_pkg_name=${FULLPKG}-src.tar.bz2
++export src_patch_name=${FULLPKG}.patch
++export bin_pkg_name=${FULLPKG}.tar.bz2
++
++export src_orig_pkg=${topdir}/${src_orig_pkg_name}
++export src_pkg=${topdir}/${src_pkg_name}
++export src_patch=${topdir}/${src_patch_name}
++export bin_pkg=${topdir}/${bin_pkg_name}
++export srcdir=${topdir}/${PKG}-${VER}
++export objdir=${srcdir}/.build
++export instdir=${srcdir}/.inst
++export srcinstdir=${srcdir}/.sinst
++export checkfile=${topdir}/${FULLPKG}.check
++# run on
++host=`gcc -dumpmachine`
++# if this package creates binaries, they run on
++target=$host
++prefix=/usr
++sysconfdir=/etc
++MY_CFLAGS="-O2 -g"
++MY_LDFLAGS=
++
++mkdirs() {
++  (cd ${topdir} && \
++  mkdir -p ${objdir} && \
++  mkdir -p ${instdir} && \
++  mkdir -p ${srcinstdir} )
++}
++prep() {
++  (cd ${topdir} && \
++  tar xvjf ${src_orig_pkg} ; \
++  cd ${topdir}/$PKG-$VER && \
++  patch -p0 < ${src_patch} \
++  && mkdirs )
++}
++conf() {
++  (cd ${objdir} && \
++  CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
++  ${srcdir}/configure --host=${host} --target=${target} \
++  --srcdir=${srcdir} --prefix=${prefix} \
++  --exec-prefix=${prefix} --sysconfdir=${sysconfdir} \
++  --libdir=${prefix}/lib --includedir=${prefix}/include \
++  --libexecdir='${sbindir}' --localstatedir=/var \
++  --datadir='${prefix}/share'
++)
++}
++build() {
++  (export SED=sed # libtool fix
++   cd ${objdir} && \
++   CFLAGS="${MY_CFLAGS}" make )
++}
++check() {
++  (cd ${objdir} && \
++  make test | tee ${checkfile} 2>&1 )
++}
++clean() {
++  (cd ${objdir} && \
++  make clean )
++}
++install() {
++  (export SED=sed # libtool fix
++  cd ${objdir} && \
++  make install DESTDIR=${instdir} 
++  if [ -f ${instdir}${prefix}/info/dir ] ; then \
++    rm ${instdir}${prefix}/info/dir ; \
++  fi && \
++  if [ ! -d ${instdir}${prefix}/doc/${PKG}-${VER} ]; then \
++    mkdir -p ${instdir}${prefix}/doc/${PKG}-${VER} ; \
++  fi && \
++  if [ ! -d ${instdir}${prefix}/doc/Cygwin ]; then \
++    mkdir -p ${instdir}${prefix}/doc/Cygwin ; \
++  fi && \
++  templist=""; \
++  for f in ${srcdir}/ANNOUNCE ${srcdir}/CHANGES ${srcdir}/INSTALL \
++           ${srcdir}/KNOWNBUG ${srcdir}/LICENSE ${srcdir}/README \
++			  ${srcdir}/TODO ; do \
++    if [ -f $f ] ; then \
++      templist="$templist $f"; \
++    fi ; \
++  done && \
++  if [ ! "x$templist" = "x" ]; then \
++    /usr/bin/install -m 644 $templist \
++         ${instdir}${prefix}/doc/${PKG}-${VER} ;
++  fi && \
++  if [ -f ${srcdir}/CYGWIN-PATCHES/${PKG}.README ]; then \
++    /usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/${PKG}.README \
++      ${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
++  else \
++    if [ -f ${srcdir}/CYGWIN-PATCHES/README ]; then \
++      /usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/README \
++        ${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
++    fi ;\
++  fi ; \
++  if [ -f ${srcdir}/CYGWIN-PATCHES/${PKG}.changelog ]; then \
++    /usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/changelog \
++      ${instdir}${prefix}/doc/${PKG}-${VER}/changelog.Cygwin ; \
++  fi ; \
++  if [ -f ${srcdir}/CYGWIN-PATCHES/postinstall.sh ]; then \
++    if [ ! -d ${instdir}${sysconfdir}/postinstall ]; then \
++      mkdir -p ${instdir}${sysconfdir}/postinstall ; \
++    fi ; \
++    /usr/bin/install -m 755 ${srcdir}/CYGWIN-PATCHES/postinstall.sh \
++      ${instdir}${sysconfdir}/postinstall/${PKG}.sh; \
++  fi
++  )
++}
++strip() {
++  (cd ${instdir} && \
++  find . -name "*.dll" | xargs strip > /dev/null 2>&1
++  find . -name "*.exe" | xargs strip > /dev/null 2>&1 ) || true # for Linux
++}
++simplepkg() {
++  (cd ${instdir} && \
++  tar cvjf ${bin_pkg} * )
++}
++split() {
++  # this all very package-specific
++
++  # setup compatibility vars
++  cyggz=.bz2
++  cygtargz=.tar$cyggz
++  czf="--owner=0 --group=0 -cjf"
++  name=$PKG
++  cygpack=$FULLPKG
++  tardir=$topdir
++  sourcedir=$srcdir
++  installroot=$instdir
++
++  ### BEGIN imported from cygwin-cross/stage/guile-1.5.6.postinstall
++
++  ## this fixes suffixes, already done here
++  ## . $stagedir/native.postinstall
++
++  ## Cygwin doesn't adhere to FHS (and why should they?)
++  ##docdir=$prefix/share/doc/$name-$version
++  docdir=$prefix/doc/$name-$version
++
++  # guile
++
++  (cd $sourcedir
++
++   ## already done here
++   ## strip $installroot/$prefix/bin/guile.exe
++
++   mkdir -p $installroot/$docdir
++   ## cp -p ANON-CVS AUTHORS BUGS COPYING ChangeLog HACKING INSTALL LICENSE NEWS README SNAPSHOTS THANKS $installroot/$docdir
++   cp -p ANON-CVS AUTHORS BUGS COPYING ChangeLog HACKING INSTALL NEWS README SNAPSHOTS THANKS $installroot/$docdir
++   cp -p CYGWIN-PATCHES/README $installroot/$docdir/README.Cygwin
++   cp -p CYGWIN-PATCHES/changelog $installroot/$docdir/changelog.Cygwin
++   mkdir -p $installroot/$prefix/doc/Cygwin
++   cp -p CYGWIN-PATCHES/README $installroot/$prefix/doc/Cygwin/$cygpack.README
++   mkdir -p $installroot/$prefix/man/man1
++   cp -p doc/guile.1 $installroot/$prefix/man/man1)
++
++  # libguileX
++
++  rm -rf $installroot-lib$name$SO
++  mkdir -p $installroot-lib$name$SO
++
++  (cd $installroot-lib$name$SO
++   mkdir -p ./$prefix/bin
++   mv $installroot/$prefix/bin/*.dll ./$prefix/bin
++   # mkdir -p ./$prefix/man/man1
++   # mv $installroot/$prefix/man/man1/guile-* ./$prefix/man/man1
++   mkdir -p ./$prefix/share
++   mv $installroot/$prefix/share/guile ./$prefix/share)
++
++  # libguile-devel
++
++  rm -rf $installroot-lib$name-devel
++  mkdir -p $installroot-lib$name-devel
++
++  (cd $installroot-lib$name-devel
++   mkdir -p ./$prefix/bin
++   mv $installroot/$prefix/bin/guile-* ./$prefix/bin
++   mv $installroot/$prefix/include ./$prefix/include
++   mkdir -p ./$prefix/lib
++   mv $installroot/$prefix/lib/*.a ./$prefix/lib
++   mv $installroot/$prefix/lib/*.la ./$prefix/lib
++   mkdir -p ./$prefix/share
++   mv $installroot/$prefix/share/aclocal ./$prefix/share)
++
++  # guile-doc
++
++  rm -rf $installroot-$name-doc
++  mkdir -p $installroot-$name-doc
++
++  (cd $installroot-$name-doc
++   mkdir -p ./$prefix
++   mv $installroot/$prefix/info ./$prefix)
++
++   ### END imported from cygwin-cross/stage/guile-1.5.6.postinstall
++}
++pkg() {
++  # this all very package-specific
++
++  # setup compatibility vars
++  cyggz=.bz2
++  cygtargz=.tar$cyggz
++  czf="--owner=0 --group=0 -cjf"
++  name=$PKG
++  cygpack=$FULLPKG
++  tardir=$topdir
++  sourcedir=$srcdir
++  installroot=$instdir
++
++  ### BEGIN imported from cygwin-cross/stage/guile-1.5.6.tar
++
++  # guile
++
++  mkdir -p $tardir/$name
++
++  # ugh, automate and fix this
++  chmod -R a-s+rX $installroot
++  chmod -R g-w $installroot
++  (cd $installroot/ && tar $czf $tardir/$name/$cygpack$cygtargz *)
++  cp -pv $sourcedir/CYGWIN-PATCHES/$name.hint $tardir/$name/setup.hint
++
++  # libguileX libguile-devel guile-doc
++
++  for i in lib$name$SO lib$name-devel $name-doc; do
++	  mkdir -p $tardir/$name/$i
++	  cygpacki=$i-$version-$build
++	  # ugh, automate and fix this
++	  chmod -R a-s+rX $installroot-$i
++	  chmod -R g-w $installroot-$i
++	  (cd $installroot-$i/ && tar $czf $tardir/$name/$i/$cygpacki$cygtargz *)
++	  cp -pv $sourcedir/CYGWIN-PATCHES/$i.hint $tardir/$name/$i/setup.hint
++  done
++
++  ## hmm?  already in template.dowload...
++  ## binball=$(ls -utr1 $tardir/$name/$cygpack$cygtargz 2>/dev/null | tail -1)
++
++
++  ### END imported from cygwin-cross/stage/guile-1.5.6.tar
++    
++}
++mkpatch() {
++  (cd ${srcdir} && \
++  tar xvjf ${src_orig_pkg} ;\
++  mv ${PKG}-${VER} ../${PKG}-${VER}-orig && \
++  cd ${topdir} && \
++  rm -f autom4te.cache config.cache && \
++  diff -urN -x '.build' -x '.inst' -x '.sinst' \
++    ${PKG}-${VER}-orig ${PKG}-${VER} > \
++    ${srcinstdir}/${src_patch_name} ; \
++  rm -rf ${PKG}-${VER}-orig )
++}
++spkg() {
++  (mkpatch && \
++  cp ${src_orig_pkg} ${srcinstdir}/${src_orig_pkg_name} && \
++  cp $0 ${srcinstdir}/`basename $0` && \
++  cd ${srcinstdir} && \
++  tar cvjf ${src_pkg} * )
++}
++finish() {
++  rm -rf ${srcdir} 
++}
++echo "$0"
++case $1 in
++  prep)	prep ; STATUS=$? ;;
++  mkdirs)	mkdirs; STATUS=$? ;;
++  conf)	conf ; STATUS=$? ;;
++  build)	build ; STATUS=$? ;;
++  check)	check ; STATUS=$? ;;
++  clean)	clean ; STATUS=$? ;;
++  install)	install ; STATUS=$? ;;
++  strip)	strip ; STATUS=$? ;;
++  split)	split ; STATUS=$? ;;
++  package)	pkg ; STATUS=$? ;;
++  pkg)	pkg ; STATUS=$? ;;
++  mkpatch)	mkpatch ; STATUS=$? ;;
++  src-package)	spkg ; STATUS=$? ;;
++  spkg)	spkg ; STATUS=$? ;;
++  finish) finish ; STATUS=$? ;;
++  all) prep && conf && build && install && \
++     strip && split && pkg && spkg && finish ; \
++	  STATUS=$? ;;
++  *) cat <<EOF
++Usage:
++
++    $0 STAGE
++    
++Where
++
++   STAGE: all prep conf build install strip split pkg spkg finish
++   
++EOF
++	# Usage error
++	exit 2 ;;
++esac
++exit ${STATUS}
+diff -purN /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/libguile-devel.hint ./CYGWIN-PATCHES/libguile-devel.hint
+--- /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/libguile-devel.hint	Thu Jan  1 01:00:00 1970
++++ ./CYGWIN-PATCHES/libguile-devel.hint	Thu Jul  4 18:26:00 2002
+@@ -0,0 +1,9 @@
++sdesc: "Development headers and static libraries for Guile."
++category: development libs
++requires: cygwin
++external-source: guile
++ldesc: "Development headers and static libraries for Guile.
++`libguile.h' etc. C headers, aclocal macros, the `guile-snarf' and
++`guile-config' utilities, and static `libguile.a' libraries for Guile,
++the GNU Ubiquitous Intelligent Language for Extension."
++
+diff -purN /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/libguile14.hint ./CYGWIN-PATCHES/libguile14.hint
+--- /home/fred/usr/src/guile-1.5.6/CYGWIN-PATCHES/libguile14.hint	Thu Jan  1 01:00:00 1970
++++ ./CYGWIN-PATCHES/libguile14.hint	Thu Jul  4 18:25:32 2002
+@@ -0,0 +1,8 @@
++sdesc: "The GNU extension language and Scheme interpreter (runtime libraries)"
++category: libs
++requires: cygwin
++external-source: guile
++ldesc: "The GNU extension language and Scheme interpreter (runtime libraries)
++Guile shared object libraries and the ice-9 scheme module.  Guile is
++the GNU Ubiquitous Intelligent Language for Extension."
++
+diff -purN /home/fred/usr/src/guile-1.5.6/ChangeLog ./ChangeLog
+--- /home/fred/usr/src/guile-1.5.6/ChangeLog	Tue Mar  5 01:12:26 2002
++++ ./ChangeLog	Fri Jul  5 02:03:22 2002
+@@ -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-03-04  Rob Browning  <rlb@defaultvalue.org>
+ 
+ 	* Guile beta 1.5.6 released.
+diff -purN /home/fred/usr/src/guile-1.5.6/INSTALL ./INSTALL
+--- /home/fred/usr/src/guile-1.5.6/INSTALL	Tue Aug 14 23:44:53 2001
++++ ./INSTALL	Thu Jul  4 18:20:05 2002
+@@ -199,6 +199,29 @@ switches specific to Guile you may find 
+ --disable-regex       ---  omit regular expression interfaces
+ 
+ 
++Cross building Guile  =====================================================
++
++As of guile-1.5.x, the build process uses compiled C files for
++snarfing, and (indirectly, through libtool) for linking, and uses the
++guile executable for generating documentation.
++
++When cross building guile, you first need to configure, build and
++install guile for your build host.
++
++Then, you may configure guile for cross building, eg:
++
++    ./configure --host=i686-pc-cygwin --disable-shared
++
++Two special options for cross building are available:
++
++--with-cc-for-build      --- native C compiler, to be used during build
++                             defaults to: `PATH=/usr/bin:$PATH cc'
++
++--with-guile-for-build   --- native C compiler, to be used during build
++                             defaults to: `guile', assuming you just
++                             installed this guile natively.
++
++
+ Using Guile Without Installing It =========================================
+ 
+ If you want to run Guile without installing it, set the environment
+diff -purN /home/fred/usr/src/guile-1.5.6/am/ChangeLog ./am/ChangeLog
+--- /home/fred/usr/src/guile-1.5.6/am/ChangeLog	Sun Mar  3 21:34:07 2002
++++ ./am/ChangeLog	Thu Jul  4 03:28:08 2002
+@@ -1,3 +1,8 @@
++2002-07-03  Jan Nieuwenhuizen  <janneke@gnu.org>
++
++	* pre-inst-guile (preinstguile): Initialize with
++	$(GUILE_FOR_BUILD) configure parameter.
++
+ 2002-03-03  Rob Browning  <rlb@defaultvalue.org>
+ 
+ 	* .cvsignore: add Makefile and Makefile.in.
+diff -purN /home/fred/usr/src/guile-1.5.6/am/pre-inst-guile ./am/pre-inst-guile
+--- /home/fred/usr/src/guile-1.5.6/am/pre-inst-guile	Tue Feb 26 12:12:18 2002
++++ ./am/pre-inst-guile	Thu Jul  4 03:25:45 2002
+@@ -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
+diff -purN /home/fred/usr/src/guile-1.5.6/configure.in ./configure.in
+--- /home/fred/usr/src/guile-1.5.6/configure.in	Tue Mar  5 00:24:38 2002
++++ ./configure.in	Thu Jul  4 04:05:56 2002
+@@ -20,7 +20,7 @@ dnl  along with GUILE; see the file COPY
+ dnl  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ dnl  Boston, MA 02111-1307, USA.
+ 
+-AC_PREREQ(2.50)
++AC_PREREQ(2.53)
+ 
+ AC_INIT
+ AC_CONFIG_SRCDIR([Makefile.in])
+@@ -51,22 +51,26 @@ AC_ARG_ENABLE(error-on-warning,
+      *) AC_MSG_ERROR(bad value ${enableval} for --enable-error-on-warning) ;;
+    esac])
+ 
++
+ AC_ARG_ENABLE(debug-freelist,
+   [  --enable-debug-freelist include garbage collector freelist debugging code],
+   if test "$enable_debug_freelist" = y || test "$enable_debug_freelist" = yes; then
+-    AC_DEFINE(GUILE_DEBUG_FREELIST)
++    AC_DEFINE(GUILE_DEBUG_FREELIST, 1,
++      [Define this if you want to debug the free list (helps w/ GC bugs).])
+   fi)
+ 
+ AC_ARG_ENABLE(debug-malloc,
+   [  --enable-debug-malloc   include malloc debugging code],
+   if test "$enable_debug_malloc" = y || test "$enable_debug_malloc" = yes; then
+-    AC_DEFINE(GUILE_DEBUG_MALLOC)
++    AC_DEFINE(GUILE_DEBUG_MALLOC, 1,
++      [Define this if you want to debug scm_must_malloc/realloc/free calls.])
+   fi)
+ 
+ AC_ARG_ENABLE(guile-debug,
+   [  --enable-guile-debug    include internal debugging functions],
+   if test "$enable_guile_debug" = y || test "$enable_guile_debug" = yes; then
+-    AC_DEFINE(GUILE_DEBUG)
++    AC_DEFINE(GUILE_DEBUG, 1,
++      [Define this to include various undocumented functions used to debug.])
+   fi)
+ 
+ AC_ARG_ENABLE(arrays,
+@@ -110,6 +114,10 @@ AM_CONDITIONAL(HTMLDOC, test x$htmldoc_e
+ AC_ARG_ENABLE(deprecated,
+   [  --disable-deprecated    omit deprecated features [no]])
+ 
++
++AH_TEMPLATE([SCM_DEBUG_DEPRECATED],
++            [Define this if you want to exclude deprecated features.])
++
+ if test "$enable_deprecated" = no; then
+   AC_DEFINE(SCM_DEBUG_DEPRECATED, 1)
+ else
+@@ -121,34 +129,17 @@ else
+     warn_default=$enable_deprecated
+   fi
+   AC_DEFINE(SCM_DEBUG_DEPRECATED, 0)
+-  AC_DEFINE_UNQUOTED(SCM_WARN_DEPRECATED_DEFAULT, "$warn_default")
++  AC_DEFINE_UNQUOTED(SCM_WARN_DEPRECATED_DEFAULT, "$warn_default",
++  [Define this to control the default warning level for deprecated features.])
+ fi
+ 
+ dnl The --disable-debug used to control these two.  But now they are
+ dnl a required part of the distribution.
+-AC_DEFINE(DEBUG_EXTENSIONS)
+-AC_DEFINE(READER_EXTENSIONS)
++AC_DEFINE(DEBUG_EXTENSIONS, 1,
++  [Define if you want support for debugging Scheme programs.])
++AC_DEFINE(READER_EXTENSIONS, 1,
++  [Define if you want support for debugging Scheme programs.])
+ 
+-dnl files which are destined for separate modules.
+-
+-if test "$enable_arrays" = yes; then
+-   LIBOBJS="$LIBOBJS ramap.o unif.o"
+-   AC_DEFINE(HAVE_ARRAYS)
+-fi
+-
+-if test "$enable_posix" = yes; then
+-   LIBOBJS="$LIBOBJS filesys.o posix.o"
+-   AC_DEFINE(HAVE_POSIX)
+-fi
+-
+-if test "$enable_networking" = yes; then
+-   LIBOBJS="$LIBOBJS net_db.o socket.o"
+-   AC_DEFINE(HAVE_NETWORKING)
+-fi
+-
+-if test "$enable_debug_malloc" = yes; then
+-   LIBOBJS="$LIBOBJS debug-malloc.o"
+-fi
+ 
+ #--------------------------------------------------------------------
+ 
+@@ -164,11 +155,42 @@ 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)
+ AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes)
+ 
++dnl files which are destined for separate modules.
++
++if test "$enable_arrays" = yes; then
++   AC_LIBOBJ([ramap])
++   AC_LIBOBJ([unif])
++   AC_DEFINE(HAVE_ARRAYS, 1,
++     [Define this if you want support for arrays and uniform arrays.])
++fi
++
++if test "$enable_posix" = yes; then
++   AC_LIBOBJ([filesys])
++   AC_LIBOBJ([posix])
++   AC_DEFINE(HAVE_POSIX, 1,
++     [Define this if you want support for POSIX system calls in Guile.])
++fi
++
++if test "$enable_networking" = yes; then
++   AC_LIBOBJ([net_db])
++   AC_LIBOBJ([socket])
++   AC_DEFINE(HAVE_NETWORKING, 1,
++     [Define this if you want support for networking in Guile.])
++fi
++
++if test "$enable_debug_malloc" = yes; then
++   AC_LIBOBJ([debug-malloc])
++fi
++
++
+ AC_C_CONST
+ AC_C_INLINE
+ AC_C_BIGENDIAN
+@@ -190,7 +212,7 @@ AC_CACHE_CHECK([for long longs], scm_cv_
+ 			      scm_cv_long_longs=yes,
+ 			      scm_cv_long_longs=no))
+ if test "$scm_cv_long_longs" = yes; then
+-  AC_DEFINE(HAVE_LONG_LONGS)
++  AC_DEFINE(HAVE_LONG_LONGS, 1, [Define if the compiler supports long longs.])
+   AC_CHECK_SIZEOF(long long)
+ fi
+ 
+@@ -230,7 +252,8 @@ use_modules="$withval")
+ test -z "$use_modules" && use_modules=yes
+ DLPREOPEN=
+ if test "$use_modules" != no; then
+-  AC_DEFINE(DYNAMIC_LINKING)
++  AC_DEFINE(DYNAMIC_LINKING, 1,
++    [Define if you want support for dynamic linking.])
+   if test "$use_modules" = yes; then
+     DLPREOPEN="-dlpreopen force"
+   else
+@@ -263,7 +286,8 @@ AC_DEFUN(GUILE_FUNC_DECLARED, [
+ 		    guile_cv_func_$1_declared=yes,
+ 		    guile_cv_func_$1_declared=no))
+   if test [x$guile_cv_func_]$1[_declared] = xno; then
+-    AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL])
++    AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL], 1,
++      [Define if the operating system supplies $1 without declaring it.])
+   fi
+ ])
+ 
+@@ -280,13 +304,15 @@ AC_CACHE_CHECK([return type of usleep], 
+ 		   [guile_cv_func_usleep_return_type=int])])
+ case "$guile_cv_func_usleep_return_type" in
+   "void" )
+-    AC_DEFINE(USLEEP_RETURNS_VOID)
++    AC_DEFINE(USLEEP_RETURNS_VOID, 1,
++      [Define if the system headers declare usleep to return void.])
+   ;;
+ esac
+ 
+ AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
+ if test -n "$have_sys_un_h" ; then
+-AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS)
++  AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS, 1,
++    [Define if the system supports Unix-domain (file-domain) sockets.])
+ fi
+ 
+ AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
+@@ -309,7 +335,7 @@ AC_CACHE_VAL(guile_cv_have_h_errno,
+ guile_cv_have_h_errno=yes, guile_cv_have_h_errno=no)])
+ AC_MSG_RESULT($guile_cv_have_h_errno)
+ if test $guile_cv_have_h_errno = yes; then
+-  AC_DEFINE(HAVE_H_ERRNO)
++  AC_DEFINE(HAVE_H_ERRNO, 1, [Define if h_errno is declared in netdb.h.])
+ fi
+ 
+ AC_MSG_CHECKING(whether uint32_t is defined)
+@@ -320,29 +346,39 @@ AC_CACHE_VAL(guile_cv_have_uint32_t,
+ 		  guile_cv_have_uint32_t=yes, guile_cv_have_uint32_t=no)])
+ AC_MSG_RESULT($guile_cv_have_uint32_t)
+ if test $guile_cv_have_uint32_t = yes; then
+-  AC_DEFINE(HAVE_UINT32_T)
++  AC_DEFINE(HAVE_UINT32_T, 1,
++    [Define if uint32_t typedef is defined when netdb.h is include.])
+ fi
+ 
+ AC_MSG_CHECKING(for working IPv6 support)
+ AC_CACHE_VAL(guile_cv_have_ipv6,
+-[AC_TRY_COMPILE([#include <netinet/in.h>
++[AC_TRY_COMPILE([
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++#include <netinet/in.h>
+ #include <sys/socket.h>],
+ [struct sockaddr_in6 a;  a.sin6_family = AF_INET6;],
+ guile_cv_have_ipv6=yes, guile_cv_have_ipv6=no)])
+ AC_MSG_RESULT($guile_cv_have_ipv6)
+ if test $guile_cv_have_ipv6 = yes; then
+-  AC_DEFINE(HAVE_IPV6)
++  AC_DEFINE(HAVE_IPV6, 1, [Define if you want support for IPv6.])
+ fi
+ 
+ # included in rfc2553 but not in older implementations, e.g., glibc 2.1.3.
+ AC_MSG_CHECKING(whether sockaddr_in6 has sin6_scope_id)
+ AC_CACHE_VAL(guile_cv_have_sin6_scope_id,
+-[AC_TRY_COMPILE([#include <netinet/in.h>],
++[AC_TRY_COMPILE([
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++#include <netinet/in.h>],
+ [struct sockaddr_in6 sok;  sok.sin6_scope_id = 0;],
+ guile_cv_have_sin6_scope_id=yes, guile_cv_have_sin6_scope_id=no)])
+ AC_MSG_RESULT($guile_cv_have_sin6_scope_id)
+ if test $guile_cv_have_sin6_scope_id = yes; then
+-  AC_DEFINE(HAVE_SIN6_SCOPE_ID)
++  AC_DEFINE(HAVE_SIN6_SCOPE_ID, 1,
++    [Define this if your IPv6 has sin6_scope_id in sockaddr_in6 struct.])
+ fi
+ 
+ AC_MSG_CHECKING(whether localtime caches TZ)
+@@ -389,7 +425,7 @@ else
+ fi])dnl
+ AC_MSG_RESULT($guile_cv_localtime_cache)
+ if test $guile_cv_localtime_cache = yes; then
+-  AC_DEFINE(LOCALTIME_CACHE)
++  AC_DEFINE(LOCALTIME_CACHE, 1, [Define if localtime caches the TZ setting.])
+ fi
+ 
+ dnl Test whether system calls are restartable by default on the
+@@ -408,15 +444,15 @@ if test "$enable_regex" = yes; then
+    if test "$ac_cv_header_regex_h" = yes ||
+       test "$ac_cv_header_rxposix_h" = yes ||
+       test "$ac_cv_header_rx_rxposix_h" = yes; then
+-     GUILE_NAMED_CHECK_FUNC(regcomp, norx, [LIBOBJS="regex-posix.o $LIBOBJS"],
+-     [AC_CHECK_LIB(rx, main)
+-      GUILE_NAMED_CHECK_FUNC(regcomp, rx, [LIBOBJS="regex-posix.o $LIBOBJS"])]
+-     )
++     GUILE_NAMED_CHECK_FUNC(regcomp, norx, [AC_LIBOBJ([regex-posix])],
++       [AC_CHECK_LIB(rx, main)
++        GUILE_NAMED_CHECK_FUNC(regcomp, rx, [AC_LIBOBJ([regex-posix])])])
+      dnl The following should not be necessary, but for some reason
+      dnl autoheader misses it if we don't include it!
+      if test "$ac_cv_func_regcomp_norx" = yes ||
+         test "$ac_cv_func_regcomp_rx" = yes; then
+-       AC_DEFINE(HAVE_REGCOMP)
++       AC_DEFINE(HAVE_REGCOMP, 1,
++         [This is included as part of a workaround for a autoheader bug.])
+      fi
+    fi
+ fi
+@@ -427,7 +463,7 @@ AC_REPLACE_FUNCS(inet_aton putenv strerr
+ # explicitly to LIBOBJS to make sure that it is translated to
+ # `alloca.lo' for libtool later on.  This can and should be done more cleanly.
+ AC_FUNC_ALLOCA
+-if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
++if test "$ALLOCA" = "alloca.o"; then AC_LIBOBJ([alloca]); fi
+ 
+ AC_CHECK_MEMBERS([struct stat.st_rdev])
+ AC_CHECK_MEMBERS([struct stat.st_blksize])
+@@ -442,7 +478,8 @@ AC_CACHE_CHECK([for S_ISLNK in sys/stat.
+                ac_cv_macro_S_ISLNK=yes,
+                ac_cv_macro_S_ISLNK=no)])
+ if test $ac_cv_macro_S_ISLNK = yes; then
+-  AC_DEFINE(HAVE_S_ISLNK)
++  AC_DEFINE(HAVE_S_ISLNK, 1,
++    [Define this if your system defines S_ISLNK in sys/stat.h.])
+ fi
+ 
+ AC_STRUCT_TIMEZONE
+@@ -457,7 +494,16 @@ GUILE_STRUCT_UTIMBUF
+ AC_TRY_RUN(aux (l) unsigned long l;
+ 	     { int x; exit (l >= ((unsigned long)&x)); }
+ 	   main () { int q; aux((unsigned long)&q); },
+-	   AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
++	   [AC_DEFINE([SCM_STACK_GROWS_UP], 1,
++              [Define this if a callee's stack frame has a higher address
++               than the caller's stack frame.  On most machines, this is
++               not the case.])],
++           [],
++           [AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in)])
++
++
++AH_TEMPLATE([SCM_SINGLES],
++  [Define this if floats are the same size as longs.])
+ 
+ AC_CACHE_CHECK([whether floats fit in longs], guile_cv_type_float_fits_long,
+     [AC_TRY_RUN([main () { exit (sizeof(float) > sizeof(long)); }],
+@@ -486,7 +532,9 @@ AC_CACHE_VAL(scm_cv_struct_linger,
+ 			scm_cv_struct_linger="no"))
+ AC_MSG_RESULT($scm_cv_struct_linger)
+ if test $scm_cv_struct_linger = yes; then
+-	AC_DEFINE(HAVE_STRUCT_LINGER)
++	AC_DEFINE([HAVE_STRUCT_LINGER], 1,
++          [Define this if your system defines struct linger, for use with the
++           getsockopt and setsockopt system calls.])
+ fi
+ 
+ 
+@@ -499,7 +547,8 @@ AC_CACHE_VAL(scm_cv_struct_timespec,
+ 			scm_cv_struct_timespec="no"))
+ AC_MSG_RESULT($scm_cv_struct_timespec)
+ if test $scm_cv_struct_timespec = yes; then
+-	AC_DEFINE(HAVE_STRUCT_TIMESPEC)
++	AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
++          [Define this if your system defines struct timespec via <time.h>.])
+ fi
+ 
+ #--------------------------------------------------------------------
+@@ -541,15 +590,16 @@ esac
+ ## If we're using threads, bring in some other parts of Guile which
+ ## work with them.
+ if test "${THREAD_PACKAGE}" != "" ; then
+-  AC_DEFINE(USE_THREADS, 1)
++  AC_DEFINE(USE_THREADS, 1, [Define if using any sort of threads.])
+ 
+   ## Include the Guile thread interface in the library...
+-  LIBOBJS="$LIBOBJS threads.o"
++  AC_LIBOBJ([threads])
+ 
+   ## ... and tell it which package to talk to.
+   case "${THREAD_PACKAGE}" in
+     "QT" )
+-      AC_DEFINE(USE_COOP_THREADS, 1)
++      AC_DEFINE(USE_COOP_THREADS, 1,
++        [Define if using cooperative multithreading.])
+     ;;
+     * )
+       AC_MSG_ERROR(invalid value for THREAD_PACKAGE: ${THREAD_PACKAGE})
+@@ -559,7 +609,7 @@ if test "${THREAD_PACKAGE}" != "" ; then
+   ## Bring in scm_internal_select, if appropriate.
+   if test $ac_cv_func_gettimeofday = yes &&
+      test $ac_cv_func_select = yes; then
+-    AC_DEFINE(GUILE_ISELECT, 1)
++    AC_DEFINE(GUILE_ISELECT, 1, [Define to implement scm_internal_select.])
+   fi
+ 
+   AC_ARG_ENABLE(linuxthreads,
+@@ -568,11 +618,60 @@ if test "${THREAD_PACKAGE}" != "" ; then
+ 
+   ## Workaround for linuxthreads (optionally disabled)
+   if test $host_os = linux-gnu -a "$enable_linuxthreads" = yes; then
+-    AC_DEFINE(GUILE_PTHREAD_COMPAT, 1)
++    AC_DEFINE(GUILE_PTHREAD_COMPAT, 1,
++      [Define to enable workaround for COOP-linuxthreads compatibility.])
+     AC_CHECK_LIB(pthread, main)
+   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 )
+@@ -589,11 +688,11 @@ AC_PROG_AWK
+ ## If we're creating a shared library (using libtool!), then we'll
+ ## need to generate a list of .lo files corresponding to the .o files
+ ## given in LIBOBJS.  We'll call it LIBLOBJS.
+-LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
++LIBLOBJS="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`"
+ 
+ ## We also need to create corresponding .doc and .x files
+-EXTRA_DOT_DOC_FILES="`echo ${LIBOBJS} | sed 's/\.o/.doc/g'`"
+-EXTRA_DOT_X_FILES="`echo ${LIBOBJS} | sed 's/\.o/.x/g'`"
++EXTRA_DOT_DOC_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.doc ,g;s,\.[[^.]]*$,.doc,'`"
++EXTRA_DOT_X_FILES="`echo ${LIB@&t@OBJS} | sed 's,\.[[^.]]* ,.x ,g;s,\.[[^.]]*$,.x,'`"
+ 
+ AC_SUBST(GUILE_MAJOR_VERSION)
+ AC_SUBST(GUILE_MINOR_VERSION)
+@@ -617,11 +716,13 @@ AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_
+ AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_REVISION)
+ AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE_AGE)
+ AC_SUBST(LIBGUILE_SRFI_SRFI_4_INTERFACE)
++AC_SUBST(LIBGUILE_SRFI_SRFI_4_LTHACK)
+ 
+ AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_CURRENT)
+ AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_REVISION)
+ AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE_AGE)
+ AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_INTERFACE)
++AC_SUBST(LIBGUILE_SRFI_SRFI_13_14_LTHACK)
+ 
+ #######################################################################
+ 
+diff -purN /home/fred/usr/src/guile-1.5.6/doc/guile.1 ./doc/guile.1
+--- /home/fred/usr/src/guile-1.5.6/doc/guile.1	Thu Jan  1 01:00:00 1970
++++ ./doc/guile.1	Fri Jul  5 02:01:58 2002
+@@ -0,0 +1,93 @@
++.\" Written by Robert Merkel (rgmerk@mira.net)
++.\" augmented by Rob Browning <rlb@cs.utexas.edu>
++.\" Process this file with
++.\" groff -man -Tascii foo.1
++.\"
++.TH GUILE 1 "January 2001" Version "1.4"
++.SH NAME
++guile \- a Scheme interpreter
++.SH SYNOPSIS
++.B guile [-q] [-ds] [--help] [--version] [--emacs] [--debug]
++.B [-l FILE] [-e FUNCTION] [\]
++.B [-c EXPR] [-s SCRIPT] [--]
++.SH DESCRIPTION
++Guile is an interpreter for the Scheme programming language.  It
++implements a superset of R4RS, providing the additional features
++necessary for real-world use.  It is extremely simple to embed guile
++into a C program, calling C from Scheme and Scheme from C.  Guile's
++design makes it very suitable for use as an "extension" or "glue"
++language, but it also works well as a stand-alone scheme development
++environment.
++
++The
++.B guile
++executable itself provides a stand-alone interpreter for scheme
++programs, for either interactive use or executing scripts.
++
++This manpage provides only brief instruction in invoking
++.B guile
++from the command line.  Please consult the guile info documentation
++(type 
++.B info guile
++at a command prompt) for more information.  There is also a tutorial
++.B (info guile-tut) 
++available.
++
++.SH OPTIONS
++.IP -l FILE
++Load scheme source code from file.
++.IP -e FUNCTION
++After reading script, apply FUNCTION to command-line arguments
++.IP -ds
++do -s SCRIPT at this point (note that this argument must be used in
++conjuction with -s)
++.IP --help 
++Describe command line options and exit
++.IP --debug
++Start guile with debugging evaluator and backtraces enabled 
++(useful for debugging guile scripts)
++.IP --version
++Display guile version and exit.
++.IP --emacs
++Enable emacs protocol for use from within emacs (experimental)
++.IP --
++Stop argument processing, start guile in interactive mode.
++.IP -c EXPR
++Stop argument processing, evaluate EXPR as a scheme expression.
++.IP -s SCRIPT-FILE
++Load Scheme source from SCRIPT-FILE and execute as a script.
++
++.SH ENVIRONMENT
++.\".TP \w'MANROFFSEQ\ \ 'u
++.TP
++.B GUILE_LOAD_PATH
++If
++.RB $ GUILE_LOAD_PATH
++is set, its value is used to agument the path to search for scheme
++files when loading.  It should be a colon separated list of
++directories which will be prepended to the default %load-path.
++
++.SH FILES
++.I ~/.guile
++is a guile script that is executed before any other processing occurs.
++For example, the following .guile activates guile's readline
++interface:
++
++.RS 4
++(use-modules (ice-9 readline))
++.RS 0
++(activate-readline)
++
++.SH "SEE ALSO"
++.B info guile, info guile-tut
++
++http://www.schemers.org provides a general introduction to the
++Scheme language.
++
++.SH AUTHORS
++Robert Merkel <rgmerk@mira.net> wrote this manpage.  
++Rob Browning <rlb@cs.utexas.edu> has added to it.
++
++.B guile 
++is GNU software.  Guile is originally based on Aubrey Jaffer's
++SCM interpreter, and is the work of many individuals.
+diff -purN /home/fred/usr/src/guile-1.5.6/libguile/ChangeLog ./libguile/ChangeLog
+--- /home/fred/usr/src/guile-1.5.6/libguile/ChangeLog	Sun Mar  3 02:14:37 2002
++++ ./libguile/ChangeLog	Thu Jul  4 03:27:54 2002
+@@ -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-03-01  Dirk Herrmann  <D.Herrmann@tu-bs.de>
+ 
+ 	* gc.c (SCM_HEAP_SEG_SIZE, CELL_UP, CELL_DN, DOUBLECELL_ALIGNED_P,
+diff -purN /home/fred/usr/src/guile-1.5.6/libguile/Makefile.am ./libguile/Makefile.am
+--- /home/fred/usr/src/guile-1.5.6/libguile/Makefile.am	Fri Mar  1 19:19:36 2002
++++ ./libguile/Makefile.am	Thu Jul  4 03:27:23 2002
+@@ -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		    \
+@@ -195,7 +214,7 @@ SUFFIXES = .x .doc
+ .c.doc:
+ 	-(test -n "${AWK+set}" || AWK="@AWK@"; ${AWK} -f ./guile-func-name-check $<)
+ 	(./guile-snarf-docs $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $< | \
+-	./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
+ 
+diff -purN /home/fred/usr/src/guile-1.5.6/libguile/guile.c ./libguile/guile.c
+--- /home/fred/usr/src/guile-1.5.6/libguile/guile.c	Wed Jun 27 21:30:20 2001
++++ ./libguile/guile.c	Thu Jul  4 03:25:46 2002
+@@ -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
+ 
+diff -purN /home/fred/usr/src/guile-1.5.6/libguile/iselect.h ./libguile/iselect.h
+--- /home/fred/usr/src/guile-1.5.6/libguile/iselect.h	Mon Jul 23 22:48:44 2001
++++ ./libguile/iselect.h	Thu Jul  4 03:25:46 2002
+@@ -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
+ 
+diff -purN /home/fred/usr/src/guile-1.5.6/libguile/net_db.c ./libguile/net_db.c
+--- /home/fred/usr/src/guile-1.5.6/libguile/net_db.c	Mon Jul  9 16:24:40 2001
++++ ./libguile/net_db.c	Thu Jul  4 03:25:46 2002
+@@ -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>
+diff -purN /home/fred/usr/src/guile-1.5.6/libguile/posix.c ./libguile/posix.c
+--- /home/fred/usr/src/guile-1.5.6/libguile/posix.c	Sat Nov 17 20:03:43 2001
++++ ./libguile/posix.c	Thu Jul  4 03:25:46 2002
+@@ -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
+ 
+diff -purN /home/fred/usr/src/guile-1.5.6/libguile/socket.c ./libguile/socket.c
+--- /home/fred/usr/src/guile-1.5.6/libguile/socket.c	Mon Jul  9 16:24:40 2001
++++ ./libguile/socket.c	Thu Jul  4 03:25:46 2002
+@@ -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>
+diff -purN /home/fred/usr/src/guile-1.5.6/qt/Makefile.am ./qt/Makefile.am
+--- /home/fred/usr/src/guile-1.5.6/qt/Makefile.am	Fri Feb 15 23:11:29 2002
++++ ./qt/Makefile.am	Thu Jul  4 03:53:53 2002
+@@ -24,7 +24,7 @@ AUTOMAKE_OPTIONS = gnu
+ ## subdirs are for making distributions only.
+ SUBDIRS = md time
+ 
+-lib_LTLIBRARIES = @QTHREAD_LTLIBS@
++lib_LTLIBRARIES =
+ EXTRA_LTLIBRARIES = libqthreads.la
+ 
+ ## Prevent automake from adding extra -I options
+diff -purN /home/fred/usr/src/guile-1.5.6/qt/Makefile.in ./qt/Makefile.in
+--- /home/fred/usr/src/guile-1.5.6/qt/Makefile.in	Tue Mar  5 00:43:37 2002
++++ ./qt/Makefile.in	Thu Jul  4 04:02:33 2002
+@@ -124,7 +124,7 @@ AUTOMAKE_OPTIONS = gnu
+ 
+ SUBDIRS = md time
+ 
+-lib_LTLIBRARIES = @QTHREAD_LTLIBS@
++lib_LTLIBRARIES =
+ EXTRA_LTLIBRARIES = libqthreads.la
+ 
+ DEFS = @DEFS@

