annotate src/portaudio_20161030/ltmain.sh @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents 59a8758c56b1
children
rev   line source
cannam@140 1
cannam@140 2 # libtool (GNU libtool) 2.4.2
cannam@140 3 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
cannam@140 4
cannam@140 5 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
cannam@140 6 # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
cannam@140 7 # This is free software; see the source for copying conditions. There is NO
cannam@140 8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
cannam@140 9
cannam@140 10 # GNU Libtool is free software; you can redistribute it and/or modify
cannam@140 11 # it under the terms of the GNU General Public License as published by
cannam@140 12 # the Free Software Foundation; either version 2 of the License, or
cannam@140 13 # (at your option) any later version.
cannam@140 14 #
cannam@140 15 # As a special exception to the GNU General Public License,
cannam@140 16 # if you distribute this file as part of a program or library that
cannam@140 17 # is built using GNU Libtool, you may include this file under the
cannam@140 18 # same distribution terms that you use for the rest of that program.
cannam@140 19 #
cannam@140 20 # GNU Libtool is distributed in the hope that it will be useful, but
cannam@140 21 # WITHOUT ANY WARRANTY; without even the implied warranty of
cannam@140 22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cannam@140 23 # General Public License for more details.
cannam@140 24 #
cannam@140 25 # You should have received a copy of the GNU General Public License
cannam@140 26 # along with GNU Libtool; see the file COPYING. If not, a copy
cannam@140 27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
cannam@140 28 # or obtained by writing to the Free Software Foundation, Inc.,
cannam@140 29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
cannam@140 30
cannam@140 31 # Usage: $progname [OPTION]... [MODE-ARG]...
cannam@140 32 #
cannam@140 33 # Provide generalized library-building support services.
cannam@140 34 #
cannam@140 35 # --config show all configuration variables
cannam@140 36 # --debug enable verbose shell tracing
cannam@140 37 # -n, --dry-run display commands without modifying any files
cannam@140 38 # --features display basic configuration information and exit
cannam@140 39 # --mode=MODE use operation mode MODE
cannam@140 40 # --preserve-dup-deps don't remove duplicate dependency libraries
cannam@140 41 # --quiet, --silent don't print informational messages
cannam@140 42 # --no-quiet, --no-silent
cannam@140 43 # print informational messages (default)
cannam@140 44 # --no-warn don't display warning messages
cannam@140 45 # --tag=TAG use configuration variables from tag TAG
cannam@140 46 # -v, --verbose print more informational messages than default
cannam@140 47 # --no-verbose don't print the extra informational messages
cannam@140 48 # --version print version information
cannam@140 49 # -h, --help, --help-all print short, long, or detailed help message
cannam@140 50 #
cannam@140 51 # MODE must be one of the following:
cannam@140 52 #
cannam@140 53 # clean remove files from the build directory
cannam@140 54 # compile compile a source file into a libtool object
cannam@140 55 # execute automatically set library path, then run a program
cannam@140 56 # finish complete the installation of libtool libraries
cannam@140 57 # install install libraries or executables
cannam@140 58 # link create a library or an executable
cannam@140 59 # uninstall remove libraries from an installed directory
cannam@140 60 #
cannam@140 61 # MODE-ARGS vary depending on the MODE. When passed as first option,
cannam@140 62 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
cannam@140 63 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
cannam@140 64 #
cannam@140 65 # When reporting a bug, please describe a test case to reproduce it and
cannam@140 66 # include the following information:
cannam@140 67 #
cannam@140 68 # host-triplet: $host
cannam@140 69 # shell: $SHELL
cannam@140 70 # compiler: $LTCC
cannam@140 71 # compiler flags: $LTCFLAGS
cannam@140 72 # linker: $LD (gnu? $with_gnu_ld)
cannam@140 73 # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1
cannam@140 74 # automake: $automake_version
cannam@140 75 # autoconf: $autoconf_version
cannam@140 76 #
cannam@140 77 # Report bugs to <bug-libtool@gnu.org>.
cannam@140 78 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
cannam@140 79 # General help using GNU software: <http://www.gnu.org/gethelp/>.
cannam@140 80
cannam@140 81 PROGRAM=libtool
cannam@140 82 PACKAGE=libtool
cannam@140 83 VERSION="2.4.2 Debian-2.4.2-1.7ubuntu1"
cannam@140 84 TIMESTAMP=""
cannam@140 85 package_revision=1.3337
cannam@140 86
cannam@140 87 # Be Bourne compatible
cannam@140 88 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
cannam@140 89 emulate sh
cannam@140 90 NULLCMD=:
cannam@140 91 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
cannam@140 92 # is contrary to our usage. Disable this feature.
cannam@140 93 alias -g '${1+"$@"}'='"$@"'
cannam@140 94 setopt NO_GLOB_SUBST
cannam@140 95 else
cannam@140 96 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
cannam@140 97 fi
cannam@140 98 BIN_SH=xpg4; export BIN_SH # for Tru64
cannam@140 99 DUALCASE=1; export DUALCASE # for MKS sh
cannam@140 100
cannam@140 101 # A function that is used when there is no print builtin or printf.
cannam@140 102 func_fallback_echo ()
cannam@140 103 {
cannam@140 104 eval 'cat <<_LTECHO_EOF
cannam@140 105 $1
cannam@140 106 _LTECHO_EOF'
cannam@140 107 }
cannam@140 108
cannam@140 109 # NLS nuisances: We save the old values to restore during execute mode.
cannam@140 110 lt_user_locale=
cannam@140 111 lt_safe_locale=
cannam@140 112 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
cannam@140 113 do
cannam@140 114 eval "if test \"\${$lt_var+set}\" = set; then
cannam@140 115 save_$lt_var=\$$lt_var
cannam@140 116 $lt_var=C
cannam@140 117 export $lt_var
cannam@140 118 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
cannam@140 119 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
cannam@140 120 fi"
cannam@140 121 done
cannam@140 122 LC_ALL=C
cannam@140 123 LANGUAGE=C
cannam@140 124 export LANGUAGE LC_ALL
cannam@140 125
cannam@140 126 $lt_unset CDPATH
cannam@140 127
cannam@140 128
cannam@140 129 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
cannam@140 130 # is ksh but when the shell is invoked as "sh" and the current value of
cannam@140 131 # the _XPG environment variable is not equal to 1 (one), the special
cannam@140 132 # positional parameter $0, within a function call, is the name of the
cannam@140 133 # function.
cannam@140 134 progpath="$0"
cannam@140 135
cannam@140 136
cannam@140 137
cannam@140 138 : ${CP="cp -f"}
cannam@140 139 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
cannam@140 140 : ${MAKE="make"}
cannam@140 141 : ${MKDIR="mkdir"}
cannam@140 142 : ${MV="mv -f"}
cannam@140 143 : ${RM="rm -f"}
cannam@140 144 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
cannam@140 145 : ${Xsed="$SED -e 1s/^X//"}
cannam@140 146
cannam@140 147 # Global variables:
cannam@140 148 EXIT_SUCCESS=0
cannam@140 149 EXIT_FAILURE=1
cannam@140 150 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
cannam@140 151 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
cannam@140 152
cannam@140 153 exit_status=$EXIT_SUCCESS
cannam@140 154
cannam@140 155 # Make sure IFS has a sensible default
cannam@140 156 lt_nl='
cannam@140 157 '
cannam@140 158 IFS=" $lt_nl"
cannam@140 159
cannam@140 160 dirname="s,/[^/]*$,,"
cannam@140 161 basename="s,^.*/,,"
cannam@140 162
cannam@140 163 # func_dirname file append nondir_replacement
cannam@140 164 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
cannam@140 165 # otherwise set result to NONDIR_REPLACEMENT.
cannam@140 166 func_dirname ()
cannam@140 167 {
cannam@140 168 func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
cannam@140 169 if test "X$func_dirname_result" = "X${1}"; then
cannam@140 170 func_dirname_result="${3}"
cannam@140 171 else
cannam@140 172 func_dirname_result="$func_dirname_result${2}"
cannam@140 173 fi
cannam@140 174 } # func_dirname may be replaced by extended shell implementation
cannam@140 175
cannam@140 176
cannam@140 177 # func_basename file
cannam@140 178 func_basename ()
cannam@140 179 {
cannam@140 180 func_basename_result=`$ECHO "${1}" | $SED "$basename"`
cannam@140 181 } # func_basename may be replaced by extended shell implementation
cannam@140 182
cannam@140 183
cannam@140 184 # func_dirname_and_basename file append nondir_replacement
cannam@140 185 # perform func_basename and func_dirname in a single function
cannam@140 186 # call:
cannam@140 187 # dirname: Compute the dirname of FILE. If nonempty,
cannam@140 188 # add APPEND to the result, otherwise set result
cannam@140 189 # to NONDIR_REPLACEMENT.
cannam@140 190 # value returned in "$func_dirname_result"
cannam@140 191 # basename: Compute filename of FILE.
cannam@140 192 # value retuned in "$func_basename_result"
cannam@140 193 # Implementation must be kept synchronized with func_dirname
cannam@140 194 # and func_basename. For efficiency, we do not delegate to
cannam@140 195 # those functions but instead duplicate the functionality here.
cannam@140 196 func_dirname_and_basename ()
cannam@140 197 {
cannam@140 198 # Extract subdirectory from the argument.
cannam@140 199 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
cannam@140 200 if test "X$func_dirname_result" = "X${1}"; then
cannam@140 201 func_dirname_result="${3}"
cannam@140 202 else
cannam@140 203 func_dirname_result="$func_dirname_result${2}"
cannam@140 204 fi
cannam@140 205 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
cannam@140 206 } # func_dirname_and_basename may be replaced by extended shell implementation
cannam@140 207
cannam@140 208
cannam@140 209 # func_stripname prefix suffix name
cannam@140 210 # strip PREFIX and SUFFIX off of NAME.
cannam@140 211 # PREFIX and SUFFIX must not contain globbing or regex special
cannam@140 212 # characters, hashes, percent signs, but SUFFIX may contain a leading
cannam@140 213 # dot (in which case that matches only a dot).
cannam@140 214 # func_strip_suffix prefix name
cannam@140 215 func_stripname ()
cannam@140 216 {
cannam@140 217 case ${2} in
cannam@140 218 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
cannam@140 219 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
cannam@140 220 esac
cannam@140 221 } # func_stripname may be replaced by extended shell implementation
cannam@140 222
cannam@140 223
cannam@140 224 # These SED scripts presuppose an absolute path with a trailing slash.
cannam@140 225 pathcar='s,^/\([^/]*\).*$,\1,'
cannam@140 226 pathcdr='s,^/[^/]*,,'
cannam@140 227 removedotparts=':dotsl
cannam@140 228 s@/\./@/@g
cannam@140 229 t dotsl
cannam@140 230 s,/\.$,/,'
cannam@140 231 collapseslashes='s@/\{1,\}@/@g'
cannam@140 232 finalslash='s,/*$,/,'
cannam@140 233
cannam@140 234 # func_normal_abspath PATH
cannam@140 235 # Remove doubled-up and trailing slashes, "." path components,
cannam@140 236 # and cancel out any ".." path components in PATH after making
cannam@140 237 # it an absolute path.
cannam@140 238 # value returned in "$func_normal_abspath_result"
cannam@140 239 func_normal_abspath ()
cannam@140 240 {
cannam@140 241 # Start from root dir and reassemble the path.
cannam@140 242 func_normal_abspath_result=
cannam@140 243 func_normal_abspath_tpath=$1
cannam@140 244 func_normal_abspath_altnamespace=
cannam@140 245 case $func_normal_abspath_tpath in
cannam@140 246 "")
cannam@140 247 # Empty path, that just means $cwd.
cannam@140 248 func_stripname '' '/' "`pwd`"
cannam@140 249 func_normal_abspath_result=$func_stripname_result
cannam@140 250 return
cannam@140 251 ;;
cannam@140 252 # The next three entries are used to spot a run of precisely
cannam@140 253 # two leading slashes without using negated character classes;
cannam@140 254 # we take advantage of case's first-match behaviour.
cannam@140 255 ///*)
cannam@140 256 # Unusual form of absolute path, do nothing.
cannam@140 257 ;;
cannam@140 258 //*)
cannam@140 259 # Not necessarily an ordinary path; POSIX reserves leading '//'
cannam@140 260 # and for example Cygwin uses it to access remote file shares
cannam@140 261 # over CIFS/SMB, so we conserve a leading double slash if found.
cannam@140 262 func_normal_abspath_altnamespace=/
cannam@140 263 ;;
cannam@140 264 /*)
cannam@140 265 # Absolute path, do nothing.
cannam@140 266 ;;
cannam@140 267 *)
cannam@140 268 # Relative path, prepend $cwd.
cannam@140 269 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
cannam@140 270 ;;
cannam@140 271 esac
cannam@140 272 # Cancel out all the simple stuff to save iterations. We also want
cannam@140 273 # the path to end with a slash for ease of parsing, so make sure
cannam@140 274 # there is one (and only one) here.
cannam@140 275 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
cannam@140 276 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
cannam@140 277 while :; do
cannam@140 278 # Processed it all yet?
cannam@140 279 if test "$func_normal_abspath_tpath" = / ; then
cannam@140 280 # If we ascended to the root using ".." the result may be empty now.
cannam@140 281 if test -z "$func_normal_abspath_result" ; then
cannam@140 282 func_normal_abspath_result=/
cannam@140 283 fi
cannam@140 284 break
cannam@140 285 fi
cannam@140 286 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
cannam@140 287 -e "$pathcar"`
cannam@140 288 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
cannam@140 289 -e "$pathcdr"`
cannam@140 290 # Figure out what to do with it
cannam@140 291 case $func_normal_abspath_tcomponent in
cannam@140 292 "")
cannam@140 293 # Trailing empty path component, ignore it.
cannam@140 294 ;;
cannam@140 295 ..)
cannam@140 296 # Parent dir; strip last assembled component from result.
cannam@140 297 func_dirname "$func_normal_abspath_result"
cannam@140 298 func_normal_abspath_result=$func_dirname_result
cannam@140 299 ;;
cannam@140 300 *)
cannam@140 301 # Actual path component, append it.
cannam@140 302 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
cannam@140 303 ;;
cannam@140 304 esac
cannam@140 305 done
cannam@140 306 # Restore leading double-slash if one was found on entry.
cannam@140 307 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
cannam@140 308 }
cannam@140 309
cannam@140 310 # func_relative_path SRCDIR DSTDIR
cannam@140 311 # generates a relative path from SRCDIR to DSTDIR, with a trailing
cannam@140 312 # slash if non-empty, suitable for immediately appending a filename
cannam@140 313 # without needing to append a separator.
cannam@140 314 # value returned in "$func_relative_path_result"
cannam@140 315 func_relative_path ()
cannam@140 316 {
cannam@140 317 func_relative_path_result=
cannam@140 318 func_normal_abspath "$1"
cannam@140 319 func_relative_path_tlibdir=$func_normal_abspath_result
cannam@140 320 func_normal_abspath "$2"
cannam@140 321 func_relative_path_tbindir=$func_normal_abspath_result
cannam@140 322
cannam@140 323 # Ascend the tree starting from libdir
cannam@140 324 while :; do
cannam@140 325 # check if we have found a prefix of bindir
cannam@140 326 case $func_relative_path_tbindir in
cannam@140 327 $func_relative_path_tlibdir)
cannam@140 328 # found an exact match
cannam@140 329 func_relative_path_tcancelled=
cannam@140 330 break
cannam@140 331 ;;
cannam@140 332 $func_relative_path_tlibdir*)
cannam@140 333 # found a matching prefix
cannam@140 334 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
cannam@140 335 func_relative_path_tcancelled=$func_stripname_result
cannam@140 336 if test -z "$func_relative_path_result"; then
cannam@140 337 func_relative_path_result=.
cannam@140 338 fi
cannam@140 339 break
cannam@140 340 ;;
cannam@140 341 *)
cannam@140 342 func_dirname $func_relative_path_tlibdir
cannam@140 343 func_relative_path_tlibdir=${func_dirname_result}
cannam@140 344 if test "x$func_relative_path_tlibdir" = x ; then
cannam@140 345 # Have to descend all the way to the root!
cannam@140 346 func_relative_path_result=../$func_relative_path_result
cannam@140 347 func_relative_path_tcancelled=$func_relative_path_tbindir
cannam@140 348 break
cannam@140 349 fi
cannam@140 350 func_relative_path_result=../$func_relative_path_result
cannam@140 351 ;;
cannam@140 352 esac
cannam@140 353 done
cannam@140 354
cannam@140 355 # Now calculate path; take care to avoid doubling-up slashes.
cannam@140 356 func_stripname '' '/' "$func_relative_path_result"
cannam@140 357 func_relative_path_result=$func_stripname_result
cannam@140 358 func_stripname '/' '/' "$func_relative_path_tcancelled"
cannam@140 359 if test "x$func_stripname_result" != x ; then
cannam@140 360 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
cannam@140 361 fi
cannam@140 362
cannam@140 363 # Normalisation. If bindir is libdir, return empty string,
cannam@140 364 # else relative path ending with a slash; either way, target
cannam@140 365 # file name can be directly appended.
cannam@140 366 if test ! -z "$func_relative_path_result"; then
cannam@140 367 func_stripname './' '' "$func_relative_path_result/"
cannam@140 368 func_relative_path_result=$func_stripname_result
cannam@140 369 fi
cannam@140 370 }
cannam@140 371
cannam@140 372 # The name of this program:
cannam@140 373 func_dirname_and_basename "$progpath"
cannam@140 374 progname=$func_basename_result
cannam@140 375
cannam@140 376 # Make sure we have an absolute path for reexecution:
cannam@140 377 case $progpath in
cannam@140 378 [\\/]*|[A-Za-z]:\\*) ;;
cannam@140 379 *[\\/]*)
cannam@140 380 progdir=$func_dirname_result
cannam@140 381 progdir=`cd "$progdir" && pwd`
cannam@140 382 progpath="$progdir/$progname"
cannam@140 383 ;;
cannam@140 384 *)
cannam@140 385 save_IFS="$IFS"
cannam@140 386 IFS=${PATH_SEPARATOR-:}
cannam@140 387 for progdir in $PATH; do
cannam@140 388 IFS="$save_IFS"
cannam@140 389 test -x "$progdir/$progname" && break
cannam@140 390 done
cannam@140 391 IFS="$save_IFS"
cannam@140 392 test -n "$progdir" || progdir=`pwd`
cannam@140 393 progpath="$progdir/$progname"
cannam@140 394 ;;
cannam@140 395 esac
cannam@140 396
cannam@140 397 # Sed substitution that helps us do robust quoting. It backslashifies
cannam@140 398 # metacharacters that are still active within double-quoted strings.
cannam@140 399 Xsed="${SED}"' -e 1s/^X//'
cannam@140 400 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
cannam@140 401
cannam@140 402 # Same as above, but do not quote variable references.
cannam@140 403 double_quote_subst='s/\(["`\\]\)/\\\1/g'
cannam@140 404
cannam@140 405 # Sed substitution that turns a string into a regex matching for the
cannam@140 406 # string literally.
cannam@140 407 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
cannam@140 408
cannam@140 409 # Sed substitution that converts a w32 file name or path
cannam@140 410 # which contains forward slashes, into one that contains
cannam@140 411 # (escaped) backslashes. A very naive implementation.
cannam@140 412 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
cannam@140 413
cannam@140 414 # Re-`\' parameter expansions in output of double_quote_subst that were
cannam@140 415 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
cannam@140 416 # in input to double_quote_subst, that '$' was protected from expansion.
cannam@140 417 # Since each input `\' is now two `\'s, look for any number of runs of
cannam@140 418 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
cannam@140 419 bs='\\'
cannam@140 420 bs2='\\\\'
cannam@140 421 bs4='\\\\\\\\'
cannam@140 422 dollar='\$'
cannam@140 423 sed_double_backslash="\
cannam@140 424 s/$bs4/&\\
cannam@140 425 /g
cannam@140 426 s/^$bs2$dollar/$bs&/
cannam@140 427 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
cannam@140 428 s/\n//g"
cannam@140 429
cannam@140 430 # Standard options:
cannam@140 431 opt_dry_run=false
cannam@140 432 opt_help=false
cannam@140 433 opt_quiet=false
cannam@140 434 opt_verbose=false
cannam@140 435 opt_warning=:
cannam@140 436
cannam@140 437 # func_echo arg...
cannam@140 438 # Echo program name prefixed message, along with the current mode
cannam@140 439 # name if it has been set yet.
cannam@140 440 func_echo ()
cannam@140 441 {
cannam@140 442 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
cannam@140 443 }
cannam@140 444
cannam@140 445 # func_verbose arg...
cannam@140 446 # Echo program name prefixed message in verbose mode only.
cannam@140 447 func_verbose ()
cannam@140 448 {
cannam@140 449 $opt_verbose && func_echo ${1+"$@"}
cannam@140 450
cannam@140 451 # A bug in bash halts the script if the last line of a function
cannam@140 452 # fails when set -e is in force, so we need another command to
cannam@140 453 # work around that:
cannam@140 454 :
cannam@140 455 }
cannam@140 456
cannam@140 457 # func_echo_all arg...
cannam@140 458 # Invoke $ECHO with all args, space-separated.
cannam@140 459 func_echo_all ()
cannam@140 460 {
cannam@140 461 $ECHO "$*"
cannam@140 462 }
cannam@140 463
cannam@140 464 # func_error arg...
cannam@140 465 # Echo program name prefixed message to standard error.
cannam@140 466 func_error ()
cannam@140 467 {
cannam@140 468 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
cannam@140 469 }
cannam@140 470
cannam@140 471 # func_warning arg...
cannam@140 472 # Echo program name prefixed warning message to standard error.
cannam@140 473 func_warning ()
cannam@140 474 {
cannam@140 475 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
cannam@140 476
cannam@140 477 # bash bug again:
cannam@140 478 :
cannam@140 479 }
cannam@140 480
cannam@140 481 # func_fatal_error arg...
cannam@140 482 # Echo program name prefixed message to standard error, and exit.
cannam@140 483 func_fatal_error ()
cannam@140 484 {
cannam@140 485 func_error ${1+"$@"}
cannam@140 486 exit $EXIT_FAILURE
cannam@140 487 }
cannam@140 488
cannam@140 489 # func_fatal_help arg...
cannam@140 490 # Echo program name prefixed message to standard error, followed by
cannam@140 491 # a help hint, and exit.
cannam@140 492 func_fatal_help ()
cannam@140 493 {
cannam@140 494 func_error ${1+"$@"}
cannam@140 495 func_fatal_error "$help"
cannam@140 496 }
cannam@140 497 help="Try \`$progname --help' for more information." ## default
cannam@140 498
cannam@140 499
cannam@140 500 # func_grep expression filename
cannam@140 501 # Check whether EXPRESSION matches any line of FILENAME, without output.
cannam@140 502 func_grep ()
cannam@140 503 {
cannam@140 504 $GREP "$1" "$2" >/dev/null 2>&1
cannam@140 505 }
cannam@140 506
cannam@140 507
cannam@140 508 # func_mkdir_p directory-path
cannam@140 509 # Make sure the entire path to DIRECTORY-PATH is available.
cannam@140 510 func_mkdir_p ()
cannam@140 511 {
cannam@140 512 my_directory_path="$1"
cannam@140 513 my_dir_list=
cannam@140 514
cannam@140 515 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
cannam@140 516
cannam@140 517 # Protect directory names starting with `-'
cannam@140 518 case $my_directory_path in
cannam@140 519 -*) my_directory_path="./$my_directory_path" ;;
cannam@140 520 esac
cannam@140 521
cannam@140 522 # While some portion of DIR does not yet exist...
cannam@140 523 while test ! -d "$my_directory_path"; do
cannam@140 524 # ...make a list in topmost first order. Use a colon delimited
cannam@140 525 # list incase some portion of path contains whitespace.
cannam@140 526 my_dir_list="$my_directory_path:$my_dir_list"
cannam@140 527
cannam@140 528 # If the last portion added has no slash in it, the list is done
cannam@140 529 case $my_directory_path in */*) ;; *) break ;; esac
cannam@140 530
cannam@140 531 # ...otherwise throw away the child directory and loop
cannam@140 532 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
cannam@140 533 done
cannam@140 534 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
cannam@140 535
cannam@140 536 save_mkdir_p_IFS="$IFS"; IFS=':'
cannam@140 537 for my_dir in $my_dir_list; do
cannam@140 538 IFS="$save_mkdir_p_IFS"
cannam@140 539 # mkdir can fail with a `File exist' error if two processes
cannam@140 540 # try to create one of the directories concurrently. Don't
cannam@140 541 # stop in that case!
cannam@140 542 $MKDIR "$my_dir" 2>/dev/null || :
cannam@140 543 done
cannam@140 544 IFS="$save_mkdir_p_IFS"
cannam@140 545
cannam@140 546 # Bail out if we (or some other process) failed to create a directory.
cannam@140 547 test -d "$my_directory_path" || \
cannam@140 548 func_fatal_error "Failed to create \`$1'"
cannam@140 549 fi
cannam@140 550 }
cannam@140 551
cannam@140 552
cannam@140 553 # func_mktempdir [string]
cannam@140 554 # Make a temporary directory that won't clash with other running
cannam@140 555 # libtool processes, and avoids race conditions if possible. If
cannam@140 556 # given, STRING is the basename for that directory.
cannam@140 557 func_mktempdir ()
cannam@140 558 {
cannam@140 559 my_template="${TMPDIR-/tmp}/${1-$progname}"
cannam@140 560
cannam@140 561 if test "$opt_dry_run" = ":"; then
cannam@140 562 # Return a directory name, but don't create it in dry-run mode
cannam@140 563 my_tmpdir="${my_template}-$$"
cannam@140 564 else
cannam@140 565
cannam@140 566 # If mktemp works, use that first and foremost
cannam@140 567 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
cannam@140 568
cannam@140 569 if test ! -d "$my_tmpdir"; then
cannam@140 570 # Failing that, at least try and use $RANDOM to avoid a race
cannam@140 571 my_tmpdir="${my_template}-${RANDOM-0}$$"
cannam@140 572
cannam@140 573 save_mktempdir_umask=`umask`
cannam@140 574 umask 0077
cannam@140 575 $MKDIR "$my_tmpdir"
cannam@140 576 umask $save_mktempdir_umask
cannam@140 577 fi
cannam@140 578
cannam@140 579 # If we're not in dry-run mode, bomb out on failure
cannam@140 580 test -d "$my_tmpdir" || \
cannam@140 581 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
cannam@140 582 fi
cannam@140 583
cannam@140 584 $ECHO "$my_tmpdir"
cannam@140 585 }
cannam@140 586
cannam@140 587
cannam@140 588 # func_quote_for_eval arg
cannam@140 589 # Aesthetically quote ARG to be evaled later.
cannam@140 590 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
cannam@140 591 # is double-quoted, suitable for a subsequent eval, whereas
cannam@140 592 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
cannam@140 593 # which are still active within double quotes backslashified.
cannam@140 594 func_quote_for_eval ()
cannam@140 595 {
cannam@140 596 case $1 in
cannam@140 597 *[\\\`\"\$]*)
cannam@140 598 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
cannam@140 599 *)
cannam@140 600 func_quote_for_eval_unquoted_result="$1" ;;
cannam@140 601 esac
cannam@140 602
cannam@140 603 case $func_quote_for_eval_unquoted_result in
cannam@140 604 # Double-quote args containing shell metacharacters to delay
cannam@140 605 # word splitting, command substitution and and variable
cannam@140 606 # expansion for a subsequent eval.
cannam@140 607 # Many Bourne shells cannot handle close brackets correctly
cannam@140 608 # in scan sets, so we specify it separately.
cannam@140 609 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
cannam@140 610 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
cannam@140 611 ;;
cannam@140 612 *)
cannam@140 613 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
cannam@140 614 esac
cannam@140 615 }
cannam@140 616
cannam@140 617
cannam@140 618 # func_quote_for_expand arg
cannam@140 619 # Aesthetically quote ARG to be evaled later; same as above,
cannam@140 620 # but do not quote variable references.
cannam@140 621 func_quote_for_expand ()
cannam@140 622 {
cannam@140 623 case $1 in
cannam@140 624 *[\\\`\"]*)
cannam@140 625 my_arg=`$ECHO "$1" | $SED \
cannam@140 626 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
cannam@140 627 *)
cannam@140 628 my_arg="$1" ;;
cannam@140 629 esac
cannam@140 630
cannam@140 631 case $my_arg in
cannam@140 632 # Double-quote args containing shell metacharacters to delay
cannam@140 633 # word splitting and command substitution for a subsequent eval.
cannam@140 634 # Many Bourne shells cannot handle close brackets correctly
cannam@140 635 # in scan sets, so we specify it separately.
cannam@140 636 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
cannam@140 637 my_arg="\"$my_arg\""
cannam@140 638 ;;
cannam@140 639 esac
cannam@140 640
cannam@140 641 func_quote_for_expand_result="$my_arg"
cannam@140 642 }
cannam@140 643
cannam@140 644
cannam@140 645 # func_show_eval cmd [fail_exp]
cannam@140 646 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
cannam@140 647 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
cannam@140 648 # is given, then evaluate it.
cannam@140 649 func_show_eval ()
cannam@140 650 {
cannam@140 651 my_cmd="$1"
cannam@140 652 my_fail_exp="${2-:}"
cannam@140 653
cannam@140 654 ${opt_silent-false} || {
cannam@140 655 func_quote_for_expand "$my_cmd"
cannam@140 656 eval "func_echo $func_quote_for_expand_result"
cannam@140 657 }
cannam@140 658
cannam@140 659 if ${opt_dry_run-false}; then :; else
cannam@140 660 eval "$my_cmd"
cannam@140 661 my_status=$?
cannam@140 662 if test "$my_status" -eq 0; then :; else
cannam@140 663 eval "(exit $my_status); $my_fail_exp"
cannam@140 664 fi
cannam@140 665 fi
cannam@140 666 }
cannam@140 667
cannam@140 668
cannam@140 669 # func_show_eval_locale cmd [fail_exp]
cannam@140 670 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
cannam@140 671 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
cannam@140 672 # is given, then evaluate it. Use the saved locale for evaluation.
cannam@140 673 func_show_eval_locale ()
cannam@140 674 {
cannam@140 675 my_cmd="$1"
cannam@140 676 my_fail_exp="${2-:}"
cannam@140 677
cannam@140 678 ${opt_silent-false} || {
cannam@140 679 func_quote_for_expand "$my_cmd"
cannam@140 680 eval "func_echo $func_quote_for_expand_result"
cannam@140 681 }
cannam@140 682
cannam@140 683 if ${opt_dry_run-false}; then :; else
cannam@140 684 eval "$lt_user_locale
cannam@140 685 $my_cmd"
cannam@140 686 my_status=$?
cannam@140 687 eval "$lt_safe_locale"
cannam@140 688 if test "$my_status" -eq 0; then :; else
cannam@140 689 eval "(exit $my_status); $my_fail_exp"
cannam@140 690 fi
cannam@140 691 fi
cannam@140 692 }
cannam@140 693
cannam@140 694 # func_tr_sh
cannam@140 695 # Turn $1 into a string suitable for a shell variable name.
cannam@140 696 # Result is stored in $func_tr_sh_result. All characters
cannam@140 697 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
cannam@140 698 # if $1 begins with a digit, a '_' is prepended as well.
cannam@140 699 func_tr_sh ()
cannam@140 700 {
cannam@140 701 case $1 in
cannam@140 702 [0-9]* | *[!a-zA-Z0-9_]*)
cannam@140 703 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
cannam@140 704 ;;
cannam@140 705 * )
cannam@140 706 func_tr_sh_result=$1
cannam@140 707 ;;
cannam@140 708 esac
cannam@140 709 }
cannam@140 710
cannam@140 711
cannam@140 712 # func_version
cannam@140 713 # Echo version message to standard output and exit.
cannam@140 714 func_version ()
cannam@140 715 {
cannam@140 716 $opt_debug
cannam@140 717
cannam@140 718 $SED -n '/(C)/!b go
cannam@140 719 :more
cannam@140 720 /\./!{
cannam@140 721 N
cannam@140 722 s/\n# / /
cannam@140 723 b more
cannam@140 724 }
cannam@140 725 :go
cannam@140 726 /^# '$PROGRAM' (GNU /,/# warranty; / {
cannam@140 727 s/^# //
cannam@140 728 s/^# *$//
cannam@140 729 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
cannam@140 730 p
cannam@140 731 }' < "$progpath"
cannam@140 732 exit $?
cannam@140 733 }
cannam@140 734
cannam@140 735 # func_usage
cannam@140 736 # Echo short help message to standard output and exit.
cannam@140 737 func_usage ()
cannam@140 738 {
cannam@140 739 $opt_debug
cannam@140 740
cannam@140 741 $SED -n '/^# Usage:/,/^# *.*--help/ {
cannam@140 742 s/^# //
cannam@140 743 s/^# *$//
cannam@140 744 s/\$progname/'$progname'/
cannam@140 745 p
cannam@140 746 }' < "$progpath"
cannam@140 747 echo
cannam@140 748 $ECHO "run \`$progname --help | more' for full usage"
cannam@140 749 exit $?
cannam@140 750 }
cannam@140 751
cannam@140 752 # func_help [NOEXIT]
cannam@140 753 # Echo long help message to standard output and exit,
cannam@140 754 # unless 'noexit' is passed as argument.
cannam@140 755 func_help ()
cannam@140 756 {
cannam@140 757 $opt_debug
cannam@140 758
cannam@140 759 $SED -n '/^# Usage:/,/# Report bugs to/ {
cannam@140 760 :print
cannam@140 761 s/^# //
cannam@140 762 s/^# *$//
cannam@140 763 s*\$progname*'$progname'*
cannam@140 764 s*\$host*'"$host"'*
cannam@140 765 s*\$SHELL*'"$SHELL"'*
cannam@140 766 s*\$LTCC*'"$LTCC"'*
cannam@140 767 s*\$LTCFLAGS*'"$LTCFLAGS"'*
cannam@140 768 s*\$LD*'"$LD"'*
cannam@140 769 s/\$with_gnu_ld/'"$with_gnu_ld"'/
cannam@140 770 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
cannam@140 771 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
cannam@140 772 p
cannam@140 773 d
cannam@140 774 }
cannam@140 775 /^# .* home page:/b print
cannam@140 776 /^# General help using/b print
cannam@140 777 ' < "$progpath"
cannam@140 778 ret=$?
cannam@140 779 if test -z "$1"; then
cannam@140 780 exit $ret
cannam@140 781 fi
cannam@140 782 }
cannam@140 783
cannam@140 784 # func_missing_arg argname
cannam@140 785 # Echo program name prefixed message to standard error and set global
cannam@140 786 # exit_cmd.
cannam@140 787 func_missing_arg ()
cannam@140 788 {
cannam@140 789 $opt_debug
cannam@140 790
cannam@140 791 func_error "missing argument for $1."
cannam@140 792 exit_cmd=exit
cannam@140 793 }
cannam@140 794
cannam@140 795
cannam@140 796 # func_split_short_opt shortopt
cannam@140 797 # Set func_split_short_opt_name and func_split_short_opt_arg shell
cannam@140 798 # variables after splitting SHORTOPT after the 2nd character.
cannam@140 799 func_split_short_opt ()
cannam@140 800 {
cannam@140 801 my_sed_short_opt='1s/^\(..\).*$/\1/;q'
cannam@140 802 my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
cannam@140 803
cannam@140 804 func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
cannam@140 805 func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
cannam@140 806 } # func_split_short_opt may be replaced by extended shell implementation
cannam@140 807
cannam@140 808
cannam@140 809 # func_split_long_opt longopt
cannam@140 810 # Set func_split_long_opt_name and func_split_long_opt_arg shell
cannam@140 811 # variables after splitting LONGOPT at the `=' sign.
cannam@140 812 func_split_long_opt ()
cannam@140 813 {
cannam@140 814 my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
cannam@140 815 my_sed_long_arg='1s/^--[^=]*=//'
cannam@140 816
cannam@140 817 func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
cannam@140 818 func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
cannam@140 819 } # func_split_long_opt may be replaced by extended shell implementation
cannam@140 820
cannam@140 821 exit_cmd=:
cannam@140 822
cannam@140 823
cannam@140 824
cannam@140 825
cannam@140 826
cannam@140 827 magic="%%%MAGIC variable%%%"
cannam@140 828 magic_exe="%%%MAGIC EXE variable%%%"
cannam@140 829
cannam@140 830 # Global variables.
cannam@140 831 nonopt=
cannam@140 832 preserve_args=
cannam@140 833 lo2o="s/\\.lo\$/.${objext}/"
cannam@140 834 o2lo="s/\\.${objext}\$/.lo/"
cannam@140 835 extracted_archives=
cannam@140 836 extracted_serial=0
cannam@140 837
cannam@140 838 # If this variable is set in any of the actions, the command in it
cannam@140 839 # will be execed at the end. This prevents here-documents from being
cannam@140 840 # left over by shells.
cannam@140 841 exec_cmd=
cannam@140 842
cannam@140 843 # func_append var value
cannam@140 844 # Append VALUE to the end of shell variable VAR.
cannam@140 845 func_append ()
cannam@140 846 {
cannam@140 847 eval "${1}=\$${1}\${2}"
cannam@140 848 } # func_append may be replaced by extended shell implementation
cannam@140 849
cannam@140 850 # func_append_quoted var value
cannam@140 851 # Quote VALUE and append to the end of shell variable VAR, separated
cannam@140 852 # by a space.
cannam@140 853 func_append_quoted ()
cannam@140 854 {
cannam@140 855 func_quote_for_eval "${2}"
cannam@140 856 eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
cannam@140 857 } # func_append_quoted may be replaced by extended shell implementation
cannam@140 858
cannam@140 859
cannam@140 860 # func_arith arithmetic-term...
cannam@140 861 func_arith ()
cannam@140 862 {
cannam@140 863 func_arith_result=`expr "${@}"`
cannam@140 864 } # func_arith may be replaced by extended shell implementation
cannam@140 865
cannam@140 866
cannam@140 867 # func_len string
cannam@140 868 # STRING may not start with a hyphen.
cannam@140 869 func_len ()
cannam@140 870 {
cannam@140 871 func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
cannam@140 872 } # func_len may be replaced by extended shell implementation
cannam@140 873
cannam@140 874
cannam@140 875 # func_lo2o object
cannam@140 876 func_lo2o ()
cannam@140 877 {
cannam@140 878 func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
cannam@140 879 } # func_lo2o may be replaced by extended shell implementation
cannam@140 880
cannam@140 881
cannam@140 882 # func_xform libobj-or-source
cannam@140 883 func_xform ()
cannam@140 884 {
cannam@140 885 func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
cannam@140 886 } # func_xform may be replaced by extended shell implementation
cannam@140 887
cannam@140 888
cannam@140 889 # func_fatal_configuration arg...
cannam@140 890 # Echo program name prefixed message to standard error, followed by
cannam@140 891 # a configuration failure hint, and exit.
cannam@140 892 func_fatal_configuration ()
cannam@140 893 {
cannam@140 894 func_error ${1+"$@"}
cannam@140 895 func_error "See the $PACKAGE documentation for more information."
cannam@140 896 func_fatal_error "Fatal configuration error."
cannam@140 897 }
cannam@140 898
cannam@140 899
cannam@140 900 # func_config
cannam@140 901 # Display the configuration for all the tags in this script.
cannam@140 902 func_config ()
cannam@140 903 {
cannam@140 904 re_begincf='^# ### BEGIN LIBTOOL'
cannam@140 905 re_endcf='^# ### END LIBTOOL'
cannam@140 906
cannam@140 907 # Default configuration.
cannam@140 908 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
cannam@140 909
cannam@140 910 # Now print the configurations for the tags.
cannam@140 911 for tagname in $taglist; do
cannam@140 912 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
cannam@140 913 done
cannam@140 914
cannam@140 915 exit $?
cannam@140 916 }
cannam@140 917
cannam@140 918 # func_features
cannam@140 919 # Display the features supported by this script.
cannam@140 920 func_features ()
cannam@140 921 {
cannam@140 922 echo "host: $host"
cannam@140 923 if test "$build_libtool_libs" = yes; then
cannam@140 924 echo "enable shared libraries"
cannam@140 925 else
cannam@140 926 echo "disable shared libraries"
cannam@140 927 fi
cannam@140 928 if test "$build_old_libs" = yes; then
cannam@140 929 echo "enable static libraries"
cannam@140 930 else
cannam@140 931 echo "disable static libraries"
cannam@140 932 fi
cannam@140 933
cannam@140 934 exit $?
cannam@140 935 }
cannam@140 936
cannam@140 937 # func_enable_tag tagname
cannam@140 938 # Verify that TAGNAME is valid, and either flag an error and exit, or
cannam@140 939 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
cannam@140 940 # variable here.
cannam@140 941 func_enable_tag ()
cannam@140 942 {
cannam@140 943 # Global variable:
cannam@140 944 tagname="$1"
cannam@140 945
cannam@140 946 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
cannam@140 947 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
cannam@140 948 sed_extractcf="/$re_begincf/,/$re_endcf/p"
cannam@140 949
cannam@140 950 # Validate tagname.
cannam@140 951 case $tagname in
cannam@140 952 *[!-_A-Za-z0-9,/]*)
cannam@140 953 func_fatal_error "invalid tag name: $tagname"
cannam@140 954 ;;
cannam@140 955 esac
cannam@140 956
cannam@140 957 # Don't test for the "default" C tag, as we know it's
cannam@140 958 # there but not specially marked.
cannam@140 959 case $tagname in
cannam@140 960 CC) ;;
cannam@140 961 *)
cannam@140 962 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
cannam@140 963 taglist="$taglist $tagname"
cannam@140 964
cannam@140 965 # Evaluate the configuration. Be careful to quote the path
cannam@140 966 # and the sed script, to avoid splitting on whitespace, but
cannam@140 967 # also don't use non-portable quotes within backquotes within
cannam@140 968 # quotes we have to do it in 2 steps:
cannam@140 969 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
cannam@140 970 eval "$extractedcf"
cannam@140 971 else
cannam@140 972 func_error "ignoring unknown tag $tagname"
cannam@140 973 fi
cannam@140 974 ;;
cannam@140 975 esac
cannam@140 976 }
cannam@140 977
cannam@140 978 # func_check_version_match
cannam@140 979 # Ensure that we are using m4 macros, and libtool script from the same
cannam@140 980 # release of libtool.
cannam@140 981 func_check_version_match ()
cannam@140 982 {
cannam@140 983 if test "$package_revision" != "$macro_revision"; then
cannam@140 984 if test "$VERSION" != "$macro_version"; then
cannam@140 985 if test -z "$macro_version"; then
cannam@140 986 cat >&2 <<_LT_EOF
cannam@140 987 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
cannam@140 988 $progname: definition of this LT_INIT comes from an older release.
cannam@140 989 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
cannam@140 990 $progname: and run autoconf again.
cannam@140 991 _LT_EOF
cannam@140 992 else
cannam@140 993 cat >&2 <<_LT_EOF
cannam@140 994 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
cannam@140 995 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
cannam@140 996 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
cannam@140 997 $progname: and run autoconf again.
cannam@140 998 _LT_EOF
cannam@140 999 fi
cannam@140 1000 else
cannam@140 1001 cat >&2 <<_LT_EOF
cannam@140 1002 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
cannam@140 1003 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
cannam@140 1004 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
cannam@140 1005 $progname: of $PACKAGE $VERSION and run autoconf again.
cannam@140 1006 _LT_EOF
cannam@140 1007 fi
cannam@140 1008
cannam@140 1009 exit $EXIT_MISMATCH
cannam@140 1010 fi
cannam@140 1011 }
cannam@140 1012
cannam@140 1013
cannam@140 1014 # Shorthand for --mode=foo, only valid as the first argument
cannam@140 1015 case $1 in
cannam@140 1016 clean|clea|cle|cl)
cannam@140 1017 shift; set dummy --mode clean ${1+"$@"}; shift
cannam@140 1018 ;;
cannam@140 1019 compile|compil|compi|comp|com|co|c)
cannam@140 1020 shift; set dummy --mode compile ${1+"$@"}; shift
cannam@140 1021 ;;
cannam@140 1022 execute|execut|execu|exec|exe|ex|e)
cannam@140 1023 shift; set dummy --mode execute ${1+"$@"}; shift
cannam@140 1024 ;;
cannam@140 1025 finish|finis|fini|fin|fi|f)
cannam@140 1026 shift; set dummy --mode finish ${1+"$@"}; shift
cannam@140 1027 ;;
cannam@140 1028 install|instal|insta|inst|ins|in|i)
cannam@140 1029 shift; set dummy --mode install ${1+"$@"}; shift
cannam@140 1030 ;;
cannam@140 1031 link|lin|li|l)
cannam@140 1032 shift; set dummy --mode link ${1+"$@"}; shift
cannam@140 1033 ;;
cannam@140 1034 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
cannam@140 1035 shift; set dummy --mode uninstall ${1+"$@"}; shift
cannam@140 1036 ;;
cannam@140 1037 esac
cannam@140 1038
cannam@140 1039
cannam@140 1040
cannam@140 1041 # Option defaults:
cannam@140 1042 opt_debug=:
cannam@140 1043 opt_dry_run=false
cannam@140 1044 opt_config=false
cannam@140 1045 opt_preserve_dup_deps=false
cannam@140 1046 opt_features=false
cannam@140 1047 opt_finish=false
cannam@140 1048 opt_help=false
cannam@140 1049 opt_help_all=false
cannam@140 1050 opt_silent=:
cannam@140 1051 opt_warning=:
cannam@140 1052 opt_verbose=:
cannam@140 1053 opt_silent=false
cannam@140 1054 opt_verbose=false
cannam@140 1055
cannam@140 1056
cannam@140 1057 # Parse options once, thoroughly. This comes as soon as possible in the
cannam@140 1058 # script to make things like `--version' happen as quickly as we can.
cannam@140 1059 {
cannam@140 1060 # this just eases exit handling
cannam@140 1061 while test $# -gt 0; do
cannam@140 1062 opt="$1"
cannam@140 1063 shift
cannam@140 1064 case $opt in
cannam@140 1065 --debug|-x) opt_debug='set -x'
cannam@140 1066 func_echo "enabling shell trace mode"
cannam@140 1067 $opt_debug
cannam@140 1068 ;;
cannam@140 1069 --dry-run|--dryrun|-n)
cannam@140 1070 opt_dry_run=:
cannam@140 1071 ;;
cannam@140 1072 --config)
cannam@140 1073 opt_config=:
cannam@140 1074 func_config
cannam@140 1075 ;;
cannam@140 1076 --dlopen|-dlopen)
cannam@140 1077 optarg="$1"
cannam@140 1078 opt_dlopen="${opt_dlopen+$opt_dlopen
cannam@140 1079 }$optarg"
cannam@140 1080 shift
cannam@140 1081 ;;
cannam@140 1082 --preserve-dup-deps)
cannam@140 1083 opt_preserve_dup_deps=:
cannam@140 1084 ;;
cannam@140 1085 --features)
cannam@140 1086 opt_features=:
cannam@140 1087 func_features
cannam@140 1088 ;;
cannam@140 1089 --finish)
cannam@140 1090 opt_finish=:
cannam@140 1091 set dummy --mode finish ${1+"$@"}; shift
cannam@140 1092 ;;
cannam@140 1093 --help)
cannam@140 1094 opt_help=:
cannam@140 1095 ;;
cannam@140 1096 --help-all)
cannam@140 1097 opt_help_all=:
cannam@140 1098 opt_help=': help-all'
cannam@140 1099 ;;
cannam@140 1100 --mode)
cannam@140 1101 test $# = 0 && func_missing_arg $opt && break
cannam@140 1102 optarg="$1"
cannam@140 1103 opt_mode="$optarg"
cannam@140 1104 case $optarg in
cannam@140 1105 # Valid mode arguments:
cannam@140 1106 clean|compile|execute|finish|install|link|relink|uninstall) ;;
cannam@140 1107
cannam@140 1108 # Catch anything else as an error
cannam@140 1109 *) func_error "invalid argument for $opt"
cannam@140 1110 exit_cmd=exit
cannam@140 1111 break
cannam@140 1112 ;;
cannam@140 1113 esac
cannam@140 1114 shift
cannam@140 1115 ;;
cannam@140 1116 --no-silent|--no-quiet)
cannam@140 1117 opt_silent=false
cannam@140 1118 func_append preserve_args " $opt"
cannam@140 1119 ;;
cannam@140 1120 --no-warning|--no-warn)
cannam@140 1121 opt_warning=false
cannam@140 1122 func_append preserve_args " $opt"
cannam@140 1123 ;;
cannam@140 1124 --no-verbose)
cannam@140 1125 opt_verbose=false
cannam@140 1126 func_append preserve_args " $opt"
cannam@140 1127 ;;
cannam@140 1128 --silent|--quiet)
cannam@140 1129 opt_silent=:
cannam@140 1130 func_append preserve_args " $opt"
cannam@140 1131 opt_verbose=false
cannam@140 1132 ;;
cannam@140 1133 --verbose|-v)
cannam@140 1134 opt_verbose=:
cannam@140 1135 func_append preserve_args " $opt"
cannam@140 1136 opt_silent=false
cannam@140 1137 ;;
cannam@140 1138 --tag)
cannam@140 1139 test $# = 0 && func_missing_arg $opt && break
cannam@140 1140 optarg="$1"
cannam@140 1141 opt_tag="$optarg"
cannam@140 1142 func_append preserve_args " $opt $optarg"
cannam@140 1143 func_enable_tag "$optarg"
cannam@140 1144 shift
cannam@140 1145 ;;
cannam@140 1146
cannam@140 1147 -\?|-h) func_usage ;;
cannam@140 1148 --help) func_help ;;
cannam@140 1149 --version) func_version ;;
cannam@140 1150
cannam@140 1151 # Separate optargs to long options:
cannam@140 1152 --*=*)
cannam@140 1153 func_split_long_opt "$opt"
cannam@140 1154 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
cannam@140 1155 shift
cannam@140 1156 ;;
cannam@140 1157
cannam@140 1158 # Separate non-argument short options:
cannam@140 1159 -\?*|-h*|-n*|-v*)
cannam@140 1160 func_split_short_opt "$opt"
cannam@140 1161 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
cannam@140 1162 shift
cannam@140 1163 ;;
cannam@140 1164
cannam@140 1165 --) break ;;
cannam@140 1166 -*) func_fatal_help "unrecognized option \`$opt'" ;;
cannam@140 1167 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
cannam@140 1168 esac
cannam@140 1169 done
cannam@140 1170
cannam@140 1171 # Validate options:
cannam@140 1172
cannam@140 1173 # save first non-option argument
cannam@140 1174 if test "$#" -gt 0; then
cannam@140 1175 nonopt="$opt"
cannam@140 1176 shift
cannam@140 1177 fi
cannam@140 1178
cannam@140 1179 # preserve --debug
cannam@140 1180 test "$opt_debug" = : || func_append preserve_args " --debug"
cannam@140 1181
cannam@140 1182 case $host in
cannam@140 1183 *cygwin* | *mingw* | *pw32* | *cegcc*)
cannam@140 1184 # don't eliminate duplications in $postdeps and $predeps
cannam@140 1185 opt_duplicate_compiler_generated_deps=:
cannam@140 1186 ;;
cannam@140 1187 *)
cannam@140 1188 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
cannam@140 1189 ;;
cannam@140 1190 esac
cannam@140 1191
cannam@140 1192 $opt_help || {
cannam@140 1193 # Sanity checks first:
cannam@140 1194 func_check_version_match
cannam@140 1195
cannam@140 1196 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
cannam@140 1197 func_fatal_configuration "not configured to build any kind of library"
cannam@140 1198 fi
cannam@140 1199
cannam@140 1200 # Darwin sucks
cannam@140 1201 eval std_shrext=\"$shrext_cmds\"
cannam@140 1202
cannam@140 1203 # Only execute mode is allowed to have -dlopen flags.
cannam@140 1204 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
cannam@140 1205 func_error "unrecognized option \`-dlopen'"
cannam@140 1206 $ECHO "$help" 1>&2
cannam@140 1207 exit $EXIT_FAILURE
cannam@140 1208 fi
cannam@140 1209
cannam@140 1210 # Change the help message to a mode-specific one.
cannam@140 1211 generic_help="$help"
cannam@140 1212 help="Try \`$progname --help --mode=$opt_mode' for more information."
cannam@140 1213 }
cannam@140 1214
cannam@140 1215
cannam@140 1216 # Bail if the options were screwed
cannam@140 1217 $exit_cmd $EXIT_FAILURE
cannam@140 1218 }
cannam@140 1219
cannam@140 1220
cannam@140 1221
cannam@140 1222
cannam@140 1223 ## ----------- ##
cannam@140 1224 ## Main. ##
cannam@140 1225 ## ----------- ##
cannam@140 1226
cannam@140 1227 # func_lalib_p file
cannam@140 1228 # True iff FILE is a libtool `.la' library or `.lo' object file.
cannam@140 1229 # This function is only a basic sanity check; it will hardly flush out
cannam@140 1230 # determined imposters.
cannam@140 1231 func_lalib_p ()
cannam@140 1232 {
cannam@140 1233 test -f "$1" &&
cannam@140 1234 $SED -e 4q "$1" 2>/dev/null \
cannam@140 1235 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
cannam@140 1236 }
cannam@140 1237
cannam@140 1238 # func_lalib_unsafe_p file
cannam@140 1239 # True iff FILE is a libtool `.la' library or `.lo' object file.
cannam@140 1240 # This function implements the same check as func_lalib_p without
cannam@140 1241 # resorting to external programs. To this end, it redirects stdin and
cannam@140 1242 # closes it afterwards, without saving the original file descriptor.
cannam@140 1243 # As a safety measure, use it only where a negative result would be
cannam@140 1244 # fatal anyway. Works if `file' does not exist.
cannam@140 1245 func_lalib_unsafe_p ()
cannam@140 1246 {
cannam@140 1247 lalib_p=no
cannam@140 1248 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
cannam@140 1249 for lalib_p_l in 1 2 3 4
cannam@140 1250 do
cannam@140 1251 read lalib_p_line
cannam@140 1252 case "$lalib_p_line" in
cannam@140 1253 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
cannam@140 1254 esac
cannam@140 1255 done
cannam@140 1256 exec 0<&5 5<&-
cannam@140 1257 fi
cannam@140 1258 test "$lalib_p" = yes
cannam@140 1259 }
cannam@140 1260
cannam@140 1261 # func_ltwrapper_script_p file
cannam@140 1262 # True iff FILE is a libtool wrapper script
cannam@140 1263 # This function is only a basic sanity check; it will hardly flush out
cannam@140 1264 # determined imposters.
cannam@140 1265 func_ltwrapper_script_p ()
cannam@140 1266 {
cannam@140 1267 func_lalib_p "$1"
cannam@140 1268 }
cannam@140 1269
cannam@140 1270 # func_ltwrapper_executable_p file
cannam@140 1271 # True iff FILE is a libtool wrapper executable
cannam@140 1272 # This function is only a basic sanity check; it will hardly flush out
cannam@140 1273 # determined imposters.
cannam@140 1274 func_ltwrapper_executable_p ()
cannam@140 1275 {
cannam@140 1276 func_ltwrapper_exec_suffix=
cannam@140 1277 case $1 in
cannam@140 1278 *.exe) ;;
cannam@140 1279 *) func_ltwrapper_exec_suffix=.exe ;;
cannam@140 1280 esac
cannam@140 1281 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
cannam@140 1282 }
cannam@140 1283
cannam@140 1284 # func_ltwrapper_scriptname file
cannam@140 1285 # Assumes file is an ltwrapper_executable
cannam@140 1286 # uses $file to determine the appropriate filename for a
cannam@140 1287 # temporary ltwrapper_script.
cannam@140 1288 func_ltwrapper_scriptname ()
cannam@140 1289 {
cannam@140 1290 func_dirname_and_basename "$1" "" "."
cannam@140 1291 func_stripname '' '.exe' "$func_basename_result"
cannam@140 1292 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
cannam@140 1293 }
cannam@140 1294
cannam@140 1295 # func_ltwrapper_p file
cannam@140 1296 # True iff FILE is a libtool wrapper script or wrapper executable
cannam@140 1297 # This function is only a basic sanity check; it will hardly flush out
cannam@140 1298 # determined imposters.
cannam@140 1299 func_ltwrapper_p ()
cannam@140 1300 {
cannam@140 1301 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
cannam@140 1302 }
cannam@140 1303
cannam@140 1304
cannam@140 1305 # func_execute_cmds commands fail_cmd
cannam@140 1306 # Execute tilde-delimited COMMANDS.
cannam@140 1307 # If FAIL_CMD is given, eval that upon failure.
cannam@140 1308 # FAIL_CMD may read-access the current command in variable CMD!
cannam@140 1309 func_execute_cmds ()
cannam@140 1310 {
cannam@140 1311 $opt_debug
cannam@140 1312 save_ifs=$IFS; IFS='~'
cannam@140 1313 for cmd in $1; do
cannam@140 1314 IFS=$save_ifs
cannam@140 1315 eval cmd=\"$cmd\"
cannam@140 1316 func_show_eval "$cmd" "${2-:}"
cannam@140 1317 done
cannam@140 1318 IFS=$save_ifs
cannam@140 1319 }
cannam@140 1320
cannam@140 1321
cannam@140 1322 # func_source file
cannam@140 1323 # Source FILE, adding directory component if necessary.
cannam@140 1324 # Note that it is not necessary on cygwin/mingw to append a dot to
cannam@140 1325 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
cannam@140 1326 # behavior happens only for exec(3), not for open(2)! Also, sourcing
cannam@140 1327 # `FILE.' does not work on cygwin managed mounts.
cannam@140 1328 func_source ()
cannam@140 1329 {
cannam@140 1330 $opt_debug
cannam@140 1331 case $1 in
cannam@140 1332 */* | *\\*) . "$1" ;;
cannam@140 1333 *) . "./$1" ;;
cannam@140 1334 esac
cannam@140 1335 }
cannam@140 1336
cannam@140 1337
cannam@140 1338 # func_resolve_sysroot PATH
cannam@140 1339 # Replace a leading = in PATH with a sysroot. Store the result into
cannam@140 1340 # func_resolve_sysroot_result
cannam@140 1341 func_resolve_sysroot ()
cannam@140 1342 {
cannam@140 1343 func_resolve_sysroot_result=$1
cannam@140 1344 case $func_resolve_sysroot_result in
cannam@140 1345 =*)
cannam@140 1346 func_stripname '=' '' "$func_resolve_sysroot_result"
cannam@140 1347 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
cannam@140 1348 ;;
cannam@140 1349 esac
cannam@140 1350 }
cannam@140 1351
cannam@140 1352 # func_replace_sysroot PATH
cannam@140 1353 # If PATH begins with the sysroot, replace it with = and
cannam@140 1354 # store the result into func_replace_sysroot_result.
cannam@140 1355 func_replace_sysroot ()
cannam@140 1356 {
cannam@140 1357 case "$lt_sysroot:$1" in
cannam@140 1358 ?*:"$lt_sysroot"*)
cannam@140 1359 func_stripname "$lt_sysroot" '' "$1"
cannam@140 1360 func_replace_sysroot_result="=$func_stripname_result"
cannam@140 1361 ;;
cannam@140 1362 *)
cannam@140 1363 # Including no sysroot.
cannam@140 1364 func_replace_sysroot_result=$1
cannam@140 1365 ;;
cannam@140 1366 esac
cannam@140 1367 }
cannam@140 1368
cannam@140 1369 # func_infer_tag arg
cannam@140 1370 # Infer tagged configuration to use if any are available and
cannam@140 1371 # if one wasn't chosen via the "--tag" command line option.
cannam@140 1372 # Only attempt this if the compiler in the base compile
cannam@140 1373 # command doesn't match the default compiler.
cannam@140 1374 # arg is usually of the form 'gcc ...'
cannam@140 1375 func_infer_tag ()
cannam@140 1376 {
cannam@140 1377 $opt_debug
cannam@140 1378 if test -n "$available_tags" && test -z "$tagname"; then
cannam@140 1379 CC_quoted=
cannam@140 1380 for arg in $CC; do
cannam@140 1381 func_append_quoted CC_quoted "$arg"
cannam@140 1382 done
cannam@140 1383 CC_expanded=`func_echo_all $CC`
cannam@140 1384 CC_quoted_expanded=`func_echo_all $CC_quoted`
cannam@140 1385 case $@ in
cannam@140 1386 # Blanks in the command may have been stripped by the calling shell,
cannam@140 1387 # but not from the CC environment variable when configure was run.
cannam@140 1388 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
cannam@140 1389 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
cannam@140 1390 # Blanks at the start of $base_compile will cause this to fail
cannam@140 1391 # if we don't check for them as well.
cannam@140 1392 *)
cannam@140 1393 for z in $available_tags; do
cannam@140 1394 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
cannam@140 1395 # Evaluate the configuration.
cannam@140 1396 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
cannam@140 1397 CC_quoted=
cannam@140 1398 for arg in $CC; do
cannam@140 1399 # Double-quote args containing other shell metacharacters.
cannam@140 1400 func_append_quoted CC_quoted "$arg"
cannam@140 1401 done
cannam@140 1402 CC_expanded=`func_echo_all $CC`
cannam@140 1403 CC_quoted_expanded=`func_echo_all $CC_quoted`
cannam@140 1404 case "$@ " in
cannam@140 1405 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
cannam@140 1406 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
cannam@140 1407 # The compiler in the base compile command matches
cannam@140 1408 # the one in the tagged configuration.
cannam@140 1409 # Assume this is the tagged configuration we want.
cannam@140 1410 tagname=$z
cannam@140 1411 break
cannam@140 1412 ;;
cannam@140 1413 esac
cannam@140 1414 fi
cannam@140 1415 done
cannam@140 1416 # If $tagname still isn't set, then no tagged configuration
cannam@140 1417 # was found and let the user know that the "--tag" command
cannam@140 1418 # line option must be used.
cannam@140 1419 if test -z "$tagname"; then
cannam@140 1420 func_echo "unable to infer tagged configuration"
cannam@140 1421 func_fatal_error "specify a tag with \`--tag'"
cannam@140 1422 # else
cannam@140 1423 # func_verbose "using $tagname tagged configuration"
cannam@140 1424 fi
cannam@140 1425 ;;
cannam@140 1426 esac
cannam@140 1427 fi
cannam@140 1428 }
cannam@140 1429
cannam@140 1430
cannam@140 1431
cannam@140 1432 # func_write_libtool_object output_name pic_name nonpic_name
cannam@140 1433 # Create a libtool object file (analogous to a ".la" file),
cannam@140 1434 # but don't create it if we're doing a dry run.
cannam@140 1435 func_write_libtool_object ()
cannam@140 1436 {
cannam@140 1437 write_libobj=${1}
cannam@140 1438 if test "$build_libtool_libs" = yes; then
cannam@140 1439 write_lobj=\'${2}\'
cannam@140 1440 else
cannam@140 1441 write_lobj=none
cannam@140 1442 fi
cannam@140 1443
cannam@140 1444 if test "$build_old_libs" = yes; then
cannam@140 1445 write_oldobj=\'${3}\'
cannam@140 1446 else
cannam@140 1447 write_oldobj=none
cannam@140 1448 fi
cannam@140 1449
cannam@140 1450 $opt_dry_run || {
cannam@140 1451 cat >${write_libobj}T <<EOF
cannam@140 1452 # $write_libobj - a libtool object file
cannam@140 1453 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
cannam@140 1454 #
cannam@140 1455 # Please DO NOT delete this file!
cannam@140 1456 # It is necessary for linking the library.
cannam@140 1457
cannam@140 1458 # Name of the PIC object.
cannam@140 1459 pic_object=$write_lobj
cannam@140 1460
cannam@140 1461 # Name of the non-PIC object
cannam@140 1462 non_pic_object=$write_oldobj
cannam@140 1463
cannam@140 1464 EOF
cannam@140 1465 $MV "${write_libobj}T" "${write_libobj}"
cannam@140 1466 }
cannam@140 1467 }
cannam@140 1468
cannam@140 1469
cannam@140 1470 ##################################################
cannam@140 1471 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
cannam@140 1472 ##################################################
cannam@140 1473
cannam@140 1474 # func_convert_core_file_wine_to_w32 ARG
cannam@140 1475 # Helper function used by file name conversion functions when $build is *nix,
cannam@140 1476 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
cannam@140 1477 # correctly configured wine environment available, with the winepath program
cannam@140 1478 # in $build's $PATH.
cannam@140 1479 #
cannam@140 1480 # ARG is the $build file name to be converted to w32 format.
cannam@140 1481 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
cannam@140 1482 # be empty on error (or when ARG is empty)
cannam@140 1483 func_convert_core_file_wine_to_w32 ()
cannam@140 1484 {
cannam@140 1485 $opt_debug
cannam@140 1486 func_convert_core_file_wine_to_w32_result="$1"
cannam@140 1487 if test -n "$1"; then
cannam@140 1488 # Unfortunately, winepath does not exit with a non-zero error code, so we
cannam@140 1489 # are forced to check the contents of stdout. On the other hand, if the
cannam@140 1490 # command is not found, the shell will set an exit code of 127 and print
cannam@140 1491 # *an error message* to stdout. So we must check for both error code of
cannam@140 1492 # zero AND non-empty stdout, which explains the odd construction:
cannam@140 1493 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
cannam@140 1494 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
cannam@140 1495 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
cannam@140 1496 $SED -e "$lt_sed_naive_backslashify"`
cannam@140 1497 else
cannam@140 1498 func_convert_core_file_wine_to_w32_result=
cannam@140 1499 fi
cannam@140 1500 fi
cannam@140 1501 }
cannam@140 1502 # end: func_convert_core_file_wine_to_w32
cannam@140 1503
cannam@140 1504
cannam@140 1505 # func_convert_core_path_wine_to_w32 ARG
cannam@140 1506 # Helper function used by path conversion functions when $build is *nix, and
cannam@140 1507 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
cannam@140 1508 # configured wine environment available, with the winepath program in $build's
cannam@140 1509 # $PATH. Assumes ARG has no leading or trailing path separator characters.
cannam@140 1510 #
cannam@140 1511 # ARG is path to be converted from $build format to win32.
cannam@140 1512 # Result is available in $func_convert_core_path_wine_to_w32_result.
cannam@140 1513 # Unconvertible file (directory) names in ARG are skipped; if no directory names
cannam@140 1514 # are convertible, then the result may be empty.
cannam@140 1515 func_convert_core_path_wine_to_w32 ()
cannam@140 1516 {
cannam@140 1517 $opt_debug
cannam@140 1518 # unfortunately, winepath doesn't convert paths, only file names
cannam@140 1519 func_convert_core_path_wine_to_w32_result=""
cannam@140 1520 if test -n "$1"; then
cannam@140 1521 oldIFS=$IFS
cannam@140 1522 IFS=:
cannam@140 1523 for func_convert_core_path_wine_to_w32_f in $1; do
cannam@140 1524 IFS=$oldIFS
cannam@140 1525 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
cannam@140 1526 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
cannam@140 1527 if test -z "$func_convert_core_path_wine_to_w32_result"; then
cannam@140 1528 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
cannam@140 1529 else
cannam@140 1530 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
cannam@140 1531 fi
cannam@140 1532 fi
cannam@140 1533 done
cannam@140 1534 IFS=$oldIFS
cannam@140 1535 fi
cannam@140 1536 }
cannam@140 1537 # end: func_convert_core_path_wine_to_w32
cannam@140 1538
cannam@140 1539
cannam@140 1540 # func_cygpath ARGS...
cannam@140 1541 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
cannam@140 1542 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
cannam@140 1543 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
cannam@140 1544 # (2), returns the Cygwin file name or path in func_cygpath_result (input
cannam@140 1545 # file name or path is assumed to be in w32 format, as previously converted
cannam@140 1546 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
cannam@140 1547 # or path in func_cygpath_result (input file name or path is assumed to be in
cannam@140 1548 # Cygwin format). Returns an empty string on error.
cannam@140 1549 #
cannam@140 1550 # ARGS are passed to cygpath, with the last one being the file name or path to
cannam@140 1551 # be converted.
cannam@140 1552 #
cannam@140 1553 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
cannam@140 1554 # environment variable; do not put it in $PATH.
cannam@140 1555 func_cygpath ()
cannam@140 1556 {
cannam@140 1557 $opt_debug
cannam@140 1558 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
cannam@140 1559 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
cannam@140 1560 if test "$?" -ne 0; then
cannam@140 1561 # on failure, ensure result is empty
cannam@140 1562 func_cygpath_result=
cannam@140 1563 fi
cannam@140 1564 else
cannam@140 1565 func_cygpath_result=
cannam@140 1566 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
cannam@140 1567 fi
cannam@140 1568 }
cannam@140 1569 #end: func_cygpath
cannam@140 1570
cannam@140 1571
cannam@140 1572 # func_convert_core_msys_to_w32 ARG
cannam@140 1573 # Convert file name or path ARG from MSYS format to w32 format. Return
cannam@140 1574 # result in func_convert_core_msys_to_w32_result.
cannam@140 1575 func_convert_core_msys_to_w32 ()
cannam@140 1576 {
cannam@140 1577 $opt_debug
cannam@140 1578 # awkward: cmd appends spaces to result
cannam@140 1579 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
cannam@140 1580 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
cannam@140 1581 }
cannam@140 1582 #end: func_convert_core_msys_to_w32
cannam@140 1583
cannam@140 1584
cannam@140 1585 # func_convert_file_check ARG1 ARG2
cannam@140 1586 # Verify that ARG1 (a file name in $build format) was converted to $host
cannam@140 1587 # format in ARG2. Otherwise, emit an error message, but continue (resetting
cannam@140 1588 # func_to_host_file_result to ARG1).
cannam@140 1589 func_convert_file_check ()
cannam@140 1590 {
cannam@140 1591 $opt_debug
cannam@140 1592 if test -z "$2" && test -n "$1" ; then
cannam@140 1593 func_error "Could not determine host file name corresponding to"
cannam@140 1594 func_error " \`$1'"
cannam@140 1595 func_error "Continuing, but uninstalled executables may not work."
cannam@140 1596 # Fallback:
cannam@140 1597 func_to_host_file_result="$1"
cannam@140 1598 fi
cannam@140 1599 }
cannam@140 1600 # end func_convert_file_check
cannam@140 1601
cannam@140 1602
cannam@140 1603 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
cannam@140 1604 # Verify that FROM_PATH (a path in $build format) was converted to $host
cannam@140 1605 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
cannam@140 1606 # func_to_host_file_result to a simplistic fallback value (see below).
cannam@140 1607 func_convert_path_check ()
cannam@140 1608 {
cannam@140 1609 $opt_debug
cannam@140 1610 if test -z "$4" && test -n "$3"; then
cannam@140 1611 func_error "Could not determine the host path corresponding to"
cannam@140 1612 func_error " \`$3'"
cannam@140 1613 func_error "Continuing, but uninstalled executables may not work."
cannam@140 1614 # Fallback. This is a deliberately simplistic "conversion" and
cannam@140 1615 # should not be "improved". See libtool.info.
cannam@140 1616 if test "x$1" != "x$2"; then
cannam@140 1617 lt_replace_pathsep_chars="s|$1|$2|g"
cannam@140 1618 func_to_host_path_result=`echo "$3" |
cannam@140 1619 $SED -e "$lt_replace_pathsep_chars"`
cannam@140 1620 else
cannam@140 1621 func_to_host_path_result="$3"
cannam@140 1622 fi
cannam@140 1623 fi
cannam@140 1624 }
cannam@140 1625 # end func_convert_path_check
cannam@140 1626
cannam@140 1627
cannam@140 1628 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
cannam@140 1629 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
cannam@140 1630 # and appending REPL if ORIG matches BACKPAT.
cannam@140 1631 func_convert_path_front_back_pathsep ()
cannam@140 1632 {
cannam@140 1633 $opt_debug
cannam@140 1634 case $4 in
cannam@140 1635 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
cannam@140 1636 ;;
cannam@140 1637 esac
cannam@140 1638 case $4 in
cannam@140 1639 $2 ) func_append func_to_host_path_result "$3"
cannam@140 1640 ;;
cannam@140 1641 esac
cannam@140 1642 }
cannam@140 1643 # end func_convert_path_front_back_pathsep
cannam@140 1644
cannam@140 1645
cannam@140 1646 ##################################################
cannam@140 1647 # $build to $host FILE NAME CONVERSION FUNCTIONS #
cannam@140 1648 ##################################################
cannam@140 1649 # invoked via `$to_host_file_cmd ARG'
cannam@140 1650 #
cannam@140 1651 # In each case, ARG is the path to be converted from $build to $host format.
cannam@140 1652 # Result will be available in $func_to_host_file_result.
cannam@140 1653
cannam@140 1654
cannam@140 1655 # func_to_host_file ARG
cannam@140 1656 # Converts the file name ARG from $build format to $host format. Return result
cannam@140 1657 # in func_to_host_file_result.
cannam@140 1658 func_to_host_file ()
cannam@140 1659 {
cannam@140 1660 $opt_debug
cannam@140 1661 $to_host_file_cmd "$1"
cannam@140 1662 }
cannam@140 1663 # end func_to_host_file
cannam@140 1664
cannam@140 1665
cannam@140 1666 # func_to_tool_file ARG LAZY
cannam@140 1667 # converts the file name ARG from $build format to toolchain format. Return
cannam@140 1668 # result in func_to_tool_file_result. If the conversion in use is listed
cannam@140 1669 # in (the comma separated) LAZY, no conversion takes place.
cannam@140 1670 func_to_tool_file ()
cannam@140 1671 {
cannam@140 1672 $opt_debug
cannam@140 1673 case ,$2, in
cannam@140 1674 *,"$to_tool_file_cmd",*)
cannam@140 1675 func_to_tool_file_result=$1
cannam@140 1676 ;;
cannam@140 1677 *)
cannam@140 1678 $to_tool_file_cmd "$1"
cannam@140 1679 func_to_tool_file_result=$func_to_host_file_result
cannam@140 1680 ;;
cannam@140 1681 esac
cannam@140 1682 }
cannam@140 1683 # end func_to_tool_file
cannam@140 1684
cannam@140 1685
cannam@140 1686 # func_convert_file_noop ARG
cannam@140 1687 # Copy ARG to func_to_host_file_result.
cannam@140 1688 func_convert_file_noop ()
cannam@140 1689 {
cannam@140 1690 func_to_host_file_result="$1"
cannam@140 1691 }
cannam@140 1692 # end func_convert_file_noop
cannam@140 1693
cannam@140 1694
cannam@140 1695 # func_convert_file_msys_to_w32 ARG
cannam@140 1696 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
cannam@140 1697 # conversion to w32 is not available inside the cwrapper. Returns result in
cannam@140 1698 # func_to_host_file_result.
cannam@140 1699 func_convert_file_msys_to_w32 ()
cannam@140 1700 {
cannam@140 1701 $opt_debug
cannam@140 1702 func_to_host_file_result="$1"
cannam@140 1703 if test -n "$1"; then
cannam@140 1704 func_convert_core_msys_to_w32 "$1"
cannam@140 1705 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
cannam@140 1706 fi
cannam@140 1707 func_convert_file_check "$1" "$func_to_host_file_result"
cannam@140 1708 }
cannam@140 1709 # end func_convert_file_msys_to_w32
cannam@140 1710
cannam@140 1711
cannam@140 1712 # func_convert_file_cygwin_to_w32 ARG
cannam@140 1713 # Convert file name ARG from Cygwin to w32 format. Returns result in
cannam@140 1714 # func_to_host_file_result.
cannam@140 1715 func_convert_file_cygwin_to_w32 ()
cannam@140 1716 {
cannam@140 1717 $opt_debug
cannam@140 1718 func_to_host_file_result="$1"
cannam@140 1719 if test -n "$1"; then
cannam@140 1720 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
cannam@140 1721 # LT_CYGPATH in this case.
cannam@140 1722 func_to_host_file_result=`cygpath -m "$1"`
cannam@140 1723 fi
cannam@140 1724 func_convert_file_check "$1" "$func_to_host_file_result"
cannam@140 1725 }
cannam@140 1726 # end func_convert_file_cygwin_to_w32
cannam@140 1727
cannam@140 1728
cannam@140 1729 # func_convert_file_nix_to_w32 ARG
cannam@140 1730 # Convert file name ARG from *nix to w32 format. Requires a wine environment
cannam@140 1731 # and a working winepath. Returns result in func_to_host_file_result.
cannam@140 1732 func_convert_file_nix_to_w32 ()
cannam@140 1733 {
cannam@140 1734 $opt_debug
cannam@140 1735 func_to_host_file_result="$1"
cannam@140 1736 if test -n "$1"; then
cannam@140 1737 func_convert_core_file_wine_to_w32 "$1"
cannam@140 1738 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
cannam@140 1739 fi
cannam@140 1740 func_convert_file_check "$1" "$func_to_host_file_result"
cannam@140 1741 }
cannam@140 1742 # end func_convert_file_nix_to_w32
cannam@140 1743
cannam@140 1744
cannam@140 1745 # func_convert_file_msys_to_cygwin ARG
cannam@140 1746 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
cannam@140 1747 # Returns result in func_to_host_file_result.
cannam@140 1748 func_convert_file_msys_to_cygwin ()
cannam@140 1749 {
cannam@140 1750 $opt_debug
cannam@140 1751 func_to_host_file_result="$1"
cannam@140 1752 if test -n "$1"; then
cannam@140 1753 func_convert_core_msys_to_w32 "$1"
cannam@140 1754 func_cygpath -u "$func_convert_core_msys_to_w32_result"
cannam@140 1755 func_to_host_file_result="$func_cygpath_result"
cannam@140 1756 fi
cannam@140 1757 func_convert_file_check "$1" "$func_to_host_file_result"
cannam@140 1758 }
cannam@140 1759 # end func_convert_file_msys_to_cygwin
cannam@140 1760
cannam@140 1761
cannam@140 1762 # func_convert_file_nix_to_cygwin ARG
cannam@140 1763 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
cannam@140 1764 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
cannam@140 1765 # in func_to_host_file_result.
cannam@140 1766 func_convert_file_nix_to_cygwin ()
cannam@140 1767 {
cannam@140 1768 $opt_debug
cannam@140 1769 func_to_host_file_result="$1"
cannam@140 1770 if test -n "$1"; then
cannam@140 1771 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
cannam@140 1772 func_convert_core_file_wine_to_w32 "$1"
cannam@140 1773 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
cannam@140 1774 func_to_host_file_result="$func_cygpath_result"
cannam@140 1775 fi
cannam@140 1776 func_convert_file_check "$1" "$func_to_host_file_result"
cannam@140 1777 }
cannam@140 1778 # end func_convert_file_nix_to_cygwin
cannam@140 1779
cannam@140 1780
cannam@140 1781 #############################################
cannam@140 1782 # $build to $host PATH CONVERSION FUNCTIONS #
cannam@140 1783 #############################################
cannam@140 1784 # invoked via `$to_host_path_cmd ARG'
cannam@140 1785 #
cannam@140 1786 # In each case, ARG is the path to be converted from $build to $host format.
cannam@140 1787 # The result will be available in $func_to_host_path_result.
cannam@140 1788 #
cannam@140 1789 # Path separators are also converted from $build format to $host format. If
cannam@140 1790 # ARG begins or ends with a path separator character, it is preserved (but
cannam@140 1791 # converted to $host format) on output.
cannam@140 1792 #
cannam@140 1793 # All path conversion functions are named using the following convention:
cannam@140 1794 # file name conversion function : func_convert_file_X_to_Y ()
cannam@140 1795 # path conversion function : func_convert_path_X_to_Y ()
cannam@140 1796 # where, for any given $build/$host combination the 'X_to_Y' value is the
cannam@140 1797 # same. If conversion functions are added for new $build/$host combinations,
cannam@140 1798 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
cannam@140 1799 # will break.
cannam@140 1800
cannam@140 1801
cannam@140 1802 # func_init_to_host_path_cmd
cannam@140 1803 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
cannam@140 1804 # appropriate value, based on the value of $to_host_file_cmd.
cannam@140 1805 to_host_path_cmd=
cannam@140 1806 func_init_to_host_path_cmd ()
cannam@140 1807 {
cannam@140 1808 $opt_debug
cannam@140 1809 if test -z "$to_host_path_cmd"; then
cannam@140 1810 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
cannam@140 1811 to_host_path_cmd="func_convert_path_${func_stripname_result}"
cannam@140 1812 fi
cannam@140 1813 }
cannam@140 1814
cannam@140 1815
cannam@140 1816 # func_to_host_path ARG
cannam@140 1817 # Converts the path ARG from $build format to $host format. Return result
cannam@140 1818 # in func_to_host_path_result.
cannam@140 1819 func_to_host_path ()
cannam@140 1820 {
cannam@140 1821 $opt_debug
cannam@140 1822 func_init_to_host_path_cmd
cannam@140 1823 $to_host_path_cmd "$1"
cannam@140 1824 }
cannam@140 1825 # end func_to_host_path
cannam@140 1826
cannam@140 1827
cannam@140 1828 # func_convert_path_noop ARG
cannam@140 1829 # Copy ARG to func_to_host_path_result.
cannam@140 1830 func_convert_path_noop ()
cannam@140 1831 {
cannam@140 1832 func_to_host_path_result="$1"
cannam@140 1833 }
cannam@140 1834 # end func_convert_path_noop
cannam@140 1835
cannam@140 1836
cannam@140 1837 # func_convert_path_msys_to_w32 ARG
cannam@140 1838 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
cannam@140 1839 # conversion to w32 is not available inside the cwrapper. Returns result in
cannam@140 1840 # func_to_host_path_result.
cannam@140 1841 func_convert_path_msys_to_w32 ()
cannam@140 1842 {
cannam@140 1843 $opt_debug
cannam@140 1844 func_to_host_path_result="$1"
cannam@140 1845 if test -n "$1"; then
cannam@140 1846 # Remove leading and trailing path separator characters from ARG. MSYS
cannam@140 1847 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
cannam@140 1848 # and winepath ignores them completely.
cannam@140 1849 func_stripname : : "$1"
cannam@140 1850 func_to_host_path_tmp1=$func_stripname_result
cannam@140 1851 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
cannam@140 1852 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
cannam@140 1853 func_convert_path_check : ";" \
cannam@140 1854 "$func_to_host_path_tmp1" "$func_to_host_path_result"
cannam@140 1855 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
cannam@140 1856 fi
cannam@140 1857 }
cannam@140 1858 # end func_convert_path_msys_to_w32
cannam@140 1859
cannam@140 1860
cannam@140 1861 # func_convert_path_cygwin_to_w32 ARG
cannam@140 1862 # Convert path ARG from Cygwin to w32 format. Returns result in
cannam@140 1863 # func_to_host_file_result.
cannam@140 1864 func_convert_path_cygwin_to_w32 ()
cannam@140 1865 {
cannam@140 1866 $opt_debug
cannam@140 1867 func_to_host_path_result="$1"
cannam@140 1868 if test -n "$1"; then
cannam@140 1869 # See func_convert_path_msys_to_w32:
cannam@140 1870 func_stripname : : "$1"
cannam@140 1871 func_to_host_path_tmp1=$func_stripname_result
cannam@140 1872 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
cannam@140 1873 func_convert_path_check : ";" \
cannam@140 1874 "$func_to_host_path_tmp1" "$func_to_host_path_result"
cannam@140 1875 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
cannam@140 1876 fi
cannam@140 1877 }
cannam@140 1878 # end func_convert_path_cygwin_to_w32
cannam@140 1879
cannam@140 1880
cannam@140 1881 # func_convert_path_nix_to_w32 ARG
cannam@140 1882 # Convert path ARG from *nix to w32 format. Requires a wine environment and
cannam@140 1883 # a working winepath. Returns result in func_to_host_file_result.
cannam@140 1884 func_convert_path_nix_to_w32 ()
cannam@140 1885 {
cannam@140 1886 $opt_debug
cannam@140 1887 func_to_host_path_result="$1"
cannam@140 1888 if test -n "$1"; then
cannam@140 1889 # See func_convert_path_msys_to_w32:
cannam@140 1890 func_stripname : : "$1"
cannam@140 1891 func_to_host_path_tmp1=$func_stripname_result
cannam@140 1892 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
cannam@140 1893 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
cannam@140 1894 func_convert_path_check : ";" \
cannam@140 1895 "$func_to_host_path_tmp1" "$func_to_host_path_result"
cannam@140 1896 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
cannam@140 1897 fi
cannam@140 1898 }
cannam@140 1899 # end func_convert_path_nix_to_w32
cannam@140 1900
cannam@140 1901
cannam@140 1902 # func_convert_path_msys_to_cygwin ARG
cannam@140 1903 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
cannam@140 1904 # Returns result in func_to_host_file_result.
cannam@140 1905 func_convert_path_msys_to_cygwin ()
cannam@140 1906 {
cannam@140 1907 $opt_debug
cannam@140 1908 func_to_host_path_result="$1"
cannam@140 1909 if test -n "$1"; then
cannam@140 1910 # See func_convert_path_msys_to_w32:
cannam@140 1911 func_stripname : : "$1"
cannam@140 1912 func_to_host_path_tmp1=$func_stripname_result
cannam@140 1913 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
cannam@140 1914 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
cannam@140 1915 func_to_host_path_result="$func_cygpath_result"
cannam@140 1916 func_convert_path_check : : \
cannam@140 1917 "$func_to_host_path_tmp1" "$func_to_host_path_result"
cannam@140 1918 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
cannam@140 1919 fi
cannam@140 1920 }
cannam@140 1921 # end func_convert_path_msys_to_cygwin
cannam@140 1922
cannam@140 1923
cannam@140 1924 # func_convert_path_nix_to_cygwin ARG
cannam@140 1925 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
cannam@140 1926 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
cannam@140 1927 # func_to_host_file_result.
cannam@140 1928 func_convert_path_nix_to_cygwin ()
cannam@140 1929 {
cannam@140 1930 $opt_debug
cannam@140 1931 func_to_host_path_result="$1"
cannam@140 1932 if test -n "$1"; then
cannam@140 1933 # Remove leading and trailing path separator characters from
cannam@140 1934 # ARG. msys behavior is inconsistent here, cygpath turns them
cannam@140 1935 # into '.;' and ';.', and winepath ignores them completely.
cannam@140 1936 func_stripname : : "$1"
cannam@140 1937 func_to_host_path_tmp1=$func_stripname_result
cannam@140 1938 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
cannam@140 1939 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
cannam@140 1940 func_to_host_path_result="$func_cygpath_result"
cannam@140 1941 func_convert_path_check : : \
cannam@140 1942 "$func_to_host_path_tmp1" "$func_to_host_path_result"
cannam@140 1943 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
cannam@140 1944 fi
cannam@140 1945 }
cannam@140 1946 # end func_convert_path_nix_to_cygwin
cannam@140 1947
cannam@140 1948
cannam@140 1949 # func_mode_compile arg...
cannam@140 1950 func_mode_compile ()
cannam@140 1951 {
cannam@140 1952 $opt_debug
cannam@140 1953 # Get the compilation command and the source file.
cannam@140 1954 base_compile=
cannam@140 1955 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
cannam@140 1956 suppress_opt=yes
cannam@140 1957 suppress_output=
cannam@140 1958 arg_mode=normal
cannam@140 1959 libobj=
cannam@140 1960 later=
cannam@140 1961 pie_flag=
cannam@140 1962
cannam@140 1963 for arg
cannam@140 1964 do
cannam@140 1965 case $arg_mode in
cannam@140 1966 arg )
cannam@140 1967 # do not "continue". Instead, add this to base_compile
cannam@140 1968 lastarg="$arg"
cannam@140 1969 arg_mode=normal
cannam@140 1970 ;;
cannam@140 1971
cannam@140 1972 target )
cannam@140 1973 libobj="$arg"
cannam@140 1974 arg_mode=normal
cannam@140 1975 continue
cannam@140 1976 ;;
cannam@140 1977
cannam@140 1978 normal )
cannam@140 1979 # Accept any command-line options.
cannam@140 1980 case $arg in
cannam@140 1981 -o)
cannam@140 1982 test -n "$libobj" && \
cannam@140 1983 func_fatal_error "you cannot specify \`-o' more than once"
cannam@140 1984 arg_mode=target
cannam@140 1985 continue
cannam@140 1986 ;;
cannam@140 1987
cannam@140 1988 -pie | -fpie | -fPIE)
cannam@140 1989 func_append pie_flag " $arg"
cannam@140 1990 continue
cannam@140 1991 ;;
cannam@140 1992
cannam@140 1993 -shared | -static | -prefer-pic | -prefer-non-pic)
cannam@140 1994 func_append later " $arg"
cannam@140 1995 continue
cannam@140 1996 ;;
cannam@140 1997
cannam@140 1998 -no-suppress)
cannam@140 1999 suppress_opt=no
cannam@140 2000 continue
cannam@140 2001 ;;
cannam@140 2002
cannam@140 2003 -Xcompiler)
cannam@140 2004 arg_mode=arg # the next one goes into the "base_compile" arg list
cannam@140 2005 continue # The current "srcfile" will either be retained or
cannam@140 2006 ;; # replaced later. I would guess that would be a bug.
cannam@140 2007
cannam@140 2008 -Wc,*)
cannam@140 2009 func_stripname '-Wc,' '' "$arg"
cannam@140 2010 args=$func_stripname_result
cannam@140 2011 lastarg=
cannam@140 2012 save_ifs="$IFS"; IFS=','
cannam@140 2013 for arg in $args; do
cannam@140 2014 IFS="$save_ifs"
cannam@140 2015 func_append_quoted lastarg "$arg"
cannam@140 2016 done
cannam@140 2017 IFS="$save_ifs"
cannam@140 2018 func_stripname ' ' '' "$lastarg"
cannam@140 2019 lastarg=$func_stripname_result
cannam@140 2020
cannam@140 2021 # Add the arguments to base_compile.
cannam@140 2022 func_append base_compile " $lastarg"
cannam@140 2023 continue
cannam@140 2024 ;;
cannam@140 2025
cannam@140 2026 *)
cannam@140 2027 # Accept the current argument as the source file.
cannam@140 2028 # The previous "srcfile" becomes the current argument.
cannam@140 2029 #
cannam@140 2030 lastarg="$srcfile"
cannam@140 2031 srcfile="$arg"
cannam@140 2032 ;;
cannam@140 2033 esac # case $arg
cannam@140 2034 ;;
cannam@140 2035 esac # case $arg_mode
cannam@140 2036
cannam@140 2037 # Aesthetically quote the previous argument.
cannam@140 2038 func_append_quoted base_compile "$lastarg"
cannam@140 2039 done # for arg
cannam@140 2040
cannam@140 2041 case $arg_mode in
cannam@140 2042 arg)
cannam@140 2043 func_fatal_error "you must specify an argument for -Xcompile"
cannam@140 2044 ;;
cannam@140 2045 target)
cannam@140 2046 func_fatal_error "you must specify a target with \`-o'"
cannam@140 2047 ;;
cannam@140 2048 *)
cannam@140 2049 # Get the name of the library object.
cannam@140 2050 test -z "$libobj" && {
cannam@140 2051 func_basename "$srcfile"
cannam@140 2052 libobj="$func_basename_result"
cannam@140 2053 }
cannam@140 2054 ;;
cannam@140 2055 esac
cannam@140 2056
cannam@140 2057 # Recognize several different file suffixes.
cannam@140 2058 # If the user specifies -o file.o, it is replaced with file.lo
cannam@140 2059 case $libobj in
cannam@140 2060 *.[cCFSifmso] | \
cannam@140 2061 *.ada | *.adb | *.ads | *.asm | \
cannam@140 2062 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
cannam@140 2063 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
cannam@140 2064 func_xform "$libobj"
cannam@140 2065 libobj=$func_xform_result
cannam@140 2066 ;;
cannam@140 2067 esac
cannam@140 2068
cannam@140 2069 case $libobj in
cannam@140 2070 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
cannam@140 2071 *)
cannam@140 2072 func_fatal_error "cannot determine name of library object from \`$libobj'"
cannam@140 2073 ;;
cannam@140 2074 esac
cannam@140 2075
cannam@140 2076 func_infer_tag $base_compile
cannam@140 2077
cannam@140 2078 for arg in $later; do
cannam@140 2079 case $arg in
cannam@140 2080 -shared)
cannam@140 2081 test "$build_libtool_libs" != yes && \
cannam@140 2082 func_fatal_configuration "can not build a shared library"
cannam@140 2083 build_old_libs=no
cannam@140 2084 continue
cannam@140 2085 ;;
cannam@140 2086
cannam@140 2087 -static)
cannam@140 2088 build_libtool_libs=no
cannam@140 2089 build_old_libs=yes
cannam@140 2090 continue
cannam@140 2091 ;;
cannam@140 2092
cannam@140 2093 -prefer-pic)
cannam@140 2094 pic_mode=yes
cannam@140 2095 continue
cannam@140 2096 ;;
cannam@140 2097
cannam@140 2098 -prefer-non-pic)
cannam@140 2099 pic_mode=no
cannam@140 2100 continue
cannam@140 2101 ;;
cannam@140 2102 esac
cannam@140 2103 done
cannam@140 2104
cannam@140 2105 func_quote_for_eval "$libobj"
cannam@140 2106 test "X$libobj" != "X$func_quote_for_eval_result" \
cannam@140 2107 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
cannam@140 2108 && func_warning "libobj name \`$libobj' may not contain shell special characters."
cannam@140 2109 func_dirname_and_basename "$obj" "/" ""
cannam@140 2110 objname="$func_basename_result"
cannam@140 2111 xdir="$func_dirname_result"
cannam@140 2112 lobj=${xdir}$objdir/$objname
cannam@140 2113
cannam@140 2114 test -z "$base_compile" && \
cannam@140 2115 func_fatal_help "you must specify a compilation command"
cannam@140 2116
cannam@140 2117 # Delete any leftover library objects.
cannam@140 2118 if test "$build_old_libs" = yes; then
cannam@140 2119 removelist="$obj $lobj $libobj ${libobj}T"
cannam@140 2120 else
cannam@140 2121 removelist="$lobj $libobj ${libobj}T"
cannam@140 2122 fi
cannam@140 2123
cannam@140 2124 # On Cygwin there's no "real" PIC flag so we must build both object types
cannam@140 2125 case $host_os in
cannam@140 2126 cygwin* | mingw* | pw32* | os2* | cegcc*)
cannam@140 2127 pic_mode=default
cannam@140 2128 ;;
cannam@140 2129 esac
cannam@140 2130 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
cannam@140 2131 # non-PIC code in shared libraries is not supported
cannam@140 2132 pic_mode=default
cannam@140 2133 fi
cannam@140 2134
cannam@140 2135 # Calculate the filename of the output object if compiler does
cannam@140 2136 # not support -o with -c
cannam@140 2137 if test "$compiler_c_o" = no; then
cannam@140 2138 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
cannam@140 2139 lockfile="$output_obj.lock"
cannam@140 2140 else
cannam@140 2141 output_obj=
cannam@140 2142 need_locks=no
cannam@140 2143 lockfile=
cannam@140 2144 fi
cannam@140 2145
cannam@140 2146 # Lock this critical section if it is needed
cannam@140 2147 # We use this script file to make the link, it avoids creating a new file
cannam@140 2148 if test "$need_locks" = yes; then
cannam@140 2149 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
cannam@140 2150 func_echo "Waiting for $lockfile to be removed"
cannam@140 2151 sleep 2
cannam@140 2152 done
cannam@140 2153 elif test "$need_locks" = warn; then
cannam@140 2154 if test -f "$lockfile"; then
cannam@140 2155 $ECHO "\
cannam@140 2156 *** ERROR, $lockfile exists and contains:
cannam@140 2157 `cat $lockfile 2>/dev/null`
cannam@140 2158
cannam@140 2159 This indicates that another process is trying to use the same
cannam@140 2160 temporary object file, and libtool could not work around it because
cannam@140 2161 your compiler does not support \`-c' and \`-o' together. If you
cannam@140 2162 repeat this compilation, it may succeed, by chance, but you had better
cannam@140 2163 avoid parallel builds (make -j) in this platform, or get a better
cannam@140 2164 compiler."
cannam@140 2165
cannam@140 2166 $opt_dry_run || $RM $removelist
cannam@140 2167 exit $EXIT_FAILURE
cannam@140 2168 fi
cannam@140 2169 func_append removelist " $output_obj"
cannam@140 2170 $ECHO "$srcfile" > "$lockfile"
cannam@140 2171 fi
cannam@140 2172
cannam@140 2173 $opt_dry_run || $RM $removelist
cannam@140 2174 func_append removelist " $lockfile"
cannam@140 2175 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
cannam@140 2176
cannam@140 2177 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
cannam@140 2178 srcfile=$func_to_tool_file_result
cannam@140 2179 func_quote_for_eval "$srcfile"
cannam@140 2180 qsrcfile=$func_quote_for_eval_result
cannam@140 2181
cannam@140 2182 # Only build a PIC object if we are building libtool libraries.
cannam@140 2183 if test "$build_libtool_libs" = yes; then
cannam@140 2184 # Without this assignment, base_compile gets emptied.
cannam@140 2185 fbsd_hideous_sh_bug=$base_compile
cannam@140 2186
cannam@140 2187 if test "$pic_mode" != no; then
cannam@140 2188 command="$base_compile $qsrcfile $pic_flag"
cannam@140 2189 else
cannam@140 2190 # Don't build PIC code
cannam@140 2191 command="$base_compile $qsrcfile"
cannam@140 2192 fi
cannam@140 2193
cannam@140 2194 func_mkdir_p "$xdir$objdir"
cannam@140 2195
cannam@140 2196 if test -z "$output_obj"; then
cannam@140 2197 # Place PIC objects in $objdir
cannam@140 2198 func_append command " -o $lobj"
cannam@140 2199 fi
cannam@140 2200
cannam@140 2201 func_show_eval_locale "$command" \
cannam@140 2202 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
cannam@140 2203
cannam@140 2204 if test "$need_locks" = warn &&
cannam@140 2205 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
cannam@140 2206 $ECHO "\
cannam@140 2207 *** ERROR, $lockfile contains:
cannam@140 2208 `cat $lockfile 2>/dev/null`
cannam@140 2209
cannam@140 2210 but it should contain:
cannam@140 2211 $srcfile
cannam@140 2212
cannam@140 2213 This indicates that another process is trying to use the same
cannam@140 2214 temporary object file, and libtool could not work around it because
cannam@140 2215 your compiler does not support \`-c' and \`-o' together. If you
cannam@140 2216 repeat this compilation, it may succeed, by chance, but you had better
cannam@140 2217 avoid parallel builds (make -j) in this platform, or get a better
cannam@140 2218 compiler."
cannam@140 2219
cannam@140 2220 $opt_dry_run || $RM $removelist
cannam@140 2221 exit $EXIT_FAILURE
cannam@140 2222 fi
cannam@140 2223
cannam@140 2224 # Just move the object if needed, then go on to compile the next one
cannam@140 2225 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
cannam@140 2226 func_show_eval '$MV "$output_obj" "$lobj"' \
cannam@140 2227 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
cannam@140 2228 fi
cannam@140 2229
cannam@140 2230 # Allow error messages only from the first compilation.
cannam@140 2231 if test "$suppress_opt" = yes; then
cannam@140 2232 suppress_output=' >/dev/null 2>&1'
cannam@140 2233 fi
cannam@140 2234 fi
cannam@140 2235
cannam@140 2236 # Only build a position-dependent object if we build old libraries.
cannam@140 2237 if test "$build_old_libs" = yes; then
cannam@140 2238 if test "$pic_mode" != yes; then
cannam@140 2239 # Don't build PIC code
cannam@140 2240 command="$base_compile $qsrcfile$pie_flag"
cannam@140 2241 else
cannam@140 2242 command="$base_compile $qsrcfile $pic_flag"
cannam@140 2243 fi
cannam@140 2244 if test "$compiler_c_o" = yes; then
cannam@140 2245 func_append command " -o $obj"
cannam@140 2246 fi
cannam@140 2247
cannam@140 2248 # Suppress compiler output if we already did a PIC compilation.
cannam@140 2249 func_append command "$suppress_output"
cannam@140 2250 func_show_eval_locale "$command" \
cannam@140 2251 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
cannam@140 2252
cannam@140 2253 if test "$need_locks" = warn &&
cannam@140 2254 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
cannam@140 2255 $ECHO "\
cannam@140 2256 *** ERROR, $lockfile contains:
cannam@140 2257 `cat $lockfile 2>/dev/null`
cannam@140 2258
cannam@140 2259 but it should contain:
cannam@140 2260 $srcfile
cannam@140 2261
cannam@140 2262 This indicates that another process is trying to use the same
cannam@140 2263 temporary object file, and libtool could not work around it because
cannam@140 2264 your compiler does not support \`-c' and \`-o' together. If you
cannam@140 2265 repeat this compilation, it may succeed, by chance, but you had better
cannam@140 2266 avoid parallel builds (make -j) in this platform, or get a better
cannam@140 2267 compiler."
cannam@140 2268
cannam@140 2269 $opt_dry_run || $RM $removelist
cannam@140 2270 exit $EXIT_FAILURE
cannam@140 2271 fi
cannam@140 2272
cannam@140 2273 # Just move the object if needed
cannam@140 2274 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
cannam@140 2275 func_show_eval '$MV "$output_obj" "$obj"' \
cannam@140 2276 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
cannam@140 2277 fi
cannam@140 2278 fi
cannam@140 2279
cannam@140 2280 $opt_dry_run || {
cannam@140 2281 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
cannam@140 2282
cannam@140 2283 # Unlock the critical section if it was locked
cannam@140 2284 if test "$need_locks" != no; then
cannam@140 2285 removelist=$lockfile
cannam@140 2286 $RM "$lockfile"
cannam@140 2287 fi
cannam@140 2288 }
cannam@140 2289
cannam@140 2290 exit $EXIT_SUCCESS
cannam@140 2291 }
cannam@140 2292
cannam@140 2293 $opt_help || {
cannam@140 2294 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
cannam@140 2295 }
cannam@140 2296
cannam@140 2297 func_mode_help ()
cannam@140 2298 {
cannam@140 2299 # We need to display help for each of the modes.
cannam@140 2300 case $opt_mode in
cannam@140 2301 "")
cannam@140 2302 # Generic help is extracted from the usage comments
cannam@140 2303 # at the start of this file.
cannam@140 2304 func_help
cannam@140 2305 ;;
cannam@140 2306
cannam@140 2307 clean)
cannam@140 2308 $ECHO \
cannam@140 2309 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
cannam@140 2310
cannam@140 2311 Remove files from the build directory.
cannam@140 2312
cannam@140 2313 RM is the name of the program to use to delete files associated with each FILE
cannam@140 2314 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
cannam@140 2315 to RM.
cannam@140 2316
cannam@140 2317 If FILE is a libtool library, object or program, all the files associated
cannam@140 2318 with it are deleted. Otherwise, only FILE itself is deleted using RM."
cannam@140 2319 ;;
cannam@140 2320
cannam@140 2321 compile)
cannam@140 2322 $ECHO \
cannam@140 2323 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
cannam@140 2324
cannam@140 2325 Compile a source file into a libtool library object.
cannam@140 2326
cannam@140 2327 This mode accepts the following additional options:
cannam@140 2328
cannam@140 2329 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
cannam@140 2330 -no-suppress do not suppress compiler output for multiple passes
cannam@140 2331 -prefer-pic try to build PIC objects only
cannam@140 2332 -prefer-non-pic try to build non-PIC objects only
cannam@140 2333 -shared do not build a \`.o' file suitable for static linking
cannam@140 2334 -static only build a \`.o' file suitable for static linking
cannam@140 2335 -Wc,FLAG pass FLAG directly to the compiler
cannam@140 2336
cannam@140 2337 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
cannam@140 2338 from the given SOURCEFILE.
cannam@140 2339
cannam@140 2340 The output file name is determined by removing the directory component from
cannam@140 2341 SOURCEFILE, then substituting the C source code suffix \`.c' with the
cannam@140 2342 library object suffix, \`.lo'."
cannam@140 2343 ;;
cannam@140 2344
cannam@140 2345 execute)
cannam@140 2346 $ECHO \
cannam@140 2347 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
cannam@140 2348
cannam@140 2349 Automatically set library path, then run a program.
cannam@140 2350
cannam@140 2351 This mode accepts the following additional options:
cannam@140 2352
cannam@140 2353 -dlopen FILE add the directory containing FILE to the library path
cannam@140 2354
cannam@140 2355 This mode sets the library path environment variable according to \`-dlopen'
cannam@140 2356 flags.
cannam@140 2357
cannam@140 2358 If any of the ARGS are libtool executable wrappers, then they are translated
cannam@140 2359 into their corresponding uninstalled binary, and any of their required library
cannam@140 2360 directories are added to the library path.
cannam@140 2361
cannam@140 2362 Then, COMMAND is executed, with ARGS as arguments."
cannam@140 2363 ;;
cannam@140 2364
cannam@140 2365 finish)
cannam@140 2366 $ECHO \
cannam@140 2367 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
cannam@140 2368
cannam@140 2369 Complete the installation of libtool libraries.
cannam@140 2370
cannam@140 2371 Each LIBDIR is a directory that contains libtool libraries.
cannam@140 2372
cannam@140 2373 The commands that this mode executes may require superuser privileges. Use
cannam@140 2374 the \`--dry-run' option if you just want to see what would be executed."
cannam@140 2375 ;;
cannam@140 2376
cannam@140 2377 install)
cannam@140 2378 $ECHO \
cannam@140 2379 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
cannam@140 2380
cannam@140 2381 Install executables or libraries.
cannam@140 2382
cannam@140 2383 INSTALL-COMMAND is the installation command. The first component should be
cannam@140 2384 either the \`install' or \`cp' program.
cannam@140 2385
cannam@140 2386 The following components of INSTALL-COMMAND are treated specially:
cannam@140 2387
cannam@140 2388 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
cannam@140 2389
cannam@140 2390 The rest of the components are interpreted as arguments to that command (only
cannam@140 2391 BSD-compatible install options are recognized)."
cannam@140 2392 ;;
cannam@140 2393
cannam@140 2394 link)
cannam@140 2395 $ECHO \
cannam@140 2396 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
cannam@140 2397
cannam@140 2398 Link object files or libraries together to form another library, or to
cannam@140 2399 create an executable program.
cannam@140 2400
cannam@140 2401 LINK-COMMAND is a command using the C compiler that you would use to create
cannam@140 2402 a program from several object files.
cannam@140 2403
cannam@140 2404 The following components of LINK-COMMAND are treated specially:
cannam@140 2405
cannam@140 2406 -all-static do not do any dynamic linking at all
cannam@140 2407 -avoid-version do not add a version suffix if possible
cannam@140 2408 -bindir BINDIR specify path to binaries directory (for systems where
cannam@140 2409 libraries must be found in the PATH setting at runtime)
cannam@140 2410 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
cannam@140 2411 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
cannam@140 2412 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
cannam@140 2413 -export-symbols SYMFILE
cannam@140 2414 try to export only the symbols listed in SYMFILE
cannam@140 2415 -export-symbols-regex REGEX
cannam@140 2416 try to export only the symbols matching REGEX
cannam@140 2417 -LLIBDIR search LIBDIR for required installed libraries
cannam@140 2418 -lNAME OUTPUT-FILE requires the installed library libNAME
cannam@140 2419 -module build a library that can dlopened
cannam@140 2420 -no-fast-install disable the fast-install mode
cannam@140 2421 -no-install link a not-installable executable
cannam@140 2422 -no-undefined declare that a library does not refer to external symbols
cannam@140 2423 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
cannam@140 2424 -objectlist FILE Use a list of object files found in FILE to specify objects
cannam@140 2425 -precious-files-regex REGEX
cannam@140 2426 don't remove output files matching REGEX
cannam@140 2427 -release RELEASE specify package release information
cannam@140 2428 -rpath LIBDIR the created library will eventually be installed in LIBDIR
cannam@140 2429 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
cannam@140 2430 -shared only do dynamic linking of libtool libraries
cannam@140 2431 -shrext SUFFIX override the standard shared library file extension
cannam@140 2432 -static do not do any dynamic linking of uninstalled libtool libraries
cannam@140 2433 -static-libtool-libs
cannam@140 2434 do not do any dynamic linking of libtool libraries
cannam@140 2435 -version-info CURRENT[:REVISION[:AGE]]
cannam@140 2436 specify library version info [each variable defaults to 0]
cannam@140 2437 -weak LIBNAME declare that the target provides the LIBNAME interface
cannam@140 2438 -Wc,FLAG
cannam@140 2439 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
cannam@140 2440 -Wl,FLAG
cannam@140 2441 -Xlinker FLAG pass linker-specific FLAG directly to the linker
cannam@140 2442 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
cannam@140 2443
cannam@140 2444 All other options (arguments beginning with \`-') are ignored.
cannam@140 2445
cannam@140 2446 Every other argument is treated as a filename. Files ending in \`.la' are
cannam@140 2447 treated as uninstalled libtool libraries, other files are standard or library
cannam@140 2448 object files.
cannam@140 2449
cannam@140 2450 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
cannam@140 2451 only library objects (\`.lo' files) may be specified, and \`-rpath' is
cannam@140 2452 required, except when creating a convenience library.
cannam@140 2453
cannam@140 2454 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
cannam@140 2455 using \`ar' and \`ranlib', or on Windows using \`lib'.
cannam@140 2456
cannam@140 2457 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
cannam@140 2458 is created, otherwise an executable program is created."
cannam@140 2459 ;;
cannam@140 2460
cannam@140 2461 uninstall)
cannam@140 2462 $ECHO \
cannam@140 2463 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
cannam@140 2464
cannam@140 2465 Remove libraries from an installation directory.
cannam@140 2466
cannam@140 2467 RM is the name of the program to use to delete files associated with each FILE
cannam@140 2468 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
cannam@140 2469 to RM.
cannam@140 2470
cannam@140 2471 If FILE is a libtool library, all the files associated with it are deleted.
cannam@140 2472 Otherwise, only FILE itself is deleted using RM."
cannam@140 2473 ;;
cannam@140 2474
cannam@140 2475 *)
cannam@140 2476 func_fatal_help "invalid operation mode \`$opt_mode'"
cannam@140 2477 ;;
cannam@140 2478 esac
cannam@140 2479
cannam@140 2480 echo
cannam@140 2481 $ECHO "Try \`$progname --help' for more information about other modes."
cannam@140 2482 }
cannam@140 2483
cannam@140 2484 # Now that we've collected a possible --mode arg, show help if necessary
cannam@140 2485 if $opt_help; then
cannam@140 2486 if test "$opt_help" = :; then
cannam@140 2487 func_mode_help
cannam@140 2488 else
cannam@140 2489 {
cannam@140 2490 func_help noexit
cannam@140 2491 for opt_mode in compile link execute install finish uninstall clean; do
cannam@140 2492 func_mode_help
cannam@140 2493 done
cannam@140 2494 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
cannam@140 2495 {
cannam@140 2496 func_help noexit
cannam@140 2497 for opt_mode in compile link execute install finish uninstall clean; do
cannam@140 2498 echo
cannam@140 2499 func_mode_help
cannam@140 2500 done
cannam@140 2501 } |
cannam@140 2502 sed '1d
cannam@140 2503 /^When reporting/,/^Report/{
cannam@140 2504 H
cannam@140 2505 d
cannam@140 2506 }
cannam@140 2507 $x
cannam@140 2508 /information about other modes/d
cannam@140 2509 /more detailed .*MODE/d
cannam@140 2510 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
cannam@140 2511 fi
cannam@140 2512 exit $?
cannam@140 2513 fi
cannam@140 2514
cannam@140 2515
cannam@140 2516 # func_mode_execute arg...
cannam@140 2517 func_mode_execute ()
cannam@140 2518 {
cannam@140 2519 $opt_debug
cannam@140 2520 # The first argument is the command name.
cannam@140 2521 cmd="$nonopt"
cannam@140 2522 test -z "$cmd" && \
cannam@140 2523 func_fatal_help "you must specify a COMMAND"
cannam@140 2524
cannam@140 2525 # Handle -dlopen flags immediately.
cannam@140 2526 for file in $opt_dlopen; do
cannam@140 2527 test -f "$file" \
cannam@140 2528 || func_fatal_help "\`$file' is not a file"
cannam@140 2529
cannam@140 2530 dir=
cannam@140 2531 case $file in
cannam@140 2532 *.la)
cannam@140 2533 func_resolve_sysroot "$file"
cannam@140 2534 file=$func_resolve_sysroot_result
cannam@140 2535
cannam@140 2536 # Check to see that this really is a libtool archive.
cannam@140 2537 func_lalib_unsafe_p "$file" \
cannam@140 2538 || func_fatal_help "\`$lib' is not a valid libtool archive"
cannam@140 2539
cannam@140 2540 # Read the libtool library.
cannam@140 2541 dlname=
cannam@140 2542 library_names=
cannam@140 2543 func_source "$file"
cannam@140 2544
cannam@140 2545 # Skip this library if it cannot be dlopened.
cannam@140 2546 if test -z "$dlname"; then
cannam@140 2547 # Warn if it was a shared library.
cannam@140 2548 test -n "$library_names" && \
cannam@140 2549 func_warning "\`$file' was not linked with \`-export-dynamic'"
cannam@140 2550 continue
cannam@140 2551 fi
cannam@140 2552
cannam@140 2553 func_dirname "$file" "" "."
cannam@140 2554 dir="$func_dirname_result"
cannam@140 2555
cannam@140 2556 if test -f "$dir/$objdir/$dlname"; then
cannam@140 2557 func_append dir "/$objdir"
cannam@140 2558 else
cannam@140 2559 if test ! -f "$dir/$dlname"; then
cannam@140 2560 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
cannam@140 2561 fi
cannam@140 2562 fi
cannam@140 2563 ;;
cannam@140 2564
cannam@140 2565 *.lo)
cannam@140 2566 # Just add the directory containing the .lo file.
cannam@140 2567 func_dirname "$file" "" "."
cannam@140 2568 dir="$func_dirname_result"
cannam@140 2569 ;;
cannam@140 2570
cannam@140 2571 *)
cannam@140 2572 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
cannam@140 2573 continue
cannam@140 2574 ;;
cannam@140 2575 esac
cannam@140 2576
cannam@140 2577 # Get the absolute pathname.
cannam@140 2578 absdir=`cd "$dir" && pwd`
cannam@140 2579 test -n "$absdir" && dir="$absdir"
cannam@140 2580
cannam@140 2581 # Now add the directory to shlibpath_var.
cannam@140 2582 if eval "test -z \"\$$shlibpath_var\""; then
cannam@140 2583 eval "$shlibpath_var=\"\$dir\""
cannam@140 2584 else
cannam@140 2585 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
cannam@140 2586 fi
cannam@140 2587 done
cannam@140 2588
cannam@140 2589 # This variable tells wrapper scripts just to set shlibpath_var
cannam@140 2590 # rather than running their programs.
cannam@140 2591 libtool_execute_magic="$magic"
cannam@140 2592
cannam@140 2593 # Check if any of the arguments is a wrapper script.
cannam@140 2594 args=
cannam@140 2595 for file
cannam@140 2596 do
cannam@140 2597 case $file in
cannam@140 2598 -* | *.la | *.lo ) ;;
cannam@140 2599 *)
cannam@140 2600 # Do a test to see if this is really a libtool program.
cannam@140 2601 if func_ltwrapper_script_p "$file"; then
cannam@140 2602 func_source "$file"
cannam@140 2603 # Transform arg to wrapped name.
cannam@140 2604 file="$progdir/$program"
cannam@140 2605 elif func_ltwrapper_executable_p "$file"; then
cannam@140 2606 func_ltwrapper_scriptname "$file"
cannam@140 2607 func_source "$func_ltwrapper_scriptname_result"
cannam@140 2608 # Transform arg to wrapped name.
cannam@140 2609 file="$progdir/$program"
cannam@140 2610 fi
cannam@140 2611 ;;
cannam@140 2612 esac
cannam@140 2613 # Quote arguments (to preserve shell metacharacters).
cannam@140 2614 func_append_quoted args "$file"
cannam@140 2615 done
cannam@140 2616
cannam@140 2617 if test "X$opt_dry_run" = Xfalse; then
cannam@140 2618 if test -n "$shlibpath_var"; then
cannam@140 2619 # Export the shlibpath_var.
cannam@140 2620 eval "export $shlibpath_var"
cannam@140 2621 fi
cannam@140 2622
cannam@140 2623 # Restore saved environment variables
cannam@140 2624 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
cannam@140 2625 do
cannam@140 2626 eval "if test \"\${save_$lt_var+set}\" = set; then
cannam@140 2627 $lt_var=\$save_$lt_var; export $lt_var
cannam@140 2628 else
cannam@140 2629 $lt_unset $lt_var
cannam@140 2630 fi"
cannam@140 2631 done
cannam@140 2632
cannam@140 2633 # Now prepare to actually exec the command.
cannam@140 2634 exec_cmd="\$cmd$args"
cannam@140 2635 else
cannam@140 2636 # Display what would be done.
cannam@140 2637 if test -n "$shlibpath_var"; then
cannam@140 2638 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
cannam@140 2639 echo "export $shlibpath_var"
cannam@140 2640 fi
cannam@140 2641 $ECHO "$cmd$args"
cannam@140 2642 exit $EXIT_SUCCESS
cannam@140 2643 fi
cannam@140 2644 }
cannam@140 2645
cannam@140 2646 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
cannam@140 2647
cannam@140 2648
cannam@140 2649 # func_mode_finish arg...
cannam@140 2650 func_mode_finish ()
cannam@140 2651 {
cannam@140 2652 $opt_debug
cannam@140 2653 libs=
cannam@140 2654 libdirs=
cannam@140 2655 admincmds=
cannam@140 2656
cannam@140 2657 for opt in "$nonopt" ${1+"$@"}
cannam@140 2658 do
cannam@140 2659 if test -d "$opt"; then
cannam@140 2660 func_append libdirs " $opt"
cannam@140 2661
cannam@140 2662 elif test -f "$opt"; then
cannam@140 2663 if func_lalib_unsafe_p "$opt"; then
cannam@140 2664 func_append libs " $opt"
cannam@140 2665 else
cannam@140 2666 func_warning "\`$opt' is not a valid libtool archive"
cannam@140 2667 fi
cannam@140 2668
cannam@140 2669 else
cannam@140 2670 func_fatal_error "invalid argument \`$opt'"
cannam@140 2671 fi
cannam@140 2672 done
cannam@140 2673
cannam@140 2674 if test -n "$libs"; then
cannam@140 2675 if test -n "$lt_sysroot"; then
cannam@140 2676 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
cannam@140 2677 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
cannam@140 2678 else
cannam@140 2679 sysroot_cmd=
cannam@140 2680 fi
cannam@140 2681
cannam@140 2682 # Remove sysroot references
cannam@140 2683 if $opt_dry_run; then
cannam@140 2684 for lib in $libs; do
cannam@140 2685 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
cannam@140 2686 done
cannam@140 2687 else
cannam@140 2688 tmpdir=`func_mktempdir`
cannam@140 2689 for lib in $libs; do
cannam@140 2690 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
cannam@140 2691 > $tmpdir/tmp-la
cannam@140 2692 mv -f $tmpdir/tmp-la $lib
cannam@140 2693 done
cannam@140 2694 ${RM}r "$tmpdir"
cannam@140 2695 fi
cannam@140 2696 fi
cannam@140 2697
cannam@140 2698 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
cannam@140 2699 for libdir in $libdirs; do
cannam@140 2700 if test -n "$finish_cmds"; then
cannam@140 2701 # Do each command in the finish commands.
cannam@140 2702 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
cannam@140 2703 '"$cmd"'"'
cannam@140 2704 fi
cannam@140 2705 if test -n "$finish_eval"; then
cannam@140 2706 # Do the single finish_eval.
cannam@140 2707 eval cmds=\"$finish_eval\"
cannam@140 2708 $opt_dry_run || eval "$cmds" || func_append admincmds "
cannam@140 2709 $cmds"
cannam@140 2710 fi
cannam@140 2711 done
cannam@140 2712 fi
cannam@140 2713
cannam@140 2714 # Exit here if they wanted silent mode.
cannam@140 2715 $opt_silent && exit $EXIT_SUCCESS
cannam@140 2716
cannam@140 2717 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
cannam@140 2718 echo "----------------------------------------------------------------------"
cannam@140 2719 echo "Libraries have been installed in:"
cannam@140 2720 for libdir in $libdirs; do
cannam@140 2721 $ECHO " $libdir"
cannam@140 2722 done
cannam@140 2723 echo
cannam@140 2724 echo "If you ever happen to want to link against installed libraries"
cannam@140 2725 echo "in a given directory, LIBDIR, you must either use libtool, and"
cannam@140 2726 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
cannam@140 2727 echo "flag during linking and do at least one of the following:"
cannam@140 2728 if test -n "$shlibpath_var"; then
cannam@140 2729 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
cannam@140 2730 echo " during execution"
cannam@140 2731 fi
cannam@140 2732 if test -n "$runpath_var"; then
cannam@140 2733 echo " - add LIBDIR to the \`$runpath_var' environment variable"
cannam@140 2734 echo " during linking"
cannam@140 2735 fi
cannam@140 2736 if test -n "$hardcode_libdir_flag_spec"; then
cannam@140 2737 libdir=LIBDIR
cannam@140 2738 eval flag=\"$hardcode_libdir_flag_spec\"
cannam@140 2739
cannam@140 2740 $ECHO " - use the \`$flag' linker flag"
cannam@140 2741 fi
cannam@140 2742 if test -n "$admincmds"; then
cannam@140 2743 $ECHO " - have your system administrator run these commands:$admincmds"
cannam@140 2744 fi
cannam@140 2745 if test -f /etc/ld.so.conf; then
cannam@140 2746 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
cannam@140 2747 fi
cannam@140 2748 echo
cannam@140 2749
cannam@140 2750 echo "See any operating system documentation about shared libraries for"
cannam@140 2751 case $host in
cannam@140 2752 solaris2.[6789]|solaris2.1[0-9])
cannam@140 2753 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
cannam@140 2754 echo "pages."
cannam@140 2755 ;;
cannam@140 2756 *)
cannam@140 2757 echo "more information, such as the ld(1) and ld.so(8) manual pages."
cannam@140 2758 ;;
cannam@140 2759 esac
cannam@140 2760 echo "----------------------------------------------------------------------"
cannam@140 2761 fi
cannam@140 2762 exit $EXIT_SUCCESS
cannam@140 2763 }
cannam@140 2764
cannam@140 2765 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
cannam@140 2766
cannam@140 2767
cannam@140 2768 # func_mode_install arg...
cannam@140 2769 func_mode_install ()
cannam@140 2770 {
cannam@140 2771 $opt_debug
cannam@140 2772 # There may be an optional sh(1) argument at the beginning of
cannam@140 2773 # install_prog (especially on Windows NT).
cannam@140 2774 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
cannam@140 2775 # Allow the use of GNU shtool's install command.
cannam@140 2776 case $nonopt in *shtool*) :;; *) false;; esac; then
cannam@140 2777 # Aesthetically quote it.
cannam@140 2778 func_quote_for_eval "$nonopt"
cannam@140 2779 install_prog="$func_quote_for_eval_result "
cannam@140 2780 arg=$1
cannam@140 2781 shift
cannam@140 2782 else
cannam@140 2783 install_prog=
cannam@140 2784 arg=$nonopt
cannam@140 2785 fi
cannam@140 2786
cannam@140 2787 # The real first argument should be the name of the installation program.
cannam@140 2788 # Aesthetically quote it.
cannam@140 2789 func_quote_for_eval "$arg"
cannam@140 2790 func_append install_prog "$func_quote_for_eval_result"
cannam@140 2791 install_shared_prog=$install_prog
cannam@140 2792 case " $install_prog " in
cannam@140 2793 *[\\\ /]cp\ *) install_cp=: ;;
cannam@140 2794 *) install_cp=false ;;
cannam@140 2795 esac
cannam@140 2796
cannam@140 2797 # We need to accept at least all the BSD install flags.
cannam@140 2798 dest=
cannam@140 2799 files=
cannam@140 2800 opts=
cannam@140 2801 prev=
cannam@140 2802 install_type=
cannam@140 2803 isdir=no
cannam@140 2804 stripme=
cannam@140 2805 no_mode=:
cannam@140 2806 for arg
cannam@140 2807 do
cannam@140 2808 arg2=
cannam@140 2809 if test -n "$dest"; then
cannam@140 2810 func_append files " $dest"
cannam@140 2811 dest=$arg
cannam@140 2812 continue
cannam@140 2813 fi
cannam@140 2814
cannam@140 2815 case $arg in
cannam@140 2816 -d) isdir=yes ;;
cannam@140 2817 -f)
cannam@140 2818 if $install_cp; then :; else
cannam@140 2819 prev=$arg
cannam@140 2820 fi
cannam@140 2821 ;;
cannam@140 2822 -g | -m | -o)
cannam@140 2823 prev=$arg
cannam@140 2824 ;;
cannam@140 2825 -s)
cannam@140 2826 stripme=" -s"
cannam@140 2827 continue
cannam@140 2828 ;;
cannam@140 2829 -*)
cannam@140 2830 ;;
cannam@140 2831 *)
cannam@140 2832 # If the previous option needed an argument, then skip it.
cannam@140 2833 if test -n "$prev"; then
cannam@140 2834 if test "x$prev" = x-m && test -n "$install_override_mode"; then
cannam@140 2835 arg2=$install_override_mode
cannam@140 2836 no_mode=false
cannam@140 2837 fi
cannam@140 2838 prev=
cannam@140 2839 else
cannam@140 2840 dest=$arg
cannam@140 2841 continue
cannam@140 2842 fi
cannam@140 2843 ;;
cannam@140 2844 esac
cannam@140 2845
cannam@140 2846 # Aesthetically quote the argument.
cannam@140 2847 func_quote_for_eval "$arg"
cannam@140 2848 func_append install_prog " $func_quote_for_eval_result"
cannam@140 2849 if test -n "$arg2"; then
cannam@140 2850 func_quote_for_eval "$arg2"
cannam@140 2851 fi
cannam@140 2852 func_append install_shared_prog " $func_quote_for_eval_result"
cannam@140 2853 done
cannam@140 2854
cannam@140 2855 test -z "$install_prog" && \
cannam@140 2856 func_fatal_help "you must specify an install program"
cannam@140 2857
cannam@140 2858 test -n "$prev" && \
cannam@140 2859 func_fatal_help "the \`$prev' option requires an argument"
cannam@140 2860
cannam@140 2861 if test -n "$install_override_mode" && $no_mode; then
cannam@140 2862 if $install_cp; then :; else
cannam@140 2863 func_quote_for_eval "$install_override_mode"
cannam@140 2864 func_append install_shared_prog " -m $func_quote_for_eval_result"
cannam@140 2865 fi
cannam@140 2866 fi
cannam@140 2867
cannam@140 2868 if test -z "$files"; then
cannam@140 2869 if test -z "$dest"; then
cannam@140 2870 func_fatal_help "no file or destination specified"
cannam@140 2871 else
cannam@140 2872 func_fatal_help "you must specify a destination"
cannam@140 2873 fi
cannam@140 2874 fi
cannam@140 2875
cannam@140 2876 # Strip any trailing slash from the destination.
cannam@140 2877 func_stripname '' '/' "$dest"
cannam@140 2878 dest=$func_stripname_result
cannam@140 2879
cannam@140 2880 # Check to see that the destination is a directory.
cannam@140 2881 test -d "$dest" && isdir=yes
cannam@140 2882 if test "$isdir" = yes; then
cannam@140 2883 destdir="$dest"
cannam@140 2884 destname=
cannam@140 2885 else
cannam@140 2886 func_dirname_and_basename "$dest" "" "."
cannam@140 2887 destdir="$func_dirname_result"
cannam@140 2888 destname="$func_basename_result"
cannam@140 2889
cannam@140 2890 # Not a directory, so check to see that there is only one file specified.
cannam@140 2891 set dummy $files; shift
cannam@140 2892 test "$#" -gt 1 && \
cannam@140 2893 func_fatal_help "\`$dest' is not a directory"
cannam@140 2894 fi
cannam@140 2895 case $destdir in
cannam@140 2896 [\\/]* | [A-Za-z]:[\\/]*) ;;
cannam@140 2897 *)
cannam@140 2898 for file in $files; do
cannam@140 2899 case $file in
cannam@140 2900 *.lo) ;;
cannam@140 2901 *)
cannam@140 2902 func_fatal_help "\`$destdir' must be an absolute directory name"
cannam@140 2903 ;;
cannam@140 2904 esac
cannam@140 2905 done
cannam@140 2906 ;;
cannam@140 2907 esac
cannam@140 2908
cannam@140 2909 # This variable tells wrapper scripts just to set variables rather
cannam@140 2910 # than running their programs.
cannam@140 2911 libtool_install_magic="$magic"
cannam@140 2912
cannam@140 2913 staticlibs=
cannam@140 2914 future_libdirs=
cannam@140 2915 current_libdirs=
cannam@140 2916 for file in $files; do
cannam@140 2917
cannam@140 2918 # Do each installation.
cannam@140 2919 case $file in
cannam@140 2920 *.$libext)
cannam@140 2921 # Do the static libraries later.
cannam@140 2922 func_append staticlibs " $file"
cannam@140 2923 ;;
cannam@140 2924
cannam@140 2925 *.la)
cannam@140 2926 func_resolve_sysroot "$file"
cannam@140 2927 file=$func_resolve_sysroot_result
cannam@140 2928
cannam@140 2929 # Check to see that this really is a libtool archive.
cannam@140 2930 func_lalib_unsafe_p "$file" \
cannam@140 2931 || func_fatal_help "\`$file' is not a valid libtool archive"
cannam@140 2932
cannam@140 2933 library_names=
cannam@140 2934 old_library=
cannam@140 2935 relink_command=
cannam@140 2936 func_source "$file"
cannam@140 2937
cannam@140 2938 # Add the libdir to current_libdirs if it is the destination.
cannam@140 2939 if test "X$destdir" = "X$libdir"; then
cannam@140 2940 case "$current_libdirs " in
cannam@140 2941 *" $libdir "*) ;;
cannam@140 2942 *) func_append current_libdirs " $libdir" ;;
cannam@140 2943 esac
cannam@140 2944 else
cannam@140 2945 # Note the libdir as a future libdir.
cannam@140 2946 case "$future_libdirs " in
cannam@140 2947 *" $libdir "*) ;;
cannam@140 2948 *) func_append future_libdirs " $libdir" ;;
cannam@140 2949 esac
cannam@140 2950 fi
cannam@140 2951
cannam@140 2952 func_dirname "$file" "/" ""
cannam@140 2953 dir="$func_dirname_result"
cannam@140 2954 func_append dir "$objdir"
cannam@140 2955
cannam@140 2956 if test -n "$relink_command"; then
cannam@140 2957 # Determine the prefix the user has applied to our future dir.
cannam@140 2958 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
cannam@140 2959
cannam@140 2960 # Don't allow the user to place us outside of our expected
cannam@140 2961 # location b/c this prevents finding dependent libraries that
cannam@140 2962 # are installed to the same prefix.
cannam@140 2963 # At present, this check doesn't affect windows .dll's that
cannam@140 2964 # are installed into $libdir/../bin (currently, that works fine)
cannam@140 2965 # but it's something to keep an eye on.
cannam@140 2966 test "$inst_prefix_dir" = "$destdir" && \
cannam@140 2967 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
cannam@140 2968
cannam@140 2969 if test -n "$inst_prefix_dir"; then
cannam@140 2970 # Stick the inst_prefix_dir data into the link command.
cannam@140 2971 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
cannam@140 2972 else
cannam@140 2973 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
cannam@140 2974 fi
cannam@140 2975
cannam@140 2976 func_warning "relinking \`$file'"
cannam@140 2977 func_show_eval "$relink_command" \
cannam@140 2978 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
cannam@140 2979 fi
cannam@140 2980
cannam@140 2981 # See the names of the shared library.
cannam@140 2982 set dummy $library_names; shift
cannam@140 2983 if test -n "$1"; then
cannam@140 2984 realname="$1"
cannam@140 2985 shift
cannam@140 2986
cannam@140 2987 srcname="$realname"
cannam@140 2988 test -n "$relink_command" && srcname="$realname"T
cannam@140 2989
cannam@140 2990 # Install the shared library and build the symlinks.
cannam@140 2991 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
cannam@140 2992 'exit $?'
cannam@140 2993 tstripme="$stripme"
cannam@140 2994 case $host_os in
cannam@140 2995 cygwin* | mingw* | pw32* | cegcc*)
cannam@140 2996 case $realname in
cannam@140 2997 *.dll.a)
cannam@140 2998 tstripme=""
cannam@140 2999 ;;
cannam@140 3000 esac
cannam@140 3001 ;;
cannam@140 3002 esac
cannam@140 3003 if test -n "$tstripme" && test -n "$striplib"; then
cannam@140 3004 func_show_eval "$striplib $destdir/$realname" 'exit $?'
cannam@140 3005 fi
cannam@140 3006
cannam@140 3007 if test "$#" -gt 0; then
cannam@140 3008 # Delete the old symlinks, and create new ones.
cannam@140 3009 # Try `ln -sf' first, because the `ln' binary might depend on
cannam@140 3010 # the symlink we replace! Solaris /bin/ln does not understand -f,
cannam@140 3011 # so we also need to try rm && ln -s.
cannam@140 3012 for linkname
cannam@140 3013 do
cannam@140 3014 test "$linkname" != "$realname" \
cannam@140 3015 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
cannam@140 3016 done
cannam@140 3017 fi
cannam@140 3018
cannam@140 3019 # Do each command in the postinstall commands.
cannam@140 3020 lib="$destdir/$realname"
cannam@140 3021 func_execute_cmds "$postinstall_cmds" 'exit $?'
cannam@140 3022 fi
cannam@140 3023
cannam@140 3024 # Install the pseudo-library for information purposes.
cannam@140 3025 func_basename "$file"
cannam@140 3026 name="$func_basename_result"
cannam@140 3027 instname="$dir/$name"i
cannam@140 3028 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
cannam@140 3029
cannam@140 3030 # Maybe install the static library, too.
cannam@140 3031 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
cannam@140 3032 ;;
cannam@140 3033
cannam@140 3034 *.lo)
cannam@140 3035 # Install (i.e. copy) a libtool object.
cannam@140 3036
cannam@140 3037 # Figure out destination file name, if it wasn't already specified.
cannam@140 3038 if test -n "$destname"; then
cannam@140 3039 destfile="$destdir/$destname"
cannam@140 3040 else
cannam@140 3041 func_basename "$file"
cannam@140 3042 destfile="$func_basename_result"
cannam@140 3043 destfile="$destdir/$destfile"
cannam@140 3044 fi
cannam@140 3045
cannam@140 3046 # Deduce the name of the destination old-style object file.
cannam@140 3047 case $destfile in
cannam@140 3048 *.lo)
cannam@140 3049 func_lo2o "$destfile"
cannam@140 3050 staticdest=$func_lo2o_result
cannam@140 3051 ;;
cannam@140 3052 *.$objext)
cannam@140 3053 staticdest="$destfile"
cannam@140 3054 destfile=
cannam@140 3055 ;;
cannam@140 3056 *)
cannam@140 3057 func_fatal_help "cannot copy a libtool object to \`$destfile'"
cannam@140 3058 ;;
cannam@140 3059 esac
cannam@140 3060
cannam@140 3061 # Install the libtool object if requested.
cannam@140 3062 test -n "$destfile" && \
cannam@140 3063 func_show_eval "$install_prog $file $destfile" 'exit $?'
cannam@140 3064
cannam@140 3065 # Install the old object if enabled.
cannam@140 3066 if test "$build_old_libs" = yes; then
cannam@140 3067 # Deduce the name of the old-style object file.
cannam@140 3068 func_lo2o "$file"
cannam@140 3069 staticobj=$func_lo2o_result
cannam@140 3070 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
cannam@140 3071 fi
cannam@140 3072 exit $EXIT_SUCCESS
cannam@140 3073 ;;
cannam@140 3074
cannam@140 3075 *)
cannam@140 3076 # Figure out destination file name, if it wasn't already specified.
cannam@140 3077 if test -n "$destname"; then
cannam@140 3078 destfile="$destdir/$destname"
cannam@140 3079 else
cannam@140 3080 func_basename "$file"
cannam@140 3081 destfile="$func_basename_result"
cannam@140 3082 destfile="$destdir/$destfile"
cannam@140 3083 fi
cannam@140 3084
cannam@140 3085 # If the file is missing, and there is a .exe on the end, strip it
cannam@140 3086 # because it is most likely a libtool script we actually want to
cannam@140 3087 # install
cannam@140 3088 stripped_ext=""
cannam@140 3089 case $file in
cannam@140 3090 *.exe)
cannam@140 3091 if test ! -f "$file"; then
cannam@140 3092 func_stripname '' '.exe' "$file"
cannam@140 3093 file=$func_stripname_result
cannam@140 3094 stripped_ext=".exe"
cannam@140 3095 fi
cannam@140 3096 ;;
cannam@140 3097 esac
cannam@140 3098
cannam@140 3099 # Do a test to see if this is really a libtool program.
cannam@140 3100 case $host in
cannam@140 3101 *cygwin* | *mingw*)
cannam@140 3102 if func_ltwrapper_executable_p "$file"; then
cannam@140 3103 func_ltwrapper_scriptname "$file"
cannam@140 3104 wrapper=$func_ltwrapper_scriptname_result
cannam@140 3105 else
cannam@140 3106 func_stripname '' '.exe' "$file"
cannam@140 3107 wrapper=$func_stripname_result
cannam@140 3108 fi
cannam@140 3109 ;;
cannam@140 3110 *)
cannam@140 3111 wrapper=$file
cannam@140 3112 ;;
cannam@140 3113 esac
cannam@140 3114 if func_ltwrapper_script_p "$wrapper"; then
cannam@140 3115 notinst_deplibs=
cannam@140 3116 relink_command=
cannam@140 3117
cannam@140 3118 func_source "$wrapper"
cannam@140 3119
cannam@140 3120 # Check the variables that should have been set.
cannam@140 3121 test -z "$generated_by_libtool_version" && \
cannam@140 3122 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
cannam@140 3123
cannam@140 3124 finalize=yes
cannam@140 3125 for lib in $notinst_deplibs; do
cannam@140 3126 # Check to see that each library is installed.
cannam@140 3127 libdir=
cannam@140 3128 if test -f "$lib"; then
cannam@140 3129 func_source "$lib"
cannam@140 3130 fi
cannam@140 3131 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
cannam@140 3132 if test -n "$libdir" && test ! -f "$libfile"; then
cannam@140 3133 func_warning "\`$lib' has not been installed in \`$libdir'"
cannam@140 3134 finalize=no
cannam@140 3135 fi
cannam@140 3136 done
cannam@140 3137
cannam@140 3138 relink_command=
cannam@140 3139 func_source "$wrapper"
cannam@140 3140
cannam@140 3141 outputname=
cannam@140 3142 if test "$fast_install" = no && test -n "$relink_command"; then
cannam@140 3143 $opt_dry_run || {
cannam@140 3144 if test "$finalize" = yes; then
cannam@140 3145 tmpdir=`func_mktempdir`
cannam@140 3146 func_basename "$file$stripped_ext"
cannam@140 3147 file="$func_basename_result"
cannam@140 3148 outputname="$tmpdir/$file"
cannam@140 3149 # Replace the output file specification.
cannam@140 3150 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
cannam@140 3151
cannam@140 3152 $opt_silent || {
cannam@140 3153 func_quote_for_expand "$relink_command"
cannam@140 3154 eval "func_echo $func_quote_for_expand_result"
cannam@140 3155 }
cannam@140 3156 if eval "$relink_command"; then :
cannam@140 3157 else
cannam@140 3158 func_error "error: relink \`$file' with the above command before installing it"
cannam@140 3159 $opt_dry_run || ${RM}r "$tmpdir"
cannam@140 3160 continue
cannam@140 3161 fi
cannam@140 3162 file="$outputname"
cannam@140 3163 else
cannam@140 3164 func_warning "cannot relink \`$file'"
cannam@140 3165 fi
cannam@140 3166 }
cannam@140 3167 else
cannam@140 3168 # Install the binary that we compiled earlier.
cannam@140 3169 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
cannam@140 3170 fi
cannam@140 3171 fi
cannam@140 3172
cannam@140 3173 # remove .exe since cygwin /usr/bin/install will append another
cannam@140 3174 # one anyway
cannam@140 3175 case $install_prog,$host in
cannam@140 3176 */usr/bin/install*,*cygwin*)
cannam@140 3177 case $file:$destfile in
cannam@140 3178 *.exe:*.exe)
cannam@140 3179 # this is ok
cannam@140 3180 ;;
cannam@140 3181 *.exe:*)
cannam@140 3182 destfile=$destfile.exe
cannam@140 3183 ;;
cannam@140 3184 *:*.exe)
cannam@140 3185 func_stripname '' '.exe' "$destfile"
cannam@140 3186 destfile=$func_stripname_result
cannam@140 3187 ;;
cannam@140 3188 esac
cannam@140 3189 ;;
cannam@140 3190 esac
cannam@140 3191 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
cannam@140 3192 $opt_dry_run || if test -n "$outputname"; then
cannam@140 3193 ${RM}r "$tmpdir"
cannam@140 3194 fi
cannam@140 3195 ;;
cannam@140 3196 esac
cannam@140 3197 done
cannam@140 3198
cannam@140 3199 for file in $staticlibs; do
cannam@140 3200 func_basename "$file"
cannam@140 3201 name="$func_basename_result"
cannam@140 3202
cannam@140 3203 # Set up the ranlib parameters.
cannam@140 3204 oldlib="$destdir/$name"
cannam@140 3205 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
cannam@140 3206 tool_oldlib=$func_to_tool_file_result
cannam@140 3207
cannam@140 3208 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
cannam@140 3209
cannam@140 3210 if test -n "$stripme" && test -n "$old_striplib"; then
cannam@140 3211 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
cannam@140 3212 fi
cannam@140 3213
cannam@140 3214 # Do each command in the postinstall commands.
cannam@140 3215 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
cannam@140 3216 done
cannam@140 3217
cannam@140 3218 test -n "$future_libdirs" && \
cannam@140 3219 func_warning "remember to run \`$progname --finish$future_libdirs'"
cannam@140 3220
cannam@140 3221 if test -n "$current_libdirs"; then
cannam@140 3222 # Maybe just do a dry run.
cannam@140 3223 $opt_dry_run && current_libdirs=" -n$current_libdirs"
cannam@140 3224 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
cannam@140 3225 else
cannam@140 3226 exit $EXIT_SUCCESS
cannam@140 3227 fi
cannam@140 3228 }
cannam@140 3229
cannam@140 3230 test "$opt_mode" = install && func_mode_install ${1+"$@"}
cannam@140 3231
cannam@140 3232
cannam@140 3233 # func_generate_dlsyms outputname originator pic_p
cannam@140 3234 # Extract symbols from dlprefiles and create ${outputname}S.o with
cannam@140 3235 # a dlpreopen symbol table.
cannam@140 3236 func_generate_dlsyms ()
cannam@140 3237 {
cannam@140 3238 $opt_debug
cannam@140 3239 my_outputname="$1"
cannam@140 3240 my_originator="$2"
cannam@140 3241 my_pic_p="${3-no}"
cannam@140 3242 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
cannam@140 3243 my_dlsyms=
cannam@140 3244
cannam@140 3245 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
cannam@140 3246 if test -n "$NM" && test -n "$global_symbol_pipe"; then
cannam@140 3247 my_dlsyms="${my_outputname}S.c"
cannam@140 3248 else
cannam@140 3249 func_error "not configured to extract global symbols from dlpreopened files"
cannam@140 3250 fi
cannam@140 3251 fi
cannam@140 3252
cannam@140 3253 if test -n "$my_dlsyms"; then
cannam@140 3254 case $my_dlsyms in
cannam@140 3255 "") ;;
cannam@140 3256 *.c)
cannam@140 3257 # Discover the nlist of each of the dlfiles.
cannam@140 3258 nlist="$output_objdir/${my_outputname}.nm"
cannam@140 3259
cannam@140 3260 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
cannam@140 3261
cannam@140 3262 # Parse the name list into a source file.
cannam@140 3263 func_verbose "creating $output_objdir/$my_dlsyms"
cannam@140 3264
cannam@140 3265 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
cannam@140 3266 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
cannam@140 3267 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
cannam@140 3268
cannam@140 3269 #ifdef __cplusplus
cannam@140 3270 extern \"C\" {
cannam@140 3271 #endif
cannam@140 3272
cannam@140 3273 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
cannam@140 3274 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
cannam@140 3275 #endif
cannam@140 3276
cannam@140 3277 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
cannam@140 3278 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
cannam@140 3279 /* DATA imports from DLLs on WIN32 con't be const, because runtime
cannam@140 3280 relocations are performed -- see ld's documentation on pseudo-relocs. */
cannam@140 3281 # define LT_DLSYM_CONST
cannam@140 3282 #elif defined(__osf__)
cannam@140 3283 /* This system does not cope well with relocations in const data. */
cannam@140 3284 # define LT_DLSYM_CONST
cannam@140 3285 #else
cannam@140 3286 # define LT_DLSYM_CONST const
cannam@140 3287 #endif
cannam@140 3288
cannam@140 3289 /* External symbol declarations for the compiler. */\
cannam@140 3290 "
cannam@140 3291
cannam@140 3292 if test "$dlself" = yes; then
cannam@140 3293 func_verbose "generating symbol list for \`$output'"
cannam@140 3294
cannam@140 3295 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
cannam@140 3296
cannam@140 3297 # Add our own program objects to the symbol list.
cannam@140 3298 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
cannam@140 3299 for progfile in $progfiles; do
cannam@140 3300 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
cannam@140 3301 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
cannam@140 3302 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
cannam@140 3303 done
cannam@140 3304
cannam@140 3305 if test -n "$exclude_expsyms"; then
cannam@140 3306 $opt_dry_run || {
cannam@140 3307 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
cannam@140 3308 eval '$MV "$nlist"T "$nlist"'
cannam@140 3309 }
cannam@140 3310 fi
cannam@140 3311
cannam@140 3312 if test -n "$export_symbols_regex"; then
cannam@140 3313 $opt_dry_run || {
cannam@140 3314 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
cannam@140 3315 eval '$MV "$nlist"T "$nlist"'
cannam@140 3316 }
cannam@140 3317 fi
cannam@140 3318
cannam@140 3319 # Prepare the list of exported symbols
cannam@140 3320 if test -z "$export_symbols"; then
cannam@140 3321 export_symbols="$output_objdir/$outputname.exp"
cannam@140 3322 $opt_dry_run || {
cannam@140 3323 $RM $export_symbols
cannam@140 3324 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
cannam@140 3325 case $host in
cannam@140 3326 *cygwin* | *mingw* | *cegcc* )
cannam@140 3327 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
cannam@140 3328 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
cannam@140 3329 ;;
cannam@140 3330 esac
cannam@140 3331 }
cannam@140 3332 else
cannam@140 3333 $opt_dry_run || {
cannam@140 3334 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
cannam@140 3335 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
cannam@140 3336 eval '$MV "$nlist"T "$nlist"'
cannam@140 3337 case $host in
cannam@140 3338 *cygwin* | *mingw* | *cegcc* )
cannam@140 3339 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
cannam@140 3340 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
cannam@140 3341 ;;
cannam@140 3342 esac
cannam@140 3343 }
cannam@140 3344 fi
cannam@140 3345 fi
cannam@140 3346
cannam@140 3347 for dlprefile in $dlprefiles; do
cannam@140 3348 func_verbose "extracting global C symbols from \`$dlprefile'"
cannam@140 3349 func_basename "$dlprefile"
cannam@140 3350 name="$func_basename_result"
cannam@140 3351 case $host in
cannam@140 3352 *cygwin* | *mingw* | *cegcc* )
cannam@140 3353 # if an import library, we need to obtain dlname
cannam@140 3354 if func_win32_import_lib_p "$dlprefile"; then
cannam@140 3355 func_tr_sh "$dlprefile"
cannam@140 3356 eval "curr_lafile=\$libfile_$func_tr_sh_result"
cannam@140 3357 dlprefile_dlbasename=""
cannam@140 3358 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
cannam@140 3359 # Use subshell, to avoid clobbering current variable values
cannam@140 3360 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
cannam@140 3361 if test -n "$dlprefile_dlname" ; then
cannam@140 3362 func_basename "$dlprefile_dlname"
cannam@140 3363 dlprefile_dlbasename="$func_basename_result"
cannam@140 3364 else
cannam@140 3365 # no lafile. user explicitly requested -dlpreopen <import library>.
cannam@140 3366 $sharedlib_from_linklib_cmd "$dlprefile"
cannam@140 3367 dlprefile_dlbasename=$sharedlib_from_linklib_result
cannam@140 3368 fi
cannam@140 3369 fi
cannam@140 3370 $opt_dry_run || {
cannam@140 3371 if test -n "$dlprefile_dlbasename" ; then
cannam@140 3372 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
cannam@140 3373 else
cannam@140 3374 func_warning "Could not compute DLL name from $name"
cannam@140 3375 eval '$ECHO ": $name " >> "$nlist"'
cannam@140 3376 fi
cannam@140 3377 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
cannam@140 3378 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
cannam@140 3379 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
cannam@140 3380 }
cannam@140 3381 else # not an import lib
cannam@140 3382 $opt_dry_run || {
cannam@140 3383 eval '$ECHO ": $name " >> "$nlist"'
cannam@140 3384 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
cannam@140 3385 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
cannam@140 3386 }
cannam@140 3387 fi
cannam@140 3388 ;;
cannam@140 3389 *)
cannam@140 3390 $opt_dry_run || {
cannam@140 3391 eval '$ECHO ": $name " >> "$nlist"'
cannam@140 3392 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
cannam@140 3393 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
cannam@140 3394 }
cannam@140 3395 ;;
cannam@140 3396 esac
cannam@140 3397 done
cannam@140 3398
cannam@140 3399 $opt_dry_run || {
cannam@140 3400 # Make sure we have at least an empty file.
cannam@140 3401 test -f "$nlist" || : > "$nlist"
cannam@140 3402
cannam@140 3403 if test -n "$exclude_expsyms"; then
cannam@140 3404 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
cannam@140 3405 $MV "$nlist"T "$nlist"
cannam@140 3406 fi
cannam@140 3407
cannam@140 3408 # Try sorting and uniquifying the output.
cannam@140 3409 if $GREP -v "^: " < "$nlist" |
cannam@140 3410 if sort -k 3 </dev/null >/dev/null 2>&1; then
cannam@140 3411 sort -k 3
cannam@140 3412 else
cannam@140 3413 sort +2
cannam@140 3414 fi |
cannam@140 3415 uniq > "$nlist"S; then
cannam@140 3416 :
cannam@140 3417 else
cannam@140 3418 $GREP -v "^: " < "$nlist" > "$nlist"S
cannam@140 3419 fi
cannam@140 3420
cannam@140 3421 if test -f "$nlist"S; then
cannam@140 3422 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
cannam@140 3423 else
cannam@140 3424 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
cannam@140 3425 fi
cannam@140 3426
cannam@140 3427 echo >> "$output_objdir/$my_dlsyms" "\
cannam@140 3428
cannam@140 3429 /* The mapping between symbol names and symbols. */
cannam@140 3430 typedef struct {
cannam@140 3431 const char *name;
cannam@140 3432 void *address;
cannam@140 3433 } lt_dlsymlist;
cannam@140 3434 extern LT_DLSYM_CONST lt_dlsymlist
cannam@140 3435 lt_${my_prefix}_LTX_preloaded_symbols[];
cannam@140 3436 LT_DLSYM_CONST lt_dlsymlist
cannam@140 3437 lt_${my_prefix}_LTX_preloaded_symbols[] =
cannam@140 3438 {\
cannam@140 3439 { \"$my_originator\", (void *) 0 },"
cannam@140 3440
cannam@140 3441 case $need_lib_prefix in
cannam@140 3442 no)
cannam@140 3443 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
cannam@140 3444 ;;
cannam@140 3445 *)
cannam@140 3446 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
cannam@140 3447 ;;
cannam@140 3448 esac
cannam@140 3449 echo >> "$output_objdir/$my_dlsyms" "\
cannam@140 3450 {0, (void *) 0}
cannam@140 3451 };
cannam@140 3452
cannam@140 3453 /* This works around a problem in FreeBSD linker */
cannam@140 3454 #ifdef FREEBSD_WORKAROUND
cannam@140 3455 static const void *lt_preloaded_setup() {
cannam@140 3456 return lt_${my_prefix}_LTX_preloaded_symbols;
cannam@140 3457 }
cannam@140 3458 #endif
cannam@140 3459
cannam@140 3460 #ifdef __cplusplus
cannam@140 3461 }
cannam@140 3462 #endif\
cannam@140 3463 "
cannam@140 3464 } # !$opt_dry_run
cannam@140 3465
cannam@140 3466 pic_flag_for_symtable=
cannam@140 3467 case "$compile_command " in
cannam@140 3468 *" -static "*) ;;
cannam@140 3469 *)
cannam@140 3470 case $host in
cannam@140 3471 # compiling the symbol table file with pic_flag works around
cannam@140 3472 # a FreeBSD bug that causes programs to crash when -lm is
cannam@140 3473 # linked before any other PIC object. But we must not use
cannam@140 3474 # pic_flag when linking with -static. The problem exists in
cannam@140 3475 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
cannam@140 3476 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
cannam@140 3477 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
cannam@140 3478 *-*-hpux*)
cannam@140 3479 pic_flag_for_symtable=" $pic_flag" ;;
cannam@140 3480 *)
cannam@140 3481 if test "X$my_pic_p" != Xno; then
cannam@140 3482 pic_flag_for_symtable=" $pic_flag"
cannam@140 3483 fi
cannam@140 3484 ;;
cannam@140 3485 esac
cannam@140 3486 ;;
cannam@140 3487 esac
cannam@140 3488 symtab_cflags=
cannam@140 3489 for arg in $LTCFLAGS; do
cannam@140 3490 case $arg in
cannam@140 3491 -pie | -fpie | -fPIE) ;;
cannam@140 3492 *) func_append symtab_cflags " $arg" ;;
cannam@140 3493 esac
cannam@140 3494 done
cannam@140 3495
cannam@140 3496 # Now compile the dynamic symbol file.
cannam@140 3497 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
cannam@140 3498
cannam@140 3499 # Clean up the generated files.
cannam@140 3500 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
cannam@140 3501
cannam@140 3502 # Transform the symbol file into the correct name.
cannam@140 3503 symfileobj="$output_objdir/${my_outputname}S.$objext"
cannam@140 3504 case $host in
cannam@140 3505 *cygwin* | *mingw* | *cegcc* )
cannam@140 3506 if test -f "$output_objdir/$my_outputname.def"; then
cannam@140 3507 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
cannam@140 3508 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
cannam@140 3509 else
cannam@140 3510 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cannam@140 3511 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cannam@140 3512 fi
cannam@140 3513 ;;
cannam@140 3514 *)
cannam@140 3515 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cannam@140 3516 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cannam@140 3517 ;;
cannam@140 3518 esac
cannam@140 3519 ;;
cannam@140 3520 *)
cannam@140 3521 func_fatal_error "unknown suffix for \`$my_dlsyms'"
cannam@140 3522 ;;
cannam@140 3523 esac
cannam@140 3524 else
cannam@140 3525 # We keep going just in case the user didn't refer to
cannam@140 3526 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
cannam@140 3527 # really was required.
cannam@140 3528
cannam@140 3529 # Nullify the symbol file.
cannam@140 3530 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
cannam@140 3531 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
cannam@140 3532 fi
cannam@140 3533 }
cannam@140 3534
cannam@140 3535 # func_win32_libid arg
cannam@140 3536 # return the library type of file 'arg'
cannam@140 3537 #
cannam@140 3538 # Need a lot of goo to handle *both* DLLs and import libs
cannam@140 3539 # Has to be a shell function in order to 'eat' the argument
cannam@140 3540 # that is supplied when $file_magic_command is called.
cannam@140 3541 # Despite the name, also deal with 64 bit binaries.
cannam@140 3542 func_win32_libid ()
cannam@140 3543 {
cannam@140 3544 $opt_debug
cannam@140 3545 win32_libid_type="unknown"
cannam@140 3546 win32_fileres=`file -L $1 2>/dev/null`
cannam@140 3547 case $win32_fileres in
cannam@140 3548 *ar\ archive\ import\ library*) # definitely import
cannam@140 3549 win32_libid_type="x86 archive import"
cannam@140 3550 ;;
cannam@140 3551 *ar\ archive*) # could be an import, or static
cannam@140 3552 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
cannam@140 3553 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
cannam@140 3554 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
cannam@140 3555 func_to_tool_file "$1" func_convert_file_msys_to_w32
cannam@140 3556 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
cannam@140 3557 $SED -n -e '
cannam@140 3558 1,100{
cannam@140 3559 / I /{
cannam@140 3560 s,.*,import,
cannam@140 3561 p
cannam@140 3562 q
cannam@140 3563 }
cannam@140 3564 }'`
cannam@140 3565 case $win32_nmres in
cannam@140 3566 import*) win32_libid_type="x86 archive import";;
cannam@140 3567 *) win32_libid_type="x86 archive static";;
cannam@140 3568 esac
cannam@140 3569 fi
cannam@140 3570 ;;
cannam@140 3571 *DLL*)
cannam@140 3572 win32_libid_type="x86 DLL"
cannam@140 3573 ;;
cannam@140 3574 *executable*) # but shell scripts are "executable" too...
cannam@140 3575 case $win32_fileres in
cannam@140 3576 *MS\ Windows\ PE\ Intel*)
cannam@140 3577 win32_libid_type="x86 DLL"
cannam@140 3578 ;;
cannam@140 3579 esac
cannam@140 3580 ;;
cannam@140 3581 esac
cannam@140 3582 $ECHO "$win32_libid_type"
cannam@140 3583 }
cannam@140 3584
cannam@140 3585 # func_cygming_dll_for_implib ARG
cannam@140 3586 #
cannam@140 3587 # Platform-specific function to extract the
cannam@140 3588 # name of the DLL associated with the specified
cannam@140 3589 # import library ARG.
cannam@140 3590 # Invoked by eval'ing the libtool variable
cannam@140 3591 # $sharedlib_from_linklib_cmd
cannam@140 3592 # Result is available in the variable
cannam@140 3593 # $sharedlib_from_linklib_result
cannam@140 3594 func_cygming_dll_for_implib ()
cannam@140 3595 {
cannam@140 3596 $opt_debug
cannam@140 3597 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
cannam@140 3598 }
cannam@140 3599
cannam@140 3600 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
cannam@140 3601 #
cannam@140 3602 # The is the core of a fallback implementation of a
cannam@140 3603 # platform-specific function to extract the name of the
cannam@140 3604 # DLL associated with the specified import library LIBNAME.
cannam@140 3605 #
cannam@140 3606 # SECTION_NAME is either .idata$6 or .idata$7, depending
cannam@140 3607 # on the platform and compiler that created the implib.
cannam@140 3608 #
cannam@140 3609 # Echos the name of the DLL associated with the
cannam@140 3610 # specified import library.
cannam@140 3611 func_cygming_dll_for_implib_fallback_core ()
cannam@140 3612 {
cannam@140 3613 $opt_debug
cannam@140 3614 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
cannam@140 3615 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
cannam@140 3616 $SED '/^Contents of section '"$match_literal"':/{
cannam@140 3617 # Place marker at beginning of archive member dllname section
cannam@140 3618 s/.*/====MARK====/
cannam@140 3619 p
cannam@140 3620 d
cannam@140 3621 }
cannam@140 3622 # These lines can sometimes be longer than 43 characters, but
cannam@140 3623 # are always uninteresting
cannam@140 3624 /:[ ]*file format pe[i]\{,1\}-/d
cannam@140 3625 /^In archive [^:]*:/d
cannam@140 3626 # Ensure marker is printed
cannam@140 3627 /^====MARK====/p
cannam@140 3628 # Remove all lines with less than 43 characters
cannam@140 3629 /^.\{43\}/!d
cannam@140 3630 # From remaining lines, remove first 43 characters
cannam@140 3631 s/^.\{43\}//' |
cannam@140 3632 $SED -n '
cannam@140 3633 # Join marker and all lines until next marker into a single line
cannam@140 3634 /^====MARK====/ b para
cannam@140 3635 H
cannam@140 3636 $ b para
cannam@140 3637 b
cannam@140 3638 :para
cannam@140 3639 x
cannam@140 3640 s/\n//g
cannam@140 3641 # Remove the marker
cannam@140 3642 s/^====MARK====//
cannam@140 3643 # Remove trailing dots and whitespace
cannam@140 3644 s/[\. \t]*$//
cannam@140 3645 # Print
cannam@140 3646 /./p' |
cannam@140 3647 # we now have a list, one entry per line, of the stringified
cannam@140 3648 # contents of the appropriate section of all members of the
cannam@140 3649 # archive which possess that section. Heuristic: eliminate
cannam@140 3650 # all those which have a first or second character that is
cannam@140 3651 # a '.' (that is, objdump's representation of an unprintable
cannam@140 3652 # character.) This should work for all archives with less than
cannam@140 3653 # 0x302f exports -- but will fail for DLLs whose name actually
cannam@140 3654 # begins with a literal '.' or a single character followed by
cannam@140 3655 # a '.'.
cannam@140 3656 #
cannam@140 3657 # Of those that remain, print the first one.
cannam@140 3658 $SED -e '/^\./d;/^.\./d;q'
cannam@140 3659 }
cannam@140 3660
cannam@140 3661 # func_cygming_gnu_implib_p ARG
cannam@140 3662 # This predicate returns with zero status (TRUE) if
cannam@140 3663 # ARG is a GNU/binutils-style import library. Returns
cannam@140 3664 # with nonzero status (FALSE) otherwise.
cannam@140 3665 func_cygming_gnu_implib_p ()
cannam@140 3666 {
cannam@140 3667 $opt_debug
cannam@140 3668 func_to_tool_file "$1" func_convert_file_msys_to_w32
cannam@140 3669 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
cannam@140 3670 test -n "$func_cygming_gnu_implib_tmp"
cannam@140 3671 }
cannam@140 3672
cannam@140 3673 # func_cygming_ms_implib_p ARG
cannam@140 3674 # This predicate returns with zero status (TRUE) if
cannam@140 3675 # ARG is an MS-style import library. Returns
cannam@140 3676 # with nonzero status (FALSE) otherwise.
cannam@140 3677 func_cygming_ms_implib_p ()
cannam@140 3678 {
cannam@140 3679 $opt_debug
cannam@140 3680 func_to_tool_file "$1" func_convert_file_msys_to_w32
cannam@140 3681 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
cannam@140 3682 test -n "$func_cygming_ms_implib_tmp"
cannam@140 3683 }
cannam@140 3684
cannam@140 3685 # func_cygming_dll_for_implib_fallback ARG
cannam@140 3686 # Platform-specific function to extract the
cannam@140 3687 # name of the DLL associated with the specified
cannam@140 3688 # import library ARG.
cannam@140 3689 #
cannam@140 3690 # This fallback implementation is for use when $DLLTOOL
cannam@140 3691 # does not support the --identify-strict option.
cannam@140 3692 # Invoked by eval'ing the libtool variable
cannam@140 3693 # $sharedlib_from_linklib_cmd
cannam@140 3694 # Result is available in the variable
cannam@140 3695 # $sharedlib_from_linklib_result
cannam@140 3696 func_cygming_dll_for_implib_fallback ()
cannam@140 3697 {
cannam@140 3698 $opt_debug
cannam@140 3699 if func_cygming_gnu_implib_p "$1" ; then
cannam@140 3700 # binutils import library
cannam@140 3701 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
cannam@140 3702 elif func_cygming_ms_implib_p "$1" ; then
cannam@140 3703 # ms-generated import library
cannam@140 3704 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
cannam@140 3705 else
cannam@140 3706 # unknown
cannam@140 3707 sharedlib_from_linklib_result=""
cannam@140 3708 fi
cannam@140 3709 }
cannam@140 3710
cannam@140 3711
cannam@140 3712 # func_extract_an_archive dir oldlib
cannam@140 3713 func_extract_an_archive ()
cannam@140 3714 {
cannam@140 3715 $opt_debug
cannam@140 3716 f_ex_an_ar_dir="$1"; shift
cannam@140 3717 f_ex_an_ar_oldlib="$1"
cannam@140 3718 if test "$lock_old_archive_extraction" = yes; then
cannam@140 3719 lockfile=$f_ex_an_ar_oldlib.lock
cannam@140 3720 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
cannam@140 3721 func_echo "Waiting for $lockfile to be removed"
cannam@140 3722 sleep 2
cannam@140 3723 done
cannam@140 3724 fi
cannam@140 3725 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
cannam@140 3726 'stat=$?; rm -f "$lockfile"; exit $stat'
cannam@140 3727 if test "$lock_old_archive_extraction" = yes; then
cannam@140 3728 $opt_dry_run || rm -f "$lockfile"
cannam@140 3729 fi
cannam@140 3730 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
cannam@140 3731 :
cannam@140 3732 else
cannam@140 3733 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
cannam@140 3734 fi
cannam@140 3735 }
cannam@140 3736
cannam@140 3737
cannam@140 3738 # func_extract_archives gentop oldlib ...
cannam@140 3739 func_extract_archives ()
cannam@140 3740 {
cannam@140 3741 $opt_debug
cannam@140 3742 my_gentop="$1"; shift
cannam@140 3743 my_oldlibs=${1+"$@"}
cannam@140 3744 my_oldobjs=""
cannam@140 3745 my_xlib=""
cannam@140 3746 my_xabs=""
cannam@140 3747 my_xdir=""
cannam@140 3748
cannam@140 3749 for my_xlib in $my_oldlibs; do
cannam@140 3750 # Extract the objects.
cannam@140 3751 case $my_xlib in
cannam@140 3752 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
cannam@140 3753 *) my_xabs=`pwd`"/$my_xlib" ;;
cannam@140 3754 esac
cannam@140 3755 func_basename "$my_xlib"
cannam@140 3756 my_xlib="$func_basename_result"
cannam@140 3757 my_xlib_u=$my_xlib
cannam@140 3758 while :; do
cannam@140 3759 case " $extracted_archives " in
cannam@140 3760 *" $my_xlib_u "*)
cannam@140 3761 func_arith $extracted_serial + 1
cannam@140 3762 extracted_serial=$func_arith_result
cannam@140 3763 my_xlib_u=lt$extracted_serial-$my_xlib ;;
cannam@140 3764 *) break ;;
cannam@140 3765 esac
cannam@140 3766 done
cannam@140 3767 extracted_archives="$extracted_archives $my_xlib_u"
cannam@140 3768 my_xdir="$my_gentop/$my_xlib_u"
cannam@140 3769
cannam@140 3770 func_mkdir_p "$my_xdir"
cannam@140 3771
cannam@140 3772 case $host in
cannam@140 3773 *-darwin*)
cannam@140 3774 func_verbose "Extracting $my_xabs"
cannam@140 3775 # Do not bother doing anything if just a dry run
cannam@140 3776 $opt_dry_run || {
cannam@140 3777 darwin_orig_dir=`pwd`
cannam@140 3778 cd $my_xdir || exit $?
cannam@140 3779 darwin_archive=$my_xabs
cannam@140 3780 darwin_curdir=`pwd`
cannam@140 3781 darwin_base_archive=`basename "$darwin_archive"`
cannam@140 3782 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
cannam@140 3783 if test -n "$darwin_arches"; then
cannam@140 3784 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
cannam@140 3785 darwin_arch=
cannam@140 3786 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
cannam@140 3787 for darwin_arch in $darwin_arches ; do
cannam@140 3788 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
cannam@140 3789 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
cannam@140 3790 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
cannam@140 3791 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
cannam@140 3792 cd "$darwin_curdir"
cannam@140 3793 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
cannam@140 3794 done # $darwin_arches
cannam@140 3795 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
cannam@140 3796 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
cannam@140 3797 darwin_file=
cannam@140 3798 darwin_files=
cannam@140 3799 for darwin_file in $darwin_filelist; do
cannam@140 3800 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
cannam@140 3801 $LIPO -create -output "$darwin_file" $darwin_files
cannam@140 3802 done # $darwin_filelist
cannam@140 3803 $RM -rf unfat-$$
cannam@140 3804 cd "$darwin_orig_dir"
cannam@140 3805 else
cannam@140 3806 cd $darwin_orig_dir
cannam@140 3807 func_extract_an_archive "$my_xdir" "$my_xabs"
cannam@140 3808 fi # $darwin_arches
cannam@140 3809 } # !$opt_dry_run
cannam@140 3810 ;;
cannam@140 3811 *)
cannam@140 3812 func_extract_an_archive "$my_xdir" "$my_xabs"
cannam@140 3813 ;;
cannam@140 3814 esac
cannam@140 3815 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
cannam@140 3816 done
cannam@140 3817
cannam@140 3818 func_extract_archives_result="$my_oldobjs"
cannam@140 3819 }
cannam@140 3820
cannam@140 3821
cannam@140 3822 # func_emit_wrapper [arg=no]
cannam@140 3823 #
cannam@140 3824 # Emit a libtool wrapper script on stdout.
cannam@140 3825 # Don't directly open a file because we may want to
cannam@140 3826 # incorporate the script contents within a cygwin/mingw
cannam@140 3827 # wrapper executable. Must ONLY be called from within
cannam@140 3828 # func_mode_link because it depends on a number of variables
cannam@140 3829 # set therein.
cannam@140 3830 #
cannam@140 3831 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
cannam@140 3832 # variable will take. If 'yes', then the emitted script
cannam@140 3833 # will assume that the directory in which it is stored is
cannam@140 3834 # the $objdir directory. This is a cygwin/mingw-specific
cannam@140 3835 # behavior.
cannam@140 3836 func_emit_wrapper ()
cannam@140 3837 {
cannam@140 3838 func_emit_wrapper_arg1=${1-no}
cannam@140 3839
cannam@140 3840 $ECHO "\
cannam@140 3841 #! $SHELL
cannam@140 3842
cannam@140 3843 # $output - temporary wrapper script for $objdir/$outputname
cannam@140 3844 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
cannam@140 3845 #
cannam@140 3846 # The $output program cannot be directly executed until all the libtool
cannam@140 3847 # libraries that it depends on are installed.
cannam@140 3848 #
cannam@140 3849 # This wrapper script should never be moved out of the build directory.
cannam@140 3850 # If it is, it will not operate correctly.
cannam@140 3851
cannam@140 3852 # Sed substitution that helps us do robust quoting. It backslashifies
cannam@140 3853 # metacharacters that are still active within double-quoted strings.
cannam@140 3854 sed_quote_subst='$sed_quote_subst'
cannam@140 3855
cannam@140 3856 # Be Bourne compatible
cannam@140 3857 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
cannam@140 3858 emulate sh
cannam@140 3859 NULLCMD=:
cannam@140 3860 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
cannam@140 3861 # is contrary to our usage. Disable this feature.
cannam@140 3862 alias -g '\${1+\"\$@\"}'='\"\$@\"'
cannam@140 3863 setopt NO_GLOB_SUBST
cannam@140 3864 else
cannam@140 3865 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
cannam@140 3866 fi
cannam@140 3867 BIN_SH=xpg4; export BIN_SH # for Tru64
cannam@140 3868 DUALCASE=1; export DUALCASE # for MKS sh
cannam@140 3869
cannam@140 3870 # The HP-UX ksh and POSIX shell print the target directory to stdout
cannam@140 3871 # if CDPATH is set.
cannam@140 3872 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
cannam@140 3873
cannam@140 3874 relink_command=\"$relink_command\"
cannam@140 3875
cannam@140 3876 # This environment variable determines our operation mode.
cannam@140 3877 if test \"\$libtool_install_magic\" = \"$magic\"; then
cannam@140 3878 # install mode needs the following variables:
cannam@140 3879 generated_by_libtool_version='$macro_version'
cannam@140 3880 notinst_deplibs='$notinst_deplibs'
cannam@140 3881 else
cannam@140 3882 # When we are sourced in execute mode, \$file and \$ECHO are already set.
cannam@140 3883 if test \"\$libtool_execute_magic\" != \"$magic\"; then
cannam@140 3884 file=\"\$0\""
cannam@140 3885
cannam@140 3886 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
cannam@140 3887 $ECHO "\
cannam@140 3888
cannam@140 3889 # A function that is used when there is no print builtin or printf.
cannam@140 3890 func_fallback_echo ()
cannam@140 3891 {
cannam@140 3892 eval 'cat <<_LTECHO_EOF
cannam@140 3893 \$1
cannam@140 3894 _LTECHO_EOF'
cannam@140 3895 }
cannam@140 3896 ECHO=\"$qECHO\"
cannam@140 3897 fi
cannam@140 3898
cannam@140 3899 # Very basic option parsing. These options are (a) specific to
cannam@140 3900 # the libtool wrapper, (b) are identical between the wrapper
cannam@140 3901 # /script/ and the wrapper /executable/ which is used only on
cannam@140 3902 # windows platforms, and (c) all begin with the string "--lt-"
cannam@140 3903 # (application programs are unlikely to have options which match
cannam@140 3904 # this pattern).
cannam@140 3905 #
cannam@140 3906 # There are only two supported options: --lt-debug and
cannam@140 3907 # --lt-dump-script. There is, deliberately, no --lt-help.
cannam@140 3908 #
cannam@140 3909 # The first argument to this parsing function should be the
cannam@140 3910 # script's $0 value, followed by "$@".
cannam@140 3911 lt_option_debug=
cannam@140 3912 func_parse_lt_options ()
cannam@140 3913 {
cannam@140 3914 lt_script_arg0=\$0
cannam@140 3915 shift
cannam@140 3916 for lt_opt
cannam@140 3917 do
cannam@140 3918 case \"\$lt_opt\" in
cannam@140 3919 --lt-debug) lt_option_debug=1 ;;
cannam@140 3920 --lt-dump-script)
cannam@140 3921 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
cannam@140 3922 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
cannam@140 3923 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
cannam@140 3924 cat \"\$lt_dump_D/\$lt_dump_F\"
cannam@140 3925 exit 0
cannam@140 3926 ;;
cannam@140 3927 --lt-*)
cannam@140 3928 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
cannam@140 3929 exit 1
cannam@140 3930 ;;
cannam@140 3931 esac
cannam@140 3932 done
cannam@140 3933
cannam@140 3934 # Print the debug banner immediately:
cannam@140 3935 if test -n \"\$lt_option_debug\"; then
cannam@140 3936 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
cannam@140 3937 fi
cannam@140 3938 }
cannam@140 3939
cannam@140 3940 # Used when --lt-debug. Prints its arguments to stdout
cannam@140 3941 # (redirection is the responsibility of the caller)
cannam@140 3942 func_lt_dump_args ()
cannam@140 3943 {
cannam@140 3944 lt_dump_args_N=1;
cannam@140 3945 for lt_arg
cannam@140 3946 do
cannam@140 3947 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
cannam@140 3948 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
cannam@140 3949 done
cannam@140 3950 }
cannam@140 3951
cannam@140 3952 # Core function for launching the target application
cannam@140 3953 func_exec_program_core ()
cannam@140 3954 {
cannam@140 3955 "
cannam@140 3956 case $host in
cannam@140 3957 # Backslashes separate directories on plain windows
cannam@140 3958 *-*-mingw | *-*-os2* | *-cegcc*)
cannam@140 3959 $ECHO "\
cannam@140 3960 if test -n \"\$lt_option_debug\"; then
cannam@140 3961 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
cannam@140 3962 func_lt_dump_args \${1+\"\$@\"} 1>&2
cannam@140 3963 fi
cannam@140 3964 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
cannam@140 3965 "
cannam@140 3966 ;;
cannam@140 3967
cannam@140 3968 *)
cannam@140 3969 $ECHO "\
cannam@140 3970 if test -n \"\$lt_option_debug\"; then
cannam@140 3971 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
cannam@140 3972 func_lt_dump_args \${1+\"\$@\"} 1>&2
cannam@140 3973 fi
cannam@140 3974 exec \"\$progdir/\$program\" \${1+\"\$@\"}
cannam@140 3975 "
cannam@140 3976 ;;
cannam@140 3977 esac
cannam@140 3978 $ECHO "\
cannam@140 3979 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
cannam@140 3980 exit 1
cannam@140 3981 }
cannam@140 3982
cannam@140 3983 # A function to encapsulate launching the target application
cannam@140 3984 # Strips options in the --lt-* namespace from \$@ and
cannam@140 3985 # launches target application with the remaining arguments.
cannam@140 3986 func_exec_program ()
cannam@140 3987 {
cannam@140 3988 case \" \$* \" in
cannam@140 3989 *\\ --lt-*)
cannam@140 3990 for lt_wr_arg
cannam@140 3991 do
cannam@140 3992 case \$lt_wr_arg in
cannam@140 3993 --lt-*) ;;
cannam@140 3994 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
cannam@140 3995 esac
cannam@140 3996 shift
cannam@140 3997 done ;;
cannam@140 3998 esac
cannam@140 3999 func_exec_program_core \${1+\"\$@\"}
cannam@140 4000 }
cannam@140 4001
cannam@140 4002 # Parse options
cannam@140 4003 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
cannam@140 4004
cannam@140 4005 # Find the directory that this script lives in.
cannam@140 4006 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
cannam@140 4007 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
cannam@140 4008
cannam@140 4009 # Follow symbolic links until we get to the real thisdir.
cannam@140 4010 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
cannam@140 4011 while test -n \"\$file\"; do
cannam@140 4012 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
cannam@140 4013
cannam@140 4014 # If there was a directory component, then change thisdir.
cannam@140 4015 if test \"x\$destdir\" != \"x\$file\"; then
cannam@140 4016 case \"\$destdir\" in
cannam@140 4017 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
cannam@140 4018 *) thisdir=\"\$thisdir/\$destdir\" ;;
cannam@140 4019 esac
cannam@140 4020 fi
cannam@140 4021
cannam@140 4022 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
cannam@140 4023 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
cannam@140 4024 done
cannam@140 4025
cannam@140 4026 # Usually 'no', except on cygwin/mingw when embedded into
cannam@140 4027 # the cwrapper.
cannam@140 4028 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
cannam@140 4029 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
cannam@140 4030 # special case for '.'
cannam@140 4031 if test \"\$thisdir\" = \".\"; then
cannam@140 4032 thisdir=\`pwd\`
cannam@140 4033 fi
cannam@140 4034 # remove .libs from thisdir
cannam@140 4035 case \"\$thisdir\" in
cannam@140 4036 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
cannam@140 4037 $objdir ) thisdir=. ;;
cannam@140 4038 esac
cannam@140 4039 fi
cannam@140 4040
cannam@140 4041 # Try to get the absolute directory name.
cannam@140 4042 absdir=\`cd \"\$thisdir\" && pwd\`
cannam@140 4043 test -n \"\$absdir\" && thisdir=\"\$absdir\"
cannam@140 4044 "
cannam@140 4045
cannam@140 4046 if test "$fast_install" = yes; then
cannam@140 4047 $ECHO "\
cannam@140 4048 program=lt-'$outputname'$exeext
cannam@140 4049 progdir=\"\$thisdir/$objdir\"
cannam@140 4050
cannam@140 4051 if test ! -f \"\$progdir/\$program\" ||
cannam@140 4052 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
cannam@140 4053 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
cannam@140 4054
cannam@140 4055 file=\"\$\$-\$program\"
cannam@140 4056
cannam@140 4057 if test ! -d \"\$progdir\"; then
cannam@140 4058 $MKDIR \"\$progdir\"
cannam@140 4059 else
cannam@140 4060 $RM \"\$progdir/\$file\"
cannam@140 4061 fi"
cannam@140 4062
cannam@140 4063 $ECHO "\
cannam@140 4064
cannam@140 4065 # relink executable if necessary
cannam@140 4066 if test -n \"\$relink_command\"; then
cannam@140 4067 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
cannam@140 4068 else
cannam@140 4069 $ECHO \"\$relink_command_output\" >&2
cannam@140 4070 $RM \"\$progdir/\$file\"
cannam@140 4071 exit 1
cannam@140 4072 fi
cannam@140 4073 fi
cannam@140 4074
cannam@140 4075 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
cannam@140 4076 { $RM \"\$progdir/\$program\";
cannam@140 4077 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
cannam@140 4078 $RM \"\$progdir/\$file\"
cannam@140 4079 fi"
cannam@140 4080 else
cannam@140 4081 $ECHO "\
cannam@140 4082 program='$outputname'
cannam@140 4083 progdir=\"\$thisdir/$objdir\"
cannam@140 4084 "
cannam@140 4085 fi
cannam@140 4086
cannam@140 4087 $ECHO "\
cannam@140 4088
cannam@140 4089 if test -f \"\$progdir/\$program\"; then"
cannam@140 4090
cannam@140 4091 # fixup the dll searchpath if we need to.
cannam@140 4092 #
cannam@140 4093 # Fix the DLL searchpath if we need to. Do this before prepending
cannam@140 4094 # to shlibpath, because on Windows, both are PATH and uninstalled
cannam@140 4095 # libraries must come first.
cannam@140 4096 if test -n "$dllsearchpath"; then
cannam@140 4097 $ECHO "\
cannam@140 4098 # Add the dll search path components to the executable PATH
cannam@140 4099 PATH=$dllsearchpath:\$PATH
cannam@140 4100 "
cannam@140 4101 fi
cannam@140 4102
cannam@140 4103 # Export our shlibpath_var if we have one.
cannam@140 4104 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
cannam@140 4105 $ECHO "\
cannam@140 4106 # Add our own library path to $shlibpath_var
cannam@140 4107 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
cannam@140 4108
cannam@140 4109 # Some systems cannot cope with colon-terminated $shlibpath_var
cannam@140 4110 # The second colon is a workaround for a bug in BeOS R4 sed
cannam@140 4111 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
cannam@140 4112
cannam@140 4113 export $shlibpath_var
cannam@140 4114 "
cannam@140 4115 fi
cannam@140 4116
cannam@140 4117 $ECHO "\
cannam@140 4118 if test \"\$libtool_execute_magic\" != \"$magic\"; then
cannam@140 4119 # Run the actual program with our arguments.
cannam@140 4120 func_exec_program \${1+\"\$@\"}
cannam@140 4121 fi
cannam@140 4122 else
cannam@140 4123 # The program doesn't exist.
cannam@140 4124 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
cannam@140 4125 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
cannam@140 4126 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
cannam@140 4127 exit 1
cannam@140 4128 fi
cannam@140 4129 fi\
cannam@140 4130 "
cannam@140 4131 }
cannam@140 4132
cannam@140 4133
cannam@140 4134 # func_emit_cwrapperexe_src
cannam@140 4135 # emit the source code for a wrapper executable on stdout
cannam@140 4136 # Must ONLY be called from within func_mode_link because
cannam@140 4137 # it depends on a number of variable set therein.
cannam@140 4138 func_emit_cwrapperexe_src ()
cannam@140 4139 {
cannam@140 4140 cat <<EOF
cannam@140 4141
cannam@140 4142 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
cannam@140 4143 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
cannam@140 4144
cannam@140 4145 The $output program cannot be directly executed until all the libtool
cannam@140 4146 libraries that it depends on are installed.
cannam@140 4147
cannam@140 4148 This wrapper executable should never be moved out of the build directory.
cannam@140 4149 If it is, it will not operate correctly.
cannam@140 4150 */
cannam@140 4151 EOF
cannam@140 4152 cat <<"EOF"
cannam@140 4153 #ifdef _MSC_VER
cannam@140 4154 # define _CRT_SECURE_NO_DEPRECATE 1
cannam@140 4155 #endif
cannam@140 4156 #include <stdio.h>
cannam@140 4157 #include <stdlib.h>
cannam@140 4158 #ifdef _MSC_VER
cannam@140 4159 # include <direct.h>
cannam@140 4160 # include <process.h>
cannam@140 4161 # include <io.h>
cannam@140 4162 #else
cannam@140 4163 # include <unistd.h>
cannam@140 4164 # include <stdint.h>
cannam@140 4165 # ifdef __CYGWIN__
cannam@140 4166 # include <io.h>
cannam@140 4167 # endif
cannam@140 4168 #endif
cannam@140 4169 #include <malloc.h>
cannam@140 4170 #include <stdarg.h>
cannam@140 4171 #include <assert.h>
cannam@140 4172 #include <string.h>
cannam@140 4173 #include <ctype.h>
cannam@140 4174 #include <errno.h>
cannam@140 4175 #include <fcntl.h>
cannam@140 4176 #include <sys/stat.h>
cannam@140 4177
cannam@140 4178 /* declarations of non-ANSI functions */
cannam@140 4179 #if defined(__MINGW32__)
cannam@140 4180 # ifdef __STRICT_ANSI__
cannam@140 4181 int _putenv (const char *);
cannam@140 4182 # endif
cannam@140 4183 #elif defined(__CYGWIN__)
cannam@140 4184 # ifdef __STRICT_ANSI__
cannam@140 4185 char *realpath (const char *, char *);
cannam@140 4186 int putenv (char *);
cannam@140 4187 int setenv (const char *, const char *, int);
cannam@140 4188 # endif
cannam@140 4189 /* #elif defined (other platforms) ... */
cannam@140 4190 #endif
cannam@140 4191
cannam@140 4192 /* portability defines, excluding path handling macros */
cannam@140 4193 #if defined(_MSC_VER)
cannam@140 4194 # define setmode _setmode
cannam@140 4195 # define stat _stat
cannam@140 4196 # define chmod _chmod
cannam@140 4197 # define getcwd _getcwd
cannam@140 4198 # define putenv _putenv
cannam@140 4199 # define S_IXUSR _S_IEXEC
cannam@140 4200 # ifndef _INTPTR_T_DEFINED
cannam@140 4201 # define _INTPTR_T_DEFINED
cannam@140 4202 # define intptr_t int
cannam@140 4203 # endif
cannam@140 4204 #elif defined(__MINGW32__)
cannam@140 4205 # define setmode _setmode
cannam@140 4206 # define stat _stat
cannam@140 4207 # define chmod _chmod
cannam@140 4208 # define getcwd _getcwd
cannam@140 4209 # define putenv _putenv
cannam@140 4210 #elif defined(__CYGWIN__)
cannam@140 4211 # define HAVE_SETENV
cannam@140 4212 # define FOPEN_WB "wb"
cannam@140 4213 /* #elif defined (other platforms) ... */
cannam@140 4214 #endif
cannam@140 4215
cannam@140 4216 #if defined(PATH_MAX)
cannam@140 4217 # define LT_PATHMAX PATH_MAX
cannam@140 4218 #elif defined(MAXPATHLEN)
cannam@140 4219 # define LT_PATHMAX MAXPATHLEN
cannam@140 4220 #else
cannam@140 4221 # define LT_PATHMAX 1024
cannam@140 4222 #endif
cannam@140 4223
cannam@140 4224 #ifndef S_IXOTH
cannam@140 4225 # define S_IXOTH 0
cannam@140 4226 #endif
cannam@140 4227 #ifndef S_IXGRP
cannam@140 4228 # define S_IXGRP 0
cannam@140 4229 #endif
cannam@140 4230
cannam@140 4231 /* path handling portability macros */
cannam@140 4232 #ifndef DIR_SEPARATOR
cannam@140 4233 # define DIR_SEPARATOR '/'
cannam@140 4234 # define PATH_SEPARATOR ':'
cannam@140 4235 #endif
cannam@140 4236
cannam@140 4237 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
cannam@140 4238 defined (__OS2__)
cannam@140 4239 # define HAVE_DOS_BASED_FILE_SYSTEM
cannam@140 4240 # define FOPEN_WB "wb"
cannam@140 4241 # ifndef DIR_SEPARATOR_2
cannam@140 4242 # define DIR_SEPARATOR_2 '\\'
cannam@140 4243 # endif
cannam@140 4244 # ifndef PATH_SEPARATOR_2
cannam@140 4245 # define PATH_SEPARATOR_2 ';'
cannam@140 4246 # endif
cannam@140 4247 #endif
cannam@140 4248
cannam@140 4249 #ifndef DIR_SEPARATOR_2
cannam@140 4250 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
cannam@140 4251 #else /* DIR_SEPARATOR_2 */
cannam@140 4252 # define IS_DIR_SEPARATOR(ch) \
cannam@140 4253 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
cannam@140 4254 #endif /* DIR_SEPARATOR_2 */
cannam@140 4255
cannam@140 4256 #ifndef PATH_SEPARATOR_2
cannam@140 4257 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
cannam@140 4258 #else /* PATH_SEPARATOR_2 */
cannam@140 4259 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
cannam@140 4260 #endif /* PATH_SEPARATOR_2 */
cannam@140 4261
cannam@140 4262 #ifndef FOPEN_WB
cannam@140 4263 # define FOPEN_WB "w"
cannam@140 4264 #endif
cannam@140 4265 #ifndef _O_BINARY
cannam@140 4266 # define _O_BINARY 0
cannam@140 4267 #endif
cannam@140 4268
cannam@140 4269 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
cannam@140 4270 #define XFREE(stale) do { \
cannam@140 4271 if (stale) { free ((void *) stale); stale = 0; } \
cannam@140 4272 } while (0)
cannam@140 4273
cannam@140 4274 #if defined(LT_DEBUGWRAPPER)
cannam@140 4275 static int lt_debug = 1;
cannam@140 4276 #else
cannam@140 4277 static int lt_debug = 0;
cannam@140 4278 #endif
cannam@140 4279
cannam@140 4280 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
cannam@140 4281
cannam@140 4282 void *xmalloc (size_t num);
cannam@140 4283 char *xstrdup (const char *string);
cannam@140 4284 const char *base_name (const char *name);
cannam@140 4285 char *find_executable (const char *wrapper);
cannam@140 4286 char *chase_symlinks (const char *pathspec);
cannam@140 4287 int make_executable (const char *path);
cannam@140 4288 int check_executable (const char *path);
cannam@140 4289 char *strendzap (char *str, const char *pat);
cannam@140 4290 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
cannam@140 4291 void lt_fatal (const char *file, int line, const char *message, ...);
cannam@140 4292 static const char *nonnull (const char *s);
cannam@140 4293 static const char *nonempty (const char *s);
cannam@140 4294 void lt_setenv (const char *name, const char *value);
cannam@140 4295 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
cannam@140 4296 void lt_update_exe_path (const char *name, const char *value);
cannam@140 4297 void lt_update_lib_path (const char *name, const char *value);
cannam@140 4298 char **prepare_spawn (char **argv);
cannam@140 4299 void lt_dump_script (FILE *f);
cannam@140 4300 EOF
cannam@140 4301
cannam@140 4302 cat <<EOF
cannam@140 4303 volatile const char * MAGIC_EXE = "$magic_exe";
cannam@140 4304 const char * LIB_PATH_VARNAME = "$shlibpath_var";
cannam@140 4305 EOF
cannam@140 4306
cannam@140 4307 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
cannam@140 4308 func_to_host_path "$temp_rpath"
cannam@140 4309 cat <<EOF
cannam@140 4310 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
cannam@140 4311 EOF
cannam@140 4312 else
cannam@140 4313 cat <<"EOF"
cannam@140 4314 const char * LIB_PATH_VALUE = "";
cannam@140 4315 EOF
cannam@140 4316 fi
cannam@140 4317
cannam@140 4318 if test -n "$dllsearchpath"; then
cannam@140 4319 func_to_host_path "$dllsearchpath:"
cannam@140 4320 cat <<EOF
cannam@140 4321 const char * EXE_PATH_VARNAME = "PATH";
cannam@140 4322 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
cannam@140 4323 EOF
cannam@140 4324 else
cannam@140 4325 cat <<"EOF"
cannam@140 4326 const char * EXE_PATH_VARNAME = "";
cannam@140 4327 const char * EXE_PATH_VALUE = "";
cannam@140 4328 EOF
cannam@140 4329 fi
cannam@140 4330
cannam@140 4331 if test "$fast_install" = yes; then
cannam@140 4332 cat <<EOF
cannam@140 4333 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
cannam@140 4334 EOF
cannam@140 4335 else
cannam@140 4336 cat <<EOF
cannam@140 4337 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
cannam@140 4338 EOF
cannam@140 4339 fi
cannam@140 4340
cannam@140 4341
cannam@140 4342 cat <<"EOF"
cannam@140 4343
cannam@140 4344 #define LTWRAPPER_OPTION_PREFIX "--lt-"
cannam@140 4345
cannam@140 4346 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
cannam@140 4347 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
cannam@140 4348 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
cannam@140 4349
cannam@140 4350 int
cannam@140 4351 main (int argc, char *argv[])
cannam@140 4352 {
cannam@140 4353 char **newargz;
cannam@140 4354 int newargc;
cannam@140 4355 char *tmp_pathspec;
cannam@140 4356 char *actual_cwrapper_path;
cannam@140 4357 char *actual_cwrapper_name;
cannam@140 4358 char *target_name;
cannam@140 4359 char *lt_argv_zero;
cannam@140 4360 intptr_t rval = 127;
cannam@140 4361
cannam@140 4362 int i;
cannam@140 4363
cannam@140 4364 program_name = (char *) xstrdup (base_name (argv[0]));
cannam@140 4365 newargz = XMALLOC (char *, argc + 1);
cannam@140 4366
cannam@140 4367 /* very simple arg parsing; don't want to rely on getopt
cannam@140 4368 * also, copy all non cwrapper options to newargz, except
cannam@140 4369 * argz[0], which is handled differently
cannam@140 4370 */
cannam@140 4371 newargc=0;
cannam@140 4372 for (i = 1; i < argc; i++)
cannam@140 4373 {
cannam@140 4374 if (strcmp (argv[i], dumpscript_opt) == 0)
cannam@140 4375 {
cannam@140 4376 EOF
cannam@140 4377 case "$host" in
cannam@140 4378 *mingw* | *cygwin* )
cannam@140 4379 # make stdout use "unix" line endings
cannam@140 4380 echo " setmode(1,_O_BINARY);"
cannam@140 4381 ;;
cannam@140 4382 esac
cannam@140 4383
cannam@140 4384 cat <<"EOF"
cannam@140 4385 lt_dump_script (stdout);
cannam@140 4386 return 0;
cannam@140 4387 }
cannam@140 4388 if (strcmp (argv[i], debug_opt) == 0)
cannam@140 4389 {
cannam@140 4390 lt_debug = 1;
cannam@140 4391 continue;
cannam@140 4392 }
cannam@140 4393 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
cannam@140 4394 {
cannam@140 4395 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
cannam@140 4396 namespace, but it is not one of the ones we know about and
cannam@140 4397 have already dealt with, above (inluding dump-script), then
cannam@140 4398 report an error. Otherwise, targets might begin to believe
cannam@140 4399 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
cannam@140 4400 namespace. The first time any user complains about this, we'll
cannam@140 4401 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
cannam@140 4402 or a configure.ac-settable value.
cannam@140 4403 */
cannam@140 4404 lt_fatal (__FILE__, __LINE__,
cannam@140 4405 "unrecognized %s option: '%s'",
cannam@140 4406 ltwrapper_option_prefix, argv[i]);
cannam@140 4407 }
cannam@140 4408 /* otherwise ... */
cannam@140 4409 newargz[++newargc] = xstrdup (argv[i]);
cannam@140 4410 }
cannam@140 4411 newargz[++newargc] = NULL;
cannam@140 4412
cannam@140 4413 EOF
cannam@140 4414 cat <<EOF
cannam@140 4415 /* The GNU banner must be the first non-error debug message */
cannam@140 4416 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
cannam@140 4417 EOF
cannam@140 4418 cat <<"EOF"
cannam@140 4419 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
cannam@140 4420 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
cannam@140 4421
cannam@140 4422 tmp_pathspec = find_executable (argv[0]);
cannam@140 4423 if (tmp_pathspec == NULL)
cannam@140 4424 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
cannam@140 4425 lt_debugprintf (__FILE__, __LINE__,
cannam@140 4426 "(main) found exe (before symlink chase) at: %s\n",
cannam@140 4427 tmp_pathspec);
cannam@140 4428
cannam@140 4429 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
cannam@140 4430 lt_debugprintf (__FILE__, __LINE__,
cannam@140 4431 "(main) found exe (after symlink chase) at: %s\n",
cannam@140 4432 actual_cwrapper_path);
cannam@140 4433 XFREE (tmp_pathspec);
cannam@140 4434
cannam@140 4435 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
cannam@140 4436 strendzap (actual_cwrapper_path, actual_cwrapper_name);
cannam@140 4437
cannam@140 4438 /* wrapper name transforms */
cannam@140 4439 strendzap (actual_cwrapper_name, ".exe");
cannam@140 4440 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
cannam@140 4441 XFREE (actual_cwrapper_name);
cannam@140 4442 actual_cwrapper_name = tmp_pathspec;
cannam@140 4443 tmp_pathspec = 0;
cannam@140 4444
cannam@140 4445 /* target_name transforms -- use actual target program name; might have lt- prefix */
cannam@140 4446 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
cannam@140 4447 strendzap (target_name, ".exe");
cannam@140 4448 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
cannam@140 4449 XFREE (target_name);
cannam@140 4450 target_name = tmp_pathspec;
cannam@140 4451 tmp_pathspec = 0;
cannam@140 4452
cannam@140 4453 lt_debugprintf (__FILE__, __LINE__,
cannam@140 4454 "(main) libtool target name: %s\n",
cannam@140 4455 target_name);
cannam@140 4456 EOF
cannam@140 4457
cannam@140 4458 cat <<EOF
cannam@140 4459 newargz[0] =
cannam@140 4460 XMALLOC (char, (strlen (actual_cwrapper_path) +
cannam@140 4461 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
cannam@140 4462 strcpy (newargz[0], actual_cwrapper_path);
cannam@140 4463 strcat (newargz[0], "$objdir");
cannam@140 4464 strcat (newargz[0], "/");
cannam@140 4465 EOF
cannam@140 4466
cannam@140 4467 cat <<"EOF"
cannam@140 4468 /* stop here, and copy so we don't have to do this twice */
cannam@140 4469 tmp_pathspec = xstrdup (newargz[0]);
cannam@140 4470
cannam@140 4471 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
cannam@140 4472 strcat (newargz[0], actual_cwrapper_name);
cannam@140 4473
cannam@140 4474 /* DO want the lt- prefix here if it exists, so use target_name */
cannam@140 4475 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
cannam@140 4476 XFREE (tmp_pathspec);
cannam@140 4477 tmp_pathspec = NULL;
cannam@140 4478 EOF
cannam@140 4479
cannam@140 4480 case $host_os in
cannam@140 4481 mingw*)
cannam@140 4482 cat <<"EOF"
cannam@140 4483 {
cannam@140 4484 char* p;
cannam@140 4485 while ((p = strchr (newargz[0], '\\')) != NULL)
cannam@140 4486 {
cannam@140 4487 *p = '/';
cannam@140 4488 }
cannam@140 4489 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
cannam@140 4490 {
cannam@140 4491 *p = '/';
cannam@140 4492 }
cannam@140 4493 }
cannam@140 4494 EOF
cannam@140 4495 ;;
cannam@140 4496 esac
cannam@140 4497
cannam@140 4498 cat <<"EOF"
cannam@140 4499 XFREE (target_name);
cannam@140 4500 XFREE (actual_cwrapper_path);
cannam@140 4501 XFREE (actual_cwrapper_name);
cannam@140 4502
cannam@140 4503 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
cannam@140 4504 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
cannam@140 4505 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
cannam@140 4506 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
cannam@140 4507 because on Windows, both *_VARNAMEs are PATH but uninstalled
cannam@140 4508 libraries must come first. */
cannam@140 4509 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
cannam@140 4510 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
cannam@140 4511
cannam@140 4512 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
cannam@140 4513 nonnull (lt_argv_zero));
cannam@140 4514 for (i = 0; i < newargc; i++)
cannam@140 4515 {
cannam@140 4516 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
cannam@140 4517 i, nonnull (newargz[i]));
cannam@140 4518 }
cannam@140 4519
cannam@140 4520 EOF
cannam@140 4521
cannam@140 4522 case $host_os in
cannam@140 4523 mingw*)
cannam@140 4524 cat <<"EOF"
cannam@140 4525 /* execv doesn't actually work on mingw as expected on unix */
cannam@140 4526 newargz = prepare_spawn (newargz);
cannam@140 4527 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
cannam@140 4528 if (rval == -1)
cannam@140 4529 {
cannam@140 4530 /* failed to start process */
cannam@140 4531 lt_debugprintf (__FILE__, __LINE__,
cannam@140 4532 "(main) failed to launch target \"%s\": %s\n",
cannam@140 4533 lt_argv_zero, nonnull (strerror (errno)));
cannam@140 4534 return 127;
cannam@140 4535 }
cannam@140 4536 return rval;
cannam@140 4537 EOF
cannam@140 4538 ;;
cannam@140 4539 *)
cannam@140 4540 cat <<"EOF"
cannam@140 4541 execv (lt_argv_zero, newargz);
cannam@140 4542 return rval; /* =127, but avoids unused variable warning */
cannam@140 4543 EOF
cannam@140 4544 ;;
cannam@140 4545 esac
cannam@140 4546
cannam@140 4547 cat <<"EOF"
cannam@140 4548 }
cannam@140 4549
cannam@140 4550 void *
cannam@140 4551 xmalloc (size_t num)
cannam@140 4552 {
cannam@140 4553 void *p = (void *) malloc (num);
cannam@140 4554 if (!p)
cannam@140 4555 lt_fatal (__FILE__, __LINE__, "memory exhausted");
cannam@140 4556
cannam@140 4557 return p;
cannam@140 4558 }
cannam@140 4559
cannam@140 4560 char *
cannam@140 4561 xstrdup (const char *string)
cannam@140 4562 {
cannam@140 4563 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
cannam@140 4564 string) : NULL;
cannam@140 4565 }
cannam@140 4566
cannam@140 4567 const char *
cannam@140 4568 base_name (const char *name)
cannam@140 4569 {
cannam@140 4570 const char *base;
cannam@140 4571
cannam@140 4572 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
cannam@140 4573 /* Skip over the disk name in MSDOS pathnames. */
cannam@140 4574 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
cannam@140 4575 name += 2;
cannam@140 4576 #endif
cannam@140 4577
cannam@140 4578 for (base = name; *name; name++)
cannam@140 4579 if (IS_DIR_SEPARATOR (*name))
cannam@140 4580 base = name + 1;
cannam@140 4581 return base;
cannam@140 4582 }
cannam@140 4583
cannam@140 4584 int
cannam@140 4585 check_executable (const char *path)
cannam@140 4586 {
cannam@140 4587 struct stat st;
cannam@140 4588
cannam@140 4589 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
cannam@140 4590 nonempty (path));
cannam@140 4591 if ((!path) || (!*path))
cannam@140 4592 return 0;
cannam@140 4593
cannam@140 4594 if ((stat (path, &st) >= 0)
cannam@140 4595 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
cannam@140 4596 return 1;
cannam@140 4597 else
cannam@140 4598 return 0;
cannam@140 4599 }
cannam@140 4600
cannam@140 4601 int
cannam@140 4602 make_executable (const char *path)
cannam@140 4603 {
cannam@140 4604 int rval = 0;
cannam@140 4605 struct stat st;
cannam@140 4606
cannam@140 4607 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
cannam@140 4608 nonempty (path));
cannam@140 4609 if ((!path) || (!*path))
cannam@140 4610 return 0;
cannam@140 4611
cannam@140 4612 if (stat (path, &st) >= 0)
cannam@140 4613 {
cannam@140 4614 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
cannam@140 4615 }
cannam@140 4616 return rval;
cannam@140 4617 }
cannam@140 4618
cannam@140 4619 /* Searches for the full path of the wrapper. Returns
cannam@140 4620 newly allocated full path name if found, NULL otherwise
cannam@140 4621 Does not chase symlinks, even on platforms that support them.
cannam@140 4622 */
cannam@140 4623 char *
cannam@140 4624 find_executable (const char *wrapper)
cannam@140 4625 {
cannam@140 4626 int has_slash = 0;
cannam@140 4627 const char *p;
cannam@140 4628 const char *p_next;
cannam@140 4629 /* static buffer for getcwd */
cannam@140 4630 char tmp[LT_PATHMAX + 1];
cannam@140 4631 int tmp_len;
cannam@140 4632 char *concat_name;
cannam@140 4633
cannam@140 4634 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
cannam@140 4635 nonempty (wrapper));
cannam@140 4636
cannam@140 4637 if ((wrapper == NULL) || (*wrapper == '\0'))
cannam@140 4638 return NULL;
cannam@140 4639
cannam@140 4640 /* Absolute path? */
cannam@140 4641 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
cannam@140 4642 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
cannam@140 4643 {
cannam@140 4644 concat_name = xstrdup (wrapper);
cannam@140 4645 if (check_executable (concat_name))
cannam@140 4646 return concat_name;
cannam@140 4647 XFREE (concat_name);
cannam@140 4648 }
cannam@140 4649 else
cannam@140 4650 {
cannam@140 4651 #endif
cannam@140 4652 if (IS_DIR_SEPARATOR (wrapper[0]))
cannam@140 4653 {
cannam@140 4654 concat_name = xstrdup (wrapper);
cannam@140 4655 if (check_executable (concat_name))
cannam@140 4656 return concat_name;
cannam@140 4657 XFREE (concat_name);
cannam@140 4658 }
cannam@140 4659 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
cannam@140 4660 }
cannam@140 4661 #endif
cannam@140 4662
cannam@140 4663 for (p = wrapper; *p; p++)
cannam@140 4664 if (*p == '/')
cannam@140 4665 {
cannam@140 4666 has_slash = 1;
cannam@140 4667 break;
cannam@140 4668 }
cannam@140 4669 if (!has_slash)
cannam@140 4670 {
cannam@140 4671 /* no slashes; search PATH */
cannam@140 4672 const char *path = getenv ("PATH");
cannam@140 4673 if (path != NULL)
cannam@140 4674 {
cannam@140 4675 for (p = path; *p; p = p_next)
cannam@140 4676 {
cannam@140 4677 const char *q;
cannam@140 4678 size_t p_len;
cannam@140 4679 for (q = p; *q; q++)
cannam@140 4680 if (IS_PATH_SEPARATOR (*q))
cannam@140 4681 break;
cannam@140 4682 p_len = q - p;
cannam@140 4683 p_next = (*q == '\0' ? q : q + 1);
cannam@140 4684 if (p_len == 0)
cannam@140 4685 {
cannam@140 4686 /* empty path: current directory */
cannam@140 4687 if (getcwd (tmp, LT_PATHMAX) == NULL)
cannam@140 4688 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
cannam@140 4689 nonnull (strerror (errno)));
cannam@140 4690 tmp_len = strlen (tmp);
cannam@140 4691 concat_name =
cannam@140 4692 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
cannam@140 4693 memcpy (concat_name, tmp, tmp_len);
cannam@140 4694 concat_name[tmp_len] = '/';
cannam@140 4695 strcpy (concat_name + tmp_len + 1, wrapper);
cannam@140 4696 }
cannam@140 4697 else
cannam@140 4698 {
cannam@140 4699 concat_name =
cannam@140 4700 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
cannam@140 4701 memcpy (concat_name, p, p_len);
cannam@140 4702 concat_name[p_len] = '/';
cannam@140 4703 strcpy (concat_name + p_len + 1, wrapper);
cannam@140 4704 }
cannam@140 4705 if (check_executable (concat_name))
cannam@140 4706 return concat_name;
cannam@140 4707 XFREE (concat_name);
cannam@140 4708 }
cannam@140 4709 }
cannam@140 4710 /* not found in PATH; assume curdir */
cannam@140 4711 }
cannam@140 4712 /* Relative path | not found in path: prepend cwd */
cannam@140 4713 if (getcwd (tmp, LT_PATHMAX) == NULL)
cannam@140 4714 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
cannam@140 4715 nonnull (strerror (errno)));
cannam@140 4716 tmp_len = strlen (tmp);
cannam@140 4717 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
cannam@140 4718 memcpy (concat_name, tmp, tmp_len);
cannam@140 4719 concat_name[tmp_len] = '/';
cannam@140 4720 strcpy (concat_name + tmp_len + 1, wrapper);
cannam@140 4721
cannam@140 4722 if (check_executable (concat_name))
cannam@140 4723 return concat_name;
cannam@140 4724 XFREE (concat_name);
cannam@140 4725 return NULL;
cannam@140 4726 }
cannam@140 4727
cannam@140 4728 char *
cannam@140 4729 chase_symlinks (const char *pathspec)
cannam@140 4730 {
cannam@140 4731 #ifndef S_ISLNK
cannam@140 4732 return xstrdup (pathspec);
cannam@140 4733 #else
cannam@140 4734 char buf[LT_PATHMAX];
cannam@140 4735 struct stat s;
cannam@140 4736 char *tmp_pathspec = xstrdup (pathspec);
cannam@140 4737 char *p;
cannam@140 4738 int has_symlinks = 0;
cannam@140 4739 while (strlen (tmp_pathspec) && !has_symlinks)
cannam@140 4740 {
cannam@140 4741 lt_debugprintf (__FILE__, __LINE__,
cannam@140 4742 "checking path component for symlinks: %s\n",
cannam@140 4743 tmp_pathspec);
cannam@140 4744 if (lstat (tmp_pathspec, &s) == 0)
cannam@140 4745 {
cannam@140 4746 if (S_ISLNK (s.st_mode) != 0)
cannam@140 4747 {
cannam@140 4748 has_symlinks = 1;
cannam@140 4749 break;
cannam@140 4750 }
cannam@140 4751
cannam@140 4752 /* search backwards for last DIR_SEPARATOR */
cannam@140 4753 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
cannam@140 4754 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
cannam@140 4755 p--;
cannam@140 4756 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
cannam@140 4757 {
cannam@140 4758 /* no more DIR_SEPARATORS left */
cannam@140 4759 break;
cannam@140 4760 }
cannam@140 4761 *p = '\0';
cannam@140 4762 }
cannam@140 4763 else
cannam@140 4764 {
cannam@140 4765 lt_fatal (__FILE__, __LINE__,
cannam@140 4766 "error accessing file \"%s\": %s",
cannam@140 4767 tmp_pathspec, nonnull (strerror (errno)));
cannam@140 4768 }
cannam@140 4769 }
cannam@140 4770 XFREE (tmp_pathspec);
cannam@140 4771
cannam@140 4772 if (!has_symlinks)
cannam@140 4773 {
cannam@140 4774 return xstrdup (pathspec);
cannam@140 4775 }
cannam@140 4776
cannam@140 4777 tmp_pathspec = realpath (pathspec, buf);
cannam@140 4778 if (tmp_pathspec == 0)
cannam@140 4779 {
cannam@140 4780 lt_fatal (__FILE__, __LINE__,
cannam@140 4781 "could not follow symlinks for %s", pathspec);
cannam@140 4782 }
cannam@140 4783 return xstrdup (tmp_pathspec);
cannam@140 4784 #endif
cannam@140 4785 }
cannam@140 4786
cannam@140 4787 char *
cannam@140 4788 strendzap (char *str, const char *pat)
cannam@140 4789 {
cannam@140 4790 size_t len, patlen;
cannam@140 4791
cannam@140 4792 assert (str != NULL);
cannam@140 4793 assert (pat != NULL);
cannam@140 4794
cannam@140 4795 len = strlen (str);
cannam@140 4796 patlen = strlen (pat);
cannam@140 4797
cannam@140 4798 if (patlen <= len)
cannam@140 4799 {
cannam@140 4800 str += len - patlen;
cannam@140 4801 if (strcmp (str, pat) == 0)
cannam@140 4802 *str = '\0';
cannam@140 4803 }
cannam@140 4804 return str;
cannam@140 4805 }
cannam@140 4806
cannam@140 4807 void
cannam@140 4808 lt_debugprintf (const char *file, int line, const char *fmt, ...)
cannam@140 4809 {
cannam@140 4810 va_list args;
cannam@140 4811 if (lt_debug)
cannam@140 4812 {
cannam@140 4813 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
cannam@140 4814 va_start (args, fmt);
cannam@140 4815 (void) vfprintf (stderr, fmt, args);
cannam@140 4816 va_end (args);
cannam@140 4817 }
cannam@140 4818 }
cannam@140 4819
cannam@140 4820 static void
cannam@140 4821 lt_error_core (int exit_status, const char *file,
cannam@140 4822 int line, const char *mode,
cannam@140 4823 const char *message, va_list ap)
cannam@140 4824 {
cannam@140 4825 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
cannam@140 4826 vfprintf (stderr, message, ap);
cannam@140 4827 fprintf (stderr, ".\n");
cannam@140 4828
cannam@140 4829 if (exit_status >= 0)
cannam@140 4830 exit (exit_status);
cannam@140 4831 }
cannam@140 4832
cannam@140 4833 void
cannam@140 4834 lt_fatal (const char *file, int line, const char *message, ...)
cannam@140 4835 {
cannam@140 4836 va_list ap;
cannam@140 4837 va_start (ap, message);
cannam@140 4838 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
cannam@140 4839 va_end (ap);
cannam@140 4840 }
cannam@140 4841
cannam@140 4842 static const char *
cannam@140 4843 nonnull (const char *s)
cannam@140 4844 {
cannam@140 4845 return s ? s : "(null)";
cannam@140 4846 }
cannam@140 4847
cannam@140 4848 static const char *
cannam@140 4849 nonempty (const char *s)
cannam@140 4850 {
cannam@140 4851 return (s && !*s) ? "(empty)" : nonnull (s);
cannam@140 4852 }
cannam@140 4853
cannam@140 4854 void
cannam@140 4855 lt_setenv (const char *name, const char *value)
cannam@140 4856 {
cannam@140 4857 lt_debugprintf (__FILE__, __LINE__,
cannam@140 4858 "(lt_setenv) setting '%s' to '%s'\n",
cannam@140 4859 nonnull (name), nonnull (value));
cannam@140 4860 {
cannam@140 4861 #ifdef HAVE_SETENV
cannam@140 4862 /* always make a copy, for consistency with !HAVE_SETENV */
cannam@140 4863 char *str = xstrdup (value);
cannam@140 4864 setenv (name, str, 1);
cannam@140 4865 #else
cannam@140 4866 int len = strlen (name) + 1 + strlen (value) + 1;
cannam@140 4867 char *str = XMALLOC (char, len);
cannam@140 4868 sprintf (str, "%s=%s", name, value);
cannam@140 4869 if (putenv (str) != EXIT_SUCCESS)
cannam@140 4870 {
cannam@140 4871 XFREE (str);
cannam@140 4872 }
cannam@140 4873 #endif
cannam@140 4874 }
cannam@140 4875 }
cannam@140 4876
cannam@140 4877 char *
cannam@140 4878 lt_extend_str (const char *orig_value, const char *add, int to_end)
cannam@140 4879 {
cannam@140 4880 char *new_value;
cannam@140 4881 if (orig_value && *orig_value)
cannam@140 4882 {
cannam@140 4883 int orig_value_len = strlen (orig_value);
cannam@140 4884 int add_len = strlen (add);
cannam@140 4885 new_value = XMALLOC (char, add_len + orig_value_len + 1);
cannam@140 4886 if (to_end)
cannam@140 4887 {
cannam@140 4888 strcpy (new_value, orig_value);
cannam@140 4889 strcpy (new_value + orig_value_len, add);
cannam@140 4890 }
cannam@140 4891 else
cannam@140 4892 {
cannam@140 4893 strcpy (new_value, add);
cannam@140 4894 strcpy (new_value + add_len, orig_value);
cannam@140 4895 }
cannam@140 4896 }
cannam@140 4897 else
cannam@140 4898 {
cannam@140 4899 new_value = xstrdup (add);
cannam@140 4900 }
cannam@140 4901 return new_value;
cannam@140 4902 }
cannam@140 4903
cannam@140 4904 void
cannam@140 4905 lt_update_exe_path (const char *name, const char *value)
cannam@140 4906 {
cannam@140 4907 lt_debugprintf (__FILE__, __LINE__,
cannam@140 4908 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
cannam@140 4909 nonnull (name), nonnull (value));
cannam@140 4910
cannam@140 4911 if (name && *name && value && *value)
cannam@140 4912 {
cannam@140 4913 char *new_value = lt_extend_str (getenv (name), value, 0);
cannam@140 4914 /* some systems can't cope with a ':'-terminated path #' */
cannam@140 4915 int len = strlen (new_value);
cannam@140 4916 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
cannam@140 4917 {
cannam@140 4918 new_value[len-1] = '\0';
cannam@140 4919 }
cannam@140 4920 lt_setenv (name, new_value);
cannam@140 4921 XFREE (new_value);
cannam@140 4922 }
cannam@140 4923 }
cannam@140 4924
cannam@140 4925 void
cannam@140 4926 lt_update_lib_path (const char *name, const char *value)
cannam@140 4927 {
cannam@140 4928 lt_debugprintf (__FILE__, __LINE__,
cannam@140 4929 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
cannam@140 4930 nonnull (name), nonnull (value));
cannam@140 4931
cannam@140 4932 if (name && *name && value && *value)
cannam@140 4933 {
cannam@140 4934 char *new_value = lt_extend_str (getenv (name), value, 0);
cannam@140 4935 lt_setenv (name, new_value);
cannam@140 4936 XFREE (new_value);
cannam@140 4937 }
cannam@140 4938 }
cannam@140 4939
cannam@140 4940 EOF
cannam@140 4941 case $host_os in
cannam@140 4942 mingw*)
cannam@140 4943 cat <<"EOF"
cannam@140 4944
cannam@140 4945 /* Prepares an argument vector before calling spawn().
cannam@140 4946 Note that spawn() does not by itself call the command interpreter
cannam@140 4947 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
cannam@140 4948 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
cannam@140 4949 GetVersionEx(&v);
cannam@140 4950 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
cannam@140 4951 }) ? "cmd.exe" : "command.com").
cannam@140 4952 Instead it simply concatenates the arguments, separated by ' ', and calls
cannam@140 4953 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
cannam@140 4954 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
cannam@140 4955 special way:
cannam@140 4956 - Space and tab are interpreted as delimiters. They are not treated as
cannam@140 4957 delimiters if they are surrounded by double quotes: "...".
cannam@140 4958 - Unescaped double quotes are removed from the input. Their only effect is
cannam@140 4959 that within double quotes, space and tab are treated like normal
cannam@140 4960 characters.
cannam@140 4961 - Backslashes not followed by double quotes are not special.
cannam@140 4962 - But 2*n+1 backslashes followed by a double quote become
cannam@140 4963 n backslashes followed by a double quote (n >= 0):
cannam@140 4964 \" -> "
cannam@140 4965 \\\" -> \"
cannam@140 4966 \\\\\" -> \\"
cannam@140 4967 */
cannam@140 4968 #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
cannam@140 4969 #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
cannam@140 4970 char **
cannam@140 4971 prepare_spawn (char **argv)
cannam@140 4972 {
cannam@140 4973 size_t argc;
cannam@140 4974 char **new_argv;
cannam@140 4975 size_t i;
cannam@140 4976
cannam@140 4977 /* Count number of arguments. */
cannam@140 4978 for (argc = 0; argv[argc] != NULL; argc++)
cannam@140 4979 ;
cannam@140 4980
cannam@140 4981 /* Allocate new argument vector. */
cannam@140 4982 new_argv = XMALLOC (char *, argc + 1);
cannam@140 4983
cannam@140 4984 /* Put quoted arguments into the new argument vector. */
cannam@140 4985 for (i = 0; i < argc; i++)
cannam@140 4986 {
cannam@140 4987 const char *string = argv[i];
cannam@140 4988
cannam@140 4989 if (string[0] == '\0')
cannam@140 4990 new_argv[i] = xstrdup ("\"\"");
cannam@140 4991 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
cannam@140 4992 {
cannam@140 4993 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
cannam@140 4994 size_t length;
cannam@140 4995 unsigned int backslashes;
cannam@140 4996 const char *s;
cannam@140 4997 char *quoted_string;
cannam@140 4998 char *p;
cannam@140 4999
cannam@140 5000 length = 0;
cannam@140 5001 backslashes = 0;
cannam@140 5002 if (quote_around)
cannam@140 5003 length++;
cannam@140 5004 for (s = string; *s != '\0'; s++)
cannam@140 5005 {
cannam@140 5006 char c = *s;
cannam@140 5007 if (c == '"')
cannam@140 5008 length += backslashes + 1;
cannam@140 5009 length++;
cannam@140 5010 if (c == '\\')
cannam@140 5011 backslashes++;
cannam@140 5012 else
cannam@140 5013 backslashes = 0;
cannam@140 5014 }
cannam@140 5015 if (quote_around)
cannam@140 5016 length += backslashes + 1;
cannam@140 5017
cannam@140 5018 quoted_string = XMALLOC (char, length + 1);
cannam@140 5019
cannam@140 5020 p = quoted_string;
cannam@140 5021 backslashes = 0;
cannam@140 5022 if (quote_around)
cannam@140 5023 *p++ = '"';
cannam@140 5024 for (s = string; *s != '\0'; s++)
cannam@140 5025 {
cannam@140 5026 char c = *s;
cannam@140 5027 if (c == '"')
cannam@140 5028 {
cannam@140 5029 unsigned int j;
cannam@140 5030 for (j = backslashes + 1; j > 0; j--)
cannam@140 5031 *p++ = '\\';
cannam@140 5032 }
cannam@140 5033 *p++ = c;
cannam@140 5034 if (c == '\\')
cannam@140 5035 backslashes++;
cannam@140 5036 else
cannam@140 5037 backslashes = 0;
cannam@140 5038 }
cannam@140 5039 if (quote_around)
cannam@140 5040 {
cannam@140 5041 unsigned int j;
cannam@140 5042 for (j = backslashes; j > 0; j--)
cannam@140 5043 *p++ = '\\';
cannam@140 5044 *p++ = '"';
cannam@140 5045 }
cannam@140 5046 *p = '\0';
cannam@140 5047
cannam@140 5048 new_argv[i] = quoted_string;
cannam@140 5049 }
cannam@140 5050 else
cannam@140 5051 new_argv[i] = (char *) string;
cannam@140 5052 }
cannam@140 5053 new_argv[argc] = NULL;
cannam@140 5054
cannam@140 5055 return new_argv;
cannam@140 5056 }
cannam@140 5057 EOF
cannam@140 5058 ;;
cannam@140 5059 esac
cannam@140 5060
cannam@140 5061 cat <<"EOF"
cannam@140 5062 void lt_dump_script (FILE* f)
cannam@140 5063 {
cannam@140 5064 EOF
cannam@140 5065 func_emit_wrapper yes |
cannam@140 5066 $SED -n -e '
cannam@140 5067 s/^\(.\{79\}\)\(..*\)/\1\
cannam@140 5068 \2/
cannam@140 5069 h
cannam@140 5070 s/\([\\"]\)/\\\1/g
cannam@140 5071 s/$/\\n/
cannam@140 5072 s/\([^\n]*\).*/ fputs ("\1", f);/p
cannam@140 5073 g
cannam@140 5074 D'
cannam@140 5075 cat <<"EOF"
cannam@140 5076 }
cannam@140 5077 EOF
cannam@140 5078 }
cannam@140 5079 # end: func_emit_cwrapperexe_src
cannam@140 5080
cannam@140 5081 # func_win32_import_lib_p ARG
cannam@140 5082 # True if ARG is an import lib, as indicated by $file_magic_cmd
cannam@140 5083 func_win32_import_lib_p ()
cannam@140 5084 {
cannam@140 5085 $opt_debug
cannam@140 5086 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
cannam@140 5087 *import*) : ;;
cannam@140 5088 *) false ;;
cannam@140 5089 esac
cannam@140 5090 }
cannam@140 5091
cannam@140 5092 # func_mode_link arg...
cannam@140 5093 func_mode_link ()
cannam@140 5094 {
cannam@140 5095 $opt_debug
cannam@140 5096 case $host in
cannam@140 5097 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
cannam@140 5098 # It is impossible to link a dll without this setting, and
cannam@140 5099 # we shouldn't force the makefile maintainer to figure out
cannam@140 5100 # which system we are compiling for in order to pass an extra
cannam@140 5101 # flag for every libtool invocation.
cannam@140 5102 # allow_undefined=no
cannam@140 5103
cannam@140 5104 # FIXME: Unfortunately, there are problems with the above when trying
cannam@140 5105 # to make a dll which has undefined symbols, in which case not
cannam@140 5106 # even a static library is built. For now, we need to specify
cannam@140 5107 # -no-undefined on the libtool link line when we can be certain
cannam@140 5108 # that all symbols are satisfied, otherwise we get a static library.
cannam@140 5109 allow_undefined=yes
cannam@140 5110 ;;
cannam@140 5111 *)
cannam@140 5112 allow_undefined=yes
cannam@140 5113 ;;
cannam@140 5114 esac
cannam@140 5115 libtool_args=$nonopt
cannam@140 5116 base_compile="$nonopt $@"
cannam@140 5117 compile_command=$nonopt
cannam@140 5118 finalize_command=$nonopt
cannam@140 5119
cannam@140 5120 compile_rpath=
cannam@140 5121 finalize_rpath=
cannam@140 5122 compile_shlibpath=
cannam@140 5123 finalize_shlibpath=
cannam@140 5124 convenience=
cannam@140 5125 old_convenience=
cannam@140 5126 deplibs=
cannam@140 5127 old_deplibs=
cannam@140 5128 compiler_flags=
cannam@140 5129 linker_flags=
cannam@140 5130 dllsearchpath=
cannam@140 5131 lib_search_path=`pwd`
cannam@140 5132 inst_prefix_dir=
cannam@140 5133 new_inherited_linker_flags=
cannam@140 5134
cannam@140 5135 avoid_version=no
cannam@140 5136 bindir=
cannam@140 5137 dlfiles=
cannam@140 5138 dlprefiles=
cannam@140 5139 dlself=no
cannam@140 5140 export_dynamic=no
cannam@140 5141 export_symbols=
cannam@140 5142 export_symbols_regex=
cannam@140 5143 generated=
cannam@140 5144 libobjs=
cannam@140 5145 ltlibs=
cannam@140 5146 module=no
cannam@140 5147 no_install=no
cannam@140 5148 objs=
cannam@140 5149 non_pic_objects=
cannam@140 5150 precious_files_regex=
cannam@140 5151 prefer_static_libs=no
cannam@140 5152 preload=no
cannam@140 5153 prev=
cannam@140 5154 prevarg=
cannam@140 5155 release=
cannam@140 5156 rpath=
cannam@140 5157 xrpath=
cannam@140 5158 perm_rpath=
cannam@140 5159 temp_rpath=
cannam@140 5160 thread_safe=no
cannam@140 5161 vinfo=
cannam@140 5162 vinfo_number=no
cannam@140 5163 weak_libs=
cannam@140 5164 single_module="${wl}-single_module"
cannam@140 5165 func_infer_tag $base_compile
cannam@140 5166
cannam@140 5167 # We need to know -static, to get the right output filenames.
cannam@140 5168 for arg
cannam@140 5169 do
cannam@140 5170 case $arg in
cannam@140 5171 -shared)
cannam@140 5172 test "$build_libtool_libs" != yes && \
cannam@140 5173 func_fatal_configuration "can not build a shared library"
cannam@140 5174 build_old_libs=no
cannam@140 5175 break
cannam@140 5176 ;;
cannam@140 5177 -all-static | -static | -static-libtool-libs)
cannam@140 5178 case $arg in
cannam@140 5179 -all-static)
cannam@140 5180 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
cannam@140 5181 func_warning "complete static linking is impossible in this configuration"
cannam@140 5182 fi
cannam@140 5183 if test -n "$link_static_flag"; then
cannam@140 5184 dlopen_self=$dlopen_self_static
cannam@140 5185 fi
cannam@140 5186 prefer_static_libs=yes
cannam@140 5187 ;;
cannam@140 5188 -static)
cannam@140 5189 if test -z "$pic_flag" && test -n "$link_static_flag"; then
cannam@140 5190 dlopen_self=$dlopen_self_static
cannam@140 5191 fi
cannam@140 5192 prefer_static_libs=built
cannam@140 5193 ;;
cannam@140 5194 -static-libtool-libs)
cannam@140 5195 if test -z "$pic_flag" && test -n "$link_static_flag"; then
cannam@140 5196 dlopen_self=$dlopen_self_static
cannam@140 5197 fi
cannam@140 5198 prefer_static_libs=yes
cannam@140 5199 ;;
cannam@140 5200 esac
cannam@140 5201 build_libtool_libs=no
cannam@140 5202 build_old_libs=yes
cannam@140 5203 break
cannam@140 5204 ;;
cannam@140 5205 esac
cannam@140 5206 done
cannam@140 5207
cannam@140 5208 # See if our shared archives depend on static archives.
cannam@140 5209 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
cannam@140 5210
cannam@140 5211 # Go through the arguments, transforming them on the way.
cannam@140 5212 while test "$#" -gt 0; do
cannam@140 5213 arg="$1"
cannam@140 5214 shift
cannam@140 5215 func_quote_for_eval "$arg"
cannam@140 5216 qarg=$func_quote_for_eval_unquoted_result
cannam@140 5217 func_append libtool_args " $func_quote_for_eval_result"
cannam@140 5218
cannam@140 5219 # If the previous option needs an argument, assign it.
cannam@140 5220 if test -n "$prev"; then
cannam@140 5221 case $prev in
cannam@140 5222 output)
cannam@140 5223 func_append compile_command " @OUTPUT@"
cannam@140 5224 func_append finalize_command " @OUTPUT@"
cannam@140 5225 ;;
cannam@140 5226 esac
cannam@140 5227
cannam@140 5228 case $prev in
cannam@140 5229 bindir)
cannam@140 5230 bindir="$arg"
cannam@140 5231 prev=
cannam@140 5232 continue
cannam@140 5233 ;;
cannam@140 5234 dlfiles|dlprefiles)
cannam@140 5235 if test "$preload" = no; then
cannam@140 5236 # Add the symbol object into the linking commands.
cannam@140 5237 func_append compile_command " @SYMFILE@"
cannam@140 5238 func_append finalize_command " @SYMFILE@"
cannam@140 5239 preload=yes
cannam@140 5240 fi
cannam@140 5241 case $arg in
cannam@140 5242 *.la | *.lo) ;; # We handle these cases below.
cannam@140 5243 force)
cannam@140 5244 if test "$dlself" = no; then
cannam@140 5245 dlself=needless
cannam@140 5246 export_dynamic=yes
cannam@140 5247 fi
cannam@140 5248 prev=
cannam@140 5249 continue
cannam@140 5250 ;;
cannam@140 5251 self)
cannam@140 5252 if test "$prev" = dlprefiles; then
cannam@140 5253 dlself=yes
cannam@140 5254 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
cannam@140 5255 dlself=yes
cannam@140 5256 else
cannam@140 5257 dlself=needless
cannam@140 5258 export_dynamic=yes
cannam@140 5259 fi
cannam@140 5260 prev=
cannam@140 5261 continue
cannam@140 5262 ;;
cannam@140 5263 *)
cannam@140 5264 if test "$prev" = dlfiles; then
cannam@140 5265 func_append dlfiles " $arg"
cannam@140 5266 else
cannam@140 5267 func_append dlprefiles " $arg"
cannam@140 5268 fi
cannam@140 5269 prev=
cannam@140 5270 continue
cannam@140 5271 ;;
cannam@140 5272 esac
cannam@140 5273 ;;
cannam@140 5274 expsyms)
cannam@140 5275 export_symbols="$arg"
cannam@140 5276 test -f "$arg" \
cannam@140 5277 || func_fatal_error "symbol file \`$arg' does not exist"
cannam@140 5278 prev=
cannam@140 5279 continue
cannam@140 5280 ;;
cannam@140 5281 expsyms_regex)
cannam@140 5282 export_symbols_regex="$arg"
cannam@140 5283 prev=
cannam@140 5284 continue
cannam@140 5285 ;;
cannam@140 5286 framework)
cannam@140 5287 case $host in
cannam@140 5288 *-*-darwin*)
cannam@140 5289 case "$deplibs " in
cannam@140 5290 *" $qarg.ltframework "*) ;;
cannam@140 5291 *) func_append deplibs " $qarg.ltframework" # this is fixed later
cannam@140 5292 ;;
cannam@140 5293 esac
cannam@140 5294 ;;
cannam@140 5295 esac
cannam@140 5296 prev=
cannam@140 5297 continue
cannam@140 5298 ;;
cannam@140 5299 inst_prefix)
cannam@140 5300 inst_prefix_dir="$arg"
cannam@140 5301 prev=
cannam@140 5302 continue
cannam@140 5303 ;;
cannam@140 5304 objectlist)
cannam@140 5305 if test -f "$arg"; then
cannam@140 5306 save_arg=$arg
cannam@140 5307 moreargs=
cannam@140 5308 for fil in `cat "$save_arg"`
cannam@140 5309 do
cannam@140 5310 # func_append moreargs " $fil"
cannam@140 5311 arg=$fil
cannam@140 5312 # A libtool-controlled object.
cannam@140 5313
cannam@140 5314 # Check to see that this really is a libtool object.
cannam@140 5315 if func_lalib_unsafe_p "$arg"; then
cannam@140 5316 pic_object=
cannam@140 5317 non_pic_object=
cannam@140 5318
cannam@140 5319 # Read the .lo file
cannam@140 5320 func_source "$arg"
cannam@140 5321
cannam@140 5322 if test -z "$pic_object" ||
cannam@140 5323 test -z "$non_pic_object" ||
cannam@140 5324 test "$pic_object" = none &&
cannam@140 5325 test "$non_pic_object" = none; then
cannam@140 5326 func_fatal_error "cannot find name of object for \`$arg'"
cannam@140 5327 fi
cannam@140 5328
cannam@140 5329 # Extract subdirectory from the argument.
cannam@140 5330 func_dirname "$arg" "/" ""
cannam@140 5331 xdir="$func_dirname_result"
cannam@140 5332
cannam@140 5333 if test "$pic_object" != none; then
cannam@140 5334 # Prepend the subdirectory the object is found in.
cannam@140 5335 pic_object="$xdir$pic_object"
cannam@140 5336
cannam@140 5337 if test "$prev" = dlfiles; then
cannam@140 5338 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
cannam@140 5339 func_append dlfiles " $pic_object"
cannam@140 5340 prev=
cannam@140 5341 continue
cannam@140 5342 else
cannam@140 5343 # If libtool objects are unsupported, then we need to preload.
cannam@140 5344 prev=dlprefiles
cannam@140 5345 fi
cannam@140 5346 fi
cannam@140 5347
cannam@140 5348 # CHECK ME: I think I busted this. -Ossama
cannam@140 5349 if test "$prev" = dlprefiles; then
cannam@140 5350 # Preload the old-style object.
cannam@140 5351 func_append dlprefiles " $pic_object"
cannam@140 5352 prev=
cannam@140 5353 fi
cannam@140 5354
cannam@140 5355 # A PIC object.
cannam@140 5356 func_append libobjs " $pic_object"
cannam@140 5357 arg="$pic_object"
cannam@140 5358 fi
cannam@140 5359
cannam@140 5360 # Non-PIC object.
cannam@140 5361 if test "$non_pic_object" != none; then
cannam@140 5362 # Prepend the subdirectory the object is found in.
cannam@140 5363 non_pic_object="$xdir$non_pic_object"
cannam@140 5364
cannam@140 5365 # A standard non-PIC object
cannam@140 5366 func_append non_pic_objects " $non_pic_object"
cannam@140 5367 if test -z "$pic_object" || test "$pic_object" = none ; then
cannam@140 5368 arg="$non_pic_object"
cannam@140 5369 fi
cannam@140 5370 else
cannam@140 5371 # If the PIC object exists, use it instead.
cannam@140 5372 # $xdir was prepended to $pic_object above.
cannam@140 5373 non_pic_object="$pic_object"
cannam@140 5374 func_append non_pic_objects " $non_pic_object"
cannam@140 5375 fi
cannam@140 5376 else
cannam@140 5377 # Only an error if not doing a dry-run.
cannam@140 5378 if $opt_dry_run; then
cannam@140 5379 # Extract subdirectory from the argument.
cannam@140 5380 func_dirname "$arg" "/" ""
cannam@140 5381 xdir="$func_dirname_result"
cannam@140 5382
cannam@140 5383 func_lo2o "$arg"
cannam@140 5384 pic_object=$xdir$objdir/$func_lo2o_result
cannam@140 5385 non_pic_object=$xdir$func_lo2o_result
cannam@140 5386 func_append libobjs " $pic_object"
cannam@140 5387 func_append non_pic_objects " $non_pic_object"
cannam@140 5388 else
cannam@140 5389 func_fatal_error "\`$arg' is not a valid libtool object"
cannam@140 5390 fi
cannam@140 5391 fi
cannam@140 5392 done
cannam@140 5393 else
cannam@140 5394 func_fatal_error "link input file \`$arg' does not exist"
cannam@140 5395 fi
cannam@140 5396 arg=$save_arg
cannam@140 5397 prev=
cannam@140 5398 continue
cannam@140 5399 ;;
cannam@140 5400 precious_regex)
cannam@140 5401 precious_files_regex="$arg"
cannam@140 5402 prev=
cannam@140 5403 continue
cannam@140 5404 ;;
cannam@140 5405 release)
cannam@140 5406 release="-$arg"
cannam@140 5407 prev=
cannam@140 5408 continue
cannam@140 5409 ;;
cannam@140 5410 rpath | xrpath)
cannam@140 5411 # We need an absolute path.
cannam@140 5412 case $arg in
cannam@140 5413 [\\/]* | [A-Za-z]:[\\/]*) ;;
cannam@140 5414 *)
cannam@140 5415 func_fatal_error "only absolute run-paths are allowed"
cannam@140 5416 ;;
cannam@140 5417 esac
cannam@140 5418 if test "$prev" = rpath; then
cannam@140 5419 case "$rpath " in
cannam@140 5420 *" $arg "*) ;;
cannam@140 5421 *) func_append rpath " $arg" ;;
cannam@140 5422 esac
cannam@140 5423 else
cannam@140 5424 case "$xrpath " in
cannam@140 5425 *" $arg "*) ;;
cannam@140 5426 *) func_append xrpath " $arg" ;;
cannam@140 5427 esac
cannam@140 5428 fi
cannam@140 5429 prev=
cannam@140 5430 continue
cannam@140 5431 ;;
cannam@140 5432 shrext)
cannam@140 5433 shrext_cmds="$arg"
cannam@140 5434 prev=
cannam@140 5435 continue
cannam@140 5436 ;;
cannam@140 5437 weak)
cannam@140 5438 func_append weak_libs " $arg"
cannam@140 5439 prev=
cannam@140 5440 continue
cannam@140 5441 ;;
cannam@140 5442 xcclinker)
cannam@140 5443 func_append linker_flags " $qarg"
cannam@140 5444 func_append compiler_flags " $qarg"
cannam@140 5445 prev=
cannam@140 5446 func_append compile_command " $qarg"
cannam@140 5447 func_append finalize_command " $qarg"
cannam@140 5448 continue
cannam@140 5449 ;;
cannam@140 5450 xcompiler)
cannam@140 5451 func_append compiler_flags " $qarg"
cannam@140 5452 prev=
cannam@140 5453 func_append compile_command " $qarg"
cannam@140 5454 func_append finalize_command " $qarg"
cannam@140 5455 continue
cannam@140 5456 ;;
cannam@140 5457 xlinker)
cannam@140 5458 func_append linker_flags " $qarg"
cannam@140 5459 func_append compiler_flags " $wl$qarg"
cannam@140 5460 prev=
cannam@140 5461 func_append compile_command " $wl$qarg"
cannam@140 5462 func_append finalize_command " $wl$qarg"
cannam@140 5463 continue
cannam@140 5464 ;;
cannam@140 5465 *)
cannam@140 5466 eval "$prev=\"\$arg\""
cannam@140 5467 prev=
cannam@140 5468 continue
cannam@140 5469 ;;
cannam@140 5470 esac
cannam@140 5471 fi # test -n "$prev"
cannam@140 5472
cannam@140 5473 prevarg="$arg"
cannam@140 5474
cannam@140 5475 case $arg in
cannam@140 5476 -all-static)
cannam@140 5477 if test -n "$link_static_flag"; then
cannam@140 5478 # See comment for -static flag below, for more details.
cannam@140 5479 func_append compile_command " $link_static_flag"
cannam@140 5480 func_append finalize_command " $link_static_flag"
cannam@140 5481 fi
cannam@140 5482 continue
cannam@140 5483 ;;
cannam@140 5484
cannam@140 5485 -allow-undefined)
cannam@140 5486 # FIXME: remove this flag sometime in the future.
cannam@140 5487 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
cannam@140 5488 ;;
cannam@140 5489
cannam@140 5490 -avoid-version)
cannam@140 5491 avoid_version=yes
cannam@140 5492 continue
cannam@140 5493 ;;
cannam@140 5494
cannam@140 5495 -bindir)
cannam@140 5496 prev=bindir
cannam@140 5497 continue
cannam@140 5498 ;;
cannam@140 5499
cannam@140 5500 -dlopen)
cannam@140 5501 prev=dlfiles
cannam@140 5502 continue
cannam@140 5503 ;;
cannam@140 5504
cannam@140 5505 -dlpreopen)
cannam@140 5506 prev=dlprefiles
cannam@140 5507 continue
cannam@140 5508 ;;
cannam@140 5509
cannam@140 5510 -export-dynamic)
cannam@140 5511 export_dynamic=yes
cannam@140 5512 continue
cannam@140 5513 ;;
cannam@140 5514
cannam@140 5515 -export-symbols | -export-symbols-regex)
cannam@140 5516 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
cannam@140 5517 func_fatal_error "more than one -exported-symbols argument is not allowed"
cannam@140 5518 fi
cannam@140 5519 if test "X$arg" = "X-export-symbols"; then
cannam@140 5520 prev=expsyms
cannam@140 5521 else
cannam@140 5522 prev=expsyms_regex
cannam@140 5523 fi
cannam@140 5524 continue
cannam@140 5525 ;;
cannam@140 5526
cannam@140 5527 -framework)
cannam@140 5528 prev=framework
cannam@140 5529 continue
cannam@140 5530 ;;
cannam@140 5531
cannam@140 5532 -inst-prefix-dir)
cannam@140 5533 prev=inst_prefix
cannam@140 5534 continue
cannam@140 5535 ;;
cannam@140 5536
cannam@140 5537 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
cannam@140 5538 # so, if we see these flags be careful not to treat them like -L
cannam@140 5539 -L[A-Z][A-Z]*:*)
cannam@140 5540 case $with_gcc/$host in
cannam@140 5541 no/*-*-irix* | /*-*-irix*)
cannam@140 5542 func_append compile_command " $arg"
cannam@140 5543 func_append finalize_command " $arg"
cannam@140 5544 ;;
cannam@140 5545 esac
cannam@140 5546 continue
cannam@140 5547 ;;
cannam@140 5548
cannam@140 5549 -L*)
cannam@140 5550 func_stripname "-L" '' "$arg"
cannam@140 5551 if test -z "$func_stripname_result"; then
cannam@140 5552 if test "$#" -gt 0; then
cannam@140 5553 func_fatal_error "require no space between \`-L' and \`$1'"
cannam@140 5554 else
cannam@140 5555 func_fatal_error "need path for \`-L' option"
cannam@140 5556 fi
cannam@140 5557 fi
cannam@140 5558 func_resolve_sysroot "$func_stripname_result"
cannam@140 5559 dir=$func_resolve_sysroot_result
cannam@140 5560 # We need an absolute path.
cannam@140 5561 case $dir in
cannam@140 5562 [\\/]* | [A-Za-z]:[\\/]*) ;;
cannam@140 5563 *)
cannam@140 5564 absdir=`cd "$dir" && pwd`
cannam@140 5565 test -z "$absdir" && \
cannam@140 5566 func_fatal_error "cannot determine absolute directory name of \`$dir'"
cannam@140 5567 dir="$absdir"
cannam@140 5568 ;;
cannam@140 5569 esac
cannam@140 5570 case "$deplibs " in
cannam@140 5571 *" -L$dir "* | *" $arg "*)
cannam@140 5572 # Will only happen for absolute or sysroot arguments
cannam@140 5573 ;;
cannam@140 5574 *)
cannam@140 5575 # Preserve sysroot, but never include relative directories
cannam@140 5576 case $dir in
cannam@140 5577 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
cannam@140 5578 *) func_append deplibs " -L$dir" ;;
cannam@140 5579 esac
cannam@140 5580 func_append lib_search_path " $dir"
cannam@140 5581 ;;
cannam@140 5582 esac
cannam@140 5583 case $host in
cannam@140 5584 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
cannam@140 5585 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
cannam@140 5586 case :$dllsearchpath: in
cannam@140 5587 *":$dir:"*) ;;
cannam@140 5588 ::) dllsearchpath=$dir;;
cannam@140 5589 *) func_append dllsearchpath ":$dir";;
cannam@140 5590 esac
cannam@140 5591 case :$dllsearchpath: in
cannam@140 5592 *":$testbindir:"*) ;;
cannam@140 5593 ::) dllsearchpath=$testbindir;;
cannam@140 5594 *) func_append dllsearchpath ":$testbindir";;
cannam@140 5595 esac
cannam@140 5596 ;;
cannam@140 5597 esac
cannam@140 5598 continue
cannam@140 5599 ;;
cannam@140 5600
cannam@140 5601 -l*)
cannam@140 5602 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
cannam@140 5603 case $host in
cannam@140 5604 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
cannam@140 5605 # These systems don't actually have a C or math library (as such)
cannam@140 5606 continue
cannam@140 5607 ;;
cannam@140 5608 *-*-os2*)
cannam@140 5609 # These systems don't actually have a C library (as such)
cannam@140 5610 test "X$arg" = "X-lc" && continue
cannam@140 5611 ;;
cannam@140 5612 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
cannam@140 5613 # Do not include libc due to us having libc/libc_r.
cannam@140 5614 test "X$arg" = "X-lc" && continue
cannam@140 5615 ;;
cannam@140 5616 *-*-rhapsody* | *-*-darwin1.[012])
cannam@140 5617 # Rhapsody C and math libraries are in the System framework
cannam@140 5618 func_append deplibs " System.ltframework"
cannam@140 5619 continue
cannam@140 5620 ;;
cannam@140 5621 *-*-sco3.2v5* | *-*-sco5v6*)
cannam@140 5622 # Causes problems with __ctype
cannam@140 5623 test "X$arg" = "X-lc" && continue
cannam@140 5624 ;;
cannam@140 5625 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
cannam@140 5626 # Compiler inserts libc in the correct place for threads to work
cannam@140 5627 test "X$arg" = "X-lc" && continue
cannam@140 5628 ;;
cannam@140 5629 esac
cannam@140 5630 elif test "X$arg" = "X-lc_r"; then
cannam@140 5631 case $host in
cannam@140 5632 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
cannam@140 5633 # Do not include libc_r directly, use -pthread flag.
cannam@140 5634 continue
cannam@140 5635 ;;
cannam@140 5636 esac
cannam@140 5637 fi
cannam@140 5638 func_append deplibs " $arg"
cannam@140 5639 continue
cannam@140 5640 ;;
cannam@140 5641
cannam@140 5642 -module)
cannam@140 5643 module=yes
cannam@140 5644 continue
cannam@140 5645 ;;
cannam@140 5646
cannam@140 5647 # Tru64 UNIX uses -model [arg] to determine the layout of C++
cannam@140 5648 # classes, name mangling, and exception handling.
cannam@140 5649 # Darwin uses the -arch flag to determine output architecture.
cannam@140 5650 -model|-arch|-isysroot|--sysroot)
cannam@140 5651 func_append compiler_flags " $arg"
cannam@140 5652 func_append compile_command " $arg"
cannam@140 5653 func_append finalize_command " $arg"
cannam@140 5654 prev=xcompiler
cannam@140 5655 continue
cannam@140 5656 ;;
cannam@140 5657
cannam@140 5658 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
cannam@140 5659 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
cannam@140 5660 func_append compiler_flags " $arg"
cannam@140 5661 func_append compile_command " $arg"
cannam@140 5662 func_append finalize_command " $arg"
cannam@140 5663 case "$new_inherited_linker_flags " in
cannam@140 5664 *" $arg "*) ;;
cannam@140 5665 * ) func_append new_inherited_linker_flags " $arg" ;;
cannam@140 5666 esac
cannam@140 5667 continue
cannam@140 5668 ;;
cannam@140 5669
cannam@140 5670 -multi_module)
cannam@140 5671 single_module="${wl}-multi_module"
cannam@140 5672 continue
cannam@140 5673 ;;
cannam@140 5674
cannam@140 5675 -no-fast-install)
cannam@140 5676 fast_install=no
cannam@140 5677 continue
cannam@140 5678 ;;
cannam@140 5679
cannam@140 5680 -no-install)
cannam@140 5681 case $host in
cannam@140 5682 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
cannam@140 5683 # The PATH hackery in wrapper scripts is required on Windows
cannam@140 5684 # and Darwin in order for the loader to find any dlls it needs.
cannam@140 5685 func_warning "\`-no-install' is ignored for $host"
cannam@140 5686 func_warning "assuming \`-no-fast-install' instead"
cannam@140 5687 fast_install=no
cannam@140 5688 ;;
cannam@140 5689 *) no_install=yes ;;
cannam@140 5690 esac
cannam@140 5691 continue
cannam@140 5692 ;;
cannam@140 5693
cannam@140 5694 -no-undefined)
cannam@140 5695 allow_undefined=no
cannam@140 5696 continue
cannam@140 5697 ;;
cannam@140 5698
cannam@140 5699 -objectlist)
cannam@140 5700 prev=objectlist
cannam@140 5701 continue
cannam@140 5702 ;;
cannam@140 5703
cannam@140 5704 -o) prev=output ;;
cannam@140 5705
cannam@140 5706 -precious-files-regex)
cannam@140 5707 prev=precious_regex
cannam@140 5708 continue
cannam@140 5709 ;;
cannam@140 5710
cannam@140 5711 -release)
cannam@140 5712 prev=release
cannam@140 5713 continue
cannam@140 5714 ;;
cannam@140 5715
cannam@140 5716 -rpath)
cannam@140 5717 prev=rpath
cannam@140 5718 continue
cannam@140 5719 ;;
cannam@140 5720
cannam@140 5721 -R)
cannam@140 5722 prev=xrpath
cannam@140 5723 continue
cannam@140 5724 ;;
cannam@140 5725
cannam@140 5726 -R*)
cannam@140 5727 func_stripname '-R' '' "$arg"
cannam@140 5728 dir=$func_stripname_result
cannam@140 5729 # We need an absolute path.
cannam@140 5730 case $dir in
cannam@140 5731 [\\/]* | [A-Za-z]:[\\/]*) ;;
cannam@140 5732 =*)
cannam@140 5733 func_stripname '=' '' "$dir"
cannam@140 5734 dir=$lt_sysroot$func_stripname_result
cannam@140 5735 ;;
cannam@140 5736 *)
cannam@140 5737 func_fatal_error "only absolute run-paths are allowed"
cannam@140 5738 ;;
cannam@140 5739 esac
cannam@140 5740 case "$xrpath " in
cannam@140 5741 *" $dir "*) ;;
cannam@140 5742 *) func_append xrpath " $dir" ;;
cannam@140 5743 esac
cannam@140 5744 continue
cannam@140 5745 ;;
cannam@140 5746
cannam@140 5747 -shared)
cannam@140 5748 # The effects of -shared are defined in a previous loop.
cannam@140 5749 continue
cannam@140 5750 ;;
cannam@140 5751
cannam@140 5752 -shrext)
cannam@140 5753 prev=shrext
cannam@140 5754 continue
cannam@140 5755 ;;
cannam@140 5756
cannam@140 5757 -static | -static-libtool-libs)
cannam@140 5758 # The effects of -static are defined in a previous loop.
cannam@140 5759 # We used to do the same as -all-static on platforms that
cannam@140 5760 # didn't have a PIC flag, but the assumption that the effects
cannam@140 5761 # would be equivalent was wrong. It would break on at least
cannam@140 5762 # Digital Unix and AIX.
cannam@140 5763 continue
cannam@140 5764 ;;
cannam@140 5765
cannam@140 5766 -thread-safe)
cannam@140 5767 thread_safe=yes
cannam@140 5768 continue
cannam@140 5769 ;;
cannam@140 5770
cannam@140 5771 -version-info)
cannam@140 5772 prev=vinfo
cannam@140 5773 continue
cannam@140 5774 ;;
cannam@140 5775
cannam@140 5776 -version-number)
cannam@140 5777 prev=vinfo
cannam@140 5778 vinfo_number=yes
cannam@140 5779 continue
cannam@140 5780 ;;
cannam@140 5781
cannam@140 5782 -weak)
cannam@140 5783 prev=weak
cannam@140 5784 continue
cannam@140 5785 ;;
cannam@140 5786
cannam@140 5787 -Wc,*)
cannam@140 5788 func_stripname '-Wc,' '' "$arg"
cannam@140 5789 args=$func_stripname_result
cannam@140 5790 arg=
cannam@140 5791 save_ifs="$IFS"; IFS=','
cannam@140 5792 for flag in $args; do
cannam@140 5793 IFS="$save_ifs"
cannam@140 5794 func_quote_for_eval "$flag"
cannam@140 5795 func_append arg " $func_quote_for_eval_result"
cannam@140 5796 func_append compiler_flags " $func_quote_for_eval_result"
cannam@140 5797 done
cannam@140 5798 IFS="$save_ifs"
cannam@140 5799 func_stripname ' ' '' "$arg"
cannam@140 5800 arg=$func_stripname_result
cannam@140 5801 ;;
cannam@140 5802
cannam@140 5803 -Wl,*)
cannam@140 5804 func_stripname '-Wl,' '' "$arg"
cannam@140 5805 args=$func_stripname_result
cannam@140 5806 arg=
cannam@140 5807 save_ifs="$IFS"; IFS=','
cannam@140 5808 for flag in $args; do
cannam@140 5809 IFS="$save_ifs"
cannam@140 5810 func_quote_for_eval "$flag"
cannam@140 5811 func_append arg " $wl$func_quote_for_eval_result"
cannam@140 5812 func_append compiler_flags " $wl$func_quote_for_eval_result"
cannam@140 5813 func_append linker_flags " $func_quote_for_eval_result"
cannam@140 5814 done
cannam@140 5815 IFS="$save_ifs"
cannam@140 5816 func_stripname ' ' '' "$arg"
cannam@140 5817 arg=$func_stripname_result
cannam@140 5818 ;;
cannam@140 5819
cannam@140 5820 -Xcompiler)
cannam@140 5821 prev=xcompiler
cannam@140 5822 continue
cannam@140 5823 ;;
cannam@140 5824
cannam@140 5825 -Xlinker)
cannam@140 5826 prev=xlinker
cannam@140 5827 continue
cannam@140 5828 ;;
cannam@140 5829
cannam@140 5830 -XCClinker)
cannam@140 5831 prev=xcclinker
cannam@140 5832 continue
cannam@140 5833 ;;
cannam@140 5834
cannam@140 5835 # -msg_* for osf cc
cannam@140 5836 -msg_*)
cannam@140 5837 func_quote_for_eval "$arg"
cannam@140 5838 arg="$func_quote_for_eval_result"
cannam@140 5839 ;;
cannam@140 5840
cannam@140 5841 # Flags to be passed through unchanged, with rationale:
cannam@140 5842 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
cannam@140 5843 # -r[0-9][0-9]* specify processor for the SGI compiler
cannam@140 5844 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
cannam@140 5845 # +DA*, +DD* enable 64-bit mode for the HP compiler
cannam@140 5846 # -q* compiler args for the IBM compiler
cannam@140 5847 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
cannam@140 5848 # -F/path path to uninstalled frameworks, gcc on darwin
cannam@140 5849 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
cannam@140 5850 # @file GCC response files
cannam@140 5851 # -tp=* Portland pgcc target processor selection
cannam@140 5852 # --sysroot=* for sysroot support
cannam@140 5853 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
cannam@140 5854 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
cannam@140 5855 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
cannam@140 5856 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
cannam@140 5857 func_quote_for_eval "$arg"
cannam@140 5858 arg="$func_quote_for_eval_result"
cannam@140 5859 func_append compile_command " $arg"
cannam@140 5860 func_append finalize_command " $arg"
cannam@140 5861 func_append compiler_flags " $arg"
cannam@140 5862 continue
cannam@140 5863 ;;
cannam@140 5864
cannam@140 5865 # Some other compiler flag.
cannam@140 5866 -* | +*)
cannam@140 5867 func_quote_for_eval "$arg"
cannam@140 5868 arg="$func_quote_for_eval_result"
cannam@140 5869 ;;
cannam@140 5870
cannam@140 5871 *.$objext)
cannam@140 5872 # A standard object.
cannam@140 5873 func_append objs " $arg"
cannam@140 5874 ;;
cannam@140 5875
cannam@140 5876 *.lo)
cannam@140 5877 # A libtool-controlled object.
cannam@140 5878
cannam@140 5879 # Check to see that this really is a libtool object.
cannam@140 5880 if func_lalib_unsafe_p "$arg"; then
cannam@140 5881 pic_object=
cannam@140 5882 non_pic_object=
cannam@140 5883
cannam@140 5884 # Read the .lo file
cannam@140 5885 func_source "$arg"
cannam@140 5886
cannam@140 5887 if test -z "$pic_object" ||
cannam@140 5888 test -z "$non_pic_object" ||
cannam@140 5889 test "$pic_object" = none &&
cannam@140 5890 test "$non_pic_object" = none; then
cannam@140 5891 func_fatal_error "cannot find name of object for \`$arg'"
cannam@140 5892 fi
cannam@140 5893
cannam@140 5894 # Extract subdirectory from the argument.
cannam@140 5895 func_dirname "$arg" "/" ""
cannam@140 5896 xdir="$func_dirname_result"
cannam@140 5897
cannam@140 5898 if test "$pic_object" != none; then
cannam@140 5899 # Prepend the subdirectory the object is found in.
cannam@140 5900 pic_object="$xdir$pic_object"
cannam@140 5901
cannam@140 5902 if test "$prev" = dlfiles; then
cannam@140 5903 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
cannam@140 5904 func_append dlfiles " $pic_object"
cannam@140 5905 prev=
cannam@140 5906 continue
cannam@140 5907 else
cannam@140 5908 # If libtool objects are unsupported, then we need to preload.
cannam@140 5909 prev=dlprefiles
cannam@140 5910 fi
cannam@140 5911 fi
cannam@140 5912
cannam@140 5913 # CHECK ME: I think I busted this. -Ossama
cannam@140 5914 if test "$prev" = dlprefiles; then
cannam@140 5915 # Preload the old-style object.
cannam@140 5916 func_append dlprefiles " $pic_object"
cannam@140 5917 prev=
cannam@140 5918 fi
cannam@140 5919
cannam@140 5920 # A PIC object.
cannam@140 5921 func_append libobjs " $pic_object"
cannam@140 5922 arg="$pic_object"
cannam@140 5923 fi
cannam@140 5924
cannam@140 5925 # Non-PIC object.
cannam@140 5926 if test "$non_pic_object" != none; then
cannam@140 5927 # Prepend the subdirectory the object is found in.
cannam@140 5928 non_pic_object="$xdir$non_pic_object"
cannam@140 5929
cannam@140 5930 # A standard non-PIC object
cannam@140 5931 func_append non_pic_objects " $non_pic_object"
cannam@140 5932 if test -z "$pic_object" || test "$pic_object" = none ; then
cannam@140 5933 arg="$non_pic_object"
cannam@140 5934 fi
cannam@140 5935 else
cannam@140 5936 # If the PIC object exists, use it instead.
cannam@140 5937 # $xdir was prepended to $pic_object above.
cannam@140 5938 non_pic_object="$pic_object"
cannam@140 5939 func_append non_pic_objects " $non_pic_object"
cannam@140 5940 fi
cannam@140 5941 else
cannam@140 5942 # Only an error if not doing a dry-run.
cannam@140 5943 if $opt_dry_run; then
cannam@140 5944 # Extract subdirectory from the argument.
cannam@140 5945 func_dirname "$arg" "/" ""
cannam@140 5946 xdir="$func_dirname_result"
cannam@140 5947
cannam@140 5948 func_lo2o "$arg"
cannam@140 5949 pic_object=$xdir$objdir/$func_lo2o_result
cannam@140 5950 non_pic_object=$xdir$func_lo2o_result
cannam@140 5951 func_append libobjs " $pic_object"
cannam@140 5952 func_append non_pic_objects " $non_pic_object"
cannam@140 5953 else
cannam@140 5954 func_fatal_error "\`$arg' is not a valid libtool object"
cannam@140 5955 fi
cannam@140 5956 fi
cannam@140 5957 ;;
cannam@140 5958
cannam@140 5959 *.$libext)
cannam@140 5960 # An archive.
cannam@140 5961 func_append deplibs " $arg"
cannam@140 5962 func_append old_deplibs " $arg"
cannam@140 5963 continue
cannam@140 5964 ;;
cannam@140 5965
cannam@140 5966 *.la)
cannam@140 5967 # A libtool-controlled library.
cannam@140 5968
cannam@140 5969 func_resolve_sysroot "$arg"
cannam@140 5970 if test "$prev" = dlfiles; then
cannam@140 5971 # This library was specified with -dlopen.
cannam@140 5972 func_append dlfiles " $func_resolve_sysroot_result"
cannam@140 5973 prev=
cannam@140 5974 elif test "$prev" = dlprefiles; then
cannam@140 5975 # The library was specified with -dlpreopen.
cannam@140 5976 func_append dlprefiles " $func_resolve_sysroot_result"
cannam@140 5977 prev=
cannam@140 5978 else
cannam@140 5979 func_append deplibs " $func_resolve_sysroot_result"
cannam@140 5980 fi
cannam@140 5981 continue
cannam@140 5982 ;;
cannam@140 5983
cannam@140 5984 # Some other compiler argument.
cannam@140 5985 *)
cannam@140 5986 # Unknown arguments in both finalize_command and compile_command need
cannam@140 5987 # to be aesthetically quoted because they are evaled later.
cannam@140 5988 func_quote_for_eval "$arg"
cannam@140 5989 arg="$func_quote_for_eval_result"
cannam@140 5990 ;;
cannam@140 5991 esac # arg
cannam@140 5992
cannam@140 5993 # Now actually substitute the argument into the commands.
cannam@140 5994 if test -n "$arg"; then
cannam@140 5995 func_append compile_command " $arg"
cannam@140 5996 func_append finalize_command " $arg"
cannam@140 5997 fi
cannam@140 5998 done # argument parsing loop
cannam@140 5999
cannam@140 6000 test -n "$prev" && \
cannam@140 6001 func_fatal_help "the \`$prevarg' option requires an argument"
cannam@140 6002
cannam@140 6003 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
cannam@140 6004 eval arg=\"$export_dynamic_flag_spec\"
cannam@140 6005 func_append compile_command " $arg"
cannam@140 6006 func_append finalize_command " $arg"
cannam@140 6007 fi
cannam@140 6008
cannam@140 6009 oldlibs=
cannam@140 6010 # calculate the name of the file, without its directory
cannam@140 6011 func_basename "$output"
cannam@140 6012 outputname="$func_basename_result"
cannam@140 6013 libobjs_save="$libobjs"
cannam@140 6014
cannam@140 6015 if test -n "$shlibpath_var"; then
cannam@140 6016 # get the directories listed in $shlibpath_var
cannam@140 6017 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
cannam@140 6018 else
cannam@140 6019 shlib_search_path=
cannam@140 6020 fi
cannam@140 6021 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
cannam@140 6022 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
cannam@140 6023
cannam@140 6024 func_dirname "$output" "/" ""
cannam@140 6025 output_objdir="$func_dirname_result$objdir"
cannam@140 6026 func_to_tool_file "$output_objdir/"
cannam@140 6027 tool_output_objdir=$func_to_tool_file_result
cannam@140 6028 # Create the object directory.
cannam@140 6029 func_mkdir_p "$output_objdir"
cannam@140 6030
cannam@140 6031 # Determine the type of output
cannam@140 6032 case $output in
cannam@140 6033 "")
cannam@140 6034 func_fatal_help "you must specify an output file"
cannam@140 6035 ;;
cannam@140 6036 *.$libext) linkmode=oldlib ;;
cannam@140 6037 *.lo | *.$objext) linkmode=obj ;;
cannam@140 6038 *.la) linkmode=lib ;;
cannam@140 6039 *) linkmode=prog ;; # Anything else should be a program.
cannam@140 6040 esac
cannam@140 6041
cannam@140 6042 specialdeplibs=
cannam@140 6043
cannam@140 6044 libs=
cannam@140 6045 # Find all interdependent deplibs by searching for libraries
cannam@140 6046 # that are linked more than once (e.g. -la -lb -la)
cannam@140 6047 for deplib in $deplibs; do
cannam@140 6048 if $opt_preserve_dup_deps ; then
cannam@140 6049 case "$libs " in
cannam@140 6050 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
cannam@140 6051 esac
cannam@140 6052 fi
cannam@140 6053 func_append libs " $deplib"
cannam@140 6054 done
cannam@140 6055
cannam@140 6056 if test "$linkmode" = lib; then
cannam@140 6057 libs="$predeps $libs $compiler_lib_search_path $postdeps"
cannam@140 6058
cannam@140 6059 # Compute libraries that are listed more than once in $predeps
cannam@140 6060 # $postdeps and mark them as special (i.e., whose duplicates are
cannam@140 6061 # not to be eliminated).
cannam@140 6062 pre_post_deps=
cannam@140 6063 if $opt_duplicate_compiler_generated_deps; then
cannam@140 6064 for pre_post_dep in $predeps $postdeps; do
cannam@140 6065 case "$pre_post_deps " in
cannam@140 6066 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
cannam@140 6067 esac
cannam@140 6068 func_append pre_post_deps " $pre_post_dep"
cannam@140 6069 done
cannam@140 6070 fi
cannam@140 6071 pre_post_deps=
cannam@140 6072 fi
cannam@140 6073
cannam@140 6074 deplibs=
cannam@140 6075 newdependency_libs=
cannam@140 6076 newlib_search_path=
cannam@140 6077 need_relink=no # whether we're linking any uninstalled libtool libraries
cannam@140 6078 notinst_deplibs= # not-installed libtool libraries
cannam@140 6079 notinst_path= # paths that contain not-installed libtool libraries
cannam@140 6080
cannam@140 6081 case $linkmode in
cannam@140 6082 lib)
cannam@140 6083 passes="conv dlpreopen link"
cannam@140 6084 for file in $dlfiles $dlprefiles; do
cannam@140 6085 case $file in
cannam@140 6086 *.la) ;;
cannam@140 6087 *)
cannam@140 6088 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
cannam@140 6089 ;;
cannam@140 6090 esac
cannam@140 6091 done
cannam@140 6092 ;;
cannam@140 6093 prog)
cannam@140 6094 compile_deplibs=
cannam@140 6095 finalize_deplibs=
cannam@140 6096 alldeplibs=no
cannam@140 6097 newdlfiles=
cannam@140 6098 newdlprefiles=
cannam@140 6099 passes="conv scan dlopen dlpreopen link"
cannam@140 6100 ;;
cannam@140 6101 *) passes="conv"
cannam@140 6102 ;;
cannam@140 6103 esac
cannam@140 6104
cannam@140 6105 for pass in $passes; do
cannam@140 6106 # The preopen pass in lib mode reverses $deplibs; put it back here
cannam@140 6107 # so that -L comes before libs that need it for instance...
cannam@140 6108 if test "$linkmode,$pass" = "lib,link"; then
cannam@140 6109 ## FIXME: Find the place where the list is rebuilt in the wrong
cannam@140 6110 ## order, and fix it there properly
cannam@140 6111 tmp_deplibs=
cannam@140 6112 for deplib in $deplibs; do
cannam@140 6113 tmp_deplibs="$deplib $tmp_deplibs"
cannam@140 6114 done
cannam@140 6115 deplibs="$tmp_deplibs"
cannam@140 6116 fi
cannam@140 6117
cannam@140 6118 if test "$linkmode,$pass" = "lib,link" ||
cannam@140 6119 test "$linkmode,$pass" = "prog,scan"; then
cannam@140 6120 libs="$deplibs"
cannam@140 6121 deplibs=
cannam@140 6122 fi
cannam@140 6123 if test "$linkmode" = prog; then
cannam@140 6124 case $pass in
cannam@140 6125 dlopen) libs="$dlfiles" ;;
cannam@140 6126 dlpreopen) libs="$dlprefiles" ;;
cannam@140 6127 link)
cannam@140 6128 libs="$deplibs %DEPLIBS%"
cannam@140 6129 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
cannam@140 6130 ;;
cannam@140 6131 esac
cannam@140 6132 fi
cannam@140 6133 if test "$linkmode,$pass" = "lib,dlpreopen"; then
cannam@140 6134 # Collect and forward deplibs of preopened libtool libs
cannam@140 6135 for lib in $dlprefiles; do
cannam@140 6136 # Ignore non-libtool-libs
cannam@140 6137 dependency_libs=
cannam@140 6138 func_resolve_sysroot "$lib"
cannam@140 6139 case $lib in
cannam@140 6140 *.la) func_source "$func_resolve_sysroot_result" ;;
cannam@140 6141 esac
cannam@140 6142
cannam@140 6143 # Collect preopened libtool deplibs, except any this library
cannam@140 6144 # has declared as weak libs
cannam@140 6145 for deplib in $dependency_libs; do
cannam@140 6146 func_basename "$deplib"
cannam@140 6147 deplib_base=$func_basename_result
cannam@140 6148 case " $weak_libs " in
cannam@140 6149 *" $deplib_base "*) ;;
cannam@140 6150 *) func_append deplibs " $deplib" ;;
cannam@140 6151 esac
cannam@140 6152 done
cannam@140 6153 done
cannam@140 6154 libs="$dlprefiles"
cannam@140 6155 fi
cannam@140 6156 if test "$pass" = dlopen; then
cannam@140 6157 # Collect dlpreopened libraries
cannam@140 6158 save_deplibs="$deplibs"
cannam@140 6159 deplibs=
cannam@140 6160 fi
cannam@140 6161
cannam@140 6162 for deplib in $libs; do
cannam@140 6163 lib=
cannam@140 6164 found=no
cannam@140 6165 case $deplib in
cannam@140 6166 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
cannam@140 6167 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
cannam@140 6168 if test "$linkmode,$pass" = "prog,link"; then
cannam@140 6169 compile_deplibs="$deplib $compile_deplibs"
cannam@140 6170 finalize_deplibs="$deplib $finalize_deplibs"
cannam@140 6171 else
cannam@140 6172 func_append compiler_flags " $deplib"
cannam@140 6173 if test "$linkmode" = lib ; then
cannam@140 6174 case "$new_inherited_linker_flags " in
cannam@140 6175 *" $deplib "*) ;;
cannam@140 6176 * ) func_append new_inherited_linker_flags " $deplib" ;;
cannam@140 6177 esac
cannam@140 6178 fi
cannam@140 6179 fi
cannam@140 6180 continue
cannam@140 6181 ;;
cannam@140 6182 -l*)
cannam@140 6183 if test "$linkmode" != lib && test "$linkmode" != prog; then
cannam@140 6184 func_warning "\`-l' is ignored for archives/objects"
cannam@140 6185 continue
cannam@140 6186 fi
cannam@140 6187 func_stripname '-l' '' "$deplib"
cannam@140 6188 name=$func_stripname_result
cannam@140 6189 if test "$linkmode" = lib; then
cannam@140 6190 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
cannam@140 6191 else
cannam@140 6192 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
cannam@140 6193 fi
cannam@140 6194 for searchdir in $searchdirs; do
cannam@140 6195 for search_ext in .la $std_shrext .so .a; do
cannam@140 6196 # Search the libtool library
cannam@140 6197 lib="$searchdir/lib${name}${search_ext}"
cannam@140 6198 if test -f "$lib"; then
cannam@140 6199 if test "$search_ext" = ".la"; then
cannam@140 6200 found=yes
cannam@140 6201 else
cannam@140 6202 found=no
cannam@140 6203 fi
cannam@140 6204 break 2
cannam@140 6205 fi
cannam@140 6206 done
cannam@140 6207 done
cannam@140 6208 if test "$found" != yes; then
cannam@140 6209 # deplib doesn't seem to be a libtool library
cannam@140 6210 if test "$linkmode,$pass" = "prog,link"; then
cannam@140 6211 compile_deplibs="$deplib $compile_deplibs"
cannam@140 6212 finalize_deplibs="$deplib $finalize_deplibs"
cannam@140 6213 else
cannam@140 6214 deplibs="$deplib $deplibs"
cannam@140 6215 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
cannam@140 6216 fi
cannam@140 6217 continue
cannam@140 6218 else # deplib is a libtool library
cannam@140 6219 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
cannam@140 6220 # We need to do some special things here, and not later.
cannam@140 6221 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
cannam@140 6222 case " $predeps $postdeps " in
cannam@140 6223 *" $deplib "*)
cannam@140 6224 if func_lalib_p "$lib"; then
cannam@140 6225 library_names=
cannam@140 6226 old_library=
cannam@140 6227 func_source "$lib"
cannam@140 6228 for l in $old_library $library_names; do
cannam@140 6229 ll="$l"
cannam@140 6230 done
cannam@140 6231 if test "X$ll" = "X$old_library" ; then # only static version available
cannam@140 6232 found=no
cannam@140 6233 func_dirname "$lib" "" "."
cannam@140 6234 ladir="$func_dirname_result"
cannam@140 6235 lib=$ladir/$old_library
cannam@140 6236 if test "$linkmode,$pass" = "prog,link"; then
cannam@140 6237 compile_deplibs="$deplib $compile_deplibs"
cannam@140 6238 finalize_deplibs="$deplib $finalize_deplibs"
cannam@140 6239 else
cannam@140 6240 deplibs="$deplib $deplibs"
cannam@140 6241 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
cannam@140 6242 fi
cannam@140 6243 continue
cannam@140 6244 fi
cannam@140 6245 fi
cannam@140 6246 ;;
cannam@140 6247 *) ;;
cannam@140 6248 esac
cannam@140 6249 fi
cannam@140 6250 fi
cannam@140 6251 ;; # -l
cannam@140 6252 *.ltframework)
cannam@140 6253 if test "$linkmode,$pass" = "prog,link"; then
cannam@140 6254 compile_deplibs="$deplib $compile_deplibs"
cannam@140 6255 finalize_deplibs="$deplib $finalize_deplibs"
cannam@140 6256 else
cannam@140 6257 deplibs="$deplib $deplibs"
cannam@140 6258 if test "$linkmode" = lib ; then
cannam@140 6259 case "$new_inherited_linker_flags " in
cannam@140 6260 *" $deplib "*) ;;
cannam@140 6261 * ) func_append new_inherited_linker_flags " $deplib" ;;
cannam@140 6262 esac
cannam@140 6263 fi
cannam@140 6264 fi
cannam@140 6265 continue
cannam@140 6266 ;;
cannam@140 6267 -L*)
cannam@140 6268 case $linkmode in
cannam@140 6269 lib)
cannam@140 6270 deplibs="$deplib $deplibs"
cannam@140 6271 test "$pass" = conv && continue
cannam@140 6272 newdependency_libs="$deplib $newdependency_libs"
cannam@140 6273 func_stripname '-L' '' "$deplib"
cannam@140 6274 func_resolve_sysroot "$func_stripname_result"
cannam@140 6275 func_append newlib_search_path " $func_resolve_sysroot_result"
cannam@140 6276 ;;
cannam@140 6277 prog)
cannam@140 6278 if test "$pass" = conv; then
cannam@140 6279 deplibs="$deplib $deplibs"
cannam@140 6280 continue
cannam@140 6281 fi
cannam@140 6282 if test "$pass" = scan; then
cannam@140 6283 deplibs="$deplib $deplibs"
cannam@140 6284 else
cannam@140 6285 compile_deplibs="$deplib $compile_deplibs"
cannam@140 6286 finalize_deplibs="$deplib $finalize_deplibs"
cannam@140 6287 fi
cannam@140 6288 func_stripname '-L' '' "$deplib"
cannam@140 6289 func_resolve_sysroot "$func_stripname_result"
cannam@140 6290 func_append newlib_search_path " $func_resolve_sysroot_result"
cannam@140 6291 ;;
cannam@140 6292 *)
cannam@140 6293 func_warning "\`-L' is ignored for archives/objects"
cannam@140 6294 ;;
cannam@140 6295 esac # linkmode
cannam@140 6296 continue
cannam@140 6297 ;; # -L
cannam@140 6298 -R*)
cannam@140 6299 if test "$pass" = link; then
cannam@140 6300 func_stripname '-R' '' "$deplib"
cannam@140 6301 func_resolve_sysroot "$func_stripname_result"
cannam@140 6302 dir=$func_resolve_sysroot_result
cannam@140 6303 # Make sure the xrpath contains only unique directories.
cannam@140 6304 case "$xrpath " in
cannam@140 6305 *" $dir "*) ;;
cannam@140 6306 *) func_append xrpath " $dir" ;;
cannam@140 6307 esac
cannam@140 6308 fi
cannam@140 6309 deplibs="$deplib $deplibs"
cannam@140 6310 continue
cannam@140 6311 ;;
cannam@140 6312 *.la)
cannam@140 6313 func_resolve_sysroot "$deplib"
cannam@140 6314 lib=$func_resolve_sysroot_result
cannam@140 6315 ;;
cannam@140 6316 *.$libext)
cannam@140 6317 if test "$pass" = conv; then
cannam@140 6318 deplibs="$deplib $deplibs"
cannam@140 6319 continue
cannam@140 6320 fi
cannam@140 6321 case $linkmode in
cannam@140 6322 lib)
cannam@140 6323 # Linking convenience modules into shared libraries is allowed,
cannam@140 6324 # but linking other static libraries is non-portable.
cannam@140 6325 case " $dlpreconveniencelibs " in
cannam@140 6326 *" $deplib "*) ;;
cannam@140 6327 *)
cannam@140 6328 valid_a_lib=no
cannam@140 6329 case $deplibs_check_method in
cannam@140 6330 match_pattern*)
cannam@140 6331 set dummy $deplibs_check_method; shift
cannam@140 6332 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
cannam@140 6333 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
cannam@140 6334 | $EGREP "$match_pattern_regex" > /dev/null; then
cannam@140 6335 valid_a_lib=yes
cannam@140 6336 fi
cannam@140 6337 ;;
cannam@140 6338 pass_all)
cannam@140 6339 valid_a_lib=yes
cannam@140 6340 ;;
cannam@140 6341 esac
cannam@140 6342 if test "$valid_a_lib" != yes; then
cannam@140 6343 echo
cannam@140 6344 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
cannam@140 6345 echo "*** I have the capability to make that library automatically link in when"
cannam@140 6346 echo "*** you link to this library. But I can only do this if you have a"
cannam@140 6347 echo "*** shared version of the library, which you do not appear to have"
cannam@140 6348 echo "*** because the file extensions .$libext of this argument makes me believe"
cannam@140 6349 echo "*** that it is just a static archive that I should not use here."
cannam@140 6350 else
cannam@140 6351 echo
cannam@140 6352 $ECHO "*** Warning: Linking the shared library $output against the"
cannam@140 6353 $ECHO "*** static library $deplib is not portable!"
cannam@140 6354 deplibs="$deplib $deplibs"
cannam@140 6355 fi
cannam@140 6356 ;;
cannam@140 6357 esac
cannam@140 6358 continue
cannam@140 6359 ;;
cannam@140 6360 prog)
cannam@140 6361 if test "$pass" != link; then
cannam@140 6362 deplibs="$deplib $deplibs"
cannam@140 6363 else
cannam@140 6364 compile_deplibs="$deplib $compile_deplibs"
cannam@140 6365 finalize_deplibs="$deplib $finalize_deplibs"
cannam@140 6366 fi
cannam@140 6367 continue
cannam@140 6368 ;;
cannam@140 6369 esac # linkmode
cannam@140 6370 ;; # *.$libext
cannam@140 6371 *.lo | *.$objext)
cannam@140 6372 if test "$pass" = conv; then
cannam@140 6373 deplibs="$deplib $deplibs"
cannam@140 6374 elif test "$linkmode" = prog; then
cannam@140 6375 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
cannam@140 6376 # If there is no dlopen support or we're linking statically,
cannam@140 6377 # we need to preload.
cannam@140 6378 func_append newdlprefiles " $deplib"
cannam@140 6379 compile_deplibs="$deplib $compile_deplibs"
cannam@140 6380 finalize_deplibs="$deplib $finalize_deplibs"
cannam@140 6381 else
cannam@140 6382 func_append newdlfiles " $deplib"
cannam@140 6383 fi
cannam@140 6384 fi
cannam@140 6385 continue
cannam@140 6386 ;;
cannam@140 6387 %DEPLIBS%)
cannam@140 6388 alldeplibs=yes
cannam@140 6389 continue
cannam@140 6390 ;;
cannam@140 6391 esac # case $deplib
cannam@140 6392
cannam@140 6393 if test "$found" = yes || test -f "$lib"; then :
cannam@140 6394 else
cannam@140 6395 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
cannam@140 6396 fi
cannam@140 6397
cannam@140 6398 # Check to see that this really is a libtool archive.
cannam@140 6399 func_lalib_unsafe_p "$lib" \
cannam@140 6400 || func_fatal_error "\`$lib' is not a valid libtool archive"
cannam@140 6401
cannam@140 6402 func_dirname "$lib" "" "."
cannam@140 6403 ladir="$func_dirname_result"
cannam@140 6404
cannam@140 6405 dlname=
cannam@140 6406 dlopen=
cannam@140 6407 dlpreopen=
cannam@140 6408 libdir=
cannam@140 6409 library_names=
cannam@140 6410 old_library=
cannam@140 6411 inherited_linker_flags=
cannam@140 6412 # If the library was installed with an old release of libtool,
cannam@140 6413 # it will not redefine variables installed, or shouldnotlink
cannam@140 6414 installed=yes
cannam@140 6415 shouldnotlink=no
cannam@140 6416 avoidtemprpath=
cannam@140 6417
cannam@140 6418
cannam@140 6419 # Read the .la file
cannam@140 6420 func_source "$lib"
cannam@140 6421
cannam@140 6422 # Convert "-framework foo" to "foo.ltframework"
cannam@140 6423 if test -n "$inherited_linker_flags"; then
cannam@140 6424 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
cannam@140 6425 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
cannam@140 6426 case " $new_inherited_linker_flags " in
cannam@140 6427 *" $tmp_inherited_linker_flag "*) ;;
cannam@140 6428 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
cannam@140 6429 esac
cannam@140 6430 done
cannam@140 6431 fi
cannam@140 6432 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@140 6433 if test "$linkmode,$pass" = "lib,link" ||
cannam@140 6434 test "$linkmode,$pass" = "prog,scan" ||
cannam@140 6435 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
cannam@140 6436 test -n "$dlopen" && func_append dlfiles " $dlopen"
cannam@140 6437 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
cannam@140 6438 fi
cannam@140 6439
cannam@140 6440 if test "$pass" = conv; then
cannam@140 6441 # Only check for convenience libraries
cannam@140 6442 deplibs="$lib $deplibs"
cannam@140 6443 if test -z "$libdir"; then
cannam@140 6444 if test -z "$old_library"; then
cannam@140 6445 func_fatal_error "cannot find name of link library for \`$lib'"
cannam@140 6446 fi
cannam@140 6447 # It is a libtool convenience library, so add in its objects.
cannam@140 6448 func_append convenience " $ladir/$objdir/$old_library"
cannam@140 6449 func_append old_convenience " $ladir/$objdir/$old_library"
cannam@140 6450 tmp_libs=
cannam@140 6451 for deplib in $dependency_libs; do
cannam@140 6452 deplibs="$deplib $deplibs"
cannam@140 6453 if $opt_preserve_dup_deps ; then
cannam@140 6454 case "$tmp_libs " in
cannam@140 6455 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
cannam@140 6456 esac
cannam@140 6457 fi
cannam@140 6458 func_append tmp_libs " $deplib"
cannam@140 6459 done
cannam@140 6460 elif test "$linkmode" != prog && test "$linkmode" != lib; then
cannam@140 6461 func_fatal_error "\`$lib' is not a convenience library"
cannam@140 6462 fi
cannam@140 6463 continue
cannam@140 6464 fi # $pass = conv
cannam@140 6465
cannam@140 6466
cannam@140 6467 # Get the name of the library we link against.
cannam@140 6468 linklib=
cannam@140 6469 if test -n "$old_library" &&
cannam@140 6470 { test "$prefer_static_libs" = yes ||
cannam@140 6471 test "$prefer_static_libs,$installed" = "built,no"; }; then
cannam@140 6472 linklib=$old_library
cannam@140 6473 else
cannam@140 6474 for l in $old_library $library_names; do
cannam@140 6475 linklib="$l"
cannam@140 6476 done
cannam@140 6477 fi
cannam@140 6478 if test -z "$linklib"; then
cannam@140 6479 func_fatal_error "cannot find name of link library for \`$lib'"
cannam@140 6480 fi
cannam@140 6481
cannam@140 6482 # This library was specified with -dlopen.
cannam@140 6483 if test "$pass" = dlopen; then
cannam@140 6484 if test -z "$libdir"; then
cannam@140 6485 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
cannam@140 6486 fi
cannam@140 6487 if test -z "$dlname" ||
cannam@140 6488 test "$dlopen_support" != yes ||
cannam@140 6489 test "$build_libtool_libs" = no; then
cannam@140 6490 # If there is no dlname, no dlopen support or we're linking
cannam@140 6491 # statically, we need to preload. We also need to preload any
cannam@140 6492 # dependent libraries so libltdl's deplib preloader doesn't
cannam@140 6493 # bomb out in the load deplibs phase.
cannam@140 6494 func_append dlprefiles " $lib $dependency_libs"
cannam@140 6495 else
cannam@140 6496 func_append newdlfiles " $lib"
cannam@140 6497 fi
cannam@140 6498 continue
cannam@140 6499 fi # $pass = dlopen
cannam@140 6500
cannam@140 6501 # We need an absolute path.
cannam@140 6502 case $ladir in
cannam@140 6503 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
cannam@140 6504 *)
cannam@140 6505 abs_ladir=`cd "$ladir" && pwd`
cannam@140 6506 if test -z "$abs_ladir"; then
cannam@140 6507 func_warning "cannot determine absolute directory name of \`$ladir'"
cannam@140 6508 func_warning "passing it literally to the linker, although it might fail"
cannam@140 6509 abs_ladir="$ladir"
cannam@140 6510 fi
cannam@140 6511 ;;
cannam@140 6512 esac
cannam@140 6513 func_basename "$lib"
cannam@140 6514 laname="$func_basename_result"
cannam@140 6515
cannam@140 6516 # Find the relevant object directory and library name.
cannam@140 6517 if test "X$installed" = Xyes; then
cannam@140 6518 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
cannam@140 6519 func_warning "library \`$lib' was moved."
cannam@140 6520 dir="$ladir"
cannam@140 6521 absdir="$abs_ladir"
cannam@140 6522 libdir="$abs_ladir"
cannam@140 6523 else
cannam@140 6524 dir="$lt_sysroot$libdir"
cannam@140 6525 absdir="$lt_sysroot$libdir"
cannam@140 6526 fi
cannam@140 6527 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
cannam@140 6528 else
cannam@140 6529 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
cannam@140 6530 dir="$ladir"
cannam@140 6531 absdir="$abs_ladir"
cannam@140 6532 # Remove this search path later
cannam@140 6533 func_append notinst_path " $abs_ladir"
cannam@140 6534 else
cannam@140 6535 dir="$ladir/$objdir"
cannam@140 6536 absdir="$abs_ladir/$objdir"
cannam@140 6537 # Remove this search path later
cannam@140 6538 func_append notinst_path " $abs_ladir"
cannam@140 6539 fi
cannam@140 6540 fi # $installed = yes
cannam@140 6541 func_stripname 'lib' '.la' "$laname"
cannam@140 6542 name=$func_stripname_result
cannam@140 6543
cannam@140 6544 # This library was specified with -dlpreopen.
cannam@140 6545 if test "$pass" = dlpreopen; then
cannam@140 6546 if test -z "$libdir" && test "$linkmode" = prog; then
cannam@140 6547 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
cannam@140 6548 fi
cannam@140 6549 case "$host" in
cannam@140 6550 # special handling for platforms with PE-DLLs.
cannam@140 6551 *cygwin* | *mingw* | *cegcc* )
cannam@140 6552 # Linker will automatically link against shared library if both
cannam@140 6553 # static and shared are present. Therefore, ensure we extract
cannam@140 6554 # symbols from the import library if a shared library is present
cannam@140 6555 # (otherwise, the dlopen module name will be incorrect). We do
cannam@140 6556 # this by putting the import library name into $newdlprefiles.
cannam@140 6557 # We recover the dlopen module name by 'saving' the la file
cannam@140 6558 # name in a special purpose variable, and (later) extracting the
cannam@140 6559 # dlname from the la file.
cannam@140 6560 if test -n "$dlname"; then
cannam@140 6561 func_tr_sh "$dir/$linklib"
cannam@140 6562 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
cannam@140 6563 func_append newdlprefiles " $dir/$linklib"
cannam@140 6564 else
cannam@140 6565 func_append newdlprefiles " $dir/$old_library"
cannam@140 6566 # Keep a list of preopened convenience libraries to check
cannam@140 6567 # that they are being used correctly in the link pass.
cannam@140 6568 test -z "$libdir" && \
cannam@140 6569 func_append dlpreconveniencelibs " $dir/$old_library"
cannam@140 6570 fi
cannam@140 6571 ;;
cannam@140 6572 * )
cannam@140 6573 # Prefer using a static library (so that no silly _DYNAMIC symbols
cannam@140 6574 # are required to link).
cannam@140 6575 if test -n "$old_library"; then
cannam@140 6576 func_append newdlprefiles " $dir/$old_library"
cannam@140 6577 # Keep a list of preopened convenience libraries to check
cannam@140 6578 # that they are being used correctly in the link pass.
cannam@140 6579 test -z "$libdir" && \
cannam@140 6580 func_append dlpreconveniencelibs " $dir/$old_library"
cannam@140 6581 # Otherwise, use the dlname, so that lt_dlopen finds it.
cannam@140 6582 elif test -n "$dlname"; then
cannam@140 6583 func_append newdlprefiles " $dir/$dlname"
cannam@140 6584 else
cannam@140 6585 func_append newdlprefiles " $dir/$linklib"
cannam@140 6586 fi
cannam@140 6587 ;;
cannam@140 6588 esac
cannam@140 6589 fi # $pass = dlpreopen
cannam@140 6590
cannam@140 6591 if test -z "$libdir"; then
cannam@140 6592 # Link the convenience library
cannam@140 6593 if test "$linkmode" = lib; then
cannam@140 6594 deplibs="$dir/$old_library $deplibs"
cannam@140 6595 elif test "$linkmode,$pass" = "prog,link"; then
cannam@140 6596 compile_deplibs="$dir/$old_library $compile_deplibs"
cannam@140 6597 finalize_deplibs="$dir/$old_library $finalize_deplibs"
cannam@140 6598 else
cannam@140 6599 deplibs="$lib $deplibs" # used for prog,scan pass
cannam@140 6600 fi
cannam@140 6601 continue
cannam@140 6602 fi
cannam@140 6603
cannam@140 6604
cannam@140 6605 if test "$linkmode" = prog && test "$pass" != link; then
cannam@140 6606 func_append newlib_search_path " $ladir"
cannam@140 6607 deplibs="$lib $deplibs"
cannam@140 6608
cannam@140 6609 linkalldeplibs=no
cannam@140 6610 if test "$link_all_deplibs" != no || test -z "$library_names" ||
cannam@140 6611 test "$build_libtool_libs" = no; then
cannam@140 6612 linkalldeplibs=yes
cannam@140 6613 fi
cannam@140 6614
cannam@140 6615 tmp_libs=
cannam@140 6616 for deplib in $dependency_libs; do
cannam@140 6617 case $deplib in
cannam@140 6618 -L*) func_stripname '-L' '' "$deplib"
cannam@140 6619 func_resolve_sysroot "$func_stripname_result"
cannam@140 6620 func_append newlib_search_path " $func_resolve_sysroot_result"
cannam@140 6621 ;;
cannam@140 6622 esac
cannam@140 6623 # Need to link against all dependency_libs?
cannam@140 6624 if test "$linkalldeplibs" = yes; then
cannam@140 6625 deplibs="$deplib $deplibs"
cannam@140 6626 else
cannam@140 6627 # Need to hardcode shared library paths
cannam@140 6628 # or/and link against static libraries
cannam@140 6629 newdependency_libs="$deplib $newdependency_libs"
cannam@140 6630 fi
cannam@140 6631 if $opt_preserve_dup_deps ; then
cannam@140 6632 case "$tmp_libs " in
cannam@140 6633 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
cannam@140 6634 esac
cannam@140 6635 fi
cannam@140 6636 func_append tmp_libs " $deplib"
cannam@140 6637 done # for deplib
cannam@140 6638 continue
cannam@140 6639 fi # $linkmode = prog...
cannam@140 6640
cannam@140 6641 if test "$linkmode,$pass" = "prog,link"; then
cannam@140 6642 if test -n "$library_names" &&
cannam@140 6643 { { test "$prefer_static_libs" = no ||
cannam@140 6644 test "$prefer_static_libs,$installed" = "built,yes"; } ||
cannam@140 6645 test -z "$old_library"; }; then
cannam@140 6646 # We need to hardcode the library path
cannam@140 6647 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
cannam@140 6648 # Make sure the rpath contains only unique directories.
cannam@140 6649 case "$temp_rpath:" in
cannam@140 6650 *"$absdir:"*) ;;
cannam@140 6651 *) func_append temp_rpath "$absdir:" ;;
cannam@140 6652 esac
cannam@140 6653 fi
cannam@140 6654
cannam@140 6655 # Hardcode the library path.
cannam@140 6656 # Skip directories that are in the system default run-time
cannam@140 6657 # search path.
cannam@140 6658 case " $sys_lib_dlsearch_path " in
cannam@140 6659 *" $absdir "*) ;;
cannam@140 6660 *)
cannam@140 6661 case "$compile_rpath " in
cannam@140 6662 *" $absdir "*) ;;
cannam@140 6663 *) func_append compile_rpath " $absdir" ;;
cannam@140 6664 esac
cannam@140 6665 ;;
cannam@140 6666 esac
cannam@140 6667 case " $sys_lib_dlsearch_path " in
cannam@140 6668 *" $libdir "*) ;;
cannam@140 6669 *)
cannam@140 6670 case "$finalize_rpath " in
cannam@140 6671 *" $libdir "*) ;;
cannam@140 6672 *) func_append finalize_rpath " $libdir" ;;
cannam@140 6673 esac
cannam@140 6674 ;;
cannam@140 6675 esac
cannam@140 6676 fi # $linkmode,$pass = prog,link...
cannam@140 6677
cannam@140 6678 if test "$alldeplibs" = yes &&
cannam@140 6679 { test "$deplibs_check_method" = pass_all ||
cannam@140 6680 { test "$build_libtool_libs" = yes &&
cannam@140 6681 test -n "$library_names"; }; }; then
cannam@140 6682 # We only need to search for static libraries
cannam@140 6683 continue
cannam@140 6684 fi
cannam@140 6685 fi
cannam@140 6686
cannam@140 6687 link_static=no # Whether the deplib will be linked statically
cannam@140 6688 use_static_libs=$prefer_static_libs
cannam@140 6689 if test "$use_static_libs" = built && test "$installed" = yes; then
cannam@140 6690 use_static_libs=no
cannam@140 6691 fi
cannam@140 6692 if test -n "$library_names" &&
cannam@140 6693 { test "$use_static_libs" = no || test -z "$old_library"; }; then
cannam@140 6694 case $host in
cannam@140 6695 *cygwin* | *mingw* | *cegcc*)
cannam@140 6696 # No point in relinking DLLs because paths are not encoded
cannam@140 6697 func_append notinst_deplibs " $lib"
cannam@140 6698 need_relink=no
cannam@140 6699 ;;
cannam@140 6700 *)
cannam@140 6701 if test "$installed" = no; then
cannam@140 6702 func_append notinst_deplibs " $lib"
cannam@140 6703 need_relink=yes
cannam@140 6704 fi
cannam@140 6705 ;;
cannam@140 6706 esac
cannam@140 6707 # This is a shared library
cannam@140 6708
cannam@140 6709 # Warn about portability, can't link against -module's on some
cannam@140 6710 # systems (darwin). Don't bleat about dlopened modules though!
cannam@140 6711 dlopenmodule=""
cannam@140 6712 for dlpremoduletest in $dlprefiles; do
cannam@140 6713 if test "X$dlpremoduletest" = "X$lib"; then
cannam@140 6714 dlopenmodule="$dlpremoduletest"
cannam@140 6715 break
cannam@140 6716 fi
cannam@140 6717 done
cannam@140 6718 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
cannam@140 6719 echo
cannam@140 6720 if test "$linkmode" = prog; then
cannam@140 6721 $ECHO "*** Warning: Linking the executable $output against the loadable module"
cannam@140 6722 else
cannam@140 6723 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
cannam@140 6724 fi
cannam@140 6725 $ECHO "*** $linklib is not portable!"
cannam@140 6726 fi
cannam@140 6727 if test "$linkmode" = lib &&
cannam@140 6728 test "$hardcode_into_libs" = yes; then
cannam@140 6729 # Hardcode the library path.
cannam@140 6730 # Skip directories that are in the system default run-time
cannam@140 6731 # search path.
cannam@140 6732 case " $sys_lib_dlsearch_path " in
cannam@140 6733 *" $absdir "*) ;;
cannam@140 6734 *)
cannam@140 6735 case "$compile_rpath " in
cannam@140 6736 *" $absdir "*) ;;
cannam@140 6737 *) func_append compile_rpath " $absdir" ;;
cannam@140 6738 esac
cannam@140 6739 ;;
cannam@140 6740 esac
cannam@140 6741 case " $sys_lib_dlsearch_path " in
cannam@140 6742 *" $libdir "*) ;;
cannam@140 6743 *)
cannam@140 6744 case "$finalize_rpath " in
cannam@140 6745 *" $libdir "*) ;;
cannam@140 6746 *) func_append finalize_rpath " $libdir" ;;
cannam@140 6747 esac
cannam@140 6748 ;;
cannam@140 6749 esac
cannam@140 6750 fi
cannam@140 6751
cannam@140 6752 if test -n "$old_archive_from_expsyms_cmds"; then
cannam@140 6753 # figure out the soname
cannam@140 6754 set dummy $library_names
cannam@140 6755 shift
cannam@140 6756 realname="$1"
cannam@140 6757 shift
cannam@140 6758 libname=`eval "\\$ECHO \"$libname_spec\""`
cannam@140 6759 # use dlname if we got it. it's perfectly good, no?
cannam@140 6760 if test -n "$dlname"; then
cannam@140 6761 soname="$dlname"
cannam@140 6762 elif test -n "$soname_spec"; then
cannam@140 6763 # bleh windows
cannam@140 6764 case $host in
cannam@140 6765 *cygwin* | mingw* | *cegcc*)
cannam@140 6766 func_arith $current - $age
cannam@140 6767 major=$func_arith_result
cannam@140 6768 versuffix="-$major"
cannam@140 6769 ;;
cannam@140 6770 esac
cannam@140 6771 eval soname=\"$soname_spec\"
cannam@140 6772 else
cannam@140 6773 soname="$realname"
cannam@140 6774 fi
cannam@140 6775
cannam@140 6776 # Make a new name for the extract_expsyms_cmds to use
cannam@140 6777 soroot="$soname"
cannam@140 6778 func_basename "$soroot"
cannam@140 6779 soname="$func_basename_result"
cannam@140 6780 func_stripname 'lib' '.dll' "$soname"
cannam@140 6781 newlib=libimp-$func_stripname_result.a
cannam@140 6782
cannam@140 6783 # If the library has no export list, then create one now
cannam@140 6784 if test -f "$output_objdir/$soname-def"; then :
cannam@140 6785 else
cannam@140 6786 func_verbose "extracting exported symbol list from \`$soname'"
cannam@140 6787 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
cannam@140 6788 fi
cannam@140 6789
cannam@140 6790 # Create $newlib
cannam@140 6791 if test -f "$output_objdir/$newlib"; then :; else
cannam@140 6792 func_verbose "generating import library for \`$soname'"
cannam@140 6793 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
cannam@140 6794 fi
cannam@140 6795 # make sure the library variables are pointing to the new library
cannam@140 6796 dir=$output_objdir
cannam@140 6797 linklib=$newlib
cannam@140 6798 fi # test -n "$old_archive_from_expsyms_cmds"
cannam@140 6799
cannam@140 6800 if test "$linkmode" = prog || test "$opt_mode" != relink; then
cannam@140 6801 add_shlibpath=
cannam@140 6802 add_dir=
cannam@140 6803 add=
cannam@140 6804 lib_linked=yes
cannam@140 6805 case $hardcode_action in
cannam@140 6806 immediate | unsupported)
cannam@140 6807 if test "$hardcode_direct" = no; then
cannam@140 6808 add="$dir/$linklib"
cannam@140 6809 case $host in
cannam@140 6810 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
cannam@140 6811 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
cannam@140 6812 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
cannam@140 6813 *-*-unixware7*) add_dir="-L$dir" ;;
cannam@140 6814 *-*-darwin* )
cannam@140 6815 # if the lib is a (non-dlopened) module then we can not
cannam@140 6816 # link against it, someone is ignoring the earlier warnings
cannam@140 6817 if /usr/bin/file -L $add 2> /dev/null |
cannam@140 6818 $GREP ": [^:]* bundle" >/dev/null ; then
cannam@140 6819 if test "X$dlopenmodule" != "X$lib"; then
cannam@140 6820 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
cannam@140 6821 if test -z "$old_library" ; then
cannam@140 6822 echo
cannam@140 6823 echo "*** And there doesn't seem to be a static archive available"
cannam@140 6824 echo "*** The link will probably fail, sorry"
cannam@140 6825 else
cannam@140 6826 add="$dir/$old_library"
cannam@140 6827 fi
cannam@140 6828 elif test -n "$old_library"; then
cannam@140 6829 add="$dir/$old_library"
cannam@140 6830 fi
cannam@140 6831 fi
cannam@140 6832 esac
cannam@140 6833 elif test "$hardcode_minus_L" = no; then
cannam@140 6834 case $host in
cannam@140 6835 *-*-sunos*) add_shlibpath="$dir" ;;
cannam@140 6836 esac
cannam@140 6837 add_dir="-L$dir"
cannam@140 6838 add="-l$name"
cannam@140 6839 elif test "$hardcode_shlibpath_var" = no; then
cannam@140 6840 add_shlibpath="$dir"
cannam@140 6841 add="-l$name"
cannam@140 6842 else
cannam@140 6843 lib_linked=no
cannam@140 6844 fi
cannam@140 6845 ;;
cannam@140 6846 relink)
cannam@140 6847 if test "$hardcode_direct" = yes &&
cannam@140 6848 test "$hardcode_direct_absolute" = no; then
cannam@140 6849 add="$dir/$linklib"
cannam@140 6850 elif test "$hardcode_minus_L" = yes; then
cannam@140 6851 add_dir="-L$absdir"
cannam@140 6852 # Try looking first in the location we're being installed to.
cannam@140 6853 if test -n "$inst_prefix_dir"; then
cannam@140 6854 case $libdir in
cannam@140 6855 [\\/]*)
cannam@140 6856 func_append add_dir " -L$inst_prefix_dir$libdir"
cannam@140 6857 ;;
cannam@140 6858 esac
cannam@140 6859 fi
cannam@140 6860 add="-l$name"
cannam@140 6861 elif test "$hardcode_shlibpath_var" = yes; then
cannam@140 6862 add_shlibpath="$dir"
cannam@140 6863 add="-l$name"
cannam@140 6864 else
cannam@140 6865 lib_linked=no
cannam@140 6866 fi
cannam@140 6867 ;;
cannam@140 6868 *) lib_linked=no ;;
cannam@140 6869 esac
cannam@140 6870
cannam@140 6871 if test "$lib_linked" != yes; then
cannam@140 6872 func_fatal_configuration "unsupported hardcode properties"
cannam@140 6873 fi
cannam@140 6874
cannam@140 6875 if test -n "$add_shlibpath"; then
cannam@140 6876 case :$compile_shlibpath: in
cannam@140 6877 *":$add_shlibpath:"*) ;;
cannam@140 6878 *) func_append compile_shlibpath "$add_shlibpath:" ;;
cannam@140 6879 esac
cannam@140 6880 fi
cannam@140 6881 if test "$linkmode" = prog; then
cannam@140 6882 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
cannam@140 6883 test -n "$add" && compile_deplibs="$add $compile_deplibs"
cannam@140 6884 else
cannam@140 6885 test -n "$add_dir" && deplibs="$add_dir $deplibs"
cannam@140 6886 test -n "$add" && deplibs="$add $deplibs"
cannam@140 6887 if test "$hardcode_direct" != yes &&
cannam@140 6888 test "$hardcode_minus_L" != yes &&
cannam@140 6889 test "$hardcode_shlibpath_var" = yes; then
cannam@140 6890 case :$finalize_shlibpath: in
cannam@140 6891 *":$libdir:"*) ;;
cannam@140 6892 *) func_append finalize_shlibpath "$libdir:" ;;
cannam@140 6893 esac
cannam@140 6894 fi
cannam@140 6895 fi
cannam@140 6896 fi
cannam@140 6897
cannam@140 6898 if test "$linkmode" = prog || test "$opt_mode" = relink; then
cannam@140 6899 add_shlibpath=
cannam@140 6900 add_dir=
cannam@140 6901 add=
cannam@140 6902 # Finalize command for both is simple: just hardcode it.
cannam@140 6903 if test "$hardcode_direct" = yes &&
cannam@140 6904 test "$hardcode_direct_absolute" = no; then
cannam@140 6905 add="$libdir/$linklib"
cannam@140 6906 elif test "$hardcode_minus_L" = yes; then
cannam@140 6907 add_dir="-L$libdir"
cannam@140 6908 add="-l$name"
cannam@140 6909 elif test "$hardcode_shlibpath_var" = yes; then
cannam@140 6910 case :$finalize_shlibpath: in
cannam@140 6911 *":$libdir:"*) ;;
cannam@140 6912 *) func_append finalize_shlibpath "$libdir:" ;;
cannam@140 6913 esac
cannam@140 6914 add="-l$name"
cannam@140 6915 elif test "$hardcode_automatic" = yes; then
cannam@140 6916 if test -n "$inst_prefix_dir" &&
cannam@140 6917 test -f "$inst_prefix_dir$libdir/$linklib" ; then
cannam@140 6918 add="$inst_prefix_dir$libdir/$linklib"
cannam@140 6919 else
cannam@140 6920 add="$libdir/$linklib"
cannam@140 6921 fi
cannam@140 6922 else
cannam@140 6923 # We cannot seem to hardcode it, guess we'll fake it.
cannam@140 6924 add_dir="-L$libdir"
cannam@140 6925 # Try looking first in the location we're being installed to.
cannam@140 6926 if test -n "$inst_prefix_dir"; then
cannam@140 6927 case $libdir in
cannam@140 6928 [\\/]*)
cannam@140 6929 func_append add_dir " -L$inst_prefix_dir$libdir"
cannam@140 6930 ;;
cannam@140 6931 esac
cannam@140 6932 fi
cannam@140 6933 add="-l$name"
cannam@140 6934 fi
cannam@140 6935
cannam@140 6936 if test "$linkmode" = prog; then
cannam@140 6937 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
cannam@140 6938 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
cannam@140 6939 else
cannam@140 6940 test -n "$add_dir" && deplibs="$add_dir $deplibs"
cannam@140 6941 test -n "$add" && deplibs="$add $deplibs"
cannam@140 6942 fi
cannam@140 6943 fi
cannam@140 6944 elif test "$linkmode" = prog; then
cannam@140 6945 # Here we assume that one of hardcode_direct or hardcode_minus_L
cannam@140 6946 # is not unsupported. This is valid on all known static and
cannam@140 6947 # shared platforms.
cannam@140 6948 if test "$hardcode_direct" != unsupported; then
cannam@140 6949 test -n "$old_library" && linklib="$old_library"
cannam@140 6950 compile_deplibs="$dir/$linklib $compile_deplibs"
cannam@140 6951 finalize_deplibs="$dir/$linklib $finalize_deplibs"
cannam@140 6952 else
cannam@140 6953 compile_deplibs="-l$name -L$dir $compile_deplibs"
cannam@140 6954 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
cannam@140 6955 fi
cannam@140 6956 elif test "$build_libtool_libs" = yes; then
cannam@140 6957 # Not a shared library
cannam@140 6958 if test "$deplibs_check_method" != pass_all; then
cannam@140 6959 # We're trying link a shared library against a static one
cannam@140 6960 # but the system doesn't support it.
cannam@140 6961
cannam@140 6962 # Just print a warning and add the library to dependency_libs so
cannam@140 6963 # that the program can be linked against the static library.
cannam@140 6964 echo
cannam@140 6965 $ECHO "*** Warning: This system can not link to static lib archive $lib."
cannam@140 6966 echo "*** I have the capability to make that library automatically link in when"
cannam@140 6967 echo "*** you link to this library. But I can only do this if you have a"
cannam@140 6968 echo "*** shared version of the library, which you do not appear to have."
cannam@140 6969 if test "$module" = yes; then
cannam@140 6970 echo "*** But as you try to build a module library, libtool will still create "
cannam@140 6971 echo "*** a static module, that should work as long as the dlopening application"
cannam@140 6972 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
cannam@140 6973 if test -z "$global_symbol_pipe"; then
cannam@140 6974 echo
cannam@140 6975 echo "*** However, this would only work if libtool was able to extract symbol"
cannam@140 6976 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
cannam@140 6977 echo "*** not find such a program. So, this module is probably useless."
cannam@140 6978 echo "*** \`nm' from GNU binutils and a full rebuild may help."
cannam@140 6979 fi
cannam@140 6980 if test "$build_old_libs" = no; then
cannam@140 6981 build_libtool_libs=module
cannam@140 6982 build_old_libs=yes
cannam@140 6983 else
cannam@140 6984 build_libtool_libs=no
cannam@140 6985 fi
cannam@140 6986 fi
cannam@140 6987 else
cannam@140 6988 deplibs="$dir/$old_library $deplibs"
cannam@140 6989 link_static=yes
cannam@140 6990 fi
cannam@140 6991 fi # link shared/static library?
cannam@140 6992
cannam@140 6993 if test "$linkmode" = lib; then
cannam@140 6994 if test -n "$dependency_libs" &&
cannam@140 6995 { test "$hardcode_into_libs" != yes ||
cannam@140 6996 test "$build_old_libs" = yes ||
cannam@140 6997 test "$link_static" = yes; }; then
cannam@140 6998 # Extract -R from dependency_libs
cannam@140 6999 temp_deplibs=
cannam@140 7000 for libdir in $dependency_libs; do
cannam@140 7001 case $libdir in
cannam@140 7002 -R*) func_stripname '-R' '' "$libdir"
cannam@140 7003 temp_xrpath=$func_stripname_result
cannam@140 7004 case " $xrpath " in
cannam@140 7005 *" $temp_xrpath "*) ;;
cannam@140 7006 *) func_append xrpath " $temp_xrpath";;
cannam@140 7007 esac;;
cannam@140 7008 *) func_append temp_deplibs " $libdir";;
cannam@140 7009 esac
cannam@140 7010 done
cannam@140 7011 dependency_libs="$temp_deplibs"
cannam@140 7012 fi
cannam@140 7013
cannam@140 7014 func_append newlib_search_path " $absdir"
cannam@140 7015 # Link against this library
cannam@140 7016 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
cannam@140 7017 # ... and its dependency_libs
cannam@140 7018 tmp_libs=
cannam@140 7019 for deplib in $dependency_libs; do
cannam@140 7020 newdependency_libs="$deplib $newdependency_libs"
cannam@140 7021 case $deplib in
cannam@140 7022 -L*) func_stripname '-L' '' "$deplib"
cannam@140 7023 func_resolve_sysroot "$func_stripname_result";;
cannam@140 7024 *) func_resolve_sysroot "$deplib" ;;
cannam@140 7025 esac
cannam@140 7026 if $opt_preserve_dup_deps ; then
cannam@140 7027 case "$tmp_libs " in
cannam@140 7028 *" $func_resolve_sysroot_result "*)
cannam@140 7029 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
cannam@140 7030 esac
cannam@140 7031 fi
cannam@140 7032 func_append tmp_libs " $func_resolve_sysroot_result"
cannam@140 7033 done
cannam@140 7034
cannam@140 7035 if test "$link_all_deplibs" != no; then
cannam@140 7036 # Add the search paths of all dependency libraries
cannam@140 7037 for deplib in $dependency_libs; do
cannam@140 7038 path=
cannam@140 7039 case $deplib in
cannam@140 7040 -L*) path="$deplib" ;;
cannam@140 7041 *.la)
cannam@140 7042 func_resolve_sysroot "$deplib"
cannam@140 7043 deplib=$func_resolve_sysroot_result
cannam@140 7044 func_dirname "$deplib" "" "."
cannam@140 7045 dir=$func_dirname_result
cannam@140 7046 # We need an absolute path.
cannam@140 7047 case $dir in
cannam@140 7048 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
cannam@140 7049 *)
cannam@140 7050 absdir=`cd "$dir" && pwd`
cannam@140 7051 if test -z "$absdir"; then
cannam@140 7052 func_warning "cannot determine absolute directory name of \`$dir'"
cannam@140 7053 absdir="$dir"
cannam@140 7054 fi
cannam@140 7055 ;;
cannam@140 7056 esac
cannam@140 7057 if $GREP "^installed=no" $deplib > /dev/null; then
cannam@140 7058 case $host in
cannam@140 7059 *-*-darwin*)
cannam@140 7060 depdepl=
cannam@140 7061 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
cannam@140 7062 if test -n "$deplibrary_names" ; then
cannam@140 7063 for tmp in $deplibrary_names ; do
cannam@140 7064 depdepl=$tmp
cannam@140 7065 done
cannam@140 7066 if test -f "$absdir/$objdir/$depdepl" ; then
cannam@140 7067 depdepl="$absdir/$objdir/$depdepl"
cannam@140 7068 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
cannam@140 7069 if test -z "$darwin_install_name"; then
cannam@140 7070 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
cannam@140 7071 fi
cannam@140 7072 func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
cannam@140 7073 func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
cannam@140 7074 path=
cannam@140 7075 fi
cannam@140 7076 fi
cannam@140 7077 ;;
cannam@140 7078 *)
cannam@140 7079 path="-L$absdir/$objdir"
cannam@140 7080 ;;
cannam@140 7081 esac
cannam@140 7082 else
cannam@140 7083 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
cannam@140 7084 test -z "$libdir" && \
cannam@140 7085 func_fatal_error "\`$deplib' is not a valid libtool archive"
cannam@140 7086 test "$absdir" != "$libdir" && \
cannam@140 7087 func_warning "\`$deplib' seems to be moved"
cannam@140 7088
cannam@140 7089 path="-L$absdir"
cannam@140 7090 fi
cannam@140 7091 ;;
cannam@140 7092 esac
cannam@140 7093 case " $deplibs " in
cannam@140 7094 *" $path "*) ;;
cannam@140 7095 *) deplibs="$path $deplibs" ;;
cannam@140 7096 esac
cannam@140 7097 done
cannam@140 7098 fi # link_all_deplibs != no
cannam@140 7099 fi # linkmode = lib
cannam@140 7100 done # for deplib in $libs
cannam@140 7101 if test "$pass" = link; then
cannam@140 7102 if test "$linkmode" = "prog"; then
cannam@140 7103 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
cannam@140 7104 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
cannam@140 7105 else
cannam@140 7106 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@140 7107 fi
cannam@140 7108 fi
cannam@140 7109 dependency_libs="$newdependency_libs"
cannam@140 7110 if test "$pass" = dlpreopen; then
cannam@140 7111 # Link the dlpreopened libraries before other libraries
cannam@140 7112 for deplib in $save_deplibs; do
cannam@140 7113 deplibs="$deplib $deplibs"
cannam@140 7114 done
cannam@140 7115 fi
cannam@140 7116 if test "$pass" != dlopen; then
cannam@140 7117 if test "$pass" != conv; then
cannam@140 7118 # Make sure lib_search_path contains only unique directories.
cannam@140 7119 lib_search_path=
cannam@140 7120 for dir in $newlib_search_path; do
cannam@140 7121 case "$lib_search_path " in
cannam@140 7122 *" $dir "*) ;;
cannam@140 7123 *) func_append lib_search_path " $dir" ;;
cannam@140 7124 esac
cannam@140 7125 done
cannam@140 7126 newlib_search_path=
cannam@140 7127 fi
cannam@140 7128
cannam@140 7129 if test "$linkmode,$pass" != "prog,link"; then
cannam@140 7130 vars="deplibs"
cannam@140 7131 else
cannam@140 7132 vars="compile_deplibs finalize_deplibs"
cannam@140 7133 fi
cannam@140 7134 for var in $vars dependency_libs; do
cannam@140 7135 # Add libraries to $var in reverse order
cannam@140 7136 eval tmp_libs=\"\$$var\"
cannam@140 7137 new_libs=
cannam@140 7138 for deplib in $tmp_libs; do
cannam@140 7139 # FIXME: Pedantically, this is the right thing to do, so
cannam@140 7140 # that some nasty dependency loop isn't accidentally
cannam@140 7141 # broken:
cannam@140 7142 #new_libs="$deplib $new_libs"
cannam@140 7143 # Pragmatically, this seems to cause very few problems in
cannam@140 7144 # practice:
cannam@140 7145 case $deplib in
cannam@140 7146 -L*) new_libs="$deplib $new_libs" ;;
cannam@140 7147 -R*) ;;
cannam@140 7148 *)
cannam@140 7149 # And here is the reason: when a library appears more
cannam@140 7150 # than once as an explicit dependence of a library, or
cannam@140 7151 # is implicitly linked in more than once by the
cannam@140 7152 # compiler, it is considered special, and multiple
cannam@140 7153 # occurrences thereof are not removed. Compare this
cannam@140 7154 # with having the same library being listed as a
cannam@140 7155 # dependency of multiple other libraries: in this case,
cannam@140 7156 # we know (pedantically, we assume) the library does not
cannam@140 7157 # need to be listed more than once, so we keep only the
cannam@140 7158 # last copy. This is not always right, but it is rare
cannam@140 7159 # enough that we require users that really mean to play
cannam@140 7160 # such unportable linking tricks to link the library
cannam@140 7161 # using -Wl,-lname, so that libtool does not consider it
cannam@140 7162 # for duplicate removal.
cannam@140 7163 case " $specialdeplibs " in
cannam@140 7164 *" $deplib "*) new_libs="$deplib $new_libs" ;;
cannam@140 7165 *)
cannam@140 7166 case " $new_libs " in
cannam@140 7167 *" $deplib "*) ;;
cannam@140 7168 *) new_libs="$deplib $new_libs" ;;
cannam@140 7169 esac
cannam@140 7170 ;;
cannam@140 7171 esac
cannam@140 7172 ;;
cannam@140 7173 esac
cannam@140 7174 done
cannam@140 7175 tmp_libs=
cannam@140 7176 for deplib in $new_libs; do
cannam@140 7177 case $deplib in
cannam@140 7178 -L*)
cannam@140 7179 case " $tmp_libs " in
cannam@140 7180 *" $deplib "*) ;;
cannam@140 7181 *) func_append tmp_libs " $deplib" ;;
cannam@140 7182 esac
cannam@140 7183 ;;
cannam@140 7184 *) func_append tmp_libs " $deplib" ;;
cannam@140 7185 esac
cannam@140 7186 done
cannam@140 7187 eval $var=\"$tmp_libs\"
cannam@140 7188 done # for var
cannam@140 7189 fi
cannam@140 7190 # Last step: remove runtime libs from dependency_libs
cannam@140 7191 # (they stay in deplibs)
cannam@140 7192 tmp_libs=
cannam@140 7193 for i in $dependency_libs ; do
cannam@140 7194 case " $predeps $postdeps $compiler_lib_search_path " in
cannam@140 7195 *" $i "*)
cannam@140 7196 i=""
cannam@140 7197 ;;
cannam@140 7198 esac
cannam@140 7199 if test -n "$i" ; then
cannam@140 7200 func_append tmp_libs " $i"
cannam@140 7201 fi
cannam@140 7202 done
cannam@140 7203 dependency_libs=$tmp_libs
cannam@140 7204 done # for pass
cannam@140 7205 if test "$linkmode" = prog; then
cannam@140 7206 dlfiles="$newdlfiles"
cannam@140 7207 fi
cannam@140 7208 if test "$linkmode" = prog || test "$linkmode" = lib; then
cannam@140 7209 dlprefiles="$newdlprefiles"
cannam@140 7210 fi
cannam@140 7211
cannam@140 7212 case $linkmode in
cannam@140 7213 oldlib)
cannam@140 7214 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
cannam@140 7215 func_warning "\`-dlopen' is ignored for archives"
cannam@140 7216 fi
cannam@140 7217
cannam@140 7218 case " $deplibs" in
cannam@140 7219 *\ -l* | *\ -L*)
cannam@140 7220 func_warning "\`-l' and \`-L' are ignored for archives" ;;
cannam@140 7221 esac
cannam@140 7222
cannam@140 7223 test -n "$rpath" && \
cannam@140 7224 func_warning "\`-rpath' is ignored for archives"
cannam@140 7225
cannam@140 7226 test -n "$xrpath" && \
cannam@140 7227 func_warning "\`-R' is ignored for archives"
cannam@140 7228
cannam@140 7229 test -n "$vinfo" && \
cannam@140 7230 func_warning "\`-version-info/-version-number' is ignored for archives"
cannam@140 7231
cannam@140 7232 test -n "$release" && \
cannam@140 7233 func_warning "\`-release' is ignored for archives"
cannam@140 7234
cannam@140 7235 test -n "$export_symbols$export_symbols_regex" && \
cannam@140 7236 func_warning "\`-export-symbols' is ignored for archives"
cannam@140 7237
cannam@140 7238 # Now set the variables for building old libraries.
cannam@140 7239 build_libtool_libs=no
cannam@140 7240 oldlibs="$output"
cannam@140 7241 func_append objs "$old_deplibs"
cannam@140 7242 ;;
cannam@140 7243
cannam@140 7244 lib)
cannam@140 7245 # Make sure we only generate libraries of the form `libNAME.la'.
cannam@140 7246 case $outputname in
cannam@140 7247 lib*)
cannam@140 7248 func_stripname 'lib' '.la' "$outputname"
cannam@140 7249 name=$func_stripname_result
cannam@140 7250 eval shared_ext=\"$shrext_cmds\"
cannam@140 7251 eval libname=\"$libname_spec\"
cannam@140 7252 ;;
cannam@140 7253 *)
cannam@140 7254 test "$module" = no && \
cannam@140 7255 func_fatal_help "libtool library \`$output' must begin with \`lib'"
cannam@140 7256
cannam@140 7257 if test "$need_lib_prefix" != no; then
cannam@140 7258 # Add the "lib" prefix for modules if required
cannam@140 7259 func_stripname '' '.la' "$outputname"
cannam@140 7260 name=$func_stripname_result
cannam@140 7261 eval shared_ext=\"$shrext_cmds\"
cannam@140 7262 eval libname=\"$libname_spec\"
cannam@140 7263 else
cannam@140 7264 func_stripname '' '.la' "$outputname"
cannam@140 7265 libname=$func_stripname_result
cannam@140 7266 fi
cannam@140 7267 ;;
cannam@140 7268 esac
cannam@140 7269
cannam@140 7270 if test -n "$objs"; then
cannam@140 7271 if test "$deplibs_check_method" != pass_all; then
cannam@140 7272 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
cannam@140 7273 else
cannam@140 7274 echo
cannam@140 7275 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
cannam@140 7276 $ECHO "*** objects $objs is not portable!"
cannam@140 7277 func_append libobjs " $objs"
cannam@140 7278 fi
cannam@140 7279 fi
cannam@140 7280
cannam@140 7281 test "$dlself" != no && \
cannam@140 7282 func_warning "\`-dlopen self' is ignored for libtool libraries"
cannam@140 7283
cannam@140 7284 set dummy $rpath
cannam@140 7285 shift
cannam@140 7286 test "$#" -gt 1 && \
cannam@140 7287 func_warning "ignoring multiple \`-rpath's for a libtool library"
cannam@140 7288
cannam@140 7289 install_libdir="$1"
cannam@140 7290
cannam@140 7291 oldlibs=
cannam@140 7292 if test -z "$rpath"; then
cannam@140 7293 if test "$build_libtool_libs" = yes; then
cannam@140 7294 # Building a libtool convenience library.
cannam@140 7295 # Some compilers have problems with a `.al' extension so
cannam@140 7296 # convenience libraries should have the same extension an
cannam@140 7297 # archive normally would.
cannam@140 7298 oldlibs="$output_objdir/$libname.$libext $oldlibs"
cannam@140 7299 build_libtool_libs=convenience
cannam@140 7300 build_old_libs=yes
cannam@140 7301 fi
cannam@140 7302
cannam@140 7303 test -n "$vinfo" && \
cannam@140 7304 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
cannam@140 7305
cannam@140 7306 test -n "$release" && \
cannam@140 7307 func_warning "\`-release' is ignored for convenience libraries"
cannam@140 7308 else
cannam@140 7309
cannam@140 7310 # Parse the version information argument.
cannam@140 7311 save_ifs="$IFS"; IFS=':'
cannam@140 7312 set dummy $vinfo 0 0 0
cannam@140 7313 shift
cannam@140 7314 IFS="$save_ifs"
cannam@140 7315
cannam@140 7316 test -n "$7" && \
cannam@140 7317 func_fatal_help "too many parameters to \`-version-info'"
cannam@140 7318
cannam@140 7319 # convert absolute version numbers to libtool ages
cannam@140 7320 # this retains compatibility with .la files and attempts
cannam@140 7321 # to make the code below a bit more comprehensible
cannam@140 7322
cannam@140 7323 case $vinfo_number in
cannam@140 7324 yes)
cannam@140 7325 number_major="$1"
cannam@140 7326 number_minor="$2"
cannam@140 7327 number_revision="$3"
cannam@140 7328 #
cannam@140 7329 # There are really only two kinds -- those that
cannam@140 7330 # use the current revision as the major version
cannam@140 7331 # and those that subtract age and use age as
cannam@140 7332 # a minor version. But, then there is irix
cannam@140 7333 # which has an extra 1 added just for fun
cannam@140 7334 #
cannam@140 7335 case $version_type in
cannam@140 7336 # correct linux to gnu/linux during the next big refactor
cannam@140 7337 darwin|linux|osf|windows|none)
cannam@140 7338 func_arith $number_major + $number_minor
cannam@140 7339 current=$func_arith_result
cannam@140 7340 age="$number_minor"
cannam@140 7341 revision="$number_revision"
cannam@140 7342 ;;
cannam@140 7343 freebsd-aout|freebsd-elf|qnx|sunos)
cannam@140 7344 current="$number_major"
cannam@140 7345 revision="$number_minor"
cannam@140 7346 age="0"
cannam@140 7347 ;;
cannam@140 7348 irix|nonstopux)
cannam@140 7349 func_arith $number_major + $number_minor
cannam@140 7350 current=$func_arith_result
cannam@140 7351 age="$number_minor"
cannam@140 7352 revision="$number_minor"
cannam@140 7353 lt_irix_increment=no
cannam@140 7354 ;;
cannam@140 7355 *)
cannam@140 7356 func_fatal_configuration "$modename: unknown library version type \`$version_type'"
cannam@140 7357 ;;
cannam@140 7358 esac
cannam@140 7359 ;;
cannam@140 7360 no)
cannam@140 7361 current="$1"
cannam@140 7362 revision="$2"
cannam@140 7363 age="$3"
cannam@140 7364 ;;
cannam@140 7365 esac
cannam@140 7366
cannam@140 7367 # Check that each of the things are valid numbers.
cannam@140 7368 case $current in
cannam@140 7369 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]) ;;
cannam@140 7370 *)
cannam@140 7371 func_error "CURRENT \`$current' must be a nonnegative integer"
cannam@140 7372 func_fatal_error "\`$vinfo' is not valid version information"
cannam@140 7373 ;;
cannam@140 7374 esac
cannam@140 7375
cannam@140 7376 case $revision in
cannam@140 7377 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]) ;;
cannam@140 7378 *)
cannam@140 7379 func_error "REVISION \`$revision' must be a nonnegative integer"
cannam@140 7380 func_fatal_error "\`$vinfo' is not valid version information"
cannam@140 7381 ;;
cannam@140 7382 esac
cannam@140 7383
cannam@140 7384 case $age in
cannam@140 7385 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]) ;;
cannam@140 7386 *)
cannam@140 7387 func_error "AGE \`$age' must be a nonnegative integer"
cannam@140 7388 func_fatal_error "\`$vinfo' is not valid version information"
cannam@140 7389 ;;
cannam@140 7390 esac
cannam@140 7391
cannam@140 7392 if test "$age" -gt "$current"; then
cannam@140 7393 func_error "AGE \`$age' is greater than the current interface number \`$current'"
cannam@140 7394 func_fatal_error "\`$vinfo' is not valid version information"
cannam@140 7395 fi
cannam@140 7396
cannam@140 7397 # Calculate the version variables.
cannam@140 7398 major=
cannam@140 7399 versuffix=
cannam@140 7400 verstring=
cannam@140 7401 case $version_type in
cannam@140 7402 none) ;;
cannam@140 7403
cannam@140 7404 darwin)
cannam@140 7405 # Like Linux, but with the current version available in
cannam@140 7406 # verstring for coding it into the library header
cannam@140 7407 func_arith $current - $age
cannam@140 7408 major=.$func_arith_result
cannam@140 7409 versuffix="$major.$age.$revision"
cannam@140 7410 # Darwin ld doesn't like 0 for these options...
cannam@140 7411 func_arith $current + 1
cannam@140 7412 minor_current=$func_arith_result
cannam@140 7413 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
cannam@140 7414 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
cannam@140 7415 ;;
cannam@140 7416
cannam@140 7417 freebsd-aout)
cannam@140 7418 major=".$current"
cannam@140 7419 versuffix=".$current.$revision";
cannam@140 7420 ;;
cannam@140 7421
cannam@140 7422 freebsd-elf)
cannam@140 7423 major=".$current"
cannam@140 7424 versuffix=".$current"
cannam@140 7425 ;;
cannam@140 7426
cannam@140 7427 irix | nonstopux)
cannam@140 7428 if test "X$lt_irix_increment" = "Xno"; then
cannam@140 7429 func_arith $current - $age
cannam@140 7430 else
cannam@140 7431 func_arith $current - $age + 1
cannam@140 7432 fi
cannam@140 7433 major=$func_arith_result
cannam@140 7434
cannam@140 7435 case $version_type in
cannam@140 7436 nonstopux) verstring_prefix=nonstopux ;;
cannam@140 7437 *) verstring_prefix=sgi ;;
cannam@140 7438 esac
cannam@140 7439 verstring="$verstring_prefix$major.$revision"
cannam@140 7440
cannam@140 7441 # Add in all the interfaces that we are compatible with.
cannam@140 7442 loop=$revision
cannam@140 7443 while test "$loop" -ne 0; do
cannam@140 7444 func_arith $revision - $loop
cannam@140 7445 iface=$func_arith_result
cannam@140 7446 func_arith $loop - 1
cannam@140 7447 loop=$func_arith_result
cannam@140 7448 verstring="$verstring_prefix$major.$iface:$verstring"
cannam@140 7449 done
cannam@140 7450
cannam@140 7451 # Before this point, $major must not contain `.'.
cannam@140 7452 major=.$major
cannam@140 7453 versuffix="$major.$revision"
cannam@140 7454 ;;
cannam@140 7455
cannam@140 7456 linux) # correct to gnu/linux during the next big refactor
cannam@140 7457 func_arith $current - $age
cannam@140 7458 major=.$func_arith_result
cannam@140 7459 versuffix="$major.$age.$revision"
cannam@140 7460 ;;
cannam@140 7461
cannam@140 7462 osf)
cannam@140 7463 func_arith $current - $age
cannam@140 7464 major=.$func_arith_result
cannam@140 7465 versuffix=".$current.$age.$revision"
cannam@140 7466 verstring="$current.$age.$revision"
cannam@140 7467
cannam@140 7468 # Add in all the interfaces that we are compatible with.
cannam@140 7469 loop=$age
cannam@140 7470 while test "$loop" -ne 0; do
cannam@140 7471 func_arith $current - $loop
cannam@140 7472 iface=$func_arith_result
cannam@140 7473 func_arith $loop - 1
cannam@140 7474 loop=$func_arith_result
cannam@140 7475 verstring="$verstring:${iface}.0"
cannam@140 7476 done
cannam@140 7477
cannam@140 7478 # Make executables depend on our current version.
cannam@140 7479 func_append verstring ":${current}.0"
cannam@140 7480 ;;
cannam@140 7481
cannam@140 7482 qnx)
cannam@140 7483 major=".$current"
cannam@140 7484 versuffix=".$current"
cannam@140 7485 ;;
cannam@140 7486
cannam@140 7487 sunos)
cannam@140 7488 major=".$current"
cannam@140 7489 versuffix=".$current.$revision"
cannam@140 7490 ;;
cannam@140 7491
cannam@140 7492 windows)
cannam@140 7493 # Use '-' rather than '.', since we only want one
cannam@140 7494 # extension on DOS 8.3 filesystems.
cannam@140 7495 func_arith $current - $age
cannam@140 7496 major=$func_arith_result
cannam@140 7497 versuffix="-$major"
cannam@140 7498 ;;
cannam@140 7499
cannam@140 7500 *)
cannam@140 7501 func_fatal_configuration "unknown library version type \`$version_type'"
cannam@140 7502 ;;
cannam@140 7503 esac
cannam@140 7504
cannam@140 7505 # Clear the version info if we defaulted, and they specified a release.
cannam@140 7506 if test -z "$vinfo" && test -n "$release"; then
cannam@140 7507 major=
cannam@140 7508 case $version_type in
cannam@140 7509 darwin)
cannam@140 7510 # we can't check for "0.0" in archive_cmds due to quoting
cannam@140 7511 # problems, so we reset it completely
cannam@140 7512 verstring=
cannam@140 7513 ;;
cannam@140 7514 *)
cannam@140 7515 verstring="0.0"
cannam@140 7516 ;;
cannam@140 7517 esac
cannam@140 7518 if test "$need_version" = no; then
cannam@140 7519 versuffix=
cannam@140 7520 else
cannam@140 7521 versuffix=".0.0"
cannam@140 7522 fi
cannam@140 7523 fi
cannam@140 7524
cannam@140 7525 # Remove version info from name if versioning should be avoided
cannam@140 7526 if test "$avoid_version" = yes && test "$need_version" = no; then
cannam@140 7527 major=
cannam@140 7528 versuffix=
cannam@140 7529 verstring=""
cannam@140 7530 fi
cannam@140 7531
cannam@140 7532 # Check to see if the archive will have undefined symbols.
cannam@140 7533 if test "$allow_undefined" = yes; then
cannam@140 7534 if test "$allow_undefined_flag" = unsupported; then
cannam@140 7535 func_warning "undefined symbols not allowed in $host shared libraries"
cannam@140 7536 build_libtool_libs=no
cannam@140 7537 build_old_libs=yes
cannam@140 7538 fi
cannam@140 7539 else
cannam@140 7540 # Don't allow undefined symbols.
cannam@140 7541 allow_undefined_flag="$no_undefined_flag"
cannam@140 7542 fi
cannam@140 7543
cannam@140 7544 fi
cannam@140 7545
cannam@140 7546 func_generate_dlsyms "$libname" "$libname" "yes"
cannam@140 7547 func_append libobjs " $symfileobj"
cannam@140 7548 test "X$libobjs" = "X " && libobjs=
cannam@140 7549
cannam@140 7550 if test "$opt_mode" != relink; then
cannam@140 7551 # Remove our outputs, but don't remove object files since they
cannam@140 7552 # may have been created when compiling PIC objects.
cannam@140 7553 removelist=
cannam@140 7554 tempremovelist=`$ECHO "$output_objdir/*"`
cannam@140 7555 for p in $tempremovelist; do
cannam@140 7556 case $p in
cannam@140 7557 *.$objext | *.gcno)
cannam@140 7558 ;;
cannam@140 7559 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
cannam@140 7560 if test "X$precious_files_regex" != "X"; then
cannam@140 7561 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
cannam@140 7562 then
cannam@140 7563 continue
cannam@140 7564 fi
cannam@140 7565 fi
cannam@140 7566 func_append removelist " $p"
cannam@140 7567 ;;
cannam@140 7568 *) ;;
cannam@140 7569 esac
cannam@140 7570 done
cannam@140 7571 test -n "$removelist" && \
cannam@140 7572 func_show_eval "${RM}r \$removelist"
cannam@140 7573 fi
cannam@140 7574
cannam@140 7575 # Now set the variables for building old libraries.
cannam@140 7576 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
cannam@140 7577 func_append oldlibs " $output_objdir/$libname.$libext"
cannam@140 7578
cannam@140 7579 # Transform .lo files to .o files.
cannam@140 7580 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
cannam@140 7581 fi
cannam@140 7582
cannam@140 7583 # Eliminate all temporary directories.
cannam@140 7584 #for path in $notinst_path; do
cannam@140 7585 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
cannam@140 7586 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
cannam@140 7587 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
cannam@140 7588 #done
cannam@140 7589
cannam@140 7590 if test -n "$xrpath"; then
cannam@140 7591 # If the user specified any rpath flags, then add them.
cannam@140 7592 temp_xrpath=
cannam@140 7593 for libdir in $xrpath; do
cannam@140 7594 func_replace_sysroot "$libdir"
cannam@140 7595 func_append temp_xrpath " -R$func_replace_sysroot_result"
cannam@140 7596 case "$finalize_rpath " in
cannam@140 7597 *" $libdir "*) ;;
cannam@140 7598 *) func_append finalize_rpath " $libdir" ;;
cannam@140 7599 esac
cannam@140 7600 done
cannam@140 7601 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
cannam@140 7602 dependency_libs="$temp_xrpath $dependency_libs"
cannam@140 7603 fi
cannam@140 7604 fi
cannam@140 7605
cannam@140 7606 # Make sure dlfiles contains only unique files that won't be dlpreopened
cannam@140 7607 old_dlfiles="$dlfiles"
cannam@140 7608 dlfiles=
cannam@140 7609 for lib in $old_dlfiles; do
cannam@140 7610 case " $dlprefiles $dlfiles " in
cannam@140 7611 *" $lib "*) ;;
cannam@140 7612 *) func_append dlfiles " $lib" ;;
cannam@140 7613 esac
cannam@140 7614 done
cannam@140 7615
cannam@140 7616 # Make sure dlprefiles contains only unique files
cannam@140 7617 old_dlprefiles="$dlprefiles"
cannam@140 7618 dlprefiles=
cannam@140 7619 for lib in $old_dlprefiles; do
cannam@140 7620 case "$dlprefiles " in
cannam@140 7621 *" $lib "*) ;;
cannam@140 7622 *) func_append dlprefiles " $lib" ;;
cannam@140 7623 esac
cannam@140 7624 done
cannam@140 7625
cannam@140 7626 if test "$build_libtool_libs" = yes; then
cannam@140 7627 if test -n "$rpath"; then
cannam@140 7628 case $host in
cannam@140 7629 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
cannam@140 7630 # these systems don't actually have a c library (as such)!
cannam@140 7631 ;;
cannam@140 7632 *-*-rhapsody* | *-*-darwin1.[012])
cannam@140 7633 # Rhapsody C library is in the System framework
cannam@140 7634 func_append deplibs " System.ltframework"
cannam@140 7635 ;;
cannam@140 7636 *-*-netbsd*)
cannam@140 7637 # Don't link with libc until the a.out ld.so is fixed.
cannam@140 7638 ;;
cannam@140 7639 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
cannam@140 7640 # Do not include libc due to us having libc/libc_r.
cannam@140 7641 ;;
cannam@140 7642 *-*-sco3.2v5* | *-*-sco5v6*)
cannam@140 7643 # Causes problems with __ctype
cannam@140 7644 ;;
cannam@140 7645 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
cannam@140 7646 # Compiler inserts libc in the correct place for threads to work
cannam@140 7647 ;;
cannam@140 7648 *)
cannam@140 7649 # Add libc to deplibs on all other systems if necessary.
cannam@140 7650 if test "$build_libtool_need_lc" = "yes"; then
cannam@140 7651 func_append deplibs " -lc"
cannam@140 7652 fi
cannam@140 7653 ;;
cannam@140 7654 esac
cannam@140 7655 fi
cannam@140 7656
cannam@140 7657 # Transform deplibs into only deplibs that can be linked in shared.
cannam@140 7658 name_save=$name
cannam@140 7659 libname_save=$libname
cannam@140 7660 release_save=$release
cannam@140 7661 versuffix_save=$versuffix
cannam@140 7662 major_save=$major
cannam@140 7663 # I'm not sure if I'm treating the release correctly. I think
cannam@140 7664 # release should show up in the -l (ie -lgmp5) so we don't want to
cannam@140 7665 # add it in twice. Is that correct?
cannam@140 7666 release=""
cannam@140 7667 versuffix=""
cannam@140 7668 major=""
cannam@140 7669 newdeplibs=
cannam@140 7670 droppeddeps=no
cannam@140 7671 case $deplibs_check_method in
cannam@140 7672 pass_all)
cannam@140 7673 # Don't check for shared/static. Everything works.
cannam@140 7674 # This might be a little naive. We might want to check
cannam@140 7675 # whether the library exists or not. But this is on
cannam@140 7676 # osf3 & osf4 and I'm not really sure... Just
cannam@140 7677 # implementing what was already the behavior.
cannam@140 7678 newdeplibs=$deplibs
cannam@140 7679 ;;
cannam@140 7680 test_compile)
cannam@140 7681 # This code stresses the "libraries are programs" paradigm to its
cannam@140 7682 # limits. Maybe even breaks it. We compile a program, linking it
cannam@140 7683 # against the deplibs as a proxy for the library. Then we can check
cannam@140 7684 # whether they linked in statically or dynamically with ldd.
cannam@140 7685 $opt_dry_run || $RM conftest.c
cannam@140 7686 cat > conftest.c <<EOF
cannam@140 7687 int main() { return 0; }
cannam@140 7688 EOF
cannam@140 7689 $opt_dry_run || $RM conftest
cannam@140 7690 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
cannam@140 7691 ldd_output=`ldd conftest`
cannam@140 7692 for i in $deplibs; do
cannam@140 7693 case $i in
cannam@140 7694 -l*)
cannam@140 7695 func_stripname -l '' "$i"
cannam@140 7696 name=$func_stripname_result
cannam@140 7697 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
cannam@140 7698 case " $predeps $postdeps " in
cannam@140 7699 *" $i "*)
cannam@140 7700 func_append newdeplibs " $i"
cannam@140 7701 i=""
cannam@140 7702 ;;
cannam@140 7703 esac
cannam@140 7704 fi
cannam@140 7705 if test -n "$i" ; then
cannam@140 7706 libname=`eval "\\$ECHO \"$libname_spec\""`
cannam@140 7707 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
cannam@140 7708 set dummy $deplib_matches; shift
cannam@140 7709 deplib_match=$1
cannam@140 7710 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
cannam@140 7711 func_append newdeplibs " $i"
cannam@140 7712 else
cannam@140 7713 droppeddeps=yes
cannam@140 7714 echo
cannam@140 7715 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
cannam@140 7716 echo "*** I have the capability to make that library automatically link in when"
cannam@140 7717 echo "*** you link to this library. But I can only do this if you have a"
cannam@140 7718 echo "*** shared version of the library, which I believe you do not have"
cannam@140 7719 echo "*** because a test_compile did reveal that the linker did not use it for"
cannam@140 7720 echo "*** its dynamic dependency list that programs get resolved with at runtime."
cannam@140 7721 fi
cannam@140 7722 fi
cannam@140 7723 ;;
cannam@140 7724 *)
cannam@140 7725 func_append newdeplibs " $i"
cannam@140 7726 ;;
cannam@140 7727 esac
cannam@140 7728 done
cannam@140 7729 else
cannam@140 7730 # Error occurred in the first compile. Let's try to salvage
cannam@140 7731 # the situation: Compile a separate program for each library.
cannam@140 7732 for i in $deplibs; do
cannam@140 7733 case $i in
cannam@140 7734 -l*)
cannam@140 7735 func_stripname -l '' "$i"
cannam@140 7736 name=$func_stripname_result
cannam@140 7737 $opt_dry_run || $RM conftest
cannam@140 7738 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
cannam@140 7739 ldd_output=`ldd conftest`
cannam@140 7740 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
cannam@140 7741 case " $predeps $postdeps " in
cannam@140 7742 *" $i "*)
cannam@140 7743 func_append newdeplibs " $i"
cannam@140 7744 i=""
cannam@140 7745 ;;
cannam@140 7746 esac
cannam@140 7747 fi
cannam@140 7748 if test -n "$i" ; then
cannam@140 7749 libname=`eval "\\$ECHO \"$libname_spec\""`
cannam@140 7750 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
cannam@140 7751 set dummy $deplib_matches; shift
cannam@140 7752 deplib_match=$1
cannam@140 7753 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
cannam@140 7754 func_append newdeplibs " $i"
cannam@140 7755 else
cannam@140 7756 droppeddeps=yes
cannam@140 7757 echo
cannam@140 7758 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
cannam@140 7759 echo "*** I have the capability to make that library automatically link in when"
cannam@140 7760 echo "*** you link to this library. But I can only do this if you have a"
cannam@140 7761 echo "*** shared version of the library, which you do not appear to have"
cannam@140 7762 echo "*** because a test_compile did reveal that the linker did not use this one"
cannam@140 7763 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
cannam@140 7764 fi
cannam@140 7765 fi
cannam@140 7766 else
cannam@140 7767 droppeddeps=yes
cannam@140 7768 echo
cannam@140 7769 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
cannam@140 7770 echo "*** make it link in! You will probably need to install it or some"
cannam@140 7771 echo "*** library that it depends on before this library will be fully"
cannam@140 7772 echo "*** functional. Installing it before continuing would be even better."
cannam@140 7773 fi
cannam@140 7774 ;;
cannam@140 7775 *)
cannam@140 7776 func_append newdeplibs " $i"
cannam@140 7777 ;;
cannam@140 7778 esac
cannam@140 7779 done
cannam@140 7780 fi
cannam@140 7781 ;;
cannam@140 7782 file_magic*)
cannam@140 7783 set dummy $deplibs_check_method; shift
cannam@140 7784 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
cannam@140 7785 for a_deplib in $deplibs; do
cannam@140 7786 case $a_deplib in
cannam@140 7787 -l*)
cannam@140 7788 func_stripname -l '' "$a_deplib"
cannam@140 7789 name=$func_stripname_result
cannam@140 7790 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
cannam@140 7791 case " $predeps $postdeps " in
cannam@140 7792 *" $a_deplib "*)
cannam@140 7793 func_append newdeplibs " $a_deplib"
cannam@140 7794 a_deplib=""
cannam@140 7795 ;;
cannam@140 7796 esac
cannam@140 7797 fi
cannam@140 7798 if test -n "$a_deplib" ; then
cannam@140 7799 libname=`eval "\\$ECHO \"$libname_spec\""`
cannam@140 7800 if test -n "$file_magic_glob"; then
cannam@140 7801 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
cannam@140 7802 else
cannam@140 7803 libnameglob=$libname
cannam@140 7804 fi
cannam@140 7805 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
cannam@140 7806 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
cannam@140 7807 if test "$want_nocaseglob" = yes; then
cannam@140 7808 shopt -s nocaseglob
cannam@140 7809 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
cannam@140 7810 $nocaseglob
cannam@140 7811 else
cannam@140 7812 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
cannam@140 7813 fi
cannam@140 7814 for potent_lib in $potential_libs; do
cannam@140 7815 # Follow soft links.
cannam@140 7816 if ls -lLd "$potent_lib" 2>/dev/null |
cannam@140 7817 $GREP " -> " >/dev/null; then
cannam@140 7818 continue
cannam@140 7819 fi
cannam@140 7820 # The statement above tries to avoid entering an
cannam@140 7821 # endless loop below, in case of cyclic links.
cannam@140 7822 # We might still enter an endless loop, since a link
cannam@140 7823 # loop can be closed while we follow links,
cannam@140 7824 # but so what?
cannam@140 7825 potlib="$potent_lib"
cannam@140 7826 while test -h "$potlib" 2>/dev/null; do
cannam@140 7827 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
cannam@140 7828 case $potliblink in
cannam@140 7829 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
cannam@140 7830 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
cannam@140 7831 esac
cannam@140 7832 done
cannam@140 7833 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
cannam@140 7834 $SED -e 10q |
cannam@140 7835 $EGREP "$file_magic_regex" > /dev/null; then
cannam@140 7836 func_append newdeplibs " $a_deplib"
cannam@140 7837 a_deplib=""
cannam@140 7838 break 2
cannam@140 7839 fi
cannam@140 7840 done
cannam@140 7841 done
cannam@140 7842 fi
cannam@140 7843 if test -n "$a_deplib" ; then
cannam@140 7844 droppeddeps=yes
cannam@140 7845 echo
cannam@140 7846 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
cannam@140 7847 echo "*** I have the capability to make that library automatically link in when"
cannam@140 7848 echo "*** you link to this library. But I can only do this if you have a"
cannam@140 7849 echo "*** shared version of the library, which you do not appear to have"
cannam@140 7850 echo "*** because I did check the linker path looking for a file starting"
cannam@140 7851 if test -z "$potlib" ; then
cannam@140 7852 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
cannam@140 7853 else
cannam@140 7854 $ECHO "*** with $libname and none of the candidates passed a file format test"
cannam@140 7855 $ECHO "*** using a file magic. Last file checked: $potlib"
cannam@140 7856 fi
cannam@140 7857 fi
cannam@140 7858 ;;
cannam@140 7859 *)
cannam@140 7860 # Add a -L argument.
cannam@140 7861 func_append newdeplibs " $a_deplib"
cannam@140 7862 ;;
cannam@140 7863 esac
cannam@140 7864 done # Gone through all deplibs.
cannam@140 7865 ;;
cannam@140 7866 match_pattern*)
cannam@140 7867 set dummy $deplibs_check_method; shift
cannam@140 7868 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
cannam@140 7869 for a_deplib in $deplibs; do
cannam@140 7870 case $a_deplib in
cannam@140 7871 -l*)
cannam@140 7872 func_stripname -l '' "$a_deplib"
cannam@140 7873 name=$func_stripname_result
cannam@140 7874 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
cannam@140 7875 case " $predeps $postdeps " in
cannam@140 7876 *" $a_deplib "*)
cannam@140 7877 func_append newdeplibs " $a_deplib"
cannam@140 7878 a_deplib=""
cannam@140 7879 ;;
cannam@140 7880 esac
cannam@140 7881 fi
cannam@140 7882 if test -n "$a_deplib" ; then
cannam@140 7883 libname=`eval "\\$ECHO \"$libname_spec\""`
cannam@140 7884 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
cannam@140 7885 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
cannam@140 7886 for potent_lib in $potential_libs; do
cannam@140 7887 potlib="$potent_lib" # see symlink-check above in file_magic test
cannam@140 7888 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
cannam@140 7889 $EGREP "$match_pattern_regex" > /dev/null; then
cannam@140 7890 func_append newdeplibs " $a_deplib"
cannam@140 7891 a_deplib=""
cannam@140 7892 break 2
cannam@140 7893 fi
cannam@140 7894 done
cannam@140 7895 done
cannam@140 7896 fi
cannam@140 7897 if test -n "$a_deplib" ; then
cannam@140 7898 droppeddeps=yes
cannam@140 7899 echo
cannam@140 7900 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
cannam@140 7901 echo "*** I have the capability to make that library automatically link in when"
cannam@140 7902 echo "*** you link to this library. But I can only do this if you have a"
cannam@140 7903 echo "*** shared version of the library, which you do not appear to have"
cannam@140 7904 echo "*** because I did check the linker path looking for a file starting"
cannam@140 7905 if test -z "$potlib" ; then
cannam@140 7906 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
cannam@140 7907 else
cannam@140 7908 $ECHO "*** with $libname and none of the candidates passed a file format test"
cannam@140 7909 $ECHO "*** using a regex pattern. Last file checked: $potlib"
cannam@140 7910 fi
cannam@140 7911 fi
cannam@140 7912 ;;
cannam@140 7913 *)
cannam@140 7914 # Add a -L argument.
cannam@140 7915 func_append newdeplibs " $a_deplib"
cannam@140 7916 ;;
cannam@140 7917 esac
cannam@140 7918 done # Gone through all deplibs.
cannam@140 7919 ;;
cannam@140 7920 none | unknown | *)
cannam@140 7921 newdeplibs=""
cannam@140 7922 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
cannam@140 7923 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
cannam@140 7924 for i in $predeps $postdeps ; do
cannam@140 7925 # can't use Xsed below, because $i might contain '/'
cannam@140 7926 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
cannam@140 7927 done
cannam@140 7928 fi
cannam@140 7929 case $tmp_deplibs in
cannam@140 7930 *[!\ \ ]*)
cannam@140 7931 echo
cannam@140 7932 if test "X$deplibs_check_method" = "Xnone"; then
cannam@140 7933 echo "*** Warning: inter-library dependencies are not supported in this platform."
cannam@140 7934 else
cannam@140 7935 echo "*** Warning: inter-library dependencies are not known to be supported."
cannam@140 7936 fi
cannam@140 7937 echo "*** All declared inter-library dependencies are being dropped."
cannam@140 7938 droppeddeps=yes
cannam@140 7939 ;;
cannam@140 7940 esac
cannam@140 7941 ;;
cannam@140 7942 esac
cannam@140 7943 versuffix=$versuffix_save
cannam@140 7944 major=$major_save
cannam@140 7945 release=$release_save
cannam@140 7946 libname=$libname_save
cannam@140 7947 name=$name_save
cannam@140 7948
cannam@140 7949 case $host in
cannam@140 7950 *-*-rhapsody* | *-*-darwin1.[012])
cannam@140 7951 # On Rhapsody replace the C library with the System framework
cannam@140 7952 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
cannam@140 7953 ;;
cannam@140 7954 esac
cannam@140 7955
cannam@140 7956 if test "$droppeddeps" = yes; then
cannam@140 7957 if test "$module" = yes; then
cannam@140 7958 echo
cannam@140 7959 echo "*** Warning: libtool could not satisfy all declared inter-library"
cannam@140 7960 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
cannam@140 7961 echo "*** a static module, that should work as long as the dlopening"
cannam@140 7962 echo "*** application is linked with the -dlopen flag."
cannam@140 7963 if test -z "$global_symbol_pipe"; then
cannam@140 7964 echo
cannam@140 7965 echo "*** However, this would only work if libtool was able to extract symbol"
cannam@140 7966 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
cannam@140 7967 echo "*** not find such a program. So, this module is probably useless."
cannam@140 7968 echo "*** \`nm' from GNU binutils and a full rebuild may help."
cannam@140 7969 fi
cannam@140 7970 if test "$build_old_libs" = no; then
cannam@140 7971 oldlibs="$output_objdir/$libname.$libext"
cannam@140 7972 build_libtool_libs=module
cannam@140 7973 build_old_libs=yes
cannam@140 7974 else
cannam@140 7975 build_libtool_libs=no
cannam@140 7976 fi
cannam@140 7977 else
cannam@140 7978 echo "*** The inter-library dependencies that have been dropped here will be"
cannam@140 7979 echo "*** automatically added whenever a program is linked with this library"
cannam@140 7980 echo "*** or is declared to -dlopen it."
cannam@140 7981
cannam@140 7982 if test "$allow_undefined" = no; then
cannam@140 7983 echo
cannam@140 7984 echo "*** Since this library must not contain undefined symbols,"
cannam@140 7985 echo "*** because either the platform does not support them or"
cannam@140 7986 echo "*** it was explicitly requested with -no-undefined,"
cannam@140 7987 echo "*** libtool will only create a static version of it."
cannam@140 7988 if test "$build_old_libs" = no; then
cannam@140 7989 oldlibs="$output_objdir/$libname.$libext"
cannam@140 7990 build_libtool_libs=module
cannam@140 7991 build_old_libs=yes
cannam@140 7992 else
cannam@140 7993 build_libtool_libs=no
cannam@140 7994 fi
cannam@140 7995 fi
cannam@140 7996 fi
cannam@140 7997 fi
cannam@140 7998 # Done checking deplibs!
cannam@140 7999 deplibs=$newdeplibs
cannam@140 8000 fi
cannam@140 8001 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
cannam@140 8002 case $host in
cannam@140 8003 *-*-darwin*)
cannam@140 8004 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@140 8005 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@140 8006 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@140 8007 ;;
cannam@140 8008 esac
cannam@140 8009
cannam@140 8010 # move library search paths that coincide with paths to not yet
cannam@140 8011 # installed libraries to the beginning of the library search list
cannam@140 8012 new_libs=
cannam@140 8013 for path in $notinst_path; do
cannam@140 8014 case " $new_libs " in
cannam@140 8015 *" -L$path/$objdir "*) ;;
cannam@140 8016 *)
cannam@140 8017 case " $deplibs " in
cannam@140 8018 *" -L$path/$objdir "*)
cannam@140 8019 func_append new_libs " -L$path/$objdir" ;;
cannam@140 8020 esac
cannam@140 8021 ;;
cannam@140 8022 esac
cannam@140 8023 done
cannam@140 8024 for deplib in $deplibs; do
cannam@140 8025 case $deplib in
cannam@140 8026 -L*)
cannam@140 8027 case " $new_libs " in
cannam@140 8028 *" $deplib "*) ;;
cannam@140 8029 *) func_append new_libs " $deplib" ;;
cannam@140 8030 esac
cannam@140 8031 ;;
cannam@140 8032 *) func_append new_libs " $deplib" ;;
cannam@140 8033 esac
cannam@140 8034 done
cannam@140 8035 deplibs="$new_libs"
cannam@140 8036
cannam@140 8037 # All the library-specific variables (install_libdir is set above).
cannam@140 8038 library_names=
cannam@140 8039 old_library=
cannam@140 8040 dlname=
cannam@140 8041
cannam@140 8042 # Test again, we may have decided not to build it any more
cannam@140 8043 if test "$build_libtool_libs" = yes; then
cannam@140 8044 # Remove ${wl} instances when linking with ld.
cannam@140 8045 # FIXME: should test the right _cmds variable.
cannam@140 8046 case $archive_cmds in
cannam@140 8047 *\$LD\ *) wl= ;;
cannam@140 8048 esac
cannam@140 8049 if test "$hardcode_into_libs" = yes; then
cannam@140 8050 # Hardcode the library paths
cannam@140 8051 hardcode_libdirs=
cannam@140 8052 dep_rpath=
cannam@140 8053 rpath="$finalize_rpath"
cannam@140 8054 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
cannam@140 8055 for libdir in $rpath; do
cannam@140 8056 if test -n "$hardcode_libdir_flag_spec"; then
cannam@140 8057 if test -n "$hardcode_libdir_separator"; then
cannam@140 8058 func_replace_sysroot "$libdir"
cannam@140 8059 libdir=$func_replace_sysroot_result
cannam@140 8060 if test -z "$hardcode_libdirs"; then
cannam@140 8061 hardcode_libdirs="$libdir"
cannam@140 8062 else
cannam@140 8063 # Just accumulate the unique libdirs.
cannam@140 8064 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
cannam@140 8065 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
cannam@140 8066 ;;
cannam@140 8067 *)
cannam@140 8068 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
cannam@140 8069 ;;
cannam@140 8070 esac
cannam@140 8071 fi
cannam@140 8072 else
cannam@140 8073 eval flag=\"$hardcode_libdir_flag_spec\"
cannam@140 8074 func_append dep_rpath " $flag"
cannam@140 8075 fi
cannam@140 8076 elif test -n "$runpath_var"; then
cannam@140 8077 case "$perm_rpath " in
cannam@140 8078 *" $libdir "*) ;;
cannam@140 8079 *) func_append perm_rpath " $libdir" ;;
cannam@140 8080 esac
cannam@140 8081 fi
cannam@140 8082 done
cannam@140 8083 # Substitute the hardcoded libdirs into the rpath.
cannam@140 8084 if test -n "$hardcode_libdir_separator" &&
cannam@140 8085 test -n "$hardcode_libdirs"; then
cannam@140 8086 libdir="$hardcode_libdirs"
cannam@140 8087 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
cannam@140 8088 fi
cannam@140 8089 if test -n "$runpath_var" && test -n "$perm_rpath"; then
cannam@140 8090 # We should set the runpath_var.
cannam@140 8091 rpath=
cannam@140 8092 for dir in $perm_rpath; do
cannam@140 8093 func_append rpath "$dir:"
cannam@140 8094 done
cannam@140 8095 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
cannam@140 8096 fi
cannam@140 8097 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
cannam@140 8098 fi
cannam@140 8099
cannam@140 8100 shlibpath="$finalize_shlibpath"
cannam@140 8101 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
cannam@140 8102 if test -n "$shlibpath"; then
cannam@140 8103 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
cannam@140 8104 fi
cannam@140 8105
cannam@140 8106 # Get the real and link names of the library.
cannam@140 8107 eval shared_ext=\"$shrext_cmds\"
cannam@140 8108 eval library_names=\"$library_names_spec\"
cannam@140 8109 set dummy $library_names
cannam@140 8110 shift
cannam@140 8111 realname="$1"
cannam@140 8112 shift
cannam@140 8113
cannam@140 8114 if test -n "$soname_spec"; then
cannam@140 8115 eval soname=\"$soname_spec\"
cannam@140 8116 else
cannam@140 8117 soname="$realname"
cannam@140 8118 fi
cannam@140 8119 if test -z "$dlname"; then
cannam@140 8120 dlname=$soname
cannam@140 8121 fi
cannam@140 8122
cannam@140 8123 lib="$output_objdir/$realname"
cannam@140 8124 linknames=
cannam@140 8125 for link
cannam@140 8126 do
cannam@140 8127 func_append linknames " $link"
cannam@140 8128 done
cannam@140 8129
cannam@140 8130 # Use standard objects if they are pic
cannam@140 8131 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
cannam@140 8132 test "X$libobjs" = "X " && libobjs=
cannam@140 8133
cannam@140 8134 delfiles=
cannam@140 8135 if test -n "$export_symbols" && test -n "$include_expsyms"; then
cannam@140 8136 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
cannam@140 8137 export_symbols="$output_objdir/$libname.uexp"
cannam@140 8138 func_append delfiles " $export_symbols"
cannam@140 8139 fi
cannam@140 8140
cannam@140 8141 orig_export_symbols=
cannam@140 8142 case $host_os in
cannam@140 8143 cygwin* | mingw* | cegcc*)
cannam@140 8144 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
cannam@140 8145 # exporting using user supplied symfile
cannam@140 8146 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
cannam@140 8147 # and it's NOT already a .def file. Must figure out
cannam@140 8148 # which of the given symbols are data symbols and tag
cannam@140 8149 # them as such. So, trigger use of export_symbols_cmds.
cannam@140 8150 # export_symbols gets reassigned inside the "prepare
cannam@140 8151 # the list of exported symbols" if statement, so the
cannam@140 8152 # include_expsyms logic still works.
cannam@140 8153 orig_export_symbols="$export_symbols"
cannam@140 8154 export_symbols=
cannam@140 8155 always_export_symbols=yes
cannam@140 8156 fi
cannam@140 8157 fi
cannam@140 8158 ;;
cannam@140 8159 esac
cannam@140 8160
cannam@140 8161 # Prepare the list of exported symbols
cannam@140 8162 if test -z "$export_symbols"; then
cannam@140 8163 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
cannam@140 8164 func_verbose "generating symbol list for \`$libname.la'"
cannam@140 8165 export_symbols="$output_objdir/$libname.exp"
cannam@140 8166 $opt_dry_run || $RM $export_symbols
cannam@140 8167 cmds=$export_symbols_cmds
cannam@140 8168 save_ifs="$IFS"; IFS='~'
cannam@140 8169 for cmd1 in $cmds; do
cannam@140 8170 IFS="$save_ifs"
cannam@140 8171 # Take the normal branch if the nm_file_list_spec branch
cannam@140 8172 # doesn't work or if tool conversion is not needed.
cannam@140 8173 case $nm_file_list_spec~$to_tool_file_cmd in
cannam@140 8174 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
cannam@140 8175 try_normal_branch=yes
cannam@140 8176 eval cmd=\"$cmd1\"
cannam@140 8177 func_len " $cmd"
cannam@140 8178 len=$func_len_result
cannam@140 8179 ;;
cannam@140 8180 *)
cannam@140 8181 try_normal_branch=no
cannam@140 8182 ;;
cannam@140 8183 esac
cannam@140 8184 if test "$try_normal_branch" = yes \
cannam@140 8185 && { test "$len" -lt "$max_cmd_len" \
cannam@140 8186 || test "$max_cmd_len" -le -1; }
cannam@140 8187 then
cannam@140 8188 func_show_eval "$cmd" 'exit $?'
cannam@140 8189 skipped_export=false
cannam@140 8190 elif test -n "$nm_file_list_spec"; then
cannam@140 8191 func_basename "$output"
cannam@140 8192 output_la=$func_basename_result
cannam@140 8193 save_libobjs=$libobjs
cannam@140 8194 save_output=$output
cannam@140 8195 output=${output_objdir}/${output_la}.nm
cannam@140 8196 func_to_tool_file "$output"
cannam@140 8197 libobjs=$nm_file_list_spec$func_to_tool_file_result
cannam@140 8198 func_append delfiles " $output"
cannam@140 8199 func_verbose "creating $NM input file list: $output"
cannam@140 8200 for obj in $save_libobjs; do
cannam@140 8201 func_to_tool_file "$obj"
cannam@140 8202 $ECHO "$func_to_tool_file_result"
cannam@140 8203 done > "$output"
cannam@140 8204 eval cmd=\"$cmd1\"
cannam@140 8205 func_show_eval "$cmd" 'exit $?'
cannam@140 8206 output=$save_output
cannam@140 8207 libobjs=$save_libobjs
cannam@140 8208 skipped_export=false
cannam@140 8209 else
cannam@140 8210 # The command line is too long to execute in one step.
cannam@140 8211 func_verbose "using reloadable object file for export list..."
cannam@140 8212 skipped_export=:
cannam@140 8213 # Break out early, otherwise skipped_export may be
cannam@140 8214 # set to false by a later but shorter cmd.
cannam@140 8215 break
cannam@140 8216 fi
cannam@140 8217 done
cannam@140 8218 IFS="$save_ifs"
cannam@140 8219 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
cannam@140 8220 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
cannam@140 8221 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
cannam@140 8222 fi
cannam@140 8223 fi
cannam@140 8224 fi
cannam@140 8225
cannam@140 8226 if test -n "$export_symbols" && test -n "$include_expsyms"; then
cannam@140 8227 tmp_export_symbols="$export_symbols"
cannam@140 8228 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
cannam@140 8229 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
cannam@140 8230 fi
cannam@140 8231
cannam@140 8232 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
cannam@140 8233 # The given exports_symbols file has to be filtered, so filter it.
cannam@140 8234 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
cannam@140 8235 # FIXME: $output_objdir/$libname.filter potentially contains lots of
cannam@140 8236 # 's' commands which not all seds can handle. GNU sed should be fine
cannam@140 8237 # though. Also, the filter scales superlinearly with the number of
cannam@140 8238 # global variables. join(1) would be nice here, but unfortunately
cannam@140 8239 # isn't a blessed tool.
cannam@140 8240 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
cannam@140 8241 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
cannam@140 8242 export_symbols=$output_objdir/$libname.def
cannam@140 8243 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
cannam@140 8244 fi
cannam@140 8245
cannam@140 8246 tmp_deplibs=
cannam@140 8247 for test_deplib in $deplibs; do
cannam@140 8248 case " $convenience " in
cannam@140 8249 *" $test_deplib "*) ;;
cannam@140 8250 *)
cannam@140 8251 func_append tmp_deplibs " $test_deplib"
cannam@140 8252 ;;
cannam@140 8253 esac
cannam@140 8254 done
cannam@140 8255 deplibs="$tmp_deplibs"
cannam@140 8256
cannam@140 8257 if test -n "$convenience"; then
cannam@140 8258 if test -n "$whole_archive_flag_spec" &&
cannam@140 8259 test "$compiler_needs_object" = yes &&
cannam@140 8260 test -z "$libobjs"; then
cannam@140 8261 # extract the archives, so we have objects to list.
cannam@140 8262 # TODO: could optimize this to just extract one archive.
cannam@140 8263 whole_archive_flag_spec=
cannam@140 8264 fi
cannam@140 8265 if test -n "$whole_archive_flag_spec"; then
cannam@140 8266 save_libobjs=$libobjs
cannam@140 8267 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
cannam@140 8268 test "X$libobjs" = "X " && libobjs=
cannam@140 8269 else
cannam@140 8270 gentop="$output_objdir/${outputname}x"
cannam@140 8271 func_append generated " $gentop"
cannam@140 8272
cannam@140 8273 func_extract_archives $gentop $convenience
cannam@140 8274 func_append libobjs " $func_extract_archives_result"
cannam@140 8275 test "X$libobjs" = "X " && libobjs=
cannam@140 8276 fi
cannam@140 8277 fi
cannam@140 8278
cannam@140 8279 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
cannam@140 8280 eval flag=\"$thread_safe_flag_spec\"
cannam@140 8281 func_append linker_flags " $flag"
cannam@140 8282 fi
cannam@140 8283
cannam@140 8284 # Make a backup of the uninstalled library when relinking
cannam@140 8285 if test "$opt_mode" = relink; then
cannam@140 8286 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
cannam@140 8287 fi
cannam@140 8288
cannam@140 8289 # Do each of the archive commands.
cannam@140 8290 if test "$module" = yes && test -n "$module_cmds" ; then
cannam@140 8291 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
cannam@140 8292 eval test_cmds=\"$module_expsym_cmds\"
cannam@140 8293 cmds=$module_expsym_cmds
cannam@140 8294 else
cannam@140 8295 eval test_cmds=\"$module_cmds\"
cannam@140 8296 cmds=$module_cmds
cannam@140 8297 fi
cannam@140 8298 else
cannam@140 8299 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
cannam@140 8300 eval test_cmds=\"$archive_expsym_cmds\"
cannam@140 8301 cmds=$archive_expsym_cmds
cannam@140 8302 else
cannam@140 8303 eval test_cmds=\"$archive_cmds\"
cannam@140 8304 cmds=$archive_cmds
cannam@140 8305 fi
cannam@140 8306 fi
cannam@140 8307
cannam@140 8308 if test "X$skipped_export" != "X:" &&
cannam@140 8309 func_len " $test_cmds" &&
cannam@140 8310 len=$func_len_result &&
cannam@140 8311 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
cannam@140 8312 :
cannam@140 8313 else
cannam@140 8314 # The command line is too long to link in one step, link piecewise
cannam@140 8315 # or, if using GNU ld and skipped_export is not :, use a linker
cannam@140 8316 # script.
cannam@140 8317
cannam@140 8318 # Save the value of $output and $libobjs because we want to
cannam@140 8319 # use them later. If we have whole_archive_flag_spec, we
cannam@140 8320 # want to use save_libobjs as it was before
cannam@140 8321 # whole_archive_flag_spec was expanded, because we can't
cannam@140 8322 # assume the linker understands whole_archive_flag_spec.
cannam@140 8323 # This may have to be revisited, in case too many
cannam@140 8324 # convenience libraries get linked in and end up exceeding
cannam@140 8325 # the spec.
cannam@140 8326 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
cannam@140 8327 save_libobjs=$libobjs
cannam@140 8328 fi
cannam@140 8329 save_output=$output
cannam@140 8330 func_basename "$output"
cannam@140 8331 output_la=$func_basename_result
cannam@140 8332
cannam@140 8333 # Clear the reloadable object creation command queue and
cannam@140 8334 # initialize k to one.
cannam@140 8335 test_cmds=
cannam@140 8336 concat_cmds=
cannam@140 8337 objlist=
cannam@140 8338 last_robj=
cannam@140 8339 k=1
cannam@140 8340
cannam@140 8341 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
cannam@140 8342 output=${output_objdir}/${output_la}.lnkscript
cannam@140 8343 func_verbose "creating GNU ld script: $output"
cannam@140 8344 echo 'INPUT (' > $output
cannam@140 8345 for obj in $save_libobjs
cannam@140 8346 do
cannam@140 8347 func_to_tool_file "$obj"
cannam@140 8348 $ECHO "$func_to_tool_file_result" >> $output
cannam@140 8349 done
cannam@140 8350 echo ')' >> $output
cannam@140 8351 func_append delfiles " $output"
cannam@140 8352 func_to_tool_file "$output"
cannam@140 8353 output=$func_to_tool_file_result
cannam@140 8354 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
cannam@140 8355 output=${output_objdir}/${output_la}.lnk
cannam@140 8356 func_verbose "creating linker input file list: $output"
cannam@140 8357 : > $output
cannam@140 8358 set x $save_libobjs
cannam@140 8359 shift
cannam@140 8360 firstobj=
cannam@140 8361 if test "$compiler_needs_object" = yes; then
cannam@140 8362 firstobj="$1 "
cannam@140 8363 shift
cannam@140 8364 fi
cannam@140 8365 for obj
cannam@140 8366 do
cannam@140 8367 func_to_tool_file "$obj"
cannam@140 8368 $ECHO "$func_to_tool_file_result" >> $output
cannam@140 8369 done
cannam@140 8370 func_append delfiles " $output"
cannam@140 8371 func_to_tool_file "$output"
cannam@140 8372 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
cannam@140 8373 else
cannam@140 8374 if test -n "$save_libobjs"; then
cannam@140 8375 func_verbose "creating reloadable object files..."
cannam@140 8376 output=$output_objdir/$output_la-${k}.$objext
cannam@140 8377 eval test_cmds=\"$reload_cmds\"
cannam@140 8378 func_len " $test_cmds"
cannam@140 8379 len0=$func_len_result
cannam@140 8380 len=$len0
cannam@140 8381
cannam@140 8382 # Loop over the list of objects to be linked.
cannam@140 8383 for obj in $save_libobjs
cannam@140 8384 do
cannam@140 8385 func_len " $obj"
cannam@140 8386 func_arith $len + $func_len_result
cannam@140 8387 len=$func_arith_result
cannam@140 8388 if test "X$objlist" = X ||
cannam@140 8389 test "$len" -lt "$max_cmd_len"; then
cannam@140 8390 func_append objlist " $obj"
cannam@140 8391 else
cannam@140 8392 # The command $test_cmds is almost too long, add a
cannam@140 8393 # command to the queue.
cannam@140 8394 if test "$k" -eq 1 ; then
cannam@140 8395 # The first file doesn't have a previous command to add.
cannam@140 8396 reload_objs=$objlist
cannam@140 8397 eval concat_cmds=\"$reload_cmds\"
cannam@140 8398 else
cannam@140 8399 # All subsequent reloadable object files will link in
cannam@140 8400 # the last one created.
cannam@140 8401 reload_objs="$objlist $last_robj"
cannam@140 8402 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
cannam@140 8403 fi
cannam@140 8404 last_robj=$output_objdir/$output_la-${k}.$objext
cannam@140 8405 func_arith $k + 1
cannam@140 8406 k=$func_arith_result
cannam@140 8407 output=$output_objdir/$output_la-${k}.$objext
cannam@140 8408 objlist=" $obj"
cannam@140 8409 func_len " $last_robj"
cannam@140 8410 func_arith $len0 + $func_len_result
cannam@140 8411 len=$func_arith_result
cannam@140 8412 fi
cannam@140 8413 done
cannam@140 8414 # Handle the remaining objects by creating one last
cannam@140 8415 # reloadable object file. All subsequent reloadable object
cannam@140 8416 # files will link in the last one created.
cannam@140 8417 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
cannam@140 8418 reload_objs="$objlist $last_robj"
cannam@140 8419 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
cannam@140 8420 if test -n "$last_robj"; then
cannam@140 8421 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
cannam@140 8422 fi
cannam@140 8423 func_append delfiles " $output"
cannam@140 8424
cannam@140 8425 else
cannam@140 8426 output=
cannam@140 8427 fi
cannam@140 8428
cannam@140 8429 if ${skipped_export-false}; then
cannam@140 8430 func_verbose "generating symbol list for \`$libname.la'"
cannam@140 8431 export_symbols="$output_objdir/$libname.exp"
cannam@140 8432 $opt_dry_run || $RM $export_symbols
cannam@140 8433 libobjs=$output
cannam@140 8434 # Append the command to create the export file.
cannam@140 8435 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
cannam@140 8436 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
cannam@140 8437 if test -n "$last_robj"; then
cannam@140 8438 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
cannam@140 8439 fi
cannam@140 8440 fi
cannam@140 8441
cannam@140 8442 test -n "$save_libobjs" &&
cannam@140 8443 func_verbose "creating a temporary reloadable object file: $output"
cannam@140 8444
cannam@140 8445 # Loop through the commands generated above and execute them.
cannam@140 8446 save_ifs="$IFS"; IFS='~'
cannam@140 8447 for cmd in $concat_cmds; do
cannam@140 8448 IFS="$save_ifs"
cannam@140 8449 $opt_silent || {
cannam@140 8450 func_quote_for_expand "$cmd"
cannam@140 8451 eval "func_echo $func_quote_for_expand_result"
cannam@140 8452 }
cannam@140 8453 $opt_dry_run || eval "$cmd" || {
cannam@140 8454 lt_exit=$?
cannam@140 8455
cannam@140 8456 # Restore the uninstalled library and exit
cannam@140 8457 if test "$opt_mode" = relink; then
cannam@140 8458 ( cd "$output_objdir" && \
cannam@140 8459 $RM "${realname}T" && \
cannam@140 8460 $MV "${realname}U" "$realname" )
cannam@140 8461 fi
cannam@140 8462
cannam@140 8463 exit $lt_exit
cannam@140 8464 }
cannam@140 8465 done
cannam@140 8466 IFS="$save_ifs"
cannam@140 8467
cannam@140 8468 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
cannam@140 8469 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
cannam@140 8470 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
cannam@140 8471 fi
cannam@140 8472 fi
cannam@140 8473
cannam@140 8474 if ${skipped_export-false}; then
cannam@140 8475 if test -n "$export_symbols" && test -n "$include_expsyms"; then
cannam@140 8476 tmp_export_symbols="$export_symbols"
cannam@140 8477 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
cannam@140 8478 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
cannam@140 8479 fi
cannam@140 8480
cannam@140 8481 if test -n "$orig_export_symbols"; then
cannam@140 8482 # The given exports_symbols file has to be filtered, so filter it.
cannam@140 8483 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
cannam@140 8484 # FIXME: $output_objdir/$libname.filter potentially contains lots of
cannam@140 8485 # 's' commands which not all seds can handle. GNU sed should be fine
cannam@140 8486 # though. Also, the filter scales superlinearly with the number of
cannam@140 8487 # global variables. join(1) would be nice here, but unfortunately
cannam@140 8488 # isn't a blessed tool.
cannam@140 8489 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
cannam@140 8490 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
cannam@140 8491 export_symbols=$output_objdir/$libname.def
cannam@140 8492 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
cannam@140 8493 fi
cannam@140 8494 fi
cannam@140 8495
cannam@140 8496 libobjs=$output
cannam@140 8497 # Restore the value of output.
cannam@140 8498 output=$save_output
cannam@140 8499
cannam@140 8500 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
cannam@140 8501 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
cannam@140 8502 test "X$libobjs" = "X " && libobjs=
cannam@140 8503 fi
cannam@140 8504 # Expand the library linking commands again to reset the
cannam@140 8505 # value of $libobjs for piecewise linking.
cannam@140 8506
cannam@140 8507 # Do each of the archive commands.
cannam@140 8508 if test "$module" = yes && test -n "$module_cmds" ; then
cannam@140 8509 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
cannam@140 8510 cmds=$module_expsym_cmds
cannam@140 8511 else
cannam@140 8512 cmds=$module_cmds
cannam@140 8513 fi
cannam@140 8514 else
cannam@140 8515 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
cannam@140 8516 cmds=$archive_expsym_cmds
cannam@140 8517 else
cannam@140 8518 cmds=$archive_cmds
cannam@140 8519 fi
cannam@140 8520 fi
cannam@140 8521 fi
cannam@140 8522
cannam@140 8523 if test -n "$delfiles"; then
cannam@140 8524 # Append the command to remove temporary files to $cmds.
cannam@140 8525 eval cmds=\"\$cmds~\$RM $delfiles\"
cannam@140 8526 fi
cannam@140 8527
cannam@140 8528 # Add any objects from preloaded convenience libraries
cannam@140 8529 if test -n "$dlprefiles"; then
cannam@140 8530 gentop="$output_objdir/${outputname}x"
cannam@140 8531 func_append generated " $gentop"
cannam@140 8532
cannam@140 8533 func_extract_archives $gentop $dlprefiles
cannam@140 8534 func_append libobjs " $func_extract_archives_result"
cannam@140 8535 test "X$libobjs" = "X " && libobjs=
cannam@140 8536 fi
cannam@140 8537
cannam@140 8538 save_ifs="$IFS"; IFS='~'
cannam@140 8539 for cmd in $cmds; do
cannam@140 8540 IFS="$save_ifs"
cannam@140 8541 eval cmd=\"$cmd\"
cannam@140 8542 $opt_silent || {
cannam@140 8543 func_quote_for_expand "$cmd"
cannam@140 8544 eval "func_echo $func_quote_for_expand_result"
cannam@140 8545 }
cannam@140 8546 $opt_dry_run || eval "$cmd" || {
cannam@140 8547 lt_exit=$?
cannam@140 8548
cannam@140 8549 # Restore the uninstalled library and exit
cannam@140 8550 if test "$opt_mode" = relink; then
cannam@140 8551 ( cd "$output_objdir" && \
cannam@140 8552 $RM "${realname}T" && \
cannam@140 8553 $MV "${realname}U" "$realname" )
cannam@140 8554 fi
cannam@140 8555
cannam@140 8556 exit $lt_exit
cannam@140 8557 }
cannam@140 8558 done
cannam@140 8559 IFS="$save_ifs"
cannam@140 8560
cannam@140 8561 # Restore the uninstalled library and exit
cannam@140 8562 if test "$opt_mode" = relink; then
cannam@140 8563 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
cannam@140 8564
cannam@140 8565 if test -n "$convenience"; then
cannam@140 8566 if test -z "$whole_archive_flag_spec"; then
cannam@140 8567 func_show_eval '${RM}r "$gentop"'
cannam@140 8568 fi
cannam@140 8569 fi
cannam@140 8570
cannam@140 8571 exit $EXIT_SUCCESS
cannam@140 8572 fi
cannam@140 8573
cannam@140 8574 # Create links to the real library.
cannam@140 8575 for linkname in $linknames; do
cannam@140 8576 if test "$realname" != "$linkname"; then
cannam@140 8577 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
cannam@140 8578 fi
cannam@140 8579 done
cannam@140 8580
cannam@140 8581 # If -module or -export-dynamic was specified, set the dlname.
cannam@140 8582 if test "$module" = yes || test "$export_dynamic" = yes; then
cannam@140 8583 # On all known operating systems, these are identical.
cannam@140 8584 dlname="$soname"
cannam@140 8585 fi
cannam@140 8586 fi
cannam@140 8587 ;;
cannam@140 8588
cannam@140 8589 obj)
cannam@140 8590 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
cannam@140 8591 func_warning "\`-dlopen' is ignored for objects"
cannam@140 8592 fi
cannam@140 8593
cannam@140 8594 case " $deplibs" in
cannam@140 8595 *\ -l* | *\ -L*)
cannam@140 8596 func_warning "\`-l' and \`-L' are ignored for objects" ;;
cannam@140 8597 esac
cannam@140 8598
cannam@140 8599 test -n "$rpath" && \
cannam@140 8600 func_warning "\`-rpath' is ignored for objects"
cannam@140 8601
cannam@140 8602 test -n "$xrpath" && \
cannam@140 8603 func_warning "\`-R' is ignored for objects"
cannam@140 8604
cannam@140 8605 test -n "$vinfo" && \
cannam@140 8606 func_warning "\`-version-info' is ignored for objects"
cannam@140 8607
cannam@140 8608 test -n "$release" && \
cannam@140 8609 func_warning "\`-release' is ignored for objects"
cannam@140 8610
cannam@140 8611 case $output in
cannam@140 8612 *.lo)
cannam@140 8613 test -n "$objs$old_deplibs" && \
cannam@140 8614 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
cannam@140 8615
cannam@140 8616 libobj=$output
cannam@140 8617 func_lo2o "$libobj"
cannam@140 8618 obj=$func_lo2o_result
cannam@140 8619 ;;
cannam@140 8620 *)
cannam@140 8621 libobj=
cannam@140 8622 obj="$output"
cannam@140 8623 ;;
cannam@140 8624 esac
cannam@140 8625
cannam@140 8626 # Delete the old objects.
cannam@140 8627 $opt_dry_run || $RM $obj $libobj
cannam@140 8628
cannam@140 8629 # Objects from convenience libraries. This assumes
cannam@140 8630 # single-version convenience libraries. Whenever we create
cannam@140 8631 # different ones for PIC/non-PIC, this we'll have to duplicate
cannam@140 8632 # the extraction.
cannam@140 8633 reload_conv_objs=
cannam@140 8634 gentop=
cannam@140 8635 # reload_cmds runs $LD directly, so let us get rid of
cannam@140 8636 # -Wl from whole_archive_flag_spec and hope we can get by with
cannam@140 8637 # turning comma into space..
cannam@140 8638 wl=
cannam@140 8639
cannam@140 8640 if test -n "$convenience"; then
cannam@140 8641 if test -n "$whole_archive_flag_spec"; then
cannam@140 8642 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
cannam@140 8643 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
cannam@140 8644 else
cannam@140 8645 gentop="$output_objdir/${obj}x"
cannam@140 8646 func_append generated " $gentop"
cannam@140 8647
cannam@140 8648 func_extract_archives $gentop $convenience
cannam@140 8649 reload_conv_objs="$reload_objs $func_extract_archives_result"
cannam@140 8650 fi
cannam@140 8651 fi
cannam@140 8652
cannam@140 8653 # If we're not building shared, we need to use non_pic_objs
cannam@140 8654 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
cannam@140 8655
cannam@140 8656 # Create the old-style object.
cannam@140 8657 reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
cannam@140 8658
cannam@140 8659 output="$obj"
cannam@140 8660 func_execute_cmds "$reload_cmds" 'exit $?'
cannam@140 8661
cannam@140 8662 # Exit if we aren't doing a library object file.
cannam@140 8663 if test -z "$libobj"; then
cannam@140 8664 if test -n "$gentop"; then
cannam@140 8665 func_show_eval '${RM}r "$gentop"'
cannam@140 8666 fi
cannam@140 8667
cannam@140 8668 exit $EXIT_SUCCESS
cannam@140 8669 fi
cannam@140 8670
cannam@140 8671 if test "$build_libtool_libs" != yes; then
cannam@140 8672 if test -n "$gentop"; then
cannam@140 8673 func_show_eval '${RM}r "$gentop"'
cannam@140 8674 fi
cannam@140 8675
cannam@140 8676 # Create an invalid libtool object if no PIC, so that we don't
cannam@140 8677 # accidentally link it into a program.
cannam@140 8678 # $show "echo timestamp > $libobj"
cannam@140 8679 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
cannam@140 8680 exit $EXIT_SUCCESS
cannam@140 8681 fi
cannam@140 8682
cannam@140 8683 if test -n "$pic_flag" || test "$pic_mode" != default; then
cannam@140 8684 # Only do commands if we really have different PIC objects.
cannam@140 8685 reload_objs="$libobjs $reload_conv_objs"
cannam@140 8686 output="$libobj"
cannam@140 8687 func_execute_cmds "$reload_cmds" 'exit $?'
cannam@140 8688 fi
cannam@140 8689
cannam@140 8690 if test -n "$gentop"; then
cannam@140 8691 func_show_eval '${RM}r "$gentop"'
cannam@140 8692 fi
cannam@140 8693
cannam@140 8694 exit $EXIT_SUCCESS
cannam@140 8695 ;;
cannam@140 8696
cannam@140 8697 prog)
cannam@140 8698 case $host in
cannam@140 8699 *cygwin*) func_stripname '' '.exe' "$output"
cannam@140 8700 output=$func_stripname_result.exe;;
cannam@140 8701 esac
cannam@140 8702 test -n "$vinfo" && \
cannam@140 8703 func_warning "\`-version-info' is ignored for programs"
cannam@140 8704
cannam@140 8705 test -n "$release" && \
cannam@140 8706 func_warning "\`-release' is ignored for programs"
cannam@140 8707
cannam@140 8708 test "$preload" = yes \
cannam@140 8709 && test "$dlopen_support" = unknown \
cannam@140 8710 && test "$dlopen_self" = unknown \
cannam@140 8711 && test "$dlopen_self_static" = unknown && \
cannam@140 8712 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
cannam@140 8713
cannam@140 8714 case $host in
cannam@140 8715 *-*-rhapsody* | *-*-darwin1.[012])
cannam@140 8716 # On Rhapsody replace the C library is the System framework
cannam@140 8717 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
cannam@140 8718 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
cannam@140 8719 ;;
cannam@140 8720 esac
cannam@140 8721
cannam@140 8722 case $host in
cannam@140 8723 *-*-darwin*)
cannam@140 8724 # Don't allow lazy linking, it breaks C++ global constructors
cannam@140 8725 # But is supposedly fixed on 10.4 or later (yay!).
cannam@140 8726 if test "$tagname" = CXX ; then
cannam@140 8727 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
cannam@140 8728 10.[0123])
cannam@140 8729 func_append compile_command " ${wl}-bind_at_load"
cannam@140 8730 func_append finalize_command " ${wl}-bind_at_load"
cannam@140 8731 ;;
cannam@140 8732 esac
cannam@140 8733 fi
cannam@140 8734 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
cannam@140 8735 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@140 8736 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@140 8737 ;;
cannam@140 8738 esac
cannam@140 8739
cannam@140 8740
cannam@140 8741 # move library search paths that coincide with paths to not yet
cannam@140 8742 # installed libraries to the beginning of the library search list
cannam@140 8743 new_libs=
cannam@140 8744 for path in $notinst_path; do
cannam@140 8745 case " $new_libs " in
cannam@140 8746 *" -L$path/$objdir "*) ;;
cannam@140 8747 *)
cannam@140 8748 case " $compile_deplibs " in
cannam@140 8749 *" -L$path/$objdir "*)
cannam@140 8750 func_append new_libs " -L$path/$objdir" ;;
cannam@140 8751 esac
cannam@140 8752 ;;
cannam@140 8753 esac
cannam@140 8754 done
cannam@140 8755 for deplib in $compile_deplibs; do
cannam@140 8756 case $deplib in
cannam@140 8757 -L*)
cannam@140 8758 case " $new_libs " in
cannam@140 8759 *" $deplib "*) ;;
cannam@140 8760 *) func_append new_libs " $deplib" ;;
cannam@140 8761 esac
cannam@140 8762 ;;
cannam@140 8763 *) func_append new_libs " $deplib" ;;
cannam@140 8764 esac
cannam@140 8765 done
cannam@140 8766 compile_deplibs="$new_libs"
cannam@140 8767
cannam@140 8768
cannam@140 8769 func_append compile_command " $compile_deplibs"
cannam@140 8770 func_append finalize_command " $finalize_deplibs"
cannam@140 8771
cannam@140 8772 if test -n "$rpath$xrpath"; then
cannam@140 8773 # If the user specified any rpath flags, then add them.
cannam@140 8774 for libdir in $rpath $xrpath; do
cannam@140 8775 # This is the magic to use -rpath.
cannam@140 8776 case "$finalize_rpath " in
cannam@140 8777 *" $libdir "*) ;;
cannam@140 8778 *) func_append finalize_rpath " $libdir" ;;
cannam@140 8779 esac
cannam@140 8780 done
cannam@140 8781 fi
cannam@140 8782
cannam@140 8783 # Now hardcode the library paths
cannam@140 8784 rpath=
cannam@140 8785 hardcode_libdirs=
cannam@140 8786 for libdir in $compile_rpath $finalize_rpath; do
cannam@140 8787 if test -n "$hardcode_libdir_flag_spec"; then
cannam@140 8788 if test -n "$hardcode_libdir_separator"; then
cannam@140 8789 if test -z "$hardcode_libdirs"; then
cannam@140 8790 hardcode_libdirs="$libdir"
cannam@140 8791 else
cannam@140 8792 # Just accumulate the unique libdirs.
cannam@140 8793 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
cannam@140 8794 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
cannam@140 8795 ;;
cannam@140 8796 *)
cannam@140 8797 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
cannam@140 8798 ;;
cannam@140 8799 esac
cannam@140 8800 fi
cannam@140 8801 else
cannam@140 8802 eval flag=\"$hardcode_libdir_flag_spec\"
cannam@140 8803 func_append rpath " $flag"
cannam@140 8804 fi
cannam@140 8805 elif test -n "$runpath_var"; then
cannam@140 8806 case "$perm_rpath " in
cannam@140 8807 *" $libdir "*) ;;
cannam@140 8808 *) func_append perm_rpath " $libdir" ;;
cannam@140 8809 esac
cannam@140 8810 fi
cannam@140 8811 case $host in
cannam@140 8812 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
cannam@140 8813 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
cannam@140 8814 case :$dllsearchpath: in
cannam@140 8815 *":$libdir:"*) ;;
cannam@140 8816 ::) dllsearchpath=$libdir;;
cannam@140 8817 *) func_append dllsearchpath ":$libdir";;
cannam@140 8818 esac
cannam@140 8819 case :$dllsearchpath: in
cannam@140 8820 *":$testbindir:"*) ;;
cannam@140 8821 ::) dllsearchpath=$testbindir;;
cannam@140 8822 *) func_append dllsearchpath ":$testbindir";;
cannam@140 8823 esac
cannam@140 8824 ;;
cannam@140 8825 esac
cannam@140 8826 done
cannam@140 8827 # Substitute the hardcoded libdirs into the rpath.
cannam@140 8828 if test -n "$hardcode_libdir_separator" &&
cannam@140 8829 test -n "$hardcode_libdirs"; then
cannam@140 8830 libdir="$hardcode_libdirs"
cannam@140 8831 eval rpath=\" $hardcode_libdir_flag_spec\"
cannam@140 8832 fi
cannam@140 8833 compile_rpath="$rpath"
cannam@140 8834
cannam@140 8835 rpath=
cannam@140 8836 hardcode_libdirs=
cannam@140 8837 for libdir in $finalize_rpath; do
cannam@140 8838 if test -n "$hardcode_libdir_flag_spec"; then
cannam@140 8839 if test -n "$hardcode_libdir_separator"; then
cannam@140 8840 if test -z "$hardcode_libdirs"; then
cannam@140 8841 hardcode_libdirs="$libdir"
cannam@140 8842 else
cannam@140 8843 # Just accumulate the unique libdirs.
cannam@140 8844 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
cannam@140 8845 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
cannam@140 8846 ;;
cannam@140 8847 *)
cannam@140 8848 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
cannam@140 8849 ;;
cannam@140 8850 esac
cannam@140 8851 fi
cannam@140 8852 else
cannam@140 8853 eval flag=\"$hardcode_libdir_flag_spec\"
cannam@140 8854 func_append rpath " $flag"
cannam@140 8855 fi
cannam@140 8856 elif test -n "$runpath_var"; then
cannam@140 8857 case "$finalize_perm_rpath " in
cannam@140 8858 *" $libdir "*) ;;
cannam@140 8859 *) func_append finalize_perm_rpath " $libdir" ;;
cannam@140 8860 esac
cannam@140 8861 fi
cannam@140 8862 done
cannam@140 8863 # Substitute the hardcoded libdirs into the rpath.
cannam@140 8864 if test -n "$hardcode_libdir_separator" &&
cannam@140 8865 test -n "$hardcode_libdirs"; then
cannam@140 8866 libdir="$hardcode_libdirs"
cannam@140 8867 eval rpath=\" $hardcode_libdir_flag_spec\"
cannam@140 8868 fi
cannam@140 8869 finalize_rpath="$rpath"
cannam@140 8870
cannam@140 8871 if test -n "$libobjs" && test "$build_old_libs" = yes; then
cannam@140 8872 # Transform all the library objects into standard objects.
cannam@140 8873 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
cannam@140 8874 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
cannam@140 8875 fi
cannam@140 8876
cannam@140 8877 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
cannam@140 8878
cannam@140 8879 # template prelinking step
cannam@140 8880 if test -n "$prelink_cmds"; then
cannam@140 8881 func_execute_cmds "$prelink_cmds" 'exit $?'
cannam@140 8882 fi
cannam@140 8883
cannam@140 8884 wrappers_required=yes
cannam@140 8885 case $host in
cannam@140 8886 *cegcc* | *mingw32ce*)
cannam@140 8887 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
cannam@140 8888 wrappers_required=no
cannam@140 8889 ;;
cannam@140 8890 *cygwin* | *mingw* )
cannam@140 8891 if test "$build_libtool_libs" != yes; then
cannam@140 8892 wrappers_required=no
cannam@140 8893 fi
cannam@140 8894 ;;
cannam@140 8895 *)
cannam@140 8896 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
cannam@140 8897 wrappers_required=no
cannam@140 8898 fi
cannam@140 8899 ;;
cannam@140 8900 esac
cannam@140 8901 if test "$wrappers_required" = no; then
cannam@140 8902 # Replace the output file specification.
cannam@140 8903 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
cannam@140 8904 link_command="$compile_command$compile_rpath"
cannam@140 8905
cannam@140 8906 # We have no uninstalled library dependencies, so finalize right now.
cannam@140 8907 exit_status=0
cannam@140 8908 func_show_eval "$link_command" 'exit_status=$?'
cannam@140 8909
cannam@140 8910 if test -n "$postlink_cmds"; then
cannam@140 8911 func_to_tool_file "$output"
cannam@140 8912 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
cannam@140 8913 func_execute_cmds "$postlink_cmds" 'exit $?'
cannam@140 8914 fi
cannam@140 8915
cannam@140 8916 # Delete the generated files.
cannam@140 8917 if test -f "$output_objdir/${outputname}S.${objext}"; then
cannam@140 8918 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
cannam@140 8919 fi
cannam@140 8920
cannam@140 8921 exit $exit_status
cannam@140 8922 fi
cannam@140 8923
cannam@140 8924 if test -n "$compile_shlibpath$finalize_shlibpath"; then
cannam@140 8925 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
cannam@140 8926 fi
cannam@140 8927 if test -n "$finalize_shlibpath"; then
cannam@140 8928 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
cannam@140 8929 fi
cannam@140 8930
cannam@140 8931 compile_var=
cannam@140 8932 finalize_var=
cannam@140 8933 if test -n "$runpath_var"; then
cannam@140 8934 if test -n "$perm_rpath"; then
cannam@140 8935 # We should set the runpath_var.
cannam@140 8936 rpath=
cannam@140 8937 for dir in $perm_rpath; do
cannam@140 8938 func_append rpath "$dir:"
cannam@140 8939 done
cannam@140 8940 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
cannam@140 8941 fi
cannam@140 8942 if test -n "$finalize_perm_rpath"; then
cannam@140 8943 # We should set the runpath_var.
cannam@140 8944 rpath=
cannam@140 8945 for dir in $finalize_perm_rpath; do
cannam@140 8946 func_append rpath "$dir:"
cannam@140 8947 done
cannam@140 8948 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
cannam@140 8949 fi
cannam@140 8950 fi
cannam@140 8951
cannam@140 8952 if test "$no_install" = yes; then
cannam@140 8953 # We don't need to create a wrapper script.
cannam@140 8954 link_command="$compile_var$compile_command$compile_rpath"
cannam@140 8955 # Replace the output file specification.
cannam@140 8956 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
cannam@140 8957 # Delete the old output file.
cannam@140 8958 $opt_dry_run || $RM $output
cannam@140 8959 # Link the executable and exit
cannam@140 8960 func_show_eval "$link_command" 'exit $?'
cannam@140 8961
cannam@140 8962 if test -n "$postlink_cmds"; then
cannam@140 8963 func_to_tool_file "$output"
cannam@140 8964 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
cannam@140 8965 func_execute_cmds "$postlink_cmds" 'exit $?'
cannam@140 8966 fi
cannam@140 8967
cannam@140 8968 exit $EXIT_SUCCESS
cannam@140 8969 fi
cannam@140 8970
cannam@140 8971 if test "$hardcode_action" = relink; then
cannam@140 8972 # Fast installation is not supported
cannam@140 8973 link_command="$compile_var$compile_command$compile_rpath"
cannam@140 8974 relink_command="$finalize_var$finalize_command$finalize_rpath"
cannam@140 8975
cannam@140 8976 func_warning "this platform does not like uninstalled shared libraries"
cannam@140 8977 func_warning "\`$output' will be relinked during installation"
cannam@140 8978 else
cannam@140 8979 if test "$fast_install" != no; then
cannam@140 8980 link_command="$finalize_var$compile_command$finalize_rpath"
cannam@140 8981 if test "$fast_install" = yes; then
cannam@140 8982 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
cannam@140 8983 else
cannam@140 8984 # fast_install is set to needless
cannam@140 8985 relink_command=
cannam@140 8986 fi
cannam@140 8987 else
cannam@140 8988 link_command="$compile_var$compile_command$compile_rpath"
cannam@140 8989 relink_command="$finalize_var$finalize_command$finalize_rpath"
cannam@140 8990 fi
cannam@140 8991 fi
cannam@140 8992
cannam@140 8993 # Replace the output file specification.
cannam@140 8994 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
cannam@140 8995
cannam@140 8996 # Delete the old output files.
cannam@140 8997 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
cannam@140 8998
cannam@140 8999 func_show_eval "$link_command" 'exit $?'
cannam@140 9000
cannam@140 9001 if test -n "$postlink_cmds"; then
cannam@140 9002 func_to_tool_file "$output_objdir/$outputname"
cannam@140 9003 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
cannam@140 9004 func_execute_cmds "$postlink_cmds" 'exit $?'
cannam@140 9005 fi
cannam@140 9006
cannam@140 9007 # Now create the wrapper script.
cannam@140 9008 func_verbose "creating $output"
cannam@140 9009
cannam@140 9010 # Quote the relink command for shipping.
cannam@140 9011 if test -n "$relink_command"; then
cannam@140 9012 # Preserve any variables that may affect compiler behavior
cannam@140 9013 for var in $variables_saved_for_relink; do
cannam@140 9014 if eval test -z \"\${$var+set}\"; then
cannam@140 9015 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
cannam@140 9016 elif eval var_value=\$$var; test -z "$var_value"; then
cannam@140 9017 relink_command="$var=; export $var; $relink_command"
cannam@140 9018 else
cannam@140 9019 func_quote_for_eval "$var_value"
cannam@140 9020 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
cannam@140 9021 fi
cannam@140 9022 done
cannam@140 9023 relink_command="(cd `pwd`; $relink_command)"
cannam@140 9024 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
cannam@140 9025 fi
cannam@140 9026
cannam@140 9027 # Only actually do things if not in dry run mode.
cannam@140 9028 $opt_dry_run || {
cannam@140 9029 # win32 will think the script is a binary if it has
cannam@140 9030 # a .exe suffix, so we strip it off here.
cannam@140 9031 case $output in
cannam@140 9032 *.exe) func_stripname '' '.exe' "$output"
cannam@140 9033 output=$func_stripname_result ;;
cannam@140 9034 esac
cannam@140 9035 # test for cygwin because mv fails w/o .exe extensions
cannam@140 9036 case $host in
cannam@140 9037 *cygwin*)
cannam@140 9038 exeext=.exe
cannam@140 9039 func_stripname '' '.exe' "$outputname"
cannam@140 9040 outputname=$func_stripname_result ;;
cannam@140 9041 *) exeext= ;;
cannam@140 9042 esac
cannam@140 9043 case $host in
cannam@140 9044 *cygwin* | *mingw* )
cannam@140 9045 func_dirname_and_basename "$output" "" "."
cannam@140 9046 output_name=$func_basename_result
cannam@140 9047 output_path=$func_dirname_result
cannam@140 9048 cwrappersource="$output_path/$objdir/lt-$output_name.c"
cannam@140 9049 cwrapper="$output_path/$output_name.exe"
cannam@140 9050 $RM $cwrappersource $cwrapper
cannam@140 9051 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
cannam@140 9052
cannam@140 9053 func_emit_cwrapperexe_src > $cwrappersource
cannam@140 9054
cannam@140 9055 # The wrapper executable is built using the $host compiler,
cannam@140 9056 # because it contains $host paths and files. If cross-
cannam@140 9057 # compiling, it, like the target executable, must be
cannam@140 9058 # executed on the $host or under an emulation environment.
cannam@140 9059 $opt_dry_run || {
cannam@140 9060 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
cannam@140 9061 $STRIP $cwrapper
cannam@140 9062 }
cannam@140 9063
cannam@140 9064 # Now, create the wrapper script for func_source use:
cannam@140 9065 func_ltwrapper_scriptname $cwrapper
cannam@140 9066 $RM $func_ltwrapper_scriptname_result
cannam@140 9067 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
cannam@140 9068 $opt_dry_run || {
cannam@140 9069 # note: this script will not be executed, so do not chmod.
cannam@140 9070 if test "x$build" = "x$host" ; then
cannam@140 9071 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
cannam@140 9072 else
cannam@140 9073 func_emit_wrapper no > $func_ltwrapper_scriptname_result
cannam@140 9074 fi
cannam@140 9075 }
cannam@140 9076 ;;
cannam@140 9077 * )
cannam@140 9078 $RM $output
cannam@140 9079 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
cannam@140 9080
cannam@140 9081 func_emit_wrapper no > $output
cannam@140 9082 chmod +x $output
cannam@140 9083 ;;
cannam@140 9084 esac
cannam@140 9085 }
cannam@140 9086 exit $EXIT_SUCCESS
cannam@140 9087 ;;
cannam@140 9088 esac
cannam@140 9089
cannam@140 9090 # See if we need to build an old-fashioned archive.
cannam@140 9091 for oldlib in $oldlibs; do
cannam@140 9092
cannam@140 9093 if test "$build_libtool_libs" = convenience; then
cannam@140 9094 oldobjs="$libobjs_save $symfileobj"
cannam@140 9095 addlibs="$convenience"
cannam@140 9096 build_libtool_libs=no
cannam@140 9097 else
cannam@140 9098 if test "$build_libtool_libs" = module; then
cannam@140 9099 oldobjs="$libobjs_save"
cannam@140 9100 build_libtool_libs=no
cannam@140 9101 else
cannam@140 9102 oldobjs="$old_deplibs $non_pic_objects"
cannam@140 9103 if test "$preload" = yes && test -f "$symfileobj"; then
cannam@140 9104 func_append oldobjs " $symfileobj"
cannam@140 9105 fi
cannam@140 9106 fi
cannam@140 9107 addlibs="$old_convenience"
cannam@140 9108 fi
cannam@140 9109
cannam@140 9110 if test -n "$addlibs"; then
cannam@140 9111 gentop="$output_objdir/${outputname}x"
cannam@140 9112 func_append generated " $gentop"
cannam@140 9113
cannam@140 9114 func_extract_archives $gentop $addlibs
cannam@140 9115 func_append oldobjs " $func_extract_archives_result"
cannam@140 9116 fi
cannam@140 9117
cannam@140 9118 # Do each command in the archive commands.
cannam@140 9119 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
cannam@140 9120 cmds=$old_archive_from_new_cmds
cannam@140 9121 else
cannam@140 9122
cannam@140 9123 # Add any objects from preloaded convenience libraries
cannam@140 9124 if test -n "$dlprefiles"; then
cannam@140 9125 gentop="$output_objdir/${outputname}x"
cannam@140 9126 func_append generated " $gentop"
cannam@140 9127
cannam@140 9128 func_extract_archives $gentop $dlprefiles
cannam@140 9129 func_append oldobjs " $func_extract_archives_result"
cannam@140 9130 fi
cannam@140 9131
cannam@140 9132 # POSIX demands no paths to be encoded in archives. We have
cannam@140 9133 # to avoid creating archives with duplicate basenames if we
cannam@140 9134 # might have to extract them afterwards, e.g., when creating a
cannam@140 9135 # static archive out of a convenience library, or when linking
cannam@140 9136 # the entirety of a libtool archive into another (currently
cannam@140 9137 # not supported by libtool).
cannam@140 9138 if (for obj in $oldobjs
cannam@140 9139 do
cannam@140 9140 func_basename "$obj"
cannam@140 9141 $ECHO "$func_basename_result"
cannam@140 9142 done | sort | sort -uc >/dev/null 2>&1); then
cannam@140 9143 :
cannam@140 9144 else
cannam@140 9145 echo "copying selected object files to avoid basename conflicts..."
cannam@140 9146 gentop="$output_objdir/${outputname}x"
cannam@140 9147 func_append generated " $gentop"
cannam@140 9148 func_mkdir_p "$gentop"
cannam@140 9149 save_oldobjs=$oldobjs
cannam@140 9150 oldobjs=
cannam@140 9151 counter=1
cannam@140 9152 for obj in $save_oldobjs
cannam@140 9153 do
cannam@140 9154 func_basename "$obj"
cannam@140 9155 objbase="$func_basename_result"
cannam@140 9156 case " $oldobjs " in
cannam@140 9157 " ") oldobjs=$obj ;;
cannam@140 9158 *[\ /]"$objbase "*)
cannam@140 9159 while :; do
cannam@140 9160 # Make sure we don't pick an alternate name that also
cannam@140 9161 # overlaps.
cannam@140 9162 newobj=lt$counter-$objbase
cannam@140 9163 func_arith $counter + 1
cannam@140 9164 counter=$func_arith_result
cannam@140 9165 case " $oldobjs " in
cannam@140 9166 *[\ /]"$newobj "*) ;;
cannam@140 9167 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
cannam@140 9168 esac
cannam@140 9169 done
cannam@140 9170 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
cannam@140 9171 func_append oldobjs " $gentop/$newobj"
cannam@140 9172 ;;
cannam@140 9173 *) func_append oldobjs " $obj" ;;
cannam@140 9174 esac
cannam@140 9175 done
cannam@140 9176 fi
cannam@140 9177 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
cannam@140 9178 tool_oldlib=$func_to_tool_file_result
cannam@140 9179 eval cmds=\"$old_archive_cmds\"
cannam@140 9180
cannam@140 9181 func_len " $cmds"
cannam@140 9182 len=$func_len_result
cannam@140 9183 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
cannam@140 9184 cmds=$old_archive_cmds
cannam@140 9185 elif test -n "$archiver_list_spec"; then
cannam@140 9186 func_verbose "using command file archive linking..."
cannam@140 9187 for obj in $oldobjs
cannam@140 9188 do
cannam@140 9189 func_to_tool_file "$obj"
cannam@140 9190 $ECHO "$func_to_tool_file_result"
cannam@140 9191 done > $output_objdir/$libname.libcmd
cannam@140 9192 func_to_tool_file "$output_objdir/$libname.libcmd"
cannam@140 9193 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
cannam@140 9194 cmds=$old_archive_cmds
cannam@140 9195 else
cannam@140 9196 # the command line is too long to link in one step, link in parts
cannam@140 9197 func_verbose "using piecewise archive linking..."
cannam@140 9198 save_RANLIB=$RANLIB
cannam@140 9199 RANLIB=:
cannam@140 9200 objlist=
cannam@140 9201 concat_cmds=
cannam@140 9202 save_oldobjs=$oldobjs
cannam@140 9203 oldobjs=
cannam@140 9204 # Is there a better way of finding the last object in the list?
cannam@140 9205 for obj in $save_oldobjs
cannam@140 9206 do
cannam@140 9207 last_oldobj=$obj
cannam@140 9208 done
cannam@140 9209 eval test_cmds=\"$old_archive_cmds\"
cannam@140 9210 func_len " $test_cmds"
cannam@140 9211 len0=$func_len_result
cannam@140 9212 len=$len0
cannam@140 9213 for obj in $save_oldobjs
cannam@140 9214 do
cannam@140 9215 func_len " $obj"
cannam@140 9216 func_arith $len + $func_len_result
cannam@140 9217 len=$func_arith_result
cannam@140 9218 func_append objlist " $obj"
cannam@140 9219 if test "$len" -lt "$max_cmd_len"; then
cannam@140 9220 :
cannam@140 9221 else
cannam@140 9222 # the above command should be used before it gets too long
cannam@140 9223 oldobjs=$objlist
cannam@140 9224 if test "$obj" = "$last_oldobj" ; then
cannam@140 9225 RANLIB=$save_RANLIB
cannam@140 9226 fi
cannam@140 9227 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
cannam@140 9228 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
cannam@140 9229 objlist=
cannam@140 9230 len=$len0
cannam@140 9231 fi
cannam@140 9232 done
cannam@140 9233 RANLIB=$save_RANLIB
cannam@140 9234 oldobjs=$objlist
cannam@140 9235 if test "X$oldobjs" = "X" ; then
cannam@140 9236 eval cmds=\"\$concat_cmds\"
cannam@140 9237 else
cannam@140 9238 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
cannam@140 9239 fi
cannam@140 9240 fi
cannam@140 9241 fi
cannam@140 9242 func_execute_cmds "$cmds" 'exit $?'
cannam@140 9243 done
cannam@140 9244
cannam@140 9245 test -n "$generated" && \
cannam@140 9246 func_show_eval "${RM}r$generated"
cannam@140 9247
cannam@140 9248 # Now create the libtool archive.
cannam@140 9249 case $output in
cannam@140 9250 *.la)
cannam@140 9251 old_library=
cannam@140 9252 test "$build_old_libs" = yes && old_library="$libname.$libext"
cannam@140 9253 func_verbose "creating $output"
cannam@140 9254
cannam@140 9255 # Preserve any variables that may affect compiler behavior
cannam@140 9256 for var in $variables_saved_for_relink; do
cannam@140 9257 if eval test -z \"\${$var+set}\"; then
cannam@140 9258 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
cannam@140 9259 elif eval var_value=\$$var; test -z "$var_value"; then
cannam@140 9260 relink_command="$var=; export $var; $relink_command"
cannam@140 9261 else
cannam@140 9262 func_quote_for_eval "$var_value"
cannam@140 9263 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
cannam@140 9264 fi
cannam@140 9265 done
cannam@140 9266 # Quote the link command for shipping.
cannam@140 9267 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
cannam@140 9268 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
cannam@140 9269 if test "$hardcode_automatic" = yes ; then
cannam@140 9270 relink_command=
cannam@140 9271 fi
cannam@140 9272
cannam@140 9273 # Only create the output if not a dry run.
cannam@140 9274 $opt_dry_run || {
cannam@140 9275 for installed in no yes; do
cannam@140 9276 if test "$installed" = yes; then
cannam@140 9277 if test -z "$install_libdir"; then
cannam@140 9278 break
cannam@140 9279 fi
cannam@140 9280 output="$output_objdir/$outputname"i
cannam@140 9281 # Replace all uninstalled libtool libraries with the installed ones
cannam@140 9282 newdependency_libs=
cannam@140 9283 for deplib in $dependency_libs; do
cannam@140 9284 case $deplib in
cannam@140 9285 *.la)
cannam@140 9286 func_basename "$deplib"
cannam@140 9287 name="$func_basename_result"
cannam@140 9288 func_resolve_sysroot "$deplib"
cannam@140 9289 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
cannam@140 9290 test -z "$libdir" && \
cannam@140 9291 func_fatal_error "\`$deplib' is not a valid libtool archive"
cannam@140 9292 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
cannam@140 9293 ;;
cannam@140 9294 -L*)
cannam@140 9295 func_stripname -L '' "$deplib"
cannam@140 9296 func_replace_sysroot "$func_stripname_result"
cannam@140 9297 func_append newdependency_libs " -L$func_replace_sysroot_result"
cannam@140 9298 ;;
cannam@140 9299 -R*)
cannam@140 9300 func_stripname -R '' "$deplib"
cannam@140 9301 func_replace_sysroot "$func_stripname_result"
cannam@140 9302 func_append newdependency_libs " -R$func_replace_sysroot_result"
cannam@140 9303 ;;
cannam@140 9304 *) func_append newdependency_libs " $deplib" ;;
cannam@140 9305 esac
cannam@140 9306 done
cannam@140 9307 dependency_libs="$newdependency_libs"
cannam@140 9308 newdlfiles=
cannam@140 9309
cannam@140 9310 for lib in $dlfiles; do
cannam@140 9311 case $lib in
cannam@140 9312 *.la)
cannam@140 9313 func_basename "$lib"
cannam@140 9314 name="$func_basename_result"
cannam@140 9315 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
cannam@140 9316 test -z "$libdir" && \
cannam@140 9317 func_fatal_error "\`$lib' is not a valid libtool archive"
cannam@140 9318 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
cannam@140 9319 ;;
cannam@140 9320 *) func_append newdlfiles " $lib" ;;
cannam@140 9321 esac
cannam@140 9322 done
cannam@140 9323 dlfiles="$newdlfiles"
cannam@140 9324 newdlprefiles=
cannam@140 9325 for lib in $dlprefiles; do
cannam@140 9326 case $lib in
cannam@140 9327 *.la)
cannam@140 9328 # Only pass preopened files to the pseudo-archive (for
cannam@140 9329 # eventual linking with the app. that links it) if we
cannam@140 9330 # didn't already link the preopened objects directly into
cannam@140 9331 # the library:
cannam@140 9332 func_basename "$lib"
cannam@140 9333 name="$func_basename_result"
cannam@140 9334 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
cannam@140 9335 test -z "$libdir" && \
cannam@140 9336 func_fatal_error "\`$lib' is not a valid libtool archive"
cannam@140 9337 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
cannam@140 9338 ;;
cannam@140 9339 esac
cannam@140 9340 done
cannam@140 9341 dlprefiles="$newdlprefiles"
cannam@140 9342 else
cannam@140 9343 newdlfiles=
cannam@140 9344 for lib in $dlfiles; do
cannam@140 9345 case $lib in
cannam@140 9346 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
cannam@140 9347 *) abs=`pwd`"/$lib" ;;
cannam@140 9348 esac
cannam@140 9349 func_append newdlfiles " $abs"
cannam@140 9350 done
cannam@140 9351 dlfiles="$newdlfiles"
cannam@140 9352 newdlprefiles=
cannam@140 9353 for lib in $dlprefiles; do
cannam@140 9354 case $lib in
cannam@140 9355 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
cannam@140 9356 *) abs=`pwd`"/$lib" ;;
cannam@140 9357 esac
cannam@140 9358 func_append newdlprefiles " $abs"
cannam@140 9359 done
cannam@140 9360 dlprefiles="$newdlprefiles"
cannam@140 9361 fi
cannam@140 9362 $RM $output
cannam@140 9363 # place dlname in correct position for cygwin
cannam@140 9364 # In fact, it would be nice if we could use this code for all target
cannam@140 9365 # systems that can't hard-code library paths into their executables
cannam@140 9366 # and that have no shared library path variable independent of PATH,
cannam@140 9367 # but it turns out we can't easily determine that from inspecting
cannam@140 9368 # libtool variables, so we have to hard-code the OSs to which it
cannam@140 9369 # applies here; at the moment, that means platforms that use the PE
cannam@140 9370 # object format with DLL files. See the long comment at the top of
cannam@140 9371 # tests/bindir.at for full details.
cannam@140 9372 tdlname=$dlname
cannam@140 9373 case $host,$output,$installed,$module,$dlname in
cannam@140 9374 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
cannam@140 9375 # If a -bindir argument was supplied, place the dll there.
cannam@140 9376 if test "x$bindir" != x ;
cannam@140 9377 then
cannam@140 9378 func_relative_path "$install_libdir" "$bindir"
cannam@140 9379 tdlname=$func_relative_path_result$dlname
cannam@140 9380 else
cannam@140 9381 # Otherwise fall back on heuristic.
cannam@140 9382 tdlname=../bin/$dlname
cannam@140 9383 fi
cannam@140 9384 ;;
cannam@140 9385 esac
cannam@140 9386 $ECHO > $output "\
cannam@140 9387 # $outputname - a libtool library file
cannam@140 9388 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
cannam@140 9389 #
cannam@140 9390 # Please DO NOT delete this file!
cannam@140 9391 # It is necessary for linking the library.
cannam@140 9392
cannam@140 9393 # The name that we can dlopen(3).
cannam@140 9394 dlname='$tdlname'
cannam@140 9395
cannam@140 9396 # Names of this library.
cannam@140 9397 library_names='$library_names'
cannam@140 9398
cannam@140 9399 # The name of the static archive.
cannam@140 9400 old_library='$old_library'
cannam@140 9401
cannam@140 9402 # Linker flags that can not go in dependency_libs.
cannam@140 9403 inherited_linker_flags='$new_inherited_linker_flags'
cannam@140 9404
cannam@140 9405 # Libraries that this one depends upon.
cannam@140 9406 dependency_libs='$dependency_libs'
cannam@140 9407
cannam@140 9408 # Names of additional weak libraries provided by this library
cannam@140 9409 weak_library_names='$weak_libs'
cannam@140 9410
cannam@140 9411 # Version information for $libname.
cannam@140 9412 current=$current
cannam@140 9413 age=$age
cannam@140 9414 revision=$revision
cannam@140 9415
cannam@140 9416 # Is this an already installed library?
cannam@140 9417 installed=$installed
cannam@140 9418
cannam@140 9419 # Should we warn about portability when linking against -modules?
cannam@140 9420 shouldnotlink=$module
cannam@140 9421
cannam@140 9422 # Files to dlopen/dlpreopen
cannam@140 9423 dlopen='$dlfiles'
cannam@140 9424 dlpreopen='$dlprefiles'
cannam@140 9425
cannam@140 9426 # Directory that this library needs to be installed in:
cannam@140 9427 libdir='$install_libdir'"
cannam@140 9428 if test "$installed" = no && test "$need_relink" = yes; then
cannam@140 9429 $ECHO >> $output "\
cannam@140 9430 relink_command=\"$relink_command\""
cannam@140 9431 fi
cannam@140 9432 done
cannam@140 9433 }
cannam@140 9434
cannam@140 9435 # Do a symbolic link so that the libtool archive can be found in
cannam@140 9436 # LD_LIBRARY_PATH before the program is installed.
cannam@140 9437 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
cannam@140 9438 ;;
cannam@140 9439 esac
cannam@140 9440 exit $EXIT_SUCCESS
cannam@140 9441 }
cannam@140 9442
cannam@140 9443 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
cannam@140 9444 func_mode_link ${1+"$@"}
cannam@140 9445
cannam@140 9446
cannam@140 9447 # func_mode_uninstall arg...
cannam@140 9448 func_mode_uninstall ()
cannam@140 9449 {
cannam@140 9450 $opt_debug
cannam@140 9451 RM="$nonopt"
cannam@140 9452 files=
cannam@140 9453 rmforce=
cannam@140 9454 exit_status=0
cannam@140 9455
cannam@140 9456 # This variable tells wrapper scripts just to set variables rather
cannam@140 9457 # than running their programs.
cannam@140 9458 libtool_install_magic="$magic"
cannam@140 9459
cannam@140 9460 for arg
cannam@140 9461 do
cannam@140 9462 case $arg in
cannam@140 9463 -f) func_append RM " $arg"; rmforce=yes ;;
cannam@140 9464 -*) func_append RM " $arg" ;;
cannam@140 9465 *) func_append files " $arg" ;;
cannam@140 9466 esac
cannam@140 9467 done
cannam@140 9468
cannam@140 9469 test -z "$RM" && \
cannam@140 9470 func_fatal_help "you must specify an RM program"
cannam@140 9471
cannam@140 9472 rmdirs=
cannam@140 9473
cannam@140 9474 for file in $files; do
cannam@140 9475 func_dirname "$file" "" "."
cannam@140 9476 dir="$func_dirname_result"
cannam@140 9477 if test "X$dir" = X.; then
cannam@140 9478 odir="$objdir"
cannam@140 9479 else
cannam@140 9480 odir="$dir/$objdir"
cannam@140 9481 fi
cannam@140 9482 func_basename "$file"
cannam@140 9483 name="$func_basename_result"
cannam@140 9484 test "$opt_mode" = uninstall && odir="$dir"
cannam@140 9485
cannam@140 9486 # Remember odir for removal later, being careful to avoid duplicates
cannam@140 9487 if test "$opt_mode" = clean; then
cannam@140 9488 case " $rmdirs " in
cannam@140 9489 *" $odir "*) ;;
cannam@140 9490 *) func_append rmdirs " $odir" ;;
cannam@140 9491 esac
cannam@140 9492 fi
cannam@140 9493
cannam@140 9494 # Don't error if the file doesn't exist and rm -f was used.
cannam@140 9495 if { test -L "$file"; } >/dev/null 2>&1 ||
cannam@140 9496 { test -h "$file"; } >/dev/null 2>&1 ||
cannam@140 9497 test -f "$file"; then
cannam@140 9498 :
cannam@140 9499 elif test -d "$file"; then
cannam@140 9500 exit_status=1
cannam@140 9501 continue
cannam@140 9502 elif test "$rmforce" = yes; then
cannam@140 9503 continue
cannam@140 9504 fi
cannam@140 9505
cannam@140 9506 rmfiles="$file"
cannam@140 9507
cannam@140 9508 case $name in
cannam@140 9509 *.la)
cannam@140 9510 # Possibly a libtool archive, so verify it.
cannam@140 9511 if func_lalib_p "$file"; then
cannam@140 9512 func_source $dir/$name
cannam@140 9513
cannam@140 9514 # Delete the libtool libraries and symlinks.
cannam@140 9515 for n in $library_names; do
cannam@140 9516 func_append rmfiles " $odir/$n"
cannam@140 9517 done
cannam@140 9518 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
cannam@140 9519
cannam@140 9520 case "$opt_mode" in
cannam@140 9521 clean)
cannam@140 9522 case " $library_names " in
cannam@140 9523 *" $dlname "*) ;;
cannam@140 9524 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
cannam@140 9525 esac
cannam@140 9526 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
cannam@140 9527 ;;
cannam@140 9528 uninstall)
cannam@140 9529 if test -n "$library_names"; then
cannam@140 9530 # Do each command in the postuninstall commands.
cannam@140 9531 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
cannam@140 9532 fi
cannam@140 9533
cannam@140 9534 if test -n "$old_library"; then
cannam@140 9535 # Do each command in the old_postuninstall commands.
cannam@140 9536 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
cannam@140 9537 fi
cannam@140 9538 # FIXME: should reinstall the best remaining shared library.
cannam@140 9539 ;;
cannam@140 9540 esac
cannam@140 9541 fi
cannam@140 9542 ;;
cannam@140 9543
cannam@140 9544 *.lo)
cannam@140 9545 # Possibly a libtool object, so verify it.
cannam@140 9546 if func_lalib_p "$file"; then
cannam@140 9547
cannam@140 9548 # Read the .lo file
cannam@140 9549 func_source $dir/$name
cannam@140 9550
cannam@140 9551 # Add PIC object to the list of files to remove.
cannam@140 9552 if test -n "$pic_object" &&
cannam@140 9553 test "$pic_object" != none; then
cannam@140 9554 func_append rmfiles " $dir/$pic_object"
cannam@140 9555 fi
cannam@140 9556
cannam@140 9557 # Add non-PIC object to the list of files to remove.
cannam@140 9558 if test -n "$non_pic_object" &&
cannam@140 9559 test "$non_pic_object" != none; then
cannam@140 9560 func_append rmfiles " $dir/$non_pic_object"
cannam@140 9561 fi
cannam@140 9562 fi
cannam@140 9563 ;;
cannam@140 9564
cannam@140 9565 *)
cannam@140 9566 if test "$opt_mode" = clean ; then
cannam@140 9567 noexename=$name
cannam@140 9568 case $file in
cannam@140 9569 *.exe)
cannam@140 9570 func_stripname '' '.exe' "$file"
cannam@140 9571 file=$func_stripname_result
cannam@140 9572 func_stripname '' '.exe' "$name"
cannam@140 9573 noexename=$func_stripname_result
cannam@140 9574 # $file with .exe has already been added to rmfiles,
cannam@140 9575 # add $file without .exe
cannam@140 9576 func_append rmfiles " $file"
cannam@140 9577 ;;
cannam@140 9578 esac
cannam@140 9579 # Do a test to see if this is a libtool program.
cannam@140 9580 if func_ltwrapper_p "$file"; then
cannam@140 9581 if func_ltwrapper_executable_p "$file"; then
cannam@140 9582 func_ltwrapper_scriptname "$file"
cannam@140 9583 relink_command=
cannam@140 9584 func_source $func_ltwrapper_scriptname_result
cannam@140 9585 func_append rmfiles " $func_ltwrapper_scriptname_result"
cannam@140 9586 else
cannam@140 9587 relink_command=
cannam@140 9588 func_source $dir/$noexename
cannam@140 9589 fi
cannam@140 9590
cannam@140 9591 # note $name still contains .exe if it was in $file originally
cannam@140 9592 # as does the version of $file that was added into $rmfiles
cannam@140 9593 func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
cannam@140 9594 if test "$fast_install" = yes && test -n "$relink_command"; then
cannam@140 9595 func_append rmfiles " $odir/lt-$name"
cannam@140 9596 fi
cannam@140 9597 if test "X$noexename" != "X$name" ; then
cannam@140 9598 func_append rmfiles " $odir/lt-${noexename}.c"
cannam@140 9599 fi
cannam@140 9600 fi
cannam@140 9601 fi
cannam@140 9602 ;;
cannam@140 9603 esac
cannam@140 9604 func_show_eval "$RM $rmfiles" 'exit_status=1'
cannam@140 9605 done
cannam@140 9606
cannam@140 9607 # Try to remove the ${objdir}s in the directories where we deleted files
cannam@140 9608 for dir in $rmdirs; do
cannam@140 9609 if test -d "$dir"; then
cannam@140 9610 func_show_eval "rmdir $dir >/dev/null 2>&1"
cannam@140 9611 fi
cannam@140 9612 done
cannam@140 9613
cannam@140 9614 exit $exit_status
cannam@140 9615 }
cannam@140 9616
cannam@140 9617 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
cannam@140 9618 func_mode_uninstall ${1+"$@"}
cannam@140 9619
cannam@140 9620 test -z "$opt_mode" && {
cannam@140 9621 help="$generic_help"
cannam@140 9622 func_fatal_help "you must specify a MODE"
cannam@140 9623 }
cannam@140 9624
cannam@140 9625 test -z "$exec_cmd" && \
cannam@140 9626 func_fatal_help "invalid operation mode \`$opt_mode'"
cannam@140 9627
cannam@140 9628 if test -n "$exec_cmd"; then
cannam@140 9629 eval exec "$exec_cmd"
cannam@140 9630 exit $EXIT_FAILURE
cannam@140 9631 fi
cannam@140 9632
cannam@140 9633 exit $exit_status
cannam@140 9634
cannam@140 9635
cannam@140 9636 # The TAGs below are defined such that we never get into a situation
cannam@140 9637 # in which we disable both kinds of libraries. Given conflicting
cannam@140 9638 # choices, we go for a static library, that is the most portable,
cannam@140 9639 # since we can't tell whether shared libraries were disabled because
cannam@140 9640 # the user asked for that or because the platform doesn't support
cannam@140 9641 # them. This is particularly important on AIX, because we don't
cannam@140 9642 # support having both static and shared libraries enabled at the same
cannam@140 9643 # time on that platform, so we default to a shared-only configuration.
cannam@140 9644 # If a disable-shared tag is given, we'll fallback to a static-only
cannam@140 9645 # configuration. But we'll never go from static-only to shared-only.
cannam@140 9646
cannam@140 9647 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
cannam@140 9648 build_libtool_libs=no
cannam@140 9649 build_old_libs=yes
cannam@140 9650 # ### END LIBTOOL TAG CONFIG: disable-shared
cannam@140 9651
cannam@140 9652 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
cannam@140 9653 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
cannam@140 9654 # ### END LIBTOOL TAG CONFIG: disable-static
cannam@140 9655
cannam@140 9656 # Local Variables:
cannam@140 9657 # mode:shell-script
cannam@140 9658 # sh-indentation:2
cannam@140 9659 # End:
cannam@140 9660 # vi:sw=2
cannam@140 9661