source: trunk/Taper/admin/ltmain.sh@ 6728

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