Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | # Generated from ltmain.m4sh. |
michael@0 | 2 | |
michael@0 | 3 | # ltmain.sh (GNU libtool) 2.2.6b |
michael@0 | 4 | # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
michael@0 | 5 | |
michael@0 | 6 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. |
michael@0 | 7 | # This is free software; see the source for copying conditions. There is NO |
michael@0 | 8 | # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
michael@0 | 9 | |
michael@0 | 10 | # GNU Libtool is free software; you can redistribute it and/or modify |
michael@0 | 11 | # it under the terms of the GNU General Public License as published by |
michael@0 | 12 | # the Free Software Foundation; either version 2 of the License, or |
michael@0 | 13 | # (at your option) any later version. |
michael@0 | 14 | # |
michael@0 | 15 | # As a special exception to the GNU General Public License, |
michael@0 | 16 | # if you distribute this file as part of a program or library that |
michael@0 | 17 | # is built using GNU Libtool, you may include this file under the |
michael@0 | 18 | # same distribution terms that you use for the rest of that program. |
michael@0 | 19 | # |
michael@0 | 20 | # GNU Libtool is distributed in the hope that it will be useful, but |
michael@0 | 21 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
michael@0 | 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
michael@0 | 23 | # General Public License for more details. |
michael@0 | 24 | # |
michael@0 | 25 | # You should have received a copy of the GNU General Public License |
michael@0 | 26 | # along with GNU Libtool; see the file COPYING. If not, a copy |
michael@0 | 27 | # can be downloaded from http://www.gnu.org/licenses/gpl.html, |
michael@0 | 28 | # or obtained by writing to the Free Software Foundation, Inc., |
michael@0 | 29 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
michael@0 | 30 | |
michael@0 | 31 | # Usage: $progname [OPTION]... [MODE-ARG]... |
michael@0 | 32 | # |
michael@0 | 33 | # Provide generalized library-building support services. |
michael@0 | 34 | # |
michael@0 | 35 | # --config show all configuration variables |
michael@0 | 36 | # --debug enable verbose shell tracing |
michael@0 | 37 | # -n, --dry-run display commands without modifying any files |
michael@0 | 38 | # --features display basic configuration information and exit |
michael@0 | 39 | # --mode=MODE use operation mode MODE |
michael@0 | 40 | # --preserve-dup-deps don't remove duplicate dependency libraries |
michael@0 | 41 | # --quiet, --silent don't print informational messages |
michael@0 | 42 | # --tag=TAG use configuration variables from tag TAG |
michael@0 | 43 | # -v, --verbose print informational messages (default) |
michael@0 | 44 | # --version print version information |
michael@0 | 45 | # -h, --help print short or long help message |
michael@0 | 46 | # |
michael@0 | 47 | # MODE must be one of the following: |
michael@0 | 48 | # |
michael@0 | 49 | # clean remove files from the build directory |
michael@0 | 50 | # compile compile a source file into a libtool object |
michael@0 | 51 | # execute automatically set library path, then run a program |
michael@0 | 52 | # finish complete the installation of libtool libraries |
michael@0 | 53 | # install install libraries or executables |
michael@0 | 54 | # link create a library or an executable |
michael@0 | 55 | # uninstall remove libraries from an installed directory |
michael@0 | 56 | # |
michael@0 | 57 | # MODE-ARGS vary depending on the MODE. |
michael@0 | 58 | # Try `$progname --help --mode=MODE' for a more detailed description of MODE. |
michael@0 | 59 | # |
michael@0 | 60 | # When reporting a bug, please describe a test case to reproduce it and |
michael@0 | 61 | # include the following information: |
michael@0 | 62 | # |
michael@0 | 63 | # host-triplet: $host |
michael@0 | 64 | # shell: $SHELL |
michael@0 | 65 | # compiler: $LTCC |
michael@0 | 66 | # compiler flags: $LTCFLAGS |
michael@0 | 67 | # linker: $LD (gnu? $with_gnu_ld) |
michael@0 | 68 | # $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1 |
michael@0 | 69 | # automake: $automake_version |
michael@0 | 70 | # autoconf: $autoconf_version |
michael@0 | 71 | # |
michael@0 | 72 | # Report bugs to <bug-libtool@gnu.org>. |
michael@0 | 73 | |
michael@0 | 74 | PROGRAM=ltmain.sh |
michael@0 | 75 | PACKAGE=libtool |
michael@0 | 76 | VERSION="2.2.6b Debian-2.2.6b-2ubuntu1" |
michael@0 | 77 | TIMESTAMP="" |
michael@0 | 78 | package_revision=1.3017 |
michael@0 | 79 | |
michael@0 | 80 | # Be Bourne compatible |
michael@0 | 81 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then |
michael@0 | 82 | emulate sh |
michael@0 | 83 | NULLCMD=: |
michael@0 | 84 | # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which |
michael@0 | 85 | # is contrary to our usage. Disable this feature. |
michael@0 | 86 | alias -g '${1+"$@"}'='"$@"' |
michael@0 | 87 | setopt NO_GLOB_SUBST |
michael@0 | 88 | else |
michael@0 | 89 | case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac |
michael@0 | 90 | fi |
michael@0 | 91 | BIN_SH=xpg4; export BIN_SH # for Tru64 |
michael@0 | 92 | DUALCASE=1; export DUALCASE # for MKS sh |
michael@0 | 93 | |
michael@0 | 94 | # NLS nuisances: We save the old values to restore during execute mode. |
michael@0 | 95 | # Only set LANG and LC_ALL to C if already set. |
michael@0 | 96 | # These must not be set unconditionally because not all systems understand |
michael@0 | 97 | # e.g. LANG=C (notably SCO). |
michael@0 | 98 | lt_user_locale= |
michael@0 | 99 | lt_safe_locale= |
michael@0 | 100 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
michael@0 | 101 | do |
michael@0 | 102 | eval "if test \"\${$lt_var+set}\" = set; then |
michael@0 | 103 | save_$lt_var=\$$lt_var |
michael@0 | 104 | $lt_var=C |
michael@0 | 105 | export $lt_var |
michael@0 | 106 | lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" |
michael@0 | 107 | lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" |
michael@0 | 108 | fi" |
michael@0 | 109 | done |
michael@0 | 110 | |
michael@0 | 111 | $lt_unset CDPATH |
michael@0 | 112 | |
michael@0 | 113 | |
michael@0 | 114 | |
michael@0 | 115 | |
michael@0 | 116 | |
michael@0 | 117 | : ${CP="cp -f"} |
michael@0 | 118 | : ${ECHO="echo"} |
michael@0 | 119 | : ${EGREP="/bin/grep -E"} |
michael@0 | 120 | : ${FGREP="/bin/grep -F"} |
michael@0 | 121 | : ${GREP="/bin/grep"} |
michael@0 | 122 | : ${LN_S="ln -s"} |
michael@0 | 123 | : ${MAKE="make"} |
michael@0 | 124 | : ${MKDIR="mkdir"} |
michael@0 | 125 | : ${MV="mv -f"} |
michael@0 | 126 | : ${RM="rm -f"} |
michael@0 | 127 | : ${SED="/bin/sed"} |
michael@0 | 128 | : ${SHELL="${CONFIG_SHELL-/bin/sh}"} |
michael@0 | 129 | : ${Xsed="$SED -e 1s/^X//"} |
michael@0 | 130 | |
michael@0 | 131 | # Global variables: |
michael@0 | 132 | EXIT_SUCCESS=0 |
michael@0 | 133 | EXIT_FAILURE=1 |
michael@0 | 134 | EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. |
michael@0 | 135 | EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. |
michael@0 | 136 | |
michael@0 | 137 | exit_status=$EXIT_SUCCESS |
michael@0 | 138 | |
michael@0 | 139 | # Make sure IFS has a sensible default |
michael@0 | 140 | lt_nl=' |
michael@0 | 141 | ' |
michael@0 | 142 | IFS=" $lt_nl" |
michael@0 | 143 | |
michael@0 | 144 | dirname="s,/[^/]*$,," |
michael@0 | 145 | basename="s,^.*/,," |
michael@0 | 146 | |
michael@0 | 147 | # func_dirname_and_basename file append nondir_replacement |
michael@0 | 148 | # perform func_basename and func_dirname in a single function |
michael@0 | 149 | # call: |
michael@0 | 150 | # dirname: Compute the dirname of FILE. If nonempty, |
michael@0 | 151 | # add APPEND to the result, otherwise set result |
michael@0 | 152 | # to NONDIR_REPLACEMENT. |
michael@0 | 153 | # value returned in "$func_dirname_result" |
michael@0 | 154 | # basename: Compute filename of FILE. |
michael@0 | 155 | # value retuned in "$func_basename_result" |
michael@0 | 156 | # Implementation must be kept synchronized with func_dirname |
michael@0 | 157 | # and func_basename. For efficiency, we do not delegate to |
michael@0 | 158 | # those functions but instead duplicate the functionality here. |
michael@0 | 159 | func_dirname_and_basename () |
michael@0 | 160 | { |
michael@0 | 161 | # Extract subdirectory from the argument. |
michael@0 | 162 | func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` |
michael@0 | 163 | if test "X$func_dirname_result" = "X${1}"; then |
michael@0 | 164 | func_dirname_result="${3}" |
michael@0 | 165 | else |
michael@0 | 166 | func_dirname_result="$func_dirname_result${2}" |
michael@0 | 167 | fi |
michael@0 | 168 | func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` |
michael@0 | 169 | } |
michael@0 | 170 | |
michael@0 | 171 | # Generated shell functions inserted here. |
michael@0 | 172 | |
michael@0 | 173 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh |
michael@0 | 174 | # is ksh but when the shell is invoked as "sh" and the current value of |
michael@0 | 175 | # the _XPG environment variable is not equal to 1 (one), the special |
michael@0 | 176 | # positional parameter $0, within a function call, is the name of the |
michael@0 | 177 | # function. |
michael@0 | 178 | progpath="$0" |
michael@0 | 179 | |
michael@0 | 180 | # The name of this program: |
michael@0 | 181 | # In the unlikely event $progname began with a '-', it would play havoc with |
michael@0 | 182 | # func_echo (imagine progname=-n), so we prepend ./ in that case: |
michael@0 | 183 | func_dirname_and_basename "$progpath" |
michael@0 | 184 | progname=$func_basename_result |
michael@0 | 185 | case $progname in |
michael@0 | 186 | -*) progname=./$progname ;; |
michael@0 | 187 | esac |
michael@0 | 188 | |
michael@0 | 189 | # Make sure we have an absolute path for reexecution: |
michael@0 | 190 | case $progpath in |
michael@0 | 191 | [\\/]*|[A-Za-z]:\\*) ;; |
michael@0 | 192 | *[\\/]*) |
michael@0 | 193 | progdir=$func_dirname_result |
michael@0 | 194 | progdir=`cd "$progdir" && pwd` |
michael@0 | 195 | progpath="$progdir/$progname" |
michael@0 | 196 | ;; |
michael@0 | 197 | *) |
michael@0 | 198 | save_IFS="$IFS" |
michael@0 | 199 | IFS=: |
michael@0 | 200 | for progdir in $PATH; do |
michael@0 | 201 | IFS="$save_IFS" |
michael@0 | 202 | test -x "$progdir/$progname" && break |
michael@0 | 203 | done |
michael@0 | 204 | IFS="$save_IFS" |
michael@0 | 205 | test -n "$progdir" || progdir=`pwd` |
michael@0 | 206 | progpath="$progdir/$progname" |
michael@0 | 207 | ;; |
michael@0 | 208 | esac |
michael@0 | 209 | |
michael@0 | 210 | # Sed substitution that helps us do robust quoting. It backslashifies |
michael@0 | 211 | # metacharacters that are still active within double-quoted strings. |
michael@0 | 212 | Xsed="${SED}"' -e 1s/^X//' |
michael@0 | 213 | sed_quote_subst='s/\([`"$\\]\)/\\\1/g' |
michael@0 | 214 | |
michael@0 | 215 | # Same as above, but do not quote variable references. |
michael@0 | 216 | double_quote_subst='s/\(["`\\]\)/\\\1/g' |
michael@0 | 217 | |
michael@0 | 218 | # Re-`\' parameter expansions in output of double_quote_subst that were |
michael@0 | 219 | # `\'-ed in input to the same. If an odd number of `\' preceded a '$' |
michael@0 | 220 | # in input to double_quote_subst, that '$' was protected from expansion. |
michael@0 | 221 | # Since each input `\' is now two `\'s, look for any number of runs of |
michael@0 | 222 | # four `\'s followed by two `\'s and then a '$'. `\' that '$'. |
michael@0 | 223 | bs='\\' |
michael@0 | 224 | bs2='\\\\' |
michael@0 | 225 | bs4='\\\\\\\\' |
michael@0 | 226 | dollar='\$' |
michael@0 | 227 | sed_double_backslash="\ |
michael@0 | 228 | s/$bs4/&\\ |
michael@0 | 229 | /g |
michael@0 | 230 | s/^$bs2$dollar/$bs&/ |
michael@0 | 231 | s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g |
michael@0 | 232 | s/\n//g" |
michael@0 | 233 | |
michael@0 | 234 | # Standard options: |
michael@0 | 235 | opt_dry_run=false |
michael@0 | 236 | opt_help=false |
michael@0 | 237 | opt_quiet=false |
michael@0 | 238 | opt_verbose=false |
michael@0 | 239 | opt_warning=: |
michael@0 | 240 | |
michael@0 | 241 | # func_echo arg... |
michael@0 | 242 | # Echo program name prefixed message, along with the current mode |
michael@0 | 243 | # name if it has been set yet. |
michael@0 | 244 | func_echo () |
michael@0 | 245 | { |
michael@0 | 246 | $ECHO "$progname${mode+: }$mode: $*" |
michael@0 | 247 | } |
michael@0 | 248 | |
michael@0 | 249 | # func_verbose arg... |
michael@0 | 250 | # Echo program name prefixed message in verbose mode only. |
michael@0 | 251 | func_verbose () |
michael@0 | 252 | { |
michael@0 | 253 | $opt_verbose && func_echo ${1+"$@"} |
michael@0 | 254 | |
michael@0 | 255 | # A bug in bash halts the script if the last line of a function |
michael@0 | 256 | # fails when set -e is in force, so we need another command to |
michael@0 | 257 | # work around that: |
michael@0 | 258 | : |
michael@0 | 259 | } |
michael@0 | 260 | |
michael@0 | 261 | # func_error arg... |
michael@0 | 262 | # Echo program name prefixed message to standard error. |
michael@0 | 263 | func_error () |
michael@0 | 264 | { |
michael@0 | 265 | $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 |
michael@0 | 266 | } |
michael@0 | 267 | |
michael@0 | 268 | # func_warning arg... |
michael@0 | 269 | # Echo program name prefixed warning message to standard error. |
michael@0 | 270 | func_warning () |
michael@0 | 271 | { |
michael@0 | 272 | $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 |
michael@0 | 273 | |
michael@0 | 274 | # bash bug again: |
michael@0 | 275 | : |
michael@0 | 276 | } |
michael@0 | 277 | |
michael@0 | 278 | # func_fatal_error arg... |
michael@0 | 279 | # Echo program name prefixed message to standard error, and exit. |
michael@0 | 280 | func_fatal_error () |
michael@0 | 281 | { |
michael@0 | 282 | func_error ${1+"$@"} |
michael@0 | 283 | exit $EXIT_FAILURE |
michael@0 | 284 | } |
michael@0 | 285 | |
michael@0 | 286 | # func_fatal_help arg... |
michael@0 | 287 | # Echo program name prefixed message to standard error, followed by |
michael@0 | 288 | # a help hint, and exit. |
michael@0 | 289 | func_fatal_help () |
michael@0 | 290 | { |
michael@0 | 291 | func_error ${1+"$@"} |
michael@0 | 292 | func_fatal_error "$help" |
michael@0 | 293 | } |
michael@0 | 294 | help="Try \`$progname --help' for more information." ## default |
michael@0 | 295 | |
michael@0 | 296 | |
michael@0 | 297 | # func_grep expression filename |
michael@0 | 298 | # Check whether EXPRESSION matches any line of FILENAME, without output. |
michael@0 | 299 | func_grep () |
michael@0 | 300 | { |
michael@0 | 301 | $GREP "$1" "$2" >/dev/null 2>&1 |
michael@0 | 302 | } |
michael@0 | 303 | |
michael@0 | 304 | |
michael@0 | 305 | # func_mkdir_p directory-path |
michael@0 | 306 | # Make sure the entire path to DIRECTORY-PATH is available. |
michael@0 | 307 | func_mkdir_p () |
michael@0 | 308 | { |
michael@0 | 309 | my_directory_path="$1" |
michael@0 | 310 | my_dir_list= |
michael@0 | 311 | |
michael@0 | 312 | if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then |
michael@0 | 313 | |
michael@0 | 314 | # Protect directory names starting with `-' |
michael@0 | 315 | case $my_directory_path in |
michael@0 | 316 | -*) my_directory_path="./$my_directory_path" ;; |
michael@0 | 317 | esac |
michael@0 | 318 | |
michael@0 | 319 | # While some portion of DIR does not yet exist... |
michael@0 | 320 | while test ! -d "$my_directory_path"; do |
michael@0 | 321 | # ...make a list in topmost first order. Use a colon delimited |
michael@0 | 322 | # list incase some portion of path contains whitespace. |
michael@0 | 323 | my_dir_list="$my_directory_path:$my_dir_list" |
michael@0 | 324 | |
michael@0 | 325 | # If the last portion added has no slash in it, the list is done |
michael@0 | 326 | case $my_directory_path in */*) ;; *) break ;; esac |
michael@0 | 327 | |
michael@0 | 328 | # ...otherwise throw away the child directory and loop |
michael@0 | 329 | my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` |
michael@0 | 330 | done |
michael@0 | 331 | my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` |
michael@0 | 332 | |
michael@0 | 333 | save_mkdir_p_IFS="$IFS"; IFS=':' |
michael@0 | 334 | for my_dir in $my_dir_list; do |
michael@0 | 335 | IFS="$save_mkdir_p_IFS" |
michael@0 | 336 | # mkdir can fail with a `File exist' error if two processes |
michael@0 | 337 | # try to create one of the directories concurrently. Don't |
michael@0 | 338 | # stop in that case! |
michael@0 | 339 | $MKDIR "$my_dir" 2>/dev/null || : |
michael@0 | 340 | done |
michael@0 | 341 | IFS="$save_mkdir_p_IFS" |
michael@0 | 342 | |
michael@0 | 343 | # Bail out if we (or some other process) failed to create a directory. |
michael@0 | 344 | test -d "$my_directory_path" || \ |
michael@0 | 345 | func_fatal_error "Failed to create \`$1'" |
michael@0 | 346 | fi |
michael@0 | 347 | } |
michael@0 | 348 | |
michael@0 | 349 | |
michael@0 | 350 | # func_mktempdir [string] |
michael@0 | 351 | # Make a temporary directory that won't clash with other running |
michael@0 | 352 | # libtool processes, and avoids race conditions if possible. If |
michael@0 | 353 | # given, STRING is the basename for that directory. |
michael@0 | 354 | func_mktempdir () |
michael@0 | 355 | { |
michael@0 | 356 | my_template="${TMPDIR-/tmp}/${1-$progname}" |
michael@0 | 357 | |
michael@0 | 358 | if test "$opt_dry_run" = ":"; then |
michael@0 | 359 | # Return a directory name, but don't create it in dry-run mode |
michael@0 | 360 | my_tmpdir="${my_template}-$$" |
michael@0 | 361 | else |
michael@0 | 362 | |
michael@0 | 363 | # If mktemp works, use that first and foremost |
michael@0 | 364 | my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` |
michael@0 | 365 | |
michael@0 | 366 | if test ! -d "$my_tmpdir"; then |
michael@0 | 367 | # Failing that, at least try and use $RANDOM to avoid a race |
michael@0 | 368 | my_tmpdir="${my_template}-${RANDOM-0}$$" |
michael@0 | 369 | |
michael@0 | 370 | save_mktempdir_umask=`umask` |
michael@0 | 371 | umask 0077 |
michael@0 | 372 | $MKDIR "$my_tmpdir" |
michael@0 | 373 | umask $save_mktempdir_umask |
michael@0 | 374 | fi |
michael@0 | 375 | |
michael@0 | 376 | # If we're not in dry-run mode, bomb out on failure |
michael@0 | 377 | test -d "$my_tmpdir" || \ |
michael@0 | 378 | func_fatal_error "cannot create temporary directory \`$my_tmpdir'" |
michael@0 | 379 | fi |
michael@0 | 380 | |
michael@0 | 381 | $ECHO "X$my_tmpdir" | $Xsed |
michael@0 | 382 | } |
michael@0 | 383 | |
michael@0 | 384 | |
michael@0 | 385 | # func_quote_for_eval arg |
michael@0 | 386 | # Aesthetically quote ARG to be evaled later. |
michael@0 | 387 | # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT |
michael@0 | 388 | # is double-quoted, suitable for a subsequent eval, whereas |
michael@0 | 389 | # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters |
michael@0 | 390 | # which are still active within double quotes backslashified. |
michael@0 | 391 | func_quote_for_eval () |
michael@0 | 392 | { |
michael@0 | 393 | case $1 in |
michael@0 | 394 | *[\\\`\"\$]*) |
michael@0 | 395 | func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; |
michael@0 | 396 | *) |
michael@0 | 397 | func_quote_for_eval_unquoted_result="$1" ;; |
michael@0 | 398 | esac |
michael@0 | 399 | |
michael@0 | 400 | case $func_quote_for_eval_unquoted_result in |
michael@0 | 401 | # Double-quote args containing shell metacharacters to delay |
michael@0 | 402 | # word splitting, command substitution and and variable |
michael@0 | 403 | # expansion for a subsequent eval. |
michael@0 | 404 | # Many Bourne shells cannot handle close brackets correctly |
michael@0 | 405 | # in scan sets, so we specify it separately. |
michael@0 | 406 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
michael@0 | 407 | func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" |
michael@0 | 408 | ;; |
michael@0 | 409 | *) |
michael@0 | 410 | func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" |
michael@0 | 411 | esac |
michael@0 | 412 | } |
michael@0 | 413 | |
michael@0 | 414 | |
michael@0 | 415 | # func_quote_for_expand arg |
michael@0 | 416 | # Aesthetically quote ARG to be evaled later; same as above, |
michael@0 | 417 | # but do not quote variable references. |
michael@0 | 418 | func_quote_for_expand () |
michael@0 | 419 | { |
michael@0 | 420 | case $1 in |
michael@0 | 421 | *[\\\`\"]*) |
michael@0 | 422 | my_arg=`$ECHO "X$1" | $Xsed \ |
michael@0 | 423 | -e "$double_quote_subst" -e "$sed_double_backslash"` ;; |
michael@0 | 424 | *) |
michael@0 | 425 | my_arg="$1" ;; |
michael@0 | 426 | esac |
michael@0 | 427 | |
michael@0 | 428 | case $my_arg in |
michael@0 | 429 | # Double-quote args containing shell metacharacters to delay |
michael@0 | 430 | # word splitting and command substitution for a subsequent eval. |
michael@0 | 431 | # Many Bourne shells cannot handle close brackets correctly |
michael@0 | 432 | # in scan sets, so we specify it separately. |
michael@0 | 433 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") |
michael@0 | 434 | my_arg="\"$my_arg\"" |
michael@0 | 435 | ;; |
michael@0 | 436 | esac |
michael@0 | 437 | |
michael@0 | 438 | func_quote_for_expand_result="$my_arg" |
michael@0 | 439 | } |
michael@0 | 440 | |
michael@0 | 441 | |
michael@0 | 442 | # func_show_eval cmd [fail_exp] |
michael@0 | 443 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is |
michael@0 | 444 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
michael@0 | 445 | # is given, then evaluate it. |
michael@0 | 446 | func_show_eval () |
michael@0 | 447 | { |
michael@0 | 448 | my_cmd="$1" |
michael@0 | 449 | my_fail_exp="${2-:}" |
michael@0 | 450 | |
michael@0 | 451 | ${opt_silent-false} || { |
michael@0 | 452 | func_quote_for_expand "$my_cmd" |
michael@0 | 453 | eval "func_echo $func_quote_for_expand_result" |
michael@0 | 454 | } |
michael@0 | 455 | |
michael@0 | 456 | if ${opt_dry_run-false}; then :; else |
michael@0 | 457 | eval "$my_cmd" |
michael@0 | 458 | my_status=$? |
michael@0 | 459 | if test "$my_status" -eq 0; then :; else |
michael@0 | 460 | eval "(exit $my_status); $my_fail_exp" |
michael@0 | 461 | fi |
michael@0 | 462 | fi |
michael@0 | 463 | } |
michael@0 | 464 | |
michael@0 | 465 | |
michael@0 | 466 | # func_show_eval_locale cmd [fail_exp] |
michael@0 | 467 | # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is |
michael@0 | 468 | # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
michael@0 | 469 | # is given, then evaluate it. Use the saved locale for evaluation. |
michael@0 | 470 | func_show_eval_locale () |
michael@0 | 471 | { |
michael@0 | 472 | my_cmd="$1" |
michael@0 | 473 | my_fail_exp="${2-:}" |
michael@0 | 474 | |
michael@0 | 475 | ${opt_silent-false} || { |
michael@0 | 476 | func_quote_for_expand "$my_cmd" |
michael@0 | 477 | eval "func_echo $func_quote_for_expand_result" |
michael@0 | 478 | } |
michael@0 | 479 | |
michael@0 | 480 | if ${opt_dry_run-false}; then :; else |
michael@0 | 481 | eval "$lt_user_locale |
michael@0 | 482 | $my_cmd" |
michael@0 | 483 | my_status=$? |
michael@0 | 484 | eval "$lt_safe_locale" |
michael@0 | 485 | if test "$my_status" -eq 0; then :; else |
michael@0 | 486 | eval "(exit $my_status); $my_fail_exp" |
michael@0 | 487 | fi |
michael@0 | 488 | fi |
michael@0 | 489 | } |
michael@0 | 490 | |
michael@0 | 491 | |
michael@0 | 492 | |
michael@0 | 493 | |
michael@0 | 494 | |
michael@0 | 495 | # func_version |
michael@0 | 496 | # Echo version message to standard output and exit. |
michael@0 | 497 | func_version () |
michael@0 | 498 | { |
michael@0 | 499 | $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { |
michael@0 | 500 | s/^# // |
michael@0 | 501 | s/^# *$// |
michael@0 | 502 | s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ |
michael@0 | 503 | p |
michael@0 | 504 | }' < "$progpath" |
michael@0 | 505 | exit $? |
michael@0 | 506 | } |
michael@0 | 507 | |
michael@0 | 508 | # func_usage |
michael@0 | 509 | # Echo short help message to standard output and exit. |
michael@0 | 510 | func_usage () |
michael@0 | 511 | { |
michael@0 | 512 | $SED -n '/^# Usage:/,/# -h/ { |
michael@0 | 513 | s/^# // |
michael@0 | 514 | s/^# *$// |
michael@0 | 515 | s/\$progname/'$progname'/ |
michael@0 | 516 | p |
michael@0 | 517 | }' < "$progpath" |
michael@0 | 518 | $ECHO |
michael@0 | 519 | $ECHO "run \`$progname --help | more' for full usage" |
michael@0 | 520 | exit $? |
michael@0 | 521 | } |
michael@0 | 522 | |
michael@0 | 523 | # func_help |
michael@0 | 524 | # Echo long help message to standard output and exit. |
michael@0 | 525 | func_help () |
michael@0 | 526 | { |
michael@0 | 527 | $SED -n '/^# Usage:/,/# Report bugs to/ { |
michael@0 | 528 | s/^# // |
michael@0 | 529 | s/^# *$// |
michael@0 | 530 | s*\$progname*'$progname'* |
michael@0 | 531 | s*\$host*'"$host"'* |
michael@0 | 532 | s*\$SHELL*'"$SHELL"'* |
michael@0 | 533 | s*\$LTCC*'"$LTCC"'* |
michael@0 | 534 | s*\$LTCFLAGS*'"$LTCFLAGS"'* |
michael@0 | 535 | s*\$LD*'"$LD"'* |
michael@0 | 536 | s/\$with_gnu_ld/'"$with_gnu_ld"'/ |
michael@0 | 537 | s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ |
michael@0 | 538 | s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ |
michael@0 | 539 | p |
michael@0 | 540 | }' < "$progpath" |
michael@0 | 541 | exit $? |
michael@0 | 542 | } |
michael@0 | 543 | |
michael@0 | 544 | # func_missing_arg argname |
michael@0 | 545 | # Echo program name prefixed message to standard error and set global |
michael@0 | 546 | # exit_cmd. |
michael@0 | 547 | func_missing_arg () |
michael@0 | 548 | { |
michael@0 | 549 | func_error "missing argument for $1" |
michael@0 | 550 | exit_cmd=exit |
michael@0 | 551 | } |
michael@0 | 552 | |
michael@0 | 553 | exit_cmd=: |
michael@0 | 554 | |
michael@0 | 555 | |
michael@0 | 556 | |
michael@0 | 557 | |
michael@0 | 558 | |
michael@0 | 559 | # Check that we have a working $ECHO. |
michael@0 | 560 | if test "X$1" = X--no-reexec; then |
michael@0 | 561 | # Discard the --no-reexec flag, and continue. |
michael@0 | 562 | shift |
michael@0 | 563 | elif test "X$1" = X--fallback-echo; then |
michael@0 | 564 | # Avoid inline document here, it may be left over |
michael@0 | 565 | : |
michael@0 | 566 | elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then |
michael@0 | 567 | # Yippee, $ECHO works! |
michael@0 | 568 | : |
michael@0 | 569 | else |
michael@0 | 570 | # Restart under the correct shell, and then maybe $ECHO will work. |
michael@0 | 571 | exec $SHELL "$progpath" --no-reexec ${1+"$@"} |
michael@0 | 572 | fi |
michael@0 | 573 | |
michael@0 | 574 | if test "X$1" = X--fallback-echo; then |
michael@0 | 575 | # used as fallback echo |
michael@0 | 576 | shift |
michael@0 | 577 | cat <<EOF |
michael@0 | 578 | $* |
michael@0 | 579 | EOF |
michael@0 | 580 | exit $EXIT_SUCCESS |
michael@0 | 581 | fi |
michael@0 | 582 | |
michael@0 | 583 | magic="%%%MAGIC variable%%%" |
michael@0 | 584 | magic_exe="%%%MAGIC EXE variable%%%" |
michael@0 | 585 | |
michael@0 | 586 | # Global variables. |
michael@0 | 587 | # $mode is unset |
michael@0 | 588 | nonopt= |
michael@0 | 589 | execute_dlfiles= |
michael@0 | 590 | preserve_args= |
michael@0 | 591 | lo2o="s/\\.lo\$/.${objext}/" |
michael@0 | 592 | o2lo="s/\\.${objext}\$/.lo/" |
michael@0 | 593 | extracted_archives= |
michael@0 | 594 | extracted_serial=0 |
michael@0 | 595 | |
michael@0 | 596 | opt_dry_run=false |
michael@0 | 597 | opt_duplicate_deps=false |
michael@0 | 598 | opt_silent=false |
michael@0 | 599 | opt_debug=: |
michael@0 | 600 | |
michael@0 | 601 | # If this variable is set in any of the actions, the command in it |
michael@0 | 602 | # will be execed at the end. This prevents here-documents from being |
michael@0 | 603 | # left over by shells. |
michael@0 | 604 | exec_cmd= |
michael@0 | 605 | |
michael@0 | 606 | # func_fatal_configuration arg... |
michael@0 | 607 | # Echo program name prefixed message to standard error, followed by |
michael@0 | 608 | # a configuration failure hint, and exit. |
michael@0 | 609 | func_fatal_configuration () |
michael@0 | 610 | { |
michael@0 | 611 | func_error ${1+"$@"} |
michael@0 | 612 | func_error "See the $PACKAGE documentation for more information." |
michael@0 | 613 | func_fatal_error "Fatal configuration error." |
michael@0 | 614 | } |
michael@0 | 615 | |
michael@0 | 616 | |
michael@0 | 617 | # func_config |
michael@0 | 618 | # Display the configuration for all the tags in this script. |
michael@0 | 619 | func_config () |
michael@0 | 620 | { |
michael@0 | 621 | re_begincf='^# ### BEGIN LIBTOOL' |
michael@0 | 622 | re_endcf='^# ### END LIBTOOL' |
michael@0 | 623 | |
michael@0 | 624 | # Default configuration. |
michael@0 | 625 | $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" |
michael@0 | 626 | |
michael@0 | 627 | # Now print the configurations for the tags. |
michael@0 | 628 | for tagname in $taglist; do |
michael@0 | 629 | $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" |
michael@0 | 630 | done |
michael@0 | 631 | |
michael@0 | 632 | exit $? |
michael@0 | 633 | } |
michael@0 | 634 | |
michael@0 | 635 | # func_features |
michael@0 | 636 | # Display the features supported by this script. |
michael@0 | 637 | func_features () |
michael@0 | 638 | { |
michael@0 | 639 | $ECHO "host: $host" |
michael@0 | 640 | if test "$build_libtool_libs" = yes; then |
michael@0 | 641 | $ECHO "enable shared libraries" |
michael@0 | 642 | else |
michael@0 | 643 | $ECHO "disable shared libraries" |
michael@0 | 644 | fi |
michael@0 | 645 | if test "$build_old_libs" = yes; then |
michael@0 | 646 | $ECHO "enable static libraries" |
michael@0 | 647 | else |
michael@0 | 648 | $ECHO "disable static libraries" |
michael@0 | 649 | fi |
michael@0 | 650 | |
michael@0 | 651 | exit $? |
michael@0 | 652 | } |
michael@0 | 653 | |
michael@0 | 654 | # func_enable_tag tagname |
michael@0 | 655 | # Verify that TAGNAME is valid, and either flag an error and exit, or |
michael@0 | 656 | # enable the TAGNAME tag. We also add TAGNAME to the global $taglist |
michael@0 | 657 | # variable here. |
michael@0 | 658 | func_enable_tag () |
michael@0 | 659 | { |
michael@0 | 660 | # Global variable: |
michael@0 | 661 | tagname="$1" |
michael@0 | 662 | |
michael@0 | 663 | re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" |
michael@0 | 664 | re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" |
michael@0 | 665 | sed_extractcf="/$re_begincf/,/$re_endcf/p" |
michael@0 | 666 | |
michael@0 | 667 | # Validate tagname. |
michael@0 | 668 | case $tagname in |
michael@0 | 669 | *[!-_A-Za-z0-9,/]*) |
michael@0 | 670 | func_fatal_error "invalid tag name: $tagname" |
michael@0 | 671 | ;; |
michael@0 | 672 | esac |
michael@0 | 673 | |
michael@0 | 674 | # Don't test for the "default" C tag, as we know it's |
michael@0 | 675 | # there but not specially marked. |
michael@0 | 676 | case $tagname in |
michael@0 | 677 | CC) ;; |
michael@0 | 678 | *) |
michael@0 | 679 | if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then |
michael@0 | 680 | taglist="$taglist $tagname" |
michael@0 | 681 | |
michael@0 | 682 | # Evaluate the configuration. Be careful to quote the path |
michael@0 | 683 | # and the sed script, to avoid splitting on whitespace, but |
michael@0 | 684 | # also don't use non-portable quotes within backquotes within |
michael@0 | 685 | # quotes we have to do it in 2 steps: |
michael@0 | 686 | extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` |
michael@0 | 687 | eval "$extractedcf" |
michael@0 | 688 | else |
michael@0 | 689 | func_error "ignoring unknown tag $tagname" |
michael@0 | 690 | fi |
michael@0 | 691 | ;; |
michael@0 | 692 | esac |
michael@0 | 693 | } |
michael@0 | 694 | |
michael@0 | 695 | # Parse options once, thoroughly. This comes as soon as possible in |
michael@0 | 696 | # the script to make things like `libtool --version' happen quickly. |
michael@0 | 697 | { |
michael@0 | 698 | |
michael@0 | 699 | # Shorthand for --mode=foo, only valid as the first argument |
michael@0 | 700 | case $1 in |
michael@0 | 701 | clean|clea|cle|cl) |
michael@0 | 702 | shift; set dummy --mode clean ${1+"$@"}; shift |
michael@0 | 703 | ;; |
michael@0 | 704 | compile|compil|compi|comp|com|co|c) |
michael@0 | 705 | shift; set dummy --mode compile ${1+"$@"}; shift |
michael@0 | 706 | ;; |
michael@0 | 707 | execute|execut|execu|exec|exe|ex|e) |
michael@0 | 708 | shift; set dummy --mode execute ${1+"$@"}; shift |
michael@0 | 709 | ;; |
michael@0 | 710 | finish|finis|fini|fin|fi|f) |
michael@0 | 711 | shift; set dummy --mode finish ${1+"$@"}; shift |
michael@0 | 712 | ;; |
michael@0 | 713 | install|instal|insta|inst|ins|in|i) |
michael@0 | 714 | shift; set dummy --mode install ${1+"$@"}; shift |
michael@0 | 715 | ;; |
michael@0 | 716 | link|lin|li|l) |
michael@0 | 717 | shift; set dummy --mode link ${1+"$@"}; shift |
michael@0 | 718 | ;; |
michael@0 | 719 | uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) |
michael@0 | 720 | shift; set dummy --mode uninstall ${1+"$@"}; shift |
michael@0 | 721 | ;; |
michael@0 | 722 | esac |
michael@0 | 723 | |
michael@0 | 724 | # Parse non-mode specific arguments: |
michael@0 | 725 | while test "$#" -gt 0; do |
michael@0 | 726 | opt="$1" |
michael@0 | 727 | shift |
michael@0 | 728 | |
michael@0 | 729 | case $opt in |
michael@0 | 730 | --config) func_config ;; |
michael@0 | 731 | |
michael@0 | 732 | --debug) preserve_args="$preserve_args $opt" |
michael@0 | 733 | func_echo "enabling shell trace mode" |
michael@0 | 734 | opt_debug='set -x' |
michael@0 | 735 | $opt_debug |
michael@0 | 736 | ;; |
michael@0 | 737 | |
michael@0 | 738 | -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break |
michael@0 | 739 | execute_dlfiles="$execute_dlfiles $1" |
michael@0 | 740 | shift |
michael@0 | 741 | ;; |
michael@0 | 742 | |
michael@0 | 743 | --dry-run | -n) opt_dry_run=: ;; |
michael@0 | 744 | --features) func_features ;; |
michael@0 | 745 | --finish) mode="finish" ;; |
michael@0 | 746 | |
michael@0 | 747 | --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break |
michael@0 | 748 | case $1 in |
michael@0 | 749 | # Valid mode arguments: |
michael@0 | 750 | clean) ;; |
michael@0 | 751 | compile) ;; |
michael@0 | 752 | execute) ;; |
michael@0 | 753 | finish) ;; |
michael@0 | 754 | install) ;; |
michael@0 | 755 | link) ;; |
michael@0 | 756 | relink) ;; |
michael@0 | 757 | uninstall) ;; |
michael@0 | 758 | |
michael@0 | 759 | # Catch anything else as an error |
michael@0 | 760 | *) func_error "invalid argument for $opt" |
michael@0 | 761 | exit_cmd=exit |
michael@0 | 762 | break |
michael@0 | 763 | ;; |
michael@0 | 764 | esac |
michael@0 | 765 | |
michael@0 | 766 | mode="$1" |
michael@0 | 767 | shift |
michael@0 | 768 | ;; |
michael@0 | 769 | |
michael@0 | 770 | --preserve-dup-deps) |
michael@0 | 771 | opt_duplicate_deps=: ;; |
michael@0 | 772 | |
michael@0 | 773 | --quiet|--silent) preserve_args="$preserve_args $opt" |
michael@0 | 774 | opt_silent=: |
michael@0 | 775 | ;; |
michael@0 | 776 | |
michael@0 | 777 | --verbose| -v) preserve_args="$preserve_args $opt" |
michael@0 | 778 | opt_silent=false |
michael@0 | 779 | ;; |
michael@0 | 780 | |
michael@0 | 781 | --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break |
michael@0 | 782 | preserve_args="$preserve_args $opt $1" |
michael@0 | 783 | func_enable_tag "$1" # tagname is set here |
michael@0 | 784 | shift |
michael@0 | 785 | ;; |
michael@0 | 786 | |
michael@0 | 787 | # Separate optargs to long options: |
michael@0 | 788 | -dlopen=*|--mode=*|--tag=*) |
michael@0 | 789 | func_opt_split "$opt" |
michael@0 | 790 | set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} |
michael@0 | 791 | shift |
michael@0 | 792 | ;; |
michael@0 | 793 | |
michael@0 | 794 | -\?|-h) func_usage ;; |
michael@0 | 795 | --help) opt_help=: ;; |
michael@0 | 796 | --version) func_version ;; |
michael@0 | 797 | |
michael@0 | 798 | -*) func_fatal_help "unrecognized option \`$opt'" ;; |
michael@0 | 799 | |
michael@0 | 800 | *) nonopt="$opt" |
michael@0 | 801 | break |
michael@0 | 802 | ;; |
michael@0 | 803 | esac |
michael@0 | 804 | done |
michael@0 | 805 | |
michael@0 | 806 | |
michael@0 | 807 | case $host in |
michael@0 | 808 | *cygwin* | *mingw* | *pw32* | *cegcc*) |
michael@0 | 809 | # don't eliminate duplications in $postdeps and $predeps |
michael@0 | 810 | opt_duplicate_compiler_generated_deps=: |
michael@0 | 811 | ;; |
michael@0 | 812 | *) |
michael@0 | 813 | opt_duplicate_compiler_generated_deps=$opt_duplicate_deps |
michael@0 | 814 | ;; |
michael@0 | 815 | esac |
michael@0 | 816 | |
michael@0 | 817 | # Having warned about all mis-specified options, bail out if |
michael@0 | 818 | # anything was wrong. |
michael@0 | 819 | $exit_cmd $EXIT_FAILURE |
michael@0 | 820 | } |
michael@0 | 821 | |
michael@0 | 822 | # func_check_version_match |
michael@0 | 823 | # Ensure that we are using m4 macros, and libtool script from the same |
michael@0 | 824 | # release of libtool. |
michael@0 | 825 | func_check_version_match () |
michael@0 | 826 | { |
michael@0 | 827 | if test "$package_revision" != "$macro_revision"; then |
michael@0 | 828 | if test "$VERSION" != "$macro_version"; then |
michael@0 | 829 | if test -z "$macro_version"; then |
michael@0 | 830 | cat >&2 <<_LT_EOF |
michael@0 | 831 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
michael@0 | 832 | $progname: definition of this LT_INIT comes from an older release. |
michael@0 | 833 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
michael@0 | 834 | $progname: and run autoconf again. |
michael@0 | 835 | _LT_EOF |
michael@0 | 836 | else |
michael@0 | 837 | cat >&2 <<_LT_EOF |
michael@0 | 838 | $progname: Version mismatch error. This is $PACKAGE $VERSION, but the |
michael@0 | 839 | $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. |
michael@0 | 840 | $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION |
michael@0 | 841 | $progname: and run autoconf again. |
michael@0 | 842 | _LT_EOF |
michael@0 | 843 | fi |
michael@0 | 844 | else |
michael@0 | 845 | cat >&2 <<_LT_EOF |
michael@0 | 846 | $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, |
michael@0 | 847 | $progname: but the definition of this LT_INIT comes from revision $macro_revision. |
michael@0 | 848 | $progname: You should recreate aclocal.m4 with macros from revision $package_revision |
michael@0 | 849 | $progname: of $PACKAGE $VERSION and run autoconf again. |
michael@0 | 850 | _LT_EOF |
michael@0 | 851 | fi |
michael@0 | 852 | |
michael@0 | 853 | exit $EXIT_MISMATCH |
michael@0 | 854 | fi |
michael@0 | 855 | } |
michael@0 | 856 | |
michael@0 | 857 | |
michael@0 | 858 | ## ----------- ## |
michael@0 | 859 | ## Main. ## |
michael@0 | 860 | ## ----------- ## |
michael@0 | 861 | |
michael@0 | 862 | $opt_help || { |
michael@0 | 863 | # Sanity checks first: |
michael@0 | 864 | func_check_version_match |
michael@0 | 865 | |
michael@0 | 866 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
michael@0 | 867 | func_fatal_configuration "not configured to build any kind of library" |
michael@0 | 868 | fi |
michael@0 | 869 | |
michael@0 | 870 | test -z "$mode" && func_fatal_error "error: you must specify a MODE." |
michael@0 | 871 | |
michael@0 | 872 | |
michael@0 | 873 | # Darwin sucks |
michael@0 | 874 | eval std_shrext=\"$shrext_cmds\" |
michael@0 | 875 | |
michael@0 | 876 | |
michael@0 | 877 | # Only execute mode is allowed to have -dlopen flags. |
michael@0 | 878 | if test -n "$execute_dlfiles" && test "$mode" != execute; then |
michael@0 | 879 | func_error "unrecognized option \`-dlopen'" |
michael@0 | 880 | $ECHO "$help" 1>&2 |
michael@0 | 881 | exit $EXIT_FAILURE |
michael@0 | 882 | fi |
michael@0 | 883 | |
michael@0 | 884 | # Change the help message to a mode-specific one. |
michael@0 | 885 | generic_help="$help" |
michael@0 | 886 | help="Try \`$progname --help --mode=$mode' for more information." |
michael@0 | 887 | } |
michael@0 | 888 | |
michael@0 | 889 | |
michael@0 | 890 | # func_lalib_p file |
michael@0 | 891 | # True iff FILE is a libtool `.la' library or `.lo' object file. |
michael@0 | 892 | # This function is only a basic sanity check; it will hardly flush out |
michael@0 | 893 | # determined imposters. |
michael@0 | 894 | func_lalib_p () |
michael@0 | 895 | { |
michael@0 | 896 | test -f "$1" && |
michael@0 | 897 | $SED -e 4q "$1" 2>/dev/null \ |
michael@0 | 898 | | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 |
michael@0 | 899 | } |
michael@0 | 900 | |
michael@0 | 901 | # func_lalib_unsafe_p file |
michael@0 | 902 | # True iff FILE is a libtool `.la' library or `.lo' object file. |
michael@0 | 903 | # This function implements the same check as func_lalib_p without |
michael@0 | 904 | # resorting to external programs. To this end, it redirects stdin and |
michael@0 | 905 | # closes it afterwards, without saving the original file descriptor. |
michael@0 | 906 | # As a safety measure, use it only where a negative result would be |
michael@0 | 907 | # fatal anyway. Works if `file' does not exist. |
michael@0 | 908 | func_lalib_unsafe_p () |
michael@0 | 909 | { |
michael@0 | 910 | lalib_p=no |
michael@0 | 911 | if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then |
michael@0 | 912 | for lalib_p_l in 1 2 3 4 |
michael@0 | 913 | do |
michael@0 | 914 | read lalib_p_line |
michael@0 | 915 | case "$lalib_p_line" in |
michael@0 | 916 | \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; |
michael@0 | 917 | esac |
michael@0 | 918 | done |
michael@0 | 919 | exec 0<&5 5<&- |
michael@0 | 920 | fi |
michael@0 | 921 | test "$lalib_p" = yes |
michael@0 | 922 | } |
michael@0 | 923 | |
michael@0 | 924 | # func_ltwrapper_script_p file |
michael@0 | 925 | # True iff FILE is a libtool wrapper script |
michael@0 | 926 | # This function is only a basic sanity check; it will hardly flush out |
michael@0 | 927 | # determined imposters. |
michael@0 | 928 | func_ltwrapper_script_p () |
michael@0 | 929 | { |
michael@0 | 930 | func_lalib_p "$1" |
michael@0 | 931 | } |
michael@0 | 932 | |
michael@0 | 933 | # func_ltwrapper_executable_p file |
michael@0 | 934 | # True iff FILE is a libtool wrapper executable |
michael@0 | 935 | # This function is only a basic sanity check; it will hardly flush out |
michael@0 | 936 | # determined imposters. |
michael@0 | 937 | func_ltwrapper_executable_p () |
michael@0 | 938 | { |
michael@0 | 939 | func_ltwrapper_exec_suffix= |
michael@0 | 940 | case $1 in |
michael@0 | 941 | *.exe) ;; |
michael@0 | 942 | *) func_ltwrapper_exec_suffix=.exe ;; |
michael@0 | 943 | esac |
michael@0 | 944 | $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 |
michael@0 | 945 | } |
michael@0 | 946 | |
michael@0 | 947 | # func_ltwrapper_scriptname file |
michael@0 | 948 | # Assumes file is an ltwrapper_executable |
michael@0 | 949 | # uses $file to determine the appropriate filename for a |
michael@0 | 950 | # temporary ltwrapper_script. |
michael@0 | 951 | func_ltwrapper_scriptname () |
michael@0 | 952 | { |
michael@0 | 953 | func_ltwrapper_scriptname_result="" |
michael@0 | 954 | if func_ltwrapper_executable_p "$1"; then |
michael@0 | 955 | func_dirname_and_basename "$1" "" "." |
michael@0 | 956 | func_stripname '' '.exe' "$func_basename_result" |
michael@0 | 957 | func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" |
michael@0 | 958 | fi |
michael@0 | 959 | } |
michael@0 | 960 | |
michael@0 | 961 | # func_ltwrapper_p file |
michael@0 | 962 | # True iff FILE is a libtool wrapper script or wrapper executable |
michael@0 | 963 | # This function is only a basic sanity check; it will hardly flush out |
michael@0 | 964 | # determined imposters. |
michael@0 | 965 | func_ltwrapper_p () |
michael@0 | 966 | { |
michael@0 | 967 | func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" |
michael@0 | 968 | } |
michael@0 | 969 | |
michael@0 | 970 | |
michael@0 | 971 | # func_execute_cmds commands fail_cmd |
michael@0 | 972 | # Execute tilde-delimited COMMANDS. |
michael@0 | 973 | # If FAIL_CMD is given, eval that upon failure. |
michael@0 | 974 | # FAIL_CMD may read-access the current command in variable CMD! |
michael@0 | 975 | func_execute_cmds () |
michael@0 | 976 | { |
michael@0 | 977 | $opt_debug |
michael@0 | 978 | save_ifs=$IFS; IFS='~' |
michael@0 | 979 | for cmd in $1; do |
michael@0 | 980 | IFS=$save_ifs |
michael@0 | 981 | eval cmd=\"$cmd\" |
michael@0 | 982 | func_show_eval "$cmd" "${2-:}" |
michael@0 | 983 | done |
michael@0 | 984 | IFS=$save_ifs |
michael@0 | 985 | } |
michael@0 | 986 | |
michael@0 | 987 | |
michael@0 | 988 | # func_source file |
michael@0 | 989 | # Source FILE, adding directory component if necessary. |
michael@0 | 990 | # Note that it is not necessary on cygwin/mingw to append a dot to |
michael@0 | 991 | # FILE even if both FILE and FILE.exe exist: automatic-append-.exe |
michael@0 | 992 | # behavior happens only for exec(3), not for open(2)! Also, sourcing |
michael@0 | 993 | # `FILE.' does not work on cygwin managed mounts. |
michael@0 | 994 | func_source () |
michael@0 | 995 | { |
michael@0 | 996 | $opt_debug |
michael@0 | 997 | case $1 in |
michael@0 | 998 | */* | *\\*) . "$1" ;; |
michael@0 | 999 | *) . "./$1" ;; |
michael@0 | 1000 | esac |
michael@0 | 1001 | } |
michael@0 | 1002 | |
michael@0 | 1003 | |
michael@0 | 1004 | # func_infer_tag arg |
michael@0 | 1005 | # Infer tagged configuration to use if any are available and |
michael@0 | 1006 | # if one wasn't chosen via the "--tag" command line option. |
michael@0 | 1007 | # Only attempt this if the compiler in the base compile |
michael@0 | 1008 | # command doesn't match the default compiler. |
michael@0 | 1009 | # arg is usually of the form 'gcc ...' |
michael@0 | 1010 | func_infer_tag () |
michael@0 | 1011 | { |
michael@0 | 1012 | $opt_debug |
michael@0 | 1013 | if test -n "$available_tags" && test -z "$tagname"; then |
michael@0 | 1014 | CC_quoted= |
michael@0 | 1015 | for arg in $CC; do |
michael@0 | 1016 | func_quote_for_eval "$arg" |
michael@0 | 1017 | CC_quoted="$CC_quoted $func_quote_for_eval_result" |
michael@0 | 1018 | done |
michael@0 | 1019 | case $@ in |
michael@0 | 1020 | # Blanks in the command may have been stripped by the calling shell, |
michael@0 | 1021 | # but not from the CC environment variable when configure was run. |
michael@0 | 1022 | " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; |
michael@0 | 1023 | # Blanks at the start of $base_compile will cause this to fail |
michael@0 | 1024 | # if we don't check for them as well. |
michael@0 | 1025 | *) |
michael@0 | 1026 | for z in $available_tags; do |
michael@0 | 1027 | if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then |
michael@0 | 1028 | # Evaluate the configuration. |
michael@0 | 1029 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" |
michael@0 | 1030 | CC_quoted= |
michael@0 | 1031 | for arg in $CC; do |
michael@0 | 1032 | # Double-quote args containing other shell metacharacters. |
michael@0 | 1033 | func_quote_for_eval "$arg" |
michael@0 | 1034 | CC_quoted="$CC_quoted $func_quote_for_eval_result" |
michael@0 | 1035 | done |
michael@0 | 1036 | case "$@ " in |
michael@0 | 1037 | " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) |
michael@0 | 1038 | # The compiler in the base compile command matches |
michael@0 | 1039 | # the one in the tagged configuration. |
michael@0 | 1040 | # Assume this is the tagged configuration we want. |
michael@0 | 1041 | tagname=$z |
michael@0 | 1042 | break |
michael@0 | 1043 | ;; |
michael@0 | 1044 | esac |
michael@0 | 1045 | fi |
michael@0 | 1046 | done |
michael@0 | 1047 | # If $tagname still isn't set, then no tagged configuration |
michael@0 | 1048 | # was found and let the user know that the "--tag" command |
michael@0 | 1049 | # line option must be used. |
michael@0 | 1050 | if test -z "$tagname"; then |
michael@0 | 1051 | func_echo "unable to infer tagged configuration" |
michael@0 | 1052 | func_fatal_error "specify a tag with \`--tag'" |
michael@0 | 1053 | # else |
michael@0 | 1054 | # func_verbose "using $tagname tagged configuration" |
michael@0 | 1055 | fi |
michael@0 | 1056 | ;; |
michael@0 | 1057 | esac |
michael@0 | 1058 | fi |
michael@0 | 1059 | } |
michael@0 | 1060 | |
michael@0 | 1061 | |
michael@0 | 1062 | |
michael@0 | 1063 | # func_write_libtool_object output_name pic_name nonpic_name |
michael@0 | 1064 | # Create a libtool object file (analogous to a ".la" file), |
michael@0 | 1065 | # but don't create it if we're doing a dry run. |
michael@0 | 1066 | func_write_libtool_object () |
michael@0 | 1067 | { |
michael@0 | 1068 | write_libobj=${1} |
michael@0 | 1069 | if test "$build_libtool_libs" = yes; then |
michael@0 | 1070 | write_lobj=\'${2}\' |
michael@0 | 1071 | else |
michael@0 | 1072 | write_lobj=none |
michael@0 | 1073 | fi |
michael@0 | 1074 | |
michael@0 | 1075 | if test "$build_old_libs" = yes; then |
michael@0 | 1076 | write_oldobj=\'${3}\' |
michael@0 | 1077 | else |
michael@0 | 1078 | write_oldobj=none |
michael@0 | 1079 | fi |
michael@0 | 1080 | |
michael@0 | 1081 | $opt_dry_run || { |
michael@0 | 1082 | cat >${write_libobj}T <<EOF |
michael@0 | 1083 | # $write_libobj - a libtool object file |
michael@0 | 1084 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
michael@0 | 1085 | # |
michael@0 | 1086 | # Please DO NOT delete this file! |
michael@0 | 1087 | # It is necessary for linking the library. |
michael@0 | 1088 | |
michael@0 | 1089 | # Name of the PIC object. |
michael@0 | 1090 | pic_object=$write_lobj |
michael@0 | 1091 | |
michael@0 | 1092 | # Name of the non-PIC object |
michael@0 | 1093 | non_pic_object=$write_oldobj |
michael@0 | 1094 | |
michael@0 | 1095 | EOF |
michael@0 | 1096 | $MV "${write_libobj}T" "${write_libobj}" |
michael@0 | 1097 | } |
michael@0 | 1098 | } |
michael@0 | 1099 | |
michael@0 | 1100 | # func_mode_compile arg... |
michael@0 | 1101 | func_mode_compile () |
michael@0 | 1102 | { |
michael@0 | 1103 | $opt_debug |
michael@0 | 1104 | # Get the compilation command and the source file. |
michael@0 | 1105 | base_compile= |
michael@0 | 1106 | srcfile="$nonopt" # always keep a non-empty value in "srcfile" |
michael@0 | 1107 | suppress_opt=yes |
michael@0 | 1108 | suppress_output= |
michael@0 | 1109 | arg_mode=normal |
michael@0 | 1110 | libobj= |
michael@0 | 1111 | later= |
michael@0 | 1112 | pie_flag= |
michael@0 | 1113 | |
michael@0 | 1114 | for arg |
michael@0 | 1115 | do |
michael@0 | 1116 | case $arg_mode in |
michael@0 | 1117 | arg ) |
michael@0 | 1118 | # do not "continue". Instead, add this to base_compile |
michael@0 | 1119 | lastarg="$arg" |
michael@0 | 1120 | arg_mode=normal |
michael@0 | 1121 | ;; |
michael@0 | 1122 | |
michael@0 | 1123 | target ) |
michael@0 | 1124 | libobj="$arg" |
michael@0 | 1125 | arg_mode=normal |
michael@0 | 1126 | continue |
michael@0 | 1127 | ;; |
michael@0 | 1128 | |
michael@0 | 1129 | normal ) |
michael@0 | 1130 | # Accept any command-line options. |
michael@0 | 1131 | case $arg in |
michael@0 | 1132 | -o) |
michael@0 | 1133 | test -n "$libobj" && \ |
michael@0 | 1134 | func_fatal_error "you cannot specify \`-o' more than once" |
michael@0 | 1135 | arg_mode=target |
michael@0 | 1136 | continue |
michael@0 | 1137 | ;; |
michael@0 | 1138 | |
michael@0 | 1139 | -pie | -fpie | -fPIE) |
michael@0 | 1140 | pie_flag="$pie_flag $arg" |
michael@0 | 1141 | continue |
michael@0 | 1142 | ;; |
michael@0 | 1143 | |
michael@0 | 1144 | -shared | -static | -prefer-pic | -prefer-non-pic) |
michael@0 | 1145 | later="$later $arg" |
michael@0 | 1146 | continue |
michael@0 | 1147 | ;; |
michael@0 | 1148 | |
michael@0 | 1149 | -no-suppress) |
michael@0 | 1150 | suppress_opt=no |
michael@0 | 1151 | continue |
michael@0 | 1152 | ;; |
michael@0 | 1153 | |
michael@0 | 1154 | -Xcompiler) |
michael@0 | 1155 | arg_mode=arg # the next one goes into the "base_compile" arg list |
michael@0 | 1156 | continue # The current "srcfile" will either be retained or |
michael@0 | 1157 | ;; # replaced later. I would guess that would be a bug. |
michael@0 | 1158 | |
michael@0 | 1159 | -Wc,*) |
michael@0 | 1160 | func_stripname '-Wc,' '' "$arg" |
michael@0 | 1161 | args=$func_stripname_result |
michael@0 | 1162 | lastarg= |
michael@0 | 1163 | save_ifs="$IFS"; IFS=',' |
michael@0 | 1164 | for arg in $args; do |
michael@0 | 1165 | IFS="$save_ifs" |
michael@0 | 1166 | func_quote_for_eval "$arg" |
michael@0 | 1167 | lastarg="$lastarg $func_quote_for_eval_result" |
michael@0 | 1168 | done |
michael@0 | 1169 | IFS="$save_ifs" |
michael@0 | 1170 | func_stripname ' ' '' "$lastarg" |
michael@0 | 1171 | lastarg=$func_stripname_result |
michael@0 | 1172 | |
michael@0 | 1173 | # Add the arguments to base_compile. |
michael@0 | 1174 | base_compile="$base_compile $lastarg" |
michael@0 | 1175 | continue |
michael@0 | 1176 | ;; |
michael@0 | 1177 | |
michael@0 | 1178 | *) |
michael@0 | 1179 | # Accept the current argument as the source file. |
michael@0 | 1180 | # The previous "srcfile" becomes the current argument. |
michael@0 | 1181 | # |
michael@0 | 1182 | lastarg="$srcfile" |
michael@0 | 1183 | srcfile="$arg" |
michael@0 | 1184 | ;; |
michael@0 | 1185 | esac # case $arg |
michael@0 | 1186 | ;; |
michael@0 | 1187 | esac # case $arg_mode |
michael@0 | 1188 | |
michael@0 | 1189 | # Aesthetically quote the previous argument. |
michael@0 | 1190 | func_quote_for_eval "$lastarg" |
michael@0 | 1191 | base_compile="$base_compile $func_quote_for_eval_result" |
michael@0 | 1192 | done # for arg |
michael@0 | 1193 | |
michael@0 | 1194 | case $arg_mode in |
michael@0 | 1195 | arg) |
michael@0 | 1196 | func_fatal_error "you must specify an argument for -Xcompile" |
michael@0 | 1197 | ;; |
michael@0 | 1198 | target) |
michael@0 | 1199 | func_fatal_error "you must specify a target with \`-o'" |
michael@0 | 1200 | ;; |
michael@0 | 1201 | *) |
michael@0 | 1202 | # Get the name of the library object. |
michael@0 | 1203 | test -z "$libobj" && { |
michael@0 | 1204 | func_basename "$srcfile" |
michael@0 | 1205 | libobj="$func_basename_result" |
michael@0 | 1206 | } |
michael@0 | 1207 | ;; |
michael@0 | 1208 | esac |
michael@0 | 1209 | |
michael@0 | 1210 | # Recognize several different file suffixes. |
michael@0 | 1211 | # If the user specifies -o file.o, it is replaced with file.lo |
michael@0 | 1212 | case $libobj in |
michael@0 | 1213 | *.[cCFSifmso] | \ |
michael@0 | 1214 | *.ada | *.adb | *.ads | *.asm | \ |
michael@0 | 1215 | *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ |
michael@0 | 1216 | *.[fF][09]? | *.for | *.java | *.obj | *.sx) |
michael@0 | 1217 | func_xform "$libobj" |
michael@0 | 1218 | libobj=$func_xform_result |
michael@0 | 1219 | ;; |
michael@0 | 1220 | esac |
michael@0 | 1221 | |
michael@0 | 1222 | case $libobj in |
michael@0 | 1223 | *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; |
michael@0 | 1224 | *) |
michael@0 | 1225 | func_fatal_error "cannot determine name of library object from \`$libobj'" |
michael@0 | 1226 | ;; |
michael@0 | 1227 | esac |
michael@0 | 1228 | |
michael@0 | 1229 | func_infer_tag $base_compile |
michael@0 | 1230 | |
michael@0 | 1231 | for arg in $later; do |
michael@0 | 1232 | case $arg in |
michael@0 | 1233 | -shared) |
michael@0 | 1234 | test "$build_libtool_libs" != yes && \ |
michael@0 | 1235 | func_fatal_configuration "can not build a shared library" |
michael@0 | 1236 | build_old_libs=no |
michael@0 | 1237 | continue |
michael@0 | 1238 | ;; |
michael@0 | 1239 | |
michael@0 | 1240 | -static) |
michael@0 | 1241 | build_libtool_libs=no |
michael@0 | 1242 | build_old_libs=yes |
michael@0 | 1243 | continue |
michael@0 | 1244 | ;; |
michael@0 | 1245 | |
michael@0 | 1246 | -prefer-pic) |
michael@0 | 1247 | pic_mode=yes |
michael@0 | 1248 | continue |
michael@0 | 1249 | ;; |
michael@0 | 1250 | |
michael@0 | 1251 | -prefer-non-pic) |
michael@0 | 1252 | pic_mode=no |
michael@0 | 1253 | continue |
michael@0 | 1254 | ;; |
michael@0 | 1255 | esac |
michael@0 | 1256 | done |
michael@0 | 1257 | |
michael@0 | 1258 | func_quote_for_eval "$libobj" |
michael@0 | 1259 | test "X$libobj" != "X$func_quote_for_eval_result" \ |
michael@0 | 1260 | && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ |
michael@0 | 1261 | && func_warning "libobj name \`$libobj' may not contain shell special characters." |
michael@0 | 1262 | func_dirname_and_basename "$obj" "/" "" |
michael@0 | 1263 | objname="$func_basename_result" |
michael@0 | 1264 | xdir="$func_dirname_result" |
michael@0 | 1265 | lobj=${xdir}$objdir/$objname |
michael@0 | 1266 | |
michael@0 | 1267 | test -z "$base_compile" && \ |
michael@0 | 1268 | func_fatal_help "you must specify a compilation command" |
michael@0 | 1269 | |
michael@0 | 1270 | # Delete any leftover library objects. |
michael@0 | 1271 | if test "$build_old_libs" = yes; then |
michael@0 | 1272 | removelist="$obj $lobj $libobj ${libobj}T" |
michael@0 | 1273 | else |
michael@0 | 1274 | removelist="$lobj $libobj ${libobj}T" |
michael@0 | 1275 | fi |
michael@0 | 1276 | |
michael@0 | 1277 | # On Cygwin there's no "real" PIC flag so we must build both object types |
michael@0 | 1278 | case $host_os in |
michael@0 | 1279 | cygwin* | mingw* | pw32* | os2* | cegcc*) |
michael@0 | 1280 | pic_mode=default |
michael@0 | 1281 | ;; |
michael@0 | 1282 | esac |
michael@0 | 1283 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
michael@0 | 1284 | # non-PIC code in shared libraries is not supported |
michael@0 | 1285 | pic_mode=default |
michael@0 | 1286 | fi |
michael@0 | 1287 | |
michael@0 | 1288 | # Calculate the filename of the output object if compiler does |
michael@0 | 1289 | # not support -o with -c |
michael@0 | 1290 | if test "$compiler_c_o" = no; then |
michael@0 | 1291 | output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} |
michael@0 | 1292 | lockfile="$output_obj.lock" |
michael@0 | 1293 | else |
michael@0 | 1294 | output_obj= |
michael@0 | 1295 | need_locks=no |
michael@0 | 1296 | lockfile= |
michael@0 | 1297 | fi |
michael@0 | 1298 | |
michael@0 | 1299 | # Lock this critical section if it is needed |
michael@0 | 1300 | # We use this script file to make the link, it avoids creating a new file |
michael@0 | 1301 | if test "$need_locks" = yes; then |
michael@0 | 1302 | until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do |
michael@0 | 1303 | func_echo "Waiting for $lockfile to be removed" |
michael@0 | 1304 | sleep 2 |
michael@0 | 1305 | done |
michael@0 | 1306 | elif test "$need_locks" = warn; then |
michael@0 | 1307 | if test -f "$lockfile"; then |
michael@0 | 1308 | $ECHO "\ |
michael@0 | 1309 | *** ERROR, $lockfile exists and contains: |
michael@0 | 1310 | `cat $lockfile 2>/dev/null` |
michael@0 | 1311 | |
michael@0 | 1312 | This indicates that another process is trying to use the same |
michael@0 | 1313 | temporary object file, and libtool could not work around it because |
michael@0 | 1314 | your compiler does not support \`-c' and \`-o' together. If you |
michael@0 | 1315 | repeat this compilation, it may succeed, by chance, but you had better |
michael@0 | 1316 | avoid parallel builds (make -j) in this platform, or get a better |
michael@0 | 1317 | compiler." |
michael@0 | 1318 | |
michael@0 | 1319 | $opt_dry_run || $RM $removelist |
michael@0 | 1320 | exit $EXIT_FAILURE |
michael@0 | 1321 | fi |
michael@0 | 1322 | removelist="$removelist $output_obj" |
michael@0 | 1323 | $ECHO "$srcfile" > "$lockfile" |
michael@0 | 1324 | fi |
michael@0 | 1325 | |
michael@0 | 1326 | $opt_dry_run || $RM $removelist |
michael@0 | 1327 | removelist="$removelist $lockfile" |
michael@0 | 1328 | trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 |
michael@0 | 1329 | |
michael@0 | 1330 | if test -n "$fix_srcfile_path"; then |
michael@0 | 1331 | eval srcfile=\"$fix_srcfile_path\" |
michael@0 | 1332 | fi |
michael@0 | 1333 | func_quote_for_eval "$srcfile" |
michael@0 | 1334 | qsrcfile=$func_quote_for_eval_result |
michael@0 | 1335 | |
michael@0 | 1336 | # Only build a PIC object if we are building libtool libraries. |
michael@0 | 1337 | if test "$build_libtool_libs" = yes; then |
michael@0 | 1338 | # Without this assignment, base_compile gets emptied. |
michael@0 | 1339 | fbsd_hideous_sh_bug=$base_compile |
michael@0 | 1340 | |
michael@0 | 1341 | if test "$pic_mode" != no; then |
michael@0 | 1342 | command="$base_compile $qsrcfile $pic_flag" |
michael@0 | 1343 | else |
michael@0 | 1344 | # Don't build PIC code |
michael@0 | 1345 | command="$base_compile $qsrcfile" |
michael@0 | 1346 | fi |
michael@0 | 1347 | |
michael@0 | 1348 | func_mkdir_p "$xdir$objdir" |
michael@0 | 1349 | |
michael@0 | 1350 | if test -z "$output_obj"; then |
michael@0 | 1351 | # Place PIC objects in $objdir |
michael@0 | 1352 | command="$command -o $lobj" |
michael@0 | 1353 | fi |
michael@0 | 1354 | |
michael@0 | 1355 | func_show_eval_locale "$command" \ |
michael@0 | 1356 | 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' |
michael@0 | 1357 | |
michael@0 | 1358 | if test "$need_locks" = warn && |
michael@0 | 1359 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
michael@0 | 1360 | $ECHO "\ |
michael@0 | 1361 | *** ERROR, $lockfile contains: |
michael@0 | 1362 | `cat $lockfile 2>/dev/null` |
michael@0 | 1363 | |
michael@0 | 1364 | but it should contain: |
michael@0 | 1365 | $srcfile |
michael@0 | 1366 | |
michael@0 | 1367 | This indicates that another process is trying to use the same |
michael@0 | 1368 | temporary object file, and libtool could not work around it because |
michael@0 | 1369 | your compiler does not support \`-c' and \`-o' together. If you |
michael@0 | 1370 | repeat this compilation, it may succeed, by chance, but you had better |
michael@0 | 1371 | avoid parallel builds (make -j) in this platform, or get a better |
michael@0 | 1372 | compiler." |
michael@0 | 1373 | |
michael@0 | 1374 | $opt_dry_run || $RM $removelist |
michael@0 | 1375 | exit $EXIT_FAILURE |
michael@0 | 1376 | fi |
michael@0 | 1377 | |
michael@0 | 1378 | # Just move the object if needed, then go on to compile the next one |
michael@0 | 1379 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
michael@0 | 1380 | func_show_eval '$MV "$output_obj" "$lobj"' \ |
michael@0 | 1381 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
michael@0 | 1382 | fi |
michael@0 | 1383 | |
michael@0 | 1384 | # Allow error messages only from the first compilation. |
michael@0 | 1385 | if test "$suppress_opt" = yes; then |
michael@0 | 1386 | suppress_output=' >/dev/null 2>&1' |
michael@0 | 1387 | fi |
michael@0 | 1388 | fi |
michael@0 | 1389 | |
michael@0 | 1390 | # Only build a position-dependent object if we build old libraries. |
michael@0 | 1391 | if test "$build_old_libs" = yes; then |
michael@0 | 1392 | if test "$pic_mode" != yes; then |
michael@0 | 1393 | # Don't build PIC code |
michael@0 | 1394 | command="$base_compile $qsrcfile$pie_flag" |
michael@0 | 1395 | else |
michael@0 | 1396 | command="$base_compile $qsrcfile $pic_flag" |
michael@0 | 1397 | fi |
michael@0 | 1398 | if test "$compiler_c_o" = yes; then |
michael@0 | 1399 | command="$command -o $obj" |
michael@0 | 1400 | fi |
michael@0 | 1401 | |
michael@0 | 1402 | # Suppress compiler output if we already did a PIC compilation. |
michael@0 | 1403 | command="$command$suppress_output" |
michael@0 | 1404 | func_show_eval_locale "$command" \ |
michael@0 | 1405 | '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' |
michael@0 | 1406 | |
michael@0 | 1407 | if test "$need_locks" = warn && |
michael@0 | 1408 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
michael@0 | 1409 | $ECHO "\ |
michael@0 | 1410 | *** ERROR, $lockfile contains: |
michael@0 | 1411 | `cat $lockfile 2>/dev/null` |
michael@0 | 1412 | |
michael@0 | 1413 | but it should contain: |
michael@0 | 1414 | $srcfile |
michael@0 | 1415 | |
michael@0 | 1416 | This indicates that another process is trying to use the same |
michael@0 | 1417 | temporary object file, and libtool could not work around it because |
michael@0 | 1418 | your compiler does not support \`-c' and \`-o' together. If you |
michael@0 | 1419 | repeat this compilation, it may succeed, by chance, but you had better |
michael@0 | 1420 | avoid parallel builds (make -j) in this platform, or get a better |
michael@0 | 1421 | compiler." |
michael@0 | 1422 | |
michael@0 | 1423 | $opt_dry_run || $RM $removelist |
michael@0 | 1424 | exit $EXIT_FAILURE |
michael@0 | 1425 | fi |
michael@0 | 1426 | |
michael@0 | 1427 | # Just move the object if needed |
michael@0 | 1428 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
michael@0 | 1429 | func_show_eval '$MV "$output_obj" "$obj"' \ |
michael@0 | 1430 | 'error=$?; $opt_dry_run || $RM $removelist; exit $error' |
michael@0 | 1431 | fi |
michael@0 | 1432 | fi |
michael@0 | 1433 | |
michael@0 | 1434 | $opt_dry_run || { |
michael@0 | 1435 | func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" |
michael@0 | 1436 | |
michael@0 | 1437 | # Unlock the critical section if it was locked |
michael@0 | 1438 | if test "$need_locks" != no; then |
michael@0 | 1439 | removelist=$lockfile |
michael@0 | 1440 | $RM "$lockfile" |
michael@0 | 1441 | fi |
michael@0 | 1442 | } |
michael@0 | 1443 | |
michael@0 | 1444 | exit $EXIT_SUCCESS |
michael@0 | 1445 | } |
michael@0 | 1446 | |
michael@0 | 1447 | $opt_help || { |
michael@0 | 1448 | test "$mode" = compile && func_mode_compile ${1+"$@"} |
michael@0 | 1449 | } |
michael@0 | 1450 | |
michael@0 | 1451 | func_mode_help () |
michael@0 | 1452 | { |
michael@0 | 1453 | # We need to display help for each of the modes. |
michael@0 | 1454 | case $mode in |
michael@0 | 1455 | "") |
michael@0 | 1456 | # Generic help is extracted from the usage comments |
michael@0 | 1457 | # at the start of this file. |
michael@0 | 1458 | func_help |
michael@0 | 1459 | ;; |
michael@0 | 1460 | |
michael@0 | 1461 | clean) |
michael@0 | 1462 | $ECHO \ |
michael@0 | 1463 | "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... |
michael@0 | 1464 | |
michael@0 | 1465 | Remove files from the build directory. |
michael@0 | 1466 | |
michael@0 | 1467 | RM is the name of the program to use to delete files associated with each FILE |
michael@0 | 1468 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
michael@0 | 1469 | to RM. |
michael@0 | 1470 | |
michael@0 | 1471 | If FILE is a libtool library, object or program, all the files associated |
michael@0 | 1472 | with it are deleted. Otherwise, only FILE itself is deleted using RM." |
michael@0 | 1473 | ;; |
michael@0 | 1474 | |
michael@0 | 1475 | compile) |
michael@0 | 1476 | $ECHO \ |
michael@0 | 1477 | "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE |
michael@0 | 1478 | |
michael@0 | 1479 | Compile a source file into a libtool library object. |
michael@0 | 1480 | |
michael@0 | 1481 | This mode accepts the following additional options: |
michael@0 | 1482 | |
michael@0 | 1483 | -o OUTPUT-FILE set the output file name to OUTPUT-FILE |
michael@0 | 1484 | -no-suppress do not suppress compiler output for multiple passes |
michael@0 | 1485 | -prefer-pic try to building PIC objects only |
michael@0 | 1486 | -prefer-non-pic try to building non-PIC objects only |
michael@0 | 1487 | -shared do not build a \`.o' file suitable for static linking |
michael@0 | 1488 | -static only build a \`.o' file suitable for static linking |
michael@0 | 1489 | |
michael@0 | 1490 | COMPILE-COMMAND is a command to be used in creating a \`standard' object file |
michael@0 | 1491 | from the given SOURCEFILE. |
michael@0 | 1492 | |
michael@0 | 1493 | The output file name is determined by removing the directory component from |
michael@0 | 1494 | SOURCEFILE, then substituting the C source code suffix \`.c' with the |
michael@0 | 1495 | library object suffix, \`.lo'." |
michael@0 | 1496 | ;; |
michael@0 | 1497 | |
michael@0 | 1498 | execute) |
michael@0 | 1499 | $ECHO \ |
michael@0 | 1500 | "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... |
michael@0 | 1501 | |
michael@0 | 1502 | Automatically set library path, then run a program. |
michael@0 | 1503 | |
michael@0 | 1504 | This mode accepts the following additional options: |
michael@0 | 1505 | |
michael@0 | 1506 | -dlopen FILE add the directory containing FILE to the library path |
michael@0 | 1507 | |
michael@0 | 1508 | This mode sets the library path environment variable according to \`-dlopen' |
michael@0 | 1509 | flags. |
michael@0 | 1510 | |
michael@0 | 1511 | If any of the ARGS are libtool executable wrappers, then they are translated |
michael@0 | 1512 | into their corresponding uninstalled binary, and any of their required library |
michael@0 | 1513 | directories are added to the library path. |
michael@0 | 1514 | |
michael@0 | 1515 | Then, COMMAND is executed, with ARGS as arguments." |
michael@0 | 1516 | ;; |
michael@0 | 1517 | |
michael@0 | 1518 | finish) |
michael@0 | 1519 | $ECHO \ |
michael@0 | 1520 | "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... |
michael@0 | 1521 | |
michael@0 | 1522 | Complete the installation of libtool libraries. |
michael@0 | 1523 | |
michael@0 | 1524 | Each LIBDIR is a directory that contains libtool libraries. |
michael@0 | 1525 | |
michael@0 | 1526 | The commands that this mode executes may require superuser privileges. Use |
michael@0 | 1527 | the \`--dry-run' option if you just want to see what would be executed." |
michael@0 | 1528 | ;; |
michael@0 | 1529 | |
michael@0 | 1530 | install) |
michael@0 | 1531 | $ECHO \ |
michael@0 | 1532 | "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... |
michael@0 | 1533 | |
michael@0 | 1534 | Install executables or libraries. |
michael@0 | 1535 | |
michael@0 | 1536 | INSTALL-COMMAND is the installation command. The first component should be |
michael@0 | 1537 | either the \`install' or \`cp' program. |
michael@0 | 1538 | |
michael@0 | 1539 | The following components of INSTALL-COMMAND are treated specially: |
michael@0 | 1540 | |
michael@0 | 1541 | -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation |
michael@0 | 1542 | |
michael@0 | 1543 | The rest of the components are interpreted as arguments to that command (only |
michael@0 | 1544 | BSD-compatible install options are recognized)." |
michael@0 | 1545 | ;; |
michael@0 | 1546 | |
michael@0 | 1547 | link) |
michael@0 | 1548 | $ECHO \ |
michael@0 | 1549 | "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... |
michael@0 | 1550 | |
michael@0 | 1551 | Link object files or libraries together to form another library, or to |
michael@0 | 1552 | create an executable program. |
michael@0 | 1553 | |
michael@0 | 1554 | LINK-COMMAND is a command using the C compiler that you would use to create |
michael@0 | 1555 | a program from several object files. |
michael@0 | 1556 | |
michael@0 | 1557 | The following components of LINK-COMMAND are treated specially: |
michael@0 | 1558 | |
michael@0 | 1559 | -all-static do not do any dynamic linking at all |
michael@0 | 1560 | -avoid-version do not add a version suffix if possible |
michael@0 | 1561 | -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime |
michael@0 | 1562 | -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols |
michael@0 | 1563 | -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) |
michael@0 | 1564 | -export-symbols SYMFILE |
michael@0 | 1565 | try to export only the symbols listed in SYMFILE |
michael@0 | 1566 | -export-symbols-regex REGEX |
michael@0 | 1567 | try to export only the symbols matching REGEX |
michael@0 | 1568 | -LLIBDIR search LIBDIR for required installed libraries |
michael@0 | 1569 | -lNAME OUTPUT-FILE requires the installed library libNAME |
michael@0 | 1570 | -module build a library that can dlopened |
michael@0 | 1571 | -no-fast-install disable the fast-install mode |
michael@0 | 1572 | -no-install link a not-installable executable |
michael@0 | 1573 | -no-undefined declare that a library does not refer to external symbols |
michael@0 | 1574 | -o OUTPUT-FILE create OUTPUT-FILE from the specified objects |
michael@0 | 1575 | -objectlist FILE Use a list of object files found in FILE to specify objects |
michael@0 | 1576 | -precious-files-regex REGEX |
michael@0 | 1577 | don't remove output files matching REGEX |
michael@0 | 1578 | -release RELEASE specify package release information |
michael@0 | 1579 | -rpath LIBDIR the created library will eventually be installed in LIBDIR |
michael@0 | 1580 | -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries |
michael@0 | 1581 | -shared only do dynamic linking of libtool libraries |
michael@0 | 1582 | -shrext SUFFIX override the standard shared library file extension |
michael@0 | 1583 | -static do not do any dynamic linking of uninstalled libtool libraries |
michael@0 | 1584 | -static-libtool-libs |
michael@0 | 1585 | do not do any dynamic linking of libtool libraries |
michael@0 | 1586 | -version-info CURRENT[:REVISION[:AGE]] |
michael@0 | 1587 | specify library version info [each variable defaults to 0] |
michael@0 | 1588 | -weak LIBNAME declare that the target provides the LIBNAME interface |
michael@0 | 1589 | |
michael@0 | 1590 | All other options (arguments beginning with \`-') are ignored. |
michael@0 | 1591 | |
michael@0 | 1592 | Every other argument is treated as a filename. Files ending in \`.la' are |
michael@0 | 1593 | treated as uninstalled libtool libraries, other files are standard or library |
michael@0 | 1594 | object files. |
michael@0 | 1595 | |
michael@0 | 1596 | If the OUTPUT-FILE ends in \`.la', then a libtool library is created, |
michael@0 | 1597 | only library objects (\`.lo' files) may be specified, and \`-rpath' is |
michael@0 | 1598 | required, except when creating a convenience library. |
michael@0 | 1599 | |
michael@0 | 1600 | If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created |
michael@0 | 1601 | using \`ar' and \`ranlib', or on Windows using \`lib'. |
michael@0 | 1602 | |
michael@0 | 1603 | If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file |
michael@0 | 1604 | is created, otherwise an executable program is created." |
michael@0 | 1605 | ;; |
michael@0 | 1606 | |
michael@0 | 1607 | uninstall) |
michael@0 | 1608 | $ECHO \ |
michael@0 | 1609 | "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... |
michael@0 | 1610 | |
michael@0 | 1611 | Remove libraries from an installation directory. |
michael@0 | 1612 | |
michael@0 | 1613 | RM is the name of the program to use to delete files associated with each FILE |
michael@0 | 1614 | (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed |
michael@0 | 1615 | to RM. |
michael@0 | 1616 | |
michael@0 | 1617 | If FILE is a libtool library, all the files associated with it are deleted. |
michael@0 | 1618 | Otherwise, only FILE itself is deleted using RM." |
michael@0 | 1619 | ;; |
michael@0 | 1620 | |
michael@0 | 1621 | *) |
michael@0 | 1622 | func_fatal_help "invalid operation mode \`$mode'" |
michael@0 | 1623 | ;; |
michael@0 | 1624 | esac |
michael@0 | 1625 | |
michael@0 | 1626 | $ECHO |
michael@0 | 1627 | $ECHO "Try \`$progname --help' for more information about other modes." |
michael@0 | 1628 | |
michael@0 | 1629 | exit $? |
michael@0 | 1630 | } |
michael@0 | 1631 | |
michael@0 | 1632 | # Now that we've collected a possible --mode arg, show help if necessary |
michael@0 | 1633 | $opt_help && func_mode_help |
michael@0 | 1634 | |
michael@0 | 1635 | |
michael@0 | 1636 | # func_mode_execute arg... |
michael@0 | 1637 | func_mode_execute () |
michael@0 | 1638 | { |
michael@0 | 1639 | $opt_debug |
michael@0 | 1640 | # The first argument is the command name. |
michael@0 | 1641 | cmd="$nonopt" |
michael@0 | 1642 | test -z "$cmd" && \ |
michael@0 | 1643 | func_fatal_help "you must specify a COMMAND" |
michael@0 | 1644 | |
michael@0 | 1645 | # Handle -dlopen flags immediately. |
michael@0 | 1646 | for file in $execute_dlfiles; do |
michael@0 | 1647 | test -f "$file" \ |
michael@0 | 1648 | || func_fatal_help "\`$file' is not a file" |
michael@0 | 1649 | |
michael@0 | 1650 | dir= |
michael@0 | 1651 | case $file in |
michael@0 | 1652 | *.la) |
michael@0 | 1653 | # Check to see that this really is a libtool archive. |
michael@0 | 1654 | func_lalib_unsafe_p "$file" \ |
michael@0 | 1655 | || func_fatal_help "\`$lib' is not a valid libtool archive" |
michael@0 | 1656 | |
michael@0 | 1657 | # Read the libtool library. |
michael@0 | 1658 | dlname= |
michael@0 | 1659 | library_names= |
michael@0 | 1660 | func_source "$file" |
michael@0 | 1661 | |
michael@0 | 1662 | # Skip this library if it cannot be dlopened. |
michael@0 | 1663 | if test -z "$dlname"; then |
michael@0 | 1664 | # Warn if it was a shared library. |
michael@0 | 1665 | test -n "$library_names" && \ |
michael@0 | 1666 | func_warning "\`$file' was not linked with \`-export-dynamic'" |
michael@0 | 1667 | continue |
michael@0 | 1668 | fi |
michael@0 | 1669 | |
michael@0 | 1670 | func_dirname "$file" "" "." |
michael@0 | 1671 | dir="$func_dirname_result" |
michael@0 | 1672 | |
michael@0 | 1673 | if test -f "$dir/$objdir/$dlname"; then |
michael@0 | 1674 | dir="$dir/$objdir" |
michael@0 | 1675 | else |
michael@0 | 1676 | if test ! -f "$dir/$dlname"; then |
michael@0 | 1677 | func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" |
michael@0 | 1678 | fi |
michael@0 | 1679 | fi |
michael@0 | 1680 | ;; |
michael@0 | 1681 | |
michael@0 | 1682 | *.lo) |
michael@0 | 1683 | # Just add the directory containing the .lo file. |
michael@0 | 1684 | func_dirname "$file" "" "." |
michael@0 | 1685 | dir="$func_dirname_result" |
michael@0 | 1686 | ;; |
michael@0 | 1687 | |
michael@0 | 1688 | *) |
michael@0 | 1689 | func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" |
michael@0 | 1690 | continue |
michael@0 | 1691 | ;; |
michael@0 | 1692 | esac |
michael@0 | 1693 | |
michael@0 | 1694 | # Get the absolute pathname. |
michael@0 | 1695 | absdir=`cd "$dir" && pwd` |
michael@0 | 1696 | test -n "$absdir" && dir="$absdir" |
michael@0 | 1697 | |
michael@0 | 1698 | # Now add the directory to shlibpath_var. |
michael@0 | 1699 | if eval "test -z \"\$$shlibpath_var\""; then |
michael@0 | 1700 | eval "$shlibpath_var=\"\$dir\"" |
michael@0 | 1701 | else |
michael@0 | 1702 | eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" |
michael@0 | 1703 | fi |
michael@0 | 1704 | done |
michael@0 | 1705 | |
michael@0 | 1706 | # This variable tells wrapper scripts just to set shlibpath_var |
michael@0 | 1707 | # rather than running their programs. |
michael@0 | 1708 | libtool_execute_magic="$magic" |
michael@0 | 1709 | |
michael@0 | 1710 | # Check if any of the arguments is a wrapper script. |
michael@0 | 1711 | args= |
michael@0 | 1712 | for file |
michael@0 | 1713 | do |
michael@0 | 1714 | case $file in |
michael@0 | 1715 | -*) ;; |
michael@0 | 1716 | *) |
michael@0 | 1717 | # Do a test to see if this is really a libtool program. |
michael@0 | 1718 | if func_ltwrapper_script_p "$file"; then |
michael@0 | 1719 | func_source "$file" |
michael@0 | 1720 | # Transform arg to wrapped name. |
michael@0 | 1721 | file="$progdir/$program" |
michael@0 | 1722 | elif func_ltwrapper_executable_p "$file"; then |
michael@0 | 1723 | func_ltwrapper_scriptname "$file" |
michael@0 | 1724 | func_source "$func_ltwrapper_scriptname_result" |
michael@0 | 1725 | # Transform arg to wrapped name. |
michael@0 | 1726 | file="$progdir/$program" |
michael@0 | 1727 | fi |
michael@0 | 1728 | ;; |
michael@0 | 1729 | esac |
michael@0 | 1730 | # Quote arguments (to preserve shell metacharacters). |
michael@0 | 1731 | func_quote_for_eval "$file" |
michael@0 | 1732 | args="$args $func_quote_for_eval_result" |
michael@0 | 1733 | done |
michael@0 | 1734 | |
michael@0 | 1735 | if test "X$opt_dry_run" = Xfalse; then |
michael@0 | 1736 | if test -n "$shlibpath_var"; then |
michael@0 | 1737 | # Export the shlibpath_var. |
michael@0 | 1738 | eval "export $shlibpath_var" |
michael@0 | 1739 | fi |
michael@0 | 1740 | |
michael@0 | 1741 | # Restore saved environment variables |
michael@0 | 1742 | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
michael@0 | 1743 | do |
michael@0 | 1744 | eval "if test \"\${save_$lt_var+set}\" = set; then |
michael@0 | 1745 | $lt_var=\$save_$lt_var; export $lt_var |
michael@0 | 1746 | else |
michael@0 | 1747 | $lt_unset $lt_var |
michael@0 | 1748 | fi" |
michael@0 | 1749 | done |
michael@0 | 1750 | |
michael@0 | 1751 | # Now prepare to actually exec the command. |
michael@0 | 1752 | exec_cmd="\$cmd$args" |
michael@0 | 1753 | else |
michael@0 | 1754 | # Display what would be done. |
michael@0 | 1755 | if test -n "$shlibpath_var"; then |
michael@0 | 1756 | eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" |
michael@0 | 1757 | $ECHO "export $shlibpath_var" |
michael@0 | 1758 | fi |
michael@0 | 1759 | $ECHO "$cmd$args" |
michael@0 | 1760 | exit $EXIT_SUCCESS |
michael@0 | 1761 | fi |
michael@0 | 1762 | } |
michael@0 | 1763 | |
michael@0 | 1764 | test "$mode" = execute && func_mode_execute ${1+"$@"} |
michael@0 | 1765 | |
michael@0 | 1766 | |
michael@0 | 1767 | # func_mode_finish arg... |
michael@0 | 1768 | func_mode_finish () |
michael@0 | 1769 | { |
michael@0 | 1770 | $opt_debug |
michael@0 | 1771 | libdirs="$nonopt" |
michael@0 | 1772 | admincmds= |
michael@0 | 1773 | |
michael@0 | 1774 | if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then |
michael@0 | 1775 | for dir |
michael@0 | 1776 | do |
michael@0 | 1777 | libdirs="$libdirs $dir" |
michael@0 | 1778 | done |
michael@0 | 1779 | |
michael@0 | 1780 | for libdir in $libdirs; do |
michael@0 | 1781 | if test -n "$finish_cmds"; then |
michael@0 | 1782 | # Do each command in the finish commands. |
michael@0 | 1783 | func_execute_cmds "$finish_cmds" 'admincmds="$admincmds |
michael@0 | 1784 | '"$cmd"'"' |
michael@0 | 1785 | fi |
michael@0 | 1786 | if test -n "$finish_eval"; then |
michael@0 | 1787 | # Do the single finish_eval. |
michael@0 | 1788 | eval cmds=\"$finish_eval\" |
michael@0 | 1789 | $opt_dry_run || eval "$cmds" || admincmds="$admincmds |
michael@0 | 1790 | $cmds" |
michael@0 | 1791 | fi |
michael@0 | 1792 | done |
michael@0 | 1793 | fi |
michael@0 | 1794 | |
michael@0 | 1795 | # Exit here if they wanted silent mode. |
michael@0 | 1796 | $opt_silent && exit $EXIT_SUCCESS |
michael@0 | 1797 | |
michael@0 | 1798 | $ECHO "X----------------------------------------------------------------------" | $Xsed |
michael@0 | 1799 | $ECHO "Libraries have been installed in:" |
michael@0 | 1800 | for libdir in $libdirs; do |
michael@0 | 1801 | $ECHO " $libdir" |
michael@0 | 1802 | done |
michael@0 | 1803 | $ECHO |
michael@0 | 1804 | $ECHO "If you ever happen to want to link against installed libraries" |
michael@0 | 1805 | $ECHO "in a given directory, LIBDIR, you must either use libtool, and" |
michael@0 | 1806 | $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" |
michael@0 | 1807 | $ECHO "flag during linking and do at least one of the following:" |
michael@0 | 1808 | if test -n "$shlibpath_var"; then |
michael@0 | 1809 | $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" |
michael@0 | 1810 | $ECHO " during execution" |
michael@0 | 1811 | fi |
michael@0 | 1812 | if test -n "$runpath_var"; then |
michael@0 | 1813 | $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" |
michael@0 | 1814 | $ECHO " during linking" |
michael@0 | 1815 | fi |
michael@0 | 1816 | if test -n "$hardcode_libdir_flag_spec"; then |
michael@0 | 1817 | libdir=LIBDIR |
michael@0 | 1818 | eval flag=\"$hardcode_libdir_flag_spec\" |
michael@0 | 1819 | |
michael@0 | 1820 | $ECHO " - use the \`$flag' linker flag" |
michael@0 | 1821 | fi |
michael@0 | 1822 | if test -n "$admincmds"; then |
michael@0 | 1823 | $ECHO " - have your system administrator run these commands:$admincmds" |
michael@0 | 1824 | fi |
michael@0 | 1825 | if test -f /etc/ld.so.conf; then |
michael@0 | 1826 | $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" |
michael@0 | 1827 | fi |
michael@0 | 1828 | $ECHO |
michael@0 | 1829 | |
michael@0 | 1830 | $ECHO "See any operating system documentation about shared libraries for" |
michael@0 | 1831 | case $host in |
michael@0 | 1832 | solaris2.[6789]|solaris2.1[0-9]) |
michael@0 | 1833 | $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" |
michael@0 | 1834 | $ECHO "pages." |
michael@0 | 1835 | ;; |
michael@0 | 1836 | *) |
michael@0 | 1837 | $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." |
michael@0 | 1838 | ;; |
michael@0 | 1839 | esac |
michael@0 | 1840 | $ECHO "X----------------------------------------------------------------------" | $Xsed |
michael@0 | 1841 | exit $EXIT_SUCCESS |
michael@0 | 1842 | } |
michael@0 | 1843 | |
michael@0 | 1844 | test "$mode" = finish && func_mode_finish ${1+"$@"} |
michael@0 | 1845 | |
michael@0 | 1846 | |
michael@0 | 1847 | # func_mode_install arg... |
michael@0 | 1848 | func_mode_install () |
michael@0 | 1849 | { |
michael@0 | 1850 | $opt_debug |
michael@0 | 1851 | # There may be an optional sh(1) argument at the beginning of |
michael@0 | 1852 | # install_prog (especially on Windows NT). |
michael@0 | 1853 | if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || |
michael@0 | 1854 | # Allow the use of GNU shtool's install command. |
michael@0 | 1855 | $ECHO "X$nonopt" | $GREP shtool >/dev/null; then |
michael@0 | 1856 | # Aesthetically quote it. |
michael@0 | 1857 | func_quote_for_eval "$nonopt" |
michael@0 | 1858 | install_prog="$func_quote_for_eval_result " |
michael@0 | 1859 | arg=$1 |
michael@0 | 1860 | shift |
michael@0 | 1861 | else |
michael@0 | 1862 | install_prog= |
michael@0 | 1863 | arg=$nonopt |
michael@0 | 1864 | fi |
michael@0 | 1865 | |
michael@0 | 1866 | # The real first argument should be the name of the installation program. |
michael@0 | 1867 | # Aesthetically quote it. |
michael@0 | 1868 | func_quote_for_eval "$arg" |
michael@0 | 1869 | install_prog="$install_prog$func_quote_for_eval_result" |
michael@0 | 1870 | |
michael@0 | 1871 | # We need to accept at least all the BSD install flags. |
michael@0 | 1872 | dest= |
michael@0 | 1873 | files= |
michael@0 | 1874 | opts= |
michael@0 | 1875 | prev= |
michael@0 | 1876 | install_type= |
michael@0 | 1877 | isdir=no |
michael@0 | 1878 | stripme= |
michael@0 | 1879 | for arg |
michael@0 | 1880 | do |
michael@0 | 1881 | if test -n "$dest"; then |
michael@0 | 1882 | files="$files $dest" |
michael@0 | 1883 | dest=$arg |
michael@0 | 1884 | continue |
michael@0 | 1885 | fi |
michael@0 | 1886 | |
michael@0 | 1887 | case $arg in |
michael@0 | 1888 | -d) isdir=yes ;; |
michael@0 | 1889 | -f) |
michael@0 | 1890 | case " $install_prog " in |
michael@0 | 1891 | *[\\\ /]cp\ *) ;; |
michael@0 | 1892 | *) prev=$arg ;; |
michael@0 | 1893 | esac |
michael@0 | 1894 | ;; |
michael@0 | 1895 | -g | -m | -o) |
michael@0 | 1896 | prev=$arg |
michael@0 | 1897 | ;; |
michael@0 | 1898 | -s) |
michael@0 | 1899 | stripme=" -s" |
michael@0 | 1900 | continue |
michael@0 | 1901 | ;; |
michael@0 | 1902 | -*) |
michael@0 | 1903 | ;; |
michael@0 | 1904 | *) |
michael@0 | 1905 | # If the previous option needed an argument, then skip it. |
michael@0 | 1906 | if test -n "$prev"; then |
michael@0 | 1907 | prev= |
michael@0 | 1908 | else |
michael@0 | 1909 | dest=$arg |
michael@0 | 1910 | continue |
michael@0 | 1911 | fi |
michael@0 | 1912 | ;; |
michael@0 | 1913 | esac |
michael@0 | 1914 | |
michael@0 | 1915 | # Aesthetically quote the argument. |
michael@0 | 1916 | func_quote_for_eval "$arg" |
michael@0 | 1917 | install_prog="$install_prog $func_quote_for_eval_result" |
michael@0 | 1918 | done |
michael@0 | 1919 | |
michael@0 | 1920 | test -z "$install_prog" && \ |
michael@0 | 1921 | func_fatal_help "you must specify an install program" |
michael@0 | 1922 | |
michael@0 | 1923 | test -n "$prev" && \ |
michael@0 | 1924 | func_fatal_help "the \`$prev' option requires an argument" |
michael@0 | 1925 | |
michael@0 | 1926 | if test -z "$files"; then |
michael@0 | 1927 | if test -z "$dest"; then |
michael@0 | 1928 | func_fatal_help "no file or destination specified" |
michael@0 | 1929 | else |
michael@0 | 1930 | func_fatal_help "you must specify a destination" |
michael@0 | 1931 | fi |
michael@0 | 1932 | fi |
michael@0 | 1933 | |
michael@0 | 1934 | # Strip any trailing slash from the destination. |
michael@0 | 1935 | func_stripname '' '/' "$dest" |
michael@0 | 1936 | dest=$func_stripname_result |
michael@0 | 1937 | |
michael@0 | 1938 | # Check to see that the destination is a directory. |
michael@0 | 1939 | test -d "$dest" && isdir=yes |
michael@0 | 1940 | if test "$isdir" = yes; then |
michael@0 | 1941 | destdir="$dest" |
michael@0 | 1942 | destname= |
michael@0 | 1943 | else |
michael@0 | 1944 | func_dirname_and_basename "$dest" "" "." |
michael@0 | 1945 | destdir="$func_dirname_result" |
michael@0 | 1946 | destname="$func_basename_result" |
michael@0 | 1947 | |
michael@0 | 1948 | # Not a directory, so check to see that there is only one file specified. |
michael@0 | 1949 | set dummy $files; shift |
michael@0 | 1950 | test "$#" -gt 1 && \ |
michael@0 | 1951 | func_fatal_help "\`$dest' is not a directory" |
michael@0 | 1952 | fi |
michael@0 | 1953 | case $destdir in |
michael@0 | 1954 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
michael@0 | 1955 | *) |
michael@0 | 1956 | for file in $files; do |
michael@0 | 1957 | case $file in |
michael@0 | 1958 | *.lo) ;; |
michael@0 | 1959 | *) |
michael@0 | 1960 | func_fatal_help "\`$destdir' must be an absolute directory name" |
michael@0 | 1961 | ;; |
michael@0 | 1962 | esac |
michael@0 | 1963 | done |
michael@0 | 1964 | ;; |
michael@0 | 1965 | esac |
michael@0 | 1966 | |
michael@0 | 1967 | # This variable tells wrapper scripts just to set variables rather |
michael@0 | 1968 | # than running their programs. |
michael@0 | 1969 | libtool_install_magic="$magic" |
michael@0 | 1970 | |
michael@0 | 1971 | staticlibs= |
michael@0 | 1972 | future_libdirs= |
michael@0 | 1973 | current_libdirs= |
michael@0 | 1974 | for file in $files; do |
michael@0 | 1975 | |
michael@0 | 1976 | # Do each installation. |
michael@0 | 1977 | case $file in |
michael@0 | 1978 | *.$libext) |
michael@0 | 1979 | # Do the static libraries later. |
michael@0 | 1980 | staticlibs="$staticlibs $file" |
michael@0 | 1981 | ;; |
michael@0 | 1982 | |
michael@0 | 1983 | *.la) |
michael@0 | 1984 | # Check to see that this really is a libtool archive. |
michael@0 | 1985 | func_lalib_unsafe_p "$file" \ |
michael@0 | 1986 | || func_fatal_help "\`$file' is not a valid libtool archive" |
michael@0 | 1987 | |
michael@0 | 1988 | library_names= |
michael@0 | 1989 | old_library= |
michael@0 | 1990 | relink_command= |
michael@0 | 1991 | func_source "$file" |
michael@0 | 1992 | |
michael@0 | 1993 | # Add the libdir to current_libdirs if it is the destination. |
michael@0 | 1994 | if test "X$destdir" = "X$libdir"; then |
michael@0 | 1995 | case "$current_libdirs " in |
michael@0 | 1996 | *" $libdir "*) ;; |
michael@0 | 1997 | *) current_libdirs="$current_libdirs $libdir" ;; |
michael@0 | 1998 | esac |
michael@0 | 1999 | else |
michael@0 | 2000 | # Note the libdir as a future libdir. |
michael@0 | 2001 | case "$future_libdirs " in |
michael@0 | 2002 | *" $libdir "*) ;; |
michael@0 | 2003 | *) future_libdirs="$future_libdirs $libdir" ;; |
michael@0 | 2004 | esac |
michael@0 | 2005 | fi |
michael@0 | 2006 | |
michael@0 | 2007 | func_dirname "$file" "/" "" |
michael@0 | 2008 | dir="$func_dirname_result" |
michael@0 | 2009 | dir="$dir$objdir" |
michael@0 | 2010 | |
michael@0 | 2011 | if test -n "$relink_command"; then |
michael@0 | 2012 | # Determine the prefix the user has applied to our future dir. |
michael@0 | 2013 | inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` |
michael@0 | 2014 | |
michael@0 | 2015 | # Don't allow the user to place us outside of our expected |
michael@0 | 2016 | # location b/c this prevents finding dependent libraries that |
michael@0 | 2017 | # are installed to the same prefix. |
michael@0 | 2018 | # At present, this check doesn't affect windows .dll's that |
michael@0 | 2019 | # are installed into $libdir/../bin (currently, that works fine) |
michael@0 | 2020 | # but it's something to keep an eye on. |
michael@0 | 2021 | test "$inst_prefix_dir" = "$destdir" && \ |
michael@0 | 2022 | func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" |
michael@0 | 2023 | |
michael@0 | 2024 | if test -n "$inst_prefix_dir"; then |
michael@0 | 2025 | # Stick the inst_prefix_dir data into the link command. |
michael@0 | 2026 | relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` |
michael@0 | 2027 | else |
michael@0 | 2028 | relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` |
michael@0 | 2029 | fi |
michael@0 | 2030 | |
michael@0 | 2031 | func_warning "relinking \`$file'" |
michael@0 | 2032 | func_show_eval "$relink_command" \ |
michael@0 | 2033 | 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' |
michael@0 | 2034 | fi |
michael@0 | 2035 | |
michael@0 | 2036 | # See the names of the shared library. |
michael@0 | 2037 | set dummy $library_names; shift |
michael@0 | 2038 | if test -n "$1"; then |
michael@0 | 2039 | realname="$1" |
michael@0 | 2040 | shift |
michael@0 | 2041 | |
michael@0 | 2042 | srcname="$realname" |
michael@0 | 2043 | test -n "$relink_command" && srcname="$realname"T |
michael@0 | 2044 | |
michael@0 | 2045 | # Install the shared library and build the symlinks. |
michael@0 | 2046 | func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ |
michael@0 | 2047 | 'exit $?' |
michael@0 | 2048 | tstripme="$stripme" |
michael@0 | 2049 | case $host_os in |
michael@0 | 2050 | cygwin* | mingw* | pw32* | cegcc*) |
michael@0 | 2051 | case $realname in |
michael@0 | 2052 | *.dll.a) |
michael@0 | 2053 | tstripme="" |
michael@0 | 2054 | ;; |
michael@0 | 2055 | esac |
michael@0 | 2056 | ;; |
michael@0 | 2057 | esac |
michael@0 | 2058 | if test -n "$tstripme" && test -n "$striplib"; then |
michael@0 | 2059 | func_show_eval "$striplib $destdir/$realname" 'exit $?' |
michael@0 | 2060 | fi |
michael@0 | 2061 | |
michael@0 | 2062 | if test "$#" -gt 0; then |
michael@0 | 2063 | # Delete the old symlinks, and create new ones. |
michael@0 | 2064 | # Try `ln -sf' first, because the `ln' binary might depend on |
michael@0 | 2065 | # the symlink we replace! Solaris /bin/ln does not understand -f, |
michael@0 | 2066 | # so we also need to try rm && ln -s. |
michael@0 | 2067 | for linkname |
michael@0 | 2068 | do |
michael@0 | 2069 | test "$linkname" != "$realname" \ |
michael@0 | 2070 | && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" |
michael@0 | 2071 | done |
michael@0 | 2072 | fi |
michael@0 | 2073 | |
michael@0 | 2074 | # Do each command in the postinstall commands. |
michael@0 | 2075 | lib="$destdir/$realname" |
michael@0 | 2076 | func_execute_cmds "$postinstall_cmds" 'exit $?' |
michael@0 | 2077 | fi |
michael@0 | 2078 | |
michael@0 | 2079 | # Install the pseudo-library for information purposes. |
michael@0 | 2080 | func_basename "$file" |
michael@0 | 2081 | name="$func_basename_result" |
michael@0 | 2082 | instname="$dir/$name"i |
michael@0 | 2083 | func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' |
michael@0 | 2084 | |
michael@0 | 2085 | # Maybe install the static library, too. |
michael@0 | 2086 | test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" |
michael@0 | 2087 | ;; |
michael@0 | 2088 | |
michael@0 | 2089 | *.lo) |
michael@0 | 2090 | # Install (i.e. copy) a libtool object. |
michael@0 | 2091 | |
michael@0 | 2092 | # Figure out destination file name, if it wasn't already specified. |
michael@0 | 2093 | if test -n "$destname"; then |
michael@0 | 2094 | destfile="$destdir/$destname" |
michael@0 | 2095 | else |
michael@0 | 2096 | func_basename "$file" |
michael@0 | 2097 | destfile="$func_basename_result" |
michael@0 | 2098 | destfile="$destdir/$destfile" |
michael@0 | 2099 | fi |
michael@0 | 2100 | |
michael@0 | 2101 | # Deduce the name of the destination old-style object file. |
michael@0 | 2102 | case $destfile in |
michael@0 | 2103 | *.lo) |
michael@0 | 2104 | func_lo2o "$destfile" |
michael@0 | 2105 | staticdest=$func_lo2o_result |
michael@0 | 2106 | ;; |
michael@0 | 2107 | *.$objext) |
michael@0 | 2108 | staticdest="$destfile" |
michael@0 | 2109 | destfile= |
michael@0 | 2110 | ;; |
michael@0 | 2111 | *) |
michael@0 | 2112 | func_fatal_help "cannot copy a libtool object to \`$destfile'" |
michael@0 | 2113 | ;; |
michael@0 | 2114 | esac |
michael@0 | 2115 | |
michael@0 | 2116 | # Install the libtool object if requested. |
michael@0 | 2117 | test -n "$destfile" && \ |
michael@0 | 2118 | func_show_eval "$install_prog $file $destfile" 'exit $?' |
michael@0 | 2119 | |
michael@0 | 2120 | # Install the old object if enabled. |
michael@0 | 2121 | if test "$build_old_libs" = yes; then |
michael@0 | 2122 | # Deduce the name of the old-style object file. |
michael@0 | 2123 | func_lo2o "$file" |
michael@0 | 2124 | staticobj=$func_lo2o_result |
michael@0 | 2125 | func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' |
michael@0 | 2126 | fi |
michael@0 | 2127 | exit $EXIT_SUCCESS |
michael@0 | 2128 | ;; |
michael@0 | 2129 | |
michael@0 | 2130 | *) |
michael@0 | 2131 | # Figure out destination file name, if it wasn't already specified. |
michael@0 | 2132 | if test -n "$destname"; then |
michael@0 | 2133 | destfile="$destdir/$destname" |
michael@0 | 2134 | else |
michael@0 | 2135 | func_basename "$file" |
michael@0 | 2136 | destfile="$func_basename_result" |
michael@0 | 2137 | destfile="$destdir/$destfile" |
michael@0 | 2138 | fi |
michael@0 | 2139 | |
michael@0 | 2140 | # If the file is missing, and there is a .exe on the end, strip it |
michael@0 | 2141 | # because it is most likely a libtool script we actually want to |
michael@0 | 2142 | # install |
michael@0 | 2143 | stripped_ext="" |
michael@0 | 2144 | case $file in |
michael@0 | 2145 | *.exe) |
michael@0 | 2146 | if test ! -f "$file"; then |
michael@0 | 2147 | func_stripname '' '.exe' "$file" |
michael@0 | 2148 | file=$func_stripname_result |
michael@0 | 2149 | stripped_ext=".exe" |
michael@0 | 2150 | fi |
michael@0 | 2151 | ;; |
michael@0 | 2152 | esac |
michael@0 | 2153 | |
michael@0 | 2154 | # Do a test to see if this is really a libtool program. |
michael@0 | 2155 | case $host in |
michael@0 | 2156 | *cygwin* | *mingw*) |
michael@0 | 2157 | if func_ltwrapper_executable_p "$file"; then |
michael@0 | 2158 | func_ltwrapper_scriptname "$file" |
michael@0 | 2159 | wrapper=$func_ltwrapper_scriptname_result |
michael@0 | 2160 | else |
michael@0 | 2161 | func_stripname '' '.exe' "$file" |
michael@0 | 2162 | wrapper=$func_stripname_result |
michael@0 | 2163 | fi |
michael@0 | 2164 | ;; |
michael@0 | 2165 | *) |
michael@0 | 2166 | wrapper=$file |
michael@0 | 2167 | ;; |
michael@0 | 2168 | esac |
michael@0 | 2169 | if func_ltwrapper_script_p "$wrapper"; then |
michael@0 | 2170 | notinst_deplibs= |
michael@0 | 2171 | relink_command= |
michael@0 | 2172 | |
michael@0 | 2173 | func_source "$wrapper" |
michael@0 | 2174 | |
michael@0 | 2175 | # Check the variables that should have been set. |
michael@0 | 2176 | test -z "$generated_by_libtool_version" && \ |
michael@0 | 2177 | func_fatal_error "invalid libtool wrapper script \`$wrapper'" |
michael@0 | 2178 | |
michael@0 | 2179 | finalize=yes |
michael@0 | 2180 | for lib in $notinst_deplibs; do |
michael@0 | 2181 | # Check to see that each library is installed. |
michael@0 | 2182 | libdir= |
michael@0 | 2183 | if test -f "$lib"; then |
michael@0 | 2184 | func_source "$lib" |
michael@0 | 2185 | fi |
michael@0 | 2186 | libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test |
michael@0 | 2187 | if test -n "$libdir" && test ! -f "$libfile"; then |
michael@0 | 2188 | func_warning "\`$lib' has not been installed in \`$libdir'" |
michael@0 | 2189 | finalize=no |
michael@0 | 2190 | fi |
michael@0 | 2191 | done |
michael@0 | 2192 | |
michael@0 | 2193 | relink_command= |
michael@0 | 2194 | func_source "$wrapper" |
michael@0 | 2195 | |
michael@0 | 2196 | outputname= |
michael@0 | 2197 | if test "$fast_install" = no && test -n "$relink_command"; then |
michael@0 | 2198 | $opt_dry_run || { |
michael@0 | 2199 | if test "$finalize" = yes; then |
michael@0 | 2200 | tmpdir=`func_mktempdir` |
michael@0 | 2201 | func_basename "$file$stripped_ext" |
michael@0 | 2202 | file="$func_basename_result" |
michael@0 | 2203 | outputname="$tmpdir/$file" |
michael@0 | 2204 | # Replace the output file specification. |
michael@0 | 2205 | relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` |
michael@0 | 2206 | |
michael@0 | 2207 | $opt_silent || { |
michael@0 | 2208 | func_quote_for_expand "$relink_command" |
michael@0 | 2209 | eval "func_echo $func_quote_for_expand_result" |
michael@0 | 2210 | } |
michael@0 | 2211 | if eval "$relink_command"; then : |
michael@0 | 2212 | else |
michael@0 | 2213 | func_error "error: relink \`$file' with the above command before installing it" |
michael@0 | 2214 | $opt_dry_run || ${RM}r "$tmpdir" |
michael@0 | 2215 | continue |
michael@0 | 2216 | fi |
michael@0 | 2217 | file="$outputname" |
michael@0 | 2218 | else |
michael@0 | 2219 | func_warning "cannot relink \`$file'" |
michael@0 | 2220 | fi |
michael@0 | 2221 | } |
michael@0 | 2222 | else |
michael@0 | 2223 | # Install the binary that we compiled earlier. |
michael@0 | 2224 | file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` |
michael@0 | 2225 | fi |
michael@0 | 2226 | fi |
michael@0 | 2227 | |
michael@0 | 2228 | # remove .exe since cygwin /usr/bin/install will append another |
michael@0 | 2229 | # one anyway |
michael@0 | 2230 | case $install_prog,$host in |
michael@0 | 2231 | */usr/bin/install*,*cygwin*) |
michael@0 | 2232 | case $file:$destfile in |
michael@0 | 2233 | *.exe:*.exe) |
michael@0 | 2234 | # this is ok |
michael@0 | 2235 | ;; |
michael@0 | 2236 | *.exe:*) |
michael@0 | 2237 | destfile=$destfile.exe |
michael@0 | 2238 | ;; |
michael@0 | 2239 | *:*.exe) |
michael@0 | 2240 | func_stripname '' '.exe' "$destfile" |
michael@0 | 2241 | destfile=$func_stripname_result |
michael@0 | 2242 | ;; |
michael@0 | 2243 | esac |
michael@0 | 2244 | ;; |
michael@0 | 2245 | esac |
michael@0 | 2246 | func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' |
michael@0 | 2247 | $opt_dry_run || if test -n "$outputname"; then |
michael@0 | 2248 | ${RM}r "$tmpdir" |
michael@0 | 2249 | fi |
michael@0 | 2250 | ;; |
michael@0 | 2251 | esac |
michael@0 | 2252 | done |
michael@0 | 2253 | |
michael@0 | 2254 | for file in $staticlibs; do |
michael@0 | 2255 | func_basename "$file" |
michael@0 | 2256 | name="$func_basename_result" |
michael@0 | 2257 | |
michael@0 | 2258 | # Set up the ranlib parameters. |
michael@0 | 2259 | oldlib="$destdir/$name" |
michael@0 | 2260 | |
michael@0 | 2261 | func_show_eval "$install_prog \$file \$oldlib" 'exit $?' |
michael@0 | 2262 | |
michael@0 | 2263 | if test -n "$stripme" && test -n "$old_striplib"; then |
michael@0 | 2264 | func_show_eval "$old_striplib $oldlib" 'exit $?' |
michael@0 | 2265 | fi |
michael@0 | 2266 | |
michael@0 | 2267 | # Do each command in the postinstall commands. |
michael@0 | 2268 | func_execute_cmds "$old_postinstall_cmds" 'exit $?' |
michael@0 | 2269 | done |
michael@0 | 2270 | |
michael@0 | 2271 | test -n "$future_libdirs" && \ |
michael@0 | 2272 | func_warning "remember to run \`$progname --finish$future_libdirs'" |
michael@0 | 2273 | |
michael@0 | 2274 | if test -n "$current_libdirs"; then |
michael@0 | 2275 | # Maybe just do a dry run. |
michael@0 | 2276 | $opt_dry_run && current_libdirs=" -n$current_libdirs" |
michael@0 | 2277 | exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' |
michael@0 | 2278 | else |
michael@0 | 2279 | exit $EXIT_SUCCESS |
michael@0 | 2280 | fi |
michael@0 | 2281 | } |
michael@0 | 2282 | |
michael@0 | 2283 | test "$mode" = install && func_mode_install ${1+"$@"} |
michael@0 | 2284 | |
michael@0 | 2285 | |
michael@0 | 2286 | # func_generate_dlsyms outputname originator pic_p |
michael@0 | 2287 | # Extract symbols from dlprefiles and create ${outputname}S.o with |
michael@0 | 2288 | # a dlpreopen symbol table. |
michael@0 | 2289 | func_generate_dlsyms () |
michael@0 | 2290 | { |
michael@0 | 2291 | $opt_debug |
michael@0 | 2292 | my_outputname="$1" |
michael@0 | 2293 | my_originator="$2" |
michael@0 | 2294 | my_pic_p="${3-no}" |
michael@0 | 2295 | my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` |
michael@0 | 2296 | my_dlsyms= |
michael@0 | 2297 | |
michael@0 | 2298 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
michael@0 | 2299 | if test -n "$NM" && test -n "$global_symbol_pipe"; then |
michael@0 | 2300 | my_dlsyms="${my_outputname}S.c" |
michael@0 | 2301 | else |
michael@0 | 2302 | func_error "not configured to extract global symbols from dlpreopened files" |
michael@0 | 2303 | fi |
michael@0 | 2304 | fi |
michael@0 | 2305 | |
michael@0 | 2306 | if test -n "$my_dlsyms"; then |
michael@0 | 2307 | case $my_dlsyms in |
michael@0 | 2308 | "") ;; |
michael@0 | 2309 | *.c) |
michael@0 | 2310 | # Discover the nlist of each of the dlfiles. |
michael@0 | 2311 | nlist="$output_objdir/${my_outputname}.nm" |
michael@0 | 2312 | |
michael@0 | 2313 | func_show_eval "$RM $nlist ${nlist}S ${nlist}T" |
michael@0 | 2314 | |
michael@0 | 2315 | # Parse the name list into a source file. |
michael@0 | 2316 | func_verbose "creating $output_objdir/$my_dlsyms" |
michael@0 | 2317 | |
michael@0 | 2318 | $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ |
michael@0 | 2319 | /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ |
michael@0 | 2320 | /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ |
michael@0 | 2321 | |
michael@0 | 2322 | #ifdef __cplusplus |
michael@0 | 2323 | extern \"C\" { |
michael@0 | 2324 | #endif |
michael@0 | 2325 | |
michael@0 | 2326 | /* External symbol declarations for the compiler. */\ |
michael@0 | 2327 | " |
michael@0 | 2328 | |
michael@0 | 2329 | if test "$dlself" = yes; then |
michael@0 | 2330 | func_verbose "generating symbol list for \`$output'" |
michael@0 | 2331 | |
michael@0 | 2332 | $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" |
michael@0 | 2333 | |
michael@0 | 2334 | # Add our own program objects to the symbol list. |
michael@0 | 2335 | progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
michael@0 | 2336 | for progfile in $progfiles; do |
michael@0 | 2337 | func_verbose "extracting global C symbols from \`$progfile'" |
michael@0 | 2338 | $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" |
michael@0 | 2339 | done |
michael@0 | 2340 | |
michael@0 | 2341 | if test -n "$exclude_expsyms"; then |
michael@0 | 2342 | $opt_dry_run || { |
michael@0 | 2343 | eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' |
michael@0 | 2344 | eval '$MV "$nlist"T "$nlist"' |
michael@0 | 2345 | } |
michael@0 | 2346 | fi |
michael@0 | 2347 | |
michael@0 | 2348 | if test -n "$export_symbols_regex"; then |
michael@0 | 2349 | $opt_dry_run || { |
michael@0 | 2350 | eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' |
michael@0 | 2351 | eval '$MV "$nlist"T "$nlist"' |
michael@0 | 2352 | } |
michael@0 | 2353 | fi |
michael@0 | 2354 | |
michael@0 | 2355 | # Prepare the list of exported symbols |
michael@0 | 2356 | if test -z "$export_symbols"; then |
michael@0 | 2357 | export_symbols="$output_objdir/$outputname.exp" |
michael@0 | 2358 | $opt_dry_run || { |
michael@0 | 2359 | $RM $export_symbols |
michael@0 | 2360 | eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' |
michael@0 | 2361 | case $host in |
michael@0 | 2362 | *cygwin* | *mingw* | *cegcc* ) |
michael@0 | 2363 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
michael@0 | 2364 | eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' |
michael@0 | 2365 | ;; |
michael@0 | 2366 | esac |
michael@0 | 2367 | } |
michael@0 | 2368 | else |
michael@0 | 2369 | $opt_dry_run || { |
michael@0 | 2370 | eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' |
michael@0 | 2371 | eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' |
michael@0 | 2372 | eval '$MV "$nlist"T "$nlist"' |
michael@0 | 2373 | case $host in |
michael@0 | 2374 | *cygwin | *mingw* | *cegcc* ) |
michael@0 | 2375 | eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' |
michael@0 | 2376 | eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' |
michael@0 | 2377 | ;; |
michael@0 | 2378 | esac |
michael@0 | 2379 | } |
michael@0 | 2380 | fi |
michael@0 | 2381 | fi |
michael@0 | 2382 | |
michael@0 | 2383 | for dlprefile in $dlprefiles; do |
michael@0 | 2384 | func_verbose "extracting global C symbols from \`$dlprefile'" |
michael@0 | 2385 | func_basename "$dlprefile" |
michael@0 | 2386 | name="$func_basename_result" |
michael@0 | 2387 | $opt_dry_run || { |
michael@0 | 2388 | eval '$ECHO ": $name " >> "$nlist"' |
michael@0 | 2389 | eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" |
michael@0 | 2390 | } |
michael@0 | 2391 | done |
michael@0 | 2392 | |
michael@0 | 2393 | $opt_dry_run || { |
michael@0 | 2394 | # Make sure we have at least an empty file. |
michael@0 | 2395 | test -f "$nlist" || : > "$nlist" |
michael@0 | 2396 | |
michael@0 | 2397 | if test -n "$exclude_expsyms"; then |
michael@0 | 2398 | $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T |
michael@0 | 2399 | $MV "$nlist"T "$nlist" |
michael@0 | 2400 | fi |
michael@0 | 2401 | |
michael@0 | 2402 | # Try sorting and uniquifying the output. |
michael@0 | 2403 | if $GREP -v "^: " < "$nlist" | |
michael@0 | 2404 | if sort -k 3 </dev/null >/dev/null 2>&1; then |
michael@0 | 2405 | sort -k 3 |
michael@0 | 2406 | else |
michael@0 | 2407 | sort +2 |
michael@0 | 2408 | fi | |
michael@0 | 2409 | uniq > "$nlist"S; then |
michael@0 | 2410 | : |
michael@0 | 2411 | else |
michael@0 | 2412 | $GREP -v "^: " < "$nlist" > "$nlist"S |
michael@0 | 2413 | fi |
michael@0 | 2414 | |
michael@0 | 2415 | if test -f "$nlist"S; then |
michael@0 | 2416 | eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' |
michael@0 | 2417 | else |
michael@0 | 2418 | $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" |
michael@0 | 2419 | fi |
michael@0 | 2420 | |
michael@0 | 2421 | $ECHO >> "$output_objdir/$my_dlsyms" "\ |
michael@0 | 2422 | |
michael@0 | 2423 | /* The mapping between symbol names and symbols. */ |
michael@0 | 2424 | typedef struct { |
michael@0 | 2425 | const char *name; |
michael@0 | 2426 | void *address; |
michael@0 | 2427 | } lt_dlsymlist; |
michael@0 | 2428 | " |
michael@0 | 2429 | case $host in |
michael@0 | 2430 | *cygwin* | *mingw* | *cegcc* ) |
michael@0 | 2431 | $ECHO >> "$output_objdir/$my_dlsyms" "\ |
michael@0 | 2432 | /* DATA imports from DLLs on WIN32 con't be const, because |
michael@0 | 2433 | runtime relocations are performed -- see ld's documentation |
michael@0 | 2434 | on pseudo-relocs. */" |
michael@0 | 2435 | lt_dlsym_const= ;; |
michael@0 | 2436 | *osf5*) |
michael@0 | 2437 | echo >> "$output_objdir/$my_dlsyms" "\ |
michael@0 | 2438 | /* This system does not cope well with relocations in const data */" |
michael@0 | 2439 | lt_dlsym_const= ;; |
michael@0 | 2440 | *) |
michael@0 | 2441 | lt_dlsym_const=const ;; |
michael@0 | 2442 | esac |
michael@0 | 2443 | |
michael@0 | 2444 | $ECHO >> "$output_objdir/$my_dlsyms" "\ |
michael@0 | 2445 | extern $lt_dlsym_const lt_dlsymlist |
michael@0 | 2446 | lt_${my_prefix}_LTX_preloaded_symbols[]; |
michael@0 | 2447 | $lt_dlsym_const lt_dlsymlist |
michael@0 | 2448 | lt_${my_prefix}_LTX_preloaded_symbols[] = |
michael@0 | 2449 | {\ |
michael@0 | 2450 | { \"$my_originator\", (void *) 0 }," |
michael@0 | 2451 | |
michael@0 | 2452 | case $need_lib_prefix in |
michael@0 | 2453 | no) |
michael@0 | 2454 | eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" |
michael@0 | 2455 | ;; |
michael@0 | 2456 | *) |
michael@0 | 2457 | eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" |
michael@0 | 2458 | ;; |
michael@0 | 2459 | esac |
michael@0 | 2460 | $ECHO >> "$output_objdir/$my_dlsyms" "\ |
michael@0 | 2461 | {0, (void *) 0} |
michael@0 | 2462 | }; |
michael@0 | 2463 | |
michael@0 | 2464 | /* This works around a problem in FreeBSD linker */ |
michael@0 | 2465 | #ifdef FREEBSD_WORKAROUND |
michael@0 | 2466 | static const void *lt_preloaded_setup() { |
michael@0 | 2467 | return lt_${my_prefix}_LTX_preloaded_symbols; |
michael@0 | 2468 | } |
michael@0 | 2469 | #endif |
michael@0 | 2470 | |
michael@0 | 2471 | #ifdef __cplusplus |
michael@0 | 2472 | } |
michael@0 | 2473 | #endif\ |
michael@0 | 2474 | " |
michael@0 | 2475 | } # !$opt_dry_run |
michael@0 | 2476 | |
michael@0 | 2477 | pic_flag_for_symtable= |
michael@0 | 2478 | case "$compile_command " in |
michael@0 | 2479 | *" -static "*) ;; |
michael@0 | 2480 | *) |
michael@0 | 2481 | case $host in |
michael@0 | 2482 | # compiling the symbol table file with pic_flag works around |
michael@0 | 2483 | # a FreeBSD bug that causes programs to crash when -lm is |
michael@0 | 2484 | # linked before any other PIC object. But we must not use |
michael@0 | 2485 | # pic_flag when linking with -static. The problem exists in |
michael@0 | 2486 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. |
michael@0 | 2487 | *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) |
michael@0 | 2488 | pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; |
michael@0 | 2489 | *-*-hpux*) |
michael@0 | 2490 | pic_flag_for_symtable=" $pic_flag" ;; |
michael@0 | 2491 | *) |
michael@0 | 2492 | if test "X$my_pic_p" != Xno; then |
michael@0 | 2493 | pic_flag_for_symtable=" $pic_flag" |
michael@0 | 2494 | fi |
michael@0 | 2495 | ;; |
michael@0 | 2496 | esac |
michael@0 | 2497 | ;; |
michael@0 | 2498 | esac |
michael@0 | 2499 | symtab_cflags= |
michael@0 | 2500 | for arg in $LTCFLAGS; do |
michael@0 | 2501 | case $arg in |
michael@0 | 2502 | -pie | -fpie | -fPIE) ;; |
michael@0 | 2503 | *) symtab_cflags="$symtab_cflags $arg" ;; |
michael@0 | 2504 | esac |
michael@0 | 2505 | done |
michael@0 | 2506 | |
michael@0 | 2507 | # Now compile the dynamic symbol file. |
michael@0 | 2508 | func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' |
michael@0 | 2509 | |
michael@0 | 2510 | # Clean up the generated files. |
michael@0 | 2511 | func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' |
michael@0 | 2512 | |
michael@0 | 2513 | # Transform the symbol file into the correct name. |
michael@0 | 2514 | symfileobj="$output_objdir/${my_outputname}S.$objext" |
michael@0 | 2515 | case $host in |
michael@0 | 2516 | *cygwin* | *mingw* | *cegcc* ) |
michael@0 | 2517 | if test -f "$output_objdir/$my_outputname.def"; then |
michael@0 | 2518 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
michael@0 | 2519 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` |
michael@0 | 2520 | else |
michael@0 | 2521 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` |
michael@0 | 2522 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` |
michael@0 | 2523 | fi |
michael@0 | 2524 | ;; |
michael@0 | 2525 | *) |
michael@0 | 2526 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` |
michael@0 | 2527 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` |
michael@0 | 2528 | ;; |
michael@0 | 2529 | esac |
michael@0 | 2530 | ;; |
michael@0 | 2531 | *) |
michael@0 | 2532 | func_fatal_error "unknown suffix for \`$my_dlsyms'" |
michael@0 | 2533 | ;; |
michael@0 | 2534 | esac |
michael@0 | 2535 | else |
michael@0 | 2536 | # We keep going just in case the user didn't refer to |
michael@0 | 2537 | # lt_preloaded_symbols. The linker will fail if global_symbol_pipe |
michael@0 | 2538 | # really was required. |
michael@0 | 2539 | |
michael@0 | 2540 | # Nullify the symbol file. |
michael@0 | 2541 | compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` |
michael@0 | 2542 | finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` |
michael@0 | 2543 | fi |
michael@0 | 2544 | } |
michael@0 | 2545 | |
michael@0 | 2546 | # func_win32_libid arg |
michael@0 | 2547 | # return the library type of file 'arg' |
michael@0 | 2548 | # |
michael@0 | 2549 | # Need a lot of goo to handle *both* DLLs and import libs |
michael@0 | 2550 | # Has to be a shell function in order to 'eat' the argument |
michael@0 | 2551 | # that is supplied when $file_magic_command is called. |
michael@0 | 2552 | func_win32_libid () |
michael@0 | 2553 | { |
michael@0 | 2554 | $opt_debug |
michael@0 | 2555 | win32_libid_type="unknown" |
michael@0 | 2556 | win32_fileres=`file -L $1 2>/dev/null` |
michael@0 | 2557 | case $win32_fileres in |
michael@0 | 2558 | *ar\ archive\ import\ library*) # definitely import |
michael@0 | 2559 | win32_libid_type="x86 archive import" |
michael@0 | 2560 | ;; |
michael@0 | 2561 | *ar\ archive*) # could be an import, or static |
michael@0 | 2562 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | |
michael@0 | 2563 | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then |
michael@0 | 2564 | win32_nmres=`eval $NM -f posix -A $1 | |
michael@0 | 2565 | $SED -n -e ' |
michael@0 | 2566 | 1,100{ |
michael@0 | 2567 | / I /{ |
michael@0 | 2568 | s,.*,import, |
michael@0 | 2569 | p |
michael@0 | 2570 | q |
michael@0 | 2571 | } |
michael@0 | 2572 | }'` |
michael@0 | 2573 | case $win32_nmres in |
michael@0 | 2574 | import*) win32_libid_type="x86 archive import";; |
michael@0 | 2575 | *) win32_libid_type="x86 archive static";; |
michael@0 | 2576 | esac |
michael@0 | 2577 | fi |
michael@0 | 2578 | ;; |
michael@0 | 2579 | *DLL*) |
michael@0 | 2580 | win32_libid_type="x86 DLL" |
michael@0 | 2581 | ;; |
michael@0 | 2582 | *executable*) # but shell scripts are "executable" too... |
michael@0 | 2583 | case $win32_fileres in |
michael@0 | 2584 | *MS\ Windows\ PE\ Intel*) |
michael@0 | 2585 | win32_libid_type="x86 DLL" |
michael@0 | 2586 | ;; |
michael@0 | 2587 | esac |
michael@0 | 2588 | ;; |
michael@0 | 2589 | esac |
michael@0 | 2590 | $ECHO "$win32_libid_type" |
michael@0 | 2591 | } |
michael@0 | 2592 | |
michael@0 | 2593 | |
michael@0 | 2594 | |
michael@0 | 2595 | # func_extract_an_archive dir oldlib |
michael@0 | 2596 | func_extract_an_archive () |
michael@0 | 2597 | { |
michael@0 | 2598 | $opt_debug |
michael@0 | 2599 | f_ex_an_ar_dir="$1"; shift |
michael@0 | 2600 | f_ex_an_ar_oldlib="$1" |
michael@0 | 2601 | func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' |
michael@0 | 2602 | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then |
michael@0 | 2603 | : |
michael@0 | 2604 | else |
michael@0 | 2605 | func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" |
michael@0 | 2606 | fi |
michael@0 | 2607 | } |
michael@0 | 2608 | |
michael@0 | 2609 | |
michael@0 | 2610 | # func_extract_archives gentop oldlib ... |
michael@0 | 2611 | func_extract_archives () |
michael@0 | 2612 | { |
michael@0 | 2613 | $opt_debug |
michael@0 | 2614 | my_gentop="$1"; shift |
michael@0 | 2615 | my_oldlibs=${1+"$@"} |
michael@0 | 2616 | my_oldobjs="" |
michael@0 | 2617 | my_xlib="" |
michael@0 | 2618 | my_xabs="" |
michael@0 | 2619 | my_xdir="" |
michael@0 | 2620 | |
michael@0 | 2621 | for my_xlib in $my_oldlibs; do |
michael@0 | 2622 | # Extract the objects. |
michael@0 | 2623 | case $my_xlib in |
michael@0 | 2624 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; |
michael@0 | 2625 | *) my_xabs=`pwd`"/$my_xlib" ;; |
michael@0 | 2626 | esac |
michael@0 | 2627 | func_basename "$my_xlib" |
michael@0 | 2628 | my_xlib="$func_basename_result" |
michael@0 | 2629 | my_xlib_u=$my_xlib |
michael@0 | 2630 | while :; do |
michael@0 | 2631 | case " $extracted_archives " in |
michael@0 | 2632 | *" $my_xlib_u "*) |
michael@0 | 2633 | func_arith $extracted_serial + 1 |
michael@0 | 2634 | extracted_serial=$func_arith_result |
michael@0 | 2635 | my_xlib_u=lt$extracted_serial-$my_xlib ;; |
michael@0 | 2636 | *) break ;; |
michael@0 | 2637 | esac |
michael@0 | 2638 | done |
michael@0 | 2639 | extracted_archives="$extracted_archives $my_xlib_u" |
michael@0 | 2640 | my_xdir="$my_gentop/$my_xlib_u" |
michael@0 | 2641 | |
michael@0 | 2642 | func_mkdir_p "$my_xdir" |
michael@0 | 2643 | |
michael@0 | 2644 | case $host in |
michael@0 | 2645 | *-darwin*) |
michael@0 | 2646 | func_verbose "Extracting $my_xabs" |
michael@0 | 2647 | # Do not bother doing anything if just a dry run |
michael@0 | 2648 | $opt_dry_run || { |
michael@0 | 2649 | darwin_orig_dir=`pwd` |
michael@0 | 2650 | cd $my_xdir || exit $? |
michael@0 | 2651 | darwin_archive=$my_xabs |
michael@0 | 2652 | darwin_curdir=`pwd` |
michael@0 | 2653 | darwin_base_archive=`basename "$darwin_archive"` |
michael@0 | 2654 | darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` |
michael@0 | 2655 | if test -n "$darwin_arches"; then |
michael@0 | 2656 | darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` |
michael@0 | 2657 | darwin_arch= |
michael@0 | 2658 | func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" |
michael@0 | 2659 | for darwin_arch in $darwin_arches ; do |
michael@0 | 2660 | func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
michael@0 | 2661 | $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" |
michael@0 | 2662 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" |
michael@0 | 2663 | func_extract_an_archive "`pwd`" "${darwin_base_archive}" |
michael@0 | 2664 | cd "$darwin_curdir" |
michael@0 | 2665 | $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" |
michael@0 | 2666 | done # $darwin_arches |
michael@0 | 2667 | ## Okay now we've a bunch of thin objects, gotta fatten them up :) |
michael@0 | 2668 | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` |
michael@0 | 2669 | darwin_file= |
michael@0 | 2670 | darwin_files= |
michael@0 | 2671 | for darwin_file in $darwin_filelist; do |
michael@0 | 2672 | darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` |
michael@0 | 2673 | $LIPO -create -output "$darwin_file" $darwin_files |
michael@0 | 2674 | done # $darwin_filelist |
michael@0 | 2675 | $RM -rf unfat-$$ |
michael@0 | 2676 | cd "$darwin_orig_dir" |
michael@0 | 2677 | else |
michael@0 | 2678 | cd $darwin_orig_dir |
michael@0 | 2679 | func_extract_an_archive "$my_xdir" "$my_xabs" |
michael@0 | 2680 | fi # $darwin_arches |
michael@0 | 2681 | } # !$opt_dry_run |
michael@0 | 2682 | ;; |
michael@0 | 2683 | *) |
michael@0 | 2684 | func_extract_an_archive "$my_xdir" "$my_xabs" |
michael@0 | 2685 | ;; |
michael@0 | 2686 | esac |
michael@0 | 2687 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` |
michael@0 | 2688 | done |
michael@0 | 2689 | |
michael@0 | 2690 | func_extract_archives_result="$my_oldobjs" |
michael@0 | 2691 | } |
michael@0 | 2692 | |
michael@0 | 2693 | |
michael@0 | 2694 | |
michael@0 | 2695 | # func_emit_wrapper_part1 [arg=no] |
michael@0 | 2696 | # |
michael@0 | 2697 | # Emit the first part of a libtool wrapper script on stdout. |
michael@0 | 2698 | # For more information, see the description associated with |
michael@0 | 2699 | # func_emit_wrapper(), below. |
michael@0 | 2700 | func_emit_wrapper_part1 () |
michael@0 | 2701 | { |
michael@0 | 2702 | func_emit_wrapper_part1_arg1=no |
michael@0 | 2703 | if test -n "$1" ; then |
michael@0 | 2704 | func_emit_wrapper_part1_arg1=$1 |
michael@0 | 2705 | fi |
michael@0 | 2706 | |
michael@0 | 2707 | $ECHO "\ |
michael@0 | 2708 | #! $SHELL |
michael@0 | 2709 | |
michael@0 | 2710 | # $output - temporary wrapper script for $objdir/$outputname |
michael@0 | 2711 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
michael@0 | 2712 | # |
michael@0 | 2713 | # The $output program cannot be directly executed until all the libtool |
michael@0 | 2714 | # libraries that it depends on are installed. |
michael@0 | 2715 | # |
michael@0 | 2716 | # This wrapper script should never be moved out of the build directory. |
michael@0 | 2717 | # If it is, it will not operate correctly. |
michael@0 | 2718 | |
michael@0 | 2719 | # Sed substitution that helps us do robust quoting. It backslashifies |
michael@0 | 2720 | # metacharacters that are still active within double-quoted strings. |
michael@0 | 2721 | Xsed='${SED} -e 1s/^X//' |
michael@0 | 2722 | sed_quote_subst='$sed_quote_subst' |
michael@0 | 2723 | |
michael@0 | 2724 | # Be Bourne compatible |
michael@0 | 2725 | if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then |
michael@0 | 2726 | emulate sh |
michael@0 | 2727 | NULLCMD=: |
michael@0 | 2728 | # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which |
michael@0 | 2729 | # is contrary to our usage. Disable this feature. |
michael@0 | 2730 | alias -g '\${1+\"\$@\"}'='\"\$@\"' |
michael@0 | 2731 | setopt NO_GLOB_SUBST |
michael@0 | 2732 | else |
michael@0 | 2733 | case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac |
michael@0 | 2734 | fi |
michael@0 | 2735 | BIN_SH=xpg4; export BIN_SH # for Tru64 |
michael@0 | 2736 | DUALCASE=1; export DUALCASE # for MKS sh |
michael@0 | 2737 | |
michael@0 | 2738 | # The HP-UX ksh and POSIX shell print the target directory to stdout |
michael@0 | 2739 | # if CDPATH is set. |
michael@0 | 2740 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
michael@0 | 2741 | |
michael@0 | 2742 | relink_command=\"$relink_command\" |
michael@0 | 2743 | |
michael@0 | 2744 | # This environment variable determines our operation mode. |
michael@0 | 2745 | if test \"\$libtool_install_magic\" = \"$magic\"; then |
michael@0 | 2746 | # install mode needs the following variables: |
michael@0 | 2747 | generated_by_libtool_version='$macro_version' |
michael@0 | 2748 | notinst_deplibs='$notinst_deplibs' |
michael@0 | 2749 | else |
michael@0 | 2750 | # When we are sourced in execute mode, \$file and \$ECHO are already set. |
michael@0 | 2751 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
michael@0 | 2752 | ECHO=\"$qecho\" |
michael@0 | 2753 | file=\"\$0\" |
michael@0 | 2754 | # Make sure echo works. |
michael@0 | 2755 | if test \"X\$1\" = X--no-reexec; then |
michael@0 | 2756 | # Discard the --no-reexec flag, and continue. |
michael@0 | 2757 | shift |
michael@0 | 2758 | elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then |
michael@0 | 2759 | # Yippee, \$ECHO works! |
michael@0 | 2760 | : |
michael@0 | 2761 | else |
michael@0 | 2762 | # Restart under the correct shell, and then maybe \$ECHO will work. |
michael@0 | 2763 | exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} |
michael@0 | 2764 | fi |
michael@0 | 2765 | fi\ |
michael@0 | 2766 | " |
michael@0 | 2767 | $ECHO "\ |
michael@0 | 2768 | |
michael@0 | 2769 | # Find the directory that this script lives in. |
michael@0 | 2770 | thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` |
michael@0 | 2771 | test \"x\$thisdir\" = \"x\$file\" && thisdir=. |
michael@0 | 2772 | |
michael@0 | 2773 | # Follow symbolic links until we get to the real thisdir. |
michael@0 | 2774 | file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` |
michael@0 | 2775 | while test -n \"\$file\"; do |
michael@0 | 2776 | destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` |
michael@0 | 2777 | |
michael@0 | 2778 | # If there was a directory component, then change thisdir. |
michael@0 | 2779 | if test \"x\$destdir\" != \"x\$file\"; then |
michael@0 | 2780 | case \"\$destdir\" in |
michael@0 | 2781 | [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; |
michael@0 | 2782 | *) thisdir=\"\$thisdir/\$destdir\" ;; |
michael@0 | 2783 | esac |
michael@0 | 2784 | fi |
michael@0 | 2785 | |
michael@0 | 2786 | file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` |
michael@0 | 2787 | file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` |
michael@0 | 2788 | done |
michael@0 | 2789 | " |
michael@0 | 2790 | } |
michael@0 | 2791 | # end: func_emit_wrapper_part1 |
michael@0 | 2792 | |
michael@0 | 2793 | # func_emit_wrapper_part2 [arg=no] |
michael@0 | 2794 | # |
michael@0 | 2795 | # Emit the second part of a libtool wrapper script on stdout. |
michael@0 | 2796 | # For more information, see the description associated with |
michael@0 | 2797 | # func_emit_wrapper(), below. |
michael@0 | 2798 | func_emit_wrapper_part2 () |
michael@0 | 2799 | { |
michael@0 | 2800 | func_emit_wrapper_part2_arg1=no |
michael@0 | 2801 | if test -n "$1" ; then |
michael@0 | 2802 | func_emit_wrapper_part2_arg1=$1 |
michael@0 | 2803 | fi |
michael@0 | 2804 | |
michael@0 | 2805 | $ECHO "\ |
michael@0 | 2806 | |
michael@0 | 2807 | # Usually 'no', except on cygwin/mingw when embedded into |
michael@0 | 2808 | # the cwrapper. |
michael@0 | 2809 | WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 |
michael@0 | 2810 | if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then |
michael@0 | 2811 | # special case for '.' |
michael@0 | 2812 | if test \"\$thisdir\" = \".\"; then |
michael@0 | 2813 | thisdir=\`pwd\` |
michael@0 | 2814 | fi |
michael@0 | 2815 | # remove .libs from thisdir |
michael@0 | 2816 | case \"\$thisdir\" in |
michael@0 | 2817 | *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; |
michael@0 | 2818 | $objdir ) thisdir=. ;; |
michael@0 | 2819 | esac |
michael@0 | 2820 | fi |
michael@0 | 2821 | |
michael@0 | 2822 | # Try to get the absolute directory name. |
michael@0 | 2823 | absdir=\`cd \"\$thisdir\" && pwd\` |
michael@0 | 2824 | test -n \"\$absdir\" && thisdir=\"\$absdir\" |
michael@0 | 2825 | " |
michael@0 | 2826 | |
michael@0 | 2827 | if test "$fast_install" = yes; then |
michael@0 | 2828 | $ECHO "\ |
michael@0 | 2829 | program=lt-'$outputname'$exeext |
michael@0 | 2830 | progdir=\"\$thisdir/$objdir\" |
michael@0 | 2831 | |
michael@0 | 2832 | if test ! -f \"\$progdir/\$program\" || |
michael@0 | 2833 | { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ |
michael@0 | 2834 | test \"X\$file\" != \"X\$progdir/\$program\"; }; then |
michael@0 | 2835 | |
michael@0 | 2836 | file=\"\$\$-\$program\" |
michael@0 | 2837 | |
michael@0 | 2838 | if test ! -d \"\$progdir\"; then |
michael@0 | 2839 | $MKDIR \"\$progdir\" |
michael@0 | 2840 | else |
michael@0 | 2841 | $RM \"\$progdir/\$file\" |
michael@0 | 2842 | fi" |
michael@0 | 2843 | |
michael@0 | 2844 | $ECHO "\ |
michael@0 | 2845 | |
michael@0 | 2846 | # relink executable if necessary |
michael@0 | 2847 | if test -n \"\$relink_command\"; then |
michael@0 | 2848 | if relink_command_output=\`eval \$relink_command 2>&1\`; then : |
michael@0 | 2849 | else |
michael@0 | 2850 | $ECHO \"\$relink_command_output\" >&2 |
michael@0 | 2851 | $RM \"\$progdir/\$file\" |
michael@0 | 2852 | exit 1 |
michael@0 | 2853 | fi |
michael@0 | 2854 | fi |
michael@0 | 2855 | |
michael@0 | 2856 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || |
michael@0 | 2857 | { $RM \"\$progdir/\$program\"; |
michael@0 | 2858 | $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
michael@0 | 2859 | $RM \"\$progdir/\$file\" |
michael@0 | 2860 | fi" |
michael@0 | 2861 | else |
michael@0 | 2862 | $ECHO "\ |
michael@0 | 2863 | program='$outputname' |
michael@0 | 2864 | progdir=\"\$thisdir/$objdir\" |
michael@0 | 2865 | " |
michael@0 | 2866 | fi |
michael@0 | 2867 | |
michael@0 | 2868 | $ECHO "\ |
michael@0 | 2869 | |
michael@0 | 2870 | if test -f \"\$progdir/\$program\"; then" |
michael@0 | 2871 | |
michael@0 | 2872 | # Export our shlibpath_var if we have one. |
michael@0 | 2873 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
michael@0 | 2874 | $ECHO "\ |
michael@0 | 2875 | # Add our own library path to $shlibpath_var |
michael@0 | 2876 | $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" |
michael@0 | 2877 | |
michael@0 | 2878 | # Some systems cannot cope with colon-terminated $shlibpath_var |
michael@0 | 2879 | # The second colon is a workaround for a bug in BeOS R4 sed |
michael@0 | 2880 | $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` |
michael@0 | 2881 | |
michael@0 | 2882 | export $shlibpath_var |
michael@0 | 2883 | " |
michael@0 | 2884 | fi |
michael@0 | 2885 | |
michael@0 | 2886 | # fixup the dll searchpath if we need to. |
michael@0 | 2887 | if test -n "$dllsearchpath"; then |
michael@0 | 2888 | $ECHO "\ |
michael@0 | 2889 | # Add the dll search path components to the executable PATH |
michael@0 | 2890 | PATH=$dllsearchpath:\$PATH |
michael@0 | 2891 | " |
michael@0 | 2892 | fi |
michael@0 | 2893 | |
michael@0 | 2894 | $ECHO "\ |
michael@0 | 2895 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
michael@0 | 2896 | # Run the actual program with our arguments. |
michael@0 | 2897 | " |
michael@0 | 2898 | case $host in |
michael@0 | 2899 | # Backslashes separate directories on plain windows |
michael@0 | 2900 | *-*-mingw | *-*-os2* | *-cegcc*) |
michael@0 | 2901 | $ECHO "\ |
michael@0 | 2902 | exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} |
michael@0 | 2903 | " |
michael@0 | 2904 | ;; |
michael@0 | 2905 | |
michael@0 | 2906 | *) |
michael@0 | 2907 | $ECHO "\ |
michael@0 | 2908 | exec \"\$progdir/\$program\" \${1+\"\$@\"} |
michael@0 | 2909 | " |
michael@0 | 2910 | ;; |
michael@0 | 2911 | esac |
michael@0 | 2912 | $ECHO "\ |
michael@0 | 2913 | \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 |
michael@0 | 2914 | exit 1 |
michael@0 | 2915 | fi |
michael@0 | 2916 | else |
michael@0 | 2917 | # The program doesn't exist. |
michael@0 | 2918 | \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 |
michael@0 | 2919 | \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 |
michael@0 | 2920 | $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 |
michael@0 | 2921 | exit 1 |
michael@0 | 2922 | fi |
michael@0 | 2923 | fi\ |
michael@0 | 2924 | " |
michael@0 | 2925 | } |
michael@0 | 2926 | # end: func_emit_wrapper_part2 |
michael@0 | 2927 | |
michael@0 | 2928 | |
michael@0 | 2929 | # func_emit_wrapper [arg=no] |
michael@0 | 2930 | # |
michael@0 | 2931 | # Emit a libtool wrapper script on stdout. |
michael@0 | 2932 | # Don't directly open a file because we may want to |
michael@0 | 2933 | # incorporate the script contents within a cygwin/mingw |
michael@0 | 2934 | # wrapper executable. Must ONLY be called from within |
michael@0 | 2935 | # func_mode_link because it depends on a number of variables |
michael@0 | 2936 | # set therein. |
michael@0 | 2937 | # |
michael@0 | 2938 | # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR |
michael@0 | 2939 | # variable will take. If 'yes', then the emitted script |
michael@0 | 2940 | # will assume that the directory in which it is stored is |
michael@0 | 2941 | # the $objdir directory. This is a cygwin/mingw-specific |
michael@0 | 2942 | # behavior. |
michael@0 | 2943 | func_emit_wrapper () |
michael@0 | 2944 | { |
michael@0 | 2945 | func_emit_wrapper_arg1=no |
michael@0 | 2946 | if test -n "$1" ; then |
michael@0 | 2947 | func_emit_wrapper_arg1=$1 |
michael@0 | 2948 | fi |
michael@0 | 2949 | |
michael@0 | 2950 | # split this up so that func_emit_cwrapperexe_src |
michael@0 | 2951 | # can call each part independently. |
michael@0 | 2952 | func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" |
michael@0 | 2953 | func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" |
michael@0 | 2954 | } |
michael@0 | 2955 | |
michael@0 | 2956 | |
michael@0 | 2957 | # func_to_host_path arg |
michael@0 | 2958 | # |
michael@0 | 2959 | # Convert paths to host format when used with build tools. |
michael@0 | 2960 | # Intended for use with "native" mingw (where libtool itself |
michael@0 | 2961 | # is running under the msys shell), or in the following cross- |
michael@0 | 2962 | # build environments: |
michael@0 | 2963 | # $build $host |
michael@0 | 2964 | # mingw (msys) mingw [e.g. native] |
michael@0 | 2965 | # cygwin mingw |
michael@0 | 2966 | # *nix + wine mingw |
michael@0 | 2967 | # where wine is equipped with the `winepath' executable. |
michael@0 | 2968 | # In the native mingw case, the (msys) shell automatically |
michael@0 | 2969 | # converts paths for any non-msys applications it launches, |
michael@0 | 2970 | # but that facility isn't available from inside the cwrapper. |
michael@0 | 2971 | # Similar accommodations are necessary for $host mingw and |
michael@0 | 2972 | # $build cygwin. Calling this function does no harm for other |
michael@0 | 2973 | # $host/$build combinations not listed above. |
michael@0 | 2974 | # |
michael@0 | 2975 | # ARG is the path (on $build) that should be converted to |
michael@0 | 2976 | # the proper representation for $host. The result is stored |
michael@0 | 2977 | # in $func_to_host_path_result. |
michael@0 | 2978 | func_to_host_path () |
michael@0 | 2979 | { |
michael@0 | 2980 | func_to_host_path_result="$1" |
michael@0 | 2981 | if test -n "$1" ; then |
michael@0 | 2982 | case $host in |
michael@0 | 2983 | *mingw* ) |
michael@0 | 2984 | lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' |
michael@0 | 2985 | case $build in |
michael@0 | 2986 | *mingw* ) # actually, msys |
michael@0 | 2987 | # awkward: cmd appends spaces to result |
michael@0 | 2988 | lt_sed_strip_trailing_spaces="s/[ ]*\$//" |
michael@0 | 2989 | func_to_host_path_tmp1=`( cmd //c echo "$1" |\ |
michael@0 | 2990 | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` |
michael@0 | 2991 | func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ |
michael@0 | 2992 | $SED -e "$lt_sed_naive_backslashify"` |
michael@0 | 2993 | ;; |
michael@0 | 2994 | *cygwin* ) |
michael@0 | 2995 | func_to_host_path_tmp1=`cygpath -w "$1"` |
michael@0 | 2996 | func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ |
michael@0 | 2997 | $SED -e "$lt_sed_naive_backslashify"` |
michael@0 | 2998 | ;; |
michael@0 | 2999 | * ) |
michael@0 | 3000 | # Unfortunately, winepath does not exit with a non-zero |
michael@0 | 3001 | # error code, so we are forced to check the contents of |
michael@0 | 3002 | # stdout. On the other hand, if the command is not |
michael@0 | 3003 | # found, the shell will set an exit code of 127 and print |
michael@0 | 3004 | # *an error message* to stdout. So we must check for both |
michael@0 | 3005 | # error code of zero AND non-empty stdout, which explains |
michael@0 | 3006 | # the odd construction: |
michael@0 | 3007 | func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` |
michael@0 | 3008 | if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then |
michael@0 | 3009 | func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ |
michael@0 | 3010 | $SED -e "$lt_sed_naive_backslashify"` |
michael@0 | 3011 | else |
michael@0 | 3012 | # Allow warning below. |
michael@0 | 3013 | func_to_host_path_result="" |
michael@0 | 3014 | fi |
michael@0 | 3015 | ;; |
michael@0 | 3016 | esac |
michael@0 | 3017 | if test -z "$func_to_host_path_result" ; then |
michael@0 | 3018 | func_error "Could not determine host path corresponding to" |
michael@0 | 3019 | func_error " '$1'" |
michael@0 | 3020 | func_error "Continuing, but uninstalled executables may not work." |
michael@0 | 3021 | # Fallback: |
michael@0 | 3022 | func_to_host_path_result="$1" |
michael@0 | 3023 | fi |
michael@0 | 3024 | ;; |
michael@0 | 3025 | esac |
michael@0 | 3026 | fi |
michael@0 | 3027 | } |
michael@0 | 3028 | # end: func_to_host_path |
michael@0 | 3029 | |
michael@0 | 3030 | # func_to_host_pathlist arg |
michael@0 | 3031 | # |
michael@0 | 3032 | # Convert pathlists to host format when used with build tools. |
michael@0 | 3033 | # See func_to_host_path(), above. This function supports the |
michael@0 | 3034 | # following $build/$host combinations (but does no harm for |
michael@0 | 3035 | # combinations not listed here): |
michael@0 | 3036 | # $build $host |
michael@0 | 3037 | # mingw (msys) mingw [e.g. native] |
michael@0 | 3038 | # cygwin mingw |
michael@0 | 3039 | # *nix + wine mingw |
michael@0 | 3040 | # |
michael@0 | 3041 | # Path separators are also converted from $build format to |
michael@0 | 3042 | # $host format. If ARG begins or ends with a path separator |
michael@0 | 3043 | # character, it is preserved (but converted to $host format) |
michael@0 | 3044 | # on output. |
michael@0 | 3045 | # |
michael@0 | 3046 | # ARG is a pathlist (on $build) that should be converted to |
michael@0 | 3047 | # the proper representation on $host. The result is stored |
michael@0 | 3048 | # in $func_to_host_pathlist_result. |
michael@0 | 3049 | func_to_host_pathlist () |
michael@0 | 3050 | { |
michael@0 | 3051 | func_to_host_pathlist_result="$1" |
michael@0 | 3052 | if test -n "$1" ; then |
michael@0 | 3053 | case $host in |
michael@0 | 3054 | *mingw* ) |
michael@0 | 3055 | lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' |
michael@0 | 3056 | # Remove leading and trailing path separator characters from |
michael@0 | 3057 | # ARG. msys behavior is inconsistent here, cygpath turns them |
michael@0 | 3058 | # into '.;' and ';.', and winepath ignores them completely. |
michael@0 | 3059 | func_to_host_pathlist_tmp2="$1" |
michael@0 | 3060 | # Once set for this call, this variable should not be |
michael@0 | 3061 | # reassigned. It is used in tha fallback case. |
michael@0 | 3062 | func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ |
michael@0 | 3063 | $SED -e 's|^:*||' -e 's|:*$||'` |
michael@0 | 3064 | case $build in |
michael@0 | 3065 | *mingw* ) # Actually, msys. |
michael@0 | 3066 | # Awkward: cmd appends spaces to result. |
michael@0 | 3067 | lt_sed_strip_trailing_spaces="s/[ ]*\$//" |
michael@0 | 3068 | func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ |
michael@0 | 3069 | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` |
michael@0 | 3070 | func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ |
michael@0 | 3071 | $SED -e "$lt_sed_naive_backslashify"` |
michael@0 | 3072 | ;; |
michael@0 | 3073 | *cygwin* ) |
michael@0 | 3074 | func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` |
michael@0 | 3075 | func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ |
michael@0 | 3076 | $SED -e "$lt_sed_naive_backslashify"` |
michael@0 | 3077 | ;; |
michael@0 | 3078 | * ) |
michael@0 | 3079 | # unfortunately, winepath doesn't convert pathlists |
michael@0 | 3080 | func_to_host_pathlist_result="" |
michael@0 | 3081 | func_to_host_pathlist_oldIFS=$IFS |
michael@0 | 3082 | IFS=: |
michael@0 | 3083 | for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do |
michael@0 | 3084 | IFS=$func_to_host_pathlist_oldIFS |
michael@0 | 3085 | if test -n "$func_to_host_pathlist_f" ; then |
michael@0 | 3086 | func_to_host_path "$func_to_host_pathlist_f" |
michael@0 | 3087 | if test -n "$func_to_host_path_result" ; then |
michael@0 | 3088 | if test -z "$func_to_host_pathlist_result" ; then |
michael@0 | 3089 | func_to_host_pathlist_result="$func_to_host_path_result" |
michael@0 | 3090 | else |
michael@0 | 3091 | func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" |
michael@0 | 3092 | fi |
michael@0 | 3093 | fi |
michael@0 | 3094 | fi |
michael@0 | 3095 | IFS=: |
michael@0 | 3096 | done |
michael@0 | 3097 | IFS=$func_to_host_pathlist_oldIFS |
michael@0 | 3098 | ;; |
michael@0 | 3099 | esac |
michael@0 | 3100 | if test -z "$func_to_host_pathlist_result" ; then |
michael@0 | 3101 | func_error "Could not determine the host path(s) corresponding to" |
michael@0 | 3102 | func_error " '$1'" |
michael@0 | 3103 | func_error "Continuing, but uninstalled executables may not work." |
michael@0 | 3104 | # Fallback. This may break if $1 contains DOS-style drive |
michael@0 | 3105 | # specifications. The fix is not to complicate the expression |
michael@0 | 3106 | # below, but for the user to provide a working wine installation |
michael@0 | 3107 | # with winepath so that path translation in the cross-to-mingw |
michael@0 | 3108 | # case works properly. |
michael@0 | 3109 | lt_replace_pathsep_nix_to_dos="s|:|;|g" |
michael@0 | 3110 | func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ |
michael@0 | 3111 | $SED -e "$lt_replace_pathsep_nix_to_dos"` |
michael@0 | 3112 | fi |
michael@0 | 3113 | # Now, add the leading and trailing path separators back |
michael@0 | 3114 | case "$1" in |
michael@0 | 3115 | :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" |
michael@0 | 3116 | ;; |
michael@0 | 3117 | esac |
michael@0 | 3118 | case "$1" in |
michael@0 | 3119 | *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" |
michael@0 | 3120 | ;; |
michael@0 | 3121 | esac |
michael@0 | 3122 | ;; |
michael@0 | 3123 | esac |
michael@0 | 3124 | fi |
michael@0 | 3125 | } |
michael@0 | 3126 | # end: func_to_host_pathlist |
michael@0 | 3127 | |
michael@0 | 3128 | # func_emit_cwrapperexe_src |
michael@0 | 3129 | # emit the source code for a wrapper executable on stdout |
michael@0 | 3130 | # Must ONLY be called from within func_mode_link because |
michael@0 | 3131 | # it depends on a number of variable set therein. |
michael@0 | 3132 | func_emit_cwrapperexe_src () |
michael@0 | 3133 | { |
michael@0 | 3134 | cat <<EOF |
michael@0 | 3135 | |
michael@0 | 3136 | /* $cwrappersource - temporary wrapper executable for $objdir/$outputname |
michael@0 | 3137 | Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
michael@0 | 3138 | |
michael@0 | 3139 | The $output program cannot be directly executed until all the libtool |
michael@0 | 3140 | libraries that it depends on are installed. |
michael@0 | 3141 | |
michael@0 | 3142 | This wrapper executable should never be moved out of the build directory. |
michael@0 | 3143 | If it is, it will not operate correctly. |
michael@0 | 3144 | |
michael@0 | 3145 | Currently, it simply execs the wrapper *script* "$SHELL $output", |
michael@0 | 3146 | but could eventually absorb all of the scripts functionality and |
michael@0 | 3147 | exec $objdir/$outputname directly. |
michael@0 | 3148 | */ |
michael@0 | 3149 | EOF |
michael@0 | 3150 | cat <<"EOF" |
michael@0 | 3151 | #include <stdio.h> |
michael@0 | 3152 | #include <stdlib.h> |
michael@0 | 3153 | #ifdef _MSC_VER |
michael@0 | 3154 | # include <direct.h> |
michael@0 | 3155 | # include <process.h> |
michael@0 | 3156 | # include <io.h> |
michael@0 | 3157 | # define setmode _setmode |
michael@0 | 3158 | #else |
michael@0 | 3159 | # include <unistd.h> |
michael@0 | 3160 | # include <stdint.h> |
michael@0 | 3161 | # ifdef __CYGWIN__ |
michael@0 | 3162 | # include <io.h> |
michael@0 | 3163 | # define HAVE_SETENV |
michael@0 | 3164 | # ifdef __STRICT_ANSI__ |
michael@0 | 3165 | char *realpath (const char *, char *); |
michael@0 | 3166 | int putenv (char *); |
michael@0 | 3167 | int setenv (const char *, const char *, int); |
michael@0 | 3168 | # endif |
michael@0 | 3169 | # endif |
michael@0 | 3170 | #endif |
michael@0 | 3171 | #include <malloc.h> |
michael@0 | 3172 | #include <stdarg.h> |
michael@0 | 3173 | #include <assert.h> |
michael@0 | 3174 | #include <string.h> |
michael@0 | 3175 | #include <ctype.h> |
michael@0 | 3176 | #include <errno.h> |
michael@0 | 3177 | #include <fcntl.h> |
michael@0 | 3178 | #include <sys/stat.h> |
michael@0 | 3179 | |
michael@0 | 3180 | #if defined(PATH_MAX) |
michael@0 | 3181 | # define LT_PATHMAX PATH_MAX |
michael@0 | 3182 | #elif defined(MAXPATHLEN) |
michael@0 | 3183 | # define LT_PATHMAX MAXPATHLEN |
michael@0 | 3184 | #else |
michael@0 | 3185 | # define LT_PATHMAX 1024 |
michael@0 | 3186 | #endif |
michael@0 | 3187 | |
michael@0 | 3188 | #ifndef S_IXOTH |
michael@0 | 3189 | # define S_IXOTH 0 |
michael@0 | 3190 | #endif |
michael@0 | 3191 | #ifndef S_IXGRP |
michael@0 | 3192 | # define S_IXGRP 0 |
michael@0 | 3193 | #endif |
michael@0 | 3194 | |
michael@0 | 3195 | #ifdef _MSC_VER |
michael@0 | 3196 | # define S_IXUSR _S_IEXEC |
michael@0 | 3197 | # define stat _stat |
michael@0 | 3198 | # ifndef _INTPTR_T_DEFINED |
michael@0 | 3199 | # define intptr_t int |
michael@0 | 3200 | # endif |
michael@0 | 3201 | #endif |
michael@0 | 3202 | |
michael@0 | 3203 | #ifndef DIR_SEPARATOR |
michael@0 | 3204 | # define DIR_SEPARATOR '/' |
michael@0 | 3205 | # define PATH_SEPARATOR ':' |
michael@0 | 3206 | #endif |
michael@0 | 3207 | |
michael@0 | 3208 | #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ |
michael@0 | 3209 | defined (__OS2__) |
michael@0 | 3210 | # define HAVE_DOS_BASED_FILE_SYSTEM |
michael@0 | 3211 | # define FOPEN_WB "wb" |
michael@0 | 3212 | # ifndef DIR_SEPARATOR_2 |
michael@0 | 3213 | # define DIR_SEPARATOR_2 '\\' |
michael@0 | 3214 | # endif |
michael@0 | 3215 | # ifndef PATH_SEPARATOR_2 |
michael@0 | 3216 | # define PATH_SEPARATOR_2 ';' |
michael@0 | 3217 | # endif |
michael@0 | 3218 | #endif |
michael@0 | 3219 | |
michael@0 | 3220 | #ifndef DIR_SEPARATOR_2 |
michael@0 | 3221 | # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) |
michael@0 | 3222 | #else /* DIR_SEPARATOR_2 */ |
michael@0 | 3223 | # define IS_DIR_SEPARATOR(ch) \ |
michael@0 | 3224 | (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) |
michael@0 | 3225 | #endif /* DIR_SEPARATOR_2 */ |
michael@0 | 3226 | |
michael@0 | 3227 | #ifndef PATH_SEPARATOR_2 |
michael@0 | 3228 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) |
michael@0 | 3229 | #else /* PATH_SEPARATOR_2 */ |
michael@0 | 3230 | # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) |
michael@0 | 3231 | #endif /* PATH_SEPARATOR_2 */ |
michael@0 | 3232 | |
michael@0 | 3233 | #ifdef __CYGWIN__ |
michael@0 | 3234 | # define FOPEN_WB "wb" |
michael@0 | 3235 | #endif |
michael@0 | 3236 | |
michael@0 | 3237 | #ifndef FOPEN_WB |
michael@0 | 3238 | # define FOPEN_WB "w" |
michael@0 | 3239 | #endif |
michael@0 | 3240 | #ifndef _O_BINARY |
michael@0 | 3241 | # define _O_BINARY 0 |
michael@0 | 3242 | #endif |
michael@0 | 3243 | |
michael@0 | 3244 | #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) |
michael@0 | 3245 | #define XFREE(stale) do { \ |
michael@0 | 3246 | if (stale) { free ((void *) stale); stale = 0; } \ |
michael@0 | 3247 | } while (0) |
michael@0 | 3248 | |
michael@0 | 3249 | #undef LTWRAPPER_DEBUGPRINTF |
michael@0 | 3250 | #if defined DEBUGWRAPPER |
michael@0 | 3251 | # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args |
michael@0 | 3252 | static void |
michael@0 | 3253 | ltwrapper_debugprintf (const char *fmt, ...) |
michael@0 | 3254 | { |
michael@0 | 3255 | va_list args; |
michael@0 | 3256 | va_start (args, fmt); |
michael@0 | 3257 | (void) vfprintf (stderr, fmt, args); |
michael@0 | 3258 | va_end (args); |
michael@0 | 3259 | } |
michael@0 | 3260 | #else |
michael@0 | 3261 | # define LTWRAPPER_DEBUGPRINTF(args) |
michael@0 | 3262 | #endif |
michael@0 | 3263 | |
michael@0 | 3264 | const char *program_name = NULL; |
michael@0 | 3265 | |
michael@0 | 3266 | void *xmalloc (size_t num); |
michael@0 | 3267 | char *xstrdup (const char *string); |
michael@0 | 3268 | const char *base_name (const char *name); |
michael@0 | 3269 | char *find_executable (const char *wrapper); |
michael@0 | 3270 | char *chase_symlinks (const char *pathspec); |
michael@0 | 3271 | int make_executable (const char *path); |
michael@0 | 3272 | int check_executable (const char *path); |
michael@0 | 3273 | char *strendzap (char *str, const char *pat); |
michael@0 | 3274 | void lt_fatal (const char *message, ...); |
michael@0 | 3275 | void lt_setenv (const char *name, const char *value); |
michael@0 | 3276 | char *lt_extend_str (const char *orig_value, const char *add, int to_end); |
michael@0 | 3277 | void lt_opt_process_env_set (const char *arg); |
michael@0 | 3278 | void lt_opt_process_env_prepend (const char *arg); |
michael@0 | 3279 | void lt_opt_process_env_append (const char *arg); |
michael@0 | 3280 | int lt_split_name_value (const char *arg, char** name, char** value); |
michael@0 | 3281 | void lt_update_exe_path (const char *name, const char *value); |
michael@0 | 3282 | void lt_update_lib_path (const char *name, const char *value); |
michael@0 | 3283 | |
michael@0 | 3284 | static const char *script_text_part1 = |
michael@0 | 3285 | EOF |
michael@0 | 3286 | |
michael@0 | 3287 | func_emit_wrapper_part1 yes | |
michael@0 | 3288 | $SED -e 's/\([\\"]\)/\\\1/g' \ |
michael@0 | 3289 | -e 's/^/ "/' -e 's/$/\\n"/' |
michael@0 | 3290 | echo ";" |
michael@0 | 3291 | cat <<EOF |
michael@0 | 3292 | |
michael@0 | 3293 | static const char *script_text_part2 = |
michael@0 | 3294 | EOF |
michael@0 | 3295 | func_emit_wrapper_part2 yes | |
michael@0 | 3296 | $SED -e 's/\([\\"]\)/\\\1/g' \ |
michael@0 | 3297 | -e 's/^/ "/' -e 's/$/\\n"/' |
michael@0 | 3298 | echo ";" |
michael@0 | 3299 | |
michael@0 | 3300 | cat <<EOF |
michael@0 | 3301 | const char * MAGIC_EXE = "$magic_exe"; |
michael@0 | 3302 | const char * LIB_PATH_VARNAME = "$shlibpath_var"; |
michael@0 | 3303 | EOF |
michael@0 | 3304 | |
michael@0 | 3305 | if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then |
michael@0 | 3306 | func_to_host_pathlist "$temp_rpath" |
michael@0 | 3307 | cat <<EOF |
michael@0 | 3308 | const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; |
michael@0 | 3309 | EOF |
michael@0 | 3310 | else |
michael@0 | 3311 | cat <<"EOF" |
michael@0 | 3312 | const char * LIB_PATH_VALUE = ""; |
michael@0 | 3313 | EOF |
michael@0 | 3314 | fi |
michael@0 | 3315 | |
michael@0 | 3316 | if test -n "$dllsearchpath"; then |
michael@0 | 3317 | func_to_host_pathlist "$dllsearchpath:" |
michael@0 | 3318 | cat <<EOF |
michael@0 | 3319 | const char * EXE_PATH_VARNAME = "PATH"; |
michael@0 | 3320 | const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; |
michael@0 | 3321 | EOF |
michael@0 | 3322 | else |
michael@0 | 3323 | cat <<"EOF" |
michael@0 | 3324 | const char * EXE_PATH_VARNAME = ""; |
michael@0 | 3325 | const char * EXE_PATH_VALUE = ""; |
michael@0 | 3326 | EOF |
michael@0 | 3327 | fi |
michael@0 | 3328 | |
michael@0 | 3329 | if test "$fast_install" = yes; then |
michael@0 | 3330 | cat <<EOF |
michael@0 | 3331 | const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ |
michael@0 | 3332 | EOF |
michael@0 | 3333 | else |
michael@0 | 3334 | cat <<EOF |
michael@0 | 3335 | const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ |
michael@0 | 3336 | EOF |
michael@0 | 3337 | fi |
michael@0 | 3338 | |
michael@0 | 3339 | |
michael@0 | 3340 | cat <<"EOF" |
michael@0 | 3341 | |
michael@0 | 3342 | #define LTWRAPPER_OPTION_PREFIX "--lt-" |
michael@0 | 3343 | #define LTWRAPPER_OPTION_PREFIX_LENGTH 5 |
michael@0 | 3344 | |
michael@0 | 3345 | static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH; |
michael@0 | 3346 | static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; |
michael@0 | 3347 | |
michael@0 | 3348 | static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; |
michael@0 | 3349 | |
michael@0 | 3350 | static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7; |
michael@0 | 3351 | static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set"; |
michael@0 | 3352 | /* argument is putenv-style "foo=bar", value of foo is set to bar */ |
michael@0 | 3353 | |
michael@0 | 3354 | static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11; |
michael@0 | 3355 | static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend"; |
michael@0 | 3356 | /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */ |
michael@0 | 3357 | |
michael@0 | 3358 | static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10; |
michael@0 | 3359 | static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append"; |
michael@0 | 3360 | /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */ |
michael@0 | 3361 | |
michael@0 | 3362 | int |
michael@0 | 3363 | main (int argc, char *argv[]) |
michael@0 | 3364 | { |
michael@0 | 3365 | char **newargz; |
michael@0 | 3366 | int newargc; |
michael@0 | 3367 | char *tmp_pathspec; |
michael@0 | 3368 | char *actual_cwrapper_path; |
michael@0 | 3369 | char *actual_cwrapper_name; |
michael@0 | 3370 | char *target_name; |
michael@0 | 3371 | char *lt_argv_zero; |
michael@0 | 3372 | intptr_t rval = 127; |
michael@0 | 3373 | |
michael@0 | 3374 | int i; |
michael@0 | 3375 | |
michael@0 | 3376 | program_name = (char *) xstrdup (base_name (argv[0])); |
michael@0 | 3377 | LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0])); |
michael@0 | 3378 | LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name)); |
michael@0 | 3379 | |
michael@0 | 3380 | /* very simple arg parsing; don't want to rely on getopt */ |
michael@0 | 3381 | for (i = 1; i < argc; i++) |
michael@0 | 3382 | { |
michael@0 | 3383 | if (strcmp (argv[i], dumpscript_opt) == 0) |
michael@0 | 3384 | { |
michael@0 | 3385 | EOF |
michael@0 | 3386 | case "$host" in |
michael@0 | 3387 | *mingw* | *cygwin* ) |
michael@0 | 3388 | # make stdout use "unix" line endings |
michael@0 | 3389 | echo " setmode(1,_O_BINARY);" |
michael@0 | 3390 | ;; |
michael@0 | 3391 | esac |
michael@0 | 3392 | |
michael@0 | 3393 | cat <<"EOF" |
michael@0 | 3394 | printf ("%s", script_text_part1); |
michael@0 | 3395 | printf ("%s", script_text_part2); |
michael@0 | 3396 | return 0; |
michael@0 | 3397 | } |
michael@0 | 3398 | } |
michael@0 | 3399 | |
michael@0 | 3400 | newargz = XMALLOC (char *, argc + 1); |
michael@0 | 3401 | tmp_pathspec = find_executable (argv[0]); |
michael@0 | 3402 | if (tmp_pathspec == NULL) |
michael@0 | 3403 | lt_fatal ("Couldn't find %s", argv[0]); |
michael@0 | 3404 | LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n", |
michael@0 | 3405 | tmp_pathspec)); |
michael@0 | 3406 | |
michael@0 | 3407 | actual_cwrapper_path = chase_symlinks (tmp_pathspec); |
michael@0 | 3408 | LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n", |
michael@0 | 3409 | actual_cwrapper_path)); |
michael@0 | 3410 | XFREE (tmp_pathspec); |
michael@0 | 3411 | |
michael@0 | 3412 | actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path)); |
michael@0 | 3413 | strendzap (actual_cwrapper_path, actual_cwrapper_name); |
michael@0 | 3414 | |
michael@0 | 3415 | /* wrapper name transforms */ |
michael@0 | 3416 | strendzap (actual_cwrapper_name, ".exe"); |
michael@0 | 3417 | tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); |
michael@0 | 3418 | XFREE (actual_cwrapper_name); |
michael@0 | 3419 | actual_cwrapper_name = tmp_pathspec; |
michael@0 | 3420 | tmp_pathspec = 0; |
michael@0 | 3421 | |
michael@0 | 3422 | /* target_name transforms -- use actual target program name; might have lt- prefix */ |
michael@0 | 3423 | target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); |
michael@0 | 3424 | strendzap (target_name, ".exe"); |
michael@0 | 3425 | tmp_pathspec = lt_extend_str (target_name, ".exe", 1); |
michael@0 | 3426 | XFREE (target_name); |
michael@0 | 3427 | target_name = tmp_pathspec; |
michael@0 | 3428 | tmp_pathspec = 0; |
michael@0 | 3429 | |
michael@0 | 3430 | LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n", |
michael@0 | 3431 | target_name)); |
michael@0 | 3432 | EOF |
michael@0 | 3433 | |
michael@0 | 3434 | cat <<EOF |
michael@0 | 3435 | newargz[0] = |
michael@0 | 3436 | XMALLOC (char, (strlen (actual_cwrapper_path) + |
michael@0 | 3437 | strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); |
michael@0 | 3438 | strcpy (newargz[0], actual_cwrapper_path); |
michael@0 | 3439 | strcat (newargz[0], "$objdir"); |
michael@0 | 3440 | strcat (newargz[0], "/"); |
michael@0 | 3441 | EOF |
michael@0 | 3442 | |
michael@0 | 3443 | cat <<"EOF" |
michael@0 | 3444 | /* stop here, and copy so we don't have to do this twice */ |
michael@0 | 3445 | tmp_pathspec = xstrdup (newargz[0]); |
michael@0 | 3446 | |
michael@0 | 3447 | /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ |
michael@0 | 3448 | strcat (newargz[0], actual_cwrapper_name); |
michael@0 | 3449 | |
michael@0 | 3450 | /* DO want the lt- prefix here if it exists, so use target_name */ |
michael@0 | 3451 | lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); |
michael@0 | 3452 | XFREE (tmp_pathspec); |
michael@0 | 3453 | tmp_pathspec = NULL; |
michael@0 | 3454 | EOF |
michael@0 | 3455 | |
michael@0 | 3456 | case $host_os in |
michael@0 | 3457 | mingw*) |
michael@0 | 3458 | cat <<"EOF" |
michael@0 | 3459 | { |
michael@0 | 3460 | char* p; |
michael@0 | 3461 | while ((p = strchr (newargz[0], '\\')) != NULL) |
michael@0 | 3462 | { |
michael@0 | 3463 | *p = '/'; |
michael@0 | 3464 | } |
michael@0 | 3465 | while ((p = strchr (lt_argv_zero, '\\')) != NULL) |
michael@0 | 3466 | { |
michael@0 | 3467 | *p = '/'; |
michael@0 | 3468 | } |
michael@0 | 3469 | } |
michael@0 | 3470 | EOF |
michael@0 | 3471 | ;; |
michael@0 | 3472 | esac |
michael@0 | 3473 | |
michael@0 | 3474 | cat <<"EOF" |
michael@0 | 3475 | XFREE (target_name); |
michael@0 | 3476 | XFREE (actual_cwrapper_path); |
michael@0 | 3477 | XFREE (actual_cwrapper_name); |
michael@0 | 3478 | |
michael@0 | 3479 | lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ |
michael@0 | 3480 | lt_setenv ("DUALCASE", "1"); /* for MSK sh */ |
michael@0 | 3481 | lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); |
michael@0 | 3482 | lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); |
michael@0 | 3483 | |
michael@0 | 3484 | newargc=0; |
michael@0 | 3485 | for (i = 1; i < argc; i++) |
michael@0 | 3486 | { |
michael@0 | 3487 | if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0) |
michael@0 | 3488 | { |
michael@0 | 3489 | if (argv[i][env_set_opt_len] == '=') |
michael@0 | 3490 | { |
michael@0 | 3491 | const char *p = argv[i] + env_set_opt_len + 1; |
michael@0 | 3492 | lt_opt_process_env_set (p); |
michael@0 | 3493 | } |
michael@0 | 3494 | else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc) |
michael@0 | 3495 | { |
michael@0 | 3496 | lt_opt_process_env_set (argv[++i]); /* don't copy */ |
michael@0 | 3497 | } |
michael@0 | 3498 | else |
michael@0 | 3499 | lt_fatal ("%s missing required argument", env_set_opt); |
michael@0 | 3500 | continue; |
michael@0 | 3501 | } |
michael@0 | 3502 | if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0) |
michael@0 | 3503 | { |
michael@0 | 3504 | if (argv[i][env_prepend_opt_len] == '=') |
michael@0 | 3505 | { |
michael@0 | 3506 | const char *p = argv[i] + env_prepend_opt_len + 1; |
michael@0 | 3507 | lt_opt_process_env_prepend (p); |
michael@0 | 3508 | } |
michael@0 | 3509 | else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc) |
michael@0 | 3510 | { |
michael@0 | 3511 | lt_opt_process_env_prepend (argv[++i]); /* don't copy */ |
michael@0 | 3512 | } |
michael@0 | 3513 | else |
michael@0 | 3514 | lt_fatal ("%s missing required argument", env_prepend_opt); |
michael@0 | 3515 | continue; |
michael@0 | 3516 | } |
michael@0 | 3517 | if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0) |
michael@0 | 3518 | { |
michael@0 | 3519 | if (argv[i][env_append_opt_len] == '=') |
michael@0 | 3520 | { |
michael@0 | 3521 | const char *p = argv[i] + env_append_opt_len + 1; |
michael@0 | 3522 | lt_opt_process_env_append (p); |
michael@0 | 3523 | } |
michael@0 | 3524 | else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc) |
michael@0 | 3525 | { |
michael@0 | 3526 | lt_opt_process_env_append (argv[++i]); /* don't copy */ |
michael@0 | 3527 | } |
michael@0 | 3528 | else |
michael@0 | 3529 | lt_fatal ("%s missing required argument", env_append_opt); |
michael@0 | 3530 | continue; |
michael@0 | 3531 | } |
michael@0 | 3532 | if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0) |
michael@0 | 3533 | { |
michael@0 | 3534 | /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX |
michael@0 | 3535 | namespace, but it is not one of the ones we know about and |
michael@0 | 3536 | have already dealt with, above (inluding dump-script), then |
michael@0 | 3537 | report an error. Otherwise, targets might begin to believe |
michael@0 | 3538 | they are allowed to use options in the LTWRAPPER_OPTION_PREFIX |
michael@0 | 3539 | namespace. The first time any user complains about this, we'll |
michael@0 | 3540 | need to make LTWRAPPER_OPTION_PREFIX a configure-time option |
michael@0 | 3541 | or a configure.ac-settable value. |
michael@0 | 3542 | */ |
michael@0 | 3543 | lt_fatal ("Unrecognized option in %s namespace: '%s'", |
michael@0 | 3544 | ltwrapper_option_prefix, argv[i]); |
michael@0 | 3545 | } |
michael@0 | 3546 | /* otherwise ... */ |
michael@0 | 3547 | newargz[++newargc] = xstrdup (argv[i]); |
michael@0 | 3548 | } |
michael@0 | 3549 | newargz[++newargc] = NULL; |
michael@0 | 3550 | |
michael@0 | 3551 | LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>"))); |
michael@0 | 3552 | for (i = 0; i < newargc; i++) |
michael@0 | 3553 | { |
michael@0 | 3554 | LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>"))); |
michael@0 | 3555 | } |
michael@0 | 3556 | |
michael@0 | 3557 | EOF |
michael@0 | 3558 | |
michael@0 | 3559 | case $host_os in |
michael@0 | 3560 | mingw*) |
michael@0 | 3561 | cat <<"EOF" |
michael@0 | 3562 | /* execv doesn't actually work on mingw as expected on unix */ |
michael@0 | 3563 | rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); |
michael@0 | 3564 | if (rval == -1) |
michael@0 | 3565 | { |
michael@0 | 3566 | /* failed to start process */ |
michael@0 | 3567 | LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); |
michael@0 | 3568 | return 127; |
michael@0 | 3569 | } |
michael@0 | 3570 | return rval; |
michael@0 | 3571 | EOF |
michael@0 | 3572 | ;; |
michael@0 | 3573 | *) |
michael@0 | 3574 | cat <<"EOF" |
michael@0 | 3575 | execv (lt_argv_zero, newargz); |
michael@0 | 3576 | return rval; /* =127, but avoids unused variable warning */ |
michael@0 | 3577 | EOF |
michael@0 | 3578 | ;; |
michael@0 | 3579 | esac |
michael@0 | 3580 | |
michael@0 | 3581 | cat <<"EOF" |
michael@0 | 3582 | } |
michael@0 | 3583 | |
michael@0 | 3584 | void * |
michael@0 | 3585 | xmalloc (size_t num) |
michael@0 | 3586 | { |
michael@0 | 3587 | void *p = (void *) malloc (num); |
michael@0 | 3588 | if (!p) |
michael@0 | 3589 | lt_fatal ("Memory exhausted"); |
michael@0 | 3590 | |
michael@0 | 3591 | return p; |
michael@0 | 3592 | } |
michael@0 | 3593 | |
michael@0 | 3594 | char * |
michael@0 | 3595 | xstrdup (const char *string) |
michael@0 | 3596 | { |
michael@0 | 3597 | return string ? strcpy ((char *) xmalloc (strlen (string) + 1), |
michael@0 | 3598 | string) : NULL; |
michael@0 | 3599 | } |
michael@0 | 3600 | |
michael@0 | 3601 | const char * |
michael@0 | 3602 | base_name (const char *name) |
michael@0 | 3603 | { |
michael@0 | 3604 | const char *base; |
michael@0 | 3605 | |
michael@0 | 3606 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
michael@0 | 3607 | /* Skip over the disk name in MSDOS pathnames. */ |
michael@0 | 3608 | if (isalpha ((unsigned char) name[0]) && name[1] == ':') |
michael@0 | 3609 | name += 2; |
michael@0 | 3610 | #endif |
michael@0 | 3611 | |
michael@0 | 3612 | for (base = name; *name; name++) |
michael@0 | 3613 | if (IS_DIR_SEPARATOR (*name)) |
michael@0 | 3614 | base = name + 1; |
michael@0 | 3615 | return base; |
michael@0 | 3616 | } |
michael@0 | 3617 | |
michael@0 | 3618 | int |
michael@0 | 3619 | check_executable (const char *path) |
michael@0 | 3620 | { |
michael@0 | 3621 | struct stat st; |
michael@0 | 3622 | |
michael@0 | 3623 | LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", |
michael@0 | 3624 | path ? (*path ? path : "EMPTY!") : "NULL!")); |
michael@0 | 3625 | if ((!path) || (!*path)) |
michael@0 | 3626 | return 0; |
michael@0 | 3627 | |
michael@0 | 3628 | if ((stat (path, &st) >= 0) |
michael@0 | 3629 | && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) |
michael@0 | 3630 | return 1; |
michael@0 | 3631 | else |
michael@0 | 3632 | return 0; |
michael@0 | 3633 | } |
michael@0 | 3634 | |
michael@0 | 3635 | int |
michael@0 | 3636 | make_executable (const char *path) |
michael@0 | 3637 | { |
michael@0 | 3638 | int rval = 0; |
michael@0 | 3639 | struct stat st; |
michael@0 | 3640 | |
michael@0 | 3641 | LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", |
michael@0 | 3642 | path ? (*path ? path : "EMPTY!") : "NULL!")); |
michael@0 | 3643 | if ((!path) || (!*path)) |
michael@0 | 3644 | return 0; |
michael@0 | 3645 | |
michael@0 | 3646 | if (stat (path, &st) >= 0) |
michael@0 | 3647 | { |
michael@0 | 3648 | rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); |
michael@0 | 3649 | } |
michael@0 | 3650 | return rval; |
michael@0 | 3651 | } |
michael@0 | 3652 | |
michael@0 | 3653 | /* Searches for the full path of the wrapper. Returns |
michael@0 | 3654 | newly allocated full path name if found, NULL otherwise |
michael@0 | 3655 | Does not chase symlinks, even on platforms that support them. |
michael@0 | 3656 | */ |
michael@0 | 3657 | char * |
michael@0 | 3658 | find_executable (const char *wrapper) |
michael@0 | 3659 | { |
michael@0 | 3660 | int has_slash = 0; |
michael@0 | 3661 | const char *p; |
michael@0 | 3662 | const char *p_next; |
michael@0 | 3663 | /* static buffer for getcwd */ |
michael@0 | 3664 | char tmp[LT_PATHMAX + 1]; |
michael@0 | 3665 | int tmp_len; |
michael@0 | 3666 | char *concat_name; |
michael@0 | 3667 | |
michael@0 | 3668 | LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", |
michael@0 | 3669 | wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); |
michael@0 | 3670 | |
michael@0 | 3671 | if ((wrapper == NULL) || (*wrapper == '\0')) |
michael@0 | 3672 | return NULL; |
michael@0 | 3673 | |
michael@0 | 3674 | /* Absolute path? */ |
michael@0 | 3675 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
michael@0 | 3676 | if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') |
michael@0 | 3677 | { |
michael@0 | 3678 | concat_name = xstrdup (wrapper); |
michael@0 | 3679 | if (check_executable (concat_name)) |
michael@0 | 3680 | return concat_name; |
michael@0 | 3681 | XFREE (concat_name); |
michael@0 | 3682 | } |
michael@0 | 3683 | else |
michael@0 | 3684 | { |
michael@0 | 3685 | #endif |
michael@0 | 3686 | if (IS_DIR_SEPARATOR (wrapper[0])) |
michael@0 | 3687 | { |
michael@0 | 3688 | concat_name = xstrdup (wrapper); |
michael@0 | 3689 | if (check_executable (concat_name)) |
michael@0 | 3690 | return concat_name; |
michael@0 | 3691 | XFREE (concat_name); |
michael@0 | 3692 | } |
michael@0 | 3693 | #if defined (HAVE_DOS_BASED_FILE_SYSTEM) |
michael@0 | 3694 | } |
michael@0 | 3695 | #endif |
michael@0 | 3696 | |
michael@0 | 3697 | for (p = wrapper; *p; p++) |
michael@0 | 3698 | if (*p == '/') |
michael@0 | 3699 | { |
michael@0 | 3700 | has_slash = 1; |
michael@0 | 3701 | break; |
michael@0 | 3702 | } |
michael@0 | 3703 | if (!has_slash) |
michael@0 | 3704 | { |
michael@0 | 3705 | /* no slashes; search PATH */ |
michael@0 | 3706 | const char *path = getenv ("PATH"); |
michael@0 | 3707 | if (path != NULL) |
michael@0 | 3708 | { |
michael@0 | 3709 | for (p = path; *p; p = p_next) |
michael@0 | 3710 | { |
michael@0 | 3711 | const char *q; |
michael@0 | 3712 | size_t p_len; |
michael@0 | 3713 | for (q = p; *q; q++) |
michael@0 | 3714 | if (IS_PATH_SEPARATOR (*q)) |
michael@0 | 3715 | break; |
michael@0 | 3716 | p_len = q - p; |
michael@0 | 3717 | p_next = (*q == '\0' ? q : q + 1); |
michael@0 | 3718 | if (p_len == 0) |
michael@0 | 3719 | { |
michael@0 | 3720 | /* empty path: current directory */ |
michael@0 | 3721 | if (getcwd (tmp, LT_PATHMAX) == NULL) |
michael@0 | 3722 | lt_fatal ("getcwd failed"); |
michael@0 | 3723 | tmp_len = strlen (tmp); |
michael@0 | 3724 | concat_name = |
michael@0 | 3725 | XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
michael@0 | 3726 | memcpy (concat_name, tmp, tmp_len); |
michael@0 | 3727 | concat_name[tmp_len] = '/'; |
michael@0 | 3728 | strcpy (concat_name + tmp_len + 1, wrapper); |
michael@0 | 3729 | } |
michael@0 | 3730 | else |
michael@0 | 3731 | { |
michael@0 | 3732 | concat_name = |
michael@0 | 3733 | XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); |
michael@0 | 3734 | memcpy (concat_name, p, p_len); |
michael@0 | 3735 | concat_name[p_len] = '/'; |
michael@0 | 3736 | strcpy (concat_name + p_len + 1, wrapper); |
michael@0 | 3737 | } |
michael@0 | 3738 | if (check_executable (concat_name)) |
michael@0 | 3739 | return concat_name; |
michael@0 | 3740 | XFREE (concat_name); |
michael@0 | 3741 | } |
michael@0 | 3742 | } |
michael@0 | 3743 | /* not found in PATH; assume curdir */ |
michael@0 | 3744 | } |
michael@0 | 3745 | /* Relative path | not found in path: prepend cwd */ |
michael@0 | 3746 | if (getcwd (tmp, LT_PATHMAX) == NULL) |
michael@0 | 3747 | lt_fatal ("getcwd failed"); |
michael@0 | 3748 | tmp_len = strlen (tmp); |
michael@0 | 3749 | concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); |
michael@0 | 3750 | memcpy (concat_name, tmp, tmp_len); |
michael@0 | 3751 | concat_name[tmp_len] = '/'; |
michael@0 | 3752 | strcpy (concat_name + tmp_len + 1, wrapper); |
michael@0 | 3753 | |
michael@0 | 3754 | if (check_executable (concat_name)) |
michael@0 | 3755 | return concat_name; |
michael@0 | 3756 | XFREE (concat_name); |
michael@0 | 3757 | return NULL; |
michael@0 | 3758 | } |
michael@0 | 3759 | |
michael@0 | 3760 | char * |
michael@0 | 3761 | chase_symlinks (const char *pathspec) |
michael@0 | 3762 | { |
michael@0 | 3763 | #ifndef S_ISLNK |
michael@0 | 3764 | return xstrdup (pathspec); |
michael@0 | 3765 | #else |
michael@0 | 3766 | char buf[LT_PATHMAX]; |
michael@0 | 3767 | struct stat s; |
michael@0 | 3768 | char *tmp_pathspec = xstrdup (pathspec); |
michael@0 | 3769 | char *p; |
michael@0 | 3770 | int has_symlinks = 0; |
michael@0 | 3771 | while (strlen (tmp_pathspec) && !has_symlinks) |
michael@0 | 3772 | { |
michael@0 | 3773 | LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", |
michael@0 | 3774 | tmp_pathspec)); |
michael@0 | 3775 | if (lstat (tmp_pathspec, &s) == 0) |
michael@0 | 3776 | { |
michael@0 | 3777 | if (S_ISLNK (s.st_mode) != 0) |
michael@0 | 3778 | { |
michael@0 | 3779 | has_symlinks = 1; |
michael@0 | 3780 | break; |
michael@0 | 3781 | } |
michael@0 | 3782 | |
michael@0 | 3783 | /* search backwards for last DIR_SEPARATOR */ |
michael@0 | 3784 | p = tmp_pathspec + strlen (tmp_pathspec) - 1; |
michael@0 | 3785 | while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
michael@0 | 3786 | p--; |
michael@0 | 3787 | if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) |
michael@0 | 3788 | { |
michael@0 | 3789 | /* no more DIR_SEPARATORS left */ |
michael@0 | 3790 | break; |
michael@0 | 3791 | } |
michael@0 | 3792 | *p = '\0'; |
michael@0 | 3793 | } |
michael@0 | 3794 | else |
michael@0 | 3795 | { |
michael@0 | 3796 | char *errstr = strerror (errno); |
michael@0 | 3797 | lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); |
michael@0 | 3798 | } |
michael@0 | 3799 | } |
michael@0 | 3800 | XFREE (tmp_pathspec); |
michael@0 | 3801 | |
michael@0 | 3802 | if (!has_symlinks) |
michael@0 | 3803 | { |
michael@0 | 3804 | return xstrdup (pathspec); |
michael@0 | 3805 | } |
michael@0 | 3806 | |
michael@0 | 3807 | tmp_pathspec = realpath (pathspec, buf); |
michael@0 | 3808 | if (tmp_pathspec == 0) |
michael@0 | 3809 | { |
michael@0 | 3810 | lt_fatal ("Could not follow symlinks for %s", pathspec); |
michael@0 | 3811 | } |
michael@0 | 3812 | return xstrdup (tmp_pathspec); |
michael@0 | 3813 | #endif |
michael@0 | 3814 | } |
michael@0 | 3815 | |
michael@0 | 3816 | char * |
michael@0 | 3817 | strendzap (char *str, const char *pat) |
michael@0 | 3818 | { |
michael@0 | 3819 | size_t len, patlen; |
michael@0 | 3820 | |
michael@0 | 3821 | assert (str != NULL); |
michael@0 | 3822 | assert (pat != NULL); |
michael@0 | 3823 | |
michael@0 | 3824 | len = strlen (str); |
michael@0 | 3825 | patlen = strlen (pat); |
michael@0 | 3826 | |
michael@0 | 3827 | if (patlen <= len) |
michael@0 | 3828 | { |
michael@0 | 3829 | str += len - patlen; |
michael@0 | 3830 | if (strcmp (str, pat) == 0) |
michael@0 | 3831 | *str = '\0'; |
michael@0 | 3832 | } |
michael@0 | 3833 | return str; |
michael@0 | 3834 | } |
michael@0 | 3835 | |
michael@0 | 3836 | static void |
michael@0 | 3837 | lt_error_core (int exit_status, const char *mode, |
michael@0 | 3838 | const char *message, va_list ap) |
michael@0 | 3839 | { |
michael@0 | 3840 | fprintf (stderr, "%s: %s: ", program_name, mode); |
michael@0 | 3841 | vfprintf (stderr, message, ap); |
michael@0 | 3842 | fprintf (stderr, ".\n"); |
michael@0 | 3843 | |
michael@0 | 3844 | if (exit_status >= 0) |
michael@0 | 3845 | exit (exit_status); |
michael@0 | 3846 | } |
michael@0 | 3847 | |
michael@0 | 3848 | void |
michael@0 | 3849 | lt_fatal (const char *message, ...) |
michael@0 | 3850 | { |
michael@0 | 3851 | va_list ap; |
michael@0 | 3852 | va_start (ap, message); |
michael@0 | 3853 | lt_error_core (EXIT_FAILURE, "FATAL", message, ap); |
michael@0 | 3854 | va_end (ap); |
michael@0 | 3855 | } |
michael@0 | 3856 | |
michael@0 | 3857 | void |
michael@0 | 3858 | lt_setenv (const char *name, const char *value) |
michael@0 | 3859 | { |
michael@0 | 3860 | LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", |
michael@0 | 3861 | (name ? name : "<NULL>"), |
michael@0 | 3862 | (value ? value : "<NULL>"))); |
michael@0 | 3863 | { |
michael@0 | 3864 | #ifdef HAVE_SETENV |
michael@0 | 3865 | /* always make a copy, for consistency with !HAVE_SETENV */ |
michael@0 | 3866 | char *str = xstrdup (value); |
michael@0 | 3867 | setenv (name, str, 1); |
michael@0 | 3868 | #else |
michael@0 | 3869 | int len = strlen (name) + 1 + strlen (value) + 1; |
michael@0 | 3870 | char *str = XMALLOC (char, len); |
michael@0 | 3871 | sprintf (str, "%s=%s", name, value); |
michael@0 | 3872 | if (putenv (str) != EXIT_SUCCESS) |
michael@0 | 3873 | { |
michael@0 | 3874 | XFREE (str); |
michael@0 | 3875 | } |
michael@0 | 3876 | #endif |
michael@0 | 3877 | } |
michael@0 | 3878 | } |
michael@0 | 3879 | |
michael@0 | 3880 | char * |
michael@0 | 3881 | lt_extend_str (const char *orig_value, const char *add, int to_end) |
michael@0 | 3882 | { |
michael@0 | 3883 | char *new_value; |
michael@0 | 3884 | if (orig_value && *orig_value) |
michael@0 | 3885 | { |
michael@0 | 3886 | int orig_value_len = strlen (orig_value); |
michael@0 | 3887 | int add_len = strlen (add); |
michael@0 | 3888 | new_value = XMALLOC (char, add_len + orig_value_len + 1); |
michael@0 | 3889 | if (to_end) |
michael@0 | 3890 | { |
michael@0 | 3891 | strcpy (new_value, orig_value); |
michael@0 | 3892 | strcpy (new_value + orig_value_len, add); |
michael@0 | 3893 | } |
michael@0 | 3894 | else |
michael@0 | 3895 | { |
michael@0 | 3896 | strcpy (new_value, add); |
michael@0 | 3897 | strcpy (new_value + add_len, orig_value); |
michael@0 | 3898 | } |
michael@0 | 3899 | } |
michael@0 | 3900 | else |
michael@0 | 3901 | { |
michael@0 | 3902 | new_value = xstrdup (add); |
michael@0 | 3903 | } |
michael@0 | 3904 | return new_value; |
michael@0 | 3905 | } |
michael@0 | 3906 | |
michael@0 | 3907 | int |
michael@0 | 3908 | lt_split_name_value (const char *arg, char** name, char** value) |
michael@0 | 3909 | { |
michael@0 | 3910 | const char *p; |
michael@0 | 3911 | int len; |
michael@0 | 3912 | if (!arg || !*arg) |
michael@0 | 3913 | return 1; |
michael@0 | 3914 | |
michael@0 | 3915 | p = strchr (arg, (int)'='); |
michael@0 | 3916 | |
michael@0 | 3917 | if (!p) |
michael@0 | 3918 | return 1; |
michael@0 | 3919 | |
michael@0 | 3920 | *value = xstrdup (++p); |
michael@0 | 3921 | |
michael@0 | 3922 | len = strlen (arg) - strlen (*value); |
michael@0 | 3923 | *name = XMALLOC (char, len); |
michael@0 | 3924 | strncpy (*name, arg, len-1); |
michael@0 | 3925 | (*name)[len - 1] = '\0'; |
michael@0 | 3926 | |
michael@0 | 3927 | return 0; |
michael@0 | 3928 | } |
michael@0 | 3929 | |
michael@0 | 3930 | void |
michael@0 | 3931 | lt_opt_process_env_set (const char *arg) |
michael@0 | 3932 | { |
michael@0 | 3933 | char *name = NULL; |
michael@0 | 3934 | char *value = NULL; |
michael@0 | 3935 | |
michael@0 | 3936 | if (lt_split_name_value (arg, &name, &value) != 0) |
michael@0 | 3937 | { |
michael@0 | 3938 | XFREE (name); |
michael@0 | 3939 | XFREE (value); |
michael@0 | 3940 | lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); |
michael@0 | 3941 | } |
michael@0 | 3942 | |
michael@0 | 3943 | lt_setenv (name, value); |
michael@0 | 3944 | XFREE (name); |
michael@0 | 3945 | XFREE (value); |
michael@0 | 3946 | } |
michael@0 | 3947 | |
michael@0 | 3948 | void |
michael@0 | 3949 | lt_opt_process_env_prepend (const char *arg) |
michael@0 | 3950 | { |
michael@0 | 3951 | char *name = NULL; |
michael@0 | 3952 | char *value = NULL; |
michael@0 | 3953 | char *new_value = NULL; |
michael@0 | 3954 | |
michael@0 | 3955 | if (lt_split_name_value (arg, &name, &value) != 0) |
michael@0 | 3956 | { |
michael@0 | 3957 | XFREE (name); |
michael@0 | 3958 | XFREE (value); |
michael@0 | 3959 | lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); |
michael@0 | 3960 | } |
michael@0 | 3961 | |
michael@0 | 3962 | new_value = lt_extend_str (getenv (name), value, 0); |
michael@0 | 3963 | lt_setenv (name, new_value); |
michael@0 | 3964 | XFREE (new_value); |
michael@0 | 3965 | XFREE (name); |
michael@0 | 3966 | XFREE (value); |
michael@0 | 3967 | } |
michael@0 | 3968 | |
michael@0 | 3969 | void |
michael@0 | 3970 | lt_opt_process_env_append (const char *arg) |
michael@0 | 3971 | { |
michael@0 | 3972 | char *name = NULL; |
michael@0 | 3973 | char *value = NULL; |
michael@0 | 3974 | char *new_value = NULL; |
michael@0 | 3975 | |
michael@0 | 3976 | if (lt_split_name_value (arg, &name, &value) != 0) |
michael@0 | 3977 | { |
michael@0 | 3978 | XFREE (name); |
michael@0 | 3979 | XFREE (value); |
michael@0 | 3980 | lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); |
michael@0 | 3981 | } |
michael@0 | 3982 | |
michael@0 | 3983 | new_value = lt_extend_str (getenv (name), value, 1); |
michael@0 | 3984 | lt_setenv (name, new_value); |
michael@0 | 3985 | XFREE (new_value); |
michael@0 | 3986 | XFREE (name); |
michael@0 | 3987 | XFREE (value); |
michael@0 | 3988 | } |
michael@0 | 3989 | |
michael@0 | 3990 | void |
michael@0 | 3991 | lt_update_exe_path (const char *name, const char *value) |
michael@0 | 3992 | { |
michael@0 | 3993 | LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", |
michael@0 | 3994 | (name ? name : "<NULL>"), |
michael@0 | 3995 | (value ? value : "<NULL>"))); |
michael@0 | 3996 | |
michael@0 | 3997 | if (name && *name && value && *value) |
michael@0 | 3998 | { |
michael@0 | 3999 | char *new_value = lt_extend_str (getenv (name), value, 0); |
michael@0 | 4000 | /* some systems can't cope with a ':'-terminated path #' */ |
michael@0 | 4001 | int len = strlen (new_value); |
michael@0 | 4002 | while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) |
michael@0 | 4003 | { |
michael@0 | 4004 | new_value[len-1] = '\0'; |
michael@0 | 4005 | } |
michael@0 | 4006 | lt_setenv (name, new_value); |
michael@0 | 4007 | XFREE (new_value); |
michael@0 | 4008 | } |
michael@0 | 4009 | } |
michael@0 | 4010 | |
michael@0 | 4011 | void |
michael@0 | 4012 | lt_update_lib_path (const char *name, const char *value) |
michael@0 | 4013 | { |
michael@0 | 4014 | LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", |
michael@0 | 4015 | (name ? name : "<NULL>"), |
michael@0 | 4016 | (value ? value : "<NULL>"))); |
michael@0 | 4017 | |
michael@0 | 4018 | if (name && *name && value && *value) |
michael@0 | 4019 | { |
michael@0 | 4020 | char *new_value = lt_extend_str (getenv (name), value, 0); |
michael@0 | 4021 | lt_setenv (name, new_value); |
michael@0 | 4022 | XFREE (new_value); |
michael@0 | 4023 | } |
michael@0 | 4024 | } |
michael@0 | 4025 | |
michael@0 | 4026 | |
michael@0 | 4027 | EOF |
michael@0 | 4028 | } |
michael@0 | 4029 | # end: func_emit_cwrapperexe_src |
michael@0 | 4030 | |
michael@0 | 4031 | # func_mode_link arg... |
michael@0 | 4032 | func_mode_link () |
michael@0 | 4033 | { |
michael@0 | 4034 | $opt_debug |
michael@0 | 4035 | case $host in |
michael@0 | 4036 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
michael@0 | 4037 | # It is impossible to link a dll without this setting, and |
michael@0 | 4038 | # we shouldn't force the makefile maintainer to figure out |
michael@0 | 4039 | # which system we are compiling for in order to pass an extra |
michael@0 | 4040 | # flag for every libtool invocation. |
michael@0 | 4041 | # allow_undefined=no |
michael@0 | 4042 | |
michael@0 | 4043 | # FIXME: Unfortunately, there are problems with the above when trying |
michael@0 | 4044 | # to make a dll which has undefined symbols, in which case not |
michael@0 | 4045 | # even a static library is built. For now, we need to specify |
michael@0 | 4046 | # -no-undefined on the libtool link line when we can be certain |
michael@0 | 4047 | # that all symbols are satisfied, otherwise we get a static library. |
michael@0 | 4048 | allow_undefined=yes |
michael@0 | 4049 | ;; |
michael@0 | 4050 | *) |
michael@0 | 4051 | allow_undefined=yes |
michael@0 | 4052 | ;; |
michael@0 | 4053 | esac |
michael@0 | 4054 | libtool_args=$nonopt |
michael@0 | 4055 | base_compile="$nonopt $@" |
michael@0 | 4056 | compile_command=$nonopt |
michael@0 | 4057 | finalize_command=$nonopt |
michael@0 | 4058 | |
michael@0 | 4059 | compile_rpath= |
michael@0 | 4060 | finalize_rpath= |
michael@0 | 4061 | compile_shlibpath= |
michael@0 | 4062 | finalize_shlibpath= |
michael@0 | 4063 | convenience= |
michael@0 | 4064 | old_convenience= |
michael@0 | 4065 | deplibs= |
michael@0 | 4066 | old_deplibs= |
michael@0 | 4067 | compiler_flags= |
michael@0 | 4068 | linker_flags= |
michael@0 | 4069 | dllsearchpath= |
michael@0 | 4070 | lib_search_path=`pwd` |
michael@0 | 4071 | inst_prefix_dir= |
michael@0 | 4072 | new_inherited_linker_flags= |
michael@0 | 4073 | |
michael@0 | 4074 | avoid_version=no |
michael@0 | 4075 | dlfiles= |
michael@0 | 4076 | dlprefiles= |
michael@0 | 4077 | dlself=no |
michael@0 | 4078 | export_dynamic=no |
michael@0 | 4079 | export_symbols= |
michael@0 | 4080 | export_symbols_regex= |
michael@0 | 4081 | generated= |
michael@0 | 4082 | libobjs= |
michael@0 | 4083 | ltlibs= |
michael@0 | 4084 | module=no |
michael@0 | 4085 | no_install=no |
michael@0 | 4086 | objs= |
michael@0 | 4087 | non_pic_objects= |
michael@0 | 4088 | precious_files_regex= |
michael@0 | 4089 | prefer_static_libs=no |
michael@0 | 4090 | preload=no |
michael@0 | 4091 | prev= |
michael@0 | 4092 | prevarg= |
michael@0 | 4093 | release= |
michael@0 | 4094 | rpath= |
michael@0 | 4095 | xrpath= |
michael@0 | 4096 | perm_rpath= |
michael@0 | 4097 | temp_rpath= |
michael@0 | 4098 | thread_safe=no |
michael@0 | 4099 | vinfo= |
michael@0 | 4100 | vinfo_number=no |
michael@0 | 4101 | weak_libs= |
michael@0 | 4102 | single_module="${wl}-single_module" |
michael@0 | 4103 | func_infer_tag $base_compile |
michael@0 | 4104 | |
michael@0 | 4105 | # We need to know -static, to get the right output filenames. |
michael@0 | 4106 | for arg |
michael@0 | 4107 | do |
michael@0 | 4108 | case $arg in |
michael@0 | 4109 | -shared) |
michael@0 | 4110 | test "$build_libtool_libs" != yes && \ |
michael@0 | 4111 | func_fatal_configuration "can not build a shared library" |
michael@0 | 4112 | build_old_libs=no |
michael@0 | 4113 | break |
michael@0 | 4114 | ;; |
michael@0 | 4115 | -all-static | -static | -static-libtool-libs) |
michael@0 | 4116 | case $arg in |
michael@0 | 4117 | -all-static) |
michael@0 | 4118 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then |
michael@0 | 4119 | func_warning "complete static linking is impossible in this configuration" |
michael@0 | 4120 | fi |
michael@0 | 4121 | if test -n "$link_static_flag"; then |
michael@0 | 4122 | dlopen_self=$dlopen_self_static |
michael@0 | 4123 | fi |
michael@0 | 4124 | prefer_static_libs=yes |
michael@0 | 4125 | ;; |
michael@0 | 4126 | -static) |
michael@0 | 4127 | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
michael@0 | 4128 | dlopen_self=$dlopen_self_static |
michael@0 | 4129 | fi |
michael@0 | 4130 | prefer_static_libs=built |
michael@0 | 4131 | ;; |
michael@0 | 4132 | -static-libtool-libs) |
michael@0 | 4133 | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
michael@0 | 4134 | dlopen_self=$dlopen_self_static |
michael@0 | 4135 | fi |
michael@0 | 4136 | prefer_static_libs=yes |
michael@0 | 4137 | ;; |
michael@0 | 4138 | esac |
michael@0 | 4139 | build_libtool_libs=no |
michael@0 | 4140 | build_old_libs=yes |
michael@0 | 4141 | break |
michael@0 | 4142 | ;; |
michael@0 | 4143 | esac |
michael@0 | 4144 | done |
michael@0 | 4145 | |
michael@0 | 4146 | # See if our shared archives depend on static archives. |
michael@0 | 4147 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
michael@0 | 4148 | |
michael@0 | 4149 | # Go through the arguments, transforming them on the way. |
michael@0 | 4150 | while test "$#" -gt 0; do |
michael@0 | 4151 | arg="$1" |
michael@0 | 4152 | shift |
michael@0 | 4153 | func_quote_for_eval "$arg" |
michael@0 | 4154 | qarg=$func_quote_for_eval_unquoted_result |
michael@0 | 4155 | func_append libtool_args " $func_quote_for_eval_result" |
michael@0 | 4156 | |
michael@0 | 4157 | # If the previous option needs an argument, assign it. |
michael@0 | 4158 | if test -n "$prev"; then |
michael@0 | 4159 | case $prev in |
michael@0 | 4160 | output) |
michael@0 | 4161 | func_append compile_command " @OUTPUT@" |
michael@0 | 4162 | func_append finalize_command " @OUTPUT@" |
michael@0 | 4163 | ;; |
michael@0 | 4164 | esac |
michael@0 | 4165 | |
michael@0 | 4166 | case $prev in |
michael@0 | 4167 | dlfiles|dlprefiles) |
michael@0 | 4168 | if test "$preload" = no; then |
michael@0 | 4169 | # Add the symbol object into the linking commands. |
michael@0 | 4170 | func_append compile_command " @SYMFILE@" |
michael@0 | 4171 | func_append finalize_command " @SYMFILE@" |
michael@0 | 4172 | preload=yes |
michael@0 | 4173 | fi |
michael@0 | 4174 | case $arg in |
michael@0 | 4175 | *.la | *.lo) ;; # We handle these cases below. |
michael@0 | 4176 | force) |
michael@0 | 4177 | if test "$dlself" = no; then |
michael@0 | 4178 | dlself=needless |
michael@0 | 4179 | export_dynamic=yes |
michael@0 | 4180 | fi |
michael@0 | 4181 | prev= |
michael@0 | 4182 | continue |
michael@0 | 4183 | ;; |
michael@0 | 4184 | self) |
michael@0 | 4185 | if test "$prev" = dlprefiles; then |
michael@0 | 4186 | dlself=yes |
michael@0 | 4187 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then |
michael@0 | 4188 | dlself=yes |
michael@0 | 4189 | else |
michael@0 | 4190 | dlself=needless |
michael@0 | 4191 | export_dynamic=yes |
michael@0 | 4192 | fi |
michael@0 | 4193 | prev= |
michael@0 | 4194 | continue |
michael@0 | 4195 | ;; |
michael@0 | 4196 | *) |
michael@0 | 4197 | if test "$prev" = dlfiles; then |
michael@0 | 4198 | dlfiles="$dlfiles $arg" |
michael@0 | 4199 | else |
michael@0 | 4200 | dlprefiles="$dlprefiles $arg" |
michael@0 | 4201 | fi |
michael@0 | 4202 | prev= |
michael@0 | 4203 | continue |
michael@0 | 4204 | ;; |
michael@0 | 4205 | esac |
michael@0 | 4206 | ;; |
michael@0 | 4207 | expsyms) |
michael@0 | 4208 | export_symbols="$arg" |
michael@0 | 4209 | test -f "$arg" \ |
michael@0 | 4210 | || func_fatal_error "symbol file \`$arg' does not exist" |
michael@0 | 4211 | prev= |
michael@0 | 4212 | continue |
michael@0 | 4213 | ;; |
michael@0 | 4214 | expsyms_regex) |
michael@0 | 4215 | export_symbols_regex="$arg" |
michael@0 | 4216 | prev= |
michael@0 | 4217 | continue |
michael@0 | 4218 | ;; |
michael@0 | 4219 | framework) |
michael@0 | 4220 | case $host in |
michael@0 | 4221 | *-*-darwin*) |
michael@0 | 4222 | case "$deplibs " in |
michael@0 | 4223 | *" $qarg.ltframework "*) ;; |
michael@0 | 4224 | *) deplibs="$deplibs $qarg.ltframework" # this is fixed later |
michael@0 | 4225 | ;; |
michael@0 | 4226 | esac |
michael@0 | 4227 | ;; |
michael@0 | 4228 | esac |
michael@0 | 4229 | prev= |
michael@0 | 4230 | continue |
michael@0 | 4231 | ;; |
michael@0 | 4232 | inst_prefix) |
michael@0 | 4233 | inst_prefix_dir="$arg" |
michael@0 | 4234 | prev= |
michael@0 | 4235 | continue |
michael@0 | 4236 | ;; |
michael@0 | 4237 | objectlist) |
michael@0 | 4238 | if test -f "$arg"; then |
michael@0 | 4239 | save_arg=$arg |
michael@0 | 4240 | moreargs= |
michael@0 | 4241 | for fil in `cat "$save_arg"` |
michael@0 | 4242 | do |
michael@0 | 4243 | # moreargs="$moreargs $fil" |
michael@0 | 4244 | arg=$fil |
michael@0 | 4245 | # A libtool-controlled object. |
michael@0 | 4246 | |
michael@0 | 4247 | # Check to see that this really is a libtool object. |
michael@0 | 4248 | if func_lalib_unsafe_p "$arg"; then |
michael@0 | 4249 | pic_object= |
michael@0 | 4250 | non_pic_object= |
michael@0 | 4251 | |
michael@0 | 4252 | # Read the .lo file |
michael@0 | 4253 | func_source "$arg" |
michael@0 | 4254 | |
michael@0 | 4255 | if test -z "$pic_object" || |
michael@0 | 4256 | test -z "$non_pic_object" || |
michael@0 | 4257 | test "$pic_object" = none && |
michael@0 | 4258 | test "$non_pic_object" = none; then |
michael@0 | 4259 | func_fatal_error "cannot find name of object for \`$arg'" |
michael@0 | 4260 | fi |
michael@0 | 4261 | |
michael@0 | 4262 | # Extract subdirectory from the argument. |
michael@0 | 4263 | func_dirname "$arg" "/" "" |
michael@0 | 4264 | xdir="$func_dirname_result" |
michael@0 | 4265 | |
michael@0 | 4266 | if test "$pic_object" != none; then |
michael@0 | 4267 | # Prepend the subdirectory the object is found in. |
michael@0 | 4268 | pic_object="$xdir$pic_object" |
michael@0 | 4269 | |
michael@0 | 4270 | if test "$prev" = dlfiles; then |
michael@0 | 4271 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
michael@0 | 4272 | dlfiles="$dlfiles $pic_object" |
michael@0 | 4273 | prev= |
michael@0 | 4274 | continue |
michael@0 | 4275 | else |
michael@0 | 4276 | # If libtool objects are unsupported, then we need to preload. |
michael@0 | 4277 | prev=dlprefiles |
michael@0 | 4278 | fi |
michael@0 | 4279 | fi |
michael@0 | 4280 | |
michael@0 | 4281 | # CHECK ME: I think I busted this. -Ossama |
michael@0 | 4282 | if test "$prev" = dlprefiles; then |
michael@0 | 4283 | # Preload the old-style object. |
michael@0 | 4284 | dlprefiles="$dlprefiles $pic_object" |
michael@0 | 4285 | prev= |
michael@0 | 4286 | fi |
michael@0 | 4287 | |
michael@0 | 4288 | # A PIC object. |
michael@0 | 4289 | func_append libobjs " $pic_object" |
michael@0 | 4290 | arg="$pic_object" |
michael@0 | 4291 | fi |
michael@0 | 4292 | |
michael@0 | 4293 | # Non-PIC object. |
michael@0 | 4294 | if test "$non_pic_object" != none; then |
michael@0 | 4295 | # Prepend the subdirectory the object is found in. |
michael@0 | 4296 | non_pic_object="$xdir$non_pic_object" |
michael@0 | 4297 | |
michael@0 | 4298 | # A standard non-PIC object |
michael@0 | 4299 | func_append non_pic_objects " $non_pic_object" |
michael@0 | 4300 | if test -z "$pic_object" || test "$pic_object" = none ; then |
michael@0 | 4301 | arg="$non_pic_object" |
michael@0 | 4302 | fi |
michael@0 | 4303 | else |
michael@0 | 4304 | # If the PIC object exists, use it instead. |
michael@0 | 4305 | # $xdir was prepended to $pic_object above. |
michael@0 | 4306 | non_pic_object="$pic_object" |
michael@0 | 4307 | func_append non_pic_objects " $non_pic_object" |
michael@0 | 4308 | fi |
michael@0 | 4309 | else |
michael@0 | 4310 | # Only an error if not doing a dry-run. |
michael@0 | 4311 | if $opt_dry_run; then |
michael@0 | 4312 | # Extract subdirectory from the argument. |
michael@0 | 4313 | func_dirname "$arg" "/" "" |
michael@0 | 4314 | xdir="$func_dirname_result" |
michael@0 | 4315 | |
michael@0 | 4316 | func_lo2o "$arg" |
michael@0 | 4317 | pic_object=$xdir$objdir/$func_lo2o_result |
michael@0 | 4318 | non_pic_object=$xdir$func_lo2o_result |
michael@0 | 4319 | func_append libobjs " $pic_object" |
michael@0 | 4320 | func_append non_pic_objects " $non_pic_object" |
michael@0 | 4321 | else |
michael@0 | 4322 | func_fatal_error "\`$arg' is not a valid libtool object" |
michael@0 | 4323 | fi |
michael@0 | 4324 | fi |
michael@0 | 4325 | done |
michael@0 | 4326 | else |
michael@0 | 4327 | func_fatal_error "link input file \`$arg' does not exist" |
michael@0 | 4328 | fi |
michael@0 | 4329 | arg=$save_arg |
michael@0 | 4330 | prev= |
michael@0 | 4331 | continue |
michael@0 | 4332 | ;; |
michael@0 | 4333 | precious_regex) |
michael@0 | 4334 | precious_files_regex="$arg" |
michael@0 | 4335 | prev= |
michael@0 | 4336 | continue |
michael@0 | 4337 | ;; |
michael@0 | 4338 | release) |
michael@0 | 4339 | release="-$arg" |
michael@0 | 4340 | prev= |
michael@0 | 4341 | continue |
michael@0 | 4342 | ;; |
michael@0 | 4343 | rpath | xrpath) |
michael@0 | 4344 | # We need an absolute path. |
michael@0 | 4345 | case $arg in |
michael@0 | 4346 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
michael@0 | 4347 | *) |
michael@0 | 4348 | func_fatal_error "only absolute run-paths are allowed" |
michael@0 | 4349 | ;; |
michael@0 | 4350 | esac |
michael@0 | 4351 | if test "$prev" = rpath; then |
michael@0 | 4352 | case "$rpath " in |
michael@0 | 4353 | *" $arg "*) ;; |
michael@0 | 4354 | *) rpath="$rpath $arg" ;; |
michael@0 | 4355 | esac |
michael@0 | 4356 | else |
michael@0 | 4357 | case "$xrpath " in |
michael@0 | 4358 | *" $arg "*) ;; |
michael@0 | 4359 | *) xrpath="$xrpath $arg" ;; |
michael@0 | 4360 | esac |
michael@0 | 4361 | fi |
michael@0 | 4362 | prev= |
michael@0 | 4363 | continue |
michael@0 | 4364 | ;; |
michael@0 | 4365 | shrext) |
michael@0 | 4366 | shrext_cmds="$arg" |
michael@0 | 4367 | prev= |
michael@0 | 4368 | continue |
michael@0 | 4369 | ;; |
michael@0 | 4370 | weak) |
michael@0 | 4371 | weak_libs="$weak_libs $arg" |
michael@0 | 4372 | prev= |
michael@0 | 4373 | continue |
michael@0 | 4374 | ;; |
michael@0 | 4375 | xcclinker) |
michael@0 | 4376 | linker_flags="$linker_flags $qarg" |
michael@0 | 4377 | compiler_flags="$compiler_flags $qarg" |
michael@0 | 4378 | prev= |
michael@0 | 4379 | func_append compile_command " $qarg" |
michael@0 | 4380 | func_append finalize_command " $qarg" |
michael@0 | 4381 | continue |
michael@0 | 4382 | ;; |
michael@0 | 4383 | xcompiler) |
michael@0 | 4384 | compiler_flags="$compiler_flags $qarg" |
michael@0 | 4385 | prev= |
michael@0 | 4386 | func_append compile_command " $qarg" |
michael@0 | 4387 | func_append finalize_command " $qarg" |
michael@0 | 4388 | continue |
michael@0 | 4389 | ;; |
michael@0 | 4390 | xlinker) |
michael@0 | 4391 | linker_flags="$linker_flags $qarg" |
michael@0 | 4392 | compiler_flags="$compiler_flags $wl$qarg" |
michael@0 | 4393 | prev= |
michael@0 | 4394 | func_append compile_command " $wl$qarg" |
michael@0 | 4395 | func_append finalize_command " $wl$qarg" |
michael@0 | 4396 | continue |
michael@0 | 4397 | ;; |
michael@0 | 4398 | *) |
michael@0 | 4399 | eval "$prev=\"\$arg\"" |
michael@0 | 4400 | prev= |
michael@0 | 4401 | continue |
michael@0 | 4402 | ;; |
michael@0 | 4403 | esac |
michael@0 | 4404 | fi # test -n "$prev" |
michael@0 | 4405 | |
michael@0 | 4406 | prevarg="$arg" |
michael@0 | 4407 | |
michael@0 | 4408 | case $arg in |
michael@0 | 4409 | -all-static) |
michael@0 | 4410 | if test -n "$link_static_flag"; then |
michael@0 | 4411 | # See comment for -static flag below, for more details. |
michael@0 | 4412 | func_append compile_command " $link_static_flag" |
michael@0 | 4413 | func_append finalize_command " $link_static_flag" |
michael@0 | 4414 | fi |
michael@0 | 4415 | continue |
michael@0 | 4416 | ;; |
michael@0 | 4417 | |
michael@0 | 4418 | -allow-undefined) |
michael@0 | 4419 | # FIXME: remove this flag sometime in the future. |
michael@0 | 4420 | func_fatal_error "\`-allow-undefined' must not be used because it is the default" |
michael@0 | 4421 | ;; |
michael@0 | 4422 | |
michael@0 | 4423 | -avoid-version) |
michael@0 | 4424 | avoid_version=yes |
michael@0 | 4425 | continue |
michael@0 | 4426 | ;; |
michael@0 | 4427 | |
michael@0 | 4428 | -dlopen) |
michael@0 | 4429 | prev=dlfiles |
michael@0 | 4430 | continue |
michael@0 | 4431 | ;; |
michael@0 | 4432 | |
michael@0 | 4433 | -dlpreopen) |
michael@0 | 4434 | prev=dlprefiles |
michael@0 | 4435 | continue |
michael@0 | 4436 | ;; |
michael@0 | 4437 | |
michael@0 | 4438 | -export-dynamic) |
michael@0 | 4439 | export_dynamic=yes |
michael@0 | 4440 | continue |
michael@0 | 4441 | ;; |
michael@0 | 4442 | |
michael@0 | 4443 | -export-symbols | -export-symbols-regex) |
michael@0 | 4444 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
michael@0 | 4445 | func_fatal_error "more than one -exported-symbols argument is not allowed" |
michael@0 | 4446 | fi |
michael@0 | 4447 | if test "X$arg" = "X-export-symbols"; then |
michael@0 | 4448 | prev=expsyms |
michael@0 | 4449 | else |
michael@0 | 4450 | prev=expsyms_regex |
michael@0 | 4451 | fi |
michael@0 | 4452 | continue |
michael@0 | 4453 | ;; |
michael@0 | 4454 | |
michael@0 | 4455 | -framework) |
michael@0 | 4456 | prev=framework |
michael@0 | 4457 | continue |
michael@0 | 4458 | ;; |
michael@0 | 4459 | |
michael@0 | 4460 | -inst-prefix-dir) |
michael@0 | 4461 | prev=inst_prefix |
michael@0 | 4462 | continue |
michael@0 | 4463 | ;; |
michael@0 | 4464 | |
michael@0 | 4465 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
michael@0 | 4466 | # so, if we see these flags be careful not to treat them like -L |
michael@0 | 4467 | -L[A-Z][A-Z]*:*) |
michael@0 | 4468 | case $with_gcc/$host in |
michael@0 | 4469 | no/*-*-irix* | /*-*-irix*) |
michael@0 | 4470 | func_append compile_command " $arg" |
michael@0 | 4471 | func_append finalize_command " $arg" |
michael@0 | 4472 | ;; |
michael@0 | 4473 | esac |
michael@0 | 4474 | continue |
michael@0 | 4475 | ;; |
michael@0 | 4476 | |
michael@0 | 4477 | -L*) |
michael@0 | 4478 | func_stripname '-L' '' "$arg" |
michael@0 | 4479 | dir=$func_stripname_result |
michael@0 | 4480 | if test -z "$dir"; then |
michael@0 | 4481 | if test "$#" -gt 0; then |
michael@0 | 4482 | func_fatal_error "require no space between \`-L' and \`$1'" |
michael@0 | 4483 | else |
michael@0 | 4484 | func_fatal_error "need path for \`-L' option" |
michael@0 | 4485 | fi |
michael@0 | 4486 | fi |
michael@0 | 4487 | # We need an absolute path. |
michael@0 | 4488 | case $dir in |
michael@0 | 4489 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
michael@0 | 4490 | *) |
michael@0 | 4491 | absdir=`cd "$dir" && pwd` |
michael@0 | 4492 | test -z "$absdir" && \ |
michael@0 | 4493 | func_fatal_error "cannot determine absolute directory name of \`$dir'" |
michael@0 | 4494 | dir="$absdir" |
michael@0 | 4495 | ;; |
michael@0 | 4496 | esac |
michael@0 | 4497 | case "$deplibs " in |
michael@0 | 4498 | *" -L$dir "*) ;; |
michael@0 | 4499 | *) |
michael@0 | 4500 | deplibs="$deplibs -L$dir" |
michael@0 | 4501 | lib_search_path="$lib_search_path $dir" |
michael@0 | 4502 | ;; |
michael@0 | 4503 | esac |
michael@0 | 4504 | case $host in |
michael@0 | 4505 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
michael@0 | 4506 | testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` |
michael@0 | 4507 | case :$dllsearchpath: in |
michael@0 | 4508 | *":$dir:"*) ;; |
michael@0 | 4509 | ::) dllsearchpath=$dir;; |
michael@0 | 4510 | *) dllsearchpath="$dllsearchpath:$dir";; |
michael@0 | 4511 | esac |
michael@0 | 4512 | case :$dllsearchpath: in |
michael@0 | 4513 | *":$testbindir:"*) ;; |
michael@0 | 4514 | ::) dllsearchpath=$testbindir;; |
michael@0 | 4515 | *) dllsearchpath="$dllsearchpath:$testbindir";; |
michael@0 | 4516 | esac |
michael@0 | 4517 | ;; |
michael@0 | 4518 | esac |
michael@0 | 4519 | continue |
michael@0 | 4520 | ;; |
michael@0 | 4521 | |
michael@0 | 4522 | -l*) |
michael@0 | 4523 | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then |
michael@0 | 4524 | case $host in |
michael@0 | 4525 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) |
michael@0 | 4526 | # These systems don't actually have a C or math library (as such) |
michael@0 | 4527 | continue |
michael@0 | 4528 | ;; |
michael@0 | 4529 | *-*-os2*) |
michael@0 | 4530 | # These systems don't actually have a C library (as such) |
michael@0 | 4531 | test "X$arg" = "X-lc" && continue |
michael@0 | 4532 | ;; |
michael@0 | 4533 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
michael@0 | 4534 | # Do not include libc due to us having libc/libc_r. |
michael@0 | 4535 | test "X$arg" = "X-lc" && continue |
michael@0 | 4536 | ;; |
michael@0 | 4537 | *-*-rhapsody* | *-*-darwin1.[012]) |
michael@0 | 4538 | # Rhapsody C and math libraries are in the System framework |
michael@0 | 4539 | deplibs="$deplibs System.ltframework" |
michael@0 | 4540 | continue |
michael@0 | 4541 | ;; |
michael@0 | 4542 | *-*-sco3.2v5* | *-*-sco5v6*) |
michael@0 | 4543 | # Causes problems with __ctype |
michael@0 | 4544 | test "X$arg" = "X-lc" && continue |
michael@0 | 4545 | ;; |
michael@0 | 4546 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
michael@0 | 4547 | # Compiler inserts libc in the correct place for threads to work |
michael@0 | 4548 | test "X$arg" = "X-lc" && continue |
michael@0 | 4549 | ;; |
michael@0 | 4550 | esac |
michael@0 | 4551 | elif test "X$arg" = "X-lc_r"; then |
michael@0 | 4552 | case $host in |
michael@0 | 4553 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
michael@0 | 4554 | # Do not include libc_r directly, use -pthread flag. |
michael@0 | 4555 | continue |
michael@0 | 4556 | ;; |
michael@0 | 4557 | esac |
michael@0 | 4558 | fi |
michael@0 | 4559 | deplibs="$deplibs $arg" |
michael@0 | 4560 | continue |
michael@0 | 4561 | ;; |
michael@0 | 4562 | |
michael@0 | 4563 | -module) |
michael@0 | 4564 | module=yes |
michael@0 | 4565 | continue |
michael@0 | 4566 | ;; |
michael@0 | 4567 | |
michael@0 | 4568 | # Tru64 UNIX uses -model [arg] to determine the layout of C++ |
michael@0 | 4569 | # classes, name mangling, and exception handling. |
michael@0 | 4570 | # Darwin uses the -arch flag to determine output architecture. |
michael@0 | 4571 | -model|-arch|-isysroot) |
michael@0 | 4572 | compiler_flags="$compiler_flags $arg" |
michael@0 | 4573 | func_append compile_command " $arg" |
michael@0 | 4574 | func_append finalize_command " $arg" |
michael@0 | 4575 | prev=xcompiler |
michael@0 | 4576 | continue |
michael@0 | 4577 | ;; |
michael@0 | 4578 | |
michael@0 | 4579 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) |
michael@0 | 4580 | compiler_flags="$compiler_flags $arg" |
michael@0 | 4581 | func_append compile_command " $arg" |
michael@0 | 4582 | func_append finalize_command " $arg" |
michael@0 | 4583 | case "$new_inherited_linker_flags " in |
michael@0 | 4584 | *" $arg "*) ;; |
michael@0 | 4585 | * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; |
michael@0 | 4586 | esac |
michael@0 | 4587 | continue |
michael@0 | 4588 | ;; |
michael@0 | 4589 | |
michael@0 | 4590 | -multi_module) |
michael@0 | 4591 | single_module="${wl}-multi_module" |
michael@0 | 4592 | continue |
michael@0 | 4593 | ;; |
michael@0 | 4594 | |
michael@0 | 4595 | -no-fast-install) |
michael@0 | 4596 | fast_install=no |
michael@0 | 4597 | continue |
michael@0 | 4598 | ;; |
michael@0 | 4599 | |
michael@0 | 4600 | -no-install) |
michael@0 | 4601 | case $host in |
michael@0 | 4602 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) |
michael@0 | 4603 | # The PATH hackery in wrapper scripts is required on Windows |
michael@0 | 4604 | # and Darwin in order for the loader to find any dlls it needs. |
michael@0 | 4605 | func_warning "\`-no-install' is ignored for $host" |
michael@0 | 4606 | func_warning "assuming \`-no-fast-install' instead" |
michael@0 | 4607 | fast_install=no |
michael@0 | 4608 | ;; |
michael@0 | 4609 | *) no_install=yes ;; |
michael@0 | 4610 | esac |
michael@0 | 4611 | continue |
michael@0 | 4612 | ;; |
michael@0 | 4613 | |
michael@0 | 4614 | -no-undefined) |
michael@0 | 4615 | allow_undefined=no |
michael@0 | 4616 | continue |
michael@0 | 4617 | ;; |
michael@0 | 4618 | |
michael@0 | 4619 | -objectlist) |
michael@0 | 4620 | prev=objectlist |
michael@0 | 4621 | continue |
michael@0 | 4622 | ;; |
michael@0 | 4623 | |
michael@0 | 4624 | -o) prev=output ;; |
michael@0 | 4625 | |
michael@0 | 4626 | -precious-files-regex) |
michael@0 | 4627 | prev=precious_regex |
michael@0 | 4628 | continue |
michael@0 | 4629 | ;; |
michael@0 | 4630 | |
michael@0 | 4631 | -release) |
michael@0 | 4632 | prev=release |
michael@0 | 4633 | continue |
michael@0 | 4634 | ;; |
michael@0 | 4635 | |
michael@0 | 4636 | -rpath) |
michael@0 | 4637 | prev=rpath |
michael@0 | 4638 | continue |
michael@0 | 4639 | ;; |
michael@0 | 4640 | |
michael@0 | 4641 | -R) |
michael@0 | 4642 | prev=xrpath |
michael@0 | 4643 | continue |
michael@0 | 4644 | ;; |
michael@0 | 4645 | |
michael@0 | 4646 | -R*) |
michael@0 | 4647 | func_stripname '-R' '' "$arg" |
michael@0 | 4648 | dir=$func_stripname_result |
michael@0 | 4649 | # We need an absolute path. |
michael@0 | 4650 | case $dir in |
michael@0 | 4651 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
michael@0 | 4652 | *) |
michael@0 | 4653 | func_fatal_error "only absolute run-paths are allowed" |
michael@0 | 4654 | ;; |
michael@0 | 4655 | esac |
michael@0 | 4656 | case "$xrpath " in |
michael@0 | 4657 | *" $dir "*) ;; |
michael@0 | 4658 | *) xrpath="$xrpath $dir" ;; |
michael@0 | 4659 | esac |
michael@0 | 4660 | continue |
michael@0 | 4661 | ;; |
michael@0 | 4662 | |
michael@0 | 4663 | -shared) |
michael@0 | 4664 | # The effects of -shared are defined in a previous loop. |
michael@0 | 4665 | continue |
michael@0 | 4666 | ;; |
michael@0 | 4667 | |
michael@0 | 4668 | -shrext) |
michael@0 | 4669 | prev=shrext |
michael@0 | 4670 | continue |
michael@0 | 4671 | ;; |
michael@0 | 4672 | |
michael@0 | 4673 | -static | -static-libtool-libs) |
michael@0 | 4674 | # The effects of -static are defined in a previous loop. |
michael@0 | 4675 | # We used to do the same as -all-static on platforms that |
michael@0 | 4676 | # didn't have a PIC flag, but the assumption that the effects |
michael@0 | 4677 | # would be equivalent was wrong. It would break on at least |
michael@0 | 4678 | # Digital Unix and AIX. |
michael@0 | 4679 | continue |
michael@0 | 4680 | ;; |
michael@0 | 4681 | |
michael@0 | 4682 | -thread-safe) |
michael@0 | 4683 | thread_safe=yes |
michael@0 | 4684 | continue |
michael@0 | 4685 | ;; |
michael@0 | 4686 | |
michael@0 | 4687 | -version-info) |
michael@0 | 4688 | prev=vinfo |
michael@0 | 4689 | continue |
michael@0 | 4690 | ;; |
michael@0 | 4691 | |
michael@0 | 4692 | -version-number) |
michael@0 | 4693 | prev=vinfo |
michael@0 | 4694 | vinfo_number=yes |
michael@0 | 4695 | continue |
michael@0 | 4696 | ;; |
michael@0 | 4697 | |
michael@0 | 4698 | -weak) |
michael@0 | 4699 | prev=weak |
michael@0 | 4700 | continue |
michael@0 | 4701 | ;; |
michael@0 | 4702 | |
michael@0 | 4703 | -Wc,*) |
michael@0 | 4704 | func_stripname '-Wc,' '' "$arg" |
michael@0 | 4705 | args=$func_stripname_result |
michael@0 | 4706 | arg= |
michael@0 | 4707 | save_ifs="$IFS"; IFS=',' |
michael@0 | 4708 | for flag in $args; do |
michael@0 | 4709 | IFS="$save_ifs" |
michael@0 | 4710 | func_quote_for_eval "$flag" |
michael@0 | 4711 | arg="$arg $wl$func_quote_for_eval_result" |
michael@0 | 4712 | compiler_flags="$compiler_flags $func_quote_for_eval_result" |
michael@0 | 4713 | done |
michael@0 | 4714 | IFS="$save_ifs" |
michael@0 | 4715 | func_stripname ' ' '' "$arg" |
michael@0 | 4716 | arg=$func_stripname_result |
michael@0 | 4717 | ;; |
michael@0 | 4718 | |
michael@0 | 4719 | -Wl,*) |
michael@0 | 4720 | func_stripname '-Wl,' '' "$arg" |
michael@0 | 4721 | args=$func_stripname_result |
michael@0 | 4722 | arg= |
michael@0 | 4723 | save_ifs="$IFS"; IFS=',' |
michael@0 | 4724 | for flag in $args; do |
michael@0 | 4725 | IFS="$save_ifs" |
michael@0 | 4726 | func_quote_for_eval "$flag" |
michael@0 | 4727 | arg="$arg $wl$func_quote_for_eval_result" |
michael@0 | 4728 | compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" |
michael@0 | 4729 | linker_flags="$linker_flags $func_quote_for_eval_result" |
michael@0 | 4730 | done |
michael@0 | 4731 | IFS="$save_ifs" |
michael@0 | 4732 | func_stripname ' ' '' "$arg" |
michael@0 | 4733 | arg=$func_stripname_result |
michael@0 | 4734 | ;; |
michael@0 | 4735 | |
michael@0 | 4736 | -Xcompiler) |
michael@0 | 4737 | prev=xcompiler |
michael@0 | 4738 | continue |
michael@0 | 4739 | ;; |
michael@0 | 4740 | |
michael@0 | 4741 | -Xlinker) |
michael@0 | 4742 | prev=xlinker |
michael@0 | 4743 | continue |
michael@0 | 4744 | ;; |
michael@0 | 4745 | |
michael@0 | 4746 | -XCClinker) |
michael@0 | 4747 | prev=xcclinker |
michael@0 | 4748 | continue |
michael@0 | 4749 | ;; |
michael@0 | 4750 | |
michael@0 | 4751 | # -msg_* for osf cc |
michael@0 | 4752 | -msg_*) |
michael@0 | 4753 | func_quote_for_eval "$arg" |
michael@0 | 4754 | arg="$func_quote_for_eval_result" |
michael@0 | 4755 | ;; |
michael@0 | 4756 | |
michael@0 | 4757 | # -64, -mips[0-9] enable 64-bit mode on the SGI compiler |
michael@0 | 4758 | # -r[0-9][0-9]* specifies the processor on the SGI compiler |
michael@0 | 4759 | # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler |
michael@0 | 4760 | # +DA*, +DD* enable 64-bit mode on the HP compiler |
michael@0 | 4761 | # -q* pass through compiler args for the IBM compiler |
michael@0 | 4762 | # -m*, -t[45]*, -txscale* pass through architecture-specific |
michael@0 | 4763 | # compiler args for GCC |
michael@0 | 4764 | # -F/path gives path to uninstalled frameworks, gcc on darwin |
michael@0 | 4765 | # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC |
michael@0 | 4766 | # @file GCC response files |
michael@0 | 4767 | -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ |
michael@0 | 4768 | -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) |
michael@0 | 4769 | func_quote_for_eval "$arg" |
michael@0 | 4770 | arg="$func_quote_for_eval_result" |
michael@0 | 4771 | func_append compile_command " $arg" |
michael@0 | 4772 | func_append finalize_command " $arg" |
michael@0 | 4773 | compiler_flags="$compiler_flags $arg" |
michael@0 | 4774 | continue |
michael@0 | 4775 | ;; |
michael@0 | 4776 | |
michael@0 | 4777 | # Some other compiler flag. |
michael@0 | 4778 | -* | +*) |
michael@0 | 4779 | func_quote_for_eval "$arg" |
michael@0 | 4780 | arg="$func_quote_for_eval_result" |
michael@0 | 4781 | ;; |
michael@0 | 4782 | |
michael@0 | 4783 | *.$objext) |
michael@0 | 4784 | # A standard object. |
michael@0 | 4785 | objs="$objs $arg" |
michael@0 | 4786 | ;; |
michael@0 | 4787 | |
michael@0 | 4788 | *.lo) |
michael@0 | 4789 | # A libtool-controlled object. |
michael@0 | 4790 | |
michael@0 | 4791 | # Check to see that this really is a libtool object. |
michael@0 | 4792 | if func_lalib_unsafe_p "$arg"; then |
michael@0 | 4793 | pic_object= |
michael@0 | 4794 | non_pic_object= |
michael@0 | 4795 | |
michael@0 | 4796 | # Read the .lo file |
michael@0 | 4797 | func_source "$arg" |
michael@0 | 4798 | |
michael@0 | 4799 | if test -z "$pic_object" || |
michael@0 | 4800 | test -z "$non_pic_object" || |
michael@0 | 4801 | test "$pic_object" = none && |
michael@0 | 4802 | test "$non_pic_object" = none; then |
michael@0 | 4803 | func_fatal_error "cannot find name of object for \`$arg'" |
michael@0 | 4804 | fi |
michael@0 | 4805 | |
michael@0 | 4806 | # Extract subdirectory from the argument. |
michael@0 | 4807 | func_dirname "$arg" "/" "" |
michael@0 | 4808 | xdir="$func_dirname_result" |
michael@0 | 4809 | |
michael@0 | 4810 | if test "$pic_object" != none; then |
michael@0 | 4811 | # Prepend the subdirectory the object is found in. |
michael@0 | 4812 | pic_object="$xdir$pic_object" |
michael@0 | 4813 | |
michael@0 | 4814 | if test "$prev" = dlfiles; then |
michael@0 | 4815 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
michael@0 | 4816 | dlfiles="$dlfiles $pic_object" |
michael@0 | 4817 | prev= |
michael@0 | 4818 | continue |
michael@0 | 4819 | else |
michael@0 | 4820 | # If libtool objects are unsupported, then we need to preload. |
michael@0 | 4821 | prev=dlprefiles |
michael@0 | 4822 | fi |
michael@0 | 4823 | fi |
michael@0 | 4824 | |
michael@0 | 4825 | # CHECK ME: I think I busted this. -Ossama |
michael@0 | 4826 | if test "$prev" = dlprefiles; then |
michael@0 | 4827 | # Preload the old-style object. |
michael@0 | 4828 | dlprefiles="$dlprefiles $pic_object" |
michael@0 | 4829 | prev= |
michael@0 | 4830 | fi |
michael@0 | 4831 | |
michael@0 | 4832 | # A PIC object. |
michael@0 | 4833 | func_append libobjs " $pic_object" |
michael@0 | 4834 | arg="$pic_object" |
michael@0 | 4835 | fi |
michael@0 | 4836 | |
michael@0 | 4837 | # Non-PIC object. |
michael@0 | 4838 | if test "$non_pic_object" != none; then |
michael@0 | 4839 | # Prepend the subdirectory the object is found in. |
michael@0 | 4840 | non_pic_object="$xdir$non_pic_object" |
michael@0 | 4841 | |
michael@0 | 4842 | # A standard non-PIC object |
michael@0 | 4843 | func_append non_pic_objects " $non_pic_object" |
michael@0 | 4844 | if test -z "$pic_object" || test "$pic_object" = none ; then |
michael@0 | 4845 | arg="$non_pic_object" |
michael@0 | 4846 | fi |
michael@0 | 4847 | else |
michael@0 | 4848 | # If the PIC object exists, use it instead. |
michael@0 | 4849 | # $xdir was prepended to $pic_object above. |
michael@0 | 4850 | non_pic_object="$pic_object" |
michael@0 | 4851 | func_append non_pic_objects " $non_pic_object" |
michael@0 | 4852 | fi |
michael@0 | 4853 | else |
michael@0 | 4854 | # Only an error if not doing a dry-run. |
michael@0 | 4855 | if $opt_dry_run; then |
michael@0 | 4856 | # Extract subdirectory from the argument. |
michael@0 | 4857 | func_dirname "$arg" "/" "" |
michael@0 | 4858 | xdir="$func_dirname_result" |
michael@0 | 4859 | |
michael@0 | 4860 | func_lo2o "$arg" |
michael@0 | 4861 | pic_object=$xdir$objdir/$func_lo2o_result |
michael@0 | 4862 | non_pic_object=$xdir$func_lo2o_result |
michael@0 | 4863 | func_append libobjs " $pic_object" |
michael@0 | 4864 | func_append non_pic_objects " $non_pic_object" |
michael@0 | 4865 | else |
michael@0 | 4866 | func_fatal_error "\`$arg' is not a valid libtool object" |
michael@0 | 4867 | fi |
michael@0 | 4868 | fi |
michael@0 | 4869 | ;; |
michael@0 | 4870 | |
michael@0 | 4871 | *.$libext) |
michael@0 | 4872 | # An archive. |
michael@0 | 4873 | deplibs="$deplibs $arg" |
michael@0 | 4874 | old_deplibs="$old_deplibs $arg" |
michael@0 | 4875 | continue |
michael@0 | 4876 | ;; |
michael@0 | 4877 | |
michael@0 | 4878 | *.la) |
michael@0 | 4879 | # A libtool-controlled library. |
michael@0 | 4880 | |
michael@0 | 4881 | if test "$prev" = dlfiles; then |
michael@0 | 4882 | # This library was specified with -dlopen. |
michael@0 | 4883 | dlfiles="$dlfiles $arg" |
michael@0 | 4884 | prev= |
michael@0 | 4885 | elif test "$prev" = dlprefiles; then |
michael@0 | 4886 | # The library was specified with -dlpreopen. |
michael@0 | 4887 | dlprefiles="$dlprefiles $arg" |
michael@0 | 4888 | prev= |
michael@0 | 4889 | else |
michael@0 | 4890 | deplibs="$deplibs $arg" |
michael@0 | 4891 | fi |
michael@0 | 4892 | continue |
michael@0 | 4893 | ;; |
michael@0 | 4894 | |
michael@0 | 4895 | # Some other compiler argument. |
michael@0 | 4896 | *) |
michael@0 | 4897 | # Unknown arguments in both finalize_command and compile_command need |
michael@0 | 4898 | # to be aesthetically quoted because they are evaled later. |
michael@0 | 4899 | func_quote_for_eval "$arg" |
michael@0 | 4900 | arg="$func_quote_for_eval_result" |
michael@0 | 4901 | ;; |
michael@0 | 4902 | esac # arg |
michael@0 | 4903 | |
michael@0 | 4904 | # Now actually substitute the argument into the commands. |
michael@0 | 4905 | if test -n "$arg"; then |
michael@0 | 4906 | func_append compile_command " $arg" |
michael@0 | 4907 | func_append finalize_command " $arg" |
michael@0 | 4908 | fi |
michael@0 | 4909 | done # argument parsing loop |
michael@0 | 4910 | |
michael@0 | 4911 | test -n "$prev" && \ |
michael@0 | 4912 | func_fatal_help "the \`$prevarg' option requires an argument" |
michael@0 | 4913 | |
michael@0 | 4914 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then |
michael@0 | 4915 | eval arg=\"$export_dynamic_flag_spec\" |
michael@0 | 4916 | func_append compile_command " $arg" |
michael@0 | 4917 | func_append finalize_command " $arg" |
michael@0 | 4918 | fi |
michael@0 | 4919 | |
michael@0 | 4920 | oldlibs= |
michael@0 | 4921 | # calculate the name of the file, without its directory |
michael@0 | 4922 | func_basename "$output" |
michael@0 | 4923 | outputname="$func_basename_result" |
michael@0 | 4924 | libobjs_save="$libobjs" |
michael@0 | 4925 | |
michael@0 | 4926 | if test -n "$shlibpath_var"; then |
michael@0 | 4927 | # get the directories listed in $shlibpath_var |
michael@0 | 4928 | eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` |
michael@0 | 4929 | else |
michael@0 | 4930 | shlib_search_path= |
michael@0 | 4931 | fi |
michael@0 | 4932 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" |
michael@0 | 4933 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" |
michael@0 | 4934 | |
michael@0 | 4935 | func_dirname "$output" "/" "" |
michael@0 | 4936 | output_objdir="$func_dirname_result$objdir" |
michael@0 | 4937 | # Create the object directory. |
michael@0 | 4938 | func_mkdir_p "$output_objdir" |
michael@0 | 4939 | |
michael@0 | 4940 | # Determine the type of output |
michael@0 | 4941 | case $output in |
michael@0 | 4942 | "") |
michael@0 | 4943 | func_fatal_help "you must specify an output file" |
michael@0 | 4944 | ;; |
michael@0 | 4945 | *.$libext) linkmode=oldlib ;; |
michael@0 | 4946 | *.lo | *.$objext) linkmode=obj ;; |
michael@0 | 4947 | *.la) linkmode=lib ;; |
michael@0 | 4948 | *) linkmode=prog ;; # Anything else should be a program. |
michael@0 | 4949 | esac |
michael@0 | 4950 | |
michael@0 | 4951 | specialdeplibs= |
michael@0 | 4952 | |
michael@0 | 4953 | libs= |
michael@0 | 4954 | # Find all interdependent deplibs by searching for libraries |
michael@0 | 4955 | # that are linked more than once (e.g. -la -lb -la) |
michael@0 | 4956 | for deplib in $deplibs; do |
michael@0 | 4957 | if $opt_duplicate_deps ; then |
michael@0 | 4958 | case "$libs " in |
michael@0 | 4959 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
michael@0 | 4960 | esac |
michael@0 | 4961 | fi |
michael@0 | 4962 | libs="$libs $deplib" |
michael@0 | 4963 | done |
michael@0 | 4964 | |
michael@0 | 4965 | if test "$linkmode" = lib; then |
michael@0 | 4966 | libs="$predeps $libs $compiler_lib_search_path $postdeps" |
michael@0 | 4967 | |
michael@0 | 4968 | # Compute libraries that are listed more than once in $predeps |
michael@0 | 4969 | # $postdeps and mark them as special (i.e., whose duplicates are |
michael@0 | 4970 | # not to be eliminated). |
michael@0 | 4971 | pre_post_deps= |
michael@0 | 4972 | if $opt_duplicate_compiler_generated_deps; then |
michael@0 | 4973 | for pre_post_dep in $predeps $postdeps; do |
michael@0 | 4974 | case "$pre_post_deps " in |
michael@0 | 4975 | *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; |
michael@0 | 4976 | esac |
michael@0 | 4977 | pre_post_deps="$pre_post_deps $pre_post_dep" |
michael@0 | 4978 | done |
michael@0 | 4979 | fi |
michael@0 | 4980 | pre_post_deps= |
michael@0 | 4981 | fi |
michael@0 | 4982 | |
michael@0 | 4983 | deplibs= |
michael@0 | 4984 | newdependency_libs= |
michael@0 | 4985 | newlib_search_path= |
michael@0 | 4986 | need_relink=no # whether we're linking any uninstalled libtool libraries |
michael@0 | 4987 | notinst_deplibs= # not-installed libtool libraries |
michael@0 | 4988 | notinst_path= # paths that contain not-installed libtool libraries |
michael@0 | 4989 | |
michael@0 | 4990 | case $linkmode in |
michael@0 | 4991 | lib) |
michael@0 | 4992 | passes="conv dlpreopen link" |
michael@0 | 4993 | for file in $dlfiles $dlprefiles; do |
michael@0 | 4994 | case $file in |
michael@0 | 4995 | *.la) ;; |
michael@0 | 4996 | *) |
michael@0 | 4997 | func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" |
michael@0 | 4998 | ;; |
michael@0 | 4999 | esac |
michael@0 | 5000 | done |
michael@0 | 5001 | ;; |
michael@0 | 5002 | prog) |
michael@0 | 5003 | compile_deplibs= |
michael@0 | 5004 | finalize_deplibs= |
michael@0 | 5005 | alldeplibs=no |
michael@0 | 5006 | newdlfiles= |
michael@0 | 5007 | newdlprefiles= |
michael@0 | 5008 | passes="conv scan dlopen dlpreopen link" |
michael@0 | 5009 | ;; |
michael@0 | 5010 | *) passes="conv" |
michael@0 | 5011 | ;; |
michael@0 | 5012 | esac |
michael@0 | 5013 | |
michael@0 | 5014 | for pass in $passes; do |
michael@0 | 5015 | # The preopen pass in lib mode reverses $deplibs; put it back here |
michael@0 | 5016 | # so that -L comes before libs that need it for instance... |
michael@0 | 5017 | if test "$linkmode,$pass" = "lib,link"; then |
michael@0 | 5018 | ## FIXME: Find the place where the list is rebuilt in the wrong |
michael@0 | 5019 | ## order, and fix it there properly |
michael@0 | 5020 | tmp_deplibs= |
michael@0 | 5021 | for deplib in $deplibs; do |
michael@0 | 5022 | tmp_deplibs="$deplib $tmp_deplibs" |
michael@0 | 5023 | done |
michael@0 | 5024 | deplibs="$tmp_deplibs" |
michael@0 | 5025 | fi |
michael@0 | 5026 | |
michael@0 | 5027 | if test "$linkmode,$pass" = "lib,link" || |
michael@0 | 5028 | test "$linkmode,$pass" = "prog,scan"; then |
michael@0 | 5029 | libs="$deplibs" |
michael@0 | 5030 | deplibs= |
michael@0 | 5031 | fi |
michael@0 | 5032 | if test "$linkmode" = prog; then |
michael@0 | 5033 | case $pass in |
michael@0 | 5034 | dlopen) libs="$dlfiles" ;; |
michael@0 | 5035 | dlpreopen) libs="$dlprefiles" ;; |
michael@0 | 5036 | link) |
michael@0 | 5037 | libs="$deplibs %DEPLIBS%" |
michael@0 | 5038 | test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" |
michael@0 | 5039 | ;; |
michael@0 | 5040 | esac |
michael@0 | 5041 | fi |
michael@0 | 5042 | if test "$linkmode,$pass" = "lib,dlpreopen"; then |
michael@0 | 5043 | # Collect and forward deplibs of preopened libtool libs |
michael@0 | 5044 | for lib in $dlprefiles; do |
michael@0 | 5045 | # Ignore non-libtool-libs |
michael@0 | 5046 | dependency_libs= |
michael@0 | 5047 | case $lib in |
michael@0 | 5048 | *.la) func_source "$lib" ;; |
michael@0 | 5049 | esac |
michael@0 | 5050 | |
michael@0 | 5051 | # Collect preopened libtool deplibs, except any this library |
michael@0 | 5052 | # has declared as weak libs |
michael@0 | 5053 | for deplib in $dependency_libs; do |
michael@0 | 5054 | deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` |
michael@0 | 5055 | case " $weak_libs " in |
michael@0 | 5056 | *" $deplib_base "*) ;; |
michael@0 | 5057 | *) deplibs="$deplibs $deplib" ;; |
michael@0 | 5058 | esac |
michael@0 | 5059 | done |
michael@0 | 5060 | done |
michael@0 | 5061 | libs="$dlprefiles" |
michael@0 | 5062 | fi |
michael@0 | 5063 | if test "$pass" = dlopen; then |
michael@0 | 5064 | # Collect dlpreopened libraries |
michael@0 | 5065 | save_deplibs="$deplibs" |
michael@0 | 5066 | deplibs= |
michael@0 | 5067 | fi |
michael@0 | 5068 | |
michael@0 | 5069 | for deplib in $libs; do |
michael@0 | 5070 | lib= |
michael@0 | 5071 | found=no |
michael@0 | 5072 | case $deplib in |
michael@0 | 5073 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) |
michael@0 | 5074 | if test "$linkmode,$pass" = "prog,link"; then |
michael@0 | 5075 | compile_deplibs="$deplib $compile_deplibs" |
michael@0 | 5076 | finalize_deplibs="$deplib $finalize_deplibs" |
michael@0 | 5077 | else |
michael@0 | 5078 | compiler_flags="$compiler_flags $deplib" |
michael@0 | 5079 | if test "$linkmode" = lib ; then |
michael@0 | 5080 | case "$new_inherited_linker_flags " in |
michael@0 | 5081 | *" $deplib "*) ;; |
michael@0 | 5082 | * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; |
michael@0 | 5083 | esac |
michael@0 | 5084 | fi |
michael@0 | 5085 | fi |
michael@0 | 5086 | continue |
michael@0 | 5087 | ;; |
michael@0 | 5088 | -l*) |
michael@0 | 5089 | if test "$linkmode" != lib && test "$linkmode" != prog; then |
michael@0 | 5090 | func_warning "\`-l' is ignored for archives/objects" |
michael@0 | 5091 | continue |
michael@0 | 5092 | fi |
michael@0 | 5093 | func_stripname '-l' '' "$deplib" |
michael@0 | 5094 | name=$func_stripname_result |
michael@0 | 5095 | if test "$linkmode" = lib; then |
michael@0 | 5096 | searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" |
michael@0 | 5097 | else |
michael@0 | 5098 | searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" |
michael@0 | 5099 | fi |
michael@0 | 5100 | for searchdir in $searchdirs; do |
michael@0 | 5101 | for search_ext in .la $std_shrext .so .a; do |
michael@0 | 5102 | # Search the libtool library |
michael@0 | 5103 | lib="$searchdir/lib${name}${search_ext}" |
michael@0 | 5104 | if test -f "$lib"; then |
michael@0 | 5105 | if test "$search_ext" = ".la"; then |
michael@0 | 5106 | found=yes |
michael@0 | 5107 | else |
michael@0 | 5108 | found=no |
michael@0 | 5109 | fi |
michael@0 | 5110 | break 2 |
michael@0 | 5111 | fi |
michael@0 | 5112 | done |
michael@0 | 5113 | done |
michael@0 | 5114 | if test "$found" != yes; then |
michael@0 | 5115 | # deplib doesn't seem to be a libtool library |
michael@0 | 5116 | if test "$linkmode,$pass" = "prog,link"; then |
michael@0 | 5117 | compile_deplibs="$deplib $compile_deplibs" |
michael@0 | 5118 | finalize_deplibs="$deplib $finalize_deplibs" |
michael@0 | 5119 | else |
michael@0 | 5120 | deplibs="$deplib $deplibs" |
michael@0 | 5121 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
michael@0 | 5122 | fi |
michael@0 | 5123 | continue |
michael@0 | 5124 | else # deplib is a libtool library |
michael@0 | 5125 | # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, |
michael@0 | 5126 | # We need to do some special things here, and not later. |
michael@0 | 5127 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
michael@0 | 5128 | case " $predeps $postdeps " in |
michael@0 | 5129 | *" $deplib "*) |
michael@0 | 5130 | if func_lalib_p "$lib"; then |
michael@0 | 5131 | library_names= |
michael@0 | 5132 | old_library= |
michael@0 | 5133 | func_source "$lib" |
michael@0 | 5134 | for l in $old_library $library_names; do |
michael@0 | 5135 | ll="$l" |
michael@0 | 5136 | done |
michael@0 | 5137 | if test "X$ll" = "X$old_library" ; then # only static version available |
michael@0 | 5138 | found=no |
michael@0 | 5139 | func_dirname "$lib" "" "." |
michael@0 | 5140 | ladir="$func_dirname_result" |
michael@0 | 5141 | lib=$ladir/$old_library |
michael@0 | 5142 | if test "$linkmode,$pass" = "prog,link"; then |
michael@0 | 5143 | compile_deplibs="$deplib $compile_deplibs" |
michael@0 | 5144 | finalize_deplibs="$deplib $finalize_deplibs" |
michael@0 | 5145 | else |
michael@0 | 5146 | deplibs="$deplib $deplibs" |
michael@0 | 5147 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
michael@0 | 5148 | fi |
michael@0 | 5149 | continue |
michael@0 | 5150 | fi |
michael@0 | 5151 | fi |
michael@0 | 5152 | ;; |
michael@0 | 5153 | *) ;; |
michael@0 | 5154 | esac |
michael@0 | 5155 | fi |
michael@0 | 5156 | fi |
michael@0 | 5157 | ;; # -l |
michael@0 | 5158 | *.ltframework) |
michael@0 | 5159 | if test "$linkmode,$pass" = "prog,link"; then |
michael@0 | 5160 | compile_deplibs="$deplib $compile_deplibs" |
michael@0 | 5161 | finalize_deplibs="$deplib $finalize_deplibs" |
michael@0 | 5162 | else |
michael@0 | 5163 | deplibs="$deplib $deplibs" |
michael@0 | 5164 | if test "$linkmode" = lib ; then |
michael@0 | 5165 | case "$new_inherited_linker_flags " in |
michael@0 | 5166 | *" $deplib "*) ;; |
michael@0 | 5167 | * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; |
michael@0 | 5168 | esac |
michael@0 | 5169 | fi |
michael@0 | 5170 | fi |
michael@0 | 5171 | continue |
michael@0 | 5172 | ;; |
michael@0 | 5173 | -L*) |
michael@0 | 5174 | case $linkmode in |
michael@0 | 5175 | lib) |
michael@0 | 5176 | deplibs="$deplib $deplibs" |
michael@0 | 5177 | test "$pass" = conv && continue |
michael@0 | 5178 | newdependency_libs="$deplib $newdependency_libs" |
michael@0 | 5179 | func_stripname '-L' '' "$deplib" |
michael@0 | 5180 | newlib_search_path="$newlib_search_path $func_stripname_result" |
michael@0 | 5181 | ;; |
michael@0 | 5182 | prog) |
michael@0 | 5183 | if test "$pass" = conv; then |
michael@0 | 5184 | deplibs="$deplib $deplibs" |
michael@0 | 5185 | continue |
michael@0 | 5186 | fi |
michael@0 | 5187 | if test "$pass" = scan; then |
michael@0 | 5188 | deplibs="$deplib $deplibs" |
michael@0 | 5189 | else |
michael@0 | 5190 | compile_deplibs="$deplib $compile_deplibs" |
michael@0 | 5191 | finalize_deplibs="$deplib $finalize_deplibs" |
michael@0 | 5192 | fi |
michael@0 | 5193 | func_stripname '-L' '' "$deplib" |
michael@0 | 5194 | newlib_search_path="$newlib_search_path $func_stripname_result" |
michael@0 | 5195 | ;; |
michael@0 | 5196 | *) |
michael@0 | 5197 | func_warning "\`-L' is ignored for archives/objects" |
michael@0 | 5198 | ;; |
michael@0 | 5199 | esac # linkmode |
michael@0 | 5200 | continue |
michael@0 | 5201 | ;; # -L |
michael@0 | 5202 | -R*) |
michael@0 | 5203 | if test "$pass" = link; then |
michael@0 | 5204 | func_stripname '-R' '' "$deplib" |
michael@0 | 5205 | dir=$func_stripname_result |
michael@0 | 5206 | # Make sure the xrpath contains only unique directories. |
michael@0 | 5207 | case "$xrpath " in |
michael@0 | 5208 | *" $dir "*) ;; |
michael@0 | 5209 | *) xrpath="$xrpath $dir" ;; |
michael@0 | 5210 | esac |
michael@0 | 5211 | fi |
michael@0 | 5212 | deplibs="$deplib $deplibs" |
michael@0 | 5213 | continue |
michael@0 | 5214 | ;; |
michael@0 | 5215 | *.la) lib="$deplib" ;; |
michael@0 | 5216 | *.$libext) |
michael@0 | 5217 | if test "$pass" = conv; then |
michael@0 | 5218 | deplibs="$deplib $deplibs" |
michael@0 | 5219 | continue |
michael@0 | 5220 | fi |
michael@0 | 5221 | case $linkmode in |
michael@0 | 5222 | lib) |
michael@0 | 5223 | # Linking convenience modules into shared libraries is allowed, |
michael@0 | 5224 | # but linking other static libraries is non-portable. |
michael@0 | 5225 | case " $dlpreconveniencelibs " in |
michael@0 | 5226 | *" $deplib "*) ;; |
michael@0 | 5227 | *) |
michael@0 | 5228 | valid_a_lib=no |
michael@0 | 5229 | case $deplibs_check_method in |
michael@0 | 5230 | match_pattern*) |
michael@0 | 5231 | set dummy $deplibs_check_method; shift |
michael@0 | 5232 | match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
michael@0 | 5233 | if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ |
michael@0 | 5234 | | $EGREP "$match_pattern_regex" > /dev/null; then |
michael@0 | 5235 | valid_a_lib=yes |
michael@0 | 5236 | fi |
michael@0 | 5237 | ;; |
michael@0 | 5238 | pass_all) |
michael@0 | 5239 | valid_a_lib=yes |
michael@0 | 5240 | ;; |
michael@0 | 5241 | esac |
michael@0 | 5242 | if test "$valid_a_lib" != yes; then |
michael@0 | 5243 | $ECHO |
michael@0 | 5244 | $ECHO "*** Warning: Trying to link with static lib archive $deplib." |
michael@0 | 5245 | $ECHO "*** I have the capability to make that library automatically link in when" |
michael@0 | 5246 | $ECHO "*** you link to this library. But I can only do this if you have a" |
michael@0 | 5247 | $ECHO "*** shared version of the library, which you do not appear to have" |
michael@0 | 5248 | $ECHO "*** because the file extensions .$libext of this argument makes me believe" |
michael@0 | 5249 | $ECHO "*** that it is just a static archive that I should not use here." |
michael@0 | 5250 | else |
michael@0 | 5251 | $ECHO |
michael@0 | 5252 | $ECHO "*** Warning: Linking the shared library $output against the" |
michael@0 | 5253 | $ECHO "*** static library $deplib is not portable!" |
michael@0 | 5254 | deplibs="$deplib $deplibs" |
michael@0 | 5255 | fi |
michael@0 | 5256 | ;; |
michael@0 | 5257 | esac |
michael@0 | 5258 | continue |
michael@0 | 5259 | ;; |
michael@0 | 5260 | prog) |
michael@0 | 5261 | if test "$pass" != link; then |
michael@0 | 5262 | deplibs="$deplib $deplibs" |
michael@0 | 5263 | else |
michael@0 | 5264 | compile_deplibs="$deplib $compile_deplibs" |
michael@0 | 5265 | finalize_deplibs="$deplib $finalize_deplibs" |
michael@0 | 5266 | fi |
michael@0 | 5267 | continue |
michael@0 | 5268 | ;; |
michael@0 | 5269 | esac # linkmode |
michael@0 | 5270 | ;; # *.$libext |
michael@0 | 5271 | *.lo | *.$objext) |
michael@0 | 5272 | if test "$pass" = conv; then |
michael@0 | 5273 | deplibs="$deplib $deplibs" |
michael@0 | 5274 | elif test "$linkmode" = prog; then |
michael@0 | 5275 | if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then |
michael@0 | 5276 | # If there is no dlopen support or we're linking statically, |
michael@0 | 5277 | # we need to preload. |
michael@0 | 5278 | newdlprefiles="$newdlprefiles $deplib" |
michael@0 | 5279 | compile_deplibs="$deplib $compile_deplibs" |
michael@0 | 5280 | finalize_deplibs="$deplib $finalize_deplibs" |
michael@0 | 5281 | else |
michael@0 | 5282 | newdlfiles="$newdlfiles $deplib" |
michael@0 | 5283 | fi |
michael@0 | 5284 | fi |
michael@0 | 5285 | continue |
michael@0 | 5286 | ;; |
michael@0 | 5287 | %DEPLIBS%) |
michael@0 | 5288 | alldeplibs=yes |
michael@0 | 5289 | continue |
michael@0 | 5290 | ;; |
michael@0 | 5291 | esac # case $deplib |
michael@0 | 5292 | |
michael@0 | 5293 | if test "$found" = yes || test -f "$lib"; then : |
michael@0 | 5294 | else |
michael@0 | 5295 | func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" |
michael@0 | 5296 | fi |
michael@0 | 5297 | |
michael@0 | 5298 | # Check to see that this really is a libtool archive. |
michael@0 | 5299 | func_lalib_unsafe_p "$lib" \ |
michael@0 | 5300 | || func_fatal_error "\`$lib' is not a valid libtool archive" |
michael@0 | 5301 | |
michael@0 | 5302 | func_dirname "$lib" "" "." |
michael@0 | 5303 | ladir="$func_dirname_result" |
michael@0 | 5304 | |
michael@0 | 5305 | dlname= |
michael@0 | 5306 | dlopen= |
michael@0 | 5307 | dlpreopen= |
michael@0 | 5308 | libdir= |
michael@0 | 5309 | library_names= |
michael@0 | 5310 | old_library= |
michael@0 | 5311 | inherited_linker_flags= |
michael@0 | 5312 | # If the library was installed with an old release of libtool, |
michael@0 | 5313 | # it will not redefine variables installed, or shouldnotlink |
michael@0 | 5314 | installed=yes |
michael@0 | 5315 | shouldnotlink=no |
michael@0 | 5316 | avoidtemprpath= |
michael@0 | 5317 | |
michael@0 | 5318 | |
michael@0 | 5319 | # Read the .la file |
michael@0 | 5320 | func_source "$lib" |
michael@0 | 5321 | |
michael@0 | 5322 | # Convert "-framework foo" to "foo.ltframework" |
michael@0 | 5323 | if test -n "$inherited_linker_flags"; then |
michael@0 | 5324 | tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` |
michael@0 | 5325 | for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do |
michael@0 | 5326 | case " $new_inherited_linker_flags " in |
michael@0 | 5327 | *" $tmp_inherited_linker_flag "*) ;; |
michael@0 | 5328 | *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; |
michael@0 | 5329 | esac |
michael@0 | 5330 | done |
michael@0 | 5331 | fi |
michael@0 | 5332 | dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` |
michael@0 | 5333 | if test "$linkmode,$pass" = "lib,link" || |
michael@0 | 5334 | test "$linkmode,$pass" = "prog,scan" || |
michael@0 | 5335 | { test "$linkmode" != prog && test "$linkmode" != lib; }; then |
michael@0 | 5336 | test -n "$dlopen" && dlfiles="$dlfiles $dlopen" |
michael@0 | 5337 | test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" |
michael@0 | 5338 | fi |
michael@0 | 5339 | |
michael@0 | 5340 | if test "$pass" = conv; then |
michael@0 | 5341 | # Only check for convenience libraries |
michael@0 | 5342 | deplibs="$lib $deplibs" |
michael@0 | 5343 | if test -z "$libdir"; then |
michael@0 | 5344 | if test -z "$old_library"; then |
michael@0 | 5345 | func_fatal_error "cannot find name of link library for \`$lib'" |
michael@0 | 5346 | fi |
michael@0 | 5347 | # It is a libtool convenience library, so add in its objects. |
michael@0 | 5348 | convenience="$convenience $ladir/$objdir/$old_library" |
michael@0 | 5349 | old_convenience="$old_convenience $ladir/$objdir/$old_library" |
michael@0 | 5350 | tmp_libs= |
michael@0 | 5351 | for deplib in $dependency_libs; do |
michael@0 | 5352 | deplibs="$deplib $deplibs" |
michael@0 | 5353 | if $opt_duplicate_deps ; then |
michael@0 | 5354 | case "$tmp_libs " in |
michael@0 | 5355 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
michael@0 | 5356 | esac |
michael@0 | 5357 | fi |
michael@0 | 5358 | tmp_libs="$tmp_libs $deplib" |
michael@0 | 5359 | done |
michael@0 | 5360 | elif test "$linkmode" != prog && test "$linkmode" != lib; then |
michael@0 | 5361 | func_fatal_error "\`$lib' is not a convenience library" |
michael@0 | 5362 | fi |
michael@0 | 5363 | continue |
michael@0 | 5364 | fi # $pass = conv |
michael@0 | 5365 | |
michael@0 | 5366 | |
michael@0 | 5367 | # Get the name of the library we link against. |
michael@0 | 5368 | linklib= |
michael@0 | 5369 | for l in $old_library $library_names; do |
michael@0 | 5370 | linklib="$l" |
michael@0 | 5371 | done |
michael@0 | 5372 | if test -z "$linklib"; then |
michael@0 | 5373 | func_fatal_error "cannot find name of link library for \`$lib'" |
michael@0 | 5374 | fi |
michael@0 | 5375 | |
michael@0 | 5376 | # This library was specified with -dlopen. |
michael@0 | 5377 | if test "$pass" = dlopen; then |
michael@0 | 5378 | if test -z "$libdir"; then |
michael@0 | 5379 | func_fatal_error "cannot -dlopen a convenience library: \`$lib'" |
michael@0 | 5380 | fi |
michael@0 | 5381 | if test -z "$dlname" || |
michael@0 | 5382 | test "$dlopen_support" != yes || |
michael@0 | 5383 | test "$build_libtool_libs" = no; then |
michael@0 | 5384 | # If there is no dlname, no dlopen support or we're linking |
michael@0 | 5385 | # statically, we need to preload. We also need to preload any |
michael@0 | 5386 | # dependent libraries so libltdl's deplib preloader doesn't |
michael@0 | 5387 | # bomb out in the load deplibs phase. |
michael@0 | 5388 | dlprefiles="$dlprefiles $lib $dependency_libs" |
michael@0 | 5389 | else |
michael@0 | 5390 | newdlfiles="$newdlfiles $lib" |
michael@0 | 5391 | fi |
michael@0 | 5392 | continue |
michael@0 | 5393 | fi # $pass = dlopen |
michael@0 | 5394 | |
michael@0 | 5395 | # We need an absolute path. |
michael@0 | 5396 | case $ladir in |
michael@0 | 5397 | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; |
michael@0 | 5398 | *) |
michael@0 | 5399 | abs_ladir=`cd "$ladir" && pwd` |
michael@0 | 5400 | if test -z "$abs_ladir"; then |
michael@0 | 5401 | func_warning "cannot determine absolute directory name of \`$ladir'" |
michael@0 | 5402 | func_warning "passing it literally to the linker, although it might fail" |
michael@0 | 5403 | abs_ladir="$ladir" |
michael@0 | 5404 | fi |
michael@0 | 5405 | ;; |
michael@0 | 5406 | esac |
michael@0 | 5407 | func_basename "$lib" |
michael@0 | 5408 | laname="$func_basename_result" |
michael@0 | 5409 | |
michael@0 | 5410 | # Find the relevant object directory and library name. |
michael@0 | 5411 | if test "X$installed" = Xyes; then |
michael@0 | 5412 | if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
michael@0 | 5413 | func_warning "library \`$lib' was moved." |
michael@0 | 5414 | dir="$ladir" |
michael@0 | 5415 | absdir="$abs_ladir" |
michael@0 | 5416 | libdir="$abs_ladir" |
michael@0 | 5417 | else |
michael@0 | 5418 | dir="$libdir" |
michael@0 | 5419 | absdir="$libdir" |
michael@0 | 5420 | fi |
michael@0 | 5421 | test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes |
michael@0 | 5422 | else |
michael@0 | 5423 | if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
michael@0 | 5424 | dir="$ladir" |
michael@0 | 5425 | absdir="$abs_ladir" |
michael@0 | 5426 | # Remove this search path later |
michael@0 | 5427 | notinst_path="$notinst_path $abs_ladir" |
michael@0 | 5428 | else |
michael@0 | 5429 | dir="$ladir/$objdir" |
michael@0 | 5430 | absdir="$abs_ladir/$objdir" |
michael@0 | 5431 | # Remove this search path later |
michael@0 | 5432 | notinst_path="$notinst_path $abs_ladir" |
michael@0 | 5433 | fi |
michael@0 | 5434 | fi # $installed = yes |
michael@0 | 5435 | func_stripname 'lib' '.la' "$laname" |
michael@0 | 5436 | name=$func_stripname_result |
michael@0 | 5437 | |
michael@0 | 5438 | # This library was specified with -dlpreopen. |
michael@0 | 5439 | if test "$pass" = dlpreopen; then |
michael@0 | 5440 | if test -z "$libdir" && test "$linkmode" = prog; then |
michael@0 | 5441 | func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" |
michael@0 | 5442 | fi |
michael@0 | 5443 | # Prefer using a static library (so that no silly _DYNAMIC symbols |
michael@0 | 5444 | # are required to link). |
michael@0 | 5445 | if test -n "$old_library"; then |
michael@0 | 5446 | newdlprefiles="$newdlprefiles $dir/$old_library" |
michael@0 | 5447 | # Keep a list of preopened convenience libraries to check |
michael@0 | 5448 | # that they are being used correctly in the link pass. |
michael@0 | 5449 | test -z "$libdir" && \ |
michael@0 | 5450 | dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" |
michael@0 | 5451 | # Otherwise, use the dlname, so that lt_dlopen finds it. |
michael@0 | 5452 | elif test -n "$dlname"; then |
michael@0 | 5453 | newdlprefiles="$newdlprefiles $dir/$dlname" |
michael@0 | 5454 | else |
michael@0 | 5455 | newdlprefiles="$newdlprefiles $dir/$linklib" |
michael@0 | 5456 | fi |
michael@0 | 5457 | fi # $pass = dlpreopen |
michael@0 | 5458 | |
michael@0 | 5459 | if test -z "$libdir"; then |
michael@0 | 5460 | # Link the convenience library |
michael@0 | 5461 | if test "$linkmode" = lib; then |
michael@0 | 5462 | deplibs="$dir/$old_library $deplibs" |
michael@0 | 5463 | elif test "$linkmode,$pass" = "prog,link"; then |
michael@0 | 5464 | compile_deplibs="$dir/$old_library $compile_deplibs" |
michael@0 | 5465 | finalize_deplibs="$dir/$old_library $finalize_deplibs" |
michael@0 | 5466 | else |
michael@0 | 5467 | deplibs="$lib $deplibs" # used for prog,scan pass |
michael@0 | 5468 | fi |
michael@0 | 5469 | continue |
michael@0 | 5470 | fi |
michael@0 | 5471 | |
michael@0 | 5472 | |
michael@0 | 5473 | if test "$linkmode" = prog && test "$pass" != link; then |
michael@0 | 5474 | newlib_search_path="$newlib_search_path $ladir" |
michael@0 | 5475 | deplibs="$lib $deplibs" |
michael@0 | 5476 | |
michael@0 | 5477 | linkalldeplibs=no |
michael@0 | 5478 | if test "$link_all_deplibs" != no || test -z "$library_names" || |
michael@0 | 5479 | test "$build_libtool_libs" = no; then |
michael@0 | 5480 | linkalldeplibs=yes |
michael@0 | 5481 | fi |
michael@0 | 5482 | |
michael@0 | 5483 | tmp_libs= |
michael@0 | 5484 | for deplib in $dependency_libs; do |
michael@0 | 5485 | case $deplib in |
michael@0 | 5486 | -L*) func_stripname '-L' '' "$deplib" |
michael@0 | 5487 | newlib_search_path="$newlib_search_path $func_stripname_result" |
michael@0 | 5488 | ;; |
michael@0 | 5489 | esac |
michael@0 | 5490 | # Need to link against all dependency_libs? |
michael@0 | 5491 | if test "$linkalldeplibs" = yes; then |
michael@0 | 5492 | deplibs="$deplib $deplibs" |
michael@0 | 5493 | else |
michael@0 | 5494 | # Need to hardcode shared library paths |
michael@0 | 5495 | # or/and link against static libraries |
michael@0 | 5496 | newdependency_libs="$deplib $newdependency_libs" |
michael@0 | 5497 | fi |
michael@0 | 5498 | if $opt_duplicate_deps ; then |
michael@0 | 5499 | case "$tmp_libs " in |
michael@0 | 5500 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
michael@0 | 5501 | esac |
michael@0 | 5502 | fi |
michael@0 | 5503 | tmp_libs="$tmp_libs $deplib" |
michael@0 | 5504 | done # for deplib |
michael@0 | 5505 | continue |
michael@0 | 5506 | fi # $linkmode = prog... |
michael@0 | 5507 | |
michael@0 | 5508 | if test "$linkmode,$pass" = "prog,link"; then |
michael@0 | 5509 | if test -n "$library_names" && |
michael@0 | 5510 | { { test "$prefer_static_libs" = no || |
michael@0 | 5511 | test "$prefer_static_libs,$installed" = "built,yes"; } || |
michael@0 | 5512 | test -z "$old_library"; }; then |
michael@0 | 5513 | # We need to hardcode the library path |
michael@0 | 5514 | if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then |
michael@0 | 5515 | # Make sure the rpath contains only unique directories. |
michael@0 | 5516 | case "$temp_rpath:" in |
michael@0 | 5517 | *"$absdir:"*) ;; |
michael@0 | 5518 | *) temp_rpath="$temp_rpath$absdir:" ;; |
michael@0 | 5519 | esac |
michael@0 | 5520 | fi |
michael@0 | 5521 | |
michael@0 | 5522 | # Hardcode the library path. |
michael@0 | 5523 | # Skip directories that are in the system default run-time |
michael@0 | 5524 | # search path. |
michael@0 | 5525 | case " $sys_lib_dlsearch_path " in |
michael@0 | 5526 | *" $absdir "*) ;; |
michael@0 | 5527 | *) |
michael@0 | 5528 | case "$compile_rpath " in |
michael@0 | 5529 | *" $absdir "*) ;; |
michael@0 | 5530 | *) compile_rpath="$compile_rpath $absdir" |
michael@0 | 5531 | esac |
michael@0 | 5532 | ;; |
michael@0 | 5533 | esac |
michael@0 | 5534 | case " $sys_lib_dlsearch_path " in |
michael@0 | 5535 | *" $libdir "*) ;; |
michael@0 | 5536 | *) |
michael@0 | 5537 | case "$finalize_rpath " in |
michael@0 | 5538 | *" $libdir "*) ;; |
michael@0 | 5539 | *) finalize_rpath="$finalize_rpath $libdir" |
michael@0 | 5540 | esac |
michael@0 | 5541 | ;; |
michael@0 | 5542 | esac |
michael@0 | 5543 | fi # $linkmode,$pass = prog,link... |
michael@0 | 5544 | |
michael@0 | 5545 | if test "$alldeplibs" = yes && |
michael@0 | 5546 | { test "$deplibs_check_method" = pass_all || |
michael@0 | 5547 | { test "$build_libtool_libs" = yes && |
michael@0 | 5548 | test -n "$library_names"; }; }; then |
michael@0 | 5549 | # We only need to search for static libraries |
michael@0 | 5550 | continue |
michael@0 | 5551 | fi |
michael@0 | 5552 | fi |
michael@0 | 5553 | |
michael@0 | 5554 | link_static=no # Whether the deplib will be linked statically |
michael@0 | 5555 | use_static_libs=$prefer_static_libs |
michael@0 | 5556 | if test "$use_static_libs" = built && test "$installed" = yes; then |
michael@0 | 5557 | use_static_libs=no |
michael@0 | 5558 | fi |
michael@0 | 5559 | if test -n "$library_names" && |
michael@0 | 5560 | { test "$use_static_libs" = no || test -z "$old_library"; }; then |
michael@0 | 5561 | case $host in |
michael@0 | 5562 | *cygwin* | *mingw* | *cegcc*) |
michael@0 | 5563 | # No point in relinking DLLs because paths are not encoded |
michael@0 | 5564 | notinst_deplibs="$notinst_deplibs $lib" |
michael@0 | 5565 | need_relink=no |
michael@0 | 5566 | ;; |
michael@0 | 5567 | *) |
michael@0 | 5568 | if test "$installed" = no; then |
michael@0 | 5569 | notinst_deplibs="$notinst_deplibs $lib" |
michael@0 | 5570 | need_relink=yes |
michael@0 | 5571 | fi |
michael@0 | 5572 | ;; |
michael@0 | 5573 | esac |
michael@0 | 5574 | # This is a shared library |
michael@0 | 5575 | |
michael@0 | 5576 | # Warn about portability, can't link against -module's on some |
michael@0 | 5577 | # systems (darwin). Don't bleat about dlopened modules though! |
michael@0 | 5578 | dlopenmodule="" |
michael@0 | 5579 | for dlpremoduletest in $dlprefiles; do |
michael@0 | 5580 | if test "X$dlpremoduletest" = "X$lib"; then |
michael@0 | 5581 | dlopenmodule="$dlpremoduletest" |
michael@0 | 5582 | break |
michael@0 | 5583 | fi |
michael@0 | 5584 | done |
michael@0 | 5585 | if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then |
michael@0 | 5586 | $ECHO |
michael@0 | 5587 | if test "$linkmode" = prog; then |
michael@0 | 5588 | $ECHO "*** Warning: Linking the executable $output against the loadable module" |
michael@0 | 5589 | else |
michael@0 | 5590 | $ECHO "*** Warning: Linking the shared library $output against the loadable module" |
michael@0 | 5591 | fi |
michael@0 | 5592 | $ECHO "*** $linklib is not portable!" |
michael@0 | 5593 | fi |
michael@0 | 5594 | if test "$linkmode" = lib && |
michael@0 | 5595 | test "$hardcode_into_libs" = yes; then |
michael@0 | 5596 | # Hardcode the library path. |
michael@0 | 5597 | # Skip directories that are in the system default run-time |
michael@0 | 5598 | # search path. |
michael@0 | 5599 | case " $sys_lib_dlsearch_path " in |
michael@0 | 5600 | *" $absdir "*) ;; |
michael@0 | 5601 | *) |
michael@0 | 5602 | case "$compile_rpath " in |
michael@0 | 5603 | *" $absdir "*) ;; |
michael@0 | 5604 | *) compile_rpath="$compile_rpath $absdir" |
michael@0 | 5605 | esac |
michael@0 | 5606 | ;; |
michael@0 | 5607 | esac |
michael@0 | 5608 | case " $sys_lib_dlsearch_path " in |
michael@0 | 5609 | *" $libdir "*) ;; |
michael@0 | 5610 | *) |
michael@0 | 5611 | case "$finalize_rpath " in |
michael@0 | 5612 | *" $libdir "*) ;; |
michael@0 | 5613 | *) finalize_rpath="$finalize_rpath $libdir" |
michael@0 | 5614 | esac |
michael@0 | 5615 | ;; |
michael@0 | 5616 | esac |
michael@0 | 5617 | fi |
michael@0 | 5618 | |
michael@0 | 5619 | if test -n "$old_archive_from_expsyms_cmds"; then |
michael@0 | 5620 | # figure out the soname |
michael@0 | 5621 | set dummy $library_names |
michael@0 | 5622 | shift |
michael@0 | 5623 | realname="$1" |
michael@0 | 5624 | shift |
michael@0 | 5625 | libname=`eval "\\$ECHO \"$libname_spec\""` |
michael@0 | 5626 | # use dlname if we got it. it's perfectly good, no? |
michael@0 | 5627 | if test -n "$dlname"; then |
michael@0 | 5628 | soname="$dlname" |
michael@0 | 5629 | elif test -n "$soname_spec"; then |
michael@0 | 5630 | # bleh windows |
michael@0 | 5631 | case $host in |
michael@0 | 5632 | *cygwin* | mingw* | *cegcc*) |
michael@0 | 5633 | func_arith $current - $age |
michael@0 | 5634 | major=$func_arith_result |
michael@0 | 5635 | versuffix="-$major" |
michael@0 | 5636 | ;; |
michael@0 | 5637 | esac |
michael@0 | 5638 | eval soname=\"$soname_spec\" |
michael@0 | 5639 | else |
michael@0 | 5640 | soname="$realname" |
michael@0 | 5641 | fi |
michael@0 | 5642 | |
michael@0 | 5643 | # Make a new name for the extract_expsyms_cmds to use |
michael@0 | 5644 | soroot="$soname" |
michael@0 | 5645 | func_basename "$soroot" |
michael@0 | 5646 | soname="$func_basename_result" |
michael@0 | 5647 | func_stripname 'lib' '.dll' "$soname" |
michael@0 | 5648 | newlib=libimp-$func_stripname_result.a |
michael@0 | 5649 | |
michael@0 | 5650 | # If the library has no export list, then create one now |
michael@0 | 5651 | if test -f "$output_objdir/$soname-def"; then : |
michael@0 | 5652 | else |
michael@0 | 5653 | func_verbose "extracting exported symbol list from \`$soname'" |
michael@0 | 5654 | func_execute_cmds "$extract_expsyms_cmds" 'exit $?' |
michael@0 | 5655 | fi |
michael@0 | 5656 | |
michael@0 | 5657 | # Create $newlib |
michael@0 | 5658 | if test -f "$output_objdir/$newlib"; then :; else |
michael@0 | 5659 | func_verbose "generating import library for \`$soname'" |
michael@0 | 5660 | func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' |
michael@0 | 5661 | fi |
michael@0 | 5662 | # make sure the library variables are pointing to the new library |
michael@0 | 5663 | dir=$output_objdir |
michael@0 | 5664 | linklib=$newlib |
michael@0 | 5665 | fi # test -n "$old_archive_from_expsyms_cmds" |
michael@0 | 5666 | |
michael@0 | 5667 | if test "$linkmode" = prog || test "$mode" != relink; then |
michael@0 | 5668 | add_shlibpath= |
michael@0 | 5669 | add_dir= |
michael@0 | 5670 | add= |
michael@0 | 5671 | lib_linked=yes |
michael@0 | 5672 | case $hardcode_action in |
michael@0 | 5673 | immediate | unsupported) |
michael@0 | 5674 | if test "$hardcode_direct" = no; then |
michael@0 | 5675 | add="$dir/$linklib" |
michael@0 | 5676 | case $host in |
michael@0 | 5677 | *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; |
michael@0 | 5678 | *-*-sysv4*uw2*) add_dir="-L$dir" ;; |
michael@0 | 5679 | *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ |
michael@0 | 5680 | *-*-unixware7*) add_dir="-L$dir" ;; |
michael@0 | 5681 | *-*-darwin* ) |
michael@0 | 5682 | # if the lib is a (non-dlopened) module then we can not |
michael@0 | 5683 | # link against it, someone is ignoring the earlier warnings |
michael@0 | 5684 | if /usr/bin/file -L $add 2> /dev/null | |
michael@0 | 5685 | $GREP ": [^:]* bundle" >/dev/null ; then |
michael@0 | 5686 | if test "X$dlopenmodule" != "X$lib"; then |
michael@0 | 5687 | $ECHO "*** Warning: lib $linklib is a module, not a shared library" |
michael@0 | 5688 | if test -z "$old_library" ; then |
michael@0 | 5689 | $ECHO |
michael@0 | 5690 | $ECHO "*** And there doesn't seem to be a static archive available" |
michael@0 | 5691 | $ECHO "*** The link will probably fail, sorry" |
michael@0 | 5692 | else |
michael@0 | 5693 | add="$dir/$old_library" |
michael@0 | 5694 | fi |
michael@0 | 5695 | elif test -n "$old_library"; then |
michael@0 | 5696 | add="$dir/$old_library" |
michael@0 | 5697 | fi |
michael@0 | 5698 | fi |
michael@0 | 5699 | esac |
michael@0 | 5700 | elif test "$hardcode_minus_L" = no; then |
michael@0 | 5701 | case $host in |
michael@0 | 5702 | *-*-sunos*) add_shlibpath="$dir" ;; |
michael@0 | 5703 | esac |
michael@0 | 5704 | add_dir="-L$dir" |
michael@0 | 5705 | add="-l$name" |
michael@0 | 5706 | elif test "$hardcode_shlibpath_var" = no; then |
michael@0 | 5707 | add_shlibpath="$dir" |
michael@0 | 5708 | add="-l$name" |
michael@0 | 5709 | else |
michael@0 | 5710 | lib_linked=no |
michael@0 | 5711 | fi |
michael@0 | 5712 | ;; |
michael@0 | 5713 | relink) |
michael@0 | 5714 | if test "$hardcode_direct" = yes && |
michael@0 | 5715 | test "$hardcode_direct_absolute" = no; then |
michael@0 | 5716 | add="$dir/$linklib" |
michael@0 | 5717 | elif test "$hardcode_minus_L" = yes; then |
michael@0 | 5718 | add_dir="-L$dir" |
michael@0 | 5719 | # Try looking first in the location we're being installed to. |
michael@0 | 5720 | if test -n "$inst_prefix_dir"; then |
michael@0 | 5721 | case $libdir in |
michael@0 | 5722 | [\\/]*) |
michael@0 | 5723 | add_dir="$add_dir -L$inst_prefix_dir$libdir" |
michael@0 | 5724 | ;; |
michael@0 | 5725 | esac |
michael@0 | 5726 | fi |
michael@0 | 5727 | add="-l$name" |
michael@0 | 5728 | elif test "$hardcode_shlibpath_var" = yes; then |
michael@0 | 5729 | add_shlibpath="$dir" |
michael@0 | 5730 | add="-l$name" |
michael@0 | 5731 | else |
michael@0 | 5732 | lib_linked=no |
michael@0 | 5733 | fi |
michael@0 | 5734 | ;; |
michael@0 | 5735 | *) lib_linked=no ;; |
michael@0 | 5736 | esac |
michael@0 | 5737 | |
michael@0 | 5738 | if test "$lib_linked" != yes; then |
michael@0 | 5739 | func_fatal_configuration "unsupported hardcode properties" |
michael@0 | 5740 | fi |
michael@0 | 5741 | |
michael@0 | 5742 | if test -n "$add_shlibpath"; then |
michael@0 | 5743 | case :$compile_shlibpath: in |
michael@0 | 5744 | *":$add_shlibpath:"*) ;; |
michael@0 | 5745 | *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; |
michael@0 | 5746 | esac |
michael@0 | 5747 | fi |
michael@0 | 5748 | if test "$linkmode" = prog; then |
michael@0 | 5749 | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" |
michael@0 | 5750 | test -n "$add" && compile_deplibs="$add $compile_deplibs" |
michael@0 | 5751 | else |
michael@0 | 5752 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
michael@0 | 5753 | test -n "$add" && deplibs="$add $deplibs" |
michael@0 | 5754 | if test "$hardcode_direct" != yes && |
michael@0 | 5755 | test "$hardcode_minus_L" != yes && |
michael@0 | 5756 | test "$hardcode_shlibpath_var" = yes; then |
michael@0 | 5757 | case :$finalize_shlibpath: in |
michael@0 | 5758 | *":$libdir:"*) ;; |
michael@0 | 5759 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
michael@0 | 5760 | esac |
michael@0 | 5761 | fi |
michael@0 | 5762 | fi |
michael@0 | 5763 | fi |
michael@0 | 5764 | |
michael@0 | 5765 | if test "$linkmode" = prog || test "$mode" = relink; then |
michael@0 | 5766 | add_shlibpath= |
michael@0 | 5767 | add_dir= |
michael@0 | 5768 | add= |
michael@0 | 5769 | # Finalize command for both is simple: just hardcode it. |
michael@0 | 5770 | if test "$hardcode_direct" = yes && |
michael@0 | 5771 | test "$hardcode_direct_absolute" = no; then |
michael@0 | 5772 | add="$libdir/$linklib" |
michael@0 | 5773 | elif test "$hardcode_minus_L" = yes; then |
michael@0 | 5774 | add_dir="-L$libdir" |
michael@0 | 5775 | add="-l$name" |
michael@0 | 5776 | elif test "$hardcode_shlibpath_var" = yes; then |
michael@0 | 5777 | case :$finalize_shlibpath: in |
michael@0 | 5778 | *":$libdir:"*) ;; |
michael@0 | 5779 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
michael@0 | 5780 | esac |
michael@0 | 5781 | add="-l$name" |
michael@0 | 5782 | elif test "$hardcode_automatic" = yes; then |
michael@0 | 5783 | if test -n "$inst_prefix_dir" && |
michael@0 | 5784 | test -f "$inst_prefix_dir$libdir/$linklib" ; then |
michael@0 | 5785 | add="$inst_prefix_dir$libdir/$linklib" |
michael@0 | 5786 | else |
michael@0 | 5787 | add="$libdir/$linklib" |
michael@0 | 5788 | fi |
michael@0 | 5789 | else |
michael@0 | 5790 | # We cannot seem to hardcode it, guess we'll fake it. |
michael@0 | 5791 | add_dir="-L$libdir" |
michael@0 | 5792 | # Try looking first in the location we're being installed to. |
michael@0 | 5793 | if test -n "$inst_prefix_dir"; then |
michael@0 | 5794 | case $libdir in |
michael@0 | 5795 | [\\/]*) |
michael@0 | 5796 | add_dir="$add_dir -L$inst_prefix_dir$libdir" |
michael@0 | 5797 | ;; |
michael@0 | 5798 | esac |
michael@0 | 5799 | fi |
michael@0 | 5800 | add="-l$name" |
michael@0 | 5801 | fi |
michael@0 | 5802 | |
michael@0 | 5803 | if test "$linkmode" = prog; then |
michael@0 | 5804 | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" |
michael@0 | 5805 | test -n "$add" && finalize_deplibs="$add $finalize_deplibs" |
michael@0 | 5806 | else |
michael@0 | 5807 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
michael@0 | 5808 | test -n "$add" && deplibs="$add $deplibs" |
michael@0 | 5809 | fi |
michael@0 | 5810 | fi |
michael@0 | 5811 | elif test "$linkmode" = prog; then |
michael@0 | 5812 | # Here we assume that one of hardcode_direct or hardcode_minus_L |
michael@0 | 5813 | # is not unsupported. This is valid on all known static and |
michael@0 | 5814 | # shared platforms. |
michael@0 | 5815 | if test "$hardcode_direct" != unsupported; then |
michael@0 | 5816 | test -n "$old_library" && linklib="$old_library" |
michael@0 | 5817 | compile_deplibs="$dir/$linklib $compile_deplibs" |
michael@0 | 5818 | finalize_deplibs="$dir/$linklib $finalize_deplibs" |
michael@0 | 5819 | else |
michael@0 | 5820 | compile_deplibs="-l$name -L$dir $compile_deplibs" |
michael@0 | 5821 | finalize_deplibs="-l$name -L$dir $finalize_deplibs" |
michael@0 | 5822 | fi |
michael@0 | 5823 | elif test "$build_libtool_libs" = yes; then |
michael@0 | 5824 | # Not a shared library |
michael@0 | 5825 | if test "$deplibs_check_method" != pass_all; then |
michael@0 | 5826 | # We're trying link a shared library against a static one |
michael@0 | 5827 | # but the system doesn't support it. |
michael@0 | 5828 | |
michael@0 | 5829 | # Just print a warning and add the library to dependency_libs so |
michael@0 | 5830 | # that the program can be linked against the static library. |
michael@0 | 5831 | $ECHO |
michael@0 | 5832 | $ECHO "*** Warning: This system can not link to static lib archive $lib." |
michael@0 | 5833 | $ECHO "*** I have the capability to make that library automatically link in when" |
michael@0 | 5834 | $ECHO "*** you link to this library. But I can only do this if you have a" |
michael@0 | 5835 | $ECHO "*** shared version of the library, which you do not appear to have." |
michael@0 | 5836 | if test "$module" = yes; then |
michael@0 | 5837 | $ECHO "*** But as you try to build a module library, libtool will still create " |
michael@0 | 5838 | $ECHO "*** a static module, that should work as long as the dlopening application" |
michael@0 | 5839 | $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." |
michael@0 | 5840 | if test -z "$global_symbol_pipe"; then |
michael@0 | 5841 | $ECHO |
michael@0 | 5842 | $ECHO "*** However, this would only work if libtool was able to extract symbol" |
michael@0 | 5843 | $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" |
michael@0 | 5844 | $ECHO "*** not find such a program. So, this module is probably useless." |
michael@0 | 5845 | $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." |
michael@0 | 5846 | fi |
michael@0 | 5847 | if test "$build_old_libs" = no; then |
michael@0 | 5848 | build_libtool_libs=module |
michael@0 | 5849 | build_old_libs=yes |
michael@0 | 5850 | else |
michael@0 | 5851 | build_libtool_libs=no |
michael@0 | 5852 | fi |
michael@0 | 5853 | fi |
michael@0 | 5854 | else |
michael@0 | 5855 | deplibs="$dir/$old_library $deplibs" |
michael@0 | 5856 | link_static=yes |
michael@0 | 5857 | fi |
michael@0 | 5858 | fi # link shared/static library? |
michael@0 | 5859 | |
michael@0 | 5860 | if test "$linkmode" = lib; then |
michael@0 | 5861 | if test -n "$dependency_libs" && |
michael@0 | 5862 | { test "$hardcode_into_libs" != yes || |
michael@0 | 5863 | test "$build_old_libs" = yes || |
michael@0 | 5864 | test "$link_static" = yes; }; then |
michael@0 | 5865 | # Extract -R from dependency_libs |
michael@0 | 5866 | temp_deplibs= |
michael@0 | 5867 | for libdir in $dependency_libs; do |
michael@0 | 5868 | case $libdir in |
michael@0 | 5869 | -R*) func_stripname '-R' '' "$libdir" |
michael@0 | 5870 | temp_xrpath=$func_stripname_result |
michael@0 | 5871 | case " $xrpath " in |
michael@0 | 5872 | *" $temp_xrpath "*) ;; |
michael@0 | 5873 | *) xrpath="$xrpath $temp_xrpath";; |
michael@0 | 5874 | esac;; |
michael@0 | 5875 | *) temp_deplibs="$temp_deplibs $libdir";; |
michael@0 | 5876 | esac |
michael@0 | 5877 | done |
michael@0 | 5878 | dependency_libs="$temp_deplibs" |
michael@0 | 5879 | fi |
michael@0 | 5880 | |
michael@0 | 5881 | newlib_search_path="$newlib_search_path $absdir" |
michael@0 | 5882 | # Link against this library |
michael@0 | 5883 | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" |
michael@0 | 5884 | # ... and its dependency_libs |
michael@0 | 5885 | tmp_libs= |
michael@0 | 5886 | for deplib in $dependency_libs; do |
michael@0 | 5887 | newdependency_libs="$deplib $newdependency_libs" |
michael@0 | 5888 | if $opt_duplicate_deps ; then |
michael@0 | 5889 | case "$tmp_libs " in |
michael@0 | 5890 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
michael@0 | 5891 | esac |
michael@0 | 5892 | fi |
michael@0 | 5893 | tmp_libs="$tmp_libs $deplib" |
michael@0 | 5894 | done |
michael@0 | 5895 | |
michael@0 | 5896 | if test "$link_all_deplibs" != no; then |
michael@0 | 5897 | # Add the search paths of all dependency libraries |
michael@0 | 5898 | for deplib in $dependency_libs; do |
michael@0 | 5899 | path= |
michael@0 | 5900 | case $deplib in |
michael@0 | 5901 | -L*) path="$deplib" ;; |
michael@0 | 5902 | *.la) |
michael@0 | 5903 | func_dirname "$deplib" "" "." |
michael@0 | 5904 | dir="$func_dirname_result" |
michael@0 | 5905 | # We need an absolute path. |
michael@0 | 5906 | case $dir in |
michael@0 | 5907 | [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; |
michael@0 | 5908 | *) |
michael@0 | 5909 | absdir=`cd "$dir" && pwd` |
michael@0 | 5910 | if test -z "$absdir"; then |
michael@0 | 5911 | func_warning "cannot determine absolute directory name of \`$dir'" |
michael@0 | 5912 | absdir="$dir" |
michael@0 | 5913 | fi |
michael@0 | 5914 | ;; |
michael@0 | 5915 | esac |
michael@0 | 5916 | if $GREP "^installed=no" $deplib > /dev/null; then |
michael@0 | 5917 | case $host in |
michael@0 | 5918 | *-*-darwin*) |
michael@0 | 5919 | depdepl= |
michael@0 | 5920 | eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` |
michael@0 | 5921 | if test -n "$deplibrary_names" ; then |
michael@0 | 5922 | for tmp in $deplibrary_names ; do |
michael@0 | 5923 | depdepl=$tmp |
michael@0 | 5924 | done |
michael@0 | 5925 | if test -f "$absdir/$objdir/$depdepl" ; then |
michael@0 | 5926 | depdepl="$absdir/$objdir/$depdepl" |
michael@0 | 5927 | darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` |
michael@0 | 5928 | if test -z "$darwin_install_name"; then |
michael@0 | 5929 | darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` |
michael@0 | 5930 | fi |
michael@0 | 5931 | compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" |
michael@0 | 5932 | linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" |
michael@0 | 5933 | path= |
michael@0 | 5934 | fi |
michael@0 | 5935 | fi |
michael@0 | 5936 | ;; |
michael@0 | 5937 | *) |
michael@0 | 5938 | path="-L$absdir/$objdir" |
michael@0 | 5939 | ;; |
michael@0 | 5940 | esac |
michael@0 | 5941 | else |
michael@0 | 5942 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
michael@0 | 5943 | test -z "$libdir" && \ |
michael@0 | 5944 | func_fatal_error "\`$deplib' is not a valid libtool archive" |
michael@0 | 5945 | test "$absdir" != "$libdir" && \ |
michael@0 | 5946 | func_warning "\`$deplib' seems to be moved" |
michael@0 | 5947 | |
michael@0 | 5948 | path="-L$absdir" |
michael@0 | 5949 | fi |
michael@0 | 5950 | ;; |
michael@0 | 5951 | esac |
michael@0 | 5952 | case " $deplibs " in |
michael@0 | 5953 | *" $path "*) ;; |
michael@0 | 5954 | *) deplibs="$path $deplibs" ;; |
michael@0 | 5955 | esac |
michael@0 | 5956 | done |
michael@0 | 5957 | fi # link_all_deplibs != no |
michael@0 | 5958 | fi # linkmode = lib |
michael@0 | 5959 | done # for deplib in $libs |
michael@0 | 5960 | if test "$pass" = link; then |
michael@0 | 5961 | if test "$linkmode" = "prog"; then |
michael@0 | 5962 | compile_deplibs="$new_inherited_linker_flags $compile_deplibs" |
michael@0 | 5963 | finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" |
michael@0 | 5964 | else |
michael@0 | 5965 | compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` |
michael@0 | 5966 | fi |
michael@0 | 5967 | fi |
michael@0 | 5968 | dependency_libs="$newdependency_libs" |
michael@0 | 5969 | if test "$pass" = dlpreopen; then |
michael@0 | 5970 | # Link the dlpreopened libraries before other libraries |
michael@0 | 5971 | for deplib in $save_deplibs; do |
michael@0 | 5972 | deplibs="$deplib $deplibs" |
michael@0 | 5973 | done |
michael@0 | 5974 | fi |
michael@0 | 5975 | if test "$pass" != dlopen; then |
michael@0 | 5976 | if test "$pass" != conv; then |
michael@0 | 5977 | # Make sure lib_search_path contains only unique directories. |
michael@0 | 5978 | lib_search_path= |
michael@0 | 5979 | for dir in $newlib_search_path; do |
michael@0 | 5980 | case "$lib_search_path " in |
michael@0 | 5981 | *" $dir "*) ;; |
michael@0 | 5982 | *) lib_search_path="$lib_search_path $dir" ;; |
michael@0 | 5983 | esac |
michael@0 | 5984 | done |
michael@0 | 5985 | newlib_search_path= |
michael@0 | 5986 | fi |
michael@0 | 5987 | |
michael@0 | 5988 | if test "$linkmode,$pass" != "prog,link"; then |
michael@0 | 5989 | vars="deplibs" |
michael@0 | 5990 | else |
michael@0 | 5991 | vars="compile_deplibs finalize_deplibs" |
michael@0 | 5992 | fi |
michael@0 | 5993 | for var in $vars dependency_libs; do |
michael@0 | 5994 | # Add libraries to $var in reverse order |
michael@0 | 5995 | eval tmp_libs=\"\$$var\" |
michael@0 | 5996 | new_libs= |
michael@0 | 5997 | for deplib in $tmp_libs; do |
michael@0 | 5998 | # FIXME: Pedantically, this is the right thing to do, so |
michael@0 | 5999 | # that some nasty dependency loop isn't accidentally |
michael@0 | 6000 | # broken: |
michael@0 | 6001 | #new_libs="$deplib $new_libs" |
michael@0 | 6002 | # Pragmatically, this seems to cause very few problems in |
michael@0 | 6003 | # practice: |
michael@0 | 6004 | case $deplib in |
michael@0 | 6005 | -L*) new_libs="$deplib $new_libs" ;; |
michael@0 | 6006 | -R*) ;; |
michael@0 | 6007 | *) |
michael@0 | 6008 | # And here is the reason: when a library appears more |
michael@0 | 6009 | # than once as an explicit dependence of a library, or |
michael@0 | 6010 | # is implicitly linked in more than once by the |
michael@0 | 6011 | # compiler, it is considered special, and multiple |
michael@0 | 6012 | # occurrences thereof are not removed. Compare this |
michael@0 | 6013 | # with having the same library being listed as a |
michael@0 | 6014 | # dependency of multiple other libraries: in this case, |
michael@0 | 6015 | # we know (pedantically, we assume) the library does not |
michael@0 | 6016 | # need to be listed more than once, so we keep only the |
michael@0 | 6017 | # last copy. This is not always right, but it is rare |
michael@0 | 6018 | # enough that we require users that really mean to play |
michael@0 | 6019 | # such unportable linking tricks to link the library |
michael@0 | 6020 | # using -Wl,-lname, so that libtool does not consider it |
michael@0 | 6021 | # for duplicate removal. |
michael@0 | 6022 | case " $specialdeplibs " in |
michael@0 | 6023 | *" $deplib "*) new_libs="$deplib $new_libs" ;; |
michael@0 | 6024 | *) |
michael@0 | 6025 | case " $new_libs " in |
michael@0 | 6026 | *" $deplib "*) ;; |
michael@0 | 6027 | *) new_libs="$deplib $new_libs" ;; |
michael@0 | 6028 | esac |
michael@0 | 6029 | ;; |
michael@0 | 6030 | esac |
michael@0 | 6031 | ;; |
michael@0 | 6032 | esac |
michael@0 | 6033 | done |
michael@0 | 6034 | tmp_libs= |
michael@0 | 6035 | for deplib in $new_libs; do |
michael@0 | 6036 | case $deplib in |
michael@0 | 6037 | -L*) |
michael@0 | 6038 | case " $tmp_libs " in |
michael@0 | 6039 | *" $deplib "*) ;; |
michael@0 | 6040 | *) tmp_libs="$tmp_libs $deplib" ;; |
michael@0 | 6041 | esac |
michael@0 | 6042 | ;; |
michael@0 | 6043 | *) tmp_libs="$tmp_libs $deplib" ;; |
michael@0 | 6044 | esac |
michael@0 | 6045 | done |
michael@0 | 6046 | eval $var=\"$tmp_libs\" |
michael@0 | 6047 | done # for var |
michael@0 | 6048 | fi |
michael@0 | 6049 | # Last step: remove runtime libs from dependency_libs |
michael@0 | 6050 | # (they stay in deplibs) |
michael@0 | 6051 | tmp_libs= |
michael@0 | 6052 | for i in $dependency_libs ; do |
michael@0 | 6053 | case " $predeps $postdeps $compiler_lib_search_path " in |
michael@0 | 6054 | *" $i "*) |
michael@0 | 6055 | i="" |
michael@0 | 6056 | ;; |
michael@0 | 6057 | esac |
michael@0 | 6058 | if test -n "$i" ; then |
michael@0 | 6059 | tmp_libs="$tmp_libs $i" |
michael@0 | 6060 | fi |
michael@0 | 6061 | done |
michael@0 | 6062 | dependency_libs=$tmp_libs |
michael@0 | 6063 | done # for pass |
michael@0 | 6064 | if test "$linkmode" = prog; then |
michael@0 | 6065 | dlfiles="$newdlfiles" |
michael@0 | 6066 | fi |
michael@0 | 6067 | if test "$linkmode" = prog || test "$linkmode" = lib; then |
michael@0 | 6068 | dlprefiles="$newdlprefiles" |
michael@0 | 6069 | fi |
michael@0 | 6070 | |
michael@0 | 6071 | case $linkmode in |
michael@0 | 6072 | oldlib) |
michael@0 | 6073 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
michael@0 | 6074 | func_warning "\`-dlopen' is ignored for archives" |
michael@0 | 6075 | fi |
michael@0 | 6076 | |
michael@0 | 6077 | case " $deplibs" in |
michael@0 | 6078 | *\ -l* | *\ -L*) |
michael@0 | 6079 | func_warning "\`-l' and \`-L' are ignored for archives" ;; |
michael@0 | 6080 | esac |
michael@0 | 6081 | |
michael@0 | 6082 | test -n "$rpath" && \ |
michael@0 | 6083 | func_warning "\`-rpath' is ignored for archives" |
michael@0 | 6084 | |
michael@0 | 6085 | test -n "$xrpath" && \ |
michael@0 | 6086 | func_warning "\`-R' is ignored for archives" |
michael@0 | 6087 | |
michael@0 | 6088 | test -n "$vinfo" && \ |
michael@0 | 6089 | func_warning "\`-version-info/-version-number' is ignored for archives" |
michael@0 | 6090 | |
michael@0 | 6091 | test -n "$release" && \ |
michael@0 | 6092 | func_warning "\`-release' is ignored for archives" |
michael@0 | 6093 | |
michael@0 | 6094 | test -n "$export_symbols$export_symbols_regex" && \ |
michael@0 | 6095 | func_warning "\`-export-symbols' is ignored for archives" |
michael@0 | 6096 | |
michael@0 | 6097 | # Now set the variables for building old libraries. |
michael@0 | 6098 | build_libtool_libs=no |
michael@0 | 6099 | oldlibs="$output" |
michael@0 | 6100 | objs="$objs$old_deplibs" |
michael@0 | 6101 | ;; |
michael@0 | 6102 | |
michael@0 | 6103 | lib) |
michael@0 | 6104 | # Make sure we only generate libraries of the form `libNAME.la'. |
michael@0 | 6105 | case $outputname in |
michael@0 | 6106 | lib*) |
michael@0 | 6107 | func_stripname 'lib' '.la' "$outputname" |
michael@0 | 6108 | name=$func_stripname_result |
michael@0 | 6109 | eval shared_ext=\"$shrext_cmds\" |
michael@0 | 6110 | eval libname=\"$libname_spec\" |
michael@0 | 6111 | ;; |
michael@0 | 6112 | *) |
michael@0 | 6113 | test "$module" = no && \ |
michael@0 | 6114 | func_fatal_help "libtool library \`$output' must begin with \`lib'" |
michael@0 | 6115 | |
michael@0 | 6116 | if test "$need_lib_prefix" != no; then |
michael@0 | 6117 | # Add the "lib" prefix for modules if required |
michael@0 | 6118 | func_stripname '' '.la' "$outputname" |
michael@0 | 6119 | name=$func_stripname_result |
michael@0 | 6120 | eval shared_ext=\"$shrext_cmds\" |
michael@0 | 6121 | eval libname=\"$libname_spec\" |
michael@0 | 6122 | else |
michael@0 | 6123 | func_stripname '' '.la' "$outputname" |
michael@0 | 6124 | libname=$func_stripname_result |
michael@0 | 6125 | fi |
michael@0 | 6126 | ;; |
michael@0 | 6127 | esac |
michael@0 | 6128 | |
michael@0 | 6129 | if test -n "$objs"; then |
michael@0 | 6130 | if test "$deplibs_check_method" != pass_all; then |
michael@0 | 6131 | func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" |
michael@0 | 6132 | else |
michael@0 | 6133 | $ECHO |
michael@0 | 6134 | $ECHO "*** Warning: Linking the shared library $output against the non-libtool" |
michael@0 | 6135 | $ECHO "*** objects $objs is not portable!" |
michael@0 | 6136 | libobjs="$libobjs $objs" |
michael@0 | 6137 | fi |
michael@0 | 6138 | fi |
michael@0 | 6139 | |
michael@0 | 6140 | test "$dlself" != no && \ |
michael@0 | 6141 | func_warning "\`-dlopen self' is ignored for libtool libraries" |
michael@0 | 6142 | |
michael@0 | 6143 | set dummy $rpath |
michael@0 | 6144 | shift |
michael@0 | 6145 | test "$#" -gt 1 && \ |
michael@0 | 6146 | func_warning "ignoring multiple \`-rpath's for a libtool library" |
michael@0 | 6147 | |
michael@0 | 6148 | install_libdir="$1" |
michael@0 | 6149 | |
michael@0 | 6150 | oldlibs= |
michael@0 | 6151 | if test -z "$rpath"; then |
michael@0 | 6152 | if test "$build_libtool_libs" = yes; then |
michael@0 | 6153 | # Building a libtool convenience library. |
michael@0 | 6154 | # Some compilers have problems with a `.al' extension so |
michael@0 | 6155 | # convenience libraries should have the same extension an |
michael@0 | 6156 | # archive normally would. |
michael@0 | 6157 | oldlibs="$output_objdir/$libname.$libext $oldlibs" |
michael@0 | 6158 | build_libtool_libs=convenience |
michael@0 | 6159 | build_old_libs=yes |
michael@0 | 6160 | fi |
michael@0 | 6161 | |
michael@0 | 6162 | test -n "$vinfo" && \ |
michael@0 | 6163 | func_warning "\`-version-info/-version-number' is ignored for convenience libraries" |
michael@0 | 6164 | |
michael@0 | 6165 | test -n "$release" && \ |
michael@0 | 6166 | func_warning "\`-release' is ignored for convenience libraries" |
michael@0 | 6167 | else |
michael@0 | 6168 | |
michael@0 | 6169 | # Parse the version information argument. |
michael@0 | 6170 | save_ifs="$IFS"; IFS=':' |
michael@0 | 6171 | set dummy $vinfo 0 0 0 |
michael@0 | 6172 | shift |
michael@0 | 6173 | IFS="$save_ifs" |
michael@0 | 6174 | |
michael@0 | 6175 | test -n "$7" && \ |
michael@0 | 6176 | func_fatal_help "too many parameters to \`-version-info'" |
michael@0 | 6177 | |
michael@0 | 6178 | # convert absolute version numbers to libtool ages |
michael@0 | 6179 | # this retains compatibility with .la files and attempts |
michael@0 | 6180 | # to make the code below a bit more comprehensible |
michael@0 | 6181 | |
michael@0 | 6182 | case $vinfo_number in |
michael@0 | 6183 | yes) |
michael@0 | 6184 | number_major="$1" |
michael@0 | 6185 | number_minor="$2" |
michael@0 | 6186 | number_revision="$3" |
michael@0 | 6187 | # |
michael@0 | 6188 | # There are really only two kinds -- those that |
michael@0 | 6189 | # use the current revision as the major version |
michael@0 | 6190 | # and those that subtract age and use age as |
michael@0 | 6191 | # a minor version. But, then there is irix |
michael@0 | 6192 | # which has an extra 1 added just for fun |
michael@0 | 6193 | # |
michael@0 | 6194 | case $version_type in |
michael@0 | 6195 | darwin|linux|osf|windows|none) |
michael@0 | 6196 | func_arith $number_major + $number_minor |
michael@0 | 6197 | current=$func_arith_result |
michael@0 | 6198 | age="$number_minor" |
michael@0 | 6199 | revision="$number_revision" |
michael@0 | 6200 | ;; |
michael@0 | 6201 | freebsd-aout|freebsd-elf|sunos) |
michael@0 | 6202 | current="$number_major" |
michael@0 | 6203 | revision="$number_minor" |
michael@0 | 6204 | age="0" |
michael@0 | 6205 | ;; |
michael@0 | 6206 | irix|nonstopux) |
michael@0 | 6207 | func_arith $number_major + $number_minor |
michael@0 | 6208 | current=$func_arith_result |
michael@0 | 6209 | age="$number_minor" |
michael@0 | 6210 | revision="$number_minor" |
michael@0 | 6211 | lt_irix_increment=no |
michael@0 | 6212 | ;; |
michael@0 | 6213 | *) |
michael@0 | 6214 | func_fatal_configuration "$modename: unknown library version type \`$version_type'" |
michael@0 | 6215 | ;; |
michael@0 | 6216 | esac |
michael@0 | 6217 | ;; |
michael@0 | 6218 | no) |
michael@0 | 6219 | current="$1" |
michael@0 | 6220 | revision="$2" |
michael@0 | 6221 | age="$3" |
michael@0 | 6222 | ;; |
michael@0 | 6223 | esac |
michael@0 | 6224 | |
michael@0 | 6225 | # Check that each of the things are valid numbers. |
michael@0 | 6226 | case $current in |
michael@0 | 6227 | 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]) ;; |
michael@0 | 6228 | *) |
michael@0 | 6229 | func_error "CURRENT \`$current' must be a nonnegative integer" |
michael@0 | 6230 | func_fatal_error "\`$vinfo' is not valid version information" |
michael@0 | 6231 | ;; |
michael@0 | 6232 | esac |
michael@0 | 6233 | |
michael@0 | 6234 | case $revision in |
michael@0 | 6235 | 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]) ;; |
michael@0 | 6236 | *) |
michael@0 | 6237 | func_error "REVISION \`$revision' must be a nonnegative integer" |
michael@0 | 6238 | func_fatal_error "\`$vinfo' is not valid version information" |
michael@0 | 6239 | ;; |
michael@0 | 6240 | esac |
michael@0 | 6241 | |
michael@0 | 6242 | case $age in |
michael@0 | 6243 | 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]) ;; |
michael@0 | 6244 | *) |
michael@0 | 6245 | func_error "AGE \`$age' must be a nonnegative integer" |
michael@0 | 6246 | func_fatal_error "\`$vinfo' is not valid version information" |
michael@0 | 6247 | ;; |
michael@0 | 6248 | esac |
michael@0 | 6249 | |
michael@0 | 6250 | if test "$age" -gt "$current"; then |
michael@0 | 6251 | func_error "AGE \`$age' is greater than the current interface number \`$current'" |
michael@0 | 6252 | func_fatal_error "\`$vinfo' is not valid version information" |
michael@0 | 6253 | fi |
michael@0 | 6254 | |
michael@0 | 6255 | # Calculate the version variables. |
michael@0 | 6256 | major= |
michael@0 | 6257 | versuffix= |
michael@0 | 6258 | verstring= |
michael@0 | 6259 | case $version_type in |
michael@0 | 6260 | none) ;; |
michael@0 | 6261 | |
michael@0 | 6262 | darwin) |
michael@0 | 6263 | # Like Linux, but with the current version available in |
michael@0 | 6264 | # verstring for coding it into the library header |
michael@0 | 6265 | func_arith $current - $age |
michael@0 | 6266 | major=.$func_arith_result |
michael@0 | 6267 | versuffix="$major.$age.$revision" |
michael@0 | 6268 | # Darwin ld doesn't like 0 for these options... |
michael@0 | 6269 | func_arith $current + 1 |
michael@0 | 6270 | minor_current=$func_arith_result |
michael@0 | 6271 | xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" |
michael@0 | 6272 | verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" |
michael@0 | 6273 | ;; |
michael@0 | 6274 | |
michael@0 | 6275 | freebsd-aout) |
michael@0 | 6276 | major=".$current" |
michael@0 | 6277 | versuffix=".$current.$revision"; |
michael@0 | 6278 | ;; |
michael@0 | 6279 | |
michael@0 | 6280 | freebsd-elf) |
michael@0 | 6281 | major=".$current" |
michael@0 | 6282 | versuffix=".$current" |
michael@0 | 6283 | ;; |
michael@0 | 6284 | |
michael@0 | 6285 | irix | nonstopux) |
michael@0 | 6286 | if test "X$lt_irix_increment" = "Xno"; then |
michael@0 | 6287 | func_arith $current - $age |
michael@0 | 6288 | else |
michael@0 | 6289 | func_arith $current - $age + 1 |
michael@0 | 6290 | fi |
michael@0 | 6291 | major=$func_arith_result |
michael@0 | 6292 | |
michael@0 | 6293 | case $version_type in |
michael@0 | 6294 | nonstopux) verstring_prefix=nonstopux ;; |
michael@0 | 6295 | *) verstring_prefix=sgi ;; |
michael@0 | 6296 | esac |
michael@0 | 6297 | verstring="$verstring_prefix$major.$revision" |
michael@0 | 6298 | |
michael@0 | 6299 | # Add in all the interfaces that we are compatible with. |
michael@0 | 6300 | loop=$revision |
michael@0 | 6301 | while test "$loop" -ne 0; do |
michael@0 | 6302 | func_arith $revision - $loop |
michael@0 | 6303 | iface=$func_arith_result |
michael@0 | 6304 | func_arith $loop - 1 |
michael@0 | 6305 | loop=$func_arith_result |
michael@0 | 6306 | verstring="$verstring_prefix$major.$iface:$verstring" |
michael@0 | 6307 | done |
michael@0 | 6308 | |
michael@0 | 6309 | # Before this point, $major must not contain `.'. |
michael@0 | 6310 | major=.$major |
michael@0 | 6311 | versuffix="$major.$revision" |
michael@0 | 6312 | ;; |
michael@0 | 6313 | |
michael@0 | 6314 | linux) |
michael@0 | 6315 | func_arith $current - $age |
michael@0 | 6316 | major=.$func_arith_result |
michael@0 | 6317 | versuffix="$major.$age.$revision" |
michael@0 | 6318 | ;; |
michael@0 | 6319 | |
michael@0 | 6320 | osf) |
michael@0 | 6321 | func_arith $current - $age |
michael@0 | 6322 | major=.$func_arith_result |
michael@0 | 6323 | versuffix=".$current.$age.$revision" |
michael@0 | 6324 | verstring="$current.$age.$revision" |
michael@0 | 6325 | |
michael@0 | 6326 | # Add in all the interfaces that we are compatible with. |
michael@0 | 6327 | loop=$age |
michael@0 | 6328 | while test "$loop" -ne 0; do |
michael@0 | 6329 | func_arith $current - $loop |
michael@0 | 6330 | iface=$func_arith_result |
michael@0 | 6331 | func_arith $loop - 1 |
michael@0 | 6332 | loop=$func_arith_result |
michael@0 | 6333 | verstring="$verstring:${iface}.0" |
michael@0 | 6334 | done |
michael@0 | 6335 | |
michael@0 | 6336 | # Make executables depend on our current version. |
michael@0 | 6337 | verstring="$verstring:${current}.0" |
michael@0 | 6338 | ;; |
michael@0 | 6339 | |
michael@0 | 6340 | qnx) |
michael@0 | 6341 | major=".$current" |
michael@0 | 6342 | versuffix=".$current" |
michael@0 | 6343 | ;; |
michael@0 | 6344 | |
michael@0 | 6345 | sunos) |
michael@0 | 6346 | major=".$current" |
michael@0 | 6347 | versuffix=".$current.$revision" |
michael@0 | 6348 | ;; |
michael@0 | 6349 | |
michael@0 | 6350 | windows) |
michael@0 | 6351 | # Use '-' rather than '.', since we only want one |
michael@0 | 6352 | # extension on DOS 8.3 filesystems. |
michael@0 | 6353 | func_arith $current - $age |
michael@0 | 6354 | major=$func_arith_result |
michael@0 | 6355 | versuffix="-$major" |
michael@0 | 6356 | ;; |
michael@0 | 6357 | |
michael@0 | 6358 | *) |
michael@0 | 6359 | func_fatal_configuration "unknown library version type \`$version_type'" |
michael@0 | 6360 | ;; |
michael@0 | 6361 | esac |
michael@0 | 6362 | |
michael@0 | 6363 | # Clear the version info if we defaulted, and they specified a release. |
michael@0 | 6364 | if test -z "$vinfo" && test -n "$release"; then |
michael@0 | 6365 | major= |
michael@0 | 6366 | case $version_type in |
michael@0 | 6367 | darwin) |
michael@0 | 6368 | # we can't check for "0.0" in archive_cmds due to quoting |
michael@0 | 6369 | # problems, so we reset it completely |
michael@0 | 6370 | verstring= |
michael@0 | 6371 | ;; |
michael@0 | 6372 | *) |
michael@0 | 6373 | verstring="0.0" |
michael@0 | 6374 | ;; |
michael@0 | 6375 | esac |
michael@0 | 6376 | if test "$need_version" = no; then |
michael@0 | 6377 | versuffix= |
michael@0 | 6378 | else |
michael@0 | 6379 | versuffix=".0.0" |
michael@0 | 6380 | fi |
michael@0 | 6381 | fi |
michael@0 | 6382 | |
michael@0 | 6383 | # Remove version info from name if versioning should be avoided |
michael@0 | 6384 | if test "$avoid_version" = yes && test "$need_version" = no; then |
michael@0 | 6385 | major= |
michael@0 | 6386 | versuffix= |
michael@0 | 6387 | verstring="" |
michael@0 | 6388 | fi |
michael@0 | 6389 | |
michael@0 | 6390 | # Check to see if the archive will have undefined symbols. |
michael@0 | 6391 | if test "$allow_undefined" = yes; then |
michael@0 | 6392 | if test "$allow_undefined_flag" = unsupported; then |
michael@0 | 6393 | func_warning "undefined symbols not allowed in $host shared libraries" |
michael@0 | 6394 | build_libtool_libs=no |
michael@0 | 6395 | build_old_libs=yes |
michael@0 | 6396 | fi |
michael@0 | 6397 | else |
michael@0 | 6398 | # Don't allow undefined symbols. |
michael@0 | 6399 | allow_undefined_flag="$no_undefined_flag" |
michael@0 | 6400 | fi |
michael@0 | 6401 | |
michael@0 | 6402 | fi |
michael@0 | 6403 | |
michael@0 | 6404 | func_generate_dlsyms "$libname" "$libname" "yes" |
michael@0 | 6405 | libobjs="$libobjs $symfileobj" |
michael@0 | 6406 | test "X$libobjs" = "X " && libobjs= |
michael@0 | 6407 | |
michael@0 | 6408 | if test "$mode" != relink; then |
michael@0 | 6409 | # Remove our outputs, but don't remove object files since they |
michael@0 | 6410 | # may have been created when compiling PIC objects. |
michael@0 | 6411 | removelist= |
michael@0 | 6412 | tempremovelist=`$ECHO "$output_objdir/*"` |
michael@0 | 6413 | for p in $tempremovelist; do |
michael@0 | 6414 | case $p in |
michael@0 | 6415 | *.$objext | *.gcno) |
michael@0 | 6416 | ;; |
michael@0 | 6417 | $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) |
michael@0 | 6418 | if test "X$precious_files_regex" != "X"; then |
michael@0 | 6419 | if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 |
michael@0 | 6420 | then |
michael@0 | 6421 | continue |
michael@0 | 6422 | fi |
michael@0 | 6423 | fi |
michael@0 | 6424 | removelist="$removelist $p" |
michael@0 | 6425 | ;; |
michael@0 | 6426 | *) ;; |
michael@0 | 6427 | esac |
michael@0 | 6428 | done |
michael@0 | 6429 | test -n "$removelist" && \ |
michael@0 | 6430 | func_show_eval "${RM}r \$removelist" |
michael@0 | 6431 | fi |
michael@0 | 6432 | |
michael@0 | 6433 | # Now set the variables for building old libraries. |
michael@0 | 6434 | if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then |
michael@0 | 6435 | oldlibs="$oldlibs $output_objdir/$libname.$libext" |
michael@0 | 6436 | |
michael@0 | 6437 | # Transform .lo files to .o files. |
michael@0 | 6438 | oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` |
michael@0 | 6439 | fi |
michael@0 | 6440 | |
michael@0 | 6441 | # Eliminate all temporary directories. |
michael@0 | 6442 | #for path in $notinst_path; do |
michael@0 | 6443 | # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` |
michael@0 | 6444 | # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` |
michael@0 | 6445 | # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` |
michael@0 | 6446 | #done |
michael@0 | 6447 | |
michael@0 | 6448 | if test -n "$xrpath"; then |
michael@0 | 6449 | # If the user specified any rpath flags, then add them. |
michael@0 | 6450 | temp_xrpath= |
michael@0 | 6451 | for libdir in $xrpath; do |
michael@0 | 6452 | temp_xrpath="$temp_xrpath -R$libdir" |
michael@0 | 6453 | case "$finalize_rpath " in |
michael@0 | 6454 | *" $libdir "*) ;; |
michael@0 | 6455 | *) finalize_rpath="$finalize_rpath $libdir" ;; |
michael@0 | 6456 | esac |
michael@0 | 6457 | done |
michael@0 | 6458 | if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then |
michael@0 | 6459 | dependency_libs="$temp_xrpath $dependency_libs" |
michael@0 | 6460 | fi |
michael@0 | 6461 | fi |
michael@0 | 6462 | |
michael@0 | 6463 | # Make sure dlfiles contains only unique files that won't be dlpreopened |
michael@0 | 6464 | old_dlfiles="$dlfiles" |
michael@0 | 6465 | dlfiles= |
michael@0 | 6466 | for lib in $old_dlfiles; do |
michael@0 | 6467 | case " $dlprefiles $dlfiles " in |
michael@0 | 6468 | *" $lib "*) ;; |
michael@0 | 6469 | *) dlfiles="$dlfiles $lib" ;; |
michael@0 | 6470 | esac |
michael@0 | 6471 | done |
michael@0 | 6472 | |
michael@0 | 6473 | # Make sure dlprefiles contains only unique files |
michael@0 | 6474 | old_dlprefiles="$dlprefiles" |
michael@0 | 6475 | dlprefiles= |
michael@0 | 6476 | for lib in $old_dlprefiles; do |
michael@0 | 6477 | case "$dlprefiles " in |
michael@0 | 6478 | *" $lib "*) ;; |
michael@0 | 6479 | *) dlprefiles="$dlprefiles $lib" ;; |
michael@0 | 6480 | esac |
michael@0 | 6481 | done |
michael@0 | 6482 | |
michael@0 | 6483 | if test "$build_libtool_libs" = yes; then |
michael@0 | 6484 | if test -n "$rpath"; then |
michael@0 | 6485 | case $host in |
michael@0 | 6486 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) |
michael@0 | 6487 | # these systems don't actually have a c library (as such)! |
michael@0 | 6488 | ;; |
michael@0 | 6489 | *-*-rhapsody* | *-*-darwin1.[012]) |
michael@0 | 6490 | # Rhapsody C library is in the System framework |
michael@0 | 6491 | deplibs="$deplibs System.ltframework" |
michael@0 | 6492 | ;; |
michael@0 | 6493 | *-*-netbsd*) |
michael@0 | 6494 | # Don't link with libc until the a.out ld.so is fixed. |
michael@0 | 6495 | ;; |
michael@0 | 6496 | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
michael@0 | 6497 | # Do not include libc due to us having libc/libc_r. |
michael@0 | 6498 | ;; |
michael@0 | 6499 | *-*-sco3.2v5* | *-*-sco5v6*) |
michael@0 | 6500 | # Causes problems with __ctype |
michael@0 | 6501 | ;; |
michael@0 | 6502 | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
michael@0 | 6503 | # Compiler inserts libc in the correct place for threads to work |
michael@0 | 6504 | ;; |
michael@0 | 6505 | *) |
michael@0 | 6506 | # Add libc to deplibs on all other systems if necessary. |
michael@0 | 6507 | if test "$build_libtool_need_lc" = "yes"; then |
michael@0 | 6508 | deplibs="$deplibs -lc" |
michael@0 | 6509 | fi |
michael@0 | 6510 | ;; |
michael@0 | 6511 | esac |
michael@0 | 6512 | fi |
michael@0 | 6513 | |
michael@0 | 6514 | # Transform deplibs into only deplibs that can be linked in shared. |
michael@0 | 6515 | name_save=$name |
michael@0 | 6516 | libname_save=$libname |
michael@0 | 6517 | release_save=$release |
michael@0 | 6518 | versuffix_save=$versuffix |
michael@0 | 6519 | major_save=$major |
michael@0 | 6520 | # I'm not sure if I'm treating the release correctly. I think |
michael@0 | 6521 | # release should show up in the -l (ie -lgmp5) so we don't want to |
michael@0 | 6522 | # add it in twice. Is that correct? |
michael@0 | 6523 | release="" |
michael@0 | 6524 | versuffix="" |
michael@0 | 6525 | major="" |
michael@0 | 6526 | newdeplibs= |
michael@0 | 6527 | droppeddeps=no |
michael@0 | 6528 | case $deplibs_check_method in |
michael@0 | 6529 | pass_all) |
michael@0 | 6530 | # Don't check for shared/static. Everything works. |
michael@0 | 6531 | # This might be a little naive. We might want to check |
michael@0 | 6532 | # whether the library exists or not. But this is on |
michael@0 | 6533 | # osf3 & osf4 and I'm not really sure... Just |
michael@0 | 6534 | # implementing what was already the behavior. |
michael@0 | 6535 | newdeplibs=$deplibs |
michael@0 | 6536 | ;; |
michael@0 | 6537 | test_compile) |
michael@0 | 6538 | # This code stresses the "libraries are programs" paradigm to its |
michael@0 | 6539 | # limits. Maybe even breaks it. We compile a program, linking it |
michael@0 | 6540 | # against the deplibs as a proxy for the library. Then we can check |
michael@0 | 6541 | # whether they linked in statically or dynamically with ldd. |
michael@0 | 6542 | $opt_dry_run || $RM conftest.c |
michael@0 | 6543 | cat > conftest.c <<EOF |
michael@0 | 6544 | int main() { return 0; } |
michael@0 | 6545 | EOF |
michael@0 | 6546 | $opt_dry_run || $RM conftest |
michael@0 | 6547 | if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then |
michael@0 | 6548 | ldd_output=`ldd conftest` |
michael@0 | 6549 | for i in $deplibs; do |
michael@0 | 6550 | case $i in |
michael@0 | 6551 | -l*) |
michael@0 | 6552 | func_stripname -l '' "$i" |
michael@0 | 6553 | name=$func_stripname_result |
michael@0 | 6554 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
michael@0 | 6555 | case " $predeps $postdeps " in |
michael@0 | 6556 | *" $i "*) |
michael@0 | 6557 | newdeplibs="$newdeplibs $i" |
michael@0 | 6558 | i="" |
michael@0 | 6559 | ;; |
michael@0 | 6560 | esac |
michael@0 | 6561 | fi |
michael@0 | 6562 | if test -n "$i" ; then |
michael@0 | 6563 | libname=`eval "\\$ECHO \"$libname_spec\""` |
michael@0 | 6564 | deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` |
michael@0 | 6565 | set dummy $deplib_matches; shift |
michael@0 | 6566 | deplib_match=$1 |
michael@0 | 6567 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
michael@0 | 6568 | newdeplibs="$newdeplibs $i" |
michael@0 | 6569 | else |
michael@0 | 6570 | droppeddeps=yes |
michael@0 | 6571 | $ECHO |
michael@0 | 6572 | $ECHO "*** Warning: dynamic linker does not accept needed library $i." |
michael@0 | 6573 | $ECHO "*** I have the capability to make that library automatically link in when" |
michael@0 | 6574 | $ECHO "*** you link to this library. But I can only do this if you have a" |
michael@0 | 6575 | $ECHO "*** shared version of the library, which I believe you do not have" |
michael@0 | 6576 | $ECHO "*** because a test_compile did reveal that the linker did not use it for" |
michael@0 | 6577 | $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." |
michael@0 | 6578 | fi |
michael@0 | 6579 | fi |
michael@0 | 6580 | ;; |
michael@0 | 6581 | *) |
michael@0 | 6582 | newdeplibs="$newdeplibs $i" |
michael@0 | 6583 | ;; |
michael@0 | 6584 | esac |
michael@0 | 6585 | done |
michael@0 | 6586 | else |
michael@0 | 6587 | # Error occurred in the first compile. Let's try to salvage |
michael@0 | 6588 | # the situation: Compile a separate program for each library. |
michael@0 | 6589 | for i in $deplibs; do |
michael@0 | 6590 | case $i in |
michael@0 | 6591 | -l*) |
michael@0 | 6592 | func_stripname -l '' "$i" |
michael@0 | 6593 | name=$func_stripname_result |
michael@0 | 6594 | $opt_dry_run || $RM conftest |
michael@0 | 6595 | if $LTCC $LTCFLAGS -o conftest conftest.c $i; then |
michael@0 | 6596 | ldd_output=`ldd conftest` |
michael@0 | 6597 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
michael@0 | 6598 | case " $predeps $postdeps " in |
michael@0 | 6599 | *" $i "*) |
michael@0 | 6600 | newdeplibs="$newdeplibs $i" |
michael@0 | 6601 | i="" |
michael@0 | 6602 | ;; |
michael@0 | 6603 | esac |
michael@0 | 6604 | fi |
michael@0 | 6605 | if test -n "$i" ; then |
michael@0 | 6606 | libname=`eval "\\$ECHO \"$libname_spec\""` |
michael@0 | 6607 | deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` |
michael@0 | 6608 | set dummy $deplib_matches; shift |
michael@0 | 6609 | deplib_match=$1 |
michael@0 | 6610 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then |
michael@0 | 6611 | newdeplibs="$newdeplibs $i" |
michael@0 | 6612 | else |
michael@0 | 6613 | droppeddeps=yes |
michael@0 | 6614 | $ECHO |
michael@0 | 6615 | $ECHO "*** Warning: dynamic linker does not accept needed library $i." |
michael@0 | 6616 | $ECHO "*** I have the capability to make that library automatically link in when" |
michael@0 | 6617 | $ECHO "*** you link to this library. But I can only do this if you have a" |
michael@0 | 6618 | $ECHO "*** shared version of the library, which you do not appear to have" |
michael@0 | 6619 | $ECHO "*** because a test_compile did reveal that the linker did not use this one" |
michael@0 | 6620 | $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." |
michael@0 | 6621 | fi |
michael@0 | 6622 | fi |
michael@0 | 6623 | else |
michael@0 | 6624 | droppeddeps=yes |
michael@0 | 6625 | $ECHO |
michael@0 | 6626 | $ECHO "*** Warning! Library $i is needed by this library but I was not able to" |
michael@0 | 6627 | $ECHO "*** make it link in! You will probably need to install it or some" |
michael@0 | 6628 | $ECHO "*** library that it depends on before this library will be fully" |
michael@0 | 6629 | $ECHO "*** functional. Installing it before continuing would be even better." |
michael@0 | 6630 | fi |
michael@0 | 6631 | ;; |
michael@0 | 6632 | *) |
michael@0 | 6633 | newdeplibs="$newdeplibs $i" |
michael@0 | 6634 | ;; |
michael@0 | 6635 | esac |
michael@0 | 6636 | done |
michael@0 | 6637 | fi |
michael@0 | 6638 | ;; |
michael@0 | 6639 | file_magic*) |
michael@0 | 6640 | set dummy $deplibs_check_method; shift |
michael@0 | 6641 | file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
michael@0 | 6642 | for a_deplib in $deplibs; do |
michael@0 | 6643 | case $a_deplib in |
michael@0 | 6644 | -l*) |
michael@0 | 6645 | func_stripname -l '' "$a_deplib" |
michael@0 | 6646 | name=$func_stripname_result |
michael@0 | 6647 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
michael@0 | 6648 | case " $predeps $postdeps " in |
michael@0 | 6649 | *" $a_deplib "*) |
michael@0 | 6650 | newdeplibs="$newdeplibs $a_deplib" |
michael@0 | 6651 | a_deplib="" |
michael@0 | 6652 | ;; |
michael@0 | 6653 | esac |
michael@0 | 6654 | fi |
michael@0 | 6655 | if test -n "$a_deplib" ; then |
michael@0 | 6656 | libname=`eval "\\$ECHO \"$libname_spec\""` |
michael@0 | 6657 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
michael@0 | 6658 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
michael@0 | 6659 | for potent_lib in $potential_libs; do |
michael@0 | 6660 | # Follow soft links. |
michael@0 | 6661 | if ls -lLd "$potent_lib" 2>/dev/null | |
michael@0 | 6662 | $GREP " -> " >/dev/null; then |
michael@0 | 6663 | continue |
michael@0 | 6664 | fi |
michael@0 | 6665 | # The statement above tries to avoid entering an |
michael@0 | 6666 | # endless loop below, in case of cyclic links. |
michael@0 | 6667 | # We might still enter an endless loop, since a link |
michael@0 | 6668 | # loop can be closed while we follow links, |
michael@0 | 6669 | # but so what? |
michael@0 | 6670 | potlib="$potent_lib" |
michael@0 | 6671 | while test -h "$potlib" 2>/dev/null; do |
michael@0 | 6672 | potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` |
michael@0 | 6673 | case $potliblink in |
michael@0 | 6674 | [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; |
michael@0 | 6675 | *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; |
michael@0 | 6676 | esac |
michael@0 | 6677 | done |
michael@0 | 6678 | if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | |
michael@0 | 6679 | $SED -e 10q | |
michael@0 | 6680 | $EGREP "$file_magic_regex" > /dev/null; then |
michael@0 | 6681 | newdeplibs="$newdeplibs $a_deplib" |
michael@0 | 6682 | a_deplib="" |
michael@0 | 6683 | break 2 |
michael@0 | 6684 | fi |
michael@0 | 6685 | done |
michael@0 | 6686 | done |
michael@0 | 6687 | fi |
michael@0 | 6688 | if test -n "$a_deplib" ; then |
michael@0 | 6689 | droppeddeps=yes |
michael@0 | 6690 | $ECHO |
michael@0 | 6691 | $ECHO "*** Warning: linker path does not have real file for library $a_deplib." |
michael@0 | 6692 | $ECHO "*** I have the capability to make that library automatically link in when" |
michael@0 | 6693 | $ECHO "*** you link to this library. But I can only do this if you have a" |
michael@0 | 6694 | $ECHO "*** shared version of the library, which you do not appear to have" |
michael@0 | 6695 | $ECHO "*** because I did check the linker path looking for a file starting" |
michael@0 | 6696 | if test -z "$potlib" ; then |
michael@0 | 6697 | $ECHO "*** with $libname but no candidates were found. (...for file magic test)" |
michael@0 | 6698 | else |
michael@0 | 6699 | $ECHO "*** with $libname and none of the candidates passed a file format test" |
michael@0 | 6700 | $ECHO "*** using a file magic. Last file checked: $potlib" |
michael@0 | 6701 | fi |
michael@0 | 6702 | fi |
michael@0 | 6703 | ;; |
michael@0 | 6704 | *) |
michael@0 | 6705 | # Add a -L argument. |
michael@0 | 6706 | newdeplibs="$newdeplibs $a_deplib" |
michael@0 | 6707 | ;; |
michael@0 | 6708 | esac |
michael@0 | 6709 | done # Gone through all deplibs. |
michael@0 | 6710 | ;; |
michael@0 | 6711 | match_pattern*) |
michael@0 | 6712 | set dummy $deplibs_check_method; shift |
michael@0 | 6713 | match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` |
michael@0 | 6714 | for a_deplib in $deplibs; do |
michael@0 | 6715 | case $a_deplib in |
michael@0 | 6716 | -l*) |
michael@0 | 6717 | func_stripname -l '' "$a_deplib" |
michael@0 | 6718 | name=$func_stripname_result |
michael@0 | 6719 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
michael@0 | 6720 | case " $predeps $postdeps " in |
michael@0 | 6721 | *" $a_deplib "*) |
michael@0 | 6722 | newdeplibs="$newdeplibs $a_deplib" |
michael@0 | 6723 | a_deplib="" |
michael@0 | 6724 | ;; |
michael@0 | 6725 | esac |
michael@0 | 6726 | fi |
michael@0 | 6727 | if test -n "$a_deplib" ; then |
michael@0 | 6728 | libname=`eval "\\$ECHO \"$libname_spec\""` |
michael@0 | 6729 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do |
michael@0 | 6730 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` |
michael@0 | 6731 | for potent_lib in $potential_libs; do |
michael@0 | 6732 | potlib="$potent_lib" # see symlink-check above in file_magic test |
michael@0 | 6733 | if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ |
michael@0 | 6734 | $EGREP "$match_pattern_regex" > /dev/null; then |
michael@0 | 6735 | newdeplibs="$newdeplibs $a_deplib" |
michael@0 | 6736 | a_deplib="" |
michael@0 | 6737 | break 2 |
michael@0 | 6738 | fi |
michael@0 | 6739 | done |
michael@0 | 6740 | done |
michael@0 | 6741 | fi |
michael@0 | 6742 | if test -n "$a_deplib" ; then |
michael@0 | 6743 | droppeddeps=yes |
michael@0 | 6744 | $ECHO |
michael@0 | 6745 | $ECHO "*** Warning: linker path does not have real file for library $a_deplib." |
michael@0 | 6746 | $ECHO "*** I have the capability to make that library automatically link in when" |
michael@0 | 6747 | $ECHO "*** you link to this library. But I can only do this if you have a" |
michael@0 | 6748 | $ECHO "*** shared version of the library, which you do not appear to have" |
michael@0 | 6749 | $ECHO "*** because I did check the linker path looking for a file starting" |
michael@0 | 6750 | if test -z "$potlib" ; then |
michael@0 | 6751 | $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" |
michael@0 | 6752 | else |
michael@0 | 6753 | $ECHO "*** with $libname and none of the candidates passed a file format test" |
michael@0 | 6754 | $ECHO "*** using a regex pattern. Last file checked: $potlib" |
michael@0 | 6755 | fi |
michael@0 | 6756 | fi |
michael@0 | 6757 | ;; |
michael@0 | 6758 | *) |
michael@0 | 6759 | # Add a -L argument. |
michael@0 | 6760 | newdeplibs="$newdeplibs $a_deplib" |
michael@0 | 6761 | ;; |
michael@0 | 6762 | esac |
michael@0 | 6763 | done # Gone through all deplibs. |
michael@0 | 6764 | ;; |
michael@0 | 6765 | none | unknown | *) |
michael@0 | 6766 | newdeplibs="" |
michael@0 | 6767 | tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ |
michael@0 | 6768 | -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` |
michael@0 | 6769 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
michael@0 | 6770 | for i in $predeps $postdeps ; do |
michael@0 | 6771 | # can't use Xsed below, because $i might contain '/' |
michael@0 | 6772 | tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` |
michael@0 | 6773 | done |
michael@0 | 6774 | fi |
michael@0 | 6775 | if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | |
michael@0 | 6776 | $GREP . >/dev/null; then |
michael@0 | 6777 | $ECHO |
michael@0 | 6778 | if test "X$deplibs_check_method" = "Xnone"; then |
michael@0 | 6779 | $ECHO "*** Warning: inter-library dependencies are not supported in this platform." |
michael@0 | 6780 | else |
michael@0 | 6781 | $ECHO "*** Warning: inter-library dependencies are not known to be supported." |
michael@0 | 6782 | fi |
michael@0 | 6783 | $ECHO "*** All declared inter-library dependencies are being dropped." |
michael@0 | 6784 | droppeddeps=yes |
michael@0 | 6785 | fi |
michael@0 | 6786 | ;; |
michael@0 | 6787 | esac |
michael@0 | 6788 | versuffix=$versuffix_save |
michael@0 | 6789 | major=$major_save |
michael@0 | 6790 | release=$release_save |
michael@0 | 6791 | libname=$libname_save |
michael@0 | 6792 | name=$name_save |
michael@0 | 6793 | |
michael@0 | 6794 | case $host in |
michael@0 | 6795 | *-*-rhapsody* | *-*-darwin1.[012]) |
michael@0 | 6796 | # On Rhapsody replace the C library with the System framework |
michael@0 | 6797 | newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` |
michael@0 | 6798 | ;; |
michael@0 | 6799 | esac |
michael@0 | 6800 | |
michael@0 | 6801 | if test "$droppeddeps" = yes; then |
michael@0 | 6802 | if test "$module" = yes; then |
michael@0 | 6803 | $ECHO |
michael@0 | 6804 | $ECHO "*** Warning: libtool could not satisfy all declared inter-library" |
michael@0 | 6805 | $ECHO "*** dependencies of module $libname. Therefore, libtool will create" |
michael@0 | 6806 | $ECHO "*** a static module, that should work as long as the dlopening" |
michael@0 | 6807 | $ECHO "*** application is linked with the -dlopen flag." |
michael@0 | 6808 | if test -z "$global_symbol_pipe"; then |
michael@0 | 6809 | $ECHO |
michael@0 | 6810 | $ECHO "*** However, this would only work if libtool was able to extract symbol" |
michael@0 | 6811 | $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" |
michael@0 | 6812 | $ECHO "*** not find such a program. So, this module is probably useless." |
michael@0 | 6813 | $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." |
michael@0 | 6814 | fi |
michael@0 | 6815 | if test "$build_old_libs" = no; then |
michael@0 | 6816 | oldlibs="$output_objdir/$libname.$libext" |
michael@0 | 6817 | build_libtool_libs=module |
michael@0 | 6818 | build_old_libs=yes |
michael@0 | 6819 | else |
michael@0 | 6820 | build_libtool_libs=no |
michael@0 | 6821 | fi |
michael@0 | 6822 | else |
michael@0 | 6823 | $ECHO "*** The inter-library dependencies that have been dropped here will be" |
michael@0 | 6824 | $ECHO "*** automatically added whenever a program is linked with this library" |
michael@0 | 6825 | $ECHO "*** or is declared to -dlopen it." |
michael@0 | 6826 | |
michael@0 | 6827 | if test "$allow_undefined" = no; then |
michael@0 | 6828 | $ECHO |
michael@0 | 6829 | $ECHO "*** Since this library must not contain undefined symbols," |
michael@0 | 6830 | $ECHO "*** because either the platform does not support them or" |
michael@0 | 6831 | $ECHO "*** it was explicitly requested with -no-undefined," |
michael@0 | 6832 | $ECHO "*** libtool will only create a static version of it." |
michael@0 | 6833 | if test "$build_old_libs" = no; then |
michael@0 | 6834 | oldlibs="$output_objdir/$libname.$libext" |
michael@0 | 6835 | build_libtool_libs=module |
michael@0 | 6836 | build_old_libs=yes |
michael@0 | 6837 | else |
michael@0 | 6838 | build_libtool_libs=no |
michael@0 | 6839 | fi |
michael@0 | 6840 | fi |
michael@0 | 6841 | fi |
michael@0 | 6842 | fi |
michael@0 | 6843 | # Done checking deplibs! |
michael@0 | 6844 | deplibs=$newdeplibs |
michael@0 | 6845 | fi |
michael@0 | 6846 | # Time to change all our "foo.ltframework" stuff back to "-framework foo" |
michael@0 | 6847 | case $host in |
michael@0 | 6848 | *-*-darwin*) |
michael@0 | 6849 | newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` |
michael@0 | 6850 | new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` |
michael@0 | 6851 | deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` |
michael@0 | 6852 | ;; |
michael@0 | 6853 | esac |
michael@0 | 6854 | |
michael@0 | 6855 | # move library search paths that coincide with paths to not yet |
michael@0 | 6856 | # installed libraries to the beginning of the library search list |
michael@0 | 6857 | new_libs= |
michael@0 | 6858 | for path in $notinst_path; do |
michael@0 | 6859 | case " $new_libs " in |
michael@0 | 6860 | *" -L$path/$objdir "*) ;; |
michael@0 | 6861 | *) |
michael@0 | 6862 | case " $deplibs " in |
michael@0 | 6863 | *" -L$path/$objdir "*) |
michael@0 | 6864 | new_libs="$new_libs -L$path/$objdir" ;; |
michael@0 | 6865 | esac |
michael@0 | 6866 | ;; |
michael@0 | 6867 | esac |
michael@0 | 6868 | done |
michael@0 | 6869 | for deplib in $deplibs; do |
michael@0 | 6870 | case $deplib in |
michael@0 | 6871 | -L*) |
michael@0 | 6872 | case " $new_libs " in |
michael@0 | 6873 | *" $deplib "*) ;; |
michael@0 | 6874 | *) new_libs="$new_libs $deplib" ;; |
michael@0 | 6875 | esac |
michael@0 | 6876 | ;; |
michael@0 | 6877 | *) new_libs="$new_libs $deplib" ;; |
michael@0 | 6878 | esac |
michael@0 | 6879 | done |
michael@0 | 6880 | deplibs="$new_libs" |
michael@0 | 6881 | |
michael@0 | 6882 | # All the library-specific variables (install_libdir is set above). |
michael@0 | 6883 | library_names= |
michael@0 | 6884 | old_library= |
michael@0 | 6885 | dlname= |
michael@0 | 6886 | |
michael@0 | 6887 | # Test again, we may have decided not to build it any more |
michael@0 | 6888 | if test "$build_libtool_libs" = yes; then |
michael@0 | 6889 | if test "$hardcode_into_libs" = yes; then |
michael@0 | 6890 | # Hardcode the library paths |
michael@0 | 6891 | hardcode_libdirs= |
michael@0 | 6892 | dep_rpath= |
michael@0 | 6893 | rpath="$finalize_rpath" |
michael@0 | 6894 | test "$mode" != relink && rpath="$compile_rpath$rpath" |
michael@0 | 6895 | for libdir in $rpath; do |
michael@0 | 6896 | if test -n "$hardcode_libdir_flag_spec"; then |
michael@0 | 6897 | if test -n "$hardcode_libdir_separator"; then |
michael@0 | 6898 | if test -z "$hardcode_libdirs"; then |
michael@0 | 6899 | hardcode_libdirs="$libdir" |
michael@0 | 6900 | else |
michael@0 | 6901 | # Just accumulate the unique libdirs. |
michael@0 | 6902 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
michael@0 | 6903 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
michael@0 | 6904 | ;; |
michael@0 | 6905 | *) |
michael@0 | 6906 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
michael@0 | 6907 | ;; |
michael@0 | 6908 | esac |
michael@0 | 6909 | fi |
michael@0 | 6910 | else |
michael@0 | 6911 | eval flag=\"$hardcode_libdir_flag_spec\" |
michael@0 | 6912 | dep_rpath="$dep_rpath $flag" |
michael@0 | 6913 | fi |
michael@0 | 6914 | elif test -n "$runpath_var"; then |
michael@0 | 6915 | case "$perm_rpath " in |
michael@0 | 6916 | *" $libdir "*) ;; |
michael@0 | 6917 | *) perm_rpath="$perm_rpath $libdir" ;; |
michael@0 | 6918 | esac |
michael@0 | 6919 | fi |
michael@0 | 6920 | done |
michael@0 | 6921 | # Substitute the hardcoded libdirs into the rpath. |
michael@0 | 6922 | if test -n "$hardcode_libdir_separator" && |
michael@0 | 6923 | test -n "$hardcode_libdirs"; then |
michael@0 | 6924 | libdir="$hardcode_libdirs" |
michael@0 | 6925 | if test -n "$hardcode_libdir_flag_spec_ld"; then |
michael@0 | 6926 | eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" |
michael@0 | 6927 | else |
michael@0 | 6928 | eval dep_rpath=\"$hardcode_libdir_flag_spec\" |
michael@0 | 6929 | fi |
michael@0 | 6930 | fi |
michael@0 | 6931 | if test -n "$runpath_var" && test -n "$perm_rpath"; then |
michael@0 | 6932 | # We should set the runpath_var. |
michael@0 | 6933 | rpath= |
michael@0 | 6934 | for dir in $perm_rpath; do |
michael@0 | 6935 | rpath="$rpath$dir:" |
michael@0 | 6936 | done |
michael@0 | 6937 | eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" |
michael@0 | 6938 | fi |
michael@0 | 6939 | test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" |
michael@0 | 6940 | fi |
michael@0 | 6941 | |
michael@0 | 6942 | shlibpath="$finalize_shlibpath" |
michael@0 | 6943 | test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" |
michael@0 | 6944 | if test -n "$shlibpath"; then |
michael@0 | 6945 | eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" |
michael@0 | 6946 | fi |
michael@0 | 6947 | |
michael@0 | 6948 | # Get the real and link names of the library. |
michael@0 | 6949 | eval shared_ext=\"$shrext_cmds\" |
michael@0 | 6950 | eval library_names=\"$library_names_spec\" |
michael@0 | 6951 | set dummy $library_names |
michael@0 | 6952 | shift |
michael@0 | 6953 | realname="$1" |
michael@0 | 6954 | shift |
michael@0 | 6955 | |
michael@0 | 6956 | if test -n "$soname_spec"; then |
michael@0 | 6957 | eval soname=\"$soname_spec\" |
michael@0 | 6958 | else |
michael@0 | 6959 | soname="$realname" |
michael@0 | 6960 | fi |
michael@0 | 6961 | if test -z "$dlname"; then |
michael@0 | 6962 | dlname=$soname |
michael@0 | 6963 | fi |
michael@0 | 6964 | |
michael@0 | 6965 | lib="$output_objdir/$realname" |
michael@0 | 6966 | linknames= |
michael@0 | 6967 | for link |
michael@0 | 6968 | do |
michael@0 | 6969 | linknames="$linknames $link" |
michael@0 | 6970 | done |
michael@0 | 6971 | |
michael@0 | 6972 | # Use standard objects if they are pic |
michael@0 | 6973 | test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
michael@0 | 6974 | test "X$libobjs" = "X " && libobjs= |
michael@0 | 6975 | |
michael@0 | 6976 | delfiles= |
michael@0 | 6977 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
michael@0 | 6978 | $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" |
michael@0 | 6979 | export_symbols="$output_objdir/$libname.uexp" |
michael@0 | 6980 | delfiles="$delfiles $export_symbols" |
michael@0 | 6981 | fi |
michael@0 | 6982 | |
michael@0 | 6983 | orig_export_symbols= |
michael@0 | 6984 | case $host_os in |
michael@0 | 6985 | cygwin* | mingw* | cegcc*) |
michael@0 | 6986 | if test -n "$export_symbols" && test -z "$export_symbols_regex"; then |
michael@0 | 6987 | # exporting using user supplied symfile |
michael@0 | 6988 | if test "x`$SED 1q $export_symbols`" != xEXPORTS; then |
michael@0 | 6989 | # and it's NOT already a .def file. Must figure out |
michael@0 | 6990 | # which of the given symbols are data symbols and tag |
michael@0 | 6991 | # them as such. So, trigger use of export_symbols_cmds. |
michael@0 | 6992 | # export_symbols gets reassigned inside the "prepare |
michael@0 | 6993 | # the list of exported symbols" if statement, so the |
michael@0 | 6994 | # include_expsyms logic still works. |
michael@0 | 6995 | orig_export_symbols="$export_symbols" |
michael@0 | 6996 | export_symbols= |
michael@0 | 6997 | always_export_symbols=yes |
michael@0 | 6998 | fi |
michael@0 | 6999 | fi |
michael@0 | 7000 | ;; |
michael@0 | 7001 | esac |
michael@0 | 7002 | |
michael@0 | 7003 | # Prepare the list of exported symbols |
michael@0 | 7004 | if test -z "$export_symbols"; then |
michael@0 | 7005 | if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then |
michael@0 | 7006 | func_verbose "generating symbol list for \`$libname.la'" |
michael@0 | 7007 | export_symbols="$output_objdir/$libname.exp" |
michael@0 | 7008 | $opt_dry_run || $RM $export_symbols |
michael@0 | 7009 | cmds=$export_symbols_cmds |
michael@0 | 7010 | save_ifs="$IFS"; IFS='~' |
michael@0 | 7011 | for cmd in $cmds; do |
michael@0 | 7012 | IFS="$save_ifs" |
michael@0 | 7013 | eval cmd=\"$cmd\" |
michael@0 | 7014 | func_len " $cmd" |
michael@0 | 7015 | len=$func_len_result |
michael@0 | 7016 | if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
michael@0 | 7017 | func_show_eval "$cmd" 'exit $?' |
michael@0 | 7018 | skipped_export=false |
michael@0 | 7019 | else |
michael@0 | 7020 | # The command line is too long to execute in one step. |
michael@0 | 7021 | func_verbose "using reloadable object file for export list..." |
michael@0 | 7022 | skipped_export=: |
michael@0 | 7023 | # Break out early, otherwise skipped_export may be |
michael@0 | 7024 | # set to false by a later but shorter cmd. |
michael@0 | 7025 | break |
michael@0 | 7026 | fi |
michael@0 | 7027 | done |
michael@0 | 7028 | IFS="$save_ifs" |
michael@0 | 7029 | if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then |
michael@0 | 7030 | func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' |
michael@0 | 7031 | func_show_eval '$MV "${export_symbols}T" "$export_symbols"' |
michael@0 | 7032 | fi |
michael@0 | 7033 | fi |
michael@0 | 7034 | fi |
michael@0 | 7035 | |
michael@0 | 7036 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
michael@0 | 7037 | tmp_export_symbols="$export_symbols" |
michael@0 | 7038 | test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" |
michael@0 | 7039 | $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' |
michael@0 | 7040 | fi |
michael@0 | 7041 | |
michael@0 | 7042 | if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then |
michael@0 | 7043 | # The given exports_symbols file has to be filtered, so filter it. |
michael@0 | 7044 | func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" |
michael@0 | 7045 | # FIXME: $output_objdir/$libname.filter potentially contains lots of |
michael@0 | 7046 | # 's' commands which not all seds can handle. GNU sed should be fine |
michael@0 | 7047 | # though. Also, the filter scales superlinearly with the number of |
michael@0 | 7048 | # global variables. join(1) would be nice here, but unfortunately |
michael@0 | 7049 | # isn't a blessed tool. |
michael@0 | 7050 | $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter |
michael@0 | 7051 | delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" |
michael@0 | 7052 | export_symbols=$output_objdir/$libname.def |
michael@0 | 7053 | $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols |
michael@0 | 7054 | fi |
michael@0 | 7055 | |
michael@0 | 7056 | tmp_deplibs= |
michael@0 | 7057 | for test_deplib in $deplibs; do |
michael@0 | 7058 | case " $convenience " in |
michael@0 | 7059 | *" $test_deplib "*) ;; |
michael@0 | 7060 | *) |
michael@0 | 7061 | tmp_deplibs="$tmp_deplibs $test_deplib" |
michael@0 | 7062 | ;; |
michael@0 | 7063 | esac |
michael@0 | 7064 | done |
michael@0 | 7065 | deplibs="$tmp_deplibs" |
michael@0 | 7066 | |
michael@0 | 7067 | if test -n "$convenience"; then |
michael@0 | 7068 | if test -n "$whole_archive_flag_spec" && |
michael@0 | 7069 | test "$compiler_needs_object" = yes && |
michael@0 | 7070 | test -z "$libobjs"; then |
michael@0 | 7071 | # extract the archives, so we have objects to list. |
michael@0 | 7072 | # TODO: could optimize this to just extract one archive. |
michael@0 | 7073 | whole_archive_flag_spec= |
michael@0 | 7074 | fi |
michael@0 | 7075 | if test -n "$whole_archive_flag_spec"; then |
michael@0 | 7076 | save_libobjs=$libobjs |
michael@0 | 7077 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
michael@0 | 7078 | test "X$libobjs" = "X " && libobjs= |
michael@0 | 7079 | else |
michael@0 | 7080 | gentop="$output_objdir/${outputname}x" |
michael@0 | 7081 | generated="$generated $gentop" |
michael@0 | 7082 | |
michael@0 | 7083 | func_extract_archives $gentop $convenience |
michael@0 | 7084 | libobjs="$libobjs $func_extract_archives_result" |
michael@0 | 7085 | test "X$libobjs" = "X " && libobjs= |
michael@0 | 7086 | fi |
michael@0 | 7087 | fi |
michael@0 | 7088 | |
michael@0 | 7089 | if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then |
michael@0 | 7090 | eval flag=\"$thread_safe_flag_spec\" |
michael@0 | 7091 | linker_flags="$linker_flags $flag" |
michael@0 | 7092 | fi |
michael@0 | 7093 | |
michael@0 | 7094 | # Make a backup of the uninstalled library when relinking |
michael@0 | 7095 | if test "$mode" = relink; then |
michael@0 | 7096 | $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? |
michael@0 | 7097 | fi |
michael@0 | 7098 | |
michael@0 | 7099 | # Do each of the archive commands. |
michael@0 | 7100 | if test "$module" = yes && test -n "$module_cmds" ; then |
michael@0 | 7101 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
michael@0 | 7102 | eval test_cmds=\"$module_expsym_cmds\" |
michael@0 | 7103 | cmds=$module_expsym_cmds |
michael@0 | 7104 | else |
michael@0 | 7105 | eval test_cmds=\"$module_cmds\" |
michael@0 | 7106 | cmds=$module_cmds |
michael@0 | 7107 | fi |
michael@0 | 7108 | else |
michael@0 | 7109 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
michael@0 | 7110 | eval test_cmds=\"$archive_expsym_cmds\" |
michael@0 | 7111 | cmds=$archive_expsym_cmds |
michael@0 | 7112 | else |
michael@0 | 7113 | eval test_cmds=\"$archive_cmds\" |
michael@0 | 7114 | cmds=$archive_cmds |
michael@0 | 7115 | fi |
michael@0 | 7116 | fi |
michael@0 | 7117 | |
michael@0 | 7118 | if test "X$skipped_export" != "X:" && |
michael@0 | 7119 | func_len " $test_cmds" && |
michael@0 | 7120 | len=$func_len_result && |
michael@0 | 7121 | test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
michael@0 | 7122 | : |
michael@0 | 7123 | else |
michael@0 | 7124 | # The command line is too long to link in one step, link piecewise |
michael@0 | 7125 | # or, if using GNU ld and skipped_export is not :, use a linker |
michael@0 | 7126 | # script. |
michael@0 | 7127 | |
michael@0 | 7128 | # Save the value of $output and $libobjs because we want to |
michael@0 | 7129 | # use them later. If we have whole_archive_flag_spec, we |
michael@0 | 7130 | # want to use save_libobjs as it was before |
michael@0 | 7131 | # whole_archive_flag_spec was expanded, because we can't |
michael@0 | 7132 | # assume the linker understands whole_archive_flag_spec. |
michael@0 | 7133 | # This may have to be revisited, in case too many |
michael@0 | 7134 | # convenience libraries get linked in and end up exceeding |
michael@0 | 7135 | # the spec. |
michael@0 | 7136 | if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then |
michael@0 | 7137 | save_libobjs=$libobjs |
michael@0 | 7138 | fi |
michael@0 | 7139 | save_output=$output |
michael@0 | 7140 | output_la=`$ECHO "X$output" | $Xsed -e "$basename"` |
michael@0 | 7141 | |
michael@0 | 7142 | # Clear the reloadable object creation command queue and |
michael@0 | 7143 | # initialize k to one. |
michael@0 | 7144 | test_cmds= |
michael@0 | 7145 | concat_cmds= |
michael@0 | 7146 | objlist= |
michael@0 | 7147 | last_robj= |
michael@0 | 7148 | k=1 |
michael@0 | 7149 | |
michael@0 | 7150 | if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then |
michael@0 | 7151 | output=${output_objdir}/${output_la}.lnkscript |
michael@0 | 7152 | func_verbose "creating GNU ld script: $output" |
michael@0 | 7153 | $ECHO 'INPUT (' > $output |
michael@0 | 7154 | for obj in $save_libobjs |
michael@0 | 7155 | do |
michael@0 | 7156 | $ECHO "$obj" >> $output |
michael@0 | 7157 | done |
michael@0 | 7158 | $ECHO ')' >> $output |
michael@0 | 7159 | delfiles="$delfiles $output" |
michael@0 | 7160 | elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then |
michael@0 | 7161 | output=${output_objdir}/${output_la}.lnk |
michael@0 | 7162 | func_verbose "creating linker input file list: $output" |
michael@0 | 7163 | : > $output |
michael@0 | 7164 | set x $save_libobjs |
michael@0 | 7165 | shift |
michael@0 | 7166 | firstobj= |
michael@0 | 7167 | if test "$compiler_needs_object" = yes; then |
michael@0 | 7168 | firstobj="$1 " |
michael@0 | 7169 | shift |
michael@0 | 7170 | fi |
michael@0 | 7171 | for obj |
michael@0 | 7172 | do |
michael@0 | 7173 | $ECHO "$obj" >> $output |
michael@0 | 7174 | done |
michael@0 | 7175 | delfiles="$delfiles $output" |
michael@0 | 7176 | output=$firstobj\"$file_list_spec$output\" |
michael@0 | 7177 | else |
michael@0 | 7178 | if test -n "$save_libobjs"; then |
michael@0 | 7179 | func_verbose "creating reloadable object files..." |
michael@0 | 7180 | output=$output_objdir/$output_la-${k}.$objext |
michael@0 | 7181 | eval test_cmds=\"$reload_cmds\" |
michael@0 | 7182 | func_len " $test_cmds" |
michael@0 | 7183 | len0=$func_len_result |
michael@0 | 7184 | len=$len0 |
michael@0 | 7185 | |
michael@0 | 7186 | # Loop over the list of objects to be linked. |
michael@0 | 7187 | for obj in $save_libobjs |
michael@0 | 7188 | do |
michael@0 | 7189 | func_len " $obj" |
michael@0 | 7190 | func_arith $len + $func_len_result |
michael@0 | 7191 | len=$func_arith_result |
michael@0 | 7192 | if test "X$objlist" = X || |
michael@0 | 7193 | test "$len" -lt "$max_cmd_len"; then |
michael@0 | 7194 | func_append objlist " $obj" |
michael@0 | 7195 | else |
michael@0 | 7196 | # The command $test_cmds is almost too long, add a |
michael@0 | 7197 | # command to the queue. |
michael@0 | 7198 | if test "$k" -eq 1 ; then |
michael@0 | 7199 | # The first file doesn't have a previous command to add. |
michael@0 | 7200 | eval concat_cmds=\"$reload_cmds $objlist $last_robj\" |
michael@0 | 7201 | else |
michael@0 | 7202 | # All subsequent reloadable object files will link in |
michael@0 | 7203 | # the last one created. |
michael@0 | 7204 | eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" |
michael@0 | 7205 | fi |
michael@0 | 7206 | last_robj=$output_objdir/$output_la-${k}.$objext |
michael@0 | 7207 | func_arith $k + 1 |
michael@0 | 7208 | k=$func_arith_result |
michael@0 | 7209 | output=$output_objdir/$output_la-${k}.$objext |
michael@0 | 7210 | objlist=$obj |
michael@0 | 7211 | func_len " $last_robj" |
michael@0 | 7212 | func_arith $len0 + $func_len_result |
michael@0 | 7213 | len=$func_arith_result |
michael@0 | 7214 | fi |
michael@0 | 7215 | done |
michael@0 | 7216 | # Handle the remaining objects by creating one last |
michael@0 | 7217 | # reloadable object file. All subsequent reloadable object |
michael@0 | 7218 | # files will link in the last one created. |
michael@0 | 7219 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
michael@0 | 7220 | eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" |
michael@0 | 7221 | if test -n "$last_robj"; then |
michael@0 | 7222 | eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" |
michael@0 | 7223 | fi |
michael@0 | 7224 | delfiles="$delfiles $output" |
michael@0 | 7225 | |
michael@0 | 7226 | else |
michael@0 | 7227 | output= |
michael@0 | 7228 | fi |
michael@0 | 7229 | |
michael@0 | 7230 | if ${skipped_export-false}; then |
michael@0 | 7231 | func_verbose "generating symbol list for \`$libname.la'" |
michael@0 | 7232 | export_symbols="$output_objdir/$libname.exp" |
michael@0 | 7233 | $opt_dry_run || $RM $export_symbols |
michael@0 | 7234 | libobjs=$output |
michael@0 | 7235 | # Append the command to create the export file. |
michael@0 | 7236 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
michael@0 | 7237 | eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" |
michael@0 | 7238 | if test -n "$last_robj"; then |
michael@0 | 7239 | eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" |
michael@0 | 7240 | fi |
michael@0 | 7241 | fi |
michael@0 | 7242 | |
michael@0 | 7243 | test -n "$save_libobjs" && |
michael@0 | 7244 | func_verbose "creating a temporary reloadable object file: $output" |
michael@0 | 7245 | |
michael@0 | 7246 | # Loop through the commands generated above and execute them. |
michael@0 | 7247 | save_ifs="$IFS"; IFS='~' |
michael@0 | 7248 | for cmd in $concat_cmds; do |
michael@0 | 7249 | IFS="$save_ifs" |
michael@0 | 7250 | $opt_silent || { |
michael@0 | 7251 | func_quote_for_expand "$cmd" |
michael@0 | 7252 | eval "func_echo $func_quote_for_expand_result" |
michael@0 | 7253 | } |
michael@0 | 7254 | $opt_dry_run || eval "$cmd" || { |
michael@0 | 7255 | lt_exit=$? |
michael@0 | 7256 | |
michael@0 | 7257 | # Restore the uninstalled library and exit |
michael@0 | 7258 | if test "$mode" = relink; then |
michael@0 | 7259 | ( cd "$output_objdir" && \ |
michael@0 | 7260 | $RM "${realname}T" && \ |
michael@0 | 7261 | $MV "${realname}U" "$realname" ) |
michael@0 | 7262 | fi |
michael@0 | 7263 | |
michael@0 | 7264 | exit $lt_exit |
michael@0 | 7265 | } |
michael@0 | 7266 | done |
michael@0 | 7267 | IFS="$save_ifs" |
michael@0 | 7268 | |
michael@0 | 7269 | if test -n "$export_symbols_regex" && ${skipped_export-false}; then |
michael@0 | 7270 | func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' |
michael@0 | 7271 | func_show_eval '$MV "${export_symbols}T" "$export_symbols"' |
michael@0 | 7272 | fi |
michael@0 | 7273 | fi |
michael@0 | 7274 | |
michael@0 | 7275 | if ${skipped_export-false}; then |
michael@0 | 7276 | if test -n "$export_symbols" && test -n "$include_expsyms"; then |
michael@0 | 7277 | tmp_export_symbols="$export_symbols" |
michael@0 | 7278 | test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" |
michael@0 | 7279 | $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' |
michael@0 | 7280 | fi |
michael@0 | 7281 | |
michael@0 | 7282 | if test -n "$orig_export_symbols"; then |
michael@0 | 7283 | # The given exports_symbols file has to be filtered, so filter it. |
michael@0 | 7284 | func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" |
michael@0 | 7285 | # FIXME: $output_objdir/$libname.filter potentially contains lots of |
michael@0 | 7286 | # 's' commands which not all seds can handle. GNU sed should be fine |
michael@0 | 7287 | # though. Also, the filter scales superlinearly with the number of |
michael@0 | 7288 | # global variables. join(1) would be nice here, but unfortunately |
michael@0 | 7289 | # isn't a blessed tool. |
michael@0 | 7290 | $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter |
michael@0 | 7291 | delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" |
michael@0 | 7292 | export_symbols=$output_objdir/$libname.def |
michael@0 | 7293 | $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols |
michael@0 | 7294 | fi |
michael@0 | 7295 | fi |
michael@0 | 7296 | |
michael@0 | 7297 | libobjs=$output |
michael@0 | 7298 | # Restore the value of output. |
michael@0 | 7299 | output=$save_output |
michael@0 | 7300 | |
michael@0 | 7301 | if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then |
michael@0 | 7302 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
michael@0 | 7303 | test "X$libobjs" = "X " && libobjs= |
michael@0 | 7304 | fi |
michael@0 | 7305 | # Expand the library linking commands again to reset the |
michael@0 | 7306 | # value of $libobjs for piecewise linking. |
michael@0 | 7307 | |
michael@0 | 7308 | # Do each of the archive commands. |
michael@0 | 7309 | if test "$module" = yes && test -n "$module_cmds" ; then |
michael@0 | 7310 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then |
michael@0 | 7311 | cmds=$module_expsym_cmds |
michael@0 | 7312 | else |
michael@0 | 7313 | cmds=$module_cmds |
michael@0 | 7314 | fi |
michael@0 | 7315 | else |
michael@0 | 7316 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
michael@0 | 7317 | cmds=$archive_expsym_cmds |
michael@0 | 7318 | else |
michael@0 | 7319 | cmds=$archive_cmds |
michael@0 | 7320 | fi |
michael@0 | 7321 | fi |
michael@0 | 7322 | fi |
michael@0 | 7323 | |
michael@0 | 7324 | if test -n "$delfiles"; then |
michael@0 | 7325 | # Append the command to remove temporary files to $cmds. |
michael@0 | 7326 | eval cmds=\"\$cmds~\$RM $delfiles\" |
michael@0 | 7327 | fi |
michael@0 | 7328 | |
michael@0 | 7329 | # Add any objects from preloaded convenience libraries |
michael@0 | 7330 | if test -n "$dlprefiles"; then |
michael@0 | 7331 | gentop="$output_objdir/${outputname}x" |
michael@0 | 7332 | generated="$generated $gentop" |
michael@0 | 7333 | |
michael@0 | 7334 | func_extract_archives $gentop $dlprefiles |
michael@0 | 7335 | libobjs="$libobjs $func_extract_archives_result" |
michael@0 | 7336 | test "X$libobjs" = "X " && libobjs= |
michael@0 | 7337 | fi |
michael@0 | 7338 | |
michael@0 | 7339 | save_ifs="$IFS"; IFS='~' |
michael@0 | 7340 | for cmd in $cmds; do |
michael@0 | 7341 | IFS="$save_ifs" |
michael@0 | 7342 | eval cmd=\"$cmd\" |
michael@0 | 7343 | $opt_silent || { |
michael@0 | 7344 | func_quote_for_expand "$cmd" |
michael@0 | 7345 | eval "func_echo $func_quote_for_expand_result" |
michael@0 | 7346 | } |
michael@0 | 7347 | $opt_dry_run || eval "$cmd" || { |
michael@0 | 7348 | lt_exit=$? |
michael@0 | 7349 | |
michael@0 | 7350 | # Restore the uninstalled library and exit |
michael@0 | 7351 | if test "$mode" = relink; then |
michael@0 | 7352 | ( cd "$output_objdir" && \ |
michael@0 | 7353 | $RM "${realname}T" && \ |
michael@0 | 7354 | $MV "${realname}U" "$realname" ) |
michael@0 | 7355 | fi |
michael@0 | 7356 | |
michael@0 | 7357 | exit $lt_exit |
michael@0 | 7358 | } |
michael@0 | 7359 | done |
michael@0 | 7360 | IFS="$save_ifs" |
michael@0 | 7361 | |
michael@0 | 7362 | # Restore the uninstalled library and exit |
michael@0 | 7363 | if test "$mode" = relink; then |
michael@0 | 7364 | $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? |
michael@0 | 7365 | |
michael@0 | 7366 | if test -n "$convenience"; then |
michael@0 | 7367 | if test -z "$whole_archive_flag_spec"; then |
michael@0 | 7368 | func_show_eval '${RM}r "$gentop"' |
michael@0 | 7369 | fi |
michael@0 | 7370 | fi |
michael@0 | 7371 | |
michael@0 | 7372 | exit $EXIT_SUCCESS |
michael@0 | 7373 | fi |
michael@0 | 7374 | |
michael@0 | 7375 | # Create links to the real library. |
michael@0 | 7376 | for linkname in $linknames; do |
michael@0 | 7377 | if test "$realname" != "$linkname"; then |
michael@0 | 7378 | func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' |
michael@0 | 7379 | fi |
michael@0 | 7380 | done |
michael@0 | 7381 | |
michael@0 | 7382 | # If -module or -export-dynamic was specified, set the dlname. |
michael@0 | 7383 | if test "$module" = yes || test "$export_dynamic" = yes; then |
michael@0 | 7384 | # On all known operating systems, these are identical. |
michael@0 | 7385 | dlname="$soname" |
michael@0 | 7386 | fi |
michael@0 | 7387 | fi |
michael@0 | 7388 | ;; |
michael@0 | 7389 | |
michael@0 | 7390 | obj) |
michael@0 | 7391 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
michael@0 | 7392 | func_warning "\`-dlopen' is ignored for objects" |
michael@0 | 7393 | fi |
michael@0 | 7394 | |
michael@0 | 7395 | case " $deplibs" in |
michael@0 | 7396 | *\ -l* | *\ -L*) |
michael@0 | 7397 | func_warning "\`-l' and \`-L' are ignored for objects" ;; |
michael@0 | 7398 | esac |
michael@0 | 7399 | |
michael@0 | 7400 | test -n "$rpath" && \ |
michael@0 | 7401 | func_warning "\`-rpath' is ignored for objects" |
michael@0 | 7402 | |
michael@0 | 7403 | test -n "$xrpath" && \ |
michael@0 | 7404 | func_warning "\`-R' is ignored for objects" |
michael@0 | 7405 | |
michael@0 | 7406 | test -n "$vinfo" && \ |
michael@0 | 7407 | func_warning "\`-version-info' is ignored for objects" |
michael@0 | 7408 | |
michael@0 | 7409 | test -n "$release" && \ |
michael@0 | 7410 | func_warning "\`-release' is ignored for objects" |
michael@0 | 7411 | |
michael@0 | 7412 | case $output in |
michael@0 | 7413 | *.lo) |
michael@0 | 7414 | test -n "$objs$old_deplibs" && \ |
michael@0 | 7415 | func_fatal_error "cannot build library object \`$output' from non-libtool objects" |
michael@0 | 7416 | |
michael@0 | 7417 | libobj=$output |
michael@0 | 7418 | func_lo2o "$libobj" |
michael@0 | 7419 | obj=$func_lo2o_result |
michael@0 | 7420 | ;; |
michael@0 | 7421 | *) |
michael@0 | 7422 | libobj= |
michael@0 | 7423 | obj="$output" |
michael@0 | 7424 | ;; |
michael@0 | 7425 | esac |
michael@0 | 7426 | |
michael@0 | 7427 | # Delete the old objects. |
michael@0 | 7428 | $opt_dry_run || $RM $obj $libobj |
michael@0 | 7429 | |
michael@0 | 7430 | # Objects from convenience libraries. This assumes |
michael@0 | 7431 | # single-version convenience libraries. Whenever we create |
michael@0 | 7432 | # different ones for PIC/non-PIC, this we'll have to duplicate |
michael@0 | 7433 | # the extraction. |
michael@0 | 7434 | reload_conv_objs= |
michael@0 | 7435 | gentop= |
michael@0 | 7436 | # reload_cmds runs $LD directly, so let us get rid of |
michael@0 | 7437 | # -Wl from whole_archive_flag_spec and hope we can get by with |
michael@0 | 7438 | # turning comma into space.. |
michael@0 | 7439 | wl= |
michael@0 | 7440 | |
michael@0 | 7441 | if test -n "$convenience"; then |
michael@0 | 7442 | if test -n "$whole_archive_flag_spec"; then |
michael@0 | 7443 | eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" |
michael@0 | 7444 | reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` |
michael@0 | 7445 | else |
michael@0 | 7446 | gentop="$output_objdir/${obj}x" |
michael@0 | 7447 | generated="$generated $gentop" |
michael@0 | 7448 | |
michael@0 | 7449 | func_extract_archives $gentop $convenience |
michael@0 | 7450 | reload_conv_objs="$reload_objs $func_extract_archives_result" |
michael@0 | 7451 | fi |
michael@0 | 7452 | fi |
michael@0 | 7453 | |
michael@0 | 7454 | # Create the old-style object. |
michael@0 | 7455 | reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test |
michael@0 | 7456 | |
michael@0 | 7457 | output="$obj" |
michael@0 | 7458 | func_execute_cmds "$reload_cmds" 'exit $?' |
michael@0 | 7459 | |
michael@0 | 7460 | # Exit if we aren't doing a library object file. |
michael@0 | 7461 | if test -z "$libobj"; then |
michael@0 | 7462 | if test -n "$gentop"; then |
michael@0 | 7463 | func_show_eval '${RM}r "$gentop"' |
michael@0 | 7464 | fi |
michael@0 | 7465 | |
michael@0 | 7466 | exit $EXIT_SUCCESS |
michael@0 | 7467 | fi |
michael@0 | 7468 | |
michael@0 | 7469 | if test "$build_libtool_libs" != yes; then |
michael@0 | 7470 | if test -n "$gentop"; then |
michael@0 | 7471 | func_show_eval '${RM}r "$gentop"' |
michael@0 | 7472 | fi |
michael@0 | 7473 | |
michael@0 | 7474 | # Create an invalid libtool object if no PIC, so that we don't |
michael@0 | 7475 | # accidentally link it into a program. |
michael@0 | 7476 | # $show "echo timestamp > $libobj" |
michael@0 | 7477 | # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? |
michael@0 | 7478 | exit $EXIT_SUCCESS |
michael@0 | 7479 | fi |
michael@0 | 7480 | |
michael@0 | 7481 | if test -n "$pic_flag" || test "$pic_mode" != default; then |
michael@0 | 7482 | # Only do commands if we really have different PIC objects. |
michael@0 | 7483 | reload_objs="$libobjs $reload_conv_objs" |
michael@0 | 7484 | output="$libobj" |
michael@0 | 7485 | func_execute_cmds "$reload_cmds" 'exit $?' |
michael@0 | 7486 | fi |
michael@0 | 7487 | |
michael@0 | 7488 | if test -n "$gentop"; then |
michael@0 | 7489 | func_show_eval '${RM}r "$gentop"' |
michael@0 | 7490 | fi |
michael@0 | 7491 | |
michael@0 | 7492 | exit $EXIT_SUCCESS |
michael@0 | 7493 | ;; |
michael@0 | 7494 | |
michael@0 | 7495 | prog) |
michael@0 | 7496 | case $host in |
michael@0 | 7497 | *cygwin*) func_stripname '' '.exe' "$output" |
michael@0 | 7498 | output=$func_stripname_result.exe;; |
michael@0 | 7499 | esac |
michael@0 | 7500 | test -n "$vinfo" && \ |
michael@0 | 7501 | func_warning "\`-version-info' is ignored for programs" |
michael@0 | 7502 | |
michael@0 | 7503 | test -n "$release" && \ |
michael@0 | 7504 | func_warning "\`-release' is ignored for programs" |
michael@0 | 7505 | |
michael@0 | 7506 | test "$preload" = yes \ |
michael@0 | 7507 | && test "$dlopen_support" = unknown \ |
michael@0 | 7508 | && test "$dlopen_self" = unknown \ |
michael@0 | 7509 | && test "$dlopen_self_static" = unknown && \ |
michael@0 | 7510 | func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." |
michael@0 | 7511 | |
michael@0 | 7512 | case $host in |
michael@0 | 7513 | *-*-rhapsody* | *-*-darwin1.[012]) |
michael@0 | 7514 | # On Rhapsody replace the C library is the System framework |
michael@0 | 7515 | compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` |
michael@0 | 7516 | finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` |
michael@0 | 7517 | ;; |
michael@0 | 7518 | esac |
michael@0 | 7519 | |
michael@0 | 7520 | case $host in |
michael@0 | 7521 | *-*-darwin*) |
michael@0 | 7522 | # Don't allow lazy linking, it breaks C++ global constructors |
michael@0 | 7523 | # But is supposedly fixed on 10.4 or later (yay!). |
michael@0 | 7524 | if test "$tagname" = CXX ; then |
michael@0 | 7525 | case ${MACOSX_DEPLOYMENT_TARGET-10.0} in |
michael@0 | 7526 | 10.[0123]) |
michael@0 | 7527 | compile_command="$compile_command ${wl}-bind_at_load" |
michael@0 | 7528 | finalize_command="$finalize_command ${wl}-bind_at_load" |
michael@0 | 7529 | ;; |
michael@0 | 7530 | esac |
michael@0 | 7531 | fi |
michael@0 | 7532 | # Time to change all our "foo.ltframework" stuff back to "-framework foo" |
michael@0 | 7533 | compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` |
michael@0 | 7534 | finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` |
michael@0 | 7535 | ;; |
michael@0 | 7536 | esac |
michael@0 | 7537 | |
michael@0 | 7538 | |
michael@0 | 7539 | # move library search paths that coincide with paths to not yet |
michael@0 | 7540 | # installed libraries to the beginning of the library search list |
michael@0 | 7541 | new_libs= |
michael@0 | 7542 | for path in $notinst_path; do |
michael@0 | 7543 | case " $new_libs " in |
michael@0 | 7544 | *" -L$path/$objdir "*) ;; |
michael@0 | 7545 | *) |
michael@0 | 7546 | case " $compile_deplibs " in |
michael@0 | 7547 | *" -L$path/$objdir "*) |
michael@0 | 7548 | new_libs="$new_libs -L$path/$objdir" ;; |
michael@0 | 7549 | esac |
michael@0 | 7550 | ;; |
michael@0 | 7551 | esac |
michael@0 | 7552 | done |
michael@0 | 7553 | for deplib in $compile_deplibs; do |
michael@0 | 7554 | case $deplib in |
michael@0 | 7555 | -L*) |
michael@0 | 7556 | case " $new_libs " in |
michael@0 | 7557 | *" $deplib "*) ;; |
michael@0 | 7558 | *) new_libs="$new_libs $deplib" ;; |
michael@0 | 7559 | esac |
michael@0 | 7560 | ;; |
michael@0 | 7561 | *) new_libs="$new_libs $deplib" ;; |
michael@0 | 7562 | esac |
michael@0 | 7563 | done |
michael@0 | 7564 | compile_deplibs="$new_libs" |
michael@0 | 7565 | |
michael@0 | 7566 | |
michael@0 | 7567 | compile_command="$compile_command $compile_deplibs" |
michael@0 | 7568 | finalize_command="$finalize_command $finalize_deplibs" |
michael@0 | 7569 | |
michael@0 | 7570 | if test -n "$rpath$xrpath"; then |
michael@0 | 7571 | # If the user specified any rpath flags, then add them. |
michael@0 | 7572 | for libdir in $rpath $xrpath; do |
michael@0 | 7573 | # This is the magic to use -rpath. |
michael@0 | 7574 | case "$finalize_rpath " in |
michael@0 | 7575 | *" $libdir "*) ;; |
michael@0 | 7576 | *) finalize_rpath="$finalize_rpath $libdir" ;; |
michael@0 | 7577 | esac |
michael@0 | 7578 | done |
michael@0 | 7579 | fi |
michael@0 | 7580 | |
michael@0 | 7581 | # Now hardcode the library paths |
michael@0 | 7582 | rpath= |
michael@0 | 7583 | hardcode_libdirs= |
michael@0 | 7584 | for libdir in $compile_rpath $finalize_rpath; do |
michael@0 | 7585 | if test -n "$hardcode_libdir_flag_spec"; then |
michael@0 | 7586 | if test -n "$hardcode_libdir_separator"; then |
michael@0 | 7587 | if test -z "$hardcode_libdirs"; then |
michael@0 | 7588 | hardcode_libdirs="$libdir" |
michael@0 | 7589 | else |
michael@0 | 7590 | # Just accumulate the unique libdirs. |
michael@0 | 7591 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
michael@0 | 7592 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
michael@0 | 7593 | ;; |
michael@0 | 7594 | *) |
michael@0 | 7595 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
michael@0 | 7596 | ;; |
michael@0 | 7597 | esac |
michael@0 | 7598 | fi |
michael@0 | 7599 | else |
michael@0 | 7600 | eval flag=\"$hardcode_libdir_flag_spec\" |
michael@0 | 7601 | rpath="$rpath $flag" |
michael@0 | 7602 | fi |
michael@0 | 7603 | elif test -n "$runpath_var"; then |
michael@0 | 7604 | case "$perm_rpath " in |
michael@0 | 7605 | *" $libdir "*) ;; |
michael@0 | 7606 | *) perm_rpath="$perm_rpath $libdir" ;; |
michael@0 | 7607 | esac |
michael@0 | 7608 | fi |
michael@0 | 7609 | case $host in |
michael@0 | 7610 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) |
michael@0 | 7611 | testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` |
michael@0 | 7612 | case :$dllsearchpath: in |
michael@0 | 7613 | *":$libdir:"*) ;; |
michael@0 | 7614 | ::) dllsearchpath=$libdir;; |
michael@0 | 7615 | *) dllsearchpath="$dllsearchpath:$libdir";; |
michael@0 | 7616 | esac |
michael@0 | 7617 | case :$dllsearchpath: in |
michael@0 | 7618 | *":$testbindir:"*) ;; |
michael@0 | 7619 | ::) dllsearchpath=$testbindir;; |
michael@0 | 7620 | *) dllsearchpath="$dllsearchpath:$testbindir";; |
michael@0 | 7621 | esac |
michael@0 | 7622 | ;; |
michael@0 | 7623 | esac |
michael@0 | 7624 | done |
michael@0 | 7625 | # Substitute the hardcoded libdirs into the rpath. |
michael@0 | 7626 | if test -n "$hardcode_libdir_separator" && |
michael@0 | 7627 | test -n "$hardcode_libdirs"; then |
michael@0 | 7628 | libdir="$hardcode_libdirs" |
michael@0 | 7629 | eval rpath=\" $hardcode_libdir_flag_spec\" |
michael@0 | 7630 | fi |
michael@0 | 7631 | compile_rpath="$rpath" |
michael@0 | 7632 | |
michael@0 | 7633 | rpath= |
michael@0 | 7634 | hardcode_libdirs= |
michael@0 | 7635 | for libdir in $finalize_rpath; do |
michael@0 | 7636 | if test -n "$hardcode_libdir_flag_spec"; then |
michael@0 | 7637 | if test -n "$hardcode_libdir_separator"; then |
michael@0 | 7638 | if test -z "$hardcode_libdirs"; then |
michael@0 | 7639 | hardcode_libdirs="$libdir" |
michael@0 | 7640 | else |
michael@0 | 7641 | # Just accumulate the unique libdirs. |
michael@0 | 7642 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in |
michael@0 | 7643 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) |
michael@0 | 7644 | ;; |
michael@0 | 7645 | *) |
michael@0 | 7646 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" |
michael@0 | 7647 | ;; |
michael@0 | 7648 | esac |
michael@0 | 7649 | fi |
michael@0 | 7650 | else |
michael@0 | 7651 | eval flag=\"$hardcode_libdir_flag_spec\" |
michael@0 | 7652 | rpath="$rpath $flag" |
michael@0 | 7653 | fi |
michael@0 | 7654 | elif test -n "$runpath_var"; then |
michael@0 | 7655 | case "$finalize_perm_rpath " in |
michael@0 | 7656 | *" $libdir "*) ;; |
michael@0 | 7657 | *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; |
michael@0 | 7658 | esac |
michael@0 | 7659 | fi |
michael@0 | 7660 | done |
michael@0 | 7661 | # Substitute the hardcoded libdirs into the rpath. |
michael@0 | 7662 | if test -n "$hardcode_libdir_separator" && |
michael@0 | 7663 | test -n "$hardcode_libdirs"; then |
michael@0 | 7664 | libdir="$hardcode_libdirs" |
michael@0 | 7665 | eval rpath=\" $hardcode_libdir_flag_spec\" |
michael@0 | 7666 | fi |
michael@0 | 7667 | finalize_rpath="$rpath" |
michael@0 | 7668 | |
michael@0 | 7669 | if test -n "$libobjs" && test "$build_old_libs" = yes; then |
michael@0 | 7670 | # Transform all the library objects into standard objects. |
michael@0 | 7671 | compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
michael@0 | 7672 | finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
michael@0 | 7673 | fi |
michael@0 | 7674 | |
michael@0 | 7675 | func_generate_dlsyms "$outputname" "@PROGRAM@" "no" |
michael@0 | 7676 | |
michael@0 | 7677 | # template prelinking step |
michael@0 | 7678 | if test -n "$prelink_cmds"; then |
michael@0 | 7679 | func_execute_cmds "$prelink_cmds" 'exit $?' |
michael@0 | 7680 | fi |
michael@0 | 7681 | |
michael@0 | 7682 | wrappers_required=yes |
michael@0 | 7683 | case $host in |
michael@0 | 7684 | *cygwin* | *mingw* ) |
michael@0 | 7685 | if test "$build_libtool_libs" != yes; then |
michael@0 | 7686 | wrappers_required=no |
michael@0 | 7687 | fi |
michael@0 | 7688 | ;; |
michael@0 | 7689 | *cegcc) |
michael@0 | 7690 | # Disable wrappers for cegcc, we are cross compiling anyway. |
michael@0 | 7691 | wrappers_required=no |
michael@0 | 7692 | ;; |
michael@0 | 7693 | *) |
michael@0 | 7694 | if test "$need_relink" = no || test "$build_libtool_libs" != yes; then |
michael@0 | 7695 | wrappers_required=no |
michael@0 | 7696 | fi |
michael@0 | 7697 | ;; |
michael@0 | 7698 | esac |
michael@0 | 7699 | if test "$wrappers_required" = no; then |
michael@0 | 7700 | # Replace the output file specification. |
michael@0 | 7701 | compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` |
michael@0 | 7702 | link_command="$compile_command$compile_rpath" |
michael@0 | 7703 | |
michael@0 | 7704 | # We have no uninstalled library dependencies, so finalize right now. |
michael@0 | 7705 | exit_status=0 |
michael@0 | 7706 | func_show_eval "$link_command" 'exit_status=$?' |
michael@0 | 7707 | |
michael@0 | 7708 | # Delete the generated files. |
michael@0 | 7709 | if test -f "$output_objdir/${outputname}S.${objext}"; then |
michael@0 | 7710 | func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' |
michael@0 | 7711 | fi |
michael@0 | 7712 | |
michael@0 | 7713 | exit $exit_status |
michael@0 | 7714 | fi |
michael@0 | 7715 | |
michael@0 | 7716 | if test -n "$compile_shlibpath$finalize_shlibpath"; then |
michael@0 | 7717 | compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" |
michael@0 | 7718 | fi |
michael@0 | 7719 | if test -n "$finalize_shlibpath"; then |
michael@0 | 7720 | finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" |
michael@0 | 7721 | fi |
michael@0 | 7722 | |
michael@0 | 7723 | compile_var= |
michael@0 | 7724 | finalize_var= |
michael@0 | 7725 | if test -n "$runpath_var"; then |
michael@0 | 7726 | if test -n "$perm_rpath"; then |
michael@0 | 7727 | # We should set the runpath_var. |
michael@0 | 7728 | rpath= |
michael@0 | 7729 | for dir in $perm_rpath; do |
michael@0 | 7730 | rpath="$rpath$dir:" |
michael@0 | 7731 | done |
michael@0 | 7732 | compile_var="$runpath_var=\"$rpath\$$runpath_var\" " |
michael@0 | 7733 | fi |
michael@0 | 7734 | if test -n "$finalize_perm_rpath"; then |
michael@0 | 7735 | # We should set the runpath_var. |
michael@0 | 7736 | rpath= |
michael@0 | 7737 | for dir in $finalize_perm_rpath; do |
michael@0 | 7738 | rpath="$rpath$dir:" |
michael@0 | 7739 | done |
michael@0 | 7740 | finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " |
michael@0 | 7741 | fi |
michael@0 | 7742 | fi |
michael@0 | 7743 | |
michael@0 | 7744 | if test "$no_install" = yes; then |
michael@0 | 7745 | # We don't need to create a wrapper script. |
michael@0 | 7746 | link_command="$compile_var$compile_command$compile_rpath" |
michael@0 | 7747 | # Replace the output file specification. |
michael@0 | 7748 | link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` |
michael@0 | 7749 | # Delete the old output file. |
michael@0 | 7750 | $opt_dry_run || $RM $output |
michael@0 | 7751 | # Link the executable and exit |
michael@0 | 7752 | func_show_eval "$link_command" 'exit $?' |
michael@0 | 7753 | exit $EXIT_SUCCESS |
michael@0 | 7754 | fi |
michael@0 | 7755 | |
michael@0 | 7756 | if test "$hardcode_action" = relink; then |
michael@0 | 7757 | # Fast installation is not supported |
michael@0 | 7758 | link_command="$compile_var$compile_command$compile_rpath" |
michael@0 | 7759 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
michael@0 | 7760 | |
michael@0 | 7761 | func_warning "this platform does not like uninstalled shared libraries" |
michael@0 | 7762 | func_warning "\`$output' will be relinked during installation" |
michael@0 | 7763 | else |
michael@0 | 7764 | if test "$fast_install" != no; then |
michael@0 | 7765 | link_command="$finalize_var$compile_command$finalize_rpath" |
michael@0 | 7766 | if test "$fast_install" = yes; then |
michael@0 | 7767 | relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` |
michael@0 | 7768 | else |
michael@0 | 7769 | # fast_install is set to needless |
michael@0 | 7770 | relink_command= |
michael@0 | 7771 | fi |
michael@0 | 7772 | else |
michael@0 | 7773 | link_command="$compile_var$compile_command$compile_rpath" |
michael@0 | 7774 | relink_command="$finalize_var$finalize_command$finalize_rpath" |
michael@0 | 7775 | fi |
michael@0 | 7776 | fi |
michael@0 | 7777 | |
michael@0 | 7778 | # Replace the output file specification. |
michael@0 | 7779 | link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` |
michael@0 | 7780 | |
michael@0 | 7781 | # Delete the old output files. |
michael@0 | 7782 | $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname |
michael@0 | 7783 | |
michael@0 | 7784 | func_show_eval "$link_command" 'exit $?' |
michael@0 | 7785 | |
michael@0 | 7786 | # Now create the wrapper script. |
michael@0 | 7787 | func_verbose "creating $output" |
michael@0 | 7788 | |
michael@0 | 7789 | # Quote the relink command for shipping. |
michael@0 | 7790 | if test -n "$relink_command"; then |
michael@0 | 7791 | # Preserve any variables that may affect compiler behavior |
michael@0 | 7792 | for var in $variables_saved_for_relink; do |
michael@0 | 7793 | if eval test -z \"\${$var+set}\"; then |
michael@0 | 7794 | relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" |
michael@0 | 7795 | elif eval var_value=\$$var; test -z "$var_value"; then |
michael@0 | 7796 | relink_command="$var=; export $var; $relink_command" |
michael@0 | 7797 | else |
michael@0 | 7798 | func_quote_for_eval "$var_value" |
michael@0 | 7799 | relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" |
michael@0 | 7800 | fi |
michael@0 | 7801 | done |
michael@0 | 7802 | relink_command="(cd `pwd`; $relink_command)" |
michael@0 | 7803 | relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` |
michael@0 | 7804 | fi |
michael@0 | 7805 | |
michael@0 | 7806 | # Quote $ECHO for shipping. |
michael@0 | 7807 | if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then |
michael@0 | 7808 | case $progpath in |
michael@0 | 7809 | [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; |
michael@0 | 7810 | *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; |
michael@0 | 7811 | esac |
michael@0 | 7812 | qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` |
michael@0 | 7813 | else |
michael@0 | 7814 | qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` |
michael@0 | 7815 | fi |
michael@0 | 7816 | |
michael@0 | 7817 | # Only actually do things if not in dry run mode. |
michael@0 | 7818 | $opt_dry_run || { |
michael@0 | 7819 | # win32 will think the script is a binary if it has |
michael@0 | 7820 | # a .exe suffix, so we strip it off here. |
michael@0 | 7821 | case $output in |
michael@0 | 7822 | *.exe) func_stripname '' '.exe' "$output" |
michael@0 | 7823 | output=$func_stripname_result ;; |
michael@0 | 7824 | esac |
michael@0 | 7825 | # test for cygwin because mv fails w/o .exe extensions |
michael@0 | 7826 | case $host in |
michael@0 | 7827 | *cygwin*) |
michael@0 | 7828 | exeext=.exe |
michael@0 | 7829 | func_stripname '' '.exe' "$outputname" |
michael@0 | 7830 | outputname=$func_stripname_result ;; |
michael@0 | 7831 | *) exeext= ;; |
michael@0 | 7832 | esac |
michael@0 | 7833 | case $host in |
michael@0 | 7834 | *cygwin* | *mingw* ) |
michael@0 | 7835 | func_dirname_and_basename "$output" "" "." |
michael@0 | 7836 | output_name=$func_basename_result |
michael@0 | 7837 | output_path=$func_dirname_result |
michael@0 | 7838 | cwrappersource="$output_path/$objdir/lt-$output_name.c" |
michael@0 | 7839 | cwrapper="$output_path/$output_name.exe" |
michael@0 | 7840 | $RM $cwrappersource $cwrapper |
michael@0 | 7841 | trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 |
michael@0 | 7842 | |
michael@0 | 7843 | func_emit_cwrapperexe_src > $cwrappersource |
michael@0 | 7844 | |
michael@0 | 7845 | # The wrapper executable is built using the $host compiler, |
michael@0 | 7846 | # because it contains $host paths and files. If cross- |
michael@0 | 7847 | # compiling, it, like the target executable, must be |
michael@0 | 7848 | # executed on the $host or under an emulation environment. |
michael@0 | 7849 | $opt_dry_run || { |
michael@0 | 7850 | $LTCC $LTCFLAGS -o $cwrapper $cwrappersource |
michael@0 | 7851 | $STRIP $cwrapper |
michael@0 | 7852 | } |
michael@0 | 7853 | |
michael@0 | 7854 | # Now, create the wrapper script for func_source use: |
michael@0 | 7855 | func_ltwrapper_scriptname $cwrapper |
michael@0 | 7856 | $RM $func_ltwrapper_scriptname_result |
michael@0 | 7857 | trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 |
michael@0 | 7858 | $opt_dry_run || { |
michael@0 | 7859 | # note: this script will not be executed, so do not chmod. |
michael@0 | 7860 | if test "x$build" = "x$host" ; then |
michael@0 | 7861 | $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result |
michael@0 | 7862 | else |
michael@0 | 7863 | func_emit_wrapper no > $func_ltwrapper_scriptname_result |
michael@0 | 7864 | fi |
michael@0 | 7865 | } |
michael@0 | 7866 | ;; |
michael@0 | 7867 | * ) |
michael@0 | 7868 | $RM $output |
michael@0 | 7869 | trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 |
michael@0 | 7870 | |
michael@0 | 7871 | func_emit_wrapper no > $output |
michael@0 | 7872 | chmod +x $output |
michael@0 | 7873 | ;; |
michael@0 | 7874 | esac |
michael@0 | 7875 | } |
michael@0 | 7876 | exit $EXIT_SUCCESS |
michael@0 | 7877 | ;; |
michael@0 | 7878 | esac |
michael@0 | 7879 | |
michael@0 | 7880 | # See if we need to build an old-fashioned archive. |
michael@0 | 7881 | for oldlib in $oldlibs; do |
michael@0 | 7882 | |
michael@0 | 7883 | if test "$build_libtool_libs" = convenience; then |
michael@0 | 7884 | oldobjs="$libobjs_save $symfileobj" |
michael@0 | 7885 | addlibs="$convenience" |
michael@0 | 7886 | build_libtool_libs=no |
michael@0 | 7887 | else |
michael@0 | 7888 | if test "$build_libtool_libs" = module; then |
michael@0 | 7889 | oldobjs="$libobjs_save" |
michael@0 | 7890 | build_libtool_libs=no |
michael@0 | 7891 | else |
michael@0 | 7892 | oldobjs="$old_deplibs $non_pic_objects" |
michael@0 | 7893 | if test "$preload" = yes && test -f "$symfileobj"; then |
michael@0 | 7894 | oldobjs="$oldobjs $symfileobj" |
michael@0 | 7895 | fi |
michael@0 | 7896 | fi |
michael@0 | 7897 | addlibs="$old_convenience" |
michael@0 | 7898 | fi |
michael@0 | 7899 | |
michael@0 | 7900 | if test -n "$addlibs"; then |
michael@0 | 7901 | gentop="$output_objdir/${outputname}x" |
michael@0 | 7902 | generated="$generated $gentop" |
michael@0 | 7903 | |
michael@0 | 7904 | func_extract_archives $gentop $addlibs |
michael@0 | 7905 | oldobjs="$oldobjs $func_extract_archives_result" |
michael@0 | 7906 | fi |
michael@0 | 7907 | |
michael@0 | 7908 | # Do each command in the archive commands. |
michael@0 | 7909 | if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then |
michael@0 | 7910 | cmds=$old_archive_from_new_cmds |
michael@0 | 7911 | else |
michael@0 | 7912 | |
michael@0 | 7913 | # Add any objects from preloaded convenience libraries |
michael@0 | 7914 | if test -n "$dlprefiles"; then |
michael@0 | 7915 | gentop="$output_objdir/${outputname}x" |
michael@0 | 7916 | generated="$generated $gentop" |
michael@0 | 7917 | |
michael@0 | 7918 | func_extract_archives $gentop $dlprefiles |
michael@0 | 7919 | oldobjs="$oldobjs $func_extract_archives_result" |
michael@0 | 7920 | fi |
michael@0 | 7921 | |
michael@0 | 7922 | # POSIX demands no paths to be encoded in archives. We have |
michael@0 | 7923 | # to avoid creating archives with duplicate basenames if we |
michael@0 | 7924 | # might have to extract them afterwards, e.g., when creating a |
michael@0 | 7925 | # static archive out of a convenience library, or when linking |
michael@0 | 7926 | # the entirety of a libtool archive into another (currently |
michael@0 | 7927 | # not supported by libtool). |
michael@0 | 7928 | if (for obj in $oldobjs |
michael@0 | 7929 | do |
michael@0 | 7930 | func_basename "$obj" |
michael@0 | 7931 | $ECHO "$func_basename_result" |
michael@0 | 7932 | done | sort | sort -uc >/dev/null 2>&1); then |
michael@0 | 7933 | : |
michael@0 | 7934 | else |
michael@0 | 7935 | $ECHO "copying selected object files to avoid basename conflicts..." |
michael@0 | 7936 | gentop="$output_objdir/${outputname}x" |
michael@0 | 7937 | generated="$generated $gentop" |
michael@0 | 7938 | func_mkdir_p "$gentop" |
michael@0 | 7939 | save_oldobjs=$oldobjs |
michael@0 | 7940 | oldobjs= |
michael@0 | 7941 | counter=1 |
michael@0 | 7942 | for obj in $save_oldobjs |
michael@0 | 7943 | do |
michael@0 | 7944 | func_basename "$obj" |
michael@0 | 7945 | objbase="$func_basename_result" |
michael@0 | 7946 | case " $oldobjs " in |
michael@0 | 7947 | " ") oldobjs=$obj ;; |
michael@0 | 7948 | *[\ /]"$objbase "*) |
michael@0 | 7949 | while :; do |
michael@0 | 7950 | # Make sure we don't pick an alternate name that also |
michael@0 | 7951 | # overlaps. |
michael@0 | 7952 | newobj=lt$counter-$objbase |
michael@0 | 7953 | func_arith $counter + 1 |
michael@0 | 7954 | counter=$func_arith_result |
michael@0 | 7955 | case " $oldobjs " in |
michael@0 | 7956 | *[\ /]"$newobj "*) ;; |
michael@0 | 7957 | *) if test ! -f "$gentop/$newobj"; then break; fi ;; |
michael@0 | 7958 | esac |
michael@0 | 7959 | done |
michael@0 | 7960 | func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" |
michael@0 | 7961 | oldobjs="$oldobjs $gentop/$newobj" |
michael@0 | 7962 | ;; |
michael@0 | 7963 | *) oldobjs="$oldobjs $obj" ;; |
michael@0 | 7964 | esac |
michael@0 | 7965 | done |
michael@0 | 7966 | fi |
michael@0 | 7967 | eval cmds=\"$old_archive_cmds\" |
michael@0 | 7968 | |
michael@0 | 7969 | func_len " $cmds" |
michael@0 | 7970 | len=$func_len_result |
michael@0 | 7971 | if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then |
michael@0 | 7972 | cmds=$old_archive_cmds |
michael@0 | 7973 | else |
michael@0 | 7974 | # the command line is too long to link in one step, link in parts |
michael@0 | 7975 | func_verbose "using piecewise archive linking..." |
michael@0 | 7976 | save_RANLIB=$RANLIB |
michael@0 | 7977 | RANLIB=: |
michael@0 | 7978 | objlist= |
michael@0 | 7979 | concat_cmds= |
michael@0 | 7980 | save_oldobjs=$oldobjs |
michael@0 | 7981 | oldobjs= |
michael@0 | 7982 | # Is there a better way of finding the last object in the list? |
michael@0 | 7983 | for obj in $save_oldobjs |
michael@0 | 7984 | do |
michael@0 | 7985 | last_oldobj=$obj |
michael@0 | 7986 | done |
michael@0 | 7987 | eval test_cmds=\"$old_archive_cmds\" |
michael@0 | 7988 | func_len " $test_cmds" |
michael@0 | 7989 | len0=$func_len_result |
michael@0 | 7990 | len=$len0 |
michael@0 | 7991 | for obj in $save_oldobjs |
michael@0 | 7992 | do |
michael@0 | 7993 | func_len " $obj" |
michael@0 | 7994 | func_arith $len + $func_len_result |
michael@0 | 7995 | len=$func_arith_result |
michael@0 | 7996 | func_append objlist " $obj" |
michael@0 | 7997 | if test "$len" -lt "$max_cmd_len"; then |
michael@0 | 7998 | : |
michael@0 | 7999 | else |
michael@0 | 8000 | # the above command should be used before it gets too long |
michael@0 | 8001 | oldobjs=$objlist |
michael@0 | 8002 | if test "$obj" = "$last_oldobj" ; then |
michael@0 | 8003 | RANLIB=$save_RANLIB |
michael@0 | 8004 | fi |
michael@0 | 8005 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ |
michael@0 | 8006 | eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" |
michael@0 | 8007 | objlist= |
michael@0 | 8008 | len=$len0 |
michael@0 | 8009 | fi |
michael@0 | 8010 | done |
michael@0 | 8011 | RANLIB=$save_RANLIB |
michael@0 | 8012 | oldobjs=$objlist |
michael@0 | 8013 | if test "X$oldobjs" = "X" ; then |
michael@0 | 8014 | eval cmds=\"\$concat_cmds\" |
michael@0 | 8015 | else |
michael@0 | 8016 | eval cmds=\"\$concat_cmds~\$old_archive_cmds\" |
michael@0 | 8017 | fi |
michael@0 | 8018 | fi |
michael@0 | 8019 | fi |
michael@0 | 8020 | func_execute_cmds "$cmds" 'exit $?' |
michael@0 | 8021 | done |
michael@0 | 8022 | |
michael@0 | 8023 | test -n "$generated" && \ |
michael@0 | 8024 | func_show_eval "${RM}r$generated" |
michael@0 | 8025 | |
michael@0 | 8026 | # Now create the libtool archive. |
michael@0 | 8027 | case $output in |
michael@0 | 8028 | *.la) |
michael@0 | 8029 | old_library= |
michael@0 | 8030 | test "$build_old_libs" = yes && old_library="$libname.$libext" |
michael@0 | 8031 | func_verbose "creating $output" |
michael@0 | 8032 | |
michael@0 | 8033 | # Preserve any variables that may affect compiler behavior |
michael@0 | 8034 | for var in $variables_saved_for_relink; do |
michael@0 | 8035 | if eval test -z \"\${$var+set}\"; then |
michael@0 | 8036 | relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" |
michael@0 | 8037 | elif eval var_value=\$$var; test -z "$var_value"; then |
michael@0 | 8038 | relink_command="$var=; export $var; $relink_command" |
michael@0 | 8039 | else |
michael@0 | 8040 | func_quote_for_eval "$var_value" |
michael@0 | 8041 | relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" |
michael@0 | 8042 | fi |
michael@0 | 8043 | done |
michael@0 | 8044 | # Quote the link command for shipping. |
michael@0 | 8045 | relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" |
michael@0 | 8046 | relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` |
michael@0 | 8047 | if test "$hardcode_automatic" = yes ; then |
michael@0 | 8048 | relink_command= |
michael@0 | 8049 | fi |
michael@0 | 8050 | |
michael@0 | 8051 | # Only create the output if not a dry run. |
michael@0 | 8052 | $opt_dry_run || { |
michael@0 | 8053 | for installed in no yes; do |
michael@0 | 8054 | if test "$installed" = yes; then |
michael@0 | 8055 | if test -z "$install_libdir"; then |
michael@0 | 8056 | break |
michael@0 | 8057 | fi |
michael@0 | 8058 | output="$output_objdir/$outputname"i |
michael@0 | 8059 | # Replace all uninstalled libtool libraries with the installed ones |
michael@0 | 8060 | newdependency_libs= |
michael@0 | 8061 | for deplib in $dependency_libs; do |
michael@0 | 8062 | case $deplib in |
michael@0 | 8063 | *.la) |
michael@0 | 8064 | func_basename "$deplib" |
michael@0 | 8065 | name="$func_basename_result" |
michael@0 | 8066 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
michael@0 | 8067 | test -z "$libdir" && \ |
michael@0 | 8068 | func_fatal_error "\`$deplib' is not a valid libtool archive" |
michael@0 | 8069 | newdependency_libs="$newdependency_libs $libdir/$name" |
michael@0 | 8070 | ;; |
michael@0 | 8071 | *) newdependency_libs="$newdependency_libs $deplib" ;; |
michael@0 | 8072 | esac |
michael@0 | 8073 | done |
michael@0 | 8074 | dependency_libs="$newdependency_libs" |
michael@0 | 8075 | newdlfiles= |
michael@0 | 8076 | |
michael@0 | 8077 | for lib in $dlfiles; do |
michael@0 | 8078 | case $lib in |
michael@0 | 8079 | *.la) |
michael@0 | 8080 | func_basename "$lib" |
michael@0 | 8081 | name="$func_basename_result" |
michael@0 | 8082 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
michael@0 | 8083 | test -z "$libdir" && \ |
michael@0 | 8084 | func_fatal_error "\`$lib' is not a valid libtool archive" |
michael@0 | 8085 | newdlfiles="$newdlfiles $libdir/$name" |
michael@0 | 8086 | ;; |
michael@0 | 8087 | *) newdlfiles="$newdlfiles $lib" ;; |
michael@0 | 8088 | esac |
michael@0 | 8089 | done |
michael@0 | 8090 | dlfiles="$newdlfiles" |
michael@0 | 8091 | newdlprefiles= |
michael@0 | 8092 | for lib in $dlprefiles; do |
michael@0 | 8093 | case $lib in |
michael@0 | 8094 | *.la) |
michael@0 | 8095 | # Only pass preopened files to the pseudo-archive (for |
michael@0 | 8096 | # eventual linking with the app. that links it) if we |
michael@0 | 8097 | # didn't already link the preopened objects directly into |
michael@0 | 8098 | # the library: |
michael@0 | 8099 | func_basename "$lib" |
michael@0 | 8100 | name="$func_basename_result" |
michael@0 | 8101 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` |
michael@0 | 8102 | test -z "$libdir" && \ |
michael@0 | 8103 | func_fatal_error "\`$lib' is not a valid libtool archive" |
michael@0 | 8104 | newdlprefiles="$newdlprefiles $libdir/$name" |
michael@0 | 8105 | ;; |
michael@0 | 8106 | esac |
michael@0 | 8107 | done |
michael@0 | 8108 | dlprefiles="$newdlprefiles" |
michael@0 | 8109 | else |
michael@0 | 8110 | newdlfiles= |
michael@0 | 8111 | for lib in $dlfiles; do |
michael@0 | 8112 | case $lib in |
michael@0 | 8113 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; |
michael@0 | 8114 | *) abs=`pwd`"/$lib" ;; |
michael@0 | 8115 | esac |
michael@0 | 8116 | newdlfiles="$newdlfiles $abs" |
michael@0 | 8117 | done |
michael@0 | 8118 | dlfiles="$newdlfiles" |
michael@0 | 8119 | newdlprefiles= |
michael@0 | 8120 | for lib in $dlprefiles; do |
michael@0 | 8121 | case $lib in |
michael@0 | 8122 | [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; |
michael@0 | 8123 | *) abs=`pwd`"/$lib" ;; |
michael@0 | 8124 | esac |
michael@0 | 8125 | newdlprefiles="$newdlprefiles $abs" |
michael@0 | 8126 | done |
michael@0 | 8127 | dlprefiles="$newdlprefiles" |
michael@0 | 8128 | fi |
michael@0 | 8129 | $RM $output |
michael@0 | 8130 | # place dlname in correct position for cygwin |
michael@0 | 8131 | tdlname=$dlname |
michael@0 | 8132 | case $host,$output,$installed,$module,$dlname in |
michael@0 | 8133 | *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; |
michael@0 | 8134 | esac |
michael@0 | 8135 | $ECHO > $output "\ |
michael@0 | 8136 | # $outputname - a libtool library file |
michael@0 | 8137 | # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION |
michael@0 | 8138 | # |
michael@0 | 8139 | # Please DO NOT delete this file! |
michael@0 | 8140 | # It is necessary for linking the library. |
michael@0 | 8141 | |
michael@0 | 8142 | # The name that we can dlopen(3). |
michael@0 | 8143 | dlname='$tdlname' |
michael@0 | 8144 | |
michael@0 | 8145 | # Names of this library. |
michael@0 | 8146 | library_names='$library_names' |
michael@0 | 8147 | |
michael@0 | 8148 | # The name of the static archive. |
michael@0 | 8149 | old_library='$old_library' |
michael@0 | 8150 | |
michael@0 | 8151 | # Linker flags that can not go in dependency_libs. |
michael@0 | 8152 | inherited_linker_flags='$new_inherited_linker_flags' |
michael@0 | 8153 | |
michael@0 | 8154 | # Libraries that this one depends upon. |
michael@0 | 8155 | dependency_libs='$dependency_libs' |
michael@0 | 8156 | |
michael@0 | 8157 | # Names of additional weak libraries provided by this library |
michael@0 | 8158 | weak_library_names='$weak_libs' |
michael@0 | 8159 | |
michael@0 | 8160 | # Version information for $libname. |
michael@0 | 8161 | current=$current |
michael@0 | 8162 | age=$age |
michael@0 | 8163 | revision=$revision |
michael@0 | 8164 | |
michael@0 | 8165 | # Is this an already installed library? |
michael@0 | 8166 | installed=$installed |
michael@0 | 8167 | |
michael@0 | 8168 | # Should we warn about portability when linking against -modules? |
michael@0 | 8169 | shouldnotlink=$module |
michael@0 | 8170 | |
michael@0 | 8171 | # Files to dlopen/dlpreopen |
michael@0 | 8172 | dlopen='$dlfiles' |
michael@0 | 8173 | dlpreopen='$dlprefiles' |
michael@0 | 8174 | |
michael@0 | 8175 | # Directory that this library needs to be installed in: |
michael@0 | 8176 | libdir='$install_libdir'" |
michael@0 | 8177 | if test "$installed" = no && test "$need_relink" = yes; then |
michael@0 | 8178 | $ECHO >> $output "\ |
michael@0 | 8179 | relink_command=\"$relink_command\"" |
michael@0 | 8180 | fi |
michael@0 | 8181 | done |
michael@0 | 8182 | } |
michael@0 | 8183 | |
michael@0 | 8184 | # Do a symbolic link so that the libtool archive can be found in |
michael@0 | 8185 | # LD_LIBRARY_PATH before the program is installed. |
michael@0 | 8186 | func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' |
michael@0 | 8187 | ;; |
michael@0 | 8188 | esac |
michael@0 | 8189 | exit $EXIT_SUCCESS |
michael@0 | 8190 | } |
michael@0 | 8191 | |
michael@0 | 8192 | { test "$mode" = link || test "$mode" = relink; } && |
michael@0 | 8193 | func_mode_link ${1+"$@"} |
michael@0 | 8194 | |
michael@0 | 8195 | |
michael@0 | 8196 | # func_mode_uninstall arg... |
michael@0 | 8197 | func_mode_uninstall () |
michael@0 | 8198 | { |
michael@0 | 8199 | $opt_debug |
michael@0 | 8200 | RM="$nonopt" |
michael@0 | 8201 | files= |
michael@0 | 8202 | rmforce= |
michael@0 | 8203 | exit_status=0 |
michael@0 | 8204 | |
michael@0 | 8205 | # This variable tells wrapper scripts just to set variables rather |
michael@0 | 8206 | # than running their programs. |
michael@0 | 8207 | libtool_install_magic="$magic" |
michael@0 | 8208 | |
michael@0 | 8209 | for arg |
michael@0 | 8210 | do |
michael@0 | 8211 | case $arg in |
michael@0 | 8212 | -f) RM="$RM $arg"; rmforce=yes ;; |
michael@0 | 8213 | -*) RM="$RM $arg" ;; |
michael@0 | 8214 | *) files="$files $arg" ;; |
michael@0 | 8215 | esac |
michael@0 | 8216 | done |
michael@0 | 8217 | |
michael@0 | 8218 | test -z "$RM" && \ |
michael@0 | 8219 | func_fatal_help "you must specify an RM program" |
michael@0 | 8220 | |
michael@0 | 8221 | rmdirs= |
michael@0 | 8222 | |
michael@0 | 8223 | origobjdir="$objdir" |
michael@0 | 8224 | for file in $files; do |
michael@0 | 8225 | func_dirname "$file" "" "." |
michael@0 | 8226 | dir="$func_dirname_result" |
michael@0 | 8227 | if test "X$dir" = X.; then |
michael@0 | 8228 | objdir="$origobjdir" |
michael@0 | 8229 | else |
michael@0 | 8230 | objdir="$dir/$origobjdir" |
michael@0 | 8231 | fi |
michael@0 | 8232 | func_basename "$file" |
michael@0 | 8233 | name="$func_basename_result" |
michael@0 | 8234 | test "$mode" = uninstall && objdir="$dir" |
michael@0 | 8235 | |
michael@0 | 8236 | # Remember objdir for removal later, being careful to avoid duplicates |
michael@0 | 8237 | if test "$mode" = clean; then |
michael@0 | 8238 | case " $rmdirs " in |
michael@0 | 8239 | *" $objdir "*) ;; |
michael@0 | 8240 | *) rmdirs="$rmdirs $objdir" ;; |
michael@0 | 8241 | esac |
michael@0 | 8242 | fi |
michael@0 | 8243 | |
michael@0 | 8244 | # Don't error if the file doesn't exist and rm -f was used. |
michael@0 | 8245 | if { test -L "$file"; } >/dev/null 2>&1 || |
michael@0 | 8246 | { test -h "$file"; } >/dev/null 2>&1 || |
michael@0 | 8247 | test -f "$file"; then |
michael@0 | 8248 | : |
michael@0 | 8249 | elif test -d "$file"; then |
michael@0 | 8250 | exit_status=1 |
michael@0 | 8251 | continue |
michael@0 | 8252 | elif test "$rmforce" = yes; then |
michael@0 | 8253 | continue |
michael@0 | 8254 | fi |
michael@0 | 8255 | |
michael@0 | 8256 | rmfiles="$file" |
michael@0 | 8257 | |
michael@0 | 8258 | case $name in |
michael@0 | 8259 | *.la) |
michael@0 | 8260 | # Possibly a libtool archive, so verify it. |
michael@0 | 8261 | if func_lalib_p "$file"; then |
michael@0 | 8262 | func_source $dir/$name |
michael@0 | 8263 | |
michael@0 | 8264 | # Delete the libtool libraries and symlinks. |
michael@0 | 8265 | for n in $library_names; do |
michael@0 | 8266 | rmfiles="$rmfiles $objdir/$n" |
michael@0 | 8267 | done |
michael@0 | 8268 | test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" |
michael@0 | 8269 | |
michael@0 | 8270 | case "$mode" in |
michael@0 | 8271 | clean) |
michael@0 | 8272 | case " $library_names " in |
michael@0 | 8273 | # " " in the beginning catches empty $dlname |
michael@0 | 8274 | *" $dlname "*) ;; |
michael@0 | 8275 | *) rmfiles="$rmfiles $objdir/$dlname" ;; |
michael@0 | 8276 | esac |
michael@0 | 8277 | test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" |
michael@0 | 8278 | ;; |
michael@0 | 8279 | uninstall) |
michael@0 | 8280 | if test -n "$library_names"; then |
michael@0 | 8281 | # Do each command in the postuninstall commands. |
michael@0 | 8282 | func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' |
michael@0 | 8283 | fi |
michael@0 | 8284 | |
michael@0 | 8285 | if test -n "$old_library"; then |
michael@0 | 8286 | # Do each command in the old_postuninstall commands. |
michael@0 | 8287 | func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' |
michael@0 | 8288 | fi |
michael@0 | 8289 | # FIXME: should reinstall the best remaining shared library. |
michael@0 | 8290 | ;; |
michael@0 | 8291 | esac |
michael@0 | 8292 | fi |
michael@0 | 8293 | ;; |
michael@0 | 8294 | |
michael@0 | 8295 | *.lo) |
michael@0 | 8296 | # Possibly a libtool object, so verify it. |
michael@0 | 8297 | if func_lalib_p "$file"; then |
michael@0 | 8298 | |
michael@0 | 8299 | # Read the .lo file |
michael@0 | 8300 | func_source $dir/$name |
michael@0 | 8301 | |
michael@0 | 8302 | # Add PIC object to the list of files to remove. |
michael@0 | 8303 | if test -n "$pic_object" && |
michael@0 | 8304 | test "$pic_object" != none; then |
michael@0 | 8305 | rmfiles="$rmfiles $dir/$pic_object" |
michael@0 | 8306 | fi |
michael@0 | 8307 | |
michael@0 | 8308 | # Add non-PIC object to the list of files to remove. |
michael@0 | 8309 | if test -n "$non_pic_object" && |
michael@0 | 8310 | test "$non_pic_object" != none; then |
michael@0 | 8311 | rmfiles="$rmfiles $dir/$non_pic_object" |
michael@0 | 8312 | fi |
michael@0 | 8313 | fi |
michael@0 | 8314 | ;; |
michael@0 | 8315 | |
michael@0 | 8316 | *) |
michael@0 | 8317 | if test "$mode" = clean ; then |
michael@0 | 8318 | noexename=$name |
michael@0 | 8319 | case $file in |
michael@0 | 8320 | *.exe) |
michael@0 | 8321 | func_stripname '' '.exe' "$file" |
michael@0 | 8322 | file=$func_stripname_result |
michael@0 | 8323 | func_stripname '' '.exe' "$name" |
michael@0 | 8324 | noexename=$func_stripname_result |
michael@0 | 8325 | # $file with .exe has already been added to rmfiles, |
michael@0 | 8326 | # add $file without .exe |
michael@0 | 8327 | rmfiles="$rmfiles $file" |
michael@0 | 8328 | ;; |
michael@0 | 8329 | esac |
michael@0 | 8330 | # Do a test to see if this is a libtool program. |
michael@0 | 8331 | if func_ltwrapper_p "$file"; then |
michael@0 | 8332 | if func_ltwrapper_executable_p "$file"; then |
michael@0 | 8333 | func_ltwrapper_scriptname "$file" |
michael@0 | 8334 | relink_command= |
michael@0 | 8335 | func_source $func_ltwrapper_scriptname_result |
michael@0 | 8336 | rmfiles="$rmfiles $func_ltwrapper_scriptname_result" |
michael@0 | 8337 | else |
michael@0 | 8338 | relink_command= |
michael@0 | 8339 | func_source $dir/$noexename |
michael@0 | 8340 | fi |
michael@0 | 8341 | |
michael@0 | 8342 | # note $name still contains .exe if it was in $file originally |
michael@0 | 8343 | # as does the version of $file that was added into $rmfiles |
michael@0 | 8344 | rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" |
michael@0 | 8345 | if test "$fast_install" = yes && test -n "$relink_command"; then |
michael@0 | 8346 | rmfiles="$rmfiles $objdir/lt-$name" |
michael@0 | 8347 | fi |
michael@0 | 8348 | if test "X$noexename" != "X$name" ; then |
michael@0 | 8349 | rmfiles="$rmfiles $objdir/lt-${noexename}.c" |
michael@0 | 8350 | fi |
michael@0 | 8351 | fi |
michael@0 | 8352 | fi |
michael@0 | 8353 | ;; |
michael@0 | 8354 | esac |
michael@0 | 8355 | func_show_eval "$RM $rmfiles" 'exit_status=1' |
michael@0 | 8356 | done |
michael@0 | 8357 | objdir="$origobjdir" |
michael@0 | 8358 | |
michael@0 | 8359 | # Try to remove the ${objdir}s in the directories where we deleted files |
michael@0 | 8360 | for dir in $rmdirs; do |
michael@0 | 8361 | if test -d "$dir"; then |
michael@0 | 8362 | func_show_eval "rmdir $dir >/dev/null 2>&1" |
michael@0 | 8363 | fi |
michael@0 | 8364 | done |
michael@0 | 8365 | |
michael@0 | 8366 | exit $exit_status |
michael@0 | 8367 | } |
michael@0 | 8368 | |
michael@0 | 8369 | { test "$mode" = uninstall || test "$mode" = clean; } && |
michael@0 | 8370 | func_mode_uninstall ${1+"$@"} |
michael@0 | 8371 | |
michael@0 | 8372 | test -z "$mode" && { |
michael@0 | 8373 | help="$generic_help" |
michael@0 | 8374 | func_fatal_help "you must specify a MODE" |
michael@0 | 8375 | } |
michael@0 | 8376 | |
michael@0 | 8377 | test -z "$exec_cmd" && \ |
michael@0 | 8378 | func_fatal_help "invalid operation mode \`$mode'" |
michael@0 | 8379 | |
michael@0 | 8380 | if test -n "$exec_cmd"; then |
michael@0 | 8381 | eval exec "$exec_cmd" |
michael@0 | 8382 | exit $EXIT_FAILURE |
michael@0 | 8383 | fi |
michael@0 | 8384 | |
michael@0 | 8385 | exit $exit_status |
michael@0 | 8386 | |
michael@0 | 8387 | |
michael@0 | 8388 | # The TAGs below are defined such that we never get into a situation |
michael@0 | 8389 | # in which we disable both kinds of libraries. Given conflicting |
michael@0 | 8390 | # choices, we go for a static library, that is the most portable, |
michael@0 | 8391 | # since we can't tell whether shared libraries were disabled because |
michael@0 | 8392 | # the user asked for that or because the platform doesn't support |
michael@0 | 8393 | # them. This is particularly important on AIX, because we don't |
michael@0 | 8394 | # support having both static and shared libraries enabled at the same |
michael@0 | 8395 | # time on that platform, so we default to a shared-only configuration. |
michael@0 | 8396 | # If a disable-shared tag is given, we'll fallback to a static-only |
michael@0 | 8397 | # configuration. But we'll never go from static-only to shared-only. |
michael@0 | 8398 | |
michael@0 | 8399 | # ### BEGIN LIBTOOL TAG CONFIG: disable-shared |
michael@0 | 8400 | build_libtool_libs=no |
michael@0 | 8401 | build_old_libs=yes |
michael@0 | 8402 | # ### END LIBTOOL TAG CONFIG: disable-shared |
michael@0 | 8403 | |
michael@0 | 8404 | # ### BEGIN LIBTOOL TAG CONFIG: disable-static |
michael@0 | 8405 | build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` |
michael@0 | 8406 | # ### END LIBTOOL TAG CONFIG: disable-static |
michael@0 | 8407 | |
michael@0 | 8408 | # Local Variables: |
michael@0 | 8409 | # mode:shell-script |
michael@0 | 8410 | # sh-indentation:2 |
michael@0 | 8411 | # End: |
michael@0 | 8412 | # vi:sw=2 |
michael@0 | 8413 |