Thomas Esser <[EMAIL PROTECTED]> writes:

Hi Thomas and Olaf,

>   I suggest: you get the main stuff working with Olaf Weber then, we see
>   what we do about the remaining parts. Only very few files are actually
>   maintained by me myself.
>   ...

I've split the patch into a patch with Cygwin fixes, and a patch that
enables cross compilation, and made some cleanups.

The Cygwin patch contains corrections for the assumption that Cygwin
would be DOSISH (Cygwin is like UNIX), an extention to klibtool to
create shared object libraries for Cygwin with code fixes for DLL
creation, and some small Makefile fixes (let CXXFLAGS be
user-overridable, use $(MAKE) instead of make).  There's also a
feature for #if __CYGWIN__ only, in elt-dirs.c, with some
documentation.

The cross compiling patch enables cross compilation, by using a
different compiler (and make rules) when cross compiling, but using
the native compiler to compile build tools.  For now, I've opted not
to change the workings when not cross compiling.  Also I've not
removed any (seemingly) disfunctional cross compile configure and
Makefile code chunks that I encountered, only commented out some
conflicting stuff.  If all is ok, removing old cruft can be done
later.

Olaf, it's still a patch against the tetex-20020911 prerelease tree,
as that's the easiest way for me to juggle versions and test if
everything is ok.  I think that should be good enough to get a
discussion going?  If you would really need to get it differently,
please tell me how.

I would appreciate it very much if you could have a look at the
patches, so that we can see what needs to be done to get them merged.

Greetings,
Jan.

diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/libs/libwww/config/klibtool ./libs/libwww/config/klibtool
--- ../teTeX-src-beta-20020911/libs/libwww/config/klibtool	1999-01-14 19:56:54.000000000 +0100
+++ ./libs/libwww/config/klibtool	2002-09-12 11:10:59.000000000 +0200
@@ -215,7 +215,10 @@ case $mode in
       args_STATIC_compile args_SHARED_compile
       args_STATIC_archive STATIC_ranlib args_SHARED_archive
       args_SHARED_link
-      SHARED_postinstall"
+      SHARED_postinstall
+      import_lib
+      shared_prefix
+      shared_postverext"
     for v in $config_vars; do
       # Preserve existing value of a couple variables.
       case $v in
@@ -225,6 +228,9 @@ case $mode in
     done
     test -z "$LIBTOOL_OBJTYPES" && LIBTOOL_OBJTYPES=STATIC
     shared_ext=so
+    import_lib=
+    shared_postverext=
+    shared_prefix=lib
     libpath_var=LD_LIBRARY_PATH
     STATIC_ranlib=$RANLIB
 
@@ -313,11 +319,22 @@ case $mode in
         SHARED_postinstall='ldconfig -m $libdir'
         ;;
 
+      *-cygwin*)
+        shared_support=true
+	args_SHARED_compile="-DKPSE_DLL"
+	SHARED_postinstall=
+	args_SHARED_archive='-shared -Wl,--image-base=0x10000000 -Wl,--out-implib,`eval echo $lib_base | sed -e ''s@${shared_prefix}@lib@'' -e s/[-.]\\\\\([0-9][0-9]*\\\\\)//g`.a'
+	shared_prefix=cyg
+	shared_ext=
+	shared_postverext=.dll
+	import_lib='`eval echo $libname | sed -e ''s@${shared_prefix}@lib@'' -e s/[-.]\\\\\([0-9][0-9]*\\\\\)//g`.a'
+	;;
+	
       hppa*-*-hpux*)
         if test $compiler = gcc; then
           shared_support=true
           args_SHARED_archive='-shared -fPIC'
-          shared_ext='sl'
+          shared_ext='.sl'
         fi
         ;;
 
@@ -408,7 +425,11 @@ case $mode in
                 $verbose "$0: running $0 version $newarg."
                 verstring=`$0 version $newarg`
                 $verbose "$0: got version $verstring."
-                libname=`echo $newarg | sed 's/\.a$/\.'$shared_ext$verstring/`
+                libname=`echo $newarg | sed 's/\.a$/$shared_ext$verstring/'`
+		if test "$shared_prefix" = "cyg"; then
+		    verstring=`echo ${verstring} | sed -e 's/[.]\([0-9][0-9]*\)/-\1/g'`
+		    libname=`echo $newarg | sed -e 's@lib@${shared_prefix}@' -e 's/\.a$/${verstring}${shared_postverext}/'`
+		fi
               else
                 libname=$newarg
               fi
@@ -426,7 +447,9 @@ case $mode in
                 # If it supports shared libraries, it supports symlinks.
                 # Although this is unnecessary on (e.g.) SunOS, it
                 # doesn't hurt, and it is necessary on (e.g.) Solaris.
-                post="&& rm -f $lib_base && ln -s $lib_basename $lib_base"
+		if test "$lib_basename" != "$lib_base"; then
+		    post="&& rm -f $lib_base && ln -s $lib_basename $lib_base"
+		fi
               elif test $ot = STATIC; then
                 ranlib=`eval echo '$'${ot}_ranlib`
                 $verbose "${ot}_ranlib = $ranlib."
@@ -605,7 +628,12 @@ case $mode in
         case $ot in
           SHARED) # needs shared extension and version number.
             verstring=`$0 version $arg`
-            libname=`echo $arg | sed 's/\.la$/\.'$shared_ext$verstring/`
+            libname=`echo $arg | sed 's/\.la$/'$shared_ext$verstring/`
+	    if test "$shared_prefix" = "cyg"; then
+		verstring=`echo ${verstring} | sed -e 's/[.]\([0-9][0-9]*\)/-\1/g'`
+		##libname=`echo $arg | sed -e 's@/lib@/${shared_prefix}@' -e 's/\.la$/${shared_ext}${verstring}${shared_postverext}/'`
+		libname=`echo $arg | sed -e "s@/lib@/${shared_prefix}@" -e "s/\.la$/${shared_ext}${verstring}${shared_postverext}/"`
+	    fi
             ;;
           STATIC) # just get rid of the `l'.
             libname=`echo $arg | sed 's/l\(.\)$/\1/'`
@@ -626,7 +654,14 @@ case $mode in
           # Link libfoo.so to libfoo.so.1.2.3.
           lib_base=`echo $lib_basename | sed 's/[.0-9]*$//'`          
           $verbose "$0: linking $libdir/$lib_base to $lib_basename"
-          (cd $libdir && rm -f $lib_base && ln -s $lib_basename $lib_base)
+	  if test "$lib_base" != "$lib_basename"; then
+	      (cd $libdir && rm -f $lib_base && ln -s $lib_basename $lib_base)
+	  fi
+	  if test -n "$import_lib"; then
+	      bindir="$libdir/../bin/"
+	      cmd="${INSTALL_PROGRAM-cp} $libname $bindir/"
+	      cmd="$cmd && ${INSTALL_DATA-cp} $import_lib $libdir/"
+	  fi
         fi
         #
         # Run ldconfig, etc.
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/klibtool ./texk/klibtool
--- ../teTeX-src-beta-20020911/texk/klibtool	1999-01-14 19:56:54.000000000 +0100
+++ ./texk/klibtool	2002-09-12 11:10:59.000000000 +0200
@@ -215,7 +215,10 @@ case $mode in
       args_STATIC_compile args_SHARED_compile
       args_STATIC_archive STATIC_ranlib args_SHARED_archive
       args_SHARED_link
-      SHARED_postinstall"
+      SHARED_postinstall
+      import_lib
+      shared_prefix
+      shared_postverext"
     for v in $config_vars; do
       # Preserve existing value of a couple variables.
       case $v in
@@ -224,7 +227,10 @@ case $mode in
       esac
     done
     test -z "$LIBTOOL_OBJTYPES" && LIBTOOL_OBJTYPES=STATIC
-    shared_ext=so
+    shared_ext='.so'
+    import_lib=
+    shared_postverext=
+    shared_prefix=lib
     libpath_var=LD_LIBRARY_PATH
     STATIC_ranlib=$RANLIB
 
@@ -313,11 +319,22 @@ case $mode in
         SHARED_postinstall='ldconfig -m $libdir'
         ;;
 
+      *-cygwin*)
+        shared_support=true
+	args_SHARED_compile="-DKPSE_DLL"
+	SHARED_postinstall=
+	args_SHARED_archive='-shared -Wl,--image-base=0x10000000 -Wl,--out-implib,`eval echo $lib_base | sed -e ''s@${shared_prefix}@lib@'' -e s/[-.]\\\\\([0-9][0-9]*\\\\\)//g`.a'
+	shared_prefix=cyg
+	shared_ext=
+	shared_postverext=.dll
+	import_lib='`eval echo $libname | sed -e ''s@${shared_prefix}@lib@'' -e s/[-.]\\\\\([0-9][0-9]*\\\\\)//g`.a'
+	;;
+	
       hppa*-*-hpux*)
         if test $compiler = gcc; then
           shared_support=true
           args_SHARED_archive='-shared -fPIC'
-          shared_ext='sl'
+          shared_ext='.sl'
         fi
         ;;
 
@@ -408,7 +425,11 @@ case $mode in
                 $verbose "$0: running $0 version $newarg."
                 verstring=`$0 version $newarg`
                 $verbose "$0: got version $verstring."
-                libname=`echo $newarg | sed 's/\.a$/\.'$shared_ext$verstring/`
+                libname=`echo $newarg | sed 's/\.a$/$shared_ext$verstring/'`
+		if test "$shared_prefix" = "cyg"; then
+		    verstring=`echo ${verstring} | sed -e 's/[.]\([0-9][0-9]*\)/-\1/g'`
+		    libname=`echo $newarg | sed -e 's@lib@${shared_prefix}@' -e 's/\.a$/${verstring}${shared_postverext}/'`
+		fi
               else
                 libname=$newarg
               fi
@@ -426,7 +447,9 @@ case $mode in
                 # If it supports shared libraries, it supports symlinks.
                 # Although this is unnecessary on (e.g.) SunOS, it
                 # doesn't hurt, and it is necessary on (e.g.) Solaris.
-                post="&& rm -f $lib_base && ln -s $lib_basename $lib_base"
+		if test "$lib_basename" != "$lib_base"; then
+		    post="&& rm -f $lib_base && ln -s $lib_basename $lib_base"
+		fi
               elif test $ot = STATIC; then
                 ranlib=`eval echo '$'${ot}_ranlib`
                 $verbose "${ot}_ranlib = $ranlib."
@@ -605,7 +628,12 @@ case $mode in
         case $ot in
           SHARED) # needs shared extension and version number.
             verstring=`$0 version $arg`
-            libname=`echo $arg | sed 's/\.la$/\.'$shared_ext$verstring/`
+            libname=`echo $arg | sed 's/\.la$/'$shared_ext$verstring/`
+	    if test "$shared_prefix" = "cyg"; then
+		verstring=`echo ${verstring} | sed -e 's/[.]\([0-9][0-9]*\)/-\1/g'`
+		##libname=`echo $arg | sed -e 's@/lib@/${shared_prefix}@' -e 's/\.la$/${shared_ext}${verstring}${shared_postverext}/'`
+		libname=`echo $arg | sed -e "s@/lib@/${shared_prefix}@" -e "s/\.la$/${shared_ext}${verstring}${shared_postverext}/"`
+	    fi
             ;;
           STATIC) # just get rid of the `l'.
             libname=`echo $arg | sed 's/l\(.\)$/\1/'`
@@ -626,7 +654,14 @@ case $mode in
           # Link libfoo.so to libfoo.so.1.2.3.
           lib_base=`echo $lib_basename | sed 's/[.0-9]*$//'`          
           $verbose "$0: linking $libdir/$lib_base to $lib_basename"
-          (cd $libdir && rm -f $lib_base && ln -s $lib_basename $lib_base)
+	  if test "$lib_base" != "$lib_basename"; then
+	      (cd $libdir && rm -f $lib_base && ln -s $lib_basename $lib_base)
+	  fi
+	  if test -n "$import_lib"; then
+	      bindir="$libdir/../bin/"
+	      cmd="${INSTALL_PROGRAM-cp} $libname $bindir/"
+	      cmd="$cmd && ${INSTALL_DATA-cp} $import_lib $libdir/"
+	  fi
         fi
         #
         # Run ldconfig, etc.
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/kpathsea/Makefile.in ./texk/kpathsea/Makefile.in
--- ../teTeX-src-beta-20020911/texk/kpathsea/Makefile.in	2001-10-23 14:01:44.000000000 +0200
+++ ./texk/kpathsea/Makefile.in	2002-09-12 11:10:59.000000000 +0200
@@ -36,7 +36,7 @@ library = kpathsea
 KPATHSEA_CC = $(LIBTOOL) compile "$(CC)"
 .SUFFIXES: .lo
 .c.lo:
-	$(KPATHSEA_CC) $< $(ALL_CFLAGS)
+	$(KPATHSEA_CC) $< $(ALL_CFLAGS) -DMAKE_KPSE_DLL
 
 default all: kpsewhich kpsestat access readlink $(library).info manfiles
 
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/kpathsea/c-pathch.h ./texk/kpathsea/c-pathch.h
--- ../teTeX-src-beta-20020911/texk/kpathsea/c-pathch.h	2001-11-12 08:45:59.000000000 +0100
+++ ./texk/kpathsea/c-pathch.h	2002-09-12 11:10:59.000000000 +0200
@@ -70,10 +70,23 @@ Foundation, Inc., 59 Temple Place - Suit
 #ifndef NAME_BEGINS_WITH_DEVICE
 #define NAME_BEGINS_WITH_DEVICE(name) 0 
 #endif
+
+#if defined (__CYGWIN__) && 0
+#define IS_UNC_NAME(name) (strlen (name) >= 3 && IS_DIR_SEP (*name)  \
+                            && IS_DIR_SEP (*(name+1)) \
+                            && (IS_DIR_SEP (*(name+2)) || isalnum(*(name+2))))
+#endif
+
 #ifndef IS_UNC_NAME /* Unc names are in practice found on Win32 only. */
 #define IS_UNC_NAME(name) 0
 #endif
 
+#ifdef WIN32
+#  define DEVICE_SEP_LEN 1
+#else  
+#  define DEVICE_SEP_LEN 0
+#endif
+
 /* What separates elements in environment variable path lists?  */
 #ifndef ENV_SEP
 #ifdef VMS
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/kpathsea/c-proto.h ./texk/kpathsea/c-proto.h
--- ../teTeX-src-beta-20020911/texk/kpathsea/c-proto.h	2001-11-17 23:14:56.000000000 +0100
+++ ./texk/kpathsea/c-proto.h	2002-09-12 11:10:59.000000000 +0200
@@ -19,21 +19,26 @@ Foundation, Inc., 59 Temple Place - Suit
 #ifndef KPATHSEA_C_PROTO_H
 #define KPATHSEA_C_PROTO_H
 
-#if defined(WIN32)
-#ifdef KPSE_DLL
+#define KPSE_DLL
+
+#if (defined (WIN32) || defined (__CYGWIN__)) && defined (KPSE_DLL)
 #ifdef MAKE_KPSE_DLL
-#define KPSEDLL __declspec( dllexport)
-#else
-#define KPSEDLL __declspec( dllimport)
-#endif
-#else
+#ifdef __CYGWIN__
 #define KPSEDLL
+#define KPSEDLL_EXPORT
+#else /* ! CYGWIN */
+#define KPSEDLL
+#define KPSEDLL_EXPORT __declspec(dllexport)
+#endif /* ! CYGWIN */
+#else /* ! MAKE_KPSE_DLL */
+#define KPSEDLL __declspec(dllimport)
+#define KPSEDLL_EXPORT
 #endif
-#else /* ! WIN32 */
+#else /* ( !WIN32 && ! __CYGWIN__) || ! KPSE_DLL */
 #define KPSEDLL
+#define KPSEDLL_EXPORT
 #endif
 
-
 /* These macros munge function declarations to make them work in both
    cases.  The P?H macros are used for declarations, the P?C for
    definitions.  Cf. <ansidecl.h> from the GNU C library.  P1H(void)
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/kpathsea/config.h ./texk/kpathsea/config.h
--- ../teTeX-src-beta-20020911/texk/kpathsea/config.h	2000-04-02 13:07:52.000000000 +0200
+++ ./texk/kpathsea/config.h	2002-09-12 11:10:59.000000000 +0200
@@ -33,10 +33,10 @@ Foundation, Inc., 59 Temple Place - Suit
 #endif
 
 /* If we have either DOS or OS2, we are DOSISH.  */
-#if defined(__i386_pc_gnu__) || \
-    defined(OS2) || \
+#if !defined (__CYGWIN__) && \
+   (defined(OS2) || \
     defined(MSDOS) || defined(__MSDOS__) || defined(DOS) || \
-    defined(WIN32) || defined(__WIN32__) || defined(_WIN32)
+    defined(WIN32) || defined(__WIN32__) || defined(_WIN32))
 #define DOSISH
 #endif
 
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/kpathsea/elt-dirs.c ./texk/kpathsea/elt-dirs.c
--- ../teTeX-src-beta-20020911/texk/kpathsea/elt-dirs.c	2001-10-22 23:31:30.000000000 +0200
+++ ./texk/kpathsea/elt-dirs.c	2002-09-12 11:10:59.000000000 +0200
@@ -357,6 +357,7 @@ expand_elt P3C(str_llist_type *, str_lis
      handle well filenames like c://dir/foo. So canonicalize the names.
      The resulting name will always be shorter than the one passed, so no
      problem.
+   - Similarly for Cygwin, re(mem)move multiple leading slashes.
    - If possible, we merely skip multiple leading slashes to prevent
      expanding from the root of a UNIX filesystem tree.
 */
@@ -365,7 +366,7 @@ kpse_normalize_path P1C(string, elt)
 {
   unsigned ret;
   unsigned i;
-
+  
   if (NAME_BEGINS_WITH_DEVICE(elt)) {
       if (*elt >= 'A' && *elt <= 'Z')
           *elt += 'a' - 'A';
@@ -375,15 +376,38 @@ kpse_normalize_path P1C(string, elt)
           memmove(elt+3, elt+i, strlen(elt+i) + 1);
       ret = 2;
   } else if (IS_UNC_NAME(elt)) {
-      for (ret = 2; elt[ret] && !IS_DIR_SEP(elt[ret]); ++ret)
+      for (ret = 1 + DEVICE_SEP_LEN; elt[ret] && !IS_DIR_SEP(elt[ret]); ++ret)
           ;
       for (i = ret; elt[i] && IS_DIR_SEP(elt[i]); ++i)
           ;
-      if (i > ret+1)
-          memmove(elt+ret+1, elt+i, strlen(elt+i) + 1);
+      if (i > ret + DEVICE_SEP_LEN)
+          memmove(elt+ret+DEVICE_SEP_LEN, elt+i, strlen(elt+i) + 1);
   } else {
+      char* p;
       for (ret = 0; IS_DIR_SEP(elt[ret]); ++ret)
           ;
+#ifdef __CYGWIN__
+      /* We've got a dilemma here.
+	 
+	 Currently, things like //share/texmf-local and //texmf/web2c
+	 get expanded; which is clearly wrong: those are UNC paths,
+	 and trigger hostname lookups.
+
+	 Otoh, something like //texserver/c/cygwin/usr/share/texmf//
+	 would be perfectly valid, and should not get collapsed to
+	 /texserver/c/...; but we should also not start a recursive
+	 search at //texserver.  So we collapse UNC prefixes, unless
+	 evironment var KPSE_SEARCH_UNC is set.
+
+	 It doesn't seem a brilliant idea to overload the use of //,
+	 in this case meaning recursive search.  Using another
+	 character, like /usr/share/texmf/@, would probably cause less
+	 trouble. --jcn */
+
+      p = getenv ("KPSE_SEARCH_UNC");
+      if (ret > 1 && !(p && strcasecmp (p, "no")))
+	memmove(elt, elt+ret-1, strlen(elt+ret) + 1);
+#endif
   }
   
   if (KPSE_DEBUG_P (KPSE_DEBUG_STAT))
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/kpathsea/getopt.h ./texk/kpathsea/getopt.h
--- ../teTeX-src-beta-20020911/texk/kpathsea/getopt.h	2000-04-03 21:35:25.000000000 +0200
+++ ./texk/kpathsea/getopt.h	2002-09-12 11:10:59.000000000 +0200
@@ -26,17 +26,26 @@
 #ifndef __STDC__
 #define __STDC__ 1
 #endif
-#if defined (KPSE_DLL) || defined (GNUW32_DLL)
-#if defined (MAKE_KPSE_DLL) || defined (MAKE_GNUW32_DLL)
-#define KPSEDLL __declspec( dllexport)
-#else
-#define KPSEDLL __declspec( dllimport)
 #endif
-#else
+
+#define KPSE_DLL
+
+#if (defined (WIN32) || defined (__CYGWIN__)) && defined (KPSE_DLL)
+#ifdef MAKE_KPSE_DLL
+#ifdef __CYGWIN__
+#define KPSEDLL
+#define KPSEDLL_EXPORT
+#else /* ! CYGWIN */
 #define KPSEDLL
+#define KPSEDLL_EXPORT __declspec(dllexport)
+#endif /* ! CYGWIN */
+#else /* ! MAKE_KPSE_DLL */
+#define KPSEDLL __declspec(dllimport)
+#define KPSEDLL_EXPORT
 #endif
-#else /* ! WIN32 */
+#else /* ( !WIN32 && ! __CYGWIN__) || ! KPSE_DLL */
 #define KPSEDLL
+#define KPSEDLL_EXPORT
 #endif
 
 #ifdef	__cplusplus
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/kpathsea/mktex.opt ./texk/kpathsea/mktex.opt
--- ../teTeX-src-beta-20020911/texk/kpathsea/mktex.opt	2002-09-11 17:51:32.000000000 +0200
+++ ./texk/kpathsea/mktex.opt	2002-09-18 13:04:14.000000000 +0200
@@ -26,7 +26,11 @@ fi
 # MS-DOS and MS-Windows define $COMSPEC or $ComSpec and use `;' to separate
 # directories in path lists whereas Unix uses `:'.
 # Create a variable that holds the right character to be used by the scripts.
-if test -z "$COMSPEC" && test -z "$ComSpec"; then SEP=':'; else SEP=';'; fi
+case `uname -s` in
+    CYGWIN*|Cygwin*|cygwin*) ;;
+    *) if test -n "$COMSPEC" -o -n "$ComSpec"; then DOSISH=yes; fi
+esac
+if test -z "$DOSISH" -o "$DOSISH" = "no"; then SEP=':'; else SEP=';'; fi
 
 # TEMPDIR needs to be unique to each process because of the possibility of two
 # people running dvips (or whatever) simultaneously.
@@ -91,10 +95,10 @@ test -n "$MT_MKTEX_CNF" && test -r "$MT_
 
 # Possible features: appendonlydir dosnames fontmaps nomfdrivers nomode
 #                    stripsupplier striptypeface varfonts.
-if test -n "$COMSPEC"; then
-  : ${MT_FEATURES=appendonlydir:dosnames}
-else
+if test -z "$DOSISH" -o "$DOSISH" = "no"; then
   : ${MT_FEATURES=appendonlydir}
+else
+  : ${MT_FEATURES=appendonlydir:dosnames}
 fi
 : ${MODE=ljfour}
 : ${BDPI=600}
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/kpathsea/mktexlsr ./texk/kpathsea/mktexlsr
--- ../teTeX-src-beta-20020911/texk/kpathsea/mktexlsr	2002-09-11 17:51:45.000000000 +0200
+++ ./texk/kpathsea/mktexlsr	2002-09-18 13:02:49.000000000 +0200
@@ -25,7 +25,11 @@ build ls-R for. Else all directories in 
 # MS-DOS and MS-Windows define $COMSPEC or $ComSpec and use `;' to separate
 # directories in path lists whereas Unix uses `:'.
 # Create a variable that holds the right character to be used by the scripts.
-if test -z "$COMSPEC" && test -z "$ComSpec"; then SEP=':'; else SEP=';'; fi
+case `uname -s` in
+    CYGWIN*|Cygwin*|cygwin*) ;;
+    *) if test -n "$COMSPEC" -o -n "$ComSpec"; then DOSISH=yes; fi
+esac
+if test -z "$DOSISH" -o "$DOSISH" = "no"; then SEP=':'; else SEP=';'; fi
 
 # Add the location of the script to the PATH if necessary.  This must
 # be done before kpsewhich can be called, and thus cannot be put into
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/kpathsea/version.c ./texk/kpathsea/version.c
--- ../teTeX-src-beta-20020911/texk/kpathsea/version.c	1999-01-26 21:34:19.000000000 +0100
+++ ./texk/kpathsea/version.c	2002-09-12 11:10:59.000000000 +0200
@@ -1,7 +1,7 @@
 #include "c-auto.h"
 #include <kpathsea/c-proto.h>
 
-KPSEDLL char *kpathsea_version_string = (char *) KPSEVERSION;
+KPSEDLL_EXPORT char *kpathsea_version_string = (char *) KPSEVERSION;
 
 /* If you are redistributing a modified version of my original
    distribution, please change this address.
@@ -11,5 +11,5 @@ KPSEDLL char *kpathsea_version_string = 
 
    Thanks.  [EMAIL PROTECTED]  */
 
-KPSEDLL char *kpse_bug_address = (char *) 
+KPSEDLL_EXPORT char *kpse_bug_address = (char *) 
   "Email bug reports to [EMAIL PROTECTED]\n";
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/kpathsea/xdirname.c ./texk/kpathsea/xdirname.c
--- ../teTeX-src-beta-20020911/texk/kpathsea/xdirname.c	2001-11-17 22:33:10.000000000 +0100
+++ ./texk/kpathsea/xdirname.c	2002-09-12 11:10:59.000000000 +0200
@@ -37,7 +37,7 @@ xdirname P1C(const_string, name)
   
   if (NAME_BEGINS_WITH_DEVICE(name)) {
       limit = 2;
-#ifdef WIN32
+#if defined (WIN32) || defined (__CYGWIN__)
   } else if (IS_UNC_NAME(name)) {
       for (limit = 2; name[limit] && !IS_DIR_SEP(name[limit]); limit++)
           ;
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/tetex/epstopdf ./texk/tetex/epstopdf
--- ../teTeX-src-beta-20020911/texk/tetex/epstopdf	2002-04-17 20:46:31.000000000 +0200
+++ ./texk/tetex/epstopdf	2002-09-12 11:10:59.000000000 +0200
@@ -56,7 +56,6 @@ my $title = "\U$program\E $fileversion, 
 ### ghostscript command name
 my $GS = "gs";
 $GS = "gswin32c" if $^O eq 'MSWin32';
-$GS = "gswin32c" if $^O =~ /cygwin/;
 
 ### options
 $::opt_help=0;
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/tetex/texconfig ./texk/tetex/texconfig
--- ../teTeX-src-beta-20020911/texk/tetex/texconfig	2002-09-11 17:49:21.000000000 +0200
+++ ./texk/tetex/texconfig	2002-09-18 12:47:33.000000000 +0200
@@ -177,7 +177,7 @@ find_dialogtype()
 {
   { u=`uname -s`; } 2>/dev/null
   case "$u" in
-    FreeBSD|Linux)
+    FreeBSD|Linux|cygwin*|CYGWIN*)
       test -f /usr/bin/whiptail && DIALOG_PROG=/usr/bin/whiptail
       test -f /usr/bin/dialog && DIALOG_PROG=/usr/bin/dialog
       test -f /bin/dialog && DIALOG_PROG=/bin/dialog
@@ -300,7 +300,7 @@ exist_test()
 {
   type=$1 ; name=$2; what=$3
   if [ ! "$type" "$name" ]; then
-    msg="Could not find $what."
+    msg="Could not find $what. ($name)"
     if test -f "$log"; then
       msg="$msg\\n\\nThe programm will show you the error-log and then exit."
     else
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/tetex/thumbpdf ./texk/tetex/thumbpdf
--- ../teTeX-src-beta-20020911/texk/tetex/thumbpdf	2002-05-30 18:30:15.000000000 +0200
+++ ./texk/tetex/thumbpdf	2002-09-12 11:10:59.000000000 +0200
@@ -122,6 +122,8 @@ my $copyright   = "Copyright (c) 1999-20
 #   2002/05/26 v3.2
 #    * Fix: "MacOS/X: darwin" is now not interpreted as
 #      Windows.
+#   2002/07/17 v3.2.jcn1
+#    * Fix: Revert Cygwin detection: is unix.
 #
 
 ### program identification
@@ -136,12 +138,10 @@ my $GS = "gs";
 $GS = "gs386"    if $^O =~ /dos/i;
 $GS = "gsos2"    if $^O =~ /os2/i;
 $GS = "gswin32c" if $^O =~ /mswin32/i;
-$GS = "gswin32c" if $^O =~ /cygwin/i;
 
 # Windows detection (no SIGHUP)
 my $Win = 0;
 $Win = 1 if $^O =~ /mswin32/i;
-$Win = 1 if $^O =~ /cygwin/i;
 
 my $gspages = 1;
 $gspages = 0 if $^O =~ /dos/i;
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache ../teTeX-src-beta-20020911/texk/web2c/pdftexdir/Makefile.in ./texk/web2c/pdftexdir/Makefile.in
--- ../teTeX-src-beta-20020911/texk/web2c/pdftexdir/Makefile.in	2002-09-11 17:50:49.000000000 +0200
+++ ./texk/web2c/pdftexdir/Makefile.in	2002-09-12 11:10:59.000000000 +0200
@@ -8,9 +8,9 @@ kpathsea_srcdir_parent = $(srcdir)/../..
 kpathsea_dir_parent = ../..
 .SUFFIXES: .cc .o
 .cc.o:
-	$(CXX) $(CXXFLAGS) -c $<
+	$(CXX) $(ALL_CXXFLAGS) -c $<
 
-CXXFLAGS = @CXXFLAGS@ @DEFS@ $(XXCFLAGS) -I. -I$(srcdir) -I$(kpathsea_dir_parent) -I$(kpathsea_srcdir_parent) @LIBXPDFCPPFLAGS@
+ALL_CXXFLAGS = @CXXFLAGS@ @DEFS@ $(XXCFLAGS) -I. -I$(srcdir) -I$(kpathsea_dir_parent) -I$(kpathsea_srcdir_parent) @LIBXPDFCPPFLAGS@
 CXX = @CXX@
 
 # XCFLAGS=-Wstrict-prototypes -Wmissing-prototypes 
@@ -51,7 +51,7 @@ distclean maintainer-clean extraclean: c
 
 depend:
 	rm -f $(OBJS) ttf2afm.o pdftosrc.o
-	XXCFLAGS=-MM XCFLAGS=-MM make -k $(OBJS) ttf2afm.o pdftosrc.o | \
+	XXCFLAGS=-MM XCFLAGS=-MM $(MAKE) -k $(OBJS) ttf2afm.o pdftosrc.o | \
 	    grep -v "^$(CC)\|$(CXX)\|$(AR)\|make\|klibtool" | \
 	    sed 's: [^ ]*/\.\./libs/[^ ]*::g' > $(srcdir)/depend.mk
 
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/Makefile.in ./Makefile.in
--- ../wtetex-src-beta-20020911-4-cygwin/Makefile.in	2002-09-08 08:14:19.000000000 +0200
+++ ./Makefile.in	2002-09-18 14:11:23.000000000 +0200
@@ -46,6 +46,7 @@ exec_prefix = @exec_prefix@
 datadir = @datadir@
 bindir = @bindir@
 scriptdir = $(bindir)
+runscriptdir = @runscriptdir@
 manext = 1
 mandir = @mandir@/man$(manext)
 infodir = @infodir@
@@ -80,30 +81,30 @@ default: all
 install: all 
 	for dir in $(ESUBDIRS); do \
 	   echo making $@ in $$dir; \
-	     (cd $$dir && PATH=$(scriptdir):$(bindir):$(PATH) \
+	     (cd $$dir && PATH=$(runscriptdir):$(bindir):$(PATH) \
                 $(MAKE) $@) || exit 1; \
 	done
 	$(srcdir)/selfautofix "$(bindir)" "$(texmf)/web2c"
 	cd $(bindir); for i in $(ALLPROGS); do test -f $$i && { echo strip $$i; strip $$i || true; }; done; true
 	test -f $(scriptdir)/mktexlsr && \
-	  TEXMFMAIN=$(texmf) PATH=$(scriptdir):$(bindir):$(PATH) \
+	  TEXMFMAIN=$(texmf) PATH=$(runscriptdir):$(bindir):$(PATH) \
 	    $(scriptdir)/mktexlsr
 	test -f $(scriptdir)/fmtutil && \
-	  TEXMFMAIN=$(texmf) PATH=$(scriptdir):$(bindir):$(PATH) \
+	  TEXMFMAIN=$(texmf) PATH=$(runscriptdir):$(bindir):$(PATH) \
 	    $(scriptdir)/fmtutil --all
 	test -f $(scriptdir)/texlinks && \
-	  TEXMFMAIN=$(texmf) PATH=$(scriptdir):$(bindir):$(PATH) \
+	  TEXMFMAIN=$(texmf) PATH=$(runscriptdir):$(bindir):$(PATH) \
 	    $(scriptdir)/texlinks
 
 install-exec:
 	for dir in $(ESUBDIRS); do \
 	   echo making $@ in $$dir; \
-	   (cd $$dir && PATH=$(scriptdir):$(bindir):$(PATH) \
+	   (cd $$dir && PATH=$(runscriptdir):$(bindir):$(PATH) \
               $(MAKE) $@) || exit 1; \
 	done
 	cd $(bindir); for i in $(ALLPROGS); do test -f $$i && { echo strip $$i; strip $$i || true; }; done; true
 	test -f $(scriptdir)/texlinks && \
-	  TEXMF=$(texmf) TEXMFMAIN=$(texmf) PATH=$(scriptdir):$(bindir):$(PATH) \
+	  TEXMF=$(texmf) TEXMFMAIN=$(texmf) PATH=$(runscriptdir):$(bindir):$(PATH) \
 	    $(scriptdir)/texlinks
 
 strip:
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/configure.in ./configure.in
--- ../wtetex-src-beta-20020911-4-cygwin/configure.in	2002-05-20 08:23:43.000000000 +0200
+++ ./configure.in	2002-09-18 14:02:33.000000000 +0200
@@ -47,6 +47,7 @@ sinclude(texk/kpathsea/withenable.ac)
 sinclude(texk/kpathsea/xt.ac)
 sinclude(texk/web2c/withenable.ac)
 sinclude(texk/xdvik/withenable.ac)
+sinclude(texk/cross.ac)
 sinclude(libs/libwww/withenable.ac)
 sinclude(libs/ncurses/withenable.ac)
 sinclude(libs/libpng/withenable.ac)
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/configure.in ./texk/configure.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/configure.in	2000-04-03 20:37:13.000000000 +0200
+++ ./texk/configure.in	2002-09-18 14:02:33.000000000 +0200
@@ -34,6 +34,7 @@ dnl options, they must be added, so conf
 dnl will show all the options.
 sinclude(acklibtool.m4)
 sinclude(withenable.ac)
+sinclude(cross)	
 sinclude(kpathsea/withenable.ac)
 sinclude(web2c/withenable.ac)
 sinclude(xdvik/withenable.ac)
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/cross.ac ./texk/cross.ac
--- ../wtetex-src-beta-20020911-4-cygwin/texk/cross.ac	1970-01-01 01:00:00.000000000 +0100
+++ ./texk/cross.ac	2002-09-18 14:02:33.000000000 +0200
@@ -0,0 +1,80 @@
+dnl cross.ac: cross compilation stuff -*-autoconf-*-
+
+## 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)
+	
+if test "$cross_compiling" = "yes"; then
+  for_build='-for-build'
+  runscriptdir=/usr/bin
+  AC_PATH_PROG(DVIPS, dvips, /usr/bin/dvips)
+  AC_PATH_PROG(ETEX, etex, /usr/bin/etex)
+  AC_PATH_PROG(KPSEWHICH, kpsewhich, /usr/bin/kpsewhich)
+  AC_PATH_PROG(MF, mf, /usr/bin/mf)
+  AC_PATH_PROG(MPOST, mpost, /usr/bin/mpost)
+  AC_PATH_PROG(OMEGA, omega, /usr/bin/omega)
+  AC_PATH_PROG(OTANGLE, otangle, /usr/bin/otangle)
+  AC_PATH_PROG(PDFETEX, pdfetex, /usr/bin/pdfetex)
+  AC_PATH_PROG(PDFTEX, pdftex, /usr/bin/pdftex)
+  AC_PATH_PROG(PLTOTF, pltotf, /usr/bin/pltotf)
+  AC_PATH_PROG(TANGLE, tangle, /usr/bin/tangle)
+  AC_PATH_PROG(TEX, tex, /usr/bin/tex)
+  AC_PATH_PROG(TFTOPL, tftopl, /usr/bin/tftopl)
+  AC_PATH_PROG(TIE, tie, /usr/bin/tie)
+else
+  for_build=
+  runscriptdir='$(bindir)'
+  DVIPS=./dvips
+  ETEX=./etex
+  KPSEWHICH='$(kpathsea_dir)/kpsewhich'
+  MF=./mf
+  MPOST=./mpost
+  OMEGA=./omega
+  OTANGLE=./otangle
+  PDFETEX=./pdfetex
+  PDFTEX=./pdftex
+  PLTOTF=./pltotf
+  TANGLE=./tangle
+  TEX=./tex
+  TFTOPL=./tftopl
+  TIE=./tie
+fi
+
+AC_SUBST(for_build)
+AC_SUBST(runscriptdir)
+AC_SUBST(DVIPS)
+AC_SUBST(ETEX)
+AC_SUBST(KPSEWHICH)
+AC_SUBST(MF)
+AC_SUBST(MPOST)
+AC_SUBST(OMEGA)
+AC_SUBST(OTANGLE)
+AC_SUBST(PDFETEX)
+AC_SUBST(PDFTEX)
+AC_SUBST(PLTOTF)
+AC_SUBST(TANGLE)
+AC_SUBST(TEX)
+AC_SUBST(TFTOPL)
+AC_SUBST(TIE)
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/dviljk/configure.in ./texk/dviljk/configure.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/dviljk/configure.in	1999-02-08 22:42:01.000000000 +0100
+++ ./texk/dviljk/configure.in	2002-09-18 14:02:33.000000000 +0200
@@ -9,6 +9,7 @@ AC_PROG_MAKE_SET
 AC_PROG_LN_S
 
 sinclude(../kpathsea/withenable.ac)
+sinclude(../cross.ac)
 
 dnl These tests prevent reliable cross-compilation.  Sigh.
 AC_C_CHAR_UNSIGNED
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/dvipsk/Makefile.in ./texk/dvipsk/Makefile.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/dvipsk/Makefile.in	2002-05-27 23:08:07.000000000 +0200
+++ ./texk/dvipsk/Makefile.in	2002-09-18 19:28:54.000000000 +0200
@@ -19,12 +19,14 @@ ac_include ../make/programs.mk
 ac_include ../make/texi.mk
 prog_cflags = -DUNIX -DKPATHSEA -DNeedFunctionPrototypes -DSHIFTLOWCHARS
 
+DVIPS = @DVIPS@
+
 # The `t[mp]-' business is so that we don't create an empty .pro file,
 # if running squeeze fails for some reason.  A dependency on squeeze
 # fails here, so we include it below.
 .SUFFIXES: .pro .lpro
 .lpro.pro:
-	./squeeze <$< >t-$@
+	./squeeze$(for-build) <$< >t-$@
 	mv t-$@ $@
 prologues = tex.pro texps.pro texc.pro special.pro finclude.pro \
             color.pro crop.pro hps.pro
@@ -45,11 +47,11 @@ $(program): $(kpathsea) $(objects)
 	$(kpathsea_link) $(objects) $(LOADLIBES) 
 afm2tfm: $(kpathsea) afm2tfm.o
 	$(kpathsea_link) afm2tfm.o $(LOADLIBES) 
-# Omit LOADLIBES since no need to dynamically link with kpathsea.
 squeeze: squeeze.o
 	$(link_command) squeeze.o $(LIBS) $(XLOADLIBES)
+squeeze-for-build: squeeze$(for-build).o
 
-$(prologues): squeeze
+$(prologues): squeeze$(for-build)
 texc.lpro: texc.script tex.lpro
 	$(SHELL) $(srcdir)/texc.script $(srcdir)/tex.lpro $@
 
@@ -59,11 +61,11 @@ check: all
 	rm -f mtest.ps
 	-(TFMFONTS=$(srcdir)/testdata: VFFONTS=$(srcdir)/testdata: \
 	TEXPSHEADERS=$(srcdir)/testdata TEXCONFIG=$(srcdir)/testdata \
-	  ./dvips -D 300 $(srcdir)/testdata/dvipstst.xdv -o dvipstst.ps)
+	  $(DVIPS) -D 300 $(srcdir)/testdata/dvipstst.xdv -o dvipstst.ps)
 	mv dvipstst.ps mtest.ps
 	-(TFMFONTS=$(srcdir)/testdata: VFFONTS=$(srcdir)/testdata: \
 	TEXPSHEADERS=$(srcdir)/testdata: TEXCONFIG=$(srcdir)/testdata: \
-	  ./dvips -D 300 $(srcdir)/testdata/dvipstst.xdv -o)
+	  $(DVIPS) -D 300 $(srcdir)/testdata/dvipstst.xdv -o)
 	-diff $(srcdir)/testdata/dvipstst.xps dvipstst.ps
 
 install: install-exec install-data
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/dvipsk/configure.in ./texk/dvipsk/configure.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/dvipsk/configure.in	2002-01-31 20:59:19.000000000 +0100
+++ ./texk/dvipsk/configure.in	2002-09-18 14:02:33.000000000 +0200
@@ -13,6 +13,7 @@ AC_CHECK_LIB(m, main,LIBS="$LIBS -lm")
 
 
 sinclude(../kpathsea/withenable.ac)
+sinclude(../cross.ac)
 
 dnl These tests prevent reliable cross-compilation.  Sigh.
 dnl Some special hacks are used to make cross-compilation
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/etc/autoconf/acsite.m4 ./texk/etc/autoconf/acsite.m4
--- ../wtetex-src-beta-20020911-4-cygwin/texk/etc/autoconf/acsite.m4	1998-03-04 14:19:45.000000000 +0100
+++ ./texk/etc/autoconf/acsite.m4	2002-09-18 14:02:33.000000000 +0200
@@ -15,7 +15,7 @@ AC_SUBST(LIBTOOL_LIBOBJS)dnl
 
 dnl Check if gcc asm for i386 needs external symbols with an underscore.
 dnl Peter Breitenlohner, April 15, 1996.
-undefine([pb_AC_ASM_UNDERSCORE])
+# undefine([pb_AC_ASM_UNDERSCORE])
 AC_DEFUN(pb_AC_ASM_UNDERSCORE,
 [AC_REQUIRE_CPP()dnl
 AC_CACHE_CHECK(whether gcc asm needs underscore, pb_cv_asm_underscore,
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/etc/autoconf/acspecific.m4 ./texk/etc/autoconf/acspecific.m4
--- ../wtetex-src-beta-20020911-4-cygwin/texk/etc/autoconf/acspecific.m4	2000-04-03 10:57:39.000000000 +0200
+++ ./texk/etc/autoconf/acspecific.m4	2002-09-18 14:02:33.000000000 +0200
@@ -117,43 +117,6 @@ else
 fi
 ])
 
-AC_DEFUN(AC_PROG_CXX,
-[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
-AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, gcc)
-
-AC_PROG_CXX_WORKS
-AC_PROG_CXX_GNU
-
-if test $ac_cv_prog_gxx = yes; then
-  GXX=yes
-else
-  GXX=
-fi
-
-dnl Check whether -g works, even if CXXFLAGS is set, in case the package
-dnl plays around with CXXFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
-ac_test_CXXFLAGS="${CXXFLAGS+set}"
-ac_save_CXXFLAGS="$CXXFLAGS"
-CXXFLAGS=
-AC_PROG_CXX_G
-if test "$ac_test_CXXFLAGS" = set; then
-  CXXFLAGS="$ac_save_CXXFLAGS"
-elif test $ac_cv_prog_cxx_g = yes; then
-  if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
-  else
-    CXXFLAGS="-g"
-  fi
-else
-  if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
-  else
-    CXXFLAGS=
-  fi
-fi
-])
-
 dnl Determine a Fortran 77 compiler to use.  If `F77' is not already set
 dnl in the environment, check for `g77', `f77' and `f2c', in that order.
 dnl Set the output variable `F77' to the name of the compiler found.
@@ -2687,6 +2650,44 @@ AC_SUBST(X_LIBS)dnl
 AC_SUBST(X_EXTRA_LIBS)dnl
 ])
 
