VirtualBox

source: vbox/trunk/src/libs/libxslt-1.1.22/ltmain.sh@ 20364

最後變更 在這個檔案從20364是 11982,由 vboxsync 提交於 16 年 前

All: license header changes for 2.0 (OSE headers, add Sun GPL/LGPL disclaimer)

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette