Hi folks,
a few weeks back I posted a patch that helps enabling cross-compiling by 
adding the necessary stuff in configure.in to tell "configure" the necessary 
values when cross-compiling. The patch also includes a README explaining 
everything.

As people asked me about it I'd like to know if there's anything to fix in 
that patch before it can get accepted or if there are any other problems to 
resolve first.

Thanks a lot,
        Marc

-- 
Marc Haisenko

Comdasys AG
Rüdesheimer Str. 7
80686 München
Germany

Tel.: +49 (0)89 548 433 321

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

diff -Nur vim71.orig/src/configure.in vim71/src/configure.in
--- vim71.orig/src/configure.in	2007-05-12 11:19:27.000000000 +0200
+++ vim71/src/configure.in	2007-09-21 14:58:23.000000000 +0200
@@ -47,13 +47,6 @@
   fi
 fi
 
-dnl If configure thinks we are cross compiling, there is probably something
-dnl wrong with the CC or CFLAGS settings, give an understandable error message
-if test "$cross_compiling" = yes; then
-  AC_MSG_ERROR([cannot compile a simple program, check CC and CFLAGS
-  (cross compiling doesn't work)])
-fi
-
 dnl gcc-cpp has the wonderful -MM option to produce nicer dependencies.
 dnl But gcc 3.1 changed the meaning!  See near the end.
 test "$GCC" = yes && CPP_MM=M; AC_SUBST(CPP_MM)
@@ -1986,11 +1979,24 @@
 
 dnl Checks for libraries and include files.
 
-AC_MSG_CHECKING(quality of toupper)
-AC_TRY_RUN([#include <ctype.h>
-main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }],
-	AC_DEFINE(BROKEN_TOUPPER) AC_MSG_RESULT(bad),
-	AC_MSG_RESULT(good), AC_MSG_ERROR(failed to compile test program))
+AC_CACHE_CHECK([toupper is broken],[vim_cv_toupper_broken],
+  [
+    AC_RUN_IFELSE([
+#include <ctype.h>
+main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); }
+  ],[
+    vim_cv_toupper_broken=yes
+    AC_MSG_RESULT(yes)
+  ],[
+    vim_cv_toupper_broken=no
+    AC_MSG_RESULT(no)
+  ],[
+    AC_MSG_ERROR(cross-compiling: please set 'vim_cv_toupper_broken')
+  ])])
+
+if test "x$vim_cv_toupper_broken" = "xyes" ; then
+  AC_DEFINE(BROKEN_TOUPPER)
+fi
 
 AC_MSG_CHECKING(whether __DATE__ and __TIME__ work)
 AC_TRY_COMPILE(, [printf("(" __DATE__ " " __TIME__ ")");],
@@ -2202,28 +2208,52 @@
       Or specify the name of the library with --with-tlib.]))
 fi
 
-AC_MSG_CHECKING(whether we talk terminfo)
-AC_TRY_RUN([
+AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo],
+  [
+    AC_RUN_IFELSE([
 #ifdef HAVE_TERMCAP_H
 # include <termcap.h>
 #endif
 main()
-{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }],
-	  AC_MSG_RESULT([no -- we are in termcap land]),
-	  AC_MSG_RESULT([yes -- terminfo spoken here]); AC_DEFINE(TERMINFO),
-	  AC_MSG_ERROR(failed to compile test program.))
+{char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!strcmp(s==0 ? "" : s, "1")); }
+    ],[
+      vim_cv_terminfo=no
+      AC_MSG_RESULT([no -- we are in termcap land])
+    ],[
+      vim_cv_terminfo=yes
+      AC_MSG_RESULT([yes -- terminfo spoken here])
+    ],[
+      AC_MSG_ERROR(cross-compiling: please set 'vim_cv_terminfo')
+    ])
+  ])
+
+if test "x$vim_cv_terminfo" = "xyes" ; then
+  AC_DEFINE(TERMINFO)
+fi
 
 if test "x$olibs" != "x$LIBS"; then
