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