annotate ltmain.sh @ 1839:d8c260bcc1f9

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