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