Merge lp:~ubuntu-branches/ubuntu/natty/gtksourceview3/natty-201104070312 into lp:ubuntu/natty/gtksourceview3
- Natty (11.04)
- natty-201104070312
- Merge into natty
Proposed by
James Westby
Status: | Merged |
---|---|
Merged at revision: | 11 |
Proposed branch: | lp:~ubuntu-branches/ubuntu/natty/gtksourceview3/natty-201104070312 |
Merge into: | lp:ubuntu/natty/gtksourceview3 |
Diff against target: |
8759 lines (+8748/-0) (has conflicts) 1 file modified
.pc/99_ltmain_as-needed.patch/ltmain.sh (+8748/-0) Text conflict in .pc/99_ltmain_as-needed.patch/ltmain.sh |
To merge this branch: | bzr merge lp:~ubuntu-branches/ubuntu/natty/gtksourceview3/natty-201104070312 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Development Team | Pending | ||
Review via email: mp+56681@code.launchpad.net |
Commit message
Description of the change
The package history in the archive and the history in the bzr branch differ. As the archive is authoritative the history of lp:ubuntu/natty/gtksourceview3 now reflects that and the old bzr branch has been pushed to lp:~ubuntu-branches/ubuntu/natty/gtksourceview3/natty-201104070312. A merge should be performed if necessary.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.pc/99_ltmain_as-needed.patch/ltmain.sh' | |||
2 | --- .pc/99_ltmain_as-needed.patch/ltmain.sh 2011-04-06 17:25:57 +0000 | |||
3 | +++ .pc/99_ltmain_as-needed.patch/ltmain.sh 2011-04-07 03:16:31 +0000 | |||
4 | @@ -1,3 +1,4 @@ | |||
5 | 1 | <<<<<<< TREE | ||
6 | 1 | 2 | ||
7 | 2 | # libtool (GNU libtool) 2.4 | 3 | # libtool (GNU libtool) 2.4 |
8 | 3 | # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 | 4 | # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
9 | @@ -9634,3 +9635,8750 @@ | |||
10 | 9634 | # End: | 9635 | # End: |
11 | 9635 | # vi:sw=2 | 9636 | # vi:sw=2 |
12 | 9636 | 9637 | ||
13 | 9638 | ======= | ||
14 | 9639 | # Generated from ltmain.m4sh. | ||
15 | 9640 | |||
16 | 9641 | # libtool (GNU libtool) 2.2.10 | ||
17 | 9642 | # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 | ||
18 | 9643 | |||
19 | 9644 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, | ||
20 | 9645 | # 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | ||
21 | 9646 | # This is free software; see the source for copying conditions. There is NO | ||
22 | 9647 | # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
23 | 9648 | |||
24 | 9649 | # GNU Libtool is free software; you can redistribute it and/or modify | ||
25 | 9650 | # it under the terms of the GNU General Public License as published by | ||
26 | 9651 | # the Free Software Foundation; either version 2 of the License, or | ||
27 | 9652 | # (at your option) any later version. | ||
28 | 9653 | # | ||
29 | 9654 | # As a special exception to the GNU General Public License, | ||
30 | 9655 | # if you distribute this file as part of a program or library that | ||
31 | 9656 | # is built using GNU Libtool, you may include this file under the | ||
32 | 9657 | # same distribution terms that you use for the rest of that program. | ||
33 | 9658 | # | ||
34 | 9659 | # GNU Libtool is distributed in the hope that it will be useful, but | ||
35 | 9660 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
36 | 9661 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
37 | 9662 | # General Public License for more details. | ||
38 | 9663 | # | ||
39 | 9664 | # You should have received a copy of the GNU General Public License | ||
40 | 9665 | # along with GNU Libtool; see the file COPYING. If not, a copy | ||
41 | 9666 | # can be downloaded from http://www.gnu.org/licenses/gpl.html, | ||
42 | 9667 | # or obtained by writing to the Free Software Foundation, Inc., | ||
43 | 9668 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
44 | 9669 | |||
45 | 9670 | # Usage: $progname [OPTION]... [MODE-ARG]... | ||
46 | 9671 | # | ||
47 | 9672 | # Provide generalized library-building support services. | ||
48 | 9673 | # | ||
49 | 9674 | # --config show all configuration variables | ||
50 | 9675 | # --debug enable verbose shell tracing | ||
51 | 9676 | # -n, --dry-run display commands without modifying any files | ||
52 | 9677 | # --features display basic configuration information and exit | ||
53 | 9678 | # --mode=MODE use operation mode MODE | ||
54 | 9679 | # --preserve-dup-deps don't remove duplicate dependency libraries | ||
55 | 9680 | # --quiet, --silent don't print informational messages | ||
56 | 9681 | # --no-quiet, --no-silent | ||
57 | 9682 | # print informational messages (default) | ||
58 | 9683 | # --tag=TAG use configuration variables from tag TAG | ||
59 | 9684 | # -v, --verbose print more informational messages than default | ||
60 | 9685 | # --no-verbose don't print the extra informational messages | ||
61 | 9686 | # --version print version information | ||
62 | 9687 | # -h, --help, --help-all print short, long, or detailed help message | ||
63 | 9688 | # | ||
64 | 9689 | # MODE must be one of the following: | ||
65 | 9690 | # | ||
66 | 9691 | # clean remove files from the build directory | ||
67 | 9692 | # compile compile a source file into a libtool object | ||
68 | 9693 | # execute automatically set library path, then run a program | ||
69 | 9694 | # finish complete the installation of libtool libraries | ||
70 | 9695 | # install install libraries or executables | ||
71 | 9696 | # link create a library or an executable | ||
72 | 9697 | # uninstall remove libraries from an installed directory | ||
73 | 9698 | # | ||
74 | 9699 | # MODE-ARGS vary depending on the MODE. When passed as first option, | ||
75 | 9700 | # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. | ||
76 | 9701 | # Try `$progname --help --mode=MODE' for a more detailed description of MODE. | ||
77 | 9702 | # | ||
78 | 9703 | # When reporting a bug, please describe a test case to reproduce it and | ||
79 | 9704 | # include the following information: | ||
80 | 9705 | # | ||
81 | 9706 | # host-triplet: $host | ||
82 | 9707 | # shell: $SHELL | ||
83 | 9708 | # compiler: $LTCC | ||
84 | 9709 | # compiler flags: $LTCFLAGS | ||
85 | 9710 | # linker: $LD (gnu? $with_gnu_ld) | ||
86 | 9711 | # $progname: (GNU libtool) 2.2.10 | ||
87 | 9712 | # automake: $automake_version | ||
88 | 9713 | # autoconf: $autoconf_version | ||
89 | 9714 | # | ||
90 | 9715 | # Report bugs to <bug-libtool@gnu.org>. | ||
91 | 9716 | |||
92 | 9717 | PROGRAM=libtool | ||
93 | 9718 | PACKAGE=libtool | ||
94 | 9719 | VERSION=2.2.10 | ||
95 | 9720 | TIMESTAMP="" | ||
96 | 9721 | package_revision=1.3175 | ||
97 | 9722 | |||
98 | 9723 | # Be Bourne compatible | ||
99 | 9724 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then | ||
100 | 9725 | emulate sh | ||
101 | 9726 | NULLCMD=: | ||
102 | 9727 | # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which | ||
103 | 9728 | # is contrary to our usage. Disable this feature. | ||
104 | 9729 | alias -g '${1+"$@"}'='"$@"' | ||
105 | 9730 | setopt NO_GLOB_SUBST | ||
106 | 9731 | else | ||
107 | 9732 | case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac | ||
108 | 9733 | fi | ||
109 | 9734 | BIN_SH=xpg4; export BIN_SH # for Tru64 | ||
110 | 9735 | DUALCASE=1; export DUALCASE # for MKS sh | ||
111 | 9736 | |||
112 | 9737 | # A function that is used when there is no print builtin or printf. | ||
113 | 9738 | func_fallback_echo () | ||
114 | 9739 | { | ||
115 | 9740 | eval 'cat <<_LTECHO_EOF | ||
116 | 9741 | $1 | ||
117 | 9742 | _LTECHO_EOF' | ||
118 | 9743 | } | ||
119 | 9744 | |||
120 | 9745 | # NLS nuisances: We save the old values to restore during execute mode. | ||
121 | 9746 | lt_user_locale= | ||
122 | 9747 | lt_safe_locale= | ||
123 | 9748 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES | ||
124 | 9749 | do | ||
125 | 9750 | eval "if test \"\${$lt_var+set}\" = set; then | ||
126 | 9751 | save_$lt_var=\$$lt_var | ||
127 | 9752 | $lt_var=C | ||
128 | 9753 | export $lt_var | ||
129 | 9754 | lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" | ||
130 | 9755 | lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" | ||
131 | 9756 | fi" | ||
132 | 9757 | done | ||
133 | 9758 | LC_ALL=C | ||
134 | 9759 | LANGUAGE=C | ||
135 | 9760 | export LANGUAGE LC_ALL | ||
136 | 9761 | |||
137 | 9762 | $lt_unset CDPATH | ||
138 | 9763 | |||
139 | 9764 | |||
140 | 9765 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh | ||
141 | 9766 | # is ksh but when the shell is invoked as "sh" and the current value of | ||
142 | 9767 | # the _XPG environment variable is not equal to 1 (one), the special | ||
143 | 9768 | # positional parameter $0, within a function call, is the name of the | ||
144 | 9769 | # function. | ||
145 | 9770 | progpath="$0" | ||
146 | 9771 | |||
147 | 9772 | |||
148 | 9773 | |||
149 | 9774 | : ${CP="cp -f"} | ||
150 | 9775 | test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} | ||
151 | 9776 | : ${EGREP="/bin/grep -E"} | ||
152 | 9777 | : ${FGREP="/bin/grep -F"} | ||
153 | 9778 | : ${GREP="/bin/grep"} | ||
154 | 9779 | : ${LN_S="ln -s"} | ||
155 | 9780 | : ${MAKE="make"} | ||
156 | 9781 | : ${MKDIR="mkdir"} | ||
157 | 9782 | : ${MV="mv -f"} | ||
158 | 9783 | : ${RM="rm -f"} | ||
159 | 9784 | : ${SED="/bin/sed"} | ||
160 | 9785 | : ${SHELL="${CONFIG_SHELL-/bin/sh}"} | ||
161 | 9786 | : ${Xsed="$SED -e 1s/^X//"} | ||
162 | 9787 | |||
163 | 9788 | # Global variables: | ||
164 | 9789 | EXIT_SUCCESS=0 | ||
165 | 9790 | EXIT_FAILURE=1 | ||
166 | 9791 | EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. | ||
167 | 9792 | EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. | ||
168 | 9793 | |||
169 | 9794 | exit_status=$EXIT_SUCCESS | ||
170 | 9795 | |||
171 | 9796 | # Make sure IFS has a sensible default | ||
172 | 9797 | lt_nl=' | ||
173 | 9798 | ' | ||
174 | 9799 | IFS=" $lt_nl" | ||
175 | 9800 | |||
176 | 9801 | dirname="s,/[^/]*$,," | ||
177 | 9802 | basename="s,^.*/,," | ||
178 | 9803 | |||
179 | 9804 | # func_dirname_and_basename file append nondir_replacement | ||
180 | 9805 | # perform func_basename and func_dirname in a single function | ||
181 | 9806 | # call: | ||
182 | 9807 | # dirname: Compute the dirname of FILE. If nonempty, | ||
183 | 9808 | # add APPEND to the result, otherwise set result | ||
184 | 9809 | # to NONDIR_REPLACEMENT. | ||
185 | 9810 | # value returned in "$func_dirname_result" | ||
186 | 9811 | # basename: Compute filename of FILE. | ||
187 | 9812 | # value retuned in "$func_basename_result" | ||
188 | 9813 | # Implementation must be kept synchronized with func_dirname | ||
189 | 9814 | # and func_basename. For efficiency, we do not delegate to | ||
190 | 9815 | # those functions but instead duplicate the functionality here. | ||
191 | 9816 | func_dirname_and_basename () | ||
192 | 9817 | { | ||
193 | 9818 | # Extract subdirectory from the argument. | ||
194 | 9819 | func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` | ||
195 | 9820 | if test "X$func_dirname_result" = "X${1}"; then | ||
196 | 9821 | func_dirname_result="${3}" | ||
197 | 9822 | else | ||
198 | 9823 | func_dirname_result="$func_dirname_result${2}" | ||
199 | 9824 | fi | ||
200 | 9825 | func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` | ||
201 | 9826 | } | ||
202 | 9827 | |||
203 | 9828 | # Generated shell functions inserted here. | ||
204 | 9829 | |||
205 | 9830 | # These SED scripts presuppose an absolute path with a trailing slash. | ||
206 | 9831 | pathcar='s,^/\([^/]*\).*$,\1,' | ||
207 | 9832 | pathcdr='s,^/[^/]*,,' | ||
208 | 9833 | removedotparts=':dotsl | ||
209 | 9834 | s@/\./@/@g | ||
210 | 9835 | t dotsl | ||
211 | 9836 | s,/\.$,/,' | ||
212 | 9837 | collapseslashes='s@/\{1,\}@/@g' | ||
213 | 9838 | finalslash='s,/*$,/,' | ||
214 | 9839 | |||
215 | 9840 | # func_normal_abspath PATH | ||
216 | 9841 | # Remove doubled-up and trailing slashes, "." path components, | ||
217 | 9842 | # and cancel out any ".." path components in PATH after making | ||
218 | 9843 | # it an absolute path. | ||
219 | 9844 | # value returned in "$func_normal_abspath_result" | ||
220 | 9845 | func_normal_abspath () | ||
221 | 9846 | { | ||
222 | 9847 | # Start from root dir and reassemble the path. | ||
223 | 9848 | func_normal_abspath_result= | ||
224 | 9849 | func_normal_abspath_tpath=$1 | ||
225 | 9850 | func_normal_abspath_altnamespace= | ||
226 | 9851 | case $func_normal_abspath_tpath in | ||
227 | 9852 | "") | ||
228 | 9853 | # Empty path, that just means $cwd. | ||
229 | 9854 | func_stripname '' '/' "`pwd`" | ||
230 | 9855 | func_normal_abspath_result=$func_stripname_result | ||
231 | 9856 | return | ||
232 | 9857 | ;; | ||
233 | 9858 | # The next three entries are used to spot a run of precisely | ||
234 | 9859 | # two leading slashes without using negated character classes; | ||
235 | 9860 | # we take advantage of case's first-match behaviour. | ||
236 | 9861 | ///*) | ||
237 | 9862 | # Unusual form of absolute path, do nothing. | ||
238 | 9863 | ;; | ||
239 | 9864 | //*) | ||
240 | 9865 | # Not necessarily an ordinary path; POSIX reserves leading '//' | ||
241 | 9866 | # and for example Cygwin uses it to access remote file shares | ||
242 | 9867 | # over CIFS/SMB, so we conserve a leading double slash if found. | ||
243 | 9868 | func_normal_abspath_altnamespace=/ | ||
244 | 9869 | ;; | ||
245 | 9870 | /*) | ||
246 | 9871 | # Absolute path, do nothing. | ||
247 | 9872 | ;; | ||
248 | 9873 | *) | ||
249 | 9874 | # Relative path, prepend $cwd. | ||
250 | 9875 | func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath | ||
251 | 9876 | ;; | ||
252 | 9877 | esac | ||
253 | 9878 | # Cancel out all the simple stuff to save iterations. We also want | ||
254 | 9879 | # the path to end with a slash for ease of parsing, so make sure | ||
255 | 9880 | # there is one (and only one) here. | ||
256 | 9881 | func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ | ||
257 | 9882 | -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` | ||
258 | 9883 | while :; do | ||
259 | 9884 | # Processed it all yet? | ||
260 | 9885 | if test "$func_normal_abspath_tpath" = / ; then | ||
261 | 9886 | # If we ascended to the root using ".." the result may be empty now. | ||
262 | 9887 | if test -z "$func_normal_abspath_result" ; then | ||
263 | 9888 | func_normal_abspath_result=/ | ||
264 | 9889 | fi | ||
265 | 9890 | break | ||
266 | 9891 | fi | ||
267 | 9892 | func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ | ||
268 | 9893 | -e "$pathcar"` | ||
269 | 9894 | func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ | ||
270 | 9895 | -e "$pathcdr"` | ||
271 | 9896 | # Figure out what to do with it | ||
272 | 9897 | case $func_normal_abspath_tcomponent in | ||
273 | 9898 | "") | ||
274 | 9899 | # Trailing empty path component, ignore it. | ||
275 | 9900 | ;; | ||
276 | 9901 | ..) | ||
277 | 9902 | # Parent dir; strip last assembled component from result. | ||
278 | 9903 | func_dirname "$func_normal_abspath_result" | ||
279 | 9904 | func_normal_abspath_result=$func_dirname_result | ||
280 | 9905 | ;; | ||
281 | 9906 | *) | ||
282 | 9907 | # Actual path component, append it. | ||
283 | 9908 | func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent | ||
284 | 9909 | ;; | ||
285 | 9910 | esac | ||
286 | 9911 | done | ||
287 | 9912 | # Restore leading double-slash if one was found on entry. | ||
288 | 9913 | func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result | ||
289 | 9914 | } | ||
290 | 9915 | |||
291 | 9916 | # func_relative_path SRCDIR DSTDIR | ||
292 | 9917 | # generates a relative path from SRCDIR to DSTDIR, with a trailing | ||
293 | 9918 | # slash if non-empty, suitable for immediately appending a filename | ||
294 | 9919 | # without needing to append a separator. | ||
295 | 9920 | # value returned in "$func_relative_path_result" | ||
296 | 9921 | func_relative_path () | ||
297 | 9922 | { | ||
298 | 9923 | func_relative_path_result= | ||
299 | 9924 | func_normal_abspath "$1" | ||
300 | 9925 | func_relative_path_tlibdir=$func_normal_abspath_result | ||
301 | 9926 | func_normal_abspath "$2" | ||
302 | 9927 | func_relative_path_tbindir=$func_normal_abspath_result | ||
303 | 9928 | |||
304 | 9929 | # Ascend the tree starting from libdir | ||
305 | 9930 | while :; do | ||
306 | 9931 | # check if we have found a prefix of bindir | ||
307 | 9932 | case $func_relative_path_tbindir in | ||
308 | 9933 | $func_relative_path_tlibdir) | ||
309 | 9934 | # found an exact match | ||
310 | 9935 | func_relative_path_tcancelled= | ||
311 | 9936 | break | ||
312 | 9937 | ;; | ||
313 | 9938 | $func_relative_path_tlibdir*) | ||
314 | 9939 | # found a matching prefix | ||
315 | 9940 | func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" | ||
316 | 9941 | func_relative_path_tcancelled=$func_stripname_result | ||
317 | 9942 | if test -z "$func_relative_path_result"; then | ||
318 | 9943 | func_relative_path_result=. | ||
319 | 9944 | fi | ||
320 | 9945 | break | ||
321 | 9946 | ;; | ||
322 | 9947 | *) | ||
323 | 9948 | func_dirname $func_relative_path_tlibdir | ||
324 | 9949 | func_relative_path_tlibdir=${func_dirname_result} | ||
325 | 9950 | if test "x$func_relative_path_tlibdir" = x ; then | ||
326 | 9951 | # Have to descend all the way to the root! | ||
327 | 9952 | func_relative_path_result=../$func_relative_path_result | ||
328 | 9953 | func_relative_path_tcancelled=$func_relative_path_tbindir | ||
329 | 9954 | break | ||
330 | 9955 | fi | ||
331 | 9956 | func_relative_path_result=../$func_relative_path_result | ||
332 | 9957 | ;; | ||
333 | 9958 | esac | ||
334 | 9959 | done | ||
335 | 9960 | |||
336 | 9961 | # Now calculate path; take care to avoid doubling-up slashes. | ||
337 | 9962 | func_stripname '' '/' "$func_relative_path_result" | ||
338 | 9963 | func_relative_path_result=$func_stripname_result | ||
339 | 9964 | func_stripname '/' '/' "$func_relative_path_tcancelled" | ||
340 | 9965 | if test "x$func_stripname_result" != x ; then | ||
341 | 9966 | func_relative_path_result=${func_relative_path_result}/${func_stripname_result} | ||
342 | 9967 | fi | ||
343 | 9968 | |||
344 | 9969 | # Normalisation. If bindir is libdir, return empty string, | ||
345 | 9970 | # else relative path ending with a slash; either way, target | ||
346 | 9971 | # file name can be directly appended. | ||
347 | 9972 | if test ! -z "$func_relative_path_result"; then | ||
348 | 9973 | func_stripname './' '' "$func_relative_path_result/" | ||
349 | 9974 | func_relative_path_result=$func_stripname_result | ||
350 | 9975 | fi | ||
351 | 9976 | } | ||
352 | 9977 | |||
353 | 9978 | # The name of this program: | ||
354 | 9979 | func_dirname_and_basename "$progpath" | ||
355 | 9980 | progname=$func_basename_result | ||
356 | 9981 | |||
357 | 9982 | # Make sure we have an absolute path for reexecution: | ||
358 | 9983 | case $progpath in | ||
359 | 9984 | [\\/]*|[A-Za-z]:\\*) ;; | ||
360 | 9985 | *[\\/]*) | ||
361 | 9986 | progdir=$func_dirname_result | ||
362 | 9987 | progdir=`cd "$progdir" && pwd` | ||
363 | 9988 | progpath="$progdir/$progname" | ||
364 | 9989 | ;; | ||
365 | 9990 | *) | ||
366 | 9991 | save_IFS="$IFS" | ||
367 | 9992 | IFS=: | ||
368 | 9993 | for progdir in $PATH; do | ||
369 | 9994 | IFS="$save_IFS" | ||
370 | 9995 | test -x "$progdir/$progname" && break | ||
371 | 9996 | done | ||
372 | 9997 | IFS="$save_IFS" | ||
373 | 9998 | test -n "$progdir" || progdir=`pwd` | ||
374 | 9999 | progpath="$progdir/$progname" | ||
375 | 10000 | ;; | ||
376 | 10001 | esac | ||
377 | 10002 | |||
378 | 10003 | # Sed substitution that helps us do robust quoting. It backslashifies | ||
379 | 10004 | # metacharacters that are still active within double-quoted strings. | ||
380 | 10005 | Xsed="${SED}"' -e 1s/^X//' | ||
381 | 10006 | sed_quote_subst='s/\([`"$\\]\)/\\\1/g' | ||
382 | 10007 | |||
383 | 10008 | # Same as above, but do not quote variable references. | ||
384 | 10009 | double_quote_subst='s/\(["`\\]\)/\\\1/g' | ||
385 | 10010 | |||
386 | 10011 | # Re-`\' parameter expansions in output of double_quote_subst that were | ||
387 | 10012 | # `\'-ed in input to the same. If an odd number of `\' preceded a '$' | ||
388 | 10013 | # in input to double_quote_subst, that '$' was protected from expansion. | ||
389 | 10014 | # Since each input `\' is now two `\'s, look for any number of runs of | ||
390 | 10015 | # four `\'s followed by two `\'s and then a '$'. `\' that '$'. | ||
391 | 10016 | bs='\\' | ||
392 | 10017 | bs2='\\\\' | ||
393 | 10018 | bs4='\\\\\\\\' | ||
394 | 10019 | dollar='\$' | ||
395 | 10020 | sed_double_backslash="\ | ||
396 | 10021 | s/$bs4/&\\ | ||
397 | 10022 | /g | ||
398 | 10023 | s/^$bs2$dollar/$bs&/ | ||
399 | 10024 | s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g | ||
400 | 10025 | s/\n//g" | ||
401 | 10026 | |||
402 | 10027 | # Standard options: | ||
403 | 10028 | opt_dry_run=false | ||
404 | 10029 | opt_help=false | ||
405 | 10030 | opt_quiet=false | ||
406 | 10031 | opt_verbose=false | ||
407 | 10032 | opt_warning=: | ||
408 | 10033 | |||
409 | 10034 | # func_echo arg... | ||
410 | 10035 | # Echo program name prefixed message, along with the current mode | ||
411 | 10036 | # name if it has been set yet. | ||
412 | 10037 | func_echo () | ||
413 | 10038 | { | ||
414 | 10039 | $ECHO "$progname${mode+: }$mode: $*" | ||
415 | 10040 | } | ||
416 | 10041 | |||
417 | 10042 | # func_verbose arg... | ||
418 | 10043 | # Echo program name prefixed message in verbose mode only. | ||
419 | 10044 | func_verbose () | ||
420 | 10045 | { | ||
421 | 10046 | $opt_verbose && func_echo ${1+"$@"} | ||
422 | 10047 | |||
423 | 10048 | # A bug in bash halts the script if the last line of a function | ||
424 | 10049 | # fails when set -e is in force, so we need another command to | ||
425 | 10050 | # work around that: | ||
426 | 10051 | : | ||
427 | 10052 | } | ||
428 | 10053 | |||
429 | 10054 | # func_echo_all arg... | ||
430 | 10055 | # Invoke $ECHO with all args, space-separated. | ||
431 | 10056 | func_echo_all () | ||
432 | 10057 | { | ||
433 | 10058 | $ECHO "$*" | ||
434 | 10059 | } | ||
435 | 10060 | |||
436 | 10061 | # func_error arg... | ||
437 | 10062 | # Echo program name prefixed message to standard error. | ||
438 | 10063 | func_error () | ||
439 | 10064 | { | ||
440 | 10065 | $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 | ||
441 | 10066 | } | ||
442 | 10067 | |||
443 | 10068 | # func_warning arg... | ||
444 | 10069 | # Echo program name prefixed warning message to standard error. | ||
445 | 10070 | func_warning () | ||
446 | 10071 | { | ||
447 | 10072 | $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 | ||
448 | 10073 | |||
449 | 10074 | # bash bug again: | ||
450 | 10075 | : | ||
451 | 10076 | } | ||
452 | 10077 | |||
453 | 10078 | # func_fatal_error arg... | ||
454 | 10079 | # Echo program name prefixed message to standard error, and exit. | ||
455 | 10080 | func_fatal_error () | ||
456 | 10081 | { | ||
457 | 10082 | func_error ${1+"$@"} | ||
458 | 10083 | exit $EXIT_FAILURE | ||
459 | 10084 | } | ||
460 | 10085 | |||
461 | 10086 | # func_fatal_help arg... | ||
462 | 10087 | # Echo program name prefixed message to standard error, followed by | ||
463 | 10088 | # a help hint, and exit. | ||
464 | 10089 | func_fatal_help () | ||
465 | 10090 | { | ||
466 | 10091 | func_error ${1+"$@"} | ||
467 | 10092 | func_fatal_error "$help" | ||
468 | 10093 | } | ||
469 | 10094 | help="Try \`$progname --help' for more information." ## default | ||
470 | 10095 | |||
471 | 10096 | |||
472 | 10097 | # func_grep expression filename | ||
473 | 10098 | # Check whether EXPRESSION matches any line of FILENAME, without output. | ||
474 | 10099 | func_grep () | ||
475 | 10100 | { | ||
476 | 10101 | $GREP "$1" "$2" >/dev/null 2>&1 | ||
477 | 10102 | } | ||
478 | 10103 | |||
479 | 10104 | |||
480 | 10105 | # func_mkdir_p directory-path | ||
481 | 10106 | # Make sure the entire path to DIRECTORY-PATH is available. | ||
482 | 10107 | func_mkdir_p () | ||
483 | 10108 | { | ||
484 | 10109 | my_directory_path="$1" | ||
485 | 10110 | my_dir_list= | ||
486 | 10111 | |||
487 | 10112 | if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then | ||
488 | 10113 | |||
489 | 10114 | # Protect directory names starting with `-' | ||
490 | 10115 | case $my_directory_path in | ||
491 | 10116 | -*) my_directory_path="./$my_directory_path" ;; | ||
492 | 10117 | esac | ||
493 | 10118 | |||
494 | 10119 | # While some portion of DIR does not yet exist... | ||
495 | 10120 | while test ! -d "$my_directory_path"; do | ||
496 | 10121 | # ...make a list in topmost first order. Use a colon delimited | ||
497 | 10122 | # list incase some portion of path contains whitespace. | ||
498 | 10123 | my_dir_list="$my_directory_path:$my_dir_list" | ||
499 | 10124 | |||
500 | 10125 | # If the last portion added has no slash in it, the list is done | ||
501 | 10126 | case $my_directory_path in */*) ;; *) break ;; esac | ||
502 | 10127 | |||
503 | 10128 | # ...otherwise throw away the child directory and loop | ||
504 | 10129 | my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` | ||
505 | 10130 | done | ||
506 | 10131 | my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` | ||
507 | 10132 | |||
508 | 10133 | save_mkdir_p_IFS="$IFS"; IFS=':' | ||
509 | 10134 | for my_dir in $my_dir_list; do | ||
510 | 10135 | IFS="$save_mkdir_p_IFS" | ||
511 | 10136 | # mkdir can fail with a `File exist' error if two processes | ||
512 | 10137 | # try to create one of the directories concurrently. Don't | ||
513 | 10138 | # stop in that case! | ||
514 | 10139 | $MKDIR "$my_dir" 2>/dev/null || : | ||
515 | 10140 | done | ||
516 | 10141 | IFS="$save_mkdir_p_IFS" | ||
517 | 10142 | |||
518 | 10143 | # Bail out if we (or some other process) failed to create a directory. | ||
519 | 10144 | test -d "$my_directory_path" || \ | ||
520 | 10145 | func_fatal_error "Failed to create \`$1'" | ||
521 | 10146 | fi | ||
522 | 10147 | } | ||
523 | 10148 | |||
524 | 10149 | |||
525 | 10150 | # func_mktempdir [string] | ||
526 | 10151 | # Make a temporary directory that won't clash with other running | ||
527 | 10152 | # libtool processes, and avoids race conditions if possible. If | ||
528 | 10153 | # given, STRING is the basename for that directory. | ||
529 | 10154 | func_mktempdir () | ||
530 | 10155 | { | ||
531 | 10156 | my_template="${TMPDIR-/tmp}/${1-$progname}" | ||
532 | 10157 | |||
533 | 10158 | if test "$opt_dry_run" = ":"; then | ||
534 | 10159 | # Return a directory name, but don't create it in dry-run mode | ||
535 | 10160 | my_tmpdir="${my_template}-$$" | ||
536 | 10161 | else | ||
537 | 10162 | |||
538 | 10163 | # If mktemp works, use that first and foremost | ||
539 | 10164 | my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` | ||
540 | 10165 | |||
541 | 10166 | if test ! -d "$my_tmpdir"; then | ||
542 | 10167 | # Failing that, at least try and use $RANDOM to avoid a race | ||
543 | 10168 | my_tmpdir="${my_template}-${RANDOM-0}$$" | ||
544 | 10169 | |||
545 | 10170 | save_mktempdir_umask=`umask` | ||
546 | 10171 | umask 0077 | ||
547 | 10172 | $MKDIR "$my_tmpdir" | ||
548 | 10173 | umask $save_mktempdir_umask | ||
549 | 10174 | fi | ||
550 | 10175 | |||
551 | 10176 | # If we're not in dry-run mode, bomb out on failure | ||
552 | 10177 | test -d "$my_tmpdir" || \ | ||
553 | 10178 | func_fatal_error "cannot create temporary directory \`$my_tmpdir'" | ||
554 | 10179 | fi | ||
555 | 10180 | |||
556 | 10181 | $ECHO "$my_tmpdir" | ||
557 | 10182 | } | ||
558 | 10183 | |||
559 | 10184 | |||
560 | 10185 | # func_quote_for_eval arg | ||
561 | 10186 | # Aesthetically quote ARG to be evaled later. | ||
562 | 10187 | # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT | ||
563 | 10188 | # is double-quoted, suitable for a subsequent eval, whereas | ||
564 | 10189 | # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters | ||
565 | 10190 | # which are still active within double quotes backslashified. | ||
566 | 10191 | func_quote_for_eval () | ||
567 | 10192 | { | ||
568 | 10193 | case $1 in | ||
569 | 10194 | *[\\\`\"\$]*) | ||
570 | 10195 | func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; | ||
571 | 10196 | *) | ||
572 | 10197 | func_quote_for_eval_unquoted_result="$1" ;; | ||
573 | 10198 | esac | ||
574 | 10199 | |||
575 | 10200 | case $func_quote_for_eval_unquoted_result in | ||
576 | 10201 | # Double-quote args containing shell metacharacters to delay | ||
577 | 10202 | # word splitting, command substitution and and variable | ||
578 | 10203 | # expansion for a subsequent eval. | ||
579 | 10204 | # Many Bourne shells cannot handle close brackets correctly | ||
580 | 10205 | # in scan sets, so we specify it separately. | ||
581 | 10206 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
582 | 10207 | func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" | ||
583 | 10208 | ;; | ||
584 | 10209 | *) | ||
585 | 10210 | func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" | ||
586 | 10211 | esac | ||
587 | 10212 | } | ||
588 | 10213 | |||
589 | 10214 | |||
590 | 10215 | # func_quote_for_expand arg | ||
591 | 10216 | # Aesthetically quote ARG to be evaled later; same as above, | ||
592 | 10217 | # but do not quote variable references. | ||
593 | 10218 | func_quote_for_expand () | ||
594 | 10219 | { | ||
595 | 10220 | case $1 in | ||
596 | 10221 | *[\\\`\"]*) | ||
597 | 10222 | my_arg=`$ECHO "$1" | $SED \ | ||
598 | 10223 | -e "$double_quote_subst" -e "$sed_double_backslash"` ;; | ||
599 | 10224 | *) | ||
600 | 10225 | my_arg="$1" ;; | ||
601 | 10226 | esac | ||
602 | 10227 | |||
603 | 10228 | case $my_arg in | ||
604 | 10229 | # Double-quote args containing shell metacharacters to delay | ||
605 | 10230 | # word splitting and command substitution for a subsequent eval. | ||
606 | 10231 | # Many Bourne shells cannot handle close brackets correctly | ||
607 | 10232 | # in scan sets, so we specify it separately. | ||
608 | 10233 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
609 | 10234 | my_arg="\"$my_arg\"" | ||
610 | 10235 | ;; | ||
611 | 10236 | esac | ||
612 | 10237 | |||
613 | 10238 | func_quote_for_expand_result="$my_arg" | ||
614 | 10239 | } | ||
615 | 10240 | |||
616 | 10241 | |||
617 | 10242 | # func_show_eval cmd [fail_exp] | ||
618 | 10243 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is | ||
619 | 10244 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP | ||
620 | 10245 | # is given, then evaluate it. | ||
621 | 10246 | func_show_eval () | ||
622 | 10247 | { | ||
623 | 10248 | my_cmd="$1" | ||
624 | 10249 | my_fail_exp="${2-:}" | ||
625 | 10250 | |||
626 | 10251 | ${opt_silent-false} || { | ||
627 | 10252 | func_quote_for_expand "$my_cmd" | ||
628 | 10253 | eval "func_echo $func_quote_for_expand_result" | ||
629 | 10254 | } | ||
630 | 10255 | |||
631 | 10256 | if ${opt_dry_run-false}; then :; else | ||
632 | 10257 | eval "$my_cmd" | ||
633 | 10258 | my_status=$? | ||
634 | 10259 | if test "$my_status" -eq 0; then :; else | ||
635 | 10260 | eval "(exit $my_status); $my_fail_exp" | ||
636 | 10261 | fi | ||
637 | 10262 | fi | ||
638 | 10263 | } | ||
639 | 10264 | |||
640 | 10265 | |||
641 | 10266 | # func_show_eval_locale cmd [fail_exp] | ||
642 | 10267 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is | ||
643 | 10268 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP | ||
644 | 10269 | # is given, then evaluate it. Use the saved locale for evaluation. | ||
645 | 10270 | func_show_eval_locale () | ||
646 | 10271 | { | ||
647 | 10272 | my_cmd="$1" | ||
648 | 10273 | my_fail_exp="${2-:}" | ||
649 | 10274 | |||
650 | 10275 | ${opt_silent-false} || { | ||
651 | 10276 | func_quote_for_expand "$my_cmd" | ||
652 | 10277 | eval "func_echo $func_quote_for_expand_result" | ||
653 | 10278 | } | ||
654 | 10279 | |||
655 | 10280 | if ${opt_dry_run-false}; then :; else | ||
656 | 10281 | eval "$lt_user_locale | ||
657 | 10282 | $my_cmd" | ||
658 | 10283 | my_status=$? | ||
659 | 10284 | eval "$lt_safe_locale" | ||
660 | 10285 | if test "$my_status" -eq 0; then :; else | ||
661 | 10286 | eval "(exit $my_status); $my_fail_exp" | ||
662 | 10287 | fi | ||
663 | 10288 | fi | ||
664 | 10289 | } | ||
665 | 10290 | |||
666 | 10291 | |||
667 | 10292 | # func_version | ||
668 | 10293 | # Echo version message to standard output and exit. | ||
669 | 10294 | func_version () | ||
670 | 10295 | { | ||
671 | 10296 | $SED -n '/(C)/!b go | ||
672 | 10297 | :more | ||
673 | 10298 | /\./!{ | ||
674 | 10299 | N | ||
675 | 10300 | s/\n# / / | ||
676 | 10301 | b more | ||
677 | 10302 | } | ||
678 | 10303 | :go | ||
679 | 10304 | /^# '$PROGRAM' (GNU /,/# warranty; / { | ||
680 | 10305 | s/^# // | ||
681 | 10306 | s/^# *$// | ||
682 | 10307 | s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ | ||
683 | 10308 | p | ||
684 | 10309 | }' < "$progpath" | ||
685 | 10310 | exit $? | ||
686 | 10311 | } | ||
687 | 10312 | |||
688 | 10313 | # func_usage | ||
689 | 10314 | # Echo short help message to standard output and exit. | ||
690 | 10315 | func_usage () | ||
691 | 10316 | { | ||
692 | 10317 | $SED -n '/^# Usage:/,/^# *.*--help/ { | ||
693 | 10318 | s/^# // | ||
694 | 10319 | s/^# *$// | ||
695 | 10320 | s/\$progname/'$progname'/ | ||
696 | 10321 | p | ||
697 | 10322 | }' < "$progpath" | ||
698 | 10323 | echo | ||
699 | 10324 | $ECHO "run \`$progname --help | more' for full usage" | ||
700 | 10325 | exit $? | ||
701 | 10326 | } | ||
702 | 10327 | |||
703 | 10328 | # func_help [NOEXIT] | ||
704 | 10329 | # Echo long help message to standard output and exit, | ||
705 | 10330 | # unless 'noexit' is passed as argument. | ||
706 | 10331 | func_help () | ||
707 | 10332 | { | ||
708 | 10333 | $SED -n '/^# Usage:/,/# Report bugs to/ { | ||
709 | 10334 | s/^# // | ||
710 | 10335 | s/^# *$// | ||
711 | 10336 | s*\$progname*'$progname'* | ||
712 | 10337 | s*\$host*'"$host"'* | ||
713 | 10338 | s*\$SHELL*'"$SHELL"'* | ||
714 | 10339 | s*\$LTCC*'"$LTCC"'* | ||
715 | 10340 | s*\$LTCFLAGS*'"$LTCFLAGS"'* | ||
716 | 10341 | s*\$LD*'"$LD"'* | ||
717 | 10342 | s/\$with_gnu_ld/'"$with_gnu_ld"'/ | ||
718 | 10343 | s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ | ||
719 | 10344 | s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ | ||
720 | 10345 | p | ||
721 | 10346 | }' < "$progpath" | ||
722 | 10347 | ret=$? | ||
723 | 10348 | if test -z "$1"; then | ||
724 | 10349 | exit $ret | ||
725 | 10350 | fi | ||
726 | 10351 | } | ||
727 | 10352 | |||
728 | 10353 | # func_missing_arg argname | ||
729 | 10354 | # Echo program name prefixed message to standard error and set global | ||
730 | 10355 | # exit_cmd. | ||
731 | 10356 | func_missing_arg () | ||
732 | 10357 | { | ||
733 | 10358 | func_error "missing argument for $1." | ||
734 | 10359 | exit_cmd=exit | ||
735 | 10360 | } | ||
736 | 10361 | |||
737 | 10362 | exit_cmd=: | ||
738 | 10363 | |||
739 | 10364 | |||
740 | 10365 | |||
741 | 10366 | |||
742 | 10367 | |||
743 | 10368 | |||
744 | 10369 | magic="%%%MAGIC variable%%%" | ||
745 | 10370 | magic_exe="%%%MAGIC EXE variable%%%" | ||
746 | 10371 | |||
747 | 10372 | # Global variables. | ||
748 | 10373 | # $mode is unset | ||
749 | 10374 | nonopt= | ||
750 | 10375 | execute_dlfiles= | ||
751 | 10376 | preserve_args= | ||
752 | 10377 | lo2o="s/\\.lo\$/.${objext}/" | ||
753 | 10378 | o2lo="s/\\.${objext}\$/.lo/" | ||
754 | 10379 | extracted_archives= | ||
755 | 10380 | extracted_serial=0 | ||
756 | 10381 | |||
757 | 10382 | opt_dry_run=false | ||
758 | 10383 | opt_duplicate_deps=false | ||
759 | 10384 | opt_silent=false | ||
760 | 10385 | opt_debug=: | ||
761 | 10386 | |||
762 | 10387 | # If this variable is set in any of the actions, the command in it | ||
763 | 10388 | # will be execed at the end. This prevents here-documents from being | ||
764 | 10389 | # left over by shells. | ||
765 | 10390 | exec_cmd= | ||
766 | 10391 | |||
767 | 10392 | # func_fatal_configuration arg... | ||
768 | 10393 | # Echo program name prefixed message to standard error, followed by | ||
769 | 10394 | # a configuration failure hint, and exit. | ||
770 | 10395 | func_fatal_configuration () | ||
771 | 10396 | { | ||
772 | 10397 | func_error ${1+"$@"} | ||
773 | 10398 | func_error "See the $PACKAGE documentation for more information." | ||
774 | 10399 | func_fatal_error "Fatal configuration error." | ||
775 | 10400 | } | ||
776 | 10401 | |||
777 | 10402 | |||
778 | 10403 | # func_config | ||
779 | 10404 | # Display the configuration for all the tags in this script. | ||
780 | 10405 | func_config () | ||
781 | 10406 | { | ||
782 | 10407 | re_begincf='^# ### BEGIN LIBTOOL' | ||
783 | 10408 | re_endcf='^# ### END LIBTOOL' | ||
784 | 10409 | |||
785 | 10410 | # Default configuration. | ||
786 | 10411 | $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" | ||
787 | 10412 | |||
788 | 10413 | # Now print the configurations for the tags. | ||
789 | 10414 | for tagname in $taglist; do | ||
790 | 10415 | $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" | ||
791 | 10416 | done | ||
792 | 10417 | |||
793 | 10418 | exit $? | ||
794 | 10419 | } | ||
795 | 10420 | |||
796 | 10421 | # func_features | ||
797 | 10422 | # Display the features supported by this script. | ||
798 | 10423 | func_features () | ||
799 | 10424 | { | ||
800 | 10425 | echo "host: $host" | ||
801 | 10426 | if test "$build_libtool_libs" = yes; then | ||
802 | 10427 | echo "enable shared libraries" | ||
803 | 10428 | else | ||
804 | 10429 | echo "disable shared libraries" | ||
805 | 10430 | fi | ||
806 | 10431 | if test "$build_old_libs" = yes; then | ||
807 | 10432 | echo "enable static libraries" | ||
808 | 10433 | else | ||
809 | 10434 | echo "disable static libraries" | ||
810 | 10435 | fi | ||
811 | 10436 | |||
812 | 10437 | exit $? | ||
813 | 10438 | } | ||
814 | 10439 | |||
815 | 10440 | # func_enable_tag tagname | ||
816 | 10441 | # Verify that TAGNAME is valid, and either flag an error and exit, or | ||
817 | 10442 | # enable the TAGNAME tag. We also add TAGNAME to the global $taglist | ||
818 | 10443 | # variable here. | ||
819 | 10444 | func_enable_tag () | ||
820 | 10445 | { | ||
821 | 10446 | # Global variable: | ||
822 | 10447 | tagname="$1" | ||
823 | 10448 | |||
824 | 10449 | re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" | ||
825 | 10450 | re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" | ||
826 | 10451 | sed_extractcf="/$re_begincf/,/$re_endcf/p" | ||
827 | 10452 | |||
828 | 10453 | # Validate tagname. | ||
829 | 10454 | case $tagname in | ||
830 | 10455 | *[!-_A-Za-z0-9,/]*) | ||
831 | 10456 | func_fatal_error "invalid tag name: $tagname" | ||
832 | 10457 | ;; | ||
833 | 10458 | esac | ||
834 | 10459 | |||
835 | 10460 | # Don't test for the "default" C tag, as we know it's | ||
836 | 10461 | # there but not specially marked. | ||
837 | 10462 | case $tagname in | ||
838 | 10463 | CC) ;; | ||
839 | 10464 | *) | ||
840 | 10465 | if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then | ||
841 | 10466 | taglist="$taglist $tagname" | ||
842 | 10467 | |||
843 | 10468 | # Evaluate the configuration. Be careful to quote the path | ||
844 | 10469 | # and the sed script, to avoid splitting on whitespace, but | ||
845 | 10470 | # also don't use non-portable quotes within backquotes within | ||
846 | 10471 | # quotes we have to do it in 2 steps: | ||
847 | 10472 | extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` | ||
848 | 10473 | eval "$extractedcf" | ||
849 | 10474 | else | ||
850 | 10475 | func_error "ignoring unknown tag $tagname" | ||
851 | 10476 | fi | ||
852 | 10477 | ;; | ||
853 | 10478 | esac | ||
854 | 10479 | } | ||
855 | 10480 | |||
856 | 10481 | # Parse options once, thoroughly. This comes as soon as possible in | ||
857 | 10482 | # the script to make things like `libtool --version' happen quickly. | ||
858 | 10483 | { | ||
859 | 10484 | |||
860 | 10485 | # Shorthand for --mode=foo, only valid as the first argument | ||
861 | 10486 | case $1 in | ||
862 | 10487 | clean|clea|cle|cl) | ||
863 | 10488 | shift; set dummy --mode clean ${1+"$@"}; shift | ||
864 | 10489 | ;; | ||
865 | 10490 | compile|compil|compi|comp|com|co|c) | ||
866 | 10491 | shift; set dummy --mode compile ${1+"$@"}; shift | ||
867 | 10492 | ;; | ||
868 | 10493 | execute|execut|execu|exec|exe|ex|e) | ||
869 | 10494 | shift; set dummy --mode execute ${1+"$@"}; shift | ||
870 | 10495 | ;; | ||
871 | 10496 | finish|finis|fini|fin|fi|f) | ||
872 | 10497 | shift; set dummy --mode finish ${1+"$@"}; shift | ||
873 | 10498 | ;; | ||
874 | 10499 | install|instal|insta|inst|ins|in|i) | ||
875 | 10500 | shift; set dummy --mode install ${1+"$@"}; shift | ||
876 | 10501 | ;; | ||
877 | 10502 | link|lin|li|l) | ||
878 | 10503 | shift; set dummy --mode link ${1+"$@"}; shift | ||
879 | 10504 | ;; | ||
880 | 10505 | uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) | ||
881 | 10506 | shift; set dummy --mode uninstall ${1+"$@"}; shift | ||
882 | 10507 | ;; | ||
883 | 10508 | esac | ||
884 | 10509 | |||
885 | 10510 | # Parse non-mode specific arguments: | ||
886 | 10511 | while test "$#" -gt 0; do | ||
887 | 10512 | opt="$1" | ||
888 | 10513 | shift | ||
889 | 10514 | |||
890 | 10515 | case $opt in | ||
891 | 10516 | --config) func_config ;; | ||
892 | 10517 | |||
893 | 10518 | --debug) preserve_args="$preserve_args $opt" | ||
894 | 10519 | func_echo "enabling shell trace mode" | ||
895 | 10520 | opt_debug='set -x' | ||
896 | 10521 | $opt_debug | ||
897 | 10522 | ;; | ||
898 | 10523 | |||
899 | 10524 | -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break | ||
900 | 10525 | execute_dlfiles="$execute_dlfiles $1" | ||
901 | 10526 | shift | ||
902 | 10527 | ;; | ||
903 | 10528 | |||
904 | 10529 | --dry-run | -n) opt_dry_run=: ;; | ||
905 | 10530 | --features) func_features ;; | ||
906 | 10531 | --finish) mode="finish" ;; | ||
907 | 10532 | |||
908 | 10533 | --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break | ||
909 | 10534 | case $1 in | ||
910 | 10535 | # Valid mode arguments: | ||
911 | 10536 | clean) ;; | ||
912 | 10537 | compile) ;; | ||
913 | 10538 | execute) ;; | ||
914 | 10539 | finish) ;; | ||
915 | 10540 | install) ;; | ||
916 | 10541 | link) ;; | ||
917 | 10542 | relink) ;; | ||
918 | 10543 | uninstall) ;; | ||
919 | 10544 | |||
920 | 10545 | # Catch anything else as an error | ||
921 | 10546 | *) func_error "invalid argument for $opt" | ||
922 | 10547 | exit_cmd=exit | ||
923 | 10548 | break | ||
924 | 10549 | ;; | ||
925 | 10550 | esac | ||
926 | 10551 | |||
927 | 10552 | mode="$1" | ||
928 | 10553 | shift | ||
929 | 10554 | ;; | ||
930 | 10555 | |||
931 | 10556 | --preserve-dup-deps) | ||
932 | 10557 | opt_duplicate_deps=: ;; | ||
933 | 10558 | |||
934 | 10559 | --quiet|--silent) preserve_args="$preserve_args $opt" | ||
935 | 10560 | opt_silent=: | ||
936 | 10561 | opt_verbose=false | ||
937 | 10562 | ;; | ||
938 | 10563 | |||
939 | 10564 | --no-quiet|--no-silent) | ||
940 | 10565 | preserve_args="$preserve_args $opt" | ||
941 | 10566 | opt_silent=false | ||
942 | 10567 | ;; | ||
943 | 10568 | |||
944 | 10569 | --verbose| -v) preserve_args="$preserve_args $opt" | ||
945 | 10570 | opt_silent=false | ||
946 | 10571 | opt_verbose=: | ||
947 | 10572 | ;; | ||
948 | 10573 | |||
949 | 10574 | --no-verbose) preserve_args="$preserve_args $opt" | ||
950 | 10575 | opt_verbose=false | ||
951 | 10576 | ;; | ||
952 | 10577 | |||
953 | 10578 | --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break | ||
954 | 10579 | preserve_args="$preserve_args $opt $1" | ||
955 | 10580 | func_enable_tag "$1" # tagname is set here | ||
956 | 10581 | shift | ||
957 | 10582 | ;; | ||
958 | 10583 | |||
959 | 10584 | # Separate optargs to long options: | ||
960 | 10585 | -dlopen=*|--mode=*|--tag=*) | ||
961 | 10586 | func_opt_split "$opt" | ||
962 | 10587 | set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} | ||
963 | 10588 | shift | ||
964 | 10589 | ;; | ||
965 | 10590 | |||
966 | 10591 | -\?|-h) func_usage ;; | ||
967 | 10592 | --help) opt_help=: ;; | ||
968 | 10593 | --help-all) opt_help=': help-all' ;; | ||
969 | 10594 | --version) func_version ;; | ||
970 | 10595 | |||
971 | 10596 | -*) func_fatal_help "unrecognized option \`$opt'" ;; | ||
972 | 10597 | |||
973 | 10598 | *) nonopt="$opt" | ||
974 | 10599 | break | ||
975 | 10600 | ;; | ||
976 | 10601 | esac | ||
977 | 10602 | done | ||
978 | 10603 | |||
979 | 10604 | |||
980 | 10605 | case $host in | ||
981 | 10606 | *cygwin* | *mingw* | *pw32* | *cegcc*) | ||
982 | 10607 | # don't eliminate duplications in $postdeps and $predeps | ||
983 | 10608 | opt_duplicate_compiler_generated_deps=: | ||
984 | 10609 | ;; | ||
985 | 10610 | *) | ||
986 | 10611 | opt_duplicate_compiler_generated_deps=$opt_duplicate_deps | ||
987 | 10612 | ;; | ||
988 | 10613 | esac | ||
989 | 10614 | |||
990 | 10615 | # Having warned about all mis-specified options, bail out if | ||
991 | 10616 | # anything was wrong. | ||
992 | 10617 | $exit_cmd $EXIT_FAILURE | ||
993 | 10618 | } | ||
994 | 10619 | |||
995 | 10620 | # func_check_version_match | ||
996 | 10621 | # Ensure that we are using m4 macros, and libtool script from the same | ||
997 | 10622 | # release of libtool. | ||
998 | 10623 | func_check_version_match () | ||
999 | 10624 | { | ||
1000 | 10625 | if test "$package_revision" != "$macro_revision"; then | ||
1001 | 10626 | if test "$VERSION" != "$macro_version"; then | ||
1002 | 10627 | if test -z "$macro_version"; then | ||
1003 | 10628 | cat >&2 <<_LT_EOF | ||
1004 | 10629 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the | ||
1005 | 10630 | $progname: definition of this LT_INIT comes from an older release. | ||
1006 | 10631 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION | ||
1007 | 10632 | $progname: and run autoconf again. | ||
1008 | 10633 | _LT_EOF | ||
1009 | 10634 | else | ||
1010 | 10635 | cat >&2 <<_LT_EOF | ||
1011 | 10636 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the | ||
1012 | 10637 | $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. | ||
1013 | 10638 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION | ||
1014 | 10639 | $progname: and run autoconf again. | ||
1015 | 10640 | _LT_EOF | ||
1016 | 10641 | fi | ||
1017 | 10642 | else | ||
1018 | 10643 | cat >&2 <<_LT_EOF | ||
1019 | 10644 | $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, | ||
1020 | 10645 | $progname: but the definition of this LT_INIT comes from revision $macro_revision. | ||
1021 | 10646 | $progname: You should recreate aclocal.m4 with macros from revision $package_revision | ||
1022 | 10647 | $progname: of $PACKAGE $VERSION and run autoconf again. | ||
1023 | 10648 | _LT_EOF | ||
1024 | 10649 | fi | ||
1025 | 10650 | |||
1026 | 10651 | exit $EXIT_MISMATCH | ||
1027 | 10652 | fi | ||
1028 | 10653 | } | ||
1029 | 10654 | |||
1030 | 10655 | |||
1031 | 10656 | ## ----------- ## | ||
1032 | 10657 | ## Main. ## | ||
1033 | 10658 | ## ----------- ## | ||
1034 | 10659 | |||
1035 | 10660 | $opt_help || { | ||
1036 | 10661 | # Sanity checks first: | ||
1037 | 10662 | func_check_version_match | ||
1038 | 10663 | |||
1039 | 10664 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then | ||
1040 | 10665 | func_fatal_configuration "not configured to build any kind of library" | ||
1041 | 10666 | fi | ||
1042 | 10667 | |||
1043 | 10668 | test -z "$mode" && func_fatal_error "error: you must specify a MODE." | ||
1044 | 10669 | |||
1045 | 10670 | |||
1046 | 10671 | # Darwin sucks | ||
1047 | 10672 | eval std_shrext=\"$shrext_cmds\" | ||
1048 | 10673 | |||
1049 | 10674 | |||
1050 | 10675 | # Only execute mode is allowed to have -dlopen flags. | ||
1051 | 10676 | if test -n "$execute_dlfiles" && test "$mode" != execute; then | ||
1052 | 10677 | func_error "unrecognized option \`-dlopen'" | ||
1053 | 10678 | $ECHO "$help" 1>&2 | ||
1054 | 10679 | exit $EXIT_FAILURE | ||
1055 | 10680 | fi | ||
1056 | 10681 | |||
1057 | 10682 | # Change the help message to a mode-specific one. | ||
1058 | 10683 | generic_help="$help" | ||
1059 | 10684 | help="Try \`$progname --help --mode=$mode' for more information." | ||
1060 | 10685 | } | ||
1061 | 10686 | |||
1062 | 10687 | |||
1063 | 10688 | # func_lalib_p file | ||
1064 | 10689 | # True iff FILE is a libtool `.la' library or `.lo' object file. | ||
1065 | 10690 | # This function is only a basic sanity check; it will hardly flush out | ||
1066 | 10691 | # determined imposters. | ||
1067 | 10692 | func_lalib_p () | ||
1068 | 10693 | { | ||
1069 | 10694 | test -f "$1" && | ||
1070 | 10695 | $SED -e 4q "$1" 2>/dev/null \ | ||
1071 | 10696 | | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 | ||
1072 | 10697 | } | ||
1073 | 10698 | |||
1074 | 10699 | # func_lalib_unsafe_p file | ||
1075 | 10700 | # True iff FILE is a libtool `.la' library or `.lo' object file. | ||
1076 | 10701 | # This function implements the same check as func_lalib_p without | ||
1077 | 10702 | # resorting to external programs. To this end, it redirects stdin and | ||
1078 | 10703 | # closes it afterwards, without saving the original file descriptor. | ||
1079 | 10704 | # As a safety measure, use it only where a negative result would be | ||
1080 | 10705 | # fatal anyway. Works if `file' does not exist. | ||
1081 | 10706 | func_lalib_unsafe_p () | ||
1082 | 10707 | { | ||
1083 | 10708 | lalib_p=no | ||
1084 | 10709 | if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then | ||
1085 | 10710 | for lalib_p_l in 1 2 3 4 | ||
1086 | 10711 | do | ||
1087 | 10712 | read lalib_p_line | ||
1088 | 10713 | case "$lalib_p_line" in | ||
1089 | 10714 | \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; | ||
1090 | 10715 | esac | ||
1091 | 10716 | done | ||
1092 | 10717 | exec 0<&5 5<&- | ||
1093 | 10718 | fi | ||
1094 | 10719 | test "$lalib_p" = yes | ||
1095 | 10720 | } | ||
1096 | 10721 | |||
1097 | 10722 | # func_ltwrapper_script_p file | ||
1098 | 10723 | # True iff FILE is a libtool wrapper script | ||
1099 | 10724 | # This function is only a basic sanity check; it will hardly flush out | ||
1100 | 10725 | # determined imposters. | ||
1101 | 10726 | func_ltwrapper_script_p () | ||
1102 | 10727 | { | ||
1103 | 10728 | func_lalib_p "$1" | ||
1104 | 10729 | } | ||
1105 | 10730 | |||
1106 | 10731 | # func_ltwrapper_executable_p file | ||
1107 | 10732 | # True iff FILE is a libtool wrapper executable | ||
1108 | 10733 | # This function is only a basic sanity check; it will hardly flush out | ||
1109 | 10734 | # determined imposters. | ||
1110 | 10735 | func_ltwrapper_executable_p () | ||
1111 | 10736 | { | ||
1112 | 10737 | func_ltwrapper_exec_suffix= | ||
1113 | 10738 | case $1 in | ||
1114 | 10739 | *.exe) ;; | ||
1115 | 10740 | *) func_ltwrapper_exec_suffix=.exe ;; | ||
1116 | 10741 | esac | ||
1117 | 10742 | $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 | ||
1118 | 10743 | } | ||
1119 | 10744 | |||
1120 | 10745 | # func_ltwrapper_scriptname file | ||
1121 | 10746 | # Assumes file is an ltwrapper_executable | ||
1122 | 10747 | # uses $file to determine the appropriate filename for a | ||
1123 | 10748 | # temporary ltwrapper_script. | ||
1124 | 10749 | func_ltwrapper_scriptname () | ||
1125 | 10750 | { | ||
1126 | 10751 | func_ltwrapper_scriptname_result="" | ||
1127 | 10752 | if func_ltwrapper_executable_p "$1"; then | ||
1128 | 10753 | func_dirname_and_basename "$1" "" "." | ||
1129 | 10754 | func_stripname '' '.exe' "$func_basename_result" | ||
1130 | 10755 | func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" | ||
1131 | 10756 | fi | ||
1132 | 10757 | } | ||
1133 | 10758 | |||
1134 | 10759 | # func_ltwrapper_p file | ||
1135 | 10760 | # True iff FILE is a libtool wrapper script or wrapper executable | ||
1136 | 10761 | # This function is only a basic sanity check; it will hardly flush out | ||
1137 | 10762 | # determined imposters. | ||
1138 | 10763 | func_ltwrapper_p () | ||
1139 | 10764 | { | ||
1140 | 10765 | func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" | ||
1141 | 10766 | } | ||
1142 | 10767 | |||
1143 | 10768 | |||
1144 | 10769 | # func_execute_cmds commands fail_cmd | ||
1145 | 10770 | # Execute tilde-delimited COMMANDS. | ||
1146 | 10771 | # If FAIL_CMD is given, eval that upon failure. | ||
1147 | 10772 | # FAIL_CMD may read-access the current command in variable CMD! | ||
1148 | 10773 | func_execute_cmds () | ||
1149 | 10774 | { | ||
1150 | 10775 | $opt_debug | ||
1151 | 10776 | save_ifs=$IFS; IFS='~' | ||
1152 | 10777 | for cmd in $1; do | ||
1153 | 10778 | IFS=$save_ifs | ||
1154 | 10779 | eval cmd=\"$cmd\" | ||
1155 | 10780 | func_show_eval "$cmd" "${2-:}" | ||
1156 | 10781 | done | ||
1157 | 10782 | IFS=$save_ifs | ||
1158 | 10783 | } | ||
1159 | 10784 | |||
1160 | 10785 | |||
1161 | 10786 | # func_source file | ||
1162 | 10787 | # Source FILE, adding directory component if necessary. | ||
1163 | 10788 | # Note that it is not necessary on cygwin/mingw to append a dot to | ||
1164 | 10789 | # FILE even if both FILE and FILE.exe exist: automatic-append-.exe | ||
1165 | 10790 | # behavior happens only for exec(3), not for open(2)! Also, sourcing | ||
1166 | 10791 | # `FILE.' does not work on cygwin managed mounts. | ||
1167 | 10792 | func_source () | ||
1168 | 10793 | { | ||
1169 | 10794 | $opt_debug | ||
1170 | 10795 | case $1 in | ||
1171 | 10796 | */* | *\\*) . "$1" ;; | ||
1172 | 10797 | *) . "./$1" ;; | ||
1173 | 10798 | esac | ||
1174 | 10799 | } | ||
1175 | 10800 | |||
1176 | 10801 | |||
1177 | 10802 | # func_infer_tag arg | ||
1178 | 10803 | # Infer tagged configuration to use if any are available and | ||
1179 | 10804 | # if one wasn't chosen via the "--tag" command line option. | ||
1180 | 10805 | # Only attempt this if the compiler in the base compile | ||
1181 | 10806 | # command doesn't match the default compiler. | ||
1182 | 10807 | # arg is usually of the form 'gcc ...' | ||
1183 | 10808 | func_infer_tag () | ||
1184 | 10809 | { | ||
1185 | 10810 | $opt_debug | ||
1186 | 10811 | if test -n "$available_tags" && test -z "$tagname"; then | ||
1187 | 10812 | CC_quoted= | ||
1188 | 10813 | for arg in $CC; do | ||
1189 | 10814 | func_quote_for_eval "$arg" | ||
1190 | 10815 | CC_quoted="$CC_quoted $func_quote_for_eval_result" | ||
1191 | 10816 | done | ||
1192 | 10817 | CC_expanded=`func_echo_all $CC` | ||
1193 | 10818 | CC_quoted_expanded=`func_echo_all $CC_quoted` | ||
1194 | 10819 | case $@ in | ||
1195 | 10820 | # Blanks in the command may have been stripped by the calling shell, | ||
1196 | 10821 | # but not from the CC environment variable when configure was run. | ||
1197 | 10822 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ | ||
1198 | 10823 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; | ||
1199 | 10824 | # Blanks at the start of $base_compile will cause this to fail | ||
1200 | 10825 | # if we don't check for them as well. | ||
1201 | 10826 | *) | ||
1202 | 10827 | for z in $available_tags; do | ||
1203 | 10828 | if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then | ||
1204 | 10829 | # Evaluate the configuration. | ||
1205 | 10830 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" | ||
1206 | 10831 | CC_quoted= | ||
1207 | 10832 | for arg in $CC; do | ||
1208 | 10833 | # Double-quote args containing other shell metacharacters. | ||
1209 | 10834 | func_quote_for_eval "$arg" | ||
1210 | 10835 | CC_quoted="$CC_quoted $func_quote_for_eval_result" | ||
1211 | 10836 | done | ||
1212 | 10837 | CC_expanded=`func_echo_all $CC` | ||
1213 | 10838 | CC_quoted_expanded=`func_echo_all $CC_quoted` | ||
1214 | 10839 | case "$@ " in | ||
1215 | 10840 | " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ | ||
1216 | 10841 | " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) | ||
1217 | 10842 | # The compiler in the base compile command matches | ||
1218 | 10843 | # the one in the tagged configuration. | ||
1219 | 10844 | # Assume this is the tagged configuration we want. | ||
1220 | 10845 | tagname=$z | ||
1221 | 10846 | break | ||
1222 | 10847 | ;; | ||
1223 | 10848 | esac | ||
1224 | 10849 | fi | ||
1225 | 10850 | done | ||
1226 | 10851 | # If $tagname still isn't set, then no tagged configuration | ||
1227 | 10852 | # was found and let the user know that the "--tag" command | ||
1228 | 10853 | # line option must be used. | ||
1229 | 10854 | if test -z "$tagname"; then | ||
1230 | 10855 | func_echo "unable to infer tagged configuration" | ||
1231 | 10856 | func_fatal_error "specify a tag with \`--tag'" | ||
1232 | 10857 | # else | ||
1233 | 10858 | # func_verbose "using $tagname tagged configuration" | ||
1234 | 10859 | fi | ||
1235 | 10860 | ;; | ||
1236 | 10861 | esac | ||
1237 | 10862 | fi | ||
1238 | 10863 | } | ||
1239 | 10864 | |||
1240 | 10865 | |||
1241 | 10866 | |||
1242 | 10867 | # func_write_libtool_object output_name pic_name nonpic_name | ||
1243 | 10868 | # Create a libtool object file (analogous to a ".la" file), | ||
1244 | 10869 | # but don't create it if we're doing a dry run. | ||
1245 | 10870 | func_write_libtool_object () | ||
1246 | 10871 | { | ||
1247 | 10872 | write_libobj=${1} | ||
1248 | 10873 | if test "$build_libtool_libs" = yes; then | ||
1249 | 10874 | write_lobj=\'${2}\' | ||
1250 | 10875 | else | ||
1251 | 10876 | write_lobj=none | ||
1252 | 10877 | fi | ||
1253 | 10878 | |||
1254 | 10879 | if test "$build_old_libs" = yes; then | ||
1255 | 10880 | write_oldobj=\'${3}\' | ||
1256 | 10881 | else | ||
1257 | 10882 | write_oldobj=none | ||
1258 | 10883 | fi | ||
1259 | 10884 | |||
1260 | 10885 | $opt_dry_run || { | ||
1261 | 10886 | cat >${write_libobj}T <<EOF | ||
1262 | 10887 | # $write_libobj - a libtool object file | ||
1263 | 10888 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION | ||
1264 | 10889 | # | ||
1265 | 10890 | # Please DO NOT delete this file! | ||
1266 | 10891 | # It is necessary for linking the library. | ||
1267 | 10892 | |||
1268 | 10893 | # Name of the PIC object. | ||
1269 | 10894 | pic_object=$write_lobj | ||
1270 | 10895 | |||
1271 | 10896 | # Name of the non-PIC object | ||
1272 | 10897 | non_pic_object=$write_oldobj | ||
1273 | 10898 | |||
1274 | 10899 | EOF | ||
1275 | 10900 | $MV "${write_libobj}T" "${write_libobj}" | ||
1276 | 10901 | } | ||
1277 | 10902 | } | ||
1278 | 10903 | |||
1279 | 10904 | # func_mode_compile arg... | ||
1280 | 10905 | func_mode_compile () | ||
1281 | 10906 | { | ||
1282 | 10907 | $opt_debug | ||
1283 | 10908 | # Get the compilation command and the source file. | ||
1284 | 10909 | base_compile= | ||
1285 | 10910 | srcfile="$nonopt" # always keep a non-empty value in "srcfile" | ||
1286 | 10911 | suppress_opt=yes | ||
1287 | 10912 | suppress_output= | ||
1288 | 10913 | arg_mode=normal | ||
1289 | 10914 | libobj= | ||
1290 | 10915 | later= | ||
1291 | 10916 | pie_flag= | ||
1292 | 10917 | |||
1293 | 10918 | for arg | ||
1294 | 10919 | do | ||
1295 | 10920 | case $arg_mode in | ||
1296 | 10921 | arg ) | ||
1297 | 10922 | # do not "continue". Instead, add this to base_compile | ||
1298 | 10923 | lastarg="$arg" | ||
1299 | 10924 | arg_mode=normal | ||
1300 | 10925 | ;; | ||
1301 | 10926 | |||
1302 | 10927 | target ) | ||
1303 | 10928 | libobj="$arg" | ||
1304 | 10929 | arg_mode=normal | ||
1305 | 10930 | continue | ||
1306 | 10931 | ;; | ||
1307 | 10932 | |||
1308 | 10933 | normal ) | ||
1309 | 10934 | # Accept any command-line options. | ||
1310 | 10935 | case $arg in | ||
1311 | 10936 | -o) | ||
1312 | 10937 | test -n "$libobj" && \ | ||
1313 | 10938 | func_fatal_error "you cannot specify \`-o' more than once" | ||
1314 | 10939 | arg_mode=target | ||
1315 | 10940 | continue | ||
1316 | 10941 | ;; | ||
1317 | 10942 | |||
1318 | 10943 | -pie | -fpie | -fPIE) | ||
1319 | 10944 | pie_flag="$pie_flag $arg" | ||
1320 | 10945 | continue | ||
1321 | 10946 | ;; | ||
1322 | 10947 | |||
1323 | 10948 | -shared | -static | -prefer-pic | -prefer-non-pic) | ||
1324 | 10949 | later="$later $arg" | ||
1325 | 10950 | continue | ||
1326 | 10951 | ;; | ||
1327 | 10952 | |||
1328 | 10953 | -no-suppress) | ||
1329 | 10954 | suppress_opt=no | ||
1330 | 10955 | continue | ||
1331 | 10956 | ;; | ||
1332 | 10957 | |||
1333 | 10958 | -Xcompiler) | ||
1334 | 10959 | arg_mode=arg # the next one goes into the "base_compile" arg list | ||
1335 | 10960 | continue # The current "srcfile" will either be retained or | ||
1336 | 10961 | ;; # replaced later. I would guess that would be a bug. | ||
1337 | 10962 | |||
1338 | 10963 | -Wc,*) | ||
1339 | 10964 | func_stripname '-Wc,' '' "$arg" | ||
1340 | 10965 | args=$func_stripname_result | ||
1341 | 10966 | lastarg= | ||
1342 | 10967 | save_ifs="$IFS"; IFS=',' | ||
1343 | 10968 | for arg in $args; do | ||
1344 | 10969 | IFS="$save_ifs" | ||
1345 | 10970 | func_quote_for_eval "$arg" | ||
1346 | 10971 | lastarg="$lastarg $func_quote_for_eval_result" | ||
1347 | 10972 | done | ||
1348 | 10973 | IFS="$save_ifs" | ||
1349 | 10974 | func_stripname ' ' '' "$lastarg" | ||
1350 | 10975 | lastarg=$func_stripname_result | ||
1351 | 10976 | |||
1352 | 10977 | # Add the arguments to base_compile. | ||
1353 | 10978 | base_compile="$base_compile $lastarg" | ||
1354 | 10979 | continue | ||
1355 | 10980 | ;; | ||
1356 | 10981 | |||
1357 | 10982 | *) | ||
1358 | 10983 | # Accept the current argument as the source file. | ||
1359 | 10984 | # The previous "srcfile" becomes the current argument. | ||
1360 | 10985 | # | ||
1361 | 10986 | lastarg="$srcfile" | ||
1362 | 10987 | srcfile="$arg" | ||
1363 | 10988 | ;; | ||
1364 | 10989 | esac # case $arg | ||
1365 | 10990 | ;; | ||
1366 | 10991 | esac # case $arg_mode | ||
1367 | 10992 | |||
1368 | 10993 | # Aesthetically quote the previous argument. | ||
1369 | 10994 | func_quote_for_eval "$lastarg" | ||
1370 | 10995 | base_compile="$base_compile $func_quote_for_eval_result" | ||
1371 | 10996 | done # for arg | ||
1372 | 10997 | |||
1373 | 10998 | case $arg_mode in | ||
1374 | 10999 | arg) | ||
1375 | 11000 | func_fatal_error "you must specify an argument for -Xcompile" | ||
1376 | 11001 | ;; | ||
1377 | 11002 | target) | ||
1378 | 11003 | func_fatal_error "you must specify a target with \`-o'" | ||
1379 | 11004 | ;; | ||
1380 | 11005 | *) | ||
1381 | 11006 | # Get the name of the library object. | ||
1382 | 11007 | test -z "$libobj" && { | ||
1383 | 11008 | func_basename "$srcfile" | ||
1384 | 11009 | libobj="$func_basename_result" | ||
1385 | 11010 | } | ||
1386 | 11011 | ;; | ||
1387 | 11012 | esac | ||
1388 | 11013 | |||
1389 | 11014 | # Recognize several different file suffixes. | ||
1390 | 11015 | # If the user specifies -o file.o, it is replaced with file.lo | ||
1391 | 11016 | case $libobj in | ||
1392 | 11017 | *.[cCFSifmso] | \ | ||
1393 | 11018 | *.ada | *.adb | *.ads | *.asm | \ | ||
1394 | 11019 | *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ | ||
1395 | 11020 | *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) | ||
1396 | 11021 | func_xform "$libobj" | ||
1397 | 11022 | libobj=$func_xform_result | ||
1398 | 11023 | ;; | ||
1399 | 11024 | esac | ||
1400 | 11025 | |||
1401 | 11026 | case $libobj in | ||
1402 | 11027 | *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; | ||
1403 | 11028 | *) | ||
1404 | 11029 | func_fatal_error "cannot determine name of library object from \`$libobj'" | ||
1405 | 11030 | ;; | ||
1406 | 11031 | esac | ||
1407 | 11032 | |||
1408 | 11033 | func_infer_tag $base_compile | ||
1409 | 11034 | |||
1410 | 11035 | for arg in $later; do | ||
1411 | 11036 | case $arg in | ||
1412 | 11037 | -shared) | ||
1413 | 11038 | test "$build_libtool_libs" != yes && \ | ||
1414 | 11039 | func_fatal_configuration "can not build a shared library" | ||
1415 | 11040 | build_old_libs=no | ||
1416 | 11041 | continue | ||
1417 | 11042 | ;; | ||
1418 | 11043 | |||
1419 | 11044 | -static) | ||
1420 | 11045 | build_libtool_libs=no | ||
1421 | 11046 | build_old_libs=yes | ||
1422 | 11047 | continue | ||
1423 | 11048 | ;; | ||
1424 | 11049 | |||
1425 | 11050 | -prefer-pic) | ||
1426 | 11051 | pic_mode=yes | ||
1427 | 11052 | continue | ||
1428 | 11053 | ;; | ||
1429 | 11054 | |||
1430 | 11055 | -prefer-non-pic) | ||
1431 | 11056 | pic_mode=no | ||
1432 | 11057 | continue | ||
1433 | 11058 | ;; | ||
1434 | 11059 | esac | ||
1435 | 11060 | done | ||
1436 | 11061 | |||
1437 | 11062 | func_quote_for_eval "$libobj" | ||
1438 | 11063 | test "X$libobj" != "X$func_quote_for_eval_result" \ | ||
1439 | 11064 | && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ | ||
1440 | 11065 | && func_warning "libobj name \`$libobj' may not contain shell special characters." | ||
1441 | 11066 | func_dirname_and_basename "$obj" "/" "" | ||
1442 | 11067 | objname="$func_basename_result" | ||
1443 | 11068 | xdir="$func_dirname_result" | ||
1444 | 11069 | lobj=${xdir}$objdir/$objname | ||
1445 | 11070 | |||
1446 | 11071 | test -z "$base_compile" && \ | ||
1447 | 11072 | func_fatal_help "you must specify a compilation command" | ||
1448 | 11073 | |||
1449 | 11074 | # Delete any leftover library objects. | ||
1450 | 11075 | if test "$build_old_libs" = yes; then | ||
1451 | 11076 | removelist="$obj $lobj $libobj ${libobj}T" | ||
1452 | 11077 | else | ||
1453 | 11078 | removelist="$lobj $libobj ${libobj}T" | ||
1454 | 11079 | fi | ||
1455 | 11080 | |||
1456 | 11081 | # On Cygwin there's no "real" PIC flag so we must build both object types | ||
1457 | 11082 | case $host_os in | ||
1458 | 11083 | cygwin* | mingw* | pw32* | os2* | cegcc*) | ||
1459 | 11084 | pic_mode=default | ||
1460 | 11085 | ;; | ||
1461 | 11086 | esac | ||
1462 | 11087 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then | ||
1463 | 11088 | # non-PIC code in shared libraries is not supported | ||
1464 | 11089 | pic_mode=default | ||
1465 | 11090 | fi | ||
1466 | 11091 | |||
1467 | 11092 | # Calculate the filename of the output object if compiler does | ||
1468 | 11093 | # not support -o with -c | ||
1469 | 11094 | if test "$compiler_c_o" = no; then | ||
1470 | 11095 | output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} | ||
1471 | 11096 | lockfile="$output_obj.lock" | ||
1472 | 11097 | else | ||
1473 | 11098 | output_obj= | ||
1474 | 11099 | need_locks=no | ||
1475 | 11100 | lockfile= | ||
1476 | 11101 | fi | ||
1477 | 11102 | |||
1478 | 11103 | # Lock this critical section if it is needed | ||
1479 | 11104 | # We use this script file to make the link, it avoids creating a new file | ||
1480 | 11105 | if test "$need_locks" = yes; then | ||
1481 | 11106 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do | ||
1482 | 11107 | func_echo "Waiting for $lockfile to be removed" | ||
1483 | 11108 | sleep 2 | ||
1484 | 11109 | done | ||
1485 | 11110 | elif test "$need_locks" = warn; then | ||
1486 | 11111 | if test -f "$lockfile"; then | ||
1487 | 11112 | $ECHO "\ | ||
1488 | 11113 | *** ERROR, $lockfile exists and contains: | ||
1489 | 11114 | `cat $lockfile 2>/dev/null` | ||
1490 | 11115 | |||
1491 | 11116 | This indicates that another process is trying to use the same | ||
1492 | 11117 | temporary object file, and libtool could not work around it because | ||
1493 | 11118 | your compiler does not support \`-c' and \`-o' together. If you | ||
1494 | 11119 | repeat this compilation, it may succeed, by chance, but you had better | ||
1495 | 11120 | avoid parallel builds (make -j) in this platform, or get a better | ||
1496 | 11121 | compiler." | ||
1497 | 11122 | |||
1498 | 11123 | $opt_dry_run || $RM $removelist | ||
1499 | 11124 | exit $EXIT_FAILURE | ||
1500 | 11125 | fi | ||
1501 | 11126 | removelist="$removelist $output_obj" | ||
1502 | 11127 | $ECHO "$srcfile" > "$lockfile" | ||
1503 | 11128 | fi | ||
1504 | 11129 | |||
1505 | 11130 | $opt_dry_run || $RM $removelist | ||
1506 | 11131 | removelist="$removelist $lockfile" | ||
1507 | 11132 | trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 | ||
1508 | 11133 | |||
1509 | 11134 | if test -n "$fix_srcfile_path"; then | ||
1510 | 11135 | eval srcfile=\"$fix_srcfile_path\" | ||
1511 | 11136 | fi | ||
1512 | 11137 | func_quote_for_eval "$srcfile" | ||
1513 | 11138 | qsrcfile=$func_quote_for_eval_result | ||
1514 | 11139 | |||
1515 | 11140 | # Only build a PIC object if we are building libtool libraries. | ||
1516 | 11141 | if test "$build_libtool_libs" = yes; then | ||
1517 | 11142 | # Without this assignment, base_compile gets emptied. | ||
1518 | 11143 | fbsd_hideous_sh_bug=$base_compile | ||
1519 | 11144 | |||
1520 | 11145 | if test "$pic_mode" != no; then | ||
1521 | 11146 | command="$base_compile $qsrcfile $pic_flag" | ||
1522 | 11147 | else | ||
1523 | 11148 | # Don't build PIC code | ||
1524 | 11149 | command="$base_compile $qsrcfile" | ||
1525 | 11150 | fi | ||
1526 | 11151 | |||
1527 | 11152 | func_mkdir_p "$xdir$objdir" | ||
1528 | 11153 | |||
1529 | 11154 | if test -z "$output_obj"; then | ||
1530 | 11155 | # Place PIC objects in $objdir | ||
1531 | 11156 | command="$command -o $lobj" | ||
1532 | 11157 | fi | ||
1533 | 11158 | |||
1534 | 11159 | func_show_eval_locale "$command" \ | ||
1535 | 11160 | 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' | ||
1536 | 11161 | |||
1537 | 11162 | if test "$need_locks" = warn && | ||
1538 | 11163 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then | ||
1539 | 11164 | $ECHO "\ | ||
1540 | 11165 | *** ERROR, $lockfile contains: | ||
1541 | 11166 | `cat $lockfile 2>/dev/null` | ||
1542 | 11167 | |||
1543 | 11168 | but it should contain: | ||
1544 | 11169 | $srcfile | ||
1545 | 11170 | |||
1546 | 11171 | This indicates that another process is trying to use the same | ||
1547 | 11172 | temporary object file, and libtool could not work around it because | ||
1548 | 11173 | your compiler does not support \`-c' and \`-o' together. If you | ||
1549 | 11174 | repeat this compilation, it may succeed, by chance, but you had better | ||
1550 | 11175 | avoid parallel builds (make -j) in this platform, or get a better | ||
1551 | 11176 | compiler." | ||
1552 | 11177 | |||
1553 | 11178 | $opt_dry_run || $RM $removelist | ||
1554 | 11179 | exit $EXIT_FAILURE | ||
1555 | 11180 | fi | ||
1556 | 11181 | |||
1557 | 11182 | # Just move the object if needed, then go on to compile the next one | ||
1558 | 11183 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then | ||
1559 | 11184 | func_show_eval '$MV "$output_obj" "$lobj"' \ | ||
1560 | 11185 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' | ||
1561 | 11186 | fi | ||
1562 | 11187 | |||
1563 | 11188 | # Allow error messages only from the first compilation. | ||
1564 | 11189 | if test "$suppress_opt" = yes; then | ||
1565 | 11190 | suppress_output=' >/dev/null 2>&1' | ||
1566 | 11191 | fi | ||
1567 | 11192 | fi | ||
1568 | 11193 | |||
1569 | 11194 | # Only build a position-dependent object if we build old libraries. | ||
1570 | 11195 | if test "$build_old_libs" = yes; then | ||
1571 | 11196 | if test "$pic_mode" != yes; then | ||
1572 | 11197 | # Don't build PIC code | ||
1573 | 11198 | command="$base_compile $qsrcfile$pie_flag" | ||
1574 | 11199 | else | ||
1575 | 11200 | command="$base_compile $qsrcfile $pic_flag" | ||
1576 | 11201 | fi | ||
1577 | 11202 | if test "$compiler_c_o" = yes; then | ||
1578 | 11203 | command="$command -o $obj" | ||
1579 | 11204 | fi | ||
1580 | 11205 | |||
1581 | 11206 | # Suppress compiler output if we already did a PIC compilation. | ||
1582 | 11207 | command="$command$suppress_output" | ||
1583 | 11208 | func_show_eval_locale "$command" \ | ||
1584 | 11209 | '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' | ||
1585 | 11210 | |||
1586 | 11211 | if test "$need_locks" = warn && | ||
1587 | 11212 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then | ||
1588 | 11213 | $ECHO "\ | ||
1589 | 11214 | *** ERROR, $lockfile contains: | ||
1590 | 11215 | `cat $lockfile 2>/dev/null` | ||
1591 | 11216 | |||
1592 | 11217 | but it should contain: | ||
1593 | 11218 | $srcfile | ||
1594 | 11219 | |||
1595 | 11220 | This indicates that another process is trying to use the same | ||
1596 | 11221 | temporary object file, and libtool could not work around it because | ||
1597 | 11222 | your compiler does not support \`-c' and \`-o' together. If you | ||
1598 | 11223 | repeat this compilation, it may succeed, by chance, but you had better | ||
1599 | 11224 | avoid parallel builds (make -j) in this platform, or get a better | ||
1600 | 11225 | compiler." | ||
1601 | 11226 | |||
1602 | 11227 | $opt_dry_run || $RM $removelist | ||
1603 | 11228 | exit $EXIT_FAILURE | ||
1604 | 11229 | fi | ||
1605 | 11230 | |||
1606 | 11231 | # Just move the object if needed | ||
1607 | 11232 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then | ||
1608 | 11233 | func_show_eval '$MV "$output_obj" "$obj"' \ | ||
1609 | 11234 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' | ||
1610 | 11235 | fi | ||
1611 | 11236 | fi | ||
1612 | 11237 | |||
1613 | 11238 | $opt_dry_run || { | ||
1614 | 11239 | func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" | ||
1615 | 11240 | |||
1616 | 11241 | # Unlock the critical section if it was locked | ||
1617 | 11242 | if test "$need_locks" != no; then | ||
1618 | 11243 | removelist=$lockfile | ||
1619 | 11244 | $RM "$lockfile" | ||
1620 | 11245 | fi | ||
1621 | 11246 | } | ||
1622 | 11247 | |||
1623 | 11248 | exit $EXIT_SUCCESS | ||
1624 | 11249 | } | ||
1625 | 11250 | |||
1626 | 11251 | $opt_help || { | ||
1627 | 11252 | test "$mode" = compile && func_mode_compile ${1+"$@"} | ||
1628 | 11253 | } | ||
1629 | 11254 | |||
1630 | 11255 | func_mode_help () | ||
1631 | 11256 | { | ||
1632 | 11257 | # We need to display help for each of the modes. | ||
1633 | 11258 | case $mode in | ||
1634 | 11259 | "") | ||
1635 | 11260 | # Generic help is extracted from the usage comments | ||
1636 | 11261 | # at the start of this file. | ||
1637 | 11262 | func_help | ||
1638 | 11263 | ;; | ||
1639 | 11264 | |||
1640 | 11265 | clean) | ||
1641 | 11266 | $ECHO \ | ||
1642 | 11267 | "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... | ||
1643 | 11268 | |||
1644 | 11269 | Remove files from the build directory. | ||
1645 | 11270 | |||
1646 | 11271 | RM is the name of the program to use to delete files associated with each FILE | ||
1647 | 11272 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed | ||
1648 | 11273 | to RM. | ||
1649 | 11274 | |||
1650 | 11275 | If FILE is a libtool library, object or program, all the files associated | ||
1651 | 11276 | with it are deleted. Otherwise, only FILE itself is deleted using RM." | ||
1652 | 11277 | ;; | ||
1653 | 11278 | |||
1654 | 11279 | compile) | ||
1655 | 11280 | $ECHO \ | ||
1656 | 11281 | "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE | ||
1657 | 11282 | |||
1658 | 11283 | Compile a source file into a libtool library object. | ||
1659 | 11284 | |||
1660 | 11285 | This mode accepts the following additional options: | ||
1661 | 11286 | |||
1662 | 11287 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE | ||
1663 | 11288 | -no-suppress do not suppress compiler output for multiple passes | ||
1664 | 11289 | -prefer-pic try to build PIC objects only | ||
1665 | 11290 | -prefer-non-pic try to build non-PIC objects only | ||
1666 | 11291 | -shared do not build a \`.o' file suitable for static linking | ||
1667 | 11292 | -static only build a \`.o' file suitable for static linking | ||
1668 | 11293 | -Wc,FLAG pass FLAG directly to the compiler | ||
1669 | 11294 | |||
1670 | 11295 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file | ||
1671 | 11296 | from the given SOURCEFILE. | ||
1672 | 11297 | |||
1673 | 11298 | The output file name is determined by removing the directory component from | ||
1674 | 11299 | SOURCEFILE, then substituting the C source code suffix \`.c' with the | ||
1675 | 11300 | library object suffix, \`.lo'." | ||
1676 | 11301 | ;; | ||
1677 | 11302 | |||
1678 | 11303 | execute) | ||
1679 | 11304 | $ECHO \ | ||
1680 | 11305 | "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... | ||
1681 | 11306 | |||
1682 | 11307 | Automatically set library path, then run a program. | ||
1683 | 11308 | |||
1684 | 11309 | This mode accepts the following additional options: | ||
1685 | 11310 | |||
1686 | 11311 | -dlopen FILE add the directory containing FILE to the library path | ||
1687 | 11312 | |||
1688 | 11313 | This mode sets the library path environment variable according to \`-dlopen' | ||
1689 | 11314 | flags. | ||
1690 | 11315 | |||
1691 | 11316 | If any of the ARGS are libtool executable wrappers, then they are translated | ||
1692 | 11317 | into their corresponding uninstalled binary, and any of their required library | ||
1693 | 11318 | directories are added to the library path. | ||
1694 | 11319 | |||
1695 | 11320 | Then, COMMAND is executed, with ARGS as arguments." | ||
1696 | 11321 | ;; | ||
1697 | 11322 | |||
1698 | 11323 | finish) | ||
1699 | 11324 | $ECHO \ | ||
1700 | 11325 | "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... | ||
1701 | 11326 | |||
1702 | 11327 | Complete the installation of libtool libraries. | ||
1703 | 11328 | |||
1704 | 11329 | Each LIBDIR is a directory that contains libtool libraries. | ||
1705 | 11330 | |||
1706 | 11331 | The commands that this mode executes may require superuser privileges. Use | ||
1707 | 11332 | the \`--dry-run' option if you just want to see what would be executed." | ||
1708 | 11333 | ;; | ||
1709 | 11334 | |||
1710 | 11335 | install) | ||
1711 | 11336 | $ECHO \ | ||
1712 | 11337 | "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... | ||
1713 | 11338 | |||
1714 | 11339 | Install executables or libraries. | ||
1715 | 11340 | |||
1716 | 11341 | INSTALL-COMMAND is the installation command. The first component should be | ||
1717 | 11342 | either the \`install' or \`cp' program. | ||
1718 | 11343 | |||
1719 | 11344 | The following components of INSTALL-COMMAND are treated specially: | ||
1720 | 11345 | |||
1721 | 11346 | -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation | ||
1722 | 11347 | |||
1723 | 11348 | The rest of the components are interpreted as arguments to that command (only | ||
1724 | 11349 | BSD-compatible install options are recognized)." | ||
1725 | 11350 | ;; | ||
1726 | 11351 | |||
1727 | 11352 | link) | ||
1728 | 11353 | $ECHO \ | ||
1729 | 11354 | "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... | ||
1730 | 11355 | |||
1731 | 11356 | Link object files or libraries together to form another library, or to | ||
1732 | 11357 | create an executable program. | ||
1733 | 11358 | |||
1734 | 11359 | LINK-COMMAND is a command using the C compiler that you would use to create | ||
1735 | 11360 | a program from several object files. | ||
1736 | 11361 | |||
1737 | 11362 | The following components of LINK-COMMAND are treated specially: | ||
1738 | 11363 | |||
1739 | 11364 | -all-static do not do any dynamic linking at all | ||
1740 | 11365 | -avoid-version do not add a version suffix if possible | ||
1741 | 11366 | -bindir BINDIR specify path to binaries directory (for systems where | ||
1742 | 11367 | libraries must be found in the PATH setting at runtime) | ||
1743 | 11368 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime | ||
1744 | 11369 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols | ||
1745 | 11370 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) | ||
1746 | 11371 | -export-symbols SYMFILE | ||
1747 | 11372 | try to export only the symbols listed in SYMFILE | ||
1748 | 11373 | -export-symbols-regex REGEX | ||
1749 | 11374 | try to export only the symbols matching REGEX | ||
1750 | 11375 | -LLIBDIR search LIBDIR for required installed libraries | ||
1751 | 11376 | -lNAME OUTPUT-FILE requires the installed library libNAME | ||
1752 | 11377 | -module build a library that can dlopened | ||
1753 | 11378 | -no-fast-install disable the fast-install mode | ||
1754 | 11379 | -no-install link a not-installable executable | ||
1755 | 11380 | -no-undefined declare that a library does not refer to external symbols | ||
1756 | 11381 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects | ||
1757 | 11382 | -objectlist FILE Use a list of object files found in FILE to specify objects | ||
1758 | 11383 | -precious-files-regex REGEX | ||
1759 | 11384 | don't remove output files matching REGEX | ||
1760 | 11385 | -release RELEASE specify package release information | ||
1761 | 11386 | -rpath LIBDIR the created library will eventually be installed in LIBDIR | ||
1762 | 11387 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries | ||
1763 | 11388 | -shared only do dynamic linking of libtool libraries | ||
1764 | 11389 | -shrext SUFFIX override the standard shared library file extension | ||
1765 | 11390 | -static do not do any dynamic linking of uninstalled libtool libraries | ||
1766 | 11391 | -static-libtool-libs | ||
1767 | 11392 | do not do any dynamic linking of libtool libraries | ||
1768 | 11393 | -version-info CURRENT[:REVISION[:AGE]] | ||
1769 | 11394 | specify library version info [each variable defaults to 0] | ||
1770 | 11395 | -weak LIBNAME declare that the target provides the LIBNAME interface | ||
1771 | 11396 | -Wc,FLAG | ||
1772 | 11397 | -Xcompiler FLAG pass linker-specific FLAG directly to the compiler | ||
1773 | 11398 | -Wl,FLAG | ||
1774 | 11399 | -Xlinker FLAG pass linker-specific FLAG directly to the linker | ||
1775 | 11400 | -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) | ||
1776 | 11401 | |||
1777 | 11402 | All other options (arguments beginning with \`-') are ignored. | ||
1778 | 11403 | |||
1779 | 11404 | Every other argument is treated as a filename. Files ending in \`.la' are | ||
1780 | 11405 | treated as uninstalled libtool libraries, other files are standard or library | ||
1781 | 11406 | object files. | ||
1782 | 11407 | |||
1783 | 11408 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, | ||
1784 | 11409 | only library objects (\`.lo' files) may be specified, and \`-rpath' is | ||
1785 | 11410 | required, except when creating a convenience library. | ||
1786 | 11411 | |||
1787 | 11412 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created | ||
1788 | 11413 | using \`ar' and \`ranlib', or on Windows using \`lib'. | ||
1789 | 11414 | |||
1790 | 11415 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file | ||
1791 | 11416 | is created, otherwise an executable program is created." | ||
1792 | 11417 | ;; | ||
1793 | 11418 | |||
1794 | 11419 | uninstall) | ||
1795 | 11420 | $ECHO \ | ||
1796 | 11421 | "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... | ||
1797 | 11422 | |||
1798 | 11423 | Remove libraries from an installation directory. | ||
1799 | 11424 | |||
1800 | 11425 | RM is the name of the program to use to delete files associated with each FILE | ||
1801 | 11426 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed | ||
1802 | 11427 | to RM. | ||
1803 | 11428 | |||
1804 | 11429 | If FILE is a libtool library, all the files associated with it are deleted. | ||
1805 | 11430 | Otherwise, only FILE itself is deleted using RM." | ||
1806 | 11431 | ;; | ||
1807 | 11432 | |||
1808 | 11433 | *) | ||
1809 | 11434 | func_fatal_help "invalid operation mode \`$mode'" | ||
1810 | 11435 | ;; | ||
1811 | 11436 | esac | ||
1812 | 11437 | |||
1813 | 11438 | echo | ||
1814 | 11439 | $ECHO "Try \`$progname --help' for more information about other modes." | ||
1815 | 11440 | } | ||
1816 | 11441 | |||
1817 | 11442 | # Now that we've collected a possible --mode arg, show help if necessary | ||
1818 | 11443 | if $opt_help; then | ||
1819 | 11444 | if test "$opt_help" = :; then | ||
1820 | 11445 | func_mode_help | ||
1821 | 11446 | else | ||
1822 | 11447 | { | ||
1823 | 11448 | func_help noexit | ||
1824 | 11449 | for mode in compile link execute install finish uninstall clean; do | ||
1825 | 11450 | func_mode_help | ||
1826 | 11451 | done | ||
1827 | 11452 | } | sed -n '1p; 2,$s/^Usage:/ or: /p' | ||
1828 | 11453 | { | ||
1829 | 11454 | func_help noexit | ||
1830 | 11455 | for mode in compile link execute install finish uninstall clean; do | ||
1831 | 11456 | echo | ||
1832 | 11457 | func_mode_help | ||
1833 | 11458 | done | ||
1834 | 11459 | } | | ||
1835 | 11460 | sed '1d | ||
1836 | 11461 | /^When reporting/,/^Report/{ | ||
1837 | 11462 | H | ||
1838 | 11463 | d | ||
1839 | 11464 | } | ||
1840 | 11465 | $x | ||
1841 | 11466 | /information about other modes/d | ||
1842 | 11467 | /more detailed .*MODE/d | ||
1843 | 11468 | s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' | ||
1844 | 11469 | fi | ||
1845 | 11470 | exit $? | ||
1846 | 11471 | fi | ||
1847 | 11472 | |||
1848 | 11473 | |||
1849 | 11474 | # func_mode_execute arg... | ||
1850 | 11475 | func_mode_execute () | ||
1851 | 11476 | { | ||
1852 | 11477 | $opt_debug | ||
1853 | 11478 | # The first argument is the command name. | ||
1854 | 11479 | cmd="$nonopt" | ||
1855 | 11480 | test -z "$cmd" && \ | ||
1856 | 11481 | func_fatal_help "you must specify a COMMAND" | ||
1857 | 11482 | |||
1858 | 11483 | # Handle -dlopen flags immediately. | ||
1859 | 11484 | for file in $execute_dlfiles; do | ||
1860 | 11485 | test -f "$file" \ | ||
1861 | 11486 | || func_fatal_help "\`$file' is not a file" | ||
1862 | 11487 | |||
1863 | 11488 | dir= | ||
1864 | 11489 | case $file in | ||
1865 | 11490 | *.la) | ||
1866 | 11491 | # Check to see that this really is a libtool archive. | ||
1867 | 11492 | func_lalib_unsafe_p "$file" \ | ||
1868 | 11493 | || func_fatal_help "\`$lib' is not a valid libtool archive" | ||
1869 | 11494 | |||
1870 | 11495 | # Read the libtool library. | ||
1871 | 11496 | dlname= | ||
1872 | 11497 | library_names= | ||
1873 | 11498 | func_source "$file" | ||
1874 | 11499 | |||
1875 | 11500 | # Skip this library if it cannot be dlopened. | ||
1876 | 11501 | if test -z "$dlname"; then | ||
1877 | 11502 | # Warn if it was a shared library. | ||
1878 | 11503 | test -n "$library_names" && \ | ||
1879 | 11504 | func_warning "\`$file' was not linked with \`-export-dynamic'" | ||
1880 | 11505 | continue | ||
1881 | 11506 | fi | ||
1882 | 11507 | |||
1883 | 11508 | func_dirname "$file" "" "." | ||
1884 | 11509 | dir="$func_dirname_result" | ||
1885 | 11510 | |||
1886 | 11511 | if test -f "$dir/$objdir/$dlname"; then | ||
1887 | 11512 | dir="$dir/$objdir" | ||
1888 | 11513 | else | ||
1889 | 11514 | if test ! -f "$dir/$dlname"; then | ||
1890 | 11515 | func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" | ||
1891 | 11516 | fi | ||
1892 | 11517 | fi | ||
1893 | 11518 | ;; | ||
1894 | 11519 | |||
1895 | 11520 | *.lo) | ||
1896 | 11521 | # Just add the directory containing the .lo file. | ||
1897 | 11522 | func_dirname "$file" "" "." | ||
1898 | 11523 | dir="$func_dirname_result" | ||
1899 | 11524 | ;; | ||
1900 | 11525 | |||
1901 | 11526 | *) | ||
1902 | 11527 | func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" | ||
1903 | 11528 | continue | ||
1904 | 11529 | ;; | ||
1905 | 11530 | esac | ||
1906 | 11531 | |||
1907 | 11532 | # Get the absolute pathname. | ||
1908 | 11533 | absdir=`cd "$dir" && pwd` | ||
1909 | 11534 | test -n "$absdir" && dir="$absdir" | ||
1910 | 11535 | |||
1911 | 11536 | # Now add the directory to shlibpath_var. | ||
1912 | 11537 | if eval "test -z \"\$$shlibpath_var\""; then | ||
1913 | 11538 | eval "$shlibpath_var=\"\$dir\"" | ||
1914 | 11539 | else | ||
1915 | 11540 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" | ||
1916 | 11541 | fi | ||
1917 | 11542 | done | ||
1918 | 11543 | |||
1919 | 11544 | # This variable tells wrapper scripts just to set shlibpath_var | ||
1920 | 11545 | # rather than running their programs. | ||
1921 | 11546 | libtool_execute_magic="$magic" | ||
1922 | 11547 | |||
1923 | 11548 | # Check if any of the arguments is a wrapper script. | ||
1924 | 11549 | args= | ||
1925 | 11550 | for file | ||
1926 | 11551 | do | ||
1927 | 11552 | case $file in | ||
1928 | 11553 | -* | *.la | *.lo ) ;; | ||
1929 | 11554 | *) | ||
1930 | 11555 | # Do a test to see if this is really a libtool program. | ||
1931 | 11556 | if func_ltwrapper_script_p "$file"; then | ||
1932 | 11557 | func_source "$file" | ||
1933 | 11558 | # Transform arg to wrapped name. | ||
1934 | 11559 | file="$progdir/$program" | ||
1935 | 11560 | elif func_ltwrapper_executable_p "$file"; then | ||
1936 | 11561 | func_ltwrapper_scriptname "$file" | ||
1937 | 11562 | func_source "$func_ltwrapper_scriptname_result" | ||
1938 | 11563 | # Transform arg to wrapped name. | ||
1939 | 11564 | file="$progdir/$program" | ||
1940 | 11565 | fi | ||
1941 | 11566 | ;; | ||
1942 | 11567 | esac | ||
1943 | 11568 | # Quote arguments (to preserve shell metacharacters). | ||
1944 | 11569 | func_quote_for_eval "$file" | ||
1945 | 11570 | args="$args $func_quote_for_eval_result" | ||
1946 | 11571 | done | ||
1947 | 11572 | |||
1948 | 11573 | if test "X$opt_dry_run" = Xfalse; then | ||
1949 | 11574 | if test -n "$shlibpath_var"; then | ||
1950 | 11575 | # Export the shlibpath_var. | ||
1951 | 11576 | eval "export $shlibpath_var" | ||
1952 | 11577 | fi | ||
1953 | 11578 | |||
1954 | 11579 | # Restore saved environment variables | ||
1955 | 11580 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES | ||
1956 | 11581 | do | ||
1957 | 11582 | eval "if test \"\${save_$lt_var+set}\" = set; then | ||
1958 | 11583 | $lt_var=\$save_$lt_var; export $lt_var | ||
1959 | 11584 | else | ||
1960 | 11585 | $lt_unset $lt_var | ||
1961 | 11586 | fi" | ||
1962 | 11587 | done | ||
1963 | 11588 | |||
1964 | 11589 | # Now prepare to actually exec the command. | ||
1965 | 11590 | exec_cmd="\$cmd$args" | ||
1966 | 11591 | else | ||
1967 | 11592 | # Display what would be done. | ||
1968 | 11593 | if test -n "$shlibpath_var"; then | ||
1969 | 11594 | eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" | ||
1970 | 11595 | echo "export $shlibpath_var" | ||
1971 | 11596 | fi | ||
1972 | 11597 | $ECHO "$cmd$args" | ||
1973 | 11598 | exit $EXIT_SUCCESS | ||
1974 | 11599 | fi | ||
1975 | 11600 | } | ||
1976 | 11601 | |||
1977 | 11602 | test "$mode" = execute && func_mode_execute ${1+"$@"} | ||
1978 | 11603 | |||
1979 | 11604 | |||
1980 | 11605 | # func_mode_finish arg... | ||
1981 | 11606 | func_mode_finish () | ||
1982 | 11607 | { | ||
1983 | 11608 | $opt_debug | ||
1984 | 11609 | libdirs="$nonopt" | ||
1985 | 11610 | admincmds= | ||
1986 | 11611 | |||
1987 | 11612 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then | ||
1988 | 11613 | for dir | ||
1989 | 11614 | do | ||
1990 | 11615 | libdirs="$libdirs $dir" | ||
1991 | 11616 | done | ||
1992 | 11617 | |||
1993 | 11618 | for libdir in $libdirs; do | ||
1994 | 11619 | if test -n "$finish_cmds"; then | ||
1995 | 11620 | # Do each command in the finish commands. | ||
1996 | 11621 | func_execute_cmds "$finish_cmds" 'admincmds="$admincmds | ||
1997 | 11622 | '"$cmd"'"' | ||
1998 | 11623 | fi | ||
1999 | 11624 | if test -n "$finish_eval"; then | ||
2000 | 11625 | # Do the single finish_eval. | ||
2001 | 11626 | eval cmds=\"$finish_eval\" | ||
2002 | 11627 | $opt_dry_run || eval "$cmds" || admincmds="$admincmds | ||
2003 | 11628 | $cmds" | ||
2004 | 11629 | fi | ||
2005 | 11630 | done | ||
2006 | 11631 | fi | ||
2007 | 11632 | |||
2008 | 11633 | # Exit here if they wanted silent mode. | ||
2009 | 11634 | $opt_silent && exit $EXIT_SUCCESS | ||
2010 | 11635 | |||
2011 | 11636 | echo "----------------------------------------------------------------------" | ||
2012 | 11637 | echo "Libraries have been installed in:" | ||
2013 | 11638 | for libdir in $libdirs; do | ||
2014 | 11639 | $ECHO " $libdir" | ||
2015 | 11640 | done | ||
2016 | 11641 | echo | ||
2017 | 11642 | echo "If you ever happen to want to link against installed libraries" | ||
2018 | 11643 | echo "in a given directory, LIBDIR, you must either use libtool, and" | ||
2019 | 11644 | echo "specify the full pathname of the library, or use the \`-LLIBDIR'" | ||
2020 | 11645 | echo "flag during linking and do at least one of the following:" | ||
2021 | 11646 | if test -n "$shlibpath_var"; then | ||
2022 | 11647 | echo " - add LIBDIR to the \`$shlibpath_var' environment variable" | ||
2023 | 11648 | echo " during execution" | ||
2024 | 11649 | fi | ||
2025 | 11650 | if test -n "$runpath_var"; then | ||
2026 | 11651 | echo " - add LIBDIR to the \`$runpath_var' environment variable" | ||
2027 | 11652 | echo " during linking" | ||
2028 | 11653 | fi | ||
2029 | 11654 | if test -n "$hardcode_libdir_flag_spec"; then | ||
2030 | 11655 | libdir=LIBDIR | ||
2031 | 11656 | eval flag=\"$hardcode_libdir_flag_spec\" | ||
2032 | 11657 | |||
2033 | 11658 | $ECHO " - use the \`$flag' linker flag" | ||
2034 | 11659 | fi | ||
2035 | 11660 | if test -n "$admincmds"; then | ||
2036 | 11661 | $ECHO " - have your system administrator run these commands:$admincmds" | ||
2037 | 11662 | fi | ||
2038 | 11663 | if test -f /etc/ld.so.conf; then | ||
2039 | 11664 | echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" | ||
2040 | 11665 | fi | ||
2041 | 11666 | echo | ||
2042 | 11667 | |||
2043 | 11668 | echo "See any operating system documentation about shared libraries for" | ||
2044 | 11669 | case $host in | ||
2045 | 11670 | solaris2.[6789]|solaris2.1[0-9]) | ||
2046 | 11671 | echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" | ||
2047 | 11672 | echo "pages." | ||
2048 | 11673 | ;; | ||
2049 | 11674 | *) | ||
2050 | 11675 | echo "more information, such as the ld(1) and ld.so(8) manual pages." | ||
2051 | 11676 | ;; | ||
2052 | 11677 | esac | ||
2053 | 11678 | echo "----------------------------------------------------------------------" | ||
2054 | 11679 | exit $EXIT_SUCCESS | ||
2055 | 11680 | } | ||
2056 | 11681 | |||
2057 | 11682 | test "$mode" = finish && func_mode_finish ${1+"$@"} | ||
2058 | 11683 | |||
2059 | 11684 | |||
2060 | 11685 | # func_mode_install arg... | ||
2061 | 11686 | func_mode_install () | ||
2062 | 11687 | { | ||
2063 | 11688 | $opt_debug | ||
2064 | 11689 | # There may be an optional sh(1) argument at the beginning of | ||
2065 | 11690 | # install_prog (especially on Windows NT). | ||
2066 | 11691 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || | ||
2067 | 11692 | # Allow the use of GNU shtool's install command. | ||
2068 | 11693 | case $nonopt in *shtool*) :;; *) false;; esac; then | ||
2069 | 11694 | # Aesthetically quote it. | ||
2070 | 11695 | func_quote_for_eval "$nonopt" | ||
2071 | 11696 | install_prog="$func_quote_for_eval_result " | ||
2072 | 11697 | arg=$1 | ||
2073 | 11698 | shift | ||
2074 | 11699 | else | ||
2075 | 11700 | install_prog= | ||
2076 | 11701 | arg=$nonopt | ||
2077 | 11702 | fi | ||
2078 | 11703 | |||
2079 | 11704 | # The real first argument should be the name of the installation program. | ||
2080 | 11705 | # Aesthetically quote it. | ||
2081 | 11706 | func_quote_for_eval "$arg" | ||
2082 | 11707 | install_prog="$install_prog$func_quote_for_eval_result" | ||
2083 | 11708 | install_shared_prog=$install_prog | ||
2084 | 11709 | case " $install_prog " in | ||
2085 | 11710 | *[\\\ /]cp\ *) install_cp=: ;; | ||
2086 | 11711 | *) install_cp=false ;; | ||
2087 | 11712 | esac | ||
2088 | 11713 | |||
2089 | 11714 | # We need to accept at least all the BSD install flags. | ||
2090 | 11715 | dest= | ||
2091 | 11716 | files= | ||
2092 | 11717 | opts= | ||
2093 | 11718 | prev= | ||
2094 | 11719 | install_type= | ||
2095 | 11720 | isdir=no | ||
2096 | 11721 | stripme= | ||
2097 | 11722 | no_mode=: | ||
2098 | 11723 | for arg | ||
2099 | 11724 | do | ||
2100 | 11725 | arg2= | ||
2101 | 11726 | if test -n "$dest"; then | ||
2102 | 11727 | files="$files $dest" | ||
2103 | 11728 | dest=$arg | ||
2104 | 11729 | continue | ||
2105 | 11730 | fi | ||
2106 | 11731 | |||
2107 | 11732 | case $arg in | ||
2108 | 11733 | -d) isdir=yes ;; | ||
2109 | 11734 | -f) | ||
2110 | 11735 | if $install_cp; then :; else | ||
2111 | 11736 | prev=$arg | ||
2112 | 11737 | fi | ||
2113 | 11738 | ;; | ||
2114 | 11739 | -g | -m | -o) | ||
2115 | 11740 | prev=$arg | ||
2116 | 11741 | ;; | ||
2117 | 11742 | -s) | ||
2118 | 11743 | stripme=" -s" | ||
2119 | 11744 | continue | ||
2120 | 11745 | ;; | ||
2121 | 11746 | -*) | ||
2122 | 11747 | ;; | ||
2123 | 11748 | *) | ||
2124 | 11749 | # If the previous option needed an argument, then skip it. | ||
2125 | 11750 | if test -n "$prev"; then | ||
2126 | 11751 | if test "x$prev" = x-m && test -n "$install_override_mode"; then | ||
2127 | 11752 | arg2=$install_override_mode | ||
2128 | 11753 | no_mode=false | ||
2129 | 11754 | fi | ||
2130 | 11755 | prev= | ||
2131 | 11756 | else | ||
2132 | 11757 | dest=$arg | ||
2133 | 11758 | continue | ||
2134 | 11759 | fi | ||
2135 | 11760 | ;; | ||
2136 | 11761 | esac | ||
2137 | 11762 | |||
2138 | 11763 | # Aesthetically quote the argument. | ||
2139 | 11764 | func_quote_for_eval "$arg" | ||
2140 | 11765 | install_prog="$install_prog $func_quote_for_eval_result" | ||
2141 | 11766 | if test -n "$arg2"; then | ||
2142 | 11767 | func_quote_for_eval "$arg2" | ||
2143 | 11768 | fi | ||
2144 | 11769 | install_shared_prog="$install_shared_prog $func_quote_for_eval_result" | ||
2145 | 11770 | done | ||
2146 | 11771 | |||
2147 | 11772 | test -z "$install_prog" && \ | ||
2148 | 11773 | func_fatal_help "you must specify an install program" | ||
2149 | 11774 | |||
2150 | 11775 | test -n "$prev" && \ | ||
2151 | 11776 | func_fatal_help "the \`$prev' option requires an argument" | ||
2152 | 11777 | |||
2153 | 11778 | if test -n "$install_override_mode" && $no_mode; then | ||
2154 | 11779 | if $install_cp; then :; else | ||
2155 | 11780 | func_quote_for_eval "$install_override_mode" | ||
2156 | 11781 | install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result" | ||
2157 | 11782 | fi | ||
2158 | 11783 | fi | ||
2159 | 11784 | |||
2160 | 11785 | if test -z "$files"; then | ||
2161 | 11786 | if test -z "$dest"; then | ||
2162 | 11787 | func_fatal_help "no file or destination specified" | ||
2163 | 11788 | else | ||
2164 | 11789 | func_fatal_help "you must specify a destination" | ||
2165 | 11790 | fi | ||
2166 | 11791 | fi | ||
2167 | 11792 | |||
2168 | 11793 | # Strip any trailing slash from the destination. | ||
2169 | 11794 | func_stripname '' '/' "$dest" | ||
2170 | 11795 | dest=$func_stripname_result | ||
2171 | 11796 | |||
2172 | 11797 | # Check to see that the destination is a directory. | ||
2173 | 11798 | test -d "$dest" && isdir=yes | ||
2174 | 11799 | if test "$isdir" = yes; then | ||
2175 | 11800 | destdir="$dest" | ||
2176 | 11801 | destname= | ||
2177 | 11802 | else | ||
2178 | 11803 | func_dirname_and_basename "$dest" "" "." | ||
2179 | 11804 | destdir="$func_dirname_result" | ||
2180 | 11805 | destname="$func_basename_result" | ||
2181 | 11806 | |||
2182 | 11807 | # Not a directory, so check to see that there is only one file specified. | ||
2183 | 11808 | set dummy $files; shift | ||
2184 | 11809 | test "$#" -gt 1 && \ | ||
2185 | 11810 | func_fatal_help "\`$dest' is not a directory" | ||
2186 | 11811 | fi | ||
2187 | 11812 | case $destdir in | ||
2188 | 11813 | [\\/]* | [A-Za-z]:[\\/]*) ;; | ||
2189 | 11814 | *) | ||
2190 | 11815 | for file in $files; do | ||
2191 | 11816 | case $file in | ||
2192 | 11817 | *.lo) ;; | ||
2193 | 11818 | *) | ||
2194 | 11819 | func_fatal_help "\`$destdir' must be an absolute directory name" | ||
2195 | 11820 | ;; | ||
2196 | 11821 | esac | ||
2197 | 11822 | done | ||
2198 | 11823 | ;; | ||
2199 | 11824 | esac | ||
2200 | 11825 | |||
2201 | 11826 | # This variable tells wrapper scripts just to set variables rather | ||
2202 | 11827 | # than running their programs. | ||
2203 | 11828 | libtool_install_magic="$magic" | ||
2204 | 11829 | |||
2205 | 11830 | staticlibs= | ||
2206 | 11831 | future_libdirs= | ||
2207 | 11832 | current_libdirs= | ||
2208 | 11833 | for file in $files; do | ||
2209 | 11834 | |||
2210 | 11835 | # Do each installation. | ||
2211 | 11836 | case $file in | ||
2212 | 11837 | *.$libext) | ||
2213 | 11838 | # Do the static libraries later. | ||
2214 | 11839 | staticlibs="$staticlibs $file" | ||
2215 | 11840 | ;; | ||
2216 | 11841 | |||
2217 | 11842 | *.la) | ||
2218 | 11843 | # Check to see that this really is a libtool archive. | ||
2219 | 11844 | func_lalib_unsafe_p "$file" \ | ||
2220 | 11845 | || func_fatal_help "\`$file' is not a valid libtool archive" | ||
2221 | 11846 | |||
2222 | 11847 | library_names= | ||
2223 | 11848 | old_library= | ||
2224 | 11849 | relink_command= | ||
2225 | 11850 | func_source "$file" | ||
2226 | 11851 | |||
2227 | 11852 | # Add the libdir to current_libdirs if it is the destination. | ||
2228 | 11853 | if test "X$destdir" = "X$libdir"; then | ||
2229 | 11854 | case "$current_libdirs " in | ||
2230 | 11855 | *" $libdir "*) ;; | ||
2231 | 11856 | *) current_libdirs="$current_libdirs $libdir" ;; | ||
2232 | 11857 | esac | ||
2233 | 11858 | else | ||
2234 | 11859 | # Note the libdir as a future libdir. | ||
2235 | 11860 | case "$future_libdirs " in | ||
2236 | 11861 | *" $libdir "*) ;; | ||
2237 | 11862 | *) future_libdirs="$future_libdirs $libdir" ;; | ||
2238 | 11863 | esac | ||
2239 | 11864 | fi | ||
2240 | 11865 | |||
2241 | 11866 | func_dirname "$file" "/" "" | ||
2242 | 11867 | dir="$func_dirname_result" | ||
2243 | 11868 | dir="$dir$objdir" | ||
2244 | 11869 | |||
2245 | 11870 | if test -n "$relink_command"; then | ||
2246 | 11871 | # Determine the prefix the user has applied to our future dir. | ||
2247 | 11872 | inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` | ||
2248 | 11873 | |||
2249 | 11874 | # Don't allow the user to place us outside of our expected | ||
2250 | 11875 | # location b/c this prevents finding dependent libraries that | ||
2251 | 11876 | # are installed to the same prefix. | ||
2252 | 11877 | # At present, this check doesn't affect windows .dll's that | ||
2253 | 11878 | # are installed into $libdir/../bin (currently, that works fine) | ||
2254 | 11879 | # but it's something to keep an eye on. | ||
2255 | 11880 | test "$inst_prefix_dir" = "$destdir" && \ | ||
2256 | 11881 | func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" | ||
2257 | 11882 | |||
2258 | 11883 | if test -n "$inst_prefix_dir"; then | ||
2259 | 11884 | # Stick the inst_prefix_dir data into the link command. | ||
2260 | 11885 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` | ||
2261 | 11886 | else | ||
2262 | 11887 | relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` | ||
2263 | 11888 | fi | ||
2264 | 11889 | |||
2265 | 11890 | func_warning "relinking \`$file'" | ||
2266 | 11891 | func_show_eval "$relink_command" \ | ||
2267 | 11892 | 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' | ||
2268 | 11893 | fi | ||
2269 | 11894 | |||
2270 | 11895 | # See the names of the shared library. | ||
2271 | 11896 | set dummy $library_names; shift | ||
2272 | 11897 | if test -n "$1"; then | ||
2273 | 11898 | realname="$1" | ||
2274 | 11899 | shift | ||
2275 | 11900 | |||
2276 | 11901 | srcname="$realname" | ||
2277 | 11902 | test -n "$relink_command" && srcname="$realname"T | ||
2278 | 11903 | |||
2279 | 11904 | # Install the shared library and build the symlinks. | ||
2280 | 11905 | func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ | ||
2281 | 11906 | 'exit $?' | ||
2282 | 11907 | tstripme="$stripme" | ||
2283 | 11908 | case $host_os in | ||
2284 | 11909 | cygwin* | mingw* | pw32* | cegcc*) | ||
2285 | 11910 | case $realname in | ||
2286 | 11911 | *.dll.a) | ||
2287 | 11912 | tstripme="" | ||
2288 | 11913 | ;; | ||
2289 | 11914 | esac | ||
2290 | 11915 | ;; | ||
2291 | 11916 | esac | ||
2292 | 11917 | if test -n "$tstripme" && test -n "$striplib"; then | ||
2293 | 11918 | func_show_eval "$striplib $destdir/$realname" 'exit $?' | ||
2294 | 11919 | fi | ||
2295 | 11920 | |||
2296 | 11921 | if test "$#" -gt 0; then | ||
2297 | 11922 | # Delete the old symlinks, and create new ones. | ||
2298 | 11923 | # Try `ln -sf' first, because the `ln' binary might depend on | ||
2299 | 11924 | # the symlink we replace! Solaris /bin/ln does not understand -f, | ||
2300 | 11925 | # so we also need to try rm && ln -s. | ||
2301 | 11926 | for linkname | ||
2302 | 11927 | do | ||
2303 | 11928 | test "$linkname" != "$realname" \ | ||
2304 | 11929 | && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" | ||
2305 | 11930 | done | ||
2306 | 11931 | fi | ||
2307 | 11932 | |||
2308 | 11933 | # Do each command in the postinstall commands. | ||
2309 | 11934 | lib="$destdir/$realname" | ||
2310 | 11935 | func_execute_cmds "$postinstall_cmds" 'exit $?' | ||
2311 | 11936 | fi | ||
2312 | 11937 | |||
2313 | 11938 | # Install the pseudo-library for information purposes. | ||
2314 | 11939 | func_basename "$file" | ||
2315 | 11940 | name="$func_basename_result" | ||
2316 | 11941 | instname="$dir/$name"i | ||
2317 | 11942 | func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' | ||
2318 | 11943 | |||
2319 | 11944 | # Maybe install the static library, too. | ||
2320 | 11945 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" | ||
2321 | 11946 | ;; | ||
2322 | 11947 | |||
2323 | 11948 | *.lo) | ||
2324 | 11949 | # Install (i.e. copy) a libtool object. | ||
2325 | 11950 | |||
2326 | 11951 | # Figure out destination file name, if it wasn't already specified. | ||
2327 | 11952 | if test -n "$destname"; then | ||
2328 | 11953 | destfile="$destdir/$destname" | ||
2329 | 11954 | else | ||
2330 | 11955 | func_basename "$file" | ||
2331 | 11956 | destfile="$func_basename_result" | ||
2332 | 11957 | destfile="$destdir/$destfile" | ||
2333 | 11958 | fi | ||
2334 | 11959 | |||
2335 | 11960 | # Deduce the name of the destination old-style object file. | ||
2336 | 11961 | case $destfile in | ||
2337 | 11962 | *.lo) | ||
2338 | 11963 | func_lo2o "$destfile" | ||
2339 | 11964 | staticdest=$func_lo2o_result | ||
2340 | 11965 | ;; | ||
2341 | 11966 | *.$objext) | ||
2342 | 11967 | staticdest="$destfile" | ||
2343 | 11968 | destfile= | ||
2344 | 11969 | ;; | ||
2345 | 11970 | *) | ||
2346 | 11971 | func_fatal_help "cannot copy a libtool object to \`$destfile'" | ||
2347 | 11972 | ;; | ||
2348 | 11973 | esac | ||
2349 | 11974 | |||
2350 | 11975 | # Install the libtool object if requested. | ||
2351 | 11976 | test -n "$destfile" && \ | ||
2352 | 11977 | func_show_eval "$install_prog $file $destfile" 'exit $?' | ||
2353 | 11978 | |||
2354 | 11979 | # Install the old object if enabled. | ||
2355 | 11980 | if test "$build_old_libs" = yes; then | ||
2356 | 11981 | # Deduce the name of the old-style object file. | ||
2357 | 11982 | func_lo2o "$file" | ||
2358 | 11983 | staticobj=$func_lo2o_result | ||
2359 | 11984 | func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' | ||
2360 | 11985 | fi | ||
2361 | 11986 | exit $EXIT_SUCCESS | ||
2362 | 11987 | ;; | ||
2363 | 11988 | |||
2364 | 11989 | *) | ||
2365 | 11990 | # Figure out destination file name, if it wasn't already specified. | ||
2366 | 11991 | if test -n "$destname"; then | ||
2367 | 11992 | destfile="$destdir/$destname" | ||
2368 | 11993 | else | ||
2369 | 11994 | func_basename "$file" | ||
2370 | 11995 | destfile="$func_basename_result" | ||
2371 | 11996 | destfile="$destdir/$destfile" | ||
2372 | 11997 | fi | ||
2373 | 11998 | |||
2374 | 11999 | # If the file is missing, and there is a .exe on the end, strip it | ||
2375 | 12000 | # because it is most likely a libtool script we actually want to | ||
2376 | 12001 | # install | ||
2377 | 12002 | stripped_ext="" | ||
2378 | 12003 | case $file in | ||
2379 | 12004 | *.exe) | ||
2380 | 12005 | if test ! -f "$file"; then | ||
2381 | 12006 | func_stripname '' '.exe' "$file" | ||
2382 | 12007 | file=$func_stripname_result | ||
2383 | 12008 | stripped_ext=".exe" | ||
2384 | 12009 | fi | ||
2385 | 12010 | ;; | ||
2386 | 12011 | esac | ||
2387 | 12012 | |||
2388 | 12013 | # Do a test to see if this is really a libtool program. | ||
2389 | 12014 | case $host in | ||
2390 | 12015 | *cygwin* | *mingw*) | ||
2391 | 12016 | if func_ltwrapper_executable_p "$file"; then | ||
2392 | 12017 | func_ltwrapper_scriptname "$file" | ||
2393 | 12018 | wrapper=$func_ltwrapper_scriptname_result | ||
2394 | 12019 | else | ||
2395 | 12020 | func_stripname '' '.exe' "$file" | ||
2396 | 12021 | wrapper=$func_stripname_result | ||
2397 | 12022 | fi | ||
2398 | 12023 | ;; | ||
2399 | 12024 | *) | ||
2400 | 12025 | wrapper=$file | ||
2401 | 12026 | ;; | ||
2402 | 12027 | esac | ||
2403 | 12028 | if func_ltwrapper_script_p "$wrapper"; then | ||
2404 | 12029 | notinst_deplibs= | ||
2405 | 12030 | relink_command= | ||
2406 | 12031 | |||
2407 | 12032 | func_source "$wrapper" | ||
2408 | 12033 | |||
2409 | 12034 | # Check the variables that should have been set. | ||
2410 | 12035 | test -z "$generated_by_libtool_version" && \ | ||
2411 | 12036 | func_fatal_error "invalid libtool wrapper script \`$wrapper'" | ||
2412 | 12037 | |||
2413 | 12038 | finalize=yes | ||
2414 | 12039 | for lib in $notinst_deplibs; do | ||
2415 | 12040 | # Check to see that each library is installed. | ||
2416 | 12041 | libdir= | ||
2417 | 12042 | if test -f "$lib"; then | ||
2418 | 12043 | func_source "$lib" | ||
2419 | 12044 | fi | ||
2420 | 12045 | libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test | ||
2421 | 12046 | if test -n "$libdir" && test ! -f "$libfile"; then | ||
2422 | 12047 | func_warning "\`$lib' has not been installed in \`$libdir'" | ||
2423 | 12048 | finalize=no | ||
2424 | 12049 | fi | ||
2425 | 12050 | done | ||
2426 | 12051 | |||
2427 | 12052 | relink_command= | ||
2428 | 12053 | func_source "$wrapper" | ||
2429 | 12054 | |||
2430 | 12055 | outputname= | ||
2431 | 12056 | if test "$fast_install" = no && test -n "$relink_command"; then | ||
2432 | 12057 | $opt_dry_run || { | ||
2433 | 12058 | if test "$finalize" = yes; then | ||
2434 | 12059 | tmpdir=`func_mktempdir` | ||
2435 | 12060 | func_basename "$file$stripped_ext" | ||
2436 | 12061 | file="$func_basename_result" | ||
2437 | 12062 | outputname="$tmpdir/$file" | ||
2438 | 12063 | # Replace the output file specification. | ||
2439 | 12064 | relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` | ||
2440 | 12065 | |||
2441 | 12066 | $opt_silent || { | ||
2442 | 12067 | func_quote_for_expand "$relink_command" | ||
2443 | 12068 | eval "func_echo $func_quote_for_expand_result" | ||
2444 | 12069 | } | ||
2445 | 12070 | if eval "$relink_command"; then : | ||
2446 | 12071 | else | ||
2447 | 12072 | func_error "error: relink \`$file' with the above command before installing it" | ||
2448 | 12073 | $opt_dry_run || ${RM}r "$tmpdir" | ||
2449 | 12074 | continue | ||
2450 | 12075 | fi | ||
2451 | 12076 | file="$outputname" | ||
2452 | 12077 | else | ||
2453 | 12078 | func_warning "cannot relink \`$file'" | ||
2454 | 12079 | fi | ||
2455 | 12080 | } | ||
2456 | 12081 | else | ||
2457 | 12082 | # Install the binary that we compiled earlier. | ||
2458 | 12083 | file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` | ||
2459 | 12084 | fi | ||
2460 | 12085 | fi | ||
2461 | 12086 | |||
2462 | 12087 | # remove .exe since cygwin /usr/bin/install will append another | ||
2463 | 12088 | # one anyway | ||
2464 | 12089 | case $install_prog,$host in | ||
2465 | 12090 | */usr/bin/install*,*cygwin*) | ||
2466 | 12091 | case $file:$destfile in | ||
2467 | 12092 | *.exe:*.exe) | ||
2468 | 12093 | # this is ok | ||
2469 | 12094 | ;; | ||
2470 | 12095 | *.exe:*) | ||
2471 | 12096 | destfile=$destfile.exe | ||
2472 | 12097 | ;; | ||
2473 | 12098 | *:*.exe) | ||
2474 | 12099 | func_stripname '' '.exe' "$destfile" | ||
2475 | 12100 | destfile=$func_stripname_result | ||
2476 | 12101 | ;; | ||
2477 | 12102 | esac | ||
2478 | 12103 | ;; | ||
2479 | 12104 | esac | ||
2480 | 12105 | func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' | ||
2481 | 12106 | $opt_dry_run || if test -n "$outputname"; then | ||
2482 | 12107 | ${RM}r "$tmpdir" | ||
2483 | 12108 | fi | ||
2484 | 12109 | ;; | ||
2485 | 12110 | esac | ||
2486 | 12111 | done | ||
2487 | 12112 | |||
2488 | 12113 | for file in $staticlibs; do | ||
2489 | 12114 | func_basename "$file" | ||
2490 | 12115 | name="$func_basename_result" | ||
2491 | 12116 | |||
2492 | 12117 | # Set up the ranlib parameters. | ||
2493 | 12118 | oldlib="$destdir/$name" | ||
2494 | 12119 | |||
2495 | 12120 | func_show_eval "$install_prog \$file \$oldlib" 'exit $?' | ||
2496 | 12121 | |||
2497 | 12122 | if test -n "$stripme" && test -n "$old_striplib"; then | ||
2498 | 12123 | func_show_eval "$old_striplib $oldlib" 'exit $?' | ||
2499 | 12124 | fi | ||
2500 | 12125 | |||
2501 | 12126 | # Do each command in the postinstall commands. | ||
2502 | 12127 | func_execute_cmds "$old_postinstall_cmds" 'exit $?' | ||
2503 | 12128 | done | ||
2504 | 12129 | |||
2505 | 12130 | test -n "$future_libdirs" && \ | ||
2506 | 12131 | func_warning "remember to run \`$progname --finish$future_libdirs'" | ||
2507 | 12132 | |||
2508 | 12133 | if test -n "$current_libdirs"; then | ||
2509 | 12134 | # Maybe just do a dry run. | ||
2510 | 12135 | $opt_dry_run && current_libdirs=" -n$current_libdirs" | ||
2511 | 12136 | exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' | ||
2512 | 12137 | else | ||
2513 | 12138 | exit $EXIT_SUCCESS | ||
2514 | 12139 | fi | ||
2515 | 12140 | } | ||
2516 | 12141 | |||
2517 | 12142 | test "$mode" = install && func_mode_install ${1+"$@"} | ||
2518 | 12143 | |||
2519 | 12144 | |||
2520 | 12145 | # func_generate_dlsyms outputname originator pic_p | ||
2521 | 12146 | # Extract symbols from dlprefiles and create ${outputname}S.o with | ||
2522 | 12147 | # a dlpreopen symbol table. | ||
2523 | 12148 | func_generate_dlsyms () | ||
2524 | 12149 | { | ||
2525 | 12150 | $opt_debug | ||
2526 | 12151 | my_outputname="$1" | ||
2527 | 12152 | my_originator="$2" | ||
2528 | 12153 | my_pic_p="${3-no}" | ||
2529 | 12154 | my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` | ||
2530 | 12155 | my_dlsyms= | ||
2531 | 12156 | |||
2532 | 12157 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then | ||
2533 | 12158 | if test -n "$NM" && test -n "$global_symbol_pipe"; then | ||
2534 | 12159 | my_dlsyms="${my_outputname}S.c" | ||
2535 | 12160 | else | ||
2536 | 12161 | func_error "not configured to extract global symbols from dlpreopened files" | ||
2537 | 12162 | fi | ||
2538 | 12163 | fi | ||
2539 | 12164 | |||
2540 | 12165 | if test -n "$my_dlsyms"; then | ||
2541 | 12166 | case $my_dlsyms in | ||
2542 | 12167 | "") ;; | ||
2543 | 12168 | *.c) | ||
2544 | 12169 | # Discover the nlist of each of the dlfiles. | ||
2545 | 12170 | nlist="$output_objdir/${my_outputname}.nm" | ||
2546 | 12171 | |||
2547 | 12172 | func_show_eval "$RM $nlist ${nlist}S ${nlist}T" | ||
2548 | 12173 | |||
2549 | 12174 | # Parse the name list into a source file. | ||
2550 | 12175 | func_verbose "creating $output_objdir/$my_dlsyms" | ||
2551 | 12176 | |||
2552 | 12177 | $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ | ||
2553 | 12178 | /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ | ||
2554 | 12179 | /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ | ||
2555 | 12180 | |||
2556 | 12181 | #ifdef __cplusplus | ||
2557 | 12182 | extern \"C\" { | ||
2558 | 12183 | #endif | ||
2559 | 12184 | |||
2560 | 12185 | #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) | ||
2561 | 12186 | #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" | ||
2562 | 12187 | #endif | ||
2563 | 12188 | |||
2564 | 12189 | /* External symbol declarations for the compiler. */\ | ||
2565 | 12190 | " | ||
2566 | 12191 | |||
2567 | 12192 | if test "$dlself" = yes; then | ||
2568 | 12193 | func_verbose "generating symbol list for \`$output'" | ||
2569 | 12194 | |||
2570 | 12195 | $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" | ||
2571 | 12196 | |||
2572 | 12197 | # Add our own program objects to the symbol list. | ||
2573 | 12198 | progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` | ||
2574 | 12199 | for progfile in $progfiles; do | ||
2575 | 12200 | func_verbose "extracting global C symbols from \`$progfile'" | ||
2576 | 12201 | $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" | ||
2577 | 12202 | done | ||
2578 | 12203 | |||
2579 | 12204 | if test -n "$exclude_expsyms"; then | ||
2580 | 12205 | $opt_dry_run || { | ||
2581 | 12206 | eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' | ||
2582 | 12207 | eval '$MV "$nlist"T "$nlist"' | ||
2583 | 12208 | } | ||
2584 | 12209 | fi | ||
2585 | 12210 | |||
2586 | 12211 | if test -n "$export_symbols_regex"; then | ||
2587 | 12212 | $opt_dry_run || { | ||
2588 | 12213 | eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' | ||
2589 | 12214 | eval '$MV "$nlist"T "$nlist"' | ||
2590 | 12215 | } | ||
2591 | 12216 | fi | ||
2592 | 12217 | |||
2593 | 12218 | # Prepare the list of exported symbols | ||
2594 | 12219 | if test -z "$export_symbols"; then | ||
2595 | 12220 | export_symbols="$output_objdir/$outputname.exp" | ||
2596 | 12221 | $opt_dry_run || { | ||
2597 | 12222 | $RM $export_symbols | ||
2598 | 12223 | eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' | ||
2599 | 12224 | case $host in | ||
2600 | 12225 | *cygwin* | *mingw* | *cegcc* ) | ||
2601 | 12226 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' | ||
2602 | 12227 | eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' | ||
2603 | 12228 | ;; | ||
2604 | 12229 | esac | ||
2605 | 12230 | } | ||
2606 | 12231 | else | ||
2607 | 12232 | $opt_dry_run || { | ||
2608 | 12233 | eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' | ||
2609 | 12234 | eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' | ||
2610 | 12235 | eval '$MV "$nlist"T "$nlist"' | ||
2611 | 12236 | case $host in | ||
2612 | 12237 | *cygwin* | *mingw* | *cegcc* ) | ||
2613 | 12238 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' | ||
2614 | 12239 | eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' | ||
2615 | 12240 | ;; | ||
2616 | 12241 | esac | ||
2617 | 12242 | } | ||
2618 | 12243 | fi | ||
2619 | 12244 | fi | ||
2620 | 12245 | |||
2621 | 12246 | for dlprefile in $dlprefiles; do | ||
2622 | 12247 | func_verbose "extracting global C symbols from \`$dlprefile'" | ||
2623 | 12248 | func_basename "$dlprefile" | ||
2624 | 12249 | name="$func_basename_result" | ||
2625 | 12250 | $opt_dry_run || { | ||
2626 | 12251 | eval '$ECHO ": $name " >> "$nlist"' | ||
2627 | 12252 | eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" | ||
2628 | 12253 | } | ||
2629 | 12254 | done | ||
2630 | 12255 | |||
2631 | 12256 | $opt_dry_run || { | ||
2632 | 12257 | # Make sure we have at least an empty file. | ||
2633 | 12258 | test -f "$nlist" || : > "$nlist" | ||
2634 | 12259 | |||
2635 | 12260 | if test -n "$exclude_expsyms"; then | ||
2636 | 12261 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T | ||
2637 | 12262 | $MV "$nlist"T "$nlist" | ||
2638 | 12263 | fi | ||
2639 | 12264 | |||
2640 | 12265 | # Try sorting and uniquifying the output. | ||
2641 | 12266 | if $GREP -v "^: " < "$nlist" | | ||
2642 | 12267 | if sort -k 3 </dev/null >/dev/null 2>&1; then | ||
2643 | 12268 | sort -k 3 | ||
2644 | 12269 | else | ||
2645 | 12270 | sort +2 | ||
2646 | 12271 | fi | | ||
2647 | 12272 | uniq > "$nlist"S; then | ||
2648 | 12273 | : | ||
2649 | 12274 | else | ||
2650 | 12275 | $GREP -v "^: " < "$nlist" > "$nlist"S | ||
2651 | 12276 | fi | ||
2652 | 12277 | |||
2653 | 12278 | if test -f "$nlist"S; then | ||
2654 | 12279 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' | ||
2655 | 12280 | else | ||
2656 | 12281 | echo '/* NONE */' >> "$output_objdir/$my_dlsyms" | ||
2657 | 12282 | fi | ||
2658 | 12283 | |||
2659 | 12284 | echo >> "$output_objdir/$my_dlsyms" "\ | ||
2660 | 12285 | |||
2661 | 12286 | /* The mapping between symbol names and symbols. */ | ||
2662 | 12287 | typedef struct { | ||
2663 | 12288 | const char *name; | ||
2664 | 12289 | void *address; | ||
2665 | 12290 | } lt_dlsymlist; | ||
2666 | 12291 | " | ||
2667 | 12292 | case $host in | ||
2668 | 12293 | *cygwin* | *mingw* | *cegcc* ) | ||
2669 | 12294 | echo >> "$output_objdir/$my_dlsyms" "\ | ||
2670 | 12295 | /* DATA imports from DLLs on WIN32 con't be const, because | ||
2671 | 12296 | runtime relocations are performed -- see ld's documentation | ||
2672 | 12297 | on pseudo-relocs. */" | ||
2673 | 12298 | lt_dlsym_const= ;; | ||
2674 | 12299 | *osf5*) | ||
2675 | 12300 | echo >> "$output_objdir/$my_dlsyms" "\ | ||
2676 | 12301 | /* This system does not cope well with relocations in const data */" | ||
2677 | 12302 | lt_dlsym_const= ;; | ||
2678 | 12303 | *) | ||
2679 | 12304 | lt_dlsym_const=const ;; | ||
2680 | 12305 | esac | ||
2681 | 12306 | |||
2682 | 12307 | echo >> "$output_objdir/$my_dlsyms" "\ | ||
2683 | 12308 | extern $lt_dlsym_const lt_dlsymlist | ||
2684 | 12309 | lt_${my_prefix}_LTX_preloaded_symbols[]; | ||
2685 | 12310 | $lt_dlsym_const lt_dlsymlist | ||
2686 | 12311 | lt_${my_prefix}_LTX_preloaded_symbols[] = | ||
2687 | 12312 | {\ | ||
2688 | 12313 | { \"$my_originator\", (void *) 0 }," | ||
2689 | 12314 | |||
2690 | 12315 | case $need_lib_prefix in | ||
2691 | 12316 | no) | ||
2692 | 12317 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" | ||
2693 | 12318 | ;; | ||
2694 | 12319 | *) | ||
2695 | 12320 | eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" | ||
2696 | 12321 | ;; | ||
2697 | 12322 | esac | ||
2698 | 12323 | echo >> "$output_objdir/$my_dlsyms" "\ | ||
2699 | 12324 | {0, (void *) 0} | ||
2700 | 12325 | }; | ||
2701 | 12326 | |||
2702 | 12327 | /* This works around a problem in FreeBSD linker */ | ||
2703 | 12328 | #ifdef FREEBSD_WORKAROUND | ||
2704 | 12329 | static const void *lt_preloaded_setup() { | ||
2705 | 12330 | return lt_${my_prefix}_LTX_preloaded_symbols; | ||
2706 | 12331 | } | ||
2707 | 12332 | #endif | ||
2708 | 12333 | |||
2709 | 12334 | #ifdef __cplusplus | ||
2710 | 12335 | } | ||
2711 | 12336 | #endif\ | ||
2712 | 12337 | " | ||
2713 | 12338 | } # !$opt_dry_run | ||
2714 | 12339 | |||
2715 | 12340 | pic_flag_for_symtable= | ||
2716 | 12341 | case "$compile_command " in | ||
2717 | 12342 | *" -static "*) ;; | ||
2718 | 12343 | *) | ||
2719 | 12344 | case $host in | ||
2720 | 12345 | # compiling the symbol table file with pic_flag works around | ||
2721 | 12346 | # a FreeBSD bug that causes programs to crash when -lm is | ||
2722 | 12347 | # linked before any other PIC object. But we must not use | ||
2723 | 12348 | # pic_flag when linking with -static. The problem exists in | ||
2724 | 12349 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. | ||
2725 | 12350 | *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) | ||
2726 | 12351 | pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; | ||
2727 | 12352 | *-*-hpux*) | ||
2728 | 12353 | pic_flag_for_symtable=" $pic_flag" ;; | ||
2729 | 12354 | *) | ||
2730 | 12355 | if test "X$my_pic_p" != Xno; then | ||
2731 | 12356 | pic_flag_for_symtable=" $pic_flag" | ||
2732 | 12357 | fi | ||
2733 | 12358 | ;; | ||
2734 | 12359 | esac | ||
2735 | 12360 | ;; | ||
2736 | 12361 | esac | ||
2737 | 12362 | symtab_cflags= | ||
2738 | 12363 | for arg in $LTCFLAGS; do | ||
2739 | 12364 | case $arg in | ||
2740 | 12365 | -pie | -fpie | -fPIE) ;; | ||
2741 | 12366 | *) symtab_cflags="$symtab_cflags $arg" ;; | ||
2742 | 12367 | esac | ||
2743 | 12368 | done | ||
2744 | 12369 | |||
2745 | 12370 | # Now compile the dynamic symbol file. | ||
2746 | 12371 | func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' | ||
2747 | 12372 | |||
2748 | 12373 | # Clean up the generated files. | ||
2749 | 12374 | func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' | ||
2750 | 12375 | |||
2751 | 12376 | # Transform the symbol file into the correct name. | ||
2752 | 12377 | symfileobj="$output_objdir/${my_outputname}S.$objext" | ||
2753 | 12378 | case $host in | ||
2754 | 12379 | *cygwin* | *mingw* | *cegcc* ) | ||
2755 | 12380 | if test -f "$output_objdir/$my_outputname.def"; then | ||
2756 | 12381 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` | ||
2757 | 12382 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` | ||
2758 | 12383 | else | ||
2759 | 12384 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` | ||
2760 | 12385 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` | ||
2761 | 12386 | fi | ||
2762 | 12387 | ;; | ||
2763 | 12388 | *) | ||
2764 | 12389 | compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` | ||
2765 | 12390 | finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` | ||
2766 | 12391 | ;; | ||
2767 | 12392 | esac | ||
2768 | 12393 | ;; | ||
2769 | 12394 | *) | ||
2770 | 12395 | func_fatal_error "unknown suffix for \`$my_dlsyms'" | ||
2771 | 12396 | ;; | ||
2772 | 12397 | esac | ||
2773 | 12398 | else | ||
2774 | 12399 | # We keep going just in case the user didn't refer to | ||
2775 | 12400 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe | ||
2776 | 12401 | # really was required. | ||
2777 | 12402 | |||
2778 | 12403 | # Nullify the symbol file. | ||
2779 | 12404 | compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` | ||
2780 | 12405 | finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` | ||
2781 | 12406 | fi | ||
2782 | 12407 | } | ||
2783 | 12408 | |||
2784 | 12409 | # func_win32_libid arg | ||
2785 | 12410 | # return the library type of file 'arg' | ||
2786 | 12411 | # | ||
2787 | 12412 | # Need a lot of goo to handle *both* DLLs and import libs | ||
2788 | 12413 | # Has to be a shell function in order to 'eat' the argument | ||
2789 | 12414 | # that is supplied when $file_magic_command is called. | ||
2790 | 12415 | # Despite the name, also deal with 64 bit binaries. | ||
2791 | 12416 | func_win32_libid () | ||
2792 | 12417 | { | ||
2793 | 12418 | $opt_debug | ||
2794 | 12419 | win32_libid_type="unknown" | ||
2795 | 12420 | win32_fileres=`file -L $1 2>/dev/null` | ||
2796 | 12421 | case $win32_fileres in | ||
2797 | 12422 | *ar\ archive\ import\ library*) # definitely import | ||
2798 | 12423 | win32_libid_type="x86 archive import" | ||
2799 | 12424 | ;; | ||
2800 | 12425 | *ar\ archive*) # could be an import, or static | ||
2801 | 12426 | # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. | ||
2802 | 12427 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | | ||
2803 | 12428 | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then | ||
2804 | 12429 | win32_nmres=`eval $NM -f posix -A $1 | | ||
2805 | 12430 | $SED -n -e ' | ||
2806 | 12431 | 1,100{ | ||
2807 | 12432 | / I /{ | ||
2808 | 12433 | s,.*,import, | ||
2809 | 12434 | p | ||
2810 | 12435 | q | ||
2811 | 12436 | } | ||
2812 | 12437 | }'` | ||
2813 | 12438 | case $win32_nmres in | ||
2814 | 12439 | import*) win32_libid_type="x86 archive import";; | ||
2815 | 12440 | *) win32_libid_type="x86 archive static";; | ||
2816 | 12441 | esac | ||
2817 | 12442 | fi | ||
2818 | 12443 | ;; | ||
2819 | 12444 | *DLL*) | ||
2820 | 12445 | win32_libid_type="x86 DLL" | ||
2821 | 12446 | ;; | ||
2822 | 12447 | *executable*) # but shell scripts are "executable" too... | ||
2823 | 12448 | case $win32_fileres in | ||
2824 | 12449 | *MS\ Windows\ PE\ Intel*) | ||
2825 | 12450 | win32_libid_type="x86 DLL" | ||
2826 | 12451 | ;; | ||
2827 | 12452 | esac | ||
2828 | 12453 | ;; | ||
2829 | 12454 | esac | ||
2830 | 12455 | $ECHO "$win32_libid_type" | ||
2831 | 12456 | } | ||
2832 | 12457 | |||
2833 | 12458 | |||
2834 | 12459 | |||
2835 | 12460 | # func_extract_an_archive dir oldlib | ||
2836 | 12461 | func_extract_an_archive () | ||
2837 | 12462 | { | ||
2838 | 12463 | $opt_debug | ||
2839 | 12464 | f_ex_an_ar_dir="$1"; shift | ||
2840 | 12465 | f_ex_an_ar_oldlib="$1" | ||
2841 | 12466 | if test "$lock_old_archive_extraction" = yes; then | ||
2842 | 12467 | lockfile=$f_ex_an_ar_oldlib.lock | ||
2843 | 12468 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do | ||
2844 | 12469 | func_echo "Waiting for $lockfile to be removed" | ||
2845 | 12470 | sleep 2 | ||
2846 | 12471 | done | ||
2847 | 12472 | fi | ||
2848 | 12473 | func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ | ||
2849 | 12474 | 'stat=$?; rm -f "$lockfile"; exit $stat' | ||
2850 | 12475 | if test "$lock_old_archive_extraction" = yes; then | ||
2851 | 12476 | $opt_dry_run || rm -f "$lockfile" | ||
2852 | 12477 | fi | ||
2853 | 12478 | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then | ||
2854 | 12479 | : | ||
2855 | 12480 | else | ||
2856 | 12481 | func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" | ||
2857 | 12482 | fi | ||
2858 | 12483 | } | ||
2859 | 12484 | |||
2860 | 12485 | |||
2861 | 12486 | # func_extract_archives gentop oldlib ... | ||
2862 | 12487 | func_extract_archives () | ||
2863 | 12488 | { | ||
2864 | 12489 | $opt_debug | ||
2865 | 12490 | my_gentop="$1"; shift | ||
2866 | 12491 | my_oldlibs=${1+"$@"} | ||
2867 | 12492 | my_oldobjs="" | ||
2868 | 12493 | my_xlib="" | ||
2869 | 12494 | my_xabs="" | ||
2870 | 12495 | my_xdir="" | ||
2871 | 12496 | |||
2872 | 12497 | for my_xlib in $my_oldlibs; do | ||
2873 | 12498 | # Extract the objects. | ||
2874 | 12499 | case $my_xlib in | ||
2875 | 12500 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; | ||
2876 | 12501 | *) my_xabs=`pwd`"/$my_xlib" ;; | ||
2877 | 12502 | esac | ||
2878 | 12503 | func_basename "$my_xlib" | ||
2879 | 12504 | my_xlib="$func_basename_result" | ||
2880 | 12505 | my_xlib_u=$my_xlib | ||
2881 | 12506 | while :; do | ||
2882 | 12507 | case " $extracted_archives " in | ||
2883 | 12508 | *" $my_xlib_u "*) | ||
2884 | 12509 | func_arith $extracted_serial + 1 | ||
2885 | 12510 | extracted_serial=$func_arith_result | ||
2886 | 12511 | my_xlib_u=lt$extracted_serial-$my_xlib ;; | ||
2887 | 12512 | *) break ;; | ||
2888 | 12513 | esac | ||
2889 | 12514 | done | ||
2890 | 12515 | extracted_archives="$extracted_archives $my_xlib_u" | ||
2891 | 12516 | my_xdir="$my_gentop/$my_xlib_u" | ||
2892 | 12517 | |||
2893 | 12518 | func_mkdir_p "$my_xdir" | ||
2894 | 12519 | |||
2895 | 12520 | case $host in | ||
2896 | 12521 | *-darwin*) | ||
2897 | 12522 | func_verbose "Extracting $my_xabs" | ||
2898 | 12523 | # Do not bother doing anything if just a dry run | ||
2899 | 12524 | $opt_dry_run || { | ||
2900 | 12525 | darwin_orig_dir=`pwd` | ||
2901 | 12526 | cd $my_xdir || exit $? | ||
2902 | 12527 | darwin_archive=$my_xabs | ||
2903 | 12528 | darwin_curdir=`pwd` | ||
2904 | 12529 | darwin_base_archive=`basename "$darwin_archive"` | ||
2905 | 12530 | darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` | ||
2906 | 12531 | if test -n "$darwin_arches"; then | ||
2907 | 12532 | darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` | ||
2908 | 12533 | darwin_arch= | ||
2909 | 12534 | func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" | ||
2910 | 12535 | for darwin_arch in $darwin_arches ; do | ||
2911 | 12536 | func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" | ||
2912 | 12537 | $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" | ||
2913 | 12538 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" | ||
2914 | 12539 | func_extract_an_archive "`pwd`" "${darwin_base_archive}" | ||
2915 | 12540 | cd "$darwin_curdir" | ||
2916 | 12541 | $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" | ||
2917 | 12542 | done # $darwin_arches | ||
2918 | 12543 | ## Okay now we've a bunch of thin objects, gotta fatten them up :) | ||
2919 | 12544 | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` | ||
2920 | 12545 | darwin_file= | ||
2921 | 12546 | darwin_files= | ||
2922 | 12547 | for darwin_file in $darwin_filelist; do | ||
2923 | 12548 | darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` | ||
2924 | 12549 | $LIPO -create -output "$darwin_file" $darwin_files | ||
2925 | 12550 | done # $darwin_filelist | ||
2926 | 12551 | $RM -rf unfat-$$ | ||
2927 | 12552 | cd "$darwin_orig_dir" | ||
2928 | 12553 | else | ||
2929 | 12554 | cd $darwin_orig_dir | ||
2930 | 12555 | func_extract_an_archive "$my_xdir" "$my_xabs" | ||
2931 | 12556 | fi # $darwin_arches | ||
2932 | 12557 | } # !$opt_dry_run | ||
2933 | 12558 | ;; | ||
2934 | 12559 | *) | ||
2935 | 12560 | func_extract_an_archive "$my_xdir" "$my_xabs" | ||
2936 | 12561 | ;; | ||
2937 | 12562 | esac | ||
2938 | 12563 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` | ||
2939 | 12564 | done | ||
2940 | 12565 | |||
2941 | 12566 | func_extract_archives_result="$my_oldobjs" | ||
2942 | 12567 | } | ||
2943 | 12568 | |||
2944 | 12569 | |||
2945 | 12570 | # func_emit_wrapper [arg=no] | ||
2946 | 12571 | # | ||
2947 | 12572 | # Emit a libtool wrapper script on stdout. | ||
2948 | 12573 | # Don't directly open a file because we may want to | ||
2949 | 12574 | # incorporate the script contents within a cygwin/mingw | ||
2950 | 12575 | # wrapper executable. Must ONLY be called from within | ||
2951 | 12576 | # func_mode_link because it depends on a number of variables | ||
2952 | 12577 | # set therein. | ||
2953 | 12578 | # | ||
2954 | 12579 | # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR | ||
2955 | 12580 | # variable will take. If 'yes', then the emitted script | ||
2956 | 12581 | # will assume that the directory in which it is stored is | ||
2957 | 12582 | # the $objdir directory. This is a cygwin/mingw-specific | ||
2958 | 12583 | # behavior. | ||
2959 | 12584 | func_emit_wrapper () | ||
2960 | 12585 | { | ||
2961 | 12586 | func_emit_wrapper_arg1=${1-no} | ||
2962 | 12587 | |||
2963 | 12588 | $ECHO "\ | ||
2964 | 12589 | #! $SHELL | ||
2965 | 12590 | |||
2966 | 12591 | # $output - temporary wrapper script for $objdir/$outputname | ||
2967 | 12592 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION | ||
2968 | 12593 | # | ||
2969 | 12594 | # The $output program cannot be directly executed until all the libtool | ||
2970 | 12595 | # libraries that it depends on are installed. | ||
2971 | 12596 | # | ||
2972 | 12597 | # This wrapper script should never be moved out of the build directory. | ||
2973 | 12598 | # If it is, it will not operate correctly. | ||
2974 | 12599 | |||
2975 | 12600 | # Sed substitution that helps us do robust quoting. It backslashifies | ||
2976 | 12601 | # metacharacters that are still active within double-quoted strings. | ||
2977 | 12602 | sed_quote_subst='$sed_quote_subst' | ||
2978 | 12603 | |||
2979 | 12604 | # Be Bourne compatible | ||
2980 | 12605 | if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then | ||
2981 | 12606 | emulate sh | ||
2982 | 12607 | NULLCMD=: | ||
2983 | 12608 | # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which | ||
2984 | 12609 | # is contrary to our usage. Disable this feature. | ||
2985 | 12610 | alias -g '\${1+\"\$@\"}'='\"\$@\"' | ||
2986 | 12611 | setopt NO_GLOB_SUBST | ||
2987 | 12612 | else | ||
2988 | 12613 | case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac | ||
2989 | 12614 | fi | ||
2990 | 12615 | BIN_SH=xpg4; export BIN_SH # for Tru64 | ||
2991 | 12616 | DUALCASE=1; export DUALCASE # for MKS sh | ||
2992 | 12617 | |||
2993 | 12618 | # The HP-UX ksh and POSIX shell print the target directory to stdout | ||
2994 | 12619 | # if CDPATH is set. | ||
2995 | 12620 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH | ||
2996 | 12621 | |||
2997 | 12622 | relink_command=\"$relink_command\" | ||
2998 | 12623 | |||
2999 | 12624 | # This environment variable determines our operation mode. | ||
3000 | 12625 | if test \"\$libtool_install_magic\" = \"$magic\"; then | ||
3001 | 12626 | # install mode needs the following variables: | ||
3002 | 12627 | generated_by_libtool_version='$macro_version' | ||
3003 | 12628 | notinst_deplibs='$notinst_deplibs' | ||
3004 | 12629 | else | ||
3005 | 12630 | # When we are sourced in execute mode, \$file and \$ECHO are already set. | ||
3006 | 12631 | if test \"\$libtool_execute_magic\" != \"$magic\"; then | ||
3007 | 12632 | file=\"\$0\"" | ||
3008 | 12633 | |||
3009 | 12634 | qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` | ||
3010 | 12635 | $ECHO "\ | ||
3011 | 12636 | |||
3012 | 12637 | # A function that is used when there is no print builtin or printf. | ||
3013 | 12638 | func_fallback_echo () | ||
3014 | 12639 | { | ||
3015 | 12640 | eval 'cat <<_LTECHO_EOF | ||
3016 | 12641 | \$1 | ||
3017 | 12642 | _LTECHO_EOF' | ||
3018 | 12643 | } | ||
3019 | 12644 | ECHO=\"$qECHO\" | ||
3020 | 12645 | fi | ||
3021 | 12646 | |||
3022 | 12647 | # Very basic option parsing. These options are (a) specific to | ||
3023 | 12648 | # the libtool wrapper, (b) are identical between the wrapper | ||
3024 | 12649 | # /script/ and the wrapper /executable/ which is used only on | ||
3025 | 12650 | # windows platforms, and (c) all begin with the string "--lt-" | ||
3026 | 12651 | # (application programs are unlikely to have options which match | ||
3027 | 12652 | # this pattern). | ||
3028 | 12653 | # | ||
3029 | 12654 | # There are only two supported options: --lt-debug and | ||
3030 | 12655 | # --lt-dump-script. There is, deliberately, no --lt-help. | ||
3031 | 12656 | # | ||
3032 | 12657 | # The first argument to this parsing function should be the | ||
3033 | 12658 | # script's $0 value, followed by "$@". | ||
3034 | 12659 | lt_option_debug= | ||
3035 | 12660 | func_parse_lt_options () | ||
3036 | 12661 | { | ||
3037 | 12662 | lt_script_arg0=\$0 | ||
3038 | 12663 | shift | ||
3039 | 12664 | for lt_opt | ||
3040 | 12665 | do | ||
3041 | 12666 | case \"\$lt_opt\" in | ||
3042 | 12667 | --lt-debug) lt_option_debug=1 ;; | ||
3043 | 12668 | --lt-dump-script) | ||
3044 | 12669 | lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` | ||
3045 | 12670 | test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. | ||
3046 | 12671 | lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` | ||
3047 | 12672 | cat \"\$lt_dump_D/\$lt_dump_F\" | ||
3048 | 12673 | exit 0 | ||
3049 | 12674 | ;; | ||
3050 | 12675 | --lt-*) | ||
3051 | 12676 | \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 | ||
3052 | 12677 | exit 1 | ||
3053 | 12678 | ;; | ||
3054 | 12679 | esac | ||
3055 | 12680 | done | ||
3056 | 12681 | |||
3057 | 12682 | # Print the debug banner immediately: | ||
3058 | 12683 | if test -n \"\$lt_option_debug\"; then | ||
3059 | 12684 | echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 | ||
3060 | 12685 | fi | ||
3061 | 12686 | } | ||
3062 | 12687 | |||
3063 | 12688 | # Used when --lt-debug. Prints its arguments to stdout | ||
3064 | 12689 | # (redirection is the responsibility of the caller) | ||
3065 | 12690 | func_lt_dump_args () | ||
3066 | 12691 | { | ||
3067 | 12692 | lt_dump_args_N=1; | ||
3068 | 12693 | for lt_arg | ||
3069 | 12694 | do | ||
3070 | 12695 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" | ||
3071 | 12696 | lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` | ||
3072 | 12697 | done | ||
3073 | 12698 | } | ||
3074 | 12699 | |||
3075 | 12700 | # Core function for launching the target application | ||
3076 | 12701 | func_exec_program_core () | ||
3077 | 12702 | { | ||
3078 | 12703 | " | ||
3079 | 12704 | case $host in | ||
3080 | 12705 | # Backslashes separate directories on plain windows | ||
3081 | 12706 | *-*-mingw | *-*-os2* | *-cegcc*) | ||
3082 | 12707 | $ECHO "\ | ||
3083 | 12708 | if test -n \"\$lt_option_debug\"; then | ||
3084 | 12709 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 | ||
3085 | 12710 | func_lt_dump_args \${1+\"\$@\"} 1>&2 | ||
3086 | 12711 | fi | ||
3087 | 12712 | exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} | ||
3088 | 12713 | " | ||
3089 | 12714 | ;; | ||
3090 | 12715 | |||
3091 | 12716 | *) | ||
3092 | 12717 | $ECHO "\ | ||
3093 | 12718 | if test -n \"\$lt_option_debug\"; then | ||
3094 | 12719 | \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 | ||
3095 | 12720 | func_lt_dump_args \${1+\"\$@\"} 1>&2 | ||
3096 | 12721 | fi | ||
3097 | 12722 | exec \"\$progdir/\$program\" \${1+\"\$@\"} | ||
3098 | 12723 | " | ||
3099 | 12724 | ;; | ||
3100 | 12725 | esac | ||
3101 | 12726 | $ECHO "\ | ||
3102 | 12727 | \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 | ||
3103 | 12728 | exit 1 | ||
3104 | 12729 | } | ||
3105 | 12730 | |||
3106 | 12731 | # A function to encapsulate launching the target application | ||
3107 | 12732 | # Strips options in the --lt-* namespace from \$@ and | ||
3108 | 12733 | # launches target application with the remaining arguments. | ||
3109 | 12734 | func_exec_program () | ||
3110 | 12735 | { | ||
3111 | 12736 | for lt_wr_arg | ||
3112 | 12737 | do | ||
3113 | 12738 | case \$lt_wr_arg in | ||
3114 | 12739 | --lt-*) ;; | ||
3115 | 12740 | *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; | ||
3116 | 12741 | esac | ||
3117 | 12742 | shift | ||
3118 | 12743 | done | ||
3119 | 12744 | func_exec_program_core \${1+\"\$@\"} | ||
3120 | 12745 | } | ||
3121 | 12746 | |||
3122 | 12747 | # Parse options | ||
3123 | 12748 | func_parse_lt_options \"\$0\" \${1+\"\$@\"} | ||
3124 | 12749 | |||
3125 | 12750 | # Find the directory that this script lives in. | ||
3126 | 12751 | thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` | ||
3127 | 12752 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. | ||
3128 | 12753 | |||
3129 | 12754 | # Follow symbolic links until we get to the real thisdir. | ||
3130 | 12755 | file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` | ||
3131 | 12756 | while test -n \"\$file\"; do | ||
3132 | 12757 | destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` | ||
3133 | 12758 | |||
3134 | 12759 | # If there was a directory component, then change thisdir. | ||
3135 | 12760 | if test \"x\$destdir\" != \"x\$file\"; then | ||
3136 | 12761 | case \"\$destdir\" in | ||
3137 | 12762 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; | ||
3138 | 12763 | *) thisdir=\"\$thisdir/\$destdir\" ;; | ||
3139 | 12764 | esac | ||
3140 | 12765 | fi | ||
3141 | 12766 | |||
3142 | 12767 | file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` | ||
3143 | 12768 | file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` | ||
3144 | 12769 | done | ||
3145 | 12770 | |||
3146 | 12771 | # Usually 'no', except on cygwin/mingw when embedded into | ||
3147 | 12772 | # the cwrapper. | ||
3148 | 12773 | WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 | ||
3149 | 12774 | if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then | ||
3150 | 12775 | # special case for '.' | ||
3151 | 12776 | if test \"\$thisdir\" = \".\"; then | ||
3152 | 12777 | thisdir=\`pwd\` | ||
3153 | 12778 | fi | ||
3154 | 12779 | # remove .libs from thisdir | ||
3155 | 12780 | case \"\$thisdir\" in | ||
3156 | 12781 | *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; | ||
3157 | 12782 | $objdir ) thisdir=. ;; | ||
3158 | 12783 | esac | ||
3159 | 12784 | fi | ||
3160 | 12785 | |||
3161 | 12786 | # Try to get the absolute directory name. | ||
3162 | 12787 | absdir=\`cd \"\$thisdir\" && pwd\` | ||
3163 | 12788 | test -n \"\$absdir\" && thisdir=\"\$absdir\" | ||
3164 | 12789 | " | ||
3165 | 12790 | |||
3166 | 12791 | if test "$fast_install" = yes; then | ||
3167 | 12792 | $ECHO "\ | ||
3168 | 12793 | program=lt-'$outputname'$exeext | ||
3169 | 12794 | progdir=\"\$thisdir/$objdir\" | ||
3170 | 12795 | |||
3171 | 12796 | if test ! -f \"\$progdir/\$program\" || | ||
3172 | 12797 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ | ||
3173 | 12798 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then | ||
3174 | 12799 | |||
3175 | 12800 | file=\"\$\$-\$program\" | ||
3176 | 12801 | |||
3177 | 12802 | if test ! -d \"\$progdir\"; then | ||
3178 | 12803 | $MKDIR \"\$progdir\" | ||
3179 | 12804 | else | ||
3180 | 12805 | $RM \"\$progdir/\$file\" | ||
3181 | 12806 | fi" | ||
3182 | 12807 | |||
3183 | 12808 | $ECHO "\ | ||
3184 | 12809 | |||
3185 | 12810 | # relink executable if necessary | ||
3186 | 12811 | if test -n \"\$relink_command\"; then | ||
3187 | 12812 | if relink_command_output=\`eval \$relink_command 2>&1\`; then : | ||
3188 | 12813 | else | ||
3189 | 12814 | $ECHO \"\$relink_command_output\" >&2 | ||
3190 | 12815 | $RM \"\$progdir/\$file\" | ||
3191 | 12816 | exit 1 | ||
3192 | 12817 | fi | ||
3193 | 12818 | fi | ||
3194 | 12819 | |||
3195 | 12820 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || | ||
3196 | 12821 | { $RM \"\$progdir/\$program\"; | ||
3197 | 12822 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } | ||
3198 | 12823 | $RM \"\$progdir/\$file\" | ||
3199 | 12824 | fi" | ||
3200 | 12825 | else | ||
3201 | 12826 | $ECHO "\ | ||
3202 | 12827 | program='$outputname' | ||
3203 | 12828 | progdir=\"\$thisdir/$objdir\" | ||
3204 | 12829 | " | ||
3205 | 12830 | fi | ||
3206 | 12831 | |||
3207 | 12832 | $ECHO "\ | ||
3208 | 12833 | |||
3209 | 12834 | if test -f \"\$progdir/\$program\"; then" | ||
3210 | 12835 | |||
3211 | 12836 | # Export our shlibpath_var if we have one. | ||
3212 | 12837 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then | ||
3213 | 12838 | $ECHO "\ | ||
3214 | 12839 | # Add our own library path to $shlibpath_var | ||
3215 | 12840 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" | ||
3216 | 12841 | |||
3217 | 12842 | # Some systems cannot cope with colon-terminated $shlibpath_var | ||
3218 | 12843 | # The second colon is a workaround for a bug in BeOS R4 sed | ||
3219 | 12844 | $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` | ||
3220 | 12845 | |||
3221 | 12846 | export $shlibpath_var | ||
3222 | 12847 | " | ||
3223 | 12848 | fi | ||
3224 | 12849 | |||
3225 | 12850 | # fixup the dll searchpath if we need to. | ||
3226 | 12851 | if test -n "$dllsearchpath"; then | ||
3227 | 12852 | $ECHO "\ | ||
3228 | 12853 | # Add the dll search path components to the executable PATH | ||
3229 | 12854 | PATH=$dllsearchpath:\$PATH | ||
3230 | 12855 | " | ||
3231 | 12856 | fi | ||
3232 | 12857 | |||
3233 | 12858 | $ECHO "\ | ||
3234 | 12859 | if test \"\$libtool_execute_magic\" != \"$magic\"; then | ||
3235 | 12860 | # Run the actual program with our arguments. | ||
3236 | 12861 | func_exec_program \${1+\"\$@\"} | ||
3237 | 12862 | fi | ||
3238 | 12863 | else | ||
3239 | 12864 | # The program doesn't exist. | ||
3240 | 12865 | \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 | ||
3241 | 12866 | \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 | ||
3242 | 12867 | \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 | ||
3243 | 12868 | exit 1 | ||
3244 | 12869 | fi | ||
3245 | 12870 | fi\ | ||
3246 | 12871 | " | ||
3247 | 12872 | } | ||
3248 | 12873 | |||
3249 | 12874 | |||
3250 | 12875 | # func_to_host_path arg | ||
3251 | 12876 | # | ||
3252 | 12877 | # Convert paths to host format when used with build tools. | ||
3253 | 12878 | # Intended for use with "native" mingw (where libtool itself | ||
3254 | 12879 | # is running under the msys shell), or in the following cross- | ||
3255 | 12880 | # build environments: | ||
3256 | 12881 | # $build $host | ||
3257 | 12882 | # mingw (msys) mingw [e.g. native] | ||
3258 | 12883 | # cygwin mingw | ||
3259 | 12884 | # *nix + wine mingw | ||
3260 | 12885 | # where wine is equipped with the `winepath' executable. | ||
3261 | 12886 | # In the native mingw case, the (msys) shell automatically | ||
3262 | 12887 | # converts paths for any non-msys applications it launches, | ||
3263 | 12888 | # but that facility isn't available from inside the cwrapper. | ||
3264 | 12889 | # Similar accommodations are necessary for $host mingw and | ||
3265 | 12890 | # $build cygwin. Calling this function does no harm for other | ||
3266 | 12891 | # $host/$build combinations not listed above. | ||
3267 | 12892 | # | ||
3268 | 12893 | # ARG is the path (on $build) that should be converted to | ||
3269 | 12894 | # the proper representation for $host. The result is stored | ||
3270 | 12895 | # in $func_to_host_path_result. | ||
3271 | 12896 | func_to_host_path () | ||
3272 | 12897 | { | ||
3273 | 12898 | func_to_host_path_result="$1" | ||
3274 | 12899 | if test -n "$1"; then | ||
3275 | 12900 | case $host in | ||
3276 | 12901 | *mingw* ) | ||
3277 | 12902 | lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' | ||
3278 | 12903 | case $build in | ||
3279 | 12904 | *mingw* ) # actually, msys | ||
3280 | 12905 | # awkward: cmd appends spaces to result | ||
3281 | 12906 | func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null | | ||
3282 | 12907 | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` | ||
3283 | 12908 | ;; | ||
3284 | 12909 | *cygwin* ) | ||
3285 | 12910 | func_to_host_path_result=`cygpath -w "$1" | | ||
3286 | 12911 | $SED -e "$lt_sed_naive_backslashify"` | ||
3287 | 12912 | ;; | ||
3288 | 12913 | * ) | ||
3289 | 12914 | # Unfortunately, winepath does not exit with a non-zero | ||
3290 | 12915 | # error code, so we are forced to check the contents of | ||
3291 | 12916 | # stdout. On the other hand, if the command is not | ||
3292 | 12917 | # found, the shell will set an exit code of 127 and print | ||
3293 | 12918 | # *an error message* to stdout. So we must check for both | ||
3294 | 12919 | # error code of zero AND non-empty stdout, which explains | ||
3295 | 12920 | # the odd construction: | ||
3296 | 12921 | func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` | ||
3297 | 12922 | if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then | ||
3298 | 12923 | func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" | | ||
3299 | 12924 | $SED -e "$lt_sed_naive_backslashify"` | ||
3300 | 12925 | else | ||
3301 | 12926 | # Allow warning below. | ||
3302 | 12927 | func_to_host_path_result= | ||
3303 | 12928 | fi | ||
3304 | 12929 | ;; | ||
3305 | 12930 | esac | ||
3306 | 12931 | if test -z "$func_to_host_path_result" ; then | ||
3307 | 12932 | func_error "Could not determine host path corresponding to" | ||
3308 | 12933 | func_error " \`$1'" | ||
3309 | 12934 | func_error "Continuing, but uninstalled executables may not work." | ||
3310 | 12935 | # Fallback: | ||
3311 | 12936 | func_to_host_path_result="$1" | ||
3312 | 12937 | fi | ||
3313 | 12938 | ;; | ||
3314 | 12939 | esac | ||
3315 | 12940 | fi | ||
3316 | 12941 | } | ||
3317 | 12942 | # end: func_to_host_path | ||
3318 | 12943 | |||
3319 | 12944 | # func_to_host_pathlist arg | ||
3320 | 12945 | # | ||
3321 | 12946 | # Convert pathlists to host format when used with build tools. | ||
3322 | 12947 | # See func_to_host_path(), above. This function supports the | ||
3323 | 12948 | # following $build/$host combinations (but does no harm for | ||
3324 | 12949 | # combinations not listed here): | ||
3325 | 12950 | # $build $host | ||
3326 | 12951 | # mingw (msys) mingw [e.g. native] | ||
3327 | 12952 | # cygwin mingw | ||
3328 | 12953 | # *nix + wine mingw | ||
3329 | 12954 | # | ||
3330 | 12955 | # Path separators are also converted from $build format to | ||
3331 | 12956 | # $host format. If ARG begins or ends with a path separator | ||
3332 | 12957 | # character, it is preserved (but converted to $host format) | ||
3333 | 12958 | # on output. | ||
3334 | 12959 | # | ||
3335 | 12960 | # ARG is a pathlist (on $build) that should be converted to | ||
3336 | 12961 | # the proper representation on $host. The result is stored | ||
3337 | 12962 | # in $func_to_host_pathlist_result. | ||
3338 | 12963 | func_to_host_pathlist () | ||
3339 | 12964 | { | ||
3340 | 12965 | func_to_host_pathlist_result="$1" | ||
3341 | 12966 | if test -n "$1"; then | ||
3342 | 12967 | case $host in | ||
3343 | 12968 | *mingw* ) | ||
3344 | 12969 | lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' | ||
3345 | 12970 | # Remove leading and trailing path separator characters from | ||
3346 | 12971 | # ARG. msys behavior is inconsistent here, cygpath turns them | ||
3347 | 12972 | # into '.;' and ';.', and winepath ignores them completely. | ||
3348 | 12973 | func_stripname : : "$1" | ||
3349 | 12974 | func_to_host_pathlist_tmp1=$func_stripname_result | ||
3350 | 12975 | case $build in | ||
3351 | 12976 | *mingw* ) # Actually, msys. | ||
3352 | 12977 | # Awkward: cmd appends spaces to result. | ||
3353 | 12978 | func_to_host_pathlist_result=` | ||
3354 | 12979 | ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null | | ||
3355 | 12980 | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` | ||
3356 | 12981 | ;; | ||
3357 | 12982 | *cygwin* ) | ||
3358 | 12983 | func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" | | ||
3359 | 12984 | $SED -e "$lt_sed_naive_backslashify"` | ||
3360 | 12985 | ;; | ||
3361 | 12986 | * ) | ||
3362 | 12987 | # unfortunately, winepath doesn't convert pathlists | ||
3363 | 12988 | func_to_host_pathlist_result="" | ||
3364 | 12989 | func_to_host_pathlist_oldIFS=$IFS | ||
3365 | 12990 | IFS=: | ||
3366 | 12991 | for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do | ||
3367 | 12992 | IFS=$func_to_host_pathlist_oldIFS | ||
3368 | 12993 | if test -n "$func_to_host_pathlist_f" ; then | ||
3369 | 12994 | func_to_host_path "$func_to_host_pathlist_f" | ||
3370 | 12995 | if test -n "$func_to_host_path_result" ; then | ||
3371 | 12996 | if test -z "$func_to_host_pathlist_result" ; then | ||
3372 | 12997 | func_to_host_pathlist_result="$func_to_host_path_result" | ||
3373 | 12998 | else | ||
3374 | 12999 | func_append func_to_host_pathlist_result ";$func_to_host_path_result" | ||
3375 | 13000 | fi | ||
3376 | 13001 | fi | ||
3377 | 13002 | fi | ||
3378 | 13003 | done | ||
3379 | 13004 | IFS=$func_to_host_pathlist_oldIFS | ||
3380 | 13005 | ;; | ||
3381 | 13006 | esac | ||
3382 | 13007 | if test -z "$func_to_host_pathlist_result"; then | ||
3383 | 13008 | func_error "Could not determine the host path(s) corresponding to" | ||
3384 | 13009 | func_error " \`$1'" | ||
3385 | 13010 | func_error "Continuing, but uninstalled executables may not work." | ||
3386 | 13011 | # Fallback. This may break if $1 contains DOS-style drive | ||
3387 | 13012 | # specifications. The fix is not to complicate the expression | ||
3388 | 13013 | # below, but for the user to provide a working wine installation | ||
3389 | 13014 | # with winepath so that path translation in the cross-to-mingw | ||
3390 | 13015 | # case works properly. | ||
3391 | 13016 | lt_replace_pathsep_nix_to_dos="s|:|;|g" | ||
3392 | 13017 | func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ | ||
3393 | 13018 | $SED -e "$lt_replace_pathsep_nix_to_dos"` | ||
3394 | 13019 | fi | ||
3395 | 13020 | # Now, add the leading and trailing path separators back | ||
3396 | 13021 | case "$1" in | ||
3397 | 13022 | :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" | ||
3398 | 13023 | ;; | ||
3399 | 13024 | esac | ||
3400 | 13025 | case "$1" in | ||
3401 | 13026 | *: ) func_append func_to_host_pathlist_result ";" | ||
3402 | 13027 | ;; | ||
3403 | 13028 | esac | ||
3404 | 13029 | ;; | ||
3405 | 13030 | esac | ||
3406 | 13031 | fi | ||
3407 | 13032 | } | ||
3408 | 13033 | # end: func_to_host_pathlist | ||
3409 | 13034 | |||
3410 | 13035 | # func_emit_cwrapperexe_src | ||
3411 | 13036 | # emit the source code for a wrapper executable on stdout | ||
3412 | 13037 | # Must ONLY be called from within func_mode_link because | ||
3413 | 13038 | # it depends on a number of variable set therein. | ||
3414 | 13039 | func_emit_cwrapperexe_src () | ||
3415 | 13040 | { | ||
3416 | 13041 | cat <<EOF | ||
3417 | 13042 | |||
3418 | 13043 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname | ||
3419 | 13044 | Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION | ||
3420 | 13045 | |||
3421 | 13046 | The $output program cannot be directly executed until all the libtool | ||
3422 | 13047 | libraries that it depends on are installed. | ||
3423 | 13048 | |||
3424 | 13049 | This wrapper executable should never be moved out of the build directory. | ||
3425 | 13050 | If it is, it will not operate correctly. | ||
3426 | 13051 | */ | ||
3427 | 13052 | EOF | ||
3428 | 13053 | cat <<"EOF" | ||
3429 | 13054 | #ifdef _MSC_VER | ||
3430 | 13055 | # define _CRT_SECURE_NO_DEPRECATE 1 | ||
3431 | 13056 | #endif | ||
3432 | 13057 | #include <stdio.h> | ||
3433 | 13058 | #include <stdlib.h> | ||
3434 | 13059 | #ifdef _MSC_VER | ||
3435 | 13060 | # include <direct.h> | ||
3436 | 13061 | # include <process.h> | ||
3437 | 13062 | # include <io.h> | ||
3438 | 13063 | #else | ||
3439 | 13064 | # include <unistd.h> | ||
3440 | 13065 | # include <stdint.h> | ||
3441 | 13066 | # ifdef __CYGWIN__ | ||
3442 | 13067 | # include <io.h> | ||
3443 | 13068 | # endif | ||
3444 | 13069 | #endif | ||
3445 | 13070 | #include <malloc.h> | ||
3446 | 13071 | #include <stdarg.h> | ||
3447 | 13072 | #include <assert.h> | ||
3448 | 13073 | #include <string.h> | ||
3449 | 13074 | #include <ctype.h> | ||
3450 | 13075 | #include <errno.h> | ||
3451 | 13076 | #include <fcntl.h> | ||
3452 | 13077 | #include <sys/stat.h> | ||
3453 | 13078 | |||
3454 | 13079 | /* declarations of non-ANSI functions */ | ||
3455 | 13080 | #if defined(__MINGW32__) | ||
3456 | 13081 | # ifdef __STRICT_ANSI__ | ||
3457 | 13082 | int _putenv (const char *); | ||
3458 | 13083 | # endif | ||
3459 | 13084 | #elif defined(__CYGWIN__) | ||
3460 | 13085 | # ifdef __STRICT_ANSI__ | ||
3461 | 13086 | char *realpath (const char *, char *); | ||
3462 | 13087 | int putenv (char *); | ||
3463 | 13088 | int setenv (const char *, const char *, int); | ||
3464 | 13089 | # endif | ||
3465 | 13090 | /* #elif defined (other platforms) ... */ | ||
3466 | 13091 | #endif | ||
3467 | 13092 | |||
3468 | 13093 | /* portability defines, excluding path handling macros */ | ||
3469 | 13094 | #if defined(_MSC_VER) | ||
3470 | 13095 | # define setmode _setmode | ||
3471 | 13096 | # define stat _stat | ||
3472 | 13097 | # define chmod _chmod | ||
3473 | 13098 | # define getcwd _getcwd | ||
3474 | 13099 | # define putenv _putenv | ||
3475 | 13100 | # define S_IXUSR _S_IEXEC | ||
3476 | 13101 | # ifndef _INTPTR_T_DEFINED | ||
3477 | 13102 | # define _INTPTR_T_DEFINED | ||
3478 | 13103 | # define intptr_t int | ||
3479 | 13104 | # endif | ||
3480 | 13105 | #elif defined(__MINGW32__) | ||
3481 | 13106 | # define setmode _setmode | ||
3482 | 13107 | # define stat _stat | ||
3483 | 13108 | # define chmod _chmod | ||
3484 | 13109 | # define getcwd _getcwd | ||
3485 | 13110 | # define putenv _putenv | ||
3486 | 13111 | #elif defined(__CYGWIN__) | ||
3487 | 13112 | # define HAVE_SETENV | ||
3488 | 13113 | # define FOPEN_WB "wb" | ||
3489 | 13114 | /* #elif defined (other platforms) ... */ | ||
3490 | 13115 | #endif | ||
3491 | 13116 | |||
3492 | 13117 | #if defined(PATH_MAX) | ||
3493 | 13118 | # define LT_PATHMAX PATH_MAX | ||
3494 | 13119 | #elif defined(MAXPATHLEN) | ||
3495 | 13120 | # define LT_PATHMAX MAXPATHLEN | ||
3496 | 13121 | #else | ||
3497 | 13122 | # define LT_PATHMAX 1024 | ||
3498 | 13123 | #endif | ||
3499 | 13124 | |||
3500 | 13125 | #ifndef S_IXOTH | ||
3501 | 13126 | # define S_IXOTH 0 | ||
3502 | 13127 | #endif | ||
3503 | 13128 | #ifndef S_IXGRP | ||
3504 | 13129 | # define S_IXGRP 0 | ||
3505 | 13130 | #endif | ||
3506 | 13131 | |||
3507 | 13132 | /* path handling portability macros */ | ||
3508 | 13133 | #ifndef DIR_SEPARATOR | ||
3509 | 13134 | # define DIR_SEPARATOR '/' | ||
3510 | 13135 | # define PATH_SEPARATOR ':' | ||
3511 | 13136 | #endif | ||
3512 | 13137 | |||
3513 | 13138 | #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ | ||
3514 | 13139 | defined (__OS2__) | ||
3515 | 13140 | # define HAVE_DOS_BASED_FILE_SYSTEM | ||
3516 | 13141 | # define FOPEN_WB "wb" | ||
3517 | 13142 | # ifndef DIR_SEPARATOR_2 | ||
3518 | 13143 | # define DIR_SEPARATOR_2 '\\' | ||
3519 | 13144 | # endif | ||
3520 | 13145 | # ifndef PATH_SEPARATOR_2 | ||
3521 | 13146 | # define PATH_SEPARATOR_2 ';' | ||
3522 | 13147 | # endif | ||
3523 | 13148 | #endif | ||
3524 | 13149 | |||
3525 | 13150 | #ifndef DIR_SEPARATOR_2 | ||
3526 | 13151 | # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) | ||
3527 | 13152 | #else /* DIR_SEPARATOR_2 */ | ||
3528 | 13153 | # define IS_DIR_SEPARATOR(ch) \ | ||
3529 | 13154 | (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) | ||
3530 | 13155 | #endif /* DIR_SEPARATOR_2 */ | ||
3531 | 13156 | |||
3532 | 13157 | #ifndef PATH_SEPARATOR_2 | ||
3533 | 13158 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) | ||
3534 | 13159 | #else /* PATH_SEPARATOR_2 */ | ||
3535 | 13160 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) | ||
3536 | 13161 | #endif /* PATH_SEPARATOR_2 */ | ||
3537 | 13162 | |||
3538 | 13163 | #ifndef FOPEN_WB | ||
3539 | 13164 | # define FOPEN_WB "w" | ||
3540 | 13165 | #endif | ||
3541 | 13166 | #ifndef _O_BINARY | ||
3542 | 13167 | # define _O_BINARY 0 | ||
3543 | 13168 | #endif | ||
3544 | 13169 | |||
3545 | 13170 | #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) | ||
3546 | 13171 | #define XFREE(stale) do { \ | ||
3547 | 13172 | if (stale) { free ((void *) stale); stale = 0; } \ | ||
3548 | 13173 | } while (0) | ||
3549 | 13174 | |||
3550 | 13175 | #if defined(LT_DEBUGWRAPPER) | ||
3551 | 13176 | static int lt_debug = 1; | ||
3552 | 13177 | #else | ||
3553 | 13178 | static int lt_debug = 0; | ||
3554 | 13179 | #endif | ||
3555 | 13180 | |||
3556 | 13181 | const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ | ||
3557 | 13182 | |||
3558 | 13183 | void *xmalloc (size_t num); | ||
3559 | 13184 | char *xstrdup (const char *string); | ||
3560 | 13185 | const char *base_name (const char *name); | ||
3561 | 13186 | char *find_executable (const char *wrapper); | ||
3562 | 13187 | char *chase_symlinks (const char *pathspec); | ||
3563 | 13188 | int make_executable (const char *path); | ||
3564 | 13189 | int check_executable (const char *path); | ||
3565 | 13190 | char *strendzap (char *str, const char *pat); | ||
3566 | 13191 | void lt_debugprintf (const char *file, int line, const char *fmt, ...); | ||
3567 | 13192 | void lt_fatal (const char *file, int line, const char *message, ...); | ||
3568 | 13193 | static const char *nonnull (const char *s); | ||
3569 | 13194 | static const char *nonempty (const char *s); | ||
3570 | 13195 | void lt_setenv (const char *name, const char *value); | ||
3571 | 13196 | char *lt_extend_str (const char *orig_value, const char *add, int to_end); | ||
3572 | 13197 | void lt_update_exe_path (const char *name, const char *value); | ||
3573 | 13198 | void lt_update_lib_path (const char *name, const char *value); | ||
3574 | 13199 | char **prepare_spawn (char **argv); | ||
3575 | 13200 | void lt_dump_script (FILE *f); | ||
3576 | 13201 | EOF | ||
3577 | 13202 | |||
3578 | 13203 | cat <<EOF | ||
3579 | 13204 | const char * MAGIC_EXE = "$magic_exe"; | ||
3580 | 13205 | const char * LIB_PATH_VARNAME = "$shlibpath_var"; | ||
3581 | 13206 | EOF | ||
3582 | 13207 | |||
3583 | 13208 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then | ||
3584 | 13209 | func_to_host_pathlist "$temp_rpath" | ||
3585 | 13210 | cat <<EOF | ||
3586 | 13211 | const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; | ||
3587 | 13212 | EOF | ||
3588 | 13213 | else | ||
3589 | 13214 | cat <<"EOF" | ||
3590 | 13215 | const char * LIB_PATH_VALUE = ""; | ||
3591 | 13216 | EOF | ||
3592 | 13217 | fi | ||
3593 | 13218 | |||
3594 | 13219 | if test -n "$dllsearchpath"; then | ||
3595 | 13220 | func_to_host_pathlist "$dllsearchpath:" | ||
3596 | 13221 | cat <<EOF | ||
3597 | 13222 | const char * EXE_PATH_VARNAME = "PATH"; | ||
3598 | 13223 | const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; | ||
3599 | 13224 | EOF | ||
3600 | 13225 | else | ||
3601 | 13226 | cat <<"EOF" | ||
3602 | 13227 | const char * EXE_PATH_VARNAME = ""; | ||
3603 | 13228 | const char * EXE_PATH_VALUE = ""; | ||
3604 | 13229 | EOF | ||
3605 | 13230 | fi | ||
3606 | 13231 | |||
3607 | 13232 | if test "$fast_install" = yes; then | ||
3608 | 13233 | cat <<EOF | ||
3609 | 13234 | const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ | ||
3610 | 13235 | EOF | ||
3611 | 13236 | else | ||
3612 | 13237 | cat <<EOF | ||
3613 | 13238 | const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ | ||
3614 | 13239 | EOF | ||
3615 | 13240 | fi | ||
3616 | 13241 | |||
3617 | 13242 | |||
3618 | 13243 | cat <<"EOF" | ||
3619 | 13244 | |||
3620 | 13245 | #define LTWRAPPER_OPTION_PREFIX "--lt-" | ||
3621 | 13246 | |||
3622 | 13247 | static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; | ||
3623 | 13248 | static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; | ||
3624 | 13249 | static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; | ||
3625 | 13250 | |||
3626 | 13251 | int | ||
3627 | 13252 | main (int argc, char *argv[]) | ||
3628 | 13253 | { | ||
3629 | 13254 | char **newargz; | ||
3630 | 13255 | int newargc; | ||
3631 | 13256 | char *tmp_pathspec; | ||
3632 | 13257 | char *actual_cwrapper_path; | ||
3633 | 13258 | char *actual_cwrapper_name; | ||
3634 | 13259 | char *target_name; | ||
3635 | 13260 | char *lt_argv_zero; | ||
3636 | 13261 | intptr_t rval = 127; | ||
3637 | 13262 | |||
3638 | 13263 | int i; | ||
3639 | 13264 | |||
3640 | 13265 | program_name = (char *) xstrdup (base_name (argv[0])); | ||
3641 | 13266 | newargz = XMALLOC (char *, argc + 1); | ||
3642 | 13267 | |||
3643 | 13268 | /* very simple arg parsing; don't want to rely on getopt | ||
3644 | 13269 | * also, copy all non cwrapper options to newargz, except | ||
3645 | 13270 | * argz[0], which is handled differently | ||
3646 | 13271 | */ | ||
3647 | 13272 | newargc=0; | ||
3648 | 13273 | for (i = 1; i < argc; i++) | ||
3649 | 13274 | { | ||
3650 | 13275 | if (strcmp (argv[i], dumpscript_opt) == 0) | ||
3651 | 13276 | { | ||
3652 | 13277 | EOF | ||
3653 | 13278 | case "$host" in | ||
3654 | 13279 | *mingw* | *cygwin* ) | ||
3655 | 13280 | # make stdout use "unix" line endings | ||
3656 | 13281 | echo " setmode(1,_O_BINARY);" | ||
3657 | 13282 | ;; | ||
3658 | 13283 | esac | ||
3659 | 13284 | |||
3660 | 13285 | cat <<"EOF" | ||
3661 | 13286 | lt_dump_script (stdout); | ||
3662 | 13287 | return 0; | ||
3663 | 13288 | } | ||
3664 | 13289 | if (strcmp (argv[i], debug_opt) == 0) | ||
3665 | 13290 | { | ||
3666 | 13291 | lt_debug = 1; | ||
3667 | 13292 | continue; | ||
3668 | 13293 | } | ||
3669 | 13294 | if (strcmp (argv[i], ltwrapper_option_prefix) == 0) | ||
3670 | 13295 | { | ||
3671 | 13296 | /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX | ||
3672 | 13297 | namespace, but it is not one of the ones we know about and | ||
3673 | 13298 | have already dealt with, above (inluding dump-script), then | ||
3674 | 13299 | report an error. Otherwise, targets might begin to believe | ||
3675 | 13300 | they are allowed to use options in the LTWRAPPER_OPTION_PREFIX | ||
3676 | 13301 | namespace. The first time any user complains about this, we'll | ||
3677 | 13302 | need to make LTWRAPPER_OPTION_PREFIX a configure-time option | ||
3678 | 13303 | or a configure.ac-settable value. | ||
3679 | 13304 | */ | ||
3680 | 13305 | lt_fatal (__FILE__, __LINE__, | ||
3681 | 13306 | "unrecognized %s option: '%s'", | ||
3682 | 13307 | ltwrapper_option_prefix, argv[i]); | ||
3683 | 13308 | } | ||
3684 | 13309 | /* otherwise ... */ | ||
3685 | 13310 | newargz[++newargc] = xstrdup (argv[i]); | ||
3686 | 13311 | } | ||
3687 | 13312 | newargz[++newargc] = NULL; | ||
3688 | 13313 | |||
3689 | 13314 | EOF | ||
3690 | 13315 | cat <<EOF | ||
3691 | 13316 | /* The GNU banner must be the first non-error debug message */ | ||
3692 | 13317 | lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); | ||
3693 | 13318 | EOF | ||
3694 | 13319 | cat <<"EOF" | ||
3695 | 13320 | lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); | ||
3696 | 13321 | lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); | ||
3697 | 13322 | |||
3698 | 13323 | tmp_pathspec = find_executable (argv[0]); | ||
3699 | 13324 | if (tmp_pathspec == NULL) | ||
3700 | 13325 | lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); | ||
3701 | 13326 | lt_debugprintf (__FILE__, __LINE__, | ||
3702 | 13327 | "(main) found exe (before symlink chase) at: %s\n", | ||
3703 | 13328 | tmp_pathspec); | ||
3704 | 13329 | |||
3705 | 13330 | actual_cwrapper_path = chase_symlinks (tmp_pathspec); | ||
3706 | 13331 | lt_debugprintf (__FILE__, __LINE__, | ||
3707 | 13332 | "(main) found exe (after symlink chase) at: %s\n", | ||
3708 | 13333 | actual_cwrapper_path); | ||
3709 | 13334 | XFREE (tmp_pathspec); | ||
3710 | 13335 | |||
3711 | 13336 | actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); | ||
3712 | 13337 | strendzap (actual_cwrapper_path, actual_cwrapper_name); | ||
3713 | 13338 | |||
3714 | 13339 | /* wrapper name transforms */ | ||
3715 | 13340 | strendzap (actual_cwrapper_name, ".exe"); | ||
3716 | 13341 | tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); | ||
3717 | 13342 | XFREE (actual_cwrapper_name); | ||
3718 | 13343 | actual_cwrapper_name = tmp_pathspec; | ||
3719 | 13344 | tmp_pathspec = 0; | ||
3720 | 13345 | |||
3721 | 13346 | /* target_name transforms -- use actual target program name; might have lt- prefix */ | ||
3722 | 13347 | target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); | ||
3723 | 13348 | strendzap (target_name, ".exe"); | ||
3724 | 13349 | tmp_pathspec = lt_extend_str (target_name, ".exe", 1); | ||
3725 | 13350 | XFREE (target_name); | ||
3726 | 13351 | target_name = tmp_pathspec; | ||
3727 | 13352 | tmp_pathspec = 0; | ||
3728 | 13353 | |||
3729 | 13354 | lt_debugprintf (__FILE__, __LINE__, | ||
3730 | 13355 | "(main) libtool target name: %s\n", | ||
3731 | 13356 | target_name); | ||
3732 | 13357 | EOF | ||
3733 | 13358 | |||
3734 | 13359 | cat <<EOF | ||
3735 | 13360 | newargz[0] = | ||
3736 | 13361 | XMALLOC (char, (strlen (actual_cwrapper_path) + | ||
3737 | 13362 | strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); | ||
3738 | 13363 | strcpy (newargz[0], actual_cwrapper_path); | ||
3739 | 13364 | strcat (newargz[0], "$objdir"); | ||
3740 | 13365 | strcat (newargz[0], "/"); | ||
3741 | 13366 | EOF | ||
3742 | 13367 | |||
3743 | 13368 | cat <<"EOF" | ||
3744 | 13369 | /* stop here, and copy so we don't have to do this twice */ | ||
3745 | 13370 | tmp_pathspec = xstrdup (newargz[0]); | ||
3746 | 13371 | |||
3747 | 13372 | /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ | ||
3748 | 13373 | strcat (newargz[0], actual_cwrapper_name); | ||
3749 | 13374 | |||
3750 | 13375 | /* DO want the lt- prefix here if it exists, so use target_name */ | ||
3751 | 13376 | lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); | ||
3752 | 13377 | XFREE (tmp_pathspec); | ||
3753 | 13378 | tmp_pathspec = NULL; | ||
3754 | 13379 | EOF | ||
3755 | 13380 | |||
3756 | 13381 | case $host_os in | ||
3757 | 13382 | mingw*) | ||
3758 | 13383 | cat <<"EOF" | ||
3759 | 13384 | { | ||
3760 | 13385 | char* p; | ||
3761 | 13386 | while ((p = strchr (newargz[0], '\\')) != NULL) | ||
3762 | 13387 | { | ||
3763 | 13388 | *p = '/'; | ||
3764 | 13389 | } | ||
3765 | 13390 | while ((p = strchr (lt_argv_zero, '\\')) != NULL) | ||
3766 | 13391 | { | ||
3767 | 13392 | *p = '/'; | ||
3768 | 13393 | } | ||
3769 | 13394 | } | ||
3770 | 13395 | EOF | ||
3771 | 13396 | ;; | ||
3772 | 13397 | esac | ||
3773 | 13398 | |||
3774 | 13399 | cat <<"EOF" | ||
3775 | 13400 | XFREE (target_name); | ||
3776 | 13401 | XFREE (actual_cwrapper_path); | ||
3777 | 13402 | XFREE (actual_cwrapper_name); | ||
3778 | 13403 | |||
3779 | 13404 | lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ | ||
3780 | 13405 | lt_setenv ("DUALCASE", "1"); /* for MSK sh */ | ||
3781 | 13406 | lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); | ||
3782 | 13407 | lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); | ||
3783 | 13408 | |||
3784 | 13409 | lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", | ||
3785 | 13410 | nonnull (lt_argv_zero)); | ||
3786 | 13411 | for (i = 0; i < newargc; i++) | ||
3787 | 13412 | { | ||
3788 | 13413 | lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", | ||
3789 | 13414 | i, nonnull (newargz[i])); | ||
3790 | 13415 | } | ||
3791 | 13416 | |||
3792 | 13417 | EOF | ||
3793 | 13418 | |||
3794 | 13419 | case $host_os in | ||
3795 | 13420 | mingw*) | ||
3796 | 13421 | cat <<"EOF" | ||
3797 | 13422 | /* execv doesn't actually work on mingw as expected on unix */ | ||
3798 | 13423 | newargz = prepare_spawn (newargz); | ||
3799 | 13424 | rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); | ||
3800 | 13425 | if (rval == -1) | ||
3801 | 13426 | { | ||
3802 | 13427 | /* failed to start process */ | ||
3803 | 13428 | lt_debugprintf (__FILE__, __LINE__, | ||
3804 | 13429 | "(main) failed to launch target \"%s\": %s\n", | ||
3805 | 13430 | lt_argv_zero, nonnull (strerror (errno))); | ||
3806 | 13431 | return 127; | ||
3807 | 13432 | } | ||
3808 | 13433 | return rval; | ||
3809 | 13434 | EOF | ||
3810 | 13435 | ;; | ||
3811 | 13436 | *) | ||
3812 | 13437 | cat <<"EOF" | ||
3813 | 13438 | execv (lt_argv_zero, newargz); | ||
3814 | 13439 | return rval; /* =127, but avoids unused variable warning */ | ||
3815 | 13440 | EOF | ||
3816 | 13441 | ;; | ||
3817 | 13442 | esac | ||
3818 | 13443 | |||
3819 | 13444 | cat <<"EOF" | ||
3820 | 13445 | } | ||
3821 | 13446 | |||
3822 | 13447 | void * | ||
3823 | 13448 | xmalloc (size_t num) | ||
3824 | 13449 | { | ||
3825 | 13450 | void *p = (void *) malloc (num); | ||
3826 | 13451 | if (!p) | ||
3827 | 13452 | lt_fatal (__FILE__, __LINE__, "memory exhausted"); | ||
3828 | 13453 | |||
3829 | 13454 | return p; | ||
3830 | 13455 | } | ||
3831 | 13456 | |||
3832 | 13457 | char * | ||
3833 | 13458 | xstrdup (const char *string) | ||
3834 | 13459 | { | ||
3835 | 13460 | return string ? strcpy ((char *) xmalloc (strlen (string) + 1), | ||
3836 | 13461 | string) : NULL; | ||
3837 | 13462 | } | ||
3838 | 13463 | |||
3839 | 13464 | const char * | ||
3840 | 13465 | base_name (const char *name) | ||
3841 | 13466 | { | ||
3842 | 13467 | const char *base; | ||
3843 | 13468 | |||
3844 | 13469 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) | ||
3845 | 13470 | /* Skip over the disk name in MSDOS pathnames. */ | ||
3846 | 13471 | if (isalpha ((unsigned char) name[0]) && name[1] == ':') | ||
3847 | 13472 | name += 2; | ||
3848 | 13473 | #endif | ||
3849 | 13474 | |||
3850 | 13475 | for (base = name; *name; name++) | ||
3851 | 13476 | if (IS_DIR_SEPARATOR (*name)) | ||
3852 | 13477 | base = name + 1; | ||
3853 | 13478 | return base; | ||
3854 | 13479 | } | ||
3855 | 13480 | |||
3856 | 13481 | int | ||
3857 | 13482 | check_executable (const char *path) | ||
3858 | 13483 | { | ||
3859 | 13484 | struct stat st; | ||
3860 | 13485 | |||
3861 | 13486 | lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", | ||
3862 | 13487 | nonempty (path)); | ||
3863 | 13488 | if ((!path) || (!*path)) | ||
3864 | 13489 | return 0; | ||
3865 | 13490 | |||
3866 | 13491 | if ((stat (path, &st) >= 0) | ||
3867 | 13492 | && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) | ||
3868 | 13493 | return 1; | ||
3869 | 13494 | else | ||
3870 | 13495 | return 0; | ||
3871 | 13496 | } | ||
3872 | 13497 | |||
3873 | 13498 | int | ||
3874 | 13499 | make_executable (const char *path) | ||
3875 | 13500 | { | ||
3876 | 13501 | int rval = 0; | ||
3877 | 13502 | struct stat st; | ||
3878 | 13503 | |||
3879 | 13504 | lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", | ||
3880 | 13505 | nonempty (path)); | ||
3881 | 13506 | if ((!path) || (!*path)) | ||
3882 | 13507 | return 0; | ||
3883 | 13508 | |||
3884 | 13509 | if (stat (path, &st) >= 0) | ||
3885 | 13510 | { | ||
3886 | 13511 | rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); | ||
3887 | 13512 | } | ||
3888 | 13513 | return rval; | ||
3889 | 13514 | } | ||
3890 | 13515 | |||
3891 | 13516 | /* Searches for the full path of the wrapper. Returns | ||
3892 | 13517 | newly allocated full path name if found, NULL otherwise | ||
3893 | 13518 | Does not chase symlinks, even on platforms that support them. | ||
3894 | 13519 | */ | ||
3895 | 13520 | char * | ||
3896 | 13521 | find_executable (const char *wrapper) | ||
3897 | 13522 | { | ||
3898 | 13523 | int has_slash = 0; | ||
3899 | 13524 | const char *p; | ||
3900 | 13525 | const char *p_next; | ||
3901 | 13526 | /* static buffer for getcwd */ | ||
3902 | 13527 | char tmp[LT_PATHMAX + 1]; | ||
3903 | 13528 | int tmp_len; | ||
3904 | 13529 | char *concat_name; | ||
3905 | 13530 | |||
3906 | 13531 | lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", | ||
3907 | 13532 | nonempty (wrapper)); | ||
3908 | 13533 | |||
3909 | 13534 | if ((wrapper == NULL) || (*wrapper == '\0')) | ||
3910 | 13535 | return NULL; | ||
3911 | 13536 | |||
3912 | 13537 | /* Absolute path? */ | ||
3913 | 13538 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) | ||
3914 | 13539 | if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') | ||
3915 | 13540 | { | ||
3916 | 13541 | concat_name = xstrdup (wrapper); | ||
3917 | 13542 | if (check_executable (concat_name)) | ||
3918 | 13543 | return concat_name; | ||
3919 | 13544 | XFREE (concat_name); | ||
3920 | 13545 | } | ||
3921 | 13546 | else | ||
3922 | 13547 | { | ||
3923 | 13548 | #endif | ||
3924 | 13549 | if (IS_DIR_SEPARATOR (wrapper[0])) | ||
3925 | 13550 | { | ||
3926 | 13551 | concat_name = xstrdup (wrapper); | ||
3927 | 13552 | if (check_executable (concat_name)) | ||
3928 | 13553 | return concat_name; | ||
3929 | 13554 | XFREE (concat_name); | ||
3930 | 13555 | } | ||
3931 | 13556 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) | ||
3932 | 13557 | } | ||
3933 | 13558 | #endif | ||
3934 | 13559 | |||
3935 | 13560 | for (p = wrapper; *p; p++) | ||
3936 | 13561 | if (*p == '/') | ||
3937 | 13562 | { | ||
3938 | 13563 | has_slash = 1; | ||
3939 | 13564 | break; | ||
3940 | 13565 | } | ||
3941 | 13566 | if (!has_slash) | ||
3942 | 13567 | { | ||
3943 | 13568 | /* no slashes; search PATH */ | ||
3944 | 13569 | const char *path = getenv ("PATH"); | ||
3945 | 13570 | if (path != NULL) | ||
3946 | 13571 | { | ||
3947 | 13572 | for (p = path; *p; p = p_next) | ||
3948 | 13573 | { | ||
3949 | 13574 | const char *q; | ||
3950 | 13575 | size_t p_len; | ||
3951 | 13576 | for (q = p; *q; q++) | ||
3952 | 13577 | if (IS_PATH_SEPARATOR (*q)) | ||
3953 | 13578 | break; | ||
3954 | 13579 | p_len = q - p; | ||
3955 | 13580 | p_next = (*q == '\0' ? q : q + 1); | ||
3956 | 13581 | if (p_len == 0) | ||
3957 | 13582 | { | ||
3958 | 13583 | /* empty path: current directory */ | ||
3959 | 13584 | if (getcwd (tmp, LT_PATHMAX) == NULL) | ||
3960 | 13585 | lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", | ||
3961 | 13586 | nonnull (strerror (errno))); | ||
3962 | 13587 | tmp_len = strlen (tmp); | ||
3963 | 13588 | concat_name = | ||
3964 | 13589 | XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); | ||
3965 | 13590 | memcpy (concat_name, tmp, tmp_len); | ||
3966 | 13591 | concat_name[tmp_len] = '/'; | ||
3967 | 13592 | strcpy (concat_name + tmp_len + 1, wrapper); | ||
3968 | 13593 | } | ||
3969 | 13594 | else | ||
3970 | 13595 | { | ||
3971 | 13596 | concat_name = | ||
3972 | 13597 | XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); | ||
3973 | 13598 | memcpy (concat_name, p, p_len); | ||
3974 | 13599 | concat_name[p_len] = '/'; | ||
3975 | 13600 | strcpy (concat_name + p_len + 1, wrapper); | ||
3976 | 13601 | } | ||
3977 | 13602 | if (check_executable (concat_name)) | ||
3978 | 13603 | return concat_name; | ||
3979 | 13604 | XFREE (concat_name); | ||
3980 | 13605 | } | ||
3981 | 13606 | } | ||
3982 | 13607 | /* not found in PATH; assume curdir */ | ||
3983 | 13608 | } | ||
3984 | 13609 | /* Relative path | not found in path: prepend cwd */ | ||
3985 | 13610 | if (getcwd (tmp, LT_PATHMAX) == NULL) | ||
3986 | 13611 | lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", | ||
3987 | 13612 | nonnull (strerror (errno))); | ||
3988 | 13613 | tmp_len = strlen (tmp); | ||
3989 | 13614 | concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); | ||
3990 | 13615 | memcpy (concat_name, tmp, tmp_len); | ||
3991 | 13616 | concat_name[tmp_len] = '/'; | ||
3992 | 13617 | strcpy (concat_name + tmp_len + 1, wrapper); | ||
3993 | 13618 | |||
3994 | 13619 | if (check_executable (concat_name)) | ||
3995 | 13620 | return concat_name; | ||
3996 | 13621 | XFREE (concat_name); | ||
3997 | 13622 | return NULL; | ||
3998 | 13623 | } | ||
3999 | 13624 | |||
4000 | 13625 | char * | ||
4001 | 13626 | chase_symlinks (const char *pathspec) | ||
4002 | 13627 | { | ||
4003 | 13628 | #ifndef S_ISLNK | ||
4004 | 13629 | return xstrdup (pathspec); | ||
4005 | 13630 | #else | ||
4006 | 13631 | char buf[LT_PATHMAX]; | ||
4007 | 13632 | struct stat s; | ||
4008 | 13633 | char *tmp_pathspec = xstrdup (pathspec); | ||
4009 | 13634 | char *p; | ||
4010 | 13635 | int has_symlinks = 0; | ||
4011 | 13636 | while (strlen (tmp_pathspec) && !has_symlinks) | ||
4012 | 13637 | { | ||
4013 | 13638 | lt_debugprintf (__FILE__, __LINE__, | ||
4014 | 13639 | "checking path component for symlinks: %s\n", | ||
4015 | 13640 | tmp_pathspec); | ||
4016 | 13641 | if (lstat (tmp_pathspec, &s) == 0) | ||
4017 | 13642 | { | ||
4018 | 13643 | if (S_ISLNK (s.st_mode) != 0) | ||
4019 | 13644 | { | ||
4020 | 13645 | has_symlinks = 1; | ||
4021 | 13646 | break; | ||
4022 | 13647 | } | ||
4023 | 13648 | |||
4024 | 13649 | /* search backwards for last DIR_SEPARATOR */ | ||
4025 | 13650 | p = tmp_pathspec + strlen (tmp_pathspec) - 1; | ||
4026 | 13651 | while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) | ||
4027 | 13652 | p--; | ||
4028 | 13653 | if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) | ||
4029 | 13654 | { | ||
4030 | 13655 | /* no more DIR_SEPARATORS left */ | ||
4031 | 13656 | break; | ||
4032 | 13657 | } | ||
4033 | 13658 | *p = '\0'; | ||
4034 | 13659 | } | ||
4035 | 13660 | else | ||
4036 | 13661 | { | ||
4037 | 13662 | lt_fatal (__FILE__, __LINE__, | ||
4038 | 13663 | "error accessing file \"%s\": %s", | ||
4039 | 13664 | tmp_pathspec, nonnull (strerror (errno))); | ||
4040 | 13665 | } | ||
4041 | 13666 | } | ||
4042 | 13667 | XFREE (tmp_pathspec); | ||
4043 | 13668 | |||
4044 | 13669 | if (!has_symlinks) | ||
4045 | 13670 | { | ||
4046 | 13671 | return xstrdup (pathspec); | ||
4047 | 13672 | } | ||
4048 | 13673 | |||
4049 | 13674 | tmp_pathspec = realpath (pathspec, buf); | ||
4050 | 13675 | if (tmp_pathspec == 0) | ||
4051 | 13676 | { | ||
4052 | 13677 | lt_fatal (__FILE__, __LINE__, | ||
4053 | 13678 | "could not follow symlinks for %s", pathspec); | ||
4054 | 13679 | } | ||
4055 | 13680 | return xstrdup (tmp_pathspec); | ||
4056 | 13681 | #endif | ||
4057 | 13682 | } | ||
4058 | 13683 | |||
4059 | 13684 | char * | ||
4060 | 13685 | strendzap (char *str, const char *pat) | ||
4061 | 13686 | { | ||
4062 | 13687 | size_t len, patlen; | ||
4063 | 13688 | |||
4064 | 13689 | assert (str != NULL); | ||
4065 | 13690 | assert (pat != NULL); | ||
4066 | 13691 | |||
4067 | 13692 | len = strlen (str); | ||
4068 | 13693 | patlen = strlen (pat); | ||
4069 | 13694 | |||
4070 | 13695 | if (patlen <= len) | ||
4071 | 13696 | { | ||
4072 | 13697 | str += len - patlen; | ||
4073 | 13698 | if (strcmp (str, pat) == 0) | ||
4074 | 13699 | *str = '\0'; | ||
4075 | 13700 | } | ||
4076 | 13701 | return str; | ||
4077 | 13702 | } | ||
4078 | 13703 | |||
4079 | 13704 | void | ||
4080 | 13705 | lt_debugprintf (const char *file, int line, const char *fmt, ...) | ||
4081 | 13706 | { | ||
4082 | 13707 | va_list args; | ||
4083 | 13708 | if (lt_debug) | ||
4084 | 13709 | { | ||
4085 | 13710 | (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); | ||
4086 | 13711 | va_start (args, fmt); | ||
4087 | 13712 | (void) vfprintf (stderr, fmt, args); | ||
4088 | 13713 | va_end (args); | ||
4089 | 13714 | } | ||
4090 | 13715 | } | ||
4091 | 13716 | |||
4092 | 13717 | static void | ||
4093 | 13718 | lt_error_core (int exit_status, const char *file, | ||
4094 | 13719 | int line, const char *mode, | ||
4095 | 13720 | const char *message, va_list ap) | ||
4096 | 13721 | { | ||
4097 | 13722 | fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); | ||
4098 | 13723 | vfprintf (stderr, message, ap); | ||
4099 | 13724 | fprintf (stderr, ".\n"); | ||
4100 | 13725 | |||
4101 | 13726 | if (exit_status >= 0) | ||
4102 | 13727 | exit (exit_status); | ||
4103 | 13728 | } | ||
4104 | 13729 | |||
4105 | 13730 | void | ||
4106 | 13731 | lt_fatal (const char *file, int line, const char *message, ...) | ||
4107 | 13732 | { | ||
4108 | 13733 | va_list ap; | ||
4109 | 13734 | va_start (ap, message); | ||
4110 | 13735 | lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); | ||
4111 | 13736 | va_end (ap); | ||
4112 | 13737 | } | ||
4113 | 13738 | |||
4114 | 13739 | static const char * | ||
4115 | 13740 | nonnull (const char *s) | ||
4116 | 13741 | { | ||
4117 | 13742 | return s ? s : "(null)"; | ||
4118 | 13743 | } | ||
4119 | 13744 | |||
4120 | 13745 | static const char * | ||
4121 | 13746 | nonempty (const char *s) | ||
4122 | 13747 | { | ||
4123 | 13748 | return (s && !*s) ? "(empty)" : nonnull (s); | ||
4124 | 13749 | } | ||
4125 | 13750 | |||
4126 | 13751 | void | ||
4127 | 13752 | lt_setenv (const char *name, const char *value) | ||
4128 | 13753 | { | ||
4129 | 13754 | lt_debugprintf (__FILE__, __LINE__, | ||
4130 | 13755 | "(lt_setenv) setting '%s' to '%s'\n", | ||
4131 | 13756 | nonnull (name), nonnull (value)); | ||
4132 | 13757 | { | ||
4133 | 13758 | #ifdef HAVE_SETENV | ||
4134 | 13759 | /* always make a copy, for consistency with !HAVE_SETENV */ | ||
4135 | 13760 | char *str = xstrdup (value); | ||
4136 | 13761 | setenv (name, str, 1); | ||
4137 | 13762 | #else | ||
4138 | 13763 | int len = strlen (name) + 1 + strlen (value) + 1; | ||
4139 | 13764 | char *str = XMALLOC (char, len); | ||
4140 | 13765 | sprintf (str, "%s=%s", name, value); | ||
4141 | 13766 | if (putenv (str) != EXIT_SUCCESS) | ||
4142 | 13767 | { | ||
4143 | 13768 | XFREE (str); | ||
4144 | 13769 | } | ||
4145 | 13770 | #endif | ||
4146 | 13771 | } | ||
4147 | 13772 | } | ||
4148 | 13773 | |||
4149 | 13774 | char * | ||
4150 | 13775 | lt_extend_str (const char *orig_value, const char *add, int to_end) | ||
4151 | 13776 | { | ||
4152 | 13777 | char *new_value; | ||
4153 | 13778 | if (orig_value && *orig_value) | ||
4154 | 13779 | { | ||
4155 | 13780 | int orig_value_len = strlen (orig_value); | ||
4156 | 13781 | int add_len = strlen (add); | ||
4157 | 13782 | new_value = XMALLOC (char, add_len + orig_value_len + 1); | ||
4158 | 13783 | if (to_end) | ||
4159 | 13784 | { | ||
4160 | 13785 | strcpy (new_value, orig_value); | ||
4161 | 13786 | strcpy (new_value + orig_value_len, add); | ||
4162 | 13787 | } | ||
4163 | 13788 | else | ||
4164 | 13789 | { | ||
4165 | 13790 | strcpy (new_value, add); | ||
4166 | 13791 | strcpy (new_value + add_len, orig_value); | ||
4167 | 13792 | } | ||
4168 | 13793 | } | ||
4169 | 13794 | else | ||
4170 | 13795 | { | ||
4171 | 13796 | new_value = xstrdup (add); | ||
4172 | 13797 | } | ||
4173 | 13798 | return new_value; | ||
4174 | 13799 | } | ||
4175 | 13800 | |||
4176 | 13801 | void | ||
4177 | 13802 | lt_update_exe_path (const char *name, const char *value) | ||
4178 | 13803 | { | ||
4179 | 13804 | lt_debugprintf (__FILE__, __LINE__, | ||
4180 | 13805 | "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", | ||
4181 | 13806 | nonnull (name), nonnull (value)); | ||
4182 | 13807 | |||
4183 | 13808 | if (name && *name && value && *value) | ||
4184 | 13809 | { | ||
4185 | 13810 | char *new_value = lt_extend_str (getenv (name), value, 0); | ||
4186 | 13811 | /* some systems can't cope with a ':'-terminated path #' */ | ||
4187 | 13812 | int len = strlen (new_value); | ||
4188 | 13813 | while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) | ||
4189 | 13814 | { | ||
4190 | 13815 | new_value[len-1] = '\0'; | ||
4191 | 13816 | } | ||
4192 | 13817 | lt_setenv (name, new_value); | ||
4193 | 13818 | XFREE (new_value); | ||
4194 | 13819 | } | ||
4195 | 13820 | } | ||
4196 | 13821 | |||
4197 | 13822 | void | ||
4198 | 13823 | lt_update_lib_path (const char *name, const char *value) | ||
4199 | 13824 | { | ||
4200 | 13825 | lt_debugprintf (__FILE__, __LINE__, | ||
4201 | 13826 | "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", | ||
4202 | 13827 | nonnull (name), nonnull (value)); | ||
4203 | 13828 | |||
4204 | 13829 | if (name && *name && value && *value) | ||
4205 | 13830 | { | ||
4206 | 13831 | char *new_value = lt_extend_str (getenv (name), value, 0); | ||
4207 | 13832 | lt_setenv (name, new_value); | ||
4208 | 13833 | XFREE (new_value); | ||
4209 | 13834 | } | ||
4210 | 13835 | } | ||
4211 | 13836 | |||
4212 | 13837 | EOF | ||
4213 | 13838 | case $host_os in | ||
4214 | 13839 | mingw*) | ||
4215 | 13840 | cat <<"EOF" | ||
4216 | 13841 | |||
4217 | 13842 | /* Prepares an argument vector before calling spawn(). | ||
4218 | 13843 | Note that spawn() does not by itself call the command interpreter | ||
4219 | 13844 | (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : | ||
4220 | 13845 | ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); | ||
4221 | 13846 | GetVersionEx(&v); | ||
4222 | 13847 | v.dwPlatformId == VER_PLATFORM_WIN32_NT; | ||
4223 | 13848 | }) ? "cmd.exe" : "command.com"). | ||
4224 | 13849 | Instead it simply concatenates the arguments, separated by ' ', and calls | ||
4225 | 13850 | CreateProcess(). We must quote the arguments since Win32 CreateProcess() | ||
4226 | 13851 | interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a | ||
4227 | 13852 | special way: | ||
4228 | 13853 | - Space and tab are interpreted as delimiters. They are not treated as | ||
4229 | 13854 | delimiters if they are surrounded by double quotes: "...". | ||
4230 | 13855 | - Unescaped double quotes are removed from the input. Their only effect is | ||
4231 | 13856 | that within double quotes, space and tab are treated like normal | ||
4232 | 13857 | characters. | ||
4233 | 13858 | - Backslashes not followed by double quotes are not special. | ||
4234 | 13859 | - But 2*n+1 backslashes followed by a double quote become | ||
4235 | 13860 | n backslashes followed by a double quote (n >= 0): | ||
4236 | 13861 | \" -> " | ||
4237 | 13862 | \\\" -> \" | ||
4238 | 13863 | \\\\\" -> \\" | ||
4239 | 13864 | */ | ||
4240 | 13865 | #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" | ||
4241 | 13866 | #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" | ||
4242 | 13867 | char ** | ||
4243 | 13868 | prepare_spawn (char **argv) | ||
4244 | 13869 | { | ||
4245 | 13870 | size_t argc; | ||
4246 | 13871 | char **new_argv; | ||
4247 | 13872 | size_t i; | ||
4248 | 13873 | |||
4249 | 13874 | /* Count number of arguments. */ | ||
4250 | 13875 | for (argc = 0; argv[argc] != NULL; argc++) | ||
4251 | 13876 | ; | ||
4252 | 13877 | |||
4253 | 13878 | /* Allocate new argument vector. */ | ||
4254 | 13879 | new_argv = XMALLOC (char *, argc + 1); | ||
4255 | 13880 | |||
4256 | 13881 | /* Put quoted arguments into the new argument vector. */ | ||
4257 | 13882 | for (i = 0; i < argc; i++) | ||
4258 | 13883 | { | ||
4259 | 13884 | const char *string = argv[i]; | ||
4260 | 13885 | |||
4261 | 13886 | if (string[0] == '\0') | ||
4262 | 13887 | new_argv[i] = xstrdup ("\"\""); | ||
4263 | 13888 | else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) | ||
4264 | 13889 | { | ||
4265 | 13890 | int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); | ||
4266 | 13891 | size_t length; | ||
4267 | 13892 | unsigned int backslashes; | ||
4268 | 13893 | const char *s; | ||
4269 | 13894 | char *quoted_string; | ||
4270 | 13895 | char *p; | ||
4271 | 13896 | |||
4272 | 13897 | length = 0; | ||
4273 | 13898 | backslashes = 0; | ||
4274 | 13899 | if (quote_around) | ||
4275 | 13900 | length++; | ||
4276 | 13901 | for (s = string; *s != '\0'; s++) | ||
4277 | 13902 | { | ||
4278 | 13903 | char c = *s; | ||
4279 | 13904 | if (c == '"') | ||
4280 | 13905 | length += backslashes + 1; | ||
4281 | 13906 | length++; | ||
4282 | 13907 | if (c == '\\') | ||
4283 | 13908 | backslashes++; | ||
4284 | 13909 | else | ||
4285 | 13910 | backslashes = 0; | ||
4286 | 13911 | } | ||
4287 | 13912 | if (quote_around) | ||
4288 | 13913 | length += backslashes + 1; | ||
4289 | 13914 | |||
4290 | 13915 | quoted_string = XMALLOC (char, length + 1); | ||
4291 | 13916 | |||
4292 | 13917 | p = quoted_string; | ||
4293 | 13918 | backslashes = 0; | ||
4294 | 13919 | if (quote_around) | ||
4295 | 13920 | *p++ = '"'; | ||
4296 | 13921 | for (s = string; *s != '\0'; s++) | ||
4297 | 13922 | { | ||
4298 | 13923 | char c = *s; | ||
4299 | 13924 | if (c == '"') | ||
4300 | 13925 | { | ||
4301 | 13926 | unsigned int j; | ||
4302 | 13927 | for (j = backslashes + 1; j > 0; j--) | ||
4303 | 13928 | *p++ = '\\'; | ||
4304 | 13929 | } | ||
4305 | 13930 | *p++ = c; | ||
4306 | 13931 | if (c == '\\') | ||
4307 | 13932 | backslashes++; | ||
4308 | 13933 | else | ||
4309 | 13934 | backslashes = 0; | ||
4310 | 13935 | } | ||
4311 | 13936 | if (quote_around) | ||
4312 | 13937 | { | ||
4313 | 13938 | unsigned int j; | ||
4314 | 13939 | for (j = backslashes; j > 0; j--) | ||
4315 | 13940 | *p++ = '\\'; | ||
4316 | 13941 | *p++ = '"'; | ||
4317 | 13942 | } | ||
4318 | 13943 | *p = '\0'; | ||
4319 | 13944 | |||
4320 | 13945 | new_argv[i] = quoted_string; | ||
4321 | 13946 | } | ||
4322 | 13947 | else | ||
4323 | 13948 | new_argv[i] = (char *) string; | ||
4324 | 13949 | } | ||
4325 | 13950 | new_argv[argc] = NULL; | ||
4326 | 13951 | |||
4327 | 13952 | return new_argv; | ||
4328 | 13953 | } | ||
4329 | 13954 | EOF | ||
4330 | 13955 | ;; | ||
4331 | 13956 | esac | ||
4332 | 13957 | |||
4333 | 13958 | cat <<"EOF" | ||
4334 | 13959 | void lt_dump_script (FILE* f) | ||
4335 | 13960 | { | ||
4336 | 13961 | EOF | ||
4337 | 13962 | func_emit_wrapper yes | | ||
4338 | 13963 | $SED -e 's/\([\\"]\)/\\\1/g' \ | ||
4339 | 13964 | -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' | ||
4340 | 13965 | |||
4341 | 13966 | cat <<"EOF" | ||
4342 | 13967 | } | ||
4343 | 13968 | EOF | ||
4344 | 13969 | } | ||
4345 | 13970 | # end: func_emit_cwrapperexe_src | ||
4346 | 13971 | |||
4347 | 13972 | # func_win32_import_lib_p ARG | ||
4348 | 13973 | # True if ARG is an import lib, as indicated by $file_magic_cmd | ||
4349 | 13974 | func_win32_import_lib_p () | ||
4350 | 13975 | { | ||
4351 | 13976 | $opt_debug | ||
4352 | 13977 | case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in | ||
4353 | 13978 | *import*) : ;; | ||
4354 | 13979 | *) false ;; | ||
4355 | 13980 | esac | ||
4356 | 13981 | } | ||
4357 | 13982 | |||
4358 | 13983 | # func_mode_link arg... | ||
4359 | 13984 | func_mode_link () | ||
4360 | 13985 | { | ||
4361 | 13986 | $opt_debug | ||
4362 | 13987 | case $host in | ||
4363 | 13988 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) | ||
4364 | 13989 | # It is impossible to link a dll without this setting, and | ||
4365 | 13990 | # we shouldn't force the makefile maintainer to figure out | ||
4366 | 13991 | # which system we are compiling for in order to pass an extra | ||
4367 | 13992 | # flag for every libtool invocation. | ||
4368 | 13993 | # allow_undefined=no | ||
4369 | 13994 | |||
4370 | 13995 | # FIXME: Unfortunately, there are problems with the above when trying | ||
4371 | 13996 | # to make a dll which has undefined symbols, in which case not | ||
4372 | 13997 | # even a static library is built. For now, we need to specify | ||
4373 | 13998 | # -no-undefined on the libtool link line when we can be certain | ||
4374 | 13999 | # that all symbols are satisfied, otherwise we get a static library. | ||
4375 | 14000 | allow_undefined=yes | ||
4376 | 14001 | ;; | ||
4377 | 14002 | *) | ||
4378 | 14003 | allow_undefined=yes | ||
4379 | 14004 | ;; | ||
4380 | 14005 | esac | ||
4381 | 14006 | libtool_args=$nonopt | ||
4382 | 14007 | base_compile="$nonopt $@" | ||
4383 | 14008 | compile_command=$nonopt | ||
4384 | 14009 | finalize_command=$nonopt | ||
4385 | 14010 | |||
4386 | 14011 | compile_rpath= | ||
4387 | 14012 | finalize_rpath= | ||
4388 | 14013 | compile_shlibpath= | ||
4389 | 14014 | finalize_shlibpath= | ||
4390 | 14015 | convenience= | ||
4391 | 14016 | old_convenience= | ||
4392 | 14017 | deplibs= | ||
4393 | 14018 | old_deplibs= | ||
4394 | 14019 | compiler_flags= | ||
4395 | 14020 | linker_flags= | ||
4396 | 14021 | dllsearchpath= | ||
4397 | 14022 | lib_search_path=`pwd` | ||
4398 | 14023 | inst_prefix_dir= | ||
4399 | 14024 | new_inherited_linker_flags= | ||
4400 | 14025 | |||
4401 | 14026 | avoid_version=no | ||
4402 | 14027 | bindir= | ||
4403 | 14028 | dlfiles= | ||
4404 | 14029 | dlprefiles= | ||
4405 | 14030 | dlself=no | ||
4406 | 14031 | export_dynamic=no | ||
4407 | 14032 | export_symbols= | ||
4408 | 14033 | export_symbols_regex= | ||
4409 | 14034 | generated= | ||
4410 | 14035 | libobjs= | ||
4411 | 14036 | ltlibs= | ||
4412 | 14037 | module=no | ||
4413 | 14038 | no_install=no | ||
4414 | 14039 | objs= | ||
4415 | 14040 | non_pic_objects= | ||
4416 | 14041 | precious_files_regex= | ||
4417 | 14042 | prefer_static_libs=no | ||
4418 | 14043 | preload=no | ||
4419 | 14044 | prev= | ||
4420 | 14045 | prevarg= | ||
4421 | 14046 | release= | ||
4422 | 14047 | rpath= | ||
4423 | 14048 | xrpath= | ||
4424 | 14049 | perm_rpath= | ||
4425 | 14050 | temp_rpath= | ||
4426 | 14051 | thread_safe=no | ||
4427 | 14052 | vinfo= | ||
4428 | 14053 | vinfo_number=no | ||
4429 | 14054 | weak_libs= | ||
4430 | 14055 | single_module="${wl}-single_module" | ||
4431 | 14056 | func_infer_tag $base_compile | ||
4432 | 14057 | |||
4433 | 14058 | # We need to know -static, to get the right output filenames. | ||
4434 | 14059 | for arg | ||
4435 | 14060 | do | ||
4436 | 14061 | case $arg in | ||
4437 | 14062 | -shared) | ||
4438 | 14063 | test "$build_libtool_libs" != yes && \ | ||
4439 | 14064 | func_fatal_configuration "can not build a shared library" | ||
4440 | 14065 | build_old_libs=no | ||
4441 | 14066 | break | ||
4442 | 14067 | ;; | ||
4443 | 14068 | -all-static | -static | -static-libtool-libs) | ||
4444 | 14069 | case $arg in | ||
4445 | 14070 | -all-static) | ||
4446 | 14071 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then | ||
4447 | 14072 | func_warning "complete static linking is impossible in this configuration" | ||
4448 | 14073 | fi | ||
4449 | 14074 | if test -n "$link_static_flag"; then | ||
4450 | 14075 | dlopen_self=$dlopen_self_static | ||
4451 | 14076 | fi | ||
4452 | 14077 | prefer_static_libs=yes | ||
4453 | 14078 | ;; | ||
4454 | 14079 | -static) | ||
4455 | 14080 | if test -z "$pic_flag" && test -n "$link_static_flag"; then | ||
4456 | 14081 | dlopen_self=$dlopen_self_static | ||
4457 | 14082 | fi | ||
4458 | 14083 | prefer_static_libs=built | ||
4459 | 14084 | ;; | ||
4460 | 14085 | -static-libtool-libs) | ||
4461 | 14086 | if test -z "$pic_flag" && test -n "$link_static_flag"; then | ||
4462 | 14087 | dlopen_self=$dlopen_self_static | ||
4463 | 14088 | fi | ||
4464 | 14089 | prefer_static_libs=yes | ||
4465 | 14090 | ;; | ||
4466 | 14091 | esac | ||
4467 | 14092 | build_libtool_libs=no | ||
4468 | 14093 | build_old_libs=yes | ||
4469 | 14094 | break | ||
4470 | 14095 | ;; | ||
4471 | 14096 | esac | ||
4472 | 14097 | done | ||
4473 | 14098 | |||
4474 | 14099 | # See if our shared archives depend on static archives. | ||
4475 | 14100 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes | ||
4476 | 14101 | |||
4477 | 14102 | # Go through the arguments, transforming them on the way. | ||
4478 | 14103 | while test "$#" -gt 0; do | ||
4479 | 14104 | arg="$1" | ||
4480 | 14105 | shift | ||
4481 | 14106 | func_quote_for_eval "$arg" | ||
4482 | 14107 | qarg=$func_quote_for_eval_unquoted_result | ||
4483 | 14108 | func_append libtool_args " $func_quote_for_eval_result" | ||
4484 | 14109 | |||
4485 | 14110 | # If the previous option needs an argument, assign it. | ||
4486 | 14111 | if test -n "$prev"; then | ||
4487 | 14112 | case $prev in | ||
4488 | 14113 | output) | ||
4489 | 14114 | func_append compile_command " @OUTPUT@" | ||
4490 | 14115 | func_append finalize_command " @OUTPUT@" | ||
4491 | 14116 | ;; | ||
4492 | 14117 | esac | ||
4493 | 14118 | |||
4494 | 14119 | case $prev in | ||
4495 | 14120 | bindir) | ||
4496 | 14121 | bindir="$arg" | ||
4497 | 14122 | prev= | ||
4498 | 14123 | continue | ||
4499 | 14124 | ;; | ||
4500 | 14125 | dlfiles|dlprefiles) | ||
4501 | 14126 | if test "$preload" = no; then | ||
4502 | 14127 | # Add the symbol object into the linking commands. | ||
4503 | 14128 | func_append compile_command " @SYMFILE@" | ||
4504 | 14129 | func_append finalize_command " @SYMFILE@" | ||
4505 | 14130 | preload=yes | ||
4506 | 14131 | fi | ||
4507 | 14132 | case $arg in | ||
4508 | 14133 | *.la | *.lo) ;; # We handle these cases below. | ||
4509 | 14134 | force) | ||
4510 | 14135 | if test "$dlself" = no; then | ||
4511 | 14136 | dlself=needless | ||
4512 | 14137 | export_dynamic=yes | ||
4513 | 14138 | fi | ||
4514 | 14139 | prev= | ||
4515 | 14140 | continue | ||
4516 | 14141 | ;; | ||
4517 | 14142 | self) | ||
4518 | 14143 | if test "$prev" = dlprefiles; then | ||
4519 | 14144 | dlself=yes | ||
4520 | 14145 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then | ||
4521 | 14146 | dlself=yes | ||
4522 | 14147 | else | ||
4523 | 14148 | dlself=needless | ||
4524 | 14149 | export_dynamic=yes | ||
4525 | 14150 | fi | ||
4526 | 14151 | prev= | ||
4527 | 14152 | continue | ||
4528 | 14153 | ;; | ||
4529 | 14154 | *) | ||
4530 | 14155 | if test "$prev" = dlfiles; then | ||
4531 | 14156 | dlfiles="$dlfiles $arg" | ||
4532 | 14157 | else | ||
4533 | 14158 | dlprefiles="$dlprefiles $arg" | ||
4534 | 14159 | fi | ||
4535 | 14160 | prev= | ||
4536 | 14161 | continue | ||
4537 | 14162 | ;; | ||
4538 | 14163 | esac | ||
4539 | 14164 | ;; | ||
4540 | 14165 | expsyms) | ||
4541 | 14166 | export_symbols="$arg" | ||
4542 | 14167 | test -f "$arg" \ | ||
4543 | 14168 | || func_fatal_error "symbol file \`$arg' does not exist" | ||
4544 | 14169 | prev= | ||
4545 | 14170 | continue | ||
4546 | 14171 | ;; | ||
4547 | 14172 | expsyms_regex) | ||
4548 | 14173 | export_symbols_regex="$arg" | ||
4549 | 14174 | prev= | ||
4550 | 14175 | continue | ||
4551 | 14176 | ;; | ||
4552 | 14177 | framework) | ||
4553 | 14178 | case $host in | ||
4554 | 14179 | *-*-darwin*) | ||
4555 | 14180 | case "$deplibs " in | ||
4556 | 14181 | *" $qarg.ltframework "*) ;; | ||
4557 | 14182 | *) deplibs="$deplibs $qarg.ltframework" # this is fixed later | ||
4558 | 14183 | ;; | ||
4559 | 14184 | esac | ||
4560 | 14185 | ;; | ||
4561 | 14186 | esac | ||
4562 | 14187 | prev= | ||
4563 | 14188 | continue | ||
4564 | 14189 | ;; | ||
4565 | 14190 | inst_prefix) | ||
4566 | 14191 | inst_prefix_dir="$arg" | ||
4567 | 14192 | prev= | ||
4568 | 14193 | continue | ||
4569 | 14194 | ;; | ||
4570 | 14195 | objectlist) | ||
4571 | 14196 | if test -f "$arg"; then | ||
4572 | 14197 | save_arg=$arg | ||
4573 | 14198 | moreargs= | ||
4574 | 14199 | for fil in `cat "$save_arg"` | ||
4575 | 14200 | do | ||
4576 | 14201 | # moreargs="$moreargs $fil" | ||
4577 | 14202 | arg=$fil | ||
4578 | 14203 | # A libtool-controlled object. | ||
4579 | 14204 | |||
4580 | 14205 | # Check to see that this really is a libtool object. | ||
4581 | 14206 | if func_lalib_unsafe_p "$arg"; then | ||
4582 | 14207 | pic_object= | ||
4583 | 14208 | non_pic_object= | ||
4584 | 14209 | |||
4585 | 14210 | # Read the .lo file | ||
4586 | 14211 | func_source "$arg" | ||
4587 | 14212 | |||
4588 | 14213 | if test -z "$pic_object" || | ||
4589 | 14214 | test -z "$non_pic_object" || | ||
4590 | 14215 | test "$pic_object" = none && | ||
4591 | 14216 | test "$non_pic_object" = none; then | ||
4592 | 14217 | func_fatal_error "cannot find name of object for \`$arg'" | ||
4593 | 14218 | fi | ||
4594 | 14219 | |||
4595 | 14220 | # Extract subdirectory from the argument. | ||
4596 | 14221 | func_dirname "$arg" "/" "" | ||
4597 | 14222 | xdir="$func_dirname_result" | ||
4598 | 14223 | |||
4599 | 14224 | if test "$pic_object" != none; then | ||
4600 | 14225 | # Prepend the subdirectory the object is found in. | ||
4601 | 14226 | pic_object="$xdir$pic_object" | ||
4602 | 14227 | |||
4603 | 14228 | if test "$prev" = dlfiles; then | ||
4604 | 14229 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then | ||
4605 | 14230 | dlfiles="$dlfiles $pic_object" | ||
4606 | 14231 | prev= | ||
4607 | 14232 | continue | ||
4608 | 14233 | else | ||
4609 | 14234 | # If libtool objects are unsupported, then we need to preload. | ||
4610 | 14235 | prev=dlprefiles | ||
4611 | 14236 | fi | ||
4612 | 14237 | fi | ||
4613 | 14238 | |||
4614 | 14239 | # CHECK ME: I think I busted this. -Ossama | ||
4615 | 14240 | if test "$prev" = dlprefiles; then | ||
4616 | 14241 | # Preload the old-style object. | ||
4617 | 14242 | dlprefiles="$dlprefiles $pic_object" | ||
4618 | 14243 | prev= | ||
4619 | 14244 | fi | ||
4620 | 14245 | |||
4621 | 14246 | # A PIC object. | ||
4622 | 14247 | func_append libobjs " $pic_object" | ||
4623 | 14248 | arg="$pic_object" | ||
4624 | 14249 | fi | ||
4625 | 14250 | |||
4626 | 14251 | # Non-PIC object. | ||
4627 | 14252 | if test "$non_pic_object" != none; then | ||
4628 | 14253 | # Prepend the subdirectory the object is found in. | ||
4629 | 14254 | non_pic_object="$xdir$non_pic_object" | ||
4630 | 14255 | |||
4631 | 14256 | # A standard non-PIC object | ||
4632 | 14257 | func_append non_pic_objects " $non_pic_object" | ||
4633 | 14258 | if test -z "$pic_object" || test "$pic_object" = none ; then | ||
4634 | 14259 | arg="$non_pic_object" | ||
4635 | 14260 | fi | ||
4636 | 14261 | else | ||
4637 | 14262 | # If the PIC object exists, use it instead. | ||
4638 | 14263 | # $xdir was prepended to $pic_object above. | ||
4639 | 14264 | non_pic_object="$pic_object" | ||
4640 | 14265 | func_append non_pic_objects " $non_pic_object" | ||
4641 | 14266 | fi | ||
4642 | 14267 | else | ||
4643 | 14268 | # Only an error if not doing a dry-run. | ||
4644 | 14269 | if $opt_dry_run; then | ||
4645 | 14270 | # Extract subdirectory from the argument. | ||
4646 | 14271 | func_dirname "$arg" "/" "" | ||
4647 | 14272 | xdir="$func_dirname_result" | ||
4648 | 14273 | |||
4649 | 14274 | func_lo2o "$arg" | ||
4650 | 14275 | pic_object=$xdir$objdir/$func_lo2o_result | ||
4651 | 14276 | non_pic_object=$xdir$func_lo2o_result | ||
4652 | 14277 | func_append libobjs " $pic_object" | ||
4653 | 14278 | func_append non_pic_objects " $non_pic_object" | ||
4654 | 14279 | else | ||
4655 | 14280 | func_fatal_error "\`$arg' is not a valid libtool object" | ||
4656 | 14281 | fi | ||
4657 | 14282 | fi | ||
4658 | 14283 | done | ||
4659 | 14284 | else | ||
4660 | 14285 | func_fatal_error "link input file \`$arg' does not exist" | ||
4661 | 14286 | fi | ||
4662 | 14287 | arg=$save_arg | ||
4663 | 14288 | prev= | ||
4664 | 14289 | continue | ||
4665 | 14290 | ;; | ||
4666 | 14291 | precious_regex) | ||
4667 | 14292 | precious_files_regex="$arg" | ||
4668 | 14293 | prev= | ||
4669 | 14294 | continue | ||
4670 | 14295 | ;; | ||
4671 | 14296 | release) | ||
4672 | 14297 | release="-$arg" | ||
4673 | 14298 | prev= | ||
4674 | 14299 | continue | ||
4675 | 14300 | ;; | ||
4676 | 14301 | rpath | xrpath) | ||
4677 | 14302 | # We need an absolute path. | ||
4678 | 14303 | case $arg in | ||
4679 | 14304 | [\\/]* | [A-Za-z]:[\\/]*) ;; | ||
4680 | 14305 | *) | ||
4681 | 14306 | func_fatal_error "only absolute run-paths are allowed" | ||
4682 | 14307 | ;; | ||
4683 | 14308 | esac | ||
4684 | 14309 | if test "$prev" = rpath; then | ||
4685 | 14310 | case "$rpath " in | ||
4686 | 14311 | *" $arg "*) ;; | ||
4687 | 14312 | *) rpath="$rpath $arg" ;; | ||
4688 | 14313 | esac | ||
4689 | 14314 | else | ||
4690 | 14315 | case "$xrpath " in | ||
4691 | 14316 | *" $arg "*) ;; | ||
4692 | 14317 | *) xrpath="$xrpath $arg" ;; | ||
4693 | 14318 | esac | ||
4694 | 14319 | fi | ||
4695 | 14320 | prev= | ||
4696 | 14321 | continue | ||
4697 | 14322 | ;; | ||
4698 | 14323 | shrext) | ||
4699 | 14324 | shrext_cmds="$arg" | ||
4700 | 14325 | prev= | ||
4701 | 14326 | continue | ||
4702 | 14327 | ;; | ||
4703 | 14328 | weak) | ||
4704 | 14329 | weak_libs="$weak_libs $arg" | ||
4705 | 14330 | prev= | ||
4706 | 14331 | continue | ||
4707 | 14332 | ;; | ||
4708 | 14333 | xcclinker) | ||
4709 | 14334 | linker_flags="$linker_flags $qarg" | ||
4710 | 14335 | compiler_flags="$compiler_flags $qarg" | ||
4711 | 14336 | prev= | ||
4712 | 14337 | func_append compile_command " $qarg" | ||
4713 | 14338 | func_append finalize_command " $qarg" | ||
4714 | 14339 | continue | ||
4715 | 14340 | ;; | ||
4716 | 14341 | xcompiler) | ||
4717 | 14342 | compiler_flags="$compiler_flags $qarg" | ||
4718 | 14343 | prev= | ||
4719 | 14344 | func_append compile_command " $qarg" | ||
4720 | 14345 | func_append finalize_command " $qarg" | ||
4721 | 14346 | continue | ||
4722 | 14347 | ;; | ||
4723 | 14348 | xlinker) | ||
4724 | 14349 | linker_flags="$linker_flags $qarg" | ||
4725 | 14350 | compiler_flags="$compiler_flags $wl$qarg" | ||
4726 | 14351 | prev= | ||
4727 | 14352 | func_append compile_command " $wl$qarg" | ||
4728 | 14353 | func_append finalize_command " $wl$qarg" | ||
4729 | 14354 | continue | ||
4730 | 14355 | ;; | ||
4731 | 14356 | *) | ||
4732 | 14357 | eval "$prev=\"\$arg\"" | ||
4733 | 14358 | prev= | ||
4734 | 14359 | continue | ||
4735 | 14360 | ;; | ||
4736 | 14361 | esac | ||
4737 | 14362 | fi # test -n "$prev" | ||
4738 | 14363 | |||
4739 | 14364 | prevarg="$arg" | ||
4740 | 14365 | |||
4741 | 14366 | case $arg in | ||
4742 | 14367 | -all-static) | ||
4743 | 14368 | if test -n "$link_static_flag"; then | ||
4744 | 14369 | # See comment for -static flag below, for more details. | ||
4745 | 14370 | func_append compile_command " $link_static_flag" | ||
4746 | 14371 | func_append finalize_command " $link_static_flag" | ||
4747 | 14372 | fi | ||
4748 | 14373 | continue | ||
4749 | 14374 | ;; | ||
4750 | 14375 | |||
4751 | 14376 | -allow-undefined) | ||
4752 | 14377 | # FIXME: remove this flag sometime in the future. | ||
4753 | 14378 | func_fatal_error "\`-allow-undefined' must not be used because it is the default" | ||
4754 | 14379 | ;; | ||
4755 | 14380 | |||
4756 | 14381 | -avoid-version) | ||
4757 | 14382 | avoid_version=yes | ||
4758 | 14383 | continue | ||
4759 | 14384 | ;; | ||
4760 | 14385 | |||
4761 | 14386 | -bindir) | ||
4762 | 14387 | prev=bindir | ||
4763 | 14388 | continue | ||
4764 | 14389 | ;; | ||
4765 | 14390 | |||
4766 | 14391 | -dlopen) | ||
4767 | 14392 | prev=dlfiles | ||
4768 | 14393 | continue | ||
4769 | 14394 | ;; | ||
4770 | 14395 | |||
4771 | 14396 | -dlpreopen) | ||
4772 | 14397 | prev=dlprefiles | ||
4773 | 14398 | continue | ||
4774 | 14399 | ;; | ||
4775 | 14400 | |||
4776 | 14401 | -export-dynamic) | ||
4777 | 14402 | export_dynamic=yes | ||
4778 | 14403 | continue | ||
4779 | 14404 | ;; | ||
4780 | 14405 | |||
4781 | 14406 | -export-symbols | -export-symbols-regex) | ||
4782 | 14407 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then | ||
4783 | 14408 | func_fatal_error "more than one -exported-symbols argument is not allowed" | ||
4784 | 14409 | fi | ||
4785 | 14410 | if test "X$arg" = "X-export-symbols"; then | ||
4786 | 14411 | prev=expsyms | ||
4787 | 14412 | else | ||
4788 | 14413 | prev=expsyms_regex | ||
4789 | 14414 | fi | ||
4790 | 14415 | continue | ||
4791 | 14416 | ;; | ||
4792 | 14417 | |||
4793 | 14418 | -framework) | ||
4794 | 14419 | prev=framework | ||
4795 | 14420 | continue | ||
4796 | 14421 | ;; | ||
4797 | 14422 | |||
4798 | 14423 | -inst-prefix-dir) | ||
4799 | 14424 | prev=inst_prefix | ||
4800 | 14425 | continue | ||
4801 | 14426 | ;; | ||
4802 | 14427 | |||
4803 | 14428 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* | ||
4804 | 14429 | # so, if we see these flags be careful not to treat them like -L | ||
4805 | 14430 | -L[A-Z][A-Z]*:*) | ||
4806 | 14431 | case $with_gcc/$host in | ||
4807 | 14432 | no/*-*-irix* | /*-*-irix*) | ||
4808 | 14433 | func_append compile_command " $arg" | ||
4809 | 14434 | func_append finalize_command " $arg" | ||
4810 | 14435 | ;; | ||
4811 | 14436 | esac | ||
4812 | 14437 | continue | ||
4813 | 14438 | ;; | ||
4814 | 14439 | |||
4815 | 14440 | -L*) | ||
4816 | 14441 | func_stripname '-L' '' "$arg" | ||
4817 | 14442 | dir=$func_stripname_result | ||
4818 | 14443 | if test -z "$dir"; then | ||
4819 | 14444 | if test "$#" -gt 0; then | ||
4820 | 14445 | func_fatal_error "require no space between \`-L' and \`$1'" | ||
4821 | 14446 | else | ||
4822 | 14447 | func_fatal_error "need path for \`-L' option" | ||
4823 | 14448 | fi | ||
4824 | 14449 | fi | ||
4825 | 14450 | # We need an absolute path. | ||
4826 | 14451 | case $dir in | ||
4827 | 14452 | [\\/]* | [A-Za-z]:[\\/]*) ;; | ||
4828 | 14453 | *) | ||
4829 | 14454 | absdir=`cd "$dir" && pwd` | ||
4830 | 14455 | test -z "$absdir" && \ | ||
4831 | 14456 | func_fatal_error "cannot determine absolute directory name of \`$dir'" | ||
4832 | 14457 | dir="$absdir" | ||
4833 | 14458 | ;; | ||
4834 | 14459 | esac | ||
4835 | 14460 | case "$deplibs " in | ||
4836 | 14461 | *" -L$dir "*) ;; | ||
4837 | 14462 | *) | ||
4838 | 14463 | deplibs="$deplibs -L$dir" | ||
4839 | 14464 | lib_search_path="$lib_search_path $dir" | ||
4840 | 14465 | ;; | ||
4841 | 14466 | esac | ||
4842 | 14467 | case $host in | ||
4843 | 14468 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) | ||
4844 | 14469 | testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` | ||
4845 | 14470 | case :$dllsearchpath: in | ||
4846 | 14471 | *":$dir:"*) ;; | ||
4847 | 14472 | ::) dllsearchpath=$dir;; | ||
4848 | 14473 | *) dllsearchpath="$dllsearchpath:$dir";; | ||
4849 | 14474 | esac | ||
4850 | 14475 | case :$dllsearchpath: in | ||
4851 | 14476 | *":$testbindir:"*) ;; | ||
4852 | 14477 | ::) dllsearchpath=$testbindir;; | ||
4853 | 14478 | *) dllsearchpath="$dllsearchpath:$testbindir";; | ||
4854 | 14479 | esac | ||
4855 | 14480 | ;; | ||
4856 | 14481 | esac | ||
4857 | 14482 | continue | ||
4858 | 14483 | ;; | ||
4859 | 14484 | |||
4860 | 14485 | -l*) | ||
4861 | 14486 | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then | ||
4862 | 14487 | case $host in | ||
4863 | 14488 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) | ||
4864 | 14489 | # These systems don't actually have a C or math library (as such) | ||
4865 | 14490 | continue | ||
4866 | 14491 | ;; | ||
4867 | 14492 | *-*-os2*) | ||
4868 | 14493 | # These systems don't actually have a C library (as such) | ||
4869 | 14494 | test "X$arg" = "X-lc" && continue | ||
4870 | 14495 | ;; | ||
4871 | 14496 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) | ||
4872 | 14497 | # Do not include libc due to us having libc/libc_r. | ||
4873 | 14498 | test "X$arg" = "X-lc" && continue | ||
4874 | 14499 | ;; | ||
4875 | 14500 | *-*-rhapsody* | *-*-darwin1.[012]) | ||
4876 | 14501 | # Rhapsody C and math libraries are in the System framework | ||
4877 | 14502 | deplibs="$deplibs System.ltframework" | ||
4878 | 14503 | continue | ||
4879 | 14504 | ;; | ||
4880 | 14505 | *-*-sco3.2v5* | *-*-sco5v6*) | ||
4881 | 14506 | # Causes problems with __ctype | ||
4882 | 14507 | test "X$arg" = "X-lc" && continue | ||
4883 | 14508 | ;; | ||
4884 | 14509 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) | ||
4885 | 14510 | # Compiler inserts libc in the correct place for threads to work | ||
4886 | 14511 | test "X$arg" = "X-lc" && continue | ||
4887 | 14512 | ;; | ||
4888 | 14513 | esac | ||
4889 | 14514 | elif test "X$arg" = "X-lc_r"; then | ||
4890 | 14515 | case $host in | ||
4891 | 14516 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) | ||
4892 | 14517 | # Do not include libc_r directly, use -pthread flag. | ||
4893 | 14518 | continue | ||
4894 | 14519 | ;; | ||
4895 | 14520 | esac | ||
4896 | 14521 | fi | ||
4897 | 14522 | deplibs="$deplibs $arg" | ||
4898 | 14523 | continue | ||
4899 | 14524 | ;; | ||
4900 | 14525 | |||
4901 | 14526 | -module) | ||
4902 | 14527 | module=yes | ||
4903 | 14528 | continue | ||
4904 | 14529 | ;; | ||
4905 | 14530 | |||
4906 | 14531 | # Tru64 UNIX uses -model [arg] to determine the layout of C++ | ||
4907 | 14532 | # classes, name mangling, and exception handling. | ||
4908 | 14533 | # Darwin uses the -arch flag to determine output architecture. | ||
4909 | 14534 | -model|-arch|-isysroot) | ||
4910 | 14535 | compiler_flags="$compiler_flags $arg" | ||
4911 | 14536 | func_append compile_command " $arg" | ||
4912 | 14537 | func_append finalize_command " $arg" | ||
4913 | 14538 | prev=xcompiler | ||
4914 | 14539 | continue | ||
4915 | 14540 | ;; | ||
4916 | 14541 | |||
4917 | 14542 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) | ||
4918 | 14543 | compiler_flags="$compiler_flags $arg" | ||
4919 | 14544 | func_append compile_command " $arg" | ||
4920 | 14545 | func_append finalize_command " $arg" | ||
4921 | 14546 | case "$new_inherited_linker_flags " in | ||
4922 | 14547 | *" $arg "*) ;; | ||
4923 | 14548 | * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; | ||
4924 | 14549 | esac | ||
4925 | 14550 | continue | ||
4926 | 14551 | ;; | ||
4927 | 14552 | |||
4928 | 14553 | -multi_module) | ||
4929 | 14554 | single_module="${wl}-multi_module" | ||
4930 | 14555 | continue | ||
4931 | 14556 | ;; | ||
4932 | 14557 | |||
4933 | 14558 | -no-fast-install) | ||
4934 | 14559 | fast_install=no | ||
4935 | 14560 | continue | ||
4936 | 14561 | ;; | ||
4937 | 14562 | |||
4938 | 14563 | -no-install) | ||
4939 | 14564 | case $host in | ||
4940 | 14565 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) | ||
4941 | 14566 | # The PATH hackery in wrapper scripts is required on Windows | ||
4942 | 14567 | # and Darwin in order for the loader to find any dlls it needs. | ||
4943 | 14568 | func_warning "\`-no-install' is ignored for $host" | ||
4944 | 14569 | func_warning "assuming \`-no-fast-install' instead" | ||
4945 | 14570 | fast_install=no | ||
4946 | 14571 | ;; | ||
4947 | 14572 | *) no_install=yes ;; | ||
4948 | 14573 | esac | ||
4949 | 14574 | continue | ||
4950 | 14575 | ;; | ||
4951 | 14576 | |||
4952 | 14577 | -no-undefined) | ||
4953 | 14578 | allow_undefined=no | ||
4954 | 14579 | continue | ||
4955 | 14580 | ;; | ||
4956 | 14581 | |||
4957 | 14582 | -objectlist) | ||
4958 | 14583 | prev=objectlist | ||
4959 | 14584 | continue | ||
4960 | 14585 | ;; | ||
4961 | 14586 | |||
4962 | 14587 | -o) prev=output ;; | ||
4963 | 14588 | |||
4964 | 14589 | -precious-files-regex) | ||
4965 | 14590 | prev=precious_regex | ||
4966 | 14591 | continue | ||
4967 | 14592 | ;; | ||
4968 | 14593 | |||
4969 | 14594 | -release) | ||
4970 | 14595 | prev=release | ||
4971 | 14596 | continue | ||
4972 | 14597 | ;; | ||
4973 | 14598 | |||
4974 | 14599 | -rpath) | ||
4975 | 14600 | prev=rpath | ||
4976 | 14601 | continue | ||
4977 | 14602 | ;; | ||
4978 | 14603 | |||
4979 | 14604 | -R) | ||
4980 | 14605 | prev=xrpath | ||
4981 | 14606 | continue | ||
4982 | 14607 | ;; | ||
4983 | 14608 | |||
4984 | 14609 | -R*) | ||
4985 | 14610 | func_stripname '-R' '' "$arg" | ||
4986 | 14611 | dir=$func_stripname_result | ||
4987 | 14612 | # We need an absolute path. | ||
4988 | 14613 | case $dir in | ||
4989 | 14614 | [\\/]* | [A-Za-z]:[\\/]*) ;; | ||
4990 | 14615 | *) | ||
4991 | 14616 | func_fatal_error "only absolute run-paths are allowed" | ||
4992 | 14617 | ;; | ||
4993 | 14618 | esac | ||
4994 | 14619 | case "$xrpath " in | ||
4995 | 14620 | *" $dir "*) ;; | ||
4996 | 14621 | *) xrpath="$xrpath $dir" ;; | ||
4997 | 14622 | esac | ||
4998 | 14623 | continue | ||
4999 | 14624 | ;; | ||
5000 | 14625 |
The diff has been truncated for viewing.