[3028] - Applied MaNGOS coding style (see trunk/bcpp.cfg).
[mangos-git.git] / ltmain.sh
blob159021d38b6a3ad7e4683104cf2db16f2f9859b2
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
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.
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.
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.
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.
27 basename="s,^.*/,,g"
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
33 # function.
34 progpath="$0"
36 # The name of this program:
37 progname=`echo "$progpath" | $SED $basename`
38 modename="$progname"
40 # Global variables:
41 EXIT_SUCCESS=0
42 EXIT_FAILURE=1
44 PROGRAM=ltmain.sh
45 PACKAGE=libtool
46 VERSION=1.5.16
47 TIMESTAMP=" (1.1220.2.235 2005/04/25 18:13:26)"
49 # See if we are running on zsh, and set the options which allow our
50 # commands through without removal of \ escapes.
51 if test -n "${ZSH_VERSION+set}" ; then
52 setopt NO_GLOB_SUBST
55 # Check that we have a working $echo.
56 if test "X$1" = X--no-reexec; then
57 # Discard the --no-reexec flag, and continue.
58 shift
59 elif test "X$1" = X--fallback-echo; then
60 # Avoid inline document here, it may be left over
62 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
63 # Yippee, $echo works!
65 else
66 # Restart under the correct shell, and then maybe $echo will work.
67 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
70 if test "X$1" = X--fallback-echo; then
71 # used as fallback echo
72 shift
73 cat <<EOF
75 EOF
76 exit $EXIT_SUCCESS
79 default_mode=
80 help="Try \`$progname --help' for more information."
81 magic="%%%MAGIC variable%%%"
82 mkdir="mkdir"
83 mv="mv -f"
84 rm="rm -f"
85 max_cmd_len=32768
87 # Sed substitution that helps us do robust quoting. It backslashifies
88 # metacharacters that are still active within double-quoted strings.
89 Xsed="${SED}"' -e 1s/^X//'
90 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
91 # test EBCDIC or ASCII
92 case `echo A|tr A '\301'` in
93 A) # EBCDIC based system
94 SP2NL="tr '\100' '\n'"
95 NL2SP="tr '\r\n' '\100\100'"
97 *) # Assume ASCII based system
98 SP2NL="tr '\040' '\012'"
99 NL2SP="tr '\015\012' '\040\040'"
101 esac
103 # NLS nuisances.
104 # Only set LANG and LC_ALL to C if already set.
105 # These must not be set unconditionally because not all systems understand
106 # e.g. LANG=C (notably SCO).
107 # We save the old values to restore during execute mode.
108 if test "${LC_ALL+set}" = set; then
109 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
111 if test "${LANG+set}" = set; then
112 save_LANG="$LANG"; LANG=C; export LANG
115 # Make sure IFS has a sensible default
116 lt_nl='
118 IFS=" $lt_nl"
120 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
121 $echo "$modename: not configured to build any kind of library" 1>&2
122 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
123 exit $EXIT_FAILURE
126 # Global variables.
127 mode=$default_mode
128 nonopt=
129 prev=
130 prevopt=
131 run=
132 show="$echo"
133 show_help=
134 execute_dlfiles=
135 lo2o="s/\\.lo\$/.${objext}/"
136 o2lo="s/\\.${objext}\$/.lo/"
137 quote_scanset='[[~#^*{};<>?'"'"' ]'
139 #####################################
140 # Shell function definitions:
141 # This seems to be the best place for them
143 # func_win32_libid arg
144 # return the library type of file 'arg'
146 # Need a lot of goo to handle *both* DLLs and import libs
147 # Has to be a shell function in order to 'eat' the argument
148 # that is supplied when $file_magic_command is called.
149 func_win32_libid ()
151 win32_libid_type="unknown"
152 win32_fileres=`file -L $1 2>/dev/null`
153 case $win32_fileres in
154 *ar\ archive\ import\ library*) # definitely import
155 win32_libid_type="x86 archive import"
157 *ar\ archive*) # could be an import, or static
158 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
159 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
160 win32_nmres=`eval $NM -f posix -A $1 | \
161 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
162 if test "X$win32_nmres" = "Ximport" ; then
163 win32_libid_type="x86 archive import"
164 else
165 win32_libid_type="x86 archive static"
169 *DLL*)
170 win32_libid_type="x86 DLL"
172 *executable*) # but shell scripts are "executable" too...
173 case $win32_fileres in
174 *MS\ Windows\ PE\ Intel*)
175 win32_libid_type="x86 DLL"
177 esac
179 esac
180 $echo $win32_libid_type
184 # func_infer_tag arg
185 # Infer tagged configuration to use if any are available and
186 # if one wasn't chosen via the "--tag" command line option.
187 # Only attempt this if the compiler in the base compile
188 # command doesn't match the default compiler.
189 # arg is usually of the form 'gcc ...'
190 func_infer_tag ()
192 if test -n "$available_tags" && test -z "$tagname"; then
193 CC_quoted=
194 for arg in $CC; do
195 case $arg in
196 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
197 arg="\"$arg\""
199 esac
200 CC_quoted="$CC_quoted $arg"
201 done
202 case $@ in
203 # Blanks in the command may have been stripped by the calling shell,
204 # but not from the CC environment variable when configure was run.
205 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
206 # Blanks at the start of $base_compile will cause this to fail
207 # if we don't check for them as well.
209 for z in $available_tags; do
210 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
211 # Evaluate the configuration.
212 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
213 CC_quoted=
214 for arg in $CC; do
215 # Double-quote args containing other shell metacharacters.
216 case $arg in
217 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
218 arg="\"$arg\""
220 esac
221 CC_quoted="$CC_quoted $arg"
222 done
223 case "$@ " in
224 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
225 # The compiler in the base compile command matches
226 # the one in the tagged configuration.
227 # Assume this is the tagged configuration we want.
228 tagname=$z
229 break
231 esac
233 done
234 # If $tagname still isn't set, then no tagged configuration
235 # was found and let the user know that the "--tag" command
236 # line option must be used.
237 if test -z "$tagname"; then
238 $echo "$modename: unable to infer tagged configuration"
239 $echo "$modename: specify a tag with \`--tag'" 1>&2
240 exit $EXIT_FAILURE
241 # else
242 # $echo "$modename: using $tagname tagged configuration"
245 esac
250 # func_extract_an_archive dir oldlib
251 func_extract_an_archive ()
253 f_ex_an_ar_dir="$1"; shift
254 f_ex_an_ar_oldlib="$1"
256 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
257 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
258 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
260 else
261 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
262 exit $EXIT_FAILURE
266 # func_extract_archives gentop oldlib ...
267 func_extract_archives ()
269 my_gentop="$1"; shift
270 my_oldlibs=${1+"$@"}
271 my_oldobjs=""
272 my_xlib=""
273 my_xabs=""
274 my_xdir=""
275 my_status=""
277 $show "${rm}r $my_gentop"
278 $run ${rm}r "$my_gentop"
279 $show "$mkdir $my_gentop"
280 $run $mkdir "$my_gentop"
281 my_status=$?
282 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
283 exit $my_status
286 for my_xlib in $my_oldlibs; do
287 # Extract the objects.
288 case $my_xlib in
289 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
290 *) my_xabs=`pwd`"/$my_xlib" ;;
291 esac
292 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
293 my_xdir="$my_gentop/$my_xlib"
295 $show "${rm}r $my_xdir"
296 $run ${rm}r "$my_xdir"
297 $show "$mkdir $my_xdir"
298 $run $mkdir "$my_xdir"
299 status=$?
300 if test "$status" -ne 0 && test ! -d "$my_xdir"; then
301 exit $status
303 case $host in
304 *-darwin*)
305 $show "Extracting $my_xabs"
306 # Do not bother doing anything if just a dry run
307 if test -z "$run"; then
308 darwin_orig_dir=`pwd`
309 cd $my_xdir || exit $?
310 darwin_archive=$my_xabs
311 darwin_curdir=`pwd`
312 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
313 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
314 if test -n "$darwin_arches"; then
315 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
316 darwin_arch=
317 $show "$darwin_base_archive has multiple architectures $darwin_arches"
318 for darwin_arch in $darwin_arches ; do
319 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
320 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
321 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
322 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
323 cd "$darwin_curdir"
324 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
325 done # $darwin_arches
326 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
327 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
328 darwin_file=
329 darwin_files=
330 for darwin_file in $darwin_filelist; do
331 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
332 lipo -create -output "$darwin_file" $darwin_files
333 done # $darwin_filelist
334 ${rm}r unfat-$$
335 cd "$darwin_orig_dir"
336 else
337 cd "$darwin_orig_dir"
338 func_extract_an_archive "$my_xdir" "$my_xabs"
339 fi # $darwin_arches
340 fi # $run
343 func_extract_an_archive "$my_xdir" "$my_xabs"
345 esac
346 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
347 done
348 func_extract_archives_result="$my_oldobjs"
350 # End of Shell function definitions
351 #####################################
353 # Darwin sucks
354 eval std_shrext=\"$shrext_cmds\"
356 # Parse our command line options once, thoroughly.
357 while test "$#" -gt 0
359 arg="$1"
360 shift
362 case $arg in
363 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
364 *) optarg= ;;
365 esac
367 # If the previous option needs an argument, assign it.
368 if test -n "$prev"; then
369 case $prev in
370 execute_dlfiles)
371 execute_dlfiles="$execute_dlfiles $arg"
373 tag)
374 tagname="$arg"
375 preserve_args="${preserve_args}=$arg"
377 # Check whether tagname contains only valid characters
378 case $tagname in
379 *[!-_A-Za-z0-9,/]*)
380 $echo "$progname: invalid tag name: $tagname" 1>&2
381 exit $EXIT_FAILURE
383 esac
385 case $tagname in
387 # Don't test for the "default" C tag, as we know, it's there, but
388 # not specially marked.
391 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
392 taglist="$taglist $tagname"
393 # Evaluate the configuration.
394 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
395 else
396 $echo "$progname: ignoring unknown tag $tagname" 1>&2
399 esac
402 eval "$prev=\$arg"
404 esac
406 prev=
407 prevopt=
408 continue
411 # Have we seen a non-optional argument yet?
412 case $arg in
413 --help)
414 show_help=yes
417 --version)
418 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
419 $echo
420 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
421 $echo "This is free software; see the source for copying conditions. There is NO"
422 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
423 exit $?
426 --config)
427 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
428 # Now print the configurations for the tags.
429 for tagname in $taglist; do
430 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
431 done
432 exit $?
435 --debug)
436 $echo "$progname: enabling shell trace mode"
437 set -x
438 preserve_args="$preserve_args $arg"
441 --dry-run | -n)
442 run=:
445 --features)
446 $echo "host: $host"
447 if test "$build_libtool_libs" = yes; then
448 $echo "enable shared libraries"
449 else
450 $echo "disable shared libraries"
452 if test "$build_old_libs" = yes; then
453 $echo "enable static libraries"
454 else
455 $echo "disable static libraries"
457 exit $?
460 --finish) mode="finish" ;;
462 --mode) prevopt="--mode" prev=mode ;;
463 --mode=*) mode="$optarg" ;;
465 --preserve-dup-deps) duplicate_deps="yes" ;;
467 --quiet | --silent)
468 show=:
469 preserve_args="$preserve_args $arg"
472 --tag) prevopt="--tag" prev=tag ;;
473 --tag=*)
474 set tag "$optarg" ${1+"$@"}
475 shift
476 prev=tag
477 preserve_args="$preserve_args --tag"
480 -dlopen)
481 prevopt="-dlopen"
482 prev=execute_dlfiles
486 $echo "$modename: unrecognized option \`$arg'" 1>&2
487 $echo "$help" 1>&2
488 exit $EXIT_FAILURE
492 nonopt="$arg"
493 break
495 esac
496 done
498 if test -n "$prevopt"; then
499 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
500 $echo "$help" 1>&2
501 exit $EXIT_FAILURE
504 # If this variable is set in any of the actions, the command in it
505 # will be execed at the end. This prevents here-documents from being
506 # left over by shells.
507 exec_cmd=
509 if test -z "$show_help"; then
511 # Infer the operation mode.
512 if test -z "$mode"; then
513 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
514 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
515 case $nonopt in
516 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
517 mode=link
518 for arg
520 case $arg in
522 mode=compile
523 break
525 esac
526 done
528 *db | *dbx | *strace | *truss)
529 mode=execute
531 *install*|cp|mv)
532 mode=install
534 *rm)
535 mode=uninstall
538 # If we have no mode, but dlfiles were specified, then do execute mode.
539 test -n "$execute_dlfiles" && mode=execute
541 # Just use the default operation mode.
542 if test -z "$mode"; then
543 if test -n "$nonopt"; then
544 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
545 else
546 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
550 esac
553 # Only execute mode is allowed to have -dlopen flags.
554 if test -n "$execute_dlfiles" && test "$mode" != execute; then
555 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
556 $echo "$help" 1>&2
557 exit $EXIT_FAILURE
560 # Change the help message to a mode-specific one.
561 generic_help="$help"
562 help="Try \`$modename --help --mode=$mode' for more information."
564 # These modes are in order of execution frequency so that they run quickly.
565 case $mode in
566 # libtool compile mode
567 compile)
568 modename="$modename: compile"
569 # Get the compilation command and the source file.
570 base_compile=
571 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
572 suppress_opt=yes
573 suppress_output=
574 arg_mode=normal
575 libobj=
576 later=
578 for arg
580 case "$arg_mode" in
581 arg )
582 # do not "continue". Instead, add this to base_compile
583 lastarg="$arg"
584 arg_mode=normal
587 target )
588 libobj="$arg"
589 arg_mode=normal
590 continue
593 normal )
594 # Accept any command-line options.
595 case $arg in
597 if test -n "$libobj" ; then
598 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
599 exit $EXIT_FAILURE
601 arg_mode=target
602 continue
605 -static | -prefer-pic | -prefer-non-pic)
606 later="$later $arg"
607 continue
610 -no-suppress)
611 suppress_opt=no
612 continue
615 -Xcompiler)
616 arg_mode=arg # the next one goes into the "base_compile" arg list
617 continue # The current "srcfile" will either be retained or
618 ;; # replaced later. I would guess that would be a bug.
620 -Wc,*)
621 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
622 lastarg=
623 save_ifs="$IFS"; IFS=','
624 for arg in $args; do
625 IFS="$save_ifs"
627 # Double-quote args containing other shell metacharacters.
628 # Many Bourne shells cannot handle close brackets correctly
629 # in scan sets, so we specify it separately.
630 case $arg in
631 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
632 arg="\"$arg\""
634 esac
635 lastarg="$lastarg $arg"
636 done
637 IFS="$save_ifs"
638 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
640 # Add the arguments to base_compile.
641 base_compile="$base_compile $lastarg"
642 continue
646 # Accept the current argument as the source file.
647 # The previous "srcfile" becomes the current argument.
649 lastarg="$srcfile"
650 srcfile="$arg"
652 esac # case $arg
654 esac # case $arg_mode
656 # Aesthetically quote the previous argument.
657 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
659 case $lastarg in
660 # Double-quote args containing other shell metacharacters.
661 # Many Bourne shells cannot handle close brackets correctly
662 # in scan sets, and some SunOS ksh mistreat backslash-escaping
663 # in scan sets (worked around with variable expansion),
664 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
665 # at all, so we specify them separately.
666 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
667 lastarg="\"$lastarg\""
669 esac
671 base_compile="$base_compile $lastarg"
672 done # for arg
674 case $arg_mode in
675 arg)
676 $echo "$modename: you must specify an argument for -Xcompile"
677 exit $EXIT_FAILURE
679 target)
680 $echo "$modename: you must specify a target with \`-o'" 1>&2
681 exit $EXIT_FAILURE
684 # Get the name of the library object.
685 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
687 esac
689 # Recognize several different file suffixes.
690 # If the user specifies -o file.o, it is replaced with file.lo
691 xform='[cCFSifmso]'
692 case $libobj in
693 *.ada) xform=ada ;;
694 *.adb) xform=adb ;;
695 *.ads) xform=ads ;;
696 *.asm) xform=asm ;;
697 *.c++) xform=c++ ;;
698 *.cc) xform=cc ;;
699 *.ii) xform=ii ;;
700 *.class) xform=class ;;
701 *.cpp) xform=cpp ;;
702 *.cxx) xform=cxx ;;
703 *.f90) xform=f90 ;;
704 *.for) xform=for ;;
705 *.java) xform=java ;;
706 esac
708 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
710 case $libobj in
711 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
713 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
714 exit $EXIT_FAILURE
716 esac
718 func_infer_tag $base_compile
720 for arg in $later; do
721 case $arg in
722 -static)
723 build_old_libs=yes
724 continue
727 -prefer-pic)
728 pic_mode=yes
729 continue
732 -prefer-non-pic)
733 pic_mode=no
734 continue
736 esac
737 done
739 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
740 case $qlibobj in
741 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
742 qlibobj="\"$qlibobj\"" ;;
743 esac
744 if test "X$libobj" != "X$qlibobj"; then
745 $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
746 exit $EXIT_FAILURE
748 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
749 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
750 if test "X$xdir" = "X$obj"; then
751 xdir=
752 else
753 xdir=$xdir/
755 lobj=${xdir}$objdir/$objname
757 if test -z "$base_compile"; then
758 $echo "$modename: you must specify a compilation command" 1>&2
759 $echo "$help" 1>&2
760 exit $EXIT_FAILURE
763 # Delete any leftover library objects.
764 if test "$build_old_libs" = yes; then
765 removelist="$obj $lobj $libobj ${libobj}T"
766 else
767 removelist="$lobj $libobj ${libobj}T"
770 $run $rm $removelist
771 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
773 # On Cygwin there's no "real" PIC flag so we must build both object types
774 case $host_os in
775 cygwin* | mingw* | pw32* | os2*)
776 pic_mode=default
778 esac
779 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
780 # non-PIC code in shared libraries is not supported
781 pic_mode=default
784 # Calculate the filename of the output object if compiler does
785 # not support -o with -c
786 if test "$compiler_c_o" = no; then
787 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
788 lockfile="$output_obj.lock"
789 removelist="$removelist $output_obj $lockfile"
790 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
791 else
792 output_obj=
793 need_locks=no
794 lockfile=
797 # Lock this critical section if it is needed
798 # We use this script file to make the link, it avoids creating a new file
799 if test "$need_locks" = yes; then
800 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
801 $show "Waiting for $lockfile to be removed"
802 sleep 2
803 done
804 elif test "$need_locks" = warn; then
805 if test -f "$lockfile"; then
806 $echo "\
807 *** ERROR, $lockfile exists and contains:
808 `cat $lockfile 2>/dev/null`
810 This indicates that another process is trying to use the same
811 temporary object file, and libtool could not work around it because
812 your compiler does not support \`-c' and \`-o' together. If you
813 repeat this compilation, it may succeed, by chance, but you had better
814 avoid parallel builds (make -j) in this platform, or get a better
815 compiler."
817 $run $rm $removelist
818 exit $EXIT_FAILURE
820 $echo "$srcfile" > "$lockfile"
823 if test -n "$fix_srcfile_path"; then
824 eval srcfile=\"$fix_srcfile_path\"
826 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
827 case $qsrcfile in
828 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
829 qsrcfile="\"$qsrcfile\"" ;;
830 esac
832 $run $rm "$libobj" "${libobj}T"
834 # Create a libtool object file (analogous to a ".la" file),
835 # but don't create it if we're doing a dry run.
836 test -z "$run" && cat > ${libobj}T <<EOF
837 # $libobj - a libtool object file
838 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
840 # Please DO NOT delete this file!
841 # It is necessary for linking the library.
843 # Name of the PIC object.
846 # Only build a PIC object if we are building libtool libraries.
847 if test "$build_libtool_libs" = yes; then
848 # Without this assignment, base_compile gets emptied.
849 fbsd_hideous_sh_bug=$base_compile
851 if test "$pic_mode" != no; then
852 command="$base_compile $qsrcfile $pic_flag"
853 else
854 # Don't build PIC code
855 command="$base_compile $qsrcfile"
858 if test ! -d "${xdir}$objdir"; then
859 $show "$mkdir ${xdir}$objdir"
860 $run $mkdir ${xdir}$objdir
861 status=$?
862 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
863 exit $status
867 if test -z "$output_obj"; then
868 # Place PIC objects in $objdir
869 command="$command -o $lobj"
872 $run $rm "$lobj" "$output_obj"
874 $show "$command"
875 if $run eval "$command"; then :
876 else
877 test -n "$output_obj" && $run $rm $removelist
878 exit $EXIT_FAILURE
881 if test "$need_locks" = warn &&
882 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
883 $echo "\
884 *** ERROR, $lockfile contains:
885 `cat $lockfile 2>/dev/null`
887 but it should contain:
888 $srcfile
890 This indicates that another process is trying to use the same
891 temporary object file, and libtool could not work around it because
892 your compiler does not support \`-c' and \`-o' together. If you
893 repeat this compilation, it may succeed, by chance, but you had better
894 avoid parallel builds (make -j) in this platform, or get a better
895 compiler."
897 $run $rm $removelist
898 exit $EXIT_FAILURE
901 # Just move the object if needed, then go on to compile the next one
902 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
903 $show "$mv $output_obj $lobj"
904 if $run $mv $output_obj $lobj; then :
905 else
906 error=$?
907 $run $rm $removelist
908 exit $error
912 # Append the name of the PIC object to the libtool object file.
913 test -z "$run" && cat >> ${libobj}T <<EOF
914 pic_object='$objdir/$objname'
918 # Allow error messages only from the first compilation.
919 if test "$suppress_opt" = yes; then
920 suppress_output=' >/dev/null 2>&1'
922 else
923 # No PIC object so indicate it doesn't exist in the libtool
924 # object file.
925 test -z "$run" && cat >> ${libobj}T <<EOF
926 pic_object=none
931 # Only build a position-dependent object if we build old libraries.
932 if test "$build_old_libs" = yes; then
933 if test "$pic_mode" != yes; then
934 # Don't build PIC code
935 command="$base_compile $qsrcfile"
936 else
937 command="$base_compile $qsrcfile $pic_flag"
939 if test "$compiler_c_o" = yes; then
940 command="$command -o $obj"
943 # Suppress compiler output if we already did a PIC compilation.
944 command="$command$suppress_output"
945 $run $rm "$obj" "$output_obj"
946 $show "$command"
947 if $run eval "$command"; then :
948 else
949 $run $rm $removelist
950 exit $EXIT_FAILURE
953 if test "$need_locks" = warn &&
954 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
955 $echo "\
956 *** ERROR, $lockfile contains:
957 `cat $lockfile 2>/dev/null`
959 but it should contain:
960 $srcfile
962 This indicates that another process is trying to use the same
963 temporary object file, and libtool could not work around it because
964 your compiler does not support \`-c' and \`-o' together. If you
965 repeat this compilation, it may succeed, by chance, but you had better
966 avoid parallel builds (make -j) in this platform, or get a better
967 compiler."
969 $run $rm $removelist
970 exit $EXIT_FAILURE
973 # Just move the object if needed
974 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
975 $show "$mv $output_obj $obj"
976 if $run $mv $output_obj $obj; then :
977 else
978 error=$?
979 $run $rm $removelist
980 exit $error
984 # Append the name of the non-PIC object the libtool object file.
985 # Only append if the libtool object file exists.
986 test -z "$run" && cat >> ${libobj}T <<EOF
987 # Name of the non-PIC object.
988 non_pic_object='$objname'
991 else
992 # Append the name of the non-PIC object the libtool object file.
993 # Only append if the libtool object file exists.
994 test -z "$run" && cat >> ${libobj}T <<EOF
995 # Name of the non-PIC object.
996 non_pic_object=none
1001 $run $mv "${libobj}T" "${libobj}"
1003 # Unlock the critical section if it was locked
1004 if test "$need_locks" != no; then
1005 $run $rm "$lockfile"
1008 exit $EXIT_SUCCESS
1011 # libtool link mode
1012 link | relink)
1013 modename="$modename: link"
1014 case $host in
1015 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1016 # It is impossible to link a dll without this setting, and
1017 # we shouldn't force the makefile maintainer to figure out
1018 # which system we are compiling for in order to pass an extra
1019 # flag for every libtool invocation.
1020 # allow_undefined=no
1022 # FIXME: Unfortunately, there are problems with the above when trying
1023 # to make a dll which has undefined symbols, in which case not
1024 # even a static library is built. For now, we need to specify
1025 # -no-undefined on the libtool link line when we can be certain
1026 # that all symbols are satisfied, otherwise we get a static library.
1027 allow_undefined=yes
1030 allow_undefined=yes
1032 esac
1033 libtool_args="$nonopt"
1034 base_compile="$nonopt $@"
1035 compile_command="$nonopt"
1036 finalize_command="$nonopt"
1038 compile_rpath=
1039 finalize_rpath=
1040 compile_shlibpath=
1041 finalize_shlibpath=
1042 convenience=
1043 old_convenience=
1044 deplibs=
1045 old_deplibs=
1046 compiler_flags=
1047 linker_flags=
1048 dllsearchpath=
1049 lib_search_path=`pwd`
1050 inst_prefix_dir=
1052 avoid_version=no
1053 dlfiles=
1054 dlprefiles=
1055 dlself=no
1056 export_dynamic=no
1057 export_symbols=
1058 export_symbols_regex=
1059 generated=
1060 libobjs=
1061 ltlibs=
1062 module=no
1063 no_install=no
1064 objs=
1065 non_pic_objects=
1066 precious_files_regex=
1067 prefer_static_libs=no
1068 preload=no
1069 prev=
1070 prevarg=
1071 release=
1072 rpath=
1073 xrpath=
1074 perm_rpath=
1075 temp_rpath=
1076 thread_safe=no
1077 vinfo=
1078 vinfo_number=no
1080 func_infer_tag $base_compile
1082 # We need to know -static, to get the right output filenames.
1083 for arg
1085 case $arg in
1086 -all-static | -static)
1087 if test "X$arg" = "X-all-static"; then
1088 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1089 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1091 if test -n "$link_static_flag"; then
1092 dlopen_self=$dlopen_self_static
1094 else
1095 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1096 dlopen_self=$dlopen_self_static
1099 build_libtool_libs=no
1100 build_old_libs=yes
1101 prefer_static_libs=yes
1102 break
1104 esac
1105 done
1107 # See if our shared archives depend on static archives.
1108 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1110 # Go through the arguments, transforming them on the way.
1111 while test "$#" -gt 0; do
1112 arg="$1"
1113 shift
1114 case $arg in
1115 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1116 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1118 *) qarg=$arg ;;
1119 esac
1120 libtool_args="$libtool_args $qarg"
1122 # If the previous option needs an argument, assign it.
1123 if test -n "$prev"; then
1124 case $prev in
1125 output)
1126 compile_command="$compile_command @OUTPUT@"
1127 finalize_command="$finalize_command @OUTPUT@"
1129 esac
1131 case $prev in
1132 dlfiles|dlprefiles)
1133 if test "$preload" = no; then
1134 # Add the symbol object into the linking commands.
1135 compile_command="$compile_command @SYMFILE@"
1136 finalize_command="$finalize_command @SYMFILE@"
1137 preload=yes
1139 case $arg in
1140 *.la | *.lo) ;; # We handle these cases below.
1141 force)
1142 if test "$dlself" = no; then
1143 dlself=needless
1144 export_dynamic=yes
1146 prev=
1147 continue
1149 self)
1150 if test "$prev" = dlprefiles; then
1151 dlself=yes
1152 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1153 dlself=yes
1154 else
1155 dlself=needless
1156 export_dynamic=yes
1158 prev=
1159 continue
1162 if test "$prev" = dlfiles; then
1163 dlfiles="$dlfiles $arg"
1164 else
1165 dlprefiles="$dlprefiles $arg"
1167 prev=
1168 continue
1170 esac
1172 expsyms)
1173 export_symbols="$arg"
1174 if test ! -f "$arg"; then
1175 $echo "$modename: symbol file \`$arg' does not exist"
1176 exit $EXIT_FAILURE
1178 prev=
1179 continue
1181 expsyms_regex)
1182 export_symbols_regex="$arg"
1183 prev=
1184 continue
1186 inst_prefix)
1187 inst_prefix_dir="$arg"
1188 prev=
1189 continue
1191 precious_regex)
1192 precious_files_regex="$arg"
1193 prev=
1194 continue
1196 release)
1197 release="-$arg"
1198 prev=
1199 continue
1201 objectlist)
1202 if test -f "$arg"; then
1203 save_arg=$arg
1204 moreargs=
1205 for fil in `cat $save_arg`
1207 # moreargs="$moreargs $fil"
1208 arg=$fil
1209 # A libtool-controlled object.
1211 # Check to see that this really is a libtool object.
1212 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1213 pic_object=
1214 non_pic_object=
1216 # Read the .lo file
1217 # If there is no directory component, then add one.
1218 case $arg in
1219 */* | *\\*) . $arg ;;
1220 *) . ./$arg ;;
1221 esac
1223 if test -z "$pic_object" || \
1224 test -z "$non_pic_object" ||
1225 test "$pic_object" = none && \
1226 test "$non_pic_object" = none; then
1227 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1228 exit $EXIT_FAILURE
1231 # Extract subdirectory from the argument.
1232 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1233 if test "X$xdir" = "X$arg"; then
1234 xdir=
1235 else
1236 xdir="$xdir/"
1239 if test "$pic_object" != none; then
1240 # Prepend the subdirectory the object is found in.
1241 pic_object="$xdir$pic_object"
1243 if test "$prev" = dlfiles; then
1244 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1245 dlfiles="$dlfiles $pic_object"
1246 prev=
1247 continue
1248 else
1249 # If libtool objects are unsupported, then we need to preload.
1250 prev=dlprefiles
1254 # CHECK ME: I think I busted this. -Ossama
1255 if test "$prev" = dlprefiles; then
1256 # Preload the old-style object.
1257 dlprefiles="$dlprefiles $pic_object"
1258 prev=
1261 # A PIC object.
1262 libobjs="$libobjs $pic_object"
1263 arg="$pic_object"
1266 # Non-PIC object.
1267 if test "$non_pic_object" != none; then
1268 # Prepend the subdirectory the object is found in.
1269 non_pic_object="$xdir$non_pic_object"
1271 # A standard non-PIC object
1272 non_pic_objects="$non_pic_objects $non_pic_object"
1273 if test -z "$pic_object" || test "$pic_object" = none ; then
1274 arg="$non_pic_object"
1277 else
1278 # Only an error if not doing a dry-run.
1279 if test -z "$run"; then
1280 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1281 exit $EXIT_FAILURE
1282 else
1283 # Dry-run case.
1285 # Extract subdirectory from the argument.
1286 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1287 if test "X$xdir" = "X$arg"; then
1288 xdir=
1289 else
1290 xdir="$xdir/"
1293 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1294 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1295 libobjs="$libobjs $pic_object"
1296 non_pic_objects="$non_pic_objects $non_pic_object"
1299 done
1300 else
1301 $echo "$modename: link input file \`$save_arg' does not exist"
1302 exit $EXIT_FAILURE
1304 arg=$save_arg
1305 prev=
1306 continue
1308 rpath | xrpath)
1309 # We need an absolute path.
1310 case $arg in
1311 [\\/]* | [A-Za-z]:[\\/]*) ;;
1313 $echo "$modename: only absolute run-paths are allowed" 1>&2
1314 exit $EXIT_FAILURE
1316 esac
1317 if test "$prev" = rpath; then
1318 case "$rpath " in
1319 *" $arg "*) ;;
1320 *) rpath="$rpath $arg" ;;
1321 esac
1322 else
1323 case "$xrpath " in
1324 *" $arg "*) ;;
1325 *) xrpath="$xrpath $arg" ;;
1326 esac
1328 prev=
1329 continue
1331 xcompiler)
1332 compiler_flags="$compiler_flags $qarg"
1333 prev=
1334 compile_command="$compile_command $qarg"
1335 finalize_command="$finalize_command $qarg"
1336 continue
1338 xlinker)
1339 linker_flags="$linker_flags $qarg"
1340 compiler_flags="$compiler_flags $wl$qarg"
1341 prev=
1342 compile_command="$compile_command $wl$qarg"
1343 finalize_command="$finalize_command $wl$qarg"
1344 continue
1346 xcclinker)
1347 linker_flags="$linker_flags $qarg"
1348 compiler_flags="$compiler_flags $qarg"
1349 prev=
1350 compile_command="$compile_command $qarg"
1351 finalize_command="$finalize_command $qarg"
1352 continue
1354 shrext)
1355 shrext_cmds="$arg"
1356 prev=
1357 continue
1359 darwin_framework)
1360 compiler_flags="$compiler_flags $arg"
1361 prev=
1362 continue
1365 eval "$prev=\"\$arg\""
1366 prev=
1367 continue
1369 esac
1370 fi # test -n "$prev"
1372 prevarg="$arg"
1374 case $arg in
1375 -all-static)
1376 if test -n "$link_static_flag"; then
1377 compile_command="$compile_command $link_static_flag"
1378 finalize_command="$finalize_command $link_static_flag"
1380 continue
1383 -allow-undefined)
1384 # FIXME: remove this flag sometime in the future.
1385 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1386 continue
1389 -avoid-version)
1390 avoid_version=yes
1391 continue
1394 -dlopen)
1395 prev=dlfiles
1396 continue
1399 -dlpreopen)
1400 prev=dlprefiles
1401 continue
1404 -export-dynamic)
1405 export_dynamic=yes
1406 continue
1409 -export-symbols | -export-symbols-regex)
1410 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1411 $echo "$modename: more than one -exported-symbols argument is not allowed"
1412 exit $EXIT_FAILURE
1414 if test "X$arg" = "X-export-symbols"; then
1415 prev=expsyms
1416 else
1417 prev=expsyms_regex
1419 continue
1422 -framework)
1423 prev=darwin_framework
1424 compiler_flags="$compiler_flags $arg"
1425 continue
1428 -inst-prefix-dir)
1429 prev=inst_prefix
1430 continue
1433 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1434 # so, if we see these flags be careful not to treat them like -L
1435 -L[A-Z][A-Z]*:*)
1436 case $with_gcc/$host in
1437 no/*-*-irix* | /*-*-irix*)
1438 compile_command="$compile_command $arg"
1439 finalize_command="$finalize_command $arg"
1441 esac
1442 continue
1445 -L*)
1446 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1447 # We need an absolute path.
1448 case $dir in
1449 [\\/]* | [A-Za-z]:[\\/]*) ;;
1451 absdir=`cd "$dir" && pwd`
1452 if test -z "$absdir"; then
1453 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1454 exit $EXIT_FAILURE
1456 dir="$absdir"
1458 esac
1459 case "$deplibs " in
1460 *" -L$dir "*) ;;
1462 deplibs="$deplibs -L$dir"
1463 lib_search_path="$lib_search_path $dir"
1465 esac
1466 case $host in
1467 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1468 case :$dllsearchpath: in
1469 *":$dir:"*) ;;
1470 *) dllsearchpath="$dllsearchpath:$dir";;
1471 esac
1473 esac
1474 continue
1477 -l*)
1478 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1479 case $host in
1480 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1481 # These systems don't actually have a C or math library (as such)
1482 continue
1484 *-*-mingw* | *-*-os2*)
1485 # These systems don't actually have a C library (as such)
1486 test "X$arg" = "X-lc" && continue
1488 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1489 # Do not include libc due to us having libc/libc_r.
1490 test "X$arg" = "X-lc" && continue
1492 *-*-rhapsody* | *-*-darwin1.[012])
1493 # Rhapsody C and math libraries are in the System framework
1494 deplibs="$deplibs -framework System"
1495 continue
1496 esac
1497 elif test "X$arg" = "X-lc_r"; then
1498 case $host in
1499 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1500 # Do not include libc_r directly, use -pthread flag.
1501 continue
1503 esac
1505 deplibs="$deplibs $arg"
1506 continue
1509 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1510 # classes, name mangling, and exception handling.
1511 -model)
1512 compile_command="$compile_command $arg"
1513 compiler_flags="$compiler_flags $arg"
1514 finalize_command="$finalize_command $arg"
1515 prev=xcompiler
1516 continue
1519 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1520 compiler_flags="$compiler_flags $arg"
1521 compile_command="$compile_command $arg"
1522 finalize_command="$finalize_command $arg"
1523 continue
1526 -module)
1527 module=yes
1528 continue
1531 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1532 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1533 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1534 # +DA*, +DD* enable 64-bit mode on the HP compiler
1535 # -q* pass through compiler args for the IBM compiler
1536 # -m* pass through architecture-specific compiler args for GCC
1537 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
1539 # Unknown arguments in both finalize_command and compile_command need
1540 # to be aesthetically quoted because they are evaled later.
1541 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1542 case $arg in
1543 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1544 arg="\"$arg\""
1546 esac
1547 compile_command="$compile_command $arg"
1548 finalize_command="$finalize_command $arg"
1549 if test "$with_gcc" = "yes" ; then
1550 compiler_flags="$compiler_flags $arg"
1552 continue
1555 -shrext)
1556 prev=shrext
1557 continue
1560 -no-fast-install)
1561 fast_install=no
1562 continue
1565 -no-install)
1566 case $host in
1567 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1568 # The PATH hackery in wrapper scripts is required on Windows
1569 # in order for the loader to find any dlls it needs.
1570 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1571 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1572 fast_install=no
1574 *) no_install=yes ;;
1575 esac
1576 continue
1579 -no-undefined)
1580 allow_undefined=no
1581 continue
1584 -objectlist)
1585 prev=objectlist
1586 continue
1589 -o) prev=output ;;
1591 -precious-files-regex)
1592 prev=precious_regex
1593 continue
1596 -release)
1597 prev=release
1598 continue
1601 -rpath)
1602 prev=rpath
1603 continue
1607 prev=xrpath
1608 continue
1611 -R*)
1612 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1613 # We need an absolute path.
1614 case $dir in
1615 [\\/]* | [A-Za-z]:[\\/]*) ;;
1617 $echo "$modename: only absolute run-paths are allowed" 1>&2
1618 exit $EXIT_FAILURE
1620 esac
1621 case "$xrpath " in
1622 *" $dir "*) ;;
1623 *) xrpath="$xrpath $dir" ;;
1624 esac
1625 continue
1628 -static)
1629 # The effects of -static are defined in a previous loop.
1630 # We used to do the same as -all-static on platforms that
1631 # didn't have a PIC flag, but the assumption that the effects
1632 # would be equivalent was wrong. It would break on at least
1633 # Digital Unix and AIX.
1634 continue
1637 -thread-safe)
1638 thread_safe=yes
1639 continue
1642 -version-info)
1643 prev=vinfo
1644 continue
1646 -version-number)
1647 prev=vinfo
1648 vinfo_number=yes
1649 continue
1652 -Wc,*)
1653 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1654 arg=
1655 save_ifs="$IFS"; IFS=','
1656 for flag in $args; do
1657 IFS="$save_ifs"
1658 case $flag in
1659 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1660 flag="\"$flag\""
1662 esac
1663 arg="$arg $wl$flag"
1664 compiler_flags="$compiler_flags $flag"
1665 done
1666 IFS="$save_ifs"
1667 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1670 -Wl,*)
1671 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1672 arg=
1673 save_ifs="$IFS"; IFS=','
1674 for flag in $args; do
1675 IFS="$save_ifs"
1676 case $flag in
1677 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1678 flag="\"$flag\""
1680 esac
1681 arg="$arg $wl$flag"
1682 compiler_flags="$compiler_flags $wl$flag"
1683 linker_flags="$linker_flags $flag"
1684 done
1685 IFS="$save_ifs"
1686 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1689 -Xcompiler)
1690 prev=xcompiler
1691 continue
1694 -Xlinker)
1695 prev=xlinker
1696 continue
1699 -XCClinker)
1700 prev=xcclinker
1701 continue
1704 # Some other compiler flag.
1705 -* | +*)
1706 # Unknown arguments in both finalize_command and compile_command need
1707 # to be aesthetically quoted because they are evaled later.
1708 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1709 case $arg in
1710 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1711 arg="\"$arg\""
1713 esac
1716 *.$objext)
1717 # A standard object.
1718 objs="$objs $arg"
1721 *.lo)
1722 # A libtool-controlled object.
1724 # Check to see that this really is a libtool object.
1725 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1726 pic_object=
1727 non_pic_object=
1729 # Read the .lo file
1730 # If there is no directory component, then add one.
1731 case $arg in
1732 */* | *\\*) . $arg ;;
1733 *) . ./$arg ;;
1734 esac
1736 if test -z "$pic_object" || \
1737 test -z "$non_pic_object" ||
1738 test "$pic_object" = none && \
1739 test "$non_pic_object" = none; then
1740 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1741 exit $EXIT_FAILURE
1744 # Extract subdirectory from the argument.
1745 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1746 if test "X$xdir" = "X$arg"; then
1747 xdir=
1748 else
1749 xdir="$xdir/"
1752 if test "$pic_object" != none; then
1753 # Prepend the subdirectory the object is found in.
1754 pic_object="$xdir$pic_object"
1756 if test "$prev" = dlfiles; then
1757 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1758 dlfiles="$dlfiles $pic_object"
1759 prev=
1760 continue
1761 else
1762 # If libtool objects are unsupported, then we need to preload.
1763 prev=dlprefiles
1767 # CHECK ME: I think I busted this. -Ossama
1768 if test "$prev" = dlprefiles; then
1769 # Preload the old-style object.
1770 dlprefiles="$dlprefiles $pic_object"
1771 prev=
1774 # A PIC object.
1775 libobjs="$libobjs $pic_object"
1776 arg="$pic_object"
1779 # Non-PIC object.
1780 if test "$non_pic_object" != none; then
1781 # Prepend the subdirectory the object is found in.
1782 non_pic_object="$xdir$non_pic_object"
1784 # A standard non-PIC object
1785 non_pic_objects="$non_pic_objects $non_pic_object"
1786 if test -z "$pic_object" || test "$pic_object" = none ; then
1787 arg="$non_pic_object"
1790 else
1791 # Only an error if not doing a dry-run.
1792 if test -z "$run"; then
1793 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1794 exit $EXIT_FAILURE
1795 else
1796 # Dry-run case.
1798 # Extract subdirectory from the argument.
1799 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1800 if test "X$xdir" = "X$arg"; then
1801 xdir=
1802 else
1803 xdir="$xdir/"
1806 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1807 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1808 libobjs="$libobjs $pic_object"
1809 non_pic_objects="$non_pic_objects $non_pic_object"
1814 *.$libext)
1815 # An archive.
1816 deplibs="$deplibs $arg"
1817 old_deplibs="$old_deplibs $arg"
1818 continue
1821 *.la)
1822 # A libtool-controlled library.
1824 if test "$prev" = dlfiles; then
1825 # This library was specified with -dlopen.
1826 dlfiles="$dlfiles $arg"
1827 prev=
1828 elif test "$prev" = dlprefiles; then
1829 # The library was specified with -dlpreopen.
1830 dlprefiles="$dlprefiles $arg"
1831 prev=
1832 else
1833 deplibs="$deplibs $arg"
1835 continue
1838 # Some other compiler argument.
1840 # Unknown arguments in both finalize_command and compile_command need
1841 # to be aesthetically quoted because they are evaled later.
1842 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1843 case $arg in
1844 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1845 arg="\"$arg\""
1847 esac
1849 esac # arg
1851 # Now actually substitute the argument into the commands.
1852 if test -n "$arg"; then
1853 compile_command="$compile_command $arg"
1854 finalize_command="$finalize_command $arg"
1856 done # argument parsing loop
1858 if test -n "$prev"; then
1859 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1860 $echo "$help" 1>&2
1861 exit $EXIT_FAILURE
1864 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1865 eval arg=\"$export_dynamic_flag_spec\"
1866 compile_command="$compile_command $arg"
1867 finalize_command="$finalize_command $arg"
1870 oldlibs=
1871 # calculate the name of the file, without its directory
1872 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1873 libobjs_save="$libobjs"
1875 if test -n "$shlibpath_var"; then
1876 # get the directories listed in $shlibpath_var
1877 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1878 else
1879 shlib_search_path=
1881 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1882 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1884 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1885 if test "X$output_objdir" = "X$output"; then
1886 output_objdir="$objdir"
1887 else
1888 output_objdir="$output_objdir/$objdir"
1890 # Create the object directory.
1891 if test ! -d "$output_objdir"; then
1892 $show "$mkdir $output_objdir"
1893 $run $mkdir $output_objdir
1894 status=$?
1895 if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1896 exit $status
1900 # Determine the type of output
1901 case $output in
1903 $echo "$modename: you must specify an output file" 1>&2
1904 $echo "$help" 1>&2
1905 exit $EXIT_FAILURE
1907 *.$libext) linkmode=oldlib ;;
1908 *.lo | *.$objext) linkmode=obj ;;
1909 *.la) linkmode=lib ;;
1910 *) linkmode=prog ;; # Anything else should be a program.
1911 esac
1913 case $host in
1914 *cygwin* | *mingw* | *pw32*)
1915 # don't eliminate duplications in $postdeps and $predeps
1916 duplicate_compiler_generated_deps=yes
1919 duplicate_compiler_generated_deps=$duplicate_deps
1921 esac
1922 specialdeplibs=
1924 libs=
1925 # Find all interdependent deplibs by searching for libraries
1926 # that are linked more than once (e.g. -la -lb -la)
1927 for deplib in $deplibs; do
1928 if test "X$duplicate_deps" = "Xyes" ; then
1929 case "$libs " in
1930 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1931 esac
1933 libs="$libs $deplib"
1934 done
1936 if test "$linkmode" = lib; then
1937 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1939 # Compute libraries that are listed more than once in $predeps
1940 # $postdeps and mark them as special (i.e., whose duplicates are
1941 # not to be eliminated).
1942 pre_post_deps=
1943 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1944 for pre_post_dep in $predeps $postdeps; do
1945 case "$pre_post_deps " in
1946 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1947 esac
1948 pre_post_deps="$pre_post_deps $pre_post_dep"
1949 done
1951 pre_post_deps=
1954 deplibs=
1955 newdependency_libs=
1956 newlib_search_path=
1957 need_relink=no # whether we're linking any uninstalled libtool libraries
1958 notinst_deplibs= # not-installed libtool libraries
1959 notinst_path= # paths that contain not-installed libtool libraries
1960 case $linkmode in
1961 lib)
1962 passes="conv link"
1963 for file in $dlfiles $dlprefiles; do
1964 case $file in
1965 *.la) ;;
1967 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1968 exit $EXIT_FAILURE
1970 esac
1971 done
1973 prog)
1974 compile_deplibs=
1975 finalize_deplibs=
1976 alldeplibs=no
1977 newdlfiles=
1978 newdlprefiles=
1979 passes="conv scan dlopen dlpreopen link"
1981 *) passes="conv"
1983 esac
1984 for pass in $passes; do
1985 if test "$linkmode,$pass" = "lib,link" ||
1986 test "$linkmode,$pass" = "prog,scan"; then
1987 libs="$deplibs"
1988 deplibs=
1990 if test "$linkmode" = prog; then
1991 case $pass in
1992 dlopen) libs="$dlfiles" ;;
1993 dlpreopen) libs="$dlprefiles" ;;
1994 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1995 esac
1997 if test "$pass" = dlopen; then
1998 # Collect dlpreopened libraries
1999 save_deplibs="$deplibs"
2000 deplibs=
2002 for deplib in $libs; do
2003 lib=
2004 found=no
2005 case $deplib in
2006 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2007 if test "$linkmode,$pass" = "prog,link"; then
2008 compile_deplibs="$deplib $compile_deplibs"
2009 finalize_deplibs="$deplib $finalize_deplibs"
2010 else
2011 compiler_flags="$compiler_flags $deplib"
2013 continue
2015 -l*)
2016 if test "$linkmode" != lib && test "$linkmode" != prog; then
2017 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2018 continue
2020 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2021 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2022 for search_ext in .la $std_shrext .so .a; do
2023 # Search the libtool library
2024 lib="$searchdir/lib${name}${search_ext}"
2025 if test -f "$lib"; then
2026 if test "$search_ext" = ".la"; then
2027 found=yes
2028 else
2029 found=no
2031 break 2
2033 done
2034 done
2035 if test "$found" != yes; then
2036 # deplib doesn't seem to be a libtool library
2037 if test "$linkmode,$pass" = "prog,link"; then
2038 compile_deplibs="$deplib $compile_deplibs"
2039 finalize_deplibs="$deplib $finalize_deplibs"
2040 else
2041 deplibs="$deplib $deplibs"
2042 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2044 continue
2045 else # deplib is a libtool library
2046 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2047 # We need to do some special things here, and not later.
2048 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2049 case " $predeps $postdeps " in
2050 *" $deplib "*)
2051 if (${SED} -e '2q' $lib |
2052 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2053 library_names=
2054 old_library=
2055 case $lib in
2056 */* | *\\*) . $lib ;;
2057 *) . ./$lib ;;
2058 esac
2059 for l in $old_library $library_names; do
2060 ll="$l"
2061 done
2062 if test "X$ll" = "X$old_library" ; then # only static version available
2063 found=no
2064 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2065 test "X$ladir" = "X$lib" && ladir="."
2066 lib=$ladir/$old_library
2067 if test "$linkmode,$pass" = "prog,link"; then
2068 compile_deplibs="$deplib $compile_deplibs"
2069 finalize_deplibs="$deplib $finalize_deplibs"
2070 else
2071 deplibs="$deplib $deplibs"
2072 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2074 continue
2078 *) ;;
2079 esac
2082 ;; # -l
2083 -L*)
2084 case $linkmode in
2085 lib)
2086 deplibs="$deplib $deplibs"
2087 test "$pass" = conv && continue
2088 newdependency_libs="$deplib $newdependency_libs"
2089 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2091 prog)
2092 if test "$pass" = conv; then
2093 deplibs="$deplib $deplibs"
2094 continue
2096 if test "$pass" = scan; then
2097 deplibs="$deplib $deplibs"
2098 else
2099 compile_deplibs="$deplib $compile_deplibs"
2100 finalize_deplibs="$deplib $finalize_deplibs"
2102 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2105 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2107 esac # linkmode
2108 continue
2109 ;; # -L
2110 -R*)
2111 if test "$pass" = link; then
2112 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2113 # Make sure the xrpath contains only unique directories.
2114 case "$xrpath " in
2115 *" $dir "*) ;;
2116 *) xrpath="$xrpath $dir" ;;
2117 esac
2119 deplibs="$deplib $deplibs"
2120 continue
2122 *.la) lib="$deplib" ;;
2123 *.$libext)
2124 if test "$pass" = conv; then
2125 deplibs="$deplib $deplibs"
2126 continue
2128 case $linkmode in
2129 lib)
2130 valid_a_lib=no
2131 case $deplibs_check_method in
2132 match_pattern*)
2133 set dummy $deplibs_check_method
2134 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2135 if eval $echo \"$deplib\" 2>/dev/null \
2136 | $SED 10q \
2137 | $EGREP "$match_pattern_regex" > /dev/null; then
2138 valid_a_lib=yes
2141 pass_all)
2142 valid_a_lib=yes
2144 esac
2145 if test "$valid_a_lib" != yes; then
2146 $echo
2147 $echo "*** Warning: Trying to link with static lib archive $deplib."
2148 $echo "*** I have the capability to make that library automatically link in when"
2149 $echo "*** you link to this library. But I can only do this if you have a"
2150 $echo "*** shared version of the library, which you do not appear to have"
2151 $echo "*** because the file extensions .$libext of this argument makes me believe"
2152 $echo "*** that it is just a static archive that I should not used here."
2153 else
2154 $echo
2155 $echo "*** Warning: Linking the shared library $output against the"
2156 $echo "*** static library $deplib is not portable!"
2157 deplibs="$deplib $deplibs"
2159 continue
2161 prog)
2162 if test "$pass" != link; then
2163 deplibs="$deplib $deplibs"
2164 else
2165 compile_deplibs="$deplib $compile_deplibs"
2166 finalize_deplibs="$deplib $finalize_deplibs"
2168 continue
2170 esac # linkmode
2171 ;; # *.$libext
2172 *.lo | *.$objext)
2173 if test "$pass" = conv; then
2174 deplibs="$deplib $deplibs"
2175 elif test "$linkmode" = prog; then
2176 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2177 # If there is no dlopen support or we're linking statically,
2178 # we need to preload.
2179 newdlprefiles="$newdlprefiles $deplib"
2180 compile_deplibs="$deplib $compile_deplibs"
2181 finalize_deplibs="$deplib $finalize_deplibs"
2182 else
2183 newdlfiles="$newdlfiles $deplib"
2186 continue
2188 %DEPLIBS%)
2189 alldeplibs=yes
2190 continue
2192 esac # case $deplib
2193 if test "$found" = yes || test -f "$lib"; then :
2194 else
2195 $echo "$modename: cannot find the library \`$lib'" 1>&2
2196 exit $EXIT_FAILURE
2199 # Check to see that this really is a libtool archive.
2200 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2201 else
2202 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2203 exit $EXIT_FAILURE
2206 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2207 test "X$ladir" = "X$lib" && ladir="."
2209 dlname=
2210 dlopen=
2211 dlpreopen=
2212 libdir=
2213 library_names=
2214 old_library=
2215 # If the library was installed with an old release of libtool,
2216 # it will not redefine variables installed, or shouldnotlink
2217 installed=yes
2218 shouldnotlink=no
2219 avoidtemprpath=
2222 # Read the .la file
2223 case $lib in
2224 */* | *\\*) . $lib ;;
2225 *) . ./$lib ;;
2226 esac
2228 if test "$linkmode,$pass" = "lib,link" ||
2229 test "$linkmode,$pass" = "prog,scan" ||
2230 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2231 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2232 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2235 if test "$pass" = conv; then
2236 # Only check for convenience libraries
2237 deplibs="$lib $deplibs"
2238 if test -z "$libdir"; then
2239 if test -z "$old_library"; then
2240 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2241 exit $EXIT_FAILURE
2243 # It is a libtool convenience library, so add in its objects.
2244 convenience="$convenience $ladir/$objdir/$old_library"
2245 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2246 tmp_libs=
2247 for deplib in $dependency_libs; do
2248 deplibs="$deplib $deplibs"
2249 if test "X$duplicate_deps" = "Xyes" ; then
2250 case "$tmp_libs " in
2251 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2252 esac
2254 tmp_libs="$tmp_libs $deplib"
2255 done
2256 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2257 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2258 exit $EXIT_FAILURE
2260 continue
2261 fi # $pass = conv
2264 # Get the name of the library we link against.
2265 linklib=
2266 for l in $old_library $library_names; do
2267 linklib="$l"
2268 done
2269 if test -z "$linklib"; then
2270 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2271 exit $EXIT_FAILURE
2274 # This library was specified with -dlopen.
2275 if test "$pass" = dlopen; then
2276 if test -z "$libdir"; then
2277 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2278 exit $EXIT_FAILURE
2280 if test -z "$dlname" ||
2281 test "$dlopen_support" != yes ||
2282 test "$build_libtool_libs" = no; then
2283 # If there is no dlname, no dlopen support or we're linking
2284 # statically, we need to preload. We also need to preload any
2285 # dependent libraries so libltdl's deplib preloader doesn't
2286 # bomb out in the load deplibs phase.
2287 dlprefiles="$dlprefiles $lib $dependency_libs"
2288 else
2289 newdlfiles="$newdlfiles $lib"
2291 continue
2292 fi # $pass = dlopen
2294 # We need an absolute path.
2295 case $ladir in
2296 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2298 abs_ladir=`cd "$ladir" && pwd`
2299 if test -z "$abs_ladir"; then
2300 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2301 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2302 abs_ladir="$ladir"
2305 esac
2306 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2308 # Find the relevant object directory and library name.
2309 if test "X$installed" = Xyes; then
2310 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2311 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2312 dir="$ladir"
2313 absdir="$abs_ladir"
2314 libdir="$abs_ladir"
2315 else
2316 dir="$libdir"
2317 absdir="$libdir"
2319 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2320 else
2321 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2322 dir="$ladir"
2323 absdir="$abs_ladir"
2324 # Remove this search path later
2325 notinst_path="$notinst_path $abs_ladir"
2326 else
2327 dir="$ladir/$objdir"
2328 absdir="$abs_ladir/$objdir"
2329 # Remove this search path later
2330 notinst_path="$notinst_path $abs_ladir"
2332 fi # $installed = yes
2333 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2335 # This library was specified with -dlpreopen.
2336 if test "$pass" = dlpreopen; then
2337 if test -z "$libdir"; then
2338 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2339 exit $EXIT_FAILURE
2341 # Prefer using a static library (so that no silly _DYNAMIC symbols
2342 # are required to link).
2343 if test -n "$old_library"; then
2344 newdlprefiles="$newdlprefiles $dir/$old_library"
2345 # Otherwise, use the dlname, so that lt_dlopen finds it.
2346 elif test -n "$dlname"; then
2347 newdlprefiles="$newdlprefiles $dir/$dlname"
2348 else
2349 newdlprefiles="$newdlprefiles $dir/$linklib"
2351 fi # $pass = dlpreopen
2353 if test -z "$libdir"; then
2354 # Link the convenience library
2355 if test "$linkmode" = lib; then
2356 deplibs="$dir/$old_library $deplibs"
2357 elif test "$linkmode,$pass" = "prog,link"; then
2358 compile_deplibs="$dir/$old_library $compile_deplibs"
2359 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2360 else
2361 deplibs="$lib $deplibs" # used for prog,scan pass
2363 continue
2367 if test "$linkmode" = prog && test "$pass" != link; then
2368 newlib_search_path="$newlib_search_path $ladir"
2369 deplibs="$lib $deplibs"
2371 linkalldeplibs=no
2372 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2373 test "$build_libtool_libs" = no; then
2374 linkalldeplibs=yes
2377 tmp_libs=
2378 for deplib in $dependency_libs; do
2379 case $deplib in
2380 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2381 esac
2382 # Need to link against all dependency_libs?
2383 if test "$linkalldeplibs" = yes; then
2384 deplibs="$deplib $deplibs"
2385 else
2386 # Need to hardcode shared library paths
2387 # or/and link against static libraries
2388 newdependency_libs="$deplib $newdependency_libs"
2390 if test "X$duplicate_deps" = "Xyes" ; then
2391 case "$tmp_libs " in
2392 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2393 esac
2395 tmp_libs="$tmp_libs $deplib"
2396 done # for deplib
2397 continue
2398 fi # $linkmode = prog...
2400 if test "$linkmode,$pass" = "prog,link"; then
2401 if test -n "$library_names" &&
2402 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2403 # We need to hardcode the library path
2404 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2405 # Make sure the rpath contains only unique directories.
2406 case "$temp_rpath " in
2407 *" $dir "*) ;;
2408 *" $absdir "*) ;;
2409 *) temp_rpath="$temp_rpath $dir" ;;
2410 esac
2413 # Hardcode the library path.
2414 # Skip directories that are in the system default run-time
2415 # search path.
2416 case " $sys_lib_dlsearch_path " in
2417 *" $absdir "*) ;;
2419 case "$compile_rpath " in
2420 *" $absdir "*) ;;
2421 *) compile_rpath="$compile_rpath $absdir"
2422 esac
2424 esac
2425 case " $sys_lib_dlsearch_path " in
2426 *" $libdir "*) ;;
2428 case "$finalize_rpath " in
2429 *" $libdir "*) ;;
2430 *) finalize_rpath="$finalize_rpath $libdir"
2431 esac
2433 esac
2434 fi # $linkmode,$pass = prog,link...
2436 if test "$alldeplibs" = yes &&
2437 { test "$deplibs_check_method" = pass_all ||
2438 { test "$build_libtool_libs" = yes &&
2439 test -n "$library_names"; }; }; then
2440 # We only need to search for static libraries
2441 continue
2445 link_static=no # Whether the deplib will be linked statically
2446 if test -n "$library_names" &&
2447 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2448 if test "$installed" = no; then
2449 notinst_deplibs="$notinst_deplibs $lib"
2450 need_relink=yes
2452 # This is a shared library
2454 # Warn about portability, can't link against -module's on
2455 # some systems (darwin)
2456 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2457 $echo
2458 if test "$linkmode" = prog; then
2459 $echo "*** Warning: Linking the executable $output against the loadable module"
2460 else
2461 $echo "*** Warning: Linking the shared library $output against the loadable module"
2463 $echo "*** $linklib is not portable!"
2465 if test "$linkmode" = lib &&
2466 test "$hardcode_into_libs" = yes; then
2467 # Hardcode the library path.
2468 # Skip directories that are in the system default run-time
2469 # search path.
2470 case " $sys_lib_dlsearch_path " in
2471 *" $absdir "*) ;;
2473 case "$compile_rpath " in
2474 *" $absdir "*) ;;
2475 *) compile_rpath="$compile_rpath $absdir"
2476 esac
2478 esac
2479 case " $sys_lib_dlsearch_path " in
2480 *" $libdir "*) ;;
2482 case "$finalize_rpath " in
2483 *" $libdir "*) ;;
2484 *) finalize_rpath="$finalize_rpath $libdir"
2485 esac
2487 esac
2490 if test -n "$old_archive_from_expsyms_cmds"; then
2491 # figure out the soname
2492 set dummy $library_names
2493 realname="$2"
2494 shift; shift
2495 libname=`eval \\$echo \"$libname_spec\"`
2496 # use dlname if we got it. it's perfectly good, no?
2497 if test -n "$dlname"; then
2498 soname="$dlname"
2499 elif test -n "$soname_spec"; then
2500 # bleh windows
2501 case $host in
2502 *cygwin* | mingw*)
2503 major=`expr $current - $age`
2504 versuffix="-$major"
2506 esac
2507 eval soname=\"$soname_spec\"
2508 else
2509 soname="$realname"
2512 # Make a new name for the extract_expsyms_cmds to use
2513 soroot="$soname"
2514 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2515 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2517 # If the library has no export list, then create one now
2518 if test -f "$output_objdir/$soname-def"; then :
2519 else
2520 $show "extracting exported symbol list from \`$soname'"
2521 save_ifs="$IFS"; IFS='~'
2522 cmds=$extract_expsyms_cmds
2523 for cmd in $cmds; do
2524 IFS="$save_ifs"
2525 eval cmd=\"$cmd\"
2526 $show "$cmd"
2527 $run eval "$cmd" || exit $?
2528 done
2529 IFS="$save_ifs"
2532 # Create $newlib
2533 if test -f "$output_objdir/$newlib"; then :; else
2534 $show "generating import library for \`$soname'"
2535 save_ifs="$IFS"; IFS='~'
2536 cmds=$old_archive_from_expsyms_cmds
2537 for cmd in $cmds; do
2538 IFS="$save_ifs"
2539 eval cmd=\"$cmd\"
2540 $show "$cmd"
2541 $run eval "$cmd" || exit $?
2542 done
2543 IFS="$save_ifs"
2545 # make sure the library variables are pointing to the new library
2546 dir=$output_objdir
2547 linklib=$newlib
2548 fi # test -n "$old_archive_from_expsyms_cmds"
2550 if test "$linkmode" = prog || test "$mode" != relink; then
2551 add_shlibpath=
2552 add_dir=
2553 add=
2554 lib_linked=yes
2555 case $hardcode_action in
2556 immediate | unsupported)
2557 if test "$hardcode_direct" = no; then
2558 add="$dir/$linklib"
2559 case $host in
2560 *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2561 *-*-darwin* )
2562 # if the lib is a module then we can not link against
2563 # it, someone is ignoring the new warnings I added
2564 if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
2565 $echo "** Warning, lib $linklib is a module, not a shared library"
2566 if test -z "$old_library" ; then
2567 $echo
2568 $echo "** And there doesn't seem to be a static archive available"
2569 $echo "** The link will probably fail, sorry"
2570 else
2571 add="$dir/$old_library"
2574 esac
2575 elif test "$hardcode_minus_L" = no; then
2576 case $host in
2577 *-*-sunos*) add_shlibpath="$dir" ;;
2578 esac
2579 add_dir="-L$dir"
2580 add="-l$name"
2581 elif test "$hardcode_shlibpath_var" = no; then
2582 add_shlibpath="$dir"
2583 add="-l$name"
2584 else
2585 lib_linked=no
2588 relink)
2589 if test "$hardcode_direct" = yes; then
2590 add="$dir/$linklib"
2591 elif test "$hardcode_minus_L" = yes; then
2592 add_dir="-L$dir"
2593 # Try looking first in the location we're being installed to.
2594 if test -n "$inst_prefix_dir"; then
2595 case "$libdir" in
2596 [\\/]*)
2597 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2599 esac
2601 add="-l$name"
2602 elif test "$hardcode_shlibpath_var" = yes; then
2603 add_shlibpath="$dir"
2604 add="-l$name"
2605 else
2606 lib_linked=no
2609 *) lib_linked=no ;;
2610 esac
2612 if test "$lib_linked" != yes; then
2613 $echo "$modename: configuration error: unsupported hardcode properties"
2614 exit $EXIT_FAILURE
2617 if test -n "$add_shlibpath"; then
2618 case :$compile_shlibpath: in
2619 *":$add_shlibpath:"*) ;;
2620 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2621 esac
2623 if test "$linkmode" = prog; then
2624 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2625 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2626 else
2627 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2628 test -n "$add" && deplibs="$add $deplibs"
2629 if test "$hardcode_direct" != yes && \
2630 test "$hardcode_minus_L" != yes && \
2631 test "$hardcode_shlibpath_var" = yes; then
2632 case :$finalize_shlibpath: in
2633 *":$libdir:"*) ;;
2634 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2635 esac
2640 if test "$linkmode" = prog || test "$mode" = relink; then
2641 add_shlibpath=
2642 add_dir=
2643 add=
2644 # Finalize command for both is simple: just hardcode it.
2645 if test "$hardcode_direct" = yes; then
2646 add="$libdir/$linklib"
2647 elif test "$hardcode_minus_L" = yes; then
2648 add_dir="-L$libdir"
2649 add="-l$name"
2650 elif test "$hardcode_shlibpath_var" = yes; then
2651 case :$finalize_shlibpath: in
2652 *":$libdir:"*) ;;
2653 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2654 esac
2655 add="-l$name"
2656 elif test "$hardcode_automatic" = yes; then
2657 if test -n "$inst_prefix_dir" &&
2658 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2659 add="$inst_prefix_dir$libdir/$linklib"
2660 else
2661 add="$libdir/$linklib"
2663 else
2664 # We cannot seem to hardcode it, guess we'll fake it.
2665 add_dir="-L$libdir"
2666 # Try looking first in the location we're being installed to.
2667 if test -n "$inst_prefix_dir"; then
2668 case "$libdir" in
2669 [\\/]*)
2670 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2672 esac
2674 add="-l$name"
2677 if test "$linkmode" = prog; then
2678 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2679 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2680 else
2681 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2682 test -n "$add" && deplibs="$add $deplibs"
2685 elif test "$linkmode" = prog; then
2686 # Here we assume that one of hardcode_direct or hardcode_minus_L
2687 # is not unsupported. This is valid on all known static and
2688 # shared platforms.
2689 if test "$hardcode_direct" != unsupported; then
2690 test -n "$old_library" && linklib="$old_library"
2691 compile_deplibs="$dir/$linklib $compile_deplibs"
2692 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2693 else
2694 compile_deplibs="-l$name -L$dir $compile_deplibs"
2695 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2697 elif test "$build_libtool_libs" = yes; then
2698 # Not a shared library
2699 if test "$deplibs_check_method" != pass_all; then
2700 # We're trying link a shared library against a static one
2701 # but the system doesn't support it.
2703 # Just print a warning and add the library to dependency_libs so
2704 # that the program can be linked against the static library.
2705 $echo
2706 $echo "*** Warning: This system can not link to static lib archive $lib."
2707 $echo "*** I have the capability to make that library automatically link in when"
2708 $echo "*** you link to this library. But I can only do this if you have a"
2709 $echo "*** shared version of the library, which you do not appear to have."
2710 if test "$module" = yes; then
2711 $echo "*** But as you try to build a module library, libtool will still create "
2712 $echo "*** a static module, that should work as long as the dlopening application"
2713 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2714 if test -z "$global_symbol_pipe"; then
2715 $echo
2716 $echo "*** However, this would only work if libtool was able to extract symbol"
2717 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2718 $echo "*** not find such a program. So, this module is probably useless."
2719 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2721 if test "$build_old_libs" = no; then
2722 build_libtool_libs=module
2723 build_old_libs=yes
2724 else
2725 build_libtool_libs=no
2728 else
2729 convenience="$convenience $dir/$old_library"
2730 old_convenience="$old_convenience $dir/$old_library"
2731 deplibs="$dir/$old_library $deplibs"
2732 link_static=yes
2734 fi # link shared/static library?
2736 if test "$linkmode" = lib; then
2737 if test -n "$dependency_libs" &&
2738 { test "$hardcode_into_libs" != yes ||
2739 test "$build_old_libs" = yes ||
2740 test "$link_static" = yes; }; then
2741 # Extract -R from dependency_libs
2742 temp_deplibs=
2743 for libdir in $dependency_libs; do
2744 case $libdir in
2745 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2746 case " $xrpath " in
2747 *" $temp_xrpath "*) ;;
2748 *) xrpath="$xrpath $temp_xrpath";;
2749 esac;;
2750 *) temp_deplibs="$temp_deplibs $libdir";;
2751 esac
2752 done
2753 dependency_libs="$temp_deplibs"
2756 newlib_search_path="$newlib_search_path $absdir"
2757 # Link against this library
2758 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2759 # ... and its dependency_libs
2760 tmp_libs=
2761 for deplib in $dependency_libs; do
2762 newdependency_libs="$deplib $newdependency_libs"
2763 if test "X$duplicate_deps" = "Xyes" ; then
2764 case "$tmp_libs " in
2765 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2766 esac
2768 tmp_libs="$tmp_libs $deplib"
2769 done
2771 if test "$link_all_deplibs" != no; then
2772 # Add the search paths of all dependency libraries
2773 for deplib in $dependency_libs; do
2774 case $deplib in
2775 -L*) path="$deplib" ;;
2776 *.la)
2777 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2778 test "X$dir" = "X$deplib" && dir="."
2779 # We need an absolute path.
2780 case $dir in
2781 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2783 absdir=`cd "$dir" && pwd`
2784 if test -z "$absdir"; then
2785 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2786 absdir="$dir"
2789 esac
2790 if grep "^installed=no" $deplib > /dev/null; then
2791 path="$absdir/$objdir"
2792 else
2793 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2794 if test -z "$libdir"; then
2795 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2796 exit $EXIT_FAILURE
2798 if test "$absdir" != "$libdir"; then
2799 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2801 path="$absdir"
2803 depdepl=
2804 case $host in
2805 *-*-darwin*)
2806 # we do not want to link against static libs,
2807 # but need to link against shared
2808 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2809 if test -n "$deplibrary_names" ; then
2810 for tmp in $deplibrary_names ; do
2811 depdepl=$tmp
2812 done
2813 if test -f "$path/$depdepl" ; then
2814 depdepl="$path/$depdepl"
2816 # do not add paths which are already there
2817 case " $newlib_search_path " in
2818 *" $path "*) ;;
2819 *) newlib_search_path="$newlib_search_path $path";;
2820 esac
2822 path=""
2825 path="-L$path"
2827 esac
2829 -l*)
2830 case $host in
2831 *-*-darwin*)
2832 # Again, we only want to link against shared libraries
2833 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2834 for tmp in $newlib_search_path ; do
2835 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2836 eval depdepl="$tmp/lib$tmp_libs.dylib"
2837 break
2839 done
2840 path=""
2842 *) continue ;;
2843 esac
2845 *) continue ;;
2846 esac
2847 case " $deplibs " in
2848 *" $path "*) ;;
2849 *) deplibs="$path $deplibs" ;;
2850 esac
2851 case " $deplibs " in
2852 *" $depdepl "*) ;;
2853 *) deplibs="$depdepl $deplibs" ;;
2854 esac
2855 done
2856 fi # link_all_deplibs != no
2857 fi # linkmode = lib
2858 done # for deplib in $libs
2859 dependency_libs="$newdependency_libs"
2860 if test "$pass" = dlpreopen; then
2861 # Link the dlpreopened libraries before other libraries
2862 for deplib in $save_deplibs; do
2863 deplibs="$deplib $deplibs"
2864 done
2866 if test "$pass" != dlopen; then
2867 if test "$pass" != conv; then
2868 # Make sure lib_search_path contains only unique directories.
2869 lib_search_path=
2870 for dir in $newlib_search_path; do
2871 case "$lib_search_path " in
2872 *" $dir "*) ;;
2873 *) lib_search_path="$lib_search_path $dir" ;;
2874 esac
2875 done
2876 newlib_search_path=
2879 if test "$linkmode,$pass" != "prog,link"; then
2880 vars="deplibs"
2881 else
2882 vars="compile_deplibs finalize_deplibs"
2884 for var in $vars dependency_libs; do
2885 # Add libraries to $var in reverse order
2886 eval tmp_libs=\"\$$var\"
2887 new_libs=
2888 for deplib in $tmp_libs; do
2889 # FIXME: Pedantically, this is the right thing to do, so
2890 # that some nasty dependency loop isn't accidentally
2891 # broken:
2892 #new_libs="$deplib $new_libs"
2893 # Pragmatically, this seems to cause very few problems in
2894 # practice:
2895 case $deplib in
2896 -L*) new_libs="$deplib $new_libs" ;;
2897 -R*) ;;
2899 # And here is the reason: when a library appears more
2900 # than once as an explicit dependence of a library, or
2901 # is implicitly linked in more than once by the
2902 # compiler, it is considered special, and multiple
2903 # occurrences thereof are not removed. Compare this
2904 # with having the same library being listed as a
2905 # dependency of multiple other libraries: in this case,
2906 # we know (pedantically, we assume) the library does not
2907 # need to be listed more than once, so we keep only the
2908 # last copy. This is not always right, but it is rare
2909 # enough that we require users that really mean to play
2910 # such unportable linking tricks to link the library
2911 # using -Wl,-lname, so that libtool does not consider it
2912 # for duplicate removal.
2913 case " $specialdeplibs " in
2914 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2916 case " $new_libs " in
2917 *" $deplib "*) ;;
2918 *) new_libs="$deplib $new_libs" ;;
2919 esac
2921 esac
2923 esac
2924 done
2925 tmp_libs=
2926 for deplib in $new_libs; do
2927 case $deplib in
2928 -L*)
2929 case " $tmp_libs " in
2930 *" $deplib "*) ;;
2931 *) tmp_libs="$tmp_libs $deplib" ;;
2932 esac
2934 *) tmp_libs="$tmp_libs $deplib" ;;
2935 esac
2936 done
2937 eval $var=\"$tmp_libs\"
2938 done # for var
2940 # Last step: remove runtime libs from dependency_libs
2941 # (they stay in deplibs)
2942 tmp_libs=
2943 for i in $dependency_libs ; do
2944 case " $predeps $postdeps $compiler_lib_search_path " in
2945 *" $i "*)
2946 i=""
2948 esac
2949 if test -n "$i" ; then
2950 tmp_libs="$tmp_libs $i"
2952 done
2953 dependency_libs=$tmp_libs
2954 done # for pass
2955 if test "$linkmode" = prog; then
2956 dlfiles="$newdlfiles"
2957 dlprefiles="$newdlprefiles"
2960 case $linkmode in
2961 oldlib)
2962 if test -n "$deplibs"; then
2963 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2966 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2967 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2970 if test -n "$rpath"; then
2971 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2974 if test -n "$xrpath"; then
2975 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2978 if test -n "$vinfo"; then
2979 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2982 if test -n "$release"; then
2983 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2986 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2987 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2990 # Now set the variables for building old libraries.
2991 build_libtool_libs=no
2992 oldlibs="$output"
2993 objs="$objs$old_deplibs"
2996 lib)
2997 # Make sure we only generate libraries of the form `libNAME.la'.
2998 case $outputname in
2999 lib*)
3000 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3001 eval shared_ext=\"$shrext_cmds\"
3002 eval libname=\"$libname_spec\"
3005 if test "$module" = no; then
3006 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3007 $echo "$help" 1>&2
3008 exit $EXIT_FAILURE
3010 if test "$need_lib_prefix" != no; then
3011 # Add the "lib" prefix for modules if required
3012 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3013 eval shared_ext=\"$shrext_cmds\"
3014 eval libname=\"$libname_spec\"
3015 else
3016 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3019 esac
3021 if test -n "$objs"; then
3022 if test "$deplibs_check_method" != pass_all; then
3023 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3024 exit $EXIT_FAILURE
3025 else
3026 $echo
3027 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3028 $echo "*** objects $objs is not portable!"
3029 libobjs="$libobjs $objs"
3033 if test "$dlself" != no; then
3034 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3037 set dummy $rpath
3038 if test "$#" -gt 2; then
3039 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3041 install_libdir="$2"
3043 oldlibs=
3044 if test -z "$rpath"; then
3045 if test "$build_libtool_libs" = yes; then
3046 # Building a libtool convenience library.
3047 # Some compilers have problems with a `.al' extension so
3048 # convenience libraries should have the same extension an
3049 # archive normally would.
3050 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3051 build_libtool_libs=convenience
3052 build_old_libs=yes
3055 if test -n "$vinfo"; then
3056 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3059 if test -n "$release"; then
3060 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3062 else
3064 # Parse the version information argument.
3065 save_ifs="$IFS"; IFS=':'
3066 set dummy $vinfo 0 0 0
3067 IFS="$save_ifs"
3069 if test -n "$8"; then
3070 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3071 $echo "$help" 1>&2
3072 exit $EXIT_FAILURE
3075 # convert absolute version numbers to libtool ages
3076 # this retains compatibility with .la files and attempts
3077 # to make the code below a bit more comprehensible
3079 case $vinfo_number in
3080 yes)
3081 number_major="$2"
3082 number_minor="$3"
3083 number_revision="$4"
3085 # There are really only two kinds -- those that
3086 # use the current revision as the major version
3087 # and those that subtract age and use age as
3088 # a minor version. But, then there is irix
3089 # which has an extra 1 added just for fun
3091 case $version_type in
3092 darwin|linux|osf|windows)
3093 current=`expr $number_major + $number_minor`
3094 age="$number_minor"
3095 revision="$number_revision"
3097 freebsd-aout|freebsd-elf|sunos)
3098 current="$number_major"
3099 revision="$number_minor"
3100 age="0"
3102 irix|nonstopux)
3103 current=`expr $number_major + $number_minor - 1`
3104 age="$number_minor"
3105 revision="$number_minor"
3107 esac
3110 current="$2"
3111 revision="$3"
3112 age="$4"
3114 esac
3116 # Check that each of the things are valid numbers.
3117 case $current in
3118 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]) ;;
3120 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3121 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3122 exit $EXIT_FAILURE
3124 esac
3126 case $revision in
3127 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]) ;;
3129 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3130 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3131 exit $EXIT_FAILURE
3133 esac
3135 case $age in
3136 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]) ;;
3138 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3139 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3140 exit $EXIT_FAILURE
3142 esac
3144 if test "$age" -gt "$current"; then
3145 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3146 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3147 exit $EXIT_FAILURE
3150 # Calculate the version variables.
3151 major=
3152 versuffix=
3153 verstring=
3154 case $version_type in
3155 none) ;;
3157 darwin)
3158 # Like Linux, but with the current version available in
3159 # verstring for coding it into the library header
3160 major=.`expr $current - $age`
3161 versuffix="$major.$age.$revision"
3162 # Darwin ld doesn't like 0 for these options...
3163 minor_current=`expr $current + 1`
3164 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3167 freebsd-aout)
3168 major=".$current"
3169 versuffix=".$current.$revision";
3172 freebsd-elf)
3173 major=".$current"
3174 versuffix=".$current";
3177 irix | nonstopux)
3178 major=`expr $current - $age + 1`
3180 case $version_type in
3181 nonstopux) verstring_prefix=nonstopux ;;
3182 *) verstring_prefix=sgi ;;
3183 esac
3184 verstring="$verstring_prefix$major.$revision"
3186 # Add in all the interfaces that we are compatible with.
3187 loop=$revision
3188 while test "$loop" -ne 0; do
3189 iface=`expr $revision - $loop`
3190 loop=`expr $loop - 1`
3191 verstring="$verstring_prefix$major.$iface:$verstring"
3192 done
3194 # Before this point, $major must not contain `.'.
3195 major=.$major
3196 versuffix="$major.$revision"
3199 linux)
3200 major=.`expr $current - $age`
3201 versuffix="$major.$age.$revision"
3204 osf)
3205 major=.`expr $current - $age`
3206 versuffix=".$current.$age.$revision"
3207 verstring="$current.$age.$revision"
3209 # Add in all the interfaces that we are compatible with.
3210 loop=$age
3211 while test "$loop" -ne 0; do
3212 iface=`expr $current - $loop`
3213 loop=`expr $loop - 1`
3214 verstring="$verstring:${iface}.0"
3215 done
3217 # Make executables depend on our current version.
3218 verstring="$verstring:${current}.0"
3221 sunos)
3222 major=".$current"
3223 versuffix=".$current.$revision"
3226 windows)
3227 # Use '-' rather than '.', since we only want one
3228 # extension on DOS 8.3 filesystems.
3229 major=`expr $current - $age`
3230 versuffix="-$major"
3234 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3235 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3236 exit $EXIT_FAILURE
3238 esac
3240 # Clear the version info if we defaulted, and they specified a release.
3241 if test -z "$vinfo" && test -n "$release"; then
3242 major=
3243 case $version_type in
3244 darwin)
3245 # we can't check for "0.0" in archive_cmds due to quoting
3246 # problems, so we reset it completely
3247 verstring=
3250 verstring="0.0"
3252 esac
3253 if test "$need_version" = no; then
3254 versuffix=
3255 else
3256 versuffix=".0.0"
3260 # Remove version info from name if versioning should be avoided
3261 if test "$avoid_version" = yes && test "$need_version" = no; then
3262 major=
3263 versuffix=
3264 verstring=""
3267 # Check to see if the archive will have undefined symbols.
3268 if test "$allow_undefined" = yes; then
3269 if test "$allow_undefined_flag" = unsupported; then
3270 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3271 build_libtool_libs=no
3272 build_old_libs=yes
3274 else
3275 # Don't allow undefined symbols.
3276 allow_undefined_flag="$no_undefined_flag"
3280 if test "$mode" != relink; then
3281 # Remove our outputs, but don't remove object files since they
3282 # may have been created when compiling PIC objects.
3283 removelist=
3284 tempremovelist=`$echo "$output_objdir/*"`
3285 for p in $tempremovelist; do
3286 case $p in
3287 *.$objext)
3289 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3290 if test "X$precious_files_regex" != "X"; then
3291 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3292 then
3293 continue
3296 removelist="$removelist $p"
3298 *) ;;
3299 esac
3300 done
3301 if test -n "$removelist"; then
3302 $show "${rm}r $removelist"
3303 $run ${rm}r $removelist
3307 # Now set the variables for building old libraries.
3308 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3309 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3311 # Transform .lo files to .o files.
3312 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3315 # Eliminate all temporary directories.
3316 for path in $notinst_path; do
3317 lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3318 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3319 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3320 done
3322 if test -n "$xrpath"; then
3323 # If the user specified any rpath flags, then add them.
3324 temp_xrpath=
3325 for libdir in $xrpath; do
3326 temp_xrpath="$temp_xrpath -R$libdir"
3327 case "$finalize_rpath " in
3328 *" $libdir "*) ;;
3329 *) finalize_rpath="$finalize_rpath $libdir" ;;
3330 esac
3331 done
3332 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3333 dependency_libs="$temp_xrpath $dependency_libs"
3337 # Make sure dlfiles contains only unique files that won't be dlpreopened
3338 old_dlfiles="$dlfiles"
3339 dlfiles=
3340 for lib in $old_dlfiles; do
3341 case " $dlprefiles $dlfiles " in
3342 *" $lib "*) ;;
3343 *) dlfiles="$dlfiles $lib" ;;
3344 esac
3345 done
3347 # Make sure dlprefiles contains only unique files
3348 old_dlprefiles="$dlprefiles"
3349 dlprefiles=
3350 for lib in $old_dlprefiles; do
3351 case "$dlprefiles " in
3352 *" $lib "*) ;;
3353 *) dlprefiles="$dlprefiles $lib" ;;
3354 esac
3355 done
3357 if test "$build_libtool_libs" = yes; then
3358 if test -n "$rpath"; then
3359 case $host in
3360 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3361 # these systems don't actually have a c library (as such)!
3363 *-*-rhapsody* | *-*-darwin1.[012])
3364 # Rhapsody C library is in the System framework
3365 deplibs="$deplibs -framework System"
3367 *-*-netbsd*)
3368 # Don't link with libc until the a.out ld.so is fixed.
3370 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3371 # Do not include libc due to us having libc/libc_r.
3372 test "X$arg" = "X-lc" && continue
3375 # Add libc to deplibs on all other systems if necessary.
3376 if test "$build_libtool_need_lc" = "yes"; then
3377 deplibs="$deplibs -lc"
3380 esac
3383 # Transform deplibs into only deplibs that can be linked in shared.
3384 name_save=$name
3385 libname_save=$libname
3386 release_save=$release
3387 versuffix_save=$versuffix
3388 major_save=$major
3389 # I'm not sure if I'm treating the release correctly. I think
3390 # release should show up in the -l (ie -lgmp5) so we don't want to
3391 # add it in twice. Is that correct?
3392 release=""
3393 versuffix=""
3394 major=""
3395 newdeplibs=
3396 droppeddeps=no
3397 case $deplibs_check_method in
3398 pass_all)
3399 # Don't check for shared/static. Everything works.
3400 # This might be a little naive. We might want to check
3401 # whether the library exists or not. But this is on
3402 # osf3 & osf4 and I'm not really sure... Just
3403 # implementing what was already the behavior.
3404 newdeplibs=$deplibs
3406 test_compile)
3407 # This code stresses the "libraries are programs" paradigm to its
3408 # limits. Maybe even breaks it. We compile a program, linking it
3409 # against the deplibs as a proxy for the library. Then we can check
3410 # whether they linked in statically or dynamically with ldd.
3411 $rm conftest.c
3412 cat > conftest.c <<EOF
3413 int main() { return 0; }
3415 $rm conftest
3416 $LTCC -o conftest conftest.c $deplibs
3417 if test "$?" -eq 0 ; then
3418 ldd_output=`ldd conftest`
3419 for i in $deplibs; do
3420 name="`expr $i : '-l\(.*\)'`"
3421 # If $name is empty we are operating on a -L argument.
3422 if test "$name" != "" && test "$name" -ne "0"; then
3423 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3424 case " $predeps $postdeps " in
3425 *" $i "*)
3426 newdeplibs="$newdeplibs $i"
3427 i=""
3429 esac
3431 if test -n "$i" ; then
3432 libname=`eval \\$echo \"$libname_spec\"`
3433 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3434 set dummy $deplib_matches
3435 deplib_match=$2
3436 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3437 newdeplibs="$newdeplibs $i"
3438 else
3439 droppeddeps=yes
3440 $echo
3441 $echo "*** Warning: dynamic linker does not accept needed library $i."
3442 $echo "*** I have the capability to make that library automatically link in when"
3443 $echo "*** you link to this library. But I can only do this if you have a"
3444 $echo "*** shared version of the library, which I believe you do not have"
3445 $echo "*** because a test_compile did reveal that the linker did not use it for"
3446 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3449 else
3450 newdeplibs="$newdeplibs $i"
3452 done
3453 else
3454 # Error occurred in the first compile. Let's try to salvage
3455 # the situation: Compile a separate program for each library.
3456 for i in $deplibs; do
3457 name="`expr $i : '-l\(.*\)'`"
3458 # If $name is empty we are operating on a -L argument.
3459 if test "$name" != "" && test "$name" != "0"; then
3460 $rm conftest
3461 $LTCC -o conftest conftest.c $i
3462 # Did it work?
3463 if test "$?" -eq 0 ; then
3464 ldd_output=`ldd conftest`
3465 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3466 case " $predeps $postdeps " in
3467 *" $i "*)
3468 newdeplibs="$newdeplibs $i"
3469 i=""
3471 esac
3473 if test -n "$i" ; then
3474 libname=`eval \\$echo \"$libname_spec\"`
3475 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3476 set dummy $deplib_matches
3477 deplib_match=$2
3478 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3479 newdeplibs="$newdeplibs $i"
3480 else
3481 droppeddeps=yes
3482 $echo
3483 $echo "*** Warning: dynamic linker does not accept needed library $i."
3484 $echo "*** I have the capability to make that library automatically link in when"
3485 $echo "*** you link to this library. But I can only do this if you have a"
3486 $echo "*** shared version of the library, which you do not appear to have"
3487 $echo "*** because a test_compile did reveal that the linker did not use this one"
3488 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3491 else
3492 droppeddeps=yes
3493 $echo
3494 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3495 $echo "*** make it link in! You will probably need to install it or some"
3496 $echo "*** library that it depends on before this library will be fully"
3497 $echo "*** functional. Installing it before continuing would be even better."
3499 else
3500 newdeplibs="$newdeplibs $i"
3502 done
3505 file_magic*)
3506 set dummy $deplibs_check_method
3507 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3508 for a_deplib in $deplibs; do
3509 name="`expr $a_deplib : '-l\(.*\)'`"
3510 # If $name is empty we are operating on a -L argument.
3511 if test "$name" != "" && test "$name" != "0"; then
3512 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3513 case " $predeps $postdeps " in
3514 *" $a_deplib "*)
3515 newdeplibs="$newdeplibs $a_deplib"
3516 a_deplib=""
3518 esac
3520 if test -n "$a_deplib" ; then
3521 libname=`eval \\$echo \"$libname_spec\"`
3522 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3523 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3524 for potent_lib in $potential_libs; do
3525 # Follow soft links.
3526 if ls -lLd "$potent_lib" 2>/dev/null \
3527 | grep " -> " >/dev/null; then
3528 continue
3530 # The statement above tries to avoid entering an
3531 # endless loop below, in case of cyclic links.
3532 # We might still enter an endless loop, since a link
3533 # loop can be closed while we follow links,
3534 # but so what?
3535 potlib="$potent_lib"
3536 while test -h "$potlib" 2>/dev/null; do
3537 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3538 case $potliblink in
3539 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3540 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3541 esac
3542 done
3543 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3544 | ${SED} 10q \
3545 | $EGREP "$file_magic_regex" > /dev/null; then
3546 newdeplibs="$newdeplibs $a_deplib"
3547 a_deplib=""
3548 break 2
3550 done
3551 done
3553 if test -n "$a_deplib" ; then
3554 droppeddeps=yes
3555 $echo
3556 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3557 $echo "*** I have the capability to make that library automatically link in when"
3558 $echo "*** you link to this library. But I can only do this if you have a"
3559 $echo "*** shared version of the library, which you do not appear to have"
3560 $echo "*** because I did check the linker path looking for a file starting"
3561 if test -z "$potlib" ; then
3562 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3563 else
3564 $echo "*** with $libname and none of the candidates passed a file format test"
3565 $echo "*** using a file magic. Last file checked: $potlib"
3568 else
3569 # Add a -L argument.
3570 newdeplibs="$newdeplibs $a_deplib"
3572 done # Gone through all deplibs.
3574 match_pattern*)
3575 set dummy $deplibs_check_method
3576 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3577 for a_deplib in $deplibs; do
3578 name="`expr $a_deplib : '-l\(.*\)'`"
3579 # If $name is empty we are operating on a -L argument.
3580 if test -n "$name" && test "$name" != "0"; then
3581 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3582 case " $predeps $postdeps " in
3583 *" $a_deplib "*)
3584 newdeplibs="$newdeplibs $a_deplib"
3585 a_deplib=""
3587 esac
3589 if test -n "$a_deplib" ; then
3590 libname=`eval \\$echo \"$libname_spec\"`
3591 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3592 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3593 for potent_lib in $potential_libs; do
3594 potlib="$potent_lib" # see symlink-check above in file_magic test
3595 if eval $echo \"$potent_lib\" 2>/dev/null \
3596 | ${SED} 10q \
3597 | $EGREP "$match_pattern_regex" > /dev/null; then
3598 newdeplibs="$newdeplibs $a_deplib"
3599 a_deplib=""
3600 break 2
3602 done
3603 done
3605 if test -n "$a_deplib" ; then
3606 droppeddeps=yes
3607 $echo
3608 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3609 $echo "*** I have the capability to make that library automatically link in when"
3610 $echo "*** you link to this library. But I can only do this if you have a"
3611 $echo "*** shared version of the library, which you do not appear to have"
3612 $echo "*** because I did check the linker path looking for a file starting"
3613 if test -z "$potlib" ; then
3614 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3615 else
3616 $echo "*** with $libname and none of the candidates passed a file format test"
3617 $echo "*** using a regex pattern. Last file checked: $potlib"
3620 else
3621 # Add a -L argument.
3622 newdeplibs="$newdeplibs $a_deplib"
3624 done # Gone through all deplibs.
3626 none | unknown | *)
3627 newdeplibs=""
3628 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3629 -e 's/ -[LR][^ ]*//g'`
3630 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3631 for i in $predeps $postdeps ; do
3632 # can't use Xsed below, because $i might contain '/'
3633 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3634 done
3636 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3637 | grep . >/dev/null; then
3638 $echo
3639 if test "X$deplibs_check_method" = "Xnone"; then
3640 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3641 else
3642 $echo "*** Warning: inter-library dependencies are not known to be supported."
3644 $echo "*** All declared inter-library dependencies are being dropped."
3645 droppeddeps=yes
3648 esac
3649 versuffix=$versuffix_save
3650 major=$major_save
3651 release=$release_save
3652 libname=$libname_save
3653 name=$name_save
3655 case $host in
3656 *-*-rhapsody* | *-*-darwin1.[012])
3657 # On Rhapsody replace the C library is the System framework
3658 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3660 esac
3662 if test "$droppeddeps" = yes; then
3663 if test "$module" = yes; then
3664 $echo
3665 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3666 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3667 $echo "*** a static module, that should work as long as the dlopening"
3668 $echo "*** application is linked with the -dlopen flag."
3669 if test -z "$global_symbol_pipe"; then
3670 $echo
3671 $echo "*** However, this would only work if libtool was able to extract symbol"
3672 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3673 $echo "*** not find such a program. So, this module is probably useless."
3674 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3676 if test "$build_old_libs" = no; then
3677 oldlibs="$output_objdir/$libname.$libext"
3678 build_libtool_libs=module
3679 build_old_libs=yes
3680 else
3681 build_libtool_libs=no
3683 else
3684 $echo "*** The inter-library dependencies that have been dropped here will be"
3685 $echo "*** automatically added whenever a program is linked with this library"
3686 $echo "*** or is declared to -dlopen it."
3688 if test "$allow_undefined" = no; then
3689 $echo
3690 $echo "*** Since this library must not contain undefined symbols,"
3691 $echo "*** because either the platform does not support them or"
3692 $echo "*** it was explicitly requested with -no-undefined,"
3693 $echo "*** libtool will only create a static version of it."
3694 if test "$build_old_libs" = no; then
3695 oldlibs="$output_objdir/$libname.$libext"
3696 build_libtool_libs=module
3697 build_old_libs=yes
3698 else
3699 build_libtool_libs=no
3704 # Done checking deplibs!
3705 deplibs=$newdeplibs
3708 # All the library-specific variables (install_libdir is set above).
3709 library_names=
3710 old_library=
3711 dlname=
3713 # Test again, we may have decided not to build it any more
3714 if test "$build_libtool_libs" = yes; then
3715 if test "$hardcode_into_libs" = yes; then
3716 # Hardcode the library paths
3717 hardcode_libdirs=
3718 dep_rpath=
3719 rpath="$finalize_rpath"
3720 test "$mode" != relink && rpath="$compile_rpath$rpath"
3721 for libdir in $rpath; do
3722 if test -n "$hardcode_libdir_flag_spec"; then
3723 if test -n "$hardcode_libdir_separator"; then
3724 if test -z "$hardcode_libdirs"; then
3725 hardcode_libdirs="$libdir"
3726 else
3727 # Just accumulate the unique libdirs.
3728 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3729 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3732 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3734 esac
3736 else
3737 eval flag=\"$hardcode_libdir_flag_spec\"
3738 dep_rpath="$dep_rpath $flag"
3740 elif test -n "$runpath_var"; then
3741 case "$perm_rpath " in
3742 *" $libdir "*) ;;
3743 *) perm_rpath="$perm_rpath $libdir" ;;
3744 esac
3746 done
3747 # Substitute the hardcoded libdirs into the rpath.
3748 if test -n "$hardcode_libdir_separator" &&
3749 test -n "$hardcode_libdirs"; then
3750 libdir="$hardcode_libdirs"
3751 if test -n "$hardcode_libdir_flag_spec_ld"; then
3752 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3753 else
3754 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3757 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3758 # We should set the runpath_var.
3759 rpath=
3760 for dir in $perm_rpath; do
3761 rpath="$rpath$dir:"
3762 done
3763 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3765 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3768 shlibpath="$finalize_shlibpath"
3769 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3770 if test -n "$shlibpath"; then
3771 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3774 # Get the real and link names of the library.
3775 eval shared_ext=\"$shrext_cmds\"
3776 eval library_names=\"$library_names_spec\"
3777 set dummy $library_names
3778 realname="$2"
3779 shift; shift
3781 if test -n "$soname_spec"; then
3782 eval soname=\"$soname_spec\"
3783 else
3784 soname="$realname"
3786 if test -z "$dlname"; then
3787 dlname=$soname
3790 lib="$output_objdir/$realname"
3791 for link
3793 linknames="$linknames $link"
3794 done
3796 # Use standard objects if they are pic
3797 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3799 # Prepare the list of exported symbols
3800 if test -z "$export_symbols"; then
3801 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3802 $show "generating symbol list for \`$libname.la'"
3803 export_symbols="$output_objdir/$libname.exp"
3804 $run $rm $export_symbols
3805 cmds=$export_symbols_cmds
3806 save_ifs="$IFS"; IFS='~'
3807 for cmd in $cmds; do
3808 IFS="$save_ifs"
3809 eval cmd=\"$cmd\"
3810 if len=`expr "X$cmd" : ".*"` &&
3811 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3812 $show "$cmd"
3813 $run eval "$cmd" || exit $?
3814 skipped_export=false
3815 else
3816 # The command line is too long to execute in one step.
3817 $show "using reloadable object file for export list..."
3818 skipped_export=:
3820 done
3821 IFS="$save_ifs"
3822 if test -n "$export_symbols_regex"; then
3823 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3824 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3825 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3826 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3831 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3832 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3835 tmp_deplibs=
3836 for test_deplib in $deplibs; do
3837 case " $convenience " in
3838 *" $test_deplib "*) ;;
3840 tmp_deplibs="$tmp_deplibs $test_deplib"
3842 esac
3843 done
3844 deplibs="$tmp_deplibs"
3846 if test -n "$convenience"; then
3847 if test -n "$whole_archive_flag_spec"; then
3848 save_libobjs=$libobjs
3849 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3850 else
3851 gentop="$output_objdir/${outputname}x"
3852 generated="$generated $gentop"
3854 func_extract_archives $gentop $convenience
3855 libobjs="$libobjs $func_extract_archives_result"
3859 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3860 eval flag=\"$thread_safe_flag_spec\"
3861 linker_flags="$linker_flags $flag"
3864 # Make a backup of the uninstalled library when relinking
3865 if test "$mode" = relink; then
3866 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3869 # Do each of the archive commands.
3870 if test "$module" = yes && test -n "$module_cmds" ; then
3871 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3872 eval test_cmds=\"$module_expsym_cmds\"
3873 cmds=$module_expsym_cmds
3874 else
3875 eval test_cmds=\"$module_cmds\"
3876 cmds=$module_cmds
3878 else
3879 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3880 eval test_cmds=\"$archive_expsym_cmds\"
3881 cmds=$archive_expsym_cmds
3882 else
3883 eval test_cmds=\"$archive_cmds\"
3884 cmds=$archive_cmds
3888 if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
3889 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3891 else
3892 # The command line is too long to link in one step, link piecewise.
3893 $echo "creating reloadable object files..."
3895 # Save the value of $output and $libobjs because we want to
3896 # use them later. If we have whole_archive_flag_spec, we
3897 # want to use save_libobjs as it was before
3898 # whole_archive_flag_spec was expanded, because we can't
3899 # assume the linker understands whole_archive_flag_spec.
3900 # This may have to be revisited, in case too many
3901 # convenience libraries get linked in and end up exceeding
3902 # the spec.
3903 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3904 save_libobjs=$libobjs
3906 save_output=$output
3907 output_la=`$echo "X$output" | $Xsed -e "$basename"`
3909 # Clear the reloadable object creation command queue and
3910 # initialize k to one.
3911 test_cmds=
3912 concat_cmds=
3913 objlist=
3914 delfiles=
3915 last_robj=
3917 output=$output_objdir/$output_la-${k}.$objext
3918 # Loop over the list of objects to be linked.
3919 for obj in $save_libobjs
3921 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3922 if test "X$objlist" = X ||
3923 { len=`expr "X$test_cmds" : ".*"` &&
3924 test "$len" -le "$max_cmd_len"; }; then
3925 objlist="$objlist $obj"
3926 else
3927 # The command $test_cmds is almost too long, add a
3928 # command to the queue.
3929 if test "$k" -eq 1 ; then
3930 # The first file doesn't have a previous command to add.
3931 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3932 else
3933 # All subsequent reloadable object files will link in
3934 # the last one created.
3935 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3937 last_robj=$output_objdir/$output_la-${k}.$objext
3938 k=`expr $k + 1`
3939 output=$output_objdir/$output_la-${k}.$objext
3940 objlist=$obj
3941 len=1
3943 done
3944 # Handle the remaining objects by creating one last
3945 # reloadable object file. All subsequent reloadable object
3946 # files will link in the last one created.
3947 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3948 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3950 if ${skipped_export-false}; then
3951 $show "generating symbol list for \`$libname.la'"
3952 export_symbols="$output_objdir/$libname.exp"
3953 $run $rm $export_symbols
3954 libobjs=$output
3955 # Append the command to create the export file.
3956 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3959 # Set up a command to remove the reloadable object files
3960 # after they are used.
3962 while test "$i" -lt "$k"
3964 i=`expr $i + 1`
3965 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
3966 done
3968 $echo "creating a temporary reloadable object file: $output"
3970 # Loop through the commands generated above and execute them.
3971 save_ifs="$IFS"; IFS='~'
3972 for cmd in $concat_cmds; do
3973 IFS="$save_ifs"
3974 $show "$cmd"
3975 $run eval "$cmd" || exit $?
3976 done
3977 IFS="$save_ifs"
3979 libobjs=$output
3980 # Restore the value of output.
3981 output=$save_output
3983 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3984 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3986 # Expand the library linking commands again to reset the
3987 # value of $libobjs for piecewise linking.
3989 # Do each of the archive commands.
3990 if test "$module" = yes && test -n "$module_cmds" ; then
3991 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3992 cmds=$module_expsym_cmds
3993 else
3994 cmds=$module_cmds
3996 else
3997 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3998 cmds=$archive_expsym_cmds
3999 else
4000 cmds=$archive_cmds
4004 # Append the command to remove the reloadable object files
4005 # to the just-reset $cmds.
4006 eval cmds=\"\$cmds~\$rm $delfiles\"
4008 save_ifs="$IFS"; IFS='~'
4009 for cmd in $cmds; do
4010 IFS="$save_ifs"
4011 eval cmd=\"$cmd\"
4012 $show "$cmd"
4013 $run eval "$cmd" || exit $?
4014 done
4015 IFS="$save_ifs"
4017 # Restore the uninstalled library and exit
4018 if test "$mode" = relink; then
4019 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4020 exit $EXIT_SUCCESS
4023 # Create links to the real library.
4024 for linkname in $linknames; do
4025 if test "$realname" != "$linkname"; then
4026 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4027 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4029 done
4031 # If -module or -export-dynamic was specified, set the dlname.
4032 if test "$module" = yes || test "$export_dynamic" = yes; then
4033 # On all known operating systems, these are identical.
4034 dlname="$soname"
4039 obj)
4040 if test -n "$deplibs"; then
4041 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4044 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4045 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4048 if test -n "$rpath"; then
4049 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4052 if test -n "$xrpath"; then
4053 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4056 if test -n "$vinfo"; then
4057 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4060 if test -n "$release"; then
4061 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4064 case $output in
4065 *.lo)
4066 if test -n "$objs$old_deplibs"; then
4067 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4068 exit $EXIT_FAILURE
4070 libobj="$output"
4071 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4074 libobj=
4075 obj="$output"
4077 esac
4079 # Delete the old objects.
4080 $run $rm $obj $libobj
4082 # Objects from convenience libraries. This assumes
4083 # single-version convenience libraries. Whenever we create
4084 # different ones for PIC/non-PIC, this we'll have to duplicate
4085 # the extraction.
4086 reload_conv_objs=
4087 gentop=
4088 # reload_cmds runs $LD directly, so let us get rid of
4089 # -Wl from whole_archive_flag_spec
4092 if test -n "$convenience"; then
4093 if test -n "$whole_archive_flag_spec"; then
4094 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4095 else
4096 gentop="$output_objdir/${obj}x"
4097 generated="$generated $gentop"
4099 func_extract_archives $gentop $convenience
4100 reload_conv_objs="$reload_objs $func_extract_archives_result"
4104 # Create the old-style object.
4105 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
4107 output="$obj"
4108 cmds=$reload_cmds
4109 save_ifs="$IFS"; IFS='~'
4110 for cmd in $cmds; do
4111 IFS="$save_ifs"
4112 eval cmd=\"$cmd\"
4113 $show "$cmd"
4114 $run eval "$cmd" || exit $?
4115 done
4116 IFS="$save_ifs"
4118 # Exit if we aren't doing a library object file.
4119 if test -z "$libobj"; then
4120 if test -n "$gentop"; then
4121 $show "${rm}r $gentop"
4122 $run ${rm}r $gentop
4125 exit $EXIT_SUCCESS
4128 if test "$build_libtool_libs" != yes; then
4129 if test -n "$gentop"; then
4130 $show "${rm}r $gentop"
4131 $run ${rm}r $gentop
4134 # Create an invalid libtool object if no PIC, so that we don't
4135 # accidentally link it into a program.
4136 # $show "echo timestamp > $libobj"
4137 # $run eval "echo timestamp > $libobj" || exit $?
4138 exit $EXIT_SUCCESS
4141 if test -n "$pic_flag" || test "$pic_mode" != default; then
4142 # Only do commands if we really have different PIC objects.
4143 reload_objs="$libobjs $reload_conv_objs"
4144 output="$libobj"
4145 cmds=$reload_cmds
4146 save_ifs="$IFS"; IFS='~'
4147 for cmd in $cmds; do
4148 IFS="$save_ifs"
4149 eval cmd=\"$cmd\"
4150 $show "$cmd"
4151 $run eval "$cmd" || exit $?
4152 done
4153 IFS="$save_ifs"
4156 if test -n "$gentop"; then
4157 $show "${rm}r $gentop"
4158 $run ${rm}r $gentop
4161 exit $EXIT_SUCCESS
4164 prog)
4165 case $host in
4166 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4167 esac
4168 if test -n "$vinfo"; then
4169 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4172 if test -n "$release"; then
4173 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4176 if test "$preload" = yes; then
4177 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4178 test "$dlopen_self_static" = unknown; then
4179 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4183 case $host in
4184 *-*-rhapsody* | *-*-darwin1.[012])
4185 # On Rhapsody replace the C library is the System framework
4186 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4187 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4189 esac
4191 case $host in
4192 *darwin*)
4193 # Don't allow lazy linking, it breaks C++ global constructors
4194 if test "$tagname" = CXX ; then
4195 compile_command="$compile_command ${wl}-bind_at_load"
4196 finalize_command="$finalize_command ${wl}-bind_at_load"
4199 esac
4201 compile_command="$compile_command $compile_deplibs"
4202 finalize_command="$finalize_command $finalize_deplibs"
4204 if test -n "$rpath$xrpath"; then
4205 # If the user specified any rpath flags, then add them.
4206 for libdir in $rpath $xrpath; do
4207 # This is the magic to use -rpath.
4208 case "$finalize_rpath " in
4209 *" $libdir "*) ;;
4210 *) finalize_rpath="$finalize_rpath $libdir" ;;
4211 esac
4212 done
4215 # Now hardcode the library paths
4216 rpath=
4217 hardcode_libdirs=
4218 for libdir in $compile_rpath $finalize_rpath; do
4219 if test -n "$hardcode_libdir_flag_spec"; then
4220 if test -n "$hardcode_libdir_separator"; then
4221 if test -z "$hardcode_libdirs"; then
4222 hardcode_libdirs="$libdir"
4223 else
4224 # Just accumulate the unique libdirs.
4225 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4226 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4229 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4231 esac
4233 else
4234 eval flag=\"$hardcode_libdir_flag_spec\"
4235 rpath="$rpath $flag"
4237 elif test -n "$runpath_var"; then
4238 case "$perm_rpath " in
4239 *" $libdir "*) ;;
4240 *) perm_rpath="$perm_rpath $libdir" ;;
4241 esac
4243 case $host in
4244 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4245 case :$dllsearchpath: in
4246 *":$libdir:"*) ;;
4247 *) dllsearchpath="$dllsearchpath:$libdir";;
4248 esac
4250 esac
4251 done
4252 # Substitute the hardcoded libdirs into the rpath.
4253 if test -n "$hardcode_libdir_separator" &&
4254 test -n "$hardcode_libdirs"; then
4255 libdir="$hardcode_libdirs"
4256 eval rpath=\" $hardcode_libdir_flag_spec\"
4258 compile_rpath="$rpath"
4260 rpath=
4261 hardcode_libdirs=
4262 for libdir in $finalize_rpath; do
4263 if test -n "$hardcode_libdir_flag_spec"; then
4264 if test -n "$hardcode_libdir_separator"; then
4265 if test -z "$hardcode_libdirs"; then
4266 hardcode_libdirs="$libdir"
4267 else
4268 # Just accumulate the unique libdirs.
4269 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4270 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4273 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4275 esac
4277 else
4278 eval flag=\"$hardcode_libdir_flag_spec\"
4279 rpath="$rpath $flag"
4281 elif test -n "$runpath_var"; then
4282 case "$finalize_perm_rpath " in
4283 *" $libdir "*) ;;
4284 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4285 esac
4287 done
4288 # Substitute the hardcoded libdirs into the rpath.
4289 if test -n "$hardcode_libdir_separator" &&
4290 test -n "$hardcode_libdirs"; then
4291 libdir="$hardcode_libdirs"
4292 eval rpath=\" $hardcode_libdir_flag_spec\"
4294 finalize_rpath="$rpath"
4296 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4297 # Transform all the library objects into standard objects.
4298 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4299 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4302 dlsyms=
4303 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4304 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4305 dlsyms="${outputname}S.c"
4306 else
4307 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4311 if test -n "$dlsyms"; then
4312 case $dlsyms in
4313 "") ;;
4314 *.c)
4315 # Discover the nlist of each of the dlfiles.
4316 nlist="$output_objdir/${outputname}.nm"
4318 $show "$rm $nlist ${nlist}S ${nlist}T"
4319 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4321 # Parse the name list into a source file.
4322 $show "creating $output_objdir/$dlsyms"
4324 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4325 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4326 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4328 #ifdef __cplusplus
4329 extern \"C\" {
4330 #endif
4332 /* Prevent the only kind of declaration conflicts we can make. */
4333 #define lt_preloaded_symbols some_other_symbol
4335 /* External symbol declarations for the compiler. */\
4338 if test "$dlself" = yes; then
4339 $show "generating symbol list for \`$output'"
4341 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4343 # Add our own program objects to the symbol list.
4344 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4345 for arg in $progfiles; do
4346 $show "extracting global C symbols from \`$arg'"
4347 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4348 done
4350 if test -n "$exclude_expsyms"; then
4351 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4352 $run eval '$mv "$nlist"T "$nlist"'
4355 if test -n "$export_symbols_regex"; then
4356 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4357 $run eval '$mv "$nlist"T "$nlist"'
4360 # Prepare the list of exported symbols
4361 if test -z "$export_symbols"; then
4362 export_symbols="$output_objdir/$outputname.exp"
4363 $run $rm $export_symbols
4364 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4365 else
4366 $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4367 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4368 $run eval 'mv "$nlist"T "$nlist"'
4372 for arg in $dlprefiles; do
4373 $show "extracting global C symbols from \`$arg'"
4374 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4375 $run eval '$echo ": $name " >> "$nlist"'
4376 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4377 done
4379 if test -z "$run"; then
4380 # Make sure we have at least an empty file.
4381 test -f "$nlist" || : > "$nlist"
4383 if test -n "$exclude_expsyms"; then
4384 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4385 $mv "$nlist"T "$nlist"
4388 # Try sorting and uniquifying the output.
4389 if grep -v "^: " < "$nlist" |
4390 if sort -k 3 </dev/null >/dev/null 2>&1; then
4391 sort -k 3
4392 else
4393 sort +2
4394 fi |
4395 uniq > "$nlist"S; then
4397 else
4398 grep -v "^: " < "$nlist" > "$nlist"S
4401 if test -f "$nlist"S; then
4402 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4403 else
4404 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4407 $echo >> "$output_objdir/$dlsyms" "\
4409 #undef lt_preloaded_symbols
4411 #if defined (__STDC__) && __STDC__
4412 # define lt_ptr void *
4413 #else
4414 # define lt_ptr char *
4415 # define const
4416 #endif
4418 /* The mapping between symbol names and symbols. */
4421 case $host in
4422 *cygwin* | *mingw* )
4423 $echo >> "$output_objdir/$dlsyms" "\
4424 /* DATA imports from DLLs on WIN32 can't be const, because
4425 runtime relocations are performed -- see ld's documentation
4426 on pseudo-relocs */
4427 struct {
4431 $echo >> "$output_objdir/$dlsyms" "\
4432 const struct {
4435 esac
4438 $echo >> "$output_objdir/$dlsyms" "\
4439 const char *name;
4440 lt_ptr address;
4442 lt_preloaded_symbols[] =
4446 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4448 $echo >> "$output_objdir/$dlsyms" "\
4449 {0, (lt_ptr) 0}
4452 /* This works around a problem in FreeBSD linker */
4453 #ifdef FREEBSD_WORKAROUND
4454 static const void *lt_preloaded_setup() {
4455 return lt_preloaded_symbols;
4457 #endif
4459 #ifdef __cplusplus
4461 #endif\
4465 pic_flag_for_symtable=
4466 case $host in
4467 # compiling the symbol table file with pic_flag works around
4468 # a FreeBSD bug that causes programs to crash when -lm is
4469 # linked before any other PIC object. But we must not use
4470 # pic_flag when linking with -static. The problem exists in
4471 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4472 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4473 case "$compile_command " in
4474 *" -static "*) ;;
4475 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4476 esac;;
4477 *-*-hpux*)
4478 case "$compile_command " in
4479 *" -static "*) ;;
4480 *) pic_flag_for_symtable=" $pic_flag";;
4481 esac
4482 esac
4484 # Now compile the dynamic symbol file.
4485 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4486 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4488 # Clean up the generated files.
4489 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4490 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4492 # Transform the symbol file into the correct name.
4493 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4494 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4497 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4498 exit $EXIT_FAILURE
4500 esac
4501 else
4502 # We keep going just in case the user didn't refer to
4503 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4504 # really was required.
4506 # Nullify the symbol file.
4507 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4508 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4511 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4512 # Replace the output file specification.
4513 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4514 link_command="$compile_command$compile_rpath"
4516 # We have no uninstalled library dependencies, so finalize right now.
4517 $show "$link_command"
4518 $run eval "$link_command"
4519 status=$?
4521 # Delete the generated files.
4522 if test -n "$dlsyms"; then
4523 $show "$rm $output_objdir/${outputname}S.${objext}"
4524 $run $rm "$output_objdir/${outputname}S.${objext}"
4527 exit $status
4530 if test -n "$shlibpath_var"; then
4531 # We should set the shlibpath_var
4532 rpath=
4533 for dir in $temp_rpath; do
4534 case $dir in
4535 [\\/]* | [A-Za-z]:[\\/]*)
4536 # Absolute path.
4537 rpath="$rpath$dir:"
4540 # Relative path: add a thisdir entry.
4541 rpath="$rpath\$thisdir/$dir:"
4543 esac
4544 done
4545 temp_rpath="$rpath"
4548 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4549 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4551 if test -n "$finalize_shlibpath"; then
4552 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4555 compile_var=
4556 finalize_var=
4557 if test -n "$runpath_var"; then
4558 if test -n "$perm_rpath"; then
4559 # We should set the runpath_var.
4560 rpath=
4561 for dir in $perm_rpath; do
4562 rpath="$rpath$dir:"
4563 done
4564 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4566 if test -n "$finalize_perm_rpath"; then
4567 # We should set the runpath_var.
4568 rpath=
4569 for dir in $finalize_perm_rpath; do
4570 rpath="$rpath$dir:"
4571 done
4572 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4576 if test "$no_install" = yes; then
4577 # We don't need to create a wrapper script.
4578 link_command="$compile_var$compile_command$compile_rpath"
4579 # Replace the output file specification.
4580 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4581 # Delete the old output file.
4582 $run $rm $output
4583 # Link the executable and exit
4584 $show "$link_command"
4585 $run eval "$link_command" || exit $?
4586 exit $EXIT_SUCCESS
4589 if test "$hardcode_action" = relink; then
4590 # Fast installation is not supported
4591 link_command="$compile_var$compile_command$compile_rpath"
4592 relink_command="$finalize_var$finalize_command$finalize_rpath"
4594 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4595 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4596 else
4597 if test "$fast_install" != no; then
4598 link_command="$finalize_var$compile_command$finalize_rpath"
4599 if test "$fast_install" = yes; then
4600 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4601 else
4602 # fast_install is set to needless
4603 relink_command=
4605 else
4606 link_command="$compile_var$compile_command$compile_rpath"
4607 relink_command="$finalize_var$finalize_command$finalize_rpath"
4611 # Replace the output file specification.
4612 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4614 # Delete the old output files.
4615 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4617 $show "$link_command"
4618 $run eval "$link_command" || exit $?
4620 # Now create the wrapper script.
4621 $show "creating $output"
4623 # Quote the relink command for shipping.
4624 if test -n "$relink_command"; then
4625 # Preserve any variables that may affect compiler behavior
4626 for var in $variables_saved_for_relink; do
4627 if eval test -z \"\${$var+set}\"; then
4628 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4629 elif eval var_value=\$$var; test -z "$var_value"; then
4630 relink_command="$var=; export $var; $relink_command"
4631 else
4632 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4633 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4635 done
4636 relink_command="(cd `pwd`; $relink_command)"
4637 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4640 # Quote $echo for shipping.
4641 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4642 case $progpath in
4643 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4644 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4645 esac
4646 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4647 else
4648 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4651 # Only actually do things if our run command is non-null.
4652 if test -z "$run"; then
4653 # win32 will think the script is a binary if it has
4654 # a .exe suffix, so we strip it off here.
4655 case $output in
4656 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4657 esac
4658 # test for cygwin because mv fails w/o .exe extensions
4659 case $host in
4660 *cygwin*)
4661 exeext=.exe
4662 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4663 *) exeext= ;;
4664 esac
4665 case $host in
4666 *cygwin* | *mingw* )
4667 cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
4668 cwrapper=`$echo ${output}.exe`
4669 $rm $cwrappersource $cwrapper
4670 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4672 cat > $cwrappersource <<EOF
4674 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4675 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4677 The $output program cannot be directly executed until all the libtool
4678 libraries that it depends on are installed.
4680 This wrapper executable should never be moved out of the build directory.
4681 If it is, it will not operate correctly.
4683 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4684 but could eventually absorb all of the scripts functionality and
4685 exec $objdir/$outputname directly.
4688 cat >> $cwrappersource<<"EOF"
4689 #include <stdio.h>
4690 #include <stdlib.h>
4691 #include <unistd.h>
4692 #include <malloc.h>
4693 #include <stdarg.h>
4694 #include <assert.h>
4696 #if defined(PATH_MAX)
4697 # define LT_PATHMAX PATH_MAX
4698 #elif defined(MAXPATHLEN)
4699 # define LT_PATHMAX MAXPATHLEN
4700 #else
4701 # define LT_PATHMAX 1024
4702 #endif
4704 #ifndef DIR_SEPARATOR
4705 #define DIR_SEPARATOR '/'
4706 #endif
4708 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4709 defined (__OS2__)
4710 #define HAVE_DOS_BASED_FILE_SYSTEM
4711 #ifndef DIR_SEPARATOR_2
4712 #define DIR_SEPARATOR_2 '\\'
4713 #endif
4714 #endif
4716 #ifndef DIR_SEPARATOR_2
4717 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4718 #else /* DIR_SEPARATOR_2 */
4719 # define IS_DIR_SEPARATOR(ch) \
4720 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4721 #endif /* DIR_SEPARATOR_2 */
4723 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4724 #define XFREE(stale) do { \
4725 if (stale) { free ((void *) stale); stale = 0; } \
4726 } while (0)
4728 const char *program_name = NULL;
4730 void * xmalloc (size_t num);
4731 char * xstrdup (const char *string);
4732 char * basename (const char *name);
4733 char * fnqualify(const char *path);
4734 char * strendzap(char *str, const char *pat);
4735 void lt_fatal (const char *message, ...);
4738 main (int argc, char *argv[])
4740 char **newargz;
4741 int i;
4743 program_name = (char *) xstrdup ((char *) basename (argv[0]));
4744 newargz = XMALLOC(char *, argc+2);
4747 cat >> $cwrappersource <<EOF
4748 newargz[0] = "$SHELL";
4751 cat >> $cwrappersource <<"EOF"
4752 newargz[1] = fnqualify(argv[0]);
4753 /* we know the script has the same name, without the .exe */
4754 /* so make sure newargz[1] doesn't end in .exe */
4755 strendzap(newargz[1],".exe");
4756 for (i = 1; i < argc; i++)
4757 newargz[i+1] = xstrdup(argv[i]);
4758 newargz[argc+1] = NULL;
4761 cat >> $cwrappersource <<EOF
4762 execv("$SHELL",newargz);
4765 cat >> $cwrappersource <<"EOF"
4768 void *
4769 xmalloc (size_t num)
4771 void * p = (void *) malloc (num);
4772 if (!p)
4773 lt_fatal ("Memory exhausted");
4775 return p;
4778 char *
4779 xstrdup (const char *string)
4781 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4785 char *
4786 basename (const char *name)
4788 const char *base;
4790 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4791 /* Skip over the disk name in MSDOS pathnames. */
4792 if (isalpha (name[0]) && name[1] == ':')
4793 name += 2;
4794 #endif
4796 for (base = name; *name; name++)
4797 if (IS_DIR_SEPARATOR (*name))
4798 base = name + 1;
4799 return (char *) base;
4802 char *
4803 fnqualify(const char *path)
4805 size_t size;
4806 char *p;
4807 char tmp[LT_PATHMAX + 1];
4809 assert(path != NULL);
4811 /* Is it qualified already? */
4812 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4813 if (isalpha (path[0]) && path[1] == ':')
4814 return xstrdup (path);
4815 #endif
4816 if (IS_DIR_SEPARATOR (path[0]))
4817 return xstrdup (path);
4819 /* prepend the current directory */
4820 /* doesn't handle '~' */
4821 if (getcwd (tmp, LT_PATHMAX) == NULL)
4822 lt_fatal ("getcwd failed");
4823 size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4824 p = XMALLOC(char, size);
4825 sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4826 return p;
4829 char *
4830 strendzap(char *str, const char *pat)
4832 size_t len, patlen;
4834 assert(str != NULL);
4835 assert(pat != NULL);
4837 len = strlen(str);
4838 patlen = strlen(pat);
4840 if (patlen <= len)
4842 str += len - patlen;
4843 if (strcmp(str, pat) == 0)
4844 *str = '\0';
4846 return str;
4849 static void
4850 lt_error_core (int exit_status, const char * mode,
4851 const char * message, va_list ap)
4853 fprintf (stderr, "%s: %s: ", program_name, mode);
4854 vfprintf (stderr, message, ap);
4855 fprintf (stderr, ".\n");
4857 if (exit_status >= 0)
4858 exit (exit_status);
4861 void
4862 lt_fatal (const char *message, ...)
4864 va_list ap;
4865 va_start (ap, message);
4866 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4867 va_end (ap);
4870 # we should really use a build-platform specific compiler
4871 # here, but OTOH, the wrappers (shell script and this C one)
4872 # are only useful if you want to execute the "real" binary.
4873 # Since the "real" binary is built for $host, then this
4874 # wrapper might as well be built for $host, too.
4875 $run $LTCC -s -o $cwrapper $cwrappersource
4877 esac
4878 $rm $output
4879 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4881 $echo > $output "\
4882 #! $SHELL
4884 # $output - temporary wrapper script for $objdir/$outputname
4885 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4887 # The $output program cannot be directly executed until all the libtool
4888 # libraries that it depends on are installed.
4890 # This wrapper script should never be moved out of the build directory.
4891 # If it is, it will not operate correctly.
4893 # Sed substitution that helps us do robust quoting. It backslashifies
4894 # metacharacters that are still active within double-quoted strings.
4895 Xsed='${SED} -e 1s/^X//'
4896 sed_quote_subst='$sed_quote_subst'
4898 # The HP-UX ksh and POSIX shell print the target directory to stdout
4899 # if CDPATH is set.
4900 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4902 relink_command=\"$relink_command\"
4904 # This environment variable determines our operation mode.
4905 if test \"\$libtool_install_magic\" = \"$magic\"; then
4906 # install mode needs the following variable:
4907 notinst_deplibs='$notinst_deplibs'
4908 else
4909 # When we are sourced in execute mode, \$file and \$echo are already set.
4910 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4911 echo=\"$qecho\"
4912 file=\"\$0\"
4913 # Make sure echo works.
4914 if test \"X\$1\" = X--no-reexec; then
4915 # Discard the --no-reexec flag, and continue.
4916 shift
4917 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4918 # Yippee, \$echo works!
4920 else
4921 # Restart under the correct shell, and then maybe \$echo will work.
4922 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4926 $echo >> $output "\
4928 # Find the directory that this script lives in.
4929 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4930 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4932 # Follow symbolic links until we get to the real thisdir.
4933 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
4934 while test -n \"\$file\"; do
4935 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4937 # If there was a directory component, then change thisdir.
4938 if test \"x\$destdir\" != \"x\$file\"; then
4939 case \"\$destdir\" in
4940 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4941 *) thisdir=\"\$thisdir/\$destdir\" ;;
4942 esac
4945 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4946 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
4947 done
4949 # Try to get the absolute directory name.
4950 absdir=\`cd \"\$thisdir\" && pwd\`
4951 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4954 if test "$fast_install" = yes; then
4955 $echo >> $output "\
4956 program=lt-'$outputname'$exeext
4957 progdir=\"\$thisdir/$objdir\"
4959 if test ! -f \"\$progdir/\$program\" || \\
4960 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4961 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4963 file=\"\$\$-\$program\"
4965 if test ! -d \"\$progdir\"; then
4966 $mkdir \"\$progdir\"
4967 else
4968 $rm \"\$progdir/\$file\"
4971 $echo >> $output "\
4973 # relink executable if necessary
4974 if test -n \"\$relink_command\"; then
4975 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4976 else
4977 $echo \"\$relink_command_output\" >&2
4978 $rm \"\$progdir/\$file\"
4979 exit $EXIT_FAILURE
4983 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4984 { $rm \"\$progdir/\$program\";
4985 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4986 $rm \"\$progdir/\$file\"
4988 else
4989 $echo >> $output "\
4990 program='$outputname'
4991 progdir=\"\$thisdir/$objdir\"
4995 $echo >> $output "\
4997 if test -f \"\$progdir/\$program\"; then"
4999 # Export our shlibpath_var if we have one.
5000 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5001 $echo >> $output "\
5002 # Add our own library path to $shlibpath_var
5003 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5005 # Some systems cannot cope with colon-terminated $shlibpath_var
5006 # The second colon is a workaround for a bug in BeOS R4 sed
5007 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5009 export $shlibpath_var
5013 # fixup the dll searchpath if we need to.
5014 if test -n "$dllsearchpath"; then
5015 $echo >> $output "\
5016 # Add the dll search path components to the executable PATH
5017 PATH=$dllsearchpath:\$PATH
5021 $echo >> $output "\
5022 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5023 # Run the actual program with our arguments.
5025 case $host in
5026 # Backslashes separate directories on plain windows
5027 *-*-mingw | *-*-os2*)
5028 $echo >> $output "\
5029 exec \$progdir\\\\\$program \${1+\"\$@\"}
5034 $echo >> $output "\
5035 exec \$progdir/\$program \${1+\"\$@\"}
5038 esac
5039 $echo >> $output "\
5040 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
5041 exit $EXIT_FAILURE
5043 else
5044 # The program doesn't exist.
5045 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
5046 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5047 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5048 exit $EXIT_FAILURE
5052 chmod +x $output
5054 exit $EXIT_SUCCESS
5056 esac
5058 # See if we need to build an old-fashioned archive.
5059 for oldlib in $oldlibs; do
5061 if test "$build_libtool_libs" = convenience; then
5062 oldobjs="$libobjs_save"
5063 addlibs="$convenience"
5064 build_libtool_libs=no
5065 else
5066 if test "$build_libtool_libs" = module; then
5067 oldobjs="$libobjs_save"
5068 build_libtool_libs=no
5069 else
5070 oldobjs="$old_deplibs $non_pic_objects"
5072 addlibs="$old_convenience"
5075 if test -n "$addlibs"; then
5076 gentop="$output_objdir/${outputname}x"
5077 generated="$generated $gentop"
5079 func_extract_archives $gentop $addlibs
5080 oldobjs="$oldobjs $func_extract_archives_result"
5083 # Do each command in the archive commands.
5084 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5085 cmds=$old_archive_from_new_cmds
5086 else
5087 # POSIX demands no paths to be encoded in archives. We have
5088 # to avoid creating archives with duplicate basenames if we
5089 # might have to extract them afterwards, e.g., when creating a
5090 # static archive out of a convenience library, or when linking
5091 # the entirety of a libtool archive into another (currently
5092 # not supported by libtool).
5093 if (for obj in $oldobjs
5095 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5096 done | sort | sort -uc >/dev/null 2>&1); then
5098 else
5099 $echo "copying selected object files to avoid basename conflicts..."
5101 if test -z "$gentop"; then
5102 gentop="$output_objdir/${outputname}x"
5103 generated="$generated $gentop"
5105 $show "${rm}r $gentop"
5106 $run ${rm}r "$gentop"
5107 $show "$mkdir $gentop"
5108 $run $mkdir "$gentop"
5109 status=$?
5110 if test "$status" -ne 0 && test ! -d "$gentop"; then
5111 exit $status
5115 save_oldobjs=$oldobjs
5116 oldobjs=
5117 counter=1
5118 for obj in $save_oldobjs
5120 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5121 case " $oldobjs " in
5122 " ") oldobjs=$obj ;;
5123 *[\ /]"$objbase "*)
5124 while :; do
5125 # Make sure we don't pick an alternate name that also
5126 # overlaps.
5127 newobj=lt$counter-$objbase
5128 counter=`expr $counter + 1`
5129 case " $oldobjs " in
5130 *[\ /]"$newobj "*) ;;
5131 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5132 esac
5133 done
5134 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5135 $run ln "$obj" "$gentop/$newobj" ||
5136 $run cp "$obj" "$gentop/$newobj"
5137 oldobjs="$oldobjs $gentop/$newobj"
5139 *) oldobjs="$oldobjs $obj" ;;
5140 esac
5141 done
5144 eval cmds=\"$old_archive_cmds\"
5146 if len=`expr "X$cmds" : ".*"` &&
5147 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5148 cmds=$old_archive_cmds
5149 else
5150 # the command line is too long to link in one step, link in parts
5151 $echo "using piecewise archive linking..."
5152 save_RANLIB=$RANLIB
5153 RANLIB=:
5154 objlist=
5155 concat_cmds=
5156 save_oldobjs=$oldobjs
5158 # Is there a better way of finding the last object in the list?
5159 for obj in $save_oldobjs
5161 last_oldobj=$obj
5162 done
5163 for obj in $save_oldobjs
5165 oldobjs="$objlist $obj"
5166 objlist="$objlist $obj"
5167 eval test_cmds=\"$old_archive_cmds\"
5168 if len=`expr "X$test_cmds" : ".*"` &&
5169 test "$len" -le "$max_cmd_len"; then
5171 else
5172 # the above command should be used before it gets too long
5173 oldobjs=$objlist
5174 if test "$obj" = "$last_oldobj" ; then
5175 RANLIB=$save_RANLIB
5177 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5178 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5179 objlist=
5181 done
5182 RANLIB=$save_RANLIB
5183 oldobjs=$objlist
5184 if test "X$oldobjs" = "X" ; then
5185 eval cmds=\"\$concat_cmds\"
5186 else
5187 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5191 save_ifs="$IFS"; IFS='~'
5192 for cmd in $cmds; do
5193 eval cmd=\"$cmd\"
5194 IFS="$save_ifs"
5195 $show "$cmd"
5196 $run eval "$cmd" || exit $?
5197 done
5198 IFS="$save_ifs"
5199 done
5201 if test -n "$generated"; then
5202 $show "${rm}r$generated"
5203 $run ${rm}r$generated
5206 # Now create the libtool archive.
5207 case $output in
5208 *.la)
5209 old_library=
5210 test "$build_old_libs" = yes && old_library="$libname.$libext"
5211 $show "creating $output"
5213 # Preserve any variables that may affect compiler behavior
5214 for var in $variables_saved_for_relink; do
5215 if eval test -z \"\${$var+set}\"; then
5216 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5217 elif eval var_value=\$$var; test -z "$var_value"; then
5218 relink_command="$var=; export $var; $relink_command"
5219 else
5220 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5221 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5223 done
5224 # Quote the link command for shipping.
5225 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5226 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5227 if test "$hardcode_automatic" = yes ; then
5228 relink_command=
5232 # Only create the output if not a dry run.
5233 if test -z "$run"; then
5234 for installed in no yes; do
5235 if test "$installed" = yes; then
5236 if test -z "$install_libdir"; then
5237 break
5239 output="$output_objdir/$outputname"i
5240 # Replace all uninstalled libtool libraries with the installed ones
5241 newdependency_libs=
5242 for deplib in $dependency_libs; do
5243 case $deplib in
5244 *.la)
5245 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5246 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5247 if test -z "$libdir"; then
5248 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5249 exit $EXIT_FAILURE
5251 newdependency_libs="$newdependency_libs $libdir/$name"
5253 *) newdependency_libs="$newdependency_libs $deplib" ;;
5254 esac
5255 done
5256 dependency_libs="$newdependency_libs"
5257 newdlfiles=
5258 for lib in $dlfiles; do
5259 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5260 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5261 if test -z "$libdir"; then
5262 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5263 exit $EXIT_FAILURE
5265 newdlfiles="$newdlfiles $libdir/$name"
5266 done
5267 dlfiles="$newdlfiles"
5268 newdlprefiles=
5269 for lib in $dlprefiles; do
5270 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5271 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5272 if test -z "$libdir"; then
5273 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5274 exit $EXIT_FAILURE
5276 newdlprefiles="$newdlprefiles $libdir/$name"
5277 done
5278 dlprefiles="$newdlprefiles"
5279 else
5280 newdlfiles=
5281 for lib in $dlfiles; do
5282 case $lib in
5283 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5284 *) abs=`pwd`"/$lib" ;;
5285 esac
5286 newdlfiles="$newdlfiles $abs"
5287 done
5288 dlfiles="$newdlfiles"
5289 newdlprefiles=
5290 for lib in $dlprefiles; do
5291 case $lib in
5292 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5293 *) abs=`pwd`"/$lib" ;;
5294 esac
5295 newdlprefiles="$newdlprefiles $abs"
5296 done
5297 dlprefiles="$newdlprefiles"
5299 $rm $output
5300 # place dlname in correct position for cygwin
5301 tdlname=$dlname
5302 case $host,$output,$installed,$module,$dlname in
5303 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5304 esac
5305 $echo > $output "\
5306 # $outputname - a libtool library file
5307 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5309 # Please DO NOT delete this file!
5310 # It is necessary for linking the library.
5312 # The name that we can dlopen(3).
5313 dlname='$tdlname'
5315 # Names of this library.
5316 library_names='$library_names'
5318 # The name of the static archive.
5319 old_library='$old_library'
5321 # Libraries that this one depends upon.
5322 dependency_libs='$dependency_libs'
5324 # Version information for $libname.
5325 current=$current
5326 age=$age
5327 revision=$revision
5329 # Is this an already installed library?
5330 installed=$installed
5332 # Should we warn about portability when linking against -modules?
5333 shouldnotlink=$module
5335 # Files to dlopen/dlpreopen
5336 dlopen='$dlfiles'
5337 dlpreopen='$dlprefiles'
5339 # Directory that this library needs to be installed in:
5340 libdir='$install_libdir'"
5341 if test "$installed" = no && test "$need_relink" = yes; then
5342 $echo >> $output "\
5343 relink_command=\"$relink_command\""
5345 done
5348 # Do a symbolic link so that the libtool archive can be found in
5349 # LD_LIBRARY_PATH before the program is installed.
5350 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5351 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5353 esac
5354 exit $EXIT_SUCCESS
5357 # libtool install mode
5358 install)
5359 modename="$modename: install"
5361 # There may be an optional sh(1) argument at the beginning of
5362 # install_prog (especially on Windows NT).
5363 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5364 # Allow the use of GNU shtool's install command.
5365 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
5366 # Aesthetically quote it.
5367 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5368 case $arg in
5369 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
5370 arg="\"$arg\""
5372 esac
5373 install_prog="$arg "
5374 arg="$1"
5375 shift
5376 else
5377 install_prog=
5378 arg="$nonopt"
5381 # The real first argument should be the name of the installation program.
5382 # Aesthetically quote it.
5383 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5384 case $arg in
5385 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
5386 arg="\"$arg\""
5388 esac
5389 install_prog="$install_prog$arg"
5391 # We need to accept at least all the BSD install flags.
5392 dest=
5393 files=
5394 opts=
5395 prev=
5396 install_type=
5397 isdir=no
5398 stripme=
5399 for arg
5401 if test -n "$dest"; then
5402 files="$files $dest"
5403 dest="$arg"
5404 continue
5407 case $arg in
5408 -d) isdir=yes ;;
5409 -f) prev="-f" ;;
5410 -g) prev="-g" ;;
5411 -m) prev="-m" ;;
5412 -o) prev="-o" ;;
5414 stripme=" -s"
5415 continue
5417 -*) ;;
5420 # If the previous option needed an argument, then skip it.
5421 if test -n "$prev"; then
5422 prev=
5423 else
5424 dest="$arg"
5425 continue
5428 esac
5430 # Aesthetically quote the argument.
5431 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5432 case $arg in
5433 *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
5434 arg="\"$arg\""
5436 esac
5437 install_prog="$install_prog $arg"
5438 done
5440 if test -z "$install_prog"; then
5441 $echo "$modename: you must specify an install program" 1>&2
5442 $echo "$help" 1>&2
5443 exit $EXIT_FAILURE
5446 if test -n "$prev"; then
5447 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5448 $echo "$help" 1>&2
5449 exit $EXIT_FAILURE
5452 if test -z "$files"; then
5453 if test -z "$dest"; then
5454 $echo "$modename: no file or destination specified" 1>&2
5455 else
5456 $echo "$modename: you must specify a destination" 1>&2
5458 $echo "$help" 1>&2
5459 exit $EXIT_FAILURE
5462 # Strip any trailing slash from the destination.
5463 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5465 # Check to see that the destination is a directory.
5466 test -d "$dest" && isdir=yes
5467 if test "$isdir" = yes; then
5468 destdir="$dest"
5469 destname=
5470 else
5471 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5472 test "X$destdir" = "X$dest" && destdir=.
5473 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5475 # Not a directory, so check to see that there is only one file specified.
5476 set dummy $files
5477 if test "$#" -gt 2; then
5478 $echo "$modename: \`$dest' is not a directory" 1>&2
5479 $echo "$help" 1>&2
5480 exit $EXIT_FAILURE
5483 case $destdir in
5484 [\\/]* | [A-Za-z]:[\\/]*) ;;
5486 for file in $files; do
5487 case $file in
5488 *.lo) ;;
5490 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5491 $echo "$help" 1>&2
5492 exit $EXIT_FAILURE
5494 esac
5495 done
5497 esac
5499 # This variable tells wrapper scripts just to set variables rather
5500 # than running their programs.
5501 libtool_install_magic="$magic"
5503 staticlibs=
5504 future_libdirs=
5505 current_libdirs=
5506 for file in $files; do
5508 # Do each installation.
5509 case $file in
5510 *.$libext)
5511 # Do the static libraries later.
5512 staticlibs="$staticlibs $file"
5515 *.la)
5516 # Check to see that this really is a libtool archive.
5517 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5518 else
5519 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5520 $echo "$help" 1>&2
5521 exit $EXIT_FAILURE
5524 library_names=
5525 old_library=
5526 relink_command=
5527 # If there is no directory component, then add one.
5528 case $file in
5529 */* | *\\*) . $file ;;
5530 *) . ./$file ;;
5531 esac
5533 # Add the libdir to current_libdirs if it is the destination.
5534 if test "X$destdir" = "X$libdir"; then
5535 case "$current_libdirs " in
5536 *" $libdir "*) ;;
5537 *) current_libdirs="$current_libdirs $libdir" ;;
5538 esac
5539 else
5540 # Note the libdir as a future libdir.
5541 case "$future_libdirs " in
5542 *" $libdir "*) ;;
5543 *) future_libdirs="$future_libdirs $libdir" ;;
5544 esac
5547 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5548 test "X$dir" = "X$file/" && dir=
5549 dir="$dir$objdir"
5551 if test -n "$relink_command"; then
5552 # Determine the prefix the user has applied to our future dir.
5553 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5555 # Don't allow the user to place us outside of our expected
5556 # location b/c this prevents finding dependent libraries that
5557 # are installed to the same prefix.
5558 # At present, this check doesn't affect windows .dll's that
5559 # are installed into $libdir/../bin (currently, that works fine)
5560 # but it's something to keep an eye on.
5561 if test "$inst_prefix_dir" = "$destdir"; then
5562 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5563 exit $EXIT_FAILURE
5566 if test -n "$inst_prefix_dir"; then
5567 # Stick the inst_prefix_dir data into the link command.
5568 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5569 else
5570 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5573 $echo "$modename: warning: relinking \`$file'" 1>&2
5574 $show "$relink_command"
5575 if $run eval "$relink_command"; then :
5576 else
5577 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5578 exit $EXIT_FAILURE
5582 # See the names of the shared library.
5583 set dummy $library_names
5584 if test -n "$2"; then
5585 realname="$2"
5586 shift
5587 shift
5589 srcname="$realname"
5590 test -n "$relink_command" && srcname="$realname"T
5592 # Install the shared library and build the symlinks.
5593 $show "$install_prog $dir/$srcname $destdir/$realname"
5594 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5595 if test -n "$stripme" && test -n "$striplib"; then
5596 $show "$striplib $destdir/$realname"
5597 $run eval "$striplib $destdir/$realname" || exit $?
5600 if test "$#" -gt 0; then
5601 # Delete the old symlinks, and create new ones.
5602 for linkname
5604 if test "$linkname" != "$realname"; then
5605 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5606 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5608 done
5611 # Do each command in the postinstall commands.
5612 lib="$destdir/$realname"
5613 cmds=$postinstall_cmds
5614 save_ifs="$IFS"; IFS='~'
5615 for cmd in $cmds; do
5616 IFS="$save_ifs"
5617 eval cmd=\"$cmd\"
5618 $show "$cmd"
5619 $run eval "$cmd" || exit $?
5620 done
5621 IFS="$save_ifs"
5624 # Install the pseudo-library for information purposes.
5625 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5626 instname="$dir/$name"i
5627 $show "$install_prog $instname $destdir/$name"
5628 $run eval "$install_prog $instname $destdir/$name" || exit $?
5630 # Maybe install the static library, too.
5631 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
5634 *.lo)
5635 # Install (i.e. copy) a libtool object.
5637 # Figure out destination file name, if it wasn't already specified.
5638 if test -n "$destname"; then
5639 destfile="$destdir/$destname"
5640 else
5641 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5642 destfile="$destdir/$destfile"
5645 # Deduce the name of the destination old-style object file.
5646 case $destfile in
5647 *.lo)
5648 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
5650 *.$objext)
5651 staticdest="$destfile"
5652 destfile=
5655 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5656 $echo "$help" 1>&2
5657 exit $EXIT_FAILURE
5659 esac
5661 # Install the libtool object if requested.
5662 if test -n "$destfile"; then
5663 $show "$install_prog $file $destfile"
5664 $run eval "$install_prog $file $destfile" || exit $?
5667 # Install the old object if enabled.
5668 if test "$build_old_libs" = yes; then
5669 # Deduce the name of the old-style object file.
5670 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
5672 $show "$install_prog $staticobj $staticdest"
5673 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5675 exit $EXIT_SUCCESS
5679 # Figure out destination file name, if it wasn't already specified.
5680 if test -n "$destname"; then
5681 destfile="$destdir/$destname"
5682 else
5683 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5684 destfile="$destdir/$destfile"
5687 # If the file is missing, and there is a .exe on the end, strip it
5688 # because it is most likely a libtool script we actually want to
5689 # install
5690 stripped_ext=""
5691 case $file in
5692 *.exe)
5693 if test ! -f "$file"; then
5694 file=`$echo $file|${SED} 's,.exe$,,'`
5695 stripped_ext=".exe"
5698 esac
5700 # Do a test to see if this is really a libtool program.
5701 case $host in
5702 *cygwin*|*mingw*)
5703 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
5706 wrapper=$file
5708 esac
5709 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5710 notinst_deplibs=
5711 relink_command=
5713 # To insure that "foo" is sourced, and not "foo.exe",
5714 # finese the cygwin/MSYS system by explicitly sourcing "foo."
5715 # which disallows the automatic-append-.exe behavior.
5716 case $build in
5717 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5718 *) wrapperdot=${wrapper} ;;
5719 esac
5720 # If there is no directory component, then add one.
5721 case $file in
5722 */* | *\\*) . ${wrapperdot} ;;
5723 *) . ./${wrapperdot} ;;
5724 esac
5726 # Check the variables that should have been set.
5727 if test -z "$notinst_deplibs"; then
5728 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5729 exit $EXIT_FAILURE
5732 finalize=yes
5733 for lib in $notinst_deplibs; do
5734 # Check to see that each library is installed.
5735 libdir=
5736 if test -f "$lib"; then
5737 # If there is no directory component, then add one.
5738 case $lib in
5739 */* | *\\*) . $lib ;;
5740 *) . ./$lib ;;
5741 esac
5743 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
5744 if test -n "$libdir" && test ! -f "$libfile"; then
5745 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
5746 finalize=no
5748 done
5750 relink_command=
5751 # To insure that "foo" is sourced, and not "foo.exe",
5752 # finese the cygwin/MSYS system by explicitly sourcing "foo."
5753 # which disallows the automatic-append-.exe behavior.
5754 case $build in
5755 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5756 *) wrapperdot=${wrapper} ;;
5757 esac
5758 # If there is no directory component, then add one.
5759 case $file in
5760 */* | *\\*) . ${wrapperdot} ;;
5761 *) . ./${wrapperdot} ;;
5762 esac
5764 outputname=
5765 if test "$fast_install" = no && test -n "$relink_command"; then
5766 if test "$finalize" = yes && test -z "$run"; then
5767 tmpdir="/tmp"
5768 test -n "$TMPDIR" && tmpdir="$TMPDIR"
5769 tmpdir="$tmpdir/libtool-$$"
5770 save_umask=`umask`
5771 umask 0077
5772 if $mkdir "$tmpdir"; then
5773 umask $save_umask
5774 else
5775 umask $save_umask
5776 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5777 continue
5779 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5780 outputname="$tmpdir/$file"
5781 # Replace the output file specification.
5782 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5784 $show "$relink_command"
5785 if $run eval "$relink_command"; then :
5786 else
5787 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5788 ${rm}r "$tmpdir"
5789 continue
5791 file="$outputname"
5792 else
5793 $echo "$modename: warning: cannot relink \`$file'" 1>&2
5795 else
5796 # Install the binary that we compiled earlier.
5797 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5801 # remove .exe since cygwin /usr/bin/install will append another
5802 # one anyways
5803 case $install_prog,$host in
5804 */usr/bin/install*,*cygwin*)
5805 case $file:$destfile in
5806 *.exe:*.exe)
5807 # this is ok
5809 *.exe:*)
5810 destfile=$destfile.exe
5812 *:*.exe)
5813 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
5815 esac
5817 esac
5818 $show "$install_prog$stripme $file $destfile"
5819 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
5820 test -n "$outputname" && ${rm}r "$tmpdir"
5822 esac
5823 done
5825 for file in $staticlibs; do
5826 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5828 # Set up the ranlib parameters.
5829 oldlib="$destdir/$name"
5831 $show "$install_prog $file $oldlib"
5832 $run eval "$install_prog \$file \$oldlib" || exit $?
5834 if test -n "$stripme" && test -n "$old_striplib"; then
5835 $show "$old_striplib $oldlib"
5836 $run eval "$old_striplib $oldlib" || exit $?
5839 # Do each command in the postinstall commands.
5840 cmds=$old_postinstall_cmds
5841 save_ifs="$IFS"; IFS='~'
5842 for cmd in $cmds; do
5843 IFS="$save_ifs"
5844 eval cmd=\"$cmd\"
5845 $show "$cmd"
5846 $run eval "$cmd" || exit $?
5847 done
5848 IFS="$save_ifs"
5849 done
5851 if test -n "$future_libdirs"; then
5852 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
5855 if test -n "$current_libdirs"; then
5856 # Maybe just do a dry run.
5857 test -n "$run" && current_libdirs=" -n$current_libdirs"
5858 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
5859 else
5860 exit $EXIT_SUCCESS
5864 # libtool finish mode
5865 finish)
5866 modename="$modename: finish"
5867 libdirs="$nonopt"
5868 admincmds=
5870 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5871 for dir
5873 libdirs="$libdirs $dir"
5874 done
5876 for libdir in $libdirs; do
5877 if test -n "$finish_cmds"; then
5878 # Do each command in the finish commands.
5879 cmds=$finish_cmds
5880 save_ifs="$IFS"; IFS='~'
5881 for cmd in $cmds; do
5882 IFS="$save_ifs"
5883 eval cmd=\"$cmd\"
5884 $show "$cmd"
5885 $run eval "$cmd" || admincmds="$admincmds
5886 $cmd"
5887 done
5888 IFS="$save_ifs"
5890 if test -n "$finish_eval"; then
5891 # Do the single finish_eval.
5892 eval cmds=\"$finish_eval\"
5893 $run eval "$cmds" || admincmds="$admincmds
5894 $cmds"
5896 done
5899 # Exit here if they wanted silent mode.
5900 test "$show" = : && exit $EXIT_SUCCESS
5902 $echo "----------------------------------------------------------------------"
5903 $echo "Libraries have been installed in:"
5904 for libdir in $libdirs; do
5905 $echo " $libdir"
5906 done
5907 $echo
5908 $echo "If you ever happen to want to link against installed libraries"
5909 $echo "in a given directory, LIBDIR, you must either use libtool, and"
5910 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5911 $echo "flag during linking and do at least one of the following:"
5912 if test -n "$shlibpath_var"; then
5913 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
5914 $echo " during execution"
5916 if test -n "$runpath_var"; then
5917 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
5918 $echo " during linking"
5920 if test -n "$hardcode_libdir_flag_spec"; then
5921 libdir=LIBDIR
5922 eval flag=\"$hardcode_libdir_flag_spec\"
5924 $echo " - use the \`$flag' linker flag"
5926 if test -n "$admincmds"; then
5927 $echo " - have your system administrator run these commands:$admincmds"
5929 if test -f /etc/ld.so.conf; then
5930 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5932 $echo
5933 $echo "See any operating system documentation about shared libraries for"
5934 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5935 $echo "----------------------------------------------------------------------"
5936 exit $EXIT_SUCCESS
5939 # libtool execute mode
5940 execute)
5941 modename="$modename: execute"
5943 # The first argument is the command name.
5944 cmd="$nonopt"
5945 if test -z "$cmd"; then
5946 $echo "$modename: you must specify a COMMAND" 1>&2
5947 $echo "$help"
5948 exit $EXIT_FAILURE
5951 # Handle -dlopen flags immediately.
5952 for file in $execute_dlfiles; do
5953 if test ! -f "$file"; then
5954 $echo "$modename: \`$file' is not a file" 1>&2
5955 $echo "$help" 1>&2
5956 exit $EXIT_FAILURE
5959 dir=
5960 case $file in
5961 *.la)
5962 # Check to see that this really is a libtool archive.
5963 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5964 else
5965 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5966 $echo "$help" 1>&2
5967 exit $EXIT_FAILURE
5970 # Read the libtool library.
5971 dlname=
5972 library_names=
5974 # If there is no directory component, then add one.
5975 case $file in
5976 */* | *\\*) . $file ;;
5977 *) . ./$file ;;
5978 esac
5980 # Skip this library if it cannot be dlopened.
5981 if test -z "$dlname"; then
5982 # Warn if it was a shared library.
5983 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5984 continue
5987 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5988 test "X$dir" = "X$file" && dir=.
5990 if test -f "$dir/$objdir/$dlname"; then
5991 dir="$dir/$objdir"
5992 else
5993 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5994 exit $EXIT_FAILURE
5998 *.lo)
5999 # Just add the directory containing the .lo file.
6000 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6001 test "X$dir" = "X$file" && dir=.
6005 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6006 continue
6008 esac
6010 # Get the absolute pathname.
6011 absdir=`cd "$dir" && pwd`
6012 test -n "$absdir" && dir="$absdir"
6014 # Now add the directory to shlibpath_var.
6015 if eval "test -z \"\$$shlibpath_var\""; then
6016 eval "$shlibpath_var=\"\$dir\""
6017 else
6018 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6020 done
6022 # This variable tells wrapper scripts just to set shlibpath_var
6023 # rather than running their programs.
6024 libtool_execute_magic="$magic"
6026 # Check if any of the arguments is a wrapper script.
6027 args=
6028 for file
6030 case $file in
6031 -*) ;;
6033 # Do a test to see if this is really a libtool program.
6034 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6035 # If there is no directory component, then add one.
6036 case $file in
6037 */* | *\\*) . $file ;;
6038 *) . ./$file ;;
6039 esac
6041 # Transform arg to wrapped name.
6042 file="$progdir/$program"
6045 esac
6046 # Quote arguments (to preserve shell metacharacters).
6047 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6048 args="$args \"$file\""
6049 done
6051 if test -z "$run"; then
6052 if test -n "$shlibpath_var"; then
6053 # Export the shlibpath_var.
6054 eval "export $shlibpath_var"
6057 # Restore saved environment variables
6058 if test "${save_LC_ALL+set}" = set; then
6059 LC_ALL="$save_LC_ALL"; export LC_ALL
6061 if test "${save_LANG+set}" = set; then
6062 LANG="$save_LANG"; export LANG
6065 # Now prepare to actually exec the command.
6066 exec_cmd="\$cmd$args"
6067 else
6068 # Display what would be done.
6069 if test -n "$shlibpath_var"; then
6070 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6071 $echo "export $shlibpath_var"
6073 $echo "$cmd$args"
6074 exit $EXIT_SUCCESS
6078 # libtool clean and uninstall mode
6079 clean | uninstall)
6080 modename="$modename: $mode"
6081 rm="$nonopt"
6082 files=
6083 rmforce=
6084 exit_status=0
6086 # This variable tells wrapper scripts just to set variables rather
6087 # than running their programs.
6088 libtool_install_magic="$magic"
6090 for arg
6092 case $arg in
6093 -f) rm="$rm $arg"; rmforce=yes ;;
6094 -*) rm="$rm $arg" ;;
6095 *) files="$files $arg" ;;
6096 esac
6097 done
6099 if test -z "$rm"; then
6100 $echo "$modename: you must specify an RM program" 1>&2
6101 $echo "$help" 1>&2
6102 exit $EXIT_FAILURE
6105 rmdirs=
6107 origobjdir="$objdir"
6108 for file in $files; do
6109 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6110 if test "X$dir" = "X$file"; then
6111 dir=.
6112 objdir="$origobjdir"
6113 else
6114 objdir="$dir/$origobjdir"
6116 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6117 test "$mode" = uninstall && objdir="$dir"
6119 # Remember objdir for removal later, being careful to avoid duplicates
6120 if test "$mode" = clean; then
6121 case " $rmdirs " in
6122 *" $objdir "*) ;;
6123 *) rmdirs="$rmdirs $objdir" ;;
6124 esac
6127 # Don't error if the file doesn't exist and rm -f was used.
6128 if (test -L "$file") >/dev/null 2>&1 \
6129 || (test -h "$file") >/dev/null 2>&1 \
6130 || test -f "$file"; then
6132 elif test -d "$file"; then
6133 exit_status=1
6134 continue
6135 elif test "$rmforce" = yes; then
6136 continue
6139 rmfiles="$file"
6141 case $name in
6142 *.la)
6143 # Possibly a libtool archive, so verify it.
6144 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6145 . $dir/$name
6147 # Delete the libtool libraries and symlinks.
6148 for n in $library_names; do
6149 rmfiles="$rmfiles $objdir/$n"
6150 done
6151 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6152 test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6154 if test "$mode" = uninstall; then
6155 if test -n "$library_names"; then
6156 # Do each command in the postuninstall commands.
6157 cmds=$postuninstall_cmds
6158 save_ifs="$IFS"; IFS='~'
6159 for cmd in $cmds; do
6160 IFS="$save_ifs"
6161 eval cmd=\"$cmd\"
6162 $show "$cmd"
6163 $run eval "$cmd"
6164 if test "$?" -ne 0 && test "$rmforce" != yes; then
6165 exit_status=1
6167 done
6168 IFS="$save_ifs"
6171 if test -n "$old_library"; then
6172 # Do each command in the old_postuninstall commands.
6173 cmds=$old_postuninstall_cmds
6174 save_ifs="$IFS"; IFS='~'
6175 for cmd in $cmds; do
6176 IFS="$save_ifs"
6177 eval cmd=\"$cmd\"
6178 $show "$cmd"
6179 $run eval "$cmd"
6180 if test "$?" -ne 0 && test "$rmforce" != yes; then
6181 exit_status=1
6183 done
6184 IFS="$save_ifs"
6186 # FIXME: should reinstall the best remaining shared library.
6191 *.lo)
6192 # Possibly a libtool object, so verify it.
6193 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6195 # Read the .lo file
6196 . $dir/$name
6198 # Add PIC object to the list of files to remove.
6199 if test -n "$pic_object" \
6200 && test "$pic_object" != none; then
6201 rmfiles="$rmfiles $dir/$pic_object"
6204 # Add non-PIC object to the list of files to remove.
6205 if test -n "$non_pic_object" \
6206 && test "$non_pic_object" != none; then
6207 rmfiles="$rmfiles $dir/$non_pic_object"
6213 if test "$mode" = clean ; then
6214 noexename=$name
6215 case $file in
6216 *.exe)
6217 file=`$echo $file|${SED} 's,.exe$,,'`
6218 noexename=`$echo $name|${SED} 's,.exe$,,'`
6219 # $file with .exe has already been added to rmfiles,
6220 # add $file without .exe
6221 rmfiles="$rmfiles $file"
6223 esac
6224 # Do a test to see if this is a libtool program.
6225 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6226 relink_command=
6227 . $dir/$noexename
6229 # note $name still contains .exe if it was in $file originally
6230 # as does the version of $file that was added into $rmfiles
6231 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6232 if test "$fast_install" = yes && test -n "$relink_command"; then
6233 rmfiles="$rmfiles $objdir/lt-$name"
6235 if test "X$noexename" != "X$name" ; then
6236 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6241 esac
6242 $show "$rm $rmfiles"
6243 $run $rm $rmfiles || exit_status=1
6244 done
6245 objdir="$origobjdir"
6247 # Try to remove the ${objdir}s in the directories where we deleted files
6248 for dir in $rmdirs; do
6249 if test -d "$dir"; then
6250 $show "rmdir $dir"
6251 $run rmdir $dir >/dev/null 2>&1
6253 done
6255 exit $exit_status
6259 $echo "$modename: you must specify a MODE" 1>&2
6260 $echo "$generic_help" 1>&2
6261 exit $EXIT_FAILURE
6263 esac
6265 if test -z "$exec_cmd"; then
6266 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6267 $echo "$generic_help" 1>&2
6268 exit $EXIT_FAILURE
6270 fi # test -z "$show_help"
6272 if test -n "$exec_cmd"; then
6273 eval exec $exec_cmd
6274 exit $EXIT_FAILURE
6277 # We need to display help for each of the modes.
6278 case $mode in
6279 "") $echo \
6280 "Usage: $modename [OPTION]... [MODE-ARG]...
6282 Provide generalized library-building support services.
6284 --config show all configuration variables
6285 --debug enable verbose shell tracing
6286 -n, --dry-run display commands without modifying any files
6287 --features display basic configuration information and exit
6288 --finish same as \`--mode=finish'
6289 --help display this help message and exit
6290 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6291 --quiet same as \`--silent'
6292 --silent don't print informational messages
6293 --tag=TAG use configuration variables from tag TAG
6294 --version print version information
6296 MODE must be one of the following:
6298 clean remove files from the build directory
6299 compile compile a source file into a libtool object
6300 execute automatically set library path, then run a program
6301 finish complete the installation of libtool libraries
6302 install install libraries or executables
6303 link create a library or an executable
6304 uninstall remove libraries from an installed directory
6306 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6307 a more detailed description of MODE.
6309 Report bugs to <bug-libtool@gnu.org>."
6310 exit $EXIT_SUCCESS
6313 clean)
6314 $echo \
6315 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6317 Remove files from the build directory.
6319 RM is the name of the program to use to delete files associated with each FILE
6320 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6321 to RM.
6323 If FILE is a libtool library, object or program, all the files associated
6324 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6327 compile)
6328 $echo \
6329 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6331 Compile a source file into a libtool library object.
6333 This mode accepts the following additional options:
6335 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6336 -prefer-pic try to building PIC objects only
6337 -prefer-non-pic try to building non-PIC objects only
6338 -static always build a \`.o' file suitable for static linking
6340 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6341 from the given SOURCEFILE.
6343 The output file name is determined by removing the directory component from
6344 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6345 library object suffix, \`.lo'."
6348 execute)
6349 $echo \
6350 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6352 Automatically set library path, then run a program.
6354 This mode accepts the following additional options:
6356 -dlopen FILE add the directory containing FILE to the library path
6358 This mode sets the library path environment variable according to \`-dlopen'
6359 flags.
6361 If any of the ARGS are libtool executable wrappers, then they are translated
6362 into their corresponding uninstalled binary, and any of their required library
6363 directories are added to the library path.
6365 Then, COMMAND is executed, with ARGS as arguments."
6368 finish)
6369 $echo \
6370 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6372 Complete the installation of libtool libraries.
6374 Each LIBDIR is a directory that contains libtool libraries.
6376 The commands that this mode executes may require superuser privileges. Use
6377 the \`--dry-run' option if you just want to see what would be executed."
6380 install)
6381 $echo \
6382 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6384 Install executables or libraries.
6386 INSTALL-COMMAND is the installation command. The first component should be
6387 either the \`install' or \`cp' program.
6389 The rest of the components are interpreted as arguments to that command (only
6390 BSD-compatible install options are recognized)."
6393 link)
6394 $echo \
6395 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6397 Link object files or libraries together to form another library, or to
6398 create an executable program.
6400 LINK-COMMAND is a command using the C compiler that you would use to create
6401 a program from several object files.
6403 The following components of LINK-COMMAND are treated specially:
6405 -all-static do not do any dynamic linking at all
6406 -avoid-version do not add a version suffix if possible
6407 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6408 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6409 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6410 -export-symbols SYMFILE
6411 try to export only the symbols listed in SYMFILE
6412 -export-symbols-regex REGEX
6413 try to export only the symbols matching REGEX
6414 -LLIBDIR search LIBDIR for required installed libraries
6415 -lNAME OUTPUT-FILE requires the installed library libNAME
6416 -module build a library that can dlopened
6417 -no-fast-install disable the fast-install mode
6418 -no-install link a not-installable executable
6419 -no-undefined declare that a library does not refer to external symbols
6420 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6421 -objectlist FILE Use a list of object files found in FILE to specify objects
6422 -precious-files-regex REGEX
6423 don't remove output files matching REGEX
6424 -release RELEASE specify package release information
6425 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6426 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6427 -static do not do any dynamic linking of libtool libraries
6428 -version-info CURRENT[:REVISION[:AGE]]
6429 specify library version info [each variable defaults to 0]
6431 All other options (arguments beginning with \`-') are ignored.
6433 Every other argument is treated as a filename. Files ending in \`.la' are
6434 treated as uninstalled libtool libraries, other files are standard or library
6435 object files.
6437 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6438 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6439 required, except when creating a convenience library.
6441 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6442 using \`ar' and \`ranlib', or on Windows using \`lib'.
6444 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6445 is created, otherwise an executable program is created."
6448 uninstall)
6449 $echo \
6450 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6452 Remove libraries from an installation directory.
6454 RM is the name of the program to use to delete files associated with each FILE
6455 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6456 to RM.
6458 If FILE is a libtool library, all the files associated with it are deleted.
6459 Otherwise, only FILE itself is deleted using RM."
6463 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6464 $echo "$help" 1>&2
6465 exit $EXIT_FAILURE
6467 esac
6469 $echo
6470 $echo "Try \`$modename --help' for more information about other modes."
6472 exit $?
6474 # The TAGs below are defined such that we never get into a situation
6475 # in which we disable both kinds of libraries. Given conflicting
6476 # choices, we go for a static library, that is the most portable,
6477 # since we can't tell whether shared libraries were disabled because
6478 # the user asked for that or because the platform doesn't support
6479 # them. This is particularly important on AIX, because we don't
6480 # support having both static and shared libraries enabled at the same
6481 # time on that platform, so we default to a shared-only configuration.
6482 # If a disable-shared tag is given, we'll fallback to a static-only
6483 # configuration. But we'll never go from static-only to shared-only.
6485 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6486 build_libtool_libs=no
6487 build_old_libs=yes
6488 # ### END LIBTOOL TAG CONFIG: disable-shared
6490 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6491 build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
6492 # ### END LIBTOOL TAG CONFIG: disable-static
6494 # Local Variables:
6495 # mode:shell-script
6496 # sh-indentation:2
6497 # End: