Change soft-fail to use the config, rather than env
[rbx.git] / shotgun / external_libs / libltdl / ltmain.sh
blobc7918d4154d29aaed5aa6ed1a5b9cd6018b92f04
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 # Check that we have a working $echo.
28 if test "X$1" = X--no-reexec; then
29 # Discard the --no-reexec flag, and continue.
30 shift
31 elif test "X$1" = X--fallback-echo; then
32 # Avoid inline document here, it may be left over
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35 # Yippee, $echo works!
37 else
38 # Restart under the correct shell, and then maybe $echo will work.
39 exec $SHELL "$0" --no-reexec ${1+"$@"}
42 if test "X$1" = X--fallback-echo; then
43 # used as fallback echo
44 shift
45 cat <<EOF
47 EOF
48 exit 0
51 # The name of this program.
52 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
53 modename="$progname"
55 # Constants.
56 PROGRAM=ltmain.sh
57 PACKAGE=libtool
58 VERSION=1.5
59 TIMESTAMP=" (1.1220 2003/04/05 19:32:58)"
61 default_mode=
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
64 mkdir="mkdir"
65 mv="mv -f"
66 rm="rm -f"
68 # Sed substitution that helps us do robust quoting. It backslashifies
69 # metacharacters that are still active within double-quoted strings.
70 Xsed="${SED}"' -e 1s/^X//'
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72 # test EBCDIC or ASCII
73 case `echo A|od -x` in
74 *[Cc]1*) # EBCDIC based system
75 SP2NL="tr '\100' '\n'"
76 NL2SP="tr '\r\n' '\100\100'"
78 *) # Assume ASCII based system
79 SP2NL="tr '\040' '\012'"
80 NL2SP="tr '\015\012' '\040\040'"
82 esac
84 # NLS nuisances.
85 # Only set LANG and LC_ALL to C if already set.
86 # These must not be set unconditionally because not all systems understand
87 # e.g. LANG=C (notably SCO).
88 # We save the old values to restore during execute mode.
89 if test "${LC_ALL+set}" = set; then
90 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
92 if test "${LANG+set}" = set; then
93 save_LANG="$LANG"; LANG=C; export LANG
96 # Make sure IFS has a sensible default
97 : ${IFS=" "}
99 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
100 $echo "$modename: not configured to build any kind of library" 1>&2
101 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
102 exit 1
105 # Global variables.
106 mode=$default_mode
107 nonopt=
108 prev=
109 prevopt=
110 run=
111 show="$echo"
112 show_help=
113 execute_dlfiles=
114 lo2o="s/\\.lo\$/.${objext}/"
115 o2lo="s/\\.${objext}\$/.lo/"
117 #####################################
118 # Shell function definitions:
119 # This seems to be the best place for them
121 # Need a lot of goo to handle *both* DLLs and import libs
122 # Has to be a shell function in order to 'eat' the argument
123 # that is supplied when $file_magic_command is called.
124 win32_libid () {
125 win32_libid_type="unknown"
126 win32_fileres=`file -L $1 2>/dev/null`
127 case $win32_fileres in
128 *ar\ archive\ import\ library*) # definitely import
129 win32_libid_type="x86 archive import"
131 *ar\ archive*) # could be an import, or static
132 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
133 grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
134 win32_nmres=`eval $NM -f posix -A $1 | \
135 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
136 if test "X$win32_nmres" = "Ximport" ; then
137 win32_libid_type="x86 archive import"
138 else
139 win32_libid_type="x86 archive static"
143 *DLL*)
144 win32_libid_type="x86 DLL"
146 *executable*) # but shell scripts are "executable" too...
147 case $win32_fileres in
148 *MS\ Windows\ PE\ Intel*)
149 win32_libid_type="x86 DLL"
151 esac
153 esac
154 $echo $win32_libid_type
157 # End of Shell function definitions
158 #####################################
160 # Parse our command line options once, thoroughly.
161 while test "$#" -gt 0
163 arg="$1"
164 shift
166 case $arg in
167 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
168 *) optarg= ;;
169 esac
171 # If the previous option needs an argument, assign it.
172 if test -n "$prev"; then
173 case $prev in
174 execute_dlfiles)
175 execute_dlfiles="$execute_dlfiles $arg"
177 tag)
178 tagname="$arg"
180 # Check whether tagname contains only valid characters
181 case $tagname in
182 *[!-_A-Za-z0-9,/]*)
183 $echo "$progname: invalid tag name: $tagname" 1>&2
184 exit 1
186 esac
188 case $tagname in
190 # Don't test for the "default" C tag, as we know, it's there, but
191 # not specially marked.
194 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
195 taglist="$taglist $tagname"
196 # Evaluate the configuration.
197 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
198 else
199 $echo "$progname: ignoring unknown tag $tagname" 1>&2
202 esac
205 eval "$prev=\$arg"
207 esac
209 prev=
210 prevopt=
211 continue
214 # Have we seen a non-optional argument yet?
215 case $arg in
216 --help)
217 show_help=yes
220 --version)
221 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
222 $echo
223 $echo "Copyright (C) 2003 Free Software Foundation, Inc."
224 $echo "This is free software; see the source for copying conditions. There is NO"
225 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
226 exit 0
229 --config)
230 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
231 # Now print the configurations for the tags.
232 for tagname in $taglist; do
233 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
234 done
235 exit 0
238 --debug)
239 $echo "$progname: enabling shell trace mode"
240 set -x
243 --dry-run | -n)
244 run=:
247 --features)
248 $echo "host: $host"
249 if test "$build_libtool_libs" = yes; then
250 $echo "enable shared libraries"
251 else
252 $echo "disable shared libraries"
254 if test "$build_old_libs" = yes; then
255 $echo "enable static libraries"
256 else
257 $echo "disable static libraries"
259 exit 0
262 --finish) mode="finish" ;;
264 --mode) prevopt="--mode" prev=mode ;;
265 --mode=*) mode="$optarg" ;;
267 --preserve-dup-deps) duplicate_deps="yes" ;;
269 --quiet | --silent)
270 show=:
273 --tag) prevopt="--tag" prev=tag ;;
274 --tag=*)
275 set tag "$optarg" ${1+"$@"}
276 shift
277 prev=tag
280 -dlopen)
281 prevopt="-dlopen"
282 prev=execute_dlfiles
286 $echo "$modename: unrecognized option \`$arg'" 1>&2
287 $echo "$help" 1>&2
288 exit 1
292 nonopt="$arg"
293 break
295 esac
296 done
298 if test -n "$prevopt"; then
299 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
300 $echo "$help" 1>&2
301 exit 1
304 # If this variable is set in any of the actions, the command in it
305 # will be execed at the end. This prevents here-documents from being
306 # left over by shells.
307 exec_cmd=
309 if test -z "$show_help"; then
310 archargs=
311 case $host in
312 *-*-darwin*)
313 # For darwin, separate arch arguments and apply them to all compile/link
314 # commands
315 doarch=
316 for arg
318 if test -n "$doarch"; then
319 archargs="$archargs -arch $arg"
320 doarch=
321 continue
323 case $arg in
324 -arch) doarch=y;;
325 esac
326 done
327 esac
329 # Infer the operation mode.
330 if test -z "$mode"; then
331 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
332 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
333 case $nonopt in
334 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
335 mode=link
336 for arg
338 case $arg in
340 mode=compile
341 break
343 esac
344 done
346 *db | *dbx | *strace | *truss)
347 mode=execute
349 *install*|cp|mv)
350 mode=install
352 *rm)
353 mode=uninstall
356 # If we have no mode, but dlfiles were specified, then do execute mode.
357 test -n "$execute_dlfiles" && mode=execute
359 # Just use the default operation mode.
360 if test -z "$mode"; then
361 if test -n "$nonopt"; then
362 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
363 else
364 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
368 esac
371 # Only execute mode is allowed to have -dlopen flags.
372 if test -n "$execute_dlfiles" && test "$mode" != execute; then
373 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
374 $echo "$help" 1>&2
375 exit 1
378 # Change the help message to a mode-specific one.
379 generic_help="$help"
380 help="Try \`$modename --help --mode=$mode' for more information."
382 # These modes are in order of execution frequency so that they run quickly.
383 case $mode in
384 # libtool compile mode
385 compile)
386 modename="$modename: compile"
387 # Get the compilation command and the source file.
388 base_compile=
389 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
390 suppress_output=
391 arg_mode=normal
392 libobj=
394 for arg
396 case "$arg_mode" in
397 arg )
398 # do not "continue". Instead, add this to base_compile
399 lastarg="$arg"
400 arg_mode=normal
403 target )
404 libobj="$arg"
405 arg_mode=normal
406 continue
409 normal )
410 # Accept any command-line options.
411 case $arg in
413 if test -n "$libobj" ; then
414 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
415 exit 1
417 arg_mode=target
418 continue
421 -static)
422 build_old_libs=yes
423 continue
426 -prefer-pic)
427 pic_mode=yes
428 continue
431 -prefer-non-pic)
432 pic_mode=no
433 continue
436 -Xcompiler)
437 arg_mode=arg # the next one goes into the "base_compile" arg list
438 continue # The current "srcfile" will either be retained or
439 ;; # replaced later. I would guess that would be a bug.
441 -Wc,*)
442 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
443 lastarg=
444 save_ifs="$IFS"; IFS=','
445 for arg in $args; do
446 IFS="$save_ifs"
448 # Double-quote args containing other shell metacharacters.
449 # Many Bourne shells cannot handle close brackets correctly
450 # in scan sets, so we specify it separately.
451 case $arg in
452 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
453 arg="\"$arg\""
455 esac
456 lastarg="$lastarg $arg"
457 done
458 IFS="$save_ifs"
459 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
461 # Add the arguments to base_compile.
462 base_compile="$base_compile $lastarg"
463 continue
467 # Accept the current argument as the source file.
468 # The previous "srcfile" becomes the current argument.
470 lastarg="$srcfile"
471 srcfile="$arg"
473 esac # case $arg
475 esac # case $arg_mode
477 # Aesthetically quote the previous argument.
478 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
480 case $lastarg in
481 # Double-quote args containing other shell metacharacters.
482 # Many Bourne shells cannot handle close brackets correctly
483 # in scan sets, so we specify it separately.
484 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
485 lastarg="\"$lastarg\""
487 esac
489 base_compile="$base_compile $lastarg"
490 done # for arg
492 case $arg_mode in
493 arg)
494 $echo "$modename: you must specify an argument for -Xcompile"
495 exit 1
497 target)
498 $echo "$modename: you must specify a target with \`-o'" 1>&2
499 exit 1
502 # Get the name of the library object.
503 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
505 esac
507 # Recognize several different file suffixes.
508 # If the user specifies -o file.o, it is replaced with file.lo
509 xform='[cCFSifmso]'
510 case $libobj in
511 *.ada) xform=ada ;;
512 *.adb) xform=adb ;;
513 *.ads) xform=ads ;;
514 *.asm) xform=asm ;;
515 *.c++) xform=c++ ;;
516 *.cc) xform=cc ;;
517 *.ii) xform=ii ;;
518 *.class) xform=class ;;
519 *.cpp) xform=cpp ;;
520 *.cxx) xform=cxx ;;
521 *.f90) xform=f90 ;;
522 *.for) xform=for ;;
523 *.java) xform=java ;;
524 esac
526 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
528 case $libobj in
529 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
531 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
532 exit 1
534 esac
536 # Infer tagged configuration to use if any are available and
537 # if one wasn't chosen via the "--tag" command line option.
538 # Only attempt this if the compiler in the base compile
539 # command doesn't match the default compiler.
540 if test -n "$available_tags" && test -z "$tagname"; then
541 case $base_compile in
542 # Blanks in the command may have been stripped by the calling shell,
543 # but not from the CC environment variable when configure was run.
544 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
545 # Blanks at the start of $base_compile will cause this to fail
546 # if we don't check for them as well.
548 for z in $available_tags; do
549 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
550 # Evaluate the configuration.
551 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
552 case "$base_compile " in
553 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
554 # The compiler in the base compile command matches
555 # the one in the tagged configuration.
556 # Assume this is the tagged configuration we want.
557 tagname=$z
558 break
560 esac
562 done
563 # If $tagname still isn't set, then no tagged configuration
564 # was found and let the user know that the "--tag" command
565 # line option must be used.
566 if test -z "$tagname"; then
567 $echo "$modename: unable to infer tagged configuration"
568 $echo "$modename: specify a tag with \`--tag'" 1>&2
569 exit 1
570 # else
571 # $echo "$modename: using $tagname tagged configuration"
574 esac
577 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
578 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
579 if test "X$xdir" = "X$obj"; then
580 xdir=
581 else
582 xdir=$xdir/
584 lobj=${xdir}$objdir/$objname
586 if test -z "$base_compile"; then
587 $echo "$modename: you must specify a compilation command" 1>&2
588 $echo "$help" 1>&2
589 exit 1
592 # Delete any leftover library objects.
593 if test "$build_old_libs" = yes; then
594 removelist="$obj $lobj $libobj ${libobj}T"
595 else
596 removelist="$lobj $libobj ${libobj}T"
599 $run $rm $removelist
600 trap "$run $rm $removelist; exit 1" 1 2 15
602 # On Cygwin there's no "real" PIC flag so we must build both object types
603 case $host_os in
604 cygwin* | mingw* | pw32* | os2*)
605 pic_mode=default
607 esac
608 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
609 # non-PIC code in shared libraries is not supported
610 pic_mode=default
613 # Calculate the filename of the output object if compiler does
614 # not support -o with -c
615 if test "$compiler_c_o" = no; then
616 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
617 lockfile="$output_obj.lock"
618 removelist="$removelist $output_obj $lockfile"
619 trap "$run $rm $removelist; exit 1" 1 2 15
620 else
621 output_obj=
622 need_locks=no
623 lockfile=
626 # Lock this critical section if it is needed
627 # We use this script file to make the link, it avoids creating a new file
628 if test "$need_locks" = yes; then
629 until $run ln "$0" "$lockfile" 2>/dev/null; do
630 $show "Waiting for $lockfile to be removed"
631 sleep 2
632 done
633 elif test "$need_locks" = warn; then
634 if test -f "$lockfile"; then
635 $echo "\
636 *** ERROR, $lockfile exists and contains:
637 `cat $lockfile 2>/dev/null`
639 This indicates that another process is trying to use the same
640 temporary object file, and libtool could not work around it because
641 your compiler does not support \`-c' and \`-o' together. If you
642 repeat this compilation, it may succeed, by chance, but you had better
643 avoid parallel builds (make -j) in this platform, or get a better
644 compiler."
646 $run $rm $removelist
647 exit 1
649 $echo $srcfile > "$lockfile"
652 if test -n "$fix_srcfile_path"; then
653 eval srcfile=\"$fix_srcfile_path\"
656 $run $rm "$libobj" "${libobj}T"
658 # Create a libtool object file (analogous to a ".la" file),
659 # but don't create it if we're doing a dry run.
660 test -z "$run" && cat > ${libobj}T <<EOF
661 # $libobj - a libtool object file
662 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
664 # Please DO NOT delete this file!
665 # It is necessary for linking the library.
667 # Name of the PIC object.
670 # Only build a PIC object if we are building libtool libraries.
671 if test "$build_libtool_libs" = yes; then
672 # Without this assignment, base_compile gets emptied.
673 fbsd_hideous_sh_bug=$base_compile
675 if test "$pic_mode" != no; then
676 command="$base_compile $srcfile $pic_flag"
677 else
678 # Don't build PIC code
679 command="$base_compile $srcfile"
682 if test ! -d "${xdir}$objdir"; then
683 $show "$mkdir ${xdir}$objdir"
684 $run $mkdir ${xdir}$objdir
685 status=$?
686 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
687 exit $status
691 if test -z "$output_obj"; then
692 # Place PIC objects in $objdir
693 command="$command -o $lobj"
696 $run $rm "$lobj" "$output_obj"
698 $show "$command"
699 if $run eval "$command"; then :
700 else
701 test -n "$output_obj" && $run $rm $removelist
702 exit 1
705 if test "$need_locks" = warn &&
706 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
707 $echo "\
708 *** ERROR, $lockfile contains:
709 `cat $lockfile 2>/dev/null`
711 but it should contain:
712 $srcfile
714 This indicates that another process is trying to use the same
715 temporary object file, and libtool could not work around it because
716 your compiler does not support \`-c' and \`-o' together. If you
717 repeat this compilation, it may succeed, by chance, but you had better
718 avoid parallel builds (make -j) in this platform, or get a better
719 compiler."
721 $run $rm $removelist
722 exit 1
725 # Just move the object if needed, then go on to compile the next one
726 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
727 $show "$mv $output_obj $lobj"
728 if $run $mv $output_obj $lobj; then :
729 else
730 error=$?
731 $run $rm $removelist
732 exit $error
736 # Append the name of the PIC object to the libtool object file.
737 test -z "$run" && cat >> ${libobj}T <<EOF
738 pic_object='$objdir/$objname'
742 # Allow error messages only from the first compilation.
743 suppress_output=' >/dev/null 2>&1'
744 else
745 # No PIC object so indicate it doesn't exist in the libtool
746 # object file.
747 test -z "$run" && cat >> ${libobj}T <<EOF
748 pic_object=none
753 # Only build a position-dependent object if we build old libraries.
754 if test "$build_old_libs" = yes; then
755 if test "$pic_mode" != yes; then
756 # Don't build PIC code
757 command="$base_compile $srcfile"
758 else
759 command="$base_compile $srcfile $pic_flag"
761 if test "$compiler_c_o" = yes; then
762 command="$command -o $obj"
765 # Suppress compiler output if we already did a PIC compilation.
766 command="$command$suppress_output"
767 $run $rm "$obj" "$output_obj"
768 $show "$command"
769 if $run eval "$command"; then :
770 else
771 $run $rm $removelist
772 exit 1
775 if test "$need_locks" = warn &&
776 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
777 $echo "\
778 *** ERROR, $lockfile contains:
779 `cat $lockfile 2>/dev/null`
781 but it should contain:
782 $srcfile
784 This indicates that another process is trying to use the same
785 temporary object file, and libtool could not work around it because
786 your compiler does not support \`-c' and \`-o' together. If you
787 repeat this compilation, it may succeed, by chance, but you had better
788 avoid parallel builds (make -j) in this platform, or get a better
789 compiler."
791 $run $rm $removelist
792 exit 1
795 # Just move the object if needed
796 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
797 $show "$mv $output_obj $obj"
798 if $run $mv $output_obj $obj; then :
799 else
800 error=$?
801 $run $rm $removelist
802 exit $error
806 # Append the name of the non-PIC object the libtool object file.
807 # Only append if the libtool object file exists.
808 test -z "$run" && cat >> ${libobj}T <<EOF
809 # Name of the non-PIC object.
810 non_pic_object='$objname'
813 else
814 # Append the name of the non-PIC object the libtool object file.
815 # Only append if the libtool object file exists.
816 test -z "$run" && cat >> ${libobj}T <<EOF
817 # Name of the non-PIC object.
818 non_pic_object=none
823 $run $mv "${libobj}T" "${libobj}"
825 # Unlock the critical section if it was locked
826 if test "$need_locks" != no; then
827 $run $rm "$lockfile"
830 exit 0
833 # libtool link mode
834 link | relink)
835 modename="$modename: link"
836 case $host in
837 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
838 # It is impossible to link a dll without this setting, and
839 # we shouldn't force the makefile maintainer to figure out
840 # which system we are compiling for in order to pass an extra
841 # flag for every libtool invocation.
842 # allow_undefined=no
844 # FIXME: Unfortunately, there are problems with the above when trying
845 # to make a dll which has undefined symbols, in which case not
846 # even a static library is built. For now, we need to specify
847 # -no-undefined on the libtool link line when we can be certain
848 # that all symbols are satisfied, otherwise we get a static library.
849 allow_undefined=yes
852 allow_undefined=yes
854 esac
855 libtool_args="$nonopt"
856 base_compile="$nonopt"
857 compile_command="$nonopt"
858 finalize_command="$nonopt"
860 compile_rpath=
861 finalize_rpath=
862 compile_shlibpath=
863 finalize_shlibpath=
864 convenience=
865 old_convenience=
866 deplibs=
867 old_deplibs=
868 compiler_flags=
869 linker_flags=
870 dllsearchpath=
871 lib_search_path=`pwd`
872 inst_prefix_dir=
874 avoid_version=no
875 dlfiles=
876 dlprefiles=
877 dlself=no
878 export_dynamic=no
879 export_symbols=
880 export_symbols_regex=
881 generated=
882 libobjs=
883 ltlibs=
884 module=no
885 no_install=no
886 objs=
887 non_pic_objects=
888 prefer_static_libs=no
889 preload=no
890 prev=
891 prevarg=
892 release=
893 rpath=
894 xrpath=
895 perm_rpath=
896 temp_rpath=
897 thread_safe=no
898 vinfo=
899 vinfo_number=no
901 # We need to know -static, to get the right output filenames.
902 for arg
904 case $arg in
905 -all-static | -static)
906 if test "X$arg" = "X-all-static"; then
907 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
908 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
910 if test -n "$link_static_flag"; then
911 dlopen_self=$dlopen_self_static
913 else
914 if test -z "$pic_flag" && test -n "$link_static_flag"; then
915 dlopen_self=$dlopen_self_static
918 build_libtool_libs=no
919 build_old_libs=yes
920 prefer_static_libs=yes
921 break
923 esac
924 done
926 # See if our shared archives depend on static archives.
927 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
929 # Go through the arguments, transforming them on the way.
930 while test "$#" -gt 0; do
931 arg="$1"
932 base_compile="$base_compile $arg"
933 shift
934 case $arg in
935 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
936 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
938 *) qarg=$arg ;;
939 esac
940 libtool_args="$libtool_args $qarg"
942 # If the previous option needs an argument, assign it.
943 if test -n "$prev"; then
944 case $prev in
945 output)
946 compile_command="$compile_command @OUTPUT@"
947 finalize_command="$finalize_command @OUTPUT@"
949 esac
951 case $prev in
952 dlfiles|dlprefiles)
953 if test "$preload" = no; then
954 # Add the symbol object into the linking commands.
955 compile_command="$compile_command @SYMFILE@"
956 finalize_command="$finalize_command @SYMFILE@"
957 preload=yes
959 case $arg in
960 *.la | *.lo) ;; # We handle these cases below.
961 force)
962 if test "$dlself" = no; then
963 dlself=needless
964 export_dynamic=yes
966 prev=
967 continue
969 self)
970 if test "$prev" = dlprefiles; then
971 dlself=yes
972 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
973 dlself=yes
974 else
975 dlself=needless
976 export_dynamic=yes
978 prev=
979 continue
982 if test "$prev" = dlfiles; then
983 dlfiles="$dlfiles $arg"
984 else
985 dlprefiles="$dlprefiles $arg"
987 prev=
988 continue
990 esac
992 expsyms)
993 export_symbols="$arg"
994 if test ! -f "$arg"; then
995 $echo "$modename: symbol file \`$arg' does not exist"
996 exit 1
998 prev=
999 continue
1001 expsyms_regex)
1002 export_symbols_regex="$arg"
1003 prev=
1004 continue
1006 inst_prefix)
1007 inst_prefix_dir="$arg"
1008 prev=
1009 continue
1011 release)
1012 release="-$arg"
1013 prev=
1014 continue
1016 objectlist)
1017 if test -f "$arg"; then
1018 save_arg=$arg
1019 moreargs=
1020 for fil in `cat $save_arg`
1022 # moreargs="$moreargs $fil"
1023 arg=$fil
1024 # A libtool-controlled object.
1026 # Check to see that this really is a libtool object.
1027 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1028 pic_object=
1029 non_pic_object=
1031 # Read the .lo file
1032 # If there is no directory component, then add one.
1033 case $arg in
1034 */* | *\\*) . $arg ;;
1035 *) . ./$arg ;;
1036 esac
1038 if test -z "$pic_object" || \
1039 test -z "$non_pic_object" ||
1040 test "$pic_object" = none && \
1041 test "$non_pic_object" = none; then
1042 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1043 exit 1
1046 # Extract subdirectory from the argument.
1047 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1048 if test "X$xdir" = "X$arg"; then
1049 xdir=
1050 else
1051 xdir="$xdir/"
1054 if test "$pic_object" != none; then
1055 # Prepend the subdirectory the object is found in.
1056 pic_object="$xdir$pic_object"
1058 if test "$prev" = dlfiles; then
1059 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1060 dlfiles="$dlfiles $pic_object"
1061 prev=
1062 continue
1063 else
1064 # If libtool objects are unsupported, then we need to preload.
1065 prev=dlprefiles
1069 # CHECK ME: I think I busted this. -Ossama
1070 if test "$prev" = dlprefiles; then
1071 # Preload the old-style object.
1072 dlprefiles="$dlprefiles $pic_object"
1073 prev=
1076 # A PIC object.
1077 libobjs="$libobjs $pic_object"
1078 arg="$pic_object"
1081 # Non-PIC object.
1082 if test "$non_pic_object" != none; then
1083 # Prepend the subdirectory the object is found in.
1084 non_pic_object="$xdir$non_pic_object"
1086 # A standard non-PIC object
1087 non_pic_objects="$non_pic_objects $non_pic_object"
1088 if test -z "$pic_object" || test "$pic_object" = none ; then
1089 arg="$non_pic_object"
1092 else
1093 # Only an error if not doing a dry-run.
1094 if test -z "$run"; then
1095 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1096 exit 1
1097 else
1098 # Dry-run case.
1100 # Extract subdirectory from the argument.
1101 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1102 if test "X$xdir" = "X$arg"; then
1103 xdir=
1104 else
1105 xdir="$xdir/"
1108 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1109 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1110 libobjs="$libobjs $pic_object"
1111 non_pic_objects="$non_pic_objects $non_pic_object"
1114 done
1115 else
1116 $echo "$modename: link input file \`$save_arg' does not exist"
1117 exit 1
1119 arg=$save_arg
1120 prev=
1121 continue
1123 rpath | xrpath)
1124 # We need an absolute path.
1125 case $arg in
1126 [\\/]* | [A-Za-z]:[\\/]*) ;;
1128 $echo "$modename: only absolute run-paths are allowed" 1>&2
1129 exit 1
1131 esac
1132 if test "$prev" = rpath; then
1133 case "$rpath " in
1134 *" $arg "*) ;;
1135 *) rpath="$rpath $arg" ;;
1136 esac
1137 else
1138 case "$xrpath " in
1139 *" $arg "*) ;;
1140 *) xrpath="$xrpath $arg" ;;
1141 esac
1143 prev=
1144 continue
1146 xcompiler)
1147 compiler_flags="$compiler_flags $qarg"
1148 prev=
1149 compile_command="$compile_command $qarg"
1150 finalize_command="$finalize_command $qarg"
1151 continue
1153 xlinker)
1154 linker_flags="$linker_flags $qarg"
1155 compiler_flags="$compiler_flags $wl$qarg"
1156 prev=
1157 compile_command="$compile_command $wl$qarg"
1158 finalize_command="$finalize_command $wl$qarg"
1159 continue
1161 xcclinker)
1162 linker_flags="$linker_flags $qarg"
1163 compiler_flags="$compiler_flags $qarg"
1164 prev=
1165 compile_command="$compile_command $qarg"
1166 finalize_command="$finalize_command $qarg"
1167 continue
1170 eval "$prev=\"\$arg\""
1171 prev=
1172 continue
1174 esac
1175 fi # test -n "$prev"
1177 prevarg="$arg"
1179 case $arg in
1180 -all-static)
1181 if test -n "$link_static_flag"; then
1182 compile_command="$compile_command $link_static_flag"
1183 finalize_command="$finalize_command $link_static_flag"
1185 continue
1188 -allow-undefined)
1189 # FIXME: remove this flag sometime in the future.
1190 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1191 continue
1194 -avoid-version)
1195 avoid_version=yes
1196 continue
1199 -dlopen)
1200 prev=dlfiles
1201 continue
1204 -dlpreopen)
1205 prev=dlprefiles
1206 continue
1209 -export-dynamic)
1210 export_dynamic=yes
1211 continue
1214 -export-symbols | -export-symbols-regex)
1215 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1216 $echo "$modename: more than one -exported-symbols argument is not allowed"
1217 exit 1
1219 if test "X$arg" = "X-export-symbols"; then
1220 prev=expsyms
1221 else
1222 prev=expsyms_regex
1224 continue
1227 -inst-prefix-dir)
1228 prev=inst_prefix
1229 continue
1232 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1233 # so, if we see these flags be careful not to treat them like -L
1234 -L[A-Z][A-Z]*:*)
1235 case $with_gcc/$host in
1236 no/*-*-irix* | /*-*-irix*)
1237 compile_command="$compile_command $arg"
1238 finalize_command="$finalize_command $arg"
1240 esac
1241 continue
1244 -L*)
1245 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1246 # We need an absolute path.
1247 case $dir in
1248 [\\/]* | [A-Za-z]:[\\/]*) ;;
1250 absdir=`cd "$dir" && pwd`
1251 if test -z "$absdir"; then
1252 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1253 exit 1
1255 dir="$absdir"
1257 esac
1258 case "$deplibs " in
1259 *" -L$dir "*) ;;
1261 deplibs="$deplibs -L$dir"
1262 lib_search_path="$lib_search_path $dir"
1264 esac
1265 case $host in
1266 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1267 case :$dllsearchpath: in
1268 *":$dir:"*) ;;
1269 *) dllsearchpath="$dllsearchpath:$dir";;
1270 esac
1272 esac
1273 continue
1276 -l*)
1277 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1278 case $host in
1279 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1280 # These systems don't actually have a C or math library (as such)
1281 continue
1283 *-*-mingw* | *-*-os2*)
1284 # These systems don't actually have a C library (as such)
1285 test "X$arg" = "X-lc" && continue
1287 *-*-openbsd* | *-*-freebsd*)
1288 # Do not include libc due to us having libc/libc_r.
1289 test "X$arg" = "X-lc" && continue
1291 *-*-rhapsody* | *-*-darwin1.[012])
1292 # Rhapsody C and math libraries are in the System framework
1293 deplibs="$deplibs -framework System"
1294 continue
1295 esac
1296 elif test "X$arg" = "X-lc_r"; then
1297 case $host in
1298 *-*-openbsd* | *-*-freebsd*)
1299 # Do not include libc_r directly, use -pthread flag.
1300 continue
1302 esac
1304 deplibs="$deplibs $arg"
1305 continue
1308 -module)
1309 module=yes
1310 continue
1313 # gcc -m* arguments should be passed to the linker via $compiler_flags
1314 # in order to pass architecture information to the linker
1315 # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
1316 # but this is not reliable with gcc because gcc may use -mfoo to
1317 # select a different linker, different libraries, etc, while
1318 # -Wl,-mfoo simply passes -mfoo to the linker.
1319 -m*)
1320 # Unknown arguments in both finalize_command and compile_command need
1321 # to be aesthetically quoted because they are evaled later.
1322 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1323 case $arg in
1324 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1325 arg="\"$arg\""
1327 esac
1328 compile_command="$compile_command $arg"
1329 finalize_command="$finalize_command $arg"
1330 if test "$with_gcc" = "yes" ; then
1331 compiler_flags="$compiler_flags $arg"
1333 continue
1336 -shrext)
1337 prev=shrext
1338 continue
1341 -no-fast-install)
1342 fast_install=no
1343 continue
1346 -no-install)
1347 case $host in
1348 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1349 # The PATH hackery in wrapper scripts is required on Windows
1350 # in order for the loader to find any dlls it needs.
1351 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1352 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1353 fast_install=no
1355 *) no_install=yes ;;
1356 esac
1357 continue
1360 -no-undefined)
1361 allow_undefined=no
1362 continue
1365 -objectlist)
1366 prev=objectlist
1367 continue
1370 -o) prev=output ;;
1372 -release)
1373 prev=release
1374 continue
1377 -rpath)
1378 prev=rpath
1379 continue
1383 prev=xrpath
1384 continue
1387 -R*)
1388 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1389 # We need an absolute path.
1390 case $dir in
1391 [\\/]* | [A-Za-z]:[\\/]*) ;;
1393 $echo "$modename: only absolute run-paths are allowed" 1>&2
1394 exit 1
1396 esac
1397 case "$xrpath " in
1398 *" $dir "*) ;;
1399 *) xrpath="$xrpath $dir" ;;
1400 esac
1401 continue
1404 -static)
1405 # The effects of -static are defined in a previous loop.
1406 # We used to do the same as -all-static on platforms that
1407 # didn't have a PIC flag, but the assumption that the effects
1408 # would be equivalent was wrong. It would break on at least
1409 # Digital Unix and AIX.
1410 continue
1413 -thread-safe)
1414 thread_safe=yes
1415 continue
1418 -version-info)
1419 prev=vinfo
1420 continue
1422 -version-number)
1423 prev=vinfo
1424 vinfo_number=yes
1425 continue
1428 -Wc,*)
1429 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1430 arg=
1431 save_ifs="$IFS"; IFS=','
1432 for flag in $args; do
1433 IFS="$save_ifs"
1434 case $flag in
1435 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1436 flag="\"$flag\""
1438 esac
1439 arg="$arg $wl$flag"
1440 compiler_flags="$compiler_flags $flag"
1441 done
1442 IFS="$save_ifs"
1443 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1446 -Wl,*)
1447 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1448 arg=
1449 save_ifs="$IFS"; IFS=','
1450 for flag in $args; do
1451 IFS="$save_ifs"
1452 case $flag in
1453 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1454 flag="\"$flag\""
1456 esac
1457 arg="$arg $wl$flag"
1458 compiler_flags="$compiler_flags $wl$flag"
1459 linker_flags="$linker_flags $flag"
1460 done
1461 IFS="$save_ifs"
1462 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1465 -Xcompiler)
1466 prev=xcompiler
1467 continue
1470 -Xlinker)
1471 prev=xlinker
1472 continue
1475 -XCClinker)
1476 prev=xcclinker
1477 continue
1480 # Some other compiler flag.
1481 -* | +*)
1482 # Unknown arguments in both finalize_command and compile_command need
1483 # to be aesthetically quoted because they are evaled later.
1484 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1485 case $arg in
1486 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1487 arg="\"$arg\""
1489 esac
1492 *.$objext)
1493 # A standard object.
1494 objs="$objs $arg"
1497 *.lo)
1498 # A libtool-controlled object.
1500 # Check to see that this really is a libtool object.
1501 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1502 pic_object=
1503 non_pic_object=
1505 # Read the .lo file
1506 # If there is no directory component, then add one.
1507 case $arg in
1508 */* | *\\*) . $arg ;;
1509 *) . ./$arg ;;
1510 esac
1512 if test -z "$pic_object" || \
1513 test -z "$non_pic_object" ||
1514 test "$pic_object" = none && \
1515 test "$non_pic_object" = none; then
1516 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1517 exit 1
1520 # Extract subdirectory from the argument.
1521 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1522 if test "X$xdir" = "X$arg"; then
1523 xdir=
1524 else
1525 xdir="$xdir/"
1528 if test "$pic_object" != none; then
1529 # Prepend the subdirectory the object is found in.
1530 pic_object="$xdir$pic_object"
1532 if test "$prev" = dlfiles; then
1533 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1534 dlfiles="$dlfiles $pic_object"
1535 prev=
1536 continue
1537 else
1538 # If libtool objects are unsupported, then we need to preload.
1539 prev=dlprefiles
1543 # CHECK ME: I think I busted this. -Ossama
1544 if test "$prev" = dlprefiles; then
1545 # Preload the old-style object.
1546 dlprefiles="$dlprefiles $pic_object"
1547 prev=
1550 # A PIC object.
1551 libobjs="$libobjs $pic_object"
1552 arg="$pic_object"
1555 # Non-PIC object.
1556 if test "$non_pic_object" != none; then
1557 # Prepend the subdirectory the object is found in.
1558 non_pic_object="$xdir$non_pic_object"
1560 # A standard non-PIC object
1561 non_pic_objects="$non_pic_objects $non_pic_object"
1562 if test -z "$pic_object" || test "$pic_object" = none ; then
1563 arg="$non_pic_object"
1566 else
1567 # Only an error if not doing a dry-run.
1568 if test -z "$run"; then
1569 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1570 exit 1
1571 else
1572 # Dry-run case.
1574 # Extract subdirectory from the argument.
1575 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1576 if test "X$xdir" = "X$arg"; then
1577 xdir=
1578 else
1579 xdir="$xdir/"
1582 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1583 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1584 libobjs="$libobjs $pic_object"
1585 non_pic_objects="$non_pic_objects $non_pic_object"
1590 *.$libext)
1591 # An archive.
1592 deplibs="$deplibs $arg"
1593 old_deplibs="$old_deplibs $arg"
1594 continue
1597 *.la)
1598 # A libtool-controlled library.
1600 if test "$prev" = dlfiles; then
1601 # This library was specified with -dlopen.
1602 dlfiles="$dlfiles $arg"
1603 prev=
1604 elif test "$prev" = dlprefiles; then
1605 # The library was specified with -dlpreopen.
1606 dlprefiles="$dlprefiles $arg"
1607 prev=
1608 else
1609 deplibs="$deplibs $arg"
1611 continue
1614 # Some other compiler argument.
1616 # Unknown arguments in both finalize_command and compile_command need
1617 # to be aesthetically quoted because they are evaled later.
1618 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1619 case $arg in
1620 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1621 arg="\"$arg\""
1623 esac
1625 esac # arg
1627 # Now actually substitute the argument into the commands.
1628 if test -n "$arg"; then
1629 compile_command="$compile_command $arg"
1630 finalize_command="$finalize_command $arg"
1632 done # argument parsing loop
1634 if test -n "$prev"; then
1635 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1636 $echo "$help" 1>&2
1637 exit 1
1640 # Infer tagged configuration to use if any are available and
1641 # if one wasn't chosen via the "--tag" command line option.
1642 # Only attempt this if the compiler in the base link
1643 # command doesn't match the default compiler.
1644 if test -n "$available_tags" && test -z "$tagname"; then
1645 case $base_compile in
1646 # Blanks in the command may have been stripped by the calling shell,
1647 # but not from the CC environment variable when configure was run.
1648 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1649 # Blanks at the start of $base_compile will cause this to fail
1650 # if we don't check for them as well.
1652 for z in $available_tags; do
1653 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1654 # Evaluate the configuration.
1655 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1656 case $base_compile in
1657 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1658 # The compiler in $compile_command matches
1659 # the one in the tagged configuration.
1660 # Assume this is the tagged configuration we want.
1661 tagname=$z
1662 break
1664 esac
1666 done
1667 # If $tagname still isn't set, then no tagged configuration
1668 # was found and let the user know that the "--tag" command
1669 # line option must be used.
1670 if test -z "$tagname"; then
1671 $echo "$modename: unable to infer tagged configuration"
1672 $echo "$modename: specify a tag with \`--tag'" 1>&2
1673 exit 1
1674 # else
1675 # $echo "$modename: using $tagname tagged configuration"
1678 esac
1681 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1682 eval arg=\"$export_dynamic_flag_spec\"
1683 compile_command="$compile_command $arg"
1684 finalize_command="$finalize_command $arg"
1687 oldlibs=
1688 # calculate the name of the file, without its directory
1689 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1690 libobjs_save="$libobjs"
1692 if test -n "$shlibpath_var"; then
1693 # get the directories listed in $shlibpath_var
1694 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1695 else
1696 shlib_search_path=
1698 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1699 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1701 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1702 if test "X$output_objdir" = "X$output"; then
1703 output_objdir="$objdir"
1704 else
1705 output_objdir="$output_objdir/$objdir"
1707 # Create the object directory.
1708 if test ! -d "$output_objdir"; then
1709 $show "$mkdir $output_objdir"
1710 $run $mkdir $output_objdir
1711 status=$?
1712 if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1713 exit $status
1717 # Determine the type of output
1718 case $output in
1720 $echo "$modename: you must specify an output file" 1>&2
1721 $echo "$help" 1>&2
1722 exit 1
1724 *.$libext) linkmode=oldlib ;;
1725 *.lo | *.$objext) linkmode=obj ;;
1726 *.la) linkmode=lib ;;
1727 *) linkmode=prog ;; # Anything else should be a program.
1728 esac
1730 case $host in
1731 *cygwin* | *mingw* | *pw32*)
1732 # don't eliminate duplcations in $postdeps and $predeps
1733 duplicate_compiler_generated_deps=yes
1736 duplicate_compiler_generated_deps=$duplicate_deps
1738 esac
1739 specialdeplibs=
1741 libs=
1742 # Find all interdependent deplibs by searching for libraries
1743 # that are linked more than once (e.g. -la -lb -la)
1744 for deplib in $deplibs; do
1745 if test "X$duplicate_deps" = "Xyes" ; then
1746 case "$libs " in
1747 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1748 esac
1750 libs="$libs $deplib"
1751 done
1753 if test "$linkmode" = lib; then
1754 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1756 # Compute libraries that are listed more than once in $predeps
1757 # $postdeps and mark them as special (i.e., whose duplicates are
1758 # not to be eliminated).
1759 pre_post_deps=
1760 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1761 for pre_post_dep in $predeps $postdeps; do
1762 case "$pre_post_deps " in
1763 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1764 esac
1765 pre_post_deps="$pre_post_deps $pre_post_dep"
1766 done
1768 pre_post_deps=
1771 deplibs=
1772 newdependency_libs=
1773 newlib_search_path=
1774 need_relink=no # whether we're linking any uninstalled libtool libraries
1775 notinst_deplibs= # not-installed libtool libraries
1776 notinst_path= # paths that contain not-installed libtool libraries
1777 case $linkmode in
1778 lib)
1779 passes="conv link"
1780 for file in $dlfiles $dlprefiles; do
1781 case $file in
1782 *.la) ;;
1784 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1785 exit 1
1787 esac
1788 done
1790 prog)
1791 compile_deplibs=
1792 finalize_deplibs=
1793 alldeplibs=no
1794 newdlfiles=
1795 newdlprefiles=
1796 passes="conv scan dlopen dlpreopen link"
1798 *) passes="conv"
1800 esac
1801 for pass in $passes; do
1802 if test "$linkmode,$pass" = "lib,link" ||
1803 test "$linkmode,$pass" = "prog,scan"; then
1804 libs="$deplibs"
1805 deplibs=
1807 if test "$linkmode" = prog; then
1808 case $pass in
1809 dlopen) libs="$dlfiles" ;;
1810 dlpreopen) libs="$dlprefiles" ;;
1811 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1812 esac
1814 if test "$pass" = dlopen; then
1815 # Collect dlpreopened libraries
1816 save_deplibs="$deplibs"
1817 deplibs=
1819 for deplib in $libs; do
1820 lib=
1821 found=no
1822 case $deplib in
1823 -l*)
1824 if test "$linkmode" != lib && test "$linkmode" != prog; then
1825 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1826 continue
1828 if test "$pass" = conv; then
1829 deplibs="$deplib $deplibs"
1830 continue
1832 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1833 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1834 # Search the libtool library
1835 lib="$searchdir/lib${name}.la"
1836 if test -f "$lib"; then
1837 found=yes
1838 break
1840 done
1841 if test "$found" != yes; then
1842 # deplib doesn't seem to be a libtool library
1843 if test "$linkmode,$pass" = "prog,link"; then
1844 compile_deplibs="$deplib $compile_deplibs"
1845 finalize_deplibs="$deplib $finalize_deplibs"
1846 else
1847 deplibs="$deplib $deplibs"
1848 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1850 continue
1851 else # deplib is a libtool library
1852 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1853 # We need to do some special things here, and not later.
1854 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1855 case " $predeps $postdeps " in
1856 *" $deplib "*)
1857 if (${SED} -e '2q' $lib |
1858 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1859 library_names=
1860 old_library=
1861 case $lib in
1862 */* | *\\*) . $lib ;;
1863 *) . ./$lib ;;
1864 esac
1865 for l in $old_library $library_names; do
1866 ll="$l"
1867 done
1868 if test "X$ll" = "X$old_library" ; then # only static version available
1869 found=no
1870 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1871 test "X$ladir" = "X$lib" && ladir="."
1872 lib=$ladir/$old_library
1873 if test "$linkmode,$pass" = "prog,link"; then
1874 compile_deplibs="$deplib $compile_deplibs"
1875 finalize_deplibs="$deplib $finalize_deplibs"
1876 else
1877 deplibs="$deplib $deplibs"
1878 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1880 continue
1884 *) ;;
1885 esac
1888 ;; # -l
1889 -L*)
1890 case $linkmode in
1891 lib)
1892 deplibs="$deplib $deplibs"
1893 test "$pass" = conv && continue
1894 newdependency_libs="$deplib $newdependency_libs"
1895 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1897 prog)
1898 if test "$pass" = conv; then
1899 deplibs="$deplib $deplibs"
1900 continue
1902 if test "$pass" = scan; then
1903 deplibs="$deplib $deplibs"
1904 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1905 else
1906 compile_deplibs="$deplib $compile_deplibs"
1907 finalize_deplibs="$deplib $finalize_deplibs"
1911 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1913 esac # linkmode
1914 continue
1915 ;; # -L
1916 -R*)
1917 if test "$pass" = link; then
1918 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1919 # Make sure the xrpath contains only unique directories.
1920 case "$xrpath " in
1921 *" $dir "*) ;;
1922 *) xrpath="$xrpath $dir" ;;
1923 esac
1925 deplibs="$deplib $deplibs"
1926 continue
1928 *.la) lib="$deplib" ;;
1929 *.$libext)
1930 if test "$pass" = conv; then
1931 deplibs="$deplib $deplibs"
1932 continue
1934 case $linkmode in
1935 lib)
1936 if test "$deplibs_check_method" != pass_all; then
1937 $echo
1938 $echo "*** Warning: Trying to link with static lib archive $deplib."
1939 $echo "*** I have the capability to make that library automatically link in when"
1940 $echo "*** you link to this library. But I can only do this if you have a"
1941 $echo "*** shared version of the library, which you do not appear to have"
1942 $echo "*** because the file extensions .$libext of this argument makes me believe"
1943 $echo "*** that it is just a static archive that I should not used here."
1944 else
1945 $echo
1946 $echo "*** Warning: Linking the shared library $output against the"
1947 $echo "*** static library $deplib is not portable!"
1948 deplibs="$deplib $deplibs"
1950 continue
1952 prog)
1953 if test "$pass" != link; then
1954 deplibs="$deplib $deplibs"
1955 else
1956 compile_deplibs="$deplib $compile_deplibs"
1957 finalize_deplibs="$deplib $finalize_deplibs"
1959 continue
1961 esac # linkmode
1962 ;; # *.$libext
1963 *.lo | *.$objext)
1964 if test "$pass" = conv; then
1965 deplibs="$deplib $deplibs"
1966 elif test "$linkmode" = prog; then
1967 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1968 # If there is no dlopen support or we're linking statically,
1969 # we need to preload.
1970 newdlprefiles="$newdlprefiles $deplib"
1971 compile_deplibs="$deplib $compile_deplibs"
1972 finalize_deplibs="$deplib $finalize_deplibs"
1973 else
1974 newdlfiles="$newdlfiles $deplib"
1977 continue
1979 %DEPLIBS%)
1980 alldeplibs=yes
1981 continue
1983 esac # case $deplib
1984 if test "$found" = yes || test -f "$lib"; then :
1985 else
1986 $echo "$modename: cannot find the library \`$lib'" 1>&2
1987 exit 1
1990 # Check to see that this really is a libtool archive.
1991 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1992 else
1993 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1994 exit 1
1997 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1998 test "X$ladir" = "X$lib" && ladir="."
2000 dlname=
2001 dlopen=
2002 dlpreopen=
2003 libdir=
2004 library_names=
2005 old_library=
2006 # If the library was installed with an old release of libtool,
2007 # it will not redefine variables installed, or shouldnotlink
2008 installed=yes
2009 shouldnotlink=no
2011 # Read the .la file
2012 case $lib in
2013 */* | *\\*) . $lib ;;
2014 *) . ./$lib ;;
2015 esac
2017 if test "$linkmode,$pass" = "lib,link" ||
2018 test "$linkmode,$pass" = "prog,scan" ||
2019 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2020 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2021 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2024 if test "$pass" = conv; then
2025 # Only check for convenience libraries
2026 deplibs="$lib $deplibs"
2027 if test -z "$libdir"; then
2028 if test -z "$old_library"; then
2029 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2030 exit 1
2032 # It is a libtool convenience library, so add in its objects.
2033 convenience="$convenience $ladir/$objdir/$old_library"
2034 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2035 tmp_libs=
2036 for deplib in $dependency_libs; do
2037 deplibs="$deplib $deplibs"
2038 if test "X$duplicate_deps" = "Xyes" ; then
2039 case "$tmp_libs " in
2040 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2041 esac
2043 tmp_libs="$tmp_libs $deplib"
2044 done
2045 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2046 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2047 exit 1
2049 continue
2050 fi # $pass = conv
2053 # Get the name of the library we link against.
2054 linklib=
2055 for l in $old_library $library_names; do
2056 linklib="$l"
2057 done
2058 if test -z "$linklib"; then
2059 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2060 exit 1
2063 # This library was specified with -dlopen.
2064 if test "$pass" = dlopen; then
2065 if test -z "$libdir"; then
2066 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2067 exit 1
2069 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2070 # If there is no dlname, no dlopen support or we're linking
2071 # statically, we need to preload. We also need to preload any
2072 # dependent libraries so libltdl's deplib preloader doesn't
2073 # bomb out in the load deplibs phase.
2074 dlprefiles="$dlprefiles $lib $dependency_libs"
2075 else
2076 newdlfiles="$newdlfiles $lib"
2078 continue
2079 fi # $pass = dlopen
2081 # We need an absolute path.
2082 case $ladir in
2083 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2085 abs_ladir=`cd "$ladir" && pwd`
2086 if test -z "$abs_ladir"; then
2087 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2088 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2089 abs_ladir="$ladir"
2092 esac
2093 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2095 # Find the relevant object directory and library name.
2096 if test "X$installed" = Xyes; then
2097 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2098 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2099 dir="$ladir"
2100 absdir="$abs_ladir"
2101 libdir="$abs_ladir"
2102 else
2103 dir="$libdir"
2104 absdir="$libdir"
2106 else
2107 dir="$ladir/$objdir"
2108 absdir="$abs_ladir/$objdir"
2109 # Remove this search path later
2110 notinst_path="$notinst_path $abs_ladir"
2111 fi # $installed = yes
2112 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2114 # This library was specified with -dlpreopen.
2115 if test "$pass" = dlpreopen; then
2116 if test -z "$libdir"; then
2117 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2118 exit 1
2120 # Prefer using a static library (so that no silly _DYNAMIC symbols
2121 # are required to link).
2122 if test -n "$old_library"; then
2123 newdlprefiles="$newdlprefiles $dir/$old_library"
2124 # Otherwise, use the dlname, so that lt_dlopen finds it.
2125 elif test -n "$dlname"; then
2126 newdlprefiles="$newdlprefiles $dir/$dlname"
2127 else
2128 newdlprefiles="$newdlprefiles $dir/$linklib"
2130 fi # $pass = dlpreopen
2132 if test -z "$libdir"; then
2133 # Link the convenience library
2134 if test "$linkmode" = lib; then
2135 deplibs="$dir/$old_library $deplibs"
2136 elif test "$linkmode,$pass" = "prog,link"; then
2137 compile_deplibs="$dir/$old_library $compile_deplibs"
2138 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2139 else
2140 deplibs="$lib $deplibs" # used for prog,scan pass
2142 continue
2146 if test "$linkmode" = prog && test "$pass" != link; then
2147 newlib_search_path="$newlib_search_path $ladir"
2148 deplibs="$lib $deplibs"
2150 linkalldeplibs=no
2151 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2152 test "$build_libtool_libs" = no; then
2153 linkalldeplibs=yes
2156 tmp_libs=
2157 for deplib in $dependency_libs; do
2158 case $deplib in
2159 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2160 esac
2161 # Need to link against all dependency_libs?
2162 if test "$linkalldeplibs" = yes; then
2163 deplibs="$deplib $deplibs"
2164 else
2165 # Need to hardcode shared library paths
2166 # or/and link against static libraries
2167 newdependency_libs="$deplib $newdependency_libs"
2169 if test "X$duplicate_deps" = "Xyes" ; then
2170 case "$tmp_libs " in
2171 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2172 esac
2174 tmp_libs="$tmp_libs $deplib"
2175 done # for deplib
2176 continue
2177 fi # $linkmode = prog...
2179 if test "$linkmode,$pass" = "prog,link"; then
2180 if test -n "$library_names" &&
2181 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2182 # We need to hardcode the library path
2183 if test -n "$shlibpath_var"; then
2184 # Make sure the rpath contains only unique directories.
2185 case "$temp_rpath " in
2186 *" $dir "*) ;;
2187 *" $absdir "*) ;;
2188 *) temp_rpath="$temp_rpath $dir" ;;
2189 esac
2192 # Hardcode the library path.
2193 # Skip directories that are in the system default run-time
2194 # search path.
2195 case " $sys_lib_dlsearch_path " in
2196 *" $absdir "*) ;;
2198 case "$compile_rpath " in
2199 *" $absdir "*) ;;
2200 *) compile_rpath="$compile_rpath $absdir"
2201 esac
2203 esac
2204 case " $sys_lib_dlsearch_path " in
2205 *" $libdir "*) ;;
2207 case "$finalize_rpath " in
2208 *" $libdir "*) ;;
2209 *) finalize_rpath="$finalize_rpath $libdir"
2210 esac
2212 esac
2213 fi # $linkmode,$pass = prog,link...
2215 if test "$alldeplibs" = yes &&
2216 { test "$deplibs_check_method" = pass_all ||
2217 { test "$build_libtool_libs" = yes &&
2218 test -n "$library_names"; }; }; then
2219 # We only need to search for static libraries
2220 continue
2224 link_static=no # Whether the deplib will be linked statically
2225 if test -n "$library_names" &&
2226 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2227 if test "$installed" = no; then
2228 notinst_deplibs="$notinst_deplibs $lib"
2229 need_relink=yes
2231 # This is a shared library
2233 # Warn about portability, can't link against -module's on some systems (darwin)
2234 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2235 $echo
2236 if test "$linkmode" = prog; then
2237 $echo "*** Warning: Linking the executable $output against the loadable module"
2238 else
2239 $echo "*** Warning: Linking the shared library $output against the loadable module"
2241 $echo "*** $linklib is not portable!"
2243 if test "$linkmode" = lib &&
2244 test "$hardcode_into_libs" = yes; then
2245 # Hardcode the library path.
2246 # Skip directories that are in the system default run-time
2247 # search path.
2248 case " $sys_lib_dlsearch_path " in
2249 *" $absdir "*) ;;
2251 case "$compile_rpath " in
2252 *" $absdir "*) ;;
2253 *) compile_rpath="$compile_rpath $absdir"
2254 esac
2256 esac
2257 case " $sys_lib_dlsearch_path " in
2258 *" $libdir "*) ;;
2260 case "$finalize_rpath " in
2261 *" $libdir "*) ;;
2262 *) finalize_rpath="$finalize_rpath $libdir"
2263 esac
2265 esac
2268 if test -n "$old_archive_from_expsyms_cmds"; then
2269 # figure out the soname
2270 set dummy $library_names
2271 realname="$2"
2272 shift; shift
2273 libname=`eval \\$echo \"$libname_spec\"`
2274 # use dlname if we got it. it's perfectly good, no?
2275 if test -n "$dlname"; then
2276 soname="$dlname"
2277 elif test -n "$soname_spec"; then
2278 # bleh windows
2279 case $host in
2280 *cygwin* | mingw*)
2281 major=`expr $current - $age`
2282 versuffix="-$major"
2284 esac
2285 eval soname=\"$soname_spec\"
2286 else
2287 soname="$realname"
2290 # Make a new name for the extract_expsyms_cmds to use
2291 soroot="$soname"
2292 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2293 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2295 # If the library has no export list, then create one now
2296 if test -f "$output_objdir/$soname-def"; then :
2297 else
2298 $show "extracting exported symbol list from \`$soname'"
2299 save_ifs="$IFS"; IFS=$_S_
2300 eval cmds=\"$extract_expsyms_cmds\"
2301 for cmd in $cmds; do
2302 IFS="$save_ifs"
2303 $show "$cmd"
2304 $run eval "$cmd" || exit $?
2305 done
2306 IFS="$save_ifs"
2309 # Create $newlib
2310 if test -f "$output_objdir/$newlib"; then :; else
2311 $show "generating import library for \`$soname'"
2312 save_ifs="$IFS"; IFS=$_S_
2313 eval cmds=\"$old_archive_from_expsyms_cmds\"
2314 for cmd in $cmds; do
2315 IFS="$save_ifs"
2316 $show "$cmd"
2317 $run eval "$cmd" || exit $?
2318 done
2319 IFS="$save_ifs"
2321 # make sure the library variables are pointing to the new library
2322 dir=$output_objdir
2323 linklib=$newlib
2324 fi # test -n "$old_archive_from_expsyms_cmds"
2326 if test "$linkmode" = prog || test "$mode" != relink; then
2327 add_shlibpath=
2328 add_dir=
2329 add=
2330 lib_linked=yes
2331 case $hardcode_action in
2332 immediate | unsupported)
2333 if test "$hardcode_direct" = no; then
2334 add="$dir/$linklib"
2335 case $host in
2336 *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2337 *-*-darwin* )
2338 # if the lib is a module then we can not link against it, someone
2339 # is ignoring the new warnings I added
2340 if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2341 $echo "** Warning, lib $linklib is a module, not a shared library"
2342 if test -z "$old_library" ; then
2343 $echo
2344 $echo "** And there doesn't seem to be a static archive available"
2345 $echo "** The link will probably fail, sorry"
2346 else
2347 add="$dir/$old_library"
2350 esac
2351 elif test "$hardcode_minus_L" = no; then
2352 case $host in
2353 *-*-sunos*) add_shlibpath="$dir" ;;
2354 esac
2355 add_dir="-L$dir"
2356 add="-l$name"
2357 elif test "$hardcode_shlibpath_var" = no; then
2358 add_shlibpath="$dir"
2359 add="-l$name"
2360 else
2361 lib_linked=no
2364 relink)
2365 if test "$hardcode_direct" = yes; then
2366 add="$dir/$linklib"
2367 elif test "$hardcode_minus_L" = yes; then
2368 add_dir="-L$dir"
2369 # Try looking first in the location we're being installed to.
2370 if test -n "$inst_prefix_dir"; then
2371 case "$libdir" in
2372 [\\/]*)
2373 add_dir="-L$inst_prefix_dir$libdir $add_dir"
2375 esac
2377 add="-l$name"
2378 elif test "$hardcode_shlibpath_var" = yes; then
2379 add_shlibpath="$dir"
2380 add="-l$name"
2381 else
2382 lib_linked=no
2385 *) lib_linked=no ;;
2386 esac
2388 if test "$lib_linked" != yes; then
2389 $echo "$modename: configuration error: unsupported hardcode properties"
2390 exit 1
2393 if test -n "$add_shlibpath"; then
2394 case :$compile_shlibpath: in
2395 *":$add_shlibpath:"*) ;;
2396 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2397 esac
2399 if test "$linkmode" = prog; then
2400 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2401 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2402 else
2403 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2404 test -n "$add" && deplibs="$add $deplibs"
2405 if test "$hardcode_direct" != yes && \
2406 test "$hardcode_minus_L" != yes && \
2407 test "$hardcode_shlibpath_var" = yes; then
2408 case :$finalize_shlibpath: in
2409 *":$libdir:"*) ;;
2410 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2411 esac
2416 if test "$linkmode" = prog || test "$mode" = relink; then
2417 add_shlibpath=
2418 add_dir=
2419 add=
2420 # Finalize command for both is simple: just hardcode it.
2421 if test "$hardcode_direct" = yes; then
2422 add="$libdir/$linklib"
2423 elif test "$hardcode_minus_L" = yes; then
2424 add_dir="-L$libdir"
2425 add="-l$name"
2426 elif test "$hardcode_shlibpath_var" = yes; then
2427 case :$finalize_shlibpath: in
2428 *":$libdir:"*) ;;
2429 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2430 esac
2431 add="-l$name"
2432 elif test "$hardcode_automatic" = yes; then
2433 if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2434 add="$inst_prefix_dir$libdir/$linklib"
2435 else
2436 add="$libdir/$linklib"
2438 else
2439 # We cannot seem to hardcode it, guess we'll fake it.
2440 add_dir="-L$libdir"
2441 # Try looking first in the location we're being installed to.
2442 if test -n "$inst_prefix_dir"; then
2443 case "$libdir" in
2444 [\\/]*)
2445 add_dir="-L$inst_prefix_dir$libdir $add_dir"
2447 esac
2449 add="-l$name"
2452 if test "$linkmode" = prog; then
2453 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2454 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2455 else
2456 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2457 test -n "$add" && deplibs="$add $deplibs"
2460 elif test "$linkmode" = prog; then
2461 # Here we assume that one of hardcode_direct or hardcode_minus_L
2462 # is not unsupported. This is valid on all known static and
2463 # shared platforms.
2464 if test "$hardcode_direct" != unsupported; then
2465 test -n "$old_library" && linklib="$old_library"
2466 compile_deplibs="$dir/$linklib $compile_deplibs"
2467 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2468 else
2469 compile_deplibs="-l$name -L$dir $compile_deplibs"
2470 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2472 elif test "$build_libtool_libs" = yes; then
2473 # Not a shared library
2474 if test "$deplibs_check_method" != pass_all; then
2475 # We're trying link a shared library against a static one
2476 # but the system doesn't support it.
2478 # Just print a warning and add the library to dependency_libs so
2479 # that the program can be linked against the static library.
2480 $echo
2481 $echo "*** Warning: This system can not link to static lib archive $lib."
2482 $echo "*** I have the capability to make that library automatically link in when"
2483 $echo "*** you link to this library. But I can only do this if you have a"
2484 $echo "*** shared version of the library, which you do not appear to have."
2485 if test "$module" = yes; then
2486 $echo "*** But as you try to build a module library, libtool will still create "
2487 $echo "*** a static module, that should work as long as the dlopening application"
2488 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2489 if test -z "$global_symbol_pipe"; then
2490 $echo
2491 $echo "*** However, this would only work if libtool was able to extract symbol"
2492 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2493 $echo "*** not find such a program. So, this module is probably useless."
2494 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2496 if test "$build_old_libs" = no; then
2497 build_libtool_libs=module
2498 build_old_libs=yes
2499 else
2500 build_libtool_libs=no
2503 else
2504 convenience="$convenience $dir/$old_library"
2505 old_convenience="$old_convenience $dir/$old_library"
2506 deplibs="$dir/$old_library $deplibs"
2507 link_static=yes
2509 fi # link shared/static library?
2511 if test "$linkmode" = lib; then
2512 if test -n "$dependency_libs" &&
2513 { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2514 test "$link_static" = yes; }; then
2515 # Extract -R from dependency_libs
2516 temp_deplibs=
2517 for libdir in $dependency_libs; do
2518 case $libdir in
2519 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2520 case " $xrpath " in
2521 *" $temp_xrpath "*) ;;
2522 *) xrpath="$xrpath $temp_xrpath";;
2523 esac;;
2524 *) temp_deplibs="$temp_deplibs $libdir";;
2525 esac
2526 done
2527 dependency_libs="$temp_deplibs"
2530 newlib_search_path="$newlib_search_path $absdir"
2531 # Link against this library
2532 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2533 # ... and its dependency_libs
2534 tmp_libs=
2535 for deplib in $dependency_libs; do
2536 newdependency_libs="$deplib $newdependency_libs"
2537 if test "X$duplicate_deps" = "Xyes" ; then
2538 case "$tmp_libs " in
2539 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2540 esac
2542 tmp_libs="$tmp_libs $deplib"
2543 done
2545 if test "$link_all_deplibs" != no; then
2546 # Add the search paths of all dependency libraries
2547 for deplib in $dependency_libs; do
2548 case $deplib in
2549 -L*) path="$deplib" ;;
2550 *.la)
2551 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2552 test "X$dir" = "X$deplib" && dir="."
2553 # We need an absolute path.
2554 case $dir in
2555 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2557 absdir=`cd "$dir" && pwd`
2558 if test -z "$absdir"; then
2559 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2560 absdir="$dir"
2563 esac
2564 if grep "^installed=no" $deplib > /dev/null; then
2565 path="$absdir/$objdir"
2566 else
2567 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2568 if test -z "$libdir"; then
2569 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2570 exit 1
2572 if test "$absdir" != "$libdir"; then
2573 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2575 path="$absdir"
2577 depdepl=
2578 case $host in
2579 *-*-darwin*)
2580 # we do not want to link against static libs, but need to link against shared
2581 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2582 if test -n "$deplibrary_names" ; then
2583 for tmp in $deplibrary_names ; do
2584 depdepl=$tmp
2585 done
2586 if test -f "$path/$depdepl" ; then
2587 depdepl="$path/$depdepl"
2589 newlib_search_path="$newlib_search_path $path"
2590 path=""
2594 path="-L$path"
2596 esac
2599 -l*)
2600 case $host in
2601 *-*-darwin*)
2602 # Again, we only want to link against shared libraries
2603 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2604 for tmp in $newlib_search_path ; do
2605 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2606 eval depdepl="$tmp/lib$tmp_libs.dylib"
2607 break
2609 done
2610 path=""
2612 *) continue ;;
2613 esac
2615 *) continue ;;
2616 esac
2617 case " $deplibs " in
2618 *" $depdepl "*) ;;
2619 *) deplibs="$deplibs $depdepl" ;;
2620 esac
2621 case " $deplibs " in
2622 *" $path "*) ;;
2623 *) deplibs="$deplibs $path" ;;
2624 esac
2625 done
2626 fi # link_all_deplibs != no
2627 fi # linkmode = lib
2628 done # for deplib in $libs
2629 dependency_libs="$newdependency_libs"
2630 if test "$pass" = dlpreopen; then
2631 # Link the dlpreopened libraries before other libraries
2632 for deplib in $save_deplibs; do
2633 deplibs="$deplib $deplibs"
2634 done
2636 if test "$pass" != dlopen; then
2637 if test "$pass" != conv; then
2638 # Make sure lib_search_path contains only unique directories.
2639 lib_search_path=
2640 for dir in $newlib_search_path; do
2641 case "$lib_search_path " in
2642 *" $dir "*) ;;
2643 *) lib_search_path="$lib_search_path $dir" ;;
2644 esac
2645 done
2646 newlib_search_path=
2649 if test "$linkmode,$pass" != "prog,link"; then
2650 vars="deplibs"
2651 else
2652 vars="compile_deplibs finalize_deplibs"
2654 for var in $vars dependency_libs; do
2655 # Add libraries to $var in reverse order
2656 eval tmp_libs=\"\$$var\"
2657 new_libs=
2658 for deplib in $tmp_libs; do
2659 # FIXME: Pedantically, this is the right thing to do, so
2660 # that some nasty dependency loop isn't accidentally
2661 # broken:
2662 #new_libs="$deplib $new_libs"
2663 # Pragmatically, this seems to cause very few problems in
2664 # practice:
2665 case $deplib in
2666 -L*) new_libs="$deplib $new_libs" ;;
2667 -R*) ;;
2669 # And here is the reason: when a library appears more
2670 # than once as an explicit dependence of a library, or
2671 # is implicitly linked in more than once by the
2672 # compiler, it is considered special, and multiple
2673 # occurrences thereof are not removed. Compare this
2674 # with having the same library being listed as a
2675 # dependency of multiple other libraries: in this case,
2676 # we know (pedantically, we assume) the library does not
2677 # need to be listed more than once, so we keep only the
2678 # last copy. This is not always right, but it is rare
2679 # enough that we require users that really mean to play
2680 # such unportable linking tricks to link the library
2681 # using -Wl,-lname, so that libtool does not consider it
2682 # for duplicate removal.
2683 case " $specialdeplibs " in
2684 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2686 case " $new_libs " in
2687 *" $deplib "*) ;;
2688 *) new_libs="$deplib $new_libs" ;;
2689 esac
2691 esac
2693 esac
2694 done
2695 tmp_libs=
2696 for deplib in $new_libs; do
2697 case $deplib in
2698 -L*)
2699 case " $tmp_libs " in
2700 *" $deplib "*) ;;
2701 *) tmp_libs="$tmp_libs $deplib" ;;
2702 esac
2704 *) tmp_libs="$tmp_libs $deplib" ;;
2705 esac
2706 done
2707 eval $var=\"$tmp_libs\"
2708 done # for var
2710 # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
2711 tmp_libs=
2712 for i in $dependency_libs ; do
2713 case " $predeps $postdeps $compiler_lib_search_path " in
2714 *" $i "*)
2715 i=""
2717 esac
2718 if test -n "$i" ; then
2719 tmp_libs="$tmp_libs $i"
2721 done
2722 dependency_libs=$tmp_libs
2723 done # for pass
2724 if test "$linkmode" = prog; then
2725 dlfiles="$newdlfiles"
2726 dlprefiles="$newdlprefiles"
2729 case $linkmode in
2730 oldlib)
2731 if test -n "$deplibs"; then
2732 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2735 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2736 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2739 if test -n "$rpath"; then
2740 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2743 if test -n "$xrpath"; then
2744 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2747 if test -n "$vinfo"; then
2748 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2751 if test -n "$release"; then
2752 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2755 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2756 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2759 # Now set the variables for building old libraries.
2760 build_libtool_libs=no
2761 oldlibs="$output"
2762 objs="$objs$old_deplibs"
2765 lib)
2766 # Make sure we only generate libraries of the form `libNAME.la'.
2767 case $outputname in
2768 lib*)
2769 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2770 eval shared_ext=\"$shrext\"
2771 eval libname=\"$libname_spec\"
2774 if test "$module" = no; then
2775 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2776 $echo "$help" 1>&2
2777 exit 1
2779 if test "$need_lib_prefix" != no; then
2780 # Add the "lib" prefix for modules if required
2781 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2782 eval shared_ext=\"$shrext\"
2783 eval libname=\"$libname_spec\"
2784 else
2785 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2788 esac
2790 if test -n "$objs"; then
2791 if test "$deplibs_check_method" != pass_all; then
2792 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2793 exit 1
2794 else
2795 $echo
2796 $echo "*** Warning: Linking the shared library $output against the non-libtool"
2797 $echo "*** objects $objs is not portable!"
2798 libobjs="$libobjs $objs"
2802 if test "$dlself" != no; then
2803 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2806 set dummy $rpath
2807 if test "$#" -gt 2; then
2808 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2810 install_libdir="$2"
2812 oldlibs=
2813 if test -z "$rpath"; then
2814 if test "$build_libtool_libs" = yes; then
2815 # Building a libtool convenience library.
2816 # Some compilers have problems with a `.al' extension so
2817 # convenience libraries should have the same extension an
2818 # archive normally would.
2819 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2820 build_libtool_libs=convenience
2821 build_old_libs=yes
2824 if test -n "$vinfo"; then
2825 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2828 if test -n "$release"; then
2829 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2831 else
2833 # Parse the version information argument.
2834 save_ifs="$IFS"; IFS=':'
2835 set dummy $vinfo 0 0 0
2836 IFS="$save_ifs"
2838 if test -n "$8"; then
2839 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2840 $echo "$help" 1>&2
2841 exit 1
2844 # convert absolute version numbers to libtool ages
2845 # this retains compatibility with .la files and attempts
2846 # to make the code below a bit more comprehensible
2848 case $vinfo_number in
2849 yes)
2850 number_major="$2"
2851 number_minor="$3"
2852 number_revision="$4"
2854 # There are really only two kinds -- those that
2855 # use the current revision as the major version
2856 # and those that subtract age and use age as
2857 # a minor version. But, then there is irix
2858 # which has an extra 1 added just for fun
2860 case $version_type in
2861 darwin|linux|osf|windows)
2862 current=`expr $number_major + $number_minor`
2863 age="$number_minor"
2864 revision="$number_revision"
2866 freebsd-aout|freebsd-elf|sunos)
2867 current="$number_major"
2868 revision="$number_minor"
2869 age="0"
2871 irix|nonstopux)
2872 current=`expr $number_major + $number_minor - 1`
2873 age="$number_minor"
2874 revision="$number_minor"
2876 esac
2879 current="$2"
2880 revision="$3"
2881 age="$4"
2883 esac
2885 # Check that each of the things are valid numbers.
2886 case $current in
2887 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2889 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2890 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2891 exit 1
2893 esac
2895 case $revision in
2896 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2898 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2899 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2900 exit 1
2902 esac
2904 case $age in
2905 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2907 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2908 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2909 exit 1
2911 esac
2913 if test "$age" -gt "$current"; then
2914 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2915 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2916 exit 1
2919 # Calculate the version variables.
2920 major=
2921 versuffix=
2922 verstring=
2923 case $version_type in
2924 none) ;;
2926 darwin)
2927 # Like Linux, but with the current version available in
2928 # verstring for coding it into the library header
2929 major=.`expr $current - $age`
2930 versuffix="$major.$age.$revision"
2931 # Darwin ld doesn't like 0 for these options...
2932 minor_current=`expr $current + 1`
2933 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2936 freebsd-aout)
2937 major=".$current"
2938 versuffix=".$current.$revision";
2941 freebsd-elf)
2942 major=".$current"
2943 versuffix=".$current";
2946 irix | nonstopux)
2947 major=`expr $current - $age + 1`
2949 case $version_type in
2950 nonstopux) verstring_prefix=nonstopux ;;
2951 *) verstring_prefix=sgi ;;
2952 esac
2953 verstring="$verstring_prefix$major.$revision"
2955 # Add in all the interfaces that we are compatible with.
2956 loop=$revision
2957 while test "$loop" -ne 0; do
2958 iface=`expr $revision - $loop`
2959 loop=`expr $loop - 1`
2960 verstring="$verstring_prefix$major.$iface:$verstring"
2961 done
2963 # Before this point, $major must not contain `.'.
2964 major=.$major
2965 versuffix="$major.$revision"
2968 linux)
2969 major=.`expr $current - $age`
2970 versuffix="$major.$age.$revision"
2973 osf)
2974 major=.`expr $current - $age`
2975 versuffix=".$current.$age.$revision"
2976 verstring="$current.$age.$revision"
2978 # Add in all the interfaces that we are compatible with.
2979 loop=$age
2980 while test "$loop" -ne 0; do
2981 iface=`expr $current - $loop`
2982 loop=`expr $loop - 1`
2983 verstring="$verstring:${iface}.0"
2984 done
2986 # Make executables depend on our current version.
2987 verstring="$verstring:${current}.0"
2990 sunos)
2991 major=".$current"
2992 versuffix=".$current.$revision"
2995 windows)
2996 # Use '-' rather than '.', since we only want one
2997 # extension on DOS 8.3 filesystems.
2998 major=`expr $current - $age`
2999 versuffix="-$major"
3003 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3004 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3005 exit 1
3007 esac
3009 # Clear the version info if we defaulted, and they specified a release.
3010 if test -z "$vinfo" && test -n "$release"; then
3011 major=
3012 case $version_type in
3013 darwin)
3014 # we can't check for "0.0" in archive_cmds due to quoting
3015 # problems, so we reset it completely
3016 verstring=
3019 verstring="0.0"
3021 esac
3022 if test "$need_version" = no; then
3023 versuffix=
3024 else
3025 versuffix=".0.0"
3029 # Remove version info from name if versioning should be avoided
3030 if test "$avoid_version" = yes && test "$need_version" = no; then
3031 major=
3032 versuffix=
3033 verstring=""
3036 # Check to see if the archive will have undefined symbols.
3037 if test "$allow_undefined" = yes; then
3038 if test "$allow_undefined_flag" = unsupported; then
3039 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3040 build_libtool_libs=no
3041 build_old_libs=yes
3043 else
3044 # Don't allow undefined symbols.
3045 allow_undefined_flag="$no_undefined_flag"
3049 if test "$mode" != relink; then
3050 # Remove our outputs, but don't remove object files since they
3051 # may have been created when compiling PIC objects.
3052 removelist=
3053 tempremovelist=`$echo "$output_objdir/*"`
3054 for p in $tempremovelist; do
3055 case $p in
3056 *.$objext)
3058 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3059 removelist="$removelist $p"
3061 *) ;;
3062 esac
3063 done
3064 if test -n "$removelist"; then
3065 $show "${rm}r $removelist"
3066 $run ${rm}r $removelist
3070 # Now set the variables for building old libraries.
3071 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3072 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3074 # Transform .lo files to .o files.
3075 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3078 # Eliminate all temporary directories.
3079 for path in $notinst_path; do
3080 lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3081 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3082 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3083 done
3085 if test -n "$xrpath"; then
3086 # If the user specified any rpath flags, then add them.
3087 temp_xrpath=
3088 for libdir in $xrpath; do
3089 temp_xrpath="$temp_xrpath -R$libdir"
3090 case "$finalize_rpath " in
3091 *" $libdir "*) ;;
3092 *) finalize_rpath="$finalize_rpath $libdir" ;;
3093 esac
3094 done
3095 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3096 dependency_libs="$temp_xrpath $dependency_libs"
3100 # Make sure dlfiles contains only unique files that won't be dlpreopened
3101 old_dlfiles="$dlfiles"
3102 dlfiles=
3103 for lib in $old_dlfiles; do
3104 case " $dlprefiles $dlfiles " in
3105 *" $lib "*) ;;
3106 *) dlfiles="$dlfiles $lib" ;;
3107 esac
3108 done
3110 # Make sure dlprefiles contains only unique files
3111 old_dlprefiles="$dlprefiles"
3112 dlprefiles=
3113 for lib in $old_dlprefiles; do
3114 case "$dlprefiles " in
3115 *" $lib "*) ;;
3116 *) dlprefiles="$dlprefiles $lib" ;;
3117 esac
3118 done
3120 if test "$build_libtool_libs" = yes; then
3121 if test -n "$rpath"; then
3122 case $host in
3123 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3124 # these systems don't actually have a c library (as such)!
3126 *-*-rhapsody* | *-*-darwin1.[012])
3127 # Rhapsody C library is in the System framework
3128 deplibs="$deplibs -framework System"
3130 *-*-netbsd*)
3131 # Don't link with libc until the a.out ld.so is fixed.
3133 *-*-openbsd* | *-*-freebsd*)
3134 # Do not include libc due to us having libc/libc_r.
3135 test "X$arg" = "X-lc" && continue
3138 # Add libc to deplibs on all other systems if necessary.
3139 if test "$build_libtool_need_lc" = "yes"; then
3140 deplibs="$deplibs -lc"
3143 esac
3146 # Transform deplibs into only deplibs that can be linked in shared.
3147 name_save=$name
3148 libname_save=$libname
3149 release_save=$release
3150 versuffix_save=$versuffix
3151 major_save=$major
3152 # I'm not sure if I'm treating the release correctly. I think
3153 # release should show up in the -l (ie -lgmp5) so we don't want to
3154 # add it in twice. Is that correct?
3155 release=""
3156 versuffix=""
3157 major=""
3158 newdeplibs=
3159 droppeddeps=no
3160 case $deplibs_check_method in
3161 pass_all)
3162 # Don't check for shared/static. Everything works.
3163 # This might be a little naive. We might want to check
3164 # whether the library exists or not. But this is on
3165 # osf3 & osf4 and I'm not really sure... Just
3166 # implementing what was already the behavior.
3167 newdeplibs=$deplibs
3169 test_compile)
3170 # This code stresses the "libraries are programs" paradigm to its
3171 # limits. Maybe even breaks it. We compile a program, linking it
3172 # against the deplibs as a proxy for the library. Then we can check
3173 # whether they linked in statically or dynamically with ldd.
3174 $rm conftest.c
3175 cat > conftest.c <<EOF
3176 int main() { return 0; }
3178 $rm conftest
3179 $LTCC $archargs -o conftest conftest.c $deplibs
3180 if test "$?" -eq 0 ; then
3181 ldd_output=`ldd conftest`
3182 for i in $deplibs; do
3183 name="`expr $i : '-l\(.*\)'`"
3184 # If $name is empty we are operating on a -L argument.
3185 if test "$name" != "" && test "$name" -ne "0"; then
3186 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3187 case " $predeps $postdeps " in
3188 *" $i "*)
3189 newdeplibs="$newdeplibs $i"
3190 i=""
3192 esac
3194 if test -n "$i" ; then
3195 libname=`eval \\$echo \"$libname_spec\"`
3196 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3197 set dummy $deplib_matches
3198 deplib_match=$2
3199 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3200 newdeplibs="$newdeplibs $i"
3201 else
3202 droppeddeps=yes
3203 $echo
3204 $echo "*** Warning: dynamic linker does not accept needed library $i."
3205 $echo "*** I have the capability to make that library automatically link in when"
3206 $echo "*** you link to this library. But I can only do this if you have a"
3207 $echo "*** shared version of the library, which I believe you do not have"
3208 $echo "*** because a test_compile did reveal that the linker did not use it for"
3209 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3212 else
3213 newdeplibs="$newdeplibs $i"
3215 done
3216 else
3217 # Error occurred in the first compile. Let's try to salvage
3218 # the situation: Compile a separate program for each library.
3219 for i in $deplibs; do
3220 name="`expr $i : '-l\(.*\)'`"
3221 # If $name is empty we are operating on a -L argument.
3222 if test "$name" != "" && test "$name" != "0"; then
3223 $rm conftest
3224 $LTCC $archargs -o conftest conftest.c $i
3225 # Did it work?
3226 if test "$?" -eq 0 ; then
3227 ldd_output=`ldd conftest`
3228 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3229 case " $predeps $postdeps " in
3230 *" $i "*)
3231 newdeplibs="$newdeplibs $i"
3232 i=""
3234 esac
3236 if test -n "$i" ; then
3237 libname=`eval \\$echo \"$libname_spec\"`
3238 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3239 set dummy $deplib_matches
3240 deplib_match=$2
3241 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3242 newdeplibs="$newdeplibs $i"
3243 else
3244 droppeddeps=yes
3245 $echo
3246 $echo "*** Warning: dynamic linker does not accept needed library $i."
3247 $echo "*** I have the capability to make that library automatically link in when"
3248 $echo "*** you link to this library. But I can only do this if you have a"
3249 $echo "*** shared version of the library, which you do not appear to have"
3250 $echo "*** because a test_compile did reveal that the linker did not use this one"
3251 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3254 else
3255 droppeddeps=yes
3256 $echo
3257 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3258 $echo "*** make it link in! You will probably need to install it or some"
3259 $echo "*** library that it depends on before this library will be fully"
3260 $echo "*** functional. Installing it before continuing would be even better."
3262 else
3263 newdeplibs="$newdeplibs $i"
3265 done
3268 file_magic*)
3269 set dummy $deplibs_check_method
3270 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3271 for a_deplib in $deplibs; do
3272 name="`expr $a_deplib : '-l\(.*\)'`"
3273 # If $name is empty we are operating on a -L argument.
3274 if test "$name" != "" && test "$name" != "0"; then
3275 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3276 case " $predeps $postdeps " in
3277 *" $a_deplib "*)
3278 newdeplibs="$newdeplibs $a_deplib"
3279 a_deplib=""
3281 esac
3283 if test -n "$a_deplib" ; then
3284 libname=`eval \\$echo \"$libname_spec\"`
3285 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3286 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3287 for potent_lib in $potential_libs; do
3288 # Follow soft links.
3289 if ls -lLd "$potent_lib" 2>/dev/null \
3290 | grep " -> " >/dev/null; then
3291 continue
3293 # The statement above tries to avoid entering an
3294 # endless loop below, in case of cyclic links.
3295 # We might still enter an endless loop, since a link
3296 # loop can be closed while we follow links,
3297 # but so what?
3298 potlib="$potent_lib"
3299 while test -h "$potlib" 2>/dev/null; do
3300 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3301 case $potliblink in
3302 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3303 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3304 esac
3305 done
3306 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3307 | ${SED} 10q \
3308 | $EGREP "$file_magic_regex" > /dev/null; then
3309 newdeplibs="$newdeplibs $a_deplib"
3310 a_deplib=""
3311 break 2
3313 done
3314 done
3316 if test -n "$a_deplib" ; then
3317 droppeddeps=yes
3318 $echo
3319 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3320 $echo "*** I have the capability to make that library automatically link in when"
3321 $echo "*** you link to this library. But I can only do this if you have a"
3322 $echo "*** shared version of the library, which you do not appear to have"
3323 $echo "*** because I did check the linker path looking for a file starting"
3324 if test -z "$potlib" ; then
3325 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3326 else
3327 $echo "*** with $libname and none of the candidates passed a file format test"
3328 $echo "*** using a file magic. Last file checked: $potlib"
3331 else
3332 # Add a -L argument.
3333 newdeplibs="$newdeplibs $a_deplib"
3335 done # Gone through all deplibs.
3337 match_pattern*)
3338 set dummy $deplibs_check_method
3339 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3340 for a_deplib in $deplibs; do
3341 name="`expr $a_deplib : '-l\(.*\)'`"
3342 # If $name is empty we are operating on a -L argument.
3343 if test -n "$name" && test "$name" != "0"; then
3344 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3345 case " $predeps $postdeps " in
3346 *" $a_deplib "*)
3347 newdeplibs="$newdeplibs $a_deplib"
3348 a_deplib=""
3350 esac
3352 if test -n "$a_deplib" ; then
3353 libname=`eval \\$echo \"$libname_spec\"`
3354 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3355 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3356 for potent_lib in $potential_libs; do
3357 potlib="$potent_lib" # see symlink-check above in file_magic test
3358 if eval $echo \"$potent_lib\" 2>/dev/null \
3359 | ${SED} 10q \
3360 | $EGREP "$match_pattern_regex" > /dev/null; then
3361 newdeplibs="$newdeplibs $a_deplib"
3362 a_deplib=""
3363 break 2
3365 done
3366 done
3368 if test -n "$a_deplib" ; then
3369 droppeddeps=yes
3370 $echo
3371 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3372 $echo "*** I have the capability to make that library automatically link in when"
3373 $echo "*** you link to this library. But I can only do this if you have a"
3374 $echo "*** shared version of the library, which you do not appear to have"
3375 $echo "*** because I did check the linker path looking for a file starting"
3376 if test -z "$potlib" ; then
3377 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3378 else
3379 $echo "*** with $libname and none of the candidates passed a file format test"
3380 $echo "*** using a regex pattern. Last file checked: $potlib"
3383 else
3384 # Add a -L argument.
3385 newdeplibs="$newdeplibs $a_deplib"
3387 done # Gone through all deplibs.
3389 none | unknown | *)
3390 newdeplibs=""
3391 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3392 -e 's/ -[LR][^ ]*//g'`
3393 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3394 for i in $predeps $postdeps ; do
3395 # can't use Xsed below, because $i might contain '/'
3396 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3397 done
3399 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3400 | grep . >/dev/null; then
3401 $echo
3402 if test "X$deplibs_check_method" = "Xnone"; then
3403 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3404 else
3405 $echo "*** Warning: inter-library dependencies are not known to be supported."
3407 $echo "*** All declared inter-library dependencies are being dropped."
3408 droppeddeps=yes
3411 esac
3412 versuffix=$versuffix_save
3413 major=$major_save
3414 release=$release_save
3415 libname=$libname_save
3416 name=$name_save
3418 case $host in
3419 *-*-rhapsody* | *-*-darwin1.[012])
3420 # On Rhapsody replace the C library is the System framework
3421 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3423 esac
3425 if test "$droppeddeps" = yes; then
3426 if test "$module" = yes; then
3427 $echo
3428 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3429 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3430 $echo "*** a static module, that should work as long as the dlopening"
3431 $echo "*** application is linked with the -dlopen flag."
3432 if test -z "$global_symbol_pipe"; then
3433 $echo
3434 $echo "*** However, this would only work if libtool was able to extract symbol"
3435 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3436 $echo "*** not find such a program. So, this module is probably useless."
3437 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3439 if test "$build_old_libs" = no; then
3440 oldlibs="$output_objdir/$libname.$libext"
3441 build_libtool_libs=module
3442 build_old_libs=yes
3443 else
3444 build_libtool_libs=no
3446 else
3447 $echo "*** The inter-library dependencies that have been dropped here will be"
3448 $echo "*** automatically added whenever a program is linked with this library"
3449 $echo "*** or is declared to -dlopen it."
3451 if test "$allow_undefined" = no; then
3452 $echo
3453 $echo "*** Since this library must not contain undefined symbols,"
3454 $echo "*** because either the platform does not support them or"
3455 $echo "*** it was explicitly requested with -no-undefined,"
3456 $echo "*** libtool will only create a static version of it."
3457 if test "$build_old_libs" = no; then
3458 oldlibs="$output_objdir/$libname.$libext"
3459 build_libtool_libs=module
3460 build_old_libs=yes
3461 else
3462 build_libtool_libs=no
3467 # Done checking deplibs!
3468 deplibs=$newdeplibs
3471 # All the library-specific variables (install_libdir is set above).
3472 library_names=
3473 old_library=
3474 dlname=
3476 # Test again, we may have decided not to build it any more
3477 if test "$build_libtool_libs" = yes; then
3478 if test "$hardcode_into_libs" = yes; then
3479 # Hardcode the library paths
3480 hardcode_libdirs=
3481 dep_rpath=
3482 rpath="$finalize_rpath"
3483 test "$mode" != relink && rpath="$compile_rpath$rpath"
3484 for libdir in $rpath; do
3485 if test -n "$hardcode_libdir_flag_spec"; then
3486 if test -n "$hardcode_libdir_separator"; then
3487 if test -z "$hardcode_libdirs"; then
3488 hardcode_libdirs="$libdir"
3489 else
3490 # Just accumulate the unique libdirs.
3491 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3492 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3495 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3497 esac
3499 else
3500 eval flag=\"$hardcode_libdir_flag_spec\"
3501 dep_rpath="$dep_rpath $flag"
3503 elif test -n "$runpath_var"; then
3504 case "$perm_rpath " in
3505 *" $libdir "*) ;;
3506 *) perm_rpath="$perm_rpath $libdir" ;;
3507 esac
3509 done
3510 # Substitute the hardcoded libdirs into the rpath.
3511 if test -n "$hardcode_libdir_separator" &&
3512 test -n "$hardcode_libdirs"; then
3513 libdir="$hardcode_libdirs"
3514 if test -n "$hardcode_libdir_flag_spec_ld"; then
3515 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3516 else
3517 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3520 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3521 # We should set the runpath_var.
3522 rpath=
3523 for dir in $perm_rpath; do
3524 rpath="$rpath$dir:"
3525 done
3526 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3528 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3531 shlibpath="$finalize_shlibpath"
3532 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3533 if test -n "$shlibpath"; then
3534 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3537 # Get the real and link names of the library.
3538 eval shared_ext=\"$shrext\"
3539 eval library_names=\"$library_names_spec\"
3540 set dummy $library_names
3541 realname="$2"
3542 shift; shift
3544 if test -n "$soname_spec"; then
3545 eval soname=\"$soname_spec\"
3546 else
3547 soname="$realname"
3549 if test -z "$dlname"; then
3550 dlname=$soname
3553 lib="$output_objdir/$realname"
3554 for link
3556 linknames="$linknames $link"
3557 done
3559 # Use standard objects if they are pic
3560 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3562 # Prepare the list of exported symbols
3563 if test -z "$export_symbols"; then
3564 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3565 $show "generating symbol list for \`$libname.la'"
3566 export_symbols="$output_objdir/$libname.exp"
3567 $run $rm $export_symbols
3568 eval cmds=\"$export_symbols_cmds\"
3569 save_ifs="$IFS"; IFS=$_S_
3570 for cmd in $cmds; do
3571 IFS="$save_ifs"
3572 if len=`expr "X$cmd" : ".*"` &&
3573 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3574 $show "$cmd"
3575 $run eval "$cmd" || exit $?
3576 skipped_export=false
3577 else
3578 # The command line is too long to execute in one step.
3579 $show "using reloadable object file for export list..."
3580 skipped_export=:
3582 done
3583 IFS="$save_ifs"
3584 if test -n "$export_symbols_regex"; then
3585 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3586 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3587 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3588 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3593 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3594 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3597 tmp_deplibs=
3598 for test_deplib in $deplibs; do
3599 case " $convenience " in
3600 *" $test_deplib "*) ;;
3602 tmp_deplibs="$tmp_deplibs $test_deplib"
3604 esac
3605 done
3606 deplibs="$tmp_deplibs"
3608 if test -n "$convenience"; then
3609 if test -n "$whole_archive_flag_spec"; then
3610 save_libobjs=$libobjs
3611 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3612 else
3613 gentop="$output_objdir/${outputname}x"
3614 $show "${rm}r $gentop"
3615 $run ${rm}r "$gentop"
3616 $show "$mkdir $gentop"
3617 $run $mkdir "$gentop"
3618 status=$?
3619 if test "$status" -ne 0 && test ! -d "$gentop"; then
3620 exit $status
3622 generated="$generated $gentop"
3624 for xlib in $convenience; do
3625 # Extract the objects.
3626 case $xlib in
3627 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3628 *) xabs=`pwd`"/$xlib" ;;
3629 esac
3630 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3631 xdir="$gentop/$xlib"
3633 $show "${rm}r $xdir"
3634 $run ${rm}r "$xdir"
3635 $show "$mkdir $xdir"
3636 $run $mkdir "$xdir"
3637 status=$?
3638 if test "$status" -ne 0 && test ! -d "$xdir"; then
3639 exit $status
3641 case $host in
3642 *-*-darwin*)
3643 # ranlib-ed archives of fat binaries are converted to a fat xabs that
3644 # ar can't use. So we to split the fat xabs into non-fat ones to unpack.
3645 # We can't deal with duplicate names, since 'ar xN' and 'uniq -cd' don't work.
3646 d_archs=`lipo -info $xabs 2> /dev/null | grep '^Architectures' | sed 's/^.*: //'`
3647 if test -n "$d_archs"; then
3648 $echo "$modename: manually unpacking fat archive $xabs" 1>&2
3649 d_name=`basename $xabs`
3650 d_dir="/tmp/fat_ar.$$"
3651 d_files=''
3653 for d_arch in $d_archs; do
3654 d_archdir="$d_dir/$d_arch"
3655 $show "$mkdir -p $d_archdir"
3656 $run $mkdir -p "$d_archdir"
3658 $show "lipo -thin $d_arch $xabs -o $d_dir/$d_name"
3659 $run lipo -thin $d_arch "$xabs" -o "$d_dir/$d_name"
3661 $show "(cd $d_archdir && $AR x $d_dir/$d_name)"
3662 $run eval "(cd \$d_archdir && \$AR x \$d_dir/\$d_name)" || exit $?
3664 $show "${rm} $d_dir/$d_name"
3665 $run ${rm} "$d_dir/$d_name"
3666 done
3668 # Can't deal with blanks in file names
3669 $run eval "d_files=\`find \$d_dir -type f | sed -e 's,.*/,,' -e '/ /d' | sort -u\`" || exit $?
3671 for d_file in $d_files; do
3672 $run eval "d_f=\`find \$d_dir -name \$d_file -print\`" || exit $?
3673 $show "lipo -create $d_f -o $xdir/$d_file"
3674 $run eval "lipo -create \$d_f -o \"\$xdir/\$d_file\"" || exit $?
3675 done
3677 $show "${rm}r $d_dir"
3678 $run ${rm}r "$d_dir"
3679 else
3680 $show "(cd $xdir && $AR x $xabs)"
3681 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3685 # We will extract separately just the conflicting names and we will no
3686 # longer touch any unique names. It is faster to leave these extract
3687 # automatically by $AR in one run.
3688 $show "(cd $xdir && $AR x $xabs)"
3689 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3690 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3692 else
3693 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3694 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3695 $AR t "$xabs" | sort | uniq -cd | while read -r count name
3698 while test "$i" -le "$count"
3700 # Put our $i before any first dot (extension)
3701 # Never overwrite any file
3702 name_to="$name"
3703 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3705 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3706 done
3707 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3708 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3709 i=`expr $i + 1`
3710 done
3711 done
3714 esac
3716 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3717 done
3721 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3722 eval flag=\"$thread_safe_flag_spec\"
3723 linker_flags="$linker_flags $flag"
3726 # Make a backup of the uninstalled library when relinking
3727 if test "$mode" = relink; then
3728 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3731 # Do each of the archive commands.
3732 if test "$module" = yes && test -n "$module_cmds" ; then
3733 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3734 eval cmds=\"$module_expsym_cmds\"
3735 else
3736 eval cmds=\"$module_cmds\"
3738 else
3739 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3740 eval cmds=\"$archive_expsym_cmds\"
3741 else
3742 eval cmds=\"$archive_cmds\"
3746 if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
3747 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3749 else
3750 # The command line is too long to link in one step, link piecewise.
3751 $echo "creating reloadable object files..."
3753 # Save the value of $output and $libobjs because we want to
3754 # use them later. If we have whole_archive_flag_spec, we
3755 # want to use save_libobjs as it was before
3756 # whole_archive_flag_spec was expanded, because we can't
3757 # assume the linker understands whole_archive_flag_spec.
3758 # This may have to be revisited, in case too many
3759 # convenience libraries get linked in and end up exceeding
3760 # the spec.
3761 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3762 save_libobjs=$libobjs
3764 save_output=$output
3766 # Clear the reloadable object creation command queue and
3767 # initialize k to one.
3768 test_cmds=
3769 concat_cmds=
3770 objlist=
3771 delfiles=
3772 last_robj=
3774 output=$output_objdir/$save_output-${k}.$objext
3775 # Loop over the list of objects to be linked.
3776 for obj in $save_libobjs
3778 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3779 if test "X$objlist" = X ||
3780 { len=`expr "X$test_cmds" : ".*"` &&
3781 test "$len" -le "$max_cmd_len"; }; then
3782 objlist="$objlist $obj"
3783 else
3784 # The command $test_cmds is almost too long, add a
3785 # command to the queue.
3786 if test "$k" -eq 1 ; then
3787 # The first file doesn't have a previous command to add.
3788 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3789 else
3790 # All subsequent reloadable object files will link in
3791 # the last one created.
3792 eval concat_cmds=\"\$concat_cmds${_S_}$reload_cmds $objlist $last_robj\"
3794 last_robj=$output_objdir/$save_output-${k}.$objext
3795 k=`expr $k + 1`
3796 output=$output_objdir/$save_output-${k}.$objext
3797 objlist=$obj
3798 len=1
3800 done
3801 # Handle the remaining objects by creating one last
3802 # reloadable object file. All subsequent reloadable object
3803 # files will link in the last one created.
3804 test -z "$concat_cmds" || concat_cmds=$concat_cmds${_S_}
3805 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3807 if ${skipped_export-false}; then
3808 $show "generating symbol list for \`$libname.la'"
3809 export_symbols="$output_objdir/$libname.exp"
3810 $run $rm $export_symbols
3811 libobjs=$output
3812 # Append the command to create the export file.
3813 eval concat_cmds=\"\$concat_cmds${_S_}$export_symbols_cmds\"
3816 # Set up a command to remove the reloadale object files
3817 # after they are used.
3819 while test "$i" -lt "$k"
3821 i=`expr $i + 1`
3822 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3823 done
3825 $echo "creating a temporary reloadable object file: $output"
3827 # Loop through the commands generated above and execute them.
3828 save_ifs="$IFS"; IFS=$_S_
3829 for cmd in $concat_cmds; do
3830 IFS="$save_ifs"
3831 $show "$cmd"
3832 $run eval "$cmd" || exit $?
3833 done
3834 IFS="$save_ifs"
3836 libobjs=$output
3837 # Restore the value of output.
3838 output=$save_output
3840 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3841 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3843 # Expand the library linking commands again to reset the
3844 # value of $libobjs for piecewise linking.
3846 # Do each of the archive commands.
3847 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3848 eval cmds=\"$archive_expsym_cmds\"
3849 else
3850 eval cmds=\"$archive_cmds\"
3853 # Append the command to remove the reloadable object files
3854 # to the just-reset $cmds.
3855 eval cmds=\"\$cmds${_S_}$rm $delfiles\"
3857 save_ifs="$IFS"; IFS=$_S_
3858 for cmd in $cmds; do
3859 IFS="$save_ifs"
3860 $show "$cmd"
3861 $run eval "$cmd" || exit $?
3862 done
3863 IFS="$save_ifs"
3865 # Restore the uninstalled library and exit
3866 if test "$mode" = relink; then
3867 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3868 exit 0
3871 # Create links to the real library.
3872 for linkname in $linknames; do
3873 if test "$realname" != "$linkname"; then
3874 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3875 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3877 done
3879 # If -module or -export-dynamic was specified, set the dlname.
3880 if test "$module" = yes || test "$export_dynamic" = yes; then
3881 # On all known operating systems, these are identical.
3882 dlname="$soname"
3887 obj)
3888 if test -n "$deplibs"; then
3889 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3892 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3893 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3896 if test -n "$rpath"; then
3897 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3900 if test -n "$xrpath"; then
3901 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3904 if test -n "$vinfo"; then
3905 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3908 if test -n "$release"; then
3909 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3912 case $output in
3913 *.lo)
3914 if test -n "$objs$old_deplibs"; then
3915 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3916 exit 1
3918 libobj="$output"
3919 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3922 libobj=
3923 obj="$output"
3925 esac
3927 # Delete the old objects.
3928 $run $rm $obj $libobj
3930 # Objects from convenience libraries. This assumes
3931 # single-version convenience libraries. Whenever we create
3932 # different ones for PIC/non-PIC, this we'll have to duplicate
3933 # the extraction.
3934 reload_conv_objs=
3935 gentop=
3936 # reload_cmds runs $LD directly, so let us get rid of
3937 # -Wl from whole_archive_flag_spec
3940 if test -n "$convenience"; then
3941 if test -n "$whole_archive_flag_spec"; then
3942 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3943 else
3944 gentop="$output_objdir/${obj}x"
3945 $show "${rm}r $gentop"
3946 $run ${rm}r "$gentop"
3947 $show "$mkdir $gentop"
3948 $run $mkdir "$gentop"
3949 status=$?
3950 if test "$status" -ne 0 && test ! -d "$gentop"; then
3951 exit $status
3953 generated="$generated $gentop"
3955 for xlib in $convenience; do
3956 # Extract the objects.
3957 case $xlib in
3958 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3959 *) xabs=`pwd`"/$xlib" ;;
3960 esac
3961 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3962 xdir="$gentop/$xlib"
3964 $show "${rm}r $xdir"
3965 $run ${rm}r "$xdir"
3966 $show "$mkdir $xdir"
3967 $run $mkdir "$xdir"
3968 status=$?
3969 if test "$status" -ne 0 && test ! -d "$xdir"; then
3970 exit $status
3972 case $host in
3973 *-*-darwin*)
3974 # ranlib-ed archives of fat binaries are converted to a fat xabs that
3975 # ar can't use. So we to split the fat xabs into non-fat ones to unpack.
3976 # We can't deal with duplicate names, since 'ar xN' and 'uniq -cd' don't work.
3977 d_archs=`lipo -info $xabs 2> /dev/null | grep '^Architectures' | sed 's/^.*: //'`
3978 if test -n "$d_archs"; then
3979 $echo "$modename: manually unpacking fat archive $xabs" 1>&2
3980 d_name=`basename $xabs`
3981 d_dir="/tmp/fat_ar.$$"
3982 d_files=''
3984 for d_arch in $d_archs; do
3985 d_archdir="$d_dir/$d_arch"
3986 $show "$mkdir -p $d_archdir"
3987 $run $mkdir -p "$d_archdir"
3989 $show "lipo -thin $d_arch $xabs -o $d_dir/$d_name"
3990 $run lipo -thin $d_arch "$xabs" -o "$d_dir/$d_name"
3992 $show "(cd $d_archdir && $AR x $d_dir/$d_name)"
3993 $run eval "(cd \$d_archdir && \$AR x \$d_dir/\$d_name)" || exit $?
3995 $show "${rm} $d_dir/$d_name"
3996 $run ${rm} "$d_dir/$d_name"
3997 done
3999 # Can't deal with blanks in file names
4000 $run eval "d_files=\`find \$d_dir -type f | sed -e 's,.*/,,' -e '/ /d' | sort -u\`" || exit $?
4002 for d_file in $d_files; do
4003 $run eval "d_f=\`find \$d_dir -name \$d_file -print\`" || exit $?
4004 $show "lipo -create $d_f -o $xdir/$d_file"
4005 $run eval "lipo -create \$d_f -o \"\$xdir/\$d_file\"" || exit $?
4006 done
4008 $show "${rm}r $d_dir"
4009 $run ${rm}r "$d_dir"
4010 else
4011 $show "(cd $xdir && $AR x $xabs)"
4012 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4016 # We will extract separately just the conflicting names and we will no
4017 # longer touch any unique names. It is faster to leave these extract
4018 # automatically by $AR in one run.
4019 $show "(cd $xdir && $AR x $xabs)"
4020 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4021 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4023 else
4024 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4025 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4026 $AR t "$xabs" | sort | uniq -cd | while read -r count name
4029 while test "$i" -le "$count"
4031 # Put our $i before any first dot (extension)
4032 # Never overwrite any file
4033 name_to="$name"
4034 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4036 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4037 done
4038 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4039 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4040 i=`expr $i + 1`
4041 done
4042 done
4045 esac
4047 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4048 done
4052 # Create the old-style object.
4053 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
4055 output="$obj"
4056 eval cmds=\"$reload_cmds\"
4057 save_ifs="$IFS"; IFS=$_S_
4058 for cmd in $cmds; do
4059 IFS="$save_ifs"
4060 $show "$cmd"
4061 $run eval "$cmd" || exit $?
4062 done
4063 IFS="$save_ifs"
4065 # Exit if we aren't doing a library object file.
4066 if test -z "$libobj"; then
4067 if test -n "$gentop"; then
4068 $show "${rm}r $gentop"
4069 $run ${rm}r $gentop
4072 exit 0
4075 if test "$build_libtool_libs" != yes; then
4076 if test -n "$gentop"; then
4077 $show "${rm}r $gentop"
4078 $run ${rm}r $gentop
4081 # Create an invalid libtool object if no PIC, so that we don't
4082 # accidentally link it into a program.
4083 # $show "echo timestamp > $libobj"
4084 # $run eval "echo timestamp > $libobj" || exit $?
4085 exit 0
4088 if test -n "$pic_flag" || test "$pic_mode" != default; then
4089 # Only do commands if we really have different PIC objects.
4090 reload_objs="$libobjs $reload_conv_objs"
4091 output="$libobj"
4092 eval cmds=\"$reload_cmds\"
4093 save_ifs="$IFS"; IFS=$_S_
4094 for cmd in $cmds; do
4095 IFS="$save_ifs"
4096 $show "$cmd"
4097 $run eval "$cmd" || exit $?
4098 done
4099 IFS="$save_ifs"
4102 if test -n "$gentop"; then
4103 $show "${rm}r $gentop"
4104 $run ${rm}r $gentop
4107 exit 0
4110 prog)
4111 case $host in
4112 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4113 esac
4114 if test -n "$vinfo"; then
4115 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4118 if test -n "$release"; then
4119 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4122 if test "$preload" = yes; then
4123 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4124 test "$dlopen_self_static" = unknown; then
4125 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4129 case $host in
4130 *-*-rhapsody* | *-*-darwin1.[012])
4131 # On Rhapsody replace the C library is the System framework
4132 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4133 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4135 esac
4137 case $host in
4138 *darwin*)
4139 # Don't allow lazy linking, it breaks C++ global constructors
4140 if test "$tagname" = CXX ; then
4141 compile_command="$compile_command ${wl}-bind_at_load"
4142 finalize_command="$finalize_command ${wl}-bind_at_load"
4145 esac
4147 compile_command="$compile_command $compile_deplibs"
4148 finalize_command="$finalize_command $finalize_deplibs"
4150 if test -n "$rpath$xrpath"; then
4151 # If the user specified any rpath flags, then add them.
4152 for libdir in $rpath $xrpath; do
4153 # This is the magic to use -rpath.
4154 case "$finalize_rpath " in
4155 *" $libdir "*) ;;
4156 *) finalize_rpath="$finalize_rpath $libdir" ;;
4157 esac
4158 done
4161 # Now hardcode the library paths
4162 rpath=
4163 hardcode_libdirs=
4164 for libdir in $compile_rpath $finalize_rpath; do
4165 if test -n "$hardcode_libdir_flag_spec"; then
4166 if test -n "$hardcode_libdir_separator"; then
4167 if test -z "$hardcode_libdirs"; then
4168 hardcode_libdirs="$libdir"
4169 else
4170 # Just accumulate the unique libdirs.
4171 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4172 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4175 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4177 esac
4179 else
4180 eval flag=\"$hardcode_libdir_flag_spec\"
4181 rpath="$rpath $flag"
4183 elif test -n "$runpath_var"; then
4184 case "$perm_rpath " in
4185 *" $libdir "*) ;;
4186 *) perm_rpath="$perm_rpath $libdir" ;;
4187 esac
4189 case $host in
4190 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4191 case :$dllsearchpath: in
4192 *":$libdir:"*) ;;
4193 *) dllsearchpath="$dllsearchpath:$libdir";;
4194 esac
4196 esac
4197 done
4198 # Substitute the hardcoded libdirs into the rpath.
4199 if test -n "$hardcode_libdir_separator" &&
4200 test -n "$hardcode_libdirs"; then
4201 libdir="$hardcode_libdirs"
4202 eval rpath=\" $hardcode_libdir_flag_spec\"
4204 compile_rpath="$rpath"
4206 rpath=
4207 hardcode_libdirs=
4208 for libdir in $finalize_rpath; do
4209 if test -n "$hardcode_libdir_flag_spec"; then
4210 if test -n "$hardcode_libdir_separator"; then
4211 if test -z "$hardcode_libdirs"; then
4212 hardcode_libdirs="$libdir"
4213 else
4214 # Just accumulate the unique libdirs.
4215 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4216 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4219 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4221 esac
4223 else
4224 eval flag=\"$hardcode_libdir_flag_spec\"
4225 rpath="$rpath $flag"
4227 elif test -n "$runpath_var"; then
4228 case "$finalize_perm_rpath " in
4229 *" $libdir "*) ;;
4230 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4231 esac
4233 done
4234 # Substitute the hardcoded libdirs into the rpath.
4235 if test -n "$hardcode_libdir_separator" &&
4236 test -n "$hardcode_libdirs"; then
4237 libdir="$hardcode_libdirs"
4238 eval rpath=\" $hardcode_libdir_flag_spec\"
4240 finalize_rpath="$rpath"
4242 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4243 # Transform all the library objects into standard objects.
4244 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4245 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4248 dlsyms=
4249 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4250 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4251 dlsyms="${outputname}S.c"
4252 else
4253 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4257 if test -n "$dlsyms"; then
4258 case $dlsyms in
4259 "") ;;
4260 *.c)
4261 # Discover the nlist of each of the dlfiles.
4262 nlist="$output_objdir/${outputname}.nm"
4264 $show "$rm $nlist ${nlist}S ${nlist}T"
4265 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4267 # Parse the name list into a source file.
4268 $show "creating $output_objdir/$dlsyms"
4270 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4271 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4272 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4274 #ifdef __cplusplus
4275 extern \"C\" {
4276 #endif
4278 /* Prevent the only kind of declaration conflicts we can make. */
4279 #define lt_preloaded_symbols some_other_symbol
4281 /* External symbol declarations for the compiler. */\
4284 if test "$dlself" = yes; then
4285 $show "generating symbol list for \`$output'"
4287 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4289 # Add our own program objects to the symbol list.
4290 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4291 for arg in $progfiles; do
4292 $show "extracting global C symbols from \`$arg'"
4293 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4294 done
4296 if test -n "$exclude_expsyms"; then
4297 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4298 $run eval '$mv "$nlist"T "$nlist"'
4301 if test -n "$export_symbols_regex"; then
4302 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4303 $run eval '$mv "$nlist"T "$nlist"'
4306 # Prepare the list of exported symbols
4307 if test -z "$export_symbols"; then
4308 export_symbols="$output_objdir/$output.exp"
4309 $run $rm $export_symbols
4310 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4311 else
4312 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4313 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4314 $run eval 'mv "$nlist"T "$nlist"'
4318 for arg in $dlprefiles; do
4319 $show "extracting global C symbols from \`$arg'"
4320 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4321 $run eval '$echo ": $name " >> "$nlist"'
4322 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4323 done
4325 if test -z "$run"; then
4326 # Make sure we have at least an empty file.
4327 test -f "$nlist" || : > "$nlist"
4329 if test -n "$exclude_expsyms"; then
4330 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4331 $mv "$nlist"T "$nlist"
4334 # Try sorting and uniquifying the output.
4335 if grep -v "^: " < "$nlist" |
4336 if sort -k 3 </dev/null >/dev/null 2>&1; then
4337 sort -k 3
4338 else
4339 sort +2
4340 fi |
4341 uniq > "$nlist"S; then
4343 else
4344 grep -v "^: " < "$nlist" > "$nlist"S
4347 if test -f "$nlist"S; then
4348 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4349 else
4350 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4353 $echo >> "$output_objdir/$dlsyms" "\
4355 #undef lt_preloaded_symbols
4357 #if defined (__STDC__) && __STDC__
4358 # define lt_ptr void *
4359 #else
4360 # define lt_ptr char *
4361 # define const
4362 #endif
4364 /* The mapping between symbol names and symbols. */
4365 const struct {
4366 const char *name;
4367 lt_ptr address;
4369 lt_preloaded_symbols[] =
4373 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4375 $echo >> "$output_objdir/$dlsyms" "\
4376 {0, (lt_ptr) 0}
4379 /* This works around a problem in FreeBSD linker */
4380 #ifdef FREEBSD_WORKAROUND
4381 static const void *lt_preloaded_setup() {
4382 return lt_preloaded_symbols;
4384 #endif
4386 #ifdef __cplusplus
4388 #endif\
4392 pic_flag_for_symtable=
4393 case $host in
4394 # compiling the symbol table file with pic_flag works around
4395 # a FreeBSD bug that causes programs to crash when -lm is
4396 # linked before any other PIC object. But we must not use
4397 # pic_flag when linking with -static. The problem exists in
4398 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4399 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4400 case "$compile_command " in
4401 *" -static "*) ;;
4402 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4403 esac;;
4404 *-*-hpux*)
4405 case "$compile_command " in
4406 *" -static "*) ;;
4407 *) pic_flag_for_symtable=" $pic_flag";;
4408 esac
4409 esac
4411 # Now compile the dynamic symbol file.
4412 $show "(cd $output_objdir && $LTCC $archargs -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4413 $run eval '(cd $output_objdir && $LTCC $archargs -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4415 # Clean up the generated files.
4416 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4417 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4419 # Transform the symbol file into the correct name.
4420 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4421 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4424 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4425 exit 1
4427 esac
4428 else
4429 # We keep going just in case the user didn't refer to
4430 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4431 # really was required.
4433 # Nullify the symbol file.
4434 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4435 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4438 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4439 # Replace the output file specification.
4440 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4441 link_command="$compile_command$compile_rpath"
4443 # We have no uninstalled library dependencies, so finalize right now.
4444 $show "$link_command"
4445 $run eval "$link_command"
4446 status=$?
4448 # Delete the generated files.
4449 if test -n "$dlsyms"; then
4450 $show "$rm $output_objdir/${outputname}S.${objext}"
4451 $run $rm "$output_objdir/${outputname}S.${objext}"
4454 exit $status
4457 if test -n "$shlibpath_var"; then
4458 # We should set the shlibpath_var
4459 rpath=
4460 for dir in $temp_rpath; do
4461 case $dir in
4462 [\\/]* | [A-Za-z]:[\\/]*)
4463 # Absolute path.
4464 rpath="$rpath$dir:"
4467 # Relative path: add a thisdir entry.
4468 rpath="$rpath\$thisdir/$dir:"
4470 esac
4471 done
4472 temp_rpath="$rpath"
4475 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4476 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4478 if test -n "$finalize_shlibpath"; then
4479 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4482 compile_var=
4483 finalize_var=
4484 if test -n "$runpath_var"; then
4485 if test -n "$perm_rpath"; then
4486 # We should set the runpath_var.
4487 rpath=
4488 for dir in $perm_rpath; do
4489 rpath="$rpath$dir:"
4490 done
4491 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4493 if test -n "$finalize_perm_rpath"; then
4494 # We should set the runpath_var.
4495 rpath=
4496 for dir in $finalize_perm_rpath; do
4497 rpath="$rpath$dir:"
4498 done
4499 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4503 if test "$no_install" = yes; then
4504 # We don't need to create a wrapper script.
4505 link_command="$compile_var$compile_command$compile_rpath"
4506 # Replace the output file specification.
4507 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4508 # Delete the old output file.
4509 $run $rm $output
4510 # Link the executable and exit
4511 $show "$link_command"
4512 $run eval "$link_command" || exit $?
4513 exit 0
4516 if test "$hardcode_action" = relink; then
4517 # Fast installation is not supported
4518 link_command="$compile_var$compile_command$compile_rpath"
4519 relink_command="$finalize_var$finalize_command$finalize_rpath"
4521 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4522 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4523 else
4524 if test "$fast_install" != no; then
4525 link_command="$finalize_var$compile_command$finalize_rpath"
4526 if test "$fast_install" = yes; then
4527 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4528 else
4529 # fast_install is set to needless
4530 relink_command=
4532 else
4533 link_command="$compile_var$compile_command$compile_rpath"
4534 relink_command="$finalize_var$finalize_command$finalize_rpath"
4538 # Replace the output file specification.
4539 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4541 # Delete the old output files.
4542 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4544 $show "$link_command"
4545 $run eval "$link_command" || exit $?
4547 # Now create the wrapper script.
4548 $show "creating $output"
4550 # Quote the relink command for shipping.
4551 if test -n "$relink_command"; then
4552 # Preserve any variables that may affect compiler behavior
4553 for var in $variables_saved_for_relink; do
4554 if eval test -z \"\${$var+set}\"; then
4555 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4556 elif eval var_value=\$$var; test -z "$var_value"; then
4557 relink_command="$var=; export $var; $relink_command"
4558 else
4559 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4560 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4562 done
4563 relink_command="(cd `pwd`; $relink_command)"
4564 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4567 # Quote $echo for shipping.
4568 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4569 case $0 in
4570 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4571 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4572 esac
4573 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4574 else
4575 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4578 # Only actually do things if our run command is non-null.
4579 if test -z "$run"; then
4580 # win32 will think the script is a binary if it has
4581 # a .exe suffix, so we strip it off here.
4582 case $output in
4583 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4584 esac
4585 # test for cygwin because mv fails w/o .exe extensions
4586 case $host in
4587 *cygwin*)
4588 exeext=.exe
4589 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4590 *) exeext= ;;
4591 esac
4592 case $host in
4593 *cygwin* | *mingw* )
4594 cwrappersource=`$echo ${objdir}/lt-${output}.c`
4595 cwrapper=`$echo ${output}.exe`
4596 $rm $cwrappersource $cwrapper
4597 trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
4599 cat > $cwrappersource <<EOF
4601 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4602 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4604 The $output program cannot be directly executed until all the libtool
4605 libraries that it depends on are installed.
4607 This wrapper executable should never be moved out of the build directory.
4608 If it is, it will not operate correctly.
4610 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4611 but could eventually absorb all of the scripts functionality and
4612 exec $objdir/$outputname directly.
4615 cat >> $cwrappersource<<"EOF"
4616 #include <stdio.h>
4617 #include <stdlib.h>
4618 #include <unistd.h>
4619 #include <malloc.h>
4620 #include <stdarg.h>
4621 #include <assert.h>
4623 #if defined(PATH_MAX)
4624 # define LT_PATHMAX PATH_MAX
4625 #elif defined(MAXPATHLEN)
4626 # define LT_PATHMAX MAXPATHLEN
4627 #else
4628 # define LT_PATHMAX 1024
4629 #endif
4631 #ifndef DIR_SEPARATOR
4632 #define DIR_SEPARATOR '/'
4633 #endif
4635 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4636 defined (__OS2__)
4637 #define HAVE_DOS_BASED_FILE_SYSTEM
4638 #ifndef DIR_SEPARATOR_2
4639 #define DIR_SEPARATOR_2 '\\'
4640 #endif
4641 #endif
4643 #ifndef DIR_SEPARATOR_2
4644 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4645 #else /* DIR_SEPARATOR_2 */
4646 # define IS_DIR_SEPARATOR(ch) \
4647 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4648 #endif /* DIR_SEPARATOR_2 */
4650 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4651 #define XFREE(stale) do { \
4652 if (stale) { free ((void *) stale); stale = 0; } \
4653 } while (0)
4655 const char *program_name = NULL;
4657 void * xmalloc (size_t num);
4658 char * xstrdup (const char *string);
4659 char * basename (const char *name);
4660 char * fnqualify(const char *path);
4661 char * strendzap(char *str, const char *pat);
4662 void lt_fatal (const char *message, ...);
4665 main (int argc, char *argv[])
4667 char **newargz;
4668 int i;
4670 program_name = (char *) xstrdup ((char *) basename (argv[0]));
4671 newargz = XMALLOC(char *, argc+2);
4674 cat >> $cwrappersource <<EOF
4675 newargz[0] = "$SHELL";
4678 cat >> $cwrappersource <<"EOF"
4679 newargz[1] = fnqualify(argv[0]);
4680 /* we know the script has the same name, without the .exe */
4681 /* so make sure newargz[1] doesn't end in .exe */
4682 strendzap(newargz[1],".exe");
4683 for (i = 1; i < argc; i++)
4684 newargz[i+1] = xstrdup(argv[i]);
4685 newargz[argc+1] = NULL;
4688 cat >> $cwrappersource <<EOF
4689 execv("$SHELL",newargz);
4692 cat >> $cwrappersource <<"EOF"
4695 void *
4696 xmalloc (size_t num)
4698 void * p = (void *) malloc (num);
4699 if (!p)
4700 lt_fatal ("Memory exhausted");
4702 return p;
4705 char *
4706 xstrdup (const char *string)
4708 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4712 char *
4713 basename (const char *name)
4715 const char *base;
4717 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4718 /* Skip over the disk name in MSDOS pathnames. */
4719 if (isalpha (name[0]) && name[1] == ':')
4720 name += 2;
4721 #endif
4723 for (base = name; *name; name++)
4724 if (IS_DIR_SEPARATOR (*name))
4725 base = name + 1;
4726 return (char *) base;
4729 char *
4730 fnqualify(const char *path)
4732 size_t size;
4733 char *p;
4734 char tmp[LT_PATHMAX + 1];
4736 assert(path != NULL);
4738 /* Is it qualified already? */
4739 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4740 if (isalpha (path[0]) && path[1] == ':')
4741 return xstrdup (path);
4742 #endif
4743 if (IS_DIR_SEPARATOR (path[0]))
4744 return xstrdup (path);
4746 /* prepend the current directory */
4747 /* doesn't handle '~' */
4748 if (getcwd (tmp, LT_PATHMAX) == NULL)
4749 lt_fatal ("getcwd failed");
4750 size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4751 p = XMALLOC(char, size);
4752 sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4753 return p;
4756 char *
4757 strendzap(char *str, const char *pat)
4759 size_t len, patlen;
4761 assert(str != NULL);
4762 assert(pat != NULL);
4764 len = strlen(str);
4765 patlen = strlen(pat);
4767 if (patlen <= len)
4769 str += len - patlen;
4770 if (strcmp(str, pat) == 0)
4771 *str = '\0';
4773 return str;
4776 static void
4777 lt_error_core (int exit_status, const char * mode,
4778 const char * message, va_list ap)
4780 fprintf (stderr, "%s: %s: ", program_name, mode);
4781 vfprintf (stderr, message, ap);
4782 fprintf (stderr, ".\n");
4784 if (exit_status >= 0)
4785 exit (exit_status);
4788 void
4789 lt_fatal (const char *message, ...)
4791 va_list ap;
4792 va_start (ap, message);
4793 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4794 va_end (ap);
4797 # we should really use a build-platform specific compiler
4798 # here, but OTOH, the wrappers (shell script and this C one)
4799 # are only useful if you want to execute the "real" binary.
4800 # Since the "real" binary is built for $host, then this
4801 # wrapper might as well be built for $host, too.
4802 $run $LTCC $archargs -s -o $cwrapper $cwrappersource
4804 esac
4805 $rm $output
4806 trap "$rm $output; exit 1" 1 2 15
4808 $echo > $output "\
4809 #! $SHELL
4811 # $output - temporary wrapper script for $objdir/$outputname
4812 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4814 # The $output program cannot be directly executed until all the libtool
4815 # libraries that it depends on are installed.
4817 # This wrapper script should never be moved out of the build directory.
4818 # If it is, it will not operate correctly.
4820 # Sed substitution that helps us do robust quoting. It backslashifies
4821 # metacharacters that are still active within double-quoted strings.
4822 Xsed='${SED} -e 1s/^X//'
4823 sed_quote_subst='$sed_quote_subst'
4825 # The HP-UX ksh and POSIX shell print the target directory to stdout
4826 # if CDPATH is set.
4827 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
4829 relink_command=\"$relink_command\"
4831 # This environment variable determines our operation mode.
4832 if test \"\$libtool_install_magic\" = \"$magic\"; then
4833 # install mode needs the following variable:
4834 notinst_deplibs='$notinst_deplibs'
4835 else
4836 # When we are sourced in execute mode, \$file and \$echo are already set.
4837 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4838 echo=\"$qecho\"
4839 file=\"\$0\"
4840 # Make sure echo works.
4841 if test \"X\$1\" = X--no-reexec; then
4842 # Discard the --no-reexec flag, and continue.
4843 shift
4844 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4845 # Yippee, \$echo works!
4847 else
4848 # Restart under the correct shell, and then maybe \$echo will work.
4849 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4853 $echo >> $output "\
4855 # Find the directory that this script lives in.
4856 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4857 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4859 # Follow symbolic links until we get to the real thisdir.
4860 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
4861 while test -n \"\$file\"; do
4862 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4864 # If there was a directory component, then change thisdir.
4865 if test \"x\$destdir\" != \"x\$file\"; then
4866 case \"\$destdir\" in
4867 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4868 *) thisdir=\"\$thisdir/\$destdir\" ;;
4869 esac
4872 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4873 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
4874 done
4876 # Try to get the absolute directory name.
4877 absdir=\`cd \"\$thisdir\" && pwd\`
4878 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4881 if test "$fast_install" = yes; then
4882 $echo >> $output "\
4883 program=lt-'$outputname'$exeext
4884 progdir=\"\$thisdir/$objdir\"
4886 if test ! -f \"\$progdir/\$program\" || \\
4887 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4888 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4890 file=\"\$\$-\$program\"
4892 if test ! -d \"\$progdir\"; then
4893 $mkdir \"\$progdir\"
4894 else
4895 $rm \"\$progdir/\$file\"
4898 $echo >> $output "\
4900 # relink executable if necessary
4901 if test -n \"\$relink_command\"; then
4902 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4903 else
4904 $echo \"\$relink_command_output\" >&2
4905 $rm \"\$progdir/\$file\"
4906 exit 1
4910 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4911 { $rm \"\$progdir/\$program\";
4912 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4913 $rm \"\$progdir/\$file\"
4915 else
4916 $echo >> $output "\
4917 program='$outputname'
4918 progdir=\"\$thisdir/$objdir\"
4922 $echo >> $output "\
4924 if test -f \"\$progdir/\$program\"; then"
4926 # Export our shlibpath_var if we have one.
4927 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4928 $echo >> $output "\
4929 # Add our own library path to $shlibpath_var
4930 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4932 # Some systems cannot cope with colon-terminated $shlibpath_var
4933 # The second colon is a workaround for a bug in BeOS R4 sed
4934 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4936 export $shlibpath_var
4940 # fixup the dll searchpath if we need to.
4941 if test -n "$dllsearchpath"; then
4942 $echo >> $output "\
4943 # Add the dll search path components to the executable PATH
4944 PATH=$dllsearchpath:\$PATH
4948 $echo >> $output "\
4949 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4950 # Run the actual program with our arguments.
4952 case $host in
4953 # Backslashes separate directories on plain windows
4954 *-*-mingw | *-*-os2*)
4955 $echo >> $output "\
4956 exec \$progdir\\\\\$program \${1+\"\$@\"}
4961 $echo >> $output "\
4962 exec \$progdir/\$program \${1+\"\$@\"}
4965 esac
4966 $echo >> $output "\
4967 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4968 exit 1
4970 else
4971 # The program doesn't exist.
4972 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4973 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4974 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4975 exit 1
4979 chmod +x $output
4981 exit 0
4983 esac
4985 # See if we need to build an old-fashioned archive.
4986 for oldlib in $oldlibs; do
4988 if test "$build_libtool_libs" = convenience; then
4989 oldobjs="$libobjs_save"
4990 addlibs="$convenience"
4991 build_libtool_libs=no
4992 else
4993 if test "$build_libtool_libs" = module; then
4994 oldobjs="$libobjs_save"
4995 build_libtool_libs=no
4996 else
4997 oldobjs="$old_deplibs $non_pic_objects"
4999 addlibs="$old_convenience"
5002 if test -n "$addlibs"; then
5003 gentop="$output_objdir/${outputname}x"
5004 $show "${rm}r $gentop"
5005 $run ${rm}r "$gentop"
5006 $show "$mkdir $gentop"
5007 $run $mkdir "$gentop"
5008 status=$?
5009 if test "$status" -ne 0 && test ! -d "$gentop"; then
5010 exit $status
5012 generated="$generated $gentop"
5014 # Add in members from convenience archives.
5015 for xlib in $addlibs; do
5016 # Extract the objects.
5017 case $xlib in
5018 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
5019 *) xabs=`pwd`"/$xlib" ;;
5020 esac
5021 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
5022 xdir="$gentop/$xlib"
5024 $show "${rm}r $xdir"
5025 $run ${rm}r "$xdir"
5026 $show "$mkdir $xdir"
5027 $run $mkdir "$xdir"
5028 status=$?
5029 if test "$status" -ne 0 && test ! -d "$xdir"; then
5030 exit $status
5032 case $host in
5033 *-*-darwin*)
5034 # ranlib-ed archives of fat binaries are converted to a fat xabs that
5035 # ar can't use. So we to split the fat xabs into non-fat ones to unpack.
5036 # We can't deal with duplicate names, since 'ar xN' and 'uniq -cd' don't work.
5037 d_archs=`lipo -info $xabs 2> /dev/null | grep '^Architectures' | sed 's/^.*: //'`
5038 if test -n "$d_archs"; then
5039 $echo "$modename: manually unpacking fat archive $xabs" 1>&2
5040 d_name=`basename $xabs`
5041 d_dir="/tmp/fat_ar.$$"
5042 d_files=''
5044 for d_arch in $d_archs; do
5045 d_archdir="$d_dir/$d_arch"
5046 $show "$mkdir -p $d_archdir"
5047 $run $mkdir -p "$d_archdir"
5049 $show "lipo -thin $d_arch $xabs -o $d_dir/$d_name"
5050 $run lipo -thin $d_arch "$xabs" -o "$d_dir/$d_name"
5052 $show "(cd $d_archdir && $AR x $d_dir/$d_name)"
5053 $run eval "(cd \$d_archdir && \$AR x \$d_dir/\$d_name)" || exit $?
5055 $show "${rm} $d_dir/$d_name"
5056 $run ${rm} "$d_dir/$d_name"
5057 done
5059 # Can't deal with blanks in file names
5060 $run eval "d_files=\`find \$d_dir -type f | sed -e 's,.*/,,' -e '/ /d' | sort -u\`" || exit $?
5062 for d_file in $d_files; do
5063 $run eval "d_f=\`find \$d_dir -name \$d_file -print\`" || exit $?
5064 $show "lipo -create $d_f -o $xdir/$d_file"
5065 $run eval "lipo -create \$d_f -o \"\$xdir/\$d_file\"" || exit $?
5066 done
5068 $show "${rm}r $d_dir"
5069 $run ${rm}r "$d_dir"
5070 else
5071 $show "(cd $xdir && $AR x $xabs)"
5072 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5076 # We will extract separately just the conflicting names and we will no
5077 # longer touch any unique names. It is faster to leave these extract
5078 # automatically by $AR in one run.
5079 $show "(cd $xdir && $AR x $xabs)"
5080 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5081 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
5083 else
5084 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
5085 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
5086 $AR t "$xabs" | sort | uniq -cd | while read -r count name
5089 while test "$i" -le "$count"
5091 # Put our $i before any first dot (extension)
5092 # Never overwrite any file
5093 name_to="$name"
5094 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
5096 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
5097 done
5098 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
5099 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
5100 i=`expr $i + 1`
5101 done
5102 done
5105 esac
5107 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5108 done
5111 # Do each command in the archive commands.
5112 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5113 eval cmds=\"$old_archive_from_new_cmds\"
5114 else
5115 eval cmds=\"$old_archive_cmds\"
5117 if len=`expr "X$cmds" : ".*"` &&
5118 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5120 else
5121 # the command line is too long to link in one step, link in parts
5122 $echo "using piecewise archive linking..."
5123 save_RANLIB=$RANLIB
5124 RANLIB=:
5125 objlist=
5126 concat_cmds=
5127 save_oldobjs=$oldobjs
5128 # GNU ar 2.10+ was changed to match POSIX; thus no paths are
5129 # encoded into archives. This makes 'ar r' malfunction in
5130 # this piecewise linking case whenever conflicting object
5131 # names appear in distinct ar calls; check, warn and compensate.
5132 if (for obj in $save_oldobjs
5134 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5135 done | sort | sort -uc >/dev/null 2>&1); then
5137 else
5138 $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5139 $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5140 AR_FLAGS=cq
5142 # Is there a better way of finding the last object in the list?
5143 for obj in $save_oldobjs
5145 last_oldobj=$obj
5146 done
5147 for obj in $save_oldobjs
5149 oldobjs="$objlist $obj"
5150 objlist="$objlist $obj"
5151 eval test_cmds=\"$old_archive_cmds\"
5152 if len=`expr "X$test_cmds" : ".*"` &&
5153 test "$len" -le "$max_cmd_len"; then
5155 else
5156 # the above command should be used before it gets too long
5157 oldobjs=$objlist
5158 if test "$obj" = "$last_oldobj" ; then
5159 RANLIB=$save_RANLIB
5161 test -z "$concat_cmds" || concat_cmds=$concat_cmds${_S_}
5162 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5163 objlist=
5165 done
5166 RANLIB=$save_RANLIB
5167 oldobjs=$objlist
5168 if test "X$oldobjs" = "X" ; then
5169 eval cmds=\"\$concat_cmds\"
5170 else
5171 eval cmds=\"\$concat_cmds${_S_}$old_archive_cmds\"
5175 save_ifs="$IFS"; IFS=$_S_
5176 for cmd in $cmds; do
5177 IFS="$save_ifs"
5178 $show "$cmd"
5179 $run eval "$cmd" || exit $?
5180 done
5181 IFS="$save_ifs"
5182 done
5184 if test -n "$generated"; then
5185 $show "${rm}r$generated"
5186 $run ${rm}r$generated
5189 # Now create the libtool archive.
5190 case $output in
5191 *.la)
5192 old_library=
5193 test "$build_old_libs" = yes && old_library="$libname.$libext"
5194 $show "creating $output"
5196 # Preserve any variables that may affect compiler behavior
5197 for var in $variables_saved_for_relink; do
5198 if eval test -z \"\${$var+set}\"; then
5199 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5200 elif eval var_value=\$$var; test -z "$var_value"; then
5201 relink_command="$var=; export $var; $relink_command"
5202 else
5203 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5204 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5206 done
5207 # Quote the link command for shipping.
5208 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
5209 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5211 # Only create the output if not a dry run.
5212 if test -z "$run"; then
5213 for installed in no yes; do
5214 if test "$installed" = yes; then
5215 if test -z "$install_libdir"; then
5216 break
5218 output="$output_objdir/$outputname"i
5219 # Replace all uninstalled libtool libraries with the installed ones
5220 newdependency_libs=
5221 for deplib in $dependency_libs; do
5222 case $deplib in
5223 *.la)
5224 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5225 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5226 if test -z "$libdir"; then
5227 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5228 exit 1
5230 newdependency_libs="$newdependency_libs $libdir/$name"
5232 *) newdependency_libs="$newdependency_libs $deplib" ;;
5233 esac
5234 done
5235 dependency_libs="$newdependency_libs"
5236 newdlfiles=
5237 for lib in $dlfiles; do
5238 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5239 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5240 if test -z "$libdir"; then
5241 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5242 exit 1
5244 newdlfiles="$newdlfiles $libdir/$name"
5245 done
5246 dlfiles="$newdlfiles"
5247 newdlprefiles=
5248 for lib in $dlprefiles; do
5249 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5250 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5251 if test -z "$libdir"; then
5252 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5253 exit 1
5255 newdlprefiles="$newdlprefiles $libdir/$name"
5256 done
5257 dlprefiles="$newdlprefiles"
5259 $rm $output
5260 # place dlname in correct position for cygwin
5261 tdlname=$dlname
5262 case $host,$output,$installed,$module,$dlname in
5263 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5264 esac
5265 $echo > $output "\
5266 # $outputname - a libtool library file
5267 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5269 # Please DO NOT delete this file!
5270 # It is necessary for linking the library.
5272 # The name that we can dlopen(3).
5273 dlname='$tdlname'
5275 # Names of this library.
5276 library_names='$library_names'
5278 # The name of the static archive.
5279 old_library='$old_library'
5281 # Libraries that this one depends upon.
5282 dependency_libs='$dependency_libs'
5284 # Version information for $libname.
5285 current=$current
5286 age=$age
5287 revision=$revision
5289 # Is this an already installed library?
5290 installed=$installed
5292 # Should we warn about portability when linking against -modules?
5293 shouldnotlink=$module
5295 # Files to dlopen/dlpreopen
5296 dlopen='$dlfiles'
5297 dlpreopen='$dlprefiles'
5299 # Directory that this library needs to be installed in:
5300 libdir='$install_libdir'"
5301 if test "$installed" = no && test "$need_relink" = yes; then
5302 $echo >> $output "\
5303 relink_command=\"$relink_command\""
5305 done
5308 # Do a symbolic link so that the libtool archive can be found in
5309 # LD_LIBRARY_PATH before the program is installed.
5310 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5311 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5313 esac
5314 exit 0
5317 # libtool install mode
5318 install)
5319 modename="$modename: install"
5321 # There may be an optional sh(1) argument at the beginning of
5322 # install_prog (especially on Windows NT).
5323 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5324 # Allow the use of GNU shtool's install command.
5325 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
5326 # Aesthetically quote it.
5327 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5328 case $arg in
5329 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5330 arg="\"$arg\""
5332 esac
5333 install_prog="$arg "
5334 arg="$1"
5335 shift
5336 else
5337 install_prog=
5338 arg="$nonopt"
5341 # The real first argument should be the name of the installation program.
5342 # Aesthetically quote it.
5343 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5344 case $arg in
5345 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5346 arg="\"$arg\""
5348 esac
5349 install_prog="$install_prog$arg"
5351 # We need to accept at least all the BSD install flags.
5352 dest=
5353 files=
5354 opts=
5355 prev=
5356 install_type=
5357 isdir=no
5358 stripme=
5359 for arg
5361 if test -n "$dest"; then
5362 files="$files $dest"
5363 dest="$arg"
5364 continue
5367 case $arg in
5368 -d) isdir=yes ;;
5369 -f) prev="-f" ;;
5370 -g) prev="-g" ;;
5371 -m) prev="-m" ;;
5372 -o) prev="-o" ;;
5374 stripme=" -s"
5375 continue
5377 -*) ;;
5380 # If the previous option needed an argument, then skip it.
5381 if test -n "$prev"; then
5382 prev=
5383 else
5384 dest="$arg"
5385 continue
5388 esac
5390 # Aesthetically quote the argument.
5391 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5392 case $arg in
5393 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
5394 arg="\"$arg\""
5396 esac
5397 install_prog="$install_prog $arg"
5398 done
5400 if test -z "$install_prog"; then
5401 $echo "$modename: you must specify an install program" 1>&2
5402 $echo "$help" 1>&2
5403 exit 1
5406 if test -n "$prev"; then
5407 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5408 $echo "$help" 1>&2
5409 exit 1
5412 if test -z "$files"; then
5413 if test -z "$dest"; then
5414 $echo "$modename: no file or destination specified" 1>&2
5415 else
5416 $echo "$modename: you must specify a destination" 1>&2
5418 $echo "$help" 1>&2
5419 exit 1
5422 # Strip any trailing slash from the destination.
5423 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5425 # Check to see that the destination is a directory.
5426 test -d "$dest" && isdir=yes
5427 if test "$isdir" = yes; then
5428 destdir="$dest"
5429 destname=
5430 else
5431 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5432 test "X$destdir" = "X$dest" && destdir=.
5433 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5435 # Not a directory, so check to see that there is only one file specified.
5436 set dummy $files
5437 if test "$#" -gt 2; then
5438 $echo "$modename: \`$dest' is not a directory" 1>&2
5439 $echo "$help" 1>&2
5440 exit 1
5443 case $destdir in
5444 [\\/]* | [A-Za-z]:[\\/]*) ;;
5446 for file in $files; do
5447 case $file in
5448 *.lo) ;;
5450 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5451 $echo "$help" 1>&2
5452 exit 1
5454 esac
5455 done
5457 esac
5459 # This variable tells wrapper scripts just to set variables rather
5460 # than running their programs.
5461 libtool_install_magic="$magic"
5463 staticlibs=
5464 future_libdirs=
5465 current_libdirs=
5466 for file in $files; do
5468 # Do each installation.
5469 case $file in
5470 *.$libext)
5471 # Do the static libraries later.
5472 staticlibs="$staticlibs $file"
5475 *.la)
5476 # Check to see that this really is a libtool archive.
5477 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5478 else
5479 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5480 $echo "$help" 1>&2
5481 exit 1
5484 library_names=
5485 old_library=
5486 relink_command=
5487 # If there is no directory component, then add one.
5488 case $file in
5489 */* | *\\*) . $file ;;
5490 *) . ./$file ;;
5491 esac
5493 # Add the libdir to current_libdirs if it is the destination.
5494 if test "X$destdir" = "X$libdir"; then
5495 case "$current_libdirs " in
5496 *" $libdir "*) ;;
5497 *) current_libdirs="$current_libdirs $libdir" ;;
5498 esac
5499 else
5500 # Note the libdir as a future libdir.
5501 case "$future_libdirs " in
5502 *" $libdir "*) ;;
5503 *) future_libdirs="$future_libdirs $libdir" ;;
5504 esac
5507 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5508 test "X$dir" = "X$file/" && dir=
5509 dir="$dir$objdir"
5511 if test -n "$relink_command"; then
5512 # Determine the prefix the user has applied to our future dir.
5513 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5515 # Don't allow the user to place us outside of our expected
5516 # location b/c this prevents finding dependent libraries that
5517 # are installed to the same prefix.
5518 # At present, this check doesn't affect windows .dll's that
5519 # are installed into $libdir/../bin (currently, that works fine)
5520 # but it's something to keep an eye on.
5521 if test "$inst_prefix_dir" = "$destdir"; then
5522 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5523 exit 1
5526 if test -n "$inst_prefix_dir"; then
5527 # Stick the inst_prefix_dir data into the link command.
5528 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5529 else
5530 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5533 $echo "$modename: warning: relinking \`$file'" 1>&2
5534 $show "$relink_command"
5535 if $run eval "$relink_command"; then :
5536 else
5537 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5538 exit 1
5542 # See the names of the shared library.
5543 set dummy $library_names
5544 if test -n "$2"; then
5545 realname="$2"
5546 shift
5547 shift
5549 srcname="$realname"
5550 test -n "$relink_command" && srcname="$realname"T
5552 # Install the shared library and build the symlinks.
5553 $show "$install_prog $dir/$srcname $destdir/$realname"
5554 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5555 if test -n "$stripme" && test -n "$striplib"; then
5556 $show "$striplib $destdir/$realname"
5557 $run eval "$striplib $destdir/$realname" || exit $?
5560 if test "$#" -gt 0; then
5561 # Delete the old symlinks, and create new ones.
5562 for linkname
5564 if test "$linkname" != "$realname"; then
5565 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5566 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5568 done
5571 # Do each command in the postinstall commands.
5572 lib="$destdir/$realname"
5573 eval cmds=\"$postinstall_cmds\"
5574 save_ifs="$IFS"; IFS=$_S_
5575 for cmd in $cmds; do
5576 IFS="$save_ifs"
5577 $show "$cmd"
5578 $run eval "$cmd" || exit $?
5579 done
5580 IFS="$save_ifs"
5583 # Install the pseudo-library for information purposes.
5584 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5585 instname="$dir/$name"i
5586 $show "$install_prog $instname $destdir/$name"
5587 $run eval "$install_prog $instname $destdir/$name" || exit $?
5589 # Maybe install the static library, too.
5590 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
5593 *.lo)
5594 # Install (i.e. copy) a libtool object.
5596 # Figure out destination file name, if it wasn't already specified.
5597 if test -n "$destname"; then
5598 destfile="$destdir/$destname"
5599 else
5600 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5601 destfile="$destdir/$destfile"
5604 # Deduce the name of the destination old-style object file.
5605 case $destfile in
5606 *.lo)
5607 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
5609 *.$objext)
5610 staticdest="$destfile"
5611 destfile=
5614 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5615 $echo "$help" 1>&2
5616 exit 1
5618 esac
5620 # Install the libtool object if requested.
5621 if test -n "$destfile"; then
5622 $show "$install_prog $file $destfile"
5623 $run eval "$install_prog $file $destfile" || exit $?
5626 # Install the old object if enabled.
5627 if test "$build_old_libs" = yes; then
5628 # Deduce the name of the old-style object file.
5629 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
5631 $show "$install_prog $staticobj $staticdest"
5632 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5634 exit 0
5638 # Figure out destination file name, if it wasn't already specified.
5639 if test -n "$destname"; then
5640 destfile="$destdir/$destname"
5641 else
5642 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5643 destfile="$destdir/$destfile"
5646 # If the file is missing, and there is a .exe on the end, strip it
5647 # because it is most likely a libtool script we actually want to
5648 # install
5649 stripped_ext=""
5650 case $file in
5651 *.exe)
5652 if test ! -f "$file"; then
5653 file=`$echo $file|${SED} 's,.exe$,,'`
5654 stripped_ext=".exe"
5657 esac
5659 # Do a test to see if this is really a libtool program.
5660 case $host in
5661 *cygwin*|*mingw*)
5662 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
5665 wrapper=$file
5667 esac
5668 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5669 notinst_deplibs=
5670 relink_command=
5672 # To insure that "foo" is sourced, and not "foo.exe",
5673 # finese the cygwin/MSYS system by explicitly sourcing "foo."
5674 # which disallows the automatic-append-.exe behavior.
5675 case $build in
5676 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5677 *) wrapperdot=${wrapper} ;;
5678 esac
5679 # If there is no directory component, then add one.
5680 case $file in
5681 */* | *\\*) . ${wrapperdot} ;;
5682 *) . ./${wrapperdot} ;;
5683 esac
5685 # Check the variables that should have been set.
5686 if test -z "$notinst_deplibs"; then
5687 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5688 exit 1
5691 finalize=yes
5692 for lib in $notinst_deplibs; do
5693 # Check to see that each library is installed.
5694 libdir=
5695 if test -f "$lib"; then
5696 # If there is no directory component, then add one.
5697 case $lib in
5698 */* | *\\*) . $lib ;;
5699 *) . ./$lib ;;
5700 esac
5702 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
5703 if test -n "$libdir" && test ! -f "$libfile"; then
5704 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
5705 finalize=no
5707 done
5709 relink_command=
5710 # To insure that "foo" is sourced, and not "foo.exe",
5711 # finese the cygwin/MSYS system by explicitly sourcing "foo."
5712 # which disallows the automatic-append-.exe behavior.
5713 case $build in
5714 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5715 *) wrapperdot=${wrapper} ;;
5716 esac
5717 # If there is no directory component, then add one.
5718 case $file in
5719 */* | *\\*) . ${wrapperdot} ;;
5720 *) . ./${wrapperdot} ;;
5721 esac
5723 outputname=
5724 if test "$fast_install" = no && test -n "$relink_command"; then
5725 if test "$finalize" = yes && test -z "$run"; then
5726 tmpdir="/tmp"
5727 test -n "$TMPDIR" && tmpdir="$TMPDIR"
5728 tmpdir="$tmpdir/libtool-$$"
5729 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
5730 else
5731 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5732 continue
5734 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5735 outputname="$tmpdir/$file"
5736 # Replace the output file specification.
5737 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5739 $show "$relink_command"
5740 if $run eval "$relink_command"; then :
5741 else
5742 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5743 ${rm}r "$tmpdir"
5744 continue
5746 file="$outputname"
5747 else
5748 $echo "$modename: warning: cannot relink \`$file'" 1>&2
5750 else
5751 # Install the binary that we compiled earlier.
5752 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5756 # remove .exe since cygwin /usr/bin/install will append another
5757 # one anyways
5758 case $install_prog,$host in
5759 */usr/bin/install*,*cygwin*)
5760 case $file:$destfile in
5761 *.exe:*.exe)
5762 # this is ok
5764 *.exe:*)
5765 destfile=$destfile.exe
5767 *:*.exe)
5768 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
5770 esac
5772 esac
5773 $show "$install_prog$stripme $file $destfile"
5774 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
5775 test -n "$outputname" && ${rm}r "$tmpdir"
5777 esac
5778 done
5780 for file in $staticlibs; do
5781 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5783 # Set up the ranlib parameters.
5784 oldlib="$destdir/$name"
5786 $show "$install_prog $file $oldlib"
5787 $run eval "$install_prog \$file \$oldlib" || exit $?
5789 if test -n "$stripme" && test -n "$striplib"; then
5790 $show "$old_striplib $oldlib"
5791 $run eval "$old_striplib $oldlib" || exit $?
5794 # Do each command in the postinstall commands.
5795 eval cmds=\"$old_postinstall_cmds\"
5796 save_ifs="$IFS"; IFS=$_S_
5797 for cmd in $cmds; do
5798 IFS="$save_ifs"
5799 $show "$cmd"
5800 $run eval "$cmd" || exit $?
5801 done
5802 IFS="$save_ifs"
5803 done
5805 if test -n "$future_libdirs"; then
5806 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
5809 if test -n "$current_libdirs"; then
5810 # Maybe just do a dry run.
5811 test -n "$run" && current_libdirs=" -n$current_libdirs"
5812 exec_cmd='$SHELL $0 --finish$current_libdirs'
5813 else
5814 exit 0
5818 # libtool finish mode
5819 finish)
5820 modename="$modename: finish"
5821 libdirs="$nonopt"
5822 admincmds=
5824 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5825 for dir
5827 libdirs="$libdirs $dir"
5828 done
5830 for libdir in $libdirs; do
5831 if test -n "$finish_cmds"; then
5832 # Do each command in the finish commands.
5833 eval cmds=\"$finish_cmds\"
5834 save_ifs="$IFS"; IFS=$_S_
5835 for cmd in $cmds; do
5836 IFS="$save_ifs"
5837 $show "$cmd"
5838 $run eval "$cmd" || admincmds="$admincmds
5839 $cmd"
5840 done
5841 IFS="$save_ifs"
5843 if test -n "$finish_eval"; then
5844 # Do the single finish_eval.
5845 eval cmds=\"$finish_eval\"
5846 $run eval "$cmds" || admincmds="$admincmds
5847 $cmds"
5849 done
5852 # Exit here if they wanted silent mode.
5853 test "$show" = : && exit 0
5855 $echo "----------------------------------------------------------------------"
5856 $echo "Libraries have been installed in:"
5857 for libdir in $libdirs; do
5858 $echo " $libdir"
5859 done
5860 $echo
5861 $echo "If you ever happen to want to link against installed libraries"
5862 $echo "in a given directory, LIBDIR, you must either use libtool, and"
5863 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5864 $echo "flag during linking and do at least one of the following:"
5865 if test -n "$shlibpath_var"; then
5866 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
5867 $echo " during execution"
5869 if test -n "$runpath_var"; then
5870 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
5871 $echo " during linking"
5873 if test -n "$hardcode_libdir_flag_spec"; then
5874 libdir=LIBDIR
5875 eval flag=\"$hardcode_libdir_flag_spec\"
5877 $echo " - use the \`$flag' linker flag"
5879 if test -n "$admincmds"; then
5880 $echo " - have your system administrator run these commands:$admincmds"
5882 if test -f /etc/ld.so.conf; then
5883 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5885 $echo
5886 $echo "See any operating system documentation about shared libraries for"
5887 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5888 $echo "----------------------------------------------------------------------"
5889 exit 0
5892 # libtool execute mode
5893 execute)
5894 modename="$modename: execute"
5896 # The first argument is the command name.
5897 cmd="$nonopt"
5898 if test -z "$cmd"; then
5899 $echo "$modename: you must specify a COMMAND" 1>&2
5900 $echo "$help"
5901 exit 1
5904 # Handle -dlopen flags immediately.
5905 for file in $execute_dlfiles; do
5906 if test ! -f "$file"; then
5907 $echo "$modename: \`$file' is not a file" 1>&2
5908 $echo "$help" 1>&2
5909 exit 1
5912 dir=
5913 case $file in
5914 *.la)
5915 # Check to see that this really is a libtool archive.
5916 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5917 else
5918 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5919 $echo "$help" 1>&2
5920 exit 1
5923 # Read the libtool library.
5924 dlname=
5925 library_names=
5927 # If there is no directory component, then add one.
5928 case $file in
5929 */* | *\\*) . $file ;;
5930 *) . ./$file ;;
5931 esac
5933 # Skip this library if it cannot be dlopened.
5934 if test -z "$dlname"; then
5935 # Warn if it was a shared library.
5936 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5937 continue
5940 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5941 test "X$dir" = "X$file" && dir=.
5943 if test -f "$dir/$objdir/$dlname"; then
5944 dir="$dir/$objdir"
5945 else
5946 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5947 exit 1
5951 *.lo)
5952 # Just add the directory containing the .lo file.
5953 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5954 test "X$dir" = "X$file" && dir=.
5958 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5959 continue
5961 esac
5963 # Get the absolute pathname.
5964 absdir=`cd "$dir" && pwd`
5965 test -n "$absdir" && dir="$absdir"
5967 # Now add the directory to shlibpath_var.
5968 if eval "test -z \"\$$shlibpath_var\""; then
5969 eval "$shlibpath_var=\"\$dir\""
5970 else
5971 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5973 done
5975 # This variable tells wrapper scripts just to set shlibpath_var
5976 # rather than running their programs.
5977 libtool_execute_magic="$magic"
5979 # Check if any of the arguments is a wrapper script.
5980 args=
5981 for file
5983 case $file in
5984 -*) ;;
5986 # Do a test to see if this is really a libtool program.
5987 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5988 # If there is no directory component, then add one.
5989 case $file in
5990 */* | *\\*) . $file ;;
5991 *) . ./$file ;;
5992 esac
5994 # Transform arg to wrapped name.
5995 file="$progdir/$program"
5998 esac
5999 # Quote arguments (to preserve shell metacharacters).
6000 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6001 args="$args \"$file\""
6002 done
6004 if test -z "$run"; then
6005 if test -n "$shlibpath_var"; then
6006 # Export the shlibpath_var.
6007 eval "export $shlibpath_var"
6010 # Restore saved environment variables
6011 if test "${save_LC_ALL+set}" = set; then
6012 LC_ALL="$save_LC_ALL"; export LC_ALL
6014 if test "${save_LANG+set}" = set; then
6015 LANG="$save_LANG"; export LANG
6018 # Now prepare to actually exec the command.
6019 exec_cmd="\$cmd$args"
6020 else
6021 # Display what would be done.
6022 if test -n "$shlibpath_var"; then
6023 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6024 $echo "export $shlibpath_var"
6026 $echo "$cmd$args"
6027 exit 0
6031 # libtool clean and uninstall mode
6032 clean | uninstall)
6033 modename="$modename: $mode"
6034 rm="$nonopt"
6035 files=
6036 rmforce=
6037 exit_status=0
6039 # This variable tells wrapper scripts just to set variables rather
6040 # than running their programs.
6041 libtool_install_magic="$magic"
6043 for arg
6045 case $arg in
6046 -f) rm="$rm $arg"; rmforce=yes ;;
6047 -*) rm="$rm $arg" ;;
6048 *) files="$files $arg" ;;
6049 esac
6050 done
6052 if test -z "$rm"; then
6053 $echo "$modename: you must specify an RM program" 1>&2
6054 $echo "$help" 1>&2
6055 exit 1
6058 rmdirs=
6060 origobjdir="$objdir"
6061 for file in $files; do
6062 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6063 if test "X$dir" = "X$file"; then
6064 dir=.
6065 objdir="$origobjdir"
6066 else
6067 objdir="$dir/$origobjdir"
6069 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6070 test "$mode" = uninstall && objdir="$dir"
6072 # Remember objdir for removal later, being careful to avoid duplicates
6073 if test "$mode" = clean; then
6074 case " $rmdirs " in
6075 *" $objdir "*) ;;
6076 *) rmdirs="$rmdirs $objdir" ;;
6077 esac
6080 # Don't error if the file doesn't exist and rm -f was used.
6081 if (test -L "$file") >/dev/null 2>&1 \
6082 || (test -h "$file") >/dev/null 2>&1 \
6083 || test -f "$file"; then
6085 elif test -d "$file"; then
6086 exit_status=1
6087 continue
6088 elif test "$rmforce" = yes; then
6089 continue
6092 rmfiles="$file"
6094 case $name in
6095 *.la)
6096 # Possibly a libtool archive, so verify it.
6097 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6098 . $dir/$name
6100 # Delete the libtool libraries and symlinks.
6101 for n in $library_names; do
6102 rmfiles="$rmfiles $objdir/$n"
6103 done
6104 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6105 test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6107 if test "$mode" = uninstall; then
6108 if test -n "$library_names"; then
6109 # Do each command in the postuninstall commands.
6110 eval cmds=\"$postuninstall_cmds\"
6111 save_ifs="$IFS"; IFS=$_S_
6112 for cmd in $cmds; do
6113 IFS="$save_ifs"
6114 $show "$cmd"
6115 $run eval "$cmd"
6116 if test "$?" -ne 0 && test "$rmforce" != yes; then
6117 exit_status=1
6119 done
6120 IFS="$save_ifs"
6123 if test -n "$old_library"; then
6124 # Do each command in the old_postuninstall commands.
6125 eval cmds=\"$old_postuninstall_cmds\"
6126 save_ifs="$IFS"; IFS=$_S_
6127 for cmd in $cmds; do
6128 IFS="$save_ifs"
6129 $show "$cmd"
6130 $run eval "$cmd"
6131 if test "$?" -ne 0 && test "$rmforce" != yes; then
6132 exit_status=1
6134 done
6135 IFS="$save_ifs"
6137 # FIXME: should reinstall the best remaining shared library.
6142 *.lo)
6143 # Possibly a libtool object, so verify it.
6144 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6146 # Read the .lo file
6147 . $dir/$name
6149 # Add PIC object to the list of files to remove.
6150 if test -n "$pic_object" \
6151 && test "$pic_object" != none; then
6152 rmfiles="$rmfiles $dir/$pic_object"
6155 # Add non-PIC object to the list of files to remove.
6156 if test -n "$non_pic_object" \
6157 && test "$non_pic_object" != none; then
6158 rmfiles="$rmfiles $dir/$non_pic_object"
6164 if test "$mode" = clean ; then
6165 noexename=$name
6166 case $file in
6167 *.exe)
6168 file=`$echo $file|${SED} 's,.exe$,,'`
6169 noexename=`$echo $name|${SED} 's,.exe$,,'`
6170 # $file with .exe has already been added to rmfiles,
6171 # add $file without .exe
6172 rmfiles="$rmfiles $file"
6174 esac
6175 # Do a test to see if this is a libtool program.
6176 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6177 relink_command=
6178 . $dir/$noexename
6180 # note $name still contains .exe if it was in $file originally
6181 # as does the version of $file that was added into $rmfiles
6182 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6183 if test "$fast_install" = yes && test -n "$relink_command"; then
6184 rmfiles="$rmfiles $objdir/lt-$name"
6186 if test "X$noexename" != "X$name" ; then
6187 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6192 esac
6193 $show "$rm $rmfiles"
6194 $run $rm $rmfiles || exit_status=1
6195 done
6196 objdir="$origobjdir"
6198 # Try to remove the ${objdir}s in the directories where we deleted files
6199 for dir in $rmdirs; do
6200 if test -d "$dir"; then
6201 $show "rmdir $dir"
6202 $run rmdir $dir >/dev/null 2>&1
6204 done
6206 exit $exit_status
6210 $echo "$modename: you must specify a MODE" 1>&2
6211 $echo "$generic_help" 1>&2
6212 exit 1
6214 esac
6216 if test -z "$exec_cmd"; then
6217 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6218 $echo "$generic_help" 1>&2
6219 exit 1
6221 fi # test -z "$show_help"
6223 if test -n "$exec_cmd"; then
6224 eval exec $exec_cmd
6225 exit 1
6228 # We need to display help for each of the modes.
6229 case $mode in
6230 "") $echo \
6231 "Usage: $modename [OPTION]... [MODE-ARG]...
6233 Provide generalized library-building support services.
6235 --config show all configuration variables
6236 --debug enable verbose shell tracing
6237 -n, --dry-run display commands without modifying any files
6238 --features display basic configuration information and exit
6239 --finish same as \`--mode=finish'
6240 --help display this help message and exit
6241 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6242 --quiet same as \`--silent'
6243 --silent don't print informational messages
6244 --tag=TAG use configuration variables from tag TAG
6245 --version print version information
6247 MODE must be one of the following:
6249 clean remove files from the build directory
6250 compile compile a source file into a libtool object
6251 execute automatically set library path, then run a program
6252 finish complete the installation of libtool libraries
6253 install install libraries or executables
6254 link create a library or an executable
6255 uninstall remove libraries from an installed directory
6257 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6258 a more detailed description of MODE.
6260 Report bugs to <bug-libtool@gnu.org>."
6261 exit 0
6264 clean)
6265 $echo \
6266 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6268 Remove files from the build directory.
6270 RM is the name of the program to use to delete files associated with each FILE
6271 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6272 to RM.
6274 If FILE is a libtool library, object or program, all the files associated
6275 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6278 compile)
6279 $echo \
6280 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6282 Compile a source file into a libtool library object.
6284 This mode accepts the following additional options:
6286 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6287 -prefer-pic try to building PIC objects only
6288 -prefer-non-pic try to building non-PIC objects only
6289 -static always build a \`.o' file suitable for static linking
6291 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6292 from the given SOURCEFILE.
6294 The output file name is determined by removing the directory component from
6295 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6296 library object suffix, \`.lo'."
6299 execute)
6300 $echo \
6301 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6303 Automatically set library path, then run a program.
6305 This mode accepts the following additional options:
6307 -dlopen FILE add the directory containing FILE to the library path
6309 This mode sets the library path environment variable according to \`-dlopen'
6310 flags.
6312 If any of the ARGS are libtool executable wrappers, then they are translated
6313 into their corresponding uninstalled binary, and any of their required library
6314 directories are added to the library path.
6316 Then, COMMAND is executed, with ARGS as arguments."
6319 finish)
6320 $echo \
6321 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6323 Complete the installation of libtool libraries.
6325 Each LIBDIR is a directory that contains libtool libraries.
6327 The commands that this mode executes may require superuser privileges. Use
6328 the \`--dry-run' option if you just want to see what would be executed."
6331 install)
6332 $echo \
6333 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6335 Install executables or libraries.
6337 INSTALL-COMMAND is the installation command. The first component should be
6338 either the \`install' or \`cp' program.
6340 The rest of the components are interpreted as arguments to that command (only
6341 BSD-compatible install options are recognized)."
6344 link)
6345 $echo \
6346 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6348 Link object files or libraries together to form another library, or to
6349 create an executable program.
6351 LINK-COMMAND is a command using the C compiler that you would use to create
6352 a program from several object files.
6354 The following components of LINK-COMMAND are treated specially:
6356 -all-static do not do any dynamic linking at all
6357 -avoid-version do not add a version suffix if possible
6358 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6359 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6360 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6361 -export-symbols SYMFILE
6362 try to export only the symbols listed in SYMFILE
6363 -export-symbols-regex REGEX
6364 try to export only the symbols matching REGEX
6365 -LLIBDIR search LIBDIR for required installed libraries
6366 -lNAME OUTPUT-FILE requires the installed library libNAME
6367 -module build a library that can dlopened
6368 -no-fast-install disable the fast-install mode
6369 -no-install link a not-installable executable
6370 -no-undefined declare that a library does not refer to external symbols
6371 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6372 -objectlist FILE Use a list of object files found in FILE to specify objects
6373 -release RELEASE specify package release information
6374 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6375 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6376 -static do not do any dynamic linking of libtool libraries
6377 -version-info CURRENT[:REVISION[:AGE]]
6378 specify library version info [each variable defaults to 0]
6380 All other options (arguments beginning with \`-') are ignored.
6382 Every other argument is treated as a filename. Files ending in \`.la' are
6383 treated as uninstalled libtool libraries, other files are standard or library
6384 object files.
6386 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6387 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6388 required, except when creating a convenience library.
6390 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6391 using \`ar' and \`ranlib', or on Windows using \`lib'.
6393 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6394 is created, otherwise an executable program is created."
6397 uninstall)
6398 $echo \
6399 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6401 Remove libraries from an installation directory.
6403 RM is the name of the program to use to delete files associated with each FILE
6404 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6405 to RM.
6407 If FILE is a libtool library, all the files associated with it are deleted.
6408 Otherwise, only FILE itself is deleted using RM."
6412 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6413 $echo "$help" 1>&2
6414 exit 1
6416 esac
6418 $echo
6419 $echo "Try \`$modename --help' for more information about other modes."
6421 exit 0
6423 # The TAGs below are defined such that we never get into a situation
6424 # in which we disable both kinds of libraries. Given conflicting
6425 # choices, we go for a static library, that is the most portable,
6426 # since we can't tell whether shared libraries were disabled because
6427 # the user asked for that or because the platform doesn't support
6428 # them. This is particularly important on AIX, because we don't
6429 # support having both static and shared libraries enabled at the same
6430 # time on that platform, so we default to a shared-only configuration.
6431 # If a disable-shared tag is given, we'll fallback to a static-only
6432 # configuration. But we'll never go from static-only to shared-only.
6434 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6435 build_libtool_libs=no
6436 build_old_libs=yes
6437 # ### END LIBTOOL TAG CONFIG: disable-shared
6439 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6440 build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
6441 # ### END LIBTOOL TAG CONFIG: disable-static
6443 # Local Variables:
6444 # mode:shell-script
6445 # sh-indentation:2
6446 # End: