comparison ext/guichan-0.8.1/ltmain.sh @ 0:4a0efb7baf70

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