libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] [cygwin]: Add cross-compile support to cwrapper


From: Charles Wilson
Subject: Re: [PATCH] [cygwin]: Add cross-compile support to cwrapper
Date: Sat, 31 Jan 2009 02:53:51 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.5.666

Charles Wilson wrote:

> How does that sound, as an intermediate plan?

Implemented as attached, which should be applied on top of the -take3 patch.

Changes:

ltmain.m4sh:
  func_pathlist_convert_check: now takes four arguments,
    FROM_PATHSEP, TO_PATHSEP, FROM_PATHLIST, TO_PATHLIST
  func_pathlist_convert_check_mingw: removed
  func_init_to_host_pathlist_cmd: new function described previously
  func_to_host_pathlist: use it.
  func_msys_to_mingw_pathlist_convert,
  func_cygwin_to_mingw_pathlist_convert,
  func_nix_to_mingw_pathlist_convert: call 4-arg version of
     func_pathlist_convert_check, instead of mingw variant.
  func_msys_to_cygwin_pathlist_convert,
  func_nix_to_cygwin_pathlist_convert: Adapt to 4-arg varseion
     of func_pathlist_convert_check.
libtool.m4
  _LT_PATH_CONVERSION_FUNCTIONS: eliminate libtool variable
     to_host_pathlist_cmd. Also, AC_SUBST(to_host_path_cmd).
testsuite.at:
  Ensure to_host_path_cmd is passed as a variable setting on
  the configure line for (new testsuite) tests.
Makefile.am:
  Ensure to_host_path_cmd is included in TEST_ENVIRONMENT so that
  it is passed to (old testsuite) tests.

I'm not sure about the Makefile.am part, but the rest should be pretty
non-controversial. Unlike the -take3 patch it modifies. <g>.

--
Chuck
diff --git a/Makefile.am b/Makefile.am
index b6b1bfa..63221c3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -505,7 +505,8 @@ TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" 
CFLAGS="$(CFLAGS)" \
        CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CXXCPP="$(CXXCPP)" \
        F77="$(F77)" FFLAGS="$(FFLAGS)" \
        FC="$(FC)" FCFLAGS="$(FCFLAGS)" \
-       GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)"
+       GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)" \
+       lt_cv_to_host_path_cmd="$(to_host_path_cmd)"
 
 BUILDCHECK_ENVIRONMENT = _lt_pkgdatadir="$(abs_top_srcdir)" \
        LIBTOOLIZE="$(abs_top_builddir)/libtoolize" \
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index d22cbf8..42a970e 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -2528,9 +2528,9 @@ fi\
 "
 }
 
-###################################
-# PATH CONVERSION HELPER FUNCTION #
-###################################
+####################################
+# PATH CONVERSION HELPER FUNCTIONS #
+####################################
 
 # func_wine_to_win32_path ARG
 # Helper function used by path conversion functions
@@ -2686,51 +2686,35 @@ func_path_convert_check ()
 # end func_path_convert_check
 
 
-# func_pathlist_convert_check ARG1 ARG2
-# Verify that ARG1 (a path in $build format) was
-# converted to $host format in ARG2. Otherwise, emit
-# an error message, but continue (resetting
-# func_to_host_path_result to a simplistic fallback
-# value (see below).
+# func_pathlist_convert_check FROM_PATHSEP TO_PATHSEP FROM_PATHLIST TO_PATHLIST
+# Verify that FROM_PATHLIST (a path in $build format) was converted
+# $host format in TO_PATHLIST. Otherwise, emit an error message, but
+# continue, resetting func_to_host_path_result to a simplistic
+# fallback value (see below).
 func_pathlist_convert_check ()
 {
   $opt_debug
-  if test -z "$2" && test -n "$1"; then
+  if test -z "$4" && test -n "$3"; then
     func_error "Could not determine the host path(s) corresponding to"
-    func_error "  \`$1'"
+    func_error "  \`$3'"
     func_error "Continuing, but uninstalled executables may not work."
-    # Fallback.
-    func_to_host_pathlist_result="$1"
-  fi
-}
-# end func_pathlist_convert_check
-
-
-# func_pathlist_convert_check_mingw ARG1 ARG2
-# Verify that ARG1 (a path in $build format) was
-# converted to $host format in ARG2. Otherwise, emit
-# an error message, but continue (resetting
-# func_to_host_path_result to a simplistic fallback
-# value (see below).
-# This function is specific for mingw $hosts.
-func_pathlist_convert_check_mingw ()
-{
-  $opt_debug
-  if test -z "$2" && test -n "$1"; then
-    func_error "Could not determine the host path(s) corresponding to"
-    func_error "  \`$1'"
-    func_error "Continuing, but uninstalled executables may not work."
-    # Fallback. This may break if $1 contains DOS-style drive
-    # specifications. The fix is not to complicate the expression
-    # below, but for the user to provide a working wine installation
+    # Fallback. If even this fallback fails, the fix is not to
+    # complicate the expression below, but for the user to provide,
+    # in that situation, whatever elements are missing from the
+    # environment so that the actual pathlist conversion functions
+    # work properly (for instance, a working wine installation
     # with winepath so that path translation in the cross-to-mingw
-    # case works properly.
-    lt_replace_pathsep_nix_to_dos="s|:|;|g"
-    func_to_host_pathlist_result=`echo "$1" |\
-      $SED -e "$lt_replace_pathsep_nix_to_dos"`
+    # case works).
+    if test "x$1" != "x$2"; then
+      lt_replace_pathsep_chars="s|$1|$2|g"
+      func_to_host_pathlist_result=`echo "$3" |\
+        $SED -e "$lt_replace_pathsep_chars"`
+    else
+      func_to_host_pathlist_result="$3"
+    fi
   fi
 }
-# end func_pathlist_convert_check_mingw
+# end func_pathlist_convert_check
 
 
 # func_pathlist_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
@@ -2940,12 +2924,35 @@ func_nix_to_cygwin_path_convert ()
 # on output.
 
 
+# func_init_to_host_pathlist_cmd
+# Ensures that function "pointer" variable
+# $to_host_pathlist_cmd is set to the appropriate
+# value, based on the value of $to_host_path_cmd.
+#
+# ASSUMPTIONS: all such conversion functions are
+# named using the following convention:
+#   path conversion function    : xxxxxx_path_convert ()
+#   pathlist conversion function: xxxxxx_pathlist_convert ()
+# where, for any given $build/$host combination the 'xxxxxx'
+# value is the same.
+to_host_pathlist_cmd=
+func_init_to_host_pathlist_cmd ()
+{
+  $opt_debug
+  if test -z "$to_host_pathlist_cmd"; then
+    func_stripname '' '_path_convert' "$to_host_path_cmd"
+    to_host_pathlist_cmd="${func_stripname_result}_pathlist_convert"
+  fi
+}
+
+
 # func_to_host_pathlist ARG
 # converts the pathlist ARG from $build format to $host
 # format.
 func_to_host_pathlist ()
 {
   $opt_debug
+  func_init_to_host_pathlist_cmd
   eval '$to_host_pathlist_cmd "$1"'
 }
 # end func_to_host_pathlist
@@ -2985,8 +2992,8 @@ func_msys_to_mingw_pathlist_convert ()
     func_to_host_pathlist_tmp1=$func_stripname_result
     func_msys_to_win32 "$func_to_host_pathlist_tmp1"
     func_to_host_pathlist_result="$func_msys_to_win32_result"
-    func_pathlist_convert_check_mingw "$func_to_host_pathlist_tmp1" \
-      "$func_to_host_pathlist_result"
+    func_pathlist_convert_check ":" ";" \
+      "$func_to_host_pathlist_tmp1" "$func_to_host_pathlist_result"
     func_pathlist_front_back_pathsep ":*" "*:" ";" "$1"
   fi
 }
@@ -3012,8 +3019,8 @@ func_cygwin_to_mingw_pathlist_convert ()
     func_stripname : : "$1"
     func_to_host_pathlist_tmp1=$func_stripname_result
     func_to_host_pathlist_result=`cygpath -m -p "$func_to_host_pathlist_tmp1"`
-    func_pathlist_convert_check_mingw "$func_to_host_pathlist_tmp1" \
-      "$func_to_host_pathlist_result"
+    func_pathlist_convert_check ":" ";" \
+      "$func_to_host_pathlist_tmp1" "$func_to_host_pathlist_result"
     func_pathlist_front_back_pathsep ":*" "*:" ";" "$1"
   fi
 }
@@ -3040,8 +3047,8 @@ func_nix_to_mingw_pathlist_convert ()
     func_to_host_pathlist_tmp1=$func_stripname_result
     func_wine_to_win32_pathlist "$func_to_host_pathlist_tmp1"
     func_to_host_pathlist_result="$func_wine_to_win32_pathlist_result"
-    func_pathlist_convert_check_mingw "$func_to_host_pathlist_tmp1" \
-      "$func_to_host_pathlist_result"
+    func_pathlist_convert_check ":" ";" \
+      "$func_to_host_pathlist_tmp1" "$func_to_host_pathlist_result"
     func_pathlist_front_back_pathsep ":*" "*:" ";" "$1"
   fi
 }
@@ -3072,8 +3079,8 @@ func_msys_to_cygwin_pathlist_convert ()
     func_msys_to_win32 "$func_to_host_pathlist_tmp1"
     func_cygpath -u -p "$func_msys_to_win32_result"
     func_to_host_pathlist_result="$func_cygpath_result"
