]> git.ipfire.org Git - thirdparty/gcc.git/blame - ltmain.sh
Makefile.am: Make a libtool convenience library.
[thirdparty/gcc.git] / ltmain.sh
CommitLineData
6599da04 1# ltmain.sh - Provide generalized library-building support services.
cf4ccd63
JL
2# NOTE: Changing this file will not affect anything until you rerun ltconfig.
3#
82e23236
AO
4# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5# Free Software Foundation, Inc.
d207ebef 6# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6599da04
JM
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
fbd836fc
ILT
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
90fb0c24 31elif test "X$1" = X--fallback-echo; then
d207ebef
JM
32 # Avoid inline document here, it may be left over
33 :
fbd836fc
ILT
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
d207ebef
JM
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
6599da04 51# The name of this program.
cf4ccd63
JL
52progname=`$echo "$0" | sed 's%^.*/%%'`
53modename="$progname"
6599da04
JM
54
55# Constants.
56PROGRAM=ltmain.sh
57PACKAGE=libtool
4f4caf92 58VERSION=1.4a
82e23236 59TIMESTAMP=" (1.641.2.198 2001/03/20 05:47:28)"
6599da04
JM
60
61default_mode=
62help="Try \`$progname --help' for more information."
63magic="%%%MAGIC variable%%%"
64mkdir="mkdir"
65mv="mv -f"
6599da04
JM
66rm="rm -f"
67
cf4ccd63
JL
68# Sed substitution that helps us do robust quoting. It backslashifies
69# metacharacters that are still active within double-quoted strings.
90fb0c24 70Xsed='sed -e 1s/^X//'
cf4ccd63 71sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
90fb0c24 72SP2NL='tr \040 \012'
d207ebef 73NL2SP='tr \015\012 \040\040'
cf4ccd63
JL
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).
fbd836fc
ILT
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
cf4ccd63 86
6599da04 87if test "$LTCONFIG_VERSION" != "$VERSION"; then
cf4ccd63 88 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
6599da04
JM
89 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
90 exit 1
91fi
92
6599da04 93if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
cf4ccd63 94 echo "$modename: not configured to build any kind of library" 1>&2
6599da04
JM
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=
cf4ccd63 105show="$echo"
6599da04 106show_help=
cf4ccd63 107execute_dlfiles=
fbd836fc 108lo2o="s/\\.lo\$/.${objext}/"
d207ebef 109o2lo="s/\\.${objext}\$/.lo/"
6599da04
JM
110
111# Parse our command line options once, thoroughly.
112while test $# -gt 0
113do
114 arg="$1"
115 shift
116
82e23236 117 case $arg in
cf4ccd63 118 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
6599da04
JM
119 *) optarg= ;;
120 esac
121
122 # If the previous option needs an argument, assign it.
123 if test -n "$prev"; then
82e23236 124 case $prev in
cf4ccd63 125 execute_dlfiles)
82e23236 126 execute_dlfiles="$execute_dlfiles $arg"
cf4ccd63 127 ;;
4f4caf92
AO
128 tag)
129 tagname="$arg"
130
131 # Check whether tagname contains only valid characters
82e23236 132 case $tagname in
4f4caf92
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 ;;
cf4ccd63
JL
147 *)
148 eval "$prev=\$arg"
149 ;;
150 esac
151
6599da04
JM
152 prev=
153 prevopt=
154 continue
155 fi
156
157 # Have we seen a non-optional argument yet?
82e23236 158 case $arg in
6599da04
JM
159 --help)
160 show_help=yes
161 ;;
162
163 --version)
90fb0c24 164 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
6599da04
JM
165 exit 0
166 ;;
167
cf4ccd63 168 --config)
4f4caf92
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
cf4ccd63
JL
174 exit 0
175 ;;
176
177 --debug)
178 echo "$progname: enabling shell trace mode"
179 set -x
180 ;;
181
6599da04
JM
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
cf4ccd63
JL
206 --quiet | --silent)
207 show=:
208 ;;
209
4f4caf92
AO
210 --tag) prevopt="--tag" prev=tag ;;
211 --tag=*)
212 set tag "$optarg" ${1+"$@"}
213 shift
214 prev=tag
215 ;;
216
cf4ccd63
JL
217 -dlopen)
218 prevopt="-dlopen"
219 prev=execute_dlfiles
220 ;;
221
6599da04 222 -*)
cf4ccd63
JL
223 $echo "$modename: unrecognized option \`$arg'" 1>&2
224 $echo "$help" 1>&2
6599da04
JM
225 exit 1
226 ;;
227
228 *)
229 nonopt="$arg"
230 break
231 ;;
232 esac
233done
234
6599da04 235if test -n "$prevopt"; then
cf4ccd63
JL
236 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
237 $echo "$help" 1>&2
6599da04
JM
238 exit 1
239fi
240
6599da04
JM
241if test -z "$show_help"; then
242
243 # Infer the operation mode.
244 if test -z "$mode"; then
82e23236 245 case $nonopt in
cf4ccd63 246 *cc | *++ | gcc* | *-gcc*)
6599da04
JM
247 mode=link
248 for arg
249 do
82e23236 250 case $arg in
90fb0c24
TT
251 -c)
252 mode=compile
253 break
254 ;;
255 esac
6599da04
JM
256 done
257 ;;
fbd836fc 258 *db | *dbx | *strace | *truss)
cf4ccd63
JL
259 mode=execute
260 ;;
261 *install*|cp|mv)
6599da04
JM
262 mode=install
263 ;;
264 *rm)
265 mode=uninstall
266 ;;
6599da04 267 *)
cf4ccd63
JL
268 # If we have no mode, but dlfiles were specified, then do execute mode.
269 test -n "$execute_dlfiles" && mode=execute
270
6599da04
JM
271 # Just use the default operation mode.
272 if test -z "$mode"; then
90fb0c24
TT
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
6599da04
JM
278 fi
279 ;;
280 esac
281 fi
282
cf4ccd63
JL
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
6599da04
JM
290 # Change the help message to a mode-specific one.
291 generic_help="$help"
cf4ccd63 292 help="Try \`$modename --help --mode=$mode' for more information."
6599da04
JM
293
294 # These modes are in order of execution frequency so that they run quickly.
82e23236 295 case $mode in
6599da04
JM
296 # libtool compile mode
297 compile)
cf4ccd63 298 modename="$modename: compile"
6599da04 299 # Get the compilation command and the source file.
cf4ccd63 300 base_compile=
4f4caf92 301 prev=
6599da04 302 lastarg=
cf4ccd63
JL
303 srcfile="$nonopt"
304 suppress_output=
6599da04 305
90fb0c24 306 user_target=no
6599da04
JM
307 for arg
308 do
82e23236 309 case $prev in
4f4caf92
AO
310 "") ;;
311 xcompiler)
312 # Aesthetically quote the previous argument.
313 prev=
314 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
315
82e23236 316 case $arg in
4f4caf92
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
cf4ccd63 335 # Accept any command-line options.
82e23236 336 case $arg in
cf4ccd63 337 -o)
90fb0c24
TT
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
cf4ccd63
JL
343 ;;
344
345 -static)
cf4ccd63
JL
346 build_old_libs=yes
347 continue
348 ;;
4f4caf92
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.
82e23236 375 case $arg in
4f4caf92
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 ;;
6599da04
JM
393 esac
394
82e23236 395 case $user_target in
90fb0c24
TT
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
cf4ccd63
JL
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.
4f4caf92
AO
421 # Many Bourne shells cannot handle close brackets correctly
422 # in scan sets, so we specify it separately.
82e23236 423 case $lastarg in
4f4caf92 424 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
cf4ccd63
JL
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
6599da04
JM
435 done
436
82e23236 437 case $user_target in
90fb0c24
TT
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
6599da04
JM
449
450 # Recognize several different file suffixes.
90fb0c24
TT
451 # If the user specifies -o file.o, it is replaced with file.lo
452 xform='[cCFSfmso]'
82e23236 453 case $libobj in
cf4ccd63
JL
454 *.ada) xform=ada ;;
455 *.adb) xform=adb ;;
456 *.ads) xform=ads ;;
457 *.asm) xform=asm ;;
458 *.c++) xform=c++ ;;
6599da04 459 *.cc) xform=cc ;;
4f4caf92 460 *.class) xform=class ;;
6599da04
JM
461 *.cpp) xform=cpp ;;
462 *.cxx) xform=cxx ;;
463 *.f90) xform=f90 ;;
cf4ccd63 464 *.for) xform=for ;;
4f4caf92 465 *.java) xform=java ;;
6599da04
JM
466 esac
467
cf4ccd63 468 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
6599da04 469
82e23236 470 case $libobj in
fbd836fc 471 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
6599da04 472 *)
90fb0c24 473 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
6599da04
JM
474 exit 1
475 ;;
476 esac
477
4f4caf92
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.
06298abd 487 "`$echo $CC` "*) ;;
4f4caf92
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 ;;
06298abd 501 "`$echo $CC` "*)
4f4caf92
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
6599da04 531 if test -z "$base_compile"; then
cf4ccd63
JL
532 $echo "$modename: you must specify a compilation command" 1>&2
533 $echo "$help" 1>&2
6599da04
JM
534 exit 1
535 fi
536
537 # Delete any leftover library objects.
538 if test "$build_old_libs" = yes; then
4f4caf92 539 removelist="$obj $lobj $libobj ${libobj}T"
6599da04 540 else
4f4caf92 541 removelist="$lobj $libobj ${libobj}T"
90fb0c24
TT
542 fi
543
544 $run $rm $removelist
545 trap "$run $rm $removelist; exit 1" 1 2 15
546
4f4caf92 547 # On Cygwin there's no "real" PIC flag so we must build both object types
82e23236 548 case $host_os in
3dd7094e 549 cygwin* | mingw* | pw32* | os2*)
4f4caf92
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
90fb0c24
TT
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
3dd7094e 561 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
90fb0c24
TT
562 lockfile="$output_obj.lock"
563 removelist="$removelist $output_obj $lockfile"
564 trap "$run $rm $removelist; exit 1" 1 2 15
565 else
4f4caf92 566 output_obj=
90fb0c24
TT
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
06298abd 574 until $run ln "$0" "$lockfile" 2>/dev/null; do
90fb0c24
TT
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"
6599da04
JM
595 fi
596
fbd836fc
ILT
597 if test -n "$fix_srcfile_path"; then
598 eval srcfile=\"$fix_srcfile_path\"
599 fi
600
4f4caf92
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
6599da04
JM
615 # Only build a PIC object if we are building libtool libraries.
616 if test "$build_libtool_libs" = yes; then
cf4ccd63
JL
617 # Without this assignment, base_compile gets emptied.
618 fbsd_hideous_sh_bug=$base_compile
619
4f4caf92
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"
90fb0c24 625 fi
4f4caf92
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"
90fb0c24
TT
639 fi
640
4f4caf92
AO
641 $run $rm "$lobj" "$output_obj"
642
90fb0c24
TT
643 $show "$command"
644 if $run eval "$command"; then :
6599da04 645 else
90fb0c24
TT
646 test -n "$output_obj" && $run $rm $removelist
647 exit 1
6599da04
JM
648 fi
649
90fb0c24
TT
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
4f4caf92
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 :
90fb0c24
TT
674 else
675 error=$?
676 $run $rm $removelist
677 exit $error
678 fi
6599da04
JM
679 fi
680
4f4caf92
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'
90fb0c24 684
4f4caf92 685EOF
cf4ccd63
JL
686
687 # Allow error messages only from the first compilation.
688 suppress_output=' >/dev/null 2>&1'
4f4caf92
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
6599da04
JM
696 fi
697
698 # Only build a position-dependent object if we build old libraries.
699 if test "$build_old_libs" = yes; then
4f4caf92
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
90fb0c24
TT
706 if test "$compiler_c_o" = yes; then
707 command="$command -o $obj"
90fb0c24
TT
708 fi
709
cf4ccd63 710 # Suppress compiler output if we already did a PIC compilation.
90fb0c24 711 command="$command$suppress_output"
4f4caf92 712 $run $rm "$obj" "$output_obj"
90fb0c24
TT
713 $show "$command"
714 if $run eval "$command"; then :
6599da04 715 else
90fb0c24
TT
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
4f4caf92 741 if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then
90fb0c24
TT
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
4f4caf92
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
6599da04
JM
766 fi
767
4f4caf92
AO
768 $run $mv "${libobj}T" "${libobj}"
769
90fb0c24
TT
770 # Unlock the critical section if it was locked
771 if test "$need_locks" != no; then
06298abd 772 $run $rm "$lockfile"
6599da04
JM
773 fi
774
775 exit 0
776 ;;
777
778 # libtool link mode
4f4caf92 779 link | relink)
cf4ccd63 780 modename="$modename: link"
82e23236 781 case $host in
3dd7094e 782 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
90fb0c24
TT
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
90fb0c24
TT
795 ;;
796 *)
797 allow_undefined=yes
798 ;;
799 esac
4f4caf92
AO
800 libtool_args="$nonopt"
801 base_compile="$nonopt"
d207ebef
JM
802 compile_command="$nonopt"
803 finalize_command="$nonopt"
cf4ccd63 804
90fb0c24
TT
805 compile_rpath=
806 finalize_rpath=
6599da04
JM
807 compile_shlibpath=
808 finalize_shlibpath=
fbd836fc
ILT
809 convenience=
810 old_convenience=
6599da04 811 deplibs=
4f4caf92
AO
812 old_deplibs=
813 compiler_flags=
814 linker_flags=
815 dllsearchpath=
816 lib_search_path=`pwd`
90fb0c24 817
90fb0c24 818 avoid_version=no
cf4ccd63
JL
819 dlfiles=
820 dlprefiles=
90fb0c24 821 dlself=no
6599da04 822 export_dynamic=no
90fb0c24
TT
823 export_symbols=
824 export_symbols_regex=
fbd836fc 825 generated=
6599da04 826 libobjs=
6599da04 827 ltlibs=
90fb0c24 828 module=no
4f4caf92 829 no_install=no
6599da04 830 objs=
4f4caf92 831 non_pic_objects=
d207ebef 832 prefer_static_libs=no
90fb0c24 833 preload=no
6599da04
JM
834 prev=
835 prevarg=
cf4ccd63
JL
836 release=
837 rpath=
90fb0c24 838 xrpath=
6599da04
JM
839 perm_rpath=
840 temp_rpath=
90fb0c24 841 thread_safe=no
6599da04
JM
842 vinfo=
843
844 # We need to know -static, to get the right output filenames.
845 for arg
846 do
82e23236 847 case $arg in
cf4ccd63 848 -all-static | -static)
d207ebef
JM
849 if test "X$arg" = "X-all-static"; then
850 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
cf4ccd63 851 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
d207ebef
JM
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
90fb0c24
TT
860 fi
861 build_libtool_libs=no
cf4ccd63 862 build_old_libs=yes
d207ebef 863 prefer_static_libs=yes
90fb0c24
TT
864 break
865 ;;
6599da04
JM
866 esac
867 done
868
cf4ccd63
JL
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.
fbd836fc
ILT
873 while test $# -gt 0; do
874 arg="$1"
4f4caf92 875 base_compile="$base_compile $arg"
fbd836fc 876 shift
82e23236 877 case $arg in
4f4caf92
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"
fbd836fc 884
6599da04
JM
885 # If the previous option needs an argument, assign it.
886 if test -n "$prev"; then
82e23236 887 case $prev in
90fb0c24
TT
888 output)
889 compile_command="$compile_command @OUTPUT@"
890 finalize_command="$finalize_command @OUTPUT@"
891 ;;
892 esac
893
82e23236 894 case $prev in
90fb0c24
TT
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
82e23236 902 case $arg in
90fb0c24 903 *.la | *.lo) ;; # We handle these cases below.
d207ebef
JM
904 force)
905 if test "$dlself" = no; then
906 dlself=needless
907 export_dynamic=yes
908 fi
909 prev=
910 continue
911 ;;
90fb0c24
TT
912 self)
913 if test "$prev" = dlprefiles; then
914 dlself=yes
915 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
916 dlself=yes
d207ebef
JM
917 else
918 dlself=needless
919 export_dynamic=yes
90fb0c24
TT
920 fi
921 prev=
922 continue
923 ;;
924 *)
d207ebef
JM
925 if test "$prev" = dlfiles; then
926 dlfiles="$dlfiles $arg"
927 else
928 dlprefiles="$dlprefiles $arg"
929 fi
90fb0c24 930 prev=
4f4caf92 931 continue
90fb0c24
TT
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 ;;
cf4ccd63
JL
949 release)
950 release="-$arg"
951 prev=
952 continue
953 ;;
82e23236
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 ;;
d207ebef
JM
1061 rpath | xrpath)
1062 # We need an absolute path.
82e23236 1063 case $arg in
d207ebef
JM
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
90fb0c24
TT
1081 prev=
1082 continue
1083 ;;
4f4caf92
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 ;;
90fb0c24
TT
1099 *)
1100 eval "$prev=\"\$arg\""
1101 prev=
1102 continue
1103 ;;
1104 esac
6599da04
JM
1105 fi
1106
6599da04
JM
1107 prevarg="$arg"
1108
82e23236 1109 case $arg in
cf4ccd63
JL
1110 -all-static)
1111 if test -n "$link_static_flag"; then
90fb0c24 1112 compile_command="$compile_command $link_static_flag"
cf4ccd63 1113 finalize_command="$finalize_command $link_static_flag"
90fb0c24
TT
1114 fi
1115 continue
cf4ccd63 1116 ;;
6599da04 1117
cf4ccd63
JL
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
6599da04
JM
1121 continue
1122 ;;
1123
90fb0c24
TT
1124 -avoid-version)
1125 avoid_version=yes
1126 continue
1127 ;;
1128
cf4ccd63 1129 -dlopen)
90fb0c24
TT
1130 prev=dlfiles
1131 continue
1132 ;;
6599da04 1133
cf4ccd63 1134 -dlpreopen)
90fb0c24
TT
1135 prev=dlprefiles
1136 continue
1137 ;;
6599da04 1138
cf4ccd63 1139 -export-dynamic)
d207ebef
JM
1140 export_dynamic=yes
1141 continue
90fb0c24 1142 ;;
6599da04 1143
90fb0c24
TT
1144 -export-symbols | -export-symbols-regex)
1145 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
d207ebef 1146 $echo "$modename: not more than one -exported-symbols argument allowed"
90fb0c24
TT
1147 exit 1
1148 fi
d207ebef 1149 if test "X$arg" = "X-export-symbols"; then
90fb0c24
TT
1150 prev=expsyms
1151 else
1152 prev=expsyms_regex
1153 fi
1154 continue
1155 ;;
6599da04 1156
06298abd
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
cf4ccd63 1169 -L*)
d207ebef
JM
1170 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1171 # We need an absolute path.
82e23236 1172 case $dir in
d207ebef 1173 [\\/]* | [A-Za-z]:[\\/]*) ;;
90fb0c24 1174 *)
d207ebef
JM
1175 absdir=`cd "$dir" && pwd`
1176 if test -z "$absdir"; then
4f4caf92
AO
1177 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1178 exit 1
d207ebef
JM
1179 fi
1180 dir="$absdir"
90fb0c24
TT
1181 ;;
1182 esac
4f4caf92
AO
1183 case "$deplibs " in
1184 *" -L$dir "*) ;;
1185 *)
1186 deplibs="$deplibs -L$dir"
1187 lib_search_path="$lib_search_path $dir"
1188 ;;
90fb0c24 1189 esac
82e23236 1190 case $host in
3dd7094e 1191 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
82e23236 1192 case :$dllsearchpath: in
4f4caf92
AO
1193 *":$dir:"*) ;;
1194 *) dllsearchpath="$dllsearchpath:$dir";;
90fb0c24
TT
1195 esac
1196 ;;
1197 esac
4f4caf92 1198 continue
90fb0c24 1199 ;;
6599da04 1200
90fb0c24 1201 -l*)
d207ebef 1202 if test "$arg" = "-lc"; then
82e23236 1203 case $host in
3dd7094e 1204 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
d207ebef
JM
1205 # These systems don't actually have c library (as such)
1206 continue
1207 ;;
82e23236
AO
1208 *-*-rhapsody* | *-*-darwin*)
1209 # Darwin C library is in the System framework
1210 deplibs="$deplibs -framework System"
1211 ;;
d207ebef
JM
1212 esac
1213 elif test "$arg" = "-lm"; then
82e23236 1214 case $host in
3dd7094e 1215 *-*-cygwin* | *-*-pw32* | *-*-beos*)
d207ebef
JM
1216 # These systems don't actually have math library (as such)
1217 continue
1218 ;;
82e23236
AO
1219 *-*-rhapsody* | *-*-darwin*)
1220 # Darwin math library is in the System framework
1221 deplibs="$deplibs -framework System"
1222 ;;
d207ebef
JM
1223 esac
1224 fi
90fb0c24 1225 deplibs="$deplibs $arg"
4f4caf92 1226 continue
90fb0c24 1227 ;;
6599da04 1228
90fb0c24 1229 -module)
d207ebef
JM
1230 module=yes
1231 continue
90fb0c24 1232 ;;
d207ebef 1233
4f4caf92
AO
1234 -no-fast-install)
1235 fast_install=no
1236 continue
1237 ;;
1238
1239 -no-install)
82e23236 1240 case $host in
3dd7094e 1241 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4f4caf92
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 ;;
82e23236
AO
1248 *-*-rhapsody* | *-*-darwin*)
1249 # Darwin C library is in the System framework
4f4caf92
AO
1250 deplibs="$deplibs -framework System"
1251 ;;
1252 *)
1253 no_install=yes
1254 ;;
1255 esac
1256 continue
1257 ;;
1258
cf4ccd63
JL
1259 -no-undefined)
1260 allow_undefined=no
6599da04
JM
1261 continue
1262 ;;
1263
82e23236
AO
1264 -objectlist)
1265 prev=objectlist
1266 continue
1267 ;;
1268
cf4ccd63 1269 -o) prev=output ;;
6599da04 1270
cf4ccd63
JL
1271 -release)
1272 prev=release
1273 continue
6599da04
JM
1274 ;;
1275
cf4ccd63 1276 -rpath)
90fb0c24
TT
1277 prev=rpath
1278 continue
1279 ;;
1280
1281 -R)
1282 prev=xrpath
1283 continue
1284 ;;
1285
1286 -R*)
d207ebef
JM
1287 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1288 # We need an absolute path.
82e23236 1289 case $dir in
d207ebef
JM
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
90fb0c24
TT
1300 continue
1301 ;;
6599da04 1302
cf4ccd63 1303 -static)
06298abd
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.
90fb0c24
TT
1309 continue
1310 ;;
1311
1312 -thread-safe)
1313 thread_safe=yes
cf4ccd63 1314 continue
6599da04
JM
1315 ;;
1316
cf4ccd63 1317 -version-info)
90fb0c24
TT
1318 prev=vinfo
1319 continue
1320 ;;
6599da04 1321
4f4caf92
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"
82e23236 1328 case $flag in
4f4caf92
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"
82e23236 1346 case $flag in
4f4caf92
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
cf4ccd63
JL
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"`
82e23236 1374 case $arg in
4f4caf92 1375 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
cf4ccd63
JL
1376 arg="\"$arg\""
1377 ;;
1378 esac
90fb0c24 1379 ;;
6599da04 1380
4f4caf92 1381 *.$objext)
90fb0c24
TT
1382 # A standard object.
1383 objs="$objs $arg"
1384 ;;
6599da04 1385
cf4ccd63 1386 *.lo)
4f4caf92
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.
82e23236 1396 case $arg in
4f4caf92
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=
cf4ccd63 1413 else
4f4caf92 1414 xdir="$xdir/"
cf4ccd63 1415 fi
6599da04 1416
4f4caf92
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
6599da04 1476 fi
4f4caf92
AO
1477 ;;
1478
1479 *.$libext)
1480 # An archive.
1481 deplibs="$deplibs $arg"
1482 old_deplibs="$old_deplibs $arg"
1483 continue
90fb0c24 1484 ;;
6599da04 1485
cf4ccd63 1486 *.la)
90fb0c24
TT
1487 # A libtool-controlled library.
1488
4f4caf92
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=
90fb0c24 1497 else
4f4caf92 1498 deplibs="$deplibs $arg"
90fb0c24 1499 fi
4f4caf92
AO
1500 continue
1501 ;;
90fb0c24 1502
4f4caf92
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"`
82e23236 1508 case $arg in
4f4caf92
AO
1509 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1510 arg="\"$arg\""
1511 ;;
90fb0c24 1512 esac
4f4caf92
AO
1513 ;;
1514 esac
90fb0c24 1515
4f4caf92
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
90fb0c24 1522
4f4caf92
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
90fb0c24 1528
4f4caf92
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.
06298abd 1538 "`$echo $CC` "*) ;;
4f4caf92
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 ;;
06298abd 1552 "`$echo $CC` "*)
4f4caf92
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
82e23236 1610 case $output in
4f4caf92
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
82e23236 1647 case $file in
4f4caf92
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
82e23236 1688 case $deplib in
4f4caf92
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
90fb0c24 1803 fi
4f4caf92
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
90fb0c24
TT
1815 fi
1816
4f4caf92
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
90fb0c24
TT
1822 fi
1823
4f4caf92
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
82e23236 1838 case $lib in
4f4caf92
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
fbd836fc
ILT
1873 continue
1874 fi
1875
4f4caf92
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
90fb0c24 1886 # This library was specified with -dlopen.
4f4caf92
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
82e23236
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"
90fb0c24 1898 else
4f4caf92
AO
1899 newdlfiles="$newdlfiles $lib"
1900 fi
1901 continue
1902 fi
1903
1904 # We need an absolute path.
82e23236 1905 case $ladir in
4f4caf92
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"
90fb0c24 1928 fi
4f4caf92
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"
90fb0c24 1934 fi
4f4caf92 1935 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
90fb0c24 1936
4f4caf92
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
90fb0c24
TT
1943 # Prefer using a static library (so that no silly _DYNAMIC symbols
1944 # are required to link).
1945 if test -n "$old_library"; then
4f4caf92 1946 newdlprefiles="$newdlprefiles $dir/$old_library"
06298abd
AO
1947 # Otherwise, use the dlname, so that lt_dlopen finds it.
1948 elif test -n "$dlname"; then
1949 newdlprefiles="$newdlprefiles $dir/$dlname"
90fb0c24 1950 else
4f4caf92 1951 newdlprefiles="$newdlprefiles $dir/$linklib"
90fb0c24 1952 fi
90fb0c24
TT
1953 fi
1954
4f4caf92
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
90fb0c24 1964 fi
4f4caf92
AO
1965 continue
1966 fi
cf4ccd63 1967
4f4caf92
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
82e23236 1980 case $deplib in
4f4caf92
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"
90fb0c24 1990 fi
4f4caf92
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" &&
4f4caf92
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
90fb0c24 2016 *" $absdir "*) ;;
4f4caf92
AO
2017 *)
2018 case "$compile_rpath " in
2019 *" $absdir "*) ;;
2020 *) compile_rpath="$compile_rpath $absdir"
2021 esac
2022 ;;
90fb0c24 2023 esac
cf4ccd63 2024
4f4caf92 2025 case " $sys_lib_dlsearch_path " in
90fb0c24 2026 *" $libdir "*) ;;
4f4caf92
AO
2027 *)
2028 case "$finalize_rpath " in
2029 *" $libdir "*) ;;
2030 *) finalize_rpath="$finalize_rpath $libdir"
2031 esac
2032 ;;
90fb0c24 2033 esac
4f4caf92 2034 fi
cf4ccd63 2035
4f4caf92
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
06298abd
AO
2053 if test $linkmode = lib &&
2054 test $hardcode_into_libs = yes; then
4f4caf92
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"
fbd836fc 2064 esac
4f4caf92
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"
90fb0c24 2073 esac
4f4caf92
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
82e23236 2129 case $hardcode_action in
4f4caf92
AO
2130 immediate | unsupported)
2131 if test "$hardcode_direct" = no; then
2132 add="$dir/$linklib"
2133 elif test "$hardcode_minus_L" = no; then
82e23236 2134 case $host in
4f4caf92
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
82e23236 2168 case :$compile_shlibpath: in
4f4caf92
AO
2169 *":$add_shlibpath:"*) ;;
2170 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
90fb0c24 2171 esac
4f4caf92
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"
fbd836fc 2176 else
4f4caf92
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
82e23236 2182 case :$finalize_shlibpath: in
4f4caf92
AO
2183 *":$libdir:"*) ;;
2184 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2185 esac
2186 fi
90fb0c24 2187 fi
4f4caf92 2188 fi
90fb0c24 2189
4f4caf92
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.
90fb0c24 2195 if test "$hardcode_direct" = yes; then
4f4caf92 2196 add="$libdir/$linklib"
90fb0c24 2197 elif test "$hardcode_minus_L" = yes; then
4f4caf92
AO
2198 add_dir="-L$libdir"
2199 add="-l$name"
90fb0c24 2200 elif test "$hardcode_shlibpath_var" = yes; then
82e23236 2201 case :$finalize_shlibpath: in
4f4caf92
AO
2202 *":$libdir:"*) ;;
2203 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
90fb0c24 2204 esac
4f4caf92 2205 add="-l$name"
fbd836fc 2206 else
4f4caf92
AO
2207 # We cannot seem to hardcode it, guess we'll fake it.
2208 add_dir="-L$libdir"
2209 add="-l$name"
90fb0c24 2210 fi
fbd836fc 2211
4f4caf92
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
90fb0c24 2219 fi
4f4caf92 2220 elif test $linkmode = prog; then
cf4ccd63
JL
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"
4f4caf92
AO
2226 compile_deplibs="$dir/$linklib $compile_deplibs"
2227 finalize_deplibs="$dir/$linklib $finalize_deplibs"
cf4ccd63 2228 else
4f4caf92
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" &&
06298abd 2254 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
4f4caf92
AO
2255 test $link_static = yes; }; then
2256 # Extract -R from dependency_libs
2257 temp_deplibs=
2258 for libdir in $dependency_libs; do
82e23236 2259 case $libdir in
4f4caf92
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
82e23236 2287 case $deplib in
4f4caf92
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.
82e23236 2293 case $dir in
4f4caf92
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
82e23236 2358 case $deplib in
4f4caf92
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 ;;
90fb0c24 2371 esac
4f4caf92
AO
2372 done
2373 tmp_libs=
2374 for deplib in $new_libs; do
82e23236 2375 case $deplib in
4f4caf92
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" ;;
90fb0c24 2383 esac
4f4caf92
AO
2384 done
2385 eval $var=\"$tmp_libs\"
2386 done
cf4ccd63 2387 fi
6599da04 2388 done
4f4caf92
AO
2389 if test $linkmode = prog; then
2390 dlfiles="$newdlfiles"
2391 dlprefiles="$newdlprefiles"
d207ebef
JM
2392 fi
2393
4f4caf92
AO
2394 case $linkmode in
2395 oldlib)
fbd836fc 2396 if test -n "$deplibs"; then
90fb0c24 2397 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
fbd836fc
ILT
2398 fi
2399
d207ebef 2400 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
90fb0c24 2401 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
fbd836fc
ILT
2402 fi
2403
2404 if test -n "$rpath"; then
90fb0c24
TT
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
fbd836fc
ILT
2410 fi
2411
2412 if test -n "$vinfo"; then
90fb0c24 2413 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
fbd836fc
ILT
2414 fi
2415
2416 if test -n "$release"; then
90fb0c24
TT
2417 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2418 fi
2419
d207ebef 2420 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
90fb0c24 2421 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
fbd836fc
ILT
2422 fi
2423
cf4ccd63
JL
2424 # Now set the variables for building old libraries.
2425 build_libtool_libs=no
fbd836fc 2426 oldlibs="$output"
4f4caf92 2427 objs="$objs$old_deplibs"
cf4ccd63
JL
2428 ;;
2429
4f4caf92 2430 lib)
cf4ccd63 2431 # Make sure we only generate libraries of the form `libNAME.la'.
82e23236 2432 case $outputname in
90fb0c24
TT
2433 lib*)
2434 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2435 eval libname=\"$libname_spec\"
2436 ;;
cf4ccd63 2437 *)
90fb0c24
TT
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
cf4ccd63
JL
2450 ;;
2451 esac
2452
6599da04 2453 if test -n "$objs"; then
4f4caf92
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
6599da04
JM
2463 fi
2464
4f4caf92
AO
2465 if test "$dlself" != no; then
2466 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
cf4ccd63 2467 fi
6599da04 2468
cf4ccd63
JL
2469 set dummy $rpath
2470 if test $# -gt 2; then
2471 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
6599da04 2472 fi
cf4ccd63 2473 install_libdir="$2"
6599da04 2474
90fb0c24 2475 oldlibs=
fbd836fc 2476 if test -z "$rpath"; then
90fb0c24
TT
2477 if test "$build_libtool_libs" = yes; then
2478 # Building a libtool convenience library.
4f4caf92
AO
2479 # Some compilers have problems with a `.al' extension so
2480 # convenience libraries should have the same extension an
2481 # archive normally would.
90fb0c24
TT
2482 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2483 build_libtool_libs=convenience
2484 build_old_libs=yes
2485 fi
fbd836fc
ILT
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
6599da04 2495
cf4ccd63
JL
2496 # Parse the version information argument.
2497 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
fbd836fc 2498 set dummy $vinfo 0 0 0
cf4ccd63 2499 IFS="$save_ifs"
6599da04 2500
fbd836fc 2501 if test -n "$8"; then
cf4ccd63
JL
2502 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2503 $echo "$help" 1>&2
2504 exit 1
2505 fi
6599da04 2506
fbd836fc
ILT
2507 current="$2"
2508 revision="$3"
2509 age="$4"
6599da04 2510
cf4ccd63 2511 # Check that each of the things are valid numbers.
82e23236 2512 case $current in
cf4ccd63
JL
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
6599da04 2520
82e23236 2521 case $revision in
cf4ccd63
JL
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
6599da04 2529
82e23236 2530 case $age in
cf4ccd63
JL
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
6599da04 2538
cf4ccd63
JL
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
6599da04 2544
cf4ccd63 2545 # Calculate the version variables.
fbd836fc
ILT
2546 major=
2547 versuffix=
2548 verstring=
82e23236 2549 case $version_type in
cf4ccd63 2550 none) ;;
6599da04 2551
90fb0c24
TT
2552 irix)
2553 major=`expr $current - $age + 1`
90fb0c24
TT
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
4f4caf92
AO
2563
2564 # Before this point, $major must not contain `.'.
2565 major=.$major
2566 versuffix="$major.$revision"
90fb0c24
TT
2567 ;;
2568
cf4ccd63 2569 linux)
cf4ccd63 2570 major=.`expr $current - $age`
fbd836fc 2571 versuffix="$major.$age.$revision"
cf4ccd63 2572 ;;
6599da04 2573
cf4ccd63 2574 osf)
fbd836fc
ILT
2575 major=`expr $current - $age`
2576 versuffix=".$current.$age.$revision"
cf4ccd63
JL
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)
fbd836fc
ILT
2592 major=".$current"
2593 versuffix=".$current.$revision"
cf4ccd63
JL
2594 ;;
2595
90fb0c24
TT
2596 freebsd-aout)
2597 major=".$current"
2598 versuffix=".$current.$revision";
2599 ;;
2600
2601 freebsd-elf)
2602 major=".$current"
2603 versuffix=".$current";
2604 ;;
2605
cf4ccd63 2606 windows)
3dd7094e
AO
2607 # Use '-' rather than '.', since we only want one
2608 # extension on DOS 8.3 filesystems.
cf4ccd63 2609 major=`expr $current - $age`
3dd7094e 2610 versuffix="-$major"
cf4ccd63
JL
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
cf4ccd63 2619
fbd836fc
ILT
2620 # Clear the version info if we defaulted, and they specified a release.
2621 if test -z "$vinfo" && test -n "$release"; then
cf4ccd63 2622 major=
fbd836fc 2623 verstring="0.0"
90fb0c24
TT
2624 if test "$need_version" = no; then
2625 versuffix=
2626 else
fbd836fc 2627 versuffix=".0.0"
90fb0c24 2628 fi
fbd836fc 2629 fi
cf4ccd63 2630
90fb0c24
TT
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
4f4caf92 2637
fbd836fc
ILT
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
cf4ccd63 2649 fi
6599da04 2650
4f4caf92
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
82e23236 2657 case $p in
4f4caf92
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
90fb0c24
TT
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`
6599da04
JM
2678 fi
2679
4f4caf92
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
06298abd 2697 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
4f4caf92
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
6599da04 2722 if test "$build_libtool_libs" = yes; then
4f4caf92 2723 if test -n "$rpath"; then
82e23236 2724 case $host in
3dd7094e 2725 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
4f4caf92
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
90fb0c24
TT
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
82e23236 2751 case $deplibs_check_method in
90fb0c24 2752 pass_all)
d207ebef
JM
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.
90fb0c24 2758 newdeplibs=$deplibs
d207ebef 2759 ;;
90fb0c24
TT
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
4f4caf92 2770 $LTCC -o conftest conftest.c $deplibs
90fb0c24
TT
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.
82e23236 2776 if test "$name" != "" -a "$name" != "0"; then
90fb0c24
TT
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.
82e23236 2801 if test "$name" != "" -a "$name" != "0"; then
90fb0c24 2802 $rm conftest
4f4caf92 2803 $LTCC -o conftest conftest.c $i
90fb0c24
TT
2804 # Did it work?
2805 if test $? -eq 0 ; then
2806 ldd_output=`ldd conftest`
d207ebef
JM
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
90fb0c24
TT
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
90fb0c24
TT
2834 ;;
2835 file_magic*)
2836 set dummy $deplibs_check_method
4f4caf92 2837 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
90fb0c24
TT
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.
82e23236 2841 if test "$name" != "" -a "$name" != "0"; then
90fb0c24 2842 libname=`eval \\$echo \"$libname_spec\"`
4f4caf92 2843 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
90fb0c24
TT
2844 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2845 for potent_lib in $potential_libs; do
2846 # Follow soft links.
d207ebef 2847 if ls -lLd "$potent_lib" 2>/dev/null \
90fb0c24 2848 | grep " -> " >/dev/null; then
4f4caf92 2849 continue
90fb0c24
TT
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/.* -> //'`
82e23236 2859 case $potliblink in
d207ebef 2860 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
90fb0c24
TT
2861 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2862 esac
2863 done
d207ebef 2864 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
90fb0c24
TT
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 ;;
d207ebef
JM
2887 none | unknown | *)
2888 newdeplibs=""
90fb0c24
TT
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
90fb0c24
TT
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."
82e23236
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
90fb0c24
TT
2949 fi
2950 fi
d207ebef
JM
2951 # Done checking deplibs!
2952 deplibs=$newdeplibs
90fb0c24
TT
2953 fi
2954
d207ebef
JM
2955 # All the library-specific variables (install_libdir is set above).
2956 library_names=
2957 old_library=
2958 dlname=
4f4caf92 2959
d207ebef 2960 # Test again, we may have decided not to build it any more
90fb0c24 2961 if test "$build_libtool_libs" = yes; then
06298abd 2962 if test $hardcode_into_libs = yes; then
4f4caf92
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.
82e23236 2975 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4f4caf92
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
fbd836fc
ILT
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
6599da04 3028
90fb0c24 3029 lib="$output_objdir/$realname"
6599da04
JM
3030 for link
3031 do
3032 linknames="$linknames $link"
3033 done
3034
4f4caf92
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
6599da04 3051
90fb0c24
TT
3052 # Use standard objects if they are pic
3053 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6599da04 3054
90fb0c24
TT
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'"
d207ebef 3059 export_symbols="$output_objdir/$libname.exp"
90fb0c24
TT
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
d207ebef
JM
3082 if test -n "$convenience"; then
3083 if test -n "$whole_archive_flag_spec"; then
82e23236 3084 save_libobjs=$libobjs
d207ebef
JM
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"
4f4caf92
AO
3090 $show "$mkdir $gentop"
3091 $run $mkdir "$gentop"
d207ebef
JM
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.
82e23236 3100 case $xlib in
d207ebef
JM
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"
4f4caf92
AO
3109 $show "$mkdir $xdir"
3110 $run $mkdir "$xdir"
d207ebef
JM
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
4f4caf92 3118 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
d207ebef
JM
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\"
4f4caf92
AO
3125 linker_flags="$linker_flags $flag"
3126 fi
3127
3128 # Make a backup of the uninstalled library when relinking
06298abd 3129 if test "$mode" = relink; then
4f4caf92 3130 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
d207ebef
JM
3131 fi
3132
fbd836fc 3133 # Do each of the archive commands.
90fb0c24
TT
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
82e23236
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"
fbd836fc 3248
4f4caf92 3249 # Restore the uninstalled library and exit
06298abd 3250 if test "$mode" = relink; then
4f4caf92
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
fbd836fc
ILT
3255 # Create links to the real library.
3256 for linkname in $linknames; do
cf4ccd63 3257 if test "$realname" != "$linkname"; then
90fb0c24
TT
3258 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3259 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
fbd836fc
ILT
3260 fi
3261 done
6599da04 3262
90fb0c24
TT
3263 # If -module or -export-dynamic was specified, set the dlname.
3264 if test "$module" = yes || test "$export_dynamic" = yes; then
fbd836fc
ILT
3265 # On all known operating systems, these are identical.
3266 dlname="$soname"
3267 fi
6599da04
JM
3268 fi
3269 ;;
3270
4f4caf92 3271 obj)
6599da04 3272 if test -n "$deplibs"; then
90fb0c24 3273 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
cf4ccd63
JL
3274 fi
3275
d207ebef 3276 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
90fb0c24 3277 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
6599da04
JM
3278 fi
3279
cf4ccd63 3280 if test -n "$rpath"; then
90fb0c24
TT
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
6599da04
JM
3286 fi
3287
3288 if test -n "$vinfo"; then
90fb0c24 3289 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
cf4ccd63
JL
3290 fi
3291
3292 if test -n "$release"; then
90fb0c24 3293 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
6599da04
JM
3294 fi
3295
82e23236 3296 case $output in
6599da04 3297 *.lo)
4f4caf92 3298 if test -n "$objs$old_deplibs"; then
90fb0c24
TT
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 ;;
6599da04 3305 *)
90fb0c24
TT
3306 libobj=
3307 obj="$output"
3308 ;;
6599da04
JM
3309 esac
3310
3311 # Delete the old objects.
3312 $run $rm $obj $libobj
3313
d207ebef
JM
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
4f4caf92 3322 wl=
d207ebef
JM
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"
4f4caf92
AO
3331 $show "$mkdir $gentop"
3332 $run $mkdir "$gentop"
d207ebef
JM
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.
82e23236 3341 case $xlib in
d207ebef
JM
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"
4f4caf92
AO
3350 $show "$mkdir $xdir"
3351 $run $mkdir "$xdir"
d207ebef
JM
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
4f4caf92 3359 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
d207ebef
JM
3360 done
3361 fi
3362 fi
3363
6599da04 3364 # Create the old-style object.
4f4caf92 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
6599da04
JM
3366
3367 output="$obj"
cf4ccd63 3368 eval cmds=\"$reload_cmds\"
90fb0c24 3369 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
6599da04 3370 for cmd in $cmds; do
90fb0c24
TT
3371 IFS="$save_ifs"
3372 $show "$cmd"
3373 $run eval "$cmd" || exit $?
6599da04
JM
3374 done
3375 IFS="$save_ifs"
3376
3377 # Exit if we aren't doing a library object file.
d207ebef
JM
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
6599da04
JM
3386
3387 if test "$build_libtool_libs" != yes; then
d207ebef
JM
3388 if test -n "$gentop"; then
3389 $show "${rm}r $gentop"
3390 $run ${rm}r $gentop
3391 fi
3392
90fb0c24
TT
3393 # Create an invalid libtool object if no PIC, so that we don't
3394 # accidentally link it into a program.
4f4caf92
AO
3395 # $show "echo timestamp > $libobj"
3396 # $run eval "echo timestamp > $libobj" || exit $?
90fb0c24 3397 exit 0
6599da04
JM
3398 fi
3399
4f4caf92 3400 if test -n "$pic_flag" || test "$pic_mode" != default; then
90fb0c24 3401 # Only do commands if we really have different PIC objects.
d207ebef 3402 reload_objs="$libobjs $reload_conv_objs"
90fb0c24
TT
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"
4f4caf92
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 $?
d207ebef
JM
3426 fi
3427
3428 if test -n "$gentop"; then
3429 $show "${rm}r $gentop"
3430 $run ${rm}r $gentop
6599da04
JM
3431 fi
3432
3433 exit 0
3434 ;;
3435
4f4caf92 3436 prog)
cf4ccd63 3437 if test -n "$vinfo"; then
90fb0c24 3438 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
6599da04
JM
3439 fi
3440
cf4ccd63 3441 if test -n "$release"; then
90fb0c24 3442 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
6599da04
JM
3443 fi
3444
90fb0c24 3445 if test "$preload" = yes; then
4f4caf92 3446 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
90fb0c24
TT
3447 test "$dlopen_self_static" = unknown; then
3448 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4f4caf92 3449 fi
90fb0c24 3450 fi
4f4caf92
AO
3451
3452 compile_command="$compile_command $compile_deplibs"
3453 finalize_command="$finalize_command $finalize_deplibs"
3454
90fb0c24 3455 if test -n "$rpath$xrpath"; then
cf4ccd63 3456 # If the user specified any rpath flags, then add them.
90fb0c24
TT
3457 for libdir in $rpath $xrpath; do
3458 # This is the magic to use -rpath.
90fb0c24
TT
3459 case "$finalize_rpath " in
3460 *" $libdir "*) ;;
3461 *) finalize_rpath="$finalize_rpath $libdir" ;;
3462 esac
cf4ccd63 3463 done
6599da04
JM
3464 fi
3465
90fb0c24
TT
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.
82e23236 3476 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
90fb0c24
TT
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\"
90fb0c24
TT
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
82e23236 3494 case $host in
3dd7094e 3495 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
82e23236 3496 case :$dllsearchpath: in
4f4caf92
AO
3497 *":$libdir:"*) ;;
3498 *) dllsearchpath="$dllsearchpath:$libdir";;
3499 esac
3500 ;;
3501 esac
90fb0c24
TT
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\"
cf4ccd63 3508 fi
90fb0c24
TT
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.
82e23236 3520 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
90fb0c24
TT
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\"
90fb0c24
TT
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\"
cf4ccd63 3544 fi
90fb0c24 3545 finalize_rpath="$rpath"
cf4ccd63 3546
90fb0c24 3547 dlsyms=
d207ebef 3548 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
90fb0c24
TT
3549 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3550 dlsyms="${outputname}S.c"
cf4ccd63 3551 else
90fb0c24 3552 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
6599da04 3553 fi
90fb0c24 3554 fi
cf4ccd63 3555
90fb0c24 3556 if test -n "$dlsyms"; then
82e23236 3557 case $dlsyms in
90fb0c24
TT
3558 "") ;;
3559 *.c)
3560 # Discover the nlist of each of the dlfiles.
d207ebef 3561 nlist="$output_objdir/${outputname}.nm"
90fb0c24 3562
d207ebef
JM
3563 $show "$rm $nlist ${nlist}S ${nlist}T"
3564 $run $rm "$nlist" "${nlist}S" "${nlist}T"
cf4ccd63 3565
90fb0c24 3566 # Parse the name list into a source file.
d207ebef 3567 $show "creating $output_objdir/$dlsyms"
90fb0c24 3568
d207ebef 3569 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
90fb0c24
TT
3570/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3571/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
cf4ccd63
JL
3572
3573#ifdef __cplusplus
3574extern \"C\" {
3575#endif
3576
3577/* Prevent the only kind of declaration conflicts we can make. */
90fb0c24 3578#define lt_preloaded_symbols some_other_symbol
cf4ccd63
JL
3579
3580/* External symbol declarations for the compiler. */\
3581"
3582
90fb0c24
TT
3583 if test "$dlself" = yes; then
3584 $show "generating symbol list for \`$output'"
3585
d207ebef 3586 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
90fb0c24
TT
3587
3588 # Add our own program objects to the symbol list.
4f4caf92 3589 progfiles="$objs$old_deplibs"
90fb0c24
TT
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
4f4caf92 3599
90fb0c24
TT
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
d207ebef 3607 export_symbols="$output_objdir/$output.exp"
90fb0c24
TT
3608 $run $rm $export_symbols
3609 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3610 else
d207ebef
JM
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'
90fb0c24
TT
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"'
cf4ccd63 3642 else
90fb0c24 3643 echo '/* NONE */' >> "$output_objdir/$dlsyms"
cf4ccd63
JL
3644 fi
3645
90fb0c24 3646 $echo >> "$output_objdir/$dlsyms" "\
cf4ccd63 3647
90fb0c24 3648#undef lt_preloaded_symbols
cf4ccd63
JL
3649
3650#if defined (__STDC__) && __STDC__
90fb0c24 3651# define lt_ptr_t void *
cf4ccd63 3652#else
90fb0c24
TT
3653# define lt_ptr_t char *
3654# define const
cf4ccd63
JL
3655#endif
3656
cf4ccd63 3657/* The mapping between symbol names and symbols. */
90fb0c24
TT
3658const struct {
3659 const char *name;
3660 lt_ptr_t address;
cf4ccd63 3661}
90fb0c24 3662lt_preloaded_symbols[] =
cf4ccd63
JL
3663{\
3664"
3665
90fb0c24
TT
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"
cf4ccd63 3669
90fb0c24
TT
3670 $echo >> "$output_objdir/$dlsyms" "\
3671 {0, (lt_ptr_t) 0}
cf4ccd63
JL
3672};
3673
90fb0c24
TT
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
cf4ccd63
JL
3681#ifdef __cplusplus
3682}
3683#endif\
3684"
90fb0c24 3685 fi
cf4ccd63 3686
90fb0c24 3687 pic_flag_for_symtable=
82e23236 3688 case $host in
90fb0c24
TT
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.
4f4caf92 3694 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
90fb0c24
TT
3695 case "$compile_command " in
3696 *" -static "*) ;;
4f4caf92 3697 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
d207ebef
JM
3698 esac;;
3699 *-*-hpux*)
3700 case "$compile_command " in
3701 *" -static "*) ;;
4f4caf92 3702 *) pic_flag_for_symtable=" $pic_flag";;
90fb0c24 3703 esac
cf4ccd63 3704 esac
cf4ccd63 3705
90fb0c24 3706 # Now compile the dynamic symbol file.
4f4caf92
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 $?
d207ebef
JM
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"
cf4ccd63 3713
90fb0c24 3714 # Transform the symbol file into the correct name.
d207ebef
JM
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}%"`
90fb0c24
TT
3717 ;;
3718 *)
3719 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3720 exit 1
3721 ;;
3722 esac
cf4ccd63 3723 else
90fb0c24
TT
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.
cf4ccd63 3727
90fb0c24
TT
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@%%"`
cf4ccd63
JL
3731 fi
3732
4f4caf92 3733 if test $need_relink = no || test "$build_libtool_libs" != yes; then
90fb0c24
TT
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"
d207ebef 3741 status=$?
4f4caf92 3742
d207ebef
JM
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
6599da04
JM
3750 fi
3751
3752 if test -n "$shlibpath_var"; then
90fb0c24
TT
3753 # We should set the shlibpath_var
3754 rpath=
3755 for dir in $temp_rpath; do
82e23236 3756 case $dir in
d207ebef 3757 [\\/]* | [A-Za-z]:[\\/]*)
90fb0c24
TT
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"
6599da04
JM
3768 fi
3769
90fb0c24
TT
3770 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3771 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
6599da04
JM
3772 fi
3773 if test -n "$finalize_shlibpath"; then
90fb0c24 3774 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
6599da04
JM
3775 fi
3776
90fb0c24
TT
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
6599da04
JM
3796 fi
3797
4f4caf92
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
06298abd 3811 if test "$hardcode_action" = relink; then
90fb0c24
TT
3812 # Fast installation is not supported
3813 link_command="$compile_var$compile_command$compile_rpath"
3814 relink_command="$finalize_var$finalize_command$finalize_rpath"
4f4caf92 3815
90fb0c24
TT
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'`
4f4caf92 3835
d207ebef 3836 # Delete the old output files.
90fb0c24
TT
3837 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3838
3839 $show "$link_command"
3840 $run eval "$link_command" || exit $?
6599da04
JM
3841
3842 # Now create the wrapper script.
cf4ccd63
JL
3843 $show "creating $output"
3844
90fb0c24
TT
3845 # Quote the relink command for shipping.
3846 if test -n "$relink_command"; then
4f4caf92 3847 # Preserve any variables that may affect compiler behavior
d207ebef 3848 for var in $variables_saved_for_relink; do
06298abd
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
d207ebef 3857 done
4f4caf92 3858 relink_command="cd `pwd`; $relink_command"
90fb0c24
TT
3859 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3860 fi
cf4ccd63
JL
3861
3862 # Quote $echo for shipping.
90fb0c24 3863 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
82e23236 3864 case $0 in
d207ebef 3865 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
90fb0c24
TT
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
6599da04
JM
3872
3873 # Only actually do things if our run command is non-null.
3874 if test -z "$run"; then
90fb0c24
TT
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
6599da04 3882
90fb0c24 3883 $echo > $output "\
cf4ccd63 3884#! $SHELL
6599da04 3885
90fb0c24
TT
3886# $output - temporary wrapper script for $objdir/$outputname
3887# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
6599da04
JM
3888#
3889# The $output program cannot be directly executed until all the libtool
3890# libraries that it depends on are installed.
3891#
90fb0c24 3892# This wrapper script should never be moved out of the build directory.
6599da04
JM
3893# If it is, it will not operate correctly.
3894
cf4ccd63
JL
3895# Sed substitution that helps us do robust quoting. It backslashifies
3896# metacharacters that are still active within double-quoted strings.
90fb0c24 3897Xsed='sed -e 1s/^X//'
cf4ccd63
JL
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.
d207ebef 3902if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
cf4ccd63 3903
90fb0c24
TT
3904relink_command=\"$relink_command\"
3905
6599da04 3906# This environment variable determines our operation mode.
cf4ccd63 3907if test \"\$libtool_install_magic\" = \"$magic\"; then
90fb0c24 3908 # install mode needs the following variable:
4f4caf92 3909 uninst_deplibs='$uninst_deplibs'
6599da04 3910else
cf4ccd63 3911 # When we are sourced in execute mode, \$file and \$echo are already set.
fbd836fc 3912 if test \"\$libtool_execute_magic\" != \"$magic\"; then
cf4ccd63
JL
3913 echo=\"$qecho\"
3914 file=\"\$0\"
fbd836fc
ILT
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
cf4ccd63
JL
3926 fi\
3927"
90fb0c24 3928 $echo >> $output "\
6599da04 3929
cf4ccd63
JL
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
4f4caf92 3942 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
cf4ccd63
JL
3943 *) thisdir=\"\$thisdir/\$destdir\" ;;
3944 esac
3945 fi
6599da04 3946
cf4ccd63
JL
3947 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3948 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3949 done
6599da04 3950
cf4ccd63
JL
3951 # Try to get the absolute directory name.
3952 absdir=\`cd \"\$thisdir\" && pwd\`
3953 test -n \"\$absdir\" && thisdir=\"\$absdir\"
90fb0c24 3954"
6599da04 3955
90fb0c24
TT
3956 if test "$fast_install" = yes; then
3957 echo >> $output "\
3958 program=lt-'$outputname'
cf4ccd63 3959 progdir=\"\$thisdir/$objdir\"
4f4caf92 3960
90fb0c24
TT
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
4f4caf92 3977 if (eval \$relink_command); then :
90fb0c24
TT
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 "\
6599da04 3997
cf4ccd63 3998 if test -f \"\$progdir/\$program\"; then"
6599da04 3999
90fb0c24
TT
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 "\
6599da04 4003 # Add our own library path to $shlibpath_var
cf4ccd63 4004 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
6599da04
JM
4005
4006 # Some systems cannot cope with colon-terminated $shlibpath_var
90fb0c24
TT
4007 # The second colon is a workaround for a bug in BeOS R4 sed
4008 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
6599da04
JM
4009
4010 export $shlibpath_var
cf4ccd63 4011"
90fb0c24
TT
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
6599da04 4021
90fb0c24 4022 $echo >> $output "\
cf4ccd63
JL
4023 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4024 # Run the actual program with our arguments.
90fb0c24
TT
4025"
4026 case $host in
4f4caf92
AO
4027 # win32 systems need to use the prog path for dll
4028 # lookup to work
3dd7094e 4029 *-*-cygwin* | *-*-pw32*)
4f4caf92
AO
4030 $echo >> $output "\
4031 exec \$progdir/\$program \${1+\"\$@\"}
4032"
4033 ;;
4034
4035 # Backslashes separate directories on plain windows
4036 *-*-mingw | *-*-os2*)
90fb0c24
TT
4037 $echo >> $output "\
4038 exec \$progdir\\\\\$program \${1+\"\$@\"}
4039"
4040 ;;
4f4caf92 4041
90fb0c24
TT
4042 *)
4043 $echo >> $output "\
cf4ccd63
JL
4044 # Export the path to the program.
4045 PATH=\"\$progdir:\$PATH\"
4046 export PATH
6599da04 4047
cf4ccd63 4048 exec \$program \${1+\"\$@\"}
90fb0c24
TT
4049"
4050 ;;
4051 esac
4052 $echo >> $output "\
cf4ccd63
JL
4053 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4054 exit 1
4055 fi
6599da04
JM
4056 else
4057 # The program doesn't exist.
cf4ccd63
JL
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
6599da04
JM
4061 exit 1
4062 fi
cf4ccd63
JL
4063fi\
4064"
90fb0c24 4065 chmod +x $output
6599da04
JM
4066 fi
4067 exit 0
4068 ;;
4069 esac
4070
6599da04 4071 # See if we need to build an old-fashioned archive.
fbd836fc
ILT
4072 for oldlib in $oldlibs; do
4073
4074 if test "$build_libtool_libs" = convenience; then
90fb0c24 4075 oldobjs="$libobjs_save"
fbd836fc
ILT
4076 addlibs="$convenience"
4077 build_libtool_libs=no
4078 else
90fb0c24
TT
4079 if test "$build_libtool_libs" = module; then
4080 oldobjs="$libobjs_save"
4081 build_libtool_libs=no
4082 else
4f4caf92 4083 oldobjs="$objs$old_deplibs $non_pic_objects"
90fb0c24 4084 fi
fbd836fc
ILT
4085 addlibs="$old_convenience"
4086 fi
4087
d207ebef
JM
4088 if test -n "$addlibs"; then
4089 gentop="$output_objdir/${outputname}x"
4090 $show "${rm}r $gentop"
4091 $run ${rm}r "$gentop"
4f4caf92
AO
4092 $show "$mkdir $gentop"
4093 $run $mkdir "$gentop"
fbd836fc 4094 status=$?
d207ebef 4095 if test $status -ne 0 && test ! -d "$gentop"; then
fbd836fc
ILT
4096 exit $status
4097 fi
d207ebef 4098 generated="$generated $gentop"
4f4caf92 4099
d207ebef
JM
4100 # Add in members from convenience archives.
4101 for xlib in $addlibs; do
4102 # Extract the objects.
82e23236 4103 case $xlib in
d207ebef
JM
4104 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4105 *) xabs=`pwd`"/$xlib" ;;
4106 esac
4107 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4108 xdir="$gentop/$xlib"
fbd836fc 4109
d207ebef
JM
4110 $show "${rm}r $xdir"
4111 $run ${rm}r "$xdir"
4f4caf92
AO
4112 $show "$mkdir $xdir"
4113 $run $mkdir "$xdir"
d207ebef
JM
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
4f4caf92 4121 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP`
d207ebef
JM
4122 done
4123 fi
6599da04 4124
cf4ccd63
JL
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\"
6599da04 4128 else
4f4caf92
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
d207ebef 4146
82e23236
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
6599da04 4180 fi
90fb0c24 4181 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
6599da04 4182 for cmd in $cmds; do
90fb0c24
TT
4183 IFS="$save_ifs"
4184 $show "$cmd"
4185 $run eval "$cmd" || exit $?
6599da04
JM
4186 done
4187 IFS="$save_ifs"
fbd836fc
ILT
4188 done
4189
4190 if test -n "$generated"; then
4191 $show "${rm}r$generated"
4192 $run ${rm}r$generated
6599da04
JM
4193 fi
4194
4195 # Now create the libtool archive.
82e23236 4196 case $output in
6599da04
JM
4197 *.la)
4198 old_library=
fbd836fc 4199 test "$build_old_libs" = yes && old_library="$libname.$libext"
cf4ccd63 4200 $show "creating $output"
6599da04 4201
4f4caf92
AO
4202 # Preserve any variables that may affect compiler behavior
4203 for var in $variables_saved_for_relink; do
06298abd
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
4f4caf92
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"`
90fb0c24 4216
6599da04
JM
4217 # Only create the output if not a dry run.
4218 if test -z "$run"; then
d207ebef
JM
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
4f4caf92
AO
4225 # Replace all uninstalled libtool libraries with the installed ones
4226 newdependency_libs=
4227 for deplib in $dependency_libs; do
82e23236 4228 case $deplib in
4f4caf92
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"
d207ebef
JM
4264 fi
4265 $rm $output
4266 $echo > $output "\
4267# $outputname - a libtool library file
90fb0c24 4268# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
d207ebef
JM
4269#
4270# Please DO NOT delete this file!
4271# It is necessary for linking the library.
6599da04
JM
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
cf4ccd63
JL
4282# Libraries that this one depends upon.
4283dependency_libs='$dependency_libs'
4284
6599da04
JM
4285# Version information for $libname.
4286current=$current
4287age=$age
4288revision=$revision
4289
90fb0c24 4290# Is this an already installed library?
d207ebef 4291installed=$installed
90fb0c24 4292
4f4caf92
AO
4293# Files to dlopen/dlpreopen
4294dlopen='$dlfiles'
4295dlpreopen='$dlprefiles'
4296
6599da04 4297# Directory that this library needs to be installed in:
4f4caf92 4298libdir='$install_libdir'"
06298abd 4299 if test "$installed" = no && test $need_relink = yes; then
4f4caf92
AO
4300 $echo >> $output "\
4301relink_command=\"$relink_command\""
4302 fi
d207ebef 4303 done
6599da04
JM
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.
90fb0c24 4308 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4f4caf92 4309 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
6599da04
JM
4310 ;;
4311 esac
4312 exit 0
4313 ;;
4314
4315 # libtool install mode
4316 install)
cf4ccd63 4317 modename="$modename: install"
6599da04 4318
cf4ccd63
JL
4319 # There may be an optional sh(1) argument at the beginning of
4320 # install_prog (especially on Windows NT).
4f4caf92
AO
4321 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4322 # Allow the use of GNU shtool's install command.
89820b43 4323 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
cf4ccd63
JL
4324 # Aesthetically quote it.
4325 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
82e23236 4326 case $arg in
cf4ccd63
JL
4327 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4328 arg="\"$arg\""
4329 ;;
4330 esac
4331 install_prog="$arg "
4332 arg="$1"
6599da04 4333 shift
cf4ccd63
JL
4334 else
4335 install_prog=
4336 arg="$nonopt"
6599da04
JM
4337 fi
4338
cf4ccd63
JL
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"`
82e23236 4342 case $arg in
cf4ccd63
JL
4343 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4344 arg="\"$arg\""
4345 ;;
4346 esac
4347 install_prog="$install_prog$arg"
4348
6599da04
JM
4349 # We need to accept at least all the BSD install flags.
4350 dest=
4351 files=
4352 opts=
4353 prev=
4354 install_type=
cf4ccd63 4355 isdir=no
6599da04
JM
4356 stripme=
4357 for arg
4358 do
4359 if test -n "$dest"; then
90fb0c24
TT
4360 files="$files $dest"
4361 dest="$arg"
4362 continue
6599da04
JM
4363 fi
4364
82e23236 4365 case $arg in
6599da04
JM
4366 -d) isdir=yes ;;
4367 -f) prev="-f" ;;
4368 -g) prev="-g" ;;
4369 -m) prev="-m" ;;
4370 -o) prev="-o" ;;
4371 -s)
90fb0c24
TT
4372 stripme=" -s"
4373 continue
4374 ;;
6599da04
JM
4375 -*) ;;
4376
4377 *)
90fb0c24
TT
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 ;;
6599da04 4386 esac
cf4ccd63
JL
4387
4388 # Aesthetically quote the argument.
4389 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
82e23236 4390 case $arg in
cf4ccd63
JL
4391 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4392 arg="\"$arg\""
4393 ;;
4394 esac
6599da04
JM
4395 install_prog="$install_prog $arg"
4396 done
4397
4398 if test -z "$install_prog"; then
cf4ccd63
JL
4399 $echo "$modename: you must specify an install program" 1>&2
4400 $echo "$help" 1>&2
6599da04
JM
4401 exit 1
4402 fi
4403
4404 if test -n "$prev"; then
cf4ccd63
JL
4405 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4406 $echo "$help" 1>&2
6599da04
JM
4407 exit 1
4408 fi
4409
4410 if test -z "$files"; then
4411 if test -z "$dest"; then
90fb0c24 4412 $echo "$modename: no file or destination specified" 1>&2
6599da04 4413 else
90fb0c24 4414 $echo "$modename: you must specify a destination" 1>&2
6599da04 4415 fi
cf4ccd63 4416 $echo "$help" 1>&2
6599da04
JM
4417 exit 1
4418 fi
4419
4420 # Strip any trailing slash from the destination.
cf4ccd63 4421 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
6599da04
JM
4422
4423 # Check to see that the destination is a directory.
4424 test -d "$dest" && isdir=yes
cf4ccd63 4425 if test "$isdir" = yes; then
6599da04
JM
4426 destdir="$dest"
4427 destname=
4428 else
cf4ccd63
JL
4429 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4430 test "X$destdir" = "X$dest" && destdir=.
4431 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
6599da04
JM
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
90fb0c24
TT
4436 $echo "$modename: \`$dest' is not a directory" 1>&2
4437 $echo "$help" 1>&2
4438 exit 1
6599da04
JM
4439 fi
4440 fi
82e23236 4441 case $destdir in
d207ebef 4442 [\\/]* | [A-Za-z]:[\\/]*) ;;
6599da04
JM
4443 *)
4444 for file in $files; do
82e23236 4445 case $file in
90fb0c24
TT
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
6599da04
JM
4453 done
4454 ;;
4455 esac
4456
cf4ccd63
JL
4457 # This variable tells wrapper scripts just to set variables rather
4458 # than running their programs.
4459 libtool_install_magic="$magic"
4460
6599da04
JM
4461 staticlibs=
4462 future_libdirs=
4463 current_libdirs=
4464 for file in $files; do
4465
4466 # Do each installation.
82e23236 4467 case $file in
4f4caf92 4468 *.$libext)
90fb0c24
TT
4469 # Do the static libraries later.
4470 staticlibs="$staticlibs $file"
4471 ;;
6599da04
JM
4472
4473 *.la)
90fb0c24
TT
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=
4f4caf92 4484 relink_command=
90fb0c24 4485 # If there is no directory component, then add one.
82e23236 4486 case $file in
90fb0c24
TT
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
4f4caf92 4505 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
90fb0c24
TT
4506 test "X$dir" = "X$file/" && dir=
4507 dir="$dir$objdir"
4508
06298abd 4509 if test -n "$relink_command"; then
4f4caf92
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
90fb0c24
TT
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
4f4caf92 4526 srcname="$realname"
06298abd 4527 test -n "$relink_command" && srcname="$realname"T
4f4caf92 4528
90fb0c24 4529 # Install the shared library and build the symlinks.
4f4caf92
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
90fb0c24
TT
4536
4537 if test $# -gt 0; then
4538 # Delete the old symlinks, and create new ones.
4539 for linkname
4540 do
90fb0c24
TT
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)"
fbd836fc 4544 fi
90fb0c24
TT
4545 done
4546 fi
4547
90fb0c24
TT
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
90fb0c24
TT
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 ;;
6599da04
JM
4569
4570 *.lo)
90fb0c24
TT
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.
82e23236 4582 case $destfile in
90fb0c24
TT
4583 *.lo)
4584 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4585 ;;
4f4caf92 4586 *.$objext)
90fb0c24
TT
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 ;;
6599da04
JM
4613
4614 *)
90fb0c24
TT
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
4f4caf92 4625 uninst_deplibs=
90fb0c24
TT
4626 relink_command=
4627
4628 # If there is no directory component, then add one.
82e23236 4629 case $file in
90fb0c24
TT
4630 */* | *\\*) . $file ;;
4631 *) . ./$file ;;
4632 esac
4633
4634 # Check the variables that should have been set.
4f4caf92 4635 if test -z "$uninst_deplibs"; then
90fb0c24
TT
4636 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4637 exit 1
4638 fi
4639
4640 finalize=yes
4f4caf92 4641 for lib in $uninst_deplibs; do
90fb0c24
TT
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.
82e23236 4646 case $lib in
90fb0c24
TT
4647 */* | *\\*) . $lib ;;
4648 *) . ./$lib ;;
4649 esac
4650 fi
4f4caf92 4651 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
90fb0c24
TT
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
4f4caf92
AO
4658 relink_command=
4659 # If there is no directory component, then add one.
82e23236 4660 case $file in
4f4caf92
AO
4661 */* | *\\*) . $file ;;
4662 *) . ./$file ;;
4663 esac
4664
90fb0c24
TT
4665 outputname=
4666 if test "$fast_install" = no && test -n "$relink_command"; then
d207ebef
JM
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
4f4caf92 4676 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
d207ebef 4677 outputname="$tmpdir/$file"
90fb0c24
TT
4678 # Replace the output file specification.
4679 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4680
90fb0c24
TT
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
d207ebef 4685 ${rm}r "$tmpdir"
90fb0c24
TT
4686 continue
4687 fi
4688 file="$outputname"
4689 else
d207ebef 4690 $echo "$modename: warning: cannot relink \`$file'" 1>&2
90fb0c24
TT
4691 fi
4692 else
4693 # Install the binary that we compiled earlier.
cf4ccd63 4694 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
90fb0c24
TT
4695 fi
4696 fi
6599da04 4697
90fb0c24
TT
4698 $show "$install_prog$stripme $file $destfile"
4699 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
d207ebef 4700 test -n "$outputname" && ${rm}r "$tmpdir"
90fb0c24 4701 ;;
6599da04
JM
4702 esac
4703 done
4704
4705 for file in $staticlibs; do
cf4ccd63 4706 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6599da04
JM
4707
4708 # Set up the ranlib parameters.
4709 oldlib="$destdir/$name"
4710
4711 $show "$install_prog $file $oldlib"
cf4ccd63 4712 $run eval "$install_prog \$file \$oldlib" || exit $?
6599da04 4713
4f4caf92
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
6599da04 4719 # Do each command in the postinstall commands.
cf4ccd63 4720 eval cmds=\"$old_postinstall_cmds\"
90fb0c24 4721 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
6599da04 4722 for cmd in $cmds; do
90fb0c24
TT
4723 IFS="$save_ifs"
4724 $show "$cmd"
4725 $run eval "$cmd" || exit $?
6599da04
JM
4726 done
4727 IFS="$save_ifs"
4728 done
4729
4730 if test -n "$future_libdirs"; then
cf4ccd63 4731 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6599da04
JM
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"
cf4ccd63 4737 exec $SHELL $0 --finish$current_libdirs
6599da04
JM
4738 exit 1
4739 fi
4740
4741 exit 0
4742 ;;
4743
cf4ccd63
JL
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
90fb0c24 4753 libdirs="$libdirs $dir"
cf4ccd63
JL
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\"
90fb0c24
TT
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
cf4ccd63 4765 $cmd"
90fb0c24
TT
4766 done
4767 IFS="$save_ifs"
cf4ccd63
JL
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
90fb0c24
TT
4778 # Exit here if they wanted silent mode.
4779 test "$show" = : && exit 0
4780
cf4ccd63
JL
4781 echo "----------------------------------------------------------------------"
4782 echo "Libraries have been installed in:"
4783 for libdir in $libdirs; do
4784 echo " $libdir"
6599da04 4785 done
cf4ccd63 4786 echo
90fb0c24
TT
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:"
cf4ccd63
JL
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\"
6599da04 4802
cf4ccd63 4803 echo " - use the \`$flag' linker flag"
6599da04 4804 fi
cf4ccd63
JL
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 ;;
6599da04 4817
cf4ccd63
JL
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
6599da04 4829
cf4ccd63
JL
4830 # Handle -dlopen flags immediately.
4831 for file in $execute_dlfiles; do
fbd836fc 4832 if test ! -f "$file"; then
cf4ccd63
JL
4833 $echo "$modename: \`$file' is not a file" 1>&2
4834 $echo "$help" 1>&2
4835 exit 1
6599da04
JM
4836 fi
4837
cf4ccd63 4838 dir=
82e23236 4839 case $file in
cf4ccd63 4840 *.la)
90fb0c24
TT
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
cf4ccd63
JL
4848
4849 # Read the libtool library.
4850 dlname=
4851 library_names=
4852
90fb0c24 4853 # If there is no directory component, then add one.
82e23236 4854 case $file in
cf4ccd63 4855 */* | *\\*) . $file ;;
90fb0c24 4856 *) . ./$file ;;
cf4ccd63
JL
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
90fb0c24 4885 continue
cf4ccd63 4886 ;;
6599da04
JM
4887 esac
4888
cf4ccd63
JL
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\""
6599da04 4896 else
cf4ccd63 4897 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6599da04
JM
4898 fi
4899 done
6599da04 4900
cf4ccd63
JL
4901 # This variable tells wrapper scripts just to set shlibpath_var
4902 # rather than running their programs.
4903 libtool_execute_magic="$magic"
6599da04 4904
cf4ccd63
JL
4905 # Check if any of the arguments is a wrapper script.
4906 args=
4907 for file
4908 do
82e23236 4909 case $file in
cf4ccd63
JL
4910 -*) ;;
4911 *)
90fb0c24
TT
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
cf4ccd63 4914 # If there is no directory component, then add one.
82e23236 4915 case $file in
cf4ccd63
JL
4916 */* | *\\*) . $file ;;
4917 *) . ./$file ;;
4918 esac
6599da04 4919
cf4ccd63
JL
4920 # Transform arg to wrapped name.
4921 file="$progdir/$program"
4922 fi
90fb0c24 4923 ;;
cf4ccd63
JL
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
6599da04 4929
cf4ccd63 4930 if test -z "$run"; then
d207ebef 4931 if test -n "$shlibpath_var"; then
4f4caf92
AO
4932 # Export the shlibpath_var.
4933 eval "export $shlibpath_var"
d207ebef 4934 fi
cf4ccd63 4935
fbd836fc
ILT
4936 # Restore saved enviroment variables
4937 if test "${save_LC_ALL+set}" = set; then
90fb0c24 4938 LC_ALL="$save_LC_ALL"; export LC_ALL
fbd836fc
ILT
4939 fi
4940 if test "${save_LANG+set}" = set; then
90fb0c24 4941 LANG="$save_LANG"; export LANG
fbd836fc
ILT
4942 fi
4943
cf4ccd63
JL
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.
d207ebef 4951 if test -n "$shlibpath_var"; then
4f4caf92
AO
4952 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4953 $echo "export $shlibpath_var"
d207ebef 4954 fi
cf4ccd63
JL
4955 $echo "$cmd$args"
4956 exit 0
6599da04 4957 fi
6599da04
JM
4958 ;;
4959
4f4caf92
AO
4960 # libtool clean and uninstall mode
4961 clean | uninstall)
4962 modename="$modename: $mode"
6599da04
JM
4963 rm="$nonopt"
4964 files=
4965
4f4caf92
AO
4966 # This variable tells wrapper scripts just to set variables rather
4967 # than running their programs.
4968 libtool_install_magic="$magic"
4969
6599da04
JM
4970 for arg
4971 do
82e23236 4972 case $arg in
6599da04
JM
4973 -*) rm="$rm $arg" ;;
4974 *) files="$files $arg" ;;
4975 esac
4976 done
4977
4978 if test -z "$rm"; then
cf4ccd63
JL
4979 $echo "$modename: you must specify an RM program" 1>&2
4980 $echo "$help" 1>&2
6599da04
JM
4981 exit 1
4982 fi
4983
82e23236
AO
4984 rmdirs=
4985
6599da04 4986 for file in $files; do
cf4ccd63 4987 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4f4caf92
AO
4988 if test "X$dir" = "X$file"; then
4989 dir=.
4990 objdir="$objdir"
4991 else
4992 objdir="$dir/$objdir"
4993 fi
cf4ccd63 4994 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4f4caf92 4995 test $mode = uninstall && objdir="$dir"
6599da04 4996
82e23236
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
6599da04
JM
5005 rmfiles="$file"
5006
82e23236 5007 case $name in
6599da04 5008 *.la)
90fb0c24
TT
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
4f4caf92 5015 rmfiles="$rmfiles $objdir/$n"
90fb0c24 5016 done
4f4caf92
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
cf4ccd63 5030 IFS="$save_ifs"
4f4caf92 5031 fi
6599da04 5032
4f4caf92
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
cf4ccd63 5042 IFS="$save_ifs"
4f4caf92
AO
5043 fi
5044 # FIXME: should reinstall the best remaining shared library.
cf4ccd63 5045 fi
90fb0c24
TT
5046 fi
5047 ;;
6599da04
JM
5048
5049 *.lo)
4f4caf92 5050 # Possibly a libtool object, so verify it.
82e23236 5051 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4f4caf92
AO
5052
5053 # Read the .lo file
82e23236 5054 . $dir/$name
4f4caf92
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
90fb0c24 5067 fi
90fb0c24 5068 ;;
6599da04 5069
cf4ccd63 5070 *)
4f4caf92
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
cf4ccd63
JL
5082 ;;
5083 esac
4f4caf92
AO
5084 $show "$rm $rmfiles"
5085 $run $rm $rmfiles
6599da04 5086 done
82e23236
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
6599da04
JM
5096 exit 0
5097 ;;
5098
cf4ccd63
JL
5099 "")
5100 $echo "$modename: you must specify a MODE" 1>&2
5101 $echo "$generic_help" 1>&2
6599da04
JM
5102 exit 1
5103 ;;
5104 esac
5105
cf4ccd63
JL
5106 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5107 $echo "$generic_help" 1>&2
6599da04
JM
5108 exit 1
5109fi # test -z "$show_help"
5110
5111# We need to display help for each of the modes.
82e23236 5112case $mode in
cf4ccd63
JL
5113"") $echo \
5114"Usage: $modename [OPTION]... [MODE-ARG]...
6599da04
JM
5115
5116Provide generalized library-building support services.
5117
cf4ccd63
JL
5118 --config show all configuration variables
5119 --debug enable verbose shell tracing
6599da04 5120-n, --dry-run display commands without modifying any files
cf4ccd63 5121 --features display basic configuration information and exit
6599da04
JM
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]
cf4ccd63
JL
5125 --quiet same as \`--silent'
5126 --silent don't print informational messages
4f4caf92 5127 --tag=TAG use configuration variables from tag TAG
6599da04
JM
5128 --version print version information
5129
5130MODE must be one of the following:
5131
4f4caf92 5132 clean remove files from the build directory
6599da04 5133 compile compile a source file into a libtool object
cf4ccd63 5134 execute automatically set library path, then run a program
6599da04
JM
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
cf4ccd63
JL
5140MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
5141a more detailed description of MODE."
5142 exit 0
6599da04
JM
5143 ;;
5144
4f4caf92
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
6599da04 5159compile)
cf4ccd63
JL
5160 $echo \
5161"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6599da04
JM
5162
5163Compile a source file into a libtool library object.
5164
fbd836fc
ILT
5165This mode accepts the following additional options:
5166
90fb0c24 5167 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
fbd836fc
ILT
5168 -static always build a \`.o' file suitable for static linking
5169
6599da04
JM
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
cf4ccd63 5175library object suffix, \`.lo'."
6599da04
JM
5176 ;;
5177
cf4ccd63
JL
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:
6599da04 5185
cf4ccd63 5186 -dlopen FILE add the directory containing FILE to the library path
6599da04 5187
cf4ccd63
JL
5188This mode sets the library path environment variable according to \`-dlopen'
5189flags.
6599da04 5190
cf4ccd63
JL
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."
6599da04
JM
5196 ;;
5197
5198finish)
cf4ccd63
JL
5199 $echo \
5200"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6599da04
JM
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
cf4ccd63 5207the \`--dry-run' option if you just want to see what would be executed."
6599da04
JM
5208 ;;
5209
5210install)
cf4ccd63
JL
5211 $echo \
5212"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6599da04
JM
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
cf4ccd63 5220BSD-compatible install options are recognized)."
6599da04
JM
5221 ;;
5222
5223link)
cf4ccd63
JL
5224 $echo \
5225"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6599da04
JM
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
cf4ccd63 5235 -all-static do not do any dynamic linking at all
90fb0c24 5236 -avoid-version do not add a version suffix if possible
cf4ccd63 5237 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
90fb0c24 5238 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6599da04 5239 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
90fb0c24
TT
5240 -export-symbols SYMFILE
5241 try to export only the symbols listed in SYMFILE
d207ebef
JM
5242 -export-symbols-regex REGEX
5243 try to export only the symbols matching REGEX
6599da04
JM
5244 -LLIBDIR search LIBDIR for required installed libraries
5245 -lNAME OUTPUT-FILE requires the installed library libNAME
90fb0c24 5246 -module build a library that can dlopened
4f4caf92
AO
5247 -no-fast-install disable the fast-install mode
5248 -no-install link a not-installable executable
cf4ccd63 5249 -no-undefined declare that a library does not refer to external symbols
6599da04 5250 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
82e23236 5251 -objectlist FILE Use a list of object files found in FILE to specify objects
cf4ccd63 5252 -release RELEASE specify package release information
6599da04 5253 -rpath LIBDIR the created library will eventually be installed in LIBDIR
90fb0c24 5254 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
cf4ccd63 5255 -static do not do any dynamic linking of libtool libraries
6599da04 5256 -version-info CURRENT[:REVISION[:AGE]]
90fb0c24 5257 specify library version info [each variable defaults to 0]
6599da04
JM
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
90fb0c24
TT
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.
6599da04 5268
fbd836fc 5269If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
90fb0c24 5270using \`ar' and \`ranlib', or on Windows using \`lib'.
6599da04 5271
fbd836fc
ILT
5272If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5273is created, otherwise an executable program is created."
6599da04
JM
5274 ;;
5275
5276uninstall)
d207ebef 5277 $echo \
cf4ccd63 5278"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6599da04
JM
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.
cf4ccd63 5287Otherwise, only FILE itself is deleted using RM."
6599da04
JM
5288 ;;
5289
5290*)
cf4ccd63
JL
5291 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5292 $echo "$help" 1>&2
6599da04
JM
5293 exit 1
5294 ;;
5295esac
5296
cf4ccd63
JL
5297echo
5298$echo "Try \`$modename --help' for more information about other modes."
6599da04
JM
5299
5300exit 0
5301
9bad11e1
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
4f4caf92
AO
5313### BEGIN LIBTOOL TAG CONFIG: disable-shared
5314build_libtool_libs=no
9bad11e1 5315build_old_libs=yes
4f4caf92
AO
5316### END LIBTOOL TAG CONFIG: disable-shared
5317
5318### BEGIN LIBTOOL TAG CONFIG: disable-static
9bad11e1 5319build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
4f4caf92
AO
5320### END LIBTOOL TAG CONFIG: disable-static
5321
6599da04
JM
5322# Local Variables:
5323# mode:shell-script
5324# sh-indentation:2
5325# End: