source: proiecte/HadoopJUnit/hadoop-0.20.1/src/c++/libhdfs/ltmain.sh @ 120

Last change on this file since 120 was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

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