annotate ltmain.sh @ 35:a5574ec3991f

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