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