AC macros for ruby_devel.
[amarok_sonynw.git] / admin / ltmain.sh
blob19e5b04bb069c0b5d736cf747d997ee289741b3d
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 # 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+"$@"}
41 # Same for EGREP, and just to be sure, do LTCC as well
42 if test "x$EGREP" = x ; then
43 EGREP=egrep
45 if test "x$LTCC" = x ; then
46 LTCC=${CC-gcc}
49 if test "X$1" = X--fallback-echo; then
50 # used as fallback echo
51 shift
52 cat <<EOF
54 EOF
55 exit 0
58 # The name of this program.
59 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
60 modename="$progname"
62 # Constants.
63 PROGRAM=ltmain.sh
64 PACKAGE=libtool
65 VERSION=1.5a
66 TIMESTAMP=" (1.1240 2003/06/26 06:55:19)"
68 default_mode=
69 help="Try \`$progname --help' for more information."
70 magic="%%%MAGIC variable%%%"
71 mkdir="mkdir"
72 mv="mv -f"
73 rm="rm -f"
75 # Sed substitution that helps us do robust quoting. It backslashifies
76 # metacharacters that are still active within double-quoted strings.
77 Xsed="${SED}"' -e 1s/^X//'
78 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
79 # test EBCDIC or ASCII
80 case `echo A|tr A '\301'` in
81 A) # EBCDIC based system
82 SP2NL="tr '\100' '\n'"
83 NL2SP="tr '\r\n' '\100\100'"
85 *) # Assume ASCII based system
86 SP2NL="tr '\040' '\012'"
87 NL2SP="tr '\015\012' '\040\040'"
89 esac
91 # NLS nuisances.
92 # Only set LANG and LC_ALL to C if already set.
93 # These must not be set unconditionally because not all systems understand
94 # e.g. LANG=C (notably SCO).
95 # We save the old values to restore during execute mode.
96 if test "${LC_ALL+set}" = set; then
97 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
99 if test "${LANG+set}" = set; then
100 save_LANG="$LANG"; LANG=C; export LANG
103 # Make sure IFS has a sensible default
104 : ${IFS=" "}
106 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
107 $echo "$modename: not configured to build any kind of library" 1>&2
108 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
109 exit 1
112 # Global variables.
113 mode=$default_mode
114 nonopt=
115 prev=
116 prevopt=
117 run=
118 show="$echo"
119 show_help=
120 execute_dlfiles=
121 lo2o="s/\\.lo\$/.${objext}/"
122 o2lo="s/\\.${objext}\$/.lo/"
124 if test -z "$max_cmd_len"; then
126 testring="ABCD"
127 new_result=
129 # If test is not a shell built-in, we'll probably end up computing a
130 # maximum length that is only half of the actual maximum length, but
131 # we can't tell.
132 while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
133 = "XX$testring") >/dev/null 2>&1 &&
134 new_result=`expr "X$testring" : ".*" 2>&1` &&
135 max_cmd_len="$new_result" &&
136 test "$i" != 17 # 1/2 MB should be enough
138 i=`expr $i + 1`
139 testring="$testring$testring"
140 done
141 testring=
142 # Add a significant safety factor because C++ compilers can tack on massive
143 # amounts of additional arguments before passing them to the linker.
144 # It appears as though 1/2 is a usable value.
145 max_cmd_len=`expr $max_cmd_len \/ 2`
148 #####################################
149 # Shell function definitions:
150 # This seems to be the best place for them
152 # Need a lot of goo to handle *both* DLLs and import libs
153 # Has to be a shell function in order to 'eat' the argument
154 # that is supplied when $file_magic_command is called.
155 win32_libid () {
156 win32_libid_type="unknown"
157 win32_fileres=`file -L $1 2>/dev/null`
158 case $win32_fileres in
159 *ar\ archive\ import\ library*) # definitely import
160 win32_libid_type="x86 archive import"
162 *ar\ archive*) # could be an import, or static
163 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
164 grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
165 win32_nmres=`eval $NM -f posix -A $1 | \
166 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
167 if test "X$win32_nmres" = "Ximport" ; then
168 win32_libid_type="x86 archive import"
169 else
170 win32_libid_type="x86 archive static"
174 *DLL*)
175 win32_libid_type="x86 DLL"
177 *executable*) # but shell scripts are "executable" too...
178 case $win32_fileres in
179 *MS\ Windows\ PE\ Intel*)
180 win32_libid_type="x86 DLL"
182 esac
184 esac
185 $echo $win32_libid_type
188 # End of Shell function definitions
189 #####################################
191 # Parse our command line options once, thoroughly.
192 while test "$#" -gt 0
194 arg="$1"
195 shift
197 case $arg in
198 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
199 *) optarg= ;;
200 esac
202 # If the previous option needs an argument, assign it.
203 if test -n "$prev"; then
204 case $prev in
205 execute_dlfiles)
206 execute_dlfiles="$execute_dlfiles $arg"
208 tag)
209 tagname="$arg"
211 # Check whether tagname contains only valid characters
212 case $tagname in
213 *[!-_A-Za-z0-9,/]*)
214 $echo "$progname: invalid tag name: $tagname" 1>&2
215 exit 1
217 esac
219 case $tagname in
221 # Don't test for the "default" C tag, as we know, it's there, but
222 # not specially marked.
225 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
226 taglist="$taglist $tagname"
227 # Evaluate the configuration.
228 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
229 else
230 $echo "$progname: ignoring unknown tag $tagname" 1>&2
233 esac
236 eval "$prev=\$arg"
238 esac
240 prev=
241 prevopt=
242 continue
245 # Have we seen a non-optional argument yet?
246 case $arg in
247 --help)
248 show_help=yes
251 --version)
252 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
253 $echo
254 $echo "Copyright (C) 2003 Free Software Foundation, Inc."
255 $echo "This is free software; see the source for copying conditions. There is NO"
256 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
257 exit 0
260 --config)
261 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
262 # Now print the configurations for the tags.
263 for tagname in $taglist; do
264 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
265 done
266 exit 0
269 --debug)
270 $echo "$progname: enabling shell trace mode"
271 set -x
274 --dry-run | -n)
275 run=:
278 --features)
279 $echo "host: $host"
280 if test "$build_libtool_libs" = yes; then
281 $echo "enable shared libraries"
282 else
283 $echo "disable shared libraries"
285 if test "$build_old_libs" = yes; then
286 $echo "enable static libraries"
287 else
288 $echo "disable static libraries"
290 exit 0
293 --finish) mode="finish" ;;
295 --mode) prevopt="--mode" prev=mode ;;
296 --mode=*) mode="$optarg" ;;
298 --preserve-dup-deps) duplicate_deps="yes" ;;
300 --quiet | --silent)
301 show=:
304 --tag) prevopt="--tag" prev=tag ;;
305 --tag=*)
306 set tag "$optarg" ${1+"$@"}
307 shift
308 prev=tag
311 -dlopen)
312 prevopt="-dlopen"
313 prev=execute_dlfiles
317 $echo "$modename: unrecognized option \`$arg'" 1>&2
318 $echo "$help" 1>&2
319 exit 1
323 nonopt="$arg"
324 break
326 esac
327 done
329 if test -n "$prevopt"; then
330 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
331 $echo "$help" 1>&2
332 exit 1
335 # If this variable is set in any of the actions, the command in it
336 # will be execed at the end. This prevents here-documents from being
337 # left over by shells.
338 exec_cmd=
340 if test -z "$show_help"; then
342 # Infer the operation mode.
343 if test -z "$mode"; then
344 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
345 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
346 case $nonopt in
347 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
348 mode=link
349 for arg
351 case $arg in
353 mode=compile
354 break
356 esac
357 done
359 *db | *dbx | *strace | *truss)
360 mode=execute
362 *install*|cp|mv)
363 mode=install
365 *rm)
366 mode=uninstall
369 # If we have no mode, but dlfiles were specified, then do execute mode.
370 test -n "$execute_dlfiles" && mode=execute
372 # Just use the default operation mode.
373 if test -z "$mode"; then
374 if test -n "$nonopt"; then
375 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
376 else
377 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
381 esac
384 # Only execute mode is allowed to have -dlopen flags.
385 if test -n "$execute_dlfiles" && test "$mode" != execute; then
386 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
387 $echo "$help" 1>&2
388 exit 1
391 # Change the help message to a mode-specific one.
392 generic_help="$help"
393 help="Try \`$modename --help --mode=$mode' for more information."
395 # These modes are in order of execution frequency so that they run quickly.
396 case $mode in
397 # libtool compile mode
398 compile)
399 modename="$modename: compile"
400 # Get the compilation command and the source file.
401 base_compile=
402 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
403 suppress_output=
404 arg_mode=normal
405 libobj=
407 for arg
409 case "$arg_mode" in
410 arg )
411 # do not "continue". Instead, add this to base_compile
412 lastarg="$arg"
413 arg_mode=normal
416 target )
417 libobj="$arg"
418 arg_mode=normal
419 continue
422 normal )
423 # Accept any command-line options.
424 case $arg in
426 if test -n "$libobj" ; then
427 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
428 exit 1
430 arg_mode=target
431 continue
434 -static)
435 build_old_libs=yes
436 continue
439 -prefer-pic)
440 pic_mode=yes
441 continue
444 -prefer-non-pic)
445 pic_mode=no
446 continue
449 -Xcompiler)
450 arg_mode=arg # the next one goes into the "base_compile" arg list
451 continue # The current "srcfile" will either be retained or
452 ;; # replaced later. I would guess that would be a bug.
454 -Wc,*)
455 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
456 lastarg=
457 save_ifs="$IFS"; IFS=','
458 for arg in $args; do
459 IFS="$save_ifs"
461 # Double-quote args containing other shell metacharacters.
462 # Many Bourne shells cannot handle close brackets correctly
463 # in scan sets, so we specify it separately.
464 case $arg in
465 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
466 arg="\"$arg\""
468 esac
469 lastarg="$lastarg $arg"
470 done
471 IFS="$save_ifs"
472 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
474 # Add the arguments to base_compile.
475 base_compile="$base_compile $lastarg"
476 continue
480 # Accept the current argument as the source file.
481 # The previous "srcfile" becomes the current argument.
483 lastarg="$srcfile"
484 srcfile="$arg"
486 esac # case $arg
488 esac # case $arg_mode
490 # Aesthetically quote the previous argument.
491 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
493 case $lastarg in
494 # Double-quote args containing other shell metacharacters.
495 # Many Bourne shells cannot handle close brackets correctly
496 # in scan sets, so we specify it separately.
497 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
498 lastarg="\"$lastarg\""
500 esac
502 base_compile="$base_compile $lastarg"
503 done # for arg
505 case $arg_mode in
506 arg)
507 $echo "$modename: you must specify an argument for -Xcompile"
508 exit 1
510 target)
511 $echo "$modename: you must specify a target with \`-o'" 1>&2
512 exit 1
515 # Get the name of the library object.
516 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
518 esac
520 # Recognize several different file suffixes.
521 # If the user specifies -o file.o, it is replaced with file.lo
522 xform='[cCFSifmso]'
523 case $libobj in
524 *.ada) xform=ada ;;
525 *.adb) xform=adb ;;
526 *.ads) xform=ads ;;
527 *.asm) xform=asm ;;
528 *.c++) xform=c++ ;;
529 *.cc) xform=cc ;;
530 *.ii) xform=ii ;;
531 *.class) xform=class ;;
532 *.cpp) xform=cpp ;;
533 *.cxx) xform=cxx ;;
534 *.f90) xform=f90 ;;
535 *.for) xform=for ;;
536 *.java) xform=java ;;
537 esac
539 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
541 case $libobj in
542 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
544 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
545 exit 1
547 esac
549 # Infer tagged configuration to use if any are available and
550 # if one wasn't chosen via the "--tag" command line option.
551 # Only attempt this if the compiler in the base compile
552 # command doesn't match the default compiler.
553 if test -n "$available_tags" && test -z "$tagname"; then
554 case $base_compile in
555 # Blanks in the command may have been stripped by the calling shell,
556 # but not from the CC environment variable when configure was run.
557 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
558 # Blanks at the start of $base_compile will cause this to fail
559 # if we don't check for them as well.
561 for z in $available_tags; do
562 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
563 # Evaluate the configuration.
564 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
565 case "$base_compile " in
566 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
567 # The compiler in the base compile command matches
568 # the one in the tagged configuration.
569 # Assume this is the tagged configuration we want.
570 tagname=$z
571 break
573 esac
575 done
576 # If $tagname still isn't set, then no tagged configuration
577 # was found and let the user know that the "--tag" command
578 # line option must be used.
579 if test -z "$tagname"; then
580 $echo "$modename: unable to infer tagged configuration"
581 $echo "$modename: specify a tag with \`--tag'" 1>&2
582 exit 1
583 # else
584 # $echo "$modename: using $tagname tagged configuration"
587 esac
590 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
591 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
592 if test "X$xdir" = "X$obj"; then
593 xdir=
594 else
595 xdir=$xdir/
597 lobj=${xdir}$objdir/$objname
599 if test -z "$base_compile"; then
600 $echo "$modename: you must specify a compilation command" 1>&2
601 $echo "$help" 1>&2
602 exit 1
605 # Delete any leftover library objects.
606 if test "$build_old_libs" = yes; then
607 removelist="$obj $lobj $libobj ${libobj}T"
608 else
609 removelist="$lobj $libobj ${libobj}T"
612 $run $rm $removelist
613 trap "$run $rm $removelist; exit 1" 1 2 15
615 # On Cygwin there's no "real" PIC flag so we must build both object types
616 case $host_os in
617 cygwin* | mingw* | pw32* | os2*)
618 pic_mode=default
620 esac
621 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
622 # non-PIC code in shared libraries is not supported
623 pic_mode=default
626 # Calculate the filename of the output object if compiler does
627 # not support -o with -c
628 if test "$compiler_c_o" = no; then
629 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
630 lockfile="$output_obj.lock"
631 removelist="$removelist $output_obj $lockfile"
632 trap "$run $rm $removelist; exit 1" 1 2 15
633 else
634 output_obj=
635 need_locks=no
636 lockfile=
639 # Lock this critical section if it is needed
640 # We use this script file to make the link, it avoids creating a new file
641 if test "$need_locks" = yes; then
642 until $run ln "$0" "$lockfile" 2>/dev/null; do
643 $show "Waiting for $lockfile to be removed"
644 sleep 2
645 done
646 elif test "$need_locks" = warn; then
647 if test -f "$lockfile"; then
648 $echo "\
649 *** ERROR, $lockfile exists and contains:
650 `cat $lockfile 2>/dev/null`
652 This indicates that another process is trying to use the same
653 temporary object file, and libtool could not work around it because
654 your compiler does not support \`-c' and \`-o' together. If you
655 repeat this compilation, it may succeed, by chance, but you had better
656 avoid parallel builds (make -j) in this platform, or get a better
657 compiler."
659 $run $rm $removelist
660 exit 1
662 $echo $srcfile > "$lockfile"
665 if test -n "$fix_srcfile_path"; then
666 eval srcfile=\"$fix_srcfile_path\"
669 $run $rm "$libobj" "${libobj}T"
671 # Create a libtool object file (analogous to a ".la" file),
672 # but don't create it if we're doing a dry run.
673 test -z "$run" && cat > ${libobj}T <<EOF
674 # $libobj - a libtool object file
675 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
677 # Please DO NOT delete this file!
678 # It is necessary for linking the library.
680 # Name of the PIC object.
683 # Only build a PIC object if we are building libtool libraries.
684 if test "$build_libtool_libs" = yes; then
685 # Without this assignment, base_compile gets emptied.
686 fbsd_hideous_sh_bug=$base_compile
688 if test "$pic_mode" != no; then
689 command="$base_compile $srcfile $pic_flag"
690 else
691 # Don't build PIC code
692 command="$base_compile $srcfile"
695 if test ! -d "${xdir}$objdir"; then
696 $show "$mkdir ${xdir}$objdir"
697 $run $mkdir ${xdir}$objdir
698 status=$?
699 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
700 exit $status
704 if test -z "$output_obj"; then
705 # Place PIC objects in $objdir
706 command="$command -o $lobj"
709 $run $rm "$lobj" "$output_obj"
711 $show "$command"
712 if $run eval "$command"; then :
713 else
714 test -n "$output_obj" && $run $rm $removelist
715 exit 1
718 if test "$need_locks" = warn &&
719 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
720 $echo "\
721 *** ERROR, $lockfile contains:
722 `cat $lockfile 2>/dev/null`
724 but it should contain:
725 $srcfile
727 This indicates that another process is trying to use the same
728 temporary object file, and libtool could not work around it because
729 your compiler does not support \`-c' and \`-o' together. If you
730 repeat this compilation, it may succeed, by chance, but you had better
731 avoid parallel builds (make -j) in this platform, or get a better
732 compiler."
734 $run $rm $removelist
735 exit 1
738 # Just move the object if needed, then go on to compile the next one
739 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
740 $show "$mv $output_obj $lobj"
741 if $run $mv $output_obj $lobj; then :
742 else
743 error=$?
744 $run $rm $removelist
745 exit $error
749 # Append the name of the PIC object to the libtool object file.
750 test -z "$run" && cat >> ${libobj}T <<EOF
751 pic_object='$objdir/$objname'
755 # Allow error messages only from the first compilation.
756 suppress_output=' >/dev/null 2>&1'
757 else
758 # No PIC object so indicate it doesn't exist in the libtool
759 # object file.
760 test -z "$run" && cat >> ${libobj}T <<EOF
761 pic_object=none
766 # Only build a position-dependent object if we build old libraries.
767 if test "$build_old_libs" = yes; then
768 if test "$pic_mode" != yes; then
769 # Don't build PIC code
770 command="$base_compile $srcfile"
771 else
772 command="$base_compile $srcfile $pic_flag"
774 if test "$compiler_c_o" = yes; then
775 command="$command -o $obj"
778 # Suppress compiler output if we already did a PIC compilation.
779 command="$command$suppress_output"
780 $run $rm "$obj" "$output_obj"
781 $show "$command"
782 if $run eval "$command"; then :
783 else
784 $run $rm $removelist
785 exit 1
788 if test "$need_locks" = warn &&
789 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
790 $echo "\
791 *** ERROR, $lockfile contains:
792 `cat $lockfile 2>/dev/null`
794 but it should contain:
795 $srcfile
797 This indicates that another process is trying to use the same
798 temporary object file, and libtool could not work around it because
799 your compiler does not support \`-c' and \`-o' together. If you
800 repeat this compilation, it may succeed, by chance, but you had better
801 avoid parallel builds (make -j) in this platform, or get a better
802 compiler."
804 $run $rm $removelist
805 exit 1
808 # Just move the object if needed
809 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
810 $show "$mv $output_obj $obj"
811 if $run $mv $output_obj $obj; then :
812 else
813 error=$?
814 $run $rm $removelist
815 exit $error
819 # Append the name of the non-PIC object the libtool object file.
820 # Only append if the libtool object file exists.
821 test -z "$run" && cat >> ${libobj}T <<EOF
822 # Name of the non-PIC object.
823 non_pic_object='$objname'
826 else
827 # Append the name of the non-PIC object the libtool object file.
828 # Only append if the libtool object file exists.
829 test -z "$run" && cat >> ${libobj}T <<EOF
830 # Name of the non-PIC object.
831 non_pic_object=none
836 $run $mv "${libobj}T" "${libobj}"
838 # Unlock the critical section if it was locked
839 if test "$need_locks" != no; then
840 $run $rm "$lockfile"
843 exit 0
846 # libtool link mode
847 link | relink)
848 modename="$modename: link"
849 case $host in
850 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
851 # It is impossible to link a dll without this setting, and
852 # we shouldn't force the makefile maintainer to figure out
853 # which system we are compiling for in order to pass an extra
854 # flag for every libtool invocation.
855 # allow_undefined=no
857 # FIXME: Unfortunately, there are problems with the above when trying
858 # to make a dll which has undefined symbols, in which case not
859 # even a static library is built. For now, we need to specify
860 # -no-undefined on the libtool link line when we can be certain
861 # that all symbols are satisfied, otherwise we get a static library.
862 allow_undefined=yes
865 allow_undefined=yes
867 esac
868 libtool_args="$nonopt"
869 base_compile="$nonopt"
870 compile_command="$nonopt"
871 finalize_command="$nonopt"
873 compile_rpath=
874 finalize_rpath=
875 compile_shlibpath=
876 finalize_shlibpath=
877 convenience=
878 old_convenience=
879 deplibs=
880 old_deplibs=
881 add_flags=
882 compiler_flags=
883 linker_flags=
884 dllsearchpath=
885 lib_search_path=`pwd`
886 inst_prefix_dir=
888 avoid_version=no
889 dlfiles=
890 dlprefiles=
891 dlself=no
892 export_dynamic=no
893 export_symbols=
894 export_symbols_regex=
895 generated=
896 libobjs=
897 ltlibs=
898 module=no
899 no_install=no
900 objs=
901 non_pic_objects=
902 prefer_static_libs=no
903 preload=no
904 prev=
905 prevarg=
906 release=
907 rpath=
908 xrpath=
909 perm_rpath=
910 temp_rpath=
911 thread_safe=no
912 vinfo=
913 vinfo_number=no
915 # We need to know -static, to get the right output filenames.
916 for arg
918 case $arg in
919 -all-static | -static)
920 if test "X$arg" = "X-all-static"; then
921 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
922 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
924 if test -n "$link_static_flag"; then
925 dlopen_self=$dlopen_self_static
927 else
928 if test -z "$pic_flag" && test -n "$link_static_flag"; then
929 dlopen_self=$dlopen_self_static
932 build_libtool_libs=no
933 build_old_libs=yes
934 prefer_static_libs=yes
935 break
937 esac
938 done
940 # See if our shared archives depend on static archives.
941 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
943 # Go through the arguments, transforming them on the way.
944 while test "$#" -gt 0; do
945 arg="$1"
946 base_compile="$base_compile $arg"
947 shift
948 case $arg in
949 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
950 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
952 *) qarg=$arg ;;
953 esac
954 libtool_args="$libtool_args $qarg"
956 # If the previous option needs an argument, assign it.
957 if test -n "$prev"; then
958 case $prev in
959 output)
960 compile_command="$compile_command @OUTPUT@"
961 finalize_command="$finalize_command @OUTPUT@"
963 esac
965 case $prev in
966 dlfiles|dlprefiles)
967 if test "$preload" = no; then
968 # Add the symbol object into the linking commands.
969 compile_command="$compile_command @SYMFILE@"
970 finalize_command="$finalize_command @SYMFILE@"
971 preload=yes
973 case $arg in
974 *.la | *.lo) ;; # We handle these cases below.
975 force)
976 if test "$dlself" = no; then
977 dlself=needless
978 export_dynamic=yes
980 prev=
981 continue
983 self)
984 if test "$prev" = dlprefiles; then
985 dlself=yes
986 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
987 dlself=yes
988 else
989 dlself=needless
990 export_dynamic=yes
992 prev=
993 continue
996 if test "$prev" = dlfiles; then
997 dlfiles="$dlfiles $arg"
998 else
999 dlprefiles="$dlprefiles $arg"
1001 prev=
1002 continue
1004 esac
1006 expsyms)
1007 export_symbols="$arg"
1008 if test ! -f "$arg"; then
1009 $echo "$modename: symbol file \`$arg' does not exist"
1010 exit 1
1012 prev=
1013 continue
1015 expsyms_regex)
1016 export_symbols_regex="$arg"
1017 prev=
1018 continue
1020 inst_prefix)
1021 inst_prefix_dir="$arg"
1022 prev=
1023 continue
1025 release)
1026 release="-$arg"
1027 prev=
1028 continue
1030 objectlist)
1031 if test -f "$arg"; then
1032 save_arg=$arg
1033 moreargs=
1034 for fil in `cat $save_arg`
1036 # moreargs="$moreargs $fil"
1037 arg=$fil
1038 # A libtool-controlled object.
1040 # Check to see that this really is a libtool object.
1041 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1042 pic_object=
1043 non_pic_object=
1045 # Read the .lo file
1046 # If there is no directory component, then add one.
1047 case $arg in
1048 */* | *\\*) . $arg ;;
1049 *) . ./$arg ;;
1050 esac
1052 if test -z "$pic_object" || \
1053 test -z "$non_pic_object" ||
1054 test "$pic_object" = none && \
1055 test "$non_pic_object" = none; then
1056 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1057 exit 1
1060 # Extract subdirectory from the argument.
1061 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1062 if test "X$xdir" = "X$arg"; then
1063 xdir=
1064 else
1065 xdir="$xdir/"
1068 if test "$pic_object" != none; then
1069 # Prepend the subdirectory the object is found in.
1070 pic_object="$xdir$pic_object"
1072 if test "$prev" = dlfiles; then
1073 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1074 dlfiles="$dlfiles $pic_object"
1075 prev=
1076 continue
1077 else
1078 # If libtool objects are unsupported, then we need to preload.
1079 prev=dlprefiles
1083 # CHECK ME: I think I busted this. -Ossama
1084 if test "$prev" = dlprefiles; then
1085 # Preload the old-style object.
1086 dlprefiles="$dlprefiles $pic_object"
1087 prev=
1090 # A PIC object.
1091 libobjs="$libobjs $pic_object"
1092 arg="$pic_object"
1095 # Non-PIC object.
1096 if test "$non_pic_object" != none; then
1097 # Prepend the subdirectory the object is found in.
1098 non_pic_object="$xdir$non_pic_object"
1100 # A standard non-PIC object
1101 non_pic_objects="$non_pic_objects $non_pic_object"
1102 if test -z "$pic_object" || test "$pic_object" = none ; then
1103 arg="$non_pic_object"
1106 else
1107 # Only an error if not doing a dry-run.
1108 if test -z "$run"; then
1109 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1110 exit 1
1111 else
1112 # Dry-run case.
1114 # Extract subdirectory from the argument.
1115 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1116 if test "X$xdir" = "X$arg"; then
1117 xdir=
1118 else
1119 xdir="$xdir/"
1122 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1123 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1124 libobjs="$libobjs $pic_object"
1125 non_pic_objects="$non_pic_objects $non_pic_object"
1128 done
1129 else
1130 $echo "$modename: link input file \`$save_arg' does not exist"
1131 exit 1
1133 arg=$save_arg
1134 prev=
1135 continue
1137 rpath | xrpath)
1138 # We need an absolute path.
1139 case $arg in
1140 [\\/]* | [A-Za-z]:[\\/]*) ;;
1142 $echo "$modename: only absolute run-paths are allowed" 1>&2
1143 exit 1
1145 esac
1146 if test "$prev" = rpath; then
1147 case "$rpath " in
1148 *" $arg "*) ;;
1149 *) rpath="$rpath $arg" ;;
1150 esac
1151 else
1152 case "$xrpath " in
1153 *" $arg "*) ;;
1154 *) xrpath="$xrpath $arg" ;;
1155 esac
1157 prev=
1158 continue
1160 xcompiler)
1161 compiler_flags="$compiler_flags $qarg"
1162 prev=
1163 compile_command="$compile_command $qarg"
1164 finalize_command="$finalize_command $qarg"
1165 continue
1167 xlinker)
1168 linker_flags="$linker_flags $qarg"
1169 compiler_flags="$compiler_flags $wl$qarg"
1170 prev=
1171 compile_command="$compile_command $wl$qarg"
1172 finalize_command="$finalize_command $wl$qarg"
1173 continue
1175 xcclinker)
1176 linker_flags="$linker_flags $qarg"
1177 compiler_flags="$compiler_flags $qarg"
1178 prev=
1179 compile_command="$compile_command $qarg"
1180 finalize_command="$finalize_command $qarg"
1181 continue
1183 framework)
1184 case $host in
1185 *-*-darwin*)
1186 case "$deplibs " in
1187 *" $qarg.ltframework "*) ;;
1188 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
1190 esac
1192 esac
1193 prev=
1194 continue
1197 eval "$prev=\"\$arg\""
1198 prev=
1199 continue
1201 esac
1202 fi # test -n "$prev"
1204 prevarg="$arg"
1206 case $arg in
1207 -all-static)
1208 if test -n "$link_static_flag"; then
1209 compile_command="$compile_command $link_static_flag"
1210 finalize_command="$finalize_command $link_static_flag"
1212 continue
1215 -allow-undefined)
1216 # FIXME: remove this flag sometime in the future.
1217 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1218 continue
1221 -avoid-version)
1222 avoid_version=yes
1223 continue
1226 -dlopen)
1227 prev=dlfiles
1228 continue
1231 -dlpreopen)
1232 prev=dlprefiles
1233 continue
1236 -export-dynamic)
1237 export_dynamic=yes
1238 continue
1241 -export-symbols | -export-symbols-regex)
1242 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1243 $echo "$modename: more than one -exported-symbols argument is not allowed"
1244 exit 1
1246 if test "X$arg" = "X-export-symbols"; then
1247 prev=expsyms
1248 else
1249 prev=expsyms_regex
1251 continue
1254 -inst-prefix-dir)
1255 prev=inst_prefix
1256 continue
1259 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1260 # so, if we see these flags be careful not to treat them like -L
1261 -L[A-Z][A-Z]*:*)
1262 case $with_gcc/$host in
1263 no/*-*-irix* | /*-*-irix*)
1264 compile_command="$compile_command $arg"
1265 finalize_command="$finalize_command $arg"
1267 esac
1268 continue
1271 -L*)
1272 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1273 # We need an absolute path.
1274 case $dir in
1275 [\\/]* | [A-Za-z]:[\\/]*) ;;
1277 absdir=`cd "$dir" && pwd`
1278 if test -z "$absdir"; then
1279 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1280 exit 1
1282 dir="$absdir"
1284 esac
1285 case "$deplibs " in
1286 *" -L$dir "*) ;;
1288 deplibs="$deplibs -L$dir"
1289 lib_search_path="$lib_search_path $dir"
1291 esac
1292 case $host in
1293 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1294 case :$dllsearchpath: in
1295 *":$dir:"*) ;;
1296 *) dllsearchpath="$dllsearchpath:$dir";;
1297 esac
1299 esac
1300 continue
1303 -l*)
1304 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1305 case $host in
1306 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1307 # These systems don't actually have a C or math library (as such)
1308 continue
1310 *-*-mingw* | *-*-os2*)
1311 # These systems don't actually have a C library (as such)
1312 test "X$arg" = "X-lc" && continue
1314 *-*-openbsd* | *-*-freebsd*)
1315 # Do not include libc due to us having libc/libc_r.
1316 test "X$arg" = "X-lc" && continue
1318 *-*-rhapsody* | *-*-darwin1.[012])
1319 # Rhapsody C and math libraries are in the System framework
1320 deplibs="$deplibs System.ltframework"
1321 continue
1322 esac
1323 elif test "X$arg" = "X-lc_r"; then
1324 case $host in
1325 *-*-openbsd*)
1326 # Do not include libc_r directly, use -pthread flag.
1327 continue
1329 esac
1331 deplibs="$deplibs $arg"
1332 continue
1335 -module)
1336 module=yes
1337 continue
1340 # gcc -m* arguments should be passed to the linker via $compiler_flags
1341 # in order to pass architecture information to the linker
1342 # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
1343 # but this is not reliable with gcc because gcc may use -mfoo to
1344 # select a different linker, different libraries, etc, while
1345 # -Wl,-mfoo simply passes -mfoo to the linker.
1346 -m*)
1347 # Unknown arguments in both finalize_command and compile_command need
1348 # to be aesthetically quoted because they are evaled later.
1349 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1350 case $arg in
1351 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1352 arg="\"$arg\""
1354 esac
1355 compile_command="$compile_command $arg"
1356 finalize_command="$finalize_command $arg"
1357 if test "$with_gcc" = "yes" ; then
1358 compiler_flags="$compiler_flags $arg"
1360 continue
1363 -shrext)
1364 prev=shrext
1365 continue
1368 -no-fast-install)
1369 fast_install=no
1370 continue
1373 -no-install)
1374 case $host in
1375 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1376 # The PATH hackery in wrapper scripts is required on Windows
1377 # in order for the loader to find any dlls it needs.
1378 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1379 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1380 fast_install=no
1382 *) no_install=yes ;;
1383 esac
1384 continue
1387 -no-undefined)
1388 allow_undefined=no
1389 continue
1392 -objectlist)
1393 prev=objectlist
1394 continue
1397 -o) prev=output ;;
1399 -release)
1400 prev=release
1401 continue
1404 -rpath)
1405 prev=rpath
1406 continue
1410 prev=xrpath
1411 continue
1414 -R*)
1415 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1416 # We need an absolute path.
1417 case $dir in
1418 [\\/]* | [A-Za-z]:[\\/]*) ;;
1420 $echo "$modename: only absolute run-paths are allowed" 1>&2
1421 exit 1
1423 esac
1424 case "$xrpath " in
1425 *" $dir "*) ;;
1426 *) xrpath="$xrpath $dir" ;;
1427 esac
1428 continue
1431 -static)
1432 # The effects of -static are defined in a previous loop.
1433 # We used to do the same as -all-static on platforms that
1434 # didn't have a PIC flag, but the assumption that the effects
1435 # would be equivalent was wrong. It would break on at least
1436 # Digital Unix and AIX.
1437 continue
1440 -thread-safe)
1441 thread_safe=yes
1442 continue
1445 -version-info)
1446 prev=vinfo
1447 continue
1449 -version-number)
1450 prev=vinfo
1451 vinfo_number=yes
1452 continue
1455 -Wc,*)
1456 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1457 arg=
1458 save_ifs="$IFS"; IFS=','
1459 for flag in $args; do
1460 IFS="$save_ifs"
1461 case $flag in
1462 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1463 flag="\"$flag\""
1465 esac
1466 arg="$arg $wl$flag"
1467 compiler_flags="$compiler_flags $flag"
1468 done
1469 IFS="$save_ifs"
1470 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1473 -Wl,*)
1474 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1475 arg=
1476 save_ifs="$IFS"; IFS=','
1477 for flag in $args; do
1478 IFS="$save_ifs"
1479 case $flag in
1480 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1481 flag="\"$flag\""
1483 esac
1484 arg="$arg $wl$flag"
1485 compiler_flags="$compiler_flags $wl$flag"
1486 linker_flags="$linker_flags $flag"
1487 done
1488 IFS="$save_ifs"
1489 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1492 -Xcompiler)
1493 prev=xcompiler
1494 continue
1497 -Xlinker)
1498 prev=xlinker
1499 continue
1502 -XCClinker)
1503 prev=xcclinker
1504 continue
1507 -framework)
1508 prev=framework
1509 continue
1512 # Some other compiler flag.
1513 -* | +*)
1514 # Unknown arguments in both finalize_command and compile_command need
1515 # to be aesthetically quoted because they are evaled later.
1516 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1517 case $arg in
1518 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1519 arg="\"$arg\""
1521 esac
1522 add_flags="$add_flags $arg"
1525 *.$objext)
1526 # A standard object.
1527 objs="$objs $arg"
1530 *.lo)
1531 # A libtool-controlled object.
1533 # Check to see that this really is a libtool object.
1534 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1535 pic_object=
1536 non_pic_object=
1538 # Read the .lo file
1539 # If there is no directory component, then add one.
1540 case $arg in
1541 */* | *\\*) . $arg ;;
1542 *) . ./$arg ;;
1543 esac
1545 if test -z "$pic_object" || \
1546 test -z "$non_pic_object" ||
1547 test "$pic_object" = none && \
1548 test "$non_pic_object" = none; then
1549 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1550 exit 1
1553 # Extract subdirectory from the argument.
1554 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1555 if test "X$xdir" = "X$arg"; then
1556 xdir=
1557 else
1558 xdir="$xdir/"
1561 if test "$pic_object" != none; then
1562 # Prepend the subdirectory the object is found in.
1563 pic_object="$xdir$pic_object"
1565 if test "$prev" = dlfiles; then
1566 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1567 dlfiles="$dlfiles $pic_object"
1568 prev=
1569 continue
1570 else
1571 # If libtool objects are unsupported, then we need to preload.
1572 prev=dlprefiles
1576 # CHECK ME: I think I busted this. -Ossama
1577 if test "$prev" = dlprefiles; then
1578 # Preload the old-style object.
1579 dlprefiles="$dlprefiles $pic_object"
1580 prev=
1583 # A PIC object.
1584 libobjs="$libobjs $pic_object"
1585 arg="$pic_object"
1588 # Non-PIC object.
1589 if test "$non_pic_object" != none; then
1590 # Prepend the subdirectory the object is found in.
1591 non_pic_object="$xdir$non_pic_object"
1593 # A standard non-PIC object
1594 non_pic_objects="$non_pic_objects $non_pic_object"
1595 if test -z "$pic_object" || test "$pic_object" = none ; then
1596 arg="$non_pic_object"
1599 else
1600 # Only an error if not doing a dry-run.
1601 if test -z "$run"; then
1602 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1603 exit 1
1604 else
1605 # Dry-run case.
1607 # Extract subdirectory from the argument.
1608 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1609 if test "X$xdir" = "X$arg"; then
1610 xdir=
1611 else
1612 xdir="$xdir/"
1615 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1616 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1617 libobjs="$libobjs $pic_object"
1618 non_pic_objects="$non_pic_objects $non_pic_object"
1623 *.$libext)
1624 # An archive.
1625 deplibs="$deplibs $arg"
1626 old_deplibs="$old_deplibs $arg"
1627 continue
1630 *.la)
1631 # A libtool-controlled library.
1633 if test "$prev" = dlfiles; then
1634 # This library was specified with -dlopen.
1635 dlfiles="$dlfiles $arg"
1636 prev=
1637 elif test "$prev" = dlprefiles; then
1638 # The library was specified with -dlpreopen.
1639 dlprefiles="$dlprefiles $arg"
1640 prev=
1641 else
1642 deplibs="$deplibs $arg"
1644 continue
1647 # Some other compiler argument.
1649 # Unknown arguments in both finalize_command and compile_command need
1650 # to be aesthetically quoted because they are evaled later.
1651 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1652 case $arg in
1653 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1654 arg="\"$arg\""
1656 esac
1657 add_flags="$add_flags $arg"
1659 esac # arg
1661 # Now actually substitute the argument into the commands.
1662 if test -n "$arg"; then
1663 compile_command="$compile_command $arg"
1664 finalize_command="$finalize_command $arg"
1666 done # argument parsing loop
1668 if test -n "$prev"; then
1669 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1670 $echo "$help" 1>&2
1671 exit 1
1674 # Infer tagged configuration to use if any are available and
1675 # if one wasn't chosen via the "--tag" command line option.
1676 # Only attempt this if the compiler in the base link
1677 # command doesn't match the default compiler.
1678 if test -n "$available_tags" && test -z "$tagname"; then
1679 case $base_compile in
1680 # Blanks in the command may have been stripped by the calling shell,
1681 # but not from the CC environment variable when configure was run.
1682 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1683 # Blanks at the start of $base_compile will cause this to fail
1684 # if we don't check for them as well.
1686 for z in $available_tags; do
1687 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1688 # Evaluate the configuration.
1689 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1690 case $base_compile in
1691 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1692 # The compiler in $compile_command matches
1693 # the one in the tagged configuration.
1694 # Assume this is the tagged configuration we want.
1695 tagname=$z
1696 break
1698 esac
1700 done
1701 # If $tagname still isn't set, then no tagged configuration
1702 # was found and let the user know that the "--tag" command
1703 # line option must be used.
1704 if test -z "$tagname"; then
1705 $echo "$modename: unable to infer tagged configuration"
1706 $echo "$modename: specify a tag with \`--tag'" 1>&2
1707 exit 1
1708 # else
1709 # $echo "$modename: using $tagname tagged configuration"
1712 esac
1715 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1716 eval arg=\"$export_dynamic_flag_spec\"
1717 compile_command="$compile_command $arg"
1718 finalize_command="$finalize_command $arg"
1721 oldlibs=
1722 # calculate the name of the file, without its directory
1723 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1724 libobjs_save="$libobjs"
1726 if test -n "$shlibpath_var"; then
1727 # get the directories listed in $shlibpath_var
1728 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1729 else
1730 shlib_search_path=
1732 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1733 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1735 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1736 if test "X$output_objdir" = "X$output"; then
1737 output_objdir="$objdir"
1738 else
1739 output_objdir="$output_objdir/$objdir"
1741 # Create the object directory.
1742 if test ! -d "$output_objdir"; then
1743 $show "$mkdir $output_objdir"
1744 $run $mkdir $output_objdir
1745 status=$?
1746 if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1747 exit $status
1751 # Determine the type of output
1752 case $output in
1754 $echo "$modename: you must specify an output file" 1>&2
1755 $echo "$help" 1>&2
1756 exit 1
1758 *.$libext) linkmode=oldlib ;;
1759 *.lo | *.$objext) linkmode=obj ;;
1760 *.la) linkmode=lib ;;
1761 *) linkmode=prog ;; # Anything else should be a program.
1762 esac
1764 case $host in
1765 *cygwin* | *mingw* | *pw32*)
1766 # don't eliminate duplcations in $postdeps and $predeps
1767 duplicate_compiler_generated_deps=yes
1770 duplicate_compiler_generated_deps=$duplicate_deps
1772 esac
1773 specialdeplibs=
1775 libs=
1776 # Find all interdependent deplibs by searching for libraries
1777 # that are linked more than once (e.g. -la -lb -la)
1778 for deplib in $deplibs; do
1779 if test "X$duplicate_deps" = "Xyes" ; then
1780 case "$libs " in
1781 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1782 esac
1784 libs="$libs $deplib"
1785 done
1787 if test "$linkmode" = lib; then
1788 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1790 # Compute libraries that are listed more than once in $predeps
1791 # $postdeps and mark them as special (i.e., whose duplicates are
1792 # not to be eliminated).
1793 pre_post_deps=
1794 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1795 for pre_post_dep in $predeps $postdeps; do
1796 case "$pre_post_deps " in
1797 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1798 esac
1799 pre_post_deps="$pre_post_deps $pre_post_dep"
1800 done
1802 pre_post_deps=
1805 deplibs=
1806 newdependency_libs=
1807 newlib_search_path=
1808 need_relink=no # whether we're linking any uninstalled libtool libraries
1809 notinst_deplibs= # not-installed libtool libraries
1810 notinst_path= # paths that contain not-installed libtool libraries
1811 case $linkmode in
1812 lib)
1813 passes="conv link"
1814 for file in $dlfiles $dlprefiles; do
1815 case $file in
1816 *.la) ;;
1818 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1819 exit 1
1821 esac
1822 done
1824 prog)
1825 compile_deplibs=
1826 finalize_deplibs=
1827 alldeplibs=no
1828 newdlfiles=
1829 newdlprefiles=
1830 passes="conv scan dlopen dlpreopen link"
1832 *) passes="conv"
1834 esac
1835 for pass in $passes; do
1836 if test "$linkmode,$pass" = "lib,link" ||
1837 test "$linkmode,$pass" = "prog,scan"; then
1838 libs="$deplibs"
1839 deplibs=
1841 if test "$linkmode" = prog; then
1842 case $pass in
1843 dlopen) libs="$dlfiles" ;;
1844 dlpreopen) libs="$dlprefiles" ;;
1845 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1846 esac
1848 if test "$pass" = dlopen; then
1849 # Collect dlpreopened libraries
1850 save_deplibs="$deplibs"
1851 deplibs=
1853 for deplib in $libs; do
1854 lib=
1855 found=no
1856 case $deplib in
1857 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1858 if test "$linkmode,$pass" = "prog,link"; then
1859 compile_deplibs="$deplib $compile_deplibs"
1860 finalize_deplibs="$deplib $finalize_deplibs"
1861 else
1862 deplibs="$deplib $deplibs"
1864 continue
1866 -l*)
1867 if test "$linkmode" != lib && test "$linkmode" != prog; then
1868 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1869 continue
1871 if test "$pass" = conv && test "$allow_undefined" = yes; then
1872 deplibs="$deplib $deplibs"
1873 continue
1875 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1876 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1877 for search_ext in .la $shrext .so .a; do
1878 # Search the libtool library
1879 lib="$searchdir/lib${name}${search_ext}"
1880 if test -f "$lib"; then
1881 if test "$search_ext" = ".la"; then
1882 found=yes
1883 else
1884 found=no
1886 break 2
1888 done
1889 done
1890 if test "$found" != yes; then
1891 # deplib doesn't seem to be a libtool library
1892 if test "$linkmode,$pass" = "prog,link"; then
1893 compile_deplibs="$deplib $compile_deplibs"
1894 finalize_deplibs="$deplib $finalize_deplibs"
1895 else
1896 deplibs="$deplib $deplibs"
1897 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1899 continue
1900 else # deplib is a libtool library
1901 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1902 # We need to do some special things here, and not later.
1903 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1904 case " $predeps $postdeps " in
1905 *" $deplib "*)
1906 if (${SED} -e '2q' $lib |
1907 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1908 library_names=
1909 old_library=
1910 case $lib in
1911 */* | *\\*) . $lib ;;
1912 *) . ./$lib ;;
1913 esac
1914 for l in $old_library $library_names; do
1915 ll="$l"
1916 done
1917 if test "X$ll" = "X$old_library" ; then # only static version available
1918 found=no
1919 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1920 test "X$ladir" = "X$lib" && ladir="."
1921 lib=$ladir/$old_library
1922 if test "$linkmode,$pass" = "prog,link"; then
1923 compile_deplibs="$deplib $compile_deplibs"
1924 finalize_deplibs="$deplib $finalize_deplibs"
1925 else
1926 deplibs="$deplib $deplibs"
1927 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1929 continue
1933 *) ;;
1934 esac
1937 ;; # -l
1938 *.ltframework)
1939 if test "$linkmode,$pass" = "prog,link"; then
1940 compile_deplibs="$deplib $compile_deplibs"
1941 finalize_deplibs="$deplib $finalize_deplibs"
1942 else
1943 deplibs="$deplib $deplibs"
1944 if test "$linkmode" = lib ; then
1945 newdependency_libs="$deplib $newdependency_libs"
1948 continue
1950 -L*)
1951 case $linkmode in
1952 lib)
1953 deplibs="$deplib $deplibs"
1954 test "$pass" = conv && continue
1955 newdependency_libs="$deplib $newdependency_libs"
1956 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1958 prog)
1959 if test "$pass" = conv; then
1960 deplibs="$deplib $deplibs"
1961 continue
1963 if test "$pass" = scan; then
1964 deplibs="$deplib $deplibs"
1965 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1966 else
1967 compile_deplibs="$deplib $compile_deplibs"
1968 finalize_deplibs="$deplib $finalize_deplibs"
1972 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1974 esac # linkmode
1975 continue
1976 ;; # -L
1977 -R*)
1978 if test "$pass" = link; then
1979 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1980 # Make sure the xrpath contains only unique directories.
1981 case "$xrpath " in
1982 *" $dir "*) ;;
1983 *) xrpath="$xrpath $dir" ;;
1984 esac
1986 deplibs="$deplib $deplibs"
1987 continue
1989 *.la) lib="$deplib" ;;
1990 *.$libext)
1991 if test "$pass" = conv; then
1992 deplibs="$deplib $deplibs"
1993 continue
1995 case $linkmode in
1996 lib)
1997 if test "$deplibs_check_method" != pass_all; then
1998 $echo
1999 $echo "*** Warning: Trying to link with static lib archive $deplib."
2000 $echo "*** I have the capability to make that library automatically link in when"
2001 $echo "*** you link to this library. But I can only do this if you have a"
2002 $echo "*** shared version of the library, which you do not appear to have"
2003 $echo "*** because the file extensions .$libext of this argument makes me believe"
2004 $echo "*** that it is just a static archive that I should not used here."
2005 else
2006 $echo
2007 $echo "*** Warning: Linking the shared library $output against the"
2008 $echo "*** static library $deplib is not portable!"
2009 deplibs="$deplib $deplibs"
2011 continue
2013 prog)
2014 if test "$pass" != link; then
2015 deplibs="$deplib $deplibs"
2016 else
2017 compile_deplibs="$deplib $compile_deplibs"
2018 finalize_deplibs="$deplib $finalize_deplibs"
2020 continue
2022 esac # linkmode
2023 ;; # *.$libext
2024 *.lo | *.$objext)
2025 if test "$pass" = conv; then
2026 deplibs="$deplib $deplibs"
2027 elif test "$linkmode" = prog; then
2028 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2029 # If there is no dlopen support or we're linking statically,
2030 # we need to preload.
2031 newdlprefiles="$newdlprefiles $deplib"
2032 compile_deplibs="$deplib $compile_deplibs"
2033 finalize_deplibs="$deplib $finalize_deplibs"
2034 else
2035 newdlfiles="$newdlfiles $deplib"
2038 continue
2040 %DEPLIBS%)
2041 alldeplibs=yes
2042 continue
2044 esac # case $deplib
2045 if test "$found" = yes || test -f "$lib"; then :
2046 else
2047 $echo "$modename: cannot find the library \`$lib'" 1>&2
2048 exit 1
2051 # Check to see that this really is a libtool archive.
2052 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2053 else
2054 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2055 exit 1
2058 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2059 test "X$ladir" = "X$lib" && ladir="."
2061 dlname=
2062 dlopen=
2063 dlpreopen=
2064 libdir=
2065 library_names=
2066 old_library=
2067 # If the library was installed with an old release of libtool,
2068 # it will not redefine variables installed, or shouldnotlink
2069 installed=yes
2070 shouldnotlink=no
2072 # Read the .la file
2073 case $lib in
2074 */* | *\\*) . $lib ;;
2075 *) . ./$lib ;;
2076 esac
2078 case $host in
2079 *-*-darwin*)
2080 # Convert "-framework foo" to "foo.ltframework" in dependency_libs
2081 test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
2083 esac
2085 if test "$linkmode,$pass" = "lib,link" ||
2086 test "$linkmode,$pass" = "prog,scan" ||
2087 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2088 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2089 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2092 if test "$pass" = conv; then
2093 # Only check for convenience libraries
2094 deplibs="$lib $deplibs"
2095 tmp_libs=
2096 for deplib in $dependency_libs; do
2097 #echo "Adding $deplib to \$deplibs"
2098 deplibs="$deplib $deplibs"
2099 if test "X$duplicate_deps" = "Xyes" ; then
2100 case "$tmp_libs " in
2101 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2102 esac
2104 tmp_libs="$tmp_libs $deplib"
2105 done
2106 if test -z "$libdir"; then
2107 if test -z "$old_library"; then
2108 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2109 exit 1
2111 # It is a libtool convenience library, so add in its objects.
2112 convenience="$convenience $ladir/$objdir/$old_library"
2113 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2114 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2115 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2116 exit 1
2118 continue
2119 fi # $pass = conv
2122 # Get the name of the library we link against.
2123 linklib=
2124 for l in $old_library $library_names; do
2125 linklib="$l"
2126 done
2127 if test -z "$linklib"; then
2128 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2129 exit 1
2132 # This library was specified with -dlopen.
2133 if test "$pass" = dlopen; then
2134 if test -z "$libdir"; then
2135 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2136 exit 1
2138 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2139 # If there is no dlname, no dlopen support or we're linking
2140 # statically, we need to preload. We also need to preload any
2141 # dependent libraries so libltdl's deplib preloader doesn't
2142 # bomb out in the load deplibs phase.
2143 dlprefiles="$dlprefiles $lib $dependency_libs"
2144 else
2145 newdlfiles="$newdlfiles $lib"
2147 continue
2148 fi # $pass = dlopen
2150 # We need an absolute path.
2151 case $ladir in
2152 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2154 abs_ladir=`cd "$ladir" && pwd`
2155 if test -z "$abs_ladir"; then
2156 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2157 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2158 abs_ladir="$ladir"
2161 esac
2162 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2164 # Find the relevant object directory and library name.
2165 if test "X$installed" = Xyes; then
2166 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2167 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2168 dir="$ladir"
2169 absdir="$abs_ladir"
2170 libdir="$abs_ladir"
2171 else
2172 dir="$libdir"
2173 absdir="$libdir"
2175 else
2176 dir="$ladir/$objdir"
2177 absdir="$abs_ladir/$objdir"
2178 # Remove this search path later
2179 notinst_path="$notinst_path $abs_ladir"
2180 fi # $installed = yes
2181 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2183 # This library was specified with -dlpreopen.
2184 if test "$pass" = dlpreopen; then
2185 if test -z "$libdir"; then
2186 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2187 exit 1
2189 # Prefer using a static library (so that no silly _DYNAMIC symbols
2190 # are required to link).
2191 if test -n "$old_library"; then
2192 newdlprefiles="$newdlprefiles $dir/$old_library"
2193 # Otherwise, use the dlname, so that lt_dlopen finds it.
2194 elif test -n "$dlname"; then
2195 newdlprefiles="$newdlprefiles $dir/$dlname"
2196 else
2197 newdlprefiles="$newdlprefiles $dir/$linklib"
2199 fi # $pass = dlpreopen
2201 if test -z "$libdir"; then
2202 # Link the convenience library
2203 if test "$linkmode" = lib; then
2204 deplibs="$dir/$old_library $deplibs"
2205 elif test "$linkmode,$pass" = "prog,link"; then
2206 compile_deplibs="$dir/$old_library $compile_deplibs"
2207 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2208 else
2209 deplibs="$lib $deplibs" # used for prog,scan pass
2211 continue
2215 if test "$linkmode" = prog && test "$pass" != link; then
2216 newlib_search_path="$newlib_search_path $ladir"
2217 deplibs="$lib $deplibs"
2219 linkalldeplibs=no
2220 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2221 test "$build_libtool_libs" = no; then
2222 linkalldeplibs=yes
2225 tmp_libs=
2226 for deplib in $dependency_libs; do
2227 case $deplib in
2228 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2229 esac
2230 # Need to link against all dependency_libs?
2231 if test "$linkalldeplibs" = yes; then
2232 deplibs="$deplib $deplibs"
2233 else
2234 # Need to hardcode shared library paths
2235 # or/and link against static libraries
2236 newdependency_libs="$deplib $newdependency_libs"
2238 if test "X$duplicate_deps" = "Xyes" ; then
2239 case "$tmp_libs " in
2240 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2241 esac
2243 tmp_libs="$tmp_libs $deplib"
2244 done # for deplib
2245 continue
2246 fi # $linkmode = prog...
2248 if test "$linkmode,$pass" = "prog,link"; then
2249 if test -n "$library_names" &&
2250 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2251 # We need to hardcode the library path
2252 if test -n "$shlibpath_var"; then
2253 # Make sure the rpath contains only unique directories.
2254 case "$temp_rpath " in
2255 *" $dir "*) ;;
2256 *" $absdir "*) ;;
2257 *) temp_rpath="$temp_rpath $dir" ;;
2258 esac
2261 # Hardcode the library path.
2262 # Skip directories that are in the system default run-time
2263 # search path.
2264 case " $sys_lib_dlsearch_path " in
2265 *" $absdir "*) ;;
2267 case "$compile_rpath " in
2268 *" $absdir "*) ;;
2269 *) compile_rpath="$compile_rpath $absdir"
2270 esac
2272 esac
2273 case " $sys_lib_dlsearch_path " in
2274 *" $libdir "*) ;;
2276 case "$finalize_rpath " in
2277 *" $libdir "*) ;;
2278 *) finalize_rpath="$finalize_rpath $libdir"
2279 esac
2281 esac
2282 fi # $linkmode,$pass = prog,link...
2284 if test "$alldeplibs" = yes &&
2285 { test "$deplibs_check_method" = pass_all ||
2286 { test "$build_libtool_libs" = yes &&
2287 test -n "$library_names"; }; }; then
2288 # We only need to search for static libraries
2289 continue
2293 link_static=no # Whether the deplib will be linked statically
2294 if test -n "$library_names" &&
2295 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2296 if test "$installed" = no; then
2297 notinst_deplibs="$notinst_deplibs $lib"
2298 need_relink=yes
2300 # This is a shared library
2302 # Warn about portability, can't link against -module's on some systems (darwin)
2303 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2304 $echo
2305 if test "$linkmode" = prog; then
2306 $echo "*** Warning: Linking the executable $output against the loadable module"
2307 else
2308 $echo "*** Warning: Linking the shared library $output against the loadable module"
2310 $echo "*** $linklib is not portable!"
2312 if test "$linkmode" = lib &&
2313 test "$hardcode_into_libs" = yes; then
2314 # Hardcode the library path.
2315 # Skip directories that are in the system default run-time
2316 # search path.
2317 case " $sys_lib_dlsearch_path " in
2318 *" $absdir "*) ;;
2320 case "$compile_rpath " in
2321 *" $absdir "*) ;;
2322 *) compile_rpath="$compile_rpath $absdir"
2323 esac
2325 esac
2326 case " $sys_lib_dlsearch_path " in
2327 *" $libdir "*) ;;
2329 case "$finalize_rpath " in
2330 *" $libdir "*) ;;
2331 *) finalize_rpath="$finalize_rpath $libdir"
2332 esac
2334 esac
2337 if test -n "$old_archive_from_expsyms_cmds"; then
2338 # figure out the soname
2339 set dummy $library_names
2340 realname="$2"
2341 shift; shift
2342 libname=`eval \\$echo \"$libname_spec\"`
2343 # use dlname if we got it. it's perfectly good, no?
2344 if test -n "$dlname"; then
2345 soname="$dlname"
2346 elif test -n "$soname_spec"; then
2347 # bleh windows
2348 case $host in
2349 *cygwin* | mingw*)
2350 major=`expr $current - $age`
2351 versuffix="-$major"
2353 esac
2354 eval soname=\"$soname_spec\"
2355 else
2356 soname="$realname"
2359 # Make a new name for the extract_expsyms_cmds to use
2360 soroot="$soname"
2361 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2362 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2364 # If the library has no export list, then create one now
2365 if test -f "$output_objdir/$soname-def"; then :
2366 else
2367 $show "extracting exported symbol list from \`$soname'"
2368 save_ifs="$IFS"; IFS='~'
2369 eval cmds=\"$extract_expsyms_cmds\"
2370 for cmd in $cmds; do
2371 IFS="$save_ifs"
2372 $show "$cmd"
2373 $run eval "$cmd" || exit $?
2374 done
2375 IFS="$save_ifs"
2378 # Create $newlib
2379 if test -f "$output_objdir/$newlib"; then :; else
2380 $show "generating import library for \`$soname'"
2381 save_ifs="$IFS"; IFS='~'
2382 eval cmds=\"$old_archive_from_expsyms_cmds\"
2383 for cmd in $cmds; do
2384 IFS="$save_ifs"
2385 $show "$cmd"
2386 $run eval "$cmd" || exit $?
2387 done
2388 IFS="$save_ifs"
2390 # make sure the library variables are pointing to the new library
2391 dir=$output_objdir
2392 linklib=$newlib
2393 fi # test -n "$old_archive_from_expsyms_cmds"
2395 if test "$linkmode" = prog || test "$mode" != relink; then
2396 add_shlibpath=
2397 add_dir=
2398 add=
2399 lib_linked=yes
2400 case $hardcode_action in
2401 immediate | unsupported)
2402 if test "$hardcode_direct" = no; then
2403 add="$dir/$linklib"
2404 case $host in
2405 *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2406 *-*-darwin* )
2407 # if the lib is a module then we can not link against it, someone
2408 # is ignoring the new warnings I added
2409 if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2410 $echo "** Warning, lib $linklib is a module, not a shared library"
2411 if test -z "$old_library" ; then
2412 $echo
2413 $echo "** And there doesn't seem to be a static archive available"
2414 $echo "** The link will probably fail, sorry"
2415 else
2416 add="$dir/$old_library"
2419 esac
2420 elif test "$hardcode_minus_L" = no; then
2421 case $host in
2422 *-*-sunos*) add_shlibpath="$dir" ;;
2423 esac
2424 add_dir="-L$dir"
2425 add="-l$name"
2426 elif test "$hardcode_shlibpath_var" = no; then
2427 add_shlibpath="$dir"
2428 add="-l$name"
2429 else
2430 lib_linked=no
2433 relink)
2434 if test "$hardcode_direct" = yes; then
2435 add="$dir/$linklib"
2436 elif test "$hardcode_minus_L" = yes; then
2437 add_dir="-L$dir"
2438 # Try looking first in the location we're being installed to.
2439 if test -n "$inst_prefix_dir"; then
2440 case "$libdir" in
2441 [\\/]*)
2442 add_dir="-L$inst_prefix_dir$libdir $add_dir"
2444 esac
2446 add="-l$name"
2447 elif test "$hardcode_shlibpath_var" = yes; then
2448 add_shlibpath="$dir"
2449 add="-l$name"
2450 else
2451 lib_linked=no
2454 *) lib_linked=no ;;
2455 esac
2457 if test "$lib_linked" != yes; then
2458 $echo "$modename: configuration error: unsupported hardcode properties"
2459 exit 1
2462 if test -n "$add_shlibpath"; then
2463 case :$compile_shlibpath: in
2464 *":$add_shlibpath:"*) ;;
2465 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2466 esac
2468 if test "$linkmode" = prog; then
2469 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2470 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2471 else
2472 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2473 test -n "$add" && deplibs="$add $deplibs"
2474 if test "$hardcode_direct" != yes && \
2475 test "$hardcode_minus_L" != yes && \
2476 test "$hardcode_shlibpath_var" = yes; then
2477 case :$finalize_shlibpath: in
2478 *":$libdir:"*) ;;
2479 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2480 esac
2485 if test "$linkmode" = prog || test "$mode" = relink; then
2486 add_shlibpath=
2487 add_dir=
2488 add=
2489 # Finalize command for both is simple: just hardcode it.
2490 if test "$hardcode_direct" = yes; then
2491 add="$libdir/$linklib"
2492 elif test "$hardcode_minus_L" = yes; then
2493 add_dir="-L$libdir"
2494 add="-l$name"
2495 elif test "$hardcode_shlibpath_var" = yes; then
2496 case :$finalize_shlibpath: in
2497 *":$libdir:"*) ;;
2498 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2499 esac
2500 add="-l$name"
2501 elif test "$hardcode_automatic" = yes; then
2502 if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2503 add="$inst_prefix_dir$libdir/$linklib"
2504 else
2505 add="$libdir/$linklib"
2507 else
2508 # We cannot seem to hardcode it, guess we'll fake it.
2509 add_dir="-L$libdir"
2510 # Try looking first in the location we're being installed to.
2511 if test -n "$inst_prefix_dir"; then
2512 case "$libdir" in
2513 [\\/]*)
2514 add_dir="-L$inst_prefix_dir$libdir $add_dir"
2516 esac
2518 add="-l$name"
2521 if test "$linkmode" = prog; then
2522 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2523 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2524 else
2525 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2526 test -n "$add" && deplibs="$add $deplibs"
2529 elif test "$linkmode" = prog; then
2530 # Here we assume that one of hardcode_direct or hardcode_minus_L
2531 # is not unsupported. This is valid on all known static and
2532 # shared platforms.
2533 if test "$hardcode_direct" != unsupported; then
2534 test -n "$old_library" && linklib="$old_library"
2535 compile_deplibs="$dir/$linklib $compile_deplibs"
2536 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2537 else
2538 compile_deplibs="-l$name -L$dir $compile_deplibs"
2539 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2541 elif test "$build_libtool_libs" = yes; then
2542 # Not a shared library
2543 if test "$deplibs_check_method" != pass_all; then
2544 # We're trying link a shared library against a static one
2545 # but the system doesn't support it.
2547 # Just print a warning and add the library to dependency_libs so
2548 # that the program can be linked against the static library.
2549 $echo
2550 $echo "*** Warning: This system can not link to static lib archive $lib."
2551 $echo "*** I have the capability to make that library automatically link in when"
2552 $echo "*** you link to this library. But I can only do this if you have a"
2553 $echo "*** shared version of the library, which you do not appear to have."
2554 if test "$module" = yes; then
2555 $echo "*** But as you try to build a module library, libtool will still create "
2556 $echo "*** a static module, that should work as long as the dlopening application"
2557 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2558 if test -z "$global_symbol_pipe"; then
2559 $echo
2560 $echo "*** However, this would only work if libtool was able to extract symbol"
2561 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2562 $echo "*** not find such a program. So, this module is probably useless."
2563 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2565 if test "$build_old_libs" = no; then
2566 build_libtool_libs=module
2567 build_old_libs=yes
2568 else
2569 build_libtool_libs=no
2572 else
2573 convenience="$convenience $dir/$old_library"
2574 old_convenience="$old_convenience $dir/$old_library"
2575 deplibs="$dir/$old_library $deplibs"
2576 link_static=yes
2578 fi # link shared/static library?
2580 if test "$linkmode" = lib; then
2581 #if test -n "$dependency_libs" &&
2582 # { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2583 # test "$link_static" = yes; }; then
2584 # Extract -R from dependency_libs
2585 temp_deplibs=
2586 for libdir in $dependency_libs; do
2587 case $libdir in
2588 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2589 case " $xrpath " in
2590 *" $temp_xrpath "*) ;;
2591 *) xrpath="$xrpath $temp_xrpath";;
2592 esac;;
2593 *) temp_deplibs="$temp_deplibs $libdir";;
2594 esac
2595 done
2596 dependency_libs="$temp_deplibs"
2599 newlib_search_path="$newlib_search_path $absdir"
2600 # Link against this library
2601 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2602 # ... and its dependency_libs
2603 tmp_libs=
2604 for deplib in $dependency_libs; do
2605 newdependency_libs="$deplib $newdependency_libs"
2606 if test "X$duplicate_deps" = "Xyes" ; then
2607 case "$tmp_libs " in
2608 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2609 esac
2611 tmp_libs="$tmp_libs $deplib"
2612 done
2614 if test "$link_all_deplibs" != no; then
2615 # Add the search paths of all dependency libraries
2616 for deplib in $dependency_libs; do
2617 case $deplib in
2618 -L*) path="$deplib" ;;
2619 *.la)
2620 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2621 test "X$dir" = "X$deplib" && dir="."
2622 # We need an absolute path.
2623 case $dir in
2624 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2626 absdir=`cd "$dir" && pwd`
2627 if test -z "$absdir"; then
2628 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2629 absdir="$dir"
2632 esac
2633 if grep "^installed=no" $deplib > /dev/null; then
2634 path="$absdir/$objdir"
2635 else
2636 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2637 if test -z "$libdir"; then
2638 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2639 exit 1
2641 if test "$absdir" != "$libdir"; then
2642 # Sure, some shells/systems don't implement the -ef.
2643 # Those will have to live with the warning.
2644 test "$absdir" -ef "$libdir" > /dev/null 2>&1 ||
2645 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2647 path="$absdir"
2649 depdepl=
2650 case $host in
2651 *-*-darwin*)
2652 # we do not want to link against static libs, but need to link against shared
2653 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2654 if test -n "$deplibrary_names" ; then
2655 for tmp in $deplibrary_names ; do
2656 depdepl=$tmp
2657 done
2658 if test -f "$path/$depdepl" ; then
2659 depdepl="$path/$depdepl"
2661 # do not add paths which are already there
2662 case " $newlib_search_path " in
2663 *" $path "*) ;;
2664 *) newlib_search_path="$newlib_search_path $path";;
2665 esac
2666 path=""
2670 path="-L$path"
2672 esac
2675 -l*)
2676 case $host in
2677 *-*-darwin*)
2678 # Again, we only want to link against shared libraries
2679 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2680 for tmp in $newlib_search_path ; do
2681 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2682 eval depdepl="$tmp/lib$tmp_libs.dylib"
2683 break
2685 done
2686 path=""
2688 *) continue ;;
2689 esac
2692 *.ltframework)
2693 case $host in
2694 *-*-darwin*)
2695 depdepl="$deplib"
2697 esac
2700 *) continue ;;
2701 esac
2702 case " $deplibs " in
2703 *" $depdepl "*) ;;
2704 *) deplibs="$deplibs $depdepl" ;;
2705 esac
2706 case " $deplibs " in
2707 *" $path "*) ;;
2708 *) deplibs="$deplibs $path" ;;
2709 esac
2710 done
2711 fi # link_all_deplibs != no
2712 fi # linkmode = lib
2713 done # for deplib in $libs
2714 dependency_libs="$newdependency_libs"
2715 if test "$pass" = dlpreopen; then
2716 # Link the dlpreopened libraries before other libraries
2717 for deplib in $save_deplibs; do
2718 deplibs="$deplib $deplibs"
2719 done
2721 if test "$pass" != dlopen; then
2722 if test "$pass" != conv; then
2723 # Make sure lib_search_path contains only unique directories.
2724 lib_search_path=
2725 for dir in $newlib_search_path; do
2726 case "$lib_search_path " in
2727 *" $dir "*) ;;
2728 *) lib_search_path="$lib_search_path $dir" ;;
2729 esac
2730 done
2731 newlib_search_path=
2734 if test "$linkmode,$pass" != "prog,link"; then
2735 vars="deplibs"
2736 else
2737 vars="compile_deplibs finalize_deplibs"
2739 for var in $vars dependency_libs; do
2740 # Add libraries to $var in reverse order
2741 eval tmp_libs=\"\$$var\"
2742 new_libs=
2743 for deplib in $tmp_libs; do
2744 # FIXME: Pedantically, this is the right thing to do, so
2745 # that some nasty dependency loop isn't accidentally
2746 # broken:
2747 #new_libs="$deplib $new_libs"
2748 # Pragmatically, this seems to cause very few problems in
2749 # practice:
2750 case $deplib in
2751 -L*) new_libs="$deplib $new_libs" ;;
2752 -R*) ;;
2754 # And here is the reason: when a library appears more
2755 # than once as an explicit dependence of a library, or
2756 # is implicitly linked in more than once by the
2757 # compiler, it is considered special, and multiple
2758 # occurrences thereof are not removed. Compare this
2759 # with having the same library being listed as a
2760 # dependency of multiple other libraries: in this case,
2761 # we know (pedantically, we assume) the library does not
2762 # need to be listed more than once, so we keep only the
2763 # last copy. This is not always right, but it is rare
2764 # enough that we require users that really mean to play
2765 # such unportable linking tricks to link the library
2766 # using -Wl,-lname, so that libtool does not consider it
2767 # for duplicate removal.
2768 case " $specialdeplibs " in
2769 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2771 case " $new_libs " in
2772 *" $deplib "*) ;;
2773 *) new_libs="$deplib $new_libs" ;;
2774 esac
2776 esac
2778 esac
2779 done
2780 tmp_libs=
2781 for deplib in $new_libs; do
2782 case $deplib in
2783 -L*)
2784 case " $tmp_libs " in
2785 *" $deplib "*) ;;
2786 *) tmp_libs="$tmp_libs $deplib" ;;
2787 esac
2789 *) tmp_libs="$tmp_libs $deplib" ;;
2790 esac
2791 done
2792 eval $var=\"$tmp_libs\"
2793 done # for var
2795 # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
2796 tmp_libs=
2797 for i in $dependency_libs ; do
2798 case " $predeps $postdeps $compiler_lib_search_path " in
2799 *" $i "*)
2800 i=""
2802 esac
2803 if test -n "$i" ; then
2804 tmp_libs="$tmp_libs $i"
2806 done
2807 dependency_libs=$tmp_libs
2808 done # for pass
2809 if test "$linkmode" = prog; then
2810 dlfiles="$newdlfiles"
2811 dlprefiles="$newdlprefiles"
2814 case $linkmode in
2815 oldlib)
2816 if test -n "$deplibs"; then
2817 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2820 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2821 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2824 if test -n "$rpath"; then
2825 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2828 if test -n "$xrpath"; then
2829 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2832 if test -n "$vinfo"; then
2833 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2836 if test -n "$release"; then
2837 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2840 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2841 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2844 # Now set the variables for building old libraries.
2845 build_libtool_libs=no
2846 oldlibs="$output"
2847 objs="$objs$old_deplibs"
2850 lib)
2851 # Make sure we only generate libraries of the form `libNAME.la'.
2852 case $outputname in
2853 lib*)
2854 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2855 eval shared_ext=\"$shrext\"
2856 eval libname=\"$libname_spec\"
2859 if test "$module" = no; then
2860 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2861 $echo "$help" 1>&2
2862 exit 1
2864 if test "$need_lib_prefix" != no; then
2865 # Add the "lib" prefix for modules if required
2866 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2867 eval shared_ext=\"$shrext\"
2868 eval libname=\"$libname_spec\"
2869 else
2870 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2873 esac
2875 if test -n "$objs"; then
2876 if test "$deplibs_check_method" != pass_all; then
2877 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2878 exit 1
2879 else
2880 $echo
2881 $echo "*** Warning: Linking the shared library $output against the non-libtool"
2882 $echo "*** objects $objs is not portable!"
2883 libobjs="$libobjs $objs"
2887 if test "$dlself" != no; then
2888 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2891 set dummy $rpath
2892 if test "$#" -gt 2; then
2893 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2895 install_libdir="$2"
2897 oldlibs=
2898 if test -z "$rpath"; then
2899 if test "$build_libtool_libs" = yes; then
2900 # Building a libtool convenience library.
2901 # Some compilers have problems with a `.al' extension so
2902 # convenience libraries should have the same extension an
2903 # archive normally would.
2904 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2905 build_libtool_libs=convenience
2906 build_old_libs=yes
2909 if test -n "$vinfo"; then
2910 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2913 if test -n "$release"; then
2914 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2916 else
2918 # Parse the version information argument.
2919 save_ifs="$IFS"; IFS=':'
2920 set dummy $vinfo 0 0 0
2921 IFS="$save_ifs"
2923 if test -n "$8"; then
2924 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2925 $echo "$help" 1>&2
2926 exit 1
2929 # convert absolute version numbers to libtool ages
2930 # this retains compatibility with .la files and attempts
2931 # to make the code below a bit more comprehensible
2933 case $vinfo_number in
2934 yes)
2935 number_major="$2"
2936 number_minor="$3"
2937 number_revision="$4"
2939 # There are really only two kinds -- those that
2940 # use the current revision as the major version
2941 # and those that subtract age and use age as
2942 # a minor version. But, then there is irix
2943 # which has an extra 1 added just for fun
2945 case $version_type in
2946 darwin|linux|osf|windows)
2947 current=`expr $number_major + $number_minor`
2948 age="$number_minor"
2949 revision="$number_revision"
2951 freebsd-aout|freebsd-elf|sunos)
2952 current="$number_major"
2953 revision="$number_minor"
2954 age="0"
2956 irix|nonstopux)
2957 current=`expr $number_major + $number_minor - 1`
2958 age="$number_minor"
2959 revision="$number_minor"
2961 esac
2964 current="$2"
2965 revision="$3"
2966 age="$4"
2968 esac
2970 # Check that each of the things are valid numbers.
2971 case $current in
2972 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2974 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2975 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2976 exit 1
2978 esac
2980 case $revision in
2981 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2983 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2984 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2985 exit 1
2987 esac
2989 case $age in
2990 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2992 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2993 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2994 exit 1
2996 esac
2998 if test "$age" -gt "$current"; then
2999 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3000 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3001 exit 1
3004 # Calculate the version variables.
3005 major=
3006 versuffix=
3007 verstring=
3008 case $version_type in
3009 none) ;;
3011 darwin)
3012 # Like Linux, but with the current version available in
3013 # verstring for coding it into the library header
3014 major=.`expr $current - $age`
3015 versuffix="$major.$age.$revision"
3016 # Darwin ld doesn't like 0 for these options...
3017 minor_current=`expr $current + 1`
3018 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3021 freebsd-aout)
3022 major=".$current"
3023 versuffix=".$current.$revision";
3026 freebsd-elf)
3027 major=".$current"
3028 versuffix=".$current";
3031 irix | nonstopux)
3032 major=`expr $current - $age + 1`
3034 case $version_type in
3035 nonstopux) verstring_prefix=nonstopux ;;
3036 *) verstring_prefix=sgi ;;
3037 esac
3038 verstring="$verstring_prefix$major.$revision"
3040 # Add in all the interfaces that we are compatible with.
3041 loop=$revision
3042 while test "$loop" -ne 0; do
3043 iface=`expr $revision - $loop`
3044 loop=`expr $loop - 1`
3045 verstring="$verstring_prefix$major.$iface:$verstring"
3046 done
3048 # Before this point, $major must not contain `.'.
3049 major=.$major
3050 versuffix="$major.$revision"
3053 linux)
3054 major=.`expr $current - $age`
3055 versuffix="$major.$age.$revision"
3058 osf)
3059 major=.`expr $current - $age`
3060 versuffix=".$current.$age.$revision"
3061 verstring="$current.$age.$revision"
3063 # Add in all the interfaces that we are compatible with.
3064 loop=$age
3065 while test "$loop" -ne 0; do
3066 iface=`expr $current - $loop`
3067 loop=`expr $loop - 1`
3068 verstring="$verstring:${iface}.0"
3069 done
3071 # Make executables depend on our current version.
3072 verstring="$verstring:${current}.0"
3075 sunos)
3076 major=".$current"
3077 versuffix=".$current.$revision"
3080 windows)
3081 # Use '-' rather than '.', since we only want one
3082 # extension on DOS 8.3 filesystems.
3083 major=`expr $current - $age`
3084 versuffix="-$major"
3088 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3089 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3090 exit 1
3092 esac
3094 # Clear the version info if we defaulted, and they specified a release.
3095 if test -z "$vinfo" && test -n "$release"; then
3096 major=
3097 case $version_type in
3098 darwin)
3099 # we can't check for "0.0" in archive_cmds due to quoting
3100 # problems, so we reset it completely
3101 verstring=
3104 verstring="0.0"
3106 esac
3107 if test "$need_version" = no; then
3108 versuffix=
3109 else
3110 versuffix=".0.0"
3114 # Remove version info from name if versioning should be avoided
3115 if test "$avoid_version" = yes && test "$need_version" = no; then
3116 major=
3117 versuffix=
3118 verstring=""
3121 # Check to see if the archive will have undefined symbols.
3122 if test "$allow_undefined" = yes; then
3123 if test "$allow_undefined_flag" = unsupported; then
3124 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3125 build_libtool_libs=no
3126 build_old_libs=yes
3128 else
3129 # Don't allow undefined symbols.
3130 allow_undefined_flag="$no_undefined_flag"
3134 if test "$mode" != relink; then
3135 # Remove our outputs, but don't remove object files since they
3136 # may have been created when compiling PIC objects.
3137 removelist=
3138 tempremovelist=`$echo "$output_objdir/*"`
3139 for p in $tempremovelist; do
3140 case $p in
3141 *.$objext | *$exeext)
3143 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3144 removelist="$removelist $p"
3146 *) ;;
3147 esac
3148 done
3149 if test -n "$removelist"; then
3150 $show "${rm}r $removelist"
3151 $run ${rm}r $removelist
3155 # Now set the variables for building old libraries.
3156 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3157 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3159 # Transform .lo files to .o files.
3160 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3163 # Eliminate all temporary directories.
3164 for path in $notinst_path; do
3165 lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3166 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3167 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3168 done
3170 if test -n "$xrpath"; then
3171 # If the user specified any rpath flags, then add them.
3172 temp_xrpath=
3173 for libdir in $xrpath; do
3174 temp_xrpath="$temp_xrpath -R$libdir"
3175 case "$finalize_rpath " in
3176 *" $libdir "*) ;;
3177 *) finalize_rpath="$finalize_rpath $libdir" ;;
3178 esac
3179 done
3180 if true || test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3181 dependency_libs="$temp_xrpath $dependency_libs"
3185 # Make sure dlfiles contains only unique files that won't be dlpreopened
3186 old_dlfiles="$dlfiles"
3187 dlfiles=
3188 for lib in $old_dlfiles; do
3189 case " $dlprefiles $dlfiles " in
3190 *" $lib "*) ;;
3191 *) dlfiles="$dlfiles $lib" ;;
3192 esac
3193 done
3195 # Make sure dlprefiles contains only unique files
3196 old_dlprefiles="$dlprefiles"
3197 dlprefiles=
3198 for lib in $old_dlprefiles; do
3199 case "$dlprefiles " in
3200 *" $lib "*) ;;
3201 *) dlprefiles="$dlprefiles $lib" ;;
3202 esac
3203 done
3205 if test "$build_libtool_libs" = yes; then
3206 if test -n "$rpath"; then
3207 case $host in
3208 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3209 # these systems don't actually have a c library (as such)!
3211 *-*-rhapsody* | *-*-darwin1.[012])
3212 # Rhapsody C library is in the System framework
3213 deplibs="$deplibs System.ltframework"
3215 *-*-netbsd*)
3216 # Don't link with libc until the a.out ld.so is fixed.
3218 *-*-openbsd* | *-*-freebsd*)
3219 # Do not include libc due to us having libc/libc_r.
3220 test "X$arg" = "X-lc" && continue
3223 # Add libc to deplibs on all other systems if necessary.
3224 if test "$build_libtool_need_lc" = "yes"; then
3225 deplibs="$deplibs -lc"
3228 esac
3231 # Transform deplibs into only deplibs that can be linked in shared.
3232 name_save=$name
3233 libname_save=$libname
3234 release_save=$release
3235 versuffix_save=$versuffix
3236 major_save=$major
3237 # I'm not sure if I'm treating the release correctly. I think
3238 # release should show up in the -l (ie -lgmp5) so we don't want to
3239 # add it in twice. Is that correct?
3240 release=""
3241 versuffix=""
3242 major=""
3243 newdeplibs=
3244 droppeddeps=no
3245 case $deplibs_check_method in
3246 pass_all)
3247 # Don't check for shared/static. Everything works.
3248 # This might be a little naive. We might want to check
3249 # whether the library exists or not. But this is on
3250 # osf3 & osf4 and I'm not really sure... Just
3251 # implementing what was already the behavior.
3252 newdeplibs=$deplibs
3254 test_compile)
3255 # This code stresses the "libraries are programs" paradigm to its
3256 # limits. Maybe even breaks it. We compile a program, linking it
3257 # against the deplibs as a proxy for the library. Then we can check
3258 # whether they linked in statically or dynamically with ldd.
3259 $rm conftest.c
3260 cat > conftest.c <<EOF
3261 int main() { return 0; }
3263 $rm conftest
3264 $LTCC -o conftest conftest.c $deplibs
3265 if test "$?" -eq 0 ; then
3266 ldd_output=`ldd conftest`
3267 for i in $deplibs; do
3268 name="`expr $i : '-l\(.*\)'`"
3269 # If $name is empty we are operating on a -L argument.
3270 if test "$name" != "" && test "$name" -ne "0"; then
3271 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3272 case " $predeps $postdeps " in
3273 *" $i "*)
3274 newdeplibs="$newdeplibs $i"
3275 i=""
3277 esac
3279 if test -n "$i" ; then
3280 libname=`eval \\$echo \"$libname_spec\"`
3281 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3282 set dummy $deplib_matches
3283 deplib_match=$2
3284 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3285 newdeplibs="$newdeplibs $i"
3286 else
3287 droppeddeps=yes
3288 $echo
3289 $echo "*** Warning: dynamic linker does not accept needed library $i."
3290 $echo "*** I have the capability to make that library automatically link in when"
3291 $echo "*** you link to this library. But I can only do this if you have a"
3292 $echo "*** shared version of the library, which I believe you do not have"
3293 $echo "*** because a test_compile did reveal that the linker did not use it for"
3294 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3297 else
3298 newdeplibs="$newdeplibs $i"
3300 done
3301 else
3302 # Error occurred in the first compile. Let's try to salvage
3303 # the situation: Compile a separate program for each library.
3304 for i in $deplibs; do
3305 name="`expr $i : '-l\(.*\)'`"
3306 # If $name is empty we are operating on a -L argument.
3307 if test "$name" != "" && test "$name" != "0"; then
3308 $rm conftest
3309 $LTCC -o conftest conftest.c $i
3310 # Did it work?
3311 if test "$?" -eq 0 ; then
3312 ldd_output=`ldd conftest`
3313 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3314 case " $predeps $postdeps " in
3315 *" $i "*)
3316 newdeplibs="$newdeplibs $i"
3317 i=""
3319 esac
3321 if test -n "$i" ; then
3322 libname=`eval \\$echo \"$libname_spec\"`
3323 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3324 set dummy $deplib_matches
3325 deplib_match=$2
3326 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3327 newdeplibs="$newdeplibs $i"
3328 else
3329 droppeddeps=yes
3330 $echo
3331 $echo "*** Warning: dynamic linker does not accept needed library $i."
3332 $echo "*** I have the capability to make that library automatically link in when"
3333 $echo "*** you link to this library. But I can only do this if you have a"
3334 $echo "*** shared version of the library, which you do not appear to have"
3335 $echo "*** because a test_compile did reveal that the linker did not use this one"
3336 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3339 else
3340 droppeddeps=yes
3341 $echo
3342 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3343 $echo "*** make it link in! You will probably need to install it or some"
3344 $echo "*** library that it depends on before this library will be fully"
3345 $echo "*** functional. Installing it before continuing would be even better."
3347 else
3348 newdeplibs="$newdeplibs $i"
3350 done
3353 file_magic*)
3354 set dummy $deplibs_check_method
3355 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3356 for a_deplib in $deplibs; do
3357 name="`expr $a_deplib : '-l\(.*\)'`"
3358 # If $name is empty we are operating on a -L argument.
3359 if test "$name" != "" && test "$name" != "0"; then
3360 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3361 case " $predeps $postdeps " in
3362 *" $a_deplib "*)
3363 newdeplibs="$newdeplibs $a_deplib"
3364 a_deplib=""
3366 esac
3368 if test -n "$a_deplib" ; then
3369 libname=`eval \\$echo \"$libname_spec\"`
3370 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3371 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3372 for potent_lib in $potential_libs; do
3373 # Follow soft links.
3374 if ls -lLd "$potent_lib" 2>/dev/null \
3375 | grep " -> " >/dev/null; then
3376 continue
3378 # The statement above tries to avoid entering an
3379 # endless loop below, in case of cyclic links.
3380 # We might still enter an endless loop, since a link
3381 # loop can be closed while we follow links,
3382 # but so what?
3383 potlib="$potent_lib"
3384 while test -h "$potlib" 2>/dev/null; do
3385 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3386 case $potliblink in
3387 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3388 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3389 esac
3390 done
3391 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3392 | ${SED} 10q \
3393 | $EGREP "$file_magic_regex" > /dev/null; then
3394 newdeplibs="$newdeplibs $a_deplib"
3395 a_deplib=""
3396 break 2
3398 done
3399 done
3401 if test -n "$a_deplib" ; then
3402 droppeddeps=yes
3403 $echo
3404 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3405 $echo "*** I have the capability to make that library automatically link in when"
3406 $echo "*** you link to this library. But I can only do this if you have a"
3407 $echo "*** shared version of the library, which you do not appear to have"
3408 $echo "*** because I did check the linker path looking for a file starting"
3409 if test -z "$potlib" ; then
3410 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3411 else
3412 $echo "*** with $libname and none of the candidates passed a file format test"
3413 $echo "*** using a file magic. Last file checked: $potlib"
3416 else
3417 # Add a -L argument.
3418 newdeplibs="$newdeplibs $a_deplib"
3420 done # Gone through all deplibs.
3422 match_pattern*)
3423 set dummy $deplibs_check_method
3424 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3425 for a_deplib in $deplibs; do
3426 name="`expr $a_deplib : '-l\(.*\)'`"
3427 # If $name is empty we are operating on a -L argument.
3428 if test -n "$name" && test "$name" != "0"; then
3429 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3430 case " $predeps $postdeps " in
3431 *" $a_deplib "*)
3432 newdeplibs="$newdeplibs $a_deplib"
3433 a_deplib=""
3435 esac
3437 if test -n "$a_deplib" ; then
3438 libname=`eval \\$echo \"$libname_spec\"`
3439 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3440 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3441 for potent_lib in $potential_libs; do
3442 potlib="$potent_lib" # see symlink-check above in file_magic test
3443 if eval $echo \"$potent_lib\" 2>/dev/null \
3444 | ${SED} 10q \
3445 | $EGREP "$match_pattern_regex" > /dev/null; then
3446 newdeplibs="$newdeplibs $a_deplib"
3447 a_deplib=""
3448 break 2
3450 done
3451 done
3453 if test -n "$a_deplib" ; then
3454 droppeddeps=yes
3455 $echo
3456 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3457 $echo "*** I have the capability to make that library automatically link in when"
3458 $echo "*** you link to this library. But I can only do this if you have a"
3459 $echo "*** shared version of the library, which you do not appear to have"
3460 $echo "*** because I did check the linker path looking for a file starting"
3461 if test -z "$potlib" ; then
3462 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3463 else
3464 $echo "*** with $libname and none of the candidates passed a file format test"
3465 $echo "*** using a regex pattern. Last file checked: $potlib"
3468 else
3469 # Add a -L argument.
3470 newdeplibs="$newdeplibs $a_deplib"
3472 done # Gone through all deplibs.
3474 none | unknown | *)
3475 newdeplibs=""
3476 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3477 -e 's/ -[LR][^ ]*//g'`
3478 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3479 for i in $predeps $postdeps ; do
3480 # can't use Xsed below, because $i might contain '/'
3481 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3482 done
3484 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3485 | grep . >/dev/null; then
3486 $echo
3487 if test "X$deplibs_check_method" = "Xnone"; then
3488 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3489 else
3490 $echo "*** Warning: inter-library dependencies are not known to be supported."
3492 $echo "*** All declared inter-library dependencies are being dropped."
3493 droppeddeps=yes
3496 esac
3497 versuffix=$versuffix_save
3498 major=$major_save
3499 release=$release_save
3500 libname=$libname_save
3501 name=$name_save
3503 case $host in
3504 *-*-rhapsody* | *-*-darwin1.[012])
3505 # On Rhapsody replace the C library is the System framework
3506 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
3508 esac
3510 if test "$droppeddeps" = yes; then
3511 if test "$module" = yes; then
3512 $echo
3513 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3514 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3515 $echo "*** a static module, that should work as long as the dlopening"
3516 $echo "*** application is linked with the -dlopen flag."
3517 if test -z "$global_symbol_pipe"; then
3518 $echo
3519 $echo "*** However, this would only work if libtool was able to extract symbol"
3520 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3521 $echo "*** not find such a program. So, this module is probably useless."
3522 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3524 if test "$build_old_libs" = no; then
3525 oldlibs="$output_objdir/$libname.$libext"
3526 build_libtool_libs=module
3527 build_old_libs=yes
3528 else
3529 build_libtool_libs=no
3531 else
3532 $echo "*** The inter-library dependencies that have been dropped here will be"
3533 $echo "*** automatically added whenever a program is linked with this library"
3534 $echo "*** or is declared to -dlopen it."
3536 if test "$allow_undefined" = no; then
3537 $echo
3538 $echo "*** Since this library must not contain undefined symbols,"
3539 $echo "*** because either the platform does not support them or"
3540 $echo "*** it was explicitly requested with -no-undefined,"
3541 $echo "*** libtool will only create a static version of it."
3542 if test "$build_old_libs" = no; then
3543 oldlibs="$output_objdir/$libname.$libext"
3544 build_libtool_libs=module
3545 build_old_libs=yes
3546 else
3547 build_libtool_libs=no
3552 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
3553 case $host in
3554 *-*-darwin*)
3555 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
3556 dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
3558 esac
3559 # Done checking deplibs!
3560 deplibs=$newdeplibs
3563 # All the library-specific variables (install_libdir is set above).
3564 library_names=
3565 old_library=
3566 dlname=
3568 # Test again, we may have decided not to build it any more
3569 if test "$build_libtool_libs" = yes; then
3570 if test "$hardcode_into_libs" = yes; then
3571 # Hardcode the library paths
3572 hardcode_libdirs=
3573 dep_rpath=
3574 rpath="$finalize_rpath"
3575 test "$mode" != relink && test "$fast_install" = no && rpath="$compile_rpath$rpath"
3576 for libdir in $rpath; do
3577 if test -n "$hardcode_libdir_flag_spec"; then
3578 if test -n "$hardcode_libdir_separator"; then
3579 if test -z "$hardcode_libdirs"; then
3580 hardcode_libdirs="$libdir"
3581 else
3582 # Just accumulate the unique libdirs.
3583 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3584 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3587 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3589 esac
3591 else
3592 eval flag=\"$hardcode_libdir_flag_spec\"
3593 dep_rpath="$dep_rpath $flag"
3595 elif test -n "$runpath_var"; then
3596 case "$perm_rpath " in
3597 *" $libdir "*) ;;
3598 *) perm_rpath="$perm_rpath $libdir" ;;
3599 esac
3601 done
3602 # Substitute the hardcoded libdirs into the rpath.
3603 if test -n "$hardcode_libdir_separator" &&
3604 test -n "$hardcode_libdirs"; then
3605 libdir="$hardcode_libdirs"
3606 if test -n "$hardcode_libdir_flag_spec_ld"; then
3607 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3608 else
3609 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3612 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3613 # We should set the runpath_var.
3614 rpath=
3615 for dir in $perm_rpath; do
3616 rpath="$rpath$dir:"
3617 done
3618 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3620 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3623 shlibpath="$finalize_shlibpath"
3624 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3625 if test -n "$shlibpath"; then
3626 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3629 # Get the real and link names of the library.
3630 eval shared_ext=\"$shrext\"
3631 eval library_names=\"$library_names_spec\"
3632 set dummy $library_names
3633 realname="$2"
3634 shift; shift
3636 if test -n "$soname_spec"; then
3637 eval soname=\"$soname_spec\"
3638 else
3639 soname="$realname"
3641 if test -z "$dlname"; then
3642 dlname=$soname
3645 lib="$output_objdir/$realname"
3646 for link
3648 linknames="$linknames $link"
3649 done
3651 # Use standard objects if they are pic
3652 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3654 # Prepare the list of exported symbols
3655 if test -z "$export_symbols"; then
3656 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3657 $show "generating symbol list for \`$libname.la'"
3658 export_symbols="$output_objdir/$libname.exp"
3659 $run $rm $export_symbols
3660 eval cmds=\"$export_symbols_cmds\"
3661 save_ifs="$IFS"; IFS='~'
3662 for cmd in $cmds; do
3663 IFS="$save_ifs"
3664 if len=`expr "X$cmd" : ".*"` &&
3665 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3666 $show "$cmd"
3667 $run eval "$cmd" || exit $?
3668 skipped_export=false
3669 else
3670 # The command line is too long to execute in one step.
3671 $show "using reloadable object file for export list..."
3672 skipped_export=:
3674 done
3675 IFS="$save_ifs"
3676 if test -n "$export_symbols_regex"; then
3677 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3678 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3679 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3680 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3685 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3686 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3689 tmp_deplibs=
3690 for test_deplib in $deplibs; do
3691 case " $convenience " in
3692 *" $test_deplib "*) ;;
3694 tmp_deplibs="$tmp_deplibs $test_deplib"
3696 esac
3697 done
3698 deplibs="$tmp_deplibs"
3700 if test -n "$convenience"; then
3701 if test -n "$whole_archive_flag_spec"; then
3702 save_libobjs=$libobjs
3703 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3704 else
3705 gentop="$output_objdir/${outputname}x"
3706 $show "${rm}r $gentop"
3707 $run ${rm}r "$gentop"
3708 $show "$mkdir $gentop"
3709 $run $mkdir "$gentop"
3710 status=$?
3711 if test "$status" -ne 0 && test ! -d "$gentop"; then
3712 exit $status
3714 generated="$generated $gentop"
3716 for xlib in $convenience; do
3717 # Extract the objects.
3718 case $xlib in
3719 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3720 *) xabs=`pwd`"/$xlib" ;;
3721 esac
3722 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3723 xdir="$gentop/$xlib"
3725 $show "${rm}r $xdir"
3726 $run ${rm}r "$xdir"
3727 $show "$mkdir $xdir"
3728 $run $mkdir "$xdir"
3729 status=$?
3730 if test "$status" -ne 0 && test ! -d "$xdir"; then
3731 exit $status
3733 # We will extract separately just the conflicting names and we will no
3734 # longer touch any unique names. It is faster to leave these extract
3735 # automatically by $AR in one run.
3736 $show "(cd $xdir && $AR x $xabs)"
3737 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3738 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3740 else
3741 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3742 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3743 $AR t "$xabs" | sort | uniq -cd | while read -r count name
3746 while test "$i" -le "$count"
3748 # Put our $i before any first dot (extension)
3749 # Never overwrite any file
3750 name_to="$name"
3751 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3753 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3754 done
3755 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3756 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3757 i=`expr $i + 1`
3758 done
3759 done
3762 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3763 done
3767 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3768 eval flag=\"$thread_safe_flag_spec\"
3769 linker_flags="$linker_flags $flag"
3772 # Make a backup of the uninstalled library when relinking
3773 if test "$mode" = relink; then
3774 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3777 # Add all flags from the command line. We here create a library,
3778 # but those flags were only added to compile_command and
3779 # finalize_command, which are only used when creating executables.
3780 # So do it by hand here.
3781 compiler_flags="$compiler_flags $add_flags"
3782 # Only add it to commands which use CC, instead of LD, i.e.
3783 # only to $compiler_flags
3784 #linker_flags="$linker_flags $add_flags"
3786 # Do each of the archive commands.
3787 if test "$module" = yes && test -n "$module_cmds" ; then
3788 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3789 eval cmds=\"$module_expsym_cmds\"
3790 else
3791 eval cmds=\"$module_cmds\"
3793 else
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\"
3801 if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
3802 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3804 else
3805 # The command line is too long to link in one step, link piecewise.
3806 $echo "creating reloadable object files..."
3808 # Save the value of $output and $libobjs because we want to
3809 # use them later. If we have whole_archive_flag_spec, we
3810 # want to use save_libobjs as it was before
3811 # whole_archive_flag_spec was expanded, because we can't
3812 # assume the linker understands whole_archive_flag_spec.
3813 # This may have to be revisited, in case too many
3814 # convenience libraries get linked in and end up exceeding
3815 # the spec.
3816 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3817 save_libobjs=$libobjs
3819 save_output=$output
3821 # Clear the reloadable object creation command queue and
3822 # initialize k to one.
3823 test_cmds=
3824 concat_cmds=
3825 objlist=
3826 delfiles=
3827 last_robj=
3829 output=$output_objdir/$save_output-${k}.$objext
3830 # Loop over the list of objects to be linked.
3831 for obj in $save_libobjs
3833 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3834 if test "X$objlist" = X ||
3835 { len=`expr "X$test_cmds" : ".*"` &&
3836 test "$len" -le "$max_cmd_len"; }; then
3837 objlist="$objlist $obj"
3838 else
3839 # The command $test_cmds is almost too long, add a
3840 # command to the queue.
3841 if test "$k" -eq 1 ; then
3842 # The first file doesn't have a previous command to add.
3843 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3844 else
3845 # All subsequent reloadable object files will link in
3846 # the last one created.
3847 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3849 last_robj=$output_objdir/$save_output-${k}.$objext
3850 k=`expr $k + 1`
3851 output=$output_objdir/$save_output-${k}.$objext
3852 objlist=$obj
3853 len=1
3855 done
3856 # Handle the remaining objects by creating one last
3857 # reloadable object file. All subsequent reloadable object
3858 # files will link in the last one created.
3859 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3860 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3862 if ${skipped_export-false}; then
3863 $show "generating symbol list for \`$libname.la'"
3864 export_symbols="$output_objdir/$libname.exp"
3865 $run $rm $export_symbols
3866 libobjs=$output
3867 # Append the command to create the export file.
3868 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3871 # Set up a command to remove the reloadale object files
3872 # after they are used.
3874 while test "$i" -lt "$k"
3876 i=`expr $i + 1`
3877 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3878 done
3880 $echo "creating a temporary reloadable object file: $output"
3882 # Loop through the commands generated above and execute them.
3883 save_ifs="$IFS"; IFS='~'
3884 for cmd in $concat_cmds; do
3885 IFS="$save_ifs"
3886 $show "$cmd"
3887 $run eval "$cmd" || exit $?
3888 done
3889 IFS="$save_ifs"
3891 libobjs=$output
3892 # Restore the value of output.
3893 output=$save_output
3895 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3896 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3898 # Expand the library linking commands again to reset the
3899 # value of $libobjs for piecewise linking.
3901 # Do each of the archive commands.
3902 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3903 eval cmds=\"$archive_expsym_cmds\"
3904 else
3905 eval cmds=\"$archive_cmds\"
3908 # Append the command to remove the reloadable object files
3909 # to the just-reset $cmds.
3910 eval cmds=\"\$cmds~$rm $delfiles\"
3912 save_ifs="$IFS"; IFS='~'
3913 for cmd in $cmds; do
3914 IFS="$save_ifs"
3915 $show "$cmd"
3916 $run eval "$cmd" || exit $?
3917 done
3918 IFS="$save_ifs"
3920 # Restore the uninstalled library and exit
3921 if test "$mode" = relink; then
3922 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3923 exit 0
3926 # Create links to the real library.
3927 for linkname in $linknames; do
3928 if test "$realname" != "$linkname"; then
3929 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3930 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3932 done
3934 # If -module or -export-dynamic was specified, set the dlname.
3935 if test "$module" = yes || test "$export_dynamic" = yes; then
3936 # On all known operating systems, these are identical.
3937 dlname="$soname"
3942 obj)
3943 if test -n "$deplibs"; then
3944 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3947 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3948 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3951 if test -n "$rpath"; then
3952 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3955 if test -n "$xrpath"; then
3956 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3959 if test -n "$vinfo"; then
3960 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3963 if test -n "$release"; then
3964 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3967 case $output in
3968 *.lo)
3969 if test -n "$objs$old_deplibs"; then
3970 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3971 exit 1
3973 libobj="$output"
3974 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3977 libobj=
3978 obj="$output"
3980 esac
3982 # Delete the old objects.
3983 $run $rm $obj $libobj
3985 # Objects from convenience libraries. This assumes
3986 # single-version convenience libraries. Whenever we create
3987 # different ones for PIC/non-PIC, this we'll have to duplicate
3988 # the extraction.
3989 reload_conv_objs=
3990 gentop=
3991 # reload_cmds runs $LD directly, so let us get rid of
3992 # -Wl from whole_archive_flag_spec
3995 if test -n "$convenience"; then
3996 if test -n "$whole_archive_flag_spec"; then
3997 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3998 else
3999 gentop="$output_objdir/${obj}x"
4000 $show "${rm}r $gentop"
4001 $run ${rm}r "$gentop"
4002 $show "$mkdir $gentop"
4003 $run $mkdir "$gentop"
4004 status=$?
4005 if test "$status" -ne 0 && test ! -d "$gentop"; then
4006 exit $status
4008 generated="$generated $gentop"
4010 for xlib in $convenience; do
4011 # Extract the objects.
4012 case $xlib in
4013 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4014 *) xabs=`pwd`"/$xlib" ;;
4015 esac
4016 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4017 xdir="$gentop/$xlib"
4019 $show "${rm}r $xdir"
4020 $run ${rm}r "$xdir"
4021 $show "$mkdir $xdir"
4022 $run $mkdir "$xdir"
4023 status=$?
4024 if test "$status" -ne 0 && test ! -d "$xdir"; then
4025 exit $status
4027 # We will extract separately just the conflicting names and we will no
4028 # longer touch any unique names. It is faster to leave these extract
4029 # automatically by $AR in one run.
4030 $show "(cd $xdir && $AR x $xabs)"
4031 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4032 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4034 else
4035 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4036 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4037 $AR t "$xabs" | sort | uniq -cd | while read -r count name
4040 while test "$i" -le "$count"
4042 # Put our $i before any first dot (extension)
4043 # Never overwrite any file
4044 name_to="$name"
4045 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4047 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4048 done
4049 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4050 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4051 i=`expr $i + 1`
4052 done
4053 done
4056 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4057 done
4061 # Create the old-style object.
4062 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
4064 output="$obj"
4065 eval cmds=\"$reload_cmds\"
4066 save_ifs="$IFS"; IFS='~'
4067 for cmd in $cmds; do
4068 IFS="$save_ifs"
4069 $show "$cmd"
4070 $run eval "$cmd" || exit $?
4071 done
4072 IFS="$save_ifs"
4074 # Exit if we aren't doing a library object file.
4075 if test -z "$libobj"; then
4076 if test -n "$gentop"; then
4077 $show "${rm}r $gentop"
4078 $run ${rm}r $gentop
4081 exit 0
4084 if test "$build_libtool_libs" != yes; then
4085 if test -n "$gentop"; then
4086 $show "${rm}r $gentop"
4087 $run ${rm}r $gentop
4090 # Create an invalid libtool object if no PIC, so that we don't
4091 # accidentally link it into a program.
4092 # $show "echo timestamp > $libobj"
4093 # $run eval "echo timestamp > $libobj" || exit $?
4094 exit 0
4097 if test -n "$pic_flag" || test "$pic_mode" != default; then
4098 # Only do commands if we really have different PIC objects.
4099 reload_objs="$libobjs $reload_conv_objs"
4100 output="$libobj"
4101 eval cmds=\"$reload_cmds\"
4102 save_ifs="$IFS"; IFS='~'
4103 for cmd in $cmds; do
4104 IFS="$save_ifs"
4105 $show "$cmd"
4106 $run eval "$cmd" || exit $?
4107 done
4108 IFS="$save_ifs"
4111 if test -n "$gentop"; then
4112 $show "${rm}r $gentop"
4113 $run ${rm}r $gentop
4116 exit 0
4119 prog)
4120 case $host in
4121 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4122 esac
4123 if test -n "$vinfo"; then
4124 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4127 if test -n "$release"; then
4128 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4131 if test "$preload" = yes; then
4132 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4133 test "$dlopen_self_static" = unknown; then
4134 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4138 case $host in
4139 *-*-rhapsody* | *-*-darwin1.[012])
4140 # On Rhapsody replace the C library is the System framework
4141 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
4142 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
4144 esac
4146 case $host in
4147 *-*-darwin*)
4148 # Don't allow lazy linking, it breaks C++ global constructors
4149 if test "$tagname" = CXX ; then
4150 compile_command="$compile_command ${wl}-bind_at_load"
4151 finalize_command="$finalize_command ${wl}-bind_at_load"
4153 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
4154 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
4155 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
4157 esac
4159 compile_command="$compile_command $compile_deplibs"
4160 finalize_command="$finalize_command $finalize_deplibs"
4162 if test -n "$rpath$xrpath"; then
4163 # If the user specified any rpath flags, then add them.
4164 for libdir in $rpath $xrpath; do
4165 # This is the magic to use -rpath.
4166 case "$finalize_rpath " in
4167 *" $libdir "*) ;;
4168 *) finalize_rpath="$finalize_rpath $libdir" ;;
4169 esac
4170 done
4173 # Now hardcode the library paths
4174 rpath=
4175 hardcode_libdirs=
4176 for libdir in $compile_rpath $finalize_rpath; do
4177 if test -n "$hardcode_libdir_flag_spec"; then
4178 if test -n "$hardcode_libdir_separator"; then
4179 if test -z "$hardcode_libdirs"; then
4180 hardcode_libdirs="$libdir"
4181 else
4182 # Just accumulate the unique libdirs.
4183 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4184 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4187 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4189 esac
4191 else
4192 eval flag=\"$hardcode_libdir_flag_spec\"
4193 rpath="$rpath $flag"
4195 elif test -n "$runpath_var"; then
4196 case "$perm_rpath " in
4197 *" $libdir "*) ;;
4198 *) perm_rpath="$perm_rpath $libdir" ;;
4199 esac
4201 case $host in
4202 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4203 case :$dllsearchpath: in
4204 *":$libdir:"*) ;;
4205 *) dllsearchpath="$dllsearchpath:$libdir";;
4206 esac
4208 esac
4209 done
4210 # Substitute the hardcoded libdirs into the rpath.
4211 if test -n "$hardcode_libdir_separator" &&
4212 test -n "$hardcode_libdirs"; then
4213 libdir="$hardcode_libdirs"
4214 eval rpath=\" $hardcode_libdir_flag_spec\"
4216 compile_rpath="$rpath"
4218 rpath=
4219 hardcode_libdirs=
4220 for libdir in $finalize_rpath; do
4221 if test -n "$hardcode_libdir_flag_spec"; then
4222 if test -n "$hardcode_libdir_separator"; then
4223 if test -z "$hardcode_libdirs"; then
4224 hardcode_libdirs="$libdir"
4225 else
4226 # Just accumulate the unique libdirs.
4227 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4228 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4231 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4233 esac
4235 else
4236 eval flag=\"$hardcode_libdir_flag_spec\"
4237 rpath="$rpath $flag"
4239 elif test -n "$runpath_var"; then
4240 case "$finalize_perm_rpath " in
4241 *" $libdir "*) ;;
4242 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4243 esac
4245 done
4246 # Substitute the hardcoded libdirs into the rpath.
4247 if test -n "$hardcode_libdir_separator" &&
4248 test -n "$hardcode_libdirs"; then
4249 libdir="$hardcode_libdirs"
4250 eval rpath=\" $hardcode_libdir_flag_spec\"
4252 finalize_rpath="$rpath"
4254 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4255 # Transform all the library objects into standard objects.
4256 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4257 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4260 dlsyms=
4261 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4262 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4263 dlsyms="${outputname}S.c"
4264 else
4265 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4269 if test -n "$dlsyms"; then
4270 case $dlsyms in
4271 "") ;;
4272 *.c)
4273 # Discover the nlist of each of the dlfiles.
4274 nlist="$output_objdir/${outputname}.nm"
4276 $show "$rm $nlist ${nlist}S ${nlist}T"
4277 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4279 # Parse the name list into a source file.
4280 $show "creating $output_objdir/$dlsyms"
4282 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4283 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4284 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4286 #ifdef __cplusplus
4287 extern \"C\" {
4288 #endif
4290 /* Prevent the only kind of declaration conflicts we can make. */
4291 #define lt_preloaded_symbols some_other_symbol
4293 /* External symbol declarations for the compiler. */\
4296 if test "$dlself" = yes; then
4297 $show "generating symbol list for \`$output'"
4299 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4301 # Add our own program objects to the symbol list.
4302 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4303 for arg in $progfiles; do
4304 $show "extracting global C symbols from \`$arg'"
4305 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4306 done
4308 if test -n "$exclude_expsyms"; then
4309 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4310 $run eval '$mv "$nlist"T "$nlist"'
4313 if test -n "$export_symbols_regex"; then
4314 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4315 $run eval '$mv "$nlist"T "$nlist"'
4318 # Prepare the list of exported symbols
4319 if test -z "$export_symbols"; then
4320 export_symbols="$output_objdir/$output.exp"
4321 $run $rm $export_symbols
4322 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4323 else
4324 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4325 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4326 $run eval 'mv "$nlist"T "$nlist"'
4330 for arg in $dlprefiles; do
4331 $show "extracting global C symbols from \`$arg'"
4332 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4333 $run eval '$echo ": $name " >> "$nlist"'
4334 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4335 done
4337 if test -z "$run"; then
4338 # Make sure we have at least an empty file.
4339 test -f "$nlist" || : > "$nlist"
4341 if test -n "$exclude_expsyms"; then
4342 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4343 $mv "$nlist"T "$nlist"
4346 # Try sorting and uniquifying the output.
4347 if grep -v "^: " < "$nlist" |
4348 if sort -k 3 </dev/null >/dev/null 2>&1; then
4349 sort -k 3
4350 else
4351 sort +2
4352 fi |
4353 uniq > "$nlist"S; then
4355 else
4356 grep -v "^: " < "$nlist" > "$nlist"S
4359 if test -f "$nlist"S; then
4360 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4361 else
4362 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4365 $echo >> "$output_objdir/$dlsyms" "\
4367 #undef lt_preloaded_symbols
4369 #if defined (__STDC__) && __STDC__
4370 # define lt_ptr void *
4371 #else
4372 # define lt_ptr char *
4373 # define const
4374 #endif
4376 /* The mapping between symbol names and symbols. */
4377 const struct {
4378 const char *name;
4379 lt_ptr address;
4381 lt_preloaded_symbols[] =
4385 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4387 $echo >> "$output_objdir/$dlsyms" "\
4388 {0, (lt_ptr) 0}
4391 /* This works around a problem in FreeBSD linker */
4392 #ifdef FREEBSD_WORKAROUND
4393 static const void *lt_preloaded_setup() {
4394 return lt_preloaded_symbols;
4396 #endif
4398 #ifdef __cplusplus
4400 #endif\
4404 pic_flag_for_symtable=
4405 case $host in
4406 # compiling the symbol table file with pic_flag works around
4407 # a FreeBSD bug that causes programs to crash when -lm is
4408 # linked before any other PIC object. But we must not use
4409 # pic_flag when linking with -static. The problem exists in
4410 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4411 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4412 case "$compile_command " in
4413 *" -static "*) ;;
4414 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4415 esac;;
4416 *-*-hpux*)
4417 case "$compile_command " in
4418 *" -static "*) ;;
4419 *) pic_flag_for_symtable=" $pic_flag";;
4420 esac
4421 esac
4423 # Now compile the dynamic symbol file.
4424 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4425 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4427 # Clean up the generated files.
4428 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4429 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4431 # Transform the symbol file into the correct name.
4432 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4433 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4436 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4437 exit 1
4439 esac
4440 else
4441 # We keep going just in case the user didn't refer to
4442 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4443 # really was required.
4445 # Nullify the symbol file.
4446 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4447 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4450 # AIX runtime linking requires linking programs with -Wl,-brtl and libs with -Wl,-G
4451 # Also add -bnolibpath to the beginning of the link line, to clear the hardcoded runpath.
4452 # Otherwise, things like the -L path to libgcc.a are accidentally hardcoded by ld.
4453 # This does not apply on AIX for ia64, which uses a SysV linker.
4454 case "$host" in
4455 ia64-*-aix5*) ;;
4456 *-*-aix4* | *-*-aix5*)
4457 compile_command=`$echo "X$compile_command $wl-brtl" | $Xsed -e "s/\$CC/\$CC $wl-bnolibpath/1"`
4458 finalize_command=`$echo "X$finalize_command $wl-brtl" | $Xsed -e "s/\$CC/\$CC $wl-bnolibpath/1"` ;;
4459 esac
4461 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4462 # Replace the output file specification.
4463 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4464 link_command="$compile_command$compile_rpath"
4466 # We have no uninstalled library dependencies, so finalize right now.
4467 $show "$link_command"
4468 $run eval "$link_command"
4469 status=$?
4471 # Delete the generated files.
4472 if test -n "$dlsyms"; then
4473 $show "$rm $output_objdir/${outputname}S.${objext}"
4474 $run $rm "$output_objdir/${outputname}S.${objext}"
4477 exit $status
4480 if test -n "$shlibpath_var"; then
4481 # We should set the shlibpath_var
4482 rpath=
4483 for dir in $temp_rpath; do
4484 case $dir in
4485 [\\/]* | [A-Za-z]:[\\/]*)
4486 # Absolute path.
4487 rpath="$rpath$dir:"
4490 # Relative path: add a thisdir entry.
4491 rpath="$rpath\$thisdir/$dir:"
4493 esac
4494 done
4495 temp_rpath="$rpath"
4498 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4499 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4501 if test -n "$finalize_shlibpath"; then
4502 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4505 compile_var=
4506 finalize_var=
4507 if test -n "$runpath_var"; then
4508 if test -n "$perm_rpath"; then
4509 # We should set the runpath_var.
4510 rpath=
4511 for dir in $perm_rpath; do
4512 rpath="$rpath$dir:"
4513 done
4514 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4516 if test -n "$finalize_perm_rpath"; then
4517 # We should set the runpath_var.
4518 rpath=
4519 for dir in $finalize_perm_rpath; do
4520 rpath="$rpath$dir:"
4521 done
4522 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4526 if test "$no_install" = yes; then
4527 # We don't need to create a wrapper script.
4528 link_command="$compile_var$compile_command$compile_rpath"
4529 # Replace the output file specification.
4530 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4531 # Delete the old output file.
4532 $run $rm $output
4533 # Link the executable and exit
4534 $show "$link_command"
4535 $run eval "$link_command" || exit $?
4536 exit 0
4539 if test "$hardcode_action" = relink; then
4540 # Fast installation is not supported
4541 link_command="$compile_var$compile_command$compile_rpath"
4542 relink_command="$finalize_var$finalize_command$finalize_rpath"
4544 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4545 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4546 else
4547 if test "$fast_install" != no; then
4548 link_command="$finalize_var$compile_command$finalize_rpath"
4549 if test "$fast_install" = yes; then
4550 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4551 else
4552 # fast_install is set to needless
4553 relink_command=
4555 else
4556 link_command="$compile_var$compile_command$compile_rpath"
4557 relink_command="$finalize_var$finalize_command$finalize_rpath"
4561 # Replace the output file specification.
4562 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4564 # Delete the old output files.
4565 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4567 $show "$link_command"
4568 $run eval "$link_command" || exit $?
4570 # Now create the wrapper script.
4571 $show "creating $output"
4573 # Quote the relink command for shipping.
4574 if test -n "$relink_command"; then
4575 # Preserve any variables that may affect compiler behavior
4576 for var in $variables_saved_for_relink; do
4577 if eval test -z \"\${$var+set}\"; then
4578 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4579 elif eval var_value=\$$var; test -z "$var_value"; then
4580 relink_command="$var=; export $var; $relink_command"
4581 else
4582 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4583 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4585 done
4586 relink_command="(cd `pwd`; $relink_command)"
4587 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4590 # Quote $echo for shipping.
4591 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4592 case $0 in
4593 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4594 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4595 esac
4596 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4597 else
4598 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4601 # Only actually do things if our run command is non-null.
4602 if test -z "$run"; then
4603 # win32 will think the script is a binary if it has
4604 # a .exe suffix, so we strip it off here.
4605 case $output in
4606 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4607 esac
4608 # test for cygwin because mv fails w/o .exe extensions
4609 case $host in
4610 *cygwin*)
4611 exeext=.exe
4612 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4613 *) exeext= ;;
4614 esac
4615 case $host in
4616 *mingw* )
4617 cwrappersource=`$echo ${output_objdir}/lt-${outputname}.c`
4618 cwrapper=`$echo ${output}.exe`
4619 $rm $cwrappersource $cwrapper
4620 trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
4622 cat > $cwrappersource <<EOF
4624 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4625 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4627 The $output program cannot be directly executed until all the libtool
4628 libraries that it depends on are installed.
4630 This wrapper executable should never be moved out of the build directory.
4631 If it is, it will not operate correctly.
4633 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4634 but could eventually absorb all of the scripts functionality and
4635 exec $objdir/$outputname directly.
4638 cat >> $cwrappersource<<"EOF"
4639 #include <stdio.h>
4640 #include <stdlib.h>
4641 #include <unistd.h>
4642 #include <malloc.h>
4643 #include <stdarg.h>
4644 #include <assert.h>
4646 #if defined(PATH_MAX)
4647 # define LT_PATHMAX PATH_MAX
4648 #elif defined(MAXPATHLEN)
4649 # define LT_PATHMAX MAXPATHLEN
4650 #else
4651 # define LT_PATHMAX 1024
4652 #endif
4654 #ifndef DIR_SEPARATOR
4655 #define DIR_SEPARATOR '/'
4656 #endif
4658 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4659 defined (__OS2__)
4660 #define HAVE_DOS_BASED_FILE_SYSTEM
4661 #ifndef DIR_SEPARATOR_2
4662 #define DIR_SEPARATOR_2 '\\'
4663 #endif
4664 #endif
4666 #ifndef DIR_SEPARATOR_2
4667 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4668 #else /* DIR_SEPARATOR_2 */
4669 # define IS_DIR_SEPARATOR(ch) \
4670 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4671 #endif /* DIR_SEPARATOR_2 */
4673 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4674 #define XFREE(stale) do { \
4675 if (stale) { free ((void *) stale); stale = 0; } \
4676 } while (0)
4678 const char *program_name = NULL;
4680 void * xmalloc (size_t num);
4681 char * xstrdup (const char *string);
4682 char * basename (const char *name);
4683 char * fnqualify(const char *path);
4684 char * strendzap(char *str, const char *pat);
4685 void lt_fatal (const char *message, ...);
4688 main (int argc, char *argv[])
4690 char **newargz;
4691 int i;
4693 program_name = (char *) xstrdup ((char *) basename (argv[0]));
4694 newargz = XMALLOC(char *, argc+2);
4697 cat >> $cwrappersource <<EOF
4698 newargz[0] = "$SHELL";
4701 cat >> $cwrappersource <<"EOF"
4702 newargz[1] = fnqualify(argv[0]);
4703 /* we know the script has the same name, without the .exe */
4704 /* so make sure newargz[1] doesn't end in .exe */
4705 strendzap(newargz[1],".exe");
4706 for (i = 1; i < argc; i++)
4707 newargz[i+1] = xstrdup(argv[i]);
4708 newargz[argc+1] = NULL;
4711 cat >> $cwrappersource <<EOF
4712 execv("$SHELL",newargz);
4715 cat >> $cwrappersource <<"EOF"
4718 void *
4719 xmalloc (size_t num)
4721 void * p = (void *) malloc (num);
4722 if (!p)
4723 lt_fatal ("Memory exhausted");
4725 return p;
4728 char *
4729 xstrdup (const char *string)
4731 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4735 char *
4736 basename (const char *name)
4738 const char *base;
4740 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4741 /* Skip over the disk name in MSDOS pathnames. */
4742 if (isalpha (name[0]) && name[1] == ':')
4743 name += 2;
4744 #endif
4746 for (base = name; *name; name++)
4747 if (IS_DIR_SEPARATOR (*name))
4748 base = name + 1;
4749 return (char *) base;
4752 char *
4753 fnqualify(const char *path)
4755 size_t size;
4756 char *p;
4757 char tmp[LT_PATHMAX + 1];
4759 assert(path != NULL);
4761 /* Is it qualified already? */
4762 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4763 if (isalpha (path[0]) && path[1] == ':')
4764 return xstrdup (path);
4765 #endif
4766 if (IS_DIR_SEPARATOR (path[0]))
4767 return xstrdup (path);
4769 /* prepend the current directory */
4770 /* doesn't handle '~' */
4771 if (getcwd (tmp, LT_PATHMAX) == NULL)
4772 lt_fatal ("getcwd failed");
4773 size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4774 p = XMALLOC(char, size);
4775 sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4776 return p;
4779 char *
4780 strendzap(char *str, const char *pat)
4782 size_t len, patlen;
4784 assert(str != NULL);
4785 assert(pat != NULL);
4787 len = strlen(str);
4788 patlen = strlen(pat);
4790 if (patlen <= len)
4792 str += len - patlen;
4793 if (strcmp(str, pat) == 0)
4794 *str = '\0';
4796 return str;
4799 static void
4800 lt_error_core (int exit_status, const char * mode,
4801 const char * message, va_list ap)
4803 fprintf (stderr, "%s: %s: ", program_name, mode);
4804 vfprintf (stderr, message, ap);
4805 fprintf (stderr, ".\n");
4807 if (exit_status >= 0)
4808 exit (exit_status);
4811 void
4812 lt_fatal (const char *message, ...)
4814 va_list ap;
4815 va_start (ap, message);
4816 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4817 va_end (ap);
4820 # we should really use a build-platform specific compiler
4821 # here, but OTOH, the wrappers (shell script and this C one)
4822 # are only useful if you want to execute the "real" binary.
4823 # Since the "real" binary is built for $host, then this
4824 # wrapper might as well be built for $host, too.
4825 $run $LTCC -s -o $cwrapper $cwrappersource
4827 esac
4828 $rm $output
4829 trap "$rm $output; exit 1" 1 2 15
4831 $echo > $output "\
4832 #! $SHELL
4834 # $output - temporary wrapper script for $objdir/$outputname
4835 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4837 # The $output program cannot be directly executed until all the libtool
4838 # libraries that it depends on are installed.
4840 # This wrapper script should never be moved out of the build directory.
4841 # If it is, it will not operate correctly.
4843 # Sed substitution that helps us do robust quoting. It backslashifies
4844 # metacharacters that are still active within double-quoted strings.
4845 Xsed='${SED} -e 1s/^X//'
4846 sed_quote_subst='$sed_quote_subst'
4848 # The HP-UX ksh and POSIX shell print the target directory to stdout
4849 # if CDPATH is set.
4850 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
4852 relink_command=\"$relink_command\"
4854 # This environment variable determines our operation mode.
4855 if test \"\$libtool_install_magic\" = \"$magic\"; then
4856 # install mode needs the following variable:
4857 notinst_deplibs='$notinst_deplibs'
4858 else
4859 # When we are sourced in execute mode, \$file and \$echo are already set.
4860 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4861 echo=\"$qecho\"
4862 file=\"\$0\"
4863 # Make sure echo works.
4864 if test \"X\$1\" = X--no-reexec; then
4865 # Discard the --no-reexec flag, and continue.
4866 shift
4867 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4868 # Yippee, \$echo works!
4870 else
4871 # Restart under the correct shell, and then maybe \$echo will work.
4872 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4876 $echo >> $output "\
4878 # Find the directory that this script lives in.
4879 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4880 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4882 # Follow symbolic links until we get to the real thisdir.
4883 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
4884 while test -n \"\$file\"; do
4885 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4887 # If there was a directory component, then change thisdir.
4888 if test \"x\$destdir\" != \"x\$file\"; then
4889 case \"\$destdir\" in
4890 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4891 *) thisdir=\"\$thisdir/\$destdir\" ;;
4892 esac
4895 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4896 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
4897 done
4899 # Try to get the absolute directory name.
4900 absdir=\`cd \"\$thisdir\" && pwd\`
4901 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4904 if test "$fast_install" = yes; then
4905 $echo >> $output "\
4906 program=lt-'$outputname'$exeext
4907 progdir=\"\$thisdir/$objdir\"
4909 if test ! -f \"\$progdir/\$program\" || \\
4910 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4911 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4913 file=\"\$\$-\$program\"
4915 if test ! -d \"\$progdir\"; then
4916 $mkdir \"\$progdir\"
4917 else
4918 $rm \"\$progdir/\$file\"
4921 $echo >> $output "\
4923 # relink executable if necessary
4924 if test -n \"\$relink_command\"; then
4925 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4926 else
4927 $echo \"\$relink_command_output\" >&2
4928 $rm \"\$progdir/\$file\"
4929 exit 1
4933 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4934 { $rm \"\$progdir/\$program\";
4935 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4936 $rm \"\$progdir/\$file\"
4938 else
4939 $echo >> $output "\
4940 program='$outputname'
4941 progdir=\"\$thisdir/$objdir\"
4945 $echo >> $output "\
4947 if test -f \"\$progdir/\$program\"; then"
4949 # Export our shlibpath_var if we have one.
4950 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4951 $echo >> $output "\
4952 # Add our own library path to $shlibpath_var
4953 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4955 # Some systems cannot cope with colon-terminated $shlibpath_var
4956 # The second colon is a workaround for a bug in BeOS R4 sed
4957 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4959 export $shlibpath_var
4963 # fixup the dll searchpath if we need to.
4964 if test -n "$dllsearchpath"; then
4965 $echo >> $output "\
4966 # Add the dll search path components to the executable PATH
4967 PATH=$dllsearchpath:\$PATH
4971 $echo >> $output "\
4972 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4973 # Run the actual program with our arguments.
4975 case $host in
4976 # Backslashes separate directories on plain windows
4977 *-*-mingw | *-*-os2*)
4978 $echo >> $output "\
4979 exec \$progdir\\\\\$program \${1+\"\$@\"}
4984 # Need to set LD_LIBRARY_PATH, to the value already
4985 # computed within libtool.
4986 $echo >> $output "\
4987 LD_LIBRARY_PATH=\"$rpath\" exec \$progdir/\$program \${1+\"\$@\"}
4990 esac
4991 $echo >> $output "\
4992 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4993 exit 1
4995 else
4996 # The program doesn't exist.
4997 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4998 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4999 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5000 exit 1
5004 chmod +x $output
5006 exit 0
5008 esac
5010 # See if we need to build an old-fashioned archive.
5011 for oldlib in $oldlibs; do
5013 if test "$build_libtool_libs" = convenience; then
5014 oldobjs="$libobjs_save"
5015 addlibs="$convenience"
5016 build_libtool_libs=no
5017 else
5018 if test "$build_libtool_libs" = module; then
5019 oldobjs="$libobjs_save"
5020 build_libtool_libs=no
5021 else
5022 oldobjs="$old_deplibs $non_pic_objects"
5024 addlibs="$old_convenience"
5027 if test -n "$addlibs"; then
5028 gentop="$output_objdir/${outputname}x"
5029 $show "${rm}r $gentop"
5030 $run ${rm}r "$gentop"
5031 $show "$mkdir $gentop"
5032 $run $mkdir "$gentop"
5033 status=$?
5034 if test "$status" -ne 0 && test ! -d "$gentop"; then
5035 exit $status
5037 generated="$generated $gentop"
5039 # Add in members from convenience archives.
5040 for xlib in $addlibs; do
5041 # Extract the objects.
5042 case $xlib in
5043 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
5044 *) xabs=`pwd`"/$xlib" ;;
5045 esac
5046 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
5047 xdir="$gentop/$xlib"
5049 $show "${rm}r $xdir"
5050 $run ${rm}r "$xdir"
5051 $show "$mkdir $xdir"
5052 $run $mkdir "$xdir"
5053 status=$?
5054 if test "$status" -ne 0 && test ! -d "$xdir"; then
5055 exit $status
5057 # We will extract separately just the conflicting names and we will no
5058 # longer touch any unique names. It is faster to leave these extract
5059 # automatically by $AR in one run.
5060 $show "(cd $xdir && $AR x $xabs)"
5061 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5062 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
5064 else
5065 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
5066 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
5067 $AR t "$xabs" | sort | uniq -cd | while read -r count name
5070 while test "$i" -le "$count"
5072 # Put our $i before any first dot (extension)
5073 # Never overwrite any file
5074 name_to="$name"
5075 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
5077 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
5078 done
5079 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
5080 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
5081 i=`expr $i + 1`
5082 done
5083 done
5086 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5087 done
5090 compiler_flags="$compiler_flags $add_flags"
5092 # Do each command in the archive commands.
5093 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5094 eval cmds=\"$old_archive_from_new_cmds\"
5095 else
5096 eval cmds=\"$old_archive_cmds\"
5098 if len=`expr "X$cmds" : ".*"` &&
5099 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5101 else
5102 # the command line is too long to link in one step, link in parts
5103 $echo "using piecewise archive linking..."
5104 save_RANLIB=$RANLIB
5105 RANLIB=:
5106 objlist=
5107 concat_cmds=
5108 save_oldobjs=$oldobjs
5109 # GNU ar 2.10+ was changed to match POSIX; thus no paths are
5110 # encoded into archives. This makes 'ar r' malfunction in
5111 # this piecewise linking case whenever conflicting object
5112 # names appear in distinct ar calls; check, warn and compensate.
5113 if (for obj in $save_oldobjs
5115 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5116 done | sort | sort -uc >/dev/null 2>&1); then
5118 else
5119 $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5120 $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5121 AR_FLAGS=cq
5123 # Is there a better way of finding the last object in the list?
5124 for obj in $save_oldobjs
5126 last_oldobj=$obj
5127 done
5128 for obj in $save_oldobjs
5130 oldobjs="$objlist $obj"
5131 objlist="$objlist $obj"
5132 eval test_cmds=\"$old_archive_cmds\"
5133 if len=`expr "X$test_cmds" : ".*"` &&
5134 test "$len" -le "$max_cmd_len"; then
5136 else
5137 # the above command should be used before it gets too long
5138 oldobjs=$objlist
5139 if test "$obj" = "$last_oldobj" ; then
5140 RANLIB=$save_RANLIB
5142 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5143 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5144 objlist=
5146 done
5147 RANLIB=$save_RANLIB
5148 oldobjs=$objlist
5149 if test "X$oldobjs" = "X" ; then
5150 eval cmds=\"\$concat_cmds\"
5151 else
5152 eval cmds=\"\$concat_cmds~$old_archive_cmds\"
5156 save_ifs="$IFS"; IFS='~'
5157 for cmd in $cmds; do
5158 IFS="$save_ifs"
5159 $show "$cmd"
5160 $run eval "$cmd" || exit $?
5161 done
5162 IFS="$save_ifs"
5163 done
5165 if test -n "$generated"; then
5166 $show "${rm}r$generated"
5167 $run ${rm}r$generated
5170 # Now create the libtool archive.
5171 case $output in
5172 *.la)
5173 old_library=
5174 test "$build_old_libs" = yes && old_library="$libname.$libext"
5175 $show "creating $output"
5177 # Preserve any variables that may affect compiler behavior
5178 for var in $variables_saved_for_relink; do
5179 if eval test -z \"\${$var+set}\"; then
5180 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5181 elif eval var_value=\$$var; test -z "$var_value"; then
5182 relink_command="$var=; export $var; $relink_command"
5183 else
5184 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5185 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5187 done
5188 # Quote the link command for shipping.
5189 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
5190 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5191 if test "$hardcode_automatic" = yes ; then
5192 relink_command=
5194 # Only create the output if not a dry run.
5195 if test -z "$run"; then
5196 for installed in no yes; do
5197 if test "$installed" = yes; then
5198 if test -z "$install_libdir"; then
5199 break
5201 output="$output_objdir/$outputname"i
5202 # Replace all uninstalled libtool libraries with the installed ones
5203 newdependency_libs=
5204 for deplib in $dependency_libs; do
5205 case $deplib in
5206 *.la)
5207 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5208 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5209 if test -z "$libdir"; then
5210 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5211 exit 1
5213 if test "x$EGREP" = x ; then
5214 EGREP=egrep
5216 # We do not want portage's install root ($D) present. Check only for
5217 # this if the .la is being installed.
5218 if test "$installed" = yes && test "$D"; then
5219 eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5220 else
5221 mynewdependency_lib="$libdir/$name"
5223 # Do not add duplicates
5224 if test "$mynewdependency_lib"; then
5225 my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5226 if test -z "$my_little_ninja_foo_1"; then
5227 newdependency_libs="$newdependency_libs $mynewdependency_lib"
5232 if test "$installed" = yes; then
5233 # Rather use S=WORKDIR if our version of portage supports it.
5234 # This is because some ebuild (gcc) do not use $S as buildroot.
5235 if test "$PWORKDIR"; then
5236 S="$PWORKDIR"
5238 # We do not want portage's build root ($S) present.
5239 my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
5240 # We do not want portage's install root ($D) present.
5241 my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
5242 if test -n "$my_little_ninja_foo_2" && test "$S"; then
5243 mynewdependency_lib=""
5244 elif test -n "$my_little_ninja_foo_3" && test "$D"; then
5245 eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5246 else
5247 mynewdependency_lib="$deplib"
5249 else
5250 mynewdependency_lib="$deplib"
5252 # Do not add duplicates
5253 if test "$mynewdependency_lib"; then
5254 my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5255 if test -z "$my_little_ninja_foo_4"; then
5256 newdependency_libs="$newdependency_libs $mynewdependency_lib"
5260 esac
5261 done
5262 dependency_libs="$newdependency_libs"
5263 newdlfiles=
5264 for lib in $dlfiles; do
5265 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5266 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5267 if test -z "$libdir"; then
5268 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5269 exit 1
5271 newdlfiles="$newdlfiles $libdir/$name"
5272 done
5273 dlfiles="$newdlfiles"
5274 newdlprefiles=
5275 for lib in $dlprefiles; do
5276 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5277 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5278 if test -z "$libdir"; then
5279 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5280 exit 1
5282 newdlprefiles="$newdlprefiles $libdir/$name"
5283 done
5284 dlprefiles="$newdlprefiles"
5286 $rm $output
5287 # place dlname in correct position for cygwin
5288 tdlname=$dlname
5289 case $host,$output,$installed,$module,$dlname in
5290 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5291 esac
5292 # Do not add duplicates
5293 if test "$installed" = yes && test "$D"; then
5294 install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5296 $echo > $output "\
5297 # $outputname - a libtool library file
5298 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5300 # Please DO NOT delete this file!
5301 # It is necessary for linking the library.
5303 # The name that we can dlopen(3).
5304 dlname='$tdlname'
5306 # Names of this library.
5307 library_names='$library_names'
5309 # The name of the static archive.
5310 old_library='$old_library'
5312 # Libraries that this one depends upon.
5313 dependency_libs='$dependency_libs'
5315 # Version information for $libname.
5316 current=$current
5317 age=$age
5318 revision=$revision
5320 # Is this an already installed library?
5321 installed=$installed
5323 # Should we warn about portability when linking against -modules?
5324 shouldnotlink=$module
5326 # Files to dlopen/dlpreopen
5327 dlopen='$dlfiles'
5328 dlpreopen='$dlprefiles'
5330 # Directory that this library needs to be installed in:
5331 libdir='$install_libdir'"
5332 if test "$installed" = no && test "$need_relink" = yes && test "$fast_install" = no; then
5333 $echo >> $output "\
5334 relink_command=\"$relink_command\""
5336 done
5339 # Do a symbolic link so that the libtool archive can be found in
5340 # LD_LIBRARY_PATH before the program is installed.
5341 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5342 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5344 esac
5345 exit 0
5348 # libtool install mode
5349 install)
5350 modename="$modename: install"
5352 # There may be an optional sh(1) argument at the beginning of
5353 # install_prog (especially on Windows NT).
5354 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5355 # Allow the use of GNU shtool's install command.
5356 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
5357 # Aesthetically quote it.
5358 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5359 case $arg in
5360 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5361 arg="\"$arg\""
5363 esac
5364 install_prog="$arg "
5365 arg="$1"
5366 shift
5367 else
5368 install_prog=
5369 arg="$nonopt"
5372 # The real first argument should be the name of the installation program.
5373 # Aesthetically quote it.
5374 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5375 case $arg in
5376 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5377 arg="\"$arg\""
5379 esac
5380 install_prog="$install_prog$arg"
5382 # We need to accept at least all the BSD install flags.
5383 dest=
5384 files=
5385 opts=
5386 prev=
5387 install_type=
5388 isdir=no
5389 stripme=
5390 for arg
5392 if test -n "$dest"; then
5393 files="$files $dest"
5394 dest="$arg"
5395 continue
5398 case $arg in
5399 -d) isdir=yes ;;
5400 -f) prev="-f" ;;
5401 -g) prev="-g" ;;
5402 -m) prev="-m" ;;
5403 -o) prev="-o" ;;
5405 stripme=" -s"
5406 continue
5408 -*) ;;
5411 # If the previous option needed an argument, then skip it.
5412 if test -n "$prev"; then
5413 prev=
5414 else
5415 dest="$arg"
5416 continue
5419 esac
5421 # Aesthetically quote the argument.
5422 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5423 case $arg in
5424 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5425 arg="\"$arg\""
5427 esac
5428 install_prog="$install_prog $arg"
5429 done
5431 if test -z "$install_prog"; then
5432 $echo "$modename: you must specify an install program" 1>&2
5433 $echo "$help" 1>&2
5434 exit 1
5437 if test -n "$prev"; then
5438 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5439 $echo "$help" 1>&2
5440 exit 1
5443 if test -z "$files"; then
5444 if test -z "$dest"; then
5445 $echo "$modename: no file or destination specified" 1>&2
5446 else
5447 $echo "$modename: you must specify a destination" 1>&2
5449 $echo "$help" 1>&2
5450 exit 1
5453 # Strip any trailing slash from the destination.
5454 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5456 # Check to see that the destination is a directory.
5457 test -d "$dest" && isdir=yes
5458 if test "$isdir" = yes; then
5459 destdir="$dest"
5460 destname=
5461 else
5462 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5463 test "X$destdir" = "X$dest" && destdir=.
5464 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5466 # Not a directory, so check to see that there is only one file specified.
5467 set dummy $files
5468 if test "$#" -gt 2; then
5469 $echo "$modename: \`$dest' is not a directory" 1>&2
5470 $echo "$help" 1>&2
5471 exit 1
5474 case $destdir in
5475 [\\/]* | [A-Za-z]:[\\/]*) ;;
5477 for file in $files; do
5478 case $file in
5479 *.lo) ;;
5481 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5482 $echo "$help" 1>&2
5483 exit 1
5485 esac
5486 done
5488 esac
5490 # This variable tells wrapper scripts just to set variables rather
5491 # than running their programs.
5492 libtool_install_magic="$magic"
5494 staticlibs=
5495 future_libdirs=
5496 current_libdirs=
5497 for file in $files; do
5499 # Do each installation.
5500 case $file in
5501 *.$libext)
5502 # Do the static libraries later.
5503 staticlibs="$staticlibs $file"
5506 *.la)
5507 # Check to see that this really is a libtool archive.
5508 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5509 else
5510 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5511 $echo "$help" 1>&2
5512 exit 1
5515 library_names=
5516 old_library=
5517 relink_command=
5518 # If there is no directory component, then add one.
5519 case $file in
5520 */* | *\\*) . $file ;;
5521 *) . ./$file ;;
5522 esac
5524 # Add the libdir to current_libdirs if it is the destination.
5525 if test "X$destdir" = "X$libdir"; then
5526 case "$current_libdirs " in
5527 *" $libdir "*) ;;
5528 *) current_libdirs="$current_libdirs $libdir" ;;
5529 esac
5530 else
5531 # Note the libdir as a future libdir.
5532 case "$future_libdirs " in
5533 *" $libdir "*) ;;
5534 *) future_libdirs="$future_libdirs $libdir" ;;
5535 esac
5538 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5539 test "X$dir" = "X$file/" && dir=
5540 dir="$dir$objdir"
5542 if test -n "$relink_command"; then
5543 # Determine the prefix the user has applied to our future dir.
5544 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5546 # Don't allow the user to place us outside of our expected
5547 # location b/c this prevents finding dependent libraries that
5548 # are installed to the same prefix.
5549 # At present, this check doesn't affect windows .dll's that
5550 # are installed into $libdir/../bin (currently, that works fine)
5551 # but it's something to keep an eye on.
5552 if test "$inst_prefix_dir" = "$destdir"; then
5553 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5554 exit 1
5557 if test -n "$inst_prefix_dir"; then
5558 # Stick the inst_prefix_dir data into the link command.
5559 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5560 else
5561 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5564 $echo "$modename: warning: relinking \`$file'" 1>&2
5565 $show "$relink_command"
5566 if $run eval "$relink_command"; then :
5567 else
5568 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5569 exit 1
5573 # See the names of the shared library.
5574 set dummy $library_names
5575 if test -n "$2"; then
5576 realname="$2"
5577 shift
5578 shift
5580 srcname="$realname"
5581 test -n "$relink_command" && srcname="$realname"T
5583 # Install the shared library and build the symlinks.
5584 $show "$install_prog $dir/$srcname $destdir/$realname"
5585 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5586 if test -n "$stripme" && test -n "$striplib"; then
5587 $show "$striplib $destdir/$realname"
5588 $run eval "$striplib $destdir/$realname" || exit $?
5591 if test "$#" -gt 0; then
5592 # Delete the old symlinks, and create new ones.
5593 for linkname
5595 if test "$linkname" != "$realname"; then
5596 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5597 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5599 done
5602 # Do each command in the postinstall commands.
5603 lib="$destdir/$realname"
5604 eval cmds=\"$postinstall_cmds\"
5605 save_ifs="$IFS"; IFS='~'
5606 for cmd in $cmds; do
5607 IFS="$save_ifs"
5608 $show "$cmd"
5609 $run eval "$cmd" || exit $?
5610 done
5611 IFS="$save_ifs"
5614 # Install the pseudo-library for information purposes.
5615 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5616 instname="$dir/$name"i
5617 $show "$install_prog $instname $destdir/$name"
5618 $run eval "$install_prog $instname $destdir/$name" || exit $?
5620 # Maybe install the static library, too.
5621 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
5624 *.lo)
5625 # Install (i.e. copy) a libtool object.
5627 # Figure out destination file name, if it wasn't already specified.
5628 if test -n "$destname"; then
5629 destfile="$destdir/$destname"
5630 else
5631 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5632 destfile="$destdir/$destfile"
5635 # Deduce the name of the destination old-style object file.
5636 case $destfile in
5637 *.lo)
5638 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
5640 *.$objext)
5641 staticdest="$destfile"
5642 destfile=
5645 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5646 $echo "$help" 1>&2
5647 exit 1
5649 esac
5651 # Install the libtool object if requested.
5652 if test -n "$destfile"; then
5653 $show "$install_prog $file $destfile"
5654 $run eval "$install_prog $file $destfile" || exit $?
5657 # Install the old object if enabled.
5658 if test "$build_old_libs" = yes; then
5659 # Deduce the name of the old-style object file.
5660 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
5662 $show "$install_prog $staticobj $staticdest"
5663 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5665 exit 0
5669 # Figure out destination file name, if it wasn't already specified.
5670 if test -n "$destname"; then
5671 destfile="$destdir/$destname"
5672 else
5673 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5674 destfile="$destdir/$destfile"
5677 # If the file is missing, and there is a .exe on the end, strip it
5678 # because it is most likely a libtool script we actually want to
5679 # install
5680 stripped_ext=""
5681 case $file in
5682 *.exe)
5683 if test ! -f "$file"; then
5684 file=`$echo $file|${SED} 's,.exe$,,'`
5685 stripped_ext=".exe"
5688 esac
5690 # Do a test to see if this is really a libtool program.
5691 case $host in
5692 *cygwin*|*mingw*)
5693 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
5696 wrapper=$file
5698 esac
5699 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5700 notinst_deplibs=
5701 relink_command=
5703 # To insure that "foo" is sourced, and not "foo.exe",
5704 # finese the cygwin/MSYS system by explicitly sourcing "foo."
5705 # which disallows the automatic-append-.exe behavior.
5706 case $build in
5707 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5708 *) wrapperdot=${wrapper} ;;
5709 esac
5710 # If there is no directory component, then add one.
5711 case $file in
5712 */* | *\\*) . ${wrapperdot} ;;
5713 *) . ./${wrapperdot} ;;
5714 esac
5716 # Check the variables that should have been set.
5717 if test -z "$notinst_deplibs"; then
5718 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5719 exit 1
5722 finalize=yes
5723 for lib in $notinst_deplibs; do
5724 # Check to see that each library is installed.
5725 libdir=
5726 if test -f "$lib"; then
5727 # If there is no directory component, then add one.
5728 case $lib in
5729 */* | *\\*) . $lib ;;
5730 *) . ./$lib ;;
5731 esac
5733 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
5734 if test -n "$libdir" && test ! -f "$libfile"; then
5735 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
5736 finalize=no
5738 done
5740 relink_command=
5741 # To insure that "foo" is sourced, and not "foo.exe",
5742 # finese the cygwin/MSYS system by explicitly sourcing "foo."
5743 # which disallows the automatic-append-.exe behavior.
5744 case $build in
5745 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5746 *) wrapperdot=${wrapper} ;;
5747 esac
5748 # If there is no directory component, then add one.
5749 case $file in
5750 */* | *\\*) . ${wrapperdot} ;;
5751 *) . ./${wrapperdot} ;;
5752 esac
5754 outputname=
5755 if test "$fast_install" = no && test -n "$relink_command"; then
5756 if test "$finalize" = yes && test -z "$run"; then
5757 tmpdir="/tmp"
5758 test -n "$TMPDIR" && tmpdir="$TMPDIR"
5759 tmpdir="$tmpdir/libtool-$$"
5760 if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then :
5761 else
5762 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5763 continue
5765 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5766 outputname="$tmpdir/$file"
5767 # Replace the output file specification.
5768 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5770 $show "$relink_command"
5771 if $run eval "$relink_command"; then :
5772 else
5773 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5774 ${rm}r "$tmpdir"
5775 continue
5777 file="$outputname"
5778 else
5779 $echo "$modename: warning: cannot relink \`$file'" 1>&2
5781 else
5782 # Install the binary that we compiled earlier.
5783 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5787 # remove .exe since cygwin /usr/bin/install will append another
5788 # one anyways
5789 case $install_prog,$host in
5790 */usr/bin/install*,*cygwin*)
5791 case $file:$destfile in
5792 *.exe:*.exe)
5793 # this is ok
5795 *.exe:*)
5796 destfile=$destfile.exe
5798 *:*.exe)
5799 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
5801 esac
5803 esac
5804 $show "$install_prog$stripme $file $destfile"
5805 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
5806 test -n "$outputname" && ${rm}r "$tmpdir"
5808 esac
5809 done
5811 for file in $staticlibs; do
5812 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5814 # Set up the ranlib parameters.
5815 oldlib="$destdir/$name"
5817 $show "$install_prog $file $oldlib"
5818 $run eval "$install_prog \$file \$oldlib" || exit $?
5820 if test -n "$stripme" && test -n "$striplib"; then
5821 $show "$old_striplib $oldlib"
5822 $run eval "$old_striplib $oldlib" || exit $?
5825 # Do each command in the postinstall commands.
5826 eval cmds=\"$old_postinstall_cmds\"
5827 save_ifs="$IFS"; IFS='~'
5828 for cmd in $cmds; do
5829 IFS="$save_ifs"
5830 $show "$cmd"
5831 $run eval "$cmd" || exit $?
5832 done
5833 IFS="$save_ifs"
5834 done
5836 if test -n "$future_libdirs"; then
5837 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
5840 if test -n "$current_libdirs"; then
5841 # Maybe just do a dry run.
5842 test -n "$run" && current_libdirs=" -n$current_libdirs"
5843 exec_cmd='$SHELL $0 --finish$current_libdirs'
5844 else
5845 exit 0
5849 # libtool finish mode
5850 finish)
5851 modename="$modename: finish"
5852 libdirs="$nonopt"
5853 admincmds=
5855 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5856 for dir
5858 libdirs="$libdirs $dir"
5859 done
5861 for libdir in $libdirs; do
5862 if test -n "$finish_cmds"; then
5863 # Do each command in the finish commands.
5864 eval cmds=\"$finish_cmds\"
5865 save_ifs="$IFS"; IFS='~'
5866 for cmd in $cmds; do
5867 IFS="$save_ifs"
5868 $show "$cmd"
5869 $run eval "$cmd" || admincmds="$admincmds
5870 $cmd"
5871 done
5872 IFS="$save_ifs"
5874 if test -n "$finish_eval"; then
5875 # Do the single finish_eval.
5876 eval cmds=\"$finish_eval\"
5877 $run eval "$cmds" || admincmds="$admincmds
5878 $cmds"
5880 done
5883 # Exit here if they wanted silent mode.
5884 exit 0
5886 $echo "----------------------------------------------------------------------"
5887 $echo "Libraries have been installed in:"
5888 for libdir in $libdirs; do
5889 $echo " $libdir"
5890 done
5891 $echo
5892 $echo "If you ever happen to want to link against installed libraries"
5893 $echo "in a given directory, LIBDIR, you must either use libtool, and"
5894 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5895 $echo "flag during linking and do at least one of the following:"
5896 if test -n "$shlibpath_var"; then
5897 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
5898 $echo " during execution"
5900 if test -n "$runpath_var"; then
5901 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
5902 $echo " during linking"
5904 if test -n "$hardcode_libdir_flag_spec"; then
5905 libdir=LIBDIR
5906 eval flag=\"$hardcode_libdir_flag_spec\"
5908 $echo " - use the \`$flag' linker flag"
5910 if test -n "$admincmds"; then
5911 $echo " - have your system administrator run these commands:$admincmds"
5913 if test -f /etc/ld.so.conf; then
5914 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5916 $echo
5917 $echo "See any operating system documentation about shared libraries for"
5918 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5919 $echo "----------------------------------------------------------------------"
5920 exit 0
5923 # libtool execute mode
5924 execute)
5925 modename="$modename: execute"
5927 # The first argument is the command name.
5928 cmd="$nonopt"
5929 if test -z "$cmd"; then
5930 $echo "$modename: you must specify a COMMAND" 1>&2
5931 $echo "$help"
5932 exit 1
5935 # Handle -dlopen flags immediately.
5936 for file in $execute_dlfiles; do
5937 if test ! -f "$file"; then
5938 $echo "$modename: \`$file' is not a file" 1>&2
5939 $echo "$help" 1>&2
5940 exit 1
5943 dir=
5944 case $file in
5945 *.la)
5946 # Check to see that this really is a libtool archive.
5947 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5948 else
5949 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5950 $echo "$help" 1>&2
5951 exit 1
5954 # Read the libtool library.
5955 dlname=
5956 library_names=
5958 # If there is no directory component, then add one.
5959 case $file in
5960 */* | *\\*) . $file ;;
5961 *) . ./$file ;;
5962 esac
5964 # Skip this library if it cannot be dlopened.
5965 if test -z "$dlname"; then
5966 # Warn if it was a shared library.
5967 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5968 continue
5971 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5972 test "X$dir" = "X$file" && dir=.
5974 if test -f "$dir/$objdir/$dlname"; then
5975 dir="$dir/$objdir"
5976 else
5977 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5978 exit 1
5982 *.lo)
5983 # Just add the directory containing the .lo file.
5984 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5985 test "X$dir" = "X$file" && dir=.
5989 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5990 continue
5992 esac
5994 # Get the absolute pathname.
5995 absdir=`cd "$dir" && pwd`
5996 test -n "$absdir" && dir="$absdir"
5998 # Now add the directory to shlibpath_var.
5999 if eval "test -z \"\$$shlibpath_var\""; then
6000 eval "$shlibpath_var=\"\$dir\""
6001 else
6002 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6004 done
6006 # This variable tells wrapper scripts just to set shlibpath_var
6007 # rather than running their programs.
6008 libtool_execute_magic="$magic"
6010 # Check if any of the arguments is a wrapper script.
6011 args=
6012 for file
6014 case $file in
6015 -*) ;;
6017 # Do a test to see if this is really a libtool program.
6018 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6019 # If there is no directory component, then add one.
6020 case $file in
6021 */* | *\\*) . $file ;;
6022 *) . ./$file ;;
6023 esac
6025 # Transform arg to wrapped name.
6026 file="$progdir/$program"
6029 esac
6030 # Quote arguments (to preserve shell metacharacters).
6031 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6032 args="$args \"$file\""
6033 done
6035 if test -z "$run"; then
6036 if test -n "$shlibpath_var"; then
6037 # Export the shlibpath_var.
6038 eval "export $shlibpath_var"
6041 # Restore saved environment variables
6042 if test "${save_LC_ALL+set}" = set; then
6043 LC_ALL="$save_LC_ALL"; export LC_ALL
6045 if test "${save_LANG+set}" = set; then
6046 LANG="$save_LANG"; export LANG
6049 # Now prepare to actually exec the command.
6050 exec_cmd="\$cmd$args"
6051 else
6052 # Display what would be done.
6053 if test -n "$shlibpath_var"; then
6054 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6055 $echo "export $shlibpath_var"
6057 $echo "$cmd$args"
6058 exit 0
6062 # libtool clean and uninstall mode
6063 clean | uninstall)
6064 modename="$modename: $mode"
6065 rm="$nonopt"
6066 files=
6067 rmforce=
6068 exit_status=0
6070 # This variable tells wrapper scripts just to set variables rather
6071 # than running their programs.
6072 libtool_install_magic="$magic"
6074 for arg
6076 case $arg in
6077 -f) rm="$rm $arg"; rmforce=yes ;;
6078 -*) rm="$rm $arg" ;;
6079 *) files="$files $arg" ;;
6080 esac
6081 done
6083 if test -z "$rm"; then
6084 $echo "$modename: you must specify an RM program" 1>&2
6085 $echo "$help" 1>&2
6086 exit 1
6089 rmdirs=
6091 origobjdir="$objdir"
6092 for file in $files; do
6093 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6094 if test "X$dir" = "X$file"; then
6095 dir=.
6096 objdir="$origobjdir"
6097 else
6098 objdir="$dir/$origobjdir"
6100 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6101 test "$mode" = uninstall && objdir="$dir"
6103 # Remember objdir for removal later, being careful to avoid duplicates
6104 if test "$mode" = clean; then
6105 case " $rmdirs " in
6106 *" $objdir "*) ;;
6107 *) rmdirs="$rmdirs $objdir" ;;
6108 esac
6111 # Don't error if the file doesn't exist and rm -f was used.
6112 if (test -L "$file") >/dev/null 2>&1 \
6113 || (test -h "$file") >/dev/null 2>&1 \
6114 || test -f "$file"; then
6116 elif test -d "$file"; then
6117 exit_status=1
6118 continue
6119 elif test "$rmforce" = yes; then
6120 continue
6123 rmfiles="$file"
6125 case $name in
6126 *.la)
6127 # Possibly a libtool archive, so verify it.
6128 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6129 . $dir/$name
6131 # Delete the libtool libraries and symlinks.
6132 for n in $library_names; do
6133 rmfiles="$rmfiles $objdir/$n"
6134 done
6135 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6136 test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6138 if test "$mode" = uninstall; then
6139 if test -n "$library_names"; then
6140 # Do each command in the postuninstall commands.
6141 eval cmds=\"$postuninstall_cmds\"
6142 save_ifs="$IFS"; IFS='~'
6143 for cmd in $cmds; do
6144 IFS="$save_ifs"
6145 $show "$cmd"
6146 $run eval "$cmd"
6147 if test "$?" -ne 0 && test "$rmforce" != yes; then
6148 exit_status=1
6150 done
6151 IFS="$save_ifs"
6154 if test -n "$old_library"; then
6155 # Do each command in the old_postuninstall commands.
6156 eval cmds=\"$old_postuninstall_cmds\"
6157 save_ifs="$IFS"; IFS='~'
6158 for cmd in $cmds; do
6159 IFS="$save_ifs"
6160 $show "$cmd"
6161 $run eval "$cmd"
6162 if test "$?" -ne 0 && test "$rmforce" != yes; then
6163 exit_status=1
6165 done
6166 IFS="$save_ifs"
6168 # FIXME: should reinstall the best remaining shared library.
6173 *.lo)
6174 # Possibly a libtool object, so verify it.
6175 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6177 # Read the .lo file
6178 . $dir/$name
6180 # Add PIC object to the list of files to remove.
6181 if test -n "$pic_object" \
6182 && test "$pic_object" != none; then
6183 rmfiles="$rmfiles $dir/$pic_object"
6186 # Add non-PIC object to the list of files to remove.
6187 if test -n "$non_pic_object" \
6188 && test "$non_pic_object" != none; then
6189 rmfiles="$rmfiles $dir/$non_pic_object"
6195 if test "$mode" = clean ; then
6196 noexename=$name
6197 case $file in
6198 *.exe)
6199 file=`$echo $file|${SED} 's,.exe$,,'`
6200 noexename=`$echo $name|${SED} 's,.exe$,,'`
6201 # $file with .exe has already been added to rmfiles,
6202 # add $file without .exe
6203 rmfiles="$rmfiles $file"
6205 esac
6206 # Do a test to see if this is a libtool program.
6207 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6208 relink_command=
6209 . $dir/$noexename
6211 # note $name still contains .exe if it was in $file originally
6212 # as does the version of $file that was added into $rmfiles
6213 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6214 if test "$fast_install" = yes && test -n "$relink_command"; then
6215 rmfiles="$rmfiles $objdir/lt-$name"
6217 if test "X$noexename" != "X$name" ; then
6218 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6223 esac
6224 $show "$rm $rmfiles"
6225 $run $rm $rmfiles || exit_status=1
6226 done
6227 objdir="$origobjdir"
6229 # Try to remove the ${objdir}s in the directories where we deleted files
6230 for dir in $rmdirs; do
6231 if test -d "$dir"; then
6232 $show "rmdir $dir"
6233 $run rmdir $dir >/dev/null 2>&1
6235 done
6237 exit $exit_status
6241 $echo "$modename: you must specify a MODE" 1>&2
6242 $echo "$generic_help" 1>&2
6243 exit 1
6245 esac
6247 if test -z "$exec_cmd"; then
6248 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6249 $echo "$generic_help" 1>&2
6250 exit 1
6252 fi # test -z "$show_help"
6254 if test -n "$exec_cmd"; then
6255 eval exec $exec_cmd
6256 exit 1
6259 # We need to display help for each of the modes.
6260 case $mode in
6261 "") $echo \
6262 "Usage: $modename [OPTION]... [MODE-ARG]...
6264 Provide generalized library-building support services.
6266 --config show all configuration variables
6267 --debug enable verbose shell tracing
6268 -n, --dry-run display commands without modifying any files
6269 --features display basic configuration information and exit
6270 --finish same as \`--mode=finish'
6271 --help display this help message and exit
6272 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6273 --quiet same as \`--silent'
6274 --silent don't print informational messages
6275 --tag=TAG use configuration variables from tag TAG
6276 --version print version information
6278 MODE must be one of the following:
6280 clean remove files from the build directory
6281 compile compile a source file into a libtool object
6282 execute automatically set library path, then run a program
6283 finish complete the installation of libtool libraries
6284 install install libraries or executables
6285 link create a library or an executable
6286 uninstall remove libraries from an installed directory
6288 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6289 a more detailed description of MODE.
6291 Report bugs to <bug-libtool@gnu.org>."
6292 exit 0
6295 clean)
6296 $echo \
6297 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6299 Remove files from the build directory.
6301 RM is the name of the program to use to delete files associated with each FILE
6302 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6303 to RM.
6305 If FILE is a libtool library, object or program, all the files associated
6306 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6309 compile)
6310 $echo \
6311 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6313 Compile a source file into a libtool library object.
6315 This mode accepts the following additional options:
6317 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6318 -prefer-pic try to building PIC objects only
6319 -prefer-non-pic try to building non-PIC objects only
6320 -static always build a \`.o' file suitable for static linking
6322 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6323 from the given SOURCEFILE.
6325 The output file name is determined by removing the directory component from
6326 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6327 library object suffix, \`.lo'."
6330 execute)
6331 $echo \
6332 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6334 Automatically set library path, then run a program.
6336 This mode accepts the following additional options:
6338 -dlopen FILE add the directory containing FILE to the library path
6340 This mode sets the library path environment variable according to \`-dlopen'
6341 flags.
6343 If any of the ARGS are libtool executable wrappers, then they are translated
6344 into their corresponding uninstalled binary, and any of their required library
6345 directories are added to the library path.
6347 Then, COMMAND is executed, with ARGS as arguments."
6350 finish)
6351 $echo \
6352 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6354 Complete the installation of libtool libraries.
6356 Each LIBDIR is a directory that contains libtool libraries.
6358 The commands that this mode executes may require superuser privileges. Use
6359 the \`--dry-run' option if you just want to see what would be executed."
6362 install)
6363 $echo \
6364 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6366 Install executables or libraries.
6368 INSTALL-COMMAND is the installation command. The first component should be
6369 either the \`install' or \`cp' program.
6371 The rest of the components are interpreted as arguments to that command (only
6372 BSD-compatible install options are recognized)."
6375 link)
6376 $echo \
6377 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6379 Link object files or libraries together to form another library, or to
6380 create an executable program.
6382 LINK-COMMAND is a command using the C compiler that you would use to create
6383 a program from several object files.
6385 The following components of LINK-COMMAND are treated specially:
6387 -all-static do not do any dynamic linking at all
6388 -avoid-version do not add a version suffix if possible
6389 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6390 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6391 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6392 -export-symbols SYMFILE
6393 try to export only the symbols listed in SYMFILE
6394 -export-symbols-regex REGEX
6395 try to export only the symbols matching REGEX
6396 -LLIBDIR search LIBDIR for required installed libraries
6397 -lNAME OUTPUT-FILE requires the installed library libNAME
6398 -module build a library that can dlopened
6399 -no-fast-install disable the fast-install mode
6400 -no-install link a not-installable executable
6401 -no-undefined declare that a library does not refer to external symbols
6402 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6403 -objectlist FILE Use a list of object files found in FILE to specify objects
6404 -release RELEASE specify package release information
6405 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6406 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6407 -static do not do any dynamic linking of libtool libraries
6408 -version-info CURRENT[:REVISION[:AGE]]
6409 specify library version info [each variable defaults to 0]
6411 All other options (arguments beginning with \`-') are ignored.
6413 Every other argument is treated as a filename. Files ending in \`.la' are
6414 treated as uninstalled libtool libraries, other files are standard or library
6415 object files.
6417 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6418 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6419 required, except when creating a convenience library.
6421 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6422 using \`ar' and \`ranlib', or on Windows using \`lib'.
6424 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6425 is created, otherwise an executable program is created."
6428 uninstall)
6429 $echo \
6430 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6432 Remove libraries from an installation directory.
6434 RM is the name of the program to use to delete files associated with each FILE
6435 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6436 to RM.
6438 If FILE is a libtool library, all the files associated with it are deleted.
6439 Otherwise, only FILE itself is deleted using RM."
6443 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6444 $echo "$help" 1>&2
6445 exit 1
6447 esac
6449 $echo
6450 $echo "Try \`$modename --help' for more information about other modes."
6452 exit 0
6454 # The TAGs below are defined such that we never get into a situation
6455 # in which we disable both kinds of libraries. Given conflicting
6456 # choices, we go for a static library, that is the most portable,
6457 # since we can't tell whether shared libraries were disabled because
6458 # the user asked for that or because the platform doesn't support
6459 # them. This is particularly important on AIX, because we don't
6460 # support having both static and shared libraries enabled at the same
6461 # time on that platform, so we default to a shared-only configuration.
6462 # If a disable-shared tag is given, we'll fallback to a static-only
6463 # configuration. But we'll never go from static-only to shared-only.
6465 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6466 build_libtool_libs=no
6467 build_old_libs=yes
6468 # ### END LIBTOOL TAG CONFIG: disable-shared
6470 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6471 build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
6472 # ### END LIBTOOL TAG CONFIG: disable-static
6474 # Local Variables:
6475 # mode:shell-script
6476 # sh-indentation:2
6477 # End: