[AdgCanvas] Implemented imposed canvas size
[adg.git] / build / shave-libtool.in
blob54ebd69077062e81b65139cdbf62a32d40b47a2e
1 #!/bin/sh
3 # Copyright (c) 2009, Damien Lespiau <damien.lespiau@gmail.com>
5 # Permission is hereby granted, free of charge, to any person
6 # obtaining a copy of this software and associated documentation
7 # files (the "Software"), to deal in the Software without
8 # restriction, including without limitation the rights to use,
9 # copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the
11 # Software is furnished to do so, subject to the following
12 # conditions:
14 # The above copyright notice and this permission notice shall be
15 # included in all copies or substantial portions of the Software.
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 # OTHER DEALINGS IN THE SOFTWARE.
26 # we need sed
27 SED=@SED@
28 if test -z "$SED" ; then
29 SED=sed
32 lt_unmangle ()
34 last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'`
37 # the real libtool to use
38 LIBTOOL="$1"
39 shift
41 # if 1, don't print anything, the underlaying wrapper will do it
42 pass_though=0
44 # scan the arguments, keep the right ones for libtool, and discover the mode
45 preserved_args=
47 # have we seen the --tag option of libtool in the command line ?
48 tag_seen=0
50 while test "$#" -gt 0; do
51 opt="$1"
52 shift
54 case $opt in
55 --mode=*)
56 mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'`
57 preserved_args="$preserved_args $opt"
59 -o)
60 lt_output="$1"
61 preserved_args="$preserved_args $opt"
63 --tag=*)
64 tag_seen=1
65 preserved_args="$preserved_args $opt"
68 preserved_args="$preserved_args $opt"
70 esac
71 done
73 case "$mode" in
74 compile)
75 # shave will be called and print the actual CC/CXX/LINK line
76 preserved_args="$preserved_args --shave-mode=$mode"
77 pass_though=1
79 link)
80 preserved_args="$preserved_args --shave-mode=$mode"
81 Q=" LINK "
84 # let's u
85 # echo "*** libtool: Unimplemented mode: $mode, fill a bug report"
87 esac
89 lt_unmangle "$lt_output"
90 output=$last_result
92 # automake does not add a --tag switch to its libtool invocation when
93 # assembling a .s file and rely on libtool to infer the right action based
94 # on the compiler name. As shave is using CC to hook a wrapper, libtool gets
95 # confused. Let's detect these cases and add a --tag=CC option.
96 tag=""
97 if test $tag_seen -eq 0 -a x"$mode" = xcompile; then
98 tag="--tag=CC"
101 if test -z $V; then
102 if test $pass_though -eq 0; then
103 echo "$Q$output"
105 $LIBTOOL --silent $tag $preserved_args
106 else
107 echo $LIBTOOL $tag $preserved_args
108 $LIBTOOL $tag $preserved_args