Advertisement
kosx

mine.sh

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