PageRenderTime 622ms CodeModel.GetById 182ms app.highlight 65ms RepoModel.GetById 36ms app.codeStats 3ms

/ltmain.sh

http://github.com/fizx/parsley
Shell | 8406 lines | 6871 code | 602 blank | 933 comment | 827 complexity | 48b5058477ed2cc2a291a43751c7fbb1 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1# Generated from ltmain.m4sh.
   2
   3# ltmain.sh (GNU libtool) 2.2.6
   4# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
   5
   6# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
   7# This is free software; see the source for copying conditions.  There is NO
   8# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   9
  10# GNU Libtool is free software; you can redistribute it and/or modify
  11# it under the terms of the GNU General Public License as published by
  12# the Free Software Foundation; either version 2 of the License, or
  13# (at your option) any later version.
  14#
  15# As a special exception to the GNU General Public License,
  16# if you distribute this file as part of a program or library that
  17# is built using GNU Libtool, you may include this file under the
  18# same distribution terms that you use for the rest of that program.
  19#
  20# GNU Libtool is distributed in the hope that it will be useful, but
  21# WITHOUT ANY WARRANTY; without even the implied warranty of
  22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  23# General Public License for more details.
  24#
  25# You should have received a copy of the GNU General Public License
  26# along with GNU Libtool; see the file COPYING.  If not, a copy
  27# can be downloaded from http://www.gnu.org/licenses/gpl.html,
  28# or obtained by writing to the Free Software Foundation, Inc.,
  29# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  30
  31# Usage: $progname [OPTION]... [MODE-ARG]...
  32#
  33# Provide generalized library-building support services.
  34#
  35#     --config             show all configuration variables
  36#     --debug              enable verbose shell tracing
  37# -n, --dry-run            display commands without modifying any files
  38#     --features           display basic configuration information and exit
  39#     --mode=MODE          use operation mode MODE
  40#     --preserve-dup-deps  don't remove duplicate dependency libraries
  41#     --quiet, --silent    don't print informational messages
  42#     --tag=TAG            use configuration variables from tag TAG
  43# -v, --verbose            print informational messages (default)
  44#     --version            print version information
  45# -h, --help               print short or long help message
  46#
  47# MODE must be one of the following:
  48#
  49#       clean              remove files from the build directory
  50#       compile            compile a source file into a libtool object
  51#       execute            automatically set library path, then run a program
  52#       finish             complete the installation of libtool libraries
  53#       install            install libraries or executables
  54#       link               create a library or an executable
  55#       uninstall          remove libraries from an installed directory
  56#
  57# MODE-ARGS vary depending on the MODE.
  58# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
  59#
  60# When reporting a bug, please describe a test case to reproduce it and
  61# include the following information:
  62#
  63#       host-triplet:	$host
  64#       shell:		$SHELL
  65#       compiler:		$LTCC
  66#       compiler flags:		$LTCFLAGS
  67#       linker:		$LD (gnu? $with_gnu_ld)
  68#       $progname:		(GNU libtool) 2.2.6
  69#       automake:		$automake_version
  70#       autoconf:		$autoconf_version
  71#
  72# Report bugs to <bug-libtool@gnu.org>.
  73
  74PROGRAM=ltmain.sh
  75PACKAGE=libtool
  76VERSION=2.2.6
  77TIMESTAMP=""
  78package_revision=1.3012
  79
  80# Be Bourne compatible
  81if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  82  emulate sh
  83  NULLCMD=:
  84  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  85  # is contrary to our usage.  Disable this feature.
  86  alias -g '${1+"$@"}'='"$@"'
  87  setopt NO_GLOB_SUBST
  88else
  89  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
  90fi
  91BIN_SH=xpg4; export BIN_SH # for Tru64
  92DUALCASE=1; export DUALCASE # for MKS sh
  93
  94# NLS nuisances: We save the old values to restore during execute mode.
  95# Only set LANG and LC_ALL to C if already set.
  96# These must not be set unconditionally because not all systems understand
  97# e.g. LANG=C (notably SCO).
  98lt_user_locale=
  99lt_safe_locale=
 100for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 101do
 102  eval "if test \"\${$lt_var+set}\" = set; then
 103          save_$lt_var=\$$lt_var
 104          $lt_var=C
 105	  export $lt_var
 106	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
 107	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
 108	fi"
 109done
 110
 111$lt_unset CDPATH
 112
 113
 114
 115
 116
 117: ${CP="cp -f"}
 118: ${ECHO="echo"}
 119: ${EGREP="/usr/bin/grep -E"}
 120: ${FGREP="/usr/bin/grep -F"}
 121: ${GREP="/usr/bin/grep"}
 122: ${LN_S="ln -s"}
 123: ${MAKE="make"}
 124: ${MKDIR="mkdir"}
 125: ${MV="mv -f"}
 126: ${RM="rm -f"}
 127: ${SED="/opt/local/bin/gsed"}
 128: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 129: ${Xsed="$SED -e 1s/^X//"}
 130
 131# Global variables:
 132EXIT_SUCCESS=0
 133EXIT_FAILURE=1
 134EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
 135EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
 136
 137exit_status=$EXIT_SUCCESS
 138
 139# Make sure IFS has a sensible default
 140lt_nl='
 141'
 142IFS=" 	$lt_nl"
 143
 144dirname="s,/[^/]*$,,"
 145basename="s,^.*/,,"
 146
 147# func_dirname_and_basename file append nondir_replacement
 148# perform func_basename and func_dirname in a single function
 149# call:
 150#   dirname:  Compute the dirname of FILE.  If nonempty,
 151#             add APPEND to the result, otherwise set result
 152#             to NONDIR_REPLACEMENT.
 153#             value returned in "$func_dirname_result"
 154#   basename: Compute filename of FILE.
 155#             value retuned in "$func_basename_result"
 156# Implementation must be kept synchronized with func_dirname
 157# and func_basename. For efficiency, we do not delegate to
 158# those functions but instead duplicate the functionality here.
 159func_dirname_and_basename ()
 160{
 161  # Extract subdirectory from the argument.
 162  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
 163  if test "X$func_dirname_result" = "X${1}"; then
 164    func_dirname_result="${3}"
 165  else
 166    func_dirname_result="$func_dirname_result${2}"
 167  fi
 168  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
 169}
 170
 171# Generated shell functions inserted here.
 172
 173# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
 174# is ksh but when the shell is invoked as "sh" and the current value of
 175# the _XPG environment variable is not equal to 1 (one), the special
 176# positional parameter $0, within a function call, is the name of the
 177# function.
 178progpath="$0"
 179
 180# The name of this program:
 181# In the unlikely event $progname began with a '-', it would play havoc with
 182# func_echo (imagine progname=-n), so we prepend ./ in that case:
 183func_dirname_and_basename "$progpath"
 184progname=$func_basename_result
 185case $progname in
 186  -*) progname=./$progname ;;
 187esac
 188
 189# Make sure we have an absolute path for reexecution:
 190case $progpath in
 191  [\\/]*|[A-Za-z]:\\*) ;;
 192  *[\\/]*)
 193     progdir=$func_dirname_result
 194     progdir=`cd "$progdir" && pwd`
 195     progpath="$progdir/$progname"
 196     ;;
 197  *)
 198     save_IFS="$IFS"
 199     IFS=:
 200     for progdir in $PATH; do
 201       IFS="$save_IFS"
 202       test -x "$progdir/$progname" && break
 203     done
 204     IFS="$save_IFS"
 205     test -n "$progdir" || progdir=`pwd`
 206     progpath="$progdir/$progname"
 207     ;;
 208esac
 209
 210# Sed substitution that helps us do robust quoting.  It backslashifies
 211# metacharacters that are still active within double-quoted strings.
 212Xsed="${SED}"' -e 1s/^X//'
 213sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
 214
 215# Same as above, but do not quote variable references.
 216double_quote_subst='s/\(["`\\]\)/\\\1/g'
 217
 218# Re-`\' parameter expansions in output of double_quote_subst that were
 219# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
 220# in input to double_quote_subst, that '$' was protected from expansion.
 221# Since each input `\' is now two `\'s, look for any number of runs of
 222# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
 223bs='\\'
 224bs2='\\\\'
 225bs4='\\\\\\\\'
 226dollar='\$'
 227sed_double_backslash="\
 228  s/$bs4/&\\
 229/g
 230  s/^$bs2$dollar/$bs&/
 231  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
 232  s/\n//g"
 233
 234# Standard options:
 235opt_dry_run=false
 236opt_help=false
 237opt_quiet=false
 238opt_verbose=false
 239opt_warning=:
 240
 241# func_echo arg...
 242# Echo program name prefixed message, along with the current mode
 243# name if it has been set yet.
 244func_echo ()
 245{
 246    $ECHO "$progname${mode+: }$mode: $*"
 247}
 248
 249# func_verbose arg...
 250# Echo program name prefixed message in verbose mode only.
 251func_verbose ()
 252{
 253    $opt_verbose && func_echo ${1+"$@"}
 254
 255    # A bug in bash halts the script if the last line of a function
 256    # fails when set -e is in force, so we need another command to
 257    # work around that:
 258    :
 259}
 260
 261# func_error arg...
 262# Echo program name prefixed message to standard error.
 263func_error ()
 264{
 265    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
 266}
 267
 268# func_warning arg...
 269# Echo program name prefixed warning message to standard error.
 270func_warning ()
 271{
 272    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
 273
 274    # bash bug again:
 275    :
 276}
 277
 278# func_fatal_error arg...
 279# Echo program name prefixed message to standard error, and exit.
 280func_fatal_error ()
 281{
 282    func_error ${1+"$@"}
 283    exit $EXIT_FAILURE
 284}
 285
 286# func_fatal_help arg...
 287# Echo program name prefixed message to standard error, followed by
 288# a help hint, and exit.
 289func_fatal_help ()
 290{
 291    func_error ${1+"$@"}
 292    func_fatal_error "$help"
 293}
 294help="Try \`$progname --help' for more information."  ## default
 295
 296
 297# func_grep expression filename
 298# Check whether EXPRESSION matches any line of FILENAME, without output.
 299func_grep ()
 300{
 301    $GREP "$1" "$2" >/dev/null 2>&1
 302}
 303
 304
 305# func_mkdir_p directory-path
 306# Make sure the entire path to DIRECTORY-PATH is available.
 307func_mkdir_p ()
 308{
 309    my_directory_path="$1"
 310    my_dir_list=
 311
 312    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
 313
 314      # Protect directory names starting with `-'
 315      case $my_directory_path in
 316        -*) my_directory_path="./$my_directory_path" ;;
 317      esac
 318
 319      # While some portion of DIR does not yet exist...
 320      while test ! -d "$my_directory_path"; do
 321        # ...make a list in topmost first order.  Use a colon delimited
 322	# list incase some portion of path contains whitespace.
 323        my_dir_list="$my_directory_path:$my_dir_list"
 324
 325        # If the last portion added has no slash in it, the list is done
 326        case $my_directory_path in */*) ;; *) break ;; esac
 327
 328        # ...otherwise throw away the child directory and loop
 329        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
 330      done
 331      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
 332
 333      save_mkdir_p_IFS="$IFS"; IFS=':'
 334      for my_dir in $my_dir_list; do
 335	IFS="$save_mkdir_p_IFS"
 336        # mkdir can fail with a `File exist' error if two processes
 337        # try to create one of the directories concurrently.  Don't
 338        # stop in that case!
 339        $MKDIR "$my_dir" 2>/dev/null || :
 340      done
 341      IFS="$save_mkdir_p_IFS"
 342
 343      # Bail out if we (or some other process) failed to create a directory.
 344      test -d "$my_directory_path" || \
 345        func_fatal_error "Failed to create \`$1'"
 346    fi
 347}
 348
 349
 350# func_mktempdir [string]
 351# Make a temporary directory that won't clash with other running
 352# libtool processes, and avoids race conditions if possible.  If
 353# given, STRING is the basename for that directory.
 354func_mktempdir ()
 355{
 356    my_template="${TMPDIR-/tmp}/${1-$progname}"
 357
 358    if test "$opt_dry_run" = ":"; then
 359      # Return a directory name, but don't create it in dry-run mode
 360      my_tmpdir="${my_template}-$$"
 361    else
 362
 363      # If mktemp works, use that first and foremost
 364      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
 365
 366      if test ! -d "$my_tmpdir"; then
 367        # Failing that, at least try and use $RANDOM to avoid a race
 368        my_tmpdir="${my_template}-${RANDOM-0}$$"
 369
 370        save_mktempdir_umask=`umask`
 371        umask 0077
 372        $MKDIR "$my_tmpdir"
 373        umask $save_mktempdir_umask
 374      fi
 375
 376      # If we're not in dry-run mode, bomb out on failure
 377      test -d "$my_tmpdir" || \
 378        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
 379    fi
 380
 381    $ECHO "X$my_tmpdir" | $Xsed
 382}
 383
 384
 385# func_quote_for_eval arg
 386# Aesthetically quote ARG to be evaled later.
 387# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
 388# is double-quoted, suitable for a subsequent eval, whereas
 389# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
 390# which are still active within double quotes backslashified.
 391func_quote_for_eval ()
 392{
 393    case $1 in
 394      *[\\\`\"\$]*)
 395	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
 396      *)
 397        func_quote_for_eval_unquoted_result="$1" ;;
 398    esac
 399
 400    case $func_quote_for_eval_unquoted_result in
 401      # Double-quote args containing shell metacharacters to delay
 402      # word splitting, command substitution and and variable
 403      # expansion for a subsequent eval.
 404      # Many Bourne shells cannot handle close brackets correctly
 405      # in scan sets, so we specify it separately.
 406      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
 407        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
 408        ;;
 409      *)
 410        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
 411    esac
 412}
 413
 414
 415# func_quote_for_expand arg
 416# Aesthetically quote ARG to be evaled later; same as above,
 417# but do not quote variable references.
 418func_quote_for_expand ()
 419{
 420    case $1 in
 421      *[\\\`\"]*)
 422	my_arg=`$ECHO "X$1" | $Xsed \
 423	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
 424      *)
 425        my_arg="$1" ;;
 426    esac
 427
 428    case $my_arg in
 429      # Double-quote args containing shell metacharacters to delay
 430      # word splitting and command substitution for a subsequent eval.
 431      # Many Bourne shells cannot handle close brackets correctly
 432      # in scan sets, so we specify it separately.
 433      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
 434        my_arg="\"$my_arg\""
 435        ;;
 436    esac
 437
 438    func_quote_for_expand_result="$my_arg"
 439}
 440
 441
 442# func_show_eval cmd [fail_exp]
 443# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
 444# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
 445# is given, then evaluate it.
 446func_show_eval ()
 447{
 448    my_cmd="$1"
 449    my_fail_exp="${2-:}"
 450
 451    ${opt_silent-false} || {
 452      func_quote_for_expand "$my_cmd"
 453      eval "func_echo $func_quote_for_expand_result"
 454    }
 455
 456    if ${opt_dry_run-false}; then :; else
 457      eval "$my_cmd"
 458      my_status=$?
 459      if test "$my_status" -eq 0; then :; else
 460	eval "(exit $my_status); $my_fail_exp"
 461      fi
 462    fi
 463}
 464
 465
 466# func_show_eval_locale cmd [fail_exp]
 467# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
 468# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
 469# is given, then evaluate it.  Use the saved locale for evaluation.
 470func_show_eval_locale ()
 471{
 472    my_cmd="$1"
 473    my_fail_exp="${2-:}"
 474
 475    ${opt_silent-false} || {
 476      func_quote_for_expand "$my_cmd"
 477      eval "func_echo $func_quote_for_expand_result"
 478    }
 479
 480    if ${opt_dry_run-false}; then :; else
 481      eval "$lt_user_locale
 482	    $my_cmd"
 483      my_status=$?
 484      eval "$lt_safe_locale"
 485      if test "$my_status" -eq 0; then :; else
 486	eval "(exit $my_status); $my_fail_exp"
 487      fi
 488    fi
 489}
 490
 491
 492
 493
 494
 495# func_version
 496# Echo version message to standard output and exit.
 497func_version ()
 498{
 499    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
 500        s/^# //
 501	s/^# *$//
 502        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
 503        p
 504     }' < "$progpath"
 505     exit $?
 506}
 507
 508# func_usage
 509# Echo short help message to standard output and exit.
 510func_usage ()
 511{
 512    $SED -n '/^# Usage:/,/# -h/ {
 513        s/^# //
 514	s/^# *$//
 515	s/\$progname/'$progname'/
 516	p
 517    }' < "$progpath"
 518    $ECHO
 519    $ECHO "run \`$progname --help | more' for full usage"
 520    exit $?
 521}
 522
 523# func_help
 524# Echo long help message to standard output and exit.
 525func_help ()
 526{
 527    $SED -n '/^# Usage:/,/# Report bugs to/ {
 528        s/^# //
 529	s/^# *$//
 530	s*\$progname*'$progname'*
 531	s*\$host*'"$host"'*
 532	s*\$SHELL*'"$SHELL"'*
 533	s*\$LTCC*'"$LTCC"'*
 534	s*\$LTCFLAGS*'"$LTCFLAGS"'*
 535	s*\$LD*'"$LD"'*
 536	s/\$with_gnu_ld/'"$with_gnu_ld"'/
 537	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
 538	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
 539	p
 540     }' < "$progpath"
 541    exit $?
 542}
 543
 544# func_missing_arg argname
 545# Echo program name prefixed message to standard error and set global
 546# exit_cmd.
 547func_missing_arg ()
 548{
 549    func_error "missing argument for $1"
 550    exit_cmd=exit
 551}
 552
 553exit_cmd=:
 554
 555
 556
 557
 558
 559# Check that we have a working $ECHO.
 560if test "X$1" = X--no-reexec; then
 561  # Discard the --no-reexec flag, and continue.
 562  shift
 563elif test "X$1" = X--fallback-echo; then
 564  # Avoid inline document here, it may be left over
 565  :
 566elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
 567  # Yippee, $ECHO works!
 568  :
 569else
 570  # Restart under the correct shell, and then maybe $ECHO will work.
 571  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
 572fi
 573
 574if test "X$1" = X--fallback-echo; then
 575  # used as fallback echo
 576  shift
 577  cat <<EOF
 578$*
 579EOF
 580  exit $EXIT_SUCCESS
 581fi
 582
 583magic="%%%MAGIC variable%%%"
 584magic_exe="%%%MAGIC EXE variable%%%"
 585
 586# Global variables.
 587# $mode is unset
 588nonopt=
 589execute_dlfiles=
 590preserve_args=
 591lo2o="s/\\.lo\$/.${objext}/"
 592o2lo="s/\\.${objext}\$/.lo/"
 593extracted_archives=
 594extracted_serial=0
 595
 596opt_dry_run=false
 597opt_duplicate_deps=false
 598opt_silent=false
 599opt_debug=:
 600
 601# If this variable is set in any of the actions, the command in it
 602# will be execed at the end.  This prevents here-documents from being
 603# left over by shells.
 604exec_cmd=
 605
 606# func_fatal_configuration arg...
 607# Echo program name prefixed message to standard error, followed by
 608# a configuration failure hint, and exit.
 609func_fatal_configuration ()
 610{
 611    func_error ${1+"$@"}
 612    func_error "See the $PACKAGE documentation for more information."
 613    func_fatal_error "Fatal configuration error."
 614}
 615
 616
 617# func_config
 618# Display the configuration for all the tags in this script.
 619func_config ()
 620{
 621    re_begincf='^# ### BEGIN LIBTOOL'
 622    re_endcf='^# ### END LIBTOOL'
 623
 624    # Default configuration.
 625    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
 626
 627    # Now print the configurations for the tags.
 628    for tagname in $taglist; do
 629      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
 630    done
 631
 632    exit $?
 633}
 634
 635# func_features
 636# Display the features supported by this script.
 637func_features ()
 638{
 639    $ECHO "host: $host"
 640    if test "$build_libtool_libs" = yes; then
 641      $ECHO "enable shared libraries"
 642    else
 643      $ECHO "disable shared libraries"
 644    fi
 645    if test "$build_old_libs" = yes; then
 646      $ECHO "enable static libraries"
 647    else
 648      $ECHO "disable static libraries"
 649    fi
 650
 651    exit $?
 652}
 653
 654# func_enable_tag tagname
 655# Verify that TAGNAME is valid, and either flag an error and exit, or
 656# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
 657# variable here.
 658func_enable_tag ()
 659{
 660  # Global variable:
 661  tagname="$1"
 662
 663  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
 664  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
 665  sed_extractcf="/$re_begincf/,/$re_endcf/p"
 666
 667  # Validate tagname.
 668  case $tagname in
 669    *[!-_A-Za-z0-9,/]*)
 670      func_fatal_error "invalid tag name: $tagname"
 671      ;;
 672  esac
 673
 674  # Don't test for the "default" C tag, as we know it's
 675  # there but not specially marked.
 676  case $tagname in
 677    CC) ;;
 678    *)
 679      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
 680	taglist="$taglist $tagname"
 681
 682	# Evaluate the configuration.  Be careful to quote the path
 683	# and the sed script, to avoid splitting on whitespace, but
 684	# also don't use non-portable quotes within backquotes within
 685	# quotes we have to do it in 2 steps:
 686	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
 687	eval "$extractedcf"
 688      else
 689	func_error "ignoring unknown tag $tagname"
 690      fi
 691      ;;
 692  esac
 693}
 694
 695# Parse options once, thoroughly.  This comes as soon as possible in
 696# the script to make things like `libtool --version' happen quickly.
 697{
 698
 699  # Shorthand for --mode=foo, only valid as the first argument
 700  case $1 in
 701  clean|clea|cle|cl)
 702    shift; set dummy --mode clean ${1+"$@"}; shift
 703    ;;
 704  compile|compil|compi|comp|com|co|c)
 705    shift; set dummy --mode compile ${1+"$@"}; shift
 706    ;;
 707  execute|execut|execu|exec|exe|ex|e)
 708    shift; set dummy --mode execute ${1+"$@"}; shift
 709    ;;
 710  finish|finis|fini|fin|fi|f)
 711    shift; set dummy --mode finish ${1+"$@"}; shift
 712    ;;
 713  install|instal|insta|inst|ins|in|i)
 714    shift; set dummy --mode install ${1+"$@"}; shift
 715    ;;
 716  link|lin|li|l)
 717    shift; set dummy --mode link ${1+"$@"}; shift
 718    ;;
 719  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
 720    shift; set dummy --mode uninstall ${1+"$@"}; shift
 721    ;;
 722  esac
 723
 724  # Parse non-mode specific arguments:
 725  while test "$#" -gt 0; do
 726    opt="$1"
 727    shift
 728
 729    case $opt in
 730      --config)		func_config					;;
 731
 732      --debug)		preserve_args="$preserve_args $opt"
 733			func_echo "enabling shell trace mode"
 734			opt_debug='set -x'
 735			$opt_debug
 736			;;
 737
 738      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
 739			execute_dlfiles="$execute_dlfiles $1"
 740			shift
 741			;;
 742
 743      --dry-run | -n)	opt_dry_run=:					;;
 744      --features)       func_features					;;
 745      --finish)		mode="finish"					;;
 746
 747      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
 748			case $1 in
 749			  # Valid mode arguments:
 750			  clean)	;;
 751			  compile)	;;
 752			  execute)	;;
 753			  finish)	;;
 754			  install)	;;
 755			  link)		;;
 756			  relink)	;;
 757			  uninstall)	;;
 758
 759			  # Catch anything else as an error
 760			  *) func_error "invalid argument for $opt"
 761			     exit_cmd=exit
 762			     break
 763			     ;;
 764		        esac
 765
 766			mode="$1"
 767			shift
 768			;;
 769
 770      --preserve-dup-deps)
 771			opt_duplicate_deps=:				;;
 772
 773      --quiet|--silent)	preserve_args="$preserve_args $opt"
 774			opt_silent=:
 775			;;
 776
 777      --verbose| -v)	preserve_args="$preserve_args $opt"
 778			opt_silent=false
 779			;;
 780
 781      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
 782			preserve_args="$preserve_args $opt $1"
 783			func_enable_tag "$1"	# tagname is set here
 784			shift
 785			;;
 786
 787      # Separate optargs to long options:
 788      -dlopen=*|--mode=*|--tag=*)
 789			func_opt_split "$opt"
 790			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
 791			shift
 792			;;
 793
 794      -\?|-h)		func_usage					;;
 795      --help)		opt_help=:					;;
 796      --version)	func_version					;;
 797
 798      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
 799
 800      *)		nonopt="$opt"
 801			break
 802			;;
 803    esac
 804  done
 805
 806
 807  case $host in
 808    *cygwin* | *mingw* | *pw32* | *cegcc*)
 809      # don't eliminate duplications in $postdeps and $predeps
 810      opt_duplicate_compiler_generated_deps=:
 811      ;;
 812    *)
 813      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
 814      ;;
 815  esac
 816
 817  # Having warned about all mis-specified options, bail out if
 818  # anything was wrong.
 819  $exit_cmd $EXIT_FAILURE
 820}
 821
 822# func_check_version_match
 823# Ensure that we are using m4 macros, and libtool script from the same
 824# release of libtool.
 825func_check_version_match ()
 826{
 827  if test "$package_revision" != "$macro_revision"; then
 828    if test "$VERSION" != "$macro_version"; then
 829      if test -z "$macro_version"; then
 830        cat >&2 <<_LT_EOF
 831$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
 832$progname: definition of this LT_INIT comes from an older release.
 833$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
 834$progname: and run autoconf again.
 835_LT_EOF
 836      else
 837        cat >&2 <<_LT_EOF
 838$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
 839$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
 840$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
 841$progname: and run autoconf again.
 842_LT_EOF
 843      fi
 844    else
 845      cat >&2 <<_LT_EOF
 846$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
 847$progname: but the definition of this LT_INIT comes from revision $macro_revision.
 848$progname: You should recreate aclocal.m4 with macros from revision $package_revision
 849$progname: of $PACKAGE $VERSION and run autoconf again.
 850_LT_EOF
 851    fi
 852
 853    exit $EXIT_MISMATCH
 854  fi
 855}
 856
 857
 858## ----------- ##
 859##    Main.    ##
 860## ----------- ##
 861
 862$opt_help || {
 863  # Sanity checks first:
 864  func_check_version_match
 865
 866  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
 867    func_fatal_configuration "not configured to build any kind of library"
 868  fi
 869
 870  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
 871
 872
 873  # Darwin sucks
 874  eval std_shrext=\"$shrext_cmds\"
 875
 876
 877  # Only execute mode is allowed to have -dlopen flags.
 878  if test -n "$execute_dlfiles" && test "$mode" != execute; then
 879    func_error "unrecognized option \`-dlopen'"
 880    $ECHO "$help" 1>&2
 881    exit $EXIT_FAILURE
 882  fi
 883
 884  # Change the help message to a mode-specific one.
 885  generic_help="$help"
 886  help="Try \`$progname --help --mode=$mode' for more information."
 887}
 888
 889
 890# func_lalib_p file
 891# True iff FILE is a libtool `.la' library or `.lo' object file.
 892# This function is only a basic sanity check; it will hardly flush out
 893# determined imposters.
 894func_lalib_p ()
 895{
 896    test -f "$1" &&
 897      $SED -e 4q "$1" 2>/dev/null \
 898        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
 899}
 900
 901# func_lalib_unsafe_p file
 902# True iff FILE is a libtool `.la' library or `.lo' object file.
 903# This function implements the same check as func_lalib_p without
 904# resorting to external programs.  To this end, it redirects stdin and
 905# closes it afterwards, without saving the original file descriptor.
 906# As a safety measure, use it only where a negative result would be
 907# fatal anyway.  Works if `file' does not exist.
 908func_lalib_unsafe_p ()
 909{
 910    lalib_p=no
 911    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
 912	for lalib_p_l in 1 2 3 4
 913	do
 914	    read lalib_p_line
 915	    case "$lalib_p_line" in
 916		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
 917	    esac
 918	done
 919	exec 0<&5 5<&-
 920    fi
 921    test "$lalib_p" = yes
 922}
 923
 924# func_ltwrapper_script_p file
 925# True iff FILE is a libtool wrapper script
 926# This function is only a basic sanity check; it will hardly flush out
 927# determined imposters.
 928func_ltwrapper_script_p ()
 929{
 930    func_lalib_p "$1"
 931}
 932
 933# func_ltwrapper_executable_p file
 934# True iff FILE is a libtool wrapper executable
 935# This function is only a basic sanity check; it will hardly flush out
 936# determined imposters.
 937func_ltwrapper_executable_p ()
 938{
 939    func_ltwrapper_exec_suffix=
 940    case $1 in
 941    *.exe) ;;
 942    *) func_ltwrapper_exec_suffix=.exe ;;
 943    esac
 944    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
 945}
 946
 947# func_ltwrapper_scriptname file
 948# Assumes file is an ltwrapper_executable
 949# uses $file to determine the appropriate filename for a
 950# temporary ltwrapper_script.
 951func_ltwrapper_scriptname ()
 952{
 953    func_ltwrapper_scriptname_result=""
 954    if func_ltwrapper_executable_p "$1"; then
 955	func_dirname_and_basename "$1" "" "."
 956	func_stripname '' '.exe' "$func_basename_result"
 957	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
 958    fi
 959}
 960
 961# func_ltwrapper_p file
 962# True iff FILE is a libtool wrapper script or wrapper executable
 963# This function is only a basic sanity check; it will hardly flush out
 964# determined imposters.
 965func_ltwrapper_p ()
 966{
 967    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
 968}
 969
 970
 971# func_execute_cmds commands fail_cmd
 972# Execute tilde-delimited COMMANDS.
 973# If FAIL_CMD is given, eval that upon failure.
 974# FAIL_CMD may read-access the current command in variable CMD!
 975func_execute_cmds ()
 976{
 977    $opt_debug
 978    save_ifs=$IFS; IFS='~'
 979    for cmd in $1; do
 980      IFS=$save_ifs
 981      eval cmd=\"$cmd\"
 982      func_show_eval "$cmd" "${2-:}"
 983    done
 984    IFS=$save_ifs
 985}
 986
 987
 988# func_source file
 989# Source FILE, adding directory component if necessary.
 990# Note that it is not necessary on cygwin/mingw to append a dot to
 991# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
 992# behavior happens only for exec(3), not for open(2)!  Also, sourcing
 993# `FILE.' does not work on cygwin managed mounts.
 994func_source ()
 995{
 996    $opt_debug
 997    case $1 in
 998    */* | *\\*)	. "$1" ;;
 999    *)		. "./$1" ;;
1000    esac
1001}
1002
1003
1004# func_infer_tag arg
1005# Infer tagged configuration to use if any are available and
1006# if one wasn't chosen via the "--tag" command line option.
1007# Only attempt this if the compiler in the base compile
1008# command doesn't match the default compiler.
1009# arg is usually of the form 'gcc ...'
1010func_infer_tag ()
1011{
1012    $opt_debug
1013    if test -n "$available_tags" && test -z "$tagname"; then
1014      CC_quoted=
1015      for arg in $CC; do
1016        func_quote_for_eval "$arg"
1017	CC_quoted="$CC_quoted $func_quote_for_eval_result"
1018      done
1019      case $@ in
1020      # Blanks in the command may have been stripped by the calling shell,
1021      # but not from the CC environment variable when configure was run.
1022      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1023      # Blanks at the start of $base_compile will cause this to fail
1024      # if we don't check for them as well.
1025      *)
1026	for z in $available_tags; do
1027	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1028	    # Evaluate the configuration.
1029	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1030	    CC_quoted=
1031	    for arg in $CC; do
1032	      # Double-quote args containing other shell metacharacters.
1033	      func_quote_for_eval "$arg"
1034	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
1035	    done
1036	    case "$@ " in
1037	      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1038	      # The compiler in the base compile command matches
1039	      # the one in the tagged configuration.
1040	      # Assume this is the tagged configuration we want.
1041	      tagname=$z
1042	      break
1043	      ;;
1044	    esac
1045	  fi
1046	done
1047	# If $tagname still isn't set, then no tagged configuration
1048	# was found and let the user know that the "--tag" command
1049	# line option must be used.
1050	if test -z "$tagname"; then
1051	  func_echo "unable to infer tagged configuration"
1052	  func_fatal_error "specify a tag with \`--tag'"
1053#	else
1054#	  func_verbose "using $tagname tagged configuration"
1055	fi
1056	;;
1057      esac
1058    fi
1059}
1060
1061
1062
1063# func_write_libtool_object output_name pic_name nonpic_name
1064# Create a libtool object file (analogous to a ".la" file),
1065# but don't create it if we're doing a dry run.
1066func_write_libtool_object ()
1067{
1068    write_libobj=${1}
1069    if test "$build_libtool_libs" = yes; then
1070      write_lobj=\'${2}\'
1071    else
1072      write_lobj=none
1073    fi
1074
1075    if test "$build_old_libs" = yes; then
1076      write_oldobj=\'${3}\'
1077    else
1078      write_oldobj=none
1079    fi
1080
1081    $opt_dry_run || {
1082      cat >${write_libobj}T <<EOF
1083# $write_libobj - a libtool object file
1084# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1085#
1086# Please DO NOT delete this file!
1087# It is necessary for linking the library.
1088
1089# Name of the PIC object.
1090pic_object=$write_lobj
1091
1092# Name of the non-PIC object
1093non_pic_object=$write_oldobj
1094
1095EOF
1096      $MV "${write_libobj}T" "${write_libobj}"
1097    }
1098}
1099
1100# func_mode_compile arg...
1101func_mode_compile ()
1102{
1103    $opt_debug
1104    # Get the compilation command and the source file.
1105    base_compile=
1106    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
1107    suppress_opt=yes
1108    suppress_output=
1109    arg_mode=normal
1110    libobj=
1111    later=
1112    pie_flag=
1113
1114    for arg
1115    do
1116      case $arg_mode in
1117      arg  )
1118	# do not "continue".  Instead, add this to base_compile
1119	lastarg="$arg"
1120	arg_mode=normal
1121	;;
1122
1123      target )
1124	libobj="$arg"
1125	arg_mode=normal
1126	continue
1127	;;
1128
1129      normal )
1130	# Accept any command-line options.
1131	case $arg in
1132	-o)
1133	  test -n "$libobj" && \
1134	    func_fatal_error "you cannot specify \`-o' more than once"
1135	  arg_mode=target
1136	  continue
1137	  ;;
1138
1139	-pie | -fpie | -fPIE)
1140          pie_flag="$pie_flag $arg"
1141	  continue
1142	  ;;
1143
1144	-shared | -static | -prefer-pic | -prefer-non-pic)
1145	  later="$later $arg"
1146	  continue
1147	  ;;
1148
1149	-no-suppress)
1150	  suppress_opt=no
1151	  continue
1152	  ;;
1153
1154	-Xcompiler)
1155	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
1156	  continue      #  The current "srcfile" will either be retained or
1157	  ;;            #  replaced later.  I would guess that would be a bug.
1158
1159	-Wc,*)
1160	  func_stripname '-Wc,' '' "$arg"
1161	  args=$func_stripname_result
1162	  lastarg=
1163	  save_ifs="$IFS"; IFS=','
1164	  for arg in $args; do
1165	    IFS="$save_ifs"
1166	    func_quote_for_eval "$arg"
1167	    lastarg="$lastarg $func_quote_for_eval_result"
1168	  done
1169	  IFS="$save_ifs"
1170	  func_stripname ' ' '' "$lastarg"
1171	  lastarg=$func_stripname_result
1172
1173	  # Add the arguments to base_compile.
1174	  base_compile="$base_compile $lastarg"
1175	  continue
1176	  ;;
1177
1178	*)
1179	  # Accept the current argument as the source file.
1180	  # The previous "srcfile" becomes the current argument.
1181	  #
1182	  lastarg="$srcfile"
1183	  srcfile="$arg"
1184	  ;;
1185	esac  #  case $arg
1186	;;
1187      esac    #  case $arg_mode
1188
1189      # Aesthetically quote the previous argument.
1190      func_quote_for_eval "$lastarg"
1191      base_compile="$base_compile $func_quote_for_eval_result"
1192    done # for arg
1193
1194    case $arg_mode in
1195    arg)
1196      func_fatal_error "you must specify an argument for -Xcompile"
1197      ;;
1198    target)
1199      func_fatal_error "you must specify a target with \`-o'"
1200      ;;
1201    *)
1202      # Get the name of the library object.
1203      test -z "$libobj" && {
1204	func_basename "$srcfile"
1205	libobj="$func_basename_result"
1206      }
1207      ;;
1208    esac
1209
1210    # Recognize several different file suffixes.
1211    # If the user specifies -o file.o, it is replaced with file.lo
1212    case $libobj in
1213    *.[cCFSifmso] | \
1214    *.ada | *.adb | *.ads | *.asm | \
1215    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1216    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1217      func_xform "$libobj"
1218      libobj=$func_xform_result
1219      ;;
1220    esac
1221
1222    case $libobj in
1223    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1224    *)
1225      func_fatal_error "cannot determine name of library object from \`$libobj'"
1226      ;;
1227    esac
1228
1229    func_infer_tag $base_compile
1230
1231    for arg in $later; do
1232      case $arg in
1233      -shared)
1234	test "$build_libtool_libs" != yes && \
1235	  func_fatal_configuration "can not build a shared library"
1236	build_old_libs=no
1237	continue
1238	;;
1239
1240      -static)
1241	build_libtool_libs=no
1242	build_old_libs=yes
1243	continue
1244	;;
1245
1246      -prefer-pic)
1247	pic_mode=yes
1248	continue
1249	;;
1250
1251      -prefer-non-pic)
1252	pic_mode=no
1253	continue
1254	;;
1255      esac
1256    done
1257
1258    func_quote_for_eval "$libobj"
1259    test "X$libobj" != "X$func_quote_for_eval_result" \
1260      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
1261      && func_warning "libobj name \`$libobj' may not contain shell special characters."
1262    func_dirname_and_basename "$obj" "/" ""
1263    objname="$func_basename_result"
1264    xdir="$func_dirname_result"
1265    lobj=${xdir}$objdir/$objname
1266
1267    test -z "$base_compile" && \
1268      func_fatal_help "you must specify a compilation command"
1269
1270    # Delete any leftover library objects.
1271    if test "$build_old_libs" = yes; then
1272      removelist="$obj $lobj $libobj ${libobj}T"
1273    else
1274      removelist="$lobj $libobj ${libobj}T"
1275    fi
1276
1277    # On Cygwin there's no "real" PIC flag so we must build both object types
1278    case $host_os in
1279    cygwin* | mingw* | pw32* | os2* | cegcc*)
1280      pic_mode=default
1281      ;;
1282    esac
1283    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1284      # non-PIC code in shared libraries is not supported
1285      pic_mode=default
1286    fi
1287
1288    # Calculate the filename of the output object if compiler does
1289    # not support -o with -c
1290    if test "$compiler_c_o" = no; then
1291      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1292      lockfile="$output_obj.lock"
1293    else
1294      output_obj=
1295      need_locks=no
1296      lockfile=
1297    fi
1298
1299    # Lock this critical section if it is needed
1300    # We use this script file to make the link, it avoids creating a new file
1301    if test "$need_locks" = yes; then
1302      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1303	func_echo "Waiting for $lockfile to be removed"
1304	sleep 2
1305      done
1306    elif test "$need_locks" = warn; then
1307      if test -f "$lockfile"; then
1308	$ECHO "\
1309*** ERROR, $lockfile exists and contains:
1310`cat $lockfile 2>/dev/null`
1311
1312This indicates that another process is trying to use the same
1313temporary object file, and libtool could not work around it because
1314your compiler does not support \`-c' and \`-o' together.  If you
1315repeat this compilation, it may succeed, by chance, but you had better
1316avoid parallel builds (make -j) in this platform, or get a better
1317compiler."
1318
1319	$opt_dry_run || $RM $removelist
1320	exit $EXIT_FAILURE
1321      fi
1322      removelist="$removelist $output_obj"
1323      $ECHO "$srcfile" > "$lockfile"
1324    fi
1325
1326    $opt_dry_run || $RM $removelist
1327    removelist="$removelist $lockfile"
1328    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1329
1330    if test -n "$fix_srcfile_path"; then
1331      eval srcfile=\"$fix_srcfile_path\"
1332    fi
1333    func_quote_for_eval "$srcfile"
1334    qsrcfile=$func_quote_for_eval_result
1335
1336    # Only build a PIC object if we are building libtool libraries.
1337    if test "$build_libtool_libs" = yes; then
1338      # Without this assignment, base_compile gets emptied.
1339      fbsd_hideous_sh_bug=$base_compile
1340
1341      if test "$pic_mode" != no; then
1342	command="$base_compile $qsrcfile $pic_flag"
1343      else
1344	# Don't build PIC code
1345	command="$base_compile $qsrcfile"
1346      fi
1347
1348      func_mkdir_p "$xdir$objdir"
1349
1350      if test -z "$output_obj"; then
1351	# Place PIC objects in $objdir
1352	command="$command -o $lobj"
1353      fi
1354
1355      func_show_eval_locale "$command"	\
1356          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1357
1358      if test "$need_locks" = warn &&
1359	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1360	$ECHO "\
1361*** ERROR, $lockfile contains:
1362`cat $lockfile 2>/dev/null`
1363
1364but it should contain:
1365$srcfile
1366
1367This indicates that another process is trying to use the same
1368temporary object file, and libtool could not work around it because
1369your compiler does not support \`-c' and \`-o' together.  If you
1370repeat this compilation, it may succeed, by chance, but you had better
1371avoid parallel builds (make -j) in this platform, or get a better
1372compiler."
1373
1374	$opt_dry_run || $RM $removelist
1375	exit $EXIT_FAILURE
1376      fi
1377
1378      # Just move the object if needed, then go on to compile the next one
1379      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1380	func_show_eval '$MV "$output_obj" "$lobj"' \
1381	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1382      fi
1383
1384      # Allow error messages only from the first compilation.
1385      if test "$suppress_opt" = yes; then
1386	suppress_output=' >/dev/null 2>&1'
1387      fi
1388    fi
1389
1390    # Only build a position-dependent object if we build old libraries.
1391    if test "$build_old_libs" = yes; then
1392      if test "$pic_mode" != yes; then
1393	# Don't build PIC code
1394	command="$base_compile $qsrcfile$pie_flag"
1395      else
1396	command="$base_compile $qsrcfile $pic_flag"
1397      fi
1398      if test "$compiler_c_o" = yes; then
1399	command="$command -o $obj"
1400      fi
1401
1402      # Suppress compiler output if we already did a PIC compilation.
1403      command="$command$suppress_output"
1404      func_show_eval_locale "$command" \
1405        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1406
1407      if test "$need_locks" = warn &&
1408	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1409	$ECHO "\
1410*** ERROR, $lockfile contains:
1411`cat $lockfile 2>/dev/null`
1412
1413but it should contain:
1414$srcfile
1415
1416This indicates that another process is trying to use the same
1417temporary object file, and libtool could not work around it because
1418your compiler does not support \`-c' and \`-o' together.  If you
1419repeat this compilation, it may succeed, by chance, but you had better
1420avoid parallel builds (make -j) in this platform, or get a better
1421compiler."
1422
1423	$opt_dry_run || $RM $removelist
1424	exit $EXIT_FAILURE
1425      fi
1426
1427      # Just move the object if needed
1428      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1429	func_show_eval '$MV "$output_obj" "$obj"' \
1430	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1431      fi
1432    fi
1433
1434    $opt_dry_run || {
1435      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1436
1437      # Unlock the critical section if it was locked
1438      if test "$need_locks" != no; then
1439	removelist=$lockfile
1440        $RM "$lockfile"
1441      fi
1442    }
1443
1444    exit $EXIT_SUCCESS
1445}
1446
1447$opt_help || {
1448test "$mode" = compile && func_mode_compile ${1+"$@"}
1449}
1450
1451func_mode_help ()
1452{
1453    # We need to display help for each of the modes.
1454    case $mode in
1455      "")
1456        # Generic help is extracted from the usage comments
1457        # at the start of this file.
1458        func_help
1459        ;;
1460
1461      clean)
1462        $ECHO \
1463"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1464
1465Remove files from the build directory.
1466
1467RM is the name of the program to use to delete files associated with each FILE
1468(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
1469to RM.
1470
1471If FILE is a libtool library, object or program, all the files associated
1472with it are deleted. Otherwise, only FILE itself is deleted using RM."
1473        ;;
1474
1475      compile)
1476      $ECHO \
1477"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1478
1479Compile a source file into a libtool library object.
1480
1481This mode accepts the following additional options:
1482
1483  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
1484  -no-suppress      do not suppress compiler output for multiple passes
1485  -prefer-pic       try to building PIC objects only
1486  -prefer-non-pic   try to building non-PIC objects only
1487  -shared           do not build a \`.o' file suitable for static linking
1488  -static           only build a \`.o' file suitable for static linking
1489
1490COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1491from the given SOURCEFILE.
1492
1493The output file name is determined by removing the directory component from
1494SOURCEFILE, then substituting the C source code suffix \`.c' with the
1495library object suffix, \`.lo'."
1496        ;;
1497
1498      execute)
1499        $ECHO \
1500"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1501
1502Automatically set library path, then run a program.
1503
1504This mode accepts the following additional options:
1505
1506  -dlopen FILE      add the directory containing FILE to the library path
1507
1508This mode sets the library path environment variable according to \`-dlopen'
1509flags.
1510
1511If any of the ARGS are libtool executable wrappers, then they are translated
1512into their corresponding uninstalled binary, and any of their required library
1513directories are added to the library path.
1514
1515Then, COMMAND is executed, with ARGS as arguments."
1516        ;;
1517
1518      finish)
1519        $ECHO \
1520"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1521
1522Complete the installation of libtool libraries.
1523
1524Each LIBDIR is a directory that contains libtool libraries.
1525
1526The commands that this mode executes may require superuser privileges.  Use
1527the \`--dry-run' option if you just want to see what would be executed."
1528        ;;
1529
1530      install)
1531        $ECHO \
1532"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1533
1534Install executables or libraries.
1535
1536INSTALL-COMMAND is the installation command.  The first component should be
1537either the \`install' or \`cp' program.
1538
1539The following components of INSTALL-COMMAND are treated specially:
1540
1541  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
1542
1543The rest of the components are interpreted as arguments to that command (only
1544BSD-compatible install options are recognized)."
1545        ;;
1546
1547      link)
1548        $ECHO \
1549"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1550
1551Link object files or libraries together to form another library, or to
1552create an executable program.
1553
1554LINK-COMMAND is a command using the C compiler that you would use to create
1555a program from several object files.
1556
1557The following components of LINK-COMMAND are treated specially:
1558
1559  -all-static       do not do any dynamic linking at all
1560  -avoid-version    do not add a version suffix if possible
1561  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
1562  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
1563  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1564  -export-symbols SYMFILE
1565                    try to export only the symbols listed in SYMFILE
1566  -export-symbols-regex REGEX
1567                    try to export only the symbols matching REGEX
1568  -LLIBDIR          search LIBDIR for required installed libraries
1569  -lNAME            OUTPUT-FILE requires the installed library libNAME
1570  -module           build a library that can dlopened
1571  -no-fast-install  disable the fast-install mode
1572  -no-install       link a not-installable executable
1573  -no-undefined     declare that a library does not refer to external symbols
1574  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
1575  -objectlist FILE  Use a list of object files found in FILE to specify objects
1576  -precious-files-regex REGEX
1577                    don't remove output files matching REGEX
1578  -release RELEASE  specify package release information
1579  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
1580  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
1581  -shared           only do dynamic linking of libtool libraries
1582  -shrext SUFFIX    override the standard shared library file extension
1583  -static           do not do any dynamic linking of uninstalled libtool libraries
1584  -static-libtool-libs
1585                    do not do any dynamic linking of libtool libraries
1586  -version-info CURRENT[:REVISION[:AGE]]
1587                    specify library version info [each variable defaults to 0]
1588  -weak LIBNAME     declare that the target provides the LIBNAME interface
1589
1590All other options (arguments beginning with \`-') are ignored.
1591
1592Every other argument is treated as a filename.  Files ending in \`.la' are
1593treated as uninstalled libtool libraries, other files are standard or library
1594object files.
1595
1596If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1597only library objects (\`.lo' files) may be specified, and \`-rpath' is
1598required, except when creating a convenience library.
1599
1600If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1601using \`ar' and \`ranlib', or on Windows using \`lib'.
1602
1603If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1604is created, otherwise an executable program is created."
1605        ;;
1606
1607      uninstall)
1608        $ECHO \
1609"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1610
1611Remove libraries from an installation directory.
1612
1613RM is the name of the program to use to delete files associated with each FILE
1614(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
1615to RM.
1616
1617If FILE is a libtool library, all the files associated with it are deleted.
1618Otherwise, only FILE itself is deleted using RM."
1619        ;;
1620
1621      *)
1622        func_fatal_help "invalid operation mode \`$mode'"
1623        ;;
1624    esac
1625
1626    $ECHO
1627    $ECHO "Try \`$progname --help' for more information about other modes."
1628
1629    exit $?
1630}
1631
1632  # Now that we've collected a possible --mode arg, show help if necessary
1633  $opt_help && func_mode_help
1634
1635
1636# func_mode_execute arg...
1637func_mode_execute ()
1638{
1639    $opt_debug
1640    # The first argument is the command name.
1641    cmd="$nonopt"
1642    test -z "$cmd" && \
1643      func_fatal_help "you must specify a COMMAND"
1644
1645    # Handle -dlopen flags immediately.
1646    for file in $execute_dlfiles; do
1647      test -f "$file" \
1648	|| func_fatal_help "\`$file' is not a file"
1649
1650      dir=
1651      case $file in
1652      *.la)
1653	# Check to see that this really is a libtool archive.
1654	func_lalib_unsafe_p "$file" \
1655	  || func_fatal_help "\`$lib' is not a valid libtool archive"
1656
1657	# Read the libtool library.
1658	dlname=
1659	library_names=
1660	func_source "$file"
1661
1662	# Skip this library if it cannot be dlopened.
1663	if test -z "$dlname"; then
1664	  # Warn if it was a shared library.
1665	  test -n "$library_names" && \
1666	    func_warning "\`$file' was not linked with \`-export-dynamic'"
1667	  continue
1668	fi
1669
1670	func_dirname "$file" "" "."
1671	dir="$func_dirname_result"
1672
1673	if test -f "$dir/$objdir/$dlname"; then
1674	  dir="$dir/$objdir"
1675	else
1676	  if test ! -f "$dir/$dlname"; then
1677	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1678	  fi
1679	fi
1680	;;
1681
1682      *.lo)
1683	# Just add the directory containing the .lo file.
1684	func_dirname "$file" "" "."
1685	dir="$func_dirname_result"
1686	;;
1687
1688      *)
1689	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1690	continue
1691	;;
1692      esac
1693
1694      # Get the absolute pathname.
1695      absdir=`cd "$dir" && pwd`
1696      test -n "$absdir" && dir="$absdir"
1697
1698      # Now add the directory to shlibpath_var.
1699      if eval "test -z \"\$$shlibpath_var\""; then
1700	eval "$shlibpath_var=\"\$dir\""
1701      else
1702	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1703      fi
1704    done
1705
1706    # This variable tells wrapper scripts just to set shlibpath_var
1707    # rather than running their programs.
1708    libtool_execute_magic="$magic"
1709
1710    # Check if any of the arguments is a wrapper script.
1711    args=
1712    for file
1713    do
1714      case $file in
1715      -*) ;;
1716      *)
1717	# Do a test to see if this is really a libtool program.
1718	if func_ltwrapper_script_p "$file"; then
1719	  func_source "$file"
1720	  # Transform arg to wrapped name.
1721	  file="$progdir/$program"
1722	elif func_ltwrapper_executable_p "$file"; then
1723	  func_ltwrapper_scriptname "$file"
1724	  func_source "$func_ltwrapper_scriptname_result"
1725	  # Transform arg to wrapped name.
1726	  file="$progdir/$program"
1727	fi
1728	;;
1729      esac
1730      # Quote arguments (to preserve shell metacharacters).
1731      func_quote_for_eval "$file"
1732      args="$args $func_quote_for_eval_result"
1733    done
1734
1735    if test "X$opt_

Large files files are truncated, but you can click here to view the full file