Hi Ralf,

Den 2010-06-12 10:05 skrev Ralf Wildenhues:
* Peter Rosin wrote on Sat, Jun 12, 2010 at 12:49:18AM CEST:
The above may sound as if I'm opposed to moving the script to
automake, but I'm not. I'm mostly afraid of the script ending up
where the cccl script - or should I say script_s_ - ended up.

Well, I sort of figured that the 'compile' script could end up absorbing
quite a bit of the cccl functionality so to make it unneeded.  But hey,
let's be honest, somebody would have to do this work, because I don't
have the resources to do it.

Do you think something along these lines would be acceptable? It would
remove the need of some patches on the pr-msvc-support branch...

Is it perhaps time for me to assign copyright for automake changes?

Cheers,
Peter
diff --git a/lib/compile b/lib/compile
index c0096a7..ce89059 100755
--- a/lib/compile
+++ b/lib/compile
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Wrapper for compilers which do not understand `-c -o'.
 
-scriptversion=2009-10-06.20; # UTC
+scriptversion=2010-06-14.06; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009  Free Software
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010  Free Software
 # Foundation, Inc.
 # Written by Tom Tromey <tro...@cygnus.com>.
 #
@@ -29,6 +29,108 @@ scriptversion=2009-10-06.20; # UTC
 # bugs to <bug-autom...@gnu.org> or send patches to
 # <automake-patc...@gnu.org>.
 
+path_conv=
+
+# func_path_conf build_path
+# Convert a $build path to $host form and store it in $path
+func_path_conv ()
+{
+  path=$1
+  case $path in
+    /[^/]*) # absolute path, and no UNC path
+      if test -z "$path_conv"; then
+       # lazily determine how to convert abs paths
+       case `uname -s` in
+         MINGW*)
+           path_conv=mingw
+           ;;
+         CYGWIN*)
+           path_conv=cygwin
+           ;;
+         *)
+           path_conv=wine
+           ;;
+       esac
+      fi
+      case $path_conv in
+       mingw)
+         path=`cmd //C echo "$path " | sed -e 's/"\(.*\) " *\$/\1/'`
+         ;;
+       cygwin)
+         path=`cygpath -w "$path"`
+         ;;
+       wine)
+         path=`winepath -w "$path"`
+         ;;
+      esac
+      ;;
+  esac
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suite cl
+func_cl_wrapper ()
+{
+  # Assume a capable shell
+  for arg
+  do
+    if test -n "$eat"; then
+      eat=
+    else
+      case $1 in
+       -o)
+         # configure might choose to run compile as `compile cc -o foo foo.c'.
+         eat=1
+         case $2 in
+           *.o | *.obj)
+             func_path_conv "$2"
+             set x "$@" -Fo"$path"
+             shift
+             ;;
+           *)
+             func_path_conv "$2"
+             set x "$@" -Fe"$path"
+             shift
+             ;;
+         esac
+         ;;
+       -I*)
+         func_path_conv "${1#-I}"
+         set x "$@" -I"$path"
+         shift
+         ;;
+       -l*)
+         set x "$@" "${1#-l}.lib"
+         shift
+         ;;
+       -L*)
+         func_path_conv "${1#-L}"
+         export LINK="$LINK -LIBPATH:$path"
+         ;;
+       -Wl,*)
+         arg=${1#-Wl,}
+         save_ifs="$IFS"; IFS=','
+         for flag in $arg; do
+           IFS="$save_ifs"
+           export LINK="$LINK $flag"
+         done
+         IFS="$save_ifs"
+         ;;
+       -Xlinker)
+         eat=1
+         export LINK="$LINK $2"
+         ;;
+       *)
+         set x "$@" "$1"
+         shift
+         ;;
+      esac
+    fi
+    shift
+  done
+  exec "$@"
+}
+
 case $1 in
   '')
      echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
@@ -53,6 +155,9 @@ EOF
     echo "compile $scriptversion"
     exit $?
     ;;
+  cl | *[/\\]cl)
+    func_cl_wrapper "$@"      # Doesn't return...
+    ;;
 esac
 
 ofile=
_______________________________________________
http://lists.gnu.org/mailman/listinfo/libtool

Reply via email to