annotate ltmain.sh @ 1133:482815817e99

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