Enable the use of "link -lib" as the wrapped archiver.
authorPeter Rosin <peda@lysator.liu.se>
Thu, 12 Aug 2010 16:01:18 +0000 (18:01 +0200)
committerPeter Rosin <peda@lysator.liu.se>
Thu, 12 Aug 2010 16:01:18 +0000 (18:01 +0200)
* lib/ar-lib: Enable the use of "link -lib" as the wrapped
archiver, as well as allowing some other options to be passed
through to the wrapped archiver.
* tests/ar-lib.test: Test the above.

Signed-off-by: Peter Rosin <peda@lysator.liu.se>
ChangeLog
lib/ar-lib
tests/ar-lib.test

index 8208906..2a1c514 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-08-12  Peter Rosin  <peda@lysator.liu.se>
+
+       Enable the use of "link -lib" as the wrapped archiver.
+       * lib/ar-lib: Enable the use of "link -lib" as the wrapped
+       archiver, as well as allowing some other options to be passed
+       through to the wrapped archiver.
+       * tests/ar-lib.test: Test the above.
+
 2010-08-06  Peter Rosin  <peda@lysator.liu.se>
 
        Add new auxiliary 'ar-lib' script, wrapping Microsoft lib.
index aa4acbd..ef03430 100755 (executable)
@@ -2,7 +2,7 @@
 # Wrapper for Microsoft lib.exe
 
 me=ar-lib
-scriptversion=2010-08-08.07; # UTC
+scriptversion=2010-08-12.16; # UTC
 
 # Copyright (C) 2010 Free Software
 # Foundation, Inc.
@@ -121,8 +121,28 @@ fi
 
 AR=$1
 shift
-action=$1
-shift
+while :
+do
+  if test $# -lt 2; then
+    func_error "you must specify a program, an action and an archive"
+  fi
+  case $1 in
+    -lib | -LIB \
+    | -ltcg | -LTCG \
+    | -machine* | -MACHINE* \
+    | -subsystem* | -SUBSYSTEM* \
+    | -verbose | -VERBOSE \
+    | -wx* | -WX* )
+      AR="$AR $1"
+      shift
+      ;;
+    *)
+      action=$1
+      shift
+      break
+      ;;
+  esac
+done
 orig_archive=$1
 shift
 func_file_conv "$orig_archive"
index 85f8242..d418c21 100755 (executable)
@@ -72,4 +72,8 @@ test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib"
 opts=`./ar-lib ./lib x foo.lib @foolist`
 test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib"
 
+# Check if ar-lib passes -lib and -LTCG through to the wrappee
+opts=`./ar-lib ./lib -lib -LTCG x foo.lib foo.obj`
+test x"$opts" = x"lib -lib -LTCG -NOLOGO -EXTRACT:foo.obj foo.lib"
+
 :