/[path-sandbox]/trunk/ltmain.sh
Gentoo

Contents of /trunk/ltmain.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8 - (show annotations) (download) (as text)
Sat Nov 20 00:21:17 2004 UTC (11 years, 9 months ago) by ferringb
File MIME type: text/x-sh
File size: 185428 byte(s)
annoying autotool files.  stuck usual copyright stuff w/ gpl v2 notice in COPYING.

1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
3 #
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
7 #
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.
12 #
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.
17 #
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.
21 #
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.
26
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
33 :
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35 # Yippee, $echo works!
36 :
37 else
38 # Restart under the correct shell, and then maybe $echo will work.
39 exec $SHELL "$0" --no-reexec ${1+"$@"}
40 fi
41
42 if test "X$1" = X--fallback-echo; then
43 # used as fallback echo
44 shift
45 cat <<EOF
46 $*
47 EOF
48 exit 0
49 fi
50
51 # define SED for historic ltconfig's generated by Libtool 1.3
52 test -z "$SED" && SED=sed
53
54 # The name of this program.
55 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
56 modename="$progname"
57
58 # Constants.
59 PROGRAM=ltmain.sh
60 PACKAGE=libtool
61 VERSION=1.5.2
62 TIMESTAMP=" (1.1220.2.60 2004/01/25 12:25:08)"
63
64 default_mode=
65 help="Try \`$progname --help' for more information."
66 magic="%%%MAGIC variable%%%"
67 mkdir="mkdir"
68 mv="mv -f"
69 rm="rm -f"
70
71 # Sed substitution that helps us do robust quoting. It backslashifies
72 # metacharacters that are still active within double-quoted strings.
73 Xsed="${SED}"' -e 1s/^X//'
74 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
75 # test EBCDIC or ASCII
76 case `echo A|tr A '\301'` in
77 A) # EBCDIC based system
78 SP2NL="tr '\100' '\n'"
79 NL2SP="tr '\r\n' '\100\100'"
80 ;;
81 *) # Assume ASCII based system
82 SP2NL="tr '\040' '\012'"
83 NL2SP="tr '\015\012' '\040\040'"
84 ;;
85 esac
86
87 # NLS nuisances.
88 # Only set LANG and LC_ALL to C if already set.
89 # These must not be set unconditionally because not all systems understand
90 # e.g. LANG=C (notably SCO).
91 # We save the old values to restore during execute mode.
92 if test "${LC_ALL+set}" = set; then
93 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
94 fi
95 if test "${LANG+set}" = set; then
96 save_LANG="$LANG"; LANG=C; export LANG
97 fi
98
99 # Make sure IFS has a sensible default
100 : ${IFS="
101 "}
102
103 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
104 $echo "$modename: not configured to build any kind of library" 1>&2
105 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
106 exit 1
107 fi
108
109 # Global variables.
110 mode=$default_mode
111 nonopt=
112 prev=
113 prevopt=
114 run=
115 show="$echo"
116 show_help=
117 execute_dlfiles=
118 lo2o="s/\\.lo\$/.${objext}/"
119 o2lo="s/\\.${objext}\$/.lo/"
120
121 if test -z "$max_cmd_len"; then
122 i=0
123 testring="ABCD"
124 new_result=
125
126 # If test is not a shell built-in, we'll probably end up computing a
127 # maximum length that is only half of the actual maximum length, but
128 # we can't tell.
129 while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
130 = "XX$testring") >/dev/null 2>&1 &&
131 new_result=`expr "X$testring" : ".*" 2>&1` &&
132 max_cmd_len="$new_result" &&
133 test $i != 17 # 1/2 MB should be enough
134 do
135 i=`expr $i + 1`
136 testring="$testring$testring"
137 done
138 testring=
139 # Add a significant safety factor because C++ compilers can tack on massive
140 # amounts of additional arguments before passing them to the linker.
141 # It appears as though 1/2 is a usable value.
142 max_cmd_len=`expr $max_cmd_len \/ 2`
143 fi
144
145 #####################################
146 # Shell function definitions:
147 # This seems to be the best place for them
148
149 # Need a lot of goo to handle *both* DLLs and import libs
150 # Has to be a shell function in order to 'eat' the argument
151 # that is supplied when $file_magic_command is called.
152 win32_libid () {
153 win32_libid_type="unknown"
154 win32_fileres=`file -L $1 2>/dev/null`
155 case $win32_fileres in
156 *ar\ archive\ import\ library*) # definitely import
157 win32_libid_type="x86 archive import"
158 ;;
159 *ar\ archive*) # could be an import, or static
160 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
161 grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
162 win32_nmres=`eval $NM -f posix -A $1 | \
163 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
164 if test "X$win32_nmres" = "Ximport" ; then
165 win32_libid_type="x86 archive import"
166 else
167 win32_libid_type="x86 archive static"
168 fi
169 fi
170 ;;
171 *DLL*)
172 win32_libid_type="x86 DLL"
173 ;;
174 *executable*) # but shell scripts are "executable" too...
175 case $win32_fileres in
176 *MS\ Windows\ PE\ Intel*)
177 win32_libid_type="x86 DLL"
178 ;;
179 esac
180 ;;
181 esac
182 $echo $win32_libid_type
183 }
184
185 # End of Shell function definitions
186 #####################################
187
188 # Parse our command line options once, thoroughly.
189 while test "$#" -gt 0
190 do
191 arg="$1"
192 shift
193
194 case $arg in
195 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
196 *) optarg= ;;
197 esac
198
199 # If the previous option needs an argument, assign it.
200 if test -n "$prev"; then
201 case $prev in
202 execute_dlfiles)
203 execute_dlfiles="$execute_dlfiles $arg"
204 ;;
205 tag)
206 tagname="$arg"
207 preserve_args="${preserve_args}=$arg"
208
209 # Check whether tagname contains only valid characters
210 case $tagname in
211 *[!-_A-Za-z0-9,/]*)
212 $echo "$progname: invalid tag name: $tagname" 1>&2
213 exit 1
214 ;;
215 esac
216
217 case $tagname in
218 CC)
219 # Don't test for the "default" C tag, as we know, it's there, but
220 # not specially marked.
221 ;;
222 *)
223 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
224 taglist="$taglist $tagname"
225 # Evaluate the configuration.
226 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
227 else
228 $echo "$progname: ignoring unknown tag $tagname" 1>&2
229 fi
230 ;;
231 esac
232 ;;
233 *)
234 eval "$prev=\$arg"
235 ;;
236 esac
237
238 prev=
239 prevopt=
240 continue
241 fi
242
243 # Have we seen a non-optional argument yet?
244 case $arg in
245 --help)
246 show_help=yes
247 ;;
248
249 --version)
250 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
251 $echo
252 $echo "Copyright (C) 2003 Free Software Foundation, Inc."
253 $echo "This is free software; see the source for copying conditions. There is NO"
254 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
255 exit 0
256 ;;
257
258 --config)
259 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
260 # Now print the configurations for the tags.
261 for tagname in $taglist; do
262 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
263 done
264 exit 0
265 ;;
266
267 --debug)
268 $echo "$progname: enabling shell trace mode"
269 set -x
270 preserve_args="$preserve_args $arg"
271 ;;
272
273 --dry-run | -n)
274 run=:
275 ;;
276
277 --features)
278 $echo "host: $host"
279 if test "$build_libtool_libs" = yes; then
280 $echo "enable shared libraries"
281 else
282 $echo "disable shared libraries"
283 fi
284 if test "$build_old_libs" = yes; then
285 $echo "enable static libraries"
286 else
287 $echo "disable static libraries"
288 fi
289 exit 0
290 ;;
291
292 --finish) mode="finish" ;;
293
294 --mode) prevopt="--mode" prev=mode ;;
295 --mode=*) mode="$optarg" ;;
296
297 --preserve-dup-deps) duplicate_deps="yes" ;;
298
299 --quiet | --silent)
300 show=:
301 preserve_args="$preserve_args $arg"
302 ;;
303
304 --tag) prevopt="--tag" prev=tag ;;
305 --tag=*)
306 set tag "$optarg" ${1+"$@"}
307 shift
308 prev=tag
309 preserve_args="$preserve_args --tag"
310 ;;
311
312 -dlopen)
313 prevopt="-dlopen"
314 prev=execute_dlfiles
315 ;;
316
317 -*)
318 $echo "$modename: unrecognized option \`$arg'" 1>&2
319 $echo "$help" 1>&2
320 exit 1
321 ;;
322
323 *)
324 nonopt="$arg"
325 break
326 ;;
327 esac
328 done
329
330 if test -n "$prevopt"; then
331 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
332 $echo "$help" 1>&2
333 exit 1
334 fi
335
336 # If this variable is set in any of the actions, the command in it
337 # will be execed at the end. This prevents here-documents from being
338 # left over by shells.
339 exec_cmd=
340
341 if test -z "$show_help"; then
342
343 # Infer the operation mode.
344 if test -z "$mode"; then
345 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
346 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
347 case $nonopt in
348 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
349 mode=link
350 for arg
351 do
352 case $arg in
353 -c)
354 mode=compile
355 break
356 ;;
357 esac
358 done
359 ;;
360 *db | *dbx | *strace | *truss)
361 mode=execute
362 ;;
363 *install*|cp|mv)
364 mode=install
365 ;;
366 *rm)
367 mode=uninstall
368 ;;
369 *)
370 # If we have no mode, but dlfiles were specified, then do execute mode.
371 test -n "$execute_dlfiles" && mode=execute
372
373 # Just use the default operation mode.
374 if test -z "$mode"; then
375 if test -n "$nonopt"; then
376 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
377 else
378 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
379 fi
380 fi
381 ;;
382 esac
383 fi
384
385 # Only execute mode is allowed to have -dlopen flags.
386 if test -n "$execute_dlfiles" && test "$mode" != execute; then
387 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
388 $echo "$help" 1>&2
389 exit 1
390 fi
391
392 # Change the help message to a mode-specific one.
393 generic_help="$help"
394 help="Try \`$modename --help --mode=$mode' for more information."
395
396 # These modes are in order of execution frequency so that they run quickly.
397 case $mode in
398 # libtool compile mode
399 compile)
400 modename="$modename: compile"
401 # Get the compilation command and the source file.
402 base_compile=
403 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
404 suppress_opt=yes
405 suppress_output=
406 arg_mode=normal
407 libobj=
408 later=
409
410 for arg
411 do
412 case "$arg_mode" in
413 arg )
414 # do not "continue". Instead, add this to base_compile
415 lastarg="$arg"
416 arg_mode=normal
417 ;;
418
419 target )
420 libobj="$arg"
421 arg_mode=normal
422 continue
423 ;;
424
425 normal )
426 # Accept any command-line options.
427 case $arg in
428 -o)
429 if test -n "$libobj" ; then
430 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
431 exit 1
432 fi
433 arg_mode=target
434 continue
435 ;;
436
437 -static | -prefer-pic | -prefer-non-pic)
438 later="$later $arg"
439 continue
440 ;;
441
442 -no-suppress)
443 suppress_opt=no
444 continue
445 ;;
446
447 -Xcompiler)
448 arg_mode=arg # the next one goes into the "base_compile" arg list
449 continue # The current "srcfile" will either be retained or
450 ;; # replaced later. I would guess that would be a bug.
451
452 -Wc,*)
453 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
454 lastarg=
455 save_ifs="$IFS"; IFS=','
456 for arg in $args; do
457 IFS="$save_ifs"
458
459 # Double-quote args containing other shell metacharacters.
460 # Many Bourne shells cannot handle close brackets correctly
461 # in scan sets, so we specify it separately.
462 case $arg in
463 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
464 arg="\"$arg\""
465 ;;
466 esac
467 lastarg="$lastarg $arg"
468 done
469 IFS="$save_ifs"
470 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
471
472 # Add the arguments to base_compile.
473 base_compile="$base_compile $lastarg"
474 continue
475 ;;
476
477 * )
478 # Accept the current argument as the source file.
479 # The previous "srcfile" becomes the current argument.
480 #
481 lastarg="$srcfile"
482 srcfile="$arg"
483 ;;
484 esac # case $arg
485 ;;
486 esac # case $arg_mode
487
488 # Aesthetically quote the previous argument.
489 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
490
491 case $lastarg in
492 # Double-quote args containing other shell metacharacters.
493 # Many Bourne shells cannot handle close brackets correctly
494 # in scan sets, so we specify it separately.
495 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
496 lastarg="\"$lastarg\""
497 ;;
498 esac
499
500 base_compile="$base_compile $lastarg"
501 done # for arg
502
503 case $arg_mode in
504 arg)
505 $echo "$modename: you must specify an argument for -Xcompile"
506 exit 1
507 ;;
508 target)
509 $echo "$modename: you must specify a target with \`-o'" 1>&2
510 exit 1
511 ;;
512 *)
513 # Get the name of the library object.
514 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
515 ;;
516 esac
517
518 # Recognize several different file suffixes.
519 # If the user specifies -o file.o, it is replaced with file.lo
520 xform='[cCFSifmso]'
521 case $libobj in
522 *.ada) xform=ada ;;
523 *.adb) xform=adb ;;
524 *.ads) xform=ads ;;
525 *.asm) xform=asm ;;
526 *.c++) xform=c++ ;;
527 *.cc) xform=cc ;;
528 *.ii) xform=ii ;;
529 *.class) xform=class ;;
530 *.cpp) xform=cpp ;;
531 *.cxx) xform=cxx ;;
532 *.f90) xform=f90 ;;
533 *.for) xform=for ;;
534 *.java) xform=java ;;
535 esac
536
537 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
538
539 case $libobj in
540 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
541 *)
542 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
543 exit 1
544 ;;
545 esac
546
547 # Infer tagged configuration to use if any are available and
548 # if one wasn't chosen via the "--tag" command line option.
549 # Only attempt this if the compiler in the base compile
550 # command doesn't match the default compiler.
551 if test -n "$available_tags" && test -z "$tagname"; then
552 case $base_compile in
553 # Blanks in the command may have been stripped by the calling shell,
554 # but not from the CC environment variable when configure was run.
555 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
556 # Blanks at the start of $base_compile will cause this to fail
557 # if we don't check for them as well.
558 *)
559 for z in $available_tags; do
560 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
561 # Evaluate the configuration.
562 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
563 case "$base_compile " in
564 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
565 # The compiler in the base compile command matches
566 # the one in the tagged configuration.
567 # Assume this is the tagged configuration we want.
568 tagname=$z
569 break
570 ;;
571 esac
572 fi
573 done
574 # If $tagname still isn't set, then no tagged configuration
575 # was found and let the user know that the "--tag" command
576 # line option must be used.
577 if test -z "$tagname"; then
578 $echo "$modename: unable to infer tagged configuration"
579 $echo "$modename: specify a tag with \`--tag'" 1>&2
580 exit 1
581 # else
582 # $echo "$modename: using $tagname tagged configuration"
583 fi
584 ;;
585 esac
586 fi
587
588 for arg in $later; do
589 case $arg in
590 -static)
591 build_old_libs=yes
592 continue
593 ;;
594
595 -prefer-pic)
596 pic_mode=yes
597 continue
598 ;;
599
600 -prefer-non-pic)
601 pic_mode=no
602 continue
603 ;;
604 esac
605 done
606
607 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
608 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
609 if test "X$xdir" = "X$obj"; then
610 xdir=
611 else
612 xdir=$xdir/
613 fi
614 lobj=${xdir}$objdir/$objname
615
616 if test -z "$base_compile"; then
617 $echo "$modename: you must specify a compilation command" 1>&2
618 $echo "$help" 1>&2
619 exit 1
620 fi
621
622 # Delete any leftover library objects.
623 if test "$build_old_libs" = yes; then
624 removelist="$obj $lobj $libobj ${libobj}T"
625 else
626 removelist="$lobj $libobj ${libobj}T"
627 fi
628
629 $run $rm $removelist
630 trap "$run $rm $removelist; exit 1" 1 2 15
631
632 # On Cygwin there's no "real" PIC flag so we must build both object types
633 case $host_os in
634 cygwin* | mingw* | pw32* | os2*)
635 pic_mode=default
636 ;;
637 esac
638 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
639 # non-PIC code in shared libraries is not supported
640 pic_mode=default
641 fi
642
643 # Calculate the filename of the output object if compiler does
644 # not support -o with -c
645 if test "$compiler_c_o" = no; then
646 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
647 lockfile="$output_obj.lock"
648 removelist="$removelist $output_obj $lockfile"
649 trap "$run $rm $removelist; exit 1" 1 2 15
650 else
651 output_obj=
652 need_locks=no
653 lockfile=
654 fi
655
656 # Lock this critical section if it is needed
657 # We use this script file to make the link, it avoids creating a new file
658 if test "$need_locks" = yes; then
659 until $run ln "$0" "$lockfile" 2>/dev/null; do
660 $show "Waiting for $lockfile to be removed"
661 sleep 2
662 done
663 elif test "$need_locks" = warn; then
664 if test -f "$lockfile"; then
665 $echo "\
666 *** ERROR, $lockfile exists and contains:
667 `cat $lockfile 2>/dev/null`
668
669 This indicates that another process is trying to use the same
670 temporary object file, and libtool could not work around it because
671 your compiler does not support \`-c' and \`-o' together. If you
672 repeat this compilation, it may succeed, by chance, but you had better
673 avoid parallel builds (make -j) in this platform, or get a better
674 compiler."
675
676 $run $rm $removelist
677 exit 1
678 fi
679 $echo $srcfile > "$lockfile"
680 fi
681
682 if test -n "$fix_srcfile_path"; then
683 eval srcfile=\"$fix_srcfile_path\"
684 fi
685
686 $run $rm "$libobj" "${libobj}T"
687
688 # Create a libtool object file (analogous to a ".la" file),
689 # but don't create it if we're doing a dry run.
690 test -z "$run" && cat > ${libobj}T <<EOF
691 # $libobj - a libtool object file
692 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
693 #
694 # Please DO NOT delete this file!
695 # It is necessary for linking the library.
696
697 # Name of the PIC object.
698 EOF
699
700 # Only build a PIC object if we are building libtool libraries.
701 if test "$build_libtool_libs" = yes; then
702 # Without this assignment, base_compile gets emptied.
703 fbsd_hideous_sh_bug=$base_compile
704
705 if test "$pic_mode" != no; then
706 command="$base_compile $srcfile $pic_flag"
707 else
708 # Don't build PIC code
709 command="$base_compile $srcfile"
710 fi
711
712 if test ! -d "${xdir}$objdir"; then
713 $show "$mkdir ${xdir}$objdir"
714 $run $mkdir ${xdir}$objdir
715 status=$?
716 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
717 exit $status
718 fi
719 fi
720
721 if test -z "$output_obj"; then
722 # Place PIC objects in $objdir
723 command="$command -o $lobj"
724 fi
725
726 $run $rm "$lobj" "$output_obj"
727
728 $show "$command"
729 if $run eval "$command"; then :
730 else
731 test -n "$output_obj" && $run $rm $removelist
732 exit 1
733 fi
734
735 if test "$need_locks" = warn &&
736 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
737 $echo "\
738 *** ERROR, $lockfile contains:
739 `cat $lockfile 2>/dev/null`
740
741 but it should contain:
742 $srcfile
743
744 This indicates that another process is trying to use the same
745 temporary object file, and libtool could not work around it because
746 your compiler does not support \`-c' and \`-o' together. If you
747 repeat this compilation, it may succeed, by chance, but you had better
748 avoid parallel builds (make -j) in this platform, or get a better
749 compiler."
750
751 $run $rm $removelist
752 exit 1
753 fi
754
755 # Just move the object if needed, then go on to compile the next one
756 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
757 $show "$mv $output_obj $lobj"
758 if $run $mv $output_obj $lobj; then :
759 else
760 error=$?
761 $run $rm $removelist
762 exit $error
763 fi
764 fi
765
766 # Append the name of the PIC object to the libtool object file.
767 test -z "$run" && cat >> ${libobj}T <<EOF
768 pic_object='$objdir/$objname'
769
770 EOF
771
772 # Allow error messages only from the first compilation.
773 if test "$suppress_opt" = yes; then
774 suppress_output=' >/dev/null 2>&1'
775 fi
776 else
777 # No PIC object so indicate it doesn't exist in the libtool
778 # object file.
779 test -z "$run" && cat >> ${libobj}T <<EOF
780 pic_object=none
781
782 EOF
783 fi
784
785 # Only build a position-dependent object if we build old libraries.
786 if test "$build_old_libs" = yes; then
787 if test "$pic_mode" != yes; then
788 # Don't build PIC code
789 command="$base_compile $srcfile"
790 else
791 command="$base_compile $srcfile $pic_flag"
792 fi
793 if test "$compiler_c_o" = yes; then
794 command="$command -o $obj"
795 fi
796
797 # Suppress compiler output if we already did a PIC compilation.
798 command="$command$suppress_output"
799 $run $rm "$obj" "$output_obj"
800 $show "$command"
801 if $run eval "$command"; then :
802 else
803 $run $rm $removelist
804 exit 1
805 fi
806
807 if test "$need_locks" = warn &&
808 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
809 $echo "\
810 *** ERROR, $lockfile contains:
811 `cat $lockfile 2>/dev/null`
812
813 but it should contain:
814 $srcfile
815
816 This indicates that another process is trying to use the same
817 temporary object file, and libtool could not work around it because
818 your compiler does not support \`-c' and \`-o' together. If you
819 repeat this compilation, it may succeed, by chance, but you had better
820 avoid parallel builds (make -j) in this platform, or get a better
821 compiler."
822
823 $run $rm $removelist
824 exit 1
825 fi
826
827 # Just move the object if needed
828 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
829 $show "$mv $output_obj $obj"
830 if $run $mv $output_obj $obj; then :
831 else
832 error=$?
833 $run $rm $removelist
834 exit $error
835 fi
836 fi
837
838 # Append the name of the non-PIC object the libtool object file.
839 # Only append if the libtool object file exists.
840 test -z "$run" && cat >> ${libobj}T <<EOF
841 # Name of the non-PIC object.
842 non_pic_object='$objname'
843
844 EOF
845 else
846 # Append the name of the non-PIC object the libtool object file.
847 # Only append if the libtool object file exists.
848 test -z "$run" && cat >> ${libobj}T <<EOF
849 # Name of the non-PIC object.
850 non_pic_object=none
851
852 EOF
853 fi
854
855 $run $mv "${libobj}T" "${libobj}"
856
857 # Unlock the critical section if it was locked
858 if test "$need_locks" != no; then
859 $run $rm "$lockfile"
860 fi
861
862 exit 0
863 ;;
864
865 # libtool link mode
866 link | relink)
867 modename="$modename: link"
868 case $host in
869 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
870 # It is impossible to link a dll without this setting, and
871 # we shouldn't force the makefile maintainer to figure out
872 # which system we are compiling for in order to pass an extra
873 # flag for every libtool invocation.
874 # allow_undefined=no
875
876 # FIXME: Unfortunately, there are problems with the above when trying
877 # to make a dll which has undefined symbols, in which case not
878 # even a static library is built. For now, we need to specify
879 # -no-undefined on the libtool link line when we can be certain
880 # that all symbols are satisfied, otherwise we get a static library.
881 allow_undefined=yes
882 ;;
883 *)
884 allow_undefined=yes
885 ;;
886 esac
887 libtool_args="$nonopt"
888 base_compile="$nonopt $@"
889 compile_command="$nonopt"
890 finalize_command="$nonopt"
891
892 compile_rpath=
893 finalize_rpath=
894 compile_shlibpath=
895 finalize_shlibpath=
896 convenience=
897 old_convenience=
898 deplibs=
899 old_deplibs=
900 compiler_flags=
901 linker_flags=
902 dllsearchpath=
903 lib_search_path=`pwd`
904 inst_prefix_dir=
905
906 avoid_version=no
907 dlfiles=
908 dlprefiles=
909 dlself=no
910 export_dynamic=no
911 export_symbols=
912 export_symbols_regex=
913 generated=
914 libobjs=
915 ltlibs=
916 module=no
917 no_install=no
918 objs=
919 non_pic_objects=
920 precious_files_regex=
921 prefer_static_libs=no
922 preload=no
923 prev=
924 prevarg=
925 release=
926 rpath=
927 xrpath=
928 perm_rpath=
929 temp_rpath=
930 thread_safe=no
931 vinfo=
932 vinfo_number=no
933
934 # Infer tagged configuration to use if any are available and
935 # if one wasn't chosen via the "--tag" command line option.
936 # Only attempt this if the compiler in the base link
937 # command doesn't match the default compiler.
938 if test -n "$available_tags" && test -z "$tagname"; then
939 case $base_compile in
940 # Blanks in the command may have been stripped by the calling shell,
941 # but not from the CC environment variable when configure was run.
942 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
943 # Blanks at the start of $base_compile will cause this to fail
944 # if we don't check for them as well.
945 *)
946 for z in $available_tags; do
947 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
948 # Evaluate the configuration.
949 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
950 case $base_compile in
951 "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
952 # The compiler in $compile_command matches
953 # the one in the tagged configuration.
954 # Assume this is the tagged configuration we want.
955 tagname=$z
956 break
957 ;;
958 esac
959 fi
960 done
961 # If $tagname still isn't set, then no tagged configuration
962 # was found and let the user know that the "--tag" command
963 # line option must be used.
964 if test -z "$tagname"; then
965 $echo "$modename: unable to infer tagged configuration"
966 $echo "$modename: specify a tag with \`--tag'" 1>&2
967 exit 1
968 # else
969 # $echo "$modename: using $tagname tagged configuration"
970 fi
971 ;;
972 esac
973 fi
974
975 # We need to know -static, to get the right output filenames.
976 for arg
977 do
978 case $arg in
979 -all-static | -static)
980 if test "X$arg" = "X-all-static"; then
981 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
982 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
983 fi
984 if test -n "$link_static_flag"; then
985 dlopen_self=$dlopen_self_static
986 fi
987 else
988 if test -z "$pic_flag" && test -n "$link_static_flag"; then
989 dlopen_self=$dlopen_self_static
990 fi
991 fi
992 build_libtool_libs=no
993 build_old_libs=yes
994 prefer_static_libs=yes
995 break
996 ;;
997 esac
998 done
999
1000 # See if our shared archives depend on static archives.
1001 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1002
1003 # Go through the arguments, transforming them on the way.
1004 while test "$#" -gt 0; do
1005 arg="$1"
1006 shift
1007 case $arg in
1008 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1009 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1010 ;;
1011 *) qarg=$arg ;;
1012 esac
1013 libtool_args="$libtool_args $qarg"
1014
1015 # If the previous option needs an argument, assign it.
1016 if test -n "$prev"; then
1017 case $prev in
1018 output)
1019 compile_command="$compile_command @OUTPUT@"
1020 finalize_command="$finalize_command @OUTPUT@"
1021 ;;
1022 esac
1023
1024 case $prev in
1025 dlfiles|dlprefiles)
1026 if test "$preload" = no; then
1027 # Add the symbol object into the linking commands.
1028 compile_command="$compile_command @SYMFILE@"
1029 finalize_command="$finalize_command @SYMFILE@"
1030 preload=yes
1031 fi
1032 case $arg in
1033 *.la | *.lo) ;; # We handle these cases below.
1034 force)
1035 if test "$dlself" = no; then
1036 dlself=needless
1037 export_dynamic=yes
1038 fi
1039 prev=
1040 continue
1041 ;;
1042 self)
1043 if test "$prev" = dlprefiles; then
1044 dlself=yes
1045 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1046 dlself=yes
1047 else
1048 dlself=needless
1049 export_dynamic=yes
1050 fi
1051 prev=
1052 continue
1053 ;;
1054 *)
1055 if test "$prev" = dlfiles; then
1056 dlfiles="$dlfiles $arg"
1057 else
1058 dlprefiles="$dlprefiles $arg"
1059 fi
1060 prev=
1061 continue
1062 ;;
1063 esac
1064 ;;
1065 expsyms)
1066 export_symbols="$arg"
1067 if test ! -f "$arg"; then
1068 $echo "$modename: symbol file \`$arg' does not exist"
1069 exit 1
1070 fi
1071 prev=
1072 continue
1073 ;;
1074 expsyms_regex)
1075 export_symbols_regex="$arg"
1076 prev=
1077 continue
1078 ;;
1079 inst_prefix)
1080 inst_prefix_dir="$arg"
1081 prev=
1082 continue
1083 ;;
1084 precious_regex)
1085 precious_files_regex="$arg"
1086 prev=
1087 continue
1088 ;;
1089 release)
1090 release="-$arg"
1091 prev=
1092 continue
1093 ;;
1094 objectlist)
1095 if test -f "$arg"; then
1096 save_arg=$arg
1097 moreargs=
1098 for fil in `cat $save_arg`
1099 do
1100 # moreargs="$moreargs $fil"
1101 arg=$fil
1102 # A libtool-controlled object.
1103
1104 # Check to see that this really is a libtool object.
1105 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1106 pic_object=
1107 non_pic_object=
1108
1109 # Read the .lo file
1110 # If there is no directory component, then add one.
1111 case $arg in
1112 */* | *\\*) . $arg ;;
1113 *) . ./$arg ;;
1114 esac
1115
1116 if test -z "$pic_object" || \
1117 test -z "$non_pic_object" ||
1118 test "$pic_object" = none && \
1119 test "$non_pic_object" = none; then
1120 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1121 exit 1
1122 fi
1123
1124 # Extract subdirectory from the argument.
1125 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1126 if test "X$xdir" = "X$arg"; then
1127 xdir=
1128 else
1129 xdir="$xdir/"
1130 fi
1131
1132 if test "$pic_object" != none; then
1133 # Prepend the subdirectory the object is found in.
1134 pic_object="$xdir$pic_object"
1135
1136 if test "$prev" = dlfiles; then
1137 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1138 dlfiles="$dlfiles $pic_object"
1139 prev=
1140 continue
1141 else
1142 # If libtool objects are unsupported, then we need to preload.
1143 prev=dlprefiles
1144 fi
1145 fi
1146
1147 # CHECK ME: I think I busted this. -Ossama
1148 if test "$prev" = dlprefiles; then
1149 # Preload the old-style object.
1150 dlprefiles="$dlprefiles $pic_object"
1151 prev=
1152 fi
1153
1154 # A PIC object.
1155 libobjs="$libobjs $pic_object"
1156 arg="$pic_object"
1157 fi
1158
1159 # Non-PIC object.
1160 if test "$non_pic_object" != none; then
1161 # Prepend the subdirectory the object is found in.
1162 non_pic_object="$xdir$non_pic_object"
1163
1164 # A standard non-PIC object
1165 non_pic_objects="$non_pic_objects $non_pic_object"
1166 if test -z "$pic_object" || test "$pic_object" = none ; then
1167 arg="$non_pic_object"
1168 fi
1169 fi
1170 else
1171 # Only an error if not doing a dry-run.
1172 if test -z "$run"; then
1173 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1174 exit 1
1175 else
1176 # Dry-run case.
1177
1178 # Extract subdirectory from the argument.
1179 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1180 if test "X$xdir" = "X$arg"; then
1181 xdir=
1182 else
1183 xdir="$xdir/"
1184 fi
1185
1186 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1187 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1188 libobjs="$libobjs $pic_object"
1189 non_pic_objects="$non_pic_objects $non_pic_object"
1190 fi
1191 fi
1192 done
1193 else
1194 $echo "$modename: link input file \`$save_arg' does not exist"
1195 exit 1
1196 fi
1197 arg=$save_arg
1198 prev=
1199 continue
1200 ;;
1201 rpath | xrpath)
1202 # We need an absolute path.
1203 case $arg in
1204 [\\/]* | [A-Za-z]:[\\/]*) ;;
1205 *)
1206 $echo "$modename: only absolute run-paths are allowed" 1>&2
1207 exit 1
1208 ;;
1209 esac
1210 if test "$prev" = rpath; then
1211 case "$rpath " in
1212 *" $arg "*) ;;
1213 *) rpath="$rpath $arg" ;;
1214 esac
1215 else
1216 case "$xrpath " in
1217 *" $arg "*) ;;
1218 *) xrpath="$xrpath $arg" ;;
1219 esac
1220 fi
1221 prev=
1222 continue
1223 ;;
1224 xcompiler)
1225 compiler_flags="$compiler_flags $qarg"
1226 prev=
1227 compile_command="$compile_command $qarg"
1228 finalize_command="$finalize_command $qarg"
1229 continue
1230 ;;
1231 xlinker)
1232 linker_flags="$linker_flags $qarg"
1233 compiler_flags="$compiler_flags $wl$qarg"
1234 prev=
1235 compile_command="$compile_command $wl$qarg"
1236 finalize_command="$finalize_command $wl$qarg"
1237 continue
1238 ;;
1239 xcclinker)
1240 linker_flags="$linker_flags $qarg"
1241 compiler_flags="$compiler_flags $qarg"
1242 prev=
1243 compile_command="$compile_command $qarg"
1244 finalize_command="$finalize_command $qarg"
1245 continue
1246 ;;
1247 *)
1248 eval "$prev=\"\$arg\""
1249 prev=
1250 continue
1251 ;;
1252 esac
1253 fi # test -n "$prev"
1254
1255 prevarg="$arg"
1256
1257 case $arg in
1258 -all-static)
1259 if test -n "$link_static_flag"; then
1260 compile_command="$compile_command $link_static_flag"
1261 finalize_command="$finalize_command $link_static_flag"
1262 fi
1263 continue
1264 ;;
1265
1266 -allow-undefined)
1267 # FIXME: remove this flag sometime in the future.
1268 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1269 continue
1270 ;;
1271
1272 -avoid-version)
1273 avoid_version=yes
1274 continue
1275 ;;
1276
1277 -dlopen)
1278 prev=dlfiles
1279 continue
1280 ;;
1281
1282 -dlpreopen)
1283 prev=dlprefiles
1284 continue
1285 ;;
1286
1287 -export-dynamic)
1288 export_dynamic=yes
1289 continue
1290 ;;
1291
1292 -export-symbols | -export-symbols-regex)
1293 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1294 $echo "$modename: more than one -exported-symbols argument is not allowed"
1295 exit 1
1296 fi
1297 if test "X$arg" = "X-export-symbols"; then
1298 prev=expsyms
1299 else
1300 prev=expsyms_regex
1301 fi
1302 continue
1303 ;;
1304
1305 -inst-prefix-dir)
1306 prev=inst_prefix
1307 continue
1308 ;;
1309
1310 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1311 # so, if we see these flags be careful not to treat them like -L
1312 -L[A-Z][A-Z]*:*)
1313 case $with_gcc/$host in
1314 no/*-*-irix* | /*-*-irix*)
1315 compile_command="$compile_command $arg"
1316 finalize_command="$finalize_command $arg"
1317 ;;
1318 esac
1319 continue
1320 ;;
1321
1322 -L*)
1323 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1324 # We need an absolute path.
1325 case $dir in
1326 [\\/]* | [A-Za-z]:[\\/]*) ;;
1327 *)
1328 absdir=`cd "$dir" && pwd`
1329 if test -z "$absdir"; then
1330 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1331 exit 1
1332 fi
1333 dir="$absdir"
1334 ;;
1335 esac
1336 case "$deplibs " in
1337 *" -L$dir "*) ;;
1338 *)
1339 deplibs="$deplibs -L$dir"
1340 lib_search_path="$lib_search_path $dir"
1341 ;;
1342 esac
1343 case $host in
1344 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1345 case :$dllsearchpath: in
1346 *":$dir:"*) ;;
1347 *) dllsearchpath="$dllsearchpath:$dir";;
1348 esac
1349 ;;
1350 esac
1351 continue
1352 ;;
1353
1354 -l*)
1355 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1356 case $host in
1357 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1358 # These systems don't actually have a C or math library (as such)
1359 continue
1360 ;;
1361 *-*-mingw* | *-*-os2*)
1362 # These systems don't actually have a C library (as such)
1363 test "X$arg" = "X-lc" && continue
1364 ;;
1365 *-*-openbsd* | *-*-freebsd*)
1366 # Do not include libc due to us having libc/libc_r.
1367 test "X$arg" = "X-lc" && continue
1368 ;;
1369 *-*-rhapsody* | *-*-darwin1.[012])
1370 # Rhapsody C and math libraries are in the System framework
1371 deplibs="$deplibs -framework System"
1372 continue
1373 esac
1374 elif test "X$arg" = "X-lc_r"; then
1375 case $host in
1376 *-*-openbsd* | *-*-freebsd*)
1377 # Do not include libc_r directly, use -pthread flag.
1378 continue
1379 ;;
1380 esac
1381 fi
1382 deplibs="$deplibs $arg"
1383 continue
1384 ;;
1385
1386 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1387 deplibs="$deplibs $arg"
1388 continue
1389 ;;
1390
1391 -module)
1392 module=yes
1393 continue
1394 ;;
1395
1396 # gcc -m* arguments should be passed to the linker via $compiler_flags
1397 # in order to pass architecture information to the linker
1398 # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
1399 # but this is not reliable with gcc because gcc may use -mfoo to
1400 # select a different linker, different libraries, etc, while
1401 # -Wl,-mfoo simply passes -mfoo to the linker.
1402 -m*)
1403 # Unknown arguments in both finalize_command and compile_command need
1404 # to be aesthetically quoted because they are evaled later.
1405 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1406 case $arg in
1407 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1408 arg="\"$arg\""
1409 ;;
1410 esac
1411 compile_command="$compile_command $arg"
1412 finalize_command="$finalize_command $arg"
1413 if test "$with_gcc" = "yes" ; then
1414 compiler_flags="$compiler_flags $arg"
1415 fi
1416 continue
1417 ;;
1418
1419 -shrext)
1420 prev=shrext
1421 continue
1422 ;;
1423
1424 -no-fast-install)
1425 fast_install=no
1426 continue
1427 ;;
1428
1429 -no-install)
1430 case $host in
1431 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1432 # The PATH hackery in wrapper scripts is required on Windows
1433 # in order for the loader to find any dlls it needs.
1434 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1435 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1436 fast_install=no
1437 ;;
1438 *) no_install=yes ;;
1439 esac
1440 continue
1441 ;;
1442
1443 -no-undefined)
1444 allow_undefined=no
1445 continue
1446 ;;
1447
1448 -objectlist)
1449 prev=objectlist
1450 continue
1451 ;;
1452
1453 -o) prev=output ;;
1454
1455 -precious-files-regex)
1456 prev=precious_regex
1457 continue
1458 ;;
1459
1460 -release)
1461 prev=release
1462 continue
1463 ;;
1464
1465 -rpath)
1466 prev=rpath
1467 continue
1468 ;;
1469
1470 -R)
1471 prev=xrpath
1472 continue
1473 ;;
1474
1475 -R*)
1476 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1477 # We need an absolute path.
1478 case $dir in
1479 [\\/]* | [A-Za-z]:[\\/]*) ;;
1480 *)
1481 $echo "$modename: only absolute run-paths are allowed" 1>&2
1482 exit 1
1483 ;;
1484 esac
1485 case "$xrpath " in
1486 *" $dir "*) ;;
1487 *) xrpath="$xrpath $dir" ;;
1488 esac
1489 continue
1490 ;;
1491
1492 -static)
1493 # The effects of -static are defined in a previous loop.
1494 # We used to do the same as -all-static on platforms that
1495 # didn't have a PIC flag, but the assumption that the effects
1496 # would be equivalent was wrong. It would break on at least
1497 # Digital Unix and AIX.
1498 continue
1499 ;;
1500
1501 -thread-safe)
1502 thread_safe=yes
1503 continue
1504 ;;
1505
1506 -version-info)
1507 prev=vinfo
1508 continue
1509 ;;
1510 -version-number)
1511 prev=vinfo
1512 vinfo_number=yes
1513 continue
1514 ;;
1515
1516 -Wc,*)
1517 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1518 arg=
1519 save_ifs="$IFS"; IFS=','
1520 for flag in $args; do
1521 IFS="$save_ifs"
1522 case $flag in
1523 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1524 flag="\"$flag\""
1525 ;;
1526 esac
1527 arg="$arg $wl$flag"
1528 compiler_flags="$compiler_flags $flag"
1529 done
1530 IFS="$save_ifs"
1531 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1532 ;;
1533
1534 -Wl,*)
1535 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1536 arg=
1537 save_ifs="$IFS"; IFS=','
1538 for flag in $args; do
1539 IFS="$save_ifs"
1540 case $flag in
1541 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1542 flag="\"$flag\""
1543 ;;
1544 esac
1545 arg="$arg $wl$flag"
1546 compiler_flags="$compiler_flags $wl$flag"
1547 linker_flags="$linker_flags $flag"
1548 done
1549 IFS="$save_ifs"
1550 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1551 ;;
1552
1553 -Xcompiler)
1554 prev=xcompiler
1555 continue
1556 ;;
1557
1558 -Xlinker)
1559 prev=xlinker
1560 continue
1561 ;;
1562
1563 -XCClinker)
1564 prev=xcclinker
1565 continue
1566 ;;
1567
1568 -Kthread | -mthreads | -mt | -pthread | -pthreads | -threads | -qthreaded | -kthread )
1569 compiler_flags="$compiler_flags $arg"
1570 continue
1571 ;;
1572
1573 # Some other compiler flag.
1574 -* | +*)
1575 # Unknown arguments in both finalize_command and compile_command need
1576 # to be aesthetically quoted because they are evaled later.
1577 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1578 case $arg in
1579 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1580 arg="\"$arg\""
1581 ;;
1582 esac
1583 ;;
1584
1585 *.$objext)
1586 # A standard object.
1587 objs="$objs $arg"
1588 ;;
1589
1590 *.lo)
1591 # A libtool-controlled object.
1592
1593 # Check to see that this really is a libtool object.
1594 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1595 pic_object=
1596 non_pic_object=
1597
1598 # Read the .lo file
1599 # If there is no directory component, then add one.
1600 case $arg in
1601 */* | *\\*) . $arg ;;
1602 *) . ./$arg ;;
1603 esac
1604
1605 if test -z "$pic_object" || \
1606 test -z "$non_pic_object" ||
1607 test "$pic_object" = none && \
1608 test "$non_pic_object" = none; then
1609 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1610 exit 1
1611 fi
1612
1613 # Extract subdirectory from the argument.
1614 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1615 if test "X$xdir" = "X$arg"; then
1616 xdir=
1617 else
1618 xdir="$xdir/"
1619 fi
1620
1621 if test "$pic_object" != none; then
1622 # Prepend the subdirectory the object is found in.
1623 pic_object="$xdir$pic_object"
1624
1625 if test "$prev" = dlfiles; then
1626 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1627 dlfiles="$dlfiles $pic_object"
1628 prev=
1629 continue
1630 else
1631 # If libtool objects are unsupported, then we need to preload.
1632 prev=dlprefiles
1633 fi
1634 fi
1635
1636 # CHECK ME: I think I busted this. -Ossama
1637 if test "$prev" = dlprefiles; then
1638 # Preload the old-style object.
1639 dlprefiles="$dlprefiles $pic_object"
1640 prev=
1641 fi
1642
1643 # A PIC object.
1644 libobjs="$libobjs $pic_object"
1645 arg="$pic_object"
1646 fi
1647
1648 # Non-PIC object.
1649 if test "$non_pic_object" != none; then
1650 # Prepend the subdirectory the object is found in.
1651 non_pic_object="$xdir$non_pic_object"
1652
1653 # A standard non-PIC object
1654 non_pic_objects="$non_pic_objects $non_pic_object"
1655 if test -z "$pic_object" || test "$pic_object" = none ; then
1656 arg="$non_pic_object"
1657 fi
1658 fi
1659 else
1660 # Only an error if not doing a dry-run.
1661 if test -z "$run"; then
1662 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1663 exit 1
1664 else
1665 # Dry-run case.
1666
1667 # Extract subdirectory from the argument.
1668 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1669 if test "X$xdir" = "X$arg"; then
1670 xdir=
1671 else
1672 xdir="$xdir/"
1673 fi
1674
1675 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1676 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1677 libobjs="$libobjs $pic_object"
1678 non_pic_objects="$non_pic_objects $non_pic_object"
1679 fi
1680 fi
1681 ;;
1682
1683 *.$libext)
1684 # An archive.
1685 deplibs="$deplibs $arg"
1686 old_deplibs="$old_deplibs $arg"
1687 continue
1688 ;;
1689
1690 *.la)
1691 # A libtool-controlled library.
1692
1693 if test "$prev" = dlfiles; then
1694 # This library was specified with -dlopen.
1695 dlfiles="$dlfiles $arg"
1696 prev=
1697 elif test "$prev" = dlprefiles; then
1698 # The library was specified with -dlpreopen.
1699 dlprefiles="$dlprefiles $arg"
1700 prev=
1701 else
1702 deplibs="$deplibs $arg"
1703 fi
1704 continue
1705 ;;
1706
1707 # Some other compiler argument.
1708 *)
1709 # Unknown arguments in both finalize_command and compile_command need
1710 # to be aesthetically quoted because they are evaled later.
1711 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1712 case $arg in
1713 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1714 arg="\"$arg\""
1715 ;;
1716 esac
1717 ;;
1718 esac # arg
1719
1720 # Now actually substitute the argument into the commands.
1721 if test -n "$arg"; then
1722 compile_command="$compile_command $arg"
1723 finalize_command="$finalize_command $arg"
1724 fi
1725 done # argument parsing loop
1726
1727 if test -n "$prev"; then
1728 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1729 $echo "$help" 1>&2
1730 exit 1
1731 fi
1732
1733 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1734 eval arg=\"$export_dynamic_flag_spec\"
1735 compile_command="$compile_command $arg"
1736 finalize_command="$finalize_command $arg"
1737 fi
1738
1739 oldlibs=
1740 # calculate the name of the file, without its directory
1741 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1742 libobjs_save="$libobjs"
1743
1744 if test -n "$shlibpath_var"; then
1745 # get the directories listed in $shlibpath_var
1746 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1747 else
1748 shlib_search_path=
1749 fi
1750 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1751 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1752
1753 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1754 if test "X$output_objdir" = "X$output"; then
1755 output_objdir="$objdir"
1756 else
1757 output_objdir="$output_objdir/$objdir"
1758 fi
1759 # Create the object directory.
1760 if test ! -d "$output_objdir"; then
1761 $show "$mkdir $output_objdir"
1762 $run $mkdir $output_objdir
1763 status=$?
1764 if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1765 exit $status
1766 fi
1767 fi
1768
1769 # Determine the type of output
1770 case $output in
1771 "")
1772 $echo "$modename: you must specify an output file" 1>&2
1773 $echo "$help" 1>&2
1774 exit 1
1775 ;;
1776 *.$libext) linkmode=oldlib ;;
1777 *.lo | *.$objext) linkmode=obj ;;
1778 *.la) linkmode=lib ;;
1779 *) linkmode=prog ;; # Anything else should be a program.
1780 esac
1781
1782 case $host in
1783 *cygwin* | *mingw* | *pw32*)
1784 # don't eliminate duplcations in $postdeps and $predeps
1785 duplicate_compiler_generated_deps=yes
1786 ;;
1787 *)
1788 duplicate_compiler_generated_deps=$duplicate_deps
1789 ;;
1790 esac
1791 specialdeplibs=
1792
1793 libs=
1794 # Find all interdependent deplibs by searching for libraries
1795 # that are linked more than once (e.g. -la -lb -la)
1796 for deplib in $deplibs; do
1797 if test "X$duplicate_deps" = "Xyes" ; then
1798 case "$libs " in
1799 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1800 esac
1801 fi
1802 libs="$libs $deplib"
1803 done
1804
1805 if test "$linkmode" = lib; then
1806 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1807
1808 # Compute libraries that are listed more than once in $predeps
1809 # $postdeps and mark them as special (i.e., whose duplicates are
1810 # not to be eliminated).
1811 pre_post_deps=
1812 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1813 for pre_post_dep in $predeps $postdeps; do
1814 case "$pre_post_deps " in
1815 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1816 esac
1817 pre_post_deps="$pre_post_deps $pre_post_dep"
1818 done
1819 fi
1820 pre_post_deps=
1821 fi
1822
1823 deplibs=
1824 newdependency_libs=
1825 newlib_search_path=
1826 need_relink=no # whether we're linking any uninstalled libtool libraries
1827 notinst_deplibs= # not-installed libtool libraries
1828 notinst_path= # paths that contain not-installed libtool libraries
1829 case $linkmode in
1830 lib)
1831 passes="conv link"
1832 for file in $dlfiles $dlprefiles; do
1833 case $file in
1834 *.la) ;;
1835 *)
1836 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1837 exit 1
1838 ;;
1839 esac
1840 done
1841 ;;
1842 prog)
1843 compile_deplibs=
1844 finalize_deplibs=
1845 alldeplibs=no
1846 newdlfiles=
1847 newdlprefiles=
1848 passes="conv scan dlopen dlpreopen link"
1849 ;;
1850 *) passes="conv"
1851 ;;
1852 esac
1853 for pass in $passes; do
1854 if test "$linkmode,$pass" = "lib,link" ||
1855 test "$linkmode,$pass" = "prog,scan"; then
1856 libs="$deplibs"
1857 deplibs=
1858 fi
1859 if test "$linkmode" = prog; then
1860 case $pass in
1861 dlopen) libs="$dlfiles" ;;
1862 dlpreopen) libs="$dlprefiles" ;;
1863 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1864 esac
1865 fi
1866 if test "$pass" = dlopen; then
1867 # Collect dlpreopened libraries
1868 save_deplibs="$deplibs"
1869 deplibs=
1870 fi
1871 for deplib in $libs; do
1872 lib=
1873 found=no
1874 case $deplib in
1875 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1876 if test "$linkmode,$pass" = "prog,link"; then
1877 compile_deplibs="$deplib $compile_deplibs"
1878 finalize_deplibs="$deplib $finalize_deplibs"
1879 else
1880 deplibs="$deplib $deplibs"
1881 fi
1882 continue
1883 ;;
1884 -l*)
1885 if test "$linkmode" != lib && test "$linkmode" != prog; then
1886 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1887 continue
1888 fi
1889 if test "$pass" = conv; then
1890 deplibs="$deplib $deplibs"
1891 continue
1892 fi
1893 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1894 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1895 for search_ext in .la $shrext .so .a; do
1896 # Search the libtool library
1897 lib="$searchdir/lib${name}${search_ext}"
1898 if test -f "$lib"; then
1899 if test "$search_ext" = ".la"; then
1900 found=yes
1901 else
1902 found=no
1903 fi
1904 break 2
1905 fi
1906 done
1907 done
1908 if test "$found" != yes; then
1909 # deplib doesn't seem to be a libtool library
1910 if test "$linkmode,$pass" = "prog,link"; then
1911 compile_deplibs="$deplib $compile_deplibs"
1912 finalize_deplibs="$deplib $finalize_deplibs"
1913 else
1914 deplibs="$deplib $deplibs"
1915 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1916 fi
1917 continue
1918 else # deplib is a libtool library
1919 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1920 # We need to do some special things here, and not later.
1921 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1922 case " $predeps $postdeps " in
1923 *" $deplib "*)
1924 if (${SED} -e '2q' $lib |
1925 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1926 library_names=
1927 old_library=
1928 case $lib in
1929 */* | *\\*) . $lib ;;
1930 *) . ./$lib ;;
1931 esac
1932 for l in $old_library $library_names; do
1933 ll="$l"
1934 done
1935 if test "X$ll" = "X$old_library" ; then # only static version available
1936 found=no
1937 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1938 test "X$ladir" = "X$lib" && ladir="."
1939 lib=$ladir/$old_library
1940 if test "$linkmode,$pass" = "prog,link"; then
1941 compile_deplibs="$deplib $compile_deplibs"
1942 finalize_deplibs="$deplib $finalize_deplibs"
1943 else
1944 deplibs="$deplib $deplibs"
1945 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1946 fi
1947 continue
1948 fi
1949 fi
1950 ;;
1951 *) ;;
1952 esac
1953 fi
1954 fi
1955 ;; # -l
1956 -L*)
1957 case $linkmode in
1958 lib)
1959 deplibs="$deplib $deplibs"
1960 test "$pass" = conv && continue
1961 newdependency_libs="$deplib $newdependency_libs"
1962 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1963 ;;
1964 prog)
1965 if test "$pass" = conv; then
1966 deplibs="$deplib $deplibs"
1967 continue
1968 fi
1969 if test "$pass" = scan; then
1970 deplibs="$deplib $deplibs"
1971 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1972 else
1973 compile_deplibs="$deplib $compile_deplibs"
1974 finalize_deplibs="$deplib $finalize_deplibs"
1975 fi
1976 ;;
1977 *)
1978 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1979 ;;
1980 esac # linkmode
1981 continue
1982 ;; # -L
1983 -R*)
1984 if test "$pass" = link; then
1985 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1986 # Make sure the xrpath contains only unique directories.
1987 case "$xrpath " in
1988 *" $dir "*) ;;
1989 *) xrpath="$xrpath $dir" ;;
1990 esac
1991 fi
1992 deplibs="$deplib $deplibs"
1993 continue
1994 ;;
1995 *.la) lib="$deplib" ;;
1996 *.$libext)
1997 if test "$pass" = conv; then
1998 deplibs="$deplib $deplibs"
1999 continue
2000 fi
2001 case $linkmode in
2002 lib)
2003 if test "$deplibs_check_method" != pass_all; then
2004 $echo
2005 $echo "*** Warning: Trying to link with static lib archive $deplib."
2006 $echo "*** I have the capability to make that library automatically link in when"
2007 $echo "*** you link to this library. But I can only do this if you have a"
2008 $echo "*** shared version of the library, which you do not appear to have"
2009 $echo "*** because the file extensions .$libext of this argument makes me believe"
2010 $echo "*** that it is just a static archive that I should not used here."
2011 else
2012 $echo
2013 $echo "*** Warning: Linking the shared library $output against the"
2014 $echo "*** static library $deplib is not portable!"
2015 deplibs="$deplib $deplibs"
2016 fi
2017 continue
2018 ;;
2019 prog)
2020 if test "$pass" != link; then
2021 deplibs="$deplib $deplibs"
2022 else
2023 compile_deplibs="$deplib $compile_deplibs"
2024 finalize_deplibs="$deplib $finalize_deplibs"
2025 fi
2026 continue
2027 ;;
2028 esac # linkmode
2029 ;; # *.$libext
2030 *.lo | *.$objext)
2031 if test "$pass" = conv; then
2032 deplibs="$deplib $deplibs"
2033 elif test "$linkmode" = prog; then
2034 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2035 # If there is no dlopen support or we're linking statically,
2036 # we need to preload.
2037 newdlprefiles="$newdlprefiles $deplib"
2038 compile_deplibs="$deplib $compile_deplibs"
2039 finalize_deplibs="$deplib $finalize_deplibs"
2040 else
2041 newdlfiles="$newdlfiles $deplib"
2042 fi
2043 fi
2044 continue
2045 ;;
2046 %DEPLIBS%)
2047 alldeplibs=yes
2048 continue
2049 ;;
2050 esac # case $deplib
2051 if test "$found" = yes || test -f "$lib"; then :
2052 else
2053 $echo "$modename: cannot find the library \`$lib'" 1>&2
2054 exit 1
2055 fi
2056
2057 # Check to see that this really is a libtool archive.
2058 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2059 else
2060 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2061 exit 1
2062 fi
2063
2064 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2065 test "X$ladir" = "X$lib" && ladir="."
2066
2067 dlname=
2068 dlopen=
2069 dlpreopen=
2070 libdir=
2071 library_names=
2072 old_library=
2073 # If the library was installed with an old release of libtool,
2074 # it will not redefine variables installed, or shouldnotlink
2075 installed=yes
2076 shouldnotlink=no
2077
2078 # Read the .la file
2079 case $lib in
2080 */* | *\\*) . $lib ;;
2081 *) . ./$lib ;;
2082 esac
2083
2084 if test "$linkmode,$pass" = "lib,link" ||
2085 test "$linkmode,$pass" = "prog,scan" ||
2086 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2087 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2088 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2089 fi
2090
2091 if test "$pass" = conv; then
2092 # Only check for convenience libraries
2093 deplibs="$lib $deplibs"
2094 if test -z "$libdir"; then
2095 if test -z "$old_library"; then
2096 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2097 exit 1
2098 fi
2099 # It is a libtool convenience library, so add in its objects.
2100 convenience="$convenience $ladir/$objdir/$old_library"
2101 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2102 tmp_libs=
2103 for deplib in $dependency_libs; do
2104 deplibs="$deplib $deplibs"
2105 if test "X$duplicate_deps" = "Xyes" ; then
2106 case "$tmp_libs " in
2107 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2108 esac
2109 fi
2110 tmp_libs="$tmp_libs $deplib"
2111 done
2112 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2113 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2114 exit 1
2115 fi
2116 continue
2117 fi # $pass = conv
2118
2119
2120 # Get the name of the library we link against.
2121 linklib=
2122 for l in $old_library $library_names; do
2123 linklib="$l"
2124 done
2125 if test -z "$linklib"; then
2126 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2127 exit 1
2128 fi
2129
2130 # This library was specified with -dlopen.
2131 if test "$pass" = dlopen; then
2132 if test -z "$libdir"; then
2133 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2134 exit 1
2135 fi
2136 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2137 # If there is no dlname, no dlopen support or we're linking
2138 # statically, we need to preload. We also need to preload any
2139 # dependent libraries so libltdl's deplib preloader doesn't
2140 # bomb out in the load deplibs phase.
2141 dlprefiles="$dlprefiles $lib $dependency_libs"
2142 else
2143 newdlfiles="$newdlfiles $lib"
2144 fi
2145 continue
2146 fi # $pass = dlopen
2147
2148 # We need an absolute path.
2149 case $ladir in
2150 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2151 *)
2152 abs_ladir=`cd "$ladir" && pwd`
2153 if test -z "$abs_ladir"; then
2154 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2155 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2156 abs_ladir="$ladir"
2157 fi
2158 ;;
2159 esac
2160 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2161
2162 # Find the relevant object directory and library name.
2163 if test "X$installed" = Xyes; then
2164 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2165 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2166 dir="$ladir"
2167 absdir="$abs_ladir"
2168 libdir="$abs_ladir"
2169 else
2170 dir="$libdir"
2171 absdir="$libdir"
2172 fi
2173 else
2174 dir="$ladir/$objdir"
2175 absdir="$abs_ladir/$objdir"
2176 # Remove this search path later
2177 notinst_path="$notinst_path $abs_ladir"
2178 fi # $installed = yes
2179 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2180
2181 # This library was specified with -dlpreopen.
2182 if test "$pass" = dlpreopen; then
2183 if test -z "$libdir"; then
2184 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2185 exit 1
2186 fi
2187 # Prefer using a static library (so that no silly _DYNAMIC symbols
2188 # are required to link).
2189 if test -n "$old_library"; then
2190 newdlprefiles="$newdlprefiles $dir/$old_library"
2191 # Otherwise, use the dlname, so that lt_dlopen finds it.
2192 elif test -n "$dlname"; then
2193 newdlprefiles="$newdlprefiles $dir/$dlname"
2194 else
2195 newdlprefiles="$newdlprefiles $dir/$linklib"
2196 fi
2197 fi # $pass = dlpreopen
2198
2199 if test -z "$libdir"; then
2200 # Link the convenience library
2201 if test "$linkmode" = lib; then
2202 deplibs="$dir/$old_library $deplibs"
2203 elif test "$linkmode,$pass" = "prog,link"; then
2204 compile_deplibs="$dir/$old_library $compile_deplibs"
2205 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2206 else
2207 deplibs="$lib $deplibs" # used for prog,scan pass
2208 fi
2209 continue
2210 fi
2211
2212
2213 if test "$linkmode" = prog && test "$pass" != link; then
2214 newlib_search_path="$newlib_search_path $ladir"
2215 deplibs="$lib $deplibs"
2216
2217 linkalldeplibs=no
2218 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2219 test "$build_libtool_libs" = no; then
2220 linkalldeplibs=yes
2221 fi
2222
2223 tmp_libs=
2224 for deplib in $dependency_libs; do
2225 case $deplib in
2226 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2227 esac
2228 # Need to link against all dependency_libs?
2229 if test "$linkalldeplibs" = yes; then
2230 deplibs="$deplib $deplibs"
2231 else
2232 # Need to hardcode shared library paths
2233 # or/and link against static libraries
2234 newdependency_libs="$deplib $newdependency_libs"
2235 fi
2236 if test "X$duplicate_deps" = "Xyes" ; then
2237 case "$tmp_libs " in
2238 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2239 esac
2240 fi
2241 tmp_libs="$tmp_libs $deplib"
2242 done # for deplib
2243 continue
2244 fi # $linkmode = prog...
2245
2246 if test "$linkmode,$pass" = "prog,link"; then
2247 if test -n "$library_names" &&
2248 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2249 # We need to hardcode the library path
2250 if test -n "$shlibpath_var"; then
2251 # Make sure the rpath contains only unique directories.
2252 case "$temp_rpath " in
2253 *" $dir "*) ;;
2254 *" $absdir "*) ;;
2255 *) temp_rpath="$temp_rpath $dir" ;;
2256 esac
2257 fi
2258
2259 # Hardcode the library path.
2260 # Skip directories that are in the system default run-time
2261 # search path.
2262 case " $sys_lib_dlsearch_path " in
2263 *" $absdir "*) ;;
2264 *)
2265 case "$compile_rpath " in
2266 *" $absdir "*) ;;
2267 *) compile_rpath="$compile_rpath $absdir"
2268 esac
2269 ;;
2270 esac
2271 case " $sys_lib_dlsearch_path " in
2272 *" $libdir "*) ;;
2273 *)
2274 case "$finalize_rpath " in
2275 *" $libdir "*) ;;
2276 *) finalize_rpath="$finalize_rpath $libdir"
2277 esac
2278 ;;
2279 esac
2280 fi # $linkmode,$pass = prog,link...
2281
2282 if test "$alldeplibs" = yes &&
2283 { test "$deplibs_check_method" = pass_all ||
2284 { test "$build_libtool_libs" = yes &&
2285 test -n "$library_names"; }; }; then
2286 # We only need to search for static libraries
2287 continue
2288 fi
2289 fi
2290
2291 link_static=no # Whether the deplib will be linked statically
2292 if test -n "$library_names" &&
2293 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2294 if test "$installed" = no; then
2295 notinst_deplibs="$notinst_deplibs $lib"
2296 need_relink=yes
2297 fi
2298 # This is a shared library
2299
2300 # Warn about portability, can't link against -module's on some systems (darwin)
2301 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2302 $echo
2303 if test "$linkmode" = prog; then
2304 $echo "*** Warning: Linking the executable $output against the loadable module"
2305 else
2306 $echo "*** Warning: Linking the shared library $output against the loadable module"
2307 fi
2308 $echo "*** $linklib is not portable!"
2309 fi
2310 if test "$linkmode" = lib &&
2311 test "$hardcode_into_libs" = yes; then
2312 # Hardcode the library path.
2313 # Skip directories that are in the system default run-time
2314 # search path.
2315 case " $sys_lib_dlsearch_path " in
2316 *" $absdir "*) ;;
2317 *)
2318 case "$compile_rpath " in
2319 *" $absdir "*) ;;
2320 *) compile_rpath="$compile_rpath $absdir"
2321 esac
2322 ;;
2323 esac
2324 case " $sys_lib_dlsearch_path " in
2325 *" $libdir "*) ;;
2326 *)
2327 case "$finalize_rpath " in
2328 *" $libdir "*) ;;
2329 *) finalize_rpath="$finalize_rpath $libdir"
2330 esac
2331 ;;
2332 esac
2333 fi
2334
2335 if test -n "$old_archive_from_expsyms_cmds"; then
2336 # figure out the soname
2337 set dummy $library_names
2338 realname="$2"
2339 shift; shift
2340 libname=`eval \\$echo \"$libname_spec\"`
2341 # use dlname if we got it. it's perfectly good, no?
2342 if test -n "$dlname"; then
2343 soname="$dlname"
2344 elif test -n "$soname_spec"; then
2345 # bleh windows
2346 case $host in
2347 *cygwin* | mingw*)
2348 major=`expr $current - $age`
2349 versuffix="-$major"
2350 ;;
2351 esac
2352 eval soname=\"$soname_spec\"
2353 else
2354 soname="$realname"
2355 fi
2356
2357 # Make a new name for the extract_expsyms_cmds to use
2358 soroot="$soname"
2359 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2360 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2361
2362 # If the library has no export list, then create one now
2363 if test -f "$output_objdir/$soname-def"; then :
2364 else
2365 $show "extracting exported symbol list from \`$soname'"
2366 save_ifs="$IFS"; IFS='~'
2367 cmds=$extract_expsyms_cmds
2368 for cmd in $cmds; do
2369 IFS="$save_ifs"
2370 eval cmd=\"$cmd\"
2371 $show "$cmd"
2372 $run eval "$cmd" || exit $?
2373 done
2374 IFS="$save_ifs"
2375 fi
2376
2377 # Create $newlib
2378 if test -f "$output_objdir/$newlib"; then :; else
2379 $show "generating import library for \`$soname'"
2380 save_ifs="$IFS"; IFS='~'
2381 cmds=$old_archive_from_expsyms_cmds
2382 for cmd in $cmds; do
2383 IFS="$save_ifs"
2384 eval cmd=\"$cmd\"
2385 $show "$cmd"
2386 $run eval "$cmd" || exit $?
2387 done
2388 IFS="$save_ifs"
2389 fi
2390 # make sure the library variables are pointing to the new library
2391 dir=$output_objdir
2392 linklib=$newlib
2393 fi # test -n "$old_archive_from_expsyms_cmds"
2394
2395 if test "$linkmode" = prog || test "$mode" != relink; then
2396 add_shlibpath=
2397 add_dir=
2398 add=
2399 lib_linked=yes
2400 case $hardcode_action in
2401 immediate | unsupported)
2402 if test "$hardcode_direct" = no; then
2403 add="$dir/$linklib"
2404 case $host in
2405 *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2406 *-*-darwin* )
2407 # if the lib is a module then we can not link against it, someone
2408 # is ignoring the new warnings I added
2409 if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2410 $echo "** Warning, lib $linklib is a module, not a shared library"
2411 if test -z "$old_library" ; then
2412 $echo
2413 $echo "** And there doesn't seem to be a static archive available"
2414 $echo "** The link will probably fail, sorry"
2415 else
2416 add="$dir/$old_library"
2417 fi
2418 fi
2419 esac
2420 elif test "$hardcode_minus_L" = no; then
2421 case $host in
2422 *-*-sunos*) add_shlibpath="$dir" ;;
2423 esac
2424 add_dir="-L$dir"
2425 add="-l$name"
2426 elif test "$hardcode_shlibpath_var" = no; then
2427 add_shlibpath="$dir"
2428 add="-l$name"
2429 else
2430 lib_linked=no
2431 fi
2432 ;;
2433 relink)
2434 if test "$hardcode_direct" = yes; then
2435 add="$dir/$linklib"
2436 elif test "$hardcode_minus_L" = yes; then
2437 add_dir="-L$dir"
2438 # Try looking first in the location we're being installed to.
2439 if test -n "$inst_prefix_dir"; then
2440 case "$libdir" in
2441 [\\/]*)
2442 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2443 ;;
2444 esac
2445 fi
2446 add="-l$name"
2447 elif test "$hardcode_shlibpath_var" = yes; then
2448 add_shlibpath="$dir"
2449 add="-l$name"
2450 else
2451 lib_linked=no
2452 fi
2453 ;;
2454 *) lib_linked=no ;;
2455 esac
2456
2457 if test "$lib_linked" != yes; then
2458 $echo "$modename: configuration error: unsupported hardcode properties"
2459 exit 1
2460 fi
2461
2462 if test -n "$add_shlibpath"; then
2463 case :$compile_shlibpath: in
2464 *":$add_shlibpath:"*) ;;
2465 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2466 esac
2467 fi
2468 if test "$linkmode" = prog; then
2469 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2470 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2471 else
2472 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2473 test -n "$add" && deplibs="$add $deplibs"
2474 if test "$hardcode_direct" != yes && \
2475 test "$hardcode_minus_L" != yes && \
2476 test "$hardcode_shlibpath_var" = yes; then
2477 case :$finalize_shlibpath: in
2478 *":$libdir:"*) ;;
2479 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2480 esac
2481 fi
2482 fi
2483 fi
2484
2485 if test "$linkmode" = prog || test "$mode" = relink; then
2486 add_shlibpath=
2487 add_dir=
2488 add=
2489 # Finalize command for both is simple: just hardcode it.
2490 if test "$hardcode_direct" = yes; then
2491 add="$libdir/$linklib"
2492 elif test "$hardcode_minus_L" = yes; then
2493 add_dir="-L$libdir"
2494 add="-l$name"
2495 elif test "$hardcode_shlibpath_var" = yes; then
2496 case :$finalize_shlibpath: in
2497 *":$libdir:"*) ;;
2498 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2499 esac
2500 add="-l$name"
2501 elif test "$hardcode_automatic" = yes; then
2502 if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2503 add="$inst_prefix_dir$libdir/$linklib"
2504 else
2505 add="$libdir/$linklib"
2506 fi
2507 else
2508 # We cannot seem to hardcode it, guess we'll fake it.
2509 add_dir="-L$libdir"
2510 # Try looking first in the location we're being installed to.
2511 if test -n "$inst_prefix_dir"; then
2512 case "$libdir" in
2513 [\\/]*)
2514 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2515 ;;
2516 esac
2517 fi
2518 add="-l$name"
2519 fi
2520
2521 if test "$linkmode" = prog; then
2522 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2523 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2524 else
2525 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2526 test -n "$add" && deplibs="$add $deplibs"
2527 fi
2528 fi
2529 elif test "$linkmode" = prog; then
2530 # Here we assume that one of hardcode_direct or hardcode_minus_L
2531 # is not unsupported. This is valid on all known static and
2532 # shared platforms.
2533 if test "$hardcode_direct" != unsupported; then
2534 test -n "$old_library" && linklib="$old_library"
2535 compile_deplibs="$dir/$linklib $compile_deplibs"
2536 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2537 else
2538 compile_deplibs="-l$name -L$dir $compile_deplibs"
2539 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2540 fi
2541 elif test "$build_libtool_libs" = yes; then
2542 # Not a shared library
2543 if test "$deplibs_check_method" != pass_all; then
2544 # We're trying link a shared library against a static one
2545 # but the system doesn't support it.
2546
2547 # Just print a warning and add the library to dependency_libs so
2548 # that the program can be linked against the static library.
2549 $echo
2550 $echo "*** Warning: This system can not link to static lib archive $lib."
2551 $echo "*** I have the capability to make that library automatically link in when"
2552 $echo "*** you link to this library. But I can only do this if you have a"
2553 $echo "*** shared version of the library, which you do not appear to have."
2554 if test "$module" = yes; then
2555 $echo "*** But as you try to build a module library, libtool will still create "
2556 $echo "*** a static module, that should work as long as the dlopening application"
2557 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2558 if test -z "$global_symbol_pipe"; then
2559 $echo
2560 $echo "*** However, this would only work if libtool was able to extract symbol"
2561 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2562 $echo "*** not find such a program. So, this module is probably useless."
2563 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2564 fi
2565 if test "$build_old_libs" = no; then
2566 build_libtool_libs=module
2567 build_old_libs=yes
2568 else
2569 build_libtool_libs=no
2570 fi
2571 fi
2572 else
2573 convenience="$convenience $dir/$old_library"
2574 old_convenience="$old_convenience $dir/$old_library"
2575 deplibs="$dir/$old_library $deplibs"
2576 link_static=yes
2577 fi
2578 fi # link shared/static library?
2579
2580 if test "$linkmode" = lib; then
2581 if test -n "$dependency_libs" &&
2582 { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2583 test "$link_static" = yes; }; then
2584 # Extract -R from dependency_libs
2585 temp_deplibs=
2586 for libdir in $dependency_libs; do
2587 case $libdir in
2588 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2589 case " $xrpath " in
2590 *" $temp_xrpath "*) ;;
2591 *) xrpath="$xrpath $temp_xrpath";;
2592 esac;;
2593 *) temp_deplibs="$temp_deplibs $libdir";;
2594 esac
2595 done
2596 dependency_libs="$temp_deplibs"
2597 fi
2598
2599 newlib_search_path="$newlib_search_path $absdir"
2600 # Link against this library
2601 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2602 # ... and its dependency_libs
2603 tmp_libs=
2604 for deplib in $dependency_libs; do
2605 newdependency_libs="$deplib $newdependency_libs"
2606 if test "X$duplicate_deps" = "Xyes" ; then
2607 case "$tmp_libs " in
2608 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2609 esac
2610 fi
2611 tmp_libs="$tmp_libs $deplib"
2612 done
2613
2614 if test "$link_all_deplibs" != no; then
2615 # Add the search paths of all dependency libraries
2616 for deplib in $dependency_libs; do
2617 case $deplib in
2618 -L*) path="$deplib" ;;
2619 *.la)
2620 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2621 test "X$dir" = "X$deplib" && dir="."
2622 # We need an absolute path.
2623 case $dir in
2624 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2625 *)
2626 absdir=`cd "$dir" && pwd`
2627 if test -z "$absdir"; then
2628 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2629 absdir="$dir"
2630 fi
2631 ;;
2632 esac
2633 if grep "^installed=no" $deplib > /dev/null; then
2634 path="$absdir/$objdir"
2635 else
2636 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2637 if test -z "$libdir"; then
2638 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2639 exit 1
2640 fi
2641 if test "$absdir" != "$libdir"; then
2642 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2643 fi
2644 path="$absdir"
2645 fi
2646 depdepl=
2647 case $host in
2648 *-*-darwin*)
2649 # we do not want to link against static libs, but need to link against shared
2650 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2651 if test -n "$deplibrary_names" ; then
2652 for tmp in $deplibrary_names ; do
2653 depdepl=$tmp
2654 done
2655 if test -f "$path/$depdepl" ; then
2656 depdepl="$path/$depdepl"
2657 fi
2658 # do not add paths which are already there
2659 case " $newlib_search_path " in
2660 *" $path "*) ;;
2661 *) newlib_search_path="$newlib_search_path $path";;
2662 esac
2663 fi
2664 path=""
2665 ;;
2666 *)
2667 path="-L$path"
2668 ;;
2669 esac
2670
2671 ;;
2672 -l*)
2673 case $host in
2674 *-*-darwin*)
2675 # Again, we only want to link against shared libraries
2676 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2677 for tmp in $newlib_search_path ; do
2678 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2679 eval depdepl="$tmp/lib$tmp_libs.dylib"
2680 break
2681 fi
2682 done
2683 path=""
2684 ;;
2685 *) continue ;;
2686 esac
2687 ;;
2688 *) continue ;;
2689 esac
2690 case " $deplibs " in
2691 *" $depdepl "*) ;;
2692 *) deplibs="$deplibs $depdepl" ;;
2693 esac
2694 case " $deplibs " in
2695 *" $path "*) ;;
2696 *) deplibs="$deplibs $path" ;;
2697 esac
2698 done
2699 fi # link_all_deplibs != no
2700 fi # linkmode = lib
2701 done # for deplib in $libs
2702 dependency_libs="$newdependency_libs"
2703 if test "$pass" = dlpreopen; then
2704 # Link the dlpreopened libraries before other libraries
2705 for deplib in $save_deplibs; do
2706 deplibs="$deplib $deplibs"
2707 done
2708 fi
2709 if test "$pass" != dlopen; then
2710 if test "$pass" != conv; then
2711 # Make sure lib_search_path contains only unique directories.
2712 lib_search_path=
2713 for dir in $newlib_search_path; do
2714 case "$lib_search_path " in
2715 *" $dir "*) ;;
2716 *) lib_search_path="$lib_search_path $dir" ;;
2717 esac
2718 done
2719 newlib_search_path=
2720 fi
2721
2722 if test "$linkmode,$pass" != "prog,link"; then
2723 vars="deplibs"
2724 else
2725 vars="compile_deplibs finalize_deplibs"
2726 fi
2727 for var in $vars dependency_libs; do
2728 # Add libraries to $var in reverse order
2729 eval tmp_libs=\"\$$var\"
2730 new_libs=
2731 for deplib in $tmp_libs; do
2732 # FIXME: Pedantically, this is the right thing to do, so
2733 # that some nasty dependency loop isn't accidentally
2734 # broken:
2735 #new_libs="$deplib $new_libs"
2736 # Pragmatically, this seems to cause very few problems in
2737 # practice:
2738 case $deplib in
2739 -L*) new_libs="$deplib $new_libs" ;;
2740 -R*) ;;
2741 *)
2742 # And here is the reason: when a library appears more
2743 # than once as an explicit dependence of a library, or
2744 # is implicitly linked in more than once by the
2745 # compiler, it is considered special, and multiple
2746 # occurrences thereof are not removed. Compare this
2747 # with having the same library being listed as a
2748 # dependency of multiple other libraries: in this case,
2749 # we know (pedantically, we assume) the library does not
2750 # need to be listed more than once, so we keep only the
2751 # last copy. This is not always right, but it is rare
2752 # enough that we require users that really mean to play
2753 # such unportable linking tricks to link the library
2754 # using -Wl,-lname, so that libtool does not consider it
2755 # for duplicate removal.
2756 case " $specialdeplibs " in
2757 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2758 *)
2759 case " $new_libs " in
2760 *" $deplib "*) ;;
2761 *) new_libs="$deplib $new_libs" ;;
2762 esac
2763 ;;
2764 esac
2765 ;;
2766 esac
2767 done
2768 tmp_libs=
2769 for deplib in $new_libs; do
2770 case $deplib in
2771 -L*)
2772 case " $tmp_libs " in
2773 *" $deplib "*) ;;
2774 *) tmp_libs="$tmp_libs $deplib" ;;
2775 esac
2776 ;;
2777 *) tmp_libs="$tmp_libs $deplib" ;;
2778 esac
2779 done
2780 eval $var=\"$tmp_libs\"
2781 done # for var
2782 fi
2783 # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
2784 tmp_libs=
2785 for i in $dependency_libs ; do
2786 case " $predeps $postdeps $compiler_lib_search_path " in
2787 *" $i "*)
2788 i=""
2789 ;;
2790 esac
2791 if test -n "$i" ; then
2792 tmp_libs="$tmp_libs $i"
2793 fi
2794 done
2795 dependency_libs=$tmp_libs
2796 done # for pass
2797 if test "$linkmode" = prog; then
2798 dlfiles="$newdlfiles"
2799 dlprefiles="$newdlprefiles"
2800 fi
2801
2802 case $linkmode in
2803 oldlib)
2804 if test -n "$deplibs"; then
2805 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2806 fi
2807
2808 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2809 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2810 fi
2811
2812 if test -n "$rpath"; then
2813 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2814 fi
2815
2816 if test -n "$xrpath"; then
2817 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2818 fi
2819
2820 if test -n "$vinfo"; then
2821 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2822 fi
2823
2824 if test -n "$release"; then
2825 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2826 fi
2827
2828 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2829 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2830 fi
2831
2832 # Now set the variables for building old libraries.
2833 build_libtool_libs=no
2834 oldlibs="$output"
2835 objs="$objs$old_deplibs"
2836 ;;
2837
2838 lib)
2839 # Make sure we only generate libraries of the form `libNAME.la'.
2840 case $outputname in
2841 lib*)
2842 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2843 eval shared_ext=\"$shrext\"
2844 eval libname=\"$libname_spec\"
2845 ;;
2846 *)
2847 if test "$module" = no; then
2848 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2849 $echo "$help" 1>&2
2850 exit 1
2851 fi
2852 if test "$need_lib_prefix" != no; then
2853 # Add the "lib" prefix for modules if required
2854 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2855 eval shared_ext=\"$shrext\"
2856 eval libname=\"$libname_spec\"
2857 else
2858 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2859 fi
2860 ;;
2861 esac
2862
2863 if test -n "$objs"; then
2864 if test "$deplibs_check_method" != pass_all; then
2865 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2866 exit 1
2867 else
2868 $echo
2869 $echo "*** Warning: Linking the shared library $output against the non-libtool"
2870 $echo "*** objects $objs is not portable!"
2871 libobjs="$libobjs $objs"
2872 fi
2873 fi
2874
2875 if test "$dlself" != no; then
2876 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2877 fi
2878
2879 set dummy $rpath
2880 if test "$#" -gt 2; then
2881 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2882 fi
2883 install_libdir="$2"
2884
2885 oldlibs=
2886 if test -z "$rpath"; then
2887 if test "$build_libtool_libs" = yes; then
2888 # Building a libtool convenience library.
2889 # Some compilers have problems with a `.al' extension so
2890 # convenience libraries should have the same extension an
2891 # archive normally would.
2892 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2893 build_libtool_libs=convenience
2894 build_old_libs=yes
2895 fi
2896
2897 if test -n "$vinfo"; then
2898 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2899 fi
2900
2901 if test -n "$release"; then
2902 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2903 fi
2904 else
2905
2906 # Parse the version information argument.
2907 save_ifs="$IFS"; IFS=':'
2908 set dummy $vinfo 0 0 0
2909 IFS="$save_ifs"
2910
2911 if test -n "$8"; then
2912 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2913 $echo "$help" 1>&2
2914 exit 1
2915 fi
2916
2917 # convert absolute version numbers to libtool ages
2918 # this retains compatibility with .la files and attempts
2919 # to make the code below a bit more comprehensible
2920
2921 case $vinfo_number in
2922 yes)
2923 number_major="$2"
2924 number_minor="$3"
2925 number_revision="$4"
2926 #
2927 # There are really only two kinds -- those that
2928 # use the current revision as the major version
2929 # and those that subtract age and use age as
2930 # a minor version. But, then there is irix
2931 # which has an extra 1 added just for fun
2932 #
2933 case $version_type in
2934 darwin|linux|osf|windows)
2935 current=`expr $number_major + $number_minor`
2936 age="$number_minor"
2937 revision="$number_revision"
2938 ;;
2939 freebsd-aout|freebsd-elf|sunos)
2940 current="$number_major"
2941 revision="$number_minor"
2942 age="0"
2943 ;;
2944 irix|nonstopux)
2945 current=`expr $number_major + $number_minor - 1`
2946 age="$number_minor"
2947 revision="$number_minor"
2948 ;;
2949 esac
2950 ;;
2951 no)
2952 current="$2"
2953 revision="$3"
2954 age="$4"
2955 ;;
2956 esac
2957
2958 # Check that each of the things are valid numbers.
2959 case $current in
2960 [0-9]*) ;;
2961 *)
2962 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2963 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2964 exit 1
2965 ;;
2966 esac
2967
2968 case $revision in
2969 [0-9]*) ;;
2970 *)
2971 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2972 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2973 exit 1
2974 ;;
2975 esac
2976
2977 case $age in
2978 [0-9]*) ;;
2979 *)
2980 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2981 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2982 exit 1
2983 ;;
2984 esac
2985
2986 if test "$age" -gt "$current"; then
2987 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2988 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2989 exit 1
2990 fi
2991
2992 # Calculate the version variables.
2993 major=
2994 versuffix=
2995 verstring=
2996 case $version_type in
2997 none) ;;
2998
2999 darwin)
3000 # Like Linux, but with the current version available in
3001 # verstring for coding it into the library header
3002 major=.`expr $current - $age`
3003 versuffix="$major.$age.$revision"
3004 # Darwin ld doesn't like 0 for these options...
3005 minor_current=`expr $current + 1`
3006 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3007 ;;
3008
3009 freebsd-aout)
3010 major=".$current"
3011 versuffix=".$current.$revision";
3012 ;;
3013
3014 freebsd-elf)
3015 major=".$current"
3016 versuffix=".$current";
3017 ;;
3018
3019 irix | nonstopux)
3020 major=`expr $current - $age + 1`
3021
3022 case $version_type in
3023 nonstopux) verstring_prefix=nonstopux ;;
3024 *) verstring_prefix=sgi ;;
3025 esac
3026 verstring="$verstring_prefix$major.$revision"
3027
3028 # Add in all the interfaces that we are compatible with.
3029 loop=$revision
3030 while test "$loop" -ne 0; do
3031 iface=`expr $revision - $loop`
3032 loop=`expr $loop - 1`
3033 verstring="$verstring_prefix$major.$iface:$verstring"
3034 done
3035
3036 # Before this point, $major must not contain `.'.
3037 major=.$major
3038 versuffix="$major.$revision"
3039 ;;
3040
3041 linux)
3042 major=.`expr $current - $age`
3043 versuffix="$major.$age.$revision"
3044 ;;
3045
3046 osf)
3047 major=.`expr $current - $age`
3048 versuffix=".$current.$age.$revision"
3049 verstring="$current.$age.$revision"
3050
3051 # Add in all the interfaces that we are compatible with.
3052 loop=$age
3053 while test "$loop" -ne 0; do
3054 iface=`expr $current - $loop`
3055 loop=`expr $loop - 1`
3056 verstring="$verstring:${iface}.0"
3057 done
3058
3059 # Make executables depend on our current version.
3060 verstring="$verstring:${current}.0"
3061 ;;
3062
3063 sunos)
3064 major=".$current"
3065 versuffix=".$current.$revision"
3066 ;;
3067
3068 windows)
3069 # Use '-' rather than '.', since we only want one
3070 # extension on DOS 8.3 filesystems.
3071 major=`expr $current - $age`
3072 versuffix="-$major"
3073 ;;
3074
3075 *)
3076 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3077 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3078 exit 1
3079 ;;
3080 esac
3081
3082 # Clear the version info if we defaulted, and they specified a release.
3083 if test -z "$vinfo" && test -n "$release"; then
3084 major=
3085 case $version_type in
3086 darwin)
3087 # we can't check for "0.0" in archive_cmds due to quoting
3088 # problems, so we reset it completely
3089 verstring=
3090 ;;
3091 *)
3092 verstring="0.0"
3093 ;;
3094 esac
3095 if test "$need_version" = no; then
3096 versuffix=
3097 else
3098 versuffix=".0.0"
3099 fi
3100 fi
3101
3102 # Remove version info from name if versioning should be avoided
3103 if test "$avoid_version" = yes && test "$need_version" = no; then
3104 major=
3105 versuffix=
3106 verstring=""
3107 fi
3108
3109 # Check to see if the archive will have undefined symbols.
3110 if test "$allow_undefined" = yes; then
3111 if test "$allow_undefined_flag" = unsupported; then
3112 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3113 build_libtool_libs=no
3114 build_old_libs=yes
3115 fi
3116 else
3117 # Don't allow undefined symbols.
3118 allow_undefined_flag="$no_undefined_flag"
3119 fi
3120 fi
3121
3122 if test "$mode" != relink; then
3123 # Remove our outputs, but don't remove object files since they
3124 # may have been created when compiling PIC objects.
3125 removelist=
3126 tempremovelist=`$echo "$output_objdir/*"`
3127 for p in $tempremovelist; do
3128 case $p in
3129 *.$objext)
3130 ;;
3131 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3132 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3133 then
3134 continue
3135 fi
3136 removelist="$removelist $p"
3137 ;;
3138 *) ;;
3139 esac
3140 done
3141 if test -n "$removelist"; then
3142 $show "${rm}r $removelist"
3143 $run ${rm}r $removelist
3144 fi
3145 fi
3146
3147 # Now set the variables for building old libraries.
3148 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3149 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3150
3151 # Transform .lo files to .o files.
3152 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3153 fi
3154
3155 # Eliminate all temporary directories.
3156 for path in $notinst_path; do
3157 lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3158 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3159 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3160 done
3161
3162 if test -n "$xrpath"; then
3163 # If the user specified any rpath flags, then add them.
3164 temp_xrpath=
3165 for libdir in $xrpath; do
3166 temp_xrpath="$temp_xrpath -R$libdir"
3167 case "$finalize_rpath " in
3168 *" $libdir "*) ;;
3169 *) finalize_rpath="$finalize_rpath $libdir" ;;
3170 esac
3171 done
3172 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3173 dependency_libs="$temp_xrpath $dependency_libs"
3174 fi
3175 fi
3176
3177 # Make sure dlfiles contains only unique files that won't be dlpreopened
3178 old_dlfiles="$dlfiles"
3179 dlfiles=
3180 for lib in $old_dlfiles; do
3181 case " $dlprefiles $dlfiles " in
3182 *" $lib "*) ;;
3183 *) dlfiles="$dlfiles $lib" ;;
3184 esac
3185 done
3186
3187 # Make sure dlprefiles contains only unique files
3188 old_dlprefiles="$dlprefiles"
3189 dlprefiles=
3190 for lib in $old_dlprefiles; do
3191 case "$dlprefiles " in
3192 *" $lib "*) ;;
3193 *) dlprefiles="$dlprefiles $lib" ;;
3194 esac
3195 done
3196
3197 if test "$build_libtool_libs" = yes; then
3198 if test -n "$rpath"; then
3199 case $host in
3200 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3201 # these systems don't actually have a c library (as such)!
3202 ;;
3203 *-*-rhapsody* | *-*-darwin1.[012])
3204 # Rhapsody C library is in the System framework
3205 deplibs="$deplibs -framework System"
3206 ;;
3207 *-*-netbsd*)
3208 # Don't link with libc until the a.out ld.so is fixed.
3209 ;;
3210 *-*-openbsd* | *-*-freebsd*)
3211 # Do not include libc due to us having libc/libc_r.
3212 test "X$arg" = "X-lc" && continue
3213 ;;
3214 *)
3215 # Add libc to deplibs on all other systems if necessary.
3216 if test "$build_libtool_need_lc" = "yes"; then
3217 deplibs="$deplibs -lc"
3218 fi
3219 ;;
3220 esac
3221 fi
3222
3223 # Transform deplibs into only deplibs that can be linked in shared.
3224 name_save=$name
3225 libname_save=$libname
3226 release_save=$release
3227 versuffix_save=$versuffix
3228 major_save=$major
3229 # I'm not sure if I'm treating the release correctly. I think
3230 # release should show up in the -l (ie -lgmp5) so we don't want to
3231 # add it in twice. Is that correct?
3232 release=""
3233 versuffix=""
3234 major=""
3235 newdeplibs=
3236 droppeddeps=no
3237 case $deplibs_check_method in
3238 pass_all)
3239 # Don't check for shared/static. Everything works.
3240 # This might be a little naive. We might want to check
3241 # whether the library exists or not. But this is on
3242 # osf3 & osf4 and I'm not really sure... Just
3243 # implementing what was already the behavior.
3244 newdeplibs=$deplibs
3245 ;;
3246 test_compile)
3247 # This code stresses the "libraries are programs" paradigm to its
3248 # limits. Maybe even breaks it. We compile a program, linking it
3249 # against the deplibs as a proxy for the library. Then we can check
3250 # whether they linked in statically or dynamically with ldd.
3251 $rm conftest.c
3252 cat > conftest.c <<EOF
3253 int main() { return 0; }
3254 EOF
3255 $rm conftest
3256 $LTCC -o conftest conftest.c $deplibs
3257 if test "$?" -eq 0 ; then
3258 ldd_output=`ldd conftest`
3259 for i in $deplibs; do
3260 name="`expr $i : '-l\(.*\)'`"
3261 # If $name is empty we are operating on a -L argument.
3262 if test "$name" != "" && test "$name" -ne "0"; then
3263 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3264 case " $predeps $postdeps " in
3265 *" $i "*)
3266 newdeplibs="$newdeplibs $i"
3267 i=""
3268 ;;
3269 esac
3270 fi
3271 if test -n "$i" ; then
3272 libname=`eval \\$echo \"$libname_spec\"`
3273 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3274 set dummy $deplib_matches
3275 deplib_match=$2
3276 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3277 newdeplibs="$newdeplibs $i"
3278 else
3279 droppeddeps=yes
3280 $echo
3281 $echo "*** Warning: dynamic linker does not accept needed library $i."
3282 $echo "*** I have the capability to make that library automatically link in when"
3283 $echo "*** you link to this library. But I can only do this if you have a"
3284 $echo "*** shared version of the library, which I believe you do not have"
3285 $echo "*** because a test_compile did reveal that the linker did not use it for"
3286 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3287 fi
3288 fi
3289 else
3290 newdeplibs="$newdeplibs $i"
3291 fi
3292 done
3293 else
3294 # Error occurred in the first compile. Let's try to salvage
3295 # the situation: Compile a separate program for each library.
3296 for i in $deplibs; do
3297 name="`expr $i : '-l\(.*\)'`"
3298 # If $name is empty we are operating on a -L argument.
3299 if test "$name" != "" && test "$name" != "0"; then
3300 $rm conftest
3301 $LTCC -o conftest conftest.c $i
3302 # Did it work?
3303 if test "$?" -eq 0 ; then
3304 ldd_output=`ldd conftest`
3305 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3306 case " $predeps $postdeps " in
3307 *" $i "*)
3308 newdeplibs="$newdeplibs $i"
3309 i=""
3310 ;;
3311 esac
3312 fi
3313 if test -n "$i" ; then
3314 libname=`eval \\$echo \"$libname_spec\"`
3315 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3316 set dummy $deplib_matches
3317 deplib_match=$2
3318 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3319 newdeplibs="$newdeplibs $i"
3320 else
3321 droppeddeps=yes
3322 $echo
3323 $echo "*** Warning: dynamic linker does not accept needed library $i."
3324 $echo "*** I have the capability to make that library automatically link in when"
3325 $echo "*** you link to this library. But I can only do this if you have a"
3326 $echo "*** shared version of the library, which you do not appear to have"
3327 $echo "*** because a test_compile did reveal that the linker did not use this one"
3328 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3329 fi
3330 fi
3331 else
3332 droppeddeps=yes
3333 $echo
3334 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3335 $echo "*** make it link in! You will probably need to install it or some"
3336 $echo "*** library that it depends on before this library will be fully"
3337 $echo "*** functional. Installing it before continuing would be even better."
3338 fi
3339 else
3340 newdeplibs="$newdeplibs $i"
3341 fi
3342 done
3343 fi
3344 ;;
3345 file_magic*)
3346 set dummy $deplibs_check_method
3347 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3348 for a_deplib in $deplibs; do
3349 name="`expr $a_deplib : '-l\(.*\)'`"
3350 # If $name is empty we are operating on a -L argument.
3351 if test "$name" != "" && test "$name" != "0"; then
3352 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3353 case " $predeps $postdeps " in
3354 *" $a_deplib "*)
3355 newdeplibs="$newdeplibs $a_deplib"
3356 a_deplib=""
3357 ;;
3358 esac
3359 fi
3360 if test -n "$a_deplib" ; then
3361 libname=`eval \\$echo \"$libname_spec\"`
3362 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3363 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3364 for potent_lib in $potential_libs; do
3365 # Follow soft links.
3366 if ls -lLd "$potent_lib" 2>/dev/null \
3367 | grep " -> " >/dev/null; then
3368 continue
3369 fi
3370 # The statement above tries to avoid entering an
3371 # endless loop below, in case of cyclic links.
3372 # We might still enter an endless loop, since a link
3373 # loop can be closed while we follow links,
3374 # but so what?
3375 potlib="$potent_lib"
3376 while test -h "$potlib" 2>/dev/null; do
3377 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3378 case $potliblink in
3379 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3380 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3381 esac
3382 done
3383 # It is ok to link against an archive when
3384 # building a shared library.
3385 if $AR -t $potlib > /dev/null 2>&1; then
3386 newdeplibs="$newdeplibs $a_deplib"
3387 a_deplib=""
3388 break 2
3389 fi
3390 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3391 | ${SED} 10q \
3392 | $EGREP "$file_magic_regex" > /dev/null; then
3393 newdeplibs="$newdeplibs $a_deplib"
3394 a_deplib=""
3395 break 2
3396 fi
3397 done
3398 done
3399 fi
3400 if test -n "$a_deplib" ; then
3401 droppeddeps=yes
3402 $echo
3403 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3404 $echo "*** I have the capability to make that library automatically link in when"
3405 $echo "*** you link to this library. But I can only do this if you have a"
3406 $echo "*** shared version of the library, which you do not appear to have"
3407 $echo "*** because I did check the linker path looking for a file starting"
3408 if test -z "$potlib" ; then
3409 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3410 else
3411 $echo "*** with $libname and none of the candidates passed a file format test"
3412 $echo "*** using a file magic. Last file checked: $potlib"
3413 fi
3414 fi
3415 else
3416 # Add a -L argument.
3417 newdeplibs="$newdeplibs $a_deplib"
3418 fi
3419 done # Gone through all deplibs.
3420 ;;
3421 match_pattern*)
3422 set dummy $deplibs_check_method
3423 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3424 for a_deplib in $deplibs; do
3425 name="`expr $a_deplib : '-l\(.*\)'`"
3426 # If $name is empty we are operating on a -L argument.
3427 if test -n "$name" && test "$name" != "0"; then
3428 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3429 case " $predeps $postdeps " in
3430 *" $a_deplib "*)
3431 newdeplibs="$newdeplibs $a_deplib"
3432 a_deplib=""
3433 ;;
3434 esac
3435 fi
3436 if test -n "$a_deplib" ; then
3437 libname=`eval \\$echo \"$libname_spec\"`
3438 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3439 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3440 for potent_lib in $potential_libs; do
3441 potlib="$potent_lib" # see symlink-check above in file_magic test
3442 if eval $echo \"$potent_lib\" 2>/dev/null \
3443 | ${SED} 10q \
3444 | $EGREP "$match_pattern_regex" > /dev/null; then
3445 newdeplibs="$newdeplibs $a_deplib"
3446 a_deplib=""
3447 break 2
3448 fi
3449 done
3450 done
3451 fi
3452 if test -n "$a_deplib" ; then
3453 droppeddeps=yes
3454 $echo
3455 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3456 $echo "*** I have the capability to make that library automatically link in when"
3457 $echo "*** you link to this library. But I can only do this if you have a"
3458 $echo "*** shared version of the library, which you do not appear to have"
3459 $echo "*** because I did check the linker path looking for a file starting"
3460 if test -z "$potlib" ; then
3461 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3462 else
3463 $echo "*** with $libname and none of the candidates passed a file format test"
3464 $echo "*** using a regex pattern. Last file checked: $potlib"
3465 fi
3466 fi
3467 else
3468 # Add a -L argument.
3469 newdeplibs="$newdeplibs $a_deplib"
3470 fi
3471 done # Gone through all deplibs.
3472 ;;
3473 none | unknown | *)
3474 newdeplibs=""
3475 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3476 -e 's/ -[LR][^ ]*//g'`
3477 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3478 for i in $predeps $postdeps ; do
3479 # can't use Xsed below, because $i might contain '/'
3480 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3481 done
3482 fi
3483 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3484 | grep . >/dev/null; then
3485 $echo
3486 if test "X$deplibs_check_method" = "Xnone"; then
3487 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3488 else
3489 $echo "*** Warning: inter-library dependencies are not known to be supported."
3490 fi
3491 $echo "*** All declared inter-library dependencies are being dropped."
3492 droppeddeps=yes
3493 fi
3494 ;;
3495 esac
3496 versuffix=$versuffix_save
3497 major=$major_save
3498 release=$release_save
3499 libname=$libname_save
3500 name=$name_save
3501
3502 case $host in
3503 *-*-rhapsody* | *-*-darwin1.[012])
3504 # On Rhapsody replace the C library is the System framework
3505 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3506 ;;
3507 esac
3508
3509 if test "$droppeddeps" = yes; then
3510 if test "$module" = yes; then
3511 $echo
3512 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3513 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3514 $echo "*** a static module, that should work as long as the dlopening"
3515 $echo "*** application is linked with the -dlopen flag."
3516 if test -z "$global_symbol_pipe"; then
3517 $echo
3518 $echo "*** However, this would only work if libtool was able to extract symbol"
3519 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3520 $echo "*** not find such a program. So, this module is probably useless."
3521 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3522 fi
3523 if test "$build_old_libs" = no; then
3524 oldlibs="$output_objdir/$libname.$libext"
3525 build_libtool_libs=module
3526 build_old_libs=yes
3527 else
3528 build_libtool_libs=no
3529 fi
3530 else
3531 $echo "*** The inter-library dependencies that have been dropped here will be"
3532 $echo "*** automatically added whenever a program is linked with this library"
3533 $echo "*** or is declared to -dlopen it."
3534
3535 if test "$allow_undefined" = no; then
3536 $echo
3537 $echo "*** Since this library must not contain undefined symbols,"
3538 $echo "*** because either the platform does not support them or"
3539 $echo "*** it was explicitly requested with -no-undefined,"
3540 $echo "*** libtool will only create a static version of it."
3541 if test "$build_old_libs" = no; then
3542 oldlibs="$output_objdir/$libname.$libext"
3543 build_libtool_libs=module
3544 build_old_libs=yes
3545 else
3546 build_libtool_libs=no
3547 fi
3548 fi
3549 fi
3550 fi
3551 # Done checking deplibs!
3552 deplibs=$newdeplibs
3553 fi
3554
3555 # All the library-specific variables (install_libdir is set above).
3556 library_names=
3557 old_library=
3558 dlname=
3559
3560 # Test again, we may have decided not to build it any more
3561 if test "$build_libtool_libs" = yes; then
3562 if test "$hardcode_into_libs" = yes; then
3563 # Hardcode the library paths
3564 hardcode_libdirs=
3565 dep_rpath=
3566 rpath="$finalize_rpath"
3567 test "$mode" != relink && rpath="$compile_rpath$rpath"
3568 for libdir in $rpath; do
3569 if test -n "$hardcode_libdir_flag_spec"; then
3570 if test -n "$hardcode_libdir_separator"; then
3571 if test -z "$hardcode_libdirs"; then
3572 hardcode_libdirs="$libdir"
3573 else
3574 # Just accumulate the unique libdirs.
3575 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3576 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3577 ;;
3578 *)
3579 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3580 ;;
3581 esac
3582 fi
3583 else
3584 eval flag=\"$hardcode_libdir_flag_spec\"
3585 dep_rpath="$dep_rpath $flag"
3586 fi
3587 elif test -n "$runpath_var"; then
3588 case "$perm_rpath " in
3589 *" $libdir "*) ;;
3590 *) perm_rpath="$perm_rpath $libdir" ;;
3591 esac
3592 fi
3593 done
3594 # Substitute the hardcoded libdirs into the rpath.
3595 if test -n "$hardcode_libdir_separator" &&
3596 test -n "$hardcode_libdirs"; then
3597 libdir="$hardcode_libdirs"
3598 if test -n "$hardcode_libdir_flag_spec_ld"; then
3599 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3600 else
3601 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3602 fi
3603 fi
3604 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3605 # We should set the runpath_var.
3606 rpath=
3607 for dir in $perm_rpath; do
3608 rpath="$rpath$dir:"
3609 done
3610 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3611 fi
3612 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3613 fi
3614
3615 shlibpath="$finalize_shlibpath"
3616 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3617 if test -n "$shlibpath"; then
3618 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3619 fi
3620
3621 # Get the real and link names of the library.
3622 eval shared_ext=\"$shrext\"
3623 eval library_names=\"$library_names_spec\"
3624 set dummy $library_names
3625 realname="$2"
3626 shift; shift
3627
3628 if test -n "$soname_spec"; then
3629 eval soname=\"$soname_spec\"
3630 else
3631 soname="$realname"
3632 fi
3633 if test -z "$dlname"; then
3634 dlname=$soname
3635 fi
3636
3637 lib="$output_objdir/$realname"
3638 for link
3639 do
3640 linknames="$linknames $link"
3641 done
3642
3643 # Use standard objects if they are pic
3644 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3645
3646 # Prepare the list of exported symbols
3647 if test -z "$export_symbols"; then
3648 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3649 $show "generating symbol list for \`$libname.la'"
3650 export_symbols="$output_objdir/$libname.exp"
3651 $run $rm $export_symbols
3652 cmds=$export_symbols_cmds
3653 save_ifs="$IFS"; IFS='~'
3654 for cmd in $cmds; do
3655 IFS="$save_ifs"
3656 eval cmd=\"$cmd\"
3657 if len=`expr "X$cmd" : ".*"` &&
3658 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3659 $show "$cmd"
3660 $run eval "$cmd" || exit $?
3661 skipped_export=false
3662 else
3663 # The command line is too long to execute in one step.
3664 $show "using reloadable object file for export list..."
3665 skipped_export=:
3666 fi
3667 done
3668 IFS="$save_ifs"
3669 if test -n "$export_symbols_regex"; then
3670 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3671 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3672 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3673 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3674 fi
3675 fi
3676 fi
3677
3678 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3679 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3680 fi
3681
3682 tmp_deplibs=
3683 for test_deplib in $deplibs; do
3684 case " $convenience " in
3685 *" $test_deplib "*) ;;
3686 *)
3687 tmp_deplibs="$tmp_deplibs $test_deplib"
3688 ;;
3689 esac
3690 done
3691 deplibs="$tmp_deplibs"
3692
3693 if test -n "$convenience"; then
3694 if test -n "$whole_archive_flag_spec"; then
3695 save_libobjs=$libobjs
3696 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3697 else
3698 gentop="$output_objdir/${outputname}x"
3699 $show "${rm}r $gentop"
3700 $run ${rm}r "$gentop"
3701 $show "$mkdir $gentop"
3702 $run $mkdir "$gentop"
3703 status=$?
3704 if test "$status" -ne 0 && test ! -d "$gentop"; then
3705 exit $status
3706 fi
3707 generated="$generated $gentop"
3708
3709 for xlib in $convenience; do
3710 # Extract the objects.
3711 case $xlib in
3712 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3713 *) xabs=`pwd`"/$xlib" ;;
3714 esac
3715 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3716 xdir="$gentop/$xlib"
3717
3718 $show "${rm}r $xdir"
3719 $run ${rm}r "$xdir"
3720 $show "$mkdir $xdir"
3721 $run $mkdir "$xdir"
3722 status=$?
3723 if test "$status" -ne 0 && test ! -d "$xdir"; then
3724 exit $status
3725 fi
3726 # We will extract separately just the conflicting names and we will no
3727 # longer touch any unique names. It is faster to leave these extract
3728 # automatically by $AR in one run.
3729 $show "(cd $xdir && $AR x $xabs)"
3730 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3731 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3732 :
3733 else
3734 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3735 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3736 $AR t "$xabs" | sort | uniq -cd | while read -r count name
3737 do
3738 i=1
3739 while test "$i" -le "$count"
3740 do
3741 # Put our $i before any first dot (extension)
3742 # Never overwrite any file
3743 name_to="$name"
3744 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3745 do
3746 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3747 done
3748 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3749 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3750 i=`expr $i + 1`
3751 done
3752 done
3753 fi
3754
3755 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3756 done
3757 fi
3758 fi
3759
3760 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3761 eval flag=\"$thread_safe_flag_spec\"
3762 linker_flags="$linker_flags $flag"
3763 fi
3764
3765 # Make a backup of the uninstalled library when relinking
3766 if test "$mode" = relink; then
3767 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3768 fi
3769
3770 # Do each of the archive commands.
3771 if test "$module" = yes && test -n "$module_cmds" ; then
3772 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3773 eval test_cmds=\"$module_expsym_cmds\"
3774 cmds=$module_expsym_cmds
3775 else
3776 eval test_cmds=\"$module_cmds\"
3777 cmds=$module_cmds
3778 fi
3779 else
3780 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3781 eval test_cmds=\"$archive_expsym_cmds\"
3782 cmds=$archive_expsym_cmds
3783 else
3784 eval test_cmds=\"$archive_cmds\"
3785 cmds=$archive_cmds
3786 fi
3787 fi
3788
3789 if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
3790 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3791 :
3792 else
3793 # The command line is too long to link in one step, link piecewise.
3794 $echo "creating reloadable object files..."
3795
3796 # Save the value of $output and $libobjs because we want to
3797 # use them later. If we have whole_archive_flag_spec, we
3798 # want to use save_libobjs as it was before
3799 # whole_archive_flag_spec was expanded, because we can't
3800 # assume the linker understands whole_archive_flag_spec.
3801 # This may have to be revisited, in case too many
3802 # convenience libraries get linked in and end up exceeding
3803 # the spec.
3804 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3805 save_libobjs=$libobjs
3806 fi
3807 save_output=$output
3808
3809 # Clear the reloadable object creation command queue and
3810 # initialize k to one.
3811 test_cmds=
3812 concat_cmds=
3813 objlist=
3814 delfiles=
3815 last_robj=
3816 k=1
3817 output=$output_objdir/$save_output-${k}.$objext
3818 # Loop over the list of objects to be linked.
3819 for obj in $save_libobjs
3820 do
3821 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3822 if test "X$objlist" = X ||
3823 { len=`expr "X$test_cmds" : ".*"` &&
3824 test "$len" -le "$max_cmd_len"; }; then
3825 objlist="$objlist $obj"
3826 else
3827 # The command $test_cmds is almost too long, add a
3828 # command to the queue.
3829 if test "$k" -eq 1 ; then
3830 # The first file doesn't have a previous command to add.
3831 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3832 else
3833 # All subsequent reloadable object files will link in
3834 # the last one created.
3835 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3836 fi
3837 last_robj=$output_objdir/$save_output-${k}.$objext
3838 k=`expr $k + 1`
3839 output=$output_objdir/$save_output-${k}.$objext
3840 objlist=$obj
3841 len=1
3842 fi
3843 done
3844 # Handle the remaining objects by creating one last
3845 # reloadable object file. All subsequent reloadable object
3846 # files will link in the last one created.
3847 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3848 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3849
3850 if ${skipped_export-false}; then
3851 $show "generating symbol list for \`$libname.la'"
3852 export_symbols="$output_objdir/$libname.exp"
3853 $run $rm $export_symbols
3854 libobjs=$output
3855 # Append the command to create the export file.
3856 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3857 fi
3858
3859 # Set up a command to remove the reloadale object files
3860 # after they are used.
3861 i=0
3862 while test "$i" -lt "$k"
3863 do
3864 i=`expr $i + 1`
3865 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3866 done
3867
3868 $echo "creating a temporary reloadable object file: $output"
3869
3870 # Loop through the commands generated above and execute them.
3871 save_ifs="$IFS"; IFS='~'
3872 for cmd in $concat_cmds; do
3873 IFS="$save_ifs"
3874 eval cmd=\"$cmd\"
3875 $show "$cmd"
3876 $run eval "$cmd" || exit $?
3877 done
3878 IFS="$save_ifs"
3879
3880 libobjs=$output
3881 # Restore the value of output.
3882 output=$save_output
3883
3884 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3885 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3886 fi
3887 # Expand the library linking commands again to reset the
3888 # value of $libobjs for piecewise linking.
3889
3890 # Do each of the archive commands.
3891 if test "$module" = yes && test -n "$module_cmds" ; then
3892 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3893 cmds=$module_expsym_cmds
3894 else
3895 cmds=$module_cmds
3896 fi
3897 else
3898 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3899 cmds=$archive_expsym_cmds
3900 else
3901 cmds=$archive_cmds
3902 fi
3903 fi
3904
3905 # Append the command to remove the reloadable object files
3906 # to the just-reset $cmds.
3907 eval cmds=\"\$cmds~\$rm $delfiles\"
3908 fi
3909 save_ifs="$IFS"; IFS='~'
3910 for cmd in $cmds; do
3911 IFS="$save_ifs"
3912 eval cmd=\"$cmd\"
3913 $show "$cmd"
3914 $run eval "$cmd" || exit $?
3915 done
3916 IFS="$save_ifs"
3917
3918 # Restore the uninstalled library and exit
3919 if test "$mode" = relink; then
3920 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3921 exit 0
3922 fi
3923
3924 # Create links to the real library.
3925 for linkname in $linknames; do
3926 if test "$realname" != "$linkname"; then
3927 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3928 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3929 fi
3930 done
3931
3932 # If -module or -export-dynamic was specified, set the dlname.
3933 if test "$module" = yes || test "$export_dynamic" = yes; then
3934 # On all known operating systems, these are identical.
3935 dlname="$soname"
3936 fi
3937 fi
3938 ;;
3939
3940 obj)
3941 if test -n "$deplibs"; then
3942 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3943 fi
3944
3945 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3946 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3947 fi
3948
3949 if test -n "$rpath"; then
3950 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3951 fi
3952
3953 if test -n "$xrpath"; then
3954 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3955 fi
3956
3957 if test -n "$vinfo"; then
3958 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3959 fi
3960
3961 if test -n "$release"; then
3962 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3963 fi
3964
3965 case $output in
3966 *.lo)
3967 if test -n "$objs$old_deplibs"; then
3968 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3969 exit 1
3970 fi
3971 libobj="$output"
3972 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3973 ;;
3974 *)
3975 libobj=
3976 obj="$output"
3977 ;;
3978 esac
3979
3980 # Delete the old objects.
3981 $run $rm $obj $libobj
3982
3983 # Objects from convenience libraries. This assumes
3984 # single-version convenience libraries. Whenever we create
3985 # different ones for PIC/non-PIC, this we'll have to duplicate
3986 # the extraction.
3987 reload_conv_objs=
3988 gentop=
3989 # reload_cmds runs $LD directly, so let us get rid of
3990 # -Wl from whole_archive_flag_spec
3991 wl=
3992
3993 if test -n "$convenience"; then
3994 if test -n "$whole_archive_flag_spec"; then
3995 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3996 else
3997 gentop="$output_objdir/${obj}x"
3998 $show "${rm}r $gentop"
3999 $run ${rm}r "$gentop"
4000 $show "$mkdir $gentop"
4001 $run $mkdir "$gentop"
4002 status=$?
4003 if test "$status" -ne 0 && test ! -d "$gentop"; then
4004 exit $status
4005 fi
4006 generated="$generated $gentop"
4007
4008 for xlib in $convenience; do
4009 # Extract the objects.
4010 case $xlib in
4011 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4012 *) xabs=`pwd`"/$xlib" ;;
4013 esac
4014 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4015 xdir="$gentop/$xlib"
4016
4017 $show "${rm}r $xdir"
4018 $run ${rm}r "$xdir"
4019 $show "$mkdir $xdir"
4020 $run $mkdir "$xdir"
4021 status=$?
4022 if test "$status" -ne 0 && test ! -d "$xdir"; then
4023 exit $status
4024 fi
4025 # We will extract separately just the conflicting names and we will no
4026 # longer touch any unique names. It is faster to leave these extract
4027 # automatically by $AR in one run.
4028 $show "(cd $xdir && $AR x $xabs)"
4029 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4030 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4031 :
4032 else
4033 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4034 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4035 $AR t "$xabs" | sort | uniq -cd | while read -r count name
4036 do
4037 i=1
4038 while test "$i" -le "$count"
4039 do
4040 # Put our $i before any first dot (extension)
4041 # Never overwrite any file
4042 name_to="$name"
4043 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4044 do
4045 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4046 done
4047 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4048 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4049 i=`expr $i + 1`
4050 done
4051