]> git.ipfire.org Git - thirdparty/gcc.git/blob - ltmain.sh
* ltconfig, ltmain.sh: Upgrade to libtool 1.4a 1.641.2.256.
[thirdparty/gcc.git] / ltmain.sh
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
3 #
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
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 # The name of this program.
52 progname=`$echo "$0" | sed 's%^.*/%%'`
53 modename="$progname"
54
55 # Constants.
56 PROGRAM=ltmain.sh
57 PACKAGE=libtool
58 VERSION=1.4a
59 TIMESTAMP=" (1.641.2.256 2001/05/28 20:09:07)"
60
61 default_mode=
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
64 mkdir="mkdir"
65 mv="mv -f"
66 rm="rm -f"
67
68 # Sed substitution that helps us do robust quoting. It backslashifies
69 # metacharacters that are still active within double-quoted strings.
70 Xsed='sed -e 1s/^X//'
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72 SP2NL='tr \040 \012'
73 NL2SP='tr \015\012 \040\040'
74
75 # NLS nuisances.
76 # Only set LANG and LC_ALL to C if already set.
77 # These must not be set unconditionally because not all systems understand
78 # e.g. LANG=C (notably SCO).
79 # We save the old values to restore during execute mode.
80 if test "${LC_ALL+set}" = set; then
81 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
82 fi
83 if test "${LANG+set}" = set; then
84 save_LANG="$LANG"; LANG=C; export LANG
85 fi
86
87 if test "$LTCONFIG_VERSION" != "$VERSION"; then
88 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
89 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
90 exit 1
91 fi
92
93 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
94 echo "$modename: not configured to build any kind of library" 1>&2
95 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
96 exit 1
97 fi
98
99 # Global variables.
100 mode=$default_mode
101 nonopt=
102 prev=
103 prevopt=
104 run=
105 show="$echo"
106 show_help=
107 execute_dlfiles=
108 lo2o="s/\\.lo\$/.${objext}/"
109 o2lo="s/\\.${objext}\$/.lo/"
110
111 # Parse our command line options once, thoroughly.
112 while test $# -gt 0
113 do
114 arg="$1"
115 shift
116
117 case $arg in
118 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
119 *) optarg= ;;
120 esac
121
122 # If the previous option needs an argument, assign it.
123 if test -n "$prev"; then
124 case $prev in
125 execute_dlfiles)
126 execute_dlfiles="$execute_dlfiles $arg"
127 ;;
128 tag)
129 tagname="$arg"
130
131 # Check whether tagname contains only valid characters
132 case $tagname in
133 *[!-_A-Za-z0-9,/]*)
134 echo "$progname: invalid tag name: $tagname" 1>&2
135 exit 1
136 ;;
137 esac
138
139 case $tagname in
140 CC)
141 # Don't test for the "default" C tag, as we know, it's there, but
142 # not specially marked.
143 ;;
144 *)
145 if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
146 taglist="$taglist $tagname"
147 # Evaluate the configuration.
148 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
149 else
150 echo "$progname: ignoring unknown tag $tagname" 1>&2
151 fi
152 ;;
153 esac
154 ;;
155 *)
156 eval "$prev=\$arg"
157 ;;
158 esac
159
160 prev=
161 prevopt=
162 continue
163 fi
164
165 # Have we seen a non-optional argument yet?
166 case $arg in
167 --help)
168 show_help=yes
169 ;;
170
171 --version)
172 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
173 exit 0
174 ;;
175
176 --config)
177 sed -n -e '/^### BEGIN LIBTOOL CONFIG/,/^### END LIBTOOL CONFIG/p' < "$0"
178 # Now print the configurations for the tags.
179 for tagname in $taglist; do
180 sed -n -e "/^### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
181 done
182 exit 0
183 ;;
184
185 --debug)
186 echo "$progname: enabling shell trace mode"
187 set -x
188 ;;
189
190 --dry-run | -n)
191 run=:
192 ;;
193
194 --features)
195 echo "host: $host"
196 if test "$build_libtool_libs" = yes; then
197 echo "enable shared libraries"
198 else
199 echo "disable shared libraries"
200 fi
201 if test "$build_old_libs" = yes; then
202 echo "enable static libraries"
203 else
204 echo "disable static libraries"
205 fi
206 exit 0
207 ;;
208
209 --finish) mode="finish" ;;
210
211 --mode) prevopt="--mode" prev=mode ;;
212 --mode=*) mode="$optarg" ;;
213
214 --quiet | --silent)
215 show=:
216 ;;
217
218 --tag) prevopt="--tag" prev=tag ;;
219 --tag=*)
220 set tag "$optarg" ${1+"$@"}
221 shift
222 prev=tag
223 ;;
224
225 -dlopen)
226 prevopt="-dlopen"
227 prev=execute_dlfiles
228 ;;
229
230 -*)
231 $echo "$modename: unrecognized option \`$arg'" 1>&2
232 $echo "$help" 1>&2
233 exit 1
234 ;;
235
236 *)
237 nonopt="$arg"
238 break
239 ;;
240 esac
241 done
242
243 if test -n "$prevopt"; then
244 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
245 $echo "$help" 1>&2
246 exit 1
247 fi
248
249 # If this variable is set in any of the actions, the command in it
250 # will be execed at the end. This prevents here-documents from being
251 # left over by shells.
252 exec_cmd=
253
254 if test -z "$show_help"; then
255
256 # Infer the operation mode.
257 if test -z "$mode"; then
258 case $nonopt in
259 *cc | *++ | gcc* | *-gcc*)
260 mode=link
261 for arg
262 do
263 case $arg in
264 -c)
265 mode=compile
266 break
267 ;;
268 esac
269 done
270 ;;
271 *db | *dbx | *strace | *truss)
272 mode=execute
273 ;;
274 *install*|cp|mv)
275 mode=install
276 ;;
277 *rm)
278 mode=uninstall
279 ;;
280 *)
281 # If we have no mode, but dlfiles were specified, then do execute mode.
282 test -n "$execute_dlfiles" && mode=execute
283
284 # Just use the default operation mode.
285 if test -z "$mode"; then
286 if test -n "$nonopt"; then
287 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
288 else
289 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
290 fi
291 fi
292 ;;
293 esac
294 fi
295
296 # Only execute mode is allowed to have -dlopen flags.
297 if test -n "$execute_dlfiles" && test "$mode" != execute; then
298 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
299 $echo "$help" 1>&2
300 exit 1
301 fi
302
303 # Change the help message to a mode-specific one.
304 generic_help="$help"
305 help="Try \`$modename --help --mode=$mode' for more information."
306
307 # These modes are in order of execution frequency so that they run quickly.
308 case $mode in
309 # libtool compile mode
310 compile)
311 modename="$modename: compile"
312 # Get the compilation command and the source file.
313 base_compile=
314 prev=
315 lastarg=
316 srcfile="$nonopt"
317 suppress_output=
318
319 user_target=no
320 for arg
321 do
322 case $prev in
323 "") ;;
324 xcompiler)
325 # Aesthetically quote the previous argument.
326 prev=
327 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
328
329 case $arg in
330 # Double-quote args containing other shell metacharacters.
331 # Many Bourne shells cannot handle close brackets correctly
332 # in scan sets, so we specify it separately.
333 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
334 arg="\"$arg\""
335 ;;
336 esac
337
338 # Add the previous argument to base_compile.
339 if test -z "$base_compile"; then
340 base_compile="$lastarg"
341 else
342 base_compile="$base_compile $lastarg"
343 fi
344 continue
345 ;;
346 esac
347
348 # Accept any command-line options.
349 case $arg in
350 -o)
351 if test "$user_target" != "no"; then
352 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
353 exit 1
354 fi
355 user_target=next
356 ;;
357
358 -static)
359 build_old_libs=yes
360 continue
361 ;;
362
363 -prefer-pic)
364 pic_mode=yes
365 continue
366 ;;
367
368 -prefer-non-pic)
369 pic_mode=no
370 continue
371 ;;
372
373 -Xcompiler)
374 prev=xcompiler
375 continue
376 ;;
377
378 -Wc,*)
379 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
380 lastarg=
381 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
382 for arg in $args; do
383 IFS="$save_ifs"
384
385 # Double-quote args containing other shell metacharacters.
386 # Many Bourne shells cannot handle close brackets correctly
387 # in scan sets, so we specify it separately.
388 case $arg in
389 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
390 arg="\"$arg\""
391 ;;
392 esac
393 lastarg="$lastarg $arg"
394 done
395 IFS="$save_ifs"
396 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
397
398 # Add the arguments to base_compile.
399 if test -z "$base_compile"; then
400 base_compile="$lastarg"
401 else
402 base_compile="$base_compile $lastarg"
403 fi
404 continue
405 ;;
406 esac
407
408 case $user_target in
409 next)
410 # The next one is the -o target name
411 user_target=yes
412 continue
413 ;;
414 yes)
415 # We got the output file
416 user_target=set
417 libobj="$arg"
418 continue
419 ;;
420 esac
421
422 # Accept the current argument as the source file.
423 lastarg="$srcfile"
424 srcfile="$arg"
425
426 # Aesthetically quote the previous argument.
427
428 # Backslashify any backslashes, double quotes, and dollar signs.
429 # These are the only characters that are still specially
430 # interpreted inside of double-quoted scrings.
431 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
432
433 # Double-quote args containing other shell metacharacters.
434 # Many Bourne shells cannot handle close brackets correctly
435 # in scan sets, so we specify it separately.
436 case $lastarg in
437 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
438 lastarg="\"$lastarg\""
439 ;;
440 esac
441
442 # Add the previous argument to base_compile.
443 if test -z "$base_compile"; then
444 base_compile="$lastarg"
445 else
446 base_compile="$base_compile $lastarg"
447 fi
448 done
449
450 case $user_target in
451 set)
452 ;;
453 no)
454 # Get the name of the library object.
455 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
456 ;;
457 *)
458 $echo "$modename: you must specify a target with \`-o'" 1>&2
459 exit 1
460 ;;
461 esac
462
463 # Recognize several different file suffixes.
464 # If the user specifies -o file.o, it is replaced with file.lo
465 xform='[cCFSfmso]'
466 case $libobj in
467 *.ada) xform=ada ;;
468 *.adb) xform=adb ;;
469 *.ads) xform=ads ;;
470 *.asm) xform=asm ;;
471 *.c++) xform=c++ ;;
472 *.cc) xform=cc ;;
473 *.class) xform=class ;;
474 *.cpp) xform=cpp ;;
475 *.cxx) xform=cxx ;;
476 *.f90) xform=f90 ;;
477 *.for) xform=for ;;
478 *.java) xform=java ;;
479 esac
480
481 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
482
483 case $libobj in
484 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
485 *)
486 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
487 exit 1
488 ;;
489 esac
490
491 # Infer tagged configuration to use if any are available and
492 # if one wasn't chosen via the "--tag" command line option.
493 # Only attempt this if the compiler in the base compile
494 # command doesn't match the default compiler.
495 if test -n "$available_tags" && test -z "$tagname"; then
496 case $base_compile in
497 "$CC "*) ;;
498 # Blanks in the command may have been stripped by the calling shell,
499 # but not from the CC environment variable when ltconfig was run.
500 "`$echo $CC` "*) ;;
501 *)
502 for z in $available_tags; do
503 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
504 # Evaluate the configuration.
505 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
506 case $base_compile in
507 "$CC "*)
508 # The compiler in the base compile command matches
509 # the one in the tagged configuration.
510 # Assume this is the tagged configuration we want.
511 tagname=$z
512 break
513 ;;
514 "`$echo $CC` "*)
515 tagname=$z
516 break
517 ;;
518 esac
519 fi
520 done
521 # If $tagname still isn't set, then no tagged configuration
522 # was found and let the user know that the "--tag" command
523 # line option must be used.
524 if test -z "$tagname"; then
525 echo "$modename: unable to infer tagged configuration"
526 echo "$modename: specify a tag with \`--tag'" 1>&2
527 exit 1
528 # else
529 # echo "$modename: using $tagname tagged configuration"
530 fi
531 ;;
532 esac
533 fi
534
535 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
536 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
537 if test "X$xdir" = "X$obj"; then
538 xdir=
539 else
540 xdir=$xdir/
541 fi
542 lobj=${xdir}$objdir/$objname
543
544 if test -z "$base_compile"; then
545 $echo "$modename: you must specify a compilation command" 1>&2
546 $echo "$help" 1>&2
547 exit 1
548 fi
549
550 # Delete any leftover library objects.
551 if test "$build_old_libs" = yes; then
552 removelist="$obj $lobj $libobj ${libobj}T"
553 else
554 removelist="$lobj $libobj ${libobj}T"
555 fi
556
557 $run $rm $removelist
558 trap "$run $rm $removelist; exit 1" 1 2 15
559
560 # On Cygwin there's no "real" PIC flag so we must build both object types
561 case $host_os in
562 cygwin* | mingw* | pw32* | os2*)
563 pic_mode=default
564 ;;
565 esac
566 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
567 # non-PIC code in shared libraries is not supported
568 pic_mode=default
569 fi
570
571 # Calculate the filename of the output object if compiler does
572 # not support -o with -c
573 if test "$compiler_c_o" = no; then
574 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
575 lockfile="$output_obj.lock"
576 removelist="$removelist $output_obj $lockfile"
577 trap "$run $rm $removelist; exit 1" 1 2 15
578 else
579 output_obj=
580 need_locks=no
581 lockfile=
582 fi
583
584 # Lock this critical section if it is needed
585 # We use this script file to make the link, it avoids creating a new file
586 if test "$need_locks" = yes; then
587 until $run ln "$0" "$lockfile" 2>/dev/null; do
588 $show "Waiting for $lockfile to be removed"
589 sleep 2
590 done
591 elif test "$need_locks" = warn; then
592 if test -f "$lockfile"; then
593 echo "\
594 *** ERROR, $lockfile exists and contains:
595 `cat $lockfile 2>/dev/null`
596
597 This indicates that another process is trying to use the same
598 temporary object file, and libtool could not work around it because
599 your compiler does not support \`-c' and \`-o' together. If you
600 repeat this compilation, it may succeed, by chance, but you had better
601 avoid parallel builds (make -j) in this platform, or get a better
602 compiler."
603
604 $run $rm $removelist
605 exit 1
606 fi
607 echo $srcfile > "$lockfile"
608 fi
609
610 if test -n "$fix_srcfile_path"; then
611 eval srcfile=\"$fix_srcfile_path\"
612 fi
613
614 $run $rm "$libobj" "${libobj}T"
615
616 # Create a libtool object file (analogous to a ".la" file),
617 # but don't create it if we're doing a dry run.
618 test -z "$run" && cat > ${libobj}T <<EOF
619 # $libobj - a libtool object file
620 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
621 #
622 # Please DO NOT delete this file!
623 # It is necessary for linking the library.
624
625 # Name of the PIC object.
626 EOF
627
628 # Only build a PIC object if we are building libtool libraries.
629 if test "$build_libtool_libs" = yes; then
630 # Without this assignment, base_compile gets emptied.
631 fbsd_hideous_sh_bug=$base_compile
632
633 if test "$pic_mode" != no; then
634 command="$base_compile $srcfile $pic_flag"
635 else
636 # Don't build PIC code
637 command="$base_compile $srcfile"
638 fi
639
640 if test ! -d ${xdir}$objdir; then
641 $show "$mkdir ${xdir}$objdir"
642 $run $mkdir ${xdir}$objdir
643 status=$?
644 if test $status -ne 0 && test ! -d ${xdir}$objdir; then
645 exit $status
646 fi
647 fi
648
649 if test -z "$output_obj"; then
650 # Place PIC objects in $objdir
651 command="$command -o $lobj"
652 fi
653
654 $run $rm "$lobj" "$output_obj"
655
656 $show "$command"
657 if $run eval "$command"; then :
658 else
659 test -n "$output_obj" && $run $rm $removelist
660 exit 1
661 fi
662
663 if test "$need_locks" = warn &&
664 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
665 echo "\
666 *** ERROR, $lockfile contains:
667 `cat $lockfile 2>/dev/null`
668
669 but it should contain:
670 $srcfile
671
672 This indicates that another process is trying to use the same
673 temporary object file, and libtool could not work around it because
674 your compiler does not support \`-c' and \`-o' together. If you
675 repeat this compilation, it may succeed, by chance, but you had better
676 avoid parallel builds (make -j) in this platform, or get a better
677 compiler."
678
679 $run $rm $removelist
680 exit 1
681 fi
682
683 # Just move the object if needed, then go on to compile the next one
684 if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then
685 $show "$mv $output_obj $lobj"
686 if $run $mv $output_obj $lobj; then :
687 else
688 error=$?
689 $run $rm $removelist
690 exit $error
691 fi
692 fi
693
694 # Append the name of the PIC object to the libtool object file.
695 test -z "$run" && cat >> ${libobj}T <<EOF
696 pic_object='$objdir/$objname'
697
698 EOF
699
700 # Allow error messages only from the first compilation.
701 suppress_output=' >/dev/null 2>&1'
702 else
703 # No PIC object so indicate it doesn't exist in the libtool
704 # object file.
705 test -z "$run" && cat >> ${libobj}T <<EOF
706 pic_object=none
707
708 EOF
709 fi
710
711 # Only build a position-dependent object if we build old libraries.
712 if test "$build_old_libs" = yes; then
713 if test "$pic_mode" != yes; then
714 # Don't build PIC code
715 command="$base_compile $srcfile"
716 else
717 command="$base_compile $srcfile $pic_flag"
718 fi
719 if test "$compiler_c_o" = yes; then
720 command="$command -o $obj"
721 fi
722
723 # Suppress compiler output if we already did a PIC compilation.
724 command="$command$suppress_output"
725 $run $rm "$obj" "$output_obj"
726 $show "$command"
727 if $run eval "$command"; then :
728 else
729 $run $rm $removelist
730 exit 1
731 fi
732
733 if test "$need_locks" = warn &&
734 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
735 echo "\
736 *** ERROR, $lockfile contains:
737 `cat $lockfile 2>/dev/null`
738
739 but it should contain:
740 $srcfile
741
742 This indicates that another process is trying to use the same
743 temporary object file, and libtool could not work around it because
744 your compiler does not support \`-c' and \`-o' together. If you
745 repeat this compilation, it may succeed, by chance, but you had better
746 avoid parallel builds (make -j) in this platform, or get a better
747 compiler."
748
749 $run $rm $removelist
750 exit 1
751 fi
752
753 # Just move the object if needed
754 if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then
755 $show "$mv $output_obj $obj"
756 if $run $mv $output_obj $obj; then :
757 else
758 error=$?
759 $run $rm $removelist
760 exit $error
761 fi
762 fi
763
764 # Append the name of the non-PIC object the libtool object file.
765 # Only append if the libtool object file exists.
766 test -z "$run" && cat >> ${libobj}T <<EOF
767 # Name of the non-PIC object.
768 non_pic_object='$objname'
769
770 EOF
771 else
772 # Append the name of the non-PIC object the libtool object file.
773 # Only append if the libtool object file exists.
774 test -z "$run" && cat >> ${libobj}T <<EOF
775 # Name of the non-PIC object.
776 non_pic_object=none
777
778 EOF
779 fi
780
781 $run $mv "${libobj}T" "${libobj}"
782
783 # Unlock the critical section if it was locked
784 if test "$need_locks" != no; then
785 $run $rm "$lockfile"
786 fi
787
788 exit 0
789 ;;
790
791 # libtool link mode
792 link | relink)
793 modename="$modename: link"
794 case $host in
795 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
796 # It is impossible to link a dll without this setting, and
797 # we shouldn't force the makefile maintainer to figure out
798 # which system we are compiling for in order to pass an extra
799 # flag for every libtool invokation.
800 # allow_undefined=no
801
802 # FIXME: Unfortunately, there are problems with the above when trying
803 # to make a dll which has undefined symbols, in which case not
804 # even a static library is built. For now, we need to specify
805 # -no-undefined on the libtool link line when we can be certain
806 # that all symbols are satisfied, otherwise we get a static library.
807 allow_undefined=yes
808 ;;
809 *)
810 allow_undefined=yes
811 ;;
812 esac
813 libtool_args="$nonopt"
814 base_compile="$nonopt"
815 compile_command="$nonopt"
816 finalize_command="$nonopt"
817
818 compile_rpath=
819 finalize_rpath=
820 compile_shlibpath=
821 finalize_shlibpath=
822 convenience=
823 old_convenience=
824 deplibs=
825 old_deplibs=
826 compiler_flags=
827 linker_flags=
828 dllsearchpath=
829 lib_search_path=`pwd`
830
831 avoid_version=no
832 dlfiles=
833 dlprefiles=
834 dlself=no
835 export_dynamic=no
836 export_symbols=
837 export_symbols_regex=
838 generated=
839 libobjs=
840 ltlibs=
841 module=no
842 no_install=no
843 objs=
844 non_pic_objects=
845 prefer_static_libs=no
846 preload=no
847 prev=
848 prevarg=
849 release=
850 rpath=
851 xrpath=
852 perm_rpath=
853 temp_rpath=
854 thread_safe=no
855 vinfo=
856
857 # We need to know -static, to get the right output filenames.
858 for arg
859 do
860 case $arg in
861 -all-static | -static)
862 if test "X$arg" = "X-all-static"; then
863 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
864 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
865 fi
866 if test -n "$link_static_flag"; then
867 dlopen_self=$dlopen_self_static
868 fi
869 else
870 if test -z "$pic_flag" && test -n "$link_static_flag"; then
871 dlopen_self=$dlopen_self_static
872 fi
873 fi
874 build_libtool_libs=no
875 build_old_libs=yes
876 prefer_static_libs=yes
877 break
878 ;;
879 esac
880 done
881
882 # See if our shared archives depend on static archives.
883 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
884
885 # Go through the arguments, transforming them on the way.
886 while test $# -gt 0; do
887 arg="$1"
888 base_compile="$base_compile $arg"
889 shift
890 case $arg in
891 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
892 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
893 ;;
894 *) qarg=$arg ;;
895 esac
896 libtool_args="$libtool_args $qarg"
897
898 # If the previous option needs an argument, assign it.
899 if test -n "$prev"; then
900 case $prev in
901 output)
902 compile_command="$compile_command @OUTPUT@"
903 finalize_command="$finalize_command @OUTPUT@"
904 ;;
905 esac
906
907 case $prev in
908 dlfiles|dlprefiles)
909 if test "$preload" = no; then
910 # Add the symbol object into the linking commands.
911 compile_command="$compile_command @SYMFILE@"
912 finalize_command="$finalize_command @SYMFILE@"
913 preload=yes
914 fi
915 case $arg in
916 *.la | *.lo) ;; # We handle these cases below.
917 force)
918 if test "$dlself" = no; then
919 dlself=needless
920 export_dynamic=yes
921 fi
922 prev=
923 continue
924 ;;
925 self)
926 if test "$prev" = dlprefiles; then
927 dlself=yes
928 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
929 dlself=yes
930 else
931 dlself=needless
932 export_dynamic=yes
933 fi
934 prev=
935 continue
936 ;;
937 *)
938 if test "$prev" = dlfiles; then
939 dlfiles="$dlfiles $arg"
940 else
941 dlprefiles="$dlprefiles $arg"
942 fi
943 prev=
944 continue
945 ;;
946 esac
947 ;;
948 expsyms)
949 export_symbols="$arg"
950 if test ! -f "$arg"; then
951 $echo "$modename: symbol file \`$arg' does not exist"
952 exit 1
953 fi
954 prev=
955 continue
956 ;;
957 expsyms_regex)
958 export_symbols_regex="$arg"
959 prev=
960 continue
961 ;;
962 release)
963 release="-$arg"
964 prev=
965 continue
966 ;;
967 objectlist)
968 if test -f "$arg"; then
969 save_arg=$arg
970 moreargs=
971 for fil in `cat $save_arg`
972 do
973 # moreargs="$moreargs $fil"
974 arg=$fil
975 # A libtool-controlled object.
976
977 # Check to see that this really is a libtool object.
978 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
979 pic_object=
980 non_pic_object=
981
982 # Read the .lo file
983 # If there is no directory component, then add one.
984 case $arg in
985 */* | *\\*) . $arg ;;
986 *) . ./$arg ;;
987 esac
988
989 if test -z "$pic_object" || \
990 test -z "$non_pic_object" ||
991 test "$pic_object" = none && \
992 test "$non_pic_object" = none; then
993 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
994 exit 1
995 fi
996
997 # Extract subdirectory from the argument.
998 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
999 if test "X$xdir" = "X$arg"; then
1000 xdir=
1001 else
1002 xdir="$xdir/"
1003 fi
1004
1005 if test "$pic_object" != none; then
1006 # Prepend the subdirectory the object is found in.
1007 pic_object="$xdir$pic_object"
1008
1009 if test "$prev" = dlfiles; then
1010 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1011 dlfiles="$dlfiles $pic_object"
1012 prev=
1013 continue
1014 else
1015 # If libtool objects are unsupported, then we need to preload.
1016 prev=dlprefiles
1017 fi
1018 fi
1019
1020 # CHECK ME: I think I busted this. -Ossama
1021 if test "$prev" = dlprefiles; then
1022 # Preload the old-style object.
1023 dlprefiles="$dlprefiles $pic_object"
1024 prev=
1025 fi
1026
1027 # A PIC object.
1028 libobjs="$libobjs $pic_object"
1029 arg="$pic_object"
1030 fi
1031
1032 # Non-PIC object.
1033 if test "$non_pic_object" != none; then
1034 # Prepend the subdirectory the object is found in.
1035 non_pic_object="$xdir$non_pic_object"
1036
1037 # A standard non-PIC object
1038 non_pic_objects="$non_pic_objects $non_pic_object"
1039 if test -z "$pic_object" || test "$pic_object" = none ; then
1040 arg="$non_pic_object"
1041 fi
1042 fi
1043 else
1044 # Only an error if not doing a dry-run.
1045 if test -z "$run"; then
1046 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1047 exit 1
1048 else
1049 # Dry-run case.
1050
1051 # Extract subdirectory from the argument.
1052 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1053 if test "X$xdir" = "X$arg"; then
1054 xdir=
1055 else
1056 xdir="$xdir/"
1057 fi
1058
1059 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1060 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1061 libobjs="$libobjs $pic_object"
1062 non_pic_objects="$non_pic_objects $non_pic_object"
1063 fi
1064 fi
1065 done
1066 else
1067 $echo "$modename: link input file \`$save_arg' does not exist"
1068 exit 1
1069 fi
1070 arg=$save_arg
1071 prev=
1072 continue
1073 ;;
1074 rpath | xrpath)
1075 # We need an absolute path.
1076 case $arg in
1077 [\\/]* | [A-Za-z]:[\\/]*) ;;
1078 *)
1079 $echo "$modename: only absolute run-paths are allowed" 1>&2
1080 exit 1
1081 ;;
1082 esac
1083 if test "$prev" = rpath; then
1084 case "$rpath " in
1085 *" $arg "*) ;;
1086 *) rpath="$rpath $arg" ;;
1087 esac
1088 else
1089 case "$xrpath " in
1090 *" $arg "*) ;;
1091 *) xrpath="$xrpath $arg" ;;
1092 esac
1093 fi
1094 prev=
1095 continue
1096 ;;
1097 xcompiler)
1098 compiler_flags="$compiler_flags $qarg"
1099 prev=
1100 compile_command="$compile_command $qarg"
1101 finalize_command="$finalize_command $qarg"
1102 continue
1103 ;;
1104 xlinker)
1105 linker_flags="$linker_flags $qarg"
1106 compiler_flags="$compiler_flags $wl$qarg"
1107 prev=
1108 compile_command="$compile_command $wl$qarg"
1109 finalize_command="$finalize_command $wl$qarg"
1110 continue
1111 ;;
1112 *)
1113 eval "$prev=\"\$arg\""
1114 prev=
1115 continue
1116 ;;
1117 esac
1118 fi # test -n $prev
1119
1120 prevarg="$arg"
1121
1122 case $arg in
1123 -all-static)
1124 if test -n "$link_static_flag"; then
1125 compile_command="$compile_command $link_static_flag"
1126 finalize_command="$finalize_command $link_static_flag"
1127 fi
1128 continue
1129 ;;
1130
1131 -allow-undefined)
1132 # FIXME: remove this flag sometime in the future.
1133 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1134 continue
1135 ;;
1136
1137 -avoid-version)
1138 avoid_version=yes
1139 continue
1140 ;;
1141
1142 -dlopen)
1143 prev=dlfiles
1144 continue
1145 ;;
1146
1147 -dlpreopen)
1148 prev=dlprefiles
1149 continue
1150 ;;
1151
1152 -export-dynamic)
1153 export_dynamic=yes
1154 continue
1155 ;;
1156
1157 -export-symbols | -export-symbols-regex)
1158 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1159 $echo "$modename: more than one -exported-symbols argument is not allowed"
1160 exit 1
1161 fi
1162 if test "X$arg" = "X-export-symbols"; then
1163 prev=expsyms
1164 else
1165 prev=expsyms_regex
1166 fi
1167 continue
1168 ;;
1169
1170 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1171 # so, if we see these flags be careful not to treat them like -L
1172 -L[A-Z][A-Z]*:*)
1173 case $with_gcc/$host in
1174 no/*-*-irix*)
1175 compile_command="$compile_command $arg"
1176 finalize_command="$finalize_command $arg"
1177 ;;
1178 esac
1179 continue
1180 ;;
1181
1182 -L*)
1183 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1184 # We need an absolute path.
1185 case $dir in
1186 [\\/]* | [A-Za-z]:[\\/]*) ;;
1187 *)
1188 absdir=`cd "$dir" && pwd`
1189 if test -z "$absdir"; then
1190 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1191 exit 1
1192 fi
1193 dir="$absdir"
1194 ;;
1195 esac
1196 case "$deplibs " in
1197 *" -L$dir "*) ;;
1198 *)
1199 deplibs="$deplibs -L$dir"
1200 lib_search_path="$lib_search_path $dir"
1201 ;;
1202 esac
1203 case $host in
1204 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1205 case :$dllsearchpath: in
1206 *":$dir:"*) ;;
1207 *) dllsearchpath="$dllsearchpath:$dir";;
1208 esac
1209 ;;
1210 esac
1211 continue
1212 ;;
1213
1214 -l*)
1215 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1216 case $host in
1217 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1218 # These systems don't actually have a C or math library (as such)
1219 continue
1220 ;;
1221 *-*-mingw* | *-*-os2*)
1222 # These systems don't actually have a C library (as such)
1223 test "X$arg" = "X-lc" && continue
1224 ;;
1225 esac
1226 fi
1227 deplibs="$deplibs $arg"
1228 continue
1229 ;;
1230
1231 -module)
1232 module=yes
1233 continue
1234 ;;
1235
1236 -no-fast-install)
1237 fast_install=no
1238 continue
1239 ;;
1240
1241 -no-install)
1242 case $host in
1243 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1244 # The PATH hackery in wrapper scripts is required on Windows
1245 # in order for the loader to find any dlls it needs.
1246 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1247 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1248 fast_install=no
1249 ;;
1250 *) no_install=yes ;;
1251 esac
1252 continue
1253 ;;
1254
1255 -no-undefined)
1256 allow_undefined=no
1257 continue
1258 ;;
1259
1260 -objectlist)
1261 prev=objectlist
1262 continue
1263 ;;
1264
1265 -o) prev=output ;;
1266
1267 -release)
1268 prev=release
1269 continue
1270 ;;
1271
1272 -rpath)
1273 prev=rpath
1274 continue
1275 ;;
1276
1277 -R)
1278 prev=xrpath
1279 continue
1280 ;;
1281
1282 -R*)
1283 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1284 # We need an absolute path.
1285 case $dir in
1286 [\\/]* | [A-Za-z]:[\\/]*) ;;
1287 *)
1288 $echo "$modename: only absolute run-paths are allowed" 1>&2
1289 exit 1
1290 ;;
1291 esac
1292 case "$xrpath " in
1293 *" $dir "*) ;;
1294 *) xrpath="$xrpath $dir" ;;
1295 esac
1296 continue
1297 ;;
1298
1299 -static)
1300 # The effects of -static are defined in a previous loop.
1301 # We used to do the same as -all-static on platforms that
1302 # didn't have a PIC flag, but the assumption that the effects
1303 # would be equivalent was wrong. It would break on at least
1304 # Digital Unix and AIX.
1305 continue
1306 ;;
1307
1308 -thread-safe)
1309 thread_safe=yes
1310 continue
1311 ;;
1312
1313 -version-info)
1314 prev=vinfo
1315 continue
1316 ;;
1317
1318 -Wc,*)
1319 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1320 arg=
1321 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1322 for flag in $args; do
1323 IFS="$save_ifs"
1324 case $flag in
1325 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1326 flag="\"$flag\""
1327 ;;
1328 esac
1329 arg="$arg $wl$flag"
1330 compiler_flags="$compiler_flags $flag"
1331 done
1332 IFS="$save_ifs"
1333 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1334 ;;
1335
1336 -Wl,*)
1337 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1338 arg=
1339 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1340 for flag in $args; do
1341 IFS="$save_ifs"
1342 case $flag in
1343 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1344 flag="\"$flag\""
1345 ;;
1346 esac
1347 arg="$arg $wl$flag"
1348 compiler_flags="$compiler_flags $wl$flag"
1349 linker_flags="$linker_flags $flag"
1350 done
1351 IFS="$save_ifs"
1352 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1353 ;;
1354
1355 -Xcompiler)
1356 prev=xcompiler
1357 continue
1358 ;;
1359
1360 -Xlinker)
1361 prev=xlinker
1362 continue
1363 ;;
1364
1365 # Some other compiler flag.
1366 -* | +*)
1367 # Unknown arguments in both finalize_command and compile_command need
1368 # to be aesthetically quoted because they are evaled later.
1369 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1370 case $arg in
1371 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1372 arg="\"$arg\""
1373 ;;
1374 esac
1375 ;;
1376
1377 *.$objext)
1378 # A standard object.
1379 objs="$objs $arg"
1380 ;;
1381
1382 *.lo)
1383 # A libtool-controlled object.
1384
1385 # Check to see that this really is a libtool object.
1386 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1387 pic_object=
1388 non_pic_object=
1389
1390 # Read the .lo file
1391 # If there is no directory component, then add one.
1392 case $arg in
1393 */* | *\\*) . $arg ;;
1394 *) . ./$arg ;;
1395 esac
1396
1397 if test -z "$pic_object" || \
1398 test -z "$non_pic_object" ||
1399 test "$pic_object" = none && \
1400 test "$non_pic_object" = none; then
1401 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1402 exit 1
1403 fi
1404
1405 # Extract subdirectory from the argument.
1406 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1407 if test "X$xdir" = "X$arg"; then
1408 xdir=
1409 else
1410 xdir="$xdir/"
1411 fi
1412
1413 if test "$pic_object" != none; then
1414 # Prepend the subdirectory the object is found in.
1415 pic_object="$xdir$pic_object"
1416
1417 if test "$prev" = dlfiles; then
1418 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1419 dlfiles="$dlfiles $pic_object"
1420 prev=
1421 continue
1422 else
1423 # If libtool objects are unsupported, then we need to preload.
1424 prev=dlprefiles
1425 fi
1426 fi
1427
1428 # CHECK ME: I think I busted this. -Ossama
1429 if test "$prev" = dlprefiles; then
1430 # Preload the old-style object.
1431 dlprefiles="$dlprefiles $pic_object"
1432 prev=
1433 fi
1434
1435 # A PIC object.
1436 libobjs="$libobjs $pic_object"
1437 arg="$pic_object"
1438 fi
1439
1440 # Non-PIC object.
1441 if test "$non_pic_object" != none; then
1442 # Prepend the subdirectory the object is found in.
1443 non_pic_object="$xdir$non_pic_object"
1444
1445 # A standard non-PIC object
1446 non_pic_objects="$non_pic_objects $non_pic_object"
1447 if test -z "$pic_object" || test "$pic_object" = none ; then
1448 arg="$non_pic_object"
1449 fi
1450 fi
1451 else
1452 # Only an error if not doing a dry-run.
1453 if test -z "$run"; then
1454 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1455 exit 1
1456 else
1457 # Dry-run case.
1458
1459 # Extract subdirectory from the argument.
1460 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1461 if test "X$xdir" = "X$arg"; then
1462 xdir=
1463 else
1464 xdir="$xdir/"
1465 fi
1466
1467 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1468 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1469 libobjs="$libobjs $pic_object"
1470 non_pic_objects="$non_pic_objects $non_pic_object"
1471 fi
1472 fi
1473 ;;
1474
1475 *.$libext)
1476 # An archive.
1477 deplibs="$deplibs $arg"
1478 old_deplibs="$old_deplibs $arg"
1479 continue
1480 ;;
1481
1482 *.la)
1483 # A libtool-controlled library.
1484
1485 if test "$prev" = dlfiles; then
1486 # This library was specified with -dlopen.
1487 dlfiles="$dlfiles $arg"
1488 prev=
1489 elif test "$prev" = dlprefiles; then
1490 # The library was specified with -dlpreopen.
1491 dlprefiles="$dlprefiles $arg"
1492 prev=
1493 else
1494 deplibs="$deplibs $arg"
1495 fi
1496 continue
1497 ;;
1498
1499 # Some other compiler argument.
1500 *)
1501 # Unknown arguments in both finalize_command and compile_command need
1502 # to be aesthetically quoted because they are evaled later.
1503 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1504 case $arg in
1505 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1506 arg="\"$arg\""
1507 ;;
1508 esac
1509 ;;
1510 esac # arg
1511
1512 # Now actually substitute the argument into the commands.
1513 if test -n "$arg"; then
1514 compile_command="$compile_command $arg"
1515 finalize_command="$finalize_command $arg"
1516 fi
1517 done # argument parsing loop
1518
1519 if test -n "$prev"; then
1520 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1521 $echo "$help" 1>&2
1522 exit 1
1523 fi
1524
1525 # Infer tagged configuration to use if any are available and
1526 # if one wasn't chosen via the "--tag" command line option.
1527 # Only attempt this if the compiler in the base link
1528 # command doesn't match the default compiler.
1529 if test -n "$available_tags" && test -z "$tagname"; then
1530 case $base_compile in
1531 "$CC "*) ;;
1532 # Blanks in the command may have been stripped by the calling shell,
1533 # but not from the CC environment variable when ltconfig was run.
1534 "`$echo $CC` "*) ;;
1535 *)
1536 for z in $available_tags; do
1537 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1538 # Evaluate the configuration.
1539 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1540 case $base_compile in
1541 "$CC "*)
1542 # The compiler in $compile_command matches
1543 # the one in the tagged configuration.
1544 # Assume this is the tagged configuration we want.
1545 tagname=$z
1546 break
1547 ;;
1548 "`$echo $CC` "*)
1549 tagname=$z
1550 break
1551 ;;
1552 esac
1553 fi
1554 done
1555 # If $tagname still isn't set, then no tagged configuration
1556 # was found and let the user know that the "--tag" command
1557 # line option must be used.
1558 if test -z "$tagname"; then
1559 echo "$modename: unable to infer tagged configuration"
1560 echo "$modename: specify a tag with \`--tag'" 1>&2
1561 exit 1
1562 # else
1563 # echo "$modename: using $tagname tagged configuration"
1564 fi
1565 ;;
1566 esac
1567 fi
1568
1569 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1570 eval arg=\"$export_dynamic_flag_spec\"
1571 compile_command="$compile_command $arg"
1572 finalize_command="$finalize_command $arg"
1573 fi
1574
1575 # calculate the name of the file, without its directory
1576 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1577 libobjs_save="$libobjs"
1578
1579 if test -n "$shlibpath_var"; then
1580 # get the directories listed in $shlibpath_var
1581 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1582 else
1583 shlib_search_path=
1584 fi
1585 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1586 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1587
1588 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1589 if test "X$output_objdir" = "X$output"; then
1590 output_objdir="$objdir"
1591 else
1592 output_objdir="$output_objdir/$objdir"
1593 fi
1594 # Create the object directory.
1595 if test ! -d $output_objdir; then
1596 $show "$mkdir $output_objdir"
1597 $run $mkdir $output_objdir
1598 status=$?
1599 if test $status -ne 0 && test ! -d $output_objdir; then
1600 exit $status
1601 fi
1602 fi
1603
1604 # Determine the type of output
1605 case $output in
1606 "")
1607 $echo "$modename: you must specify an output file" 1>&2
1608 $echo "$help" 1>&2
1609 exit 1
1610 ;;
1611 *.$libext) linkmode=oldlib ;;
1612 *.lo | *.$objext) linkmode=obj ;;
1613 *.la) linkmode=lib ;;
1614 *) linkmode=prog ;; # Anything else should be a program.
1615 esac
1616
1617 specialdeplibs=
1618 libs=
1619 # Find all interdependent deplibs by searching for libraries
1620 # that are linked more than once (e.g. -la -lb -la)
1621 for deplib in $deplibs; do
1622 case "$libs " in
1623 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1624 esac
1625 libs="$libs $deplib"
1626 done
1627
1628 if test $linkmode = lib; then
1629 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1630
1631 # Compute libraries that are listed more than once in $predeps
1632 # $postdeps and mark them as special (i.e., whose duplicates are
1633 # not to be eliminated).
1634 pre_post_deps=
1635 for pre_post_dep in $predeps $postdeps; do
1636 case "$pre_post_deps " in
1637 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1638 esac
1639 pre_post_deps="$pre_post_deps $pre_post_dep"
1640 done
1641 pre_post_deps=
1642 fi
1643
1644 deplibs=
1645 newdependency_libs=
1646 newlib_search_path=
1647 need_relink=no # whether we're linking any uninstalled libtool libraries
1648 notinst_deplibs= # not-installed libtool libraries
1649 notinst_path= # paths that contain not-installed libtool libraries
1650 case $linkmode in
1651 lib)
1652 passes="conv link"
1653 for file in $dlfiles $dlprefiles; do
1654 case $file in
1655 *.la) ;;
1656 *)
1657 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1658 exit 1
1659 ;;
1660 esac
1661 done
1662 ;;
1663 prog)
1664 compile_deplibs=
1665 finalize_deplibs=
1666 alldeplibs=no
1667 newdlfiles=
1668 newdlprefiles=
1669 passes="conv scan dlopen dlpreopen link"
1670 ;;
1671 *) passes="conv"
1672 ;;
1673 esac
1674 for pass in $passes; do
1675 if test $linkmode = prog; then
1676 # Determine which files to process
1677 case $pass in
1678 dlopen)
1679 libs="$dlfiles"
1680 save_deplibs="$deplibs" # Collect dlpreopened libraries
1681 deplibs=
1682 ;;
1683 dlpreopen) libs="$dlprefiles" ;;
1684 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1685 esac
1686 fi
1687 for deplib in $libs; do
1688 lib=
1689 found=no
1690 case $deplib in
1691 -l*)
1692 if test $linkmode = oldlib && test $linkmode = obj; then
1693 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1694 continue
1695 fi
1696 if test $pass = conv; then
1697 deplibs="$deplib $deplibs"
1698 continue
1699 fi
1700 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1701 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1702 # Search the libtool library
1703 lib="$searchdir/lib${name}.la"
1704 if test -f "$lib"; then
1705 found=yes
1706 break
1707 fi
1708 done
1709 if test "$found" != yes; then
1710 # deplib doesn't seem to be a libtool library
1711 if test "$linkmode,$pass" = "prog,link"; then
1712 compile_deplibs="$deplib $compile_deplibs"
1713 finalize_deplibs="$deplib $finalize_deplibs"
1714 else
1715 deplibs="$deplib $deplibs"
1716 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1717 fi
1718 continue
1719 fi
1720 ;; # -l
1721 -L*)
1722 case $linkmode in
1723 lib)
1724 deplibs="$deplib $deplibs"
1725 test $pass = conv && continue
1726 newdependency_libs="$deplib $newdependency_libs"
1727 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1728 ;;
1729 prog)
1730 if test $pass = conv; then
1731 deplibs="$deplib $deplibs"
1732 continue
1733 fi
1734 if test $pass = scan; then
1735 deplibs="$deplib $deplibs"
1736 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1737 else
1738 compile_deplibs="$deplib $compile_deplibs"
1739 finalize_deplibs="$deplib $finalize_deplibs"
1740 fi
1741 ;;
1742 *)
1743 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1744 ;;
1745 esac # linkmode
1746 continue
1747 ;; # -L
1748 -R*)
1749 if test $pass = link; then
1750 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1751 # Make sure the xrpath contains only unique directories.
1752 case "$xrpath " in
1753 *" $dir "*) ;;
1754 *) xrpath="$xrpath $dir" ;;
1755 esac
1756 fi
1757 deplibs="$deplib $deplibs"
1758 continue
1759 ;;
1760 *.la) lib="$deplib" ;;
1761 *.$libext)
1762 if test $pass = conv; then
1763 deplibs="$deplib $deplibs"
1764 continue
1765 fi
1766 case $linkmode in
1767 lib)
1768 if test "$deplibs_check_method" != pass_all; then
1769 echo
1770 echo "*** Warning: This library needs some functionality provided by $deplib."
1771 echo "*** I have the capability to make that library automatically link in when"
1772 echo "*** you link to this library. But I can only do this if you have a"
1773 echo "*** shared version of the library, which you do not appear to have."
1774 else
1775 echo
1776 echo "*** Warning: Linking the shared library $output against the"
1777 echo "*** static library $deplib is not portable!"
1778 deplibs="$deplib $deplibs"
1779 fi
1780 continue
1781 ;;
1782 prog)
1783 if test $pass != link; then
1784 deplibs="$deplib $deplibs"
1785 else
1786 compile_deplibs="$deplib $compile_deplibs"
1787 finalize_deplibs="$deplib $finalize_deplibs"
1788 fi
1789 continue
1790 ;;
1791 esac # linkmode
1792 ;; # *.$libext
1793 *.lo | *.$objext)
1794 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1795 # If there is no dlopen support or we're linking statically,
1796 # we need to preload.
1797 newdlprefiles="$newdlprefiles $deplib"
1798 compile_deplibs="$deplib $compile_deplibs"
1799 finalize_deplibs="$deplib $finalize_deplibs"
1800 else
1801 newdlfiles="$newdlfiles $deplib"
1802 fi
1803 continue
1804 ;;
1805 %DEPLIBS%)
1806 alldeplibs=yes
1807 continue
1808 ;;
1809 esac # case $deplib
1810 if test $found = yes || test -f "$lib"; then :
1811 else
1812 $echo "$modename: cannot find the library \`$lib'" 1>&2
1813 exit 1
1814 fi
1815
1816 # Check to see that this really is a libtool archive.
1817 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1818 else
1819 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1820 exit 1
1821 fi
1822
1823 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1824 test "X$ladir" = "X$lib" && ladir="."
1825
1826 dlname=
1827 dlopen=
1828 dlpreopen=
1829 libdir=
1830 library_names=
1831 old_library=
1832 # If the library was installed with an old release of libtool,
1833 # it will not redefine variable installed.
1834 installed=yes
1835
1836 # Read the .la file
1837 case $lib in
1838 */* | *\\*) . $lib ;;
1839 *) . ./$lib ;;
1840 esac
1841
1842 if test "$linkmode,$pass" = "lib,link" ||
1843 test "$linkmode,$pass" = "prog,scan" ||
1844 { test $linkmode = oldlib && test $linkmode = obj; }; then
1845 # Add dl[pre]opened files of deplib
1846 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1847 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1848 fi
1849
1850 if test $pass = conv; then
1851 # Only check for convenience libraries
1852 deplibs="$lib $deplibs"
1853 if test -z "$libdir"; then
1854 if test -z "$old_library"; then
1855 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1856 exit 1
1857 fi
1858 # It is a libtool convenience library, so add in its objects.
1859 convenience="$convenience $ladir/$objdir/$old_library"
1860 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1861 tmp_libs=
1862 for deplib in $dependency_libs; do
1863 deplibs="$deplib $deplibs"
1864 case "$tmp_libs " in
1865 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1866 esac
1867 tmp_libs="$tmp_libs $deplib"
1868 done
1869 elif test $linkmode != prog && test $linkmode != lib; then
1870 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1871 exit 1
1872 fi
1873 continue
1874 fi # $pass = conv
1875
1876 # Get the name of the library we link against.
1877 linklib=
1878 for l in $old_library $library_names; do
1879 linklib="$l"
1880 done
1881 if test -z "$linklib"; then
1882 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1883 exit 1
1884 fi
1885
1886 # This library was specified with -dlopen.
1887 if test $pass = dlopen; then
1888 if test -z "$libdir"; then
1889 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1890 exit 1
1891 fi
1892 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1893 # If there is no dlname, no dlopen support or we're linking
1894 # statically, we need to preload.
1895 dlprefiles="$dlprefiles $lib"
1896 else
1897 newdlfiles="$newdlfiles $lib"
1898 fi
1899 continue
1900 fi # $pass = dlopen
1901
1902 # We need an absolute path.
1903 case $ladir in
1904 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1905 *)
1906 abs_ladir=`cd "$ladir" && pwd`
1907 if test -z "$abs_ladir"; then
1908 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1909 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1910 abs_ladir="$ladir"
1911 fi
1912 ;;
1913 esac
1914 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1915
1916 # Find the relevant object directory and library name.
1917 if test "X$installed" = Xyes; then
1918 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1919 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1920 dir="$ladir"
1921 absdir="$abs_ladir"
1922 libdir="$abs_ladir"
1923 else
1924 dir="$libdir"
1925 absdir="$libdir"
1926 fi
1927 else
1928 dir="$ladir/$objdir"
1929 absdir="$abs_ladir/$objdir"
1930 # Remove this search path later
1931 notinst_path="$notinst_path $abs_ladir"
1932 fi # $installed = yes
1933 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1934
1935 # This library was specified with -dlpreopen.
1936 if test $pass = dlpreopen; then
1937 if test -z "$libdir"; then
1938 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1939 exit 1
1940 fi
1941 # Prefer using a static library (so that no silly _DYNAMIC symbols
1942 # are required to link).
1943 if test -n "$old_library"; then
1944 newdlprefiles="$newdlprefiles $dir/$old_library"
1945 # Otherwise, use the dlname, so that lt_dlopen finds it.
1946 elif test -n "$dlname"; then
1947 newdlprefiles="$newdlprefiles $dir/$dlname"
1948 else
1949 newdlprefiles="$newdlprefiles $dir/$linklib"
1950 fi
1951 fi # $pass = dlpreopen
1952
1953 if test -z "$libdir"; then
1954 # Link the convenience library
1955 if test $linkmode = lib; then
1956 deplibs="$dir/$old_library $deplibs"
1957 elif test "$linkmode,$pass" = "prog,link"; then
1958 compile_deplibs="$dir/$old_library $compile_deplibs"
1959 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1960 else
1961 deplibs="$lib $deplibs"
1962 fi
1963 continue
1964 fi
1965
1966 if test $linkmode = prog && test $pass != link; then
1967 newlib_search_path="$newlib_search_path $ladir"
1968 deplibs="$lib $deplibs"
1969
1970 linkalldeplibs=no
1971 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1972 test "$build_libtool_libs" = no; then
1973 linkalldeplibs=yes
1974 fi
1975
1976 tmp_libs=
1977 for deplib in $dependency_libs; do
1978 case $deplib in
1979 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1980 esac
1981 # Need to link against all dependency_libs?
1982 if test $linkalldeplibs = yes; then
1983 deplibs="$deplib $deplibs"
1984 else
1985 # Need to hardcode shared library paths
1986 # or/and link against static libraries
1987 newdependency_libs="$deplib $newdependency_libs"
1988 fi
1989 case "$tmp_libs " in
1990 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1991 esac
1992 tmp_libs="$tmp_libs $deplib"
1993 done # for deplib
1994 continue
1995 fi # $linkmode = prog...
1996
1997 link_static=no # Whether the deplib will be linked statically
1998 if test -n "$library_names" &&
1999 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2000 # Link against this shared library
2001
2002 if test "$linkmode,$pass" = "prog,link" ||
2003 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
2004 # Hardcode the library path.
2005 # Skip directories that are in the system default run-time
2006 # search path.
2007 case " $sys_lib_dlsearch_path " in
2008 *" $absdir "*) ;;
2009 *)
2010 case "$compile_rpath " in
2011 *" $absdir "*) ;;
2012 *) compile_rpath="$compile_rpath $absdir"
2013 esac
2014 ;;
2015 esac
2016 case " $sys_lib_dlsearch_path " in
2017 *" $libdir "*) ;;
2018 *)
2019 case "$finalize_rpath " in
2020 *" $libdir "*) ;;
2021 *) finalize_rpath="$finalize_rpath $libdir"
2022 esac
2023 ;;
2024 esac
2025 if test $linkmode = prog; then
2026 # We need to hardcode the library path
2027 if test -n "$shlibpath_var"; then
2028 # Make sure the rpath contains only unique directories.
2029 case "$temp_rpath " in
2030 *" $dir "*) ;;
2031 *" $absdir "*) ;;
2032 *) temp_rpath="$temp_rpath $dir" ;;
2033 esac
2034 fi
2035 fi
2036 fi # $linkmode,$pass = prog,link...
2037
2038 if test "$alldeplibs" = yes &&
2039 { test "$deplibs_check_method" = pass_all ||
2040 { test "$build_libtool_libs" = yes &&
2041 test -n "$library_names"; }; }; then
2042 # We only need to search for static libraries
2043 continue
2044 fi
2045
2046 if test "$installed" = no; then
2047 notinst_deplibs="$notinst_deplibs $lib"
2048 need_relink=yes
2049 fi
2050
2051 if test -n "$old_archive_from_expsyms_cmds"; then
2052 # figure out the soname
2053 set dummy $library_names
2054 realname="$2"
2055 shift; shift
2056 libname=`eval \\$echo \"$libname_spec\"`
2057 # use dlname if we got it. it's perfectly good, no?
2058 if test -n "$dlname"; then
2059 soname="$dlname"
2060 elif test -n "$soname_spec"; then
2061 # bleh windows
2062 case $host in
2063 *cygwin*)
2064 major=`expr $current - $age`
2065 versuffix="-$major"
2066 ;;
2067 esac
2068 eval soname=\"$soname_spec\"
2069 else
2070 soname="$realname"
2071 fi
2072
2073 # Make a new name for the extract_expsyms_cmds to use
2074 soroot="$soname"
2075 soname=`echo $soroot | sed -e 's/^.*\///'`
2076 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
2077
2078 # If the library has no export list, then create one now
2079 if test -f "$output_objdir/$soname-def"; then :
2080 else
2081 $show "extracting exported symbol list from \`$soname'"
2082 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2083 eval cmds=\"$extract_expsyms_cmds\"
2084 for cmd in $cmds; do
2085 IFS="$save_ifs"
2086 $show "$cmd"
2087 $run eval "$cmd" || exit $?
2088 done
2089 IFS="$save_ifs"
2090 fi
2091
2092 # Create $newlib
2093 if test -f "$output_objdir/$newlib"; then :; else
2094 $show "generating import library for \`$soname'"
2095 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2096 eval cmds=\"$old_archive_from_expsyms_cmds\"
2097 for cmd in $cmds; do
2098 IFS="$save_ifs"
2099 $show "$cmd"
2100 $run eval "$cmd" || exit $?
2101 done
2102 IFS="$save_ifs"
2103 fi
2104 # make sure the library variables are pointing to the new library
2105 dir=$output_objdir
2106 linklib=$newlib
2107 fi # test -n $old_archive_from_expsyms_cmds
2108
2109 if test $linkmode = prog || test "$mode" != relink; then
2110 add_shlibpath=
2111 add_dir=
2112 add=
2113 lib_linked=yes
2114 case $hardcode_action in
2115 immediate | unsupported)
2116 if test "$hardcode_direct" = no; then
2117 add="$dir/$linklib"
2118 elif test "$hardcode_minus_L" = no; then
2119 case $host in
2120 *-*-sunos*) add_shlibpath="$dir" ;;
2121 esac
2122 add_dir="-L$dir"
2123 add="-l$name"
2124 elif test "$hardcode_shlibpath_var" = no; then
2125 add_shlibpath="$dir"
2126 add="-l$name"
2127 else
2128 lib_linked=no
2129 fi
2130 ;;
2131 relink)
2132 if test "$hardcode_direct" = yes; then
2133 add="$dir/$linklib"
2134 elif test "$hardcode_minus_L" = yes; then
2135 add_dir="-L$dir"
2136 add="-l$name"
2137 elif test "$hardcode_shlibpath_var" = yes; then
2138 add_shlibpath="$dir"
2139 add="-l$name"
2140 else
2141 lib_linked=no
2142 fi
2143 ;;
2144 *) lib_linked=no ;;
2145 esac
2146
2147 if test "$lib_linked" != yes; then
2148 $echo "$modename: configuration error: unsupported hardcode properties"
2149 exit 1
2150 fi
2151
2152 if test -n "$add_shlibpath"; then
2153 case :$compile_shlibpath: in
2154 *":$add_shlibpath:"*) ;;
2155 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2156 esac
2157 fi
2158 if test $linkmode = prog; then
2159 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2160 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2161 else
2162 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2163 test -n "$add" && deplibs="$add $deplibs"
2164 if test "$hardcode_direct" != yes && \
2165 test "$hardcode_minus_L" != yes && \
2166 test "$hardcode_shlibpath_var" = yes; then
2167 case :$finalize_shlibpath: in
2168 *":$libdir:"*) ;;
2169 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2170 esac
2171 fi
2172 fi
2173 fi
2174
2175 if test $linkmode = prog || test "$mode" = relink; then
2176 add_shlibpath=
2177 add_dir=
2178 add=
2179 # Finalize command for both is simple: just hardcode it.
2180 if test "$hardcode_direct" = yes; then
2181 add="$libdir/$linklib"
2182 elif test "$hardcode_minus_L" = yes; then
2183 add_dir="-L$libdir"
2184 add="-l$name"
2185 elif test "$hardcode_shlibpath_var" = yes; then
2186 case :$finalize_shlibpath: in
2187 *":$libdir:"*) ;;
2188 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2189 esac
2190 add="-l$name"
2191 else
2192 # We cannot seem to hardcode it, guess we'll fake it.
2193 add_dir="-L$libdir"
2194 add="-l$name"
2195 fi
2196
2197 if test $linkmode = prog; then
2198 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2199 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2200 else
2201 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2202 test -n "$add" && deplibs="$add $deplibs"
2203 fi
2204 fi
2205 elif test $linkmode = prog; then
2206 if test "$alldeplibs" = yes &&
2207 { test "$deplibs_check_method" = pass_all ||
2208 { test "$build_libtool_libs" = yes &&
2209 test -n "$library_names"; }; }; then
2210 # We only need to search for static libraries
2211 continue
2212 fi
2213
2214 # Try to link the static library
2215 # Here we assume that one of hardcode_direct or hardcode_minus_L
2216 # is not unsupported. This is valid on all known static and
2217 # shared platforms.
2218 if test "$hardcode_direct" != unsupported; then
2219 test -n "$old_library" && linklib="$old_library"
2220 compile_deplibs="$dir/$linklib $compile_deplibs"
2221 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2222 else
2223 compile_deplibs="-l$name -L$dir $compile_deplibs"
2224 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2225 fi
2226 elif test "$build_libtool_libs" = yes; then
2227 # Not a shared library
2228 if test "$deplibs_check_method" != pass_all; then
2229 # We're trying link a shared library against a static one
2230 # but the system doesn't support it.
2231
2232 # Just print a warning and add the library to dependency_libs so
2233 # that the program can be linked against the static library.
2234 echo
2235 echo "*** Warning: This library needs some functionality provided by $lib."
2236 echo "*** I have the capability to make that library automatically link in when"
2237 echo "*** you link to this library. But I can only do this if you have a"
2238 echo "*** shared version of the library, which you do not appear to have."
2239 if test "$module" = yes; then
2240 echo "*** Therefore, libtool will create a static module, that should work "
2241 echo "*** as long as the dlopening application is linked with the -dlopen flag."
2242 if test -z "$global_symbol_pipe"; then
2243 echo
2244 echo "*** However, this would only work if libtool was able to extract symbol"
2245 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2246 echo "*** not find such a program. So, this module is probably useless."
2247 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2248 fi
2249 if test "$build_old_libs" = no; then
2250 build_libtool_libs=module
2251 build_old_libs=yes
2252 else
2253 build_libtool_libs=no
2254 fi
2255 fi
2256 else
2257 convenience="$convenience $dir/$old_library"
2258 old_convenience="$old_convenience $dir/$old_library"
2259 deplibs="$dir/$old_library $deplibs"
2260 link_static=yes
2261 fi
2262 fi # link shared/static library?
2263
2264 if test $linkmode = lib; then
2265 if test -n "$dependency_libs" &&
2266 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2267 test $link_static = yes; }; then
2268 # Extract -R from dependency_libs
2269 temp_deplibs=
2270 for libdir in $dependency_libs; do
2271 case $libdir in
2272 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2273 case " $xrpath " in
2274 *" $temp_xrpath "*) ;;
2275 *) xrpath="$xrpath $temp_xrpath";;
2276 esac;;
2277 *) temp_deplibs="$temp_deplibs $libdir";;
2278 esac
2279 done
2280 dependency_libs="$temp_deplibs"
2281 fi
2282
2283 newlib_search_path="$newlib_search_path $absdir"
2284 # Link against this library
2285 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2286 # ... and its dependency_libs
2287 tmp_libs=
2288 for deplib in $dependency_libs; do
2289 newdependency_libs="$deplib $newdependency_libs"
2290 case "$tmp_libs " in
2291 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2292 esac
2293 tmp_libs="$tmp_libs $deplib"
2294 done
2295
2296 if test $link_all_deplibs != no; then
2297 # Add the search paths of all dependency libraries
2298 for deplib in $dependency_libs; do
2299 case $deplib in
2300 -L*) path="$deplib" ;;
2301 *.la)
2302 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2303 test "X$dir" = "X$deplib" && dir="."
2304 # We need an absolute path.
2305 case $dir in
2306 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2307 *)
2308 absdir=`cd "$dir" && pwd`
2309 if test -z "$absdir"; then
2310 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2311 absdir="$dir"
2312 fi
2313 ;;
2314 esac
2315 if grep "^installed=no" $deplib > /dev/null; then
2316 path="-L$absdir/$objdir"
2317 else
2318 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2319 if test -z "$libdir"; then
2320 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2321 exit 1
2322 fi
2323 if test "$absdir" != "$libdir"; then
2324 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2325 fi
2326 path="-L$absdir"
2327 fi
2328 ;;
2329 *) continue ;;
2330 esac
2331 case " $deplibs " in
2332 *" $path "*) ;;
2333 *) deplibs="$path $deplibs" ;;
2334 esac
2335 done
2336 fi # link_all_deplibs != no
2337 fi # linkmode = lib
2338 done # for deplib in $libs
2339 if test $pass = dlpreopen; then
2340 # Link the dlpreopened libraries before other libraries
2341 for deplib in $save_deplibs; do
2342 deplibs="$deplib $deplibs"
2343 done
2344 fi
2345 if test $pass != dlopen; then
2346 test $pass != scan && dependency_libs="$newdependency_libs"
2347 if test $pass != conv; then
2348 # Make sure lib_search_path contains only unique directories.
2349 lib_search_path=
2350 for dir in $newlib_search_path; do
2351 case "$lib_search_path " in
2352 *" $dir "*) ;;
2353 *) lib_search_path="$lib_search_path $dir" ;;
2354 esac
2355 done
2356 newlib_search_path=
2357 fi
2358
2359 if test "$linkmode,$pass" != "prog,link"; then
2360 vars="deplibs"
2361 else
2362 vars="compile_deplibs finalize_deplibs"
2363 fi
2364 for var in $vars dependency_libs; do
2365 # Add libraries to $var in reverse order
2366 eval tmp_libs=\"\$$var\"
2367 new_libs=
2368 for deplib in $tmp_libs; do
2369 case $deplib in
2370 -L*) new_libs="$deplib $new_libs" ;;
2371 *)
2372 case " $specialdeplibs " in
2373 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2374 *)
2375 case " $new_libs " in
2376 *" $deplib "*) ;;
2377 *) new_libs="$deplib $new_libs" ;;
2378 esac
2379 ;;
2380 esac
2381 ;;
2382 esac
2383 done
2384 tmp_libs=
2385 for deplib in $new_libs; do
2386 case $deplib in
2387 -L*)
2388 case " $tmp_libs " in
2389 *" $deplib "*) ;;
2390 *) tmp_libs="$tmp_libs $deplib" ;;
2391 esac
2392 ;;
2393 *) tmp_libs="$tmp_libs $deplib" ;;
2394 esac
2395 done
2396 eval $var=\"$tmp_libs\"
2397 done # for var
2398 fi
2399 if test "$pass" = "conv" &&
2400 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2401 libs="$deplibs" # reset libs
2402 deplibs=
2403 fi
2404 done # for pass
2405 if test $linkmode = prog; then
2406 dlfiles="$newdlfiles"
2407 dlprefiles="$newdlprefiles"
2408 fi
2409
2410 case $linkmode in
2411 oldlib)
2412 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2413 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2414 fi
2415
2416 if test -n "$rpath"; then
2417 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2418 fi
2419
2420 if test -n "$xrpath"; then
2421 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2422 fi
2423
2424 if test -n "$vinfo"; then
2425 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2426 fi
2427
2428 if test -n "$release"; then
2429 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2430 fi
2431
2432 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2433 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2434 fi
2435
2436 # Now set the variables for building old libraries.
2437 build_libtool_libs=no
2438 oldlibs="$output"
2439 objs="$objs$old_deplibs"
2440 ;;
2441
2442 lib)
2443 # Make sure we only generate libraries of the form `libNAME.la'.
2444 case $outputname in
2445 lib*)
2446 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2447 eval libname=\"$libname_spec\"
2448 ;;
2449 *)
2450 if test "$module" = no; then
2451 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2452 $echo "$help" 1>&2
2453 exit 1
2454 fi
2455 if test "$need_lib_prefix" != no; then
2456 # Add the "lib" prefix for modules if required
2457 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2458 eval libname=\"$libname_spec\"
2459 else
2460 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2461 fi
2462 ;;
2463 esac
2464
2465 if test -n "$objs"; then
2466 if test "$deplibs_check_method" != pass_all; then
2467 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2468 exit 1
2469 else
2470 echo
2471 echo "*** Warning: Linking the shared library $output against the non-libtool"
2472 echo "*** objects $objs is not portable!"
2473 libobjs="$libobjs $objs"
2474 fi
2475 fi
2476
2477 if test "$dlself" != no; then
2478 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2479 fi
2480
2481 set dummy $rpath
2482 if test $# -gt 2; then
2483 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2484 fi
2485 install_libdir="$2"
2486
2487 oldlibs=
2488 if test -z "$rpath"; then
2489 if test "$build_libtool_libs" = yes; then
2490 # Building a libtool convenience library.
2491 # Some compilers have problems with a `.al' extension so
2492 # convenience libraries should have the same extension an
2493 # archive normally would.
2494 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2495 build_libtool_libs=convenience
2496 build_old_libs=yes
2497 fi
2498
2499 if test -n "$vinfo"; then
2500 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2501 fi
2502
2503 if test -n "$release"; then
2504 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2505 fi
2506 else
2507
2508 # Parse the version information argument.
2509 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
2510 set dummy $vinfo 0 0 0
2511 IFS="$save_ifs"
2512
2513 if test -n "$8"; then
2514 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2515 $echo "$help" 1>&2
2516 exit 1
2517 fi
2518
2519 current="$2"
2520 revision="$3"
2521 age="$4"
2522
2523 # Check that each of the things are valid numbers.
2524 case $current in
2525 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2526 *)
2527 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2528 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2529 exit 1
2530 ;;
2531 esac
2532
2533 case $revision in
2534 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2535 *)
2536 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2537 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2538 exit 1
2539 ;;
2540 esac
2541
2542 case $age in
2543 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2544 *)
2545 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2546 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2547 exit 1
2548 ;;
2549 esac
2550
2551 if test $age -gt $current; then
2552 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2553 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2554 exit 1
2555 fi
2556
2557 # Calculate the version variables.
2558 major=
2559 versuffix=
2560 verstring=
2561 case $version_type in
2562 none) ;;
2563
2564 darwin)
2565 # Like Linux, but with the current version available in
2566 # verstring for coding it into the library header
2567 major=.`expr $current - $age`
2568 versuffix="$major.$age.$revision"
2569 # Darwin ld doesn't like 0 for these options...
2570 minor_current=`expr $current + 1`
2571 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2572 ;;
2573
2574 freebsd-aout)
2575 major=".$current"
2576 versuffix=".$current.$revision";
2577 ;;
2578
2579 freebsd-elf)
2580 major=".$current"
2581 versuffix=".$current";
2582 ;;
2583
2584 irix)
2585 major=`expr $current - $age + 1`
2586 verstring="sgi$major.$revision"
2587
2588 # Add in all the interfaces that we are compatible with.
2589 loop=$revision
2590 while test $loop != 0; do
2591 iface=`expr $revision - $loop`
2592 loop=`expr $loop - 1`
2593 verstring="sgi$major.$iface:$verstring"
2594 done
2595
2596 # Before this point, $major must not contain `.'.
2597 major=.$major
2598 versuffix="$major.$revision"
2599 ;;
2600
2601 linux)
2602 major=.`expr $current - $age`
2603 versuffix="$major.$age.$revision"
2604 ;;
2605
2606 osf)
2607 major=`expr $current - $age`
2608 versuffix=".$current.$age.$revision"
2609 verstring="$current.$age.$revision"
2610
2611 # Add in all the interfaces that we are compatible with.
2612 loop=$age
2613 while test $loop != 0; do
2614 iface=`expr $current - $loop`
2615 loop=`expr $loop - 1`
2616 verstring="$verstring:${iface}.0"
2617 done
2618
2619 # Make executables depend on our current version.
2620 verstring="$verstring:${current}.0"
2621 ;;
2622
2623 sunos)
2624 major=".$current"
2625 versuffix=".$current.$revision"
2626 ;;
2627
2628 windows)
2629 # Use '-' rather than '.', since we only want one
2630 # extension on DOS 8.3 filesystems.
2631 major=`expr $current - $age`
2632 versuffix="-$major"
2633 ;;
2634
2635 *)
2636 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2637 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2638 exit 1
2639 ;;
2640 esac
2641
2642 # Clear the version info if we defaulted, and they specified a release.
2643 if test -z "$vinfo" && test -n "$release"; then
2644 major=
2645 verstring="0.0"
2646 if test "$need_version" = no; then
2647 versuffix=
2648 else
2649 versuffix=".0.0"
2650 fi
2651 fi
2652
2653 # Remove version info from name if versioning should be avoided
2654 if test "$avoid_version" = yes && test "$need_version" = no; then
2655 major=
2656 versuffix=
2657 verstring=""
2658 fi
2659
2660 # Check to see if the archive will have undefined symbols.
2661 if test "$allow_undefined" = yes; then
2662 if test "$allow_undefined_flag" = unsupported; then
2663 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2664 build_libtool_libs=no
2665 build_old_libs=yes
2666 fi
2667 else
2668 # Don't allow undefined symbols.
2669 allow_undefined_flag="$no_undefined_flag"
2670 fi
2671 fi
2672
2673 if test "$mode" != relink; then
2674 # Remove our outputs, but don't remove object files since they
2675 # may have been created when compiling PIC objects.
2676 removelist=
2677 tempremovelist=`echo "$output_objdir/*"`
2678 for p in $tempremovelist; do
2679 case $p in
2680 *.$objext)
2681 ;;
2682 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
2683 removelist="$removelist $p"
2684 ;;
2685 *) ;;
2686 esac
2687 done
2688 if test -n "$removelist"; then
2689 $show "${rm}r $removelist"
2690 $run ${rm}r $removelist
2691 fi
2692 fi
2693
2694 # Now set the variables for building old libraries.
2695 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2696 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2697
2698 # Transform .lo files to .o files.
2699 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2700 fi
2701
2702 # Eliminate all temporary directories.
2703 for path in $notinst_path; do
2704 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2705 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2706 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2707 done
2708
2709 if test -n "$xrpath"; then
2710 # If the user specified any rpath flags, then add them.
2711 temp_xrpath=
2712 for libdir in $xrpath; do
2713 temp_xrpath="$temp_xrpath -R$libdir"
2714 case "$finalize_rpath " in
2715 *" $libdir "*) ;;
2716 *) finalize_rpath="$finalize_rpath $libdir" ;;
2717 esac
2718 done
2719 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2720 dependency_libs="$temp_xrpath $dependency_libs"
2721 fi
2722 fi
2723
2724 # Make sure dlfiles contains only unique files that won't be dlpreopened
2725 old_dlfiles="$dlfiles"
2726 dlfiles=
2727 for lib in $old_dlfiles; do
2728 case " $dlprefiles $dlfiles " in
2729 *" $lib "*) ;;
2730 *) dlfiles="$dlfiles $lib" ;;
2731 esac
2732 done
2733
2734 # Make sure dlprefiles contains only unique files
2735 old_dlprefiles="$dlprefiles"
2736 dlprefiles=
2737 for lib in $old_dlprefiles; do
2738 case "$dlprefiles " in
2739 *" $lib "*) ;;
2740 *) dlprefiles="$dlprefiles $lib" ;;
2741 esac
2742 done
2743
2744 if test "$build_libtool_libs" = yes; then
2745 if test -n "$rpath"; then
2746 case $host in
2747 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2748 # these systems don't actually have a c library (as such)!
2749 ;;
2750 *-*-rhapsody* | *-*-darwin1.[012])
2751 # Rhapsody C library is in the System framework
2752 deplibs="$deplibs -framework System"
2753 ;;
2754 *-*-netbsd*)
2755 # Don't link with libc until the a.out ld.so is fixed.
2756 ;;
2757 *)
2758 # Add libc to deplibs on all other systems if necessary.
2759 if test $build_libtool_need_lc = "yes"; then
2760 deplibs="$deplibs -lc"
2761 fi
2762 ;;
2763 esac
2764 fi
2765
2766 # Transform deplibs into only deplibs that can be linked in shared.
2767 name_save=$name
2768 libname_save=$libname
2769 release_save=$release
2770 versuffix_save=$versuffix
2771 major_save=$major
2772 # I'm not sure if I'm treating the release correctly. I think
2773 # release should show up in the -l (ie -lgmp5) so we don't want to
2774 # add it in twice. Is that correct?
2775 release=""
2776 versuffix=""
2777 major=""
2778 newdeplibs=
2779 droppeddeps=no
2780 case $deplibs_check_method in
2781 pass_all)
2782 # Don't check for shared/static. Everything works.
2783 # This might be a little naive. We might want to check
2784 # whether the library exists or not. But this is on
2785 # osf3 & osf4 and I'm not really sure... Just
2786 # implementing what was already the behaviour.
2787 newdeplibs=$deplibs
2788 ;;
2789 test_compile)
2790 # This code stresses the "libraries are programs" paradigm to its
2791 # limits. Maybe even breaks it. We compile a program, linking it
2792 # against the deplibs as a proxy for the library. Then we can check
2793 # whether they linked in statically or dynamically with ldd.
2794 $rm conftest.c
2795 cat > conftest.c <<EOF
2796 int main() { return 0; }
2797 EOF
2798 $rm conftest
2799 $LTCC -o conftest conftest.c $deplibs
2800 if test $? -eq 0 ; then
2801 ldd_output=`ldd conftest`
2802 for i in $deplibs; do
2803 name="`expr $i : '-l\(.*\)'`"
2804 # If $name is empty we are operating on a -L argument.
2805 if test -n "$name" && test "$name" != "0"; then
2806 libname=`eval \\$echo \"$libname_spec\"`
2807 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2808 set dummy $deplib_matches
2809 deplib_match=$2
2810 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2811 newdeplibs="$newdeplibs $i"
2812 else
2813 droppeddeps=yes
2814 echo
2815 echo "*** Warning: This library needs some functionality provided by $i."
2816 echo "*** I have the capability to make that library automatically link in when"
2817 echo "*** you link to this library. But I can only do this if you have a"
2818 echo "*** shared version of the library, which you do not appear to have."
2819 fi
2820 else
2821 newdeplibs="$newdeplibs $i"
2822 fi
2823 done
2824 else
2825 # Error occured in the first compile. Let's try to salvage the situation:
2826 # Compile a seperate program for each library.
2827 for i in $deplibs; do
2828 name="`expr $i : '-l\(.*\)'`"
2829 # If $name is empty we are operating on a -L argument.
2830 if test -n "$name" && test "$name" != "0"; then
2831 $rm conftest
2832 $LTCC -o conftest conftest.c $i
2833 # Did it work?
2834 if test $? -eq 0 ; then
2835 ldd_output=`ldd conftest`
2836 libname=`eval \\$echo \"$libname_spec\"`
2837 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2838 set dummy $deplib_matches
2839 deplib_match=$2
2840 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2841 newdeplibs="$newdeplibs $i"
2842 else
2843 droppeddeps=yes
2844 echo
2845 echo "*** Warning: This library needs some functionality provided by $i."
2846 echo "*** I have the capability to make that library automatically link in when"
2847 echo "*** you link to this library. But I can only do this if you have a"
2848 echo "*** shared version of the library, which you do not appear to have."
2849 fi
2850 else
2851 droppeddeps=yes
2852 echo
2853 echo "*** Warning! Library $i is needed by this library but I was not able to"
2854 echo "*** make it link in! You will probably need to install it or some"
2855 echo "*** library that it depends on before this library will be fully"
2856 echo "*** functional. Installing it before continuing would be even better."
2857 fi
2858 else
2859 newdeplibs="$newdeplibs $i"
2860 fi
2861 done
2862 fi
2863 ;;
2864 file_magic*)
2865 set dummy $deplibs_check_method
2866 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2867 for a_deplib in $deplibs; do
2868 name="`expr $a_deplib : '-l\(.*\)'`"
2869 # If $name is empty we are operating on a -L argument.
2870 if test -n "$name" && test "$name" != "0"; then
2871 libname=`eval \\$echo \"$libname_spec\"`
2872 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2873 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2874 for potent_lib in $potential_libs; do
2875 # Follow soft links.
2876 if ls -lLd "$potent_lib" 2>/dev/null \
2877 | grep " -> " >/dev/null; then
2878 continue
2879 fi
2880 # The statement above tries to avoid entering an
2881 # endless loop below, in case of cyclic links.
2882 # We might still enter an endless loop, since a link
2883 # loop can be closed while we follow links,
2884 # but so what?
2885 potlib="$potent_lib"
2886 while test -h "$potlib" 2>/dev/null; do
2887 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2888 case $potliblink in
2889 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2890 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2891 esac
2892 done
2893 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2894 | sed 10q \
2895 | egrep "$file_magic_regex" > /dev/null; then
2896 newdeplibs="$newdeplibs $a_deplib"
2897 a_deplib=""
2898 break 2
2899 fi
2900 done
2901 done
2902 if test -n "$a_deplib" ; then
2903 droppeddeps=yes
2904 echo
2905 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2906 echo "*** I have the capability to make that library automatically link in when"
2907 echo "*** you link to this library. But I can only do this if you have a"
2908 echo "*** shared version of the library, which you do not appear to have."
2909 fi
2910 else
2911 # Add a -L argument.
2912 newdeplibs="$newdeplibs $a_deplib"
2913 fi
2914 done # Gone through all deplibs.
2915 ;;
2916 match_pattern*)
2917 set dummy $deplibs_check_method
2918 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2919 for a_deplib in $deplibs; do
2920 name="`expr $a_deplib : '-l\(.*\)'`"
2921 # If $name is empty we are operating on a -L argument.
2922 if test -n "$name" && test "$name" != "0"; then
2923 libname=`eval \\$echo \"$libname_spec\"`
2924 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2925 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2926 for potent_lib in $potential_libs; do
2927 if eval echo \"$potent_lib\" 2>/dev/null \
2928 | sed 10q \
2929 | egrep "$match_pattern_regex" > /dev/null; then
2930 newdeplibs="$newdeplibs $a_deplib"
2931 a_deplib=""
2932 break 2
2933 fi
2934 done
2935 done
2936 if test -n "$a_deplib" ; then
2937 droppeddeps=yes
2938 echo
2939 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2940 echo "*** I have the capability to make that library automatically link in when"
2941 echo "*** you link to this library. But I can only do this if you have a"
2942 echo "*** shared version of the library, which you do not appear to have."
2943 fi
2944 else
2945 # Add a -L argument.
2946 newdeplibs="$newdeplibs $a_deplib"
2947 fi
2948 done # Gone through all deplibs.
2949 ;;
2950 none | unknown | *)
2951 newdeplibs=""
2952 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2953 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2954 grep . >/dev/null; then
2955 echo
2956 if test "X$deplibs_check_method" = "Xnone"; then
2957 echo "*** Warning: inter-library dependencies are not supported in this platform."
2958 else
2959 echo "*** Warning: inter-library dependencies are not known to be supported."
2960 fi
2961 echo "*** All declared inter-library dependencies are being dropped."
2962 droppeddeps=yes
2963 fi
2964 ;;
2965 esac
2966 versuffix=$versuffix_save
2967 major=$major_save
2968 release=$release_save
2969 libname=$libname_save
2970 name=$name_save
2971
2972 case $host in
2973 *-*-rhapsody* | *-*-darwin1.[012])
2974 # On Rhapsody replace the C library is the System framework
2975 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2976 ;;
2977 esac
2978
2979 if test "$droppeddeps" = yes; then
2980 if test "$module" = yes; then
2981 echo
2982 echo "*** Warning: libtool could not satisfy all declared inter-library"
2983 echo "*** dependencies of module $libname. Therefore, libtool will create"
2984 echo "*** a static module, that should work as long as the dlopening"
2985 echo "*** application is linked with the -dlopen flag."
2986 if test -z "$global_symbol_pipe"; then
2987 echo
2988 echo "*** However, this would only work if libtool was able to extract symbol"
2989 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2990 echo "*** not find such a program. So, this module is probably useless."
2991 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2992 fi
2993 if test "$build_old_libs" = no; then
2994 oldlibs="$output_objdir/$libname.$libext"
2995 build_libtool_libs=module
2996 build_old_libs=yes
2997 else
2998 build_libtool_libs=no
2999 fi
3000 else
3001 echo "*** The inter-library dependencies that have been dropped here will be"
3002 echo "*** automatically added whenever a program is linked with this library"
3003 echo "*** or is declared to -dlopen it."
3004
3005 if test $allow_undefined = no; then
3006 echo
3007 echo "*** Since this library must not contain undefined symbols,"
3008 echo "*** because either the platform does not support them or"
3009 echo "*** it was explicitly requested with -no-undefined,"
3010 echo "*** libtool will only create a static version of it."
3011 if test "$build_old_libs" = no; then
3012 oldlibs="$output_objdir/$libname.$libext"
3013 build_libtool_libs=module
3014 build_old_libs=yes
3015 else
3016 build_libtool_libs=no
3017 fi
3018 fi
3019 fi
3020 fi
3021 # Done checking deplibs!
3022 deplibs=$newdeplibs
3023 fi
3024
3025 # All the library-specific variables (install_libdir is set above).
3026 library_names=
3027 old_library=
3028 dlname=
3029
3030 # Test again, we may have decided not to build it any more
3031 if test "$build_libtool_libs" = yes; then
3032 if test $hardcode_into_libs = yes; then
3033 # Hardcode the library paths
3034 hardcode_libdirs=
3035 dep_rpath=
3036 rpath="$finalize_rpath"
3037 test "$mode" != relink && rpath="$compile_rpath$rpath"
3038 for libdir in $rpath; do
3039 if test -n "$hardcode_libdir_flag_spec"; then
3040 if test -n "$hardcode_libdir_separator"; then
3041 if test -z "$hardcode_libdirs"; then
3042 hardcode_libdirs="$libdir"
3043 else
3044 # Just accumulate the unique libdirs.
3045 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3046 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3047 ;;
3048 *)
3049 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3050 ;;
3051 esac
3052 fi
3053 else
3054 eval flag=\"$hardcode_libdir_flag_spec\"
3055 dep_rpath="$dep_rpath $flag"
3056 fi
3057 elif test -n "$runpath_var"; then
3058 case "$perm_rpath " in
3059 *" $libdir "*) ;;
3060 *) perm_rpath="$perm_rpath $libdir" ;;
3061 esac
3062 fi
3063 done
3064 # Substitute the hardcoded libdirs into the rpath.
3065 if test -n "$hardcode_libdir_separator" &&
3066 test -n "$hardcode_libdirs"; then
3067 libdir="$hardcode_libdirs"
3068 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3069 fi
3070 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3071 # We should set the runpath_var.
3072 rpath=
3073 for dir in $perm_rpath; do
3074 rpath="$rpath$dir:"
3075 done
3076 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3077 fi
3078 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3079 fi
3080
3081 shlibpath="$finalize_shlibpath"
3082 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3083 if test -n "$shlibpath"; then
3084 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3085 fi
3086
3087 # Get the real and link names of the library.
3088 eval library_names=\"$library_names_spec\"
3089 set dummy $library_names
3090 realname="$2"
3091 shift; shift
3092
3093 if test -n "$soname_spec"; then
3094 eval soname=\"$soname_spec\"
3095 else
3096 soname="$realname"
3097 fi
3098 test -z "$dlname" && dlname=$soname
3099
3100 lib="$output_objdir/$realname"
3101 for link
3102 do
3103 linknames="$linknames $link"
3104 done
3105
3106 # # Ensure that we have .o objects for linkers which dislike .lo
3107 # # (e.g. aix) in case we are running --disable-static
3108 # for obj in $libobjs; do
3109 # xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
3110 # if test "X$xdir" = "X$obj"; then
3111 # xdir="."
3112 # else
3113 # xdir="$xdir"
3114 # fi
3115 # baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
3116 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3117 # if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then
3118 # $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
3119 # $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
3120 # fi
3121 # done
3122
3123 # Use standard objects if they are pic
3124 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3125
3126 # Prepare the list of exported symbols
3127 if test -z "$export_symbols"; then
3128 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3129 $show "generating symbol list for \`$libname.la'"
3130 export_symbols="$output_objdir/$libname.exp"
3131 $run $rm $export_symbols
3132 eval cmds=\"$export_symbols_cmds\"
3133 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3134 for cmd in $cmds; do
3135 IFS="$save_ifs"
3136 $show "$cmd"
3137 $run eval "$cmd" || exit $?
3138 done
3139 IFS="$save_ifs"
3140 if test -n "$export_symbols_regex"; then
3141 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3142 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3143 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3144 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3145 fi
3146 fi
3147 fi
3148
3149 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3150 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3151 fi
3152
3153 if test -n "$convenience"; then
3154 if test -n "$whole_archive_flag_spec"; then
3155 save_libobjs=$libobjs
3156 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3157 else
3158 gentop="$output_objdir/${outputname}x"
3159 $show "${rm}r $gentop"
3160 $run ${rm}r "$gentop"
3161 $show "$mkdir $gentop"
3162 $run $mkdir "$gentop"
3163 status=$?
3164 if test $status -ne 0 && test ! -d "$gentop"; then
3165 exit $status
3166 fi
3167 generated="$generated $gentop"
3168
3169 for xlib in $convenience; do
3170 # Extract the objects.
3171 case $xlib in
3172 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3173 *) xabs=`pwd`"/$xlib" ;;
3174 esac
3175 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3176 xdir="$gentop/$xlib"
3177
3178 $show "${rm}r $xdir"
3179 $run ${rm}r "$xdir"
3180 $show "$mkdir $xdir"
3181 $run $mkdir "$xdir"
3182 status=$?
3183 if test $status -ne 0 && test ! -d "$xdir"; then
3184 exit $status
3185 fi
3186 $show "(cd $xdir && $AR x $xabs)"
3187 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3188
3189 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3190 done
3191 fi
3192 fi
3193
3194 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3195 eval flag=\"$thread_safe_flag_spec\"
3196 linker_flags="$linker_flags $flag"
3197 fi
3198
3199 # Make a backup of the uninstalled library when relinking
3200 if test "$mode" = relink; then
3201 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3202 fi
3203
3204 # Do each of the archive commands.
3205 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3206 eval cmds=\"$archive_expsym_cmds\"
3207 else
3208 eval cmds=\"$archive_cmds\"
3209 fi
3210 if len=`expr "X$cmds" : ".*"` &&
3211 test $len -le $max_cmd_len; then
3212 :
3213 else
3214 # The command line is too long to link in one step, link piecewise.
3215 $echo "creating reloadable object files..."
3216
3217 # Save the value of $output and $libobjs because we want to
3218 # use them later. If we have whole_archive_flag_spec, we
3219 # want to use save_libobjs as it was before
3220 # whole_archive_flag_spec was expanded, because we can't
3221 # assume the linker understands whole_archive_flag_spec.
3222 # This may have to be revisited, in case too many
3223 # convenience libraries get linked in and end up exceeding
3224 # the spec.
3225 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3226 save_libobjs=$libobjs
3227 fi
3228 save_output=$output
3229
3230 # Clear the reloadable object creation command queue and
3231 # initialize k to one.
3232 test_cmds=
3233 concat_cmds=
3234 objlist=
3235 delfiles=
3236 last_robj=
3237 k=1
3238 output=$output_objdir/$save_output-${k}.$objext
3239 # Loop over the list of objects to be linked.
3240 for obj in $save_libobjs
3241 do
3242 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3243 if test "X$objlist" = X ||
3244 { len=`expr "X$test_cmds" : ".*"` &&
3245 test $len -le $max_cmd_len; }; then
3246 objlist="$objlist $obj"
3247 else
3248 # The command $test_cmds is almost too long, add a
3249 # command to the queue.
3250 if test $k -eq 1 ; then
3251 # The first file doesn't have a previous command to add.
3252 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3253 else
3254 # All subsequent reloadable object files will link in
3255 # the last one created.
3256 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3257 fi
3258 last_robj=$output_objdir/$save_output-${k}.$objext
3259 k=`expr $k + 1`
3260 output=$output_objdir/$save_output-${k}.$objext
3261 objlist=$obj
3262 len=1
3263 fi
3264 done
3265 # Handle the remaining objects by creating one last
3266 # reloadable object file. All subsequent reloadable object
3267 # files will link in the last one created.
3268 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3269 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3270
3271 # Set up a command to remove the reloadale object files
3272 # after they are used.
3273 i=0
3274 while test $i -lt $k
3275 do
3276 i=`expr $i + 1`
3277 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3278 done
3279
3280 $echo "creating a temporary reloadable object file: $output"
3281
3282 # Loop through the commands generated above and execute them.
3283 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3284 for cmd in $concat_cmds; do
3285 IFS="$save_ifs"
3286 $show "$cmd"
3287 $run eval "$cmd" || exit $?
3288 done
3289 IFS="$save_ifs"
3290
3291 libobjs=$output
3292 # Restore the value of output.
3293 output=$save_output
3294
3295 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3296 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3297 fi
3298 # Expand the library linking commands again to reset the
3299 # value of $libobjs for piecewise linking.
3300
3301 # Do each of the archive commands.
3302 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3303 eval cmds=\"$archive_expsym_cmds\"
3304 else
3305 eval cmds=\"$archive_cmds\"
3306 fi
3307
3308 # Append the command to remove the reloadable object files
3309 # to the just-reset $cmds.
3310 eval cmds=\"\$cmds~$rm $delfiles\"
3311 fi
3312 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3313 for cmd in $cmds; do
3314 IFS="$save_ifs"
3315 $show "$cmd"
3316 $run eval "$cmd" || exit $?
3317 done
3318 IFS="$save_ifs"
3319
3320 # Restore the uninstalled library and exit
3321 if test "$mode" = relink; then
3322 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3323 exit 0
3324 fi
3325
3326 # Create links to the real library.
3327 for linkname in $linknames; do
3328 if test "$realname" != "$linkname"; then
3329 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3330 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3331 fi
3332 done
3333
3334 # If -module or -export-dynamic was specified, set the dlname.
3335 if test "$module" = yes || test "$export_dynamic" = yes; then
3336 # On all known operating systems, these are identical.
3337 dlname="$soname"
3338 fi
3339 fi
3340 ;;
3341
3342 obj)
3343 if test -n "$deplibs"; then
3344 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3345 fi
3346
3347 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3348 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3349 fi
3350
3351 if test -n "$rpath"; then
3352 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3353 fi
3354
3355 if test -n "$xrpath"; then
3356 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3357 fi
3358
3359 if test -n "$vinfo"; then
3360 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3361 fi
3362
3363 if test -n "$release"; then
3364 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3365 fi
3366
3367 case $output in
3368 *.lo)
3369 if test -n "$objs$old_deplibs"; then
3370 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3371 exit 1
3372 fi
3373 libobj="$output"
3374 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3375 ;;
3376 *)
3377 libobj=
3378 obj="$output"
3379 ;;
3380 esac
3381
3382 # Delete the old objects.
3383 $run $rm $obj $libobj
3384
3385 # Objects from convenience libraries. This assumes
3386 # single-version convenience libraries. Whenever we create
3387 # different ones for PIC/non-PIC, this we'll have to duplicate
3388 # the extraction.
3389 reload_conv_objs=
3390 gentop=
3391 # reload_cmds runs $LD directly, so let us get rid of
3392 # -Wl from whole_archive_flag_spec
3393 wl=
3394
3395 if test -n "$convenience"; then
3396 if test -n "$whole_archive_flag_spec"; then
3397 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3398 else
3399 gentop="$output_objdir/${obj}x"
3400 $show "${rm}r $gentop"
3401 $run ${rm}r "$gentop"
3402 $show "$mkdir $gentop"
3403 $run $mkdir "$gentop"
3404 status=$?
3405 if test $status -ne 0 && test ! -d "$gentop"; then
3406 exit $status
3407 fi
3408 generated="$generated $gentop"
3409
3410 for xlib in $convenience; do
3411 # Extract the objects.
3412 case $xlib in
3413 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3414 *) xabs=`pwd`"/$xlib" ;;
3415 esac
3416 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3417 xdir="$gentop/$xlib"
3418
3419 $show "${rm}r $xdir"
3420 $run ${rm}r "$xdir"
3421 $show "$mkdir $xdir"
3422 $run $mkdir "$xdir"
3423 status=$?
3424 if test $status -ne 0 && test ! -d "$xdir"; then
3425 exit $status
3426 fi
3427 $show "(cd $xdir && $AR x $xabs)"
3428 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3429
3430 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3431 done
3432 fi
3433 fi
3434
3435 # Create the old-style object.
3436 reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
3437
3438 output="$obj"
3439 eval cmds=\"$reload_cmds\"
3440 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3441 for cmd in $cmds; do
3442 IFS="$save_ifs"
3443 $show "$cmd"
3444 $run eval "$cmd" || exit $?
3445 done
3446 IFS="$save_ifs"
3447
3448 # Exit if we aren't doing a library object file.
3449 if test -z "$libobj"; then
3450 if test -n "$gentop"; then
3451 $show "${rm}r $gentop"
3452 $run ${rm}r $gentop
3453 fi
3454
3455 exit 0
3456 fi
3457
3458 if test "$build_libtool_libs" != yes; then
3459 if test -n "$gentop"; then
3460 $show "${rm}r $gentop"
3461 $run ${rm}r $gentop
3462 fi
3463
3464 # Create an invalid libtool object if no PIC, so that we don't
3465 # accidentally link it into a program.
3466 # $show "echo timestamp > $libobj"
3467 # $run eval "echo timestamp > $libobj" || exit $?
3468 exit 0
3469 fi
3470
3471 if test -n "$pic_flag" || test "$pic_mode" != default; then
3472 # Only do commands if we really have different PIC objects.
3473 reload_objs="$libobjs $reload_conv_objs"
3474 output="$libobj"
3475 eval cmds=\"$reload_cmds\"
3476 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3477 for cmd in $cmds; do
3478 IFS="$save_ifs"
3479 $show "$cmd"
3480 $run eval "$cmd" || exit $?
3481 done
3482 IFS="$save_ifs"
3483 # else
3484 # # Just create a symlink.
3485 # $show $rm $libobj
3486 # $run $rm $libobj
3487 # xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3488 # if test "X$xdir" = "X$libobj"; then
3489 # xdir="."
3490 # else
3491 # xdir="$xdir"
3492 # fi
3493 # baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3494 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3495 # $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3496 # $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3497 fi
3498
3499 if test -n "$gentop"; then
3500 $show "${rm}r $gentop"
3501 $run ${rm}r $gentop
3502 fi
3503
3504 exit 0
3505 ;;
3506
3507 prog)
3508 case $host in
3509 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3510 esac
3511 if test -n "$vinfo"; then
3512 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3513 fi
3514
3515 if test -n "$release"; then
3516 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3517 fi
3518
3519 if test "$preload" = yes; then
3520 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3521 test "$dlopen_self_static" = unknown; then
3522 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3523 fi
3524 fi
3525
3526 case $host in
3527 *-*-rhapsody* | *-*-darwin1.[012])
3528 # On Rhapsody replace the C library is the System framework
3529 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3530 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3531 ;;
3532 esac
3533
3534 compile_command="$compile_command $compile_deplibs"
3535 finalize_command="$finalize_command $finalize_deplibs"
3536
3537 if test -n "$rpath$xrpath"; then
3538 # If the user specified any rpath flags, then add them.
3539 for libdir in $rpath $xrpath; do
3540 # This is the magic to use -rpath.
3541 case "$finalize_rpath " in
3542 *" $libdir "*) ;;
3543 *) finalize_rpath="$finalize_rpath $libdir" ;;
3544 esac
3545 done
3546 fi
3547
3548 # Now hardcode the library paths
3549 rpath=
3550 hardcode_libdirs=
3551 for libdir in $compile_rpath $finalize_rpath; do
3552 if test -n "$hardcode_libdir_flag_spec"; then
3553 if test -n "$hardcode_libdir_separator"; then
3554 if test -z "$hardcode_libdirs"; then
3555 hardcode_libdirs="$libdir"
3556 else
3557 # Just accumulate the unique libdirs.
3558 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3559 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3560 ;;
3561 *)
3562 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3563 ;;
3564 esac
3565 fi
3566 else
3567 eval flag=\"$hardcode_libdir_flag_spec\"
3568 rpath="$rpath $flag"
3569 fi
3570 elif test -n "$runpath_var"; then
3571 case "$perm_rpath " in
3572 *" $libdir "*) ;;
3573 *) perm_rpath="$perm_rpath $libdir" ;;
3574 esac
3575 fi
3576 case $host in
3577 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3578 case :$dllsearchpath: in
3579 *":$libdir:"*) ;;
3580 *) dllsearchpath="$dllsearchpath:$libdir";;
3581 esac
3582 ;;
3583 esac
3584 done
3585 # Substitute the hardcoded libdirs into the rpath.
3586 if test -n "$hardcode_libdir_separator" &&
3587 test -n "$hardcode_libdirs"; then
3588 libdir="$hardcode_libdirs"
3589 eval rpath=\" $hardcode_libdir_flag_spec\"
3590 fi
3591 compile_rpath="$rpath"
3592
3593 rpath=
3594 hardcode_libdirs=
3595 for libdir in $finalize_rpath; do
3596 if test -n "$hardcode_libdir_flag_spec"; then
3597 if test -n "$hardcode_libdir_separator"; then
3598 if test -z "$hardcode_libdirs"; then
3599 hardcode_libdirs="$libdir"
3600 else
3601 # Just accumulate the unique libdirs.
3602 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3603 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3604 ;;
3605 *)
3606 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3607 ;;
3608 esac
3609 fi
3610 else
3611 eval flag=\"$hardcode_libdir_flag_spec\"
3612 rpath="$rpath $flag"
3613 fi
3614 elif test -n "$runpath_var"; then
3615 case "$finalize_perm_rpath " in
3616 *" $libdir "*) ;;
3617 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3618 esac
3619 fi
3620 done
3621 # Substitute the hardcoded libdirs into the rpath.
3622 if test -n "$hardcode_libdir_separator" &&
3623 test -n "$hardcode_libdirs"; then
3624 libdir="$hardcode_libdirs"
3625 eval rpath=\" $hardcode_libdir_flag_spec\"
3626 fi
3627 finalize_rpath="$rpath"
3628
3629 dlsyms=
3630 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3631 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3632 dlsyms="${outputname}S.c"
3633 else
3634 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3635 fi
3636 fi
3637
3638 if test -n "$dlsyms"; then
3639 case $dlsyms in
3640 "") ;;
3641 *.c)
3642 # Discover the nlist of each of the dlfiles.
3643 nlist="$output_objdir/${outputname}.nm"
3644
3645 $show "$rm $nlist ${nlist}S ${nlist}T"
3646 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3647
3648 # Parse the name list into a source file.
3649 $show "creating $output_objdir/$dlsyms"
3650
3651 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3652 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3653 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3654
3655 #ifdef __cplusplus
3656 extern \"C\" {
3657 #endif
3658
3659 /* Prevent the only kind of declaration conflicts we can make. */
3660 #define lt_preloaded_symbols some_other_symbol
3661
3662 /* External symbol declarations for the compiler. */\
3663 "
3664
3665 if test "$dlself" = yes; then
3666 $show "generating symbol list for \`$output'"
3667
3668 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3669
3670 # Add our own program objects to the symbol list.
3671 progfiles="$objs$old_deplibs"
3672 for arg in $progfiles; do
3673 $show "extracting global C symbols from \`$arg'"
3674 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3675 done
3676
3677 if test -n "$exclude_expsyms"; then
3678 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3679 $run eval '$mv "$nlist"T "$nlist"'
3680 fi
3681
3682 if test -n "$export_symbols_regex"; then
3683 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3684 $run eval '$mv "$nlist"T "$nlist"'
3685 fi
3686
3687 # Prepare the list of exported symbols
3688 if test -z "$export_symbols"; then
3689 export_symbols="$output_objdir/$output.exp"
3690 $run $rm $export_symbols
3691 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3692 else
3693 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3694 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3695 $run eval 'mv "$nlist"T "$nlist"'
3696 fi
3697 fi
3698
3699 for arg in $dlprefiles; do
3700 $show "extracting global C symbols from \`$arg'"
3701 name=`echo "$arg" | sed -e 's%^.*/%%'`
3702 $run eval 'echo ": $name " >> "$nlist"'
3703 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3704 done
3705
3706 if test -z "$run"; then
3707 # Make sure we have at least an empty file.
3708 test -f "$nlist" || : > "$nlist"
3709
3710 if test -n "$exclude_expsyms"; then
3711 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3712 $mv "$nlist"T "$nlist"
3713 fi
3714
3715 # Try sorting and uniquifying the output.
3716 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3717 :
3718 else
3719 grep -v "^: " < "$nlist" > "$nlist"S
3720 fi
3721
3722 if test -f "$nlist"S; then
3723 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3724 else
3725 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3726 fi
3727
3728 $echo >> "$output_objdir/$dlsyms" "\
3729
3730 #undef lt_preloaded_symbols
3731
3732 #if defined (__STDC__) && __STDC__
3733 # define lt_ptr_t void *
3734 #else
3735 # define lt_ptr_t char *
3736 # define const
3737 #endif
3738
3739 /* The mapping between symbol names and symbols. */
3740 const struct {
3741 const char *name;
3742 lt_ptr_t address;
3743 }
3744 lt_preloaded_symbols[] =
3745 {\
3746 "
3747
3748 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
3749 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
3750 < "$nlist" >> "$output_objdir/$dlsyms"
3751
3752 $echo >> "$output_objdir/$dlsyms" "\
3753 {0, (lt_ptr_t) 0}
3754 };
3755
3756 /* This works around a problem in FreeBSD linker */
3757 #ifdef FREEBSD_WORKAROUND
3758 static const void *lt_preloaded_setup() {
3759 return lt_preloaded_symbols;
3760 }
3761 #endif
3762
3763 #ifdef __cplusplus
3764 }
3765 #endif\
3766 "
3767 fi
3768
3769 pic_flag_for_symtable=
3770 case $host in
3771 # compiling the symbol table file with pic_flag works around
3772 # a FreeBSD bug that causes programs to crash when -lm is
3773 # linked before any other PIC object. But we must not use
3774 # pic_flag when linking with -static. The problem exists in
3775 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3776 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3777 case "$compile_command " in
3778 *" -static "*) ;;
3779 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3780 esac;;
3781 *-*-hpux*)
3782 case "$compile_command " in
3783 *" -static "*) ;;
3784 *) pic_flag_for_symtable=" $pic_flag";;
3785 esac
3786 esac
3787
3788 # Now compile the dynamic symbol file.
3789 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3790 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3791
3792 # Clean up the generated files.
3793 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3794 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3795
3796 # Transform the symbol file into the correct name.
3797 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3798 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3799 ;;
3800 *)
3801 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3802 exit 1
3803 ;;
3804 esac
3805 else
3806 # We keep going just in case the user didn't refer to
3807 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3808 # really was required.
3809
3810 # Nullify the symbol file.
3811 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3812 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3813 fi
3814
3815 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3816 # Replace the output file specification.
3817 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3818 link_command="$compile_command$compile_rpath"
3819
3820 # We have no uninstalled library dependencies, so finalize right now.
3821 $show "$link_command"
3822 $run eval "$link_command"
3823 status=$?
3824
3825 # Delete the generated files.
3826 if test -n "$dlsyms"; then
3827 $show "$rm $output_objdir/${outputname}S.${objext}"
3828 $run $rm "$output_objdir/${outputname}S.${objext}"
3829 fi
3830
3831 exit $status
3832 fi
3833
3834 if test -n "$shlibpath_var"; then
3835 # We should set the shlibpath_var
3836 rpath=
3837 for dir in $temp_rpath; do
3838 case $dir in
3839 [\\/]* | [A-Za-z]:[\\/]*)
3840 # Absolute path.
3841 rpath="$rpath$dir:"
3842 ;;
3843 *)
3844 # Relative path: add a thisdir entry.
3845 rpath="$rpath\$thisdir/$dir:"
3846 ;;
3847 esac
3848 done
3849 temp_rpath="$rpath"
3850 fi
3851
3852 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3853 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3854 fi
3855 if test -n "$finalize_shlibpath"; then
3856 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3857 fi
3858
3859 compile_var=
3860 finalize_var=
3861 if test -n "$runpath_var"; then
3862 if test -n "$perm_rpath"; then
3863 # We should set the runpath_var.
3864 rpath=
3865 for dir in $perm_rpath; do
3866 rpath="$rpath$dir:"
3867 done
3868 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3869 fi
3870 if test -n "$finalize_perm_rpath"; then
3871 # We should set the runpath_var.
3872 rpath=
3873 for dir in $finalize_perm_rpath; do
3874 rpath="$rpath$dir:"
3875 done
3876 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3877 fi
3878 fi
3879
3880 if test "$no_install" = yes; then
3881 # We don't need to create a wrapper script.
3882 link_command="$compile_var$compile_command$compile_rpath"
3883 # Replace the output file specification.
3884 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3885 # Delete the old output file.
3886 $run $rm $output
3887 # Link the executable and exit
3888 $show "$link_command"
3889 $run eval "$link_command" || exit $?
3890 exit 0
3891 fi
3892
3893 if test "$hardcode_action" = relink; then
3894 # Fast installation is not supported
3895 link_command="$compile_var$compile_command$compile_rpath"
3896 relink_command="$finalize_var$finalize_command$finalize_rpath"
3897
3898 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3899 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3900 else
3901 if test "$fast_install" != no; then
3902 link_command="$finalize_var$compile_command$finalize_rpath"
3903 if test "$fast_install" = yes; then
3904 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3905 else
3906 # fast_install is set to needless
3907 relink_command=
3908 fi
3909 else
3910 link_command="$compile_var$compile_command$compile_rpath"
3911 relink_command="$finalize_var$finalize_command$finalize_rpath"
3912 fi
3913 fi
3914
3915 # Replace the output file specification.
3916 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3917
3918 # Delete the old output files.
3919 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3920
3921 $show "$link_command"
3922 $run eval "$link_command" || exit $?
3923
3924 # Now create the wrapper script.
3925 $show "creating $output"
3926
3927 # Quote the relink command for shipping.
3928 if test -n "$relink_command"; then
3929 # Preserve any variables that may affect compiler behavior
3930 for var in $variables_saved_for_relink; do
3931 if eval test -z \"\${$var+set}\"; then
3932 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3933 elif eval var_value=\$$var; test -z "$var_value"; then
3934 relink_command="$var=; export $var; $relink_command"
3935 else
3936 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3937 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3938 fi
3939 done
3940 relink_command="cd `pwd`; $relink_command"
3941 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3942 fi
3943
3944 # Quote $echo for shipping.
3945 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3946 case $0 in
3947 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3948 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3949 esac
3950 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3951 else
3952 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3953 fi
3954
3955 # Only actually do things if our run command is non-null.
3956 if test -z "$run"; then
3957 # win32 will think the script is a binary if it has
3958 # a .exe suffix, so we strip it off here.
3959 case $output in
3960 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3961 esac
3962 # test for cygwin because mv fails w/o .exe extensions
3963 case $host in
3964 *cygwin*) exeext=.exe ;;
3965 *) exeext= ;;
3966 esac
3967 $rm $output
3968 trap "$rm $output; exit 1" 1 2 15
3969
3970 $echo > $output "\
3971 #! $SHELL
3972
3973 # $output - temporary wrapper script for $objdir/$outputname
3974 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3975 #
3976 # The $output program cannot be directly executed until all the libtool
3977 # libraries that it depends on are installed.
3978 #
3979 # This wrapper script should never be moved out of the build directory.
3980 # If it is, it will not operate correctly.
3981
3982 # Sed substitution that helps us do robust quoting. It backslashifies
3983 # metacharacters that are still active within double-quoted strings.
3984 Xsed='sed -e 1s/^X//'
3985 sed_quote_subst='$sed_quote_subst'
3986
3987 # The HP-UX ksh and POSIX shell print the target directory to stdout
3988 # if CDPATH is set.
3989 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3990
3991 relink_command=\"$relink_command\"
3992
3993 # This environment variable determines our operation mode.
3994 if test \"\$libtool_install_magic\" = \"$magic\"; then
3995 # install mode needs the following variable:
3996 notinst_deplibs='$notinst_deplibs'
3997 else
3998 # When we are sourced in execute mode, \$file and \$echo are already set.
3999 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4000 echo=\"$qecho\"
4001 file=\"\$0\"
4002 # Make sure echo works.
4003 if test \"X\$1\" = X--no-reexec; then
4004 # Discard the --no-reexec flag, and continue.
4005 shift
4006 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4007 # Yippee, \$echo works!
4008 :
4009 else
4010 # Restart under the correct shell, and then maybe \$echo will work.
4011 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4012 fi
4013 fi\
4014 "
4015 $echo >> $output "\
4016
4017 # Find the directory that this script lives in.
4018 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4019 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4020
4021 # Follow symbolic links until we get to the real thisdir.
4022 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
4023 while test -n \"\$file\"; do
4024 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4025
4026 # If there was a directory component, then change thisdir.
4027 if test \"x\$destdir\" != \"x\$file\"; then
4028 case \"\$destdir\" in
4029 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4030 *) thisdir=\"\$thisdir/\$destdir\" ;;
4031 esac
4032 fi
4033
4034 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4035 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
4036 done
4037
4038 # Try to get the absolute directory name.
4039 absdir=\`cd \"\$thisdir\" && pwd\`
4040 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4041 "
4042
4043 if test "$fast_install" = yes; then
4044 echo >> $output "\
4045 program=lt-'$outputname'$exeext
4046 progdir=\"\$thisdir/$objdir\"
4047
4048 if test ! -f \"\$progdir/\$program\" || \\
4049 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
4050 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4051
4052 file=\"\$\$-\$program\"
4053
4054 if test ! -d \"\$progdir\"; then
4055 $mkdir \"\$progdir\"
4056 else
4057 $rm \"\$progdir/\$file\"
4058 fi"
4059
4060 echo >> $output "\
4061
4062 # relink executable if necessary
4063 if test -n \"\$relink_command\"; then
4064 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4065 else
4066 $echo \"\$relink_command_output\" >&2
4067 $rm \"\$progdir/\$file\"
4068 exit 1
4069 fi
4070 fi
4071
4072 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4073 { $rm \"\$progdir/\$program\";
4074 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4075 $rm \"\$progdir/\$file\"
4076 fi"
4077 else
4078 echo >> $output "\
4079 program='$outputname'
4080 progdir=\"\$thisdir/$objdir\"
4081 "
4082 fi
4083
4084 echo >> $output "\
4085
4086 if test -f \"\$progdir/\$program\"; then"
4087
4088 # Export our shlibpath_var if we have one.
4089 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4090 $echo >> $output "\
4091 # Add our own library path to $shlibpath_var
4092 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4093
4094 # Some systems cannot cope with colon-terminated $shlibpath_var
4095 # The second colon is a workaround for a bug in BeOS R4 sed
4096 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4097
4098 export $shlibpath_var
4099 "
4100 fi
4101
4102 # fixup the dll searchpath if we need to.
4103 if test -n "$dllsearchpath"; then
4104 $echo >> $output "\
4105 # Add the dll search path components to the executable PATH
4106 PATH=$dllsearchpath:\$PATH
4107 "
4108 fi
4109
4110 $echo >> $output "\
4111 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4112 # Run the actual program with our arguments.
4113 "
4114 case $host in
4115 # win32 systems need to use the prog path for dll
4116 # lookup to work
4117 *-*-cygwin* | *-*-pw32*)
4118 $echo >> $output "\
4119 exec \$progdir/\$program \${1+\"\$@\"}
4120 "
4121 ;;
4122
4123 # Backslashes separate directories on plain windows
4124 *-*-mingw | *-*-os2*)
4125 $echo >> $output "\
4126 exec \$progdir\\\\\$program \${1+\"\$@\"}
4127 "
4128 ;;
4129
4130 *)
4131 $echo >> $output "\
4132 # Export the path to the program.
4133 PATH=\"\$progdir:\$PATH\"
4134 export PATH
4135
4136 exec \$program \${1+\"\$@\"}
4137 "
4138 ;;
4139 esac
4140 $echo >> $output "\
4141 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4142 exit 1
4143 fi
4144 else
4145 # The program doesn't exist.
4146 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4147 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4148 echo \"See the $PACKAGE documentation for more information.\" 1>&2
4149 exit 1
4150 fi
4151 fi\
4152 "
4153 chmod +x $output
4154 fi
4155 exit 0
4156 ;;
4157 esac
4158
4159 # See if we need to build an old-fashioned archive.
4160 for oldlib in $oldlibs; do
4161
4162 if test "$build_libtool_libs" = convenience; then
4163 oldobjs="$libobjs_save"
4164 addlibs="$convenience"
4165 build_libtool_libs=no
4166 else
4167 if test "$build_libtool_libs" = module; then
4168 oldobjs="$libobjs_save"
4169 build_libtool_libs=no
4170 else
4171 oldobjs="$objs$old_deplibs $non_pic_objects"
4172 fi
4173 addlibs="$old_convenience"
4174 fi
4175
4176 if test -n "$addlibs"; then
4177 gentop="$output_objdir/${outputname}x"
4178 $show "${rm}r $gentop"
4179 $run ${rm}r "$gentop"
4180 $show "$mkdir $gentop"
4181 $run $mkdir "$gentop"
4182 status=$?
4183 if test $status -ne 0 && test ! -d "$gentop"; then
4184 exit $status
4185 fi
4186 generated="$generated $gentop"
4187
4188 # Add in members from convenience archives.
4189 for xlib in $addlibs; do
4190 # Extract the objects.
4191 case $xlib in
4192 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4193 *) xabs=`pwd`"/$xlib" ;;
4194 esac
4195 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4196 xdir="$gentop/$xlib"
4197
4198 $show "${rm}r $xdir"
4199 $run ${rm}r "$xdir"
4200 $show "$mkdir $xdir"
4201 $run $mkdir "$xdir"
4202 status=$?
4203 if test $status -ne 0 && test ! -d "$xdir"; then
4204 exit $status
4205 fi
4206 $show "(cd $xdir && $AR x $xabs)"
4207 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4208
4209 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP`
4210 done
4211 fi
4212
4213 # Do each command in the archive commands.
4214 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4215 eval cmds=\"$old_archive_from_new_cmds\"
4216 else
4217 # # Ensure that we have .o objects in place in case we decided
4218 # # not to build a shared library, and have fallen back to building
4219 # # static libs even though --disable-static was passed!
4220 # for oldobj in $oldobjs; do
4221 # if test ! -f $oldobj; then
4222 # xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
4223 # if test "X$xdir" = "X$oldobj"; then
4224 # xdir="."
4225 # else
4226 # xdir="$xdir"
4227 # fi
4228 # baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
4229 # obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
4230 # $show "(cd $xdir && ${LN_S} $obj $baseobj)"
4231 # $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
4232 # fi
4233 # done
4234
4235 eval cmds=\"$old_archive_cmds\"
4236
4237 if len=`expr "X$cmds" : ".*"` &&
4238 test $len -le $max_cmd_len; then
4239 :
4240 else
4241 # the command line is too long to link in one step, link in parts
4242 $echo "using piecewise archive linking..."
4243 save_RANLIB=$RANLIB
4244 RANLIB=:
4245 objlist=
4246 concat_cmds=
4247 save_oldobjs=$oldobjs
4248 for obj in $save_oldobjs
4249 do
4250 oldobjs="$objlist $obj"
4251 objlist="$objlist $obj"
4252 eval test_cmds=\"$old_archive_cmds\"
4253 if len=`expr "X$test_cmds" : ".*"` &&
4254 test $len -le $max_cmd_len; then
4255 :
4256 else
4257 # the above command should be used before it gets too long
4258 oldobjs=$objlist
4259 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4260 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
4261 objlist=
4262 fi
4263 done
4264 RANLIB=$save_RANLIB
4265 oldobjs=$objlist
4266 eval cmds=\"\$concat_cmds~$old_archive_cmds\"
4267 fi
4268 fi
4269 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4270 for cmd in $cmds; do
4271 IFS="$save_ifs"
4272 $show "$cmd"
4273 $run eval "$cmd" || exit $?
4274 done
4275 IFS="$save_ifs"
4276 done
4277
4278 if test -n "$generated"; then
4279 $show "${rm}r$generated"
4280 $run ${rm}r$generated
4281 fi
4282
4283 # Now create the libtool archive.
4284 case $output in
4285 *.la)
4286 old_library=
4287 test "$build_old_libs" = yes && old_library="$libname.$libext"
4288 $show "creating $output"
4289
4290 # Preserve any variables that may affect compiler behavior
4291 for var in $variables_saved_for_relink; do
4292 if eval test -z \"\${$var+set}\"; then
4293 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4294 elif eval var_value=\$$var; test -z "$var_value"; then
4295 relink_command="$var=; export $var; $relink_command"
4296 else
4297 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4298 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4299 fi
4300 done
4301 # Quote the link command for shipping.
4302 relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
4303 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4304
4305 # Only create the output if not a dry run.
4306 if test -z "$run"; then
4307 for installed in no yes; do
4308 if test "$installed" = yes; then
4309 if test -z "$install_libdir"; then
4310 break
4311 fi
4312 output="$output_objdir/$outputname"i
4313 # Replace all uninstalled libtool libraries with the installed ones
4314 newdependency_libs=
4315 for deplib in $dependency_libs; do
4316 case $deplib in
4317 *.la)
4318 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
4319 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4320 if test -z "$libdir"; then
4321 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
4322 exit 1
4323 fi
4324 newdependency_libs="$newdependency_libs $libdir/$name"
4325 ;;
4326 *) newdependency_libs="$newdependency_libs $deplib" ;;
4327 esac
4328 done
4329 dependency_libs="$newdependency_libs"
4330 newdlfiles=
4331 for lib in $dlfiles; do
4332 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4333 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4334 if test -z "$libdir"; then
4335 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4336 exit 1
4337 fi
4338 newdlfiles="$newdlfiles $libdir/$name"
4339 done
4340 dlfiles="$newdlfiles"
4341 newdlprefiles=
4342 for lib in $dlprefiles; do
4343 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4344 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4345 if test -z "$libdir"; then
4346 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4347 exit 1
4348 fi
4349 newdlprefiles="$newdlprefiles $libdir/$name"
4350 done
4351 dlprefiles="$newdlprefiles"
4352 fi
4353 $rm $output
4354 # place dlname in correct position for cygwin
4355 tdlname=$dlname
4356 case $host,$output,$installed,$module,$dlname in
4357 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4358 esac
4359 $echo > $output "\
4360 # $outputname - a libtool library file
4361 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4362 #
4363 # Please DO NOT delete this file!
4364 # It is necessary for linking the library.
4365
4366 # The name that we can dlopen(3).
4367 dlname='$tdlname'
4368
4369 # Names of this library.
4370 library_names='$library_names'
4371
4372 # The name of the static archive.
4373 old_library='$old_library'
4374
4375 # Libraries that this one depends upon.
4376 dependency_libs='$dependency_libs'
4377
4378 # Version information for $libname.
4379 current=$current
4380 age=$age
4381 revision=$revision
4382
4383 # Is this an already installed library?
4384 installed=$installed
4385
4386 # Files to dlopen/dlpreopen
4387 dlopen='$dlfiles'
4388 dlpreopen='$dlprefiles'
4389
4390 # Directory that this library needs to be installed in:
4391 libdir='$install_libdir'"
4392 if test "$installed" = no && test $need_relink = yes; then
4393 $echo >> $output "\
4394 relink_command=\"$relink_command\""
4395 fi
4396 done
4397 fi
4398
4399 # Do a symbolic link so that the libtool archive can be found in
4400 # LD_LIBRARY_PATH before the program is installed.
4401 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4402 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4403 ;;
4404 esac
4405 exit 0
4406 ;;
4407
4408 # libtool install mode
4409 install)
4410 modename="$modename: install"
4411
4412 # There may be an optional sh(1) argument at the beginning of
4413 # install_prog (especially on Windows NT).
4414 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4415 # Allow the use of GNU shtool's install command.
4416 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4417 # Aesthetically quote it.
4418 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4419 case $arg in
4420 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4421 arg="\"$arg\""
4422 ;;
4423 esac
4424 install_prog="$arg "
4425 arg="$1"
4426 shift
4427 else
4428 install_prog=
4429 arg="$nonopt"
4430 fi
4431
4432 # The real first argument should be the name of the installation program.
4433 # Aesthetically quote it.
4434 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4435 case $arg in
4436 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4437 arg="\"$arg\""
4438 ;;
4439 esac
4440 install_prog="$install_prog$arg"
4441
4442 # We need to accept at least all the BSD install flags.
4443 dest=
4444 files=
4445 opts=
4446 prev=
4447 install_type=
4448 isdir=no
4449 stripme=
4450 for arg
4451 do
4452 if test -n "$dest"; then
4453 files="$files $dest"
4454 dest="$arg"
4455 continue
4456 fi
4457
4458 case $arg in
4459 -d) isdir=yes ;;
4460 -f) prev="-f" ;;
4461 -g) prev="-g" ;;
4462 -m) prev="-m" ;;
4463 -o) prev="-o" ;;
4464 -s)
4465 stripme=" -s"
4466 continue
4467 ;;
4468 -*) ;;
4469
4470 *)
4471 # If the previous option needed an argument, then skip it.
4472 if test -n "$prev"; then
4473 prev=
4474 else
4475 dest="$arg"
4476 continue
4477 fi
4478 ;;
4479 esac
4480
4481 # Aesthetically quote the argument.
4482 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4483 case $arg in
4484 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4485 arg="\"$arg\""
4486 ;;
4487 esac
4488 install_prog="$install_prog $arg"
4489 done
4490
4491 if test -z "$install_prog"; then
4492 $echo "$modename: you must specify an install program" 1>&2
4493 $echo "$help" 1>&2
4494 exit 1
4495 fi
4496
4497 if test -n "$prev"; then
4498 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4499 $echo "$help" 1>&2
4500 exit 1
4501 fi
4502
4503 if test -z "$files"; then
4504 if test -z "$dest"; then
4505 $echo "$modename: no file or destination specified" 1>&2
4506 else
4507 $echo "$modename: you must specify a destination" 1>&2
4508 fi
4509 $echo "$help" 1>&2
4510 exit 1
4511 fi
4512
4513 # Strip any trailing slash from the destination.
4514 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4515
4516 # Check to see that the destination is a directory.
4517 test -d "$dest" && isdir=yes
4518 if test "$isdir" = yes; then
4519 destdir="$dest"
4520 destname=
4521 else
4522 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4523 test "X$destdir" = "X$dest" && destdir=.
4524 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4525
4526 # Not a directory, so check to see that there is only one file specified.
4527 set dummy $files
4528 if test $# -gt 2; then
4529 $echo "$modename: \`$dest' is not a directory" 1>&2
4530 $echo "$help" 1>&2
4531 exit 1
4532 fi
4533 fi
4534 case $destdir in
4535 [\\/]* | [A-Za-z]:[\\/]*) ;;
4536 *)
4537 for file in $files; do
4538 case $file in
4539 *.lo) ;;
4540 *)
4541 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4542 $echo "$help" 1>&2
4543 exit 1
4544 ;;
4545 esac
4546 done
4547 ;;
4548 esac
4549
4550 # This variable tells wrapper scripts just to set variables rather
4551 # than running their programs.
4552 libtool_install_magic="$magic"
4553
4554 staticlibs=
4555 future_libdirs=
4556 current_libdirs=
4557 for file in $files; do
4558
4559 # Do each installation.
4560 case $file in
4561 *.$libext)
4562 # Do the static libraries later.
4563 staticlibs="$staticlibs $file"
4564 ;;
4565
4566 *.la)
4567 # Check to see that this really is a libtool archive.
4568 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4569 else
4570 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4571 $echo "$help" 1>&2
4572 exit 1
4573 fi
4574
4575 library_names=
4576 old_library=
4577 relink_command=
4578 # If there is no directory component, then add one.
4579 case $file in
4580 */* | *\\*) . $file ;;
4581 *) . ./$file ;;
4582 esac
4583
4584 # Add the libdir to current_libdirs if it is the destination.
4585 if test "X$destdir" = "X$libdir"; then
4586 case "$current_libdirs " in
4587 *" $libdir "*) ;;
4588 *) current_libdirs="$current_libdirs $libdir" ;;
4589 esac
4590 else
4591 # Note the libdir as a future libdir.
4592 case "$future_libdirs " in
4593 *" $libdir "*) ;;
4594 *) future_libdirs="$future_libdirs $libdir" ;;
4595 esac
4596 fi
4597
4598 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4599 test "X$dir" = "X$file/" && dir=
4600 dir="$dir$objdir"
4601
4602 if test -n "$relink_command"; then
4603 $echo "$modename: warning: relinking \`$file'" 1>&2
4604 $show "$relink_command"
4605 if $run eval "$relink_command"; then :
4606 else
4607 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4608 continue
4609 fi
4610 fi
4611
4612 # See the names of the shared library.
4613 set dummy $library_names
4614 if test -n "$2"; then
4615 realname="$2"
4616 shift
4617 shift
4618
4619 srcname="$realname"
4620 test -n "$relink_command" && srcname="$realname"T
4621
4622 # Install the shared library and build the symlinks.
4623 $show "$install_prog $dir/$srcname $destdir/$realname"
4624 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4625 if test -n "$stripme" && test -n "$striplib"; then
4626 $show "$striplib $destdir/$realname"
4627 $run eval "$striplib $destdir/$realname" || exit $?
4628 fi
4629
4630 if test $# -gt 0; then
4631 # Delete the old symlinks, and create new ones.
4632 for linkname
4633 do
4634 if test "$linkname" != "$realname"; then
4635 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4636 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4637 fi
4638 done
4639 fi
4640
4641 # Do each command in the postinstall commands.
4642 lib="$destdir/$realname"
4643 eval cmds=\"$postinstall_cmds\"
4644 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4645 for cmd in $cmds; do
4646 IFS="$save_ifs"
4647 $show "$cmd"
4648 $run eval "$cmd" || exit $?
4649 done
4650 IFS="$save_ifs"
4651 fi
4652
4653 # Install the pseudo-library for information purposes.
4654 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4655 instname="$dir/$name"i
4656 $show "$install_prog $instname $destdir/$name"
4657 $run eval "$install_prog $instname $destdir/$name" || exit $?
4658
4659 # Maybe install the static library, too.
4660 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4661 ;;
4662
4663 *.lo)
4664 # Install (i.e. copy) a libtool object.
4665
4666 # Figure out destination file name, if it wasn't already specified.
4667 if test -n "$destname"; then
4668 destfile="$destdir/$destname"
4669 else
4670 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4671 destfile="$destdir/$destfile"
4672 fi
4673
4674 # Deduce the name of the destination old-style object file.
4675 case $destfile in
4676 *.lo)
4677 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4678 ;;
4679 *.$objext)
4680 staticdest="$destfile"
4681 destfile=
4682 ;;
4683 *)
4684 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4685 $echo "$help" 1>&2
4686 exit 1
4687 ;;
4688 esac
4689
4690 # Install the libtool object if requested.
4691 if test -n "$destfile"; then
4692 $show "$install_prog $file $destfile"
4693 $run eval "$install_prog $file $destfile" || exit $?
4694 fi
4695
4696 # Install the old object if enabled.
4697 if test "$build_old_libs" = yes; then
4698 # Deduce the name of the old-style object file.
4699 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4700
4701 $show "$install_prog $staticobj $staticdest"
4702 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4703 fi
4704 exit 0
4705 ;;
4706
4707 *)
4708 # Figure out destination file name, if it wasn't already specified.
4709 if test -n "$destname"; then
4710 destfile="$destdir/$destname"
4711 else
4712 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4713 destfile="$destdir/$destfile"
4714 fi
4715
4716 # Do a test to see if this is really a libtool program.
4717 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4718 notinst_deplibs=
4719 relink_command=
4720
4721 # If there is no directory component, then add one.
4722 case $file in
4723 */* | *\\*) . $file ;;
4724 *) . ./$file ;;
4725 esac
4726
4727 # Check the variables that should have been set.
4728 if test -z "$notinst_deplibs"; then
4729 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4730 exit 1
4731 fi
4732
4733 finalize=yes
4734 for lib in $notinst_deplibs; do
4735 # Check to see that each library is installed.
4736 libdir=
4737 if test -f "$lib"; then
4738 # If there is no directory component, then add one.
4739 case $lib in
4740 */* | *\\*) . $lib ;;
4741 *) . ./$lib ;;
4742 esac
4743 fi
4744 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4745 if test -n "$libdir" && test ! -f "$libfile"; then
4746 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4747 finalize=no
4748 fi
4749 done
4750
4751 relink_command=
4752 # If there is no directory component, then add one.
4753 case $file in
4754 */* | *\\*) . $file ;;
4755 *) . ./$file ;;
4756 esac
4757
4758 outputname=
4759 if test "$fast_install" = no && test -n "$relink_command"; then
4760 if test "$finalize" = yes && test -z "$run"; then
4761 tmpdir="/tmp"
4762 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4763 tmpdir="$tmpdir/libtool-$$"
4764 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4765 else
4766 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4767 continue
4768 fi
4769 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4770 outputname="$tmpdir/$file"
4771 # Replace the output file specification.
4772 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4773
4774 $show "$relink_command"
4775 if $run eval "$relink_command"; then :
4776 else
4777 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4778 ${rm}r "$tmpdir"
4779 continue
4780 fi
4781 file="$outputname"
4782 else
4783 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4784 fi
4785 else
4786 # Install the binary that we compiled earlier.
4787 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4788 fi
4789 fi
4790
4791
4792 # remove .exe since cygwin /usr/bin/install will append another
4793 # one anyways
4794 case $install_prog,$host in
4795 */usr/bin/install*,*cygwin*)
4796 case $file:$destfile in
4797 *.exe:*.exe)
4798 # this is ok
4799 ;;
4800 *.exe:*)
4801 destfile=$destfile.exe
4802 ;;
4803 *:*.exe)
4804 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4805 ;;
4806 esac
4807 ;;
4808 esac
4809
4810 $show "$install_prog$stripme $file $destfile"
4811 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4812 test -n "$outputname" && ${rm}r "$tmpdir"
4813 ;;
4814 esac
4815 done
4816
4817 for file in $staticlibs; do
4818 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4819
4820 # Set up the ranlib parameters.
4821 oldlib="$destdir/$name"
4822
4823 $show "$install_prog $file $oldlib"
4824 $run eval "$install_prog \$file \$oldlib" || exit $?
4825
4826 if test -n "$stripme" && test -n "$striplib"; then
4827 $show "$old_striplib $oldlib"
4828 $run eval "$old_striplib $oldlib" || exit $?
4829 fi
4830
4831 # Do each command in the postinstall commands.
4832 eval cmds=\"$old_postinstall_cmds\"
4833 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4834 for cmd in $cmds; do
4835 IFS="$save_ifs"
4836 $show "$cmd"
4837 $run eval "$cmd" || exit $?
4838 done
4839 IFS="$save_ifs"
4840 done
4841
4842 if test -n "$future_libdirs"; then
4843 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4844 fi
4845
4846 if test -n "$current_libdirs"; then
4847 # Maybe just do a dry run.
4848 test -n "$run" && current_libdirs=" -n$current_libdirs"
4849 exec_cmd='$SHELL $0 --finish$current_libdirs'
4850 else
4851 exit 0
4852 fi
4853 ;;
4854
4855 # libtool finish mode
4856 finish)
4857 modename="$modename: finish"
4858 libdirs="$nonopt"
4859 admincmds=
4860
4861 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4862 for dir
4863 do
4864 libdirs="$libdirs $dir"
4865 done
4866
4867 for libdir in $libdirs; do
4868 if test -n "$finish_cmds"; then
4869 # Do each command in the finish commands.
4870 eval cmds=\"$finish_cmds\"
4871 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4872 for cmd in $cmds; do
4873 IFS="$save_ifs"
4874 $show "$cmd"
4875 $run eval "$cmd" || admincmds="$admincmds
4876 $cmd"
4877 done
4878 IFS="$save_ifs"
4879 fi
4880 if test -n "$finish_eval"; then
4881 # Do the single finish_eval.
4882 eval cmds=\"$finish_eval\"
4883 $run eval "$cmds" || admincmds="$admincmds
4884 $cmds"
4885 fi
4886 done
4887 fi
4888
4889 # Exit here if they wanted silent mode.
4890 test "$show" = ":" && exit 0
4891
4892 echo "----------------------------------------------------------------------"
4893 echo "Libraries have been installed in:"
4894 for libdir in $libdirs; do
4895 echo " $libdir"
4896 done
4897 echo
4898 echo "If you ever happen to want to link against installed libraries"
4899 echo "in a given directory, LIBDIR, you must either use libtool, and"
4900 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4901 echo "flag during linking and do at least one of the following:"
4902 if test -n "$shlibpath_var"; then
4903 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4904 echo " during execution"
4905 fi
4906 if test -n "$runpath_var"; then
4907 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4908 echo " during linking"
4909 fi
4910 if test -n "$hardcode_libdir_flag_spec"; then
4911 libdir=LIBDIR
4912 eval flag=\"$hardcode_libdir_flag_spec\"
4913
4914 echo " - use the \`$flag' linker flag"
4915 fi
4916 if test -n "$admincmds"; then
4917 echo " - have your system administrator run these commands:$admincmds"
4918 fi
4919 if test -f /etc/ld.so.conf; then
4920 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4921 fi
4922 echo
4923 echo "See any operating system documentation about shared libraries for"
4924 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4925 echo "----------------------------------------------------------------------"
4926 exit 0
4927 ;;
4928
4929 # libtool execute mode
4930 execute)
4931 modename="$modename: execute"
4932
4933 # The first argument is the command name.
4934 cmd="$nonopt"
4935 if test -z "$cmd"; then
4936 $echo "$modename: you must specify a COMMAND" 1>&2
4937 $echo "$help"
4938 exit 1
4939 fi
4940
4941 # Handle -dlopen flags immediately.
4942 for file in $execute_dlfiles; do
4943 if test ! -f "$file"; then
4944 $echo "$modename: \`$file' is not a file" 1>&2
4945 $echo "$help" 1>&2
4946 exit 1
4947 fi
4948
4949 dir=
4950 case $file in
4951 *.la)
4952 # Check to see that this really is a libtool archive.
4953 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4954 else
4955 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4956 $echo "$help" 1>&2
4957 exit 1
4958 fi
4959
4960 # Read the libtool library.
4961 dlname=
4962 library_names=
4963
4964 # If there is no directory component, then add one.
4965 case $file in
4966 */* | *\\*) . $file ;;
4967 *) . ./$file ;;
4968 esac
4969
4970 # Skip this library if it cannot be dlopened.
4971 if test -z "$dlname"; then
4972 # Warn if it was a shared library.
4973 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4974 continue
4975 fi
4976
4977 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4978 test "X$dir" = "X$file" && dir=.
4979
4980 if test -f "$dir/$objdir/$dlname"; then
4981 dir="$dir/$objdir"
4982 else
4983 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4984 exit 1
4985 fi
4986 ;;
4987
4988 *.lo)
4989 # Just add the directory containing the .lo file.
4990 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4991 test "X$dir" = "X$file" && dir=.
4992 ;;
4993
4994 *)
4995 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4996 continue
4997 ;;
4998 esac
4999
5000 # Get the absolute pathname.
5001 absdir=`cd "$dir" && pwd`
5002 test -n "$absdir" && dir="$absdir"
5003
5004 # Now add the directory to shlibpath_var.
5005 if eval "test -z \"\$$shlibpath_var\""; then
5006 eval "$shlibpath_var=\"\$dir\""
5007 else
5008 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5009 fi
5010 done
5011
5012 # This variable tells wrapper scripts just to set shlibpath_var
5013 # rather than running their programs.
5014 libtool_execute_magic="$magic"
5015
5016 # Check if any of the arguments is a wrapper script.
5017 args=
5018 for file
5019 do
5020 case $file in
5021 -*) ;;
5022 *)
5023 # Do a test to see if this is really a libtool program.
5024 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5025 # If there is no directory component, then add one.
5026 case $file in
5027 */* | *\\*) . $file ;;
5028 *) . ./$file ;;
5029 esac
5030
5031 # Transform arg to wrapped name.
5032 file="$progdir/$program"
5033 fi
5034 ;;
5035 esac
5036 # Quote arguments (to preserve shell metacharacters).
5037 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5038 args="$args \"$file\""
5039 done
5040
5041 if test -z "$run"; then
5042 if test -n "$shlibpath_var"; then
5043 # Export the shlibpath_var.
5044 eval "export $shlibpath_var"
5045 fi
5046
5047 # Restore saved enviroment variables
5048 if test "${save_LC_ALL+set}" = set; then
5049 LC_ALL="$save_LC_ALL"; export LC_ALL
5050 fi
5051 if test "${save_LANG+set}" = set; then
5052 LANG="$save_LANG"; export LANG
5053 fi
5054
5055 # Now prepare to actually exec the command.
5056 exec_cmd='"$cmd"$args'
5057 else
5058 # Display what would be done.
5059 if test -n "$shlibpath_var"; then
5060 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5061 $echo "export $shlibpath_var"
5062 fi
5063 $echo "$cmd$args"
5064 exit 0
5065 fi
5066 ;;
5067
5068 # libtool clean and uninstall mode
5069 clean | uninstall)
5070 modename="$modename: $mode"
5071 rm="$nonopt"
5072 files=
5073 rmforce=
5074 exit_status=0
5075
5076 # This variable tells wrapper scripts just to set variables rather
5077 # than running their programs.
5078 libtool_install_magic="$magic"
5079
5080 for arg
5081 do
5082 case $arg in
5083 -f) rm="$rm $arg"; rmforce=yes ;;
5084 -*) rm="$rm $arg" ;;
5085 *) files="$files $arg" ;;
5086 esac
5087 done
5088
5089 if test -z "$rm"; then
5090 $echo "$modename: you must specify an RM program" 1>&2
5091 $echo "$help" 1>&2
5092 exit 1
5093 fi
5094
5095 rmdirs=
5096
5097 for file in $files; do
5098 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5099 if test "X$dir" = "X$file"; then
5100 dir=.
5101 objdir="$objdir"
5102 else
5103 objdir="$dir/$objdir"
5104 fi
5105 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5106 test $mode = uninstall && objdir="$dir"
5107
5108 # Remember objdir for removal later, being careful to avoid duplicates
5109 if test $mode = clean; then
5110 case " $rmdirs " in
5111 *" $objdir "*) ;;
5112 *) rmdirs="$rmdirs $objdir" ;;
5113 esac
5114 fi
5115
5116 # Don't error if the file doesn't exist and rm -f was used.
5117 if (test -L "$file") >/dev/null 2>&1 \
5118 || (test -h "$file") >/dev/null 2>&1 \
5119 || test -f "$file"; then
5120 :
5121 elif test -d "$file"; then
5122 exit_status=1
5123 continue
5124 elif test "$rmforce" = yes; then
5125 continue
5126 fi
5127
5128 rmfiles="$file"
5129
5130 case $name in
5131 *.la)
5132 # Possibly a libtool archive, so verify it.
5133 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5134 . $dir/$name
5135
5136 # Delete the libtool libraries and symlinks.
5137 for n in $library_names; do
5138 rmfiles="$rmfiles $objdir/$n"
5139 done
5140 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
5141 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
5142
5143 if test $mode = uninstall; then
5144 if test -n "$library_names"; then
5145 # Do each command in the postuninstall commands.
5146 eval cmds=\"$postuninstall_cmds\"
5147 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
5148 for cmd in $cmds; do
5149 IFS="$save_ifs"
5150 $show "$cmd"
5151 $run eval "$cmd"
5152 if test $? != 0 && test "$rmforce" != yes; then
5153 exit_status=1
5154 fi
5155 done
5156 IFS="$save_ifs"
5157 fi
5158
5159 if test -n "$old_library"; then
5160 # Do each command in the old_postuninstall commands.
5161 eval cmds=\"$old_postuninstall_cmds\"
5162 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
5163 for cmd in $cmds; do
5164 IFS="$save_ifs"
5165 $show "$cmd"
5166 $run eval "$cmd"
5167 if test $? != 0 && test "$rmforce" != yes; then
5168 exit_status=1
5169 fi
5170 done
5171 IFS="$save_ifs"
5172 fi
5173 # FIXME: should reinstall the best remaining shared library.
5174 fi
5175 fi
5176 ;;
5177
5178 *.lo)
5179 # Possibly a libtool object, so verify it.
5180 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5181
5182 # Read the .lo file
5183 . $dir/$name
5184
5185 # Add PIC object to the list of files to remove.
5186 if test -n "$pic_object" \
5187 && test "$pic_object" != none; then
5188 rmfiles="$rmfiles $dir/$pic_object"
5189 fi
5190
5191 # Add non-PIC object to the list of files to remove.
5192 if test -n "$non_pic_object" \
5193 && test "$non_pic_object" != none; then
5194 rmfiles="$rmfiles $dir/$non_pic_object"
5195 fi
5196 fi
5197 ;;
5198
5199 *)
5200 # Do a test to see if this is a libtool program.
5201 if test $mode = clean &&
5202 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5203 relink_command=
5204 . $dir/$file
5205
5206 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
5207 if test "$fast_install" = yes && test -n "$relink_command"; then
5208 rmfiles="$rmfiles $objdir/lt-$name"
5209 fi
5210 fi
5211 ;;
5212 esac
5213 $show "$rm $rmfiles"
5214 $run $rm $rmfiles || exit_status=1
5215 done
5216
5217 # Try to remove the ${objdir}s in the directories where we deleted files
5218 for dir in $rmdirs; do
5219 if test -d "$dir"; then
5220 $show "rmdir $dir"
5221 $run rmdir $dir >/dev/null 2>&1
5222 fi
5223 done
5224
5225 exit $exit_status
5226 ;;
5227
5228 "")
5229 $echo "$modename: you must specify a MODE" 1>&2
5230 $echo "$generic_help" 1>&2
5231 exit 1
5232 ;;
5233 esac
5234
5235 if test -z "$exec_cmd"; then
5236 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5237 $echo "$generic_help" 1>&2
5238 exit 1
5239 fi
5240 fi # test -z "$show_help"
5241
5242 if test -n "$exec_cmd"; then
5243 eval exec $exec_cmd
5244 exit 1
5245 fi
5246
5247 # We need to display help for each of the modes.
5248 case $mode in
5249 "") $echo \
5250 "Usage: $modename [OPTION]... [MODE-ARG]...
5251
5252 Provide generalized library-building support services.
5253
5254 --config show all configuration variables
5255 --debug enable verbose shell tracing
5256 -n, --dry-run display commands without modifying any files
5257 --features display basic configuration information and exit
5258 --finish same as \`--mode=finish'
5259 --help display this help message and exit
5260 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
5261 --quiet same as \`--silent'
5262 --silent don't print informational messages
5263 --tag=TAG use configuration variables from tag TAG
5264 --version print version information
5265
5266 MODE must be one of the following:
5267
5268 clean remove files from the build directory
5269 compile compile a source file into a libtool object
5270 execute automatically set library path, then run a program
5271 finish complete the installation of libtool libraries
5272 install install libraries or executables
5273 link create a library or an executable
5274 uninstall remove libraries from an installed directory
5275
5276 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
5277 a more detailed description of MODE."
5278 exit 0
5279 ;;
5280
5281 clean)
5282 $echo \
5283 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
5284
5285 Remove files from the build directory.
5286
5287 RM is the name of the program to use to delete files associated with each FILE
5288 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5289 to RM.
5290
5291 If FILE is a libtool library, object or program, all the files associated
5292 with it are deleted. Otherwise, only FILE itself is deleted using RM."
5293 ;;
5294
5295 compile)
5296 $echo \
5297 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
5298
5299 Compile a source file into a libtool library object.
5300
5301 This mode accepts the following additional options:
5302
5303 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
5304 -prefer-pic try to building PIC objects only
5305 -prefer-non-pic try to building non-PIC objects only
5306 -static always build a \`.o' file suitable for static linking
5307
5308 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
5309 from the given SOURCEFILE.
5310
5311 The output file name is determined by removing the directory component from
5312 SOURCEFILE, then substituting the C source code suffix \`.c' with the
5313 library object suffix, \`.lo'."
5314 ;;
5315
5316 execute)
5317 $echo \
5318 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
5319
5320 Automatically set library path, then run a program.
5321
5322 This mode accepts the following additional options:
5323
5324 -dlopen FILE add the directory containing FILE to the library path
5325
5326 This mode sets the library path environment variable according to \`-dlopen'
5327 flags.
5328
5329 If any of the ARGS are libtool executable wrappers, then they are translated
5330 into their corresponding uninstalled binary, and any of their required library
5331 directories are added to the library path.
5332
5333 Then, COMMAND is executed, with ARGS as arguments."
5334 ;;
5335
5336 finish)
5337 $echo \
5338 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
5339
5340 Complete the installation of libtool libraries.
5341
5342 Each LIBDIR is a directory that contains libtool libraries.
5343
5344 The commands that this mode executes may require superuser privileges. Use
5345 the \`--dry-run' option if you just want to see what would be executed."
5346 ;;
5347
5348 install)
5349 $echo \
5350 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
5351
5352 Install executables or libraries.
5353
5354 INSTALL-COMMAND is the installation command. The first component should be
5355 either the \`install' or \`cp' program.
5356
5357 The rest of the components are interpreted as arguments to that command (only
5358 BSD-compatible install options are recognized)."
5359 ;;
5360
5361 link)
5362 $echo \
5363 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5364
5365 Link object files or libraries together to form another library, or to
5366 create an executable program.
5367
5368 LINK-COMMAND is a command using the C compiler that you would use to create
5369 a program from several object files.
5370
5371 The following components of LINK-COMMAND are treated specially:
5372
5373 -all-static do not do any dynamic linking at all
5374 -avoid-version do not add a version suffix if possible
5375 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
5376 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5377 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5378 -export-symbols SYMFILE
5379 try to export only the symbols listed in SYMFILE
5380 -export-symbols-regex REGEX
5381 try to export only the symbols matching REGEX
5382 -LLIBDIR search LIBDIR for required installed libraries
5383 -lNAME OUTPUT-FILE requires the installed library libNAME
5384 -module build a library that can dlopened
5385 -no-fast-install disable the fast-install mode
5386 -no-install link a not-installable executable
5387 -no-undefined declare that a library does not refer to external symbols
5388 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5389 -objectlist FILE Use a list of object files found in FILE to specify objects
5390 -release RELEASE specify package release information
5391 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5392 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5393 -static do not do any dynamic linking of libtool libraries
5394 -version-info CURRENT[:REVISION[:AGE]]
5395 specify library version info [each variable defaults to 0]
5396
5397 All other options (arguments beginning with \`-') are ignored.
5398
5399 Every other argument is treated as a filename. Files ending in \`.la' are
5400 treated as uninstalled libtool libraries, other files are standard or library
5401 object files.
5402
5403 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5404 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5405 required, except when creating a convenience library.
5406
5407 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5408 using \`ar' and \`ranlib', or on Windows using \`lib'.
5409
5410 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5411 is created, otherwise an executable program is created."
5412 ;;
5413
5414 uninstall)
5415 $echo \
5416 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5417
5418 Remove libraries from an installation directory.
5419
5420 RM is the name of the program to use to delete files associated with each FILE
5421 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5422 to RM.
5423
5424 If FILE is a libtool library, all the files associated with it are deleted.
5425 Otherwise, only FILE itself is deleted using RM."
5426 ;;
5427
5428 *)
5429 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5430 $echo "$help" 1>&2
5431 exit 1
5432 ;;
5433 esac
5434
5435 echo
5436 $echo "Try \`$modename --help' for more information about other modes."
5437
5438 exit 0
5439
5440 # The TAGs below are defined such that we never get into a situation
5441 # in which we disable both kinds of libraries. Given conflicting
5442 # choices, we go for a static library, that is the most portable,
5443 # since we can't tell whether shared libraries were disabled because
5444 # the user asked for that or because the platform doesn't support
5445 # them. This is particularly important on AIX, because we don't
5446 # support having both static and shared libraries enabled at the same
5447 # time on that platform, so we default to a shared-only configuration.
5448 # If a disable-shared tag is given, we'll fallback to a static-only
5449 # configuration. But we'll never go from static-only to shared-only.
5450
5451 ### BEGIN LIBTOOL TAG CONFIG: disable-shared
5452 build_libtool_libs=no
5453 build_old_libs=yes
5454 ### END LIBTOOL TAG CONFIG: disable-shared
5455
5456 ### BEGIN LIBTOOL TAG CONFIG: disable-static
5457 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5458 ### END LIBTOOL TAG CONFIG: disable-static
5459
5460 # Local Variables:
5461 # mode:shell-script
5462 # sh-indentation:2
5463 # End: