ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/ltmain.sh
(Generate patch)

Comparing ircd-hybrid-7.2/ltmain.sh (file contents):
Revision 912 by michael, Wed Nov 7 22:47:44 2007 UTC vs.
Revision 945 by michael, Mon Jul 20 15:48:27 2009 UTC

# Line 1 | Line 1
1 < # ltmain.sh - Provide generalized library-building support services.
2 < # NOTE: Changing this file will not affect anything until you rerun configure.
3 < #
4 < # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5 < # 2007  Free Software Foundation, Inc.
6 < # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7 < #
8 < # This program is free software; you can redistribute it and/or modify
1 > # Generated from ltmain.m4sh.
2 >
3 > # ltmain.sh (GNU libtool) 2.2.6
4 > # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
5 >
6 > # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
7 > # This is free software; see the source for copying conditions.  There is NO
8 > # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 >
10 > # GNU Libtool is free software; you can redistribute it and/or modify
11   # it under the terms of the GNU General Public License as published by
12   # the Free Software Foundation; either version 2 of the License, or
13   # (at your option) any later version.
14   #
15 < # This program is distributed in the hope that it will be useful, but
15 > # As a special exception to the GNU General Public License,
16 > # if you distribute this file as part of a program or library that
17 > # is built using GNU Libtool, you may include this file under the
18 > # same distribution terms that you use for the rest of that program.
19 > #
20 > # GNU Libtool is distributed in the hope that it will be useful, but
21   # WITHOUT ANY WARRANTY; without even the implied warranty of
22   # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23   # General Public License for more details.
24   #
25   # You should have received a copy of the GNU General Public License
26 < # along with this program; if not, write to the Free Software
27 < # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 < #
29 < # As a special exception to the GNU General Public License, if you
23 < # distribute this file as part of a program that contains a
24 < # configuration script generated by Autoconf, you may include it under
25 < # the same distribution terms that you use for the rest of that program.
26 <
27 < basename="s,^.*/,,g"
28 <
29 < # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 < # is ksh but when the shell is invoked as "sh" and the current value of
31 < # the _XPG environment variable is not equal to 1 (one), the special
32 < # positional parameter $0, within a function call, is the name of the
33 < # function.
34 < progpath="$0"
26 > # along with GNU Libtool; see the file COPYING.  If not, a copy
27 > # can be downloaded from http://www.gnu.org/licenses/gpl.html,
28 > # or obtained by writing to the Free Software Foundation, Inc.,
29 > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30  
31 < # The name of this program:
32 < progname=`echo "$progpath" | $SED $basename`
33 < modename="$progname"
34 <
35 < # Global variables:
36 < EXIT_SUCCESS=0
37 < EXIT_FAILURE=1
31 > # Usage: $progname [OPTION]... [MODE-ARG]...
32 > #
33 > # Provide generalized library-building support services.
34 > #
35 > #     --config             show all configuration variables
36 > #     --debug              enable verbose shell tracing
37 > # -n, --dry-run            display commands without modifying any files
38 > #     --features           display basic configuration information and exit
39 > #     --mode=MODE          use operation mode MODE
40 > #     --preserve-dup-deps  don't remove duplicate dependency libraries
41 > #     --quiet, --silent    don't print informational messages
42 > #     --tag=TAG            use configuration variables from tag TAG
43 > # -v, --verbose            print informational messages (default)
44 > #     --version            print version information
45 > # -h, --help               print short or long help message
46 > #
47 > # MODE must be one of the following:
48 > #
49 > #       clean              remove files from the build directory
50 > #       compile            compile a source file into a libtool object
51 > #       execute            automatically set library path, then run a program
52 > #       finish             complete the installation of libtool libraries
53 > #       install            install libraries or executables
54 > #       link               create a library or an executable
55 > #       uninstall          remove libraries from an installed directory
56 > #
57 > # MODE-ARGS vary depending on the MODE.
58 > # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
59 > #
60 > # When reporting a bug, please describe a test case to reproduce it and
61 > # include the following information:
62 > #
63 > #       host-triplet:   $host
64 > #       shell:          $SHELL
65 > #       compiler:               $LTCC
66 > #       compiler flags:         $LTCFLAGS
67 > #       linker:         $LD (gnu? $with_gnu_ld)
68 > #       $progname:              (GNU libtool) 2.2.6
69 > #       automake:               $automake_version
70 > #       autoconf:               $autoconf_version
71 > #
72 > # Report bugs to <bug-libtool@gnu.org>.
73  
74   PROGRAM=ltmain.sh
75   PACKAGE=libtool
76 < VERSION=1.5.24
77 < TIMESTAMP=" (1.1220.2.455 2007/06/24 02:13:29)"
76 > VERSION=2.2.6
77 > TIMESTAMP=""
78 > package_revision=1.3012
79 >
80 > # define SED for historic ltconfig's generated by Libtool 1.3
81 > test -z "$SED" && SED=sed
82  
83 < # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
83 > # Be Bourne compatible
84   if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
85    emulate sh
86    NULLCMD=:
# Line 60 | Line 94 | fi
94   BIN_SH=xpg4; export BIN_SH # for Tru64
95   DUALCASE=1; export DUALCASE # for MKS sh
96  
97 < # Check that we have a working $echo.
64 < if test "X$1" = X--no-reexec; then
65 <  # Discard the --no-reexec flag, and continue.
66 <  shift
67 < elif test "X$1" = X--fallback-echo; then
68 <  # Avoid inline document here, it may be left over
69 <  :
70 < elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71 <  # Yippee, $echo works!
72 <  :
73 < else
74 <  # Restart under the correct shell, and then maybe $echo will work.
75 <  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
76 < fi
77 <
78 < if test "X$1" = X--fallback-echo; then
79 <  # used as fallback echo
80 <  shift
81 <  cat <<EOF
82 < $*
83 < EOF
84 <  exit $EXIT_SUCCESS
85 < fi
86 <
87 < default_mode=
88 < help="Try \`$progname --help' for more information."
89 < magic="%%%MAGIC variable%%%"
90 < mkdir="mkdir"
91 < mv="mv -f"
92 < rm="rm -f"
93 <
94 < # Sed substitution that helps us do robust quoting.  It backslashifies
95 < # metacharacters that are still active within double-quoted strings.
96 < Xsed="${SED}"' -e 1s/^X//'
97 < sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98 < # test EBCDIC or ASCII
99 < case `echo X|tr X '\101'` in
100 < A) # ASCII based system
101 <    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
102 <  SP2NL='tr \040 \012'
103 <  NL2SP='tr \015\012 \040\040'
104 <  ;;
105 < *) # EBCDIC based system
106 <  SP2NL='tr \100 \n'
107 <  NL2SP='tr \r\n \100\100'
108 <  ;;
109 < esac
110 <
111 < # NLS nuisances.
97 > # NLS nuisances: We save the old values to restore during execute mode.
98   # Only set LANG and LC_ALL to C if already set.
99   # These must not be set unconditionally because not all systems understand
100   # e.g. LANG=C (notably SCO).
101 < # We save the old values to restore during execute mode.
102 < for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
101 > lt_user_locale=
102 > lt_safe_locale=
103 > for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
104   do
105    eval "if test \"\${$lt_var+set}\" = set; then
106 <          save_$lt_var=\$$lt_var
107 <          $lt_var=C
106 >          save_$lt_var=\$$lt_var
107 >          $lt_var=C
108            export $lt_var
109 +          lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
110 +          lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
111          fi"
112   done
113  
114 + $lt_unset CDPATH
115 +
116 +
117 +
118 +
119 +
120 + : ${CP="cp -f"}
121 + : ${ECHO="echo"}
122 + : ${EGREP="/bin/grep -E"}
123 + : ${FGREP="/bin/grep -F"}
124 + : ${GREP="/bin/grep"}
125 + : ${LN_S="ln -s"}
126 + : ${MAKE="make"}
127 + : ${MKDIR="mkdir"}
128 + : ${MV="mv -f"}
129 + : ${RM="rm -f"}
130 + : ${SED="/bin/sed"}
131 + : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
132 + : ${Xsed="$SED -e 1s/^X//"}
133 +
134 + # Global variables:
135 + EXIT_SUCCESS=0
136 + EXIT_FAILURE=1
137 + EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
138 + EXIT_SKIP=77      # $? = 77 is used to indicate a skipped test to automake.
139 +
140 + exit_status=$EXIT_SUCCESS
141 +
142   # Make sure IFS has a sensible default
143   lt_nl='
144   '
145   IFS="   $lt_nl"
146  
147 < if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
148 <  $echo "$modename: not configured to build any kind of library" 1>&2
132 <  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
133 <  exit $EXIT_FAILURE
134 < fi
147 > dirname="s,/[^/]*$,,"
148 > basename="s,^.*/,,"
149  
150 < # Global variables.
151 < mode=$default_mode
152 < nonopt=
153 < prev=
154 < prevopt=
155 < run=
156 < show="$echo"
157 < show_help=
158 < execute_dlfiles=
159 < duplicate_deps=no
160 < preserve_args=
161 < lo2o="s/\\.lo\$/.${objext}/"
162 < o2lo="s/\\.${objext}\$/.lo/"
163 < extracted_archives=
164 < extracted_serial=0
150 > # func_dirname_and_basename file append nondir_replacement
151 > # perform func_basename and func_dirname in a single function
152 > # call:
153 > #   dirname:  Compute the dirname of FILE.  If nonempty,
154 > #             add APPEND to the result, otherwise set result
155 > #             to NONDIR_REPLACEMENT.
156 > #             value returned in "$func_dirname_result"
157 > #   basename: Compute filename of FILE.
158 > #             value retuned in "$func_basename_result"
159 > # Implementation must be kept synchronized with func_dirname
160 > # and func_basename. For efficiency, we do not delegate to
161 > # those functions but instead duplicate the functionality here.
162 > func_dirname_and_basename ()
163 > {
164 >  # Extract subdirectory from the argument.
165 >  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
166 >  if test "X$func_dirname_result" = "X${1}"; then
167 >    func_dirname_result="${3}"
168 >  else
169 >    func_dirname_result="$func_dirname_result${2}"
170 >  fi
171 >  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
172 > }
173 >
174 > # Generated shell functions inserted here.
175 >
176 > # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
177 > # is ksh but when the shell is invoked as "sh" and the current value of
178 > # the _XPG environment variable is not equal to 1 (one), the special
179 > # positional parameter $0, within a function call, is the name of the
180 > # function.
181 > progpath="$0"
182 >
183 > # The name of this program:
184 > # In the unlikely event $progname began with a '-', it would play havoc with
185 > # func_echo (imagine progname=-n), so we prepend ./ in that case:
186 > func_dirname_and_basename "$progpath"
187 > progname=$func_basename_result
188 > case $progname in
189 >  -*) progname=./$progname ;;
190 > esac
191 >
192 > # Make sure we have an absolute path for reexecution:
193 > case $progpath in
194 >  [\\/]*|[A-Za-z]:\\*) ;;
195 >  *[\\/]*)
196 >     progdir=$func_dirname_result
197 >     progdir=`cd "$progdir" && pwd`
198 >     progpath="$progdir/$progname"
199 >     ;;
200 >  *)
201 >     save_IFS="$IFS"
202 >     IFS=:
203 >     for progdir in $PATH; do
204 >       IFS="$save_IFS"
205 >       test -x "$progdir/$progname" && break
206 >     done
207 >     IFS="$save_IFS"
208 >     test -n "$progdir" || progdir=`pwd`
209 >     progpath="$progdir/$progname"
210 >     ;;
211 > esac
212 >
213 > # Sed substitution that helps us do robust quoting.  It backslashifies
214 > # metacharacters that are still active within double-quoted strings.
215 > Xsed="${SED}"' -e 1s/^X//'
216 > sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
217 >
218 > # Same as above, but do not quote variable references.
219 > double_quote_subst='s/\(["`\\]\)/\\\1/g'
220 >
221 > # Re-`\' parameter expansions in output of double_quote_subst that were
222 > # `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
223 > # in input to double_quote_subst, that '$' was protected from expansion.
224 > # Since each input `\' is now two `\'s, look for any number of runs of
225 > # four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
226 > bs='\\'
227 > bs2='\\\\'
228 > bs4='\\\\\\\\'
229 > dollar='\$'
230 > sed_double_backslash="\
231 >  s/$bs4/&\\
232 > /g
233 >  s/^$bs2$dollar/$bs&/
234 >  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
235 >  s/\n//g"
236 >
237 > # Standard options:
238 > opt_dry_run=false
239 > opt_help=false
240 > opt_quiet=false
241 > opt_verbose=false
242 > opt_warning=:
243 >
244 > # func_echo arg...
245 > # Echo program name prefixed message, along with the current mode
246 > # name if it has been set yet.
247 > func_echo ()
248 > {
249 >    $ECHO "$progname${mode+: }$mode: $*"
250 > }
251 >
252 > # func_verbose arg...
253 > # Echo program name prefixed message in verbose mode only.
254 > func_verbose ()
255 > {
256 >    $opt_verbose && func_echo ${1+"$@"}
257 >
258 >    # A bug in bash halts the script if the last line of a function
259 >    # fails when set -e is in force, so we need another command to
260 >    # work around that:
261 >    :
262 > }
263 >
264 > # func_error arg...
265 > # Echo program name prefixed message to standard error.
266 > func_error ()
267 > {
268 >    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
269 > }
270 >
271 > # func_warning arg...
272 > # Echo program name prefixed warning message to standard error.
273 > func_warning ()
274 > {
275 >    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
276 >
277 >    # bash bug again:
278 >    :
279 > }
280 >
281 > # func_fatal_error arg...
282 > # Echo program name prefixed message to standard error, and exit.
283 > func_fatal_error ()
284 > {
285 >    func_error ${1+"$@"}
286 >    exit $EXIT_FAILURE
287 > }
288 >
289 > # func_fatal_help arg...
290 > # Echo program name prefixed message to standard error, followed by
291 > # a help hint, and exit.
292 > func_fatal_help ()
293 > {
294 >    func_error ${1+"$@"}
295 >    func_fatal_error "$help"
296 > }
297 > help="Try \`$progname --help' for more information."  ## default
298 >
299 >
300 > # func_grep expression filename
301 > # Check whether EXPRESSION matches any line of FILENAME, without output.
302 > func_grep ()
303 > {
304 >    $GREP "$1" "$2" >/dev/null 2>&1
305 > }
306 >
307 >
308 > # func_mkdir_p directory-path
309 > # Make sure the entire path to DIRECTORY-PATH is available.
310 > func_mkdir_p ()
311 > {
312 >    my_directory_path="$1"
313 >    my_dir_list=
314 >
315 >    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
316 >
317 >      # Protect directory names starting with `-'
318 >      case $my_directory_path in
319 >        -*) my_directory_path="./$my_directory_path" ;;
320 >      esac
321 >
322 >      # While some portion of DIR does not yet exist...
323 >      while test ! -d "$my_directory_path"; do
324 >        # ...make a list in topmost first order.  Use a colon delimited
325 >        # list incase some portion of path contains whitespace.
326 >        my_dir_list="$my_directory_path:$my_dir_list"
327 >
328 >        # If the last portion added has no slash in it, the list is done
329 >        case $my_directory_path in */*) ;; *) break ;; esac
330 >
331 >        # ...otherwise throw away the child directory and loop
332 >        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
333 >      done
334 >      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
335 >
336 >      save_mkdir_p_IFS="$IFS"; IFS=':'
337 >      for my_dir in $my_dir_list; do
338 >        IFS="$save_mkdir_p_IFS"
339 >        # mkdir can fail with a `File exist' error if two processes
340 >        # try to create one of the directories concurrently.  Don't
341 >        # stop in that case!
342 >        $MKDIR "$my_dir" 2>/dev/null || :
343 >      done
344 >      IFS="$save_mkdir_p_IFS"
345 >
346 >      # Bail out if we (or some other process) failed to create a directory.
347 >      test -d "$my_directory_path" || \
348 >        func_fatal_error "Failed to create \`$1'"
349 >    fi
350 > }
351  
152 #####################################
153 # Shell function definitions:
154 # This seems to be the best place for them
352  
353   # func_mktempdir [string]
354   # Make a temporary directory that won't clash with other running
# Line 161 | Line 358 | func_mktempdir ()
358   {
359      my_template="${TMPDIR-/tmp}/${1-$progname}"
360  
361 <    if test "$run" = ":"; then
361 >    if test "$opt_dry_run" = ":"; then
362        # Return a directory name, but don't create it in dry-run mode
363        my_tmpdir="${my_template}-$$"
364      else
# Line 170 | Line 367 | func_mktempdir ()
367        my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
368  
369        if test ! -d "$my_tmpdir"; then
370 <        # Failing that, at least try and use $RANDOM to avoid a race
371 <        my_tmpdir="${my_template}-${RANDOM-0}$$"
370 >        # Failing that, at least try and use $RANDOM to avoid a race
371 >        my_tmpdir="${my_template}-${RANDOM-0}$$"
372  
373 <        save_mktempdir_umask=`umask`
374 <        umask 0077
375 <        $mkdir "$my_tmpdir"
376 <        umask $save_mktempdir_umask
373 >        save_mktempdir_umask=`umask`
374 >        umask 0077
375 >        $MKDIR "$my_tmpdir"
376 >        umask $save_mktempdir_umask
377        fi
378  
379        # If we're not in dry-run mode, bomb out on failure
380 <      test -d "$my_tmpdir" || {
381 <        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
185 <        exit $EXIT_FAILURE
186 <      }
380 >      test -d "$my_tmpdir" || \
381 >        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
382      fi
383  
384 <    $echo "X$my_tmpdir" | $Xsed
384 >    $ECHO "X$my_tmpdir" | $Xsed
385   }
386  
387  
388 < # func_win32_libid arg
389 < # return the library type of file 'arg'
390 < #
391 < # Need a lot of goo to handle *both* DLLs and import libs
392 < # Has to be a shell function in order to 'eat' the argument
393 < # that is supplied when $file_magic_command is called.
394 < func_win32_libid ()
388 > # func_quote_for_eval arg
389 > # Aesthetically quote ARG to be evaled later.
390 > # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
391 > # is double-quoted, suitable for a subsequent eval, whereas
392 > # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
393 > # which are still active within double quotes backslashified.
394 > func_quote_for_eval ()
395   {
396 <  win32_libid_type="unknown"
397 <  win32_fileres=`file -L $1 2>/dev/null`
398 <  case $win32_fileres in
399 <  *ar\ archive\ import\ library*) # definitely import
400 <    win32_libid_type="x86 archive import"
401 <    ;;
402 <  *ar\ archive*) # could be an import, or static
403 <    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
404 <      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
405 <      win32_nmres=`eval $NM -f posix -A $1 | \
406 <        $SED -n -e '1,100{
407 <                / I /{
408 <                        s,.*,import,
409 <                        p
410 <                        q
411 <                        }
412 <                }'`
413 <      case $win32_nmres in
219 <      import*)  win32_libid_type="x86 archive import";;
220 <      *)        win32_libid_type="x86 archive static";;
221 <      esac
222 <    fi
223 <    ;;
224 <  *DLL*)
225 <    win32_libid_type="x86 DLL"
226 <    ;;
227 <  *executable*) # but shell scripts are "executable" too...
228 <    case $win32_fileres in
229 <    *MS\ Windows\ PE\ Intel*)
230 <      win32_libid_type="x86 DLL"
231 <      ;;
396 >    case $1 in
397 >      *[\\\`\"\$]*)
398 >        func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
399 >      *)
400 >        func_quote_for_eval_unquoted_result="$1" ;;
401 >    esac
402 >
403 >    case $func_quote_for_eval_unquoted_result in
404 >      # Double-quote args containing shell metacharacters to delay
405 >      # word splitting, command substitution and and variable
406 >      # expansion for a subsequent eval.
407 >      # Many Bourne shells cannot handle close brackets correctly
408 >      # in scan sets, so we specify it separately.
409 >      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
410 >        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
411 >        ;;
412 >      *)
413 >        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
414      esac
233    ;;
234  esac
235  $echo $win32_libid_type
415   }
416  
417  
418 < # func_infer_tag arg
419 < # Infer tagged configuration to use if any are available and
420 < # if one wasn't chosen via the "--tag" command line option.
421 < # Only attempt this if the compiler in the base compile
243 < # command doesn't match the default compiler.
244 < # arg is usually of the form 'gcc ...'
245 < func_infer_tag ()
418 > # func_quote_for_expand arg
419 > # Aesthetically quote ARG to be evaled later; same as above,
420 > # but do not quote variable references.
421 > func_quote_for_expand ()
422   {
423 <    if test -n "$available_tags" && test -z "$tagname"; then
424 <      CC_quoted=
425 <      for arg in $CC; do
426 <        case $arg in
251 <          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
252 <          arg="\"$arg\""
253 <          ;;
254 <        esac
255 <        CC_quoted="$CC_quoted $arg"
256 <      done
257 <      case $@ in
258 <      # Blanks in the command may have been stripped by the calling shell,
259 <      # but not from the CC environment variable when configure was run.
260 <      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
261 <      # Blanks at the start of $base_compile will cause this to fail
262 <      # if we don't check for them as well.
423 >    case $1 in
424 >      *[\\\`\"]*)
425 >        my_arg=`$ECHO "X$1" | $Xsed \
426 >            -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
427        *)
428 <        for z in $available_tags; do
429 <          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
430 <            # Evaluate the configuration.
431 <            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
432 <            CC_quoted=
433 <            for arg in $CC; do
434 <            # Double-quote args containing other shell metacharacters.
435 <            case $arg in
436 <              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
437 <              arg="\"$arg\""
438 <              ;;
439 <            esac
440 <            CC_quoted="$CC_quoted $arg"
441 <          done
278 <            case "$@ " in
279 <              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
280 <              # The compiler in the base compile command matches
281 <              # the one in the tagged configuration.
282 <              # Assume this is the tagged configuration we want.
283 <              tagname=$z
284 <              break
285 <              ;;
286 <            esac
287 <          fi
288 <        done
289 <        # If $tagname still isn't set, then no tagged configuration
290 <        # was found and let the user know that the "--tag" command
291 <        # line option must be used.
292 <        if test -z "$tagname"; then
293 <          $echo "$modename: unable to infer tagged configuration"
294 <          $echo "$modename: specify a tag with \`--tag'" 1>&2
295 <          exit $EXIT_FAILURE
296 < #        else
297 < #          $echo "$modename: using $tagname tagged configuration"
298 <        fi
299 <        ;;
300 <      esac
301 <    fi
428 >        my_arg="$1" ;;
429 >    esac
430 >
431 >    case $my_arg in
432 >      # Double-quote args containing shell metacharacters to delay
433 >      # word splitting and command substitution for a subsequent eval.
434 >      # Many Bourne shells cannot handle close brackets correctly
435 >      # in scan sets, so we specify it separately.
436 >      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
437 >        my_arg="\"$my_arg\""
438 >        ;;
439 >    esac
440 >
441 >    func_quote_for_expand_result="$my_arg"
442   }
443  
444  
445 < # func_extract_an_archive dir oldlib
446 < func_extract_an_archive ()
445 > # func_show_eval cmd [fail_exp]
446 > # Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
447 > # not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
448 > # is given, then evaluate it.
449 > func_show_eval ()
450   {
451 <    f_ex_an_ar_dir="$1"; shift
452 <    f_ex_an_ar_oldlib="$1"
451 >    my_cmd="$1"
452 >    my_fail_exp="${2-:}"
453  
454 <    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
455 <    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
456 <    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
457 <     :
458 <    else
459 <      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
460 <      exit $EXIT_FAILURE
454 >    ${opt_silent-false} || {
455 >      func_quote_for_expand "$my_cmd"
456 >      eval "func_echo $func_quote_for_expand_result"
457 >    }
458 >
459 >    if ${opt_dry_run-false}; then :; else
460 >      eval "$my_cmd"
461 >      my_status=$?
462 >      if test "$my_status" -eq 0; then :; else
463 >        eval "(exit $my_status); $my_fail_exp"
464 >      fi
465      fi
466   }
467  
468 < # func_extract_archives gentop oldlib ...
469 < func_extract_archives ()
468 >
469 > # func_show_eval_locale cmd [fail_exp]
470 > # Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
471 > # not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
472 > # is given, then evaluate it.  Use the saved locale for evaluation.
473 > func_show_eval_locale ()
474   {
475 <    my_gentop="$1"; shift
476 <    my_oldlibs=${1+"$@"}
326 <    my_oldobjs=""
327 <    my_xlib=""
328 <    my_xabs=""
329 <    my_xdir=""
330 <    my_status=""
475 >    my_cmd="$1"
476 >    my_fail_exp="${2-:}"
477  
478 <    $show "${rm}r $my_gentop"
479 <    $run ${rm}r "$my_gentop"
480 <    $show "$mkdir $my_gentop"
481 <    $run $mkdir "$my_gentop"
482 <    my_status=$?
483 <    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
484 <      exit $my_status
478 >    ${opt_silent-false} || {
479 >      func_quote_for_expand "$my_cmd"
480 >      eval "func_echo $func_quote_for_expand_result"
481 >    }
482 >
483 >    if ${opt_dry_run-false}; then :; else
484 >      eval "$lt_user_locale
485 >            $my_cmd"
486 >      my_status=$?
487 >      eval "$lt_safe_locale"
488 >      if test "$my_status" -eq 0; then :; else
489 >        eval "(exit $my_status); $my_fail_exp"
490 >      fi
491      fi
492 + }
493  
341    for my_xlib in $my_oldlibs; do
342      # Extract the objects.
343      case $my_xlib in
344        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
345        *) my_xabs=`pwd`"/$my_xlib" ;;
346      esac
347      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
348      my_xlib_u=$my_xlib
349      while :; do
350        case " $extracted_archives " in
351        *" $my_xlib_u "*)
352          extracted_serial=`expr $extracted_serial + 1`
353          my_xlib_u=lt$extracted_serial-$my_xlib ;;
354        *) break ;;
355        esac
356      done
357      extracted_archives="$extracted_archives $my_xlib_u"
358      my_xdir="$my_gentop/$my_xlib_u"
494  
495 <      $show "${rm}r $my_xdir"
496 <      $run ${rm}r "$my_xdir"
497 <      $show "$mkdir $my_xdir"
498 <      $run $mkdir "$my_xdir"
499 <      exit_status=$?
500 <      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
501 <        exit $exit_status
502 <      fi
503 <      case $host in
504 <      *-darwin*)
505 <        $show "Extracting $my_xabs"
506 <        # Do not bother doing anything if just a dry run
507 <        if test -z "$run"; then
508 <          darwin_orig_dir=`pwd`
374 <          cd $my_xdir || exit $?
375 <          darwin_archive=$my_xabs
376 <          darwin_curdir=`pwd`
377 <          darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
378 <          darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
379 <          if test -n "$darwin_arches"; then
380 <            darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
381 <            darwin_arch=
382 <            $show "$darwin_base_archive has multiple architectures $darwin_arches"
383 <            for darwin_arch in  $darwin_arches ; do
384 <              mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
385 <              lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
386 <              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
387 <              func_extract_an_archive "`pwd`" "${darwin_base_archive}"
388 <              cd "$darwin_curdir"
389 <              $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
390 <            done # $darwin_arches
391 <      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
392 <            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
393 <            darwin_file=
394 <            darwin_files=
395 <            for darwin_file in $darwin_filelist; do
396 <              darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
397 <              lipo -create -output "$darwin_file" $darwin_files
398 <            done # $darwin_filelist
399 <            ${rm}r unfat-$$
400 <            cd "$darwin_orig_dir"
401 <          else
402 <            cd "$darwin_orig_dir"
403 <            func_extract_an_archive "$my_xdir" "$my_xabs"
404 <          fi # $darwin_arches
405 <        fi # $run
406 <        ;;
407 <      *)
408 <        func_extract_an_archive "$my_xdir" "$my_xabs"
409 <        ;;
410 <      esac
411 <      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
412 <    done
413 <    func_extract_archives_result="$my_oldobjs"
495 >
496 >
497 >
498 > # func_version
499 > # Echo version message to standard output and exit.
500 > func_version ()
501 > {
502 >    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
503 >        s/^# //
504 >        s/^# *$//
505 >        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
506 >        p
507 >     }' < "$progpath"
508 >     exit $?
509   }
415 # End of Shell function definitions
416 #####################################
510  
511 < # Darwin sucks
512 < eval std_shrext=\"$shrext_cmds\"
511 > # func_usage
512 > # Echo short help message to standard output and exit.
513 > func_usage ()
514 > {
515 >    $SED -n '/^# Usage:/,/# -h/ {
516 >        s/^# //
517 >        s/^# *$//
518 >        s/\$progname/'$progname'/
519 >        p
520 >    }' < "$progpath"
521 >    $ECHO
522 >    $ECHO "run \`$progname --help | more' for full usage"
523 >    exit $?
524 > }
525  
526 < disable_libs=no
526 > # func_help
527 > # Echo long help message to standard output and exit.
528 > func_help ()
529 > {
530 >    $SED -n '/^# Usage:/,/# Report bugs to/ {
531 >        s/^# //
532 >        s/^# *$//
533 >        s*\$progname*'$progname'*
534 >        s*\$host*'"$host"'*
535 >        s*\$SHELL*'"$SHELL"'*
536 >        s*\$LTCC*'"$LTCC"'*
537 >        s*\$LTCFLAGS*'"$LTCFLAGS"'*
538 >        s*\$LD*'"$LD"'*
539 >        s/\$with_gnu_ld/'"$with_gnu_ld"'/
540 >        s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
541 >        s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
542 >        p
543 >     }' < "$progpath"
544 >    exit $?
545 > }
546  
547 < # Parse our command line options once, thoroughly.
548 < while test "$#" -gt 0
549 < do
550 <  arg="$1"
547 > # func_missing_arg argname
548 > # Echo program name prefixed message to standard error and set global
549 > # exit_cmd.
550 > func_missing_arg ()
551 > {
552 >    func_error "missing argument for $1"
553 >    exit_cmd=exit
554 > }
555 >
556 > exit_cmd=:
557 >
558 >
559 >
560 >
561 >
562 > # Check that we have a working $ECHO.
563 > if test "X$1" = X--no-reexec; then
564 >  # Discard the --no-reexec flag, and continue.
565    shift
566 + elif test "X$1" = X--fallback-echo; then
567 +  # Avoid inline document here, it may be left over
568 +  :
569 + elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
570 +  # Yippee, $ECHO works!
571 +  :
572 + else
573 +  # Restart under the correct shell, and then maybe $ECHO will work.
574 +  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
575 + fi
576  
577 <  case $arg in
578 <  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
579 <  *) optarg= ;;
580 <  esac
577 > if test "X$1" = X--fallback-echo; then
578 >  # used as fallback echo
579 >  shift
580 >  cat <<EOF
581 > $*
582 > EOF
583 >  exit $EXIT_SUCCESS
584 > fi
585  
586 <  # If the previous option needs an argument, assign it.
587 <  if test -n "$prev"; then
436 <    case $prev in
437 <    execute_dlfiles)
438 <      execute_dlfiles="$execute_dlfiles $arg"
439 <      ;;
440 <    tag)
441 <      tagname="$arg"
442 <      preserve_args="${preserve_args}=$arg"
443 <
444 <      # Check whether tagname contains only valid characters
445 <      case $tagname in
446 <      *[!-_A-Za-z0-9,/]*)
447 <        $echo "$progname: invalid tag name: $tagname" 1>&2
448 <        exit $EXIT_FAILURE
449 <        ;;
450 <      esac
586 > magic="%%%MAGIC variable%%%"
587 > magic_exe="%%%MAGIC EXE variable%%%"
588  
589 <      case $tagname in
590 <      CC)
591 <        # Don't test for the "default" C tag, as we know, it's there, but
592 <        # not specially marked.
593 <        ;;
594 <      *)
595 <        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
596 <          taglist="$taglist $tagname"
597 <          # Evaluate the configuration.
461 <          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
462 <        else
463 <          $echo "$progname: ignoring unknown tag $tagname" 1>&2
464 <        fi
465 <        ;;
466 <      esac
467 <      ;;
468 <    *)
469 <      eval "$prev=\$arg"
470 <      ;;
471 <    esac
589 > # Global variables.
590 > # $mode is unset
591 > nonopt=
592 > execute_dlfiles=
593 > preserve_args=
594 > lo2o="s/\\.lo\$/.${objext}/"
595 > o2lo="s/\\.${objext}\$/.lo/"
596 > extracted_archives=
597 > extracted_serial=0
598  
599 <    prev=
600 <    prevopt=
601 <    continue
602 <  fi
599 > opt_dry_run=false
600 > opt_duplicate_deps=false
601 > opt_silent=false
602 > opt_debug=:
603  
604 <  # Have we seen a non-optional argument yet?
605 <  case $arg in
606 <  --help)
607 <    show_help=yes
482 <    ;;
604 > # If this variable is set in any of the actions, the command in it
605 > # will be execed at the end.  This prevents here-documents from being
606 > # left over by shells.
607 > exec_cmd=
608  
609 <  --version)
610 <    echo "\
611 < $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
612 <
613 < Copyright (C) 2007  Free Software Foundation, Inc.
614 < This is free software; see the source for copying conditions.  There is NO
615 < warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
616 <    exit $?
617 <    ;;
609 > # func_fatal_configuration arg...
610 > # Echo program name prefixed message to standard error, followed by
611 > # a configuration failure hint, and exit.
612 > func_fatal_configuration ()
613 > {
614 >    func_error ${1+"$@"}
615 >    func_error "See the $PACKAGE documentation for more information."
616 >    func_fatal_error "Fatal configuration error."
617 > }
618 >
619 >
620 > # func_config
621 > # Display the configuration for all the tags in this script.
622 > func_config ()
623 > {
624 >    re_begincf='^# ### BEGIN LIBTOOL'
625 >    re_endcf='^# ### END LIBTOOL'
626 >
627 >    # Default configuration.
628 >    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
629  
494  --config)
495    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
630      # Now print the configurations for the tags.
631      for tagname in $taglist; do
632 <      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
632 >      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
633      done
500    exit $?
501    ;;
634  
635 <  --debug)
636 <    $echo "$progname: enabling shell trace mode"
505 <    set -x
506 <    preserve_args="$preserve_args $arg"
507 <    ;;
508 <
509 <  --dry-run | -n)
510 <    run=:
511 <    ;;
635 >    exit $?
636 > }
637  
638 <  --features)
639 <    $echo "host: $host"
638 > # func_features
639 > # Display the features supported by this script.
640 > func_features ()
641 > {
642 >    $ECHO "host: $host"
643      if test "$build_libtool_libs" = yes; then
644 <      $echo "enable shared libraries"
644 >      $ECHO "enable shared libraries"
645      else
646 <      $echo "disable shared libraries"
646 >      $ECHO "disable shared libraries"
647      fi
648      if test "$build_old_libs" = yes; then
649 <      $echo "enable static libraries"
649 >      $ECHO "enable static libraries"
650      else
651 <      $echo "disable static libraries"
651 >      $ECHO "disable static libraries"
652      fi
653 +
654      exit $?
655 <    ;;
655 > }
656  
657 <  --finish) mode="finish" ;;
657 > # func_enable_tag tagname
658 > # Verify that TAGNAME is valid, and either flag an error and exit, or
659 > # enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
660 > # variable here.
661 > func_enable_tag ()
662 > {
663 >  # Global variable:
664 >  tagname="$1"
665  
666 <  --mode) prevopt="--mode" prev=mode ;;
667 <  --mode=*) mode="$optarg" ;;
666 >  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
667 >  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
668 >  sed_extractcf="/$re_begincf/,/$re_endcf/p"
669 >
670 >  # Validate tagname.
671 >  case $tagname in
672 >    *[!-_A-Za-z0-9,/]*)
673 >      func_fatal_error "invalid tag name: $tagname"
674 >      ;;
675 >  esac
676  
677 <  --preserve-dup-deps) duplicate_deps="yes" ;;
677 >  # Don't test for the "default" C tag, as we know it's
678 >  # there but not specially marked.
679 >  case $tagname in
680 >    CC) ;;
681 >    *)
682 >      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
683 >        taglist="$taglist $tagname"
684  
685 <  --quiet | --silent)
686 <    show=:
687 <    preserve_args="$preserve_args $arg"
688 <    ;;
685 >        # Evaluate the configuration.  Be careful to quote the path
686 >        # and the sed script, to avoid splitting on whitespace, but
687 >        # also don't use non-portable quotes within backquotes within
688 >        # quotes we have to do it in 2 steps:
689 >        extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
690 >        eval "$extractedcf"
691 >      else
692 >        func_error "ignoring unknown tag $tagname"
693 >      fi
694 >      ;;
695 >  esac
696 > }
697 >
698 > # Parse options once, thoroughly.  This comes as soon as possible in
699 > # the script to make things like `libtool --version' happen quickly.
700 > {
701  
702 <  --tag)
703 <    prevopt="--tag"
704 <    prev=tag
705 <    preserve_args="$preserve_args --tag"
702 >  # Shorthand for --mode=foo, only valid as the first argument
703 >  case $1 in
704 >  clean|clea|cle|cl)
705 >    shift; set dummy --mode clean ${1+"$@"}; shift
706      ;;
707 <  --tag=*)
708 <    set tag "$optarg" ${1+"$@"}
547 <    shift
548 <    prev=tag
549 <    preserve_args="$preserve_args --tag"
707 >  compile|compil|compi|comp|com|co|c)
708 >    shift; set dummy --mode compile ${1+"$@"}; shift
709      ;;
710 <
711 <  -dlopen)
553 <    prevopt="-dlopen"
554 <    prev=execute_dlfiles
710 >  execute|execut|execu|exec|exe|ex|e)
711 >    shift; set dummy --mode execute ${1+"$@"}; shift
712      ;;
713 <
714 <  -*)
558 <    $echo "$modename: unrecognized option \`$arg'" 1>&2
559 <    $echo "$help" 1>&2
560 <    exit $EXIT_FAILURE
713 >  finish|finis|fini|fin|fi|f)
714 >    shift; set dummy --mode finish ${1+"$@"}; shift
715      ;;
716 <
717 <  *)
718 <    nonopt="$arg"
719 <    break
716 >  install|instal|insta|inst|ins|in|i)
717 >    shift; set dummy --mode install ${1+"$@"}; shift
718 >    ;;
719 >  link|lin|li|l)
720 >    shift; set dummy --mode link ${1+"$@"}; shift
721 >    ;;
722 >  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
723 >    shift; set dummy --mode uninstall ${1+"$@"}; shift
724      ;;
725    esac
568 done
726  
727 < if test -n "$prevopt"; then
728 <  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
729 <  $echo "$help" 1>&2
730 <  exit $EXIT_FAILURE
574 < fi
727 >  # Parse non-mode specific arguments:
728 >  while test "$#" -gt 0; do
729 >    opt="$1"
730 >    shift
731  
732 < case $disable_libs in
733 < no)
578 <  ;;
579 < shared)
580 <  build_libtool_libs=no
581 <  build_old_libs=yes
582 <  ;;
583 < static)
584 <  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
585 <  ;;
586 < esac
732 >    case $opt in
733 >      --config)         func_config                                     ;;
734  
735 < # If this variable is set in any of the actions, the command in it
736 < # will be execed at the end.  This prevents here-documents from being
737 < # left over by shells.
738 < exec_cmd=
735 >      --debug)          preserve_args="$preserve_args $opt"
736 >                        func_echo "enabling shell trace mode"
737 >                        opt_debug='set -x'
738 >                        $opt_debug
739 >                        ;;
740  
741 < if test -z "$show_help"; then
741 >      -dlopen)          test "$#" -eq 0 && func_missing_arg "$opt" && break
742 >                        execute_dlfiles="$execute_dlfiles $1"
743 >                        shift
744 >                        ;;
745  
746 <  # Infer the operation mode.
747 <  if test -z "$mode"; then
748 <    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
749 <    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
750 <    case $nonopt in
751 <    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
752 <      mode=link
753 <      for arg
754 <      do
755 <        case $arg in
756 <        -c)
757 <           mode=compile
758 <           break
759 <           ;;
760 <        esac
761 <      done
762 <      ;;
763 <    *db | *dbx | *strace | *truss)
764 <      mode=execute
765 <      ;;
766 <    *install*|cp|mv)
767 <      mode=install
768 <      ;;
769 <    *rm)
770 <      mode=uninstall
746 >      --dry-run | -n)   opt_dry_run=:                                   ;;
747 >      --features)       func_features                                   ;;
748 >      --finish)         mode="finish"                                   ;;
749 >
750 >      --mode)           test "$#" -eq 0 && func_missing_arg "$opt" && break
751 >                        case $1 in
752 >                          # Valid mode arguments:
753 >                          clean)        ;;
754 >                          compile)      ;;
755 >                          execute)      ;;
756 >                          finish)       ;;
757 >                          install)      ;;
758 >                          link)         ;;
759 >                          relink)       ;;
760 >                          uninstall)    ;;
761 >
762 >                          # Catch anything else as an error
763 >                          *) func_error "invalid argument for $opt"
764 >                             exit_cmd=exit
765 >                             break
766 >                             ;;
767 >                        esac
768 >
769 >                        mode="$1"
770 >                        shift
771 >                        ;;
772 >
773 >      --preserve-dup-deps)
774 >                        opt_duplicate_deps=:                            ;;
775 >
776 >      --quiet|--silent) preserve_args="$preserve_args $opt"
777 >                        opt_silent=:
778 >                        ;;
779 >
780 >      --verbose| -v)    preserve_args="$preserve_args $opt"
781 >                        opt_silent=false
782 >                        ;;
783 >
784 >      --tag)            test "$#" -eq 0 && func_missing_arg "$opt" && break
785 >                        preserve_args="$preserve_args $opt $1"
786 >                        func_enable_tag "$1"    # tagname is set here
787 >                        shift
788 >                        ;;
789 >
790 >      # Separate optargs to long options:
791 >      -dlopen=*|--mode=*|--tag=*)
792 >                        func_opt_split "$opt"
793 >                        set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
794 >                        shift
795 >                        ;;
796 >
797 >      -\?|-h)           func_usage                                      ;;
798 >      --help)           opt_help=:                                      ;;
799 >      --version)        func_version                                    ;;
800 >
801 >      -*)               func_fatal_help "unrecognized option \`$opt'"   ;;
802 >
803 >      *)                nonopt="$opt"
804 >                        break
805 >                        ;;
806 >    esac
807 >  done
808 >
809 >
810 >  case $host in
811 >    *cygwin* | *mingw* | *pw32* | *cegcc*)
812 >      # don't eliminate duplications in $postdeps and $predeps
813 >      opt_duplicate_compiler_generated_deps=:
814        ;;
815      *)
816 <      # If we have no mode, but dlfiles were specified, then do execute mode.
817 <      test -n "$execute_dlfiles" && mode=execute
816 >      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
817 >      ;;
818 >  esac
819  
820 <      # Just use the default operation mode.
821 <      if test -z "$mode"; then
822 <        if test -n "$nonopt"; then
823 <          $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
824 <        else
825 <          $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
826 <        fi
820 >  # Having warned about all mis-specified options, bail out if
821 >  # anything was wrong.
822 >  $exit_cmd $EXIT_FAILURE
823 > }
824 >
825 > # func_check_version_match
826 > # Ensure that we are using m4 macros, and libtool script from the same
827 > # release of libtool.
828 > func_check_version_match ()
829 > {
830 >  if test "$package_revision" != "$macro_revision"; then
831 >    if test "$VERSION" != "$macro_version"; then
832 >      if test -z "$macro_version"; then
833 >        cat >&2 <<_LT_EOF
834 > $progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
835 > $progname: definition of this LT_INIT comes from an older release.
836 > $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
837 > $progname: and run autoconf again.
838 > _LT_EOF
839 >      else
840 >        cat >&2 <<_LT_EOF
841 > $progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
842 > $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
843 > $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
844 > $progname: and run autoconf again.
845 > _LT_EOF
846        fi
847 <      ;;
848 <    esac
847 >    else
848 >      cat >&2 <<_LT_EOF
849 > $progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
850 > $progname: but the definition of this LT_INIT comes from revision $macro_revision.
851 > $progname: You should recreate aclocal.m4 with macros from revision $package_revision
852 > $progname: of $PACKAGE $VERSION and run autoconf again.
853 > _LT_EOF
854 >    fi
855 >
856 >    exit $EXIT_MISMATCH
857 >  fi
858 > }
859 >
860 >
861 > ## ----------- ##
862 > ##    Main.    ##
863 > ## ----------- ##
864 >
865 > $opt_help || {
866 >  # Sanity checks first:
867 >  func_check_version_match
868 >
869 >  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
870 >    func_fatal_configuration "not configured to build any kind of library"
871    fi
872  
873 +  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
874 +
875 +
876 +  # Darwin sucks
877 +  eval std_shrext=\"$shrext_cmds\"
878 +
879 +
880    # Only execute mode is allowed to have -dlopen flags.
881    if test -n "$execute_dlfiles" && test "$mode" != execute; then
882 <    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
883 <    $echo "$help" 1>&2
882 >    func_error "unrecognized option \`-dlopen'"
883 >    $ECHO "$help" 1>&2
884      exit $EXIT_FAILURE
885    fi
886  
887    # Change the help message to a mode-specific one.
888    generic_help="$help"
889 <  help="Try \`$modename --help --mode=$mode' for more information."
889 >  help="Try \`$progname --help --mode=$mode' for more information."
890 > }
891 >
892 >
893 > # func_lalib_p file
894 > # True iff FILE is a libtool `.la' library or `.lo' object file.
895 > # This function is only a basic sanity check; it will hardly flush out
896 > # determined imposters.
897 > func_lalib_p ()
898 > {
899 >    test -f "$1" &&
900 >      $SED -e 4q "$1" 2>/dev/null \
901 >        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
902 > }
903 >
904 > # func_lalib_unsafe_p file
905 > # True iff FILE is a libtool `.la' library or `.lo' object file.
906 > # This function implements the same check as func_lalib_p without
907 > # resorting to external programs.  To this end, it redirects stdin and
908 > # closes it afterwards, without saving the original file descriptor.
909 > # As a safety measure, use it only where a negative result would be
910 > # fatal anyway.  Works if `file' does not exist.
911 > func_lalib_unsafe_p ()
912 > {
913 >    lalib_p=no
914 >    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
915 >        for lalib_p_l in 1 2 3 4
916 >        do
917 >            read lalib_p_line
918 >            case "$lalib_p_line" in
919 >                \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
920 >            esac
921 >        done
922 >        exec 0<&5 5<&-
923 >    fi
924 >    test "$lalib_p" = yes
925 > }
926 >
927 > # func_ltwrapper_script_p file
928 > # True iff FILE is a libtool wrapper script
929 > # This function is only a basic sanity check; it will hardly flush out
930 > # determined imposters.
931 > func_ltwrapper_script_p ()
932 > {
933 >    func_lalib_p "$1"
934 > }
935 >
936 > # func_ltwrapper_executable_p file
937 > # True iff FILE is a libtool wrapper executable
938 > # This function is only a basic sanity check; it will hardly flush out
939 > # determined imposters.
940 > func_ltwrapper_executable_p ()
941 > {
942 >    func_ltwrapper_exec_suffix=
943 >    case $1 in
944 >    *.exe) ;;
945 >    *) func_ltwrapper_exec_suffix=.exe ;;
946 >    esac
947 >    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
948 > }
949 >
950 > # func_ltwrapper_scriptname file
951 > # Assumes file is an ltwrapper_executable
952 > # uses $file to determine the appropriate filename for a
953 > # temporary ltwrapper_script.
954 > func_ltwrapper_scriptname ()
955 > {
956 >    func_ltwrapper_scriptname_result=""
957 >    if func_ltwrapper_executable_p "$1"; then
958 >        func_dirname_and_basename "$1" "" "."
959 >        func_stripname '' '.exe' "$func_basename_result"
960 >        func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
961 >    fi
962 > }
963 >
964 > # func_ltwrapper_p file
965 > # True iff FILE is a libtool wrapper script or wrapper executable
966 > # This function is only a basic sanity check; it will hardly flush out
967 > # determined imposters.
968 > func_ltwrapper_p ()
969 > {
970 >    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
971 > }
972 >
973 >
974 > # func_execute_cmds commands fail_cmd
975 > # Execute tilde-delimited COMMANDS.
976 > # If FAIL_CMD is given, eval that upon failure.
977 > # FAIL_CMD may read-access the current command in variable CMD!
978 > func_execute_cmds ()
979 > {
980 >    $opt_debug
981 >    save_ifs=$IFS; IFS='~'
982 >    for cmd in $1; do
983 >      IFS=$save_ifs
984 >      eval cmd=\"$cmd\"
985 >      func_show_eval "$cmd" "${2-:}"
986 >    done
987 >    IFS=$save_ifs
988 > }
989 >
990 >
991 > # func_source file
992 > # Source FILE, adding directory component if necessary.
993 > # Note that it is not necessary on cygwin/mingw to append a dot to
994 > # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
995 > # behavior happens only for exec(3), not for open(2)!  Also, sourcing
996 > # `FILE.' does not work on cygwin managed mounts.
997 > func_source ()
998 > {
999 >    $opt_debug
1000 >    case $1 in
1001 >    */* | *\\*) . "$1" ;;
1002 >    *)          . "./$1" ;;
1003 >    esac
1004 > }
1005 >
1006 >
1007 > # func_infer_tag arg
1008 > # Infer tagged configuration to use if any are available and
1009 > # if one wasn't chosen via the "--tag" command line option.
1010 > # Only attempt this if the compiler in the base compile
1011 > # command doesn't match the default compiler.
1012 > # arg is usually of the form 'gcc ...'
1013 > func_infer_tag ()
1014 > {
1015 >    $opt_debug
1016 >    if test -n "$available_tags" && test -z "$tagname"; then
1017 >      CC_quoted=
1018 >      for arg in $CC; do
1019 >        func_quote_for_eval "$arg"
1020 >        CC_quoted="$CC_quoted $func_quote_for_eval_result"
1021 >      done
1022 >      case $@ in
1023 >      # Blanks in the command may have been stripped by the calling shell,
1024 >      # but not from the CC environment variable when configure was run.
1025 >      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1026 >      # Blanks at the start of $base_compile will cause this to fail
1027 >      # if we don't check for them as well.
1028 >      *)
1029 >        for z in $available_tags; do
1030 >          if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1031 >            # Evaluate the configuration.
1032 >            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1033 >            CC_quoted=
1034 >            for arg in $CC; do
1035 >              # Double-quote args containing other shell metacharacters.
1036 >              func_quote_for_eval "$arg"
1037 >              CC_quoted="$CC_quoted $func_quote_for_eval_result"
1038 >            done
1039 >            case "$@ " in
1040 >              " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1041 >              # The compiler in the base compile command matches
1042 >              # the one in the tagged configuration.
1043 >              # Assume this is the tagged configuration we want.
1044 >              tagname=$z
1045 >              break
1046 >              ;;
1047 >            esac
1048 >          fi
1049 >        done
1050 >        # If $tagname still isn't set, then no tagged configuration
1051 >        # was found and let the user know that the "--tag" command
1052 >        # line option must be used.
1053 >        if test -z "$tagname"; then
1054 >          func_echo "unable to infer tagged configuration"
1055 >          func_fatal_error "specify a tag with \`--tag'"
1056 > #       else
1057 > #         func_verbose "using $tagname tagged configuration"
1058 >        fi
1059 >        ;;
1060 >      esac
1061 >    fi
1062 > }
1063 >
1064 >
1065 >
1066 > # func_write_libtool_object output_name pic_name nonpic_name
1067 > # Create a libtool object file (analogous to a ".la" file),
1068 > # but don't create it if we're doing a dry run.
1069 > func_write_libtool_object ()
1070 > {
1071 >    write_libobj=${1}
1072 >    if test "$build_libtool_libs" = yes; then
1073 >      write_lobj=\'${2}\'
1074 >    else
1075 >      write_lobj=none
1076 >    fi
1077 >
1078 >    if test "$build_old_libs" = yes; then
1079 >      write_oldobj=\'${3}\'
1080 >    else
1081 >      write_oldobj=none
1082 >    fi
1083 >
1084 >    $opt_dry_run || {
1085 >      cat >${write_libobj}T <<EOF
1086 > # $write_libobj - a libtool object file
1087 > # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1088 > #
1089 > # Please DO NOT delete this file!
1090 > # It is necessary for linking the library.
1091 >
1092 > # Name of the PIC object.
1093 > pic_object=$write_lobj
1094 >
1095 > # Name of the non-PIC object
1096 > non_pic_object=$write_oldobj
1097 >
1098 > EOF
1099 >      $MV "${write_libobj}T" "${write_libobj}"
1100 >    }
1101 > }
1102  
1103 <  # These modes are in order of execution frequency so that they run quickly.
1104 <  case $mode in
1105 <  # libtool compile mode
1106 <  compile)
652 <    modename="$modename: compile"
1103 > # func_mode_compile arg...
1104 > func_mode_compile ()
1105 > {
1106 >    $opt_debug
1107      # Get the compilation command and the source file.
1108      base_compile=
1109      srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
# Line 658 | Line 1112 | if test -z "$show_help"; then
1112      arg_mode=normal
1113      libobj=
1114      later=
1115 +    pie_flag=
1116  
1117      for arg
1118      do
# Line 678 | Line 1133 | if test -z "$show_help"; then
1133          # Accept any command-line options.
1134          case $arg in
1135          -o)
1136 <          if test -n "$libobj" ; then
1137 <            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
683 <            exit $EXIT_FAILURE
684 <          fi
1136 >          test -n "$libobj" && \
1137 >            func_fatal_error "you cannot specify \`-o' more than once"
1138            arg_mode=target
1139            continue
1140            ;;
1141  
1142 <        -static | -prefer-pic | -prefer-non-pic)
1142 >        -pie | -fpie | -fPIE)
1143 >          pie_flag="$pie_flag $arg"
1144 >          continue
1145 >          ;;
1146 >
1147 >        -shared | -static | -prefer-pic | -prefer-non-pic)
1148            later="$later $arg"
1149            continue
1150            ;;
# Line 702 | Line 1160 | if test -z "$show_help"; then
1160            ;;            #  replaced later.  I would guess that would be a bug.
1161  
1162          -Wc,*)
1163 <          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
1163 >          func_stripname '-Wc,' '' "$arg"
1164 >          args=$func_stripname_result
1165            lastarg=
1166            save_ifs="$IFS"; IFS=','
1167 <          for arg in $args; do
1167 >          for arg in $args; do
1168              IFS="$save_ifs"
1169 <
1170 <            # Double-quote args containing other shell metacharacters.
712 <            # Many Bourne shells cannot handle close brackets correctly
713 <            # in scan sets, so we specify it separately.
714 <            case $arg in
715 <              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
716 <              arg="\"$arg\""
717 <              ;;
718 <            esac
719 <            lastarg="$lastarg $arg"
1169 >            func_quote_for_eval "$arg"
1170 >            lastarg="$lastarg $func_quote_for_eval_result"
1171            done
1172            IFS="$save_ifs"
1173 <          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
1173 >          func_stripname ' ' '' "$lastarg"
1174 >          lastarg=$func_stripname_result
1175  
1176            # Add the arguments to base_compile.
1177            base_compile="$base_compile $lastarg"
1178            continue
1179            ;;
1180  
1181 <        * )
1181 >        *)
1182            # Accept the current argument as the source file.
1183            # The previous "srcfile" becomes the current argument.
1184            #
# Line 738 | Line 1190 | if test -z "$show_help"; then
1190        esac    #  case $arg_mode
1191  
1192        # Aesthetically quote the previous argument.
1193 <      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
1194 <
743 <      case $lastarg in
744 <      # Double-quote args containing other shell metacharacters.
745 <      # Many Bourne shells cannot handle close brackets correctly
746 <      # in scan sets, and some SunOS ksh mistreat backslash-escaping
747 <      # in scan sets (worked around with variable expansion),
748 <      # and furthermore cannot handle '|' '&' '(' ')' in scan sets
749 <      # at all, so we specify them separately.
750 <      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
751 <        lastarg="\"$lastarg\""
752 <        ;;
753 <      esac
754 <
755 <      base_compile="$base_compile $lastarg"
1193 >      func_quote_for_eval "$lastarg"
1194 >      base_compile="$base_compile $func_quote_for_eval_result"
1195      done # for arg
1196  
1197      case $arg_mode in
1198      arg)
1199 <      $echo "$modename: you must specify an argument for -Xcompile"
761 <      exit $EXIT_FAILURE
1199 >      func_fatal_error "you must specify an argument for -Xcompile"
1200        ;;
1201      target)
1202 <      $echo "$modename: you must specify a target with \`-o'" 1>&2
765 <      exit $EXIT_FAILURE
1202 >      func_fatal_error "you must specify a target with \`-o'"
1203        ;;
1204      *)
1205        # Get the name of the library object.
1206 <      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
1206 >      test -z "$libobj" && {
1207 >        func_basename "$srcfile"
1208 >        libobj="$func_basename_result"
1209 >      }
1210        ;;
1211      esac
1212  
1213      # Recognize several different file suffixes.
1214      # If the user specifies -o file.o, it is replaced with file.lo
775    xform='[cCFSifmso]'
1215      case $libobj in
1216 <    *.ada) xform=ada ;;
1217 <    *.adb) xform=adb ;;
1218 <    *.ads) xform=ads ;;
1219 <    *.asm) xform=asm ;;
1220 <    *.c++) xform=c++ ;;
1221 <    *.cc) xform=cc ;;
1222 <    *.ii) xform=ii ;;
784 <    *.class) xform=class ;;
785 <    *.cpp) xform=cpp ;;
786 <    *.cxx) xform=cxx ;;
787 <    *.[fF][09]?) xform=[fF][09]. ;;
788 <    *.for) xform=for ;;
789 <    *.java) xform=java ;;
790 <    *.obj) xform=obj ;;
1216 >    *.[cCFSifmso] | \
1217 >    *.ada | *.adb | *.ads | *.asm | \
1218 >    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1219 >    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1220 >      func_xform "$libobj"
1221 >      libobj=$func_xform_result
1222 >      ;;
1223      esac
1224  
793    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
794
1225      case $libobj in
1226 <    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
1226 >    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1227      *)
1228 <      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
799 <      exit $EXIT_FAILURE
1228 >      func_fatal_error "cannot determine name of library object from \`$libobj'"
1229        ;;
1230      esac
1231  
# Line 804 | Line 1233 | if test -z "$show_help"; then
1233  
1234      for arg in $later; do
1235        case $arg in
1236 +      -shared)
1237 +        test "$build_libtool_libs" != yes && \
1238 +          func_fatal_configuration "can not build a shared library"
1239 +        build_old_libs=no
1240 +        continue
1241 +        ;;
1242 +
1243        -static)
1244 +        build_libtool_libs=no
1245          build_old_libs=yes
1246          continue
1247          ;;
# Line 821 | Line 1258 | if test -z "$show_help"; then
1258        esac
1259      done
1260  
1261 <    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
1262 <    case $qlibobj in
1263 <      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
1264 <        qlibobj="\"$qlibobj\"" ;;
1265 <    esac
1266 <    test "X$libobj" != "X$qlibobj" \
1267 <        && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
831 <        && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
832 <    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
833 <    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
834 <    if test "X$xdir" = "X$obj"; then
835 <      xdir=
836 <    else
837 <      xdir=$xdir/
838 <    fi
1261 >    func_quote_for_eval "$libobj"
1262 >    test "X$libobj" != "X$func_quote_for_eval_result" \
1263 >      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'    &()|`$[]' \
1264 >      && func_warning "libobj name \`$libobj' may not contain shell special characters."
1265 >    func_dirname_and_basename "$obj" "/" ""
1266 >    objname="$func_basename_result"
1267 >    xdir="$func_dirname_result"
1268      lobj=${xdir}$objdir/$objname
1269  
1270 <    if test -z "$base_compile"; then
1271 <      $echo "$modename: you must specify a compilation command" 1>&2
843 <      $echo "$help" 1>&2
844 <      exit $EXIT_FAILURE
845 <    fi
1270 >    test -z "$base_compile" && \
1271 >      func_fatal_help "you must specify a compilation command"
1272  
1273      # Delete any leftover library objects.
1274      if test "$build_old_libs" = yes; then
# Line 851 | Line 1277 | if test -z "$show_help"; then
1277        removelist="$lobj $libobj ${libobj}T"
1278      fi
1279  
854    $run $rm $removelist
855    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
856
1280      # On Cygwin there's no "real" PIC flag so we must build both object types
1281      case $host_os in
1282 <    cygwin* | mingw* | pw32* | os2*)
1282 >    cygwin* | mingw* | pw32* | os2* | cegcc*)
1283        pic_mode=default
1284        ;;
1285      esac
# Line 868 | Line 1291 | if test -z "$show_help"; then
1291      # Calculate the filename of the output object if compiler does
1292      # not support -o with -c
1293      if test "$compiler_c_o" = no; then
1294 <      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1294 >      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1295        lockfile="$output_obj.lock"
873      removelist="$removelist $output_obj $lockfile"
874      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
1296      else
1297        output_obj=
1298        need_locks=no
# Line 881 | Line 1302 | if test -z "$show_help"; then
1302      # Lock this critical section if it is needed
1303      # We use this script file to make the link, it avoids creating a new file
1304      if test "$need_locks" = yes; then
1305 <      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
1306 <        $show "Waiting for $lockfile to be removed"
1305 >      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1306 >        func_echo "Waiting for $lockfile to be removed"
1307          sleep 2
1308        done
1309      elif test "$need_locks" = warn; then
1310        if test -f "$lockfile"; then
1311 <        $echo "\
1311 >        $ECHO "\
1312   *** ERROR, $lockfile exists and contains:
1313   `cat $lockfile 2>/dev/null`
1314  
# Line 898 | Line 1319 | repeat this compilation, it may succeed,
1319   avoid parallel builds (make -j) in this platform, or get a better
1320   compiler."
1321  
1322 <        $run $rm $removelist
1322 >        $opt_dry_run || $RM $removelist
1323          exit $EXIT_FAILURE
1324        fi
1325 <      $echo "$srcfile" > "$lockfile"
1325 >      removelist="$removelist $output_obj"
1326 >      $ECHO "$srcfile" > "$lockfile"
1327      fi
1328  
1329 +    $opt_dry_run || $RM $removelist
1330 +    removelist="$removelist $lockfile"
1331 +    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1332 +
1333      if test -n "$fix_srcfile_path"; then
1334        eval srcfile=\"$fix_srcfile_path\"
1335      fi
1336 <    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
1337 <    case $qsrcfile in
912 <      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
913 <      qsrcfile="\"$qsrcfile\"" ;;
914 <    esac
915 <
916 <    $run $rm "$libobj" "${libobj}T"
917 <
918 <    # Create a libtool object file (analogous to a ".la" file),
919 <    # but don't create it if we're doing a dry run.
920 <    test -z "$run" && cat > ${libobj}T <<EOF
921 < # $libobj - a libtool object file
922 < # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
923 < #
924 < # Please DO NOT delete this file!
925 < # It is necessary for linking the library.
926 <
927 < # Name of the PIC object.
928 < EOF
1336 >    func_quote_for_eval "$srcfile"
1337 >    qsrcfile=$func_quote_for_eval_result
1338  
1339      # Only build a PIC object if we are building libtool libraries.
1340      if test "$build_libtool_libs" = yes; then
# Line 939 | Line 1348 | EOF
1348          command="$base_compile $qsrcfile"
1349        fi
1350  
1351 <      if test ! -d "${xdir}$objdir"; then
943 <        $show "$mkdir ${xdir}$objdir"
944 <        $run $mkdir ${xdir}$objdir
945 <        exit_status=$?
946 <        if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
947 <          exit $exit_status
948 <        fi
949 <      fi
1351 >      func_mkdir_p "$xdir$objdir"
1352  
1353        if test -z "$output_obj"; then
1354          # Place PIC objects in $objdir
1355          command="$command -o $lobj"
1356        fi
1357  
1358 <      $run $rm "$lobj" "$output_obj"
1359 <
958 <      $show "$command"
959 <      if $run eval "$command"; then :
960 <      else
961 <        test -n "$output_obj" && $run $rm $removelist
962 <        exit $EXIT_FAILURE
963 <      fi
1358 >      func_show_eval_locale "$command"  \
1359 >          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1360  
1361        if test "$need_locks" = warn &&
1362           test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1363 <        $echo "\
1363 >        $ECHO "\
1364   *** ERROR, $lockfile contains:
1365   `cat $lockfile 2>/dev/null`
1366  
# Line 978 | Line 1374 | repeat this compilation, it may succeed,
1374   avoid parallel builds (make -j) in this platform, or get a better
1375   compiler."
1376  
1377 <        $run $rm $removelist
1377 >        $opt_dry_run || $RM $removelist
1378          exit $EXIT_FAILURE
1379        fi
1380  
1381        # Just move the object if needed, then go on to compile the next one
1382        if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1383 <        $show "$mv $output_obj $lobj"
1384 <        if $run $mv $output_obj $lobj; then :
989 <        else
990 <          error=$?
991 <          $run $rm $removelist
992 <          exit $error
993 <        fi
1383 >        func_show_eval '$MV "$output_obj" "$lobj"' \
1384 >          'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1385        fi
1386  
996      # Append the name of the PIC object to the libtool object file.
997      test -z "$run" && cat >> ${libobj}T <<EOF
998 pic_object='$objdir/$objname'
999
1000 EOF
1001
1387        # Allow error messages only from the first compilation.
1388        if test "$suppress_opt" = yes; then
1389 <        suppress_output=' >/dev/null 2>&1'
1389 >        suppress_output=' >/dev/null 2>&1'
1390        fi
1006    else
1007      # No PIC object so indicate it doesn't exist in the libtool
1008      # object file.
1009      test -z "$run" && cat >> ${libobj}T <<EOF
1010 pic_object=none
1011
1012 EOF
1391      fi
1392  
1393      # Only build a position-dependent object if we build old libraries.
1394      if test "$build_old_libs" = yes; then
1395        if test "$pic_mode" != yes; then
1396          # Don't build PIC code
1397 <        command="$base_compile $qsrcfile"
1397 >        command="$base_compile $qsrcfile$pie_flag"
1398        else
1399          command="$base_compile $qsrcfile $pic_flag"
1400        fi
# Line 1026 | Line 1404 | EOF
1404  
1405        # Suppress compiler output if we already did a PIC compilation.
1406        command="$command$suppress_output"
1407 <      $run $rm "$obj" "$output_obj"
1408 <      $show "$command"
1031 <      if $run eval "$command"; then :
1032 <      else
1033 <        $run $rm $removelist
1034 <        exit $EXIT_FAILURE
1035 <      fi
1407 >      func_show_eval_locale "$command" \
1408 >        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1409  
1410        if test "$need_locks" = warn &&
1411           test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1412 <        $echo "\
1412 >        $ECHO "\
1413   *** ERROR, $lockfile contains:
1414   `cat $lockfile 2>/dev/null`
1415  
# Line 1050 | Line 1423 | repeat this compilation, it may succeed,
1423   avoid parallel builds (make -j) in this platform, or get a better
1424   compiler."
1425  
1426 <        $run $rm $removelist
1426 >        $opt_dry_run || $RM $removelist
1427          exit $EXIT_FAILURE
1428        fi
1429  
1430        # Just move the object if needed
1431        if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1432 <        $show "$mv $output_obj $obj"
1433 <        if $run $mv $output_obj $obj; then :
1432 >        func_show_eval '$MV "$output_obj" "$obj"' \
1433 >          'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1434 >      fi
1435 >    fi
1436 >
1437 >    $opt_dry_run || {
1438 >      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1439 >
1440 >      # Unlock the critical section if it was locked
1441 >      if test "$need_locks" != no; then
1442 >        removelist=$lockfile
1443 >        $RM "$lockfile"
1444 >      fi
1445 >    }
1446 >
1447 >    exit $EXIT_SUCCESS
1448 > }
1449 >
1450 > $opt_help || {
1451 > test "$mode" = compile && func_mode_compile ${1+"$@"}
1452 > }
1453 >
1454 > func_mode_help ()
1455 > {
1456 >    # We need to display help for each of the modes.
1457 >    case $mode in
1458 >      "")
1459 >        # Generic help is extracted from the usage comments
1460 >        # at the start of this file.
1461 >        func_help
1462 >        ;;
1463 >
1464 >      clean)
1465 >        $ECHO \
1466 > "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1467 >
1468 > Remove files from the build directory.
1469 >
1470 > RM is the name of the program to use to delete files associated with each FILE
1471 > (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
1472 > to RM.
1473 >
1474 > If FILE is a libtool library, object or program, all the files associated
1475 > with it are deleted. Otherwise, only FILE itself is deleted using RM."
1476 >        ;;
1477 >
1478 >      compile)
1479 >      $ECHO \
1480 > "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1481 >
1482 > Compile a source file into a libtool library object.
1483 >
1484 > This mode accepts the following additional options:
1485 >
1486 >  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
1487 >  -no-suppress      do not suppress compiler output for multiple passes
1488 >  -prefer-pic       try to building PIC objects only
1489 >  -prefer-non-pic   try to building non-PIC objects only
1490 >  -shared           do not build a \`.o' file suitable for static linking
1491 >  -static           only build a \`.o' file suitable for static linking
1492 >
1493 > COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1494 > from the given SOURCEFILE.
1495 >
1496 > The output file name is determined by removing the directory component from
1497 > SOURCEFILE, then substituting the C source code suffix \`.c' with the
1498 > library object suffix, \`.lo'."
1499 >        ;;
1500 >
1501 >      execute)
1502 >        $ECHO \
1503 > "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1504 >
1505 > Automatically set library path, then run a program.
1506 >
1507 > This mode accepts the following additional options:
1508 >
1509 >  -dlopen FILE      add the directory containing FILE to the library path
1510 >
1511 > This mode sets the library path environment variable according to \`-dlopen'
1512 > flags.
1513 >
1514 > If any of the ARGS are libtool executable wrappers, then they are translated
1515 > into their corresponding uninstalled binary, and any of their required library
1516 > directories are added to the library path.
1517 >
1518 > Then, COMMAND is executed, with ARGS as arguments."
1519 >        ;;
1520 >
1521 >      finish)
1522 >        $ECHO \
1523 > "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1524 >
1525 > Complete the installation of libtool libraries.
1526 >
1527 > Each LIBDIR is a directory that contains libtool libraries.
1528 >
1529 > The commands that this mode executes may require superuser privileges.  Use
1530 > the \`--dry-run' option if you just want to see what would be executed."
1531 >        ;;
1532 >
1533 >      install)
1534 >        $ECHO \
1535 > "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1536 >
1537 > Install executables or libraries.
1538 >
1539 > INSTALL-COMMAND is the installation command.  The first component should be
1540 > either the \`install' or \`cp' program.
1541 >
1542 > The following components of INSTALL-COMMAND are treated specially:
1543 >
1544 >  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
1545 >
1546 > The rest of the components are interpreted as arguments to that command (only
1547 > BSD-compatible install options are recognized)."
1548 >        ;;
1549 >
1550 >      link)
1551 >        $ECHO \
1552 > "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1553 >
1554 > Link object files or libraries together to form another library, or to
1555 > create an executable program.
1556 >
1557 > LINK-COMMAND is a command using the C compiler that you would use to create
1558 > a program from several object files.
1559 >
1560 > The following components of LINK-COMMAND are treated specially:
1561 >
1562 >  -all-static       do not do any dynamic linking at all
1563 >  -avoid-version    do not add a version suffix if possible
1564 >  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
1565 >  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
1566 >  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1567 >  -export-symbols SYMFILE
1568 >                    try to export only the symbols listed in SYMFILE
1569 >  -export-symbols-regex REGEX
1570 >                    try to export only the symbols matching REGEX
1571 >  -LLIBDIR          search LIBDIR for required installed libraries
1572 >  -lNAME            OUTPUT-FILE requires the installed library libNAME
1573 >  -module           build a library that can dlopened
1574 >  -no-fast-install  disable the fast-install mode
1575 >  -no-install       link a not-installable executable
1576 >  -no-undefined     declare that a library does not refer to external symbols
1577 >  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
1578 >  -objectlist FILE  Use a list of object files found in FILE to specify objects
1579 >  -precious-files-regex REGEX
1580 >                    don't remove output files matching REGEX
1581 >  -release RELEASE  specify package release information
1582 >  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
1583 >  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
1584 >  -shared           only do dynamic linking of libtool libraries
1585 >  -shrext SUFFIX    override the standard shared library file extension
1586 >  -static           do not do any dynamic linking of uninstalled libtool libraries
1587 >  -static-libtool-libs
1588 >                    do not do any dynamic linking of libtool libraries
1589 >  -version-info CURRENT[:REVISION[:AGE]]
1590 >                    specify library version info [each variable defaults to 0]
1591 >  -weak LIBNAME     declare that the target provides the LIBNAME interface
1592 >
1593 > All other options (arguments beginning with \`-') are ignored.
1594 >
1595 > Every other argument is treated as a filename.  Files ending in \`.la' are
1596 > treated as uninstalled libtool libraries, other files are standard or library
1597 > object files.
1598 >
1599 > If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1600 > only library objects (\`.lo' files) may be specified, and \`-rpath' is
1601 > required, except when creating a convenience library.
1602 >
1603 > If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1604 > using \`ar' and \`ranlib', or on Windows using \`lib'.
1605 >
1606 > If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1607 > is created, otherwise an executable program is created."
1608 >        ;;
1609 >
1610 >      uninstall)
1611 >        $ECHO \
1612 > "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1613 >
1614 > Remove libraries from an installation directory.
1615 >
1616 > RM is the name of the program to use to delete files associated with each FILE
1617 > (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
1618 > to RM.
1619 >
1620 > If FILE is a libtool library, all the files associated with it are deleted.
1621 > Otherwise, only FILE itself is deleted using RM."
1622 >        ;;
1623 >
1624 >      *)
1625 >        func_fatal_help "invalid operation mode \`$mode'"
1626 >        ;;
1627 >    esac
1628 >
1629 >    $ECHO
1630 >    $ECHO "Try \`$progname --help' for more information about other modes."
1631 >
1632 >    exit $?
1633 > }
1634 >
1635 >  # Now that we've collected a possible --mode arg, show help if necessary
1636 >  $opt_help && func_mode_help
1637 >
1638 >
1639 > # func_mode_execute arg...
1640 > func_mode_execute ()
1641 > {
1642 >    $opt_debug
1643 >    # The first argument is the command name.
1644 >    cmd="$nonopt"
1645 >    test -z "$cmd" && \
1646 >      func_fatal_help "you must specify a COMMAND"
1647 >
1648 >    # Handle -dlopen flags immediately.
1649 >    for file in $execute_dlfiles; do
1650 >      test -f "$file" \
1651 >        || func_fatal_help "\`$file' is not a file"
1652 >
1653 >      dir=
1654 >      case $file in
1655 >      *.la)
1656 >        # Check to see that this really is a libtool archive.
1657 >        func_lalib_unsafe_p "$file" \
1658 >          || func_fatal_help "\`$lib' is not a valid libtool archive"
1659 >
1660 >        # Read the libtool library.
1661 >        dlname=
1662 >        library_names=
1663 >        func_source "$file"
1664 >
1665 >        # Skip this library if it cannot be dlopened.
1666 >        if test -z "$dlname"; then
1667 >          # Warn if it was a shared library.
1668 >          test -n "$library_names" && \
1669 >            func_warning "\`$file' was not linked with \`-export-dynamic'"
1670 >          continue
1671 >        fi
1672 >
1673 >        func_dirname "$file" "" "."
1674 >        dir="$func_dirname_result"
1675 >
1676 >        if test -f "$dir/$objdir/$dlname"; then
1677 >          dir="$dir/$objdir"
1678          else
1679 <          error=$?
1680 <          $run $rm $removelist
1681 <          exit $error
1679 >          if test ! -f "$dir/$dlname"; then
1680 >            func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1681 >          fi
1682          fi
1683 +        ;;
1684 +
1685 +      *.lo)
1686 +        # Just add the directory containing the .lo file.
1687 +        func_dirname "$file" "" "."
1688 +        dir="$func_dirname_result"
1689 +        ;;
1690 +
1691 +      *)
1692 +        func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1693 +        continue
1694 +        ;;
1695 +      esac
1696 +
1697 +      # Get the absolute pathname.
1698 +      absdir=`cd "$dir" && pwd`
1699 +      test -n "$absdir" && dir="$absdir"
1700 +
1701 +      # Now add the directory to shlibpath_var.
1702 +      if eval "test -z \"\$$shlibpath_var\""; then
1703 +        eval "$shlibpath_var=\"\$dir\""
1704 +      else
1705 +        eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1706        fi
1707 +    done
1708  
1709 <      # Append the name of the non-PIC object the libtool object file.
1710 <      # Only append if the libtool object file exists.
1711 <      test -z "$run" && cat >> ${libobj}T <<EOF
1071 < # Name of the non-PIC object.
1072 < non_pic_object='$objname'
1709 >    # This variable tells wrapper scripts just to set shlibpath_var
1710 >    # rather than running their programs.
1711 >    libtool_execute_magic="$magic"
1712  
1713 < EOF
1713 >    # Check if any of the arguments is a wrapper script.
1714 >    args=
1715 >    for file
1716 >    do
1717 >      case $file in
1718 >      -*) ;;
1719 >      *)
1720 >        # Do a test to see if this is really a libtool program.
1721 >        if func_ltwrapper_script_p "$file"; then
1722 >          func_source "$file"
1723 >          # Transform arg to wrapped name.
1724 >          file="$progdir/$program"
1725 >        elif func_ltwrapper_executable_p "$file"; then
1726 >          func_ltwrapper_scriptname "$file"
1727 >          func_source "$func_ltwrapper_scriptname_result"
1728 >          # Transform arg to wrapped name.
1729 >          file="$progdir/$program"
1730 >        fi
1731 >        ;;
1732 >      esac
1733 >      # Quote arguments (to preserve shell metacharacters).
1734 >      func_quote_for_eval "$file"
1735 >      args="$args $func_quote_for_eval_result"
1736 >    done
1737 >
1738 >    if test "X$opt_dry_run" = Xfalse; then
1739 >      if test -n "$shlibpath_var"; then
1740 >        # Export the shlibpath_var.
1741 >        eval "export $shlibpath_var"
1742 >      fi
1743 >
1744 >      # Restore saved environment variables
1745 >      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1746 >      do
1747 >        eval "if test \"\${save_$lt_var+set}\" = set; then
1748 >                $lt_var=\$save_$lt_var; export $lt_var
1749 >              else
1750 >                $lt_unset $lt_var
1751 >              fi"
1752 >      done
1753 >
1754 >      # Now prepare to actually exec the command.
1755 >      exec_cmd="\$cmd$args"
1756      else
1757 <      # Append the name of the non-PIC object the libtool object file.
1758 <      # Only append if the libtool object file exists.
1759 <      test -z "$run" && cat >> ${libobj}T <<EOF
1760 < # Name of the non-PIC object.
1761 < non_pic_object=none
1757 >      # Display what would be done.
1758 >      if test -n "$shlibpath_var"; then
1759 >        eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1760 >        $ECHO "export $shlibpath_var"
1761 >      fi
1762 >      $ECHO "$cmd$args"
1763 >      exit $EXIT_SUCCESS
1764 >    fi
1765 > }
1766  
1767 < EOF
1767 > test "$mode" = execute && func_mode_execute ${1+"$@"}
1768 >
1769 >
1770 > # func_mode_finish arg...
1771 > func_mode_finish ()
1772 > {
1773 >    $opt_debug
1774 >    libdirs="$nonopt"
1775 >    admincmds=
1776 >
1777 >    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1778 >      for dir
1779 >      do
1780 >        libdirs="$libdirs $dir"
1781 >      done
1782 >
1783 >      for libdir in $libdirs; do
1784 >        if test -n "$finish_cmds"; then
1785 >          # Do each command in the finish commands.
1786 >          func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1787 > '"$cmd"'"'
1788 >        fi
1789 >        if test -n "$finish_eval"; then
1790 >          # Do the single finish_eval.
1791 >          eval cmds=\"$finish_eval\"
1792 >          $opt_dry_run || eval "$cmds" || admincmds="$admincmds
1793 >       $cmds"
1794 >        fi
1795 >      done
1796      fi
1797  
1798 <    $run $mv "${libobj}T" "${libobj}"
1798 >    # Exit here if they wanted silent mode.
1799 >    $opt_silent && exit $EXIT_SUCCESS
1800 >
1801 >    $ECHO "X----------------------------------------------------------------------" | $Xsed
1802 >    $ECHO "Libraries have been installed in:"
1803 >    for libdir in $libdirs; do
1804 >      $ECHO "   $libdir"
1805 >    done
1806 >    $ECHO
1807 >    $ECHO "If you ever happen to want to link against installed libraries"
1808 >    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
1809 >    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
1810 >    $ECHO "flag during linking and do at least one of the following:"
1811 >    if test -n "$shlibpath_var"; then
1812 >      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
1813 >      $ECHO "     during execution"
1814 >    fi
1815 >    if test -n "$runpath_var"; then
1816 >      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
1817 >      $ECHO "     during linking"
1818 >    fi
1819 >    if test -n "$hardcode_libdir_flag_spec"; then
1820 >      libdir=LIBDIR
1821 >      eval flag=\"$hardcode_libdir_flag_spec\"
1822  
1823 <    # Unlock the critical section if it was locked
1824 <    if test "$need_locks" != no; then
1825 <      $run $rm "$lockfile"
1823 >      $ECHO "   - use the \`$flag' linker flag"
1824 >    fi
1825 >    if test -n "$admincmds"; then
1826 >      $ECHO "   - have your system administrator run these commands:$admincmds"
1827      fi
1828 +    if test -f /etc/ld.so.conf; then
1829 +      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1830 +    fi
1831 +    $ECHO
1832  
1833 +    $ECHO "See any operating system documentation about shared libraries for"
1834 +    case $host in
1835 +      solaris2.[6789]|solaris2.1[0-9])
1836 +        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1837 +        $ECHO "pages."
1838 +        ;;
1839 +      *)
1840 +        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
1841 +        ;;
1842 +    esac
1843 +    $ECHO "X----------------------------------------------------------------------" | $Xsed
1844      exit $EXIT_SUCCESS
1845 + }
1846 +
1847 + test "$mode" = finish && func_mode_finish ${1+"$@"}
1848 +
1849 +
1850 + # func_mode_install arg...
1851 + func_mode_install ()
1852 + {
1853 +    $opt_debug
1854 +    # There may be an optional sh(1) argument at the beginning of
1855 +    # install_prog (especially on Windows NT).
1856 +    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
1857 +       # Allow the use of GNU shtool's install command.
1858 +       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
1859 +      # Aesthetically quote it.
1860 +      func_quote_for_eval "$nonopt"
1861 +      install_prog="$func_quote_for_eval_result "
1862 +      arg=$1
1863 +      shift
1864 +    else
1865 +      install_prog=
1866 +      arg=$nonopt
1867 +    fi
1868 +
1869 +    # The real first argument should be the name of the installation program.
1870 +    # Aesthetically quote it.
1871 +    func_quote_for_eval "$arg"
1872 +    install_prog="$install_prog$func_quote_for_eval_result"
1873 +
1874 +    # We need to accept at least all the BSD install flags.
1875 +    dest=
1876 +    files=
1877 +    opts=
1878 +    prev=
1879 +    install_type=
1880 +    isdir=no
1881 +    stripme=
1882 +    for arg
1883 +    do
1884 +      if test -n "$dest"; then
1885 +        files="$files $dest"
1886 +        dest=$arg
1887 +        continue
1888 +      fi
1889 +
1890 +      case $arg in
1891 +      -d) isdir=yes ;;
1892 +      -f)
1893 +        case " $install_prog " in
1894 +        *[\\\ /]cp\ *) ;;
1895 +        *) prev=$arg ;;
1896 +        esac
1897 +        ;;
1898 +      -g | -m | -o)
1899 +        prev=$arg
1900 +        ;;
1901 +      -s)
1902 +        stripme=" -s"
1903 +        continue
1904 +        ;;
1905 +      -*)
1906 +        ;;
1907 +      *)
1908 +        # If the previous option needed an argument, then skip it.
1909 +        if test -n "$prev"; then
1910 +          prev=
1911 +        else
1912 +          dest=$arg
1913 +          continue
1914 +        fi
1915 +        ;;
1916 +      esac
1917 +
1918 +      # Aesthetically quote the argument.
1919 +      func_quote_for_eval "$arg"
1920 +      install_prog="$install_prog $func_quote_for_eval_result"
1921 +    done
1922 +
1923 +    test -z "$install_prog" && \
1924 +      func_fatal_help "you must specify an install program"
1925 +
1926 +    test -n "$prev" && \
1927 +      func_fatal_help "the \`$prev' option requires an argument"
1928 +
1929 +    if test -z "$files"; then
1930 +      if test -z "$dest"; then
1931 +        func_fatal_help "no file or destination specified"
1932 +      else
1933 +        func_fatal_help "you must specify a destination"
1934 +      fi
1935 +    fi
1936 +
1937 +    # Strip any trailing slash from the destination.
1938 +    func_stripname '' '/' "$dest"
1939 +    dest=$func_stripname_result
1940 +
1941 +    # Check to see that the destination is a directory.
1942 +    test -d "$dest" && isdir=yes
1943 +    if test "$isdir" = yes; then
1944 +      destdir="$dest"
1945 +      destname=
1946 +    else
1947 +      func_dirname_and_basename "$dest" "" "."
1948 +      destdir="$func_dirname_result"
1949 +      destname="$func_basename_result"
1950 +
1951 +      # Not a directory, so check to see that there is only one file specified.
1952 +      set dummy $files; shift
1953 +      test "$#" -gt 1 && \
1954 +        func_fatal_help "\`$dest' is not a directory"
1955 +    fi
1956 +    case $destdir in
1957 +    [\\/]* | [A-Za-z]:[\\/]*) ;;
1958 +    *)
1959 +      for file in $files; do
1960 +        case $file in
1961 +        *.lo) ;;
1962 +        *)
1963 +          func_fatal_help "\`$destdir' must be an absolute directory name"
1964 +          ;;
1965 +        esac
1966 +      done
1967 +      ;;
1968 +    esac
1969 +
1970 +    # This variable tells wrapper scripts just to set variables rather
1971 +    # than running their programs.
1972 +    libtool_install_magic="$magic"
1973 +
1974 +    staticlibs=
1975 +    future_libdirs=
1976 +    current_libdirs=
1977 +    for file in $files; do
1978 +
1979 +      # Do each installation.
1980 +      case $file in
1981 +      *.$libext)
1982 +        # Do the static libraries later.
1983 +        staticlibs="$staticlibs $file"
1984 +        ;;
1985 +
1986 +      *.la)
1987 +        # Check to see that this really is a libtool archive.
1988 +        func_lalib_unsafe_p "$file" \
1989 +          || func_fatal_help "\`$file' is not a valid libtool archive"
1990 +
1991 +        library_names=
1992 +        old_library=
1993 +        relink_command=
1994 +        func_source "$file"
1995 +
1996 +        # Add the libdir to current_libdirs if it is the destination.
1997 +        if test "X$destdir" = "X$libdir"; then
1998 +          case "$current_libdirs " in
1999 +          *" $libdir "*) ;;
2000 +          *) current_libdirs="$current_libdirs $libdir" ;;
2001 +          esac
2002 +        else
2003 +          # Note the libdir as a future libdir.
2004 +          case "$future_libdirs " in
2005 +          *" $libdir "*) ;;
2006 +          *) future_libdirs="$future_libdirs $libdir" ;;
2007 +          esac
2008 +        fi
2009 +
2010 +        func_dirname "$file" "/" ""
2011 +        dir="$func_dirname_result"
2012 +        dir="$dir$objdir"
2013 +
2014 +        if test -n "$relink_command"; then
2015 +          # Determine the prefix the user has applied to our future dir.
2016 +          inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2017 +
2018 +          # Don't allow the user to place us outside of our expected
2019 +          # location b/c this prevents finding dependent libraries that
2020 +          # are installed to the same prefix.
2021 +          # At present, this check doesn't affect windows .dll's that
2022 +          # are installed into $libdir/../bin (currently, that works fine)
2023 +          # but it's something to keep an eye on.
2024 +          test "$inst_prefix_dir" = "$destdir" && \
2025 +            func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2026 +
2027 +          if test -n "$inst_prefix_dir"; then
2028 +            # Stick the inst_prefix_dir data into the link command.
2029 +            relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2030 +          else
2031 +            relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2032 +          fi
2033 +
2034 +          func_warning "relinking \`$file'"
2035 +          func_show_eval "$relink_command" \
2036 +            'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2037 +        fi
2038 +
2039 +        # See the names of the shared library.
2040 +        set dummy $library_names; shift
2041 +        if test -n "$1"; then
2042 +          realname="$1"
2043 +          shift
2044 +
2045 +          srcname="$realname"
2046 +          test -n "$relink_command" && srcname="$realname"T
2047 +
2048 +          # Install the shared library and build the symlinks.
2049 +          func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2050 +              'exit $?'
2051 +          tstripme="$stripme"
2052 +          case $host_os in
2053 +          cygwin* | mingw* | pw32* | cegcc*)
2054 +            case $realname in
2055 +            *.dll.a)
2056 +              tstripme=""
2057 +              ;;
2058 +            esac
2059 +            ;;
2060 +          esac
2061 +          if test -n "$tstripme" && test -n "$striplib"; then
2062 +            func_show_eval "$striplib $destdir/$realname" 'exit $?'
2063 +          fi
2064 +
2065 +          if test "$#" -gt 0; then
2066 +            # Delete the old symlinks, and create new ones.
2067 +            # Try `ln -sf' first, because the `ln' binary might depend on
2068 +            # the symlink we replace!  Solaris /bin/ln does not understand -f,
2069 +            # so we also need to try rm && ln -s.
2070 +            for linkname
2071 +            do
2072 +              test "$linkname" != "$realname" \
2073 +                && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2074 +            done
2075 +          fi
2076 +
2077 +          # Do each command in the postinstall commands.
2078 +          lib="$destdir/$realname"
2079 +          func_execute_cmds "$postinstall_cmds" 'exit $?'
2080 +        fi
2081 +
2082 +        # Install the pseudo-library for information purposes.
2083 +        func_basename "$file"
2084 +        name="$func_basename_result"
2085 +        instname="$dir/$name"i
2086 +        func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2087 +
2088 +        # Maybe install the static library, too.
2089 +        test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2090 +        ;;
2091 +
2092 +      *.lo)
2093 +        # Install (i.e. copy) a libtool object.
2094 +
2095 +        # Figure out destination file name, if it wasn't already specified.
2096 +        if test -n "$destname"; then
2097 +          destfile="$destdir/$destname"
2098 +        else
2099 +          func_basename "$file"
2100 +          destfile="$func_basename_result"
2101 +          destfile="$destdir/$destfile"
2102 +        fi
2103 +
2104 +        # Deduce the name of the destination old-style object file.
2105 +        case $destfile in
2106 +        *.lo)
2107 +          func_lo2o "$destfile"
2108 +          staticdest=$func_lo2o_result
2109 +          ;;
2110 +        *.$objext)
2111 +          staticdest="$destfile"
2112 +          destfile=
2113 +          ;;
2114 +        *)
2115 +          func_fatal_help "cannot copy a libtool object to \`$destfile'"
2116 +          ;;
2117 +        esac
2118 +
2119 +        # Install the libtool object if requested.
2120 +        test -n "$destfile" && \
2121 +          func_show_eval "$install_prog $file $destfile" 'exit $?'
2122 +
2123 +        # Install the old object if enabled.
2124 +        if test "$build_old_libs" = yes; then
2125 +          # Deduce the name of the old-style object file.
2126 +          func_lo2o "$file"
2127 +          staticobj=$func_lo2o_result
2128 +          func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2129 +        fi
2130 +        exit $EXIT_SUCCESS
2131 +        ;;
2132 +
2133 +      *)
2134 +        # Figure out destination file name, if it wasn't already specified.
2135 +        if test -n "$destname"; then
2136 +          destfile="$destdir/$destname"
2137 +        else
2138 +          func_basename "$file"
2139 +          destfile="$func_basename_result"
2140 +          destfile="$destdir/$destfile"
2141 +        fi
2142 +
2143 +        # If the file is missing, and there is a .exe on the end, strip it
2144 +        # because it is most likely a libtool script we actually want to
2145 +        # install
2146 +        stripped_ext=""
2147 +        case $file in
2148 +          *.exe)
2149 +            if test ! -f "$file"; then
2150 +              func_stripname '' '.exe' "$file"
2151 +              file=$func_stripname_result
2152 +              stripped_ext=".exe"
2153 +            fi
2154 +            ;;
2155 +        esac
2156 +
2157 +        # Do a test to see if this is really a libtool program.
2158 +        case $host in
2159 +        *cygwin* | *mingw*)
2160 +            if func_ltwrapper_executable_p "$file"; then
2161 +              func_ltwrapper_scriptname "$file"
2162 +              wrapper=$func_ltwrapper_scriptname_result
2163 +            else
2164 +              func_stripname '' '.exe' "$file"
2165 +              wrapper=$func_stripname_result
2166 +            fi
2167 +            ;;
2168 +        *)
2169 +            wrapper=$file
2170 +            ;;
2171 +        esac
2172 +        if func_ltwrapper_script_p "$wrapper"; then
2173 +          notinst_deplibs=
2174 +          relink_command=
2175 +
2176 +          func_source "$wrapper"
2177 +
2178 +          # Check the variables that should have been set.
2179 +          test -z "$generated_by_libtool_version" && \
2180 +            func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2181 +
2182 +          finalize=yes
2183 +          for lib in $notinst_deplibs; do
2184 +            # Check to see that each library is installed.
2185 +            libdir=
2186 +            if test -f "$lib"; then
2187 +              func_source "$lib"
2188 +            fi
2189 +            libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2190 +            if test -n "$libdir" && test ! -f "$libfile"; then
2191 +              func_warning "\`$lib' has not been installed in \`$libdir'"
2192 +              finalize=no
2193 +            fi
2194 +          done
2195 +
2196 +          relink_command=
2197 +          func_source "$wrapper"
2198 +
2199 +          outputname=
2200 +          if test "$fast_install" = no && test -n "$relink_command"; then
2201 +            $opt_dry_run || {
2202 +              if test "$finalize" = yes; then
2203 +                tmpdir=`func_mktempdir`
2204 +                func_basename "$file$stripped_ext"
2205 +                file="$func_basename_result"
2206 +                outputname="$tmpdir/$file"
2207 +                # Replace the output file specification.
2208 +                relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2209 +
2210 +                $opt_silent || {
2211 +                  func_quote_for_expand "$relink_command"
2212 +                  eval "func_echo $func_quote_for_expand_result"
2213 +                }
2214 +                if eval "$relink_command"; then :
2215 +                  else
2216 +                  func_error "error: relink \`$file' with the above command before installing it"
2217 +                  $opt_dry_run || ${RM}r "$tmpdir"
2218 +                  continue
2219 +                fi
2220 +                file="$outputname"
2221 +              else
2222 +                func_warning "cannot relink \`$file'"
2223 +              fi
2224 +            }
2225 +          else
2226 +            # Install the binary that we compiled earlier.
2227 +            file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2228 +          fi
2229 +        fi
2230 +
2231 +        # remove .exe since cygwin /usr/bin/install will append another
2232 +        # one anyway
2233 +        case $install_prog,$host in
2234 +        */usr/bin/install*,*cygwin*)
2235 +          case $file:$destfile in
2236 +          *.exe:*.exe)
2237 +            # this is ok
2238 +            ;;
2239 +          *.exe:*)
2240 +            destfile=$destfile.exe
2241 +            ;;
2242 +          *:*.exe)
2243 +            func_stripname '' '.exe' "$destfile"
2244 +            destfile=$func_stripname_result
2245 +            ;;
2246 +          esac
2247 +          ;;
2248 +        esac
2249 +        func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2250 +        $opt_dry_run || if test -n "$outputname"; then
2251 +          ${RM}r "$tmpdir"
2252 +        fi
2253 +        ;;
2254 +      esac
2255 +    done
2256 +
2257 +    for file in $staticlibs; do
2258 +      func_basename "$file"
2259 +      name="$func_basename_result"
2260 +
2261 +      # Set up the ranlib parameters.
2262 +      oldlib="$destdir/$name"
2263 +
2264 +      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2265 +
2266 +      if test -n "$stripme" && test -n "$old_striplib"; then
2267 +        func_show_eval "$old_striplib $oldlib" 'exit $?'
2268 +      fi
2269 +
2270 +      # Do each command in the postinstall commands.
2271 +      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2272 +    done
2273 +
2274 +    test -n "$future_libdirs" && \
2275 +      func_warning "remember to run \`$progname --finish$future_libdirs'"
2276 +
2277 +    if test -n "$current_libdirs"; then
2278 +      # Maybe just do a dry run.
2279 +      $opt_dry_run && current_libdirs=" -n$current_libdirs"
2280 +      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2281 +    else
2282 +      exit $EXIT_SUCCESS
2283 +    fi
2284 + }
2285 +
2286 + test "$mode" = install && func_mode_install ${1+"$@"}
2287 +
2288 +
2289 + # func_generate_dlsyms outputname originator pic_p
2290 + # Extract symbols from dlprefiles and create ${outputname}S.o with
2291 + # a dlpreopen symbol table.
2292 + func_generate_dlsyms ()
2293 + {
2294 +    $opt_debug
2295 +    my_outputname="$1"
2296 +    my_originator="$2"
2297 +    my_pic_p="${3-no}"
2298 +    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2299 +    my_dlsyms=
2300 +
2301 +    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2302 +      if test -n "$NM" && test -n "$global_symbol_pipe"; then
2303 +        my_dlsyms="${my_outputname}S.c"
2304 +      else
2305 +        func_error "not configured to extract global symbols from dlpreopened files"
2306 +      fi
2307 +    fi
2308 +
2309 +    if test -n "$my_dlsyms"; then
2310 +      case $my_dlsyms in
2311 +      "") ;;
2312 +      *.c)
2313 +        # Discover the nlist of each of the dlfiles.
2314 +        nlist="$output_objdir/${my_outputname}.nm"
2315 +
2316 +        func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2317 +
2318 +        # Parse the name list into a source file.
2319 +        func_verbose "creating $output_objdir/$my_dlsyms"
2320 +
2321 +        $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2322 + /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2323 + /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2324 +
2325 + #ifdef __cplusplus
2326 + extern \"C\" {
2327 + #endif
2328 +
2329 + /* External symbol declarations for the compiler. */\
2330 + "
2331 +
2332 +        if test "$dlself" = yes; then
2333 +          func_verbose "generating symbol list for \`$output'"
2334 +
2335 +          $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2336 +
2337 +          # Add our own program objects to the symbol list.
2338 +          progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2339 +          for progfile in $progfiles; do
2340 +            func_verbose "extracting global C symbols from \`$progfile'"
2341 +            $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2342 +          done
2343 +
2344 +          if test -n "$exclude_expsyms"; then
2345 +            $opt_dry_run || {
2346 +              eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2347 +              eval '$MV "$nlist"T "$nlist"'
2348 +            }
2349 +          fi
2350 +
2351 +          if test -n "$export_symbols_regex"; then
2352 +            $opt_dry_run || {
2353 +              eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2354 +              eval '$MV "$nlist"T "$nlist"'
2355 +            }
2356 +          fi
2357 +
2358 +          # Prepare the list of exported symbols
2359 +          if test -z "$export_symbols"; then
2360 +            export_symbols="$output_objdir/$outputname.exp"
2361 +            $opt_dry_run || {
2362 +              $RM $export_symbols
2363 +              eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2364 +              case $host in
2365 +              *cygwin* | *mingw* | *cegcc* )
2366 +                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2367 +                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2368 +                ;;
2369 +              esac
2370 +            }
2371 +          else
2372 +            $opt_dry_run || {
2373 +              eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2374 +              eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2375 +              eval '$MV "$nlist"T "$nlist"'
2376 +              case $host in
2377 +                *cygwin | *mingw* | *cegcc* )
2378 +                  eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2379 +                  eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2380 +                  ;;
2381 +              esac
2382 +            }
2383 +          fi
2384 +        fi
2385 +
2386 +        for dlprefile in $dlprefiles; do
2387 +          func_verbose "extracting global C symbols from \`$dlprefile'"
2388 +          func_basename "$dlprefile"
2389 +          name="$func_basename_result"
2390 +          $opt_dry_run || {
2391 +            eval '$ECHO ": $name " >> "$nlist"'
2392 +            eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2393 +          }
2394 +        done
2395 +
2396 +        $opt_dry_run || {
2397 +          # Make sure we have at least an empty file.
2398 +          test -f "$nlist" || : > "$nlist"
2399 +
2400 +          if test -n "$exclude_expsyms"; then
2401 +            $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2402 +            $MV "$nlist"T "$nlist"
2403 +          fi
2404 +
2405 +          # Try sorting and uniquifying the output.
2406 +          if $GREP -v "^: " < "$nlist" |
2407 +              if sort -k 3 </dev/null >/dev/null 2>&1; then
2408 +                sort -k 3
2409 +              else
2410 +                sort +2
2411 +              fi |
2412 +              uniq > "$nlist"S; then
2413 +            :
2414 +          else
2415 +            $GREP -v "^: " < "$nlist" > "$nlist"S
2416 +          fi
2417 +
2418 +          if test -f "$nlist"S; then
2419 +            eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2420 +          else
2421 +            $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2422 +          fi
2423 +
2424 +          $ECHO >> "$output_objdir/$my_dlsyms" "\
2425 +
2426 + /* The mapping between symbol names and symbols.  */
2427 + typedef struct {
2428 +  const char *name;
2429 +  void *address;
2430 + } lt_dlsymlist;
2431 + "
2432 +          case $host in
2433 +          *cygwin* | *mingw* | *cegcc* )
2434 +            $ECHO >> "$output_objdir/$my_dlsyms" "\
2435 + /* DATA imports from DLLs on WIN32 con't be const, because
2436 +   runtime relocations are performed -- see ld's documentation
2437 +   on pseudo-relocs.  */"
2438 +            lt_dlsym_const= ;;
2439 +          *osf5*)
2440 +            echo >> "$output_objdir/$my_dlsyms" "\
2441 + /* This system does not cope well with relocations in const data */"
2442 +            lt_dlsym_const= ;;
2443 +          *)
2444 +            lt_dlsym_const=const ;;
2445 +          esac
2446 +
2447 +          $ECHO >> "$output_objdir/$my_dlsyms" "\
2448 + extern $lt_dlsym_const lt_dlsymlist
2449 + lt_${my_prefix}_LTX_preloaded_symbols[];
2450 + $lt_dlsym_const lt_dlsymlist
2451 + lt_${my_prefix}_LTX_preloaded_symbols[] =
2452 + {\
2453 +  { \"$my_originator\", (void *) 0 },"
2454 +
2455 +          case $need_lib_prefix in
2456 +          no)
2457 +            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2458 +            ;;
2459 +          *)
2460 +            eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2461 +            ;;
2462 +          esac
2463 +          $ECHO >> "$output_objdir/$my_dlsyms" "\
2464 +  {0, (void *) 0}
2465 + };
2466 +
2467 + /* This works around a problem in FreeBSD linker */
2468 + #ifdef FREEBSD_WORKAROUND
2469 + static const void *lt_preloaded_setup() {
2470 +  return lt_${my_prefix}_LTX_preloaded_symbols;
2471 + }
2472 + #endif
2473 +
2474 + #ifdef __cplusplus
2475 + }
2476 + #endif\
2477 + "
2478 +        } # !$opt_dry_run
2479 +
2480 +        pic_flag_for_symtable=
2481 +        case "$compile_command " in
2482 +        *" -static "*) ;;
2483 +        *)
2484 +          case $host in
2485 +          # compiling the symbol table file with pic_flag works around
2486 +          # a FreeBSD bug that causes programs to crash when -lm is
2487 +          # linked before any other PIC object.  But we must not use
2488 +          # pic_flag when linking with -static.  The problem exists in
2489 +          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2490 +          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2491 +            pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2492 +          *-*-hpux*)
2493 +            pic_flag_for_symtable=" $pic_flag"  ;;
2494 +          *)
2495 +            if test "X$my_pic_p" != Xno; then
2496 +              pic_flag_for_symtable=" $pic_flag"
2497 +            fi
2498 +            ;;
2499 +          esac
2500 +          ;;
2501 +        esac
2502 +        symtab_cflags=
2503 +        for arg in $LTCFLAGS; do
2504 +          case $arg in
2505 +          -pie | -fpie | -fPIE) ;;
2506 +          *) symtab_cflags="$symtab_cflags $arg" ;;
2507 +          esac
2508 +        done
2509 +
2510 +        # Now compile the dynamic symbol file.
2511 +        func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
2512 +
2513 +        # Clean up the generated files.
2514 +        func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
2515 +
2516 +        # Transform the symbol file into the correct name.
2517 +        symfileobj="$output_objdir/${my_outputname}S.$objext"
2518 +        case $host in
2519 +        *cygwin* | *mingw* | *cegcc* )
2520 +          if test -f "$output_objdir/$my_outputname.def"; then
2521 +            compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2522 +            finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2523 +          else
2524 +            compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2525 +            finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2526 +          fi
2527 +          ;;
2528 +        *)
2529 +          compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2530 +          finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2531 +          ;;
2532 +        esac
2533 +        ;;
2534 +      *)
2535 +        func_fatal_error "unknown suffix for \`$my_dlsyms'"
2536 +        ;;
2537 +      esac
2538 +    else
2539 +      # We keep going just in case the user didn't refer to
2540 +      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
2541 +      # really was required.
2542 +
2543 +      # Nullify the symbol file.
2544 +      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2545 +      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2546 +    fi
2547 + }
2548 +
2549 + # func_win32_libid arg
2550 + # return the library type of file 'arg'
2551 + #
2552 + # Need a lot of goo to handle *both* DLLs and import libs
2553 + # Has to be a shell function in order to 'eat' the argument
2554 + # that is supplied when $file_magic_command is called.
2555 + func_win32_libid ()
2556 + {
2557 +  $opt_debug
2558 +  win32_libid_type="unknown"
2559 +  win32_fileres=`file -L $1 2>/dev/null`
2560 +  case $win32_fileres in
2561 +  *ar\ archive\ import\ library*) # definitely import
2562 +    win32_libid_type="x86 archive import"
2563 +    ;;
2564 +  *ar\ archive*) # could be an import, or static
2565 +    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2566 +       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
2567 +      win32_nmres=`eval $NM -f posix -A $1 |
2568 +        $SED -n -e '
2569 +            1,100{
2570 +                / I /{
2571 +                    s,.*,import,
2572 +                    p
2573 +                    q
2574 +                }
2575 +            }'`
2576 +      case $win32_nmres in
2577 +      import*)  win32_libid_type="x86 archive import";;
2578 +      *)        win32_libid_type="x86 archive static";;
2579 +      esac
2580 +    fi
2581      ;;
2582 +  *DLL*)
2583 +    win32_libid_type="x86 DLL"
2584 +    ;;
2585 +  *executable*) # but shell scripts are "executable" too...
2586 +    case $win32_fileres in
2587 +    *MS\ Windows\ PE\ Intel*)
2588 +      win32_libid_type="x86 DLL"
2589 +      ;;
2590 +    esac
2591 +    ;;
2592 +  esac
2593 +  $ECHO "$win32_libid_type"
2594 + }
2595 +
2596 +
2597 +
2598 + # func_extract_an_archive dir oldlib
2599 + func_extract_an_archive ()
2600 + {
2601 +    $opt_debug
2602 +    f_ex_an_ar_dir="$1"; shift
2603 +    f_ex_an_ar_oldlib="$1"
2604 +    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
2605 +    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2606 +     :
2607 +    else
2608 +      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
2609 +    fi
2610 + }
2611 +
2612 +
2613 + # func_extract_archives gentop oldlib ...
2614 + func_extract_archives ()
2615 + {
2616 +    $opt_debug
2617 +    my_gentop="$1"; shift
2618 +    my_oldlibs=${1+"$@"}
2619 +    my_oldobjs=""
2620 +    my_xlib=""
2621 +    my_xabs=""
2622 +    my_xdir=""
2623 +
2624 +    for my_xlib in $my_oldlibs; do
2625 +      # Extract the objects.
2626 +      case $my_xlib in
2627 +        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
2628 +        *) my_xabs=`pwd`"/$my_xlib" ;;
2629 +      esac
2630 +      func_basename "$my_xlib"
2631 +      my_xlib="$func_basename_result"
2632 +      my_xlib_u=$my_xlib
2633 +      while :; do
2634 +        case " $extracted_archives " in
2635 +        *" $my_xlib_u "*)
2636 +          func_arith $extracted_serial + 1
2637 +          extracted_serial=$func_arith_result
2638 +          my_xlib_u=lt$extracted_serial-$my_xlib ;;
2639 +        *) break ;;
2640 +        esac
2641 +      done
2642 +      extracted_archives="$extracted_archives $my_xlib_u"
2643 +      my_xdir="$my_gentop/$my_xlib_u"
2644 +
2645 +      func_mkdir_p "$my_xdir"
2646 +
2647 +      case $host in
2648 +      *-darwin*)
2649 +        func_verbose "Extracting $my_xabs"
2650 +        # Do not bother doing anything if just a dry run
2651 +        $opt_dry_run || {
2652 +          darwin_orig_dir=`pwd`
2653 +          cd $my_xdir || exit $?
2654 +          darwin_archive=$my_xabs
2655 +          darwin_curdir=`pwd`
2656 +          darwin_base_archive=`basename "$darwin_archive"`
2657 +          darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2658 +          if test -n "$darwin_arches"; then
2659 +            darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2660 +            darwin_arch=
2661 +            func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
2662 +            for darwin_arch in  $darwin_arches ; do
2663 +              func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2664 +              $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2665 +              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2666 +              func_extract_an_archive "`pwd`" "${darwin_base_archive}"
2667 +              cd "$darwin_curdir"
2668 +              $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
2669 +            done # $darwin_arches
2670 +            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
2671 +            darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
2672 +            darwin_file=
2673 +            darwin_files=
2674 +            for darwin_file in $darwin_filelist; do
2675 +              darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
2676 +              $LIPO -create -output "$darwin_file" $darwin_files
2677 +            done # $darwin_filelist
2678 +            $RM -rf unfat-$$
2679 +            cd "$darwin_orig_dir"
2680 +          else
2681 +            cd $darwin_orig_dir
2682 +            func_extract_an_archive "$my_xdir" "$my_xabs"
2683 +          fi # $darwin_arches
2684 +        } # !$opt_dry_run
2685 +        ;;
2686 +      *)
2687 +        func_extract_an_archive "$my_xdir" "$my_xabs"
2688 +        ;;
2689 +      esac
2690 +      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2691 +    done
2692 +
2693 +    func_extract_archives_result="$my_oldobjs"
2694 + }
2695 +
2696 +
2697 +
2698 + # func_emit_wrapper_part1 [arg=no]
2699 + #
2700 + # Emit the first part of a libtool wrapper script on stdout.
2701 + # For more information, see the description associated with
2702 + # func_emit_wrapper(), below.
2703 + func_emit_wrapper_part1 ()
2704 + {
2705 +        func_emit_wrapper_part1_arg1=no
2706 +        if test -n "$1" ; then
2707 +          func_emit_wrapper_part1_arg1=$1
2708 +        fi
2709 +
2710 +        $ECHO "\
2711 + #! $SHELL
2712 +
2713 + # $output - temporary wrapper script for $objdir/$outputname
2714 + # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2715 + #
2716 + # The $output program cannot be directly executed until all the libtool
2717 + # libraries that it depends on are installed.
2718 + #
2719 + # This wrapper script should never be moved out of the build directory.
2720 + # If it is, it will not operate correctly.
2721 +
2722 + # Sed substitution that helps us do robust quoting.  It backslashifies
2723 + # metacharacters that are still active within double-quoted strings.
2724 + Xsed='${SED} -e 1s/^X//'
2725 + sed_quote_subst='$sed_quote_subst'
2726 +
2727 + # Be Bourne compatible
2728 + if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
2729 +  emulate sh
2730 +  NULLCMD=:
2731 +  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
2732 +  # is contrary to our usage.  Disable this feature.
2733 +  alias -g '\${1+\"\$@\"}'='\"\$@\"'
2734 +  setopt NO_GLOB_SUBST
2735 + else
2736 +  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
2737 + fi
2738 + BIN_SH=xpg4; export BIN_SH # for Tru64
2739 + DUALCASE=1; export DUALCASE # for MKS sh
2740 +
2741 + # The HP-UX ksh and POSIX shell print the target directory to stdout
2742 + # if CDPATH is set.
2743 + (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2744 +
2745 + relink_command=\"$relink_command\"
2746 +
2747 + # This environment variable determines our operation mode.
2748 + if test \"\$libtool_install_magic\" = \"$magic\"; then
2749 +  # install mode needs the following variables:
2750 +  generated_by_libtool_version='$macro_version'
2751 +  notinst_deplibs='$notinst_deplibs'
2752 + else
2753 +  # When we are sourced in execute mode, \$file and \$ECHO are already set.
2754 +  if test \"\$libtool_execute_magic\" != \"$magic\"; then
2755 +    ECHO=\"$qecho\"
2756 +    file=\"\$0\"
2757 +    # Make sure echo works.
2758 +    if test \"X\$1\" = X--no-reexec; then
2759 +      # Discard the --no-reexec flag, and continue.
2760 +      shift
2761 +    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
2762 +      # Yippee, \$ECHO works!
2763 +      :
2764 +    else
2765 +      # Restart under the correct shell, and then maybe \$ECHO will work.
2766 +      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2767 +    fi
2768 +  fi\
2769 + "
2770 +        $ECHO "\
2771 +
2772 +  # Find the directory that this script lives in.
2773 +  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2774 +  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2775 +
2776 +  # Follow symbolic links until we get to the real thisdir.
2777 +  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
2778 +  while test -n \"\$file\"; do
2779 +    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2780 +
2781 +    # If there was a directory component, then change thisdir.
2782 +    if test \"x\$destdir\" != \"x\$file\"; then
2783 +      case \"\$destdir\" in
2784 +      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2785 +      *) thisdir=\"\$thisdir/\$destdir\" ;;
2786 +      esac
2787 +    fi
2788 +
2789 +    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2790 +    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
2791 +  done
2792 + "
2793 + }
2794 + # end: func_emit_wrapper_part1
2795 +
2796 + # func_emit_wrapper_part2 [arg=no]
2797 + #
2798 + # Emit the second part of a libtool wrapper script on stdout.
2799 + # For more information, see the description associated with
2800 + # func_emit_wrapper(), below.
2801 + func_emit_wrapper_part2 ()
2802 + {
2803 +        func_emit_wrapper_part2_arg1=no
2804 +        if test -n "$1" ; then
2805 +          func_emit_wrapper_part2_arg1=$1
2806 +        fi
2807 +
2808 +        $ECHO "\
2809 +
2810 +  # Usually 'no', except on cygwin/mingw when embedded into
2811 +  # the cwrapper.
2812 +  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
2813 +  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
2814 +    # special case for '.'
2815 +    if test \"\$thisdir\" = \".\"; then
2816 +      thisdir=\`pwd\`
2817 +    fi
2818 +    # remove .libs from thisdir
2819 +    case \"\$thisdir\" in
2820 +    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
2821 +    $objdir )   thisdir=. ;;
2822 +    esac
2823 +  fi
2824 +
2825 +  # Try to get the absolute directory name.
2826 +  absdir=\`cd \"\$thisdir\" && pwd\`
2827 +  test -n \"\$absdir\" && thisdir=\"\$absdir\"
2828 + "
2829 +
2830 +        if test "$fast_install" = yes; then
2831 +          $ECHO "\
2832 +  program=lt-'$outputname'$exeext
2833 +  progdir=\"\$thisdir/$objdir\"
2834 +
2835 +  if test ! -f \"\$progdir/\$program\" ||
2836 +     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2837 +       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2838 +
2839 +    file=\"\$\$-\$program\"
2840 +
2841 +    if test ! -d \"\$progdir\"; then
2842 +      $MKDIR \"\$progdir\"
2843 +    else
2844 +      $RM \"\$progdir/\$file\"
2845 +    fi"
2846 +
2847 +          $ECHO "\
2848 +
2849 +    # relink executable if necessary
2850 +    if test -n \"\$relink_command\"; then
2851 +      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2852 +      else
2853 +        $ECHO \"\$relink_command_output\" >&2
2854 +        $RM \"\$progdir/\$file\"
2855 +        exit 1
2856 +      fi
2857 +    fi
2858 +
2859 +    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2860 +    { $RM \"\$progdir/\$program\";
2861 +      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2862 +    $RM \"\$progdir/\$file\"
2863 +  fi"
2864 +        else
2865 +          $ECHO "\
2866 +  program='$outputname'
2867 +  progdir=\"\$thisdir/$objdir\"
2868 + "
2869 +        fi
2870 +
2871 +        $ECHO "\
2872 +
2873 +  if test -f \"\$progdir/\$program\"; then"
2874 +
2875 +        # Export our shlibpath_var if we have one.
2876 +        if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2877 +          $ECHO "\
2878 +    # Add our own library path to $shlibpath_var
2879 +    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2880 +
2881 +    # Some systems cannot cope with colon-terminated $shlibpath_var
2882 +    # The second colon is a workaround for a bug in BeOS R4 sed
2883 +    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2884 +
2885 +    export $shlibpath_var
2886 + "
2887 +        fi
2888 +
2889 +        # fixup the dll searchpath if we need to.
2890 +        if test -n "$dllsearchpath"; then
2891 +          $ECHO "\
2892 +    # Add the dll search path components to the executable PATH
2893 +    PATH=$dllsearchpath:\$PATH
2894 + "
2895 +        fi
2896 +
2897 +        $ECHO "\
2898 +    if test \"\$libtool_execute_magic\" != \"$magic\"; then
2899 +      # Run the actual program with our arguments.
2900 + "
2901 +        case $host in
2902 +        # Backslashes separate directories on plain windows
2903 +        *-*-mingw | *-*-os2* | *-cegcc*)
2904 +          $ECHO "\
2905 +      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
2906 + "
2907 +          ;;
2908 +
2909 +        *)
2910 +          $ECHO "\
2911 +      exec \"\$progdir/\$program\" \${1+\"\$@\"}
2912 + "
2913 +          ;;
2914 +        esac
2915 +        $ECHO "\
2916 +      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
2917 +      exit 1
2918 +    fi
2919 +  else
2920 +    # The program doesn't exist.
2921 +    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
2922 +    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
2923 +    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
2924 +    exit 1
2925 +  fi
2926 + fi\
2927 + "
2928 + }
2929 + # end: func_emit_wrapper_part2
2930 +
2931 +
2932 + # func_emit_wrapper [arg=no]
2933 + #
2934 + # Emit a libtool wrapper script on stdout.
2935 + # Don't directly open a file because we may want to
2936 + # incorporate the script contents within a cygwin/mingw
2937 + # wrapper executable.  Must ONLY be called from within
2938 + # func_mode_link because it depends on a number of variables
2939 + # set therein.
2940 + #
2941 + # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2942 + # variable will take.  If 'yes', then the emitted script
2943 + # will assume that the directory in which it is stored is
2944 + # the $objdir directory.  This is a cygwin/mingw-specific
2945 + # behavior.
2946 + func_emit_wrapper ()
2947 + {
2948 +        func_emit_wrapper_arg1=no
2949 +        if test -n "$1" ; then
2950 +          func_emit_wrapper_arg1=$1
2951 +        fi
2952 +
2953 +        # split this up so that func_emit_cwrapperexe_src
2954 +        # can call each part independently.
2955 +        func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
2956 +        func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
2957 + }
2958 +
2959 +
2960 + # func_to_host_path arg
2961 + #
2962 + # Convert paths to host format when used with build tools.
2963 + # Intended for use with "native" mingw (where libtool itself
2964 + # is running under the msys shell), or in the following cross-
2965 + # build environments:
2966 + #    $build          $host
2967 + #    mingw (msys)    mingw  [e.g. native]
2968 + #    cygwin          mingw
2969 + #    *nix + wine     mingw
2970 + # where wine is equipped with the `winepath' executable.
2971 + # In the native mingw case, the (msys) shell automatically
2972 + # converts paths for any non-msys applications it launches,
2973 + # but that facility isn't available from inside the cwrapper.
2974 + # Similar accommodations are necessary for $host mingw and
2975 + # $build cygwin.  Calling this function does no harm for other
2976 + # $host/$build combinations not listed above.
2977 + #
2978 + # ARG is the path (on $build) that should be converted to
2979 + # the proper representation for $host. The result is stored
2980 + # in $func_to_host_path_result.
2981 + func_to_host_path ()
2982 + {
2983 +  func_to_host_path_result="$1"
2984 +  if test -n "$1" ; then
2985 +    case $host in
2986 +      *mingw* )
2987 +        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
2988 +        case $build in
2989 +          *mingw* ) # actually, msys
2990 +            # awkward: cmd appends spaces to result
2991 +            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
2992 +            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
2993 +              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
2994 +            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
2995 +              $SED -e "$lt_sed_naive_backslashify"`
2996 +            ;;
2997 +          *cygwin* )
2998 +            func_to_host_path_tmp1=`cygpath -w "$1"`
2999 +            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3000 +              $SED -e "$lt_sed_naive_backslashify"`
3001 +            ;;
3002 +          * )
3003 +            # Unfortunately, winepath does not exit with a non-zero
3004 +            # error code, so we are forced to check the contents of
3005 +            # stdout. On the other hand, if the command is not
3006 +            # found, the shell will set an exit code of 127 and print
3007 +            # *an error message* to stdout. So we must check for both
3008 +            # error code of zero AND non-empty stdout, which explains
3009 +            # the odd construction:
3010 +            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3011 +            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3012 +              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3013 +                $SED -e "$lt_sed_naive_backslashify"`
3014 +            else
3015 +              # Allow warning below.
3016 +              func_to_host_path_result=""
3017 +            fi
3018 +            ;;
3019 +        esac
3020 +        if test -z "$func_to_host_path_result" ; then
3021 +          func_error "Could not determine host path corresponding to"
3022 +          func_error "  '$1'"
3023 +          func_error "Continuing, but uninstalled executables may not work."
3024 +          # Fallback:
3025 +          func_to_host_path_result="$1"
3026 +        fi
3027 +        ;;
3028 +    esac
3029 +  fi
3030 + }
3031 + # end: func_to_host_path
3032 +
3033 + # func_to_host_pathlist arg
3034 + #
3035 + # Convert pathlists to host format when used with build tools.
3036 + # See func_to_host_path(), above. This function supports the
3037 + # following $build/$host combinations (but does no harm for
3038 + # combinations not listed here):
3039 + #    $build          $host
3040 + #    mingw (msys)    mingw  [e.g. native]
3041 + #    cygwin          mingw
3042 + #    *nix + wine     mingw
3043 + #
3044 + # Path separators are also converted from $build format to
3045 + # $host format. If ARG begins or ends with a path separator
3046 + # character, it is preserved (but converted to $host format)
3047 + # on output.
3048 + #
3049 + # ARG is a pathlist (on $build) that should be converted to
3050 + # the proper representation on $host. The result is stored
3051 + # in $func_to_host_pathlist_result.
3052 + func_to_host_pathlist ()
3053 + {
3054 +  func_to_host_pathlist_result="$1"
3055 +  if test -n "$1" ; then
3056 +    case $host in
3057 +      *mingw* )
3058 +        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3059 +        # Remove leading and trailing path separator characters from
3060 +        # ARG. msys behavior is inconsistent here, cygpath turns them
3061 +        # into '.;' and ';.', and winepath ignores them completely.
3062 +        func_to_host_pathlist_tmp2="$1"
3063 +        # Once set for this call, this variable should not be
3064 +        # reassigned. It is used in tha fallback case.
3065 +        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
3066 +          $SED -e 's|^:*||' -e 's|:*$||'`
3067 +        case $build in
3068 +          *mingw* ) # Actually, msys.
3069 +            # Awkward: cmd appends spaces to result.
3070 +            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3071 +            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
3072 +              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3073 +            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3074 +              $SED -e "$lt_sed_naive_backslashify"`
3075 +            ;;
3076 +          *cygwin* )
3077 +            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
3078 +            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3079 +              $SED -e "$lt_sed_naive_backslashify"`
3080 +            ;;
3081 +          * )
3082 +            # unfortunately, winepath doesn't convert pathlists
3083 +            func_to_host_pathlist_result=""
3084 +            func_to_host_pathlist_oldIFS=$IFS
3085 +            IFS=:
3086 +            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3087 +              IFS=$func_to_host_pathlist_oldIFS
3088 +              if test -n "$func_to_host_pathlist_f" ; then
3089 +                func_to_host_path "$func_to_host_pathlist_f"
3090 +                if test -n "$func_to_host_path_result" ; then
3091 +                  if test -z "$func_to_host_pathlist_result" ; then
3092 +                    func_to_host_pathlist_result="$func_to_host_path_result"
3093 +                  else
3094 +                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
3095 +                  fi
3096 +                fi
3097 +              fi
3098 +              IFS=:
3099 +            done
3100 +            IFS=$func_to_host_pathlist_oldIFS
3101 +            ;;
3102 +        esac
3103 +        if test -z "$func_to_host_pathlist_result" ; then
3104 +          func_error "Could not determine the host path(s) corresponding to"
3105 +          func_error "  '$1'"
3106 +          func_error "Continuing, but uninstalled executables may not work."
3107 +          # Fallback. This may break if $1 contains DOS-style drive
3108 +          # specifications. The fix is not to complicate the expression
3109 +          # below, but for the user to provide a working wine installation
3110 +          # with winepath so that path translation in the cross-to-mingw
3111 +          # case works properly.
3112 +          lt_replace_pathsep_nix_to_dos="s|:|;|g"
3113 +          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3114 +            $SED -e "$lt_replace_pathsep_nix_to_dos"`
3115 +        fi
3116 +        # Now, add the leading and trailing path separators back
3117 +        case "$1" in
3118 +          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3119 +            ;;
3120 +        esac
3121 +        case "$1" in
3122 +          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
3123 +            ;;
3124 +        esac
3125 +        ;;
3126 +    esac
3127 +  fi
3128 + }
3129 + # end: func_to_host_pathlist
3130 +
3131 + # func_emit_cwrapperexe_src
3132 + # emit the source code for a wrapper executable on stdout
3133 + # Must ONLY be called from within func_mode_link because
3134 + # it depends on a number of variable set therein.
3135 + func_emit_cwrapperexe_src ()
3136 + {
3137 +        cat <<EOF
3138 +
3139 + /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3140 +   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3141 +
3142 +   The $output program cannot be directly executed until all the libtool
3143 +   libraries that it depends on are installed.
3144 +
3145 +   This wrapper executable should never be moved out of the build directory.
3146 +   If it is, it will not operate correctly.
3147 +
3148 +   Currently, it simply execs the wrapper *script* "$SHELL $output",
3149 +   but could eventually absorb all of the scripts functionality and
3150 +   exec $objdir/$outputname directly.
3151 + */
3152 + EOF
3153 +            cat <<"EOF"
3154 + #include <stdio.h>
3155 + #include <stdlib.h>
3156 + #ifdef _MSC_VER
3157 + # include <direct.h>
3158 + # include <process.h>
3159 + # include <io.h>
3160 + # define setmode _setmode
3161 + #else
3162 + # include <unistd.h>
3163 + # include <stdint.h>
3164 + # ifdef __CYGWIN__
3165 + #  include <io.h>
3166 + #  define HAVE_SETENV
3167 + #  ifdef __STRICT_ANSI__
3168 + char *realpath (const char *, char *);
3169 + int putenv (char *);
3170 + int setenv (const char *, const char *, int);
3171 + #  endif
3172 + # endif
3173 + #endif
3174 + #include <malloc.h>
3175 + #include <stdarg.h>
3176 + #include <assert.h>
3177 + #include <string.h>
3178 + #include <ctype.h>
3179 + #include <errno.h>
3180 + #include <fcntl.h>
3181 + #include <sys/stat.h>
3182 +
3183 + #if defined(PATH_MAX)
3184 + # define LT_PATHMAX PATH_MAX
3185 + #elif defined(MAXPATHLEN)
3186 + # define LT_PATHMAX MAXPATHLEN
3187 + #else
3188 + # define LT_PATHMAX 1024
3189 + #endif
3190 +
3191 + #ifndef S_IXOTH
3192 + # define S_IXOTH 0
3193 + #endif
3194 + #ifndef S_IXGRP
3195 + # define S_IXGRP 0
3196 + #endif
3197 +
3198 + #ifdef _MSC_VER
3199 + # define S_IXUSR _S_IEXEC
3200 + # define stat _stat
3201 + # ifndef _INTPTR_T_DEFINED
3202 + #  define intptr_t int
3203 + # endif
3204 + #endif
3205 +
3206 + #ifndef DIR_SEPARATOR
3207 + # define DIR_SEPARATOR '/'
3208 + # define PATH_SEPARATOR ':'
3209 + #endif
3210 +
3211 + #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3212 +  defined (__OS2__)
3213 + # define HAVE_DOS_BASED_FILE_SYSTEM
3214 + # define FOPEN_WB "wb"
3215 + # ifndef DIR_SEPARATOR_2
3216 + #  define DIR_SEPARATOR_2 '\\'
3217 + # endif
3218 + # ifndef PATH_SEPARATOR_2
3219 + #  define PATH_SEPARATOR_2 ';'
3220 + # endif
3221 + #endif
3222 +
3223 + #ifndef DIR_SEPARATOR_2
3224 + # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3225 + #else /* DIR_SEPARATOR_2 */
3226 + # define IS_DIR_SEPARATOR(ch) \
3227 +        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3228 + #endif /* DIR_SEPARATOR_2 */
3229 +
3230 + #ifndef PATH_SEPARATOR_2
3231 + # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3232 + #else /* PATH_SEPARATOR_2 */
3233 + # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3234 + #endif /* PATH_SEPARATOR_2 */
3235 +
3236 + #ifdef __CYGWIN__
3237 + # define FOPEN_WB "wb"
3238 + #endif
3239 +
3240 + #ifndef FOPEN_WB
3241 + # define FOPEN_WB "w"
3242 + #endif
3243 + #ifndef _O_BINARY
3244 + # define _O_BINARY 0
3245 + #endif
3246 +
3247 + #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
3248 + #define XFREE(stale) do { \
3249 +  if (stale) { free ((void *) stale); stale = 0; } \
3250 + } while (0)
3251 +
3252 + #undef LTWRAPPER_DEBUGPRINTF
3253 + #if defined DEBUGWRAPPER
3254 + # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3255 + static void
3256 + ltwrapper_debugprintf (const char *fmt, ...)
3257 + {
3258 +    va_list args;
3259 +    va_start (args, fmt);
3260 +    (void) vfprintf (stderr, fmt, args);
3261 +    va_end (args);
3262 + }
3263 + #else
3264 + # define LTWRAPPER_DEBUGPRINTF(args)
3265 + #endif
3266 +
3267 + const char *program_name = NULL;
3268 +
3269 + void *xmalloc (size_t num);
3270 + char *xstrdup (const char *string);
3271 + const char *base_name (const char *name);
3272 + char *find_executable (const char *wrapper);
3273 + char *chase_symlinks (const char *pathspec);
3274 + int make_executable (const char *path);
3275 + int check_executable (const char *path);
3276 + char *strendzap (char *str, const char *pat);
3277 + void lt_fatal (const char *message, ...);
3278 + void lt_setenv (const char *name, const char *value);
3279 + char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3280 + void lt_opt_process_env_set (const char *arg);
3281 + void lt_opt_process_env_prepend (const char *arg);
3282 + void lt_opt_process_env_append (const char *arg);
3283 + int lt_split_name_value (const char *arg, char** name, char** value);
3284 + void lt_update_exe_path (const char *name, const char *value);
3285 + void lt_update_lib_path (const char *name, const char *value);
3286 +
3287 + static const char *script_text_part1 =
3288 + EOF
3289 +
3290 +            func_emit_wrapper_part1 yes |
3291 +                $SED -e 's/\([\\"]\)/\\\1/g' \
3292 +                     -e 's/^/  "/' -e 's/$/\\n"/'
3293 +            echo ";"
3294 +            cat <<EOF
3295 +
3296 + static const char *script_text_part2 =
3297 + EOF
3298 +            func_emit_wrapper_part2 yes |
3299 +                $SED -e 's/\([\\"]\)/\\\1/g' \
3300 +                     -e 's/^/  "/' -e 's/$/\\n"/'
3301 +            echo ";"
3302 +
3303 +            cat <<EOF
3304 + const char * MAGIC_EXE = "$magic_exe";
3305 + const char * LIB_PATH_VARNAME = "$shlibpath_var";
3306 + EOF
3307 +
3308 +            if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3309 +              func_to_host_pathlist "$temp_rpath"
3310 +              cat <<EOF
3311 + const char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
3312 + EOF
3313 +            else
3314 +              cat <<"EOF"
3315 + const char * LIB_PATH_VALUE   = "";
3316 + EOF
3317 +            fi
3318 +
3319 +            if test -n "$dllsearchpath"; then
3320 +              func_to_host_pathlist "$dllsearchpath:"
3321 +              cat <<EOF
3322 + const char * EXE_PATH_VARNAME = "PATH";
3323 + const char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
3324 + EOF
3325 +            else
3326 +              cat <<"EOF"
3327 + const char * EXE_PATH_VARNAME = "";
3328 + const char * EXE_PATH_VALUE   = "";
3329 + EOF
3330 +            fi
3331 +
3332 +            if test "$fast_install" = yes; then
3333 +              cat <<EOF
3334 + const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3335 + EOF
3336 +            else
3337 +              cat <<EOF
3338 + const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
3339 + EOF
3340 +            fi
3341 +
3342 +
3343 +            cat <<"EOF"
3344 +
3345 + #define LTWRAPPER_OPTION_PREFIX         "--lt-"
3346 + #define LTWRAPPER_OPTION_PREFIX_LENGTH  5
3347 +
3348 + static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
3349 + static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
3350 +
3351 + static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
3352 +
3353 + static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
3354 + static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
3355 +  /* argument is putenv-style "foo=bar", value of foo is set to bar */
3356 +
3357 + static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
3358 + static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
3359 +  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
3360 +
3361 + static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
3362 + static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
3363 +  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
3364 +
3365 + int
3366 + main (int argc, char *argv[])
3367 + {
3368 +  char **newargz;
3369 +  int  newargc;
3370 +  char *tmp_pathspec;
3371 +  char *actual_cwrapper_path;
3372 +  char *actual_cwrapper_name;
3373 +  char *target_name;
3374 +  char *lt_argv_zero;
3375 +  intptr_t rval = 127;
3376 +
3377 +  int i;
3378 +
3379 +  program_name = (char *) xstrdup (base_name (argv[0]));
3380 +  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
3381 +  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3382 +
3383 +  /* very simple arg parsing; don't want to rely on getopt */
3384 +  for (i = 1; i < argc; i++)
3385 +    {
3386 +      if (strcmp (argv[i], dumpscript_opt) == 0)
3387 +        {
3388 + EOF
3389 +            case "$host" in
3390 +              *mingw* | *cygwin* )
3391 +                # make stdout use "unix" line endings
3392 +                echo "          setmode(1,_O_BINARY);"
3393 +                ;;
3394 +              esac
3395 +
3396 +            cat <<"EOF"
3397 +          printf ("%s", script_text_part1);
3398 +          printf ("%s", script_text_part2);
3399 +          return 0;
3400 +        }
3401 +    }
3402 +
3403 +  newargz = XMALLOC (char *, argc + 1);
3404 +  tmp_pathspec = find_executable (argv[0]);
3405 +  if (tmp_pathspec == NULL)
3406 +    lt_fatal ("Couldn't find %s", argv[0]);
3407 +  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3408 +                          tmp_pathspec));
3409 +
3410 +  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3411 +  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3412 +                          actual_cwrapper_path));
3413 +  XFREE (tmp_pathspec);
3414 +
3415 +  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
3416 +  strendzap (actual_cwrapper_path, actual_cwrapper_name);
3417 +
3418 +  /* wrapper name transforms */
3419 +  strendzap (actual_cwrapper_name, ".exe");
3420 +  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
3421 +  XFREE (actual_cwrapper_name);
3422 +  actual_cwrapper_name = tmp_pathspec;
3423 +  tmp_pathspec = 0;
3424 +
3425 +  /* target_name transforms -- use actual target program name; might have lt- prefix */
3426 +  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
3427 +  strendzap (target_name, ".exe");
3428 +  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
3429 +  XFREE (target_name);
3430 +  target_name = tmp_pathspec;
3431 +  tmp_pathspec = 0;
3432 +
3433 +  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
3434 +                          target_name));
3435 + EOF
3436 +
3437 +            cat <<EOF
3438 +  newargz[0] =
3439 +    XMALLOC (char, (strlen (actual_cwrapper_path) +
3440 +                    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
3441 +  strcpy (newargz[0], actual_cwrapper_path);
3442 +  strcat (newargz[0], "$objdir");
3443 +  strcat (newargz[0], "/");
3444 + EOF
3445 +
3446 +            cat <<"EOF"
3447 +  /* stop here, and copy so we don't have to do this twice */
3448 +  tmp_pathspec = xstrdup (newargz[0]);
3449 +
3450 +  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
3451 +  strcat (newargz[0], actual_cwrapper_name);
3452 +
3453 +  /* DO want the lt- prefix here if it exists, so use target_name */
3454 +  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
3455 +  XFREE (tmp_pathspec);
3456 +  tmp_pathspec = NULL;
3457 + EOF
3458 +
3459 +            case $host_os in
3460 +              mingw*)
3461 +            cat <<"EOF"
3462 +  {
3463 +    char* p;
3464 +    while ((p = strchr (newargz[0], '\\')) != NULL)
3465 +      {
3466 +        *p = '/';
3467 +      }
3468 +    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
3469 +      {
3470 +        *p = '/';
3471 +      }
3472 +  }
3473 + EOF
3474 +            ;;
3475 +            esac
3476 +
3477 +            cat <<"EOF"
3478 +  XFREE (target_name);
3479 +  XFREE (actual_cwrapper_path);
3480 +  XFREE (actual_cwrapper_name);
3481 +
3482 +  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
3483 +  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
3484 +  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3485 +  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
3486 +
3487 +  newargc=0;
3488 +  for (i = 1; i < argc; i++)
3489 +    {
3490 +      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
3491 +        {
3492 +          if (argv[i][env_set_opt_len] == '=')
3493 +            {
3494 +              const char *p = argv[i] + env_set_opt_len + 1;
3495 +              lt_opt_process_env_set (p);
3496 +            }
3497 +          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
3498 +            {
3499 +              lt_opt_process_env_set (argv[++i]); /* don't copy */
3500 +            }
3501 +          else
3502 +            lt_fatal ("%s missing required argument", env_set_opt);
3503 +          continue;
3504 +        }
3505 +      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
3506 +        {
3507 +          if (argv[i][env_prepend_opt_len] == '=')
3508 +            {
3509 +              const char *p = argv[i] + env_prepend_opt_len + 1;
3510 +              lt_opt_process_env_prepend (p);
3511 +            }
3512 +          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
3513 +            {
3514 +              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
3515 +            }
3516 +          else
3517 +            lt_fatal ("%s missing required argument", env_prepend_opt);
3518 +          continue;
3519 +        }
3520 +      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
3521 +        {
3522 +          if (argv[i][env_append_opt_len] == '=')
3523 +            {
3524 +              const char *p = argv[i] + env_append_opt_len + 1;
3525 +              lt_opt_process_env_append (p);
3526 +            }
3527 +          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
3528 +            {
3529 +              lt_opt_process_env_append (argv[++i]); /* don't copy */
3530 +            }
3531 +          else
3532 +            lt_fatal ("%s missing required argument", env_append_opt);
3533 +          continue;
3534 +        }
3535 +      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
3536 +        {
3537 +          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
3538 +             namespace, but it is not one of the ones we know about and
3539 +             have already dealt with, above (inluding dump-script), then
3540 +             report an error. Otherwise, targets might begin to believe
3541 +             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
3542 +             namespace. The first time any user complains about this, we'll
3543 +             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
3544 +             or a configure.ac-settable value.
3545 +           */
3546 +          lt_fatal ("Unrecognized option in %s namespace: '%s'",
3547 +                    ltwrapper_option_prefix, argv[i]);
3548 +        }
3549 +      /* otherwise ... */
3550 +      newargz[++newargc] = xstrdup (argv[i]);
3551 +    }
3552 +  newargz[++newargc] = NULL;
3553 +
3554 +  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
3555 +  for (i = 0; i < newargc; i++)
3556 +    {
3557 +      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
3558 +    }
3559 +
3560 + EOF
3561  
3562 <  # libtool link mode
3563 <  link | relink)
3564 <    modename="$modename: link"
3562 >            case $host_os in
3563 >              mingw*)
3564 >                cat <<"EOF"
3565 >  /* execv doesn't actually work on mingw as expected on unix */
3566 >  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
3567 >  if (rval == -1)
3568 >    {
3569 >      /* failed to start process */
3570 >      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
3571 >      return 127;
3572 >    }
3573 >  return rval;
3574 > EOF
3575 >                ;;
3576 >              *)
3577 >                cat <<"EOF"
3578 >  execv (lt_argv_zero, newargz);
3579 >  return rval; /* =127, but avoids unused variable warning */
3580 > EOF
3581 >                ;;
3582 >            esac
3583 >
3584 >            cat <<"EOF"
3585 > }
3586 >
3587 > void *
3588 > xmalloc (size_t num)
3589 > {
3590 >  void *p = (void *) malloc (num);
3591 >  if (!p)
3592 >    lt_fatal ("Memory exhausted");
3593 >
3594 >  return p;
3595 > }
3596 >
3597 > char *
3598 > xstrdup (const char *string)
3599 > {
3600 >  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3601 >                          string) : NULL;
3602 > }
3603 >
3604 > const char *
3605 > base_name (const char *name)
3606 > {
3607 >  const char *base;
3608 >
3609 > #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3610 >  /* Skip over the disk name in MSDOS pathnames. */
3611 >  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3612 >    name += 2;
3613 > #endif
3614 >
3615 >  for (base = name; *name; name++)
3616 >    if (IS_DIR_SEPARATOR (*name))
3617 >      base = name + 1;
3618 >  return base;
3619 > }
3620 >
3621 > int
3622 > check_executable (const char *path)
3623 > {
3624 >  struct stat st;
3625 >
3626 >  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
3627 >                          path ? (*path ? path : "EMPTY!") : "NULL!"));
3628 >  if ((!path) || (!*path))
3629 >    return 0;
3630 >
3631 >  if ((stat (path, &st) >= 0)
3632 >      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3633 >    return 1;
3634 >  else
3635 >    return 0;
3636 > }
3637 >
3638 > int
3639 > make_executable (const char *path)
3640 > {
3641 >  int rval = 0;
3642 >  struct stat st;
3643 >
3644 >  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
3645 >                          path ? (*path ? path : "EMPTY!") : "NULL!"));
3646 >  if ((!path) || (!*path))
3647 >    return 0;
3648 >
3649 >  if (stat (path, &st) >= 0)
3650 >    {
3651 >      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3652 >    }
3653 >  return rval;
3654 > }
3655 >
3656 > /* Searches for the full path of the wrapper.  Returns
3657 >   newly allocated full path name if found, NULL otherwise
3658 >   Does not chase symlinks, even on platforms that support them.
3659 > */
3660 > char *
3661 > find_executable (const char *wrapper)
3662 > {
3663 >  int has_slash = 0;
3664 >  const char *p;
3665 >  const char *p_next;
3666 >  /* static buffer for getcwd */
3667 >  char tmp[LT_PATHMAX + 1];
3668 >  int tmp_len;
3669 >  char *concat_name;
3670 >
3671 >  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
3672 >                          wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
3673 >
3674 >  if ((wrapper == NULL) || (*wrapper == '\0'))
3675 >    return NULL;
3676 >
3677 >  /* Absolute path? */
3678 > #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3679 >  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3680 >    {
3681 >      concat_name = xstrdup (wrapper);
3682 >      if (check_executable (concat_name))
3683 >        return concat_name;
3684 >      XFREE (concat_name);
3685 >    }
3686 >  else
3687 >    {
3688 > #endif
3689 >      if (IS_DIR_SEPARATOR (wrapper[0]))
3690 >        {
3691 >          concat_name = xstrdup (wrapper);
3692 >          if (check_executable (concat_name))
3693 >            return concat_name;
3694 >          XFREE (concat_name);
3695 >        }
3696 > #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3697 >    }
3698 > #endif
3699 >
3700 >  for (p = wrapper; *p; p++)
3701 >    if (*p == '/')
3702 >      {
3703 >        has_slash = 1;
3704 >        break;
3705 >      }
3706 >  if (!has_slash)
3707 >    {
3708 >      /* no slashes; search PATH */
3709 >      const char *path = getenv ("PATH");
3710 >      if (path != NULL)
3711 >        {
3712 >          for (p = path; *p; p = p_next)
3713 >            {
3714 >              const char *q;
3715 >              size_t p_len;
3716 >              for (q = p; *q; q++)
3717 >                if (IS_PATH_SEPARATOR (*q))
3718 >                  break;
3719 >              p_len = q - p;
3720 >              p_next = (*q == '\0' ? q : q + 1);
3721 >              if (p_len == 0)
3722 >                {
3723 >                  /* empty path: current directory */
3724 >                  if (getcwd (tmp, LT_PATHMAX) == NULL)
3725 >                    lt_fatal ("getcwd failed");
3726 >                  tmp_len = strlen (tmp);
3727 >                  concat_name =
3728 >                    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3729 >                  memcpy (concat_name, tmp, tmp_len);
3730 >                  concat_name[tmp_len] = '/';
3731 >                  strcpy (concat_name + tmp_len + 1, wrapper);
3732 >                }
3733 >              else
3734 >                {
3735 >                  concat_name =
3736 >                    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3737 >                  memcpy (concat_name, p, p_len);
3738 >                  concat_name[p_len] = '/';
3739 >                  strcpy (concat_name + p_len + 1, wrapper);
3740 >                }
3741 >              if (check_executable (concat_name))
3742 >                return concat_name;
3743 >              XFREE (concat_name);
3744 >            }
3745 >        }
3746 >      /* not found in PATH; assume curdir */
3747 >    }
3748 >  /* Relative path | not found in path: prepend cwd */
3749 >  if (getcwd (tmp, LT_PATHMAX) == NULL)
3750 >    lt_fatal ("getcwd failed");
3751 >  tmp_len = strlen (tmp);
3752 >  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3753 >  memcpy (concat_name, tmp, tmp_len);
3754 >  concat_name[tmp_len] = '/';
3755 >  strcpy (concat_name + tmp_len + 1, wrapper);
3756 >
3757 >  if (check_executable (concat_name))
3758 >    return concat_name;
3759 >  XFREE (concat_name);
3760 >  return NULL;
3761 > }
3762 >
3763 > char *
3764 > chase_symlinks (const char *pathspec)
3765 > {
3766 > #ifndef S_ISLNK
3767 >  return xstrdup (pathspec);
3768 > #else
3769 >  char buf[LT_PATHMAX];
3770 >  struct stat s;
3771 >  char *tmp_pathspec = xstrdup (pathspec);
3772 >  char *p;
3773 >  int has_symlinks = 0;
3774 >  while (strlen (tmp_pathspec) && !has_symlinks)
3775 >    {
3776 >      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
3777 >                              tmp_pathspec));
3778 >      if (lstat (tmp_pathspec, &s) == 0)
3779 >        {
3780 >          if (S_ISLNK (s.st_mode) != 0)
3781 >            {
3782 >              has_symlinks = 1;
3783 >              break;
3784 >            }
3785 >
3786 >          /* search backwards for last DIR_SEPARATOR */
3787 >          p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3788 >          while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3789 >            p--;
3790 >          if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3791 >            {
3792 >              /* no more DIR_SEPARATORS left */
3793 >              break;
3794 >            }
3795 >          *p = '\0';
3796 >        }
3797 >      else
3798 >        {
3799 >          char *errstr = strerror (errno);
3800 >          lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
3801 >        }
3802 >    }
3803 >  XFREE (tmp_pathspec);
3804 >
3805 >  if (!has_symlinks)
3806 >    {
3807 >      return xstrdup (pathspec);
3808 >    }
3809 >
3810 >  tmp_pathspec = realpath (pathspec, buf);
3811 >  if (tmp_pathspec == 0)
3812 >    {
3813 >      lt_fatal ("Could not follow symlinks for %s", pathspec);
3814 >    }
3815 >  return xstrdup (tmp_pathspec);
3816 > #endif
3817 > }
3818 >
3819 > char *
3820 > strendzap (char *str, const char *pat)
3821 > {
3822 >  size_t len, patlen;
3823 >
3824 >  assert (str != NULL);
3825 >  assert (pat != NULL);
3826 >
3827 >  len = strlen (str);
3828 >  patlen = strlen (pat);
3829 >
3830 >  if (patlen <= len)
3831 >    {
3832 >      str += len - patlen;
3833 >      if (strcmp (str, pat) == 0)
3834 >        *str = '\0';
3835 >    }
3836 >  return str;
3837 > }
3838 >
3839 > static void
3840 > lt_error_core (int exit_status, const char *mode,
3841 >               const char *message, va_list ap)
3842 > {
3843 >  fprintf (stderr, "%s: %s: ", program_name, mode);
3844 >  vfprintf (stderr, message, ap);
3845 >  fprintf (stderr, ".\n");
3846 >
3847 >  if (exit_status >= 0)
3848 >    exit (exit_status);
3849 > }
3850 >
3851 > void
3852 > lt_fatal (const char *message, ...)
3853 > {
3854 >  va_list ap;
3855 >  va_start (ap, message);
3856 >  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
3857 >  va_end (ap);
3858 > }
3859 >
3860 > void
3861 > lt_setenv (const char *name, const char *value)
3862 > {
3863 >  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
3864 >                          (name ? name : "<NULL>"),
3865 >                          (value ? value : "<NULL>")));
3866 >  {
3867 > #ifdef HAVE_SETENV
3868 >    /* always make a copy, for consistency with !HAVE_SETENV */
3869 >    char *str = xstrdup (value);
3870 >    setenv (name, str, 1);
3871 > #else
3872 >    int len = strlen (name) + 1 + strlen (value) + 1;
3873 >    char *str = XMALLOC (char, len);
3874 >    sprintf (str, "%s=%s", name, value);
3875 >    if (putenv (str) != EXIT_SUCCESS)
3876 >      {
3877 >        XFREE (str);
3878 >      }
3879 > #endif
3880 >  }
3881 > }
3882 >
3883 > char *
3884 > lt_extend_str (const char *orig_value, const char *add, int to_end)
3885 > {
3886 >  char *new_value;
3887 >  if (orig_value && *orig_value)
3888 >    {
3889 >      int orig_value_len = strlen (orig_value);
3890 >      int add_len = strlen (add);
3891 >      new_value = XMALLOC (char, add_len + orig_value_len + 1);
3892 >      if (to_end)
3893 >        {
3894 >          strcpy (new_value, orig_value);
3895 >          strcpy (new_value + orig_value_len, add);
3896 >        }
3897 >      else
3898 >        {
3899 >          strcpy (new_value, add);
3900 >          strcpy (new_value + add_len, orig_value);
3901 >        }
3902 >    }
3903 >  else
3904 >    {
3905 >      new_value = xstrdup (add);
3906 >    }
3907 >  return new_value;
3908 > }
3909 >
3910 > int
3911 > lt_split_name_value (const char *arg, char** name, char** value)
3912 > {
3913 >  const char *p;
3914 >  int len;
3915 >  if (!arg || !*arg)
3916 >    return 1;
3917 >
3918 >  p = strchr (arg, (int)'=');
3919 >
3920 >  if (!p)
3921 >    return 1;
3922 >
3923 >  *value = xstrdup (++p);
3924 >
3925 >  len = strlen (arg) - strlen (*value);
3926 >  *name = XMALLOC (char, len);
3927 >  strncpy (*name, arg, len-1);
3928 >  (*name)[len - 1] = '\0';
3929 >
3930 >  return 0;
3931 > }
3932 >
3933 > void
3934 > lt_opt_process_env_set (const char *arg)
3935 > {
3936 >  char *name = NULL;
3937 >  char *value = NULL;
3938 >
3939 >  if (lt_split_name_value (arg, &name, &value) != 0)
3940 >    {
3941 >      XFREE (name);
3942 >      XFREE (value);
3943 >      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
3944 >    }
3945 >
3946 >  lt_setenv (name, value);
3947 >  XFREE (name);
3948 >  XFREE (value);
3949 > }
3950 >
3951 > void
3952 > lt_opt_process_env_prepend (const char *arg)
3953 > {
3954 >  char *name = NULL;
3955 >  char *value = NULL;
3956 >  char *new_value = NULL;
3957 >
3958 >  if (lt_split_name_value (arg, &name, &value) != 0)
3959 >    {
3960 >      XFREE (name);
3961 >      XFREE (value);
3962 >      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
3963 >    }
3964 >
3965 >  new_value = lt_extend_str (getenv (name), value, 0);
3966 >  lt_setenv (name, new_value);
3967 >  XFREE (new_value);
3968 >  XFREE (name);
3969 >  XFREE (value);
3970 > }
3971 >
3972 > void
3973 > lt_opt_process_env_append (const char *arg)
3974 > {
3975 >  char *name = NULL;
3976 >  char *value = NULL;
3977 >  char *new_value = NULL;
3978 >
3979 >  if (lt_split_name_value (arg, &name, &value) != 0)
3980 >    {
3981 >      XFREE (name);
3982 >      XFREE (value);
3983 >      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
3984 >    }
3985 >
3986 >  new_value = lt_extend_str (getenv (name), value, 1);
3987 >  lt_setenv (name, new_value);
3988 >  XFREE (new_value);
3989 >  XFREE (name);
3990 >  XFREE (value);
3991 > }
3992 >
3993 > void
3994 > lt_update_exe_path (const char *name, const char *value)
3995 > {
3996 >  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
3997 >                          (name ? name : "<NULL>"),
3998 >                          (value ? value : "<NULL>")));
3999 >
4000 >  if (name && *name && value && *value)
4001 >    {
4002 >      char *new_value = lt_extend_str (getenv (name), value, 0);
4003 >      /* some systems can't cope with a ':'-terminated path #' */
4004 >      int len = strlen (new_value);
4005 >      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4006 >        {
4007 >          new_value[len-1] = '\0';
4008 >        }
4009 >      lt_setenv (name, new_value);
4010 >      XFREE (new_value);
4011 >    }
4012 > }
4013 >
4014 > void
4015 > lt_update_lib_path (const char *name, const char *value)
4016 > {
4017 >  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4018 >                          (name ? name : "<NULL>"),
4019 >                          (value ? value : "<NULL>")));
4020 >
4021 >  if (name && *name && value && *value)
4022 >    {
4023 >      char *new_value = lt_extend_str (getenv (name), value, 0);
4024 >      lt_setenv (name, new_value);
4025 >      XFREE (new_value);
4026 >    }
4027 > }
4028 >
4029 >
4030 > EOF
4031 > }
4032 > # end: func_emit_cwrapperexe_src
4033 >
4034 > # func_mode_link arg...
4035 > func_mode_link ()
4036 > {
4037 >    $opt_debug
4038      case $host in
4039 <    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4039 >    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4040        # It is impossible to link a dll without this setting, and
4041        # we shouldn't force the makefile maintainer to figure out
4042        # which system we are compiling for in order to pass an extra
# Line 1114 | Line 4054 | EOF
4054        allow_undefined=yes
4055        ;;
4056      esac
4057 <    libtool_args="$nonopt"
4057 >    libtool_args=$nonopt
4058      base_compile="$nonopt $@"
4059 <    compile_command="$nonopt"
4060 <    finalize_command="$nonopt"
4059 >    compile_command=$nonopt
4060 >    finalize_command=$nonopt
4061  
4062      compile_rpath=
4063      finalize_rpath=
# Line 1132 | Line 4072 | EOF
4072      dllsearchpath=
4073      lib_search_path=`pwd`
4074      inst_prefix_dir=
4075 +    new_inherited_linker_flags=
4076  
4077      avoid_version=no
4078      dlfiles=
# Line 1147 | Line 4088 | EOF
4088      no_install=no
4089      objs=
4090      non_pic_objects=
1150    notinst_path= # paths that contain not-installed libtool libraries
4091      precious_files_regex=
4092      prefer_static_libs=no
4093      preload=no
# Line 1161 | Line 4101 | EOF
4101      thread_safe=no
4102      vinfo=
4103      vinfo_number=no
4104 <
4104 >    weak_libs=
4105 >    single_module="${wl}-single_module"
4106      func_infer_tag $base_compile
4107  
4108      # We need to know -static, to get the right output filenames.
4109      for arg
4110      do
4111        case $arg in
4112 +      -shared)
4113 +        test "$build_libtool_libs" != yes && \
4114 +          func_fatal_configuration "can not build a shared library"
4115 +        build_old_libs=no
4116 +        break
4117 +        ;;
4118        -all-static | -static | -static-libtool-libs)
4119          case $arg in
4120          -all-static)
4121            if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
4122 <            $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
4122 >            func_warning "complete static linking is impossible in this configuration"
4123            fi
4124            if test -n "$link_static_flag"; then
4125              dlopen_self=$dlopen_self_static
# Line 1206 | Line 4153 | EOF
4153      while test "$#" -gt 0; do
4154        arg="$1"
4155        shift
4156 <      case $arg in
4157 <      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
4158 <        qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1212 <        ;;
1213 <      *) qarg=$arg ;;
1214 <      esac
1215 <      libtool_args="$libtool_args $qarg"
4156 >      func_quote_for_eval "$arg"
4157 >      qarg=$func_quote_for_eval_unquoted_result
4158 >      func_append libtool_args " $func_quote_for_eval_result"
4159  
4160        # If the previous option needs an argument, assign it.
4161        if test -n "$prev"; then
4162          case $prev in
4163          output)
4164 <          compile_command="$compile_command @OUTPUT@"
4165 <          finalize_command="$finalize_command @OUTPUT@"
4164 >          func_append compile_command " @OUTPUT@"
4165 >          func_append finalize_command " @OUTPUT@"
4166            ;;
4167          esac
4168  
# Line 1227 | Line 4170 | EOF
4170          dlfiles|dlprefiles)
4171            if test "$preload" = no; then
4172              # Add the symbol object into the linking commands.
4173 <            compile_command="$compile_command @SYMFILE@"
4174 <            finalize_command="$finalize_command @SYMFILE@"
4173 >            func_append compile_command " @SYMFILE@"
4174 >            func_append finalize_command " @SYMFILE@"
4175              preload=yes
4176            fi
4177            case $arg in
# Line 1266 | Line 4209 | EOF
4209            ;;
4210          expsyms)
4211            export_symbols="$arg"
4212 <          if test ! -f "$arg"; then
4213 <            $echo "$modename: symbol file \`$arg' does not exist"
1271 <            exit $EXIT_FAILURE
1272 <          fi
4212 >          test -f "$arg" \
4213 >            || func_fatal_error "symbol file \`$arg' does not exist"
4214            prev=
4215            continue
4216            ;;
# Line 1278 | Line 4219 | EOF
4219            prev=
4220            continue
4221            ;;
4222 <        inst_prefix)
4223 <          inst_prefix_dir="$arg"
4224 <          prev=
4225 <          continue
4226 <          ;;
4227 <        precious_regex)
4228 <          precious_files_regex="$arg"
4222 >        framework)
4223 >          case $host in
4224 >            *-*-darwin*)
4225 >              case "$deplibs " in
4226 >                *" $qarg.ltframework "*) ;;
4227 >                *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4228 >                   ;;
4229 >              esac
4230 >              ;;
4231 >          esac
4232            prev=
4233            continue
4234            ;;
4235 <        release)
4236 <          release="-$arg"
4235 >        inst_prefix)
4236 >          inst_prefix_dir="$arg"
4237            prev=
4238            continue
4239            ;;
# Line 1297 | Line 4241 | EOF
4241            if test -f "$arg"; then
4242              save_arg=$arg
4243              moreargs=
4244 <            for fil in `cat $save_arg`
4244 >            for fil in `cat "$save_arg"`
4245              do
4246   #             moreargs="$moreargs $fil"
4247                arg=$fil
4248                # A libtool-controlled object.
4249  
4250                # Check to see that this really is a libtool object.
4251 <              if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4251 >              if func_lalib_unsafe_p "$arg"; then
4252                  pic_object=
4253                  non_pic_object=
4254  
4255                  # Read the .lo file
4256 <                # If there is no directory component, then add one.
1313 <                case $arg in
1314 <                */* | *\\*) . $arg ;;
1315 <                *) . ./$arg ;;
1316 <                esac
4256 >                func_source "$arg"
4257  
4258 <                if test -z "$pic_object" || \
4258 >                if test -z "$pic_object" ||
4259                     test -z "$non_pic_object" ||
4260 <                   test "$pic_object" = none && \
4260 >                   test "$pic_object" = none &&
4261                     test "$non_pic_object" = none; then
4262 <                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1323 <                  exit $EXIT_FAILURE
4262 >                  func_fatal_error "cannot find name of object for \`$arg'"
4263                  fi
4264  
4265                  # Extract subdirectory from the argument.
4266 <                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
4267 <                if test "X$xdir" = "X$arg"; then
1329 <                  xdir=
1330 <                else
1331 <                  xdir="$xdir/"
1332 <                fi
4266 >                func_dirname "$arg" "/" ""
4267 >                xdir="$func_dirname_result"
4268  
4269                  if test "$pic_object" != none; then
4270                    # Prepend the subdirectory the object is found in.
# Line 1354 | Line 4289 | EOF
4289                    fi
4290  
4291                    # A PIC object.
4292 <                  libobjs="$libobjs $pic_object"
4292 >                  func_append libobjs " $pic_object"
4293                    arg="$pic_object"
4294                  fi
4295  
# Line 1364 | Line 4299 | EOF
4299                    non_pic_object="$xdir$non_pic_object"
4300  
4301                    # A standard non-PIC object
4302 <                  non_pic_objects="$non_pic_objects $non_pic_object"
4302 >                  func_append non_pic_objects " $non_pic_object"
4303                    if test -z "$pic_object" || test "$pic_object" = none ; then
4304                      arg="$non_pic_object"
4305                    fi
# Line 1372 | Line 4307 | EOF
4307                    # If the PIC object exists, use it instead.
4308                    # $xdir was prepended to $pic_object above.
4309                    non_pic_object="$pic_object"
4310 <                  non_pic_objects="$non_pic_objects $non_pic_object"
4310 >                  func_append non_pic_objects " $non_pic_object"
4311                  fi
4312                else
4313                  # Only an error if not doing a dry-run.
4314 <                if test -z "$run"; then
1380 <                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1381 <                  exit $EXIT_FAILURE
1382 <                else
1383 <                  # Dry-run case.
1384 <
4314 >                if $opt_dry_run; then
4315                    # Extract subdirectory from the argument.
4316 <                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
4317 <                  if test "X$xdir" = "X$arg"; then
1388 <                    xdir=
1389 <                  else
1390 <                    xdir="$xdir/"
1391 <                  fi
4316 >                  func_dirname "$arg" "/" ""
4317 >                  xdir="$func_dirname_result"
4318  
4319 <                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
4320 <                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
4321 <                  libobjs="$libobjs $pic_object"
4322 <                  non_pic_objects="$non_pic_objects $non_pic_object"
4319 >                  func_lo2o "$arg"
4320 >                  pic_object=$xdir$objdir/$func_lo2o_result
4321 >                  non_pic_object=$xdir$func_lo2o_result
4322 >                  func_append libobjs " $pic_object"
4323 >                  func_append non_pic_objects " $non_pic_object"
4324 >                else
4325 >                  func_fatal_error "\`$arg' is not a valid libtool object"
4326                  fi
4327                fi
4328              done
4329            else
4330 <            $echo "$modename: link input file \`$save_arg' does not exist"
1402 <            exit $EXIT_FAILURE
4330 >            func_fatal_error "link input file \`$arg' does not exist"
4331            fi
4332            arg=$save_arg
4333            prev=
4334            continue
4335            ;;
4336 +        precious_regex)
4337 +          precious_files_regex="$arg"
4338 +          prev=
4339 +          continue
4340 +          ;;
4341 +        release)
4342 +          release="-$arg"
4343 +          prev=
4344 +          continue
4345 +          ;;
4346          rpath | xrpath)
4347            # We need an absolute path.
4348            case $arg in
4349            [\\/]* | [A-Za-z]:[\\/]*) ;;
4350            *)
4351 <            $echo "$modename: only absolute run-paths are allowed" 1>&2
1414 <            exit $EXIT_FAILURE
4351 >            func_fatal_error "only absolute run-paths are allowed"
4352              ;;
4353            esac
4354            if test "$prev" = rpath; then
# Line 1428 | Line 4365 | EOF
4365            prev=
4366            continue
4367            ;;
4368 <        xcompiler)
4369 <          compiler_flags="$compiler_flags $qarg"
4368 >        shrext)
4369 >          shrext_cmds="$arg"
4370            prev=
1434          compile_command="$compile_command $qarg"
1435          finalize_command="$finalize_command $qarg"
4371            continue
4372            ;;
4373 <        xlinker)
4374 <          linker_flags="$linker_flags $qarg"
1440 <          compiler_flags="$compiler_flags $wl$qarg"
4373 >        weak)
4374 >          weak_libs="$weak_libs $arg"
4375            prev=
1442          compile_command="$compile_command $wl$qarg"
1443          finalize_command="$finalize_command $wl$qarg"
4376            continue
4377            ;;
4378          xcclinker)
4379            linker_flags="$linker_flags $qarg"
4380            compiler_flags="$compiler_flags $qarg"
4381            prev=
4382 <          compile_command="$compile_command $qarg"
4383 <          finalize_command="$finalize_command $qarg"
4382 >          func_append compile_command " $qarg"
4383 >          func_append finalize_command " $qarg"
4384            continue
4385            ;;
4386 <        shrext)
4387 <          shrext_cmds="$arg"
4386 >        xcompiler)
4387 >          compiler_flags="$compiler_flags $qarg"
4388            prev=
4389 +          func_append compile_command " $qarg"
4390 +          func_append finalize_command " $qarg"
4391            continue
4392            ;;
4393 <        darwin_framework|darwin_framework_skip)
4394 <          test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
4395 <          compile_command="$compile_command $arg"
1462 <          finalize_command="$finalize_command $arg"
4393 >        xlinker)
4394 >          linker_flags="$linker_flags $qarg"
4395 >          compiler_flags="$compiler_flags $wl$qarg"
4396            prev=
4397 +          func_append compile_command " $wl$qarg"
4398 +          func_append finalize_command " $wl$qarg"
4399            continue
4400            ;;
4401          *)
# Line 1476 | Line 4411 | EOF
4411        case $arg in
4412        -all-static)
4413          if test -n "$link_static_flag"; then
4414 <          compile_command="$compile_command $link_static_flag"
4415 <          finalize_command="$finalize_command $link_static_flag"
4414 >          # See comment for -static flag below, for more details.
4415 >          func_append compile_command " $link_static_flag"
4416 >          func_append finalize_command " $link_static_flag"
4417          fi
4418          continue
4419          ;;
4420  
4421        -allow-undefined)
4422          # FIXME: remove this flag sometime in the future.
4423 <        $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1488 <        continue
4423 >        func_fatal_error "\`-allow-undefined' must not be used because it is the default"
4424          ;;
4425  
4426        -avoid-version)
# Line 1510 | Line 4445 | EOF
4445  
4446        -export-symbols | -export-symbols-regex)
4447          if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
4448 <          $echo "$modename: more than one -exported-symbols argument is not allowed"
1514 <          exit $EXIT_FAILURE
4448 >          func_fatal_error "more than one -exported-symbols argument is not allowed"
4449          fi
4450          if test "X$arg" = "X-export-symbols"; then
4451            prev=expsyms
# Line 1521 | Line 4455 | EOF
4455          continue
4456          ;;
4457  
4458 <      -framework|-arch|-isysroot)
4459 <        case " $CC " in
1526 <          *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1527 <                prev=darwin_framework_skip ;;
1528 <          *) compiler_flags="$compiler_flags $arg"
1529 <             prev=darwin_framework ;;
1530 <        esac
1531 <        compile_command="$compile_command $arg"
1532 <        finalize_command="$finalize_command $arg"
4458 >      -framework)
4459 >        prev=framework
4460          continue
4461          ;;
4462  
# Line 1543 | Line 4470 | EOF
4470        -L[A-Z][A-Z]*:*)
4471          case $with_gcc/$host in
4472          no/*-*-irix* | /*-*-irix*)
4473 <          compile_command="$compile_command $arg"
4474 <          finalize_command="$finalize_command $arg"
4473 >          func_append compile_command " $arg"
4474 >          func_append finalize_command " $arg"
4475            ;;
4476          esac
4477          continue
4478          ;;
4479  
4480        -L*)
4481 <        dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
4481 >        func_stripname '-L' '' "$arg"
4482 >        dir=$func_stripname_result
4483 >        if test -z "$dir"; then
4484 >          if test "$#" -gt 0; then
4485 >            func_fatal_error "require no space between \`-L' and \`$1'"
4486 >          else
4487 >            func_fatal_error "need path for \`-L' option"
4488 >          fi
4489 >        fi
4490          # We need an absolute path.
4491          case $dir in
4492          [\\/]* | [A-Za-z]:[\\/]*) ;;
4493          *)
4494            absdir=`cd "$dir" && pwd`
4495 <          if test -z "$absdir"; then
4496 <            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1562 <            absdir="$dir"
1563 <            notinst_path="$notinst_path $dir"
1564 <          fi
4495 >          test -z "$absdir" && \
4496 >            func_fatal_error "cannot determine absolute directory name of \`$dir'"
4497            dir="$absdir"
4498            ;;
4499          esac
# Line 1573 | Line 4505 | EOF
4505            ;;
4506          esac
4507          case $host in
4508 <        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4509 <          testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
4508 >        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
4509 >          testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
4510            case :$dllsearchpath: in
4511            *":$dir:"*) ;;
4512 +          ::) dllsearchpath=$dir;;
4513            *) dllsearchpath="$dllsearchpath:$dir";;
4514            esac
4515            case :$dllsearchpath: in
4516            *":$testbindir:"*) ;;
4517 +          ::) dllsearchpath=$testbindir;;
4518            *) dllsearchpath="$dllsearchpath:$testbindir";;
4519            esac
4520            ;;
# Line 1591 | Line 4525 | EOF
4525        -l*)
4526          if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
4527            case $host in
4528 <          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
4528 >          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
4529              # These systems don't actually have a C or math library (as such)
4530              continue
4531              ;;
# Line 1605 | Line 4539 | EOF
4539              ;;
4540            *-*-rhapsody* | *-*-darwin1.[012])
4541              # Rhapsody C and math libraries are in the System framework
4542 <            deplibs="$deplibs -framework System"
4542 >            deplibs="$deplibs System.ltframework"
4543              continue
4544              ;;
4545            *-*-sco3.2v5* | *-*-sco5v6*)
# Line 1629 | Line 4563 | EOF
4563          continue
4564          ;;
4565  
4566 +      -module)
4567 +        module=yes
4568 +        continue
4569 +        ;;
4570 +
4571        # Tru64 UNIX uses -model [arg] to determine the layout of C++
4572        # classes, name mangling, and exception handling.
4573 <      -model)
4574 <        compile_command="$compile_command $arg"
4573 >      # Darwin uses the -arch flag to determine output architecture.
4574 >      -model|-arch|-isysroot)
4575          compiler_flags="$compiler_flags $arg"
4576 <        finalize_command="$finalize_command $arg"
4576 >        func_append compile_command " $arg"
4577 >        func_append finalize_command " $arg"
4578          prev=xcompiler
4579          continue
4580          ;;
4581  
4582 <     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4582 >      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4583          compiler_flags="$compiler_flags $arg"
4584 <        compile_command="$compile_command $arg"
4585 <        finalize_command="$finalize_command $arg"
4584 >        func_append compile_command " $arg"
4585 >        func_append finalize_command " $arg"
4586 >        case "$new_inherited_linker_flags " in
4587 >            *" $arg "*) ;;
4588 >            * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
4589 >        esac
4590          continue
4591          ;;
4592  
4593 <      -module)
4594 <        module=yes
1651 <        continue
1652 <        ;;
1653 <
1654 <      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1655 <      # -r[0-9][0-9]* specifies the processor on the SGI compiler
1656 <      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1657 <      # +DA*, +DD* enable 64-bit mode on the HP compiler
1658 <      # -q* pass through compiler args for the IBM compiler
1659 <      # -m* pass through architecture-specific compiler args for GCC
1660 <      # -m*, -t[45]*, -txscale* pass through architecture-specific
1661 <      # compiler args for GCC
1662 <      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1663 <      # -F/path gives path to uninstalled frameworks, gcc on darwin
1664 <      # @file GCC response files
1665 <      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1666 <      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1667 <
1668 <        # Unknown arguments in both finalize_command and compile_command need
1669 <        # to be aesthetically quoted because they are evaled later.
1670 <        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1671 <        case $arg in
1672 <        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1673 <          arg="\"$arg\""
1674 <          ;;
1675 <        esac
1676 <        compile_command="$compile_command $arg"
1677 <        finalize_command="$finalize_command $arg"
1678 <        compiler_flags="$compiler_flags $arg"
1679 <        continue
1680 <        ;;
1681 <
1682 <      -shrext)
1683 <        prev=shrext
4593 >      -multi_module)
4594 >        single_module="${wl}-multi_module"
4595          continue
4596          ;;
4597  
# Line 1691 | Line 4602 | EOF
4602  
4603        -no-install)
4604          case $host in
4605 <        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
4605 >        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
4606            # The PATH hackery in wrapper scripts is required on Windows
4607            # and Darwin in order for the loader to find any dlls it needs.
4608 <          $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
4609 <          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
4608 >          func_warning "\`-no-install' is ignored for $host"
4609 >          func_warning "assuming \`-no-fast-install' instead"
4610            fast_install=no
4611            ;;
4612          *) no_install=yes ;;
# Line 1736 | Line 4647 | EOF
4647          ;;
4648  
4649        -R*)
4650 <        dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
4650 >        func_stripname '-R' '' "$arg"
4651 >        dir=$func_stripname_result
4652          # We need an absolute path.
4653          case $dir in
4654          [\\/]* | [A-Za-z]:[\\/]*) ;;
4655          *)
4656 <          $echo "$modename: only absolute run-paths are allowed" 1>&2
1745 <          exit $EXIT_FAILURE
4656 >          func_fatal_error "only absolute run-paths are allowed"
4657            ;;
4658          esac
4659          case "$xrpath " in
# Line 1752 | Line 4663 | EOF
4663          continue
4664          ;;
4665  
4666 +      -shared)
4667 +        # The effects of -shared are defined in a previous loop.
4668 +        continue
4669 +        ;;
4670 +
4671 +      -shrext)
4672 +        prev=shrext
4673 +        continue
4674 +        ;;
4675 +
4676        -static | -static-libtool-libs)
4677          # The effects of -static are defined in a previous loop.
4678          # We used to do the same as -all-static on platforms that
# Line 1770 | Line 4691 | EOF
4691          prev=vinfo
4692          continue
4693          ;;
4694 +
4695        -version-number)
4696          prev=vinfo
4697          vinfo_number=yes
4698          continue
4699          ;;
4700  
4701 +      -weak)
4702 +        prev=weak
4703 +        continue
4704 +        ;;
4705 +
4706        -Wc,*)
4707 <        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
4707 >        func_stripname '-Wc,' '' "$arg"
4708 >        args=$func_stripname_result
4709          arg=
4710          save_ifs="$IFS"; IFS=','
4711          for flag in $args; do
4712            IFS="$save_ifs"
4713 <          case $flag in
4714 <            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
4715 <            flag="\"$flag\""
1788 <            ;;
1789 <          esac
1790 <          arg="$arg $wl$flag"
1791 <          compiler_flags="$compiler_flags $flag"
4713 >          func_quote_for_eval "$flag"
4714 >          arg="$arg $wl$func_quote_for_eval_result"
4715 >          compiler_flags="$compiler_flags $func_quote_for_eval_result"
4716          done
4717          IFS="$save_ifs"
4718 <        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
4718 >        func_stripname ' ' '' "$arg"
4719 >        arg=$func_stripname_result
4720          ;;
4721  
4722        -Wl,*)
4723 <        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
4723 >        func_stripname '-Wl,' '' "$arg"
4724 >        args=$func_stripname_result
4725          arg=
4726          save_ifs="$IFS"; IFS=','
4727          for flag in $args; do
4728            IFS="$save_ifs"
4729 <          case $flag in
4730 <            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
4731 <            flag="\"$flag\""
4732 <            ;;
1807 <          esac
1808 <          arg="$arg $wl$flag"
1809 <          compiler_flags="$compiler_flags $wl$flag"
1810 <          linker_flags="$linker_flags $flag"
4729 >          func_quote_for_eval "$flag"
4730 >          arg="$arg $wl$func_quote_for_eval_result"
4731 >          compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
4732 >          linker_flags="$linker_flags $func_quote_for_eval_result"
4733          done
4734          IFS="$save_ifs"
4735 <        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
4735 >        func_stripname ' ' '' "$arg"
4736 >        arg=$func_stripname_result
4737          ;;
4738  
4739        -Xcompiler)
# Line 1828 | Line 4751 | EOF
4751          continue
4752          ;;
4753  
4754 +      # -msg_* for osf cc
4755 +      -msg_*)
4756 +        func_quote_for_eval "$arg"
4757 +        arg="$func_quote_for_eval_result"
4758 +        ;;
4759 +
4760 +      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
4761 +      # -r[0-9][0-9]* specifies the processor on the SGI compiler
4762 +      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
4763 +      # +DA*, +DD* enable 64-bit mode on the HP compiler
4764 +      # -q* pass through compiler args for the IBM compiler
4765 +      # -m*, -t[45]*, -txscale* pass through architecture-specific
4766 +      # compiler args for GCC
4767 +      # -F/path gives path to uninstalled frameworks, gcc on darwin
4768 +      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
4769 +      # @file GCC response files
4770 +      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
4771 +      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
4772 +        func_quote_for_eval "$arg"
4773 +        arg="$func_quote_for_eval_result"
4774 +        func_append compile_command " $arg"
4775 +        func_append finalize_command " $arg"
4776 +        compiler_flags="$compiler_flags $arg"
4777 +        continue
4778 +        ;;
4779 +
4780        # Some other compiler flag.
4781        -* | +*)
4782 <        # Unknown arguments in both finalize_command and compile_command need
4783 <        # to be aesthetically quoted because they are evaled later.
1835 <        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1836 <        case $arg in
1837 <        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1838 <          arg="\"$arg\""
1839 <          ;;
1840 <        esac
4782 >        func_quote_for_eval "$arg"
4783 >        arg="$func_quote_for_eval_result"
4784          ;;
4785  
4786        *.$objext)
# Line 1849 | Line 4792 | EOF
4792          # A libtool-controlled object.
4793  
4794          # Check to see that this really is a libtool object.
4795 <        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4795 >        if func_lalib_unsafe_p "$arg"; then
4796            pic_object=
4797            non_pic_object=
4798  
4799            # Read the .lo file
4800 <          # If there is no directory component, then add one.
1858 <          case $arg in
1859 <          */* | *\\*) . $arg ;;
1860 <          *) . ./$arg ;;
1861 <          esac
4800 >          func_source "$arg"
4801  
4802 <          if test -z "$pic_object" || \
4802 >          if test -z "$pic_object" ||
4803               test -z "$non_pic_object" ||
4804 <             test "$pic_object" = none && \
4804 >             test "$pic_object" = none &&
4805               test "$non_pic_object" = none; then
4806 <            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1868 <            exit $EXIT_FAILURE
4806 >            func_fatal_error "cannot find name of object for \`$arg'"
4807            fi
4808  
4809            # Extract subdirectory from the argument.
4810 <          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
4811 <          if test "X$xdir" = "X$arg"; then
1874 <            xdir=
1875 <          else
1876 <            xdir="$xdir/"
1877 <          fi
4810 >          func_dirname "$arg" "/" ""
4811 >          xdir="$func_dirname_result"
4812  
4813            if test "$pic_object" != none; then
4814              # Prepend the subdirectory the object is found in.
# Line 1899 | Line 4833 | EOF
4833              fi
4834  
4835              # A PIC object.
4836 <            libobjs="$libobjs $pic_object"
4836 >            func_append libobjs " $pic_object"
4837              arg="$pic_object"
4838            fi
4839  
# Line 1909 | Line 4843 | EOF
4843              non_pic_object="$xdir$non_pic_object"
4844  
4845              # A standard non-PIC object
4846 <            non_pic_objects="$non_pic_objects $non_pic_object"
4846 >            func_append non_pic_objects " $non_pic_object"
4847              if test -z "$pic_object" || test "$pic_object" = none ; then
4848                arg="$non_pic_object"
4849              fi
# Line 1917 | Line 4851 | EOF
4851              # If the PIC object exists, use it instead.
4852              # $xdir was prepended to $pic_object above.
4853              non_pic_object="$pic_object"
4854 <            non_pic_objects="$non_pic_objects $non_pic_object"
4854 >            func_append non_pic_objects " $non_pic_object"
4855            fi
4856          else
4857            # Only an error if not doing a dry-run.
4858 <          if test -z "$run"; then
1925 <            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1926 <            exit $EXIT_FAILURE
1927 <          else
1928 <            # Dry-run case.
1929 <
4858 >          if $opt_dry_run; then
4859              # Extract subdirectory from the argument.
4860 <            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
4861 <            if test "X$xdir" = "X$arg"; then
1933 <              xdir=
1934 <            else
1935 <              xdir="$xdir/"
1936 <            fi
4860 >            func_dirname "$arg" "/" ""
4861 >            xdir="$func_dirname_result"
4862  
4863 <            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
4864 <            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
4865 <            libobjs="$libobjs $pic_object"
4866 <            non_pic_objects="$non_pic_objects $non_pic_object"
4863 >            func_lo2o "$arg"
4864 >            pic_object=$xdir$objdir/$func_lo2o_result
4865 >            non_pic_object=$xdir$func_lo2o_result
4866 >            func_append libobjs " $pic_object"
4867 >            func_append non_pic_objects " $non_pic_object"
4868 >          else
4869 >            func_fatal_error "\`$arg' is not a valid libtool object"
4870            fi
4871          fi
4872          ;;
# Line 1971 | Line 4899 | EOF
4899        *)
4900          # Unknown arguments in both finalize_command and compile_command need
4901          # to be aesthetically quoted because they are evaled later.
4902 <        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4903 <        case $arg in
1976 <        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1977 <          arg="\"$arg\""
1978 <          ;;
1979 <        esac
4902 >        func_quote_for_eval "$arg"
4903 >        arg="$func_quote_for_eval_result"
4904          ;;
4905        esac # arg
4906  
4907        # Now actually substitute the argument into the commands.
4908        if test -n "$arg"; then
4909 <        compile_command="$compile_command $arg"
4910 <        finalize_command="$finalize_command $arg"
4909 >        func_append compile_command " $arg"
4910 >        func_append finalize_command " $arg"
4911        fi
4912      done # argument parsing loop
4913  
4914 <    if test -n "$prev"; then
4915 <      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
4916 <      $echo "$help" 1>&2
4917 <      exit $EXIT_FAILURE
4914 >    if test "$module" = yes ; then
4915 >      # [Mandriva] dropping ld option "--no-undefined" which is wrong for plugins
4916 >      linker_flags=`$ECHO "X $linker_flags" | $Xsed -e 's/ --no-undefined//'`
4917 >      compiler_flags=`$ECHO "X $compiler_flags" | $Xsed -e 's/ -Wl,--no-undefined//'`
4918      fi
4919  
4920 +    test -n "$prev" && \
4921 +      func_fatal_help "the \`$prevarg' option requires an argument"
4922 +
4923      if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
4924        eval arg=\"$export_dynamic_flag_spec\"
4925 <      compile_command="$compile_command $arg"
4926 <      finalize_command="$finalize_command $arg"
4925 >      func_append compile_command " $arg"
4926 >      func_append finalize_command " $arg"
4927      fi
4928  
4929      oldlibs=
4930      # calculate the name of the file, without its directory
4931 <    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
4931 >    func_basename "$output"
4932 >    outputname="$func_basename_result"
4933      libobjs_save="$libobjs"
4934  
4935      if test -n "$shlibpath_var"; then
4936        # get the directories listed in $shlibpath_var
4937 <      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
4937 >      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
4938      else
4939        shlib_search_path=
4940      fi
4941      eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
4942      eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
4943  
4944 <    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
4945 <    if test "X$output_objdir" = "X$output"; then
2018 <      output_objdir="$objdir"
2019 <    else
2020 <      output_objdir="$output_objdir/$objdir"
2021 <    fi
4944 >    func_dirname "$output" "/" ""
4945 >    output_objdir="$func_dirname_result$objdir"
4946      # Create the object directory.
4947 <    if test ! -d "$output_objdir"; then
2024 <      $show "$mkdir $output_objdir"
2025 <      $run $mkdir $output_objdir
2026 <      exit_status=$?
2027 <      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2028 <        exit $exit_status
2029 <      fi
2030 <    fi
4947 >    func_mkdir_p "$output_objdir"
4948  
4949      # Determine the type of output
4950      case $output in
4951      "")
4952 <      $echo "$modename: you must specify an output file" 1>&2
2036 <      $echo "$help" 1>&2
2037 <      exit $EXIT_FAILURE
4952 >      func_fatal_help "you must specify an output file"
4953        ;;
4954      *.$libext) linkmode=oldlib ;;
4955      *.lo | *.$objext) linkmode=obj ;;
# Line 2042 | Line 4957 | EOF
4957      *) linkmode=prog ;; # Anything else should be a program.
4958      esac
4959  
2045    case $host in
2046    *cygwin* | *mingw* | *pw32*)
2047      # don't eliminate duplications in $postdeps and $predeps
2048      duplicate_compiler_generated_deps=yes
2049      ;;
2050    *)
2051      duplicate_compiler_generated_deps=$duplicate_deps
2052      ;;
2053    esac
4960      specialdeplibs=
4961  
4962      libs=
4963      # Find all interdependent deplibs by searching for libraries
4964      # that are linked more than once (e.g. -la -lb -la)
4965      for deplib in $deplibs; do
4966 <      if test "X$duplicate_deps" = "Xyes" ; then
4966 >      if $opt_duplicate_deps ; then
4967          case "$libs " in
4968          *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4969          esac
# Line 2072 | Line 4978 | EOF
4978        # $postdeps and mark them as special (i.e., whose duplicates are
4979        # not to be eliminated).
4980        pre_post_deps=
4981 <      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
4981 >      if $opt_duplicate_compiler_generated_deps; then
4982          for pre_post_dep in $predeps $postdeps; do
4983            case "$pre_post_deps " in
4984            *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
# Line 2088 | Line 4994 | EOF
4994      newlib_search_path=
4995      need_relink=no # whether we're linking any uninstalled libtool libraries
4996      notinst_deplibs= # not-installed libtool libraries
4997 +    notinst_path= # paths that contain not-installed libtool libraries
4998 +
4999      case $linkmode in
5000      lib)
5001 <        passes="conv link"
5001 >        passes="conv dlpreopen link"
5002          for file in $dlfiles $dlprefiles; do
5003            case $file in
5004            *.la) ;;
5005            *)
5006 <            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2099 <            exit $EXIT_FAILURE
5006 >            func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
5007              ;;
5008            esac
5009          done
# Line 2112 | Line 5019 | EOF
5019      *)  passes="conv"
5020          ;;
5021      esac
5022 +
5023      for pass in $passes; do
5024 +      # The preopen pass in lib mode reverses $deplibs; put it back here
5025 +      # so that -L comes before libs that need it for instance...
5026 +      if test "$linkmode,$pass" = "lib,link"; then
5027 +        ## FIXME: Find the place where the list is rebuilt in the wrong
5028 +        ##        order, and fix it there properly
5029 +        tmp_deplibs=
5030 +        for deplib in $deplibs; do
5031 +          tmp_deplibs="$deplib $tmp_deplibs"
5032 +        done
5033 +        deplibs="$tmp_deplibs"
5034 +      fi
5035 +
5036        if test "$linkmode,$pass" = "lib,link" ||
5037           test "$linkmode,$pass" = "prog,scan"; then
5038          libs="$deplibs"
# Line 2122 | Line 5042 | EOF
5042          case $pass in
5043          dlopen) libs="$dlfiles" ;;
5044          dlpreopen) libs="$dlprefiles" ;;
5045 <        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5045 >        link)
5046 >          libs="$deplibs %DEPLIBS%"
5047 >          test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
5048 >          ;;
5049          esac
5050        fi
5051 +      if test "$linkmode,$pass" = "lib,dlpreopen"; then
5052 +        # Collect and forward deplibs of preopened libtool libs
5053 +        for lib in $dlprefiles; do
5054 +          # Ignore non-libtool-libs
5055 +          dependency_libs=
5056 +          case $lib in
5057 +          *.la) func_source "$lib" ;;
5058 +          esac
5059 +
5060 +          # Collect preopened libtool deplibs, except any this library
5061 +          # has declared as weak libs
5062 +          for deplib in $dependency_libs; do
5063 +            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
5064 +            case " $weak_libs " in
5065 +            *" $deplib_base "*) ;;
5066 +            *) deplibs="$deplibs $deplib" ;;
5067 +            esac
5068 +          done
5069 +        done
5070 +        libs="$dlprefiles"
5071 +      fi
5072        if test "$pass" = dlopen; then
5073          # Collect dlpreopened libraries
5074          save_deplibs="$deplibs"
5075          deplibs=
5076        fi
5077 +
5078        for deplib in $libs; do
5079          lib=
5080          found=no
# Line 2140 | Line 5085 | EOF
5085              finalize_deplibs="$deplib $finalize_deplibs"
5086            else
5087              compiler_flags="$compiler_flags $deplib"
5088 +            if test "$linkmode" = lib ; then
5089 +                case "$new_inherited_linker_flags " in
5090 +                    *" $deplib "*) ;;
5091 +                    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5092 +                esac
5093 +            fi
5094            fi
5095            continue
5096            ;;
5097          -l*)
5098            if test "$linkmode" != lib && test "$linkmode" != prog; then
5099 <            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
5099 >            func_warning "\`-l' is ignored for archives/objects"
5100              continue
5101            fi
5102 <          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
5103 <          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
5102 >          func_stripname '-l' '' "$deplib"
5103 >          name=$func_stripname_result
5104 >          if test "$linkmode" = lib; then
5105 >            searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5106 >          else
5107 >            searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5108 >          fi
5109 >          for searchdir in $searchdirs; do
5110              for search_ext in .la $std_shrext .so .a; do
5111                # Search the libtool library
5112                lib="$searchdir/lib${name}${search_ext}"
# Line 2179 | Line 5136 | EOF
5136              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5137                case " $predeps $postdeps " in
5138                *" $deplib "*)
5139 <                if (${SED} -e '2q' $lib |
2183 <                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5139 >                if func_lalib_p "$lib"; then
5140                    library_names=
5141                    old_library=
5142 <                  case $lib in
2187 <                  */* | *\\*) . $lib ;;
2188 <                  *) . ./$lib ;;
2189 <                  esac
5142 >                  func_source "$lib"
5143                    for l in $old_library $library_names; do
5144                      ll="$l"
5145                    done
5146                    if test "X$ll" = "X$old_library" ; then # only static version available
5147                      found=no
5148 <                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
5149 <                    test "X$ladir" = "X$lib" && ladir="."
5148 >                    func_dirname "$lib" "" "."
5149 >                    ladir="$func_dirname_result"
5150                      lib=$ladir/$old_library
5151                      if test "$linkmode,$pass" = "prog,link"; then
5152                        compile_deplibs="$deplib $compile_deplibs"
# Line 2205 | Line 5158 | EOF
5158                      continue
5159                    fi
5160                  fi
5161 <                ;;
5161 >                ;;
5162                *) ;;
5163                esac
5164              fi
5165            fi
5166            ;; # -l
5167 +        *.ltframework)
5168 +          if test "$linkmode,$pass" = "prog,link"; then
5169 +            compile_deplibs="$deplib $compile_deplibs"
5170 +            finalize_deplibs="$deplib $finalize_deplibs"
5171 +          else
5172 +            deplibs="$deplib $deplibs"
5173 +            if test "$linkmode" = lib ; then
5174 +                case "$new_inherited_linker_flags " in
5175 +                    *" $deplib "*) ;;
5176 +                    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5177 +                esac
5178 +            fi
5179 +          fi
5180 +          continue
5181 +          ;;
5182          -L*)
5183            case $linkmode in
5184            lib)
5185              deplibs="$deplib $deplibs"
5186              test "$pass" = conv && continue
5187              newdependency_libs="$deplib $newdependency_libs"
5188 <            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
5188 >            func_stripname '-L' '' "$deplib"
5189 >            newlib_search_path="$newlib_search_path $func_stripname_result"
5190              ;;
5191            prog)
5192              if test "$pass" = conv; then
# Line 2230 | Line 5199 | EOF
5199                compile_deplibs="$deplib $compile_deplibs"
5200                finalize_deplibs="$deplib $finalize_deplibs"
5201              fi
5202 <            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
5202 >            func_stripname '-L' '' "$deplib"
5203 >            newlib_search_path="$newlib_search_path $func_stripname_result"
5204              ;;
5205            *)
5206 <            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
5206 >            func_warning "\`-L' is ignored for archives/objects"
5207              ;;
5208            esac # linkmode
5209            continue
5210            ;; # -L
5211          -R*)
5212            if test "$pass" = link; then
5213 <            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
5213 >            func_stripname '-R' '' "$deplib"
5214 >            dir=$func_stripname_result
5215              # Make sure the xrpath contains only unique directories.
5216              case "$xrpath " in
5217              *" $dir "*) ;;
# Line 2258 | Line 5229 | EOF
5229            fi
5230            case $linkmode in
5231            lib)
5232 <            valid_a_lib=no
5233 <            case $deplibs_check_method in
5234 <              match_pattern*)
5235 <                set dummy $deplibs_check_method
5236 <                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
5237 <                if eval $echo \"$deplib\" 2>/dev/null \
5238 <                    | $SED 10q \
5232 >            # Linking convenience modules into shared libraries is allowed,
5233 >            # but linking other static libraries is non-portable.
5234 >            case " $dlpreconveniencelibs " in
5235 >            *" $deplib "*) ;;
5236 >            *)
5237 >              valid_a_lib=no
5238 >              case $deplibs_check_method in
5239 >                match_pattern*)
5240 >                  set dummy $deplibs_check_method; shift
5241 >                  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5242 >                  if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
5243                      | $EGREP "$match_pattern_regex" > /dev/null; then
5244 <                  valid_a_lib=yes
5245 <                fi
5244 >                    valid_a_lib=yes
5245 >                  fi
5246                  ;;
5247 <              pass_all)
5248 <                valid_a_lib=yes
5247 >                pass_all)
5248 >                  valid_a_lib=yes
5249                  ;;
5250 <            esac
5251 <            if test "$valid_a_lib" != yes; then
5252 <              $echo
5253 <              $echo "*** Warning: Trying to link with static lib archive $deplib."
5254 <              $echo "*** I have the capability to make that library automatically link in when"
5255 <              $echo "*** you link to this library.  But I can only do this if you have a"
5256 <              $echo "*** shared version of the library, which you do not appear to have"
5257 <              $echo "*** because the file extensions .$libext of this argument makes me believe"
5258 <              $echo "*** that it is just a static archive that I should not used here."
5259 <            else
5260 <              $echo
5261 <              $echo "*** Warning: Linking the shared library $output against the"
5262 <              $echo "*** static library $deplib is not portable!"
5263 <              deplibs="$deplib $deplibs"
5264 <            fi
5250 >              esac
5251 >              if test "$valid_a_lib" != yes; then
5252 >                $ECHO
5253 >                $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5254 >                $ECHO "*** I have the capability to make that library automatically link in when"
5255 >                $ECHO "*** you link to this library.  But I can only do this if you have a"
5256 >                $ECHO "*** shared version of the library, which you do not appear to have"
5257 >                $ECHO "*** because the file extensions .$libext of this argument makes me believe"
5258 >                $ECHO "*** that it is just a static archive that I should not use here."
5259 >              else
5260 >                $ECHO
5261 >                $ECHO "*** Warning: Linking the shared library $output against the"
5262 >                $ECHO "*** static library $deplib is not portable!"
5263 >                deplibs="$deplib $deplibs"
5264 >              fi
5265 >              ;;
5266 >            esac
5267              continue
5268              ;;
5269            prog)
# Line 2321 | Line 5298 | EOF
5298            continue
5299            ;;
5300          esac # case $deplib
5301 +
5302          if test "$found" = yes || test -f "$lib"; then :
5303          else
5304 <          $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2327 <          exit $EXIT_FAILURE
5304 >          func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
5305          fi
5306  
5307          # Check to see that this really is a libtool archive.
5308 <        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5309 <        else
2333 <          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2334 <          exit $EXIT_FAILURE
2335 <        fi
5308 >        func_lalib_unsafe_p "$lib" \
5309 >          || func_fatal_error "\`$lib' is not a valid libtool archive"
5310  
5311 <        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
5312 <        test "X$ladir" = "X$lib" && ladir="."
5311 >        func_dirname "$lib" "" "."
5312 >        ladir="$func_dirname_result"
5313  
5314          dlname=
5315          dlopen=
# Line 2343 | Line 5317 | EOF
5317          libdir=
5318          library_names=
5319          old_library=
5320 +        inherited_linker_flags=
5321          # If the library was installed with an old release of libtool,
5322          # it will not redefine variables installed, or shouldnotlink
5323          installed=yes
# Line 2351 | Line 5326 | EOF
5326  
5327  
5328          # Read the .la file
5329 <        case $lib in
2355 <        */* | *\\*) . $lib ;;
2356 <        *) . ./$lib ;;
2357 <        esac
5329 >        func_source "$lib"
5330  
5331 +        # Convert "-framework foo" to "foo.ltframework"
5332 +        if test -n "$inherited_linker_flags"; then
5333 +          tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
5334 +          for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5335 +            case " $new_inherited_linker_flags " in
5336 +              *" $tmp_inherited_linker_flag "*) ;;
5337 +              *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
5338 +            esac
5339 +          done
5340 +        fi
5341 +        dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5342          if test "$linkmode,$pass" = "lib,link" ||
5343             test "$linkmode,$pass" = "prog,scan" ||
5344             { test "$linkmode" != prog && test "$linkmode" != lib; }; then
# Line 2368 | Line 5351 | EOF
5351            deplibs="$lib $deplibs"
5352            if test -z "$libdir"; then
5353              if test -z "$old_library"; then
5354 <              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2372 <              exit $EXIT_FAILURE
5354 >              func_fatal_error "cannot find name of link library for \`$lib'"
5355              fi
5356              # It is a libtool convenience library, so add in its objects.
5357              convenience="$convenience $ladir/$objdir/$old_library"
5358              old_convenience="$old_convenience $ladir/$objdir/$old_library"
2377            tmp_libs=
2378            for deplib in $dependency_libs; do
2379              deplibs="$deplib $deplibs"
2380              if test "X$duplicate_deps" = "Xyes" ; then
2381                case "$tmp_libs " in
2382                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2383                esac
2384              fi
2385              tmp_libs="$tmp_libs $deplib"
2386            done
5359            elif test "$linkmode" != prog && test "$linkmode" != lib; then
5360 <            $echo "$modename: \`$lib' is not a convenience library" 1>&2
2389 <            exit $EXIT_FAILURE
5360 >            func_fatal_error "\`$lib' is not a convenience library"
5361            fi
5362 +          tmp_libs=
5363 +          for deplib in $dependency_libs; do
5364 +            deplibs="$deplib $deplibs"
5365 +            if $opt_duplicate_deps ; then
5366 +              case "$tmp_libs " in
5367 +              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5368 +              esac
5369 +            fi
5370 +            tmp_libs="$tmp_libs $deplib"
5371 +          done
5372            continue
5373          fi # $pass = conv
5374  
# Line 2398 | Line 5379 | EOF
5379            linklib="$l"
5380          done
5381          if test -z "$linklib"; then
5382 <          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2402 <          exit $EXIT_FAILURE
5382 >          func_fatal_error "cannot find name of link library for \`$lib'"
5383          fi
5384  
5385          # This library was specified with -dlopen.
5386          if test "$pass" = dlopen; then
5387            if test -z "$libdir"; then
5388 <            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2409 <            exit $EXIT_FAILURE
5388 >            func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
5389            fi
5390            if test -z "$dlname" ||
5391               test "$dlopen_support" != yes ||
# Line 2428 | Line 5407 | EOF
5407          *)
5408            abs_ladir=`cd "$ladir" && pwd`
5409            if test -z "$abs_ladir"; then
5410 <            $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
5411 <            $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
5410 >            func_warning "cannot determine absolute directory name of \`$ladir'"
5411 >            func_warning "passing it literally to the linker, although it might fail"
5412              abs_ladir="$ladir"
5413            fi
5414            ;;
5415          esac
5416 <        laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5416 >        func_basename "$lib"
5417 >        laname="$func_basename_result"
5418  
5419          # Find the relevant object directory and library name.
5420          if test "X$installed" = Xyes; then
5421            if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5422 <            $echo "$modename: warning: library \`$lib' was moved." 1>&2
5422 >            func_warning "library \`$lib' was moved."
5423              dir="$ladir"
5424              absdir="$abs_ladir"
5425              libdir="$abs_ladir"
# Line 2461 | Line 5441 | EOF
5441              notinst_path="$notinst_path $abs_ladir"
5442            fi
5443          fi # $installed = yes
5444 <        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
5444 >        func_stripname 'lib' '.la' "$laname"
5445 >        name=$func_stripname_result
5446  
5447          # This library was specified with -dlpreopen.
5448          if test "$pass" = dlpreopen; then
5449 <          if test -z "$libdir"; then
5450 <            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2470 <            exit $EXIT_FAILURE
5449 >          if test -z "$libdir" && test "$linkmode" = prog; then
5450 >            func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
5451            fi
5452            # Prefer using a static library (so that no silly _DYNAMIC symbols
5453            # are required to link).
5454            if test -n "$old_library"; then
5455              newdlprefiles="$newdlprefiles $dir/$old_library"
5456 +            # Keep a list of preopened convenience libraries to check
5457 +            # that they are being used correctly in the link pass.
5458 +            test -z "$libdir" && \
5459 +                dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
5460            # Otherwise, use the dlname, so that lt_dlopen finds it.
5461            elif test -n "$dlname"; then
5462              newdlprefiles="$newdlprefiles $dir/$dlname"
# Line 2508 | Line 5492 | EOF
5492            tmp_libs=
5493            for deplib in $dependency_libs; do
5494              case $deplib in
5495 <            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
5495 >            -L*) func_stripname '-L' '' "$deplib"
5496 >                 newlib_search_path="$newlib_search_path $func_stripname_result"
5497 >                 ;;
5498              esac
5499              # Need to link against all dependency_libs?
5500              if test "$linkalldeplibs" = yes; then
# Line 2518 | Line 5504 | EOF
5504                # or/and link against static libraries
5505                newdependency_libs="$deplib $newdependency_libs"
5506              fi
5507 <            if test "X$duplicate_deps" = "Xyes" ; then
5507 >            if $opt_duplicate_deps ; then
5508                case "$tmp_libs " in
5509                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5510                esac
# Line 2531 | Line 5517 | EOF
5517          if test "$linkmode,$pass" = "prog,link"; then
5518            if test -n "$library_names" &&
5519               { { test "$prefer_static_libs" = no ||
5520 <                 test "$prefer_static_libs,$installed" = "built,yes"; } ||
5520 >                 test "$prefer_static_libs,$installed" = "built,yes"; } ||
5521                 test -z "$old_library"; }; then
5522              # We need to hardcode the library path
5523              if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
5524                # Make sure the rpath contains only unique directories.
5525 <              case "$temp_rpath " in
5526 <              *" $dir "*) ;;
5527 <              *" $absdir "*) ;;
2542 <              *) temp_rpath="$temp_rpath $absdir" ;;
5525 >              case "$temp_rpath:" in
5526 >              *"$absdir:"*) ;;
5527 >              *) temp_rpath="$temp_rpath$absdir:" ;;
5528                esac
5529              fi
5530  
# Line 2577 | Line 5562 | EOF
5562  
5563          link_static=no # Whether the deplib will be linked statically
5564          use_static_libs=$prefer_static_libs
5565 <        if test "$use_static_libs" = built && test "$installed" = yes ; then
5565 >        if test "$use_static_libs" = built && test "$installed" = yes; then
5566            use_static_libs=no
5567          fi
5568          if test -n "$library_names" &&
5569             { test "$use_static_libs" = no || test -z "$old_library"; }; then
5570 <          if test "$installed" = no; then
5571 <            notinst_deplibs="$notinst_deplibs $lib"
5572 <            need_relink=yes
5573 <          fi
5570 >          case $host in
5571 >          *cygwin* | *mingw* | *cegcc*)
5572 >              # No point in relinking DLLs because paths are not encoded
5573 >              notinst_deplibs="$notinst_deplibs $lib"
5574 >              need_relink=no
5575 >            ;;
5576 >          *)
5577 >            if test "$installed" = no; then
5578 >              notinst_deplibs="$notinst_deplibs $lib"
5579 >              need_relink=yes
5580 >            fi
5581 >            ;;
5582 >          esac
5583            # This is a shared library
5584  
5585 <          # Warn about portability, can't link against -module's on
5586 <          # some systems (darwin)
5587 <          if test "$shouldnotlink" = yes && test "$pass" = link ; then
5588 <            $echo
5585 >          # Warn about portability, can't link against -module's on some
5586 >          # systems (darwin).  Don't bleat about dlopened modules though!
5587 >          dlopenmodule=""
5588 >          for dlpremoduletest in $dlprefiles; do
5589 >            if test "X$dlpremoduletest" = "X$lib"; then
5590 >              dlopenmodule="$dlpremoduletest"
5591 >              break
5592 >            fi
5593 >          done
5594 >          if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
5595 >            $ECHO
5596              if test "$linkmode" = prog; then
5597 <              $echo "*** Warning: Linking the executable $output against the loadable module"
5597 >              $ECHO "*** Warning: Linking the executable $output against the loadable module"
5598              else
5599 <              $echo "*** Warning: Linking the shared library $output against the loadable module"
5599 >              $ECHO "*** Warning: Linking the shared library $output against the loadable module"
5600              fi
5601 <            $echo "*** $linklib is not portable!"
5601 >            $ECHO "*** $linklib is not portable!"
5602            fi
5603            if test "$linkmode" = lib &&
5604               test "$hardcode_into_libs" = yes; then
# Line 2627 | Line 5628 | EOF
5628            if test -n "$old_archive_from_expsyms_cmds"; then
5629              # figure out the soname
5630              set dummy $library_names
5631 <            realname="$2"
5632 <            shift; shift
5633 <            libname=`eval \\$echo \"$libname_spec\"`
5631 >            shift
5632 >            realname="$1"
5633 >            shift
5634 >            libname=`eval "\\$ECHO \"$libname_spec\""`
5635              # use dlname if we got it. it's perfectly good, no?
5636              if test -n "$dlname"; then
5637                soname="$dlname"
5638              elif test -n "$soname_spec"; then
5639                # bleh windows
5640                case $host in
5641 <              *cygwin* | mingw*)
5642 <                major=`expr $current - $age`
5641 >              *cygwin* | mingw* | *cegcc*)
5642 >                func_arith $current - $age
5643 >                major=$func_arith_result
5644                  versuffix="-$major"
5645                  ;;
5646                esac
# Line 2648 | Line 5651 | EOF
5651  
5652              # Make a new name for the extract_expsyms_cmds to use
5653              soroot="$soname"
5654 <            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
5655 <            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
5654 >            func_basename "$soroot"
5655 >            soname="$func_basename_result"
5656 >            func_stripname 'lib' '.dll' "$soname"
5657 >            newlib=libimp-$func_stripname_result.a
5658  
5659              # If the library has no export list, then create one now
5660              if test -f "$output_objdir/$soname-def"; then :
5661              else
5662 <              $show "extracting exported symbol list from \`$soname'"
5663 <              save_ifs="$IFS"; IFS='~'
2659 <              cmds=$extract_expsyms_cmds
2660 <              for cmd in $cmds; do
2661 <                IFS="$save_ifs"
2662 <                eval cmd=\"$cmd\"
2663 <                $show "$cmd"
2664 <                $run eval "$cmd" || exit $?
2665 <              done
2666 <              IFS="$save_ifs"
5662 >              func_verbose "extracting exported symbol list from \`$soname'"
5663 >              func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
5664              fi
5665  
5666              # Create $newlib
5667              if test -f "$output_objdir/$newlib"; then :; else
5668 <              $show "generating import library for \`$soname'"
5669 <              save_ifs="$IFS"; IFS='~'
2673 <              cmds=$old_archive_from_expsyms_cmds
2674 <              for cmd in $cmds; do
2675 <                IFS="$save_ifs"
2676 <                eval cmd=\"$cmd\"
2677 <                $show "$cmd"
2678 <                $run eval "$cmd" || exit $?
2679 <              done
2680 <              IFS="$save_ifs"
5668 >              func_verbose "generating import library for \`$soname'"
5669 >              func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
5670              fi
5671              # make sure the library variables are pointing to the new library
5672              dir=$output_objdir
# Line 2699 | Line 5688 | EOF
5688                    *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
5689                      *-*-unixware7*) add_dir="-L$dir" ;;
5690                    *-*-darwin* )
5691 <                    # if the lib is a module then we can not link against
5692 <                    # it, someone is ignoring the new warnings I added
5691 >                    # if the lib is a (non-dlopened) module then we can not
5692 >                    # link against it, someone is ignoring the earlier warnings
5693                      if /usr/bin/file -L $add 2> /dev/null |
5694 <                      $EGREP ": [^:]* bundle" >/dev/null ; then
5695 <                      $echo "** Warning, lib $linklib is a module, not a shared library"
5696 <                      if test -z "$old_library" ; then
5697 <                        $echo
5698 <                        $echo "** And there doesn't seem to be a static archive available"
5699 <                        $echo "** The link will probably fail, sorry"
5700 <                      else
5701 <                        add="$dir/$old_library"
5694 >                         $GREP ": [^:]* bundle" >/dev/null ; then
5695 >                      if test "X$dlopenmodule" != "X$lib"; then
5696 >                        $ECHO "*** Warning: lib $linklib is a module, not a shared library"
5697 >                        if test -z "$old_library" ; then
5698 >                          $ECHO
5699 >                          $ECHO "*** And there doesn't seem to be a static archive available"
5700 >                          $ECHO "*** The link will probably fail, sorry"
5701 >                        else
5702 >                          add="$dir/$old_library"
5703 >                        fi
5704 >                      elif test -n "$old_library"; then
5705 >                        add="$dir/$old_library"
5706                        fi
5707                      fi
5708                  esac
# Line 2727 | Line 5720 | EOF
5720                fi
5721                ;;
5722              relink)
5723 <              if test "$hardcode_direct" = yes; then
5723 >              if test "$hardcode_direct" = yes &&
5724 >                 test "$hardcode_direct_absolute" = no; then
5725                  add="$dir/$linklib"
5726                elif test "$hardcode_minus_L" = yes; then
5727                  add_dir="-L$dir"
# Line 2751 | Line 5745 | EOF
5745              esac
5746  
5747              if test "$lib_linked" != yes; then
5748 <              $echo "$modename: configuration error: unsupported hardcode properties"
2755 <              exit $EXIT_FAILURE
5748 >              func_fatal_configuration "unsupported hardcode properties"
5749              fi
5750  
5751              if test -n "$add_shlibpath"; then
# Line 2767 | Line 5760 | EOF
5760              else
5761                test -n "$add_dir" && deplibs="$add_dir $deplibs"
5762                test -n "$add" && deplibs="$add $deplibs"
5763 <              if test "$hardcode_direct" != yes && \
5764 <                 test "$hardcode_minus_L" != yes && \
5763 >              if test "$hardcode_direct" != yes &&
5764 >                 test "$hardcode_minus_L" != yes &&
5765                   test "$hardcode_shlibpath_var" = yes; then
5766                  case :$finalize_shlibpath: in
5767                  *":$libdir:"*) ;;
# Line 2783 | Line 5776 | EOF
5776              add_dir=
5777              add=
5778              # Finalize command for both is simple: just hardcode it.
5779 <            if test "$hardcode_direct" = yes; then
5779 >            if test "$hardcode_direct" = yes &&
5780 >               test "$hardcode_direct_absolute" = no; then
5781                add="$libdir/$linklib"
5782              elif test "$hardcode_minus_L" = yes; then
5783                add_dir="-L$libdir"
# Line 2797 | Line 5791 | EOF
5791              elif test "$hardcode_automatic" = yes; then
5792                if test -n "$inst_prefix_dir" &&
5793                   test -f "$inst_prefix_dir$libdir/$linklib" ; then
5794 <                add="$inst_prefix_dir$libdir/$linklib"
5794 >                add="$inst_prefix_dir$libdir/$linklib"
5795                else
5796 <                add="$libdir/$linklib"
5796 >                add="$libdir/$linklib"
5797                fi
5798              else
5799                # We cannot seem to hardcode it, guess we'll fake it.
# Line 2843 | Line 5837 | EOF
5837  
5838              # Just print a warning and add the library to dependency_libs so
5839              # that the program can be linked against the static library.
5840 <            $echo
5841 <            $echo "*** Warning: This system can not link to static lib archive $lib."
5842 <            $echo "*** I have the capability to make that library automatically link in when"
5843 <            $echo "*** you link to this library.  But I can only do this if you have a"
5844 <            $echo "*** shared version of the library, which you do not appear to have."
5840 >            $ECHO
5841 >            $ECHO "*** Warning: This system can not link to static lib archive $lib."
5842 >            $ECHO "*** I have the capability to make that library automatically link in when"
5843 >            $ECHO "*** you link to this library.  But I can only do this if you have a"
5844 >            $ECHO "*** shared version of the library, which you do not appear to have."
5845              if test "$module" = yes; then
5846 <              $echo "*** But as you try to build a module library, libtool will still create "
5847 <              $echo "*** a static module, that should work as long as the dlopening application"
5848 <              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
5846 >              $ECHO "*** But as you try to build a module library, libtool will still create "
5847 >              $ECHO "*** a static module, that should work as long as the dlopening application"
5848 >              $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
5849                if test -z "$global_symbol_pipe"; then
5850 <                $echo
5851 <                $echo "*** However, this would only work if libtool was able to extract symbol"
5852 <                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
5853 <                $echo "*** not find such a program.  So, this module is probably useless."
5854 <                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
5850 >                $ECHO
5851 >                $ECHO "*** However, this would only work if libtool was able to extract symbol"
5852 >                $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5853 >                $ECHO "*** not find such a program.  So, this module is probably useless."
5854 >                $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
5855                fi
5856                if test "$build_old_libs" = no; then
5857                  build_libtool_libs=module
# Line 2881 | Line 5875 | EOF
5875              temp_deplibs=
5876              for libdir in $dependency_libs; do
5877                case $libdir in
5878 <              -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
5878 >              -R*) func_stripname '-R' '' "$libdir"
5879 >                   temp_xrpath=$func_stripname_result
5880                     case " $xrpath " in
5881                     *" $temp_xrpath "*) ;;
5882                     *) xrpath="$xrpath $temp_xrpath";;
# Line 2899 | Line 5894 | EOF
5894            tmp_libs=
5895            for deplib in $dependency_libs; do
5896              newdependency_libs="$deplib $newdependency_libs"
5897 <            if test "X$duplicate_deps" = "Xyes" ; then
5897 >            if $opt_duplicate_deps ; then
5898                case "$tmp_libs " in
5899                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5900                esac
# Line 2913 | Line 5908 | EOF
5908                case $deplib in
5909                -L*) path="$deplib" ;;
5910                *.la)
5911 <                dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
5912 <                test "X$dir" = "X$deplib" && dir="."
5911 >                func_dirname "$deplib" "" "."
5912 >                dir="$func_dirname_result"
5913                  # We need an absolute path.
5914                  case $dir in
5915                  [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
5916                  *)
5917                    absdir=`cd "$dir" && pwd`
5918                    if test -z "$absdir"; then
5919 <                    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
5919 >                    func_warning "cannot determine absolute directory name of \`$dir'"
5920                      absdir="$dir"
5921                    fi
5922                    ;;
5923                  esac
5924 <                if grep "^installed=no" $deplib > /dev/null; then
2930 <                  path="$absdir/$objdir"
2931 <                else
2932 <                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2933 <                  if test -z "$libdir"; then
2934 <                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2935 <                    exit $EXIT_FAILURE
2936 <                  fi
2937 <                  if test "$absdir" != "$libdir"; then
2938 <                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2939 <                  fi
2940 <                  path="$absdir"
2941 <                fi
2942 <                depdepl=
5924 >                if $GREP "^installed=no" $deplib > /dev/null; then
5925                  case $host in
5926                  *-*-darwin*)
5927 <                  # we do not want to link against static libs,
2946 <                  # but need to link against shared
5927 >                  depdepl=
5928                    eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
5929                    if test -n "$deplibrary_names" ; then
5930                      for tmp in $deplibrary_names ; do
5931                        depdepl=$tmp
5932                      done
5933 <                    if test -f "$path/$depdepl" ; then
5934 <                      depdepl="$path/$depdepl"
5933 >                    if test -f "$absdir/$objdir/$depdepl" ; then
5934 >                      depdepl="$absdir/$objdir/$depdepl"
5935 >                      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5936 >                      if test -z "$darwin_install_name"; then
5937 >                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
5938 >                      fi
5939 >                      compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
5940 >                      linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
5941 >                      path=
5942                      fi
2955                    # do not add paths which are already there
2956                    case " $newlib_search_path " in
2957                    *" $path "*) ;;
2958                    *) newlib_search_path="$newlib_search_path $path";;
2959                    esac
5943                    fi
2961                  path=""
5944                    ;;
5945                  *)
5946 <                  path="-L$path"
5946 >                  path="-L$absdir/$objdir"
5947                    ;;
5948                  esac
5949 +                else
5950 +                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5951 +                  test -z "$libdir" && \
5952 +                    func_fatal_error "\`$deplib' is not a valid libtool archive"
5953 +                  test "$absdir" != "$libdir" && \
5954 +                    func_warning "\`$deplib' seems to be moved"
5955 +
5956 +                  path="-L$absdir"
5957 +                fi
5958                  ;;
2968              -l*)
2969                case $host in
2970                *-*-darwin*)
2971                  # Again, we only want to link against shared libraries
2972                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2973                  for tmp in $newlib_search_path ; do
2974                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
2975                      eval depdepl="$tmp/lib$tmp_libs.dylib"
2976                      break
2977                    fi
2978                  done
2979                  path=""
2980                  ;;
2981                *) continue ;;
2982                esac
2983                ;;
2984              *) continue ;;
5959                esac
5960                case " $deplibs " in
5961                *" $path "*) ;;
5962                *) deplibs="$path $deplibs" ;;
5963                esac
2990              case " $deplibs " in
2991              *" $depdepl "*) ;;
2992              *) deplibs="$depdepl $deplibs" ;;
2993              esac
5964              done
5965            fi # link_all_deplibs != no
5966          fi # linkmode = lib
5967        done # for deplib in $libs
5968 +      if test "$pass" = link; then
5969 +        if test "$linkmode" = "prog"; then
5970 +          compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
5971 +          finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
5972 +        else
5973 +          compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5974 +        fi
5975 +      fi
5976        dependency_libs="$newdependency_libs"
5977        if test "$pass" = dlpreopen; then
5978          # Link the dlpreopened libraries before other libraries
# Line 3093 | Line 6071 | EOF
6071      done # for pass
6072      if test "$linkmode" = prog; then
6073        dlfiles="$newdlfiles"
6074 +    fi
6075 +    if test "$linkmode" = prog || test "$linkmode" = lib; then
6076        dlprefiles="$newdlprefiles"
6077      fi
6078  
6079      case $linkmode in
6080      oldlib)
3101      if test -n "$deplibs"; then
3102        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3103      fi
3104
6081        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
6082 <        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
6082 >        func_warning "\`-dlopen' is ignored for archives"
6083        fi
6084  
6085 <      if test -n "$rpath"; then
6086 <        $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
6087 <      fi
6085 >      case " $deplibs" in
6086 >      *\ -l* | *\ -L*)
6087 >        func_warning "\`-l' and \`-L' are ignored for archives" ;;
6088 >      esac
6089  
6090 <      if test -n "$xrpath"; then
6091 <        $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3115 <      fi
6090 >      test -n "$rpath" && \
6091 >        func_warning "\`-rpath' is ignored for archives"
6092  
6093 <      if test -n "$vinfo"; then
6094 <        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3119 <      fi
6093 >      test -n "$xrpath" && \
6094 >        func_warning "\`-R' is ignored for archives"
6095  
6096 <      if test -n "$release"; then
6097 <        $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3123 <      fi
6096 >      test -n "$vinfo" && \
6097 >        func_warning "\`-version-info/-version-number' is ignored for archives"
6098  
6099 <      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
6100 <        $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
6101 <      fi
6099 >      test -n "$release" && \
6100 >        func_warning "\`-release' is ignored for archives"
6101 >
6102 >      test -n "$export_symbols$export_symbols_regex" && \
6103 >        func_warning "\`-export-symbols' is ignored for archives"
6104  
6105        # Now set the variables for building old libraries.
6106        build_libtool_libs=no
# Line 3136 | Line 6112 | EOF
6112        # Make sure we only generate libraries of the form `libNAME.la'.
6113        case $outputname in
6114        lib*)
6115 <        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
6115 >        func_stripname 'lib' '.la' "$outputname"
6116 >        name=$func_stripname_result
6117          eval shared_ext=\"$shrext_cmds\"
6118          eval libname=\"$libname_spec\"
6119          ;;
6120        *)
6121 <        if test "$module" = no; then
6122 <          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
6123 <          $echo "$help" 1>&2
3147 <          exit $EXIT_FAILURE
3148 <        fi
6121 >        test "$module" = no && \
6122 >          func_fatal_help "libtool library \`$output' must begin with \`lib'"
6123 >
6124          if test "$need_lib_prefix" != no; then
6125            # Add the "lib" prefix for modules if required
6126 <          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
6126 >          func_stripname '' '.la' "$outputname"
6127 >          name=$func_stripname_result
6128            eval shared_ext=\"$shrext_cmds\"
6129            eval libname=\"$libname_spec\"
6130          else
6131 <          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
6131 >          func_stripname '' '.la' "$outputname"
6132 >          libname=$func_stripname_result
6133          fi
6134          ;;
6135        esac
6136  
6137        if test -n "$objs"; then
6138          if test "$deplibs_check_method" != pass_all; then
6139 <          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3163 <          exit $EXIT_FAILURE
6139 >          func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
6140          else
6141 <          $echo
6142 <          $echo "*** Warning: Linking the shared library $output against the non-libtool"
6143 <          $echo "*** objects $objs is not portable!"
6141 >          $ECHO
6142 >          $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6143 >          $ECHO "*** objects $objs is not portable!"
6144            libobjs="$libobjs $objs"
6145          fi
6146        fi
6147  
6148 <      if test "$dlself" != no; then
6149 <        $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3174 <      fi
6148 >      test "$dlself" != no && \
6149 >        func_warning "\`-dlopen self' is ignored for libtool libraries"
6150  
6151        set dummy $rpath
6152 <      if test "$#" -gt 2; then
6153 <        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
6154 <      fi
6155 <      install_libdir="$2"
6152 >      shift
6153 >      test "$#" -gt 1 && \
6154 >        func_warning "ignoring multiple \`-rpath's for a libtool library"
6155 >
6156 >      install_libdir="$1"
6157  
6158        oldlibs=
6159        if test -z "$rpath"; then
# Line 3191 | Line 6167 | EOF
6167            build_old_libs=yes
6168          fi
6169  
6170 <        if test -n "$vinfo"; then
6171 <          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3196 <        fi
6170 >        test -n "$vinfo" && \
6171 >          func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
6172  
6173 <        if test -n "$release"; then
6174 <          $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3200 <        fi
6173 >        test -n "$release" && \
6174 >          func_warning "\`-release' is ignored for convenience libraries"
6175        else
6176  
6177          # Parse the version information argument.
6178          save_ifs="$IFS"; IFS=':'
6179          set dummy $vinfo 0 0 0
6180 +        shift
6181          IFS="$save_ifs"
6182  
6183 <        if test -n "$8"; then
6184 <          $echo "$modename: too many parameters to \`-version-info'" 1>&2
3210 <          $echo "$help" 1>&2
3211 <          exit $EXIT_FAILURE
3212 <        fi
6183 >        test -n "$7" && \
6184 >          func_fatal_help "too many parameters to \`-version-info'"
6185  
6186          # convert absolute version numbers to libtool ages
6187          # this retains compatibility with .la files and attempts
# Line 3217 | Line 6189 | EOF
6189  
6190          case $vinfo_number in
6191          yes)
6192 <          number_major="$2"
6193 <          number_minor="$3"
6194 <          number_revision="$4"
6192 >          number_major="$1"
6193 >          number_minor="$2"
6194 >          number_revision="$3"
6195            #
6196            # There are really only two kinds -- those that
6197            # use the current revision as the major version
# Line 3229 | Line 6201 | EOF
6201            #
6202            case $version_type in
6203            darwin|linux|osf|windows|none)
6204 <            current=`expr $number_major + $number_minor`
6204 >            func_arith $number_major + $number_minor
6205 >            current=$func_arith_result
6206              age="$number_minor"
6207              revision="$number_revision"
6208              ;;
# Line 3239 | Line 6212 | EOF
6212              age="0"
6213              ;;
6214            irix|nonstopux)
6215 <            current=`expr $number_major + $number_minor`
6215 >            func_arith $number_major + $number_minor
6216 >            current=$func_arith_result
6217              age="$number_minor"
6218              revision="$number_minor"
6219              lt_irix_increment=no
# Line 3247 | Line 6221 | EOF
6221            esac
6222            ;;
6223          no)
6224 <          current="$2"
6225 <          revision="$3"
6226 <          age="$4"
6224 >          current="$1"
6225 >          revision="$2"
6226 >          age="$3"
6227            ;;
6228          esac
6229  
# Line 3257 | Line 6231 | EOF
6231          case $current in
6232          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]) ;;
6233          *)
6234 <          $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
6235 <          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3262 <          exit $EXIT_FAILURE
6234 >          func_error "CURRENT \`$current' must be a nonnegative integer"
6235 >          func_fatal_error "\`$vinfo' is not valid version information"
6236            ;;
6237          esac
6238  
6239          case $revision in
6240          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]) ;;
6241          *)
6242 <          $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
6243 <          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3271 <          exit $EXIT_FAILURE
6242 >          func_error "REVISION \`$revision' must be a nonnegative integer"
6243 >          func_fatal_error "\`$vinfo' is not valid version information"
6244            ;;
6245          esac
6246  
6247          case $age in
6248          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]) ;;
6249          *)
6250 <          $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
6251 <          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3280 <          exit $EXIT_FAILURE
6250 >          func_error "AGE \`$age' must be a nonnegative integer"
6251 >          func_fatal_error "\`$vinfo' is not valid version information"
6252            ;;
6253          esac
6254  
6255          if test "$age" -gt "$current"; then
6256 <          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
6257 <          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3287 <          exit $EXIT_FAILURE
6256 >          func_error "AGE \`$age' is greater than the current interface number \`$current'"
6257 >          func_fatal_error "\`$vinfo' is not valid version information"
6258          fi
6259  
6260          # Calculate the version variables.
# Line 3297 | Line 6267 | EOF
6267          darwin)
6268            # Like Linux, but with the current version available in
6269            # verstring for coding it into the library header
6270 <          major=.`expr $current - $age`
6270 >          func_arith $current - $age
6271 >          major=.$func_arith_result
6272            versuffix="$major.$age.$revision"
6273            # Darwin ld doesn't like 0 for these options...
6274 <          minor_current=`expr $current + 1`
6274 >          func_arith $current + 1
6275 >          minor_current=$func_arith_result
6276            xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6277            verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
6278            ;;
# Line 3312 | Line 6284 | EOF
6284  
6285          freebsd-elf)
6286            major=".$current"
6287 <          versuffix=".$current";
6287 >          versuffix=".$current"
6288            ;;
6289  
6290          irix | nonstopux)
6291            if test "X$lt_irix_increment" = "Xno"; then
6292 <            major=`expr $current - $age`
6292 >            func_arith $current - $age
6293            else
6294 <            major=`expr $current - $age + 1`
6294 >            func_arith $current - $age + 1
6295            fi
6296 +          major=$func_arith_result
6297 +
6298            case $version_type in
6299              nonstopux) verstring_prefix=nonstopux ;;
6300              *)         verstring_prefix=sgi ;;
# Line 3330 | Line 6304 | EOF
6304            # Add in all the interfaces that we are compatible with.
6305            loop=$revision
6306            while test "$loop" -ne 0; do
6307 <            iface=`expr $revision - $loop`
6308 <            loop=`expr $loop - 1`
6307 >            func_arith $revision - $loop
6308 >            iface=$func_arith_result
6309 >            func_arith $loop - 1
6310 >            loop=$func_arith_result
6311              verstring="$verstring_prefix$major.$iface:$verstring"
6312            done
6313  
# Line 3341 | Line 6317 | EOF
6317            ;;
6318  
6319          linux)
6320 <          major=.`expr $current - $age`
6320 >          func_arith $current - $age
6321 >          major=.$func_arith_result
6322            versuffix="$major.$age.$revision"
6323            ;;
6324  
6325          osf)
6326 <          major=.`expr $current - $age`
6326 >          func_arith $current - $age
6327 >          major=.$func_arith_result
6328            versuffix=".$current.$age.$revision"
6329            verstring="$current.$age.$revision"
6330  
6331            # Add in all the interfaces that we are compatible with.
6332            loop=$age
6333            while test "$loop" -ne 0; do
6334 <            iface=`expr $current - $loop`
6335 <            loop=`expr $loop - 1`
6334 >            func_arith $current - $loop
6335 >            iface=$func_arith_result
6336 >            func_arith $loop - 1
6337 >            loop=$func_arith_result
6338              verstring="$verstring:${iface}.0"
6339            done
6340  
# Line 3362 | Line 6342 | EOF
6342            verstring="$verstring:${current}.0"
6343            ;;
6344  
6345 +        qnx)
6346 +          major=".$current"
6347 +          versuffix=".$current"
6348 +          ;;
6349 +
6350          sunos)
6351            major=".$current"
6352            versuffix=".$current.$revision"
# Line 3370 | Line 6355 | EOF
6355          windows)
6356            # Use '-' rather than '.', since we only want one
6357            # extension on DOS 8.3 filesystems.
6358 <          major=`expr $current - $age`
6358 >          func_arith $current - $age
6359 >          major=$func_arith_result
6360            versuffix="-$major"
6361            ;;
6362  
6363          *)
6364 <          $echo "$modename: unknown library version type \`$version_type'" 1>&2
3379 <          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3380 <          exit $EXIT_FAILURE
6364 >          func_fatal_configuration "unknown library version type \`$version_type'"
6365            ;;
6366          esac
6367  
# Line 3411 | Line 6395 | EOF
6395          # Check to see if the archive will have undefined symbols.
6396          if test "$allow_undefined" = yes; then
6397            if test "$allow_undefined_flag" = unsupported; then
6398 <            $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
6398 >            func_warning "undefined symbols not allowed in $host shared libraries"
6399              build_libtool_libs=no
6400              build_old_libs=yes
6401            fi
# Line 3419 | Line 6403 | EOF
6403            # Don't allow undefined symbols.
6404            allow_undefined_flag="$no_undefined_flag"
6405          fi
6406 +
6407        fi
6408  
6409 +      func_generate_dlsyms "$libname" "$libname" "yes"
6410 +      libobjs="$libobjs $symfileobj"
6411 +      test "X$libobjs" = "X " && libobjs=
6412 +
6413        if test "$mode" != relink; then
6414          # Remove our outputs, but don't remove object files since they
6415          # may have been created when compiling PIC objects.
6416          removelist=
6417 <        tempremovelist=`$echo "$output_objdir/*"`
6417 >        tempremovelist=`$ECHO "$output_objdir/*"`
6418          for p in $tempremovelist; do
6419            case $p in
6420 <            *.$objext)
6420 >            *.$objext | *.gcno)
6421                 ;;
6422              $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
6423                 if test "X$precious_files_regex" != "X"; then
6424 <                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
6425 <                 then
6424 >                 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
6425 >                 then
6426                     continue
6427                   fi
6428                 fi
# Line 3442 | Line 6431 | EOF
6431              *) ;;
6432            esac
6433          done
6434 <        if test -n "$removelist"; then
6435 <          $show "${rm}r $removelist"
3447 <          $run ${rm}r $removelist
3448 <        fi
6434 >        test -n "$removelist" && \
6435 >          func_show_eval "${RM}r \$removelist"
6436        fi
6437  
6438        # Now set the variables for building old libraries.
# Line 3453 | Line 6440 | EOF
6440          oldlibs="$oldlibs $output_objdir/$libname.$libext"
6441  
6442          # Transform .lo files to .o files.
6443 <        oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
6443 >        oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
6444        fi
6445  
6446        # Eliminate all temporary directories.
6447        #for path in $notinst_path; do
6448 <      # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
6449 <      # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
6450 <      # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
6448 >      # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
6449 >      # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
6450 >      # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
6451        #done
6452  
6453        if test -n "$xrpath"; then
# Line 3501 | Line 6488 | EOF
6488        if test "$build_libtool_libs" = yes; then
6489          if test -n "$rpath"; then
6490            case $host in
6491 <          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
6491 >          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
6492              # these systems don't actually have a c library (as such)!
6493              ;;
6494            *-*-rhapsody* | *-*-darwin1.[012])
6495              # Rhapsody C library is in the System framework
6496 <            deplibs="$deplibs -framework System"
6496 >            deplibs="$deplibs System.ltframework"
6497              ;;
6498            *-*-netbsd*)
6499              # Don't link with libc until the a.out ld.so is fixed.
# Line 3520 | Line 6507 | EOF
6507            *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6508              # Compiler inserts libc in the correct place for threads to work
6509              ;;
6510 <          *)
6510 >          *)
6511              # Add libc to deplibs on all other systems if necessary.
6512              if test "$build_libtool_need_lc" = "yes"; then
6513                deplibs="$deplibs -lc"
# Line 3557 | Line 6544 | EOF
6544            # limits. Maybe even breaks it.  We compile a program, linking it
6545            # against the deplibs as a proxy for the library.  Then we can check
6546            # whether they linked in statically or dynamically with ldd.
6547 <          $rm conftest.c
6547 >          $opt_dry_run || $RM conftest.c
6548            cat > conftest.c <<EOF
6549            int main() { return 0; }
6550   EOF
6551 <          $rm conftest
6551 >          $opt_dry_run || $RM conftest
6552            if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
6553              ldd_output=`ldd conftest`
6554              for i in $deplibs; do
6555 <              name=`expr $i : '-l\(.*\)'`
6556 <              # If $name is empty we are operating on a -L argument.
6557 <              if test "$name" != "" && test "$name" != "0"; then
6555 >              case $i in
6556 >              -l*)
6557 >                func_stripname -l '' "$i"
6558 >                name=$func_stripname_result
6559                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6560                    case " $predeps $postdeps " in
6561                    *" $i "*)
# Line 3575 | Line 6563 | EOF
6563                      i=""
6564                      ;;
6565                    esac
6566 <                fi
6566 >                fi
6567                  if test -n "$i" ; then
6568 <                  libname=`eval \\$echo \"$libname_spec\"`
6569 <                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
6570 <                  set dummy $deplib_matches
6571 <                  deplib_match=$2
6568 >                  libname=`eval "\\$ECHO \"$libname_spec\""`
6569 >                  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6570 >                  set dummy $deplib_matches; shift
6571 >                  deplib_match=$1
6572                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6573                      newdeplibs="$newdeplibs $i"
6574                    else
6575                      droppeddeps=yes
6576 <                    $echo
6577 <                    $echo "*** Warning: dynamic linker does not accept needed library $i."
6578 <                    $echo "*** I have the capability to make that library automatically link in when"
6579 <                    $echo "*** you link to this library.  But I can only do this if you have a"
6580 <                    $echo "*** shared version of the library, which I believe you do not have"
6581 <                    $echo "*** because a test_compile did reveal that the linker did not use it for"
6582 <                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
6576 >                    $ECHO
6577 >                    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6578 >                    $ECHO "*** I have the capability to make that library automatically link in when"
6579 >                    $ECHO "*** you link to this library.  But I can only do this if you have a"
6580 >                    $ECHO "*** shared version of the library, which I believe you do not have"
6581 >                    $ECHO "*** because a test_compile did reveal that the linker did not use it for"
6582 >                    $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
6583                    fi
6584                  fi
6585 <              else
6585 >                ;;
6586 >              *)
6587                  newdeplibs="$newdeplibs $i"
6588 <              fi
6588 >                ;;
6589 >              esac
6590              done
6591            else
6592              # Error occurred in the first compile.  Let's try to salvage
6593              # the situation: Compile a separate program for each library.
6594              for i in $deplibs; do
6595 <              name=`expr $i : '-l\(.*\)'`
6596 <              # If $name is empty we are operating on a -L argument.
6597 <              if test "$name" != "" && test "$name" != "0"; then
6598 <                $rm conftest
6595 >              case $i in
6596 >              -l*)
6597 >                func_stripname -l '' "$i"
6598 >                name=$func_stripname_result
6599 >                $opt_dry_run || $RM conftest
6600                  if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
6601                    ldd_output=`ldd conftest`
6602                    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
# Line 3617 | Line 6608 | EOF
6608                      esac
6609                    fi
6610                    if test -n "$i" ; then
6611 <                    libname=`eval \\$echo \"$libname_spec\"`
6612 <                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
6613 <                    set dummy $deplib_matches
6614 <                    deplib_match=$2
6611 >                    libname=`eval "\\$ECHO \"$libname_spec\""`
6612 >                    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6613 >                    set dummy $deplib_matches; shift
6614 >                    deplib_match=$1
6615                      if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6616                        newdeplibs="$newdeplibs $i"
6617                      else
6618                        droppeddeps=yes
6619 <                      $echo
6620 <                      $echo "*** Warning: dynamic linker does not accept needed library $i."
6621 <                      $echo "*** I have the capability to make that library automatically link in when"
6622 <                      $echo "*** you link to this library.  But I can only do this if you have a"
6623 <                      $echo "*** shared version of the library, which you do not appear to have"
6624 <                      $echo "*** because a test_compile did reveal that the linker did not use this one"
6625 <                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
6619 >                      $ECHO
6620 >                      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6621 >                      $ECHO "*** I have the capability to make that library automatically link in when"
6622 >                      $ECHO "*** you link to this library.  But I can only do this if you have a"
6623 >                      $ECHO "*** shared version of the library, which you do not appear to have"
6624 >                      $ECHO "*** because a test_compile did reveal that the linker did not use this one"
6625 >                      $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
6626                      fi
6627                    fi
6628                  else
6629                    droppeddeps=yes
6630 <                  $echo
6631 <                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
6632 <                  $echo "*** make it link in!  You will probably need to install it or some"
6633 <                  $echo "*** library that it depends on before this library will be fully"
6634 <                  $echo "*** functional.  Installing it before continuing would be even better."
6630 >                  $ECHO
6631 >                  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
6632 >                  $ECHO "*** make it link in!  You will probably need to install it or some"
6633 >                  $ECHO "*** library that it depends on before this library will be fully"
6634 >                  $ECHO "*** functional.  Installing it before continuing would be even better."
6635                  fi
6636 <              else
6636 >                ;;
6637 >              *)
6638                  newdeplibs="$newdeplibs $i"
6639 <              fi
6639 >                ;;
6640 >              esac
6641              done
6642            fi
6643            ;;
6644          file_magic*)
6645 <          set dummy $deplibs_check_method
6646 <          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
6645 >          set dummy $deplibs_check_method; shift
6646 >          file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6647            for a_deplib in $deplibs; do
6648 <            name=`expr $a_deplib : '-l\(.*\)'`
6649 <            # If $name is empty we are operating on a -L argument.
6650 <            if test "$name" != "" && test  "$name" != "0"; then
6648 >            case $a_deplib in
6649 >            -l*)
6650 >              func_stripname -l '' "$a_deplib"
6651 >              name=$func_stripname_result
6652                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6653                  case " $predeps $postdeps " in
6654                  *" $a_deplib "*)
# Line 3664 | Line 6658 | EOF
6658                  esac
6659                fi
6660                if test -n "$a_deplib" ; then
6661 <                libname=`eval \\$echo \"$libname_spec\"`
6661 >                libname=`eval "\\$ECHO \"$libname_spec\""`
6662                  for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6663                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6664                    for potent_lib in $potential_libs; do
6665                        # Follow soft links.
6666 <                      if ls -lLd "$potent_lib" 2>/dev/null \
6667 <                         | grep " -> " >/dev/null; then
6666 >                      if ls -lLd "$potent_lib" 2>/dev/null |
6667 >                         $GREP " -> " >/dev/null; then
6668                          continue
6669                        fi
6670                        # The statement above tries to avoid entering an
# Line 3683 | Line 6677 | EOF
6677                          potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
6678                          case $potliblink in
6679                          [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
6680 <                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
6680 >                        *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
6681                          esac
6682                        done
6683 <                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
6684 <                         | ${SED} 10q \
6685 <                         | $EGREP "$file_magic_regex" > /dev/null; then
6683 >                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
6684 >                         $SED -e 10q |
6685 >                         $EGREP "$file_magic_regex" > /dev/null; then
6686                          newdeplibs="$newdeplibs $a_deplib"
6687                          a_deplib=""
6688                          break 2
# Line 3698 | Line 6692 | EOF
6692                fi
6693                if test -n "$a_deplib" ; then
6694                  droppeddeps=yes
6695 <                $echo
6696 <                $echo "*** Warning: linker path does not have real file for library $a_deplib."
6697 <                $echo "*** I have the capability to make that library automatically link in when"
6698 <                $echo "*** you link to this library.  But I can only do this if you have a"
6699 <                $echo "*** shared version of the library, which you do not appear to have"
6700 <                $echo "*** because I did check the linker path looking for a file starting"
6695 >                $ECHO
6696 >                $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6697 >                $ECHO "*** I have the capability to make that library automatically link in when"
6698 >                $ECHO "*** you link to this library.  But I can only do this if you have a"
6699 >                $ECHO "*** shared version of the library, which you do not appear to have"
6700 >                $ECHO "*** because I did check the linker path looking for a file starting"
6701                  if test -z "$potlib" ; then
6702 <                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
6702 >                  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
6703                  else
6704 <                  $echo "*** with $libname and none of the candidates passed a file format test"
6705 <                  $echo "*** using a file magic. Last file checked: $potlib"
6704 >                  $ECHO "*** with $libname and none of the candidates passed a file format test"
6705 >                  $ECHO "*** using a file magic. Last file checked: $potlib"
6706                  fi
6707                fi
6708 <            else
6708 >              ;;
6709 >            *)
6710                # Add a -L argument.
6711                newdeplibs="$newdeplibs $a_deplib"
6712 <            fi
6712 >              ;;
6713 >            esac
6714            done # Gone through all deplibs.
6715            ;;
6716          match_pattern*)
6717 <          set dummy $deplibs_check_method
6718 <          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
6717 >          set dummy $deplibs_check_method; shift
6718 >          match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6719            for a_deplib in $deplibs; do
6720 <            name=`expr $a_deplib : '-l\(.*\)'`
6721 <            # If $name is empty we are operating on a -L argument.
6722 <            if test -n "$name" && test "$name" != "0"; then
6720 >            case $a_deplib in
6721 >            -l*)
6722 >              func_stripname -l '' "$a_deplib"
6723 >              name=$func_stripname_result
6724                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6725                  case " $predeps $postdeps " in
6726                  *" $a_deplib "*)
# Line 3733 | Line 6730 | EOF
6730                  esac
6731                fi
6732                if test -n "$a_deplib" ; then
6733 <                libname=`eval \\$echo \"$libname_spec\"`
6733 >                libname=`eval "\\$ECHO \"$libname_spec\""`
6734                  for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6735                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6736                    for potent_lib in $potential_libs; do
6737                      potlib="$potent_lib" # see symlink-check above in file_magic test
6738 <                    if eval $echo \"$potent_lib\" 2>/dev/null \
6739 <                        | ${SED} 10q \
3743 <                        | $EGREP "$match_pattern_regex" > /dev/null; then
6738 >                    if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
6739 >                       $EGREP "$match_pattern_regex" > /dev/null; then
6740                        newdeplibs="$newdeplibs $a_deplib"
6741                        a_deplib=""
6742                        break 2
# Line 3750 | Line 6746 | EOF
6746                fi
6747                if test -n "$a_deplib" ; then
6748                  droppeddeps=yes
6749 <                $echo
6750 <                $echo "*** Warning: linker path does not have real file for library $a_deplib."
6751 <                $echo "*** I have the capability to make that library automatically link in when"
6752 <                $echo "*** you link to this library.  But I can only do this if you have a"
6753 <                $echo "*** shared version of the library, which you do not appear to have"
6754 <                $echo "*** because I did check the linker path looking for a file starting"
6749 >                $ECHO
6750 >                $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6751 >                $ECHO "*** I have the capability to make that library automatically link in when"
6752 >                $ECHO "*** you link to this library.  But I can only do this if you have a"
6753 >                $ECHO "*** shared version of the library, which you do not appear to have"
6754 >                $ECHO "*** because I did check the linker path looking for a file starting"
6755                  if test -z "$potlib" ; then
6756 <                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
6756 >                  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
6757                  else
6758 <                  $echo "*** with $libname and none of the candidates passed a file format test"
6759 <                  $echo "*** using a regex pattern. Last file checked: $potlib"
6758 >                  $ECHO "*** with $libname and none of the candidates passed a file format test"
6759 >                  $ECHO "*** using a regex pattern. Last file checked: $potlib"
6760                  fi
6761                fi
6762 <            else
6762 >              ;;
6763 >            *)
6764                # Add a -L argument.
6765                newdeplibs="$newdeplibs $a_deplib"
6766 <            fi
6766 >              ;;
6767 >            esac
6768            done # Gone through all deplibs.
6769            ;;
6770          none | unknown | *)
6771            newdeplibs=""
6772 <          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
6773 <            -e 's/ -[LR][^ ]*//g'`
6772 >          tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
6773 >              -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
6774            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6775              for i in $predeps $postdeps ; do
6776                # can't use Xsed below, because $i might contain '/'
6777 <              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
6777 >              tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
6778              done
6779            fi
6780 <          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
6781 <            | grep . >/dev/null; then
6782 <            $echo
6780 >          if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[      ]//g' |
6781 >             $GREP . >/dev/null; then
6782 >            $ECHO
6783              if test "X$deplibs_check_method" = "Xnone"; then
6784 <              $echo "*** Warning: inter-library dependencies are not supported in this platform."
6784 >              $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
6785              else
6786 <              $echo "*** Warning: inter-library dependencies are not known to be supported."
6786 >              $ECHO "*** Warning: inter-library dependencies are not known to be supported."
6787              fi
6788 <            $echo "*** All declared inter-library dependencies are being dropped."
6788 >            $ECHO "*** All declared inter-library dependencies are being dropped."
6789              droppeddeps=yes
6790            fi
6791            ;;
# Line 3800 | Line 6798 | EOF
6798  
6799          case $host in
6800          *-*-rhapsody* | *-*-darwin1.[012])
6801 <          # On Rhapsody replace the C library is the System framework
6802 <          newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
6801 >          # On Rhapsody replace the C library with the System framework
6802 >          newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6803            ;;
6804          esac
6805  
6806          if test "$droppeddeps" = yes; then
6807            if test "$module" = yes; then
6808 <            $echo
6809 <            $echo "*** Warning: libtool could not satisfy all declared inter-library"
6810 <            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
6811 <            $echo "*** a static module, that should work as long as the dlopening"
6812 <            $echo "*** application is linked with the -dlopen flag."
6808 >            $ECHO
6809 >            $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
6810 >            $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
6811 >            $ECHO "*** a static module, that should work as long as the dlopening"
6812 >            $ECHO "*** application is linked with the -dlopen flag."
6813              if test -z "$global_symbol_pipe"; then
6814 <              $echo
6815 <              $echo "*** However, this would only work if libtool was able to extract symbol"
6816 <              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6817 <              $echo "*** not find such a program.  So, this module is probably useless."
6818 <              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
6814 >              $ECHO
6815 >              $ECHO "*** However, this would only work if libtool was able to extract symbol"
6816 >              $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6817 >              $ECHO "*** not find such a program.  So, this module is probably useless."
6818 >              $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
6819              fi
6820              if test "$build_old_libs" = no; then
6821                oldlibs="$output_objdir/$libname.$libext"
# Line 3827 | Line 6825 | EOF
6825                build_libtool_libs=no
6826              fi
6827            else
6828 <            $echo "*** The inter-library dependencies that have been dropped here will be"
6829 <            $echo "*** automatically added whenever a program is linked with this library"
6830 <            $echo "*** or is declared to -dlopen it."
6828 >            $ECHO "*** The inter-library dependencies that have been dropped here will be"
6829 >            $ECHO "*** automatically added whenever a program is linked with this library"
6830 >            $ECHO "*** or is declared to -dlopen it."
6831  
6832              if test "$allow_undefined" = no; then
6833 <              $echo
6834 <              $echo "*** Since this library must not contain undefined symbols,"
6835 <              $echo "*** because either the platform does not support them or"
6836 <              $echo "*** it was explicitly requested with -no-undefined,"
6837 <              $echo "*** libtool will only create a static version of it."
6833 >              $ECHO
6834 >              $ECHO "*** Since this library must not contain undefined symbols,"
6835 >              $ECHO "*** because either the platform does not support them or"
6836 >              $ECHO "*** it was explicitly requested with -no-undefined,"
6837 >              $ECHO "*** libtool will only create a static version of it."
6838                if test "$build_old_libs" = no; then
6839                  oldlibs="$output_objdir/$libname.$libext"
6840                  build_libtool_libs=module
# Line 3850 | Line 6848 | EOF
6848          # Done checking deplibs!
6849          deplibs=$newdeplibs
6850        fi
6851 <
6851 >      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
6852 >      case $host in
6853 >        *-*-darwin*)
6854 >          newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6855 >          new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6856 >          deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6857 >          ;;
6858 >      esac
6859  
6860        # move library search paths that coincide with paths to not yet
6861        # installed libraries to the beginning of the library search list
# Line 3879 | Line 6884 | EOF
6884        done
6885        deplibs="$new_libs"
6886  
3882
6887        # All the library-specific variables (install_libdir is set above).
6888        library_names=
6889        old_library=
# Line 3924 | Line 6928 | EOF
6928               test -n "$hardcode_libdirs"; then
6929              libdir="$hardcode_libdirs"
6930              if test -n "$hardcode_libdir_flag_spec_ld"; then
6931 <              case $archive_cmds in
3928 <              *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3929 <              *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3930 <              esac
6931 >              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
6932              else
6933                eval dep_rpath=\"$hardcode_libdir_flag_spec\"
6934              fi
# Line 3953 | Line 6954 | EOF
6954          eval shared_ext=\"$shrext_cmds\"
6955          eval library_names=\"$library_names_spec\"
6956          set dummy $library_names
6957 <        realname="$2"
6958 <        shift; shift
6957 >        shift
6958 >        realname="$1"
6959 >        shift
6960  
6961          if test -n "$soname_spec"; then
6962            eval soname=\"$soname_spec\"
# Line 3973 | Line 6975 | EOF
6975          done
6976  
6977          # Use standard objects if they are pic
6978 <        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6978 >        test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6979 >        test "X$libobjs" = "X " && libobjs=
6980 >
6981 >        delfiles=
6982 >        if test -n "$export_symbols" && test -n "$include_expsyms"; then
6983 >          $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
6984 >          export_symbols="$output_objdir/$libname.uexp"
6985 >          delfiles="$delfiles $export_symbols"
6986 >        fi
6987 >
6988 >        orig_export_symbols=
6989 >        case $host_os in
6990 >        cygwin* | mingw* | cegcc*)
6991 >          if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
6992 >            # exporting using user supplied symfile
6993 >            if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
6994 >              # and it's NOT already a .def file. Must figure out
6995 >              # which of the given symbols are data symbols and tag
6996 >              # them as such. So, trigger use of export_symbols_cmds.
6997 >              # export_symbols gets reassigned inside the "prepare
6998 >              # the list of exported symbols" if statement, so the
6999 >              # include_expsyms logic still works.
7000 >              orig_export_symbols="$export_symbols"
7001 >              export_symbols=
7002 >              always_export_symbols=yes
7003 >            fi
7004 >          fi
7005 >          ;;
7006 >        esac
7007  
7008          # Prepare the list of exported symbols
7009          if test -z "$export_symbols"; then
7010            if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
7011 <            $show "generating symbol list for \`$libname.la'"
7011 >            func_verbose "generating symbol list for \`$libname.la'"
7012              export_symbols="$output_objdir/$libname.exp"
7013 <            $run $rm $export_symbols
7013 >            $opt_dry_run || $RM $export_symbols
7014              cmds=$export_symbols_cmds
7015              save_ifs="$IFS"; IFS='~'
7016              for cmd in $cmds; do
7017                IFS="$save_ifs"
7018                eval cmd=\"$cmd\"
7019 <              if len=`expr "X$cmd" : ".*"` &&
7020 <               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7021 <                $show "$cmd"
7022 <                $run eval "$cmd" || exit $?
7023 <                skipped_export=false
7019 >              func_len " $cmd"
7020 >              len=$func_len_result
7021 >              if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7022 >                func_show_eval "$cmd" 'exit $?'
7023 >                skipped_export=false
7024                else
7025 <                # The command line is too long to execute in one step.
7026 <                $show "using reloadable object file for export list..."
7027 <                skipped_export=:
7025 >                # The command line is too long to execute in one step.
7026 >                func_verbose "using reloadable object file for export list..."
7027 >                skipped_export=:
7028                  # Break out early, otherwise skipped_export may be
7029                  # set to false by a later but shorter cmd.
7030                  break
7031                fi
7032              done
7033              IFS="$save_ifs"
7034 <            if test -n "$export_symbols_regex"; then
7035 <              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
7036 <              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4007 <              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4008 <              $run eval '$mv "${export_symbols}T" "$export_symbols"'
7034 >            if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7035 >              func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7036 >              func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7037              fi
7038            fi
7039          fi
7040  
7041          if test -n "$export_symbols" && test -n "$include_expsyms"; then
7042 <          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
7042 >          tmp_export_symbols="$export_symbols"
7043 >          test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7044 >          $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7045 >        fi
7046 >
7047 >        if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7048 >          # The given exports_symbols file has to be filtered, so filter it.
7049 >          func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7050 >          # FIXME: $output_objdir/$libname.filter potentially contains lots of
7051 >          # 's' commands which not all seds can handle. GNU sed should be fine
7052 >          # though. Also, the filter scales superlinearly with the number of
7053 >          # global variables. join(1) would be nice here, but unfortunately
7054 >          # isn't a blessed tool.
7055 >          $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7056 >          delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7057 >          export_symbols=$output_objdir/$libname.def
7058 >          $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7059          fi
7060  
7061          tmp_deplibs=
7062 +        inst_prefix_arg=
7063          for test_deplib in $deplibs; do
7064 <                case " $convenience " in
7065 <                *" $test_deplib "*) ;;
7066 <                *)
7064 >          case " $convenience " in
7065 >          *" $test_deplib "*) ;;
7066 >          *)
7067 >                if test -n "$inst_prefix_dir" && (echo "$test_deplib" | grep -- "$inst_prefix_dir" >/dev/null); then
7068 >                        inst_prefix_arg="$inst_prefix_arg $test_deplib"
7069 >                else
7070                          tmp_deplibs="$tmp_deplibs $test_deplib"
7071 <                        ;;
7072 <                esac
7071 >                fi
7072 >            ;;
7073 >          esac
7074          done
7075          deplibs="$tmp_deplibs"
7076 +        if test -n "$inst_prefix_arg"; then
7077 +                deplibs="$inst_prefix_arg $deplibs"
7078 +        fi
7079  
7080          if test -n "$convenience"; then
7081 +          if test -n "$whole_archive_flag_spec" &&
7082 +            test "$compiler_needs_object" = yes &&
7083 +            test -z "$libobjs"; then
7084 +            # extract the archives, so we have objects to list.
7085 +            # TODO: could optimize this to just extract one archive.
7086 +            whole_archive_flag_spec=
7087 +          fi
7088            if test -n "$whole_archive_flag_spec"; then
7089              save_libobjs=$libobjs
7090              eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7091 +            test "X$libobjs" = "X " && libobjs=
7092            else
7093              gentop="$output_objdir/${outputname}x"
7094              generated="$generated $gentop"
7095  
7096              func_extract_archives $gentop $convenience
7097              libobjs="$libobjs $func_extract_archives_result"
7098 +            test "X$libobjs" = "X " && libobjs=
7099            fi
7100          fi
7101 <        
7101 >
7102          if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7103            eval flag=\"$thread_safe_flag_spec\"
7104            linker_flags="$linker_flags $flag"
# Line 4045 | Line 7106 | EOF
7106  
7107          # Make a backup of the uninstalled library when relinking
7108          if test "$mode" = relink; then
7109 <          $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
7109 >          $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
7110          fi
7111  
7112          # Do each of the archive commands.
# Line 4058 | Line 7119 | EOF
7119              cmds=$module_cmds
7120            fi
7121          else
7122 <        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7123 <          eval test_cmds=\"$archive_expsym_cmds\"
7124 <          cmds=$archive_expsym_cmds
7125 <        else
7126 <          eval test_cmds=\"$archive_cmds\"
7127 <          cmds=$archive_cmds
7122 >          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7123 >            eval test_cmds=\"$archive_expsym_cmds\"
7124 >            cmds=$archive_expsym_cmds
7125 >          else
7126 >            eval test_cmds=\"$archive_cmds\"
7127 >            cmds=$archive_cmds
7128            fi
7129          fi
7130  
7131          if test "X$skipped_export" != "X:" &&
7132 <           len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
7133 <           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7132 >           func_len " $test_cmds" &&
7133 >           len=$func_len_result &&
7134 >           test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7135            :
7136          else
7137 <          # The command line is too long to link in one step, link piecewise.
7138 <          $echo "creating reloadable object files..."
7137 >          # The command line is too long to link in one step, link piecewise
7138 >          # or, if using GNU ld and skipped_export is not :, use a linker
7139 >          # script.
7140  
7141            # Save the value of $output and $libobjs because we want to
7142            # use them later.  If we have whole_archive_flag_spec, we
# Line 4087 | Line 7150 | EOF
7150              save_libobjs=$libobjs
7151            fi
7152            save_output=$output
7153 <          output_la=`$echo "X$output" | $Xsed -e "$basename"`
7153 >          output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
7154  
7155            # Clear the reloadable object creation command queue and
7156            # initialize k to one.
7157            test_cmds=
7158            concat_cmds=
7159            objlist=
4097          delfiles=
7160            last_robj=
7161            k=1
7162 <          output=$output_objdir/$output_la-${k}.$objext
7163 <          # Loop over the list of objects to be linked.
7164 <          for obj in $save_libobjs
7165 <          do
7166 <            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
7167 <            if test "X$objlist" = X ||
7168 <               { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
7169 <                 test "$len" -le "$max_cmd_len"; }; then
7170 <              objlist="$objlist $obj"
7162 >
7163 >          if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7164 >            output=${output_objdir}/${output_la}.lnkscript
7165 >            func_verbose "creating GNU ld script: $output"
7166 >            $ECHO 'INPUT (' > $output
7167 >            for obj in $save_libobjs
7168 >            do
7169 >              $ECHO "$obj" >> $output
7170 >            done
7171 >            $ECHO ')' >> $output
7172 >            delfiles="$delfiles $output"
7173 >          elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7174 >            output=${output_objdir}/${output_la}.lnk
7175 >            func_verbose "creating linker input file list: $output"
7176 >            : > $output
7177 >            set x $save_libobjs
7178 >            shift
7179 >            firstobj=
7180 >            if test "$compiler_needs_object" = yes; then
7181 >              firstobj="$1 "
7182 >              shift
7183 >            fi
7184 >            for obj
7185 >            do
7186 >              $ECHO "$obj" >> $output
7187 >            done
7188 >            delfiles="$delfiles $output"
7189 >            output=$firstobj\"$file_list_spec$output\"
7190 >          else
7191 >            if test -n "$save_libobjs"; then
7192 >              func_verbose "creating reloadable object files..."
7193 >              output=$output_objdir/$output_la-${k}.$objext
7194 >              eval test_cmds=\"$reload_cmds\"
7195 >              func_len " $test_cmds"
7196 >              len0=$func_len_result
7197 >              len=$len0
7198 >
7199 >              # Loop over the list of objects to be linked.
7200 >              for obj in $save_libobjs
7201 >              do
7202 >                func_len " $obj"
7203 >                func_arith $len + $func_len_result
7204 >                len=$func_arith_result
7205 >                if test "X$objlist" = X ||
7206 >                   test "$len" -lt "$max_cmd_len"; then
7207 >                  func_append objlist " $obj"
7208 >                else
7209 >                  # The command $test_cmds is almost too long, add a
7210 >                  # command to the queue.
7211 >                  if test "$k" -eq 1 ; then
7212 >                    # The first file doesn't have a previous command to add.
7213 >                    eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
7214 >                  else
7215 >                    # All subsequent reloadable object files will link in
7216 >                    # the last one created.
7217 >                    eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
7218 >                  fi
7219 >                  last_robj=$output_objdir/$output_la-${k}.$objext
7220 >                  func_arith $k + 1
7221 >                  k=$func_arith_result
7222 >                  output=$output_objdir/$output_la-${k}.$objext
7223 >                  objlist=$obj
7224 >                  func_len " $last_robj"
7225 >                  func_arith $len0 + $func_len_result
7226 >                  len=$func_arith_result
7227 >                fi
7228 >              done
7229 >              # Handle the remaining objects by creating one last
7230 >              # reloadable object file.  All subsequent reloadable object
7231 >              # files will link in the last one created.
7232 >              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7233 >              eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
7234 >              if test -n "$last_robj"; then
7235 >                eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7236 >              fi
7237 >              delfiles="$delfiles $output"
7238 >
7239              else
7240 <              # The command $test_cmds is almost too long, add a
7241 <              # command to the queue.
7242 <              if test "$k" -eq 1 ; then
7243 <                # The first file doesn't have a previous command to add.
7244 <                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
7245 <              else
7246 <                # All subsequent reloadable object files will link in
7247 <                # the last one created.
7248 <                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
7240 >              output=
7241 >            fi
7242 >
7243 >            if ${skipped_export-false}; then
7244 >              func_verbose "generating symbol list for \`$libname.la'"
7245 >              export_symbols="$output_objdir/$libname.exp"
7246 >              $opt_dry_run || $RM $export_symbols
7247 >              libobjs=$output
7248 >              # Append the command to create the export file.
7249 >              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7250 >              eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7251 >              if test -n "$last_robj"; then
7252 >                eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7253                fi
4120              last_robj=$output_objdir/$output_la-${k}.$objext
4121              k=`expr $k + 1`
4122              output=$output_objdir/$output_la-${k}.$objext
4123              objlist=$obj
4124              len=1
7254              fi
4126          done
4127          # Handle the remaining objects by creating one last
4128          # reloadable object file.  All subsequent reloadable object
4129          # files will link in the last one created.
4130          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4131          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
7255  
7256 <          if ${skipped_export-false}; then
7257 <            $show "generating symbol list for \`$libname.la'"
4135 <            export_symbols="$output_objdir/$libname.exp"
4136 <            $run $rm $export_symbols
4137 <            libobjs=$output
4138 <            # Append the command to create the export file.
4139 <            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4140 <          fi
4141 <
4142 <          # Set up a command to remove the reloadable object files
4143 <          # after they are used.
4144 <          i=0
4145 <          while test "$i" -lt "$k"
4146 <          do
4147 <            i=`expr $i + 1`
4148 <            delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4149 <          done
7256 >            test -n "$save_libobjs" &&
7257 >              func_verbose "creating a temporary reloadable object file: $output"
7258  
7259 <          $echo "creating a temporary reloadable object file: $output"
7259 >            # Loop through the commands generated above and execute them.
7260 >            save_ifs="$IFS"; IFS='~'
7261 >            for cmd in $concat_cmds; do
7262 >              IFS="$save_ifs"
7263 >              $opt_silent || {
7264 >                  func_quote_for_expand "$cmd"
7265 >                  eval "func_echo $func_quote_for_expand_result"
7266 >              }
7267 >              $opt_dry_run || eval "$cmd" || {
7268 >                lt_exit=$?
7269 >
7270 >                # Restore the uninstalled library and exit
7271 >                if test "$mode" = relink; then
7272 >                  ( cd "$output_objdir" && \
7273 >                    $RM "${realname}T" && \
7274 >                    $MV "${realname}U" "$realname" )
7275 >                fi
7276  
7277 <          # Loop through the commands generated above and execute them.
7278 <          save_ifs="$IFS"; IFS='~'
7279 <          for cmd in $concat_cmds; do
7277 >                exit $lt_exit
7278 >              }
7279 >            done
7280              IFS="$save_ifs"
7281 <            $show "$cmd"
7282 <            $run eval "$cmd" || exit $?
7283 <          done
7284 <          IFS="$save_ifs"
7281 >
7282 >            if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7283 >              func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7284 >              func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7285 >            fi
7286 >          fi
7287 >
7288 >          if ${skipped_export-false}; then
7289 >            if test -n "$export_symbols" && test -n "$include_expsyms"; then
7290 >              tmp_export_symbols="$export_symbols"
7291 >              test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7292 >              $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7293 >            fi
7294 >
7295 >            if test -n "$orig_export_symbols"; then
7296 >              # The given exports_symbols file has to be filtered, so filter it.
7297 >              func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7298 >              # FIXME: $output_objdir/$libname.filter potentially contains lots of
7299 >              # 's' commands which not all seds can handle. GNU sed should be fine
7300 >              # though. Also, the filter scales superlinearly with the number of
7301 >              # global variables. join(1) would be nice here, but unfortunately
7302 >              # isn't a blessed tool.
7303 >              $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7304 >              delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7305 >              export_symbols=$output_objdir/$libname.def
7306 >              $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7307 >            fi
7308 >          fi
7309  
7310            libobjs=$output
7311            # Restore the value of output.
# Line 4165 | Line 7313 | EOF
7313  
7314            if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
7315              eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
7316 +            test "X$libobjs" = "X " && libobjs=
7317            fi
7318            # Expand the library linking commands again to reset the
7319            # value of $libobjs for piecewise linking.
# Line 4177 | Line 7326 | EOF
7326                cmds=$module_cmds
7327              fi
7328            else
7329 <          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7330 <            cmds=$archive_expsym_cmds
7331 <          else
7332 <            cmds=$archive_cmds
7329 >            if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7330 >              cmds=$archive_expsym_cmds
7331 >            else
7332 >              cmds=$archive_cmds
7333              fi
7334            fi
7335 +        fi
7336 +
7337 +        if test -n "$delfiles"; then
7338 +          # Append the command to remove temporary files to $cmds.
7339 +          eval cmds=\"\$cmds~\$RM $delfiles\"
7340 +        fi
7341  
7342 <          # Append the command to remove the reloadable object files
7343 <          # to the just-reset $cmds.
7344 <          eval cmds=\"\$cmds~\$rm $delfiles\"
7342 >        # Add any objects from preloaded convenience libraries
7343 >        if test -n "$dlprefiles"; then
7344 >          gentop="$output_objdir/${outputname}x"
7345 >          generated="$generated $gentop"
7346 >
7347 >          func_extract_archives $gentop $dlprefiles
7348 >          libobjs="$libobjs $func_extract_archives_result"
7349 >          test "X$libobjs" = "X " && libobjs=
7350          fi
7351 +
7352          save_ifs="$IFS"; IFS='~'
7353          for cmd in $cmds; do
7354            IFS="$save_ifs"
7355            eval cmd=\"$cmd\"
7356 <          $show "$cmd"
7357 <          $run eval "$cmd" || {
7356 >          $opt_silent || {
7357 >            func_quote_for_expand "$cmd"
7358 >            eval "func_echo $func_quote_for_expand_result"
7359 >          }
7360 >          $opt_dry_run || eval "$cmd" || {
7361              lt_exit=$?
7362  
7363              # Restore the uninstalled library and exit
7364              if test "$mode" = relink; then
7365 <              $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
7365 >              ( cd "$output_objdir" && \
7366 >                $RM "${realname}T" && \
7367 >                $MV "${realname}U" "$realname" )
7368              fi
7369  
7370              exit $lt_exit
# Line 4208 | Line 7374 | EOF
7374  
7375          # Restore the uninstalled library and exit
7376          if test "$mode" = relink; then
7377 <          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
7377 >          $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
7378  
7379            if test -n "$convenience"; then
7380              if test -z "$whole_archive_flag_spec"; then
7381 <              $show "${rm}r $gentop"
4216 <              $run ${rm}r "$gentop"
7381 >              func_show_eval '${RM}r "$gentop"'
7382              fi
7383            fi
7384  
# Line 4223 | Line 7388 | EOF
7388          # Create links to the real library.
7389          for linkname in $linknames; do
7390            if test "$realname" != "$linkname"; then
7391 <            $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4227 <            $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
7391 >            func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
7392            fi
7393          done
7394  
# Line 4237 | Line 7401 | EOF
7401        ;;
7402  
7403      obj)
4240      if test -n "$deplibs"; then
4241        $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4242      fi
4243
7404        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7405 <        $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
7405 >        func_warning "\`-dlopen' is ignored for objects"
7406        fi
7407  
7408 <      if test -n "$rpath"; then
7409 <        $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
7410 <      fi
7408 >      case " $deplibs" in
7409 >      *\ -l* | *\ -L*)
7410 >        func_warning "\`-l' and \`-L' are ignored for objects" ;;
7411 >      esac
7412  
7413 <      if test -n "$xrpath"; then
7414 <        $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4254 <      fi
7413 >      test -n "$rpath" && \
7414 >        func_warning "\`-rpath' is ignored for objects"
7415  
7416 <      if test -n "$vinfo"; then
7417 <        $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4258 <      fi
7416 >      test -n "$xrpath" && \
7417 >        func_warning "\`-R' is ignored for objects"
7418  
7419 <      if test -n "$release"; then
7420 <        $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
7421 <      fi
7419 >      test -n "$vinfo" && \
7420 >        func_warning "\`-version-info' is ignored for objects"
7421 >
7422 >      test -n "$release" && \
7423 >        func_warning "\`-release' is ignored for objects"
7424  
7425        case $output in
7426        *.lo)
7427 <        if test -n "$objs$old_deplibs"; then
7428 <          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
7429 <          exit $EXIT_FAILURE
7430 <        fi
7431 <        libobj="$output"
7432 <        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
7427 >        test -n "$objs$old_deplibs" && \
7428 >          func_fatal_error "cannot build library object \`$output' from non-libtool objects"
7429 >
7430 >        libobj=$output
7431 >        func_lo2o "$libobj"
7432 >        obj=$func_lo2o_result
7433          ;;
7434        *)
7435          libobj=
# Line 4277 | Line 7438 | EOF
7438        esac
7439  
7440        # Delete the old objects.
7441 <      $run $rm $obj $libobj
7441 >      $opt_dry_run || $RM $obj $libobj
7442  
7443        # Objects from convenience libraries.  This assumes
7444        # single-version convenience libraries.  Whenever we create
# Line 4293 | Line 7454 | EOF
7454        if test -n "$convenience"; then
7455          if test -n "$whole_archive_flag_spec"; then
7456            eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
7457 <          reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
7457 >          reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
7458          else
7459            gentop="$output_objdir/${obj}x"
7460            generated="$generated $gentop"
# Line 4304 | Line 7465 | EOF
7465        fi
7466  
7467        # Create the old-style object.
7468 <      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
7468 >      reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
7469  
7470        output="$obj"
7471 <      cmds=$reload_cmds
4311 <      save_ifs="$IFS"; IFS='~'
4312 <      for cmd in $cmds; do
4313 <        IFS="$save_ifs"
4314 <        eval cmd=\"$cmd\"
4315 <        $show "$cmd"
4316 <        $run eval "$cmd" || exit $?
4317 <      done
4318 <      IFS="$save_ifs"
7471 >      func_execute_cmds "$reload_cmds" 'exit $?'
7472  
7473        # Exit if we aren't doing a library object file.
7474        if test -z "$libobj"; then
7475          if test -n "$gentop"; then
7476 <          $show "${rm}r $gentop"
4324 <          $run ${rm}r $gentop
7476 >          func_show_eval '${RM}r "$gentop"'
7477          fi
7478  
7479          exit $EXIT_SUCCESS
# Line 4329 | Line 7481 | EOF
7481  
7482        if test "$build_libtool_libs" != yes; then
7483          if test -n "$gentop"; then
7484 <          $show "${rm}r $gentop"
4333 <          $run ${rm}r $gentop
7484 >          func_show_eval '${RM}r "$gentop"'
7485          fi
7486  
7487          # Create an invalid libtool object if no PIC, so that we don't
7488          # accidentally link it into a program.
7489          # $show "echo timestamp > $libobj"
7490 <        # $run eval "echo timestamp > $libobj" || exit $?
7490 >        # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
7491          exit $EXIT_SUCCESS
7492        fi
7493  
# Line 4344 | Line 7495 | EOF
7495          # Only do commands if we really have different PIC objects.
7496          reload_objs="$libobjs $reload_conv_objs"
7497          output="$libobj"
7498 <        cmds=$reload_cmds
4348 <        save_ifs="$IFS"; IFS='~'
4349 <        for cmd in $cmds; do
4350 <          IFS="$save_ifs"
4351 <          eval cmd=\"$cmd\"
4352 <          $show "$cmd"
4353 <          $run eval "$cmd" || exit $?
4354 <        done
4355 <        IFS="$save_ifs"
7498 >        func_execute_cmds "$reload_cmds" 'exit $?'
7499        fi
7500  
7501        if test -n "$gentop"; then
7502 <        $show "${rm}r $gentop"
4360 <        $run ${rm}r $gentop
7502 >        func_show_eval '${RM}r "$gentop"'
7503        fi
7504  
7505        exit $EXIT_SUCCESS
# Line 4365 | Line 7507 | EOF
7507  
7508      prog)
7509        case $host in
7510 <        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
7510 >        *cygwin*) func_stripname '' '.exe' "$output"
7511 >                  output=$func_stripname_result.exe;;
7512        esac
7513 <      if test -n "$vinfo"; then
7514 <        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4372 <      fi
7513 >      test -n "$vinfo" && \
7514 >        func_warning "\`-version-info' is ignored for programs"
7515  
7516 <      if test -n "$release"; then
7517 <        $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4376 <      fi
7516 >      test -n "$release" && \
7517 >        func_warning "\`-release' is ignored for programs"
7518  
7519 <      if test "$preload" = yes; then
7520 <        if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
7521 <           test "$dlopen_self_static" = unknown; then
7522 <          $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
7523 <        fi
4383 <      fi
7519 >      test "$preload" = yes \
7520 >        && test "$dlopen_support" = unknown \
7521 >        && test "$dlopen_self" = unknown \
7522 >        && test "$dlopen_self_static" = unknown && \
7523 >          func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
7524  
7525        case $host in
7526        *-*-rhapsody* | *-*-darwin1.[012])
7527          # On Rhapsody replace the C library is the System framework
7528 <        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
7529 <        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
7528 >        compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7529 >        finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7530          ;;
7531        esac
7532  
7533        case $host in
7534 <      *darwin*)
7535 <        # Don't allow lazy linking, it breaks C++ global constructors
7536 <        if test "$tagname" = CXX ; then
7537 <        compile_command="$compile_command ${wl}-bind_at_load"
7538 <        finalize_command="$finalize_command ${wl}-bind_at_load"
7539 <        fi
7540 <        ;;
7534 >      *-*-darwin*)
7535 >        # Don't allow lazy linking, it breaks C++ global constructors
7536 >        # But is supposedly fixed on 10.4 or later (yay!).
7537 >        if test "$tagname" = CXX ; then
7538 >          case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
7539 >            10.[0123])
7540 >              compile_command="$compile_command ${wl}-bind_at_load"
7541 >              finalize_command="$finalize_command ${wl}-bind_at_load"
7542 >            ;;
7543 >          esac
7544 >        fi
7545 >        # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7546 >        compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7547 >        finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7548 >        ;;
7549        esac
7550  
7551  
# Line 4472 | Line 7620 | EOF
7620            esac
7621          fi
7622          case $host in
7623 <        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
7624 <          testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
7623 >        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
7624 >          testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
7625            case :$dllsearchpath: in
7626            *":$libdir:"*) ;;
7627 +          ::) dllsearchpath=$libdir;;
7628            *) dllsearchpath="$dllsearchpath:$libdir";;
7629            esac
7630            case :$dllsearchpath: in
7631            *":$testbindir:"*) ;;
7632 +          ::) dllsearchpath=$testbindir;;
7633            *) dllsearchpath="$dllsearchpath:$testbindir";;
7634            esac
7635            ;;
# Line 4531 | Line 7681 | EOF
7681  
7682        if test -n "$libobjs" && test "$build_old_libs" = yes; then
7683          # Transform all the library objects into standard objects.
7684 <        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7685 <        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7684 >        compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7685 >        finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7686        fi
7687  
7688 <      dlsyms=
4539 <      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4540 <        if test -n "$NM" && test -n "$global_symbol_pipe"; then
4541 <          dlsyms="${outputname}S.c"
4542 <        else
4543 <          $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4544 <        fi
4545 <      fi
4546 <
4547 <      if test -n "$dlsyms"; then
4548 <        case $dlsyms in
4549 <        "") ;;
4550 <        *.c)
4551 <          # Discover the nlist of each of the dlfiles.
4552 <          nlist="$output_objdir/${outputname}.nm"
4553 <
4554 <          $show "$rm $nlist ${nlist}S ${nlist}T"
4555 <          $run $rm "$nlist" "${nlist}S" "${nlist}T"
4556 <
4557 <          # Parse the name list into a source file.
4558 <          $show "creating $output_objdir/$dlsyms"
4559 <
4560 <          test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4561 < /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4562 < /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4563 <
4564 < #ifdef __cplusplus
4565 < extern \"C\" {
4566 < #endif
4567 <
4568 < /* Prevent the only kind of declaration conflicts we can make. */
4569 < #define lt_preloaded_symbols some_other_symbol
4570 <
4571 < /* External symbol declarations for the compiler. */\
4572 < "
4573 <
4574 <          if test "$dlself" = yes; then
4575 <            $show "generating symbol list for \`$output'"
4576 <
4577 <            test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4578 <
4579 <            # Add our own program objects to the symbol list.
4580 <            progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4581 <            for arg in $progfiles; do
4582 <              $show "extracting global C symbols from \`$arg'"
4583 <              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4584 <            done
7688 >      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
7689  
7690 <            if test -n "$exclude_expsyms"; then
7691 <              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
7692 <              $run eval '$mv "$nlist"T "$nlist"'
4589 <            fi
4590 <
4591 <            if test -n "$export_symbols_regex"; then
4592 <              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4593 <              $run eval '$mv "$nlist"T "$nlist"'
4594 <            fi
4595 <
4596 <            # Prepare the list of exported symbols
4597 <            if test -z "$export_symbols"; then
4598 <              export_symbols="$output_objdir/$outputname.exp"
4599 <              $run $rm $export_symbols
4600 <              $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4601 <              case $host in
4602 <              *cygwin* | *mingw* )
4603 <                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4604 <                $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4605 <                ;;
4606 <              esac
4607 <            else
4608 <              $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4609 <              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4610 <              $run eval 'mv "$nlist"T "$nlist"'
4611 <              case $host in
4612 <              *cygwin* | *mingw* )
4613 <                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4614 <                $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4615 <                ;;
4616 <              esac
4617 <            fi
4618 <          fi
4619 <
4620 <          for arg in $dlprefiles; do
4621 <            $show "extracting global C symbols from \`$arg'"
4622 <            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4623 <            $run eval '$echo ": $name " >> "$nlist"'
4624 <            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4625 <          done
4626 <
4627 <          if test -z "$run"; then
4628 <            # Make sure we have at least an empty file.
4629 <            test -f "$nlist" || : > "$nlist"
4630 <
4631 <            if test -n "$exclude_expsyms"; then
4632 <              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4633 <              $mv "$nlist"T "$nlist"
4634 <            fi
4635 <
4636 <            # Try sorting and uniquifying the output.
4637 <            if grep -v "^: " < "$nlist" |
4638 <                if sort -k 3 </dev/null >/dev/null 2>&1; then
4639 <                  sort -k 3
4640 <                else
4641 <                  sort +2
4642 <                fi |
4643 <                uniq > "$nlist"S; then
4644 <              :
4645 <            else
4646 <              grep -v "^: " < "$nlist" > "$nlist"S
4647 <            fi
4648 <
4649 <            if test -f "$nlist"S; then
4650 <              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4651 <            else
4652 <              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4653 <            fi
4654 <
4655 <            $echo >> "$output_objdir/$dlsyms" "\
4656 <
4657 < #undef lt_preloaded_symbols
4658 <
4659 < #if defined (__STDC__) && __STDC__
4660 < # define lt_ptr void *
4661 < #else
4662 < # define lt_ptr char *
4663 < # define const
4664 < #endif
4665 <
4666 < /* The mapping between symbol names and symbols. */
4667 < "
4668 <
4669 <            case $host in
4670 <            *cygwin* | *mingw* )
4671 <          $echo >> "$output_objdir/$dlsyms" "\
4672 < /* DATA imports from DLLs on WIN32 can't be const, because
4673 <   runtime relocations are performed -- see ld's documentation
4674 <   on pseudo-relocs */
4675 < struct {
4676 < "
4677 <              ;;
4678 <            * )
4679 <          $echo >> "$output_objdir/$dlsyms" "\
4680 < const struct {
4681 < "
4682 <              ;;
4683 <            esac
4684 <
4685 <
4686 <          $echo >> "$output_objdir/$dlsyms" "\
4687 <  const char *name;
4688 <  lt_ptr address;
4689 < }
4690 < lt_preloaded_symbols[] =
4691 < {\
4692 < "
4693 <
4694 <            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4695 <
4696 <            $echo >> "$output_objdir/$dlsyms" "\
4697 <  {0, (lt_ptr) 0}
4698 < };
4699 <
4700 < /* This works around a problem in FreeBSD linker */
4701 < #ifdef FREEBSD_WORKAROUND
4702 < static const void *lt_preloaded_setup() {
4703 <  return lt_preloaded_symbols;
4704 < }
4705 < #endif
4706 <
4707 < #ifdef __cplusplus
4708 < }
4709 < #endif\
4710 < "
4711 <          fi
4712 <
4713 <          pic_flag_for_symtable=
4714 <          case $host in
4715 <          # compiling the symbol table file with pic_flag works around
4716 <          # a FreeBSD bug that causes programs to crash when -lm is
4717 <          # linked before any other PIC object.  But we must not use
4718 <          # pic_flag when linking with -static.  The problem exists in
4719 <          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4720 <          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4721 <            case "$compile_command " in
4722 <            *" -static "*) ;;
4723 <            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4724 <            esac;;
4725 <          *-*-hpux*)
4726 <            case "$compile_command " in
4727 <            *" -static "*) ;;
4728 <            *) pic_flag_for_symtable=" $pic_flag";;
4729 <            esac
4730 <          esac
4731 <
4732 <          # Now compile the dynamic symbol file.
4733 <          $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4734 <          $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4735 <
4736 <          # Clean up the generated files.
4737 <          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4738 <          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4739 <
4740 <          # Transform the symbol file into the correct name.
4741 <          case $host in
4742 <          *cygwin* | *mingw* )
4743 <            if test -f "$output_objdir/${outputname}.def" ; then
4744 <              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4745 <              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4746 <            else
4747 <              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4748 <              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4749 <             fi
4750 <            ;;
4751 <          * )
4752 <            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4753 <            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4754 <            ;;
4755 <          esac
4756 <          ;;
4757 <        *)
4758 <          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4759 <          exit $EXIT_FAILURE
4760 <          ;;
4761 <        esac
4762 <      else
4763 <        # We keep going just in case the user didn't refer to
4764 <        # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
4765 <        # really was required.
4766 <
4767 <        # Nullify the symbol file.
4768 <        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4769 <        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
7690 >      # template prelinking step
7691 >      if test -n "$prelink_cmds"; then
7692 >        func_execute_cmds "$prelink_cmds" 'exit $?'
7693        fi
7694  
7695 <      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
7695 >      wrappers_required=yes
7696 >      case $host in
7697 >      *cygwin* | *mingw* )
7698 >        if test "$build_libtool_libs" != yes; then
7699 >          wrappers_required=no
7700 >        fi
7701 >        ;;
7702 >      *cegcc)
7703 >        # Disable wrappers for cegcc, we are cross compiling anyway.
7704 >        wrappers_required=no
7705 >        ;;
7706 >      *)
7707 >        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
7708 >          wrappers_required=no
7709 >        fi
7710 >        ;;
7711 >      esac
7712 >      if test "$wrappers_required" = no; then
7713          # Replace the output file specification.
7714 <        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
7714 >        compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7715          link_command="$compile_command$compile_rpath"
7716  
7717          # We have no uninstalled library dependencies, so finalize right now.
7718 <        $show "$link_command"
7719 <        $run eval "$link_command"
4780 <        exit_status=$?
7718 >        exit_status=0
7719 >        func_show_eval "$link_command" 'exit_status=$?'
7720  
7721          # Delete the generated files.
7722 <        if test -n "$dlsyms"; then
7723 <          $show "$rm $output_objdir/${outputname}S.${objext}"
4785 <          $run $rm "$output_objdir/${outputname}S.${objext}"
7722 >        if test -f "$output_objdir/${outputname}S.${objext}"; then
7723 >          func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
7724          fi
7725  
7726          exit $exit_status
7727        fi
7728  
4791      if test -n "$shlibpath_var"; then
4792        # We should set the shlibpath_var
4793        rpath=
4794        for dir in $temp_rpath; do
4795          case $dir in
4796          [\\/]* | [A-Za-z]:[\\/]*)
4797            # Absolute path.
4798            rpath="$rpath$dir:"
4799            ;;
4800          *)
4801            # Relative path: add a thisdir entry.
4802            rpath="$rpath\$thisdir/$dir:"
4803            ;;
4804          esac
4805        done
4806        temp_rpath="$rpath"
4807      fi
4808
7729        if test -n "$compile_shlibpath$finalize_shlibpath"; then
7730          compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
7731        fi
# Line 4838 | Line 7758 | static const void *lt_preloaded_setup()
7758          # We don't need to create a wrapper script.
7759          link_command="$compile_var$compile_command$compile_rpath"
7760          # Replace the output file specification.
7761 <        link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7761 >        link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
7762          # Delete the old output file.
7763 <        $run $rm $output
7763 >        $opt_dry_run || $RM $output
7764          # Link the executable and exit
7765 <        $show "$link_command"
4846 <        $run eval "$link_command" || exit $?
7765 >        func_show_eval "$link_command" 'exit $?'
7766          exit $EXIT_SUCCESS
7767        fi
7768  
# Line 4852 | Line 7771 | static const void *lt_preloaded_setup()
7771          link_command="$compile_var$compile_command$compile_rpath"
7772          relink_command="$finalize_var$finalize_command$finalize_rpath"
7773  
7774 <        $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
7775 <        $echo "$modename: \`$output' will be relinked during installation" 1>&2
7774 >        func_warning "this platform does not like uninstalled shared libraries"
7775 >        func_warning "\`$output' will be relinked during installation"
7776        else
7777          if test "$fast_install" != no; then
7778            link_command="$finalize_var$compile_command$finalize_rpath"
7779            if test "$fast_install" = yes; then
7780 <            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
7780 >            relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
7781            else
7782              # fast_install is set to needless
7783              relink_command=
# Line 4870 | Line 7789 | static const void *lt_preloaded_setup()
7789        fi
7790  
7791        # Replace the output file specification.
7792 <      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
7792 >      link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
7793  
7794        # Delete the old output files.
7795 <      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
7795 >      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
7796  
7797 <      $show "$link_command"
4879 <      $run eval "$link_command" || exit $?
7797 >      func_show_eval "$link_command" 'exit $?'
7798  
7799        # Now create the wrapper script.
7800 <      $show "creating $output"
7800 >      func_verbose "creating $output"
7801  
7802        # Quote the relink command for shipping.
7803        if test -n "$relink_command"; then
7804          # Preserve any variables that may affect compiler behavior
7805          for var in $variables_saved_for_relink; do
7806            if eval test -z \"\${$var+set}\"; then
7807 <            relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
7807 >            relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7808            elif eval var_value=\$$var; test -z "$var_value"; then
7809              relink_command="$var=; export $var; $relink_command"
7810            else
7811 <            var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
7812 <            relink_command="$var=\"$var_value\"; export $var; $relink_command"
7811 >            func_quote_for_eval "$var_value"
7812 >            relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7813            fi
7814          done
7815          relink_command="(cd `pwd`; $relink_command)"
7816 <        relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
7816 >        relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7817        fi
7818  
7819 <      # Quote $echo for shipping.
7820 <      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
7819 >      # Quote $ECHO for shipping.
7820 >      if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
7821          case $progpath in
7822          [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
7823          *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
7824          esac
7825 <        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
7825 >        qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
7826        else
7827 <        qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
7827 >        qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
7828        fi
7829  
7830 <      # Only actually do things if our run command is non-null.
7831 <      if test -z "$run"; then
7830 >      # Only actually do things if not in dry run mode.
7831 >      $opt_dry_run || {
7832          # win32 will think the script is a binary if it has
7833          # a .exe suffix, so we strip it off here.
7834          case $output in
7835 <          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
7835 >          *.exe) func_stripname '' '.exe' "$output"
7836 >                 output=$func_stripname_result ;;
7837          esac
7838          # test for cygwin because mv fails w/o .exe extensions
7839          case $host in
7840            *cygwin*)
7841              exeext=.exe
7842 <            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
7842 >            func_stripname '' '.exe' "$outputname"
7843 >            outputname=$func_stripname_result ;;
7844            *) exeext= ;;
7845          esac
7846          case $host in
7847            *cygwin* | *mingw* )
7848 <            output_name=`basename $output`
7849 <            output_path=`dirname $output`
7850 <            cwrappersource="$output_path/$objdir/lt-$output_name.c"
7851 <            cwrapper="$output_path/$output_name.exe"
7852 <            $rm $cwrappersource $cwrapper
7853 <            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
7854 <
7855 <            cat > $cwrappersource <<EOF
7856 <
7857 < /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
7858 <   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
7859 <
7860 <   The $output program cannot be directly executed until all the libtool
7861 <   libraries that it depends on are installed.
7862 <
7863 <   This wrapper executable should never be moved out of the build directory.
7864 <   If it is, it will not operate correctly.
7865 <
4946 <   Currently, it simply execs the wrapper *script* "/bin/sh $output",
4947 <   but could eventually absorb all of the scripts functionality and
4948 <   exec $objdir/$outputname directly.
4949 < */
4950 < EOF
4951 <            cat >> $cwrappersource<<"EOF"
4952 < #include <stdio.h>
4953 < #include <stdlib.h>
4954 < #include <unistd.h>
4955 < #include <malloc.h>
4956 < #include <stdarg.h>
4957 < #include <assert.h>
4958 < #include <string.h>
4959 < #include <ctype.h>
4960 < #include <sys/stat.h>
4961 <
4962 < #if defined(PATH_MAX)
4963 < # define LT_PATHMAX PATH_MAX
4964 < #elif defined(MAXPATHLEN)
4965 < # define LT_PATHMAX MAXPATHLEN
4966 < #else
4967 < # define LT_PATHMAX 1024
4968 < #endif
4969 <
4970 < #ifndef DIR_SEPARATOR
4971 < # define DIR_SEPARATOR '/'
4972 < # define PATH_SEPARATOR ':'
4973 < #endif
4974 <
4975 < #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4976 <  defined (__OS2__)
4977 < # define HAVE_DOS_BASED_FILE_SYSTEM
4978 < # ifndef DIR_SEPARATOR_2
4979 < #  define DIR_SEPARATOR_2 '\\'
4980 < # endif
4981 < # ifndef PATH_SEPARATOR_2
4982 < #  define PATH_SEPARATOR_2 ';'
4983 < # endif
4984 < #endif
4985 <
4986 < #ifndef DIR_SEPARATOR_2
4987 < # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4988 < #else /* DIR_SEPARATOR_2 */
4989 < # define IS_DIR_SEPARATOR(ch) \
4990 <        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4991 < #endif /* DIR_SEPARATOR_2 */
4992 <
4993 < #ifndef PATH_SEPARATOR_2
4994 < # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4995 < #else /* PATH_SEPARATOR_2 */
4996 < # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4997 < #endif /* PATH_SEPARATOR_2 */
4998 <
4999 < #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
5000 < #define XFREE(stale) do { \
5001 <  if (stale) { free ((void *) stale); stale = 0; } \
5002 < } while (0)
5003 <
5004 < /* -DDEBUG is fairly common in CFLAGS.  */
5005 < #undef DEBUG
5006 < #if defined DEBUGWRAPPER
5007 < # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5008 < #else
5009 < # define DEBUG(format, ...)
5010 < #endif
5011 <
5012 < const char *program_name = NULL;
5013 <
5014 < void * xmalloc (size_t num);
5015 < char * xstrdup (const char *string);
5016 < const char * base_name (const char *name);
5017 < char * find_executable(const char *wrapper);
5018 < int    check_executable(const char *path);
5019 < char * strendzap(char *str, const char *pat);
5020 < void lt_fatal (const char *message, ...);
5021 <
5022 < int
5023 < main (int argc, char *argv[])
5024 < {
5025 <  char **newargz;
5026 <  int i;
5027 <
5028 <  program_name = (char *) xstrdup (base_name (argv[0]));
5029 <  DEBUG("(main) argv[0]      : %s\n",argv[0]);
5030 <  DEBUG("(main) program_name : %s\n",program_name);
5031 <  newargz = XMALLOC(char *, argc+2);
5032 < EOF
5033 <
5034 <            cat >> $cwrappersource <<EOF
5035 <  newargz[0] = (char *) xstrdup("$SHELL");
5036 < EOF
5037 <
5038 <            cat >> $cwrappersource <<"EOF"
5039 <  newargz[1] = find_executable(argv[0]);
5040 <  if (newargz[1] == NULL)
5041 <    lt_fatal("Couldn't find %s", argv[0]);
5042 <  DEBUG("(main) found exe at : %s\n",newargz[1]);
5043 <  /* we know the script has the same name, without the .exe */
5044 <  /* so make sure newargz[1] doesn't end in .exe */
5045 <  strendzap(newargz[1],".exe");
5046 <  for (i = 1; i < argc; i++)
5047 <    newargz[i+1] = xstrdup(argv[i]);
5048 <  newargz[argc+1] = NULL;
5049 <
5050 <  for (i=0; i<argc+1; i++)
5051 <  {
5052 <    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
5053 <    ;
5054 <  }
5055 <
5056 < EOF
5057 <
5058 <            case $host_os in
5059 <              mingw*)
5060 <                cat >> $cwrappersource <<EOF
5061 <  execv("$SHELL",(char const **)newargz);
5062 < EOF
5063 <              ;;
5064 <              *)
5065 <                cat >> $cwrappersource <<EOF
5066 <  execv("$SHELL",newargz);
5067 < EOF
5068 <              ;;
5069 <            esac
5070 <
5071 <            cat >> $cwrappersource <<"EOF"
5072 <  return 127;
5073 < }
5074 <
5075 < void *
5076 < xmalloc (size_t num)
5077 < {
5078 <  void * p = (void *) malloc (num);
5079 <  if (!p)
5080 <    lt_fatal ("Memory exhausted");
5081 <
5082 <  return p;
5083 < }
5084 <
5085 < char *
5086 < xstrdup (const char *string)
5087 < {
5088 <  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5089 < ;
5090 < }
5091 <
5092 < const char *
5093 < base_name (const char *name)
5094 < {
5095 <  const char *base;
5096 <
5097 < #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5098 <  /* Skip over the disk name in MSDOS pathnames. */
5099 <  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5100 <    name += 2;
5101 < #endif
5102 <
5103 <  for (base = name; *name; name++)
5104 <    if (IS_DIR_SEPARATOR (*name))
5105 <      base = name + 1;
5106 <  return base;
5107 < }
5108 <
5109 < int
5110 < check_executable(const char * path)
5111 < {
5112 <  struct stat st;
5113 <
5114 <  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5115 <  if ((!path) || (!*path))
5116 <    return 0;
5117 <
5118 <  if ((stat (path, &st) >= 0) &&
5119 <      (
5120 <        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5121 < #if defined (S_IXOTH)
5122 <       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5123 < #endif
5124 < #if defined (S_IXGRP)
5125 <       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5126 < #endif
5127 <       ((st.st_mode & S_IXUSR) == S_IXUSR))
5128 <      )
5129 <    return 1;
5130 <  else
5131 <    return 0;
5132 < }
5133 <
5134 < /* Searches for the full path of the wrapper.  Returns
5135 <   newly allocated full path name if found, NULL otherwise */
5136 < char *
5137 < find_executable (const char* wrapper)
5138 < {
5139 <  int has_slash = 0;
5140 <  const char* p;
5141 <  const char* p_next;
5142 <  /* static buffer for getcwd */
5143 <  char tmp[LT_PATHMAX + 1];
5144 <  int tmp_len;
5145 <  char* concat_name;
5146 <
5147 <  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5148 <
5149 <  if ((wrapper == NULL) || (*wrapper == '\0'))
5150 <    return NULL;
5151 <
5152 <  /* Absolute path? */
5153 < #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5154 <  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5155 <  {
5156 <    concat_name = xstrdup (wrapper);
5157 <    if (check_executable(concat_name))
5158 <      return concat_name;
5159 <    XFREE(concat_name);
5160 <  }
5161 <  else
5162 <  {
5163 < #endif
5164 <    if (IS_DIR_SEPARATOR (wrapper[0]))
5165 <    {
5166 <      concat_name = xstrdup (wrapper);
5167 <      if (check_executable(concat_name))
5168 <        return concat_name;
5169 <      XFREE(concat_name);
5170 <    }
5171 < #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5172 <  }
5173 < #endif
5174 <
5175 <  for (p = wrapper; *p; p++)
5176 <    if (*p == '/')
5177 <    {
5178 <      has_slash = 1;
5179 <      break;
5180 <    }
5181 <  if (!has_slash)
5182 <  {
5183 <    /* no slashes; search PATH */
5184 <    const char* path = getenv ("PATH");
5185 <    if (path != NULL)
5186 <    {
5187 <      for (p = path; *p; p = p_next)
5188 <      {
5189 <        const char* q;
5190 <        size_t p_len;
5191 <        for (q = p; *q; q++)
5192 <          if (IS_PATH_SEPARATOR(*q))
5193 <            break;
5194 <        p_len = q - p;
5195 <        p_next = (*q == '\0' ? q : q + 1);
5196 <        if (p_len == 0)
5197 <        {
5198 <          /* empty path: current directory */
5199 <          if (getcwd (tmp, LT_PATHMAX) == NULL)
5200 <            lt_fatal ("getcwd failed");
5201 <          tmp_len = strlen(tmp);
5202 <          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5203 <          memcpy (concat_name, tmp, tmp_len);
5204 <          concat_name[tmp_len] = '/';
5205 <          strcpy (concat_name + tmp_len + 1, wrapper);
5206 <        }
5207 <        else
5208 <        {
5209 <          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5210 <          memcpy (concat_name, p, p_len);
5211 <          concat_name[p_len] = '/';
5212 <          strcpy (concat_name + p_len + 1, wrapper);
5213 <        }
5214 <        if (check_executable(concat_name))
5215 <          return concat_name;
5216 <        XFREE(concat_name);
5217 <      }
5218 <    }
5219 <    /* not found in PATH; assume curdir */
5220 <  }
5221 <  /* Relative path | not found in path: prepend cwd */
5222 <  if (getcwd (tmp, LT_PATHMAX) == NULL)
5223 <    lt_fatal ("getcwd failed");
5224 <  tmp_len = strlen(tmp);
5225 <  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5226 <  memcpy (concat_name, tmp, tmp_len);
5227 <  concat_name[tmp_len] = '/';
5228 <  strcpy (concat_name + tmp_len + 1, wrapper);
5229 <
5230 <  if (check_executable(concat_name))
5231 <    return concat_name;
5232 <  XFREE(concat_name);
5233 <  return NULL;
5234 < }
5235 <
5236 < char *
5237 < strendzap(char *str, const char *pat)
5238 < {
5239 <  size_t len, patlen;
5240 <
5241 <  assert(str != NULL);
5242 <  assert(pat != NULL);
5243 <
5244 <  len = strlen(str);
5245 <  patlen = strlen(pat);
5246 <
5247 <  if (patlen <= len)
5248 <  {
5249 <    str += len - patlen;
5250 <    if (strcmp(str, pat) == 0)
5251 <      *str = '\0';
5252 <  }
5253 <  return str;
5254 < }
5255 <
5256 < static void
5257 < lt_error_core (int exit_status, const char * mode,
5258 <          const char * message, va_list ap)
5259 < {
5260 <  fprintf (stderr, "%s: %s: ", program_name, mode);
5261 <  vfprintf (stderr, message, ap);
5262 <  fprintf (stderr, ".\n");
5263 <
5264 <  if (exit_status >= 0)
5265 <    exit (exit_status);
5266 < }
5267 <
5268 < void
5269 < lt_fatal (const char *message, ...)
5270 < {
5271 <  va_list ap;
5272 <  va_start (ap, message);
5273 <  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5274 <  va_end (ap);
5275 < }
5276 < EOF
5277 <          # we should really use a build-platform specific compiler
5278 <          # here, but OTOH, the wrappers (shell script and this C one)
5279 <          # are only useful if you want to execute the "real" binary.
5280 <          # Since the "real" binary is built for $host, then this
5281 <          # wrapper might as well be built for $host, too.
5282 <          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5283 <          ;;
5284 <        esac
5285 <        $rm $output
5286 <        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5287 <
5288 <        $echo > $output "\
5289 < #! $SHELL
5290 <
5291 < # $output - temporary wrapper script for $objdir/$outputname
5292 < # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5293 < #
5294 < # The $output program cannot be directly executed until all the libtool
5295 < # libraries that it depends on are installed.
5296 < #
5297 < # This wrapper script should never be moved out of the build directory.
5298 < # If it is, it will not operate correctly.
5299 <
5300 < # Sed substitution that helps us do robust quoting.  It backslashifies
5301 < # metacharacters that are still active within double-quoted strings.
5302 < Xsed='${SED} -e 1s/^X//'
5303 < sed_quote_subst='$sed_quote_subst'
5304 <
5305 < # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5306 < if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5307 <  emulate sh
5308 <  NULLCMD=:
5309 <  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5310 <  # is contrary to our usage.  Disable this feature.
5311 <  alias -g '\${1+\"\$@\"}'='\"\$@\"'
5312 <  setopt NO_GLOB_SUBST
5313 < else
5314 <  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5315 < fi
5316 < BIN_SH=xpg4; export BIN_SH # for Tru64
5317 < DUALCASE=1; export DUALCASE # for MKS sh
5318 <
5319 < # The HP-UX ksh and POSIX shell print the target directory to stdout
5320 < # if CDPATH is set.
5321 < (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5322 <
5323 < relink_command=\"$relink_command\"
5324 <
5325 < # This environment variable determines our operation mode.
5326 < if test \"\$libtool_install_magic\" = \"$magic\"; then
5327 <  # install mode needs the following variable:
5328 <  notinst_deplibs='$notinst_deplibs'
5329 < else
5330 <  # When we are sourced in execute mode, \$file and \$echo are already set.
5331 <  if test \"\$libtool_execute_magic\" != \"$magic\"; then
5332 <    echo=\"$qecho\"
5333 <    file=\"\$0\"
5334 <    # Make sure echo works.
5335 <    if test \"X\$1\" = X--no-reexec; then
5336 <      # Discard the --no-reexec flag, and continue.
5337 <      shift
5338 <    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5339 <      # Yippee, \$echo works!
5340 <      :
5341 <    else
5342 <      # Restart under the correct shell, and then maybe \$echo will work.
5343 <      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5344 <    fi
5345 <  fi\
5346 < "
5347 <        $echo >> $output "\
5348 <
5349 <  # Find the directory that this script lives in.
5350 <  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5351 <  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5352 <
5353 <  # Follow symbolic links until we get to the real thisdir.
5354 <  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5355 <  while test -n \"\$file\"; do
5356 <    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5357 <
5358 <    # If there was a directory component, then change thisdir.
5359 <    if test \"x\$destdir\" != \"x\$file\"; then
5360 <      case \"\$destdir\" in
5361 <      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5362 <      *) thisdir=\"\$thisdir/\$destdir\" ;;
5363 <      esac
5364 <    fi
5365 <
5366 <    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5367 <    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5368 <  done
5369 <
5370 <  # Try to get the absolute directory name.
5371 <  absdir=\`cd \"\$thisdir\" && pwd\`
5372 <  test -n \"\$absdir\" && thisdir=\"\$absdir\"
5373 < "
5374 <
5375 <        if test "$fast_install" = yes; then
5376 <          $echo >> $output "\
5377 <  program=lt-'$outputname'$exeext
5378 <  progdir=\"\$thisdir/$objdir\"
5379 <
5380 <  if test ! -f \"\$progdir/\$program\" || \\
5381 <     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5382 <       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5383 <
5384 <    file=\"\$\$-\$program\"
5385 <
5386 <    if test ! -d \"\$progdir\"; then
5387 <      $mkdir \"\$progdir\"
5388 <    else
5389 <      $rm \"\$progdir/\$file\"
5390 <    fi"
5391 <
5392 <          $echo >> $output "\
5393 <
5394 <    # relink executable if necessary
5395 <    if test -n \"\$relink_command\"; then
5396 <      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5397 <      else
5398 <        $echo \"\$relink_command_output\" >&2
5399 <        $rm \"\$progdir/\$file\"
5400 <        exit $EXIT_FAILURE
5401 <      fi
5402 <    fi
5403 <
5404 <    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5405 <    { $rm \"\$progdir/\$program\";
5406 <      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5407 <    $rm \"\$progdir/\$file\"
5408 <  fi"
5409 <        else
5410 <          $echo >> $output "\
5411 <  program='$outputname'
5412 <  progdir=\"\$thisdir/$objdir\"
5413 < "
5414 <        fi
5415 <
5416 <        $echo >> $output "\
5417 <
5418 <  if test -f \"\$progdir/\$program\"; then"
5419 <
5420 <        # Export our shlibpath_var if we have one.
5421 <        if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5422 <          $echo >> $output "\
5423 <    # Add our own library path to $shlibpath_var
5424 <    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5425 <
5426 <    # Some systems cannot cope with colon-terminated $shlibpath_var
5427 <    # The second colon is a workaround for a bug in BeOS R4 sed
5428 <    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5429 <
5430 <    export $shlibpath_var
5431 < "
5432 <        fi
5433 <
5434 <        # fixup the dll searchpath if we need to.
5435 <        if test -n "$dllsearchpath"; then
5436 <          $echo >> $output "\
5437 <    # Add the dll search path components to the executable PATH
5438 <    PATH=$dllsearchpath:\$PATH
5439 < "
5440 <        fi
7848 >            func_dirname_and_basename "$output" "" "."
7849 >            output_name=$func_basename_result
7850 >            output_path=$func_dirname_result
7851 >            cwrappersource="$output_path/$objdir/lt-$output_name.c"
7852 >            cwrapper="$output_path/$output_name.exe"
7853 >            $RM $cwrappersource $cwrapper
7854 >            trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
7855 >
7856 >            func_emit_cwrapperexe_src > $cwrappersource
7857 >
7858 >            # The wrapper executable is built using the $host compiler,
7859 >            # because it contains $host paths and files. If cross-
7860 >            # compiling, it, like the target executable, must be
7861 >            # executed on the $host or under an emulation environment.
7862 >            $opt_dry_run || {
7863 >              $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
7864 >              $STRIP $cwrapper
7865 >            }
7866  
7867 <        $echo >> $output "\
7868 <    if test \"\$libtool_execute_magic\" != \"$magic\"; then
7869 <      # Run the actual program with our arguments.
7870 < "
7871 <        case $host in
7872 <        # Backslashes separate directories on plain windows
7873 <        *-*-mingw | *-*-os2*)
7874 <          $echo >> $output "\
7875 <      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
7876 < "
7867 >            # Now, create the wrapper script for func_source use:
7868 >            func_ltwrapper_scriptname $cwrapper
7869 >            $RM $func_ltwrapper_scriptname_result
7870 >            trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
7871 >            $opt_dry_run || {
7872 >              # note: this script will not be executed, so do not chmod.
7873 >              if test "x$build" = "x$host" ; then
7874 >                $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7875 >              else
7876 >                func_emit_wrapper no > $func_ltwrapper_scriptname_result
7877 >              fi
7878 >            }
7879            ;;
7880 +          * )
7881 +            $RM $output
7882 +            trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
7883  
7884 <        *)
7885 <          $echo >> $output "\
5456 <      exec \"\$progdir/\$program\" \${1+\"\$@\"}
5457 < "
7884 >            func_emit_wrapper no > $output
7885 >            chmod +x $output
7886            ;;
7887          esac
7888 <        $echo >> $output "\
5461 <      \$echo \"\$0: cannot exec \$program \$*\"
5462 <      exit $EXIT_FAILURE
5463 <    fi
5464 <  else
5465 <    # The program doesn't exist.
5466 <    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5467 <    \$echo \"This script is just a wrapper for \$program.\" 1>&2
5468 <    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5469 <    exit $EXIT_FAILURE
5470 <  fi
5471 < fi\
5472 < "
5473 <        chmod +x $output
5474 <      fi
7888 >      }
7889        exit $EXIT_SUCCESS
7890        ;;
7891      esac
# Line 5480 | Line 7894 | fi\
7894      for oldlib in $oldlibs; do
7895  
7896        if test "$build_libtool_libs" = convenience; then
7897 <        oldobjs="$libobjs_save"
7897 >        oldobjs="$libobjs_save $symfileobj"
7898          addlibs="$convenience"
7899          build_libtool_libs=no
7900        else
# Line 5489 | Line 7903 | fi\
7903            build_libtool_libs=no
7904          else
7905            oldobjs="$old_deplibs $non_pic_objects"
7906 +          if test "$preload" = yes && test -f "$symfileobj"; then
7907 +            oldobjs="$oldobjs $symfileobj"
7908 +          fi
7909          fi
7910          addlibs="$old_convenience"
7911        fi
# Line 5503 | Line 7920 | fi\
7920  
7921        # Do each command in the archive commands.
7922        if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
7923 <       cmds=$old_archive_from_new_cmds
7923 >        cmds=$old_archive_from_new_cmds
7924        else
7925 +
7926 +        # Add any objects from preloaded convenience libraries
7927 +        if test -n "$dlprefiles"; then
7928 +          gentop="$output_objdir/${outputname}x"
7929 +          generated="$generated $gentop"
7930 +
7931 +          func_extract_archives $gentop $dlprefiles
7932 +          oldobjs="$oldobjs $func_extract_archives_result"
7933 +        fi
7934 +
7935          # POSIX demands no paths to be encoded in archives.  We have
7936          # to avoid creating archives with duplicate basenames if we
7937          # might have to extract them afterwards, e.g., when creating a
# Line 5513 | Line 7940 | fi\
7940          # not supported by libtool).
7941          if (for obj in $oldobjs
7942              do
7943 <              $echo "X$obj" | $Xsed -e 's%^.*/%%'
7943 >              func_basename "$obj"
7944 >              $ECHO "$func_basename_result"
7945              done | sort | sort -uc >/dev/null 2>&1); then
7946            :
7947          else
7948 <          $echo "copying selected object files to avoid basename conflicts..."
7949 <
7950 <          if test -z "$gentop"; then
7951 <            gentop="$output_objdir/${outputname}x"
5524 <            generated="$generated $gentop"
5525 <
5526 <            $show "${rm}r $gentop"
5527 <            $run ${rm}r "$gentop"
5528 <            $show "$mkdir $gentop"
5529 <            $run $mkdir "$gentop"
5530 <            exit_status=$?
5531 <            if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5532 <              exit $exit_status
5533 <            fi
5534 <          fi
5535 <
7948 >          $ECHO "copying selected object files to avoid basename conflicts..."
7949 >          gentop="$output_objdir/${outputname}x"
7950 >          generated="$generated $gentop"
7951 >          func_mkdir_p "$gentop"
7952            save_oldobjs=$oldobjs
7953            oldobjs=
7954            counter=1
7955            for obj in $save_oldobjs
7956            do
7957 <            objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
7957 >            func_basename "$obj"
7958 >            objbase="$func_basename_result"
7959              case " $oldobjs " in
7960              " ") oldobjs=$obj ;;
7961              *[\ /]"$objbase "*)
# Line 5546 | Line 7963 | fi\
7963                  # Make sure we don't pick an alternate name that also
7964                  # overlaps.
7965                  newobj=lt$counter-$objbase
7966 <                counter=`expr $counter + 1`
7966 >                func_arith $counter + 1
7967 >                counter=$func_arith_result
7968                  case " $oldobjs " in
7969                  *[\ /]"$newobj "*) ;;
7970                  *) if test ! -f "$gentop/$newobj"; then break; fi ;;
7971                  esac
7972                done
7973 <              $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5556 <              $run ln "$obj" "$gentop/$newobj" ||
5557 <              $run cp "$obj" "$gentop/$newobj"
7973 >              func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
7974                oldobjs="$oldobjs $gentop/$newobj"
7975                ;;
7976              *) oldobjs="$oldobjs $obj" ;;
7977              esac
7978            done
7979          fi
5564
7980          eval cmds=\"$old_archive_cmds\"
7981  
7982 <        if len=`expr "X$cmds" : ".*"` &&
7983 <             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7982 >        func_len " $cmds"
7983 >        len=$func_len_result
7984 >        if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7985            cmds=$old_archive_cmds
7986          else
7987            # the command line is too long to link in one step, link in parts
7988 <          $echo "using piecewise archive linking..."
7988 >          func_verbose "using piecewise archive linking..."
7989            save_RANLIB=$RANLIB
7990            RANLIB=:
7991            objlist=
7992            concat_cmds=
7993            save_oldobjs=$oldobjs
7994 <
7994 >          oldobjs=
7995            # Is there a better way of finding the last object in the list?
7996            for obj in $save_oldobjs
7997            do
7998              last_oldobj=$obj
7999            done
8000 +          eval test_cmds=\"$old_archive_cmds\"
8001 +          func_len " $test_cmds"
8002 +          len0=$func_len_result
8003 +          len=$len0
8004            for obj in $save_oldobjs
8005            do
8006 <            oldobjs="$objlist $obj"
8007 <            objlist="$objlist $obj"
8008 <            eval test_cmds=\"$old_archive_cmds\"
8009 <            if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
8010 <               test "$len" -le "$max_cmd_len"; then
8006 >            func_len " $obj"
8007 >            func_arith $len + $func_len_result
8008 >            len=$func_arith_result
8009 >            func_append objlist " $obj"
8010 >            if test "$len" -lt "$max_cmd_len"; then
8011                :
8012              else
8013                # the above command should be used before it gets too long
8014                oldobjs=$objlist
8015                if test "$obj" = "$last_oldobj" ; then
8016 <                RANLIB=$save_RANLIB
8016 >                RANLIB=$save_RANLIB
8017                fi
8018                test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8019                eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8020                objlist=
8021 +              len=$len0
8022              fi
8023            done
8024            RANLIB=$save_RANLIB
# Line 5609 | Line 8030 | fi\
8030            fi
8031          fi
8032        fi
8033 <      save_ifs="$IFS"; IFS='~'
5613 <      for cmd in $cmds; do
5614 <        eval cmd=\"$cmd\"
5615 <        IFS="$save_ifs"
5616 <        $show "$cmd"
5617 <        $run eval "$cmd" || exit $?
5618 <      done
5619 <      IFS="$save_ifs"
8033 >      func_execute_cmds "$cmds" 'exit $?'
8034      done
8035  
8036 <    if test -n "$generated"; then
8037 <      $show "${rm}r$generated"
5624 <      $run ${rm}r$generated
5625 <    fi
8036 >    test -n "$generated" && \
8037 >      func_show_eval "${RM}r$generated"
8038  
8039      # Now create the libtool archive.
8040      case $output in
8041      *.la)
8042        old_library=
8043        test "$build_old_libs" = yes && old_library="$libname.$libext"
8044 <      $show "creating $output"
8044 >      func_verbose "creating $output"
8045  
8046        # Preserve any variables that may affect compiler behavior
8047        for var in $variables_saved_for_relink; do
8048          if eval test -z \"\${$var+set}\"; then
8049 <          relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
8049 >          relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8050          elif eval var_value=\$$var; test -z "$var_value"; then
8051            relink_command="$var=; export $var; $relink_command"
8052          else
8053 <          var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
8054 <          relink_command="$var=\"$var_value\"; export $var; $relink_command"
8053 >          func_quote_for_eval "$var_value"
8054 >          relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8055          fi
8056        done
8057        # Quote the link command for shipping.
8058        relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
8059 <      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
8059 >      relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
8060        if test "$hardcode_automatic" = yes ; then
8061          relink_command=
8062        fi
8063  
5652
8064        # Only create the output if not a dry run.
8065 <      if test -z "$run"; then
8065 >      $opt_dry_run || {
8066          for installed in no yes; do
8067            if test "$installed" = yes; then
8068              if test -z "$install_libdir"; then
# Line 5663 | Line 8074 | fi\
8074              for deplib in $dependency_libs; do
8075                case $deplib in
8076                *.la)
8077 <                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
8077 >                func_basename "$deplib"
8078 >                name="$func_basename_result"
8079                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8080 <                if test -z "$libdir"; then
8081 <                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5670 <                  exit $EXIT_FAILURE
5671 <                fi
8080 >                test -z "$libdir" && \
8081 >                  func_fatal_error "\`$deplib' is not a valid libtool archive"
8082                  newdependency_libs="$newdependency_libs $libdir/$name"
8083                  ;;
8084                *) newdependency_libs="$newdependency_libs $deplib" ;;
# Line 5676 | Line 8086 | fi\
8086              done
8087              dependency_libs="$newdependency_libs"
8088              newdlfiles=
8089 +
8090              for lib in $dlfiles; do
8091 <              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
8092 <              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8093 <              if test -z "$libdir"; then
8094 <                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
8095 <                exit $EXIT_FAILURE
8096 <              fi
8097 <              newdlfiles="$newdlfiles $libdir/$name"
8091 >              case $lib in
8092 >              *.la)
8093 >                func_basename "$lib"
8094 >                name="$func_basename_result"
8095 >                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8096 >                test -z "$libdir" && \
8097 >                  func_fatal_error "\`$lib' is not a valid libtool archive"
8098 >                newdlfiles="$newdlfiles $libdir/$name"
8099 >                ;;
8100 >              *) newdlfiles="$newdlfiles $lib" ;;
8101 >              esac
8102              done
8103              dlfiles="$newdlfiles"
8104              newdlprefiles=
8105              for lib in $dlprefiles; do
8106 <              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
8107 <              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8108 <              if test -z "$libdir"; then
8109 <                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
8110 <                exit $EXIT_FAILURE
8111 <              fi
8112 <              newdlprefiles="$newdlprefiles $libdir/$name"
8106 >              case $lib in
8107 >              *.la)
8108 >                # Only pass preopened files to the pseudo-archive (for
8109 >                # eventual linking with the app. that links it) if we
8110 >                # didn't already link the preopened objects directly into
8111 >                # the library:
8112 >                func_basename "$lib"
8113 >                name="$func_basename_result"
8114 >                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8115 >                test -z "$libdir" && \
8116 >                  func_fatal_error "\`$lib' is not a valid libtool archive"
8117 >                newdlprefiles="$newdlprefiles $libdir/$name"
8118 >                ;;
8119 >              esac
8120              done
8121              dlprefiles="$newdlprefiles"
8122            else
# Line 5717 | Line 8139 | fi\
8139              done
8140              dlprefiles="$newdlprefiles"
8141            fi
8142 <          $rm $output
8142 >          $RM $output
8143            # place dlname in correct position for cygwin
8144            tdlname=$dlname
8145            case $host,$output,$installed,$module,$dlname in
8146 <            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
8146 >            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
8147            esac
8148 <          $echo > $output "\
8148 >          $ECHO > $output "\
8149   # $outputname - a libtool library file
8150 < # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
8150 > # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
8151   #
8152   # Please DO NOT delete this file!
8153   # It is necessary for linking the library.
# Line 5739 | Line 8161 | library_names='$library_names'
8161   # The name of the static archive.
8162   old_library='$old_library'
8163  
8164 + # Linker flags that can not go in dependency_libs.
8165 + inherited_linker_flags='$new_inherited_linker_flags'
8166 +
8167   # Libraries that this one depends upon.
8168   dependency_libs='$dependency_libs'
8169  
8170 + # Names of additional weak libraries provided by this library
8171 + weak_library_names='$weak_libs'
8172 +
8173   # Version information for $libname.
8174   current=$current
8175   age=$age
# Line 5760 | Line 8188 | dlpreopen='$dlprefiles'
8188   # Directory that this library needs to be installed in:
8189   libdir='$install_libdir'"
8190            if test "$installed" = no && test "$need_relink" = yes; then
8191 <            $echo >> $output "\
8191 >            $ECHO >> $output "\
8192   relink_command=\"$relink_command\""
8193            fi
8194          done
8195 <      fi
8195 >      }
8196  
8197        # Do a symbolic link so that the libtool archive can be found in
8198        # LD_LIBRARY_PATH before the program is installed.
8199 <      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5772 <      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
8199 >      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
8200        ;;
8201      esac
8202      exit $EXIT_SUCCESS
8203 <    ;;
5777 <
5778 <  # libtool install mode
5779 <  install)
5780 <    modename="$modename: install"
5781 <
5782 <    # There may be an optional sh(1) argument at the beginning of
5783 <    # install_prog (especially on Windows NT).
5784 <    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5785 <       # Allow the use of GNU shtool's install command.
5786 <       $echo "X$nonopt" | grep shtool > /dev/null; then
5787 <      # Aesthetically quote it.
5788 <      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5789 <      case $arg in
5790 <      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5791 <        arg="\"$arg\""
5792 <        ;;
5793 <      esac
5794 <      install_prog="$arg "
5795 <      arg="$1"
5796 <      shift
5797 <    else
5798 <      install_prog=
5799 <      arg=$nonopt
5800 <    fi
5801 <
5802 <    # The real first argument should be the name of the installation program.
5803 <    # Aesthetically quote it.
5804 <    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5805 <    case $arg in
5806 <    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
5807 <      arg="\"$arg\""
5808 <      ;;
5809 <    esac
5810 <    install_prog="$install_prog$arg"
5811 <
5812 <    # We need to accept at least all the BSD install flags.
5813 <    dest=
5814 <    files=
5815 <    opts=
5816 <    prev=
5817 <    install_type=
5818 <    isdir=no
5819 <    stripme=
5820 <    for arg
5821 <    do
5822 <      if test -n "$dest"; then
5823 <        files="$files $dest"
5824 <        dest=$arg
5825 <        continue
5826 <      fi
5827 <
5828 <      case $arg in
5829 <      -d) isdir=yes ;;
5830 <      -f)
5831 <        case " $install_prog " in
5832 <        *[\\\ /]cp\ *) ;;
5833 <        *) prev=$arg ;;
5834 <        esac
5835 <        ;;
5836 <      -g | -m | -o) prev=$arg ;;
5837 <      -s)
5838 <        stripme=" -s"
5839 <        continue
5840 <        ;;
5841 <      -*)
5842 <        ;;
5843 <      *)
5844 <        # If the previous option needed an argument, then skip it.
5845 <        if test -n "$prev"; then
5846 <          prev=
5847 <        else
5848 <          dest=$arg
5849 <          continue
5850 <        fi
5851 <        ;;
5852 <      esac
5853 <
5854 <      # Aesthetically quote the argument.
5855 <      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5856 <      case $arg in
5857 <      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5858 <        arg="\"$arg\""
5859 <        ;;
5860 <      esac
5861 <      install_prog="$install_prog $arg"
5862 <    done
5863 <
5864 <    if test -z "$install_prog"; then
5865 <      $echo "$modename: you must specify an install program" 1>&2
5866 <      $echo "$help" 1>&2
5867 <      exit $EXIT_FAILURE
5868 <    fi
5869 <
5870 <    if test -n "$prev"; then
5871 <      $echo "$modename: the \`$prev' option requires an argument" 1>&2
5872 <      $echo "$help" 1>&2
5873 <      exit $EXIT_FAILURE
5874 <    fi
5875 <
5876 <    if test -z "$files"; then
5877 <      if test -z "$dest"; then
5878 <        $echo "$modename: no file or destination specified" 1>&2
5879 <      else
5880 <        $echo "$modename: you must specify a destination" 1>&2
5881 <      fi
5882 <      $echo "$help" 1>&2
5883 <      exit $EXIT_FAILURE
5884 <    fi
5885 <
5886 <    # Strip any trailing slash from the destination.
5887 <    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5888 <
5889 <    # Check to see that the destination is a directory.
5890 <    test -d "$dest" && isdir=yes
5891 <    if test "$isdir" = yes; then
5892 <      destdir="$dest"
5893 <      destname=
5894 <    else
5895 <      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5896 <      test "X$destdir" = "X$dest" && destdir=.
5897 <      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5898 <
5899 <      # Not a directory, so check to see that there is only one file specified.
5900 <      set dummy $files
5901 <      if test "$#" -gt 2; then
5902 <        $echo "$modename: \`$dest' is not a directory" 1>&2
5903 <        $echo "$help" 1>&2
5904 <        exit $EXIT_FAILURE
5905 <      fi
5906 <    fi
5907 <    case $destdir in
5908 <    [\\/]* | [A-Za-z]:[\\/]*) ;;
5909 <    *)
5910 <      for file in $files; do
5911 <        case $file in
5912 <        *.lo) ;;
5913 <        *)
5914 <          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5915 <          $echo "$help" 1>&2
5916 <          exit $EXIT_FAILURE
5917 <          ;;
5918 <        esac
5919 <      done
5920 <      ;;
5921 <    esac
5922 <
5923 <    # This variable tells wrapper scripts just to set variables rather
5924 <    # than running their programs.
5925 <    libtool_install_magic="$magic"
5926 <
5927 <    staticlibs=
5928 <    future_libdirs=
5929 <    current_libdirs=
5930 <    for file in $files; do
5931 <
5932 <      # Do each installation.
5933 <      case $file in
5934 <      *.$libext)
5935 <        # Do the static libraries later.
5936 <        staticlibs="$staticlibs $file"
5937 <        ;;
5938 <
5939 <      *.la)
5940 <        # Check to see that this really is a libtool archive.
5941 <        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5942 <        else
5943 <          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5944 <          $echo "$help" 1>&2
5945 <          exit $EXIT_FAILURE
5946 <        fi
5947 <
5948 <        library_names=
5949 <        old_library=
5950 <        relink_command=
5951 <        # If there is no directory component, then add one.
5952 <        case $file in
5953 <        */* | *\\*) . $file ;;
5954 <        *) . ./$file ;;
5955 <        esac
5956 <
5957 <        # Add the libdir to current_libdirs if it is the destination.
5958 <        if test "X$destdir" = "X$libdir"; then
5959 <          case "$current_libdirs " in
5960 <          *" $libdir "*) ;;
5961 <          *) current_libdirs="$current_libdirs $libdir" ;;
5962 <          esac
5963 <        else
5964 <          # Note the libdir as a future libdir.
5965 <          case "$future_libdirs " in
5966 <          *" $libdir "*) ;;
5967 <          *) future_libdirs="$future_libdirs $libdir" ;;
5968 <          esac
5969 <        fi
5970 <
5971 <        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5972 <        test "X$dir" = "X$file/" && dir=
5973 <        dir="$dir$objdir"
5974 <
5975 <        if test -n "$relink_command"; then
5976 <          # Determine the prefix the user has applied to our future dir.
5977 <          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5978 <
5979 <          # Don't allow the user to place us outside of our expected
5980 <          # location b/c this prevents finding dependent libraries that
5981 <          # are installed to the same prefix.
5982 <          # At present, this check doesn't affect windows .dll's that
5983 <          # are installed into $libdir/../bin (currently, that works fine)
5984 <          # but it's something to keep an eye on.
5985 <          if test "$inst_prefix_dir" = "$destdir"; then
5986 <            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5987 <            exit $EXIT_FAILURE
5988 <          fi
5989 <
5990 <          if test -n "$inst_prefix_dir"; then
5991 <            # Stick the inst_prefix_dir data into the link command.
5992 <            relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
5993 <          else
5994 <            relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
5995 <          fi
5996 <
5997 <          $echo "$modename: warning: relinking \`$file'" 1>&2
5998 <          $show "$relink_command"
5999 <          if $run eval "$relink_command"; then :
6000 <          else
6001 <            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6002 <            exit $EXIT_FAILURE
6003 <          fi
6004 <        fi
6005 <
6006 <        # See the names of the shared library.
6007 <        set dummy $library_names
6008 <        if test -n "$2"; then
6009 <          realname="$2"
6010 <          shift
6011 <          shift
6012 <
6013 <          srcname="$realname"
6014 <          test -n "$relink_command" && srcname="$realname"T
6015 <
6016 <          # Install the shared library and build the symlinks.
6017 <          $show "$install_prog $dir/$srcname $destdir/$realname"
6018 <          $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6019 <          if test -n "$stripme" && test -n "$striplib"; then
6020 <            $show "$striplib $destdir/$realname"
6021 <            $run eval "$striplib $destdir/$realname" || exit $?
6022 <          fi
6023 <
6024 <          if test "$#" -gt 0; then
6025 <            # Delete the old symlinks, and create new ones.
6026 <            # Try `ln -sf' first, because the `ln' binary might depend on
6027 <            # the symlink we replace!  Solaris /bin/ln does not understand -f,
6028 <            # so we also need to try rm && ln -s.
6029 <            for linkname
6030 <            do
6031 <              if test "$linkname" != "$realname"; then
6032 <                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6033 <                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6034 <              fi
6035 <            done
6036 <          fi
6037 <
6038 <          # Do each command in the postinstall commands.
6039 <          lib="$destdir/$realname"
6040 <          cmds=$postinstall_cmds
6041 <          save_ifs="$IFS"; IFS='~'
6042 <          for cmd in $cmds; do
6043 <            IFS="$save_ifs"
6044 <            eval cmd=\"$cmd\"
6045 <            $show "$cmd"
6046 <            $run eval "$cmd" || {
6047 <              lt_exit=$?
6048 <
6049 <              # Restore the uninstalled library and exit
6050 <              if test "$mode" = relink; then
6051 <                $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6052 <              fi
6053 <
6054 <              exit $lt_exit
6055 <            }
6056 <          done
6057 <          IFS="$save_ifs"
6058 <        fi
6059 <
6060 <        # Install the pseudo-library for information purposes.
6061 <        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6062 <        instname="$dir/$name"i
6063 <        $show "$install_prog $instname $destdir/$name"
6064 <        $run eval "$install_prog $instname $destdir/$name" || exit $?
6065 <
6066 <        # Maybe install the static library, too.
6067 <        test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6068 <        ;;
6069 <
6070 <      *.lo)
6071 <        # Install (i.e. copy) a libtool object.
6072 <
6073 <        # Figure out destination file name, if it wasn't already specified.
6074 <        if test -n "$destname"; then
6075 <          destfile="$destdir/$destname"
6076 <        else
6077 <          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6078 <          destfile="$destdir/$destfile"
6079 <        fi
6080 <
6081 <        # Deduce the name of the destination old-style object file.
6082 <        case $destfile in
6083 <        *.lo)
6084 <          staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6085 <          ;;
6086 <        *.$objext)
6087 <          staticdest="$destfile"
6088 <          destfile=
6089 <          ;;
6090 <        *)
6091 <          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6092 <          $echo "$help" 1>&2
6093 <          exit $EXIT_FAILURE
6094 <          ;;
6095 <        esac
6096 <
6097 <        # Install the libtool object if requested.
6098 <        if test -n "$destfile"; then
6099 <          $show "$install_prog $file $destfile"
6100 <          $run eval "$install_prog $file $destfile" || exit $?
6101 <        fi
6102 <
6103 <        # Install the old object if enabled.
6104 <        if test "$build_old_libs" = yes; then
6105 <          # Deduce the name of the old-style object file.
6106 <          staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6107 <
6108 <          $show "$install_prog $staticobj $staticdest"
6109 <          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6110 <        fi
6111 <        exit $EXIT_SUCCESS
6112 <        ;;
6113 <
6114 <      *)
6115 <        # Figure out destination file name, if it wasn't already specified.
6116 <        if test -n "$destname"; then
6117 <          destfile="$destdir/$destname"
6118 <        else
6119 <          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6120 <          destfile="$destdir/$destfile"
6121 <        fi
6122 <
6123 <        # If the file is missing, and there is a .exe on the end, strip it
6124 <        # because it is most likely a libtool script we actually want to
6125 <        # install
6126 <        stripped_ext=""
6127 <        case $file in
6128 <          *.exe)
6129 <            if test ! -f "$file"; then
6130 <              file=`$echo $file|${SED} 's,.exe$,,'`
6131 <              stripped_ext=".exe"
6132 <            fi
6133 <            ;;
6134 <        esac
6135 <
6136 <        # Do a test to see if this is really a libtool program.
6137 <        case $host in
6138 <        *cygwin*|*mingw*)
6139 <            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6140 <            ;;
6141 <        *)
6142 <            wrapper=$file
6143 <            ;;
6144 <        esac
6145 <        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6146 <          notinst_deplibs=
6147 <          relink_command=
6148 <
6149 <          # Note that it is not necessary on cygwin/mingw to append a dot to
6150 <          # foo even if both foo and FILE.exe exist: automatic-append-.exe
6151 <          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
6152 <          # `FILE.' does not work on cygwin managed mounts.
6153 <          #
6154 <          # If there is no directory component, then add one.
6155 <          case $wrapper in
6156 <          */* | *\\*) . ${wrapper} ;;
6157 <          *) . ./${wrapper} ;;
6158 <          esac
6159 <
6160 <          # Check the variables that should have been set.
6161 <          if test -z "$notinst_deplibs"; then
6162 <            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6163 <            exit $EXIT_FAILURE
6164 <          fi
6165 <
6166 <          finalize=yes
6167 <          for lib in $notinst_deplibs; do
6168 <            # Check to see that each library is installed.
6169 <            libdir=
6170 <            if test -f "$lib"; then
6171 <              # If there is no directory component, then add one.
6172 <              case $lib in
6173 <              */* | *\\*) . $lib ;;
6174 <              *) . ./$lib ;;
6175 <              esac
6176 <            fi
6177 <            libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6178 <            if test -n "$libdir" && test ! -f "$libfile"; then
6179 <              $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6180 <              finalize=no
6181 <            fi
6182 <          done
6183 <
6184 <          relink_command=
6185 <          # Note that it is not necessary on cygwin/mingw to append a dot to
6186 <          # foo even if both foo and FILE.exe exist: automatic-append-.exe
6187 <          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
6188 <          # `FILE.' does not work on cygwin managed mounts.
6189 <          #
6190 <          # If there is no directory component, then add one.
6191 <          case $wrapper in
6192 <          */* | *\\*) . ${wrapper} ;;
6193 <          *) . ./${wrapper} ;;
6194 <          esac
6195 <
6196 <          outputname=
6197 <          if test "$fast_install" = no && test -n "$relink_command"; then
6198 <            if test "$finalize" = yes && test -z "$run"; then
6199 <              tmpdir=`func_mktempdir`
6200 <              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6201 <              outputname="$tmpdir/$file"
6202 <              # Replace the output file specification.
6203 <              relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6204 <
6205 <              $show "$relink_command"
6206 <              if $run eval "$relink_command"; then :
6207 <              else
6208 <                $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6209 <                ${rm}r "$tmpdir"
6210 <                continue
6211 <              fi
6212 <              file="$outputname"
6213 <            else
6214 <              $echo "$modename: warning: cannot relink \`$file'" 1>&2
6215 <            fi
6216 <          else
6217 <            # Install the binary that we compiled earlier.
6218 <            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6219 <          fi
6220 <        fi
6221 <
6222 <        # remove .exe since cygwin /usr/bin/install will append another
6223 <        # one anyway
6224 <        case $install_prog,$host in
6225 <        */usr/bin/install*,*cygwin*)
6226 <          case $file:$destfile in
6227 <          *.exe:*.exe)
6228 <            # this is ok
6229 <            ;;
6230 <          *.exe:*)
6231 <            destfile=$destfile.exe
6232 <            ;;
6233 <          *:*.exe)
6234 <            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6235 <            ;;
6236 <          esac
6237 <          ;;
6238 <        esac
6239 <        $show "$install_prog$stripme $file $destfile"
6240 <        $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6241 <        test -n "$outputname" && ${rm}r "$tmpdir"
6242 <        ;;
6243 <      esac
6244 <    done
6245 <
6246 <    for file in $staticlibs; do
6247 <      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6248 <
6249 <      # Set up the ranlib parameters.
6250 <      oldlib="$destdir/$name"
6251 <
6252 <      $show "$install_prog $file $oldlib"
6253 <      $run eval "$install_prog \$file \$oldlib" || exit $?
6254 <
6255 <      if test -n "$stripme" && test -n "$old_striplib"; then
6256 <        $show "$old_striplib $oldlib"
6257 <        $run eval "$old_striplib $oldlib" || exit $?
6258 <      fi
6259 <
6260 <      # Do each command in the postinstall commands.
6261 <      cmds=$old_postinstall_cmds
6262 <      save_ifs="$IFS"; IFS='~'
6263 <      for cmd in $cmds; do
6264 <        IFS="$save_ifs"
6265 <        eval cmd=\"$cmd\"
6266 <        $show "$cmd"
6267 <        $run eval "$cmd" || exit $?
6268 <      done
6269 <      IFS="$save_ifs"
6270 <    done
6271 <
6272 <    if test -n "$future_libdirs"; then
6273 <      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6274 <    fi
6275 <
6276 <    if test -n "$current_libdirs"; then
6277 <      # Maybe just do a dry run.
6278 <      test -n "$run" && current_libdirs=" -n$current_libdirs"
6279 <      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6280 <    else
6281 <      exit $EXIT_SUCCESS
6282 <    fi
6283 <    ;;
6284 <
6285 <  # libtool finish mode
6286 <  finish)
6287 <    modename="$modename: finish"
6288 <    libdirs="$nonopt"
6289 <    admincmds=
6290 <
6291 <    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6292 <      for dir
6293 <      do
6294 <        libdirs="$libdirs $dir"
6295 <      done
6296 <
6297 <      for libdir in $libdirs; do
6298 <        if test -n "$finish_cmds"; then
6299 <          # Do each command in the finish commands.
6300 <          cmds=$finish_cmds
6301 <          save_ifs="$IFS"; IFS='~'
6302 <          for cmd in $cmds; do
6303 <            IFS="$save_ifs"
6304 <            eval cmd=\"$cmd\"
6305 <            $show "$cmd"
6306 <            $run eval "$cmd" || admincmds="$admincmds
6307 <       $cmd"
6308 <          done
6309 <          IFS="$save_ifs"
6310 <        fi
6311 <        if test -n "$finish_eval"; then
6312 <          # Do the single finish_eval.
6313 <          eval cmds=\"$finish_eval\"
6314 <          $run eval "$cmds" || admincmds="$admincmds
6315 <       $cmds"
6316 <        fi
6317 <      done
6318 <    fi
6319 <
6320 <    # Exit here if they wanted silent mode.
6321 <    test "$show" = : && exit $EXIT_SUCCESS
6322 <
6323 <    $echo "X----------------------------------------------------------------------" | $Xsed
6324 <    $echo "Libraries have been installed in:"
6325 <    for libdir in $libdirs; do
6326 <      $echo "   $libdir"
6327 <    done
6328 <    $echo
6329 <    $echo "If you ever happen to want to link against installed libraries"
6330 <    $echo "in a given directory, LIBDIR, you must either use libtool, and"
6331 <    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6332 <    $echo "flag during linking and do at least one of the following:"
6333 <    if test -n "$shlibpath_var"; then
6334 <      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
6335 <      $echo "     during execution"
6336 <    fi
6337 <    if test -n "$runpath_var"; then
6338 <      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
6339 <      $echo "     during linking"
6340 <    fi
6341 <    if test -n "$hardcode_libdir_flag_spec"; then
6342 <      libdir=LIBDIR
6343 <      eval flag=\"$hardcode_libdir_flag_spec\"
6344 <
6345 <      $echo "   - use the \`$flag' linker flag"
6346 <    fi
6347 <    if test -n "$admincmds"; then
6348 <      $echo "   - have your system administrator run these commands:$admincmds"
6349 <    fi
6350 <    if test -f /etc/ld.so.conf; then
6351 <      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6352 <    fi
6353 <    $echo
6354 <    $echo "See any operating system documentation about shared libraries for"
6355 <    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6356 <    $echo "X----------------------------------------------------------------------" | $Xsed
6357 <    exit $EXIT_SUCCESS
6358 <    ;;
6359 <
6360 <  # libtool execute mode
6361 <  execute)
6362 <    modename="$modename: execute"
6363 <
6364 <    # The first argument is the command name.
6365 <    cmd="$nonopt"
6366 <    if test -z "$cmd"; then
6367 <      $echo "$modename: you must specify a COMMAND" 1>&2
6368 <      $echo "$help"
6369 <      exit $EXIT_FAILURE
6370 <    fi
6371 <
6372 <    # Handle -dlopen flags immediately.
6373 <    for file in $execute_dlfiles; do
6374 <      if test ! -f "$file"; then
6375 <        $echo "$modename: \`$file' is not a file" 1>&2
6376 <        $echo "$help" 1>&2
6377 <        exit $EXIT_FAILURE
6378 <      fi
6379 <
6380 <      dir=
6381 <      case $file in
6382 <      *.la)
6383 <        # Check to see that this really is a libtool archive.
6384 <        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6385 <        else
6386 <          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6387 <          $echo "$help" 1>&2
6388 <          exit $EXIT_FAILURE
6389 <        fi
6390 <
6391 <        # Read the libtool library.
6392 <        dlname=
6393 <        library_names=
6394 <
6395 <        # If there is no directory component, then add one.
6396 <        case $file in
6397 <        */* | *\\*) . $file ;;
6398 <        *) . ./$file ;;
6399 <        esac
6400 <
6401 <        # Skip this library if it cannot be dlopened.
6402 <        if test -z "$dlname"; then
6403 <          # Warn if it was a shared library.
6404 <          test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6405 <          continue
6406 <        fi
6407 <
6408 <        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6409 <        test "X$dir" = "X$file" && dir=.
6410 <
6411 <        if test -f "$dir/$objdir/$dlname"; then
6412 <          dir="$dir/$objdir"
6413 <        else
6414 <          if test ! -f "$dir/$dlname"; then
6415 <            $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6416 <            exit $EXIT_FAILURE
6417 <          fi
6418 <        fi
6419 <        ;;
6420 <
6421 <      *.lo)
6422 <        # Just add the directory containing the .lo file.
6423 <        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6424 <        test "X$dir" = "X$file" && dir=.
6425 <        ;;
6426 <
6427 <      *)
6428 <        $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6429 <        continue
6430 <        ;;
6431 <      esac
6432 <
6433 <      # Get the absolute pathname.
6434 <      absdir=`cd "$dir" && pwd`
6435 <      test -n "$absdir" && dir="$absdir"
6436 <
6437 <      # Now add the directory to shlibpath_var.
6438 <      if eval "test -z \"\$$shlibpath_var\""; then
6439 <        eval "$shlibpath_var=\"\$dir\""
6440 <      else
6441 <        eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6442 <      fi
6443 <    done
6444 <
6445 <    # This variable tells wrapper scripts just to set shlibpath_var
6446 <    # rather than running their programs.
6447 <    libtool_execute_magic="$magic"
6448 <
6449 <    # Check if any of the arguments is a wrapper script.
6450 <    args=
6451 <    for file
6452 <    do
6453 <      case $file in
6454 <      -*) ;;
6455 <      *)
6456 <        # Do a test to see if this is really a libtool program.
6457 <        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6458 <          # If there is no directory component, then add one.
6459 <          case $file in
6460 <          */* | *\\*) . $file ;;
6461 <          *) . ./$file ;;
6462 <          esac
6463 <
6464 <          # Transform arg to wrapped name.
6465 <          file="$progdir/$program"
6466 <        fi
6467 <        ;;
6468 <      esac
6469 <      # Quote arguments (to preserve shell metacharacters).
6470 <      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6471 <      args="$args \"$file\""
6472 <    done
8203 > }
8204  
8205 <    if test -z "$run"; then
8206 <      if test -n "$shlibpath_var"; then
6476 <        # Export the shlibpath_var.
6477 <        eval "export $shlibpath_var"
6478 <      fi
8205 > { test "$mode" = link || test "$mode" = relink; } &&
8206 >    func_mode_link ${1+"$@"}
8207  
6480      # Restore saved environment variables
6481      for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6482      do
6483        eval "if test \"\${save_$lt_var+set}\" = set; then
6484                $lt_var=\$save_$lt_var; export $lt_var
6485              fi"
6486      done
8208  
8209 <      # Now prepare to actually exec the command.
8210 <      exec_cmd="\$cmd$args"
8211 <    else
8212 <      # Display what would be done.
8213 <      if test -n "$shlibpath_var"; then
6493 <        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6494 <        $echo "export $shlibpath_var"
6495 <      fi
6496 <      $echo "$cmd$args"
6497 <      exit $EXIT_SUCCESS
6498 <    fi
6499 <    ;;
6500 <
6501 <  # libtool clean and uninstall mode
6502 <  clean | uninstall)
6503 <    modename="$modename: $mode"
6504 <    rm="$nonopt"
8209 > # func_mode_uninstall arg...
8210 > func_mode_uninstall ()
8211 > {
8212 >    $opt_debug
8213 >    RM="$nonopt"
8214      files=
8215      rmforce=
8216      exit_status=0
# Line 6513 | Line 8222 | relink_command=\"$relink_command\""
8222      for arg
8223      do
8224        case $arg in
8225 <      -f) rm="$rm $arg"; rmforce=yes ;;
8226 <      -*) rm="$rm $arg" ;;
8225 >      -f) RM="$RM $arg"; rmforce=yes ;;
8226 >      -*) RM="$RM $arg" ;;
8227        *) files="$files $arg" ;;
8228        esac
8229      done
8230  
8231 <    if test -z "$rm"; then
8232 <      $echo "$modename: you must specify an RM program" 1>&2
6524 <      $echo "$help" 1>&2
6525 <      exit $EXIT_FAILURE
6526 <    fi
8231 >    test -z "$RM" && \
8232 >      func_fatal_help "you must specify an RM program"
8233  
8234      rmdirs=
8235  
8236      origobjdir="$objdir"
8237      for file in $files; do
8238 <      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
8239 <      if test "X$dir" = "X$file"; then
8240 <        dir=.
8238 >      func_dirname "$file" "" "."
8239 >      dir="$func_dirname_result"
8240 >      if test "X$dir" = X.; then
8241          objdir="$origobjdir"
8242        else
8243          objdir="$dir/$origobjdir"
8244        fi
8245 <      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
8245 >      func_basename "$file"
8246 >      name="$func_basename_result"
8247        test "$mode" = uninstall && objdir="$dir"
8248  
8249        # Remember objdir for removal later, being careful to avoid duplicates
# Line 6548 | Line 8255 | relink_command=\"$relink_command\""
8255        fi
8256  
8257        # Don't error if the file doesn't exist and rm -f was used.
8258 <      if (test -L "$file") >/dev/null 2>&1 \
8259 <        || (test -h "$file") >/dev/null 2>&1 \
8260 <        || test -f "$file"; then
8258 >      if { test -L "$file"; } >/dev/null 2>&1 ||
8259 >         { test -h "$file"; } >/dev/null 2>&1 ||
8260 >         test -f "$file"; then
8261          :
8262        elif test -d "$file"; then
8263          exit_status=1
# Line 6564 | Line 8271 | relink_command=\"$relink_command\""
8271        case $name in
8272        *.la)
8273          # Possibly a libtool archive, so verify it.
8274 <        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
8275 <          . $dir/$name
8274 >        if func_lalib_p "$file"; then
8275 >          func_source $dir/$name
8276  
8277            # Delete the libtool libraries and symlinks.
8278            for n in $library_names; do
# Line 6580 | Line 8287 | relink_command=\"$relink_command\""
8287              *" $dlname "*) ;;
8288              *) rmfiles="$rmfiles $objdir/$dlname" ;;
8289              esac
8290 <             test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
8290 >            test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
8291              ;;
8292            uninstall)
8293              if test -n "$library_names"; then
8294                # Do each command in the postuninstall commands.
8295 <              cmds=$postuninstall_cmds
6589 <              save_ifs="$IFS"; IFS='~'
6590 <              for cmd in $cmds; do
6591 <                IFS="$save_ifs"
6592 <                eval cmd=\"$cmd\"
6593 <                $show "$cmd"
6594 <                $run eval "$cmd"
6595 <                if test "$?" -ne 0 && test "$rmforce" != yes; then
6596 <                  exit_status=1
6597 <                fi
6598 <              done
6599 <              IFS="$save_ifs"
8295 >              func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8296              fi
8297  
8298              if test -n "$old_library"; then
8299                # Do each command in the old_postuninstall commands.
8300 <              cmds=$old_postuninstall_cmds
6605 <              save_ifs="$IFS"; IFS='~'
6606 <              for cmd in $cmds; do
6607 <                IFS="$save_ifs"
6608 <                eval cmd=\"$cmd\"
6609 <                $show "$cmd"
6610 <                $run eval "$cmd"
6611 <                if test "$?" -ne 0 && test "$rmforce" != yes; then
6612 <                  exit_status=1
6613 <                fi
6614 <              done
6615 <              IFS="$save_ifs"
8300 >              func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
8301              fi
8302              # FIXME: should reinstall the best remaining shared library.
8303              ;;
# Line 6622 | Line 8307 | relink_command=\"$relink_command\""
8307  
8308        *.lo)
8309          # Possibly a libtool object, so verify it.
8310 <        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
8310 >        if func_lalib_p "$file"; then
8311  
8312            # Read the .lo file
8313 <          . $dir/$name
8313 >          func_source $dir/$name
8314  
8315            # Add PIC object to the list of files to remove.
8316 <          if test -n "$pic_object" \
8317 <             && test "$pic_object" != none; then
8316 >          if test -n "$pic_object" &&
8317 >             test "$pic_object" != none; then
8318              rmfiles="$rmfiles $dir/$pic_object"
8319            fi
8320  
8321            # Add non-PIC object to the list of files to remove.
8322 <          if test -n "$non_pic_object" \
8323 <             && test "$non_pic_object" != none; then
8322 >          if test -n "$non_pic_object" &&
8323 >             test "$non_pic_object" != none; then
8324              rmfiles="$rmfiles $dir/$non_pic_object"
8325            fi
8326          fi
# Line 6646 | Line 8331 | relink_command=\"$relink_command\""
8331            noexename=$name
8332            case $file in
8333            *.exe)
8334 <            file=`$echo $file|${SED} 's,.exe$,,'`
8335 <            noexename=`$echo $name|${SED} 's,.exe$,,'`
8334 >            func_stripname '' '.exe' "$file"
8335 >            file=$func_stripname_result
8336 >            func_stripname '' '.exe' "$name"
8337 >            noexename=$func_stripname_result
8338              # $file with .exe has already been added to rmfiles,
8339              # add $file without .exe
8340              rmfiles="$rmfiles $file"
8341              ;;
8342            esac
8343            # Do a test to see if this is a libtool program.
8344 <          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
8345 <            relink_command=
8346 <            . $dir/$noexename
8344 >          if func_ltwrapper_p "$file"; then
8345 >            if func_ltwrapper_executable_p "$file"; then
8346 >              func_ltwrapper_scriptname "$file"
8347 >              relink_command=
8348 >              func_source $func_ltwrapper_scriptname_result
8349 >              rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
8350 >            else
8351 >              relink_command=
8352 >              func_source $dir/$noexename
8353 >            fi
8354  
8355              # note $name still contains .exe if it was in $file originally
8356              # as does the version of $file that was added into $rmfiles
# Line 6671 | Line 8365 | relink_command=\"$relink_command\""
8365          fi
8366          ;;
8367        esac
8368 <      $show "$rm $rmfiles"
6675 <      $run $rm $rmfiles || exit_status=1
8368 >      func_show_eval "$RM $rmfiles" 'exit_status=1'
8369      done
8370      objdir="$origobjdir"
8371  
8372      # Try to remove the ${objdir}s in the directories where we deleted files
8373      for dir in $rmdirs; do
8374        if test -d "$dir"; then
8375 <        $show "rmdir $dir"
6683 <        $run rmdir $dir >/dev/null 2>&1
8375 >        func_show_eval "rmdir $dir >/dev/null 2>&1"
8376        fi
8377      done
8378  
8379      exit $exit_status
8380 <    ;;
8380 > }
8381  
8382 <  "")
8383 <    $echo "$modename: you must specify a MODE" 1>&2
6692 <    $echo "$generic_help" 1>&2
6693 <    exit $EXIT_FAILURE
6694 <    ;;
6695 <  esac
8382 > { test "$mode" = uninstall || test "$mode" = clean; } &&
8383 >    func_mode_uninstall ${1+"$@"}
8384  
8385 <  if test -z "$exec_cmd"; then
8386 <    $echo "$modename: invalid operation mode \`$mode'" 1>&2
8387 <    $echo "$generic_help" 1>&2
8388 <    exit $EXIT_FAILURE
8389 <  fi
8390 < fi # test -z "$show_help"
8385 > test -z "$mode" && {
8386 >  help="$generic_help"
8387 >  func_fatal_help "you must specify a MODE"
8388 > }
8389 >
8390 > test -z "$exec_cmd" && \
8391 >  func_fatal_help "invalid operation mode \`$mode'"
8392  
8393   if test -n "$exec_cmd"; then
8394 <  eval exec $exec_cmd
8394 >  eval exec "$exec_cmd"
8395    exit $EXIT_FAILURE
8396   fi
8397  
8398 < # We need to display help for each of the modes.
6710 < case $mode in
6711 < "") $echo \
6712 < "Usage: $modename [OPTION]... [MODE-ARG]...
6713 <
6714 < Provide generalized library-building support services.
6715 <
6716 <    --config          show all configuration variables
6717 <    --debug           enable verbose shell tracing
6718 < -n, --dry-run         display commands without modifying any files
6719 <    --features        display basic configuration information and exit
6720 <    --finish          same as \`--mode=finish'
6721 <    --help            display this help message and exit
6722 <    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
6723 <    --quiet           same as \`--silent'
6724 <    --silent          don't print informational messages
6725 <    --tag=TAG         use configuration variables from tag TAG
6726 <    --version         print version information
6727 <
6728 < MODE must be one of the following:
6729 <
6730 <      clean           remove files from the build directory
6731 <      compile         compile a source file into a libtool object
6732 <      execute         automatically set library path, then run a program
6733 <      finish          complete the installation of libtool libraries
6734 <      install         install libraries or executables
6735 <      link            create a library or an executable
6736 <      uninstall       remove libraries from an installed directory
6737 <
6738 < MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
6739 < a more detailed description of MODE.
6740 <
6741 < Report bugs to <bug-libtool@gnu.org>."
6742 <  exit $EXIT_SUCCESS
6743 <  ;;
6744 <
6745 < clean)
6746 <  $echo \
6747 < "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6748 <
6749 < Remove files from the build directory.
6750 <
6751 < RM is the name of the program to use to delete files associated with each FILE
6752 < (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6753 < to RM.
6754 <
6755 < If FILE is a libtool library, object or program, all the files associated
6756 < with it are deleted. Otherwise, only FILE itself is deleted using RM."
6757 <  ;;
6758 <
6759 < compile)
6760 <  $echo \
6761 < "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6762 <
6763 < Compile a source file into a libtool library object.
6764 <
6765 < This mode accepts the following additional options:
6766 <
6767 <  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
6768 <  -prefer-pic       try to building PIC objects only
6769 <  -prefer-non-pic   try to building non-PIC objects only
6770 <  -static           always build a \`.o' file suitable for static linking
6771 <
6772 < COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6773 < from the given SOURCEFILE.
6774 <
6775 < The output file name is determined by removing the directory component from
6776 < SOURCEFILE, then substituting the C source code suffix \`.c' with the
6777 < library object suffix, \`.lo'."
6778 <  ;;
6779 <
6780 < execute)
6781 <  $echo \
6782 < "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6783 <
6784 < Automatically set library path, then run a program.
6785 <
6786 < This mode accepts the following additional options:
6787 <
6788 <  -dlopen FILE      add the directory containing FILE to the library path
6789 <
6790 < This mode sets the library path environment variable according to \`-dlopen'
6791 < flags.
6792 <
6793 < If any of the ARGS are libtool executable wrappers, then they are translated
6794 < into their corresponding uninstalled binary, and any of their required library
6795 < directories are added to the library path.
6796 <
6797 < Then, COMMAND is executed, with ARGS as arguments."
6798 <  ;;
6799 <
6800 < finish)
6801 <  $echo \
6802 < "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6803 <
6804 < Complete the installation of libtool libraries.
6805 <
6806 < Each LIBDIR is a directory that contains libtool libraries.
6807 <
6808 < The commands that this mode executes may require superuser privileges.  Use
6809 < the \`--dry-run' option if you just want to see what would be executed."
6810 <  ;;
6811 <
6812 < install)
6813 <  $echo \
6814 < "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6815 <
6816 < Install executables or libraries.
6817 <
6818 < INSTALL-COMMAND is the installation command.  The first component should be
6819 < either the \`install' or \`cp' program.
6820 <
6821 < The rest of the components are interpreted as arguments to that command (only
6822 < BSD-compatible install options are recognized)."
6823 <  ;;
6824 <
6825 < link)
6826 <  $echo \
6827 < "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6828 <
6829 < Link object files or libraries together to form another library, or to
6830 < create an executable program.
6831 <
6832 < LINK-COMMAND is a command using the C compiler that you would use to create
6833 < a program from several object files.
6834 <
6835 < The following components of LINK-COMMAND are treated specially:
6836 <
6837 <  -all-static       do not do any dynamic linking at all
6838 <  -avoid-version    do not add a version suffix if possible
6839 <  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
6840 <  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
6841 <  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6842 <  -export-symbols SYMFILE
6843 <                    try to export only the symbols listed in SYMFILE
6844 <  -export-symbols-regex REGEX
6845 <                    try to export only the symbols matching REGEX
6846 <  -LLIBDIR          search LIBDIR for required installed libraries
6847 <  -lNAME            OUTPUT-FILE requires the installed library libNAME
6848 <  -module           build a library that can dlopened
6849 <  -no-fast-install  disable the fast-install mode
6850 <  -no-install       link a not-installable executable
6851 <  -no-undefined     declare that a library does not refer to external symbols
6852 <  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
6853 <  -objectlist FILE  Use a list of object files found in FILE to specify objects
6854 <  -precious-files-regex REGEX
6855 <                    don't remove output files matching REGEX
6856 <  -release RELEASE  specify package release information
6857 <  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
6858 <  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
6859 <  -static           do not do any dynamic linking of uninstalled libtool libraries
6860 <  -static-libtool-libs
6861 <                    do not do any dynamic linking of libtool libraries
6862 <  -version-info CURRENT[:REVISION[:AGE]]
6863 <                    specify library version info [each variable defaults to 0]
6864 <
6865 < All other options (arguments beginning with \`-') are ignored.
8398 > exit $exit_status
8399  
6867 Every other argument is treated as a filename.  Files ending in \`.la' are
6868 treated as uninstalled libtool libraries, other files are standard or library
6869 object files.
6870
6871 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6872 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6873 required, except when creating a convenience library.
6874
6875 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6876 using \`ar' and \`ranlib', or on Windows using \`lib'.
6877
6878 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6879 is created, otherwise an executable program is created."
6880  ;;
6881
6882 uninstall)
6883  $echo \
6884 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6885
6886 Remove libraries from an installation directory.
6887
6888 RM is the name of the program to use to delete files associated with each FILE
6889 (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6890 to RM.
6891
6892 If FILE is a libtool library, all the files associated with it are deleted.
6893 Otherwise, only FILE itself is deleted using RM."
6894  ;;
6895
6896 *)
6897  $echo "$modename: invalid operation mode \`$mode'" 1>&2
6898  $echo "$help" 1>&2
6899  exit $EXIT_FAILURE
6900  ;;
6901 esac
6902
6903 $echo
6904 $echo "Try \`$modename --help' for more information about other modes."
6905
6906 exit $?
8400  
8401   # The TAGs below are defined such that we never get into a situation
8402   # in which we disable both kinds of libraries.  Given conflicting
# Line 6917 | Line 8410 | exit $?
8410   # configuration.  But we'll never go from static-only to shared-only.
8411  
8412   # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
8413 < disable_libs=shared
8413 > build_libtool_libs=no
8414 > build_old_libs=yes
8415   # ### END LIBTOOL TAG CONFIG: disable-shared
8416  
8417   # ### BEGIN LIBTOOL TAG CONFIG: disable-static
8418 < disable_libs=static
8418 > build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
8419   # ### END LIBTOOL TAG CONFIG: disable-static
8420  
8421   # Local Variables:
8422   # mode:shell-script
8423   # sh-indentation:2
8424   # End:
8425 + # vi:sw=2
8426 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines