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