source: trunk/ORBit2-2.14.0/ltmain.sh

Last change on this file was 92, checked in by cinc, 19 years ago

Orbit2 modified for use with NOM

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