1 | # ltmain.sh - Provide generalized library-building support services. |
---|
2 | # NOTE: Changing this file will not affect anything until you rerun configure. |
---|
3 | # |
---|
4 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 |
---|
5 | # Free Software Foundation, Inc. |
---|
6 | # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
---|
7 | # |
---|
8 | # This program is free software; you can redistribute it and/or modify |
---|
9 | # it under the terms of the GNU General Public License as published by |
---|
10 | # the Free Software Foundation; either version 2 of the License, or |
---|
11 | # (at your option) any later version. |
---|
12 | # |
---|
13 | # This program is distributed in the hope that it will be useful, but |
---|
14 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 | # General Public License for more details. |
---|
17 | # |
---|
18 | # You should have received a copy of the GNU General Public License |
---|
19 | # along with this program; if not, write to the Free Software |
---|
20 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
21 | # |
---|
22 | # As a special exception to the GNU General Public License, if you |
---|
23 | # distribute this file as part of a program that contains a |
---|
24 | # configuration script generated by Autoconf, you may include it under |
---|
25 | # the same distribution terms that you use for the rest of that program. |
---|
26 | |
---|
27 | basename="s,^.*/,,g" |
---|
28 | |
---|
29 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh |
---|
30 | # is ksh but when the shell is invoked as "sh" and the current value of |
---|
31 | # the _XPG environment variable is not equal to 1 (one), the special |
---|
32 | # positional parameter $0, within a function call, is the name of the |
---|
33 | # function. |
---|
34 | progpath="$0" |
---|
35 | |
---|
36 | # RH: define SED for historic ltconfig's generated by Libtool 1.3 |
---|
37 | [ -z "$SED" ] && SED=sed |
---|
38 | |
---|
39 | # The name of this program: |
---|
40 | progname=`echo "$progpath" | $SED $basename` |
---|
41 | modename="$progname" |
---|
42 | |
---|
43 | # Global variables: |
---|
44 | EXIT_SUCCESS=0 |
---|
45 | EXIT_FAILURE=1 |
---|
46 | |
---|
47 | PROGRAM=ltmain.sh |
---|
48 | PACKAGE=libtool |
---|
49 | VERSION=1.5.8 |
---|
50 | TIMESTAMP=" (1.1220.2.117 2004/08/04 14:12:05)" |
---|
51 | |
---|
52 | # See if we are running on zsh, and set the options which allow our |
---|
53 | # commands through without removal of \ escapes. |
---|
54 | if test -n "${ZSH_VERSION+set}" ; then |
---|
55 | setopt NO_GLOB_SUBST |
---|
56 | fi |
---|
57 | |
---|
58 | # Check that we have a working $echo. |
---|
59 | if test "X$1" = X--no-reexec; then |
---|
60 | # Discard the --no-reexec flag, and continue. |
---|
61 | shift |
---|
62 | elif test "X$1" = X--fallback-echo; then |
---|
63 | # Avoid inline document here, it may be left over |
---|
64 | : |
---|
65 | elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then |
---|
66 | # Yippee, $echo works! |
---|
67 | : |
---|
68 | else |
---|
69 | # Restart under the correct shell, and then maybe $echo will work. |
---|
70 | exec $SHELL "$progpath" --no-reexec ${1+"$@"} |
---|
71 | fi |
---|
72 | |
---|
73 | if test "X$1" = X--fallback-echo; then |
---|
74 | # used as fallback echo |
---|
75 | shift |
---|
76 | cat <<EOF |
---|
77 | $* |
---|
78 | EOF |
---|
79 | exit $EXIT_SUCCESS |
---|
80 | fi |
---|
81 | |
---|
82 | default_mode= |
---|
83 | help="Try \`$progname --help' for more information." |
---|
84 | magic="%%%MAGIC variable%%%" |
---|
85 | mkdir="mkdir" |
---|
86 | mv="mv -f" |
---|
87 | rm="rm -f" |
---|
88 | |
---|
89 | # Sed substitution that helps us do robust quoting. It backslashifies |
---|
90 | # metacharacters that are still active within double-quoted strings. |
---|
91 | Xsed="${SED}"' -e 1s/^X//' |
---|
92 | sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' |
---|
93 | # test EBCDIC or ASCII |
---|
94 | case `echo A|tr A '\301'` in |
---|
95 | A) # EBCDIC based system |
---|
96 | SP2NL="tr '\100' '\n'" |
---|
97 | NL2SP="tr '\r\n' '\100\100'" |
---|
98 | ;; |
---|
99 | *) # Assume ASCII based system |
---|
100 | SP2NL="tr '\040' '\012'" |
---|
101 | NL2SP="tr '\015\012' '\040\040'" |
---|
102 | ;; |
---|
103 | esac |
---|
104 | |
---|
105 | # NLS nuisances. |
---|
106 | # Only set LANG and LC_ALL to C if already set. |
---|
107 | # These must not be set unconditionally because not all systems understand |
---|
108 | # e.g. LANG=C (notably SCO). |
---|
109 | # We save the old values to restore during execute mode. |
---|
110 | if test "${LC_ALL+set}" = set; then |
---|
111 | save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL |
---|
112 | fi |
---|
113 | if test "${LANG+set}" = set; then |
---|
114 | save_LANG="$LANG"; LANG=C; export LANG |
---|
115 | fi |
---|
116 | |
---|
117 | # Make sure IFS has a sensible default |
---|
118 | : ${IFS=" |
---|
119 | "} |
---|
120 | |
---|
121 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
---|
122 | $echo "$modename: not configured to build any kind of library" 1>&2 |
---|
123 | $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
---|
124 | exit $EXIT_FAILURE |
---|
125 | fi |
---|
126 | |
---|
127 | # Global variables. |
---|
128 | mode=$default_mode |
---|
129 | nonopt= |
---|
130 | prev= |
---|
131 | prevopt= |
---|
132 | run= |
---|
133 | show="$echo" |
---|
134 | show_help= |
---|
135 | execute_dlfiles= |
---|
136 | lo2o="s/\\.lo\$/.${objext}/" |
---|
137 | o2lo="s/\\.${objext}\$/.lo/" |
---|
138 | |
---|
139 | ##################################### |
---|
140 | # Shell function definitions: |
---|
141 | # This seems to be the best place for them |
---|
142 | |
---|
143 | # func_win32_libid arg |
---|
144 | # return the library type of file 'arg' |
---|
145 | # |
---|
146 | # Need a lot of goo to handle *both* DLLs and import libs |
---|
147 | # Has to be a shell function in order to 'eat' the argument |
---|
148 | # that is supplied when $file_magic_command is called. |
---|
149 | func_win32_libid () { |
---|
150 | win32_libid_type="unknown" |
---|
151 | win32_fileres=`file -L $1 2>/dev/null` |
---|
152 | case $win32_fileres in |
---|
153 | *ar\ archive\ import\ library*) # definitely import |
---|
154 | win32_libid_type="x86 archive import" |
---|
155 | ;; |
---|
156 | *ar\ archive*) # could be an import, or static |
---|
157 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ |
---|
158 | $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then |
---|
159 | win32_nmres=`eval $NM -f posix -A $1 | \ |
---|
160 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` |
---|
161 | if test "X$win32_nmres" = "Ximport" ; then |
---|
162 | win32_libid_type="x86 archive import" |
---|
163 | else |
---|
164 | win32_libid_type="x86 archive static" |
---|
165 | fi |
---|
166 | fi |
---|
167 | ;; |
---|
168 | *DLL*) |
---|
169 | win32_libid_type="x86 DLL" |
---|
170 | ;; |
---|
171 | *executable*) # but shell scripts are "executable" too... |
---|
172 | case $win32_fileres in |
---|
173 | *MS\ Windows\ PE\ Intel*) |
---|
174 | win32_libid_type="x86 DLL" |
---|
175 | ;; |
---|
176 | esac |
---|
177 | ;; |
---|
178 | esac |
---|
179 | $echo $win32_libid_type |
---|
180 | } |
---|
181 | |
---|
182 | |
---|
183 | # func_infer_tag arg |
---|
184 | # Infer tagged configuration to use if any are available and |
---|
185 | # if one wasn't chosen via the "--tag" command line option. |
---|
186 | # Only attempt this if the compiler in the base compile |
---|
187 | # command doesn't match the default compiler. |
---|
188 | # arg is usually of the form 'gcc ...' |
---|
189 | func_infer_tag () { |
---|
190 | if test -n "$available_tags" && test -z "$tagname"; then |
---|
191 | CC_quoted= |
---|
192 | for arg in $CC; do |
---|
193 | case $arg in |
---|
194 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
195 | arg="\"$arg\"" |
---|
196 | ;; |
---|
197 | esac |
---|
198 | CC_quoted="$CC_quoted $arg" |
---|
199 | done |
---|
200 | case $@ in |
---|
201 | # Blanks in the command may have been stripped by the calling shell, |
---|
202 | # but not from the CC environment variable when configure was run. |
---|
203 | " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; |
---|
204 | # Blanks at the start of $base_compile will cause this to fail |
---|
205 | # if we don't check for them as well. |
---|
206 | *) |
---|
207 | for z in $available_tags; do |
---|
208 | if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then |
---|
209 | # Evaluate the configuration. |
---|
210 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" |
---|
211 | CC_quoted= |
---|
212 | for arg in $CC; do |
---|
213 | # Double-quote args containing other shell metacharacters. |
---|
214 | case $arg in |
---|
215 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
216 | arg="\"$arg\"" |
---|
217 | ;; |
---|
218 | esac |
---|
219 | CC_quoted="$CC_quoted $arg" |
---|
220 | done |
---|
221 | case "$@ " in |
---|
222 | " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) |
---|
223 | # The compiler in the base compile command matches |
---|
224 | # the one in the tagged configuration. |
---|
225 | # Assume this is the tagged configuration we want. |
---|
226 | tagname=$z |
---|
227 | break |
---|
228 | ;; |
---|
229 | esac |
---|
230 | fi |
---|
231 | done |
---|
232 | # If $tagname still isn't set, then no tagged configuration |
---|
233 | # was found and let the user know that the "--tag" command |
---|
234 | # line option must be used. |
---|
235 | if test -z "$tagname"; then |
---|
236 | $echo "$modename: unable to infer tagged configuration" |
---|
237 | $echo "$modename: specify a tag with \`--tag'" 1>&2 |
---|
238 | exit $EXIT_FAILURE |
---|
239 | # else |
---|
240 | # $echo "$modename: using $tagname tagged configuration" |
---|
241 | fi |
---|
242 | ;; |
---|
243 | esac |
---|
244 | fi |
---|
245 | } |
---|
246 | |
---|
247 | |
---|
248 | # func_extract_archives gentop oldlib ... |
---|
249 | func_extract_archives () { |
---|
250 | my_gentop="$1"; shift |
---|
251 | my_oldlibs=${1+"$@"} |
---|
252 | my_oldobjs="" |
---|
253 | my_xlib="" |
---|
254 | my_xabs="" |
---|
255 | my_xdir="" |
---|
256 | my_status="" |
---|
257 | |
---|
258 | $show "${rm}r $my_gentop" |
---|
259 | $run ${rm}r "$my_gentop" |
---|
260 | $show "$mkdir $my_gentop" |
---|
261 | $run $mkdir "$my_gentop" |
---|
262 | my_status=$? |
---|
263 | if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then |
---|
264 | exit $my_status |
---|
265 | fi |
---|
266 | |
---|
267 | for my_xlib in $my_oldlibs; do |
---|
268 | # Extract the objects. |
---|
269 | case $my_xlib in |
---|
270 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; |
---|
271 | *) my_xabs=`pwd`"/$my_xlib" ;; |
---|
272 | esac |
---|
273 | my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` |
---|
274 | my_xdir="$my_gentop/$my_xlib" |
---|
275 | |
---|
276 | $show "${rm}r $my_xdir" |
---|
277 | $run ${rm}r "$my_xdir" |
---|
278 | $show "$mkdir $my_xdir" |
---|
279 | $run $mkdir "$my_xdir" |
---|
280 | status=$? |
---|
281 | if test "$status" -ne 0 && test ! -d "$my_xdir"; then |
---|
282 | exit $status |
---|
283 | fi |
---|
284 | case $host in |
---|
285 | *-darwin*) |
---|
286 | $show "Extracting $my_xabs" |
---|
287 | # Do not bother doing anything if just a dry run |
---|
288 | if test -z "$run"; then |
---|
289 | darwin_orig_dir=`pwd` |
---|
290 | cd $my_xdir || exit $? |
---|
291 | darwin_archive=$my_xabs |
---|
292 | darwin_curdir=`pwd` |
---|
293 | darwin_base_archive=`basename $darwin_archive` |
---|
294 | darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` |
---|
295 | if test -n "$darwin_arches"; then |
---|
296 | darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` |
---|
297 | darwin_arch= |
---|
298 | $show "$darwin_base_archive has multiple architectures $darwin_arches" |
---|
299 | for darwin_arch in $darwin_arches ; do |
---|
300 | mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
---|
301 | lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" |
---|
302 | # Remove the table of contents from the thin files. |
---|
303 | $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true |
---|
304 | $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true |
---|
305 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
---|
306 | $AR -xo "${darwin_base_archive}" |
---|
307 | rm "${darwin_base_archive}" |
---|
308 | cd "$darwin_curdir" |
---|
309 | done # $darwin_arches |
---|
310 | ## Okay now we have a bunch of thin objects, gotta fatten them up :) |
---|
311 | darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` |
---|
312 | darwin_file= |
---|
313 | darwin_files= |
---|
314 | for darwin_file in $darwin_filelist; do |
---|
315 | darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` |
---|
316 | lipo -create -output "$darwin_file" $darwin_files |
---|
317 | done # $darwin_filelist |
---|
318 | rm -rf unfat-$$ |
---|
319 | cd "$darwin_orig_dir" |
---|
320 | else |
---|
321 | cd $darwin_orig_dir |
---|
322 | (cd $my_xdir && $AR x $my_xabs) || exit $? |
---|
323 | fi # $darwin_arches |
---|
324 | fi # $run |
---|
325 | ;; |
---|
326 | *) |
---|
327 | # We will extract separately just the conflicting names and we will |
---|
328 | # no longer touch any unique names. It is faster to leave these |
---|
329 | # extract automatically by $AR in one run. |
---|
330 | $show "(cd $my_xdir && $AR x $my_xabs)" |
---|
331 | $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? |
---|
332 | if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then |
---|
333 | : |
---|
334 | else |
---|
335 | $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 |
---|
336 | $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 |
---|
337 | $AR t "$my_xabs" | sort | uniq -cd | while read -r count name |
---|
338 | do |
---|
339 | i=1 |
---|
340 | while test "$i" -le "$count" |
---|
341 | do |
---|
342 | # Put our $i before any first dot (extension) |
---|
343 | # Never overwrite any file |
---|
344 | name_to="$name" |
---|
345 | while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" |
---|
346 | do |
---|
347 | name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` |
---|
348 | done |
---|
349 | $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" |
---|
350 | $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? |
---|
351 | i=`expr $i + 1` |
---|
352 | done |
---|
353 | done |
---|
354 | fi |
---|
355 | ;; |
---|
356 | esac |
---|
357 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` |
---|
358 | done |
---|
359 | |
---|
360 | func_extract_archives_result="$my_oldobjs" |
---|
361 | } |
---|
362 | # End of Shell function definitions |
---|
363 | ##################################### |
---|
364 | |
---|
365 | # Darwin sucks |
---|
366 | eval std_shrext=\"$shrext_cmds\" |
---|
367 | |
---|
368 | # Parse our command line options once, thoroughly. |
---|
369 | while test "$#" -gt 0 |
---|
370 | do |
---|
371 | arg="$1" |
---|
372 | shift |
---|
373 | |
---|
374 | case $arg in |
---|
375 | -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; |
---|
376 | *) optarg= ;; |
---|
377 | esac |
---|
378 | |
---|
379 | # If the previous option needs an argument, assign it. |
---|
380 | if test -n "$prev"; then |
---|
381 | case $prev in |
---|
382 | execute_dlfiles) |
---|
383 | execute_dlfiles="$execute_dlfiles $arg" |
---|
384 | ;; |
---|
385 | tag) |
---|
386 | tagname="$arg" |
---|
387 | preserve_args="${preserve_args}=$arg" |
---|
388 | |
---|
389 | # Check whether tagname contains only valid characters |
---|
390 | case $tagname in |
---|
391 | *[!-_A-Za-z0-9,/]*) |
---|
392 | $echo "$progname: invalid tag name: $tagname" 1>&2 |
---|
393 | exit $EXIT_FAILURE |
---|
394 | ;; |
---|
395 | esac |
---|
396 | |
---|
397 | case $tagname in |
---|
398 | CC) |
---|
399 | # Don't test for the "default" C tag, as we know, it's there, but |
---|
400 | # not specially marked. |
---|
401 | ;; |
---|
402 | *) |
---|
403 | if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then |
---|
404 | taglist="$taglist $tagname" |
---|
405 | # Evaluate the configuration. |
---|
406 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" |
---|
407 | else |
---|
408 | $echo "$progname: ignoring unknown tag $tagname" 1>&2 |
---|
409 | fi |
---|
410 | ;; |
---|
411 | esac |
---|
412 | ;; |
---|
413 | *) |
---|
414 | eval "$prev=\$arg" |
---|
415 | ;; |
---|
416 | esac |
---|
417 | |
---|
418 | prev= |
---|
419 | prevopt= |
---|
420 | continue |
---|
421 | fi |
---|
422 | |
---|
423 | # Have we seen a non-optional argument yet? |
---|
424 | case $arg in |
---|
425 | --help) |
---|
426 | show_help=yes |
---|
427 | ;; |
---|
428 | |
---|
429 | --version) |
---|
430 | $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" |
---|
431 | $echo |
---|
432 | $echo "Copyright (C) 2003 Free Software Foundation, Inc." |
---|
433 | $echo "This is free software; see the source for copying conditions. There is NO" |
---|
434 | $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." |
---|
435 | exit $EXIT_SUCCESS |
---|
436 | ;; |
---|
437 | |
---|
438 | --config) |
---|
439 | ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath |
---|
440 | # Now print the configurations for the tags. |
---|
441 | for tagname in $taglist; do |
---|
442 | ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" |
---|
443 | done |
---|
444 | exit $EXIT_SUCCESS |
---|
445 | ;; |
---|
446 | |
---|
447 | --debug) |
---|
448 | $echo "$progname: enabling shell trace mode" |
---|
449 | set -x |
---|
450 | preserve_args="$preserve_args $arg" |
---|
451 | ;; |
---|
452 | |
---|
453 | --dry-run | -n) |
---|
454 | run=: |
---|
455 | ;; |
---|
456 | |
---|
457 | --features) |
---|
458 | $echo "host: $host" |
---|
459 | if test "$build_libtool_libs" = yes; then |
---|
460 | $echo "enable shared libraries" |
---|
461 | else |
---|
462 | $echo "disable shared libraries" |
---|
463 | fi |
---|
464 | if test "$build_old_libs" = yes; then |
---|
465 | $echo "enable static libraries" |
---|
466 | else |
---|
467 | $echo "disable static libraries" |
---|
468 | fi |
---|
469 | exit $EXIT_SUCCESS |
---|
470 | ;; |
---|
471 | |
---|
472 | --finish) mode="finish" ;; |
---|
473 | |
---|
474 | --mode) prevopt="--mode" prev=mode ;; |
---|
475 | --mode=*) mode="$optarg" ;; |
---|
476 | |
---|
477 | --preserve-dup-deps) duplicate_deps="yes" ;; |
---|
478 | |
---|
479 | --quiet | --silent) |
---|
480 | show=: |
---|
481 | preserve_args="$preserve_args $arg" |
---|
482 | ;; |
---|
483 | |
---|
484 | --tag) prevopt="--tag" prev=tag ;; |
---|
485 | --tag=*) |
---|
486 | set tag "$optarg" ${1+"$@"} |
---|
487 | shift |
---|
488 | prev=tag |
---|
489 | preserve_args="$preserve_args --tag" |
---|
490 | ;; |
---|
491 | |
---|
492 | -dlopen) |
---|
493 | prevopt="-dlopen" |
---|
494 | prev=execute_dlfiles |
---|
495 | ;; |
---|
496 | |
---|
497 | -*) |
---|
498 | $echo "$modename: unrecognized option \`$arg'" 1>&2 |
---|
499 | $echo "$help" 1>&2 |
---|
500 | exit $EXIT_FAILURE |
---|
501 | ;; |
---|
502 | |
---|
503 | *) |
---|
504 | nonopt="$arg" |
---|
505 | break |
---|
506 | ;; |
---|
507 | esac |
---|
508 | done |
---|
509 | |
---|
510 | if test -n "$prevopt"; then |
---|
511 | $echo "$modename: option \`$prevopt' requires an argument" 1>&2 |
---|
512 | $echo "$help" 1>&2 |
---|
513 | exit $EXIT_FAILURE |
---|
514 | fi |
---|
515 | |
---|
516 | # If this variable is set in any of the actions, the command in it |
---|
517 | # will be execed at the end. This prevents here-documents from being |
---|
518 | # left over by shells. |
---|
519 | exec_cmd= |
---|
520 | |
---|
521 | if test -z "$show_help"; then |
---|
522 | |
---|
523 | # Infer the operation mode. |
---|
524 | if test -z "$mode"; then |
---|
525 | $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 |
---|
526 | $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 |
---|
527 | case $nonopt in |
---|
528 | *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) |
---|
529 | mode=link |
---|
530 | for arg |
---|
531 | do |
---|
532 | case $arg in |
---|
533 | -c) |
---|
534 | mode=compile |
---|
535 | break |
---|
536 | ;; |
---|
537 | esac |
---|
538 | done |
---|
539 | ;; |
---|
540 | *db | *dbx | *strace | *truss) |
---|
541 | mode=execute |
---|
542 | ;; |
---|
543 | *install*|cp|mv) |
---|
544 | mode=install |
---|
545 | ;; |
---|
546 | *rm) |
---|
547 | mode=uninstall |
---|
548 | ;; |
---|
549 | *) |
---|
550 | # If we have no mode, but dlfiles were specified, then do execute mode. |
---|
551 | test -n "$execute_dlfiles" && mode=execute |
---|
552 | |
---|
553 | # Just use the default operation mode. |
---|
554 | if test -z "$mode"; then |
---|
555 | if test -n "$nonopt"; then |
---|
556 | $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 |
---|
557 | else |
---|
558 | $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 |
---|
559 | fi |
---|
560 | fi |
---|
561 | ;; |
---|
562 | esac |
---|
563 | fi |
---|
564 | |
---|
565 | # Only execute mode is allowed to have -dlopen flags. |
---|
566 | if test -n "$execute_dlfiles" && test "$mode" != execute; then |
---|
567 | $echo "$modename: unrecognized option \`-dlopen'" 1>&2 |
---|
568 | $echo "$help" 1>&2 |
---|
569 | exit $EXIT_FAILURE |
---|
570 | fi |
---|
571 | |
---|
572 | # Change the help message to a mode-specific one. |
---|
573 | generic_help="$help" |
---|
574 | help="Try \`$modename --help --mode=$mode' for more information." |
---|
575 | |
---|
576 | # These modes are in order of execution frequency so that they run quickly. |
---|
577 | case $mode in |
---|
578 | # libtool compile mode |
---|
579 | compile) |
---|
580 | modename="$modename: compile" |
---|
581 | # Get the compilation command and the source file. |
---|
582 | base_compile= |
---|
583 | srcfile="$nonopt" # always keep a non-empty value in "srcfile" |
---|
584 | suppress_opt=yes |
---|
585 | suppress_output= |
---|
586 | arg_mode=normal |
---|
587 | libobj= |
---|
588 | later= |
---|
589 | |
---|
590 | for arg |
---|
591 | do |
---|
592 | case "$arg_mode" in |
---|
593 | arg ) |
---|
594 | # do not "continue". Instead, add this to base_compile |
---|
595 | lastarg="$arg" |
---|
596 | arg_mode=normal |
---|
597 | ;; |
---|
598 | |
---|
599 | target ) |
---|
600 | libobj="$arg" |
---|
601 | arg_mode=normal |
---|
602 | continue |
---|
603 | ;; |
---|
604 | |
---|
605 | normal ) |
---|
606 | # Accept any command-line options. |
---|
607 | case $arg in |
---|
608 | -o) |
---|
609 | if test -n "$libobj" ; then |
---|
610 | $echo "$modename: you cannot specify \`-o' more than once" 1>&2 |
---|
611 | exit $EXIT_FAILURE |
---|
612 | fi |
---|
613 | arg_mode=target |
---|
614 | continue |
---|
615 | ;; |
---|
616 | |
---|
617 | -static | -prefer-pic | -prefer-non-pic) |
---|
618 | later="$later $arg" |
---|
619 | continue |
---|
620 | ;; |
---|
621 | |
---|
622 | -no-suppress) |
---|
623 | suppress_opt=no |
---|
624 | continue |
---|
625 | ;; |
---|
626 | |
---|
627 | -Xcompiler) |
---|
628 | arg_mode=arg # the next one goes into the "base_compile" arg list |
---|
629 | continue # The current "srcfile" will either be retained or |
---|
630 | ;; # replaced later. I would guess that would be a bug. |
---|
631 | |
---|
632 | -Wc,*) |
---|
633 | args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` |
---|
634 | lastarg= |
---|
635 | save_ifs="$IFS"; IFS=',' |
---|
636 | for arg in $args; do |
---|
637 | IFS="$save_ifs" |
---|
638 | |
---|
639 | # Double-quote args containing other shell metacharacters. |
---|
640 | # Many Bourne shells cannot handle close brackets correctly |
---|
641 | # in scan sets, so we specify it separately. |
---|
642 | case $arg in |
---|
643 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
644 | arg="\"$arg\"" |
---|
645 | ;; |
---|
646 | esac |
---|
647 | lastarg="$lastarg $arg" |
---|
648 | done |
---|
649 | IFS="$save_ifs" |
---|
650 | lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` |
---|
651 | |
---|
652 | # Add the arguments to base_compile. |
---|
653 | base_compile="$base_compile $lastarg" |
---|
654 | continue |
---|
655 | ;; |
---|
656 | |
---|
657 | * ) |
---|
658 | # Accept the current argument as the source file. |
---|
659 | # The previous "srcfile" becomes the current argument. |
---|
660 | # |
---|
661 | lastarg="$srcfile" |
---|
662 | srcfile="$arg" |
---|
663 | ;; |
---|
664 | esac # case $arg |
---|
665 | ;; |
---|
666 | esac # case $arg_mode |
---|
667 | |
---|
668 | # Aesthetically quote the previous argument. |
---|
669 | lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` |
---|
670 | |
---|
671 | case $lastarg in |
---|
672 | # Double-quote args containing other shell metacharacters. |
---|
673 | # Many Bourne shells cannot handle close brackets correctly |
---|
674 | # in scan sets, so we specify it separately. |
---|
675 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
676 | lastarg="\"$lastarg\"" |
---|
677 | ;; |
---|
678 | esac |
---|
679 | |
---|
680 | base_compile="$base_compile $lastarg" |
---|
681 | done # for arg |
---|
682 | |
---|
683 | case $arg_mode in |
---|
684 | arg) |
---|
685 | $echo "$modename: you must specify an argument for -Xcompile" |
---|
686 | exit $EXIT_FAILURE |
---|
687 | ;; |
---|
688 | target) |
---|
689 | $echo "$modename: you must specify a target with \`-o'" 1>&2 |
---|
690 | exit $EXIT_FAILURE |
---|
691 | ;; |
---|
692 | *) |
---|
693 | # Get the name of the library object. |
---|
694 | [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` |
---|
695 | ;; |
---|
696 | esac |
---|
697 | |
---|
698 | # Recognize several different file suffixes. |
---|
699 | # If the user specifies -o file.o, it is replaced with file.lo |
---|
700 | xform='[cCFSifmso]' |
---|
701 | case $libobj in |
---|
702 | *.ada) xform=ada ;; |
---|
703 | *.adb) xform=adb ;; |
---|
704 | *.ads) xform=ads ;; |
---|
705 | *.asm) xform=asm ;; |
---|
706 | *.c++) xform=c++ ;; |
---|
707 | *.cc) xform=cc ;; |
---|
708 | *.ii) xform=ii ;; |
---|
709 | *.class) xform=class ;; |
---|
710 | *.cpp) xform=cpp ;; |
---|
711 | *.cxx) xform=cxx ;; |
---|
712 | *.f90) xform=f90 ;; |
---|
713 | *.for) xform=for ;; |
---|
714 | *.java) xform=java ;; |
---|
715 | esac |
---|
716 | |
---|
717 | libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` |
---|
718 | |
---|
719 | case $libobj in |
---|
720 | *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; |
---|
721 | *) |
---|
722 | $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 |
---|
723 | exit $EXIT_FAILURE |
---|
724 | ;; |
---|
725 | esac |
---|
726 | |
---|
727 | func_infer_tag $base_compile |
---|
728 | |
---|
729 | for arg in $later; do |
---|
730 | case $arg in |
---|
731 | -static) |
---|
732 | build_old_libs=yes |
---|
733 | continue |
---|
734 | ;; |
---|
735 | |
---|
736 | -prefer-pic) |
---|
737 | pic_mode=yes |
---|
738 | continue |
---|
739 | ;; |
---|
740 | |
---|
741 | -prefer-non-pic) |
---|
742 | pic_mode=no |
---|
743 | continue |
---|
744 | ;; |
---|
745 | esac |
---|
746 | done |
---|
747 | |
---|
748 | objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` |
---|
749 | xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` |
---|
750 | if test "X$xdir" = "X$obj"; then |
---|
751 | xdir= |
---|
752 | else |
---|
753 | xdir=$xdir/ |
---|
754 | fi |
---|
755 | lobj=${xdir}$objdir/$objname |
---|
756 | |
---|
757 | if test -z "$base_compile"; then |
---|
758 | $echo "$modename: you must specify a compilation command" 1>&2 |
---|
759 | $echo "$help" 1>&2 |
---|
760 | exit $EXIT_FAILURE |
---|
761 | fi |
---|
762 | |
---|
763 | # Delete any leftover library objects. |
---|
764 | if test "$build_old_libs" = yes; then |
---|
765 | removelist="$obj $lobj $libobj ${libobj}T" |
---|
766 | else |
---|
767 | removelist="$lobj $libobj ${libobj}T" |
---|
768 | fi |
---|
769 | |
---|
770 | $run $rm $removelist |
---|
771 | trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 |
---|
772 | |
---|
773 | # On Cygwin there's no "real" PIC flag so we must build both object types |
---|
774 | case $host_os in |
---|
775 | cygwin* | mingw* | pw32* | os2*) |
---|
776 | pic_mode=default |
---|
777 | ;; |
---|
778 | esac |
---|
779 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
---|
780 | # non-PIC code in shared libraries is not supported |
---|
781 | pic_mode=default |
---|
782 | fi |
---|
783 | |
---|
784 | # Calculate the filename of the output object if compiler does |
---|
785 | # not support -o with -c |
---|
786 | if test "$compiler_c_o" = no; then |
---|
787 | output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} |
---|
788 | lockfile="$output_obj.lock" |
---|
789 | removelist="$removelist $output_obj $lockfile" |
---|
790 | trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 |
---|
791 | else |
---|
792 | output_obj= |
---|
793 | need_locks=no |
---|
794 | lockfile= |
---|
795 | fi |
---|
796 | |
---|
797 | # Lock this critical section if it is needed |
---|
798 | # We use this script file to make the link, it avoids creating a new file |
---|
799 | if test "$need_locks" = yes; then |
---|
800 | until $run ln "$progpath" "$lockfile" 2>/dev/null; do |
---|
801 | $show "Waiting for $lockfile to be removed" |
---|
802 | sleep 2 |
---|
803 | done |
---|
804 | elif test "$need_locks" = warn; then |
---|
805 | if test -f "$lockfile"; then |
---|
806 | $echo "\ |
---|
807 | *** ERROR, $lockfile exists and contains: |
---|
808 | `cat $lockfile 2>/dev/null` |
---|
809 | |
---|
810 | This indicates that another process is trying to use the same |
---|
811 | temporary object file, and libtool could not work around it because |
---|
812 | your compiler does not support \`-c' and \`-o' together. If you |
---|
813 | repeat this compilation, it may succeed, by chance, but you had better |
---|
814 | avoid parallel builds (make -j) in this platform, or get a better |
---|
815 | compiler." |
---|
816 | |
---|
817 | $run $rm $removelist |
---|
818 | exit $EXIT_FAILURE |
---|
819 | fi |
---|
820 | $echo $srcfile > "$lockfile" |
---|
821 | fi |
---|
822 | |
---|
823 | if test -n "$fix_srcfile_path"; then |
---|
824 | eval srcfile=\"$fix_srcfile_path\" |
---|
825 | fi |
---|
826 | |
---|
827 | $run $rm "$libobj" "${libobj}T" |
---|
828 | |
---|
829 | # Create a libtool object file (analogous to a ".la" file), |
---|
830 | # but don't create it if we're doing a dry run. |
---|
831 | test -z "$run" && cat > ${libobj}T <<EOF |
---|
832 | # $libobj - a libtool object file |
---|
833 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
---|
834 | # |
---|
835 | # Please DO NOT delete this file! |
---|
836 | # It is necessary for linking the library. |
---|
837 | |
---|
838 | # Name of the PIC object. |
---|
839 | EOF |
---|
840 | |
---|
841 | # Only build a PIC object if we are building libtool libraries. |
---|
842 | if test "$build_libtool_libs" = yes; then |
---|
843 | # Without this assignment, base_compile gets emptied. |
---|
844 | fbsd_hideous_sh_bug=$base_compile |
---|
845 | |
---|
846 | if test "$pic_mode" != no; then |
---|
847 | command="$base_compile $srcfile $pic_flag" |
---|
848 | else |
---|
849 | # Don't build PIC code |
---|
850 | command="$base_compile $srcfile" |
---|
851 | fi |
---|
852 | |
---|
853 | if test ! -d "${xdir}$objdir"; then |
---|
854 | $show "$mkdir ${xdir}$objdir" |
---|
855 | $run $mkdir ${xdir}$objdir |
---|
856 | status=$? |
---|
857 | if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then |
---|
858 | exit $status |
---|
859 | fi |
---|
860 | fi |
---|
861 | |
---|
862 | if test -z "$output_obj"; then |
---|
863 | # Place PIC objects in $objdir |
---|
864 | command="$command -o $lobj" |
---|
865 | fi |
---|
866 | |
---|
867 | $run $rm "$lobj" "$output_obj" |
---|
868 | |
---|
869 | $show "$command" |
---|
870 | if $run eval "$command"; then : |
---|
871 | else |
---|
872 | test -n "$output_obj" && $run $rm $removelist |
---|
873 | exit $EXIT_FAILURE |
---|
874 | fi |
---|
875 | |
---|
876 | if test "$need_locks" = warn && |
---|
877 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
---|
878 | $echo "\ |
---|
879 | *** ERROR, $lockfile contains: |
---|
880 | `cat $lockfile 2>/dev/null` |
---|
881 | |
---|
882 | but it should contain: |
---|
883 | $srcfile |
---|
884 | |
---|
885 | This indicates that another process is trying to use the same |
---|
886 | temporary object file, and libtool could not work around it because |
---|
887 | your compiler does not support \`-c' and \`-o' together. If you |
---|
888 | repeat this compilation, it may succeed, by chance, but you had better |
---|
889 | avoid parallel builds (make -j) in this platform, or get a better |
---|
890 | compiler." |
---|
891 | |
---|
892 | $run $rm $removelist |
---|
893 | exit $EXIT_FAILURE |
---|
894 | fi |
---|
895 | |
---|
896 | # Just move the object if needed, then go on to compile the next one |
---|
897 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
---|
898 | $show "$mv $output_obj $lobj" |
---|
899 | if $run $mv $output_obj $lobj; then : |
---|
900 | else |
---|
901 | error=$? |
---|
902 | $run $rm $removelist |
---|
903 | exit $error |
---|
904 | fi |
---|
905 | fi |
---|
906 | |
---|
907 | # Append the name of the PIC object to the libtool object file. |
---|
908 | test -z "$run" && cat >> ${libobj}T <<EOF |
---|
909 | pic_object='$objdir/$objname' |
---|
910 | |
---|
911 | EOF |
---|
912 | |
---|
913 | # Allow error messages only from the first compilation. |
---|
914 | if test "$suppress_opt" = yes; then |
---|
915 | suppress_output=' >/dev/null 2>&1' |
---|
916 | fi |
---|
917 | else |
---|
918 | # No PIC object so indicate it doesn't exist in the libtool |
---|
919 | # object file. |
---|
920 | test -z "$run" && cat >> ${libobj}T <<EOF |
---|
921 | pic_object=none |
---|
922 | |
---|
923 | EOF |
---|
924 | fi |
---|
925 | |
---|
926 | # Only build a position-dependent object if we build old libraries. |
---|
927 | if test "$build_old_libs" = yes; then |
---|
928 | if test "$pic_mode" != yes; then |
---|
929 | # Don't build PIC code |
---|
930 | command="$base_compile $srcfile" |
---|
931 | else |
---|
932 | command="$base_compile $srcfile $pic_flag" |
---|
933 | fi |
---|
934 | if test "$compiler_c_o" = yes; then |
---|
935 | command="$command -o $obj" |
---|
936 | fi |
---|
937 | |
---|
938 | # Suppress compiler output if we already did a PIC compilation. |
---|
939 | command="$command$suppress_output" |
---|
940 | $run $rm "$obj" "$output_obj" |
---|
941 | $show "$command" |
---|
942 | if $run eval "$command"; then : |
---|
943 | else |
---|
944 | $run $rm $removelist |
---|
945 | exit $EXIT_FAILURE |
---|
946 | fi |
---|
947 | |
---|
948 | if test "$need_locks" = warn && |
---|
949 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
---|
950 | $echo "\ |
---|
951 | *** ERROR, $lockfile contains: |
---|
952 | `cat $lockfile 2>/dev/null` |
---|
953 | |
---|
954 | but it should contain: |
---|
955 | $srcfile |
---|
956 | |
---|
957 | This indicates that another process is trying to use the same |
---|
958 | temporary object file, and libtool could not work around it because |
---|
959 | your compiler does not support \`-c' and \`-o' together. If you |
---|
960 | repeat this compilation, it may succeed, by chance, but you had better |
---|
961 | avoid parallel builds (make -j) in this platform, or get a better |
---|
962 | compiler." |
---|
963 | |
---|
964 | $run $rm $removelist |
---|
965 | exit $EXIT_FAILURE |
---|
966 | fi |
---|
967 | |
---|
968 | # Just move the object if needed |
---|
969 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
---|
970 | $show "$mv $output_obj $obj" |
---|
971 | if $run $mv $output_obj $obj; then : |
---|
972 | else |
---|
973 | error=$? |
---|
974 | $run $rm $removelist |
---|
975 | exit $error |
---|
976 | fi |
---|
977 | fi |
---|
978 | |
---|
979 | # Append the name of the non-PIC object the libtool object file. |
---|
980 | # Only append if the libtool object file exists. |
---|
981 | test -z "$run" && cat >> ${libobj}T <<EOF |
---|
982 | # Name of the non-PIC object. |
---|
983 | non_pic_object='$objname' |
---|
984 | |
---|
985 | EOF |
---|
986 | else |
---|
987 | # Append the name of the non-PIC object the libtool object file. |
---|
988 | # Only append if the libtool object file exists. |
---|
989 | test -z "$run" && cat >> ${libobj}T <<EOF |
---|
990 | # Name of the non-PIC object. |
---|
991 | non_pic_object=none |
---|
992 | |
---|
993 | EOF |
---|
994 | fi |
---|
995 | |
---|
996 | $run $mv "${libobj}T" "${libobj}" |
---|
997 | |
---|
998 | # Unlock the critical section if it was locked |
---|
999 | if test "$need_locks" != no; then |
---|
1000 | $run $rm "$lockfile" |
---|
1001 | fi |
---|
1002 | |
---|
1003 | exit $EXIT_SUCCESS |
---|
1004 | ;; |
---|
1005 | |
---|
1006 | # libtool link mode |
---|
1007 | link | relink) |
---|
1008 | modename="$modename: link" |
---|
1009 | case $host in |
---|
1010 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
---|
1011 | # It is impossible to link a dll without this setting, and |
---|
1012 | # we shouldn't force the makefile maintainer to figure out |
---|
1013 | # which system we are compiling for in order to pass an extra |
---|
1014 | # flag for every libtool invocation. |
---|
1015 | # allow_undefined=no |
---|
1016 | |
---|
1017 | # FIXME: Unfortunately, there are problems with the above when trying |
---|
1018 | # to make a dll which has undefined symbols, in which case not |
---|
1019 | # even a static library is built. For now, we need to specify |
---|
1020 | # -no-undefined on the libtool link line when we can be certain |
---|
1021 | # that all symbols are satisfied, otherwise we get a static library. |
---|
1022 | allow_undefined=yes |
---|
1023 | ;; |
---|
1024 | *) |
---|
1025 | allow_undefined=yes |
---|
1026 | ;; |
---|
1027 | esac |
---|
1028 | libtool_args="$nonopt" |
---|
1029 | base_compile="$nonopt $@" |
---|
1030 | compile_command="$nonopt" |
---|
1031 | finalize_command="$nonopt" |
---|
1032 | |
---|
1033 | compile_rpath= |
---|
1034 | finalize_rpath= |
---|
1035 | compile_shlibpath= |
---|
1036 | finalize_shlibpath= |
---|
1037 | convenience= |
---|
1038 | old_convenience= |
---|
1039 | deplibs= |
---|
1040 | old_deplibs= |
---|
1041 | compiler_flags= |
---|
1042 | linker_flags= |
---|
1043 | dllsearchpath= |
---|
1044 | lib_search_path=`pwd` |
---|
1045 | inst_prefix_dir= |
---|
1046 | |
---|
1047 | avoid_version=no |
---|
1048 | dlfiles= |
---|
1049 | dlprefiles= |
---|
1050 | dlself=no |
---|
1051 | export_dynamic=no |
---|
1052 | export_symbols= |
---|
1053 | export_symbols_regex= |
---|
1054 | generated= |
---|
1055 | libobjs= |
---|
1056 | ltlibs= |
---|
1057 | module=no |
---|
1058 | no_install=no |
---|
1059 | objs= |
---|
1060 | non_pic_objects= |
---|
1061 | precious_files_regex= |
---|
1062 | prefer_static_libs=no |
---|
1063 | preload=no |
---|
1064 | prev= |
---|
1065 | prevarg= |
---|
1066 | release= |
---|
1067 | rpath= |
---|
1068 | xrpath= |
---|
1069 | perm_rpath= |
---|
1070 | temp_rpath= |
---|
1071 | thread_safe=no |
---|
1072 | vinfo= |
---|
1073 | vinfo_number=no |
---|
1074 | |
---|
1075 | func_infer_tag $base_compile |
---|
1076 | |
---|
1077 | # We need to know -static, to get the right output filenames. |
---|
1078 | for arg |
---|
1079 | do |
---|
1080 | case $arg in |
---|
1081 | -all-static | -static) |
---|
1082 | if test "X$arg" = "X-all-static"; then |
---|
1083 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then |
---|
1084 | $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 |
---|
1085 | fi |
---|
1086 | if test -n "$link_static_flag"; then |
---|
1087 | dlopen_self=$dlopen_self_static |
---|
1088 | fi |
---|
1089 | else |
---|
1090 | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
---|
1091 | dlopen_self=$dlopen_self_static |
---|
1092 | fi |
---|
1093 | fi |
---|
1094 | build_libtool_libs=no |
---|
1095 | build_old_libs=yes |
---|
1096 | prefer_static_libs=yes |
---|
1097 | break |
---|
1098 | ;; |
---|
1099 | esac |
---|
1100 | done |
---|
1101 | |
---|
1102 | # See if our shared archives depend on static archives. |
---|
1103 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
---|
1104 | |
---|
1105 | # Go through the arguments, transforming them on the way. |
---|
1106 | while test "$#" -gt 0; do |
---|
1107 | arg="$1" |
---|
1108 | shift |
---|
1109 | case $arg in |
---|
1110 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
1111 | qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test |
---|
1112 | ;; |
---|
1113 | *) qarg=$arg ;; |
---|
1114 | esac |
---|
1115 | libtool_args="$libtool_args $qarg" |
---|
1116 | |
---|
1117 | # If the previous option needs an argument, assign it. |
---|
1118 | if test -n "$prev"; then |
---|
1119 | case $prev in |
---|
1120 | output) |
---|
1121 | compile_command="$compile_command @OUTPUT@" |
---|
1122 | finalize_command="$finalize_command @OUTPUT@" |
---|
1123 | ;; |
---|
1124 | esac |
---|
1125 | |
---|
1126 | case $prev in |
---|
1127 | dlfiles|dlprefiles) |
---|
1128 | if test "$preload" = no; then |
---|
1129 | # Add the symbol object into the linking commands. |
---|
1130 | compile_command="$compile_command @SYMFILE@" |
---|
1131 | finalize_command="$finalize_command @SYMFILE@" |
---|
1132 | preload=yes |
---|
1133 | fi |
---|
1134 | case $arg in |
---|
1135 | *.la | *.lo) ;; # We handle these cases below. |
---|
1136 | force) |
---|
1137 | if test "$dlself" = no; then |
---|
1138 | dlself=needless |
---|
1139 | export_dynamic=yes |
---|
1140 | fi |
---|
1141 | prev= |
---|
1142 | continue |
---|
1143 | ;; |
---|
1144 | self) |
---|
1145 | if test "$prev" = dlprefiles; then |
---|
1146 | dlself=yes |
---|
1147 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then |
---|
1148 | dlself=yes |
---|
1149 | else |
---|
1150 | dlself=needless |
---|
1151 | export_dynamic=yes |
---|
1152 | fi |
---|
1153 | prev= |
---|
1154 | continue |
---|
1155 | ;; |
---|
1156 | *) |
---|
1157 | if test "$prev" = dlfiles; then |
---|
1158 | dlfiles="$dlfiles $arg" |
---|
1159 | else |
---|
1160 | dlprefiles="$dlprefiles $arg" |
---|
1161 | fi |
---|
1162 | prev= |
---|
1163 | continue |
---|
1164 | ;; |
---|
1165 | esac |
---|
1166 | ;; |
---|
1167 | expsyms) |
---|
1168 | export_symbols="$arg" |
---|
1169 | if test ! -f "$arg"; then |
---|
1170 | $echo "$modename: symbol file \`$arg' does not exist" |
---|
1171 | exit $EXIT_FAILURE |
---|
1172 | fi |
---|
1173 | prev= |
---|
1174 | continue |
---|
1175 | ;; |
---|
1176 | expsyms_regex) |
---|
1177 | export_symbols_regex="$arg" |
---|
1178 | prev= |
---|
1179 | continue |
---|
1180 | ;; |
---|
1181 | inst_prefix) |
---|
1182 | inst_prefix_dir="$arg" |
---|
1183 | prev= |
---|
1184 | continue |
---|
1185 | ;; |
---|
1186 | precious_regex) |
---|
1187 | precious_files_regex="$arg" |
---|
1188 | prev= |
---|
1189 | continue |
---|
1190 | ;; |
---|
1191 | release) |
---|
1192 | release="-$arg" |
---|
1193 | prev= |
---|
1194 | continue |
---|
1195 | ;; |
---|
1196 | objectlist) |
---|
1197 | if test -f "$arg"; then |
---|
1198 | save_arg=$arg |
---|
1199 | moreargs= |
---|
1200 | for fil in `cat $save_arg` |
---|
1201 | do |
---|
1202 | # moreargs="$moreargs $fil" |
---|
1203 | arg=$fil |
---|
1204 | # A libtool-controlled object. |
---|
1205 | |
---|
1206 | # Check to see that this really is a libtool object. |
---|
1207 | if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
1208 | pic_object= |
---|
1209 | non_pic_object= |
---|
1210 | |
---|
1211 | # Read the .lo file |
---|
1212 | # If there is no directory component, then add one. |
---|
1213 | case $arg in |
---|
1214 | */* | *\\*) . $arg ;; |
---|
1215 | *) . ./$arg ;; |
---|
1216 | esac |
---|
1217 | |
---|
1218 | if test -z "$pic_object" || \ |
---|
1219 | test -z "$non_pic_object" || |
---|
1220 | test "$pic_object" = none && \ |
---|
1221 | test "$non_pic_object" = none; then |
---|
1222 | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 |
---|
1223 | exit $EXIT_FAILURE |
---|
1224 | fi |
---|
1225 | |
---|
1226 | # Extract subdirectory from the argument. |
---|
1227 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
---|
1228 | if test "X$xdir" = "X$arg"; then |
---|
1229 | xdir= |
---|
1230 | else |
---|
1231 | xdir="$xdir/" |
---|
1232 | fi |
---|
1233 | |
---|
1234 | if test "$pic_object" != none; then |
---|
1235 | # Prepend the subdirectory the object is found in. |
---|
1236 | pic_object="$xdir$pic_object" |
---|
1237 | |
---|
1238 | if test "$prev" = dlfiles; then |
---|
1239 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
---|
1240 | dlfiles="$dlfiles $pic_object" |
---|
1241 | prev= |
---|
1242 | continue |
---|
1243 | else |
---|
1244 | # If libtool objects are unsupported, then we need to preload. |
---|
1245 | prev=dlprefiles |
---|
1246 | fi |
---|
1247 | fi |
---|
1248 | |
---|
1249 | # CHECK ME: I think I busted this. -Ossama |
---|
1250 | if test "$prev" = dlprefiles; then |
---|
1251 | # Preload the old-style object. |
---|
1252 | dlprefiles="$dlprefiles $pic_object" |
---|
1253 | prev= |
---|
1254 | fi |
---|
1255 | |
---|
1256 | # A PIC object. |
---|
1257 | libobjs="$libobjs $pic_object" |
---|
1258 | arg="$pic_object" |
---|
1259 | fi |
---|
1260 | |
---|
1261 | # Non-PIC object. |
---|
1262 | if test "$non_pic_object" != none; then |
---|
1263 | # Prepend the subdirectory the object is found in. |
---|
1264 | non_pic_object="$xdir$non_pic_object" |
---|
1265 | |
---|
1266 | # A standard non-PIC object |
---|
1267 | non_pic_objects="$non_pic_objects $non_pic_object" |
---|
1268 | if test -z "$pic_object" || test "$pic_object" = none ; then |
---|
1269 | arg="$non_pic_object" |
---|
1270 | fi |
---|
1271 | fi |
---|
1272 | else |
---|
1273 | # Only an error if not doing a dry-run. |
---|
1274 | if test -z "$run"; then |
---|
1275 | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 |
---|
1276 | exit $EXIT_FAILURE |
---|
1277 | else |
---|
1278 | # Dry-run case. |
---|
1279 | |
---|
1280 | # Extract subdirectory from the argument. |
---|
1281 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
---|
1282 | if test "X$xdir" = "X$arg"; then |
---|
1283 | xdir= |
---|
1284 | else |
---|
1285 | xdir="$xdir/" |
---|
1286 | fi |
---|
1287 | |
---|
1288 | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` |
---|
1289 | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` |
---|
1290 | libobjs="$libobjs $pic_object" |
---|
1291 | non_pic_objects="$non_pic_objects $non_pic_object" |
---|
1292 | fi |
---|
1293 | fi |
---|
1294 | done |
---|
1295 | else |
---|
1296 | $echo "$modename: link input file \`$save_arg' does not exist" |
---|
1297 | exit $EXIT_FAILURE |
---|
1298 | fi |
---|
1299 | arg=$save_arg |
---|
1300 | prev= |
---|
1301 | continue |
---|
1302 | ;; |
---|
1303 | rpath | xrpath) |
---|
1304 | # We need an absolute path. |
---|
1305 | case $arg in |
---|
1306 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
---|
1307 | *) |
---|
1308 | $echo "$modename: only absolute run-paths are allowed" 1>&2 |
---|
1309 | exit $EXIT_FAILURE |
---|
1310 | ;; |
---|
1311 | esac |
---|
1312 | if test "$prev" = rpath; then |
---|
1313 | case "$rpath " in |
---|
1314 | *" $arg "*) ;; |
---|
1315 | *) rpath="$rpath $arg" ;; |
---|
1316 | esac |
---|
1317 | else |
---|
1318 | case "$xrpath " in |
---|
1319 | *" $arg "*) ;; |
---|
1320 | *) xrpath="$xrpath $arg" ;; |
---|
1321 | esac |
---|
1322 | fi |
---|
1323 | prev= |
---|
1324 | continue |
---|
1325 | ;; |
---|
1326 | xcompiler) |
---|
1327 | compiler_flags="$compiler_flags $qarg" |
---|
1328 | prev= |
---|
1329 | compile_command="$compile_command $qarg" |
---|
1330 | finalize_command="$finalize_command $qarg" |
---|
1331 | continue |
---|
1332 | ;; |
---|
1333 | xlinker) |
---|
1334 | linker_flags="$linker_flags $qarg" |
---|
1335 | compiler_flags="$compiler_flags $wl$qarg" |
---|
1336 | prev= |
---|
1337 | compile_command="$compile_command $wl$qarg" |
---|
1338 | finalize_command="$finalize_command $wl$qarg" |
---|
1339 | continue |
---|
1340 | ;; |
---|
1341 | xcclinker) |
---|
1342 | linker_flags="$linker_flags $qarg" |
---|
1343 | compiler_flags="$compiler_flags $qarg" |
---|
1344 | prev= |
---|
1345 | compile_command="$compile_command $qarg" |
---|
1346 | finalize_command="$finalize_command $qarg" |
---|
1347 | continue |
---|
1348 | ;; |
---|
1349 | shrext) |
---|
1350 | shrext_cmds="$arg" |
---|
1351 | prev= |
---|
1352 | continue |
---|
1353 | ;; |
---|
1354 | *) |
---|
1355 | eval "$prev=\"\$arg\"" |
---|
1356 | prev= |
---|
1357 | continue |
---|
1358 | ;; |
---|
1359 | esac |
---|
1360 | fi # test -n "$prev" |
---|
1361 | |
---|
1362 | prevarg="$arg" |
---|
1363 | |
---|
1364 | case $arg in |
---|
1365 | -all-static) |
---|
1366 | if test -n "$link_static_flag"; then |
---|
1367 | compile_command="$compile_command $link_static_flag" |
---|
1368 | finalize_command="$finalize_command $link_static_flag" |
---|
1369 | fi |
---|
1370 | continue |
---|
1371 | ;; |
---|
1372 | |
---|
1373 | -allow-undefined) |
---|
1374 | # FIXME: remove this flag sometime in the future. |
---|
1375 | $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 |
---|
1376 | continue |
---|
1377 | ;; |
---|
1378 | |
---|
1379 | -avoid-version) |
---|
1380 | avoid_version=yes |
---|
1381 | continue |
---|
1382 | ;; |
---|
1383 | |
---|
1384 | -dlopen) |
---|
1385 | prev=dlfiles |
---|
1386 | continue |
---|
1387 | ;; |
---|
1388 | |
---|
1389 | -dlpreopen) |
---|
1390 | prev=dlprefiles |
---|
1391 | continue |
---|
1392 | ;; |
---|
1393 | |
---|
1394 | -export-dynamic) |
---|
1395 | export_dynamic=yes |
---|
1396 | continue |
---|
1397 | ;; |
---|
1398 | |
---|
1399 | -export-symbols | -export-symbols-regex) |
---|
1400 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
---|
1401 | $echo "$modename: more than one -exported-symbols argument is not allowed" |
---|
1402 | exit $EXIT_FAILURE |
---|
1403 | fi |
---|
1404 | if test "X$arg" = "X-export-symbols"; then |
---|
1405 | prev=expsyms |
---|
1406 | else |
---|
1407 | prev=expsyms_regex |
---|
1408 | fi |
---|
1409 | continue |
---|
1410 | ;; |
---|
1411 | |
---|
1412 | -inst-prefix-dir) |
---|
1413 | prev=inst_prefix |
---|
1414 | continue |
---|
1415 | ;; |
---|
1416 | |
---|
1417 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
---|
1418 | # so, if we see these flags be careful not to treat them like -L |
---|
1419 | -L[A-Z][A-Z]*:*) |
---|
1420 | case $with_gcc/$host in |
---|
1421 | no/*-*-irix* | /*-*-irix*) |
---|
1422 | compile_command="$compile_command $arg" |
---|
1423 | finalize_command="$finalize_command $arg" |
---|
1424 | ;; |
---|
1425 | esac |
---|
1426 | continue |
---|
1427 | ;; |
---|
1428 | |
---|
1429 | -L*) |
---|
1430 | dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` |
---|
1431 | # We need an absolute path. |
---|
1432 | case $dir in |
---|
1433 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
---|
1434 | *) |
---|
1435 | absdir=`cd "$dir" && pwd` |
---|
1436 | if test -z "$absdir"; then |
---|
1437 | $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 |
---|
1438 | exit $EXIT_FAILURE |
---|
1439 | fi |
---|
1440 | dir="$absdir" |
---|
1441 | ;; |
---|
1442 | esac |
---|
1443 | case "$deplibs " in |
---|
1444 | *" -L$dir "*) ;; |
---|
1445 | *) |
---|
1446 | deplibs="$deplibs -L$dir" |
---|
1447 | lib_search_path="$lib_search_path $dir" |
---|
1448 | ;; |
---|
1449 | esac |
---|
1450 | case $host in |
---|
1451 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
---|
1452 | case :$dllsearchpath: in |
---|
1453 | *":$dir:"*) ;; |
---|
1454 | *) dllsearchpath="$dllsearchpath:$dir";; |
---|
1455 | esac |
---|
1456 | ;; |
---|
1457 | esac |
---|
1458 | continue |
---|
1459 | ;; |
---|
1460 | |
---|
1461 | -l*) |
---|
1462 | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then |
---|
1463 | case $host in |
---|
1464 | *-*-cygwin* | *-*-pw32* | *-*-beos*) |
---|
1465 | # These systems don't actually have a C or math library (as such) |
---|
1466 | continue |
---|
1467 | ;; |
---|
1468 | *-*-mingw* | *-*-os2*) |
---|
1469 | # These systems don't actually have a C library (as such) |
---|
1470 | test "X$arg" = "X-lc" && continue |
---|
1471 | ;; |
---|
1472 | *-*-openbsd* | *-*-freebsd*) |
---|
1473 | # Do not include libc due to us having libc/libc_r. |
---|
1474 | test "X$arg" = "X-lc" && continue |
---|
1475 | ;; |
---|
1476 | *-*-rhapsody* | *-*-darwin1.[012]) |
---|
1477 | # Rhapsody C and math libraries are in the System framework |
---|
1478 | deplibs="$deplibs -framework System" |
---|
1479 | continue |
---|
1480 | esac |
---|
1481 | elif test "X$arg" = "X-lc_r"; then |
---|
1482 | case $host in |
---|
1483 | *-*-openbsd* | *-*-freebsd*) |
---|
1484 | # Do not include libc_r directly, use -pthread flag. |
---|
1485 | continue |
---|
1486 | ;; |
---|
1487 | esac |
---|
1488 | fi |
---|
1489 | deplibs="$deplibs $arg" |
---|
1490 | continue |
---|
1491 | ;; |
---|
1492 | |
---|
1493 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) |
---|
1494 | deplibs="$deplibs $arg" |
---|
1495 | continue |
---|
1496 | ;; |
---|
1497 | |
---|
1498 | -module) |
---|
1499 | module=yes |
---|
1500 | continue |
---|
1501 | ;; |
---|
1502 | |
---|
1503 | # gcc -m* arguments should be passed to the linker via $compiler_flags |
---|
1504 | # in order to pass architecture information to the linker |
---|
1505 | # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo |
---|
1506 | # but this is not reliable with gcc because gcc may use -mfoo to |
---|
1507 | # select a different linker, different libraries, etc, while |
---|
1508 | # -Wl,-mfoo simply passes -mfoo to the linker. |
---|
1509 | -m*) |
---|
1510 | # Unknown arguments in both finalize_command and compile_command need |
---|
1511 | # to be aesthetically quoted because they are evaled later. |
---|
1512 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
---|
1513 | case $arg in |
---|
1514 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
1515 | arg="\"$arg\"" |
---|
1516 | ;; |
---|
1517 | esac |
---|
1518 | compile_command="$compile_command $arg" |
---|
1519 | finalize_command="$finalize_command $arg" |
---|
1520 | if test "$with_gcc" = "yes" ; then |
---|
1521 | compiler_flags="$compiler_flags $arg" |
---|
1522 | fi |
---|
1523 | continue |
---|
1524 | ;; |
---|
1525 | |
---|
1526 | -shrext) |
---|
1527 | prev=shrext |
---|
1528 | continue |
---|
1529 | ;; |
---|
1530 | |
---|
1531 | -no-fast-install) |
---|
1532 | fast_install=no |
---|
1533 | continue |
---|
1534 | ;; |
---|
1535 | |
---|
1536 | -no-install) |
---|
1537 | case $host in |
---|
1538 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
---|
1539 | # The PATH hackery in wrapper scripts is required on Windows |
---|
1540 | # in order for the loader to find any dlls it needs. |
---|
1541 | $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 |
---|
1542 | $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 |
---|
1543 | fast_install=no |
---|
1544 | ;; |
---|
1545 | *) no_install=yes ;; |
---|
1546 | esac |
---|
1547 | continue |
---|
1548 | ;; |
---|
1549 | |
---|
1550 | -no-undefined) |
---|
1551 | allow_undefined=no |
---|
1552 | continue |
---|
1553 | ;; |
---|
1554 | |
---|
1555 | -objectlist) |
---|
1556 | prev=objectlist |
---|
1557 | continue |
---|
1558 | ;; |
---|
1559 | |
---|
1560 | -o) prev=output ;; |
---|
1561 | |
---|
1562 | -precious-files-regex) |
---|
1563 | prev=precious_regex |
---|
1564 | continue |
---|
1565 | ;; |
---|
1566 | |
---|
1567 | -release) |
---|
1568 | prev=release |
---|
1569 | continue |
---|
1570 | ;; |
---|
1571 | |
---|
1572 | -rpath) |
---|
1573 | prev=rpath |
---|
1574 | continue |
---|
1575 | ;; |
---|
1576 | |
---|
1577 | -R) |
---|
1578 | prev=xrpath |
---|
1579 | continue |
---|
1580 | ;; |
---|
1581 | |
---|
1582 | -R*) |
---|
1583 | dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` |
---|
1584 | # We need an absolute path. |
---|
1585 | case $dir in |
---|
1586 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
---|
1587 | *) |
---|
1588 | $echo "$modename: only absolute run-paths are allowed" 1>&2 |
---|
1589 | exit $EXIT_FAILURE |
---|
1590 | ;; |
---|
1591 | esac |
---|
1592 | case "$xrpath " in |
---|
1593 | *" $dir "*) ;; |
---|
1594 | *) xrpath="$xrpath $dir" ;; |
---|
1595 | esac |
---|
1596 | continue |
---|
1597 | ;; |
---|
1598 | |
---|
1599 | -static) |
---|
1600 | # The effects of -static are defined in a previous loop. |
---|
1601 | # We used to do the same as -all-static on platforms that |
---|
1602 | # didn't have a PIC flag, but the assumption that the effects |
---|
1603 | # would be equivalent was wrong. It would break on at least |
---|
1604 | # Digital Unix and AIX. |
---|
1605 | continue |
---|
1606 | ;; |
---|
1607 | |
---|
1608 | -thread-safe) |
---|
1609 | thread_safe=yes |
---|
1610 | continue |
---|
1611 | ;; |
---|
1612 | |
---|
1613 | -version-info) |
---|
1614 | prev=vinfo |
---|
1615 | continue |
---|
1616 | ;; |
---|
1617 | -version-number) |
---|
1618 | prev=vinfo |
---|
1619 | vinfo_number=yes |
---|
1620 | continue |
---|
1621 | ;; |
---|
1622 | |
---|
1623 | -Wc,*) |
---|
1624 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` |
---|
1625 | arg= |
---|
1626 | save_ifs="$IFS"; IFS=',' |
---|
1627 | for flag in $args; do |
---|
1628 | IFS="$save_ifs" |
---|
1629 | case $flag in |
---|
1630 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
1631 | flag="\"$flag\"" |
---|
1632 | ;; |
---|
1633 | esac |
---|
1634 | arg="$arg $wl$flag" |
---|
1635 | compiler_flags="$compiler_flags $flag" |
---|
1636 | done |
---|
1637 | IFS="$save_ifs" |
---|
1638 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` |
---|
1639 | ;; |
---|
1640 | |
---|
1641 | -Wl,*) |
---|
1642 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` |
---|
1643 | arg= |
---|
1644 | save_ifs="$IFS"; IFS=',' |
---|
1645 | for flag in $args; do |
---|
1646 | IFS="$save_ifs" |
---|
1647 | case $flag in |
---|
1648 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
1649 | flag="\"$flag\"" |
---|
1650 | ;; |
---|
1651 | esac |
---|
1652 | arg="$arg $wl$flag" |
---|
1653 | compiler_flags="$compiler_flags $wl$flag" |
---|
1654 | linker_flags="$linker_flags $flag" |
---|
1655 | done |
---|
1656 | IFS="$save_ifs" |
---|
1657 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` |
---|
1658 | ;; |
---|
1659 | |
---|
1660 | -Xcompiler) |
---|
1661 | prev=xcompiler |
---|
1662 | continue |
---|
1663 | ;; |
---|
1664 | |
---|
1665 | -Xlinker) |
---|
1666 | prev=xlinker |
---|
1667 | continue |
---|
1668 | ;; |
---|
1669 | |
---|
1670 | -XCClinker) |
---|
1671 | prev=xcclinker |
---|
1672 | continue |
---|
1673 | ;; |
---|
1674 | |
---|
1675 | # Some other compiler flag. |
---|
1676 | -* | +*) |
---|
1677 | # Unknown arguments in both finalize_command and compile_command need |
---|
1678 | # to be aesthetically quoted because they are evaled later. |
---|
1679 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
---|
1680 | case $arg in |
---|
1681 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
1682 | arg="\"$arg\"" |
---|
1683 | ;; |
---|
1684 | esac |
---|
1685 | ;; |
---|
1686 | |
---|
1687 | *.$objext) |
---|
1688 | # A standard object. |
---|
1689 | objs="$objs $arg" |
---|
1690 | ;; |
---|
1691 | |
---|
1692 | *.lo) |
---|
1693 | # A libtool-controlled object. |
---|
1694 | |
---|
1695 | # Check to see that this really is a libtool object. |
---|
1696 | if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
1697 | pic_object= |
---|
1698 | non_pic_object= |
---|
1699 | |
---|
1700 | # Read the .lo file |
---|
1701 | # If there is no directory component, then add one. |
---|
1702 | case $arg in |
---|
1703 | */* | *\\*) . $arg ;; |
---|
1704 | *) . ./$arg ;; |
---|
1705 | esac |
---|
1706 | |
---|
1707 | if test -z "$pic_object" || \ |
---|
1708 | test -z "$non_pic_object" || |
---|
1709 | test "$pic_object" = none && \ |
---|
1710 | test "$non_pic_object" = none; then |
---|
1711 | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 |
---|
1712 | exit $EXIT_FAILURE |
---|
1713 | fi |
---|
1714 | |
---|
1715 | # Extract subdirectory from the argument. |
---|
1716 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
---|
1717 | if test "X$xdir" = "X$arg"; then |
---|
1718 | xdir= |
---|
1719 | else |
---|
1720 | xdir="$xdir/" |
---|
1721 | fi |
---|
1722 | |
---|
1723 | if test "$pic_object" != none; then |
---|
1724 | # Prepend the subdirectory the object is found in. |
---|
1725 | pic_object="$xdir$pic_object" |
---|
1726 | |
---|
1727 | if test "$prev" = dlfiles; then |
---|
1728 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
---|
1729 | dlfiles="$dlfiles $pic_object" |
---|
1730 | prev= |
---|
1731 | continue |
---|
1732 | else |
---|
1733 | # If libtool objects are unsupported, then we need to preload. |
---|
1734 | prev=dlprefiles |
---|
1735 | fi |
---|
1736 | fi |
---|
1737 | |
---|
1738 | # CHECK ME: I think I busted this. -Ossama |
---|
1739 | if test "$prev" = dlprefiles; then |
---|
1740 | # Preload the old-style object. |
---|
1741 | dlprefiles="$dlprefiles $pic_object" |
---|
1742 | prev= |
---|
1743 | fi |
---|
1744 | |
---|
1745 | # A PIC object. |
---|
1746 | libobjs="$libobjs $pic_object" |
---|
1747 | arg="$pic_object" |
---|
1748 | fi |
---|
1749 | |
---|
1750 | # Non-PIC object. |
---|
1751 | if test "$non_pic_object" != none; then |
---|
1752 | # Prepend the subdirectory the object is found in. |
---|
1753 | non_pic_object="$xdir$non_pic_object" |
---|
1754 | |
---|
1755 | # A standard non-PIC object |
---|
1756 | non_pic_objects="$non_pic_objects $non_pic_object" |
---|
1757 | if test -z "$pic_object" || test "$pic_object" = none ; then |
---|
1758 | arg="$non_pic_object" |
---|
1759 | fi |
---|
1760 | fi |
---|
1761 | else |
---|
1762 | # Only an error if not doing a dry-run. |
---|
1763 | if test -z "$run"; then |
---|
1764 | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 |
---|
1765 | exit $EXIT_FAILURE |
---|
1766 | else |
---|
1767 | # Dry-run case. |
---|
1768 | |
---|
1769 | # Extract subdirectory from the argument. |
---|
1770 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
---|
1771 | if test "X$xdir" = "X$arg"; then |
---|
1772 | xdir= |
---|
1773 | else |
---|
1774 | xdir="$xdir/" |
---|
1775 | fi |
---|
1776 | |
---|
1777 | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` |
---|
1778 | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` |
---|
1779 | libobjs="$libobjs $pic_object" |
---|
1780 | non_pic_objects="$non_pic_objects $non_pic_object" |
---|
1781 | fi |
---|
1782 | fi |
---|
1783 | ;; |
---|
1784 | |
---|
1785 | *.$libext) |
---|
1786 | # An archive. |
---|
1787 | deplibs="$deplibs $arg" |
---|
1788 | old_deplibs="$old_deplibs $arg" |
---|
1789 | continue |
---|
1790 | ;; |
---|
1791 | |
---|
1792 | *.la) |
---|
1793 | # A libtool-controlled library. |
---|
1794 | |
---|
1795 | if test "$prev" = dlfiles; then |
---|
1796 | # This library was specified with -dlopen. |
---|
1797 | dlfiles="$dlfiles $arg" |
---|
1798 | prev= |
---|
1799 | elif test "$prev" = dlprefiles; then |
---|
1800 | # The library was specified with -dlpreopen. |
---|
1801 | dlprefiles="$dlprefiles $arg" |
---|
1802 | prev= |
---|
1803 | else |
---|
1804 | deplibs="$deplibs $arg" |
---|
1805 | fi |
---|
1806 | continue |
---|
1807 | ;; |
---|
1808 | |
---|
1809 | # Some other compiler argument. |
---|
1810 | *) |
---|
1811 | # Unknown arguments in both finalize_command and compile_command need |
---|
1812 | # to be aesthetically quoted because they are evaled later. |
---|
1813 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
---|
1814 | case $arg in |
---|
1815 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
---|
1816 | arg="\"$arg\"" |
---|
1817 | ;; |
---|
1818 | esac |
---|
1819 | ;; |
---|
1820 | esac # arg |
---|
1821 | |
---|
1822 | # Now actually substitute the argument into the commands. |
---|
1823 | if test -n "$arg"; then |
---|
1824 | compile_command="$compile_command $arg" |
---|
1825 | finalize_command="$finalize_command $arg" |
---|
1826 | fi |
---|
1827 | done # argument parsing loop |
---|
1828 | |
---|
1829 | if test -n "$prev"; then |
---|
1830 | $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 |
---|
1831 | $echo "$help" 1>&2 |
---|
1832 | exit $EXIT_FAILURE |
---|
1833 | fi |
---|
1834 | |
---|
1835 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then |
---|
1836 | eval arg=\"$export_dynamic_flag_spec\" |
---|
1837 | compile_command="$compile_command $arg" |
---|
1838 | finalize_command="$finalize_command $arg" |
---|
1839 | fi |
---|
1840 | |
---|
1841 | oldlibs= |
---|
1842 | # calculate the name of the file, without its directory |
---|
1843 | outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` |
---|
1844 | libobjs_save="$libobjs" |
---|
1845 | |
---|
1846 | if test -n "$shlibpath_var"; then |
---|
1847 | # get the directories listed in $shlibpath_var |
---|
1848 | eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` |
---|
1849 | else |
---|
1850 | shlib_search_path= |
---|
1851 | fi |
---|
1852 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" |
---|
1853 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" |
---|
1854 | |
---|
1855 | output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` |
---|
1856 | if test "X$output_objdir" = "X$output"; then |
---|
1857 | output_objdir="$objdir" |
---|
1858 | else |
---|
1859 | output_objdir="$output_objdir/$objdir" |
---|
1860 | fi |
---|
1861 | # Create the object directory. |
---|
1862 | if test ! -d "$output_objdir"; then |
---|
1863 | $show "$mkdir $output_objdir" |
---|
1864 | $run $mkdir $output_objdir |
---|
1865 | status=$? |
---|
1866 | if test "$status" -ne 0 && test ! -d "$output_objdir"; then |
---|
1867 | exit $status |
---|
1868 | fi |
---|
1869 | fi |
---|
1870 | |
---|
1871 | # Determine the type of output |
---|
1872 | case $output in |
---|
1873 | "") |
---|
1874 | $echo "$modename: you must specify an output file" 1>&2 |
---|
1875 | $echo "$help" 1>&2 |
---|
1876 | exit $EXIT_FAILURE |
---|
1877 | ;; |
---|
1878 | *.$libext) linkmode=oldlib ;; |
---|
1879 | *.lo | *.$objext) linkmode=obj ;; |
---|
1880 | *.la) linkmode=lib ;; |
---|
1881 | *) linkmode=prog ;; # Anything else should be a program. |
---|
1882 | esac |
---|
1883 | |
---|
1884 | case $host in |
---|
1885 | *cygwin* | *mingw* | *pw32*) |
---|
1886 | # don't eliminate duplications in $postdeps and $predeps |
---|
1887 | duplicate_compiler_generated_deps=yes |
---|
1888 | ;; |
---|
1889 | *) |
---|
1890 | duplicate_compiler_generated_deps=$duplicate_deps |
---|
1891 | ;; |
---|
1892 | esac |
---|
1893 | specialdeplibs= |
---|
1894 | |
---|
1895 | libs= |
---|
1896 | # Find all interdependent deplibs by searching for libraries |
---|
1897 | # that are linked more than once (e.g. -la -lb -la) |
---|
1898 | for deplib in $deplibs; do |
---|
1899 | if test "X$duplicate_deps" = "Xyes" ; then |
---|
1900 | case "$libs " in |
---|
1901 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
---|
1902 | esac |
---|
1903 | fi |
---|
1904 | libs="$libs $deplib" |
---|
1905 | done |
---|
1906 | |
---|
1907 | if test "$linkmode" = lib; then |
---|
1908 | libs="$predeps $libs $compiler_lib_search_path $postdeps" |
---|
1909 | |
---|
1910 | # Compute libraries that are listed more than once in $predeps |
---|
1911 | # $postdeps and mark them as special (i.e., whose duplicates are |
---|
1912 | # not to be eliminated). |
---|
1913 | pre_post_deps= |
---|
1914 | if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then |
---|
1915 | for pre_post_dep in $predeps $postdeps; do |
---|
1916 | case "$pre_post_deps " in |
---|
1917 | *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; |
---|
1918 | esac |
---|
1919 | pre_post_deps="$pre_post_deps $pre_post_dep" |
---|
1920 | done |
---|
1921 | fi |
---|
1922 | pre_post_deps= |
---|
1923 | fi |
---|
1924 | |
---|
1925 | deplibs= |
---|
1926 | newdependency_libs= |
---|
1927 | newlib_search_path= |
---|
1928 | need_relink=no # whether we're linking any uninstalled libtool libraries |
---|
1929 | notinst_deplibs= # not-installed libtool libraries |
---|
1930 | notinst_path= # paths that contain not-installed libtool libraries |
---|
1931 | case $linkmode in |
---|
1932 | lib) |
---|
1933 | passes="conv link" |
---|
1934 | for file in $dlfiles $dlprefiles; do |
---|
1935 | case $file in |
---|
1936 | *.la) ;; |
---|
1937 | *) |
---|
1938 | $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 |
---|
1939 | exit $EXIT_FAILURE |
---|
1940 | ;; |
---|
1941 | esac |
---|
1942 | done |
---|
1943 | ;; |
---|
1944 | prog) |
---|
1945 | compile_deplibs= |
---|
1946 | finalize_deplibs= |
---|
1947 | alldeplibs=no |
---|
1948 | newdlfiles= |
---|
1949 | newdlprefiles= |
---|
1950 | passes="conv scan dlopen dlpreopen link" |
---|
1951 | ;; |
---|
1952 | *) passes="conv" |
---|
1953 | ;; |
---|
1954 | esac |
---|
1955 | for pass in $passes; do |
---|
1956 | if test "$linkmode,$pass" = "lib,link" || |
---|
1957 | test "$linkmode,$pass" = "prog,scan"; then |
---|
1958 | libs="$deplibs" |
---|
1959 | deplibs= |
---|
1960 | fi |
---|
1961 | if test "$linkmode" = prog; then |
---|
1962 | case $pass in |
---|
1963 | dlopen) libs="$dlfiles" ;; |
---|
1964 | dlpreopen) libs="$dlprefiles" ;; |
---|
1965 | link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; |
---|
1966 | esac |
---|
1967 | fi |
---|
1968 | if test "$pass" = dlopen; then |
---|
1969 | # Collect dlpreopened libraries |
---|
1970 | save_deplibs="$deplibs" |
---|
1971 | deplibs= |
---|
1972 | fi |
---|
1973 | for deplib in $libs; do |
---|
1974 | lib= |
---|
1975 | found=no |
---|
1976 | case $deplib in |
---|
1977 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) |
---|
1978 | if test "$linkmode,$pass" = "prog,link"; then |
---|
1979 | compile_deplibs="$deplib $compile_deplibs" |
---|
1980 | finalize_deplibs="$deplib $finalize_deplibs" |
---|
1981 | else |
---|
1982 | deplibs="$deplib $deplibs" |
---|
1983 | fi |
---|
1984 | continue |
---|
1985 | ;; |
---|
1986 | -l*) |
---|
1987 | if test "$linkmode" != lib && test "$linkmode" != prog; then |
---|
1988 | $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 |
---|
1989 | continue |
---|
1990 | fi |
---|
1991 | if test "$pass" = conv; then |
---|
1992 | deplibs="$deplib $deplibs" |
---|
1993 | continue |
---|
1994 | fi |
---|
1995 | name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` |
---|
1996 | for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do |
---|
1997 | for search_ext in .la $std_shrext .so .a; do |
---|
1998 | # Search the libtool library |
---|
1999 | lib="$searchdir/lib${name}${search_ext}" |
---|
2000 | if test -f "$lib"; then |
---|
2001 | if test "$search_ext" = ".la"; then |
---|
2002 | found=yes |
---|
2003 | else |
---|
2004 | found=no |
---|
2005 | fi |
---|
2006 | break 2 |
---|
2007 | fi |
---|
2008 | done |
---|
2009 | done |
---|
2010 | if test "$found" != yes; then |
---|
2011 | # deplib doesn't seem to be a libtool library |
---|
2012 | if test "$linkmode,$pass" = "prog,link"; then |
---|
2013 | compile_deplibs="$deplib $compile_deplibs" |
---|
2014 | finalize_deplibs="$deplib $finalize_deplibs" |
---|
2015 | else |
---|
2016 | deplibs="$deplib $deplibs" |
---|
2017 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
---|
2018 | fi |
---|
2019 | continue |
---|
2020 | else # deplib is a libtool library |
---|
2021 | # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, |
---|
2022 | # We need to do some special things here, and not later. |
---|
2023 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
---|
2024 | case " $predeps $postdeps " in |
---|
2025 | *" $deplib "*) |
---|
2026 | if (${SED} -e '2q' $lib | |
---|
2027 | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
2028 | library_names= |
---|
2029 | old_library= |
---|
2030 | case $lib in |
---|
2031 | */* | *\\*) . $lib ;; |
---|
2032 | *) . ./$lib ;; |
---|
2033 | esac |
---|
2034 | for l in $old_library $library_names; do |
---|
2035 | ll="$l" |
---|
2036 | done |
---|
2037 | if test "X$ll" = "X$old_library" ; then # only static version available |
---|
2038 | found=no |
---|
2039 | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` |
---|
2040 | test "X$ladir" = "X$lib" && ladir="." |
---|
2041 | lib=$ladir/$old_library |
---|
2042 | if test "$linkmode,$pass" = "prog,link"; then |
---|
2043 | compile_deplibs="$deplib $compile_deplibs" |
---|
2044 | finalize_deplibs="$deplib $finalize_deplibs" |
---|
2045 | else |
---|
2046 | deplibs="$deplib $deplibs" |
---|
2047 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
---|
2048 | fi |
---|
2049 | continue |
---|
2050 | fi |
---|
2051 | fi |
---|
2052 | ;; |
---|
2053 | *) ;; |
---|
2054 | esac |
---|
2055 | fi |
---|
2056 | fi |
---|
2057 | ;; # -l |
---|
2058 | -L*) |
---|
2059 | case $linkmode in |
---|
2060 | lib) |
---|
2061 | deplibs="$deplib $deplibs" |
---|
2062 | test "$pass" = conv && continue |
---|
2063 | newdependency_libs="$deplib $newdependency_libs" |
---|
2064 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` |
---|
2065 | ;; |
---|
2066 | prog) |
---|
2067 | if test "$pass" = conv; then |
---|
2068 | deplibs="$deplib $deplibs" |
---|
2069 | continue |
---|
2070 | fi |
---|
2071 | if test "$pass" = scan; then |
---|
2072 | deplibs="$deplib $deplibs" |
---|
2073 | else |
---|
2074 | compile_deplibs="$deplib $compile_deplibs" |
---|
2075 | finalize_deplibs="$deplib $finalize_deplibs" |
---|
2076 | fi |
---|
2077 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` |
---|
2078 | ;; |
---|
2079 | *) |
---|
2080 | $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 |
---|
2081 | ;; |
---|
2082 | esac # linkmode |
---|
2083 | continue |
---|
2084 | ;; # -L |
---|
2085 | -R*) |
---|
2086 | if test "$pass" = link; then |
---|
2087 | dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` |
---|
2088 | # Make sure the xrpath contains only unique directories. |
---|
2089 | case "$xrpath " in |
---|
2090 | *" $dir "*) ;; |
---|
2091 | *) xrpath="$xrpath $dir" ;; |
---|
2092 | esac |
---|
2093 | fi |
---|
2094 | deplibs="$deplib $deplibs" |
---|
2095 | continue |
---|
2096 | ;; |
---|
2097 | *.la) lib="$deplib" ;; |
---|
2098 | *.$libext) |
---|
2099 | if test "$pass" = conv; then |
---|
2100 | deplibs="$deplib $deplibs" |
---|
2101 | continue |
---|
2102 | fi |
---|
2103 | case $linkmode in |
---|
2104 | lib) |
---|
2105 | valid_a_lib=no |
---|
2106 | case $deplibs_check_method in |
---|
2107 | match_pattern*) |
---|
2108 | set dummy $deplibs_check_method |
---|
2109 | match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
---|
2110 | if eval $echo \"$deplib\" 2>/dev/null \ |
---|
2111 | | $SED 10q \ |
---|
2112 | | $EGREP "$match_pattern_regex" > /dev/null; then |
---|
2113 | valid_a_lib=yes |
---|
2114 | fi |
---|
2115 | ;; |
---|
2116 | pass_all) |
---|
2117 | valid_a_lib=yes |
---|
2118 | ;; |
---|
2119 | esac |
---|
2120 | if test "$valid_a_lib" != yes; then |
---|
2121 | $echo |
---|
2122 | $echo "*** Warning: Trying to link with static lib archive $deplib." |
---|
2123 | $echo "*** I have the capability to make that library automatically link in when" |
---|
2124 | $echo "*** you link to this library. But I can only do this if you have a" |
---|
2125 | $echo "*** shared version of the library, which you do not appear to have" |
---|
2126 | $echo "*** because the file extensions .$libext of this argument makes me believe" |
---|
2127 | $echo "*** that it is just a static archive that I should not used here." |
---|
2128 | else |
---|
2129 | $echo |
---|
2130 | $echo "*** Warning: Linking the shared library $output against the" |
---|
2131 | $echo "*** static library $deplib is not portable!" |
---|
2132 | deplibs="$deplib $deplibs" |
---|
2133 | fi |
---|
2134 | continue |
---|
2135 | ;; |
---|
2136 | prog) |
---|
2137 | if test "$pass" != link; then |
---|
2138 | deplibs="$deplib $deplibs" |
---|
2139 | else |
---|
2140 | compile_deplibs="$deplib $compile_deplibs" |
---|
2141 | finalize_deplibs="$deplib $finalize_deplibs" |
---|
2142 | fi |
---|
2143 | continue |
---|
2144 | ;; |
---|
2145 | esac # linkmode |
---|
2146 | ;; # *.$libext |
---|
2147 | *.lo | *.$objext) |
---|
2148 | if test "$pass" = conv; then |
---|
2149 | deplibs="$deplib $deplibs" |
---|
2150 | elif test "$linkmode" = prog; then |
---|
2151 | if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then |
---|
2152 | # If there is no dlopen support or we're linking statically, |
---|
2153 | # we need to preload. |
---|
2154 | newdlprefiles="$newdlprefiles $deplib" |
---|
2155 | compile_deplibs="$deplib $compile_deplibs" |
---|
2156 | finalize_deplibs="$deplib $finalize_deplibs" |
---|
2157 | else |
---|
2158 | newdlfiles="$newdlfiles $deplib" |
---|
2159 | fi |
---|
2160 | fi |
---|
2161 | continue |
---|
2162 | ;; |
---|
2163 | %DEPLIBS%) |
---|
2164 | alldeplibs=yes |
---|
2165 | continue |
---|
2166 | ;; |
---|
2167 | esac # case $deplib |
---|
2168 | if test "$found" = yes || test -f "$lib"; then : |
---|
2169 | else |
---|
2170 | $echo "$modename: cannot find the library \`$lib'" 1>&2 |
---|
2171 | exit $EXIT_FAILURE |
---|
2172 | fi |
---|
2173 | |
---|
2174 | # Check to see that this really is a libtool archive. |
---|
2175 | if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
---|
2176 | else |
---|
2177 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
---|
2178 | exit $EXIT_FAILURE |
---|
2179 | fi |
---|
2180 | |
---|
2181 | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` |
---|
2182 | test "X$ladir" = "X$lib" && ladir="." |
---|
2183 | |
---|
2184 | dlname= |
---|
2185 | dlopen= |
---|
2186 | dlpreopen= |
---|
2187 | libdir= |
---|
2188 | library_names= |
---|
2189 | old_library= |
---|
2190 | # If the library was installed with an old release of libtool, |
---|
2191 | # it will not redefine variables installed, or shouldnotlink |
---|
2192 | installed=yes |
---|
2193 | shouldnotlink=no |
---|
2194 | |
---|
2195 | # Read the .la file |
---|
2196 | case $lib in |
---|
2197 | */* | *\\*) . $lib ;; |
---|
2198 | *) . ./$lib ;; |
---|
2199 | esac |
---|
2200 | |
---|
2201 | if test "$linkmode,$pass" = "lib,link" || |
---|
2202 | test "$linkmode,$pass" = "prog,scan" || |
---|
2203 | { test "$linkmode" != prog && test "$linkmode" != lib; }; then |
---|
2204 | test -n "$dlopen" && dlfiles="$dlfiles $dlopen" |
---|
2205 | test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" |
---|
2206 | fi |
---|
2207 | |
---|
2208 | if test "$pass" = conv; then |
---|
2209 | # Only check for convenience libraries |
---|
2210 | deplibs="$lib $deplibs" |
---|
2211 | if test -z "$libdir"; then |
---|
2212 | if test -z "$old_library"; then |
---|
2213 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 |
---|
2214 | exit $EXIT_FAILURE |
---|
2215 | fi |
---|
2216 | # It is a libtool convenience library, so add in its objects. |
---|
2217 | convenience="$convenience $ladir/$objdir/$old_library" |
---|
2218 | old_convenience="$old_convenience $ladir/$objdir/$old_library" |
---|
2219 | tmp_libs= |
---|
2220 | for deplib in $dependency_libs; do |
---|
2221 | deplibs="$deplib $deplibs" |
---|
2222 | if test "X$duplicate_deps" = "Xyes" ; then |
---|
2223 | case "$tmp_libs " in |
---|
2224 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
---|
2225 | esac |
---|
2226 | fi |
---|
2227 | tmp_libs="$tmp_libs $deplib" |
---|
2228 | done |
---|
2229 | elif test "$linkmode" != prog && test "$linkmode" != lib; then |
---|
2230 | $echo "$modename: \`$lib' is not a convenience library" 1>&2 |
---|
2231 | exit $EXIT_FAILURE |
---|
2232 | fi |
---|
2233 | continue |
---|
2234 | fi # $pass = conv |
---|
2235 | |
---|
2236 | |
---|
2237 | # Get the name of the library we link against. |
---|
2238 | linklib= |
---|
2239 | for l in $old_library $library_names; do |
---|
2240 | linklib="$l" |
---|
2241 | done |
---|
2242 | if test -z "$linklib"; then |
---|
2243 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 |
---|
2244 | exit $EXIT_FAILURE |
---|
2245 | fi |
---|
2246 | |
---|
2247 | # This library was specified with -dlopen. |
---|
2248 | if test "$pass" = dlopen; then |
---|
2249 | if test -z "$libdir"; then |
---|
2250 | $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 |
---|
2251 | exit $EXIT_FAILURE |
---|
2252 | fi |
---|
2253 | if test -z "$dlname" || |
---|
2254 | test "$dlopen_support" != yes || |
---|
2255 | test "$build_libtool_libs" = no; then |
---|
2256 | # If there is no dlname, no dlopen support or we're linking |
---|
2257 | # statically, we need to preload. We also need to preload any |
---|
2258 | # dependent libraries so libltdl's deplib preloader doesn't |
---|
2259 | # bomb out in the load deplibs phase. |
---|
2260 | dlprefiles="$dlprefiles $lib $dependency_libs" |
---|
2261 | else |
---|
2262 | newdlfiles="$newdlfiles $lib" |
---|
2263 | fi |
---|
2264 | continue |
---|
2265 | fi # $pass = dlopen |
---|
2266 | |
---|
2267 | # We need an absolute path. |
---|
2268 | case $ladir in |
---|
2269 | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; |
---|
2270 | *) |
---|
2271 | abs_ladir=`cd "$ladir" && pwd` |
---|
2272 | if test -z "$abs_ladir"; then |
---|
2273 | $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 |
---|
2274 | $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 |
---|
2275 | abs_ladir="$ladir" |
---|
2276 | fi |
---|
2277 | ;; |
---|
2278 | esac |
---|
2279 | laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` |
---|
2280 | |
---|
2281 | # Find the relevant object directory and library name. |
---|
2282 | if test "X$installed" = Xyes; then |
---|
2283 | if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
---|
2284 | $echo "$modename: warning: library \`$lib' was moved." 1>&2 |
---|
2285 | dir="$ladir" |
---|
2286 | absdir="$abs_ladir" |
---|
2287 | libdir="$abs_ladir" |
---|
2288 | else |
---|
2289 | dir="$libdir" |
---|
2290 | absdir="$libdir" |
---|
2291 | fi |
---|
2292 | else |
---|
2293 | if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
---|
2294 | dir="$ladir" |
---|
2295 | absdir="$abs_ladir" |
---|
2296 | # Remove this search path later |
---|
2297 | notinst_path="$notinst_path $abs_ladir" |
---|
2298 | else |
---|
2299 | dir="$ladir/$objdir" |
---|
2300 | absdir="$abs_ladir/$objdir" |
---|
2301 | # Remove this search path later |
---|
2302 | notinst_path="$notinst_path $abs_ladir" |
---|
2303 | fi |
---|
2304 | fi # $installed = yes |
---|
2305 | name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` |
---|
2306 | |
---|
2307 | # This library was specified with -dlpreopen. |
---|
2308 | if test "$pass" = dlpreopen; then |
---|
2309 | if test -z "$libdir"; then |
---|
2310 | $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 |
---|
2311 | exit $EXIT_FAILURE |
---|
2312 | fi |
---|
2313 | # Prefer using a static library (so that no silly _DYNAMIC symbols |
---|
2314 | # are required to link). |
---|
2315 | if test -n "$old_library"; then |
---|
2316 | newdlprefiles="$newdlprefiles $dir/$old_library" |
---|
2317 | # Otherwise, use the dlname, so that lt_dlopen finds it. |
---|
2318 | elif test -n "$dlname"; then |
---|
2319 | newdlprefiles="$newdlprefiles $dir/$dlname" |
---|
2320 | else |
---|
2321 | newdlprefiles="$newdlprefiles $dir/$linklib" |
---|
2322 | fi |
---|
2323 | fi # $pass = dlpreopen |
---|
2324 | |
---|
2325 | if test -z "$libdir"; then |
---|
2326 | # Link the convenience library |
---|
2327 | if test "$linkmode" = lib; then |
---|
2328 | deplibs="$dir/$old_library $deplibs" |
---|
2329 | elif test "$linkmode,$pass" = "prog,link"; then |
---|
2330 | compile_deplibs="$dir/$old_library $compile_deplibs" |
---|
2331 | finalize_deplibs="$dir/$old_library $finalize_deplibs" |
---|
2332 | else |
---|
2333 | deplibs="$lib $deplibs" # used for prog,scan pass |
---|
2334 | fi |
---|
2335 | continue |
---|
2336 | fi |
---|
2337 | |
---|
2338 | |
---|
2339 | if test "$linkmode" = prog && test "$pass" != link; then |
---|
2340 | newlib_search_path="$newlib_search_path $ladir" |
---|
2341 | deplibs="$lib $deplibs" |
---|
2342 | |
---|
2343 | linkalldeplibs=no |
---|
2344 | if test "$link_all_deplibs" != no || test -z "$library_names" || |
---|
2345 | test "$build_libtool_libs" = no; then |
---|
2346 | linkalldeplibs=yes |
---|
2347 | fi |
---|
2348 | |
---|
2349 | tmp_libs= |
---|
2350 | for deplib in $dependency_libs; do |
---|
2351 | case $deplib in |
---|
2352 | -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test |
---|
2353 | esac |
---|
2354 | # Need to link against all dependency_libs? |
---|
2355 | if test "$linkalldeplibs" = yes; then |
---|
2356 | deplibs="$deplib $deplibs" |
---|
2357 | else |
---|
2358 | # Need to hardcode shared library paths |
---|
2359 | # or/and link against static libraries |
---|
2360 | newdependency_libs="$deplib $newdependency_libs" |
---|
2361 | fi |
---|
2362 | if test "X$duplicate_deps" = "Xyes" ; then |
---|
2363 | case "$tmp_libs " in |
---|
2364 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
---|
2365 | esac |
---|
2366 | fi |
---|
2367 | tmp_libs="$tmp_libs $deplib" |
---|
2368 | done # for deplib |
---|
2369 | continue |
---|
2370 | fi # $linkmode = prog... |
---|
2371 | |
---|
2372 | if test "$linkmode,$pass" = "prog,link"; then |
---|
2373 | if test -n "$library_names" && |
---|
2374 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then |
---|
2375 | # We need to hardcode the library path |
---|
2376 | if test -n "$shlibpath_var"; then |
---|
2377 | # Make sure the rpath contains only unique directories. |
---|
2378 | case "$temp_rpath " in |
---|
2379 | *" $dir "*) ;; |
---|
2380 | *" $absdir "*) ;; |
---|
2381 | *) temp_rpath="$temp_rpath $dir" ;; |
---|
2382 | esac |
---|
2383 | fi |
---|
2384 | |
---|
2385 | # Hardcode the library path. |
---|
2386 | # Skip directories that are in the system default run-time |
---|
2387 | # search path. |
---|
2388 | case " $sys_lib_dlsearch_path " in |
---|
2389 | *" $absdir "*) ;; |
---|
2390 | *) |
---|
2391 | case "$compile_rpath " in |
---|
2392 | *" $absdir "*) ;; |
---|
2393 | *) compile_rpath="$compile_rpath $absdir" |
---|
2394 | esac |
---|
2395 | ;; |
---|
2396 | esac |
---|
2397 | case " $sys_lib_dlsearch_path " in |
---|
2398 | *" $libdir "*) ;; |
---|
2399 | *) |
---|
2400 | case "$finalize_rpath " in |
---|
2401 | *" $libdir "*) ;; |
---|
2402 | *) finalize_rpath="$finalize_rpath $libdir" |
---|
2403 | esac |
---|
2404 | ;; |
---|
2405 | esac |
---|
2406 | fi # $linkmode,$pass = prog,link... |
---|
2407 | |
---|
2408 | if test "$alldeplibs" = yes && |
---|
2409 | { test "$deplibs_check_method" = pass_all || |
---|
2410 | { test "$build_libtool_libs" = yes && |
---|
2411 | test -n "$library_names"; }; }; then |
---|
2412 | # We only need to search for static libraries |
---|
2413 | continue |
---|
2414 | fi |
---|
2415 | fi |
---|
2416 | |
---|
2417 | link_static=no # Whether the deplib will be linked statically |
---|
2418 | if test -n "$library_names" && |
---|
2419 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then |
---|
2420 | if test "$installed" = no; then |
---|
2421 | notinst_deplibs="$notinst_deplibs $lib" |
---|
2422 | need_relink=yes |
---|
2423 | fi |
---|
2424 | # This is a shared library |
---|
2425 | |
---|
2426 | # Warn about portability, can't link against -module's on |
---|
2427 | # some systems (darwin) |
---|
2428 | if test "$shouldnotlink" = yes && test "$pass" = link ; then |
---|
2429 | $echo |
---|
2430 | if test "$linkmode" = prog; then |
---|
2431 | $echo "*** Warning: Linking the executable $output against the loadable module" |
---|
2432 | else |
---|
2433 | $echo "*** Warning: Linking the shared library $output against the loadable module" |
---|
2434 | fi |
---|
2435 | $echo "*** $linklib is not portable!" |
---|
2436 | fi |
---|
2437 | if test "$linkmode" = lib && |
---|
2438 | test "$hardcode_into_libs" = yes; then |
---|
2439 | # Hardcode the library path. |
---|
2440 | # Skip directories that are in the system default run-time |
---|
2441 | # search path. |
---|
2442 | case " $sys_lib_dlsearch_path " in |
---|
2443 | *" $absdir "*) ;; |
---|
2444 | *) |
---|
2445 | case "$compile_rpath " in |
---|
2446 | *" $absdir "*) ;; |
---|
2447 | *) compile_rpath="$compile_rpath $absdir" |
---|
2448 | esac |
---|
2449 | ;; |
---|
2450 | esac |
---|
2451 | case " $sys_lib_dlsearch_path " in |
---|
2452 | *" $libdir "*) ;; |
---|
2453 | *) |
---|
2454 | case "$finalize_rpath " in |
---|
2455 | *" $libdir "*) ;; |
---|
2456 | *) finalize_rpath="$finalize_rpath $libdir" |
---|
2457 | esac |
---|
2458 | ;; |
---|
2459 | esac |
---|
2460 | fi |
---|
2461 | |
---|
2462 | if test -n "$old_archive_from_expsyms_cmds"; then |
---|
2463 | # figure out the soname |
---|
2464 | set dummy $library_names |
---|
2465 | realname="$2" |
---|
2466 | shift; shift |
---|
2467 | libname=`eval \\$echo \"$libname_spec\"` |
---|
2468 | # use dlname if we got it. it's perfectly good, no? |
---|
2469 | if test -n "$dlname"; then |
---|
2470 | soname="$dlname" |
---|
2471 | elif test -n "$soname_spec"; then |
---|
2472 | # bleh windows |
---|
2473 | case $host in |
---|
2474 | *cygwin* | mingw*) |
---|
2475 | major=`expr $current - $age` |
---|
2476 | versuffix="-$major" |
---|
2477 | ;; |
---|
2478 | esac |
---|
2479 | eval soname=\"$soname_spec\" |
---|
2480 | else |
---|
2481 | soname="$realname" |
---|
2482 | fi |
---|
2483 | |
---|
2484 | # Make a new name for the extract_expsyms_cmds to use |
---|
2485 | soroot="$soname" |
---|
2486 | soname=`$echo $soroot | ${SED} -e 's/^.*\///'` |
---|
2487 | newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" |
---|
2488 | |
---|
2489 | # If the library has no export list, then create one now |
---|
2490 | if test -f "$output_objdir/$soname-def"; then : |
---|
2491 | else |
---|
2492 | $show "extracting exported symbol list from \`$soname'" |
---|
2493 | save_ifs="$IFS"; IFS='~' |
---|
2494 | cmds=$extract_expsyms_cmds |
---|
2495 | for cmd in $cmds; do |
---|
2496 | IFS="$save_ifs" |
---|
2497 | eval cmd=\"$cmd\" |
---|
2498 | $show "$cmd" |
---|
2499 | $run eval "$cmd" || exit $? |
---|
2500 | done |
---|
2501 | IFS="$save_ifs" |
---|
2502 | fi |
---|
2503 | |
---|
2504 | # Create $newlib |
---|
2505 | if test -f "$output_objdir/$newlib"; then :; else |
---|
2506 | $show "generating import library for \`$soname'" |
---|
2507 | save_ifs="$IFS"; IFS='~' |
---|
2508 | cmds=$old_archive_from_expsyms_cmds |
---|
2509 | for cmd in $cmds; do |
---|
2510 | IFS="$save_ifs" |
---|
2511 | eval cmd=\"$cmd\" |
---|
2512 | $show "$cmd" |
---|
2513 | $run eval "$cmd" || exit $? |
---|
2514 | done |
---|
2515 | IFS="$save_ifs" |
---|
2516 | fi |
---|
2517 | # make sure the library variables are pointing to the new library |
---|
2518 | dir=$output_objdir |
---|
2519 | linklib=$newlib |
---|
2520 | fi # test -n "$old_archive_from_expsyms_cmds" |
---|
2521 | |
---|
2522 | if test "$linkmode" = prog || test "$mode" != relink; then |
---|
2523 | add_shlibpath= |
---|
2524 | add_dir= |
---|
2525 | add= |
---|
2526 | lib_linked=yes |
---|
2527 | case $hardcode_action in |
---|
2528 | immediate | unsupported) |
---|
2529 | if test "$hardcode_direct" = no; then |
---|
2530 | add="$dir/$linklib" |
---|
2531 | case $host in |
---|
2532 | *-*-sco3.2v5* ) add_dir="-L$dir" ;; |
---|
2533 | *-*-darwin* ) |
---|
2534 | # if the lib is a module then we can not link against |
---|
2535 | # it, someone is ignoring the new warnings I added |
---|
2536 | if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then |
---|
2537 | $echo "** Warning, lib $linklib is a module, not a shared library" |
---|
2538 | if test -z "$old_library" ; then |
---|
2539 | $echo |
---|
2540 | $echo "** And there doesn't seem to be a static archive available" |
---|
2541 | $echo "** The link will probably fail, sorry" |
---|
2542 | else |
---|
2543 | add="$dir/$old_library" |
---|
2544 | fi |
---|
2545 | fi |
---|
2546 | esac |
---|
2547 | elif test "$hardcode_minus_L" = no; then |
---|
2548 | case $host in |
---|
2549 | *-*-sunos*) add_shlibpath="$dir" ;; |
---|
2550 | esac |
---|
2551 | add_dir="-L$dir" |
---|
2552 | add="-l$name" |
---|
2553 | elif test "$hardcode_shlibpath_var" = no; then |
---|
2554 | add_shlibpath="$dir" |
---|
2555 | add="-l$name" |
---|
2556 | else |
---|
2557 | lib_linked=no |
---|
2558 | fi |
---|
2559 | ;; |
---|
2560 | relink) |
---|
2561 | if test "$hardcode_direct" = yes; then |
---|
2562 | add="$dir/$linklib" |
---|
2563 | elif test "$hardcode_minus_L" = yes; then |
---|
2564 | add_dir="-L$dir" |
---|
2565 | # Try looking first in the location we're being installed to. |
---|
2566 | if test -n "$inst_prefix_dir"; then |
---|
2567 | case "$libdir" in |
---|
2568 | [\\/]*) |
---|
2569 | add_dir="$add_dir -L$inst_prefix_dir$libdir" |
---|
2570 | ;; |
---|
2571 | esac |
---|
2572 | fi |
---|
2573 | add="-l$name" |
---|
2574 | elif test "$hardcode_shlibpath_var" = yes; then |
---|
2575 | add_shlibpath="$dir" |
---|
2576 | add="-l$name" |
---|
2577 | else |
---|
2578 | lib_linked=no |
---|
2579 | fi |
---|
2580 | ;; |
---|
2581 | *) lib_linked=no ;; |
---|
2582 | esac |
---|
2583 | |
---|
2584 | if test "$lib_linked" != yes; then |
---|
2585 | $echo "$modename: configuration error: unsupported hardcode properties" |
---|
2586 | exit $EXIT_FAILURE |
---|
2587 | fi |
---|
2588 | |
---|
2589 | if test -n "$add_shlibpath"; then |
---|
2590 | case :$compile_shlibpath: in |
---|
2591 | *":$add_shlibpath:"*) ;; |
---|
2592 | *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; |
---|
2593 | esac |
---|
2594 | fi |
---|
2595 | if test "$linkmode" = prog; then |
---|
2596 | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" |
---|
2597 | test -n "$add" && compile_deplibs="$add $compile_deplibs" |
---|
2598 | else |
---|
2599 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
---|
2600 | test -n "$add" && deplibs="$add $deplibs" |
---|
2601 | if test "$hardcode_direct" != yes && \ |
---|
2602 | test "$hardcode_minus_L" != yes && \ |
---|
2603 | test "$hardcode_shlibpath_var" = yes; then |
---|
2604 | case :$finalize_shlibpath: in |
---|
2605 | *":$libdir:"*) ;; |
---|
2606 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
---|
2607 | esac |
---|
2608 | fi |
---|
2609 | fi |
---|
2610 | fi |
---|
2611 | |
---|
2612 | if test "$linkmode" = prog || test "$mode" = relink; then |
---|
2613 | add_shlibpath= |
---|
2614 | add_dir= |
---|
2615 | add= |
---|
2616 | # Finalize command for both is simple: just hardcode it. |
---|
2617 | if test "$hardcode_direct" = yes; then |
---|
2618 | add="$libdir/$linklib" |
---|
2619 | elif test "$hardcode_minus_L" = yes; then |
---|
2620 | add_dir="-L$libdir" |
---|
2621 | add="-l$name" |
---|
2622 | elif test "$hardcode_shlibpath_var" = yes; then |
---|
2623 | case :$finalize_shlibpath: in |
---|
2624 | *":$libdir:"*) ;; |
---|
2625 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
---|
2626 | esac |
---|
2627 | add="-l$name" |
---|
2628 | elif test "$hardcode_automatic" = yes; then |
---|
2629 | if test -n "$inst_prefix_dir" && |
---|
2630 | test -f "$inst_prefix_dir$libdir/$linklib" ; then |
---|
2631 | add="$inst_prefix_dir$libdir/$linklib" |
---|
2632 | else |
---|
2633 | add="$libdir/$linklib" |
---|
2634 | fi |
---|
2635 | else |
---|
2636 | # We cannot seem to hardcode it, guess we'll fake it. |
---|
2637 | add_dir="-L$libdir" |
---|
2638 | # Try looking first in the location we're being installed to. |
---|
2639 | if test -n "$inst_prefix_dir"; then |
---|
2640 | case "$libdir" in |
---|
2641 | [\\/]*) |
---|
2642 | add_dir="$add_dir -L$inst_prefix_dir$libdir" |
---|
2643 | ;; |
---|
2644 | esac |
---|
2645 | fi |
---|
2646 | add="-l$name" |
---|
2647 | fi |
---|
2648 | |
---|
2649 | if test "$linkmode" = prog; then |
---|
2650 | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" |
---|
2651 | test -n "$add" && finalize_deplibs="$add $finalize_deplibs" |
---|
2652 | else |
---|
2653 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
---|
2654 | test -n "$add" && deplibs="$add $deplibs" |
---|
2655 | fi |
---|
2656 | fi |
---|
2657 | elif test "$linkmode" = prog; then |
---|
2658 | # Here we assume that one of hardcode_direct or hardcode_minus_L |
---|
2659 | # is not unsupported. This is valid on all known static and |
---|
2660 | # shared platforms. |
---|
2661 | if test "$hardcode_direct" != unsupported; then |
---|
2662 | test -n "$old_library" && linklib="$old_library" |
---|
2663 | compile_deplibs="$dir/$linklib $compile_deplibs" |
---|
2664 | finalize_deplibs="$dir/$linklib $finalize_deplibs" |
---|
2665 | else |
---|
2666 | compile_deplibs="-l$name -L$dir $compile_deplibs" |
---|
2667 | finalize_deplibs="-l$name -L$dir $finalize_deplibs" |
---|
2668 | fi |
---|
2669 | elif test "$build_libtool_libs" = yes; then |
---|
2670 | # Not a shared library |
---|
2671 | if test "$deplibs_check_method" != pass_all; then |
---|
2672 | # We're trying link a shared library against a static one |
---|
2673 | # but the system doesn't support it. |
---|
2674 | |
---|
2675 | # Just print a warning and add the library to dependency_libs so |
---|
2676 | # that the program can be linked against the static library. |
---|
2677 | $echo |
---|
2678 | $echo "*** Warning: This system can not link to static lib archive $lib." |
---|
2679 | $echo "*** I have the capability to make that library automatically link in when" |
---|
2680 | $echo "*** you link to this library. But I can only do this if you have a" |
---|
2681 | $echo "*** shared version of the library, which you do not appear to have." |
---|
2682 | if test "$module" = yes; then |
---|
2683 | $echo "*** But as you try to build a module library, libtool will still create " |
---|
2684 | $echo "*** a static module, that should work as long as the dlopening application" |
---|
2685 | $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." |
---|
2686 | if test -z "$global_symbol_pipe"; then |
---|
2687 | $echo |
---|
2688 | $echo "*** However, this would only work if libtool was able to extract symbol" |
---|
2689 | $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
---|
2690 | $echo "*** not find such a program. So, this module is probably useless." |
---|
2691 | $echo "*** \`nm' from GNU binutils and a full rebuild may help." |
---|
2692 | fi |
---|
2693 | if test "$build_old_libs" = no; then |
---|
2694 | build_libtool_libs=module |
---|
2695 | build_old_libs=yes |
---|
2696 | else |
---|
2697 | build_libtool_libs=no |
---|
2698 | fi |
---|
2699 | fi |
---|
2700 | else |
---|
2701 | convenience="$convenience $dir/$old_library" |
---|
2702 | old_convenience="$old_convenience $dir/$old_library" |
---|
2703 | deplibs="$dir/$old_library $deplibs" |
---|
2704 | link_static=yes |
---|
2705 | fi |
---|
2706 | fi # link shared/static library? |
---|
2707 | |
---|
2708 | if test "$linkmode" = lib; then |
---|
2709 | if test -n "$dependency_libs" && |
---|
2710 | { test "$hardcode_into_libs" != yes || |
---|
2711 | test "$build_old_libs" = yes || |
---|
2712 | test "$link_static" = yes; }; then |
---|
2713 | # Extract -R from dependency_libs |
---|
2714 | temp_deplibs= |
---|
2715 | for libdir in $dependency_libs; do |
---|
2716 | case $libdir in |
---|
2717 | -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` |
---|
2718 | case " $xrpath " in |
---|
2719 | *" $temp_xrpath "*) ;; |
---|
2720 | *) xrpath="$xrpath $temp_xrpath";; |
---|
2721 | esac;; |
---|
2722 | *) temp_deplibs="$temp_deplibs $libdir";; |
---|
2723 | esac |
---|
2724 | done |
---|
2725 | dependency_libs="$temp_deplibs" |
---|
2726 | fi |
---|
2727 | |
---|
2728 | newlib_search_path="$newlib_search_path $absdir" |
---|
2729 | # Link against this library |
---|
2730 | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" |
---|
2731 | # ... and its dependency_libs |
---|
2732 | tmp_libs= |
---|
2733 | for deplib in $dependency_libs; do |
---|
2734 | newdependency_libs="$deplib $newdependency_libs" |
---|
2735 | if test "X$duplicate_deps" = "Xyes" ; then |
---|
2736 | case "$tmp_libs " in |
---|
2737 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
---|
2738 | esac |
---|
2739 | fi |
---|
2740 | tmp_libs="$tmp_libs $deplib" |
---|
2741 | done |
---|
2742 | |
---|
2743 | if test "$link_all_deplibs" != no; then |
---|
2744 | # Add the search paths of all dependency libraries |
---|
2745 | for deplib in $dependency_libs; do |
---|
2746 | case $deplib in |
---|
2747 | -L*) path="$deplib" ;; |
---|
2748 | *.la) |
---|
2749 | dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` |
---|
2750 | test "X$dir" = "X$deplib" && dir="." |
---|
2751 | # We need an absolute path. |
---|
2752 | case $dir in |
---|
2753 | [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; |
---|
2754 | *) |
---|
2755 | absdir=`cd "$dir" && pwd` |
---|
2756 | if test -z "$absdir"; then |
---|
2757 | $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 |
---|
2758 | absdir="$dir" |
---|
2759 | fi |
---|
2760 | ;; |
---|
2761 | esac |
---|
2762 | if grep "^installed=no" $deplib > /dev/null; then |
---|
2763 | path="$absdir/$objdir" |
---|
2764 | else |
---|
2765 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
---|
2766 | if test -z "$libdir"; then |
---|
2767 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 |
---|
2768 | exit $EXIT_FAILURE |
---|
2769 | fi |
---|
2770 | if test "$absdir" != "$libdir"; then |
---|
2771 | $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 |
---|
2772 | fi |
---|
2773 | path="$absdir" |
---|
2774 | fi |
---|
2775 | depdepl= |
---|
2776 | case $host in |
---|
2777 | *-*-darwin*) |
---|
2778 | # we do not want to link against static libs, |
---|
2779 | # but need to link against shared |
---|
2780 | eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` |
---|
2781 | if test -n "$deplibrary_names" ; then |
---|
2782 | for tmp in $deplibrary_names ; do |
---|
2783 | depdepl=$tmp |
---|
2784 | done |
---|
2785 | if test -f "$path/$depdepl" ; then |
---|
2786 | depdepl="$path/$depdepl" |
---|
2787 | fi |
---|
2788 | # do not add paths which are already there |
---|
2789 | case " $newlib_search_path " in |
---|
2790 | *" $path "*) ;; |
---|
2791 | *) newlib_search_path="$newlib_search_path $path";; |
---|
2792 | esac |
---|
2793 | fi |
---|
2794 | path="" |
---|
2795 | ;; |
---|
2796 | *) |
---|
2797 | path="-L$path" |
---|
2798 | ;; |
---|
2799 | esac |
---|
2800 | ;; |
---|
2801 | -l*) |
---|
2802 | case $host in |
---|
2803 | *-*-darwin*) |
---|
2804 | # Again, we only want to link against shared libraries |
---|
2805 | eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` |
---|
2806 | for tmp in $newlib_search_path ; do |
---|
2807 | if test -f "$tmp/lib$tmp_libs.dylib" ; then |
---|
2808 | eval depdepl="$tmp/lib$tmp_libs.dylib" |
---|
2809 | break |
---|
2810 | fi |
---|
2811 | done |
---|
2812 | path="" |
---|
2813 | ;; |
---|
2814 | *) continue ;; |
---|
2815 | esac |
---|
2816 | ;; |
---|
2817 | *) continue ;; |
---|
2818 | esac |
---|
2819 | case " $deplibs " in |
---|
2820 | *" $depdepl "*) ;; |
---|
2821 | *) deplibs="$depdepl $deplibs" ;; |
---|
2822 | esac |
---|
2823 | case " $deplibs " in |
---|
2824 | *" $path "*) ;; |
---|
2825 | *) deplibs="$deplibs $path" ;; |
---|
2826 | esac |
---|
2827 | done |
---|
2828 | fi # link_all_deplibs != no |
---|
2829 | fi # linkmode = lib |
---|
2830 | done # for deplib in $libs |
---|
2831 | dependency_libs="$newdependency_libs" |
---|
2832 | if test "$pass" = dlpreopen; then |
---|
2833 | # Link the dlpreopened libraries before other libraries |
---|
2834 | for deplib in $save_deplibs; do |
---|
2835 | deplibs="$deplib $deplibs" |
---|
2836 | done |
---|
2837 | fi |
---|
2838 | if test "$pass" != dlopen; then |
---|
2839 | if test "$pass" != conv; then |
---|
2840 | # Make sure lib_search_path contains only unique directories. |
---|
2841 | lib_search_path= |
---|
2842 | for dir in $newlib_search_path; do |
---|
2843 | case "$lib_search_path " in |
---|
2844 | *" $dir "*) ;; |
---|
2845 | *) lib_search_path="$lib_search_path $dir" ;; |
---|
2846 | esac |
---|
2847 | done |
---|
2848 | newlib_search_path= |
---|
2849 | fi |
---|
2850 | |
---|
2851 | if test "$linkmode,$pass" != "prog,link"; then |
---|
2852 | vars="deplibs" |
---|
2853 | else |
---|
2854 | vars="compile_deplibs finalize_deplibs" |
---|
2855 | fi |
---|
2856 | for var in $vars dependency_libs; do |
---|
2857 | # Add libraries to $var in reverse order |
---|
2858 | eval tmp_libs=\"\$$var\" |
---|
2859 | new_libs= |
---|
2860 | for deplib in $tmp_libs; do |
---|
2861 | # FIXME: Pedantically, this is the right thing to do, so |
---|
2862 | # that some nasty dependency loop isn't accidentally |
---|
2863 | # broken: |
---|
2864 | #new_libs="$deplib $new_libs" |
---|
2865 | # Pragmatically, this seems to cause very few problems in |
---|
2866 | # practice: |
---|
2867 | case $deplib in |
---|
2868 | -L*) new_libs="$deplib $new_libs" ;; |
---|
2869 | -R*) ;; |
---|
2870 | *) |
---|
2871 | # And here is the reason: when a library appears more |
---|
2872 | # than once as an explicit dependence of a library, or |
---|
2873 | # is implicitly linked in more than once by the |
---|
2874 | # compiler, it is considered special, and multiple |
---|
2875 | # occurrences thereof are not removed. Compare this |
---|
2876 | # with having the same library being listed as a |
---|
2877 | # dependency of multiple other libraries: in this case, |
---|
2878 | # we know (pedantically, we assume) the library does not |
---|
2879 | # need to be listed more than once, so we keep only the |
---|
2880 | # last copy. This is not always right, but it is rare |
---|
2881 | # enough that we require users that really mean to play |
---|
2882 | # such unportable linking tricks to link the library |
---|
2883 | # using -Wl,-lname, so that libtool does not consider it |
---|
2884 | # for duplicate removal. |
---|
2885 | case " $specialdeplibs " in |
---|
2886 | *" $deplib "*) new_libs="$deplib $new_libs" ;; |
---|
2887 | *) |
---|
2888 | case " $new_libs " in |
---|
2889 | *" $deplib "*) ;; |
---|
2890 | *) new_libs="$deplib $new_libs" ;; |
---|
2891 | esac |
---|
2892 | ;; |
---|
2893 | esac |
---|
2894 | ;; |
---|
2895 | esac |
---|
2896 | done |
---|
2897 | tmp_libs= |
---|
2898 | for deplib in $new_libs; do |
---|
2899 | case $deplib in |
---|
2900 | -L*) |
---|
2901 | case " $tmp_libs " in |
---|
2902 | *" $deplib "*) ;; |
---|
2903 | *) tmp_libs="$tmp_libs $deplib" ;; |
---|
2904 | esac |
---|
2905 | ;; |
---|
2906 | *) tmp_libs="$tmp_libs $deplib" ;; |
---|
2907 | esac |
---|
2908 | done |
---|
2909 | eval $var=\"$tmp_libs\" |
---|
2910 | done # for var |
---|
2911 | fi |
---|
2912 | # Last step: remove runtime libs from dependency_libs |
---|
2913 | # (they stay in deplibs) |
---|
2914 | tmp_libs= |
---|
2915 | for i in $dependency_libs ; do |
---|
2916 | case " $predeps $postdeps $compiler_lib_search_path " in |
---|
2917 | *" $i "*) |
---|
2918 | i="" |
---|
2919 | ;; |
---|
2920 | esac |
---|
2921 | if test -n "$i" ; then |
---|
2922 | tmp_libs="$tmp_libs $i" |
---|
2923 | fi |
---|
2924 | done |
---|
2925 | dependency_libs=$tmp_libs |
---|
2926 | done # for pass |
---|
2927 | if test "$linkmode" = prog; then |
---|
2928 | dlfiles="$newdlfiles" |
---|
2929 | dlprefiles="$newdlprefiles" |
---|
2930 | fi |
---|
2931 | |
---|
2932 | case $linkmode in |
---|
2933 | oldlib) |
---|
2934 | if test -n "$deplibs"; then |
---|
2935 | $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 |
---|
2936 | fi |
---|
2937 | |
---|
2938 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
---|
2939 | $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 |
---|
2940 | fi |
---|
2941 | |
---|
2942 | if test -n "$rpath"; then |
---|
2943 | $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 |
---|
2944 | fi |
---|
2945 | |
---|
2946 | if test -n "$xrpath"; then |
---|
2947 | $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 |
---|
2948 | fi |
---|
2949 | |
---|
2950 | if test -n "$vinfo"; then |
---|
2951 | $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 |
---|
2952 | fi |
---|
2953 | |
---|
2954 | if test -n "$release"; then |
---|
2955 | $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 |
---|
2956 | fi |
---|
2957 | |
---|
2958 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
---|
2959 | $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 |
---|
2960 | fi |
---|
2961 | |
---|
2962 | # Now set the variables for building old libraries. |
---|
2963 | build_libtool_libs=no |
---|
2964 | oldlibs="$output" |
---|
2965 | objs="$objs$old_deplibs" |
---|
2966 | ;; |
---|
2967 | |
---|
2968 | lib) |
---|
2969 | # Make sure we only generate libraries of the form `libNAME.la'. |
---|
2970 | case $outputname in |
---|
2971 | lib*) |
---|
2972 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` |
---|
2973 | eval shared_ext=\"$shrext_cmds\" |
---|
2974 | eval libname=\"$libname_spec\" |
---|
2975 | ;; |
---|
2976 | *) |
---|
2977 | if test "$module" = no; then |
---|
2978 | $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 |
---|
2979 | $echo "$help" 1>&2 |
---|
2980 | exit $EXIT_FAILURE |
---|
2981 | fi |
---|
2982 | if test "$need_lib_prefix" != no; then |
---|
2983 | # Add the "lib" prefix for modules if required |
---|
2984 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` |
---|
2985 | eval shared_ext=\"$shrext_cmds\" |
---|
2986 | eval libname=\"$libname_spec\" |
---|
2987 | else |
---|
2988 | libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` |
---|
2989 | fi |
---|
2990 | ;; |
---|
2991 | esac |
---|
2992 | |
---|
2993 | if test -n "$objs"; then |
---|
2994 | if test "$deplibs_check_method" != pass_all; then |
---|
2995 | $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 |
---|
2996 | exit $EXIT_FAILURE |
---|
2997 | else |
---|
2998 | $echo |
---|
2999 | $echo "*** Warning: Linking the shared library $output against the non-libtool" |
---|
3000 | $echo "*** objects $objs is not portable!" |
---|
3001 | libobjs="$libobjs $objs" |
---|
3002 | fi |
---|
3003 | fi |
---|
3004 | |
---|
3005 | if test "$dlself" != no; then |
---|
3006 | $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 |
---|
3007 | fi |
---|
3008 | |
---|
3009 | set dummy $rpath |
---|
3010 | if test "$#" -gt 2; then |
---|
3011 | $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 |
---|
3012 | fi |
---|
3013 | install_libdir="$2" |
---|
3014 | |
---|
3015 | oldlibs= |
---|
3016 | if test -z "$rpath"; then |
---|
3017 | if test "$build_libtool_libs" = yes; then |
---|
3018 | # Building a libtool convenience library. |
---|
3019 | # Some compilers have problems with a `.al' extension so |
---|
3020 | # convenience libraries should have the same extension an |
---|
3021 | # archive normally would. |
---|
3022 | oldlibs="$output_objdir/$libname.$libext $oldlibs" |
---|
3023 | build_libtool_libs=convenience |
---|
3024 | build_old_libs=yes |
---|
3025 | fi |
---|
3026 | |
---|
3027 | if test -n "$vinfo"; then |
---|
3028 | $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 |
---|
3029 | fi |
---|
3030 | |
---|
3031 | if test -n "$release"; then |
---|
3032 | $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 |
---|
3033 | fi |
---|
3034 | else |
---|
3035 | |
---|
3036 | # Parse the version information argument. |
---|
3037 | save_ifs="$IFS"; IFS=':' |
---|
3038 | set dummy $vinfo 0 0 0 |
---|
3039 | IFS="$save_ifs" |
---|
3040 | |
---|
3041 | if test -n "$8"; then |
---|
3042 | $echo "$modename: too many parameters to \`-version-info'" 1>&2 |
---|
3043 | $echo "$help" 1>&2 |
---|
3044 | exit $EXIT_FAILURE |
---|
3045 | fi |
---|
3046 | |
---|
3047 | # convert absolute version numbers to libtool ages |
---|
3048 | # this retains compatibility with .la files and attempts |
---|
3049 | # to make the code below a bit more comprehensible |
---|
3050 | |
---|
3051 | case $vinfo_number in |
---|
3052 | yes) |
---|
3053 | number_major="$2" |
---|
3054 | number_minor="$3" |
---|
3055 | number_revision="$4" |
---|
3056 | # |
---|
3057 | # There are really only two kinds -- those that |
---|
3058 | # use the current revision as the major version |
---|
3059 | # and those that subtract age and use age as |
---|
3060 | # a minor version. But, then there is irix |
---|
3061 | # which has an extra 1 added just for fun |
---|
3062 | # |
---|
3063 | case $version_type in |
---|
3064 | darwin|linux|osf|windows) |
---|
3065 | current=`expr $number_major + $number_minor` |
---|
3066 | age="$number_minor" |
---|
3067 | revision="$number_revision" |
---|
3068 | ;; |
---|
3069 | freebsd-aout|freebsd-elf|sunos) |
---|
3070 | current="$number_major" |
---|
3071 | revision="$number_minor" |
---|
3072 | age="0" |
---|
3073 | ;; |
---|
3074 | irix|nonstopux) |
---|
3075 | current=`expr $number_major + $number_minor - 1` |
---|
3076 | age="$number_minor" |
---|
3077 | revision="$number_minor" |
---|
3078 | ;; |
---|
3079 | esac |
---|
3080 | ;; |
---|
3081 | no) |
---|
3082 | current="$2" |
---|
3083 | revision="$3" |
---|
3084 | age="$4" |
---|
3085 | ;; |
---|
3086 | esac |
---|
3087 | |
---|
3088 | # Check that each of the things are valid numbers. |
---|
3089 | case $current in |
---|
3090 | 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; |
---|
3091 | *) |
---|
3092 | $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 |
---|
3093 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
---|
3094 | exit $EXIT_FAILURE |
---|
3095 | ;; |
---|
3096 | esac |
---|
3097 | |
---|
3098 | case $revision in |
---|
3099 | 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; |
---|
3100 | *) |
---|
3101 | $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 |
---|
3102 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
---|
3103 | exit $EXIT_FAILURE |
---|
3104 | ;; |
---|
3105 | esac |
---|
3106 | |
---|
3107 | case $age in |
---|
3108 | 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; |
---|
3109 | *) |
---|
3110 | $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 |
---|
3111 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
---|
3112 | exit $EXIT_FAILURE |
---|
3113 | ;; |
---|
3114 | esac |
---|
3115 | |
---|
3116 | if test "$age" -gt "$current"; then |
---|
3117 | $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 |
---|
3118 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 |
---|
3119 | exit $EXIT_FAILURE |
---|
3120 | fi |
---|
3121 | |
---|
3122 | # Calculate the version variables. |
---|
3123 | major= |
---|
3124 | versuffix= |
---|
3125 | verstring= |
---|
3126 | case $version_type in |
---|
3127 | none) ;; |
---|
3128 | |
---|
3129 | darwin) |
---|
3130 | # Like Linux, but with the current version available in |
---|
3131 | # verstring for coding it into the library header |
---|
3132 | major=.`expr $current - $age` |
---|
3133 | versuffix="$major.$age.$revision" |
---|
3134 | # Darwin ld doesn't like 0 for these options... |
---|
3135 | minor_current=`expr $current + 1` |
---|
3136 | verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" |
---|
3137 | ;; |
---|
3138 | |
---|
3139 | freebsd-aout) |
---|
3140 | major=".$current" |
---|
3141 | versuffix=".$current.$revision"; |
---|
3142 | ;; |
---|
3143 | |
---|
3144 | freebsd-elf) |
---|
3145 | major=".$current" |
---|
3146 | versuffix=".$current"; |
---|
3147 | ;; |
---|
3148 | |
---|
3149 | irix | nonstopux) |
---|
3150 | major=`expr $current - $age + 1` |
---|
3151 | |
---|
3152 | case $version_type in |
---|
3153 | nonstopux) verstring_prefix=nonstopux ;; |
---|
3154 | *) verstring_prefix=sgi ;; |
---|
3155 | esac |
---|
3156 | verstring="$verstring_prefix$major.$revision" |
---|
3157 | |
---|
3158 | # Add in all the interfaces that we are compatible with. |
---|
3159 | loop=$revision |
---|
3160 | while test "$loop" -ne 0; do |
---|
3161 | iface=`expr $revision - $loop` |
---|
3162 | loop=`expr $loop - 1` |
---|
3163 | verstring="$verstring_prefix$major.$iface:$verstring" |
---|
3164 | done |
---|
3165 | |
---|
3166 | # Before this point, $major must not contain `.'. |
---|
3167 | major=.$major |
---|
3168 | versuffix="$major.$revision" |
---|
3169 | ;; |
---|
3170 | |
---|
3171 | linux) |
---|
3172 | major=.`expr $current - $age` |
---|
3173 | versuffix="$major.$age.$revision" |
---|
3174 | ;; |
---|
3175 | |
---|
3176 | osf) |
---|
3177 | major=.`expr $current - $age` |
---|
3178 | versuffix=".$current.$age.$revision" |
---|
3179 | verstring="$current.$age.$revision" |
---|
3180 | |
---|
3181 | # Add in all the interfaces that we are compatible with. |
---|
3182 | loop=$age |
---|
3183 | while test "$loop" -ne 0; do |
---|
3184 | iface=`expr $current - $loop` |
---|
3185 | loop=`expr $loop - 1` |
---|
3186 | verstring="$verstring:${iface}.0" |
---|
3187 | done |
---|
3188 | |
---|
3189 | # Make executables depend on our current version. |
---|
3190 | verstring="$verstring:${current}.0" |
---|
3191 | ;; |
---|
3192 | |
---|
3193 | sunos) |
---|
3194 | major=".$current" |
---|
3195 | versuffix=".$current.$revision" |
---|
3196 | ;; |
---|
3197 | |
---|
3198 | windows) |
---|
3199 | # Use '-' rather than '.', since we only want one |
---|
3200 | # extension on DOS 8.3 filesystems. |
---|
3201 | major=`expr $current - $age` |
---|
3202 | versuffix="-$major" |
---|
3203 | ;; |
---|
3204 | |
---|
3205 | *) |
---|
3206 | $echo "$modename: unknown library version type \`$version_type'" 1>&2 |
---|
3207 | $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
---|
3208 | exit $EXIT_FAILURE |
---|
3209 | ;; |
---|
3210 | esac |
---|
3211 | |
---|
3212 | # Clear the version info if we defaulted, and they specified a release. |
---|
3213 | if test -z "$vinfo" && test -n "$release"; then |
---|
3214 | major= |
---|
3215 | case $version_type in |
---|
3216 | darwin) |
---|
3217 | # we can't check for "0.0" in archive_cmds due to quoting |
---|
3218 | # problems, so we reset it completely |
---|
3219 | verstring= |
---|
3220 | ;; |
---|
3221 | *) |
---|
3222 | verstring="0.0" |
---|
3223 | ;; |
---|
3224 | esac |
---|
3225 | if test "$need_version" = no; then |
---|
3226 | versuffix= |
---|
3227 | else |
---|
3228 | versuffix=".0.0" |
---|
3229 | fi |
---|
3230 | fi |
---|
3231 | |
---|
3232 | # Remove version info from name if versioning should be avoided |
---|
3233 | if test "$avoid_version" = yes && test "$need_version" = no; then |
---|
3234 | major= |
---|
3235 | versuffix= |
---|
3236 | verstring="" |
---|
3237 | fi |
---|
3238 | |
---|
3239 | # Check to see if the archive will have undefined symbols. |
---|
3240 | if test "$allow_undefined" = yes; then |
---|
3241 | if test "$allow_undefined_flag" = unsupported; then |
---|
3242 | $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 |
---|
3243 | build_libtool_libs=no |
---|
3244 | build_old_libs=yes |
---|
3245 | fi |
---|
3246 | else |
---|
3247 | # Don't allow undefined symbols. |
---|
3248 | allow_undefined_flag="$no_undefined_flag" |
---|
3249 | fi |
---|
3250 | fi |
---|
3251 | |
---|
3252 | if test "$mode" != relink; then |
---|
3253 | # Remove our outputs, but don't remove object files since they |
---|
3254 | # may have been created when compiling PIC objects. |
---|
3255 | removelist= |
---|
3256 | tempremovelist=`$echo "$output_objdir/*"` |
---|
3257 | for p in $tempremovelist; do |
---|
3258 | case $p in |
---|
3259 | *.$objext) |
---|
3260 | ;; |
---|
3261 | $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) |
---|
3262 | if test "X$precious_files_regex" != "X"; then |
---|
3263 | if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 |
---|
3264 | then |
---|
3265 | continue |
---|
3266 | fi |
---|
3267 | fi |
---|
3268 | removelist="$removelist $p" |
---|
3269 | ;; |
---|
3270 | *) ;; |
---|
3271 | esac |
---|
3272 | done |
---|
3273 | if test -n "$removelist"; then |
---|
3274 | $show "${rm}r $removelist" |
---|
3275 | $run ${rm}r $removelist |
---|
3276 | fi |
---|
3277 | fi |
---|
3278 | |
---|
3279 | # Now set the variables for building old libraries. |
---|
3280 | if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then |
---|
3281 | oldlibs="$oldlibs $output_objdir/$libname.$libext" |
---|
3282 | |
---|
3283 | # Transform .lo files to .o files. |
---|
3284 | oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` |
---|
3285 | fi |
---|
3286 | |
---|
3287 | # Eliminate all temporary directories. |
---|
3288 | for path in $notinst_path; do |
---|
3289 | lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` |
---|
3290 | deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` |
---|
3291 | dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` |
---|
3292 | done |
---|
3293 | |
---|
3294 | if test -n "$xrpath"; then |
---|
3295 | # If the user specified any rpath flags, then add them. |
---|
3296 | temp_xrpath= |
---|
3297 | for libdir in $xrpath; do |
---|
3298 | temp_xrpath="$temp_xrpath -R$libdir" |
---|
3299 | case "$finalize_rpath " in |
---|
3300 | *" $libdir "*) ;; |
---|
3301 | *) finalize_rpath="$finalize_rpath $libdir" ;; |
---|
3302 | esac |
---|
3303 | done |
---|
3304 | if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then |
---|
3305 | dependency_libs="$temp_xrpath $dependency_libs" |
---|
3306 | fi |
---|
3307 | fi |
---|
3308 | |
---|
3309 | # Make sure dlfiles contains only unique files that won't be dlpreopened |
---|
3310 | old_dlfiles="$dlfiles" |
---|
3311 | dlfiles= |
---|
3312 | for lib in $old_dlfiles; do |
---|
3313 | case " $dlprefiles $dlfiles " in |
---|
3314 | *" $lib "*) ;; |
---|
3315 | *) dlfiles="$dlfiles $lib" ;; |
---|
3316 | esac |
---|
3317 | done |
---|
3318 | |
---|
3319 | # Make sure dlprefiles contains only unique files |
---|
3320 | old_dlprefiles="$dlprefiles" |
---|
3321 | dlprefiles= |
---|
3322 | for lib in $old_dlprefiles; do |
---|
3323 | case "$dlprefiles " in |
---|
3324 | *" $lib "*) ;; |
---|
3325 | *) dlprefiles="$dlprefiles $lib" ;; |
---|
3326 | esac |
---|
3327 | done |
---|
3328 | |
---|
3329 | if test "$build_libtool_libs" = yes; then |
---|
3330 | if test -n "$rpath"; then |
---|
3331 | case $host in |
---|
3332 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) |
---|
3333 | # these systems don't actually have a c library (as such)! |
---|
3334 | ;; |
---|
3335 | *-*-rhapsody* | *-*-darwin1.[012]) |
---|
3336 | # Rhapsody C library is in the System framework |
---|
3337 | deplibs="$deplibs -framework System" |
---|
3338 | ;; |
---|
3339 | *-*-netbsd*) |
---|
3340 | # Don't link with libc until the a.out ld.so is fixed. |
---|
3341 | ;; |
---|
3342 | *-*-openbsd* | *-*-freebsd*) |
---|
3343 | # Do not include libc due to us having libc/libc_r. |
---|
3344 | test "X$arg" = "X-lc" && continue |
---|
3345 | ;; |
---|
3346 | *) |
---|
3347 | # Add libc to deplibs on all other systems if necessary. |
---|
3348 | if test "$build_libtool_need_lc" = "yes"; then |
---|
3349 | deplibs="$deplibs -lc" |
---|
3350 | fi |
---|
3351 | ;; |
---|
3352 | esac |
---|
3353 | fi |
---|
3354 | |
---|
3355 | # Transform deplibs into only deplibs that can be linked in shared. |
---|
3356 | name_save=$name |
---|
3357 | libname_save=$libname |
---|
3358 | release_save=$release |
---|
3359 | versuffix_save=$versuffix |
---|
3360 | major_save=$major |
---|
3361 | # I'm not sure if I'm treating the release correctly. I think |
---|
3362 | # release should show up in the -l (ie -lgmp5) so we don't want to |
---|
3363 | # add it in twice. Is that correct? |
---|
3364 | release="" |
---|
3365 | versuffix="" |
---|
3366 | major="" |
---|
3367 | newdeplibs= |
---|
3368 | droppeddeps=no |
---|
3369 | case $deplibs_check_method in |
---|
3370 | pass_all) |
---|
3371 | # Don't check for shared/static. Everything works. |
---|
3372 | # This might be a little naive. We might want to check |
---|
3373 | # whether the library exists or not. But this is on |
---|
3374 | # osf3 & osf4 and I'm not really sure... Just |
---|
3375 | # implementing what was already the behavior. |
---|
3376 | newdeplibs=$deplibs |
---|
3377 | ;; |
---|
3378 | test_compile) |
---|
3379 | # This code stresses the "libraries are programs" paradigm to its |
---|
3380 | # limits. Maybe even breaks it. We compile a program, linking it |
---|
3381 | # against the deplibs as a proxy for the library. Then we can check |
---|
3382 | # whether they linked in statically or dynamically with ldd. |
---|
3383 | $rm conftest.c |
---|
3384 | cat > conftest.c <<EOF |
---|
3385 | int main() { return 0; } |
---|
3386 | EOF |
---|
3387 | $rm conftest |
---|
3388 | $LTCC -o conftest conftest.c $deplibs |
---|
3389 | if test "$?" -eq 0 ; then |
---|
3390 | ldd_output=`ldd conftest` |
---|
3391 | for i in $deplibs; do |
---|
3392 | name="`expr $i : '-l\(.*\)'`" |
---|
3393 | # If $name is empty we are operating on a -L argument. |
---|
3394 | if test "$name" != "" && test "$name" -ne "0"; then |
---|
3395 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
---|
3396 | case " $predeps $postdeps " in |
---|
3397 | *" $i "*) |
---|
3398 | newdeplibs="$newdeplibs $i" |
---|
3399 | i="" |
---|
3400 | ;; |
---|
3401 | esac |
---|
3402 | fi |
---|
3403 | if test -n "$i" ; then |
---|
3404 | libname=`eval \\$echo \"$libname_spec\"` |
---|
3405 | deplib_matches=`eval \\$echo \"$library_names_spec\"` |
---|
3406 | set dummy $deplib_matches |
---|
3407 | deplib_match=$2 |
---|
3408 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
---|
3409 | newdeplibs="$newdeplibs $i" |
---|
3410 | else |
---|
3411 | droppeddeps=yes |
---|
3412 | $echo |
---|
3413 | $echo "*** Warning: dynamic linker does not accept needed library $i." |
---|
3414 | $echo "*** I have the capability to make that library automatically link in when" |
---|
3415 | $echo "*** you link to this library. But I can only do this if you have a" |
---|
3416 | $echo "*** shared version of the library, which I believe you do not have" |
---|
3417 | $echo "*** because a test_compile did reveal that the linker did not use it for" |
---|
3418 | $echo "*** its dynamic dependency list that programs get resolved with at runtime." |
---|
3419 | fi |
---|
3420 | fi |
---|
3421 | else |
---|
3422 | newdeplibs="$newdeplibs $i" |
---|
3423 | fi |
---|
3424 | done |
---|
3425 | else |
---|
3426 | # Error occurred in the first compile. Let's try to salvage |
---|
3427 | # the situation: Compile a separate program for each library. |
---|
3428 | for i in $deplibs; do |
---|
3429 | name="`expr $i : '-l\(.*\)'`" |
---|
3430 | # If $name is empty we are operating on a -L argument. |
---|
3431 | if test "$name" != "" && test "$name" != "0"; then |
---|
3432 | $rm conftest |
---|
3433 | $LTCC -o conftest conftest.c $i |
---|
3434 | # Did it work? |
---|
3435 | if test "$?" -eq 0 ; then |
---|
3436 | ldd_output=`ldd conftest` |
---|
3437 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
---|
3438 | case " $predeps $postdeps " in |
---|
3439 | *" $i "*) |
---|
3440 | newdeplibs="$newdeplibs $i" |
---|
3441 | i="" |
---|
3442 | ;; |
---|
3443 | esac |
---|
3444 | fi |
---|
3445 | if test -n "$i" ; then |
---|
3446 | libname=`eval \\$echo \"$libname_spec\"` |
---|
3447 | deplib_matches=`eval \\$echo \"$library_names_spec\"` |
---|
3448 | set dummy $deplib_matches |
---|
3449 | deplib_match=$2 |
---|
3450 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
---|
3451 | newdeplibs="$newdeplibs $i" |
---|
3452 | else |
---|
3453 | droppeddeps=yes |
---|
3454 | $echo |
---|
3455 | $echo "*** Warning: dynamic linker does not accept needed library $i." |
---|
3456 | $echo "*** I have the capability to make that library automatically link in when" |
---|
3457 | $echo "*** you link to this library. But I can only do this if you have a" |
---|
3458 | $echo "*** shared version of the library, which you do not appear to have" |
---|
3459 | $echo "*** because a test_compile did reveal that the linker did not use this one" |
---|
3460 | $echo "*** as a dynamic dependency that programs can get resolved with at runtime." |
---|
3461 | fi |
---|
3462 | fi |
---|
3463 | else |
---|
3464 | droppeddeps=yes |
---|
3465 | $echo |
---|
3466 | $echo "*** Warning! Library $i is needed by this library but I was not able to" |
---|
3467 | $echo "*** make it link in! You will probably need to install it or some" |
---|
3468 | $echo "*** library that it depends on before this library will be fully" |
---|
3469 | $echo "*** functional. Installing it before continuing would be even better." |
---|
3470 | fi |
---|
3471 | else |
---|
3472 | newdeplibs="$newdeplibs $i" |
---|
3473 | fi |
---|
3474 | done |
---|
3475 | fi |
---|
3476 | ;; |
---|
3477 | file_magic*) |
---|
3478 | set dummy $deplibs_check_method |
---|
3479 | file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
---|
3480 | for a_deplib in $deplibs; do |
---|
3481 | name="`expr $a_deplib : '-l\(.*\)'`" |
---|
3482 | # If $name is empty we are operating on a -L argument. |
---|
3483 | if test "$name" != "" && test "$name" != "0"; then |
---|
3484 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
---|
3485 | case " $predeps $postdeps " in |
---|
3486 | *" $a_deplib "*) |
---|
3487 | newdeplibs="$newdeplibs $a_deplib" |
---|
3488 | a_deplib="" |
---|
3489 | ;; |
---|
3490 | esac |
---|
3491 | fi |
---|
3492 | if test -n "$a_deplib" ; then |
---|
3493 | libname=`eval \\$echo \"$libname_spec\"` |
---|
3494 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
---|
3495 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
---|
3496 | for potent_lib in $potential_libs; do |
---|
3497 | # Follow soft links. |
---|
3498 | if ls -lLd "$potent_lib" 2>/dev/null \ |
---|
3499 | | grep " -> " >/dev/null; then |
---|
3500 | continue |
---|
3501 | fi |
---|
3502 | # The statement above tries to avoid entering an |
---|
3503 | # endless loop below, in case of cyclic links. |
---|
3504 | # We might still enter an endless loop, since a link |
---|
3505 | # loop can be closed while we follow links, |
---|
3506 | # but so what? |
---|
3507 | potlib="$potent_lib" |
---|
3508 | while test -h "$potlib" 2>/dev/null; do |
---|
3509 | potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` |
---|
3510 | case $potliblink in |
---|
3511 | [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; |
---|
3512 | *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; |
---|
3513 | esac |
---|
3514 | done |
---|
3515 | if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ |
---|
3516 | | ${SED} 10q \ |
---|
3517 | | $EGREP "$file_magic_regex" > /dev/null; then |
---|
3518 | newdeplibs="$newdeplibs $a_deplib" |
---|
3519 | a_deplib="" |
---|
3520 | break 2 |
---|
3521 | fi |
---|
3522 | done |
---|
3523 | done |
---|
3524 | fi |
---|
3525 | if test -n "$a_deplib" ; then |
---|
3526 | droppeddeps=yes |
---|
3527 | $echo |
---|
3528 | $echo "*** Warning: linker path does not have real file for library $a_deplib." |
---|
3529 | $echo "*** I have the capability to make that library automatically link in when" |
---|
3530 | $echo "*** you link to this library. But I can only do this if you have a" |
---|
3531 | $echo "*** shared version of the library, which you do not appear to have" |
---|
3532 | $echo "*** because I did check the linker path looking for a file starting" |
---|
3533 | if test -z "$potlib" ; then |
---|
3534 | $echo "*** with $libname but no candidates were found. (...for file magic test)" |
---|
3535 | else |
---|
3536 | $echo "*** with $libname and none of the candidates passed a file format test" |
---|
3537 | $echo "*** using a file magic. Last file checked: $potlib" |
---|
3538 | fi |
---|
3539 | fi |
---|
3540 | else |
---|
3541 | # Add a -L argument. |
---|
3542 | newdeplibs="$newdeplibs $a_deplib" |
---|
3543 | fi |
---|
3544 | done # Gone through all deplibs. |
---|
3545 | ;; |
---|
3546 | match_pattern*) |
---|
3547 | set dummy $deplibs_check_method |
---|
3548 | match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
---|
3549 | for a_deplib in $deplibs; do |
---|
3550 | name="`expr $a_deplib : '-l\(.*\)'`" |
---|
3551 | # If $name is empty we are operating on a -L argument. |
---|
3552 | if test -n "$name" && test "$name" != "0"; then |
---|
3553 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
---|
3554 | case " $predeps $postdeps " in |
---|
3555 | *" $a_deplib "*) |
---|
3556 | newdeplibs="$newdeplibs $a_deplib" |
---|
3557 | a_deplib="" |
---|
3558 | ;; |
---|
3559 | esac |
---|
3560 | fi |
---|
3561 | if test -n "$a_deplib" ; then |
---|
3562 | libname=`eval \\$echo \"$libname_spec\"` |
---|
3563 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
---|
3564 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
---|
3565 | for potent_lib in $potential_libs; do |
---|
3566 | potlib="$potent_lib" # see symlink-check above in file_magic test |
---|
3567 | if eval $echo \"$potent_lib\" 2>/dev/null \ |
---|
3568 | | ${SED} 10q \ |
---|
3569 | | $EGREP "$match_pattern_regex" > /dev/null; then |
---|
3570 | newdeplibs="$newdeplibs $a_deplib" |
---|
3571 | a_deplib="" |
---|
3572 | break 2 |
---|
3573 | fi |
---|
3574 | done |
---|
3575 | done |
---|
3576 | fi |
---|
3577 | if test -n "$a_deplib" ; then |
---|
3578 | droppeddeps=yes |
---|
3579 | $echo |
---|
3580 | $echo "*** Warning: linker path does not have real file for library $a_deplib." |
---|
3581 | $echo "*** I have the capability to make that library automatically link in when" |
---|
3582 | $echo "*** you link to this library. But I can only do this if you have a" |
---|
3583 | $echo "*** shared version of the library, which you do not appear to have" |
---|
3584 | $echo "*** because I did check the linker path looking for a file starting" |
---|
3585 | if test -z "$potlib" ; then |
---|
3586 | $echo "*** with $libname but no candidates were found. (...for regex pattern test)" |
---|
3587 | else |
---|
3588 | $echo "*** with $libname and none of the candidates passed a file format test" |
---|
3589 | $echo "*** using a regex pattern. Last file checked: $potlib" |
---|
3590 | fi |
---|
3591 | fi |
---|
3592 | else |
---|
3593 | # Add a -L argument. |
---|
3594 | newdeplibs="$newdeplibs $a_deplib" |
---|
3595 | fi |
---|
3596 | done # Gone through all deplibs. |
---|
3597 | ;; |
---|
3598 | none | unknown | *) |
---|
3599 | newdeplibs="" |
---|
3600 | tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ |
---|
3601 | -e 's/ -[LR][^ ]*//g'` |
---|
3602 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
---|
3603 | for i in $predeps $postdeps ; do |
---|
3604 | # can't use Xsed below, because $i might contain '/' |
---|
3605 | tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` |
---|
3606 | done |
---|
3607 | fi |
---|
3608 | if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ |
---|
3609 | | grep . >/dev/null; then |
---|
3610 | $echo |
---|
3611 | if test "X$deplibs_check_method" = "Xnone"; then |
---|
3612 | $echo "*** Warning: inter-library dependencies are not supported in this platform." |
---|
3613 | else |
---|
3614 | $echo "*** Warning: inter-library dependencies are not known to be supported." |
---|
3615 | fi |
---|
3616 | $echo "*** All declared inter-library dependencies are being dropped." |
---|
3617 | droppeddeps=yes |
---|
3618 | fi |
---|
3619 | ;; |
---|
3620 | esac |
---|
3621 | versuffix=$versuffix_save |
---|
3622 | major=$major_save |
---|
3623 | release=$release_save |
---|
3624 | libname=$libname_save |
---|
3625 | name=$name_save |
---|
3626 | |
---|
3627 | case $host in |
---|
3628 | *-*-rhapsody* | *-*-darwin1.[012]) |
---|
3629 | # On Rhapsody replace the C library is the System framework |
---|
3630 | newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` |
---|
3631 | ;; |
---|
3632 | esac |
---|
3633 | |
---|
3634 | if test "$droppeddeps" = yes; then |
---|
3635 | if test "$module" = yes; then |
---|
3636 | $echo |
---|
3637 | $echo "*** Warning: libtool could not satisfy all declared inter-library" |
---|
3638 | $echo "*** dependencies of module $libname. Therefore, libtool will create" |
---|
3639 | $echo "*** a static module, that should work as long as the dlopening" |
---|
3640 | $echo "*** application is linked with the -dlopen flag." |
---|
3641 | if test -z "$global_symbol_pipe"; then |
---|
3642 | $echo |
---|
3643 | $echo "*** However, this would only work if libtool was able to extract symbol" |
---|
3644 | $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
---|
3645 | $echo "*** not find such a program. So, this module is probably useless." |
---|
3646 | $echo "*** \`nm' from GNU binutils and a full rebuild may help." |
---|
3647 | fi |
---|
3648 | if test "$build_old_libs" = no; then |
---|
3649 | oldlibs="$output_objdir/$libname.$libext" |
---|
3650 | build_libtool_libs=module |
---|
3651 | build_old_libs=yes |
---|
3652 | else |
---|
3653 | build_libtool_libs=no |
---|
3654 | fi |
---|
3655 | else |
---|
3656 | $echo "*** The inter-library dependencies that have been dropped here will be" |
---|
3657 | $echo "*** automatically added whenever a program is linked with this library" |
---|
3658 | $echo "*** or is declared to -dlopen it." |
---|
3659 | |
---|
3660 | if test "$allow_undefined" = no; then |
---|
3661 | $echo |
---|
3662 | $echo "*** Since this library must not contain undefined symbols," |
---|
3663 | $echo "*** because either the platform does not support them or" |
---|
3664 | $echo "*** it was explicitly requested with -no-undefined," |
---|
3665 | $echo "*** libtool will only create a static version of it." |
---|
3666 | if test "$build_old_libs" = no; then |
---|
3667 | oldlibs="$output_objdir/$libname.$libext" |
---|
3668 | build_libtool_libs=module |
---|
3669 | build_old_libs=yes |
---|
3670 | else |
---|
3671 | build_libtool_libs=no |
---|
3672 | fi |
---|
3673 | fi |
---|
3674 | fi |
---|
3675 | fi |
---|
3676 | # Done checking deplibs! |
---|
3677 | deplibs=$newdeplibs |
---|
3678 | fi |
---|
3679 | |
---|
3680 | # All the library-specific variables (install_libdir is set above). |
---|
3681 | library_names= |
---|
3682 | old_library= |
---|
3683 | dlname= |
---|
3684 | |
---|
3685 | # Test again, we may have decided not to build it any more |
---|
3686 | if test "$build_libtool_libs" = yes; then |
---|
3687 | if test "$hardcode_into_libs" = yes; then |
---|
3688 | # Hardcode the library paths |
---|
3689 | hardcode_libdirs= |
---|
3690 | dep_rpath= |
---|
3691 | rpath="$finalize_rpath" |
---|
3692 | test "$mode" != relink && rpath="$compile_rpath$rpath" |
---|
3693 | for libdir in $rpath; do |
---|
3694 | if test -n "$hardcode_libdir_flag_spec"; then |
---|
3695 | if test -n "$hardcode_libdir_separator"; then |
---|
3696 | if test -z "$hardcode_libdirs"; then |
---|
3697 | hardcode_libdirs="$libdir" |
---|
3698 | else |
---|
3699 | # Just accumulate the unique libdirs. |
---|
3700 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
---|
3701 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
---|
3702 | ;; |
---|
3703 | *) |
---|
3704 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
---|
3705 | ;; |
---|
3706 | esac |
---|
3707 | fi |
---|
3708 | else |
---|
3709 | eval flag=\"$hardcode_libdir_flag_spec\" |
---|
3710 | dep_rpath="$dep_rpath $flag" |
---|
3711 | fi |
---|
3712 | elif test -n "$runpath_var"; then |
---|
3713 | case "$perm_rpath " in |
---|
3714 | *" $libdir "*) ;; |
---|
3715 | *) perm_rpath="$perm_rpath $libdir" ;; |
---|
3716 | esac |
---|
3717 | fi |
---|
3718 | done |
---|
3719 | # Substitute the hardcoded libdirs into the rpath. |
---|
3720 | if test -n "$hardcode_libdir_separator" && |
---|
3721 | test -n "$hardcode_libdirs"; then |
---|
3722 | libdir="$hardcode_libdirs" |
---|
3723 | if test -n "$hardcode_libdir_flag_spec_ld"; then |
---|
3724 | eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" |
---|
3725 | else |
---|
3726 | eval dep_rpath=\"$hardcode_libdir_flag_spec\" |
---|
3727 | fi |
---|
3728 | fi |
---|
3729 | if test -n "$runpath_var" && test -n "$perm_rpath"; then |
---|
3730 | # We should set the runpath_var. |
---|
3731 | rpath= |
---|
3732 | for dir in $perm_rpath; do |
---|
3733 | rpath="$rpath$dir:" |
---|
3734 | done |
---|
3735 | eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" |
---|
3736 | fi |
---|
3737 | test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" |
---|
3738 | fi |
---|
3739 | |
---|
3740 | shlibpath="$finalize_shlibpath" |
---|
3741 | test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" |
---|
3742 | if test -n "$shlibpath"; then |
---|
3743 | eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" |
---|
3744 | fi |
---|
3745 | |
---|
3746 | # Get the real and link names of the library. |
---|
3747 | eval shared_ext=\"$shrext_cmds\" |
---|
3748 | eval library_names=\"$library_names_spec\" |
---|
3749 | set dummy $library_names |
---|
3750 | realname="$2" |
---|
3751 | shift; shift |
---|
3752 | |
---|
3753 | if test -n "$soname_spec"; then |
---|
3754 | eval soname=\"$soname_spec\" |
---|
3755 | else |
---|
3756 | soname="$realname" |
---|
3757 | fi |
---|
3758 | if test -z "$dlname"; then |
---|
3759 | dlname=$soname |
---|
3760 | fi |
---|
3761 | |
---|
3762 | lib="$output_objdir/$realname" |
---|
3763 | for link |
---|
3764 | do |
---|
3765 | linknames="$linknames $link" |
---|
3766 | done |
---|
3767 | |
---|
3768 | # Use standard objects if they are pic |
---|
3769 | test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
---|
3770 | |
---|
3771 | # Prepare the list of exported symbols |
---|
3772 | if test -z "$export_symbols"; then |
---|
3773 | if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then |
---|
3774 | $show "generating symbol list for \`$libname.la'" |
---|
3775 | export_symbols="$output_objdir/$libname.exp" |
---|
3776 | $run $rm $export_symbols |
---|
3777 | cmds=$export_symbols_cmds |
---|
3778 | save_ifs="$IFS"; IFS='~' |
---|
3779 | for cmd in $cmds; do |
---|
3780 | IFS="$save_ifs" |
---|
3781 | eval cmd=\"$cmd\" |
---|
3782 | if len=`expr "X$cmd" : ".*"` && |
---|
3783 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
---|
3784 | $show "$cmd" |
---|
3785 | $run eval "$cmd" || exit $? |
---|
3786 | skipped_export=false |
---|
3787 | else |
---|
3788 | # The command line is too long to execute in one step. |
---|
3789 | $show "using reloadable object file for export list..." |
---|
3790 | skipped_export=: |
---|
3791 | fi |
---|
3792 | done |
---|
3793 | IFS="$save_ifs" |
---|
3794 | if test -n "$export_symbols_regex"; then |
---|
3795 | $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" |
---|
3796 | $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' |
---|
3797 | $show "$mv \"${export_symbols}T\" \"$export_symbols\"" |
---|
3798 | $run eval '$mv "${export_symbols}T" "$export_symbols"' |
---|
3799 | fi |
---|
3800 | fi |
---|
3801 | fi |
---|
3802 | |
---|
3803 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
---|
3804 | $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' |
---|
3805 | fi |
---|
3806 | |
---|
3807 | tmp_deplibs= |
---|
3808 | for test_deplib in $deplibs; do |
---|
3809 | case " $convenience " in |
---|
3810 | *" $test_deplib "*) ;; |
---|
3811 | *) |
---|
3812 | tmp_deplibs="$tmp_deplibs $test_deplib" |
---|
3813 | ;; |
---|
3814 | esac |
---|
3815 | done |
---|
3816 | deplibs="$tmp_deplibs" |
---|
3817 | |
---|
3818 | if test -n "$convenience"; then |
---|
3819 | if test -n "$whole_archive_flag_spec"; then |
---|
3820 | save_libobjs=$libobjs |
---|
3821 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
---|
3822 | else |
---|
3823 | gentop="$output_objdir/${outputname}x" |
---|
3824 | generated="$generated $gentop" |
---|
3825 | |
---|
3826 | func_extract_archives $gentop $convenience |
---|
3827 | libobjs="$libobjs $func_extract_archives_result" |
---|
3828 | fi |
---|
3829 | fi |
---|
3830 | |
---|
3831 | if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then |
---|
3832 | eval flag=\"$thread_safe_flag_spec\" |
---|
3833 | linker_flags="$linker_flags $flag" |
---|
3834 | fi |
---|
3835 | |
---|
3836 | # Make a backup of the uninstalled library when relinking |
---|
3837 | if test "$mode" = relink; then |
---|
3838 | $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? |
---|
3839 | fi |
---|
3840 | |
---|
3841 | # Do each of the archive commands. |
---|
3842 | if test "$module" = yes && test -n "$module_cmds" ; then |
---|
3843 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
---|
3844 | eval test_cmds=\"$module_expsym_cmds\" |
---|
3845 | cmds=$module_expsym_cmds |
---|
3846 | else |
---|
3847 | eval test_cmds=\"$module_cmds\" |
---|
3848 | cmds=$module_cmds |
---|
3849 | fi |
---|
3850 | else |
---|
3851 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
---|
3852 | eval test_cmds=\"$archive_expsym_cmds\" |
---|
3853 | cmds=$archive_expsym_cmds |
---|
3854 | else |
---|
3855 | eval test_cmds=\"$archive_cmds\" |
---|
3856 | cmds=$archive_cmds |
---|
3857 | fi |
---|
3858 | fi |
---|
3859 | |
---|
3860 | if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && |
---|
3861 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
---|
3862 | : |
---|
3863 | else |
---|
3864 | # The command line is too long to link in one step, link piecewise. |
---|
3865 | $echo "creating reloadable object files..." |
---|
3866 | |
---|
3867 | # Save the value of $output and $libobjs because we want to |
---|
3868 | # use them later. If we have whole_archive_flag_spec, we |
---|
3869 | # want to use save_libobjs as it was before |
---|
3870 | # whole_archive_flag_spec was expanded, because we can't |
---|
3871 | # assume the linker understands whole_archive_flag_spec. |
---|
3872 | # This may have to be revisited, in case too many |
---|
3873 | # convenience libraries get linked in and end up exceeding |
---|
3874 | # the spec. |
---|
3875 | if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then |
---|
3876 | save_libobjs=$libobjs |
---|
3877 | fi |
---|
3878 | save_output=$output |
---|
3879 | |
---|
3880 | # Clear the reloadable object creation command queue and |
---|
3881 | # initialize k to one. |
---|
3882 | test_cmds= |
---|
3883 | concat_cmds= |
---|
3884 | objlist= |
---|
3885 | delfiles= |
---|
3886 | last_robj= |
---|
3887 | k=1 |
---|
3888 | output=$output_objdir/$save_output-${k}.$objext |
---|
3889 | # Loop over the list of objects to be linked. |
---|
3890 | for obj in $save_libobjs |
---|
3891 | do |
---|
3892 | eval test_cmds=\"$reload_cmds $objlist $last_robj\" |
---|
3893 | if test "X$objlist" = X || |
---|
3894 | { len=`expr "X$test_cmds" : ".*"` && |
---|
3895 | test "$len" -le "$max_cmd_len"; }; then |
---|
3896 | objlist="$objlist $obj" |
---|
3897 | else |
---|
3898 | # The command $test_cmds is almost too long, add a |
---|
3899 | # command to the queue. |
---|
3900 | if test "$k" -eq 1 ; then |
---|
3901 | # The first file doesn't have a previous command to add. |
---|
3902 | eval concat_cmds=\"$reload_cmds $objlist $last_robj\" |
---|
3903 | else |
---|
3904 | # All subsequent reloadable object files will link in |
---|
3905 | # the last one created. |
---|
3906 | eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" |
---|
3907 | fi |
---|
3908 | last_robj=$output_objdir/$save_output-${k}.$objext |
---|
3909 | k=`expr $k + 1` |
---|
3910 | output=$output_objdir/$save_output-${k}.$objext |
---|
3911 | objlist=$obj |
---|
3912 | len=1 |
---|
3913 | fi |
---|
3914 | done |
---|
3915 | # Handle the remaining objects by creating one last |
---|
3916 | # reloadable object file. All subsequent reloadable object |
---|
3917 | # files will link in the last one created. |
---|
3918 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
---|
3919 | eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" |
---|
3920 | |
---|
3921 | if ${skipped_export-false}; then |
---|
3922 | $show "generating symbol list for \`$libname.la'" |
---|
3923 | export_symbols="$output_objdir/$libname.exp" |
---|
3924 | $run $rm $export_symbols |
---|
3925 | libobjs=$output |
---|
3926 | # Append the command to create the export file. |
---|
3927 | eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" |
---|
3928 | fi |
---|
3929 | |
---|
3930 | # Set up a command to remove the reloadale object files |
---|
3931 | # after they are used. |
---|
3932 | i=0 |
---|
3933 | while test "$i" -lt "$k" |
---|
3934 | do |
---|
3935 | i=`expr $i + 1` |
---|
3936 | delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" |
---|
3937 | done |
---|
3938 | |
---|
3939 | $echo "creating a temporary reloadable object file: $output" |
---|
3940 | |
---|
3941 | # Loop through the commands generated above and execute them. |
---|
3942 | save_ifs="$IFS"; IFS='~' |
---|
3943 | for cmd in $concat_cmds; do |
---|
3944 | IFS="$save_ifs" |
---|
3945 | $show "$cmd" |
---|
3946 | $run eval "$cmd" || exit $? |
---|
3947 | done |
---|
3948 | IFS="$save_ifs" |
---|
3949 | |
---|
3950 | libobjs=$output |
---|
3951 | # Restore the value of output. |
---|
3952 | output=$save_output |
---|
3953 | |
---|
3954 | if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then |
---|
3955 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
---|
3956 | fi |
---|
3957 | # Expand the library linking commands again to reset the |
---|
3958 | # value of $libobjs for piecewise linking. |
---|
3959 | |
---|
3960 | # Do each of the archive commands. |
---|
3961 | if test "$module" = yes && test -n "$module_cmds" ; then |
---|
3962 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
---|
3963 | cmds=$module_expsym_cmds |
---|
3964 | else |
---|
3965 | cmds=$module_cmds |
---|
3966 | fi |
---|
3967 | else |
---|
3968 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
---|
3969 | cmds=$archive_expsym_cmds |
---|
3970 | else |
---|
3971 | cmds=$archive_cmds |
---|
3972 | fi |
---|
3973 | fi |
---|
3974 | |
---|
3975 | # Append the command to remove the reloadable object files |
---|
3976 | # to the just-reset $cmds. |
---|
3977 | eval cmds=\"\$cmds~\$rm $delfiles\" |
---|
3978 | fi |
---|
3979 | save_ifs="$IFS"; IFS='~' |
---|
3980 | for cmd in $cmds; do |
---|
3981 | IFS="$save_ifs" |
---|
3982 | eval cmd=\"$cmd\" |
---|
3983 | $show "$cmd" |
---|
3984 | $run eval "$cmd" || exit $? |
---|
3985 | done |
---|
3986 | IFS="$save_ifs" |
---|
3987 | |
---|
3988 | # Restore the uninstalled library and exit |
---|
3989 | if test "$mode" = relink; then |
---|
3990 | $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? |
---|
3991 | exit $EXIT_SUCCESS |
---|
3992 | fi |
---|
3993 | |
---|
3994 | # Create links to the real library. |
---|
3995 | for linkname in $linknames; do |
---|
3996 | if test "$realname" != "$linkname"; then |
---|
3997 | $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" |
---|
3998 | $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? |
---|
3999 | fi |
---|
4000 | done |
---|
4001 | |
---|
4002 | # If -module or -export-dynamic was specified, set the dlname. |
---|
4003 | if test "$module" = yes || test "$export_dynamic" = yes; then |
---|
4004 | # On all known operating systems, these are identical. |
---|
4005 | dlname="$soname" |
---|
4006 | fi |
---|
4007 | fi |
---|
4008 | ;; |
---|
4009 | |
---|
4010 | obj) |
---|
4011 | if test -n "$deplibs"; then |
---|
4012 | $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 |
---|
4013 | fi |
---|
4014 | |
---|
4015 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
---|
4016 | $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 |
---|
4017 | fi |
---|
4018 | |
---|
4019 | if test -n "$rpath"; then |
---|
4020 | $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 |
---|
4021 | fi |
---|
4022 | |
---|
4023 | if test -n "$xrpath"; then |
---|
4024 | $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 |
---|
4025 | fi |
---|
4026 | |
---|
4027 | if test -n "$vinfo"; then |
---|
4028 | $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 |
---|
4029 | fi |
---|
4030 | |
---|
4031 | if test -n "$release"; then |
---|
4032 | $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 |
---|
4033 | fi |
---|
4034 | |
---|
4035 | case $output in |
---|
4036 | *.lo) |
---|
4037 | if test -n "$objs$old_deplibs"; then |
---|
4038 | $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 |
---|
4039 | exit $EXIT_FAILURE |
---|
4040 | fi |
---|
4041 | libobj="$output" |
---|
4042 | obj=`$echo "X$output" | $Xsed -e "$lo2o"` |
---|
4043 | ;; |
---|
4044 | *) |
---|
4045 | libobj= |
---|
4046 | obj="$output" |
---|
4047 | ;; |
---|
4048 | esac |
---|
4049 | |
---|
4050 | # Delete the old objects. |
---|
4051 | $run $rm $obj $libobj |
---|
4052 | |
---|
4053 | # Objects from convenience libraries. This assumes |
---|
4054 | # single-version convenience libraries. Whenever we create |
---|
4055 | # different ones for PIC/non-PIC, this we'll have to duplicate |
---|
4056 | # the extraction. |
---|
4057 | reload_conv_objs= |
---|
4058 | gentop= |
---|
4059 | # reload_cmds runs $LD directly, so let us get rid of |
---|
4060 | # -Wl from whole_archive_flag_spec |
---|
4061 | wl= |
---|
4062 | |
---|
4063 | if test -n "$convenience"; then |
---|
4064 | if test -n "$whole_archive_flag_spec"; then |
---|
4065 | eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" |
---|
4066 | else |
---|
4067 | gentop="$output_objdir/${obj}x" |
---|
4068 | generated="$generated $gentop" |
---|
4069 | |
---|
4070 | func_extract_archives $gentop $convenience |
---|
4071 | reload_conv_objs="$reload_objs $func_extract_archives_result" |
---|
4072 | fi |
---|
4073 | fi |
---|
4074 | |
---|
4075 | # Create the old-style object. |
---|
4076 | reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test |
---|
4077 | |
---|
4078 | output="$obj" |
---|
4079 | cmds=$reload_cmds |
---|
4080 | save_ifs="$IFS"; IFS='~' |
---|
4081 | for cmd in $cmds; do |
---|
4082 | IFS="$save_ifs" |
---|
4083 | eval cmd=\"$cmd\" |
---|
4084 | $show "$cmd" |
---|
4085 | $run eval "$cmd" || exit $? |
---|
4086 | done |
---|
4087 | IFS="$save_ifs" |
---|
4088 | |
---|
4089 | # Exit if we aren't doing a library object file. |
---|
4090 | if test -z "$libobj"; then |
---|
4091 | if test -n "$gentop"; then |
---|
4092 | $show "${rm}r $gentop" |
---|
4093 | $run ${rm}r $gentop |
---|
4094 | fi |
---|
4095 | |
---|
4096 | exit $EXIT_SUCCESS |
---|
4097 | fi |
---|
4098 | |
---|
4099 | if test "$build_libtool_libs" != yes; then |
---|
4100 | if test -n "$gentop"; then |
---|
4101 | $show "${rm}r $gentop" |
---|
4102 | $run ${rm}r $gentop |
---|
4103 | fi |
---|
4104 | |
---|
4105 | # Create an invalid libtool object if no PIC, so that we don't |
---|
4106 | # accidentally link it into a program. |
---|
4107 | # $show "echo timestamp > $libobj" |
---|
4108 | # $run eval "echo timestamp > $libobj" || exit $? |
---|
4109 | exit $EXIT_SUCCESS |
---|
4110 | fi |
---|
4111 | |
---|
4112 | if test -n "$pic_flag" || test "$pic_mode" != default; then |
---|
4113 | # Only do commands if we really have different PIC objects. |
---|
4114 | reload_objs="$libobjs $reload_conv_objs" |
---|
4115 | output="$libobj" |
---|
4116 | cmds=$reload_cmds |
---|
4117 | save_ifs="$IFS"; IFS='~' |
---|
4118 | for cmd in $cmds; do |
---|
4119 | IFS="$save_ifs" |
---|
4120 | eval cmd=\"$cmd\" |
---|
4121 | $show "$cmd" |
---|
4122 | $run eval "$cmd" || exit $? |
---|
4123 | done |
---|
4124 | IFS="$save_ifs" |
---|
4125 | fi |
---|
4126 | |
---|
4127 | if test -n "$gentop"; then |
---|
4128 | $show "${rm}r $gentop" |
---|
4129 | $run ${rm}r $gentop |
---|
4130 | fi |
---|
4131 | |
---|
4132 | exit $EXIT_SUCCESS |
---|
4133 | ;; |
---|
4134 | |
---|
4135 | prog) |
---|
4136 | case $host in |
---|
4137 | *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; |
---|
4138 | esac |
---|
4139 | if test -n "$vinfo"; then |
---|
4140 | $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 |
---|
4141 | fi |
---|
4142 | |
---|
4143 | if test -n "$release"; then |
---|
4144 | $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 |
---|
4145 | fi |
---|
4146 | |
---|
4147 | if test "$preload" = yes; then |
---|
4148 | if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && |
---|
4149 | test "$dlopen_self_static" = unknown; then |
---|
4150 | $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." |
---|
4151 | fi |
---|
4152 | fi |
---|
4153 | |
---|
4154 | case $host in |
---|
4155 | *-*-rhapsody* | *-*-darwin1.[012]) |
---|
4156 | # On Rhapsody replace the C library is the System framework |
---|
4157 | compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` |
---|
4158 | finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` |
---|
4159 | ;; |
---|
4160 | esac |
---|
4161 | |
---|
4162 | case $host in |
---|
4163 | *darwin*) |
---|
4164 | # Don't allow lazy linking, it breaks C++ global constructors |
---|
4165 | if test "$tagname" = CXX ; then |
---|
4166 | compile_command="$compile_command ${wl}-bind_at_load" |
---|
4167 | finalize_command="$finalize_command ${wl}-bind_at_load" |
---|
4168 | fi |
---|
4169 | ;; |
---|
4170 | esac |
---|
4171 | |
---|
4172 | compile_command="$compile_command $compile_deplibs" |
---|
4173 | finalize_command="$finalize_command $finalize_deplibs" |
---|
4174 | |
---|
4175 | if test -n "$rpath$xrpath"; then |
---|
4176 | # If the user specified any rpath flags, then add them. |
---|
4177 | for libdir in $rpath $xrpath; do |
---|
4178 | # This is the magic to use -rpath. |
---|
4179 | case "$finalize_rpath " in |
---|
4180 | *" $libdir "*) ;; |
---|
4181 | *) finalize_rpath="$finalize_rpath $libdir" ;; |
---|
4182 | esac |
---|
4183 | done |
---|
4184 | fi |
---|
4185 | |
---|
4186 | # Now hardcode the library paths |
---|
4187 | rpath= |
---|
4188 | hardcode_libdirs= |
---|
4189 | for libdir in $compile_rpath $finalize_rpath; do |
---|
4190 | if test -n "$hardcode_libdir_flag_spec"; then |
---|
4191 | if test -n "$hardcode_libdir_separator"; then |
---|
4192 | if test -z "$hardcode_libdirs"; then |
---|
4193 | hardcode_libdirs="$libdir" |
---|
4194 | else |
---|
4195 | # Just accumulate the unique libdirs. |
---|
4196 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
---|
4197 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
---|
4198 | ;; |
---|
4199 | *) |
---|
4200 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
---|
4201 | ;; |
---|
4202 | esac |
---|
4203 | fi |
---|
4204 | else |
---|
4205 | eval flag=\"$hardcode_libdir_flag_spec\" |
---|
4206 | rpath="$rpath $flag" |
---|
4207 | fi |
---|
4208 | elif test -n "$runpath_var"; then |
---|
4209 | case "$perm_rpath " in |
---|
4210 | *" $libdir "*) ;; |
---|
4211 | *) perm_rpath="$perm_rpath $libdir" ;; |
---|
4212 | esac |
---|
4213 | fi |
---|
4214 | case $host in |
---|
4215 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
---|
4216 | case :$dllsearchpath: in |
---|
4217 | *":$libdir:"*) ;; |
---|
4218 | *) dllsearchpath="$dllsearchpath:$libdir";; |
---|
4219 | esac |
---|
4220 | ;; |
---|
4221 | esac |
---|
4222 | done |
---|
4223 | # Substitute the hardcoded libdirs into the rpath. |
---|
4224 | if test -n "$hardcode_libdir_separator" && |
---|
4225 | test -n "$hardcode_libdirs"; then |
---|
4226 | libdir="$hardcode_libdirs" |
---|
4227 | eval rpath=\" $hardcode_libdir_flag_spec\" |
---|
4228 | fi |
---|
4229 | compile_rpath="$rpath" |
---|
4230 | |
---|
4231 | rpath= |
---|
4232 | hardcode_libdirs= |
---|
4233 | for libdir in $finalize_rpath; do |
---|
4234 | if test -n "$hardcode_libdir_flag_spec"; then |
---|
4235 | if test -n "$hardcode_libdir_separator"; then |
---|
4236 | if test -z "$hardcode_libdirs"; then |
---|
4237 | hardcode_libdirs="$libdir" |
---|
4238 | else |
---|
4239 | # Just accumulate the unique libdirs. |
---|
4240 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
---|
4241 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
---|
4242 | ;; |
---|
4243 | *) |
---|
4244 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
---|
4245 | ;; |
---|
4246 | esac |
---|
4247 | fi |
---|
4248 | else |
---|
4249 | eval flag=\"$hardcode_libdir_flag_spec\" |
---|
4250 | rpath="$rpath $flag" |
---|
4251 | fi |
---|
4252 | elif test -n "$runpath_var"; then |
---|
4253 | case "$finalize_perm_rpath " in |
---|
4254 | *" $libdir "*) ;; |
---|
4255 | *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; |
---|
4256 | esac |
---|
4257 | fi |
---|
4258 | done |
---|
4259 | # Substitute the hardcoded libdirs into the rpath. |
---|
4260 | if test -n "$hardcode_libdir_separator" && |
---|
4261 | test -n "$hardcode_libdirs"; then |
---|
4262 | libdir="$hardcode_libdirs" |
---|
4263 | eval rpath=\" $hardcode_libdir_flag_spec\" |
---|
4264 | fi |
---|
4265 | finalize_rpath="$rpath" |
---|
4266 | |
---|
4267 | if test -n "$libobjs" && test "$build_old_libs" = yes; then |
---|
4268 | # Transform all the library objects into standard objects. |
---|
4269 | compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
---|
4270 | finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
---|
4271 | fi |
---|
4272 | |
---|
4273 | dlsyms= |
---|
4274 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
---|
4275 | if test -n "$NM" && test -n "$global_symbol_pipe"; then |
---|
4276 | dlsyms="${outputname}S.c" |
---|
4277 | else |
---|
4278 | $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 |
---|
4279 | fi |
---|
4280 | fi |
---|
4281 | |
---|
4282 | if test -n "$dlsyms"; then |
---|
4283 | case $dlsyms in |
---|
4284 | "") ;; |
---|
4285 | *.c) |
---|
4286 | # Discover the nlist of each of the dlfiles. |
---|
4287 | nlist="$output_objdir/${outputname}.nm" |
---|
4288 | |
---|
4289 | $show "$rm $nlist ${nlist}S ${nlist}T" |
---|
4290 | $run $rm "$nlist" "${nlist}S" "${nlist}T" |
---|
4291 | |
---|
4292 | # Parse the name list into a source file. |
---|
4293 | $show "creating $output_objdir/$dlsyms" |
---|
4294 | |
---|
4295 | test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ |
---|
4296 | /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ |
---|
4297 | /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ |
---|
4298 | |
---|
4299 | #ifdef __cplusplus |
---|
4300 | extern \"C\" { |
---|
4301 | #endif |
---|
4302 | |
---|
4303 | /* Prevent the only kind of declaration conflicts we can make. */ |
---|
4304 | #define lt_preloaded_symbols some_other_symbol |
---|
4305 | |
---|
4306 | /* External symbol declarations for the compiler. */\ |
---|
4307 | " |
---|
4308 | |
---|
4309 | if test "$dlself" = yes; then |
---|
4310 | $show "generating symbol list for \`$output'" |
---|
4311 | |
---|
4312 | test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" |
---|
4313 | |
---|
4314 | # Add our own program objects to the symbol list. |
---|
4315 | progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
---|
4316 | for arg in $progfiles; do |
---|
4317 | $show "extracting global C symbols from \`$arg'" |
---|
4318 | $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" |
---|
4319 | done |
---|
4320 | |
---|
4321 | if test -n "$exclude_expsyms"; then |
---|
4322 | $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' |
---|
4323 | $run eval '$mv "$nlist"T "$nlist"' |
---|
4324 | fi |
---|
4325 | |
---|
4326 | if test -n "$export_symbols_regex"; then |
---|
4327 | $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' |
---|
4328 | $run eval '$mv "$nlist"T "$nlist"' |
---|
4329 | fi |
---|
4330 | |
---|
4331 | # Prepare the list of exported symbols |
---|
4332 | if test -z "$export_symbols"; then |
---|
4333 | export_symbols="$output_objdir/$output.exp" |
---|
4334 | $run $rm $export_symbols |
---|
4335 | $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' |
---|
4336 | else |
---|
4337 | $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' |
---|
4338 | $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' |
---|
4339 | $run eval 'mv "$nlist"T "$nlist"' |
---|
4340 | fi |
---|
4341 | fi |
---|
4342 | |
---|
4343 | for arg in $dlprefiles; do |
---|
4344 | $show "extracting global C symbols from \`$arg'" |
---|
4345 | name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` |
---|
4346 | $run eval '$echo ": $name " >> "$nlist"' |
---|
4347 | $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" |
---|
4348 | done |
---|
4349 | |
---|
4350 | if test -z "$run"; then |
---|
4351 | # Make sure we have at least an empty file. |
---|
4352 | test -f "$nlist" || : > "$nlist" |
---|
4353 | |
---|
4354 | if test -n "$exclude_expsyms"; then |
---|
4355 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T |
---|
4356 | $mv "$nlist"T "$nlist" |
---|
4357 | fi |
---|
4358 | |
---|
4359 | # Try sorting and uniquifying the output. |
---|
4360 | if grep -v "^: " < "$nlist" | |
---|
4361 | if sort -k 3 </dev/null >/dev/null 2>&1; then |
---|
4362 | sort -k 3 |
---|
4363 | else |
---|
4364 | sort +2 |
---|
4365 | fi | |
---|
4366 | uniq > "$nlist"S; then |
---|
4367 | : |
---|
4368 | else |
---|
4369 | grep -v "^: " < "$nlist" > "$nlist"S |
---|
4370 | fi |
---|
4371 | |
---|
4372 | if test -f "$nlist"S; then |
---|
4373 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' |
---|
4374 | else |
---|
4375 | $echo '/* NONE */' >> "$output_objdir/$dlsyms" |
---|
4376 | fi |
---|
4377 | |
---|
4378 | $echo >> "$output_objdir/$dlsyms" "\ |
---|
4379 | |
---|
4380 | #undef lt_preloaded_symbols |
---|
4381 | |
---|
4382 | #if defined (__STDC__) && __STDC__ |
---|
4383 | # define lt_ptr void * |
---|
4384 | #else |
---|
4385 | # define lt_ptr char * |
---|
4386 | # define const |
---|
4387 | #endif |
---|
4388 | |
---|
4389 | /* The mapping between symbol names and symbols. */ |
---|
4390 | const struct { |
---|
4391 | const char *name; |
---|
4392 | lt_ptr address; |
---|
4393 | } |
---|
4394 | lt_preloaded_symbols[] = |
---|
4395 | {\ |
---|
4396 | " |
---|
4397 | |
---|
4398 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" |
---|
4399 | |
---|
4400 | $echo >> "$output_objdir/$dlsyms" "\ |
---|
4401 | {0, (lt_ptr) 0} |
---|
4402 | }; |
---|
4403 | |
---|
4404 | /* This works around a problem in FreeBSD linker */ |
---|
4405 | #ifdef FREEBSD_WORKAROUND |
---|
4406 | static const void *lt_preloaded_setup() { |
---|
4407 | return lt_preloaded_symbols; |
---|
4408 | } |
---|
4409 | #endif |
---|
4410 | |
---|
4411 | #ifdef __cplusplus |
---|
4412 | } |
---|
4413 | #endif\ |
---|
4414 | " |
---|
4415 | fi |
---|
4416 | |
---|
4417 | pic_flag_for_symtable= |
---|
4418 | case $host in |
---|
4419 | # compiling the symbol table file with pic_flag works around |
---|
4420 | # a FreeBSD bug that causes programs to crash when -lm is |
---|
4421 | # linked before any other PIC object. But we must not use |
---|
4422 | # pic_flag when linking with -static. The problem exists in |
---|
4423 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. |
---|
4424 | *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) |
---|
4425 | case "$compile_command " in |
---|
4426 | *" -static "*) ;; |
---|
4427 | *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; |
---|
4428 | esac;; |
---|
4429 | *-*-hpux*) |
---|
4430 | case "$compile_command " in |
---|
4431 | *" -static "*) ;; |
---|
4432 | *) pic_flag_for_symtable=" $pic_flag";; |
---|
4433 | esac |
---|
4434 | esac |
---|
4435 | |
---|
4436 | # Now compile the dynamic symbol file. |
---|
4437 | $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" |
---|
4438 | $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? |
---|
4439 | |
---|
4440 | # Clean up the generated files. |
---|
4441 | $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" |
---|
4442 | $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" |
---|
4443 | |
---|
4444 | # Transform the symbol file into the correct name. |
---|
4445 | compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` |
---|
4446 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` |
---|
4447 | ;; |
---|
4448 | *) |
---|
4449 | $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 |
---|
4450 | exit $EXIT_FAILURE |
---|
4451 | ;; |
---|
4452 | esac |
---|
4453 | else |
---|
4454 | # We keep going just in case the user didn't refer to |
---|
4455 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe |
---|
4456 | # really was required. |
---|
4457 | |
---|
4458 | # Nullify the symbol file. |
---|
4459 | compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` |
---|
4460 | finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` |
---|
4461 | fi |
---|
4462 | |
---|
4463 | if test "$need_relink" = no || test "$build_libtool_libs" != yes; then |
---|
4464 | # Replace the output file specification. |
---|
4465 | compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` |
---|
4466 | link_command="$compile_command$compile_rpath" |
---|
4467 | |
---|
4468 | # We have no uninstalled library dependencies, so finalize right now. |
---|
4469 | $show "$link_command" |
---|
4470 | $run eval "$link_command" |
---|
4471 | status=$? |
---|
4472 | |
---|
4473 | # Delete the generated files. |
---|
4474 | if test -n "$dlsyms"; then |
---|
4475 | $show "$rm $output_objdir/${outputname}S.${objext}" |
---|
4476 | $run $rm "$output_objdir/${outputname}S.${objext}" |
---|
4477 | fi |
---|
4478 | |
---|
4479 | exit $status |
---|
4480 | fi |
---|
4481 | |
---|
4482 | if test -n "$shlibpath_var"; then |
---|
4483 | # We should set the shlibpath_var |
---|
4484 | rpath= |
---|
4485 | for dir in $temp_rpath; do |
---|
4486 | case $dir in |
---|
4487 | [\\/]* | [A-Za-z]:[\\/]*) |
---|
4488 | # Absolute path. |
---|
4489 | rpath="$rpath$dir:" |
---|
4490 | ;; |
---|
4491 | *) |
---|
4492 | # Relative path: add a thisdir entry. |
---|
4493 | rpath="$rpath\$thisdir/$dir:" |
---|
4494 | ;; |
---|
4495 | esac |
---|
4496 | done |
---|
4497 | temp_rpath="$rpath" |
---|
4498 | fi |
---|
4499 | |
---|
4500 | if test -n "$compile_shlibpath$finalize_shlibpath"; then |
---|
4501 | compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" |
---|
4502 | fi |
---|
4503 | if test -n "$finalize_shlibpath"; then |
---|
4504 | finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" |
---|
4505 | fi |
---|
4506 | |
---|
4507 | compile_var= |
---|
4508 | finalize_var= |
---|
4509 | if test -n "$runpath_var"; then |
---|
4510 | if test -n "$perm_rpath"; then |
---|
4511 | # We should set the runpath_var. |
---|
4512 | rpath= |
---|
4513 | for dir in $perm_rpath; do |
---|
4514 | rpath="$rpath$dir:" |
---|
4515 | done |
---|
4516 | compile_var="$runpath_var=\"$rpath\$$runpath_var\" " |
---|
4517 | fi |
---|
4518 | if test -n "$finalize_perm_rpath"; then |
---|
4519 | # We should set the runpath_var. |
---|
4520 | rpath= |
---|
4521 | for dir in $finalize_perm_rpath; do |
---|
4522 | rpath="$rpath$dir:" |
---|
4523 | done |
---|
4524 | finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " |
---|
4525 | fi |
---|
4526 | fi |
---|
4527 | |
---|
4528 | if test "$no_install" = yes; then |
---|
4529 | # We don't need to create a wrapper script. |
---|
4530 | link_command="$compile_var$compile_command$compile_rpath" |
---|
4531 | # Replace the output file specification. |
---|
4532 | link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` |
---|
4533 | # Delete the old output file. |
---|
4534 | $run $rm $output |
---|
4535 | # Link the executable and exit |
---|
4536 | $show "$link_command" |
---|
4537 | $run eval "$link_command" || exit $? |
---|
4538 | exit $EXIT_SUCCESS |
---|
4539 | fi |
---|
4540 | |
---|
4541 | if test "$hardcode_action" = relink; then |
---|
4542 | # Fast installation is not supported |
---|
4543 | link_command="$compile_var$compile_command$compile_rpath" |
---|
4544 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
---|
4545 | |
---|
4546 | $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 |
---|
4547 | $echo "$modename: \`$output' will be relinked during installation" 1>&2 |
---|
4548 | else |
---|
4549 | if test "$fast_install" != no; then |
---|
4550 | link_command="$finalize_var$compile_command$finalize_rpath" |
---|
4551 | if test "$fast_install" = yes; then |
---|
4552 | relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` |
---|
4553 | else |
---|
4554 | # fast_install is set to needless |
---|
4555 | relink_command= |
---|
4556 | fi |
---|
4557 | else |
---|
4558 | link_command="$compile_var$compile_command$compile_rpath" |
---|
4559 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
---|
4560 | fi |
---|
4561 | fi |
---|
4562 | |
---|
4563 | # Replace the output file specification. |
---|
4564 | link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` |
---|
4565 | |
---|
4566 | # Delete the old output files. |
---|
4567 | $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname |
---|
4568 | |
---|
4569 | $show "$link_command" |
---|
4570 | $run eval "$link_command" || exit $? |
---|
4571 | |
---|
4572 | # Now create the wrapper script. |
---|
4573 | $show "creating $output" |
---|
4574 | |
---|
4575 | # Quote the relink command for shipping. |
---|
4576 | if test -n "$relink_command"; then |
---|
4577 | # Preserve any variables that may affect compiler behavior |
---|
4578 | for var in $variables_saved_for_relink; do |
---|
4579 | if eval test -z \"\${$var+set}\"; then |
---|
4580 | relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" |
---|
4581 | elif eval var_value=\$$var; test -z "$var_value"; then |
---|
4582 | relink_command="$var=; export $var; $relink_command" |
---|
4583 | else |
---|
4584 | var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` |
---|
4585 | relink_command="$var=\"$var_value\"; export $var; $relink_command" |
---|
4586 | fi |
---|
4587 | done |
---|
4588 | relink_command="(cd `pwd`; $relink_command)" |
---|
4589 | relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` |
---|
4590 | fi |
---|
4591 | |
---|
4592 | # Quote $echo for shipping. |
---|
4593 | if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then |
---|
4594 | case $progpath in |
---|
4595 | [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; |
---|
4596 | *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; |
---|
4597 | esac |
---|
4598 | qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` |
---|
4599 | else |
---|
4600 | qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` |
---|
4601 | fi |
---|
4602 | |
---|
4603 | # Only actually do things if our run command is non-null. |
---|
4604 | if test -z "$run"; then |
---|
4605 | # win32 will think the script is a binary if it has |
---|
4606 | # a .exe suffix, so we strip it off here. |
---|
4607 | case $output in |
---|
4608 | *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; |
---|
4609 | esac |
---|
4610 | # test for cygwin because mv fails w/o .exe extensions |
---|
4611 | case $host in |
---|
4612 | *cygwin*) |
---|
4613 | exeext=.exe |
---|
4614 | outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; |
---|
4615 | *) exeext= ;; |
---|
4616 | esac |
---|
4617 | case $host in |
---|
4618 | *cygwin* | *mingw* ) |
---|
4619 | cwrappersource=`$echo ${objdir}/lt-${output}.c` |
---|
4620 | cwrapper=`$echo ${output}.exe` |
---|
4621 | $rm $cwrappersource $cwrapper |
---|
4622 | trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 |
---|
4623 | |
---|
4624 | cat > $cwrappersource <<EOF |
---|
4625 | |
---|
4626 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname |
---|
4627 | Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
---|
4628 | |
---|
4629 | The $output program cannot be directly executed until all the libtool |
---|
4630 | libraries that it depends on are installed. |
---|
4631 | |
---|
4632 | This wrapper executable should never be moved out of the build directory. |
---|
4633 | If it is, it will not operate correctly. |
---|
4634 | |
---|
4635 | Currently, it simply execs the wrapper *script* "/bin/sh $output", |
---|
4636 | but could eventually absorb all of the scripts functionality and |
---|
4637 | exec $objdir/$outputname directly. |
---|
4638 | */ |
---|
4639 | EOF |
---|
4640 | cat >> $cwrappersource<<"EOF" |
---|
4641 | #include <stdio.h> |
---|
4642 | #include <stdlib.h> |
---|
4643 | #include <unistd.h> |
---|
4644 | #include <malloc.h> |
---|
4645 | #include <stdarg.h> |
---|
4646 | #include <assert.h> |
---|
4647 | |
---|
4648 | #if defined(PATH_MAX) |
---|
4649 | # define LT_PATHMAX PATH_MAX |
---|
4650 | #elif defined(MAXPATHLEN) |
---|
4651 | # define LT_PATHMAX MAXPATHLEN |
---|
4652 | #else |
---|
4653 | # define LT_PATHMAX 1024 |
---|
4654 | #endif |
---|
4655 | |
---|
4656 | #ifndef DIR_SEPARATOR |
---|
4657 | #define DIR_SEPARATOR '/' |
---|
4658 | #endif |
---|
4659 | |
---|
4660 | #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ |
---|
4661 | defined (__OS2__) |
---|
4662 | #define HAVE_DOS_BASED_FILE_SYSTEM |
---|
4663 | #ifndef DIR_SEPARATOR_2 |
---|
4664 | #define DIR_SEPARATOR_2 '\\' |
---|
4665 | #endif |
---|
4666 | #endif |
---|
4667 | |
---|
4668 | #ifndef DIR_SEPARATOR_2 |
---|
4669 | # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) |
---|
4670 | #else /* DIR_SEPARATOR_2 */ |
---|
4671 | # define IS_DIR_SEPARATOR(ch) \ |
---|
4672 | (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) |
---|
4673 | #endif /* DIR_SEPARATOR_2 */ |
---|
4674 | |
---|
4675 | #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) |
---|
4676 | #define XFREE(stale) do { \ |
---|
4677 | if (stale) { free ((void *) stale); stale = 0; } \ |
---|
4678 | } while (0) |
---|
4679 | |
---|
4680 | const char *program_name = NULL; |
---|
4681 | |
---|
4682 | void * xmalloc (size_t num); |
---|
4683 | char * xstrdup (const char *string); |
---|
4684 | char * basename (const char *name); |
---|
4685 | char * fnqualify(const char *path); |
---|
4686 | char * strendzap(char *str, const char *pat); |
---|
4687 | void lt_fatal (const char *message, ...); |
---|
4688 | |
---|
4689 | int |
---|
4690 | main (int argc, char *argv[]) |
---|
4691 | { |
---|
4692 | char **newargz; |
---|
4693 | int i; |
---|
4694 | |
---|
4695 | program_name = (char *) xstrdup ((char *) basename (argv[0])); |
---|
4696 | newargz = XMALLOC(char *, argc+2); |
---|
4697 | EOF |
---|
4698 | |
---|
4699 | cat >> $cwrappersource <<EOF |
---|
4700 | newargz[0] = "$SHELL"; |
---|
4701 | EOF |
---|
4702 | |
---|
4703 | cat >> $cwrappersource <<"EOF" |
---|
4704 | newargz[1] = fnqualify(argv[0]); |
---|
4705 | /* we know the script has the same name, without the .exe */ |
---|
4706 | /* so make sure newargz[1] doesn't end in .exe */ |
---|
4707 | strendzap(newargz[1],".exe"); |
---|
4708 | for (i = 1; i < argc; i++) |
---|
4709 | newargz[i+1] = xstrdup(argv[i]); |
---|
4710 | newargz[argc+1] = NULL; |
---|
4711 | EOF |
---|
4712 | |
---|
4713 | cat >> $cwrappersource <<EOF |
---|
4714 | execv("$SHELL",newargz); |
---|
4715 | EOF |
---|
4716 | |
---|
4717 | cat >> $cwrappersource <<"EOF" |
---|
4718 | } |
---|
4719 | |
---|
4720 | void * |
---|
4721 | xmalloc (size_t num) |
---|
4722 | { |
---|
4723 | void * p = (void *) malloc (num); |
---|
4724 | if (!p) |
---|
4725 | lt_fatal ("Memory exhausted"); |
---|
4726 | |
---|
4727 | return p; |
---|
4728 | } |
---|
4729 | |
---|
4730 | char * |
---|
4731 | xstrdup (const char *string) |
---|
4732 | { |
---|
4733 | return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL |
---|
4734 | ; |
---|
4735 | } |
---|
4736 | |
---|
4737 | char * |
---|
4738 | basename (const char *name) |
---|
4739 | { |
---|
4740 | const char *base; |
---|
4741 | |
---|
4742 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
---|
4743 | /* Skip over the disk name in MSDOS pathnames. */ |
---|
4744 | if (isalpha (name[0]) && name[1] == ':') |
---|
4745 | name += 2; |
---|
4746 | #endif |
---|
4747 | |
---|
4748 | for (base = name; *name; name++) |
---|
4749 | if (IS_DIR_SEPARATOR (*name)) |
---|
4750 | base = name + 1; |
---|
4751 | return (char *) base; |
---|
4752 | } |
---|
4753 | |
---|
4754 | char * |
---|
4755 | fnqualify(const char *path) |
---|
4756 | { |
---|
4757 | size_t size; |
---|
4758 | char *p; |
---|
4759 | char tmp[LT_PATHMAX + 1]; |
---|
4760 | |
---|
4761 | assert(path != NULL); |
---|
4762 | |
---|
4763 | /* Is it qualified already? */ |
---|
4764 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
---|
4765 | if (isalpha (path[0]) && path[1] == ':') |
---|
4766 | return xstrdup (path); |
---|
4767 | #endif |
---|
4768 | if (IS_DIR_SEPARATOR (path[0])) |
---|
4769 | return xstrdup (path); |
---|
4770 | |
---|
4771 | /* prepend the current directory */ |
---|
4772 | /* doesn't handle '~' */ |
---|
4773 | if (getcwd (tmp, LT_PATHMAX) == NULL) |
---|
4774 | lt_fatal ("getcwd failed"); |
---|
4775 | size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ |
---|
4776 | p = XMALLOC(char, size); |
---|
4777 | sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); |
---|
4778 | return p; |
---|
4779 | } |
---|
4780 | |
---|
4781 | char * |
---|
4782 | strendzap(char *str, const char *pat) |
---|
4783 | { |
---|
4784 | size_t len, patlen; |
---|
4785 | |
---|
4786 | assert(str != NULL); |
---|
4787 | assert(pat != NULL); |
---|
4788 | |
---|
4789 | len = strlen(str); |
---|
4790 | patlen = strlen(pat); |
---|
4791 | |
---|
4792 | if (patlen <= len) |
---|
4793 | { |
---|
4794 | str += len - patlen; |
---|
4795 | if (strcmp(str, pat) == 0) |
---|
4796 | *str = '\0'; |
---|
4797 | } |
---|
4798 | return str; |
---|
4799 | } |
---|
4800 | |
---|
4801 | static void |
---|
4802 | lt_error_core (int exit_status, const char * mode, |
---|
4803 | const char * message, va_list ap) |
---|
4804 | { |
---|
4805 | fprintf (stderr, "%s: %s: ", program_name, mode); |
---|
4806 | vfprintf (stderr, message, ap); |
---|
4807 | fprintf (stderr, ".\n"); |
---|
4808 | |
---|
4809 | if (exit_status >= 0) |
---|
4810 | exit (exit_status); |
---|
4811 | } |
---|
4812 | |
---|
4813 | void |
---|
4814 | lt_fatal (const char *message, ...) |
---|
4815 | { |
---|
4816 | va_list ap; |
---|
4817 | va_start (ap, message); |
---|
4818 | lt_error_core (EXIT_FAILURE, "FATAL", message, ap); |
---|
4819 | va_end (ap); |
---|
4820 | } |
---|
4821 | EOF |
---|
4822 | # we should really use a build-platform specific compiler |
---|
4823 | # here, but OTOH, the wrappers (shell script and this C one) |
---|
4824 | # are only useful if you want to execute the "real" binary. |
---|
4825 | # Since the "real" binary is built for $host, then this |
---|
4826 | # wrapper might as well be built for $host, too. |
---|
4827 | $run $LTCC -s -o $cwrapper $cwrappersource |
---|
4828 | ;; |
---|
4829 | esac |
---|
4830 | $rm $output |
---|
4831 | trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 |
---|
4832 | |
---|
4833 | $echo > $output "\ |
---|
4834 | #! $SHELL |
---|
4835 | |
---|
4836 | # $output - temporary wrapper script for $objdir/$outputname |
---|
4837 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
---|
4838 | # |
---|
4839 | # The $output program cannot be directly executed until all the libtool |
---|
4840 | # libraries that it depends on are installed. |
---|
4841 | # |
---|
4842 | # This wrapper script should never be moved out of the build directory. |
---|
4843 | # If it is, it will not operate correctly. |
---|
4844 | |
---|
4845 | # Sed substitution that helps us do robust quoting. It backslashifies |
---|
4846 | # metacharacters that are still active within double-quoted strings. |
---|
4847 | Xsed='${SED} -e 1s/^X//' |
---|
4848 | sed_quote_subst='$sed_quote_subst' |
---|
4849 | |
---|
4850 | # The HP-UX ksh and POSIX shell print the target directory to stdout |
---|
4851 | # if CDPATH is set. |
---|
4852 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
---|
4853 | |
---|
4854 | relink_command=\"$relink_command\" |
---|
4855 | |
---|
4856 | # This environment variable determines our operation mode. |
---|
4857 | if test \"\$libtool_install_magic\" = \"$magic\"; then |
---|
4858 | # install mode needs the following variable: |
---|
4859 | notinst_deplibs='$notinst_deplibs' |
---|
4860 | else |
---|
4861 | # When we are sourced in execute mode, \$file and \$echo are already set. |
---|
4862 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
---|
4863 | echo=\"$qecho\" |
---|
4864 | file=\"\$0\" |
---|
4865 | # Make sure echo works. |
---|
4866 | if test \"X\$1\" = X--no-reexec; then |
---|
4867 | # Discard the --no-reexec flag, and continue. |
---|
4868 | shift |
---|
4869 | elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then |
---|
4870 | # Yippee, \$echo works! |
---|
4871 | : |
---|
4872 | else |
---|
4873 | # Restart under the correct shell, and then maybe \$echo will work. |
---|
4874 | exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} |
---|
4875 | fi |
---|
4876 | fi\ |
---|
4877 | " |
---|
4878 | $echo >> $output "\ |
---|
4879 | |
---|
4880 | # Find the directory that this script lives in. |
---|
4881 | thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` |
---|
4882 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. |
---|
4883 | |
---|
4884 | # Follow symbolic links until we get to the real thisdir. |
---|
4885 | file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` |
---|
4886 | while test -n \"\$file\"; do |
---|
4887 | destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` |
---|
4888 | |
---|
4889 | # If there was a directory component, then change thisdir. |
---|
4890 | if test \"x\$destdir\" != \"x\$file\"; then |
---|
4891 | case \"\$destdir\" in |
---|
4892 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; |
---|
4893 | *) thisdir=\"\$thisdir/\$destdir\" ;; |
---|
4894 | esac |
---|
4895 | fi |
---|
4896 | |
---|
4897 | file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` |
---|
4898 | file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` |
---|
4899 | done |
---|
4900 | |
---|
4901 | # Try to get the absolute directory name. |
---|
4902 | absdir=\`cd \"\$thisdir\" && pwd\` |
---|
4903 | test -n \"\$absdir\" && thisdir=\"\$absdir\" |
---|
4904 | " |
---|
4905 | |
---|
4906 | if test "$fast_install" = yes; then |
---|
4907 | $echo >> $output "\ |
---|
4908 | program=lt-'$outputname'$exeext |
---|
4909 | progdir=\"\$thisdir/$objdir\" |
---|
4910 | |
---|
4911 | if test ! -f \"\$progdir/\$program\" || \\ |
---|
4912 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ |
---|
4913 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then |
---|
4914 | |
---|
4915 | file=\"\$\$-\$program\" |
---|
4916 | |
---|
4917 | if test ! -d \"\$progdir\"; then |
---|
4918 | $mkdir \"\$progdir\" |
---|
4919 | else |
---|
4920 | $rm \"\$progdir/\$file\" |
---|
4921 | fi" |
---|
4922 | |
---|
4923 | $echo >> $output "\ |
---|
4924 | |
---|
4925 | # relink executable if necessary |
---|
4926 | if test -n \"\$relink_command\"; then |
---|
4927 | if relink_command_output=\`eval \$relink_command 2>&1\`; then : |
---|
4928 | else |
---|
4929 | $echo \"\$relink_command_output\" >&2 |
---|
4930 | $rm \"\$progdir/\$file\" |
---|
4931 | exit $EXIT_FAILURE |
---|
4932 | fi |
---|
4933 | fi |
---|
4934 | |
---|
4935 | $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || |
---|
4936 | { $rm \"\$progdir/\$program\"; |
---|
4937 | $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
---|
4938 | $rm \"\$progdir/\$file\" |
---|
4939 | fi" |
---|
4940 | else |
---|
4941 | $echo >> $output "\ |
---|
4942 | program='$outputname' |
---|
4943 | progdir=\"\$thisdir/$objdir\" |
---|
4944 | " |
---|
4945 | fi |
---|
4946 | |
---|
4947 | $echo >> $output "\ |
---|
4948 | |
---|
4949 | if test -f \"\$progdir/\$program\"; then" |
---|
4950 | |
---|
4951 | # Export our shlibpath_var if we have one. |
---|
4952 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
---|
4953 | $echo >> $output "\ |
---|
4954 | # Add our own library path to $shlibpath_var |
---|
4955 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" |
---|
4956 | |
---|
4957 | # Some systems cannot cope with colon-terminated $shlibpath_var |
---|
4958 | # The second colon is a workaround for a bug in BeOS R4 sed |
---|
4959 | $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` |
---|
4960 | |
---|
4961 | export $shlibpath_var |
---|
4962 | " |
---|
4963 | fi |
---|
4964 | |
---|
4965 | # fixup the dll searchpath if we need to. |
---|
4966 | if test -n "$dllsearchpath"; then |
---|
4967 | $echo >> $output "\ |
---|
4968 | # Add the dll search path components to the executable PATH |
---|
4969 | PATH=$dllsearchpath:\$PATH |
---|
4970 | " |
---|
4971 | fi |
---|
4972 | |
---|
4973 | $echo >> $output "\ |
---|
4974 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
---|
4975 | # Run the actual program with our arguments. |
---|
4976 | " |
---|
4977 | case $host in |
---|
4978 | # Backslashes separate directories on plain windows |
---|
4979 | *-*-mingw | *-*-os2*) |
---|
4980 | $echo >> $output "\ |
---|
4981 | exec \$progdir\\\\\$program \${1+\"\$@\"} |
---|
4982 | " |
---|
4983 | ;; |
---|
4984 | |
---|
4985 | *) |
---|
4986 | $echo >> $output "\ |
---|
4987 | exec \$progdir/\$program \${1+\"\$@\"} |
---|
4988 | " |
---|
4989 | ;; |
---|
4990 | esac |
---|
4991 | $echo >> $output "\ |
---|
4992 | \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" |
---|
4993 | exit $EXIT_FAILURE |
---|
4994 | fi |
---|
4995 | else |
---|
4996 | # The program doesn't exist. |
---|
4997 | \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 |
---|
4998 | \$echo \"This script is just a wrapper for \$program.\" 1>&2 |
---|
4999 | $echo \"See the $PACKAGE documentation for more information.\" 1>&2 |
---|
5000 | exit $EXIT_FAILURE |
---|
5001 | fi |
---|
5002 | fi\ |
---|
5003 | " |
---|
5004 | chmod +x $output |
---|
5005 | fi |
---|
5006 | exit $EXIT_SUCCESS |
---|
5007 | ;; |
---|
5008 | esac |
---|
5009 | |
---|
5010 | # See if we need to build an old-fashioned archive. |
---|
5011 | for oldlib in $oldlibs; do |
---|
5012 | |
---|
5013 | if test "$build_libtool_libs" = convenience; then |
---|
5014 | oldobjs="$libobjs_save" |
---|
5015 | addlibs="$convenience" |
---|
5016 | build_libtool_libs=no |
---|
5017 | else |
---|
5018 | if test "$build_libtool_libs" = module; then |
---|
5019 | oldobjs="$libobjs_save" |
---|
5020 | build_libtool_libs=no |
---|
5021 | else |
---|
5022 | oldobjs="$old_deplibs $non_pic_objects" |
---|
5023 | fi |
---|
5024 | addlibs="$old_convenience" |
---|
5025 | fi |
---|
5026 | |
---|
5027 | if test -n "$addlibs"; then |
---|
5028 | gentop="$output_objdir/${outputname}x" |
---|
5029 | generated="$generated $gentop" |
---|
5030 | |
---|
5031 | func_extract_archives $gentop $addlibs |
---|
5032 | oldobjs="$oldobjs $func_extract_archives_result" |
---|
5033 | fi |
---|
5034 | |
---|
5035 | # Do each command in the archive commands. |
---|
5036 | if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then |
---|
5037 | cmds=$old_archive_from_new_cmds |
---|
5038 | else |
---|
5039 | eval cmds=\"$old_archive_cmds\" |
---|
5040 | |
---|
5041 | if len=`expr "X$cmds" : ".*"` && |
---|
5042 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
---|
5043 | cmds=$old_archive_cmds |
---|
5044 | else |
---|
5045 | # the command line is too long to link in one step, link in parts |
---|
5046 | $echo "using piecewise archive linking..." |
---|
5047 | save_RANLIB=$RANLIB |
---|
5048 | RANLIB=: |
---|
5049 | objlist= |
---|
5050 | concat_cmds= |
---|
5051 | save_oldobjs=$oldobjs |
---|
5052 | # GNU ar 2.10+ was changed to match POSIX; thus no paths are |
---|
5053 | # encoded into archives. This makes 'ar r' malfunction in |
---|
5054 | # this piecewise linking case whenever conflicting object |
---|
5055 | # names appear in distinct ar calls; check, warn and compensate. |
---|
5056 | if (for obj in $save_oldobjs |
---|
5057 | do |
---|
5058 | $echo "X$obj" | $Xsed -e 's%^.*/%%' |
---|
5059 | done | sort | sort -uc >/dev/null 2>&1); then |
---|
5060 | : |
---|
5061 | else |
---|
5062 | $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 |
---|
5063 | $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 |
---|
5064 | AR_FLAGS=cq |
---|
5065 | fi |
---|
5066 | # Is there a better way of finding the last object in the list? |
---|
5067 | for obj in $save_oldobjs |
---|
5068 | do |
---|
5069 | last_oldobj=$obj |
---|
5070 | done |
---|
5071 | for obj in $save_oldobjs |
---|
5072 | do |
---|
5073 | oldobjs="$objlist $obj" |
---|
5074 | objlist="$objlist $obj" |
---|
5075 | eval test_cmds=\"$old_archive_cmds\" |
---|
5076 | if len=`expr "X$test_cmds" : ".*"` && |
---|
5077 | test "$len" -le "$max_cmd_len"; then |
---|
5078 | : |
---|
5079 | else |
---|
5080 | # the above command should be used before it gets too long |
---|
5081 | oldobjs=$objlist |
---|
5082 | if test "$obj" = "$last_oldobj" ; then |
---|
5083 | RANLIB=$save_RANLIB |
---|
5084 | fi |
---|
5085 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
---|
5086 | eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" |
---|
5087 | objlist= |
---|
5088 | fi |
---|
5089 | done |
---|
5090 | RANLIB=$save_RANLIB |
---|
5091 | oldobjs=$objlist |
---|
5092 | if test "X$oldobjs" = "X" ; then |
---|
5093 | eval cmds=\"\$concat_cmds\" |
---|
5094 | else |
---|
5095 | eval cmds=\"\$concat_cmds~\$old_archive_cmds\" |
---|
5096 | fi |
---|
5097 | fi |
---|
5098 | fi |
---|
5099 | save_ifs="$IFS"; IFS='~' |
---|
5100 | for cmd in $cmds; do |
---|
5101 | eval cmd=\"$cmd\" |
---|
5102 | IFS="$save_ifs" |
---|
5103 | $show "$cmd" |
---|
5104 | $run eval "$cmd" || exit $? |
---|
5105 | done |
---|
5106 | IFS="$save_ifs" |
---|
5107 | done |
---|
5108 | |
---|
5109 | if test -n "$generated"; then |
---|
5110 | $show "${rm}r$generated" |
---|
5111 | $run ${rm}r$generated |
---|
5112 | fi |
---|
5113 | |
---|
5114 | # Now create the libtool archive. |
---|
5115 | case $output in |
---|
5116 | *.la) |
---|
5117 | old_library= |
---|
5118 | test "$build_old_libs" = yes && old_library="$libname.$libext" |
---|
5119 | $show "creating $output" |
---|
5120 | |
---|
5121 | # Preserve any variables that may affect compiler behavior |
---|
5122 | for var in $variables_saved_for_relink; do |
---|
5123 | if eval test -z \"\${$var+set}\"; then |
---|
5124 | relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" |
---|
5125 | elif eval var_value=\$$var; test -z "$var_value"; then |
---|
5126 | relink_command="$var=; export $var; $relink_command" |
---|
5127 | else |
---|
5128 | var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` |
---|
5129 | relink_command="$var=\"$var_value\"; export $var; $relink_command" |
---|
5130 | fi |
---|
5131 | done |
---|
5132 | # Quote the link command for shipping. |
---|
5133 | relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" |
---|
5134 | relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` |
---|
5135 | if test "$hardcode_automatic" = yes ; then |
---|
5136 | relink_command= |
---|
5137 | fi |
---|
5138 | |
---|
5139 | |
---|
5140 | # Only create the output if not a dry run. |
---|
5141 | if test -z "$run"; then |
---|
5142 | for installed in no yes; do |
---|
5143 | if test "$installed" = yes; then |
---|
5144 | if test -z "$install_libdir"; then |
---|
5145 | break |
---|
5146 | fi |
---|
5147 | output="$output_objdir/$outputname"i |
---|
5148 | # Replace all uninstalled libtool libraries with the installed ones |
---|
5149 | newdependency_libs= |
---|
5150 | for deplib in $dependency_libs; do |
---|
5151 | case $deplib in |
---|
5152 | *.la) |
---|
5153 | name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` |
---|
5154 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
---|
5155 | if test -z "$libdir"; then |
---|
5156 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 |
---|
5157 | exit $EXIT_FAILURE |
---|
5158 | fi |
---|
5159 | newdependency_libs="$newdependency_libs $libdir/$name" |
---|
5160 | ;; |
---|
5161 | *) newdependency_libs="$newdependency_libs $deplib" ;; |
---|
5162 | esac |
---|
5163 | done |
---|
5164 | dependency_libs="$newdependency_libs" |
---|
5165 | newdlfiles= |
---|
5166 | for lib in $dlfiles; do |
---|
5167 | name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` |
---|
5168 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
---|
5169 | if test -z "$libdir"; then |
---|
5170 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
---|
5171 | exit $EXIT_FAILURE |
---|
5172 | fi |
---|
5173 | newdlfiles="$newdlfiles $libdir/$name" |
---|
5174 | done |
---|
5175 | dlfiles="$newdlfiles" |
---|
5176 | newdlprefiles= |
---|
5177 | for lib in $dlprefiles; do |
---|
5178 | name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` |
---|
5179 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
---|
5180 | if test -z "$libdir"; then |
---|
5181 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
---|
5182 | exit $EXIT_FAILURE |
---|
5183 | fi |
---|
5184 | newdlprefiles="$newdlprefiles $libdir/$name" |
---|
5185 | done |
---|
5186 | dlprefiles="$newdlprefiles" |
---|
5187 | else |
---|
5188 | newdlfiles= |
---|
5189 | for lib in $dlfiles; do |
---|
5190 | case $lib in |
---|
5191 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; |
---|
5192 | *) abs=`pwd`"/$lib" ;; |
---|
5193 | esac |
---|
5194 | newdlfiles="$newdlfiles $abs" |
---|
5195 | done |
---|
5196 | dlfiles="$newdlfiles" |
---|
5197 | newdlprefiles= |
---|
5198 | for lib in $dlprefiles; do |
---|
5199 | case $lib in |
---|
5200 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; |
---|
5201 | *) abs=`pwd`"/$lib" ;; |
---|
5202 | esac |
---|
5203 | newdlprefiles="$newdlprefiles $abs" |
---|
5204 | done |
---|
5205 | dlprefiles="$newdlprefiles" |
---|
5206 | fi |
---|
5207 | $rm $output |
---|
5208 | # place dlname in correct position for cygwin |
---|
5209 | tdlname=$dlname |
---|
5210 | case $host,$output,$installed,$module,$dlname in |
---|
5211 | *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; |
---|
5212 | esac |
---|
5213 | $echo > $output "\ |
---|
5214 | # $outputname - a libtool library file |
---|
5215 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
---|
5216 | # |
---|
5217 | # Please DO NOT delete this file! |
---|
5218 | # It is necessary for linking the library. |
---|
5219 | |
---|
5220 | # The name that we can dlopen(3). |
---|
5221 | dlname='$tdlname' |
---|
5222 | |
---|
5223 | # Names of this library. |
---|
5224 | library_names='$library_names' |
---|
5225 | |
---|
5226 | # The name of the static archive. |
---|
5227 | old_library='$old_library' |
---|
5228 | |
---|
5229 | # Libraries that this one depends upon. |
---|
5230 | dependency_libs='$dependency_libs' |
---|
5231 | |
---|
5232 | # Version information for $libname. |
---|
5233 | current=$current |
---|
5234 | age=$age |
---|
5235 | revision=$revision |
---|
5236 | |
---|
5237 | # Is this an already installed library? |
---|
5238 | installed=$installed |
---|
5239 | |
---|
5240 | # Should we warn about portability when linking against -modules? |
---|
5241 | shouldnotlink=$module |
---|
5242 | |
---|
5243 | # Files to dlopen/dlpreopen |
---|
5244 | dlopen='$dlfiles' |
---|
5245 | dlpreopen='$dlprefiles' |
---|
5246 | |
---|
5247 | # Directory that this library needs to be installed in: |
---|
5248 | libdir='$install_libdir'" |
---|
5249 | if test "$installed" = no && test "$need_relink" = yes; then |
---|
5250 | $echo >> $output "\ |
---|
5251 | relink_command=\"$relink_command\"" |
---|
5252 | fi |
---|
5253 | done |
---|
5254 | fi |
---|
5255 | |
---|
5256 | # Do a symbolic link so that the libtool archive can be found in |
---|
5257 | # LD_LIBRARY_PATH before the program is installed. |
---|
5258 | $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" |
---|
5259 | $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? |
---|
5260 | ;; |
---|
5261 | esac |
---|
5262 | exit $EXIT_SUCCESS |
---|
5263 | ;; |
---|
5264 | |
---|
5265 | # libtool install mode |
---|
5266 | install) |
---|
5267 | modename="$modename: install" |
---|
5268 | |
---|
5269 | # There may be an optional sh(1) argument at the beginning of |
---|
5270 | # install_prog (especially on Windows NT). |
---|
5271 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || |
---|
5272 | # Allow the use of GNU shtool's install command. |
---|
5273 | $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then |
---|
5274 | # Aesthetically quote it. |
---|
5275 | arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` |
---|
5276 | case $arg in |
---|
5277 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) |
---|
5278 | arg="\"$arg\"" |
---|
5279 | ;; |
---|
5280 | esac |
---|
5281 | install_prog="$arg " |
---|
5282 | arg="$1" |
---|
5283 | shift |
---|
5284 | else |
---|
5285 | install_prog= |
---|
5286 | arg="$nonopt" |
---|
5287 | fi |
---|
5288 | |
---|
5289 | # The real first argument should be the name of the installation program. |
---|
5290 | # Aesthetically quote it. |
---|
5291 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
---|
5292 | case $arg in |
---|
5293 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) |
---|
5294 | arg="\"$arg\"" |
---|
5295 | ;; |
---|
5296 | esac |
---|
5297 | install_prog="$install_prog$arg" |
---|
5298 | |
---|
5299 | # We need to accept at least all the BSD install flags. |
---|
5300 | dest= |
---|
5301 | files= |
---|
5302 | opts= |
---|
5303 | prev= |
---|
5304 | install_type= |
---|
5305 | isdir=no |
---|
5306 | stripme= |
---|
5307 | for arg |
---|
5308 | do |
---|
5309 | if test -n "$dest"; then |
---|
5310 | files="$files $dest" |
---|
5311 | dest="$arg" |
---|
5312 | continue |
---|
5313 | fi |
---|
5314 | |
---|
5315 | case $arg in |
---|
5316 | -d) isdir=yes ;; |
---|
5317 | -f) prev="-f" ;; |
---|
5318 | -g) prev="-g" ;; |
---|
5319 | -m) prev="-m" ;; |
---|
5320 | -o) prev="-o" ;; |
---|
5321 | -s) |
---|
5322 | stripme=" -s" |
---|
5323 | continue |
---|
5324 | ;; |
---|
5325 | -*) ;; |
---|
5326 | |
---|
5327 | *) |
---|
5328 | # If the previous option needed an argument, then skip it. |
---|
5329 | if test -n "$prev"; then |
---|
5330 | prev= |
---|
5331 | else |
---|
5332 | dest="$arg" |
---|
5333 | continue |
---|
5334 | fi |
---|
5335 | ;; |
---|
5336 | esac |
---|
5337 | |
---|
5338 | # Aesthetically quote the argument. |
---|
5339 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
---|
5340 | case $arg in |
---|
5341 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) |
---|
5342 | arg="\"$arg\"" |
---|
5343 | ;; |
---|
5344 | esac |
---|
5345 | install_prog="$install_prog $arg" |
---|
5346 | done |
---|
5347 | |
---|
5348 | if test -z "$install_prog"; then |
---|
5349 | $echo "$modename: you must specify an install program" 1>&2 |
---|
5350 | $echo "$help" 1>&2 |
---|
5351 | exit $EXIT_FAILURE |
---|
5352 | fi |
---|
5353 | |
---|
5354 | if test -n "$prev"; then |
---|
5355 | $echo "$modename: the \`$prev' option requires an argument" 1>&2 |
---|
5356 | $echo "$help" 1>&2 |
---|
5357 | exit $EXIT_FAILURE |
---|
5358 | fi |
---|
5359 | |
---|
5360 | if test -z "$files"; then |
---|
5361 | if test -z "$dest"; then |
---|
5362 | $echo "$modename: no file or destination specified" 1>&2 |
---|
5363 | else |
---|
5364 | $echo "$modename: you must specify a destination" 1>&2 |
---|
5365 | fi |
---|
5366 | $echo "$help" 1>&2 |
---|
5367 | exit $EXIT_FAILURE |
---|
5368 | fi |
---|
5369 | |
---|
5370 | # Strip any trailing slash from the destination. |
---|
5371 | dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` |
---|
5372 | |
---|
5373 | # Check to see that the destination is a directory. |
---|
5374 | test -d "$dest" && isdir=yes |
---|
5375 | if test "$isdir" = yes; then |
---|
5376 | destdir="$dest" |
---|
5377 | destname= |
---|
5378 | else |
---|
5379 | destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` |
---|
5380 | test "X$destdir" = "X$dest" && destdir=. |
---|
5381 | destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` |
---|
5382 | |
---|
5383 | # Not a directory, so check to see that there is only one file specified. |
---|
5384 | set dummy $files |
---|
5385 | if test "$#" -gt 2; then |
---|
5386 | $echo "$modename: \`$dest' is not a directory" 1>&2 |
---|
5387 | $echo "$help" 1>&2 |
---|
5388 | exit $EXIT_FAILURE |
---|
5389 | fi |
---|
5390 | fi |
---|
5391 | case $destdir in |
---|
5392 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
---|
5393 | *) |
---|
5394 | for file in $files; do |
---|
5395 | case $file in |
---|
5396 | *.lo) ;; |
---|
5397 | *) |
---|
5398 | $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 |
---|
5399 | $echo "$help" 1>&2 |
---|
5400 | exit $EXIT_FAILURE |
---|
5401 | ;; |
---|
5402 | esac |
---|
5403 | done |
---|
5404 | ;; |
---|
5405 | esac |
---|
5406 | |
---|
5407 | # This variable tells wrapper scripts just to set variables rather |
---|
5408 | # than running their programs. |
---|
5409 | libtool_install_magic="$magic" |
---|
5410 | |
---|
5411 | staticlibs= |
---|
5412 | future_libdirs= |
---|
5413 | current_libdirs= |
---|
5414 | for file in $files; do |
---|
5415 | |
---|
5416 | # Do each installation. |
---|
5417 | case $file in |
---|
5418 | *.$libext) |
---|
5419 | # Do the static libraries later. |
---|
5420 | staticlibs="$staticlibs $file" |
---|
5421 | ;; |
---|
5422 | |
---|
5423 | *.la) |
---|
5424 | # Check to see that this really is a libtool archive. |
---|
5425 | if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
---|
5426 | else |
---|
5427 | $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 |
---|
5428 | $echo "$help" 1>&2 |
---|
5429 | exit $EXIT_FAILURE |
---|
5430 | fi |
---|
5431 | |
---|
5432 | library_names= |
---|
5433 | old_library= |
---|
5434 | relink_command= |
---|
5435 | # If there is no directory component, then add one. |
---|
5436 | case $file in |
---|
5437 | */* | *\\*) . $file ;; |
---|
5438 | *) . ./$file ;; |
---|
5439 | esac |
---|
5440 | |
---|
5441 | # Add the libdir to current_libdirs if it is the destination. |
---|
5442 | if test "X$destdir" = "X$libdir"; then |
---|
5443 | case "$current_libdirs " in |
---|
5444 | *" $libdir "*) ;; |
---|
5445 | *) current_libdirs="$current_libdirs $libdir" ;; |
---|
5446 | esac |
---|
5447 | else |
---|
5448 | # Note the libdir as a future libdir. |
---|
5449 | case "$future_libdirs " in |
---|
5450 | *" $libdir "*) ;; |
---|
5451 | *) future_libdirs="$future_libdirs $libdir" ;; |
---|
5452 | esac |
---|
5453 | fi |
---|
5454 | |
---|
5455 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ |
---|
5456 | test "X$dir" = "X$file/" && dir= |
---|
5457 | dir="$dir$objdir" |
---|
5458 | |
---|
5459 | if test -n "$relink_command"; then |
---|
5460 | # Determine the prefix the user has applied to our future dir. |
---|
5461 | inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` |
---|
5462 | |
---|
5463 | # Don't allow the user to place us outside of our expected |
---|
5464 | # location b/c this prevents finding dependent libraries that |
---|
5465 | # are installed to the same prefix. |
---|
5466 | # At present, this check doesn't affect windows .dll's that |
---|
5467 | # are installed into $libdir/../bin (currently, that works fine) |
---|
5468 | # but it's something to keep an eye on. |
---|
5469 | if test "$inst_prefix_dir" = "$destdir"; then |
---|
5470 | $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 |
---|
5471 | exit $EXIT_FAILURE |
---|
5472 | fi |
---|
5473 | |
---|
5474 | if test -n "$inst_prefix_dir"; then |
---|
5475 | # Stick the inst_prefix_dir data into the link command. |
---|
5476 | relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` |
---|
5477 | else |
---|
5478 | relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` |
---|
5479 | fi |
---|
5480 | |
---|
5481 | $echo "$modename: warning: relinking \`$file'" 1>&2 |
---|
5482 | $show "$relink_command" |
---|
5483 | if $run eval "$relink_command"; then : |
---|
5484 | else |
---|
5485 | $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 |
---|
5486 | exit $EXIT_FAILURE |
---|
5487 | fi |
---|
5488 | fi |
---|
5489 | |
---|
5490 | # See the names of the shared library. |
---|
5491 | set dummy $library_names |
---|
5492 | if test -n "$2"; then |
---|
5493 | realname="$2" |
---|
5494 | shift |
---|
5495 | shift |
---|
5496 | |
---|
5497 | srcname="$realname" |
---|
5498 | test -n "$relink_command" && srcname="$realname"T |
---|
5499 | |
---|
5500 | # Install the shared library and build the symlinks. |
---|
5501 | $show "$install_prog $dir/$srcname $destdir/$realname" |
---|
5502 | $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? |
---|
5503 | if test -n "$stripme" && test -n "$striplib"; then |
---|
5504 | $show "$striplib $destdir/$realname" |
---|
5505 | $run eval "$striplib $destdir/$realname" || exit $? |
---|
5506 | fi |
---|
5507 | |
---|
5508 | if test "$#" -gt 0; then |
---|
5509 | # Delete the old symlinks, and create new ones. |
---|
5510 | for linkname |
---|
5511 | do |
---|
5512 | if test "$linkname" != "$realname"; then |
---|
5513 | $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" |
---|
5514 | $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" |
---|
5515 | fi |
---|
5516 | done |
---|
5517 | fi |
---|
5518 | |
---|
5519 | # Do each command in the postinstall commands. |
---|
5520 | lib="$destdir/$realname" |
---|
5521 | cmds=$postinstall_cmds |
---|
5522 | save_ifs="$IFS"; IFS='~' |
---|
5523 | for cmd in $cmds; do |
---|
5524 | IFS="$save_ifs" |
---|
5525 | eval cmd=\"$cmd\" |
---|
5526 | $show "$cmd" |
---|
5527 | $run eval "$cmd" || exit $? |
---|
5528 | done |
---|
5529 | IFS="$save_ifs" |
---|
5530 | fi |
---|
5531 | |
---|
5532 | # Install the pseudo-library for information purposes. |
---|
5533 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
---|
5534 | instname="$dir/$name"i |
---|
5535 | $show "$install_prog $instname $destdir/$name" |
---|
5536 | $run eval "$install_prog $instname $destdir/$name" || exit $? |
---|
5537 | |
---|
5538 | # Maybe install the static library, too. |
---|
5539 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" |
---|
5540 | ;; |
---|
5541 | |
---|
5542 | *.lo) |
---|
5543 | # Install (i.e. copy) a libtool object. |
---|
5544 | |
---|
5545 | # Figure out destination file name, if it wasn't already specified. |
---|
5546 | if test -n "$destname"; then |
---|
5547 | destfile="$destdir/$destname" |
---|
5548 | else |
---|
5549 | destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
---|
5550 | destfile="$destdir/$destfile" |
---|
5551 | fi |
---|
5552 | |
---|
5553 | # Deduce the name of the destination old-style object file. |
---|
5554 | case $destfile in |
---|
5555 | *.lo) |
---|
5556 | staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` |
---|
5557 | ;; |
---|
5558 | *.$objext) |
---|
5559 | staticdest="$destfile" |
---|
5560 | destfile= |
---|
5561 | ;; |
---|
5562 | *) |
---|
5563 | $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 |
---|
5564 | $echo "$help" 1>&2 |
---|
5565 | exit $EXIT_FAILURE |
---|
5566 | ;; |
---|
5567 | esac |
---|
5568 | |
---|
5569 | # Install the libtool object if requested. |
---|
5570 | if test -n "$destfile"; then |
---|
5571 | $show "$install_prog $file $destfile" |
---|
5572 | $run eval "$install_prog $file $destfile" || exit $? |
---|
5573 | fi |
---|
5574 | |
---|
5575 | # Install the old object if enabled. |
---|
5576 | if test "$build_old_libs" = yes; then |
---|
5577 | # Deduce the name of the old-style object file. |
---|
5578 | staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` |
---|
5579 | |
---|
5580 | $show "$install_prog $staticobj $staticdest" |
---|
5581 | $run eval "$install_prog \$staticobj \$staticdest" || exit $? |
---|
5582 | fi |
---|
5583 | exit $EXIT_SUCCESS |
---|
5584 | ;; |
---|
5585 | |
---|
5586 | *) |
---|
5587 | # Figure out destination file name, if it wasn't already specified. |
---|
5588 | if test -n "$destname"; then |
---|
5589 | destfile="$destdir/$destname" |
---|
5590 | else |
---|
5591 | destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
---|
5592 | destfile="$destdir/$destfile" |
---|
5593 | fi |
---|
5594 | |
---|
5595 | # If the file is missing, and there is a .exe on the end, strip it |
---|
5596 | # because it is most likely a libtool script we actually want to |
---|
5597 | # install |
---|
5598 | stripped_ext="" |
---|
5599 | case $file in |
---|
5600 | *.exe) |
---|
5601 | if test ! -f "$file"; then |
---|
5602 | file=`$echo $file|${SED} 's,.exe$,,'` |
---|
5603 | stripped_ext=".exe" |
---|
5604 | fi |
---|
5605 | ;; |
---|
5606 | esac |
---|
5607 | |
---|
5608 | # Do a test to see if this is really a libtool program. |
---|
5609 | case $host in |
---|
5610 | *cygwin*|*mingw*) |
---|
5611 | wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` |
---|
5612 | ;; |
---|
5613 | *) |
---|
5614 | wrapper=$file |
---|
5615 | ;; |
---|
5616 | esac |
---|
5617 | if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then |
---|
5618 | notinst_deplibs= |
---|
5619 | relink_command= |
---|
5620 | |
---|
5621 | # To insure that "foo" is sourced, and not "foo.exe", |
---|
5622 | # finese the cygwin/MSYS system by explicitly sourcing "foo." |
---|
5623 | # which disallows the automatic-append-.exe behavior. |
---|
5624 | case $build in |
---|
5625 | *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; |
---|
5626 | *) wrapperdot=${wrapper} ;; |
---|
5627 | esac |
---|
5628 | # If there is no directory component, then add one. |
---|
5629 | case $file in |
---|
5630 | */* | *\\*) . ${wrapperdot} ;; |
---|
5631 | *) . ./${wrapperdot} ;; |
---|
5632 | esac |
---|
5633 | |
---|
5634 | # Check the variables that should have been set. |
---|
5635 | if test -z "$notinst_deplibs"; then |
---|
5636 | $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 |
---|
5637 | exit $EXIT_FAILURE |
---|
5638 | fi |
---|
5639 | |
---|
5640 | finalize=yes |
---|
5641 | for lib in $notinst_deplibs; do |
---|
5642 | # Check to see that each library is installed. |
---|
5643 | libdir= |
---|
5644 | if test -f "$lib"; then |
---|
5645 | # If there is no directory component, then add one. |
---|
5646 | case $lib in |
---|
5647 | */* | *\\*) . $lib ;; |
---|
5648 | *) . ./$lib ;; |
---|
5649 | esac |
---|
5650 | fi |
---|
5651 | libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test |
---|
5652 | if test -n "$libdir" && test ! -f "$libfile"; then |
---|
5653 | $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 |
---|
5654 | finalize=no |
---|
5655 | fi |
---|
5656 | done |
---|
5657 | |
---|
5658 | relink_command= |
---|
5659 | # To insure that "foo" is sourced, and not "foo.exe", |
---|
5660 | # finese the cygwin/MSYS system by explicitly sourcing "foo." |
---|
5661 | # which disallows the automatic-append-.exe behavior. |
---|
5662 | case $build in |
---|
5663 | *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; |
---|
5664 | *) wrapperdot=${wrapper} ;; |
---|
5665 | esac |
---|
5666 | # If there is no directory component, then add one. |
---|
5667 | case $file in |
---|
5668 | */* | *\\*) . ${wrapperdot} ;; |
---|
5669 | *) . ./${wrapperdot} ;; |
---|
5670 | esac |
---|
5671 | |
---|
5672 | outputname= |
---|
5673 | if test "$fast_install" = no && test -n "$relink_command"; then |
---|
5674 | if test "$finalize" = yes && test -z "$run"; then |
---|
5675 | tmpdir="/tmp" |
---|
5676 | test -n "$TMPDIR" && tmpdir="$TMPDIR" |
---|
5677 | tmpdir="$tmpdir/libtool-$$" |
---|
5678 | save_umask=`umask` |
---|
5679 | umask 0077 |
---|
5680 | if $mkdir "$tmpdir"; then |
---|
5681 | umask $save_umask |
---|
5682 | else |
---|
5683 | umask $save_umask |
---|
5684 | $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 |
---|
5685 | continue |
---|
5686 | fi |
---|
5687 | file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` |
---|
5688 | outputname="$tmpdir/$file" |
---|
5689 | # Replace the output file specification. |
---|
5690 | relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` |
---|
5691 | |
---|
5692 | $show "$relink_command" |
---|
5693 | if $run eval "$relink_command"; then : |
---|
5694 | else |
---|
5695 | $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 |
---|
5696 | ${rm}r "$tmpdir" |
---|
5697 | continue |
---|
5698 | fi |
---|
5699 | file="$outputname" |
---|
5700 | else |
---|
5701 | $echo "$modename: warning: cannot relink \`$file'" 1>&2 |
---|
5702 | fi |
---|
5703 | else |
---|
5704 | # Install the binary that we compiled earlier. |
---|
5705 | file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` |
---|
5706 | fi |
---|
5707 | fi |
---|
5708 | |
---|
5709 | # remove .exe since cygwin /usr/bin/install will append another |
---|
5710 | # one anyways |
---|
5711 | case $install_prog,$host in |
---|
5712 | */usr/bin/install*,*cygwin*) |
---|
5713 | case $file:$destfile in |
---|
5714 | *.exe:*.exe) |
---|
5715 | # this is ok |
---|
5716 | ;; |
---|
5717 | *.exe:*) |
---|
5718 | destfile=$destfile.exe |
---|
5719 | ;; |
---|
5720 | *:*.exe) |
---|
5721 | destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` |
---|
5722 | ;; |
---|
5723 | esac |
---|
5724 | ;; |
---|
5725 | esac |
---|
5726 | $show "$install_prog$stripme $file $destfile" |
---|
5727 | $run eval "$install_prog\$stripme \$file \$destfile" || exit $? |
---|
5728 | test -n "$outputname" && ${rm}r "$tmpdir" |
---|
5729 | ;; |
---|
5730 | esac |
---|
5731 | done |
---|
5732 | |
---|
5733 | for file in $staticlibs; do |
---|
5734 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
---|
5735 | |
---|
5736 | # Set up the ranlib parameters. |
---|
5737 | oldlib="$destdir/$name" |
---|
5738 | |
---|
5739 | $show "$install_prog $file $oldlib" |
---|
5740 | $run eval "$install_prog \$file \$oldlib" || exit $? |
---|
5741 | |
---|
5742 | if test -n "$stripme" && test -n "$old_striplib"; then |
---|
5743 | $show "$old_striplib $oldlib" |
---|
5744 | $run eval "$old_striplib $oldlib" || exit $? |
---|
5745 | fi |
---|
5746 | |
---|
5747 | # Do each command in the postinstall commands. |
---|
5748 | cmds=$old_postinstall_cmds |
---|
5749 | save_ifs="$IFS"; IFS='~' |
---|
5750 | for cmd in $cmds; do |
---|
5751 | IFS="$save_ifs" |
---|
5752 | eval cmd=\"$cmd\" |
---|
5753 | $show "$cmd" |
---|
5754 | $run eval "$cmd" || exit $? |
---|
5755 | done |
---|
5756 | IFS="$save_ifs" |
---|
5757 | done |
---|
5758 | |
---|
5759 | if test -n "$future_libdirs"; then |
---|
5760 | $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 |
---|
5761 | fi |
---|
5762 | |
---|
5763 | if test -n "$current_libdirs"; then |
---|
5764 | # Maybe just do a dry run. |
---|
5765 | test -n "$run" && current_libdirs=" -n$current_libdirs" |
---|
5766 | exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' |
---|
5767 | else |
---|
5768 | exit $EXIT_SUCCESS |
---|
5769 | fi |
---|
5770 | ;; |
---|
5771 | |
---|
5772 | # libtool finish mode |
---|
5773 | finish) |
---|
5774 | modename="$modename: finish" |
---|
5775 | libdirs="$nonopt" |
---|
5776 | admincmds= |
---|
5777 | |
---|
5778 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
---|
5779 | for dir |
---|
5780 | do |
---|
5781 | libdirs="$libdirs $dir" |
---|
5782 | done |
---|
5783 | |
---|
5784 | for libdir in $libdirs; do |
---|
5785 | if test -n "$finish_cmds"; then |
---|
5786 | # Do each command in the finish commands. |
---|
5787 | cmds=$finish_cmds |
---|
5788 | save_ifs="$IFS"; IFS='~' |
---|
5789 | for cmd in $cmds; do |
---|
5790 | IFS="$save_ifs" |
---|
5791 | eval cmd=\"$cmd\" |
---|
5792 | $show "$cmd" |
---|
5793 | $run eval "$cmd" || admincmds="$admincmds |
---|
5794 | $cmd" |
---|
5795 | done |
---|
5796 | IFS="$save_ifs" |
---|
5797 | fi |
---|
5798 | if test -n "$finish_eval"; then |
---|
5799 | # Do the single finish_eval. |
---|
5800 | eval cmds=\"$finish_eval\" |
---|
5801 | $run eval "$cmds" || admincmds="$admincmds |
---|
5802 | $cmds" |
---|
5803 | fi |
---|
5804 | done |
---|
5805 | fi |
---|
5806 | |
---|
5807 | # Exit here if they wanted silent mode. |
---|
5808 | test "$show" = : && exit $EXIT_SUCCESS |
---|
5809 | |
---|
5810 | $echo "----------------------------------------------------------------------" |
---|
5811 | $echo "Libraries have been installed in:" |
---|
5812 | for libdir in $libdirs; do |
---|
5813 | $echo " $libdir" |
---|
5814 | done |
---|
5815 | $echo |
---|
5816 | $echo "If you ever happen to want to link against installed libraries" |
---|
5817 | $echo "in a given directory, LIBDIR, you must either use libtool, and" |
---|
5818 | $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" |
---|
5819 | $echo "flag during linking and do at least one of the following:" |
---|
5820 | if test -n "$shlibpath_var"; then |
---|
5821 | $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" |
---|
5822 | $echo " during execution" |
---|
5823 | fi |
---|
5824 | if test -n "$runpath_var"; then |
---|
5825 | $echo " - add LIBDIR to the \`$runpath_var' environment variable" |
---|
5826 | $echo " during linking" |
---|
5827 | fi |
---|
5828 | if test -n "$hardcode_libdir_flag_spec"; then |
---|
5829 | libdir=LIBDIR |
---|
5830 | eval flag=\"$hardcode_libdir_flag_spec\" |
---|
5831 | |
---|
5832 | $echo " - use the \`$flag' linker flag" |
---|
5833 | fi |
---|
5834 | if test -n "$admincmds"; then |
---|
5835 | $echo " - have your system administrator run these commands:$admincmds" |
---|
5836 | fi |
---|
5837 | if test -f /etc/ld.so.conf; then |
---|
5838 | $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" |
---|
5839 | fi |
---|
5840 | $echo |
---|
5841 | $echo "See any operating system documentation about shared libraries for" |
---|
5842 | $echo "more information, such as the ld(1) and ld.so(8) manual pages." |
---|
5843 | $echo "----------------------------------------------------------------------" |
---|
5844 | exit $EXIT_SUCCESS |
---|
5845 | ;; |
---|
5846 | |
---|
5847 | # libtool execute mode |
---|
5848 | execute) |
---|
5849 | modename="$modename: execute" |
---|
5850 | |
---|
5851 | # The first argument is the command name. |
---|
5852 | cmd="$nonopt" |
---|
5853 | if test -z "$cmd"; then |
---|
5854 | $echo "$modename: you must specify a COMMAND" 1>&2 |
---|
5855 | $echo "$help" |
---|
5856 | exit $EXIT_FAILURE |
---|
5857 | fi |
---|
5858 | |
---|
5859 | # Handle -dlopen flags immediately. |
---|
5860 | for file in $execute_dlfiles; do |
---|
5861 | if test ! -f "$file"; then |
---|
5862 | $echo "$modename: \`$file' is not a file" 1>&2 |
---|
5863 | $echo "$help" 1>&2 |
---|
5864 | exit $EXIT_FAILURE |
---|
5865 | fi |
---|
5866 | |
---|
5867 | dir= |
---|
5868 | case $file in |
---|
5869 | *.la) |
---|
5870 | # Check to see that this really is a libtool archive. |
---|
5871 | if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
---|
5872 | else |
---|
5873 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
---|
5874 | $echo "$help" 1>&2 |
---|
5875 | exit $EXIT_FAILURE |
---|
5876 | fi |
---|
5877 | |
---|
5878 | # Read the libtool library. |
---|
5879 | dlname= |
---|
5880 | library_names= |
---|
5881 | |
---|
5882 | # If there is no directory component, then add one. |
---|
5883 | case $file in |
---|
5884 | */* | *\\*) . $file ;; |
---|
5885 | *) . ./$file ;; |
---|
5886 | esac |
---|
5887 | |
---|
5888 | # Skip this library if it cannot be dlopened. |
---|
5889 | if test -z "$dlname"; then |
---|
5890 | # Warn if it was a shared library. |
---|
5891 | test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" |
---|
5892 | continue |
---|
5893 | fi |
---|
5894 | |
---|
5895 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` |
---|
5896 | test "X$dir" = "X$file" && dir=. |
---|
5897 | |
---|
5898 | if test -f "$dir/$objdir/$dlname"; then |
---|
5899 | dir="$dir/$objdir" |
---|
5900 | else |
---|
5901 | $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 |
---|
5902 | exit $EXIT_FAILURE |
---|
5903 | fi |
---|
5904 | ;; |
---|
5905 | |
---|
5906 | *.lo) |
---|
5907 | # Just add the directory containing the .lo file. |
---|
5908 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` |
---|
5909 | test "X$dir" = "X$file" && dir=. |
---|
5910 | ;; |
---|
5911 | |
---|
5912 | *) |
---|
5913 | $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 |
---|
5914 | continue |
---|
5915 | ;; |
---|
5916 | esac |
---|
5917 | |
---|
5918 | # Get the absolute pathname. |
---|
5919 | absdir=`cd "$dir" && pwd` |
---|
5920 | test -n "$absdir" && dir="$absdir" |
---|
5921 | |
---|
5922 | # Now add the directory to shlibpath_var. |
---|
5923 | if eval "test -z \"\$$shlibpath_var\""; then |
---|
5924 | eval "$shlibpath_var=\"\$dir\"" |
---|
5925 | else |
---|
5926 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" |
---|
5927 | fi |
---|
5928 | done |
---|
5929 | |
---|
5930 | # This variable tells wrapper scripts just to set shlibpath_var |
---|
5931 | # rather than running their programs. |
---|
5932 | libtool_execute_magic="$magic" |
---|
5933 | |
---|
5934 | # Check if any of the arguments is a wrapper script. |
---|
5935 | args= |
---|
5936 | for file |
---|
5937 | do |
---|
5938 | case $file in |
---|
5939 | -*) ;; |
---|
5940 | *) |
---|
5941 | # Do a test to see if this is really a libtool program. |
---|
5942 | if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
5943 | # If there is no directory component, then add one. |
---|
5944 | case $file in |
---|
5945 | */* | *\\*) . $file ;; |
---|
5946 | *) . ./$file ;; |
---|
5947 | esac |
---|
5948 | |
---|
5949 | # Transform arg to wrapped name. |
---|
5950 | file="$progdir/$program" |
---|
5951 | fi |
---|
5952 | ;; |
---|
5953 | esac |
---|
5954 | # Quote arguments (to preserve shell metacharacters). |
---|
5955 | file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` |
---|
5956 | args="$args \"$file\"" |
---|
5957 | done |
---|
5958 | |
---|
5959 | if test -z "$run"; then |
---|
5960 | if test -n "$shlibpath_var"; then |
---|
5961 | # Export the shlibpath_var. |
---|
5962 | eval "export $shlibpath_var" |
---|
5963 | fi |
---|
5964 | |
---|
5965 | # Restore saved environment variables |
---|
5966 | if test "${save_LC_ALL+set}" = set; then |
---|
5967 | LC_ALL="$save_LC_ALL"; export LC_ALL |
---|
5968 | fi |
---|
5969 | if test "${save_LANG+set}" = set; then |
---|
5970 | LANG="$save_LANG"; export LANG |
---|
5971 | fi |
---|
5972 | |
---|
5973 | # Now prepare to actually exec the command. |
---|
5974 | exec_cmd="\$cmd$args" |
---|
5975 | else |
---|
5976 | # Display what would be done. |
---|
5977 | if test -n "$shlibpath_var"; then |
---|
5978 | eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" |
---|
5979 | $echo "export $shlibpath_var" |
---|
5980 | fi |
---|
5981 | $echo "$cmd$args" |
---|
5982 | exit $EXIT_SUCCESS |
---|
5983 | fi |
---|
5984 | ;; |
---|
5985 | |
---|
5986 | # libtool clean and uninstall mode |
---|
5987 | clean | uninstall) |
---|
5988 | modename="$modename: $mode" |
---|
5989 | rm="$nonopt" |
---|
5990 | files= |
---|
5991 | rmforce= |
---|
5992 | exit_status=0 |
---|
5993 | |
---|
5994 | # This variable tells wrapper scripts just to set variables rather |
---|
5995 | # than running their programs. |
---|
5996 | libtool_install_magic="$magic" |
---|
5997 | |
---|
5998 | for arg |
---|
5999 | do |
---|
6000 | case $arg in |
---|
6001 | -f) rm="$rm $arg"; rmforce=yes ;; |
---|
6002 | -*) rm="$rm $arg" ;; |
---|
6003 | *) files="$files $arg" ;; |
---|
6004 | esac |
---|
6005 | done |
---|
6006 | |
---|
6007 | if test -z "$rm"; then |
---|
6008 | $echo "$modename: you must specify an RM program" 1>&2 |
---|
6009 | $echo "$help" 1>&2 |
---|
6010 | exit $EXIT_FAILURE |
---|
6011 | fi |
---|
6012 | |
---|
6013 | rmdirs= |
---|
6014 | |
---|
6015 | origobjdir="$objdir" |
---|
6016 | for file in $files; do |
---|
6017 | dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` |
---|
6018 | if test "X$dir" = "X$file"; then |
---|
6019 | dir=. |
---|
6020 | objdir="$origobjdir" |
---|
6021 | else |
---|
6022 | objdir="$dir/$origobjdir" |
---|
6023 | fi |
---|
6024 | name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` |
---|
6025 | test "$mode" = uninstall && objdir="$dir" |
---|
6026 | |
---|
6027 | # Remember objdir for removal later, being careful to avoid duplicates |
---|
6028 | if test "$mode" = clean; then |
---|
6029 | case " $rmdirs " in |
---|
6030 | *" $objdir "*) ;; |
---|
6031 | *) rmdirs="$rmdirs $objdir" ;; |
---|
6032 | esac |
---|
6033 | fi |
---|
6034 | |
---|
6035 | # Don't error if the file doesn't exist and rm -f was used. |
---|
6036 | if (test -L "$file") >/dev/null 2>&1 \ |
---|
6037 | || (test -h "$file") >/dev/null 2>&1 \ |
---|
6038 | || test -f "$file"; then |
---|
6039 | : |
---|
6040 | elif test -d "$file"; then |
---|
6041 | exit_status=1 |
---|
6042 | continue |
---|
6043 | elif test "$rmforce" = yes; then |
---|
6044 | continue |
---|
6045 | fi |
---|
6046 | |
---|
6047 | rmfiles="$file" |
---|
6048 | |
---|
6049 | case $name in |
---|
6050 | *.la) |
---|
6051 | # Possibly a libtool archive, so verify it. |
---|
6052 | if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
6053 | . $dir/$name |
---|
6054 | |
---|
6055 | # Delete the libtool libraries and symlinks. |
---|
6056 | for n in $library_names; do |
---|
6057 | rmfiles="$rmfiles $objdir/$n" |
---|
6058 | done |
---|
6059 | test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" |
---|
6060 | test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" |
---|
6061 | |
---|
6062 | if test "$mode" = uninstall; then |
---|
6063 | if test -n "$library_names"; then |
---|
6064 | # Do each command in the postuninstall commands. |
---|
6065 | cmds=$postuninstall_cmds |
---|
6066 | save_ifs="$IFS"; IFS='~' |
---|
6067 | for cmd in $cmds; do |
---|
6068 | IFS="$save_ifs" |
---|
6069 | eval cmd=\"$cmd\" |
---|
6070 | $show "$cmd" |
---|
6071 | $run eval "$cmd" |
---|
6072 | if test "$?" -ne 0 && test "$rmforce" != yes; then |
---|
6073 | exit_status=1 |
---|
6074 | fi |
---|
6075 | done |
---|
6076 | IFS="$save_ifs" |
---|
6077 | fi |
---|
6078 | |
---|
6079 | if test -n "$old_library"; then |
---|
6080 | # Do each command in the old_postuninstall commands. |
---|
6081 | cmds=$old_postuninstall_cmds |
---|
6082 | save_ifs="$IFS"; IFS='~' |
---|
6083 | for cmd in $cmds; do |
---|
6084 | IFS="$save_ifs" |
---|
6085 | eval cmd=\"$cmd\" |
---|
6086 | $show "$cmd" |
---|
6087 | $run eval "$cmd" |
---|
6088 | if test "$?" -ne 0 && test "$rmforce" != yes; then |
---|
6089 | exit_status=1 |
---|
6090 | fi |
---|
6091 | done |
---|
6092 | IFS="$save_ifs" |
---|
6093 | fi |
---|
6094 | # FIXME: should reinstall the best remaining shared library. |
---|
6095 | fi |
---|
6096 | fi |
---|
6097 | ;; |
---|
6098 | |
---|
6099 | *.lo) |
---|
6100 | # Possibly a libtool object, so verify it. |
---|
6101 | if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
6102 | |
---|
6103 | # Read the .lo file |
---|
6104 | . $dir/$name |
---|
6105 | |
---|
6106 | # Add PIC object to the list of files to remove. |
---|
6107 | if test -n "$pic_object" \ |
---|
6108 | && test "$pic_object" != none; then |
---|
6109 | rmfiles="$rmfiles $dir/$pic_object" |
---|
6110 | fi |
---|
6111 | |
---|
6112 | # Add non-PIC object to the list of files to remove. |
---|
6113 | if test -n "$non_pic_object" \ |
---|
6114 | && test "$non_pic_object" != none; then |
---|
6115 | rmfiles="$rmfiles $dir/$non_pic_object" |
---|
6116 | fi |
---|
6117 | fi |
---|
6118 | ;; |
---|
6119 | |
---|
6120 | *) |
---|
6121 | if test "$mode" = clean ; then |
---|
6122 | noexename=$name |
---|
6123 | case $file in |
---|
6124 | *.exe) |
---|
6125 | file=`$echo $file|${SED} 's,.exe$,,'` |
---|
6126 | noexename=`$echo $name|${SED} 's,.exe$,,'` |
---|
6127 | # $file with .exe has already been added to rmfiles, |
---|
6128 | # add $file without .exe |
---|
6129 | rmfiles="$rmfiles $file" |
---|
6130 | ;; |
---|
6131 | esac |
---|
6132 | # Do a test to see if this is a libtool program. |
---|
6133 | if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
---|
6134 | relink_command= |
---|
6135 | . $dir/$noexename |
---|
6136 | |
---|
6137 | # note $name still contains .exe if it was in $file originally |
---|
6138 | # as does the version of $file that was added into $rmfiles |
---|
6139 | rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" |
---|
6140 | if test "$fast_install" = yes && test -n "$relink_command"; then |
---|
6141 | rmfiles="$rmfiles $objdir/lt-$name" |
---|
6142 | fi |
---|
6143 | if test "X$noexename" != "X$name" ; then |
---|
6144 | rmfiles="$rmfiles $objdir/lt-${noexename}.c" |
---|
6145 | fi |
---|
6146 | fi |
---|
6147 | fi |
---|
6148 | ;; |
---|
6149 | esac |
---|
6150 | $show "$rm $rmfiles" |
---|
6151 | $run $rm $rmfiles || exit_status=1 |
---|
6152 | done |
---|
6153 | objdir="$origobjdir" |
---|
6154 | |
---|
6155 | # Try to remove the ${objdir}s in the directories where we deleted files |
---|
6156 | for dir in $rmdirs; do |
---|
6157 | if test -d "$dir"; then |
---|
6158 | $show "rmdir $dir" |
---|
6159 | $run rmdir $dir >/dev/null 2>&1 |
---|
6160 | fi |
---|
6161 | done |
---|
6162 | |
---|
6163 | exit $exit_status |
---|
6164 | ;; |
---|
6165 | |
---|
6166 | "") |
---|
6167 | $echo "$modename: you must specify a MODE" 1>&2 |
---|
6168 | $echo "$generic_help" 1>&2 |
---|
6169 | exit $EXIT_FAILURE |
---|
6170 | ;; |
---|
6171 | esac |
---|
6172 | |
---|
6173 | if test -z "$exec_cmd"; then |
---|
6174 | $echo "$modename: invalid operation mode \`$mode'" 1>&2 |
---|
6175 | $echo "$generic_help" 1>&2 |
---|
6176 | exit $EXIT_FAILURE |
---|
6177 | fi |
---|
6178 | fi # test -z "$show_help" |
---|
6179 | |
---|
6180 | if test -n "$exec_cmd"; then |
---|
6181 | eval exec $exec_cmd |
---|
6182 | exit $EXIT_FAILURE |
---|
6183 | fi |
---|
6184 | |
---|
6185 | # We need to display help for each of the modes. |
---|
6186 | case $mode in |
---|
6187 | "") $echo \ |
---|
6188 | "Usage: $modename [OPTION]... [MODE-ARG]... |
---|
6189 | |
---|
6190 | Provide generalized library-building support services. |
---|
6191 | |
---|
6192 | --config show all configuration variables |
---|
6193 | --debug enable verbose shell tracing |
---|
6194 | -n, --dry-run display commands without modifying any files |
---|
6195 | --features display basic configuration information and exit |
---|
6196 | --finish same as \`--mode=finish' |
---|
6197 | --help display this help message and exit |
---|
6198 | --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] |
---|
6199 | --quiet same as \`--silent' |
---|
6200 | --silent don't print informational messages |
---|
6201 | --tag=TAG use configuration variables from tag TAG |
---|
6202 | --version print version information |
---|
6203 | |
---|
6204 | MODE must be one of the following: |
---|
6205 | |
---|
6206 | clean remove files from the build directory |
---|
6207 | compile compile a source file into a libtool object |
---|
6208 | execute automatically set library path, then run a program |
---|
6209 | finish complete the installation of libtool libraries |
---|
6210 | install install libraries or executables |
---|
6211 | link create a library or an executable |
---|
6212 | uninstall remove libraries from an installed directory |
---|
6213 | |
---|
6214 | MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for |
---|
6215 | a more detailed description of MODE. |
---|
6216 | |
---|
6217 | Report bugs to <bug-libtool@gnu.org>." |
---|
6218 | exit $EXIT_SUCCESS |
---|
6219 | ;; |
---|
6220 | |
---|
6221 | clean) |
---|
6222 | $echo \ |
---|
6223 | "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... |
---|
6224 | |
---|
6225 | Remove files from the build directory. |
---|
6226 | |
---|
6227 | RM is the name of the program to use to delete files associated with each FILE |
---|
6228 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
---|
6229 | to RM. |
---|
6230 | |
---|
6231 | If FILE is a libtool library, object or program, all the files associated |
---|
6232 | with it are deleted. Otherwise, only FILE itself is deleted using RM." |
---|
6233 | ;; |
---|
6234 | |
---|
6235 | compile) |
---|
6236 | $echo \ |
---|
6237 | "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE |
---|
6238 | |
---|
6239 | Compile a source file into a libtool library object. |
---|
6240 | |
---|
6241 | This mode accepts the following additional options: |
---|
6242 | |
---|
6243 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE |
---|
6244 | -prefer-pic try to building PIC objects only |
---|
6245 | -prefer-non-pic try to building non-PIC objects only |
---|
6246 | -static always build a \`.o' file suitable for static linking |
---|
6247 | |
---|
6248 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file |
---|
6249 | from the given SOURCEFILE. |
---|
6250 | |
---|
6251 | The output file name is determined by removing the directory component from |
---|
6252 | SOURCEFILE, then substituting the C source code suffix \`.c' with the |
---|
6253 | library object suffix, \`.lo'." |
---|
6254 | ;; |
---|
6255 | |
---|
6256 | execute) |
---|
6257 | $echo \ |
---|
6258 | "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... |
---|
6259 | |
---|
6260 | Automatically set library path, then run a program. |
---|
6261 | |
---|
6262 | This mode accepts the following additional options: |
---|
6263 | |
---|
6264 | -dlopen FILE add the directory containing FILE to the library path |
---|
6265 | |
---|
6266 | This mode sets the library path environment variable according to \`-dlopen' |
---|
6267 | flags. |
---|
6268 | |
---|
6269 | If any of the ARGS are libtool executable wrappers, then they are translated |
---|
6270 | into their corresponding uninstalled binary, and any of their required library |
---|
6271 | directories are added to the library path. |
---|
6272 | |
---|
6273 | Then, COMMAND is executed, with ARGS as arguments." |
---|
6274 | ;; |
---|
6275 | |
---|
6276 | finish) |
---|
6277 | $echo \ |
---|
6278 | "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... |
---|
6279 | |
---|
6280 | Complete the installation of libtool libraries. |
---|
6281 | |
---|
6282 | Each LIBDIR is a directory that contains libtool libraries. |
---|
6283 | |
---|
6284 | The commands that this mode executes may require superuser privileges. Use |
---|
6285 | the \`--dry-run' option if you just want to see what would be executed." |
---|
6286 | ;; |
---|
6287 | |
---|
6288 | install) |
---|
6289 | $echo \ |
---|
6290 | "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... |
---|
6291 | |
---|
6292 | Install executables or libraries. |
---|
6293 | |
---|
6294 | INSTALL-COMMAND is the installation command. The first component should be |
---|
6295 | either the \`install' or \`cp' program. |
---|
6296 | |
---|
6297 | The rest of the components are interpreted as arguments to that command (only |
---|
6298 | BSD-compatible install options are recognized)." |
---|
6299 | ;; |
---|
6300 | |
---|
6301 | link) |
---|
6302 | $echo \ |
---|
6303 | "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... |
---|
6304 | |
---|
6305 | Link object files or libraries together to form another library, or to |
---|
6306 | create an executable program. |
---|
6307 | |
---|
6308 | LINK-COMMAND is a command using the C compiler that you would use to create |
---|
6309 | a program from several object files. |
---|
6310 | |
---|
6311 | The following components of LINK-COMMAND are treated specially: |
---|
6312 | |
---|
6313 | -all-static do not do any dynamic linking at all |
---|
6314 | -avoid-version do not add a version suffix if possible |
---|
6315 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime |
---|
6316 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols |
---|
6317 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) |
---|
6318 | -export-symbols SYMFILE |
---|
6319 | try to export only the symbols listed in SYMFILE |
---|
6320 | -export-symbols-regex REGEX |
---|
6321 | try to export only the symbols matching REGEX |
---|
6322 | -LLIBDIR search LIBDIR for required installed libraries |
---|
6323 | -lNAME OUTPUT-FILE requires the installed library libNAME |
---|
6324 | -module build a library that can dlopened |
---|
6325 | -no-fast-install disable the fast-install mode |
---|
6326 | -no-install link a not-installable executable |
---|
6327 | -no-undefined declare that a library does not refer to external symbols |
---|
6328 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects |
---|
6329 | -objectlist FILE Use a list of object files found in FILE to specify objects |
---|
6330 | -precious-files-regex REGEX |
---|
6331 | don't remove output files matching REGEX |
---|
6332 | -release RELEASE specify package release information |
---|
6333 | -rpath LIBDIR the created library will eventually be installed in LIBDIR |
---|
6334 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries |
---|
6335 | -static do not do any dynamic linking of libtool libraries |
---|
6336 | -version-info CURRENT[:REVISION[:AGE]] |
---|
6337 | specify library version info [each variable defaults to 0] |
---|
6338 | |
---|
6339 | All other options (arguments beginning with \`-') are ignored. |
---|
6340 | |
---|
6341 | Every other argument is treated as a filename. Files ending in \`.la' are |
---|
6342 | treated as uninstalled libtool libraries, other files are standard or library |
---|
6343 | object files. |
---|
6344 | |
---|
6345 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, |
---|
6346 | only library objects (\`.lo' files) may be specified, and \`-rpath' is |
---|
6347 | required, except when creating a convenience library. |
---|
6348 | |
---|
6349 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created |
---|
6350 | using \`ar' and \`ranlib', or on Windows using \`lib'. |
---|
6351 | |
---|
6352 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file |
---|
6353 | is created, otherwise an executable program is created." |
---|
6354 | ;; |
---|
6355 | |
---|
6356 | uninstall) |
---|
6357 | $echo \ |
---|
6358 | "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
---|
6359 | |
---|
6360 | Remove libraries from an installation directory. |
---|
6361 | |
---|
6362 | RM is the name of the program to use to delete files associated with each FILE |
---|
6363 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
---|
6364 | to RM. |
---|
6365 | |
---|
6366 | If FILE is a libtool library, all the files associated with it are deleted. |
---|
6367 | Otherwise, only FILE itself is deleted using RM." |
---|
6368 | ;; |
---|
6369 | |
---|
6370 | *) |
---|
6371 | $echo "$modename: invalid operation mode \`$mode'" 1>&2 |
---|
6372 | $echo "$help" 1>&2 |
---|
6373 | exit $EXIT_FAILURE |
---|
6374 | ;; |
---|
6375 | esac |
---|
6376 | |
---|
6377 | $echo |
---|
6378 | $echo "Try \`$modename --help' for more information about other modes." |
---|
6379 | |
---|
6380 | exit $EXIT_SUCCESS |
---|
6381 | |
---|
6382 | # The TAGs below are defined such that we never get into a situation |
---|
6383 | # in which we disable both kinds of libraries. Given conflicting |
---|
6384 | # choices, we go for a static library, that is the most portable, |
---|
6385 | # since we can't tell whether shared libraries were disabled because |
---|
6386 | # the user asked for that or because the platform doesn't support |
---|
6387 | # them. This is particularly important on AIX, because we don't |
---|
6388 | # support having both static and shared libraries enabled at the same |
---|
6389 | # time on that platform, so we default to a shared-only configuration. |
---|
6390 | # If a disable-shared tag is given, we'll fallback to a static-only |
---|
6391 | # configuration. But we'll never go from static-only to shared-only. |
---|
6392 | |
---|
6393 | # ### BEGIN LIBTOOL TAG CONFIG: disable-shared |
---|
6394 | build_libtool_libs=no |
---|
6395 | build_old_libs=yes |
---|
6396 | # ### END LIBTOOL TAG CONFIG: disable-shared |
---|
6397 | |
---|
6398 | # ### BEGIN LIBTOOL TAG CONFIG: disable-static |
---|
6399 | build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` |
---|
6400 | # ### END LIBTOOL TAG CONFIG: disable-static |
---|
6401 | |
---|
6402 | # Local Variables: |
---|
6403 | # mode:shell-script |
---|
6404 | # sh-indentation:2 |
---|
6405 | # End: |
---|