-    func_pathlist_convert_check "$func_to_host_pathlist_tmp1" \
-      "$func_to_host_pathlist_result"
+    func_pathlist_convert_check ":" ":" \
+      "$func_to_host_pathlist_tmp1" "$func_to_host_pathlist_result"
     func_pathlist_front_back_pathsep ":*" "*:" ":" "$1"
   fi
 }
@@ -3103,8 +3110,8 @@ func_nix_to_cygwin_pathlist_convert ()
     func_wine_to_win32_pathlist "$func_to_host_pathlist_tmp1"
     func_cygpath -u -p "$func_wine_to_win32_pathlist_result"
     func_to_host_pathlist_result="$func_cygpath_result"
-    func_pathlist_convert_check "$func_to_host_pathlist_tmp1" \
-      "$func_to_host_pathlist_result"
+    func_pathlist_convert_check ":" ":" \
+      "$func_to_host_pathlist_tmp1" "$func_to_host_pathlist_result"
     func_pathlist_front_back_pathsep ":*" "*:" ":" "$1"
   fi
 }
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index f260eac..347a38f 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -7310,10 +7310,10 @@ _LT_EOF
 # _LT_PATH_CONVERSION_FUNCTIONS
 # -----------------------------
 # Determine which path conversion functions should be
-# used by func_to_host_path and func_to_host_pathlist.
-# These are needed for certain cross-compile configurations
-# and "native" mingw (which is actually an msys->mingw
-# cross).
+# used by func_to_host_path (and, implicitly, by
+# func_to_host_pathlist).  These are needed for certain
+# cross-compile configurations and "native" mingw (which
+# is actually an msys->mingw cross).
 m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
@@ -7351,45 +7351,10 @@ AC_CACHE_VAL(lt_cv_to_host_path_cmd,
     ;;
 esac
 ])
+to_host_path_cmd=$lt_cv_to_host_path_cmd
 AC_MSG_RESULT([$lt_cv_to_host_path_cmd])
 _LT_DECL([to_host_path_cmd], [lt_cv_to_host_path_cmd],
          [0], [convert $build paths to $host format])dnl
-AC_MSG_CHECKING([how to convert $build pathlists to $host format])
-AC_CACHE_VAL(lt_cv_to_host_pathlist_cmd,
-[case $host in
-  *mingw* )
-    case $build in
-      *mingw* ) # actually msys
-        lt_cv_to_host_pathlist_cmd=func_msys_to_mingw_pathlist_convert
-        ;;
-      *cygwin* )
-        lt_cv_to_host_pathlist_cmd=func_cygwin_to_mingw_pathlist_convert
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_pathlist_cmd=func_nix_to_mingw_pathlist_convert
-        ;;
-    esac
-    ;;
-  *cygwin* )
-    case $build in
-      *mingw* ) # actually msys
-        lt_cv_to_host_pathlist_cmd=func_msys_to_cygwin_pathlist_convert
-        ;;
-      *cygwin* )
-        lt_cv_to_host_pathlist_cmd=func_noop_pathlist_convert
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_pathlist_cmd=func_nix_to_cygwin_pathlist_convert
-        ;;
-    esac
-    ;;
-  * ) # unhandled hosts (and "normal" native builds)
-    lt_cv_to_host_pathlist_cmd=func_noop_pathlist_convert
-    ;;
-esac
-])
-AC_MSG_RESULT([$lt_cv_to_host_pathlist_cmd])
-_LT_DECL([to_host_pathlist_cmd], [lt_cv_to_host_pathlist_cmd],
-         [0], [convert $build pathlists to $host format])dnl
+AC_SUBST([to_host_path_cmd])dnl
 ])# _LT_PATH_CONVERSION_FUNCTIONS
 
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 92e786e..7a9cf13 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -38,7 +38,7 @@ for tool in ACLOCAL AUTOHEADER AUTOCONF AUTOMAKE AUTORECONF; 
do
 done
 export ACLOCAL AUTOHEADER AUTOCONF AUTOMAKE AUTORECONF
 eval `$LIBTOOL --config | grep '^EGREP='`
-eval `$LIBTOOL --config | $EGREP 
'^(host|host_os|host_alias|build|build_alias)='`
+eval `$LIBTOOL --config | $EGREP 
'^(host|host_os|host_alias|build|build_alias|to_host_path_cmd)='`
 configure_options=--prefix=/nonexistent
 if test -n "$host_alias"; then
   configure_options="$configure_options --host $host_alias"
@@ -46,6 +46,9 @@ fi
 if test -n "$build_alias"; then
   configure_options="$configure_options --build $build_alias"
 fi
+if test -n "$to_host_path_cmd"; then
+  configure_options="$configure_options 
lt_cv_to_host_path_cmd=$to_host_path_cmd"
+fi
 if (FOO=bar; unset FOO) >/dev/null 2>&1; then
   unset=unset
 else

reply via email to

[Prev in Thread] Current Thread [Next in Thread]