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