VirtualBox

source: vbox/trunk/src/libs/libxml2-2.6.30/ltmain.sh@ 38157

最後變更 在這個檔案從38157是 33656,由 vboxsync 提交於 14 年 前

*: rebrand Sun (L)GPL disclaimers

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette