Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

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