annotate src/portaudio_20161030_catalina_patch/ltmain.sh @ 167:bd3cc4d1df30

Add FFTW 3.3.8 source, and a Linux build
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 19 Nov 2019 14:52:55 +0000
parents d43aab368df9
children
rev   line source
cannam@162 1
cannam@162 2 # libtool (GNU libtool) 2.4.2
cannam@162 3 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
cannam@162 4
cannam@162 5 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
cannam@162 6 # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
cannam@162 7 # This is free software; see the source for copying conditions. There is NO
cannam@162 8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
cannam@162 9
cannam@162 10 # GNU Libtool is free software; you can redistribute it and/or modify
cannam@162 11 # it under the terms of the GNU General Public License as published by
cannam@162 12 # the Free Software Foundation; either version 2 of the License, or
cannam@162 13 # (at your option) any later version.
cannam@162 14 #
cannam@162 15 # As a special exception to the GNU General Public License,
cannam@162 16 # if you distribute this file as part of a program or library that
cannam@162 17 # is built using GNU Libtool, you may include this file under the
cannam@162 18 # same distribution terms that you use for the rest of that program.
cannam@162 19 #
cannam@162 20 # GNU Libtool is distributed in the hope that it will be useful, but
cannam@162 21 # WITHOUT ANY WARRANTY; without even the implied warranty of
cannam@162 22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cannam@162 23 # General Public License for more details.
cannam@162 24 #
cannam@162 25 # You should have received a copy of the GNU General Public License
cannam@162 26 # along with GNU Libtool; see the file COPYING. If not, a copy
cannam@162 27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
cannam@162 28 # or obtained by writing to the Free Software Foundation, Inc.,
cannam@162 29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
cannam@162 30
cannam@162 31 # Usage: $progname [OPTION]... [MODE-ARG]...
cannam@162 32 #
cannam@162 33 # Provide generalized library-building support services.
cannam@162 34 #
cannam@162 35 # --config show all configuration variables
cannam@162 36 # --debug enable verbose shell tracing
cannam@162 37 # -n, --dry-run display commands without modifying any files
cannam@162 38 # --features display basic configuration information and exit
cannam@162 39 # --mode=MODE use operation mode MODE
cannam@162 40 # --preserve-dup-deps don't remove duplicate dependency libraries
cannam@162 41 # --quiet, --silent don't print informational messages
cannam@162 42 # --no-quiet, --no-silent
cannam@162 43 # print informational messages (default)
cannam@162 44 # --no-warn don't display warning messages
cannam@162 45 # --tag=TAG use configuration variables from tag TAG
cannam@162 46 # -v, --verbose print more informational messages than default
cannam@162 47 # --no-verbose don't print the extra informational messages
cannam@162 48 # --version print version information
cannam@162 49 # -h, --help, --help-all print short, long, or detailed help message
cannam@162 50 #
cannam@162 51 # MODE must be one of the following:
cannam@162 52 #
cannam@162 53 # clean remove files from the build directory
cannam@162 54 # compile compile a source file into a libtool object
cannam@162 55 # execute automatically set library path, then run a program
cannam@162 56 # finish complete the installation of libtool libraries
cannam@162 57 # install install libraries or executables
cannam@162 58 # link create a library or an executable
cannam@162 59 # uninstall remove libraries from an installed directory
cannam@162 60 #
cannam@162 61 # MODE-ARGS vary depending on the MODE. When passed as first option,
cannam@162 62 # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
cannam@162 63 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
cannam@162 64 #
cannam@162 65 # When reporting a bug, please describe a test case to reproduce it and
cannam@162 66 # include the following information:
cannam@162 67 #
cannam@162 68 # host-triplet: $host
cannam@162 69 # shell: $SHELL
cannam@162 70 # compiler: $LTCC
cannam@162 71 # compiler flags: $LTCFLAGS
cannam@162 72 # linker: $LD (gnu? $with_gnu_ld)
cannam@162 73 # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1
cannam@162 74 # automake: $automake_version
cannam@162 75 # autoconf: $autoconf_version
cannam@162 76 #
cannam@162 77 # Report bugs to <bug-libtool@gnu.org>.
cannam@162 78 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
cannam@162 79 # General help using GNU software: <http://www.gnu.org/gethelp/>.
cannam@162 80
cannam@162 81 PROGRAM=libtool
cannam@162 82 PACKAGE=libtool
cannam@162 83 VERSION="2.4.2 Debian-2.4.2-1.7ubuntu1"
cannam@162 84 TIMESTAMP=""
cannam@162 85 package_revision=1.3337
cannam@162 86
cannam@162 87 # Be Bourne compatible
cannam@162 88 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
cannam@162 89 emulate sh
cannam@162 90 NULLCMD=:
cannam@162 91 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
cannam@162 92 # is contrary to our usage. Disable this feature.
cannam@162 93 alias -g '${1+"$@"}'='"$@"'
cannam@162 94 setopt NO_GLOB_SUBST
cannam@162 95 else
cannam@162 96 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
cannam@162 97 fi
cannam@162 98 BIN_SH=xpg4; export BIN_SH # for Tru64
cannam@162 99 DUALCASE=1; export DUALCASE # for MKS sh
cannam@162 100
cannam@162 101 # A function that is used when there is no print builtin or printf.
cannam@162 102 func_fallback_echo ()
cannam@162 103 {
cannam@162 104 eval 'cat <<_LTECHO_EOF
cannam@162 105 $1
cannam@162 106 _LTECHO_EOF'
cannam@162 107 }
cannam@162 108
cannam@162 109 # NLS nuisances: We save the old values to restore during execute mode.
cannam@162 110 lt_user_locale=
cannam@162 111 lt_safe_locale=
cannam@162 112 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
cannam@162 113 do
cannam@162 114 eval "if test \"\${$lt_var+set}\" = set; then
cannam@162 115 save_$lt_var=\$$lt_var
cannam@162 116 $lt_var=C
cannam@162 117 export $lt_var
cannam@162 118 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
cannam@162 119 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
cannam@162 120 fi"
cannam@162 121 done
cannam@162 122 LC_ALL=C
cannam@162 123 LANGUAGE=C
cannam@162 124 export LANGUAGE LC_ALL
cannam@162 125
cannam@162 126 $lt_unset CDPATH
cannam@162 127
cannam@162 128
cannam@162 129 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
cannam@162 130 # is ksh but when the shell is invoked as "sh" and the current value of
cannam@162 131 # the _XPG environment variable is not equal to 1 (one), the special
cannam@162 132 # positional parameter $0, within a function call, is the name of the
cannam@162 133 # function.
cannam@162 134 progpath="$0"
cannam@162 135
cannam@162 136
cannam@162 137
cannam@162 138 : ${CP="cp -f"}
cannam@162 139 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
cannam@162 140 : ${MAKE="make"}
cannam@162 141 : ${MKDIR="mkdir"}
cannam@162 142 : ${MV="mv -f"}
cannam@162 143 : ${RM="rm -f"}
cannam@162 144 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
cannam@162 145 : ${Xsed="$SED -e 1s/^X//"}
cannam@162 146
cannam@162 147 # Global variables:
cannam@162 148 EXIT_SUCCESS=0
cannam@162 149 EXIT_FAILURE=1
cannam@162 150 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
cannam@162 151 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
cannam@162 152
cannam@162 153 exit_status=$EXIT_SUCCESS
cannam@162 154
cannam@162 155 # Make sure IFS has a sensible default
cannam@162 156 lt_nl='
cannam@162 157 '
cannam@162 158 IFS=" $lt_nl"
cannam@162 159
cannam@162 160 dirname="s,/[^/]*$,,"
cannam@162 161 basename="s,^.*/,,"
cannam@162 162
cannam@162 163 # func_dirname file append nondir_replacement
cannam@162 164 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
cannam@162 165 # otherwise set result to NONDIR_REPLACEMENT.
cannam@162 166 func_dirname ()
cannam@162 167 {
cannam@162 168 func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
cannam@162 169 if test "X$func_dirname_result" = "X${1}"; then
cannam@162 170 func_dirname_result="${3}"
cannam@162 171 else
cannam@162 172 func_dirname_result="$func_dirname_result${2}"
cannam@162 173 fi
cannam@162 174 } # func_dirname may be replaced by extended shell implementation
cannam@162 175
cannam@162 176
cannam@162 177 # func_basename file
cannam@162 178 func_basename ()
cannam@162 179 {
cannam@162 180 func_basename_result=`$ECHO "${1}" | $SED "$basename"`
cannam@162 181 } # func_basename may be replaced by extended shell implementation
cannam@162 182
cannam@162 183
cannam@162 184 # func_dirname_and_basename file append nondir_replacement
cannam@162 185 # perform func_basename and func_dirname in a single function
cannam@162 186 # call:
cannam@162 187 # dirname: Compute the dirname of FILE. If nonempty,
cannam@162 188 # add APPEND to the result, otherwise set result
cannam@162 189 # to NONDIR_REPLACEMENT.
cannam@162 190 # value returned in "$func_dirname_result"
cannam@162 191 # basename: Compute filename of FILE.
cannam@162 192 # value retuned in "$func_basename_result"
cannam@162 193 # Implementation must be kept synchronized with func_dirname
cannam@162 194 # and func_basename. For efficiency, we do not delegate to
cannam@162 195 # those functions but instead duplicate the functionality here.
cannam@162 196 func_dirname_and_basename ()
cannam@162 197 {
cannam@162 198 # Extract subdirectory from the argument.
cannam@162 199 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
cannam@162 200 if test "X$func_dirname_result" = "X${1}"; then
cannam@162 201 func_dirname_result="${3}"
cannam@162 202 else
cannam@162 203 func_dirname_result="$func_dirname_result${2}"
cannam@162 204 fi
cannam@162 205 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
cannam@162 206 } # func_dirname_and_basename may be replaced by extended shell implementation
cannam@162 207
cannam@162 208
cannam@162 209 # func_stripname prefix suffix name
cannam@162 210 # strip PREFIX and SUFFIX off of NAME.
cannam@162 211 # PREFIX and SUFFIX must not contain globbing or regex special
cannam@162 212 # characters, hashes, percent signs, but SUFFIX may contain a leading
cannam@162 213 # dot (in which case that matches only a dot).
cannam@162 214 # func_strip_suffix prefix name
cannam@162 215 func_stripname ()
cannam@162 216 {
cannam@162 217 case ${2} in
cannam@162 218 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
cannam@162 219 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
cannam@162 220 esac
cannam@162 221 } # func_stripname may be replaced by extended shell implementation
cannam@162 222
cannam@162 223
cannam@162 224 # These SED scripts presuppose an absolute path with a trailing slash.
cannam@162 225 pathcar='s,^/\([^/]*\).*$,\1,'
cannam@162 226 pathcdr='s,^/[^/]*,,'
cannam@162 227 removedotparts=':dotsl
cannam@162 228 s@/\./@/@g
cannam@162 229 t dotsl
cannam@162 230 s,/\.$,/,'
cannam@162 231 collapseslashes='s@/\{1,\}@/@g'
cannam@162 232 finalslash='s,/*$,/,'
cannam@162 233
cannam@162 234 # func_normal_abspath PATH
cannam@162 235 # Remove doubled-up and trailing slashes, "." path components,
cannam@162 236 # and cancel out any ".." path components in PATH after making
cannam@162 237 # it an absolute path.
cannam@162 238 # value returned in "$func_normal_abspath_result"
cannam@162 239 func_normal_abspath ()
cannam@162 240 {
cannam@162 241 # Start from root dir and reassemble the path.
cannam@162 242 func_normal_abspath_result=
cannam@162 243 func_normal_abspath_tpath=$1
cannam@162 244 func_normal_abspath_altnamespace=
cannam@162 245 case $func_normal_abspath_tpath in
cannam@162 246 "")
cannam@162 247 # Empty path, that just means $cwd.
cannam@162 248 func_stripname '' '/' "`pwd`"
cannam@162 249 func_normal_abspath_result=$func_stripname_result
cannam@162 250 return
cannam@162 251 ;;
cannam@162 252 # The next three entries are used to spot a run of precisely
cannam@162 253 # two leading slashes without using negated character classes;
cannam@162 254 # we take advantage of case's first-match behaviour.
cannam@162 255 ///*)
cannam@162 256 # Unusual form of absolute path, do nothing.
cannam@162 257 ;;
cannam@162 258 //*)
cannam@162 259 # Not necessarily an ordinary path; POSIX reserves leading '//'
cannam@162 260 # and for example Cygwin uses it to access remote file shares
cannam@162 261 # over CIFS/SMB, so we conserve a leading double slash if found.
cannam@162 262 func_normal_abspath_altnamespace=/
cannam@162 263 ;;
cannam@162 264 /*)
cannam@162 265 # Absolute path, do nothing.
cannam@162 266 ;;
cannam@162 267 *)
cannam@162 268 # Relative path, prepend $cwd.
cannam@162 269 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
cannam@162 270 ;;
cannam@162 271 esac
cannam@162 272 # Cancel out all the simple stuff to save iterations. We also want
cannam@162 273 # the path to end with a slash for ease of parsing, so make sure
cannam@162 274 # there is one (and only one) here.
cannam@162 275 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
cannam@162 276 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
cannam@162 277 while :; do
cannam@162 278 # Processed it all yet?
cannam@162 279 if test "$func_normal_abspath_tpath" = / ; then
cannam@162 280 # If we ascended to the root using ".." the result may be empty now.
cannam@162 281 if test -z "$func_normal_abspath_result" ; then
cannam@162 282 func_normal_abspath_result=/
cannam@162 283 fi
cannam@162 284 break
cannam@162 285 fi
cannam@162 286 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
cannam@162 287 -e "$pathcar"`
cannam@162 288 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
cannam@162 289 -e "$pathcdr"`
cannam@162 290 # Figure out what to do with it
cannam@162 291 case $func_normal_abspath_tcomponent in
cannam@162 292 "")
cannam@162 293 # Trailing empty path component, ignore it.
cannam@162 294 ;;
cannam@162 295 ..)
cannam@162 296 # Parent dir; strip last assembled component from result.
cannam@162 297 func_dirname "$func_normal_abspath_result"
cannam@162 298 func_normal_abspath_result=$func_dirname_result
cannam@162 299 ;;
cannam@162 300 *)
cannam@162 301 # Actual path component, append it.
cannam@162 302 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
cannam@162 303 ;;
cannam@162 304 esac
cannam@162 305 done
cannam@162 306 # Restore leading double-slash if one was found on entry.
cannam@162 307 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
cannam@162 308 }
cannam@162 309
cannam@162 310 # func_relative_path SRCDIR DSTDIR
cannam@162 311 # generates a relative path from SRCDIR to DSTDIR, with a trailing
cannam@162 312 # slash if non-empty, suitable for immediately appending a filename
cannam@162 313 # without needing to append a separator.
cannam@162 314 # value returned in "$func_relative_path_result"
cannam@162 315 func_relative_path ()
cannam@162 316 {
cannam@162 317 func_relative_path_result=
cannam@162 318 func_normal_abspath "$1"
cannam@162 319 func_relative_path_tlibdir=$func_normal_abspath_result
cannam@162 320 func_normal_abspath "$2"
cannam@162 321 func_relative_path_tbindir=$func_normal_abspath_result
cannam@162 322
cannam@162 323 # Ascend the tree starting from libdir
cannam@162 324 while :; do
cannam@162 325 # check if we have found a prefix of bindir
cannam@162 326 case $func_relative_path_tbindir in
cannam@162 327 $func_relative_path_tlibdir)
cannam@162 328 # found an exact match
cannam@162 329 func_relative_path_tcancelled=
cannam@162 330 break
cannam@162 331 ;;
cannam@162 332 $func_relative_path_tlibdir*)
cannam@162 333 # found a matching prefix
cannam@162 334 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
cannam@162 335 func_relative_path_tcancelled=$func_stripname_result
cannam@162 336 if test -z "$func_relative_path_result"; then
cannam@162 337 func_relative_path_result=.
cannam@162 338 fi
cannam@162 339 break
cannam@162 340 ;;
cannam@162 341 *)
cannam@162 342 func_dirname $func_relative_path_tlibdir
cannam@162 343 func_relative_path_tlibdir=${func_dirname_result}
cannam@162 344 if test "x$func_relative_path_tlibdir" = x ; then
cannam@162 345 # Have to descend all the way to the root!
cannam@162 346 func_relative_path_result=../$func_relative_path_result
cannam@162 347 func_relative_path_tcancelled=$func_relative_path_tbindir
cannam@162 348 break
cannam@162 349 fi
cannam@162 350 func_relative_path_result=../$func_relative_path_result
cannam@162 351 ;;
cannam@162 352 esac
cannam@162 353 done
cannam@162 354
cannam@162 355 # Now calculate path; take care to avoid doubling-up slashes.
cannam@162 356 func_stripname '' '/' "$func_relative_path_result"
cannam@162 357 func_relative_path_result=$func_stripname_result
cannam@162 358 func_stripname '/' '/' "$func_relative_path_tcancelled"
cannam@162 359 if test "x$func_stripname_result" != x ; then
cannam@162 360 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
cannam@162 361 fi
cannam@162 362
cannam@162 363 # Normalisation. If bindir is libdir, return empty string,
cannam@162 364 # else relative path ending with a slash; either way, target
cannam@162 365 # file name can be directly appended.
cannam@162 366 if test ! -z "$func_relative_path_result"; then
cannam@162 367 func_stripname './' '' "$func_relative_path_result/"
cannam@162 368 func_relative_path_result=$func_stripname_result
cannam@162 369 fi
cannam@162 370 }
cannam@162 371
cannam@162 372 # The name of this program:
cannam@162 373 func_dirname_and_basename "$progpath"
cannam@162 374 progname=$func_basename_result
cannam@162 375
cannam@162 376 # Make sure we have an absolute path for reexecution:
cannam@162 377 case $progpath in
cannam@162 378 [\\/]*|[A-Za-z]:\\*) ;;
cannam@162 379 *[\\/]*)
cannam@162 380 progdir=$func_dirname_result
cannam@162 381 progdir=`cd "$progdir" && pwd`
cannam@162 382 progpath="$progdir/$progname"
cannam@162 383 ;;
cannam@162 384 *)
cannam@162 385 save_IFS="$IFS"
cannam@162 386 IFS=${PATH_SEPARATOR-:}
cannam@162 387 for progdir in $PATH; do
cannam@162 388 IFS="$save_IFS"
cannam@162 389 test -x "$progdir/$progname" && break
cannam@162 390 done
cannam@162 391 IFS="$save_IFS"
cannam@162 392 test -n "$progdir" || progdir=`pwd`
cannam@162 393 progpath="$progdir/$progname"
cannam@162 394 ;;
cannam@162 395 esac
cannam@162 396
cannam@162 397 # Sed substitution that helps us do robust quoting. It backslashifies
cannam@162 398 # metacharacters that are still active within double-quoted strings.
cannam@162 399 Xsed="${SED}"' -e 1s/^X//'
cannam@162 400 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
cannam@162 401
cannam@162 402 # Same as above, but do not quote variable references.
cannam@162 403 double_quote_subst='s/\(["`\\]\)/\\\1/g'
cannam@162 404
cannam@162 405 # Sed substitution that turns a string into a regex matching for the
cannam@162 406 # string literally.
cannam@162 407 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
cannam@162 408
cannam@162 409 # Sed substitution that converts a w32 file name or path
cannam@162 410 # which contains forward slashes, into one that contains
cannam@162 411 # (escaped) backslashes. A very naive implementation.
cannam@162 412 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
cannam@162 413
cannam@162 414 # Re-`\' parameter expansions in output of double_quote_subst that were
cannam@162 415 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
cannam@162 416 # in input to double_quote_subst, that '$' was protected from expansion.
cannam@162 417 # Since each input `\' is now two `\'s, look for any number of runs of
cannam@162 418 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
cannam@162 419 bs='\\'
cannam@162 420 bs2='\\\\'
cannam@162 421 bs4='\\\\\\\\'
cannam@162 422 dollar='\$'
cannam@162 423 sed_double_backslash="\
cannam@162 424 s/$bs4/&\\
cannam@162 425 /g
cannam@162 426 s/^$bs2$dollar/$bs&/
cannam@162 427 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
cannam@162 428 s/\n//g"
cannam@162 429
cannam@162 430 # Standard options:
cannam@162 431 opt_dry_run=false
cannam@162 432 opt_help=false
cannam@162 433 opt_quiet=false
cannam@162 434 opt_verbose=false
cannam@162 435 opt_warning=:
cannam@162 436
cannam@162 437 # func_echo arg...
cannam@162 438 # Echo program name prefixed message, along with the current mode
cannam@162 439 # name if it has been set yet.
cannam@162 440 func_echo ()
cannam@162 441 {
cannam@162 442 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
cannam@162 443 }
cannam@162 444
cannam@162 445 # func_verbose arg...
cannam@162 446 # Echo program name prefixed message in verbose mode only.
cannam@162 447 func_verbose ()
cannam@162 448 {
cannam@162 449 $opt_verbose && func_echo ${1+"$@"}
cannam@162 450
cannam@162 451 # A bug in bash halts the script if the last line of a function
cannam@162 452 # fails when set -e is in force, so we need another command to
cannam@162 453 # work around that:
cannam@162 454 :
cannam@162 455 }
cannam@162 456
cannam@162 457 # func_echo_all arg...
cannam@162 458 # Invoke $ECHO with all args, space-separated.
cannam@162 459 func_echo_all ()
cannam@162 460 {
cannam@162 461 $ECHO "$*"
cannam@162 462 }
cannam@162 463
cannam@162 464 # func_error arg...
cannam@162 465 # Echo program name prefixed message to standard error.
cannam@162 466 func_error ()
cannam@162 467 {
cannam@162 468 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
cannam@162 469 }
cannam@162 470
cannam@162 471 # func_warning arg...
cannam@162 472 # Echo program name prefixed warning message to standard error.
cannam@162 473 func_warning ()
cannam@162 474 {
cannam@162 475 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
cannam@162 476
cannam@162 477 # bash bug again:
cannam@162 478 :
cannam@162 479 }
cannam@162 480
cannam@162 481 # func_fatal_error arg...
cannam@162 482 # Echo program name prefixed message to standard error, and exit.
cannam@162 483 func_fatal_error ()
cannam@162 484 {
cannam@162 485 func_error ${1+"$@"}
cannam@162 486 exit $EXIT_FAILURE
cannam@162 487 }
cannam@162 488
cannam@162 489 # func_fatal_help arg...
cannam@162 490 # Echo program name prefixed message to standard error, followed by
cannam@162 491 # a help hint, and exit.
cannam@162 492 func_fatal_help ()
cannam@162 493 {
cannam@162 494 func_error ${1+"$@"}
cannam@162 495 func_fatal_error "$help"
cannam@162 496 }
cannam@162 497 help="Try \`$progname --help' for more information." ## default
cannam@162 498
cannam@162 499
cannam@162 500 # func_grep expression filename
cannam@162 501 # Check whether EXPRESSION matches any line of FILENAME, without output.
cannam@162 502 func_grep ()
cannam@162 503 {
cannam@162 504 $GREP "$1" "$2" >/dev/null 2>&1
cannam@162 505 }
cannam@162 506
cannam@162 507
cannam@162 508 # func_mkdir_p directory-path
cannam@162 509 # Make sure the entire path to DIRECTORY-PATH is available.
cannam@162 510 func_mkdir_p ()
cannam@162 511 {
cannam@162 512 my_directory_path="$1"
cannam@162 513 my_dir_list=
cannam@162 514
cannam@162 515 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
cannam@162 516
cannam@162 517 # Protect directory names starting with `-'
cannam@162 518 case $my_directory_path in
cannam@162 519 -*) my_directory_path="./$my_directory_path" ;;
cannam@162 520 esac
cannam@162 521
cannam@162 522 # While some portion of DIR does not yet exist...
cannam@162 523 while test ! -d "$my_directory_path"; do
cannam@162 524 # ...make a list in topmost first order. Use a colon delimited
cannam@162 525 # list incase some portion of path contains whitespace.
cannam@162 526 my_dir_list="$my_directory_path:$my_dir_list"
cannam@162 527
cannam@162 528 # If the last portion added has no slash in it, the list is done
cannam@162 529 case $my_directory_path in */*) ;; *) break ;; esac
cannam@162 530
cannam@162 531 # ...otherwise throw away the child directory and loop
cannam@162 532 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
cannam@162 533 done
cannam@162 534 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
cannam@162 535
cannam@162 536 save_mkdir_p_IFS="$IFS"; IFS=':'
cannam@162 537 for my_dir in $my_dir_list; do
cannam@162 538 IFS="$save_mkdir_p_IFS"
cannam@162 539 # mkdir can fail with a `File exist' error if two processes
cannam@162 540 # try to create one of the directories concurrently. Don't
cannam@162 541 # stop in that case!
cannam@162 542 $MKDIR "$my_dir" 2>/dev/null || :
cannam@162 543 done
cannam@162 544 IFS="$save_mkdir_p_IFS"
cannam@162 545
cannam@162 546 # Bail out if we (or some other process) failed to create a directory.
cannam@162 547 test -d "$my_directory_path" || \
cannam@162 548 func_fatal_error "Failed to create \`$1'"
cannam@162 549 fi
cannam@162 550 }
cannam@162 551
cannam@162 552
cannam@162 553 # func_mktempdir [string]
cannam@162 554 # Make a temporary directory that won't clash with other running
cannam@162 555 # libtool processes, and avoids race conditions if possible. If
cannam@162 556 # given, STRING is the basename for that directory.
cannam@162 557 func_mktempdir ()
cannam@162 558 {
cannam@162 559 my_template="${TMPDIR-/tmp}/${1-$progname}"
cannam@162 560
cannam@162 561 if test "$opt_dry_run" = ":"; then
cannam@162 562 # Return a directory name, but don't create it in dry-run mode
cannam@162 563 my_tmpdir="${my_template}-$$"
cannam@162 564 else
cannam@162 565
cannam@162 566 # If mktemp works, use that first and foremost
cannam@162 567 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
cannam@162 568
cannam@162 569 if test ! -d "$my_tmpdir"; then
cannam@162 570 # Failing that, at least try and use $RANDOM to avoid a race
cannam@162 571 my_tmpdir="${my_template}-${RANDOM-0}$$"
cannam@162 572
cannam@162 573 save_mktempdir_umask=`umask`
cannam@162 574 umask 0077
cannam@162 575 $MKDIR "$my_tmpdir"
cannam@162 576 umask $save_mktempdir_umask
cannam@162 577 fi
cannam@162 578
cannam@162 579 # If we're not in dry-run mode, bomb out on failure
cannam@162 580 test -d "$my_tmpdir" || \
cannam@162 581 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
cannam@162 582 fi
cannam@162 583
cannam@162 584 $ECHO "$my_tmpdir"
cannam@162 585 }
cannam@162 586
cannam@162 587
cannam@162 588 # func_quote_for_eval arg
cannam@162 589 # Aesthetically quote ARG to be evaled later.
cannam@162 590 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
cannam@162 591 # is double-quoted, suitable for a subsequent eval, whereas
cannam@162 592 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
cannam@162 593 # which are still active within double quotes backslashified.
cannam@162 594 func_quote_for_eval ()
cannam@162 595 {
cannam@162 596 case $1 in
cannam@162 597 *[\\\`\"\$]*)
cannam@162 598 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
cannam@162 599 *)
cannam@162 600 func_quote_for_eval_unquoted_result="$1" ;;
cannam@162 601 esac
cannam@162 602
cannam@162 603 case $func_quote_for_eval_unquoted_result in
cannam@162 604 # Double-quote args containing shell metacharacters to delay
cannam@162 605 # word splitting, command substitution and and variable
cannam@162 606 # expansion for a subsequent eval.
cannam@162 607 # Many Bourne shells cannot handle close brackets correctly
cannam@162 608 # in scan sets, so we specify it separately.
cannam@162 609 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
cannam@162 610 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
cannam@162 611 ;;
cannam@162 612 *)
cannam@162 613 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
cannam@162 614 esac
cannam@162 615 }
cannam@162 616
cannam@162 617
cannam@162 618 # func_quote_for_expand arg
cannam@162 619 # Aesthetically quote ARG to be evaled later; same as above,
cannam@162 620 # but do not quote variable references.
cannam@162 621 func_quote_for_expand ()
cannam@162 622 {
cannam@162 623 case $1 in
cannam@162 624 *[\\\`\"]*)
cannam@162 625 my_arg=`$ECHO "$1" | $SED \
cannam@162 626 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
cannam@162 627 *)
cannam@162 628 my_arg="$1" ;;
cannam@162 629 esac
cannam@162 630
cannam@162 631 case $my_arg in
cannam@162 632 # Double-quote args containing shell metacharacters to delay
cannam@162 633 # word splitting and command substitution for a subsequent eval.
cannam@162 634 # Many Bourne shells cannot handle close brackets correctly
cannam@162 635 # in scan sets, so we specify it separately.
cannam@162 636 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
cannam@162 637 my_arg="\"$my_arg\""
cannam@162 638 ;;
cannam@162 639 esac
cannam@162 640
cannam@162 641 func_quote_for_expand_result="$my_arg"
cannam@162 642 }
cannam@162 643
cannam@162 644
cannam@162 645 # func_show_eval cmd [fail_exp]
cannam@162 646 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
cannam@162 647 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
cannam@162 648 # is given, then evaluate it.
cannam@162 649 func_show_eval ()
cannam@162 650 {
cannam@162 651 my_cmd="$1"
cannam@162 652 my_fail_exp="${2-:}"
cannam@162 653
cannam@162 654 ${opt_silent-false} || {
cannam@162 655 func_quote_for_expand "$my_cmd"
cannam@162 656 eval "func_echo $func_quote_for_expand_result"
cannam@162 657 }
cannam@162 658
cannam@162 659 if ${opt_dry_run-false}; then :; else
cannam@162 660 eval "$my_cmd"
cannam@162 661 my_status=$?
cannam@162 662 if test "$my_status" -eq 0; then :; else
cannam@162 663 eval "(exit $my_status); $my_fail_exp"
cannam@162 664 fi
cannam@162 665 fi
cannam@162 666 }
cannam@162 667
cannam@162 668
cannam@162 669 # func_show_eval_locale cmd [fail_exp]
cannam@162 670 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
cannam@162 671 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
cannam@162 672 # is given, then evaluate it. Use the saved locale for evaluation.
cannam@162 673 func_show_eval_locale ()
cannam@162 674 {
cannam@162 675 my_cmd="$1"
cannam@162 676 my_fail_exp="${2-:}"
cannam@162 677
cannam@162 678 ${opt_silent-false} || {
cannam@162 679 func_quote_for_expand "$my_cmd"
cannam@162 680 eval "func_echo $func_quote_for_expand_result"
cannam@162 681 }
cannam@162 682
cannam@162 683 if ${opt_dry_run-false}; then :; else
cannam@162 684 eval "$lt_user_locale
cannam@162 685 $my_cmd"
cannam@162 686 my_status=$?
cannam@162 687 eval "$lt_safe_locale"
cannam@162 688 if test "$my_status" -eq 0; then :; else
cannam@162 689 eval "(exit $my_status); $my_fail_exp"
cannam@162 690 fi
cannam@162 691 fi
cannam@162 692 }
cannam@162 693
cannam@162 694 # func_tr_sh
cannam@162 695 # Turn $1 into a string suitable for a shell variable name.
cannam@162 696 # Result is stored in $func_tr_sh_result. All characters
cannam@162 697 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
cannam@162 698 # if $1 begins with a digit, a '_' is prepended as well.
cannam@162 699 func_tr_sh ()
cannam@162 700 {
cannam@162 701 case $1 in
cannam@162 702 [0-9]* | *[!a-zA-Z0-9_]*)
cannam@162 703 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
cannam@162 704 ;;
cannam@162 705 * )
cannam@162 706 func_tr_sh_result=$1
cannam@162 707 ;;
cannam@162 708 esac
cannam@162 709 }
cannam@162 710
cannam@162 711
cannam@162 712 # func_version
cannam@162 713 # Echo version message to standard output and exit.
cannam@162 714 func_version ()
cannam@162 715 {
cannam@162 716 $opt_debug
cannam@162 717
cannam@162 718 $SED -n '/(C)/!b go
cannam@162 719 :more
cannam@162 720 /\./!{
cannam@162 721 N
cannam@162 722 s/\n# / /
cannam@162 723 b more
cannam@162 724 }
cannam@162 725 :go
cannam@162 726 /^# '$PROGRAM' (GNU /,/# warranty; / {
cannam@162 727 s/^# //
cannam@162 728 s/^# *$//
cannam@162 729 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
cannam@162 730 p
cannam@162 731 }' < "$progpath"
cannam@162 732 exit $?
cannam@162 733 }
cannam@162 734
cannam@162 735 # func_usage
cannam@162 736 # Echo short help message to standard output and exit.
cannam@162 737 func_usage ()
cannam@162 738 {
cannam@162 739 $opt_debug
cannam@162 740
cannam@162 741 $SED -n '/^# Usage:/,/^# *.*--help/ {
cannam@162 742 s/^# //
cannam@162 743 s/^# *$//
cannam@162 744 s/\$progname/'$progname'/
cannam@162 745 p
cannam@162 746 }' < "$progpath"
cannam@162 747 echo
cannam@162 748 $ECHO "run \`$progname --help | more' for full usage"
cannam@162 749 exit $?
cannam@162 750 }
cannam@162 751
cannam@162 752 # func_help [NOEXIT]
cannam@162 753 # Echo long help message to standard output and exit,
cannam@162 754 # unless 'noexit' is passed as argument.
cannam@162 755 func_help ()
cannam@162 756 {
cannam@162 757 $opt_debug
cannam@162 758
cannam@162 759 $SED -n '/^# Usage:/,/# Report bugs to/ {
cannam@162 760 :print
cannam@162 761 s/^# //
cannam@162 762 s/^# *$//
cannam@162 763 s*\$progname*'$progname'*
cannam@162 764 s*\$host*'"$host"'*
cannam@162 765 s*\$SHELL*'"$SHELL"'*
cannam@162 766 s*\$LTCC*'"$LTCC"'*
cannam@162 767 s*\$LTCFLAGS*'"$LTCFLAGS"'*
cannam@162 768 s*\$LD*'"$LD"'*
cannam@162 769 s/\$with_gnu_ld/'"$with_gnu_ld"'/
cannam@162 770 s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
cannam@162 771 s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
cannam@162 772 p
cannam@162 773 d
cannam@162 774 }
cannam@162 775 /^# .* home page:/b print
cannam@162 776 /^# General help using/b print
cannam@162 777 ' < "$progpath"
cannam@162 778 ret=$?
cannam@162 779 if test -z "$1"; then
cannam@162 780 exit $ret
cannam@162 781 fi
cannam@162 782 }
cannam@162 783
cannam@162 784 # func_missing_arg argname
cannam@162 785 # Echo program name prefixed message to standard error and set global
cannam@162 786 # exit_cmd.
cannam@162 787 func_missing_arg ()
cannam@162 788 {
cannam@162 789 $opt_debug
cannam@162 790
cannam@162 791 func_error "missing argument for $1."
cannam@162 792 exit_cmd=exit
cannam@162 793 }
cannam@162 794
cannam@162 795
cannam@162 796 # func_split_short_opt shortopt
cannam@162 797 # Set func_split_short_opt_name and func_split_short_opt_arg shell
cannam@162 798 # variables after splitting SHORTOPT after the 2nd character.
cannam@162 799 func_split_short_opt ()
cannam@162 800 {
cannam@162 801 my_sed_short_opt='1s/^\(..\).*$/\1/;q'
cannam@162 802 my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
cannam@162 803
cannam@162 804 func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
cannam@162 805 func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
cannam@162 806 } # func_split_short_opt may be replaced by extended shell implementation
cannam@162 807
cannam@162 808
cannam@162 809 # func_split_long_opt longopt
cannam@162 810 # Set func_split_long_opt_name and func_split_long_opt_arg shell
cannam@162 811 # variables after splitting LONGOPT at the `=' sign.
cannam@162 812 func_split_long_opt ()
cannam@162 813 {
cannam@162 814 my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
cannam@162 815 my_sed_long_arg='1s/^--[^=]*=//'
cannam@162 816
cannam@162 817 func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
cannam@162 818 func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
cannam@162 819 } # func_split_long_opt may be replaced by extended shell implementation
cannam@162 820
cannam@162 821 exit_cmd=:
cannam@162 822
cannam@162 823
cannam@162 824
cannam@162 825
cannam@162 826
cannam@162 827 magic="%%%MAGIC variable%%%"
cannam@162 828 magic_exe="%%%MAGIC EXE variable%%%"
cannam@162 829
cannam@162 830 # Global variables.
cannam@162 831 nonopt=
cannam@162 832 preserve_args=
cannam@162 833 lo2o="s/\\.lo\$/.${objext}/"
cannam@162 834 o2lo="s/\\.${objext}\$/.lo/"
cannam@162 835 extracted_archives=
cannam@162 836 extracted_serial=0
cannam@162 837
cannam@162 838 # If this variable is set in any of the actions, the command in it
cannam@162 839 # will be execed at the end. This prevents here-documents from being
cannam@162 840 # left over by shells.
cannam@162 841 exec_cmd=
cannam@162 842
cannam@162 843 # func_append var value
cannam@162 844 # Append VALUE to the end of shell variable VAR.
cannam@162 845 func_append ()
cannam@162 846 {
cannam@162 847 eval "${1}=\$${1}\${2}"
cannam@162 848 } # func_append may be replaced by extended shell implementation
cannam@162 849
cannam@162 850 # func_append_quoted var value
cannam@162 851 # Quote VALUE and append to the end of shell variable VAR, separated
cannam@162 852 # by a space.
cannam@162 853 func_append_quoted ()
cannam@162 854 {
cannam@162 855 func_quote_for_eval "${2}"
cannam@162 856 eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
cannam@162 857 } # func_append_quoted may be replaced by extended shell implementation
cannam@162 858
cannam@162 859
cannam@162 860 # func_arith arithmetic-term...
cannam@162 861 func_arith ()
cannam@162 862 {
cannam@162 863 func_arith_result=`expr "${@}"`
cannam@162 864 } # func_arith may be replaced by extended shell implementation
cannam@162 865
cannam@162 866
cannam@162 867 # func_len string
cannam@162 868 # STRING may not start with a hyphen.
cannam@162 869 func_len ()
cannam@162 870 {
cannam@162 871 func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
cannam@162 872 } # func_len may be replaced by extended shell implementation
cannam@162 873
cannam@162 874
cannam@162 875 # func_lo2o object
cannam@162 876 func_lo2o ()
cannam@162 877 {
cannam@162 878 func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
cannam@162 879 } # func_lo2o may be replaced by extended shell implementation
cannam@162 880
cannam@162 881
cannam@162 882 # func_xform libobj-or-source
cannam@162 883 func_xform ()
cannam@162 884 {
cannam@162 885 func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
cannam@162 886 } # func_xform may be replaced by extended shell implementation
cannam@162 887
cannam@162 888
cannam@162 889 # func_fatal_configuration arg...
cannam@162 890 # Echo program name prefixed message to standard error, followed by
cannam@162 891 # a configuration failure hint, and exit.
cannam@162 892 func_fatal_configuration ()
cannam@162 893 {
cannam@162 894 func_error ${1+"$@"}
cannam@162 895 func_error "See the $PACKAGE documentation for more information."
cannam@162 896 func_fatal_error "Fatal configuration error."
cannam@162 897 }
cannam@162 898
cannam@162 899
cannam@162 900 # func_config
cannam@162 901 # Display the configuration for all the tags in this script.
cannam@162 902 func_config ()
cannam@162 903 {
cannam@162 904 re_begincf='^# ### BEGIN LIBTOOL'
cannam@162 905 re_endcf='^# ### END LIBTOOL'
cannam@162 906
cannam@162 907 # Default configuration.
cannam@162 908 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
cannam@162 909
cannam@162 910 # Now print the configurations for the tags.
cannam@162 911 for tagname in $taglist; do
cannam@162 912 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
cannam@162 913 done
cannam@162 914
cannam@162 915 exit $?
cannam@162 916 }
cannam@162 917
cannam@162 918 # func_features
cannam@162 919 # Display the features supported by this script.
cannam@162 920 func_features ()
cannam@162 921 {
cannam@162 922 echo "host: $host"
cannam@162 923 if test "$build_libtool_libs" = yes; then
cannam@162 924 echo "enable shared libraries"
cannam@162 925 else
cannam@162 926 echo "disable shared libraries"
cannam@162 927 fi
cannam@162 928 if test "$build_old_libs" = yes; then
cannam@162 929 echo "enable static libraries"
cannam@162 930 else
cannam@162 931 echo "disable static libraries"
cannam@162 932 fi
cannam@162 933
cannam@162 934 exit $?
cannam@162 935 }
cannam@162 936
cannam@162 937 # func_enable_tag tagname
cannam@162 938 # Verify that TAGNAME is valid, and either flag an error and exit, or
cannam@162 939 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
cannam@162 940 # variable here.
cannam@162 941 func_enable_tag ()
cannam@162 942 {
cannam@162 943 # Global variable:
cannam@162 944 tagname="$1"
cannam@162 945
cannam@162 946 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
cannam@162 947 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
cannam@162 948 sed_extractcf="/$re_begincf/,/$re_endcf/p"
cannam@162 949
cannam@162 950 # Validate tagname.
cannam@162 951 case $tagname in
cannam@162 952 *[!-_A-Za-z0-9,/]*)
cannam@162 953 func_fatal_error "invalid tag name: $tagname"
cannam@162 954 ;;
cannam@162 955 esac
cannam@162 956
cannam@162 957 # Don't test for the "default" C tag, as we know it's
cannam@162 958 # there but not specially marked.
cannam@162 959 case $tagname in
cannam@162 960 CC) ;;
cannam@162 961 *)
cannam@162 962 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
cannam@162 963 taglist="$taglist $tagname"
cannam@162 964
cannam@162 965 # Evaluate the configuration. Be careful to quote the path
cannam@162 966 # and the sed script, to avoid splitting on whitespace, but
cannam@162 967 # also don't use non-portable quotes within backquotes within
cannam@162 968 # quotes we have to do it in 2 steps:
cannam@162 969 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
cannam@162 970 eval "$extractedcf"
cannam@162 971 else
cannam@162 972 func_error "ignoring unknown tag $tagname"
cannam@162 973 fi
cannam@162 974 ;;
cannam@162 975 esac
cannam@162 976 }
cannam@162 977
cannam@162 978 # func_check_version_match
cannam@162 979 # Ensure that we are using m4 macros, and libtool script from the same
cannam@162 980 # release of libtool.
cannam@162 981 func_check_version_match ()
cannam@162 982 {
cannam@162 983 if test "$package_revision" != "$macro_revision"; then
cannam@162 984 if test "$VERSION" != "$macro_version"; then
cannam@162 985 if test -z "$macro_version"; then
cannam@162 986 cat >&2 <<_LT_EOF
cannam@162 987 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
cannam@162 988 $progname: definition of this LT_INIT comes from an older release.
cannam@162 989 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
cannam@162 990 $progname: and run autoconf again.
cannam@162 991 _LT_EOF
cannam@162 992 else
cannam@162 993 cat >&2 <<_LT_EOF
cannam@162 994 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
cannam@162 995 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
cannam@162 996 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
cannam@162 997 $progname: and run autoconf again.
cannam@162 998 _LT_EOF
cannam@162 999 fi
cannam@162 1000 else
cannam@162 1001 cat >&2 <<_LT_EOF
cannam@162 1002 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
cannam@162 1003 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
cannam@162 1004 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
cannam@162 1005 $progname: of $PACKAGE $VERSION and run autoconf again.
cannam@162 1006 _LT_EOF
cannam@162 1007 fi
cannam@162 1008
cannam@162 1009 exit $EXIT_MISMATCH
cannam@162 1010 fi
cannam@162 1011 }
cannam@162 1012
cannam@162 1013
cannam@162 1014 # Shorthand for --mode=foo, only valid as the first argument
cannam@162 1015 case $1 in
cannam@162 1016 clean|clea|cle|cl)
cannam@162 1017 shift; set dummy --mode clean ${1+"$@"}; shift
cannam@162 1018 ;;
cannam@162 1019 compile|compil|compi|comp|com|co|c)
cannam@162 1020 shift; set dummy --mode compile ${1+"$@"}; shift
cannam@162 1021 ;;
cannam@162 1022 execute|execut|execu|exec|exe|ex|e)
cannam@162 1023 shift; set dummy --mode execute ${1+"$@"}; shift
cannam@162 1024 ;;
cannam@162 1025 finish|finis|fini|fin|fi|f)
cannam@162 1026 shift; set dummy --mode finish ${1+"$@"}; shift
cannam@162 1027 ;;
cannam@162 1028 install|instal|insta|inst|ins|in|i)
cannam@162 1029 shift; set dummy --mode install ${1+"$@"}; shift
cannam@162 1030 ;;
cannam@162 1031 link|lin|li|l)
cannam@162 1032 shift; set dummy --mode link ${1+"$@"}; shift
cannam@162 1033 ;;
cannam@162 1034 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
cannam@162 1035 shift; set dummy --mode uninstall ${1+"$@"}; shift
cannam@162 1036 ;;
cannam@162 1037 esac
cannam@162 1038
cannam@162 1039
cannam@162 1040
cannam@162 1041 # Option defaults:
cannam@162 1042 opt_debug=:
cannam@162 1043 opt_dry_run=false
cannam@162 1044 opt_config=false
cannam@162 1045 opt_preserve_dup_deps=false
cannam@162 1046 opt_features=false
cannam@162 1047 opt_finish=false
cannam@162 1048 opt_help=false
cannam@162 1049 opt_help_all=false
cannam@162 1050 opt_silent=:
cannam@162 1051 opt_warning=:
cannam@162 1052 opt_verbose=:
cannam@162 1053 opt_silent=false
cannam@162 1054 opt_verbose=false
cannam@162 1055
cannam@162 1056
cannam@162 1057 # Parse options once, thoroughly. This comes as soon as possible in the
cannam@162 1058 # script to make things like `--version' happen as quickly as we can.
cannam@162 1059 {
cannam@162 1060 # this just eases exit handling
cannam@162 1061 while test $# -gt 0; do
cannam@162 1062 opt="$1"
cannam@162 1063 shift
cannam@162 1064 case $opt in
cannam@162 1065 --debug|-x) opt_debug='set -x'
cannam@162 1066 func_echo "enabling shell trace mode"
cannam@162 1067 $opt_debug
cannam@162 1068 ;;
cannam@162 1069 --dry-run|--dryrun|-n)
cannam@162 1070 opt_dry_run=:
cannam@162 1071 ;;
cannam@162 1072 --config)
cannam@162 1073 opt_config=:
cannam@162 1074 func_config
cannam@162 1075 ;;
cannam@162 1076 --dlopen|-dlopen)
cannam@162 1077 optarg="$1"
cannam@162 1078 opt_dlopen="${opt_dlopen+$opt_dlopen
cannam@162 1079 }$optarg"
cannam@162 1080 shift
cannam@162 1081 ;;
cannam@162 1082 --preserve-dup-deps)
cannam@162 1083 opt_preserve_dup_deps=:
cannam@162 1084 ;;
cannam@162 1085 --features)
cannam@162 1086 opt_features=:
cannam@162 1087 func_features
cannam@162 1088 ;;
cannam@162 1089 --finish)
cannam@162 1090 opt_finish=:
cannam@162 1091 set dummy --mode finish ${1+"$@"}; shift
cannam@162 1092 ;;
cannam@162 1093 --help)
cannam@162 1094 opt_help=:
cannam@162 1095 ;;
cannam@162 1096 --help-all)
cannam@162 1097 opt_help_all=:
cannam@162 1098 opt_help=': help-all'
cannam@162 1099 ;;
cannam@162 1100 --mode)
cannam@162 1101 test $# = 0 && func_missing_arg $opt && break
cannam@162 1102 optarg="$1"
cannam@162 1103 opt_mode="$optarg"
cannam@162 1104 case $optarg in
cannam@162 1105 # Valid mode arguments:
cannam@162 1106 clean|compile|execute|finish|install|link|relink|uninstall) ;;
cannam@162 1107
cannam@162 1108 # Catch anything else as an error
cannam@162 1109 *) func_error "invalid argument for $opt"
cannam@162 1110 exit_cmd=exit
cannam@162 1111 break
cannam@162 1112 ;;
cannam@162 1113 esac
cannam@162 1114 shift
cannam@162 1115 ;;
cannam@162 1116 --no-silent|--no-quiet)
cannam@162 1117 opt_silent=false
cannam@162 1118 func_append preserve_args " $opt"
cannam@162 1119 ;;
cannam@162 1120 --no-warning|--no-warn)
cannam@162 1121 opt_warning=false
cannam@162 1122 func_append preserve_args " $opt"
cannam@162 1123 ;;
cannam@162 1124 --no-verbose)
cannam@162 1125 opt_verbose=false
cannam@162 1126 func_append preserve_args " $opt"
cannam@162 1127 ;;
cannam@162 1128 --silent|--quiet)
cannam@162 1129 opt_silent=:
cannam@162 1130 func_append preserve_args " $opt"
cannam@162 1131 opt_verbose=false
cannam@162 1132 ;;
cannam@162 1133 --verbose|-v)
cannam@162 1134 opt_verbose=:
cannam@162 1135 func_append preserve_args " $opt"
cannam@162 1136 opt_silent=false
cannam@162 1137 ;;
cannam@162 1138 --tag)
cannam@162 1139 test $# = 0 && func_missing_arg $opt && break
cannam@162 1140 optarg="$1"
cannam@162 1141 opt_tag="$optarg"
cannam@162 1142 func_append preserve_args " $opt $optarg"
cannam@162 1143 func_enable_tag "$optarg"
cannam@162 1144 shift
cannam@162 1145 ;;
cannam@162 1146
cannam@162 1147 -\?|-h) func_usage ;;
cannam@162 1148 --help) func_help ;;
cannam@162 1149 --version) func_version ;;
cannam@162 1150
cannam@162 1151 # Separate optargs to long options:
cannam@162 1152 --*=*)
cannam@162 1153 func_split_long_opt "$opt"
cannam@162 1154 set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
cannam@162 1155 shift
cannam@162 1156 ;;
cannam@162 1157
cannam@162 1158 # Separate non-argument short options:
cannam@162 1159 -\?*|-h*|-n*|-v*)
cannam@162 1160 func_split_short_opt "$opt"
cannam@162 1161 set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
cannam@162 1162 shift
cannam@162 1163 ;;
cannam@162 1164
cannam@162 1165 --) break ;;
cannam@162 1166 -*) func_fatal_help "unrecognized option \`$opt'" ;;
cannam@162 1167 *) set dummy "$opt" ${1+"$@"}; shift; break ;;
cannam@162 1168 esac
cannam@162 1169 done
cannam@162 1170
cannam@162 1171 # Validate options:
cannam@162 1172
cannam@162 1173 # save first non-option argument
cannam@162 1174 if test "$#" -gt 0; then
cannam@162 1175 nonopt="$opt"
cannam@162 1176 shift
cannam@162 1177 fi
cannam@162 1178
cannam@162 1179 # preserve --debug
cannam@162 1180 test "$opt_debug" = : || func_append preserve_args " --debug"
cannam@162 1181
cannam@162 1182 case $host in
cannam@162 1183 *cygwin* | *mingw* | *pw32* | *cegcc*)
cannam@162 1184 # don't eliminate duplications in $postdeps and $predeps
cannam@162 1185 opt_duplicate_compiler_generated_deps=:
cannam@162 1186 ;;
cannam@162 1187 *)
cannam@162 1188 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
cannam@162 1189 ;;
cannam@162 1190 esac
cannam@162 1191
cannam@162 1192 $opt_help || {
cannam@162 1193 # Sanity checks first:
cannam@162 1194 func_check_version_match
cannam@162 1195
cannam@162 1196 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
cannam@162 1197 func_fatal_configuration "not configured to build any kind of library"
cannam@162 1198 fi
cannam@162 1199
cannam@162 1200 # Darwin sucks
cannam@162 1201 eval std_shrext=\"$shrext_cmds\"
cannam@162 1202
cannam@162 1203 # Only execute mode is allowed to have -dlopen flags.
cannam@162 1204 if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
cannam@162 1205 func_error "unrecognized option \`-dlopen'"
cannam@162 1206 $ECHO "$help" 1>&2
cannam@162 1207 exit $EXIT_FAILURE
cannam@162 1208 fi
cannam@162 1209
cannam@162 1210 # Change the help message to a mode-specific one.
cannam@162 1211 generic_help="$help"
cannam@162 1212 help="Try \`$progname --help --mode=$opt_mode' for more information."
cannam@162 1213 }
cannam@162 1214
cannam@162 1215
cannam@162 1216 # Bail if the options were screwed
cannam@162 1217 $exit_cmd $EXIT_FAILURE
cannam@162 1218 }
cannam@162 1219
cannam@162 1220
cannam@162 1221
cannam@162 1222
cannam@162 1223 ## ----------- ##
cannam@162 1224 ## Main. ##
cannam@162 1225 ## ----------- ##
cannam@162 1226
cannam@162 1227 # func_lalib_p file
cannam@162 1228 # True iff FILE is a libtool `.la' library or `.lo' object file.
cannam@162 1229 # This function is only a basic sanity check; it will hardly flush out
cannam@162 1230 # determined imposters.
cannam@162 1231 func_lalib_p ()
cannam@162 1232 {
cannam@162 1233 test -f "$1" &&
cannam@162 1234 $SED -e 4q "$1" 2>/dev/null \
cannam@162 1235 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
cannam@162 1236 }
cannam@162 1237
cannam@162 1238 # func_lalib_unsafe_p file
cannam@162 1239 # True iff FILE is a libtool `.la' library or `.lo' object file.
cannam@162 1240 # This function implements the same check as func_lalib_p without
cannam@162 1241 # resorting to external programs. To this end, it redirects stdin and
cannam@162 1242 # closes it afterwards, without saving the original file descriptor.
cannam@162 1243 # As a safety measure, use it only where a negative result would be
cannam@162 1244 # fatal anyway. Works if `file' does not exist.
cannam@162 1245 func_lalib_unsafe_p ()
cannam@162 1246 {
cannam@162 1247 lalib_p=no
cannam@162 1248 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
cannam@162 1249 for lalib_p_l in 1 2 3 4
cannam@162 1250 do
cannam@162 1251 read lalib_p_line
cannam@162 1252 case "$lalib_p_line" in
cannam@162 1253 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
cannam@162 1254 esac
cannam@162 1255 done
cannam@162 1256 exec 0<&5 5<&-
cannam@162 1257 fi
cannam@162 1258 test "$lalib_p" = yes
cannam@162 1259 }
cannam@162 1260
cannam@162 1261 # func_ltwrapper_script_p file
cannam@162 1262 # True iff FILE is a libtool wrapper script
cannam@162 1263 # This function is only a basic sanity check; it will hardly flush out
cannam@162 1264 # determined imposters.
cannam@162 1265 func_ltwrapper_script_p ()
cannam@162 1266 {
cannam@162 1267 func_lalib_p "$1"
cannam@162 1268 }
cannam@162 1269
cannam@162 1270 # func_ltwrapper_executable_p file
cannam@162 1271 # True iff FILE is a libtool wrapper executable
cannam@162 1272 # This function is only a basic sanity check; it will hardly flush out
cannam@162 1273 # determined imposters.
cannam@162 1274 func_ltwrapper_executable_p ()
cannam@162 1275 {
cannam@162 1276 func_ltwrapper_exec_suffix=
cannam@162 1277 case $1 in
cannam@162 1278 *.exe) ;;
cannam@162 1279 *) func_ltwrapper_exec_suffix=.exe ;;
cannam@162 1280 esac
cannam@162 1281 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
cannam@162 1282 }
cannam@162 1283
cannam@162 1284 # func_ltwrapper_scriptname file
cannam@162 1285 # Assumes file is an ltwrapper_executable
cannam@162 1286 # uses $file to determine the appropriate filename for a
cannam@162 1287 # temporary ltwrapper_script.
cannam@162 1288 func_ltwrapper_scriptname ()
cannam@162 1289 {
cannam@162 1290 func_dirname_and_basename "$1" "" "."
cannam@162 1291 func_stripname '' '.exe' "$func_basename_result"
cannam@162 1292 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
cannam@162 1293 }
cannam@162 1294
cannam@162 1295 # func_ltwrapper_p file
cannam@162 1296 # True iff FILE is a libtool wrapper script or wrapper executable
cannam@162 1297 # This function is only a basic sanity check; it will hardly flush out
cannam@162 1298 # determined imposters.
cannam@162 1299 func_ltwrapper_p ()
cannam@162 1300 {
cannam@162 1301 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
cannam@162 1302 }
cannam@162 1303
cannam@162 1304
cannam@162 1305 # func_execute_cmds commands fail_cmd
cannam@162 1306 # Execute tilde-delimited COMMANDS.
cannam@162 1307 # If FAIL_CMD is given, eval that upon failure.
cannam@162 1308 # FAIL_CMD may read-access the current command in variable CMD!
cannam@162 1309 func_execute_cmds ()
cannam@162 1310 {
cannam@162 1311 $opt_debug
cannam@162 1312 save_ifs=$IFS; IFS='~'
cannam@162 1313 for cmd in $1; do
cannam@162 1314 IFS=$save_ifs
cannam@162 1315 eval cmd=\"$cmd\"
cannam@162 1316 func_show_eval "$cmd" "${2-:}"
cannam@162 1317 done
cannam@162 1318 IFS=$save_ifs
cannam@162 1319 }
cannam@162 1320
cannam@162 1321
cannam@162 1322 # func_source file
cannam@162 1323 # Source FILE, adding directory component if necessary.
cannam@162 1324 # Note that it is not necessary on cygwin/mingw to append a dot to
cannam@162 1325 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
cannam@162 1326 # behavior happens only for exec(3), not for open(2)! Also, sourcing
cannam@162 1327 # `FILE.' does not work on cygwin managed mounts.
cannam@162 1328 func_source ()
cannam@162 1329 {
cannam@162 1330 $opt_debug
cannam@162 1331 case $1 in
cannam@162 1332 */* | *\\*) . "$1" ;;
cannam@162 1333 *) . "./$1" ;;
cannam@162 1334 esac
cannam@162 1335 }
cannam@162 1336
cannam@162 1337
cannam@162 1338 # func_resolve_sysroot PATH
cannam@162 1339 # Replace a leading = in PATH with a sysroot. Store the result into
cannam@162 1340 # func_resolve_sysroot_result
cannam@162 1341 func_resolve_sysroot ()
cannam@162 1342 {
cannam@162 1343 func_resolve_sysroot_result=$1
cannam@162 1344 case $func_resolve_sysroot_result in
cannam@162 1345 =*)
cannam@162 1346 func_stripname '=' '' "$func_resolve_sysroot_result"
cannam@162 1347 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
cannam@162 1348 ;;
cannam@162 1349 esac
cannam@162 1350 }
cannam@162 1351
cannam@162 1352 # func_replace_sysroot PATH
cannam@162 1353 # If PATH begins with the sysroot, replace it with = and
cannam@162 1354 # store the result into func_replace_sysroot_result.
cannam@162 1355 func_replace_sysroot ()
cannam@162 1356 {
cannam@162 1357 case "$lt_sysroot:$1" in
cannam@162 1358 ?*:"$lt_sysroot"*)
cannam@162 1359 func_stripname "$lt_sysroot" '' "$1"
cannam@162 1360 func_replace_sysroot_result="=$func_stripname_result"
cannam@162 1361 ;;
cannam@162 1362 *)
cannam@162 1363 # Including no sysroot.
cannam@162 1364 func_replace_sysroot_result=$1
cannam@162 1365 ;;
cannam@162 1366 esac
cannam@162 1367 }
cannam@162 1368
cannam@162 1369 # func_infer_tag arg
cannam@162 1370 # Infer tagged configuration to use if any are available and
cannam@162 1371 # if one wasn't chosen via the "--tag" command line option.
cannam@162 1372 # Only attempt this if the compiler in the base compile
cannam@162 1373 # command doesn't match the default compiler.
cannam@162 1374 # arg is usually of the form 'gcc ...'
cannam@162 1375 func_infer_tag ()
cannam@162 1376 {
cannam@162 1377 $opt_debug
cannam@162 1378 if test -n "$available_tags" && test -z "$tagname"; then
cannam@162 1379 CC_quoted=
cannam@162 1380 for arg in $CC; do
cannam@162 1381 func_append_quoted CC_quoted "$arg"
cannam@162 1382 done
cannam@162 1383 CC_expanded=`func_echo_all $CC`
cannam@162 1384 CC_quoted_expanded=`func_echo_all $CC_quoted`
cannam@162 1385 case $@ in
cannam@162 1386 # Blanks in the command may have been stripped by the calling shell,
cannam@162 1387 # but not from the CC environment variable when configure was run.
cannam@162 1388 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
cannam@162 1389 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
cannam@162 1390 # Blanks at the start of $base_compile will cause this to fail
cannam@162 1391 # if we don't check for them as well.
cannam@162 1392 *)
cannam@162 1393 for z in $available_tags; do
cannam@162 1394 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
cannam@162 1395 # Evaluate the configuration.
cannam@162 1396 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
cannam@162 1397 CC_quoted=
cannam@162 1398 for arg in $CC; do
cannam@162 1399 # Double-quote args containing other shell metacharacters.
cannam@162 1400 func_append_quoted CC_quoted "$arg"
cannam@162 1401 done
cannam@162 1402 CC_expanded=`func_echo_all $CC`
cannam@162 1403 CC_quoted_expanded=`func_echo_all $CC_quoted`
cannam@162 1404 case "$@ " in
cannam@162 1405 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
cannam@162 1406 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
cannam@162 1407 # The compiler in the base compile command matches
cannam@162 1408 # the one in the tagged configuration.
cannam@162 1409 # Assume this is the tagged configuration we want.
cannam@162 1410 tagname=$z
cannam@162 1411 break
cannam@162 1412 ;;
cannam@162 1413 esac
cannam@162 1414 fi
cannam@162 1415 done
cannam@162 1416 # If $tagname still isn't set, then no tagged configuration
cannam@162 1417 # was found and let the user know that the "--tag" command
cannam@162 1418 # line option must be used.
cannam@162 1419 if test -z "$tagname"; then
cannam@162 1420 func_echo "unable to infer tagged configuration"
cannam@162 1421 func_fatal_error "specify a tag with \`--tag'"
cannam@162 1422 # else
cannam@162 1423 # func_verbose "using $tagname tagged configuration"
cannam@162 1424 fi
cannam@162 1425 ;;
cannam@162 1426 esac
cannam@162 1427 fi
cannam@162 1428 }
cannam@162 1429
cannam@162 1430
cannam@162 1431
cannam@162 1432 # func_write_libtool_object output_name pic_name nonpic_name
cannam@162 1433 # Create a libtool object file (analogous to a ".la" file),
cannam@162 1434 # but don't create it if we're doing a dry run.
cannam@162 1435 func_write_libtool_object ()
cannam@162 1436 {
cannam@162 1437 write_libobj=${1}
cannam@162 1438 if test "$build_libtool_libs" = yes; then
cannam@162 1439 write_lobj=\'${2}\'
cannam@162 1440 else
cannam@162 1441 write_lobj=none
cannam@162 1442 fi
cannam@162 1443
cannam@162 1444 if test "$build_old_libs" = yes; then
cannam@162 1445 write_oldobj=\'${3}\'
cannam@162 1446 else
cannam@162 1447 write_oldobj=none
cannam@162 1448 fi
cannam@162 1449
cannam@162 1450 $opt_dry_run || {
cannam@162 1451 cat >${write_libobj}T <<EOF
cannam@162 1452 # $write_libobj - a libtool object file
cannam@162 1453 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
cannam@162 1454 #
cannam@162 1455 # Please DO NOT delete this file!
cannam@162 1456 # It is necessary for linking the library.
cannam@162 1457
cannam@162 1458 # Name of the PIC object.
cannam@162 1459 pic_object=$write_lobj
cannam@162 1460
cannam@162 1461 # Name of the non-PIC object
cannam@162 1462 non_pic_object=$write_oldobj
cannam@162 1463
cannam@162 1464 EOF
cannam@162 1465 $MV "${write_libobj}T" "${write_libobj}"
cannam@162 1466 }
cannam@162 1467 }
cannam@162 1468
cannam@162 1469
cannam@162 1470 ##################################################
cannam@162 1471 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
cannam@162 1472 ##################################################
cannam@162 1473
cannam@162 1474 # func_convert_core_file_wine_to_w32 ARG
cannam@162 1475 # Helper function used by file name conversion functions when $build is *nix,
cannam@162 1476 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
cannam@162 1477 # correctly configured wine environment available, with the winepath program
cannam@162 1478 # in $build's $PATH.
cannam@162 1479 #
cannam@162 1480 # ARG is the $build file name to be converted to w32 format.
cannam@162 1481 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
cannam@162 1482 # be empty on error (or when ARG is empty)
cannam@162 1483 func_convert_core_file_wine_to_w32 ()
cannam@162 1484 {
cannam@162 1485 $opt_debug
cannam@162 1486 func_convert_core_file_wine_to_w32_result="$1"
cannam@162 1487 if test -n "$1"; then
cannam@162 1488 # Unfortunately, winepath does not exit with a non-zero error code, so we
cannam@162 1489 # are forced to check the contents of stdout. On the other hand, if the
cannam@162 1490 # command is not found, the shell will set an exit code of 127 and print
cannam@162 1491 # *an error message* to stdout. So we must check for both error code of
cannam@162 1492 # zero AND non-empty stdout, which explains the odd construction:
cannam@162 1493 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
cannam@162 1494 if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
cannam@162 1495 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
cannam@162 1496 $SED -e "$lt_sed_naive_backslashify"`
cannam@162 1497 else
cannam@162 1498 func_convert_core_file_wine_to_w32_result=
cannam@162 1499 fi
cannam@162 1500 fi
cannam@162 1501 }
cannam@162 1502 # end: func_convert_core_file_wine_to_w32
cannam@162 1503
cannam@162 1504
cannam@162 1505 # func_convert_core_path_wine_to_w32 ARG
cannam@162 1506 # Helper function used by path conversion functions when $build is *nix, and
cannam@162 1507 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
cannam@162 1508 # configured wine environment available, with the winepath program in $build's
cannam@162 1509 # $PATH. Assumes ARG has no leading or trailing path separator characters.
cannam@162 1510 #
cannam@162 1511 # ARG is path to be converted from $build format to win32.
cannam@162 1512 # Result is available in $func_convert_core_path_wine_to_w32_result.
cannam@162 1513 # Unconvertible file (directory) names in ARG are skipped; if no directory names
cannam@162 1514 # are convertible, then the result may be empty.
cannam@162 1515 func_convert_core_path_wine_to_w32 ()
cannam@162 1516 {
cannam@162 1517 $opt_debug
cannam@162 1518 # unfortunately, winepath doesn't convert paths, only file names
cannam@162 1519 func_convert_core_path_wine_to_w32_result=""
cannam@162 1520 if test -n "$1"; then
cannam@162 1521 oldIFS=$IFS
cannam@162 1522 IFS=:
cannam@162 1523 for func_convert_core_path_wine_to_w32_f in $1; do
cannam@162 1524 IFS=$oldIFS
cannam@162 1525 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
cannam@162 1526 if test -n "$func_convert_core_file_wine_to_w32_result" ; then
cannam@162 1527 if test -z "$func_convert_core_path_wine_to_w32_result"; then
cannam@162 1528 func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
cannam@162 1529 else
cannam@162 1530 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
cannam@162 1531 fi
cannam@162 1532 fi
cannam@162 1533 done
cannam@162 1534 IFS=$oldIFS
cannam@162 1535 fi
cannam@162 1536 }
cannam@162 1537 # end: func_convert_core_path_wine_to_w32
cannam@162 1538
cannam@162 1539
cannam@162 1540 # func_cygpath ARGS...
cannam@162 1541 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
cannam@162 1542 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
cannam@162 1543 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
cannam@162 1544 # (2), returns the Cygwin file name or path in func_cygpath_result (input
cannam@162 1545 # file name or path is assumed to be in w32 format, as previously converted
cannam@162 1546 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
cannam@162 1547 # or path in func_cygpath_result (input file name or path is assumed to be in
cannam@162 1548 # Cygwin format). Returns an empty string on error.
cannam@162 1549 #
cannam@162 1550 # ARGS are passed to cygpath, with the last one being the file name or path to
cannam@162 1551 # be converted.
cannam@162 1552 #
cannam@162 1553 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
cannam@162 1554 # environment variable; do not put it in $PATH.
cannam@162 1555 func_cygpath ()
cannam@162 1556 {
cannam@162 1557 $opt_debug
cannam@162 1558 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
cannam@162 1559 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
cannam@162 1560 if test "$?" -ne 0; then
cannam@162 1561 # on failure, ensure result is empty
cannam@162 1562 func_cygpath_result=
cannam@162 1563 fi
cannam@162 1564 else
cannam@162 1565 func_cygpath_result=
cannam@162 1566 func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
cannam@162 1567 fi
cannam@162 1568 }
cannam@162 1569 #end: func_cygpath
cannam@162 1570
cannam@162 1571
cannam@162 1572 # func_convert_core_msys_to_w32 ARG
cannam@162 1573 # Convert file name or path ARG from MSYS format to w32 format. Return
cannam@162 1574 # result in func_convert_core_msys_to_w32_result.
cannam@162 1575 func_convert_core_msys_to_w32 ()
cannam@162 1576 {
cannam@162 1577 $opt_debug
cannam@162 1578 # awkward: cmd appends spaces to result
cannam@162 1579 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
cannam@162 1580 $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
cannam@162 1581 }
cannam@162 1582 #end: func_convert_core_msys_to_w32
cannam@162 1583
cannam@162 1584
cannam@162 1585 # func_convert_file_check ARG1 ARG2
cannam@162 1586 # Verify that ARG1 (a file name in $build format) was converted to $host
cannam@162 1587 # format in ARG2. Otherwise, emit an error message, but continue (resetting
cannam@162 1588 # func_to_host_file_result to ARG1).
cannam@162 1589 func_convert_file_check ()
cannam@162 1590 {
cannam@162 1591 $opt_debug
cannam@162 1592 if test -z "$2" && test -n "$1" ; then
cannam@162 1593 func_error "Could not determine host file name corresponding to"
cannam@162 1594 func_error " \`$1'"
cannam@162 1595 func_error "Continuing, but uninstalled executables may not work."
cannam@162 1596 # Fallback:
cannam@162 1597 func_to_host_file_result="$1"
cannam@162 1598 fi
cannam@162 1599 }
cannam@162 1600 # end func_convert_file_check
cannam@162 1601
cannam@162 1602
cannam@162 1603 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
cannam@162 1604 # Verify that FROM_PATH (a path in $build format) was converted to $host
cannam@162 1605 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
cannam@162 1606 # func_to_host_file_result to a simplistic fallback value (see below).
cannam@162 1607 func_convert_path_check ()
cannam@162 1608 {
cannam@162 1609 $opt_debug
cannam@162 1610 if test -z "$4" && test -n "$3"; then
cannam@162 1611 func_error "Could not determine the host path corresponding to"
cannam@162 1612 func_error " \`$3'"
cannam@162 1613 func_error "Continuing, but uninstalled executables may not work."
cannam@162 1614 # Fallback. This is a deliberately simplistic "conversion" and
cannam@162 1615 # should not be "improved". See libtool.info.
cannam@162 1616 if test "x$1" != "x$2"; then
cannam@162 1617 lt_replace_pathsep_chars="s|$1|$2|g"
cannam@162 1618 func_to_host_path_result=`echo "$3" |
cannam@162 1619 $SED -e "$lt_replace_pathsep_chars"`
cannam@162 1620 else
cannam@162 1621 func_to_host_path_result="$3"
cannam@162 1622 fi
cannam@162 1623 fi
cannam@162 1624 }
cannam@162 1625 # end func_convert_path_check
cannam@162 1626
cannam@162 1627
cannam@162 1628 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
cannam@162 1629 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
cannam@162 1630 # and appending REPL if ORIG matches BACKPAT.
cannam@162 1631 func_convert_path_front_back_pathsep ()
cannam@162 1632 {
cannam@162 1633 $opt_debug
cannam@162 1634 case $4 in
cannam@162 1635 $1 ) func_to_host_path_result="$3$func_to_host_path_result"
cannam@162 1636 ;;
cannam@162 1637 esac
cannam@162 1638 case $4 in
cannam@162 1639 $2 ) func_append func_to_host_path_result "$3"
cannam@162 1640 ;;
cannam@162 1641 esac
cannam@162 1642 }
cannam@162 1643 # end func_convert_path_front_back_pathsep
cannam@162 1644
cannam@162 1645
cannam@162 1646 ##################################################
cannam@162 1647 # $build to $host FILE NAME CONVERSION FUNCTIONS #
cannam@162 1648 ##################################################
cannam@162 1649 # invoked via `$to_host_file_cmd ARG'
cannam@162 1650 #
cannam@162 1651 # In each case, ARG is the path to be converted from $build to $host format.
cannam@162 1652 # Result will be available in $func_to_host_file_result.
cannam@162 1653
cannam@162 1654
cannam@162 1655 # func_to_host_file ARG
cannam@162 1656 # Converts the file name ARG from $build format to $host format. Return result
cannam@162 1657 # in func_to_host_file_result.
cannam@162 1658 func_to_host_file ()
cannam@162 1659 {
cannam@162 1660 $opt_debug
cannam@162 1661 $to_host_file_cmd "$1"
cannam@162 1662 }
cannam@162 1663 # end func_to_host_file
cannam@162 1664
cannam@162 1665
cannam@162 1666 # func_to_tool_file ARG LAZY
cannam@162 1667 # converts the file name ARG from $build format to toolchain format. Return
cannam@162 1668 # result in func_to_tool_file_result. If the conversion in use is listed
cannam@162 1669 # in (the comma separated) LAZY, no conversion takes place.
cannam@162 1670 func_to_tool_file ()
cannam@162 1671 {
cannam@162 1672 $opt_debug
cannam@162 1673 case ,$2, in
cannam@162 1674 *,"$to_tool_file_cmd",*)
cannam@162 1675 func_to_tool_file_result=$1
cannam@162 1676 ;;
cannam@162 1677 *)
cannam@162 1678 $to_tool_file_cmd "$1"
cannam@162 1679 func_to_tool_file_result=$func_to_host_file_result
cannam@162 1680 ;;
cannam@162 1681 esac
cannam@162 1682 }
cannam@162 1683 # end func_to_tool_file
cannam@162 1684
cannam@162 1685
cannam@162 1686 # func_convert_file_noop ARG
cannam@162 1687 # Copy ARG to func_to_host_file_result.
cannam@162 1688 func_convert_file_noop ()
cannam@162 1689 {
cannam@162 1690 func_to_host_file_result="$1"
cannam@162 1691 }
cannam@162 1692 # end func_convert_file_noop
cannam@162 1693
cannam@162 1694
cannam@162 1695 # func_convert_file_msys_to_w32 ARG
cannam@162 1696 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
cannam@162 1697 # conversion to w32 is not available inside the cwrapper. Returns result in
cannam@162 1698 # func_to_host_file_result.
cannam@162 1699 func_convert_file_msys_to_w32 ()
cannam@162 1700 {
cannam@162 1701 $opt_debug
cannam@162 1702 func_to_host_file_result="$1"
cannam@162 1703 if test -n "$1"; then
cannam@162 1704 func_convert_core_msys_to_w32 "$1"
cannam@162 1705 func_to_host_file_result="$func_convert_core_msys_to_w32_result"
cannam@162 1706 fi
cannam@162 1707 func_convert_file_check "$1" "$func_to_host_file_result"
cannam@162 1708 }
cannam@162 1709 # end func_convert_file_msys_to_w32
cannam@162 1710
cannam@162 1711
cannam@162 1712 # func_convert_file_cygwin_to_w32 ARG
cannam@162 1713 # Convert file name ARG from Cygwin to w32 format. Returns result in
cannam@162 1714 # func_to_host_file_result.
cannam@162 1715 func_convert_file_cygwin_to_w32 ()
cannam@162 1716 {
cannam@162 1717 $opt_debug
cannam@162 1718 func_to_host_file_result="$1"
cannam@162 1719 if test -n "$1"; then
cannam@162 1720 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
cannam@162 1721 # LT_CYGPATH in this case.
cannam@162 1722 func_to_host_file_result=`cygpath -m "$1"`
cannam@162 1723 fi
cannam@162 1724 func_convert_file_check "$1" "$func_to_host_file_result"
cannam@162 1725 }
cannam@162 1726 # end func_convert_file_cygwin_to_w32
cannam@162 1727
cannam@162 1728
cannam@162 1729 # func_convert_file_nix_to_w32 ARG
cannam@162 1730 # Convert file name ARG from *nix to w32 format. Requires a wine environment
cannam@162 1731 # and a working winepath. Returns result in func_to_host_file_result.
cannam@162 1732 func_convert_file_nix_to_w32 ()
cannam@162 1733 {
cannam@162 1734 $opt_debug
cannam@162 1735 func_to_host_file_result="$1"
cannam@162 1736 if test -n "$1"; then
cannam@162 1737 func_convert_core_file_wine_to_w32 "$1"
cannam@162 1738 func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
cannam@162 1739 fi
cannam@162 1740 func_convert_file_check "$1" "$func_to_host_file_result"
cannam@162 1741 }
cannam@162 1742 # end func_convert_file_nix_to_w32
cannam@162 1743
cannam@162 1744
cannam@162 1745 # func_convert_file_msys_to_cygwin ARG
cannam@162 1746 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
cannam@162 1747 # Returns result in func_to_host_file_result.
cannam@162 1748 func_convert_file_msys_to_cygwin ()
cannam@162 1749 {
cannam@162 1750 $opt_debug
cannam@162 1751 func_to_host_file_result="$1"
cannam@162 1752 if test -n "$1"; then
cannam@162 1753 func_convert_core_msys_to_w32 "$1"
cannam@162 1754 func_cygpath -u "$func_convert_core_msys_to_w32_result"
cannam@162 1755 func_to_host_file_result="$func_cygpath_result"
cannam@162 1756 fi
cannam@162 1757 func_convert_file_check "$1" "$func_to_host_file_result"
cannam@162 1758 }
cannam@162 1759 # end func_convert_file_msys_to_cygwin
cannam@162 1760
cannam@162 1761
cannam@162 1762 # func_convert_file_nix_to_cygwin ARG
cannam@162 1763 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
cannam@162 1764 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
cannam@162 1765 # in func_to_host_file_result.
cannam@162 1766 func_convert_file_nix_to_cygwin ()
cannam@162 1767 {
cannam@162 1768 $opt_debug
cannam@162 1769 func_to_host_file_result="$1"
cannam@162 1770 if test -n "$1"; then
cannam@162 1771 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
cannam@162 1772 func_convert_core_file_wine_to_w32 "$1"
cannam@162 1773 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
cannam@162 1774 func_to_host_file_result="$func_cygpath_result"
cannam@162 1775 fi
cannam@162 1776 func_convert_file_check "$1" "$func_to_host_file_result"
cannam@162 1777 }
cannam@162 1778 # end func_convert_file_nix_to_cygwin
cannam@162 1779
cannam@162 1780
cannam@162 1781 #############################################
cannam@162 1782 # $build to $host PATH CONVERSION FUNCTIONS #
cannam@162 1783 #############################################
cannam@162 1784 # invoked via `$to_host_path_cmd ARG'
cannam@162 1785 #
cannam@162 1786 # In each case, ARG is the path to be converted from $build to $host format.
cannam@162 1787 # The result will be available in $func_to_host_path_result.
cannam@162 1788 #
cannam@162 1789 # Path separators are also converted from $build format to $host format. If
cannam@162 1790 # ARG begins or ends with a path separator character, it is preserved (but
cannam@162 1791 # converted to $host format) on output.
cannam@162 1792 #
cannam@162 1793 # All path conversion functions are named using the following convention:
cannam@162 1794 # file name conversion function : func_convert_file_X_to_Y ()
cannam@162 1795 # path conversion function : func_convert_path_X_to_Y ()
cannam@162 1796 # where, for any given $build/$host combination the 'X_to_Y' value is the
cannam@162 1797 # same. If conversion functions are added for new $build/$host combinations,
cannam@162 1798 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
cannam@162 1799 # will break.
cannam@162 1800
cannam@162 1801
cannam@162 1802 # func_init_to_host_path_cmd
cannam@162 1803 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
cannam@162 1804 # appropriate value, based on the value of $to_host_file_cmd.
cannam@162 1805 to_host_path_cmd=
cannam@162 1806 func_init_to_host_path_cmd ()
cannam@162 1807 {
cannam@162 1808 $opt_debug
cannam@162 1809 if test -z "$to_host_path_cmd"; then
cannam@162 1810 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
cannam@162 1811 to_host_path_cmd="func_convert_path_${func_stripname_result}"
cannam@162 1812 fi
cannam@162 1813 }
cannam@162 1814
cannam@162 1815
cannam@162 1816 # func_to_host_path ARG
cannam@162 1817 # Converts the path ARG from $build format to $host format. Return result
cannam@162 1818 # in func_to_host_path_result.
cannam@162 1819 func_to_host_path ()
cannam@162 1820 {
cannam@162 1821 $opt_debug
cannam@162 1822 func_init_to_host_path_cmd
cannam@162 1823 $to_host_path_cmd "$1"
cannam@162 1824 }
cannam@162 1825 # end func_to_host_path
cannam@162 1826
cannam@162 1827
cannam@162 1828 # func_convert_path_noop ARG
cannam@162 1829 # Copy ARG to func_to_host_path_result.
cannam@162 1830 func_convert_path_noop ()
cannam@162 1831 {
cannam@162 1832 func_to_host_path_result="$1"
cannam@162 1833 }
cannam@162 1834 # end func_convert_path_noop
cannam@162 1835
cannam@162 1836
cannam@162 1837 # func_convert_path_msys_to_w32 ARG
cannam@162 1838 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
cannam@162 1839 # conversion to w32 is not available inside the cwrapper. Returns result in
cannam@162 1840 # func_to_host_path_result.
cannam@162 1841 func_convert_path_msys_to_w32 ()
cannam@162 1842 {
cannam@162 1843 $opt_debug
cannam@162 1844 func_to_host_path_result="$1"
cannam@162 1845 if test -n "$1"; then
cannam@162 1846 # Remove leading and trailing path separator characters from ARG. MSYS
cannam@162 1847 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
cannam@162 1848 # and winepath ignores them completely.
cannam@162 1849 func_stripname : : "$1"
cannam@162 1850 func_to_host_path_tmp1=$func_stripname_result
cannam@162 1851 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
cannam@162 1852 func_to_host_path_result="$func_convert_core_msys_to_w32_result"
cannam@162 1853 func_convert_path_check : ";" \
cannam@162 1854 "$func_to_host_path_tmp1" "$func_to_host_path_result"
cannam@162 1855 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
cannam@162 1856 fi
cannam@162 1857 }
cannam@162 1858 # end func_convert_path_msys_to_w32
cannam@162 1859
cannam@162 1860
cannam@162 1861 # func_convert_path_cygwin_to_w32 ARG
cannam@162 1862 # Convert path ARG from Cygwin to w32 format. Returns result in
cannam@162 1863 # func_to_host_file_result.
cannam@162 1864 func_convert_path_cygwin_to_w32 ()
cannam@162 1865 {
cannam@162 1866 $opt_debug
cannam@162 1867 func_to_host_path_result="$1"
cannam@162 1868 if test -n "$1"; then
cannam@162 1869 # See func_convert_path_msys_to_w32:
cannam@162 1870 func_stripname : : "$1"
cannam@162 1871 func_to_host_path_tmp1=$func_stripname_result
cannam@162 1872 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
cannam@162 1873 func_convert_path_check : ";" \
cannam@162 1874 "$func_to_host_path_tmp1" "$func_to_host_path_result"
cannam@162 1875 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
cannam@162 1876 fi
cannam@162 1877 }
cannam@162 1878 # end func_convert_path_cygwin_to_w32
cannam@162 1879
cannam@162 1880
cannam@162 1881 # func_convert_path_nix_to_w32 ARG
cannam@162 1882 # Convert path ARG from *nix to w32 format. Requires a wine environment and
cannam@162 1883 # a working winepath. Returns result in func_to_host_file_result.
cannam@162 1884 func_convert_path_nix_to_w32 ()
cannam@162 1885 {
cannam@162 1886 $opt_debug
cannam@162 1887 func_to_host_path_result="$1"
cannam@162 1888 if test -n "$1"; then
cannam@162 1889 # See func_convert_path_msys_to_w32:
cannam@162 1890 func_stripname : : "$1"
cannam@162 1891 func_to_host_path_tmp1=$func_stripname_result
cannam@162 1892 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
cannam@162 1893 func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
cannam@162 1894 func_convert_path_check : ";" \
cannam@162 1895 "$func_to_host_path_tmp1" "$func_to_host_path_result"
cannam@162 1896 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
cannam@162 1897 fi
cannam@162 1898 }
cannam@162 1899 # end func_convert_path_nix_to_w32
cannam@162 1900
cannam@162 1901
cannam@162 1902 # func_convert_path_msys_to_cygwin ARG
cannam@162 1903 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
cannam@162 1904 # Returns result in func_to_host_file_result.
cannam@162 1905 func_convert_path_msys_to_cygwin ()
cannam@162 1906 {
cannam@162 1907 $opt_debug
cannam@162 1908 func_to_host_path_result="$1"
cannam@162 1909 if test -n "$1"; then
cannam@162 1910 # See func_convert_path_msys_to_w32:
cannam@162 1911 func_stripname : : "$1"
cannam@162 1912 func_to_host_path_tmp1=$func_stripname_result
cannam@162 1913 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
cannam@162 1914 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
cannam@162 1915 func_to_host_path_result="$func_cygpath_result"
cannam@162 1916 func_convert_path_check : : \
cannam@162 1917 "$func_to_host_path_tmp1" "$func_to_host_path_result"
cannam@162 1918 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
cannam@162 1919 fi
cannam@162 1920 }
cannam@162 1921 # end func_convert_path_msys_to_cygwin
cannam@162 1922
cannam@162 1923
cannam@162 1924 # func_convert_path_nix_to_cygwin ARG
cannam@162 1925 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
cannam@162 1926 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
cannam@162 1927 # func_to_host_file_result.
cannam@162 1928 func_convert_path_nix_to_cygwin ()
cannam@162 1929 {
cannam@162 1930 $opt_debug
cannam@162 1931 func_to_host_path_result="$1"
cannam@162 1932 if test -n "$1"; then
cannam@162 1933 # Remove leading and trailing path separator characters from
cannam@162 1934 # ARG. msys behavior is inconsistent here, cygpath turns them
cannam@162 1935 # into '.;' and ';.', and winepath ignores them completely.
cannam@162 1936 func_stripname : : "$1"
cannam@162 1937 func_to_host_path_tmp1=$func_stripname_result
cannam@162 1938 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
cannam@162 1939 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
cannam@162 1940 func_to_host_path_result="$func_cygpath_result"
cannam@162 1941 func_convert_path_check : : \
cannam@162 1942 "$func_to_host_path_tmp1" "$func_to_host_path_result"
cannam@162 1943 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
cannam@162 1944 fi
cannam@162 1945 }
cannam@162 1946 # end func_convert_path_nix_to_cygwin
cannam@162 1947
cannam@162 1948
cannam@162 1949 # func_mode_compile arg...
cannam@162 1950 func_mode_compile ()
cannam@162 1951 {
cannam@162 1952 $opt_debug
cannam@162 1953 # Get the compilation command and the source file.
cannam@162 1954 base_compile=
cannam@162 1955 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
cannam@162 1956 suppress_opt=yes
cannam@162 1957 suppress_output=
cannam@162 1958 arg_mode=normal
cannam@162 1959 libobj=
cannam@162 1960 later=
cannam@162 1961 pie_flag=
cannam@162 1962
cannam@162 1963 for arg
cannam@162 1964 do
cannam@162 1965 case $arg_mode in
cannam@162 1966 arg )
cannam@162 1967 # do not "continue". Instead, add this to base_compile
cannam@162 1968 lastarg="$arg"
cannam@162 1969 arg_mode=normal
cannam@162 1970 ;;
cannam@162 1971
cannam@162 1972 target )
cannam@162 1973 libobj="$arg"
cannam@162 1974 arg_mode=normal
cannam@162 1975 continue
cannam@162 1976 ;;
cannam@162 1977
cannam@162 1978 normal )
cannam@162 1979 # Accept any command-line options.
cannam@162 1980 case $arg in
cannam@162 1981 -o)
cannam@162 1982 test -n "$libobj" && \
cannam@162 1983 func_fatal_error "you cannot specify \`-o' more than once"
cannam@162 1984 arg_mode=target
cannam@162 1985 continue
cannam@162 1986 ;;
cannam@162 1987
cannam@162 1988 -pie | -fpie | -fPIE)
cannam@162 1989 func_append pie_flag " $arg"
cannam@162 1990 continue
cannam@162 1991 ;;
cannam@162 1992
cannam@162 1993 -shared | -static | -prefer-pic | -prefer-non-pic)
cannam@162 1994 func_append later " $arg"
cannam@162 1995 continue
cannam@162 1996 ;;
cannam@162 1997
cannam@162 1998 -no-suppress)
cannam@162 1999 suppress_opt=no
cannam@162 2000 continue
cannam@162 2001 ;;
cannam@162 2002
cannam@162 2003 -Xcompiler)
cannam@162 2004 arg_mode=arg # the next one goes into the "base_compile" arg list
cannam@162 2005 continue # The current "srcfile" will either be retained or
cannam@162 2006 ;; # replaced later. I would guess that would be a bug.
cannam@162 2007
cannam@162 2008 -Wc,*)
cannam@162 2009 func_stripname '-Wc,' '' "$arg"
cannam@162 2010 args=$func_stripname_result
cannam@162 2011 lastarg=
cannam@162 2012 save_ifs="$IFS"; IFS=','
cannam@162 2013 for arg in $args; do
cannam@162 2014 IFS="$save_ifs"
cannam@162 2015 func_append_quoted lastarg "$arg"
cannam@162 2016 done
cannam@162 2017 IFS="$save_ifs"
cannam@162 2018 func_stripname ' ' '' "$lastarg"
cannam@162 2019 lastarg=$func_stripname_result
cannam@162 2020
cannam@162 2021 # Add the arguments to base_compile.
cannam@162 2022 func_append base_compile " $lastarg"
cannam@162 2023 continue
cannam@162 2024 ;;
cannam@162 2025
cannam@162 2026 *)
cannam@162 2027 # Accept the current argument as the source file.
cannam@162 2028 # The previous "srcfile" becomes the current argument.
cannam@162 2029 #
cannam@162 2030 lastarg="$srcfile"
cannam@162 2031 srcfile="$arg"
cannam@162 2032 ;;
cannam@162 2033 esac # case $arg
cannam@162 2034 ;;
cannam@162 2035 esac # case $arg_mode
cannam@162 2036
cannam@162 2037 # Aesthetically quote the previous argument.
cannam@162 2038 func_append_quoted base_compile "$lastarg"
cannam@162 2039 done # for arg
cannam@162 2040
cannam@162 2041 case $arg_mode in
cannam@162 2042 arg)
cannam@162 2043 func_fatal_error "you must specify an argument for -Xcompile"
cannam@162 2044 ;;
cannam@162 2045 target)
cannam@162 2046 func_fatal_error "you must specify a target with \`-o'"
cannam@162 2047 ;;
cannam@162 2048 *)
cannam@162 2049 # Get the name of the library object.
cannam@162 2050 test -z "$libobj" && {
cannam@162 2051 func_basename "$srcfile"
cannam@162 2052 libobj="$func_basename_result"
cannam@162 2053 }
cannam@162 2054 ;;
cannam@162 2055 esac
cannam@162 2056
cannam@162 2057 # Recognize several different file suffixes.
cannam@162 2058 # If the user specifies -o file.o, it is replaced with file.lo
cannam@162 2059 case $libobj in
cannam@162 2060 *.[cCFSifmso] | \
cannam@162 2061 *.ada | *.adb | *.ads | *.asm | \
cannam@162 2062 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
cannam@162 2063 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
cannam@162 2064 func_xform "$libobj"
cannam@162 2065 libobj=$func_xform_result
cannam@162 2066 ;;
cannam@162 2067 esac
cannam@162 2068
cannam@162 2069 case $libobj in
cannam@162 2070 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
cannam@162 2071 *)
cannam@162 2072 func_fatal_error "cannot determine name of library object from \`$libobj'"
cannam@162 2073 ;;
cannam@162 2074 esac
cannam@162 2075
cannam@162 2076 func_infer_tag $base_compile
cannam@162 2077
cannam@162 2078 for arg in $later; do
cannam@162 2079 case $arg in
cannam@162 2080 -shared)
cannam@162 2081 test "$build_libtool_libs" != yes && \
cannam@162 2082 func_fatal_configuration "can not build a shared library"
cannam@162 2083 build_old_libs=no
cannam@162 2084 continue
cannam@162 2085 ;;
cannam@162 2086
cannam@162 2087 -static)
cannam@162 2088 build_libtool_libs=no
cannam@162 2089 build_old_libs=yes
cannam@162 2090 continue
cannam@162 2091 ;;
cannam@162 2092
cannam@162 2093 -prefer-pic)
cannam@162 2094 pic_mode=yes
cannam@162 2095 continue
cannam@162 2096 ;;
cannam@162 2097
cannam@162 2098 -prefer-non-pic)
cannam@162 2099 pic_mode=no
cannam@162 2100 continue
cannam@162 2101 ;;
cannam@162 2102 esac
cannam@162 2103 done
cannam@162 2104
cannam@162 2105 func_quote_for_eval "$libobj"
cannam@162 2106 test "X$libobj" != "X$func_quote_for_eval_result" \
cannam@162 2107 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
cannam@162 2108 && func_warning "libobj name \`$libobj' may not contain shell special characters."
cannam@162 2109 func_dirname_and_basename "$obj" "/" ""
cannam@162 2110 objname="$func_basename_result"
cannam@162 2111 xdir="$func_dirname_result"
cannam@162 2112 lobj=${xdir}$objdir/$objname
cannam@162 2113
cannam@162 2114 test -z "$base_compile" && \
cannam@162 2115 func_fatal_help "you must specify a compilation command"
cannam@162 2116
cannam@162 2117 # Delete any leftover library objects.
cannam@162 2118 if test "$build_old_libs" = yes; then
cannam@162 2119 removelist="$obj $lobj $libobj ${libobj}T"
cannam@162 2120 else
cannam@162 2121 removelist="$lobj $libobj ${libobj}T"
cannam@162 2122 fi
cannam@162 2123
cannam@162 2124 # On Cygwin there's no "real" PIC flag so we must build both object types
cannam@162 2125 case $host_os in
cannam@162 2126 cygwin* | mingw* | pw32* | os2* | cegcc*)
cannam@162 2127 pic_mode=default
cannam@162 2128 ;;
cannam@162 2129 esac
cannam@162 2130 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
cannam@162 2131 # non-PIC code in shared libraries is not supported
cannam@162 2132 pic_mode=default
cannam@162 2133 fi
cannam@162 2134
cannam@162 2135 # Calculate the filename of the output object if compiler does
cannam@162 2136 # not support -o with -c
cannam@162 2137 if test "$compiler_c_o" = no; then
cannam@162 2138 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
cannam@162 2139 lockfile="$output_obj.lock"
cannam@162 2140 else
cannam@162 2141 output_obj=
cannam@162 2142 need_locks=no
cannam@162 2143 lockfile=
cannam@162 2144 fi
cannam@162 2145
cannam@162 2146 # Lock this critical section if it is needed
cannam@162 2147 # We use this script file to make the link, it avoids creating a new file
cannam@162 2148 if test "$need_locks" = yes; then
cannam@162 2149 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
cannam@162 2150 func_echo "Waiting for $lockfile to be removed"
cannam@162 2151 sleep 2
cannam@162 2152 done
cannam@162 2153 elif test "$need_locks" = warn; then
cannam@162 2154 if test -f "$lockfile"; then
cannam@162 2155 $ECHO "\
cannam@162 2156 *** ERROR, $lockfile exists and contains:
cannam@162 2157 `cat $lockfile 2>/dev/null`
cannam@162 2158
cannam@162 2159 This indicates that another process is trying to use the same
cannam@162 2160 temporary object file, and libtool could not work around it because
cannam@162 2161 your compiler does not support \`-c' and \`-o' together. If you
cannam@162 2162 repeat this compilation, it may succeed, by chance, but you had better
cannam@162 2163 avoid parallel builds (make -j) in this platform, or get a better
cannam@162 2164 compiler."
cannam@162 2165
cannam@162 2166 $opt_dry_run || $RM $removelist
cannam@162 2167 exit $EXIT_FAILURE
cannam@162 2168 fi
cannam@162 2169 func_append removelist " $output_obj"
cannam@162 2170 $ECHO "$srcfile" > "$lockfile"
cannam@162 2171 fi
cannam@162 2172
cannam@162 2173 $opt_dry_run || $RM $removelist
cannam@162 2174 func_append removelist " $lockfile"
cannam@162 2175 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
cannam@162 2176
cannam@162 2177 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
cannam@162 2178 srcfile=$func_to_tool_file_result
cannam@162 2179 func_quote_for_eval "$srcfile"
cannam@162 2180 qsrcfile=$func_quote_for_eval_result
cannam@162 2181
cannam@162 2182 # Only build a PIC object if we are building libtool libraries.
cannam@162 2183 if test "$build_libtool_libs" = yes; then
cannam@162 2184 # Without this assignment, base_compile gets emptied.
cannam@162 2185 fbsd_hideous_sh_bug=$base_compile
cannam@162 2186
cannam@162 2187 if test "$pic_mode" != no; then
cannam@162 2188 command="$base_compile $qsrcfile $pic_flag"
cannam@162 2189 else
cannam@162 2190 # Don't build PIC code
cannam@162 2191 command="$base_compile $qsrcfile"
cannam@162 2192 fi
cannam@162 2193
cannam@162 2194 func_mkdir_p "$xdir$objdir"
cannam@162 2195
cannam@162 2196 if test -z "$output_obj"; then
cannam@162 2197 # Place PIC objects in $objdir
cannam@162 2198 func_append command " -o $lobj"
cannam@162 2199 fi
cannam@162 2200
cannam@162 2201 func_show_eval_locale "$command" \
cannam@162 2202 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
cannam@162 2203
cannam@162 2204 if test "$need_locks" = warn &&
cannam@162 2205 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
cannam@162 2206 $ECHO "\
cannam@162 2207 *** ERROR, $lockfile contains:
cannam@162 2208 `cat $lockfile 2>/dev/null`
cannam@162 2209
cannam@162 2210 but it should contain:
cannam@162 2211 $srcfile
cannam@162 2212
cannam@162 2213 This indicates that another process is trying to use the same
cannam@162 2214 temporary object file, and libtool could not work around it because
cannam@162 2215 your compiler does not support \`-c' and \`-o' together. If you
cannam@162 2216 repeat this compilation, it may succeed, by chance, but you had better
cannam@162 2217 avoid parallel builds (make -j) in this platform, or get a better
cannam@162 2218 compiler."
cannam@162 2219
cannam@162 2220 $opt_dry_run || $RM $removelist
cannam@162 2221 exit $EXIT_FAILURE
cannam@162 2222 fi
cannam@162 2223
cannam@162 2224 # Just move the object if needed, then go on to compile the next one
cannam@162 2225 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
cannam@162 2226 func_show_eval '$MV "$output_obj" "$lobj"' \
cannam@162 2227 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
cannam@162 2228 fi
cannam@162 2229
cannam@162 2230 # Allow error messages only from the first compilation.
cannam@162 2231 if test "$suppress_opt" = yes; then
cannam@162 2232 suppress_output=' >/dev/null 2>&1'
cannam@162 2233 fi
cannam@162 2234 fi
cannam@162 2235
cannam@162 2236 # Only build a position-dependent object if we build old libraries.
cannam@162 2237 if test "$build_old_libs" = yes; then
cannam@162 2238 if test "$pic_mode" != yes; then
cannam@162 2239 # Don't build PIC code
cannam@162 2240 command="$base_compile $qsrcfile$pie_flag"
cannam@162 2241 else
cannam@162 2242 command="$base_compile $qsrcfile $pic_flag"
cannam@162 2243 fi
cannam@162 2244 if test "$compiler_c_o" = yes; then
cannam@162 2245 func_append command " -o $obj"
cannam@162 2246 fi
cannam@162 2247
cannam@162 2248 # Suppress compiler output if we already did a PIC compilation.
cannam@162 2249 func_append command "$suppress_output"
cannam@162 2250 func_show_eval_locale "$command" \
cannam@162 2251 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
cannam@162 2252
cannam@162 2253 if test "$need_locks" = warn &&
cannam@162 2254 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
cannam@162 2255 $ECHO "\
cannam@162 2256 *** ERROR, $lockfile contains:
cannam@162 2257 `cat $lockfile 2>/dev/null`
cannam@162 2258
cannam@162 2259 but it should contain:
cannam@162 2260 $srcfile
cannam@162 2261
cannam@162 2262 This indicates that another process is trying to use the same
cannam@162 2263 temporary object file, and libtool could not work around it because
cannam@162 2264 your compiler does not support \`-c' and \`-o' together. If you
cannam@162 2265 repeat this compilation, it may succeed, by chance, but you had better
cannam@162 2266 avoid parallel builds (make -j) in this platform, or get a better
cannam@162 2267 compiler."
cannam@162 2268
cannam@162 2269 $opt_dry_run || $RM $removelist
cannam@162 2270 exit $EXIT_FAILURE
cannam@162 2271 fi
cannam@162 2272
cannam@162 2273 # Just move the object if needed
cannam@162 2274 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
cannam@162 2275 func_show_eval '$MV "$output_obj" "$obj"' \
cannam@162 2276 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
cannam@162 2277 fi
cannam@162 2278 fi
cannam@162 2279
cannam@162 2280 $opt_dry_run || {
cannam@162 2281 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
cannam@162 2282
cannam@162 2283 # Unlock the critical section if it was locked
cannam@162 2284 if test "$need_locks" != no; then
cannam@162 2285 removelist=$lockfile
cannam@162 2286 $RM "$lockfile"
cannam@162 2287 fi
cannam@162 2288 }
cannam@162 2289
cannam@162 2290 exit $EXIT_SUCCESS
cannam@162 2291 }
cannam@162 2292
cannam@162 2293 $opt_help || {
cannam@162 2294 test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
cannam@162 2295 }
cannam@162 2296
cannam@162 2297 func_mode_help ()
cannam@162 2298 {
cannam@162 2299 # We need to display help for each of the modes.
cannam@162 2300 case $opt_mode in
cannam@162 2301 "")
cannam@162 2302 # Generic help is extracted from the usage comments
cannam@162 2303 # at the start of this file.
cannam@162 2304 func_help
cannam@162 2305 ;;
cannam@162 2306
cannam@162 2307 clean)
cannam@162 2308 $ECHO \
cannam@162 2309 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
cannam@162 2310
cannam@162 2311 Remove files from the build directory.
cannam@162 2312
cannam@162 2313 RM is the name of the program to use to delete files associated with each FILE
cannam@162 2314 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
cannam@162 2315 to RM.
cannam@162 2316
cannam@162 2317 If FILE is a libtool library, object or program, all the files associated
cannam@162 2318 with it are deleted. Otherwise, only FILE itself is deleted using RM."
cannam@162 2319 ;;
cannam@162 2320
cannam@162 2321 compile)
cannam@162 2322 $ECHO \
cannam@162 2323 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
cannam@162 2324
cannam@162 2325 Compile a source file into a libtool library object.
cannam@162 2326
cannam@162 2327 This mode accepts the following additional options:
cannam@162 2328
cannam@162 2329 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
cannam@162 2330 -no-suppress do not suppress compiler output for multiple passes
cannam@162 2331 -prefer-pic try to build PIC objects only
cannam@162 2332 -prefer-non-pic try to build non-PIC objects only
cannam@162 2333 -shared do not build a \`.o' file suitable for static linking
cannam@162 2334 -static only build a \`.o' file suitable for static linking
cannam@162 2335 -Wc,FLAG pass FLAG directly to the compiler
cannam@162 2336
cannam@162 2337 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
cannam@162 2338 from the given SOURCEFILE.
cannam@162 2339
cannam@162 2340 The output file name is determined by removing the directory component from
cannam@162 2341 SOURCEFILE, then substituting the C source code suffix \`.c' with the
cannam@162 2342 library object suffix, \`.lo'."
cannam@162 2343 ;;
cannam@162 2344
cannam@162 2345 execute)
cannam@162 2346 $ECHO \
cannam@162 2347 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
cannam@162 2348
cannam@162 2349 Automatically set library path, then run a program.
cannam@162 2350
cannam@162 2351 This mode accepts the following additional options:
cannam@162 2352
cannam@162 2353 -dlopen FILE add the directory containing FILE to the library path
cannam@162 2354
cannam@162 2355 This mode sets the library path environment variable according to \`-dlopen'
cannam@162 2356 flags.
cannam@162 2357
cannam@162 2358 If any of the ARGS are libtool executable wrappers, then they are translated
cannam@162 2359 into their corresponding uninstalled binary, and any of their required library
cannam@162 2360 directories are added to the library path.
cannam@162 2361
cannam@162 2362 Then, COMMAND is executed, with ARGS as arguments."
cannam@162 2363 ;;
cannam@162 2364
cannam@162 2365 finish)
cannam@162 2366 $ECHO \
cannam@162 2367 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
cannam@162 2368
cannam@162 2369 Complete the installation of libtool libraries.
cannam@162 2370
cannam@162 2371 Each LIBDIR is a directory that contains libtool libraries.
cannam@162 2372
cannam@162 2373 The commands that this mode executes may require superuser privileges. Use
cannam@162 2374 the \`--dry-run' option if you just want to see what would be executed."
cannam@162 2375 ;;
cannam@162 2376
cannam@162 2377 install)
cannam@162 2378 $ECHO \
cannam@162 2379 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
cannam@162 2380
cannam@162 2381 Install executables or libraries.
cannam@162 2382
cannam@162 2383 INSTALL-COMMAND is the installation command. The first component should be
cannam@162 2384 either the \`install' or \`cp' program.
cannam@162 2385
cannam@162 2386 The following components of INSTALL-COMMAND are treated specially:
cannam@162 2387
cannam@162 2388 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
cannam@162 2389
cannam@162 2390 The rest of the components are interpreted as arguments to that command (only
cannam@162 2391 BSD-compatible install options are recognized)."
cannam@162 2392 ;;
cannam@162 2393
cannam@162 2394 link)
cannam@162 2395 $ECHO \
cannam@162 2396 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
cannam@162 2397
cannam@162 2398 Link object files or libraries together to form another library, or to
cannam@162 2399 create an executable program.
cannam@162 2400
cannam@162 2401 LINK-COMMAND is a command using the C compiler that you would use to create
cannam@162 2402 a program from several object files.
cannam@162 2403
cannam@162 2404 The following components of LINK-COMMAND are treated specially:
cannam@162 2405
cannam@162 2406 -all-static do not do any dynamic linking at all
cannam@162 2407 -avoid-version do not add a version suffix if possible
cannam@162 2408 -bindir BINDIR specify path to binaries directory (for systems where
cannam@162 2409 libraries must be found in the PATH setting at runtime)
cannam@162 2410 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
cannam@162 2411 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
cannam@162 2412 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
cannam@162 2413 -export-symbols SYMFILE
cannam@162 2414 try to export only the symbols listed in SYMFILE
cannam@162 2415 -export-symbols-regex REGEX
cannam@162 2416 try to export only the symbols matching REGEX
cannam@162 2417 -LLIBDIR search LIBDIR for required installed libraries
cannam@162 2418 -lNAME OUTPUT-FILE requires the installed library libNAME
cannam@162 2419 -module build a library that can dlopened
cannam@162 2420 -no-fast-install disable the fast-install mode
cannam@162 2421 -no-install link a not-installable executable
cannam@162 2422 -no-undefined declare that a library does not refer to external symbols
cannam@162 2423 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
cannam@162 2424 -objectlist FILE Use a list of object files found in FILE to specify objects
cannam@162 2425 -precious-files-regex REGEX
cannam@162 2426 don't remove output files matching REGEX
cannam@162 2427 -release RELEASE specify package release information
cannam@162 2428 -rpath LIBDIR the created library will eventually be installed in LIBDIR
cannam@162 2429 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
cannam@162 2430 -shared only do dynamic linking of libtool libraries
cannam@162 2431 -shrext SUFFIX override the standard shared library file extension
cannam@162 2432 -static do not do any dynamic linking of uninstalled libtool libraries
cannam@162 2433 -static-libtool-libs
cannam@162 2434 do not do any dynamic linking of libtool libraries
cannam@162 2435 -version-info CURRENT[:REVISION[:AGE]]
cannam@162 2436 specify library version info [each variable defaults to 0]
cannam@162 2437 -weak LIBNAME declare that the target provides the LIBNAME interface
cannam@162 2438 -Wc,FLAG
cannam@162 2439 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
cannam@162 2440 -Wl,FLAG
cannam@162 2441 -Xlinker FLAG pass linker-specific FLAG directly to the linker
cannam@162 2442 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
cannam@162 2443
cannam@162 2444 All other options (arguments beginning with \`-') are ignored.
cannam@162 2445
cannam@162 2446 Every other argument is treated as a filename. Files ending in \`.la' are
cannam@162 2447 treated as uninstalled libtool libraries, other files are standard or library
cannam@162 2448 object files.
cannam@162 2449
cannam@162 2450 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
cannam@162 2451 only library objects (\`.lo' files) may be specified, and \`-rpath' is
cannam@162 2452 required, except when creating a convenience library.
cannam@162 2453
cannam@162 2454 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
cannam@162 2455 using \`ar' and \`ranlib', or on Windows using \`lib'.
cannam@162 2456
cannam@162 2457 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
cannam@162 2458 is created, otherwise an executable program is created."
cannam@162 2459 ;;
cannam@162 2460
cannam@162 2461 uninstall)
cannam@162 2462 $ECHO \
cannam@162 2463 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
cannam@162 2464
cannam@162 2465 Remove libraries from an installation directory.
cannam@162 2466
cannam@162 2467 RM is the name of the program to use to delete files associated with each FILE
cannam@162 2468 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
cannam@162 2469 to RM.
cannam@162 2470
cannam@162 2471 If FILE is a libtool library, all the files associated with it are deleted.
cannam@162 2472 Otherwise, only FILE itself is deleted using RM."
cannam@162 2473 ;;
cannam@162 2474
cannam@162 2475 *)
cannam@162 2476 func_fatal_help "invalid operation mode \`$opt_mode'"
cannam@162 2477 ;;
cannam@162 2478 esac
cannam@162 2479
cannam@162 2480 echo
cannam@162 2481 $ECHO "Try \`$progname --help' for more information about other modes."
cannam@162 2482 }
cannam@162 2483
cannam@162 2484 # Now that we've collected a possible --mode arg, show help if necessary
cannam@162 2485 if $opt_help; then
cannam@162 2486 if test "$opt_help" = :; then
cannam@162 2487 func_mode_help
cannam@162 2488 else
cannam@162 2489 {
cannam@162 2490 func_help noexit
cannam@162 2491 for opt_mode in compile link execute install finish uninstall clean; do
cannam@162 2492 func_mode_help
cannam@162 2493 done
cannam@162 2494 } | sed -n '1p; 2,$s/^Usage:/ or: /p'
cannam@162 2495 {
cannam@162 2496 func_help noexit
cannam@162 2497 for opt_mode in compile link execute install finish uninstall clean; do
cannam@162 2498 echo
cannam@162 2499 func_mode_help
cannam@162 2500 done
cannam@162 2501 } |
cannam@162 2502 sed '1d
cannam@162 2503 /^When reporting/,/^Report/{
cannam@162 2504 H
cannam@162 2505 d
cannam@162 2506 }
cannam@162 2507 $x
cannam@162 2508 /information about other modes/d
cannam@162 2509 /more detailed .*MODE/d
cannam@162 2510 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
cannam@162 2511 fi
cannam@162 2512 exit $?
cannam@162 2513 fi
cannam@162 2514
cannam@162 2515
cannam@162 2516 # func_mode_execute arg...
cannam@162 2517 func_mode_execute ()
cannam@162 2518 {
cannam@162 2519 $opt_debug
cannam@162 2520 # The first argument is the command name.
cannam@162 2521 cmd="$nonopt"
cannam@162 2522 test -z "$cmd" && \
cannam@162 2523 func_fatal_help "you must specify a COMMAND"
cannam@162 2524
cannam@162 2525 # Handle -dlopen flags immediately.
cannam@162 2526 for file in $opt_dlopen; do
cannam@162 2527 test -f "$file" \
cannam@162 2528 || func_fatal_help "\`$file' is not a file"
cannam@162 2529
cannam@162 2530 dir=
cannam@162 2531 case $file in
cannam@162 2532 *.la)
cannam@162 2533 func_resolve_sysroot "$file"
cannam@162 2534 file=$func_resolve_sysroot_result
cannam@162 2535
cannam@162 2536 # Check to see that this really is a libtool archive.
cannam@162 2537 func_lalib_unsafe_p "$file" \
cannam@162 2538 || func_fatal_help "\`$lib' is not a valid libtool archive"
cannam@162 2539
cannam@162 2540 # Read the libtool library.
cannam@162 2541 dlname=
cannam@162 2542 library_names=
cannam@162 2543 func_source "$file"
cannam@162 2544
cannam@162 2545 # Skip this library if it cannot be dlopened.
cannam@162 2546 if test -z "$dlname"; then
cannam@162 2547 # Warn if it was a shared library.
cannam@162 2548 test -n "$library_names" && \
cannam@162 2549 func_warning "\`$file' was not linked with \`-export-dynamic'"
cannam@162 2550 continue
cannam@162 2551 fi
cannam@162 2552
cannam@162 2553 func_dirname "$file" "" "."
cannam@162 2554 dir="$func_dirname_result"
cannam@162 2555
cannam@162 2556 if test -f "$dir/$objdir/$dlname"; then
cannam@162 2557 func_append dir "/$objdir"
cannam@162 2558 else
cannam@162 2559 if test ! -f "$dir/$dlname"; then
cannam@162 2560 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
cannam@162 2561 fi
cannam@162 2562 fi
cannam@162 2563 ;;
cannam@162 2564
cannam@162 2565 *.lo)
cannam@162 2566 # Just add the directory containing the .lo file.
cannam@162 2567 func_dirname "$file" "" "."
cannam@162 2568 dir="$func_dirname_result"
cannam@162 2569 ;;
cannam@162 2570
cannam@162 2571 *)
cannam@162 2572 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
cannam@162 2573 continue
cannam@162 2574 ;;
cannam@162 2575 esac
cannam@162 2576
cannam@162 2577 # Get the absolute pathname.
cannam@162 2578 absdir=`cd "$dir" && pwd`
cannam@162 2579 test -n "$absdir" && dir="$absdir"
cannam@162 2580
cannam@162 2581 # Now add the directory to shlibpath_var.
cannam@162 2582 if eval "test -z \"\$$shlibpath_var\""; then
cannam@162 2583 eval "$shlibpath_var=\"\$dir\""
cannam@162 2584 else
cannam@162 2585 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
cannam@162 2586 fi
cannam@162 2587 done
cannam@162 2588
cannam@162 2589 # This variable tells wrapper scripts just to set shlibpath_var
cannam@162 2590 # rather than running their programs.
cannam@162 2591 libtool_execute_magic="$magic"
cannam@162 2592
cannam@162 2593 # Check if any of the arguments is a wrapper script.
cannam@162 2594 args=
cannam@162 2595 for file
cannam@162 2596 do
cannam@162 2597 case $file in
cannam@162 2598 -* | *.la | *.lo ) ;;
cannam@162 2599 *)
cannam@162 2600 # Do a test to see if this is really a libtool program.
cannam@162 2601 if func_ltwrapper_script_p "$file"; then
cannam@162 2602 func_source "$file"
cannam@162 2603 # Transform arg to wrapped name.
cannam@162 2604 file="$progdir/$program"
cannam@162 2605 elif func_ltwrapper_executable_p "$file"; then
cannam@162 2606 func_ltwrapper_scriptname "$file"
cannam@162 2607 func_source "$func_ltwrapper_scriptname_result"
cannam@162 2608 # Transform arg to wrapped name.
cannam@162 2609 file="$progdir/$program"
cannam@162 2610 fi
cannam@162 2611 ;;
cannam@162 2612 esac
cannam@162 2613 # Quote arguments (to preserve shell metacharacters).
cannam@162 2614 func_append_quoted args "$file"
cannam@162 2615 done
cannam@162 2616
cannam@162 2617 if test "X$opt_dry_run" = Xfalse; then
cannam@162 2618 if test -n "$shlibpath_var"; then
cannam@162 2619 # Export the shlibpath_var.
cannam@162 2620 eval "export $shlibpath_var"
cannam@162 2621 fi
cannam@162 2622
cannam@162 2623 # Restore saved environment variables
cannam@162 2624 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
cannam@162 2625 do
cannam@162 2626 eval "if test \"\${save_$lt_var+set}\" = set; then
cannam@162 2627 $lt_var=\$save_$lt_var; export $lt_var
cannam@162 2628 else
cannam@162 2629 $lt_unset $lt_var
cannam@162 2630 fi"
cannam@162 2631 done
cannam@162 2632
cannam@162 2633 # Now prepare to actually exec the command.
cannam@162 2634 exec_cmd="\$cmd$args"
cannam@162 2635 else
cannam@162 2636 # Display what would be done.
cannam@162 2637 if test -n "$shlibpath_var"; then
cannam@162 2638 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
cannam@162 2639 echo "export $shlibpath_var"
cannam@162 2640 fi
cannam@162 2641 $ECHO "$cmd$args"
cannam@162 2642 exit $EXIT_SUCCESS
cannam@162 2643 fi
cannam@162 2644 }
cannam@162 2645
cannam@162 2646 test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
cannam@162 2647
cannam@162 2648
cannam@162 2649 # func_mode_finish arg...
cannam@162 2650 func_mode_finish ()
cannam@162 2651 {
cannam@162 2652 $opt_debug
cannam@162 2653 libs=
cannam@162 2654 libdirs=
cannam@162 2655 admincmds=
cannam@162 2656
cannam@162 2657 for opt in "$nonopt" ${1+"$@"}
cannam@162 2658 do
cannam@162 2659 if test -d "$opt"; then
cannam@162 2660 func_append libdirs " $opt"
cannam@162 2661
cannam@162 2662 elif test -f "$opt"; then
cannam@162 2663 if func_lalib_unsafe_p "$opt"; then
cannam@162 2664 func_append libs " $opt"
cannam@162 2665 else
cannam@162 2666 func_warning "\`$opt' is not a valid libtool archive"
cannam@162 2667 fi
cannam@162 2668
cannam@162 2669 else
cannam@162 2670 func_fatal_error "invalid argument \`$opt'"
cannam@162 2671 fi
cannam@162 2672 done
cannam@162 2673
cannam@162 2674 if test -n "$libs"; then
cannam@162 2675 if test -n "$lt_sysroot"; then
cannam@162 2676 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
cannam@162 2677 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
cannam@162 2678 else
cannam@162 2679 sysroot_cmd=
cannam@162 2680 fi
cannam@162 2681
cannam@162 2682 # Remove sysroot references
cannam@162 2683 if $opt_dry_run; then
cannam@162 2684 for lib in $libs; do
cannam@162 2685 echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
cannam@162 2686 done
cannam@162 2687 else
cannam@162 2688 tmpdir=`func_mktempdir`
cannam@162 2689 for lib in $libs; do
cannam@162 2690 sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
cannam@162 2691 > $tmpdir/tmp-la
cannam@162 2692 mv -f $tmpdir/tmp-la $lib
cannam@162 2693 done
cannam@162 2694 ${RM}r "$tmpdir"
cannam@162 2695 fi
cannam@162 2696 fi
cannam@162 2697
cannam@162 2698 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
cannam@162 2699 for libdir in $libdirs; do
cannam@162 2700 if test -n "$finish_cmds"; then
cannam@162 2701 # Do each command in the finish commands.
cannam@162 2702 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
cannam@162 2703 '"$cmd"'"'
cannam@162 2704 fi
cannam@162 2705 if test -n "$finish_eval"; then
cannam@162 2706 # Do the single finish_eval.
cannam@162 2707 eval cmds=\"$finish_eval\"
cannam@162 2708 $opt_dry_run || eval "$cmds" || func_append admincmds "
cannam@162 2709 $cmds"
cannam@162 2710 fi
cannam@162 2711 done
cannam@162 2712 fi
cannam@162 2713
cannam@162 2714 # Exit here if they wanted silent mode.
cannam@162 2715 $opt_silent && exit $EXIT_SUCCESS
cannam@162 2716
cannam@162 2717 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
cannam@162 2718 echo "----------------------------------------------------------------------"
cannam@162 2719 echo "Libraries have been installed in:"
cannam@162 2720 for libdir in $libdirs; do
cannam@162 2721 $ECHO " $libdir"
cannam@162 2722 done
cannam@162 2723 echo
cannam@162 2724 echo "If you ever happen to want to link against installed libraries"
cannam@162 2725 echo "in a given directory, LIBDIR, you must either use libtool, and"
cannam@162 2726 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
cannam@162 2727 echo "flag during linking and do at least one of the following:"
cannam@162 2728 if test -n "$shlibpath_var"; then
cannam@162 2729 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
cannam@162 2730 echo " during execution"
cannam@162 2731 fi
cannam@162 2732 if test -n "$runpath_var"; then
cannam@162 2733 echo " - add LIBDIR to the \`$runpath_var' environment variable"
cannam@162 2734 echo " during linking"
cannam@162 2735 fi
cannam@162 2736 if test -n "$hardcode_libdir_flag_spec"; then
cannam@162 2737 libdir=LIBDIR
cannam@162 2738 eval flag=\"$hardcode_libdir_flag_spec\"
cannam@162 2739
cannam@162 2740 $ECHO " - use the \`$flag' linker flag"
cannam@162 2741 fi
cannam@162 2742 if test -n "$admincmds"; then
cannam@162 2743 $ECHO " - have your system administrator run these commands:$admincmds"
cannam@162 2744 fi
cannam@162 2745 if test -f /etc/ld.so.conf; then
cannam@162 2746 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
cannam@162 2747 fi
cannam@162 2748 echo
cannam@162 2749
cannam@162 2750 echo "See any operating system documentation about shared libraries for"
cannam@162 2751 case $host in
cannam@162 2752 solaris2.[6789]|solaris2.1[0-9])
cannam@162 2753 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
cannam@162 2754 echo "pages."
cannam@162 2755 ;;
cannam@162 2756 *)
cannam@162 2757 echo "more information, such as the ld(1) and ld.so(8) manual pages."
cannam@162 2758 ;;
cannam@162 2759 esac
cannam@162 2760 echo "----------------------------------------------------------------------"
cannam@162 2761 fi
cannam@162 2762 exit $EXIT_SUCCESS
cannam@162 2763 }
cannam@162 2764
cannam@162 2765 test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
cannam@162 2766
cannam@162 2767
cannam@162 2768 # func_mode_install arg...
cannam@162 2769 func_mode_install ()
cannam@162 2770 {
cannam@162 2771 $opt_debug
cannam@162 2772 # There may be an optional sh(1) argument at the beginning of
cannam@162 2773 # install_prog (especially on Windows NT).
cannam@162 2774 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
cannam@162 2775 # Allow the use of GNU shtool's install command.
cannam@162 2776 case $nonopt in *shtool*) :;; *) false;; esac; then
cannam@162 2777 # Aesthetically quote it.
cannam@162 2778 func_quote_for_eval "$nonopt"
cannam@162 2779 install_prog="$func_quote_for_eval_result "
cannam@162 2780 arg=$1
cannam@162 2781 shift
cannam@162 2782 else
cannam@162 2783 install_prog=
cannam@162 2784 arg=$nonopt
cannam@162 2785 fi
cannam@162 2786
cannam@162 2787 # The real first argument should be the name of the installation program.
cannam@162 2788 # Aesthetically quote it.
cannam@162 2789 func_quote_for_eval "$arg"
cannam@162 2790 func_append install_prog "$func_quote_for_eval_result"
cannam@162 2791 install_shared_prog=$install_prog
cannam@162 2792 case " $install_prog " in
cannam@162 2793 *[\\\ /]cp\ *) install_cp=: ;;
cannam@162 2794 *) install_cp=false ;;
cannam@162 2795 esac
cannam@162 2796
cannam@162 2797 # We need to accept at least all the BSD install flags.
cannam@162 2798 dest=
cannam@162 2799 files=
cannam@162 2800 opts=
cannam@162 2801 prev=
cannam@162 2802 install_type=
cannam@162 2803 isdir=no
cannam@162 2804 stripme=
cannam@162 2805 no_mode=:
cannam@162 2806 for arg
cannam@162 2807 do
cannam@162 2808 arg2=
cannam@162 2809 if test -n "$dest"; then
cannam@162 2810 func_append files " $dest"
cannam@162 2811 dest=$arg
cannam@162 2812 continue
cannam@162 2813 fi
cannam@162 2814
cannam@162 2815 case $arg in
cannam@162 2816 -d) isdir=yes ;;
cannam@162 2817 -f)
cannam@162 2818 if $install_cp; then :; else
cannam@162 2819 prev=$arg
cannam@162 2820 fi
cannam@162 2821 ;;
cannam@162 2822 -g | -m | -o)
cannam@162 2823 prev=$arg
cannam@162 2824 ;;
cannam@162 2825 -s)
cannam@162 2826 stripme=" -s"
cannam@162 2827 continue
cannam@162 2828 ;;
cannam@162 2829 -*)
cannam@162 2830 ;;
cannam@162 2831 *)
cannam@162 2832 # If the previous option needed an argument, then skip it.
cannam@162 2833 if test -n "$prev"; then
cannam@162 2834 if test "x$prev" = x-m && test -n "$install_override_mode"; then
cannam@162 2835 arg2=$install_override_mode
cannam@162 2836 no_mode=false
cannam@162 2837 fi
cannam@162 2838 prev=
cannam@162 2839 else
cannam@162 2840 dest=$arg
cannam@162 2841 continue
cannam@162 2842 fi
cannam@162 2843 ;;
cannam@162 2844 esac
cannam@162 2845
cannam@162 2846 # Aesthetically quote the argument.
cannam@162 2847 func_quote_for_eval "$arg"
cannam@162 2848 func_append install_prog " $func_quote_for_eval_result"
cannam@162 2849 if test -n "$arg2"; then
cannam@162 2850 func_quote_for_eval "$arg2"
cannam@162 2851 fi
cannam@162 2852 func_append install_shared_prog " $func_quote_for_eval_result"
cannam@162 2853 done
cannam@162 2854
cannam@162 2855 test -z "$install_prog" && \
cannam@162 2856 func_fatal_help "you must specify an install program"
cannam@162 2857
cannam@162 2858 test -n "$prev" && \
cannam@162 2859 func_fatal_help "the \`$prev' option requires an argument"
cannam@162 2860
cannam@162 2861 if test -n "$install_override_mode" && $no_mode; then
cannam@162 2862 if $install_cp; then :; else
cannam@162 2863 func_quote_for_eval "$install_override_mode"
cannam@162 2864 func_append install_shared_prog " -m $func_quote_for_eval_result"
cannam@162 2865 fi
cannam@162 2866 fi
cannam@162 2867
cannam@162 2868 if test -z "$files"; then
cannam@162 2869 if test -z "$dest"; then
cannam@162 2870 func_fatal_help "no file or destination specified"
cannam@162 2871 else
cannam@162 2872 func_fatal_help "you must specify a destination"
cannam@162 2873 fi
cannam@162 2874 fi
cannam@162 2875
cannam@162 2876 # Strip any trailing slash from the destination.
cannam@162 2877 func_stripname '' '/' "$dest"
cannam@162 2878 dest=$func_stripname_result
cannam@162 2879
cannam@162 2880 # Check to see that the destination is a directory.
cannam@162 2881 test -d "$dest" && isdir=yes
cannam@162 2882 if test "$isdir" = yes; then
cannam@162 2883 destdir="$dest"
cannam@162 2884 destname=
cannam@162 2885 else
cannam@162 2886 func_dirname_and_basename "$dest" "" "."
cannam@162 2887 destdir="$func_dirname_result"
cannam@162 2888 destname="$func_basename_result"
cannam@162 2889
cannam@162 2890 # Not a directory, so check to see that there is only one file specified.
cannam@162 2891 set dummy $files; shift
cannam@162 2892 test "$#" -gt 1 && \
cannam@162 2893 func_fatal_help "\`$dest' is not a directory"
cannam@162 2894 fi
cannam@162 2895 case $destdir in
cannam@162 2896 [\\/]* | [A-Za-z]:[\\/]*) ;;
cannam@162 2897 *)
cannam@162 2898 for file in $files; do
cannam@162 2899 case $file in
cannam@162 2900 *.lo) ;;
cannam@162 2901 *)
cannam@162 2902 func_fatal_help "\`$destdir' must be an absolute directory name"
cannam@162 2903 ;;
cannam@162 2904 esac
cannam@162 2905 done
cannam@162 2906 ;;
cannam@162 2907 esac
cannam@162 2908
cannam@162 2909 # This variable tells wrapper scripts just to set variables rather
cannam@162 2910 # than running their programs.
cannam@162 2911 libtool_install_magic="$magic"
cannam@162 2912
cannam@162 2913 staticlibs=
cannam@162 2914 future_libdirs=
cannam@162 2915 current_libdirs=
cannam@162 2916 for file in $files; do
cannam@162 2917
cannam@162 2918 # Do each installation.
cannam@162 2919 case $file in
cannam@162 2920 *.$libext)
cannam@162 2921 # Do the static libraries later.
cannam@162 2922 func_append staticlibs " $file"
cannam@162 2923 ;;
cannam@162 2924
cannam@162 2925 *.la)
cannam@162 2926 func_resolve_sysroot "$file"
cannam@162 2927 file=$func_resolve_sysroot_result
cannam@162 2928
cannam@162 2929 # Check to see that this really is a libtool archive.
cannam@162 2930 func_lalib_unsafe_p "$file" \
cannam@162 2931 || func_fatal_help "\`$file' is not a valid libtool archive"
cannam@162 2932
cannam@162 2933 library_names=
cannam@162 2934 old_library=
cannam@162 2935 relink_command=
cannam@162 2936 func_source "$file"
cannam@162 2937
cannam@162 2938 # Add the libdir to current_libdirs if it is the destination.
cannam@162 2939 if test "X$destdir" = "X$libdir"; then
cannam@162 2940 case "$current_libdirs " in
cannam@162 2941 *" $libdir "*) ;;
cannam@162 2942 *) func_append current_libdirs " $libdir" ;;
cannam@162 2943 esac
cannam@162 2944 else
cannam@162 2945 # Note the libdir as a future libdir.
cannam@162 2946 case "$future_libdirs " in
cannam@162 2947 *" $libdir "*) ;;
cannam@162 2948 *) func_append future_libdirs " $libdir" ;;
cannam@162 2949 esac
cannam@162 2950 fi
cannam@162 2951
cannam@162 2952 func_dirname "$file" "/" ""
cannam@162 2953 dir="$func_dirname_result"
cannam@162 2954 func_append dir "$objdir"
cannam@162 2955
cannam@162 2956 if test -n "$relink_command"; then
cannam@162 2957 # Determine the prefix the user has applied to our future dir.
cannam@162 2958 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
cannam@162 2959
cannam@162 2960 # Don't allow the user to place us outside of our expected
cannam@162 2961 # location b/c this prevents finding dependent libraries that
cannam@162 2962 # are installed to the same prefix.
cannam@162 2963 # At present, this check doesn't affect windows .dll's that
cannam@162 2964 # are installed into $libdir/../bin (currently, that works fine)
cannam@162 2965 # but it's something to keep an eye on.
cannam@162 2966 test "$inst_prefix_dir" = "$destdir" && \
cannam@162 2967 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
cannam@162 2968
cannam@162 2969 if test -n "$inst_prefix_dir"; then
cannam@162 2970 # Stick the inst_prefix_dir data into the link command.
cannam@162 2971 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
cannam@162 2972 else
cannam@162 2973 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
cannam@162 2974 fi
cannam@162 2975
cannam@162 2976 func_warning "relinking \`$file'"
cannam@162 2977 func_show_eval "$relink_command" \
cannam@162 2978 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
cannam@162 2979 fi
cannam@162 2980
cannam@162 2981 # See the names of the shared library.
cannam@162 2982 set dummy $library_names; shift
cannam@162 2983 if test -n "$1"; then
cannam@162 2984 realname="$1"
cannam@162 2985 shift
cannam@162 2986
cannam@162 2987 srcname="$realname"
cannam@162 2988 test -n "$relink_command" && srcname="$realname"T
cannam@162 2989
cannam@162 2990 # Install the shared library and build the symlinks.
cannam@162 2991 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
cannam@162 2992 'exit $?'
cannam@162 2993 tstripme="$stripme"
cannam@162 2994 case $host_os in
cannam@162 2995 cygwin* | mingw* | pw32* | cegcc*)
cannam@162 2996 case $realname in
cannam@162 2997 *.dll.a)
cannam@162 2998 tstripme=""
cannam@162 2999 ;;
cannam@162 3000 esac
cannam@162 3001 ;;
cannam@162 3002 esac
cannam@162 3003 if test -n "$tstripme" && test -n "$striplib"; then
cannam@162 3004 func_show_eval "$striplib $destdir/$realname" 'exit $?'
cannam@162 3005 fi
cannam@162 3006
cannam@162 3007 if test "$#" -gt 0; then
cannam@162 3008 # Delete the old symlinks, and create new ones.
cannam@162 3009 # Try `ln -sf' first, because the `ln' binary might depend on
cannam@162 3010 # the symlink we replace! Solaris /bin/ln does not understand -f,
cannam@162 3011 # so we also need to try rm && ln -s.
cannam@162 3012 for linkname
cannam@162 3013 do
cannam@162 3014 test "$linkname" != "$realname" \
cannam@162 3015 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
cannam@162 3016 done
cannam@162 3017 fi
cannam@162 3018
cannam@162 3019 # Do each command in the postinstall commands.
cannam@162 3020 lib="$destdir/$realname"
cannam@162 3021 func_execute_cmds "$postinstall_cmds" 'exit $?'
cannam@162 3022 fi
cannam@162 3023
cannam@162 3024 # Install the pseudo-library for information purposes.
cannam@162 3025 func_basename "$file"
cannam@162 3026 name="$func_basename_result"
cannam@162 3027 instname="$dir/$name"i
cannam@162 3028 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
cannam@162 3029
cannam@162 3030 # Maybe install the static library, too.
cannam@162 3031 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
cannam@162 3032 ;;
cannam@162 3033
cannam@162 3034 *.lo)
cannam@162 3035 # Install (i.e. copy) a libtool object.
cannam@162 3036
cannam@162 3037 # Figure out destination file name, if it wasn't already specified.
cannam@162 3038 if test -n "$destname"; then
cannam@162 3039 destfile="$destdir/$destname"
cannam@162 3040 else
cannam@162 3041 func_basename "$file"
cannam@162 3042 destfile="$func_basename_result"
cannam@162 3043 destfile="$destdir/$destfile"
cannam@162 3044 fi
cannam@162 3045
cannam@162 3046 # Deduce the name of the destination old-style object file.
cannam@162 3047 case $destfile in
cannam@162 3048 *.lo)
cannam@162 3049 func_lo2o "$destfile"
cannam@162 3050 staticdest=$func_lo2o_result
cannam@162 3051 ;;
cannam@162 3052 *.$objext)
cannam@162 3053 staticdest="$destfile"
cannam@162 3054 destfile=
cannam@162 3055 ;;
cannam@162 3056 *)
cannam@162 3057 func_fatal_help "cannot copy a libtool object to \`$destfile'"
cannam@162 3058 ;;
cannam@162 3059 esac
cannam@162 3060
cannam@162 3061 # Install the libtool object if requested.
cannam@162 3062 test -n "$destfile" && \
cannam@162 3063 func_show_eval "$install_prog $file $destfile" 'exit $?'
cannam@162 3064
cannam@162 3065 # Install the old object if enabled.
cannam@162 3066 if test "$build_old_libs" = yes; then
cannam@162 3067 # Deduce the name of the old-style object file.
cannam@162 3068 func_lo2o "$file"
cannam@162 3069 staticobj=$func_lo2o_result
cannam@162 3070 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
cannam@162 3071 fi
cannam@162 3072 exit $EXIT_SUCCESS
cannam@162 3073 ;;
cannam@162 3074
cannam@162 3075 *)
cannam@162 3076 # Figure out destination file name, if it wasn't already specified.
cannam@162 3077 if test -n "$destname"; then
cannam@162 3078 destfile="$destdir/$destname"
cannam@162 3079 else
cannam@162 3080 func_basename "$file"
cannam@162 3081 destfile="$func_basename_result"
cannam@162 3082 destfile="$destdir/$destfile"
cannam@162 3083 fi
cannam@162 3084
cannam@162 3085 # If the file is missing, and there is a .exe on the end, strip it
cannam@162 3086 # because it is most likely a libtool script we actually want to
cannam@162 3087 # install
cannam@162 3088 stripped_ext=""
cannam@162 3089 case $file in
cannam@162 3090 *.exe)
cannam@162 3091 if test ! -f "$file"; then
cannam@162 3092 func_stripname '' '.exe' "$file"
cannam@162 3093 file=$func_stripname_result
cannam@162 3094 stripped_ext=".exe"
cannam@162 3095 fi
cannam@162 3096 ;;
cannam@162 3097 esac
cannam@162 3098
cannam@162 3099 # Do a test to see if this is really a libtool program.
cannam@162 3100 case $host in
cannam@162 3101 *cygwin* | *mingw*)
cannam@162 3102 if func_ltwrapper_executable_p "$file"; then
cannam@162 3103 func_ltwrapper_scriptname "$file"
cannam@162 3104 wrapper=$func_ltwrapper_scriptname_result
cannam@162 3105 else
cannam@162 3106 func_stripname '' '.exe' "$file"
cannam@162 3107 wrapper=$func_stripname_result
cannam@162 3108 fi
cannam@162 3109 ;;
cannam@162 3110 *)
cannam@162 3111 wrapper=$file
cannam@162 3112 ;;
cannam@162 3113 esac
cannam@162 3114 if func_ltwrapper_script_p "$wrapper"; then
cannam@162 3115 notinst_deplibs=
cannam@162 3116 relink_command=
cannam@162 3117
cannam@162 3118 func_source "$wrapper"
cannam@162 3119
cannam@162 3120 # Check the variables that should have been set.
cannam@162 3121 test -z "$generated_by_libtool_version" && \
cannam@162 3122 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
cannam@162 3123
cannam@162 3124 finalize=yes
cannam@162 3125 for lib in $notinst_deplibs; do
cannam@162 3126 # Check to see that each library is installed.
cannam@162 3127 libdir=
cannam@162 3128 if test -f "$lib"; then
cannam@162 3129 func_source "$lib"
cannam@162 3130 fi
cannam@162 3131 libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
cannam@162 3132 if test -n "$libdir" && test ! -f "$libfile"; then
cannam@162 3133 func_warning "\`$lib' has not been installed in \`$libdir'"
cannam@162 3134 finalize=no
cannam@162 3135 fi
cannam@162 3136 done
cannam@162 3137
cannam@162 3138 relink_command=
cannam@162 3139 func_source "$wrapper"
cannam@162 3140
cannam@162 3141 outputname=
cannam@162 3142 if test "$fast_install" = no && test -n "$relink_command"; then
cannam@162 3143 $opt_dry_run || {
cannam@162 3144 if test "$finalize" = yes; then
cannam@162 3145 tmpdir=`func_mktempdir`
cannam@162 3146 func_basename "$file$stripped_ext"
cannam@162 3147 file="$func_basename_result"
cannam@162 3148 outputname="$tmpdir/$file"
cannam@162 3149 # Replace the output file specification.
cannam@162 3150 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
cannam@162 3151
cannam@162 3152 $opt_silent || {
cannam@162 3153 func_quote_for_expand "$relink_command"
cannam@162 3154 eval "func_echo $func_quote_for_expand_result"
cannam@162 3155 }
cannam@162 3156 if eval "$relink_command"; then :
cannam@162 3157 else
cannam@162 3158 func_error "error: relink \`$file' with the above command before installing it"
cannam@162 3159 $opt_dry_run || ${RM}r "$tmpdir"
cannam@162 3160 continue
cannam@162 3161 fi
cannam@162 3162 file="$outputname"
cannam@162 3163 else
cannam@162 3164 func_warning "cannot relink \`$file'"
cannam@162 3165 fi
cannam@162 3166 }
cannam@162 3167 else
cannam@162 3168 # Install the binary that we compiled earlier.
cannam@162 3169 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
cannam@162 3170 fi
cannam@162 3171 fi
cannam@162 3172
cannam@162 3173 # remove .exe since cygwin /usr/bin/install will append another
cannam@162 3174 # one anyway
cannam@162 3175 case $install_prog,$host in
cannam@162 3176 */usr/bin/install*,*cygwin*)
cannam@162 3177 case $file:$destfile in
cannam@162 3178 *.exe:*.exe)
cannam@162 3179 # this is ok
cannam@162 3180 ;;
cannam@162 3181 *.exe:*)
cannam@162 3182 destfile=$destfile.exe
cannam@162 3183 ;;
cannam@162 3184 *:*.exe)
cannam@162 3185 func_stripname '' '.exe' "$destfile"
cannam@162 3186 destfile=$func_stripname_result
cannam@162 3187 ;;
cannam@162 3188 esac
cannam@162 3189 ;;
cannam@162 3190 esac
cannam@162 3191 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
cannam@162 3192 $opt_dry_run || if test -n "$outputname"; then
cannam@162 3193 ${RM}r "$tmpdir"
cannam@162 3194 fi
cannam@162 3195 ;;
cannam@162 3196 esac
cannam@162 3197 done
cannam@162 3198
cannam@162 3199 for file in $staticlibs; do
cannam@162 3200 func_basename "$file"
cannam@162 3201 name="$func_basename_result"
cannam@162 3202
cannam@162 3203 # Set up the ranlib parameters.
cannam@162 3204 oldlib="$destdir/$name"
cannam@162 3205 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
cannam@162 3206 tool_oldlib=$func_to_tool_file_result
cannam@162 3207
cannam@162 3208 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
cannam@162 3209
cannam@162 3210 if test -n "$stripme" && test -n "$old_striplib"; then
cannam@162 3211 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
cannam@162 3212 fi
cannam@162 3213
cannam@162 3214 # Do each command in the postinstall commands.
cannam@162 3215 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
cannam@162 3216 done
cannam@162 3217
cannam@162 3218 test -n "$future_libdirs" && \
cannam@162 3219 func_warning "remember to run \`$progname --finish$future_libdirs'"
cannam@162 3220
cannam@162 3221 if test -n "$current_libdirs"; then
cannam@162 3222 # Maybe just do a dry run.
cannam@162 3223 $opt_dry_run && current_libdirs=" -n$current_libdirs"
cannam@162 3224 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
cannam@162 3225 else
cannam@162 3226 exit $EXIT_SUCCESS
cannam@162 3227 fi
cannam@162 3228 }
cannam@162 3229
cannam@162 3230 test "$opt_mode" = install && func_mode_install ${1+"$@"}
cannam@162 3231
cannam@162 3232
cannam@162 3233 # func_generate_dlsyms outputname originator pic_p
cannam@162 3234 # Extract symbols from dlprefiles and create ${outputname}S.o with
cannam@162 3235 # a dlpreopen symbol table.
cannam@162 3236 func_generate_dlsyms ()
cannam@162 3237 {
cannam@162 3238 $opt_debug
cannam@162 3239 my_outputname="$1"
cannam@162 3240 my_originator="$2"
cannam@162 3241 my_pic_p="${3-no}"
cannam@162 3242 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
cannam@162 3243 my_dlsyms=
cannam@162 3244
cannam@162 3245 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
cannam@162 3246 if test -n "$NM" && test -n "$global_symbol_pipe"; then
cannam@162 3247 my_dlsyms="${my_outputname}S.c"
cannam@162 3248 else
cannam@162 3249 func_error "not configured to extract global symbols from dlpreopened files"
cannam@162 3250 fi
cannam@162 3251 fi
cannam@162 3252
cannam@162 3253 if test -n "$my_dlsyms"; then
cannam@162 3254 case $my_dlsyms in
cannam@162 3255 "") ;;
cannam@162 3256 *.c)
cannam@162 3257 # Discover the nlist of each of the dlfiles.
cannam@162 3258 nlist="$output_objdir/${my_outputname}.nm"
cannam@162 3259
cannam@162 3260 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
cannam@162 3261
cannam@162 3262 # Parse the name list into a source file.
cannam@162 3263 func_verbose "creating $output_objdir/$my_dlsyms"
cannam@162 3264
cannam@162 3265 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
cannam@162 3266 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
cannam@162 3267 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
cannam@162 3268
cannam@162 3269 #ifdef __cplusplus
cannam@162 3270 extern \"C\" {
cannam@162 3271 #endif
cannam@162 3272
cannam@162 3273 #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
cannam@162 3274 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
cannam@162 3275 #endif
cannam@162 3276
cannam@162 3277 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
cannam@162 3278 #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
cannam@162 3279 /* DATA imports from DLLs on WIN32 con't be const, because runtime
cannam@162 3280 relocations are performed -- see ld's documentation on pseudo-relocs. */
cannam@162 3281 # define LT_DLSYM_CONST
cannam@162 3282 #elif defined(__osf__)
cannam@162 3283 /* This system does not cope well with relocations in const data. */
cannam@162 3284 # define LT_DLSYM_CONST
cannam@162 3285 #else
cannam@162 3286 # define LT_DLSYM_CONST const
cannam@162 3287 #endif
cannam@162 3288
cannam@162 3289 /* External symbol declarations for the compiler. */\
cannam@162 3290 "
cannam@162 3291
cannam@162 3292 if test "$dlself" = yes; then
cannam@162 3293 func_verbose "generating symbol list for \`$output'"
cannam@162 3294
cannam@162 3295 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
cannam@162 3296
cannam@162 3297 # Add our own program objects to the symbol list.
cannam@162 3298 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
cannam@162 3299 for progfile in $progfiles; do
cannam@162 3300 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
cannam@162 3301 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
cannam@162 3302 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
cannam@162 3303 done
cannam@162 3304
cannam@162 3305 if test -n "$exclude_expsyms"; then
cannam@162 3306 $opt_dry_run || {
cannam@162 3307 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
cannam@162 3308 eval '$MV "$nlist"T "$nlist"'
cannam@162 3309 }
cannam@162 3310 fi
cannam@162 3311
cannam@162 3312 if test -n "$export_symbols_regex"; then
cannam@162 3313 $opt_dry_run || {
cannam@162 3314 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
cannam@162 3315 eval '$MV "$nlist"T "$nlist"'
cannam@162 3316 }
cannam@162 3317 fi
cannam@162 3318
cannam@162 3319 # Prepare the list of exported symbols
cannam@162 3320 if test -z "$export_symbols"; then
cannam@162 3321 export_symbols="$output_objdir/$outputname.exp"
cannam@162 3322 $opt_dry_run || {
cannam@162 3323 $RM $export_symbols
cannam@162 3324 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
cannam@162 3325 case $host in
cannam@162 3326 *cygwin* | *mingw* | *cegcc* )
cannam@162 3327 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
cannam@162 3328 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
cannam@162 3329 ;;
cannam@162 3330 esac
cannam@162 3331 }
cannam@162 3332 else
cannam@162 3333 $opt_dry_run || {
cannam@162 3334 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
cannam@162 3335 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
cannam@162 3336 eval '$MV "$nlist"T "$nlist"'
cannam@162 3337 case $host in
cannam@162 3338 *cygwin* | *mingw* | *cegcc* )
cannam@162 3339 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
cannam@162 3340 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
cannam@162 3341 ;;
cannam@162 3342 esac
cannam@162 3343 }
cannam@162 3344 fi
cannam@162 3345 fi
cannam@162 3346
cannam@162 3347 for dlprefile in $dlprefiles; do
cannam@162 3348 func_verbose "extracting global C symbols from \`$dlprefile'"
cannam@162 3349 func_basename "$dlprefile"
cannam@162 3350 name="$func_basename_result"
cannam@162 3351 case $host in
cannam@162 3352 *cygwin* | *mingw* | *cegcc* )
cannam@162 3353 # if an import library, we need to obtain dlname
cannam@162 3354 if func_win32_import_lib_p "$dlprefile"; then
cannam@162 3355 func_tr_sh "$dlprefile"
cannam@162 3356 eval "curr_lafile=\$libfile_$func_tr_sh_result"
cannam@162 3357 dlprefile_dlbasename=""
cannam@162 3358 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
cannam@162 3359 # Use subshell, to avoid clobbering current variable values
cannam@162 3360 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
cannam@162 3361 if test -n "$dlprefile_dlname" ; then
cannam@162 3362 func_basename "$dlprefile_dlname"
cannam@162 3363 dlprefile_dlbasename="$func_basename_result"
cannam@162 3364 else
cannam@162 3365 # no lafile. user explicitly requested -dlpreopen <import library>.
cannam@162 3366 $sharedlib_from_linklib_cmd "$dlprefile"
cannam@162 3367 dlprefile_dlbasename=$sharedlib_from_linklib_result
cannam@162 3368 fi
cannam@162 3369 fi
cannam@162 3370 $opt_dry_run || {
cannam@162 3371 if test -n "$dlprefile_dlbasename" ; then
cannam@162 3372 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
cannam@162 3373 else
cannam@162 3374 func_warning "Could not compute DLL name from $name"
cannam@162 3375 eval '$ECHO ": $name " >> "$nlist"'
cannam@162 3376 fi
cannam@162 3377 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
cannam@162 3378 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
cannam@162 3379 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
cannam@162 3380 }
cannam@162 3381 else # not an import lib
cannam@162 3382 $opt_dry_run || {
cannam@162 3383 eval '$ECHO ": $name " >> "$nlist"'
cannam@162 3384 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
cannam@162 3385 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
cannam@162 3386 }
cannam@162 3387 fi
cannam@162 3388 ;;
cannam@162 3389 *)
cannam@162 3390 $opt_dry_run || {
cannam@162 3391 eval '$ECHO ": $name " >> "$nlist"'
cannam@162 3392 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
cannam@162 3393 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
cannam@162 3394 }
cannam@162 3395 ;;
cannam@162 3396 esac
cannam@162 3397 done
cannam@162 3398
cannam@162 3399 $opt_dry_run || {
cannam@162 3400 # Make sure we have at least an empty file.
cannam@162 3401 test -f "$nlist" || : > "$nlist"
cannam@162 3402
cannam@162 3403 if test -n "$exclude_expsyms"; then
cannam@162 3404 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
cannam@162 3405 $MV "$nlist"T "$nlist"
cannam@162 3406 fi
cannam@162 3407
cannam@162 3408 # Try sorting and uniquifying the output.
cannam@162 3409 if $GREP -v "^: " < "$nlist" |
cannam@162 3410 if sort -k 3 </dev/null >/dev/null 2>&1; then
cannam@162 3411 sort -k 3
cannam@162 3412 else
cannam@162 3413 sort +2
cannam@162 3414 fi |
cannam@162 3415 uniq > "$nlist"S; then
cannam@162 3416 :
cannam@162 3417 else
cannam@162 3418 $GREP -v "^: " < "$nlist" > "$nlist"S
cannam@162 3419 fi
cannam@162 3420
cannam@162 3421 if test -f "$nlist"S; then
cannam@162 3422 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
cannam@162 3423 else
cannam@162 3424 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
cannam@162 3425 fi
cannam@162 3426
cannam@162 3427 echo >> "$output_objdir/$my_dlsyms" "\
cannam@162 3428
cannam@162 3429 /* The mapping between symbol names and symbols. */
cannam@162 3430 typedef struct {
cannam@162 3431 const char *name;
cannam@162 3432 void *address;
cannam@162 3433 } lt_dlsymlist;
cannam@162 3434 extern LT_DLSYM_CONST lt_dlsymlist
cannam@162 3435 lt_${my_prefix}_LTX_preloaded_symbols[];
cannam@162 3436 LT_DLSYM_CONST lt_dlsymlist
cannam@162 3437 lt_${my_prefix}_LTX_preloaded_symbols[] =
cannam@162 3438 {\
cannam@162 3439 { \"$my_originator\", (void *) 0 },"
cannam@162 3440
cannam@162 3441 case $need_lib_prefix in
cannam@162 3442 no)
cannam@162 3443 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
cannam@162 3444 ;;
cannam@162 3445 *)
cannam@162 3446 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
cannam@162 3447 ;;
cannam@162 3448 esac
cannam@162 3449 echo >> "$output_objdir/$my_dlsyms" "\
cannam@162 3450 {0, (void *) 0}
cannam@162 3451 };
cannam@162 3452
cannam@162 3453 /* This works around a problem in FreeBSD linker */
cannam@162 3454 #ifdef FREEBSD_WORKAROUND
cannam@162 3455 static const void *lt_preloaded_setup() {
cannam@162 3456 return lt_${my_prefix}_LTX_preloaded_symbols;
cannam@162 3457 }
cannam@162 3458 #endif
cannam@162 3459
cannam@162 3460 #ifdef __cplusplus
cannam@162 3461 }
cannam@162 3462 #endif\
cannam@162 3463 "
cannam@162 3464 } # !$opt_dry_run
cannam@162 3465
cannam@162 3466 pic_flag_for_symtable=
cannam@162 3467 case "$compile_command " in
cannam@162 3468 *" -static "*) ;;
cannam@162 3469 *)
cannam@162 3470 case $host in
cannam@162 3471 # compiling the symbol table file with pic_flag works around
cannam@162 3472 # a FreeBSD bug that causes programs to crash when -lm is
cannam@162 3473 # linked before any other PIC object. But we must not use
cannam@162 3474 # pic_flag when linking with -static. The problem exists in
cannam@162 3475 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
cannam@162 3476 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
cannam@162 3477 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
cannam@162 3478 *-*-hpux*)
cannam@162 3479 pic_flag_for_symtable=" $pic_flag" ;;
cannam@162 3480 *)
cannam@162 3481 if test "X$my_pic_p" != Xno; then
cannam@162 3482 pic_flag_for_symtable=" $pic_flag"
cannam@162 3483 fi
cannam@162 3484 ;;
cannam@162 3485 esac
cannam@162 3486 ;;
cannam@162 3487 esac
cannam@162 3488 symtab_cflags=
cannam@162 3489 for arg in $LTCFLAGS; do
cannam@162 3490 case $arg in
cannam@162 3491 -pie | -fpie | -fPIE) ;;
cannam@162 3492 *) func_append symtab_cflags " $arg" ;;
cannam@162 3493 esac
cannam@162 3494 done
cannam@162 3495
cannam@162 3496 # Now compile the dynamic symbol file.
cannam@162 3497 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
cannam@162 3498
cannam@162 3499 # Clean up the generated files.
cannam@162 3500 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
cannam@162 3501
cannam@162 3502 # Transform the symbol file into the correct name.
cannam@162 3503 symfileobj="$output_objdir/${my_outputname}S.$objext"
cannam@162 3504 case $host in
cannam@162 3505 *cygwin* | *mingw* | *cegcc* )
cannam@162 3506 if test -f "$output_objdir/$my_outputname.def"; then
cannam@162 3507 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
cannam@162 3508 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
cannam@162 3509 else
cannam@162 3510 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cannam@162 3511 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cannam@162 3512 fi
cannam@162 3513 ;;
cannam@162 3514 *)
cannam@162 3515 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cannam@162 3516 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
cannam@162 3517 ;;
cannam@162 3518 esac
cannam@162 3519 ;;
cannam@162 3520 *)
cannam@162 3521 func_fatal_error "unknown suffix for \`$my_dlsyms'"
cannam@162 3522 ;;
cannam@162 3523 esac
cannam@162 3524 else
cannam@162 3525 # We keep going just in case the user didn't refer to
cannam@162 3526 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
cannam@162 3527 # really was required.
cannam@162 3528
cannam@162 3529 # Nullify the symbol file.
cannam@162 3530 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
cannam@162 3531 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
cannam@162 3532 fi
cannam@162 3533 }
cannam@162 3534
cannam@162 3535 # func_win32_libid arg
cannam@162 3536 # return the library type of file 'arg'
cannam@162 3537 #
cannam@162 3538 # Need a lot of goo to handle *both* DLLs and import libs
cannam@162 3539 # Has to be a shell function in order to 'eat' the argument
cannam@162 3540 # that is supplied when $file_magic_command is called.
cannam@162 3541 # Despite the name, also deal with 64 bit binaries.
cannam@162 3542 func_win32_libid ()
cannam@162 3543 {
cannam@162 3544 $opt_debug
cannam@162 3545 win32_libid_type="unknown"
cannam@162 3546 win32_fileres=`file -L $1 2>/dev/null`
cannam@162 3547 case $win32_fileres in
cannam@162 3548 *ar\ archive\ import\ library*) # definitely import
cannam@162 3549 win32_libid_type="x86 archive import"
cannam@162 3550 ;;
cannam@162 3551 *ar\ archive*) # could be an import, or static
cannam@162 3552 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
cannam@162 3553 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
cannam@162 3554 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
cannam@162 3555 func_to_tool_file "$1" func_convert_file_msys_to_w32
cannam@162 3556 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
cannam@162 3557 $SED -n -e '
cannam@162 3558 1,100{
cannam@162 3559 / I /{
cannam@162 3560 s,.*,import,
cannam@162 3561 p
cannam@162 3562 q
cannam@162 3563 }
cannam@162 3564 }'`
cannam@162 3565 case $win32_nmres in
cannam@162 3566 import*) win32_libid_type="x86 archive import";;
cannam@162 3567 *) win32_libid_type="x86 archive static";;
cannam@162 3568 esac
cannam@162 3569 fi
cannam@162 3570 ;;
cannam@162 3571 *DLL*)
cannam@162 3572 win32_libid_type="x86 DLL"
cannam@162 3573 ;;
cannam@162 3574 *executable*) # but shell scripts are "executable" too...
cannam@162 3575 case $win32_fileres in
cannam@162 3576 *MS\ Windows\ PE\ Intel*)
cannam@162 3577 win32_libid_type="x86 DLL"
cannam@162 3578 ;;
cannam@162 3579 esac
cannam@162 3580 ;;
cannam@162 3581 esac
cannam@162 3582 $ECHO "$win32_libid_type"
cannam@162 3583 }
cannam@162 3584
cannam@162 3585 # func_cygming_dll_for_implib ARG
cannam@162 3586 #
cannam@162 3587 # Platform-specific function to extract the
cannam@162 3588 # name of the DLL associated with the specified
cannam@162 3589 # import library ARG.
cannam@162 3590 # Invoked by eval'ing the libtool variable
cannam@162 3591 # $sharedlib_from_linklib_cmd
cannam@162 3592 # Result is available in the variable
cannam@162 3593 # $sharedlib_from_linklib_result
cannam@162 3594 func_cygming_dll_for_implib ()
cannam@162 3595 {
cannam@162 3596 $opt_debug
cannam@162 3597 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
cannam@162 3598 }
cannam@162 3599
cannam@162 3600 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
cannam@162 3601 #
cannam@162 3602 # The is the core of a fallback implementation of a
cannam@162 3603 # platform-specific function to extract the name of the
cannam@162 3604 # DLL associated with the specified import library LIBNAME.
cannam@162 3605 #
cannam@162 3606 # SECTION_NAME is either .idata$6 or .idata$7, depending
cannam@162 3607 # on the platform and compiler that created the implib.
cannam@162 3608 #
cannam@162 3609 # Echos the name of the DLL associated with the
cannam@162 3610 # specified import library.
cannam@162 3611 func_cygming_dll_for_implib_fallback_core ()
cannam@162 3612 {
cannam@162 3613 $opt_debug
cannam@162 3614 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
cannam@162 3615 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
cannam@162 3616 $SED '/^Contents of section '"$match_literal"':/{
cannam@162 3617 # Place marker at beginning of archive member dllname section
cannam@162 3618 s/.*/====MARK====/
cannam@162 3619 p
cannam@162 3620 d
cannam@162 3621 }
cannam@162 3622 # These lines can sometimes be longer than 43 characters, but
cannam@162 3623 # are always uninteresting
cannam@162 3624 /:[ ]*file format pe[i]\{,1\}-/d
cannam@162 3625 /^In archive [^:]*:/d
cannam@162 3626 # Ensure marker is printed
cannam@162 3627 /^====MARK====/p
cannam@162 3628 # Remove all lines with less than 43 characters
cannam@162 3629 /^.\{43\}/!d
cannam@162 3630 # From remaining lines, remove first 43 characters
cannam@162 3631 s/^.\{43\}//' |
cannam@162 3632 $SED -n '
cannam@162 3633 # Join marker and all lines until next marker into a single line
cannam@162 3634 /^====MARK====/ b para
cannam@162 3635 H
cannam@162 3636 $ b para
cannam@162 3637 b
cannam@162 3638 :para
cannam@162 3639 x
cannam@162 3640 s/\n//g
cannam@162 3641 # Remove the marker
cannam@162 3642 s/^====MARK====//
cannam@162 3643 # Remove trailing dots and whitespace
cannam@162 3644 s/[\. \t]*$//
cannam@162 3645 # Print
cannam@162 3646 /./p' |
cannam@162 3647 # we now have a list, one entry per line, of the stringified
cannam@162 3648 # contents of the appropriate section of all members of the
cannam@162 3649 # archive which possess that section. Heuristic: eliminate
cannam@162 3650 # all those which have a first or second character that is
cannam@162 3651 # a '.' (that is, objdump's representation of an unprintable
cannam@162 3652 # character.) This should work for all archives with less than
cannam@162 3653 # 0x302f exports -- but will fail for DLLs whose name actually
cannam@162 3654 # begins with a literal '.' or a single character followed by
cannam@162 3655 # a '.'.
cannam@162 3656 #
cannam@162 3657 # Of those that remain, print the first one.
cannam@162 3658 $SED -e '/^\./d;/^.\./d;q'
cannam@162 3659 }
cannam@162 3660
cannam@162 3661 # func_cygming_gnu_implib_p ARG
cannam@162 3662 # This predicate returns with zero status (TRUE) if
cannam@162 3663 # ARG is a GNU/binutils-style import library. Returns
cannam@162 3664 # with nonzero status (FALSE) otherwise.
cannam@162 3665 func_cygming_gnu_implib_p ()
cannam@162 3666 {
cannam@162 3667 $opt_debug
cannam@162 3668 func_to_tool_file "$1" func_convert_file_msys_to_w32
cannam@162 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@162 3670 test -n "$func_cygming_gnu_implib_tmp"
cannam@162 3671 }
cannam@162 3672
cannam@162 3673 # func_cygming_ms_implib_p ARG
cannam@162 3674 # This predicate returns with zero status (TRUE) if
cannam@162 3675 # ARG is an MS-style import library. Returns
cannam@162 3676 # with nonzero status (FALSE) otherwise.
cannam@162 3677 func_cygming_ms_implib_p ()
cannam@162 3678 {
cannam@162 3679 $opt_debug
cannam@162 3680 func_to_tool_file "$1" func_convert_file_msys_to_w32
cannam@162 3681 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
cannam@162 3682 test -n "$func_cygming_ms_implib_tmp"
cannam@162 3683 }
cannam@162 3684
cannam@162 3685 # func_cygming_dll_for_implib_fallback ARG
cannam@162 3686 # Platform-specific function to extract the
cannam@162 3687 # name of the DLL associated with the specified
cannam@162 3688 # import library ARG.
cannam@162 3689 #
cannam@162 3690 # This fallback implementation is for use when $DLLTOOL
cannam@162 3691 # does not support the --identify-strict option.
cannam@162 3692 # Invoked by eval'ing the libtool variable
cannam@162 3693 # $sharedlib_from_linklib_cmd
cannam@162 3694 # Result is available in the variable
cannam@162 3695 # $sharedlib_from_linklib_result
cannam@162 3696 func_cygming_dll_for_implib_fallback ()
cannam@162 3697 {
cannam@162 3698 $opt_debug
cannam@162 3699 if func_cygming_gnu_implib_p "$1" ; then
cannam@162 3700 # binutils import library
cannam@162 3701 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
cannam@162 3702 elif func_cygming_ms_implib_p "$1" ; then
cannam@162 3703 # ms-generated import library
cannam@162 3704 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
cannam@162 3705 else
cannam@162 3706 # unknown
cannam@162 3707 sharedlib_from_linklib_result=""
cannam@162 3708 fi
cannam@162 3709 }
cannam@162 3710
cannam@162 3711
cannam@162 3712 # func_extract_an_archive dir oldlib
cannam@162 3713 func_extract_an_archive ()
cannam@162 3714 {
cannam@162 3715 $opt_debug
cannam@162 3716 f_ex_an_ar_dir="$1"; shift
cannam@162 3717 f_ex_an_ar_oldlib="$1"
cannam@162 3718 if test "$lock_old_archive_extraction" = yes; then
cannam@162 3719 lockfile=$f_ex_an_ar_oldlib.lock
cannam@162 3720 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
cannam@162 3721 func_echo "Waiting for $lockfile to be removed"
cannam@162 3722 sleep 2
cannam@162 3723 done
cannam@162 3724 fi
cannam@162 3725 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
cannam@162 3726 'stat=$?; rm -f "$lockfile"; exit $stat'
cannam@162 3727 if test "$lock_old_archive_extraction" = yes; then
cannam@162 3728 $opt_dry_run || rm -f "$lockfile"
cannam@162 3729 fi
cannam@162 3730 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
cannam@162 3731 :
cannam@162 3732 else
cannam@162 3733 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
cannam@162 3734 fi
cannam@162 3735 }
cannam@162 3736
cannam@162 3737
cannam@162 3738 # func_extract_archives gentop oldlib ...
cannam@162 3739 func_extract_archives ()
cannam@162 3740 {
cannam@162 3741 $opt_debug
cannam@162 3742 my_gentop="$1"; shift
cannam@162 3743 my_oldlibs=${1+"$@"}
cannam@162 3744 my_oldobjs=""
cannam@162 3745 my_xlib=""
cannam@162 3746 my_xabs=""
cannam@162 3747 my_xdir=""
cannam@162 3748
cannam@162 3749 for my_xlib in $my_oldlibs; do
cannam@162 3750 # Extract the objects.
cannam@162 3751 case $my_xlib in
cannam@162 3752 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
cannam@162 3753 *) my_xabs=`pwd`"/$my_xlib" ;;
cannam@162 3754 esac
cannam@162 3755 func_basename "$my_xlib"
cannam@162 3756 my_xlib="$func_basename_result"
cannam@162 3757 my_xlib_u=$my_xlib
cannam@162 3758 while :; do
cannam@162 3759 case " $extracted_archives " in
cannam@162 3760 *" $my_xlib_u "*)
cannam@162 3761 func_arith $extracted_serial + 1
cannam@162 3762 extracted_serial=$func_arith_result
cannam@162 3763 my_xlib_u=lt$extracted_serial-$my_xlib ;;
cannam@162 3764 *) break ;;
cannam@162 3765 esac
cannam@162 3766 done
cannam@162 3767 extracted_archives="$extracted_archives $my_xlib_u"
cannam@162 3768 my_xdir="$my_gentop/$my_xlib_u"
cannam@162 3769
cannam@162 3770 func_mkdir_p "$my_xdir"
cannam@162 3771
cannam@162 3772 case $host in
cannam@162 3773 *-darwin*)
cannam@162 3774 func_verbose "Extracting $my_xabs"
cannam@162 3775 # Do not bother doing anything if just a dry run
cannam@162 3776 $opt_dry_run || {
cannam@162 3777 darwin_orig_dir=`pwd`
cannam@162 3778 cd $my_xdir || exit $?
cannam@162 3779 darwin_archive=$my_xabs
cannam@162 3780 darwin_curdir=`pwd`
cannam@162 3781 darwin_base_archive=`basename "$darwin_archive"`
cannam@162 3782 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
cannam@162 3783 if test -n "$darwin_arches"; then
cannam@162 3784 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
cannam@162 3785 darwin_arch=
cannam@162 3786 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
cannam@162 3787 for darwin_arch in $darwin_arches ; do
cannam@162 3788 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
cannam@162 3789 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
cannam@162 3790 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
cannam@162 3791 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
cannam@162 3792 cd "$darwin_curdir"
cannam@162 3793 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
cannam@162 3794 done # $darwin_arches
cannam@162 3795 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
cannam@162 3796 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
cannam@162 3797 darwin_file=
cannam@162 3798 darwin_files=
cannam@162 3799 for darwin_file in $darwin_filelist; do
cannam@162 3800 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
cannam@162 3801 $LIPO -create -output "$darwin_file" $darwin_files
cannam@162 3802 done # $darwin_filelist
cannam@162 3803 $RM -rf unfat-$$
cannam@162 3804 cd "$darwin_orig_dir"
cannam@162 3805 else
cannam@162 3806 cd $darwin_orig_dir
cannam@162 3807 func_extract_an_archive "$my_xdir" "$my_xabs"
cannam@162 3808 fi # $darwin_arches
cannam@162 3809 } # !$opt_dry_run
cannam@162 3810 ;;
cannam@162 3811 *)
cannam@162 3812 func_extract_an_archive "$my_xdir" "$my_xabs"
cannam@162 3813 ;;
cannam@162 3814 esac
cannam@162 3815 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
cannam@162 3816 done
cannam@162 3817
cannam@162 3818 func_extract_archives_result="$my_oldobjs"
cannam@162 3819 }
cannam@162 3820
cannam@162 3821
cannam@162 3822 # func_emit_wrapper [arg=no]
cannam@162 3823 #
cannam@162 3824 # Emit a libtool wrapper script on stdout.
cannam@162 3825 # Don't directly open a file because we may want to
cannam@162 3826 # incorporate the script contents within a cygwin/mingw
cannam@162 3827 # wrapper executable. Must ONLY be called from within
cannam@162 3828 # func_mode_link because it depends on a number of variables
cannam@162 3829 # set therein.
cannam@162 3830 #
cannam@162 3831 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
cannam@162 3832 # variable will take. If 'yes', then the emitted script
cannam@162 3833 # will assume that the directory in which it is stored is
cannam@162 3834 # the $objdir directory. This is a cygwin/mingw-specific
cannam@162 3835 # behavior.
cannam@162 3836 func_emit_wrapper ()
cannam@162 3837 {
cannam@162 3838 func_emit_wrapper_arg1=${1-no}
cannam@162 3839
cannam@162 3840 $ECHO "\
cannam@162 3841 #! $SHELL
cannam@162 3842
cannam@162 3843 # $output - temporary wrapper script for $objdir/$outputname
cannam@162 3844 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
cannam@162 3845 #
cannam@162 3846 # The $output program cannot be directly executed until all the libtool
cannam@162 3847 # libraries that it depends on are installed.
cannam@162 3848 #
cannam@162 3849 # This wrapper script should never be moved out of the build directory.
cannam@162 3850 # If it is, it will not operate correctly.
cannam@162 3851
cannam@162 3852 # Sed substitution that helps us do robust quoting. It backslashifies
cannam@162 3853 # metacharacters that are still active within double-quoted strings.
cannam@162 3854 sed_quote_subst='$sed_quote_subst'
cannam@162 3855
cannam@162 3856 # Be Bourne compatible
cannam@162 3857 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
cannam@162 3858 emulate sh
cannam@162 3859 NULLCMD=:
cannam@162 3860 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
cannam@162 3861 # is contrary to our usage. Disable this feature.
cannam@162 3862 alias -g '\${1+\"\$@\"}'='\"\$@\"'
cannam@162 3863 setopt NO_GLOB_SUBST
cannam@162 3864 else
cannam@162 3865 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
cannam@162 3866 fi
cannam@162 3867 BIN_SH=xpg4; export BIN_SH # for Tru64
cannam@162 3868 DUALCASE=1; export DUALCASE # for MKS sh
cannam@162 3869
cannam@162 3870 # The HP-UX ksh and POSIX shell print the target directory to stdout
cannam@162 3871 # if CDPATH is set.
cannam@162 3872 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
cannam@162 3873
cannam@162 3874 relink_command=\"$relink_command\"
cannam@162 3875
cannam@162 3876 # This environment variable determines our operation mode.
cannam@162 3877 if test \"\$libtool_install_magic\" = \"$magic\"; then
cannam@162 3878 # install mode needs the following variables:
cannam@162 3879 generated_by_libtool_version='$macro_version'
cannam@162 3880 notinst_deplibs='$notinst_deplibs'
cannam@162 3881 else
cannam@162 3882 # When we are sourced in execute mode, \$file and \$ECHO are already set.
cannam@162 3883 if test \"\$libtool_execute_magic\" != \"$magic\"; then
cannam@162 3884 file=\"\$0\""
cannam@162 3885
cannam@162 3886 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
cannam@162 3887 $ECHO "\
cannam@162 3888
cannam@162 3889 # A function that is used when there is no print builtin or printf.
cannam@162 3890 func_fallback_echo ()
cannam@162 3891 {
cannam@162 3892 eval 'cat <<_LTECHO_EOF
cannam@162 3893 \$1
cannam@162 3894 _LTECHO_EOF'
cannam@162 3895 }
cannam@162 3896 ECHO=\"$qECHO\"
cannam@162 3897 fi
cannam@162 3898
cannam@162 3899 # Very basic option parsing. These options are (a) specific to
cannam@162 3900 # the libtool wrapper, (b) are identical between the wrapper
cannam@162 3901 # /script/ and the wrapper /executable/ which is used only on
cannam@162 3902 # windows platforms, and (c) all begin with the string "--lt-"
cannam@162 3903 # (application programs are unlikely to have options which match
cannam@162 3904 # this pattern).
cannam@162 3905 #
cannam@162 3906 # There are only two supported options: --lt-debug and
cannam@162 3907 # --lt-dump-script. There is, deliberately, no --lt-help.
cannam@162 3908 #
cannam@162 3909 # The first argument to this parsing function should be the
cannam@162 3910 # script's $0 value, followed by "$@".
cannam@162 3911 lt_option_debug=
cannam@162 3912 func_parse_lt_options ()
cannam@162 3913 {
cannam@162 3914 lt_script_arg0=\$0
cannam@162 3915 shift
cannam@162 3916 for lt_opt
cannam@162 3917 do
cannam@162 3918 case \"\$lt_opt\" in
cannam@162 3919 --lt-debug) lt_option_debug=1 ;;
cannam@162 3920 --lt-dump-script)
cannam@162 3921 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
cannam@162 3922 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
cannam@162 3923 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
cannam@162 3924 cat \"\$lt_dump_D/\$lt_dump_F\"
cannam@162 3925 exit 0
cannam@162 3926 ;;
cannam@162 3927 --lt-*)
cannam@162 3928 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
cannam@162 3929 exit 1
cannam@162 3930 ;;
cannam@162 3931 esac
cannam@162 3932 done
cannam@162 3933
cannam@162 3934 # Print the debug banner immediately:
cannam@162 3935 if test -n \"\$lt_option_debug\"; then
cannam@162 3936 echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
cannam@162 3937 fi
cannam@162 3938 }
cannam@162 3939
cannam@162 3940 # Used when --lt-debug. Prints its arguments to stdout
cannam@162 3941 # (redirection is the responsibility of the caller)
cannam@162 3942 func_lt_dump_args ()
cannam@162 3943 {
cannam@162 3944 lt_dump_args_N=1;
cannam@162 3945 for lt_arg
cannam@162 3946 do
cannam@162 3947 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
cannam@162 3948 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
cannam@162 3949 done
cannam@162 3950 }
cannam@162 3951
cannam@162 3952 # Core function for launching the target application
cannam@162 3953 func_exec_program_core ()
cannam@162 3954 {
cannam@162 3955 "
cannam@162 3956 case $host in
cannam@162 3957 # Backslashes separate directories on plain windows
cannam@162 3958 *-*-mingw | *-*-os2* | *-cegcc*)
cannam@162 3959 $ECHO "\
cannam@162 3960 if test -n \"\$lt_option_debug\"; then
cannam@162 3961 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
cannam@162 3962 func_lt_dump_args \${1+\"\$@\"} 1>&2
cannam@162 3963 fi
cannam@162 3964 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
cannam@162 3965 "
cannam@162 3966 ;;
cannam@162 3967
cannam@162 3968 *)
cannam@162 3969 $ECHO "\
cannam@162 3970 if test -n \"\$lt_option_debug\"; then
cannam@162 3971 \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
cannam@162 3972 func_lt_dump_args \${1+\"\$@\"} 1>&2
cannam@162 3973 fi
cannam@162 3974 exec \"\$progdir/\$program\" \${1+\"\$@\"}
cannam@162 3975 "
cannam@162 3976 ;;
cannam@162 3977 esac
cannam@162 3978 $ECHO "\
cannam@162 3979 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
cannam@162 3980 exit 1
cannam@162 3981 }
cannam@162 3982
cannam@162 3983 # A function to encapsulate launching the target application
cannam@162 3984 # Strips options in the --lt-* namespace from \$@ and
cannam@162 3985 # launches target application with the remaining arguments.
cannam@162 3986 func_exec_program ()
cannam@162 3987 {
cannam@162 3988 case \" \$* \" in
cannam@162 3989 *\\ --lt-*)
cannam@162 3990 for lt_wr_arg
cannam@162 3991 do
cannam@162 3992 case \$lt_wr_arg in
cannam@162 3993 --lt-*) ;;
cannam@162 3994 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
cannam@162 3995 esac
cannam@162 3996 shift
cannam@162 3997 done ;;
cannam@162 3998 esac
cannam@162 3999 func_exec_program_core \${1+\"\$@\"}
cannam@162 4000 }
cannam@162 4001
cannam@162 4002 # Parse options
cannam@162 4003 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
cannam@162 4004
cannam@162 4005 # Find the directory that this script lives in.
cannam@162 4006 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
cannam@162 4007 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
cannam@162 4008
cannam@162 4009 # Follow symbolic links until we get to the real thisdir.
cannam@162 4010 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
cannam@162 4011 while test -n \"\$file\"; do
cannam@162 4012 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
cannam@162 4013
cannam@162 4014 # If there was a directory component, then change thisdir.
cannam@162 4015 if test \"x\$destdir\" != \"x\$file\"; then
cannam@162 4016 case \"\$destdir\" in
cannam@162 4017 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
cannam@162 4018 *) thisdir=\"\$thisdir/\$destdir\" ;;
cannam@162 4019 esac
cannam@162 4020 fi
cannam@162 4021
cannam@162 4022 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
cannam@162 4023 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
cannam@162 4024 done
cannam@162 4025
cannam@162 4026 # Usually 'no', except on cygwin/mingw when embedded into
cannam@162 4027 # the cwrapper.
cannam@162 4028 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
cannam@162 4029 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
cannam@162 4030 # special case for '.'
cannam@162 4031 if test \"\$thisdir\" = \".\"; then
cannam@162 4032 thisdir=\`pwd\`
cannam@162 4033 fi
cannam@162 4034 # remove .libs from thisdir
cannam@162 4035 case \"\$thisdir\" in
cannam@162 4036 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
cannam@162 4037 $objdir ) thisdir=. ;;
cannam@162 4038 esac
cannam@162 4039 fi
cannam@162 4040
cannam@162 4041 # Try to get the absolute directory name.
cannam@162 4042 absdir=\`cd \"\$thisdir\" && pwd\`
cannam@162 4043 test -n \"\$absdir\" && thisdir=\"\$absdir\"
cannam@162 4044 "
cannam@162 4045
cannam@162 4046 if test "$fast_install" = yes; then
cannam@162 4047 $ECHO "\
cannam@162 4048 program=lt-'$outputname'$exeext
cannam@162 4049 progdir=\"\$thisdir/$objdir\"
cannam@162 4050
cannam@162 4051 if test ! -f \"\$progdir/\$program\" ||
cannam@162 4052 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
cannam@162 4053 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
cannam@162 4054
cannam@162 4055 file=\"\$\$-\$program\"
cannam@162 4056
cannam@162 4057 if test ! -d \"\$progdir\"; then
cannam@162 4058 $MKDIR \"\$progdir\"
cannam@162 4059 else
cannam@162 4060 $RM \"\$progdir/\$file\"
cannam@162 4061 fi"
cannam@162 4062
cannam@162 4063 $ECHO "\
cannam@162 4064
cannam@162 4065 # relink executable if necessary
cannam@162 4066 if test -n \"\$relink_command\"; then
cannam@162 4067 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
cannam@162 4068 else
cannam@162 4069 $ECHO \"\$relink_command_output\" >&2
cannam@162 4070 $RM \"\$progdir/\$file\"
cannam@162 4071 exit 1
cannam@162 4072 fi
cannam@162 4073 fi
cannam@162 4074
cannam@162 4075 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
cannam@162 4076 { $RM \"\$progdir/\$program\";
cannam@162 4077 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
cannam@162 4078 $RM \"\$progdir/\$file\"
cannam@162 4079 fi"
cannam@162 4080 else
cannam@162 4081 $ECHO "\
cannam@162 4082 program='$outputname'
cannam@162 4083 progdir=\"\$thisdir/$objdir\"
cannam@162 4084 "
cannam@162 4085 fi
cannam@162 4086
cannam@162 4087 $ECHO "\
cannam@162 4088
cannam@162 4089 if test -f \"\$progdir/\$program\"; then"
cannam@162 4090
cannam@162 4091 # fixup the dll searchpath if we need to.
cannam@162 4092 #
cannam@162 4093 # Fix the DLL searchpath if we need to. Do this before prepending
cannam@162 4094 # to shlibpath, because on Windows, both are PATH and uninstalled
cannam@162 4095 # libraries must come first.
cannam@162 4096 if test -n "$dllsearchpath"; then
cannam@162 4097 $ECHO "\
cannam@162 4098 # Add the dll search path components to the executable PATH
cannam@162 4099 PATH=$dllsearchpath:\$PATH
cannam@162 4100 "
cannam@162 4101 fi
cannam@162 4102
cannam@162 4103 # Export our shlibpath_var if we have one.
cannam@162 4104 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
cannam@162 4105 $ECHO "\
cannam@162 4106 # Add our own library path to $shlibpath_var
cannam@162 4107 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
cannam@162 4108
cannam@162 4109 # Some systems cannot cope with colon-terminated $shlibpath_var
cannam@162 4110 # The second colon is a workaround for a bug in BeOS R4 sed
cannam@162 4111 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
cannam@162 4112
cannam@162 4113 export $shlibpath_var
cannam@162 4114 "
cannam@162 4115 fi
cannam@162 4116
cannam@162 4117 $ECHO "\
cannam@162 4118 if test \"\$libtool_execute_magic\" != \"$magic\"; then
cannam@162 4119 # Run the actual program with our arguments.
cannam@162 4120 func_exec_program \${1+\"\$@\"}
cannam@162 4121 fi
cannam@162 4122 else
cannam@162 4123 # The program doesn't exist.
cannam@162 4124 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
cannam@162 4125 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
cannam@162 4126 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
cannam@162 4127 exit 1
cannam@162 4128 fi
cannam@162 4129 fi\
cannam@162 4130 "
cannam@162 4131 }
cannam@162 4132
cannam@162 4133
cannam@162 4134 # func_emit_cwrapperexe_src
cannam@162 4135 # emit the source code for a wrapper executable on stdout
cannam@162 4136 # Must ONLY be called from within func_mode_link because
cannam@162 4137 # it depends on a number of variable set therein.
cannam@162 4138 func_emit_cwrapperexe_src ()
cannam@162 4139 {
cannam@162 4140 cat <<EOF
cannam@162 4141
cannam@162 4142 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
cannam@162 4143 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
cannam@162 4144
cannam@162 4145 The $output program cannot be directly executed until all the libtool
cannam@162 4146 libraries that it depends on are installed.
cannam@162 4147
cannam@162 4148 This wrapper executable should never be moved out of the build directory.
cannam@162 4149 If it is, it will not operate correctly.
cannam@162 4150 */
cannam@162 4151 EOF
cannam@162 4152 cat <<"EOF"
cannam@162 4153 #ifdef _MSC_VER
cannam@162 4154 # define _CRT_SECURE_NO_DEPRECATE 1
cannam@162 4155 #endif
cannam@162 4156 #include <stdio.h>
cannam@162 4157 #include <stdlib.h>
cannam@162 4158 #ifdef _MSC_VER
cannam@162 4159 # include <direct.h>
cannam@162 4160 # include <process.h>
cannam@162 4161 # include <io.h>
cannam@162 4162 #else
cannam@162 4163 # include <unistd.h>
cannam@162 4164 # include <stdint.h>
cannam@162 4165 # ifdef __CYGWIN__
cannam@162 4166 # include <io.h>
cannam@162 4167 # endif
cannam@162 4168 #endif
cannam@162 4169 #include <malloc.h>
cannam@162 4170 #include <stdarg.h>
cannam@162 4171 #include <assert.h>
cannam@162 4172 #include <string.h>
cannam@162 4173 #include <ctype.h>
cannam@162 4174 #include <errno.h>
cannam@162 4175 #include <fcntl.h>
cannam@162 4176 #include <sys/stat.h>
cannam@162 4177
cannam@162 4178 /* declarations of non-ANSI functions */
cannam@162 4179 #if defined(__MINGW32__)
cannam@162 4180 # ifdef __STRICT_ANSI__
cannam@162 4181 int _putenv (const char *);
cannam@162 4182 # endif
cannam@162 4183 #elif defined(__CYGWIN__)
cannam@162 4184 # ifdef __STRICT_ANSI__
cannam@162 4185 char *realpath (const char *, char *);
cannam@162 4186 int putenv (char *);
cannam@162 4187 int setenv (const char *, const char *, int);
cannam@162 4188 # endif
cannam@162 4189 /* #elif defined (other platforms) ... */
cannam@162 4190 #endif
cannam@162 4191
cannam@162 4192 /* portability defines, excluding path handling macros */
cannam@162 4193 #if defined(_MSC_VER)
cannam@162 4194 # define setmode _setmode
cannam@162 4195 # define stat _stat
cannam@162 4196 # define chmod _chmod
cannam@162 4197 # define getcwd _getcwd
cannam@162 4198 # define putenv _putenv
cannam@162 4199 # define S_IXUSR _S_IEXEC
cannam@162 4200 # ifndef _INTPTR_T_DEFINED
cannam@162 4201 # define _INTPTR_T_DEFINED
cannam@162 4202 # define intptr_t int
cannam@162 4203 # endif
cannam@162 4204 #elif defined(__MINGW32__)
cannam@162 4205 # define setmode _setmode
cannam@162 4206 # define stat _stat
cannam@162 4207 # define chmod _chmod
cannam@162 4208 # define getcwd _getcwd
cannam@162 4209 # define putenv _putenv
cannam@162 4210 #elif defined(__CYGWIN__)
cannam@162 4211 # define HAVE_SETENV
cannam@162 4212 # define FOPEN_WB "wb"
cannam@162 4213 /* #elif defined (other platforms) ... */
cannam@162 4214 #endif
cannam@162 4215
cannam@162 4216 #if defined(PATH_MAX)
cannam@162 4217 # define LT_PATHMAX PATH_MAX
cannam@162 4218 #elif defined(MAXPATHLEN)
cannam@162 4219 # define LT_PATHMAX MAXPATHLEN
cannam@162 4220 #else
cannam@162 4221 # define LT_PATHMAX 1024
cannam@162 4222 #endif
cannam@162 4223
cannam@162 4224 #ifndef S_IXOTH
cannam@162 4225 # define S_IXOTH 0
cannam@162 4226 #endif
cannam@162 4227 #ifndef S_IXGRP
cannam@162 4228 # define S_IXGRP 0
cannam@162 4229 #endif
cannam@162 4230
cannam@162 4231 /* path handling portability macros */
cannam@162 4232 #ifndef DIR_SEPARATOR
cannam@162 4233 # define DIR_SEPARATOR '/'
cannam@162 4234 # define PATH_SEPARATOR ':'
cannam@162 4235 #endif
cannam@162 4236
cannam@162 4237 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
cannam@162 4238 defined (__OS2__)
cannam@162 4239 # define HAVE_DOS_BASED_FILE_SYSTEM
cannam@162 4240 # define FOPEN_WB "wb"
cannam@162 4241 # ifndef DIR_SEPARATOR_2
cannam@162 4242 # define DIR_SEPARATOR_2 '\\'
cannam@162 4243 # endif
cannam@162 4244 # ifndef PATH_SEPARATOR_2
cannam@162 4245 # define PATH_SEPARATOR_2 ';'
cannam@162 4246 # endif
cannam@162 4247 #endif
cannam@162 4248
cannam@162 4249 #ifndef DIR_SEPARATOR_2
cannam@162 4250 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
cannam@162 4251 #else /* DIR_SEPARATOR_2 */
cannam@162 4252 # define IS_DIR_SEPARATOR(ch) \
cannam@162 4253 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
cannam@162 4254 #endif /* DIR_SEPARATOR_2 */
cannam@162 4255
cannam@162 4256 #ifndef PATH_SEPARATOR_2
cannam@162 4257 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
cannam@162 4258 #else /* PATH_SEPARATOR_2 */
cannam@162 4259 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
cannam@162 4260 #endif /* PATH_SEPARATOR_2 */
cannam@162 4261
cannam@162 4262 #ifndef FOPEN_WB
cannam@162 4263 # define FOPEN_WB "w"
cannam@162 4264 #endif
cannam@162 4265 #ifndef _O_BINARY
cannam@162 4266 # define _O_BINARY 0
cannam@162 4267 #endif
cannam@162 4268
cannam@162 4269 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
cannam@162 4270 #define XFREE(stale) do { \
cannam@162 4271 if (stale) { free ((void *) stale); stale = 0; } \
cannam@162 4272 } while (0)
cannam@162 4273
cannam@162 4274 #if defined(LT_DEBUGWRAPPER)
cannam@162 4275 static int lt_debug = 1;
cannam@162 4276 #else
cannam@162 4277 static int lt_debug = 0;
cannam@162 4278 #endif
cannam@162 4279
cannam@162 4280 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
cannam@162 4281
cannam@162 4282 void *xmalloc (size_t num);
cannam@162 4283 char *xstrdup (const char *string);
cannam@162 4284 const char *base_name (const char *name);
cannam@162 4285 char *find_executable (const char *wrapper);
cannam@162 4286 char *chase_symlinks (const char *pathspec);
cannam@162 4287 int make_executable (const char *path);
cannam@162 4288 int check_executable (const char *path);
cannam@162 4289 char *strendzap (char *str, const char *pat);
cannam@162 4290 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
cannam@162 4291 void lt_fatal (const char *file, int line, const char *message, ...);
cannam@162 4292 static const char *nonnull (const char *s);
cannam@162 4293 static const char *nonempty (const char *s);
cannam@162 4294 void lt_setenv (const char *name, const char *value);
cannam@162 4295 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
cannam@162 4296 void lt_update_exe_path (const char *name, const char *value);
cannam@162 4297 void lt_update_lib_path (const char *name, const char *value);
cannam@162 4298 char **prepare_spawn (char **argv);
cannam@162 4299 void lt_dump_script (FILE *f);
cannam@162 4300 EOF
cannam@162 4301
cannam@162 4302 cat <<EOF
cannam@162 4303 volatile const char * MAGIC_EXE = "$magic_exe";
cannam@162 4304 const char * LIB_PATH_VARNAME = "$shlibpath_var";
cannam@162 4305 EOF
cannam@162 4306
cannam@162 4307 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
cannam@162 4308 func_to_host_path "$temp_rpath"
cannam@162 4309 cat <<EOF
cannam@162 4310 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
cannam@162 4311 EOF
cannam@162 4312 else
cannam@162 4313 cat <<"EOF"
cannam@162 4314 const char * LIB_PATH_VALUE = "";
cannam@162 4315 EOF
cannam@162 4316 fi
cannam@162 4317
cannam@162 4318 if test -n "$dllsearchpath"; then
cannam@162 4319 func_to_host_path "$dllsearchpath:"
cannam@162 4320 cat <<EOF
cannam@162 4321 const char * EXE_PATH_VARNAME = "PATH";
cannam@162 4322 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
cannam@162 4323 EOF
cannam@162 4324 else
cannam@162 4325 cat <<"EOF"
cannam@162 4326 const char * EXE_PATH_VARNAME = "";
cannam@162 4327 const char * EXE_PATH_VALUE = "";
cannam@162 4328 EOF
cannam@162 4329 fi
cannam@162 4330
cannam@162 4331 if test "$fast_install" = yes; then
cannam@162 4332 cat <<EOF
cannam@162 4333 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
cannam@162 4334 EOF
cannam@162 4335 else
cannam@162 4336 cat <<EOF
cannam@162 4337 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
cannam@162 4338 EOF
cannam@162 4339 fi
cannam@162 4340
cannam@162 4341
cannam@162 4342 cat <<"EOF"
cannam@162 4343
cannam@162 4344 #define LTWRAPPER_OPTION_PREFIX "--lt-"
cannam@162 4345
cannam@162 4346 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
cannam@162 4347 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
cannam@162 4348 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
cannam@162 4349
cannam@162 4350 int
cannam@162 4351 main (int argc, char *argv[])
cannam@162 4352 {
cannam@162 4353 char **newargz;
cannam@162 4354 int newargc;
cannam@162 4355 char *tmp_pathspec;
cannam@162 4356 char *actual_cwrapper_path;
cannam@162 4357 char *actual_cwrapper_name;
cannam@162 4358 char *target_name;
cannam@162 4359 char *lt_argv_zero;
cannam@162 4360 intptr_t rval = 127;
cannam@162 4361
cannam@162 4362 int i;
cannam@162 4363
cannam@162 4364 program_name = (char *) xstrdup (base_name (argv[0]));
cannam@162 4365 newargz = XMALLOC (char *, argc + 1);
cannam@162 4366
cannam@162 4367 /* very simple arg parsing; don't want to rely on getopt
cannam@162 4368 * also, copy all non cwrapper options to newargz, except
cannam@162 4369 * argz[0], which is handled differently
cannam@162 4370 */
cannam@162 4371 newargc=0;
cannam@162 4372 for (i = 1; i < argc; i++)
cannam@162 4373 {
cannam@162 4374 if (strcmp (argv[i], dumpscript_opt) == 0)
cannam@162 4375 {
cannam@162 4376 EOF
cannam@162 4377 case "$host" in
cannam@162 4378 *mingw* | *cygwin* )
cannam@162 4379 # make stdout use "unix" line endings
cannam@162 4380 echo " setmode(1,_O_BINARY);"
cannam@162 4381 ;;
cannam@162 4382 esac
cannam@162 4383
cannam@162 4384 cat <<"EOF"
cannam@162 4385 lt_dump_script (stdout);
cannam@162 4386 return 0;
cannam@162 4387 }
cannam@162 4388 if (strcmp (argv[i], debug_opt) == 0)
cannam@162 4389 {
cannam@162 4390 lt_debug = 1;
cannam@162 4391 continue;
cannam@162 4392 }
cannam@162 4393 if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
cannam@162 4394 {
cannam@162 4395 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
cannam@162 4396 namespace, but it is not one of the ones we know about and
cannam@162 4397 have already dealt with, above (inluding dump-script), then
cannam@162 4398 report an error. Otherwise, targets might begin to believe
cannam@162 4399 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
cannam@162 4400 namespace. The first time any user complains about this, we'll
cannam@162 4401 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
cannam@162 4402 or a configure.ac-settable value.
cannam@162 4403 */
cannam@162 4404 lt_fatal (__FILE__, __LINE__,
cannam@162 4405 "unrecognized %s option: '%s'",
cannam@162 4406 ltwrapper_option_prefix, argv[i]);
cannam@162 4407 }
cannam@162 4408 /* otherwise ... */
cannam@162 4409 newargz[++newargc] = xstrdup (argv[i]);
cannam@162 4410 }
cannam@162 4411 newargz[++newargc] = NULL;
cannam@162 4412
cannam@162 4413 EOF
cannam@162 4414 cat <<EOF
cannam@162 4415 /* The GNU banner must be the first non-error debug message */
cannam@162 4416 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
cannam@162 4417 EOF
cannam@162 4418 cat <<"EOF"
cannam@162 4419 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
cannam@162 4420 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
cannam@162 4421
cannam@162 4422 tmp_pathspec = find_executable (argv[0]);
cannam@162 4423 if (tmp_pathspec == NULL)
cannam@162 4424 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
cannam@162 4425 lt_debugprintf (__FILE__, __LINE__,
cannam@162 4426 "(main) found exe (before symlink chase) at: %s\n",
cannam@162 4427 tmp_pathspec);
cannam@162 4428
cannam@162 4429 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
cannam@162 4430 lt_debugprintf (__FILE__, __LINE__,
cannam@162 4431 "(main) found exe (after symlink chase) at: %s\n",
cannam@162 4432 actual_cwrapper_path);
cannam@162 4433 XFREE (tmp_pathspec);
cannam@162 4434
cannam@162 4435 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
cannam@162 4436 strendzap (actual_cwrapper_path, actual_cwrapper_name);
cannam@162 4437
cannam@162 4438 /* wrapper name transforms */
cannam@162 4439 strendzap (actual_cwrapper_name, ".exe");
cannam@162 4440 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
cannam@162 4441 XFREE (actual_cwrapper_name);
cannam@162 4442 actual_cwrapper_name = tmp_pathspec;
cannam@162 4443 tmp_pathspec = 0;
cannam@162 4444
cannam@162 4445 /* target_name transforms -- use actual target program name; might have lt- prefix */
cannam@162 4446 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
cannam@162 4447 strendzap (target_name, ".exe");
cannam@162 4448 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
cannam@162 4449 XFREE (target_name);
cannam@162 4450 target_name = tmp_pathspec;
cannam@162 4451 tmp_pathspec = 0;
cannam@162 4452
cannam@162 4453 lt_debugprintf (__FILE__, __LINE__,
cannam@162 4454 "(main) libtool target name: %s\n",
cannam@162 4455 target_name);
cannam@162 4456 EOF
cannam@162 4457
cannam@162 4458 cat <<EOF
cannam@162 4459 newargz[0] =
cannam@162 4460 XMALLOC (char, (strlen (actual_cwrapper_path) +
cannam@162 4461 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
cannam@162 4462 strcpy (newargz[0], actual_cwrapper_path);
cannam@162 4463 strcat (newargz[0], "$objdir");
cannam@162 4464 strcat (newargz[0], "/");
cannam@162 4465 EOF
cannam@162 4466
cannam@162 4467 cat <<"EOF"
cannam@162 4468 /* stop here, and copy so we don't have to do this twice */
cannam@162 4469 tmp_pathspec = xstrdup (newargz[0]);
cannam@162 4470
cannam@162 4471 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
cannam@162 4472 strcat (newargz[0], actual_cwrapper_name);
cannam@162 4473
cannam@162 4474 /* DO want the lt- prefix here if it exists, so use target_name */
cannam@162 4475 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
cannam@162 4476 XFREE (tmp_pathspec);
cannam@162 4477 tmp_pathspec = NULL;
cannam@162 4478 EOF
cannam@162 4479
cannam@162 4480 case $host_os in
cannam@162 4481 mingw*)
cannam@162 4482 cat <<"EOF"
cannam@162 4483 {
cannam@162 4484 char* p;
cannam@162 4485 while ((p = strchr (newargz[0], '\\')) != NULL)
cannam@162 4486 {
cannam@162 4487 *p = '/';
cannam@162 4488 }
cannam@162 4489 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
cannam@162 4490 {
cannam@162 4491 *p = '/';
cannam@162 4492 }
cannam@162 4493 }
cannam@162 4494 EOF
cannam@162 4495 ;;
cannam@162 4496 esac
cannam@162 4497
cannam@162 4498 cat <<"EOF"
cannam@162 4499 XFREE (target_name);
cannam@162 4500 XFREE (actual_cwrapper_path);
cannam@162 4501 XFREE (actual_cwrapper_name);
cannam@162 4502
cannam@162 4503 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
cannam@162 4504 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
cannam@162 4505 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
cannam@162 4506 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
cannam@162 4507 because on Windows, both *_VARNAMEs are PATH but uninstalled
cannam@162 4508 libraries must come first. */
cannam@162 4509 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
cannam@162 4510 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
cannam@162 4511
cannam@162 4512 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
cannam@162 4513 nonnull (lt_argv_zero));
cannam@162 4514 for (i = 0; i < newargc; i++)
cannam@162 4515 {
cannam@162 4516 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
cannam@162 4517 i, nonnull (newargz[i]));
cannam@162 4518 }
cannam@162 4519
cannam@162 4520 EOF
cannam@162 4521
cannam@162 4522 case $host_os in
cannam@162 4523 mingw*)
cannam@162 4524 cat <<"EOF"
cannam@162 4525 /* execv doesn't actually work on mingw as expected on unix */
cannam@162 4526 newargz = prepare_spawn (newargz);
cannam@162 4527 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
cannam@162 4528 if (rval == -1)
cannam@162 4529 {
cannam@162 4530 /* failed to start process */
cannam@162 4531 lt_debugprintf (__FILE__, __LINE__,
cannam@162 4532 "(main) failed to launch target \"%s\": %s\n",
cannam@162 4533 lt_argv_zero, nonnull (strerror (errno)));
cannam@162 4534 return 127;
cannam@162 4535 }
cannam@162 4536 return rval;
cannam@162 4537 EOF
cannam@162 4538 ;;
cannam@162 4539 *)
cannam@162 4540 cat <<"EOF"
cannam@162 4541 execv (lt_argv_zero, newargz);
cannam@162 4542 return rval; /* =127, but avoids unused variable warning */
cannam@162 4543 EOF
cannam@162 4544 ;;
cannam@162 4545 esac
cannam@162 4546
cannam@162 4547 cat <<"EOF"
cannam@162 4548 }
cannam@162 4549
cannam@162 4550 void *
cannam@162 4551 xmalloc (size_t num)
cannam@162 4552 {
cannam@162 4553 void *p = (void *) malloc (num);
cannam@162 4554 if (!p)
cannam@162 4555 lt_fatal (__FILE__, __LINE__, "memory exhausted");
cannam@162 4556
cannam@162 4557 return p;
cannam@162 4558 }
cannam@162 4559
cannam@162 4560 char *
cannam@162 4561 xstrdup (const char *string)
cannam@162 4562 {
cannam@162 4563 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
cannam@162 4564 string) : NULL;
cannam@162 4565 }
cannam@162 4566
cannam@162 4567 const char *
cannam@162 4568 base_name (const char *name)
cannam@162 4569 {
cannam@162 4570 const char *base;
cannam@162 4571
cannam@162 4572 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
cannam@162 4573 /* Skip over the disk name in MSDOS pathnames. */
cannam@162 4574 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
cannam@162 4575 name += 2;
cannam@162 4576 #endif
cannam@162 4577
cannam@162 4578 for (base = name; *name; name++)
cannam@162 4579 if (IS_DIR_SEPARATOR (*name))
cannam@162 4580 base = name + 1;
cannam@162 4581 return base;
cannam@162 4582 }
cannam@162 4583
cannam@162 4584 int
cannam@162 4585 check_executable (const char *path)
cannam@162 4586 {
cannam@162 4587 struct stat st;
cannam@162 4588
cannam@162 4589 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
cannam@162 4590 nonempty (path));
cannam@162 4591 if ((!path) || (!*path))
cannam@162 4592 return 0;
cannam@162 4593
cannam@162 4594 if ((stat (path, &st) >= 0)
cannam@162 4595 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
cannam@162 4596 return 1;
cannam@162 4597 else
cannam@162 4598 return 0;
cannam@162 4599 }
cannam@162 4600
cannam@162 4601 int
cannam@162 4602 make_executable (const char *path)
cannam@162 4603 {
cannam@162 4604 int rval = 0;
cannam@162 4605 struct stat st;
cannam@162 4606
cannam@162 4607 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
cannam@162 4608 nonempty (path));
cannam@162 4609 if ((!path) || (!*path))
cannam@162 4610 return 0;
cannam@162 4611
cannam@162 4612 if (stat (path, &st) >= 0)
cannam@162 4613 {
cannam@162 4614 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
cannam@162 4615 }
cannam@162 4616 return rval;
cannam@162 4617 }
cannam@162 4618
cannam@162 4619 /* Searches for the full path of the wrapper. Returns
cannam@162 4620 newly allocated full path name if found, NULL otherwise
cannam@162 4621 Does not chase symlinks, even on platforms that support them.
cannam@162 4622 */
cannam@162 4623 char *
cannam@162 4624 find_executable (const char *wrapper)
cannam@162 4625 {
cannam@162 4626 int has_slash = 0;
cannam@162 4627 const char *p;
cannam@162 4628 const char *p_next;
cannam@162 4629 /* static buffer for getcwd */
cannam@162 4630 char tmp[LT_PATHMAX + 1];
cannam@162 4631 int tmp_len;
cannam@162 4632 char *concat_name;
cannam@162 4633
cannam@162 4634 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
cannam@162 4635 nonempty (wrapper));
cannam@162 4636
cannam@162 4637 if ((wrapper == NULL) || (*wrapper == '\0'))
cannam@162 4638 return NULL;
cannam@162 4639
cannam@162 4640 /* Absolute path? */
cannam@162 4641 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
cannam@162 4642 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
cannam@162 4643 {
cannam@162 4644 concat_name = xstrdup (wrapper);
cannam@162 4645 if (check_executable (concat_name))
cannam@162 4646 return concat_name;
cannam@162 4647 XFREE (concat_name);
cannam@162 4648 }
cannam@162 4649 else
cannam@162 4650 {
cannam@162 4651 #endif
cannam@162 4652 if (IS_DIR_SEPARATOR (wrapper[0]))
cannam@162 4653 {
cannam@162 4654 concat_name = xstrdup (wrapper);
cannam@162 4655 if (check_executable (concat_name))
cannam@162 4656 return concat_name;
cannam@162 4657 XFREE (concat_name);
cannam@162 4658 }
cannam@162 4659 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
cannam@162 4660 }
cannam@162 4661 #endif
cannam@162 4662
cannam@162 4663 for (p = wrapper; *p; p++)
cannam@162 4664 if (*p == '/')
cannam@162 4665 {
cannam@162 4666 has_slash = 1;
cannam@162 4667 break;
cannam@162 4668 }
cannam@162 4669 if (!has_slash)
cannam@162 4670 {
cannam@162 4671 /* no slashes; search PATH */
cannam@162 4672 const char *path = getenv ("PATH");
cannam@162 4673 if (path != NULL)
cannam@162 4674 {
cannam@162 4675 for (p = path; *p; p = p_next)
cannam@162 4676 {
cannam@162 4677 const char *q;
cannam@162 4678 size_t p_len;
cannam@162 4679 for (q = p; *q; q++)
cannam@162 4680 if (IS_PATH_SEPARATOR (*q))
cannam@162 4681 break;
cannam@162 4682 p_len = q - p;
cannam@162 4683 p_next = (*q == '\0' ? q : q + 1);
cannam@162 4684 if (p_len == 0)
cannam@162 4685 {
cannam@162 4686 /* empty path: current directory */
cannam@162 4687 if (getcwd (tmp, LT_PATHMAX) == NULL)
cannam@162 4688 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
cannam@162 4689 nonnull (strerror (errno)));
cannam@162 4690 tmp_len = strlen (tmp);
cannam@162 4691 concat_name =
cannam@162 4692 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
cannam@162 4693 memcpy (concat_name, tmp, tmp_len);
cannam@162 4694 concat_name[tmp_len] = '/';
cannam@162 4695 strcpy (concat_name + tmp_len + 1, wrapper);
cannam@162 4696 }
cannam@162 4697 else
cannam@162 4698 {
cannam@162 4699 concat_name =
cannam@162 4700 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
cannam@162 4701 memcpy (concat_name, p, p_len);
cannam@162 4702 concat_name[p_len] = '/';
cannam@162 4703 strcpy (concat_name + p_len + 1, wrapper);
cannam@162 4704 }
cannam@162 4705 if (check_executable (concat_name))
cannam@162 4706 return concat_name;
cannam@162 4707 XFREE (concat_name);
cannam@162 4708 }
cannam@162 4709 }
cannam@162 4710 /* not found in PATH; assume curdir */
cannam@162 4711 }
cannam@162 4712 /* Relative path | not found in path: prepend cwd */
cannam@162 4713 if (getcwd (tmp, LT_PATHMAX) == NULL)
cannam@162 4714 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
cannam@162 4715 nonnull (strerror (errno)));
cannam@162 4716 tmp_len = strlen (tmp);
cannam@162 4717 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
cannam@162 4718 memcpy (concat_name, tmp, tmp_len);
cannam@162 4719 concat_name[tmp_len] = '/';
cannam@162 4720 strcpy (concat_name + tmp_len + 1, wrapper);
cannam@162 4721
cannam@162 4722 if (check_executable (concat_name))
cannam@162 4723 return concat_name;
cannam@162 4724 XFREE (concat_name);
cannam@162 4725 return NULL;
cannam@162 4726 }
cannam@162 4727
cannam@162 4728 char *
cannam@162 4729 chase_symlinks (const char *pathspec)
cannam@162 4730 {
cannam@162 4731 #ifndef S_ISLNK
cannam@162 4732 return xstrdup (pathspec);
cannam@162 4733 #else
cannam@162 4734 char buf[LT_PATHMAX];
cannam@162 4735 struct stat s;
cannam@162 4736 char *tmp_pathspec = xstrdup (pathspec);
cannam@162 4737 char *p;
cannam@162 4738 int has_symlinks = 0;
cannam@162 4739 while (strlen (tmp_pathspec) && !has_symlinks)
cannam@162 4740 {
cannam@162 4741 lt_debugprintf (__FILE__, __LINE__,
cannam@162 4742 "checking path component for symlinks: %s\n",
cannam@162 4743 tmp_pathspec);
cannam@162 4744 if (lstat (tmp_pathspec, &s) == 0)
cannam@162 4745 {
cannam@162 4746 if (S_ISLNK (s.st_mode) != 0)
cannam@162 4747 {
cannam@162 4748 has_symlinks = 1;
cannam@162 4749 break;
cannam@162 4750 }
cannam@162 4751
cannam@162 4752 /* search backwards for last DIR_SEPARATOR */
cannam@162 4753 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
cannam@162 4754 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
cannam@162 4755 p--;
cannam@162 4756 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
cannam@162 4757 {
cannam@162 4758 /* no more DIR_SEPARATORS left */
cannam@162 4759 break;
cannam@162 4760 }
cannam@162 4761 *p = '\0';
cannam@162 4762 }
cannam@162 4763 else
cannam@162 4764 {
cannam@162 4765 lt_fatal (__FILE__, __LINE__,
cannam@162 4766 "error accessing file \"%s\": %s",
cannam@162 4767 tmp_pathspec, nonnull (strerror (errno)));
cannam@162 4768 }
cannam@162 4769 }
cannam@162 4770 XFREE (tmp_pathspec);
cannam@162 4771
cannam@162 4772 if (!has_symlinks)
cannam@162 4773 {
cannam@162 4774 return xstrdup (pathspec);
cannam@162 4775 }
cannam@162 4776
cannam@162 4777 tmp_pathspec = realpath (pathspec, buf);
cannam@162 4778 if (tmp_pathspec == 0)
cannam@162 4779 {
cannam@162 4780 lt_fatal (__FILE__, __LINE__,
cannam@162 4781 "could not follow symlinks for %s", pathspec);
cannam@162 4782 }
cannam@162 4783 return xstrdup (tmp_pathspec);
cannam@162 4784 #endif
cannam@162 4785 }
cannam@162 4786
cannam@162 4787 char *
cannam@162 4788 strendzap (char *str, const char *pat)
cannam@162 4789 {
cannam@162 4790 size_t len, patlen;
cannam@162 4791
cannam@162 4792 assert (str != NULL);
cannam@162 4793 assert (pat != NULL);
cannam@162 4794
cannam@162 4795 len = strlen (str);
cannam@162 4796 patlen = strlen (pat);
cannam@162 4797
cannam@162 4798 if (patlen <= len)
cannam@162 4799 {
cannam@162 4800 str += len - patlen;
cannam@162 4801 if (strcmp (str, pat) == 0)
cannam@162 4802 *str = '\0';
cannam@162 4803 }
cannam@162 4804 return str;
cannam@162 4805 }
cannam@162 4806
cannam@162 4807 void
cannam@162 4808 lt_debugprintf (const char *file, int line, const char *fmt, ...)
cannam@162 4809 {
cannam@162 4810 va_list args;
cannam@162 4811 if (lt_debug)
cannam@162 4812 {
cannam@162 4813 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
cannam@162 4814 va_start (args, fmt);
cannam@162 4815 (void) vfprintf (stderr, fmt, args);
cannam@162 4816 va_end (args);
cannam@162 4817 }
cannam@162 4818 }
cannam@162 4819
cannam@162 4820 static void
cannam@162 4821 lt_error_core (int exit_status, const char *file,
cannam@162 4822 int line, const char *mode,
cannam@162 4823 const char *message, va_list ap)
cannam@162 4824 {
cannam@162 4825 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
cannam@162 4826 vfprintf (stderr, message, ap);
cannam@162 4827 fprintf (stderr, ".\n");
cannam@162 4828
cannam@162 4829 if (exit_status >= 0)
cannam@162 4830 exit (exit_status);
cannam@162 4831 }
cannam@162 4832
cannam@162 4833 void
cannam@162 4834 lt_fatal (const char *file, int line, const char *message, ...)
cannam@162 4835 {
cannam@162 4836 va_list ap;
cannam@162 4837 va_start (ap, message);
cannam@162 4838 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
cannam@162 4839 va_end (ap);
cannam@162 4840 }
cannam@162 4841
cannam@162 4842 static const char *
cannam@162 4843 nonnull (const char *s)
cannam@162 4844 {
cannam@162 4845 return s ? s : "(null)";
cannam@162 4846 }
cannam@162 4847
cannam@162 4848 static const char *
cannam@162 4849 nonempty (const char *s)
cannam@162 4850 {
cannam@162 4851 return (s && !*s) ? "(empty)" : nonnull (s);
cannam@162 4852 }
cannam@162 4853
cannam@162 4854 void
cannam@162 4855 lt_setenv (const char *name, const char *value)
cannam@162 4856 {
cannam@162 4857 lt_debugprintf (__FILE__, __LINE__,
cannam@162 4858 "(lt_setenv) setting '%s' to '%s'\n",
cannam@162 4859 nonnull (name), nonnull (value));
cannam@162 4860 {
cannam@162 4861 #ifdef HAVE_SETENV
cannam@162 4862 /* always make a copy, for consistency with !HAVE_SETENV */
cannam@162 4863 char *str = xstrdup (value);
cannam@162 4864 setenv (name, str, 1);
cannam@162 4865 #else
cannam@162 4866 int len = strlen (name) + 1 + strlen (value) + 1;
cannam@162 4867 char *str = XMALLOC (char, len);
cannam@162 4868 sprintf (str, "%s=%s", name, value);
cannam@162 4869 if (putenv (str) != EXIT_SUCCESS)
cannam@162 4870 {
cannam@162 4871 XFREE (str);
cannam@162 4872 }
cannam@162 4873 #endif
cannam@162 4874 }
cannam@162 4875 }
cannam@162 4876
cannam@162 4877 char *
cannam@162 4878 lt_extend_str (const char *orig_value, const char *add, int to_end)
cannam@162 4879 {
cannam@162 4880 char *new_value;
cannam@162 4881 if (orig_value && *orig_value)
cannam@162 4882 {
cannam@162 4883 int orig_value_len = strlen (orig_value);
cannam@162 4884 int add_len = strlen (add);
cannam@162 4885 new_value = XMALLOC (char, add_len + orig_value_len + 1);
cannam@162 4886 if (to_end)
cannam@162 4887 {
cannam@162 4888 strcpy (new_value, orig_value);
cannam@162 4889 strcpy (new_value + orig_value_len, add);
cannam@162 4890 }
cannam@162 4891 else
cannam@162 4892 {
cannam@162 4893 strcpy (new_value, add);
cannam@162 4894 strcpy (new_value + add_len, orig_value);
cannam@162 4895 }
cannam@162 4896 }
cannam@162 4897 else
cannam@162 4898 {
cannam@162 4899 new_value = xstrdup (add);
cannam@162 4900 }
cannam@162 4901 return new_value;
cannam@162 4902 }
cannam@162 4903
cannam@162 4904 void
cannam@162 4905 lt_update_exe_path (const char *name, const char *value)
cannam@162 4906 {
cannam@162 4907 lt_debugprintf (__FILE__, __LINE__,
cannam@162 4908 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
cannam@162 4909 nonnull (name), nonnull (value));
cannam@162 4910
cannam@162 4911 if (name && *name && value && *value)
cannam@162 4912 {
cannam@162 4913 char *new_value = lt_extend_str (getenv (name), value, 0);
cannam@162 4914 /* some systems can't cope with a ':'-terminated path #' */
cannam@162 4915 int len = strlen (new_value);
cannam@162 4916 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
cannam@162 4917 {
cannam@162 4918 new_value[len-1] = '\0';
cannam@162 4919 }
cannam@162 4920 lt_setenv (name, new_value);
cannam@162 4921 XFREE (new_value);
cannam@162 4922 }
cannam@162 4923 }
cannam@162 4924
cannam@162 4925 void
cannam@162 4926 lt_update_lib_path (const char *name, const char *value)
cannam@162 4927 {
cannam@162 4928 lt_debugprintf (__FILE__, __LINE__,
cannam@162 4929 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
cannam@162 4930 nonnull (name), nonnull (value));
cannam@162 4931
cannam@162 4932 if (name && *name && value && *value)
cannam@162 4933 {
cannam@162 4934 char *new_value = lt_extend_str (getenv (name), value, 0);
cannam@162 4935 lt_setenv (name, new_value);
cannam@162 4936 XFREE (new_value);
cannam@162 4937 }
cannam@162 4938 }
cannam@162 4939
cannam@162 4940 EOF
cannam@162 4941 case $host_os in
cannam@162 4942 mingw*)
cannam@162 4943 cat <<"EOF"
cannam@162 4944
cannam@162 4945 /* Prepares an argument vector before calling spawn().
cannam@162 4946 Note that spawn() does not by itself call the command interpreter
cannam@162 4947 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
cannam@162 4948 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
cannam@162 4949 GetVersionEx(&v);
cannam@162 4950 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
cannam@162 4951 }) ? "cmd.exe" : "command.com").
cannam@162 4952 Instead it simply concatenates the arguments, separated by ' ', and calls
cannam@162 4953 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
cannam@162 4954 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
cannam@162 4955 special way:
cannam@162 4956 - Space and tab are interpreted as delimiters. They are not treated as
cannam@162 4957 delimiters if they are surrounded by double quotes: "...".
cannam@162 4958 - Unescaped double quotes are removed from the input. Their only effect is
cannam@162 4959 that within double quotes, space and tab are treated like normal
cannam@162 4960 characters.
cannam@162 4961 - Backslashes not followed by double quotes are not special.
cannam@162 4962 - But 2*n+1 backslashes followed by a double quote become
cannam@162 4963 n backslashes followed by a double quote (n >= 0):
cannam@162 4964 \" -> "
cannam@162 4965 \\\" -> \"
cannam@162 4966 \\\\\" -> \\"
cannam@162 4967 */
cannam@162 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@162 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@162 4970 char **
cannam@162 4971 prepare_spawn (char **argv)
cannam@162 4972 {
cannam@162 4973 size_t argc;
cannam@162 4974 char **new_argv;
cannam@162 4975 size_t i;
cannam@162 4976
cannam@162 4977 /* Count number of arguments. */
cannam@162 4978 for (argc = 0; argv[argc] != NULL; argc++)
cannam@162 4979 ;
cannam@162 4980
cannam@162 4981 /* Allocate new argument vector. */
cannam@162 4982 new_argv = XMALLOC (char *, argc + 1);
cannam@162 4983
cannam@162 4984 /* Put quoted arguments into the new argument vector. */
cannam@162 4985 for (i = 0; i < argc; i++)
cannam@162 4986 {
cannam@162 4987 const char *string = argv[i];
cannam@162 4988
cannam@162 4989 if (string[0] == '\0')
cannam@162 4990 new_argv[i] = xstrdup ("\"\"");
cannam@162 4991 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
cannam@162 4992 {
cannam@162 4993 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
cannam@162 4994 size_t length;
cannam@162 4995 unsigned int backslashes;
cannam@162 4996 const char *s;
cannam@162 4997 char *quoted_string;
cannam@162 4998 char *p;
cannam@162 4999
cannam@162 5000 length = 0;
cannam@162 5001 backslashes = 0;
cannam@162 5002 if (quote_around)
cannam@162 5003 length++;
cannam@162 5004 for (s = string; *s != '\0'; s++)
cannam@162 5005 {
cannam@162 5006 char c = *s;
cannam@162 5007 if (c == '"')
cannam@162 5008 length += backslashes + 1;
cannam@162 5009 length++;
cannam@162 5010 if (c == '\\')
cannam@162 5011 backslashes++;
cannam@162 5012 else
cannam@162 5013 backslashes = 0;
cannam@162 5014 }
cannam@162 5015 if (quote_around)
cannam@162 5016 length += backslashes + 1;
cannam@162 5017
cannam@162 5018 quoted_string = XMALLOC (char, length + 1);
cannam@162 5019
cannam@162 5020 p = quoted_string;
cannam@162 5021 backslashes = 0;
cannam@162 5022 if (quote_around)
cannam@162 5023 *p++ = '"';
cannam@162 5024 for (s = string; *s != '\0'; s++)
cannam@162 5025 {
cannam@162 5026 char c = *s;
cannam@162 5027 if (c == '"')
cannam@162 5028 {
cannam@162 5029 unsigned int j;
cannam@162 5030 for (j = backslashes + 1; j > 0; j--)
cannam@162 5031 *p++ = '\\';
cannam@162 5032 }
cannam@162 5033 *p++ = c;
cannam@162 5034 if (c == '\\')
cannam@162 5035 backslashes++;
cannam@162 5036 else
cannam@162 5037 backslashes = 0;
cannam@162 5038 }
cannam@162 5039 if (quote_around)
cannam@162 5040 {
cannam@162 5041 unsigned int j;
cannam@162 5042 for (j = backslashes; j > 0; j--)
cannam@162 5043 *p++ = '\\';
cannam@162 5044 *p++ = '"';
cannam@162 5045 }
cannam@162 5046 *p = '\0';
cannam@162 5047
cannam@162 5048 new_argv[i] = quoted_string;
cannam@162 5049 }
cannam@162 5050 else
cannam@162 5051 new_argv[i] = (char *) string;
cannam@162 5052 }
cannam@162 5053 new_argv[argc] = NULL;
cannam@162 5054
cannam@162 5055 return new_argv;
cannam@162 5056 }
cannam@162 5057 EOF
cannam@162 5058 ;;
cannam@162 5059 esac
cannam@162 5060
cannam@162 5061 cat <<"EOF"
cannam@162 5062 void lt_dump_script (FILE* f)
cannam@162 5063 {
cannam@162 5064 EOF
cannam@162 5065 func_emit_wrapper yes |
cannam@162 5066 $SED -n -e '
cannam@162 5067 s/^\(.\{79\}\)\(..*\)/\1\
cannam@162 5068 \2/
cannam@162 5069 h
cannam@162 5070 s/\([\\"]\)/\\\1/g
cannam@162 5071 s/$/\\n/
cannam@162 5072 s/\([^\n]*\).*/ fputs ("\1", f);/p
cannam@162 5073 g
cannam@162 5074 D'
cannam@162 5075 cat <<"EOF"
cannam@162 5076 }
cannam@162 5077 EOF
cannam@162 5078 }
cannam@162 5079 # end: func_emit_cwrapperexe_src
cannam@162 5080
cannam@162 5081 # func_win32_import_lib_p ARG
cannam@162 5082 # True if ARG is an import lib, as indicated by $file_magic_cmd
cannam@162 5083 func_win32_import_lib_p ()
cannam@162 5084 {
cannam@162 5085 $opt_debug
cannam@162 5086 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
cannam@162 5087 *import*) : ;;
cannam@162 5088 *) false ;;
cannam@162 5089 esac
cannam@162 5090 }
cannam@162 5091
cannam@162 5092 # func_mode_link arg...
cannam@162 5093 func_mode_link ()
cannam@162 5094 {
cannam@162 5095 $opt_debug
cannam@162 5096 case $host in
cannam@162 5097 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
cannam@162 5098 # It is impossible to link a dll without this setting, and
cannam@162 5099 # we shouldn't force the makefile maintainer to figure out
cannam@162 5100 # which system we are compiling for in order to pass an extra
cannam@162 5101 # flag for every libtool invocation.
cannam@162 5102 # allow_undefined=no
cannam@162 5103
cannam@162 5104 # FIXME: Unfortunately, there are problems with the above when trying
cannam@162 5105 # to make a dll which has undefined symbols, in which case not
cannam@162 5106 # even a static library is built. For now, we need to specify
cannam@162 5107 # -no-undefined on the libtool link line when we can be certain
cannam@162 5108 # that all symbols are satisfied, otherwise we get a static library.
cannam@162 5109 allow_undefined=yes
cannam@162 5110 ;;
cannam@162 5111 *)
cannam@162 5112 allow_undefined=yes
cannam@162 5113 ;;
cannam@162 5114 esac
cannam@162 5115 libtool_args=$nonopt
cannam@162 5116 base_compile="$nonopt $@"
cannam@162 5117 compile_command=$nonopt
cannam@162 5118 finalize_command=$nonopt
cannam@162 5119
cannam@162 5120 compile_rpath=
cannam@162 5121 finalize_rpath=
cannam@162 5122 compile_shlibpath=
cannam@162 5123 finalize_shlibpath=
cannam@162 5124 convenience=
cannam@162 5125 old_convenience=
cannam@162 5126 deplibs=
cannam@162 5127 old_deplibs=
cannam@162 5128 compiler_flags=
cannam@162 5129 linker_flags=
cannam@162 5130 dllsearchpath=
cannam@162 5131 lib_search_path=`pwd`
cannam@162 5132 inst_prefix_dir=
cannam@162 5133 new_inherited_linker_flags=
cannam@162 5134
cannam@162 5135 avoid_version=no
cannam@162 5136 bindir=
cannam@162 5137 dlfiles=
cannam@162 5138 dlprefiles=
cannam@162 5139 dlself=no
cannam@162 5140 export_dynamic=no
cannam@162 5141 export_symbols=
cannam@162 5142 export_symbols_regex=
cannam@162 5143 generated=
cannam@162 5144 libobjs=
cannam@162 5145 ltlibs=
cannam@162 5146 module=no
cannam@162 5147 no_install=no
cannam@162 5148 objs=
cannam@162 5149 non_pic_objects=
cannam@162 5150 precious_files_regex=
cannam@162 5151 prefer_static_libs=no
cannam@162 5152 preload=no
cannam@162 5153 prev=
cannam@162 5154 prevarg=
cannam@162 5155 release=
cannam@162 5156 rpath=
cannam@162 5157 xrpath=
cannam@162 5158 perm_rpath=
cannam@162 5159 temp_rpath=
cannam@162 5160 thread_safe=no
cannam@162 5161 vinfo=
cannam@162 5162 vinfo_number=no
cannam@162 5163 weak_libs=
cannam@162 5164 single_module="${wl}-single_module"
cannam@162 5165 func_infer_tag $base_compile
cannam@162 5166
cannam@162 5167 # We need to know -static, to get the right output filenames.
cannam@162 5168 for arg
cannam@162 5169 do
cannam@162 5170 case $arg in
cannam@162 5171 -shared)
cannam@162 5172 test "$build_libtool_libs" != yes && \
cannam@162 5173 func_fatal_configuration "can not build a shared library"
cannam@162 5174 build_old_libs=no
cannam@162 5175 break
cannam@162 5176 ;;
cannam@162 5177 -all-static | -static | -static-libtool-libs)
cannam@162 5178 case $arg in
cannam@162 5179 -all-static)
cannam@162 5180 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
cannam@162 5181 func_warning "complete static linking is impossible in this configuration"
cannam@162 5182 fi
cannam@162 5183 if test -n "$link_static_flag"; then
cannam@162 5184 dlopen_self=$dlopen_self_static
cannam@162 5185 fi
cannam@162 5186 prefer_static_libs=yes
cannam@162 5187 ;;
cannam@162 5188 -static)
cannam@162 5189 if test -z "$pic_flag" && test -n "$link_static_flag"; then
cannam@162 5190 dlopen_self=$dlopen_self_static
cannam@162 5191 fi
cannam@162 5192 prefer_static_libs=built
cannam@162 5193 ;;
cannam@162 5194 -static-libtool-libs)
cannam@162 5195 if test -z "$pic_flag" && test -n "$link_static_flag"; then
cannam@162 5196 dlopen_self=$dlopen_self_static
cannam@162 5197 fi
cannam@162 5198 prefer_static_libs=yes
cannam@162 5199 ;;
cannam@162 5200 esac
cannam@162 5201 build_libtool_libs=no
cannam@162 5202 build_old_libs=yes
cannam@162 5203 break
cannam@162 5204 ;;
cannam@162 5205 esac
cannam@162 5206 done
cannam@162 5207
cannam@162 5208 # See if our shared archives depend on static archives.
cannam@162 5209 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
cannam@162 5210
cannam@162 5211 # Go through the arguments, transforming them on the way.
cannam@162 5212 while test "$#" -gt 0; do
cannam@162 5213 arg="$1"
cannam@162 5214 shift
cannam@162 5215 func_quote_for_eval "$arg"
cannam@162 5216 qarg=$func_quote_for_eval_unquoted_result
cannam@162 5217 func_append libtool_args " $func_quote_for_eval_result"
cannam@162 5218
cannam@162 5219 # If the previous option needs an argument, assign it.
cannam@162 5220 if test -n "$prev"; then
cannam@162 5221 case $prev in
cannam@162 5222 output)
cannam@162 5223 func_append compile_command " @OUTPUT@"
cannam@162 5224 func_append finalize_command " @OUTPUT@"
cannam@162 5225 ;;
cannam@162 5226 esac
cannam@162 5227
cannam@162 5228 case $prev in
cannam@162 5229 bindir)
cannam@162 5230 bindir="$arg"
cannam@162 5231 prev=
cannam@162 5232 continue
cannam@162 5233 ;;
cannam@162 5234 dlfiles|dlprefiles)
cannam@162 5235 if test "$preload" = no; then
cannam@162 5236 # Add the symbol object into the linking commands.
cannam@162 5237 func_append compile_command " @SYMFILE@"
cannam@162 5238 func_append finalize_command " @SYMFILE@"
cannam@162 5239 preload=yes
cannam@162 5240 fi
cannam@162 5241 case $arg in
cannam@162 5242 *.la | *.lo) ;; # We handle these cases below.
cannam@162 5243 force)
cannam@162 5244 if test "$dlself" = no; then
cannam@162 5245 dlself=needless
cannam@162 5246 export_dynamic=yes
cannam@162 5247 fi
cannam@162 5248 prev=
cannam@162 5249 continue
cannam@162 5250 ;;
cannam@162 5251 self)
cannam@162 5252 if test "$prev" = dlprefiles; then
cannam@162 5253 dlself=yes
cannam@162 5254 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
cannam@162 5255 dlself=yes
cannam@162 5256 else
cannam@162 5257 dlself=needless
cannam@162 5258 export_dynamic=yes
cannam@162 5259 fi
cannam@162 5260 prev=
cannam@162 5261 continue
cannam@162 5262 ;;
cannam@162 5263 *)
cannam@162 5264 if test "$prev" = dlfiles; then
cannam@162 5265 func_append dlfiles " $arg"
cannam@162 5266 else
cannam@162 5267 func_append dlprefiles " $arg"
cannam@162 5268 fi
cannam@162 5269 prev=
cannam@162 5270 continue
cannam@162 5271 ;;
cannam@162 5272 esac
cannam@162 5273 ;;
cannam@162 5274 expsyms)
cannam@162 5275 export_symbols="$arg"
cannam@162 5276 test -f "$arg" \
cannam@162 5277 || func_fatal_error "symbol file \`$arg' does not exist"
cannam@162 5278 prev=
cannam@162 5279 continue
cannam@162 5280 ;;
cannam@162 5281 expsyms_regex)
cannam@162 5282 export_symbols_regex="$arg"
cannam@162 5283 prev=
cannam@162 5284 continue
cannam@162 5285 ;;
cannam@162 5286 framework)
cannam@162 5287 case $host in
cannam@162 5288 *-*-darwin*)
cannam@162 5289 case "$deplibs " in
cannam@162 5290 *" $qarg.ltframework "*) ;;
cannam@162 5291 *) func_append deplibs " $qarg.ltframework" # this is fixed later
cannam@162 5292 ;;
cannam@162 5293 esac
cannam@162 5294 ;;
cannam@162 5295 esac
cannam@162 5296 prev=
cannam@162 5297 continue
cannam@162 5298 ;;
cannam@162 5299 inst_prefix)
cannam@162 5300 inst_prefix_dir="$arg"
cannam@162 5301 prev=
cannam@162 5302 continue
cannam@162 5303 ;;
cannam@162 5304 objectlist)
cannam@162 5305 if test -f "$arg"; then
cannam@162 5306 save_arg=$arg
cannam@162 5307 moreargs=
cannam@162 5308 for fil in `cat "$save_arg"`
cannam@162 5309 do
cannam@162 5310 # func_append moreargs " $fil"
cannam@162 5311 arg=$fil
cannam@162 5312 # A libtool-controlled object.
cannam@162 5313
cannam@162 5314 # Check to see that this really is a libtool object.
cannam@162 5315 if func_lalib_unsafe_p "$arg"; then
cannam@162 5316 pic_object=
cannam@162 5317 non_pic_object=
cannam@162 5318
cannam@162 5319 # Read the .lo file
cannam@162 5320 func_source "$arg"
cannam@162 5321
cannam@162 5322 if test -z "$pic_object" ||
cannam@162 5323 test -z "$non_pic_object" ||
cannam@162 5324 test "$pic_object" = none &&
cannam@162 5325 test "$non_pic_object" = none; then
cannam@162 5326 func_fatal_error "cannot find name of object for \`$arg'"
cannam@162 5327 fi
cannam@162 5328
cannam@162 5329 # Extract subdirectory from the argument.
cannam@162 5330 func_dirname "$arg" "/" ""
cannam@162 5331 xdir="$func_dirname_result"
cannam@162 5332
cannam@162 5333 if test "$pic_object" != none; then
cannam@162 5334 # Prepend the subdirectory the object is found in.
cannam@162 5335 pic_object="$xdir$pic_object"
cannam@162 5336
cannam@162 5337 if test "$prev" = dlfiles; then
cannam@162 5338 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
cannam@162 5339 func_append dlfiles " $pic_object"
cannam@162 5340 prev=
cannam@162 5341 continue
cannam@162 5342 else
cannam@162 5343 # If libtool objects are unsupported, then we need to preload.
cannam@162 5344 prev=dlprefiles
cannam@162 5345 fi
cannam@162 5346 fi
cannam@162 5347
cannam@162 5348 # CHECK ME: I think I busted this. -Ossama
cannam@162 5349 if test "$prev" = dlprefiles; then
cannam@162 5350 # Preload the old-style object.
cannam@162 5351 func_append dlprefiles " $pic_object"
cannam@162 5352 prev=
cannam@162 5353 fi
cannam@162 5354
cannam@162 5355 # A PIC object.
cannam@162 5356 func_append libobjs " $pic_object"
cannam@162 5357 arg="$pic_object"
cannam@162 5358 fi
cannam@162 5359
cannam@162 5360 # Non-PIC object.
cannam@162 5361 if test "$non_pic_object" != none; then
cannam@162 5362 # Prepend the subdirectory the object is found in.
cannam@162 5363 non_pic_object="$xdir$non_pic_object"
cannam@162 5364
cannam@162 5365 # A standard non-PIC object
cannam@162 5366 func_append non_pic_objects " $non_pic_object"
cannam@162 5367 if test -z "$pic_object" || test "$pic_object" = none ; then
cannam@162 5368 arg="$non_pic_object"
cannam@162 5369 fi
cannam@162 5370 else
cannam@162 5371 # If the PIC object exists, use it instead.
cannam@162 5372 # $xdir was prepended to $pic_object above.
cannam@162 5373 non_pic_object="$pic_object"
cannam@162 5374 func_append non_pic_objects " $non_pic_object"
cannam@162 5375 fi
cannam@162 5376 else
cannam@162 5377 # Only an error if not doing a dry-run.
cannam@162 5378 if $opt_dry_run; then
cannam@162 5379 # Extract subdirectory from the argument.
cannam@162 5380 func_dirname "$arg" "/" ""
cannam@162 5381 xdir="$func_dirname_result"
cannam@162 5382
cannam@162 5383 func_lo2o "$arg"
cannam@162 5384 pic_object=$xdir$objdir/$func_lo2o_result
cannam@162 5385 non_pic_object=$xdir$func_lo2o_result
cannam@162 5386 func_append libobjs " $pic_object"
cannam@162 5387 func_append non_pic_objects " $non_pic_object"
cannam@162 5388 else
cannam@162 5389 func_fatal_error "\`$arg' is not a valid libtool object"
cannam@162 5390 fi
cannam@162 5391 fi
cannam@162 5392 done
cannam@162 5393 else
cannam@162 5394 func_fatal_error "link input file \`$arg' does not exist"
cannam@162 5395 fi
cannam@162 5396 arg=$save_arg
cannam@162 5397 prev=
cannam@162 5398 continue
cannam@162 5399 ;;
cannam@162 5400 precious_regex)
cannam@162 5401 precious_files_regex="$arg"
cannam@162 5402 prev=
cannam@162 5403 continue
cannam@162 5404 ;;
cannam@162 5405 release)
cannam@162 5406 release="-$arg"
cannam@162 5407 prev=
cannam@162 5408 continue
cannam@162 5409 ;;
cannam@162 5410 rpath | xrpath)
cannam@162 5411 # We need an absolute path.
cannam@162 5412 case $arg in
cannam@162 5413 [\\/]* | [A-Za-z]:[\\/]*) ;;
cannam@162 5414 *)
cannam@162 5415 func_fatal_error "only absolute run-paths are allowed"
cannam@162 5416 ;;
cannam@162 5417 esac
cannam@162 5418 if test "$prev" = rpath; then
cannam@162 5419 case "$rpath " in
cannam@162 5420 *" $arg "*) ;;
cannam@162 5421 *) func_append rpath " $arg" ;;
cannam@162 5422 esac
cannam@162 5423 else
cannam@162 5424 case "$xrpath " in
cannam@162 5425 *" $arg "*) ;;
cannam@162 5426 *) func_append xrpath " $arg" ;;
cannam@162 5427 esac
cannam@162 5428 fi
cannam@162 5429 prev=
cannam@162 5430 continue
cannam@162 5431 ;;
cannam@162 5432 shrext)
cannam@162 5433 shrext_cmds="$arg"
cannam@162 5434 prev=
cannam@162 5435 continue
cannam@162 5436 ;;
cannam@162 5437 weak)
cannam@162 5438 func_append weak_libs " $arg"
cannam@162 5439 prev=
cannam@162 5440 continue
cannam@162 5441 ;;
cannam@162 5442 xcclinker)
cannam@162 5443 func_append linker_flags " $qarg"
cannam@162 5444 func_append compiler_flags " $qarg"
cannam@162 5445 prev=
cannam@162 5446 func_append compile_command " $qarg"
cannam@162 5447 func_append finalize_command " $qarg"
cannam@162 5448 continue
cannam@162 5449 ;;
cannam@162 5450 xcompiler)
cannam@162 5451 func_append compiler_flags " $qarg"
cannam@162 5452 prev=
cannam@162 5453 func_append compile_command " $qarg"
cannam@162 5454 func_append finalize_command " $qarg"
cannam@162 5455 continue
cannam@162 5456 ;;
cannam@162 5457 xlinker)
cannam@162 5458 func_append linker_flags " $qarg"
cannam@162 5459 func_append compiler_flags " $wl$qarg"
cannam@162 5460 prev=
cannam@162 5461 func_append compile_command " $wl$qarg"
cannam@162 5462 func_append finalize_command " $wl$qarg"
cannam@162 5463 continue
cannam@162 5464 ;;
cannam@162 5465 *)
cannam@162 5466 eval "$prev=\"\$arg\""
cannam@162 5467 prev=
cannam@162 5468 continue
cannam@162 5469 ;;
cannam@162 5470 esac
cannam@162 5471 fi # test -n "$prev"
cannam@162 5472
cannam@162 5473 prevarg="$arg"
cannam@162 5474
cannam@162 5475 case $arg in
cannam@162 5476 -all-static)
cannam@162 5477 if test -n "$link_static_flag"; then
cannam@162 5478 # See comment for -static flag below, for more details.
cannam@162 5479 func_append compile_command " $link_static_flag"
cannam@162 5480 func_append finalize_command " $link_static_flag"
cannam@162 5481 fi
cannam@162 5482 continue
cannam@162 5483 ;;
cannam@162 5484
cannam@162 5485 -allow-undefined)
cannam@162 5486 # FIXME: remove this flag sometime in the future.
cannam@162 5487 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
cannam@162 5488 ;;
cannam@162 5489
cannam@162 5490 -avoid-version)
cannam@162 5491 avoid_version=yes
cannam@162 5492 continue
cannam@162 5493 ;;
cannam@162 5494
cannam@162 5495 -bindir)
cannam@162 5496 prev=bindir
cannam@162 5497 continue
cannam@162 5498 ;;
cannam@162 5499
cannam@162 5500 -dlopen)
cannam@162 5501 prev=dlfiles
cannam@162 5502 continue
cannam@162 5503 ;;
cannam@162 5504
cannam@162 5505 -dlpreopen)
cannam@162 5506 prev=dlprefiles
cannam@162 5507 continue
cannam@162 5508 ;;
cannam@162 5509
cannam@162 5510 -export-dynamic)
cannam@162 5511 export_dynamic=yes
cannam@162 5512 continue
cannam@162 5513 ;;
cannam@162 5514
cannam@162 5515 -export-symbols | -export-symbols-regex)
cannam@162 5516 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
cannam@162 5517 func_fatal_error "more than one -exported-symbols argument is not allowed"
cannam@162 5518 fi
cannam@162 5519 if test "X$arg" = "X-export-symbols"; then
cannam@162 5520 prev=expsyms
cannam@162 5521 else
cannam@162 5522 prev=expsyms_regex
cannam@162 5523 fi
cannam@162 5524 continue
cannam@162 5525 ;;
cannam@162 5526
cannam@162 5527 -framework)
cannam@162 5528 prev=framework
cannam@162 5529 continue
cannam@162 5530 ;;
cannam@162 5531
cannam@162 5532 -inst-prefix-dir)
cannam@162 5533 prev=inst_prefix
cannam@162 5534 continue
cannam@162 5535 ;;
cannam@162 5536
cannam@162 5537 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
cannam@162 5538 # so, if we see these flags be careful not to treat them like -L
cannam@162 5539 -L[A-Z][A-Z]*:*)
cannam@162 5540 case $with_gcc/$host in
cannam@162 5541 no/*-*-irix* | /*-*-irix*)
cannam@162 5542 func_append compile_command " $arg"
cannam@162 5543 func_append finalize_command " $arg"
cannam@162 5544 ;;
cannam@162 5545 esac
cannam@162 5546 continue
cannam@162 5547 ;;
cannam@162 5548
cannam@162 5549 -L*)
cannam@162 5550 func_stripname "-L" '' "$arg"
cannam@162 5551 if test -z "$func_stripname_result"; then
cannam@162 5552 if test "$#" -gt 0; then
cannam@162 5553 func_fatal_error "require no space between \`-L' and \`$1'"
cannam@162 5554 else
cannam@162 5555 func_fatal_error "need path for \`-L' option"
cannam@162 5556 fi
cannam@162 5557 fi
cannam@162 5558 func_resolve_sysroot "$func_stripname_result"
cannam@162 5559 dir=$func_resolve_sysroot_result
cannam@162 5560 # We need an absolute path.
cannam@162 5561 case $dir in
cannam@162 5562 [\\/]* | [A-Za-z]:[\\/]*) ;;
cannam@162 5563 *)
cannam@162 5564 absdir=`cd "$dir" && pwd`
cannam@162 5565 test -z "$absdir" && \
cannam@162 5566 func_fatal_error "cannot determine absolute directory name of \`$dir'"
cannam@162 5567 dir="$absdir"
cannam@162 5568 ;;
cannam@162 5569 esac
cannam@162 5570 case "$deplibs " in
cannam@162 5571 *" -L$dir "* | *" $arg "*)
cannam@162 5572 # Will only happen for absolute or sysroot arguments
cannam@162 5573 ;;
cannam@162 5574 *)
cannam@162 5575 # Preserve sysroot, but never include relative directories
cannam@162 5576 case $dir in
cannam@162 5577 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
cannam@162 5578 *) func_append deplibs " -L$dir" ;;
cannam@162 5579 esac
cannam@162 5580 func_append lib_search_path " $dir"
cannam@162 5581 ;;
cannam@162 5582 esac
cannam@162 5583 case $host in
cannam@162 5584 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
cannam@162 5585 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
cannam@162 5586 case :$dllsearchpath: in
cannam@162 5587 *":$dir:"*) ;;
cannam@162 5588 ::) dllsearchpath=$dir;;
cannam@162 5589 *) func_append dllsearchpath ":$dir";;
cannam@162 5590 esac
cannam@162 5591 case :$dllsearchpath: in
cannam@162 5592 *":$testbindir:"*) ;;
cannam@162 5593 ::) dllsearchpath=$testbindir;;
cannam@162 5594 *) func_append dllsearchpath ":$testbindir";;
cannam@162 5595 esac
cannam@162 5596 ;;
cannam@162 5597 esac
cannam@162 5598 continue
cannam@162 5599 ;;
cannam@162 5600
cannam@162 5601 -l*)
cannam@162 5602 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
cannam@162 5603 case $host in
cannam@162 5604 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
cannam@162 5605 # These systems don't actually have a C or math library (as such)
cannam@162 5606 continue
cannam@162 5607 ;;
cannam@162 5608 *-*-os2*)
cannam@162 5609 # These systems don't actually have a C library (as such)
cannam@162 5610 test "X$arg" = "X-lc" && continue
cannam@162 5611 ;;
cannam@162 5612 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
cannam@162 5613 # Do not include libc due to us having libc/libc_r.
cannam@162 5614 test "X$arg" = "X-lc" && continue
cannam@162 5615 ;;
cannam@162 5616 *-*-rhapsody* | *-*-darwin1.[012])
cannam@162 5617 # Rhapsody C and math libraries are in the System framework
cannam@162 5618 func_append deplibs " System.ltframework"
cannam@162 5619 continue
cannam@162 5620 ;;
cannam@162 5621 *-*-sco3.2v5* | *-*-sco5v6*)
cannam@162 5622 # Causes problems with __ctype
cannam@162 5623 test "X$arg" = "X-lc" && continue
cannam@162 5624 ;;
cannam@162 5625 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
cannam@162 5626 # Compiler inserts libc in the correct place for threads to work
cannam@162 5627 test "X$arg" = "X-lc" && continue
cannam@162 5628 ;;
cannam@162 5629 esac
cannam@162 5630 elif test "X$arg" = "X-lc_r"; then
cannam@162 5631 case $host in
cannam@162 5632 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
cannam@162 5633 # Do not include libc_r directly, use -pthread flag.
cannam@162 5634 continue
cannam@162 5635 ;;
cannam@162 5636 esac
cannam@162 5637 fi
cannam@162 5638 func_append deplibs " $arg"
cannam@162 5639 continue
cannam@162 5640 ;;
cannam@162 5641
cannam@162 5642 -module)
cannam@162 5643 module=yes
cannam@162 5644 continue
cannam@162 5645 ;;
cannam@162 5646
cannam@162 5647 # Tru64 UNIX uses -model [arg] to determine the layout of C++
cannam@162 5648 # classes, name mangling, and exception handling.
cannam@162 5649 # Darwin uses the -arch flag to determine output architecture.
cannam@162 5650 -model|-arch|-isysroot|--sysroot)
cannam@162 5651 func_append compiler_flags " $arg"
cannam@162 5652 func_append compile_command " $arg"
cannam@162 5653 func_append finalize_command " $arg"
cannam@162 5654 prev=xcompiler
cannam@162 5655 continue
cannam@162 5656 ;;
cannam@162 5657
cannam@162 5658 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
cannam@162 5659 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
cannam@162 5660 func_append compiler_flags " $arg"
cannam@162 5661 func_append compile_command " $arg"
cannam@162 5662 func_append finalize_command " $arg"
cannam@162 5663 case "$new_inherited_linker_flags " in
cannam@162 5664 *" $arg "*) ;;
cannam@162 5665 * ) func_append new_inherited_linker_flags " $arg" ;;
cannam@162 5666 esac
cannam@162 5667 continue
cannam@162 5668 ;;
cannam@162 5669
cannam@162 5670 -multi_module)
cannam@162 5671 single_module="${wl}-multi_module"
cannam@162 5672 continue
cannam@162 5673 ;;
cannam@162 5674
cannam@162 5675 -no-fast-install)
cannam@162 5676 fast_install=no
cannam@162 5677 continue
cannam@162 5678 ;;
cannam@162 5679
cannam@162 5680 -no-install)
cannam@162 5681 case $host in
cannam@162 5682 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
cannam@162 5683 # The PATH hackery in wrapper scripts is required on Windows
cannam@162 5684 # and Darwin in order for the loader to find any dlls it needs.
cannam@162 5685 func_warning "\`-no-install' is ignored for $host"
cannam@162 5686 func_warning "assuming \`-no-fast-install' instead"
cannam@162 5687 fast_install=no
cannam@162 5688 ;;
cannam@162 5689 *) no_install=yes ;;
cannam@162 5690 esac
cannam@162 5691 continue
cannam@162 5692 ;;
cannam@162 5693
cannam@162 5694 -no-undefined)
cannam@162 5695 allow_undefined=no
cannam@162 5696 continue
cannam@162 5697 ;;
cannam@162 5698
cannam@162 5699 -objectlist)
cannam@162 5700 prev=objectlist
cannam@162 5701 continue
cannam@162 5702 ;;
cannam@162 5703
cannam@162 5704 -o) prev=output ;;
cannam@162 5705
cannam@162 5706 -precious-files-regex)
cannam@162 5707 prev=precious_regex
cannam@162 5708 continue
cannam@162 5709 ;;
cannam@162 5710
cannam@162 5711 -release)
cannam@162 5712 prev=release
cannam@162 5713 continue
cannam@162 5714 ;;
cannam@162 5715
cannam@162 5716 -rpath)
cannam@162 5717 prev=rpath
cannam@162 5718 continue
cannam@162 5719 ;;
cannam@162 5720
cannam@162 5721 -R)
cannam@162 5722 prev=xrpath
cannam@162 5723 continue
cannam@162 5724 ;;
cannam@162 5725
cannam@162 5726 -R*)
cannam@162 5727 func_stripname '-R' '' "$arg"
cannam@162 5728 dir=$func_stripname_result
cannam@162 5729 # We need an absolute path.
cannam@162 5730 case $dir in
cannam@162 5731 [\\/]* | [A-Za-z]:[\\/]*) ;;
cannam@162 5732 =*)
cannam@162 5733 func_stripname '=' '' "$dir"
cannam@162 5734 dir=$lt_sysroot$func_stripname_result
cannam@162 5735 ;;
cannam@162 5736 *)
cannam@162 5737 func_fatal_error "only absolute run-paths are allowed"
cannam@162 5738 ;;
cannam@162 5739 esac
cannam@162 5740 case "$xrpath " in
cannam@162 5741 *" $dir "*) ;;
cannam@162 5742 *) func_append xrpath " $dir" ;;
cannam@162 5743 esac
cannam@162 5744 continue
cannam@162 5745 ;;
cannam@162 5746
cannam@162 5747 -shared)
cannam@162 5748 # The effects of -shared are defined in a previous loop.
cannam@162 5749 continue
cannam@162 5750 ;;
cannam@162 5751
cannam@162 5752 -shrext)
cannam@162 5753 prev=shrext
cannam@162 5754 continue
cannam@162 5755 ;;
cannam@162 5756
cannam@162 5757 -static | -static-libtool-libs)
cannam@162 5758 # The effects of -static are defined in a previous loop.
cannam@162 5759 # We used to do the same as -all-static on platforms that
cannam@162 5760 # didn't have a PIC flag, but the assumption that the effects
cannam@162 5761 # would be equivalent was wrong. It would break on at least
cannam@162 5762 # Digital Unix and AIX.
cannam@162 5763 continue
cannam@162 5764 ;;
cannam@162 5765
cannam@162 5766 -thread-safe)
cannam@162 5767 thread_safe=yes
cannam@162 5768 continue
cannam@162 5769 ;;
cannam@162 5770
cannam@162 5771 -version-info)
cannam@162 5772 prev=vinfo
cannam@162 5773 continue
cannam@162 5774 ;;
cannam@162 5775
cannam@162 5776 -version-number)
cannam@162 5777 prev=vinfo
cannam@162 5778 vinfo_number=yes
cannam@162 5779 continue
cannam@162 5780 ;;
cannam@162 5781
cannam@162 5782 -weak)
cannam@162 5783 prev=weak
cannam@162 5784 continue
cannam@162 5785 ;;
cannam@162 5786
cannam@162 5787 -Wc,*)
cannam@162 5788 func_stripname '-Wc,' '' "$arg"
cannam@162 5789 args=$func_stripname_result
cannam@162 5790 arg=
cannam@162 5791 save_ifs="$IFS"; IFS=','
cannam@162 5792 for flag in $args; do
cannam@162 5793 IFS="$save_ifs"
cannam@162 5794 func_quote_for_eval "$flag"
cannam@162 5795 func_append arg " $func_quote_for_eval_result"
cannam@162 5796 func_append compiler_flags " $func_quote_for_eval_result"
cannam@162 5797 done
cannam@162 5798 IFS="$save_ifs"
cannam@162 5799 func_stripname ' ' '' "$arg"
cannam@162 5800 arg=$func_stripname_result
cannam@162 5801 ;;
cannam@162 5802
cannam@162 5803 -Wl,*)
cannam@162 5804 func_stripname '-Wl,' '' "$arg"
cannam@162 5805 args=$func_stripname_result
cannam@162 5806 arg=
cannam@162 5807 save_ifs="$IFS"; IFS=','
cannam@162 5808 for flag in $args; do
cannam@162 5809 IFS="$save_ifs"
cannam@162 5810 func_quote_for_eval "$flag"
cannam@162 5811 func_append arg " $wl$func_quote_for_eval_result"
cannam@162 5812 func_append compiler_flags " $wl$func_quote_for_eval_result"
cannam@162 5813 func_append linker_flags " $func_quote_for_eval_result"
cannam@162 5814 done
cannam@162 5815 IFS="$save_ifs"
cannam@162 5816 func_stripname ' ' '' "$arg"
cannam@162 5817 arg=$func_stripname_result
cannam@162 5818 ;;
cannam@162 5819
cannam@162 5820 -Xcompiler)
cannam@162 5821 prev=xcompiler
cannam@162 5822 continue
cannam@162 5823 ;;
cannam@162 5824
cannam@162 5825 -Xlinker)
cannam@162 5826 prev=xlinker
cannam@162 5827 continue
cannam@162 5828 ;;
cannam@162 5829
cannam@162 5830 -XCClinker)
cannam@162 5831 prev=xcclinker
cannam@162 5832 continue
cannam@162 5833 ;;
cannam@162 5834
cannam@162 5835 # -msg_* for osf cc
cannam@162 5836 -msg_*)
cannam@162 5837 func_quote_for_eval "$arg"
cannam@162 5838 arg="$func_quote_for_eval_result"
cannam@162 5839 ;;
cannam@162 5840
cannam@162 5841 # Flags to be passed through unchanged, with rationale:
cannam@162 5842 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
cannam@162 5843 # -r[0-9][0-9]* specify processor for the SGI compiler
cannam@162 5844 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
cannam@162 5845 # +DA*, +DD* enable 64-bit mode for the HP compiler
cannam@162 5846 # -q* compiler args for the IBM compiler
cannam@162 5847 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
cannam@162 5848 # -F/path path to uninstalled frameworks, gcc on darwin
cannam@162 5849 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
cannam@162 5850 # @file GCC response files
cannam@162 5851 # -tp=* Portland pgcc target processor selection
cannam@162 5852 # --sysroot=* for sysroot support
cannam@162 5853 # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
cannam@162 5854 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
cannam@162 5855 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
cannam@162 5856 -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
cannam@162 5857 func_quote_for_eval "$arg"
cannam@162 5858 arg="$func_quote_for_eval_result"
cannam@162 5859 func_append compile_command " $arg"
cannam@162 5860 func_append finalize_command " $arg"
cannam@162 5861 func_append compiler_flags " $arg"
cannam@162 5862 continue
cannam@162 5863 ;;
cannam@162 5864
cannam@162 5865 # Some other compiler flag.
cannam@162 5866 -* | +*)
cannam@162 5867 func_quote_for_eval "$arg"
cannam@162 5868 arg="$func_quote_for_eval_result"
cannam@162 5869 ;;
cannam@162 5870
cannam@162 5871 *.$objext)
cannam@162 5872 # A standard object.
cannam@162 5873 func_append objs " $arg"
cannam@162 5874 ;;
cannam@162 5875
cannam@162 5876 *.lo)
cannam@162 5877 # A libtool-controlled object.
cannam@162 5878
cannam@162 5879 # Check to see that this really is a libtool object.
cannam@162 5880 if func_lalib_unsafe_p "$arg"; then
cannam@162 5881 pic_object=
cannam@162 5882 non_pic_object=
cannam@162 5883
cannam@162 5884 # Read the .lo file
cannam@162 5885 func_source "$arg"
cannam@162 5886
cannam@162 5887 if test -z "$pic_object" ||
cannam@162 5888 test -z "$non_pic_object" ||
cannam@162 5889 test "$pic_object" = none &&
cannam@162 5890 test "$non_pic_object" = none; then
cannam@162 5891 func_fatal_error "cannot find name of object for \`$arg'"
cannam@162 5892 fi
cannam@162 5893
cannam@162 5894 # Extract subdirectory from the argument.
cannam@162 5895 func_dirname "$arg" "/" ""
cannam@162 5896 xdir="$func_dirname_result"
cannam@162 5897
cannam@162 5898 if test "$pic_object" != none; then
cannam@162 5899 # Prepend the subdirectory the object is found in.
cannam@162 5900 pic_object="$xdir$pic_object"
cannam@162 5901
cannam@162 5902 if test "$prev" = dlfiles; then
cannam@162 5903 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
cannam@162 5904 func_append dlfiles " $pic_object"
cannam@162 5905 prev=
cannam@162 5906 continue
cannam@162 5907 else
cannam@162 5908 # If libtool objects are unsupported, then we need to preload.
cannam@162 5909 prev=dlprefiles
cannam@162 5910 fi
cannam@162 5911 fi
cannam@162 5912
cannam@162 5913 # CHECK ME: I think I busted this. -Ossama
cannam@162 5914 if test "$prev" = dlprefiles; then
cannam@162 5915 # Preload the old-style object.
cannam@162 5916 func_append dlprefiles " $pic_object"
cannam@162 5917 prev=
cannam@162 5918 fi
cannam@162 5919
cannam@162 5920 # A PIC object.
cannam@162 5921 func_append libobjs " $pic_object"
cannam@162 5922 arg="$pic_object"
cannam@162 5923 fi
cannam@162 5924
cannam@162 5925 # Non-PIC object.
cannam@162 5926 if test "$non_pic_object" != none; then
cannam@162 5927 # Prepend the subdirectory the object is found in.
cannam@162 5928 non_pic_object="$xdir$non_pic_object"
cannam@162 5929
cannam@162 5930 # A standard non-PIC object
cannam@162 5931 func_append non_pic_objects " $non_pic_object"
cannam@162 5932 if test -z "$pic_object" || test "$pic_object" = none ; then
cannam@162 5933 arg="$non_pic_object"
cannam@162 5934 fi
cannam@162 5935 else
cannam@162 5936 # If the PIC object exists, use it instead.
cannam@162 5937 # $xdir was prepended to $pic_object above.
cannam@162 5938 non_pic_object="$pic_object"
cannam@162 5939 func_append non_pic_objects " $non_pic_object"
cannam@162 5940 fi
cannam@162 5941 else
cannam@162 5942 # Only an error if not doing a dry-run.
cannam@162 5943 if $opt_dry_run; then
cannam@162 5944 # Extract subdirectory from the argument.
cannam@162 5945 func_dirname "$arg" "/" ""
cannam@162 5946 xdir="$func_dirname_result"
cannam@162 5947
cannam@162 5948 func_lo2o "$arg"
cannam@162 5949 pic_object=$xdir$objdir/$func_lo2o_result
cannam@162 5950 non_pic_object=$xdir$func_lo2o_result
cannam@162 5951 func_append libobjs " $pic_object"
cannam@162 5952 func_append non_pic_objects " $non_pic_object"
cannam@162 5953 else
cannam@162 5954 func_fatal_error "\`$arg' is not a valid libtool object"
cannam@162 5955 fi
cannam@162 5956 fi
cannam@162 5957 ;;
cannam@162 5958
cannam@162 5959 *.$libext)
cannam@162 5960 # An archive.
cannam@162 5961 func_append deplibs " $arg"
cannam@162 5962 func_append old_deplibs " $arg"
cannam@162 5963 continue
cannam@162 5964 ;;
cannam@162 5965
cannam@162 5966 *.la)
cannam@162 5967 # A libtool-controlled library.
cannam@162 5968
cannam@162 5969 func_resolve_sysroot "$arg"
cannam@162 5970 if test "$prev" = dlfiles; then
cannam@162 5971 # This library was specified with -dlopen.
cannam@162 5972 func_append dlfiles " $func_resolve_sysroot_result"
cannam@162 5973 prev=
cannam@162 5974 elif test "$prev" = dlprefiles; then
cannam@162 5975 # The library was specified with -dlpreopen.
cannam@162 5976 func_append dlprefiles " $func_resolve_sysroot_result"
cannam@162 5977 prev=
cannam@162 5978 else
cannam@162 5979 func_append deplibs " $func_resolve_sysroot_result"
cannam@162 5980 fi
cannam@162 5981 continue
cannam@162 5982 ;;
cannam@162 5983
cannam@162 5984 # Some other compiler argument.
cannam@162 5985 *)
cannam@162 5986 # Unknown arguments in both finalize_command and compile_command need
cannam@162 5987 # to be aesthetically quoted because they are evaled later.
cannam@162 5988 func_quote_for_eval "$arg"
cannam@162 5989 arg="$func_quote_for_eval_result"
cannam@162 5990 ;;
cannam@162 5991 esac # arg
cannam@162 5992
cannam@162 5993 # Now actually substitute the argument into the commands.
cannam@162 5994 if test -n "$arg"; then
cannam@162 5995 func_append compile_command " $arg"
cannam@162 5996 func_append finalize_command " $arg"
cannam@162 5997 fi
cannam@162 5998 done # argument parsing loop
cannam@162 5999
cannam@162 6000 test -n "$prev" && \
cannam@162 6001 func_fatal_help "the \`$prevarg' option requires an argument"
cannam@162 6002
cannam@162 6003 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
cannam@162 6004 eval arg=\"$export_dynamic_flag_spec\"
cannam@162 6005 func_append compile_command " $arg"
cannam@162 6006 func_append finalize_command " $arg"
cannam@162 6007 fi
cannam@162 6008
cannam@162 6009 oldlibs=
cannam@162 6010 # calculate the name of the file, without its directory
cannam@162 6011 func_basename "$output"
cannam@162 6012 outputname="$func_basename_result"
cannam@162 6013 libobjs_save="$libobjs"
cannam@162 6014
cannam@162 6015 if test -n "$shlibpath_var"; then
cannam@162 6016 # get the directories listed in $shlibpath_var
cannam@162 6017 eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
cannam@162 6018 else
cannam@162 6019 shlib_search_path=
cannam@162 6020 fi
cannam@162 6021 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
cannam@162 6022 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
cannam@162 6023
cannam@162 6024 func_dirname "$output" "/" ""
cannam@162 6025 output_objdir="$func_dirname_result$objdir"
cannam@162 6026 func_to_tool_file "$output_objdir/"
cannam@162 6027 tool_output_objdir=$func_to_tool_file_result
cannam@162 6028 # Create the object directory.
cannam@162 6029 func_mkdir_p "$output_objdir"
cannam@162 6030
cannam@162 6031 # Determine the type of output
cannam@162 6032 case $output in
cannam@162 6033 "")
cannam@162 6034 func_fatal_help "you must specify an output file"
cannam@162 6035 ;;
cannam@162 6036 *.$libext) linkmode=oldlib ;;
cannam@162 6037 *.lo | *.$objext) linkmode=obj ;;
cannam@162 6038 *.la) linkmode=lib ;;
cannam@162 6039 *) linkmode=prog ;; # Anything else should be a program.
cannam@162 6040 esac
cannam@162 6041
cannam@162 6042 specialdeplibs=
cannam@162 6043
cannam@162 6044 libs=
cannam@162 6045 # Find all interdependent deplibs by searching for libraries
cannam@162 6046 # that are linked more than once (e.g. -la -lb -la)
cannam@162 6047 for deplib in $deplibs; do
cannam@162 6048 if $opt_preserve_dup_deps ; then
cannam@162 6049 case "$libs " in
cannam@162 6050 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
cannam@162 6051 esac
cannam@162 6052 fi
cannam@162 6053 func_append libs " $deplib"
cannam@162 6054 done
cannam@162 6055
cannam@162 6056 if test "$linkmode" = lib; then
cannam@162 6057 libs="$predeps $libs $compiler_lib_search_path $postdeps"
cannam@162 6058
cannam@162 6059 # Compute libraries that are listed more than once in $predeps
cannam@162 6060 # $postdeps and mark them as special (i.e., whose duplicates are
cannam@162 6061 # not to be eliminated).
cannam@162 6062 pre_post_deps=
cannam@162 6063 if $opt_duplicate_compiler_generated_deps; then
cannam@162 6064 for pre_post_dep in $predeps $postdeps; do
cannam@162 6065 case "$pre_post_deps " in
cannam@162 6066 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
cannam@162 6067 esac
cannam@162 6068 func_append pre_post_deps " $pre_post_dep"
cannam@162 6069 done
cannam@162 6070 fi
cannam@162 6071 pre_post_deps=
cannam@162 6072 fi
cannam@162 6073
cannam@162 6074 deplibs=
cannam@162 6075 newdependency_libs=
cannam@162 6076 newlib_search_path=
cannam@162 6077 need_relink=no # whether we're linking any uninstalled libtool libraries
cannam@162 6078 notinst_deplibs= # not-installed libtool libraries
cannam@162 6079 notinst_path= # paths that contain not-installed libtool libraries
cannam@162 6080
cannam@162 6081 case $linkmode in
cannam@162 6082 lib)
cannam@162 6083 passes="conv dlpreopen link"
cannam@162 6084 for file in $dlfiles $dlprefiles; do
cannam@162 6085 case $file in
cannam@162 6086 *.la) ;;
cannam@162 6087 *)
cannam@162 6088 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
cannam@162 6089 ;;
cannam@162 6090 esac
cannam@162 6091 done
cannam@162 6092 ;;
cannam@162 6093 prog)
cannam@162 6094 compile_deplibs=
cannam@162 6095 finalize_deplibs=
cannam@162 6096 alldeplibs=no
cannam@162 6097 newdlfiles=
cannam@162 6098 newdlprefiles=
cannam@162 6099 passes="conv scan dlopen dlpreopen link"
cannam@162 6100 ;;
cannam@162 6101 *) passes="conv"
cannam@162 6102 ;;
cannam@162 6103 esac
cannam@162 6104
cannam@162 6105 for pass in $passes; do
cannam@162 6106 # The preopen pass in lib mode reverses $deplibs; put it back here
cannam@162 6107 # so that -L comes before libs that need it for instance...
cannam@162 6108 if test "$linkmode,$pass" = "lib,link"; then
cannam@162 6109 ## FIXME: Find the place where the list is rebuilt in the wrong
cannam@162 6110 ## order, and fix it there properly
cannam@162 6111 tmp_deplibs=
cannam@162 6112 for deplib in $deplibs; do
cannam@162 6113 tmp_deplibs="$deplib $tmp_deplibs"
cannam@162 6114 done
cannam@162 6115 deplibs="$tmp_deplibs"
cannam@162 6116 fi
cannam@162 6117
cannam@162 6118 if test "$linkmode,$pass" = "lib,link" ||
cannam@162 6119 test "$linkmode,$pass" = "prog,scan"; then
cannam@162 6120 libs="$deplibs"
cannam@162 6121 deplibs=
cannam@162 6122 fi
cannam@162 6123 if test "$linkmode" = prog; then
cannam@162 6124 case $pass in
cannam@162 6125 dlopen) libs="$dlfiles" ;;
cannam@162 6126 dlpreopen) libs="$dlprefiles" ;;
cannam@162 6127 link)
cannam@162 6128 libs="$deplibs %DEPLIBS%"
cannam@162 6129 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
cannam@162 6130 ;;
cannam@162 6131 esac
cannam@162 6132 fi
cannam@162 6133 if test "$linkmode,$pass" = "lib,dlpreopen"; then
cannam@162 6134 # Collect and forward deplibs of preopened libtool libs
cannam@162 6135 for lib in $dlprefiles; do
cannam@162 6136 # Ignore non-libtool-libs
cannam@162 6137 dependency_libs=
cannam@162 6138 func_resolve_sysroot "$lib"
cannam@162 6139 case $lib in
cannam@162 6140 *.la) func_source "$func_resolve_sysroot_result" ;;
cannam@162 6141 esac
cannam@162 6142
cannam@162 6143 # Collect preopened libtool deplibs, except any this library
cannam@162 6144 # has declared as weak libs
cannam@162 6145 for deplib in $dependency_libs; do
cannam@162 6146 func_basename "$deplib"
cannam@162 6147 deplib_base=$func_basename_result
cannam@162 6148 case " $weak_libs " in
cannam@162 6149 *" $deplib_base "*) ;;
cannam@162 6150 *) func_append deplibs " $deplib" ;;
cannam@162 6151 esac
cannam@162 6152 done
cannam@162 6153 done
cannam@162 6154 libs="$dlprefiles"
cannam@162 6155 fi
cannam@162 6156 if test "$pass" = dlopen; then
cannam@162 6157 # Collect dlpreopened libraries
cannam@162 6158 save_deplibs="$deplibs"
cannam@162 6159 deplibs=
cannam@162 6160 fi
cannam@162 6161
cannam@162 6162 for deplib in $libs; do
cannam@162 6163 lib=
cannam@162 6164 found=no
cannam@162 6165 case $deplib in
cannam@162 6166 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
cannam@162 6167 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
cannam@162 6168 if test "$linkmode,$pass" = "prog,link"; then
cannam@162 6169 compile_deplibs="$deplib $compile_deplibs"
cannam@162 6170 finalize_deplibs="$deplib $finalize_deplibs"
cannam@162 6171 else
cannam@162 6172 func_append compiler_flags " $deplib"
cannam@162 6173 if test "$linkmode" = lib ; then
cannam@162 6174 case "$new_inherited_linker_flags " in
cannam@162 6175 *" $deplib "*) ;;
cannam@162 6176 * ) func_append new_inherited_linker_flags " $deplib" ;;
cannam@162 6177 esac
cannam@162 6178 fi
cannam@162 6179 fi
cannam@162 6180 continue
cannam@162 6181 ;;
cannam@162 6182 -l*)
cannam@162 6183 if test "$linkmode" != lib && test "$linkmode" != prog; then
cannam@162 6184 func_warning "\`-l' is ignored for archives/objects"
cannam@162 6185 continue
cannam@162 6186 fi
cannam@162 6187 func_stripname '-l' '' "$deplib"
cannam@162 6188 name=$func_stripname_result
cannam@162 6189 if test "$linkmode" = lib; then
cannam@162 6190 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
cannam@162 6191 else
cannam@162 6192 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
cannam@162 6193 fi
cannam@162 6194 for searchdir in $searchdirs; do
cannam@162 6195 for search_ext in .la $std_shrext .so .a; do
cannam@162 6196 # Search the libtool library
cannam@162 6197 lib="$searchdir/lib${name}${search_ext}"
cannam@162 6198 if test -f "$lib"; then
cannam@162 6199 if test "$search_ext" = ".la"; then
cannam@162 6200 found=yes
cannam@162 6201 else
cannam@162 6202 found=no
cannam@162 6203 fi
cannam@162 6204 break 2
cannam@162 6205 fi
cannam@162 6206 done
cannam@162 6207 done
cannam@162 6208 if test "$found" != yes; then
cannam@162 6209 # deplib doesn't seem to be a libtool library
cannam@162 6210 if test "$linkmode,$pass" = "prog,link"; then
cannam@162 6211 compile_deplibs="$deplib $compile_deplibs"
cannam@162 6212 finalize_deplibs="$deplib $finalize_deplibs"
cannam@162 6213 else
cannam@162 6214 deplibs="$deplib $deplibs"
cannam@162 6215 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
cannam@162 6216 fi
cannam@162 6217 continue
cannam@162 6218 else # deplib is a libtool library
cannam@162 6219 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
cannam@162 6220 # We need to do some special things here, and not later.
cannam@162 6221 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
cannam@162 6222 case " $predeps $postdeps " in
cannam@162 6223 *" $deplib "*)
cannam@162 6224 if func_lalib_p "$lib"; then
cannam@162 6225 library_names=
cannam@162 6226 old_library=
cannam@162 6227 func_source "$lib"
cannam@162 6228 for l in $old_library $library_names; do
cannam@162 6229 ll="$l"
cannam@162 6230 done
cannam@162 6231 if test "X$ll" = "X$old_library" ; then # only static version available
cannam@162 6232 found=no
cannam@162 6233 func_dirname "$lib" "" "."
cannam@162 6234 ladir="$func_dirname_result"
cannam@162 6235 lib=$ladir/$old_library
cannam@162 6236 if test "$linkmode,$pass" = "prog,link"; then
cannam@162 6237 compile_deplibs="$deplib $compile_deplibs"
cannam@162 6238 finalize_deplibs="$deplib $finalize_deplibs"
cannam@162 6239 else
cannam@162 6240 deplibs="$deplib $deplibs"
cannam@162 6241 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
cannam@162 6242 fi
cannam@162 6243 continue
cannam@162 6244 fi
cannam@162 6245 fi
cannam@162 6246 ;;
cannam@162 6247 *) ;;
cannam@162 6248 esac
cannam@162 6249 fi
cannam@162 6250 fi
cannam@162 6251 ;; # -l
cannam@162 6252 *.ltframework)
cannam@162 6253 if test "$linkmode,$pass" = "prog,link"; then
cannam@162 6254 compile_deplibs="$deplib $compile_deplibs"
cannam@162 6255 finalize_deplibs="$deplib $finalize_deplibs"
cannam@162 6256 else
cannam@162 6257 deplibs="$deplib $deplibs"
cannam@162 6258 if test "$linkmode" = lib ; then
cannam@162 6259 case "$new_inherited_linker_flags " in
cannam@162 6260 *" $deplib "*) ;;
cannam@162 6261 * ) func_append new_inherited_linker_flags " $deplib" ;;
cannam@162 6262 esac
cannam@162 6263 fi
cannam@162 6264 fi
cannam@162 6265 continue
cannam@162 6266 ;;
cannam@162 6267 -L*)
cannam@162 6268 case $linkmode in
cannam@162 6269 lib)
cannam@162 6270 deplibs="$deplib $deplibs"
cannam@162 6271 test "$pass" = conv && continue
cannam@162 6272 newdependency_libs="$deplib $newdependency_libs"
cannam@162 6273 func_stripname '-L' '' "$deplib"
cannam@162 6274 func_resolve_sysroot "$func_stripname_result"
cannam@162 6275 func_append newlib_search_path " $func_resolve_sysroot_result"
cannam@162 6276 ;;
cannam@162 6277 prog)
cannam@162 6278 if test "$pass" = conv; then
cannam@162 6279 deplibs="$deplib $deplibs"
cannam@162 6280 continue
cannam@162 6281 fi
cannam@162 6282 if test "$pass" = scan; then
cannam@162 6283 deplibs="$deplib $deplibs"
cannam@162 6284 else
cannam@162 6285 compile_deplibs="$deplib $compile_deplibs"
cannam@162 6286 finalize_deplibs="$deplib $finalize_deplibs"
cannam@162 6287 fi
cannam@162 6288 func_stripname '-L' '' "$deplib"
cannam@162 6289 func_resolve_sysroot "$func_stripname_result"
cannam@162 6290 func_append newlib_search_path " $func_resolve_sysroot_result"
cannam@162 6291 ;;
cannam@162 6292 *)
cannam@162 6293 func_warning "\`-L' is ignored for archives/objects"
cannam@162 6294 ;;
cannam@162 6295 esac # linkmode
cannam@162 6296 continue
cannam@162 6297 ;; # -L
cannam@162 6298 -R*)
cannam@162 6299 if test "$pass" = link; then
cannam@162 6300 func_stripname '-R' '' "$deplib"
cannam@162 6301 func_resolve_sysroot "$func_stripname_result"
cannam@162 6302 dir=$func_resolve_sysroot_result
cannam@162 6303 # Make sure the xrpath contains only unique directories.
cannam@162 6304 case "$xrpath " in
cannam@162 6305 *" $dir "*) ;;
cannam@162 6306 *) func_append xrpath " $dir" ;;
cannam@162 6307 esac
cannam@162 6308 fi
cannam@162 6309 deplibs="$deplib $deplibs"
cannam@162 6310 continue
cannam@162 6311 ;;
cannam@162 6312 *.la)
cannam@162 6313 func_resolve_sysroot "$deplib"
cannam@162 6314 lib=$func_resolve_sysroot_result
cannam@162 6315 ;;
cannam@162 6316 *.$libext)
cannam@162 6317 if test "$pass" = conv; then
cannam@162 6318 deplibs="$deplib $deplibs"
cannam@162 6319 continue
cannam@162 6320 fi
cannam@162 6321 case $linkmode in
cannam@162 6322 lib)
cannam@162 6323 # Linking convenience modules into shared libraries is allowed,
cannam@162 6324 # but linking other static libraries is non-portable.
cannam@162 6325 case " $dlpreconveniencelibs " in
cannam@162 6326 *" $deplib "*) ;;
cannam@162 6327 *)
cannam@162 6328 valid_a_lib=no
cannam@162 6329 case $deplibs_check_method in
cannam@162 6330 match_pattern*)
cannam@162 6331 set dummy $deplibs_check_method; shift
cannam@162 6332 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
cannam@162 6333 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
cannam@162 6334 | $EGREP "$match_pattern_regex" > /dev/null; then
cannam@162 6335 valid_a_lib=yes
cannam@162 6336 fi
cannam@162 6337 ;;
cannam@162 6338 pass_all)
cannam@162 6339 valid_a_lib=yes
cannam@162 6340 ;;
cannam@162 6341 esac
cannam@162 6342 if test "$valid_a_lib" != yes; then
cannam@162 6343 echo
cannam@162 6344 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
cannam@162 6345 echo "*** I have the capability to make that library automatically link in when"
cannam@162 6346 echo "*** you link to this library. But I can only do this if you have a"
cannam@162 6347 echo "*** shared version of the library, which you do not appear to have"
cannam@162 6348 echo "*** because the file extensions .$libext of this argument makes me believe"
cannam@162 6349 echo "*** that it is just a static archive that I should not use here."
cannam@162 6350 else
cannam@162 6351 echo
cannam@162 6352 $ECHO "*** Warning: Linking the shared library $output against the"
cannam@162 6353 $ECHO "*** static library $deplib is not portable!"
cannam@162 6354 deplibs="$deplib $deplibs"
cannam@162 6355 fi
cannam@162 6356 ;;
cannam@162 6357 esac
cannam@162 6358 continue
cannam@162 6359 ;;
cannam@162 6360 prog)
cannam@162 6361 if test "$pass" != link; then
cannam@162 6362 deplibs="$deplib $deplibs"
cannam@162 6363 else
cannam@162 6364 compile_deplibs="$deplib $compile_deplibs"
cannam@162 6365 finalize_deplibs="$deplib $finalize_deplibs"
cannam@162 6366 fi
cannam@162 6367 continue
cannam@162 6368 ;;
cannam@162 6369 esac # linkmode
cannam@162 6370 ;; # *.$libext
cannam@162 6371 *.lo | *.$objext)
cannam@162 6372 if test "$pass" = conv; then
cannam@162 6373 deplibs="$deplib $deplibs"
cannam@162 6374 elif test "$linkmode" = prog; then
cannam@162 6375 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
cannam@162 6376 # If there is no dlopen support or we're linking statically,
cannam@162 6377 # we need to preload.
cannam@162 6378 func_append newdlprefiles " $deplib"
cannam@162 6379 compile_deplibs="$deplib $compile_deplibs"
cannam@162 6380 finalize_deplibs="$deplib $finalize_deplibs"
cannam@162 6381 else
cannam@162 6382 func_append newdlfiles " $deplib"
cannam@162 6383 fi
cannam@162 6384 fi
cannam@162 6385 continue
cannam@162 6386 ;;
cannam@162 6387 %DEPLIBS%)
cannam@162 6388 alldeplibs=yes
cannam@162 6389 continue
cannam@162 6390 ;;
cannam@162 6391 esac # case $deplib
cannam@162 6392
cannam@162 6393 if test "$found" = yes || test -f "$lib"; then :
cannam@162 6394 else
cannam@162 6395 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
cannam@162 6396 fi
cannam@162 6397
cannam@162 6398 # Check to see that this really is a libtool archive.
cannam@162 6399 func_lalib_unsafe_p "$lib" \
cannam@162 6400 || func_fatal_error "\`$lib' is not a valid libtool archive"
cannam@162 6401
cannam@162 6402 func_dirname "$lib" "" "."
cannam@162 6403 ladir="$func_dirname_result"
cannam@162 6404
cannam@162 6405 dlname=
cannam@162 6406 dlopen=
cannam@162 6407 dlpreopen=
cannam@162 6408 libdir=
cannam@162 6409 library_names=
cannam@162 6410 old_library=
cannam@162 6411 inherited_linker_flags=
cannam@162 6412 # If the library was installed with an old release of libtool,
cannam@162 6413 # it will not redefine variables installed, or shouldnotlink
cannam@162 6414 installed=yes
cannam@162 6415 shouldnotlink=no
cannam@162 6416 avoidtemprpath=
cannam@162 6417
cannam@162 6418
cannam@162 6419 # Read the .la file
cannam@162 6420 func_source "$lib"
cannam@162 6421
cannam@162 6422 # Convert "-framework foo" to "foo.ltframework"
cannam@162 6423 if test -n "$inherited_linker_flags"; then
cannam@162 6424 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
cannam@162 6425 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
cannam@162 6426 case " $new_inherited_linker_flags " in
cannam@162 6427 *" $tmp_inherited_linker_flag "*) ;;
cannam@162 6428 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
cannam@162 6429 esac
cannam@162 6430 done
cannam@162 6431 fi
cannam@162 6432 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@162 6433 if test "$linkmode,$pass" = "lib,link" ||
cannam@162 6434 test "$linkmode,$pass" = "prog,scan" ||
cannam@162 6435 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
cannam@162 6436 test -n "$dlopen" && func_append dlfiles " $dlopen"
cannam@162 6437 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
cannam@162 6438 fi
cannam@162 6439
cannam@162 6440 if test "$pass" = conv; then
cannam@162 6441 # Only check for convenience libraries
cannam@162 6442 deplibs="$lib $deplibs"
cannam@162 6443 if test -z "$libdir"; then
cannam@162 6444 if test -z "$old_library"; then
cannam@162 6445 func_fatal_error "cannot find name of link library for \`$lib'"
cannam@162 6446 fi
cannam@162 6447 # It is a libtool convenience library, so add in its objects.
cannam@162 6448 func_append convenience " $ladir/$objdir/$old_library"
cannam@162 6449 func_append old_convenience " $ladir/$objdir/$old_library"
cannam@162 6450 tmp_libs=
cannam@162 6451 for deplib in $dependency_libs; do
cannam@162 6452 deplibs="$deplib $deplibs"
cannam@162 6453 if $opt_preserve_dup_deps ; then
cannam@162 6454 case "$tmp_libs " in
cannam@162 6455 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
cannam@162 6456 esac
cannam@162 6457 fi
cannam@162 6458 func_append tmp_libs " $deplib"
cannam@162 6459 done
cannam@162 6460 elif test "$linkmode" != prog && test "$linkmode" != lib; then
cannam@162 6461 func_fatal_error "\`$lib' is not a convenience library"
cannam@162 6462 fi
cannam@162 6463 continue
cannam@162 6464 fi # $pass = conv
cannam@162 6465
cannam@162 6466
cannam@162 6467 # Get the name of the library we link against.
cannam@162 6468 linklib=
cannam@162 6469 if test -n "$old_library" &&
cannam@162 6470 { test "$prefer_static_libs" = yes ||
cannam@162 6471 test "$prefer_static_libs,$installed" = "built,no"; }; then
cannam@162 6472 linklib=$old_library
cannam@162 6473 else
cannam@162 6474 for l in $old_library $library_names; do
cannam@162 6475 linklib="$l"
cannam@162 6476 done
cannam@162 6477 fi
cannam@162 6478 if test -z "$linklib"; then
cannam@162 6479 func_fatal_error "cannot find name of link library for \`$lib'"
cannam@162 6480 fi
cannam@162 6481
cannam@162 6482 # This library was specified with -dlopen.
cannam@162 6483 if test "$pass" = dlopen; then
cannam@162 6484 if test -z "$libdir"; then
cannam@162 6485 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
cannam@162 6486 fi
cannam@162 6487 if test -z "$dlname" ||
cannam@162 6488 test "$dlopen_support" != yes ||
cannam@162 6489 test "$build_libtool_libs" = no; then
cannam@162 6490 # If there is no dlname, no dlopen support or we're linking
cannam@162 6491 # statically, we need to preload. We also need to preload any
cannam@162 6492 # dependent libraries so libltdl's deplib preloader doesn't
cannam@162 6493 # bomb out in the load deplibs phase.
cannam@162 6494 func_append dlprefiles " $lib $dependency_libs"
cannam@162 6495 else
cannam@162 6496 func_append newdlfiles " $lib"
cannam@162 6497 fi
cannam@162 6498 continue
cannam@162 6499 fi # $pass = dlopen
cannam@162 6500
cannam@162 6501 # We need an absolute path.
cannam@162 6502 case $ladir in
cannam@162 6503 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
cannam@162 6504 *)
cannam@162 6505 abs_ladir=`cd "$ladir" && pwd`
cannam@162 6506 if test -z "$abs_ladir"; then
cannam@162 6507 func_warning "cannot determine absolute directory name of \`$ladir'"
cannam@162 6508 func_warning "passing it literally to the linker, although it might fail"
cannam@162 6509 abs_ladir="$ladir"
cannam@162 6510 fi
cannam@162 6511 ;;
cannam@162 6512 esac
cannam@162 6513 func_basename "$lib"
cannam@162 6514 laname="$func_basename_result"
cannam@162 6515
cannam@162 6516 # Find the relevant object directory and library name.
cannam@162 6517 if test "X$installed" = Xyes; then
cannam@162 6518 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
cannam@162 6519 func_warning "library \`$lib' was moved."
cannam@162 6520 dir="$ladir"
cannam@162 6521 absdir="$abs_ladir"
cannam@162 6522 libdir="$abs_ladir"
cannam@162 6523 else
cannam@162 6524 dir="$lt_sysroot$libdir"
cannam@162 6525 absdir="$lt_sysroot$libdir"
cannam@162 6526 fi
cannam@162 6527 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
cannam@162 6528 else
cannam@162 6529 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
cannam@162 6530 dir="$ladir"
cannam@162 6531 absdir="$abs_ladir"
cannam@162 6532 # Remove this search path later
cannam@162 6533 func_append notinst_path " $abs_ladir"
cannam@162 6534 else
cannam@162 6535 dir="$ladir/$objdir"
cannam@162 6536 absdir="$abs_ladir/$objdir"
cannam@162 6537 # Remove this search path later
cannam@162 6538 func_append notinst_path " $abs_ladir"
cannam@162 6539 fi
cannam@162 6540 fi # $installed = yes
cannam@162 6541 func_stripname 'lib' '.la' "$laname"
cannam@162 6542 name=$func_stripname_result
cannam@162 6543
cannam@162 6544 # This library was specified with -dlpreopen.
cannam@162 6545 if test "$pass" = dlpreopen; then
cannam@162 6546 if test -z "$libdir" && test "$linkmode" = prog; then
cannam@162 6547 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
cannam@162 6548 fi
cannam@162 6549 case "$host" in
cannam@162 6550 # special handling for platforms with PE-DLLs.
cannam@162 6551 *cygwin* | *mingw* | *cegcc* )
cannam@162 6552 # Linker will automatically link against shared library if both
cannam@162 6553 # static and shared are present. Therefore, ensure we extract
cannam@162 6554 # symbols from the import library if a shared library is present
cannam@162 6555 # (otherwise, the dlopen module name will be incorrect). We do
cannam@162 6556 # this by putting the import library name into $newdlprefiles.
cannam@162 6557 # We recover the dlopen module name by 'saving' the la file
cannam@162 6558 # name in a special purpose variable, and (later) extracting the
cannam@162 6559 # dlname from the la file.
cannam@162 6560 if test -n "$dlname"; then
cannam@162 6561 func_tr_sh "$dir/$linklib"
cannam@162 6562 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
cannam@162 6563 func_append newdlprefiles " $dir/$linklib"
cannam@162 6564 else
cannam@162 6565 func_append newdlprefiles " $dir/$old_library"
cannam@162 6566 # Keep a list of preopened convenience libraries to check
cannam@162 6567 # that they are being used correctly in the link pass.
cannam@162 6568 test -z "$libdir" && \
cannam@162 6569 func_append dlpreconveniencelibs " $dir/$old_library"
cannam@162 6570 fi
cannam@162 6571 ;;
cannam@162 6572 * )
cannam@162 6573 # Prefer using a static library (so that no silly _DYNAMIC symbols
cannam@162 6574 # are required to link).
cannam@162 6575 if test -n "$old_library"; then
cannam@162 6576 func_append newdlprefiles " $dir/$old_library"
cannam@162 6577 # Keep a list of preopened convenience libraries to check
cannam@162 6578 # that they are being used correctly in the link pass.
cannam@162 6579 test -z "$libdir" && \
cannam@162 6580 func_append dlpreconveniencelibs " $dir/$old_library"
cannam@162 6581 # Otherwise, use the dlname, so that lt_dlopen finds it.
cannam@162 6582 elif test -n "$dlname"; then
cannam@162 6583 func_append newdlprefiles " $dir/$dlname"
cannam@162 6584 else
cannam@162 6585 func_append newdlprefiles " $dir/$linklib"
cannam@162 6586 fi
cannam@162 6587 ;;
cannam@162 6588 esac
cannam@162 6589 fi # $pass = dlpreopen
cannam@162 6590
cannam@162 6591 if test -z "$libdir"; then
cannam@162 6592 # Link the convenience library
cannam@162 6593 if test "$linkmode" = lib; then
cannam@162 6594 deplibs="$dir/$old_library $deplibs"
cannam@162 6595 elif test "$linkmode,$pass" = "prog,link"; then
cannam@162 6596 compile_deplibs="$dir/$old_library $compile_deplibs"
cannam@162 6597 finalize_deplibs="$dir/$old_library $finalize_deplibs"
cannam@162 6598 else
cannam@162 6599 deplibs="$lib $deplibs" # used for prog,scan pass
cannam@162 6600 fi
cannam@162 6601 continue
cannam@162 6602 fi
cannam@162 6603
cannam@162 6604
cannam@162 6605 if test "$linkmode" = prog && test "$pass" != link; then
cannam@162 6606 func_append newlib_search_path " $ladir"
cannam@162 6607 deplibs="$lib $deplibs"
cannam@162 6608
cannam@162 6609 linkalldeplibs=no
cannam@162 6610 if test "$link_all_deplibs" != no || test -z "$library_names" ||
cannam@162 6611 test "$build_libtool_libs" = no; then
cannam@162 6612 linkalldeplibs=yes
cannam@162 6613 fi
cannam@162 6614
cannam@162 6615 tmp_libs=
cannam@162 6616 for deplib in $dependency_libs; do
cannam@162 6617 case $deplib in
cannam@162 6618 -L*) func_stripname '-L' '' "$deplib"
cannam@162 6619 func_resolve_sysroot "$func_stripname_result"
cannam@162 6620 func_append newlib_search_path " $func_resolve_sysroot_result"
cannam@162 6621 ;;
cannam@162 6622 esac
cannam@162 6623 # Need to link against all dependency_libs?
cannam@162 6624 if test "$linkalldeplibs" = yes; then
cannam@162 6625 deplibs="$deplib $deplibs"
cannam@162 6626 else
cannam@162 6627 # Need to hardcode shared library paths
cannam@162 6628 # or/and link against static libraries
cannam@162 6629 newdependency_libs="$deplib $newdependency_libs"
cannam@162 6630 fi
cannam@162 6631 if $opt_preserve_dup_deps ; then
cannam@162 6632 case "$tmp_libs " in
cannam@162 6633 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
cannam@162 6634 esac
cannam@162 6635 fi
cannam@162 6636 func_append tmp_libs " $deplib"
cannam@162 6637 done # for deplib
cannam@162 6638 continue
cannam@162 6639 fi # $linkmode = prog...
cannam@162 6640
cannam@162 6641 if test "$linkmode,$pass" = "prog,link"; then
cannam@162 6642 if test -n "$library_names" &&
cannam@162 6643 { { test "$prefer_static_libs" = no ||
cannam@162 6644 test "$prefer_static_libs,$installed" = "built,yes"; } ||
cannam@162 6645 test -z "$old_library"; }; then
cannam@162 6646 # We need to hardcode the library path
cannam@162 6647 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
cannam@162 6648 # Make sure the rpath contains only unique directories.
cannam@162 6649 case "$temp_rpath:" in
cannam@162 6650 *"$absdir:"*) ;;
cannam@162 6651 *) func_append temp_rpath "$absdir:" ;;
cannam@162 6652 esac
cannam@162 6653 fi
cannam@162 6654
cannam@162 6655 # Hardcode the library path.
cannam@162 6656 # Skip directories that are in the system default run-time
cannam@162 6657 # search path.
cannam@162 6658 case " $sys_lib_dlsearch_path " in
cannam@162 6659 *" $absdir "*) ;;
cannam@162 6660 *)
cannam@162 6661 case "$compile_rpath " in
cannam@162 6662 *" $absdir "*) ;;
cannam@162 6663 *) func_append compile_rpath " $absdir" ;;
cannam@162 6664 esac
cannam@162 6665 ;;
cannam@162 6666 esac
cannam@162 6667 case " $sys_lib_dlsearch_path " in
cannam@162 6668 *" $libdir "*) ;;
cannam@162 6669 *)
cannam@162 6670 case "$finalize_rpath " in
cannam@162 6671 *" $libdir "*) ;;
cannam@162 6672 *) func_append finalize_rpath " $libdir" ;;
cannam@162 6673 esac
cannam@162 6674 ;;
cannam@162 6675 esac
cannam@162 6676 fi # $linkmode,$pass = prog,link...
cannam@162 6677
cannam@162 6678 if test "$alldeplibs" = yes &&
cannam@162 6679 { test "$deplibs_check_method" = pass_all ||
cannam@162 6680 { test "$build_libtool_libs" = yes &&
cannam@162 6681 test -n "$library_names"; }; }; then
cannam@162 6682 # We only need to search for static libraries
cannam@162 6683 continue
cannam@162 6684 fi
cannam@162 6685 fi
cannam@162 6686
cannam@162 6687 link_static=no # Whether the deplib will be linked statically
cannam@162 6688 use_static_libs=$prefer_static_libs
cannam@162 6689 if test "$use_static_libs" = built && test "$installed" = yes; then
cannam@162 6690 use_static_libs=no
cannam@162 6691 fi
cannam@162 6692 if test -n "$library_names" &&
cannam@162 6693 { test "$use_static_libs" = no || test -z "$old_library"; }; then
cannam@162 6694 case $host in
cannam@162 6695 *cygwin* | *mingw* | *cegcc*)
cannam@162 6696 # No point in relinking DLLs because paths are not encoded
cannam@162 6697 func_append notinst_deplibs " $lib"
cannam@162 6698 need_relink=no
cannam@162 6699 ;;
cannam@162 6700 *)
cannam@162 6701 if test "$installed" = no; then
cannam@162 6702 func_append notinst_deplibs " $lib"
cannam@162 6703 need_relink=yes
cannam@162 6704 fi
cannam@162 6705 ;;
cannam@162 6706 esac
cannam@162 6707 # This is a shared library
cannam@162 6708
cannam@162 6709 # Warn about portability, can't link against -module's on some
cannam@162 6710 # systems (darwin). Don't bleat about dlopened modules though!
cannam@162 6711 dlopenmodule=""
cannam@162 6712 for dlpremoduletest in $dlprefiles; do
cannam@162 6713 if test "X$dlpremoduletest" = "X$lib"; then
cannam@162 6714 dlopenmodule="$dlpremoduletest"
cannam@162 6715 break
cannam@162 6716 fi
cannam@162 6717 done
cannam@162 6718 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
cannam@162 6719 echo
cannam@162 6720 if test "$linkmode" = prog; then
cannam@162 6721 $ECHO "*** Warning: Linking the executable $output against the loadable module"
cannam@162 6722 else
cannam@162 6723 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
cannam@162 6724 fi
cannam@162 6725 $ECHO "*** $linklib is not portable!"
cannam@162 6726 fi
cannam@162 6727 if test "$linkmode" = lib &&
cannam@162 6728 test "$hardcode_into_libs" = yes; then
cannam@162 6729 # Hardcode the library path.
cannam@162 6730 # Skip directories that are in the system default run-time
cannam@162 6731 # search path.
cannam@162 6732 case " $sys_lib_dlsearch_path " in
cannam@162 6733 *" $absdir "*) ;;
cannam@162 6734 *)
cannam@162 6735 case "$compile_rpath " in
cannam@162 6736 *" $absdir "*) ;;
cannam@162 6737 *) func_append compile_rpath " $absdir" ;;
cannam@162 6738 esac
cannam@162 6739 ;;
cannam@162 6740 esac
cannam@162 6741 case " $sys_lib_dlsearch_path " in
cannam@162 6742 *" $libdir "*) ;;
cannam@162 6743 *)
cannam@162 6744 case "$finalize_rpath " in
cannam@162 6745 *" $libdir "*) ;;
cannam@162 6746 *) func_append finalize_rpath " $libdir" ;;
cannam@162 6747 esac
cannam@162 6748 ;;
cannam@162 6749 esac
cannam@162 6750 fi
cannam@162 6751
cannam@162 6752 if test -n "$old_archive_from_expsyms_cmds"; then
cannam@162 6753 # figure out the soname
cannam@162 6754 set dummy $library_names
cannam@162 6755 shift
cannam@162 6756 realname="$1"
cannam@162 6757 shift
cannam@162 6758 libname=`eval "\\$ECHO \"$libname_spec\""`
cannam@162 6759 # use dlname if we got it. it's perfectly good, no?
cannam@162 6760 if test -n "$dlname"; then
cannam@162 6761 soname="$dlname"
cannam@162 6762 elif test -n "$soname_spec"; then
cannam@162 6763 # bleh windows
cannam@162 6764 case $host in
cannam@162 6765 *cygwin* | mingw* | *cegcc*)
cannam@162 6766 func_arith $current - $age
cannam@162 6767 major=$func_arith_result
cannam@162 6768 versuffix="-$major"
cannam@162 6769 ;;
cannam@162 6770 esac
cannam@162 6771 eval soname=\"$soname_spec\"
cannam@162 6772 else
cannam@162 6773 soname="$realname"
cannam@162 6774 fi
cannam@162 6775
cannam@162 6776 # Make a new name for the extract_expsyms_cmds to use
cannam@162 6777 soroot="$soname"
cannam@162 6778 func_basename "$soroot"
cannam@162 6779 soname="$func_basename_result"
cannam@162 6780 func_stripname 'lib' '.dll' "$soname"
cannam@162 6781 newlib=libimp-$func_stripname_result.a
cannam@162 6782
cannam@162 6783 # If the library has no export list, then create one now
cannam@162 6784 if test -f "$output_objdir/$soname-def"; then :
cannam@162 6785 else
cannam@162 6786 func_verbose "extracting exported symbol list from \`$soname'"
cannam@162 6787 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
cannam@162 6788 fi
cannam@162 6789
cannam@162 6790 # Create $newlib
cannam@162 6791 if test -f "$output_objdir/$newlib"; then :; else
cannam@162 6792 func_verbose "generating import library for \`$soname'"
cannam@162 6793 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
cannam@162 6794 fi
cannam@162 6795 # make sure the library variables are pointing to the new library
cannam@162 6796 dir=$output_objdir
cannam@162 6797 linklib=$newlib
cannam@162 6798 fi # test -n "$old_archive_from_expsyms_cmds"
cannam@162 6799
cannam@162 6800 if test "$linkmode" = prog || test "$opt_mode" != relink; then
cannam@162 6801 add_shlibpath=
cannam@162 6802 add_dir=
cannam@162 6803 add=
cannam@162 6804 lib_linked=yes
cannam@162 6805 case $hardcode_action in
cannam@162 6806 immediate | unsupported)
cannam@162 6807 if test "$hardcode_direct" = no; then
cannam@162 6808 add="$dir/$linklib"
cannam@162 6809 case $host in
cannam@162 6810 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
cannam@162 6811 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
cannam@162 6812 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
cannam@162 6813 *-*-unixware7*) add_dir="-L$dir" ;;
cannam@162 6814 *-*-darwin* )
cannam@162 6815 # if the lib is a (non-dlopened) module then we can not
cannam@162 6816 # link against it, someone is ignoring the earlier warnings
cannam@162 6817 if /usr/bin/file -L $add 2> /dev/null |
cannam@162 6818 $GREP ": [^:]* bundle" >/dev/null ; then
cannam@162 6819 if test "X$dlopenmodule" != "X$lib"; then
cannam@162 6820 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
cannam@162 6821 if test -z "$old_library" ; then
cannam@162 6822 echo
cannam@162 6823 echo "*** And there doesn't seem to be a static archive available"
cannam@162 6824 echo "*** The link will probably fail, sorry"
cannam@162 6825 else
cannam@162 6826 add="$dir/$old_library"
cannam@162 6827 fi
cannam@162 6828 elif test -n "$old_library"; then
cannam@162 6829 add="$dir/$old_library"
cannam@162 6830 fi
cannam@162 6831 fi
cannam@162 6832 esac
cannam@162 6833 elif test "$hardcode_minus_L" = no; then
cannam@162 6834 case $host in
cannam@162 6835 *-*-sunos*) add_shlibpath="$dir" ;;
cannam@162 6836 esac
cannam@162 6837 add_dir="-L$dir"
cannam@162 6838 add="-l$name"
cannam@162 6839 elif test "$hardcode_shlibpath_var" = no; then
cannam@162 6840 add_shlibpath="$dir"
cannam@162 6841 add="-l$name"
cannam@162 6842 else
cannam@162 6843 lib_linked=no
cannam@162 6844 fi
cannam@162 6845 ;;
cannam@162 6846 relink)
cannam@162 6847 if test "$hardcode_direct" = yes &&
cannam@162 6848 test "$hardcode_direct_absolute" = no; then
cannam@162 6849 add="$dir/$linklib"
cannam@162 6850 elif test "$hardcode_minus_L" = yes; then
cannam@162 6851 add_dir="-L$absdir"
cannam@162 6852 # Try looking first in the location we're being installed to.
cannam@162 6853 if test -n "$inst_prefix_dir"; then
cannam@162 6854 case $libdir in
cannam@162 6855 [\\/]*)
cannam@162 6856 func_append add_dir " -L$inst_prefix_dir$libdir"
cannam@162 6857 ;;
cannam@162 6858 esac
cannam@162 6859 fi
cannam@162 6860 add="-l$name"
cannam@162 6861 elif test "$hardcode_shlibpath_var" = yes; then
cannam@162 6862 add_shlibpath="$dir"
cannam@162 6863 add="-l$name"
cannam@162 6864 else
cannam@162 6865 lib_linked=no
cannam@162 6866 fi
cannam@162 6867 ;;
cannam@162 6868 *) lib_linked=no ;;
cannam@162 6869 esac
cannam@162 6870
cannam@162 6871 if test "$lib_linked" != yes; then
cannam@162 6872 func_fatal_configuration "unsupported hardcode properties"
cannam@162 6873 fi
cannam@162 6874
cannam@162 6875 if test -n "$add_shlibpath"; then
cannam@162 6876 case :$compile_shlibpath: in
cannam@162 6877 *":$add_shlibpath:"*) ;;
cannam@162 6878 *) func_append compile_shlibpath "$add_shlibpath:" ;;
cannam@162 6879 esac
cannam@162 6880 fi
cannam@162 6881 if test "$linkmode" = prog; then
cannam@162 6882 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
cannam@162 6883 test -n "$add" && compile_deplibs="$add $compile_deplibs"
cannam@162 6884 else
cannam@162 6885 test -n "$add_dir" && deplibs="$add_dir $deplibs"
cannam@162 6886 test -n "$add" && deplibs="$add $deplibs"
cannam@162 6887 if test "$hardcode_direct" != yes &&
cannam@162 6888 test "$hardcode_minus_L" != yes &&
cannam@162 6889 test "$hardcode_shlibpath_var" = yes; then
cannam@162 6890 case :$finalize_shlibpath: in
cannam@162 6891 *":$libdir:"*) ;;
cannam@162 6892 *) func_append finalize_shlibpath "$libdir:" ;;
cannam@162 6893 esac
cannam@162 6894 fi
cannam@162 6895 fi
cannam@162 6896 fi
cannam@162 6897
cannam@162 6898 if test "$linkmode" = prog || test "$opt_mode" = relink; then
cannam@162 6899 add_shlibpath=
cannam@162 6900 add_dir=
cannam@162 6901 add=
cannam@162 6902 # Finalize command for both is simple: just hardcode it.
cannam@162 6903 if test "$hardcode_direct" = yes &&
cannam@162 6904 test "$hardcode_direct_absolute" = no; then
cannam@162 6905 add="$libdir/$linklib"
cannam@162 6906 elif test "$hardcode_minus_L" = yes; then
cannam@162 6907 add_dir="-L$libdir"
cannam@162 6908 add="-l$name"
cannam@162 6909 elif test "$hardcode_shlibpath_var" = yes; then
cannam@162 6910 case :$finalize_shlibpath: in
cannam@162 6911 *":$libdir:"*) ;;
cannam@162 6912 *) func_append finalize_shlibpath "$libdir:" ;;
cannam@162 6913 esac
cannam@162 6914 add="-l$name"
cannam@162 6915 elif test "$hardcode_automatic" = yes; then
cannam@162 6916 if test -n "$inst_prefix_dir" &&
cannam@162 6917 test -f "$inst_prefix_dir$libdir/$linklib" ; then
cannam@162 6918 add="$inst_prefix_dir$libdir/$linklib"
cannam@162 6919 else
cannam@162 6920 add="$libdir/$linklib"
cannam@162 6921 fi
cannam@162 6922 else
cannam@162 6923 # We cannot seem to hardcode it, guess we'll fake it.
cannam@162 6924 add_dir="-L$libdir"
cannam@162 6925 # Try looking first in the location we're being installed to.
cannam@162 6926 if test -n "$inst_prefix_dir"; then
cannam@162 6927 case $libdir in
cannam@162 6928 [\\/]*)
cannam@162 6929 func_append add_dir " -L$inst_prefix_dir$libdir"
cannam@162 6930 ;;
cannam@162 6931 esac
cannam@162 6932 fi
cannam@162 6933 add="-l$name"
cannam@162 6934 fi
cannam@162 6935
cannam@162 6936 if test "$linkmode" = prog; then
cannam@162 6937 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
cannam@162 6938 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
cannam@162 6939 else
cannam@162 6940 test -n "$add_dir" && deplibs="$add_dir $deplibs"
cannam@162 6941 test -n "$add" && deplibs="$add $deplibs"
cannam@162 6942 fi
cannam@162 6943 fi
cannam@162 6944 elif test "$linkmode" = prog; then
cannam@162 6945 # Here we assume that one of hardcode_direct or hardcode_minus_L
cannam@162 6946 # is not unsupported. This is valid on all known static and
cannam@162 6947 # shared platforms.
cannam@162 6948 if test "$hardcode_direct" != unsupported; then
cannam@162 6949 test -n "$old_library" && linklib="$old_library"
cannam@162 6950 compile_deplibs="$dir/$linklib $compile_deplibs"
cannam@162 6951 finalize_deplibs="$dir/$linklib $finalize_deplibs"
cannam@162 6952 else
cannam@162 6953 compile_deplibs="-l$name -L$dir $compile_deplibs"
cannam@162 6954 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
cannam@162 6955 fi
cannam@162 6956 elif test "$build_libtool_libs" = yes; then
cannam@162 6957 # Not a shared library
cannam@162 6958 if test "$deplibs_check_method" != pass_all; then
cannam@162 6959 # We're trying link a shared library against a static one
cannam@162 6960 # but the system doesn't support it.
cannam@162 6961
cannam@162 6962 # Just print a warning and add the library to dependency_libs so
cannam@162 6963 # that the program can be linked against the static library.
cannam@162 6964 echo
cannam@162 6965 $ECHO "*** Warning: This system can not link to static lib archive $lib."
cannam@162 6966 echo "*** I have the capability to make that library automatically link in when"
cannam@162 6967 echo "*** you link to this library. But I can only do this if you have a"
cannam@162 6968 echo "*** shared version of the library, which you do not appear to have."
cannam@162 6969 if test "$module" = yes; then
cannam@162 6970 echo "*** But as you try to build a module library, libtool will still create "
cannam@162 6971 echo "*** a static module, that should work as long as the dlopening application"
cannam@162 6972 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
cannam@162 6973 if test -z "$global_symbol_pipe"; then
cannam@162 6974 echo
cannam@162 6975 echo "*** However, this would only work if libtool was able to extract symbol"
cannam@162 6976 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
cannam@162 6977 echo "*** not find such a program. So, this module is probably useless."
cannam@162 6978 echo "*** \`nm' from GNU binutils and a full rebuild may help."
cannam@162 6979 fi
cannam@162 6980 if test "$build_old_libs" = no; then
cannam@162 6981 build_libtool_libs=module
cannam@162 6982 build_old_libs=yes
cannam@162 6983 else
cannam@162 6984 build_libtool_libs=no
cannam@162 6985 fi
cannam@162 6986 fi
cannam@162 6987 else
cannam@162 6988 deplibs="$dir/$old_library $deplibs"
cannam@162 6989 link_static=yes
cannam@162 6990 fi
cannam@162 6991 fi # link shared/static library?
cannam@162 6992
cannam@162 6993 if test "$linkmode" = lib; then
cannam@162 6994 if test -n "$dependency_libs" &&
cannam@162 6995 { test "$hardcode_into_libs" != yes ||
cannam@162 6996 test "$build_old_libs" = yes ||
cannam@162 6997 test "$link_static" = yes; }; then
cannam@162 6998 # Extract -R from dependency_libs
cannam@162 6999 temp_deplibs=
cannam@162 7000 for libdir in $dependency_libs; do
cannam@162 7001 case $libdir in
cannam@162 7002 -R*) func_stripname '-R' '' "$libdir"
cannam@162 7003 temp_xrpath=$func_stripname_result
cannam@162 7004 case " $xrpath " in
cannam@162 7005 *" $temp_xrpath "*) ;;
cannam@162 7006 *) func_append xrpath " $temp_xrpath";;
cannam@162 7007 esac;;
cannam@162 7008 *) func_append temp_deplibs " $libdir";;
cannam@162 7009 esac
cannam@162 7010 done
cannam@162 7011 dependency_libs="$temp_deplibs"
cannam@162 7012 fi
cannam@162 7013
cannam@162 7014 func_append newlib_search_path " $absdir"
cannam@162 7015 # Link against this library
cannam@162 7016 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
cannam@162 7017 # ... and its dependency_libs
cannam@162 7018 tmp_libs=
cannam@162 7019 for deplib in $dependency_libs; do
cannam@162 7020 newdependency_libs="$deplib $newdependency_libs"
cannam@162 7021 case $deplib in
cannam@162 7022 -L*) func_stripname '-L' '' "$deplib"
cannam@162 7023 func_resolve_sysroot "$func_stripname_result";;
cannam@162 7024 *) func_resolve_sysroot "$deplib" ;;
cannam@162 7025 esac
cannam@162 7026 if $opt_preserve_dup_deps ; then
cannam@162 7027 case "$tmp_libs " in
cannam@162 7028 *" $func_resolve_sysroot_result "*)
cannam@162 7029 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
cannam@162 7030 esac
cannam@162 7031 fi
cannam@162 7032 func_append tmp_libs " $func_resolve_sysroot_result"
cannam@162 7033 done
cannam@162 7034
cannam@162 7035 if test "$link_all_deplibs" != no; then
cannam@162 7036 # Add the search paths of all dependency libraries
cannam@162 7037 for deplib in $dependency_libs; do
cannam@162 7038 path=
cannam@162 7039 case $deplib in
cannam@162 7040 -L*) path="$deplib" ;;
cannam@162 7041 *.la)
cannam@162 7042 func_resolve_sysroot "$deplib"
cannam@162 7043 deplib=$func_resolve_sysroot_result
cannam@162 7044 func_dirname "$deplib" "" "."
cannam@162 7045 dir=$func_dirname_result
cannam@162 7046 # We need an absolute path.
cannam@162 7047 case $dir in
cannam@162 7048 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
cannam@162 7049 *)
cannam@162 7050 absdir=`cd "$dir" && pwd`
cannam@162 7051 if test -z "$absdir"; then
cannam@162 7052 func_warning "cannot determine absolute directory name of \`$dir'"
cannam@162 7053 absdir="$dir"
cannam@162 7054 fi
cannam@162 7055 ;;
cannam@162 7056 esac
cannam@162 7057 if $GREP "^installed=no" $deplib > /dev/null; then
cannam@162 7058 case $host in
cannam@162 7059 *-*-darwin*)
cannam@162 7060 depdepl=
cannam@162 7061 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
cannam@162 7062 if test -n "$deplibrary_names" ; then
cannam@162 7063 for tmp in $deplibrary_names ; do
cannam@162 7064 depdepl=$tmp
cannam@162 7065 done
cannam@162 7066 if test -f "$absdir/$objdir/$depdepl" ; then
cannam@162 7067 depdepl="$absdir/$objdir/$depdepl"
cannam@162 7068 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
cannam@162 7069 if test -z "$darwin_install_name"; then
cannam@162 7070 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
cannam@162 7071 fi
cannam@162 7072 func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
cannam@162 7073 func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
cannam@162 7074 path=
cannam@162 7075 fi
cannam@162 7076 fi
cannam@162 7077 ;;
cannam@162 7078 *)
cannam@162 7079 path="-L$absdir/$objdir"
cannam@162 7080 ;;
cannam@162 7081 esac
cannam@162 7082 else
cannam@162 7083 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
cannam@162 7084 test -z "$libdir" && \
cannam@162 7085 func_fatal_error "\`$deplib' is not a valid libtool archive"
cannam@162 7086 test "$absdir" != "$libdir" && \
cannam@162 7087 func_warning "\`$deplib' seems to be moved"
cannam@162 7088
cannam@162 7089 path="-L$absdir"
cannam@162 7090 fi
cannam@162 7091 ;;
cannam@162 7092 esac
cannam@162 7093 case " $deplibs " in
cannam@162 7094 *" $path "*) ;;
cannam@162 7095 *) deplibs="$path $deplibs" ;;
cannam@162 7096 esac
cannam@162 7097 done
cannam@162 7098 fi # link_all_deplibs != no
cannam@162 7099 fi # linkmode = lib
cannam@162 7100 done # for deplib in $libs
cannam@162 7101 if test "$pass" = link; then
cannam@162 7102 if test "$linkmode" = "prog"; then
cannam@162 7103 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
cannam@162 7104 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
cannam@162 7105 else
cannam@162 7106 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@162 7107 fi
cannam@162 7108 fi
cannam@162 7109 dependency_libs="$newdependency_libs"
cannam@162 7110 if test "$pass" = dlpreopen; then
cannam@162 7111 # Link the dlpreopened libraries before other libraries
cannam@162 7112 for deplib in $save_deplibs; do
cannam@162 7113 deplibs="$deplib $deplibs"
cannam@162 7114 done
cannam@162 7115 fi
cannam@162 7116 if test "$pass" != dlopen; then
cannam@162 7117 if test "$pass" != conv; then
cannam@162 7118 # Make sure lib_search_path contains only unique directories.
cannam@162 7119 lib_search_path=
cannam@162 7120 for dir in $newlib_search_path; do
cannam@162 7121 case "$lib_search_path " in
cannam@162 7122 *" $dir "*) ;;
cannam@162 7123 *) func_append lib_search_path " $dir" ;;
cannam@162 7124 esac
cannam@162 7125 done
cannam@162 7126 newlib_search_path=
cannam@162 7127 fi
cannam@162 7128
cannam@162 7129 if test "$linkmode,$pass" != "prog,link"; then
cannam@162 7130 vars="deplibs"
cannam@162 7131 else
cannam@162 7132 vars="compile_deplibs finalize_deplibs"
cannam@162 7133 fi
cannam@162 7134 for var in $vars dependency_libs; do
cannam@162 7135 # Add libraries to $var in reverse order
cannam@162 7136 eval tmp_libs=\"\$$var\"
cannam@162 7137 new_libs=
cannam@162 7138 for deplib in $tmp_libs; do
cannam@162 7139 # FIXME: Pedantically, this is the right thing to do, so
cannam@162 7140 # that some nasty dependency loop isn't accidentally
cannam@162 7141 # broken:
cannam@162 7142 #new_libs="$deplib $new_libs"
cannam@162 7143 # Pragmatically, this seems to cause very few problems in
cannam@162 7144 # practice:
cannam@162 7145 case $deplib in
cannam@162 7146 -L*) new_libs="$deplib $new_libs" ;;
cannam@162 7147 -R*) ;;
cannam@162 7148 *)
cannam@162 7149 # And here is the reason: when a library appears more
cannam@162 7150 # than once as an explicit dependence of a library, or
cannam@162 7151 # is implicitly linked in more than once by the
cannam@162 7152 # compiler, it is considered special, and multiple
cannam@162 7153 # occurrences thereof are not removed. Compare this
cannam@162 7154 # with having the same library being listed as a
cannam@162 7155 # dependency of multiple other libraries: in this case,
cannam@162 7156 # we know (pedantically, we assume) the library does not
cannam@162 7157 # need to be listed more than once, so we keep only the
cannam@162 7158 # last copy. This is not always right, but it is rare
cannam@162 7159 # enough that we require users that really mean to play
cannam@162 7160 # such unportable linking tricks to link the library
cannam@162 7161 # using -Wl,-lname, so that libtool does not consider it
cannam@162 7162 # for duplicate removal.
cannam@162 7163 case " $specialdeplibs " in
cannam@162 7164 *" $deplib "*) new_libs="$deplib $new_libs" ;;
cannam@162 7165 *)
cannam@162 7166 case " $new_libs " in
cannam@162 7167 *" $deplib "*) ;;
cannam@162 7168 *) new_libs="$deplib $new_libs" ;;
cannam@162 7169 esac
cannam@162 7170 ;;
cannam@162 7171 esac
cannam@162 7172 ;;
cannam@162 7173 esac
cannam@162 7174 done
cannam@162 7175 tmp_libs=
cannam@162 7176 for deplib in $new_libs; do
cannam@162 7177 case $deplib in
cannam@162 7178 -L*)
cannam@162 7179 case " $tmp_libs " in
cannam@162 7180 *" $deplib "*) ;;
cannam@162 7181 *) func_append tmp_libs " $deplib" ;;
cannam@162 7182 esac
cannam@162 7183 ;;
cannam@162 7184 *) func_append tmp_libs " $deplib" ;;
cannam@162 7185 esac
cannam@162 7186 done
cannam@162 7187 eval $var=\"$tmp_libs\"
cannam@162 7188 done # for var
cannam@162 7189 fi
cannam@162 7190 # Last step: remove runtime libs from dependency_libs
cannam@162 7191 # (they stay in deplibs)
cannam@162 7192 tmp_libs=
cannam@162 7193 for i in $dependency_libs ; do
cannam@162 7194 case " $predeps $postdeps $compiler_lib_search_path " in
cannam@162 7195 *" $i "*)
cannam@162 7196 i=""
cannam@162 7197 ;;
cannam@162 7198 esac
cannam@162 7199 if test -n "$i" ; then
cannam@162 7200 func_append tmp_libs " $i"
cannam@162 7201 fi
cannam@162 7202 done
cannam@162 7203 dependency_libs=$tmp_libs
cannam@162 7204 done # for pass
cannam@162 7205 if test "$linkmode" = prog; then
cannam@162 7206 dlfiles="$newdlfiles"
cannam@162 7207 fi
cannam@162 7208 if test "$linkmode" = prog || test "$linkmode" = lib; then
cannam@162 7209 dlprefiles="$newdlprefiles"
cannam@162 7210 fi
cannam@162 7211
cannam@162 7212 case $linkmode in
cannam@162 7213 oldlib)
cannam@162 7214 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
cannam@162 7215 func_warning "\`-dlopen' is ignored for archives"
cannam@162 7216 fi
cannam@162 7217
cannam@162 7218 case " $deplibs" in
cannam@162 7219 *\ -l* | *\ -L*)
cannam@162 7220 func_warning "\`-l' and \`-L' are ignored for archives" ;;
cannam@162 7221 esac
cannam@162 7222
cannam@162 7223 test -n "$rpath" && \
cannam@162 7224 func_warning "\`-rpath' is ignored for archives"
cannam@162 7225
cannam@162 7226 test -n "$xrpath" && \
cannam@162 7227 func_warning "\`-R' is ignored for archives"
cannam@162 7228
cannam@162 7229 test -n "$vinfo" && \
cannam@162 7230 func_warning "\`-version-info/-version-number' is ignored for archives"
cannam@162 7231
cannam@162 7232 test -n "$release" && \
cannam@162 7233 func_warning "\`-release' is ignored for archives"
cannam@162 7234
cannam@162 7235 test -n "$export_symbols$export_symbols_regex" && \
cannam@162 7236 func_warning "\`-export-symbols' is ignored for archives"
cannam@162 7237
cannam@162 7238 # Now set the variables for building old libraries.
cannam@162 7239 build_libtool_libs=no
cannam@162 7240 oldlibs="$output"
cannam@162 7241 func_append objs "$old_deplibs"
cannam@162 7242 ;;
cannam@162 7243
cannam@162 7244 lib)
cannam@162 7245 # Make sure we only generate libraries of the form `libNAME.la'.
cannam@162 7246 case $outputname in
cannam@162 7247 lib*)
cannam@162 7248 func_stripname 'lib' '.la' "$outputname"
cannam@162 7249 name=$func_stripname_result
cannam@162 7250 eval shared_ext=\"$shrext_cmds\"
cannam@162 7251 eval libname=\"$libname_spec\"
cannam@162 7252 ;;
cannam@162 7253 *)
cannam@162 7254 test "$module" = no && \
cannam@162 7255 func_fatal_help "libtool library \`$output' must begin with \`lib'"
cannam@162 7256
cannam@162 7257 if test "$need_lib_prefix" != no; then
cannam@162 7258 # Add the "lib" prefix for modules if required
cannam@162 7259 func_stripname '' '.la' "$outputname"
cannam@162 7260 name=$func_stripname_result
cannam@162 7261 eval shared_ext=\"$shrext_cmds\"
cannam@162 7262 eval libname=\"$libname_spec\"
cannam@162 7263 else
cannam@162 7264 func_stripname '' '.la' "$outputname"
cannam@162 7265 libname=$func_stripname_result
cannam@162 7266 fi
cannam@162 7267 ;;
cannam@162 7268 esac
cannam@162 7269
cannam@162 7270 if test -n "$objs"; then
cannam@162 7271 if test "$deplibs_check_method" != pass_all; then
cannam@162 7272 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
cannam@162 7273 else
cannam@162 7274 echo
cannam@162 7275 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
cannam@162 7276 $ECHO "*** objects $objs is not portable!"
cannam@162 7277 func_append libobjs " $objs"
cannam@162 7278 fi
cannam@162 7279 fi
cannam@162 7280
cannam@162 7281 test "$dlself" != no && \
cannam@162 7282 func_warning "\`-dlopen self' is ignored for libtool libraries"
cannam@162 7283
cannam@162 7284 set dummy $rpath
cannam@162 7285 shift
cannam@162 7286 test "$#" -gt 1 && \
cannam@162 7287 func_warning "ignoring multiple \`-rpath's for a libtool library"
cannam@162 7288
cannam@162 7289 install_libdir="$1"
cannam@162 7290
cannam@162 7291 oldlibs=
cannam@162 7292 if test -z "$rpath"; then
cannam@162 7293 if test "$build_libtool_libs" = yes; then
cannam@162 7294 # Building a libtool convenience library.
cannam@162 7295 # Some compilers have problems with a `.al' extension so
cannam@162 7296 # convenience libraries should have the same extension an
cannam@162 7297 # archive normally would.
cannam@162 7298 oldlibs="$output_objdir/$libname.$libext $oldlibs"
cannam@162 7299 build_libtool_libs=convenience
cannam@162 7300 build_old_libs=yes
cannam@162 7301 fi
cannam@162 7302
cannam@162 7303 test -n "$vinfo" && \
cannam@162 7304 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
cannam@162 7305
cannam@162 7306 test -n "$release" && \
cannam@162 7307 func_warning "\`-release' is ignored for convenience libraries"
cannam@162 7308 else
cannam@162 7309
cannam@162 7310 # Parse the version information argument.
cannam@162 7311 save_ifs="$IFS"; IFS=':'
cannam@162 7312 set dummy $vinfo 0 0 0
cannam@162 7313 shift
cannam@162 7314 IFS="$save_ifs"
cannam@162 7315
cannam@162 7316 test -n "$7" && \
cannam@162 7317 func_fatal_help "too many parameters to \`-version-info'"
cannam@162 7318
cannam@162 7319 # convert absolute version numbers to libtool ages
cannam@162 7320 # this retains compatibility with .la files and attempts
cannam@162 7321 # to make the code below a bit more comprehensible
cannam@162 7322
cannam@162 7323 case $vinfo_number in
cannam@162 7324 yes)
cannam@162 7325 number_major="$1"
cannam@162 7326 number_minor="$2"
cannam@162 7327 number_revision="$3"
cannam@162 7328 #
cannam@162 7329 # There are really only two kinds -- those that
cannam@162 7330 # use the current revision as the major version
cannam@162 7331 # and those that subtract age and use age as
cannam@162 7332 # a minor version. But, then there is irix
cannam@162 7333 # which has an extra 1 added just for fun
cannam@162 7334 #
cannam@162 7335 case $version_type in
cannam@162 7336 # correct linux to gnu/linux during the next big refactor
cannam@162 7337 darwin|linux|osf|windows|none)
cannam@162 7338 func_arith $number_major + $number_minor
cannam@162 7339 current=$func_arith_result
cannam@162 7340 age="$number_minor"
cannam@162 7341 revision="$number_revision"
cannam@162 7342 ;;
cannam@162 7343 freebsd-aout|freebsd-elf|qnx|sunos)
cannam@162 7344 current="$number_major"
cannam@162 7345 revision="$number_minor"
cannam@162 7346 age="0"
cannam@162 7347 ;;
cannam@162 7348 irix|nonstopux)
cannam@162 7349 func_arith $number_major + $number_minor
cannam@162 7350 current=$func_arith_result
cannam@162 7351 age="$number_minor"
cannam@162 7352 revision="$number_minor"
cannam@162 7353 lt_irix_increment=no
cannam@162 7354 ;;
cannam@162 7355 *)
cannam@162 7356 func_fatal_configuration "$modename: unknown library version type \`$version_type'"
cannam@162 7357 ;;
cannam@162 7358 esac
cannam@162 7359 ;;
cannam@162 7360 no)
cannam@162 7361 current="$1"
cannam@162 7362 revision="$2"
cannam@162 7363 age="$3"
cannam@162 7364 ;;
cannam@162 7365 esac
cannam@162 7366
cannam@162 7367 # Check that each of the things are valid numbers.
cannam@162 7368 case $current in
cannam@162 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@162 7370 *)
cannam@162 7371 func_error "CURRENT \`$current' must be a nonnegative integer"
cannam@162 7372 func_fatal_error "\`$vinfo' is not valid version information"
cannam@162 7373 ;;
cannam@162 7374 esac
cannam@162 7375
cannam@162 7376 case $revision in
cannam@162 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@162 7378 *)
cannam@162 7379 func_error "REVISION \`$revision' must be a nonnegative integer"
cannam@162 7380 func_fatal_error "\`$vinfo' is not valid version information"
cannam@162 7381 ;;
cannam@162 7382 esac
cannam@162 7383
cannam@162 7384 case $age in
cannam@162 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@162 7386 *)
cannam@162 7387 func_error "AGE \`$age' must be a nonnegative integer"
cannam@162 7388 func_fatal_error "\`$vinfo' is not valid version information"
cannam@162 7389 ;;
cannam@162 7390 esac
cannam@162 7391
cannam@162 7392 if test "$age" -gt "$current"; then
cannam@162 7393 func_error "AGE \`$age' is greater than the current interface number \`$current'"
cannam@162 7394 func_fatal_error "\`$vinfo' is not valid version information"
cannam@162 7395 fi
cannam@162 7396
cannam@162 7397 # Calculate the version variables.
cannam@162 7398 major=
cannam@162 7399 versuffix=
cannam@162 7400 verstring=
cannam@162 7401 case $version_type in
cannam@162 7402 none) ;;
cannam@162 7403
cannam@162 7404 darwin)
cannam@162 7405 # Like Linux, but with the current version available in
cannam@162 7406 # verstring for coding it into the library header
cannam@162 7407 func_arith $current - $age
cannam@162 7408 major=.$func_arith_result
cannam@162 7409 versuffix="$major.$age.$revision"
cannam@162 7410 # Darwin ld doesn't like 0 for these options...
cannam@162 7411 func_arith $current + 1
cannam@162 7412 minor_current=$func_arith_result
cannam@162 7413 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
cannam@162 7414 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
cannam@162 7415 ;;
cannam@162 7416
cannam@162 7417 freebsd-aout)
cannam@162 7418 major=".$current"
cannam@162 7419 versuffix=".$current.$revision";
cannam@162 7420 ;;
cannam@162 7421
cannam@162 7422 freebsd-elf)
cannam@162 7423 major=".$current"
cannam@162 7424 versuffix=".$current"
cannam@162 7425 ;;
cannam@162 7426
cannam@162 7427 irix | nonstopux)
cannam@162 7428 if test "X$lt_irix_increment" = "Xno"; then
cannam@162 7429 func_arith $current - $age
cannam@162 7430 else
cannam@162 7431 func_arith $current - $age + 1
cannam@162 7432 fi
cannam@162 7433 major=$func_arith_result
cannam@162 7434
cannam@162 7435 case $version_type in
cannam@162 7436 nonstopux) verstring_prefix=nonstopux ;;
cannam@162 7437 *) verstring_prefix=sgi ;;
cannam@162 7438 esac
cannam@162 7439 verstring="$verstring_prefix$major.$revision"
cannam@162 7440
cannam@162 7441 # Add in all the interfaces that we are compatible with.
cannam@162 7442 loop=$revision
cannam@162 7443 while test "$loop" -ne 0; do
cannam@162 7444 func_arith $revision - $loop
cannam@162 7445 iface=$func_arith_result
cannam@162 7446 func_arith $loop - 1
cannam@162 7447 loop=$func_arith_result
cannam@162 7448 verstring="$verstring_prefix$major.$iface:$verstring"
cannam@162 7449 done
cannam@162 7450
cannam@162 7451 # Before this point, $major must not contain `.'.
cannam@162 7452 major=.$major
cannam@162 7453 versuffix="$major.$revision"
cannam@162 7454 ;;
cannam@162 7455
cannam@162 7456 linux) # correct to gnu/linux during the next big refactor
cannam@162 7457 func_arith $current - $age
cannam@162 7458 major=.$func_arith_result
cannam@162 7459 versuffix="$major.$age.$revision"
cannam@162 7460 ;;
cannam@162 7461
cannam@162 7462 osf)
cannam@162 7463 func_arith $current - $age
cannam@162 7464 major=.$func_arith_result
cannam@162 7465 versuffix=".$current.$age.$revision"
cannam@162 7466 verstring="$current.$age.$revision"
cannam@162 7467
cannam@162 7468 # Add in all the interfaces that we are compatible with.
cannam@162 7469 loop=$age
cannam@162 7470 while test "$loop" -ne 0; do
cannam@162 7471 func_arith $current - $loop
cannam@162 7472 iface=$func_arith_result
cannam@162 7473 func_arith $loop - 1
cannam@162 7474 loop=$func_arith_result
cannam@162 7475 verstring="$verstring:${iface}.0"
cannam@162 7476 done
cannam@162 7477
cannam@162 7478 # Make executables depend on our current version.
cannam@162 7479 func_append verstring ":${current}.0"
cannam@162 7480 ;;
cannam@162 7481
cannam@162 7482 qnx)
cannam@162 7483 major=".$current"
cannam@162 7484 versuffix=".$current"
cannam@162 7485 ;;
cannam@162 7486
cannam@162 7487 sunos)
cannam@162 7488 major=".$current"
cannam@162 7489 versuffix=".$current.$revision"
cannam@162 7490 ;;
cannam@162 7491
cannam@162 7492 windows)
cannam@162 7493 # Use '-' rather than '.', since we only want one
cannam@162 7494 # extension on DOS 8.3 filesystems.
cannam@162 7495 func_arith $current - $age
cannam@162 7496 major=$func_arith_result
cannam@162 7497 versuffix="-$major"
cannam@162 7498 ;;
cannam@162 7499
cannam@162 7500 *)
cannam@162 7501 func_fatal_configuration "unknown library version type \`$version_type'"
cannam@162 7502 ;;
cannam@162 7503 esac
cannam@162 7504
cannam@162 7505 # Clear the version info if we defaulted, and they specified a release.
cannam@162 7506 if test -z "$vinfo" && test -n "$release"; then
cannam@162 7507 major=
cannam@162 7508 case $version_type in
cannam@162 7509 darwin)
cannam@162 7510 # we can't check for "0.0" in archive_cmds due to quoting
cannam@162 7511 # problems, so we reset it completely
cannam@162 7512 verstring=
cannam@162 7513 ;;
cannam@162 7514 *)
cannam@162 7515 verstring="0.0"
cannam@162 7516 ;;
cannam@162 7517 esac
cannam@162 7518 if test "$need_version" = no; then
cannam@162 7519 versuffix=
cannam@162 7520 else
cannam@162 7521 versuffix=".0.0"
cannam@162 7522 fi
cannam@162 7523 fi
cannam@162 7524
cannam@162 7525 # Remove version info from name if versioning should be avoided
cannam@162 7526 if test "$avoid_version" = yes && test "$need_version" = no; then
cannam@162 7527 major=
cannam@162 7528 versuffix=
cannam@162 7529 verstring=""
cannam@162 7530 fi
cannam@162 7531
cannam@162 7532 # Check to see if the archive will have undefined symbols.
cannam@162 7533 if test "$allow_undefined" = yes; then
cannam@162 7534 if test "$allow_undefined_flag" = unsupported; then
cannam@162 7535 func_warning "undefined symbols not allowed in $host shared libraries"
cannam@162 7536 build_libtool_libs=no
cannam@162 7537 build_old_libs=yes
cannam@162 7538 fi
cannam@162 7539 else
cannam@162 7540 # Don't allow undefined symbols.
cannam@162 7541 allow_undefined_flag="$no_undefined_flag"
cannam@162 7542 fi
cannam@162 7543
cannam@162 7544 fi
cannam@162 7545
cannam@162 7546 func_generate_dlsyms "$libname" "$libname" "yes"
cannam@162 7547 func_append libobjs " $symfileobj"
cannam@162 7548 test "X$libobjs" = "X " && libobjs=
cannam@162 7549
cannam@162 7550 if test "$opt_mode" != relink; then
cannam@162 7551 # Remove our outputs, but don't remove object files since they
cannam@162 7552 # may have been created when compiling PIC objects.
cannam@162 7553 removelist=
cannam@162 7554 tempremovelist=`$ECHO "$output_objdir/*"`
cannam@162 7555 for p in $tempremovelist; do
cannam@162 7556 case $p in
cannam@162 7557 *.$objext | *.gcno)
cannam@162 7558 ;;
cannam@162 7559 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
cannam@162 7560 if test "X$precious_files_regex" != "X"; then
cannam@162 7561 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
cannam@162 7562 then
cannam@162 7563 continue
cannam@162 7564 fi
cannam@162 7565 fi
cannam@162 7566 func_append removelist " $p"
cannam@162 7567 ;;
cannam@162 7568 *) ;;
cannam@162 7569 esac
cannam@162 7570 done
cannam@162 7571 test -n "$removelist" && \
cannam@162 7572 func_show_eval "${RM}r \$removelist"
cannam@162 7573 fi
cannam@162 7574
cannam@162 7575 # Now set the variables for building old libraries.
cannam@162 7576 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
cannam@162 7577 func_append oldlibs " $output_objdir/$libname.$libext"
cannam@162 7578
cannam@162 7579 # Transform .lo files to .o files.
cannam@162 7580 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
cannam@162 7581 fi
cannam@162 7582
cannam@162 7583 # Eliminate all temporary directories.
cannam@162 7584 #for path in $notinst_path; do
cannam@162 7585 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
cannam@162 7586 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
cannam@162 7587 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
cannam@162 7588 #done
cannam@162 7589
cannam@162 7590 if test -n "$xrpath"; then
cannam@162 7591 # If the user specified any rpath flags, then add them.
cannam@162 7592 temp_xrpath=
cannam@162 7593 for libdir in $xrpath; do
cannam@162 7594 func_replace_sysroot "$libdir"
cannam@162 7595 func_append temp_xrpath " -R$func_replace_sysroot_result"
cannam@162 7596 case "$finalize_rpath " in
cannam@162 7597 *" $libdir "*) ;;
cannam@162 7598 *) func_append finalize_rpath " $libdir" ;;
cannam@162 7599 esac
cannam@162 7600 done
cannam@162 7601 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
cannam@162 7602 dependency_libs="$temp_xrpath $dependency_libs"
cannam@162 7603 fi
cannam@162 7604 fi
cannam@162 7605
cannam@162 7606 # Make sure dlfiles contains only unique files that won't be dlpreopened
cannam@162 7607 old_dlfiles="$dlfiles"
cannam@162 7608 dlfiles=
cannam@162 7609 for lib in $old_dlfiles; do
cannam@162 7610 case " $dlprefiles $dlfiles " in
cannam@162 7611 *" $lib "*) ;;
cannam@162 7612 *) func_append dlfiles " $lib" ;;
cannam@162 7613 esac
cannam@162 7614 done
cannam@162 7615
cannam@162 7616 # Make sure dlprefiles contains only unique files
cannam@162 7617 old_dlprefiles="$dlprefiles"
cannam@162 7618 dlprefiles=
cannam@162 7619 for lib in $old_dlprefiles; do
cannam@162 7620 case "$dlprefiles " in
cannam@162 7621 *" $lib "*) ;;
cannam@162 7622 *) func_append dlprefiles " $lib" ;;
cannam@162 7623 esac
cannam@162 7624 done
cannam@162 7625
cannam@162 7626 if test "$build_libtool_libs" = yes; then
cannam@162 7627 if test -n "$rpath"; then
cannam@162 7628 case $host in
cannam@162 7629 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
cannam@162 7630 # these systems don't actually have a c library (as such)!
cannam@162 7631 ;;
cannam@162 7632 *-*-rhapsody* | *-*-darwin1.[012])
cannam@162 7633 # Rhapsody C library is in the System framework
cannam@162 7634 func_append deplibs " System.ltframework"
cannam@162 7635 ;;
cannam@162 7636 *-*-netbsd*)
cannam@162 7637 # Don't link with libc until the a.out ld.so is fixed.
cannam@162 7638 ;;
cannam@162 7639 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
cannam@162 7640 # Do not include libc due to us having libc/libc_r.
cannam@162 7641 ;;
cannam@162 7642 *-*-sco3.2v5* | *-*-sco5v6*)
cannam@162 7643 # Causes problems with __ctype
cannam@162 7644 ;;
cannam@162 7645 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
cannam@162 7646 # Compiler inserts libc in the correct place for threads to work
cannam@162 7647 ;;
cannam@162 7648 *)
cannam@162 7649 # Add libc to deplibs on all other systems if necessary.
cannam@162 7650 if test "$build_libtool_need_lc" = "yes"; then
cannam@162 7651 func_append deplibs " -lc"
cannam@162 7652 fi
cannam@162 7653 ;;
cannam@162 7654 esac
cannam@162 7655 fi
cannam@162 7656
cannam@162 7657 # Transform deplibs into only deplibs that can be linked in shared.
cannam@162 7658 name_save=$name
cannam@162 7659 libname_save=$libname
cannam@162 7660 release_save=$release
cannam@162 7661 versuffix_save=$versuffix
cannam@162 7662 major_save=$major
cannam@162 7663 # I'm not sure if I'm treating the release correctly. I think
cannam@162 7664 # release should show up in the -l (ie -lgmp5) so we don't want to
cannam@162 7665 # add it in twice. Is that correct?
cannam@162 7666 release=""
cannam@162 7667 versuffix=""
cannam@162 7668 major=""
cannam@162 7669 newdeplibs=
cannam@162 7670 droppeddeps=no
cannam@162 7671 case $deplibs_check_method in
cannam@162 7672 pass_all)
cannam@162 7673 # Don't check for shared/static. Everything works.
cannam@162 7674 # This might be a little naive. We might want to check
cannam@162 7675 # whether the library exists or not. But this is on
cannam@162 7676 # osf3 & osf4 and I'm not really sure... Just
cannam@162 7677 # implementing what was already the behavior.
cannam@162 7678 newdeplibs=$deplibs
cannam@162 7679 ;;
cannam@162 7680 test_compile)
cannam@162 7681 # This code stresses the "libraries are programs" paradigm to its
cannam@162 7682 # limits. Maybe even breaks it. We compile a program, linking it
cannam@162 7683 # against the deplibs as a proxy for the library. Then we can check
cannam@162 7684 # whether they linked in statically or dynamically with ldd.
cannam@162 7685 $opt_dry_run || $RM conftest.c
cannam@162 7686 cat > conftest.c <<EOF
cannam@162 7687 int main() { return 0; }
cannam@162 7688 EOF
cannam@162 7689 $opt_dry_run || $RM conftest
cannam@162 7690 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
cannam@162 7691 ldd_output=`ldd conftest`
cannam@162 7692 for i in $deplibs; do
cannam@162 7693 case $i in
cannam@162 7694 -l*)
cannam@162 7695 func_stripname -l '' "$i"
cannam@162 7696 name=$func_stripname_result
cannam@162 7697 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
cannam@162 7698 case " $predeps $postdeps " in
cannam@162 7699 *" $i "*)
cannam@162 7700 func_append newdeplibs " $i"
cannam@162 7701 i=""
cannam@162 7702 ;;
cannam@162 7703 esac
cannam@162 7704 fi
cannam@162 7705 if test -n "$i" ; then
cannam@162 7706 libname=`eval "\\$ECHO \"$libname_spec\""`
cannam@162 7707 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
cannam@162 7708 set dummy $deplib_matches; shift
cannam@162 7709 deplib_match=$1
cannam@162 7710 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
cannam@162 7711 func_append newdeplibs " $i"
cannam@162 7712 else
cannam@162 7713 droppeddeps=yes
cannam@162 7714 echo
cannam@162 7715 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
cannam@162 7716 echo "*** I have the capability to make that library automatically link in when"
cannam@162 7717 echo "*** you link to this library. But I can only do this if you have a"
cannam@162 7718 echo "*** shared version of the library, which I believe you do not have"
cannam@162 7719 echo "*** because a test_compile did reveal that the linker did not use it for"
cannam@162 7720 echo "*** its dynamic dependency list that programs get resolved with at runtime."
cannam@162 7721 fi
cannam@162 7722 fi
cannam@162 7723 ;;
cannam@162 7724 *)
cannam@162 7725 func_append newdeplibs " $i"
cannam@162 7726 ;;
cannam@162 7727 esac
cannam@162 7728 done
cannam@162 7729 else
cannam@162 7730 # Error occurred in the first compile. Let's try to salvage
cannam@162 7731 # the situation: Compile a separate program for each library.
cannam@162 7732 for i in $deplibs; do
cannam@162 7733 case $i in
cannam@162 7734 -l*)
cannam@162 7735 func_stripname -l '' "$i"
cannam@162 7736 name=$func_stripname_result
cannam@162 7737 $opt_dry_run || $RM conftest
cannam@162 7738 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
cannam@162 7739 ldd_output=`ldd conftest`
cannam@162 7740 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
cannam@162 7741 case " $predeps $postdeps " in
cannam@162 7742 *" $i "*)
cannam@162 7743 func_append newdeplibs " $i"
cannam@162 7744 i=""
cannam@162 7745 ;;
cannam@162 7746 esac
cannam@162 7747 fi
cannam@162 7748 if test -n "$i" ; then
cannam@162 7749 libname=`eval "\\$ECHO \"$libname_spec\""`
cannam@162 7750 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
cannam@162 7751 set dummy $deplib_matches; shift
cannam@162 7752 deplib_match=$1
cannam@162 7753 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
cannam@162 7754 func_append newdeplibs " $i"
cannam@162 7755 else
cannam@162 7756 droppeddeps=yes
cannam@162 7757 echo
cannam@162 7758 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
cannam@162 7759 echo "*** I have the capability to make that library automatically link in when"
cannam@162 7760 echo "*** you link to this library. But I can only do this if you have a"
cannam@162 7761 echo "*** shared version of the library, which you do not appear to have"
cannam@162 7762 echo "*** because a test_compile did reveal that the linker did not use this one"
cannam@162 7763 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
cannam@162 7764 fi
cannam@162 7765 fi
cannam@162 7766 else
cannam@162 7767 droppeddeps=yes
cannam@162 7768 echo
cannam@162 7769 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
cannam@162 7770 echo "*** make it link in! You will probably need to install it or some"
cannam@162 7771 echo "*** library that it depends on before this library will be fully"
cannam@162 7772 echo "*** functional. Installing it before continuing would be even better."
cannam@162 7773 fi
cannam@162 7774 ;;
cannam@162 7775 *)
cannam@162 7776 func_append newdeplibs " $i"
cannam@162 7777 ;;
cannam@162 7778 esac
cannam@162 7779 done
cannam@162 7780 fi
cannam@162 7781 ;;
cannam@162 7782 file_magic*)
cannam@162 7783 set dummy $deplibs_check_method; shift
cannam@162 7784 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
cannam@162 7785 for a_deplib in $deplibs; do
cannam@162 7786 case $a_deplib in
cannam@162 7787 -l*)
cannam@162 7788 func_stripname -l '' "$a_deplib"
cannam@162 7789 name=$func_stripname_result
cannam@162 7790 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
cannam@162 7791 case " $predeps $postdeps " in
cannam@162 7792 *" $a_deplib "*)
cannam@162 7793 func_append newdeplibs " $a_deplib"
cannam@162 7794 a_deplib=""
cannam@162 7795 ;;
cannam@162 7796 esac
cannam@162 7797 fi
cannam@162 7798 if test -n "$a_deplib" ; then
cannam@162 7799 libname=`eval "\\$ECHO \"$libname_spec\""`
cannam@162 7800 if test -n "$file_magic_glob"; then
cannam@162 7801 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
cannam@162 7802 else
cannam@162 7803 libnameglob=$libname
cannam@162 7804 fi
cannam@162 7805 test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
cannam@162 7806 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
cannam@162 7807 if test "$want_nocaseglob" = yes; then
cannam@162 7808 shopt -s nocaseglob
cannam@162 7809 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
cannam@162 7810 $nocaseglob
cannam@162 7811 else
cannam@162 7812 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
cannam@162 7813 fi
cannam@162 7814 for potent_lib in $potential_libs; do
cannam@162 7815 # Follow soft links.
cannam@162 7816 if ls -lLd "$potent_lib" 2>/dev/null |
cannam@162 7817 $GREP " -> " >/dev/null; then
cannam@162 7818 continue
cannam@162 7819 fi
cannam@162 7820 # The statement above tries to avoid entering an
cannam@162 7821 # endless loop below, in case of cyclic links.
cannam@162 7822 # We might still enter an endless loop, since a link
cannam@162 7823 # loop can be closed while we follow links,
cannam@162 7824 # but so what?
cannam@162 7825 potlib="$potent_lib"
cannam@162 7826 while test -h "$potlib" 2>/dev/null; do
cannam@162 7827 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
cannam@162 7828 case $potliblink in
cannam@162 7829 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
cannam@162 7830 *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
cannam@162 7831 esac
cannam@162 7832 done
cannam@162 7833 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
cannam@162 7834 $SED -e 10q |
cannam@162 7835 $EGREP "$file_magic_regex" > /dev/null; then
cannam@162 7836 func_append newdeplibs " $a_deplib"
cannam@162 7837 a_deplib=""
cannam@162 7838 break 2
cannam@162 7839 fi
cannam@162 7840 done
cannam@162 7841 done
cannam@162 7842 fi
cannam@162 7843 if test -n "$a_deplib" ; then
cannam@162 7844 droppeddeps=yes
cannam@162 7845 echo
cannam@162 7846 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
cannam@162 7847 echo "*** I have the capability to make that library automatically link in when"
cannam@162 7848 echo "*** you link to this library. But I can only do this if you have a"
cannam@162 7849 echo "*** shared version of the library, which you do not appear to have"
cannam@162 7850 echo "*** because I did check the linker path looking for a file starting"
cannam@162 7851 if test -z "$potlib" ; then
cannam@162 7852 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
cannam@162 7853 else
cannam@162 7854 $ECHO "*** with $libname and none of the candidates passed a file format test"
cannam@162 7855 $ECHO "*** using a file magic. Last file checked: $potlib"
cannam@162 7856 fi
cannam@162 7857 fi
cannam@162 7858 ;;
cannam@162 7859 *)
cannam@162 7860 # Add a -L argument.
cannam@162 7861 func_append newdeplibs " $a_deplib"
cannam@162 7862 ;;
cannam@162 7863 esac
cannam@162 7864 done # Gone through all deplibs.
cannam@162 7865 ;;
cannam@162 7866 match_pattern*)
cannam@162 7867 set dummy $deplibs_check_method; shift
cannam@162 7868 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
cannam@162 7869 for a_deplib in $deplibs; do
cannam@162 7870 case $a_deplib in
cannam@162 7871 -l*)
cannam@162 7872 func_stripname -l '' "$a_deplib"
cannam@162 7873 name=$func_stripname_result
cannam@162 7874 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
cannam@162 7875 case " $predeps $postdeps " in
cannam@162 7876 *" $a_deplib "*)
cannam@162 7877 func_append newdeplibs " $a_deplib"
cannam@162 7878 a_deplib=""
cannam@162 7879 ;;
cannam@162 7880 esac
cannam@162 7881 fi
cannam@162 7882 if test -n "$a_deplib" ; then
cannam@162 7883 libname=`eval "\\$ECHO \"$libname_spec\""`
cannam@162 7884 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
cannam@162 7885 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
cannam@162 7886 for potent_lib in $potential_libs; do
cannam@162 7887 potlib="$potent_lib" # see symlink-check above in file_magic test
cannam@162 7888 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
cannam@162 7889 $EGREP "$match_pattern_regex" > /dev/null; then
cannam@162 7890 func_append newdeplibs " $a_deplib"
cannam@162 7891 a_deplib=""
cannam@162 7892 break 2
cannam@162 7893 fi
cannam@162 7894 done
cannam@162 7895 done
cannam@162 7896 fi
cannam@162 7897 if test -n "$a_deplib" ; then
cannam@162 7898 droppeddeps=yes
cannam@162 7899 echo
cannam@162 7900 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
cannam@162 7901 echo "*** I have the capability to make that library automatically link in when"
cannam@162 7902 echo "*** you link to this library. But I can only do this if you have a"
cannam@162 7903 echo "*** shared version of the library, which you do not appear to have"
cannam@162 7904 echo "*** because I did check the linker path looking for a file starting"
cannam@162 7905 if test -z "$potlib" ; then
cannam@162 7906 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
cannam@162 7907 else
cannam@162 7908 $ECHO "*** with $libname and none of the candidates passed a file format test"
cannam@162 7909 $ECHO "*** using a regex pattern. Last file checked: $potlib"
cannam@162 7910 fi
cannam@162 7911 fi
cannam@162 7912 ;;
cannam@162 7913 *)
cannam@162 7914 # Add a -L argument.
cannam@162 7915 func_append newdeplibs " $a_deplib"
cannam@162 7916 ;;
cannam@162 7917 esac
cannam@162 7918 done # Gone through all deplibs.
cannam@162 7919 ;;
cannam@162 7920 none | unknown | *)
cannam@162 7921 newdeplibs=""
cannam@162 7922 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
cannam@162 7923 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
cannam@162 7924 for i in $predeps $postdeps ; do
cannam@162 7925 # can't use Xsed below, because $i might contain '/'
cannam@162 7926 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
cannam@162 7927 done
cannam@162 7928 fi
cannam@162 7929 case $tmp_deplibs in
cannam@162 7930 *[!\ \ ]*)
cannam@162 7931 echo
cannam@162 7932 if test "X$deplibs_check_method" = "Xnone"; then
cannam@162 7933 echo "*** Warning: inter-library dependencies are not supported in this platform."
cannam@162 7934 else
cannam@162 7935 echo "*** Warning: inter-library dependencies are not known to be supported."
cannam@162 7936 fi
cannam@162 7937 echo "*** All declared inter-library dependencies are being dropped."
cannam@162 7938 droppeddeps=yes
cannam@162 7939 ;;
cannam@162 7940 esac
cannam@162 7941 ;;
cannam@162 7942 esac
cannam@162 7943 versuffix=$versuffix_save
cannam@162 7944 major=$major_save
cannam@162 7945 release=$release_save
cannam@162 7946 libname=$libname_save
cannam@162 7947 name=$name_save
cannam@162 7948
cannam@162 7949 case $host in
cannam@162 7950 *-*-rhapsody* | *-*-darwin1.[012])
cannam@162 7951 # On Rhapsody replace the C library with the System framework
cannam@162 7952 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
cannam@162 7953 ;;
cannam@162 7954 esac
cannam@162 7955
cannam@162 7956 if test "$droppeddeps" = yes; then
cannam@162 7957 if test "$module" = yes; then
cannam@162 7958 echo
cannam@162 7959 echo "*** Warning: libtool could not satisfy all declared inter-library"
cannam@162 7960 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
cannam@162 7961 echo "*** a static module, that should work as long as the dlopening"
cannam@162 7962 echo "*** application is linked with the -dlopen flag."
cannam@162 7963 if test -z "$global_symbol_pipe"; then
cannam@162 7964 echo
cannam@162 7965 echo "*** However, this would only work if libtool was able to extract symbol"
cannam@162 7966 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
cannam@162 7967 echo "*** not find such a program. So, this module is probably useless."
cannam@162 7968 echo "*** \`nm' from GNU binutils and a full rebuild may help."
cannam@162 7969 fi
cannam@162 7970 if test "$build_old_libs" = no; then
cannam@162 7971 oldlibs="$output_objdir/$libname.$libext"
cannam@162 7972 build_libtool_libs=module
cannam@162 7973 build_old_libs=yes
cannam@162 7974 else
cannam@162 7975 build_libtool_libs=no
cannam@162 7976 fi
cannam@162 7977 else
cannam@162 7978 echo "*** The inter-library dependencies that have been dropped here will be"
cannam@162 7979 echo "*** automatically added whenever a program is linked with this library"
cannam@162 7980 echo "*** or is declared to -dlopen it."
cannam@162 7981
cannam@162 7982 if test "$allow_undefined" = no; then
cannam@162 7983 echo
cannam@162 7984 echo "*** Since this library must not contain undefined symbols,"
cannam@162 7985 echo "*** because either the platform does not support them or"
cannam@162 7986 echo "*** it was explicitly requested with -no-undefined,"
cannam@162 7987 echo "*** libtool will only create a static version of it."
cannam@162 7988 if test "$build_old_libs" = no; then
cannam@162 7989 oldlibs="$output_objdir/$libname.$libext"
cannam@162 7990 build_libtool_libs=module
cannam@162 7991 build_old_libs=yes
cannam@162 7992 else
cannam@162 7993 build_libtool_libs=no
cannam@162 7994 fi
cannam@162 7995 fi
cannam@162 7996 fi
cannam@162 7997 fi
cannam@162 7998 # Done checking deplibs!
cannam@162 7999 deplibs=$newdeplibs
cannam@162 8000 fi
cannam@162 8001 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
cannam@162 8002 case $host in
cannam@162 8003 *-*-darwin*)
cannam@162 8004 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@162 8005 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@162 8006 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@162 8007 ;;
cannam@162 8008 esac
cannam@162 8009
cannam@162 8010 # move library search paths that coincide with paths to not yet
cannam@162 8011 # installed libraries to the beginning of the library search list
cannam@162 8012 new_libs=
cannam@162 8013 for path in $notinst_path; do
cannam@162 8014 case " $new_libs " in
cannam@162 8015 *" -L$path/$objdir "*) ;;
cannam@162 8016 *)
cannam@162 8017 case " $deplibs " in
cannam@162 8018 *" -L$path/$objdir "*)
cannam@162 8019 func_append new_libs " -L$path/$objdir" ;;
cannam@162 8020 esac
cannam@162 8021 ;;
cannam@162 8022 esac
cannam@162 8023 done
cannam@162 8024 for deplib in $deplibs; do
cannam@162 8025 case $deplib in
cannam@162 8026 -L*)
cannam@162 8027 case " $new_libs " in
cannam@162 8028 *" $deplib "*) ;;
cannam@162 8029 *) func_append new_libs " $deplib" ;;
cannam@162 8030 esac
cannam@162 8031 ;;
cannam@162 8032 *) func_append new_libs " $deplib" ;;
cannam@162 8033 esac
cannam@162 8034 done
cannam@162 8035 deplibs="$new_libs"
cannam@162 8036
cannam@162 8037 # All the library-specific variables (install_libdir is set above).
cannam@162 8038 library_names=
cannam@162 8039 old_library=
cannam@162 8040 dlname=
cannam@162 8041
cannam@162 8042 # Test again, we may have decided not to build it any more
cannam@162 8043 if test "$build_libtool_libs" = yes; then
cannam@162 8044 # Remove ${wl} instances when linking with ld.
cannam@162 8045 # FIXME: should test the right _cmds variable.
cannam@162 8046 case $archive_cmds in
cannam@162 8047 *\$LD\ *) wl= ;;
cannam@162 8048 esac
cannam@162 8049 if test "$hardcode_into_libs" = yes; then
cannam@162 8050 # Hardcode the library paths
cannam@162 8051 hardcode_libdirs=
cannam@162 8052 dep_rpath=
cannam@162 8053 rpath="$finalize_rpath"
cannam@162 8054 test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
cannam@162 8055 for libdir in $rpath; do
cannam@162 8056 if test -n "$hardcode_libdir_flag_spec"; then
cannam@162 8057 if test -n "$hardcode_libdir_separator"; then
cannam@162 8058 func_replace_sysroot "$libdir"
cannam@162 8059 libdir=$func_replace_sysroot_result
cannam@162 8060 if test -z "$hardcode_libdirs"; then
cannam@162 8061 hardcode_libdirs="$libdir"
cannam@162 8062 else
cannam@162 8063 # Just accumulate the unique libdirs.
cannam@162 8064 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
cannam@162 8065 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
cannam@162 8066 ;;
cannam@162 8067 *)
cannam@162 8068 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
cannam@162 8069 ;;
cannam@162 8070 esac
cannam@162 8071 fi
cannam@162 8072 else
cannam@162 8073 eval flag=\"$hardcode_libdir_flag_spec\"
cannam@162 8074 func_append dep_rpath " $flag"
cannam@162 8075 fi
cannam@162 8076 elif test -n "$runpath_var"; then
cannam@162 8077 case "$perm_rpath " in
cannam@162 8078 *" $libdir "*) ;;
cannam@162 8079 *) func_append perm_rpath " $libdir" ;;
cannam@162 8080 esac
cannam@162 8081 fi
cannam@162 8082 done
cannam@162 8083 # Substitute the hardcoded libdirs into the rpath.
cannam@162 8084 if test -n "$hardcode_libdir_separator" &&
cannam@162 8085 test -n "$hardcode_libdirs"; then
cannam@162 8086 libdir="$hardcode_libdirs"
cannam@162 8087 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
cannam@162 8088 fi
cannam@162 8089 if test -n "$runpath_var" && test -n "$perm_rpath"; then
cannam@162 8090 # We should set the runpath_var.
cannam@162 8091 rpath=
cannam@162 8092 for dir in $perm_rpath; do
cannam@162 8093 func_append rpath "$dir:"
cannam@162 8094 done
cannam@162 8095 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
cannam@162 8096 fi
cannam@162 8097 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
cannam@162 8098 fi
cannam@162 8099
cannam@162 8100 shlibpath="$finalize_shlibpath"
cannam@162 8101 test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
cannam@162 8102 if test -n "$shlibpath"; then
cannam@162 8103 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
cannam@162 8104 fi
cannam@162 8105
cannam@162 8106 # Get the real and link names of the library.
cannam@162 8107 eval shared_ext=\"$shrext_cmds\"
cannam@162 8108 eval library_names=\"$library_names_spec\"
cannam@162 8109 set dummy $library_names
cannam@162 8110 shift
cannam@162 8111 realname="$1"
cannam@162 8112 shift
cannam@162 8113
cannam@162 8114 if test -n "$soname_spec"; then
cannam@162 8115 eval soname=\"$soname_spec\"
cannam@162 8116 else
cannam@162 8117 soname="$realname"
cannam@162 8118 fi
cannam@162 8119 if test -z "$dlname"; then
cannam@162 8120 dlname=$soname
cannam@162 8121 fi
cannam@162 8122
cannam@162 8123 lib="$output_objdir/$realname"
cannam@162 8124 linknames=
cannam@162 8125 for link
cannam@162 8126 do
cannam@162 8127 func_append linknames " $link"
cannam@162 8128 done
cannam@162 8129
cannam@162 8130 # Use standard objects if they are pic
cannam@162 8131 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
cannam@162 8132 test "X$libobjs" = "X " && libobjs=
cannam@162 8133
cannam@162 8134 delfiles=
cannam@162 8135 if test -n "$export_symbols" && test -n "$include_expsyms"; then
cannam@162 8136 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
cannam@162 8137 export_symbols="$output_objdir/$libname.uexp"
cannam@162 8138 func_append delfiles " $export_symbols"
cannam@162 8139 fi
cannam@162 8140
cannam@162 8141 orig_export_symbols=
cannam@162 8142 case $host_os in
cannam@162 8143 cygwin* | mingw* | cegcc*)
cannam@162 8144 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
cannam@162 8145 # exporting using user supplied symfile
cannam@162 8146 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
cannam@162 8147 # and it's NOT already a .def file. Must figure out
cannam@162 8148 # which of the given symbols are data symbols and tag
cannam@162 8149 # them as such. So, trigger use of export_symbols_cmds.
cannam@162 8150 # export_symbols gets reassigned inside the "prepare
cannam@162 8151 # the list of exported symbols" if statement, so the
cannam@162 8152 # include_expsyms logic still works.
cannam@162 8153 orig_export_symbols="$export_symbols"
cannam@162 8154 export_symbols=
cannam@162 8155 always_export_symbols=yes
cannam@162 8156 fi
cannam@162 8157 fi
cannam@162 8158 ;;
cannam@162 8159 esac
cannam@162 8160
cannam@162 8161 # Prepare the list of exported symbols
cannam@162 8162 if test -z "$export_symbols"; then
cannam@162 8163 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
cannam@162 8164 func_verbose "generating symbol list for \`$libname.la'"
cannam@162 8165 export_symbols="$output_objdir/$libname.exp"
cannam@162 8166 $opt_dry_run || $RM $export_symbols
cannam@162 8167 cmds=$export_symbols_cmds
cannam@162 8168 save_ifs="$IFS"; IFS='~'
cannam@162 8169 for cmd1 in $cmds; do
cannam@162 8170 IFS="$save_ifs"
cannam@162 8171 # Take the normal branch if the nm_file_list_spec branch
cannam@162 8172 # doesn't work or if tool conversion is not needed.
cannam@162 8173 case $nm_file_list_spec~$to_tool_file_cmd in
cannam@162 8174 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
cannam@162 8175 try_normal_branch=yes
cannam@162 8176 eval cmd=\"$cmd1\"
cannam@162 8177 func_len " $cmd"
cannam@162 8178 len=$func_len_result
cannam@162 8179 ;;
cannam@162 8180 *)
cannam@162 8181 try_normal_branch=no
cannam@162 8182 ;;
cannam@162 8183 esac
cannam@162 8184 if test "$try_normal_branch" = yes \
cannam@162 8185 && { test "$len" -lt "$max_cmd_len" \
cannam@162 8186 || test "$max_cmd_len" -le -1; }
cannam@162 8187 then
cannam@162 8188 func_show_eval "$cmd" 'exit $?'
cannam@162 8189 skipped_export=false
cannam@162 8190 elif test -n "$nm_file_list_spec"; then
cannam@162 8191 func_basename "$output"
cannam@162 8192 output_la=$func_basename_result
cannam@162 8193 save_libobjs=$libobjs
cannam@162 8194 save_output=$output
cannam@162 8195 output=${output_objdir}/${output_la}.nm
cannam@162 8196 func_to_tool_file "$output"
cannam@162 8197 libobjs=$nm_file_list_spec$func_to_tool_file_result
cannam@162 8198 func_append delfiles " $output"
cannam@162 8199 func_verbose "creating $NM input file list: $output"
cannam@162 8200 for obj in $save_libobjs; do
cannam@162 8201 func_to_tool_file "$obj"
cannam@162 8202 $ECHO "$func_to_tool_file_result"
cannam@162 8203 done > "$output"
cannam@162 8204 eval cmd=\"$cmd1\"
cannam@162 8205 func_show_eval "$cmd" 'exit $?'
cannam@162 8206 output=$save_output
cannam@162 8207 libobjs=$save_libobjs
cannam@162 8208 skipped_export=false
cannam@162 8209 else
cannam@162 8210 # The command line is too long to execute in one step.
cannam@162 8211 func_verbose "using reloadable object file for export list..."
cannam@162 8212 skipped_export=:
cannam@162 8213 # Break out early, otherwise skipped_export may be
cannam@162 8214 # set to false by a later but shorter cmd.
cannam@162 8215 break
cannam@162 8216 fi
cannam@162 8217 done
cannam@162 8218 IFS="$save_ifs"
cannam@162 8219 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
cannam@162 8220 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
cannam@162 8221 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
cannam@162 8222 fi
cannam@162 8223 fi
cannam@162 8224 fi
cannam@162 8225
cannam@162 8226 if test -n "$export_symbols" && test -n "$include_expsyms"; then
cannam@162 8227 tmp_export_symbols="$export_symbols"
cannam@162 8228 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
cannam@162 8229 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
cannam@162 8230 fi
cannam@162 8231
cannam@162 8232 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
cannam@162 8233 # The given exports_symbols file has to be filtered, so filter it.
cannam@162 8234 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
cannam@162 8235 # FIXME: $output_objdir/$libname.filter potentially contains lots of
cannam@162 8236 # 's' commands which not all seds can handle. GNU sed should be fine
cannam@162 8237 # though. Also, the filter scales superlinearly with the number of
cannam@162 8238 # global variables. join(1) would be nice here, but unfortunately
cannam@162 8239 # isn't a blessed tool.
cannam@162 8240 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
cannam@162 8241 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
cannam@162 8242 export_symbols=$output_objdir/$libname.def
cannam@162 8243 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
cannam@162 8244 fi
cannam@162 8245
cannam@162 8246 tmp_deplibs=
cannam@162 8247 for test_deplib in $deplibs; do
cannam@162 8248 case " $convenience " in
cannam@162 8249 *" $test_deplib "*) ;;
cannam@162 8250 *)
cannam@162 8251 func_append tmp_deplibs " $test_deplib"
cannam@162 8252 ;;
cannam@162 8253 esac
cannam@162 8254 done
cannam@162 8255 deplibs="$tmp_deplibs"
cannam@162 8256
cannam@162 8257 if test -n "$convenience"; then
cannam@162 8258 if test -n "$whole_archive_flag_spec" &&
cannam@162 8259 test "$compiler_needs_object" = yes &&
cannam@162 8260 test -z "$libobjs"; then
cannam@162 8261 # extract the archives, so we have objects to list.
cannam@162 8262 # TODO: could optimize this to just extract one archive.
cannam@162 8263 whole_archive_flag_spec=
cannam@162 8264 fi
cannam@162 8265 if test -n "$whole_archive_flag_spec"; then
cannam@162 8266 save_libobjs=$libobjs
cannam@162 8267 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
cannam@162 8268 test "X$libobjs" = "X " && libobjs=
cannam@162 8269 else
cannam@162 8270 gentop="$output_objdir/${outputname}x"
cannam@162 8271 func_append generated " $gentop"
cannam@162 8272
cannam@162 8273 func_extract_archives $gentop $convenience
cannam@162 8274 func_append libobjs " $func_extract_archives_result"
cannam@162 8275 test "X$libobjs" = "X " && libobjs=
cannam@162 8276 fi
cannam@162 8277 fi
cannam@162 8278
cannam@162 8279 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
cannam@162 8280 eval flag=\"$thread_safe_flag_spec\"
cannam@162 8281 func_append linker_flags " $flag"
cannam@162 8282 fi
cannam@162 8283
cannam@162 8284 # Make a backup of the uninstalled library when relinking
cannam@162 8285 if test "$opt_mode" = relink; then
cannam@162 8286 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
cannam@162 8287 fi
cannam@162 8288
cannam@162 8289 # Do each of the archive commands.
cannam@162 8290 if test "$module" = yes && test -n "$module_cmds" ; then
cannam@162 8291 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
cannam@162 8292 eval test_cmds=\"$module_expsym_cmds\"
cannam@162 8293 cmds=$module_expsym_cmds
cannam@162 8294 else
cannam@162 8295 eval test_cmds=\"$module_cmds\"
cannam@162 8296 cmds=$module_cmds
cannam@162 8297 fi
cannam@162 8298 else
cannam@162 8299 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
cannam@162 8300 eval test_cmds=\"$archive_expsym_cmds\"
cannam@162 8301 cmds=$archive_expsym_cmds
cannam@162 8302 else
cannam@162 8303 eval test_cmds=\"$archive_cmds\"
cannam@162 8304 cmds=$archive_cmds
cannam@162 8305 fi
cannam@162 8306 fi
cannam@162 8307
cannam@162 8308 if test "X$skipped_export" != "X:" &&
cannam@162 8309 func_len " $test_cmds" &&
cannam@162 8310 len=$func_len_result &&
cannam@162 8311 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
cannam@162 8312 :
cannam@162 8313 else
cannam@162 8314 # The command line is too long to link in one step, link piecewise
cannam@162 8315 # or, if using GNU ld and skipped_export is not :, use a linker
cannam@162 8316 # script.
cannam@162 8317
cannam@162 8318 # Save the value of $output and $libobjs because we want to
cannam@162 8319 # use them later. If we have whole_archive_flag_spec, we
cannam@162 8320 # want to use save_libobjs as it was before
cannam@162 8321 # whole_archive_flag_spec was expanded, because we can't
cannam@162 8322 # assume the linker understands whole_archive_flag_spec.
cannam@162 8323 # This may have to be revisited, in case too many
cannam@162 8324 # convenience libraries get linked in and end up exceeding
cannam@162 8325 # the spec.
cannam@162 8326 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
cannam@162 8327 save_libobjs=$libobjs
cannam@162 8328 fi
cannam@162 8329 save_output=$output
cannam@162 8330 func_basename "$output"
cannam@162 8331 output_la=$func_basename_result
cannam@162 8332
cannam@162 8333 # Clear the reloadable object creation command queue and
cannam@162 8334 # initialize k to one.
cannam@162 8335 test_cmds=
cannam@162 8336 concat_cmds=
cannam@162 8337 objlist=
cannam@162 8338 last_robj=
cannam@162 8339 k=1
cannam@162 8340
cannam@162 8341 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
cannam@162 8342 output=${output_objdir}/${output_la}.lnkscript
cannam@162 8343 func_verbose "creating GNU ld script: $output"
cannam@162 8344 echo 'INPUT (' > $output
cannam@162 8345 for obj in $save_libobjs
cannam@162 8346 do
cannam@162 8347 func_to_tool_file "$obj"
cannam@162 8348 $ECHO "$func_to_tool_file_result" >> $output
cannam@162 8349 done
cannam@162 8350 echo ')' >> $output
cannam@162 8351 func_append delfiles " $output"
cannam@162 8352 func_to_tool_file "$output"
cannam@162 8353 output=$func_to_tool_file_result
cannam@162 8354 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
cannam@162 8355 output=${output_objdir}/${output_la}.lnk
cannam@162 8356 func_verbose "creating linker input file list: $output"
cannam@162 8357 : > $output
cannam@162 8358 set x $save_libobjs
cannam@162 8359 shift
cannam@162 8360 firstobj=
cannam@162 8361 if test "$compiler_needs_object" = yes; then
cannam@162 8362 firstobj="$1 "
cannam@162 8363 shift
cannam@162 8364 fi
cannam@162 8365 for obj
cannam@162 8366 do
cannam@162 8367 func_to_tool_file "$obj"
cannam@162 8368 $ECHO "$func_to_tool_file_result" >> $output
cannam@162 8369 done
cannam@162 8370 func_append delfiles " $output"
cannam@162 8371 func_to_tool_file "$output"
cannam@162 8372 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
cannam@162 8373 else
cannam@162 8374 if test -n "$save_libobjs"; then
cannam@162 8375 func_verbose "creating reloadable object files..."
cannam@162 8376 output=$output_objdir/$output_la-${k}.$objext
cannam@162 8377 eval test_cmds=\"$reload_cmds\"
cannam@162 8378 func_len " $test_cmds"
cannam@162 8379 len0=$func_len_result
cannam@162 8380 len=$len0
cannam@162 8381
cannam@162 8382 # Loop over the list of objects to be linked.
cannam@162 8383 for obj in $save_libobjs
cannam@162 8384 do
cannam@162 8385 func_len " $obj"
cannam@162 8386 func_arith $len + $func_len_result
cannam@162 8387 len=$func_arith_result
cannam@162 8388 if test "X$objlist" = X ||
cannam@162 8389 test "$len" -lt "$max_cmd_len"; then
cannam@162 8390 func_append objlist " $obj"
cannam@162 8391 else
cannam@162 8392 # The command $test_cmds is almost too long, add a
cannam@162 8393 # command to the queue.
cannam@162 8394 if test "$k" -eq 1 ; then
cannam@162 8395 # The first file doesn't have a previous command to add.
cannam@162 8396 reload_objs=$objlist
cannam@162 8397 eval concat_cmds=\"$reload_cmds\"
cannam@162 8398 else
cannam@162 8399 # All subsequent reloadable object files will link in
cannam@162 8400 # the last one created.
cannam@162 8401 reload_objs="$objlist $last_robj"
cannam@162 8402 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
cannam@162 8403 fi
cannam@162 8404 last_robj=$output_objdir/$output_la-${k}.$objext
cannam@162 8405 func_arith $k + 1
cannam@162 8406 k=$func_arith_result
cannam@162 8407 output=$output_objdir/$output_la-${k}.$objext
cannam@162 8408 objlist=" $obj"
cannam@162 8409 func_len " $last_robj"
cannam@162 8410 func_arith $len0 + $func_len_result
cannam@162 8411 len=$func_arith_result
cannam@162 8412 fi
cannam@162 8413 done
cannam@162 8414 # Handle the remaining objects by creating one last
cannam@162 8415 # reloadable object file. All subsequent reloadable object
cannam@162 8416 # files will link in the last one created.
cannam@162 8417 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
cannam@162 8418 reload_objs="$objlist $last_robj"
cannam@162 8419 eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
cannam@162 8420 if test -n "$last_robj"; then
cannam@162 8421 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
cannam@162 8422 fi
cannam@162 8423 func_append delfiles " $output"
cannam@162 8424
cannam@162 8425 else
cannam@162 8426 output=
cannam@162 8427 fi
cannam@162 8428
cannam@162 8429 if ${skipped_export-false}; then
cannam@162 8430 func_verbose "generating symbol list for \`$libname.la'"
cannam@162 8431 export_symbols="$output_objdir/$libname.exp"
cannam@162 8432 $opt_dry_run || $RM $export_symbols
cannam@162 8433 libobjs=$output
cannam@162 8434 # Append the command to create the export file.
cannam@162 8435 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
cannam@162 8436 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
cannam@162 8437 if test -n "$last_robj"; then
cannam@162 8438 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
cannam@162 8439 fi
cannam@162 8440 fi
cannam@162 8441
cannam@162 8442 test -n "$save_libobjs" &&
cannam@162 8443 func_verbose "creating a temporary reloadable object file: $output"
cannam@162 8444
cannam@162 8445 # Loop through the commands generated above and execute them.
cannam@162 8446 save_ifs="$IFS"; IFS='~'
cannam@162 8447 for cmd in $concat_cmds; do
cannam@162 8448 IFS="$save_ifs"
cannam@162 8449 $opt_silent || {
cannam@162 8450 func_quote_for_expand "$cmd"
cannam@162 8451 eval "func_echo $func_quote_for_expand_result"
cannam@162 8452 }
cannam@162 8453 $opt_dry_run || eval "$cmd" || {
cannam@162 8454 lt_exit=$?
cannam@162 8455
cannam@162 8456 # Restore the uninstalled library and exit
cannam@162 8457 if test "$opt_mode" = relink; then
cannam@162 8458 ( cd "$output_objdir" && \
cannam@162 8459 $RM "${realname}T" && \
cannam@162 8460 $MV "${realname}U" "$realname" )
cannam@162 8461 fi
cannam@162 8462
cannam@162 8463 exit $lt_exit
cannam@162 8464 }
cannam@162 8465 done
cannam@162 8466 IFS="$save_ifs"
cannam@162 8467
cannam@162 8468 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
cannam@162 8469 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
cannam@162 8470 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
cannam@162 8471 fi
cannam@162 8472 fi
cannam@162 8473
cannam@162 8474 if ${skipped_export-false}; then
cannam@162 8475 if test -n "$export_symbols" && test -n "$include_expsyms"; then
cannam@162 8476 tmp_export_symbols="$export_symbols"
cannam@162 8477 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
cannam@162 8478 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
cannam@162 8479 fi
cannam@162 8480
cannam@162 8481 if test -n "$orig_export_symbols"; then
cannam@162 8482 # The given exports_symbols file has to be filtered, so filter it.
cannam@162 8483 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
cannam@162 8484 # FIXME: $output_objdir/$libname.filter potentially contains lots of
cannam@162 8485 # 's' commands which not all seds can handle. GNU sed should be fine
cannam@162 8486 # though. Also, the filter scales superlinearly with the number of
cannam@162 8487 # global variables. join(1) would be nice here, but unfortunately
cannam@162 8488 # isn't a blessed tool.
cannam@162 8489 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
cannam@162 8490 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
cannam@162 8491 export_symbols=$output_objdir/$libname.def
cannam@162 8492 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
cannam@162 8493 fi
cannam@162 8494 fi
cannam@162 8495
cannam@162 8496 libobjs=$output
cannam@162 8497 # Restore the value of output.
cannam@162 8498 output=$save_output
cannam@162 8499
cannam@162 8500 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
cannam@162 8501 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
cannam@162 8502 test "X$libobjs" = "X " && libobjs=
cannam@162 8503 fi
cannam@162 8504 # Expand the library linking commands again to reset the
cannam@162 8505 # value of $libobjs for piecewise linking.
cannam@162 8506
cannam@162 8507 # Do each of the archive commands.
cannam@162 8508 if test "$module" = yes && test -n "$module_cmds" ; then
cannam@162 8509 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
cannam@162 8510 cmds=$module_expsym_cmds
cannam@162 8511 else
cannam@162 8512 cmds=$module_cmds
cannam@162 8513 fi
cannam@162 8514 else
cannam@162 8515 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
cannam@162 8516 cmds=$archive_expsym_cmds
cannam@162 8517 else
cannam@162 8518 cmds=$archive_cmds
cannam@162 8519 fi
cannam@162 8520 fi
cannam@162 8521 fi
cannam@162 8522
cannam@162 8523 if test -n "$delfiles"; then
cannam@162 8524 # Append the command to remove temporary files to $cmds.
cannam@162 8525 eval cmds=\"\$cmds~\$RM $delfiles\"
cannam@162 8526 fi
cannam@162 8527
cannam@162 8528 # Add any objects from preloaded convenience libraries
cannam@162 8529 if test -n "$dlprefiles"; then
cannam@162 8530 gentop="$output_objdir/${outputname}x"
cannam@162 8531 func_append generated " $gentop"
cannam@162 8532
cannam@162 8533 func_extract_archives $gentop $dlprefiles
cannam@162 8534 func_append libobjs " $func_extract_archives_result"
cannam@162 8535 test "X$libobjs" = "X " && libobjs=
cannam@162 8536 fi
cannam@162 8537
cannam@162 8538 save_ifs="$IFS"; IFS='~'
cannam@162 8539 for cmd in $cmds; do
cannam@162 8540 IFS="$save_ifs"
cannam@162 8541 eval cmd=\"$cmd\"
cannam@162 8542 $opt_silent || {
cannam@162 8543 func_quote_for_expand "$cmd"
cannam@162 8544 eval "func_echo $func_quote_for_expand_result"
cannam@162 8545 }
cannam@162 8546 $opt_dry_run || eval "$cmd" || {
cannam@162 8547 lt_exit=$?
cannam@162 8548
cannam@162 8549 # Restore the uninstalled library and exit
cannam@162 8550 if test "$opt_mode" = relink; then
cannam@162 8551 ( cd "$output_objdir" && \
cannam@162 8552 $RM "${realname}T" && \
cannam@162 8553 $MV "${realname}U" "$realname" )
cannam@162 8554 fi
cannam@162 8555
cannam@162 8556 exit $lt_exit
cannam@162 8557 }
cannam@162 8558 done
cannam@162 8559 IFS="$save_ifs"
cannam@162 8560
cannam@162 8561 # Restore the uninstalled library and exit
cannam@162 8562 if test "$opt_mode" = relink; then
cannam@162 8563 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
cannam@162 8564
cannam@162 8565 if test -n "$convenience"; then
cannam@162 8566 if test -z "$whole_archive_flag_spec"; then
cannam@162 8567 func_show_eval '${RM}r "$gentop"'
cannam@162 8568 fi
cannam@162 8569 fi
cannam@162 8570
cannam@162 8571 exit $EXIT_SUCCESS
cannam@162 8572 fi
cannam@162 8573
cannam@162 8574 # Create links to the real library.
cannam@162 8575 for linkname in $linknames; do
cannam@162 8576 if test "$realname" != "$linkname"; then
cannam@162 8577 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
cannam@162 8578 fi
cannam@162 8579 done
cannam@162 8580
cannam@162 8581 # If -module or -export-dynamic was specified, set the dlname.
cannam@162 8582 if test "$module" = yes || test "$export_dynamic" = yes; then
cannam@162 8583 # On all known operating systems, these are identical.
cannam@162 8584 dlname="$soname"
cannam@162 8585 fi
cannam@162 8586 fi
cannam@162 8587 ;;
cannam@162 8588
cannam@162 8589 obj)
cannam@162 8590 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
cannam@162 8591 func_warning "\`-dlopen' is ignored for objects"
cannam@162 8592 fi
cannam@162 8593
cannam@162 8594 case " $deplibs" in
cannam@162 8595 *\ -l* | *\ -L*)
cannam@162 8596 func_warning "\`-l' and \`-L' are ignored for objects" ;;
cannam@162 8597 esac
cannam@162 8598
cannam@162 8599 test -n "$rpath" && \
cannam@162 8600 func_warning "\`-rpath' is ignored for objects"
cannam@162 8601
cannam@162 8602 test -n "$xrpath" && \
cannam@162 8603 func_warning "\`-R' is ignored for objects"
cannam@162 8604
cannam@162 8605 test -n "$vinfo" && \
cannam@162 8606 func_warning "\`-version-info' is ignored for objects"
cannam@162 8607
cannam@162 8608 test -n "$release" && \
cannam@162 8609 func_warning "\`-release' is ignored for objects"
cannam@162 8610
cannam@162 8611 case $output in
cannam@162 8612 *.lo)
cannam@162 8613 test -n "$objs$old_deplibs" && \
cannam@162 8614 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
cannam@162 8615
cannam@162 8616 libobj=$output
cannam@162 8617 func_lo2o "$libobj"
cannam@162 8618 obj=$func_lo2o_result
cannam@162 8619 ;;
cannam@162 8620 *)
cannam@162 8621 libobj=
cannam@162 8622 obj="$output"
cannam@162 8623 ;;
cannam@162 8624 esac
cannam@162 8625
cannam@162 8626 # Delete the old objects.
cannam@162 8627 $opt_dry_run || $RM $obj $libobj
cannam@162 8628
cannam@162 8629 # Objects from convenience libraries. This assumes
cannam@162 8630 # single-version convenience libraries. Whenever we create
cannam@162 8631 # different ones for PIC/non-PIC, this we'll have to duplicate
cannam@162 8632 # the extraction.
cannam@162 8633 reload_conv_objs=
cannam@162 8634 gentop=
cannam@162 8635 # reload_cmds runs $LD directly, so let us get rid of
cannam@162 8636 # -Wl from whole_archive_flag_spec and hope we can get by with
cannam@162 8637 # turning comma into space..
cannam@162 8638 wl=
cannam@162 8639
cannam@162 8640 if test -n "$convenience"; then
cannam@162 8641 if test -n "$whole_archive_flag_spec"; then
cannam@162 8642 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
cannam@162 8643 reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
cannam@162 8644 else
cannam@162 8645 gentop="$output_objdir/${obj}x"
cannam@162 8646 func_append generated " $gentop"
cannam@162 8647
cannam@162 8648 func_extract_archives $gentop $convenience
cannam@162 8649 reload_conv_objs="$reload_objs $func_extract_archives_result"
cannam@162 8650 fi
cannam@162 8651 fi
cannam@162 8652
cannam@162 8653 # If we're not building shared, we need to use non_pic_objs
cannam@162 8654 test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
cannam@162 8655
cannam@162 8656 # Create the old-style object.
cannam@162 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@162 8658
cannam@162 8659 output="$obj"
cannam@162 8660 func_execute_cmds "$reload_cmds" 'exit $?'
cannam@162 8661
cannam@162 8662 # Exit if we aren't doing a library object file.
cannam@162 8663 if test -z "$libobj"; then
cannam@162 8664 if test -n "$gentop"; then
cannam@162 8665 func_show_eval '${RM}r "$gentop"'
cannam@162 8666 fi
cannam@162 8667
cannam@162 8668 exit $EXIT_SUCCESS
cannam@162 8669 fi
cannam@162 8670
cannam@162 8671 if test "$build_libtool_libs" != yes; then
cannam@162 8672 if test -n "$gentop"; then
cannam@162 8673 func_show_eval '${RM}r "$gentop"'
cannam@162 8674 fi
cannam@162 8675
cannam@162 8676 # Create an invalid libtool object if no PIC, so that we don't
cannam@162 8677 # accidentally link it into a program.
cannam@162 8678 # $show "echo timestamp > $libobj"
cannam@162 8679 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
cannam@162 8680 exit $EXIT_SUCCESS
cannam@162 8681 fi
cannam@162 8682
cannam@162 8683 if test -n "$pic_flag" || test "$pic_mode" != default; then
cannam@162 8684 # Only do commands if we really have different PIC objects.
cannam@162 8685 reload_objs="$libobjs $reload_conv_objs"
cannam@162 8686 output="$libobj"
cannam@162 8687 func_execute_cmds "$reload_cmds" 'exit $?'
cannam@162 8688 fi
cannam@162 8689
cannam@162 8690 if test -n "$gentop"; then
cannam@162 8691 func_show_eval '${RM}r "$gentop"'
cannam@162 8692 fi
cannam@162 8693
cannam@162 8694 exit $EXIT_SUCCESS
cannam@162 8695 ;;
cannam@162 8696
cannam@162 8697 prog)
cannam@162 8698 case $host in
cannam@162 8699 *cygwin*) func_stripname '' '.exe' "$output"
cannam@162 8700 output=$func_stripname_result.exe;;
cannam@162 8701 esac
cannam@162 8702 test -n "$vinfo" && \
cannam@162 8703 func_warning "\`-version-info' is ignored for programs"
cannam@162 8704
cannam@162 8705 test -n "$release" && \
cannam@162 8706 func_warning "\`-release' is ignored for programs"
cannam@162 8707
cannam@162 8708 test "$preload" = yes \
cannam@162 8709 && test "$dlopen_support" = unknown \
cannam@162 8710 && test "$dlopen_self" = unknown \
cannam@162 8711 && test "$dlopen_self_static" = unknown && \
cannam@162 8712 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
cannam@162 8713
cannam@162 8714 case $host in
cannam@162 8715 *-*-rhapsody* | *-*-darwin1.[012])
cannam@162 8716 # On Rhapsody replace the C library is the System framework
cannam@162 8717 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
cannam@162 8718 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
cannam@162 8719 ;;
cannam@162 8720 esac
cannam@162 8721
cannam@162 8722 case $host in
cannam@162 8723 *-*-darwin*)
cannam@162 8724 # Don't allow lazy linking, it breaks C++ global constructors
cannam@162 8725 # But is supposedly fixed on 10.4 or later (yay!).
cannam@162 8726 if test "$tagname" = CXX ; then
cannam@162 8727 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
cannam@162 8728 10.[0123])
cannam@162 8729 func_append compile_command " ${wl}-bind_at_load"
cannam@162 8730 func_append finalize_command " ${wl}-bind_at_load"
cannam@162 8731 ;;
cannam@162 8732 esac
cannam@162 8733 fi
cannam@162 8734 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
cannam@162 8735 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@162 8736 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
cannam@162 8737 ;;
cannam@162 8738 esac
cannam@162 8739
cannam@162 8740
cannam@162 8741 # move library search paths that coincide with paths to not yet
cannam@162 8742 # installed libraries to the beginning of the library search list
cannam@162 8743 new_libs=
cannam@162 8744 for path in $notinst_path; do
cannam@162 8745 case " $new_libs " in
cannam@162 8746 *" -L$path/$objdir "*) ;;
cannam@162 8747 *)
cannam@162 8748 case " $compile_deplibs " in
cannam@162 8749 *" -L$path/$objdir "*)
cannam@162 8750 func_append new_libs " -L$path/$objdir" ;;
cannam@162 8751 esac
cannam@162 8752 ;;
cannam@162 8753 esac
cannam@162 8754 done
cannam@162 8755 for deplib in $compile_deplibs; do
cannam@162 8756 case $deplib in
cannam@162 8757 -L*)
cannam@162 8758 case " $new_libs " in
cannam@162 8759 *" $deplib "*) ;;
cannam@162 8760 *) func_append new_libs " $deplib" ;;
cannam@162 8761 esac
cannam@162 8762 ;;
cannam@162 8763 *) func_append new_libs " $deplib" ;;
cannam@162 8764 esac
cannam@162 8765 done
cannam@162 8766 compile_deplibs="$new_libs"
cannam@162 8767
cannam@162 8768
cannam@162 8769 func_append compile_command " $compile_deplibs"
cannam@162 8770 func_append finalize_command " $finalize_deplibs"
cannam@162 8771
cannam@162 8772 if test -n "$rpath$xrpath"; then
cannam@162 8773 # If the user specified any rpath flags, then add them.
cannam@162 8774 for libdir in $rpath $xrpath; do
cannam@162 8775 # This is the magic to use -rpath.
cannam@162 8776 case "$finalize_rpath " in
cannam@162 8777 *" $libdir "*) ;;
cannam@162 8778 *) func_append finalize_rpath " $libdir" ;;
cannam@162 8779 esac
cannam@162 8780 done
cannam@162 8781 fi
cannam@162 8782
cannam@162 8783 # Now hardcode the library paths
cannam@162 8784 rpath=
cannam@162 8785 hardcode_libdirs=
cannam@162 8786 for libdir in $compile_rpath $finalize_rpath; do
cannam@162 8787 if test -n "$hardcode_libdir_flag_spec"; then
cannam@162 8788 if test -n "$hardcode_libdir_separator"; then
cannam@162 8789 if test -z "$hardcode_libdirs"; then
cannam@162 8790 hardcode_libdirs="$libdir"
cannam@162 8791 else
cannam@162 8792 # Just accumulate the unique libdirs.
cannam@162 8793 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
cannam@162 8794 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
cannam@162 8795 ;;
cannam@162 8796 *)
cannam@162 8797 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
cannam@162 8798 ;;
cannam@162 8799 esac
cannam@162 8800 fi
cannam@162 8801 else
cannam@162 8802 eval flag=\"$hardcode_libdir_flag_spec\"
cannam@162 8803 func_append rpath " $flag"
cannam@162 8804 fi
cannam@162 8805 elif test -n "$runpath_var"; then
cannam@162 8806 case "$perm_rpath " in
cannam@162 8807 *" $libdir "*) ;;
cannam@162 8808 *) func_append perm_rpath " $libdir" ;;
cannam@162 8809 esac
cannam@162 8810 fi
cannam@162 8811 case $host in
cannam@162 8812 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
cannam@162 8813 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
cannam@162 8814 case :$dllsearchpath: in
cannam@162 8815 *":$libdir:"*) ;;
cannam@162 8816 ::) dllsearchpath=$libdir;;
cannam@162 8817 *) func_append dllsearchpath ":$libdir";;
cannam@162 8818 esac
cannam@162 8819 case :$dllsearchpath: in
cannam@162 8820 *":$testbindir:"*) ;;
cannam@162 8821 ::) dllsearchpath=$testbindir;;
cannam@162 8822 *) func_append dllsearchpath ":$testbindir";;
cannam@162 8823 esac
cannam@162 8824 ;;
cannam@162 8825 esac
cannam@162 8826 done
cannam@162 8827 # Substitute the hardcoded libdirs into the rpath.
cannam@162 8828 if test -n "$hardcode_libdir_separator" &&
cannam@162 8829 test -n "$hardcode_libdirs"; then
cannam@162 8830 libdir="$hardcode_libdirs"
cannam@162 8831 eval rpath=\" $hardcode_libdir_flag_spec\"
cannam@162 8832 fi
cannam@162 8833 compile_rpath="$rpath"
cannam@162 8834
cannam@162 8835 rpath=
cannam@162 8836 hardcode_libdirs=
cannam@162 8837 for libdir in $finalize_rpath; do
cannam@162 8838 if test -n "$hardcode_libdir_flag_spec"; then
cannam@162 8839 if test -n "$hardcode_libdir_separator"; then
cannam@162 8840 if test -z "$hardcode_libdirs"; then
cannam@162 8841 hardcode_libdirs="$libdir"
cannam@162 8842 else
cannam@162 8843 # Just accumulate the unique libdirs.
cannam@162 8844 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
cannam@162 8845 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
cannam@162 8846 ;;
cannam@162 8847 *)
cannam@162 8848 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
cannam@162 8849 ;;
cannam@162 8850 esac
cannam@162 8851 fi
cannam@162 8852 else
cannam@162 8853 eval flag=\"$hardcode_libdir_flag_spec\"
cannam@162 8854 func_append rpath " $flag"
cannam@162 8855 fi
cannam@162 8856 elif test -n "$runpath_var"; then
cannam@162 8857 case "$finalize_perm_rpath " in
cannam@162 8858 *" $libdir "*) ;;
cannam@162 8859 *) func_append finalize_perm_rpath " $libdir" ;;
cannam@162 8860 esac
cannam@162 8861 fi
cannam@162 8862 done
cannam@162 8863 # Substitute the hardcoded libdirs into the rpath.
cannam@162 8864 if test -n "$hardcode_libdir_separator" &&
cannam@162 8865 test -n "$hardcode_libdirs"; then
cannam@162 8866 libdir="$hardcode_libdirs"
cannam@162 8867 eval rpath=\" $hardcode_libdir_flag_spec\"
cannam@162 8868 fi
cannam@162 8869 finalize_rpath="$rpath"
cannam@162 8870
cannam@162 8871 if test -n "$libobjs" && test "$build_old_libs" = yes; then
cannam@162 8872 # Transform all the library objects into standard objects.
cannam@162 8873 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
cannam@162 8874 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
cannam@162 8875 fi
cannam@162 8876
cannam@162 8877 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
cannam@162 8878
cannam@162 8879 # template prelinking step
cannam@162 8880 if test -n "$prelink_cmds"; then
cannam@162 8881 func_execute_cmds "$prelink_cmds" 'exit $?'
cannam@162 8882 fi
cannam@162 8883
cannam@162 8884 wrappers_required=yes
cannam@162 8885 case $host in
cannam@162 8886 *cegcc* | *mingw32ce*)
cannam@162 8887 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
cannam@162 8888 wrappers_required=no
cannam@162 8889 ;;
cannam@162 8890 *cygwin* | *mingw* )
cannam@162 8891 if test "$build_libtool_libs" != yes; then
cannam@162 8892 wrappers_required=no
cannam@162 8893 fi
cannam@162 8894 ;;
cannam@162 8895 *)
cannam@162 8896 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
cannam@162 8897 wrappers_required=no
cannam@162 8898 fi
cannam@162 8899 ;;
cannam@162 8900 esac
cannam@162 8901 if test "$wrappers_required" = no; then
cannam@162 8902 # Replace the output file specification.
cannam@162 8903 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
cannam@162 8904 link_command="$compile_command$compile_rpath"
cannam@162 8905
cannam@162 8906 # We have no uninstalled library dependencies, so finalize right now.
cannam@162 8907 exit_status=0
cannam@162 8908 func_show_eval "$link_command" 'exit_status=$?'
cannam@162 8909
cannam@162 8910 if test -n "$postlink_cmds"; then
cannam@162 8911 func_to_tool_file "$output"
cannam@162 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@162 8913 func_execute_cmds "$postlink_cmds" 'exit $?'
cannam@162 8914 fi
cannam@162 8915
cannam@162 8916 # Delete the generated files.
cannam@162 8917 if test -f "$output_objdir/${outputname}S.${objext}"; then
cannam@162 8918 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
cannam@162 8919 fi
cannam@162 8920
cannam@162 8921 exit $exit_status
cannam@162 8922 fi
cannam@162 8923
cannam@162 8924 if test -n "$compile_shlibpath$finalize_shlibpath"; then
cannam@162 8925 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
cannam@162 8926 fi
cannam@162 8927 if test -n "$finalize_shlibpath"; then
cannam@162 8928 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
cannam@162 8929 fi
cannam@162 8930
cannam@162 8931 compile_var=
cannam@162 8932 finalize_var=
cannam@162 8933 if test -n "$runpath_var"; then
cannam@162 8934 if test -n "$perm_rpath"; then
cannam@162 8935 # We should set the runpath_var.
cannam@162 8936 rpath=
cannam@162 8937 for dir in $perm_rpath; do
cannam@162 8938 func_append rpath "$dir:"
cannam@162 8939 done
cannam@162 8940 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
cannam@162 8941 fi
cannam@162 8942 if test -n "$finalize_perm_rpath"; then
cannam@162 8943 # We should set the runpath_var.
cannam@162 8944 rpath=
cannam@162 8945 for dir in $finalize_perm_rpath; do
cannam@162 8946 func_append rpath "$dir:"
cannam@162 8947 done
cannam@162 8948 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
cannam@162 8949 fi
cannam@162 8950 fi
cannam@162 8951
cannam@162 8952 if test "$no_install" = yes; then
cannam@162 8953 # We don't need to create a wrapper script.
cannam@162 8954 link_command="$compile_var$compile_command$compile_rpath"
cannam@162 8955 # Replace the output file specification.
cannam@162 8956 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
cannam@162 8957 # Delete the old output file.
cannam@162 8958 $opt_dry_run || $RM $output
cannam@162 8959 # Link the executable and exit
cannam@162 8960 func_show_eval "$link_command" 'exit $?'
cannam@162 8961
cannam@162 8962 if test -n "$postlink_cmds"; then
cannam@162 8963 func_to_tool_file "$output"
cannam@162 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@162 8965 func_execute_cmds "$postlink_cmds" 'exit $?'
cannam@162 8966 fi
cannam@162 8967
cannam@162 8968 exit $EXIT_SUCCESS
cannam@162 8969 fi
cannam@162 8970
cannam@162 8971 if test "$hardcode_action" = relink; then
cannam@162 8972 # Fast installation is not supported
cannam@162 8973 link_command="$compile_var$compile_command$compile_rpath"
cannam@162 8974 relink_command="$finalize_var$finalize_command$finalize_rpath"
cannam@162 8975
cannam@162 8976 func_warning "this platform does not like uninstalled shared libraries"
cannam@162 8977 func_warning "\`$output' will be relinked during installation"
cannam@162 8978 else
cannam@162 8979 if test "$fast_install" != no; then
cannam@162 8980 link_command="$finalize_var$compile_command$finalize_rpath"
cannam@162 8981 if test "$fast_install" = yes; then
cannam@162 8982 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
cannam@162 8983 else
cannam@162 8984 # fast_install is set to needless
cannam@162 8985 relink_command=
cannam@162 8986 fi
cannam@162 8987 else
cannam@162 8988 link_command="$compile_var$compile_command$compile_rpath"
cannam@162 8989 relink_command="$finalize_var$finalize_command$finalize_rpath"
cannam@162 8990 fi
cannam@162 8991 fi
cannam@162 8992
cannam@162 8993 # Replace the output file specification.
cannam@162 8994 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
cannam@162 8995
cannam@162 8996 # Delete the old output files.
cannam@162 8997 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
cannam@162 8998
cannam@162 8999 func_show_eval "$link_command" 'exit $?'
cannam@162 9000
cannam@162 9001 if test -n "$postlink_cmds"; then
cannam@162 9002 func_to_tool_file "$output_objdir/$outputname"
cannam@162 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@162 9004 func_execute_cmds "$postlink_cmds" 'exit $?'
cannam@162 9005 fi
cannam@162 9006
cannam@162 9007 # Now create the wrapper script.
cannam@162 9008 func_verbose "creating $output"
cannam@162 9009
cannam@162 9010 # Quote the relink command for shipping.
cannam@162 9011 if test -n "$relink_command"; then
cannam@162 9012 # Preserve any variables that may affect compiler behavior
cannam@162 9013 for var in $variables_saved_for_relink; do
cannam@162 9014 if eval test -z \"\${$var+set}\"; then
cannam@162 9015 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
cannam@162 9016 elif eval var_value=\$$var; test -z "$var_value"; then
cannam@162 9017 relink_command="$var=; export $var; $relink_command"
cannam@162 9018 else
cannam@162 9019 func_quote_for_eval "$var_value"
cannam@162 9020 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
cannam@162 9021 fi
cannam@162 9022 done
cannam@162 9023 relink_command="(cd `pwd`; $relink_command)"
cannam@162 9024 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
cannam@162 9025 fi
cannam@162 9026
cannam@162 9027 # Only actually do things if not in dry run mode.
cannam@162 9028 $opt_dry_run || {
cannam@162 9029 # win32 will think the script is a binary if it has
cannam@162 9030 # a .exe suffix, so we strip it off here.
cannam@162 9031 case $output in
cannam@162 9032 *.exe) func_stripname '' '.exe' "$output"
cannam@162 9033 output=$func_stripname_result ;;
cannam@162 9034 esac
cannam@162 9035 # test for cygwin because mv fails w/o .exe extensions
cannam@162 9036 case $host in
cannam@162 9037 *cygwin*)
cannam@162 9038 exeext=.exe
cannam@162 9039 func_stripname '' '.exe' "$outputname"
cannam@162 9040 outputname=$func_stripname_result ;;
cannam@162 9041 *) exeext= ;;
cannam@162 9042 esac
cannam@162 9043 case $host in
cannam@162 9044 *cygwin* | *mingw* )
cannam@162 9045 func_dirname_and_basename "$output" "" "."
cannam@162 9046 output_name=$func_basename_result
cannam@162 9047 output_path=$func_dirname_result
cannam@162 9048 cwrappersource="$output_path/$objdir/lt-$output_name.c"
cannam@162 9049 cwrapper="$output_path/$output_name.exe"
cannam@162 9050 $RM $cwrappersource $cwrapper
cannam@162 9051 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
cannam@162 9052
cannam@162 9053 func_emit_cwrapperexe_src > $cwrappersource
cannam@162 9054
cannam@162 9055 # The wrapper executable is built using the $host compiler,
cannam@162 9056 # because it contains $host paths and files. If cross-
cannam@162 9057 # compiling, it, like the target executable, must be
cannam@162 9058 # executed on the $host or under an emulation environment.
cannam@162 9059 $opt_dry_run || {
cannam@162 9060 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
cannam@162 9061 $STRIP $cwrapper
cannam@162 9062 }
cannam@162 9063
cannam@162 9064 # Now, create the wrapper script for func_source use:
cannam@162 9065 func_ltwrapper_scriptname $cwrapper
cannam@162 9066 $RM $func_ltwrapper_scriptname_result
cannam@162 9067 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
cannam@162 9068 $opt_dry_run || {
cannam@162 9069 # note: this script will not be executed, so do not chmod.
cannam@162 9070 if test "x$build" = "x$host" ; then
cannam@162 9071 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
cannam@162 9072 else
cannam@162 9073 func_emit_wrapper no > $func_ltwrapper_scriptname_result
cannam@162 9074 fi
cannam@162 9075 }
cannam@162 9076 ;;
cannam@162 9077 * )
cannam@162 9078 $RM $output
cannam@162 9079 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
cannam@162 9080
cannam@162 9081 func_emit_wrapper no > $output
cannam@162 9082 chmod +x $output
cannam@162 9083 ;;
cannam@162 9084 esac
cannam@162 9085 }
cannam@162 9086 exit $EXIT_SUCCESS
cannam@162 9087 ;;
cannam@162 9088 esac
cannam@162 9089
cannam@162 9090 # See if we need to build an old-fashioned archive.
cannam@162 9091 for oldlib in $oldlibs; do
cannam@162 9092
cannam@162 9093 if test "$build_libtool_libs" = convenience; then
cannam@162 9094 oldobjs="$libobjs_save $symfileobj"
cannam@162 9095 addlibs="$convenience"
cannam@162 9096 build_libtool_libs=no
cannam@162 9097 else
cannam@162 9098 if test "$build_libtool_libs" = module; then
cannam@162 9099 oldobjs="$libobjs_save"
cannam@162 9100 build_libtool_libs=no
cannam@162 9101 else
cannam@162 9102 oldobjs="$old_deplibs $non_pic_objects"
cannam@162 9103 if test "$preload" = yes && test -f "$symfileobj"; then
cannam@162 9104 func_append oldobjs " $symfileobj"
cannam@162 9105 fi
cannam@162 9106 fi
cannam@162 9107 addlibs="$old_convenience"
cannam@162 9108 fi
cannam@162 9109
cannam@162 9110 if test -n "$addlibs"; then
cannam@162 9111 gentop="$output_objdir/${outputname}x"
cannam@162 9112 func_append generated " $gentop"
cannam@162 9113
cannam@162 9114 func_extract_archives $gentop $addlibs
cannam@162 9115 func_append oldobjs " $func_extract_archives_result"
cannam@162 9116 fi
cannam@162 9117
cannam@162 9118 # Do each command in the archive commands.
cannam@162 9119 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
cannam@162 9120 cmds=$old_archive_from_new_cmds
cannam@162 9121 else
cannam@162 9122
cannam@162 9123 # Add any objects from preloaded convenience libraries
cannam@162 9124 if test -n "$dlprefiles"; then
cannam@162 9125 gentop="$output_objdir/${outputname}x"
cannam@162 9126 func_append generated " $gentop"
cannam@162 9127
cannam@162 9128 func_extract_archives $gentop $dlprefiles
cannam@162 9129 func_append oldobjs " $func_extract_archives_result"
cannam@162 9130 fi
cannam@162 9131
cannam@162 9132 # POSIX demands no paths to be encoded in archives. We have
cannam@162 9133 # to avoid creating archives with duplicate basenames if we
cannam@162 9134 # might have to extract them afterwards, e.g., when creating a
cannam@162 9135 # static archive out of a convenience library, or when linking
cannam@162 9136 # the entirety of a libtool archive into another (currently
cannam@162 9137 # not supported by libtool).
cannam@162 9138 if (for obj in $oldobjs
cannam@162 9139 do
cannam@162 9140 func_basename "$obj"
cannam@162 9141 $ECHO "$func_basename_result"
cannam@162 9142 done | sort | sort -uc >/dev/null 2>&1); then
cannam@162 9143 :
cannam@162 9144 else
cannam@162 9145 echo "copying selected object files to avoid basename conflicts..."
cannam@162 9146 gentop="$output_objdir/${outputname}x"
cannam@162 9147 func_append generated " $gentop"
cannam@162 9148 func_mkdir_p "$gentop"
cannam@162 9149 save_oldobjs=$oldobjs
cannam@162 9150 oldobjs=
cannam@162 9151 counter=1
cannam@162 9152 for obj in $save_oldobjs
cannam@162 9153 do
cannam@162 9154 func_basename "$obj"
cannam@162 9155 objbase="$func_basename_result"
cannam@162 9156 case " $oldobjs " in
cannam@162 9157 " ") oldobjs=$obj ;;
cannam@162 9158 *[\ /]"$objbase "*)
cannam@162 9159 while :; do
cannam@162 9160 # Make sure we don't pick an alternate name that also
cannam@162 9161 # overlaps.
cannam@162 9162 newobj=lt$counter-$objbase
cannam@162 9163 func_arith $counter + 1
cannam@162 9164 counter=$func_arith_result
cannam@162 9165 case " $oldobjs " in
cannam@162 9166 *[\ /]"$newobj "*) ;;
cannam@162 9167 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
cannam@162 9168 esac
cannam@162 9169 done
cannam@162 9170 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
cannam@162 9171 func_append oldobjs " $gentop/$newobj"
cannam@162 9172 ;;
cannam@162 9173 *) func_append oldobjs " $obj" ;;
cannam@162 9174 esac
cannam@162 9175 done
cannam@162 9176 fi
cannam@162 9177 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
cannam@162 9178 tool_oldlib=$func_to_tool_file_result
cannam@162 9179 eval cmds=\"$old_archive_cmds\"
cannam@162 9180
cannam@162 9181 func_len " $cmds"
cannam@162 9182 len=$func_len_result
cannam@162 9183 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
cannam@162 9184 cmds=$old_archive_cmds
cannam@162 9185 elif test -n "$archiver_list_spec"; then
cannam@162 9186 func_verbose "using command file archive linking..."
cannam@162 9187 for obj in $oldobjs
cannam@162 9188 do
cannam@162 9189 func_to_tool_file "$obj"
cannam@162 9190 $ECHO "$func_to_tool_file_result"
cannam@162 9191 done > $output_objdir/$libname.libcmd
cannam@162 9192 func_to_tool_file "$output_objdir/$libname.libcmd"
cannam@162 9193 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
cannam@162 9194 cmds=$old_archive_cmds
cannam@162 9195 else
cannam@162 9196 # the command line is too long to link in one step, link in parts
cannam@162 9197 func_verbose "using piecewise archive linking..."
cannam@162 9198 save_RANLIB=$RANLIB
cannam@162 9199 RANLIB=:
cannam@162 9200 objlist=
cannam@162 9201 concat_cmds=
cannam@162 9202 save_oldobjs=$oldobjs
cannam@162 9203 oldobjs=
cannam@162 9204 # Is there a better way of finding the last object in the list?
cannam@162 9205 for obj in $save_oldobjs
cannam@162 9206 do
cannam@162 9207 last_oldobj=$obj
cannam@162 9208 done
cannam@162 9209 eval test_cmds=\"$old_archive_cmds\"
cannam@162 9210 func_len " $test_cmds"
cannam@162 9211 len0=$func_len_result
cannam@162 9212 len=$len0
cannam@162 9213 for obj in $save_oldobjs
cannam@162 9214 do
cannam@162 9215 func_len " $obj"
cannam@162 9216 func_arith $len + $func_len_result
cannam@162 9217 len=$func_arith_result
cannam@162 9218 func_append objlist " $obj"
cannam@162 9219 if test "$len" -lt "$max_cmd_len"; then
cannam@162 9220 :
cannam@162 9221 else
cannam@162 9222 # the above command should be used before it gets too long
cannam@162 9223 oldobjs=$objlist
cannam@162 9224 if test "$obj" = "$last_oldobj" ; then
cannam@162 9225 RANLIB=$save_RANLIB
cannam@162 9226 fi
cannam@162 9227 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
cannam@162 9228 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
cannam@162 9229 objlist=
cannam@162 9230 len=$len0
cannam@162 9231 fi
cannam@162 9232 done
cannam@162 9233 RANLIB=$save_RANLIB
cannam@162 9234 oldobjs=$objlist
cannam@162 9235 if test "X$oldobjs" = "X" ; then
cannam@162 9236 eval cmds=\"\$concat_cmds\"
cannam@162 9237 else
cannam@162 9238 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
cannam@162 9239 fi
cannam@162 9240 fi
cannam@162 9241 fi
cannam@162 9242 func_execute_cmds "$cmds" 'exit $?'
cannam@162 9243 done
cannam@162 9244
cannam@162 9245 test -n "$generated" && \
cannam@162 9246 func_show_eval "${RM}r$generated"
cannam@162 9247
cannam@162 9248 # Now create the libtool archive.
cannam@162 9249 case $output in
cannam@162 9250 *.la)
cannam@162 9251 old_library=
cannam@162 9252 test "$build_old_libs" = yes && old_library="$libname.$libext"
cannam@162 9253 func_verbose "creating $output"
cannam@162 9254
cannam@162 9255 # Preserve any variables that may affect compiler behavior
cannam@162 9256 for var in $variables_saved_for_relink; do
cannam@162 9257 if eval test -z \"\${$var+set}\"; then
cannam@162 9258 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
cannam@162 9259 elif eval var_value=\$$var; test -z "$var_value"; then
cannam@162 9260 relink_command="$var=; export $var; $relink_command"
cannam@162 9261 else
cannam@162 9262 func_quote_for_eval "$var_value"
cannam@162 9263 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
cannam@162 9264 fi
cannam@162 9265 done
cannam@162 9266 # Quote the link command for shipping.
cannam@162 9267 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
cannam@162 9268 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
cannam@162 9269 if test "$hardcode_automatic" = yes ; then
cannam@162 9270 relink_command=
cannam@162 9271 fi
cannam@162 9272
cannam@162 9273 # Only create the output if not a dry run.
cannam@162 9274 $opt_dry_run || {
cannam@162 9275 for installed in no yes; do
cannam@162 9276 if test "$installed" = yes; then
cannam@162 9277 if test -z "$install_libdir"; then
cannam@162 9278 break
cannam@162 9279 fi
cannam@162 9280 output="$output_objdir/$outputname"i
cannam@162 9281 # Replace all uninstalled libtool libraries with the installed ones
cannam@162 9282 newdependency_libs=
cannam@162 9283 for deplib in $dependency_libs; do
cannam@162 9284 case $deplib in
cannam@162 9285 *.la)
cannam@162 9286 func_basename "$deplib"
cannam@162 9287 name="$func_basename_result"
cannam@162 9288 func_resolve_sysroot "$deplib"
cannam@162 9289 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
cannam@162 9290 test -z "$libdir" && \
cannam@162 9291 func_fatal_error "\`$deplib' is not a valid libtool archive"
cannam@162 9292 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
cannam@162 9293 ;;
cannam@162 9294 -L*)
cannam@162 9295 func_stripname -L '' "$deplib"
cannam@162 9296 func_replace_sysroot "$func_stripname_result"
cannam@162 9297 func_append newdependency_libs " -L$func_replace_sysroot_result"
cannam@162 9298 ;;
cannam@162 9299 -R*)
cannam@162 9300 func_stripname -R '' "$deplib"
cannam@162 9301 func_replace_sysroot "$func_stripname_result"
cannam@162 9302 func_append newdependency_libs " -R$func_replace_sysroot_result"
cannam@162 9303 ;;
cannam@162 9304 *) func_append newdependency_libs " $deplib" ;;
cannam@162 9305 esac
cannam@162 9306 done
cannam@162 9307 dependency_libs="$newdependency_libs"
cannam@162 9308 newdlfiles=
cannam@162 9309
cannam@162 9310 for lib in $dlfiles; do
cannam@162 9311 case $lib in
cannam@162 9312 *.la)
cannam@162 9313 func_basename "$lib"
cannam@162 9314 name="$func_basename_result"
cannam@162 9315 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
cannam@162 9316 test -z "$libdir" && \
cannam@162 9317 func_fatal_error "\`$lib' is not a valid libtool archive"
cannam@162 9318 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
cannam@162 9319 ;;
cannam@162 9320 *) func_append newdlfiles " $lib" ;;
cannam@162 9321 esac
cannam@162 9322 done
cannam@162 9323 dlfiles="$newdlfiles"
cannam@162 9324 newdlprefiles=
cannam@162 9325 for lib in $dlprefiles; do
cannam@162 9326 case $lib in
cannam@162 9327 *.la)
cannam@162 9328 # Only pass preopened files to the pseudo-archive (for
cannam@162 9329 # eventual linking with the app. that links it) if we
cannam@162 9330 # didn't already link the preopened objects directly into
cannam@162 9331 # the library:
cannam@162 9332 func_basename "$lib"
cannam@162 9333 name="$func_basename_result"
cannam@162 9334 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
cannam@162 9335 test -z "$libdir" && \
cannam@162 9336 func_fatal_error "\`$lib' is not a valid libtool archive"
cannam@162 9337 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
cannam@162 9338 ;;
cannam@162 9339 esac
cannam@162 9340 done
cannam@162 9341 dlprefiles="$newdlprefiles"
cannam@162 9342 else
cannam@162 9343 newdlfiles=
cannam@162 9344 for lib in $dlfiles; do
cannam@162 9345 case $lib in
cannam@162 9346 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
cannam@162 9347 *) abs=`pwd`"/$lib" ;;
cannam@162 9348 esac
cannam@162 9349 func_append newdlfiles " $abs"
cannam@162 9350 done
cannam@162 9351 dlfiles="$newdlfiles"
cannam@162 9352 newdlprefiles=
cannam@162 9353 for lib in $dlprefiles; do
cannam@162 9354 case $lib in
cannam@162 9355 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
cannam@162 9356 *) abs=`pwd`"/$lib" ;;
cannam@162 9357 esac
cannam@162 9358 func_append newdlprefiles " $abs"
cannam@162 9359 done
cannam@162 9360 dlprefiles="$newdlprefiles"
cannam@162 9361 fi
cannam@162 9362 $RM $output
cannam@162 9363 # place dlname in correct position for cygwin
cannam@162 9364 # In fact, it would be nice if we could use this code for all target
cannam@162 9365 # systems that can't hard-code library paths into their executables
cannam@162 9366 # and that have no shared library path variable independent of PATH,
cannam@162 9367 # but it turns out we can't easily determine that from inspecting
cannam@162 9368 # libtool variables, so we have to hard-code the OSs to which it
cannam@162 9369 # applies here; at the moment, that means platforms that use the PE
cannam@162 9370 # object format with DLL files. See the long comment at the top of
cannam@162 9371 # tests/bindir.at for full details.
cannam@162 9372 tdlname=$dlname
cannam@162 9373 case $host,$output,$installed,$module,$dlname in
cannam@162 9374 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
cannam@162 9375 # If a -bindir argument was supplied, place the dll there.
cannam@162 9376 if test "x$bindir" != x ;
cannam@162 9377 then
cannam@162 9378 func_relative_path "$install_libdir" "$bindir"
cannam@162 9379 tdlname=$func_relative_path_result$dlname
cannam@162 9380 else
cannam@162 9381 # Otherwise fall back on heuristic.
cannam@162 9382 tdlname=../bin/$dlname
cannam@162 9383 fi
cannam@162 9384 ;;
cannam@162 9385 esac
cannam@162 9386 $ECHO > $output "\
cannam@162 9387 # $outputname - a libtool library file
cannam@162 9388 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
cannam@162 9389 #
cannam@162 9390 # Please DO NOT delete this file!
cannam@162 9391 # It is necessary for linking the library.
cannam@162 9392
cannam@162 9393 # The name that we can dlopen(3).
cannam@162 9394 dlname='$tdlname'
cannam@162 9395
cannam@162 9396 # Names of this library.
cannam@162 9397 library_names='$library_names'
cannam@162 9398
cannam@162 9399 # The name of the static archive.
cannam@162 9400 old_library='$old_library'
cannam@162 9401
cannam@162 9402 # Linker flags that can not go in dependency_libs.
cannam@162 9403 inherited_linker_flags='$new_inherited_linker_flags'
cannam@162 9404
cannam@162 9405 # Libraries that this one depends upon.
cannam@162 9406 dependency_libs='$dependency_libs'
cannam@162 9407
cannam@162 9408 # Names of additional weak libraries provided by this library
cannam@162 9409 weak_library_names='$weak_libs'
cannam@162 9410
cannam@162 9411 # Version information for $libname.
cannam@162 9412 current=$current
cannam@162 9413 age=$age
cannam@162 9414 revision=$revision
cannam@162 9415
cannam@162 9416 # Is this an already installed library?
cannam@162 9417 installed=$installed
cannam@162 9418
cannam@162 9419 # Should we warn about portability when linking against -modules?
cannam@162 9420 shouldnotlink=$module
cannam@162 9421
cannam@162 9422 # Files to dlopen/dlpreopen
cannam@162 9423 dlopen='$dlfiles'
cannam@162 9424 dlpreopen='$dlprefiles'
cannam@162 9425
cannam@162 9426 # Directory that this library needs to be installed in:
cannam@162 9427 libdir='$install_libdir'"
cannam@162 9428 if test "$installed" = no && test "$need_relink" = yes; then
cannam@162 9429 $ECHO >> $output "\
cannam@162 9430 relink_command=\"$relink_command\""
cannam@162 9431 fi
cannam@162 9432 done
cannam@162 9433 }
cannam@162 9434
cannam@162 9435 # Do a symbolic link so that the libtool archive can be found in
cannam@162 9436 # LD_LIBRARY_PATH before the program is installed.
cannam@162 9437 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
cannam@162 9438 ;;
cannam@162 9439 esac
cannam@162 9440 exit $EXIT_SUCCESS
cannam@162 9441 }
cannam@162 9442
cannam@162 9443 { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
cannam@162 9444 func_mode_link ${1+"$@"}
cannam@162 9445
cannam@162 9446
cannam@162 9447 # func_mode_uninstall arg...
cannam@162 9448 func_mode_uninstall ()
cannam@162 9449 {
cannam@162 9450 $opt_debug
cannam@162 9451 RM="$nonopt"
cannam@162 9452 files=
cannam@162 9453 rmforce=
cannam@162 9454 exit_status=0
cannam@162 9455
cannam@162 9456 # This variable tells wrapper scripts just to set variables rather
cannam@162 9457 # than running their programs.
cannam@162 9458 libtool_install_magic="$magic"
cannam@162 9459
cannam@162 9460 for arg
cannam@162 9461 do
cannam@162 9462 case $arg in
cannam@162 9463 -f) func_append RM " $arg"; rmforce=yes ;;
cannam@162 9464 -*) func_append RM " $arg" ;;
cannam@162 9465 *) func_append files " $arg" ;;
cannam@162 9466 esac
cannam@162 9467 done
cannam@162 9468
cannam@162 9469 test -z "$RM" && \
cannam@162 9470 func_fatal_help "you must specify an RM program"
cannam@162 9471
cannam@162 9472 rmdirs=
cannam@162 9473
cannam@162 9474 for file in $files; do
cannam@162 9475 func_dirname "$file" "" "."
cannam@162 9476 dir="$func_dirname_result"
cannam@162 9477 if test "X$dir" = X.; then
cannam@162 9478 odir="$objdir"
cannam@162 9479 else
cannam@162 9480 odir="$dir/$objdir"
cannam@162 9481 fi
cannam@162 9482 func_basename "$file"
cannam@162 9483 name="$func_basename_result"
cannam@162 9484 test "$opt_mode" = uninstall && odir="$dir"
cannam@162 9485
cannam@162 9486 # Remember odir for removal later, being careful to avoid duplicates
cannam@162 9487 if test "$opt_mode" = clean; then
cannam@162 9488 case " $rmdirs " in
cannam@162 9489 *" $odir "*) ;;
cannam@162 9490 *) func_append rmdirs " $odir" ;;
cannam@162 9491 esac
cannam@162 9492 fi
cannam@162 9493
cannam@162 9494 # Don't error if the file doesn't exist and rm -f was used.
cannam@162 9495 if { test -L "$file"; } >/dev/null 2>&1 ||
cannam@162 9496 { test -h "$file"; } >/dev/null 2>&1 ||
cannam@162 9497 test -f "$file"; then
cannam@162 9498 :
cannam@162 9499 elif test -d "$file"; then
cannam@162 9500 exit_status=1
cannam@162 9501 continue
cannam@162 9502 elif test "$rmforce" = yes; then
cannam@162 9503 continue
cannam@162 9504 fi
cannam@162 9505
cannam@162 9506 rmfiles="$file"
cannam@162 9507
cannam@162 9508 case $name in
cannam@162 9509 *.la)
cannam@162 9510 # Possibly a libtool archive, so verify it.
cannam@162 9511 if func_lalib_p "$file"; then
cannam@162 9512 func_source $dir/$name
cannam@162 9513
cannam@162 9514 # Delete the libtool libraries and symlinks.
cannam@162 9515 for n in $library_names; do
cannam@162 9516 func_append rmfiles " $odir/$n"
cannam@162 9517 done
cannam@162 9518 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
cannam@162 9519
cannam@162 9520 case "$opt_mode" in
cannam@162 9521 clean)
cannam@162 9522 case " $library_names " in
cannam@162 9523 *" $dlname "*) ;;
cannam@162 9524 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
cannam@162 9525 esac
cannam@162 9526 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
cannam@162 9527 ;;
cannam@162 9528 uninstall)
cannam@162 9529 if test -n "$library_names"; then
cannam@162 9530 # Do each command in the postuninstall commands.
cannam@162 9531 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
cannam@162 9532 fi
cannam@162 9533
cannam@162 9534 if test -n "$old_library"; then
cannam@162 9535 # Do each command in the old_postuninstall commands.
cannam@162 9536 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
cannam@162 9537 fi
cannam@162 9538 # FIXME: should reinstall the best remaining shared library.
cannam@162 9539 ;;
cannam@162 9540 esac
cannam@162 9541 fi
cannam@162 9542 ;;
cannam@162 9543
cannam@162 9544 *.lo)
cannam@162 9545 # Possibly a libtool object, so verify it.
cannam@162 9546 if func_lalib_p "$file"; then
cannam@162 9547
cannam@162 9548 # Read the .lo file
cannam@162 9549 func_source $dir/$name
cannam@162 9550
cannam@162 9551 # Add PIC object to the list of files to remove.
cannam@162 9552 if test -n "$pic_object" &&
cannam@162 9553 test "$pic_object" != none; then
cannam@162 9554 func_append rmfiles " $dir/$pic_object"
cannam@162 9555 fi
cannam@162 9556
cannam@162 9557 # Add non-PIC object to the list of files to remove.
cannam@162 9558 if test -n "$non_pic_object" &&
cannam@162 9559 test "$non_pic_object" != none; then
cannam@162 9560 func_append rmfiles " $dir/$non_pic_object"
cannam@162 9561 fi
cannam@162 9562 fi
cannam@162 9563 ;;
cannam@162 9564
cannam@162 9565 *)
cannam@162 9566 if test "$opt_mode" = clean ; then
cannam@162 9567 noexename=$name
cannam@162 9568 case $file in
cannam@162 9569 *.exe)
cannam@162 9570 func_stripname '' '.exe' "$file"
cannam@162 9571 file=$func_stripname_result
cannam@162 9572 func_stripname '' '.exe' "$name"
cannam@162 9573 noexename=$func_stripname_result
cannam@162 9574 # $file with .exe has already been added to rmfiles,
cannam@162 9575 # add $file without .exe
cannam@162 9576 func_append rmfiles " $file"
cannam@162 9577 ;;
cannam@162 9578 esac
cannam@162 9579 # Do a test to see if this is a libtool program.
cannam@162 9580 if func_ltwrapper_p "$file"; then
cannam@162 9581 if func_ltwrapper_executable_p "$file"; then
cannam@162 9582 func_ltwrapper_scriptname "$file"
cannam@162 9583 relink_command=
cannam@162 9584 func_source $func_ltwrapper_scriptname_result
cannam@162 9585 func_append rmfiles " $func_ltwrapper_scriptname_result"
cannam@162 9586 else
cannam@162 9587 relink_command=
cannam@162 9588 func_source $dir/$noexename
cannam@162 9589 fi
cannam@162 9590
cannam@162 9591 # note $name still contains .exe if it was in $file originally
cannam@162 9592 # as does the version of $file that was added into $rmfiles
cannam@162 9593 func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
cannam@162 9594 if test "$fast_install" = yes && test -n "$relink_command"; then
cannam@162 9595 func_append rmfiles " $odir/lt-$name"
cannam@162 9596 fi
cannam@162 9597 if test "X$noexename" != "X$name" ; then
cannam@162 9598 func_append rmfiles " $odir/lt-${noexename}.c"
cannam@162 9599 fi
cannam@162 9600 fi
cannam@162 9601 fi
cannam@162 9602 ;;
cannam@162 9603 esac
cannam@162 9604 func_show_eval "$RM $rmfiles" 'exit_status=1'
cannam@162 9605 done
cannam@162 9606
cannam@162 9607 # Try to remove the ${objdir}s in the directories where we deleted files
cannam@162 9608 for dir in $rmdirs; do
cannam@162 9609 if test -d "$dir"; then
cannam@162 9610 func_show_eval "rmdir $dir >/dev/null 2>&1"
cannam@162 9611 fi
cannam@162 9612 done
cannam@162 9613
cannam@162 9614 exit $exit_status
cannam@162 9615 }
cannam@162 9616
cannam@162 9617 { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
cannam@162 9618 func_mode_uninstall ${1+"$@"}
cannam@162 9619
cannam@162 9620 test -z "$opt_mode" && {
cannam@162 9621 help="$generic_help"
cannam@162 9622 func_fatal_help "you must specify a MODE"
cannam@162 9623 }
cannam@162 9624
cannam@162 9625 test -z "$exec_cmd" && \
cannam@162 9626 func_fatal_help "invalid operation mode \`$opt_mode'"
cannam@162 9627
cannam@162 9628 if test -n "$exec_cmd"; then
cannam@162 9629 eval exec "$exec_cmd"
cannam@162 9630 exit $EXIT_FAILURE
cannam@162 9631 fi
cannam@162 9632
cannam@162 9633 exit $exit_status
cannam@162 9634
cannam@162 9635
cannam@162 9636 # The TAGs below are defined such that we never get into a situation
cannam@162 9637 # in which we disable both kinds of libraries. Given conflicting
cannam@162 9638 # choices, we go for a static library, that is the most portable,
cannam@162 9639 # since we can't tell whether shared libraries were disabled because
cannam@162 9640 # the user asked for that or because the platform doesn't support
cannam@162 9641 # them. This is particularly important on AIX, because we don't
cannam@162 9642 # support having both static and shared libraries enabled at the same
cannam@162 9643 # time on that platform, so we default to a shared-only configuration.
cannam@162 9644 # If a disable-shared tag is given, we'll fallback to a static-only
cannam@162 9645 # configuration. But we'll never go from static-only to shared-only.
cannam@162 9646
cannam@162 9647 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
cannam@162 9648 build_libtool_libs=no
cannam@162 9649 build_old_libs=yes
cannam@162 9650 # ### END LIBTOOL TAG CONFIG: disable-shared
cannam@162 9651
cannam@162 9652 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
cannam@162 9653 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
cannam@162 9654 # ### END LIBTOOL TAG CONFIG: disable-static
cannam@162 9655
cannam@162 9656 # Local Variables:
cannam@162 9657 # mode:shell-script
cannam@162 9658 # sh-indentation:2
cannam@162 9659 # End:
cannam@162 9660 # vi:sw=2
cannam@162 9661