1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
36 # The name of this program:
37 progname=`echo "$progpath" | $SED $basename`
47 TIMESTAMP=" (1.1220.2.287 2005/08/31 18:54:15)"
49 # See if we are running on zsh, and set the options which allow our
50 # commands through without removal of \ escapes.
51 if test -n "${ZSH_VERSION+set}" ; then
55 # Check that we have a working $echo.
56 if test "X$1" = X--no-reexec; then
57 # Discard the --no-reexec flag, and continue.
59 elif test "X$1" = X--fallback-echo; then
60 # Avoid inline document here, it may be left over
62 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
63 # Yippee, $echo works!
66 # Restart under the correct shell, and then maybe $echo will work.
67 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
70 if test "X$1" = X--fallback-echo; then
71 # used as fallback echo
80 help="Try \`$progname --help' for more information."
81 magic="%%%MAGIC variable%%%"
86 # Sed substitution that helps us do robust quoting. It backslashifies
87 # metacharacters that are still active within double-quoted strings.
88 Xsed="${SED}"' -e 1s/^X//'
89 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
90 # test EBCDIC or ASCII
91 case `echo X|tr X '\101'` in
92 A) # ASCII based system
93 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
95 NL2SP='tr \015\012 \040\040'
97 *) # EBCDIC based system
99 NL2SP='tr \r\n \100\100'
104 # Only set LANG and LC_ALL to C if already set.
105 # These must not be set unconditionally because not all systems understand
106 # e.g. LANG=C (notably SCO).
107 # We save the old values to restore during execute mode.
108 if test "${LC_ALL+set}" = set; then
109 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
111 if test "${LANG+set}" = set; then
112 save_LANG="$LANG"; LANG=C; export LANG
115 # Make sure IFS has a sensible default
120 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
121 $echo "$modename: not configured to build any kind of library" 1>&2
122 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
135 lo2o="s/\\.lo\$/.${objext}/"
136 o2lo="s/\\.${objext}\$/.lo/"
138 #####################################
139 # Shell function definitions:
140 # This seems to be the best place for them
142 # func_win32_libid arg
143 # return the library type of file 'arg'
145 # Need a lot of goo to handle *both* DLLs and import libs
146 # Has to be a shell function in order to 'eat' the argument
147 # that is supplied when $file_magic_command is called.
150 win32_libid_type="unknown"
151 win32_fileres=`file -L $1 2>/dev/null`
152 case $win32_fileres in
153 *ar\ archive\ import\ library*) # definitely import
154 win32_libid_type="x86 archive import"
156 *ar\ archive*) # could be an import, or static
157 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
158 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
159 win32_nmres=`eval $NM -f posix -A $1 | \
160 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
161 if test "X$win32_nmres" = "Ximport" ; then
162 win32_libid_type="x86 archive import"
164 win32_libid_type="x86 archive static"
169 win32_libid_type="x86 DLL"
171 *executable*) # but shell scripts are "executable" too...
172 case $win32_fileres in
173 *MS\ Windows\ PE\ Intel*)
174 win32_libid_type="x86 DLL"
179 $echo $win32_libid_type
184 # Infer tagged configuration to use if any are available and
185 # if one wasn't chosen via the "--tag" command line option.
186 # Only attempt this if the compiler in the base compile
187 # command doesn't match the default compiler.
188 # arg is usually of the form 'gcc ...'
191 if test -n "$available_tags" && test -z "$tagname"; then
195 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
199 CC_quoted="$CC_quoted $arg"
202 # Blanks in the command may have been stripped by the calling shell,
203 # but not from the CC environment variable when configure was run.
204 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
205 # Blanks at the start of $base_compile will cause this to fail
206 # if we don't check for them as well.
208 for z in $available_tags; do
209 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
210 # Evaluate the configuration.
211 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
214 # Double-quote args containing other shell metacharacters.
216 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
220 CC_quoted="$CC_quoted $arg"
223 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
224 # The compiler in the base compile command matches
225 # the one in the tagged configuration.
226 # Assume this is the tagged configuration we want.
233 # If $tagname still isn't set, then no tagged configuration
234 # was found and let the user know that the "--tag" command
235 # line option must be used.
236 if test -z "$tagname"; then
237 $echo "$modename: unable to infer tagged configuration"
238 $echo "$modename: specify a tag with \`--tag'" 1>&2
241 # $echo "$modename: using $tagname tagged configuration"
249 # func_extract_an_archive dir oldlib
250 func_extract_an_archive ()
252 f_ex_an_ar_dir="$1"; shift
253 f_ex_an_ar_oldlib="$1"
255 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
256 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
257 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
260 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
265 # func_extract_archives gentop oldlib ...
266 func_extract_archives ()
268 my_gentop="$1"; shift
276 $show "${rm}r $my_gentop"
277 $run ${rm}r "$my_gentop"
278 $show "$mkdir $my_gentop"
279 $run $mkdir "$my_gentop"
281 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
285 for my_xlib in $my_oldlibs; do
286 # Extract the objects.
288 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
289 *) my_xabs=`pwd`"/$my_xlib" ;;
291 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
292 my_xdir="$my_gentop/$my_xlib"
294 $show "${rm}r $my_xdir"
295 $run ${rm}r "$my_xdir"
296 $show "$mkdir $my_xdir"
297 $run $mkdir "$my_xdir"
299 if test "$status" -ne 0 && test ! -d "$my_xdir"; then
304 $show "Extracting $my_xabs"
305 # Do not bother doing anything if just a dry run
306 if test -z "$run"; then
307 darwin_orig_dir=`pwd`
308 cd $my_xdir || exit $?
309 darwin_archive=$my_xabs
311 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
312 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
313 if test -n "$darwin_arches"; then
314 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
316 $show "$darwin_base_archive has multiple architectures $darwin_arches"
317 for darwin_arch in $darwin_arches ; do
318 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
319 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
320 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
321 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
323 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
324 done # $darwin_arches
325 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
326 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
329 for darwin_file in $darwin_filelist; do
330 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
331 lipo -create -output "$darwin_file" $darwin_files
332 done # $darwin_filelist
334 cd "$darwin_orig_dir"
336 cd "$darwin_orig_dir"
337 func_extract_an_archive "$my_xdir" "$my_xabs"
342 func_extract_an_archive "$my_xdir" "$my_xabs"
345 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
347 func_extract_archives_result="$my_oldobjs"
349 # End of Shell function definitions
350 #####################################
353 eval std_shrext=\"$shrext_cmds\"
355 # Parse our command line options once, thoroughly.
356 while test "$#" -gt 0
362 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
366 # If the previous option needs an argument, assign it.
367 if test -n "$prev"; then
370 execute_dlfiles="$execute_dlfiles $arg"
374 preserve_args="${preserve_args}=$arg"
376 # Check whether tagname contains only valid characters
379 $echo "$progname: invalid tag name: $tagname" 1>&2
386 # Don't test for the "default" C tag, as we know, it's there, but
387 # not specially marked.
390 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
391 taglist="$taglist $tagname"
392 # Evaluate the configuration.
393 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
395 $echo "$progname: ignoring unknown tag $tagname" 1>&2
410 # Have we seen a non-optional argument yet?
417 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
419 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
420 $echo "This is free software; see the source for copying conditions. There is NO"
421 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
426 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
427 # Now print the configurations for the tags.
428 for tagname in $taglist; do
429 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
435 $echo "$progname: enabling shell trace mode"
437 preserve_args="$preserve_args $arg"
446 if test "$build_libtool_libs" = yes; then
447 $echo "enable shared libraries"
449 $echo "disable shared libraries"
451 if test "$build_old_libs" = yes; then
452 $echo "enable static libraries"
454 $echo "disable static libraries"
459 --finish) mode="finish" ;;
461 --mode) prevopt="--mode" prev=mode ;;
462 --mode=*) mode="$optarg" ;;
464 --preserve-dup-deps) duplicate_deps="yes" ;;
468 preserve_args="$preserve_args $arg"
471 --tag) prevopt="--tag" prev=tag ;;
473 set tag "$optarg" ${1+"$@"}
476 preserve_args="$preserve_args --tag"
485 $echo "$modename: unrecognized option \`$arg'" 1>&2
497 if test -n "$prevopt"; then
498 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
503 # If this variable is set in any of the actions, the command in it
504 # will be execed at the end. This prevents here-documents from being
505 # left over by shells.
508 if test -z "$show_help"; then
510 # Infer the operation mode.
511 if test -z "$mode"; then
512 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
513 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
515 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
527 *db | *dbx | *strace | *truss)
537 # If we have no mode, but dlfiles were specified, then do execute mode.
538 test -n "$execute_dlfiles" && mode=execute
540 # Just use the default operation mode.
541 if test -z "$mode"; then
542 if test -n "$nonopt"; then
543 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
545 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
552 # Only execute mode is allowed to have -dlopen flags.
553 if test -n "$execute_dlfiles" && test "$mode" != execute; then
554 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
559 # Change the help message to a mode-specific one.
561 help="Try \`$modename --help --mode=$mode' for more information."
563 # These modes are in order of execution frequency so that they run quickly.
565 # libtool compile mode
567 modename="$modename: compile"
568 # Get the compilation command and the source file.
570 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
581 # do not "continue". Instead, add this to base_compile
593 # Accept any command-line options.
596 if test -n "$libobj" ; then
597 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
604 -static | -prefer-pic | -prefer-non-pic)
615 arg_mode=arg # the next one goes into the "base_compile" arg list
616 continue # The current "srcfile" will either be retained or
617 ;; # replaced later. I would guess that would be a bug.
620 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
622 save_ifs="$IFS"; IFS=','
626 # Double-quote args containing other shell metacharacters.
627 # Many Bourne shells cannot handle close brackets correctly
628 # in scan sets, so we specify it separately.
630 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
634 lastarg="$lastarg $arg"
637 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
639 # Add the arguments to base_compile.
640 base_compile="$base_compile $lastarg"
645 # Accept the current argument as the source file.
646 # The previous "srcfile" becomes the current argument.
653 esac # case $arg_mode
655 # Aesthetically quote the previous argument.
656 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
659 # Double-quote args containing other shell metacharacters.
660 # Many Bourne shells cannot handle close brackets correctly
661 # in scan sets, and some SunOS ksh mistreat backslash-escaping
662 # in scan sets (worked around with variable expansion),
663 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
664 # at all, so we specify them separately.
665 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
666 lastarg="\"$lastarg\""
670 base_compile="$base_compile $lastarg"
675 $echo "$modename: you must specify an argument for -Xcompile"
679 $echo "$modename: you must specify a target with \`-o'" 1>&2
683 # Get the name of the library object.
684 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
688 # Recognize several different file suffixes.
689 # If the user specifies -o file.o, it is replaced with file.lo
699 *.class) xform=class ;;
704 *.java) xform=java ;;
707 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
710 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
712 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
717 func_infer_tag $base_compile
719 for arg in $later; do
738 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
740 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
741 qlibobj="\"$qlibobj\"" ;;
743 test "X$libobj" != "X$qlibobj" \
744 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
745 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
746 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
747 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
748 if test "X$xdir" = "X$obj"; then
753 lobj=${xdir}$objdir/$objname
755 if test -z "$base_compile"; then
756 $echo "$modename: you must specify a compilation command" 1>&2
761 # Delete any leftover library objects.
762 if test "$build_old_libs" = yes; then
763 removelist="$obj $lobj $libobj ${libobj}T"
765 removelist="$lobj $libobj ${libobj}T"
769 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
771 # On Cygwin there's no "real" PIC flag so we must build both object types
773 cygwin* | mingw* | pw32* | os2*)
777 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
778 # non-PIC code in shared libraries is not supported
782 # Calculate the filename of the output object if compiler does
783 # not support -o with -c
784 if test "$compiler_c_o" = no; then
785 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
786 lockfile="$output_obj.lock"
787 removelist="$removelist $output_obj $lockfile"
788 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
795 # Lock this critical section if it is needed
796 # We use this script file to make the link, it avoids creating a new file
797 if test "$need_locks" = yes; then
798 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
799 $show "Waiting for $lockfile to be removed"
802 elif test "$need_locks" = warn; then
803 if test -f "$lockfile"; then
805 *** ERROR, $lockfile exists and contains:
806 `cat $lockfile 2>/dev/null`
808 This indicates that another process is trying to use the same
809 temporary object file, and libtool could not work around it because
810 your compiler does not support \`-c' and \`-o' together. If you
811 repeat this compilation, it may succeed, by chance, but you had better
812 avoid parallel builds (make -j) in this platform, or get a better
818 $echo "$srcfile" > "$lockfile"
821 if test -n "$fix_srcfile_path"; then
822 eval srcfile=\"$fix_srcfile_path\"
824 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
826 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
827 qsrcfile="\"$qsrcfile\"" ;;
830 $run $rm "$libobj" "${libobj}T"
832 # Create a libtool object file (analogous to a ".la" file),
833 # but don't create it if we're doing a dry run.
834 test -z "$run" && cat > ${libobj}T <<EOF
835 # $libobj - a libtool object file
836 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
838 # Please DO NOT delete this file!
839 # It is necessary for linking the library.
841 # Name of the PIC object.
844 # Only build a PIC object if we are building libtool libraries.
845 if test "$build_libtool_libs" = yes; then
846 # Without this assignment, base_compile gets emptied.
847 fbsd_hideous_sh_bug=$base_compile
849 if test "$pic_mode" != no; then
850 command="$base_compile $qsrcfile $pic_flag"
852 # Don't build PIC code
853 command="$base_compile $qsrcfile"
856 if test ! -d "${xdir}$objdir"; then
857 $show "$mkdir ${xdir}$objdir"
858 $run $mkdir ${xdir}$objdir
860 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
865 if test -z "$output_obj"; then
866 # Place PIC objects in $objdir
867 command="$command -o $lobj"
870 $run $rm "$lobj" "$output_obj"
873 if $run eval "$command"; then :
875 test -n "$output_obj" && $run $rm $removelist
879 if test "$need_locks" = warn &&
880 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
882 *** ERROR, $lockfile contains:
883 `cat $lockfile 2>/dev/null`
885 but it should contain:
888 This indicates that another process is trying to use the same
889 temporary object file, and libtool could not work around it because
890 your compiler does not support \`-c' and \`-o' together. If you
891 repeat this compilation, it may succeed, by chance, but you had better
892 avoid parallel builds (make -j) in this platform, or get a better
899 # Just move the object if needed, then go on to compile the next one
900 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
901 $show "$mv $output_obj $lobj"
902 if $run $mv $output_obj $lobj; then :
910 # Append the name of the PIC object to the libtool object file.
911 test -z "$run" && cat >> ${libobj}T <<EOF
912 pic_object='$objdir/$objname'
916 # Allow error messages only from the first compilation.
917 if test "$suppress_opt" = yes; then
918 suppress_output=' >/dev/null 2>&1'
921 # No PIC object so indicate it doesn't exist in the libtool
923 test -z "$run" && cat >> ${libobj}T <<EOF
929 # Only build a position-dependent object if we build old libraries.
930 if test "$build_old_libs" = yes; then
931 if test "$pic_mode" != yes; then
932 # Don't build PIC code
933 command="$base_compile $qsrcfile"
935 command="$base_compile $qsrcfile $pic_flag"
937 if test "$compiler_c_o" = yes; then
938 command="$command -o $obj"
941 # Suppress compiler output if we already did a PIC compilation.
942 command="$command$suppress_output"
943 $run $rm "$obj" "$output_obj"
945 if $run eval "$command"; then :
951 if test "$need_locks" = warn &&
952 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
954 *** ERROR, $lockfile contains:
955 `cat $lockfile 2>/dev/null`
957 but it should contain:
960 This indicates that another process is trying to use the same
961 temporary object file, and libtool could not work around it because
962 your compiler does not support \`-c' and \`-o' together. If you
963 repeat this compilation, it may succeed, by chance, but you had better
964 avoid parallel builds (make -j) in this platform, or get a better
971 # Just move the object if needed
972 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
973 $show "$mv $output_obj $obj"
974 if $run $mv $output_obj $obj; then :
982 # Append the name of the non-PIC object the libtool object file.
983 # Only append if the libtool object file exists.
984 test -z "$run" && cat >> ${libobj}T <<EOF
985 # Name of the non-PIC object.
986 non_pic_object='$objname'
990 # Append the name of the non-PIC object the libtool object file.
991 # Only append if the libtool object file exists.
992 test -z "$run" && cat >> ${libobj}T <<EOF
993 # Name of the non-PIC object.
999 $run $mv "${libobj}T" "${libobj}"
1001 # Unlock the critical section if it was locked
1002 if test "$need_locks" != no; then
1003 $run $rm "$lockfile"
1011 modename="$modename: link"
1013 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1014 # It is impossible to link a dll without this setting, and
1015 # we shouldn't force the makefile maintainer to figure out
1016 # which system we are compiling for in order to pass an extra
1017 # flag for every libtool invocation.
1018 # allow_undefined=no
1020 # FIXME: Unfortunately, there are problems with the above when trying
1021 # to make a dll which has undefined symbols, in which case not
1022 # even a static library is built. For now, we need to specify
1023 # -no-undefined on the libtool link line when we can be certain
1024 # that all symbols are satisfied, otherwise we get a static library.
1031 libtool_args="$nonopt"
1032 base_compile="$nonopt $@"
1033 compile_command="$nonopt"
1034 finalize_command="$nonopt"
1047 lib_search_path=`pwd`
1056 export_symbols_regex=
1064 precious_files_regex=
1065 prefer_static_libs=no
1078 func_infer_tag $base_compile
1080 # We need to know -static, to get the right output filenames.
1084 -all-static | -static)
1085 if test "X$arg" = "X-all-static"; then
1086 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1087 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1089 if test -n "$link_static_flag"; then
1090 dlopen_self=$dlopen_self_static
1093 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1094 dlopen_self=$dlopen_self_static
1097 build_libtool_libs=no
1099 prefer_static_libs=yes
1105 # See if our shared archives depend on static archives.
1106 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1108 # Go through the arguments, transforming them on the way.
1109 while test "$#" -gt 0; do
1113 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1114 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1118 libtool_args="$libtool_args $qarg"
1120 # If the previous option needs an argument, assign it.
1121 if test -n "$prev"; then
1124 compile_command="$compile_command @OUTPUT@"
1125 finalize_command="$finalize_command @OUTPUT@"
1131 if test "$preload" = no; then
1132 # Add the symbol object into the linking commands.
1133 compile_command="$compile_command @SYMFILE@"
1134 finalize_command="$finalize_command @SYMFILE@"
1138 *.la | *.lo) ;; # We handle these cases below.
1140 if test "$dlself" = no; then
1148 if test "$prev" = dlprefiles; then
1150 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1160 if test "$prev" = dlfiles; then
1161 dlfiles="$dlfiles $arg"
1163 dlprefiles="$dlprefiles $arg"
1171 export_symbols="$arg"
1172 if test ! -f "$arg"; then
1173 $echo "$modename: symbol file \`$arg' does not exist"
1180 export_symbols_regex="$arg"
1185 inst_prefix_dir="$arg"
1190 precious_files_regex="$arg"
1200 if test -f "$arg"; then
1203 for fil in `cat $save_arg`
1205 # moreargs="$moreargs $fil"
1207 # A libtool-controlled object.
1209 # Check to see that this really is a libtool object.
1210 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1215 # If there is no directory component, then add one.
1217 */* | *\\*) . $arg ;;
1221 if test -z "$pic_object" || \
1222 test -z "$non_pic_object" ||
1223 test "$pic_object" = none && \
1224 test "$non_pic_object" = none; then
1225 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1229 # Extract subdirectory from the argument.
1230 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1231 if test "X$xdir" = "X$arg"; then
1237 if test "$pic_object" != none; then
1238 # Prepend the subdirectory the object is found in.
1239 pic_object="$xdir$pic_object"
1241 if test "$prev" = dlfiles; then
1242 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1243 dlfiles="$dlfiles $pic_object"
1247 # If libtool objects are unsupported, then we need to preload.
1252 # CHECK ME: I think I busted this. -Ossama
1253 if test "$prev" = dlprefiles; then
1254 # Preload the old-style object.
1255 dlprefiles="$dlprefiles $pic_object"
1260 libobjs="$libobjs $pic_object"
1265 if test "$non_pic_object" != none; then
1266 # Prepend the subdirectory the object is found in.
1267 non_pic_object="$xdir$non_pic_object"
1269 # A standard non-PIC object
1270 non_pic_objects="$non_pic_objects $non_pic_object"
1271 if test -z "$pic_object" || test "$pic_object" = none ; then
1272 arg="$non_pic_object"
1276 # Only an error if not doing a dry-run.
1277 if test -z "$run"; then
1278 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1283 # Extract subdirectory from the argument.
1284 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1285 if test "X$xdir" = "X$arg"; then
1291 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1292 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1293 libobjs="$libobjs $pic_object"
1294 non_pic_objects="$non_pic_objects $non_pic_object"
1299 $echo "$modename: link input file \`$save_arg' does not exist"
1307 # We need an absolute path.
1309 [\\/]* | [A-Za-z]:[\\/]*) ;;
1311 $echo "$modename: only absolute run-paths are allowed" 1>&2
1315 if test "$prev" = rpath; then
1318 *) rpath="$rpath $arg" ;;
1323 *) xrpath="$xrpath $arg" ;;
1330 compiler_flags="$compiler_flags $qarg"
1332 compile_command="$compile_command $qarg"
1333 finalize_command="$finalize_command $qarg"
1337 linker_flags="$linker_flags $qarg"
1338 compiler_flags="$compiler_flags $wl$qarg"
1340 compile_command="$compile_command $wl$qarg"
1341 finalize_command="$finalize_command $wl$qarg"
1345 linker_flags="$linker_flags $qarg"
1346 compiler_flags="$compiler_flags $qarg"
1348 compile_command="$compile_command $qarg"
1349 finalize_command="$finalize_command $qarg"
1358 compiler_flags="$compiler_flags $arg"
1359 compile_command="$compile_command $arg"
1360 finalize_command="$finalize_command $arg"
1365 eval "$prev=\"\$arg\""
1370 fi # test -n "$prev"
1376 if test -n "$link_static_flag"; then
1377 compile_command="$compile_command $link_static_flag"
1378 finalize_command="$finalize_command $link_static_flag"
1384 # FIXME: remove this flag sometime in the future.
1385 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1409 -export-symbols | -export-symbols-regex)
1410 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1411 $echo "$modename: more than one -exported-symbols argument is not allowed"
1414 if test "X$arg" = "X-export-symbols"; then
1423 prev=darwin_framework
1424 compiler_flags="$compiler_flags $arg"
1425 compile_command="$compile_command $arg"
1426 finalize_command="$finalize_command $arg"
1435 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1436 # so, if we see these flags be careful not to treat them like -L
1438 case $with_gcc/$host in
1439 no/*-*-irix* | /*-*-irix*)
1440 compile_command="$compile_command $arg"
1441 finalize_command="$finalize_command $arg"
1448 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1449 # We need an absolute path.
1451 [\\/]* | [A-Za-z]:[\\/]*) ;;
1453 absdir=`cd "$dir" && pwd`
1454 if test -z "$absdir"; then
1455 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1464 deplibs="$deplibs -L$dir"
1465 lib_search_path="$lib_search_path $dir"
1469 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1470 case :$dllsearchpath: in
1472 *) dllsearchpath="$dllsearchpath:$dir";;
1480 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1482 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1483 # These systems don't actually have a C or math library (as such)
1486 *-*-mingw* | *-*-os2*)
1487 # These systems don't actually have a C library (as such)
1488 test "X$arg" = "X-lc" && continue
1490 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1491 # Do not include libc due to us having libc/libc_r.
1492 test "X$arg" = "X-lc" && continue
1494 *-*-rhapsody* | *-*-darwin1.[012])
1495 # Rhapsody C and math libraries are in the System framework
1496 deplibs="$deplibs -framework System"
1499 elif test "X$arg" = "X-lc_r"; then
1501 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1502 # Do not include libc_r directly, use -pthread flag.
1507 deplibs="$deplibs $arg"
1511 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1512 # classes, name mangling, and exception handling.
1514 compile_command="$compile_command $arg"
1515 compiler_flags="$compiler_flags $arg"
1516 finalize_command="$finalize_command $arg"
1521 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1522 compiler_flags="$compiler_flags $arg"
1523 compile_command="$compile_command $arg"
1524 finalize_command="$finalize_command $arg"
1533 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1534 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1535 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1536 # +DA*, +DD* enable 64-bit mode on the HP compiler
1537 # -q* pass through compiler args for the IBM compiler
1538 # -m* pass through architecture-specific compiler args for GCC
1539 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
1541 # Unknown arguments in both finalize_command and compile_command need
1542 # to be aesthetically quoted because they are evaled later.
1543 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1545 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1549 compile_command="$compile_command $arg"
1550 finalize_command="$finalize_command $arg"
1551 if test "$with_gcc" = "yes" ; then
1552 compiler_flags="$compiler_flags $arg"
1569 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1570 # The PATH hackery in wrapper scripts is required on Windows
1571 # in order for the loader to find any dlls it needs.
1572 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1573 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1576 *) no_install=yes ;;
1593 -precious-files-regex)
1614 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1615 # We need an absolute path.
1617 [\\/]* | [A-Za-z]:[\\/]*) ;;
1619 $echo "$modename: only absolute run-paths are allowed" 1>&2
1625 *) xrpath="$xrpath $dir" ;;
1631 # The effects of -static are defined in a previous loop.
1632 # We used to do the same as -all-static on platforms that
1633 # didn't have a PIC flag, but the assumption that the effects
1634 # would be equivalent was wrong. It would break on at least
1635 # Digital Unix and AIX.
1655 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1657 save_ifs="$IFS"; IFS=','
1658 for flag in $args; do
1661 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1666 compiler_flags="$compiler_flags $flag"
1669 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1673 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1675 save_ifs="$IFS"; IFS=','
1676 for flag in $args; do
1679 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1684 compiler_flags="$compiler_flags $wl$flag"
1685 linker_flags="$linker_flags $flag"
1688 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1706 # Some other compiler flag.
1708 # Unknown arguments in both finalize_command and compile_command need
1709 # to be aesthetically quoted because they are evaled later.
1710 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1712 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1719 # A standard object.
1724 # A libtool-controlled object.
1726 # Check to see that this really is a libtool object.
1727 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1732 # If there is no directory component, then add one.
1734 */* | *\\*) . $arg ;;
1738 if test -z "$pic_object" || \
1739 test -z "$non_pic_object" ||
1740 test "$pic_object" = none && \
1741 test "$non_pic_object" = none; then
1742 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1746 # Extract subdirectory from the argument.
1747 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1748 if test "X$xdir" = "X$arg"; then
1754 if test "$pic_object" != none; then
1755 # Prepend the subdirectory the object is found in.
1756 pic_object="$xdir$pic_object"
1758 if test "$prev" = dlfiles; then
1759 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1760 dlfiles="$dlfiles $pic_object"
1764 # If libtool objects are unsupported, then we need to preload.
1769 # CHECK ME: I think I busted this. -Ossama
1770 if test "$prev" = dlprefiles; then
1771 # Preload the old-style object.
1772 dlprefiles="$dlprefiles $pic_object"
1777 libobjs="$libobjs $pic_object"
1782 if test "$non_pic_object" != none; then
1783 # Prepend the subdirectory the object is found in.
1784 non_pic_object="$xdir$non_pic_object"
1786 # A standard non-PIC object
1787 non_pic_objects="$non_pic_objects $non_pic_object"
1788 if test -z "$pic_object" || test "$pic_object" = none ; then
1789 arg="$non_pic_object"
1793 # Only an error if not doing a dry-run.
1794 if test -z "$run"; then
1795 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1800 # Extract subdirectory from the argument.
1801 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1802 if test "X$xdir" = "X$arg"; then
1808 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1809 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1810 libobjs="$libobjs $pic_object"
1811 non_pic_objects="$non_pic_objects $non_pic_object"
1818 deplibs="$deplibs $arg"
1819 old_deplibs="$old_deplibs $arg"
1824 # A libtool-controlled library.
1826 if test "$prev" = dlfiles; then
1827 # This library was specified with -dlopen.
1828 dlfiles="$dlfiles $arg"
1830 elif test "$prev" = dlprefiles; then
1831 # The library was specified with -dlpreopen.
1832 dlprefiles="$dlprefiles $arg"
1835 deplibs="$deplibs $arg"
1840 # Some other compiler argument.
1842 # Unknown arguments in both finalize_command and compile_command need
1843 # to be aesthetically quoted because they are evaled later.
1844 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1846 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1853 # Now actually substitute the argument into the commands.
1854 if test -n "$arg"; then
1855 compile_command="$compile_command $arg"
1856 finalize_command="$finalize_command $arg"
1858 done # argument parsing loop
1860 if test -n "$prev"; then
1861 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1866 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1867 eval arg=\"$export_dynamic_flag_spec\"
1868 compile_command="$compile_command $arg"
1869 finalize_command="$finalize_command $arg"
1873 # calculate the name of the file, without its directory
1874 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1875 libobjs_save="$libobjs"
1877 if test -n "$shlibpath_var"; then
1878 # get the directories listed in $shlibpath_var
1879 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1883 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1884 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1886 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1887 if test "X$output_objdir" = "X$output"; then
1888 output_objdir="$objdir"
1890 output_objdir="$output_objdir/$objdir"
1892 # Create the object directory.
1893 if test ! -d "$output_objdir"; then
1894 $show "$mkdir $output_objdir"
1895 $run $mkdir $output_objdir
1897 if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1902 # Determine the type of output
1905 $echo "$modename: you must specify an output file" 1>&2
1909 *.$libext) linkmode=oldlib ;;
1910 *.lo | *.$objext) linkmode=obj ;;
1911 *.la) linkmode=lib ;;
1912 *) linkmode=prog ;; # Anything else should be a program.
1916 *cygwin* | *mingw* | *pw32*)
1917 # don't eliminate duplications in $postdeps and $predeps
1918 duplicate_compiler_generated_deps=yes
1921 duplicate_compiler_generated_deps=$duplicate_deps
1927 # Find all interdependent deplibs by searching for libraries
1928 # that are linked more than once (e.g. -la -lb -la)
1929 for deplib in $deplibs; do
1930 if test "X$duplicate_deps" = "Xyes" ; then
1932 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1935 libs="$libs $deplib"
1938 if test "$linkmode" = lib; then
1939 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1941 # Compute libraries that are listed more than once in $predeps
1942 # $postdeps and mark them as special (i.e., whose duplicates are
1943 # not to be eliminated).
1945 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1946 for pre_post_dep in $predeps $postdeps; do
1947 case "$pre_post_deps " in
1948 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1950 pre_post_deps="$pre_post_deps $pre_post_dep"
1959 need_relink=no # whether we're linking any uninstalled libtool libraries
1960 notinst_deplibs= # not-installed libtool libraries
1961 notinst_path= # paths that contain not-installed libtool libraries
1965 for file in $dlfiles $dlprefiles; do
1969 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1981 passes="conv scan dlopen dlpreopen link"
1986 for pass in $passes; do
1987 if test "$linkmode,$pass" = "lib,link" ||
1988 test "$linkmode,$pass" = "prog,scan"; then
1992 if test "$linkmode" = prog; then
1994 dlopen) libs="$dlfiles" ;;
1995 dlpreopen) libs="$dlprefiles" ;;
1996 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1999 if test "$pass" = dlopen; then
2000 # Collect dlpreopened libraries
2001 save_deplibs="$deplibs"
2004 for deplib in $libs; do
2008 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2009 if test "$linkmode,$pass" = "prog,link"; then
2010 compile_deplibs="$deplib $compile_deplibs"
2011 finalize_deplibs="$deplib $finalize_deplibs"
2013 compiler_flags="$compiler_flags $deplib"
2018 if test "$linkmode" != lib && test "$linkmode" != prog; then
2019 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2022 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2023 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2024 for search_ext in .la $std_shrext .so .a; do
2025 # Search the libtool library
2026 lib="$searchdir/lib${name}${search_ext}"
2027 if test -f "$lib"; then
2028 if test "$search_ext" = ".la"; then
2037 if test "$found" != yes; then
2038 # deplib doesn't seem to be a libtool library
2039 if test "$linkmode,$pass" = "prog,link"; then
2040 compile_deplibs="$deplib $compile_deplibs"
2041 finalize_deplibs="$deplib $finalize_deplibs"
2043 deplibs="$deplib $deplibs"
2044 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2047 else # deplib is a libtool library
2048 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2049 # We need to do some special things here, and not later.
2050 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2051 case " $predeps $postdeps " in
2053 if (${SED} -e '2q' $lib |
2054 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2058 */* | *\\*) . $lib ;;
2061 for l in $old_library $library_names; do
2064 if test "X$ll" = "X$old_library" ; then # only static version available
2066 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2067 test "X$ladir" = "X$lib" && ladir="."
2068 lib=$ladir/$old_library
2069 if test "$linkmode,$pass" = "prog,link"; then
2070 compile_deplibs="$deplib $compile_deplibs"
2071 finalize_deplibs="$deplib $finalize_deplibs"
2073 deplibs="$deplib $deplibs"
2074 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2088 deplibs="$deplib $deplibs"
2089 test "$pass" = conv && continue
2090 newdependency_libs="$deplib $newdependency_libs"
2091 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2094 if test "$pass" = conv; then
2095 deplibs="$deplib $deplibs"
2098 if test "$pass" = scan; then
2099 deplibs="$deplib $deplibs"
2101 compile_deplibs="$deplib $compile_deplibs"
2102 finalize_deplibs="$deplib $finalize_deplibs"
2104 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2107 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2113 if test "$pass" = link; then
2114 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2115 # Make sure the xrpath contains only unique directories.
2118 *) xrpath="$xrpath $dir" ;;
2121 deplibs="$deplib $deplibs"
2124 *.la) lib="$deplib" ;;
2126 if test "$pass" = conv; then
2127 deplibs="$deplib $deplibs"
2133 case $deplibs_check_method in
2135 set dummy $deplibs_check_method
2136 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2137 if eval $echo \"$deplib\" 2>/dev/null \
2139 | $EGREP "$match_pattern_regex" > /dev/null; then
2147 if test "$valid_a_lib" != yes; then
2149 $echo "*** Warning: Trying to link with static lib archive $deplib."
2150 $echo "*** I have the capability to make that library automatically link in when"
2151 $echo "*** you link to this library. But I can only do this if you have a"
2152 $echo "*** shared version of the library, which you do not appear to have"
2153 $echo "*** because the file extensions .$libext of this argument makes me believe"
2154 $echo "*** that it is just a static archive that I should not used here."
2157 $echo "*** Warning: Linking the shared library $output against the"
2158 $echo "*** static library $deplib is not portable!"
2159 deplibs="$deplib $deplibs"
2164 if test "$pass" != link; then
2165 deplibs="$deplib $deplibs"
2167 compile_deplibs="$deplib $compile_deplibs"
2168 finalize_deplibs="$deplib $finalize_deplibs"
2175 if test "$pass" = conv; then
2176 deplibs="$deplib $deplibs"
2177 elif test "$linkmode" = prog; then
2178 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2179 # If there is no dlopen support or we're linking statically,
2180 # we need to preload.
2181 newdlprefiles="$newdlprefiles $deplib"
2182 compile_deplibs="$deplib $compile_deplibs"
2183 finalize_deplibs="$deplib $finalize_deplibs"
2185 newdlfiles="$newdlfiles $deplib"
2195 if test "$found" = yes || test -f "$lib"; then :
2197 $echo "$modename: cannot find the library \`$lib'" 1>&2
2201 # Check to see that this really is a libtool archive.
2202 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2204 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2208 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2209 test "X$ladir" = "X$lib" && ladir="."
2217 # If the library was installed with an old release of libtool,
2218 # it will not redefine variables installed, or shouldnotlink
2226 */* | *\\*) . $lib ;;
2230 if test "$linkmode,$pass" = "lib,link" ||
2231 test "$linkmode,$pass" = "prog,scan" ||
2232 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2233 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2234 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2237 if test "$pass" = conv; then
2238 # Only check for convenience libraries
2239 deplibs="$lib $deplibs"
2240 if test -z "$libdir"; then
2241 if test -z "$old_library"; then
2242 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2245 # It is a libtool convenience library, so add in its objects.
2246 convenience="$convenience $ladir/$objdir/$old_library"
2247 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2249 for deplib in $dependency_libs; do
2250 deplibs="$deplib $deplibs"
2251 if test "X$duplicate_deps" = "Xyes" ; then
2252 case "$tmp_libs " in
2253 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2256 tmp_libs="$tmp_libs $deplib"
2258 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2259 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2266 # Get the name of the library we link against.
2268 for l in $old_library $library_names; do
2271 if test -z "$linklib"; then
2272 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2276 # This library was specified with -dlopen.
2277 if test "$pass" = dlopen; then
2278 if test -z "$libdir"; then
2279 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2282 if test -z "$dlname" ||
2283 test "$dlopen_support" != yes ||
2284 test "$build_libtool_libs" = no; then
2285 # If there is no dlname, no dlopen support or we're linking
2286 # statically, we need to preload. We also need to preload any
2287 # dependent libraries so libltdl's deplib preloader doesn't
2288 # bomb out in the load deplibs phase.
2289 dlprefiles="$dlprefiles $lib $dependency_libs"
2291 newdlfiles="$newdlfiles $lib"
2296 # We need an absolute path.
2298 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2300 abs_ladir=`cd "$ladir" && pwd`
2301 if test -z "$abs_ladir"; then
2302 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2303 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2308 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2310 # Find the relevant object directory and library name.
2311 if test "X$installed" = Xyes; then
2312 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2313 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2321 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2323 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2326 # Remove this search path later
2327 notinst_path="$notinst_path $abs_ladir"
2329 dir="$ladir/$objdir"
2330 absdir="$abs_ladir/$objdir"
2331 # Remove this search path later
2332 notinst_path="$notinst_path $abs_ladir"
2334 fi # $installed = yes
2335 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2337 # This library was specified with -dlpreopen.
2338 if test "$pass" = dlpreopen; then
2339 if test -z "$libdir"; then
2340 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2343 # Prefer using a static library (so that no silly _DYNAMIC symbols
2344 # are required to link).
2345 if test -n "$old_library"; then
2346 newdlprefiles="$newdlprefiles $dir/$old_library"
2347 # Otherwise, use the dlname, so that lt_dlopen finds it.
2348 elif test -n "$dlname"; then
2349 newdlprefiles="$newdlprefiles $dir/$dlname"
2351 newdlprefiles="$newdlprefiles $dir/$linklib"
2353 fi # $pass = dlpreopen
2355 if test -z "$libdir"; then
2356 # Link the convenience library
2357 if test "$linkmode" = lib; then
2358 deplibs="$dir/$old_library $deplibs"
2359 elif test "$linkmode,$pass" = "prog,link"; then
2360 compile_deplibs="$dir/$old_library $compile_deplibs"
2361 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2363 deplibs="$lib $deplibs" # used for prog,scan pass
2369 if test "$linkmode" = prog && test "$pass" != link; then
2370 newlib_search_path="$newlib_search_path $ladir"
2371 deplibs="$lib $deplibs"
2374 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2375 test "$build_libtool_libs" = no; then
2380 for deplib in $dependency_libs; do
2382 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2384 # Need to link against all dependency_libs?
2385 if test "$linkalldeplibs" = yes; then
2386 deplibs="$deplib $deplibs"
2388 # Need to hardcode shared library paths
2389 # or/and link against static libraries
2390 newdependency_libs="$deplib $newdependency_libs"
2392 if test "X$duplicate_deps" = "Xyes" ; then
2393 case "$tmp_libs " in
2394 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2397 tmp_libs="$tmp_libs $deplib"
2400 fi # $linkmode = prog...
2402 if test "$linkmode,$pass" = "prog,link"; then
2403 if test -n "$library_names" &&
2404 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2405 # We need to hardcode the library path
2406 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2407 # Make sure the rpath contains only unique directories.
2408 case "$temp_rpath " in
2411 *) temp_rpath="$temp_rpath $absdir" ;;
2415 # Hardcode the library path.
2416 # Skip directories that are in the system default run-time
2418 case " $sys_lib_dlsearch_path " in
2421 case "$compile_rpath " in
2423 *) compile_rpath="$compile_rpath $absdir"
2427 case " $sys_lib_dlsearch_path " in
2430 case "$finalize_rpath " in
2432 *) finalize_rpath="$finalize_rpath $libdir"
2436 fi # $linkmode,$pass = prog,link...
2438 if test "$alldeplibs" = yes &&
2439 { test "$deplibs_check_method" = pass_all ||
2440 { test "$build_libtool_libs" = yes &&
2441 test -n "$library_names"; }; }; then
2442 # We only need to search for static libraries
2447 link_static=no # Whether the deplib will be linked statically
2448 if test -n "$library_names" &&
2449 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2450 if test "$installed" = no; then
2451 notinst_deplibs="$notinst_deplibs $lib"
2454 # This is a shared library
2456 # Warn about portability, can't link against -module's on
2457 # some systems (darwin)
2458 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2460 if test "$linkmode" = prog; then
2461 $echo "*** Warning: Linking the executable $output against the loadable module"
2463 $echo "*** Warning: Linking the shared library $output against the loadable module"
2465 $echo "*** $linklib is not portable!"
2467 if test "$linkmode" = lib &&
2468 test "$hardcode_into_libs" = yes; then
2469 # Hardcode the library path.
2470 # Skip directories that are in the system default run-time
2472 case " $sys_lib_dlsearch_path " in
2475 case "$compile_rpath " in
2477 *) compile_rpath="$compile_rpath $absdir"
2481 case " $sys_lib_dlsearch_path " in
2484 case "$finalize_rpath " in
2486 *) finalize_rpath="$finalize_rpath $libdir"
2492 if test -n "$old_archive_from_expsyms_cmds"; then
2493 # figure out the soname
2494 set dummy $library_names
2497 libname=`eval \\$echo \"$libname_spec\"`
2498 # use dlname if we got it. it's perfectly good, no?
2499 if test -n "$dlname"; then
2501 elif test -n "$soname_spec"; then
2505 major=`expr $current - $age`
2509 eval soname=\"$soname_spec\"
2514 # Make a new name for the extract_expsyms_cmds to use
2516 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2517 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2519 # If the library has no export list, then create one now
2520 if test -f "$output_objdir/$soname-def"; then :
2522 $show "extracting exported symbol list from \`$soname'"
2523 save_ifs="$IFS"; IFS='~'
2524 cmds=$extract_expsyms_cmds
2525 for cmd in $cmds; do
2529 $run eval "$cmd" || exit $?
2535 if test -f "$output_objdir/$newlib"; then :; else
2536 $show "generating import library for \`$soname'"
2537 save_ifs="$IFS"; IFS='~'
2538 cmds=$old_archive_from_expsyms_cmds
2539 for cmd in $cmds; do
2543 $run eval "$cmd" || exit $?
2547 # make sure the library variables are pointing to the new library
2550 fi # test -n "$old_archive_from_expsyms_cmds"
2552 if test "$linkmode" = prog || test "$mode" != relink; then
2557 case $hardcode_action in
2558 immediate | unsupported)
2559 if test "$hardcode_direct" = no; then
2562 *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2564 # if the lib is a module then we can not link against
2565 # it, someone is ignoring the new warnings I added
2566 if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
2567 $echo "** Warning, lib $linklib is a module, not a shared library"
2568 if test -z "$old_library" ; then
2570 $echo "** And there doesn't seem to be a static archive available"
2571 $echo "** The link will probably fail, sorry"
2573 add="$dir/$old_library"
2577 elif test "$hardcode_minus_L" = no; then
2579 *-*-sunos*) add_shlibpath="$dir" ;;
2583 elif test "$hardcode_shlibpath_var" = no; then
2584 add_shlibpath="$dir"
2591 if test "$hardcode_direct" = yes; then
2593 elif test "$hardcode_minus_L" = yes; then
2595 # Try looking first in the location we're being installed to.
2596 if test -n "$inst_prefix_dir"; then
2599 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2604 elif test "$hardcode_shlibpath_var" = yes; then
2605 add_shlibpath="$dir"
2614 if test "$lib_linked" != yes; then
2615 $echo "$modename: configuration error: unsupported hardcode properties"
2619 if test -n "$add_shlibpath"; then
2620 case :$compile_shlibpath: in
2621 *":$add_shlibpath:"*) ;;
2622 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2625 if test "$linkmode" = prog; then
2626 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2627 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2629 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2630 test -n "$add" && deplibs="$add $deplibs"
2631 if test "$hardcode_direct" != yes && \
2632 test "$hardcode_minus_L" != yes && \
2633 test "$hardcode_shlibpath_var" = yes; then
2634 case :$finalize_shlibpath: in
2636 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2642 if test "$linkmode" = prog || test "$mode" = relink; then
2646 # Finalize command for both is simple: just hardcode it.
2647 if test "$hardcode_direct" = yes; then
2648 add="$libdir/$linklib"
2649 elif test "$hardcode_minus_L" = yes; then
2652 elif test "$hardcode_shlibpath_var" = yes; then
2653 case :$finalize_shlibpath: in
2655 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2658 elif test "$hardcode_automatic" = yes; then
2659 if test -n "$inst_prefix_dir" &&
2660 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2661 add="$inst_prefix_dir$libdir/$linklib"
2663 add="$libdir/$linklib"
2666 # We cannot seem to hardcode it, guess we'll fake it.
2668 # Try looking first in the location we're being installed to.
2669 if test -n "$inst_prefix_dir"; then
2672 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2679 if test "$linkmode" = prog; then
2680 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2681 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2683 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2684 test -n "$add" && deplibs="$add $deplibs"
2687 elif test "$linkmode" = prog; then
2688 # Here we assume that one of hardcode_direct or hardcode_minus_L
2689 # is not unsupported. This is valid on all known static and
2691 if test "$hardcode_direct" != unsupported; then
2692 test -n "$old_library" && linklib="$old_library"
2693 compile_deplibs="$dir/$linklib $compile_deplibs"
2694 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2696 compile_deplibs="-l$name -L$dir $compile_deplibs"
2697 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2699 elif test "$build_libtool_libs" = yes; then
2700 # Not a shared library
2701 if test "$deplibs_check_method" != pass_all; then
2702 # We're trying link a shared library against a static one
2703 # but the system doesn't support it.
2705 # Just print a warning and add the library to dependency_libs so
2706 # that the program can be linked against the static library.
2708 $echo "*** Warning: This system can not link to static lib archive $lib."
2709 $echo "*** I have the capability to make that library automatically link in when"
2710 $echo "*** you link to this library. But I can only do this if you have a"
2711 $echo "*** shared version of the library, which you do not appear to have."
2712 if test "$module" = yes; then
2713 $echo "*** But as you try to build a module library, libtool will still create "
2714 $echo "*** a static module, that should work as long as the dlopening application"
2715 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2716 if test -z "$global_symbol_pipe"; then
2718 $echo "*** However, this would only work if libtool was able to extract symbol"
2719 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2720 $echo "*** not find such a program. So, this module is probably useless."
2721 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2723 if test "$build_old_libs" = no; then
2724 build_libtool_libs=module
2727 build_libtool_libs=no
2731 deplibs="$dir/$old_library $deplibs"
2734 fi # link shared/static library?
2736 if test "$linkmode" = lib; then
2737 if test -n "$dependency_libs" &&
2738 { test "$hardcode_into_libs" != yes ||
2739 test "$build_old_libs" = yes ||
2740 test "$link_static" = yes; }; then
2741 # Extract -R from dependency_libs
2743 for libdir in $dependency_libs; do
2745 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2747 *" $temp_xrpath "*) ;;
2748 *) xrpath="$xrpath $temp_xrpath";;
2750 *) temp_deplibs="$temp_deplibs $libdir";;
2753 dependency_libs="$temp_deplibs"
2756 newlib_search_path="$newlib_search_path $absdir"
2757 # Link against this library
2758 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2759 # ... and its dependency_libs
2761 for deplib in $dependency_libs; do
2762 newdependency_libs="$deplib $newdependency_libs"
2763 if test "X$duplicate_deps" = "Xyes" ; then
2764 case "$tmp_libs " in
2765 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2768 tmp_libs="$tmp_libs $deplib"
2771 if test "$link_all_deplibs" != no; then
2772 # Add the search paths of all dependency libraries
2773 for deplib in $dependency_libs; do
2775 -L*) path="$deplib" ;;
2777 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2778 test "X$dir" = "X$deplib" && dir="."
2779 # We need an absolute path.
2781 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2783 absdir=`cd "$dir" && pwd`
2784 if test -z "$absdir"; then
2785 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2790 if grep "^installed=no" $deplib > /dev/null; then
2791 path="$absdir/$objdir"
2793 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2794 if test -z "$libdir"; then
2795 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2798 if test "$absdir" != "$libdir"; then
2799 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2806 # we do not want to link against static libs,
2807 # but need to link against shared
2808 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2809 if test -n "$deplibrary_names" ; then
2810 for tmp in $deplibrary_names ; do
2813 if test -f "$path/$depdepl" ; then
2814 depdepl="$path/$depdepl"
2816 # do not add paths which are already there
2817 case " $newlib_search_path " in
2819 *) newlib_search_path="$newlib_search_path $path";;
2832 # Again, we only want to link against shared libraries
2833 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2834 for tmp in $newlib_search_path ; do
2835 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2836 eval depdepl="$tmp/lib$tmp_libs.dylib"
2847 case " $deplibs " in
2849 *) deplibs="$path $deplibs" ;;
2851 case " $deplibs " in
2853 *) deplibs="$depdepl $deplibs" ;;
2856 fi # link_all_deplibs != no
2858 done # for deplib in $libs
2859 dependency_libs="$newdependency_libs"
2860 if test "$pass" = dlpreopen; then
2861 # Link the dlpreopened libraries before other libraries
2862 for deplib in $save_deplibs; do
2863 deplibs="$deplib $deplibs"
2866 if test "$pass" != dlopen; then
2867 if test "$pass" != conv; then
2868 # Make sure lib_search_path contains only unique directories.
2870 for dir in $newlib_search_path; do
2871 case "$lib_search_path " in
2873 *) lib_search_path="$lib_search_path $dir" ;;
2879 if test "$linkmode,$pass" != "prog,link"; then
2882 vars="compile_deplibs finalize_deplibs"
2884 for var in $vars dependency_libs; do
2885 # Add libraries to $var in reverse order
2886 eval tmp_libs=\"\$$var\"
2888 for deplib in $tmp_libs; do
2889 # FIXME: Pedantically, this is the right thing to do, so
2890 # that some nasty dependency loop isn't accidentally
2892 #new_libs="$deplib $new_libs"
2893 # Pragmatically, this seems to cause very few problems in
2896 -L*) new_libs="$deplib $new_libs" ;;
2899 # And here is the reason: when a library appears more
2900 # than once as an explicit dependence of a library, or
2901 # is implicitly linked in more than once by the
2902 # compiler, it is considered special, and multiple
2903 # occurrences thereof are not removed. Compare this
2904 # with having the same library being listed as a
2905 # dependency of multiple other libraries: in this case,
2906 # we know (pedantically, we assume) the library does not
2907 # need to be listed more than once, so we keep only the
2908 # last copy. This is not always right, but it is rare
2909 # enough that we require users that really mean to play
2910 # such unportable linking tricks to link the library
2911 # using -Wl,-lname, so that libtool does not consider it
2912 # for duplicate removal.
2913 case " $specialdeplibs " in
2914 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2916 case " $new_libs " in
2918 *) new_libs="$deplib $new_libs" ;;
2926 for deplib in $new_libs; do
2929 case " $tmp_libs " in
2931 *) tmp_libs="$tmp_libs $deplib" ;;
2934 *) tmp_libs="$tmp_libs $deplib" ;;
2937 eval $var=\"$tmp_libs\"
2940 # Last step: remove runtime libs from dependency_libs
2941 # (they stay in deplibs)
2943 for i in $dependency_libs ; do
2944 case " $predeps $postdeps $compiler_lib_search_path " in
2949 if test -n "$i" ; then
2950 tmp_libs="$tmp_libs $i"
2953 dependency_libs=$tmp_libs
2955 if test "$linkmode" = prog; then
2956 dlfiles="$newdlfiles"
2957 dlprefiles="$newdlprefiles"
2962 if test -n "$deplibs"; then
2963 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2966 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2967 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2970 if test -n "$rpath"; then
2971 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2974 if test -n "$xrpath"; then
2975 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2978 if test -n "$vinfo"; then
2979 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2982 if test -n "$release"; then
2983 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2986 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2987 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2990 # Now set the variables for building old libraries.
2991 build_libtool_libs=no
2993 objs="$objs$old_deplibs"
2997 # Make sure we only generate libraries of the form `libNAME.la'.
3000 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3001 eval shared_ext=\"$shrext_cmds\"
3002 eval libname=\"$libname_spec\"
3005 if test "$module" = no; then
3006 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3010 if test "$need_lib_prefix" != no; then
3011 # Add the "lib" prefix for modules if required
3012 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3013 eval shared_ext=\"$shrext_cmds\"
3014 eval libname=\"$libname_spec\"
3016 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3021 if test -n "$objs"; then
3022 if test "$deplibs_check_method" != pass_all; then
3023 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3027 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3028 $echo "*** objects $objs is not portable!"
3029 libobjs="$libobjs $objs"
3033 if test "$dlself" != no; then
3034 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3038 if test "$#" -gt 2; then
3039 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3044 if test -z "$rpath"; then
3045 if test "$build_libtool_libs" = yes; then
3046 # Building a libtool convenience library.
3047 # Some compilers have problems with a `.al' extension so
3048 # convenience libraries should have the same extension an
3049 # archive normally would.
3050 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3051 build_libtool_libs=convenience
3055 if test -n "$vinfo"; then
3056 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3059 if test -n "$release"; then
3060 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3064 # Parse the version information argument.
3065 save_ifs="$IFS"; IFS=':'
3066 set dummy $vinfo 0 0 0
3069 if test -n "$8"; then
3070 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3075 # convert absolute version numbers to libtool ages
3076 # this retains compatibility with .la files and attempts
3077 # to make the code below a bit more comprehensible
3079 case $vinfo_number in
3083 number_revision="$4"
3085 # There are really only two kinds -- those that
3086 # use the current revision as the major version
3087 # and those that subtract age and use age as
3088 # a minor version. But, then there is irix
3089 # which has an extra 1 added just for fun
3091 case $version_type in
3092 darwin|linux|osf|windows)
3093 current=`expr $number_major + $number_minor`
3095 revision="$number_revision"
3097 freebsd-aout|freebsd-elf|sunos)
3098 current="$number_major"
3099 revision="$number_minor"
3103 current=`expr $number_major + $number_minor - 1`
3105 revision="$number_minor"
3116 # Check that each of the things are valid numbers.
3118 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3120 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3121 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3127 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3129 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3130 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3136 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3138 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3139 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3144 if test "$age" -gt "$current"; then
3145 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3146 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3150 # Calculate the version variables.
3154 case $version_type in
3158 # Like Linux, but with the current version available in
3159 # verstring for coding it into the library header
3160 major=.`expr $current - $age`
3161 versuffix="$major.$age.$revision"
3162 # Darwin ld doesn't like 0 for these options...
3163 minor_current=`expr $current + 1`
3164 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3169 versuffix=".$current.$revision";
3174 versuffix=".$current";
3178 major=`expr $current - $age + 1`
3180 case $version_type in
3181 nonstopux) verstring_prefix=nonstopux ;;
3182 *) verstring_prefix=sgi ;;
3184 verstring="$verstring_prefix$major.$revision"
3186 # Add in all the interfaces that we are compatible with.
3188 while test "$loop" -ne 0; do
3189 iface=`expr $revision - $loop`
3190 loop=`expr $loop - 1`
3191 verstring="$verstring_prefix$major.$iface:$verstring"
3194 # Before this point, $major must not contain `.'.
3196 versuffix="$major.$revision"
3200 major=.`expr $current - $age`
3201 versuffix="$major.$age.$revision"
3205 major=.`expr $current - $age`
3206 versuffix=".$current.$age.$revision"
3207 verstring="$current.$age.$revision"
3209 # Add in all the interfaces that we are compatible with.
3211 while test "$loop" -ne 0; do
3212 iface=`expr $current - $loop`
3213 loop=`expr $loop - 1`
3214 verstring="$verstring:${iface}.0"
3217 # Make executables depend on our current version.
3218 verstring="$verstring:${current}.0"
3223 versuffix=".$current.$revision"
3227 # Use '-' rather than '.', since we only want one
3228 # extension on DOS 8.3 filesystems.
3229 major=`expr $current - $age`
3234 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3235 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3240 # Clear the version info if we defaulted, and they specified a release.
3241 if test -z "$vinfo" && test -n "$release"; then
3243 case $version_type in
3245 # we can't check for "0.0" in archive_cmds due to quoting
3246 # problems, so we reset it completely
3253 if test "$need_version" = no; then
3260 # Remove version info from name if versioning should be avoided
3261 if test "$avoid_version" = yes && test "$need_version" = no; then
3267 # Check to see if the archive will have undefined symbols.
3268 if test "$allow_undefined" = yes; then
3269 if test "$allow_undefined_flag" = unsupported; then
3270 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3271 build_libtool_libs=no
3275 # Don't allow undefined symbols.
3276 allow_undefined_flag="$no_undefined_flag"
3280 if test "$mode" != relink; then
3281 # Remove our outputs, but don't remove object files since they
3282 # may have been created when compiling PIC objects.
3284 tempremovelist=`$echo "$output_objdir/*"`
3285 for p in $tempremovelist; do
3289 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3290 if test "X$precious_files_regex" != "X"; then
3291 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3296 removelist="$removelist $p"
3301 if test -n "$removelist"; then
3302 $show "${rm}r $removelist"
3303 $run ${rm}r $removelist
3307 # Now set the variables for building old libraries.
3308 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3309 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3311 # Transform .lo files to .o files.
3312 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3315 # Eliminate all temporary directories.
3316 for path in $notinst_path; do
3317 lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3318 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3319 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3322 if test -n "$xrpath"; then
3323 # If the user specified any rpath flags, then add them.
3325 for libdir in $xrpath; do
3326 temp_xrpath="$temp_xrpath -R$libdir"
3327 case "$finalize_rpath " in
3329 *) finalize_rpath="$finalize_rpath $libdir" ;;
3332 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3333 dependency_libs="$temp_xrpath $dependency_libs"
3337 # Make sure dlfiles contains only unique files that won't be dlpreopened
3338 old_dlfiles="$dlfiles"
3340 for lib in $old_dlfiles; do
3341 case " $dlprefiles $dlfiles " in
3343 *) dlfiles="$dlfiles $lib" ;;
3347 # Make sure dlprefiles contains only unique files
3348 old_dlprefiles="$dlprefiles"
3350 for lib in $old_dlprefiles; do
3351 case "$dlprefiles " in
3353 *) dlprefiles="$dlprefiles $lib" ;;
3357 if test "$build_libtool_libs" = yes; then
3358 if test -n "$rpath"; then
3360 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3361 # these systems don't actually have a c library (as such)!
3363 *-*-rhapsody* | *-*-darwin1.[012])
3364 # Rhapsody C library is in the System framework
3365 deplibs="$deplibs -framework System"
3368 # Don't link with libc until the a.out ld.so is fixed.
3370 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3371 # Do not include libc due to us having libc/libc_r.
3372 test "X$arg" = "X-lc" && continue
3375 # Add libc to deplibs on all other systems if necessary.
3376 if test "$build_libtool_need_lc" = "yes"; then
3377 deplibs="$deplibs -lc"
3383 # Transform deplibs into only deplibs that can be linked in shared.
3385 libname_save=$libname
3386 release_save=$release
3387 versuffix_save=$versuffix
3389 # I'm not sure if I'm treating the release correctly. I think
3390 # release should show up in the -l (ie -lgmp5) so we don't want to
3391 # add it in twice. Is that correct?
3397 case $deplibs_check_method in
3399 # Don't check for shared/static. Everything works.
3400 # This might be a little naive. We might want to check
3401 # whether the library exists or not. But this is on
3402 # osf3 & osf4 and I'm not really sure... Just
3403 # implementing what was already the behavior.
3407 # This code stresses the "libraries are programs" paradigm to its
3408 # limits. Maybe even breaks it. We compile a program, linking it
3409 # against the deplibs as a proxy for the library. Then we can check
3410 # whether they linked in statically or dynamically with ldd.
3412 cat > conftest.c <<EOF
3413 int main() { return 0; }
3416 $LTCC -o conftest conftest.c $deplibs
3417 if test "$?" -eq 0 ; then
3418 ldd_output=`ldd conftest`
3419 for i in $deplibs; do
3420 name=`expr $i : '-l\(.*\)'`
3421 # If $name is empty we are operating on a -L argument.
3422 if test "$name" != "" && test "$name" -ne "0"; then
3423 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3424 case " $predeps $postdeps " in
3426 newdeplibs="$newdeplibs $i"
3431 if test -n "$i" ; then
3432 libname=`eval \\$echo \"$libname_spec\"`
3433 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3434 set dummy $deplib_matches
3436 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3437 newdeplibs="$newdeplibs $i"
3441 $echo "*** Warning: dynamic linker does not accept needed library $i."
3442 $echo "*** I have the capability to make that library automatically link in when"
3443 $echo "*** you link to this library. But I can only do this if you have a"
3444 $echo "*** shared version of the library, which I believe you do not have"
3445 $echo "*** because a test_compile did reveal that the linker did not use it for"
3446 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3450 newdeplibs="$newdeplibs $i"
3454 # Error occurred in the first compile. Let's try to salvage
3455 # the situation: Compile a separate program for each library.
3456 for i in $deplibs; do
3457 name=`expr $i : '-l\(.*\)'`
3458 # If $name is empty we are operating on a -L argument.
3459 if test "$name" != "" && test "$name" != "0"; then
3461 $LTCC -o conftest conftest.c $i
3463 if test "$?" -eq 0 ; then
3464 ldd_output=`ldd conftest`
3465 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3466 case " $predeps $postdeps " in
3468 newdeplibs="$newdeplibs $i"
3473 if test -n "$i" ; then
3474 libname=`eval \\$echo \"$libname_spec\"`
3475 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3476 set dummy $deplib_matches
3478 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3479 newdeplibs="$newdeplibs $i"
3483 $echo "*** Warning: dynamic linker does not accept needed library $i."
3484 $echo "*** I have the capability to make that library automatically link in when"
3485 $echo "*** you link to this library. But I can only do this if you have a"
3486 $echo "*** shared version of the library, which you do not appear to have"
3487 $echo "*** because a test_compile did reveal that the linker did not use this one"
3488 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3494 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3495 $echo "*** make it link in! You will probably need to install it or some"
3496 $echo "*** library that it depends on before this library will be fully"
3497 $echo "*** functional. Installing it before continuing would be even better."
3500 newdeplibs="$newdeplibs $i"
3506 set dummy $deplibs_check_method
3507 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3508 for a_deplib in $deplibs; do
3509 name=`expr $a_deplib : '-l\(.*\)'`
3510 # If $name is empty we are operating on a -L argument.
3511 if test "$name" != "" && test "$name" != "0"; then
3512 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3513 case " $predeps $postdeps " in
3515 newdeplibs="$newdeplibs $a_deplib"
3520 if test -n "$a_deplib" ; then
3521 libname=`eval \\$echo \"$libname_spec\"`
3522 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3523 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3524 for potent_lib in $potential_libs; do
3525 # Follow soft links.
3526 if ls -lLd "$potent_lib" 2>/dev/null \
3527 | grep " -> " >/dev/null; then
3530 # The statement above tries to avoid entering an
3531 # endless loop below, in case of cyclic links.
3532 # We might still enter an endless loop, since a link
3533 # loop can be closed while we follow links,
3535 potlib="$potent_lib"
3536 while test -h "$potlib" 2>/dev/null; do
3537 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3539 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3540 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3543 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3545 | $EGREP "$file_magic_regex" > /dev/null; then
3546 newdeplibs="$newdeplibs $a_deplib"
3553 if test -n "$a_deplib" ; then
3556 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3557 $echo "*** I have the capability to make that library automatically link in when"
3558 $echo "*** you link to this library. But I can only do this if you have a"
3559 $echo "*** shared version of the library, which you do not appear to have"
3560 $echo "*** because I did check the linker path looking for a file starting"
3561 if test -z "$potlib" ; then
3562 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3564 $echo "*** with $libname and none of the candidates passed a file format test"
3565 $echo "*** using a file magic. Last file checked: $potlib"
3569 # Add a -L argument.
3570 newdeplibs="$newdeplibs $a_deplib"
3572 done # Gone through all deplibs.
3575 set dummy $deplibs_check_method
3576 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3577 for a_deplib in $deplibs; do
3578 name=`expr $a_deplib : '-l\(.*\)'`
3579 # If $name is empty we are operating on a -L argument.
3580 if test -n "$name" && test "$name" != "0"; then
3581 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3582 case " $predeps $postdeps " in
3584 newdeplibs="$newdeplibs $a_deplib"
3589 if test -n "$a_deplib" ; then
3590 libname=`eval \\$echo \"$libname_spec\"`
3591 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3592 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3593 for potent_lib in $potential_libs; do
3594 potlib="$potent_lib" # see symlink-check above in file_magic test
3595 if eval $echo \"$potent_lib\" 2>/dev/null \
3597 | $EGREP "$match_pattern_regex" > /dev/null; then
3598 newdeplibs="$newdeplibs $a_deplib"
3605 if test -n "$a_deplib" ; then
3608 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3609 $echo "*** I have the capability to make that library automatically link in when"
3610 $echo "*** you link to this library. But I can only do this if you have a"
3611 $echo "*** shared version of the library, which you do not appear to have"
3612 $echo "*** because I did check the linker path looking for a file starting"
3613 if test -z "$potlib" ; then
3614 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3616 $echo "*** with $libname and none of the candidates passed a file format test"
3617 $echo "*** using a regex pattern. Last file checked: $potlib"
3621 # Add a -L argument.
3622 newdeplibs="$newdeplibs $a_deplib"
3624 done # Gone through all deplibs.
3628 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3629 -e 's/ -[LR][^ ]*//g'`
3630 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3631 for i in $predeps $postdeps ; do
3632 # can't use Xsed below, because $i might contain '/'
3633 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3636 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3637 | grep . >/dev/null; then
3639 if test "X$deplibs_check_method" = "Xnone"; then
3640 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3642 $echo "*** Warning: inter-library dependencies are not known to be supported."
3644 $echo "*** All declared inter-library dependencies are being dropped."
3649 versuffix=$versuffix_save
3651 release=$release_save
3652 libname=$libname_save
3656 *-*-rhapsody* | *-*-darwin1.[012])
3657 # On Rhapsody replace the C library is the System framework
3658 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3662 if test "$droppeddeps" = yes; then
3663 if test "$module" = yes; then
3665 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3666 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3667 $echo "*** a static module, that should work as long as the dlopening"
3668 $echo "*** application is linked with the -dlopen flag."
3669 if test -z "$global_symbol_pipe"; then
3671 $echo "*** However, this would only work if libtool was able to extract symbol"
3672 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3673 $echo "*** not find such a program. So, this module is probably useless."
3674 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3676 if test "$build_old_libs" = no; then
3677 oldlibs="$output_objdir/$libname.$libext"
3678 build_libtool_libs=module
3681 build_libtool_libs=no
3684 $echo "*** The inter-library dependencies that have been dropped here will be"
3685 $echo "*** automatically added whenever a program is linked with this library"
3686 $echo "*** or is declared to -dlopen it."
3688 if test "$allow_undefined" = no; then
3690 $echo "*** Since this library must not contain undefined symbols,"
3691 $echo "*** because either the platform does not support them or"
3692 $echo "*** it was explicitly requested with -no-undefined,"
3693 $echo "*** libtool will only create a static version of it."
3694 if test "$build_old_libs" = no; then
3695 oldlibs="$output_objdir/$libname.$libext"
3696 build_libtool_libs=module
3699 build_libtool_libs=no
3704 # Done checking deplibs!
3708 # All the library-specific variables (install_libdir is set above).
3713 # Test again, we may have decided not to build it any more
3714 if test "$build_libtool_libs" = yes; then
3715 if test "$hardcode_into_libs" = yes; then
3716 # Hardcode the library paths
3719 rpath="$finalize_rpath"
3720 test "$mode" != relink && rpath="$compile_rpath$rpath"
3721 for libdir in $rpath; do
3722 if test -n "$hardcode_libdir_flag_spec"; then
3723 if test -n "$hardcode_libdir_separator"; then
3724 if test -z "$hardcode_libdirs"; then
3725 hardcode_libdirs="$libdir"
3727 # Just accumulate the unique libdirs.
3728 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3729 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3732 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3737 eval flag=\"$hardcode_libdir_flag_spec\"
3738 dep_rpath="$dep_rpath $flag"
3740 elif test -n "$runpath_var"; then
3741 case "$perm_rpath " in
3743 *) perm_rpath="$perm_rpath $libdir" ;;
3747 # Substitute the hardcoded libdirs into the rpath.
3748 if test -n "$hardcode_libdir_separator" &&
3749 test -n "$hardcode_libdirs"; then
3750 libdir="$hardcode_libdirs"
3751 if test -n "$hardcode_libdir_flag_spec_ld"; then
3752 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3754 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3757 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3758 # We should set the runpath_var.
3760 for dir in $perm_rpath; do
3763 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3765 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3768 shlibpath="$finalize_shlibpath"
3769 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3770 if test -n "$shlibpath"; then
3771 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3774 # Get the real and link names of the library.
3775 eval shared_ext=\"$shrext_cmds\"
3776 eval library_names=\"$library_names_spec\"
3777 set dummy $library_names
3781 if test -n "$soname_spec"; then
3782 eval soname=\"$soname_spec\"
3786 if test -z "$dlname"; then
3790 lib="$output_objdir/$realname"
3793 linknames="$linknames $link"
3796 # Use standard objects if they are pic
3797 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3799 # Prepare the list of exported symbols
3800 if test -z "$export_symbols"; then
3801 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3802 $show "generating symbol list for \`$libname.la'"
3803 export_symbols="$output_objdir/$libname.exp"
3804 $run $rm $export_symbols
3805 cmds=$export_symbols_cmds
3806 save_ifs="$IFS"; IFS='~'
3807 for cmd in $cmds; do
3810 if len=`expr "X$cmd" : ".*"` &&
3811 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3813 $run eval "$cmd" || exit $?
3814 skipped_export=false
3816 # The command line is too long to execute in one step.
3817 $show "using reloadable object file for export list..."
3819 # Break out early, otherwise skipped_export may be
3820 # set to false by a later but shorter cmd.
3825 if test -n "$export_symbols_regex"; then
3826 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3827 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3828 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3829 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3834 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3835 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3839 for test_deplib in $deplibs; do
3840 case " $convenience " in
3841 *" $test_deplib "*) ;;
3843 tmp_deplibs="$tmp_deplibs $test_deplib"
3847 deplibs="$tmp_deplibs"
3849 if test -n "$convenience"; then
3850 if test -n "$whole_archive_flag_spec"; then
3851 save_libobjs=$libobjs
3852 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3854 gentop="$output_objdir/${outputname}x"
3855 generated="$generated $gentop"
3857 func_extract_archives $gentop $convenience
3858 libobjs="$libobjs $func_extract_archives_result"
3862 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3863 eval flag=\"$thread_safe_flag_spec\"
3864 linker_flags="$linker_flags $flag"
3867 # Make a backup of the uninstalled library when relinking
3868 if test "$mode" = relink; then
3869 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3872 # Do each of the archive commands.
3873 if test "$module" = yes && test -n "$module_cmds" ; then
3874 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3875 eval test_cmds=\"$module_expsym_cmds\"
3876 cmds=$module_expsym_cmds
3878 eval test_cmds=\"$module_cmds\"
3882 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3883 eval test_cmds=\"$archive_expsym_cmds\"
3884 cmds=$archive_expsym_cmds
3886 eval test_cmds=\"$archive_cmds\"
3891 if test "X$skipped_export" != "X:" &&
3892 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3893 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3896 # The command line is too long to link in one step, link piecewise.
3897 $echo "creating reloadable object files..."
3899 # Save the value of $output and $libobjs because we want to
3900 # use them later. If we have whole_archive_flag_spec, we
3901 # want to use save_libobjs as it was before
3902 # whole_archive_flag_spec was expanded, because we can't
3903 # assume the linker understands whole_archive_flag_spec.
3904 # This may have to be revisited, in case too many
3905 # convenience libraries get linked in and end up exceeding
3907 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3908 save_libobjs=$libobjs
3911 output_la=`$echo "X$output" | $Xsed -e "$basename"`
3913 # Clear the reloadable object creation command queue and
3914 # initialize k to one.
3921 output=$output_objdir/$output_la-${k}.$objext
3922 # Loop over the list of objects to be linked.
3923 for obj in $save_libobjs