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