Parent Directory
|
Revision Log
- fixed some configure mess and imported latest libtool sources
1 | michael | 945 | # Generated from ltmain.m4sh. |
2 | |||
3 | # ltmain.sh (GNU libtool) 2.2.6 | ||
4 | # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 | ||
5 | |||
6 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. | ||
7 | # This is free software; see the source for copying conditions. There is NO | ||
8 | # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
9 | |||
10 | # GNU Libtool is free software; you can redistribute it and/or modify | ||
11 | michael | 912 | # it under the terms of the GNU General Public License as published by |
12 | # the Free Software Foundation; either version 2 of the License, or | ||
13 | # (at your option) any later version. | ||
14 | # | ||
15 | michael | 945 | # As a special exception to the GNU General Public License, |
16 | # if you distribute this file as part of a program or library that | ||
17 | # is built using GNU Libtool, you may include this file under the | ||
18 | # same distribution terms that you use for the rest of that program. | ||
19 | # | ||
20 | # GNU Libtool is distributed in the hope that it will be useful, but | ||
21 | michael | 912 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
23 | # General Public License for more details. | ||
24 | # | ||
25 | # You should have received a copy of the GNU General Public License | ||
26 | michael | 945 | # along with GNU Libtool; see the file COPYING. If not, a copy |
27 | # can be downloaded from http://www.gnu.org/licenses/gpl.html, | ||
28 | # or obtained by writing to the Free Software Foundation, Inc., | ||
29 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
30 | |||
31 | # Usage: $progname [OPTION]... [MODE-ARG]... | ||
32 | michael | 912 | # |
33 | michael | 945 | # Provide generalized library-building support services. |
34 | # | ||
35 | # --config show all configuration variables | ||
36 | # --debug enable verbose shell tracing | ||
37 | # -n, --dry-run display commands without modifying any files | ||
38 | # --features display basic configuration information and exit | ||
39 | # --mode=MODE use operation mode MODE | ||
40 | # --preserve-dup-deps don't remove duplicate dependency libraries | ||
41 | # --quiet, --silent don't print informational messages | ||
42 | # --tag=TAG use configuration variables from tag TAG | ||
43 | # -v, --verbose print informational messages (default) | ||
44 | # --version print version information | ||
45 | # -h, --help print short or long help message | ||
46 | # | ||
47 | # MODE must be one of the following: | ||
48 | # | ||
49 | # clean remove files from the build directory | ||
50 | # compile compile a source file into a libtool object | ||
51 | # execute automatically set library path, then run a program | ||
52 | # finish complete the installation of libtool libraries | ||
53 | # install install libraries or executables | ||
54 | # link create a library or an executable | ||
55 | # uninstall remove libraries from an installed directory | ||
56 | # | ||
57 | # MODE-ARGS vary depending on the MODE. | ||
58 | # Try `$progname --help --mode=MODE' for a more detailed description of MODE. | ||
59 | # | ||
60 | # When reporting a bug, please describe a test case to reproduce it and | ||
61 | # include the following information: | ||
62 | # | ||
63 | # host-triplet: $host | ||
64 | # shell: $SHELL | ||
65 | # compiler: $LTCC | ||
66 | # compiler flags: $LTCFLAGS | ||
67 | # linker: $LD (gnu? $with_gnu_ld) | ||
68 | # $progname: (GNU libtool) 2.2.6 | ||
69 | # automake: $automake_version | ||
70 | # autoconf: $autoconf_version | ||
71 | # | ||
72 | # Report bugs to <bug-libtool@gnu.org>. | ||
73 | michael | 912 | |
74 | PROGRAM=ltmain.sh | ||
75 | PACKAGE=libtool | ||
76 | michael | 945 | VERSION=2.2.6 |
77 | TIMESTAMP="" | ||
78 | package_revision=1.3012 | ||
79 | michael | 912 | |
80 | michael | 945 | # define SED for historic ltconfig's generated by Libtool 1.3 |
81 | test -z "$SED" && SED=sed | ||
82 | |||
83 | # Be Bourne compatible | ||
84 | michael | 912 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then |
85 | emulate sh | ||
86 | NULLCMD=: | ||
87 | # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which | ||
88 | # is contrary to our usage. Disable this feature. | ||
89 | alias -g '${1+"$@"}'='"$@"' | ||
90 | setopt NO_GLOB_SUBST | ||
91 | else | ||
92 | case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac | ||
93 | fi | ||
94 | BIN_SH=xpg4; export BIN_SH # for Tru64 | ||
95 | DUALCASE=1; export DUALCASE # for MKS sh | ||
96 | |||
97 | michael | 945 | # NLS nuisances: We save the old values to restore during execute mode. |
98 | michael | 912 | # Only set LANG and LC_ALL to C if already set. |
99 | # These must not be set unconditionally because not all systems understand | ||
100 | # e.g. LANG=C (notably SCO). | ||
101 | michael | 945 | lt_user_locale= |
102 | lt_safe_locale= | ||
103 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES | ||
104 | michael | 912 | do |
105 | eval "if test \"\${$lt_var+set}\" = set; then | ||
106 | michael | 945 | save_$lt_var=\$$lt_var |
107 | $lt_var=C | ||
108 | michael | 912 | export $lt_var |
109 | michael | 945 | lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" |
110 | lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" | ||
111 | michael | 912 | fi" |
112 | done | ||
113 | |||
114 | michael | 945 | $lt_unset CDPATH |
115 | |||
116 | |||
117 | |||
118 | |||
119 | |||
120 | : ${CP="cp -f"} | ||
121 | : ${ECHO="echo"} | ||
122 | : ${EGREP="/bin/grep -E"} | ||
123 | : ${FGREP="/bin/grep -F"} | ||
124 | : ${GREP="/bin/grep"} | ||
125 | : ${LN_S="ln -s"} | ||
126 | : ${MAKE="make"} | ||
127 | : ${MKDIR="mkdir"} | ||
128 | : ${MV="mv -f"} | ||
129 | : ${RM="rm -f"} | ||
130 | : ${SED="/bin/sed"} | ||
131 | : ${SHELL="${CONFIG_SHELL-/bin/sh}"} | ||
132 | : ${Xsed="$SED -e 1s/^X//"} | ||
133 | |||
134 | # Global variables: | ||
135 | EXIT_SUCCESS=0 | ||
136 | EXIT_FAILURE=1 | ||
137 | EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. | ||
138 | EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. | ||
139 | |||
140 | exit_status=$EXIT_SUCCESS | ||
141 | |||
142 | michael | 912 | # Make sure IFS has a sensible default |
143 | lt_nl=' | ||
144 | ' | ||
145 | IFS=" $lt_nl" | ||
146 | |||
147 | michael | 945 | dirname="s,/[^/]*$,," |
148 | basename="s,^.*/,," | ||
149 | michael | 912 | |
150 | michael | 945 | # func_dirname_and_basename file append nondir_replacement |
151 | # perform func_basename and func_dirname in a single function | ||
152 | # call: | ||
153 | # dirname: Compute the dirname of FILE. If nonempty, | ||
154 | # add APPEND to the result, otherwise set result | ||
155 | # to NONDIR_REPLACEMENT. | ||
156 | # value returned in "$func_dirname_result" | ||
157 | # basename: Compute filename of FILE. | ||
158 | # value retuned in "$func_basename_result" | ||
159 | # Implementation must be kept synchronized with func_dirname | ||
160 | # and func_basename. For efficiency, we do not delegate to | ||
161 | # those functions but instead duplicate the functionality here. | ||
162 | func_dirname_and_basename () | ||
163 | { | ||
164 | # Extract subdirectory from the argument. | ||
165 | func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` | ||
166 | if test "X$func_dirname_result" = "X${1}"; then | ||
167 | func_dirname_result="${3}" | ||
168 | else | ||
169 | func_dirname_result="$func_dirname_result${2}" | ||
170 | fi | ||
171 | func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` | ||
172 | } | ||
173 | michael | 912 | |
174 | michael | 945 | # Generated shell functions inserted here. |
175 | michael | 912 | |
176 | michael | 945 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh |
177 | # is ksh but when the shell is invoked as "sh" and the current value of | ||
178 | # the _XPG environment variable is not equal to 1 (one), the special | ||
179 | # positional parameter $0, within a function call, is the name of the | ||
180 | # function. | ||
181 | progpath="$0" | ||
182 | |||
183 | # The name of this program: | ||
184 | # In the unlikely event $progname began with a '-', it would play havoc with | ||
185 | # func_echo (imagine progname=-n), so we prepend ./ in that case: | ||
186 | func_dirname_and_basename "$progpath" | ||
187 | progname=$func_basename_result | ||
188 | case $progname in | ||
189 | -*) progname=./$progname ;; | ||
190 | esac | ||
191 | |||
192 | # Make sure we have an absolute path for reexecution: | ||
193 | case $progpath in | ||
194 | [\\/]*|[A-Za-z]:\\*) ;; | ||
195 | *[\\/]*) | ||
196 | progdir=$func_dirname_result | ||
197 | progdir=`cd "$progdir" && pwd` | ||
198 | progpath="$progdir/$progname" | ||
199 | ;; | ||
200 | *) | ||
201 | save_IFS="$IFS" | ||
202 | IFS=: | ||
203 | for progdir in $PATH; do | ||
204 | IFS="$save_IFS" | ||
205 | test -x "$progdir/$progname" && break | ||
206 | done | ||
207 | IFS="$save_IFS" | ||
208 | test -n "$progdir" || progdir=`pwd` | ||
209 | progpath="$progdir/$progname" | ||
210 | ;; | ||
211 | esac | ||
212 | |||
213 | # Sed substitution that helps us do robust quoting. It backslashifies | ||
214 | # metacharacters that are still active within double-quoted strings. | ||
215 | Xsed="${SED}"' -e 1s/^X//' | ||
216 | sed_quote_subst='s/\([`"$\\]\)/\\\1/g' | ||
217 | |||
218 | # Same as above, but do not quote variable references. | ||
219 | double_quote_subst='s/\(["`\\]\)/\\\1/g' | ||
220 | |||
221 | # Re-`\' parameter expansions in output of double_quote_subst that were | ||
222 | # `\'-ed in input to the same. If an odd number of `\' preceded a '$' | ||
223 | # in input to double_quote_subst, that '$' was protected from expansion. | ||
224 | # Since each input `\' is now two `\'s, look for any number of runs of | ||
225 | # four `\'s followed by two `\'s and then a '$'. `\' that '$'. | ||
226 | bs='\\' | ||
227 | bs2='\\\\' | ||
228 | bs4='\\\\\\\\' | ||
229 | dollar='\$' | ||
230 | sed_double_backslash="\ | ||
231 | s/$bs4/&\\ | ||
232 | /g | ||
233 | s/^$bs2$dollar/$bs&/ | ||
234 | s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g | ||
235 | s/\n//g" | ||
236 | |||
237 | # Standard options: | ||
238 | opt_dry_run=false | ||
239 | opt_help=false | ||
240 | opt_quiet=false | ||
241 | opt_verbose=false | ||
242 | opt_warning=: | ||
243 | |||
244 | # func_echo arg... | ||
245 | # Echo program name prefixed message, along with the current mode | ||
246 | # name if it has been set yet. | ||
247 | func_echo () | ||
248 | { | ||
249 | $ECHO "$progname${mode+: }$mode: $*" | ||
250 | } | ||
251 | |||
252 | # func_verbose arg... | ||
253 | # Echo program name prefixed message in verbose mode only. | ||
254 | func_verbose () | ||
255 | { | ||
256 | $opt_verbose && func_echo ${1+"$@"} | ||
257 | |||
258 | # A bug in bash halts the script if the last line of a function | ||
259 | # fails when set -e is in force, so we need another command to | ||
260 | # work around that: | ||
261 | : | ||
262 | } | ||
263 | |||
264 | # func_error arg... | ||
265 | # Echo program name prefixed message to standard error. | ||
266 | func_error () | ||
267 | { | ||
268 | $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 | ||
269 | } | ||
270 | |||
271 | # func_warning arg... | ||
272 | # Echo program name prefixed warning message to standard error. | ||
273 | func_warning () | ||
274 | { | ||
275 | $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 | ||
276 | |||
277 | # bash bug again: | ||
278 | : | ||
279 | } | ||
280 | |||
281 | # func_fatal_error arg... | ||
282 | # Echo program name prefixed message to standard error, and exit. | ||
283 | func_fatal_error () | ||
284 | { | ||
285 | func_error ${1+"$@"} | ||
286 | exit $EXIT_FAILURE | ||
287 | } | ||
288 | |||
289 | # func_fatal_help arg... | ||
290 | # Echo program name prefixed message to standard error, followed by | ||
291 | # a help hint, and exit. | ||
292 | func_fatal_help () | ||
293 | { | ||
294 | func_error ${1+"$@"} | ||
295 | func_fatal_error "$help" | ||
296 | } | ||
297 | help="Try \`$progname --help' for more information." ## default | ||
298 | |||
299 | |||
300 | # func_grep expression filename | ||
301 | # Check whether EXPRESSION matches any line of FILENAME, without output. | ||
302 | func_grep () | ||
303 | { | ||
304 | $GREP "$1" "$2" >/dev/null 2>&1 | ||
305 | } | ||
306 | |||
307 | |||
308 | # func_mkdir_p directory-path | ||
309 | # Make sure the entire path to DIRECTORY-PATH is available. | ||
310 | func_mkdir_p () | ||
311 | { | ||
312 | my_directory_path="$1" | ||
313 | my_dir_list= | ||
314 | |||
315 | if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then | ||
316 | |||
317 | # Protect directory names starting with `-' | ||
318 | case $my_directory_path in | ||
319 | -*) my_directory_path="./$my_directory_path" ;; | ||
320 | esac | ||
321 | |||
322 | # While some portion of DIR does not yet exist... | ||
323 | while test ! -d "$my_directory_path"; do | ||
324 | # ...make a list in topmost first order. Use a colon delimited | ||
325 | # list incase some portion of path contains whitespace. | ||
326 | my_dir_list="$my_directory_path:$my_dir_list" | ||
327 | |||
328 | # If the last portion added has no slash in it, the list is done | ||
329 | case $my_directory_path in */*) ;; *) break ;; esac | ||
330 | |||
331 | # ...otherwise throw away the child directory and loop | ||
332 | my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` | ||
333 | done | ||
334 | my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` | ||
335 | |||
336 | save_mkdir_p_IFS="$IFS"; IFS=':' | ||
337 | for my_dir in $my_dir_list; do | ||
338 | IFS="$save_mkdir_p_IFS" | ||
339 | # mkdir can fail with a `File exist' error if two processes | ||
340 | # try to create one of the directories concurrently. Don't | ||
341 | # stop in that case! | ||
342 | $MKDIR "$my_dir" 2>/dev/null || : | ||
343 | done | ||
344 | IFS="$save_mkdir_p_IFS" | ||
345 | |||
346 | # Bail out if we (or some other process) failed to create a directory. | ||
347 | test -d "$my_directory_path" || \ | ||
348 | func_fatal_error "Failed to create \`$1'" | ||
349 | fi | ||
350 | } | ||
351 | |||
352 | |||
353 | michael | 912 | # func_mktempdir [string] |
354 | # Make a temporary directory that won't clash with other running | ||
355 | # libtool processes, and avoids race conditions if possible. If | ||
356 | # given, STRING is the basename for that directory. | ||
357 | func_mktempdir () | ||
358 | { | ||
359 | my_template="${TMPDIR-/tmp}/${1-$progname}" | ||
360 | |||
361 | michael | 945 | if test "$opt_dry_run" = ":"; then |
362 | michael | 912 | # Return a directory name, but don't create it in dry-run mode |
363 | my_tmpdir="${my_template}-$$" | ||
364 | else | ||
365 | |||
366 | # If mktemp works, use that first and foremost | ||
367 | my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` | ||
368 | |||
369 | if test ! -d "$my_tmpdir"; then | ||
370 | michael | 945 | # Failing that, at least try and use $RANDOM to avoid a race |
371 | my_tmpdir="${my_template}-${RANDOM-0}$$" | ||
372 | michael | 912 | |
373 | michael | 945 | save_mktempdir_umask=`umask` |
374 | umask 0077 | ||
375 | $MKDIR "$my_tmpdir" | ||
376 | umask $save_mktempdir_umask | ||
377 | michael | 912 | fi |
378 | |||
379 | # If we're not in dry-run mode, bomb out on failure | ||
380 | michael | 945 | test -d "$my_tmpdir" || \ |
381 | func_fatal_error "cannot create temporary directory \`$my_tmpdir'" | ||
382 | michael | 912 | fi |
383 | |||
384 | michael | 945 | $ECHO "X$my_tmpdir" | $Xsed |
385 | michael | 912 | } |
386 | |||
387 | |||
388 | michael | 945 | # func_quote_for_eval arg |
389 | # Aesthetically quote ARG to be evaled later. | ||
390 | # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT | ||
391 | # is double-quoted, suitable for a subsequent eval, whereas | ||
392 | # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters | ||
393 | # which are still active within double quotes backslashified. | ||
394 | func_quote_for_eval () | ||
395 | michael | 912 | { |
396 | michael | 945 | case $1 in |
397 | *[\\\`\"\$]*) | ||
398 | func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; | ||
399 | *) | ||
400 | func_quote_for_eval_unquoted_result="$1" ;; | ||
401 | michael | 912 | esac |
402 | michael | 945 | |
403 | case $func_quote_for_eval_unquoted_result in | ||
404 | # Double-quote args containing shell metacharacters to delay | ||
405 | # word splitting, command substitution and and variable | ||
406 | # expansion for a subsequent eval. | ||
407 | # Many Bourne shells cannot handle close brackets correctly | ||
408 | # in scan sets, so we specify it separately. | ||
409 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
410 | func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" | ||
411 | ;; | ||
412 | *) | ||
413 | func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" | ||
414 | esac | ||
415 | michael | 912 | } |
416 | |||
417 | |||
418 | michael | 945 | # func_quote_for_expand arg |
419 | # Aesthetically quote ARG to be evaled later; same as above, | ||
420 | # but do not quote variable references. | ||
421 | func_quote_for_expand () | ||
422 | michael | 912 | { |
423 | michael | 945 | case $1 in |
424 | *[\\\`\"]*) | ||
425 | my_arg=`$ECHO "X$1" | $Xsed \ | ||
426 | -e "$double_quote_subst" -e "$sed_double_backslash"` ;; | ||
427 | michael | 912 | *) |
428 | michael | 945 | my_arg="$1" ;; |
429 | esac | ||
430 | |||
431 | case $my_arg in | ||
432 | # Double-quote args containing shell metacharacters to delay | ||
433 | # word splitting and command substitution for a subsequent eval. | ||
434 | # Many Bourne shells cannot handle close brackets correctly | ||
435 | # in scan sets, so we specify it separately. | ||
436 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
437 | my_arg="\"$my_arg\"" | ||
438 | ;; | ||
439 | esac | ||
440 | |||
441 | func_quote_for_expand_result="$my_arg" | ||
442 | michael | 912 | } |
443 | |||
444 | |||
445 | michael | 945 | # func_show_eval cmd [fail_exp] |
446 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is | ||
447 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP | ||
448 | # is given, then evaluate it. | ||
449 | func_show_eval () | ||
450 | michael | 912 | { |
451 | michael | 945 | my_cmd="$1" |
452 | my_fail_exp="${2-:}" | ||
453 | michael | 912 | |
454 | michael | 945 | ${opt_silent-false} || { |
455 | func_quote_for_expand "$my_cmd" | ||
456 | eval "func_echo $func_quote_for_expand_result" | ||
457 | } | ||
458 | |||
459 | if ${opt_dry_run-false}; then :; else | ||
460 | eval "$my_cmd" | ||
461 | my_status=$? | ||
462 | if test "$my_status" -eq 0; then :; else | ||
463 | eval "(exit $my_status); $my_fail_exp" | ||
464 | fi | ||
465 | michael | 912 | fi |
466 | } | ||
467 | |||
468 | michael | 945 | |
469 | # func_show_eval_locale cmd [fail_exp] | ||
470 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is | ||
471 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP | ||
472 | # is given, then evaluate it. Use the saved locale for evaluation. | ||
473 | func_show_eval_locale () | ||
474 | michael | 912 | { |
475 | michael | 945 | my_cmd="$1" |
476 | my_fail_exp="${2-:}" | ||
477 | michael | 912 | |
478 | michael | 945 | ${opt_silent-false} || { |
479 | func_quote_for_expand "$my_cmd" | ||
480 | eval "func_echo $func_quote_for_expand_result" | ||
481 | } | ||
482 | |||
483 | if ${opt_dry_run-false}; then :; else | ||
484 | eval "$lt_user_locale | ||
485 | $my_cmd" | ||
486 | my_status=$? | ||
487 | eval "$lt_safe_locale" | ||
488 | if test "$my_status" -eq 0; then :; else | ||
489 | eval "(exit $my_status); $my_fail_exp" | ||
490 | fi | ||
491 | michael | 912 | fi |
492 | michael | 945 | } |
493 | michael | 912 | |
494 | |||
495 | michael | 945 | |
496 | |||
497 | |||
498 | # func_version | ||
499 | # Echo version message to standard output and exit. | ||
500 | func_version () | ||
501 | { | ||
502 | $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { | ||
503 | s/^# // | ||
504 | s/^# *$// | ||
505 | s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ | ||
506 | p | ||
507 | }' < "$progpath" | ||
508 | exit $? | ||
509 | michael | 912 | } |
510 | |||
511 | michael | 945 | # func_usage |
512 | # Echo short help message to standard output and exit. | ||
513 | func_usage () | ||
514 | { | ||
515 | $SED -n '/^# Usage:/,/# -h/ { | ||
516 | s/^# // | ||
517 | s/^# *$// | ||
518 | s/\$progname/'$progname'/ | ||
519 | p | ||
520 | }' < "$progpath" | ||
521 | $ECHO | ||
522 | $ECHO "run \`$progname --help | more' for full usage" | ||
523 | exit $? | ||
524 | } | ||
525 | michael | 912 | |
526 | michael | 945 | # func_help |
527 | # Echo long help message to standard output and exit. | ||
528 | func_help () | ||
529 | { | ||
530 | $SED -n '/^# Usage:/,/# Report bugs to/ { | ||
531 | s/^# // | ||
532 | s/^# *$// | ||
533 | s*\$progname*'$progname'* | ||
534 | s*\$host*'"$host"'* | ||
535 | s*\$SHELL*'"$SHELL"'* | ||
536 | s*\$LTCC*'"$LTCC"'* | ||
537 | s*\$LTCFLAGS*'"$LTCFLAGS"'* | ||
538 | s*\$LD*'"$LD"'* | ||
539 | s/\$with_gnu_ld/'"$with_gnu_ld"'/ | ||
540 | s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ | ||
541 | s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ | ||
542 | p | ||
543 | }' < "$progpath" | ||
544 | exit $? | ||
545 | } | ||
546 | michael | 912 | |
547 | michael | 945 | # func_missing_arg argname |
548 | # Echo program name prefixed message to standard error and set global | ||
549 | # exit_cmd. | ||
550 | func_missing_arg () | ||
551 | { | ||
552 | func_error "missing argument for $1" | ||
553 | exit_cmd=exit | ||
554 | } | ||
555 | |||
556 | exit_cmd=: | ||
557 | |||
558 | |||
559 | |||
560 | |||
561 | |||
562 | # Check that we have a working $ECHO. | ||
563 | if test "X$1" = X--no-reexec; then | ||
564 | # Discard the --no-reexec flag, and continue. | ||
565 | michael | 912 | shift |
566 | michael | 945 | elif test "X$1" = X--fallback-echo; then |
567 | # Avoid inline document here, it may be left over | ||
568 | : | ||
569 | elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then | ||
570 | # Yippee, $ECHO works! | ||
571 | : | ||
572 | else | ||
573 | # Restart under the correct shell, and then maybe $ECHO will work. | ||
574 | exec $SHELL "$progpath" --no-reexec ${1+"$@"} | ||
575 | fi | ||
576 | michael | 912 | |
577 | michael | 945 | if test "X$1" = X--fallback-echo; then |
578 | # used as fallback echo | ||
579 | shift | ||
580 | cat <<EOF | ||
581 | $* | ||
582 | EOF | ||
583 | exit $EXIT_SUCCESS | ||
584 | fi | ||
585 | michael | 912 | |
586 | michael | 945 | magic="%%%MAGIC variable%%%" |
587 | magic_exe="%%%MAGIC EXE variable%%%" | ||
588 | michael | 912 | |
589 | michael | 945 | # Global variables. |
590 | # $mode is unset | ||
591 | nonopt= | ||
592 | execute_dlfiles= | ||
593 | preserve_args= | ||
594 | lo2o="s/\\.lo\$/.${objext}/" | ||
595 | o2lo="s/\\.${objext}\$/.lo/" | ||
596 | extracted_archives= | ||
597 | extracted_serial=0 | ||
598 | michael | 912 | |
599 | michael | 945 | opt_dry_run=false |
600 | opt_duplicate_deps=false | ||
601 | opt_silent=false | ||
602 | opt_debug=: | ||
603 | michael | 912 | |
604 | michael | 945 | # If this variable is set in any of the actions, the command in it |
605 | # will be execed at the end. This prevents here-documents from being | ||
606 | # left over by shells. | ||
607 | exec_cmd= | ||
608 | michael | 912 | |
609 | michael | 945 | # func_fatal_configuration arg... |
610 | # Echo program name prefixed message to standard error, followed by | ||
611 | # a configuration failure hint, and exit. | ||
612 | func_fatal_configuration () | ||
613 | { | ||
614 | func_error ${1+"$@"} | ||
615 | func_error "See the $PACKAGE documentation for more information." | ||
616 | func_fatal_error "Fatal configuration error." | ||
617 | } | ||
618 | michael | 912 | |
619 | |||
620 | michael | 945 | # func_config |
621 | # Display the configuration for all the tags in this script. | ||
622 | func_config () | ||
623 | { | ||
624 | re_begincf='^# ### BEGIN LIBTOOL' | ||
625 | re_endcf='^# ### END LIBTOOL' | ||
626 | michael | 912 | |
627 | michael | 945 | # Default configuration. |
628 | $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" | ||
629 | |||
630 | michael | 912 | # Now print the configurations for the tags. |
631 | for tagname in $taglist; do | ||
632 | michael | 945 | $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" |
633 | michael | 912 | done |
634 | michael | 945 | |
635 | michael | 912 | exit $? |
636 | michael | 945 | } |
637 | michael | 912 | |
638 | michael | 945 | # func_features |
639 | # Display the features supported by this script. | ||
640 | func_features () | ||
641 | { | ||
642 | $ECHO "host: $host" | ||
643 | michael | 912 | if test "$build_libtool_libs" = yes; then |
644 | michael | 945 | $ECHO "enable shared libraries" |
645 | michael | 912 | else |
646 | michael | 945 | $ECHO "disable shared libraries" |
647 | michael | 912 | fi |
648 | if test "$build_old_libs" = yes; then | ||
649 | michael | 945 | $ECHO "enable static libraries" |
650 | michael | 912 | else |
651 | michael | 945 | $ECHO "disable static libraries" |
652 | michael | 912 | fi |
653 | michael | 945 | |
654 | michael | 912 | exit $? |
655 | michael | 945 | } |
656 | michael | 912 | |
657 | michael | 945 | # func_enable_tag tagname |
658 | # Verify that TAGNAME is valid, and either flag an error and exit, or | ||
659 | # enable the TAGNAME tag. We also add TAGNAME to the global $taglist | ||
660 | # variable here. | ||
661 | func_enable_tag () | ||
662 | { | ||
663 | # Global variable: | ||
664 | tagname="$1" | ||
665 | michael | 912 | |
666 | michael | 945 | re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" |
667 | re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" | ||
668 | sed_extractcf="/$re_begincf/,/$re_endcf/p" | ||
669 | michael | 912 | |
670 | michael | 945 | # Validate tagname. |
671 | case $tagname in | ||
672 | *[!-_A-Za-z0-9,/]*) | ||
673 | func_fatal_error "invalid tag name: $tagname" | ||
674 | ;; | ||
675 | esac | ||
676 | michael | 912 | |
677 | michael | 945 | # Don't test for the "default" C tag, as we know it's |
678 | # there but not specially marked. | ||
679 | case $tagname in | ||
680 | CC) ;; | ||
681 | *) | ||
682 | if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then | ||
683 | taglist="$taglist $tagname" | ||
684 | michael | 912 | |
685 | michael | 945 | # Evaluate the configuration. Be careful to quote the path |
686 | # and the sed script, to avoid splitting on whitespace, but | ||
687 | # also don't use non-portable quotes within backquotes within | ||
688 | # quotes we have to do it in 2 steps: | ||
689 | extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` | ||
690 | eval "$extractedcf" | ||
691 | else | ||
692 | func_error "ignoring unknown tag $tagname" | ||
693 | fi | ||
694 | ;; | ||
695 | esac | ||
696 | } | ||
697 | |||
698 | # Parse options once, thoroughly. This comes as soon as possible in | ||
699 | # the script to make things like `libtool --version' happen quickly. | ||
700 | { | ||
701 | |||
702 | # Shorthand for --mode=foo, only valid as the first argument | ||
703 | case $1 in | ||
704 | clean|clea|cle|cl) | ||
705 | shift; set dummy --mode clean ${1+"$@"}; shift | ||
706 | michael | 912 | ;; |
707 | michael | 945 | compile|compil|compi|comp|com|co|c) |
708 | shift; set dummy --mode compile ${1+"$@"}; shift | ||
709 | michael | 912 | ;; |
710 | michael | 945 | execute|execut|execu|exec|exe|ex|e) |
711 | shift; set dummy --mode execute ${1+"$@"}; shift | ||
712 | michael | 912 | ;; |
713 | michael | 945 | finish|finis|fini|fin|fi|f) |
714 | shift; set dummy --mode finish ${1+"$@"}; shift | ||
715 | michael | 912 | ;; |
716 | michael | 945 | install|instal|insta|inst|ins|in|i) |
717 | shift; set dummy --mode install ${1+"$@"}; shift | ||
718 | michael | 912 | ;; |
719 | michael | 945 | link|lin|li|l) |
720 | shift; set dummy --mode link ${1+"$@"}; shift | ||
721 | ;; | ||
722 | uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) | ||
723 | shift; set dummy --mode uninstall ${1+"$@"}; shift | ||
724 | ;; | ||
725 | michael | 912 | esac |
726 | |||
727 | michael | 945 | # Parse non-mode specific arguments: |
728 | while test "$#" -gt 0; do | ||
729 | opt="$1" | ||
730 | shift | ||
731 | michael | 912 | |
732 | michael | 945 | case $opt in |
733 | --config) func_config ;; | ||
734 | michael | 912 | |
735 | michael | 945 | --debug) preserve_args="$preserve_args $opt" |
736 | func_echo "enabling shell trace mode" | ||
737 | opt_debug='set -x' | ||
738 | $opt_debug | ||
739 | ;; | ||
740 | michael | 912 | |
741 | michael | 945 | -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break |
742 | execute_dlfiles="$execute_dlfiles $1" | ||
743 | shift | ||
744 | ;; | ||
745 | michael | 912 | |
746 | michael | 945 | --dry-run | -n) opt_dry_run=: ;; |
747 | --features) func_features ;; | ||
748 | --finish) mode="finish" ;; | ||
749 | |||
750 | --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break | ||
751 | case $1 in | ||
752 | # Valid mode arguments: | ||
753 | clean) ;; | ||
754 | compile) ;; | ||
755 | execute) ;; | ||
756 | finish) ;; | ||
757 | install) ;; | ||
758 | link) ;; | ||
759 | relink) ;; | ||
760 | uninstall) ;; | ||
761 | |||
762 | # Catch anything else as an error | ||
763 | *) func_error "invalid argument for $opt" | ||
764 | exit_cmd=exit | ||
765 | break | ||
766 | ;; | ||
767 | esac | ||
768 | |||
769 | mode="$1" | ||
770 | shift | ||
771 | ;; | ||
772 | |||
773 | --preserve-dup-deps) | ||
774 | opt_duplicate_deps=: ;; | ||
775 | |||
776 | --quiet|--silent) preserve_args="$preserve_args $opt" | ||
777 | opt_silent=: | ||
778 | ;; | ||
779 | |||
780 | --verbose| -v) preserve_args="$preserve_args $opt" | ||
781 | opt_silent=false | ||
782 | ;; | ||
783 | |||
784 | --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break | ||
785 | preserve_args="$preserve_args $opt $1" | ||
786 | func_enable_tag "$1" # tagname is set here | ||
787 | shift | ||
788 | ;; | ||
789 | |||
790 | # Separate optargs to long options: | ||
791 | -dlopen=*|--mode=*|--tag=*) | ||
792 | func_opt_split "$opt" | ||
793 | set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} | ||
794 | shift | ||
795 | ;; | ||
796 | |||
797 | -\?|-h) func_usage ;; | ||
798 | --help) opt_help=: ;; | ||
799 | --version) func_version ;; | ||
800 | |||
801 | -*) func_fatal_help "unrecognized option \`$opt'" ;; | ||
802 | |||
803 | *) nonopt="$opt" | ||
804 | break | ||
805 | ;; | ||
806 | esac | ||
807 | done | ||
808 | |||
809 | |||
810 | case $host in | ||
811 | *cygwin* | *mingw* | *pw32* | *cegcc*) | ||
812 | # don't eliminate duplications in $postdeps and $predeps | ||
813 | opt_duplicate_compiler_generated_deps=: | ||
814 | michael | 912 | ;; |
815 | michael | 945 | *) |
816 | opt_duplicate_compiler_generated_deps=$opt_duplicate_deps | ||
817 | michael | 912 | ;; |
818 | michael | 945 | esac |
819 | michael | 912 | |
820 | michael | 945 | # Having warned about all mis-specified options, bail out if |
821 | # anything was wrong. | ||
822 | $exit_cmd $EXIT_FAILURE | ||
823 | } | ||
824 | |||
825 | # func_check_version_match | ||
826 | # Ensure that we are using m4 macros, and libtool script from the same | ||
827 | # release of libtool. | ||
828 | func_check_version_match () | ||
829 | { | ||
830 | if test "$package_revision" != "$macro_revision"; then | ||
831 | if test "$VERSION" != "$macro_version"; then | ||
832 | if test -z "$macro_version"; then | ||
833 | cat >&2 <<_LT_EOF | ||
834 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the | ||
835 | $progname: definition of this LT_INIT comes from an older release. | ||
836 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION | ||
837 | $progname: and run autoconf again. | ||
838 | _LT_EOF | ||
839 | else | ||
840 | cat >&2 <<_LT_EOF | ||
841 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the | ||
842 | $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. | ||
843 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION | ||
844 | $progname: and run autoconf again. | ||
845 | _LT_EOF | ||
846 | michael | 912 | fi |
847 | michael | 945 | else |
848 | cat >&2 <<_LT_EOF | ||
849 | $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, | ||
850 | $progname: but the definition of this LT_INIT comes from revision $macro_revision. | ||
851 | $progname: You should recreate aclocal.m4 with macros from revision $package_revision | ||
852 | $progname: of $PACKAGE $VERSION and run autoconf again. | ||
853 | _LT_EOF | ||
854 | fi | ||
855 | |||
856 | exit $EXIT_MISMATCH | ||
857 | michael | 912 | fi |
858 | michael | 945 | } |
859 | michael | 912 | |
860 | michael | 945 | |
861 | ## ----------- ## | ||
862 | ## Main. ## | ||
863 | ## ----------- ## | ||
864 | |||
865 | $opt_help || { | ||
866 | # Sanity checks first: | ||
867 | func_check_version_match | ||
868 | |||
869 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then | ||
870 | func_fatal_configuration "not configured to build any kind of library" | ||
871 | fi | ||
872 | |||
873 | test -z "$mode" && func_fatal_error "error: you must specify a MODE." | ||
874 | |||
875 | |||
876 | # Darwin sucks | ||
877 | eval std_shrext=\"$shrext_cmds\" | ||
878 | |||
879 | |||
880 | michael | 912 | # Only execute mode is allowed to have -dlopen flags. |
881 | if test -n "$execute_dlfiles" && test "$mode" != execute; then | ||
882 | michael | 945 | func_error "unrecognized option \`-dlopen'" |
883 | $ECHO "$help" 1>&2 | ||
884 | michael | 912 | exit $EXIT_FAILURE |
885 | fi | ||
886 | |||
887 | # Change the help message to a mode-specific one. | ||
888 | generic_help="$help" | ||
889 | michael | 945 | help="Try \`$progname --help --mode=$mode' for more information." |
890 | } | ||
891 | michael | 912 | |
892 | michael | 945 | |
893 | # func_lalib_p file | ||
894 | # True iff FILE is a libtool `.la' library or `.lo' object file. | ||
895 | # This function is only a basic sanity check; it will hardly flush out | ||
896 | # determined imposters. | ||
897 | func_lalib_p () | ||
898 | { | ||
899 | test -f "$1" && | ||
900 | $SED -e 4q "$1" 2>/dev/null \ | ||
901 | | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 | ||
902 | } | ||
903 | |||
904 | # func_lalib_unsafe_p file | ||
905 | # True iff FILE is a libtool `.la' library or `.lo' object file. | ||
906 | # This function implements the same check as func_lalib_p without | ||
907 | # resorting to external programs. To this end, it redirects stdin and | ||
908 | # closes it afterwards, without saving the original file descriptor. | ||
909 | # As a safety measure, use it only where a negative result would be | ||
910 | # fatal anyway. Works if `file' does not exist. | ||
911 | func_lalib_unsafe_p () | ||
912 | { | ||
913 | lalib_p=no | ||
914 | if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then | ||
915 | for lalib_p_l in 1 2 3 4 | ||
916 | do | ||
917 | read lalib_p_line | ||
918 | case "$lalib_p_line" in | ||
919 | \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; | ||
920 | esac | ||
921 | done | ||
922 | exec 0<&5 5<&- | ||
923 | fi | ||
924 | test "$lalib_p" = yes | ||
925 | } | ||
926 | |||
927 | # func_ltwrapper_script_p file | ||
928 | # True iff FILE is a libtool wrapper script | ||
929 | # This function is only a basic sanity check; it will hardly flush out | ||
930 | # determined imposters. | ||
931 | func_ltwrapper_script_p () | ||
932 | { | ||
933 | func_lalib_p "$1" | ||
934 | } | ||
935 | |||
936 | # func_ltwrapper_executable_p file | ||
937 | # True iff FILE is a libtool wrapper executable | ||
938 | # This function is only a basic sanity check; it will hardly flush out | ||
939 | # determined imposters. | ||
940 | func_ltwrapper_executable_p () | ||
941 | { | ||
942 | func_ltwrapper_exec_suffix= | ||
943 | case $1 in | ||
944 | *.exe) ;; | ||
945 | *) func_ltwrapper_exec_suffix=.exe ;; | ||
946 | esac | ||
947 | $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 | ||
948 | } | ||
949 | |||
950 | # func_ltwrapper_scriptname file | ||
951 | # Assumes file is an ltwrapper_executable | ||
952 | # uses $file to determine the appropriate filename for a | ||
953 | # temporary ltwrapper_script. | ||
954 | func_ltwrapper_scriptname () | ||
955 | { | ||
956 | func_ltwrapper_scriptname_result="" | ||
957 | if func_ltwrapper_executable_p "$1"; then | ||
958 | func_dirname_and_basename "$1" "" "." | ||
959 | func_stripname '' '.exe' "$func_basename_result" | ||
960 | func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" | ||
961 | fi | ||
962 | } | ||
963 | |||
964 | # func_ltwrapper_p file | ||
965 | # True iff FILE is a libtool wrapper script or wrapper executable | ||
966 | # This function is only a basic sanity check; it will hardly flush out | ||
967 | # determined imposters. | ||
968 | func_ltwrapper_p () | ||
969 | { | ||
970 | func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" | ||
971 | } | ||
972 | |||
973 | |||
974 | # func_execute_cmds commands fail_cmd | ||
975 | # Execute tilde-delimited COMMANDS. | ||
976 | # If FAIL_CMD is given, eval that upon failure. | ||
977 | # FAIL_CMD may read-access the current command in variable CMD! | ||
978 | func_execute_cmds () | ||
979 | { | ||
980 | $opt_debug | ||
981 | save_ifs=$IFS; IFS='~' | ||
982 | for cmd in $1; do | ||
983 | IFS=$save_ifs | ||
984 | eval cmd=\"$cmd\" | ||
985 | func_show_eval "$cmd" "${2-:}" | ||
986 | done | ||
987 | IFS=$save_ifs | ||
988 | } | ||
989 | |||
990 | |||
991 | # func_source file | ||
992 | # Source FILE, adding directory component if necessary. | ||
993 | # Note that it is not necessary on cygwin/mingw to append a dot to | ||
994 | # FILE even if both FILE and FILE.exe exist: automatic-append-.exe | ||
995 | # behavior happens only for exec(3), not for open(2)! Also, sourcing | ||
996 | # `FILE.' does not work on cygwin managed mounts. | ||
997 | func_source () | ||
998 | { | ||
999 | $opt_debug | ||
1000 | case $1 in | ||
1001 | */* | *\\*) . "$1" ;; | ||
1002 | *) . "./$1" ;; | ||
1003 | esac | ||
1004 | } | ||
1005 | |||
1006 | |||
1007 | # func_infer_tag arg | ||
1008 | # Infer tagged configuration to use if any are available and | ||
1009 | # if one wasn't chosen via the "--tag" command line option. | ||
1010 | # Only attempt this if the compiler in the base compile | ||
1011 | # command doesn't match the default compiler. | ||
1012 | # arg is usually of the form 'gcc ...' | ||
1013 | func_infer_tag () | ||
1014 | { | ||
1015 | $opt_debug | ||
1016 | if test -n "$available_tags" && test -z "$tagname"; then | ||
1017 | CC_quoted= | ||
1018 | for arg in $CC; do | ||
1019 | func_quote_for_eval "$arg" | ||
1020 | CC_quoted="$CC_quoted $func_quote_for_eval_result" | ||
1021 | done | ||
1022 | case $@ in | ||
1023 | # Blanks in the command may have been stripped by the calling shell, | ||
1024 | # but not from the CC environment variable when configure was run. | ||
1025 | " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; | ||
1026 | # Blanks at the start of $base_compile will cause this to fail | ||
1027 | # if we don't check for them as well. | ||
1028 | *) | ||
1029 | for z in $available_tags; do | ||
1030 | if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then | ||
1031 | # Evaluate the configuration. | ||
1032 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" | ||
1033 | CC_quoted= | ||
1034 | for arg in $CC; do | ||
1035 | # Double-quote args containing other shell metacharacters. | ||
1036 | func_quote_for_eval "$arg" | ||
1037 | CC_quoted="$CC_quoted $func_quote_for_eval_result" | ||
1038 | done | ||
1039 | case "$@ " in | ||
1040 | " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) | ||
1041 | # The compiler in the base compile command matches | ||
1042 | # the one in the tagged configuration. | ||
1043 | # Assume this is the tagged configuration we want. | ||
1044 | tagname=$z | ||
1045 | break | ||
1046 | ;; | ||
1047 | esac | ||
1048 | fi | ||
1049 | done | ||
1050 | # If $tagname still isn't set, then no tagged configuration | ||
1051 | # was found and let the user know that the "--tag" command | ||
1052 | # line option must be used. | ||
1053 | if test -z "$tagname"; then | ||
1054 | func_echo "unable to infer tagged configuration" | ||
1055 | func_fatal_error "specify a tag with \`--tag'" | ||
1056 | # else | ||
1057 | # func_verbose "using $tagname tagged configuration" | ||
1058 | fi | ||
1059 | ;; | ||
1060 | esac | ||
1061 | fi | ||
1062 | } | ||
1063 | |||
1064 | |||
1065 | |||
1066 | # func_write_libtool_object output_name pic_name nonpic_name | ||
1067 | # Create a libtool object file (analogous to a ".la" file), | ||
1068 | # but don't create it if we're doing a dry run. | ||
1069 | func_write_libtool_object () | ||
1070 | { | ||
1071 | write_libobj=${1} | ||
1072 | if test "$build_libtool_libs" = yes; then | ||
1073 | write_lobj=\'${2}\' | ||
1074 | else | ||
1075 | write_lobj=none | ||
1076 | fi | ||
1077 | |||
1078 | if test "$build_old_libs" = yes; then | ||
1079 | write_oldobj=\'${3}\' | ||
1080 | else | ||
1081 | write_oldobj=none | ||
1082 | fi | ||
1083 | |||
1084 | $opt_dry_run || { | ||
1085 | cat >${write_libobj}T <<EOF | ||
1086 | # $write_libobj - a libtool object file | ||
1087 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION | ||
1088 | # | ||
1089 | # Please DO NOT delete this file! | ||
1090 | # It is necessary for linking the library. | ||
1091 | |||
1092 | # Name of the PIC object. | ||
1093 | pic_object=$write_lobj | ||
1094 | |||
1095 | # Name of the non-PIC object | ||
1096 | non_pic_object=$write_oldobj | ||
1097 | |||
1098 | EOF | ||
1099 | $MV "${write_libobj}T" "${write_libobj}" | ||
1100 | } | ||
1101 | } | ||
1102 | |||
1103 | # func_mode_compile arg... | ||
1104 | func_mode_compile () | ||
1105 | { | ||
1106 | $opt_debug | ||
1107 | michael | 912 | # Get the compilation command and the source file. |
1108 | base_compile= | ||
1109 | srcfile="$nonopt" # always keep a non-empty value in "srcfile" | ||
1110 | suppress_opt=yes | ||
1111 | suppress_output= | ||
1112 | arg_mode=normal | ||
1113 | libobj= | ||
1114 | later= | ||
1115 | michael | 945 | pie_flag= |
1116 | michael | 912 | |
1117 | for arg | ||
1118 | do | ||
1119 | case $arg_mode in | ||
1120 | arg ) | ||
1121 | # do not "continue". Instead, add this to base_compile | ||
1122 | lastarg="$arg" | ||
1123 | arg_mode=normal | ||
1124 | ;; | ||
1125 | |||
1126 | target ) | ||
1127 | libobj="$arg" | ||
1128 | arg_mode=normal | ||
1129 | continue | ||
1130 | ;; | ||
1131 | |||
1132 | normal ) | ||
1133 | # Accept any command-line options. | ||
1134 | case $arg in | ||
1135 | -o) | ||
1136 | michael | 945 | test -n "$libobj" && \ |
1137 | func_fatal_error "you cannot specify \`-o' more than once" | ||
1138 | michael | 912 | arg_mode=target |
1139 | continue | ||
1140 | ;; | ||
1141 | |||
1142 | michael | 945 | -pie | -fpie | -fPIE) |
1143 | pie_flag="$pie_flag $arg" | ||
1144 | continue | ||
1145 | ;; | ||
1146 | |||
1147 | -shared | -static | -prefer-pic | -prefer-non-pic) | ||
1148 | michael | 912 | later="$later $arg" |
1149 | continue | ||
1150 | ;; | ||
1151 | |||
1152 | -no-suppress) | ||
1153 | suppress_opt=no | ||
1154 | continue | ||
1155 | ;; | ||
1156 | |||
1157 | -Xcompiler) | ||
1158 | arg_mode=arg # the next one goes into the "base_compile" arg list | ||
1159 | continue # The current "srcfile" will either be retained or | ||
1160 | ;; # replaced later. I would guess that would be a bug. | ||
1161 | |||
1162 | -Wc,*) | ||
1163 | michael | 945 | func_stripname '-Wc,' '' "$arg" |
1164 | args=$func_stripname_result | ||
1165 | michael | 912 | lastarg= |
1166 | save_ifs="$IFS"; IFS=',' | ||
1167 | michael | 945 | for arg in $args; do |
1168 | michael | 912 | IFS="$save_ifs" |
1169 | michael | 945 | func_quote_for_eval "$arg" |
1170 | lastarg="$lastarg $func_quote_for_eval_result" | ||
1171 | michael | 912 | done |
1172 | IFS="$save_ifs" | ||
1173 | michael | 945 | func_stripname ' ' '' "$lastarg" |
1174 | lastarg=$func_stripname_result | ||
1175 | michael | 912 | |
1176 | # Add the arguments to base_compile. | ||
1177 | base_compile="$base_compile $lastarg" | ||
1178 | continue | ||
1179 | ;; | ||
1180 | |||
1181 | michael | 945 | *) |
1182 | michael | 912 | # Accept the current argument as the source file. |
1183 | # The previous "srcfile" becomes the current argument. | ||
1184 | # | ||
1185 | lastarg="$srcfile" | ||
1186 | srcfile="$arg" | ||
1187 | ;; | ||
1188 | esac # case $arg | ||
1189 | ;; | ||
1190 | esac # case $arg_mode | ||
1191 | |||
1192 | # Aesthetically quote the previous argument. | ||
1193 | michael | 945 | func_quote_for_eval "$lastarg" |
1194 | base_compile="$base_compile $func_quote_for_eval_result" | ||
1195 | michael | 912 | done # for arg |
1196 | |||
1197 | case $arg_mode in | ||
1198 | arg) | ||
1199 | michael | 945 | func_fatal_error "you must specify an argument for -Xcompile" |
1200 | michael | 912 | ;; |
1201 | target) | ||
1202 | michael | 945 | func_fatal_error "you must specify a target with \`-o'" |
1203 | michael | 912 | ;; |
1204 | *) | ||
1205 | # Get the name of the library object. | ||
1206 | michael | 945 | test -z "$libobj" && { |
1207 | func_basename "$srcfile" | ||
1208 | libobj="$func_basename_result" | ||
1209 | } | ||
1210 | michael | 912 | ;; |
1211 | esac | ||
1212 | |||
1213 | # Recognize several different file suffixes. | ||
1214 | # If the user specifies -o file.o, it is replaced with file.lo | ||
1215 | case $libobj in | ||
1216 | michael | 945 | *.[cCFSifmso] | \ |
1217 | *.ada | *.adb | *.ads | *.asm | \ | ||
1218 | *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ | ||
1219 | *.[fF][09]? | *.for | *.java | *.obj | *.sx) | ||
1220 | func_xform "$libobj" | ||
1221 | libobj=$func_xform_result | ||
1222 | ;; | ||
1223 | michael | 912 | esac |
1224 | |||
1225 | case $libobj in | ||
1226 | michael | 945 | *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; |
1227 | michael | 912 | *) |
1228 | michael | 945 | func_fatal_error "cannot determine name of library object from \`$libobj'" |
1229 | michael | 912 | ;; |
1230 | esac | ||
1231 | |||
1232 | func_infer_tag $base_compile | ||
1233 | |||
1234 | for arg in $later; do | ||
1235 | case $arg in | ||
1236 | michael | 945 | -shared) |
1237 | test "$build_libtool_libs" != yes && \ | ||
1238 | func_fatal_configuration "can not build a shared library" | ||
1239 | build_old_libs=no | ||
1240 | continue | ||
1241 | ;; | ||
1242 | |||
1243 | michael | 912 | -static) |
1244 | michael | 945 | build_libtool_libs=no |
1245 | michael | 912 | build_old_libs=yes |
1246 | continue | ||
1247 | ;; | ||
1248 | |||
1249 | -prefer-pic) | ||
1250 | pic_mode=yes | ||
1251 | continue | ||
1252 | ;; | ||
1253 | |||
1254 | -prefer-non-pic) | ||
1255 | pic_mode=no | ||
1256 | continue | ||
1257 | ;; | ||
1258 | esac | ||
1259 | done | ||
1260 | |||
1261 | michael | 945 | func_quote_for_eval "$libobj" |
1262 | test "X$libobj" != "X$func_quote_for_eval_result" \ | ||
1263 | && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ | ||
1264 | && func_warning "libobj name \`$libobj' may not contain shell special characters." | ||
1265 | func_dirname_and_basename "$obj" "/" "" | ||
1266 | objname="$func_basename_result" | ||
1267 | xdir="$func_dirname_result" | ||
1268 | michael | 912 | lobj=${xdir}$objdir/$objname |
1269 | |||
1270 | michael | 945 | test -z "$base_compile" && \ |
1271 | func_fatal_help "you must specify a compilation command" | ||
1272 | michael | 912 | |
1273 | # Delete any leftover library objects. | ||
1274 | if test "$build_old_libs" = yes; then | ||
1275 | removelist="$obj $lobj $libobj ${libobj}T" | ||
1276 | else | ||
1277 | removelist="$lobj $libobj ${libobj}T" | ||
1278 | fi | ||
1279 | |||
1280 | # On Cygwin there's no "real" PIC flag so we must build both object types | ||
1281 | case $host_os in | ||
1282 | michael | 945 | cygwin* | mingw* | pw32* | os2* | cegcc*) |
1283 | michael | 912 | pic_mode=default |
1284 | ;; | ||
1285 | esac | ||
1286 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then | ||
1287 | # non-PIC code in shared libraries is not supported | ||
1288 | pic_mode=default | ||
1289 | fi | ||
1290 | |||
1291 | # Calculate the filename of the output object if compiler does | ||
1292 | # not support -o with -c | ||
1293 | if test "$compiler_c_o" = no; then | ||
1294 | michael | 945 | output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} |
1295 | michael | 912 | lockfile="$output_obj.lock" |
1296 | else | ||
1297 | output_obj= | ||
1298 | need_locks=no | ||
1299 | lockfile= | ||
1300 | fi | ||
1301 | |||
1302 | # Lock this critical section if it is needed | ||
1303 | # We use this script file to make the link, it avoids creating a new file | ||
1304 | if test "$need_locks" = yes; then | ||
1305 | michael | 945 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
1306 | func_echo "Waiting for $lockfile to be removed" | ||
1307 | michael | 912 | sleep 2 |
1308 | done | ||
1309 | elif test "$need_locks" = warn; then | ||
1310 | if test -f "$lockfile"; then | ||
1311 | michael | 945 | $ECHO "\ |
1312 | michael | 912 | *** ERROR, $lockfile exists and contains: |
1313 | `cat $lockfile 2>/dev/null` | ||
1314 | |||
1315 | This indicates that another process is trying to use the same | ||
1316 | temporary object file, and libtool could not work around it because | ||
1317 | your compiler does not support \`-c' and \`-o' together. If you | ||
1318 | repeat this compilation, it may succeed, by chance, but you had better | ||
1319 | avoid parallel builds (make -j) in this platform, or get a better | ||
1320 | compiler." | ||
1321 | |||
1322 | michael | 945 | $opt_dry_run || $RM $removelist |
1323 | michael | 912 | exit $EXIT_FAILURE |
1324 | fi | ||
1325 | michael | 945 | removelist="$removelist $output_obj" |
1326 | $ECHO "$srcfile" > "$lockfile" | ||
1327 | michael | 912 | fi |
1328 | |||
1329 | michael | 945 | $opt_dry_run || $RM $removelist |
1330 | removelist="$removelist $lockfile" | ||
1331 | trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 | ||
1332 | |||
1333 | michael | 912 | if test -n "$fix_srcfile_path"; then |
1334 | eval srcfile=\"$fix_srcfile_path\" | ||
1335 | fi | ||
1336 | michael | 945 | func_quote_for_eval "$srcfile" |
1337 | qsrcfile=$func_quote_for_eval_result | ||
1338 | michael | 912 | |
1339 | # Only build a PIC object if we are building libtool libraries. | ||
1340 | if test "$build_libtool_libs" = yes; then | ||
1341 | # Without this assignment, base_compile gets emptied. | ||
1342 | fbsd_hideous_sh_bug=$base_compile | ||
1343 | |||
1344 | if test "$pic_mode" != no; then | ||
1345 | command="$base_compile $qsrcfile $pic_flag" | ||
1346 | else | ||
1347 | # Don't build PIC code | ||
1348 | command="$base_compile $qsrcfile" | ||
1349 | fi | ||
1350 | |||
1351 | michael | 945 | func_mkdir_p "$xdir$objdir" |
1352 | michael | 912 | |
1353 | if test -z "$output_obj"; then | ||
1354 | # Place PIC objects in $objdir | ||
1355 | command="$command -o $lobj" | ||
1356 | fi | ||
1357 | |||
1358 | michael | 945 | func_show_eval_locale "$command" \ |
1359 | 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' | ||
1360 | michael | 912 | |
1361 | if test "$need_locks" = warn && | ||
1362 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then | ||
1363 | michael | 945 | $ECHO "\ |
1364 | michael | 912 | *** ERROR, $lockfile contains: |
1365 | `cat $lockfile 2>/dev/null` | ||
1366 | |||
1367 | but it should contain: | ||
1368 | $srcfile | ||
1369 | |||
1370 | This indicates that another process is trying to use the same | ||
1371 | temporary object file, and libtool could not work around it because | ||
1372 | your compiler does not support \`-c' and \`-o' together. If you | ||
1373 | repeat this compilation, it may succeed, by chance, but you had better | ||
1374 | avoid parallel builds (make -j) in this platform, or get a better | ||
1375 | compiler." | ||
1376 | |||
1377 | michael | 945 | $opt_dry_run || $RM $removelist |
1378 | michael | 912 | exit $EXIT_FAILURE |
1379 | fi | ||
1380 | |||
1381 | # Just move the object if needed, then go on to compile the next one | ||
1382 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then | ||
1383 | michael | 945 | func_show_eval '$MV "$output_obj" "$lobj"' \ |
1384 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' | ||
1385 | michael | 912 | fi |
1386 | |||
1387 | # Allow error messages only from the first compilation. | ||
1388 | if test "$suppress_opt" = yes; then | ||
1389 | michael | 945 | suppress_output=' >/dev/null 2>&1' |
1390 | michael | 912 | fi |
1391 | fi | ||
1392 | |||
1393 | # Only build a position-dependent object if we build old libraries. | ||
1394 | if test "$build_old_libs" = yes; then | ||
1395 | if test "$pic_mode" != yes; then | ||
1396 | # Don't build PIC code | ||
1397 | michael | 945 | command="$base_compile $qsrcfile$pie_flag" |
1398 | michael | 912 | else |
1399 | command="$base_compile $qsrcfile $pic_flag" | ||
1400 | fi | ||
1401 | if test "$compiler_c_o" = yes; then | ||
1402 | command="$command -o $obj" | ||
1403 | fi | ||
1404 | |||
1405 | # Suppress compiler output if we already did a PIC compilation. | ||
1406 | command="$command$suppress_output" | ||
1407 | michael | 945 | func_show_eval_locale "$command" \ |
1408 | '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' | ||
1409 | michael | 912 | |
1410 | if test "$need_locks" = warn && | ||
1411 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then | ||
1412 | michael | 945 | $ECHO "\ |
1413 | michael | 912 | *** ERROR, $lockfile contains: |
1414 | `cat $lockfile 2>/dev/null` | ||
1415 | |||
1416 | but it should contain: | ||
1417 | $srcfile | ||
1418 | |||
1419 | This indicates that another process is trying to use the same | ||
1420 | temporary object file, and libtool could not work around it because | ||
1421 | your compiler does not support \`-c' and \`-o' together. If you | ||
1422 | repeat this compilation, it may succeed, by chance, but you had better | ||
1423 | avoid parallel builds (make -j) in this platform, or get a better | ||
1424 | compiler." | ||
1425 | |||
1426 | michael | 945 | $opt_dry_run || $RM $removelist |
1427 | michael | 912 | exit $EXIT_FAILURE |
1428 | fi | ||
1429 | |||
1430 | # Just move the object if needed | ||
1431 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then | ||
1432 | michael | 945 | func_show_eval '$MV "$output_obj" "$obj"' \ |
1433 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' | ||
1434 | fi | ||
1435 | fi | ||
1436 | |||
1437 | $opt_dry_run || { | ||
1438 | func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" | ||
1439 | |||
1440 | # Unlock the critical section if it was locked | ||
1441 | if test "$need_locks" != no; then | ||
1442 | removelist=$lockfile | ||
1443 | $RM "$lockfile" | ||
1444 | fi | ||
1445 | } | ||
1446 | |||
1447 | exit $EXIT_SUCCESS | ||
1448 | } | ||
1449 | |||
1450 | $opt_help || { | ||
1451 | test "$mode" = compile && func_mode_compile ${1+"$@"} | ||
1452 | } | ||
1453 | |||
1454 | func_mode_help () | ||
1455 | { | ||
1456 | # We need to display help for each of the modes. | ||
1457 | case $mode in | ||
1458 | "") | ||
1459 | # Generic help is extracted from the usage comments | ||
1460 | # at the start of this file. | ||
1461 | func_help | ||
1462 | ;; | ||
1463 | |||
1464 | clean) | ||
1465 | $ECHO \ | ||
1466 | "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... | ||
1467 | |||
1468 | Remove files from the build directory. | ||
1469 | |||
1470 | RM is the name of the program to use to delete files associated with each FILE | ||
1471 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed | ||
1472 | to RM. | ||
1473 | |||
1474 | If FILE is a libtool library, object or program, all the files associated | ||
1475 | with it are deleted. Otherwise, only FILE itself is deleted using RM." | ||
1476 | ;; | ||
1477 | |||
1478 | compile) | ||
1479 | $ECHO \ | ||
1480 | "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE | ||
1481 | |||
1482 | Compile a source file into a libtool library object. | ||
1483 | |||
1484 | This mode accepts the following additional options: | ||
1485 | |||
1486 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE | ||
1487 | -no-suppress do not suppress compiler output for multiple passes | ||
1488 | -prefer-pic try to building PIC objects only | ||
1489 | -prefer-non-pic try to building non-PIC objects only | ||
1490 | -shared do not build a \`.o' file suitable for static linking | ||
1491 | -static only build a \`.o' file suitable for static linking | ||
1492 | |||
1493 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file | ||
1494 | from the given SOURCEFILE. | ||
1495 | |||
1496 | The output file name is determined by removing the directory component from | ||
1497 | SOURCEFILE, then substituting the C source code suffix \`.c' with the | ||
1498 | library object suffix, \`.lo'." | ||
1499 | ;; | ||
1500 | |||
1501 | execute) | ||
1502 | $ECHO \ | ||
1503 | "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... | ||
1504 | |||
1505 | Automatically set library path, then run a program. | ||
1506 | |||
1507 | This mode accepts the following additional options: | ||
1508 | |||
1509 | -dlopen FILE add the directory containing FILE to the library path | ||
1510 | |||
1511 | This mode sets the library path environment variable according to \`-dlopen' | ||
1512 | flags. | ||
1513 | |||
1514 | If any of the ARGS are libtool executable wrappers, then they are translated | ||
1515 | into their corresponding uninstalled binary, and any of their required library | ||
1516 | directories are added to the library path. | ||
1517 | |||
1518 | Then, COMMAND is executed, with ARGS as arguments." | ||
1519 | ;; | ||
1520 | |||
1521 | finish) | ||
1522 | $ECHO \ | ||
1523 | "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... | ||
1524 | |||
1525 | Complete the installation of libtool libraries. | ||
1526 | |||
1527 | Each LIBDIR is a directory that contains libtool libraries. | ||
1528 | |||
1529 | The commands that this mode executes may require superuser privileges. Use | ||
1530 | the \`--dry-run' option if you just want to see what would be executed." | ||
1531 | ;; | ||
1532 | |||
1533 | install) | ||
1534 | $ECHO \ | ||
1535 | "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... | ||
1536 | |||
1537 | Install executables or libraries. | ||
1538 | |||
1539 | INSTALL-COMMAND is the installation command. The first component should be | ||
1540 | either the \`install' or \`cp' program. | ||
1541 | |||
1542 | The following components of INSTALL-COMMAND are treated specially: | ||
1543 | |||
1544 | -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation | ||
1545 | |||
1546 | The rest of the components are interpreted as arguments to that command (only | ||
1547 | BSD-compatible install options are recognized)." | ||
1548 | ;; | ||
1549 | |||
1550 | link) | ||
1551 | $ECHO \ | ||
1552 | "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... | ||
1553 | |||
1554 | Link object files or libraries together to form another library, or to | ||
1555 | create an executable program. | ||
1556 | |||
1557 | LINK-COMMAND is a command using the C compiler that you would use to create | ||
1558 | a program from several object files. | ||
1559 | |||
1560 | The following components of LINK-COMMAND are treated specially: | ||
1561 | |||
1562 | -all-static do not do any dynamic linking at all | ||
1563 | -avoid-version do not add a version suffix if possible | ||
1564 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime | ||
1565 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols | ||
1566 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) | ||
1567 | -export-symbols SYMFILE | ||
1568 | try to export only the symbols listed in SYMFILE | ||
1569 | -export-symbols-regex REGEX | ||
1570 | try to export only the symbols matching REGEX | ||
1571 | -LLIBDIR search LIBDIR for required installed libraries | ||
1572 | -lNAME OUTPUT-FILE requires the installed library libNAME | ||
1573 | -module build a library that can dlopened | ||
1574 | -no-fast-install disable the fast-install mode | ||
1575 | -no-install link a not-installable executable | ||
1576 | -no-undefined declare that a library does not refer to external symbols | ||
1577 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects | ||
1578 | -objectlist FILE Use a list of object files found in FILE to specify objects | ||
1579 | -precious-files-regex REGEX | ||
1580 | don't remove output files matching REGEX | ||
1581 | -release RELEASE specify package release information | ||
1582 | -rpath LIBDIR the created library will eventually be installed in LIBDIR | ||
1583 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries | ||
1584 | -shared only do dynamic linking of libtool libraries | ||
1585 | -shrext SUFFIX override the standard shared library file extension | ||
1586 | -static do not do any dynamic linking of uninstalled libtool libraries | ||
1587 | -static-libtool-libs | ||
1588 | do not do any dynamic linking of libtool libraries | ||
1589 | -version-info CURRENT[:REVISION[:AGE]] | ||
1590 | specify library version info [each variable defaults to 0] | ||
1591 | -weak LIBNAME declare that the target provides the LIBNAME interface | ||
1592 | |||
1593 | All other options (arguments beginning with \`-') are ignored. | ||
1594 | |||
1595 | Every other argument is treated as a filename. Files ending in \`.la' are | ||
1596 | treated as uninstalled libtool libraries, other files are standard or library | ||
1597 | object files. | ||
1598 | |||
1599 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, | ||
1600 | only library objects (\`.lo' files) may be specified, and \`-rpath' is | ||
1601 | required, except when creating a convenience library. | ||
1602 | |||
1603 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created | ||
1604 | using \`ar' and \`ranlib', or on Windows using \`lib'. | ||
1605 | |||
1606 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file | ||
1607 | is created, otherwise an executable program is created." | ||
1608 | ;; | ||
1609 | |||
1610 | uninstall) | ||
1611 | $ECHO \ | ||
1612 | "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... | ||
1613 | |||
1614 | Remove libraries from an installation directory. | ||
1615 | |||
1616 | RM is the name of the program to use to delete files associated with each FILE | ||
1617 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed | ||
1618 | to RM. | ||
1619 | |||
1620 | If FILE is a libtool library, all the files associated with it are deleted. | ||
1621 | Otherwise, only FILE itself is deleted using RM." | ||
1622 | ;; | ||
1623 | |||
1624 | *) | ||
1625 | func_fatal_help "invalid operation mode \`$mode'" | ||
1626 | ;; | ||
1627 | esac | ||
1628 | |||
1629 | $ECHO | ||
1630 | $ECHO "Try \`$progname --help' for more information about other modes." | ||
1631 | |||
1632 | exit $? | ||
1633 | } | ||
1634 | |||
1635 | # Now that we've collected a possible --mode arg, show help if necessary | ||
1636 | $opt_help && func_mode_help | ||
1637 | |||
1638 | |||
1639 | # func_mode_execute arg... | ||
1640 | func_mode_execute () | ||
1641 | { | ||
1642 | $opt_debug | ||
1643 | # The first argument is the command name. | ||
1644 | cmd="$nonopt" | ||
1645 | test -z "$cmd" && \ | ||
1646 | func_fatal_help "you must specify a COMMAND" | ||
1647 | |||
1648 | # Handle -dlopen flags immediately. | ||
1649 | for file in $execute_dlfiles; do | ||
1650 | test -f "$file" \ | ||
1651 | || func_fatal_help "\`$file' is not a file" | ||
1652 | |||
1653 | dir= | ||
1654 | case $file in | ||
1655 | *.la) | ||
1656 | # Check to see that this really is a libtool archive. | ||
1657 | func_lalib_unsafe_p "$file" \ | ||
1658 | || func_fatal_help "\`$lib' is not a valid libtool archive" | ||
1659 | |||
1660 | # Read the libtool library. | ||
1661 | dlname= | ||
1662 | library_names= | ||
1663 | func_source "$file" | ||
1664 | |||
1665 | # Skip this library if it cannot be dlopened. | ||
1666 | if test -z "$dlname"; then | ||
1667 | # Warn if it was a shared library. | ||
1668 | test -n "$library_names" && \ | ||
1669 | func_warning "\`$file' was not linked with \`-export-dynamic'" | ||
1670 | continue | ||
1671 | fi | ||
1672 | |||
1673 | func_dirname "$file" "" "." | ||
1674 | dir="$func_dirname_result" | ||
1675 | |||
1676 | if test -f "$dir/$objdir/$dlname"; then | ||
1677 | dir="$dir/$objdir" | ||
1678 | michael | 912 | else |
1679 | michael | 945 | if test ! -f "$dir/$dlname"; then |
1680 | func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" | ||
1681 | fi | ||
1682 | michael | 912 | fi |
1683 | michael | 945 | ;; |
1684 | |||
1685 | *.lo) | ||
1686 | # Just add the directory containing the .lo file. | ||
1687 | func_dirname "$file" "" "." | ||
1688 | dir="$func_dirname_result" | ||
1689 | ;; | ||
1690 | |||
1691 | *) | ||
1692 | func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" | ||
1693 | continue | ||
1694 | ;; | ||
1695 | esac | ||
1696 | |||
1697 | # Get the absolute pathname. | ||
1698 | absdir=`cd "$dir" && pwd` | ||
1699 | test -n "$absdir" && dir="$absdir" | ||
1700 | |||
1701 | # Now add the directory to shlibpath_var. | ||
1702 | if eval "test -z \"\$$shlibpath_var\""; then | ||
1703 | eval "$shlibpath_var=\"\$dir\"" | ||
1704 | else | ||
1705 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" | ||
1706 | michael | 912 | fi |
1707 | michael | 945 | done |
1708 | michael | 912 | |
1709 | michael | 945 | # This variable tells wrapper scripts just to set shlibpath_var |
1710 | # rather than running their programs. | ||
1711 | libtool_execute_magic="$magic" | ||
1712 | michael | 912 | |
1713 | michael | 945 | # Check if any of the arguments is a wrapper script. |
1714 | args= | ||
1715 | for file | ||
1716 | do | ||
1717 | case $file in | ||
1718 | -*) ;; | ||
1719 | *) | ||
1720 | # Do a test to see if this is really a libtool program. | ||
1721 | if func_ltwrapper_script_p "$file"; then | ||
1722 | func_source "$file" | ||
1723 | # Transform arg to wrapped name. | ||
1724 | file="$progdir/$program" | ||
1725 | elif func_ltwrapper_executable_p "$file"; then | ||
1726 | func_ltwrapper_scriptname "$file" | ||
1727 | func_source "$func_ltwrapper_scriptname_result" | ||
1728 | # Transform arg to wrapped name. | ||
1729 | file="$progdir/$program" | ||
1730 | fi | ||
1731 | ;; | ||
1732 | esac | ||
1733 | # Quote arguments (to preserve shell metacharacters). | ||
1734 | func_quote_for_eval "$file" | ||
1735 | args="$args $func_quote_for_eval_result" | ||
1736 | done | ||
1737 | |||
1738 | if test "X$opt_dry_run" = Xfalse; then | ||
1739 | if test -n "$shlibpath_var"; then | ||
1740 | # Export the shlibpath_var. | ||
1741 | eval "export $shlibpath_var" | ||
1742 | fi | ||
1743 | |||
1744 | # Restore saved environment variables | ||
1745 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES | ||
1746 | do | ||
1747 | eval "if test \"\${save_$lt_var+set}\" = set; then | ||
1748 | $lt_var=\$save_$lt_var; export $lt_var | ||
1749 | else | ||
1750 | $lt_unset $lt_var | ||
1751 | fi" | ||
1752 | done | ||
1753 | |||
1754 | # Now prepare to actually exec the command. | ||
1755 | exec_cmd="\$cmd$args" | ||
1756 | michael | 912 | else |
1757 | michael | 945 | # Display what would be done. |
1758 | if test -n "$shlibpath_var"; then | ||
1759 | eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" | ||
1760 | $ECHO "export $shlibpath_var" | ||
1761 | fi | ||
1762 | $ECHO "$cmd$args" | ||
1763 | exit $EXIT_SUCCESS | ||
1764 | fi | ||
1765 | } | ||
1766 | michael | 912 | |
1767 | michael | 945 | test "$mode" = execute && func_mode_execute ${1+"$@"} |
1768 | |||
1769 | |||
1770 | # func_mode_finish arg... | ||
1771 | func_mode_finish () | ||
1772 | { | ||
1773 | $opt_debug | ||
1774 | libdirs="$nonopt" | ||
1775 | admincmds= | ||
1776 | |||
1777 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then | ||
1778 | for dir | ||
1779 | do | ||
1780 | libdirs="$libdirs $dir" | ||
1781 | done | ||
1782 | |||
1783 | for libdir in $libdirs; do | ||
1784 | if test -n "$finish_cmds"; then | ||
1785 | # Do each command in the finish commands. | ||
1786 | func_execute_cmds "$finish_cmds" 'admincmds="$admincmds | ||
1787 | '"$cmd"'"' | ||
1788 | fi | ||
1789 | if test -n "$finish_eval"; then | ||
1790 | # Do the single finish_eval. | ||
1791 | eval cmds=\"$finish_eval\" | ||
1792 | $opt_dry_run || eval "$cmds" || admincmds="$admincmds | ||
1793 | $cmds" | ||
1794 | fi | ||
1795 | done | ||
1796 | michael | 912 | fi |
1797 | |||
1798 | michael | 945 | # Exit here if they wanted silent mode. |
1799 | $opt_silent && exit $EXIT_SUCCESS | ||
1800 | michael | 912 | |
1801 | michael | 945 | $ECHO "X----------------------------------------------------------------------" | $Xsed |
1802 | $ECHO "Libraries have been installed in:" | ||
1803 | for libdir in $libdirs; do | ||
1804 | $ECHO " $libdir" | ||
1805 | done | ||
1806 | $ECHO | ||
1807 | $ECHO "If you ever happen to want to link against installed libraries" | ||
1808 | $ECHO "in a given directory, LIBDIR, you must either use libtool, and" | ||
1809 | $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" | ||
1810 | $ECHO "flag during linking and do at least one of the following:" | ||
1811 | if test -n "$shlibpath_var"; then | ||
1812 | $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" | ||
1813 | $ECHO " during execution" | ||
1814 | michael | 912 | fi |
1815 | michael | 945 | if test -n "$runpath_var"; then |
1816 | $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" | ||
1817 | $ECHO " during linking" | ||
1818 | fi | ||
1819 | if test -n "$hardcode_libdir_flag_spec"; then | ||
1820 | libdir=LIBDIR | ||
1821 | eval flag=\"$hardcode_libdir_flag_spec\" | ||
1822 | michael | 912 | |
1823 | michael | 945 | $ECHO " - use the \`$flag' linker flag" |
1824 | fi | ||
1825 | if test -n "$admincmds"; then | ||
1826 | $ECHO " - have your system administrator run these commands:$admincmds" | ||
1827 | fi | ||
1828 | if test -f /etc/ld.so.conf; then | ||
1829 | $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" | ||
1830 | fi | ||
1831 | $ECHO | ||
1832 | |||
1833 | $ECHO "See any operating system documentation about shared libraries for" | ||
1834 | case $host in | ||
1835 | solaris2.[6789]|solaris2.1[0-9]) | ||
1836 | $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" | ||
1837 | $ECHO "pages." | ||
1838 | ;; | ||
1839 | *) | ||
1840 | $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." | ||
1841 | ;; | ||
1842 | esac | ||
1843 | $ECHO "X----------------------------------------------------------------------" | $Xsed | ||
1844 | michael | 912 | exit $EXIT_SUCCESS |
1845 | michael | 945 | } |
1846 | |||
1847 | test "$mode" = finish && func_mode_finish ${1+"$@"} | ||
1848 | |||
1849 | |||
1850 | # func_mode_install arg... | ||
1851 | func_mode_install () | ||
1852 | { | ||
1853 | $opt_debug | ||
1854 | # There may be an optional sh(1) argument at the beginning of | ||
1855 | # install_prog (especially on Windows NT). | ||
1856 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || | ||
1857 | # Allow the use of GNU shtool's install command. | ||
1858 | $ECHO "X$nonopt" | $GREP shtool >/dev/null; then | ||
1859 | # Aesthetically quote it. | ||
1860 | func_quote_for_eval "$nonopt" | ||
1861 | install_prog="$func_quote_for_eval_result " | ||
1862 | arg=$1 | ||
1863 | shift | ||
1864 | else | ||
1865 | install_prog= | ||
1866 | arg=$nonopt | ||
1867 | fi | ||
1868 | |||
1869 | # The real first argument should be the name of the installation program. | ||
1870 | # Aesthetically quote it. | ||
1871 | func_quote_for_eval "$arg" | ||
1872 | install_prog="$install_prog$func_quote_for_eval_result" | ||
1873 | |||
1874 | # We need to accept at least all the BSD install flags. | ||
1875 | dest= | ||
1876 | files= | ||
1877 | opts= | ||
1878 | prev= | ||
1879 | install_type= | ||
1880 | isdir=no | ||
1881 | stripme= | ||
1882 | for arg | ||
1883 | do | ||
1884 | if test -n "$dest"; then | ||
1885 | files="$files $dest" | ||
1886 | dest=$arg | ||
1887 | continue | ||
1888 | fi | ||
1889 | |||
1890 | case $arg in | ||
1891 | -d) isdir=yes ;; | ||
1892 | -f) | ||
1893 | case " $install_prog " in | ||
1894 | *[\\\ /]cp\ *) ;; | ||
1895 | *) prev=$arg ;; | ||
1896 | esac | ||
1897 | ;; | ||
1898 | -g | -m | -o) | ||
1899 | prev=$arg | ||
1900 | ;; | ||
1901 | -s) | ||
1902 | stripme=" -s" | ||
1903 | continue | ||
1904 | ;; | ||
1905 | -*) | ||
1906 | ;; | ||
1907 | *) | ||
1908 | # If the previous option needed an argument, then skip it. | ||
1909 | if test -n "$prev"; then | ||
1910 | prev= | ||
1911 | else | ||
1912 | dest=$arg | ||
1913 | continue | ||
1914 | fi | ||
1915 | ;; | ||
1916 | esac | ||
1917 | |||
1918 | # Aesthetically quote the argument. | ||
1919 | func_quote_for_eval "$arg" | ||
1920 | install_prog="$install_prog $func_quote_for_eval_result" | ||
1921 | done | ||
1922 | |||
1923 | test -z "$install_prog" && \ | ||
1924 | func_fatal_help "you must specify an install program" | ||
1925 | |||
1926 | test -n "$prev" && \ | ||
1927 | func_fatal_help "the \`$prev' option requires an argument" | ||
1928 | |||
1929 | if test -z "$files"; then | ||
1930 | if test -z "$dest"; then | ||
1931 | func_fatal_help "no file or destination specified" | ||
1932 | else | ||
1933 | func_fatal_help "you must specify a destination" | ||
1934 | fi | ||
1935 | fi | ||
1936 | |||
1937 | # Strip any trailing slash from the destination. | ||
1938 | func_stripname '' '/' "$dest" | ||
1939 | dest=$func_stripname_result | ||
1940 | |||
1941 | # Check to see that the destination is a directory. | ||
1942 | test -d "$dest" && isdir=yes | ||
1943 | if test "$isdir" = yes; then | ||
1944 | destdir="$dest" | ||
1945 | destname= | ||
1946 | else | ||
1947 | func_dirname_and_basename "$dest" "" "." | ||
1948 | destdir="$func_dirname_result" | ||
1949 | destname="$func_basename_result" | ||
1950 | |||
1951 | # Not a directory, so check to see that there is only one file specified. | ||
1952 | set dummy $files; shift | ||
1953 | test "$#" -gt 1 && \ | ||
1954 | func_fatal_help "\`$dest' is not a directory" | ||
1955 | fi | ||
1956 | case $destdir in | ||
1957 | [\\/]* | [A-Za-z]:[\\/]*) ;; | ||
1958 | *) | ||
1959 | for file in $files; do | ||
1960 | case $file in | ||
1961 | *.lo) ;; | ||
1962 | *) | ||
1963 | func_fatal_help "\`$destdir' must be an absolute directory name" | ||
1964 | ;; | ||
1965 | esac | ||
1966 | done | ||
1967 | ;; | ||
1968 | esac | ||
1969 | |||
1970 | # This variable tells wrapper scripts just to set variables rather | ||
1971 | # than running their programs. | ||
1972 | libtool_install_magic="$magic" | ||
1973 | |||
1974 | staticlibs= | ||
1975 | future_libdirs= | ||
1976 | current_libdirs= | ||
1977 | for file in $files; do | ||
1978 | |||
1979 | # Do each installation. | ||
1980 | case $file in | ||
1981 | *.$libext) | ||
1982 | # Do the static libraries later. | ||
1983 | staticlibs="$staticlibs $file" | ||
1984 | ;; | ||
1985 | |||
1986 | *.la) | ||
1987 | # Check to see that this really is a libtool archive. | ||
1988 | func_lalib_unsafe_p "$file" \ | ||
1989 | || func_fatal_help "\`$file' is not a valid libtool archive" | ||
1990 | |||
1991 | library_names= | ||
1992 | old_library= | ||
1993 | relink_command= | ||
1994 | func_source "$file" | ||
1995 | |||
1996 | # Add the libdir to current_libdirs if it is the destination. | ||
1997 | if test "X$destdir" = "X$libdir"; then | ||
1998 | case "$current_libdirs " in | ||
1999 | *" $libdir "*) ;; | ||
2000 | *) current_libdirs="$current_libdirs $libdir" ;; | ||
2001 | esac | ||
2002 | else | ||
2003 | # Note the libdir as a future libdir. | ||
2004 | case "$future_libdirs " in | ||
2005 | *" $libdir "*) ;; | ||
2006 | *) future_libdirs="$future_libdirs $libdir" ;; | ||
2007 | esac | ||
2008 | fi | ||
2009 | |||
2010 | func_dirname "$file" "/" "" | ||
2011 | dir="$func_dirname_result" | ||
2012 | dir="$dir$objdir" | ||
2013 | |||
2014 | if test -n "$relink_command"; then | ||
2015 | # Determine the prefix the user has applied to our future dir. | ||
2016 | inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` | ||
2017 | |||
2018 | # Don't allow the user to place us outside of our expected | ||
2019 | # location b/c this prevents finding dependent libraries that | ||
2020 | # are installed to the same prefix. | ||
2021 | # At present, this check doesn't affect windows .dll's that | ||
2022 | # are installed into $libdir/../bin (currently, that works fine) | ||
2023 | # but it's something to keep an eye on. | ||
2024 | test "$inst_prefix_dir" = "$destdir" && \ | ||
2025 | func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" | ||
2026 | |||
2027 | if test -n "$inst_prefix_dir"; then | ||
2028 | # Stick the inst_prefix_dir data into the link command. | ||
2029 | relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` | ||
2030 | else | ||
2031 | relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` | ||
2032 | fi | ||
2033 | |||
2034 | func_warning "relinking \`$file'" | ||
2035 | func_show_eval "$relink_command" \ | ||
2036 | 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' | ||
2037 | fi | ||
2038 | |||
2039 | # See the names of the shared library. | ||
2040 | set dummy $library_names; shift | ||
2041 | if test -n "$1"; then | ||
2042 | realname="$1" | ||
2043 | shift | ||
2044 | |||
2045 | srcname="$realname" | ||
2046 | test -n "$relink_command" && srcname="$realname"T | ||
2047 | |||
2048 | # Install the shared library and build the symlinks. | ||
2049 | func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ | ||
2050 | 'exit $?' | ||
2051 | tstripme="$stripme" | ||
2052 | case $host_os in | ||
2053 | cygwin* | mingw* | pw32* | cegcc*) | ||
2054 | case $realname in | ||
2055 | *.dll.a) | ||
2056 | tstripme="" | ||
2057 | ;; | ||
2058 | esac | ||
2059 | ;; | ||
2060 | esac | ||
2061 | if test -n "$tstripme" && test -n "$striplib"; then | ||
2062 | func_show_eval "$striplib $destdir/$realname" 'exit $?' | ||
2063 | fi | ||
2064 | |||
2065 | if test "$#" -gt 0; then | ||
2066 | # Delete the old symlinks, and create new ones. | ||
2067 | # Try `ln -sf' first, because the `ln' binary might depend on | ||
2068 | # the symlink we replace! Solaris /bin/ln does not understand -f, | ||
2069 | # so we also need to try rm && ln -s. | ||
2070 | for linkname | ||
2071 | do | ||
2072 | test "$linkname" != "$realname" \ | ||
2073 | && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" | ||
2074 | done | ||
2075 | fi | ||
2076 | |||
2077 | # Do each command in the postinstall commands. | ||
2078 | lib="$destdir/$realname" | ||
2079 | func_execute_cmds "$postinstall_cmds" 'exit $?' | ||
2080 | fi | ||
2081 | |||
2082 | # Install the pseudo-library for information purposes. | ||
2083 | func_basename "$file" | ||
2084 | name="$func_basename_result" | ||
2085 | instname="$dir/$name"i | ||
2086 | func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' | ||
2087 | |||
2088 | # Maybe install the static library, too. | ||
2089 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" | ||
2090 | ;; | ||
2091 | |||
2092 | *.lo) | ||
2093 | # Install (i.e. copy) a libtool object. | ||
2094 | |||
2095 | # Figure out destination file name, if it wasn't already specified. | ||
2096 | if test -n "$destname"; then | ||
2097 | destfile="$destdir/$destname" | ||
2098 | else | ||
2099 | func_basename "$file" | ||
2100 | destfile="$func_basename_result" | ||
2101 | destfile="$destdir/$destfile" | ||
2102 | fi | ||
2103 | |||
2104 | # Deduce the name of the destination old-style object file. | ||
2105 | case $destfile in | ||
2106 | *.lo) | ||
2107 | func_lo2o "$destfile" | ||
2108 | staticdest=$func_lo2o_result | ||
2109 | ;; | ||
2110 | *.$objext) | ||
2111 | staticdest="$destfile" | ||
2112 | destfile= | ||
2113 | ;; | ||
2114 | *) | ||
2115 | func_fatal_help "cannot copy a libtool object to \`$destfile'" | ||
2116 | ;; | ||
2117 | esac | ||
2118 | |||
2119 | # Install the libtool object if requested. | ||
2120 | test -n "$destfile" && \ | ||
2121 | func_show_eval "$install_prog $file $destfile" 'exit $?' | ||
2122 | |||
2123 | # Install the old object if enabled. | ||
2124 | if test "$build_old_libs" = yes; then | ||
2125 | # Deduce the name of the old-style object file. | ||
2126 | func_lo2o "$file" | ||
2127 | staticobj=$func_lo2o_result | ||
2128 | func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' | ||
2129 | fi | ||
2130 | exit $EXIT_SUCCESS | ||
2131 | ;; | ||
2132 | |||
2133 | *) | ||
2134 | # Figure out destination file name, if it wasn't already specified. | ||
2135 | if test -n "$destname"; then | ||
2136 | destfile="$destdir/$destname" | ||
2137 | else | ||
2138 | func_basename "$file" | ||
2139 | destfile="$func_basename_result" | ||
2140 | destfile="$destdir/$destfile" | ||
2141 | fi | ||
2142 | |||
2143 | # If the file is missing, and there is a .exe on the end, strip it | ||
2144 | # because it is most likely a libtool script we actually want to | ||
2145 | # install | ||
2146 | stripped_ext="" | ||
2147 | case $file in | ||
2148 | *.exe) | ||
2149 | if test ! -f "$file"; then | ||
2150 | func_stripname '' '.exe' "$file" | ||
2151 | file=$func_stripname_result | ||
2152 | stripped_ext=".exe" | ||
2153 | fi | ||
2154 | ;; | ||
2155 | esac | ||
2156 | |||
2157 | # Do a test to see if this is really a libtool program. | ||
2158 | case $host in | ||
2159 | *cygwin* | *mingw*) | ||
2160 | if func_ltwrapper_executable_p "$file"; then | ||
2161 | func_ltwrapper_scriptname "$file" | ||
2162 | wrapper=$func_ltwrapper_scriptname_result | ||
2163 | else | ||
2164 | func_stripname '' '.exe' "$file" | ||
2165 | wrapper=$func_stripname_result | ||
2166 | fi | ||
2167 | ;; | ||
2168 | *) | ||
2169 | wrapper=$file | ||
2170 | ;; | ||
2171 | esac | ||
2172 | if func_ltwrapper_script_p "$wrapper"; then | ||
2173 | notinst_deplibs= | ||
2174 | relink_command= | ||
2175 | |||
2176 | func_source "$wrapper" | ||
2177 | |||
2178 | # Check the variables that should have been set. | ||
2179 | test -z "$generated_by_libtool_version" && \ | ||
2180 | func_fatal_error "invalid libtool wrapper script \`$wrapper'" | ||
2181 | |||
2182 | finalize=yes | ||
2183 | for lib in $notinst_deplibs; do | ||
2184 | # Check to see that each library is installed. | ||
2185 | libdir= | ||
2186 | if test -f "$lib"; then | ||
2187 | func_source "$lib" | ||
2188 | fi | ||
2189 | libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test | ||
2190 | if test -n "$libdir" && test ! -f "$libfile"; then | ||
2191 | func_warning "\`$lib' has not been installed in \`$libdir'" | ||
2192 | finalize=no | ||
2193 | fi | ||
2194 | done | ||
2195 | |||
2196 | relink_command= | ||
2197 | func_source "$wrapper" | ||
2198 | |||
2199 | outputname= | ||
2200 | if test "$fast_install" = no && test -n "$relink_command"; then | ||
2201 | $opt_dry_run || { | ||
2202 | if test "$finalize" = yes; then | ||
2203 | tmpdir=`func_mktempdir` | ||
2204 | func_basename "$file$stripped_ext" | ||
2205 | file="$func_basename_result" | ||
2206 | outputname="$tmpdir/$file" | ||
2207 | # Replace the output file specification. | ||
2208 | relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` | ||
2209 | |||
2210 | $opt_silent || { | ||
2211 | func_quote_for_expand "$relink_command" | ||
2212 | eval "func_echo $func_quote_for_expand_result" | ||
2213 | } | ||
2214 | if eval "$relink_command"; then : | ||
2215 | else | ||
2216 | func_error "error: relink \`$file' with the above command before installing it" | ||
2217 | $opt_dry_run || ${RM}r "$tmpdir" | ||
2218 | continue | ||
2219 | fi | ||
2220 | file="$outputname" | ||
2221 | else | ||
2222 | func_warning "cannot relink \`$file'" | ||
2223 | fi | ||
2224 | } | ||
2225 | else | ||
2226 | # Install the binary that we compiled earlier. | ||
2227 | file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` | ||
2228 | fi | ||
2229 | fi | ||
2230 | |||
2231 | # remove .exe since cygwin /usr/bin/install will append another | ||
2232 | # one anyway | ||
2233 | case $install_prog,$host in | ||
2234 | */usr/bin/install*,*cygwin*) | ||
2235 | case $file:$destfile in | ||
2236 | *.exe:*.exe) | ||
2237 | # this is ok | ||
2238 | ;; | ||
2239 | *.exe:*) | ||
2240 | destfile=$destfile.exe | ||
2241 | ;; | ||
2242 | *:*.exe) | ||
2243 | func_stripname '' '.exe' "$destfile" | ||
2244 | destfile=$func_stripname_result | ||
2245 | ;; | ||
2246 | esac | ||
2247 | ;; | ||
2248 | esac | ||
2249 | func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' | ||
2250 | $opt_dry_run || if test -n "$outputname"; then | ||
2251 | ${RM}r "$tmpdir" | ||
2252 | fi | ||
2253 | ;; | ||
2254 | esac | ||
2255 | done | ||
2256 | |||
2257 | for file in $staticlibs; do | ||
2258 | func_basename "$file" | ||
2259 | name="$func_basename_result" | ||
2260 | |||
2261 | # Set up the ranlib parameters. | ||
2262 | oldlib="$destdir/$name" | ||
2263 | |||
2264 | func_show_eval "$install_prog \$file \$oldlib" 'exit $?' | ||
2265 | |||
2266 | if test -n "$stripme" && test -n "$old_striplib"; then | ||
2267 | func_show_eval "$old_striplib $oldlib" 'exit $?' | ||
2268 | fi | ||
2269 | |||
2270 | # Do each command in the postinstall commands. | ||
2271 | func_execute_cmds "$old_postinstall_cmds" 'exit $?' | ||
2272 | done | ||
2273 | |||
2274 | test -n "$future_libdirs" && \ | ||
2275 | func_warning "remember to run \`$progname --finish$future_libdirs'" | ||
2276 | |||
2277 | if test -n "$current_libdirs"; then | ||
2278 | # Maybe just do a dry run. | ||
2279 | $opt_dry_run && current_libdirs=" -n$current_libdirs" | ||
2280 | exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' | ||
2281 | else | ||
2282 | exit $EXIT_SUCCESS | ||
2283 | fi | ||
2284 | } | ||
2285 | |||
2286 | test "$mode" = install && func_mode_install ${1+"$@"} | ||
2287 | |||
2288 | |||
2289 | # func_generate_dlsyms outputname originator pic_p | ||
2290 | # Extract symbols from dlprefiles and create ${outputname}S.o with | ||
2291 | # a dlpreopen symbol table. | ||
2292 | func_generate_dlsyms () | ||
2293 | { | ||
2294 | $opt_debug | ||
2295 | my_outputname="$1" | ||
2296 | my_originator="$2" | ||
2297 | my_pic_p="${3-no}" | ||
2298 | my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` | ||
2299 | my_dlsyms= | ||
2300 | |||
2301 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then | ||
2302 | if test -n "$NM" && test -n "$global_symbol_pipe"; then | ||
2303 | my_dlsyms="${my_outputname}S.c" | ||
2304 | else | ||
2305 | func_error "not configured to extract global symbols from dlpreopened files" | ||
2306 | fi | ||
2307 | fi | ||
2308 | |||
2309 | if test -n "$my_dlsyms"; then | ||
2310 | case $my_dlsyms in | ||
2311 | "") ;; | ||
2312 | *.c) | ||
2313 | # Discover the nlist of each of the dlfiles. | ||
2314 | nlist="$output_objdir/${my_outputname}.nm" | ||
2315 | |||
2316 | func_show_eval "$RM $nlist ${nlist}S ${nlist}T" | ||
2317 | |||
2318 | # Parse the name list into a source file. | ||
2319 | func_verbose "creating $output_objdir/$my_dlsyms" | ||
2320 | |||
2321 | $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ | ||
2322 | /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ | ||
2323 | /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ | ||
2324 | |||
2325 | #ifdef __cplusplus | ||
2326 | extern \"C\" { | ||
2327 | #endif | ||
2328 | |||
2329 | /* External symbol declarations for the compiler. */\ | ||
2330 | " | ||
2331 | |||
2332 | if test "$dlself" = yes; then | ||
2333 | func_verbose "generating symbol list for \`$output'" | ||
2334 | |||
2335 | $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" | ||
2336 | |||
2337 | # Add our own program objects to the symbol list. | ||
2338 | progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` | ||
2339 | for progfile in $progfiles; do | ||
2340 | func_verbose "extracting global C symbols from \`$progfile'" | ||
2341 | $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" | ||
2342 | done | ||
2343 | |||
2344 | if test -n "$exclude_expsyms"; then | ||
2345 | $opt_dry_run || { | ||
2346 | eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' | ||
2347 | eval '$MV "$nlist"T "$nlist"' | ||
2348 | } | ||
2349 | fi | ||
2350 | |||
2351 | if test -n "$export_symbols_regex"; then | ||
2352 | $opt_dry_run || { | ||
2353 | eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' | ||
2354 | eval '$MV "$nlist"T "$nlist"' | ||
2355 | } | ||
2356 | fi | ||
2357 | |||
2358 | # Prepare the list of exported symbols | ||
2359 | if test -z "$export_symbols"; then | ||
2360 | export_symbols="$output_objdir/$outputname.exp" | ||
2361 | $opt_dry_run || { | ||
2362 | $RM $export_symbols | ||
2363 | eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' | ||
2364 | case $host in | ||
2365 | *cygwin* | *mingw* | *cegcc* ) | ||
2366 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' | ||
2367 | eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' | ||
2368 | ;; | ||
2369 | esac | ||
2370 | } | ||
2371 | else | ||
2372 | $opt_dry_run || { | ||
2373 | eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' | ||
2374 | eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' | ||
2375 | eval '$MV "$nlist"T "$nlist"' | ||
2376 | case $host in | ||
2377 | *cygwin | *mingw* | *cegcc* ) | ||
2378 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' | ||
2379 | eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' | ||
2380 | ;; | ||
2381 | esac | ||
2382 | } | ||
2383 | fi | ||
2384 | fi | ||
2385 | |||
2386 | for dlprefile in $dlprefiles; do | ||
2387 | func_verbose "extracting global C symbols from \`$dlprefile'" | ||
2388 | func_basename "$dlprefile" | ||
2389 | name="$func_basename_result" | ||
2390 | $opt_dry_run || { | ||
2391 | eval '$ECHO ": $name " >> "$nlist"' | ||
2392 | eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" | ||
2393 | } | ||
2394 | done | ||
2395 | |||
2396 | $opt_dry_run || { | ||
2397 | # Make sure we have at least an empty file. | ||
2398 | test -f "$nlist" || : > "$nlist" | ||
2399 | |||
2400 | if test -n "$exclude_expsyms"; then | ||
2401 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T | ||
2402 | $MV "$nlist"T "$nlist" | ||
2403 | fi | ||
2404 | |||
2405 | # Try sorting and uniquifying the output. | ||
2406 | if $GREP -v "^: " < "$nlist" | | ||
2407 | if sort -k 3 </dev/null >/dev/null 2>&1; then | ||
2408 | sort -k 3 | ||
2409 | else | ||
2410 | sort +2 | ||
2411 | fi | | ||
2412 | uniq > "$nlist"S; then | ||
2413 | : | ||
2414 | else | ||
2415 | $GREP -v "^: " < "$nlist" > "$nlist"S | ||
2416 | fi | ||
2417 | |||
2418 | if test -f "$nlist"S; then | ||
2419 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' | ||
2420 | else | ||
2421 | $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" | ||
2422 | fi | ||
2423 | |||
2424 | $ECHO >> "$output_objdir/$my_dlsyms" "\ | ||
2425 | |||
2426 | /* The mapping between symbol names and symbols. */ | ||
2427 | typedef struct { | ||
2428 | const char *name; | ||
2429 | void *address; | ||
2430 | } lt_dlsymlist; | ||
2431 | " | ||
2432 | case $host in | ||
2433 | *cygwin* | *mingw* | *cegcc* ) | ||
2434 | $ECHO >> "$output_objdir/$my_dlsyms" "\ | ||
2435 | /* DATA imports from DLLs on WIN32 con't be const, because | ||
2436 | runtime relocations are performed -- see ld's documentation | ||
2437 | on pseudo-relocs. */" | ||
2438 | lt_dlsym_const= ;; | ||
2439 | *osf5*) | ||
2440 | echo >> "$output_objdir/$my_dlsyms" "\ | ||
2441 | /* This system does not cope well with relocations in const data */" | ||
2442 | lt_dlsym_const= ;; | ||
2443 | *) | ||
2444 | lt_dlsym_const=const ;; | ||
2445 | esac | ||
2446 | |||
2447 | $ECHO >> "$output_objdir/$my_dlsyms" "\ | ||
2448 | extern $lt_dlsym_const lt_dlsymlist | ||
2449 | lt_${my_prefix}_LTX_preloaded_symbols[]; | ||
2450 | $lt_dlsym_const lt_dlsymlist | ||
2451 | lt_${my_prefix}_LTX_preloaded_symbols[] = | ||
2452 | {\ | ||
2453 | { \"$my_originator\", (void *) 0 }," | ||
2454 | |||
2455 | case $need_lib_prefix in | ||
2456 | no) | ||
2457 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" | ||
2458 | ;; | ||
2459 | *) | ||
2460 | eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" | ||
2461 | ;; | ||
2462 | esac | ||
2463 | $ECHO >> "$output_objdir/$my_dlsyms" "\ | ||
2464 | {0, (void *) 0} | ||
2465 | }; | ||
2466 | |||
2467 | /* This works around a problem in FreeBSD linker */ | ||
2468 | #ifdef FREEBSD_WORKAROUND | ||
2469 | static const void *lt_preloaded_setup() { | ||
2470 | return lt_${my_prefix}_LTX_preloaded_symbols; | ||
2471 | } | ||
2472 | #endif | ||
2473 | |||
2474 | #ifdef __cplusplus | ||
2475 | } | ||
2476 | #endif\ | ||
2477 | " | ||
2478 | } # !$opt_dry_run | ||
2479 | |||
2480 | pic_flag_for_symtable= | ||
2481 | case "$compile_command " in | ||
2482 | *" -static "*) ;; | ||
2483 | *) | ||
2484 | case $host in | ||
2485 | # compiling the symbol table file with pic_flag works around | ||
2486 | # a FreeBSD bug that causes programs to crash when -lm is | ||
2487 | # linked before any other PIC object. But we must not use | ||
2488 | # pic_flag when linking with -static. The problem exists in | ||
2489 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. | ||
2490 | *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) | ||
2491 | pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; | ||
2492 | *-*-hpux*) | ||
2493 | pic_flag_for_symtable=" $pic_flag" ;; | ||
2494 | *) | ||
2495 | if test "X$my_pic_p" != Xno; then | ||
2496 | pic_flag_for_symtable=" $pic_flag" | ||
2497 | fi | ||
2498 | ;; | ||
2499 | esac | ||
2500 | ;; | ||
2501 | esac | ||
2502 | symtab_cflags= | ||
2503 | for arg in $LTCFLAGS; do | ||
2504 | case $arg in | ||
2505 | -pie | -fpie | -fPIE) ;; | ||
2506 | *) symtab_cflags="$symtab_cflags $arg" ;; | ||
2507 | esac | ||
2508 | done | ||
2509 | |||
2510 | # Now compile the dynamic symbol file. | ||
2511 | func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' | ||
2512 | |||
2513 | # Clean up the generated files. | ||
2514 | func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' | ||
2515 | |||
2516 | # Transform the symbol file into the correct name. | ||
2517 | symfileobj="$output_objdir/${my_outputname}S.$objext" | ||
2518 | case $host in | ||
2519 | *cygwin* | *mingw* | *cegcc* ) | ||
2520 | if test -f "$output_objdir/$my_outputname.def"; then | ||
2521 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` | ||
2522 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` | ||
2523 | else | ||
2524 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` | ||
2525 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` | ||
2526 | fi | ||
2527 | ;; | ||
2528 | *) | ||
2529 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` | ||
2530 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` | ||
2531 | ;; | ||
2532 | esac | ||
2533 | ;; | ||
2534 | *) | ||
2535 | func_fatal_error "unknown suffix for \`$my_dlsyms'" | ||
2536 | ;; | ||
2537 | esac | ||
2538 | else | ||
2539 | # We keep going just in case the user didn't refer to | ||
2540 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe | ||
2541 | # really was required. | ||
2542 | |||
2543 | # Nullify the symbol file. | ||
2544 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` | ||
2545 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` | ||
2546 | fi | ||
2547 | } | ||
2548 | |||
2549 | # func_win32_libid arg | ||
2550 | # return the library type of file 'arg' | ||
2551 | # | ||
2552 | # Need a lot of goo to handle *both* DLLs and import libs | ||
2553 | # Has to be a shell function in order to 'eat' the argument | ||
2554 | # that is supplied when $file_magic_command is called. | ||
2555 | func_win32_libid () | ||
2556 | { | ||
2557 | $opt_debug | ||
2558 | win32_libid_type="unknown" | ||
2559 | win32_fileres=`file -L $1 2>/dev/null` | ||
2560 | case $win32_fileres in | ||
2561 | *ar\ archive\ import\ library*) # definitely import | ||
2562 | win32_libid_type="x86 archive import" | ||
2563 | michael | 912 | ;; |
2564 | michael | 945 | *ar\ archive*) # could be an import, or static |
2565 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | | ||
2566 | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then | ||
2567 | win32_nmres=`eval $NM -f posix -A $1 | | ||
2568 | $SED -n -e ' | ||
2569 | 1,100{ | ||
2570 | / I /{ | ||
2571 | s,.*,import, | ||
2572 | p | ||
2573 | q | ||
2574 | } | ||
2575 | }'` | ||
2576 | case $win32_nmres in | ||
2577 | import*) win32_libid_type="x86 archive import";; | ||
2578 | *) win32_libid_type="x86 archive static";; | ||
2579 | esac | ||
2580 | fi | ||
2581 | ;; | ||
2582 | *DLL*) | ||
2583 | win32_libid_type="x86 DLL" | ||
2584 | ;; | ||
2585 | *executable*) # but shell scripts are "executable" too... | ||
2586 | case $win32_fileres in | ||
2587 | *MS\ Windows\ PE\ Intel*) | ||
2588 | win32_libid_type="x86 DLL" | ||
2589 | ;; | ||
2590 | esac | ||
2591 | ;; | ||
2592 | esac | ||
2593 | $ECHO "$win32_libid_type" | ||
2594 | } | ||
2595 | michael | 912 | |
2596 | michael | 945 | |
2597 | |||
2598 | # func_extract_an_archive dir oldlib | ||
2599 | func_extract_an_archive () | ||
2600 | { | ||
2601 | $opt_debug | ||
2602 | f_ex_an_ar_dir="$1"; shift | ||
2603 | f_ex_an_ar_oldlib="$1" | ||
2604 | func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' | ||
2605 | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then | ||
2606 | : | ||
2607 | else | ||
2608 | func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" | ||
2609 | fi | ||
2610 | } | ||
2611 | |||
2612 | |||
2613 | # func_extract_archives gentop oldlib ... | ||
2614 | func_extract_archives () | ||
2615 | { | ||
2616 | $opt_debug | ||
2617 | my_gentop="$1"; shift | ||
2618 | my_oldlibs=${1+"$@"} | ||
2619 | my_oldobjs="" | ||
2620 | my_xlib="" | ||
2621 | my_xabs="" | ||
2622 | my_xdir="" | ||
2623 | |||
2624 | for my_xlib in $my_oldlibs; do | ||
2625 | # Extract the objects. | ||
2626 | case $my_xlib in | ||
2627 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; | ||
2628 | *) my_xabs=`pwd`"/$my_xlib" ;; | ||
2629 | esac | ||
2630 | func_basename "$my_xlib" | ||
2631 | my_xlib="$func_basename_result" | ||
2632 | my_xlib_u=$my_xlib | ||
2633 | while :; do | ||
2634 | case " $extracted_archives " in | ||
2635 | *" $my_xlib_u "*) | ||
2636 | func_arith $extracted_serial + 1 | ||
2637 | extracted_serial=$func_arith_result | ||
2638 | my_xlib_u=lt$extracted_serial-$my_xlib ;; | ||
2639 | *) break ;; | ||
2640 | esac | ||
2641 | done | ||
2642 | extracted_archives="$extracted_archives $my_xlib_u" | ||
2643 | my_xdir="$my_gentop/$my_xlib_u" | ||
2644 | |||
2645 | func_mkdir_p "$my_xdir" | ||
2646 | |||
2647 | case $host in | ||
2648 | *-darwin*) | ||
2649 | func_verbose "Extracting $my_xabs" | ||
2650 | # Do not bother doing anything if just a dry run | ||
2651 | $opt_dry_run || { | ||
2652 | darwin_orig_dir=`pwd` | ||
2653 | cd $my_xdir || exit $? | ||
2654 | darwin_archive=$my_xabs | ||
2655 | darwin_curdir=`pwd` | ||
2656 | darwin_base_archive=`basename "$darwin_archive"` | ||
2657 | darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` | ||
2658 | if test -n "$darwin_arches"; then | ||
2659 | darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` | ||
2660 | darwin_arch= | ||
2661 | func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" | ||
2662 | for darwin_arch in $darwin_arches ; do | ||
2663 | func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" | ||
2664 | $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" | ||
2665 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" | ||
2666 | func_extract_an_archive "`pwd`" "${darwin_base_archive}" | ||
2667 | cd "$darwin_curdir" | ||
2668 | $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" | ||
2669 | done # $darwin_arches | ||
2670 | ## Okay now we've a bunch of thin objects, gotta fatten them up :) | ||
2671 | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` | ||
2672 | darwin_file= | ||
2673 | darwin_files= | ||
2674 | for darwin_file in $darwin_filelist; do | ||
2675 | darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` | ||
2676 | $LIPO -create -output "$darwin_file" $darwin_files | ||
2677 | done # $darwin_filelist | ||
2678 | $RM -rf unfat-$$ | ||
2679 | cd "$darwin_orig_dir" | ||
2680 | else | ||
2681 | cd $darwin_orig_dir | ||
2682 | func_extract_an_archive "$my_xdir" "$my_xabs" | ||
2683 | fi # $darwin_arches | ||
2684 | } # !$opt_dry_run | ||
2685 | ;; | ||
2686 | *) | ||
2687 | func_extract_an_archive "$my_xdir" "$my_xabs" | ||
2688 | ;; | ||
2689 | esac | ||
2690 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` | ||
2691 | done | ||
2692 | |||
2693 | func_extract_archives_result="$my_oldobjs" | ||
2694 | } | ||
2695 | |||
2696 | |||
2697 | |||
2698 | # func_emit_wrapper_part1 [arg=no] | ||
2699 | # | ||
2700 | # Emit the first part of a libtool wrapper script on stdout. | ||
2701 | # For more information, see the description associated with | ||
2702 | # func_emit_wrapper(), below. | ||
2703 | func_emit_wrapper_part1 () | ||
2704 | { | ||
2705 | func_emit_wrapper_part1_arg1=no | ||
2706 | if test -n "$1" ; then | ||
2707 | func_emit_wrapper_part1_arg1=$1 | ||
2708 | fi | ||
2709 | |||
2710 | $ECHO "\ | ||
2711 | #! $SHELL | ||
2712 | |||
2713 | # $output - temporary wrapper script for $objdir/$outputname | ||
2714 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION | ||
2715 | # | ||
2716 | # The $output program cannot be directly executed until all the libtool | ||
2717 | # libraries that it depends on are installed. | ||
2718 | # | ||
2719 | # This wrapper script should never be moved out of the build directory. | ||
2720 | # If it is, it will not operate correctly. | ||
2721 | |||
2722 | # Sed substitution that helps us do robust quoting. It backslashifies | ||
2723 | # metacharacters that are still active within double-quoted strings. | ||
2724 | Xsed='${SED} -e 1s/^X//' | ||
2725 | sed_quote_subst='$sed_quote_subst' | ||
2726 | |||
2727 | # Be Bourne compatible | ||
2728 | if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then | ||
2729 | emulate sh | ||
2730 | NULLCMD=: | ||
2731 | # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which | ||
2732 | # is contrary to our usage. Disable this feature. | ||
2733 | alias -g '\${1+\"\$@\"}'='\"\$@\"' | ||
2734 | setopt NO_GLOB_SUBST | ||
2735 | else | ||
2736 | case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac | ||
2737 | fi | ||
2738 | BIN_SH=xpg4; export BIN_SH # for Tru64 | ||
2739 | DUALCASE=1; export DUALCASE # for MKS sh | ||
2740 | |||
2741 | # The HP-UX ksh and POSIX shell print the target directory to stdout | ||
2742 | # if CDPATH is set. | ||
2743 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH | ||
2744 | |||
2745 | relink_command=\"$relink_command\" | ||
2746 | |||
2747 | # This environment variable determines our operation mode. | ||
2748 | if test \"\$libtool_install_magic\" = \"$magic\"; then | ||
2749 | # install mode needs the following variables: | ||
2750 | generated_by_libtool_version='$macro_version' | ||
2751 | notinst_deplibs='$notinst_deplibs' | ||
2752 | else | ||
2753 | # When we are sourced in execute mode, \$file and \$ECHO are already set. | ||
2754 | if test \"\$libtool_execute_magic\" != \"$magic\"; then | ||
2755 | ECHO=\"$qecho\" | ||
2756 | file=\"\$0\" | ||
2757 | # Make sure echo works. | ||
2758 | if test \"X\$1\" = X--no-reexec; then | ||
2759 | # Discard the --no-reexec flag, and continue. | ||
2760 | shift | ||
2761 | elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then | ||
2762 | # Yippee, \$ECHO works! | ||
2763 | : | ||
2764 | else | ||
2765 | # Restart under the correct shell, and then maybe \$ECHO will work. | ||
2766 | exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} | ||
2767 | fi | ||
2768 | fi\ | ||
2769 | " | ||
2770 | $ECHO "\ | ||
2771 | |||
2772 | # Find the directory that this script lives in. | ||
2773 | thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` | ||
2774 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. | ||
2775 | |||
2776 | # Follow symbolic links until we get to the real thisdir. | ||
2777 | file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` | ||
2778 | while test -n \"\$file\"; do | ||
2779 | destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` | ||
2780 | |||
2781 | # If there was a directory component, then change thisdir. | ||
2782 | if test \"x\$destdir\" != \"x\$file\"; then | ||
2783 | case \"\$destdir\" in | ||
2784 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; | ||
2785 | *) thisdir=\"\$thisdir/\$destdir\" ;; | ||
2786 | esac | ||
2787 | fi | ||
2788 | |||
2789 | file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` | ||
2790 | file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` | ||
2791 | done | ||
2792 | " | ||
2793 | } | ||
2794 | # end: func_emit_wrapper_part1 | ||
2795 | |||
2796 | # func_emit_wrapper_part2 [arg=no] | ||
2797 | # | ||
2798 | # Emit the second part of a libtool wrapper script on stdout. | ||
2799 | # For more information, see the description associated with | ||
2800 | # func_emit_wrapper(), below. | ||
2801 | func_emit_wrapper_part2 () | ||
2802 | { | ||
2803 |