Add new netstatus plugin ported from GNOME netstatus panel applet.
[lxde/lxpanel.git] / ltmain.sh
CommitLineData
a52c2257
HJYP
1# Generated from ltmain.m4sh; do not edit by hand
2
3# ltmain.sh (GNU libtool 1.2237 2005/12/21 11:40:47) 2.1a
4# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
5
6# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
7# This is free software; see the source for copying conditions. There is NO
8# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful, but
16# WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18# General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23#
24# As a special exception to the GNU General Public License, if you
25# distribute this file as part of a program that contains a
26# configuration script generated by Autoconf, you may include it under
27# the same distribution terms that you use for the rest of that program.
28
29# Usage: $progname [OPTION]... [MODE-ARG]...
30#
31# Provide generalized library-building support services.
32#
33# --config show all configuration variables
34# --debug enable verbose shell tracing
35# -n, --dry-run display commands without modifying any files
36# --features display basic configuration information and exit
37# --mode=MODE use operation mode MODE
38# --preserve-dup-deps don't remove duplicate dependency libraries
39# --quiet, --silent don't print informational messages
40# --tag=TAG use configuration variables from tag TAG
41# -v, --verbose print informational messages (default)
42# --version print version information
43# -h, --help print short or long help message
44#
45# MODE must be one of the following:
46#
47# clean remove files from the build directory
48# compile compile a source file into a libtool object
49# execute automatically set library path, then run a program
50# finish complete the installation of libtool libraries
51# install install libraries or executables
52# link create a library or an executable
53# uninstall remove libraries from an installed directory
54#
55# MODE-ARGS vary depending on the MODE.
56# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
57#
58# When reporting a bug, please describe a test case to reproduce it and
59# include the following information:
60#
61# host-triplet: i486-pc-linux-gnu
62# shell: $SHELL
63# compiler: $LTCC
64# compiler flags: $LTCFLAGS
65# linker: $LD (gnu? $with_gnu_ld)
66# $progname: (GNU libtool 1.2237 2005/12/21 11:40:47) 2.1a
67# automake: $automake_version
68# autoconf: $autoconf_version
69#
70# Report bugs to <bug-libtool@gnu.org>.
71
72PROGRAM=ltmain.sh
73PACKAGE=libtool
74VERSION="2.1a Debian 1.9+20051221-1"
75TIMESTAMP=" 1.2237 2005/12/21 11:40:47"
76package_revision=1.2237
77
78## --------------------- ##
79## M4sh Initialization. ##
80## --------------------- ##
81
82# Be Bourne compatible
83if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
84 emulate sh
85 NULLCMD=:
86 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
87 # is contrary to our usage. Disable this feature.
88 alias -g '${1+"$@"}'='"$@"'
89elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
90 set -o posix
91fi
92DUALCASE=1; export DUALCASE # for MKS sh
93
94# Support unset when possible.
95if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
96 as_unset=unset
97else
98 as_unset=false
99fi
100
101
102# Work around bugs in pre-3.0 UWIN ksh.
103$as_unset ENV MAIL MAILPATH
104PS1='$ '
105PS2='> '
106PS4='+ '
107
108# NLS nuisances.
109for as_var in \
110 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
111 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
112 LC_TELEPHONE LC_TIME
113do
114 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
115 eval $as_var=C; export $as_var
116 else
117 $as_unset $as_var
118 fi
119done
120
121# Required to use basename.
122if expr a : '\(a\)' >/dev/null 2>&1; then
123 as_expr=expr
124else
125 as_expr=false
126fi
127
128if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
129 as_basename=basename
130else
131 as_basename=false
132fi
133
134
135# Name of the executable.
136as_me=`$as_basename "$0" ||
137$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
138 X"$0" : 'X\(//\)$' \| \
139 X"$0" : 'X\(/\)$' \| \
140 . : '\(.\)' 2>/dev/null ||
141echo X/"$0" |
142 sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
143 /^X\/\(\/\/\)$/{ s//\1/; q; }
144 /^X\/\(\/\).*/{ s//\1/; q; }
145 s/.*/./; q'`
146
147
148$as_unset CDPATH
149
150
151
152: ${CP="cp -f"}
153: ${ECHO="echo"}
154: ${EGREP="grep -E"}
155: ${FGREP="grep -F"}
156: ${GREP="grep"}
157: ${LN_S="ln -s"}
158: ${MAKE="make"}
159: ${MKDIR="mkdir"}
160: ${MV="mv -f"}
161: ${RM="rm -f"}
162: ${SED="/bin/sed"}
163: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
164: ${Xsed="$SED -e 1s/^X//"}
165
166# Global variables:
167EXIT_SUCCESS=0
168EXIT_FAILURE=1
169EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
170EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
171
172exit_status=$EXIT_SUCCESS
173
174# Make sure IFS has a sensible default
175lt_nl='
176'
177IFS=" $lt_nl"
178
179dirname="s,/[^/]*$,,"
180basename="s,^.*/,,"
181
182# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
183# is ksh but when the shell is invoked as "sh" and the current value of
184# the _XPG environment variable is not equal to 1 (one), the special
185# positional parameter $0, within a function call, is the name of the
186# function.
187progpath="$0"
188
189# The name of this program:
190# In the unlikely event $progname began with a '-', it would play havoc with
191# func_echo (imagine progname=-n), so we prepend ./ in that case:
192progname=`$ECHO "X$progpath" | $Xsed -e "$basename" -e 's,^-,./-,'`
193
194# Make sure we have an absolute path for reexecution:
195case $progpath in
196 [\\/]*|[A-Za-z]:\\*) ;;
197 *[\\/]*)
198 progdir=`$ECHO "X$progpath" | $Xsed -e "$dirname"`
199 progdir=`cd "$progdir" && pwd`
200 progpath="$progdir/$progname"
201 ;;
202 *)
203 save_IFS="$IFS"
204 IFS=:
205 for progdir in $PATH; do
206 IFS="$save_IFS"
207 test -x "$progdir/$progname" && break
208 done
209 IFS="$save_IFS"
210 test -n "$progdir" || progdir=`pwd`
211 progpath="$progdir/$progname"
212 ;;
213esac
214
215# Sed substitution that helps us do robust quoting. It backslashifies
216# metacharacters that are still active within double-quoted strings.
217Xsed="${SED}"' -e 1s/^X//'
218sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
219
220# Same as above, but do not quote variable references.
221double_quote_subst='s/\(["`\\]\)/\\\1/g'
222
223# Re-`\' parameter expansions in output of double_quote_subst that were
224# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
225# in input to double_quote_subst, that '$' was protected from expansion.
226# Since each input `\' is now two `\'s, look for any number of runs of
227# four `\'s followed by two `\'s and then a '$'. `\' that '$'. Note
228# that the embedded single quotes serve only to enhance readability.
229sed_double_backslash='s/^\(\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/;
230 s/\([^\\]\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/g'
231
232# test EBCDIC or ASCII
233case `echo X|tr X '\101'` in
234 A) # ASCII based system
235 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
236 SP2NL='tr \040 \012'
237 NL2SP='tr \015\012 \040\040'
238 ;;
239 *) # EBCDIC based system
240 SP2NL='tr \100 \n'
241 NL2SP='tr \r\n \100\100'
242 ;;
243esac
244
245# Standard options:
246opt_dry_run=false
247opt_help=false
248opt_quiet=false
249opt_verbose=false
250
251# func_echo arg...
252# Echo program name prefixed message, along with the current mode
253# name if it has been set yet.
254func_echo ()
255{
256 $ECHO "$progname${mode+: }$mode: "${1+"$@"}
257}
258
259# func_verbose arg...
260# Echo program name prefixed message in verbose mode only.
261func_verbose ()
262{
263 $opt_verbose && func_echo ${1+"$@"}
264
265 # A bug in bash halts the script if the last line of a function
266 # fails when set -e is in force, so we need another command to
267 # work around that:
268 :
269}
270
271# func_error arg...
272# Echo program name prefixed message to standard error.
273func_error ()
274{
275 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
276}
277
278# func_warning arg...
279# Echo program name prefixed warning message to standard error.
280func_warning ()
281{
282 $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
283}
284
285# func_fatal_error arg...
286# Echo program name prefixed message to standard error, and exit.
287func_fatal_error ()
288{
289 func_error ${1+"$@"}
290 exit $EXIT_FAILURE
291}
292
293# func_fatal_help arg...
294# Echo program name prefixed message to standard error, followed by
295# a help hint, and exit.
296func_fatal_help ()
297{
298 func_error ${1+"$@"}
299 func_fatal_error "$help"
300}
301help="Try \`$progname --help' for more information." ## default
302
303
304# func_grep expression filename
305# Check whether EXPRESSION matches any line of FILENAME, without output.
306func_grep ()
307{
308 $GREP "$1" "$2" >/dev/null 2>&1
309}
310
311
312# func_mkdir_p directory-path
313# Make sure the entire path to DIRECTORY-PATH is available.
314func_mkdir_p ()
315{
316 my_directory_path="$1"
317 my_dir_list=
318
319 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
320
321 # Protect directory names starting with `-'
322 case $my_directory_path in
323 -*) my_directory_path="./$my_directory_path" ;;
324 esac
325
326 # While some portion of DIR does not yet exist...
327 while test ! -d "$my_directory_path"; do
328 # ...make a list in topmost first order. Use a colon delimited
329 # list incase some portion of path contains whitespace.
330 my_dir_list="$my_directory_path:$my_dir_list"
331
332 # If the last portion added has no slash in it, the list is done
333 case $my_directory_path in */*) ;; *) break ;; esac
334
335 # ...otherwise throw away the child directory and loop
336 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
337 done
338 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
339
340 save_mkdir_p_IFS="$IFS"; IFS=':'
341 for my_dir in $my_dir_list; do
342 IFS="$save_mkdir_p_IFS"
343 # mkdir can fail with a `File exist' error if two processes
344 # try to create one of the directories concurrently. Don't
345 # stop in that case!
346 $MKDIR "$my_dir" 2>/dev/null || :
347 done
348 IFS="$save_mkdir_p_IFS"
349
350 # Bail out if we (or some other process) failed to create a directory.
351 test -d "$my_directory_path" || \
352 func_fatal_error "Failed to create \`$1'"
353 fi
354}
355
356
357# func_mktempdir [string]
358# Make a temporary directory that won't clash with other running
359# libtool processes, and avoids race conditions if possible. If
360# given, STRING is the basename for that directory.
361func_mktempdir ()
362{
363 my_template="${TMPDIR-/tmp}/${1-$progname}"
364
365 if test "$opt_dry_run" = ":"; then
366 # Return a directory name, but don't create it in dry-run mode
367 my_tmpdir="${my_template}-$$"
368 else
369
370 # If mktemp works, use that first and foremost
371 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
372
373 if test ! -d "$my_tmpdir"; then
374 # Failing that, at least try and use $RANDOM to avoid a race
375 my_tmpdir="${my_template}-${RANDOM-0}$$"
376
377 save_mktempdir_umask=`umask`
378 umask 0077
379 $MKDIR "$my_tmpdir"
380 umask $save_mktempdir_umask
381 fi
382
383 # If we're not in dry-run mode, bomb out on failure
384 test -d "$my_tmpdir" || \
385 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
386 fi
387
388 $ECHO "X$my_tmpdir" | $Xsed
389}
390
391
392# func_quote_for_eval arg
393# Aesthetically quote ARG to be evaled later.
394# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
395# is double-quoted, suitable for a subsequent eval, whereas
396# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
397# which are still active within double quotes backslashified.
398func_quote_for_eval ()
399{
400 case $1 in
401 *[\\\`\"\$]*)
402 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
403 *)
404 func_quote_for_eval_unquoted_result="$1" ;;
405 esac
406
407 case $func_quote_for_eval_unquoted_result in
408 # Double-quote args containing shell metacharacters to delay
409 # word splitting, command substitution and and variable
410 # expansion for a subsequent eval.
411 # Many Bourne shells cannot handle close brackets correctly
412 # in scan sets, so we specify it separately.
413 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
414 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
415 ;;
416 *)
417 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
418 esac
419}
420
421
422# func_quote_for_expand arg
423# Aesthetically quote ARG to be evaled later; same as above,
424# but do not quote variable references.
425func_quote_for_expand ()
426{
427 case $1 in
428 *[\\\`\"]*)
429 my_arg=`$ECHO "X$1" | $Xsed \
430 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
431 *)
432 my_arg="$1" ;;
433 esac
434
435 case $my_arg in
436 # Double-quote args containing shell metacharacters to delay
437 # word splitting and command substitution for a subsequent eval.
438 # Many Bourne shells cannot handle close brackets correctly
439 # in scan sets, so we specify it separately.
440 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
441 my_arg="\"$my_arg\""
442 ;;
443 esac
444
445 func_quote_for_expand_result="$my_arg"
446}
447
448
449# func_show_eval cmd [fail_exp]
450# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
451# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
452# is given, then evaluate it.
453func_show_eval ()
454{
455 my_cmd="$1"
456 my_fail_exp="${2-:}"
457
458 ${opt_silent-false} || {
459 func_quote_for_expand "$my_cmd"
460 eval "func_echo $func_quote_for_expand_result"
461 }
462
463 if ${opt_dry_run-false}; then :; else
464 eval "$my_cmd"
465 my_status=$?
466 if test "$my_status" -eq 0; then :; else
467 eval "(exit $my_status); $my_fail_exp"
468 fi
469 fi
470}
471
472
473# func_version
474# Echo version message to standard output and exit.
475func_version ()
476{
477 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
478 s/^# //; s/^# *$//;
479 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/;
480 p;
481 }' < "$progpath"
482 exit $?
483}
484
485# func_usage
486# Echo short help message to standard output and exit.
487func_usage ()
488{
489 $SED -n '/^# Usage:/,/# -h/ {
490 s/^# //; s/^# *$//;
491 s/\$progname/'$progname'/;
492 p;
493 }' < "$progpath"
494 $ECHO
495 $ECHO "run \`$progname --help | more' for full usage"
496 exit $?
497}
498
499# func_help
500# Echo long help message to standard output and exit.
501func_help ()
502{
503 $SED -n '/^# Usage:/,/# Report bugs to/ {
504 s/^# //; s/^# *$//;
505 s*\$progname*'$progname'*;
506 s*\$SHELL*'"$SHELL"'*;
507 s*\$LTCC*'"$LTCC"'*;
508 s*\$LTCFLAGS*'"$LTCFLAGS"'*;
509 s*\$LD*'"$LD"'*;
510 s/\$with_gnu_ld/'"$with_gnu_ld"'/;
511 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/;
512 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/;
513 p;
514 }' < "$progpath"
515 exit $?
516}
517
518# func_missing_arg argname
519# Echo program name prefixed message to standard error and set global
520# exit_cmd.
521func_missing_arg ()
522{
523 func_error "missing argument for $1"
524 exit_cmd=exit
525}
526
527exit_cmd=:
528
529
530# Check that we have a working $ECHO.
531if test "X$1" = X--no-reexec; then
532 # Discard the --no-reexec flag, and continue.
533 shift
534elif test "X$1" = X--fallback-echo; then
535 # Avoid inline document here, it may be left over
536 :
537elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
538 # Yippee, $ECHO works!
539 :
540else
541 # Restart under the correct shell, and then maybe $ECHO will work.
542 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
543fi
544
545if test "X$1" = X--fallback-echo; then
546 # used as fallback echo
547 shift
548 cat <<EOF
549$*
550EOF
551 exit $EXIT_SUCCESS
552fi
553
554magic="%%%MAGIC variable%%%"
555
556
557# Global variables.
558# $mode is unset
559nonopt=
560execute_dlfiles=
561preserve_args=
562lo2o="s/\\.lo\$/.${objext}/"
563o2lo="s/\\.${objext}\$/.lo/"
564
565opt_dry_run=false
566opt_duplicate_deps=false
567opt_silent=false
568opt_debug=:
569
570# If this variable is set in any of the actions, the command in it
571# will be execed at the end. This prevents here-documents from being
572# left over by shells.
573exec_cmd=
574
575# func_fatal_configuration arg...
576# Echo program name prefixed message to standard error, followed by
577# a configuration failure hint, and exit.
578func_fatal_configuration ()
579{
580 func_error ${1+"$@"}
581 func_error "See the $PACKAGE documentation for more information."
582 func_fatal_error "Fatal configuration error."
583}
584
585
586# func_config
587# Display the configuration for all the tags in this script.
588func_config ()
589{
590 re_begincf='^# ### BEGIN LIBTOOL'
591 re_endcf='^# ### END LIBTOOL'
592
593 # Default configuration.
594 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
595
596 # Now print the configurations for the tags.
597 for tagname in $taglist; do
598 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
599 done
600
601 exit $?
602}
603
604# func_features
605# Display the features supported by this script.
606func_features ()
607{
608 $ECHO "host: $host"
609 if test "$build_libtool_libs" = yes; then
610 $ECHO "enable shared libraries"
611 else
612 $ECHO "disable shared libraries"
613 fi
614 if test "$build_old_libs" = yes; then
615 $ECHO "enable static libraries"
616 else
617 $ECHO "disable static libraries"
618 fi
619
620 exit $?
621}
622
623# func_enable_tag tagname
624# Verify that TAGNAME is valid, and either flag an error and exit, or
625# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
626# variable here.
627func_enable_tag ()
628{
629 # Global variable:
630 tagname="$1"
631
632 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
633 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
634 sed_extractcf="/$re_begincf/,/$re_endcf/p"
635
636 # Validate tagname.
637 case $tagname in
638 *[!-_A-Za-z0-9,/]*)
639 func_fatal_error "invalid tag name: $tagname"
640 ;;
641 esac
642
643 # Don't test for the "default" C tag, as we know it's
644 # there but not specially marked.
645 case $tagname in
646 CC) ;;
647 *)
648 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
649 taglist="$taglist $tagname"
650
651 # Evaluate the configuration. Be careful to quote the path
652 # and the sed script, to avoid splitting on whitespace, but
653 # also don't use non-portable quotes within backquotes within
654 # quotes we have to do it in 2 steps:
655 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
656 eval "$extractedcf"
657 else
658 func_error "ignoring unknown tag $tagname"
659 fi
660 ;;
661 esac
662}
663
664
665func_mode_help ()
666{
667 # We need to display help for each of the modes.
668 case $mode in
669 "")
670 # Generic help is extracted from the usage comments
671 # at the start of this file.
672 func_help
673 ;;
674
675 clean)
676 $ECHO \
677"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
678
679Remove files from the build directory.
680
681RM is the name of the program to use to delete files associated with each FILE
682(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
683to RM.
684
685If FILE is a libtool library, object or program, all the files associated
686with it are deleted. Otherwise, only FILE itself is deleted using RM."
687 ;;
688
689 compile)
690 $ECHO \
691"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
692
693Compile a source file into a libtool library object.
694
695This mode accepts the following additional options:
696
697 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
698 -no-suppress do not suppress compiler output for multiple passes
699 -prefer-pic try to building PIC objects only
700 -prefer-non-pic try to building non-PIC objects only
701 -shared do not build a \`.o' file suitable for static linking
702 -static only build a \`.o' file suitable for static linking
703
704COMPILE-COMMAND is a command to be used in creating a \`standard' object file
705from the given SOURCEFILE.
706
707The output file name is determined by removing the directory component from
708SOURCEFILE, then substituting the C source code suffix \`.c' with the
709library object suffix, \`.lo'."
710 ;;
711
712 execute)
713 $ECHO \
714"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
715
716Automatically set library path, then run a program.
717
718This mode accepts the following additional options:
719
720 -dlopen FILE add the directory containing FILE to the library path
721
722This mode sets the library path environment variable according to \`-dlopen'
723flags.
724
725If any of the ARGS are libtool executable wrappers, then they are translated
726into their corresponding uninstalled binary, and any of their required library
727directories are added to the library path.
728
729Then, COMMAND is executed, with ARGS as arguments."
730 ;;
731
732 finish)
733 $ECHO \
734"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
735
736Complete the installation of libtool libraries.
737
738Each LIBDIR is a directory that contains libtool libraries.
739
740The commands that this mode executes may require superuser privileges. Use
741the \`--dry-run' option if you just want to see what would be executed."
742 ;;
743
744 install)
745 $ECHO \
746"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
747
748Install executables or libraries.
749
750INSTALL-COMMAND is the installation command. The first component should be
751either the \`install' or \`cp' program.
752
753The following components of INSTALL-COMMAND are treated specially:
754
755 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
756
757The rest of the components are interpreted as arguments to that command (only
758BSD-compatible install options are recognized)."
759 ;;
760
761 link)
762 $ECHO \
763"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
764
765Link object files or libraries together to form another library, or to
766create an executable program.
767
768LINK-COMMAND is a command using the C compiler that you would use to create
769a program from several object files.
770
771The following components of LINK-COMMAND are treated specially:
772
773 -all-static do not do any dynamic linking at all
774 -avoid-version do not add a version suffix if possible
775 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
776 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
777 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
778 -export-symbols SYMFILE
779 try to export only the symbols listed in SYMFILE
780 -export-symbols-regex REGEX
781 try to export only the symbols matching REGEX
782 -LLIBDIR search LIBDIR for required installed libraries
783 -lNAME OUTPUT-FILE requires the installed library libNAME
784 -module build a library that can dlopened
785 -no-fast-install disable the fast-install mode
786 -no-install link a not-installable executable
787 -no-undefined declare that a library does not refer to external symbols
788 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
789 -objectlist FILE Use a list of object files found in FILE to specify objects
790 -precious-files-regex REGEX
791 don't remove output files matching REGEX
792 -release RELEASE specify package release information
793 -rpath LIBDIR the created library will eventually be installed in LIBDIR
794 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
795 -shared only do dynamic linking of libtool libraries
796 -shrext SUFFIX override the standard shared library file extension
797 -static do not do any dynamic linking of libtool libraries
798 -version-info CURRENT[:REVISION[:AGE]]
799 specify library version info [each variable defaults to 0]
800 -weak LIBNAME declare that the target provides the LIBNAME interface
801
802All other options (arguments beginning with \`-') are ignored.
803
804Every other argument is treated as a filename. Files ending in \`.la' are
805treated as uninstalled libtool libraries, other files are standard or library
806object files.
807
808If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
809only library objects (\`.lo' files) may be specified, and \`-rpath' is
810required, except when creating a convenience library.
811
812If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
813using \`ar' and \`ranlib', or on Windows using \`lib'.
814
815If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
816is created, otherwise an executable program is created."
817 ;;
818
819 uninstall)
820 $ECHO \
821"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
822
823Remove libraries from an installation directory.
824
825RM is the name of the program to use to delete files associated with each FILE
826(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
827to RM.
828
829If FILE is a libtool library, all the files associated with it are deleted.
830Otherwise, only FILE itself is deleted using RM."
831 ;;
832
833 *)
834 func_fatal_help "invalid operation mode \`$mode'"
835 ;;
836 esac
837
838 $ECHO
839 $ECHO "Try \`$progname --help' for more information about other modes."
840
841 exit $?
842}
843
844# TEST SUITE MARKER ## NON-FUNCTION
845# Parse options once, thoroughly. This comes as soon as possible in
846# the script to make things like `libtool --version' happen quickly.
847{
848 # sed scripts:
849 my_sed_single_opt='1s/^\(..\).*$/\1/;q'
850 my_sed_single_rest='1s/^..\(.*\)$/\1/;q'
851 my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
852 my_sed_long_arg='1s/^-[^=]*=//'
853
854 # Shorthand for --mode=foo, only valid as the first argument
855 case $1 in
856 clean|clea|cle|cl)
857 shift; set dummy --mode clean ${1+"$@"}; shift
858 ;;
859 compile|compil|compi|comp|com|co|c)
860 shift; set dummy --mode compile ${1+"$@"}; shift
861 ;;
862 execute|execut|execu|exec|exe|ex|e)
863 shift; set dummy --mode execute ${1+"$@"}; shift
864 ;;
865 finish|finis|fini|fin|fi|f)
866 shift; set dummy --mode finish ${1+"$@"}; shift
867 ;;
868 install|instal|insta|inst|ins|in|i)
869 shift; set dummy --mode install ${1+"$@"}; shift
870 ;;
871 link|lin|li|l)
872 shift; set dummy --mode link ${1+"$@"}; shift
873 ;;
874 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
875 shift; set dummy --mode uninstall ${1+"$@"}; shift
876 ;;
877 esac
878
879 # Parse non-mode specific arguments:
880 while test "$#" -gt 0; do
881 opt="$1"
882 shift
883
884 case $opt in
885 --config) func_config ;;
886
887 --debug) preserve_args="$preserve_args $opt"
888 func_echo "enabling shell trace mode"
889 opt_debug='set -x'
890 $opt_debug
891 ;;
892
893 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
894 execute_dlfiles="$execute_dlfiles $1"
895 shift
896 ;;
897
898 --dry-run | -n) opt_dry_run=: ;;
899 --features) func_features ;;
900 --finish) mode="finish" ;;
901
902 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
903 case $1 in
904 # Valid mode arguments:
905 clean) ;;
906 compile) ;;
907 execute) ;;
908 finish) ;;
909 install) ;;
910 link) ;;
911 relink) ;;
912 uninstall) ;;
913
914 # Catch anything else as an error
915 *) func_error "invalid argument for $opt"
916 exit_cmd=exit
917 break
918 ;;
919 esac
920
921 mode="$1"
922 shift
923 ;;
924
925 --preserve-dup-deps)
926 opt_duplicate_deps=: ;;
927
928 --quiet|--silent) preserve_args="$preserve_args $opt"
929 opt_silent=:
930 ;;
931
932 --verbose| -v) preserve_args="$preserve_args $opt"
933 opt_silent=false
934 ;;
935
936 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
937 preserve_args="$preserve_args $opt $1"
938 func_enable_tag "$1" # tagname is set here
939 shift
940 ;;
941
942 # Separate optargs to long options:
943 -dlopen=*|--mode=*|--tag=*)
944 arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_arg"`
945 opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_opt"`
946 set dummy "$opt" "$arg" ${1+"$@"}
947 shift
948 ;;
949
950 # Separate optargs to short options:
951# -x*|-y*)
952# arg=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`
953# opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`
954# set dummy "$opt" "$arg" ${1+"$@"}
955# shift
956# ;;
957
958 # Separate non-argument short options:
959# -z*|-z*|-y*)
960# rest=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`
961# opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`
962# set dummy "$opt" "-$rest" ${1+"$@"}
963# shift
964# ;;
965
966 -\?|-h) func_usage ;;
967 --help) opt_help=: ;;
968 --version) func_version ;;
969
970 -*) func_fatal_help "unrecognized option \`$opt'" ;;
971
972 *) nonopt="$opt"
973 break
974 ;;
975 esac
976 done
977
978 # Now that we've collected a possible --mode arg, show help if necessary
979 $opt_help && func_mode_help
980
981 case $host in
982 *cygwin* | *mingw* | *pw32*)
983 # don't eliminate duplications in $postdeps and $predeps
984 opt_duplicate_compiler_generated_deps=:
985 ;;
986 *)
987 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
988 ;;
989 esac
990
991 # Having warned about all mis-specified options, bail out if
992 # anything was wrong.
993 $exit_cmd $EXIT_FAILURE
994}
995# TEST SUITE MARKER ## BEGIN SOURCABLE
996
997# func_check_version_match
998# Ensure that we are using m4 macros, and libtool script from the same
999# release of libtool.
1000func_check_version_match ()
1001{
1002 if test "$package_revision" != "$macro_revision"; then
1003 if test "$VERSION" != "$macro_version"; then
1004 if test -z "$macro_version"; then
1005 cat >&2 <<_LT_EOF
1006$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1007$progname: definition of this LT_INIT comes from an older release.
1008$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1009$progname: and run autoconf again.
1010_LT_EOF
1011 else
1012 cat >&2 <<_LT_EOF
1013$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
1014$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
1015$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
1016$progname: and run autoconf again.
1017_LT_EOF
1018 fi
1019 else
1020 cat >&2 <<_LT_EOF
1021$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
1022$progname: but the definition of this LT_INIT comes from revision $macro_revision.
1023$progname: You should recreate aclocal.m4 with macros from revision $package_revision
1024$progname: of $PACKAGE $VERSION and run autoconf again.
1025_LT_EOF
1026 fi
1027
1028 exit $EXIT_MISMATCH
1029 fi
1030}
1031
1032
1033# func_lalib_p file
1034# True iff FILE is a libtool `.la' library or `.lo' object file.
1035# This function is only a basic sanity check; it will hardly flush out
1036# determined imposters.
1037func_lalib_p ()
1038{
1039 $SED -e 4q "$1" 2>/dev/null \
1040 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1041}
1042
1043# func_lalib_unsafe_p file
1044# True iff FILE is a libtool `.la' library or `.lo' object file.
1045# This function implements the same check as func_lalib_p without
1046# resorting to external programs. To this end, it redirects stdin and
1047# closes it afterwards, without saving the original file descriptor.
1048# As a safety measure, use it only where a negative result would be
1049# fatal anyway. Works if `file' does not exist.
1050func_lalib_unsafe_p ()
1051{
1052 lalib_p=no
1053 if test -r "$1" && exec 5<&1 <"$1"; then
1054 for lalib_p_l in 1 2 3 4
1055 do
1056 read lalib_p_line
1057 case "$lalib_p_line" in
1058 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1059 esac
1060 done
1061 exec 1<&5 5<&-
1062 fi
1063 test "$lalib_p" = yes
1064}
1065
1066# func_ltwrapper_p file
1067# True iff FILE is a libtool wrapper script.
1068# This function is only a basic sanity check; it will hardly flush out
1069# determined imposters.
1070func_ltwrapper_p ()
1071{
1072 func_lalib_p "$1"
1073}
1074
1075
1076# func_execute_cmds commands fail_cmd
1077# Execute tilde-delimited COMMANDS.
1078# If FAIL_CMD is given, eval that upon failure.
1079# FAIL_CMD may read-access the current command in variable CMD!
1080func_execute_cmds ()
1081{
1082 $opt_debug
1083 save_ifs=$IFS; IFS='~'
1084 for cmd in $1; do
1085 IFS=$save_ifs
1086 eval cmd=\"$cmd\"
1087 func_show_eval "$cmd" "${2-:}"
1088 done
1089 IFS=$save_ifs
1090}
1091
1092
1093# func_source file
1094# Source FILE, adding directory component if necessary.
1095# Note that it is not necessary on cygwin/mingw to append a dot to
1096# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1097# behavior happens only for exec(3), not for open(2)! Also, sourcing
1098# `FILE.' does not work on cygwin managed mounts.
1099func_source ()
1100{
1101 $opt_debug
1102 case $1 in
1103 */* | *\\*) . "$1" ;;
1104 *) . "./$1" ;;
1105 esac
1106}
1107
1108
1109# Generated shell functions inserted here.
1110
1111
1112# func_win32_libid arg
1113# return the library type of file 'arg'
1114#
1115# Need a lot of goo to handle *both* DLLs and import libs
1116# Has to be a shell function in order to 'eat' the argument
1117# that is supplied when $file_magic_command is called.
1118func_win32_libid ()
1119{
1120 $opt_debug
1121 win32_libid_type="unknown"
1122 win32_fileres=`file -L $1 2>/dev/null`
1123 case $win32_fileres in
1124 *ar\ archive\ import\ library*) # definitely import
1125 win32_libid_type="x86 archive import"
1126 ;;
1127 *ar\ archive*) # could be an import, or static
1128 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
1129 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
1130 win32_nmres=`eval $NM -f posix -A $1 |
1131 $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
1132 case $win32_nmres in
1133 import*) win32_libid_type="x86 archive import";;
1134 *) win32_libid_type="x86 archive static";;
1135 esac
1136 fi
1137 ;;
1138 *DLL*)
1139 win32_libid_type="x86 DLL"
1140 ;;
1141 *executable*) # but shell scripts are "executable" too...
1142 case $win32_fileres in
1143 *MS\ Windows\ PE\ Intel*)
1144 win32_libid_type="x86 DLL"
1145 ;;
1146 esac
1147 ;;
1148 esac
1149 $ECHO "$win32_libid_type"
1150}
1151
1152
1153
1154# func_infer_tag arg
1155# Infer tagged configuration to use if any are available and
1156# if one wasn't chosen via the "--tag" command line option.
1157# Only attempt this if the compiler in the base compile
1158# command doesn't match the default compiler.
1159# arg is usually of the form 'gcc ...'
1160func_infer_tag ()
1161{
1162 $opt_debug
1163 if test -n "$available_tags" && test -z "$tagname"; then
1164 CC_quoted=
1165 for arg in $CC; do
1166 func_quote_for_eval "$arg"
1167 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1168 done
1169 case $@ in
1170 # Blanks in the command may have been stripped by the calling shell,
1171 # but not from the CC environment variable when configure was run.
1172 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1173 # Blanks at the start of $base_compile will cause this to fail
1174 # if we don't check for them as well.
1175 *)
1176 for z in $available_tags; do
1177 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1178 # Evaluate the configuration.
1179 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1180 CC_quoted=
1181 for arg in $CC; do
1182 # Double-quote args containing other shell metacharacters.
1183 func_quote_for_eval "$arg"
1184 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1185 done
1186 case "$@ " in
1187 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1188 # The compiler in the base compile command matches
1189 # the one in the tagged configuration.
1190 # Assume this is the tagged configuration we want.
1191 tagname=$z
1192 break
1193 ;;
1194 esac
1195 fi
1196 done
1197 # If $tagname still isn't set, then no tagged configuration
1198 # was found and let the user know that the "--tag" command
1199 # line option must be used.
1200 if test -z "$tagname"; then
1201 func_echo "unable to infer tagged configuration"
1202 func_fatal_error "specify a tag with \`--tag'"
1203# else
1204# func_verbose "using $tagname tagged configuration"
1205 fi
1206 ;;
1207 esac
1208 fi
1209}
1210
1211
1212
1213# func_generate_dlsyms outputname originator pic_p
1214# Extract symbols from dlprefiles and create ${outputname}S.o with
1215# a dlpreopen symbol table.
1216func_generate_dlsyms ()
1217{
1218 $opt_debug
1219 my_outputname="$1"
1220 my_originator="$2"
1221 my_pic_p="${3-no}"
1222 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
1223 my_dlsyms=
1224
1225 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1226 if test -n "$NM" && test -n "$global_symbol_pipe"; then
1227 my_dlsyms="${my_outputname}S.c"
1228 else
1229 func_error "not configured to extract global symbols from dlpreopened files"
1230 fi
1231 fi
1232
1233 if test -n "$my_dlsyms"; then
1234 case $my_dlsyms in
1235 "") ;;
1236 *.c)
1237 # Discover the nlist of each of the dlfiles.
1238 nlist="$output_objdir/${my_outputname}.nm"
1239
1240 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
1241
1242 # Parse the name list into a source file.
1243 func_echo "creating $output_objdir/$my_dlsyms"
1244
1245 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
1246/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
1247/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
1248
1249#ifdef __cplusplus
1250extern \"C\" {
1251#endif
1252
1253/* External symbol declarations for the compiler. */\
1254"
1255
1256 if test "$dlself" = yes; then
1257 func_echo "generating symbol list for \`$output'"
1258
1259 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
1260
1261 # Add our own program objects to the symbol list.
1262 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1263 for progfile in $progfiles; do
1264 func_echo "extracting global C symbols from \`$progfile'"
1265 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
1266 done
1267
1268 if test -n "$exclude_expsyms"; then
1269 $opt_dry_run || {
1270 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
1271 eval '$MV "$nlist"T "$nlist"'
1272 }
1273 fi
1274
1275 if test -n "$export_symbols_regex"; then
1276 $opt_dry_run || {
1277 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
1278 eval '$MV "$nlist"T "$nlist"'
1279 }
1280 fi
1281
1282 # Prepare the list of exported symbols
1283 if test -z "$export_symbols"; then
1284 export_symbols="$output_objdir/$outputname.exp"
1285 $opt_dry_run || {
1286 $RM $export_symbols
1287 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
1288 case $host in
1289 *cygwin* | *mingw* )
1290 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1291 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
1292 ;;
1293 esac
1294 }
1295 else
1296 $opt_dry_run || {
1297 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
1298 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
1299 eval '$MV "$nlist"T "$nlist"'
1300 case $host in
1301 *cygwin | *mingw* )
1302 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1303 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
1304 ;;
1305 esac
1306 }
1307 fi
1308 fi
1309
1310 for dlprefile in $dlprefiles; do
1311 func_echo "extracting global C symbols from \`$dlprefile'"
1312 func_basename "$dlprefile"
1313 name="$func_basename_result"
1314 $opt_dry_run || {
1315 eval '$ECHO ": $name " >> "$nlist"'
1316 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
1317 }
1318 done
1319
1320 $opt_dry_run || {
1321 # Make sure we have at least an empty file.
1322 test -f "$nlist" || : > "$nlist"
1323
1324 if test -n "$exclude_expsyms"; then
1325 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
1326 $MV "$nlist"T "$nlist"
1327 fi
1328
1329 # Try sorting and uniquifying the output.
1330 if $GREP -v "^: " < "$nlist" |
1331 if sort -k 3 </dev/null >/dev/null 2>&1; then
1332 sort -k 3
1333 else
1334 sort +2
1335 fi |
1336 uniq > "$nlist"S; then
1337 :
1338 else
1339 $GREP -v "^: " < "$nlist" > "$nlist"S
1340 fi
1341
1342 if test -f "$nlist"S; then
1343 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
1344 else
1345 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
1346 fi
1347
1348 $ECHO >> "$output_objdir/$my_dlsyms" "\
1349
1350/* The mapping between symbol names and symbols. */
1351"
1352 case $host in
1353 *cygwin* | *mingw* )
1354 $ECHO >> "$output_objdir/$my_dlsyms" "\
1355/* DATA imports from DLLs on WIN32 con't be const, because
1356 runtime relocations are performed -- see ld's documentation
1357 on pseudo-relocs. */
1358 struct {
1359"
1360 ;;
1361 *)
1362 $ECHO >> "$output_objdir/$my_dlsyms" "\
1363const struct {
1364"
1365 ;;
1366 esac
1367
1368 $ECHO >> "$output_objdir/$my_dlsyms" "\
1369 const char *name;
1370 void *address;
1371}
1372lt_${my_prefix}_LTX_preloaded_symbols[] =
1373{\
1374 { \"$my_originator\", (void *) 0 },
1375"
1376
1377 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
1378
1379 $ECHO >> "$output_objdir/$my_dlsyms" "\
1380 {0, (void *) 0}
1381};
1382
1383/* This works around a problem in FreeBSD linker */
1384#ifdef FREEBSD_WORKAROUND
1385static const void *lt_preloaded_setup() {
1386 return lt_${my_prefix}_LTX_preloaded_symbols;
1387}
1388#endif
1389
1390#ifdef __cplusplus
1391}
1392#endif\
1393"
1394 } # !$opt_dry_run
1395
1396 pic_flag_for_symtable=
1397 case "$compile_command " in
1398 *" -static "*) ;;
1399 *)
1400 case $host in
1401 # compiling the symbol table file with pic_flag works around
1402 # a FreeBSD bug that causes programs to crash when -lm is
1403 # linked before any other PIC object. But we must not use
1404 # pic_flag when linking with -static. The problem exists in
1405 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
1406 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
1407 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
1408 *-*-hpux*)
1409 pic_flag_for_symtable=" $pic_flag" ;;
1410 *)
1411 if test "X$my_pic_p" != Xno; then
1412 pic_flag_for_symtable=" $pic_flag"
1413 fi
1414 ;;
1415 esac
1416 ;;
1417 esac
1418 symtab_cflags=
1419 for arg in $LTCFLAGS; do
1420 case $arg in
1421 -pie | -fpie | -fPIE) ;;
1422 *) symtab_cflags="$symtab_cflags $arg" ;;
1423 esac
1424 done
1425
1426 # Now compile the dynamic symbol file.
1427 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
1428
1429 # Clean up the generated files.
1430 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
1431
1432 # Transform the symbol file into the correct name.
1433 symfileobj="$output_objdir/${my_outputname}S.$objext"
1434 case $host in
1435 *cygwin* | *mingw* )
1436 if test -f "$output_objdir/$my_outputname.def"; then
1437 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1438 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1439 else
1440 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1441 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1442 fi
1443 ;;
1444 *)
1445 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1446 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1447 ;;
1448 esac
1449 ;;
1450 *)
1451 func_fatal_error "unknown suffix for \`$my_dlsyms'"
1452 ;;
1453 esac
1454 else
1455 # We keep going just in case the user didn't refer to
1456 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
1457 # really was required.
1458
1459 # Nullify the symbol file.
1460 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1461 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1462 fi
1463}
1464
1465# func_extract_an_archive dir oldlib
1466func_extract_an_archive ()
1467{
1468 $opt_debug
1469 f_ex_an_ar_dir="$1"; shift
1470 f_ex_an_ar_oldlib="$1"
1471 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" 'exit $?'
1472 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
1473 :
1474 else
1475 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
1476 fi
1477}
1478
1479
1480# func_extract_archives gentop oldlib ...
1481func_extract_archives ()
1482{
1483 $opt_debug
1484 my_gentop="$1"; shift
1485 my_oldlibs=${1+"$@"}
1486 my_oldobjs=""
1487 my_xlib=""
1488 my_xabs=""
1489 my_xdir=""
1490
1491 for my_xlib in $my_oldlibs; do
1492 # Extract the objects.
1493 case $my_xlib in
1494 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
1495 *) my_xabs=`pwd`"/$my_xlib" ;;
1496 esac
1497 func_basename "$my_xlib"
1498 my_xlib="$func_basename_result"
1499 my_xdir="$my_gentop/$my_xlib"
1500
1501 func_mkdir_p "$my_xdir"
1502
1503 case $host in
1504 *-darwin*)
1505 func_echo "Extracting $my_xabs"
1506 # Do not bother doing anything if just a dry run
1507 $opt_dry_run || {
1508 darwin_orig_dir=`pwd`
1509 cd $my_xdir || exit $?
1510 darwin_archive=$my_xabs
1511 darwin_curdir=`pwd`
1512 darwin_base_archive=`basename $darwin_archive`
1513 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
1514 if test -n "$darwin_arches"; then
1515 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
1516 darwin_arch=
1517 func_echo "$darwin_base_archive has multiple architectures $darwin_arches"
1518 for darwin_arch in $darwin_arches ; do
1519 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1520 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
1521 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1522 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
1523 cd "$darwin_curdir"
1524 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
1525 done # $darwin_arches
1526 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
1527 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
1528 darwin_file=
1529 darwin_files=
1530 for darwin_file in $darwin_filelist; do
1531 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
1532 lipo -create -output "$darwin_file" $darwin_files
1533 done # $darwin_filelist
1534 $RM -rf unfat-$$
1535 cd "$darwin_orig_dir"
1536 else
1537 cd $darwin_orig_dir
1538 func_extract_an_archive "$my_xdir" "$my_xabs"
1539 fi # $darwin_arches
1540 } # !$opt_dry_run
1541 ;;
1542 *)
1543 func_extract_an_archive "$my_xdir" "$my_xabs"
1544 ;;
1545 esac
1546 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
1547 done
1548
1549 func_extract_archives_result="$my_oldobjs"
1550}
1551
1552
1553# func_mode_compile arg...
1554func_mode_compile ()
1555{
1556 $opt_debug
1557 # Get the compilation command and the source file.
1558 base_compile=
1559 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1560 suppress_opt=yes
1561 suppress_output=
1562 arg_mode=normal
1563 libobj=
1564 later=
1565 pie_flag=
1566
1567 for arg
1568 do
1569 case $arg_mode in
1570 arg )
1571 # do not "continue". Instead, add this to base_compile
1572 lastarg="$arg"
1573 arg_mode=normal
1574 ;;
1575
1576 target )
1577 libobj="$arg"
1578 arg_mode=normal
1579 continue
1580 ;;
1581
1582 normal )
1583 # Accept any command-line options.
1584 case $arg in
1585 -o)
1586 test -n "$libobj" && \
1587 func_fatal_error "you cannot specify \`-o' more than once"
1588 arg_mode=target
1589 continue
1590 ;;
1591
1592 -pie | -fpie | -fPIE)
1593 pie_flag="$pie_flag $arg"
1594 continue
1595 ;;
1596
1597 -shared | -static | -prefer-pic | -prefer-non-pic)
1598 later="$later $arg"
1599 continue
1600 ;;
1601
1602 -no-suppress)
1603 suppress_opt=no
1604 continue
1605 ;;
1606
1607 -Xcompiler)
1608 arg_mode=arg # the next one goes into the "base_compile" arg list
1609 continue # The current "srcfile" will either be retained or
1610 ;; # replaced later. I would guess that would be a bug.
1611
1612 -Wc,*)
1613 func_stripname '-Wc,' '' "$arg"
1614 args=$func_stripname_result
1615 lastarg=
1616 save_ifs="$IFS"; IFS=','
1617 for arg in $args; do
1618 IFS="$save_ifs"
1619 func_quote_for_eval "$arg"
1620 lastarg="$lastarg $func_quote_for_eval_result"
1621 done
1622 IFS="$save_ifs"
1623 func_stripname ' ' '' "$lastarg"
1624 lastarg=$func_stripname_result
1625
1626 # Add the arguments to base_compile.
1627 base_compile="$base_compile $lastarg"
1628 continue
1629 ;;
1630
1631 *)
1632 # Accept the current argument as the source file.
1633 # The previous "srcfile" becomes the current argument.
1634 #
1635 lastarg="$srcfile"
1636 srcfile="$arg"
1637 ;;
1638 esac # case $arg
1639 ;;
1640 esac # case $arg_mode
1641
1642 # Aesthetically quote the previous argument.
1643 func_quote_for_eval "$lastarg"
1644 base_compile="$base_compile $func_quote_for_eval_result"
1645 done # for arg
1646
1647 case $arg_mode in
1648 arg)
1649 func_fatal_error "you must specify an argument for -Xcompile"
1650 ;;
1651 target)
1652 func_fatal_error "you must specify a target with \`-o'"
1653 ;;
1654 *)
1655 # Get the name of the library object.
1656 test -z "$libobj" && {
1657 func_basename "$srcfile"
1658 libobj="$func_basename_result"
1659 }
1660 ;;
1661 esac
1662
1663 # Recognize several different file suffixes.
1664 # If the user specifies -o file.o, it is replaced with file.lo
1665 xform='[cCFSifmso]'
1666 case $libobj in
1667 *.ada) xform=ada ;;
1668 *.adb) xform=adb ;;
1669 *.ads) xform=ads ;;
1670 *.asm) xform=asm ;;
1671 *.c++) xform=c++ ;;
1672 *.cc) xform=cc ;;
1673 *.ii) xform=ii ;;
1674 *.class) xform=class ;;
1675 *.cpp) xform=cpp ;;
1676 *.cxx) xform=cxx ;;
1677 *.f90) xform=f90 ;;
1678 *.for) xform=for ;;
1679 *.java) xform=java ;;
1680 esac
1681
1682 libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
1683
1684 case $libobj in
1685 *.lo) obj=`$ECHO "X$libobj" | $Xsed -e "$lo2o"` ;;
1686 *)
1687 func_fatal_error "cannot determine name of library object from \`$libobj'"
1688 ;;
1689 esac
1690
1691 func_infer_tag $base_compile
1692
1693 for arg in $later; do
1694 case $arg in
1695 -shared)
1696 test "$build_libtool_libs" != yes && \
1697 func_fatal_configuration "can not build a shared library"
1698 build_old_libs=no
1699 continue
1700 ;;
1701
1702 -static)
1703 build_libtool_libs=no
1704 build_old_libs=yes
1705 continue
1706 ;;
1707
1708 -prefer-pic)
1709 pic_mode=yes
1710 continue
1711 ;;
1712
1713 -prefer-non-pic)
1714 pic_mode=no
1715 continue
1716 ;;
1717 esac
1718 done
1719
1720 func_quote_for_eval "$libobj"
1721 test "X$libobj" != "X$func_quote_for_eval_result" \
1722 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1723 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1724 func_basename "$obj"
1725 objname="$func_basename_result"
1726 func_dirname "$obj" "/" ""
1727 xdir="$func_dirname_result"
1728 lobj=${xdir}$objdir/$objname
1729
1730 test -z "$base_compile" && \
1731 func_fatal_help "you must specify a compilation command"
1732
1733 # Delete any leftover library objects.
1734 if test "$build_old_libs" = yes; then
1735 removelist="$obj $lobj $libobj ${libobj}T"
1736 else
1737 removelist="$lobj $libobj ${libobj}T"
1738 fi
1739
1740 $opt_dry_run || $RM $removelist
1741 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1742
1743 # On Cygwin there's no "real" PIC flag so we must build both object types
1744 case $host_os in
1745 cygwin* | mingw* | pw32* | os2*)
1746 pic_mode=default
1747 ;;
1748 esac
1749 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1750 # non-PIC code in shared libraries is not supported
1751 pic_mode=default
1752 fi
1753
1754 # Calculate the filename of the output object if compiler does
1755 # not support -o with -c
1756 if test "$compiler_c_o" = no; then
1757 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1758 lockfile="$output_obj.lock"
1759 removelist="$removelist $output_obj $lockfile"
1760 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1761 else
1762 output_obj=
1763 need_locks=no
1764 lockfile=
1765 fi
1766
1767 # Lock this critical section if it is needed
1768 # We use this script file to make the link, it avoids creating a new file
1769 if test "$need_locks" = yes; then
1770 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1771 func_echo "Waiting for $lockfile to be removed"
1772 sleep 2
1773 done
1774 elif test "$need_locks" = warn; then
1775 if test -f "$lockfile"; then
1776 $ECHO "\
1777*** ERROR, $lockfile exists and contains:
1778`cat $lockfile 2>/dev/null`
1779
1780This indicates that another process is trying to use the same
1781temporary object file, and libtool could not work around it because
1782your compiler does not support \`-c' and \`-o' together. If you
1783repeat this compilation, it may succeed, by chance, but you had better
1784avoid parallel builds (make -j) in this platform, or get a better
1785compiler."
1786
1787 $opt_dry_run || $RM $removelist
1788 exit $EXIT_FAILURE
1789 fi
1790 $ECHO "$srcfile" > "$lockfile"
1791 fi
1792
1793 if test -n "$fix_srcfile_path"; then
1794 eval srcfile=\"$fix_srcfile_path\"
1795 fi
1796 func_quote_for_eval "$srcfile"
1797 qsrcfile=$func_quote_for_eval_result
1798
1799 $opt_dry_run || $RM "$libobj" "${libobj}T"
1800
1801 # Create a libtool object file (analogous to a ".la" file),
1802 # but don't create it if we're doing a dry run.
1803 $opt_dry_run || cat > ${libobj}T <<EOF
1804# $libobj - a libtool object file
1805# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1806#
1807# Please DO NOT delete this file!
1808# It is necessary for linking the library.
1809
1810# Name of the PIC object.
1811EOF
1812
1813 # Only build a PIC object if we are building libtool libraries.
1814 if test "$build_libtool_libs" = yes; then
1815 # Without this assignment, base_compile gets emptied.
1816 fbsd_hideous_sh_bug=$base_compile
1817
1818 if test "$pic_mode" != no; then
1819 command="$base_compile $qsrcfile $pic_flag"
1820 else
1821 # Don't build PIC code
1822 command="$base_compile $qsrcfile"
1823 fi
1824
1825 func_mkdir_p "$xdir$objdir"
1826
1827 if test -z "$output_obj"; then
1828 # Place PIC objects in $objdir
1829 command="$command -o $lobj"
1830 fi
1831
1832 $opt_dry_run || $RM "$lobj" "$output_obj"
1833
1834 func_show_eval "$command" \
1835 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1836
1837 if test "$need_locks" = warn &&
1838 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1839 $ECHO "\
1840*** ERROR, $lockfile contains:
1841`cat $lockfile 2>/dev/null`
1842
1843but it should contain:
1844$srcfile
1845
1846This indicates that another process is trying to use the same
1847temporary object file, and libtool could not work around it because
1848your compiler does not support \`-c' and \`-o' together. If you
1849repeat this compilation, it may succeed, by chance, but you had better
1850avoid parallel builds (make -j) in this platform, or get a better
1851compiler."
1852
1853 $opt_dry_run || $RM $removelist
1854 exit $EXIT_FAILURE
1855 fi
1856
1857 # Just move the object if needed, then go on to compile the next one
1858 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1859 func_show_eval '$MV "$output_obj" "$lobj"' \
1860 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1861 fi
1862
1863 # Append the name of the PIC object to the libtool object file.
1864 $opt_dry_run || cat >> ${libobj}T <<EOF
1865pic_object='$objdir/$objname'
1866
1867EOF
1868
1869 # Allow error messages only from the first compilation.
1870 if test "$suppress_opt" = yes; then
1871 suppress_output=' >/dev/null 2>&1'
1872 fi
1873 else
1874 # No PIC object so indicate it doesn't exist in the libtool
1875 # object file.
1876 $opt_dry_run || cat >> ${libobj}T <<EOF
1877pic_object=none
1878
1879EOF
1880 fi
1881
1882 # Only build a position-dependent object if we build old libraries.
1883 if test "$build_old_libs" = yes; then
1884 if test "$pic_mode" != yes; then
1885 # Don't build PIC code
1886 command="$base_compile $qsrcfile$pie_flag"
1887 else
1888 command="$base_compile $qsrcfile $pic_flag"
1889 fi
1890 if test "$compiler_c_o" = yes; then
1891 command="$command -o $obj"
1892 fi
1893
1894 # Suppress compiler output if we already did a PIC compilation.
1895 command="$command$suppress_output"
1896 $opt_dry_run || $RM "$obj" "$output_obj"
1897 func_show_eval "$command" \
1898 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1899
1900 if test "$need_locks" = warn &&
1901 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1902 $ECHO "\
1903*** ERROR, $lockfile contains:
1904`cat $lockfile 2>/dev/null`
1905
1906but it should contain:
1907$srcfile
1908
1909This indicates that another process is trying to use the same
1910temporary object file, and libtool could not work around it because
1911your compiler does not support \`-c' and \`-o' together. If you
1912repeat this compilation, it may succeed, by chance, but you had better
1913avoid parallel builds (make -j) in this platform, or get a better
1914compiler."
1915
1916 $opt_dry_run || $RM $removelist
1917 exit $EXIT_FAILURE
1918 fi
1919
1920 # Just move the object if needed
1921 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1922 func_show_eval '$MV "$output_obj" "$obj"' \
1923 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1924 fi
1925
1926 # Append the name of the non-PIC object the libtool object file.
1927 # Only append if the libtool object file exists.
1928 $opt_dry_run || cat >> ${libobj}T <<EOF
1929# Name of the non-PIC object.
1930non_pic_object='$objname'
1931
1932EOF
1933 else
1934 # Append the name of the non-PIC object the libtool object file.
1935 # Only append if the libtool object file exists.
1936 $opt_dry_run || cat >> ${libobj}T <<EOF
1937# Name of the non-PIC object.
1938non_pic_object=none
1939
1940EOF
1941 fi
1942
1943 $opt_dry_run || {
1944 $MV "${libobj}T" "${libobj}"
1945
1946 # Unlock the critical section if it was locked
1947 if test "$need_locks" != no; then
1948 $RM "$lockfile"
1949 fi
1950 }
1951
1952 exit $EXIT_SUCCESS
1953}
1954
1955
1956# func_mode_execute arg...
1957func_mode_execute ()
1958{
1959 $opt_debug
1960 # The first argument is the command name.
1961 cmd="$nonopt"
1962 test -z "$cmd" && \
1963 func_fatal_help "you must specify a COMMAND"
1964
1965 # Handle -dlopen flags immediately.
1966 for file in $execute_dlfiles; do
1967 test -f "$file" \
1968 || func_fatal_help "\`$file' is not a file"
1969
1970 dir=
1971 case $file in
1972 *.la)
1973 # Check to see that this really is a libtool archive.
1974 func_lalib_unsafe_p "$file" \
1975 || func_fatal_help "\`$lib' is not a valid libtool archive"
1976
1977 # Read the libtool library.
1978 dlname=
1979 library_names=
1980 func_source "$file"
1981
1982 # Skip this library if it cannot be dlopened.
1983 if test -z "$dlname"; then
1984 # Warn if it was a shared library.
1985 test -n "$library_names" && \
1986 func_warning "\`$file' was not linked with \`-export-dynamic'"
1987 continue
1988 fi
1989
1990 func_dirname "$file" "" "."
1991 dir="$func_dirname_result"
1992
1993 if test -f "$dir/$objdir/$dlname"; then
1994 dir="$dir/$objdir"
1995 else
1996 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1997 fi
1998 ;;
1999
2000 *.lo)
2001 # Just add the directory containing the .lo file.
2002 func_dirname "$file" "" "."
2003 dir="$func_dirname_result"
2004 ;;
2005
2006 *)
2007 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2008 continue
2009 ;;
2010 esac
2011
2012 # Get the absolute pathname.
2013 absdir=`cd "$dir" && pwd`
2014 test -n "$absdir" && dir="$absdir"
2015
2016 # Now add the directory to shlibpath_var.
2017 if eval "test -z \"\$$shlibpath_var\""; then
2018 eval "$shlibpath_var=\"\$dir\""
2019 else
2020 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2021 fi
2022 done
2023
2024 # This variable tells wrapper scripts just to set shlibpath_var
2025 # rather than running their programs.
2026 libtool_execute_magic="$magic"
2027
2028 # Check if any of the arguments is a wrapper script.
2029 args=
2030 for file
2031 do
2032 case $file in
2033 -*) ;;
2034 *)
2035 # Do a test to see if this is really a libtool program.
2036 if func_ltwrapper_p "$file"; then
2037 func_source "$file"
2038
2039 # Transform arg to wrapped name.
2040 file="$progdir/$program"
2041 fi
2042 ;;
2043 esac
2044 # Quote arguments (to preserve shell metacharacters).
2045 func_quote_for_eval "$file"
2046 args="$args $func_quote_for_eval_result"
2047 done
2048
2049 if test "X$opt_dry_run" = Xfalse; then
2050 if test -n "$shlibpath_var"; then
2051 # Export the shlibpath_var.
2052 eval "export $shlibpath_var"
2053 fi
2054
2055 # Restore saved environment variables
2056 if test "${save_LC_ALL+set}" = set; then
2057 LC_ALL="$save_LC_ALL"; export LC_ALL
2058 fi
2059 if test "${save_LANG+set}" = set; then
2060 LANG="$save_LANG"; export LANG
2061 fi
2062
2063 # Now prepare to actually exec the command.
2064 exec_cmd="\$cmd$args"
2065 else
2066 # Display what would be done.
2067 if test -n "$shlibpath_var"; then
2068 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2069 $ECHO "export $shlibpath_var"
2070 fi
2071 $ECHO "$cmd$args"
2072 exit $EXIT_SUCCESS
2073 fi
2074}
2075
2076
2077# func_mode_finish arg...
2078func_mode_finish ()
2079{
2080 $opt_debug
2081 libdirs="$nonopt"
2082 admincmds=
2083
2084 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2085 for dir
2086 do
2087 libdirs="$libdirs $dir"
2088 done
2089
2090 for libdir in $libdirs; do
2091 if test -n "$finish_cmds"; then
2092 # Do each command in the finish commands.
2093 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2094'"$cmd"'"'
2095 fi
2096 if test -n "$finish_eval"; then
2097 # Do the single finish_eval.
2098 eval cmds=\"$finish_eval\"
2099 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2100 $cmds"
2101 fi
2102 done
2103 fi
2104
2105 # Exit here if they wanted silent mode.
2106 $opt_silent && exit $EXIT_SUCCESS
2107
2108 $ECHO "X----------------------------------------------------------------------" | $Xsed
2109 $ECHO "Libraries have been installed in:"
2110 for libdir in $libdirs; do
2111 $ECHO " $libdir"
2112 done
2113 $ECHO
2114 $ECHO "If you ever happen to want to link against installed libraries"
2115 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
2116 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
2117 $ECHO "flag during linking and do at least one of the following:"
2118 if test -n "$shlibpath_var"; then
2119 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
2120 $ECHO " during execution"
2121 fi
2122 if test -n "$runpath_var"; then
2123 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
2124 $ECHO " during linking"
2125 fi
2126 if test -n "$hardcode_libdir_flag_spec"; then
2127 libdir=LIBDIR
2128 eval flag=\"$hardcode_libdir_flag_spec\"
2129
2130 $ECHO " - use the \`$flag' linker flag"
2131 fi
2132 if test -n "$admincmds"; then
2133 $ECHO " - have your system administrator run these commands:$admincmds"
2134 fi
2135 if test -f /etc/ld.so.conf; then
2136 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2137 fi
2138 $ECHO
2139
2140 $ECHO "See any operating system documentation about shared libraries for"
2141 case $host in
2142 solaris2.[6789]|solaris2.1[0-9])
2143 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2144 $ECHO "pages."
2145 ;;
2146 *)
2147 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
2148 ;;
2149 esac
2150 $ECHO "X----------------------------------------------------------------------" | $Xsed
2151 exit $EXIT_SUCCESS
2152}
2153
2154
2155# func_mode_install arg...
2156func_mode_install ()
2157{
2158 $opt_debug
2159 # There may be an optional sh(1) argument at the beginning of
2160 # install_prog (especially on Windows NT).
2161 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2162 # Allow the use of GNU shtool's install command.
2163 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2164 # Aesthetically quote it.
2165 func_quote_for_eval "$nonopt"
2166 install_prog="$func_quote_for_eval_result "
2167 arg=$1
2168 shift
2169 else
2170 install_prog=
2171 arg=$nonopt
2172 fi
2173
2174 # The real first argument should be the name of the installation program.
2175 # Aesthetically quote it.
2176 func_quote_for_eval "$arg"
2177 install_prog="$install_prog$func_quote_for_eval_result"
2178
2179 # We need to accept at least all the BSD install flags.
2180 dest=
2181 files=
2182 opts=
2183 prev=
2184 install_type=
2185 isdir=no
2186 stripme=
2187 for arg
2188 do
2189 if test -n "$dest"; then
2190 files="$files $dest"
2191 dest=$arg
2192 continue
2193 fi
2194
2195 case $arg in
2196 -d) isdir=yes ;;
2197 -f)
2198 case " $install_prog " in
2199 *[\\\ /]cp\ *) ;;
2200 *) prev=$arg ;;
2201 esac
2202 ;;
2203 -g | -m | -o)
2204 prev=$arg
2205 ;;
2206 -s)
2207 stripme=" -s"
2208 continue
2209 ;;
2210 -*)
2211 ;;
2212 *)
2213 # If the previous option needed an argument, then skip it.
2214 if test -n "$prev"; then
2215 prev=
2216 else
2217 dest=$arg
2218 continue
2219 fi
2220 ;;
2221 esac
2222
2223 # Aesthetically quote the argument.
2224 func_quote_for_eval "$arg"
2225 install_prog="$install_prog $func_quote_for_eval_result"
2226 done
2227
2228 test -z "$install_prog" && \
2229 func_fatal_help "you must specify an install program"
2230
2231 test -n "$prev" && \
2232 func_fatal_help "the \`$prev' option requires an argument"
2233
2234 if test -z "$files"; then
2235 if test -z "$dest"; then
2236 func_fatal_help "no file or destination specified"
2237 else
2238 func_fatal_help "you must specify a destination"
2239 fi
2240 fi
2241
2242 # Strip any trailing slash from the destination.
2243 func_stripname '' '/' "$dest"
2244 dest=$func_stripname_result
2245
2246 # Check to see that the destination is a directory.
2247 test -d "$dest" && isdir=yes
2248 if test "$isdir" = yes; then
2249 destdir="$dest"
2250 destname=
2251 else
2252 func_dirname "$dest" "" "."
2253 destdir="$func_dirname_result"
2254 func_basename "$dest"
2255 destname="$func_basename_result"
2256
2257 # Not a directory, so check to see that there is only one file specified.
2258 set dummy $files; shift
2259 test "$#" -gt 1 && \
2260 func_fatal_help "\`$dest' is not a directory"
2261 fi
2262 case $destdir in
2263 [\\/]* | [A-Za-z]:[\\/]*) ;;
2264 *)
2265 for file in $files; do
2266 case $file in
2267 *.lo) ;;
2268 *)
2269 func_fatal_help "\`$destdir' must be an absolute directory name"
2270 ;;
2271 esac
2272 done
2273 ;;
2274 esac
2275
2276 # This variable tells wrapper scripts just to set variables rather
2277 # than running their programs.
2278 libtool_install_magic="$magic"
2279
2280 staticlibs=
2281 future_libdirs=
2282 current_libdirs=
2283 for file in $files; do
2284
2285 # Do each installation.
2286 case $file in
2287 *.$libext)
2288 # Do the static libraries later.
2289 staticlibs="$staticlibs $file"
2290 ;;
2291
2292 *.la)
2293 # Check to see that this really is a libtool archive.
2294 func_lalib_unsafe_p "$file" \
2295 || func_fatal_help "\`$file' is not a valid libtool archive"
2296
2297 library_names=
2298 old_library=
2299 relink_command=
2300 func_source "$file"
2301
2302 # Add the libdir to current_libdirs if it is the destination.
2303 if test "X$destdir" = "X$libdir"; then
2304 case "$current_libdirs " in
2305 *" $libdir "*) ;;
2306 *) current_libdirs="$current_libdirs $libdir" ;;
2307 esac
2308 else
2309 # Note the libdir as a future libdir.
2310 case "$future_libdirs " in
2311 *" $libdir "*) ;;
2312 *) future_libdirs="$future_libdirs $libdir" ;;
2313 esac
2314 fi
2315
2316 func_dirname "$file" "/" ""
2317 dir="$func_dirname_result"
2318 dir="$dir$objdir"
2319
2320 if test -n "$relink_command"; then
2321 # Determine the prefix the user has applied to our future dir.
2322 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2323
2324 # Don't allow the user to place us outside of our expected
2325 # location b/c this prevents finding dependent libraries that
2326 # are installed to the same prefix.
2327 # At present, this check doesn't affect windows .dll's that
2328 # are installed into $libdir/../bin (currently, that works fine)
2329 # but it's something to keep an eye on.
2330 test "$inst_prefix_dir" = "$destdir" && \
2331 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2332
2333 if test -n "$inst_prefix_dir"; then
2334 # Stick the inst_prefix_dir data into the link command.
2335 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2336 else
2337 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2338 fi
2339
2340 func_warning "relinking \`$file'"
2341 func_show_eval "$relink_command" \
2342 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2343 fi
2344
2345 # See the names of the shared library.
2346 set dummy $library_names; shift
2347 if test -n "$1"; then
2348 realname="$1"
2349 shift
2350
2351 srcname="$realname"
2352 test -n "$relink_command" && srcname="$realname"T
2353
2354 # Install the shared library and build the symlinks.
2355 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2356 'exit $?'
2357 tstripme="$stripme"
2358 case $host_os in
2359 cygwin* | mingw* | pw32*)
2360 case $realname in
2361 *.dll.a)
2362 tstripme=""
2363 ;;
2364 esac
2365 ;;
2366 esac
2367 if test -n "$tstripme" && test -n "$striplib"; then
2368 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2369 fi
2370
2371 if test "$#" -gt 0; then
2372 # Delete the old symlinks, and create new ones.
2373 # Try `ln -sf' first, because the `ln' binary might depend on
2374 # the symlink we replace! Solaris /bin/ln does not understand -f,
2375 # so we also need to try rm && ln -s.
2376 for linkname
2377 do
2378 test "$linkname" != "$realname" \
2379 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2380 done
2381 fi
2382
2383 # Do each command in the postinstall commands.
2384 lib="$destdir/$realname"
2385 func_execute_cmds "$postinstall_cmds" 'exit $?'
2386 fi
2387
2388 # Install the pseudo-library for information purposes.
2389 func_basename "$file"
2390 name="$func_basename_result"
2391 instname="$dir/$name"i
2392 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2393
2394 # Maybe install the static library, too.
2395 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2396 ;;
2397
2398 *.lo)
2399 # Install (i.e. copy) a libtool object.
2400
2401 # Figure out destination file name, if it wasn't already specified.
2402 if test -n "$destname"; then
2403 destfile="$destdir/$destname"
2404 else
2405 func_basename "$file"
2406 destfile="$func_basename_result"
2407 destfile="$destdir/$destfile"
2408 fi
2409
2410 # Deduce the name of the destination old-style object file.
2411 case $destfile in
2412 *.lo)
2413 staticdest=`$ECHO "X$destfile" | $Xsed -e "$lo2o"`
2414 ;;
2415 *.$objext)
2416 staticdest="$destfile"
2417 destfile=
2418 ;;
2419 *)
2420 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2421 ;;
2422 esac
2423
2424 # Install the libtool object if requested.
2425 test -n "$destfile" && \
2426 func_show_eval "$install_prog $file $destfile" 'exit $?'
2427
2428 # Install the old object if enabled.
2429 if test "$build_old_libs" = yes; then
2430 # Deduce the name of the old-style object file.
2431 staticobj=`$ECHO "X$file" | $Xsed -e "$lo2o"`
2432 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2433 fi
2434 exit $EXIT_SUCCESS
2435 ;;
2436
2437 *)
2438 # Figure out destination file name, if it wasn't already specified.
2439 if test -n "$destname"; then
2440 destfile="$destdir/$destname"
2441 else
2442 func_basename "$file"
2443 destfile="$func_basename_result"
2444 destfile="$destdir/$destfile"
2445 fi
2446
2447 # If the file is missing, and there is a .exe on the end, strip it
2448 # because it is most likely a libtool script we actually want to
2449 # install
2450 stripped_ext=""
2451 case $file in
2452 *.exe)
2453 if test ! -f "$file"; then
2454 func_stripname '' '.exe' "$file"
2455 file=$func_stripname_result
2456 stripped_ext=".exe"
2457 fi
2458 ;;
2459 esac
2460
2461 # Do a test to see if this is really a libtool program.
2462 case $host in
2463 *cygwin*|*mingw*)
2464 func_stripname '' '.exe' "$file"
2465 wrapper=$func_stripname_result
2466 ;;
2467 *)
2468 wrapper=$file
2469 ;;
2470 esac
2471 if func_ltwrapper_p "$wrapper"; then
2472 notinst_deplibs=
2473 relink_command=
2474
2475 func_source "$wrapper"
2476
2477 # Check the variables that should have been set.
2478 test -z "$generated_by_libtool_version" && \
2479 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2480
2481 finalize=yes
2482 for lib in $notinst_deplibs; do
2483 # Check to see that each library is installed.
2484 libdir=
2485 if test -f "$lib"; then
2486 func_source "$lib"
2487 fi
2488 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2489 if test -n "$libdir" && test ! -f "$libfile"; then
2490 func_warning "\`$lib' has not been installed in \`$libdir'"
2491 finalize=no
2492 fi
2493 done
2494
2495 relink_command=
2496 func_source "$wrapper"
2497
2498 outputname=
2499 if test "$fast_install" = no && test -n "$relink_command"; then
2500 $opt_dry_run || {
2501 if test "$finalize" = yes; then
2502 tmpdir=`func_mktempdir`
2503 func_basename "$file$stripped_ext"
2504 file="$func_basename_result"
2505 outputname="$tmpdir/$file"
2506 # Replace the output file specification.
2507 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2508
2509 $opt_silent || {
2510 func_quote_for_expand "$relink_command"
2511 eval "func_echo $func_quote_for_expand_result"
2512 }
2513 if eval "$relink_command"; then :
2514 else
2515 func_error "error: relink \`$file' with the above command before installing it"
2516 $opt_dry_run || ${RM}r "$tmpdir"
2517 continue
2518 fi
2519 file="$outputname"
2520 else
2521 func_warning "cannot relink \`$file'"
2522 fi
2523 }
2524 else
2525 # Install the binary that we compiled earlier.
2526 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2527 fi
2528 fi
2529
2530 # remove .exe since cygwin /usr/bin/install will append another
2531 # one anyway
2532 case $install_prog,$host in
2533 */usr/bin/install*,*cygwin*)
2534 case $file:$destfile in
2535 *.exe:*.exe)
2536 # this is ok
2537 ;;
2538 *.exe:*)
2539 destfile=$destfile.exe
2540 ;;
2541 *:*.exe)
2542 func_stripname '' '.exe' "$destfile"
2543 destfile=$func_stripname_result
2544 ;;
2545 esac
2546 ;;
2547 esac
2548 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2549 $opt_dry_run || if test -n "$outputname"; then
2550 ${RM}r "$tmpdir"
2551 fi
2552 ;;
2553 esac
2554 done
2555
2556 for file in $staticlibs; do
2557 func_basename "$file"
2558 name="$func_basename_result"
2559
2560 # Set up the ranlib parameters.
2561 oldlib="$destdir/$name"
2562
2563 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2564
2565 if test -n "$stripme" && test -n "$old_striplib"; then
2566 func_show_eval "$old_striplib $oldlib" 'exit $?'
2567 fi
2568
2569 # Do each command in the postinstall commands.
2570 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2571 done
2572
2573 test -n "$future_libdirs" && \
2574 func_warning "remember to run \`$progname --finish$future_libdirs'"
2575
2576 if test -n "$current_libdirs"; then
2577 # Maybe just do a dry run.
2578 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2579 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2580 else
2581 exit $EXIT_SUCCESS
2582 fi
2583}
2584
2585
2586# func_mode_link arg...
2587func_mode_link ()
2588{
2589 $opt_debug
2590 case $host in
2591 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
2592 # It is impossible to link a dll without this setting, and
2593 # we shouldn't force the makefile maintainer to figure out
2594 # which system we are compiling for in order to pass an extra
2595 # flag for every libtool invocation.
2596 # allow_undefined=no
2597
2598 # FIXME: Unfortunately, there are problems with the above when trying
2599 # to make a dll which has undefined symbols, in which case not
2600 # even a static library is built. For now, we need to specify
2601 # -no-undefined on the libtool link line when we can be certain
2602 # that all symbols are satisfied, otherwise we get a static library.
2603 allow_undefined=yes
2604 ;;
2605 *)
2606 allow_undefined=yes
2607 ;;
2608 esac
2609 libtool_args="$nonopt"
2610 base_compile="$nonopt $@"
2611 compile_command="$nonopt"
2612 finalize_command="$nonopt"
2613
2614 compile_rpath=
2615 finalize_rpath=
2616 compile_shlibpath=
2617 finalize_shlibpath=
2618 convenience=
2619 old_convenience=
2620 deplibs=
2621 old_deplibs=
2622 compiler_flags=
2623 linker_flags=
2624 dllsearchpath=
2625 lib_search_path=`pwd`
2626 inst_prefix_dir=
2627 new_inherited_linker_flags=
2628
2629 avoid_version=no
2630 dlfiles=
2631 dlprefiles=
2632 dlself=no
2633 export_dynamic=no
2634 export_symbols=
2635 export_symbols_regex=
2636 generated=
2637 libobjs=
2638 ltlibs=
2639 module=no
2640 no_install=no
2641 objs=
2642 non_pic_objects=
2643 precious_files_regex=
2644 prefer_static_libs=no
2645 preload=no
2646 prev=
2647 prevarg=
2648 release=
2649 rpath=
2650 xrpath=
2651 perm_rpath=
2652 temp_rpath=
2653 thread_safe=no
2654 vinfo=
2655 vinfo_number=no
2656 weak_libs=
2657 single_module="${wl}-single_module"
2658 func_infer_tag $base_compile
2659
2660 # We need to know -static, to get the right output filenames.
2661 for arg
2662 do
2663 case $arg in
2664 -shared)
2665 test "$build_libtool_libs" != yes && \
2666 func_fatal_configuration "can not build a shared library"
2667 build_old_libs=no
2668 break
2669 ;;
2670 -all-static | -static)
2671 if test "X$arg" = "X-all-static"; then
2672 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
2673 func_warning "complete static linking is impossible in this configuration"
2674 fi
2675 if test -n "$link_static_flag"; then
2676 dlopen_self=$dlopen_self_static
2677 # See comment for -static flag below, for more details.
2678 compile_command="$compile_command $link_static_flag"
2679 finalize_command="$finalize_command $link_static_flag"
2680 fi
2681 prefer_static_libs=yes
2682 else
2683 if test -z "$pic_flag" && test -n "$link_static_flag"; then
2684 dlopen_self=$dlopen_self_static
2685 fi
2686 prefer_static_libs=built
2687 fi
2688 build_libtool_libs=no
2689 build_old_libs=yes
2690 break
2691 ;;
2692 esac
2693 done
2694
2695 # See if our shared archives depend on static archives.
2696 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
2697
2698 # Go through the arguments, transforming them on the way.
2699 while test "$#" -gt 0; do
2700 arg="$1"
2701 shift
2702 func_quote_for_eval "$arg"
2703 qarg="$func_quote_for_eval_unquoted_result"
2704 libtool_args="$libtool_args $func_quote_for_eval_result"
2705
2706 # If the previous option needs an argument, assign it.
2707 if test -n "$prev"; then
2708 case $prev in
2709 output)
2710 compile_command="$compile_command @OUTPUT@"
2711 finalize_command="$finalize_command @OUTPUT@"
2712 ;;
2713 esac
2714
2715 case $prev in
2716 dlfiles|dlprefiles)
2717 if test "$preload" = no; then
2718 # Add the symbol object into the linking commands.
2719 compile_command="$compile_command @SYMFILE@"
2720 finalize_command="$finalize_command @SYMFILE@"
2721 preload=yes
2722 fi
2723 case $arg in
2724 *.la | *.lo) ;; # We handle these cases below.
2725 force)
2726 if test "$dlself" = no; then
2727 dlself=needless
2728 export_dynamic=yes
2729 fi
2730 prev=
2731 continue
2732 ;;
2733 self)
2734 if test "$prev" = dlprefiles; then
2735 dlself=yes
2736 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
2737 dlself=yes
2738 else
2739 dlself=needless
2740 export_dynamic=yes
2741 fi
2742 prev=
2743 continue
2744 ;;
2745 *)
2746 if test "$prev" = dlfiles; then
2747 dlfiles="$dlfiles $arg"
2748 else
2749 dlprefiles="$dlprefiles $arg"
2750 fi
2751 prev=
2752 continue
2753 ;;
2754 esac
2755 ;;
2756 expsyms)
2757 export_symbols="$arg"
2758 test -f "$arg" \
2759 || func_fatal_error "symbol file \`$arg' does not exist"
2760 prev=
2761 continue
2762 ;;
2763 expsyms_regex)
2764 export_symbols_regex="$arg"
2765 prev=
2766 continue
2767 ;;
2768 framework)
2769 case $host in
2770 *-*-darwin*)
2771 case "$deplibs " in
2772 *" $qarg.ltframework "*) ;;
2773 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
2774 ;;
2775 esac
2776 ;;
2777 esac
2778 prev=
2779 continue
2780 ;;
2781 inst_prefix)
2782 inst_prefix_dir="$arg"
2783 prev=
2784 continue
2785 ;;
2786 objectlist)
2787 if test -f "$arg"; then
2788 save_arg=$arg
2789 moreargs=
2790 for fil in `cat "$save_arg"`
2791 do
2792# moreargs="$moreargs $fil"
2793 arg=$fil
2794 # A libtool-controlled object.
2795
2796 # Check to see that this really is a libtool object.
2797 if func_lalib_unsafe_p "$arg"; then
2798 pic_object=
2799 non_pic_object=
2800
2801 # Read the .lo file
2802 func_source "$arg"
2803
2804 if test -z "$pic_object" ||
2805 test -z "$non_pic_object" ||
2806 test "$pic_object" = none &&
2807 test "$non_pic_object" = none; then
2808 func_fatal_error "cannot find name of object for \`$arg'"
2809 fi
2810
2811 # Extract subdirectory from the argument.
2812 func_dirname "$arg" "/" ""
2813 xdir="$func_dirname_result"
2814
2815 if test "$pic_object" != none; then
2816 # Prepend the subdirectory the object is found in.
2817 pic_object="$xdir$pic_object"
2818
2819 if test "$prev" = dlfiles; then
2820 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
2821 dlfiles="$dlfiles $pic_object"
2822 prev=
2823 continue
2824 else
2825 # If libtool objects are unsupported, then we need to preload.
2826 prev=dlprefiles
2827 fi
2828 fi
2829
2830 # CHECK ME: I think I busted this. -Ossama
2831 if test "$prev" = dlprefiles; then
2832 # Preload the old-style object.
2833 dlprefiles="$dlprefiles $pic_object"
2834 prev=
2835 fi
2836
2837 # A PIC object.
2838 libobjs="$libobjs $pic_object"
2839 arg="$pic_object"
2840 fi
2841
2842 # Non-PIC object.
2843 if test "$non_pic_object" != none; then
2844 # Prepend the subdirectory the object is found in.
2845 non_pic_object="$xdir$non_pic_object"
2846
2847 # A standard non-PIC object
2848 non_pic_objects="$non_pic_objects $non_pic_object"
2849 if test -z "$pic_object" || test "$pic_object" = none ; then
2850 arg="$non_pic_object"
2851 fi
2852 else
2853 # If the PIC object exists, use it instead.
2854 # $xdir was prepended to $pic_object above.
2855 non_pic_object="$pic_object"
2856 non_pic_objects="$non_pic_objects $non_pic_object"
2857 fi
2858 else
2859 # Only an error if not doing a dry-run.
2860 if $opt_dry_run; then
2861 # Extract subdirectory from the argument.
2862 func_dirname "$arg" "/" ""
2863 xdir="$func_dirname_result"
2864
2865 pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
2866 non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
2867 libobjs="$libobjs $pic_object"
2868 non_pic_objects="$non_pic_objects $non_pic_object"
2869 else
2870 func_fatal_error "\`$arg' is not a valid libtool object"
2871 fi
2872 fi
2873 done
2874 else
2875 func_fatal_error "link input file \`$arg' does not exist"
2876 fi
2877 arg=$save_arg
2878 prev=
2879 continue
2880 ;;
2881 precious_regex)
2882 precious_files_regex="$arg"
2883 prev=
2884 continue
2885 ;;
2886 release)
2887 release="-$arg"
2888 prev=
2889 continue
2890 ;;
2891 rpath | xrpath)
2892 # We need an absolute path.
2893 case $arg in
2894 [\\/]* | [A-Za-z]:[\\/]*) ;;
2895 *)
2896 func_fatal_error "only absolute run-paths are allowed"
2897 ;;
2898 esac
2899 if test "$prev" = rpath; then
2900 case "$rpath " in
2901 *" $arg "*) ;;
2902 *) rpath="$rpath $arg" ;;
2903 esac
2904 else
2905 case "$xrpath " in
2906 *" $arg "*) ;;
2907 *) xrpath="$xrpath $arg" ;;
2908 esac
2909 fi
2910 prev=
2911 continue
2912 ;;
2913 shrext)
2914 shrext_cmds="$arg"
2915 prev=
2916 continue
2917 ;;
2918 weak)
2919 weak_libs="$weak_libs $arg"
2920 prev=
2921 continue
2922 ;;
2923 xcclinker)
2924 linker_flags="$linker_flags $qarg"
2925 compiler_flags="$compiler_flags $qarg"
2926 prev=
2927 compile_command="$compile_command $qarg"
2928 finalize_command="$finalize_command $qarg"
2929 continue
2930 ;;
2931 xcompiler)
2932 compiler_flags="$compiler_flags $qarg"
2933 prev=
2934 compile_command="$compile_command $qarg"
2935 finalize_command="$finalize_command $qarg"
2936 continue
2937 ;;
2938 xlinker)
2939 linker_flags="$linker_flags $qarg"
2940 compiler_flags="$compiler_flags $wl$qarg"
2941 prev=
2942 compile_command="$compile_command $wl$qarg"
2943 finalize_command="$finalize_command $wl$qarg"
2944 continue
2945 ;;
2946 *)
2947 eval "$prev=\"\$arg\""
2948 prev=
2949 continue
2950 ;;
2951 esac
2952 fi # test -n "$prev"
2953
2954 prevarg="$arg"
2955
2956 case $arg in
2957 -all-static)
2958 # The effects of -all-static are defined in a previous loop.
2959 continue
2960 ;;
2961
2962 -allow-undefined)
2963 # FIXME: remove this flag sometime in the future.
2964 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
2965 ;;
2966
2967 -avoid-version)
2968 avoid_version=yes
2969 continue
2970 ;;
2971
2972 -dlopen)
2973 prev=dlfiles
2974 continue
2975 ;;
2976
2977 -dlpreopen)
2978 prev=dlprefiles
2979 continue
2980 ;;
2981
2982 -export-dynamic)
2983 export_dynamic=yes
2984 continue
2985 ;;
2986
2987 -export-symbols | -export-symbols-regex)
2988 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2989 func_fatal_error "more than one -exported-symbols argument is not allowed"
2990 fi
2991 if test "X$arg" = "X-export-symbols"; then
2992 prev=expsyms
2993 else
2994 prev=expsyms_regex
2995 fi
2996 continue
2997 ;;
2998
2999 -framework)
3000 prev=framework
3001 continue
3002 ;;
3003
3004 -inst-prefix-dir)
3005 prev=inst_prefix
3006 continue
3007 ;;
3008
3009 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
3010 # so, if we see these flags be careful not to treat them like -L
3011 -L[A-Z][A-Z]*:*)
3012 case $with_gcc/$host in
3013 no/*-*-irix* | /*-*-irix*)
3014 compile_command="$compile_command $arg"
3015 finalize_command="$finalize_command $arg"
3016 ;;
3017 esac
3018 continue
3019 ;;
3020
3021 -L*)
3022 func_stripname '-L' '' "$arg"
3023 dir=$func_stripname_result
3024 # We need an absolute path.
3025 case $dir in
3026 [\\/]* | [A-Za-z]:[\\/]*) ;;
3027 *)
3028 absdir=`cd "$dir" && pwd`
3029 test -z "$absdir" && \
3030 func_fatal_error "cannot determine absolute directory name of \`$dir'"
3031 dir="$absdir"
3032 ;;
3033 esac
3034 case "$deplibs " in
3035 *" -L$dir "*) ;;
3036 *)
3037 deplibs="$deplibs -L$dir"
3038 lib_search_path="$lib_search_path $dir"
3039 ;;
3040 esac
3041 case $host in
3042 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3043 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
3044 case :$dllsearchpath: in
3045 *":$dir:"*) ;;
3046 *) dllsearchpath="$dllsearchpath:$dir";;
3047 esac
3048 case :$dllsearchpath: in
3049 *":$testbindir:"*) ;;
3050 *) dllsearchpath="$dllsearchpath:$testbindir";;
3051 esac
3052 ;;
3053 esac
3054 continue
3055 ;;
3056
3057 -l*)
3058 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
3059 case $host in
3060 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
3061 # These systems don't actually have a C or math library (as such)
3062 continue
3063 ;;
3064 *-*-os2*)
3065 # These systems don't actually have a C library (as such)
3066 test "X$arg" = "X-lc" && continue
3067 ;;
3068 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3069 # Do not include libc due to us having libc/libc_r.
3070 test "X$arg" = "X-lc" && continue
3071 ;;
3072 *-*-rhapsody* | *-*-darwin1.[012])
3073 # Rhapsody C and math libraries are in the System framework
3074 deplibs="$deplibs System.ltframework"
3075 continue
3076 ;;
3077 *-*-sco3.2v5* | *-*-sco5v6*)
3078 # Causes problems with __ctype
3079 test "X$arg" = "X-lc" && continue
3080 ;;
3081 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3082 # Compiler inserts libc in the correct place for threads to work
3083 test "X$arg" = "X-lc" && continue
3084 ;;
3085 esac
3086 elif test "X$arg" = "X-lc_r"; then
3087 case $host in
3088 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3089 # Do not include libc_r directly, use -pthread flag.
3090 continue
3091 ;;
3092 esac
3093 fi
3094 deplibs="$deplibs $arg"
3095 continue
3096 ;;
3097
3098 -module)
3099 module=yes
3100 continue
3101 ;;
3102
3103 # Tru64 UNIX uses -model [arg] to determine the layout of C++
3104 # classes, name mangling, and exception handling.
3105 # Darwin uses the -arch flag to determine output architecture.
3106 -model|-arch|-isysroot)
3107 compile_command="$compile_command $arg"
3108 compiler_flags="$compiler_flags $arg"
3109 finalize_command="$finalize_command $arg"
3110 prev=xcompiler
3111 continue
3112 ;;
3113
3114 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
3115 compiler_flags="$compiler_flags $arg"
3116 compile_command="$compile_command $arg"
3117 finalize_command="$finalize_command $arg"
3118 case "$new_inherited_linker_flags " in
3119 *" $arg "*) ;;
3120 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
3121 esac
3122 continue
3123 ;;
3124
3125 -multi_module)
3126 single_module="${wl}-multi_module"
3127 continue
3128 ;;
3129
3130 -no-fast-install)
3131 fast_install=no
3132 continue
3133 ;;
3134
3135 -no-install)
3136 case $host in
3137 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3138 # The PATH hackery in wrapper scripts is required on Windows
3139 # in order for the loader to find any dlls it needs.
3140 func_warning "\`-no-install' is ignored for $host"
3141 func_warning "assuming \`-no-fast-install' instead"
3142 fast_install=no
3143 ;;
3144 *) no_install=yes ;;
3145 esac
3146 continue
3147 ;;
3148
3149 -no-undefined)
3150 allow_undefined=no
3151 continue
3152 ;;
3153
3154 -objectlist)
3155 prev=objectlist
3156 continue
3157 ;;
3158
3159 -o) prev=output ;;
3160
3161 -precious-files-regex)
3162 prev=precious_regex
3163 continue
3164 ;;
3165
3166 -release)
3167 prev=release
3168 continue
3169 ;;
3170
3171 -rpath)
3172 prev=rpath
3173 continue
3174 ;;
3175
3176 -R)
3177 prev=xrpath
3178 continue
3179 ;;
3180
3181 -R*)
3182 func_stripname '-R' '' "$arg"
3183 dir=$func_stripname_result
3184 # We need an absolute path.
3185 case $dir in
3186 [\\/]* | [A-Za-z]:[\\/]*) ;;
3187 *)
3188 func_fatal_error "only absolute run-paths are allowed"
3189 ;;
3190 esac
3191 case "$xrpath " in
3192 *" $dir "*) ;;
3193 *) xrpath="$xrpath $dir" ;;
3194 esac
3195 continue
3196 ;;
3197
3198 -shared)
3199 # The effects of -shared are defined in a previous loop.
3200 continue
3201 ;;
3202
3203 -shrext)
3204 prev=shrext
3205 continue
3206 ;;
3207
3208 -static)
3209 # The effects of -static are defined in a previous loop.
3210 # We used to do the same as -all-static on platforms that
3211 # didn't have a PIC flag, but the assumption that the effects
3212 # would be equivalent was wrong. It would break on at least
3213 # Digital Unix and AIX.
3214 continue
3215 ;;
3216
3217 -thread-safe)
3218 thread_safe=yes
3219 continue
3220 ;;
3221
3222 -version-info)
3223 prev=vinfo
3224 continue
3225 ;;
3226
3227 -version-number)
3228 prev=vinfo
3229 vinfo_number=yes
3230 continue
3231 ;;
3232
3233 -weak)
3234 prev=weak
3235 continue
3236 ;;
3237
3238 -Wc,*)
3239 func_stripname '-Wc,' '' "$arg"
3240 args=$func_stripname_result
3241 arg=
3242 save_ifs="$IFS"; IFS=','
3243 for flag in $args; do
3244 IFS="$save_ifs"
3245 func_quote_for_eval "$flag"
3246 arg="$arg $wl$func_quote_for_eval_result"
3247 compiler_flags="$compiler_flags $func_quote_for_eval_result"
3248 done
3249 IFS="$save_ifs"
3250 func_stripname ' ' '' "$arg"
3251 arg=$func_stripname_result
3252 ;;
3253
3254 -Wl,*)
3255 func_stripname '-Wl,' '' "$arg"
3256 args=$func_stripname_result
3257 arg=
3258 save_ifs="$IFS"; IFS=','
3259 for flag in $args; do
3260 IFS="$save_ifs"
3261 func_quote_for_eval "$flag"
3262 arg="$arg $wl$func_quote_for_eval_result"
3263 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
3264 linker_flags="$linker_flags $func_quote_for_eval_result"
3265 done
3266 IFS="$save_ifs"
3267 func_stripname ' ' '' "$arg"
3268 arg=$func_stripname_result
3269 ;;
3270
3271 -Xcompiler)
3272 prev=xcompiler
3273 continue
3274 ;;
3275
3276 -Xlinker)
3277 prev=xlinker
3278 continue
3279 ;;
3280
3281 -XCClinker)
3282 prev=xcclinker
3283 continue
3284 ;;
3285
3286 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
3287 # -r[0-9][0-9]* specifies the processor on the SGI compiler
3288 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
3289 # +DA*, +DD* enable 64-bit mode on the HP compiler
3290 # -q* pass through compiler args for the IBM compiler
3291 # -m*, -t[45]*, -txscale* pass through architecture-specific
3292 # compiler args for GCC
3293 # @file GCC response files
3294 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
3295 -t[45]*|-txscale*|@*)
3296 func_quote_for_eval "$arg"
3297 arg="$func_quote_for_eval_result"
3298 compile_command="$compile_command $arg"
3299 finalize_command="$finalize_command $arg"
3300 compiler_flags="$compiler_flags $arg"
3301 continue
3302 ;;
3303
3304 # Some other compiler flag.
3305 -* | +*)
3306 func_quote_for_eval "$arg"
3307 arg="$func_quote_for_eval_result"
3308 ;;
3309
3310 *.$objext)
3311 # A standard object.
3312 objs="$objs $arg"
3313 ;;
3314
3315 *.lo)
3316 # A libtool-controlled object.
3317
3318 # Check to see that this really is a libtool object.
3319 if func_lalib_unsafe_p "$arg"; then
3320 pic_object=
3321 non_pic_object=
3322
3323 # Read the .lo file
3324 func_source "$arg"
3325
3326 if test -z "$pic_object" ||
3327 test -z "$non_pic_object" ||
3328 test "$pic_object" = none &&
3329 test "$non_pic_object" = none; then
3330 func_fatal_error "cannot find name of object for \`$arg'"
3331 fi
3332
3333 # Extract subdirectory from the argument.
3334 func_dirname "$arg" "/" ""
3335 xdir="$func_dirname_result"
3336
3337 if test "$pic_object" != none; then
3338 # Prepend the subdirectory the object is found in.
3339 pic_object="$xdir$pic_object"
3340
3341 if test "$prev" = dlfiles; then
3342 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
3343 dlfiles="$dlfiles $pic_object"
3344 prev=
3345 continue
3346 else
3347 # If libtool objects are unsupported, then we need to preload.
3348 prev=dlprefiles
3349 fi
3350 fi
3351
3352 # CHECK ME: I think I busted this. -Ossama
3353 if test "$prev" = dlprefiles; then
3354 # Preload the old-style object.
3355 dlprefiles="$dlprefiles $pic_object"
3356 prev=
3357 fi
3358
3359 # A PIC object.
3360 libobjs="$libobjs $pic_object"
3361 arg="$pic_object"
3362 fi
3363
3364 # Non-PIC object.
3365 if test "$non_pic_object" != none; then
3366 # Prepend the subdirectory the object is found in.
3367 non_pic_object="$xdir$non_pic_object"
3368
3369 # A standard non-PIC object
3370 non_pic_objects="$non_pic_objects $non_pic_object"
3371 if test -z "$pic_object" || test "$pic_object" = none ; then
3372 arg="$non_pic_object"
3373 fi
3374 else
3375 # If the PIC object exists, use it instead.
3376 # $xdir was prepended to $pic_object above.
3377 non_pic_object="$pic_object"
3378 non_pic_objects="$non_pic_objects $non_pic_object"
3379 fi
3380 else
3381 # Only an error if not doing a dry-run.
3382 if $opt_dry_run; then
3383 # Extract subdirectory from the argument.
3384 func_dirname "$arg" "/" ""
3385 xdir="$func_dirname_result"
3386
3387 pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
3388 non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
3389 libobjs="$libobjs $pic_object"
3390 non_pic_objects="$non_pic_objects $non_pic_object"
3391 else
3392 func_fatal_error "\`$arg' is not a valid libtool object"
3393 fi
3394 fi
3395 ;;
3396
3397 *.$libext)
3398 # An archive.
3399 deplibs="$deplibs $arg"
3400 old_deplibs="$old_deplibs $arg"
3401 continue
3402 ;;
3403
3404 *.la)
3405 # A libtool-controlled library.
3406
3407 if test "$prev" = dlfiles; then
3408 # This library was specified with -dlopen.
3409 dlfiles="$dlfiles $arg"
3410 prev=
3411 elif test "$prev" = dlprefiles; then
3412 # The library was specified with -dlpreopen.
3413 dlprefiles="$dlprefiles $arg"
3414 prev=
3415 else
3416 deplibs="$deplibs $arg"
3417 fi
3418 continue
3419 ;;
3420
3421 # Some other compiler argument.
3422 *)
3423 # Unknown arguments in both finalize_command and compile_command need
3424 # to be aesthetically quoted because they are evaled later.
3425 func_quote_for_eval "$arg"
3426 arg="$func_quote_for_eval_result"
3427 ;;
3428 esac # arg
3429
3430 # Now actually substitute the argument into the commands.
3431 if test -n "$arg"; then
3432 compile_command="$compile_command $arg"
3433 finalize_command="$finalize_command $arg"
3434 fi
3435 done # argument parsing loop
3436
3437 test -n "$prev" && \
3438 func_fatal_help "the \`$prevarg' option requires an argument"
3439
3440 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
3441 eval arg=\"$export_dynamic_flag_spec\"
3442 compile_command="$compile_command $arg"
3443 finalize_command="$finalize_command $arg"
3444 fi
3445
3446 oldlibs=
3447 # calculate the name of the file, without its directory
3448 func_basename "$output"
3449 outputname="$func_basename_result"
3450 libobjs_save="$libobjs"
3451
3452 if test -n "$shlibpath_var"; then
3453 # get the directories listed in $shlibpath_var
3454 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
3455 else
3456 shlib_search_path=
3457 fi
3458 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
3459 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
3460
3461 func_dirname "$output" "/" ""
3462 output_objdir="$func_dirname_result$objdir"
3463 # Create the object directory.
3464 func_mkdir_p "$output_objdir"
3465
3466 # Determine the type of output
3467 case $output in
3468 "")
3469 func_fatal_help "you must specify an output file"
3470 ;;
3471 *.$libext) linkmode=oldlib ;;
3472 *.lo | *.$objext) linkmode=obj ;;
3473 *.la) linkmode=lib ;;
3474 *) linkmode=prog ;; # Anything else should be a program.
3475 esac
3476
3477 specialdeplibs=
3478
3479 libs=
3480 # Find all interdependent deplibs by searching for libraries
3481 # that are linked more than once (e.g. -la -lb -la)
3482 for deplib in $deplibs; do
3483 if $opt_duplicate_deps ; then
3484 case "$libs " in
3485 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3486 esac
3487 fi
3488 libs="$libs $deplib"
3489 done
3490
3491 if test "$linkmode" = lib; then
3492 libs="$predeps $libs $compiler_lib_search_path $postdeps"
3493
3494 # Compute libraries that are listed more than once in $predeps
3495 # $postdeps and mark them as special (i.e., whose duplicates are
3496 # not to be eliminated).
3497 pre_post_deps=
3498 if $opt_duplicate_compiler_generated_deps; then
3499 for pre_post_dep in $predeps $postdeps; do
3500 case "$pre_post_deps " in
3501 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
3502 esac
3503 pre_post_deps="$pre_post_deps $pre_post_dep"
3504 done
3505 fi
3506 pre_post_deps=
3507 fi
3508
3509 deplibs=
3510 newdependency_libs=
3511 newlib_search_path=
3512 need_relink=no # whether we're linking any uninstalled libtool libraries
3513 notinst_deplibs= # not-installed libtool libraries
3514 notinst_path= # paths that contain not-installed libtool libraries
3515
3516 case $linkmode in
3517 lib)
3518 passes="conv dlpreopen link"
3519 for file in $dlfiles $dlprefiles; do
3520 case $file in
3521 *.la) ;;
3522 *)
3523 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
3524 ;;
3525 esac
3526 done
3527 ;;
3528 prog)
3529 compile_deplibs=
3530 finalize_deplibs=
3531 alldeplibs=no
3532 newdlfiles=
3533 newdlprefiles=
3534 passes="conv scan dlopen dlpreopen link"
3535 ;;
3536 *) passes="conv"
3537 ;;
3538 esac
3539
3540 for pass in $passes; do
3541 # The preopen pass in lib mode reverses $deplibs; put it back here
3542 # so that -L comes before libs that need it for instance...
3543 if test "$linkmode,$pass" = "lib,link"; then
3544 ## FIXME: Find the place where the list is rebuilt in the wrong
3545 ## order, and fix it there properly
3546 tmp_deplibs=
3547 for deplib in $deplibs; do
3548 tmp_deplibs="$deplib $tmp_deplibs"
3549 done
3550 deplibs="$tmp_deplibs"
3551 fi
3552
3553 if test "$linkmode,$pass" = "lib,link" ||
3554 test "$linkmode,$pass" = "prog,scan"; then
3555 libs="$deplibs"
3556 deplibs=
3557 fi
3558 if test "$linkmode" = prog; then
3559 case $pass in
3560 dlopen) libs="$dlfiles" ;;
3561 dlpreopen) libs="$dlprefiles" ;;
3562 link)
3563 libs="$deplibs %DEPLIBS%"
3564 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
3565 ;;
3566 esac
3567 fi
3568 if test "$linkmode,$pass" = "lib,dlpreopen"; then
3569 # Collect and forward deplibs of preopened libtool libs
3570 for lib in $dlprefiles; do
3571 # Ignore non-libtool-libs
3572 dependency_libs=
3573 case $lib in
3574 *.la) func_source "$lib" ;;
3575 esac
3576
3577 # Collect preopened libtool deplibs, except any this library
3578 # has declared as weak libs
3579 for deplib in $dependency_libs; do
3580 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
3581 case " $weak_libs " in
3582 *" $deplib_base "*) ;;
3583 *) deplibs="$deplibs $deplib" ;;
3584 esac
3585 done
3586 done
3587 libs="$dlprefiles"
3588 fi
3589 if test "$pass" = dlopen; then
3590 # Collect dlpreopened libraries
3591 save_deplibs="$deplibs"
3592 deplibs=
3593 fi
3594
3595 for deplib in $libs; do
3596 lib=
3597 found=no
3598 case $deplib in
3599 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
3600 if test "$linkmode,$pass" = "prog,link"; then
3601 compile_deplibs="$deplib $compile_deplibs"
3602 finalize_deplibs="$deplib $finalize_deplibs"
3603 else
3604 compiler_flags="$compiler_flags $deplib"
3605 if test "$linkmode" = lib ; then
3606 case "$new_inherited_linker_flags " in
3607 *" $deplib "*) ;;
3608 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
3609 esac
3610 fi
3611 fi
3612 continue
3613 ;;
3614 -l*)
3615 if test "$linkmode" != lib && test "$linkmode" != prog; then
3616 func_warning "\`-l' is ignored for archives/objects"
3617 continue
3618 fi
3619 func_stripname '-l' '' "$deplib"
3620 name=$func_stripname_result
3621 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
3622 for search_ext in .la $std_shrext .so .a; do
3623 # Search the libtool library
3624 lib="$searchdir/lib${name}${search_ext}"
3625 if test -f "$lib"; then
3626 if test "$search_ext" = ".la"; then
3627 found=yes
3628 else
3629 found=no
3630 fi
3631 break 2
3632 fi
3633 done
3634 done
3635 if test "$found" != yes; then
3636 # deplib doesn't seem to be a libtool library
3637 if test "$linkmode,$pass" = "prog,link"; then
3638 compile_deplibs="$deplib $compile_deplibs"
3639 finalize_deplibs="$deplib $finalize_deplibs"
3640 else
3641 deplibs="$deplib $deplibs"
3642 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
3643 fi
3644 continue
3645 else # deplib is a libtool library
3646 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
3647 # We need to do some special things here, and not later.
3648 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3649 case " $predeps $postdeps " in
3650 *" $deplib "*)
3651 if func_lalib_p "$lib"; then
3652 library_names=
3653 old_library=
3654 func_source "$lib"
3655 for l in $old_library $library_names; do
3656 ll="$l"
3657 done
3658 if test "X$ll" = "X$old_library" ; then # only static version available
3659 found=no
3660 func_dirname "$lib" "" "."
3661 ladir="$func_dirname_result"
3662 lib=$ladir/$old_library
3663 if test "$linkmode,$pass" = "prog,link"; then
3664 compile_deplibs="$deplib $compile_deplibs"
3665 finalize_deplibs="$deplib $finalize_deplibs"
3666 else
3667 deplibs="$deplib $deplibs"
3668 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
3669 fi
3670 continue
3671 fi
3672 fi
3673 ;;
3674 *) ;;
3675 esac
3676 fi
3677 fi
3678 ;; # -l
3679 *.ltframework)
3680 if test "$linkmode,$pass" = "prog,link"; then
3681 compile_deplibs="$deplib $compile_deplibs"
3682 finalize_deplibs="$deplib $finalize_deplibs"
3683 else
3684 deplibs="$deplib $deplibs"
3685 if test "$linkmode" = lib ; then
3686 case "$new_inherited_linker_flags " in
3687 *" $deplib "*) ;;
3688 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
3689 esac
3690 fi
3691 fi
3692 continue
3693 ;;
3694 -L*)
3695 case $linkmode in
3696 lib)
3697 deplibs="$deplib $deplibs"
3698 test "$pass" = conv && continue
3699 newdependency_libs="$deplib $newdependency_libs"
3700 func_stripname '-L' '' "$deplib"
3701 newlib_search_path="$newlib_search_path $func_stripname_result"
3702 ;;
3703 prog)
3704 if test "$pass" = conv; then
3705 deplibs="$deplib $deplibs"
3706 continue
3707 fi
3708 if test "$pass" = scan; then
3709 deplibs="$deplib $deplibs"
3710 else
3711 compile_deplibs="$deplib $compile_deplibs"
3712 finalize_deplibs="$deplib $finalize_deplibs"
3713 fi
3714 func_stripname '-L' '' "$deplib"
3715 newlib_search_path="$newlib_search_path $func_stripname_result"
3716 ;;
3717 *)
3718 func_warning "\`-L' is ignored for archives/objects"
3719 ;;
3720 esac # linkmode
3721 continue
3722 ;; # -L
3723 -R*)
3724 if test "$pass" = link; then
3725 func_stripname '-R' '' "$deplib"
3726 dir=$func_stripname_result
3727 # Make sure the xrpath contains only unique directories.
3728 case "$xrpath " in
3729 *" $dir "*) ;;
3730 *) xrpath="$xrpath $dir" ;;
3731 esac
3732 fi
3733 deplibs="$deplib $deplibs"
3734 continue
3735 ;;
3736 *.la) lib="$deplib" ;;
3737 *.$libext)
3738 if test "$pass" = conv; then
3739 deplibs="$deplib $deplibs"
3740 continue
3741 fi
3742 case $linkmode in
3743 lib)
3744 # Linking convenience modules into shared libraries is allowed,
3745 # but linking other static libraries is non-portable.
3746 case " $dlpreconveniencelibs " in
3747 *" $lib "*) ;;
3748 *)
3749 valid_a_lib=no
3750 case $deplibs_check_method in
3751 match_pattern*)
3752 set dummy $deplibs_check_method; shift
3753 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
3754 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
3755 | $EGREP "$match_pattern_regex" > /dev/null; then
3756 valid_a_lib=yes
3757 fi
3758 ;;
3759 pass_all)
3760 valid_a_lib=yes
3761 ;;
3762 esac
3763 if test "$valid_a_lib" != yes; then
3764 $ECHO
3765 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
3766 $ECHO "*** I have the capability to make that library automatically link in when"
3767 $ECHO "*** you link to this library. But I can only do this if you have a"
3768 $ECHO "*** shared version of the library, which you do not appear to have"
3769 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
3770 $ECHO "*** that it is just a static archive that I should not use here."
3771 else
3772 $ECHO
3773 $ECHO "*** Warning: Linking the shared library $output against the"
3774 $ECHO "*** static library $deplib is not portable!"
3775 deplibs="$deplib $deplibs"
3776 fi
3777 ;;
3778 esac
3779 continue
3780 ;;
3781 prog)
3782 if test "$pass" != link; then
3783 deplibs="$deplib $deplibs"
3784 else
3785 compile_deplibs="$deplib $compile_deplibs"
3786 finalize_deplibs="$deplib $finalize_deplibs"
3787 fi
3788 continue
3789 ;;
3790 esac # linkmode
3791 ;; # *.$libext
3792 *.lo | *.$objext)
3793 if test "$pass" = conv; then
3794 deplibs="$deplib $deplibs"
3795 elif test "$linkmode" = prog; then
3796 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
3797 # If there is no dlopen support or we're linking statically,
3798 # we need to preload.
3799 newdlprefiles="$newdlprefiles $deplib"
3800 compile_deplibs="$deplib $compile_deplibs"
3801 finalize_deplibs="$deplib $finalize_deplibs"
3802 else
3803 newdlfiles="$newdlfiles $deplib"
3804 fi
3805 fi
3806 continue
3807 ;;
3808 %DEPLIBS%)
3809 alldeplibs=yes
3810 continue
3811 ;;
3812 esac # case $deplib
3813
3814 if test "$found" = yes || test -f "$lib"; then :
3815 else
3816 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
3817 fi
3818
3819 # Check to see that this really is a libtool archive.
3820 func_lalib_unsafe_p "$lib" \
3821 || func_fatal_error "\`$lib' is not a valid libtool archive"
3822
3823 func_dirname "$lib" "" "."
3824 ladir="$func_dirname_result"
3825
3826 dlname=
3827 dlopen=
3828 dlpreopen=
3829 libdir=
3830 library_names=
3831 old_library=
3832 inherited_linker_flags=
3833 # If the library was installed with an old release of libtool,
3834 # it will not redefine variables installed, or shouldnotlink
3835 installed=yes
3836 shouldnotlink=no
3837 avoidtemprpath=
3838
3839
3840 # Read the .la file
3841 func_source "$lib"
3842
3843 # Convert "-framework foo" to "foo.ltframework"
3844 if test -n "$inherited_linker_flags"; then
3845 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
3846 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
3847 case " $new_inherited_linker_flags " in
3848 *" $tmp_inherited_linker_flag "*) ;;
3849 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
3850 esac
3851 done
3852 fi
3853 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
3854 if test "$linkmode,$pass" = "prog,link"; then
3855 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
3856 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
3857 else
3858 compiler_flags="$compiler_flags $inherited_linker_flags"
3859 fi
3860 if test "$linkmode,$pass" = "lib,link" ||
3861 test "$linkmode,$pass" = "prog,scan" ||
3862 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
3863 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
3864 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
3865 fi
3866
3867 if test "$pass" = conv; then
3868 # Only check for convenience libraries
3869 deplibs="$lib $deplibs"
3870 if test -z "$libdir"; then
3871 if test -z "$old_library"; then
3872 func_fatal_error "cannot find name of link library for \`$lib'"
3873 fi
3874 # It is a libtool convenience library, so add in its objects.
3875 convenience="$convenience $ladir/$objdir/$old_library"
3876 old_convenience="$old_convenience $ladir/$objdir/$old_library"
3877 elif test "$linkmode" != prog && test "$linkmode" != lib; then
3878 func_fatal_error "\`$lib' is not a convenience library"
3879 fi
3880 tmp_libs=
3881 for deplib in $dependency_libs; do
3882 deplibs="$deplib $deplibs"
3883 if $opt_duplicate_deps ; then
3884 case "$tmp_libs " in
3885 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3886 esac
3887 fi
3888 tmp_libs="$tmp_libs $deplib"
3889 done
3890 continue
3891 fi # $pass = conv
3892
3893
3894 # Get the name of the library we link against.
3895 linklib=
3896 for l in $old_library $library_names; do
3897 linklib="$l"
3898 done
3899 if test -z "$linklib"; then
3900 func_fatal_error "cannot find name of link library for \`$lib'"
3901 fi
3902
3903 # This library was specified with -dlopen.
3904 if test "$pass" = dlopen; then
3905 if test -z "$libdir"; then
3906 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
3907 fi
3908 if test -z "$dlname" ||
3909 test "$dlopen_support" != yes ||
3910 test "$build_libtool_libs" = no; then
3911 # If there is no dlname, no dlopen support or we're linking
3912 # statically, we need to preload. We also need to preload any
3913 # dependent libraries so libltdl's deplib preloader doesn't
3914 # bomb out in the load deplibs phase.
3915 dlprefiles="$dlprefiles $lib $dependency_libs"
3916 else
3917 newdlfiles="$newdlfiles $lib"
3918 fi
3919 continue
3920 fi # $pass = dlopen
3921
3922 # We need an absolute path.
3923 case $ladir in
3924 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
3925 *)
3926 abs_ladir=`cd "$ladir" && pwd`
3927 if test -z "$abs_ladir"; then
3928 func_warning "cannot determine absolute directory name of \`$ladir'"
3929 func_warning "passing it literally to the linker, although it might fail"
3930 abs_ladir="$ladir"
3931 fi
3932 ;;
3933 esac
3934 func_basename "$lib"
3935 laname="$func_basename_result"
3936
3937 # Find the relevant object directory and library name.
3938 if test "X$installed" = Xyes; then
3939 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
3940 func_warning "library \`$lib' was moved."
3941 dir="$ladir"
3942 absdir="$abs_ladir"
3943 libdir="$abs_ladir"
3944 else
3945 dir="$libdir"
3946 absdir="$libdir"
3947 fi
3948 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
3949 else
3950 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
3951 dir="$ladir"
3952 absdir="$abs_ladir"
3953 # Remove this search path later
3954 notinst_path="$notinst_path $abs_ladir"
3955 else
3956 dir="$ladir/$objdir"
3957 absdir="$abs_ladir/$objdir"
3958 # Remove this search path later
3959 notinst_path="$notinst_path $abs_ladir"
3960 fi
3961 fi # $installed = yes
3962 func_stripname 'lib' '.la' "$laname"
3963 name=$func_stripname_result
3964
3965 # This library was specified with -dlpreopen.
3966 if test "$pass" = dlpreopen; then
3967 if test -z "$libdir" && test "$linkmode" = prog; then
3968 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
3969 fi
3970 # Prefer using a static library (so that no silly _DYNAMIC symbols
3971 # are required to link).
3972 if test -n "$old_library"; then
3973 newdlprefiles="$newdlprefiles $dir/$old_library"
3974 # Keep a list of preopened convenience libraries to check
3975 # that they are being used correctly in the link pass.
3976 test -z "$libdir" && \
3977 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
3978 # Otherwise, use the dlname, so that lt_dlopen finds it.
3979 elif test -n "$dlname"; then
3980 newdlprefiles="$newdlprefiles $dir/$dlname"
3981 else
3982 newdlprefiles="$newdlprefiles $dir/$linklib"
3983 fi
3984 fi # $pass = dlpreopen
3985
3986 if test -z "$libdir"; then
3987 # Link the convenience library
3988 if test "$linkmode" = lib; then
3989 deplibs="$dir/$old_library $deplibs"
3990 elif test "$linkmode,$pass" = "prog,link"; then
3991 compile_deplibs="$dir/$old_library $compile_deplibs"
3992 finalize_deplibs="$dir/$old_library $finalize_deplibs"
3993 else
3994 deplibs="$lib $deplibs" # used for prog,scan pass
3995 fi
3996 continue
3997 fi
3998
3999
4000 if test "$linkmode" = prog && test "$pass" != link; then
4001 newlib_search_path="$newlib_search_path $ladir"
4002 deplibs="$lib $deplibs"
4003
4004 linkalldeplibs=no
4005 if test "$link_all_deplibs" != no || test -z "$library_names" ||
4006 test "$build_libtool_libs" = no; then
4007 linkalldeplibs=yes
4008 fi
4009
4010 tmp_libs=
4011 for deplib in $dependency_libs; do
4012 case $deplib in
4013 -L*) func_stripname '-L' '' "$deplib"
4014 newlib_search_path="$newlib_search_path $func_stripname_result"
4015 ;;
4016 esac
4017 # Need to link against all dependency_libs?
4018 if test "$linkalldeplibs" = yes; then
4019 deplibs="$deplib $deplibs"
4020 else
4021 # Need to hardcode shared library paths
4022 # or/and link against static libraries
4023 newdependency_libs="$deplib $newdependency_libs"
4024 fi
4025 if $opt_duplicate_deps ; then
4026 case "$tmp_libs " in
4027 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4028 esac
4029 fi
4030 tmp_libs="$tmp_libs $deplib"
4031 done # for deplib
4032 continue
4033 fi # $linkmode = prog...
4034
4035 if test "$linkmode,$pass" = "prog,link"; then
4036 if test -n "$library_names" &&
4037 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
4038 # We need to hardcode the library path
4039 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
4040 # Make sure the rpath contains only unique directories.
4041 case "$temp_rpath " in
4042 *"$absdir:"*) ;;
4043 *) temp_rpath="$temp_rpath:$absdir" ;;
4044 esac
4045 fi
4046
4047 # Hardcode the library path.
4048 # Skip directories that are in the system default run-time
4049 # search path.
4050 case " $sys_lib_dlsearch_path " in
4051 *" $absdir "*) ;;
4052 *)
4053 case "$compile_rpath " in
4054 *" $absdir "*) ;;
4055 *) compile_rpath="$compile_rpath $absdir"
4056 esac
4057 ;;
4058 esac
4059 case " $sys_lib_dlsearch_path " in
4060 *" $libdir "*) ;;
4061 *)
4062 case "$finalize_rpath " in
4063 *" $libdir "*) ;;
4064 *) finalize_rpath="$finalize_rpath $libdir"
4065 esac
4066 ;;
4067 esac
4068 fi # $linkmode,$pass = prog,link...
4069
4070 if test "$alldeplibs" = yes &&
4071 { test "$deplibs_check_method" = pass_all ||
4072 { test "$build_libtool_libs" = yes &&
4073 test -n "$library_names"; }; }; then
4074 # We only need to search for static libraries
4075 continue
4076 fi
4077 fi
4078
4079 link_static=no # Whether the deplib will be linked statically
4080 use_static_libs=$prefer_static_libs
4081 if test "$use_static_libs" = built && test "$installed" = yes; then
4082 use_static_libs=no
4083 fi
4084 if test -n "$library_names" &&
4085 { test "$use_static_libs" = no || test -z "$old_library"; }; then
4086 case $host in
4087 *cygwin* | *mingw*)
4088 # No point in relinking DLLs because paths are not encoded
4089 notinst_deplibs="$notinst_deplibs $lib"
4090 need_relink=no
4091 ;;
4092 *)
4093 if test "$installed" = no; then
4094 notinst_deplibs="$notinst_deplibs $lib"
4095 need_relink=yes
4096 fi
4097 ;;
4098 esac
4099 # This is a shared library
4100
4101 # Warn about portability, can't link against -module's on some
4102 # systems (darwin). Don't bleat about dlopened modules though!
4103 dlopenmodule=""
4104 for dlpremoduletest in $dlprefiles; do
4105 if test "X$dlpremoduletest" = "X$lib"; then
4106 dlopenmodule="$dlpremoduletest"
4107 break
4108 fi
4109 done
4110 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
4111 $ECHO
4112 if test "$linkmode" = prog; then
4113 $ECHO "*** Warning: Linking the executable $output against the loadable module"
4114 else
4115 $ECHO "*** Warning: Linking the shared library $output against the loadable module"