-  AC_MSG_CHECKING(what tgetent() returns for an unknown terminal)
-  AC_TRY_RUN([
+  AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgent],
+    [
+      AC_RUN_IFELSE([
 #ifdef HAVE_TERMCAP_H
 # include <termcap.h>
 #endif
 main()
-{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }],
-	  AC_MSG_RESULT(zero); AC_DEFINE(TGETENT_ZERO_ERR, 0),
-	  AC_MSG_RESULT(non-zero),
-	  AC_MSG_ERROR(failed to compile test program.))
+{char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); }
+      ],[
+	vim_cv_tgent=zero
+	AC_MSG_RESULT(zero)
+      ],[
+	vim_cv_tgent=non-zero
+	AC_MSG_RESULT(non-zero)
+      ],[
+	AC_MSG_ERROR(failed to compile test program.)
+      ])
+    ])
+  
+  if test "x$vim_cv_tgent" = "xzero" ; then
+    AC_DEFINE(TGETENT_ZERO_ERR, 0)
+  fi
 fi
 
 AC_MSG_CHECKING(whether termcap.h contains ospeed)
@@ -2333,9 +2363,10 @@
 dnl    ****  pty mode/group handling ****
 dnl
 dnl support provided by Luke Mewburn <[EMAIL PROTECTED]>, 931222
-AC_MSG_CHECKING(default tty permissions/group)
 rm -f conftest_grp
-AC_TRY_RUN([
+AC_CACHE_CHECK([default tty permissions/group], [vim_cv_tty_group],
+  [
+    AC_RUN_IFELSE([
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdio.h>
@@ -2363,20 +2394,35 @@
   fclose(fp);
   exit(0);
 }
-],[
-    if test -f conftest_grp; then
-	ptygrp=`cat conftest_grp`
-	AC_MSG_RESULT([pty mode: 0620, group: $ptygrp])
-	AC_DEFINE(PTYMODE, 0620)
-	AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
-    else
+    ],[
+      if test -f conftest_grp; then
+	vim_cv_tty_group=`cat conftest_grp`
+	if test "x$vim_cv_tty_mode" = "x" ; then
+	  vim_cv_tty_mode=0620
+	fi
+	AC_MSG_RESULT([pty mode: $vim_cv_tty_mode, group: $vim_cv_tty_group])
+      else
+	vim_cv_tty_group=world
 	AC_MSG_RESULT([ptys are world accessable])
-    fi
-],
-    AC_MSG_RESULT([can't determine - assume ptys are world accessable]),
-    AC_MSG_ERROR(failed to compile test program))
+      fi
+    ],[
+      vim_cv_tty_group=world
+      AC_MSG_RESULT([can't determine - assume ptys are world accessable])
+    ],[
+      AC_MSG_ERROR(cross-compiling: please set 'vim_cv_tty_group' and 'vim_cv_tty_mode')
+    ])
+  ])
 rm -f conftest_grp
 
+if test "x$vim_cv_tty_group" != "xworld" ; then
+  AC_DEFINE_UNQUOTED(PTYGROUP,$vim_cv_tty_group)
+  if test "x$vim_cv_tty_mode" = "x" ; then
+    AC_MSG_ERROR([It seems you're cross compiling and have 'vim_cv_tty_group' set, please also set the environment variable 'vim_cv_tty_mode' to the correct mode (propably 0620)])
+  else
+    AC_DEFINE(PTYMODE, 0620)
+  fi
+fi
+
 dnl Checks for library functions. ===================================
 
 AC_TYPE_SIGNAL
@@ -2404,8 +2450,9 @@
 
 dnl tricky stuff: try to find out if getcwd() is implemented with
 dnl system("sh -c pwd")
-AC_MSG_CHECKING(getcwd implementation)
-AC_TRY_RUN([
+AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken],
+  [
+    AC_RUN_IFELSE([
 char *dagger[] = { "IFS=pwd", 0 };
 main()
 {
@@ -2413,11 +2460,21 @@
   extern char **environ;
   environ = dagger;
   return getcwd(buffer, 500) ? 0 : 1;
-}],
-	AC_MSG_RESULT(it is usable),
-	AC_MSG_RESULT(it stinks)
-		AC_DEFINE(BAD_GETCWD),
-	AC_MSG_ERROR(failed to compile test program))
+}
+    ],[
+      vim_cv_getcwd_broken=no
+      AC_MSG_RESULT(no)
+    ],[
+      vim_cv_getcwd_broken=yes
+      AC_MSG_RESULT(yes)
+    ],[
+      AC_MSG_ERROR(cross-compiling: please set 'vim_cv_getcwd_broken')
+    ])
+  ])
+
+if test "x$vim_cv_getcwd_broken" = "xyes" ; then
+  AC_DEFINE(BAD_GETCWD)
+fi
 
 dnl Check for functions in one big call, to reduce the size of configure
 AC_CHECK_FUNCS(bcmp fchdir fchown fseeko fsync ftello getcwd getpseudotty \
@@ -2441,14 +2498,27 @@
 	AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
 	AC_MSG_RESULT(no))
 
-AC_MSG_CHECKING(whether stat() ignores a trailing slash)
-AC_TRY_RUN(
+AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash],
+  [
+    AC_RUN_IFELSE(
 [#include <sys/types.h>
 #include <sys/stat.h>
-main() {struct stat st;  exit(stat("configure/", &st) != 0); }],
-	AC_MSG_RESULT(yes); AC_DEFINE(STAT_IGNORES_SLASH),
-	AC_MSG_RESULT(no), AC_MSG_ERROR(failed to compile test program))
+main() {struct stat st;  exit(stat("configure/", &st) != 0); }
+    ],[
+      vim_cv_stat_ignores_slash=yes
+      AC_MSG_RESULT(yes)
+    ],[
+      vim_cv_stat_ignores_slash=no
+      AC_MSG_RESULT(no)
+    ],[
+      AC_MSG_ERROR(cross-compiling: please set 'vim_cv_stat_ignores_slash')
+    ])
+  ])
 
+if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then
+  AC_DEFINE(STAT_IGNORES_SLASH)
+fi
+  
 dnl Link with iconv for charset translation, if not found without library.
 dnl check for iconv() requires including iconv.h
 dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
@@ -2641,7 +2711,10 @@
 AC_MSG_RESULT($ac_cv_sizeof_int)
 AC_DEFINE_UNQUOTED(SIZEOF_INT, $ac_cv_sizeof_int)
 
-AC_MSG_CHECKING(whether memmove/bcopy/memcpy handle overlaps)
+
+dnl Check for memmove() before bcopy(), makes memmove() be used when both are
+dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
+
 [bcopy_test_prog='
 main() {
   char buf[10];
@@ -2656,18 +2729,60 @@
   exit(0); /* libc version works properly.  */
 }']
 
-dnl Check for memmove() before bcopy(), makes memmove() be used when both are
-dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
+AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap],
+  [
+    AC_RUN_IFELSE([#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog],
+      [
+	vim_cv_memmove_handles_overlap=yes
+	AC_MSG_RESULT(yes)
+      ],[
+	vim_cv_memmove_handles_overlap=no
+	AC_MSG_RESULT(no)
+      ],[
+	AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memmove_handles_overlap')
+      ])
+  ])
+
+if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then
+  AC_DEFINE(USEMEMMOVE)
+else
+  AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap],
+    [
+      AC_RUN_IFELSE([#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog],
+      [
+	vim_cv_bcopy_handles_overlap=yes
+	AC_MSG_RESULT(yes)
+      ],[
+	vim_cv_bcopy_handles_overlap=no
+	AC_MSG_RESULT(no)
+      ],[
+	AC_MSG_ERROR(cross-compiling: please set 'vim_cv_bcopy_handles_overlap')
+      ])
+    ])
+
+  if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then
+    AC_DEFINE(USEBCOPY)
+  else
+    AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap],
+      [
+	AC_RUN_IFELSE([#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog],
+	  [
+	    vim_cv_memcpy_handles_overlap=yes
+	    AC_MSG_RESULT(yes)
+	  ],[
+	    vim_cv_memcpy_handles_overlap=no
+	    AC_MSG_RESULT(no)
+	  ],[
+	    AC_MSG_ERROR(cross-compiling: please set 'vim_cv_memcpy_handles_overlap')
+	  ])
+      ])
+
+    if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then
+      AC_DEFINE(USEMEMCPY)
+    fi
+  fi
+fi
 
-AC_TRY_RUN([#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog],
-    AC_DEFINE(USEMEMMOVE) AC_MSG_RESULT(memmove does),
-    AC_TRY_RUN([#define mch_memmove(s,d,l) bcopy(d,s,l) $bcopy_test_prog],
-	AC_DEFINE(USEBCOPY) AC_MSG_RESULT(bcopy does),
-	AC_TRY_RUN([#define mch_memmove(s,d,l) memcpy(d,s,l) $bcopy_test_prog],
-	    AC_DEFINE(USEMEMCPY) AC_MSG_RESULT(memcpy does), AC_MSG_RESULT(no),
-	    AC_MSG_ERROR(failed to compile test program)),
-	AC_MSG_ERROR(failed to compile test program)),
-    AC_MSG_ERROR(failed to compile test program))
 
 dnl Check for multibyte locale functions
 dnl Find out if _Xsetlocale() is supported by libX11.
diff -Nur vim71.orig/src/INSTALL vim71/src/INSTALL
--- vim71.orig/src/INSTALL	2007-05-11 23:13:27.000000000 +0200
+++ vim71/src/INSTALL	2007-09-24 18:56:06.000000000 +0200
@@ -14,6 +14,7 @@
 See INSTALLmac.txt              for Macintosh
 See INSTALLpc.txt               for PC (MS-DOS, Windows 95/98/NT/XP)
 See INSTALLvms.txt              for VMS
+See INSTALLcross.txt		for cross-compiling on Unix
 See ../runtime/doc/os_390.txt   for OS/390 Unix
 See ../runtime/doc/os_beos.txt  for BeBox
 
diff -Nur vim71.orig/src/INSTALLcross.txt vim71/src/INSTALLcross.txt
--- vim71.orig/src/INSTALLcross.txt	1970-01-01 01:00:00.000000000 +0100
+++ vim71/src/INSTALLcross.txt	2007-09-21 16:43:58.000000000 +0200
@@ -0,0 +1,163 @@
+Content:
+ 1. Introduction
+ 2. Necessary arguments for "configure"
+ 3. Necessary environment variables for "configure"
+ 4. Example
+
+
+1. INTRODUCTION
+===============
+
+This document discusses cross-compiling VIM on Unix-like systems. We assume
+you are already familiar with cross-compiling and have a working cross-compile
+environment with at least the following components:
+
+ * a cross-compiler
+ * a libc to link against
+ * ncurses library to link against
+
+Discussing how to set up a cross-compile environment would go beyond the scope
+of this document. See http://www.kegel.com/crosstool/ for more information and
+a script that aids in setting up such an environment.
+
+
+The problem is that "configure" needs to compile and run small test programs
+to check for certain features. Running these test programs can't be done when
+cross-compiling so we need to pass the results these checks would produce via
+environment variables. See the list of variables and the examples at the end of
+this document.
+
+
+2. NECESSARY ARGUMENTS FOR "configure"
+======================================
+
+You need to set the following "configure" command line switches:
+
+--build=... :
+	The build system (i.e. the platform name of the system you compile on
+	right now).
+	For example, "i586-linux".
+
+--host=... :
+	The system on which VIM will be run. Quite often this the name of your
+	cross-compiler without the "-gcc".
+	For example, "powerpc-603-linux-gnu".
+
+--target=... :
+	Only relevant for compiling compilers. Set this to the same value as
+	--host.
+
+--with-tlib=... :
+	Which terminal library to.
+	For example, "ncurses".
+
+
+3. NECESSARY ENVIRONMENT VARIABLES FOR "configure"
+==================================================
+
+Additionally to the variables listed here you might want to set the CPPFLAGS
+environment variable to enable optimization for your target system (e.g.
+"CPPFLAGS=-march=arm5te").
+
+The following variables need to be set:
+
+ac_cv_sizeof_int:
+	The size of an "int" C type in bytes. Should be "4" on all 32bit
+	machines.
+
+vi_cv_path_python_conf:
+	If Python support is enabled, set this variables to the path for
+	Python's library implementation. This is a path like
+	"/usr/lib/pythonX.Y/config" (the directory contains a file
+	"config.c").
+
+vi_cv_var_python_epfx:
+	If Python support is enabled, set this variables to the execution
+	prefix of your Python interpreter (that is, where it thinks it is
+	running).
+	This is the output of the following Python script:
+		import sys; print sys.exec_prefix
+
+vi_cv_var_python_pfx:
+	If Python support is enabled, set this variables to the prefix of your
+	Python interpreter (that is, where was installed).
+	This is the output of the following Python script:
+		import sys; print sys.prefix
+
+vi_cv_var_python_version:
+	If Python support is enabled, set this variables to the version of the
+	Python interpreter that will be used.
+	This is the output of the following Python script:
+		import sys; print sys.version[:3]
+
+vim_cv_bcopy_handles_overlap:
+	Whether the "memmove" C library call is able to copy overlapping
+	memory regions. Set to "yes" if it does or "no" if it does not.
+	You only need to set this if vim_cv_memmove_handles_overlap is set
+	to "no".
+
+vim_cv_getcwd_broken:
+	Whether the "getcwd" C library call is broken. Set to "yes" if you
+	know that "getcwd" is implemented as 'system("sh -c pwd")', set to
+	"no" otherwise.
+
+vim_cv_memcpy_handles_overlap:
+	Whether the "memcpy" C library call is able to copy overlapping
+	memory regions. Set to "yes" if it does or "no" if it does not.
+	You only need to set this if both vim_cv_memmove_handles_overlap
+	and vim_cv_bcopy_handles_overlap are set to "no".
+
+vim_cv_memmove_handles_overlap:
+	Whether the "memmove" C library call is able to copy overlapping
+	memory regions. Set to "yes" if it does or "no" if it does not.
+
+vim_cv_stat_ignores_slash:
+	Whether the "stat" C library call ignores trailing slashes in the path
+	name. Set to "yes" if it ignores them or "no" if it does not ignore
+	them.
+
+vim_cv_tgetent:
+	Whether the "tgetent" terminal library call returns a zero or non-zero
+	value when it encounters an unknown terminal. Set to either the string
+	"zero" or "non-zero", corresponding.
+
+vim_cv_terminfo:
+	Whether the environment has terminfo support. Set to "yes" if so,
+	otherwise set to "no".
+
+vim_cv_toupper_broken:
+	Whether the "toupper" C library function works correctly. Set to "yes"
+	if you know it's broken, otherwise set to "no".
+
+vim_cv_tty_group:
+	The default group of pseudo terminals. Either set to the numeric value
+	of the your tty group or to "world" if they are world accessable.
+
+vim_cv_tty_mode:
+	The default mode of pseudo terminals if they are not world accessable.
+	Most propably the value "0620".
+
+
+4. EXAMPLE:
+===========
+
+Assuming the target system string is "armeb-xscale-linux-gnu" (a Intel XScale
+system) with glibc and ncurses, the call to configure would look like this:
+
+ac_cv_sizeof_int=4 \
+vim_cv_getcwd_broken=no \
+vim_cv_memmove_handles_overlap=yes \
+vim_cv_stat_ignores_slash=yes \
+vim_cv_tgetent=zero \
+vim_cv_terminfo=yes \
+vim_cv_toupper_broken=no \
+vim_cv_tty_group=world \
+./configure \
+	--build=i586-linux \
+	--host=armeb-xscale-linux-gnu \
+	--target=armeb-xscale-linux-gnu \
+	--with-tlib=ncurses
+
+
+
+Written 2007 by Marc Haisenko <[EMAIL PROTECTED]> for the VIM project.

Raspunde prin e-mail lui