/build/m4/shave/shave-libtool.in

http://github.com/hbons/SparkleShare · Autoconf · 109 lines · 61 code · 12 blank · 36 comment · 5 complexity · cea230cdabd8e5e356bab16645357a29 MD5 · raw file

  1. #!/bin/sh
  2. #
  3. # Copyright (c) 2009, Damien Lespiau <damien.lespiau@gmail.com>
  4. #
  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:
  13. #
  14. # The above copyright notice and this permission notice shall be
  15. # included in all copies or substantial portions of the Software.
  16. #
  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.
  25. # we need sed
  26. SED=@SED@
  27. if test -z "$SED" ; then
  28. SED=sed
  29. fi
  30. lt_unmangle ()
  31. {
  32. last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'`
  33. }
  34. # the real libtool to use
  35. LIBTOOL="$1"
  36. shift
  37. # if 1, don't print anything, the underlaying wrapper will do it
  38. pass_though=0
  39. # scan the arguments, keep the right ones for libtool, and discover the mode
  40. preserved_args=
  41. # have we seen the --tag option of libtool in the command line ?
  42. tag_seen=0
  43. while test "$#" -gt 0; do
  44. opt="$1"
  45. shift
  46. case $opt in
  47. --mode=*)
  48. mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'`
  49. preserved_args="$preserved_args $opt"
  50. ;;
  51. -o)
  52. lt_output="$1"
  53. preserved_args="$preserved_args $opt"
  54. ;;
  55. --tag=*)
  56. tag_seen=1
  57. preserved_args="$preserved_args $opt"
  58. ;;
  59. *)
  60. preserved_args="$preserved_args $opt"
  61. ;;
  62. esac
  63. done
  64. case "$mode" in
  65. compile)
  66. # shave will be called and print the actual CC/CXX/LINK line
  67. preserved_args="$preserved_args --shave-mode=$mode"
  68. pass_though=1
  69. ;;
  70. link)
  71. preserved_args="$preserved_args --shave-mode=$mode"
  72. Q=" LINK "
  73. ;;
  74. *)
  75. # let's u
  76. # echo "*** libtool: Unimplemented mode: $mode, fill a bug report"
  77. ;;
  78. esac
  79. lt_unmangle "$lt_output"
  80. output=$last_result
  81. # automake does not add a --tag switch to its libtool invocation when
  82. # assembling a .s file and rely on libtool to infer the right action based
  83. # on the compiler name. As shave is using CC to hook a wrapper, libtool gets
  84. # confused. Let's detect these cases and add a --tag=CC option.
  85. tag=""
  86. if test $tag_seen -eq 0 -a x"$mode" = xcompile; then
  87. tag="--tag=CC"
  88. fi
  89. if test -z $V; then
  90. if test $pass_though -eq 0; then
  91. echo "$Q$output"
  92. fi
  93. $LIBTOOL --silent $tag $preserved_args
  94. else
  95. echo $LIBTOOL $tag $preserved_args
  96. $LIBTOOL $tag $preserved_args
  97. fi