* config/sparc/sparc.md (save_register_windowdi): Add missing mode.
[official-gcc.git] / libjava / libltdl / ltmain.sh
blob036c65e519b87b515442145017d4851eced7925b
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
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 # Check that we have a working $echo.
28 if test "X$1" = X--no-reexec; then
29 # Discard the --no-reexec flag, and continue.
30 shift
31 elif test "X$1" = X--fallback-echo; then
32 # Avoid inline document here, it may be left over
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35 # Yippee, $echo works!
37 else
38 # Restart under the correct shell, and then maybe $echo will work.
39 exec $SHELL "$0" --no-reexec ${1+"$@"}
42 if test "X$1" = X--fallback-echo; then
43 # used as fallback echo
44 shift
45 cat <<EOF
47 EOF
48 exit 0
51 # The name of this program.
52 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
53 modename="$progname"
55 # Constants.
56 PROGRAM=ltmain.sh
57 PACKAGE=libtool
58 VERSION=1.5.0a
59 TIMESTAMP=" (1.1220.2.25 2003/08/01 19:08:35) Debian$Rev: 49 $"
61 default_mode=
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
64 mkdir="mkdir"
65 mv="mv -f"
66 rm="rm -f"
68 # Sed substitution that helps us do robust quoting. It backslashifies
69 # metacharacters that are still active within double-quoted strings.
70 Xsed="${SED}"' -e 1s/^X//'
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72 # test EBCDIC or ASCII
73 case `echo A|tr A '\301'` in
74 A) # EBCDIC based system
75 SP2NL="tr '\100' '\n'"
76 NL2SP="tr '\r\n' '\100\100'"
78 *) # Assume ASCII based system
79 SP2NL="tr '\040' '\012'"
80 NL2SP="tr '\015\012' '\040\040'"
82 esac
84 # NLS nuisances.
85 # Only set LANG and LC_ALL to C if already set.
86 # These must not be set unconditionally because not all systems understand
87 # e.g. LANG=C (notably SCO).
88 # We save the old values to restore during execute mode.
89 if test "${LC_ALL+set}" = set; then
90 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
92 if test "${LANG+set}" = set; then
93 save_LANG="$LANG"; LANG=C; export LANG
96 # Make sure IFS has a sensible default
97 : ${IFS="
100 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
101 $echo "$modename: not configured to build any kind of library" 1>&2
102 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
103 exit 1
106 # Global variables.
107 mode=$default_mode
108 nonopt=
109 prev=
110 prevopt=
111 run=
112 show="$echo"
113 show_help=
114 execute_dlfiles=
115 lo2o="s/\\.lo\$/.${objext}/"
116 o2lo="s/\\.${objext}\$/.lo/"
118 #####################################
119 # Shell function definitions:
120 # This seems to be the best place for them
122 # Need a lot of goo to handle *both* DLLs and import libs
123 # Has to be a shell function in order to 'eat' the argument
124 # that is supplied when $file_magic_command is called.
125 win32_libid () {
126 win32_libid_type="unknown"
127 win32_fileres=`file -L $1 2>/dev/null`
128 case $win32_fileres in
129 *ar\ archive\ import\ library*) # definitely import
130 win32_libid_type="x86 archive import"
132 *ar\ archive*) # could be an import, or static
133 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
134 grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
135 win32_nmres=`eval $NM -f posix -A $1 | \
136 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
137 if test "X$win32_nmres" = "Ximport" ; then
138 win32_libid_type="x86 archive import"
139 else
140 win32_libid_type="x86 archive static"
144 *DLL*)
145 win32_libid_type="x86 DLL"
147 *executable*) # but shell scripts are "executable" too...
148 case $win32_fileres in
149 *MS\ Windows\ PE\ Intel*)
150 win32_libid_type="x86 DLL"
152 esac
154 esac
155 $echo $win32_libid_type
158 # End of Shell function definitions
159 #####################################
161 # Parse our command line options once, thoroughly.
162 while test "$#" -gt 0
164 arg="$1"
165 shift
167 case $arg in
168 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
169 *) optarg= ;;
170 esac
172 # If the previous option needs an argument, assign it.
173 if test -n "$prev"; then
174 case $prev in
175 execute_dlfiles)
176 execute_dlfiles="$execute_dlfiles $arg"
178 tag)
179 tagname="$arg"
181 # Check whether tagname contains only valid characters
182 case $tagname in
183 *[!-_A-Za-z0-9,/]*)
184 $echo "$progname: invalid tag name: $tagname" 1>&2
185 exit 1
187 esac
189 case $tagname in
191 # Don't test for the "default" C tag, as we know, it's there, but
192 # not specially marked.
195 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
196 taglist="$taglist $tagname"
197 # Evaluate the configuration.
198 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
199 else
200 $echo "$progname: ignoring unknown tag $tagname" 1>&2
203 esac
206 eval "$prev=\$arg"
208 esac
210 prev=
211 prevopt=
212 continue
215 # Have we seen a non-optional argument yet?
216 case $arg in
217 --help)
218 show_help=yes
221 --version)
222 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
223 $echo
224 $echo "Copyright (C) 2003 Free Software Foundation, Inc."
225 $echo "This is free software; see the source for copying conditions. There is NO"
226 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
227 exit 0
230 --config)
231 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
232 # Now print the configurations for the tags.
233 for tagname in $taglist; do
234 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
235 done
236 exit 0
239 --debug)
240 $echo "$progname: enabling shell trace mode"
241 set -x
244 --dry-run | -n)
245 run=:
248 --features)
249 $echo "host: $host"
250 if test "$build_libtool_libs" = yes; then
251 $echo "enable shared libraries"
252 else
253 $echo "disable shared libraries"
255 if test "$build_old_libs" = yes; then
256 $echo "enable static libraries"
257 else
258 $echo "disable static libraries"
260 exit 0
263 --finish) mode="finish" ;;
265 --mode) prevopt="--mode" prev=mode ;;
266 --mode=*) mode="$optarg" ;;
268 --preserve-dup-deps) duplicate_deps="yes" ;;
270 --quiet | --silent)
271 show=:
274 --tag) prevopt="--tag" prev=tag ;;
275 --tag=*)
276 set tag "$optarg" ${1+"$@"}
277 shift
278 prev=tag
281 -dlopen)
282 prevopt="-dlopen"
283 prev=execute_dlfiles
287 $echo "$modename: unrecognized option \`$arg'" 1>&2
288 $echo "$help" 1>&2
289 exit 1
293 nonopt="$arg"
294 break
296 esac
297 done
299 if test -n "$prevopt"; then
300 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
301 $echo "$help" 1>&2
302 exit 1
305 # If this variable is set in any of the actions, the command in it
306 # will be execed at the end. This prevents here-documents from being
307 # left over by shells.
308 exec_cmd=
310 if test -z "$show_help"; then
312 # Infer the operation mode.
313 if test -z "$mode"; then
314 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
315 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
316 case $nonopt in
317 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
318 mode=link
319 for arg
321 case $arg in
323 mode=compile
324 break
326 esac
327 done
329 *db | *dbx | *strace | *truss)
330 mode=execute
332 *install*|cp|mv)
333 mode=install
335 *rm)
336 mode=uninstall
339 # If we have no mode, but dlfiles were specified, then do execute mode.
340 test -n "$execute_dlfiles" && mode=execute
342 # Just use the default operation mode.
343 if test -z "$mode"; then
344 if test -n "$nonopt"; then
345 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
346 else
347 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
351 esac
354 # Only execute mode is allowed to have -dlopen flags.
355 if test -n "$execute_dlfiles" && test "$mode" != execute; then
356 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
357 $echo "$help" 1>&2
358 exit 1
361 # Change the help message to a mode-specific one.
362 generic_help="$help"
363 help="Try \`$modename --help --mode=$mode' for more information."
365 # These modes are in order of execution frequency so that they run quickly.
366 case $mode in
367 # libtool compile mode
368 compile)
369 modename="$modename: compile"
370 # Get the compilation command and the source file.
371 base_compile=
372 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
373 suppress_output=
374 arg_mode=normal
375 libobj=
377 for arg
379 case "$arg_mode" in
380 arg )
381 # do not "continue". Instead, add this to base_compile
382 lastarg="$arg"
383 arg_mode=normal
386 target )
387 libobj="$arg"
388 arg_mode=normal
389 continue
392 normal )
393 # Accept any command-line options.
394 case $arg in
396 if test -n "$libobj" ; then
397 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
398 exit 1
400 arg_mode=target
401 continue
404 -static)
405 build_old_libs=yes
406 continue
409 -prefer-pic)
410 pic_mode=yes
411 continue
414 -prefer-non-pic)
415 pic_mode=no
416 continue
419 -Xcompiler)
420 arg_mode=arg # the next one goes into the "base_compile" arg list
421 continue # The current "srcfile" will either be retained or
422 ;; # replaced later. I would guess that would be a bug.
424 -Wc,*)
425 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
426 lastarg=
427 save_ifs="$IFS"; IFS=','
428 for arg in $args; do
429 IFS="$save_ifs"
431 # Double-quote args containing other shell metacharacters.
432 # Many Bourne shells cannot handle close brackets correctly
433 # in scan sets, so we specify it separately.
434 case $arg in
435 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
436 arg="\"$arg\""
438 esac
439 lastarg="$lastarg $arg"
440 done
441 IFS="$save_ifs"
442 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
444 # Add the arguments to base_compile.
445 base_compile="$base_compile $lastarg"
446 continue
450 # Accept the current argument as the source file.
451 # The previous "srcfile" becomes the current argument.
453 lastarg="$srcfile"
454 srcfile="$arg"
456 esac # case $arg
458 esac # case $arg_mode
460 # Aesthetically quote the previous argument.
461 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
463 case $lastarg in
464 # Double-quote args containing other shell metacharacters.
465 # Many Bourne shells cannot handle close brackets correctly
466 # in scan sets, so we specify it separately.
467 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
468 lastarg="\"$lastarg\""
470 esac
472 base_compile="$base_compile $lastarg"
473 done # for arg
475 case $arg_mode in
476 arg)
477 $echo "$modename: you must specify an argument for -Xcompile"
478 exit 1
480 target)
481 $echo "$modename: you must specify a target with \`-o'" 1>&2
482 exit 1
485 # Get the name of the library object.
486 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
488 esac
490 # Recognize several different file suffixes.
491 # If the user specifies -o file.o, it is replaced with file.lo
492 xform='[cCFSifmso]'
493 case $libobj in
494 *.ada) xform=ada ;;
495 *.adb) xform=adb ;;
496 *.ads) xform=ads ;;
497 *.asm) xform=asm ;;
498 *.c++) xform=c++ ;;
499 *.cc) xform=cc ;;
500 *.ii) xform=ii ;;
501 *.class) xform=class ;;
502 *.cpp) xform=cpp ;;
503 *.cxx) xform=cxx ;;
504 *.f90) xform=f90 ;;
505 *.for) xform=for ;;
506 *.java) xform=java ;;
507 esac
509 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
511 case $libobj in
512 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
514 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
515 exit 1
517 esac
519 # Infer tagged configuration to use if any are available and
520 # if one wasn't chosen via the "--tag" command line option.
521 # Only attempt this if the compiler in the base compile
522 # command doesn't match the default compiler.
523 if test -n "$available_tags" && test -z "$tagname"; then
524 case $base_compile in
525 # Blanks in the command may have been stripped by the calling shell,
526 # but not from the CC environment variable when configure was run.
527 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
528 # Blanks at the start of $base_compile will cause this to fail
529 # if we don't check for them as well.
531 for z in $available_tags; do
532 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
533 # Evaluate the configuration.
534 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
535 case "$base_compile " in
536 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
537 # The compiler in the base compile command matches
538 # the one in the tagged configuration.
539 # Assume this is the tagged configuration we want.
540 tagname=$z
541 break
543 esac
545 done
546 # If $tagname still isn't set, then no tagged configuration
547 # was found and let the user know that the "--tag" command
548 # line option must be used.
549 if test -z "$tagname"; then
550 $echo "$modename: unable to infer tagged configuration"
551 $echo "$modename: specify a tag with \`--tag'" 1>&2
552 exit 1
553 # else
554 # $echo "$modename: using $tagname tagged configuration"
557 esac
560 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
561 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
562 if test "X$xdir" = "X$obj"; then
563 xdir=
564 else
565 xdir=$xdir/
567 lobj=${xdir}$objdir/$objname
569 if test -z "$base_compile"; then
570 $echo "$modename: you must specify a compilation command" 1>&2
571 $echo "$help" 1>&2
572 exit 1
575 # Delete any leftover library objects.
576 if test "$build_old_libs" = yes; then
577 removelist="$obj $lobj $libobj ${libobj}T"
578 else
579 removelist="$lobj $libobj ${libobj}T"
582 $run $rm $removelist
583 trap "$run $rm $removelist; exit 1" 1 2 15
585 # On Cygwin there's no "real" PIC flag so we must build both object types
586 case $host_os in
587 cygwin* | mingw* | pw32* | os2*)
588 pic_mode=default
590 esac
591 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
592 # non-PIC code in shared libraries is not supported
593 pic_mode=default
596 # Calculate the filename of the output object if compiler does
597 # not support -o with -c
598 if test "$compiler_c_o" = no; then
599 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
600 lockfile="$output_obj.lock"
601 removelist="$removelist $output_obj $lockfile"
602 trap "$run $rm $removelist; exit 1" 1 2 15
603 else
604 output_obj=
605 need_locks=no
606 lockfile=
609 # Lock this critical section if it is needed
610 # We use this script file to make the link, it avoids creating a new file
611 if test "$need_locks" = yes; then
612 until $run ln "$0" "$lockfile" 2>/dev/null; do
613 $show "Waiting for $lockfile to be removed"
614 sleep 2
615 done
616 elif test "$need_locks" = warn; then
617 if test -f "$lockfile"; then
618 $echo "\
619 *** ERROR, $lockfile exists and contains:
620 `cat $lockfile 2>/dev/null`
622 This indicates that another process is trying to use the same
623 temporary object file, and libtool could not work around it because
624 your compiler does not support \`-c' and \`-o' together. If you
625 repeat this compilation, it may succeed, by chance, but you had better
626 avoid parallel builds (make -j) in this platform, or get a better
627 compiler."
629 $run $rm $removelist
630 exit 1
632 $echo $srcfile > "$lockfile"
635 if test -n "$fix_srcfile_path"; then
636 eval srcfile=\"$fix_srcfile_path\"
639 $run $rm "$libobj" "${libobj}T"
641 # Create a libtool object file (analogous to a ".la" file),
642 # but don't create it if we're doing a dry run.
643 test -z "$run" && cat > ${libobj}T <<EOF
644 # $libobj - a libtool object file
645 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
647 # Please DO NOT delete this file!
648 # It is necessary for linking the library.
650 # Name of the PIC object.
653 # Only build a PIC object if we are building libtool libraries.
654 if test "$build_libtool_libs" = yes; then
655 # Without this assignment, base_compile gets emptied.
656 fbsd_hideous_sh_bug=$base_compile
658 if test "$pic_mode" != no; then
659 command="$base_compile $srcfile $pic_flag"
660 else
661 # Don't build PIC code
662 command="$base_compile $srcfile"
665 if test ! -d "${xdir}$objdir"; then
666 $show "$mkdir ${xdir}$objdir"
667 $run $mkdir ${xdir}$objdir
668 status=$?
669 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
670 exit $status
674 if test -z "$output_obj"; then
675 # Place PIC objects in $objdir
676 command="$command -o $lobj"
679 $run $rm "$lobj" "$output_obj"
681 $show "$command"
682 if $run eval "$command"; then :
683 else
684 test -n "$output_obj" && $run $rm $removelist
685 exit 1
688 if test "$need_locks" = warn &&
689 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
690 $echo "\
691 *** ERROR, $lockfile contains:
692 `cat $lockfile 2>/dev/null`
694 but it should contain:
695 $srcfile
697 This indicates that another process is trying to use the same
698 temporary object file, and libtool could not work around it because
699 your compiler does not support \`-c' and \`-o' together. If you
700 repeat this compilation, it may succeed, by chance, but you had better
701 avoid parallel builds (make -j) in this platform, or get a better
702 compiler."
704 $run $rm $removelist
705 exit 1
708 # Just move the object if needed, then go on to compile the next one
709 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
710 $show "$mv $output_obj $lobj"
711 if $run $mv $output_obj $lobj; then :
712 else
713 error=$?
714 $run $rm $removelist
715 exit $error
719 # Append the name of the PIC object to the libtool object file.
720 test -z "$run" && cat >> ${libobj}T <<EOF
721 pic_object='$objdir/$objname'
725 # Allow error messages only from the first compilation.
726 suppress_output=' >/dev/null 2>&1'
727 else
728 # No PIC object so indicate it doesn't exist in the libtool
729 # object file.
730 test -z "$run" && cat >> ${libobj}T <<EOF
731 pic_object=none
736 # Only build a position-dependent object if we build old libraries.
737 if test "$build_old_libs" = yes; then
738 if test "$pic_mode" != yes; then
739 # Don't build PIC code
740 command="$base_compile $srcfile"
741 else
742 command="$base_compile $srcfile $pic_flag"
744 if test "$compiler_c_o" = yes; then
745 command="$command -o $obj"
748 # Suppress compiler output if we already did a PIC compilation.
749 command="$command$suppress_output"
750 $run $rm "$obj" "$output_obj"
751 $show "$command"
752 if $run eval "$command"; then :
753 else
754 $run $rm $removelist
755 exit 1
758 if test "$need_locks" = warn &&
759 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
760 $echo "\
761 *** ERROR, $lockfile contains:
762 `cat $lockfile 2>/dev/null`
764 but it should contain:
765 $srcfile
767 This indicates that another process is trying to use the same
768 temporary object file, and libtool could not work around it because
769 your compiler does not support \`-c' and \`-o' together. If you
770 repeat this compilation, it may succeed, by chance, but you had better
771 avoid parallel builds (make -j) in this platform, or get a better
772 compiler."
774 $run $rm $removelist
775 exit 1
778 # Just move the object if needed
779 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
780 $show "$mv $output_obj $obj"
781 if $run $mv $output_obj $obj; then :
782 else
783 error=$?
784 $run $rm $removelist
785 exit $error
789 # Append the name of the non-PIC object the libtool object file.
790 # Only append if the libtool object file exists.
791 test -z "$run" && cat >> ${libobj}T <<EOF
792 # Name of the non-PIC object.
793 non_pic_object='$objname'
796 else
797 # Append the name of the non-PIC object the libtool object file.
798 # Only append if the libtool object file exists.
799 test -z "$run" && cat >> ${libobj}T <<EOF
800 # Name of the non-PIC object.
801 non_pic_object=none
806 $run $mv "${libobj}T" "${libobj}"
808 # Unlock the critical section if it was locked
809 if test "$need_locks" != no; then
810 $run $rm "$lockfile"
813 exit 0
816 # libtool link mode
817 link | relink)
818 modename="$modename: link"
819 case $host in
820 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
821 # It is impossible to link a dll without this setting, and
822 # we shouldn't force the makefile maintainer to figure out
823 # which system we are compiling for in order to pass an extra
824 # flag for every libtool invocation.
825 # allow_undefined=no
827 # FIXME: Unfortunately, there are problems with the above when trying
828 # to make a dll which has undefined symbols, in which case not
829 # even a static library is built. For now, we need to specify
830 # -no-undefined on the libtool link line when we can be certain
831 # that all symbols are satisfied, otherwise we get a static library.
832 allow_undefined=yes
835 allow_undefined=yes
837 esac
838 libtool_args="$nonopt"
839 base_compile="$nonopt"
840 compile_command="$nonopt"
841 finalize_command="$nonopt"
843 compile_rpath=
844 finalize_rpath=
845 compile_shlibpath=
846 finalize_shlibpath=
847 convenience=
848 old_convenience=
849 deplibs=
850 old_deplibs=
851 compiler_flags=
852 linker_flags=
853 dllsearchpath=
854 lib_search_path=`pwd`
855 inst_prefix_dir=
857 avoid_version=no
858 dlfiles=
859 dlprefiles=
860 dlself=no
861 export_dynamic=no
862 export_symbols=
863 export_symbols_regex=
864 generated=
865 libobjs=
866 ltlibs=
867 module=no
868 no_install=no
869 objs=
870 non_pic_objects=
871 prefer_static_libs=no
872 preload=no
873 prev=
874 prevarg=
875 release=
876 rpath=
877 xrpath=
878 perm_rpath=
879 temp_rpath=
880 thread_safe=no
881 vinfo=
882 vinfo_number=no
884 # We need to know -static, to get the right output filenames.
885 for arg
887 case $arg in
888 -all-static | -static)
889 if test "X$arg" = "X-all-static"; then
890 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
891 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
893 if test -n "$link_static_flag"; then
894 dlopen_self=$dlopen_self_static
896 else
897 if test -z "$pic_flag" && test -n "$link_static_flag"; then
898 dlopen_self=$dlopen_self_static
901 build_libtool_libs=no
902 build_old_libs=yes
903 prefer_static_libs=yes
904 break
906 esac
907 done
909 # See if our shared archives depend on static archives.
910 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
912 # Go through the arguments, transforming them on the way.
913 while test "$#" -gt 0; do
914 arg="$1"
915 base_compile="$base_compile $arg"
916 shift
917 case $arg in
918 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
919 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
921 *) qarg=$arg ;;
922 esac
923 libtool_args="$libtool_args $qarg"
925 # If the previous option needs an argument, assign it.
926 if test -n "$prev"; then
927 case $prev in
928 output)
929 compile_command="$compile_command @OUTPUT@"
930 finalize_command="$finalize_command @OUTPUT@"
932 esac
934 case $prev in
935 dlfiles|dlprefiles)
936 if test "$preload" = no; then
937 # Add the symbol object into the linking commands.
938 compile_command="$compile_command @SYMFILE@"
939 finalize_command="$finalize_command @SYMFILE@"
940 preload=yes
942 case $arg in
943 *.la | *.lo) ;; # We handle these cases below.
944 force)
945 if test "$dlself" = no; then
946 dlself=needless
947 export_dynamic=yes
949 prev=
950 continue
952 self)
953 if test "$prev" = dlprefiles; then
954 dlself=yes
955 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
956 dlself=yes
957 else
958 dlself=needless
959 export_dynamic=yes
961 prev=
962 continue
965 if test "$prev" = dlfiles; then
966 dlfiles="$dlfiles $arg"
967 else
968 dlprefiles="$dlprefiles $arg"
970 prev=
971 continue
973 esac
975 expsyms)
976 export_symbols="$arg"
977 if test ! -f "$arg"; then
978 $echo "$modename: symbol file \`$arg' does not exist"
979 exit 1
981 prev=
982 continue
984 expsyms_regex)
985 export_symbols_regex="$arg"
986 prev=
987 continue
989 inst_prefix)
990 inst_prefix_dir="$arg"
991 prev=
992 continue
994 release)
995 release="-$arg"
996 prev=
997 continue
999 objectlist)
1000 if test -f "$arg"; then
1001 save_arg=$arg
1002 moreargs=
1003 for fil in `cat $save_arg`
1005 # moreargs="$moreargs $fil"
1006 arg=$fil
1007 # A libtool-controlled object.
1009 # Check to see that this really is a libtool object.
1010 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1011 pic_object=
1012 non_pic_object=
1014 # Read the .lo file
1015 # If there is no directory component, then add one.
1016 case $arg in
1017 */* | *\\*) . $arg ;;
1018 *) . ./$arg ;;
1019 esac
1021 if test -z "$pic_object" || \
1022 test -z "$non_pic_object" ||
1023 test "$pic_object" = none && \
1024 test "$non_pic_object" = none; then
1025 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1026 exit 1
1029 # Extract subdirectory from the argument.
1030 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1031 if test "X$xdir" = "X$arg"; then
1032 xdir=
1033 else
1034 xdir="$xdir/"
1037 if test "$pic_object" != none; then
1038 # Prepend the subdirectory the object is found in.
1039 pic_object="$xdir$pic_object"
1041 if test "$prev" = dlfiles; then
1042 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1043 dlfiles="$dlfiles $pic_object"
1044 prev=
1045 continue
1046 else
1047 # If libtool objects are unsupported, then we need to preload.
1048 prev=dlprefiles
1052 # CHECK ME: I think I busted this. -Ossama
1053 if test "$prev" = dlprefiles; then
1054 # Preload the old-style object.
1055 dlprefiles="$dlprefiles $pic_object"
1056 prev=
1059 # A PIC object.
1060 libobjs="$libobjs $pic_object"
1061 arg="$pic_object"
1064 # Non-PIC object.
1065 if test "$non_pic_object" != none; then
1066 # Prepend the subdirectory the object is found in.
1067 non_pic_object="$xdir$non_pic_object"
1069 # A standard non-PIC object
1070 non_pic_objects="$non_pic_objects $non_pic_object"
1071 if test -z "$pic_object" || test "$pic_object" = none ; then
1072 arg="$non_pic_object"
1075 else
1076 # Only an error if not doing a dry-run.
1077 if test -z "$run"; then
1078 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1079 exit 1
1080 else
1081 # Dry-run case.
1083 # Extract subdirectory from the argument.
1084 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1085 if test "X$xdir" = "X$arg"; then
1086 xdir=
1087 else
1088 xdir="$xdir/"
1091 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1092 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1093 libobjs="$libobjs $pic_object"
1094 non_pic_objects="$non_pic_objects $non_pic_object"
1097 done
1098 else
1099 $echo "$modename: link input file \`$save_arg' does not exist"
1100 exit 1
1102 arg=$save_arg
1103 prev=
1104 continue
1106 rpath | xrpath)
1107 # We need an absolute path.
1108 case $arg in
1109 [\\/]* | [A-Za-z]:[\\/]*) ;;
1111 $echo "$modename: only absolute run-paths are allowed" 1>&2
1112 exit 1
1114 esac
1115 if test "$prev" = rpath; then
1116 case "$rpath " in
1117 *" $arg "*) ;;
1118 *) rpath="$rpath $arg" ;;
1119 esac
1120 else
1121 case "$xrpath " in
1122 *" $arg "*) ;;
1123 *) xrpath="$xrpath $arg" ;;
1124 esac
1126 prev=
1127 continue
1129 xcompiler)
1130 compiler_flags="$compiler_flags $qarg"
1131 prev=
1132 compile_command="$compile_command $qarg"
1133 finalize_command="$finalize_command $qarg"
1134 continue
1136 xlinker)
1137 linker_flags="$linker_flags $qarg"
1138 compiler_flags="$compiler_flags $wl$qarg"
1139 prev=
1140 compile_command="$compile_command $wl$qarg"
1141 finalize_command="$finalize_command $wl$qarg"
1142 continue
1144 xcclinker)
1145 linker_flags="$linker_flags $qarg"
1146 compiler_flags="$compiler_flags $qarg"
1147 prev=
1148 compile_command="$compile_command $qarg"
1149 finalize_command="$finalize_command $qarg"
1150 continue
1153 eval "$prev=\"\$arg\""
1154 prev=
1155 continue
1157 esac
1158 fi # test -n "$prev"
1160 prevarg="$arg"
1162 case $arg in
1163 -all-static)
1164 if test -n "$link_static_flag"; then
1165 compile_command="$compile_command $link_static_flag"
1166 finalize_command="$finalize_command $link_static_flag"
1168 continue
1171 -allow-undefined)
1172 # FIXME: remove this flag sometime in the future.
1173 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1174 continue
1177 -avoid-version)
1178 avoid_version=yes
1179 continue
1182 -dlopen)
1183 prev=dlfiles
1184 continue
1187 -dlpreopen)
1188 prev=dlprefiles
1189 continue
1192 -export-dynamic)
1193 export_dynamic=yes
1194 continue
1197 -export-symbols | -export-symbols-regex)
1198 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1199 $echo "$modename: more than one -exported-symbols argument is not allowed"
1200 exit 1
1202 if test "X$arg" = "X-export-symbols"; then
1203 prev=expsyms
1204 else
1205 prev=expsyms_regex
1207 continue
1210 -inst-prefix-dir)
1211 prev=inst_prefix
1212 continue
1215 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1216 # so, if we see these flags be careful not to treat them like -L
1217 -L[A-Z][A-Z]*:*)
1218 case $with_gcc/$host in
1219 no/*-*-irix* | /*-*-irix*)
1220 compile_command="$compile_command $arg"
1221 finalize_command="$finalize_command $arg"
1223 esac
1224 continue
1227 -L*)
1228 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1229 # We need an absolute path.
1230 case $dir in
1231 [\\/]* | [A-Za-z]:[\\/]*) ;;
1233 absdir=`cd "$dir" && pwd`
1234 if test -z "$absdir"; then
1235 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1236 exit 1
1238 dir="$absdir"
1240 esac
1241 case "$deplibs " in
1242 *" -L$dir "*) ;;
1244 deplibs="$deplibs -L$dir"
1245 lib_search_path="$lib_search_path $dir"
1247 esac
1248 case $host in
1249 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1250 case :$dllsearchpath: in
1251 *":$dir:"*) ;;
1252 *) dllsearchpath="$dllsearchpath:$dir";;
1253 esac
1255 esac
1256 continue
1259 -l*)
1260 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1261 case $host in
1262 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1263 # These systems don't actually have a C or math library (as such)
1264 continue
1266 *-*-mingw* | *-*-os2*)
1267 # These systems don't actually have a C library (as such)
1268 test "X$arg" = "X-lc" && continue
1270 *-*-openbsd* | *-*-freebsd*)
1271 # Do not include libc due to us having libc/libc_r.
1272 test "X$arg" = "X-lc" && continue
1274 *-*-rhapsody* | *-*-darwin1.[012])
1275 # Rhapsody C and math libraries are in the System framework
1276 deplibs="$deplibs -framework System"
1277 continue
1278 esac
1279 elif test "X$arg" = "X-lc_r"; then
1280 case $host in
1281 *-*-openbsd* | *-*-freebsd*)
1282 # Do not include libc_r directly, use -pthread flag.
1283 continue
1285 esac
1287 deplibs="$deplibs $arg"
1288 continue
1291 -module)
1292 module=yes
1293 continue
1296 # gcc -m* arguments should be passed to the linker via $compiler_flags
1297 # in order to pass architecture information to the linker
1298 # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
1299 # but this is not reliable with gcc because gcc may use -mfoo to
1300 # select a different linker, different libraries, etc, while
1301 # -Wl,-mfoo simply passes -mfoo to the linker.
1302 -m*)
1303 # Unknown arguments in both finalize_command and compile_command need
1304 # to be aesthetically quoted because they are evaled later.
1305 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1306 case $arg in
1307 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1308 arg="\"$arg\""
1310 esac
1311 compile_command="$compile_command $arg"
1312 finalize_command="$finalize_command $arg"
1313 if test "$with_gcc" = "yes" ; then
1314 compiler_flags="$compiler_flags $arg"
1316 continue
1319 -shrext)
1320 prev=shrext
1321 continue
1324 -no-fast-install)
1325 fast_install=no
1326 continue
1329 -no-install)
1330 case $host in
1331 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1332 # The PATH hackery in wrapper scripts is required on Windows
1333 # in order for the loader to find any dlls it needs.
1334 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1335 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1336 fast_install=no
1338 *) no_install=yes ;;
1339 esac
1340 continue
1343 -no-undefined)
1344 allow_undefined=no
1345 continue
1348 -objectlist)
1349 prev=objectlist
1350 continue
1353 -o) prev=output ;;
1355 -release)
1356 prev=release
1357 continue
1360 -rpath)
1361 prev=rpath
1362 continue
1366 prev=xrpath
1367 continue
1370 -R*)
1371 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1372 # We need an absolute path.
1373 case $dir in
1374 [\\/]* | [A-Za-z]:[\\/]*) ;;
1376 $echo "$modename: only absolute run-paths are allowed" 1>&2
1377 exit 1
1379 esac
1380 case "$xrpath " in
1381 *" $dir "*) ;;
1382 *) xrpath="$xrpath $dir" ;;
1383 esac
1384 continue
1387 -static)
1388 # The effects of -static are defined in a previous loop.
1389 # We used to do the same as -all-static on platforms that
1390 # didn't have a PIC flag, but the assumption that the effects
1391 # would be equivalent was wrong. It would break on at least
1392 # Digital Unix and AIX.
1393 continue
1396 -thread-safe)
1397 thread_safe=yes
1398 continue
1401 -version-info)
1402 prev=vinfo
1403 continue
1405 -version-number)
1406 prev=vinfo
1407 vinfo_number=yes
1408 continue
1411 -Wc,*)
1412 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1413 arg=
1414 save_ifs="$IFS"; IFS=','
1415 for flag in $args; do
1416 IFS="$save_ifs"
1417 case $flag in
1418 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1419 flag="\"$flag\""
1421 esac
1422 arg="$arg $wl$flag"
1423 compiler_flags="$compiler_flags $flag"
1424 done
1425 IFS="$save_ifs"
1426 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1429 -Wl,*)
1430 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1431 arg=
1432 save_ifs="$IFS"; IFS=','
1433 for flag in $args; do
1434 IFS="$save_ifs"
1435 case $flag in
1436 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1437 flag="\"$flag\""
1439 esac
1440 arg="$arg $wl$flag"
1441 compiler_flags="$compiler_flags $wl$flag"
1442 linker_flags="$linker_flags $flag"
1443 done
1444 IFS="$save_ifs"
1445 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1448 -Xcompiler)
1449 prev=xcompiler
1450 continue
1453 -Xlinker)
1454 prev=xlinker
1455 continue
1458 -XCClinker)
1459 prev=xcclinker
1460 continue
1463 # Some other compiler flag.
1464 -* | +*)
1465 # Unknown arguments in both finalize_command and compile_command need
1466 # to be aesthetically quoted because they are evaled later.
1467 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1468 case $arg in
1469 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1470 arg="\"$arg\""
1472 esac
1475 *.$objext)
1476 # A standard object.
1477 objs="$objs $arg"
1480 *.lo)
1481 # A libtool-controlled object.
1483 # Check to see that this really is a libtool object.
1484 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1485 pic_object=
1486 non_pic_object=
1488 # Read the .lo file
1489 # If there is no directory component, then add one.
1490 case $arg in
1491 */* | *\\*) . $arg ;;
1492 *) . ./$arg ;;
1493 esac
1495 if test -z "$pic_object" || \
1496 test -z "$non_pic_object" ||
1497 test "$pic_object" = none && \
1498 test "$non_pic_object" = none; then
1499 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1500 exit 1
1503 # Extract subdirectory from the argument.
1504 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1505 if test "X$xdir" = "X$arg"; then
1506 xdir=
1507 else
1508 xdir="$xdir/"
1511 if test "$pic_object" != none; then
1512 # Prepend the subdirectory the object is found in.
1513 pic_object="$xdir$pic_object"
1515 if test "$prev" = dlfiles; then
1516 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1517 dlfiles="$dlfiles $pic_object"
1518 prev=
1519 continue
1520 else
1521 # If libtool objects are unsupported, then we need to preload.
1522 prev=dlprefiles
1526 # CHECK ME: I think I busted this. -Ossama
1527 if test "$prev" = dlprefiles; then
1528 # Preload the old-style object.
1529 dlprefiles="$dlprefiles $pic_object"
1530 prev=
1533 # A PIC object.
1534 libobjs="$libobjs $pic_object"
1535 arg="$pic_object"
1538 # Non-PIC object.
1539 if test "$non_pic_object" != none; then
1540 # Prepend the subdirectory the object is found in.
1541 non_pic_object="$xdir$non_pic_object"
1543 # A standard non-PIC object
1544 non_pic_objects="$non_pic_objects $non_pic_object"
1545 if test -z "$pic_object" || test "$pic_object" = none ; then
1546 arg="$non_pic_object"
1549 else
1550 # Only an error if not doing a dry-run.
1551 if test -z "$run"; then
1552 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1553 exit 1
1554 else
1555 # Dry-run case.
1557 # Extract subdirectory from the argument.
1558 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1559 if test "X$xdir" = "X$arg"; then
1560 xdir=
1561 else
1562 xdir="$xdir/"
1565 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1566 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1567 libobjs="$libobjs $pic_object"
1568 non_pic_objects="$non_pic_objects $non_pic_object"
1573 *.$libext)
1574 # An archive.
1575 deplibs="$deplibs $arg"
1576 old_deplibs="$old_deplibs $arg"
1577 continue
1580 *.la)
1581 # A libtool-controlled library.
1583 if test "$prev" = dlfiles; then
1584 # This library was specified with -dlopen.
1585 dlfiles="$dlfiles $arg"
1586 prev=
1587 elif test "$prev" = dlprefiles; then
1588 # The library was specified with -dlpreopen.
1589 dlprefiles="$dlprefiles $arg"
1590 prev=
1591 else
1592 deplibs="$deplibs $arg"
1594 continue
1597 # Some other compiler argument.
1599 # Unknown arguments in both finalize_command and compile_command need
1600 # to be aesthetically quoted because they are evaled later.
1601 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1602 case $arg in
1603 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1604 arg="\"$arg\""
1606 esac
1608 esac # arg
1610 # Now actually substitute the argument into the commands.
1611 if test -n "$arg"; then
1612 compile_command="$compile_command $arg"
1613 finalize_command="$finalize_command $arg"
1615 done # argument parsing loop
1617 if test -n "$prev"; then
1618 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1619 $echo "$help" 1>&2
1620 exit 1
1623 # Infer tagged configuration to use if any are available and
1624 # if one wasn't chosen via the "--tag" command line option.
1625 # Only attempt this if the compiler in the base link
1626 # command doesn't match the default compiler.
1627 if test -n "$available_tags" && test -z "$tagname"; then
1628 case $base_compile in
1629 # Blanks in the command may have been stripped by the calling shell,
1630 # but not from the CC environment variable when configure was run.
1631 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1632 # Blanks at the start of $base_compile will cause this to fail
1633 # if we don't check for them as well.
1635 for z in $available_tags; do
1636 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1637 # Evaluate the configuration.
1638 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1639 case $base_compile in
1640 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1641 # The compiler in $compile_command matches
1642 # the one in the tagged configuration.
1643 # Assume this is the tagged configuration we want.
1644 tagname=$z
1645 break
1647 esac
1649 done
1650 # If $tagname still isn't set, then no tagged configuration
1651 # was found and let the user know that the "--tag" command
1652 # line option must be used.
1653 if test -z "$tagname"; then
1654 $echo "$modename: unable to infer tagged configuration"
1655 $echo "$modename: specify a tag with \`--tag'" 1>&2
1656 exit 1
1657 # else
1658 # $echo "$modename: using $tagname tagged configuration"
1661 esac
1664 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1665 eval arg=\"$export_dynamic_flag_spec\"
1666 compile_command="$compile_command $arg"
1667 finalize_command="$finalize_command $arg"
1670 oldlibs=
1671 # calculate the name of the file, without its directory
1672 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1673 libobjs_save="$libobjs"
1675 if test -n "$shlibpath_var"; then
1676 # get the directories listed in $shlibpath_var
1677 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1678 else
1679 shlib_search_path=
1681 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1682 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1684 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1685 if test "X$output_objdir" = "X$output"; then
1686 output_objdir="$objdir"
1687 else
1688 output_objdir="$output_objdir/$objdir"
1690 # Create the object directory.
1691 if test ! -d "$output_objdir"; then
1692 $show "$mkdir $output_objdir"
1693 $run $mkdir $output_objdir
1694 status=$?
1695 if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1696 exit $status
1700 # Determine the type of output
1701 case $output in
1703 $echo "$modename: you must specify an output file" 1>&2
1704 $echo "$help" 1>&2
1705 exit 1
1707 *.$libext) linkmode=oldlib ;;
1708 *.lo | *.$objext) linkmode=obj ;;
1709 *.la) linkmode=lib ;;
1710 *) linkmode=prog ;; # Anything else should be a program.
1711 esac
1713 case $host in
1714 *cygwin* | *mingw* | *pw32*)
1715 # don't eliminate duplcations in $postdeps and $predeps
1716 duplicate_compiler_generated_deps=yes
1719 duplicate_compiler_generated_deps=$duplicate_deps
1721 esac
1722 specialdeplibs=
1724 libs=
1725 # Find all interdependent deplibs by searching for libraries
1726 # that are linked more than once (e.g. -la -lb -la)
1727 for deplib in $deplibs; do
1728 if test "X$duplicate_deps" = "Xyes" ; then
1729 case "$libs " in
1730 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1731 esac
1733 libs="$libs $deplib"
1734 done
1736 if test "$linkmode" = lib; then
1737 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1739 # Compute libraries that are listed more than once in $predeps
1740 # $postdeps and mark them as special (i.e., whose duplicates are
1741 # not to be eliminated).
1742 pre_post_deps=
1743 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1744 for pre_post_dep in $predeps $postdeps; do
1745 case "$pre_post_deps " in
1746 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1747 esac
1748 pre_post_deps="$pre_post_deps $pre_post_dep"
1749 done
1751 pre_post_deps=
1754 deplibs=
1755 newdependency_libs=
1756 newlib_search_path=
1757 need_relink=no # whether we're linking any uninstalled libtool libraries
1758 notinst_deplibs= # not-installed libtool libraries
1759 notinst_path= # paths that contain not-installed libtool libraries
1760 case $linkmode in
1761 lib)
1762 passes="conv link"
1763 for file in $dlfiles $dlprefiles; do
1764 case $file in
1765 *.la) ;;
1767 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1768 exit 1
1770 esac
1771 done
1773 prog)
1774 compile_deplibs=
1775 finalize_deplibs=
1776 alldeplibs=no
1777 newdlfiles=
1778 newdlprefiles=
1779 passes="conv scan dlopen dlpreopen link"
1781 *) passes="conv"
1783 esac
1784 for pass in $passes; do
1785 if test "$linkmode,$pass" = "lib,link" ||
1786 test "$linkmode,$pass" = "prog,scan"; then
1787 libs="$deplibs"
1788 deplibs=
1790 if test "$linkmode" = prog; then
1791 case $pass in
1792 dlopen) libs="$dlfiles" ;;
1793 dlpreopen) libs="$dlprefiles" ;;
1794 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1795 esac
1797 if test "$pass" = dlopen; then
1798 # Collect dlpreopened libraries
1799 save_deplibs="$deplibs"
1800 deplibs=
1802 for deplib in $libs; do
1803 lib=
1804 found=no
1805 case $deplib in
1806 -l*)
1807 if test "$linkmode" != lib && test "$linkmode" != prog; then
1808 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1809 continue
1811 if test "$pass" = conv; then
1812 deplibs="$deplib $deplibs"
1813 continue
1815 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1816 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1817 for search_ext in .la $shrext .so .a; do
1818 # Search the libtool library
1819 lib="$searchdir/lib${name}${search_ext}"
1820 if test -f "$lib"; then
1821 if test "$search_ext" = ".la"; then
1822 found=yes
1823 else
1824 found=no
1826 break 2
1828 done
1829 done
1830 if test "$found" != yes; then
1831 # deplib doesn't seem to be a libtool library
1832 if test "$linkmode,$pass" = "prog,link"; then
1833 compile_deplibs="$deplib $compile_deplibs"
1834 finalize_deplibs="$deplib $finalize_deplibs"
1835 else
1836 deplibs="$deplib $deplibs"
1837 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1839 continue
1840 else # deplib is a libtool library
1841 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1842 # We need to do some special things here, and not later.
1843 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1844 case " $predeps $postdeps " in
1845 *" $deplib "*)
1846 if (${SED} -e '2q' $lib |
1847 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1848 library_names=
1849 old_library=
1850 case $lib in
1851 */* | *\\*) . $lib ;;
1852 *) . ./$lib ;;
1853 esac
1854 for l in $old_library $library_names; do
1855 ll="$l"
1856 done
1857 if test "X$ll" = "X$old_library" ; then # only static version available
1858 found=no
1859 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1860 test "X$ladir" = "X$lib" && ladir="."
1861 lib=$ladir/$old_library
1862 if test "$linkmode,$pass" = "prog,link"; then
1863 compile_deplibs="$deplib $compile_deplibs"
1864 finalize_deplibs="$deplib $finalize_deplibs"
1865 else
1866 deplibs="$deplib $deplibs"
1867 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1869 continue
1873 *) ;;
1874 esac
1877 ;; # -l
1878 -L*)
1879 case $linkmode in
1880 lib)
1881 deplibs="$deplib $deplibs"
1882 test "$pass" = conv && continue
1883 newdependency_libs="$deplib $newdependency_libs"
1884 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1886 prog)
1887 if test "$pass" = conv; then
1888 deplibs="$deplib $deplibs"
1889 continue
1891 if test "$pass" = scan; then
1892 deplibs="$deplib $deplibs"
1893 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1894 else
1895 compile_deplibs="$deplib $compile_deplibs"
1896 finalize_deplibs="$deplib $finalize_deplibs"
1900 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1902 esac # linkmode
1903 continue
1904 ;; # -L
1905 -R*)
1906 if test "$pass" = link; then
1907 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1908 # Make sure the xrpath contains only unique directories.
1909 case "$xrpath " in
1910 *" $dir "*) ;;
1911 *) xrpath="$xrpath $dir" ;;
1912 esac
1914 deplibs="$deplib $deplibs"
1915 continue
1917 *.la) lib="$deplib" ;;
1918 *.$libext)
1919 if test "$pass" = conv; then
1920 deplibs="$deplib $deplibs"
1921 continue
1923 case $linkmode in
1924 lib)
1925 if test "$deplibs_check_method" != pass_all; then
1926 $echo
1927 $echo "*** Warning: Trying to link with static lib archive $deplib."
1928 $echo "*** I have the capability to make that library automatically link in when"
1929 $echo "*** you link to this library. But I can only do this if you have a"
1930 $echo "*** shared version of the library, which you do not appear to have"
1931 $echo "*** because the file extensions .$libext of this argument makes me believe"
1932 $echo "*** that it is just a static archive that I should not used here."
1933 else
1934 $echo
1935 $echo "*** Warning: Linking the shared library $output against the"
1936 $echo "*** static library $deplib is not portable!"
1937 deplibs="$deplib $deplibs"
1939 continue
1941 prog)
1942 if test "$pass" != link; then
1943 deplibs="$deplib $deplibs"
1944 else
1945 compile_deplibs="$deplib $compile_deplibs"
1946 finalize_deplibs="$deplib $finalize_deplibs"
1948 continue
1950 esac # linkmode
1951 ;; # *.$libext
1952 *.lo | *.$objext)
1953 if test "$pass" = conv; then
1954 deplibs="$deplib $deplibs"
1955 elif test "$linkmode" = prog; then
1956 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1957 # If there is no dlopen support or we're linking statically,
1958 # we need to preload.
1959 newdlprefiles="$newdlprefiles $deplib"
1960 compile_deplibs="$deplib $compile_deplibs"
1961 finalize_deplibs="$deplib $finalize_deplibs"
1962 else
1963 newdlfiles="$newdlfiles $deplib"
1966 continue
1968 %DEPLIBS%)
1969 alldeplibs=yes
1970 continue
1972 esac # case $deplib
1973 if test "$found" = yes || test -f "$lib"; then :
1974 else
1975 $echo "$modename: cannot find the library \`$lib'" 1>&2
1976 exit 1
1979 # Check to see that this really is a libtool archive.
1980 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1981 else
1982 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1983 exit 1
1986 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1987 test "X$ladir" = "X$lib" && ladir="."
1989 dlname=
1990 dlopen=
1991 dlpreopen=
1992 libdir=
1993 library_names=
1994 old_library=
1995 # If the library was installed with an old release of libtool,
1996 # it will not redefine variables installed, or shouldnotlink
1997 installed=yes
1998 shouldnotlink=no
2000 # Read the .la file
2001 case $lib in
2002 */* | *\\*) . $lib ;;
2003 *) . ./$lib ;;
2004 esac
2006 if test "$linkmode,$pass" = "lib,link" ||
2007 test "$linkmode,$pass" = "prog,scan" ||
2008 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2009 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2010 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2013 if test "$pass" = conv; then
2014 # Only check for convenience libraries
2015 deplibs="$lib $deplibs"
2016 if test -z "$libdir"; then
2017 if test -z "$old_library"; then
2018 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2019 exit 1
2021 # It is a libtool convenience library, so add in its objects.
2022 convenience="$convenience $ladir/$objdir/$old_library"
2023 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2024 tmp_libs=
2025 for deplib in $dependency_libs; do
2026 deplibs="$deplib $deplibs"
2027 if test "X$duplicate_deps" = "Xyes" ; then
2028 case "$tmp_libs " in
2029 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2030 esac
2032 tmp_libs="$tmp_libs $deplib"
2033 done
2034 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2035 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2036 exit 1
2038 continue
2039 fi # $pass = conv
2042 # Get the name of the library we link against.
2043 linklib=
2044 for l in $old_library $library_names; do
2045 linklib="$l"
2046 done
2047 if test -z "$linklib"; then
2048 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2049 exit 1
2052 # This library was specified with -dlopen.
2053 if test "$pass" = dlopen; then
2054 if test -z "$libdir"; then
2055 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2056 exit 1
2058 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2059 # If there is no dlname, no dlopen support or we're linking
2060 # statically, we need to preload. We also need to preload any
2061 # dependent libraries so libltdl's deplib preloader doesn't
2062 # bomb out in the load deplibs phase.
2063 dlprefiles="$dlprefiles $lib $dependency_libs"
2064 else
2065 newdlfiles="$newdlfiles $lib"
2067 continue
2068 fi # $pass = dlopen
2070 # We need an absolute path.
2071 case $ladir in
2072 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2074 abs_ladir=`cd "$ladir" && pwd`
2075 if test -z "$abs_ladir"; then
2076 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2077 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2078 abs_ladir="$ladir"
2081 esac
2082 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2084 # Find the relevant object directory and library name.
2085 if test "X$installed" = Xyes; then
2086 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2087 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2088 dir="$ladir"
2089 absdir="$abs_ladir"
2090 libdir="$abs_ladir"
2091 else
2092 dir="$libdir"
2093 absdir="$libdir"
2095 else
2096 dir="$ladir/$objdir"
2097 absdir="$abs_ladir/$objdir"
2098 # Remove this search path later
2099 notinst_path="$notinst_path $abs_ladir"
2100 fi # $installed = yes
2101 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2103 # This library was specified with -dlpreopen.
2104 if test "$pass" = dlpreopen; then
2105 if test -z "$libdir"; then
2106 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2107 exit 1
2109 # Prefer using a static library (so that no silly _DYNAMIC symbols
2110 # are required to link).
2111 if test -n "$old_library"; then
2112 newdlprefiles="$newdlprefiles $dir/$old_library"
2113 # Otherwise, use the dlname, so that lt_dlopen finds it.
2114 elif test -n "$dlname"; then
2115 newdlprefiles="$newdlprefiles $dir/$dlname"
2116 else
2117 newdlprefiles="$newdlprefiles $dir/$linklib"
2119 fi # $pass = dlpreopen
2121 if test -z "$libdir"; then
2122 # Link the convenience library
2123 if test "$linkmode" = lib; then
2124 deplibs="$dir/$old_library $deplibs"
2125 elif test "$linkmode,$pass" = "prog,link"; then
2126 compile_deplibs="$dir/$old_library $compile_deplibs"
2127 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2128 else
2129 deplibs="$lib $deplibs" # used for prog,scan pass
2131 continue
2135 if test "$linkmode" = prog && test "$pass" != link; then
2136 newlib_search_path="$newlib_search_path $ladir"
2137 deplibs="$lib $deplibs"
2139 linkalldeplibs=no
2140 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2141 test "$build_libtool_libs" = no; then
2142 linkalldeplibs=yes
2145 tmp_libs=
2146 for deplib in $dependency_libs; do
2147 case $deplib in
2148 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2149 esac
2150 # Need to link against all dependency_libs?
2151 if test "$linkalldeplibs" = yes; then
2152 deplibs="$deplib $deplibs"
2153 else
2154 # Need to hardcode shared library paths
2155 # or/and link against static libraries
2156 newdependency_libs="$deplib $newdependency_libs"
2158 if test "X$duplicate_deps" = "Xyes" ; then
2159 case "$tmp_libs " in
2160 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2161 esac
2163 tmp_libs="$tmp_libs $deplib"
2164 done # for deplib
2165 continue
2166 fi # $linkmode = prog...
2168 if test "$linkmode,$pass" = "prog,link"; then
2169 if test -n "$library_names" &&
2170 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2171 # We need to hardcode the library path
2172 if test -n "$shlibpath_var"; then
2173 # Make sure the rpath contains only unique directories.
2174 case "$temp_rpath " in
2175 *" $dir "*) ;;
2176 *" $absdir "*) ;;
2177 *) temp_rpath="$temp_rpath $dir" ;;
2178 esac
2181 # Hardcode the library path.
2182 # Skip directories that are in the system default run-time
2183 # search path.
2184 case " $sys_lib_dlsearch_path " in
2185 *" $absdir "*) ;;
2187 case "$compile_rpath " in
2188 *" $absdir "*) ;;
2189 *) compile_rpath="$compile_rpath $absdir"
2190 esac
2192 esac
2193 case " $sys_lib_dlsearch_path " in
2194 *" $libdir "*) ;;
2196 case "$finalize_rpath " in
2197 *" $libdir "*) ;;
2198 *) finalize_rpath="$finalize_rpath $libdir"
2199 esac
2201 esac
2202 fi # $linkmode,$pass = prog,link...
2204 if test "$alldeplibs" = yes &&
2205 { test "$deplibs_check_method" = pass_all ||
2206 { test "$build_libtool_libs" = yes &&
2207 test -n "$library_names"; }; }; then
2208 # We only need to search for static libraries
2209 continue
2213 link_static=no # Whether the deplib will be linked statically
2214 if test -n "$library_names" &&
2215 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2216 if test "$installed" = no; then
2217 notinst_deplibs="$notinst_deplibs $lib"
2218 need_relink=yes
2220 # This is a shared library
2222 # Warn about portability, can't link against -module's on some systems (darwin)
2223 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2224 $echo
2225 if test "$linkmode" = prog; then
2226 $echo "*** Warning: Linking the executable $output against the loadable module"
2227 else
2228 $echo "*** Warning: Linking the shared library $output against the loadable module"
2230 $echo "*** $linklib is not portable!"
2232 if test "$linkmode" = lib &&
2233 test "$hardcode_into_libs" = yes; then
2234 # Hardcode the library path.
2235 # Skip directories that are in the system default run-time
2236 # search path.
2237 case " $sys_lib_dlsearch_path " in
2238 *" $absdir "*) ;;
2240 case "$compile_rpath " in
2241 *" $absdir "*) ;;
2242 *) compile_rpath="$compile_rpath $absdir"
2243 esac
2245 esac
2246 case " $sys_lib_dlsearch_path " in
2247 *" $libdir "*) ;;
2249 case "$finalize_rpath " in
2250 *" $libdir "*) ;;
2251 *) finalize_rpath="$finalize_rpath $libdir"
2252 esac
2254 esac
2257 if test -n "$old_archive_from_expsyms_cmds"; then
2258 # figure out the soname
2259 set dummy $library_names
2260 realname="$2"
2261 shift; shift
2262 libname=`eval \\$echo \"$libname_spec\"`
2263 # use dlname if we got it. it's perfectly good, no?
2264 if test -n "$dlname"; then
2265 soname="$dlname"
2266 elif test -n "$soname_spec"; then
2267 # bleh windows
2268 case $host in
2269 *cygwin* | mingw*)
2270 major=`expr $current - $age`
2271 versuffix="-$major"
2273 esac
2274 eval soname=\"$soname_spec\"
2275 else
2276 soname="$realname"
2279 # Make a new name for the extract_expsyms_cmds to use
2280 soroot="$soname"
2281 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2282 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2284 # If the library has no export list, then create one now
2285 if test -f "$output_objdir/$soname-def"; then :
2286 else
2287 $show "extracting exported symbol list from \`$soname'"
2288 save_ifs="$IFS"; IFS='~'
2289 eval cmds=\"$extract_expsyms_cmds\"
2290 for cmd in $cmds; do
2291 IFS="$save_ifs"
2292 $show "$cmd"
2293 $run eval "$cmd" || exit $?
2294 done
2295 IFS="$save_ifs"
2298 # Create $newlib
2299 if test -f "$output_objdir/$newlib"; then :; else
2300 $show "generating import library for \`$soname'"
2301 save_ifs="$IFS"; IFS='~'
2302 eval cmds=\"$old_archive_from_expsyms_cmds\"
2303 for cmd in $cmds; do
2304 IFS="$save_ifs"
2305 $show "$cmd"
2306 $run eval "$cmd" || exit $?
2307 done
2308 IFS="$save_ifs"
2310 # make sure the library variables are pointing to the new library
2311 dir=$output_objdir
2312 linklib=$newlib
2313 fi # test -n "$old_archive_from_expsyms_cmds"
2315 if test "$linkmode" = prog || test "$mode" != relink; then
2316 add_shlibpath=
2317 add_dir=
2318 add=
2319 lib_linked=yes
2320 case $hardcode_action in
2321 immediate | unsupported)
2322 if test "$hardcode_direct" = no; then
2323 add="$dir/$linklib"
2324 case $host in
2325 *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2326 *-*-darwin* )
2327 # if the lib is a module then we can not link against it, someone
2328 # is ignoring the new warnings I added
2329 if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2330 $echo "** Warning, lib $linklib is a module, not a shared library"
2331 if test -z "$old_library" ; then
2332 $echo
2333 $echo "** And there doesn't seem to be a static archive available"
2334 $echo "** The link will probably fail, sorry"
2335 else
2336 add="$dir/$old_library"
2339 esac
2340 elif test "$hardcode_minus_L" = no; then
2341 case $host in
2342 *-*-sunos*) add_shlibpath="$dir" ;;
2343 esac
2344 add_dir="-L$dir"
2345 add="-l$name"
2346 elif test "$hardcode_shlibpath_var" = no; then
2347 add_shlibpath="$dir"
2348 add="-l$name"
2349 else
2350 lib_linked=no
2353 relink)
2354 if test "$hardcode_direct" = yes; then
2355 add="$dir/$linklib"
2356 elif test "$hardcode_minus_L" = yes; then
2357 add_dir="-L$dir"
2358 # Try looking first in the location we're being installed to.
2359 if test -n "$inst_prefix_dir"; then
2360 case "$libdir" in
2361 [\\/]*)
2362 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2364 esac
2366 add="-l$name"
2367 elif test "$hardcode_shlibpath_var" = yes; then
2368 add_shlibpath="$dir"
2369 add="-l$name"
2370 else
2371 lib_linked=no
2374 *) lib_linked=no ;;
2375 esac
2377 if test "$lib_linked" != yes; then
2378 $echo "$modename: configuration error: unsupported hardcode properties"
2379 exit 1
2382 if test -n "$add_shlibpath"; then
2383 case :$compile_shlibpath: in
2384 *":$add_shlibpath:"*) ;;
2385 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2386 esac
2388 if test "$linkmode" = prog; then
2389 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2390 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2391 else
2392 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2393 test -n "$add" && deplibs="$add $deplibs"
2394 if test "$hardcode_direct" != yes && \
2395 test "$hardcode_minus_L" != yes && \
2396 test "$hardcode_shlibpath_var" = yes; then
2397 case :$finalize_shlibpath: in
2398 *":$libdir:"*) ;;
2399 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2400 esac
2405 if test "$linkmode" = prog || test "$mode" = relink; then
2406 add_shlibpath=
2407 add_dir=
2408 add=
2409 # Finalize command for both is simple: just hardcode it.
2410 if test "$hardcode_direct" = yes; then
2411 add="$libdir/$linklib"
2412 elif test "$hardcode_minus_L" = yes; then
2413 add_dir="-L$libdir"
2414 add="-l$name"
2415 elif test "$hardcode_shlibpath_var" = yes; then
2416 case :$finalize_shlibpath: in
2417 *":$libdir:"*) ;;
2418 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2419 esac
2420 add="-l$name"
2421 elif test "$hardcode_automatic" = yes; then
2422 if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2423 add="$inst_prefix_dir$libdir/$linklib"
2424 else
2425 add="$libdir/$linklib"
2427 else
2428 # We cannot seem to hardcode it, guess we'll fake it.
2429 add_dir="-L$libdir"
2430 # Try looking first in the location we're being installed to.
2431 if test -n "$inst_prefix_dir"; then
2432 case "$libdir" in
2433 [\\/]*)
2434 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2436 esac
2438 add="-l$name"
2441 if test "$linkmode" = prog; then
2442 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2443 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2444 else
2445 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2446 test -n "$add" && deplibs="$add $deplibs"
2449 elif test "$linkmode" = prog; then
2450 # Here we assume that one of hardcode_direct or hardcode_minus_L
2451 # is not unsupported. This is valid on all known static and
2452 # shared platforms.
2453 if test "$hardcode_direct" != unsupported; then
2454 test -n "$old_library" && linklib="$old_library"
2455 compile_deplibs="$dir/$linklib $compile_deplibs"
2456 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2457 else
2458 compile_deplibs="-l$name -L$dir $compile_deplibs"
2459 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2461 elif test "$build_libtool_libs" = yes; then
2462 # Not a shared library
2463 if test "$deplibs_check_method" != pass_all; then
2464 # We're trying link a shared library against a static one
2465 # but the system doesn't support it.
2467 # Just print a warning and add the library to dependency_libs so
2468 # that the program can be linked against the static library.
2469 $echo
2470 $echo "*** Warning: This system can not link to static lib archive $lib."
2471 $echo "*** I have the capability to make that library automatically link in when"
2472 $echo "*** you link to this library. But I can only do this if you have a"
2473 $echo "*** shared version of the library, which you do not appear to have."
2474 if test "$module" = yes; then
2475 $echo "*** But as you try to build a module library, libtool will still create "
2476 $echo "*** a static module, that should work as long as the dlopening application"
2477 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2478 if test -z "$global_symbol_pipe"; then
2479 $echo
2480 $echo "*** However, this would only work if libtool was able to extract symbol"
2481 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2482 $echo "*** not find such a program. So, this module is probably useless."
2483 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2485 if test "$build_old_libs" = no; then
2486 build_libtool_libs=module
2487 build_old_libs=yes
2488 else
2489 build_libtool_libs=no
2492 else
2493 convenience="$convenience $dir/$old_library"
2494 old_convenience="$old_convenience $dir/$old_library"
2495 deplibs="$dir/$old_library $deplibs"
2496 link_static=yes
2498 fi # link shared/static library?
2500 if test "$linkmode" = lib; then
2501 if test -n "$dependency_libs" &&
2502 { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2503 test "$link_static" = yes; }; then
2504 # Extract -R from dependency_libs
2505 temp_deplibs=
2506 for libdir in $dependency_libs; do
2507 case $libdir in
2508 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2509 case " $xrpath " in
2510 *" $temp_xrpath "*) ;;
2511 *) xrpath="$xrpath $temp_xrpath";;
2512 esac;;
2513 *) temp_deplibs="$temp_deplibs $libdir";;
2514 esac
2515 done
2516 dependency_libs="$temp_deplibs"
2519 newlib_search_path="$newlib_search_path $absdir"
2520 # Link against this library
2521 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2522 # ... and its dependency_libs
2523 tmp_libs=
2524 for deplib in $dependency_libs; do
2525 newdependency_libs="$deplib $newdependency_libs"
2526 if test "X$duplicate_deps" = "Xyes" ; then
2527 case "$tmp_libs " in
2528 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2529 esac
2531 tmp_libs="$tmp_libs $deplib"
2532 done
2534 if test "$link_all_deplibs" != no; then
2535 # Add the search paths of all dependency libraries
2536 for deplib in $dependency_libs; do
2537 case $deplib in
2538 -L*) path="$deplib" ;;
2539 *.la)
2540 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2541 test "X$dir" = "X$deplib" && dir="."
2542 # We need an absolute path.
2543 case $dir in
2544 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2546 absdir=`cd "$dir" && pwd`
2547 if test -z "$absdir"; then
2548 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2549 absdir="$dir"
2552 esac
2553 if grep "^installed=no" $deplib > /dev/null; then
2554 path="$absdir/$objdir"
2555 else
2556 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2557 if test -z "$libdir"; then
2558 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2559 exit 1
2561 if test "$absdir" != "$libdir"; then
2562 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2564 path="$absdir"
2566 depdepl=
2567 case $host in
2568 *-*-darwin*)
2569 # we do not want to link against static libs, but need to link against shared
2570 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2571 if test -n "$deplibrary_names" ; then
2572 for tmp in $deplibrary_names ; do
2573 depdepl=$tmp
2574 done
2575 if test -f "$path/$depdepl" ; then
2576 depdepl="$path/$depdepl"
2578 # do not add paths which are already there
2579 case " $newlib_search_path " in
2580 *" $path "*) ;;
2581 *) newlib_search_path="$newlib_search_path $path";;
2582 esac
2583 path=""
2587 path="-L$path"
2589 esac
2592 -l*)
2593 case $host in
2594 *-*-darwin*)
2595 # Again, we only want to link against shared libraries
2596 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2597 for tmp in $newlib_search_path ; do
2598 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2599 eval depdepl="$tmp/lib$tmp_libs.dylib"
2600 break
2602 done
2603 path=""
2605 *) continue ;;
2606 esac
2608 *) continue ;;
2609 esac
2610 case " $deplibs " in
2611 *" $depdepl "*) ;;
2612 *) deplibs="$deplibs $depdepl" ;;
2613 esac
2614 case " $deplibs " in
2615 *" $path "*) ;;
2616 *) deplibs="$deplibs $path" ;;
2617 esac
2618 done
2619 fi # link_all_deplibs != no
2620 fi # linkmode = lib
2621 done # for deplib in $libs
2622 dependency_libs="$newdependency_libs"
2623 if test "$pass" = dlpreopen; then
2624 # Link the dlpreopened libraries before other libraries
2625 for deplib in $save_deplibs; do
2626 deplibs="$deplib $deplibs"
2627 done
2629 if test "$pass" != dlopen; then
2630 if test "$pass" != conv; then
2631 # Make sure lib_search_path contains only unique directories.
2632 lib_search_path=
2633 for dir in $newlib_search_path; do
2634 case "$lib_search_path " in
2635 *" $dir "*) ;;
2636 *) lib_search_path="$lib_search_path $dir" ;;
2637 esac
2638 done
2639 newlib_search_path=
2642 if test "$linkmode,$pass" != "prog,link"; then
2643 vars="deplibs"
2644 else
2645 vars="compile_deplibs finalize_deplibs"
2647 for var in $vars dependency_libs; do
2648 # Add libraries to $var in reverse order
2649 eval tmp_libs=\"\$$var\"
2650 new_libs=
2651 for deplib in $tmp_libs; do
2652 # FIXME: Pedantically, this is the right thing to do, so
2653 # that some nasty dependency loop isn't accidentally
2654 # broken:
2655 #new_libs="$deplib $new_libs"
2656 # Pragmatically, this seems to cause very few problems in
2657 # practice:
2658 case $deplib in
2659 -L*) new_libs="$deplib $new_libs" ;;
2660 -R*) ;;
2662 # And here is the reason: when a library appears more
2663 # than once as an explicit dependence of a library, or
2664 # is implicitly linked in more than once by the
2665 # compiler, it is considered special, and multiple
2666 # occurrences thereof are not removed. Compare this
2667 # with having the same library being listed as a
2668 # dependency of multiple other libraries: in this case,
2669 # we know (pedantically, we assume) the library does not
2670 # need to be listed more than once, so we keep only the
2671 # last copy. This is not always right, but it is rare
2672 # enough that we require users that really mean to play
2673 # such unportable linking tricks to link the library
2674 # using -Wl,-lname, so that libtool does not consider it
2675 # for duplicate removal.
2676 case " $specialdeplibs " in
2677 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2679 case " $new_libs " in
2680 *" $deplib "*) ;;
2681 *) new_libs="$deplib $new_libs" ;;
2682 esac
2684 esac
2686 esac
2687 done
2688 tmp_libs=
2689 for deplib in $new_libs; do
2690 case $deplib in
2691 -L*)
2692 case " $tmp_libs " in
2693 *" $deplib "*) ;;
2694 *) tmp_libs="$tmp_libs $deplib" ;;
2695 esac
2697 *) tmp_libs="$tmp_libs $deplib" ;;
2698 esac
2699 done
2700 eval $var=\"$tmp_libs\"
2701 done # for var
2703 # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
2704 tmp_libs=
2705 for i in $dependency_libs ; do
2706 case " $predeps $postdeps $compiler_lib_search_path " in
2707 *" $i "*)
2708 i=""
2710 esac
2711 if test -n "$i" ; then
2712 tmp_libs="$tmp_libs $i"
2714 done
2715 dependency_libs=$tmp_libs
2716 done # for pass
2717 if test "$linkmode" = prog; then
2718 dlfiles="$newdlfiles"
2719 dlprefiles="$newdlprefiles"
2722 case $linkmode in
2723 oldlib)
2724 if test -n "$deplibs"; then
2725 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2728 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2729 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2732 if test -n "$rpath"; then
2733 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2736 if test -n "$xrpath"; then
2737 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2740 if test -n "$vinfo"; then
2741 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2744 if test -n "$release"; then
2745 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2748 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2749 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2752 # Now set the variables for building old libraries.
2753 build_libtool_libs=no
2754 oldlibs="$output"
2755 objs="$objs$old_deplibs"
2758 lib)
2759 # Make sure we only generate libraries of the form `libNAME.la'.
2760 case $outputname in
2761 lib*)
2762 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2763 eval shared_ext=\"$shrext\"
2764 eval libname=\"$libname_spec\"
2767 if test "$module" = no; then
2768 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2769 $echo "$help" 1>&2
2770 exit 1
2772 if test "$need_lib_prefix" != no; then
2773 # Add the "lib" prefix for modules if required
2774 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2775 eval shared_ext=\"$shrext\"
2776 eval libname=\"$libname_spec\"
2777 else
2778 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2781 esac
2783 if test -n "$objs"; then
2784 if test "$deplibs_check_method" != pass_all; then
2785 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2786 exit 1
2787 else
2788 $echo
2789 $echo "*** Warning: Linking the shared library $output against the non-libtool"
2790 $echo "*** objects $objs is not portable!"
2791 libobjs="$libobjs $objs"
2795 if test "$dlself" != no; then
2796 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2799 set dummy $rpath
2800 if test "$#" -gt 2; then
2801 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2803 install_libdir="$2"
2805 oldlibs=
2806 if test -z "$rpath"; then
2807 if test "$build_libtool_libs" = yes; then
2808 # Building a libtool convenience library.
2809 # Some compilers have problems with a `.al' extension so
2810 # convenience libraries should have the same extension an
2811 # archive normally would.
2812 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2813 build_libtool_libs=convenience
2814 build_old_libs=yes
2817 if test -n "$vinfo"; then
2818 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2821 if test -n "$release"; then
2822 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2824 else
2826 # Parse the version information argument.
2827 save_ifs="$IFS"; IFS=':'
2828 set dummy $vinfo 0 0 0
2829 IFS="$save_ifs"
2831 if test -n "$8"; then
2832 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2833 $echo "$help" 1>&2
2834 exit 1
2837 # convert absolute version numbers to libtool ages
2838 # this retains compatibility with .la files and attempts
2839 # to make the code below a bit more comprehensible
2841 case $vinfo_number in
2842 yes)
2843 number_major="$2"
2844 number_minor="$3"
2845 number_revision="$4"
2847 # There are really only two kinds -- those that
2848 # use the current revision as the major version
2849 # and those that subtract age and use age as
2850 # a minor version. But, then there is irix
2851 # which has an extra 1 added just for fun
2853 case $version_type in
2854 darwin|linux|osf|windows)
2855 current=`expr $number_major + $number_minor`
2856 age="$number_minor"
2857 revision="$number_revision"
2859 freebsd-aout|freebsd-elf|sunos)
2860 current="$number_major"
2861 revision="$number_minor"
2862 age="0"
2864 irix|nonstopux)
2865 current=`expr $number_major + $number_minor - 1`
2866 age="$number_minor"
2867 revision="$number_minor"
2869 esac
2872 current="$2"
2873 revision="$3"
2874 age="$4"
2876 esac
2878 # Check that each of the things are valid numbers.
2879 case $current in
2880 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2882 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2883 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2884 exit 1
2886 esac
2888 case $revision in
2889 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2891 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2892 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2893 exit 1
2895 esac
2897 case $age in
2898 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2900 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2901 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2902 exit 1
2904 esac
2906 if test "$age" -gt "$current"; then
2907 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2908 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2909 exit 1
2912 # Calculate the version variables.
2913 major=
2914 versuffix=
2915 verstring=
2916 case $version_type in
2917 none) ;;
2919 darwin)
2920 # Like Linux, but with the current version available in
2921 # verstring for coding it into the library header
2922 major=.`expr $current - $age`
2923 versuffix="$major.$age.$revision"
2924 # Darwin ld doesn't like 0 for these options...
2925 minor_current=`expr $current + 1`
2926 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2929 freebsd-aout)
2930 major=".$current"
2931 versuffix=".$current.$revision";
2934 freebsd-elf)
2935 major=".$current"
2936 versuffix=".$current";
2939 irix | nonstopux)
2940 major=`expr $current - $age + 1`
2942 case $version_type in
2943 nonstopux) verstring_prefix=nonstopux ;;
2944 *) verstring_prefix=sgi ;;
2945 esac
2946 verstring="$verstring_prefix$major.$revision"
2948 # Add in all the interfaces that we are compatible with.
2949 loop=$revision
2950 while test "$loop" -ne 0; do
2951 iface=`expr $revision - $loop`
2952 loop=`expr $loop - 1`
2953 verstring="$verstring_prefix$major.$iface:$verstring"
2954 done
2956 # Before this point, $major must not contain `.'.
2957 major=.$major
2958 versuffix="$major.$revision"
2961 linux)
2962 major=.`expr $current - $age`
2963 versuffix="$major.$age.$revision"
2966 osf)
2967 major=.`expr $current - $age`
2968 versuffix=".$current.$age.$revision"
2969 verstring="$current.$age.$revision"
2971 # Add in all the interfaces that we are compatible with.
2972 loop=$age
2973 while test "$loop" -ne 0; do
2974 iface=`expr $current - $loop`
2975 loop=`expr $loop - 1`
2976 verstring="$verstring:${iface}.0"
2977 done
2979 # Make executables depend on our current version.
2980 verstring="$verstring:${current}.0"
2983 sunos)
2984 major=".$current"
2985 versuffix=".$current.$revision"
2988 windows)
2989 # Use '-' rather than '.', since we only want one
2990 # extension on DOS 8.3 filesystems.
2991 major=`expr $current - $age`
2992 versuffix="-$major"
2996 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2997 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2998 exit 1
3000 esac
3002 # Clear the version info if we defaulted, and they specified a release.
3003 if test -z "$vinfo" && test -n "$release"; then
3004 major=
3005 case $version_type in
3006 darwin)
3007 # we can't check for "0.0" in archive_cmds due to quoting
3008 # problems, so we reset it completely
3009 verstring=
3012 verstring="0.0"
3014 esac
3015 if test "$need_version" = no; then
3016 versuffix=
3017 else
3018 versuffix=".0.0"
3022 # Remove version info from name if versioning should be avoided
3023 if test "$avoid_version" = yes && test "$need_version" = no; then
3024 major=
3025 versuffix=
3026 verstring=""
3029 # Check to see if the archive will have undefined symbols.
3030 if test "$allow_undefined" = yes; then
3031 if test "$allow_undefined_flag" = unsupported; then
3032 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3033 build_libtool_libs=no
3034 build_old_libs=yes
3036 else
3037 # Don't allow undefined symbols.
3038 allow_undefined_flag="$no_undefined_flag"
3042 if test "$mode" != relink; then
3043 # Remove our outputs, but don't remove object files since they
3044 # may have been created when compiling PIC objects.
3045 removelist=
3046 tempremovelist=`$echo "$output_objdir/*"`
3047 for p in $tempremovelist; do
3048 case $p in
3049 *.$objext)
3051 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3052 removelist="$removelist $p"
3054 *) ;;
3055 esac
3056 done
3057 if test -n "$removelist"; then
3058 $show "${rm}r $removelist"
3059 $run ${rm}r $removelist
3063 # Now set the variables for building old libraries.
3064 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3065 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3067 # Transform .lo files to .o files.
3068 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3071 # Eliminate all temporary directories.
3072 for path in $notinst_path; do
3073 lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3074 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3075 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3076 done
3078 if test -n "$xrpath"; then
3079 # If the user specified any rpath flags, then add them.
3080 temp_xrpath=
3081 for libdir in $xrpath; do
3082 temp_xrpath="$temp_xrpath -R$libdir"
3083 case "$finalize_rpath " in
3084 *" $libdir "*) ;;
3085 *) finalize_rpath="$finalize_rpath $libdir" ;;
3086 esac
3087 done
3088 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3089 dependency_libs="$temp_xrpath $dependency_libs"
3093 # Make sure dlfiles contains only unique files that won't be dlpreopened
3094 old_dlfiles="$dlfiles"
3095 dlfiles=
3096 for lib in $old_dlfiles; do
3097 case " $dlprefiles $dlfiles " in
3098 *" $lib "*) ;;
3099 *) dlfiles="$dlfiles $lib" ;;
3100 esac
3101 done
3103 # Make sure dlprefiles contains only unique files
3104 old_dlprefiles="$dlprefiles"
3105 dlprefiles=
3106 for lib in $old_dlprefiles; do
3107 case "$dlprefiles " in
3108 *" $lib "*) ;;
3109 *) dlprefiles="$dlprefiles $lib" ;;
3110 esac
3111 done
3113 if test "$build_libtool_libs" = yes; then
3114 if test -n "$rpath"; then
3115 case $host in
3116 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3117 # these systems don't actually have a c library (as such)!
3119 *-*-rhapsody* | *-*-darwin1.[012])
3120 # Rhapsody C library is in the System framework
3121 deplibs="$deplibs -framework System"
3123 *-*-netbsd*)
3124 # Don't link with libc until the a.out ld.so is fixed.
3126 *-*-openbsd* | *-*-freebsd*)
3127 # Do not include libc due to us having libc/libc_r.
3128 test "X$arg" = "X-lc" && continue
3131 # Add libc to deplibs on all other systems if necessary.
3132 if test "$build_libtool_need_lc" = "yes"; then
3133 deplibs="$deplibs -lc"
3136 esac
3139 # Transform deplibs into only deplibs that can be linked in shared.
3140 name_save=$name
3141 libname_save=$libname
3142 release_save=$release
3143 versuffix_save=$versuffix
3144 major_save=$major
3145 # I'm not sure if I'm treating the release correctly. I think
3146 # release should show up in the -l (ie -lgmp5) so we don't want to
3147 # add it in twice. Is that correct?
3148 release=""
3149 versuffix=""
3150 major=""
3151 newdeplibs=
3152 droppeddeps=no
3153 case $deplibs_check_method in
3154 pass_all)
3155 # Don't check for shared/static. Everything works.
3156 # This might be a little naive. We might want to check
3157 # whether the library exists or not. But this is on
3158 # osf3 & osf4 and I'm not really sure... Just
3159 # implementing what was already the behavior.
3160 newdeplibs=$deplibs
3162 test_compile)
3163 # This code stresses the "libraries are programs" paradigm to its
3164 # limits. Maybe even breaks it. We compile a program, linking it
3165 # against the deplibs as a proxy for the library. Then we can check
3166 # whether they linked in statically or dynamically with ldd.
3167 $rm conftest.c
3168 cat > conftest.c <<EOF
3169 int main() { return 0; }
3171 $rm conftest
3172 $LTCC -o conftest conftest.c $deplibs
3173 if test "$?" -eq 0 ; then
3174 ldd_output=`ldd conftest`
3175 for i in $deplibs; do
3176 name="`expr $i : '-l\(.*\)'`"
3177 # If $name is empty we are operating on a -L argument.
3178 if test "$name" != "" && test "$name" -ne "0"; then
3179 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3180 case " $predeps $postdeps " in
3181 *" $i "*)
3182 newdeplibs="$newdeplibs $i"
3183 i=""
3185 esac
3187 if test -n "$i" ; then
3188 libname=`eval \\$echo \"$libname_spec\"`
3189 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3190 set dummy $deplib_matches
3191 deplib_match=$2
3192 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3193 newdeplibs="$newdeplibs $i"
3194 else
3195 droppeddeps=yes
3196 $echo
3197 $echo "*** Warning: dynamic linker does not accept needed library $i."
3198 $echo "*** I have the capability to make that library automatically link in when"
3199 $echo "*** you link to this library. But I can only do this if you have a"
3200 $echo "*** shared version of the library, which I believe you do not have"
3201 $echo "*** because a test_compile did reveal that the linker did not use it for"
3202 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3205 else
3206 newdeplibs="$newdeplibs $i"
3208 done
3209 else
3210 # Error occurred in the first compile. Let's try to salvage
3211 # the situation: Compile a separate program for each library.
3212 for i in $deplibs; do
3213 name="`expr $i : '-l\(.*\)'`"
3214 # If $name is empty we are operating on a -L argument.
3215 if test "$name" != "" && test "$name" != "0"; then
3216 $rm conftest
3217 $LTCC -o conftest conftest.c $i
3218 # Did it work?
3219 if test "$?" -eq 0 ; then
3220 ldd_output=`ldd conftest`
3221 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3222 case " $predeps $postdeps " in
3223 *" $i "*)
3224 newdeplibs="$newdeplibs $i"
3225 i=""
3227 esac
3229 if test -n "$i" ; then
3230 libname=`eval \\$echo \"$libname_spec\"`
3231 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3232 set dummy $deplib_matches
3233 deplib_match=$2
3234 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3235 newdeplibs="$newdeplibs $i"
3236 else
3237 droppeddeps=yes
3238 $echo
3239 $echo "*** Warning: dynamic linker does not accept needed library $i."
3240 $echo "*** I have the capability to make that library automatically link in when"
3241 $echo "*** you link to this library. But I can only do this if you have a"
3242 $echo "*** shared version of the library, which you do not appear to have"
3243 $echo "*** because a test_compile did reveal that the linker did not use this one"
3244 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3247 else
3248 droppeddeps=yes
3249 $echo
3250 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3251 $echo "*** make it link in! You will probably need to install it or some"
3252 $echo "*** library that it depends on before this library will be fully"
3253 $echo "*** functional. Installing it before continuing would be even better."
3255 else
3256 newdeplibs="$newdeplibs $i"
3258 done
3261 file_magic*)
3262 set dummy $deplibs_check_method
3263 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3264 for a_deplib in $deplibs; do
3265 name="`expr $a_deplib : '-l\(.*\)'`"
3266 # If $name is empty we are operating on a -L argument.
3267 if test "$name" != "" && test "$name" != "0"; then
3268 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3269 case " $predeps $postdeps " in
3270 *" $a_deplib "*)
3271 newdeplibs="$newdeplibs $a_deplib"
3272 a_deplib=""
3274 esac
3276 if test -n "$a_deplib" ; then
3277 libname=`eval \\$echo \"$libname_spec\"`
3278 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3279 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3280 for potent_lib in $potential_libs; do
3281 # Follow soft links.
3282 if ls -lLd "$potent_lib" 2>/dev/null \
3283 | grep " -> " >/dev/null; then
3284 continue
3286 # The statement above tries to avoid entering an
3287 # endless loop below, in case of cyclic links.
3288 # We might still enter an endless loop, since a link
3289 # loop can be closed while we follow links,
3290 # but so what?
3291 potlib="$potent_lib"
3292 while test -h "$potlib" 2>/dev/null; do
3293 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3294 case $potliblink in
3295 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3296 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3297 esac
3298 done
3299 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3300 | ${SED} 10q \
3301 | $EGREP "$file_magic_regex" > /dev/null; then
3302 newdeplibs="$newdeplibs $a_deplib"
3303 a_deplib=""
3304 break 2
3306 done
3307 done
3309 if test -n "$a_deplib" ; then
3310 droppeddeps=yes
3311 $echo
3312 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3313 $echo "*** I have the capability to make that library automatically link in when"
3314 $echo "*** you link to this library. But I can only do this if you have a"
3315 $echo "*** shared version of the library, which you do not appear to have"
3316 $echo "*** because I did check the linker path looking for a file starting"
3317 if test -z "$potlib" ; then
3318 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3319 else
3320 $echo "*** with $libname and none of the candidates passed a file format test"
3321 $echo "*** using a file magic. Last file checked: $potlib"
3324 else
3325 # Add a -L argument.
3326 newdeplibs="$newdeplibs $a_deplib"
3328 done # Gone through all deplibs.
3330 match_pattern*)
3331 set dummy $deplibs_check_method
3332 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3333 for a_deplib in $deplibs; do
3334 name="`expr $a_deplib : '-l\(.*\)'`"
3335 # If $name is empty we are operating on a -L argument.
3336 if test -n "$name" && test "$name" != "0"; then
3337 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3338 case " $predeps $postdeps " in
3339 *" $a_deplib "*)
3340 newdeplibs="$newdeplibs $a_deplib"
3341 a_deplib=""
3343 esac
3345 if test -n "$a_deplib" ; then
3346 libname=`eval \\$echo \"$libname_spec\"`
3347 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3348 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3349 for potent_lib in $potential_libs; do
3350 potlib="$potent_lib" # see symlink-check above in file_magic test
3351 if eval $echo \"$potent_lib\" 2>/dev/null \
3352 | ${SED} 10q \
3353 | $EGREP "$match_pattern_regex" > /dev/null; then
3354 newdeplibs="$newdeplibs $a_deplib"
3355 a_deplib=""
3356 break 2
3358 done
3359 done
3361 if test -n "$a_deplib" ; then
3362 droppeddeps=yes
3363 $echo
3364 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3365 $echo "*** I have the capability to make that library automatically link in when"
3366 $echo "*** you link to this library. But I can only do this if you have a"
3367 $echo "*** shared version of the library, which you do not appear to have"
3368 $echo "*** because I did check the linker path looking for a file starting"
3369 if test -z "$potlib" ; then
3370 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3371 else
3372 $echo "*** with $libname and none of the candidates passed a file format test"
3373 $echo "*** using a regex pattern. Last file checked: $potlib"
3376 else
3377 # Add a -L argument.
3378 newdeplibs="$newdeplibs $a_deplib"
3380 done # Gone through all deplibs.
3382 none | unknown | *)
3383 newdeplibs=""
3384 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3385 -e 's/ -[LR][^ ]*//g'`
3386 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3387 for i in $predeps $postdeps ; do
3388 # can't use Xsed below, because $i might contain '/'
3389 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3390 done
3392 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3393 | grep . >/dev/null; then
3394 $echo
3395 if test "X$deplibs_check_method" = "Xnone"; then
3396 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3397 else
3398 $echo "*** Warning: inter-library dependencies are not known to be supported."
3400 $echo "*** All declared inter-library dependencies are being dropped."
3401 droppeddeps=yes
3404 esac
3405 versuffix=$versuffix_save
3406 major=$major_save
3407 release=$release_save
3408 libname=$libname_save
3409 name=$name_save
3411 case $host in
3412 *-*-rhapsody* | *-*-darwin1.[012])
3413 # On Rhapsody replace the C library is the System framework
3414 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3416 esac
3418 if test "$droppeddeps" = yes; then
3419 if test "$module" = yes; then
3420 $echo
3421 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3422 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3423 $echo "*** a static module, that should work as long as the dlopening"
3424 $echo "*** application is linked with the -dlopen flag."
3425 if test -z "$global_symbol_pipe"; then
3426 $echo
3427 $echo "*** However, this would only work if libtool was able to extract symbol"
3428 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3429 $echo "*** not find such a program. So, this module is probably useless."
3430 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3432 if test "$build_old_libs" = no; then
3433 oldlibs="$output_objdir/$libname.$libext"
3434 build_libtool_libs=module
3435 build_old_libs=yes
3436 else
3437 build_libtool_libs=no
3439 else
3440 $echo "*** The inter-library dependencies that have been dropped here will be"
3441 $echo "*** automatically added whenever a program is linked with this library"
3442 $echo "*** or is declared to -dlopen it."
3444 if test "$allow_undefined" = no; then
3445 $echo
3446 $echo "*** Since this library must not contain undefined symbols,"
3447 $echo "*** because either the platform does not support them or"
3448 $echo "*** it was explicitly requested with -no-undefined,"
3449 $echo "*** libtool will only create a static version of it."
3450 if test "$build_old_libs" = no; then
3451 oldlibs="$output_objdir/$libname.$libext"
3452 build_libtool_libs=module
3453 build_old_libs=yes
3454 else
3455 build_libtool_libs=no
3460 # Done checking deplibs!
3461 deplibs=$newdeplibs
3464 # All the library-specific variables (install_libdir is set above).
3465 library_names=
3466 old_library=
3467 dlname=
3469 # Test again, we may have decided not to build it any more
3470 if test "$build_libtool_libs" = yes; then
3471 if test "$hardcode_into_libs" = yes; then
3472 # Hardcode the library paths
3473 hardcode_libdirs=
3474 dep_rpath=
3475 rpath="$finalize_rpath"
3476 test "$mode" != relink && rpath="$compile_rpath$rpath"
3477 for libdir in $rpath; do
3478 if test -n "$hardcode_libdir_flag_spec"; then
3479 if test -n "$hardcode_libdir_separator"; then
3480 if test -z "$hardcode_libdirs"; then
3481 hardcode_libdirs="$libdir"
3482 else
3483 # Just accumulate the unique libdirs.
3484 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3485 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3488 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3490 esac
3492 else
3493 eval flag=\"$hardcode_libdir_flag_spec\"
3494 dep_rpath="$dep_rpath $flag"
3496 elif test -n "$runpath_var"; then
3497 case "$perm_rpath " in
3498 *" $libdir "*) ;;
3499 *) perm_rpath="$perm_rpath $libdir" ;;
3500 esac
3502 done
3503 # Substitute the hardcoded libdirs into the rpath.
3504 if test -n "$hardcode_libdir_separator" &&
3505 test -n "$hardcode_libdirs"; then
3506 libdir="$hardcode_libdirs"
3507 if test -n "$hardcode_libdir_flag_spec_ld"; then
3508 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3509 else
3510 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3513 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3514 # We should set the runpath_var.
3515 rpath=
3516 for dir in $perm_rpath; do
3517 rpath="$rpath$dir:"
3518 done
3519 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3521 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3524 shlibpath="$finalize_shlibpath"
3525 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3526 if test -n "$shlibpath"; then
3527 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3530 # Get the real and link names of the library.
3531 eval shared_ext=\"$shrext\"
3532 eval library_names=\"$library_names_spec\"
3533 set dummy $library_names
3534 realname="$2"
3535 shift; shift
3537 if test -n "$soname_spec"; then
3538 eval soname=\"$soname_spec\"
3539 else
3540 soname="$realname"
3542 if test -z "$dlname"; then
3543 dlname=$soname
3546 lib="$output_objdir/$realname"
3547 for link
3549 linknames="$linknames $link"
3550 done
3552 # Use standard objects if they are pic
3553 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3555 # Prepare the list of exported symbols
3556 if test -z "$export_symbols"; then
3557 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3558 $show "generating symbol list for \`$libname.la'"
3559 export_symbols="$output_objdir/$libname.exp"
3560 $run $rm $export_symbols
3561 eval cmds=\"$export_symbols_cmds\"
3562 save_ifs="$IFS"; IFS='~'
3563 for cmd in $cmds; do
3564 IFS="$save_ifs"
3565 if len=`expr "X$cmd" : ".*"` &&
3566 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3567 $show "$cmd"
3568 $run eval "$cmd" || exit $?
3569 skipped_export=false
3570 else
3571 # The command line is too long to execute in one step.
3572 $show "using reloadable object file for export list..."
3573 skipped_export=:
3575 done
3576 IFS="$save_ifs"
3577 if test -n "$export_symbols_regex"; then
3578 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3579 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3580 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3581 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3586 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3587 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3590 tmp_deplibs=
3591 for test_deplib in $deplibs; do
3592 case " $convenience " in
3593 *" $test_deplib "*) ;;
3595 tmp_deplibs="$tmp_deplibs $test_deplib"
3597 esac
3598 done
3599 deplibs="$tmp_deplibs"
3601 if test -n "$convenience"; then
3602 if test -n "$whole_archive_flag_spec"; then
3603 save_libobjs=$libobjs
3604 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3605 else
3606 gentop="$output_objdir/${outputname}x"
3607 $show "${rm}r $gentop"
3608 $run ${rm}r "$gentop"
3609 $show "$mkdir $gentop"
3610 $run $mkdir "$gentop"
3611 status=$?
3612 if test "$status" -ne 0 && test ! -d "$gentop"; then
3613 exit $status
3615 generated="$generated $gentop"
3617 for xlib in $convenience; do
3618 # Extract the objects.
3619 case $xlib in
3620 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3621 *) xabs=`pwd`"/$xlib" ;;
3622 esac
3623 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3624 xdir="$gentop/$xlib"
3626 $show "${rm}r $xdir"
3627 $run ${rm}r "$xdir"
3628 $show "$mkdir $xdir"
3629 $run $mkdir "$xdir"
3630 status=$?
3631 if test "$status" -ne 0 && test ! -d "$xdir"; then
3632 exit $status
3634 # We will extract separately just the conflicting names and we will no
3635 # longer touch any unique names. It is faster to leave these extract
3636 # automatically by $AR in one run.
3637 $show "(cd $xdir && $AR x $xabs)"
3638 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3639 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3641 else
3642 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3643 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3644 $AR t "$xabs" | sort | uniq -cd | while read -r count name
3647 while test "$i" -le "$count"
3649 # Put our $i before any first dot (extension)
3650 # Never overwrite any file
3651 name_to="$name"
3652 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3654 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3655 done
3656 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3657 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3658 i=`expr $i + 1`
3659 done
3660 done
3663 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3664 done
3668 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3669 eval flag=\"$thread_safe_flag_spec\"
3670 linker_flags="$linker_flags $flag"
3673 # Make a backup of the uninstalled library when relinking
3674 if test "$mode" = relink; then
3675 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3678 # Do each of the archive commands.
3679 if test "$module" = yes && test -n "$module_cmds" ; then
3680 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3681 eval cmds=\"$module_expsym_cmds\"
3682 else
3683 eval cmds=\"$module_cmds\"
3685 else
3686 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3687 eval cmds=\"$archive_expsym_cmds\"
3688 else
3689 eval cmds=\"$archive_cmds\"
3693 if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
3694 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3696 else
3697 # The command line is too long to link in one step, link piecewise.
3698 $echo "creating reloadable object files..."
3700 # Save the value of $output and $libobjs because we want to
3701 # use them later. If we have whole_archive_flag_spec, we
3702 # want to use save_libobjs as it was before
3703 # whole_archive_flag_spec was expanded, because we can't
3704 # assume the linker understands whole_archive_flag_spec.
3705 # This may have to be revisited, in case too many
3706 # convenience libraries get linked in and end up exceeding
3707 # the spec.
3708 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3709 save_libobjs=$libobjs
3711 save_output=$output
3713 # Clear the reloadable object creation command queue and
3714 # initialize k to one.
3715 test_cmds=
3716 concat_cmds=
3717 objlist=
3718 delfiles=
3719 last_robj=
3721 output=$output_objdir/$save_output-${k}.$objext
3722 # Loop over the list of objects to be linked.
3723 for obj in $save_libobjs
3725 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3726 if test "X$objlist" = X ||
3727 { len=`expr "X$test_cmds" : ".*"` &&
3728 test "$len" -le "$max_cmd_len"; }; then
3729 objlist="$objlist $obj"
3730 else
3731 # The command $test_cmds is almost too long, add a
3732 # command to the queue.
3733 if test "$k" -eq 1 ; then
3734 # The first file doesn't have a previous command to add.
3735 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3736 else
3737 # All subsequent reloadable object files will link in
3738 # the last one created.
3739 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3741 last_robj=$output_objdir/$save_output-${k}.$objext
3742 k=`expr $k + 1`
3743 output=$output_objdir/$save_output-${k}.$objext
3744 objlist=$obj
3745 len=1
3747 done
3748 # Handle the remaining objects by creating one last
3749 # reloadable object file. All subsequent reloadable object
3750 # files will link in the last one created.
3751 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3752 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3754 if ${skipped_export-false}; then
3755 $show "generating symbol list for \`$libname.la'"
3756 export_symbols="$output_objdir/$libname.exp"
3757 $run $rm $export_symbols
3758 libobjs=$output
3759 # Append the command to create the export file.
3760 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3763 # Set up a command to remove the reloadale object files
3764 # after they are used.
3766 while test "$i" -lt "$k"
3768 i=`expr $i + 1`
3769 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3770 done
3772 $echo "creating a temporary reloadable object file: $output"
3774 # Loop through the commands generated above and execute them.
3775 save_ifs="$IFS"; IFS='~'
3776 for cmd in $concat_cmds; do
3777 IFS="$save_ifs"
3778 $show "$cmd"
3779 $run eval "$cmd" || exit $?
3780 done
3781 IFS="$save_ifs"
3783 libobjs=$output
3784 # Restore the value of output.
3785 output=$save_output
3787 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3788 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3790 # Expand the library linking commands again to reset the
3791 # value of $libobjs for piecewise linking.
3793 # Do each of the archive commands.
3794 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3795 eval cmds=\"$archive_expsym_cmds\"
3796 else
3797 eval cmds=\"$archive_cmds\"
3800 # Append the command to remove the reloadable object files
3801 # to the just-reset $cmds.
3802 eval cmds=\"\$cmds~$rm $delfiles\"
3804 save_ifs="$IFS"; IFS='~'
3805 for cmd in $cmds; do
3806 IFS="$save_ifs"
3807 $show "$cmd"
3808 $run eval "$cmd" || exit $?
3809 done
3810 IFS="$save_ifs"
3812 # Restore the uninstalled library and exit
3813 if test "$mode" = relink; then
3814 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3815 exit 0
3818 # Create links to the real library.
3819 for linkname in $linknames; do
3820 if test "$realname" != "$linkname"; then
3821 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3822 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3824 done
3826 # If -module or -export-dynamic was specified, set the dlname.
3827 if test "$module" = yes || test "$export_dynamic" = yes; then
3828 # On all known operating systems, these are identical.
3829 dlname="$soname"
3834 obj)
3835 if test -n "$deplibs"; then
3836 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3839 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3840 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3843 if test -n "$rpath"; then
3844 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3847 if test -n "$xrpath"; then
3848 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3851 if test -n "$vinfo"; then
3852 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3855 if test -n "$release"; then
3856 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3859 case $output in
3860 *.lo)
3861 if test -n "$objs$old_deplibs"; then
3862 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3863 exit 1
3865 libobj="$output"
3866 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3869 libobj=
3870 obj="$output"
3872 esac
3874 # Delete the old objects.
3875 $run $rm $obj $libobj
3877 # Objects from convenience libraries. This assumes
3878 # single-version convenience libraries. Whenever we create
3879 # different ones for PIC/non-PIC, this we'll have to duplicate
3880 # the extraction.
3881 reload_conv_objs=
3882 gentop=
3883 # reload_cmds runs $LD directly, so let us get rid of
3884 # -Wl from whole_archive_flag_spec
3887 if test -n "$convenience"; then
3888 if test -n "$whole_archive_flag_spec"; then
3889 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3890 else
3891 gentop="$output_objdir/${obj}x"
3892 $show "${rm}r $gentop"
3893 $run ${rm}r "$gentop"
3894 $show "$mkdir $gentop"
3895 $run $mkdir "$gentop"
3896 status=$?
3897 if test "$status" -ne 0 && test ! -d "$gentop"; then
3898 exit $status
3900 generated="$generated $gentop"
3902 for xlib in $convenience; do
3903 # Extract the objects.
3904 case $xlib in
3905 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3906 *) xabs=`pwd`"/$xlib" ;;
3907 esac
3908 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3909 xdir="$gentop/$xlib"
3911 $show "${rm}r $xdir"
3912 $run ${rm}r "$xdir"
3913 $show "$mkdir $xdir"
3914 $run $mkdir "$xdir"
3915 status=$?
3916 if test "$status" -ne 0 && test ! -d "$xdir"; then
3917 exit $status
3919 # We will extract separately just the conflicting names and we will no
3920 # longer touch any unique names. It is faster to leave these extract
3921 # automatically by $AR in one run.
3922 $show "(cd $xdir && $AR x $xabs)"
3923 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3924 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3926 else
3927 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3928 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3929 $AR t "$xabs" | sort | uniq -cd | while read -r count name
3932 while test "$i" -le "$count"
3934 # Put our $i before any first dot (extension)
3935 # Never overwrite any file
3936 name_to="$name"
3937 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3939 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3940 done
3941 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3942 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3943 i=`expr $i + 1`
3944 done
3945 done
3948 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3949 done
3953 # Create the old-style object.
3954 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
3956 output="$obj"
3957 eval cmds=\"$reload_cmds\"
3958 save_ifs="$IFS"; IFS='~'
3959 for cmd in $cmds; do
3960 IFS="$save_ifs"
3961 $show "$cmd"
3962 $run eval "$cmd" || exit $?
3963 done
3964 IFS="$save_ifs"
3966 # Exit if we aren't doing a library object file.
3967 if test -z "$libobj"; then
3968 if test -n "$gentop"; then
3969 $show "${rm}r $gentop"
3970 $run ${rm}r $gentop
3973 exit 0
3976 if test "$build_libtool_libs" != yes; then
3977 if test -n "$gentop"; then
3978 $show "${rm}r $gentop"
3979 $run ${rm}r $gentop
3982 # Create an invalid libtool object if no PIC, so that we don't
3983 # accidentally link it into a program.
3984 # $show "echo timestamp > $libobj"
3985 # $run eval "echo timestamp > $libobj" || exit $?
3986 exit 0
3989 if test -n "$pic_flag" || test "$pic_mode" != default; then
3990 # Only do commands if we really have different PIC objects.
3991 reload_objs="$libobjs $reload_conv_objs"
3992 output="$libobj"
3993 eval cmds=\"$reload_cmds\"
3994 save_ifs="$IFS"; IFS='~'
3995 for cmd in $cmds; do
3996 IFS="$save_ifs"
3997 $show "$cmd"
3998 $run eval "$cmd" || exit $?
3999 done
4000 IFS="$save_ifs"
4003 if test -n "$gentop"; then
4004 $show "${rm}r $gentop"
4005 $run ${rm}r $gentop
4008 exit 0
4011 prog)
4012 case $host in
4013 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4014 esac
4015 if test -n "$vinfo"; then
4016 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4019 if test -n "$release"; then
4020 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4023 if test "$preload" = yes; then
4024 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4025 test "$dlopen_self_static" = unknown; then
4026 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4030 case $host in
4031 *-*-rhapsody* | *-*-darwin1.[012])
4032 # On Rhapsody replace the C library is the System framework
4033 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4034 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4036 esac
4038 case $host in
4039 *darwin*)
4040 # Don't allow lazy linking, it breaks C++ global constructors
4041 if test "$tagname" = CXX ; then
4042 compile_command="$compile_command ${wl}-bind_at_load"
4043 finalize_command="$finalize_command ${wl}-bind_at_load"
4046 esac
4048 compile_command="$compile_command $compile_deplibs"
4049 finalize_command="$finalize_command $finalize_deplibs"
4051 if test -n "$rpath$xrpath"; then
4052 # If the user specified any rpath flags, then add them.
4053 for libdir in $rpath $xrpath; do
4054 # This is the magic to use -rpath.
4055 case "$finalize_rpath " in
4056 *" $libdir "*) ;;
4057 *) finalize_rpath="$finalize_rpath $libdir" ;;
4058 esac
4059 done
4062 # Now hardcode the library paths
4063 rpath=
4064 hardcode_libdirs=
4065 for libdir in $compile_rpath $finalize_rpath; do
4066 if test -n "$hardcode_libdir_flag_spec"; then
4067 if test -n "$hardcode_libdir_separator"; then
4068 if test -z "$hardcode_libdirs"; then
4069 hardcode_libdirs="$libdir"
4070 else
4071 # Just accumulate the unique libdirs.
4072 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4073 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4076 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4078 esac
4080 else
4081 eval flag=\"$hardcode_libdir_flag_spec\"
4082 rpath="$rpath $flag"
4084 elif test -n "$runpath_var"; then
4085 case "$perm_rpath " in
4086 *" $libdir "*) ;;
4087 *) perm_rpath="$perm_rpath $libdir" ;;
4088 esac
4090 case $host in
4091 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4092 case :$dllsearchpath: in
4093 *":$libdir:"*) ;;
4094 *) dllsearchpath="$dllsearchpath:$libdir";;
4095 esac
4097 esac
4098 done
4099 # Substitute the hardcoded libdirs into the rpath.
4100 if test -n "$hardcode_libdir_separator" &&
4101 test -n "$hardcode_libdirs"; then
4102 libdir="$hardcode_libdirs"
4103 eval rpath=\" $hardcode_libdir_flag_spec\"
4105 compile_rpath="$rpath"
4107 rpath=
4108 hardcode_libdirs=
4109 for libdir in $finalize_rpath; do
4110 if test -n "$hardcode_libdir_flag_spec"; then
4111 if test -n "$hardcode_libdir_separator"; then
4112 if test -z "$hardcode_libdirs"; then
4113 hardcode_libdirs="$libdir"
4114 else
4115 # Just accumulate the unique libdirs.
4116 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4117 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4120 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4122 esac
4124 else
4125 eval flag=\"$hardcode_libdir_flag_spec\"
4126 rpath="$rpath $flag"
4128 elif test -n "$runpath_var"; then
4129 case "$finalize_perm_rpath " in
4130 *" $libdir "*) ;;
4131 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4132 esac
4134 done
4135 # Substitute the hardcoded libdirs into the rpath.
4136 if test -n "$hardcode_libdir_separator" &&
4137 test -n "$hardcode_libdirs"; then
4138 libdir="$hardcode_libdirs"
4139 eval rpath=\" $hardcode_libdir_flag_spec\"
4141 finalize_rpath="$rpath"
4143 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4144 # Transform all the library objects into standard objects.
4145 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4146 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4149 dlsyms=
4150 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4151 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4152 dlsyms="${outputname}S.c"
4153 else
4154 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4158 if test -n "$dlsyms"; then
4159 case $dlsyms in
4160 "") ;;
4161 *.c)
4162 # Discover the nlist of each of the dlfiles.
4163 nlist="$output_objdir/${outputname}.nm"
4165 $show "$rm $nlist ${nlist}S ${nlist}T"
4166 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4168 # Parse the name list into a source file.
4169 $show "creating $output_objdir/$dlsyms"
4171 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4172 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4173 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4175 #ifdef __cplusplus
4176 extern \"C\" {
4177 #endif
4179 /* Prevent the only kind of declaration conflicts we can make. */
4180 #define lt_preloaded_symbols some_other_symbol
4182 /* External symbol declarations for the compiler. */\
4185 if test "$dlself" = yes; then
4186 $show "generating symbol list for \`$output'"
4188 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4190 # Add our own program objects to the symbol list.
4191 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4192 for arg in $progfiles; do
4193 $show "extracting global C symbols from \`$arg'"
4194 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4195 done
4197 if test -n "$exclude_expsyms"; then
4198 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4199 $run eval '$mv "$nlist"T "$nlist"'
4202 if test -n "$export_symbols_regex"; then
4203 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4204 $run eval '$mv "$nlist"T "$nlist"'
4207 # Prepare the list of exported symbols
4208 if test -z "$export_symbols"; then
4209 export_symbols="$output_objdir/$output.exp"
4210 $run $rm $export_symbols
4211 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4212 else
4213 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4214 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4215 $run eval 'mv "$nlist"T "$nlist"'
4219 for arg in $dlprefiles; do
4220 $show "extracting global C symbols from \`$arg'"
4221 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4222 $run eval '$echo ": $name " >> "$nlist"'
4223 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4224 done
4226 if test -z "$run"; then
4227 # Make sure we have at least an empty file.
4228 test -f "$nlist" || : > "$nlist"
4230 if test -n "$exclude_expsyms"; then
4231 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4232 $mv "$nlist"T "$nlist"
4235 # Try sorting and uniquifying the output.
4236 if grep -v "^: " < "$nlist" |
4237 if sort -k 3 </dev/null >/dev/null 2>&1; then
4238 sort -k 3
4239 else
4240 sort +2
4241 fi |
4242 uniq > "$nlist"S; then
4244 else
4245 grep -v "^: " < "$nlist" > "$nlist"S
4248 if test -f "$nlist"S; then
4249 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4250 else
4251 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4254 $echo >> "$output_objdir/$dlsyms" "\
4256 #undef lt_preloaded_symbols
4258 #if defined (__STDC__) && __STDC__
4259 # define lt_ptr void *
4260 #else
4261 # define lt_ptr char *
4262 # define const
4263 #endif
4265 /* The mapping between symbol names and symbols. */
4266 const struct {
4267 const char *name;
4268 lt_ptr address;
4270 lt_preloaded_symbols[] =
4274 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4276 $echo >> "$output_objdir/$dlsyms" "\
4277 {0, (lt_ptr) 0}
4280 /* This works around a problem in FreeBSD linker */
4281 #ifdef FREEBSD_WORKAROUND
4282 static const void *lt_preloaded_setup() {
4283 return lt_preloaded_symbols;
4285 #endif
4287 #ifdef __cplusplus
4289 #endif\
4293 pic_flag_for_symtable=
4294 case $host in
4295 # compiling the symbol table file with pic_flag works around
4296 # a FreeBSD bug that causes programs to crash when -lm is
4297 # linked before any other PIC object. But we must not use
4298 # pic_flag when linking with -static. The problem exists in
4299 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4300 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4301 case "$compile_command " in
4302 *" -static "*) ;;
4303 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4304 esac;;
4305 *-*-hpux*)
4306 case "$compile_command " in
4307 *" -static "*) ;;
4308 *) pic_flag_for_symtable=" $pic_flag";;
4309 esac
4310 esac
4312 # Now compile the dynamic symbol file.
4313 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4314 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4316 # Clean up the generated files.
4317 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4318 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4320 # Transform the symbol file into the correct name.
4321 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4322 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4325 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4326 exit 1
4328 esac
4329 else
4330 # We keep going just in case the user didn't refer to
4331 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4332 # really was required.
4334 # Nullify the symbol file.
4335 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4336 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4339 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4340 # Replace the output file specification.
4341 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4342 link_command="$compile_command$compile_rpath"
4344 # We have no uninstalled library dependencies, so finalize right now.
4345 $show "$link_command"
4346 $run eval "$link_command"
4347 status=$?
4349 # Delete the generated files.
4350 if test -n "$dlsyms"; then
4351 $show "$rm $output_objdir/${outputname}S.${objext}"
4352 $run $rm "$output_objdir/${outputname}S.${objext}"
4355 exit $status
4358 if test -n "$shlibpath_var"; then
4359 # We should set the shlibpath_var
4360 rpath=
4361 for dir in $temp_rpath; do
4362 case $dir in
4363 [\\/]* | [A-Za-z]:[\\/]*)
4364 # Absolute path.
4365 rpath="$rpath$dir:"
4368 # Relative path: add a thisdir entry.
4369 rpath="$rpath\$thisdir/$dir:"
4371 esac
4372 done
4373 temp_rpath="$rpath"
4376 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4377 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4379 if test -n "$finalize_shlibpath"; then
4380 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4383 compile_var=
4384 finalize_var=
4385 if test -n "$runpath_var"; then
4386 if test -n "$perm_rpath"; then
4387 # We should set the runpath_var.
4388 rpath=
4389 for dir in $perm_rpath; do
4390 rpath="$rpath$dir:"
4391 done
4392 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4394 if test -n "$finalize_perm_rpath"; then
4395 # We should set the runpath_var.
4396 rpath=
4397 for dir in $finalize_perm_rpath; do
4398 rpath="$rpath$dir:"
4399 done
4400 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4404 if test "$no_install" = yes; then
4405 # We don't need to create a wrapper script.
4406 link_command="$compile_var$compile_command$compile_rpath"
4407 # Replace the output file specification.
4408 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4409 # Delete the old output file.
4410 $run $rm $output
4411 # Link the executable and exit
4412 $show "$link_command"
4413 $run eval "$link_command" || exit $?
4414 exit 0
4417 if test "$hardcode_action" = relink; then
4418 # Fast installation is not supported
4419 link_command="$compile_var$compile_command$compile_rpath"
4420 relink_command="$finalize_var$finalize_command$finalize_rpath"
4422 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4423 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4424 else
4425 if test "$fast_install" != no; then
4426 link_command="$finalize_var$compile_command$finalize_rpath"
4427 if test "$fast_install" = yes; then
4428 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4429 else
4430 # fast_install is set to needless
4431 relink_command=
4433 else
4434 link_command="$compile_var$compile_command$compile_rpath"
4435 relink_command="$finalize_var$finalize_command$finalize_rpath"
4439 # Replace the output file specification.
4440 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4442 # Delete the old output files.
4443 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4445 $show "$link_command"
4446 $run eval "$link_command" || exit $?
4448 # Now create the wrapper script.
4449 $show "creating $output"
4451 # Quote the relink command for shipping.
4452 if test -n "$relink_command"; then
4453 # Preserve any variables that may affect compiler behavior
4454 for var in $variables_saved_for_relink; do
4455 if eval test -z \"\${$var+set}\"; then
4456 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4457 elif eval var_value=\$$var; test -z "$var_value"; then
4458 relink_command="$var=; export $var; $relink_command"
4459 else
4460 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4461 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4463 done
4464 relink_command="(cd `pwd`; $relink_command)"
4465 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4468 # Quote $echo for shipping.
4469 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4470 case $0 in
4471 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4472 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4473 esac
4474 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4475 else
4476 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4479 # Only actually do things if our run command is non-null.
4480 if test -z "$run"; then
4481 # win32 will think the script is a binary if it has
4482 # a .exe suffix, so we strip it off here.
4483 case $output in
4484 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4485 esac
4486 # test for cygwin because mv fails w/o .exe extensions
4487 case $host in
4488 *cygwin*)
4489 exeext=.exe
4490 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4491 *) exeext= ;;
4492 esac
4493 case $host in
4494 *cygwin* | *mingw* )
4495 cwrappersource=`$echo ${objdir}/lt-${output}.c`
4496 cwrapper=`$echo ${output}.exe`
4497 $rm $cwrappersource $cwrapper
4498 trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
4500 cat > $cwrappersource <<EOF
4502 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4503 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4505 The $output program cannot be directly executed until all the libtool
4506 libraries that it depends on are installed.
4508 This wrapper executable should never be moved out of the build directory.
4509 If it is, it will not operate correctly.
4511 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4512 but could eventually absorb all of the scripts functionality and
4513 exec $objdir/$outputname directly.
4516 cat >> $cwrappersource<<"EOF"
4517 #include <stdio.h>
4518 #include <stdlib.h>
4519 #include <unistd.h>
4520 #include <malloc.h>
4521 #include <stdarg.h>
4522 #include <assert.h>
4524 #if defined(PATH_MAX)
4525 # define LT_PATHMAX PATH_MAX
4526 #elif defined(MAXPATHLEN)
4527 # define LT_PATHMAX MAXPATHLEN
4528 #else
4529 # define LT_PATHMAX 1024
4530 #endif
4532 #ifndef DIR_SEPARATOR
4533 #define DIR_SEPARATOR '/'
4534 #endif
4536 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4537 defined (__OS2__)
4538 #define HAVE_DOS_BASED_FILE_SYSTEM
4539 #ifndef DIR_SEPARATOR_2
4540 #define DIR_SEPARATOR_2 '\\'
4541 #endif
4542 #endif
4544 #ifndef DIR_SEPARATOR_2
4545 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4546 #else /* DIR_SEPARATOR_2 */
4547 # define IS_DIR_SEPARATOR(ch) \
4548 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4549 #endif /* DIR_SEPARATOR_2 */
4551 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4552 #define XFREE(stale) do { \
4553 if (stale) { free ((void *) stale); stale = 0; } \
4554 } while (0)
4556 const char *program_name = NULL;
4558 void * xmalloc (size_t num);
4559 char * xstrdup (const char *string);
4560 char * basename (const char *name);
4561 char * fnqualify(const char *path);
4562 char * strendzap(char *str, const char *pat);
4563 void lt_fatal (const char *message, ...);
4566 main (int argc, char *argv[])
4568 char **newargz;
4569 int i;
4571 program_name = (char *) xstrdup ((char *) basename (argv[0]));
4572 newargz = XMALLOC(char *, argc+2);
4575 cat >> $cwrappersource <<EOF
4576 newargz[0] = "$SHELL";
4579 cat >> $cwrappersource <<"EOF"
4580 newargz[1] = fnqualify(argv[0]);
4581 /* we know the script has the same name, without the .exe */
4582 /* so make sure newargz[1] doesn't end in .exe */
4583 strendzap(newargz[1],".exe");
4584 for (i = 1; i < argc; i++)
4585 newargz[i+1] = xstrdup(argv[i]);
4586 newargz[argc+1] = NULL;
4589 cat >> $cwrappersource <<EOF
4590 execv("$SHELL",newargz);
4593 cat >> $cwrappersource <<"EOF"
4596 void *
4597 xmalloc (size_t num)
4599 void * p = (void *) malloc (num);
4600 if (!p)
4601 lt_fatal ("Memory exhausted");
4603 return p;
4606 char *
4607 xstrdup (const char *string)
4609 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4613 char *
4614 basename (const char *name)
4616 const char *base;
4618 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4619 /* Skip over the disk name in MSDOS pathnames. */
4620 if (isalpha (name[0]) && name[1] == ':')
4621 name += 2;
4622 #endif
4624 for (base = name; *name; name++)
4625 if (IS_DIR_SEPARATOR (*name))
4626 base = name + 1;
4627 return (char *) base;
4630 char *
4631 fnqualify(const char *path)
4633 size_t size;
4634 char *p;
4635 char tmp[LT_PATHMAX + 1];
4637 assert(path != NULL);
4639 /* Is it qualified already? */
4640 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4641 if (isalpha (path[0]) && path[1] == ':')
4642 return xstrdup (path);
4643 #endif
4644 if (IS_DIR_SEPARATOR (path[0]))
4645 return xstrdup (path);
4647 /* prepend the current directory */
4648 /* doesn't handle '~' */
4649 if (getcwd (tmp, LT_PATHMAX) == NULL)
4650 lt_fatal ("getcwd failed");
4651 size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4652 p = XMALLOC(char, size);
4653 sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4654 return p;
4657 char *
4658 strendzap(char *str, const char *pat)
4660 size_t len, patlen;
4662 assert(str != NULL);
4663 assert(pat != NULL);
4665 len = strlen(str);
4666 patlen = strlen(pat);
4668 if (patlen <= len)
4670 str += len - patlen;
4671 if (strcmp(str, pat) == 0)
4672 *str = '\0';
4674 return str;
4677 static void
4678 lt_error_core (int exit_status, const char * mode,
4679 const char * message, va_list ap)
4681 fprintf (stderr, "%s: %s: ", program_name, mode);
4682 vfprintf (stderr, message, ap);
4683 fprintf (stderr, ".\n");
4685 if (exit_status >= 0)
4686 exit (exit_status);
4689 void
4690 lt_fatal (const char *message, ...)
4692 va_list ap;
4693 va_start (ap, message);
4694 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4695 va_end (ap);
4698 # we should really use a build-platform specific compiler
4699 # here, but OTOH, the wrappers (shell script and this C one)
4700 # are only useful if you want to execute the "real" binary.
4701 # Since the "real" binary is built for $host, then this
4702 # wrapper might as well be built for $host, too.
4703 $run $LTCC -s -o $cwrapper $cwrappersource
4705 esac
4706 $rm $output
4707 trap "$rm $output; exit 1" 1 2 15
4709 $echo > $output "\
4710 #! $SHELL
4712 # $output - temporary wrapper script for $objdir/$outputname
4713 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4715 # The $output program cannot be directly executed until all the libtool
4716 # libraries that it depends on are installed.
4718 # This wrapper script should never be moved out of the build directory.
4719 # If it is, it will not operate correctly.
4721 # Sed substitution that helps us do robust quoting. It backslashifies
4722 # metacharacters that are still active within double-quoted strings.
4723 Xsed='${SED} -e 1s/^X//'
4724 sed_quote_subst='$sed_quote_subst'
4726 # The HP-UX ksh and POSIX shell print the target directory to stdout
4727 # if CDPATH is set.
4728 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
4730 relink_command=\"$relink_command\"
4732 # This environment variable determines our operation mode.
4733 if test \"\$libtool_install_magic\" = \"$magic\"; then
4734 # install mode needs the following variable:
4735 notinst_deplibs='$notinst_deplibs'
4736 else
4737 # When we are sourced in execute mode, \$file and \$echo are already set.
4738 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4739 echo=\"$qecho\"
4740 file=\"\$0\"
4741 # Make sure echo works.
4742 if test \"X\$1\" = X--no-reexec; then
4743 # Discard the --no-reexec flag, and continue.
4744 shift
4745 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4746 # Yippee, \$echo works!
4748 else
4749 # Restart under the correct shell, and then maybe \$echo will work.
4750 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4754 $echo >> $output "\
4756 # Find the directory that this script lives in.
4757 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4758 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4760 # Follow symbolic links until we get to the real thisdir.
4761 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
4762 while test -n \"\$file\"; do
4763 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4765 # If there was a directory component, then change thisdir.
4766 if test \"x\$destdir\" != \"x\$file\"; then
4767 case \"\$destdir\" in
4768 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4769 *) thisdir=\"\$thisdir/\$destdir\" ;;
4770 esac
4773 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4774 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
4775 done
4777 # Try to get the absolute directory name.
4778 absdir=\`cd \"\$thisdir\" && pwd\`
4779 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4782 if test "$fast_install" = yes; then
4783 $echo >> $output "\
4784 program=lt-'$outputname'$exeext
4785 progdir=\"\$thisdir/$objdir\"
4787 if test ! -f \"\$progdir/\$program\" || \\
4788 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4789 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4791 file=\"\$\$-\$program\"
4793 if test ! -d \"\$progdir\"; then
4794 $mkdir \"\$progdir\"
4795 else
4796 $rm \"\$progdir/\$file\"
4799 $echo >> $output "\
4801 # relink executable if necessary
4802 if test -n \"\$relink_command\"; then
4803 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4804 else
4805 $echo \"\$relink_command_output\" >&2
4806 $rm \"\$progdir/\$file\"
4807 exit 1
4811 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4812 { $rm \"\$progdir/\$program\";
4813 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4814 $rm \"\$progdir/\$file\"
4816 else
4817 $echo >> $output "\
4818 program='$outputname'
4819 progdir=\"\$thisdir/$objdir\"
4823 $echo >> $output "\
4825 if test -f \"\$progdir/\$program\"; then"
4827 # Export our shlibpath_var if we have one.
4828 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4829 $echo >> $output "\
4830 # Add our own library path to $shlibpath_var
4831 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4833 # Some systems cannot cope with colon-terminated $shlibpath_var
4834 # The second colon is a workaround for a bug in BeOS R4 sed
4835 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4837 export $shlibpath_var
4841 # fixup the dll searchpath if we need to.
4842 if test -n "$dllsearchpath"; then
4843 $echo >> $output "\
4844 # Add the dll search path components to the executable PATH
4845 PATH=$dllsearchpath:\$PATH
4849 $echo >> $output "\
4850 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4851 # Run the actual program with our arguments.
4853 case $host in
4854 # Backslashes separate directories on plain windows
4855 *-*-mingw | *-*-os2*)
4856 $echo >> $output "\
4857 exec \$progdir\\\\\$program \${1+\"\$@\"}
4862 $echo >> $output "\
4863 exec \$progdir/\$program \${1+\"\$@\"}
4866 esac
4867 $echo >> $output "\
4868 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4869 exit 1
4871 else
4872 # The program doesn't exist.
4873 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4874 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4875 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4876 exit 1
4880 chmod +x $output
4882 exit 0
4884 esac
4886 # See if we need to build an old-fashioned archive.
4887 for oldlib in $oldlibs; do
4889 if test "$build_libtool_libs" = convenience; then
4890 oldobjs="$libobjs_save"
4891 addlibs="$convenience"
4892 build_libtool_libs=no
4893 else
4894 if test "$build_libtool_libs" = module; then
4895 oldobjs="$libobjs_save"
4896 build_libtool_libs=no
4897 else
4898 oldobjs="$old_deplibs $non_pic_objects"
4900 addlibs="$old_convenience"
4903 if test -n "$addlibs"; then
4904 gentop="$output_objdir/${outputname}x"
4905 $show "${rm}r $gentop"
4906 $run ${rm}r "$gentop"
4907 $show "$mkdir $gentop"
4908 $run $mkdir "$gentop"
4909 status=$?
4910 if test "$status" -ne 0 && test ! -d "$gentop"; then
4911 exit $status
4913 generated="$generated $gentop"
4915 # Add in members from convenience archives.
4916 for xlib in $addlibs; do
4917 # Extract the objects.
4918 case $xlib in
4919 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4920 *) xabs=`pwd`"/$xlib" ;;
4921 esac
4922 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4923 xdir="$gentop/$xlib"
4925 $show "${rm}r $xdir"
4926 $run ${rm}r "$xdir"
4927 $show "$mkdir $xdir"
4928 $run $mkdir "$xdir"
4929 status=$?
4930 if test "$status" -ne 0 && test ! -d "$xdir"; then
4931 exit $status
4933 # We will extract separately just the conflicting names and we will no
4934 # longer touch any unique names. It is faster to leave these extract
4935 # automatically by $AR in one run.
4936 $show "(cd $xdir && $AR x $xabs)"
4937 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4938 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4940 else
4941 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4942 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4943 $AR t "$xabs" | sort | uniq -cd | while read -r count name
4946 while test "$i" -le "$count"
4948 # Put our $i before any first dot (extension)
4949 # Never overwrite any file
4950 name_to="$name"
4951 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4953 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4954 done
4955 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4956 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4957 i=`expr $i + 1`
4958 done
4959 done
4962 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
4963 done
4966 # Do each command in the archive commands.
4967 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4968 eval cmds=\"$old_archive_from_new_cmds\"
4969 else
4970 eval cmds=\"$old_archive_cmds\"
4972 if len=`expr "X$cmds" : ".*"` &&
4973 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4975 else
4976 # the command line is too long to link in one step, link in parts
4977 $echo "using piecewise archive linking..."
4978 save_RANLIB=$RANLIB
4979 RANLIB=:
4980 objlist=
4981 concat_cmds=
4982 save_oldobjs=$oldobjs
4983 # GNU ar 2.10+ was changed to match POSIX; thus no paths are
4984 # encoded into archives. This makes 'ar r' malfunction in
4985 # this piecewise linking case whenever conflicting object
4986 # names appear in distinct ar calls; check, warn and compensate.
4987 if (for obj in $save_oldobjs
4989 $echo "X$obj" | $Xsed -e 's%^.*/%%'
4990 done | sort | sort -uc >/dev/null 2>&1); then
4992 else
4993 $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
4994 $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
4995 AR_FLAGS=cq
4997 # Is there a better way of finding the last object in the list?
4998 for obj in $save_oldobjs
5000 last_oldobj=$obj
5001 done
5002 for obj in $save_oldobjs
5004 oldobjs="$objlist $obj"
5005 objlist="$objlist $obj"
5006 eval test_cmds=\"$old_archive_cmds\"
5007 if len=`expr "X$test_cmds" : ".*"` &&
5008 test "$len" -le "$max_cmd_len"; then
5010 else
5011 # the above command should be used before it gets too long
5012 oldobjs=$objlist
5013 if test "$obj" = "$last_oldobj" ; then
5014 RANLIB=$save_RANLIB
5016 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5017 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5018 objlist=
5020 done
5021 RANLIB=$save_RANLIB
5022 oldobjs=$objlist
5023 if test "X$oldobjs" = "X" ; then
5024 eval cmds=\"\$concat_cmds\"
5025 else
5026 eval cmds=\"\$concat_cmds~$old_archive_cmds\"
5030 save_ifs="$IFS"; IFS='~'
5031 for cmd in $cmds; do
5032 IFS="$save_ifs"
5033 $show "$cmd"
5034 $run eval "$cmd" || exit $?
5035 done
5036 IFS="$save_ifs"
5037 done
5039 if test -n "$generated"; then
5040 $show "${rm}r$generated"
5041 $run ${rm}r$generated
5044 # Now create the libtool archive.
5045 case $output in
5046 *.la)
5047 old_library=
5048 test "$build_old_libs" = yes && old_library="$libname.$libext"
5049 $show "creating $output"
5051 # Preserve any variables that may affect compiler behavior
5052 for var in $variables_saved_for_relink; do
5053 if eval test -z \"\${$var+set}\"; then
5054 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5055 elif eval var_value=\$$var; test -z "$var_value"; then
5056 relink_command="$var=; export $var; $relink_command"
5057 else
5058 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5059 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5061 done
5062 # Quote the link command for shipping.
5063 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
5064 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5065 if test "$hardcode_automatic" = yes ; then
5066 relink_command=
5068 # Only create the output if not a dry run.
5069 if test -z "$run"; then
5070 for installed in no yes; do
5071 if test "$installed" = yes; then
5072 if test -z "$install_libdir"; then
5073 break
5075 output="$output_objdir/$outputname"i
5076 # Replace all uninstalled libtool libraries with the installed ones
5077 newdependency_libs=
5078 for deplib in $dependency_libs; do
5079 case $deplib in
5080 *.la)
5081 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5082 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5083 if test -z "$libdir"; then
5084 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5085 exit 1
5087 newdependency_libs="$newdependency_libs $libdir/$name"
5089 *) newdependency_libs="$newdependency_libs $deplib" ;;
5090 esac
5091 done
5092 dependency_libs="$newdependency_libs"
5093 newdlfiles=
5094 for lib in $dlfiles; do
5095 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5096 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5097 if test -z "$libdir"; then
5098 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5099 exit 1
5101 newdlfiles="$newdlfiles $libdir/$name"
5102 done
5103 dlfiles="$newdlfiles"
5104 newdlprefiles=
5105 for lib in $dlprefiles; do
5106 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5107 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5108 if test -z "$libdir"; then
5109 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5110 exit 1
5112 newdlprefiles="$newdlprefiles $libdir/$name"
5113 done
5114 dlprefiles="$newdlprefiles"
5115 else
5116 newdlfiles=
5117 for lib in $dlfiles; do
5118 case $lib in
5119 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5120 *) abs=`pwd`"/$lib" ;;
5121 esac
5122 newdlfiles="$newdlfiles $abs"
5123 done
5124 dlfiles="$newdlfiles"
5125 newdlprefiles=
5126 for lib in $dlprefiles; do
5127 case $lib in
5128 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5129 *) abs=`pwd`"/$lib" ;;
5130 esac
5131 newdlprefiles="$newdlprefiles $abs"
5132 done
5133 dlprefiles="$newdlprefiles"
5135 $rm $output
5136 # place dlname in correct position for cygwin
5137 tdlname=$dlname
5138 case $host,$output,$installed,$module,$dlname in
5139 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5140 esac
5141 $echo > $output "\
5142 # $outputname - a libtool library file
5143 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5145 # Please DO NOT delete this file!
5146 # It is necessary for linking the library.
5148 # The name that we can dlopen(3).
5149 dlname='$tdlname'
5151 # Names of this library.
5152 library_names='$library_names'
5154 # The name of the static archive.
5155 old_library='$old_library'
5157 # Libraries that this one depends upon.
5158 dependency_libs='$dependency_libs'
5160 # Version information for $libname.
5161 current=$current
5162 age=$age
5163 revision=$revision
5165 # Is this an already installed library?
5166 installed=$installed
5168 # Should we warn about portability when linking against -modules?
5169 shouldnotlink=$module
5171 # Files to dlopen/dlpreopen
5172 dlopen='$dlfiles'
5173 dlpreopen='$dlprefiles'
5175 # Directory that this library needs to be installed in:
5176 libdir='$install_libdir'"
5177 if test "$installed" = no && test "$need_relink" = yes; then
5178 $echo >> $output "\
5179 relink_command=\"$relink_command\""
5181 done
5184 # Do a symbolic link so that the libtool archive can be found in
5185 # LD_LIBRARY_PATH before the program is installed.
5186 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5187 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5189 esac
5190 exit 0
5193 # libtool install mode
5194 install)
5195 modename="$modename: install"
5197 # There may be an optional sh(1) argument at the beginning of
5198 # install_prog (especially on Windows NT).
5199 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5200 # Allow the use of GNU shtool's install command.
5201 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
5202 # Aesthetically quote it.
5203 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5204 case $arg in
5205 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5206 arg="\"$arg\""
5208 esac
5209 install_prog="$arg "
5210 arg="$1"
5211 shift
5212 else
5213 install_prog=
5214 arg="$nonopt"
5217 # The real first argument should be the name of the installation program.
5218 # Aesthetically quote it.
5219 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5220 case $arg in
5221 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5222 arg="\"$arg\""
5224 esac
5225 install_prog="$install_prog$arg"
5227 # We need to accept at least all the BSD install flags.
5228 dest=
5229 files=
5230 opts=
5231 prev=
5232 install_type=
5233 isdir=no
5234 stripme=
5235 for arg
5237 if test -n "$dest"; then
5238 files="$files $dest"
5239 dest="$arg"
5240 continue
5243 case $arg in
5244 -d) isdir=yes ;;
5245 -f) prev="-f" ;;
5246 -g) prev="-g" ;;
5247 -m) prev="-m" ;;
5248 -o) prev="-o" ;;
5250 stripme=" -s"
5251 continue
5253 -*) ;;
5256 # If the previous option needed an argument, then skip it.
5257 if test -n "$prev"; then
5258 prev=
5259 else
5260 dest="$arg"
5261 continue
5264 esac
5266 # Aesthetically quote the argument.
5267 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5268 case $arg in
5269 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5270 arg="\"$arg\""
5272 esac
5273 install_prog="$install_prog $arg"
5274 done
5276 if test -z "$install_prog"; then
5277 $echo "$modename: you must specify an install program" 1>&2
5278 $echo "$help" 1>&2
5279 exit 1
5282 if test -n "$prev"; then
5283 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5284 $echo "$help" 1>&2
5285 exit 1
5288 if test -z "$files"; then
5289 if test -z "$dest"; then
5290 $echo "$modename: no file or destination specified" 1>&2
5291 else
5292 $echo "$modename: you must specify a destination" 1>&2
5294 $echo "$help" 1>&2
5295 exit 1
5298 # Strip any trailing slash from the destination.
5299 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5301 # Check to see that the destination is a directory.
5302 test -d "$dest" && isdir=yes
5303 if test "$isdir" = yes; then
5304 destdir="$dest"
5305 destname=
5306 else
5307 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5308 test "X$destdir" = "X$dest" && destdir=.
5309 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5311 # Not a directory, so check to see that there is only one file specified.
5312 set dummy $files
5313 if test "$#" -gt 2; then
5314 $echo "$modename: \`$dest' is not a directory" 1>&2
5315 $echo "$help" 1>&2
5316 exit 1
5319 case $destdir in
5320 [\\/]* | [A-Za-z]:[\\/]*) ;;
5322 for file in $files; do
5323 case $file in
5324 *.lo) ;;
5326 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5327 $echo "$help" 1>&2
5328 exit 1
5330 esac
5331 done
5333 esac
5335 # This variable tells wrapper scripts just to set variables rather
5336 # than running their programs.
5337 libtool_install_magic="$magic"
5339 staticlibs=
5340 future_libdirs=
5341 current_libdirs=
5342 for file in $files; do
5344 # Do each installation.
5345 case $file in
5346 *.$libext)
5347 # Do the static libraries later.
5348 staticlibs="$staticlibs $file"
5351 *.la)
5352 # Check to see that this really is a libtool archive.
5353 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5354 else
5355 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5356 $echo "$help" 1>&2
5357 exit 1
5360 library_names=
5361 old_library=
5362 relink_command=
5363 # If there is no directory component, then add one.
5364 case $file in
5365 */* | *\\*) . $file ;;
5366 *) . ./$file ;;
5367 esac
5369 # Add the libdir to current_libdirs if it is the destination.
5370 if test "X$destdir" = "X$libdir"; then
5371 case "$current_libdirs " in
5372 *" $libdir "*) ;;
5373 *) current_libdirs="$current_libdirs $libdir" ;;
5374 esac
5375 else
5376 # Note the libdir as a future libdir.
5377 case "$future_libdirs " in
5378 *" $libdir "*) ;;
5379 *) future_libdirs="$future_libdirs $libdir" ;;
5380 esac
5383 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5384 test "X$dir" = "X$file/" && dir=
5385 dir="$dir$objdir"
5387 if test -n "$relink_command"; then
5388 # Determine the prefix the user has applied to our future dir.
5389 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5391 # Don't allow the user to place us outside of our expected
5392 # location b/c this prevents finding dependent libraries that
5393 # are installed to the same prefix.
5394 # At present, this check doesn't affect windows .dll's that
5395 # are installed into $libdir/../bin (currently, that works fine)
5396 # but it's something to keep an eye on.
5397 if test "$inst_prefix_dir" = "$destdir"; then
5398 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5399 exit 1
5402 if test -n "$inst_prefix_dir"; then
5403 # Stick the inst_prefix_dir data into the link command.
5404 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5405 else
5406 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5409 $echo "$modename: warning: relinking \`$file'" 1>&2
5410 $show "$relink_command"
5411 if $run eval "$relink_command"; then :
5412 else
5413 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5414 exit 1
5418 # See the names of the shared library.
5419 set dummy $library_names
5420 if test -n "$2"; then
5421 realname="$2"
5422 shift
5423 shift
5425 srcname="$realname"
5426 test -n "$relink_command" && srcname="$realname"T
5428 # Install the shared library and build the symlinks.
5429 $show "$install_prog $dir/$srcname $destdir/$realname"
5430 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5431 if test -n "$stripme" && test -n "$striplib"; then
5432 $show "$striplib $destdir/$realname"
5433 $run eval "$striplib $destdir/$realname" || exit $?
5436 if test "$#" -gt 0; then
5437 # Delete the old symlinks, and create new ones.
5438 for linkname
5440 if test "$linkname" != "$realname"; then
5441 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5442 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5444 done
5447 # Do each command in the postinstall commands.
5448 lib="$destdir/$realname"
5449 eval cmds=\"$postinstall_cmds\"
5450 save_ifs="$IFS"; IFS='~'
5451 for cmd in $cmds; do
5452 IFS="$save_ifs"
5453 $show "$cmd"
5454 $run eval "$cmd" || exit $?
5455 done
5456 IFS="$save_ifs"
5459 # Install the pseudo-library for information purposes.
5460 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5461 instname="$dir/$name"i
5462 $show "$install_prog $instname $destdir/$name"
5463 $run eval "$install_prog $instname $destdir/$name" || exit $?
5465 # Maybe install the static library, too.
5466 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
5469 *.lo)
5470 # Install (i.e. copy) a libtool object.
5472 # Figure out destination file name, if it wasn't already specified.
5473 if test -n "$destname"; then
5474 destfile="$destdir/$destname"
5475 else
5476 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5477 destfile="$destdir/$destfile"
5480 # Deduce the name of the destination old-style object file.
5481 case $destfile in
5482 *.lo)
5483 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
5485 *.$objext)
5486 staticdest="$destfile"
5487 destfile=
5490 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5491 $echo "$help" 1>&2
5492 exit 1
5494 esac
5496 # Install the libtool object if requested.
5497 if test -n "$destfile"; then
5498 $show "$install_prog $file $destfile"
5499 $run eval "$install_prog $file $destfile" || exit $?
5502 # Install the old object if enabled.
5503 if test "$build_old_libs" = yes; then
5504 # Deduce the name of the old-style object file.
5505 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
5507 $show "$install_prog $staticobj $staticdest"
5508 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5510 exit 0
5514 # Figure out destination file name, if it wasn't already specified.
5515 if test -n "$destname"; then
5516 destfile="$destdir/$destname"
5517 else
5518 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5519 destfile="$destdir/$destfile"
5522 # If the file is missing, and there is a .exe on the end, strip it
5523 # because it is most likely a libtool script we actually want to
5524 # install
5525 stripped_ext=""
5526 case $file in
5527 *.exe)
5528 if test ! -f "$file"; then
5529 file=`$echo $file|${SED} 's,.exe$,,'`
5530 stripped_ext=".exe"
5533 esac
5535 # Do a test to see if this is really a libtool program.
5536 case $host in
5537 *cygwin*|*mingw*)
5538 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
5541 wrapper=$file
5543 esac
5544 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5545 notinst_deplibs=
5546 relink_command=
5548 # To insure that "foo" is sourced, and not "foo.exe",
5549 # finese the cygwin/MSYS system by explicitly sourcing "foo."
5550 # which disallows the automatic-append-.exe behavior.
5551 case $build in
5552 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5553 *) wrapperdot=${wrapper} ;;
5554 esac
5555 # If there is no directory component, then add one.
5556 case $file in
5557 */* | *\\*) . ${wrapperdot} ;;
5558 *) . ./${wrapperdot} ;;
5559 esac
5561 # Check the variables that should have been set.
5562 if test -z "$notinst_deplibs"; then
5563 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5564 exit 1
5567 finalize=yes
5568 for lib in $notinst_deplibs; do
5569 # Check to see that each library is installed.
5570 libdir=
5571 if test -f "$lib"; then
5572 # If there is no directory component, then add one.
5573 case $lib in
5574 */* | *\\*) . $lib ;;
5575 *) . ./$lib ;;
5576 esac
5578 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
5579 if test -n "$libdir" && test ! -f "$libfile"; then
5580 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
5581 finalize=no
5583 done
5585 relink_command=
5586 # To insure that "foo" is sourced, and not "foo.exe",
5587 # finese the cygwin/MSYS system by explicitly sourcing "foo."
5588 # which disallows the automatic-append-.exe behavior.
5589 case $build in
5590 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5591 *) wrapperdot=${wrapper} ;;
5592 esac
5593 # If there is no directory component, then add one.
5594 case $file in
5595 */* | *\\*) . ${wrapperdot} ;;
5596 *) . ./${wrapperdot} ;;
5597 esac
5599 outputname=
5600 if test "$fast_install" = no && test -n "$relink_command"; then
5601 if test "$finalize" = yes && test -z "$run"; then
5602 tmpdir="/tmp"
5603 test -n "$TMPDIR" && tmpdir="$TMPDIR"
5604 tmpdir="$tmpdir/libtool-$$"
5605 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
5606 else
5607 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5608 continue
5610 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5611 outputname="$tmpdir/$file"
5612 # Replace the output file specification.
5613 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5615 $show "$relink_command"
5616 if $run eval "$relink_command"; then :
5617 else
5618 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5619 ${rm}r "$tmpdir"
5620 continue
5622 file="$outputname"
5623 else
5624 $echo "$modename: warning: cannot relink \`$file'" 1>&2
5626 else
5627 # Install the binary that we compiled earlier.
5628 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5632 # remove .exe since cygwin /usr/bin/install will append another
5633 # one anyways
5634 case $install_prog,$host in
5635 */usr/bin/install*,*cygwin*)
5636 case $file:$destfile in
5637 *.exe:*.exe)
5638 # this is ok
5640 *.exe:*)
5641 destfile=$destfile.exe
5643 *:*.exe)
5644 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
5646 esac
5648 esac
5649 $show "$install_prog$stripme $file $destfile"
5650 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
5651 test -n "$outputname" && ${rm}r "$tmpdir"
5653 esac
5654 done
5656 for file in $staticlibs; do
5657 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5659 # Set up the ranlib parameters.
5660 oldlib="$destdir/$name"
5662 $show "$install_prog $file $oldlib"
5663 $run eval "$install_prog \$file \$oldlib" || exit $?
5665 if test -n "$stripme" && test -n "$striplib"; then
5666 $show "$old_striplib $oldlib"
5667 $run eval "$old_striplib $oldlib" || exit $?
5670 # Do each command in the postinstall commands.
5671 eval cmds=\"$old_postinstall_cmds\"
5672 save_ifs="$IFS"; IFS='~'
5673 for cmd in $cmds; do
5674 IFS="$save_ifs"
5675 $show "$cmd"
5676 $run eval "$cmd" || exit $?
5677 done
5678 IFS="$save_ifs"
5679 done
5681 if test -n "$future_libdirs"; then
5682 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
5685 if test -n "$current_libdirs"; then
5686 # Maybe just do a dry run.
5687 test -n "$run" && current_libdirs=" -n$current_libdirs"
5688 exec_cmd='$SHELL $0 --finish$current_libdirs'
5689 else
5690 exit 0
5694 # libtool finish mode
5695 finish)
5696 modename="$modename: finish"
5697 libdirs="$nonopt"
5698 admincmds=
5700 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5701 for dir
5703 libdirs="$libdirs $dir"
5704 done
5706 for libdir in $libdirs; do
5707 if test -n "$finish_cmds"; then
5708 # Do each command in the finish commands.
5709 eval cmds=\"$finish_cmds\"
5710 save_ifs="$IFS"; IFS='~'
5711 for cmd in $cmds; do
5712 IFS="$save_ifs"
5713 $show "$cmd"
5714 $run eval "$cmd" || admincmds="$admincmds
5715 $cmd"
5716 done
5717 IFS="$save_ifs"
5719 if test -n "$finish_eval"; then
5720 # Do the single finish_eval.
5721 eval cmds=\"$finish_eval\"
5722 $run eval "$cmds" || admincmds="$admincmds
5723 $cmds"
5725 done
5728 # Exit here if they wanted silent mode.
5729 test "$show" = : && exit 0
5731 $echo "----------------------------------------------------------------------"
5732 $echo "Libraries have been installed in:"
5733 for libdir in $libdirs; do
5734 $echo " $libdir"
5735 done
5736 $echo
5737 $echo "If you ever happen to want to link against installed libraries"
5738 $echo "in a given directory, LIBDIR, you must either use libtool, and"
5739 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5740 $echo "flag during linking and do at least one of the following:"
5741 if test -n "$shlibpath_var"; then
5742 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
5743 $echo " during execution"
5745 if test -n "$runpath_var"; then
5746 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
5747 $echo " during linking"
5749 if test -n "$hardcode_libdir_flag_spec"; then
5750 libdir=LIBDIR
5751 eval flag=\"$hardcode_libdir_flag_spec\"
5753 $echo " - use the \`$flag' linker flag"
5755 if test -n "$admincmds"; then
5756 $echo " - have your system administrator run these commands:$admincmds"
5758 if test -f /etc/ld.so.conf; then
5759 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5761 $echo
5762 $echo "See any operating system documentation about shared libraries for"
5763 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5764 $echo "----------------------------------------------------------------------"
5765 exit 0
5768 # libtool execute mode
5769 execute)
5770 modename="$modename: execute"
5772 # The first argument is the command name.
5773 cmd="$nonopt"
5774 if test -z "$cmd"; then
5775 $echo "$modename: you must specify a COMMAND" 1>&2
5776 $echo "$help"
5777 exit 1
5780 # Handle -dlopen flags immediately.
5781 for file in $execute_dlfiles; do
5782 if test ! -f "$file"; then
5783 $echo "$modename: \`$file' is not a file" 1>&2
5784 $echo "$help" 1>&2
5785 exit 1
5788 dir=
5789 case $file in
5790 *.la)
5791 # Check to see that this really is a libtool archive.
5792 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5793 else
5794 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5795 $echo "$help" 1>&2
5796 exit 1
5799 # Read the libtool library.
5800 dlname=
5801 library_names=
5803 # If there is no directory component, then add one.
5804 case $file in
5805 */* | *\\*) . $file ;;
5806 *) . ./$file ;;
5807 esac
5809 # Skip this library if it cannot be dlopened.
5810 if test -z "$dlname"; then
5811 # Warn if it was a shared library.
5812 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5813 continue
5816 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5817 test "X$dir" = "X$file" && dir=.
5819 if test -f "$dir/$objdir/$dlname"; then
5820 dir="$dir/$objdir"
5821 else
5822 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5823 exit 1
5827 *.lo)
5828 # Just add the directory containing the .lo file.
5829 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5830 test "X$dir" = "X$file" && dir=.
5834 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5835 continue
5837 esac
5839 # Get the absolute pathname.
5840 absdir=`cd "$dir" && pwd`
5841 test -n "$absdir" && dir="$absdir"
5843 # Now add the directory to shlibpath_var.
5844 if eval "test -z \"\$$shlibpath_var\""; then
5845 eval "$shlibpath_var=\"\$dir\""
5846 else
5847 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5849 done
5851 # This variable tells wrapper scripts just to set shlibpath_var
5852 # rather than running their programs.
5853 libtool_execute_magic="$magic"
5855 # Check if any of the arguments is a wrapper script.
5856 args=
5857 for file
5859 case $file in
5860 -*) ;;
5862 # Do a test to see if this is really a libtool program.
5863 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5864 # If there is no directory component, then add one.
5865 case $file in
5866 */* | *\\*) . $file ;;
5867 *) . ./$file ;;
5868 esac
5870 # Transform arg to wrapped name.
5871 file="$progdir/$program"
5874 esac
5875 # Quote arguments (to preserve shell metacharacters).
5876 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5877 args="$args \"$file\""
5878 done
5880 if test -z "$run"; then
5881 if test -n "$shlibpath_var"; then
5882 # Export the shlibpath_var.
5883 eval "export $shlibpath_var"
5886 # Restore saved environment variables
5887 if test "${save_LC_ALL+set}" = set; then
5888 LC_ALL="$save_LC_ALL"; export LC_ALL
5890 if test "${save_LANG+set}" = set; then
5891 LANG="$save_LANG"; export LANG
5894 # Now prepare to actually exec the command.
5895 exec_cmd="\$cmd$args"
5896 else
5897 # Display what would be done.
5898 if test -n "$shlibpath_var"; then
5899 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5900 $echo "export $shlibpath_var"
5902 $echo "$cmd$args"
5903 exit 0
5907 # libtool clean and uninstall mode
5908 clean | uninstall)
5909 modename="$modename: $mode"
5910 rm="$nonopt"
5911 files=
5912 rmforce=
5913 exit_status=0
5915 # This variable tells wrapper scripts just to set variables rather
5916 # than running their programs.
5917 libtool_install_magic="$magic"
5919 for arg
5921 case $arg in
5922 -f) rm="$rm $arg"; rmforce=yes ;;
5923 -*) rm="$rm $arg" ;;
5924 *) files="$files $arg" ;;
5925 esac
5926 done
5928 if test -z "$rm"; then
5929 $echo "$modename: you must specify an RM program" 1>&2
5930 $echo "$help" 1>&2
5931 exit 1
5934 rmdirs=
5936 origobjdir="$objdir"
5937 for file in $files; do
5938 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5939 if test "X$dir" = "X$file"; then
5940 dir=.
5941 objdir="$origobjdir"
5942 else
5943 objdir="$dir/$origobjdir"
5945 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5946 test "$mode" = uninstall && objdir="$dir"
5948 # Remember objdir for removal later, being careful to avoid duplicates
5949 if test "$mode" = clean; then
5950 case " $rmdirs " in
5951 *" $objdir "*) ;;
5952 *) rmdirs="$rmdirs $objdir" ;;
5953 esac
5956 # Don't error if the file doesn't exist and rm -f was used.
5957 if (test -L "$file") >/dev/null 2>&1 \
5958 || (test -h "$file") >/dev/null 2>&1 \
5959 || test -f "$file"; then
5961 elif test -d "$file"; then
5962 exit_status=1
5963 continue
5964 elif test "$rmforce" = yes; then
5965 continue
5968 rmfiles="$file"
5970 case $name in
5971 *.la)
5972 # Possibly a libtool archive, so verify it.
5973 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5974 . $dir/$name
5976 # Delete the libtool libraries and symlinks.
5977 for n in $library_names; do
5978 rmfiles="$rmfiles $objdir/$n"
5979 done
5980 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
5981 test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
5983 if test "$mode" = uninstall; then
5984 if test -n "$library_names"; then
5985 # Do each command in the postuninstall commands.
5986 eval cmds=\"$postuninstall_cmds\"
5987 save_ifs="$IFS"; IFS='~'
5988 for cmd in $cmds; do
5989 IFS="$save_ifs"
5990 $show "$cmd"
5991 $run eval "$cmd"
5992 if test "$?" -ne 0 && test "$rmforce" != yes; then
5993 exit_status=1
5995 done
5996 IFS="$save_ifs"
5999 if test -n "$old_library"; then
6000 # Do each command in the old_postuninstall commands.
6001 eval cmds=\"$old_postuninstall_cmds\"
6002 save_ifs="$IFS"; IFS='~'
6003 for cmd in $cmds; do
6004 IFS="$save_ifs"
6005 $show "$cmd"
6006 $run eval "$cmd"
6007 if test "$?" -ne 0 && test "$rmforce" != yes; then
6008 exit_status=1
6010 done
6011 IFS="$save_ifs"
6013 # FIXME: should reinstall the best remaining shared library.
6018 *.lo)
6019 # Possibly a libtool object, so verify it.
6020 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6022 # Read the .lo file
6023 . $dir/$name
6025 # Add PIC object to the list of files to remove.
6026 if test -n "$pic_object" \
6027 && test "$pic_object" != none; then
6028 rmfiles="$rmfiles $dir/$pic_object"
6031 # Add non-PIC object to the list of files to remove.
6032 if test -n "$non_pic_object" \
6033 && test "$non_pic_object" != none; then
6034 rmfiles="$rmfiles $dir/$non_pic_object"
6040 if test "$mode" = clean ; then
6041 noexename=$name
6042 case $file in
6043 *.exe)
6044 file=`$echo $file|${SED} 's,.exe$,,'`
6045 noexename=`$echo $name|${SED} 's,.exe$,,'`
6046 # $file with .exe has already been added to rmfiles,
6047 # add $file without .exe
6048 rmfiles="$rmfiles $file"
6050 esac
6051 # Do a test to see if this is a libtool program.
6052 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6053 relink_command=
6054 . $dir/$noexename
6056 # note $name still contains .exe if it was in $file originally
6057 # as does the version of $file that was added into $rmfiles
6058 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6059 if test "$fast_install" = yes && test -n "$relink_command"; then
6060 rmfiles="$rmfiles $objdir/lt-$name"
6062 if test "X$noexename" != "X$name" ; then
6063 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6068 esac
6069 $show "$rm $rmfiles"
6070 $run $rm $rmfiles || exit_status=1
6071 done
6072 objdir="$origobjdir"
6074 # Try to remove the ${objdir}s in the directories where we deleted files
6075 for dir in $rmdirs; do
6076 if test -d "$dir"; then
6077 $show "rmdir $dir"
6078 $run rmdir $dir >/dev/null 2>&1
6080 done
6082 exit $exit_status
6086 $echo "$modename: you must specify a MODE" 1>&2
6087 $echo "$generic_help" 1>&2
6088 exit 1
6090 esac
6092 if test -z "$exec_cmd"; then
6093 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6094 $echo "$generic_help" 1>&2
6095 exit 1
6097 fi # test -z "$show_help"
6099 if test -n "$exec_cmd"; then
6100 eval exec $exec_cmd
6101 exit 1
6104 # We need to display help for each of the modes.
6105 case $mode in
6106 "") $echo \
6107 "Usage: $modename [OPTION]... [MODE-ARG]...
6109 Provide generalized library-building support services.
6111 --config show all configuration variables
6112 --debug enable verbose shell tracing
6113 -n, --dry-run display commands without modifying any files
6114 --features display basic configuration information and exit
6115 --finish same as \`--mode=finish'
6116 --help display this help message and exit
6117 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6118 --quiet same as \`--silent'
6119 --silent don't print informational messages
6120 --tag=TAG use configuration variables from tag TAG
6121 --version print version information
6123 MODE must be one of the following:
6125 clean remove files from the build directory
6126 compile compile a source file into a libtool object
6127 execute automatically set library path, then run a program
6128 finish complete the installation of libtool libraries
6129 install install libraries or executables
6130 link create a library or an executable
6131 uninstall remove libraries from an installed directory
6133 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6134 a more detailed description of MODE.
6136 Report bugs to <bug-libtool@gnu.org>."
6137 exit 0
6140 clean)
6141 $echo \
6142 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6144 Remove files from the build directory.
6146 RM is the name of the program to use to delete files associated with each FILE
6147 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6148 to RM.
6150 If FILE is a libtool library, object or program, all the files associated
6151 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6154 compile)
6155 $echo \
6156 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6158 Compile a source file into a libtool library object.
6160 This mode accepts the following additional options:
6162 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6163 -prefer-pic try to building PIC objects only
6164 -prefer-non-pic try to building non-PIC objects only
6165 -static always build a \`.o' file suitable for static linking
6167 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6168 from the given SOURCEFILE.
6170 The output file name is determined by removing the directory component from
6171 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6172 library object suffix, \`.lo'."
6175 execute)
6176 $echo \
6177 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6179 Automatically set library path, then run a program.
6181 This mode accepts the following additional options:
6183 -dlopen FILE add the directory containing FILE to the library path
6185 This mode sets the library path environment variable according to \`-dlopen'
6186 flags.
6188 If any of the ARGS are libtool executable wrappers, then they are translated
6189 into their corresponding uninstalled binary, and any of their required library
6190 directories are added to the library path.
6192 Then, COMMAND is executed, with ARGS as arguments."
6195 finish)
6196 $echo \
6197 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6199 Complete the installation of libtool libraries.
6201 Each LIBDIR is a directory that contains libtool libraries.
6203 The commands that this mode executes may require superuser privileges. Use
6204 the \`--dry-run' option if you just want to see what would be executed."
6207 install)
6208 $echo \
6209 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6211 Install executables or libraries.
6213 INSTALL-COMMAND is the installation command. The first component should be
6214 either the \`install' or \`cp' program.
6216 The rest of the components are interpreted as arguments to that command (only
6217 BSD-compatible install options are recognized)."
6220 link)
6221 $echo \
6222 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6224 Link object files or libraries together to form another library, or to
6225 create an executable program.
6227 LINK-COMMAND is a command using the C compiler that you would use to create
6228 a program from several object files.
6230 The following components of LINK-COMMAND are treated specially:
6232 -all-static do not do any dynamic linking at all
6233 -avoid-version do not add a version suffix if possible
6234 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6235 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6236 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6237 -export-symbols SYMFILE
6238 try to export only the symbols listed in SYMFILE
6239 -export-symbols-regex REGEX
6240 try to export only the symbols matching REGEX
6241 -LLIBDIR search LIBDIR for required installed libraries
6242 -lNAME OUTPUT-FILE requires the installed library libNAME
6243 -module build a library that can dlopened
6244 -no-fast-install disable the fast-install mode
6245 -no-install link a not-installable executable
6246 -no-undefined declare that a library does not refer to external symbols
6247 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6248 -objectlist FILE Use a list of object files found in FILE to specify objects
6249 -release RELEASE specify package release information
6250 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6251 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6252 -static do not do any dynamic linking of libtool libraries
6253 -version-info CURRENT[:REVISION[:AGE]]
6254 specify library version info [each variable defaults to 0]
6256 All other options (arguments beginning with \`-') are ignored.
6258 Every other argument is treated as a filename. Files ending in \`.la' are
6259 treated as uninstalled libtool libraries, other files are standard or library
6260 object files.
6262 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6263 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6264 required, except when creating a convenience library.
6266 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6267 using \`ar' and \`ranlib', or on Windows using \`lib'.
6269 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6270 is created, otherwise an executable program is created."
6273 uninstall)
6274 $echo \
6275 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6277 Remove libraries from an installation directory.
6279 RM is the name of the program to use to delete files associated with each FILE
6280 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6281 to RM.
6283 If FILE is a libtool library, all the files associated with it are deleted.
6284 Otherwise, only FILE itself is deleted using RM."
6288 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6289 $echo "$help" 1>&2
6290 exit 1
6292 esac
6294 $echo
6295 $echo "Try \`$modename --help' for more information about other modes."
6297 exit 0
6299 # The TAGs below are defined such that we never get into a situation
6300 # in which we disable both kinds of libraries. Given conflicting
6301 # choices, we go for a static library, that is the most portable,
6302 # since we can't tell whether shared libraries were disabled because
6303 # the user asked for that or because the platform doesn't support
6304 # them. This is particularly important on AIX, because we don't
6305 # support having both static and shared libraries enabled at the same
6306 # time on that platform, so we default to a shared-only configuration.
6307 # If a disable-shared tag is given, we'll fallback to a static-only
6308 # configuration. But we'll never go from static-only to shared-only.
6310 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6311 build_libtool_libs=no
6312 build_old_libs=yes
6313 # ### END LIBTOOL TAG CONFIG: disable-shared
6315 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6316 build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
6317 # ### END LIBTOOL TAG CONFIG: disable-static
6319 # Local Variables:
6320 # mode:shell-script
6321 # sh-indentation:2
6322 # End: