PageRenderTime 63ms CodeModel.GetById 12ms app.highlight 30ms RepoModel.GetById 1ms app.codeStats 1ms

/trunk/src/common/INet/libntlm-0.4.2/build-aux/ltmain.sh

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

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