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