GCC with OpenMP stream-computing extension and BatchQueue algorithm
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

libtool-ldflags 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #! /bin/sh
  2. # Script to translate LDFLAGS into a form suitable for use with libtool.
  3. # Copyright (C) 2005 Free Software Foundation, Inc.
  4. #
  5. # This file is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  18. # MA 02110-1301, USA.
  19. # Contributed by CodeSourcery, LLC.
  20. # This script is designed to be used from a Makefile that uses libtool
  21. # to build libraries as follows:
  22. #
  23. # LTLDFLAGS = $(shell libtool-ldflags $(LDFLAGS))
  24. #
  25. # Then, use (LTLDFLAGS) in place of $(LDFLAGS) in your link line.
  26. # The output of the script. This string is built up as we process the
  27. # arguments.
  28. result=
  29. prev_arg=
  30. for arg
  31. do
  32. case $arg in
  33. -f*|--*)
  34. # Libtool does not ascribe any special meaning options
  35. # that begin with -f or with a double-dash. So, it will
  36. # think these options are linker options, and prefix them
  37. # with "-Wl,". Then, the compiler driver will ignore the
  38. # options. So, we prefix these options with -Xcompiler to
  39. # make clear to libtool that they are in fact compiler
  40. # options.
  41. case $prev_arg in
  42. -Xpreprocessor|-Xcompiler|-Xlinker)
  43. # This option is already prefixed; don't prefix it again.
  44. ;;
  45. *)
  46. result="$result -Xcompiler"
  47. ;;
  48. esac
  49. ;;
  50. *)
  51. # We do not want to add -Xcompiler to other options because
  52. # that would prevent libtool itself from recognizing them.
  53. ;;
  54. esac
  55. prev_arg=$arg
  56. # If $(LDFLAGS) is (say):
  57. # a "b'c d" e
  58. # then the user expects that:
  59. # $(LD) $(LDFLAGS)
  60. # will pass three arguments to $(LD):
  61. # 1) a
  62. # 2) b'c d
  63. # 3) e
  64. # We must ensure, therefore, that the arguments are appropriately
  65. # quoted so that using:
  66. # libtool --mode=link ... $(LTLDFLAGS)
  67. # will result in the same number of arguments being passed to
  68. # libtool. In other words, when this script was invoked, the shell
  69. # removed one level of quoting, present in $(LDFLAGS); we have to put
  70. # it back.
  71. # Quote any embedded single quotes.
  72. case $arg in
  73. *"'"*)
  74. # The following command creates the script:
  75. # 1s,^X,,;s|'|'"'"'|g
  76. # which removes a leading X, and then quotes and embedded single
  77. # quotes.
  78. sed_script="1s,^X,,;s|'|'\"'\"'|g"
  79. # Add a leading "X" so that if $arg starts with a dash,
  80. # the echo command will not try to interpret the argument
  81. # as a command-line option.
  82. arg="X$arg"
  83. # Generate the quoted string.
  84. quoted_arg=`echo "$arg" | sed -e "$sed_script"`
  85. ;;
  86. *)
  87. quoted_arg=$arg
  88. ;;
  89. esac
  90. # Surround the entire argument with single quotes.
  91. quoted_arg="'"$quoted_arg"'"
  92. # Add it to the string.
  93. result="$result $quoted_arg"
  94. done
  95. # Output the string we have built up.
  96. echo "$result"