Merge lp:~ubuntu-branches/ubuntu/oneiric/gnome-desktop3/oneiric-201109060812 into lp:ubuntu/oneiric/gnome-desktop3
- Oneiric (11.10)
- oneiric-201109060812
- Merge into oneiric
Status: | Rejected |
---|---|
Rejected by: | Colin Watson |
Proposed branch: | lp:~ubuntu-branches/ubuntu/oneiric/gnome-desktop3/oneiric-201109060812 |
Merge into: | lp:ubuntu/oneiric/gnome-desktop3 |
Diff against target: |
8433 lines (+8409/-0) (has conflicts) 4 files modified
.pc/.quilt_patches (+1/-0) .pc/.quilt_series (+1/-0) .pc/99_ltmain_as-needed.patch/ltmain.sh (+8406/-0) .pc/applied-patches (+1/-0) Conflict adding file .pc/99_ltmain_as-needed.patch. Moved existing file to .pc/99_ltmain_as-needed.patch.moved. Conflict adding file .pc/applied-patches. Moved existing file to .pc/applied-patches.moved. |
To merge this branch: | bzr merge lp:~ubuntu-branches/ubuntu/oneiric/gnome-desktop3/oneiric-201109060812 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson | Disapprove | ||
Review via email: mp+74173@code.launchpad.net |
Commit message
Description of the change
The package importer has detected a possible inconsistency between the package history in the archve and the history in bzr. As the archive is authoritative the importer has made lp:ubuntu/oneiric/gnome-desktop3 reflect what is in the archive and the old bzr branch has been pushed to lp:~ubuntu-branches/ubuntu/oneiric/gnome-desktop3/oneiric-201109060812. This merge proposal was created so that an Ubuntu developer can review the situations and perform a merge/upload if necessary. There are three typical cases where this can happen.
1. Where someone pushes a change to bzr and someone else uploads the package without that change. This is the reason that this check is done by the importer. If this appears to be the case then a merge/upload should be done if the changes that were in bzr are still desirable.
2. The importer incorrectly detected the above situation when someone made a change in bzr and then uploaded it.
3. The importer incorrectly detected the above situation when someone just uploaded a package and didn't touch bzr.
If this case doesn't appear to be the first situation then set the status of the merge proposal to "Rejected" and help avoid the problem in future by filing a bug at https:/
(this is an automatically generated message)
Unmerged revisions
- 29. By Martin Pitt
-
releasing version 3.1.91-0ubuntu1
- 28. By Martin Pitt
-
* New upstream release.
- Add GnomeWallClock
* debian/libgnome- desktop- 3-2.symbols: Updated
Preview Diff
1 | === added file '.pc/.quilt_patches' | |||
2 | --- .pc/.quilt_patches 1970-01-01 00:00:00 +0000 | |||
3 | +++ .pc/.quilt_patches 2011-09-06 08:17:24 +0000 | |||
4 | @@ -0,0 +1,1 @@ | |||
5 | 1 | debian/patches | ||
6 | 0 | 2 | ||
7 | === added file '.pc/.quilt_series' | |||
8 | --- .pc/.quilt_series 1970-01-01 00:00:00 +0000 | |||
9 | +++ .pc/.quilt_series 2011-09-06 08:17:24 +0000 | |||
10 | @@ -0,0 +1,1 @@ | |||
11 | 1 | series | ||
12 | 0 | 2 | ||
13 | === added directory '.pc/99_ltmain_as-needed.patch' | |||
14 | === renamed directory '.pc/99_ltmain_as-needed.patch' => '.pc/99_ltmain_as-needed.patch.moved' | |||
15 | === added file '.pc/99_ltmain_as-needed.patch/.timestamp' | |||
16 | === added file '.pc/99_ltmain_as-needed.patch/ltmain.sh' | |||
17 | --- .pc/99_ltmain_as-needed.patch/ltmain.sh 1970-01-01 00:00:00 +0000 | |||
18 | +++ .pc/99_ltmain_as-needed.patch/ltmain.sh 2011-09-06 08:17:24 +0000 | |||
19 | @@ -0,0 +1,8406 @@ | |||
20 | 1 | # Generated from ltmain.m4sh. | ||
21 | 2 | |||
22 | 3 | # ltmain.sh (GNU libtool) 2.2.6 | ||
23 | 4 | # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 | ||
24 | 5 | |||
25 | 6 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. | ||
26 | 7 | # This is free software; see the source for copying conditions. There is NO | ||
27 | 8 | # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
28 | 9 | |||
29 | 10 | # GNU Libtool is free software; you can redistribute it and/or modify | ||
30 | 11 | # it under the terms of the GNU General Public License as published by | ||
31 | 12 | # the Free Software Foundation; either version 2 of the License, or | ||
32 | 13 | # (at your option) any later version. | ||
33 | 14 | # | ||
34 | 15 | # As a special exception to the GNU General Public License, | ||
35 | 16 | # if you distribute this file as part of a program or library that | ||
36 | 17 | # is built using GNU Libtool, you may include this file under the | ||
37 | 18 | # same distribution terms that you use for the rest of that program. | ||
38 | 19 | # | ||
39 | 20 | # GNU Libtool is distributed in the hope that it will be useful, but | ||
40 | 21 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
41 | 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
42 | 23 | # General Public License for more details. | ||
43 | 24 | # | ||
44 | 25 | # You should have received a copy of the GNU General Public License | ||
45 | 26 | # along with GNU Libtool; see the file COPYING. If not, a copy | ||
46 | 27 | # can be downloaded from http://www.gnu.org/licenses/gpl.html, | ||
47 | 28 | # or obtained by writing to the Free Software Foundation, Inc., | ||
48 | 29 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
49 | 30 | |||
50 | 31 | # Usage: $progname [OPTION]... [MODE-ARG]... | ||
51 | 32 | # | ||
52 | 33 | # Provide generalized library-building support services. | ||
53 | 34 | # | ||
54 | 35 | # --config show all configuration variables | ||
55 | 36 | # --debug enable verbose shell tracing | ||
56 | 37 | # -n, --dry-run display commands without modifying any files | ||
57 | 38 | # --features display basic configuration information and exit | ||
58 | 39 | # --mode=MODE use operation mode MODE | ||
59 | 40 | # --preserve-dup-deps don't remove duplicate dependency libraries | ||
60 | 41 | # --quiet, --silent don't print informational messages | ||
61 | 42 | # --tag=TAG use configuration variables from tag TAG | ||
62 | 43 | # -v, --verbose print informational messages (default) | ||
63 | 44 | # --version print version information | ||
64 | 45 | # -h, --help print short or long help message | ||
65 | 46 | # | ||
66 | 47 | # MODE must be one of the following: | ||
67 | 48 | # | ||
68 | 49 | # clean remove files from the build directory | ||
69 | 50 | # compile compile a source file into a libtool object | ||
70 | 51 | # execute automatically set library path, then run a program | ||
71 | 52 | # finish complete the installation of libtool libraries | ||
72 | 53 | # install install libraries or executables | ||
73 | 54 | # link create a library or an executable | ||
74 | 55 | # uninstall remove libraries from an installed directory | ||
75 | 56 | # | ||
76 | 57 | # MODE-ARGS vary depending on the MODE. | ||
77 | 58 | # Try `$progname --help --mode=MODE' for a more detailed description of MODE. | ||
78 | 59 | # | ||
79 | 60 | # When reporting a bug, please describe a test case to reproduce it and | ||
80 | 61 | # include the following information: | ||
81 | 62 | # | ||
82 | 63 | # host-triplet: $host | ||
83 | 64 | # shell: $SHELL | ||
84 | 65 | # compiler: $LTCC | ||
85 | 66 | # compiler flags: $LTCFLAGS | ||
86 | 67 | # linker: $LD (gnu? $with_gnu_ld) | ||
87 | 68 | # $progname: (GNU libtool) 2.2.6 | ||
88 | 69 | # automake: $automake_version | ||
89 | 70 | # autoconf: $autoconf_version | ||
90 | 71 | # | ||
91 | 72 | # Report bugs to <bug-libtool@gnu.org>. | ||
92 | 73 | |||
93 | 74 | PROGRAM=ltmain.sh | ||
94 | 75 | PACKAGE=libtool | ||
95 | 76 | VERSION=2.2.6 | ||
96 | 77 | TIMESTAMP="" | ||
97 | 78 | package_revision=1.3012 | ||
98 | 79 | |||
99 | 80 | # Be Bourne compatible | ||
100 | 81 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then | ||
101 | 82 | emulate sh | ||
102 | 83 | NULLCMD=: | ||
103 | 84 | # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which | ||
104 | 85 | # is contrary to our usage. Disable this feature. | ||
105 | 86 | alias -g '${1+"$@"}'='"$@"' | ||
106 | 87 | setopt NO_GLOB_SUBST | ||
107 | 88 | else | ||
108 | 89 | case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac | ||
109 | 90 | fi | ||
110 | 91 | BIN_SH=xpg4; export BIN_SH # for Tru64 | ||
111 | 92 | DUALCASE=1; export DUALCASE # for MKS sh | ||
112 | 93 | |||
113 | 94 | # NLS nuisances: We save the old values to restore during execute mode. | ||
114 | 95 | # Only set LANG and LC_ALL to C if already set. | ||
115 | 96 | # These must not be set unconditionally because not all systems understand | ||
116 | 97 | # e.g. LANG=C (notably SCO). | ||
117 | 98 | lt_user_locale= | ||
118 | 99 | lt_safe_locale= | ||
119 | 100 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES | ||
120 | 101 | do | ||
121 | 102 | eval "if test \"\${$lt_var+set}\" = set; then | ||
122 | 103 | save_$lt_var=\$$lt_var | ||
123 | 104 | $lt_var=C | ||
124 | 105 | export $lt_var | ||
125 | 106 | lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" | ||
126 | 107 | lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" | ||
127 | 108 | fi" | ||
128 | 109 | done | ||
129 | 110 | |||
130 | 111 | $lt_unset CDPATH | ||
131 | 112 | |||
132 | 113 | |||
133 | 114 | |||
134 | 115 | |||
135 | 116 | |||
136 | 117 | : ${CP="cp -f"} | ||
137 | 118 | : ${ECHO="echo"} | ||
138 | 119 | : ${EGREP="/usr/bin/grep -E"} | ||
139 | 120 | : ${FGREP="/usr/bin/grep -F"} | ||
140 | 121 | : ${GREP="/usr/bin/grep"} | ||
141 | 122 | : ${LN_S="ln -s"} | ||
142 | 123 | : ${MAKE="make"} | ||
143 | 124 | : ${MKDIR="mkdir"} | ||
144 | 125 | : ${MV="mv -f"} | ||
145 | 126 | : ${RM="rm -f"} | ||
146 | 127 | : ${SED="/opt/local/bin/gsed"} | ||
147 | 128 | : ${SHELL="${CONFIG_SHELL-/bin/sh}"} | ||
148 | 129 | : ${Xsed="$SED -e 1s/^X//"} | ||
149 | 130 | |||
150 | 131 | # Global variables: | ||
151 | 132 | EXIT_SUCCESS=0 | ||
152 | 133 | EXIT_FAILURE=1 | ||
153 | 134 | EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. | ||
154 | 135 | EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. | ||
155 | 136 | |||
156 | 137 | exit_status=$EXIT_SUCCESS | ||
157 | 138 | |||
158 | 139 | # Make sure IFS has a sensible default | ||
159 | 140 | lt_nl=' | ||
160 | 141 | ' | ||
161 | 142 | IFS=" $lt_nl" | ||
162 | 143 | |||
163 | 144 | dirname="s,/[^/]*$,," | ||
164 | 145 | basename="s,^.*/,," | ||
165 | 146 | |||
166 | 147 | # func_dirname_and_basename file append nondir_replacement | ||
167 | 148 | # perform func_basename and func_dirname in a single function | ||
168 | 149 | # call: | ||
169 | 150 | # dirname: Compute the dirname of FILE. If nonempty, | ||
170 | 151 | # add APPEND to the result, otherwise set result | ||
171 | 152 | # to NONDIR_REPLACEMENT. | ||
172 | 153 | # value returned in "$func_dirname_result" | ||
173 | 154 | # basename: Compute filename of FILE. | ||
174 | 155 | # value retuned in "$func_basename_result" | ||
175 | 156 | # Implementation must be kept synchronized with func_dirname | ||
176 | 157 | # and func_basename. For efficiency, we do not delegate to | ||
177 | 158 | # those functions but instead duplicate the functionality here. | ||
178 | 159 | func_dirname_and_basename () | ||
179 | 160 | { | ||
180 | 161 | # Extract subdirectory from the argument. | ||
181 | 162 | func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` | ||
182 | 163 | if test "X$func_dirname_result" = "X${1}"; then | ||
183 | 164 | func_dirname_result="${3}" | ||
184 | 165 | else | ||
185 | 166 | func_dirname_result="$func_dirname_result${2}" | ||
186 | 167 | fi | ||
187 | 168 | func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` | ||
188 | 169 | } | ||
189 | 170 | |||
190 | 171 | # Generated shell functions inserted here. | ||
191 | 172 | |||
192 | 173 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh | ||
193 | 174 | # is ksh but when the shell is invoked as "sh" and the current value of | ||
194 | 175 | # the _XPG environment variable is not equal to 1 (one), the special | ||
195 | 176 | # positional parameter $0, within a function call, is the name of the | ||
196 | 177 | # function. | ||
197 | 178 | progpath="$0" | ||
198 | 179 | |||
199 | 180 | # The name of this program: | ||
200 | 181 | # In the unlikely event $progname began with a '-', it would play havoc with | ||
201 | 182 | # func_echo (imagine progname=-n), so we prepend ./ in that case: | ||
202 | 183 | func_dirname_and_basename "$progpath" | ||
203 | 184 | progname=$func_basename_result | ||
204 | 185 | case $progname in | ||
205 | 186 | -*) progname=./$progname ;; | ||
206 | 187 | esac | ||
207 | 188 | |||
208 | 189 | # Make sure we have an absolute path for reexecution: | ||
209 | 190 | case $progpath in | ||
210 | 191 | [\\/]*|[A-Za-z]:\\*) ;; | ||
211 | 192 | *[\\/]*) | ||
212 | 193 | progdir=$func_dirname_result | ||
213 | 194 | progdir=`cd "$progdir" && pwd` | ||
214 | 195 | progpath="$progdir/$progname" | ||
215 | 196 | ;; | ||
216 | 197 | *) | ||
217 | 198 | save_IFS="$IFS" | ||
218 | 199 | IFS=: | ||
219 | 200 | for progdir in $PATH; do | ||
220 | 201 | IFS="$save_IFS" | ||
221 | 202 | test -x "$progdir/$progname" && break | ||
222 | 203 | done | ||
223 | 204 | IFS="$save_IFS" | ||
224 | 205 | test -n "$progdir" || progdir=`pwd` | ||
225 | 206 | progpath="$progdir/$progname" | ||
226 | 207 | ;; | ||
227 | 208 | esac | ||
228 | 209 | |||
229 | 210 | # Sed substitution that helps us do robust quoting. It backslashifies | ||
230 | 211 | # metacharacters that are still active within double-quoted strings. | ||
231 | 212 | Xsed="${SED}"' -e 1s/^X//' | ||
232 | 213 | sed_quote_subst='s/\([`"$\\]\)/\\\1/g' | ||
233 | 214 | |||
234 | 215 | # Same as above, but do not quote variable references. | ||
235 | 216 | double_quote_subst='s/\(["`\\]\)/\\\1/g' | ||
236 | 217 | |||
237 | 218 | # Re-`\' parameter expansions in output of double_quote_subst that were | ||
238 | 219 | # `\'-ed in input to the same. If an odd number of `\' preceded a '$' | ||
239 | 220 | # in input to double_quote_subst, that '$' was protected from expansion. | ||
240 | 221 | # Since each input `\' is now two `\'s, look for any number of runs of | ||
241 | 222 | # four `\'s followed by two `\'s and then a '$'. `\' that '$'. | ||
242 | 223 | bs='\\' | ||
243 | 224 | bs2='\\\\' | ||
244 | 225 | bs4='\\\\\\\\' | ||
245 | 226 | dollar='\$' | ||
246 | 227 | sed_double_backslash="\ | ||
247 | 228 | s/$bs4/&\\ | ||
248 | 229 | /g | ||
249 | 230 | s/^$bs2$dollar/$bs&/ | ||
250 | 231 | s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g | ||
251 | 232 | s/\n//g" | ||
252 | 233 | |||
253 | 234 | # Standard options: | ||
254 | 235 | opt_dry_run=false | ||
255 | 236 | opt_help=false | ||
256 | 237 | opt_quiet=false | ||
257 | 238 | opt_verbose=false | ||
258 | 239 | opt_warning=: | ||
259 | 240 | |||
260 | 241 | # func_echo arg... | ||
261 | 242 | # Echo program name prefixed message, along with the current mode | ||
262 | 243 | # name if it has been set yet. | ||
263 | 244 | func_echo () | ||
264 | 245 | { | ||
265 | 246 | $ECHO "$progname${mode+: }$mode: $*" | ||
266 | 247 | } | ||
267 | 248 | |||
268 | 249 | # func_verbose arg... | ||
269 | 250 | # Echo program name prefixed message in verbose mode only. | ||
270 | 251 | func_verbose () | ||
271 | 252 | { | ||
272 | 253 | $opt_verbose && func_echo ${1+"$@"} | ||
273 | 254 | |||
274 | 255 | # A bug in bash halts the script if the last line of a function | ||
275 | 256 | # fails when set -e is in force, so we need another command to | ||
276 | 257 | # work around that: | ||
277 | 258 | : | ||
278 | 259 | } | ||
279 | 260 | |||
280 | 261 | # func_error arg... | ||
281 | 262 | # Echo program name prefixed message to standard error. | ||
282 | 263 | func_error () | ||
283 | 264 | { | ||
284 | 265 | $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 | ||
285 | 266 | } | ||
286 | 267 | |||
287 | 268 | # func_warning arg... | ||
288 | 269 | # Echo program name prefixed warning message to standard error. | ||
289 | 270 | func_warning () | ||
290 | 271 | { | ||
291 | 272 | $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 | ||
292 | 273 | |||
293 | 274 | # bash bug again: | ||
294 | 275 | : | ||
295 | 276 | } | ||
296 | 277 | |||
297 | 278 | # func_fatal_error arg... | ||
298 | 279 | # Echo program name prefixed message to standard error, and exit. | ||
299 | 280 | func_fatal_error () | ||
300 | 281 | { | ||
301 | 282 | func_error ${1+"$@"} | ||
302 | 283 | exit $EXIT_FAILURE | ||
303 | 284 | } | ||
304 | 285 | |||
305 | 286 | # func_fatal_help arg... | ||
306 | 287 | # Echo program name prefixed message to standard error, followed by | ||
307 | 288 | # a help hint, and exit. | ||
308 | 289 | func_fatal_help () | ||
309 | 290 | { | ||
310 | 291 | func_error ${1+"$@"} | ||
311 | 292 | func_fatal_error "$help" | ||
312 | 293 | } | ||
313 | 294 | help="Try \`$progname --help' for more information." ## default | ||
314 | 295 | |||
315 | 296 | |||
316 | 297 | # func_grep expression filename | ||
317 | 298 | # Check whether EXPRESSION matches any line of FILENAME, without output. | ||
318 | 299 | func_grep () | ||
319 | 300 | { | ||
320 | 301 | $GREP "$1" "$2" >/dev/null 2>&1 | ||
321 | 302 | } | ||
322 | 303 | |||
323 | 304 | |||
324 | 305 | # func_mkdir_p directory-path | ||
325 | 306 | # Make sure the entire path to DIRECTORY-PATH is available. | ||
326 | 307 | func_mkdir_p () | ||
327 | 308 | { | ||
328 | 309 | my_directory_path="$1" | ||
329 | 310 | my_dir_list= | ||
330 | 311 | |||
331 | 312 | if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then | ||
332 | 313 | |||
333 | 314 | # Protect directory names starting with `-' | ||
334 | 315 | case $my_directory_path in | ||
335 | 316 | -*) my_directory_path="./$my_directory_path" ;; | ||
336 | 317 | esac | ||
337 | 318 | |||
338 | 319 | # While some portion of DIR does not yet exist... | ||
339 | 320 | while test ! -d "$my_directory_path"; do | ||
340 | 321 | # ...make a list in topmost first order. Use a colon delimited | ||
341 | 322 | # list incase some portion of path contains whitespace. | ||
342 | 323 | my_dir_list="$my_directory_path:$my_dir_list" | ||
343 | 324 | |||
344 | 325 | # If the last portion added has no slash in it, the list is done | ||
345 | 326 | case $my_directory_path in */*) ;; *) break ;; esac | ||
346 | 327 | |||
347 | 328 | # ...otherwise throw away the child directory and loop | ||
348 | 329 | my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` | ||
349 | 330 | done | ||
350 | 331 | my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` | ||
351 | 332 | |||
352 | 333 | save_mkdir_p_IFS="$IFS"; IFS=':' | ||
353 | 334 | for my_dir in $my_dir_list; do | ||
354 | 335 | IFS="$save_mkdir_p_IFS" | ||
355 | 336 | # mkdir can fail with a `File exist' error if two processes | ||
356 | 337 | # try to create one of the directories concurrently. Don't | ||
357 | 338 | # stop in that case! | ||
358 | 339 | $MKDIR "$my_dir" 2>/dev/null || : | ||
359 | 340 | done | ||
360 | 341 | IFS="$save_mkdir_p_IFS" | ||
361 | 342 | |||
362 | 343 | # Bail out if we (or some other process) failed to create a directory. | ||
363 | 344 | test -d "$my_directory_path" || \ | ||
364 | 345 | func_fatal_error "Failed to create \`$1'" | ||
365 | 346 | fi | ||
366 | 347 | } | ||
367 | 348 | |||
368 | 349 | |||
369 | 350 | # func_mktempdir [string] | ||
370 | 351 | # Make a temporary directory that won't clash with other running | ||
371 | 352 | # libtool processes, and avoids race conditions if possible. If | ||
372 | 353 | # given, STRING is the basename for that directory. | ||
373 | 354 | func_mktempdir () | ||
374 | 355 | { | ||
375 | 356 | my_template="${TMPDIR-/tmp}/${1-$progname}" | ||
376 | 357 | |||
377 | 358 | if test "$opt_dry_run" = ":"; then | ||
378 | 359 | # Return a directory name, but don't create it in dry-run mode | ||
379 | 360 | my_tmpdir="${my_template}-$$" | ||
380 | 361 | else | ||
381 | 362 | |||
382 | 363 | # If mktemp works, use that first and foremost | ||
383 | 364 | my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` | ||
384 | 365 | |||
385 | 366 | if test ! -d "$my_tmpdir"; then | ||
386 | 367 | # Failing that, at least try and use $RANDOM to avoid a race | ||
387 | 368 | my_tmpdir="${my_template}-${RANDOM-0}$$" | ||
388 | 369 | |||
389 | 370 | save_mktempdir_umask=`umask` | ||
390 | 371 | umask 0077 | ||
391 | 372 | $MKDIR "$my_tmpdir" | ||
392 | 373 | umask $save_mktempdir_umask | ||
393 | 374 | fi | ||
394 | 375 | |||
395 | 376 | # If we're not in dry-run mode, bomb out on failure | ||
396 | 377 | test -d "$my_tmpdir" || \ | ||
397 | 378 | func_fatal_error "cannot create temporary directory \`$my_tmpdir'" | ||
398 | 379 | fi | ||
399 | 380 | |||
400 | 381 | $ECHO "X$my_tmpdir" | $Xsed | ||
401 | 382 | } | ||
402 | 383 | |||
403 | 384 | |||
404 | 385 | # func_quote_for_eval arg | ||
405 | 386 | # Aesthetically quote ARG to be evaled later. | ||
406 | 387 | # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT | ||
407 | 388 | # is double-quoted, suitable for a subsequent eval, whereas | ||
408 | 389 | # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters | ||
409 | 390 | # which are still active within double quotes backslashified. | ||
410 | 391 | func_quote_for_eval () | ||
411 | 392 | { | ||
412 | 393 | case $1 in | ||
413 | 394 | *[\\\`\"\$]*) | ||
414 | 395 | func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; | ||
415 | 396 | *) | ||
416 | 397 | func_quote_for_eval_unquoted_result="$1" ;; | ||
417 | 398 | esac | ||
418 | 399 | |||
419 | 400 | case $func_quote_for_eval_unquoted_result in | ||
420 | 401 | # Double-quote args containing shell metacharacters to delay | ||
421 | 402 | # word splitting, command substitution and and variable | ||
422 | 403 | # expansion for a subsequent eval. | ||
423 | 404 | # Many Bourne shells cannot handle close brackets correctly | ||
424 | 405 | # in scan sets, so we specify it separately. | ||
425 | 406 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
426 | 407 | func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" | ||
427 | 408 | ;; | ||
428 | 409 | *) | ||
429 | 410 | func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" | ||
430 | 411 | esac | ||
431 | 412 | } | ||
432 | 413 | |||
433 | 414 | |||
434 | 415 | # func_quote_for_expand arg | ||
435 | 416 | # Aesthetically quote ARG to be evaled later; same as above, | ||
436 | 417 | # but do not quote variable references. | ||
437 | 418 | func_quote_for_expand () | ||
438 | 419 | { | ||
439 | 420 | case $1 in | ||
440 | 421 | *[\\\`\"]*) | ||
441 | 422 | my_arg=`$ECHO "X$1" | $Xsed \ | ||
442 | 423 | -e "$double_quote_subst" -e "$sed_double_backslash"` ;; | ||
443 | 424 | *) | ||
444 | 425 | my_arg="$1" ;; | ||
445 | 426 | esac | ||
446 | 427 | |||
447 | 428 | case $my_arg in | ||
448 | 429 | # Double-quote args containing shell metacharacters to delay | ||
449 | 430 | # word splitting and command substitution for a subsequent eval. | ||
450 | 431 | # Many Bourne shells cannot handle close brackets correctly | ||
451 | 432 | # in scan sets, so we specify it separately. | ||
452 | 433 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
453 | 434 | my_arg="\"$my_arg\"" | ||
454 | 435 | ;; | ||
455 | 436 | esac | ||
456 | 437 | |||
457 | 438 | func_quote_for_expand_result="$my_arg" | ||
458 | 439 | } | ||
459 | 440 | |||
460 | 441 | |||
461 | 442 | # func_show_eval cmd [fail_exp] | ||
462 | 443 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is | ||
463 | 444 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP | ||
464 | 445 | # is given, then evaluate it. | ||
465 | 446 | func_show_eval () | ||
466 | 447 | { | ||
467 | 448 | my_cmd="$1" | ||
468 | 449 | my_fail_exp="${2-:}" | ||
469 | 450 | |||
470 | 451 | ${opt_silent-false} || { | ||
471 | 452 | func_quote_for_expand "$my_cmd" | ||
472 | 453 | eval "func_echo $func_quote_for_expand_result" | ||
473 | 454 | } | ||
474 | 455 | |||
475 | 456 | if ${opt_dry_run-false}; then :; else | ||
476 | 457 | eval "$my_cmd" | ||
477 | 458 | my_status=$? | ||
478 | 459 | if test "$my_status" -eq 0; then :; else | ||
479 | 460 | eval "(exit $my_status); $my_fail_exp" | ||
480 | 461 | fi | ||
481 | 462 | fi | ||
482 | 463 | } | ||
483 | 464 | |||
484 | 465 | |||
485 | 466 | # func_show_eval_locale cmd [fail_exp] | ||
486 | 467 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is | ||
487 | 468 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP | ||
488 | 469 | # is given, then evaluate it. Use the saved locale for evaluation. | ||
489 | 470 | func_show_eval_locale () | ||
490 | 471 | { | ||
491 | 472 | my_cmd="$1" | ||
492 | 473 | my_fail_exp="${2-:}" | ||
493 | 474 | |||
494 | 475 | ${opt_silent-false} || { | ||
495 | 476 | func_quote_for_expand "$my_cmd" | ||
496 | 477 | eval "func_echo $func_quote_for_expand_result" | ||
497 | 478 | } | ||
498 | 479 | |||
499 | 480 | if ${opt_dry_run-false}; then :; else | ||
500 | 481 | eval "$lt_user_locale | ||
501 | 482 | $my_cmd" | ||
502 | 483 | my_status=$? | ||
503 | 484 | eval "$lt_safe_locale" | ||
504 | 485 | if test "$my_status" -eq 0; then :; else | ||
505 | 486 | eval "(exit $my_status); $my_fail_exp" | ||
506 | 487 | fi | ||
507 | 488 | fi | ||
508 | 489 | } | ||
509 | 490 | |||
510 | 491 | |||
511 | 492 | |||
512 | 493 | |||
513 | 494 | |||
514 | 495 | # func_version | ||
515 | 496 | # Echo version message to standard output and exit. | ||
516 | 497 | func_version () | ||
517 | 498 | { | ||
518 | 499 | $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { | ||
519 | 500 | s/^# // | ||
520 | 501 | s/^# *$// | ||
521 | 502 | s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ | ||
522 | 503 | p | ||
523 | 504 | }' < "$progpath" | ||
524 | 505 | exit $? | ||
525 | 506 | } | ||
526 | 507 | |||
527 | 508 | # func_usage | ||
528 | 509 | # Echo short help message to standard output and exit. | ||
529 | 510 | func_usage () | ||
530 | 511 | { | ||
531 | 512 | $SED -n '/^# Usage:/,/# -h/ { | ||
532 | 513 | s/^# // | ||
533 | 514 | s/^# *$// | ||
534 | 515 | s/\$progname/'$progname'/ | ||
535 | 516 | p | ||
536 | 517 | }' < "$progpath" | ||
537 | 518 | $ECHO | ||
538 | 519 | $ECHO "run \`$progname --help | more' for full usage" | ||
539 | 520 | exit $? | ||
540 | 521 | } | ||
541 | 522 | |||
542 | 523 | # func_help | ||
543 | 524 | # Echo long help message to standard output and exit. | ||
544 | 525 | func_help () | ||
545 | 526 | { | ||
546 | 527 | $SED -n '/^# Usage:/,/# Report bugs to/ { | ||
547 | 528 | s/^# // | ||
548 | 529 | s/^# *$// | ||
549 | 530 | s*\$progname*'$progname'* | ||
550 | 531 | s*\$host*'"$host"'* | ||
551 | 532 | s*\$SHELL*'"$SHELL"'* | ||
552 | 533 | s*\$LTCC*'"$LTCC"'* | ||
553 | 534 | s*\$LTCFLAGS*'"$LTCFLAGS"'* | ||
554 | 535 | s*\$LD*'"$LD"'* | ||
555 | 536 | s/\$with_gnu_ld/'"$with_gnu_ld"'/ | ||
556 | 537 | s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ | ||
557 | 538 | s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ | ||
558 | 539 | p | ||
559 | 540 | }' < "$progpath" | ||
560 | 541 | exit $? | ||
561 | 542 | } | ||
562 | 543 | |||
563 | 544 | # func_missing_arg argname | ||
564 | 545 | # Echo program name prefixed message to standard error and set global | ||
565 | 546 | # exit_cmd. | ||
566 | 547 | func_missing_arg () | ||
567 | 548 | { | ||
568 | 549 | func_error "missing argument for $1" | ||
569 | 550 | exit_cmd=exit | ||
570 | 551 | } | ||
571 | 552 | |||
572 | 553 | exit_cmd=: | ||
573 | 554 | |||
574 | 555 | |||
575 | 556 | |||
576 | 557 | |||
577 | 558 | |||
578 | 559 | # Check that we have a working $ECHO. | ||
579 | 560 | if test "X$1" = X--no-reexec; then | ||
580 | 561 | # Discard the --no-reexec flag, and continue. | ||
581 | 562 | shift | ||
582 | 563 | elif test "X$1" = X--fallback-echo; then | ||
583 | 564 | # Avoid inline document here, it may be left over | ||
584 | 565 | : | ||
585 | 566 | elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then | ||
586 | 567 | # Yippee, $ECHO works! | ||
587 | 568 | : | ||
588 | 569 | else | ||
589 | 570 | # Restart under the correct shell, and then maybe $ECHO will work. | ||
590 | 571 | exec $SHELL "$progpath" --no-reexec ${1+"$@"} | ||
591 | 572 | fi | ||
592 | 573 | |||
593 | 574 | if test "X$1" = X--fallback-echo; then | ||
594 | 575 | # used as fallback echo | ||
595 | 576 | shift | ||
596 | 577 | cat <<EOF | ||
597 | 578 | $* | ||
598 | 579 | EOF | ||
599 | 580 | exit $EXIT_SUCCESS | ||
600 | 581 | fi | ||
601 | 582 | |||
602 | 583 | magic="%%%MAGIC variable%%%" | ||
603 | 584 | magic_exe="%%%MAGIC EXE variable%%%" | ||
604 | 585 | |||
605 | 586 | # Global variables. | ||
606 | 587 | # $mode is unset | ||
607 | 588 | nonopt= | ||
608 | 589 | execute_dlfiles= | ||
609 | 590 | preserve_args= | ||
610 | 591 | lo2o="s/\\.lo\$/.${objext}/" | ||
611 | 592 | o2lo="s/\\.${objext}\$/.lo/" | ||
612 | 593 | extracted_archives= | ||
613 | 594 | extracted_serial=0 | ||
614 | 595 | |||
615 | 596 | opt_dry_run=false | ||
616 | 597 | opt_duplicate_deps=false | ||
617 | 598 | opt_silent=false | ||
618 | 599 | opt_debug=: | ||
619 | 600 | |||
620 | 601 | # If this variable is set in any of the actions, the command in it | ||
621 | 602 | # will be execed at the end. This prevents here-documents from being | ||
622 | 603 | # left over by shells. | ||
623 | 604 | exec_cmd= | ||
624 | 605 | |||
625 | 606 | # func_fatal_configuration arg... | ||
626 | 607 | # Echo program name prefixed message to standard error, followed by | ||
627 | 608 | # a configuration failure hint, and exit. | ||
628 | 609 | func_fatal_configuration () | ||
629 | 610 | { | ||
630 | 611 | func_error ${1+"$@"} | ||
631 | 612 | func_error "See the $PACKAGE documentation for more information." | ||
632 | 613 | func_fatal_error "Fatal configuration error." | ||
633 | 614 | } | ||
634 | 615 | |||
635 | 616 | |||
636 | 617 | # func_config | ||
637 | 618 | # Display the configuration for all the tags in this script. | ||
638 | 619 | func_config () | ||
639 | 620 | { | ||
640 | 621 | re_begincf='^# ### BEGIN LIBTOOL' | ||
641 | 622 | re_endcf='^# ### END LIBTOOL' | ||
642 | 623 | |||
643 | 624 | # Default configuration. | ||
644 | 625 | $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" | ||
645 | 626 | |||
646 | 627 | # Now print the configurations for the tags. | ||
647 | 628 | for tagname in $taglist; do | ||
648 | 629 | $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" | ||
649 | 630 | done | ||
650 | 631 | |||
651 | 632 | exit $? | ||
652 | 633 | } | ||
653 | 634 | |||
654 | 635 | # func_features | ||
655 | 636 | # Display the features supported by this script. | ||
656 | 637 | func_features () | ||
657 | 638 | { | ||
658 | 639 | $ECHO "host: $host" | ||
659 | 640 | if test "$build_libtool_libs" = yes; then | ||
660 | 641 | $ECHO "enable shared libraries" | ||
661 | 642 | else | ||
662 | 643 | $ECHO "disable shared libraries" | ||
663 | 644 | fi | ||
664 | 645 | if test "$build_old_libs" = yes; then | ||
665 | 646 | $ECHO "enable static libraries" | ||
666 | 647 | else | ||
667 | 648 | $ECHO "disable static libraries" | ||
668 | 649 | fi | ||
669 | 650 | |||
670 | 651 | exit $? | ||
671 | 652 | } | ||
672 | 653 | |||
673 | 654 | # func_enable_tag tagname | ||
674 | 655 | # Verify that TAGNAME is valid, and either flag an error and exit, or | ||
675 | 656 | # enable the TAGNAME tag. We also add TAGNAME to the global $taglist | ||
676 | 657 | # variable here. | ||
677 | 658 | func_enable_tag () | ||
678 | 659 | { | ||
679 | 660 | # Global variable: | ||
680 | 661 | tagname="$1" | ||
681 | 662 | |||
682 | 663 | re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" | ||
683 | 664 | re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" | ||
684 | 665 | sed_extractcf="/$re_begincf/,/$re_endcf/p" | ||
685 | 666 | |||
686 | 667 | # Validate tagname. | ||
687 | 668 | case $tagname in | ||
688 | 669 | *[!-_A-Za-z0-9,/]*) | ||
689 | 670 | func_fatal_error "invalid tag name: $tagname" | ||
690 | 671 | ;; | ||
691 | 672 | esac | ||
692 | 673 | |||
693 | 674 | # Don't test for the "default" C tag, as we know it's | ||
694 | 675 | # there but not specially marked. | ||
695 | 676 | case $tagname in | ||
696 | 677 | CC) ;; | ||
697 | 678 | *) | ||
698 | 679 | if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then | ||
699 | 680 | taglist="$taglist $tagname" | ||
700 | 681 | |||
701 | 682 | # Evaluate the configuration. Be careful to quote the path | ||
702 | 683 | # and the sed script, to avoid splitting on whitespace, but | ||
703 | 684 | # also don't use non-portable quotes within backquotes within | ||
704 | 685 | # quotes we have to do it in 2 steps: | ||
705 | 686 | extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` | ||
706 | 687 | eval "$extractedcf" | ||
707 | 688 | else | ||
708 | 689 | func_error "ignoring unknown tag $tagname" | ||
709 | 690 | fi | ||
710 | 691 | ;; | ||
711 | 692 | esac | ||
712 | 693 | } | ||
713 | 694 | |||
714 | 695 | # Parse options once, thoroughly. This comes as soon as possible in | ||
715 | 696 | # the script to make things like `libtool --version' happen quickly. | ||
716 | 697 | { | ||
717 | 698 | |||
718 | 699 | # Shorthand for --mode=foo, only valid as the first argument | ||
719 | 700 | case $1 in | ||
720 | 701 | clean|clea|cle|cl) | ||
721 | 702 | shift; set dummy --mode clean ${1+"$@"}; shift | ||
722 | 703 | ;; | ||
723 | 704 | compile|compil|compi|comp|com|co|c) | ||
724 | 705 | shift; set dummy --mode compile ${1+"$@"}; shift | ||
725 | 706 | ;; | ||
726 | 707 | execute|execut|execu|exec|exe|ex|e) | ||
727 | 708 | shift; set dummy --mode execute ${1+"$@"}; shift | ||
728 | 709 | ;; | ||
729 | 710 | finish|finis|fini|fin|fi|f) | ||
730 | 711 | shift; set dummy --mode finish ${1+"$@"}; shift | ||
731 | 712 | ;; | ||
732 | 713 | install|instal|insta|inst|ins|in|i) | ||
733 | 714 | shift; set dummy --mode install ${1+"$@"}; shift | ||
734 | 715 | ;; | ||
735 | 716 | link|lin|li|l) | ||
736 | 717 | shift; set dummy --mode link ${1+"$@"}; shift | ||
737 | 718 | ;; | ||
738 | 719 | uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) | ||
739 | 720 | shift; set dummy --mode uninstall ${1+"$@"}; shift | ||
740 | 721 | ;; | ||
741 | 722 | esac | ||
742 | 723 | |||
743 | 724 | # Parse non-mode specific arguments: | ||
744 | 725 | while test "$#" -gt 0; do | ||
745 | 726 | opt="$1" | ||
746 | 727 | shift | ||
747 | 728 | |||
748 | 729 | case $opt in | ||
749 | 730 | --config) func_config ;; | ||
750 | 731 | |||
751 | 732 | --debug) preserve_args="$preserve_args $opt" | ||
752 | 733 | func_echo "enabling shell trace mode" | ||
753 | 734 | opt_debug='set -x' | ||
754 | 735 | $opt_debug | ||
755 | 736 | ;; | ||
756 | 737 | |||
757 | 738 | -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break | ||
758 | 739 | execute_dlfiles="$execute_dlfiles $1" | ||
759 | 740 | shift | ||
760 | 741 | ;; | ||
761 | 742 | |||
762 | 743 | --dry-run | -n) opt_dry_run=: ;; | ||
763 | 744 | --features) func_features ;; | ||
764 | 745 | --finish) mode="finish" ;; | ||
765 | 746 | |||
766 | 747 | --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break | ||
767 | 748 | case $1 in | ||
768 | 749 | # Valid mode arguments: | ||
769 | 750 | clean) ;; | ||
770 | 751 | compile) ;; | ||
771 | 752 | execute) ;; | ||
772 | 753 | finish) ;; | ||
773 | 754 | install) ;; | ||
774 | 755 | link) ;; | ||
775 | 756 | relink) ;; | ||
776 | 757 | uninstall) ;; | ||
777 | 758 | |||
778 | 759 | # Catch anything else as an error | ||
779 | 760 | *) func_error "invalid argument for $opt" | ||
780 | 761 | exit_cmd=exit | ||
781 | 762 | break | ||
782 | 763 | ;; | ||
783 | 764 | esac | ||
784 | 765 | |||
785 | 766 | mode="$1" | ||
786 | 767 | shift | ||
787 | 768 | ;; | ||
788 | 769 | |||
789 | 770 | --preserve-dup-deps) | ||
790 | 771 | opt_duplicate_deps=: ;; | ||
791 | 772 | |||
792 | 773 | --quiet|--silent) preserve_args="$preserve_args $opt" | ||
793 | 774 | opt_silent=: | ||
794 | 775 | ;; | ||
795 | 776 | |||
796 | 777 | --verbose| -v) preserve_args="$preserve_args $opt" | ||
797 | 778 | opt_silent=false | ||
798 | 779 | ;; | ||
799 | 780 | |||
800 | 781 | --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break | ||
801 | 782 | preserve_args="$preserve_args $opt $1" | ||
802 | 783 | func_enable_tag "$1" # tagname is set here | ||
803 | 784 | shift | ||
804 | 785 | ;; | ||
805 | 786 | |||
806 | 787 | # Separate optargs to long options: | ||
807 | 788 | -dlopen=*|--mode=*|--tag=*) | ||
808 | 789 | func_opt_split "$opt" | ||
809 | 790 | set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} | ||
810 | 791 | shift | ||
811 | 792 | ;; | ||
812 | 793 | |||
813 | 794 | -\?|-h) func_usage ;; | ||
814 | 795 | --help) opt_help=: ;; | ||
815 | 796 | --version) func_version ;; | ||
816 | 797 | |||
817 | 798 | -*) func_fatal_help "unrecognized option \`$opt'" ;; | ||
818 | 799 | |||
819 | 800 | *) nonopt="$opt" | ||
820 | 801 | break | ||
821 | 802 | ;; | ||
822 | 803 | esac | ||
823 | 804 | done | ||
824 | 805 | |||
825 | 806 | |||
826 | 807 | case $host in | ||
827 | 808 | *cygwin* | *mingw* | *pw32* | *cegcc*) | ||
828 | 809 | # don't eliminate duplications in $postdeps and $predeps | ||
829 | 810 | opt_duplicate_compiler_generated_deps=: | ||
830 | 811 | ;; | ||
831 | 812 | *) | ||
832 | 813 | opt_duplicate_compiler_generated_deps=$opt_duplicate_deps | ||
833 | 814 | ;; | ||
834 | 815 | esac | ||
835 | 816 | |||
836 | 817 | # Having warned about all mis-specified options, bail out if | ||
837 | 818 | # anything was wrong. | ||
838 | 819 | $exit_cmd $EXIT_FAILURE | ||
839 | 820 | } | ||
840 | 821 | |||
841 | 822 | # func_check_version_match | ||
842 | 823 | # Ensure that we are using m4 macros, and libtool script from the same | ||
843 | 824 | # release of libtool. | ||
844 | 825 | func_check_version_match () | ||
845 | 826 | { | ||
846 | 827 | if test "$package_revision" != "$macro_revision"; then | ||
847 | 828 | if test "$VERSION" != "$macro_version"; then | ||
848 | 829 | if test -z "$macro_version"; then | ||
849 | 830 | cat >&2 <<_LT_EOF | ||
850 | 831 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the | ||
851 | 832 | $progname: definition of this LT_INIT comes from an older release. | ||
852 | 833 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION | ||
853 | 834 | $progname: and run autoconf again. | ||
854 | 835 | _LT_EOF | ||
855 | 836 | else | ||
856 | 837 | cat >&2 <<_LT_EOF | ||
857 | 838 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the | ||
858 | 839 | $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. | ||
859 | 840 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION | ||
860 | 841 | $progname: and run autoconf again. | ||
861 | 842 | _LT_EOF | ||
862 | 843 | fi | ||
863 | 844 | else | ||
864 | 845 | cat >&2 <<_LT_EOF | ||
865 | 846 | $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, | ||
866 | 847 | $progname: but the definition of this LT_INIT comes from revision $macro_revision. | ||
867 | 848 | $progname: You should recreate aclocal.m4 with macros from revision $package_revision | ||
868 | 849 | $progname: of $PACKAGE $VERSION and run autoconf again. | ||
869 | 850 | _LT_EOF | ||
870 | 851 | fi | ||
871 | 852 | |||
872 | 853 | exit $EXIT_MISMATCH | ||
873 | 854 | fi | ||
874 | 855 | } | ||
875 | 856 | |||
876 | 857 | |||
877 | 858 | ## ----------- ## | ||
878 | 859 | ## Main. ## | ||
879 | 860 | ## ----------- ## | ||
880 | 861 | |||
881 | 862 | $opt_help || { | ||
882 | 863 | # Sanity checks first: | ||
883 | 864 | func_check_version_match | ||
884 | 865 | |||
885 | 866 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then | ||
886 | 867 | func_fatal_configuration "not configured to build any kind of library" | ||
887 | 868 | fi | ||
888 | 869 | |||
889 | 870 | test -z "$mode" && func_fatal_error "error: you must specify a MODE." | ||
890 | 871 | |||
891 | 872 | |||
892 | 873 | # Darwin sucks | ||
893 | 874 | eval std_shrext=\"$shrext_cmds\" | ||
894 | 875 | |||
895 | 876 | |||
896 | 877 | # Only execute mode is allowed to have -dlopen flags. | ||
897 | 878 | if test -n "$execute_dlfiles" && test "$mode" != execute; then | ||
898 | 879 | func_error "unrecognized option \`-dlopen'" | ||
899 | 880 | $ECHO "$help" 1>&2 | ||
900 | 881 | exit $EXIT_FAILURE | ||
901 | 882 | fi | ||
902 | 883 | |||
903 | 884 | # Change the help message to a mode-specific one. | ||
904 | 885 | generic_help="$help" | ||
905 | 886 | help="Try \`$progname --help --mode=$mode' for more information." | ||
906 | 887 | } | ||
907 | 888 | |||
908 | 889 | |||
909 | 890 | # func_lalib_p file | ||
910 | 891 | # True iff FILE is a libtool `.la' library or `.lo' object file. | ||
911 | 892 | # This function is only a basic sanity check; it will hardly flush out | ||
912 | 893 | # determined imposters. | ||
913 | 894 | func_lalib_p () | ||
914 | 895 | { | ||
915 | 896 | test -f "$1" && | ||
916 | 897 | $SED -e 4q "$1" 2>/dev/null \ | ||
917 | 898 | | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 | ||
918 | 899 | } | ||
919 | 900 | |||
920 | 901 | # func_lalib_unsafe_p file | ||
921 | 902 | # True iff FILE is a libtool `.la' library or `.lo' object file. | ||
922 | 903 | # This function implements the same check as func_lalib_p without | ||
923 | 904 | # resorting to external programs. To this end, it redirects stdin and | ||
924 | 905 | # closes it afterwards, without saving the original file descriptor. | ||
925 | 906 | # As a safety measure, use it only where a negative result would be | ||
926 | 907 | # fatal anyway. Works if `file' does not exist. | ||
927 | 908 | func_lalib_unsafe_p () | ||
928 | 909 | { | ||
929 | 910 | lalib_p=no | ||
930 | 911 | if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then | ||
931 | 912 | for lalib_p_l in 1 2 3 4 | ||
932 | 913 | do | ||
933 | 914 | read lalib_p_line | ||
934 | 915 | case "$lalib_p_line" in | ||
935 | 916 | \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; | ||
936 | 917 | esac | ||
937 | 918 | done | ||
938 | 919 | exec 0<&5 5<&- | ||
939 | 920 | fi | ||
940 | 921 | test "$lalib_p" = yes | ||
941 | 922 | } | ||
942 | 923 | |||
943 | 924 | # func_ltwrapper_script_p file | ||
944 | 925 | # True iff FILE is a libtool wrapper script | ||
945 | 926 | # This function is only a basic sanity check; it will hardly flush out | ||
946 | 927 | # determined imposters. | ||
947 | 928 | func_ltwrapper_script_p () | ||
948 | 929 | { | ||
949 | 930 | func_lalib_p "$1" | ||
950 | 931 | } | ||
951 | 932 | |||
952 | 933 | # func_ltwrapper_executable_p file | ||
953 | 934 | # True iff FILE is a libtool wrapper executable | ||
954 | 935 | # This function is only a basic sanity check; it will hardly flush out | ||
955 | 936 | # determined imposters. | ||
956 | 937 | func_ltwrapper_executable_p () | ||
957 | 938 | { | ||
958 | 939 | func_ltwrapper_exec_suffix= | ||
959 | 940 | case $1 in | ||
960 | 941 | *.exe) ;; | ||
961 | 942 | *) func_ltwrapper_exec_suffix=.exe ;; | ||
962 | 943 | esac | ||
963 | 944 | $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 | ||
964 | 945 | } | ||
965 | 946 | |||
966 | 947 | # func_ltwrapper_scriptname file | ||
967 | 948 | # Assumes file is an ltwrapper_executable | ||
968 | 949 | # uses $file to determine the appropriate filename for a | ||
969 | 950 | # temporary ltwrapper_script. | ||
970 | 951 | func_ltwrapper_scriptname () | ||
971 | 952 | { | ||
972 | 953 | func_ltwrapper_scriptname_result="" | ||
973 | 954 | if func_ltwrapper_executable_p "$1"; then | ||
974 | 955 | func_dirname_and_basename "$1" "" "." | ||
975 | 956 | func_stripname '' '.exe' "$func_basename_result" | ||
976 | 957 | func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" | ||
977 | 958 | fi | ||
978 | 959 | } | ||
979 | 960 | |||
980 | 961 | # func_ltwrapper_p file | ||
981 | 962 | # True iff FILE is a libtool wrapper script or wrapper executable | ||
982 | 963 | # This function is only a basic sanity check; it will hardly flush out | ||
983 | 964 | # determined imposters. | ||
984 | 965 | func_ltwrapper_p () | ||
985 | 966 | { | ||
986 | 967 | func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" | ||
987 | 968 | } | ||
988 | 969 | |||
989 | 970 | |||
990 | 971 | # func_execute_cmds commands fail_cmd | ||
991 | 972 | # Execute tilde-delimited COMMANDS. | ||
992 | 973 | # If FAIL_CMD is given, eval that upon failure. | ||
993 | 974 | # FAIL_CMD may read-access the current command in variable CMD! | ||
994 | 975 | func_execute_cmds () | ||
995 | 976 | { | ||
996 | 977 | $opt_debug | ||
997 | 978 | save_ifs=$IFS; IFS='~' | ||
998 | 979 | for cmd in $1; do | ||
999 | 980 | IFS=$save_ifs | ||
1000 | 981 | eval cmd=\"$cmd\" | ||
1001 | 982 | func_show_eval "$cmd" "${2-:}" | ||
1002 | 983 | done | ||
1003 | 984 | IFS=$save_ifs | ||
1004 | 985 | } | ||
1005 | 986 | |||
1006 | 987 | |||
1007 | 988 | # func_source file | ||
1008 | 989 | # Source FILE, adding directory component if necessary. | ||
1009 | 990 | # Note that it is not necessary on cygwin/mingw to append a dot to | ||
1010 | 991 | # FILE even if both FILE and FILE.exe exist: automatic-append-.exe | ||
1011 | 992 | # behavior happens only for exec(3), not for open(2)! Also, sourcing | ||
1012 | 993 | # `FILE.' does not work on cygwin managed mounts. | ||
1013 | 994 | func_source () | ||
1014 | 995 | { | ||
1015 | 996 | $opt_debug | ||
1016 | 997 | case $1 in | ||
1017 | 998 | */* | *\\*) . "$1" ;; | ||
1018 | 999 | *) . "./$1" ;; | ||
1019 | 1000 | esac | ||
1020 | 1001 | } | ||
1021 | 1002 | |||
1022 | 1003 | |||
1023 | 1004 | # func_infer_tag arg | ||
1024 | 1005 | # Infer tagged configuration to use if any are available and | ||
1025 | 1006 | # if one wasn't chosen via the "--tag" command line option. | ||
1026 | 1007 | # Only attempt this if the compiler in the base compile | ||
1027 | 1008 | # command doesn't match the default compiler. | ||
1028 | 1009 | # arg is usually of the form 'gcc ...' | ||
1029 | 1010 | func_infer_tag () | ||
1030 | 1011 | { | ||
1031 | 1012 | $opt_debug | ||
1032 | 1013 | if test -n "$available_tags" && test -z "$tagname"; then | ||
1033 | 1014 | CC_quoted= | ||
1034 | 1015 | for arg in $CC; do | ||
1035 | 1016 | func_quote_for_eval "$arg" | ||
1036 | 1017 | CC_quoted="$CC_quoted $func_quote_for_eval_result" | ||
1037 | 1018 | done | ||
1038 | 1019 | case $@ in | ||
1039 | 1020 | # Blanks in the command may have been stripped by the calling shell, | ||
1040 | 1021 | # but not from the CC environment variable when configure was run. | ||
1041 | 1022 | " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; | ||
1042 | 1023 | # Blanks at the start of $base_compile will cause this to fail | ||
1043 | 1024 | # if we don't check for them as well. | ||
1044 | 1025 | *) | ||
1045 | 1026 | for z in $available_tags; do | ||
1046 | 1027 | if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then | ||
1047 | 1028 | # Evaluate the configuration. | ||
1048 | 1029 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" | ||
1049 | 1030 | CC_quoted= | ||
1050 | 1031 | for arg in $CC; do | ||
1051 | 1032 | # Double-quote args containing other shell metacharacters. | ||
1052 | 1033 | func_quote_for_eval "$arg" | ||
1053 | 1034 | CC_quoted="$CC_quoted $func_quote_for_eval_result" | ||
1054 | 1035 | done | ||
1055 | 1036 | case "$@ " in | ||
1056 | 1037 | " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) | ||
1057 | 1038 | # The compiler in the base compile command matches | ||
1058 | 1039 | # the one in the tagged configuration. | ||
1059 | 1040 | # Assume this is the tagged configuration we want. | ||
1060 | 1041 | tagname=$z | ||
1061 | 1042 | break | ||
1062 | 1043 | ;; | ||
1063 | 1044 | esac | ||
1064 | 1045 | fi | ||
1065 | 1046 | done | ||
1066 | 1047 | # If $tagname still isn't set, then no tagged configuration | ||
1067 | 1048 | # was found and let the user know that the "--tag" command | ||
1068 | 1049 | # line option must be used. | ||
1069 | 1050 | if test -z "$tagname"; then | ||
1070 | 1051 | func_echo "unable to infer tagged configuration" | ||
1071 | 1052 | func_fatal_error "specify a tag with \`--tag'" | ||
1072 | 1053 | # else | ||
1073 | 1054 | # func_verbose "using $tagname tagged configuration" | ||
1074 | 1055 | fi | ||
1075 | 1056 | ;; | ||
1076 | 1057 | esac | ||
1077 | 1058 | fi | ||
1078 | 1059 | } | ||
1079 | 1060 | |||
1080 | 1061 | |||
1081 | 1062 | |||
1082 | 1063 | # func_write_libtool_object output_name pic_name nonpic_name | ||
1083 | 1064 | # Create a libtool object file (analogous to a ".la" file), | ||
1084 | 1065 | # but don't create it if we're doing a dry run. | ||
1085 | 1066 | func_write_libtool_object () | ||
1086 | 1067 | { | ||
1087 | 1068 | write_libobj=${1} | ||
1088 | 1069 | if test "$build_libtool_libs" = yes; then | ||
1089 | 1070 | write_lobj=\'${2}\' | ||
1090 | 1071 | else | ||
1091 | 1072 | write_lobj=none | ||
1092 | 1073 | fi | ||
1093 | 1074 | |||
1094 | 1075 | if test "$build_old_libs" = yes; then | ||
1095 | 1076 | write_oldobj=\'${3}\' | ||
1096 | 1077 | else | ||
1097 | 1078 | write_oldobj=none | ||
1098 | 1079 | fi | ||
1099 | 1080 | |||
1100 | 1081 | $opt_dry_run || { | ||
1101 | 1082 | cat >${write_libobj}T <<EOF | ||
1102 | 1083 | # $write_libobj - a libtool object file | ||
1103 | 1084 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION | ||
1104 | 1085 | # | ||
1105 | 1086 | # Please DO NOT delete this file! | ||
1106 | 1087 | # It is necessary for linking the library. | ||
1107 | 1088 | |||
1108 | 1089 | # Name of the PIC object. | ||
1109 | 1090 | pic_object=$write_lobj | ||
1110 | 1091 | |||
1111 | 1092 | # Name of the non-PIC object | ||
1112 | 1093 | non_pic_object=$write_oldobj | ||
1113 | 1094 | |||
1114 | 1095 | EOF | ||
1115 | 1096 | $MV "${write_libobj}T" "${write_libobj}" | ||
1116 | 1097 | } | ||
1117 | 1098 | } | ||
1118 | 1099 | |||
1119 | 1100 | # func_mode_compile arg... | ||
1120 | 1101 | func_mode_compile () | ||
1121 | 1102 | { | ||
1122 | 1103 | $opt_debug | ||
1123 | 1104 | # Get the compilation command and the source file. | ||
1124 | 1105 | base_compile= | ||
1125 | 1106 | srcfile="$nonopt" # always keep a non-empty value in "srcfile" | ||
1126 | 1107 | suppress_opt=yes | ||
1127 | 1108 | suppress_output= | ||
1128 | 1109 | arg_mode=normal | ||
1129 | 1110 | libobj= | ||
1130 | 1111 | later= | ||
1131 | 1112 | pie_flag= | ||
1132 | 1113 | |||
1133 | 1114 | for arg | ||
1134 | 1115 | do | ||
1135 | 1116 | case $arg_mode in | ||
1136 | 1117 | arg ) | ||
1137 | 1118 | # do not "continue". Instead, add this to base_compile | ||
1138 | 1119 | lastarg="$arg" | ||
1139 | 1120 | arg_mode=normal | ||
1140 | 1121 | ;; | ||
1141 | 1122 | |||
1142 | 1123 | target ) | ||
1143 | 1124 | libobj="$arg" | ||
1144 | 1125 | arg_mode=normal | ||
1145 | 1126 | continue | ||
1146 | 1127 | ;; | ||
1147 | 1128 | |||
1148 | 1129 | normal ) | ||
1149 | 1130 | # Accept any command-line options. | ||
1150 | 1131 | case $arg in | ||
1151 | 1132 | -o) | ||
1152 | 1133 | test -n "$libobj" && \ | ||
1153 | 1134 | func_fatal_error "you cannot specify \`-o' more than once" | ||
1154 | 1135 | arg_mode=target | ||
1155 | 1136 | continue | ||
1156 | 1137 | ;; | ||
1157 | 1138 | |||
1158 | 1139 | -pie | -fpie | -fPIE) | ||
1159 | 1140 | pie_flag="$pie_flag $arg" | ||
1160 | 1141 | continue | ||
1161 | 1142 | ;; | ||
1162 | 1143 | |||
1163 | 1144 | -shared | -static | -prefer-pic | -prefer-non-pic) | ||
1164 | 1145 | later="$later $arg" | ||
1165 | 1146 | continue | ||
1166 | 1147 | ;; | ||
1167 | 1148 | |||
1168 | 1149 | -no-suppress) | ||
1169 | 1150 | suppress_opt=no | ||
1170 | 1151 | continue | ||
1171 | 1152 | ;; | ||
1172 | 1153 | |||
1173 | 1154 | -Xcompiler) | ||
1174 | 1155 | arg_mode=arg # the next one goes into the "base_compile" arg list | ||
1175 | 1156 | continue # The current "srcfile" will either be retained or | ||
1176 | 1157 | ;; # replaced later. I would guess that would be a bug. | ||
1177 | 1158 | |||
1178 | 1159 | -Wc,*) | ||
1179 | 1160 | func_stripname '-Wc,' '' "$arg" | ||
1180 | 1161 | args=$func_stripname_result | ||
1181 | 1162 | lastarg= | ||
1182 | 1163 | save_ifs="$IFS"; IFS=',' | ||
1183 | 1164 | for arg in $args; do | ||
1184 | 1165 | IFS="$save_ifs" | ||
1185 | 1166 | func_quote_for_eval "$arg" | ||
1186 | 1167 | lastarg="$lastarg $func_quote_for_eval_result" | ||
1187 | 1168 | done | ||
1188 | 1169 | IFS="$save_ifs" | ||
1189 | 1170 | func_stripname ' ' '' "$lastarg" | ||
1190 | 1171 | lastarg=$func_stripname_result | ||
1191 | 1172 | |||
1192 | 1173 | # Add the arguments to base_compile. | ||
1193 | 1174 | base_compile="$base_compile $lastarg" | ||
1194 | 1175 | continue | ||
1195 | 1176 | ;; | ||
1196 | 1177 | |||
1197 | 1178 | *) | ||
1198 | 1179 | # Accept the current argument as the source file. | ||
1199 | 1180 | # The previous "srcfile" becomes the current argument. | ||
1200 | 1181 | # | ||
1201 | 1182 | lastarg="$srcfile" | ||
1202 | 1183 | srcfile="$arg" | ||
1203 | 1184 | ;; | ||
1204 | 1185 | esac # case $arg | ||
1205 | 1186 | ;; | ||
1206 | 1187 | esac # case $arg_mode | ||
1207 | 1188 | |||
1208 | 1189 | # Aesthetically quote the previous argument. | ||
1209 | 1190 | func_quote_for_eval "$lastarg" | ||
1210 | 1191 | base_compile="$base_compile $func_quote_for_eval_result" | ||
1211 | 1192 | done # for arg | ||
1212 | 1193 | |||
1213 | 1194 | case $arg_mode in | ||
1214 | 1195 | arg) | ||
1215 | 1196 | func_fatal_error "you must specify an argument for -Xcompile" | ||
1216 | 1197 | ;; | ||
1217 | 1198 | target) | ||
1218 | 1199 | func_fatal_error "you must specify a target with \`-o'" | ||
1219 | 1200 | ;; | ||
1220 | 1201 | *) | ||
1221 | 1202 | # Get the name of the library object. | ||
1222 | 1203 | test -z "$libobj" && { | ||
1223 | 1204 | func_basename "$srcfile" | ||
1224 | 1205 | libobj="$func_basename_result" | ||
1225 | 1206 | } | ||
1226 | 1207 | ;; | ||
1227 | 1208 | esac | ||
1228 | 1209 | |||
1229 | 1210 | # Recognize several different file suffixes. | ||
1230 | 1211 | # If the user specifies -o file.o, it is replaced with file.lo | ||
1231 | 1212 | case $libobj in | ||
1232 | 1213 | *.[cCFSifmso] | \ | ||
1233 | 1214 | *.ada | *.adb | *.ads | *.asm | \ | ||
1234 | 1215 | *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ | ||
1235 | 1216 | *.[fF][09]? | *.for | *.java | *.obj | *.sx) | ||
1236 | 1217 | func_xform "$libobj" | ||
1237 | 1218 | libobj=$func_xform_result | ||
1238 | 1219 | ;; | ||
1239 | 1220 | esac | ||
1240 | 1221 | |||
1241 | 1222 | case $libobj in | ||
1242 | 1223 | *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; | ||
1243 | 1224 | *) | ||
1244 | 1225 | func_fatal_error "cannot determine name of library object from \`$libobj'" | ||
1245 | 1226 | ;; | ||
1246 | 1227 | esac | ||
1247 | 1228 | |||
1248 | 1229 | func_infer_tag $base_compile | ||
1249 | 1230 | |||
1250 | 1231 | for arg in $later; do | ||
1251 | 1232 | case $arg in | ||
1252 | 1233 | -shared) | ||
1253 | 1234 | test "$build_libtool_libs" != yes && \ | ||
1254 | 1235 | func_fatal_configuration "can not build a shared library" | ||
1255 | 1236 | build_old_libs=no | ||
1256 | 1237 | continue | ||
1257 | 1238 | ;; | ||
1258 | 1239 | |||
1259 | 1240 | -static) | ||
1260 | 1241 | build_libtool_libs=no | ||
1261 | 1242 | build_old_libs=yes | ||
1262 | 1243 | continue | ||
1263 | 1244 | ;; | ||
1264 | 1245 | |||
1265 | 1246 | -prefer-pic) | ||
1266 | 1247 | pic_mode=yes | ||
1267 | 1248 | continue | ||
1268 | 1249 | ;; | ||
1269 | 1250 | |||
1270 | 1251 | -prefer-non-pic) | ||
1271 | 1252 | pic_mode=no | ||
1272 | 1253 | continue | ||
1273 | 1254 | ;; | ||
1274 | 1255 | esac | ||
1275 | 1256 | done | ||
1276 | 1257 | |||
1277 | 1258 | func_quote_for_eval "$libobj" | ||
1278 | 1259 | test "X$libobj" != "X$func_quote_for_eval_result" \ | ||
1279 | 1260 | && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ | ||
1280 | 1261 | && func_warning "libobj name \`$libobj' may not contain shell special characters." | ||
1281 | 1262 | func_dirname_and_basename "$obj" "/" "" | ||
1282 | 1263 | objname="$func_basename_result" | ||
1283 | 1264 | xdir="$func_dirname_result" | ||
1284 | 1265 | lobj=${xdir}$objdir/$objname | ||
1285 | 1266 | |||
1286 | 1267 | test -z "$base_compile" && \ | ||
1287 | 1268 | func_fatal_help "you must specify a compilation command" | ||
1288 | 1269 | |||
1289 | 1270 | # Delete any leftover library objects. | ||
1290 | 1271 | if test "$build_old_libs" = yes; then | ||
1291 | 1272 | removelist="$obj $lobj $libobj ${libobj}T" | ||
1292 | 1273 | else | ||
1293 | 1274 | removelist="$lobj $libobj ${libobj}T" | ||
1294 | 1275 | fi | ||
1295 | 1276 | |||
1296 | 1277 | # On Cygwin there's no "real" PIC flag so we must build both object types | ||
1297 | 1278 | case $host_os in | ||
1298 | 1279 | cygwin* | mingw* | pw32* | os2* | cegcc*) | ||
1299 | 1280 | pic_mode=default | ||
1300 | 1281 | ;; | ||
1301 | 1282 | esac | ||
1302 | 1283 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then | ||
1303 | 1284 | # non-PIC code in shared libraries is not supported | ||
1304 | 1285 | pic_mode=default | ||
1305 | 1286 | fi | ||
1306 | 1287 | |||
1307 | 1288 | # Calculate the filename of the output object if compiler does | ||
1308 | 1289 | # not support -o with -c | ||
1309 | 1290 | if test "$compiler_c_o" = no; then | ||
1310 | 1291 | output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} | ||
1311 | 1292 | lockfile="$output_obj.lock" | ||
1312 | 1293 | else | ||
1313 | 1294 | output_obj= | ||
1314 | 1295 | need_locks=no | ||
1315 | 1296 | lockfile= | ||
1316 | 1297 | fi | ||
1317 | 1298 | |||
1318 | 1299 | # Lock this critical section if it is needed | ||
1319 | 1300 | # We use this script file to make the link, it avoids creating a new file | ||
1320 | 1301 | if test "$need_locks" = yes; then | ||
1321 | 1302 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do | ||
1322 | 1303 | func_echo "Waiting for $lockfile to be removed" | ||
1323 | 1304 | sleep 2 | ||
1324 | 1305 | done | ||
1325 | 1306 | elif test "$need_locks" = warn; then | ||
1326 | 1307 | if test -f "$lockfile"; then | ||
1327 | 1308 | $ECHO "\ | ||
1328 | 1309 | *** ERROR, $lockfile exists and contains: | ||
1329 | 1310 | `cat $lockfile 2>/dev/null` | ||
1330 | 1311 | |||
1331 | 1312 | This indicates that another process is trying to use the same | ||
1332 | 1313 | temporary object file, and libtool could not work around it because | ||
1333 | 1314 | your compiler does not support \`-c' and \`-o' together. If you | ||
1334 | 1315 | repeat this compilation, it may succeed, by chance, but you had better | ||
1335 | 1316 | avoid parallel builds (make -j) in this platform, or get a better | ||
1336 | 1317 | compiler." | ||
1337 | 1318 | |||
1338 | 1319 | $opt_dry_run || $RM $removelist | ||
1339 | 1320 | exit $EXIT_FAILURE | ||
1340 | 1321 | fi | ||
1341 | 1322 | removelist="$removelist $output_obj" | ||
1342 | 1323 | $ECHO "$srcfile" > "$lockfile" | ||
1343 | 1324 | fi | ||
1344 | 1325 | |||
1345 | 1326 | $opt_dry_run || $RM $removelist | ||
1346 | 1327 | removelist="$removelist $lockfile" | ||
1347 | 1328 | trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 | ||
1348 | 1329 | |||
1349 | 1330 | if test -n "$fix_srcfile_path"; then | ||
1350 | 1331 | eval srcfile=\"$fix_srcfile_path\" | ||
1351 | 1332 | fi | ||
1352 | 1333 | func_quote_for_eval "$srcfile" | ||
1353 | 1334 | qsrcfile=$func_quote_for_eval_result | ||
1354 | 1335 | |||
1355 | 1336 | # Only build a PIC object if we are building libtool libraries. | ||
1356 | 1337 | if test "$build_libtool_libs" = yes; then | ||
1357 | 1338 | # Without this assignment, base_compile gets emptied. | ||
1358 | 1339 | fbsd_hideous_sh_bug=$base_compile | ||
1359 | 1340 | |||
1360 | 1341 | if test "$pic_mode" != no; then | ||
1361 | 1342 | command="$base_compile $qsrcfile $pic_flag" | ||
1362 | 1343 | else | ||
1363 | 1344 | # Don't build PIC code | ||
1364 | 1345 | command="$base_compile $qsrcfile" | ||
1365 | 1346 | fi | ||
1366 | 1347 | |||
1367 | 1348 | func_mkdir_p "$xdir$objdir" | ||
1368 | 1349 | |||
1369 | 1350 | if test -z "$output_obj"; then | ||
1370 | 1351 | # Place PIC objects in $objdir | ||
1371 | 1352 | command="$command -o $lobj" | ||
1372 | 1353 | fi | ||
1373 | 1354 | |||
1374 | 1355 | func_show_eval_locale "$command" \ | ||
1375 | 1356 | 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' | ||
1376 | 1357 | |||
1377 | 1358 | if test "$need_locks" = warn && | ||
1378 | 1359 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then | ||
1379 | 1360 | $ECHO "\ | ||
1380 | 1361 | *** ERROR, $lockfile contains: | ||
1381 | 1362 | `cat $lockfile 2>/dev/null` | ||
1382 | 1363 | |||
1383 | 1364 | but it should contain: | ||
1384 | 1365 | $srcfile | ||
1385 | 1366 | |||
1386 | 1367 | This indicates that another process is trying to use the same | ||
1387 | 1368 | temporary object file, and libtool could not work around it because | ||
1388 | 1369 | your compiler does not support \`-c' and \`-o' together. If you | ||
1389 | 1370 | repeat this compilation, it may succeed, by chance, but you had better | ||
1390 | 1371 | avoid parallel builds (make -j) in this platform, or get a better | ||
1391 | 1372 | compiler." | ||
1392 | 1373 | |||
1393 | 1374 | $opt_dry_run || $RM $removelist | ||
1394 | 1375 | exit $EXIT_FAILURE | ||
1395 | 1376 | fi | ||
1396 | 1377 | |||
1397 | 1378 | # Just move the object if needed, then go on to compile the next one | ||
1398 | 1379 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then | ||
1399 | 1380 | func_show_eval '$MV "$output_obj" "$lobj"' \ | ||
1400 | 1381 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' | ||
1401 | 1382 | fi | ||
1402 | 1383 | |||
1403 | 1384 | # Allow error messages only from the first compilation. | ||
1404 | 1385 | if test "$suppress_opt" = yes; then | ||
1405 | 1386 | suppress_output=' >/dev/null 2>&1' | ||
1406 | 1387 | fi | ||
1407 | 1388 | fi | ||
1408 | 1389 | |||
1409 | 1390 | # Only build a position-dependent object if we build old libraries. | ||
1410 | 1391 | if test "$build_old_libs" = yes; then | ||
1411 | 1392 | if test "$pic_mode" != yes; then | ||
1412 | 1393 | # Don't build PIC code | ||
1413 | 1394 | command="$base_compile $qsrcfile$pie_flag" | ||
1414 | 1395 | else | ||
1415 | 1396 | command="$base_compile $qsrcfile $pic_flag" | ||
1416 | 1397 | fi | ||
1417 | 1398 | if test "$compiler_c_o" = yes; then | ||
1418 | 1399 | command="$command -o $obj" | ||
1419 | 1400 | fi | ||
1420 | 1401 | |||
1421 | 1402 | # Suppress compiler output if we already did a PIC compilation. | ||
1422 | 1403 | command="$command$suppress_output" | ||
1423 | 1404 | func_show_eval_locale "$command" \ | ||
1424 | 1405 | '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' | ||
1425 | 1406 | |||
1426 | 1407 | if test "$need_locks" = warn && | ||
1427 | 1408 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then | ||
1428 | 1409 | $ECHO "\ | ||
1429 | 1410 | *** ERROR, $lockfile contains: | ||
1430 | 1411 | `cat $lockfile 2>/dev/null` | ||
1431 | 1412 | |||
1432 | 1413 | but it should contain: | ||
1433 | 1414 | $srcfile | ||
1434 | 1415 | |||
1435 | 1416 | This indicates that another process is trying to use the same | ||
1436 | 1417 | temporary object file, and libtool could not work around it because | ||
1437 | 1418 | your compiler does not support \`-c' and \`-o' together. If you | ||
1438 | 1419 | repeat this compilation, it may succeed, by chance, but you had better | ||
1439 | 1420 | avoid parallel builds (make -j) in this platform, or get a better | ||
1440 | 1421 | compiler." | ||
1441 | 1422 | |||
1442 | 1423 | $opt_dry_run || $RM $removelist | ||
1443 | 1424 | exit $EXIT_FAILURE | ||
1444 | 1425 | fi | ||
1445 | 1426 | |||
1446 | 1427 | # Just move the object if needed | ||
1447 | 1428 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then | ||
1448 | 1429 | func_show_eval '$MV "$output_obj" "$obj"' \ | ||
1449 | 1430 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' | ||
1450 | 1431 | fi | ||
1451 | 1432 | fi | ||
1452 | 1433 | |||
1453 | 1434 | $opt_dry_run || { | ||
1454 | 1435 | func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" | ||
1455 | 1436 | |||
1456 | 1437 | # Unlock the critical section if it was locked | ||
1457 | 1438 | if test "$need_locks" != no; then | ||
1458 | 1439 | removelist=$lockfile | ||
1459 | 1440 | $RM "$lockfile" | ||
1460 | 1441 | fi | ||
1461 | 1442 | } | ||
1462 | 1443 | |||
1463 | 1444 | exit $EXIT_SUCCESS | ||
1464 | 1445 | } | ||
1465 | 1446 | |||
1466 | 1447 | $opt_help || { | ||
1467 | 1448 | test "$mode" = compile && func_mode_compile ${1+"$@"} | ||
1468 | 1449 | } | ||
1469 | 1450 | |||
1470 | 1451 | func_mode_help () | ||
1471 | 1452 | { | ||
1472 | 1453 | # We need to display help for each of the modes. | ||
1473 | 1454 | case $mode in | ||
1474 | 1455 | "") | ||
1475 | 1456 | # Generic help is extracted from the usage comments | ||
1476 | 1457 | # at the start of this file. | ||
1477 | 1458 | func_help | ||
1478 | 1459 | ;; | ||
1479 | 1460 | |||
1480 | 1461 | clean) | ||
1481 | 1462 | $ECHO \ | ||
1482 | 1463 | "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... | ||
1483 | 1464 | |||
1484 | 1465 | Remove files from the build directory. | ||
1485 | 1466 | |||
1486 | 1467 | RM is the name of the program to use to delete files associated with each FILE | ||
1487 | 1468 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed | ||
1488 | 1469 | to RM. | ||
1489 | 1470 | |||
1490 | 1471 | If FILE is a libtool library, object or program, all the files associated | ||
1491 | 1472 | with it are deleted. Otherwise, only FILE itself is deleted using RM." | ||
1492 | 1473 | ;; | ||
1493 | 1474 | |||
1494 | 1475 | compile) | ||
1495 | 1476 | $ECHO \ | ||
1496 | 1477 | "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE | ||
1497 | 1478 | |||
1498 | 1479 | Compile a source file into a libtool library object. | ||
1499 | 1480 | |||
1500 | 1481 | This mode accepts the following additional options: | ||
1501 | 1482 | |||
1502 | 1483 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE | ||
1503 | 1484 | -no-suppress do not suppress compiler output for multiple passes | ||
1504 | 1485 | -prefer-pic try to building PIC objects only | ||
1505 | 1486 | -prefer-non-pic try to building non-PIC objects only | ||
1506 | 1487 | -shared do not build a \`.o' file suitable for static linking | ||
1507 | 1488 | -static only build a \`.o' file suitable for static linking | ||
1508 | 1489 | |||
1509 | 1490 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file | ||
1510 | 1491 | from the given SOURCEFILE. | ||
1511 | 1492 | |||
1512 | 1493 | The output file name is determined by removing the directory component from | ||
1513 | 1494 | SOURCEFILE, then substituting the C source code suffix \`.c' with the | ||
1514 | 1495 | library object suffix, \`.lo'." | ||
1515 | 1496 | ;; | ||
1516 | 1497 | |||
1517 | 1498 | execute) | ||
1518 | 1499 | $ECHO \ | ||
1519 | 1500 | "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... | ||
1520 | 1501 | |||
1521 | 1502 | Automatically set library path, then run a program. | ||
1522 | 1503 | |||
1523 | 1504 | This mode accepts the following additional options: | ||
1524 | 1505 | |||
1525 | 1506 | -dlopen FILE add the directory containing FILE to the library path | ||
1526 | 1507 | |||
1527 | 1508 | This mode sets the library path environment variable according to \`-dlopen' | ||
1528 | 1509 | flags. | ||
1529 | 1510 | |||
1530 | 1511 | If any of the ARGS are libtool executable wrappers, then they are translated | ||
1531 | 1512 | into their corresponding uninstalled binary, and any of their required library | ||
1532 | 1513 | directories are added to the library path. | ||
1533 | 1514 | |||
1534 | 1515 | Then, COMMAND is executed, with ARGS as arguments." | ||
1535 | 1516 | ;; | ||
1536 | 1517 | |||
1537 | 1518 | finish) | ||
1538 | 1519 | $ECHO \ | ||
1539 | 1520 | "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... | ||
1540 | 1521 | |||
1541 | 1522 | Complete the installation of libtool libraries. | ||
1542 | 1523 | |||
1543 | 1524 | Each LIBDIR is a directory that contains libtool libraries. | ||
1544 | 1525 | |||
1545 | 1526 | The commands that this mode executes may require superuser privileges. Use | ||
1546 | 1527 | the \`--dry-run' option if you just want to see what would be executed." | ||
1547 | 1528 | ;; | ||
1548 | 1529 | |||
1549 | 1530 | install) | ||
1550 | 1531 | $ECHO \ | ||
1551 | 1532 | "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... | ||
1552 | 1533 | |||
1553 | 1534 | Install executables or libraries. | ||
1554 | 1535 | |||
1555 | 1536 | INSTALL-COMMAND is the installation command. The first component should be | ||
1556 | 1537 | either the \`install' or \`cp' program. | ||
1557 | 1538 | |||
1558 | 1539 | The following components of INSTALL-COMMAND are treated specially: | ||
1559 | 1540 | |||
1560 | 1541 | -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation | ||
1561 | 1542 | |||
1562 | 1543 | The rest of the components are interpreted as arguments to that command (only | ||
1563 | 1544 | BSD-compatible install options are recognized)." | ||
1564 | 1545 | ;; | ||
1565 | 1546 | |||
1566 | 1547 | link) | ||
1567 | 1548 | $ECHO \ | ||
1568 | 1549 | "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... | ||
1569 | 1550 | |||
1570 | 1551 | Link object files or libraries together to form another library, or to | ||
1571 | 1552 | create an executable program. | ||
1572 | 1553 | |||
1573 | 1554 | LINK-COMMAND is a command using the C compiler that you would use to create | ||
1574 | 1555 | a program from several object files. | ||
1575 | 1556 | |||
1576 | 1557 | The following components of LINK-COMMAND are treated specially: | ||
1577 | 1558 | |||
1578 | 1559 | -all-static do not do any dynamic linking at all | ||
1579 | 1560 | -avoid-version do not add a version suffix if possible | ||
1580 | 1561 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime | ||
1581 | 1562 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols | ||
1582 | 1563 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) | ||
1583 | 1564 | -export-symbols SYMFILE | ||
1584 | 1565 | try to export only the symbols listed in SYMFILE | ||
1585 | 1566 | -export-symbols-regex REGEX | ||
1586 | 1567 | try to export only the symbols matching REGEX | ||
1587 | 1568 | -LLIBDIR search LIBDIR for required installed libraries | ||
1588 | 1569 | -lNAME OUTPUT-FILE requires the installed library libNAME | ||
1589 | 1570 | -module build a library that can dlopened | ||
1590 | 1571 | -no-fast-install disable the fast-install mode | ||
1591 | 1572 | -no-install link a not-installable executable | ||
1592 | 1573 | -no-undefined declare that a library does not refer to external symbols | ||
1593 | 1574 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects | ||
1594 | 1575 | -objectlist FILE Use a list of object files found in FILE to specify objects | ||
1595 | 1576 | -precious-files-regex REGEX | ||
1596 | 1577 | don't remove output files matching REGEX | ||
1597 | 1578 | -release RELEASE specify package release information | ||
1598 | 1579 | -rpath LIBDIR the created library will eventually be installed in LIBDIR | ||
1599 | 1580 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries | ||
1600 | 1581 | -shared only do dynamic linking of libtool libraries | ||
1601 | 1582 | -shrext SUFFIX override the standard shared library file extension | ||
1602 | 1583 | -static do not do any dynamic linking of uninstalled libtool libraries | ||
1603 | 1584 | -static-libtool-libs | ||
1604 | 1585 | do not do any dynamic linking of libtool libraries | ||
1605 | 1586 | -version-info CURRENT[:REVISION[:AGE]] | ||
1606 | 1587 | specify library version info [each variable defaults to 0] | ||
1607 | 1588 | -weak LIBNAME declare that the target provides the LIBNAME interface | ||
1608 | 1589 | |||
1609 | 1590 | All other options (arguments beginning with \`-') are ignored. | ||
1610 | 1591 | |||
1611 | 1592 | Every other argument is treated as a filename. Files ending in \`.la' are | ||
1612 | 1593 | treated as uninstalled libtool libraries, other files are standard or library | ||
1613 | 1594 | object files. | ||
1614 | 1595 | |||
1615 | 1596 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, | ||
1616 | 1597 | only library objects (\`.lo' files) may be specified, and \`-rpath' is | ||
1617 | 1598 | required, except when creating a convenience library. | ||
1618 | 1599 | |||
1619 | 1600 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created | ||
1620 | 1601 | using \`ar' and \`ranlib', or on Windows using \`lib'. | ||
1621 | 1602 | |||
1622 | 1603 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file | ||
1623 | 1604 | is created, otherwise an executable program is created." | ||
1624 | 1605 | ;; | ||
1625 | 1606 | |||
1626 | 1607 | uninstall) | ||
1627 | 1608 | $ECHO \ | ||
1628 | 1609 | "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... | ||
1629 | 1610 | |||
1630 | 1611 | Remove libraries from an installation directory. | ||
1631 | 1612 | |||
1632 | 1613 | RM is the name of the program to use to delete files associated with each FILE | ||
1633 | 1614 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed | ||
1634 | 1615 | to RM. | ||
1635 | 1616 | |||
1636 | 1617 | If FILE is a libtool library, all the files associated with it are deleted. | ||
1637 | 1618 | Otherwise, only FILE itself is deleted using RM." | ||
1638 | 1619 | ;; | ||
1639 | 1620 | |||
1640 | 1621 | *) | ||
1641 | 1622 | func_fatal_help "invalid operation mode \`$mode'" | ||
1642 | 1623 | ;; | ||
1643 | 1624 | esac | ||
1644 | 1625 | |||
1645 | 1626 | $ECHO | ||
1646 | 1627 | $ECHO "Try \`$progname --help' for more information about other modes." | ||
1647 | 1628 | |||
1648 | 1629 | exit $? | ||
1649 | 1630 | } | ||
1650 | 1631 | |||
1651 | 1632 | # Now that we've collected a possible --mode arg, show help if necessary | ||
1652 | 1633 | $opt_help && func_mode_help | ||
1653 | 1634 | |||
1654 | 1635 | |||
1655 | 1636 | # func_mode_execute arg... | ||
1656 | 1637 | func_mode_execute () | ||
1657 | 1638 | { | ||
1658 | 1639 | $opt_debug | ||
1659 | 1640 | # The first argument is the command name. | ||
1660 | 1641 | cmd="$nonopt" | ||
1661 | 1642 | test -z "$cmd" && \ | ||
1662 | 1643 | func_fatal_help "you must specify a COMMAND" | ||
1663 | 1644 | |||
1664 | 1645 | # Handle -dlopen flags immediately. | ||
1665 | 1646 | for file in $execute_dlfiles; do | ||
1666 | 1647 | test -f "$file" \ | ||
1667 | 1648 | || func_fatal_help "\`$file' is not a file" | ||
1668 | 1649 | |||
1669 | 1650 | dir= | ||
1670 | 1651 | case $file in | ||
1671 | 1652 | *.la) | ||
1672 | 1653 | # Check to see that this really is a libtool archive. | ||
1673 | 1654 | func_lalib_unsafe_p "$file" \ | ||
1674 | 1655 | || func_fatal_help "\`$lib' is not a valid libtool archive" | ||
1675 | 1656 | |||
1676 | 1657 | # Read the libtool library. | ||
1677 | 1658 | dlname= | ||
1678 | 1659 | library_names= | ||
1679 | 1660 | func_source "$file" | ||
1680 | 1661 | |||
1681 | 1662 | # Skip this library if it cannot be dlopened. | ||
1682 | 1663 | if test -z "$dlname"; then | ||
1683 | 1664 | # Warn if it was a shared library. | ||
1684 | 1665 | test -n "$library_names" && \ | ||
1685 | 1666 | func_warning "\`$file' was not linked with \`-export-dynamic'" | ||
1686 | 1667 | continue | ||
1687 | 1668 | fi | ||
1688 | 1669 | |||
1689 | 1670 | func_dirname "$file" "" "." | ||
1690 | 1671 | dir="$func_dirname_result" | ||
1691 | 1672 | |||
1692 | 1673 | if test -f "$dir/$objdir/$dlname"; then | ||
1693 | 1674 | dir="$dir/$objdir" | ||
1694 | 1675 | else | ||
1695 | 1676 | if test ! -f "$dir/$dlname"; then | ||
1696 | 1677 | func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" | ||
1697 | 1678 | fi | ||
1698 | 1679 | fi | ||
1699 | 1680 | ;; | ||
1700 | 1681 | |||
1701 | 1682 | *.lo) | ||
1702 | 1683 | # Just add the directory containing the .lo file. | ||
1703 | 1684 | func_dirname "$file" "" "." | ||
1704 | 1685 | dir="$func_dirname_result" | ||
1705 | 1686 | ;; | ||
1706 | 1687 | |||
1707 | 1688 | *) | ||
1708 | 1689 | func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" | ||
1709 | 1690 | continue | ||
1710 | 1691 | ;; | ||
1711 | 1692 | esac | ||
1712 | 1693 | |||
1713 | 1694 | # Get the absolute pathname. | ||
1714 | 1695 | absdir=`cd "$dir" && pwd` | ||
1715 | 1696 | test -n "$absdir" && dir="$absdir" | ||
1716 | 1697 | |||
1717 | 1698 | # Now add the directory to shlibpath_var. | ||
1718 | 1699 | if eval "test -z \"\$$shlibpath_var\""; then | ||
1719 | 1700 | eval "$shlibpath_var=\"\$dir\"" | ||
1720 | 1701 | else | ||
1721 | 1702 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" | ||
1722 | 1703 | fi | ||
1723 | 1704 | done | ||
1724 | 1705 | |||
1725 | 1706 | # This variable tells wrapper scripts just to set shlibpath_var | ||
1726 | 1707 | # rather than running their programs. | ||
1727 | 1708 | libtool_execute_magic="$magic" | ||
1728 | 1709 | |||
1729 | 1710 | # Check if any of the arguments is a wrapper script. | ||
1730 | 1711 | args= | ||
1731 | 1712 | for file | ||
1732 | 1713 | do | ||
1733 | 1714 | case $file in | ||
1734 | 1715 | -*) ;; | ||
1735 | 1716 | *) | ||
1736 | 1717 | # Do a test to see if this is really a libtool program. | ||
1737 | 1718 | if func_ltwrapper_script_p "$file"; then | ||
1738 | 1719 | func_source "$file" | ||
1739 | 1720 | # Transform arg to wrapped name. | ||
1740 | 1721 | file="$progdir/$program" | ||
1741 | 1722 | elif func_ltwrapper_executable_p "$file"; then | ||
1742 | 1723 | func_ltwrapper_scriptname "$file" | ||
1743 | 1724 | func_source "$func_ltwrapper_scriptname_result" | ||
1744 | 1725 | # Transform arg to wrapped name. | ||
1745 | 1726 | file="$progdir/$program" | ||
1746 | 1727 | fi | ||
1747 | 1728 | ;; | ||
1748 | 1729 | esac | ||
1749 | 1730 | # Quote arguments (to preserve shell metacharacters). | ||
1750 | 1731 | func_quote_for_eval "$file" | ||
1751 | 1732 | args="$args $func_quote_for_eval_result" | ||
1752 | 1733 | done | ||
1753 | 1734 | |||
1754 | 1735 | if test "X$opt_dry_run" = Xfalse; then | ||
1755 | 1736 | if test -n "$shlibpath_var"; then | ||
1756 | 1737 | # Export the shlibpath_var. | ||
1757 | 1738 | eval "export $shlibpath_var" | ||
1758 | 1739 | fi | ||
1759 | 1740 | |||
1760 | 1741 | # Restore saved environment variables | ||
1761 | 1742 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES | ||
1762 | 1743 | do | ||
1763 | 1744 | eval "if test \"\${save_$lt_var+set}\" = set; then | ||
1764 | 1745 | $lt_var=\$save_$lt_var; export $lt_var | ||
1765 | 1746 | else | ||
1766 | 1747 | $lt_unset $lt_var | ||
1767 | 1748 | fi" | ||
1768 | 1749 | done | ||
1769 | 1750 | |||
1770 | 1751 | # Now prepare to actually exec the command. | ||
1771 | 1752 | exec_cmd="\$cmd$args" | ||
1772 | 1753 | else | ||
1773 | 1754 | # Display what would be done. | ||
1774 | 1755 | if test -n "$shlibpath_var"; then | ||
1775 | 1756 | eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" | ||
1776 | 1757 | $ECHO "export $shlibpath_var" | ||
1777 | 1758 | fi | ||
1778 | 1759 | $ECHO "$cmd$args" | ||
1779 | 1760 | exit $EXIT_SUCCESS | ||
1780 | 1761 | fi | ||
1781 | 1762 | } | ||
1782 | 1763 | |||
1783 | 1764 | test "$mode" = execute && func_mode_execute ${1+"$@"} | ||
1784 | 1765 | |||
1785 | 1766 | |||
1786 | 1767 | # func_mode_finish arg... | ||
1787 | 1768 | func_mode_finish () | ||
1788 | 1769 | { | ||
1789 | 1770 | $opt_debug | ||
1790 | 1771 | libdirs="$nonopt" | ||
1791 | 1772 | admincmds= | ||
1792 | 1773 | |||
1793 | 1774 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then | ||
1794 | 1775 | for dir | ||
1795 | 1776 | do | ||
1796 | 1777 | libdirs="$libdirs $dir" | ||
1797 | 1778 | done | ||
1798 | 1779 | |||
1799 | 1780 | for libdir in $libdirs; do | ||
1800 | 1781 | if test -n "$finish_cmds"; then | ||
1801 | 1782 | # Do each command in the finish commands. | ||
1802 | 1783 | func_execute_cmds "$finish_cmds" 'admincmds="$admincmds | ||
1803 | 1784 | '"$cmd"'"' | ||
1804 | 1785 | fi | ||
1805 | 1786 | if test -n "$finish_eval"; then | ||
1806 | 1787 | # Do the single finish_eval. | ||
1807 | 1788 | eval cmds=\"$finish_eval\" | ||
1808 | 1789 | $opt_dry_run || eval "$cmds" || admincmds="$admincmds | ||
1809 | 1790 | $cmds" | ||
1810 | 1791 | fi | ||
1811 | 1792 | done | ||
1812 | 1793 | fi | ||
1813 | 1794 | |||
1814 | 1795 | # Exit here if they wanted silent mode. | ||
1815 | 1796 | $opt_silent && exit $EXIT_SUCCESS | ||
1816 | 1797 | |||
1817 | 1798 | $ECHO "X----------------------------------------------------------------------" | $Xsed | ||
1818 | 1799 | $ECHO "Libraries have been installed in:" | ||
1819 | 1800 | for libdir in $libdirs; do | ||
1820 | 1801 | $ECHO " $libdir" | ||
1821 | 1802 | done | ||
1822 | 1803 | $ECHO | ||
1823 | 1804 | $ECHO "If you ever happen to want to link against installed libraries" | ||
1824 | 1805 | $ECHO "in a given directory, LIBDIR, you must either use libtool, and" | ||
1825 | 1806 | $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" | ||
1826 | 1807 | $ECHO "flag during linking and do at least one of the following:" | ||
1827 | 1808 | if test -n "$shlibpath_var"; then | ||
1828 | 1809 | $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" | ||
1829 | 1810 | $ECHO " during execution" | ||
1830 | 1811 | fi | ||
1831 | 1812 | if test -n "$runpath_var"; then | ||
1832 | 1813 | $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" | ||
1833 | 1814 | $ECHO " during linking" | ||
1834 | 1815 | fi | ||
1835 | 1816 | if test -n "$hardcode_libdir_flag_spec"; then | ||
1836 | 1817 | libdir=LIBDIR | ||
1837 | 1818 | eval flag=\"$hardcode_libdir_flag_spec\" | ||
1838 | 1819 | |||
1839 | 1820 | $ECHO " - use the \`$flag' linker flag" | ||
1840 | 1821 | fi | ||
1841 | 1822 | if test -n "$admincmds"; then | ||
1842 | 1823 | $ECHO " - have your system administrator run these commands:$admincmds" | ||
1843 | 1824 | fi | ||
1844 | 1825 | if test -f /etc/ld.so.conf; then | ||
1845 | 1826 | $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" | ||
1846 | 1827 | fi | ||
1847 | 1828 | $ECHO | ||
1848 | 1829 | |||
1849 | 1830 | $ECHO "See any operating system documentation about shared libraries for" | ||
1850 | 1831 | case $host in | ||
1851 | 1832 | solaris2.[6789]|solaris2.1[0-9]) | ||
1852 | 1833 | $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" | ||
1853 | 1834 | $ECHO "pages." | ||
1854 | 1835 | ;; | ||
1855 | 1836 | *) | ||
1856 | 1837 | $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." | ||
1857 | 1838 | ;; | ||
1858 | 1839 | esac | ||
1859 | 1840 | $ECHO "X----------------------------------------------------------------------" | $Xsed | ||
1860 | 1841 | exit $EXIT_SUCCESS | ||
1861 | 1842 | } | ||
1862 | 1843 | |||
1863 | 1844 | test "$mode" = finish && func_mode_finish ${1+"$@"} | ||
1864 | 1845 | |||
1865 | 1846 | |||
1866 | 1847 | # func_mode_install arg... | ||
1867 | 1848 | func_mode_install () | ||
1868 | 1849 | { | ||
1869 | 1850 | $opt_debug | ||
1870 | 1851 | # There may be an optional sh(1) argument at the beginning of | ||
1871 | 1852 | # install_prog (especially on Windows NT). | ||
1872 | 1853 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || | ||
1873 | 1854 | # Allow the use of GNU shtool's install command. | ||
1874 | 1855 | $ECHO "X$nonopt" | $GREP shtool >/dev/null; then | ||
1875 | 1856 | # Aesthetically quote it. | ||
1876 | 1857 | func_quote_for_eval "$nonopt" | ||
1877 | 1858 | install_prog="$func_quote_for_eval_result " | ||
1878 | 1859 | arg=$1 | ||
1879 | 1860 | shift | ||
1880 | 1861 | else | ||
1881 | 1862 | install_prog= | ||
1882 | 1863 | arg=$nonopt | ||
1883 | 1864 | fi | ||
1884 | 1865 | |||
1885 | 1866 | # The real first argument should be the name of the installation program. | ||
1886 | 1867 | # Aesthetically quote it. | ||
1887 | 1868 | func_quote_for_eval "$arg" | ||
1888 | 1869 | install_prog="$install_prog$func_quote_for_eval_result" | ||
1889 | 1870 | |||
1890 | 1871 | # We need to accept at least all the BSD install flags. | ||
1891 | 1872 | dest= | ||
1892 | 1873 | files= | ||
1893 | 1874 | opts= | ||
1894 | 1875 | prev= | ||
1895 | 1876 | install_type= | ||
1896 | 1877 | isdir=no | ||
1897 | 1878 | stripme= | ||
1898 | 1879 | for arg | ||
1899 | 1880 | do | ||
1900 | 1881 | if test -n "$dest"; then | ||
1901 | 1882 | files="$files $dest" | ||
1902 | 1883 | dest=$arg | ||
1903 | 1884 | continue | ||
1904 | 1885 | fi | ||
1905 | 1886 | |||
1906 | 1887 | case $arg in | ||
1907 | 1888 | -d) isdir=yes ;; | ||
1908 | 1889 | -f) | ||
1909 | 1890 | case " $install_prog " in | ||
1910 | 1891 | *[\\\ /]cp\ *) ;; | ||
1911 | 1892 | *) prev=$arg ;; | ||
1912 | 1893 | esac | ||
1913 | 1894 | ;; | ||
1914 | 1895 | -g | -m | -o) | ||
1915 | 1896 | prev=$arg | ||
1916 | 1897 | ;; | ||
1917 | 1898 | -s) | ||
1918 | 1899 | stripme=" -s" | ||
1919 | 1900 | continue | ||
1920 | 1901 | ;; | ||
1921 | 1902 | -*) | ||
1922 | 1903 | ;; | ||
1923 | 1904 | *) | ||
1924 | 1905 | # If the previous option needed an argument, then skip it. | ||
1925 | 1906 | if test -n "$prev"; then | ||
1926 | 1907 | prev= | ||
1927 | 1908 | else | ||
1928 | 1909 | dest=$arg | ||
1929 | 1910 | continue | ||
1930 | 1911 | fi | ||
1931 | 1912 | ;; | ||
1932 | 1913 | esac | ||
1933 | 1914 | |||
1934 | 1915 | # Aesthetically quote the argument. | ||
1935 | 1916 | func_quote_for_eval "$arg" | ||
1936 | 1917 | install_prog="$install_prog $func_quote_for_eval_result" | ||
1937 | 1918 | done | ||
1938 | 1919 | |||
1939 | 1920 | test -z "$install_prog" && \ | ||
1940 | 1921 | func_fatal_help "you must specify an install program" | ||
1941 | 1922 | |||
1942 | 1923 | test -n "$prev" && \ | ||
1943 | 1924 | func_fatal_help "the \`$prev' option requires an argument" | ||
1944 | 1925 | |||
1945 | 1926 | if test -z "$files"; then | ||
1946 | 1927 | if test -z "$dest"; then | ||
1947 | 1928 | func_fatal_help "no file or destination specified" | ||
1948 | 1929 | else | ||
1949 | 1930 | func_fatal_help "you must specify a destination" | ||
1950 | 1931 | fi | ||
1951 | 1932 | fi | ||
1952 | 1933 | |||
1953 | 1934 | # Strip any trailing slash from the destination. | ||
1954 | 1935 | func_stripname '' '/' "$dest" | ||
1955 | 1936 | dest=$func_stripname_result | ||
1956 | 1937 | |||
1957 | 1938 | # Check to see that the destination is a directory. | ||
1958 | 1939 | test -d "$dest" && isdir=yes | ||
1959 | 1940 | if test "$isdir" = yes; then | ||
1960 | 1941 | destdir="$dest" | ||
1961 | 1942 | destname= | ||
1962 | 1943 | else | ||
1963 | 1944 | func_dirname_and_basename "$dest" "" "." | ||
1964 | 1945 | destdir="$func_dirname_result" | ||
1965 | 1946 | destname="$func_basename_result" | ||
1966 | 1947 | |||
1967 | 1948 | # Not a directory, so check to see that there is only one file specified. | ||
1968 | 1949 | set dummy $files; shift | ||
1969 | 1950 | test "$#" -gt 1 && \ | ||
1970 | 1951 | func_fatal_help "\`$dest' is not a directory" | ||
1971 | 1952 | fi | ||
1972 | 1953 | case $destdir in | ||
1973 | 1954 | [\\/]* | [A-Za-z]:[\\/]*) ;; | ||
1974 | 1955 | *) | ||
1975 | 1956 | for file in $files; do | ||
1976 | 1957 | case $file in | ||
1977 | 1958 | *.lo) ;; | ||
1978 | 1959 | *) | ||
1979 | 1960 | func_fatal_help "\`$destdir' must be an absolute directory name" | ||
1980 | 1961 | ;; | ||
1981 | 1962 | esac | ||
1982 | 1963 | done | ||
1983 | 1964 | ;; | ||
1984 | 1965 | esac | ||
1985 | 1966 | |||
1986 | 1967 | # This variable tells wrapper scripts just to set variables rather | ||
1987 | 1968 | # than running their programs. | ||
1988 | 1969 | libtool_install_magic="$magic" | ||
1989 | 1970 | |||
1990 | 1971 | staticlibs= | ||
1991 | 1972 | future_libdirs= | ||
1992 | 1973 | current_libdirs= | ||
1993 | 1974 | for file in $files; do | ||
1994 | 1975 | |||
1995 | 1976 | # Do each installation. | ||
1996 | 1977 | case $file in | ||
1997 | 1978 | *.$libext) | ||
1998 | 1979 | # Do the static libraries later. | ||
1999 | 1980 | staticlibs="$staticlibs $file" | ||
2000 | 1981 | ;; | ||
2001 | 1982 | |||
2002 | 1983 | *.la) | ||
2003 | 1984 | # Check to see that this really is a libtool archive. | ||
2004 | 1985 | func_lalib_unsafe_p "$file" \ | ||
2005 | 1986 | || func_fatal_help "\`$file' is not a valid libtool archive" | ||
2006 | 1987 | |||
2007 | 1988 | library_names= | ||
2008 | 1989 | old_library= | ||
2009 | 1990 | relink_command= | ||
2010 | 1991 | func_source "$file" | ||
2011 | 1992 | |||
2012 | 1993 | # Add the libdir to current_libdirs if it is the destination. | ||
2013 | 1994 | if test "X$destdir" = "X$libdir"; then | ||
2014 | 1995 | case "$current_libdirs " in | ||
2015 | 1996 | *" $libdir "*) ;; | ||
2016 | 1997 | *) current_libdirs="$current_libdirs $libdir" ;; | ||
2017 | 1998 | esac | ||
2018 | 1999 | else | ||
2019 | 2000 | # Note the libdir as a future libdir. | ||
2020 | 2001 | case "$future_libdirs " in | ||
2021 | 2002 | *" $libdir "*) ;; | ||
2022 | 2003 | *) future_libdirs="$future_libdirs $libdir" ;; | ||
2023 | 2004 | esac | ||
2024 | 2005 | fi | ||
2025 | 2006 | |||
2026 | 2007 | func_dirname "$file" "/" "" | ||
2027 | 2008 | dir="$func_dirname_result" | ||
2028 | 2009 | dir="$dir$objdir" | ||
2029 | 2010 | |||
2030 | 2011 | if test -n "$relink_command"; then | ||
2031 | 2012 | # Determine the prefix the user has applied to our future dir. | ||
2032 | 2013 | inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` | ||
2033 | 2014 | |||
2034 | 2015 | # Don't allow the user to place us outside of our expected | ||
2035 | 2016 | # location b/c this prevents finding dependent libraries that | ||
2036 | 2017 | # are installed to the same prefix. | ||
2037 | 2018 | # At present, this check doesn't affect windows .dll's that | ||
2038 | 2019 | # are installed into $libdir/../bin (currently, that works fine) | ||
2039 | 2020 | # but it's something to keep an eye on. | ||
2040 | 2021 | test "$inst_prefix_dir" = "$destdir" && \ | ||
2041 | 2022 | func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" | ||
2042 | 2023 | |||
2043 | 2024 | if test -n "$inst_prefix_dir"; then | ||
2044 | 2025 | # Stick the inst_prefix_dir data into the link command. | ||
2045 | 2026 | relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` | ||
2046 | 2027 | else | ||
2047 | 2028 | relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` | ||
2048 | 2029 | fi | ||
2049 | 2030 | |||
2050 | 2031 | func_warning "relinking \`$file'" | ||
2051 | 2032 | func_show_eval "$relink_command" \ | ||
2052 | 2033 | 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' | ||
2053 | 2034 | fi | ||
2054 | 2035 | |||
2055 | 2036 | # See the names of the shared library. | ||
2056 | 2037 | set dummy $library_names; shift | ||
2057 | 2038 | if test -n "$1"; then | ||
2058 | 2039 | realname="$1" | ||
2059 | 2040 | shift | ||
2060 | 2041 | |||
2061 | 2042 | srcname="$realname" | ||
2062 | 2043 | test -n "$relink_command" && srcname="$realname"T | ||
2063 | 2044 | |||
2064 | 2045 | # Install the shared library and build the symlinks. | ||
2065 | 2046 | func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ | ||
2066 | 2047 | 'exit $?' | ||
2067 | 2048 | tstripme="$stripme" | ||
2068 | 2049 | case $host_os in | ||
2069 | 2050 | cygwin* | mingw* | pw32* | cegcc*) | ||
2070 | 2051 | case $realname in | ||
2071 | 2052 | *.dll.a) | ||
2072 | 2053 | tstripme="" | ||
2073 | 2054 | ;; | ||
2074 | 2055 | esac | ||
2075 | 2056 | ;; | ||
2076 | 2057 | esac | ||
2077 | 2058 | if test -n "$tstripme" && test -n "$striplib"; then | ||
2078 | 2059 | func_show_eval "$striplib $destdir/$realname" 'exit $?' | ||
2079 | 2060 | fi | ||
2080 | 2061 | |||
2081 | 2062 | if test "$#" -gt 0; then | ||
2082 | 2063 | # Delete the old symlinks, and create new ones. | ||
2083 | 2064 | # Try `ln -sf' first, because the `ln' binary might depend on | ||
2084 | 2065 | # the symlink we replace! Solaris /bin/ln does not understand -f, | ||
2085 | 2066 | # so we also need to try rm && ln -s. | ||
2086 | 2067 | for linkname | ||
2087 | 2068 | do | ||
2088 | 2069 | test "$linkname" != "$realname" \ | ||
2089 | 2070 | && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" | ||
2090 | 2071 | done | ||
2091 | 2072 | fi | ||
2092 | 2073 | |||
2093 | 2074 | # Do each command in the postinstall commands. | ||
2094 | 2075 | lib="$destdir/$realname" | ||
2095 | 2076 | func_execute_cmds "$postinstall_cmds" 'exit $?' | ||
2096 | 2077 | fi | ||
2097 | 2078 | |||
2098 | 2079 | # Install the pseudo-library for information purposes. | ||
2099 | 2080 | func_basename "$file" | ||
2100 | 2081 | name="$func_basename_result" | ||
2101 | 2082 | instname="$dir/$name"i | ||
2102 | 2083 | func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' | ||
2103 | 2084 | |||
2104 | 2085 | # Maybe install the static library, too. | ||
2105 | 2086 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" | ||
2106 | 2087 | ;; | ||
2107 | 2088 | |||
2108 | 2089 | *.lo) | ||
2109 | 2090 | # Install (i.e. copy) a libtool object. | ||
2110 | 2091 | |||
2111 | 2092 | # Figure out destination file name, if it wasn't already specified. | ||
2112 | 2093 | if test -n "$destname"; then | ||
2113 | 2094 | destfile="$destdir/$destname" | ||
2114 | 2095 | else | ||
2115 | 2096 | func_basename "$file" | ||
2116 | 2097 | destfile="$func_basename_result" | ||
2117 | 2098 | destfile="$destdir/$destfile" | ||
2118 | 2099 | fi | ||
2119 | 2100 | |||
2120 | 2101 | # Deduce the name of the destination old-style object file. | ||
2121 | 2102 | case $destfile in | ||
2122 | 2103 | *.lo) | ||
2123 | 2104 | func_lo2o "$destfile" | ||
2124 | 2105 | staticdest=$func_lo2o_result | ||
2125 | 2106 | ;; | ||
2126 | 2107 | *.$objext) | ||
2127 | 2108 | staticdest="$destfile" | ||
2128 | 2109 | destfile= | ||
2129 | 2110 | ;; | ||
2130 | 2111 | *) | ||
2131 | 2112 | func_fatal_help "cannot copy a libtool object to \`$destfile'" | ||
2132 | 2113 | ;; | ||
2133 | 2114 | esac | ||
2134 | 2115 | |||
2135 | 2116 | # Install the libtool object if requested. | ||
2136 | 2117 | test -n "$destfile" && \ | ||
2137 | 2118 | func_show_eval "$install_prog $file $destfile" 'exit $?' | ||
2138 | 2119 | |||
2139 | 2120 | # Install the old object if enabled. | ||
2140 | 2121 | if test "$build_old_libs" = yes; then | ||
2141 | 2122 | # Deduce the name of the old-style object file. | ||
2142 | 2123 | func_lo2o "$file" | ||
2143 | 2124 | staticobj=$func_lo2o_result | ||
2144 | 2125 | func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' | ||
2145 | 2126 | fi | ||
2146 | 2127 | exit $EXIT_SUCCESS | ||
2147 | 2128 | ;; | ||
2148 | 2129 | |||
2149 | 2130 | *) | ||
2150 | 2131 | # Figure out destination file name, if it wasn't already specified. | ||
2151 | 2132 | if test -n "$destname"; then | ||
2152 | 2133 | destfile="$destdir/$destname" | ||
2153 | 2134 | else | ||
2154 | 2135 | func_basename "$file" | ||
2155 | 2136 | destfile="$func_basename_result" | ||
2156 | 2137 | destfile="$destdir/$destfile" | ||
2157 | 2138 | fi | ||
2158 | 2139 | |||
2159 | 2140 | # If the file is missing, and there is a .exe on the end, strip it | ||
2160 | 2141 | # because it is most likely a libtool script we actually want to | ||
2161 | 2142 | # install | ||
2162 | 2143 | stripped_ext="" | ||
2163 | 2144 | case $file in | ||
2164 | 2145 | *.exe) | ||
2165 | 2146 | if test ! -f "$file"; then | ||
2166 | 2147 | func_stripname '' '.exe' "$file" | ||
2167 | 2148 | file=$func_stripname_result | ||
2168 | 2149 | stripped_ext=".exe" | ||
2169 | 2150 | fi | ||
2170 | 2151 | ;; | ||
2171 | 2152 | esac | ||
2172 | 2153 | |||
2173 | 2154 | # Do a test to see if this is really a libtool program. | ||
2174 | 2155 | case $host in | ||
2175 | 2156 | *cygwin* | *mingw*) | ||
2176 | 2157 | if func_ltwrapper_executable_p "$file"; then | ||
2177 | 2158 | func_ltwrapper_scriptname "$file" | ||
2178 | 2159 | wrapper=$func_ltwrapper_scriptname_result | ||
2179 | 2160 | else | ||
2180 | 2161 | func_stripname '' '.exe' "$file" | ||
2181 | 2162 | wrapper=$func_stripname_result | ||
2182 | 2163 | fi | ||
2183 | 2164 | ;; | ||
2184 | 2165 | *) | ||
2185 | 2166 | wrapper=$file | ||
2186 | 2167 | ;; | ||
2187 | 2168 | esac | ||
2188 | 2169 | if func_ltwrapper_script_p "$wrapper"; then | ||
2189 | 2170 | notinst_deplibs= | ||
2190 | 2171 | relink_command= | ||
2191 | 2172 | |||
2192 | 2173 | func_source "$wrapper" | ||
2193 | 2174 | |||
2194 | 2175 | # Check the variables that should have been set. | ||
2195 | 2176 | test -z "$generated_by_libtool_version" && \ | ||
2196 | 2177 | func_fatal_error "invalid libtool wrapper script \`$wrapper'" | ||
2197 | 2178 | |||
2198 | 2179 | finalize=yes | ||
2199 | 2180 | for lib in $notinst_deplibs; do | ||
2200 | 2181 | # Check to see that each library is installed. | ||
2201 | 2182 | libdir= | ||
2202 | 2183 | if test -f "$lib"; then | ||
2203 | 2184 | func_source "$lib" | ||
2204 | 2185 | fi | ||
2205 | 2186 | libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test | ||
2206 | 2187 | if test -n "$libdir" && test ! -f "$libfile"; then | ||
2207 | 2188 | func_warning "\`$lib' has not been installed in \`$libdir'" | ||
2208 | 2189 | finalize=no | ||
2209 | 2190 | fi | ||
2210 | 2191 | done | ||
2211 | 2192 | |||
2212 | 2193 | relink_command= | ||
2213 | 2194 | func_source "$wrapper" | ||
2214 | 2195 | |||
2215 | 2196 | outputname= | ||
2216 | 2197 | if test "$fast_install" = no && test -n "$relink_command"; then | ||
2217 | 2198 | $opt_dry_run || { | ||
2218 | 2199 | if test "$finalize" = yes; then | ||
2219 | 2200 | tmpdir=`func_mktempdir` | ||
2220 | 2201 | func_basename "$file$stripped_ext" | ||
2221 | 2202 | file="$func_basename_result" | ||
2222 | 2203 | outputname="$tmpdir/$file" | ||
2223 | 2204 | # Replace the output file specification. | ||
2224 | 2205 | relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` | ||
2225 | 2206 | |||
2226 | 2207 | $opt_silent || { | ||
2227 | 2208 | func_quote_for_expand "$relink_command" | ||
2228 | 2209 | eval "func_echo $func_quote_for_expand_result" | ||
2229 | 2210 | } | ||
2230 | 2211 | if eval "$relink_command"; then : | ||
2231 | 2212 | else | ||
2232 | 2213 | func_error "error: relink \`$file' with the above command before installing it" | ||
2233 | 2214 | $opt_dry_run || ${RM}r "$tmpdir" | ||
2234 | 2215 | continue | ||
2235 | 2216 | fi | ||
2236 | 2217 | file="$outputname" | ||
2237 | 2218 | else | ||
2238 | 2219 | func_warning "cannot relink \`$file'" | ||
2239 | 2220 | fi | ||
2240 | 2221 | } | ||
2241 | 2222 | else | ||
2242 | 2223 | # Install the binary that we compiled earlier. | ||
2243 | 2224 | file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` | ||
2244 | 2225 | fi | ||
2245 | 2226 | fi | ||
2246 | 2227 | |||
2247 | 2228 | # remove .exe since cygwin /usr/bin/install will append another | ||
2248 | 2229 | # one anyway | ||
2249 | 2230 | case $install_prog,$host in | ||
2250 | 2231 | */usr/bin/install*,*cygwin*) | ||
2251 | 2232 | case $file:$destfile in | ||
2252 | 2233 | *.exe:*.exe) | ||
2253 | 2234 | # this is ok | ||
2254 | 2235 | ;; | ||
2255 | 2236 | *.exe:*) | ||
2256 | 2237 | destfile=$destfile.exe | ||
2257 | 2238 | ;; | ||
2258 | 2239 | *:*.exe) | ||
2259 | 2240 | func_stripname '' '.exe' "$destfile" | ||
2260 | 2241 | destfile=$func_stripname_result | ||
2261 | 2242 | ;; | ||
2262 | 2243 | esac | ||
2263 | 2244 | ;; | ||
2264 | 2245 | esac | ||
2265 | 2246 | func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' | ||
2266 | 2247 | $opt_dry_run || if test -n "$outputname"; then | ||
2267 | 2248 | ${RM}r "$tmpdir" | ||
2268 | 2249 | fi | ||
2269 | 2250 | ;; | ||
2270 | 2251 | esac | ||
2271 | 2252 | done | ||
2272 | 2253 | |||
2273 | 2254 | for file in $staticlibs; do | ||
2274 | 2255 | func_basename "$file" | ||
2275 | 2256 | name="$func_basename_result" | ||
2276 | 2257 | |||
2277 | 2258 | # Set up the ranlib parameters. | ||
2278 | 2259 | oldlib="$destdir/$name" | ||
2279 | 2260 | |||
2280 | 2261 | func_show_eval "$install_prog \$file \$oldlib" 'exit $?' | ||
2281 | 2262 | |||
2282 | 2263 | if test -n "$stripme" && test -n "$old_striplib"; then | ||
2283 | 2264 | func_show_eval "$old_striplib $oldlib" 'exit $?' | ||
2284 | 2265 | fi | ||
2285 | 2266 | |||
2286 | 2267 | # Do each command in the postinstall commands. | ||
2287 | 2268 | func_execute_cmds "$old_postinstall_cmds" 'exit $?' | ||
2288 | 2269 | done | ||
2289 | 2270 | |||
2290 | 2271 | test -n "$future_libdirs" && \ | ||
2291 | 2272 | func_warning "remember to run \`$progname --finish$future_libdirs'" | ||
2292 | 2273 | |||
2293 | 2274 | if test -n "$current_libdirs"; then | ||
2294 | 2275 | # Maybe just do a dry run. | ||
2295 | 2276 | $opt_dry_run && current_libdirs=" -n$current_libdirs" | ||
2296 | 2277 | exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' | ||
2297 | 2278 | else | ||
2298 | 2279 | exit $EXIT_SUCCESS | ||
2299 | 2280 | fi | ||
2300 | 2281 | } | ||
2301 | 2282 | |||
2302 | 2283 | test "$mode" = install && func_mode_install ${1+"$@"} | ||
2303 | 2284 | |||
2304 | 2285 | |||
2305 | 2286 | # func_generate_dlsyms outputname originator pic_p | ||
2306 | 2287 | # Extract symbols from dlprefiles and create ${outputname}S.o with | ||
2307 | 2288 | # a dlpreopen symbol table. | ||
2308 | 2289 | func_generate_dlsyms () | ||
2309 | 2290 | { | ||
2310 | 2291 | $opt_debug | ||
2311 | 2292 | my_outputname="$1" | ||
2312 | 2293 | my_originator="$2" | ||
2313 | 2294 | my_pic_p="${3-no}" | ||
2314 | 2295 | my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` | ||
2315 | 2296 | my_dlsyms= | ||
2316 | 2297 | |||
2317 | 2298 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then | ||
2318 | 2299 | if test -n "$NM" && test -n "$global_symbol_pipe"; then | ||
2319 | 2300 | my_dlsyms="${my_outputname}S.c" | ||
2320 | 2301 | else | ||
2321 | 2302 | func_error "not configured to extract global symbols from dlpreopened files" | ||
2322 | 2303 | fi | ||
2323 | 2304 | fi | ||
2324 | 2305 | |||
2325 | 2306 | if test -n "$my_dlsyms"; then | ||
2326 | 2307 | case $my_dlsyms in | ||
2327 | 2308 | "") ;; | ||
2328 | 2309 | *.c) | ||
2329 | 2310 | # Discover the nlist of each of the dlfiles. | ||
2330 | 2311 | nlist="$output_objdir/${my_outputname}.nm" | ||
2331 | 2312 | |||
2332 | 2313 | func_show_eval "$RM $nlist ${nlist}S ${nlist}T" | ||
2333 | 2314 | |||
2334 | 2315 | # Parse the name list into a source file. | ||
2335 | 2316 | func_verbose "creating $output_objdir/$my_dlsyms" | ||
2336 | 2317 | |||
2337 | 2318 | $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ | ||
2338 | 2319 | /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ | ||
2339 | 2320 | /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ | ||
2340 | 2321 | |||
2341 | 2322 | #ifdef __cplusplus | ||
2342 | 2323 | extern \"C\" { | ||
2343 | 2324 | #endif | ||
2344 | 2325 | |||
2345 | 2326 | /* External symbol declarations for the compiler. */\ | ||
2346 | 2327 | " | ||
2347 | 2328 | |||
2348 | 2329 | if test "$dlself" = yes; then | ||
2349 | 2330 | func_verbose "generating symbol list for \`$output'" | ||
2350 | 2331 | |||
2351 | 2332 | $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" | ||
2352 | 2333 | |||
2353 | 2334 | # Add our own program objects to the symbol list. | ||
2354 | 2335 | progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` | ||
2355 | 2336 | for progfile in $progfiles; do | ||
2356 | 2337 | func_verbose "extracting global C symbols from \`$progfile'" | ||
2357 | 2338 | $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" | ||
2358 | 2339 | done | ||
2359 | 2340 | |||
2360 | 2341 | if test -n "$exclude_expsyms"; then | ||
2361 | 2342 | $opt_dry_run || { | ||
2362 | 2343 | eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' | ||
2363 | 2344 | eval '$MV "$nlist"T "$nlist"' | ||
2364 | 2345 | } | ||
2365 | 2346 | fi | ||
2366 | 2347 | |||
2367 | 2348 | if test -n "$export_symbols_regex"; then | ||
2368 | 2349 | $opt_dry_run || { | ||
2369 | 2350 | eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' | ||
2370 | 2351 | eval '$MV "$nlist"T "$nlist"' | ||
2371 | 2352 | } | ||
2372 | 2353 | fi | ||
2373 | 2354 | |||
2374 | 2355 | # Prepare the list of exported symbols | ||
2375 | 2356 | if test -z "$export_symbols"; then | ||
2376 | 2357 | export_symbols="$output_objdir/$outputname.exp" | ||
2377 | 2358 | $opt_dry_run || { | ||
2378 | 2359 | $RM $export_symbols | ||
2379 | 2360 | eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' | ||
2380 | 2361 | case $host in | ||
2381 | 2362 | *cygwin* | *mingw* | *cegcc* ) | ||
2382 | 2363 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' | ||
2383 | 2364 | eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' | ||
2384 | 2365 | ;; | ||
2385 | 2366 | esac | ||
2386 | 2367 | } | ||
2387 | 2368 | else | ||
2388 | 2369 | $opt_dry_run || { | ||
2389 | 2370 | eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' | ||
2390 | 2371 | eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' | ||
2391 | 2372 | eval '$MV "$nlist"T "$nlist"' | ||
2392 | 2373 | case $host in | ||
2393 | 2374 | *cygwin | *mingw* | *cegcc* ) | ||
2394 | 2375 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' | ||
2395 | 2376 | eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' | ||
2396 | 2377 | ;; | ||
2397 | 2378 | esac | ||
2398 | 2379 | } | ||
2399 | 2380 | fi | ||
2400 | 2381 | fi | ||
2401 | 2382 | |||
2402 | 2383 | for dlprefile in $dlprefiles; do | ||
2403 | 2384 | func_verbose "extracting global C symbols from \`$dlprefile'" | ||
2404 | 2385 | func_basename "$dlprefile" | ||
2405 | 2386 | name="$func_basename_result" | ||
2406 | 2387 | $opt_dry_run || { | ||
2407 | 2388 | eval '$ECHO ": $name " >> "$nlist"' | ||
2408 | 2389 | eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" | ||
2409 | 2390 | } | ||
2410 | 2391 | done | ||
2411 | 2392 | |||
2412 | 2393 | $opt_dry_run || { | ||
2413 | 2394 | # Make sure we have at least an empty file. | ||
2414 | 2395 | test -f "$nlist" || : > "$nlist" | ||
2415 | 2396 | |||
2416 | 2397 | if test -n "$exclude_expsyms"; then | ||
2417 | 2398 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T | ||
2418 | 2399 | $MV "$nlist"T "$nlist" | ||
2419 | 2400 | fi | ||
2420 | 2401 | |||
2421 | 2402 | # Try sorting and uniquifying the output. | ||
2422 | 2403 | if $GREP -v "^: " < "$nlist" | | ||
2423 | 2404 | if sort -k 3 </dev/null >/dev/null 2>&1; then | ||
2424 | 2405 | sort -k 3 | ||
2425 | 2406 | else | ||
2426 | 2407 | sort +2 | ||
2427 | 2408 | fi | | ||
2428 | 2409 | uniq > "$nlist"S; then | ||
2429 | 2410 | : | ||
2430 | 2411 | else | ||
2431 | 2412 | $GREP -v "^: " < "$nlist" > "$nlist"S | ||
2432 | 2413 | fi | ||
2433 | 2414 | |||
2434 | 2415 | if test -f "$nlist"S; then | ||
2435 | 2416 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' | ||
2436 | 2417 | else | ||
2437 | 2418 | $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" | ||
2438 | 2419 | fi | ||
2439 | 2420 | |||
2440 | 2421 | $ECHO >> "$output_objdir/$my_dlsyms" "\ | ||
2441 | 2422 | |||
2442 | 2423 | /* The mapping between symbol names and symbols. */ | ||
2443 | 2424 | typedef struct { | ||
2444 | 2425 | const char *name; | ||
2445 | 2426 | void *address; | ||
2446 | 2427 | } lt_dlsymlist; | ||
2447 | 2428 | " | ||
2448 | 2429 | case $host in | ||
2449 | 2430 | *cygwin* | *mingw* | *cegcc* ) | ||
2450 | 2431 | $ECHO >> "$output_objdir/$my_dlsyms" "\ | ||
2451 | 2432 | /* DATA imports from DLLs on WIN32 con't be const, because | ||
2452 | 2433 | runtime relocations are performed -- see ld's documentation | ||
2453 | 2434 | on pseudo-relocs. */" | ||
2454 | 2435 | lt_dlsym_const= ;; | ||
2455 | 2436 | *osf5*) | ||
2456 | 2437 | echo >> "$output_objdir/$my_dlsyms" "\ | ||
2457 | 2438 | /* This system does not cope well with relocations in const data */" | ||
2458 | 2439 | lt_dlsym_const= ;; | ||
2459 | 2440 | *) | ||
2460 | 2441 | lt_dlsym_const=const ;; | ||
2461 | 2442 | esac | ||
2462 | 2443 | |||
2463 | 2444 | $ECHO >> "$output_objdir/$my_dlsyms" "\ | ||
2464 | 2445 | extern $lt_dlsym_const lt_dlsymlist | ||
2465 | 2446 | lt_${my_prefix}_LTX_preloaded_symbols[]; | ||
2466 | 2447 | $lt_dlsym_const lt_dlsymlist | ||
2467 | 2448 | lt_${my_prefix}_LTX_preloaded_symbols[] = | ||
2468 | 2449 | {\ | ||
2469 | 2450 | { \"$my_originator\", (void *) 0 }," | ||
2470 | 2451 | |||
2471 | 2452 | case $need_lib_prefix in | ||
2472 | 2453 | no) | ||
2473 | 2454 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" | ||
2474 | 2455 | ;; | ||
2475 | 2456 | *) | ||
2476 | 2457 | eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" | ||
2477 | 2458 | ;; | ||
2478 | 2459 | esac | ||
2479 | 2460 | $ECHO >> "$output_objdir/$my_dlsyms" "\ | ||
2480 | 2461 | {0, (void *) 0} | ||
2481 | 2462 | }; | ||
2482 | 2463 | |||
2483 | 2464 | /* This works around a problem in FreeBSD linker */ | ||
2484 | 2465 | #ifdef FREEBSD_WORKAROUND | ||
2485 | 2466 | static const void *lt_preloaded_setup() { | ||
2486 | 2467 | return lt_${my_prefix}_LTX_preloaded_symbols; | ||
2487 | 2468 | } | ||
2488 | 2469 | #endif | ||
2489 | 2470 | |||
2490 | 2471 | #ifdef __cplusplus | ||
2491 | 2472 | } | ||
2492 | 2473 | #endif\ | ||
2493 | 2474 | " | ||
2494 | 2475 | } # !$opt_dry_run | ||
2495 | 2476 | |||
2496 | 2477 | pic_flag_for_symtable= | ||
2497 | 2478 | case "$compile_command " in | ||
2498 | 2479 | *" -static "*) ;; | ||
2499 | 2480 | *) | ||
2500 | 2481 | case $host in | ||
2501 | 2482 | # compiling the symbol table file with pic_flag works around | ||
2502 | 2483 | # a FreeBSD bug that causes programs to crash when -lm is | ||
2503 | 2484 | # linked before any other PIC object. But we must not use | ||
2504 | 2485 | # pic_flag when linking with -static. The problem exists in | ||
2505 | 2486 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. | ||
2506 | 2487 | *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) | ||
2507 | 2488 | pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; | ||
2508 | 2489 | *-*-hpux*) | ||
2509 | 2490 | pic_flag_for_symtable=" $pic_flag" ;; | ||
2510 | 2491 | *) | ||
2511 | 2492 | if test "X$my_pic_p" != Xno; then | ||
2512 | 2493 | pic_flag_for_symtable=" $pic_flag" | ||
2513 | 2494 | fi | ||
2514 | 2495 | ;; | ||
2515 | 2496 | esac | ||
2516 | 2497 | ;; | ||
2517 | 2498 | esac | ||
2518 | 2499 | symtab_cflags= | ||
2519 | 2500 | for arg in $LTCFLAGS; do | ||
2520 | 2501 | case $arg in | ||
2521 | 2502 | -pie | -fpie | -fPIE) ;; | ||
2522 | 2503 | *) symtab_cflags="$symtab_cflags $arg" ;; | ||
2523 | 2504 | esac | ||
2524 | 2505 | done | ||
2525 | 2506 | |||
2526 | 2507 | # Now compile the dynamic symbol file. | ||
2527 | 2508 | func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' | ||
2528 | 2509 | |||
2529 | 2510 | # Clean up the generated files. | ||
2530 | 2511 | func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' | ||
2531 | 2512 | |||
2532 | 2513 | # Transform the symbol file into the correct name. | ||
2533 | 2514 | symfileobj="$output_objdir/${my_outputname}S.$objext" | ||
2534 | 2515 | case $host in | ||
2535 | 2516 | *cygwin* | *mingw* | *cegcc* ) | ||
2536 | 2517 | if test -f "$output_objdir/$my_outputname.def"; then | ||
2537 | 2518 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` | ||
2538 | 2519 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` | ||
2539 | 2520 | else | ||
2540 | 2521 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` | ||
2541 | 2522 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` | ||
2542 | 2523 | fi | ||
2543 | 2524 | ;; | ||
2544 | 2525 | *) | ||
2545 | 2526 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` | ||
2546 | 2527 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` | ||
2547 | 2528 | ;; | ||
2548 | 2529 | esac | ||
2549 | 2530 | ;; | ||
2550 | 2531 | *) | ||
2551 | 2532 | func_fatal_error "unknown suffix for \`$my_dlsyms'" | ||
2552 | 2533 | ;; | ||
2553 | 2534 | esac | ||
2554 | 2535 | else | ||
2555 | 2536 | # We keep going just in case the user didn't refer to | ||
2556 | 2537 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe | ||
2557 | 2538 | # really was required. | ||
2558 | 2539 | |||
2559 | 2540 | # Nullify the symbol file. | ||
2560 | 2541 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` | ||
2561 | 2542 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` | ||
2562 | 2543 | fi | ||
2563 | 2544 | } | ||
2564 | 2545 | |||
2565 | 2546 | # func_win32_libid arg | ||
2566 | 2547 | # return the library type of file 'arg' | ||
2567 | 2548 | # | ||
2568 | 2549 | # Need a lot of goo to handle *both* DLLs and import libs | ||
2569 | 2550 | # Has to be a shell function in order to 'eat' the argument | ||
2570 | 2551 | # that is supplied when $file_magic_command is called. | ||
2571 | 2552 | func_win32_libid () | ||
2572 | 2553 | { | ||
2573 | 2554 | $opt_debug | ||
2574 | 2555 | win32_libid_type="unknown" | ||
2575 | 2556 | win32_fileres=`file -L $1 2>/dev/null` | ||
2576 | 2557 | case $win32_fileres in | ||
2577 | 2558 | *ar\ archive\ import\ library*) # definitely import | ||
2578 | 2559 | win32_libid_type="x86 archive import" | ||
2579 | 2560 | ;; | ||
2580 | 2561 | *ar\ archive*) # could be an import, or static | ||
2581 | 2562 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | | ||
2582 | 2563 | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then | ||
2583 | 2564 | win32_nmres=`eval $NM -f posix -A $1 | | ||
2584 | 2565 | $SED -n -e ' | ||
2585 | 2566 | 1,100{ | ||
2586 | 2567 | / I /{ | ||
2587 | 2568 | s,.*,import, | ||
2588 | 2569 | p | ||
2589 | 2570 | q | ||
2590 | 2571 | } | ||
2591 | 2572 | }'` | ||
2592 | 2573 | case $win32_nmres in | ||
2593 | 2574 | import*) win32_libid_type="x86 archive import";; | ||
2594 | 2575 | *) win32_libid_type="x86 archive static";; | ||
2595 | 2576 | esac | ||
2596 | 2577 | fi | ||
2597 | 2578 | ;; | ||
2598 | 2579 | *DLL*) | ||
2599 | 2580 | win32_libid_type="x86 DLL" | ||
2600 | 2581 | ;; | ||
2601 | 2582 | *executable*) # but shell scripts are "executable" too... | ||
2602 | 2583 | case $win32_fileres in | ||
2603 | 2584 | *MS\ Windows\ PE\ Intel*) | ||
2604 | 2585 | win32_libid_type="x86 DLL" | ||
2605 | 2586 | ;; | ||
2606 | 2587 | esac | ||
2607 | 2588 | ;; | ||
2608 | 2589 | esac | ||
2609 | 2590 | $ECHO "$win32_libid_type" | ||
2610 | 2591 | } | ||
2611 | 2592 | |||
2612 | 2593 | |||
2613 | 2594 | |||
2614 | 2595 | # func_extract_an_archive dir oldlib | ||
2615 | 2596 | func_extract_an_archive () | ||
2616 | 2597 | { | ||
2617 | 2598 | $opt_debug | ||
2618 | 2599 | f_ex_an_ar_dir="$1"; shift | ||
2619 | 2600 | f_ex_an_ar_oldlib="$1" | ||
2620 | 2601 | func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' | ||
2621 | 2602 | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then | ||
2622 | 2603 | : | ||
2623 | 2604 | else | ||
2624 | 2605 | func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" | ||
2625 | 2606 | fi | ||
2626 | 2607 | } | ||
2627 | 2608 | |||
2628 | 2609 | |||
2629 | 2610 | # func_extract_archives gentop oldlib ... | ||
2630 | 2611 | func_extract_archives () | ||
2631 | 2612 | { | ||
2632 | 2613 | $opt_debug | ||
2633 | 2614 | my_gentop="$1"; shift | ||
2634 | 2615 | my_oldlibs=${1+"$@"} | ||
2635 | 2616 | my_oldobjs="" | ||
2636 | 2617 | my_xlib="" | ||
2637 | 2618 | my_xabs="" | ||
2638 | 2619 | my_xdir="" | ||
2639 | 2620 | |||
2640 | 2621 | for my_xlib in $my_oldlibs; do | ||
2641 | 2622 | # Extract the objects. | ||
2642 | 2623 | case $my_xlib in | ||
2643 | 2624 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; | ||
2644 | 2625 | *) my_xabs=`pwd`"/$my_xlib" ;; | ||
2645 | 2626 | esac | ||
2646 | 2627 | func_basename "$my_xlib" | ||
2647 | 2628 | my_xlib="$func_basename_result" | ||
2648 | 2629 | my_xlib_u=$my_xlib | ||
2649 | 2630 | while :; do | ||
2650 | 2631 | case " $extracted_archives " in | ||
2651 | 2632 | *" $my_xlib_u "*) | ||
2652 | 2633 | func_arith $extracted_serial + 1 | ||
2653 | 2634 | extracted_serial=$func_arith_result | ||
2654 | 2635 | my_xlib_u=lt$extracted_serial-$my_xlib ;; | ||
2655 | 2636 | *) break ;; | ||
2656 | 2637 | esac | ||
2657 | 2638 | done | ||
2658 | 2639 | extracted_archives="$extracted_archives $my_xlib_u" | ||
2659 | 2640 | my_xdir="$my_gentop/$my_xlib_u" | ||
2660 | 2641 | |||
2661 | 2642 | func_mkdir_p "$my_xdir" | ||
2662 | 2643 | |||
2663 | 2644 | case $host in | ||
2664 | 2645 | *-darwin*) | ||
2665 | 2646 | func_verbose "Extracting $my_xabs" | ||
2666 | 2647 | # Do not bother doing anything if just a dry run | ||
2667 | 2648 | $opt_dry_run || { | ||
2668 | 2649 | darwin_orig_dir=`pwd` | ||
2669 | 2650 | cd $my_xdir || exit $? | ||
2670 | 2651 | darwin_archive=$my_xabs | ||
2671 | 2652 | darwin_curdir=`pwd` | ||
2672 | 2653 | darwin_base_archive=`basename "$darwin_archive"` | ||
2673 | 2654 | darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` | ||
2674 | 2655 | if test -n "$darwin_arches"; then | ||
2675 | 2656 | darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` | ||
2676 | 2657 | darwin_arch= | ||
2677 | 2658 | func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" | ||
2678 | 2659 | for darwin_arch in $darwin_arches ; do | ||
2679 | 2660 | func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" | ||
2680 | 2661 | $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" | ||
2681 | 2662 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" | ||
2682 | 2663 | func_extract_an_archive "`pwd`" "${darwin_base_archive}" | ||
2683 | 2664 | cd "$darwin_curdir" | ||
2684 | 2665 | $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" | ||
2685 | 2666 | done # $darwin_arches | ||
2686 | 2667 | ## Okay now we've a bunch of thin objects, gotta fatten them up :) | ||
2687 | 2668 | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` | ||
2688 | 2669 | darwin_file= | ||
2689 | 2670 | darwin_files= | ||
2690 | 2671 | for darwin_file in $darwin_filelist; do | ||
2691 | 2672 | darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` | ||
2692 | 2673 | $LIPO -create -output "$darwin_file" $darwin_files | ||
2693 | 2674 | done # $darwin_filelist | ||
2694 | 2675 | $RM -rf unfat-$$ | ||
2695 | 2676 | cd "$darwin_orig_dir" | ||
2696 | 2677 | else | ||
2697 | 2678 | cd $darwin_orig_dir | ||
2698 | 2679 | func_extract_an_archive "$my_xdir" "$my_xabs" | ||
2699 | 2680 | fi # $darwin_arches | ||
2700 | 2681 | } # !$opt_dry_run | ||
2701 | 2682 | ;; | ||
2702 | 2683 | *) | ||
2703 | 2684 | func_extract_an_archive "$my_xdir" "$my_xabs" | ||
2704 | 2685 | ;; | ||
2705 | 2686 | esac | ||
2706 | 2687 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` | ||
2707 | 2688 | done | ||
2708 | 2689 | |||
2709 | 2690 | func_extract_archives_result="$my_oldobjs" | ||
2710 | 2691 | } | ||
2711 | 2692 | |||
2712 | 2693 | |||
2713 | 2694 | |||
2714 | 2695 | # func_emit_wrapper_part1 [arg=no] | ||
2715 | 2696 | # | ||
2716 | 2697 | # Emit the first part of a libtool wrapper script on stdout. | ||
2717 | 2698 | # For more information, see the description associated with | ||
2718 | 2699 | # func_emit_wrapper(), below. | ||
2719 | 2700 | func_emit_wrapper_part1 () | ||
2720 | 2701 | { | ||
2721 | 2702 | func_emit_wrapper_part1_arg1=no | ||
2722 | 2703 | if test -n "$1" ; then | ||
2723 | 2704 | func_emit_wrapper_part1_arg1=$1 | ||
2724 | 2705 | fi | ||
2725 | 2706 | |||
2726 | 2707 | $ECHO "\ | ||
2727 | 2708 | #! $SHELL | ||
2728 | 2709 | |||
2729 | 2710 | # $output - temporary wrapper script for $objdir/$outputname | ||
2730 | 2711 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION | ||
2731 | 2712 | # | ||
2732 | 2713 | # The $output program cannot be directly executed until all the libtool | ||
2733 | 2714 | # libraries that it depends on are installed. | ||
2734 | 2715 | # | ||
2735 | 2716 | # This wrapper script should never be moved out of the build directory. | ||
2736 | 2717 | # If it is, it will not operate correctly. | ||
2737 | 2718 | |||
2738 | 2719 | # Sed substitution that helps us do robust quoting. It backslashifies | ||
2739 | 2720 | # metacharacters that are still active within double-quoted strings. | ||
2740 | 2721 | Xsed='${SED} -e 1s/^X//' | ||
2741 | 2722 | sed_quote_subst='$sed_quote_subst' | ||
2742 | 2723 | |||
2743 | 2724 | # Be Bourne compatible | ||
2744 | 2725 | if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then | ||
2745 | 2726 | emulate sh | ||
2746 | 2727 | NULLCMD=: | ||
2747 | 2728 | # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which | ||
2748 | 2729 | # is contrary to our usage. Disable this feature. | ||
2749 | 2730 | alias -g '\${1+\"\$@\"}'='\"\$@\"' | ||
2750 | 2731 | setopt NO_GLOB_SUBST | ||
2751 | 2732 | else | ||
2752 | 2733 | case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac | ||
2753 | 2734 | fi | ||
2754 | 2735 | BIN_SH=xpg4; export BIN_SH # for Tru64 | ||
2755 | 2736 | DUALCASE=1; export DUALCASE # for MKS sh | ||
2756 | 2737 | |||
2757 | 2738 | # The HP-UX ksh and POSIX shell print the target directory to stdout | ||
2758 | 2739 | # if CDPATH is set. | ||
2759 | 2740 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH | ||
2760 | 2741 | |||
2761 | 2742 | relink_command=\"$relink_command\" | ||
2762 | 2743 | |||
2763 | 2744 | # This environment variable determines our operation mode. | ||
2764 | 2745 | if test \"\$libtool_install_magic\" = \"$magic\"; then | ||
2765 | 2746 | # install mode needs the following variables: | ||
2766 | 2747 | generated_by_libtool_version='$macro_version' | ||
2767 | 2748 | notinst_deplibs='$notinst_deplibs' | ||
2768 | 2749 | else | ||
2769 | 2750 | # When we are sourced in execute mode, \$file and \$ECHO are already set. | ||
2770 | 2751 | if test \"\$libtool_execute_magic\" != \"$magic\"; then | ||
2771 | 2752 | ECHO=\"$qecho\" | ||
2772 | 2753 | file=\"\$0\" | ||
2773 | 2754 | # Make sure echo works. | ||
2774 | 2755 | if test \"X\$1\" = X--no-reexec; then | ||
2775 | 2756 | # Discard the --no-reexec flag, and continue. | ||
2776 | 2757 | shift | ||
2777 | 2758 | elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then | ||
2778 | 2759 | # Yippee, \$ECHO works! | ||
2779 | 2760 | : | ||
2780 | 2761 | else | ||
2781 | 2762 | # Restart under the correct shell, and then maybe \$ECHO will work. | ||
2782 | 2763 | exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} | ||
2783 | 2764 | fi | ||
2784 | 2765 | fi\ | ||
2785 | 2766 | " | ||
2786 | 2767 | $ECHO "\ | ||
2787 | 2768 | |||
2788 | 2769 | # Find the directory that this script lives in. | ||
2789 | 2770 | thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` | ||
2790 | 2771 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. | ||
2791 | 2772 | |||
2792 | 2773 | # Follow symbolic links until we get to the real thisdir. | ||
2793 | 2774 | file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` | ||
2794 | 2775 | while test -n \"\$file\"; do | ||
2795 | 2776 | destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` | ||
2796 | 2777 | |||
2797 | 2778 | # If there was a directory component, then change thisdir. | ||
2798 | 2779 | if test \"x\$destdir\" != \"x\$file\"; then | ||
2799 | 2780 | case \"\$destdir\" in | ||
2800 | 2781 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; | ||
2801 | 2782 | *) thisdir=\"\$thisdir/\$destdir\" ;; | ||
2802 | 2783 | esac | ||
2803 | 2784 | fi | ||
2804 | 2785 | |||
2805 | 2786 | file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` | ||
2806 | 2787 | file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` | ||
2807 | 2788 | done | ||
2808 | 2789 | " | ||
2809 | 2790 | } | ||
2810 | 2791 | # end: func_emit_wrapper_part1 | ||
2811 | 2792 | |||
2812 | 2793 | # func_emit_wrapper_part2 [arg=no] | ||
2813 | 2794 | # | ||
2814 | 2795 | # Emit the second part of a libtool wrapper script on stdout. | ||
2815 | 2796 | # For more information, see the description associated with | ||
2816 | 2797 | # func_emit_wrapper(), below. | ||
2817 | 2798 | func_emit_wrapper_part2 () | ||
2818 | 2799 | { | ||
2819 | 2800 | func_emit_wrapper_part2_arg1=no | ||
2820 | 2801 | if test -n "$1" ; then | ||
2821 | 2802 | func_emit_wrapper_part2_arg1=$1 | ||
2822 | 2803 | fi | ||
2823 | 2804 | |||
2824 | 2805 | $ECHO "\ | ||
2825 | 2806 | |||
2826 | 2807 | # Usually 'no', except on cygwin/mingw when embedded into | ||
2827 | 2808 | # the cwrapper. | ||
2828 | 2809 | WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 | ||
2829 | 2810 | if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then | ||
2830 | 2811 | # special case for '.' | ||
2831 | 2812 | if test \"\$thisdir\" = \".\"; then | ||
2832 | 2813 | thisdir=\`pwd\` | ||
2833 | 2814 | fi | ||
2834 | 2815 | # remove .libs from thisdir | ||
2835 | 2816 | case \"\$thisdir\" in | ||
2836 | 2817 | *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; | ||
2837 | 2818 | $objdir ) thisdir=. ;; | ||
2838 | 2819 | esac | ||
2839 | 2820 | fi | ||
2840 | 2821 | |||
2841 | 2822 | # Try to get the absolute directory name. | ||
2842 | 2823 | absdir=\`cd \"\$thisdir\" && pwd\` | ||
2843 | 2824 | test -n \"\$absdir\" && thisdir=\"\$absdir\" | ||
2844 | 2825 | " | ||
2845 | 2826 | |||
2846 | 2827 | if test "$fast_install" = yes; then | ||
2847 | 2828 | $ECHO "\ | ||
2848 | 2829 | program=lt-'$outputname'$exeext | ||
2849 | 2830 | progdir=\"\$thisdir/$objdir\" | ||
2850 | 2831 | |||
2851 | 2832 | if test ! -f \"\$progdir/\$program\" || | ||
2852 | 2833 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ | ||
2853 | 2834 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then | ||
2854 | 2835 | |||
2855 | 2836 | file=\"\$\$-\$program\" | ||
2856 | 2837 | |||
2857 | 2838 | if test ! -d \"\$progdir\"; then | ||
2858 | 2839 | $MKDIR \"\$progdir\" | ||
2859 | 2840 | else | ||
2860 | 2841 | $RM \"\$progdir/\$file\" | ||
2861 | 2842 | fi" | ||
2862 | 2843 | |||
2863 | 2844 | $ECHO "\ | ||
2864 | 2845 | |||
2865 | 2846 | # relink executable if necessary | ||
2866 | 2847 | if test -n \"\$relink_command\"; then | ||
2867 | 2848 | if relink_command_output=\`eval \$relink_command 2>&1\`; then : | ||
2868 | 2849 | else | ||
2869 | 2850 | $ECHO \"\$relink_command_output\" >&2 | ||
2870 | 2851 | $RM \"\$progdir/\$file\" | ||
2871 | 2852 | exit 1 | ||
2872 | 2853 | fi | ||
2873 | 2854 | fi | ||
2874 | 2855 | |||
2875 | 2856 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || | ||
2876 | 2857 | { $RM \"\$progdir/\$program\"; | ||
2877 | 2858 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } | ||
2878 | 2859 | $RM \"\$progdir/\$file\" | ||
2879 | 2860 | fi" | ||
2880 | 2861 | else | ||
2881 | 2862 | $ECHO "\ | ||
2882 | 2863 | program='$outputname' | ||
2883 | 2864 | progdir=\"\$thisdir/$objdir\" | ||
2884 | 2865 | " | ||
2885 | 2866 | fi | ||
2886 | 2867 | |||
2887 | 2868 | $ECHO "\ | ||
2888 | 2869 | |||
2889 | 2870 | if test -f \"\$progdir/\$program\"; then" | ||
2890 | 2871 | |||
2891 | 2872 | # Export our shlibpath_var if we have one. | ||
2892 | 2873 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then | ||
2893 | 2874 | $ECHO "\ | ||
2894 | 2875 | # Add our own library path to $shlibpath_var | ||
2895 | 2876 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" | ||
2896 | 2877 | |||
2897 | 2878 | # Some systems cannot cope with colon-terminated $shlibpath_var | ||
2898 | 2879 | # The second colon is a workaround for a bug in BeOS R4 sed | ||
2899 | 2880 | $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` | ||
2900 | 2881 | |||
2901 | 2882 | export $shlibpath_var | ||
2902 | 2883 | " | ||
2903 | 2884 | fi | ||
2904 | 2885 | |||
2905 | 2886 | # fixup the dll searchpath if we need to. | ||
2906 | 2887 | if test -n "$dllsearchpath"; then | ||
2907 | 2888 | $ECHO "\ | ||
2908 | 2889 | # Add the dll search path components to the executable PATH | ||
2909 | 2890 | PATH=$dllsearchpath:\$PATH | ||
2910 | 2891 | " | ||
2911 | 2892 | fi | ||
2912 | 2893 | |||
2913 | 2894 | $ECHO "\ | ||
2914 | 2895 | if test \"\$libtool_execute_magic\" != \"$magic\"; then | ||
2915 | 2896 | # Run the actual program with our arguments. | ||
2916 | 2897 | " | ||
2917 | 2898 | case $host in | ||
2918 | 2899 | # Backslashes separate directories on plain windows | ||
2919 | 2900 | *-*-mingw | *-*-os2* | *-cegcc*) | ||
2920 | 2901 | $ECHO "\ | ||
2921 | 2902 | exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} | ||
2922 | 2903 | " | ||
2923 | 2904 | ;; | ||
2924 | 2905 | |||
2925 | 2906 | *) | ||
2926 | 2907 | $ECHO "\ | ||
2927 | 2908 | exec \"\$progdir/\$program\" \${1+\"\$@\"} | ||
2928 | 2909 | " | ||
2929 | 2910 | ;; | ||
2930 | 2911 | esac | ||
2931 | 2912 | $ECHO "\ | ||
2932 | 2913 | \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 | ||
2933 | 2914 | exit 1 | ||
2934 | 2915 | fi | ||
2935 | 2916 | else | ||
2936 | 2917 | # The program doesn't exist. | ||
2937 | 2918 | \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 | ||
2938 | 2919 | \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 | ||
2939 | 2920 | $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 | ||
2940 | 2921 | exit 1 | ||
2941 | 2922 | fi | ||
2942 | 2923 | fi\ | ||
2943 | 2924 | " | ||
2944 | 2925 | } | ||
2945 | 2926 | # end: func_emit_wrapper_part2 | ||
2946 | 2927 | |||
2947 | 2928 | |||
2948 | 2929 | # func_emit_wrapper [arg=no] | ||
2949 | 2930 | # | ||
2950 | 2931 | # Emit a libtool wrapper script on stdout. | ||
2951 | 2932 | # Don't directly open a file because we may want to | ||
2952 | 2933 | # incorporate the script contents within a cygwin/mingw | ||
2953 | 2934 | # wrapper executable. Must ONLY be called from within | ||
2954 | 2935 | # func_mode_link because it depends on a number of variables | ||
2955 | 2936 | # set therein. | ||
2956 | 2937 | # | ||
2957 | 2938 | # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR | ||
2958 | 2939 | # variable will take. If 'yes', then the emitted script | ||
2959 | 2940 | # will assume that the directory in which it is stored is | ||
2960 | 2941 | # the $objdir directory. This is a cygwin/mingw-specific | ||
2961 | 2942 | # behavior. | ||
2962 | 2943 | func_emit_wrapper () | ||
2963 | 2944 | { | ||
2964 | 2945 | func_emit_wrapper_arg1=no | ||
2965 | 2946 | if test -n "$1" ; then | ||
2966 | 2947 | func_emit_wrapper_arg1=$1 | ||
2967 | 2948 | fi | ||
2968 | 2949 | |||
2969 | 2950 | # split this up so that func_emit_cwrapperexe_src | ||
2970 | 2951 | # can call each part independently. | ||
2971 | 2952 | func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" | ||
2972 | 2953 | func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" | ||
2973 | 2954 | } | ||
2974 | 2955 | |||
2975 | 2956 | |||
2976 | 2957 | # func_to_host_path arg | ||
2977 | 2958 | # | ||
2978 | 2959 | # Convert paths to host format when used with build tools. | ||
2979 | 2960 | # Intended for use with "native" mingw (where libtool itself | ||
2980 | 2961 | # is running under the msys shell), or in the following cross- | ||
2981 | 2962 | # build environments: | ||
2982 | 2963 | # $build $host | ||
2983 | 2964 | # mingw (msys) mingw [e.g. native] | ||
2984 | 2965 | # cygwin mingw | ||
2985 | 2966 | # *nix + wine mingw | ||
2986 | 2967 | # where wine is equipped with the `winepath' executable. | ||
2987 | 2968 | # In the native mingw case, the (msys) shell automatically | ||
2988 | 2969 | # converts paths for any non-msys applications it launches, | ||
2989 | 2970 | # but that facility isn't available from inside the cwrapper. | ||
2990 | 2971 | # Similar accommodations are necessary for $host mingw and | ||
2991 | 2972 | # $build cygwin. Calling this function does no harm for other | ||
2992 | 2973 | # $host/$build combinations not listed above. | ||
2993 | 2974 | # | ||
2994 | 2975 | # ARG is the path (on $build) that should be converted to | ||
2995 | 2976 | # the proper representation for $host. The result is stored | ||
2996 | 2977 | # in $func_to_host_path_result. | ||
2997 | 2978 | func_to_host_path () | ||
2998 | 2979 | { | ||
2999 | 2980 | func_to_host_path_result="$1" | ||
3000 | 2981 | if test -n "$1" ; then | ||
3001 | 2982 | case $host in | ||
3002 | 2983 | *mingw* ) | ||
3003 | 2984 | lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' | ||
3004 | 2985 | case $build in | ||
3005 | 2986 | *mingw* ) # actually, msys | ||
3006 | 2987 | # awkward: cmd appends spaces to result | ||
3007 | 2988 | lt_sed_strip_trailing_spaces="s/[ ]*\$//" | ||
3008 | 2989 | func_to_host_path_tmp1=`( cmd //c echo "$1" |\ | ||
3009 | 2990 | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` | ||
3010 | 2991 | func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ | ||
3011 | 2992 | $SED -e "$lt_sed_naive_backslashify"` | ||
3012 | 2993 | ;; | ||
3013 | 2994 | *cygwin* ) | ||
3014 | 2995 | func_to_host_path_tmp1=`cygpath -w "$1"` | ||
3015 | 2996 | func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ | ||
3016 | 2997 | $SED -e "$lt_sed_naive_backslashify"` | ||
3017 | 2998 | ;; | ||
3018 | 2999 | * ) | ||
3019 | 3000 | # Unfortunately, winepath does not exit with a non-zero | ||
3020 | 3001 | # error code, so we are forced to check the contents of | ||
3021 | 3002 | # stdout. On the other hand, if the command is not | ||
3022 | 3003 | # found, the shell will set an exit code of 127 and print | ||
3023 | 3004 | # *an error message* to stdout. So we must check for both | ||
3024 | 3005 | # error code of zero AND non-empty stdout, which explains | ||
3025 | 3006 | # the odd construction: | ||
3026 | 3007 | func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` | ||
3027 | 3008 | if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then | ||
3028 | 3009 | func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ | ||
3029 | 3010 | $SED -e "$lt_sed_naive_backslashify"` | ||
3030 | 3011 | else | ||
3031 | 3012 | # Allow warning below. | ||
3032 | 3013 | func_to_host_path_result="" | ||
3033 | 3014 | fi | ||
3034 | 3015 | ;; | ||
3035 | 3016 | esac | ||
3036 | 3017 | if test -z "$func_to_host_path_result" ; then | ||
3037 | 3018 | func_error "Could not determine host path corresponding to" | ||
3038 | 3019 | func_error " '$1'" | ||
3039 | 3020 | func_error "Continuing, but uninstalled executables may not work." | ||
3040 | 3021 | # Fallback: | ||
3041 | 3022 | func_to_host_path_result="$1" | ||
3042 | 3023 | fi | ||
3043 | 3024 | ;; | ||
3044 | 3025 | esac | ||
3045 | 3026 | fi | ||
3046 | 3027 | } | ||
3047 | 3028 | # end: func_to_host_path | ||
3048 | 3029 | |||
3049 | 3030 | # func_to_host_pathlist arg | ||
3050 | 3031 | # | ||
3051 | 3032 | # Convert pathlists to host format when used with build tools. | ||
3052 | 3033 | # See func_to_host_path(), above. This function supports the | ||
3053 | 3034 | # following $build/$host combinations (but does no harm for | ||
3054 | 3035 | # combinations not listed here): | ||
3055 | 3036 | # $build $host | ||
3056 | 3037 | # mingw (msys) mingw [e.g. native] | ||
3057 | 3038 | # cygwin mingw | ||
3058 | 3039 | # *nix + wine mingw | ||
3059 | 3040 | # | ||
3060 | 3041 | # Path separators are also converted from $build format to | ||
3061 | 3042 | # $host format. If ARG begins or ends with a path separator | ||
3062 | 3043 | # character, it is preserved (but converted to $host format) | ||
3063 | 3044 | # on output. | ||
3064 | 3045 | # | ||
3065 | 3046 | # ARG is a pathlist (on $build) that should be converted to | ||
3066 | 3047 | # the proper representation on $host. The result is stored | ||
3067 | 3048 | # in $func_to_host_pathlist_result. | ||
3068 | 3049 | func_to_host_pathlist () | ||
3069 | 3050 | { | ||
3070 | 3051 | func_to_host_pathlist_result="$1" | ||
3071 | 3052 | if test -n "$1" ; then | ||
3072 | 3053 | case $host in | ||
3073 | 3054 | *mingw* ) | ||
3074 | 3055 | lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' | ||
3075 | 3056 | # Remove leading and trailing path separator characters from | ||
3076 | 3057 | # ARG. msys behavior is inconsistent here, cygpath turns them | ||
3077 | 3058 | # into '.;' and ';.', and winepath ignores them completely. | ||
3078 | 3059 | func_to_host_pathlist_tmp2="$1" | ||
3079 | 3060 | # Once set for this call, this variable should not be | ||
3080 | 3061 | # reassigned. It is used in tha fallback case. | ||
3081 | 3062 | func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ | ||
3082 | 3063 | $SED -e 's|^:*||' -e 's|:*$||'` | ||
3083 | 3064 | case $build in | ||
3084 | 3065 | *mingw* ) # Actually, msys. | ||
3085 | 3066 | # Awkward: cmd appends spaces to result. | ||
3086 | 3067 | lt_sed_strip_trailing_spaces="s/[ ]*\$//" | ||
3087 | 3068 | func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ | ||
3088 | 3069 | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` | ||
3089 | 3070 | func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ | ||
3090 | 3071 | $SED -e "$lt_sed_naive_backslashify"` | ||
3091 | 3072 | ;; | ||
3092 | 3073 | *cygwin* ) | ||
3093 | 3074 | func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` | ||
3094 | 3075 | func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ | ||
3095 | 3076 | $SED -e "$lt_sed_naive_backslashify"` | ||
3096 | 3077 | ;; | ||
3097 | 3078 | * ) | ||
3098 | 3079 | # unfortunately, winepath doesn't convert pathlists | ||
3099 | 3080 | func_to_host_pathlist_result="" | ||
3100 | 3081 | func_to_host_pathlist_oldIFS=$IFS | ||
3101 | 3082 | IFS=: | ||
3102 | 3083 | for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do | ||
3103 | 3084 | IFS=$func_to_host_pathlist_oldIFS | ||
3104 | 3085 | if test -n "$func_to_host_pathlist_f" ; then | ||
3105 | 3086 | func_to_host_path "$func_to_host_pathlist_f" | ||
3106 | 3087 | if test -n "$func_to_host_path_result" ; then | ||
3107 | 3088 | if test -z "$func_to_host_pathlist_result" ; then | ||
3108 | 3089 | func_to_host_pathlist_result="$func_to_host_path_result" | ||
3109 | 3090 | else | ||
3110 | 3091 | func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" | ||
3111 | 3092 | fi | ||
3112 | 3093 | fi | ||
3113 | 3094 | fi | ||
3114 | 3095 | IFS=: | ||
3115 | 3096 | done | ||
3116 | 3097 | IFS=$func_to_host_pathlist_oldIFS | ||
3117 | 3098 | ;; | ||
3118 | 3099 | esac | ||
3119 | 3100 | if test -z "$func_to_host_pathlist_result" ; then | ||
3120 | 3101 | func_error "Could not determine the host path(s) corresponding to" | ||
3121 | 3102 | func_error " '$1'" | ||
3122 | 3103 | func_error "Continuing, but uninstalled executables may not work." | ||
3123 | 3104 | # Fallback. This may break if $1 contains DOS-style drive | ||
3124 | 3105 | # specifications. The fix is not to complicate the expression | ||
3125 | 3106 | # below, but for the user to provide a working wine installation | ||
3126 | 3107 | # with winepath so that path translation in the cross-to-mingw | ||
3127 | 3108 | # case works properly. | ||
3128 | 3109 | lt_replace_pathsep_nix_to_dos="s|:|;|g" | ||
3129 | 3110 | func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ | ||
3130 | 3111 | $SED -e "$lt_replace_pathsep_nix_to_dos"` | ||
3131 | 3112 | fi | ||
3132 | 3113 | # Now, add the leading and trailing path separators back | ||
3133 | 3114 | case "$1" in | ||
3134 | 3115 | :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" | ||
3135 | 3116 | ;; | ||
3136 | 3117 | esac | ||
3137 | 3118 | case "$1" in | ||
3138 | 3119 | *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" | ||
3139 | 3120 | ;; | ||
3140 | 3121 | esac | ||
3141 | 3122 | ;; | ||
3142 | 3123 | esac | ||
3143 | 3124 | fi | ||
3144 | 3125 | } | ||
3145 | 3126 | # end: func_to_host_pathlist | ||
3146 | 3127 | |||
3147 | 3128 | # func_emit_cwrapperexe_src | ||
3148 | 3129 | # emit the source code for a wrapper executable on stdout | ||
3149 | 3130 | # Must ONLY be called from within func_mode_link because | ||
3150 | 3131 | # it depends on a number of variable set therein. | ||
3151 | 3132 | func_emit_cwrapperexe_src () | ||
3152 | 3133 | { | ||
3153 | 3134 | cat <<EOF | ||
3154 | 3135 | |||
3155 | 3136 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname | ||
3156 | 3137 | Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION | ||
3157 | 3138 | |||
3158 | 3139 | The $output program cannot be directly executed until all the libtool | ||
3159 | 3140 | libraries that it depends on are installed. | ||
3160 | 3141 | |||
3161 | 3142 | This wrapper executable should never be moved out of the build directory. | ||
3162 | 3143 | If it is, it will not operate correctly. | ||
3163 | 3144 | |||
3164 | 3145 | Currently, it simply execs the wrapper *script* "$SHELL $output", | ||
3165 | 3146 | but could eventually absorb all of the scripts functionality and | ||
3166 | 3147 | exec $objdir/$outputname directly. | ||
3167 | 3148 | */ | ||
3168 | 3149 | EOF | ||
3169 | 3150 | cat <<"EOF" | ||
3170 | 3151 | #include <stdio.h> | ||
3171 | 3152 | #include <stdlib.h> | ||
3172 | 3153 | #ifdef _MSC_VER | ||
3173 | 3154 | # include <direct.h> | ||
3174 | 3155 | # include <process.h> | ||
3175 | 3156 | # include <io.h> | ||
3176 | 3157 | # define setmode _setmode | ||
3177 | 3158 | #else | ||
3178 | 3159 | # include <unistd.h> | ||
3179 | 3160 | # include <stdint.h> | ||
3180 | 3161 | # ifdef __CYGWIN__ | ||
3181 | 3162 | # include <io.h> | ||
3182 | 3163 | # define HAVE_SETENV | ||
3183 | 3164 | # ifdef __STRICT_ANSI__ | ||
3184 | 3165 | char *realpath (const char *, char *); | ||
3185 | 3166 | int putenv (char *); | ||
3186 | 3167 | int setenv (const char *, const char *, int); | ||
3187 | 3168 | # endif | ||
3188 | 3169 | # endif | ||
3189 | 3170 | #endif | ||
3190 | 3171 | #include <malloc.h> | ||
3191 | 3172 | #include <stdarg.h> | ||
3192 | 3173 | #include <assert.h> | ||
3193 | 3174 | #include <string.h> | ||
3194 | 3175 | #include <ctype.h> | ||
3195 | 3176 | #include <errno.h> | ||
3196 | 3177 | #include <fcntl.h> | ||
3197 | 3178 | #include <sys/stat.h> | ||
3198 | 3179 | |||
3199 | 3180 | #if defined(PATH_MAX) | ||
3200 | 3181 | # define LT_PATHMAX PATH_MAX | ||
3201 | 3182 | #elif defined(MAXPATHLEN) | ||
3202 | 3183 | # define LT_PATHMAX MAXPATHLEN | ||
3203 | 3184 | #else | ||
3204 | 3185 | # define LT_PATHMAX 1024 | ||
3205 | 3186 | #endif | ||
3206 | 3187 | |||
3207 | 3188 | #ifndef S_IXOTH | ||
3208 | 3189 | # define S_IXOTH 0 | ||
3209 | 3190 | #endif | ||
3210 | 3191 | #ifndef S_IXGRP | ||
3211 | 3192 | # define S_IXGRP 0 | ||
3212 | 3193 | #endif | ||
3213 | 3194 | |||
3214 | 3195 | #ifdef _MSC_VER | ||
3215 | 3196 | # define S_IXUSR _S_IEXEC | ||
3216 | 3197 | # define stat _stat | ||
3217 | 3198 | # ifndef _INTPTR_T_DEFINED | ||
3218 | 3199 | # define intptr_t int | ||
3219 | 3200 | # endif | ||
3220 | 3201 | #endif | ||
3221 | 3202 | |||
3222 | 3203 | #ifndef DIR_SEPARATOR | ||
3223 | 3204 | # define DIR_SEPARATOR '/' | ||
3224 | 3205 | # define PATH_SEPARATOR ':' | ||
3225 | 3206 | #endif | ||
3226 | 3207 | |||
3227 | 3208 | #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ | ||
3228 | 3209 | defined (__OS2__) | ||
3229 | 3210 | # define HAVE_DOS_BASED_FILE_SYSTEM | ||
3230 | 3211 | # define FOPEN_WB "wb" | ||
3231 | 3212 | # ifndef DIR_SEPARATOR_2 | ||
3232 | 3213 | # define DIR_SEPARATOR_2 '\\' | ||
3233 | 3214 | # endif | ||
3234 | 3215 | # ifndef PATH_SEPARATOR_2 | ||
3235 | 3216 | # define PATH_SEPARATOR_2 ';' | ||
3236 | 3217 | # endif | ||
3237 | 3218 | #endif | ||
3238 | 3219 | |||
3239 | 3220 | #ifndef DIR_SEPARATOR_2 | ||
3240 | 3221 | # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) | ||
3241 | 3222 | #else /* DIR_SEPARATOR_2 */ | ||
3242 | 3223 | # define IS_DIR_SEPARATOR(ch) \ | ||
3243 | 3224 | (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) | ||
3244 | 3225 | #endif /* DIR_SEPARATOR_2 */ | ||
3245 | 3226 | |||
3246 | 3227 | #ifndef PATH_SEPARATOR_2 | ||
3247 | 3228 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) | ||
3248 | 3229 | #else /* PATH_SEPARATOR_2 */ | ||
3249 | 3230 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) | ||
3250 | 3231 | #endif /* PATH_SEPARATOR_2 */ | ||
3251 | 3232 | |||
3252 | 3233 | #ifdef __CYGWIN__ | ||
3253 | 3234 | # define FOPEN_WB "wb" | ||
3254 | 3235 | #endif | ||
3255 | 3236 | |||
3256 | 3237 | #ifndef FOPEN_WB | ||
3257 | 3238 | # define FOPEN_WB "w" | ||
3258 | 3239 | #endif | ||
3259 | 3240 | #ifndef _O_BINARY | ||
3260 | 3241 | # define _O_BINARY 0 | ||
3261 | 3242 | #endif | ||
3262 | 3243 | |||
3263 | 3244 | #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) | ||
3264 | 3245 | #define XFREE(stale) do { \ | ||
3265 | 3246 | if (stale) { free ((void *) stale); stale = 0; } \ | ||
3266 | 3247 | } while (0) | ||
3267 | 3248 | |||
3268 | 3249 | #undef LTWRAPPER_DEBUGPRINTF | ||
3269 | 3250 | #if defined DEBUGWRAPPER | ||
3270 | 3251 | # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args | ||
3271 | 3252 | static void | ||
3272 | 3253 | ltwrapper_debugprintf (const char *fmt, ...) | ||
3273 | 3254 | { | ||
3274 | 3255 | va_list args; | ||
3275 | 3256 | va_start (args, fmt); | ||
3276 | 3257 | (void) vfprintf (stderr, fmt, args); | ||
3277 | 3258 | va_end (args); | ||
3278 | 3259 | } | ||
3279 | 3260 | #else | ||
3280 | 3261 | # define LTWRAPPER_DEBUGPRINTF(args) | ||
3281 | 3262 | #endif | ||
3282 | 3263 | |||
3283 | 3264 | const char *program_name = NULL; | ||
3284 | 3265 | |||
3285 | 3266 | void *xmalloc (size_t num); | ||
3286 | 3267 | char *xstrdup (const char *string); | ||
3287 | 3268 | const char *base_name (const char *name); | ||
3288 | 3269 | char *find_executable (const char *wrapper); | ||
3289 | 3270 | char *chase_symlinks (const char *pathspec); | ||
3290 | 3271 | int make_executable (const char *path); | ||
3291 | 3272 | int check_executable (const char *path); | ||
3292 | 3273 | char *strendzap (char *str, const char *pat); | ||
3293 | 3274 | void lt_fatal (const char *message, ...); | ||
3294 | 3275 | void lt_setenv (const char *name, const char *value); | ||
3295 | 3276 | char *lt_extend_str (const char *orig_value, const char *add, int to_end); | ||
3296 | 3277 | void lt_opt_process_env_set (const char *arg); | ||
3297 | 3278 | void lt_opt_process_env_prepend (const char *arg); | ||
3298 | 3279 | void lt_opt_process_env_append (const char *arg); | ||
3299 | 3280 | int lt_split_name_value (const char *arg, char** name, char** value); | ||
3300 | 3281 | void lt_update_exe_path (const char *name, const char *value); | ||
3301 | 3282 | void lt_update_lib_path (const char *name, const char *value); | ||
3302 | 3283 | |||
3303 | 3284 | static const char *script_text_part1 = | ||
3304 | 3285 | EOF | ||
3305 | 3286 | |||
3306 | 3287 | func_emit_wrapper_part1 yes | | ||
3307 | 3288 | $SED -e 's/\([\\"]\)/\\\1/g' \ | ||
3308 | 3289 | -e 's/^/ "/' -e 's/$/\\n"/' | ||
3309 | 3290 | echo ";" | ||
3310 | 3291 | cat <<EOF | ||
3311 | 3292 | |||
3312 | 3293 | static const char *script_text_part2 = | ||
3313 | 3294 | EOF | ||
3314 | 3295 | func_emit_wrapper_part2 yes | | ||
3315 | 3296 | $SED -e 's/\([\\"]\)/\\\1/g' \ | ||
3316 | 3297 | -e 's/^/ "/' -e 's/$/\\n"/' | ||
3317 | 3298 | echo ";" | ||
3318 | 3299 | |||
3319 | 3300 | cat <<EOF | ||
3320 | 3301 | const char * MAGIC_EXE = "$magic_exe"; | ||
3321 | 3302 | const char * LIB_PATH_VARNAME = "$shlibpath_var"; | ||
3322 | 3303 | EOF | ||
3323 | 3304 | |||
3324 | 3305 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then | ||
3325 | 3306 | func_to_host_pathlist "$temp_rpath" | ||
3326 | 3307 | cat <<EOF | ||
3327 | 3308 | const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; | ||
3328 | 3309 | EOF | ||
3329 | 3310 | else | ||
3330 | 3311 | cat <<"EOF" | ||
3331 | 3312 | const char * LIB_PATH_VALUE = ""; | ||
3332 | 3313 | EOF | ||
3333 | 3314 | fi | ||
3334 | 3315 | |||
3335 | 3316 | if test -n "$dllsearchpath"; then | ||
3336 | 3317 | func_to_host_pathlist "$dllsearchpath:" | ||
3337 | 3318 | cat <<EOF | ||
3338 | 3319 | const char * EXE_PATH_VARNAME = "PATH"; | ||
3339 | 3320 | const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; | ||
3340 | 3321 | EOF | ||
3341 | 3322 | else | ||
3342 | 3323 | cat <<"EOF" | ||
3343 | 3324 | const char * EXE_PATH_VARNAME = ""; | ||
3344 | 3325 | const char * EXE_PATH_VALUE = ""; | ||
3345 | 3326 | EOF | ||
3346 | 3327 | fi | ||
3347 | 3328 | |||
3348 | 3329 | if test "$fast_install" = yes; then | ||
3349 | 3330 | cat <<EOF | ||
3350 | 3331 | const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ | ||
3351 | 3332 | EOF | ||
3352 | 3333 | else | ||
3353 | 3334 | cat <<EOF | ||
3354 | 3335 | const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ | ||
3355 | 3336 | EOF | ||
3356 | 3337 | fi | ||
3357 | 3338 | |||
3358 | 3339 | |||
3359 | 3340 | cat <<"EOF" | ||
3360 | 3341 | |||
3361 | 3342 | #define LTWRAPPER_OPTION_PREFIX "--lt-" | ||
3362 | 3343 | #define LTWRAPPER_OPTION_PREFIX_LENGTH 5 | ||
3363 | 3344 | |||
3364 | 3345 | static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH; | ||
3365 | 3346 | static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; | ||
3366 | 3347 | |||
3367 | 3348 | static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; | ||
3368 | 3349 | |||
3369 | 3350 | static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7; | ||
3370 | 3351 | static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set"; | ||
3371 | 3352 | /* argument is putenv-style "foo=bar", value of foo is set to bar */ | ||
3372 | 3353 | |||
3373 | 3354 | static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11; | ||
3374 | 3355 | static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend"; | ||
3375 | 3356 | /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */ | ||
3376 | 3357 | |||
3377 | 3358 | static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10; | ||
3378 | 3359 | static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append"; | ||
3379 | 3360 | /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */ | ||
3380 | 3361 | |||
3381 | 3362 | int | ||
3382 | 3363 | main (int argc, char *argv[]) | ||
3383 | 3364 | { | ||
3384 | 3365 | char **newargz; | ||
3385 | 3366 | int newargc; | ||
3386 | 3367 | char *tmp_pathspec; | ||
3387 | 3368 | char *actual_cwrapper_path; | ||
3388 | 3369 | char *actual_cwrapper_name; | ||
3389 | 3370 | char *target_name; | ||
3390 | 3371 | char *lt_argv_zero; | ||
3391 | 3372 | intptr_t rval = 127; | ||
3392 | 3373 | |||
3393 | 3374 | int i; | ||
3394 | 3375 | |||
3395 | 3376 | program_name = (char *) xstrdup (base_name (argv[0])); | ||
3396 | 3377 | LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0])); | ||
3397 | 3378 | LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name)); | ||
3398 | 3379 | |||
3399 | 3380 | /* very simple arg parsing; don't want to rely on getopt */ | ||
3400 | 3381 | for (i = 1; i < argc; i++) | ||
3401 | 3382 | { | ||
3402 | 3383 | if (strcmp (argv[i], dumpscript_opt) == 0) | ||
3403 | 3384 | { | ||
3404 | 3385 | EOF | ||
3405 | 3386 | case "$host" in | ||
3406 | 3387 | *mingw* | *cygwin* ) | ||
3407 | 3388 | # make stdout use "unix" line endings | ||
3408 | 3389 | echo " setmode(1,_O_BINARY);" | ||
3409 | 3390 | ;; | ||
3410 | 3391 | esac | ||
3411 | 3392 | |||
3412 | 3393 | cat <<"EOF" | ||
3413 | 3394 | printf ("%s", script_text_part1); | ||
3414 | 3395 | printf ("%s", script_text_part2); | ||
3415 | 3396 | return 0; | ||
3416 | 3397 | } | ||
3417 | 3398 | } | ||
3418 | 3399 | |||
3419 | 3400 | newargz = XMALLOC (char *, argc + 1); | ||
3420 | 3401 | tmp_pathspec = find_executable (argv[0]); | ||
3421 | 3402 | if (tmp_pathspec == NULL) | ||
3422 | 3403 | lt_fatal ("Couldn't find %s", argv[0]); | ||
3423 | 3404 | LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n", | ||
3424 | 3405 | tmp_pathspec)); | ||
3425 | 3406 | |||
3426 | 3407 | actual_cwrapper_path = chase_symlinks (tmp_pathspec); | ||
3427 | 3408 | LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n", | ||
3428 | 3409 | actual_cwrapper_path)); | ||
3429 | 3410 | XFREE (tmp_pathspec); | ||
3430 | 3411 | |||
3431 | 3412 | actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path)); | ||
3432 | 3413 | strendzap (actual_cwrapper_path, actual_cwrapper_name); | ||
3433 | 3414 | |||
3434 | 3415 | /* wrapper name transforms */ | ||
3435 | 3416 | strendzap (actual_cwrapper_name, ".exe"); | ||
3436 | 3417 | tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); | ||
3437 | 3418 | XFREE (actual_cwrapper_name); | ||
3438 | 3419 | actual_cwrapper_name = tmp_pathspec; | ||
3439 | 3420 | tmp_pathspec = 0; | ||
3440 | 3421 | |||
3441 | 3422 | /* target_name transforms -- use actual target program name; might have lt- prefix */ | ||
3442 | 3423 | target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); | ||
3443 | 3424 | strendzap (target_name, ".exe"); | ||
3444 | 3425 | tmp_pathspec = lt_extend_str (target_name, ".exe", 1); | ||
3445 | 3426 | XFREE (target_name); | ||
3446 | 3427 | target_name = tmp_pathspec; | ||
3447 | 3428 | tmp_pathspec = 0; | ||
3448 | 3429 | |||
3449 | 3430 | LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n", | ||
3450 | 3431 | target_name)); | ||
3451 | 3432 | EOF | ||
3452 | 3433 | |||
3453 | 3434 | cat <<EOF | ||
3454 | 3435 | newargz[0] = | ||
3455 | 3436 | XMALLOC (char, (strlen (actual_cwrapper_path) + | ||
3456 | 3437 | strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); | ||
3457 | 3438 | strcpy (newargz[0], actual_cwrapper_path); | ||
3458 | 3439 | strcat (newargz[0], "$objdir"); | ||
3459 | 3440 | strcat (newargz[0], "/"); | ||
3460 | 3441 | EOF | ||
3461 | 3442 | |||
3462 | 3443 | cat <<"EOF" | ||
3463 | 3444 | /* stop here, and copy so we don't have to do this twice */ | ||
3464 | 3445 | tmp_pathspec = xstrdup (newargz[0]); | ||
3465 | 3446 | |||
3466 | 3447 | /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ | ||
3467 | 3448 | strcat (newargz[0], actual_cwrapper_name); | ||
3468 | 3449 | |||
3469 | 3450 | /* DO want the lt- prefix here if it exists, so use target_name */ | ||
3470 | 3451 | lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); | ||
3471 | 3452 | XFREE (tmp_pathspec); | ||
3472 | 3453 | tmp_pathspec = NULL; | ||
3473 | 3454 | EOF | ||
3474 | 3455 | |||
3475 | 3456 | case $host_os in | ||
3476 | 3457 | mingw*) | ||
3477 | 3458 | cat <<"EOF" | ||
3478 | 3459 | { | ||
3479 | 3460 | char* p; | ||
3480 | 3461 | while ((p = strchr (newargz[0], '\\')) != NULL) | ||
3481 | 3462 | { | ||
3482 | 3463 | *p = '/'; | ||
3483 | 3464 | } | ||
3484 | 3465 | while ((p = strchr (lt_argv_zero, '\\')) != NULL) | ||
3485 | 3466 | { | ||
3486 | 3467 | *p = '/'; | ||
3487 | 3468 | } | ||
3488 | 3469 | } | ||
3489 | 3470 | EOF | ||
3490 | 3471 | ;; | ||
3491 | 3472 | esac | ||
3492 | 3473 | |||
3493 | 3474 | cat <<"EOF" | ||
3494 | 3475 | XFREE (target_name); | ||
3495 | 3476 | XFREE (actual_cwrapper_path); | ||
3496 | 3477 | XFREE (actual_cwrapper_name); | ||
3497 | 3478 | |||
3498 | 3479 | lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ | ||
3499 | 3480 | lt_setenv ("DUALCASE", "1"); /* for MSK sh */ | ||
3500 | 3481 | lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); | ||
3501 | 3482 | lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); | ||
3502 | 3483 | |||
3503 | 3484 | newargc=0; | ||
3504 | 3485 | for (i = 1; i < argc; i++) | ||
3505 | 3486 | { | ||
3506 | 3487 | if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0) | ||
3507 | 3488 | { | ||
3508 | 3489 | if (argv[i][env_set_opt_len] == '=') | ||
3509 | 3490 | { | ||
3510 | 3491 | const char *p = argv[i] + env_set_opt_len + 1; | ||
3511 | 3492 | lt_opt_process_env_set (p); | ||
3512 | 3493 | } | ||
3513 | 3494 | else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc) | ||
3514 | 3495 | { | ||
3515 | 3496 | lt_opt_process_env_set (argv[++i]); /* don't copy */ | ||
3516 | 3497 | } | ||
3517 | 3498 | else | ||
3518 | 3499 | lt_fatal ("%s missing required argument", env_set_opt); | ||
3519 | 3500 | continue; | ||
3520 | 3501 | } | ||
3521 | 3502 | if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0) | ||
3522 | 3503 | { | ||
3523 | 3504 | if (argv[i][env_prepend_opt_len] == '=') | ||
3524 | 3505 | { | ||
3525 | 3506 | const char *p = argv[i] + env_prepend_opt_len + 1; | ||
3526 | 3507 | lt_opt_process_env_prepend (p); | ||
3527 | 3508 | } | ||
3528 | 3509 | else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc) | ||
3529 | 3510 | { | ||
3530 | 3511 | lt_opt_process_env_prepend (argv[++i]); /* don't copy */ | ||
3531 | 3512 | } | ||
3532 | 3513 | else | ||
3533 | 3514 | lt_fatal ("%s missing required argument", env_prepend_opt); | ||
3534 | 3515 | continue; | ||
3535 | 3516 | } | ||
3536 | 3517 | if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0) | ||
3537 | 3518 | { | ||
3538 | 3519 | if (argv[i][env_append_opt_len] == '=') | ||
3539 | 3520 | { | ||
3540 | 3521 | const char *p = argv[i] + env_append_opt_len + 1; | ||
3541 | 3522 | lt_opt_process_env_append (p); | ||
3542 | 3523 | } | ||
3543 | 3524 | else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc) | ||
3544 | 3525 | { | ||
3545 | 3526 | lt_opt_process_env_append (argv[++i]); /* don't copy */ | ||
3546 | 3527 | } | ||
3547 | 3528 | else | ||
3548 | 3529 | lt_fatal ("%s missing required argument", env_append_opt); | ||
3549 | 3530 | continue; | ||
3550 | 3531 | } | ||
3551 | 3532 | if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0) | ||
3552 | 3533 | { | ||
3553 | 3534 | /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX | ||
3554 | 3535 | namespace, but it is not one of the ones we know about and | ||
3555 | 3536 | have already dealt with, above (inluding dump-script), then | ||
3556 | 3537 | report an error. Otherwise, targets might begin to believe | ||
3557 | 3538 | they are allowed to use options in the LTWRAPPER_OPTION_PREFIX | ||
3558 | 3539 | namespace. The first time any user complains about this, we'll | ||
3559 | 3540 | need to make LTWRAPPER_OPTION_PREFIX a configure-time option | ||
3560 | 3541 | or a configure.ac-settable value. | ||
3561 | 3542 | */ | ||
3562 | 3543 | lt_fatal ("Unrecognized option in %s namespace: '%s'", | ||
3563 | 3544 | ltwrapper_option_prefix, argv[i]); | ||
3564 | 3545 | } | ||
3565 | 3546 | /* otherwise ... */ | ||
3566 | 3547 | newargz[++newargc] = xstrdup (argv[i]); | ||
3567 | 3548 | } | ||
3568 | 3549 | newargz[++newargc] = NULL; | ||
3569 | 3550 | |||
3570 | 3551 | LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>"))); | ||
3571 | 3552 | for (i = 0; i < newargc; i++) | ||
3572 | 3553 | { | ||
3573 | 3554 | LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>"))); | ||
3574 | 3555 | } | ||
3575 | 3556 | |||
3576 | 3557 | EOF | ||
3577 | 3558 | |||
3578 | 3559 | case $host_os in | ||
3579 | 3560 | mingw*) | ||
3580 | 3561 | cat <<"EOF" | ||
3581 | 3562 | /* execv doesn't actually work on mingw as expected on unix */ | ||
3582 | 3563 | rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); | ||
3583 | 3564 | if (rval == -1) | ||
3584 | 3565 | { | ||
3585 | 3566 | /* failed to start process */ | ||
3586 | 3567 | LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); | ||
3587 | 3568 | return 127; | ||
3588 | 3569 | } | ||
3589 | 3570 | return rval; | ||
3590 | 3571 | EOF | ||
3591 | 3572 | ;; | ||
3592 | 3573 | *) | ||
3593 | 3574 | cat <<"EOF" | ||
3594 | 3575 | execv (lt_argv_zero, newargz); | ||
3595 | 3576 | return rval; /* =127, but avoids unused variable warning */ | ||
3596 | 3577 | EOF | ||
3597 | 3578 | ;; | ||
3598 | 3579 | esac | ||
3599 | 3580 | |||
3600 | 3581 | cat <<"EOF" | ||
3601 | 3582 | } | ||
3602 | 3583 | |||
3603 | 3584 | void * | ||
3604 | 3585 | xmalloc (size_t num) | ||
3605 | 3586 | { | ||
3606 | 3587 | void *p = (void *) malloc (num); | ||
3607 | 3588 | if (!p) | ||
3608 | 3589 | lt_fatal ("Memory exhausted"); | ||
3609 | 3590 | |||
3610 | 3591 | return p; | ||
3611 | 3592 | } | ||
3612 | 3593 | |||
3613 | 3594 | char * | ||
3614 | 3595 | xstrdup (const char *string) | ||
3615 | 3596 | { | ||
3616 | 3597 | return string ? strcpy ((char *) xmalloc (strlen (string) + 1), | ||
3617 | 3598 | string) : NULL; | ||
3618 | 3599 | } | ||
3619 | 3600 | |||
3620 | 3601 | const char * | ||
3621 | 3602 | base_name (const char *name) | ||
3622 | 3603 | { | ||
3623 | 3604 | const char *base; | ||
3624 | 3605 | |||
3625 | 3606 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) | ||
3626 | 3607 | /* Skip over the disk name in MSDOS pathnames. */ | ||
3627 | 3608 | if (isalpha ((unsigned char) name[0]) && name[1] == ':') | ||
3628 | 3609 | name += 2; | ||
3629 | 3610 | #endif | ||
3630 | 3611 | |||
3631 | 3612 | for (base = name; *name; name++) | ||
3632 | 3613 | if (IS_DIR_SEPARATOR (*name)) | ||
3633 | 3614 | base = name + 1; | ||
3634 | 3615 | return base; | ||
3635 | 3616 | } | ||
3636 | 3617 | |||
3637 | 3618 | int | ||
3638 | 3619 | check_executable (const char *path) | ||
3639 | 3620 | { | ||
3640 | 3621 | struct stat st; | ||
3641 | 3622 | |||
3642 | 3623 | LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", | ||
3643 | 3624 | path ? (*path ? path : "EMPTY!") : "NULL!")); | ||
3644 | 3625 | if ((!path) || (!*path)) | ||
3645 | 3626 | return 0; | ||
3646 | 3627 | |||
3647 | 3628 | if ((stat (path, &st) >= 0) | ||
3648 | 3629 | && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) | ||
3649 | 3630 | return 1; | ||
3650 | 3631 | else | ||
3651 | 3632 | return 0; | ||
3652 | 3633 | } | ||
3653 | 3634 | |||
3654 | 3635 | int | ||
3655 | 3636 | make_executable (const char *path) | ||
3656 | 3637 | { | ||
3657 | 3638 | int rval = 0; | ||
3658 | 3639 | struct stat st; | ||
3659 | 3640 | |||
3660 | 3641 | LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", | ||
3661 | 3642 | path ? (*path ? path : "EMPTY!") : "NULL!")); | ||
3662 | 3643 | if ((!path) || (!*path)) | ||
3663 | 3644 | return 0; | ||
3664 | 3645 | |||
3665 | 3646 | if (stat (path, &st) >= 0) | ||
3666 | 3647 | { | ||
3667 | 3648 | rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); | ||
3668 | 3649 | } | ||
3669 | 3650 | return rval; | ||
3670 | 3651 | } | ||
3671 | 3652 | |||
3672 | 3653 | /* Searches for the full path of the wrapper. Returns | ||
3673 | 3654 | newly allocated full path name if found, NULL otherwise | ||
3674 | 3655 | Does not chase symlinks, even on platforms that support them. | ||
3675 | 3656 | */ | ||
3676 | 3657 | char * | ||
3677 | 3658 | find_executable (const char *wrapper) | ||
3678 | 3659 | { | ||
3679 | 3660 | int has_slash = 0; | ||
3680 | 3661 | const char *p; | ||
3681 | 3662 | const char *p_next; | ||
3682 | 3663 | /* static buffer for getcwd */ | ||
3683 | 3664 | char tmp[LT_PATHMAX + 1]; | ||
3684 | 3665 | int tmp_len; | ||
3685 | 3666 | char *concat_name; | ||
3686 | 3667 | |||
3687 | 3668 | LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", | ||
3688 | 3669 | wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); | ||
3689 | 3670 | |||
3690 | 3671 | if ((wrapper == NULL) || (*wrapper == '\0')) | ||
3691 | 3672 | return NULL; | ||
3692 | 3673 | |||
3693 | 3674 | /* Absolute path? */ | ||
3694 | 3675 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) | ||
3695 | 3676 | if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') | ||
3696 | 3677 | { | ||
3697 | 3678 | concat_name = xstrdup (wrapper); | ||
3698 | 3679 | if (check_executable (concat_name)) | ||
3699 | 3680 | return concat_name; | ||
3700 | 3681 | XFREE (concat_name); | ||
3701 | 3682 | } | ||
3702 | 3683 | else | ||
3703 | 3684 | { | ||
3704 | 3685 | #endif | ||
3705 | 3686 | if (IS_DIR_SEPARATOR (wrapper[0])) | ||
3706 | 3687 | { | ||
3707 | 3688 | concat_name = xstrdup (wrapper); | ||
3708 | 3689 | if (check_executable (concat_name)) | ||
3709 | 3690 | return concat_name; | ||
3710 | 3691 | XFREE (concat_name); | ||
3711 | 3692 | } | ||
3712 | 3693 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) | ||
3713 | 3694 | } | ||
3714 | 3695 | #endif | ||
3715 | 3696 | |||
3716 | 3697 | for (p = wrapper; *p; p++) | ||
3717 | 3698 | if (*p == '/') | ||
3718 | 3699 | { | ||
3719 | 3700 | has_slash = 1; | ||
3720 | 3701 | break; | ||
3721 | 3702 | } | ||
3722 | 3703 | if (!has_slash) | ||
3723 | 3704 | { | ||
3724 | 3705 | /* no slashes; search PATH */ | ||
3725 | 3706 | const char *path = getenv ("PATH"); | ||
3726 | 3707 | if (path != NULL) | ||
3727 | 3708 | { | ||
3728 | 3709 | for (p = path; *p; p = p_next) | ||
3729 | 3710 | { | ||
3730 | 3711 | const char *q; | ||
3731 | 3712 | size_t p_len; | ||
3732 | 3713 | for (q = p; *q; q++) | ||
3733 | 3714 | if (IS_PATH_SEPARATOR (*q)) | ||
3734 | 3715 | break; | ||
3735 | 3716 | p_len = q - p; | ||
3736 | 3717 | p_next = (*q == '\0' ? q : q + 1); | ||
3737 | 3718 | if (p_len == 0) | ||
3738 | 3719 | { | ||
3739 | 3720 | /* empty path: current directory */ | ||
3740 | 3721 | if (getcwd (tmp, LT_PATHMAX) == NULL) | ||
3741 | 3722 | lt_fatal ("getcwd failed"); | ||
3742 | 3723 | tmp_len = strlen (tmp); | ||
3743 | 3724 | concat_name = | ||
3744 | 3725 | XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); | ||
3745 | 3726 | memcpy (concat_name, tmp, tmp_len); | ||
3746 | 3727 | concat_name[tmp_len] = '/'; | ||
3747 | 3728 | strcpy (concat_name + tmp_len + 1, wrapper); | ||
3748 | 3729 | } | ||
3749 | 3730 | else | ||
3750 | 3731 | { | ||
3751 | 3732 | concat_name = | ||
3752 | 3733 | XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); | ||
3753 | 3734 | memcpy (concat_name, p, p_len); | ||
3754 | 3735 | concat_name[p_len] = '/'; | ||
3755 | 3736 | strcpy (concat_name + p_len + 1, wrapper); | ||
3756 | 3737 | } | ||
3757 | 3738 | if (check_executable (concat_name)) | ||
3758 | 3739 | return concat_name; | ||
3759 | 3740 | XFREE (concat_name); | ||
3760 | 3741 | } | ||
3761 | 3742 | } | ||
3762 | 3743 | /* not found in PATH; assume curdir */ | ||
3763 | 3744 | } | ||
3764 | 3745 | /* Relative path | not found in path: prepend cwd */ | ||
3765 | 3746 | if (getcwd (tmp, LT_PATHMAX) == NULL) | ||
3766 | 3747 | lt_fatal ("getcwd failed"); | ||
3767 | 3748 | tmp_len = strlen (tmp); | ||
3768 | 3749 | concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); | ||
3769 | 3750 | memcpy (concat_name, tmp, tmp_len); | ||
3770 | 3751 | concat_name[tmp_len] = '/'; | ||
3771 | 3752 | strcpy (concat_name + tmp_len + 1, wrapper); | ||
3772 | 3753 | |||
3773 | 3754 | if (check_executable (concat_name)) | ||
3774 | 3755 | return concat_name; | ||
3775 | 3756 | XFREE (concat_name); | ||
3776 | 3757 | return NULL; | ||
3777 | 3758 | } | ||
3778 | 3759 | |||
3779 | 3760 | char * | ||
3780 | 3761 | chase_symlinks (const char *pathspec) | ||
3781 | 3762 | { | ||
3782 | 3763 | #ifndef S_ISLNK | ||
3783 | 3764 | return xstrdup (pathspec); | ||
3784 | 3765 | #else | ||
3785 | 3766 | char buf[LT_PATHMAX]; | ||
3786 | 3767 | struct stat s; | ||
3787 | 3768 | char *tmp_pathspec = xstrdup (pathspec); | ||
3788 | 3769 | char *p; | ||
3789 | 3770 | int has_symlinks = 0; | ||
3790 | 3771 | while (strlen (tmp_pathspec) && !has_symlinks) | ||
3791 | 3772 | { | ||
3792 | 3773 | LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", | ||
3793 | 3774 | tmp_pathspec)); | ||
3794 | 3775 | if (lstat (tmp_pathspec, &s) == 0) | ||
3795 | 3776 | { | ||
3796 | 3777 | if (S_ISLNK (s.st_mode) != 0) | ||
3797 | 3778 | { | ||
3798 | 3779 | has_symlinks = 1; | ||
3799 | 3780 | break; | ||
3800 | 3781 | } | ||
3801 | 3782 | |||
3802 | 3783 | /* search backwards for last DIR_SEPARATOR */ | ||
3803 | 3784 | p = tmp_pathspec + strlen (tmp_pathspec) - 1; | ||
3804 | 3785 | while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) | ||
3805 | 3786 | p--; | ||
3806 | 3787 | if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) | ||
3807 | 3788 | { | ||
3808 | 3789 | /* no more DIR_SEPARATORS left */ | ||
3809 | 3790 | break; | ||
3810 | 3791 | } | ||
3811 | 3792 | *p = '\0'; | ||
3812 | 3793 | } | ||
3813 | 3794 | else | ||
3814 | 3795 | { | ||
3815 | 3796 | char *errstr = strerror (errno); | ||
3816 | 3797 | lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); | ||
3817 | 3798 | } | ||
3818 | 3799 | } | ||
3819 | 3800 | XFREE (tmp_pathspec); | ||
3820 | 3801 | |||
3821 | 3802 | if (!has_symlinks) | ||
3822 | 3803 | { | ||
3823 | 3804 | return xstrdup (pathspec); | ||
3824 | 3805 | } | ||
3825 | 3806 | |||
3826 | 3807 | tmp_pathspec = realpath (pathspec, buf); | ||
3827 | 3808 | if (tmp_pathspec == 0) | ||
3828 | 3809 | { | ||
3829 | 3810 | lt_fatal ("Could not follow symlinks for %s", pathspec); | ||
3830 | 3811 | } | ||
3831 | 3812 | return xstrdup (tmp_pathspec); | ||
3832 | 3813 | #endif | ||
3833 | 3814 | } | ||
3834 | 3815 | |||
3835 | 3816 | char * | ||
3836 | 3817 | strendzap (char *str, const char *pat) | ||
3837 | 3818 | { | ||
3838 | 3819 | size_t len, patlen; | ||
3839 | 3820 | |||
3840 | 3821 | assert (str != NULL); | ||
3841 | 3822 | assert (pat != NULL); | ||
3842 | 3823 | |||
3843 | 3824 | len = strlen (str); | ||
3844 | 3825 | patlen = strlen (pat); | ||
3845 | 3826 | |||
3846 | 3827 | if (patlen <= len) | ||
3847 | 3828 | { | ||
3848 | 3829 | str += len - patlen; | ||
3849 | 3830 | if (strcmp (str, pat) == 0) | ||
3850 | 3831 | *str = '\0'; | ||
3851 | 3832 | } | ||
3852 | 3833 | return str; | ||
3853 | 3834 | } | ||
3854 | 3835 | |||
3855 | 3836 | static void | ||
3856 | 3837 | lt_error_core (int exit_status, const char *mode, | ||
3857 | 3838 | const char *message, va_list ap) | ||
3858 | 3839 | { | ||
3859 | 3840 | fprintf (stderr, "%s: %s: ", program_name, mode); | ||
3860 | 3841 | vfprintf (stderr, message, ap); | ||
3861 | 3842 | fprintf (stderr, ".\n"); | ||
3862 | 3843 | |||
3863 | 3844 | if (exit_status >= 0) | ||
3864 | 3845 | exit (exit_status); | ||
3865 | 3846 | } | ||
3866 | 3847 | |||
3867 | 3848 | void | ||
3868 | 3849 | lt_fatal (const char *message, ...) | ||
3869 | 3850 | { | ||
3870 | 3851 | va_list ap; | ||
3871 | 3852 | va_start (ap, message); | ||
3872 | 3853 | lt_error_core (EXIT_FAILURE, "FATAL", message, ap); | ||
3873 | 3854 | va_end (ap); | ||
3874 | 3855 | } | ||
3875 | 3856 | |||
3876 | 3857 | void | ||
3877 | 3858 | lt_setenv (const char *name, const char *value) | ||
3878 | 3859 | { | ||
3879 | 3860 | LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", | ||
3880 | 3861 | (name ? name : "<NULL>"), | ||
3881 | 3862 | (value ? value : "<NULL>"))); | ||
3882 | 3863 | { | ||
3883 | 3864 | #ifdef HAVE_SETENV | ||
3884 | 3865 | /* always make a copy, for consistency with !HAVE_SETENV */ | ||
3885 | 3866 | char *str = xstrdup (value); | ||
3886 | 3867 | setenv (name, str, 1); | ||
3887 | 3868 | #else | ||
3888 | 3869 | int len = strlen (name) + 1 + strlen (value) + 1; | ||
3889 | 3870 | char *str = XMALLOC (char, len); | ||
3890 | 3871 | sprintf (str, "%s=%s", name, value); | ||
3891 | 3872 | if (putenv (str) != EXIT_SUCCESS) | ||
3892 | 3873 | { | ||
3893 | 3874 | XFREE (str); | ||
3894 | 3875 | } | ||
3895 | 3876 | #endif | ||
3896 | 3877 | } | ||
3897 | 3878 | } | ||
3898 | 3879 | |||
3899 | 3880 | char * | ||
3900 | 3881 | lt_extend_str (const char *orig_value, const char *add, int to_end) | ||
3901 | 3882 | { | ||
3902 | 3883 | char *new_value; | ||
3903 | 3884 | if (orig_value && *orig_value) | ||
3904 | 3885 | { | ||
3905 | 3886 | int orig_value_len = strlen (orig_value); | ||
3906 | 3887 | int add_len = strlen (add); | ||
3907 | 3888 | new_value = XMALLOC (char, add_len + orig_value_len + 1); | ||
3908 | 3889 | if (to_end) | ||
3909 | 3890 | { | ||
3910 | 3891 | strcpy (new_value, orig_value); | ||
3911 | 3892 | strcpy (new_value + orig_value_len, add); | ||
3912 | 3893 | } | ||
3913 | 3894 | else | ||
3914 | 3895 | { | ||
3915 | 3896 | strcpy (new_value, add); | ||
3916 | 3897 | strcpy (new_value + add_len, orig_value); | ||
3917 | 3898 | } | ||
3918 | 3899 | } | ||
3919 | 3900 | else | ||
3920 | 3901 | { | ||
3921 | 3902 | new_value = xstrdup (add); | ||
3922 | 3903 | } | ||
3923 | 3904 | return new_value; | ||
3924 | 3905 | } | ||
3925 | 3906 | |||
3926 | 3907 | int | ||
3927 | 3908 | lt_split_name_value (const char *arg, char** name, char** value) | ||
3928 | 3909 | { | ||
3929 | 3910 | const char *p; | ||
3930 | 3911 | int len; | ||
3931 | 3912 | if (!arg || !*arg) | ||
3932 | 3913 | return 1; | ||
3933 | 3914 | |||
3934 | 3915 | p = strchr (arg, (int)'='); | ||
3935 | 3916 | |||
3936 | 3917 | if (!p) | ||
3937 | 3918 | return 1; | ||
3938 | 3919 | |||
3939 | 3920 | *value = xstrdup (++p); | ||
3940 | 3921 | |||
3941 | 3922 | len = strlen (arg) - strlen (*value); | ||
3942 | 3923 | *name = XMALLOC (char, len); | ||
3943 | 3924 | strncpy (*name, arg, len-1); | ||
3944 | 3925 | (*name)[len - 1] = '\0'; | ||
3945 | 3926 | |||
3946 | 3927 | return 0; | ||
3947 | 3928 | } | ||
3948 | 3929 | |||
3949 | 3930 | void | ||
3950 | 3931 | lt_opt_process_env_set (const char *arg) | ||
3951 | 3932 | { | ||
3952 | 3933 | char *name = NULL; | ||
3953 | 3934 | char *value = NULL; | ||
3954 | 3935 | |||
3955 | 3936 | if (lt_split_name_value (arg, &name, &value) != 0) | ||
3956 | 3937 | { | ||
3957 | 3938 | XFREE (name); | ||
3958 | 3939 | XFREE (value); | ||
3959 | 3940 | lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); | ||
3960 | 3941 | } | ||
3961 | 3942 | |||
3962 | 3943 | lt_setenv (name, value); | ||
3963 | 3944 | XFREE (name); | ||
3964 | 3945 | XFREE (value); | ||
3965 | 3946 | } | ||
3966 | 3947 | |||
3967 | 3948 | void | ||
3968 | 3949 | lt_opt_process_env_prepend (const char *arg) | ||
3969 | 3950 | { | ||
3970 | 3951 | char *name = NULL; | ||
3971 | 3952 | char *value = NULL; | ||
3972 | 3953 | char *new_value = NULL; | ||
3973 | 3954 | |||
3974 | 3955 | if (lt_split_name_value (arg, &name, &value) != 0) | ||
3975 | 3956 | { | ||
3976 | 3957 | XFREE (name); | ||
3977 | 3958 | XFREE (value); | ||
3978 | 3959 | lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); | ||
3979 | 3960 | } | ||
3980 | 3961 | |||
3981 | 3962 | new_value = lt_extend_str (getenv (name), value, 0); | ||
3982 | 3963 | lt_setenv (name, new_value); | ||
3983 | 3964 | XFREE (new_value); | ||
3984 | 3965 | XFREE (name); | ||
3985 | 3966 | XFREE (value); | ||
3986 | 3967 | } | ||
3987 | 3968 | |||
3988 | 3969 | void | ||
3989 | 3970 | lt_opt_process_env_append (const char *arg) | ||
3990 | 3971 | { | ||
3991 | 3972 | char *name = NULL; | ||
3992 | 3973 | char *value = NULL; | ||
3993 | 3974 | char *new_value = NULL; | ||
3994 | 3975 | |||
3995 | 3976 | if (lt_split_name_value (arg, &name, &value) != 0) | ||
3996 | 3977 | { | ||
3997 | 3978 | XFREE (name); | ||
3998 | 3979 | XFREE (value); | ||
3999 | 3980 | lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); | ||
4000 | 3981 | } | ||
4001 | 3982 | |||
4002 | 3983 | new_value = lt_extend_str (getenv (name), value, 1); | ||
4003 | 3984 | lt_setenv (name, new_value); | ||
4004 | 3985 | XFREE (new_value); | ||
4005 | 3986 | XFREE (name); | ||
4006 | 3987 | XFREE (value); | ||
4007 | 3988 | } | ||
4008 | 3989 | |||
4009 | 3990 | void | ||
4010 | 3991 | lt_update_exe_path (const char *name, const char *value) | ||
4011 | 3992 | { | ||
4012 | 3993 | LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", | ||
4013 | 3994 | (name ? name : "<NULL>"), | ||
4014 | 3995 | (value ? value : "<NULL>"))); | ||
4015 | 3996 | |||
4016 | 3997 | if (name && *name && value && *value) | ||
4017 | 3998 | { | ||
4018 | 3999 | char *new_value = lt_extend_str (getenv (name), value, 0); | ||
4019 | 4000 | /* some systems can't cope with a ':'-terminated path #' */ | ||
4020 | 4001 | int len = strlen (new_value); | ||
4021 | 4002 | while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) | ||
4022 | 4003 | { | ||
4023 | 4004 | new_value[len-1] = '\0'; | ||
4024 | 4005 | } | ||
4025 | 4006 | lt_setenv (name, new_value); | ||
4026 | 4007 | XFREE (new_value); | ||
4027 | 4008 | } | ||
4028 | 4009 | } | ||
4029 | 4010 | |||
4030 | 4011 | void | ||
4031 | 4012 | lt_update_lib_path (const char *name, const char *value) | ||
4032 | 4013 | { | ||
4033 | 4014 | LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", | ||
4034 | 4015 | (name ? name : "<NULL>"), | ||
4035 | 4016 | (value ? value : "<NULL>"))); | ||
4036 | 4017 | |||
4037 | 4018 | if (name && *name && value && *value) | ||
4038 | 4019 | { | ||
4039 | 4020 | char *new_value = lt_extend_str (getenv (name), value, 0); | ||
4040 | 4021 | lt_setenv (name, new_value); | ||
4041 | 4022 | XFREE (new_value); | ||
4042 | 4023 | } | ||
4043 | 4024 | } | ||
4044 | 4025 | |||
4045 | 4026 | |||
4046 | 4027 | EOF | ||
4047 | 4028 | } | ||
4048 | 4029 | # end: func_emit_cwrapperexe_src | ||
4049 | 4030 | |||
4050 | 4031 | # func_mode_link arg... | ||
4051 | 4032 | func_mode_link () | ||
4052 | 4033 | { | ||
4053 | 4034 | $opt_debug | ||
4054 | 4035 | case $host in | ||
4055 | 4036 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) | ||
4056 | 4037 | # It is impossible to link a dll without this setting, and | ||
4057 | 4038 | # we shouldn't force the makefile maintainer to figure out | ||
4058 | 4039 | # which system we are compiling for in order to pass an extra | ||
4059 | 4040 | # flag for every libtool invocation. | ||
4060 | 4041 | # allow_undefined=no | ||
4061 | 4042 | |||
4062 | 4043 | # FIXME: Unfortunately, there are problems with the above when trying | ||
4063 | 4044 | # to make a dll which has undefined symbols, in which case not | ||
4064 | 4045 | # even a static library is built. For now, we need to specify | ||
4065 | 4046 | # -no-undefined on the libtool link line when we can be certain | ||
4066 | 4047 | # that all symbols are satisfied, otherwise we get a static library. | ||
4067 | 4048 | allow_undefined=yes | ||
4068 | 4049 | ;; | ||
4069 | 4050 | *) | ||
4070 | 4051 | allow_undefined=yes | ||
4071 | 4052 | ;; | ||
4072 | 4053 | esac | ||
4073 | 4054 | libtool_args=$nonopt | ||
4074 | 4055 | base_compile="$nonopt $@" | ||
4075 | 4056 | compile_command=$nonopt | ||
4076 | 4057 | finalize_command=$nonopt | ||
4077 | 4058 | |||
4078 | 4059 | compile_rpath= | ||
4079 | 4060 | finalize_rpath= | ||
4080 | 4061 | compile_shlibpath= | ||
4081 | 4062 | finalize_shlibpath= | ||
4082 | 4063 | convenience= | ||
4083 | 4064 | old_convenience= | ||
4084 | 4065 | deplibs= | ||
4085 | 4066 | old_deplibs= | ||
4086 | 4067 | compiler_flags= | ||
4087 | 4068 | linker_flags= | ||
4088 | 4069 | dllsearchpath= | ||
4089 | 4070 | lib_search_path=`pwd` | ||
4090 | 4071 | inst_prefix_dir= | ||
4091 | 4072 | new_inherited_linker_flags= | ||
4092 | 4073 | |||
4093 | 4074 | avoid_version=no | ||
4094 | 4075 | dlfiles= | ||
4095 | 4076 | dlprefiles= | ||
4096 | 4077 | dlself=no | ||
4097 | 4078 | export_dynamic=no | ||
4098 | 4079 | export_symbols= | ||
4099 | 4080 | export_symbols_regex= | ||
4100 | 4081 | generated= | ||
4101 | 4082 | libobjs= | ||
4102 | 4083 | ltlibs= | ||
4103 | 4084 | module=no | ||
4104 | 4085 | no_install=no | ||
4105 | 4086 | objs= | ||
4106 | 4087 | non_pic_objects= | ||
4107 | 4088 | precious_files_regex= | ||
4108 | 4089 | prefer_static_libs=no | ||
4109 | 4090 | preload=no | ||
4110 | 4091 | prev= | ||
4111 | 4092 | prevarg= | ||
4112 | 4093 | release= | ||
4113 | 4094 | rpath= | ||
4114 | 4095 | xrpath= | ||
4115 | 4096 | perm_rpath= | ||
4116 | 4097 | temp_rpath= | ||
4117 | 4098 | thread_safe=no | ||
4118 | 4099 | vinfo= | ||
4119 | 4100 | vinfo_number=no | ||
4120 | 4101 | weak_libs= | ||
4121 | 4102 | single_module="${wl}-single_module" | ||
4122 | 4103 | func_infer_tag $base_compile | ||
4123 | 4104 | |||
4124 | 4105 | # We need to know -static, to get the right output filenames. | ||
4125 | 4106 | for arg | ||
4126 | 4107 | do | ||
4127 | 4108 | case $arg in | ||
4128 | 4109 | -shared) | ||
4129 | 4110 | test "$build_libtool_libs" != yes && \ | ||
4130 | 4111 | func_fatal_configuration "can not build a shared library" | ||
4131 | 4112 | build_old_libs=no | ||
4132 | 4113 | break | ||
4133 | 4114 | ;; | ||
4134 | 4115 | -all-static | -static | -static-libtool-libs) | ||
4135 | 4116 | case $arg in | ||
4136 | 4117 | -all-static) | ||
4137 | 4118 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then | ||
4138 | 4119 | func_warning "complete static linking is impossible in this configuration" | ||
4139 | 4120 | fi | ||
4140 | 4121 | if test -n "$link_static_flag"; then | ||
4141 | 4122 | dlopen_self=$dlopen_self_static | ||
4142 | 4123 | fi | ||
4143 | 4124 | prefer_static_libs=yes | ||
4144 | 4125 | ;; | ||
4145 | 4126 | -static) | ||
4146 | 4127 | if test -z "$pic_flag" && test -n "$link_static_flag"; then | ||
4147 | 4128 | dlopen_self=$dlopen_self_static | ||
4148 | 4129 | fi | ||
4149 | 4130 | prefer_static_libs=built | ||
4150 | 4131 | ;; | ||
4151 | 4132 | -static-libtool-libs) | ||
4152 | 4133 | if test -z "$pic_flag" && test -n "$link_static_flag"; then | ||
4153 | 4134 | dlopen_self=$dlopen_self_static | ||
4154 | 4135 | fi | ||
4155 | 4136 | prefer_static_libs=yes | ||
4156 | 4137 | ;; | ||
4157 | 4138 | esac | ||
4158 | 4139 | build_libtool_libs=no | ||
4159 | 4140 | build_old_libs=yes | ||
4160 | 4141 | break | ||
4161 | 4142 | ;; | ||
4162 | 4143 | esac | ||
4163 | 4144 | done | ||
4164 | 4145 | |||
4165 | 4146 | # See if our shared archives depend on static archives. | ||
4166 | 4147 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes | ||
4167 | 4148 | |||
4168 | 4149 | # Go through the arguments, transforming them on the way. | ||
4169 | 4150 | while test "$#" -gt 0; do | ||
4170 | 4151 | arg="$1" | ||
4171 | 4152 | shift | ||
4172 | 4153 | func_quote_for_eval "$arg" | ||
4173 | 4154 | qarg=$func_quote_for_eval_unquoted_result | ||
4174 | 4155 | func_append libtool_args " $func_quote_for_eval_result" | ||
4175 | 4156 | |||
4176 | 4157 | # If the previous option needs an argument, assign it. | ||
4177 | 4158 | if test -n "$prev"; then | ||
4178 | 4159 | case $prev in | ||
4179 | 4160 | output) | ||
4180 | 4161 | func_append compile_command " @OUTPUT@" | ||
4181 | 4162 | func_append finalize_command " @OUTPUT@" | ||
4182 | 4163 | ;; | ||
4183 | 4164 | esac | ||
4184 | 4165 | |||
4185 | 4166 | case $prev in | ||
4186 | 4167 | dlfiles|dlprefiles) | ||
4187 | 4168 | if test "$preload" = no; then | ||
4188 | 4169 | # Add the symbol object into the linking commands. | ||
4189 | 4170 | func_append compile_command " @SYMFILE@" | ||
4190 | 4171 | func_append finalize_command " @SYMFILE@" | ||
4191 | 4172 | preload=yes | ||
4192 | 4173 | fi | ||
4193 | 4174 | case $arg in | ||
4194 | 4175 | *.la | *.lo) ;; # We handle these cases below. | ||
4195 | 4176 | force) | ||
4196 | 4177 | if test "$dlself" = no; then | ||
4197 | 4178 | dlself=needless | ||
4198 | 4179 | export_dynamic=yes | ||
4199 | 4180 | fi | ||
4200 | 4181 | prev= | ||
4201 | 4182 | continue | ||
4202 | 4183 | ;; | ||
4203 | 4184 | self) | ||
4204 | 4185 | if test "$prev" = dlprefiles; then | ||
4205 | 4186 | dlself=yes | ||
4206 | 4187 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then | ||
4207 | 4188 | dlself=yes | ||
4208 | 4189 | else | ||
4209 | 4190 | dlself=needless | ||
4210 | 4191 | export_dynamic=yes | ||
4211 | 4192 | fi | ||
4212 | 4193 | prev= | ||
4213 | 4194 | continue | ||
4214 | 4195 | ;; | ||
4215 | 4196 | *) | ||
4216 | 4197 | if test "$prev" = dlfiles; then | ||
4217 | 4198 | dlfiles="$dlfiles $arg" | ||
4218 | 4199 | else | ||
4219 | 4200 | dlprefiles="$dlprefiles $arg" | ||
4220 | 4201 | fi | ||
4221 | 4202 | prev= | ||
4222 | 4203 | continue | ||
4223 | 4204 | ;; | ||
4224 | 4205 | esac | ||
4225 | 4206 | ;; | ||
4226 | 4207 | expsyms) | ||
4227 | 4208 | export_symbols="$arg" | ||
4228 | 4209 | test -f "$arg" \ | ||
4229 | 4210 | || func_fatal_error "symbol file \`$arg' does not exist" | ||
4230 | 4211 | prev= | ||
4231 | 4212 | continue | ||
4232 | 4213 | ;; | ||
4233 | 4214 | expsyms_regex) | ||
4234 | 4215 | export_symbols_regex="$arg" | ||
4235 | 4216 | prev= | ||
4236 | 4217 | continue | ||
4237 | 4218 | ;; | ||
4238 | 4219 | framework) | ||
4239 | 4220 | case $host in | ||
4240 | 4221 | *-*-darwin*) | ||
4241 | 4222 | case "$deplibs " in | ||
4242 | 4223 | *" $qarg.ltframework "*) ;; | ||
4243 | 4224 | *) deplibs="$deplibs $qarg.ltframework" # this is fixed later | ||
4244 | 4225 | ;; | ||
4245 | 4226 | esac | ||
4246 | 4227 | ;; | ||
4247 | 4228 | esac | ||
4248 | 4229 | prev= | ||
4249 | 4230 | continue | ||
4250 | 4231 | ;; | ||
4251 | 4232 | inst_prefix) | ||
4252 | 4233 | inst_prefix_dir="$arg" | ||
4253 | 4234 | prev= | ||
4254 | 4235 | continue | ||
4255 | 4236 | ;; | ||
4256 | 4237 | objectlist) | ||
4257 | 4238 | if test -f "$arg"; then | ||
4258 | 4239 | save_arg=$arg | ||
4259 | 4240 | moreargs= | ||
4260 | 4241 | for fil in `cat "$save_arg"` | ||
4261 | 4242 | do | ||
4262 | 4243 | # moreargs="$moreargs $fil" | ||
4263 | 4244 | arg=$fil | ||
4264 | 4245 | # A libtool-controlled object. | ||
4265 | 4246 | |||
4266 | 4247 | # Check to see that this really is a libtool object. | ||
4267 | 4248 | if func_lalib_unsafe_p "$arg"; then | ||
4268 | 4249 | pic_object= | ||
4269 | 4250 | non_pic_object= | ||
4270 | 4251 | |||
4271 | 4252 | # Read the .lo file | ||
4272 | 4253 | func_source "$arg" | ||
4273 | 4254 | |||
4274 | 4255 | if test -z "$pic_object" || | ||
4275 | 4256 | test -z "$non_pic_object" || | ||
4276 | 4257 | test "$pic_object" = none && | ||
4277 | 4258 | test "$non_pic_object" = none; then | ||
4278 | 4259 | func_fatal_error "cannot find name of object for \`$arg'" | ||
4279 | 4260 | fi | ||
4280 | 4261 | |||
4281 | 4262 | # Extract subdirectory from the argument. | ||
4282 | 4263 | func_dirname "$arg" "/" "" | ||
4283 | 4264 | xdir="$func_dirname_result" | ||
4284 | 4265 | |||
4285 | 4266 | if test "$pic_object" != none; then | ||
4286 | 4267 | # Prepend the subdirectory the object is found in. | ||
4287 | 4268 | pic_object="$xdir$pic_object" | ||
4288 | 4269 | |||
4289 | 4270 | if test "$prev" = dlfiles; then | ||
4290 | 4271 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then | ||
4291 | 4272 | dlfiles="$dlfiles $pic_object" | ||
4292 | 4273 | prev= | ||
4293 | 4274 | continue | ||
4294 | 4275 | else | ||
4295 | 4276 | # If libtool objects are unsupported, then we need to preload. | ||
4296 | 4277 | prev=dlprefiles | ||
4297 | 4278 | fi | ||
4298 | 4279 | fi | ||
4299 | 4280 | |||
4300 | 4281 | # CHECK ME: I think I busted this. -Ossama | ||
4301 | 4282 | if test "$prev" = dlprefiles; then | ||
4302 | 4283 | # Preload the old-style object. | ||
4303 | 4284 | dlprefiles="$dlprefiles $pic_object" | ||
4304 | 4285 | prev= | ||
4305 | 4286 | fi | ||
4306 | 4287 | |||
4307 | 4288 | # A PIC object. | ||
4308 | 4289 | func_append libobjs " $pic_object" | ||
4309 | 4290 | arg="$pic_object" | ||
4310 | 4291 | fi | ||
4311 | 4292 | |||
4312 | 4293 | # Non-PIC object. | ||
4313 | 4294 | if test "$non_pic_object" != none; then | ||
4314 | 4295 | # Prepend the subdirectory the object is found in. | ||
4315 | 4296 | non_pic_object="$xdir$non_pic_object" | ||
4316 | 4297 | |||
4317 | 4298 | # A standard non-PIC object | ||
4318 | 4299 | func_append non_pic_objects " $non_pic_object" | ||
4319 | 4300 | if test -z "$pic_object" || test "$pic_object" = none ; then | ||
4320 | 4301 | arg="$non_pic_object" | ||
4321 | 4302 | fi | ||
4322 | 4303 | else | ||
4323 | 4304 | # If the PIC object exists, use it instead. | ||
4324 | 4305 | # $xdir was prepended to $pic_object above. | ||
4325 | 4306 | non_pic_object="$pic_object" | ||
4326 | 4307 | func_append non_pic_objects " $non_pic_object" | ||
4327 | 4308 | fi | ||
4328 | 4309 | else | ||
4329 | 4310 | # Only an error if not doing a dry-run. | ||
4330 | 4311 | if $opt_dry_run; then | ||
4331 | 4312 | # Extract subdirectory from the argument. | ||
4332 | 4313 | func_dirname "$arg" "/" "" | ||
4333 | 4314 | xdir="$func_dirname_result" | ||
4334 | 4315 | |||
4335 | 4316 | func_lo2o "$arg" | ||
4336 | 4317 | pic_object=$xdir$objdir/$func_lo2o_result | ||
4337 | 4318 | non_pic_object=$xdir$func_lo2o_result | ||
4338 | 4319 | func_append libobjs " $pic_object" | ||
4339 | 4320 | func_append non_pic_objects " $non_pic_object" | ||
4340 | 4321 | else | ||
4341 | 4322 | func_fatal_error "\`$arg' is not a valid libtool object" | ||
4342 | 4323 | fi | ||
4343 | 4324 | fi | ||
4344 | 4325 | done | ||
4345 | 4326 | else | ||
4346 | 4327 | func_fatal_error "link input file \`$arg' does not exist" | ||
4347 | 4328 | fi | ||
4348 | 4329 | arg=$save_arg | ||
4349 | 4330 | prev= | ||
4350 | 4331 | continue | ||
4351 | 4332 | ;; | ||
4352 | 4333 | precious_regex) | ||
4353 | 4334 | precious_files_regex="$arg" | ||
4354 | 4335 | prev= | ||
4355 | 4336 | continue | ||
4356 | 4337 | ;; | ||
4357 | 4338 | release) | ||
4358 | 4339 | release="-$arg" | ||
4359 | 4340 | prev= | ||
4360 | 4341 | continue | ||
4361 | 4342 | ;; | ||
4362 | 4343 | rpath | xrpath) | ||
4363 | 4344 | # We need an absolute path. | ||
4364 | 4345 | case $arg in | ||
4365 | 4346 | [\\/]* | [A-Za-z]:[\\/]*) ;; | ||
4366 | 4347 | *) | ||
4367 | 4348 | func_fatal_error "only absolute run-paths are allowed" | ||
4368 | 4349 | ;; | ||
4369 | 4350 | esac | ||
4370 | 4351 | if test "$prev" = rpath; then | ||
4371 | 4352 | case "$rpath " in | ||
4372 | 4353 | *" $arg "*) ;; | ||
4373 | 4354 | *) rpath="$rpath $arg" ;; | ||
4374 | 4355 | esac | ||
4375 | 4356 | else | ||
4376 | 4357 | case "$xrpath " in | ||
4377 | 4358 | *" $arg "*) ;; | ||
4378 | 4359 | *) xrpath="$xrpath $arg" ;; | ||
4379 | 4360 | esac | ||
4380 | 4361 | fi | ||
4381 | 4362 | prev= | ||
4382 | 4363 | continue | ||
4383 | 4364 | ;; | ||
4384 | 4365 | shrext) | ||
4385 | 4366 | shrext_cmds="$arg" | ||
4386 | 4367 | prev= | ||
4387 | 4368 | continue | ||
4388 | 4369 | ;; | ||
4389 | 4370 | weak) | ||
4390 | 4371 | weak_libs="$weak_libs $arg" | ||
4391 | 4372 | prev= | ||
4392 | 4373 | continue | ||
4393 | 4374 | ;; | ||
4394 | 4375 | xcclinker) | ||
4395 | 4376 | linker_flags="$linker_flags $qarg" | ||
4396 | 4377 | compiler_flags="$compiler_flags $qarg" | ||
4397 | 4378 | prev= | ||
4398 | 4379 | func_append compile_command " $qarg" | ||
4399 | 4380 | func_append finalize_command " $qarg" | ||
4400 | 4381 | continue | ||
4401 | 4382 | ;; | ||
4402 | 4383 | xcompiler) | ||
4403 | 4384 | compiler_flags="$compiler_flags $qarg" | ||
4404 | 4385 | prev= | ||
4405 | 4386 | func_append compile_command " $qarg" | ||
4406 | 4387 | func_append finalize_command " $qarg" | ||
4407 | 4388 | continue | ||
4408 | 4389 | ;; | ||
4409 | 4390 | xlinker) | ||
4410 | 4391 | linker_flags="$linker_flags $qarg" | ||
4411 | 4392 | compiler_flags="$compiler_flags $wl$qarg" | ||
4412 | 4393 | prev= | ||
4413 | 4394 | func_append compile_command " $wl$qarg" | ||
4414 | 4395 | func_append finalize_command " $wl$qarg" | ||
4415 | 4396 | continue | ||
4416 | 4397 | ;; | ||
4417 | 4398 | *) | ||
4418 | 4399 | eval "$prev=\"\$arg\"" | ||
4419 | 4400 | prev= | ||
4420 | 4401 | continue | ||
4421 | 4402 | ;; | ||
4422 | 4403 | esac | ||
4423 | 4404 | fi # test -n "$prev" | ||
4424 | 4405 | |||
4425 | 4406 | prevarg="$arg" | ||
4426 | 4407 | |||
4427 | 4408 | case $arg in | ||
4428 | 4409 | -all-static) | ||
4429 | 4410 | if test -n "$link_static_flag"; then | ||
4430 | 4411 | # See comment for -static flag below, for more details. | ||
4431 | 4412 | func_append compile_command " $link_static_flag" | ||
4432 | 4413 | func_append finalize_command " $link_static_flag" | ||
4433 | 4414 | fi | ||
4434 | 4415 | continue | ||
4435 | 4416 | ;; | ||
4436 | 4417 | |||
4437 | 4418 | -allow-undefined) | ||
4438 | 4419 | # FIXME: remove this flag sometime in the future. | ||
4439 | 4420 | func_fatal_error "\`-allow-undefined' must not be used because it is the default" | ||
4440 | 4421 | ;; | ||
4441 | 4422 | |||
4442 | 4423 | -avoid-version) | ||
4443 | 4424 | avoid_version=yes | ||
4444 | 4425 | continue | ||
4445 | 4426 | ;; | ||
4446 | 4427 | |||
4447 | 4428 | -dlopen) | ||
4448 | 4429 | prev=dlfiles | ||
4449 | 4430 | continue | ||
4450 | 4431 | ;; | ||
4451 | 4432 | |||
4452 | 4433 | -dlpreopen) | ||
4453 | 4434 | prev=dlprefiles | ||
4454 | 4435 | continue | ||
4455 | 4436 | ;; | ||
4456 | 4437 | |||
4457 | 4438 | -export-dynamic) | ||
4458 | 4439 | export_dynamic=yes | ||
4459 | 4440 | continue | ||
4460 | 4441 | ;; | ||
4461 | 4442 | |||
4462 | 4443 | -export-symbols | -export-symbols-regex) | ||
4463 | 4444 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then | ||
4464 | 4445 | func_fatal_error "more than one -exported-symbols argument is not allowed" | ||
4465 | 4446 | fi | ||
4466 | 4447 | if test "X$arg" = "X-export-symbols"; then | ||
4467 | 4448 | prev=expsyms | ||
4468 | 4449 | else | ||
4469 | 4450 | prev=expsyms_regex | ||
4470 | 4451 | fi | ||
4471 | 4452 | continue | ||
4472 | 4453 | ;; | ||
4473 | 4454 | |||
4474 | 4455 | -framework) | ||
4475 | 4456 | prev=framework | ||
4476 | 4457 | continue | ||
4477 | 4458 | ;; | ||
4478 | 4459 | |||
4479 | 4460 | -inst-prefix-dir) | ||
4480 | 4461 | prev=inst_prefix | ||
4481 | 4462 | continue | ||
4482 | 4463 | ;; | ||
4483 | 4464 | |||
4484 | 4465 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* | ||
4485 | 4466 | # so, if we see these flags be careful not to treat them like -L | ||
4486 | 4467 | -L[A-Z][A-Z]*:*) | ||
4487 | 4468 | case $with_gcc/$host in | ||
4488 | 4469 | no/*-*-irix* | /*-*-irix*) | ||
4489 | 4470 | func_append compile_command " $arg" | ||
4490 | 4471 | func_append finalize_command " $arg" | ||
4491 | 4472 | ;; | ||
4492 | 4473 | esac | ||
4493 | 4474 | continue | ||
4494 | 4475 | ;; | ||
4495 | 4476 | |||
4496 | 4477 | -L*) | ||
4497 | 4478 | func_stripname '-L' '' "$arg" | ||
4498 | 4479 | dir=$func_stripname_result | ||
4499 | 4480 | if test -z "$dir"; then | ||
4500 | 4481 | if test "$#" -gt 0; then | ||
4501 | 4482 | func_fatal_error "require no space between \`-L' and \`$1'" | ||
4502 | 4483 | else | ||
4503 | 4484 | func_fatal_error "need path for \`-L' option" | ||
4504 | 4485 | fi | ||
4505 | 4486 | fi | ||
4506 | 4487 | # We need an absolute path. | ||
4507 | 4488 | case $dir in | ||
4508 | 4489 | [\\/]* | [A-Za-z]:[\\/]*) ;; | ||
4509 | 4490 | *) | ||
4510 | 4491 | absdir=`cd "$dir" && pwd` | ||
4511 | 4492 | test -z "$absdir" && \ | ||
4512 | 4493 | func_fatal_error "cannot determine absolute directory name of \`$dir'" | ||
4513 | 4494 | dir="$absdir" | ||
4514 | 4495 | ;; | ||
4515 | 4496 | esac | ||
4516 | 4497 | case "$deplibs " in | ||
4517 | 4498 | *" -L$dir "*) ;; | ||
4518 | 4499 | *) | ||
4519 | 4500 | deplibs="$deplibs -L$dir" | ||
4520 | 4501 | lib_search_path="$lib_search_path $dir" | ||
4521 | 4502 | ;; | ||
4522 | 4503 | esac | ||
4523 | 4504 | case $host in | ||
4524 | 4505 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) | ||
4525 | 4506 | testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` | ||
4526 | 4507 | case :$dllsearchpath: in | ||
4527 | 4508 | *":$dir:"*) ;; | ||
4528 | 4509 | ::) dllsearchpath=$dir;; | ||
4529 | 4510 | *) dllsearchpath="$dllsearchpath:$dir";; | ||
4530 | 4511 | esac | ||
4531 | 4512 | case :$dllsearchpath: in | ||
4532 | 4513 | *":$testbindir:"*) ;; | ||
4533 | 4514 | ::) dllsearchpath=$testbindir;; | ||
4534 | 4515 | *) dllsearchpath="$dllsearchpath:$testbindir";; | ||
4535 | 4516 | esac | ||
4536 | 4517 | ;; | ||
4537 | 4518 | esac | ||
4538 | 4519 | continue | ||
4539 | 4520 | ;; | ||
4540 | 4521 | |||
4541 | 4522 | -l*) | ||
4542 | 4523 | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then | ||
4543 | 4524 | case $host in | ||
4544 | 4525 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) | ||
4545 | 4526 | # These systems don't actually have a C or math library (as such) | ||
4546 | 4527 | continue | ||
4547 | 4528 | ;; | ||
4548 | 4529 | *-*-os2*) | ||
4549 | 4530 | # These systems don't actually have a C library (as such) | ||
4550 | 4531 | test "X$arg" = "X-lc" && continue | ||
4551 | 4532 | ;; | ||
4552 | 4533 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) | ||
4553 | 4534 | # Do not include libc due to us having libc/libc_r. | ||
4554 | 4535 | test "X$arg" = "X-lc" && continue | ||
4555 | 4536 | ;; | ||
4556 | 4537 | *-*-rhapsody* | *-*-darwin1.[012]) | ||
4557 | 4538 | # Rhapsody C and math libraries are in the System framework | ||
4558 | 4539 | deplibs="$deplibs System.ltframework" | ||
4559 | 4540 | continue | ||
4560 | 4541 | ;; | ||
4561 | 4542 | *-*-sco3.2v5* | *-*-sco5v6*) | ||
4562 | 4543 | # Causes problems with __ctype | ||
4563 | 4544 | test "X$arg" = "X-lc" && continue | ||
4564 | 4545 | ;; | ||
4565 | 4546 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) | ||
4566 | 4547 | # Compiler inserts libc in the correct place for threads to work | ||
4567 | 4548 | test "X$arg" = "X-lc" && continue | ||
4568 | 4549 | ;; | ||
4569 | 4550 | esac | ||
4570 | 4551 | elif test "X$arg" = "X-lc_r"; then | ||
4571 | 4552 | case $host in | ||
4572 | 4553 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) | ||
4573 | 4554 | # Do not include libc_r directly, use -pthread flag. | ||
4574 | 4555 | continue | ||
4575 | 4556 | ;; | ||
4576 | 4557 | esac | ||
4577 | 4558 | fi | ||
4578 | 4559 | deplibs="$deplibs $arg" | ||
4579 | 4560 | continue | ||
4580 | 4561 | ;; | ||
4581 | 4562 | |||
4582 | 4563 | -module) | ||
4583 | 4564 | module=yes | ||
4584 | 4565 | continue | ||
4585 | 4566 | ;; | ||
4586 | 4567 | |||
4587 | 4568 | # Tru64 UNIX uses -model [arg] to determine the layout of C++ | ||
4588 | 4569 | # classes, name mangling, and exception handling. | ||
4589 | 4570 | # Darwin uses the -arch flag to determine output architecture. | ||
4590 | 4571 | -model|-arch|-isysroot) | ||
4591 | 4572 | compiler_flags="$compiler_flags $arg" | ||
4592 | 4573 | func_append compile_command " $arg" | ||
4593 | 4574 | func_append finalize_command " $arg" | ||
4594 | 4575 | prev=xcompiler | ||
4595 | 4576 | continue | ||
4596 | 4577 | ;; | ||
4597 | 4578 | |||
4598 | 4579 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) | ||
4599 | 4580 | compiler_flags="$compiler_flags $arg" | ||
4600 | 4581 | func_append compile_command " $arg" | ||
4601 | 4582 | func_append finalize_command " $arg" | ||
4602 | 4583 | case "$new_inherited_linker_flags " in | ||
4603 | 4584 | *" $arg "*) ;; | ||
4604 | 4585 | * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; | ||
4605 | 4586 | esac | ||
4606 | 4587 | continue | ||
4607 | 4588 | ;; | ||
4608 | 4589 | |||
4609 | 4590 | -multi_module) | ||
4610 | 4591 | single_module="${wl}-multi_module" | ||
4611 | 4592 | continue | ||
4612 | 4593 | ;; | ||
4613 | 4594 | |||
4614 | 4595 | -no-fast-install) | ||
4615 | 4596 | fast_install=no | ||
4616 | 4597 | continue | ||
4617 | 4598 | ;; | ||
4618 | 4599 | |||
4619 | 4600 | -no-install) | ||
4620 | 4601 | case $host in | ||
4621 | 4602 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) | ||
4622 | 4603 | # The PATH hackery in wrapper scripts is required on Windows | ||
4623 | 4604 | # and Darwin in order for the loader to find any dlls it needs. | ||
4624 | 4605 | func_warning "\`-no-install' is ignored for $host" | ||
4625 | 4606 | func_warning "assuming \`-no-fast-install' instead" | ||
4626 | 4607 | fast_install=no | ||
4627 | 4608 | ;; | ||
4628 | 4609 | *) no_install=yes ;; | ||
4629 | 4610 | esac | ||
4630 | 4611 | continue | ||
4631 | 4612 | ;; | ||
4632 | 4613 | |||
4633 | 4614 | -no-undefined) | ||
4634 | 4615 | allow_undefined=no | ||
4635 | 4616 | continue | ||
4636 | 4617 | ;; | ||
4637 | 4618 | |||
4638 | 4619 | -objectlist) | ||
4639 | 4620 | prev=objectlist | ||
4640 | 4621 | continue | ||
4641 | 4622 | ;; | ||
4642 | 4623 | |||
4643 | 4624 | -o) prev=output ;; | ||
4644 | 4625 | |||
4645 | 4626 | -precious-files-regex) | ||
4646 | 4627 | prev=precious_regex | ||
4647 | 4628 | continue | ||
4648 | 4629 | ;; | ||
4649 | 4630 | |||
4650 | 4631 | -release) | ||
4651 | 4632 | prev=release | ||
4652 | 4633 | continue | ||
4653 | 4634 | ;; | ||
4654 | 4635 | |||
4655 | 4636 | -rpath) | ||
4656 | 4637 | prev=rpath | ||
4657 | 4638 | continue | ||
4658 | 4639 | ;; | ||
4659 | 4640 | |||
4660 | 4641 | -R) | ||
4661 | 4642 | prev=xrpath | ||
4662 | 4643 | continue | ||
4663 | 4644 | ;; | ||
4664 | 4645 | |||
4665 | 4646 | -R*) | ||
4666 | 4647 | func_stripname '-R' '' "$arg" | ||
4667 | 4648 | dir=$func_stripname_result | ||
4668 | 4649 | # We need an absolute path. | ||
4669 | 4650 | case $dir in | ||
4670 | 4651 | [\\/]* | [A-Za-z]:[\\/]*) ;; | ||
4671 | 4652 | *) | ||
4672 | 4653 | func_fatal_error "only absolute run-paths are allowed" | ||
4673 | 4654 | ;; | ||
4674 | 4655 | esac | ||
4675 | 4656 | case "$xrpath " in | ||
4676 | 4657 | *" $dir "*) ;; | ||
4677 | 4658 | *) xrpath="$xrpath $dir" ;; | ||
4678 | 4659 | esac | ||
4679 | 4660 | continue | ||
4680 | 4661 | ;; | ||
4681 | 4662 | |||
4682 | 4663 | -shared) | ||
4683 | 4664 | # The effects of -shared are defined in a previous loop. | ||
4684 | 4665 | continue | ||
4685 | 4666 | ;; | ||
4686 | 4667 | |||
4687 | 4668 | -shrext) | ||
4688 | 4669 | prev=shrext | ||
4689 | 4670 | continue | ||
4690 | 4671 | ;; | ||
4691 | 4672 | |||
4692 | 4673 | -static | -static-libtool-libs) | ||
4693 | 4674 | # The effects of -static are defined in a previous loop. | ||
4694 | 4675 | # We used to do the same as -all-static on platforms that | ||
4695 | 4676 | # didn't have a PIC flag, but the assumption that the effects | ||
4696 | 4677 | # would be equivalent was wrong. It would break on at least | ||
4697 | 4678 | # Digital Unix and AIX. | ||
4698 | 4679 | continue | ||
4699 | 4680 | ;; | ||
4700 | 4681 | |||
4701 | 4682 | -thread-safe) | ||
4702 | 4683 | thread_safe=yes | ||
4703 | 4684 | continue | ||
4704 | 4685 | ;; | ||
4705 | 4686 | |||
4706 | 4687 | -version-info) | ||
4707 | 4688 | prev=vinfo | ||
4708 | 4689 | continue | ||
4709 | 4690 | ;; | ||
4710 | 4691 | |||
4711 | 4692 | -version-number) | ||
4712 | 4693 | prev=vinfo | ||
4713 | 4694 | vinfo_number=yes | ||
4714 | 4695 | continue | ||
4715 | 4696 | ;; | ||
4716 | 4697 | |||
4717 | 4698 | -weak) | ||
4718 | 4699 | prev=weak | ||
4719 | 4700 | continue | ||
4720 | 4701 | ;; | ||
4721 | 4702 | |||
4722 | 4703 | -Wc,*) | ||
4723 | 4704 | func_stripname '-Wc,' '' "$arg" | ||
4724 | 4705 | args=$func_stripname_result | ||
4725 | 4706 | arg= | ||
4726 | 4707 | save_ifs="$IFS"; IFS=',' | ||
4727 | 4708 | for flag in $args; do | ||
4728 | 4709 | IFS="$save_ifs" | ||
4729 | 4710 | func_quote_for_eval "$flag" | ||
4730 | 4711 | arg="$arg $wl$func_quote_for_eval_result" | ||
4731 | 4712 | compiler_flags="$compiler_flags $func_quote_for_eval_result" | ||
4732 | 4713 | done | ||
4733 | 4714 | IFS="$save_ifs" | ||
4734 | 4715 | func_stripname ' ' '' "$arg" | ||
4735 | 4716 | arg=$func_stripname_result | ||
4736 | 4717 | ;; | ||
4737 | 4718 | |||
4738 | 4719 | -Wl,*) | ||
4739 | 4720 | func_stripname '-Wl,' '' "$arg" | ||
4740 | 4721 | args=$func_stripname_result | ||
4741 | 4722 | arg= | ||
4742 | 4723 | save_ifs="$IFS"; IFS=',' | ||
4743 | 4724 | for flag in $args; do | ||
4744 | 4725 | IFS="$save_ifs" | ||
4745 | 4726 | func_quote_for_eval "$flag" | ||
4746 | 4727 | arg="$arg $wl$func_quote_for_eval_result" | ||
4747 | 4728 | compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" | ||
4748 | 4729 | linker_flags="$linker_flags $func_quote_for_eval_result" | ||
4749 | 4730 | done | ||
4750 | 4731 | IFS="$save_ifs" | ||
4751 | 4732 | func_stripname ' ' '' "$arg" | ||
4752 | 4733 | arg=$func_stripname_result | ||
4753 | 4734 | ;; | ||
4754 | 4735 | |||
4755 | 4736 | -Xcompiler) | ||
4756 | 4737 | prev=xcompiler | ||
4757 | 4738 | continue | ||
4758 | 4739 | ;; | ||
4759 | 4740 | |||
4760 | 4741 | -Xlinker) | ||
4761 | 4742 | prev=xlinker | ||
4762 | 4743 | continue | ||
4763 | 4744 | ;; | ||
4764 | 4745 | |||
4765 | 4746 | -XCClinker) | ||
4766 | 4747 | prev=xcclinker | ||
4767 | 4748 | continue | ||
4768 | 4749 | ;; | ||
4769 | 4750 | |||
4770 | 4751 | # -msg_* for osf cc | ||
4771 | 4752 | -msg_*) | ||
4772 | 4753 | func_quote_for_eval "$arg" | ||
4773 | 4754 | arg="$func_quote_for_eval_result" | ||
4774 | 4755 | ;; | ||
4775 | 4756 | |||
4776 | 4757 | # -64, -mips[0-9] enable 64-bit mode on the SGI compiler | ||
4777 | 4758 | # -r[0-9][0-9]* specifies the processor on the SGI compiler | ||
4778 | 4759 | # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler | ||
4779 | 4760 | # +DA*, +DD* enable 64-bit mode on the HP compiler | ||
4780 | 4761 | # -q* pass through compiler args for the IBM compiler | ||
4781 | 4762 | # -m*, -t[45]*, -txscale* pass through architecture-specific | ||
4782 | 4763 | # compiler args for GCC | ||
4783 | 4764 | # -F/path gives path to uninstalled frameworks, gcc on darwin | ||
4784 | 4765 | # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC | ||
4785 | 4766 | # @file GCC response files | ||
4786 | 4767 | -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ | ||
4787 | 4768 | -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) | ||
4788 | 4769 | func_quote_for_eval "$arg" | ||
4789 | 4770 | arg="$func_quote_for_eval_result" | ||
4790 | 4771 | func_append compile_command " $arg" | ||
4791 | 4772 | func_append finalize_command " $arg" | ||
4792 | 4773 | compiler_flags="$compiler_flags $arg" | ||
4793 | 4774 | continue | ||
4794 | 4775 | ;; | ||
4795 | 4776 | |||
4796 | 4777 | # Some other compiler flag. | ||
4797 | 4778 | -* | +*) | ||
4798 | 4779 | func_quote_for_eval "$arg" | ||
4799 | 4780 | arg="$func_quote_for_eval_result" | ||
4800 | 4781 | ;; | ||
4801 | 4782 | |||
4802 | 4783 | *.$objext) | ||
4803 | 4784 | # A standard object. | ||
4804 | 4785 | objs="$objs $arg" | ||
4805 | 4786 | ;; | ||
4806 | 4787 | |||
4807 | 4788 | *.lo) | ||
4808 | 4789 | # A libtool-controlled object. | ||
4809 | 4790 | |||
4810 | 4791 | # Check to see that this really is a libtool object. | ||
4811 | 4792 | if func_lalib_unsafe_p "$arg"; then | ||
4812 | 4793 | pic_object= | ||
4813 | 4794 | non_pic_object= | ||
4814 | 4795 | |||
4815 | 4796 | # Read the .lo file | ||
4816 | 4797 | func_source "$arg" | ||
4817 | 4798 | |||
4818 | 4799 | if test -z "$pic_object" || | ||
4819 | 4800 | test -z "$non_pic_object" || | ||
4820 | 4801 | test "$pic_object" = none && | ||
4821 | 4802 | test "$non_pic_object" = none; then | ||
4822 | 4803 | func_fatal_error "cannot find name of object for \`$arg'" | ||
4823 | 4804 | fi | ||
4824 | 4805 | |||
4825 | 4806 | # Extract subdirectory from the argument. | ||
4826 | 4807 | func_dirname "$arg" "/" "" | ||
4827 | 4808 | xdir="$func_dirname_result" | ||
4828 | 4809 | |||
4829 | 4810 | if test "$pic_object" != none; then | ||
4830 | 4811 | # Prepend the subdirectory the object is found in. | ||
4831 | 4812 | pic_object="$xdir$pic_object" | ||
4832 | 4813 | |||
4833 | 4814 | if test "$prev" = dlfiles; then | ||
4834 | 4815 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then | ||
4835 | 4816 | dlfiles="$dlfiles $pic_object" | ||
4836 | 4817 | prev= | ||
4837 | 4818 | continue | ||
4838 | 4819 | else | ||
4839 | 4820 | # If libtool objects are unsupported, then we need to preload. | ||
4840 | 4821 | prev=dlprefiles | ||
4841 | 4822 | fi | ||
4842 | 4823 | fi | ||
4843 | 4824 | |||
4844 | 4825 | # CHECK ME: I think I busted this. -Ossama | ||
4845 | 4826 | if test "$prev" = dlprefiles; then | ||
4846 | 4827 | # Preload the old-style object. | ||
4847 | 4828 | dlprefiles="$dlprefiles $pic_object" | ||
4848 | 4829 | prev= | ||
4849 | 4830 | fi | ||
4850 | 4831 | |||
4851 | 4832 | # A PIC object. | ||
4852 | 4833 | func_append libobjs " $pic_object" | ||
4853 | 4834 | arg="$pic_object" | ||
4854 | 4835 | fi | ||
4855 | 4836 | |||
4856 | 4837 | # Non-PIC object. | ||
4857 | 4838 | if test "$non_pic_object" != none; then | ||
4858 | 4839 | # Prepend the subdirectory the object is found in. | ||
4859 | 4840 | non_pic_object="$xdir$non_pic_object" | ||
4860 | 4841 | |||
4861 | 4842 | # A standard non-PIC object | ||
4862 | 4843 | func_append non_pic_objects " $non_pic_object" | ||
4863 | 4844 | if test -z "$pic_object" || test "$pic_object" = none ; then | ||
4864 | 4845 | arg="$non_pic_object" | ||
4865 | 4846 | fi | ||
4866 | 4847 | else | ||
4867 | 4848 | # If the PIC object exists, use it instead. | ||
4868 | 4849 | # $xdir was prepended to $pic_object above. | ||
4869 | 4850 | non_pic_object="$pic_object" | ||
4870 | 4851 | func_append non_pic_objects " $non_pic_object" | ||
4871 | 4852 | fi | ||
4872 | 4853 | else | ||
4873 | 4854 | # Only an error if not doing a dry-run. | ||
4874 | 4855 | if $opt_dry_run; then | ||
4875 | 4856 | # Extract subdirectory from the argument. | ||
4876 | 4857 | func_dirname "$arg" "/" "" | ||
4877 | 4858 | xdir="$func_dirname_result" | ||
4878 | 4859 | |||
4879 | 4860 | func_lo2o "$arg" | ||
4880 | 4861 | pic_object=$xdir$objdir/$func_lo2o_result | ||
4881 | 4862 | non_pic_object=$xdir$func_lo2o_result | ||
4882 | 4863 | func_append libobjs " $pic_object" | ||
4883 | 4864 | func_append non_pic_objects " $non_pic_object" | ||
4884 | 4865 | else | ||
4885 | 4866 | func_fatal_error "\`$arg' is not a valid libtool object" | ||
4886 | 4867 | fi | ||
4887 | 4868 | fi | ||
4888 | 4869 | ;; | ||
4889 | 4870 | |||
4890 | 4871 | *.$libext) | ||
4891 | 4872 | # An archive. | ||
4892 | 4873 | deplibs="$deplibs $arg" | ||
4893 | 4874 | old_deplibs="$old_deplibs $arg" | ||
4894 | 4875 | continue | ||
4895 | 4876 | ;; | ||
4896 | 4877 | |||
4897 | 4878 | *.la) | ||
4898 | 4879 | # A libtool-controlled library. | ||
4899 | 4880 | |||
4900 | 4881 | if test "$prev" = dlfiles; then | ||
4901 | 4882 | # This library was specified with -dlopen. | ||
4902 | 4883 | dlfiles="$dlfiles $arg" | ||
4903 | 4884 | prev= | ||
4904 | 4885 | elif test "$prev" = dlprefiles; then | ||
4905 | 4886 | # The library was specified with -dlpreopen. | ||
4906 | 4887 | dlprefiles="$dlprefiles $arg" | ||
4907 | 4888 | prev= | ||
4908 | 4889 | else | ||
4909 | 4890 | deplibs="$deplibs $arg" | ||
4910 | 4891 | fi | ||
4911 | 4892 | continue | ||
4912 | 4893 | ;; | ||
4913 | 4894 | |||
4914 | 4895 | # Some other compiler argument. | ||
4915 | 4896 | *) | ||
4916 | 4897 | # Unknown arguments in both finalize_command and compile_command need | ||
4917 | 4898 | # to be aesthetically quoted because they are evaled later. | ||
4918 | 4899 | func_quote_for_eval "$arg" | ||
4919 | 4900 | arg="$func_quote_for_eval_result" | ||
4920 | 4901 | ;; | ||
4921 | 4902 | esac # arg | ||
4922 | 4903 | |||
4923 | 4904 | # Now actually substitute the argument into the commands. | ||
4924 | 4905 | if test -n "$arg"; then | ||
4925 | 4906 | func_append compile_command " $arg" | ||
4926 | 4907 | func_append finalize_command " $arg" | ||
4927 | 4908 | fi | ||
4928 | 4909 | done # argument parsing loop | ||
4929 | 4910 | |||
4930 | 4911 | test -n "$prev" && \ | ||
4931 | 4912 | func_fatal_help "the \`$prevarg' option requires an argument" | ||
4932 | 4913 | |||
4933 | 4914 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then | ||
4934 | 4915 | eval arg=\"$export_dynamic_flag_spec\" | ||
4935 | 4916 | func_append compile_command " $arg" | ||
4936 | 4917 | func_append finalize_command " $arg" | ||
4937 | 4918 | fi | ||
4938 | 4919 | |||
4939 | 4920 | oldlibs= | ||
4940 | 4921 | # calculate the name of the file, without its directory | ||
4941 | 4922 | func_basename "$output" | ||
4942 | 4923 | outputname="$func_basename_result" | ||
4943 | 4924 | libobjs_save="$libobjs" | ||
4944 | 4925 | |||
4945 | 4926 | if test -n "$shlibpath_var"; then | ||
4946 | 4927 | # get the directories listed in $shlibpath_var | ||
4947 | 4928 | eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` | ||
4948 | 4929 | else | ||
4949 | 4930 | shlib_search_path= | ||
4950 | 4931 | fi | ||
4951 | 4932 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" | ||
4952 | 4933 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" | ||
4953 | 4934 | |||
4954 | 4935 | func_dirname "$output" "/" "" | ||
4955 | 4936 | output_objdir="$func_dirname_result$objdir" | ||
4956 | 4937 | # Create the object directory. | ||
4957 | 4938 | func_mkdir_p "$output_objdir" | ||
4958 | 4939 | |||
4959 | 4940 | # Determine the type of output | ||
4960 | 4941 | case $output in | ||
4961 | 4942 | "") | ||
4962 | 4943 | func_fatal_help "you must specify an output file" | ||
4963 | 4944 | ;; | ||
4964 | 4945 | *.$libext) linkmode=oldlib ;; | ||
4965 | 4946 | *.lo | *.$objext) linkmode=obj ;; | ||
4966 | 4947 | *.la) linkmode=lib ;; | ||
4967 | 4948 | *) linkmode=prog ;; # Anything else should be a program. | ||
4968 | 4949 | esac | ||
4969 | 4950 | |||
4970 | 4951 | specialdeplibs= | ||
4971 | 4952 | |||
4972 | 4953 | libs= | ||
4973 | 4954 | # Find all interdependent deplibs by searching for libraries | ||
4974 | 4955 | # that are linked more than once (e.g. -la -lb -la) | ||
4975 | 4956 | for deplib in $deplibs; do | ||
4976 | 4957 | if $opt_duplicate_deps ; then | ||
4977 | 4958 | case "$libs " in | ||
4978 | 4959 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | ||
4979 | 4960 | esac | ||
4980 | 4961 | fi | ||
4981 | 4962 | libs="$libs $deplib" | ||
4982 | 4963 | done | ||
4983 | 4964 | |||
4984 | 4965 | if test "$linkmode" = lib; then | ||
4985 | 4966 | libs="$predeps $libs $compiler_lib_search_path $postdeps" | ||
4986 | 4967 | |||
4987 | 4968 | # Compute libraries that are listed more than once in $predeps | ||
4988 | 4969 | # $postdeps and mark them as special (i.e., whose duplicates are | ||
4989 | 4970 | # not to be eliminated). | ||
4990 | 4971 | pre_post_deps= | ||
4991 | 4972 | if $opt_duplicate_compiler_generated_deps; then | ||
4992 | 4973 | for pre_post_dep in $predeps $postdeps; do | ||
4993 | 4974 | case "$pre_post_deps " in | ||
4994 | 4975 | *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; | ||
4995 | 4976 | esac | ||
4996 | 4977 | pre_post_deps="$pre_post_deps $pre_post_dep" | ||
4997 | 4978 | done | ||
4998 | 4979 | fi | ||
4999 | 4980 | pre_post_deps= | ||
5000 | 4981 | fi |
No significant extra content or history; the .pc discrepancies are due to slightly overenthusiastic 'bzr add' in the manual branch (the importer never adds dotfiles under .pc, for whatever reason). Rejecting.