+dnl Check for C++.  Do this after checking all libraries -- jcn
+AC_DEFUN(AC_PROG_CXX,
+[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
+AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, gcc)
+
+AC_PROG_CXX_WORKS
+AC_PROG_CXX_GNU
+
+if test $ac_cv_prog_gxx = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+
+dnl Check whether -g works, even if CXXFLAGS is set, in case the package
+dnl plays around with CXXFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+ac_test_CXXFLAGS="${CXXFLAGS+set}"
+ac_save_CXXFLAGS="$CXXFLAGS"
+CXXFLAGS=
+AC_PROG_CXX_G
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS="$ac_save_CXXFLAGS"
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+])
+
 dnl The old Cygwin32 macro is deprecated.
 AC_DEFUN(AC_CYGWIN32,
 [AC_OBSOLETE([$0], [; instead use AC_CYGWIN])dnl
@@ -2777,11 +2778,15 @@ dnl Setting ac_exeext will implicitly ch
 ac_exeext=$EXEEXT
 AC_SUBST(EXEEXT)])
 
+
+dnl This is completely and utterly broken -- jcn
+dnl Non-autoconf functions should not be prefixed 'AC_' anyway
+
 dnl Unset CC to run configure with cross compiler.
-AC_DEFUN(AC_UNSET_CC, [
+AC_DEFUN(BROKEN_AC_UNSET_CC, [
 ZZ=
 if test "$cross_compiling" = yes &&
-   (test "x$CC" = "xdos-gcc" || test "x$CC" = "xi386-mingw32-gcc" || test "x$CC" = "xgnuwin32gcc") ; then
+  (test "x$CC" = "xdos-gcc" || test "x$CC" = "xi386-mingw32-gcc" || test "x$CC" = "xgnuwin32gcc") ; then
 ZZ=$CC
 unset CC
 cross_compiling=no
@@ -2789,13 +2794,16 @@ fi
 ])
 
 dnl Restore CC that has been unset by AC_UNSET_CC
-AC_DEFUN(AC_RESET_CC, [
+AC_DEFUN(BROKEN_AC_RESET_CC, [
 if test "x$ZZ" = "xdos-gcc" || test "x$ZZ" = "xi386-mingw32-gcc" || test "x$ZZ" = "xgnuwin32gcc" ; then
 CC=$ZZ
 cross_compiling=yes
 fi
 ])
 
+AC_DEFUN(AC_UNSET_CC, true)
+AC_DEFUN(AC_RESET_CC, true)
+
 
 dnl ### Checks for UNIX variants
 dnl These are kludges which should be replaced by a single POSIX check.
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/gsftopk/configure.in ./texk/gsftopk/configure.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/gsftopk/configure.in	1999-04-22 07:53:37.000000000 +0200
+++ ./texk/gsftopk/configure.in	2002-09-18 14:02:33.000000000 +0200
@@ -9,6 +9,7 @@ AC_PROG_MAKE_SET
 AC_PROG_LN_S
 
 sinclude(../kpathsea/withenable.ac)
+sinclude(../cross.ac)
 
 dnl Checks for header files.
 AC_HEADER_SYS_WAIT
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/make/common.mk ./texk/make/common.mk
--- ../wtetex-src-beta-20020911-4-cygwin/texk/make/common.mk	1999-06-28 22:09:57.000000000 +0200
+++ ./texk/make/common.mk	2002-09-18 14:02:33.000000000 +0200
@@ -48,4 +48,41 @@ kpathsea = $(kpathsea_dir)/libkpathsea.l
 @MAINT@XDEFS = -Wpointer-arith $(warn_more)
 @MAINT@CFLAGS = -pipe -g $(XCFLAGS)
 @MAINT@endif
+
+
+
+## Cross build stuff -- jcn
+
+cross_compiling = @cross_compiling@
+for-build = @for_build@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CCLD_FOR_BUILD = @CCLD_FOR_BUILD@
+CFLAGS_FOR_BUILD = '-Duexit=exit' $(ALL_CFLAGS)
+
+
+## Override default rule; this should be compiled for BUILD host.
+%-for-build.o: %.c
+	if [ "$(cross_compiling)" = "yes" ]; then \
+		$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c -o $@ $<; \
+	else \
+		$(compile) $<; \
+	fi
+
+## Override default rule; this should run on BUILD host.
+%-for-build: %-for-build.o
+	@rm -f $@
+	if [ "$(cross_compiling)" = "yes" ]; then \
+		$(CCLD_FOR_BUILD) -o $@ $< $(LOADLIBES_FOR_BUILD); \
+	else \
+		$(kpathsea_link) $< $(LOADLIBES); \
+	fi
+
+%: %.exe
+	cp -f $< $@
+
+%-for-build: %-for-build.exe
+	cp -f $< $@
+
+
+
 # End of common.mk.
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/make/programs.mk ./texk/make/programs.mk
--- ../wtetex-src-beta-20020911-4-cygwin/texk/make/programs.mk	2001-10-27 12:21:12.000000000 +0200
+++ ./texk/make/programs.mk	2002-09-18 14:02:33.000000000 +0200
@@ -7,7 +7,8 @@ LDFLAGS = @LDFLAGS@ $(XLDFLAGS)
 # proglib is for web2c; 
 # XLOADLIBES is for the installer.
 LIBS = @LIBS@
-LOADLIBES = $(proglib) $(kpathsea) $(LIBS) $(XLOADLIBES)
+LOADLIBES = $(proglib) $(kpathsea) $(XLOADLIBES)
+LOADLIBES_FOR_BUILD = $(proglib-for-build) -lkpathsea -lm 
 
 # May as well separate linking from compiling, just in case.
 CCLD = $(CC)
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/makeindexk/configure.in ./texk/makeindexk/configure.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/makeindexk/configure.in	1999-02-08 22:42:13.000000000 +0100
+++ ./texk/makeindexk/configure.in	2002-09-18 14:02:33.000000000 +0200
@@ -9,6 +9,7 @@ AC_PROG_MAKE_SET
 AC_PROG_LN_S
 
 sinclude(../kpathsea/withenable.ac)
+sinclude(../cross.ac)
 
 AC_ARG_PROGRAM
 AC_HAVE_HEADERS(ctype.h types.h)
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/odvipsk/Makefile.in ./texk/odvipsk/Makefile.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/odvipsk/Makefile.in	2002-05-27 23:08:31.000000000 +0200
+++ ./texk/odvipsk/Makefile.in	2002-09-18 19:29:39.000000000 +0200
@@ -24,7 +24,7 @@ prog_cflags = -DUNIX -DKPATHSEA -DNeedFu
 # fails here, so we include it below.
 .SUFFIXES: .pro .lpro
 .lpro.pro:
-	./squeeze <$< >t-$@
+	./squeeze$(for-build) <$< >t-$@
 	mv t-$@ $@
 prologues = tex.pro texps.pro texc.pro special.pro finclude.pro \
             color.pro crop.pro hps.pro
@@ -45,11 +45,11 @@ $(program): $(kpathsea) $(objects)
 	$(kpathsea_link) $(objects) $(LOADLIBES) 
 afm2tfm: $(kpathsea) afm2tfm.o
 	$(kpathsea_link) afm2tfm.o $(LOADLIBES) 
-# Omit LOADLIBES since no need to dynamically link with kpathsea.
 squeeze: squeeze.o
 	$(link_command) squeeze.o $(LIBS) $(XLOADLIBES)
+squeeze-for-build: squeeze$(for-build).o
 
-$(prologues): squeeze
+$(prologues): squeeze$(for-build)
 texc.lpro: texc.script tex.lpro
 	$(SHELL) $(srcdir)/texc.script $(srcdir)/tex.lpro $@
 
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/odvipsk/configure.in ./texk/odvipsk/configure.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/odvipsk/configure.in	2002-01-31 20:59:19.000000000 +0100
+++ ./texk/odvipsk/configure.in	2002-09-18 14:02:33.000000000 +0200
@@ -13,6 +13,7 @@ AC_CHECK_LIB(m, main,LIBS="$LIBS -lm")
 
 
 sinclude(../kpathsea/withenable.ac)
+sinclude(../cross.ac)
 
 dnl These tests prevent reliable cross-compilation.  Sigh.
 dnl Some special hacks are used to make cross-compilation
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/oxdvik/Makefile.in ./texk/oxdvik/Makefile.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/oxdvik/Makefile.in	2002-05-23 19:44:43.000000000 +0200
+++ ./texk/oxdvik/Makefile.in	2002-09-18 19:30:06.000000000 +0200
@@ -61,6 +61,7 @@ $(program): $(kpathsea) $(objects) $(LIB
 
 squeeze: squeeze.o
 	$(link_command) squeeze.o $(LIBS) $(XLOADLIBES)
+squeeze-for-build: squeeze$(for-build).o
 
 ###
 ### the CC_CONCAT_FILES listed here use ANSI-style string concatenation;
@@ -85,8 +86,8 @@ krheader.h: $(CC_CONCAT_FILES) c-auto.h 
 	>> krheader.h; done
 	echo "#endif /* HAVE_CC_CONCAT */" >> krheader.h
 
-psheader.c: psheader.txt squeeze
-	./squeeze $(srcdir)/psheader.txt $@
+psheader.c: psheader.txt squeeze$(for-build)
+	./squeeze$(for-build) $(srcdir)/psheader.txt $@
 
 xdvi.1: xdvi.man sedscript
 	sed -f sedscript <$(srcdir)/xdvi.man >$@
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/oxdvik/configure.in ./texk/oxdvik/configure.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/oxdvik/configure.in	2002-05-23 17:24:22.000000000 +0200
+++ ./texk/oxdvik/configure.in	2002-09-18 14:03:15.000000000 +0200
@@ -47,6 +47,7 @@ AC_CHECK_HEADERS(netdb.h sys/bsdtypes.h 
 
 sinclude(../kpathsea/xt.ac)
 sinclude(withenable.ac)
+sinclude(../cross.ac)
 sinclude(../../libs/libwww/withenable.ac)
 sinclude(../../libs/libwww/libwww.ac)
 sinclude(../../libs/zlib/withenable.ac)
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/ps2pkm/configure.in ./texk/ps2pkm/configure.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/ps2pkm/configure.in	2001-10-30 22:09:23.000000000 +0100
+++ ./texk/ps2pkm/configure.in	2002-09-18 14:02:33.000000000 +0200
@@ -9,6 +9,7 @@ AC_PROG_MAKE_SET
 AC_PROG_LN_S
 
 sinclude(../kpathsea/withenable.ac)
+sinclude(../cross.ac)
 AC_CHECK_LIB(m, main)
 
 dnl Checks for header files.
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/tetex/configure.in ./texk/tetex/configure.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/tetex/configure.in	1999-02-08 22:42:27.000000000 +0100
+++ ./texk/tetex/configure.in	2002-09-18 14:02:33.000000000 +0200
@@ -6,5 +6,6 @@ AC_PROG_MAKE_SET
 AC_PROG_LN_S
 
 sinclude(../kpathsea/withenable.ac)
+sinclude(../cross.ac)
 
 AC_OUTPUT(Makefile)
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/Makefile.in ./texk/web2c/Makefile.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/Makefile.in	2002-05-30 18:31:16.000000000 +0200
+++ ./texk/web2c/Makefile.in	2002-09-18 18:25:15.000000000 +0200
@@ -29,6 +29,17 @@ ac_include ../make/paths.mk
 DIFF = diff
 DIFFFLAGS =
 
+KPSEWHICH = @KPSEWHICH@
+TANGLE = @TANGLE@
+OTANGLE = @OTANGLE@
+TEX = @TEX@
+ETEX = @ETEX@
+PDFTEX = @PDFTEX@
+PDFETEX = @PDFETEX@
+MF = @MF@
+MPOST = @MPOST@
+OMEGA = @OMEGA@
+
 .SUFFIXES: # get rid of .p.o
 ac_include ../make/common.mk
 ac_include ../make/programs.mk
@@ -68,6 +79,7 @@ install_makeargs = INSTALL='$(INSTALL)' 
   $(makevars) $(common_makeargs)  
 
 proglib = lib/lib.a
+proglib-for-build = lib/lib-for-build.a
 windowlib = window/window.a
 @PTEX@ZLIBDIR=../../libs/zlib
 @PTEX@ZLIBSRCDIR=$(srcdir)/$(ZLIBDIR)
@@ -93,7 +105,7 @@ windowlib = window/window.a
 web2c = srcdir=$(srcdir) $(shared_env) $(SHELL) $(srcdir)/web2c/convert
 # Additional dependencies:
 web2c_aux = web2c/convert web2c/common.defines
-web2c_programs = web2c/fixwrites web2c/splitup web2c/web2c
+web2c_programs = web2c/fixwrites$(for-build) web2c/splitup$(for-build) web2c/web2c$(for-build)
 
 # Unfortunately, suffix rules can't have dependencies, or multiple
 # targets, and we can't assume all makes supports pattern rules.
@@ -101,7 +113,7 @@ web2c_programs = web2c/fixwrites web2c/s
 .p.c: # really depends on $(web2c_programs), and generates .h.
 	$(web2c) $*
 .ch.p: # really depends on ./tangle; for mf/mp/tex, also generates .pool
-	$(shared_env) ./tangle $(srcdir)/$*.web $<
+	$(shared_env) $(TANGLE) $(srcdir)/$*.web $<
 
 # These definitions have to come before the rules that expand them.
 # The *{ini,[0-2]}.c files are created by splitup, run as part of convert.
@@ -211,6 +223,7 @@ tex: $(tex_o)
 	$(kpathsea_link) $(tex_o) $(socketlibs) $(LOADLIBES)
 tie: tie.o
 	$(kpathsea_link) tie.o $(LOADLIBES)
+tie-for-build: tie$(for-build).o
 tftopl: tftopl.o
 	$(kpathsea_link) tftopl.o $(LOADLIBES)
 vftovp: vftovp.o
@@ -228,7 +241,7 @@ $(mpware): $(mpware_sources)
 bibtex.p dvicopy.p dvitomp.p dvitype.p etex.p gftopk.p gftodvi.p gftype.p \
   mf.p mft.p mp.p odvicopy.p odvitype.p omega.p otangle.p patgen.p pdfetex.p \
   pdftex.p pktogf.p pktype.p pltotf.p pooltype.p tex.p tftopl.p vftovp.p \
-  vptovf.p weave.p: tangle
+  vptovf.p weave.p: $(TANGLE)
 # We need to be explicit for a number of programs because there is a
 # $(srcdir) in the suffix rule.  This also means we can use a different
 # suffix for the change file than .ch, if we want to.
@@ -237,7 +250,7 @@ dvicopy.p: dvicopy.web dvicopy.ch
 dvitomp.p: dvitomp.web dvitomp.ch
 dvitype.p: dvitype.web dvitype.ch
 etex.p etex.pool: etex.web etex.ch
-	$(shared_env) ./tangle etex.web etex.ch
+	$(shared_env) $(TANGLE) etex.web etex.ch
 gftodvi.p: gftodvi.web gftodvi.ch
 gftopk.p: gftopk.web gftopk.ch
 gftype.p: gftype.web gftype.ch
@@ -245,18 +258,18 @@ mf.p mf.pool: mf.web mf.ch
 mp.p mp.pool: mp.web mp.ch
 mft.p: mft.web mft.ch
 odvicopy.p: odvicopy.web odvicopy.ch
-	$(shared_env) ./tangle odvicopy.web odvicopy.ch
+	$(shared_env) $(TANGLE) odvicopy.web odvicopy.ch
 odvitype.p: odvitype.web odvitype.ch
-	$(shared_env) ./tangle odvitype.web odvitype.ch
+	$(shared_env) $(TANGLE) odvitype.web odvitype.ch
 otangle.p: otangle.web otangle.ch
-	$(shared_env) ./tangle otangle.web otangle.ch
+	$(shared_env) $(TANGLE) otangle.web otangle.ch
 omega.p omega.pool: otangle omega.web omega.ch
-	$(shared_env) ./otangle omega.web omega.ch
+	$(shared_env) $(OTANGLE) omega.web omega.ch
 patgen.p: patgen.web patgen.ch
 pdftex.p pdftex.pool: pdftex.web pdftex.ch
-	$(shared_env) ./tangle pdftex.web pdftex.ch
+	$(shared_env) $(TANGLE) pdftex.web pdftex.ch
 pdfetex.p pdfetex.pool: pdfetex.web pdfetex.ch
-	$(shared_env) ./tangle pdfetex.web pdfetex.ch
+	$(shared_env) $(TANGLE) pdfetex.web pdfetex.ch
 pktogf.p: pktogf.web pktogf.ch
 pktype.p: pktype.web pktype.ch
 pltotf.p: pltotf.web pltotf.ch
@@ -325,11 +338,12 @@ $(web2c_programs) $(programs) tangle tan
 tangle: tangle.o
 	$(kpathsea_link) tangle.o $(LOADLIBES)
 	$(MAKE) $(common_makeargs) tangleboot.p
+tangle-for-build: tangle$(for-build).o
 # tangle.p is a special case, since it is needed to compile itself.  We
 # convert and compile the (distributed) tangleboot.p to make a tangle
 # which we use to make the other programs.
-tangle.p: tangleboot tangle.web tangle.ch
-	$(shared_env) ./tangleboot $(srcdir)/tangle.web $(srcdir)/tangle.ch
+tangle.p: tangleboot$(for-build) tangle.web tangle.ch
+	$(shared_env) ./tangleboot$(for-build) $(srcdir)/tangle.web $(srcdir)/tangle.ch
 tangle.web:
 	@echo "You seem to be missing tangle.web, perhaps because you" >&2
 	@echo "didn't retrieve web.tar.gz, only web2c.tar.gz." >&2
@@ -343,17 +357,22 @@ tangle.web:
 
 tangleboot: tangleboot.o
 	$(kpathsea_link) tangleboot.o $(LOADLIBES)
+tangleboot-for-build: tangleboot$(for-build).o
 tangleboot.c tangleboot.h: stamp-tangle $(web2c_programs) $(web2c_aux)
 	$(web2c) tangleboot
 # tangleboot.p is in the distribution
-stamp-tangle: tangleboot.p
+stamp-tangle: $(srcdir)/tangleboot.p
 	date >stamp-tangle
+%-for-build.c: %.c
+	cp -pv $< $@
+%-for-build.p: %.p
+	cp -pv $< $@
 # This is not run unless tangle.web or tangle.ch is changed.
-# Only try to run ./tangle if it actually exists, otherwise
+# Only try to run $(TANGLE) if it actually exists, otherwise
 # just touch tangleboot.p and build tangle.
 tangleboot.p: tangle.web tangle.ch
-	if [ -r ./tangle ] || [ -r ./tangle.exe ]; then \
-	  $(shared_env) ./tangle $(srcdir)/tangle.web $(srcdir)/tangle.ch; \
+	if [ -r $(TANGLE) ] || [ -r ./tangle.exe ]; then \
+	  $(shared_env) $(TANGLE) $(srcdir)/tangle.web $(srcdir)/tangle.ch; \
 	  mv tangle.p tangleboot.p; \
 	else \
 	  touch tangleboot.p; \
@@ -396,12 +415,12 @@ window/trap.o: $(srcdir)/window/trap.c
 @PTEX@$(pdflib): $(LIBTIFFDEP)
 
 # The web2c program consists of several executables.
-web2c/fixwrites: web2c/fixwrites.c
-	cd web2c && $(MAKE) $(common_makeargs) fixwrites
-web2c/splitup: web2c/splitup.c
-	cd web2c && $(MAKE) $(common_makeargs) splitup
-web2c/web2c: web2c/main.c web2c/web2c.h web2c/web2c.l web2c/web2c.y
-	cd web2c && $(MAKE) $(common_makeargs) web2c
+web2c/fixwrites$(for-build): web2c/fixwrites.c
+	cd web2c && $(MAKE) $(common_makeargs) fixwrites$(for-build)
+web2c/splitup$(for-build): web2c/splitup.c
+	cd web2c && $(MAKE) $(common_makeargs) splitup$(for-build)
+web2c/web2c$(for-build): web2c/main.c web2c/web2c.h web2c/web2c.l web2c/web2c.y
+	cd web2c && $(MAKE) $(common_makeargs) web2c$(for-build)
 
 ac_include ../make/tkpathsea.mk
 
@@ -431,75 +450,75 @@ mems: $(all_mems)
 
 tex.fmt: tex
 	$(dumpenv) $(MAKE) progname=tex files="plain.tex cmr10.tfm" prereq-check
-	$(dumpenv) ./tex --fmt=tex --ini \\input plain \\dump </dev/null
+	$(dumpenv) $(TEX) --fmt=tex --ini \\input plain \\dump </dev/null
 
 latex.fmt: tex
 	$(dumpenv) $(MAKE) progname=latex files="latex.ltx" prereq-check
-	$(dumpenv) ./tex --progname=latex --ini \\input latex.ltx </dev/null
+	$(dumpenv) $(TEX) --progname=latex --ini \\input latex.ltx </dev/null
 
 etex.efmt: etex
 	$(dumpenv) $(MAKE) progname=etex files="etex.src plain.tex cmr10.tfm" prereq-check
-	$(dumpenv) ./etex --efmt=etex --ini \*\\input etex.src \\dump </dev/null
+	$(dumpenv) $(ETEX) --efmt=etex --ini \*\\input etex.src \\dump </dev/null
 
 elatex.efmt: etex
 	$(dumpenv) $(MAKE) progname=elatex files="latex.ltx" prereq-check
-	$(dumpenv) ./etex --efmt=elatex --ini \*\\input latex.ltx </dev/null
+	$(dumpenv) $(ETEX) --efmt=elatex --ini \*\\input latex.ltx </dev/null
 
 tex.efmt: etex
 	$(dumpenv) $(MAKE) progname=tex files="plain.tex cmr10.tfm" prereq-check
-	$(dumpenv) ./etex --efmt=tex --ini \\input plain \\dump </dev/null
+	$(dumpenv) $(ETEX) --efmt=tex --ini \\input plain \\dump </dev/null
 
 latex.efmt: etex
 	$(dumpenv) $(MAKE) progname=latex files="latex.ltx" prereq-check
-	$(dumpenv) ./etex --progname=latex --ini \\input latex.ltx </dev/null
+	$(dumpenv) $(ETEX) --progname=latex --ini \\input latex.ltx </dev/null
 
 omega.fmt: omega
 	$(dumpenv) $(MAKE) progname=omega files="omega.tex" prereq-check
-	$(dumpenv) ./omega --ini \\input omega.tex \\dump </dev/null
+	$(dumpenv) $(OMEGA) --ini \\input omega.tex \\dump </dev/null
 
 lambda.fmt: omega
 	$(dumpenv) $(MAKE) progname=lambda files="lambda.tex" prereq-check
-	$(dumpenv) ./omega --ini --progname=lambda \\input lambda.tex </dev/null
+	$(dumpenv) $(OMEGA) --ini --progname=lambda \\input lambda.tex </dev/null
 
 pdftex.fmt: pdftex
 	$(dumpenv) $(MAKE) progname=pdftex files="plain.tex cmr10.tfm" prereq-check
-	$(dumpenv) ./pdftex --fmt=pdftex --ini \\pdfoutput=1 \\input plain \\dump </dev/null
+	$(dumpenv) $(PDFTEX) --fmt=pdftex --ini \\pdfoutput=1 \\input plain \\dump </dev/null
 
 pdflatex.fmt: pdftex
 	$(dumpenv) $(MAKE) progname=pdflatex files="latex.ltx" prereq-check
-	$(dumpenv) ./pdftex --fmt=pdflatex --ini \\pdfoutput=1 \\input latex.ltx </dev/null
+	$(dumpenv) $(PDFTEX) --fmt=pdflatex --ini \\pdfoutput=1 \\input latex.ltx </dev/null
 
 pdftexinfo.fmt: pdftex
 	$(dumpenv) $(MAKE) progname=pdftexinfo files="pdftexinfo.ini" prereq-check
-	$(dumpenv) ./pdftex --progname=pdftexinfo --ini pdftexinfo.ini </dev/null
+	$(dumpenv) $(PDFTEX) --progname=pdftexinfo --ini pdftexinfo.ini </dev/null
 
 pdfetex.efmt: pdfetex
 	$(dumpenv) $(MAKE) progname=pdfetex files="etex.src plain.tex cmr10.tfm" prereq-check
-	$(dumpenv) ./pdfetex --efmt=pdfetex --ini \*\\pdfoutput=1\\input etex.src \\dump </dev/null
+	$(dumpenv) $(PDFETEX) --efmt=pdfetex --ini \*\\pdfoutput=1\\input etex.src \\dump </dev/null
 
 pdfelatex.efmt: pdfetex
 	$(dumpenv) $(MAKE) progname=pdfelatex files="latex.ltx" prereq-check
-	$(dumpenv) ./pdfetex --efmt=pdfelatex --ini \*\\pdfoutput=1\\input latex.ltx </dev/null
+	$(dumpenv) $(PDFETEX) --efmt=pdfelatex --ini \*\\pdfoutput=1\\input latex.ltx </dev/null
 
 mltex.fmt: tex
 	$(dumpenv) $(MAKE) progname=mltex files="plain.tex cmr10.tfm" prereq-check
-	$(dumpenv) ./tex --mltex --fmt=mltex --ini \\input plain \\dump </dev/null
+	$(dumpenv) $(TEX) --mltex --fmt=mltex --ini \\input plain \\dump </dev/null
 
 mllatex.fmt: tex
 	$(dumpenv) $(MAKE) progname=mllatex files="latex.ltx" prereq-check
-	$(dumpenv) ./tex --mltex --fmt=mllatex --ini \\input latex.ltx </dev/null
+	$(dumpenv) $(TEX) --mltex --fmt=mllatex --ini \\input latex.ltx </dev/null
 
 mf.base: mf
 	$(dumpenv) $(MAKE) progname=mf files="plain.mf cmr10.mf $(localmodes).mf" prereq-check
-	$(dumpenv) ./mf --base=mf --ini \\input plain input $(localmodes) dump </dev/null
+	$(dumpenv) $(MF) --base=mf --ini \\input plain input $(localmodes) dump </dev/null
 
 mpost.mem: mpost
 	$(dumpenv) $(MAKE) progname=mpost files=plain.mp prereq-check
-	$(dumpenv) ./mpost --mem=mpost --ini \\input plain dump </dev/null
+	$(dumpenv) $(MPOST) --mem=mpost --ini \\input plain dump </dev/null
 
 # This is meant to be called recursively, with $(files) set.
 prereq-check: $(kpathsea_dir)/kpsewhich
-	$(kpathsea_dir)/kpsewhich --progname=$(progname) $(files) >/dev/null || $(MAKE) prereq-lose >/dev/null
+	$(KPSEWHICH) --progname=$(progname) $(files) >/dev/null || $(MAKE) prereq-lose >/dev/null
 
 prereq-lose:
 	@echo "You seem to be missing input files necessary to make the" >&2
@@ -517,15 +536,15 @@ prereq-lose:
 $(kpathsea_dir)/kpsewhich: $(kpathsea)
 
 amstex.fmt: tex
-	$(dumpenv) ./tex --progname=amstex --ini amstex.ini </dev/null
+	$(dumpenv) $(TEX) --progname=amstex --ini amstex.ini </dev/null
 
 # Texinfo changes the escape character from `\' to `@'.
 texinfo.fmt: tex.fmt
-	$(dumpenv) ./tex --progname=texinfo --ini texinfo @dump </dev/null
+	$(dumpenv) $(TEX) --progname=texinfo --ini texinfo @dump </dev/null
 
 eplain.fmt: tex.fmt
 	touch eplain.aux # Makes cross-reference warnings work right.
-	$(dumpenv) ./tex --progname=eplain --ini \&./tex eplain \\dump </dev/null
+	$(dumpenv) $(TEX) --progname=eplain --ini \&./tex eplain \\dump </dev/null
 
 # 
 install: install-exec install-data
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/configure.in ./texk/web2c/configure.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/configure.in	2002-03-09 19:37:29.000000000 +0100
+++ ./texk/web2c/configure.in	2002-09-18 14:02:33.000000000 +0200
@@ -81,6 +81,7 @@ test "x$with_x" = xno && with_x_toolkit=
 : ${with_x=no} # tell PATH_XTRA no X by default, if not specified.
 
 sinclude(withenable.ac)
+sinclude(../cross.ac)
 sinclude(../kpathsea/withenable.ac)
 sinclude(../../libs/zlib/withenable.ac)
 sinclude(../../libs/libpng/withenable.ac)
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/etexdir/etex.mk ./texk/web2c/etexdir/etex.mk
--- ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/etexdir/etex.mk	1999-02-02 21:08:18.000000000 +0100
+++ ./texk/web2c/etexdir/etex.mk	2002-09-18 14:02:33.000000000 +0200
@@ -8,11 +8,16 @@ Makefile: $(srcdir)/etexdir/etex.mk
 etex_c = etexini.c etex0.c etex1.c etex2.c
 etex_o = etexini.o etex0.o etex1.o etex2.o etexextra.o
 
+ETEX = @ETEX@
+PLTOTF = @PLTOTF@
+TFTOPL = @TFTOPL@
+TIE = @TIE@
+
 # Generation of the web and ch file.
 etex.web: tie tex.web etexdir/etex.ch
-	./tie -m etex.web $(srcdir)/tex.web $(srcdir)/etexdir/etex.ch
+	$(TIE) -m etex.web $(srcdir)/tex.web $(srcdir)/etexdir/etex.ch
 etex.ch: tie etex.web tex.ch etexdir/tex.ech
-	./tie -c etex.ch etex.web $(srcdir)/tex.ch $(srcdir)/etexdir/tex.ech
+	$(TIE) -c etex.ch etex.web $(srcdir)/tex.ch $(srcdir)/etexdir/tex.ech
 
 # Tests...
 etestdir = $(srcdir)/etexdir/etrip
@@ -21,66 +26,66 @@ etestenv = TEXMFCNF=$(etestdir)
 etrip: pltotf tftopl etex dvitype
 	@echo ">>> See $(etestdir)/etrip.diffs for example of acceptable diffs." >&2
 	@echo "*** TRIP test for e-TeX in compatibility mode ***."
-	./pltotf $(testdir)/trip.pl trip.tfm
-	./tftopl ./trip.tfm trip.pl
+	$(PLTOTF) $(testdir)/trip.pl trip.tfm
+	$(TFTOPL) ./trip.tfm trip.pl
 	-diff $(testdir)/trip.pl trip.pl
 	rm -f trip.tex; $(LN) $(testdir)/trip.tex . # get same filename in log
-	-$(SHELL) -c '$(etestenv) ./etex --progname=einitex <$(testdir)/trip1.in >ctripin.fot'
+	-$(SHELL) -c '$(etestenv) $(ETEX) --progname=einitex <$(testdir)/trip1.in >ctripin.fot'
 	mv trip.log ctripin.log
 	-diff $(testdir)/tripin.log ctripin.log
-	-$(SHELL) -c '$(etestenv) ./etex <$(testdir)/trip2.in >ctrip.fot'
+	-$(SHELL) -c '$(etestenv) $(ETEX) <$(testdir)/trip2.in >ctrip.fot'
 	mv trip.log ctrip.log
 	-diff $(testdir)/trip.fot ctrip.fot
 	-$(DIFF) $(DIFFFLAGS) $(testdir)/trip.log ctrip.log
-	$(SHELL) -c '$(etestenv) ./dvitype $(dvitype_args) trip.dvi >ctrip.typ'
+	$(SHELL) -c '$(etestenv) $(dvitype) $(dvitype_args) trip.dvi >ctrip.typ'
 	-$(DIFF) $(DIFFFLAGS) $(testdir)/trip.typ ctrip.typ
 	@echo "*** TRIP test for e-TeX in extended mode ***."
-	-$(SHELL) -c '$(etestenv) ./etex --progname=einitex <$(etestdir)/etrip1.in >xtripin.fot'
+	-$(SHELL) -c '$(etestenv) $(ETEX) --progname=einitex <$(etestdir)/etrip1.in >xtripin.fot'
 	mv trip.log xtripin.log
 	-diff ctripin.log xtripin.log
-	-$(SHELL) -c '$(etestenv) ./etex <$(etestdir)/trip2.in >xtrip.fot'
+	-$(SHELL) -c '$(etestenv) $(ETEX) <$(etestdir)/trip2.in >xtrip.fot'
 	mv trip.log xtrip.log
 	-diff ctrip.fot xtrip.fot
 	-$(DIFF) $(DIFFFLAGS) ctrip.log xtrip.log
-	$(SHELL) -c '$(etestenv) ./dvitype $(dvitype_args) trip.dvi >xtrip.typ'
+	$(SHELL) -c '$(etestenv) $(dvitype) $(dvitype_args) trip.dvi >xtrip.typ'
 	-$(DIFF) $(DIFFFLAGS) ctrip.typ xtrip.typ
 	@echo "*** e-TeX specific part of e-TRIP test ***."
-	./pltotf $(etestdir)/etrip.pl etrip.tfm
-	./tftopl ./etrip.tfm etrip.pl
+	$(PLTOTF) $(etestdir)/etrip.pl etrip.tfm
+	$(TFTOPL) ./etrip.tfm etrip.pl
 	-diff $(etestdir)/etrip.pl etrip.pl
 	rm -f etrip.tex; $(LN) $(etestdir)/etrip.tex . # get same filename in log
-	-$(SHELL) -c '$(etestenv) ./etex --progname=einitex <$(etestdir)/etrip2.in >etripin.fot'
+	-$(SHELL) -c '$(etestenv) $(ETEX) --progname=einitex <$(etestdir)/etrip2.in >etripin.fot'
 	mv etrip.log etripin.log
 	-diff $(etestdir)/etripin.log etripin.log
-	-$(SHELL) -c '$(etestenv) ./etex <$(etestdir)/etrip3.in >etrip.fot'
+	-$(SHELL) -c '$(etestenv) $(ETEX) <$(etestdir)/etrip3.in >etrip.fot'
 	-diff $(etestdir)/etrip.fot etrip.fot
 	-$(DIFF) $(DIFFFLAGS) $(etestdir)/etrip.log etrip.log
 	diff $(etestdir)/etrip.out etrip.out
-	$(SHELL) -c '$(etestenv) ./dvitype $(dvitype_args) etrip.dvi >etrip.typ'
+	$(SHELL) -c '$(etestenv) $(dvitype) $(dvitype_args) etrip.dvi >etrip.typ'
 	-$(DIFF) $(DIFFFLAGS) $(etestdir)/etrip.typ etrip.typ
 
 etex-check: etrip etex.efmt
 # Test truncation (but don't bother showing the warning msg).
-	./etex --output-comment="`cat $(srcdir)/PROJECTS`" \
+	$(ETEX) --output-comment="`cat $(srcdir)/PROJECTS`" \
 	  $(srcdir)/tests/hello 2>/dev/null \
-	  && ./dvitype hello.dvi | grep [EMAIL PROTECTED] >/dev/null
+	  && $(dvitype) hello.dvi | grep [EMAIL PROTECTED] >/dev/null
 # \openout should show up in \write's.
-	./etex $(srcdir)/tests/openout && grep xfoo openout.log
+	$(ETEX) $(srcdir)/tests/openout && grep xfoo openout.log
 # one.two.tex -> one.two.log
-	./etex $(srcdir)/tests/one.two && ls -l one.two.log
+	$(ETEX) $(srcdir)/tests/one.two && ls -l one.two.log
 # uno.dos -> uno.log
-	./etex $(srcdir)/tests/uno.dos && ls -l uno.log
-	./etex $(srcdir)/tests/just.texi && ls -l just.log
-	-./etex $(srcdir)/tests/batch.tex
-	./etex --shell $(srcdir)/tests/write18 | grep echo
+	$(ETEX) $(srcdir)/tests/uno.dos && ls -l uno.log
+	$(ETEX) $(srcdir)/tests/just.texi && ls -l just.log
+	-$(ETEX) $(srcdir)/tests/batch.tex
+	$(ETEX) --shell $(srcdir)/tests/write18 | grep echo
 # tcx files are a bad idea.
-#	./etex --translate-file=$(srcdir)/share/isol1-t1.tcx \
-#	  $(srcdir)/tests/eight && ./dvitype eight.dvi >eigh.typ
-	./etex --mltex --progname=einitex $(srcdir)/tests/mltextst
-	-./etex </dev/null
+#	$(ETEX) --translate-file=$(srcdir)/share/isol1-t1.tcx \
+#	  $(srcdir)/tests/eight && $(dvitype) eight.dvi >eigh.typ
+	$(ETEX) --mltex --progname=einitex $(srcdir)/tests/mltextst
+	-$(ETEX) </dev/null
 	-PATH=`pwd`:$(kpathsea_dir):$(kpathsea_srcdir):$$PATH \
 	  WEB2C=$(kpathsea_srcdir) TMPDIR=.. \
-	  ./etex '\nonstopmode\font\foo=nonesuch\end'
+	  $(ETEX) '\nonstopmode\font\foo=nonesuch\end'
 
 # Distfiles ...
 @MAINT@triptrapdiffs: etexdir/etrip/etrip.diffs
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/lib/Makefile.in ./texk/web2c/lib/Makefile.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/lib/Makefile.in	1999-01-12 20:11:41.000000000 +0100
+++ ./texk/web2c/lib/Makefile.in	2002-09-18 14:02:33.000000000 +0200
@@ -13,7 +13,7 @@ objects = alloca.o basechsuffix.o charto
   eofeoln.o fprintreal.o inputint.o input2int.o main.o \
   openclose.o printversion.o uexit.o usage.o version.o zround.o
 
-default all: $(library).a
+default all: $(library)$(for-build).a $(library).a
 $(library).a: $(objects)
 	rm -f $@
 	$(AR) $(ARFLAGS) $@ $(objects)
@@ -24,6 +24,14 @@ $(library).a: $(objects)
 alloca.o: alloca.c 
 	$(CC) $(CFLAGS) -c $(srcdir)/alloca.c
 
+alloca-for-build.o: alloca.c 
+	$(CC_FOR_BUILD $(CFLAGS) -c $(srcdir)/alloca.c
+	$(MAKE) for-build= CC="$(CC_FOR_BUILD)" lib.a
+	for i in $(objects); do mv $$i `basename $$i .o`-for-build.o; done
+	mv lib.a lib-for-build.a
+
+lib-for-build.a: alloca-for-build.o
+
 Makefile: Makefile.in ../config.status
 	cd .. && $(SHELL) config.status
 
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/pdfetexdir/pdfetex.mk ./texk/web2c/pdfetexdir/pdfetex.mk
--- ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/pdfetexdir/pdfetex.mk	2001-10-27 00:11:37.000000000 +0200
+++ ./texk/web2c/pdfetexdir/pdfetex.mk	2002-09-18 14:02:46.000000000 +0200
@@ -4,6 +4,8 @@
 
 Makefile: $(srcdir)/pdfetexdir/pdfetex.mk
 
+TIE = @TIE@
+
 # The C sources.
 pdfetex_c = pdfetexini.c pdfetex0.c pdfetex1.c pdfetex2.c pdfetex3.c
 pdfetex_o = pdfetexini.o pdfetex0.o pdfetex1.o pdfetex2.o pdfetex3.o pdfetexextra.o
@@ -12,13 +14,13 @@ pdfetex_o = pdfetexini.o pdfetex0.o pdfe
 pdfetex.web: tie tex.web etexdir/etex.ch \
              pdfetexdir/pdfetex.ch1 pdftexdir/pdftex.ch pdfetexdir/pdfetex.ch2 \
              $(srcdir)/pdfetexdir/pdfetex.h $(srcdir)/pdfetexdir/pdfetex.defines
-	./tie -m pdfetex.web $(srcdir)/tex.web $(srcdir)/etexdir/etex.ch \
+	$(TIE) -m pdfetex.web $(srcdir)/tex.web $(srcdir)/etexdir/etex.ch \
 		 $(srcdir)/pdfetexdir/pdfetex.ch1 \
 		 $(srcdir)/pdftexdir/pdftex.ch \
 		 $(srcdir)/pdfetexdir/pdfetex.ch2
 pdfetex.ch: tie pdfetex.web tex.ch etexdir/tex.ech \
             pdfetexdir/tex.ch1 pdftexdir/tex.pch pdfetexdir/tex.ch2
-	./tie -c pdfetex.ch pdfetex.web \
+	$(TIE) -c pdfetex.ch pdfetex.web \
 		 $(srcdir)/tex.ch $(srcdir)/etexdir/tex.ech \
 		 \
 		 $(srcdir)/pdfetexdir/tex.ch1 \
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/pdftexdir/pdftex.mk ./texk/web2c/pdftexdir/pdftex.mk
--- ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/pdftexdir/pdftex.mk	2001-10-27 00:01:19.000000000 +0200
+++ ./texk/web2c/pdftexdir/pdftex.mk	2002-09-18 14:03:15.000000000 +0200
@@ -8,6 +8,8 @@
 
 Makefile: $(srcdir)/pdftexdir/pdftex.mk
 
+TIE = @TIE@
+
 # The C sources.
 pdftex_c = pdftexini.c pdftex0.c pdftex1.c pdftex2.c pdftex3.c
 pdftex_o = pdftexini.o pdftex0.o pdftex1.o pdftex2.o pdftex3.o pdftexextra.o
@@ -19,9 +21,9 @@ linux_build_dir = $(HOME)/pdftex/build/l
 
 # Generation of the web and ch files.
 pdftex.web: tie tex.web pdftexdir/pdftex.ch
-	./tie -m pdftex.web $(srcdir)/tex.web $(srcdir)/pdftexdir/pdftex.ch
+	$(TIE) -m pdftex.web $(srcdir)/tex.web $(srcdir)/pdftexdir/pdftex.ch
 pdftex.ch: tie pdftex.web tex.ch pdftexdir/tex.pch
-	./tie -c pdftex.ch pdftex.web $(srcdir)/tex.ch $(srcdir)/pdftexdir/tex.pch
+	$(TIE) -c pdftex.ch pdftex.web $(srcdir)/tex.ch $(srcdir)/pdftexdir/tex.pch
 
 # ttf2afm
 ttf2afm: ttf2afm.o
@@ -37,25 +39,25 @@ macnames.c:
 pdftosrc: pdftexdir/pdftosrc.o
 	$(kpathsea_cxx_link) pdftexdir/pdftosrc.o $(LDLIBXPDF) -lm
 pdftexdir/pdftosrc.o:$(srcdir)/pdftexdir/pdftosrc.cc
-	cd pdftexdir && make pdftosrc.o
+	cd pdftexdir && $(MAKE) pdftosrc.o
 
 # pdftex binaries archive
 pdftexbin:
 	rm -f pdtex*.zip $(pdftex_bin)
-	XLDFLAGS=-static make $(pdftex_bin)
+	XLDFLAGS=-static $(MAKE) $(pdftex_bin)
 	if test "x$(CC)" = "xdos-gcc"; then \
-	    make pdftexbin-djgpp; \
+	    $(MAKE) pdftexbin-djgpp; \
 	elif test "x$(CC)" = "xi386-mingw32-gcc"; then \
-	    make pdftexbin-mingw32; \
+	    $(MAKE) pdftexbin-mingw32; \
 	elif test "x$(CC)" = "xgnuwin32gcc"; then \
-	    make pdftexbin-gnuwin32; \
+	    $(MAKE) pdftexbin-gnuwin32; \
 	else \
-	    make pdftexbin-native; \
+	    $(MAKE) pdftexbin-native; \
 	fi
 
 pdftex-cross:
-	make web2c-cross
-	make pdftexbin
+	$(MAKE) web2c-cross
+	$(MAKE) pdftexbin
 
 web2c-cross: $(web2c_programs)
 	@if test ! -x $(linux_build_dir)/tangle; then echo Error: linux_build_dir not ready; exit -1; fi
@@ -64,15 +66,15 @@ web2c-cross: $(web2c_programs)
 	cp -f $(linux_build_dir)/web2c/splitup web2c
 	cp -f $(linux_build_dir)/web2c/web2c web2c
 	touch web2c/fixwrites web2c/splitup web2c/web2c
-	make tie
+	$(MAKE) tie
 	rm -f tie
 	cp -f $(linux_build_dir)/tie .
 	touch tie
-	make tangleboot
+	$(MAKE) tangleboot
 	rm -f tangleboot
 	cp -f $(linux_build_dir)/tangleboot .
 	touch tangleboot
-	make tangle
+	$(MAKE) tangle
 	rm -f tangle
 	cp -f $(linux_build_dir)/tangle .
 	touch tangle
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/web2c/Makefile.in ./texk/web2c/web2c/Makefile.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/web2c/Makefile.in	1999-01-12 20:12:18.000000000 +0100
+++ ./texk/web2c/web2c/Makefile.in	2002-09-18 19:32:34.000000000 +0200
@@ -11,6 +11,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
 YACC = @YACC@
 
 proglib = ../lib/lib.a
+proglib-for-build = ../lib/lib-for-build.a
 programs = web2c fixwrites splitup
 
 web2c_objects = main.o y_tab.o $(LEX_OUTPUT_ROOT).o
@@ -20,12 +21,14 @@ web2c: $(web2c_objects)
 
 # We use y_tab.* for the sake of MS-DOS.
 main.o: main.c y_tab.h
+main-for-build.o: main.c y_tab.h
 y_tab.c y_tab.h: web2c.y
 	@echo Expect one shift/reduce conflict.
 	$(YACC) -d -v $(srcdir)/web2c.y
 	-test -f y.tab.c && mv -f y.tab.c y_tab.c
 	-test -f y.tab.h && mv -f y.tab.h y_tab.h
 $(LEX_OUTPUT_ROOT).o: y_tab.h
+$(LEX_OUTPUT_ROOT)-for-build.o: y_tab.h
 $(LEX_OUTPUT_ROOT).c: web2c.l
 	$(LEX) $(srcdir)/web2c.l
 
@@ -33,9 +36,14 @@ fixwrites: fixwrites.o
 	$(kpathsea_link) fixwrites.o $(LOADLIBES)
 splitup: splitup.o
 	$(kpathsea_link) splitup.o $(LOADLIBES)
-regfix: regfix.o
+regfix: rexfix.o
 	$(kpathsea_link) regfix.o $(LOADLIBES)
 
+fixwrites-for-build: fixwrites$(for-build).o
+splitup-for-build: splitup$(for-build).o
+regfix-for-build: regfix$(for-build).o
+
+
 $(programs): $(proglib) $(kpathsea)
 
 @MAINT@# It's really not worth srcdir etc. here.
@@ -57,3 +65,15 @@ clean::
 
 ac_include ../make/rdepend.mk
 ac_include web2c/depend.mk
+
+
+web2c_objects-for-build = main$(for-build).o y_tab$(for-build).o $(LEX_OUTPUT_ROOT)$(for-build).o
+
+web2c-for-build: $(web2c_objects-for-build)
+	@rm -f $@
+	if [ "$(cross_compiling)" = "yes" ]; then \
+		$(CCLD_FOR_BUILD) -o $@ $(web2c_objects-for-build) $(LEXLIB) -lkpathsea; \
+	else \
+		$(kpathsea_link) $(web2c_objects) $(LEXLIB) $(LOADLIBES); \
+	fi
+
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/web2c/convert ./texk/web2c/web2c/convert
--- ../wtetex-src-beta-20020911-4-cygwin/texk/web2c/web2c/convert	1999-02-09 22:06:59.000000000 +0100
+++ ./texk/web2c/web2c/convert	2002-09-18 14:03:15.000000000 +0200
@@ -44,6 +44,14 @@ postcmd=
 output="> $cfile"
 output_files="$cfile $basefile.h"
 
+fixwrites='./web2c/fixwrites'
+splitup='./web2c/splitup'
+web2c='./web2c/web2c'
+
+f=./web2c/fixwrites-for-build && test -x $f && fixwrites=$f
+f=./web2c/splitup-for-build && test -x $f && splitup=$f
+f=./web2c/web2c-for-build && test -x $f && web2c=$f
+
 case $basefile in
   bibtex)
     midcmd="| sed -f $srcdir/web2c/cvtbib.sed";;
@@ -53,7 +61,7 @@ case $basefile in
     web2c_options="-m -c${basefile}coerce"
     hfile=texmfmp.h
     midcmd="| sed -f $srcdir/web2c/cvtmf2.sed"
-    postcmd="| ./web2c/splitup $basefile"
+    postcmd="| $splitup $basefile"
     cfile=${basefile}2.c # last output file, or thereabouts
     output=
     output_files="$basefile[0-9]*.c ${basefile}ini.c ${basefile}d.h \
@@ -68,7 +76,7 @@ ${basefile}coerce.h"
     web2c_options="-t -c${basefile}coerce"
     hfile=texmfmp.h
     fixwrites_options=-t
-    postcmd="| ./web2c/splitup ${basefile}"
+    postcmd="| $splitup ${basefile}"
     cfile=${basefile}2.c # last output file, or thereabouts
     output=
     output_files="$basefile[0-9]*.c ${basefile}ini.c ${basefile}d.h \
@@ -79,9 +87,9 @@ esac
 # Do it.
 eval "cat $srcdir/web2c/common.defines $more_defines $pascalfile \
   $precmd \
-  | ./web2c/web2c -h$hfile $web2c_options \
+  | $web2c -h$hfile $web2c_options \
   $midcmd \
-  | ./web2c/fixwrites $fixwrites_options $basefile \
+  | $fixwrites $fixwrites_options $basefile \
   $postcmd \
   $output"
 
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/xdvik/Makefile.in ./texk/xdvik/Makefile.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/xdvik/Makefile.in	2002-06-14 07:06:46.000000000 +0200
+++ ./texk/xdvik/Makefile.in	2002-09-18 19:29:55.000000000 +0200
@@ -61,6 +61,7 @@ $(program): $(kpathsea) $(objects) $(LIB
 
 squeeze: squeeze.o
 	$(link_command) squeeze.o $(LIBS) $(XLOADLIBES)
+squeeze-for-build: squeeze$(for-build).o
 
 ###
 ### the CC_CONCAT_FILES listed here use ANSI-style string concatenation;
@@ -85,8 +86,8 @@ krheader.h: $(CC_CONCAT_FILES) c-auto.h 
 	>> krheader.h; done
 	echo "#endif /* HAVE_CC_CONCAT */" >> krheader.h
 
-psheader.c: psheader.txt squeeze
-	./squeeze $(srcdir)/psheader.txt $@
+psheader.c: psheader.txt squeeze$(for-build)
+	./squeeze$(for-build) $(srcdir)/psheader.txt $@
 
 xdvi.1: xdvi.man sedscript
 	sed -f sedscript <$(srcdir)/xdvi.man >$@
@@ -110,9 +111,10 @@ uninstall-exec:
 install-data: xdvi.1 t1mapper.1
 	$(INSTALL_DATA) xdvi.1 $(mandir)/xdvi.$(manext)
 	$(INSTALL_DATA) $(srcdir)/t1mapper.1 $(mandir)/t1mapper.$(manext)
-	# $(SHELL) $(top_srcdir)/../mkinstalldirs $(mandir) $(texmf)/xdvi
-	# $(INSTALL_DATA) $(srcdir)/texmf/xdvi.cfg $(texmf)/xdvi
-	# $(INSTALL_DATA) $(srcdir)/texmf/ps2pk.map $(texmf)/xdvi
+	$(SHELL) $(top_srcdir)/../mkinstalldirs $(mandir) $(texmf)/xdvi
+	$(INSTALL_DATA) $(srcdir)/texmf/xdvi.cfg $(texmf)/xdvi
+	$(INSTALL_DATA) $(srcdir)/texmf/XDvi $(texmf)/xdvi
+	$(INSTALL_DATA) $(srcdir)/texmf/ps2pk.map $(texmf)/xdvi
 
 uninstall-data:
 	rm -f $(mandir)/xdvi.$(manext) 
diff -p'urNx*~' -xcygwin -xCYGWIN-PATCHES -x.bash_mknetrel -xconfigure -xautom4te.cache -xstrip -xautogen.sh ../wtetex-src-beta-20020911-4-cygwin/texk/xdvik/configure.in ./texk/xdvik/configure.in
--- ../wtetex-src-beta-20020911-4-cygwin/texk/xdvik/configure.in	2002-05-23 17:24:22.000000000 +0200
+++ ./texk/xdvik/configure.in	2002-09-18 14:03:15.000000000 +0200
@@ -47,6 +47,7 @@ AC_CHECK_HEADERS(netdb.h sys/bsdtypes.h 
 
 sinclude(../kpathsea/xt.ac)
 sinclude(withenable.ac)
+sinclude(../cross.ac)
 sinclude(../../libs/libwww/withenable.ac)
 sinclude(../../libs/libwww/libwww.ac)
 sinclude(../../libs/zlib/withenable.ac)


-- 
Jan Nieuwenhuizen <[EMAIL PROTECTED]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org

Reply via email to