Statistics
| Revision:

root / ltmain.sh

History | View | Annotate | Download (237.8 kB)

1 3247 hiro
# Generated from ltmain.m4sh.
2 3247 hiro
3 3247 hiro
# ltmain.sh (GNU libtool) 2.2.6b
4 3247 hiro
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
5 3247 hiro
6 3247 hiro
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
7 3247 hiro
# This is free software; see the source for copying conditions.  There is NO
8 3247 hiro
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 3247 hiro
10 3247 hiro
# GNU Libtool is free software; you can redistribute it and/or modify
11 1 hiro
# it under the terms of the GNU General Public License as published by
12 1 hiro
# the Free Software Foundation; either version 2 of the License, or
13 1 hiro
# (at your option) any later version.
14 1 hiro
#
15 3247 hiro
# As a special exception to the GNU General Public License,
16 3247 hiro
# if you distribute this file as part of a program or library that
17 3247 hiro
# is built using GNU Libtool, you may include this file under the
18 3247 hiro
# same distribution terms that you use for the rest of that program.
19 3247 hiro
#
20 3247 hiro
# GNU Libtool is distributed in the hope that it will be useful, but
21 1 hiro
# WITHOUT ANY WARRANTY; without even the implied warranty of
22 1 hiro
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23 1 hiro
# General Public License for more details.
24 1 hiro
#
25 1 hiro
# You should have received a copy of the GNU General Public License
26 3247 hiro
# along with GNU Libtool; see the file COPYING.  If not, a copy
27 3247 hiro
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
28 3247 hiro
# or obtained by writing to the Free Software Foundation, Inc.,
29 3247 hiro
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30 3247 hiro
31 3247 hiro
# Usage: $progname [OPTION]... [MODE-ARG]...
32 1 hiro
#
33 3247 hiro
# Provide generalized library-building support services.
34 3247 hiro
#
35 3247 hiro
#     --config             show all configuration variables
36 3247 hiro
#     --debug              enable verbose shell tracing
37 3247 hiro
# -n, --dry-run            display commands without modifying any files
38 3247 hiro
#     --features           display basic configuration information and exit
39 3247 hiro
#     --mode=MODE          use operation mode MODE
40 3247 hiro
#     --preserve-dup-deps  don't remove duplicate dependency libraries
41 3247 hiro
#     --quiet, --silent    don't print informational messages
42 3247 hiro
#     --tag=TAG            use configuration variables from tag TAG
43 3247 hiro
# -v, --verbose            print informational messages (default)
44 3247 hiro
#     --version            print version information
45 3247 hiro
# -h, --help               print short or long help message
46 3247 hiro
#
47 3247 hiro
# MODE must be one of the following:
48 3247 hiro
#
49 3247 hiro
#       clean              remove files from the build directory
50 3247 hiro
#       compile            compile a source file into a libtool object
51 3247 hiro
#       execute            automatically set library path, then run a program
52 3247 hiro
#       finish             complete the installation of libtool libraries
53 3247 hiro
#       install            install libraries or executables
54 3247 hiro
#       link               create a library or an executable
55 3247 hiro
#       uninstall          remove libraries from an installed directory
56 3247 hiro
#
57 3247 hiro
# MODE-ARGS vary depending on the MODE.
58 3247 hiro
# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
59 3247 hiro
#
60 3247 hiro
# When reporting a bug, please describe a test case to reproduce it and
61 3247 hiro
# include the following information:
62 3247 hiro
#
63 3247 hiro
#       host-triplet:	$host
64 3247 hiro
#       shell:		$SHELL
65 3247 hiro
#       compiler:		$LTCC
66 3247 hiro
#       compiler flags:		$LTCFLAGS
67 3247 hiro
#       linker:		$LD (gnu? $with_gnu_ld)
68 3247 hiro
#       $progname:		(GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
69 3247 hiro
#       automake:		$automake_version
70 3247 hiro
#       autoconf:		$autoconf_version
71 3247 hiro
#
72 3247 hiro
# Report bugs to <bug-libtool@gnu.org>.
73 1 hiro
74 1 hiro
PROGRAM=ltmain.sh
75 1 hiro
PACKAGE=libtool
76 3247 hiro
VERSION="2.2.6b Debian-2.2.6b-2ubuntu1"
77 3247 hiro
TIMESTAMP=""
78 3247 hiro
package_revision=1.3017
79 1 hiro
80 3247 hiro
# Be Bourne compatible
81 2022 hiro
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
82 2022 hiro
  emulate sh
83 2022 hiro
  NULLCMD=:
84 2022 hiro
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
85 2022 hiro
  # is contrary to our usage.  Disable this feature.
86 2022 hiro
  alias -g '${1+"$@"}'='"$@"'
87 597 hiro
  setopt NO_GLOB_SUBST
88 2022 hiro
else
89 2022 hiro
  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
90 597 hiro
fi
91 2022 hiro
BIN_SH=xpg4; export BIN_SH # for Tru64
92 2022 hiro
DUALCASE=1; export DUALCASE # for MKS sh
93 1 hiro
94 3247 hiro
# NLS nuisances: We save the old values to restore during execute mode.
95 1 hiro
# Only set LANG and LC_ALL to C if already set.
96 1 hiro
# These must not be set unconditionally because not all systems understand
97 1 hiro
# e.g. LANG=C (notably SCO).
98 3247 hiro
lt_user_locale=
99 3247 hiro
lt_safe_locale=
100 2022 hiro
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
101 2022 hiro
do
102 2022 hiro
  eval "if test \"\${$lt_var+set}\" = set; then
103 3247 hiro
          save_$lt_var=\$$lt_var
104 3247 hiro
          $lt_var=C
105 2022 hiro
	  export $lt_var
106 3247 hiro
	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
107 3247 hiro
	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
108 2022 hiro
	fi"
109 2022 hiro
done
110 2022 hiro
111 3247 hiro
$lt_unset CDPATH
112 1 hiro
113 3247 hiro
114 3247 hiro
115 3247 hiro
116 3247 hiro
117 3247 hiro
: ${CP="cp -f"}
118 3247 hiro
: ${ECHO="echo"}
119 3247 hiro
: ${EGREP="/bin/grep -E"}
120 3247 hiro
: ${FGREP="/bin/grep -F"}
121 3247 hiro
: ${GREP="/bin/grep"}
122 3247 hiro
: ${LN_S="ln -s"}
123 3247 hiro
: ${MAKE="make"}
124 3247 hiro
: ${MKDIR="mkdir"}
125 3247 hiro
: ${MV="mv -f"}
126 3247 hiro
: ${RM="rm -f"}
127 3247 hiro
: ${SED="/bin/sed"}
128 3247 hiro
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
129 3247 hiro
: ${Xsed="$SED -e 1s/^X//"}
130 3247 hiro
131 3247 hiro
# Global variables:
132 3247 hiro
EXIT_SUCCESS=0
133 3247 hiro
EXIT_FAILURE=1
134 3247 hiro
EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
135 3247 hiro
EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
136 3247 hiro
137 3247 hiro
exit_status=$EXIT_SUCCESS
138 3247 hiro
139 1 hiro
# Make sure IFS has a sensible default
140 597 hiro
lt_nl='
141 597 hiro
'
142 597 hiro
IFS=" 	$lt_nl"
143 1 hiro
144 3247 hiro
dirname="s,/[^/]*$,,"
145 3247 hiro
basename="s,^.*/,,"
146 1 hiro
147 3247 hiro
# func_dirname_and_basename file append nondir_replacement
148 3247 hiro
# perform func_basename and func_dirname in a single function
149 3247 hiro
# call:
150 3247 hiro
#   dirname:  Compute the dirname of FILE.  If nonempty,
151 3247 hiro
#             add APPEND to the result, otherwise set result
152 3247 hiro
#             to NONDIR_REPLACEMENT.
153 3247 hiro
#             value returned in "$func_dirname_result"
154 3247 hiro
#   basename: Compute filename of FILE.
155 3247 hiro
#             value retuned in "$func_basename_result"
156 3247 hiro
# Implementation must be kept synchronized with func_dirname
157 3247 hiro
# and func_basename. For efficiency, we do not delegate to
158 3247 hiro
# those functions but instead duplicate the functionality here.
159 3247 hiro
func_dirname_and_basename ()
160 3247 hiro
{
161 3247 hiro
  # Extract subdirectory from the argument.
162 3247 hiro
  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
163 3247 hiro
  if test "X$func_dirname_result" = "X${1}"; then
164 3247 hiro
    func_dirname_result="${3}"
165 3247 hiro
  else
166 3247 hiro
    func_dirname_result="$func_dirname_result${2}"
167 3247 hiro
  fi
168 3247 hiro
  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
169 3247 hiro
}
170 1 hiro
171 3247 hiro
# Generated shell functions inserted here.
172 1 hiro
173 3247 hiro
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
174 3247 hiro
# is ksh but when the shell is invoked as "sh" and the current value of
175 3247 hiro
# the _XPG environment variable is not equal to 1 (one), the special
176 3247 hiro
# positional parameter $0, within a function call, is the name of the
177 3247 hiro
# function.
178 3247 hiro
progpath="$0"
179 3247 hiro
180 3247 hiro
# The name of this program:
181 3247 hiro
# In the unlikely event $progname began with a '-', it would play havoc with
182 3247 hiro
# func_echo (imagine progname=-n), so we prepend ./ in that case:
183 3247 hiro
func_dirname_and_basename "$progpath"
184 3247 hiro
progname=$func_basename_result
185 3247 hiro
case $progname in
186 3247 hiro
  -*) progname=./$progname ;;
187 3247 hiro
esac
188 3247 hiro
189 3247 hiro
# Make sure we have an absolute path for reexecution:
190 3247 hiro
case $progpath in
191 3247 hiro
  [\\/]*|[A-Za-z]:\\*) ;;
192 3247 hiro
  *[\\/]*)
193 3247 hiro
     progdir=$func_dirname_result
194 3247 hiro
     progdir=`cd "$progdir" && pwd`
195 3247 hiro
     progpath="$progdir/$progname"
196 3247 hiro
     ;;
197 3247 hiro
  *)
198 3247 hiro
     save_IFS="$IFS"
199 3247 hiro
     IFS=:
200 3247 hiro
     for progdir in $PATH; do
201 3247 hiro
       IFS="$save_IFS"
202 3247 hiro
       test -x "$progdir/$progname" && break
203 3247 hiro
     done
204 3247 hiro
     IFS="$save_IFS"
205 3247 hiro
     test -n "$progdir" || progdir=`pwd`
206 3247 hiro
     progpath="$progdir/$progname"
207 3247 hiro
     ;;
208 3247 hiro
esac
209 3247 hiro
210 3247 hiro
# Sed substitution that helps us do robust quoting.  It backslashifies
211 3247 hiro
# metacharacters that are still active within double-quoted strings.
212 3247 hiro
Xsed="${SED}"' -e 1s/^X//'
213 3247 hiro
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
214 3247 hiro
215 3247 hiro
# Same as above, but do not quote variable references.
216 3247 hiro
double_quote_subst='s/\(["`\\]\)/\\\1/g'
217 3247 hiro
218 3247 hiro
# Re-`\' parameter expansions in output of double_quote_subst that were
219 3247 hiro
# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
220 3247 hiro
# in input to double_quote_subst, that '$' was protected from expansion.
221 3247 hiro
# Since each input `\' is now two `\'s, look for any number of runs of
222 3247 hiro
# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
223 3247 hiro
bs='\\'
224 3247 hiro
bs2='\\\\'
225 3247 hiro
bs4='\\\\\\\\'
226 3247 hiro
dollar='\$'
227 3247 hiro
sed_double_backslash="\
228 3247 hiro
  s/$bs4/&\\
229 3247 hiro
/g
230 3247 hiro
  s/^$bs2$dollar/$bs&/
231 3247 hiro
  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
232 3247 hiro
  s/\n//g"
233 3247 hiro
234 3247 hiro
# Standard options:
235 3247 hiro
opt_dry_run=false
236 3247 hiro
opt_help=false
237 3247 hiro
opt_quiet=false
238 3247 hiro
opt_verbose=false
239 3247 hiro
opt_warning=:
240 3247 hiro
241 3247 hiro
# func_echo arg...
242 3247 hiro
# Echo program name prefixed message, along with the current mode
243 3247 hiro
# name if it has been set yet.
244 3247 hiro
func_echo ()
245 3247 hiro
{
246 3247 hiro
    $ECHO "$progname${mode+: }$mode: $*"
247 3247 hiro
}
248 3247 hiro
249 3247 hiro
# func_verbose arg...
250 3247 hiro
# Echo program name prefixed message in verbose mode only.
251 3247 hiro
func_verbose ()
252 3247 hiro
{
253 3247 hiro
    $opt_verbose && func_echo ${1+"$@"}
254 3247 hiro
255 3247 hiro
    # A bug in bash halts the script if the last line of a function
256 3247 hiro
    # fails when set -e is in force, so we need another command to
257 3247 hiro
    # work around that:
258 3247 hiro
    :
259 3247 hiro
}
260 3247 hiro
261 3247 hiro
# func_error arg...
262 3247 hiro
# Echo program name prefixed message to standard error.
263 3247 hiro
func_error ()
264 3247 hiro
{
265 3247 hiro
    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
266 3247 hiro
}
267 3247 hiro
268 3247 hiro
# func_warning arg...
269 3247 hiro
# Echo program name prefixed warning message to standard error.
270 3247 hiro
func_warning ()
271 3247 hiro
{
272 3247 hiro
    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
273 3247 hiro
274 3247 hiro
    # bash bug again:
275 3247 hiro
    :
276 3247 hiro
}
277 3247 hiro
278 3247 hiro
# func_fatal_error arg...
279 3247 hiro
# Echo program name prefixed message to standard error, and exit.
280 3247 hiro
func_fatal_error ()
281 3247 hiro
{
282 3247 hiro
    func_error ${1+"$@"}
283 3247 hiro
    exit $EXIT_FAILURE
284 3247 hiro
}
285 3247 hiro
286 3247 hiro
# func_fatal_help arg...
287 3247 hiro
# Echo program name prefixed message to standard error, followed by
288 3247 hiro
# a help hint, and exit.
289 3247 hiro
func_fatal_help ()
290 3247 hiro
{
291 3247 hiro
    func_error ${1+"$@"}
292 3247 hiro
    func_fatal_error "$help"
293 3247 hiro
}
294 3247 hiro
help="Try \`$progname --help' for more information."  ## default
295 3247 hiro
296 3247 hiro
297 3247 hiro
# func_grep expression filename
298 3247 hiro
# Check whether EXPRESSION matches any line of FILENAME, without output.
299 3247 hiro
func_grep ()
300 3247 hiro
{
301 3247 hiro
    $GREP "$1" "$2" >/dev/null 2>&1
302 3247 hiro
}
303 3247 hiro
304 3247 hiro
305 3247 hiro
# func_mkdir_p directory-path
306 3247 hiro
# Make sure the entire path to DIRECTORY-PATH is available.
307 3247 hiro
func_mkdir_p ()
308 3247 hiro
{
309 3247 hiro
    my_directory_path="$1"
310 3247 hiro
    my_dir_list=
311 3247 hiro
312 3247 hiro
    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
313 3247 hiro
314 3247 hiro
      # Protect directory names starting with `-'
315 3247 hiro
      case $my_directory_path in
316 3247 hiro
        -*) my_directory_path="./$my_directory_path" ;;
317 3247 hiro
      esac
318 3247 hiro
319 3247 hiro
      # While some portion of DIR does not yet exist...
320 3247 hiro
      while test ! -d "$my_directory_path"; do
321 3247 hiro
        # ...make a list in topmost first order.  Use a colon delimited
322 3247 hiro
	# list incase some portion of path contains whitespace.
323 3247 hiro
        my_dir_list="$my_directory_path:$my_dir_list"
324 3247 hiro
325 3247 hiro
        # If the last portion added has no slash in it, the list is done
326 3247 hiro
        case $my_directory_path in */*) ;; *) break ;; esac
327 3247 hiro
328 3247 hiro
        # ...otherwise throw away the child directory and loop
329 3247 hiro
        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
330 3247 hiro
      done
331 3247 hiro
      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
332 3247 hiro
333 3247 hiro
      save_mkdir_p_IFS="$IFS"; IFS=':'
334 3247 hiro
      for my_dir in $my_dir_list; do
335 3247 hiro
	IFS="$save_mkdir_p_IFS"
336 3247 hiro
        # mkdir can fail with a `File exist' error if two processes
337 3247 hiro
        # try to create one of the directories concurrently.  Don't
338 3247 hiro
        # stop in that case!
339 3247 hiro
        $MKDIR "$my_dir" 2>/dev/null || :
340 3247 hiro
      done
341 3247 hiro
      IFS="$save_mkdir_p_IFS"
342 3247 hiro
343 3247 hiro
      # Bail out if we (or some other process) failed to create a directory.
344 3247 hiro
      test -d "$my_directory_path" || \
345 3247 hiro
        func_fatal_error "Failed to create \`$1'"
346 3247 hiro
    fi
347 3247 hiro
}
348 3247 hiro
349 3247 hiro
350 879 hiro
# func_mktempdir [string]
351 879 hiro
# Make a temporary directory that won't clash with other running
352 879 hiro
# libtool processes, and avoids race conditions if possible.  If
353 879 hiro
# given, STRING is the basename for that directory.
354 879 hiro
func_mktempdir ()
355 879 hiro
{
356 879 hiro
    my_template="${TMPDIR-/tmp}/${1-$progname}"
357 879 hiro
358 3247 hiro
    if test "$opt_dry_run" = ":"; then
359 879 hiro
      # Return a directory name, but don't create it in dry-run mode
360 879 hiro
      my_tmpdir="${my_template}-$$"
361 879 hiro
    else
362 879 hiro
363 879 hiro
      # If mktemp works, use that first and foremost
364 879 hiro
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
365 879 hiro
366 879 hiro
      if test ! -d "$my_tmpdir"; then
367 3247 hiro
        # Failing that, at least try and use $RANDOM to avoid a race
368 3247 hiro
        my_tmpdir="${my_template}-${RANDOM-0}$$"
369 879 hiro
370 3247 hiro
        save_mktempdir_umask=`umask`
371 3247 hiro
        umask 0077
372 3247 hiro
        $MKDIR "$my_tmpdir"
373 3247 hiro
        umask $save_mktempdir_umask
374 879 hiro
      fi
375 879 hiro
376 879 hiro
      # If we're not in dry-run mode, bomb out on failure
377 3247 hiro
      test -d "$my_tmpdir" || \
378 3247 hiro
        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
379 879 hiro
    fi
380 879 hiro
381 3247 hiro
    $ECHO "X$my_tmpdir" | $Xsed
382 879 hiro
}
383 879 hiro
384 879 hiro
385 3247 hiro
# func_quote_for_eval arg
386 3247 hiro
# Aesthetically quote ARG to be evaled later.
387 3247 hiro
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
388 3247 hiro
# is double-quoted, suitable for a subsequent eval, whereas
389 3247 hiro
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
390 3247 hiro
# which are still active within double quotes backslashified.
391 3247 hiro
func_quote_for_eval ()
392 597 hiro
{
393 3247 hiro
    case $1 in
394 3247 hiro
      *[\\\`\"\$]*)
395 3247 hiro
	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
396 3247 hiro
      *)
397 3247 hiro
        func_quote_for_eval_unquoted_result="$1" ;;
398 1 hiro
    esac
399 3247 hiro
400 3247 hiro
    case $func_quote_for_eval_unquoted_result in
401 3247 hiro
      # Double-quote args containing shell metacharacters to delay
402 3247 hiro
      # word splitting, command substitution and and variable
403 3247 hiro
      # expansion for a subsequent eval.
404 3247 hiro
      # Many Bourne shells cannot handle close brackets correctly
405 3247 hiro
      # in scan sets, so we specify it separately.
406 3247 hiro
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
407 3247 hiro
        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
408 3247 hiro
        ;;
409 3247 hiro
      *)
410 3247 hiro
        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
411 3247 hiro
    esac
412 1 hiro
}
413 1 hiro
414 1 hiro
415 3247 hiro
# func_quote_for_expand arg
416 3247 hiro
# Aesthetically quote ARG to be evaled later; same as above,
417 3247 hiro
# but do not quote variable references.
418 3247 hiro
func_quote_for_expand ()
419 597 hiro
{
420 3247 hiro
    case $1 in
421 3247 hiro
      *[\\\`\"]*)
422 3247 hiro
	my_arg=`$ECHO "X$1" | $Xsed \
423 3247 hiro
	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
424 1 hiro
      *)
425 3247 hiro
        my_arg="$1" ;;
426 3247 hiro
    esac
427 3247 hiro
428 3247 hiro
    case $my_arg in
429 3247 hiro
      # Double-quote args containing shell metacharacters to delay
430 3247 hiro
      # word splitting and command substitution for a subsequent eval.
431 3247 hiro
      # Many Bourne shells cannot handle close brackets correctly
432 3247 hiro
      # in scan sets, so we specify it separately.
433 3247 hiro
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
434 3247 hiro
        my_arg="\"$my_arg\""
435 3247 hiro
        ;;
436 3247 hiro
    esac
437 3247 hiro
438 3247 hiro
    func_quote_for_expand_result="$my_arg"
439 1 hiro
}
440 597 hiro
441 597 hiro
442 3247 hiro
# func_show_eval cmd [fail_exp]
443 3247 hiro
# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
444 3247 hiro
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
445 3247 hiro
# is given, then evaluate it.
446 3247 hiro
func_show_eval ()
447 597 hiro
{
448 3247 hiro
    my_cmd="$1"
449 3247 hiro
    my_fail_exp="${2-:}"
450 597 hiro
451 3247 hiro
    ${opt_silent-false} || {
452 3247 hiro
      func_quote_for_expand "$my_cmd"
453 3247 hiro
      eval "func_echo $func_quote_for_expand_result"
454 3247 hiro
    }
455 3247 hiro
456 3247 hiro
    if ${opt_dry_run-false}; then :; else
457 3247 hiro
      eval "$my_cmd"
458 3247 hiro
      my_status=$?
459 3247 hiro
      if test "$my_status" -eq 0; then :; else
460 3247 hiro
	eval "(exit $my_status); $my_fail_exp"
461 3247 hiro
      fi
462 597 hiro
    fi
463 597 hiro
}
464 597 hiro
465 3247 hiro
466 3247 hiro
# func_show_eval_locale cmd [fail_exp]
467 3247 hiro
# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
468 3247 hiro
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
469 3247 hiro
# is given, then evaluate it.  Use the saved locale for evaluation.
470 3247 hiro
func_show_eval_locale ()
471 597 hiro
{
472 3247 hiro
    my_cmd="$1"
473 3247 hiro
    my_fail_exp="${2-:}"
474 597 hiro
475 3247 hiro
    ${opt_silent-false} || {
476 3247 hiro
      func_quote_for_expand "$my_cmd"
477 3247 hiro
      eval "func_echo $func_quote_for_expand_result"
478 3247 hiro
    }
479 3247 hiro
480 3247 hiro
    if ${opt_dry_run-false}; then :; else
481 3247 hiro
      eval "$lt_user_locale
482 3247 hiro
	    $my_cmd"
483 3247 hiro
      my_status=$?
484 3247 hiro
      eval "$lt_safe_locale"
485 3247 hiro
      if test "$my_status" -eq 0; then :; else
486 3247 hiro
	eval "(exit $my_status); $my_fail_exp"
487 3247 hiro
      fi
488 597 hiro
    fi
489 3247 hiro
}
490 597 hiro
491 597 hiro
492 3247 hiro
493 3247 hiro
494 3247 hiro
495 3247 hiro
# func_version
496 3247 hiro
# Echo version message to standard output and exit.
497 3247 hiro
func_version ()
498 3247 hiro
{
499 3247 hiro
    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
500 3247 hiro
        s/^# //
501 3247 hiro
	s/^# *$//
502 3247 hiro
        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
503 3247 hiro
        p
504 3247 hiro
     }' < "$progpath"
505 3247 hiro
     exit $?
506 597 hiro
}
507 1 hiro
508 3247 hiro
# func_usage
509 3247 hiro
# Echo short help message to standard output and exit.
510 3247 hiro
func_usage ()
511 3247 hiro
{
512 3247 hiro
    $SED -n '/^# Usage:/,/# -h/ {
513 3247 hiro
        s/^# //
514 3247 hiro
	s/^# *$//
515 3247 hiro
	s/\$progname/'$progname'/
516 3247 hiro
	p
517 3247 hiro
    }' < "$progpath"
518 3247 hiro
    $ECHO
519 3247 hiro
    $ECHO "run \`$progname --help | more' for full usage"
520 3247 hiro
    exit $?
521 3247 hiro
}
522 1 hiro
523 3247 hiro
# func_help
524 3247 hiro
# Echo long help message to standard output and exit.
525 3247 hiro
func_help ()
526 3247 hiro
{
527 3247 hiro
    $SED -n '/^# Usage:/,/# Report bugs to/ {
528 3247 hiro
        s/^# //
529 3247 hiro
	s/^# *$//
530 3247 hiro
	s*\$progname*'$progname'*
531 3247 hiro
	s*\$host*'"$host"'*
532 3247 hiro
	s*\$SHELL*'"$SHELL"'*
533 3247 hiro
	s*\$LTCC*'"$LTCC"'*
534 3247 hiro
	s*\$LTCFLAGS*'"$LTCFLAGS"'*
535 3247 hiro
	s*\$LD*'"$LD"'*
536 3247 hiro
	s/\$with_gnu_ld/'"$with_gnu_ld"'/
537 3247 hiro
	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
538 3247 hiro
	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
539 3247 hiro
	p
540 3247 hiro
     }' < "$progpath"
541 3247 hiro
    exit $?
542 3247 hiro
}
543 879 hiro
544 3247 hiro
# func_missing_arg argname
545 3247 hiro
# Echo program name prefixed message to standard error and set global
546 3247 hiro
# exit_cmd.
547 3247 hiro
func_missing_arg ()
548 3247 hiro
{
549 3247 hiro
    func_error "missing argument for $1"
550 3247 hiro
    exit_cmd=exit
551 3247 hiro
}
552 3247 hiro
553 3247 hiro
exit_cmd=:
554 3247 hiro
555 3247 hiro
556 3247 hiro
557 3247 hiro
558 3247 hiro
559 3247 hiro
# Check that we have a working $ECHO.
560 3247 hiro
if test "X$1" = X--no-reexec; then
561 3247 hiro
  # Discard the --no-reexec flag, and continue.
562 1 hiro
  shift
563 3247 hiro
elif test "X$1" = X--fallback-echo; then
564 3247 hiro
  # Avoid inline document here, it may be left over
565 3247 hiro
  :
566 3247 hiro
elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
567 3247 hiro
  # Yippee, $ECHO works!
568 3247 hiro
  :
569 3247 hiro
else
570 3247 hiro
  # Restart under the correct shell, and then maybe $ECHO will work.
571 3247 hiro
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
572 3247 hiro
fi
573 1 hiro
574 3247 hiro
if test "X$1" = X--fallback-echo; then
575 3247 hiro
  # used as fallback echo
576 3247 hiro
  shift
577 3247 hiro
  cat <<EOF
578 3247 hiro
$*
579 3247 hiro
EOF
580 3247 hiro
  exit $EXIT_SUCCESS
581 3247 hiro
fi
582 1 hiro
583 3247 hiro
magic="%%%MAGIC variable%%%"
584 3247 hiro
magic_exe="%%%MAGIC EXE variable%%%"
585 1 hiro
586 3247 hiro
# Global variables.
587 3247 hiro
# $mode is unset
588 3247 hiro
nonopt=
589 3247 hiro
execute_dlfiles=
590 3247 hiro
preserve_args=
591 3247 hiro
lo2o="s/\\.lo\$/.${objext}/"
592 3247 hiro
o2lo="s/\\.${objext}\$/.lo/"
593 3247 hiro
extracted_archives=
594 3247 hiro
extracted_serial=0
595 1 hiro
596 3247 hiro
opt_dry_run=false
597 3247 hiro
opt_duplicate_deps=false
598 3247 hiro
opt_silent=false
599 3247 hiro
opt_debug=:
600 1 hiro
601 3247 hiro
# If this variable is set in any of the actions, the command in it
602 3247 hiro
# will be execed at the end.  This prevents here-documents from being
603 3247 hiro
# left over by shells.
604 3247 hiro
exec_cmd=
605 1 hiro
606 3247 hiro
# func_fatal_configuration arg...
607 3247 hiro
# Echo program name prefixed message to standard error, followed by
608 3247 hiro
# a configuration failure hint, and exit.
609 3247 hiro
func_fatal_configuration ()
610 3247 hiro
{
611 3247 hiro
    func_error ${1+"$@"}
612 3247 hiro
    func_error "See the $PACKAGE documentation for more information."
613 3247 hiro
    func_fatal_error "Fatal configuration error."
614 3247 hiro
}
615 1 hiro
616 2022 hiro
617 3247 hiro
# func_config
618 3247 hiro
# Display the configuration for all the tags in this script.
619 3247 hiro
func_config ()
620 3247 hiro
{
621 3247 hiro
    re_begincf='^# ### BEGIN LIBTOOL'
622 3247 hiro
    re_endcf='^# ### END LIBTOOL'
623 1 hiro
624 3247 hiro
    # Default configuration.
625 3247 hiro
    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
626 3247 hiro
627 1 hiro
    # Now print the configurations for the tags.
628 1 hiro
    for tagname in $taglist; do
629 3247 hiro
      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
630 1 hiro
    done
631 3247 hiro
632 597 hiro
    exit $?
633 3247 hiro
}
634 1 hiro
635 3247 hiro
# func_features
636 3247 hiro
# Display the features supported by this script.
637 3247 hiro
func_features ()
638 3247 hiro
{
639 3247 hiro
    $ECHO "host: $host"
640 1 hiro
    if test "$build_libtool_libs" = yes; then
641 3247 hiro
      $ECHO "enable shared libraries"
642 1 hiro
    else
643 3247 hiro
      $ECHO "disable shared libraries"
644 1 hiro
    fi
645 1 hiro
    if test "$build_old_libs" = yes; then
646 3247 hiro
      $ECHO "enable static libraries"
647 1 hiro
    else
648 3247 hiro
      $ECHO "disable static libraries"
649 1 hiro
    fi
650 3247 hiro
651 597 hiro
    exit $?
652 3247 hiro
}
653 1 hiro
654 3247 hiro
# func_enable_tag tagname
655 3247 hiro
# Verify that TAGNAME is valid, and either flag an error and exit, or
656 3247 hiro
# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
657 3247 hiro
# variable here.
658 3247 hiro
func_enable_tag ()
659 3247 hiro
{
660 3247 hiro
  # Global variable:
661 3247 hiro
  tagname="$1"
662 1 hiro
663 3247 hiro
  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
664 3247 hiro
  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
665 3247 hiro
  sed_extractcf="/$re_begincf/,/$re_endcf/p"
666 1 hiro
667 3247 hiro
  # Validate tagname.
668 3247 hiro
  case $tagname in
669 3247 hiro
    *[!-_A-Za-z0-9,/]*)
670 3247 hiro
      func_fatal_error "invalid tag name: $tagname"
671 3247 hiro
      ;;
672 3247 hiro
  esac
673 1 hiro
674 3247 hiro
  # Don't test for the "default" C tag, as we know it's
675 3247 hiro
  # there but not specially marked.
676 3247 hiro
  case $tagname in
677 3247 hiro
    CC) ;;
678 3247 hiro
    *)
679 3247 hiro
      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
680 3247 hiro
	taglist="$taglist $tagname"
681 1 hiro
682 3247 hiro
	# Evaluate the configuration.  Be careful to quote the path
683 3247 hiro
	# and the sed script, to avoid splitting on whitespace, but
684 3247 hiro
	# also don't use non-portable quotes within backquotes within
685 3247 hiro
	# quotes we have to do it in 2 steps:
686 3247 hiro
	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
687 3247 hiro
	eval "$extractedcf"
688 3247 hiro
      else
689 3247 hiro
	func_error "ignoring unknown tag $tagname"
690 3247 hiro
      fi
691 3247 hiro
      ;;
692 3247 hiro
  esac
693 3247 hiro
}
694 3247 hiro
695 3247 hiro
# Parse options once, thoroughly.  This comes as soon as possible in
696 3247 hiro
# the script to make things like `libtool --version' happen quickly.
697 3247 hiro
{
698 3247 hiro
699 3247 hiro
  # Shorthand for --mode=foo, only valid as the first argument
700 3247 hiro
  case $1 in
701 3247 hiro
  clean|clea|cle|cl)
702 3247 hiro
    shift; set dummy --mode clean ${1+"$@"}; shift
703 879 hiro
    ;;
704 3247 hiro
  compile|compil|compi|comp|com|co|c)
705 3247 hiro
    shift; set dummy --mode compile ${1+"$@"}; shift
706 1 hiro
    ;;
707 3247 hiro
  execute|execut|execu|exec|exe|ex|e)
708 3247 hiro
    shift; set dummy --mode execute ${1+"$@"}; shift
709 1 hiro
    ;;
710 3247 hiro
  finish|finis|fini|fin|fi|f)
711 3247 hiro
    shift; set dummy --mode finish ${1+"$@"}; shift
712 1 hiro
    ;;
713 3247 hiro
  install|instal|insta|inst|ins|in|i)
714 3247 hiro
    shift; set dummy --mode install ${1+"$@"}; shift
715 1 hiro
    ;;
716 3247 hiro
  link|lin|li|l)
717 3247 hiro
    shift; set dummy --mode link ${1+"$@"}; shift
718 3247 hiro
    ;;
719 3247 hiro
  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
720 3247 hiro
    shift; set dummy --mode uninstall ${1+"$@"}; shift
721 3247 hiro
    ;;
722 1 hiro
  esac
723 1 hiro
724 3247 hiro
  # Parse non-mode specific arguments:
725 3247 hiro
  while test "$#" -gt 0; do
726 3247 hiro
    opt="$1"
727 3247 hiro
    shift
728 1 hiro
729 3247 hiro
    case $opt in
730 3247 hiro
      --config)		func_config					;;
731 879 hiro
732 3247 hiro
      --debug)		preserve_args="$preserve_args $opt"
733 3247 hiro
			func_echo "enabling shell trace mode"
734 3247 hiro
			opt_debug='set -x'
735 3247 hiro
			$opt_debug
736 3247 hiro
			;;
737 1 hiro
738 3247 hiro
      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
739 3247 hiro
			execute_dlfiles="$execute_dlfiles $1"
740 3247 hiro
			shift
741 3247 hiro
			;;
742 1 hiro
743 3247 hiro
      --dry-run | -n)	opt_dry_run=:					;;
744 3247 hiro
      --features)       func_features					;;
745 3247 hiro
      --finish)		mode="finish"					;;
746 3247 hiro
747 3247 hiro
      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
748 3247 hiro
			case $1 in
749 3247 hiro
			  # Valid mode arguments:
750 3247 hiro
			  clean)	;;
751 3247 hiro
			  compile)	;;
752 3247 hiro
			  execute)	;;
753 3247 hiro
			  finish)	;;
754 3247 hiro
			  install)	;;
755 3247 hiro
			  link)		;;
756 3247 hiro
			  relink)	;;
757 3247 hiro
			  uninstall)	;;
758 3247 hiro
759 3247 hiro
			  # Catch anything else as an error
760 3247 hiro
			  *) func_error "invalid argument for $opt"
761 3247 hiro
			     exit_cmd=exit
762 3247 hiro
			     break
763 3247 hiro
			     ;;
764 3247 hiro
		        esac
765 3247 hiro
766 3247 hiro
			mode="$1"
767 3247 hiro
			shift
768 3247 hiro
			;;
769 3247 hiro
770 3247 hiro
      --preserve-dup-deps)
771 3247 hiro
			opt_duplicate_deps=:				;;
772 3247 hiro
773 3247 hiro
      --quiet|--silent)	preserve_args="$preserve_args $opt"
774 3247 hiro
			opt_silent=:
775 3247 hiro
			;;
776 3247 hiro
777 3247 hiro
      --verbose| -v)	preserve_args="$preserve_args $opt"
778 3247 hiro
			opt_silent=false
779 3247 hiro
			;;
780 3247 hiro
781 3247 hiro
      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
782 3247 hiro
			preserve_args="$preserve_args $opt $1"
783 3247 hiro
			func_enable_tag "$1"	# tagname is set here
784 3247 hiro
			shift
785 3247 hiro
			;;
786 3247 hiro
787 3247 hiro
      # Separate optargs to long options:
788 3247 hiro
      -dlopen=*|--mode=*|--tag=*)
789 3247 hiro
			func_opt_split "$opt"
790 3247 hiro
			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
791 3247 hiro
			shift
792 3247 hiro
			;;
793 3247 hiro
794 3247 hiro
      -\?|-h)		func_usage					;;
795 3247 hiro
      --help)		opt_help=:					;;
796 3247 hiro
      --version)	func_version					;;
797 3247 hiro
798 3247 hiro
      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
799 3247 hiro
800 3247 hiro
      *)		nonopt="$opt"
801 3247 hiro
			break
802 3247 hiro
			;;
803 3247 hiro
    esac
804 3247 hiro
  done
805 3247 hiro
806 3247 hiro
807 3247 hiro
  case $host in
808 3247 hiro
    *cygwin* | *mingw* | *pw32* | *cegcc*)
809 3247 hiro
      # don't eliminate duplications in $postdeps and $predeps
810 3247 hiro
      opt_duplicate_compiler_generated_deps=:
811 1 hiro
      ;;
812 3247 hiro
    *)
813 3247 hiro
      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
814 1 hiro
      ;;
815 3247 hiro
  esac
816 1 hiro
817 3247 hiro
  # Having warned about all mis-specified options, bail out if
818 3247 hiro
  # anything was wrong.
819 3247 hiro
  $exit_cmd $EXIT_FAILURE
820 3247 hiro
}
821 3247 hiro
822 3247 hiro
# func_check_version_match
823 3247 hiro
# Ensure that we are using m4 macros, and libtool script from the same
824 3247 hiro
# release of libtool.
825 3247 hiro
func_check_version_match ()
826 3247 hiro
{
827 3247 hiro
  if test "$package_revision" != "$macro_revision"; then
828 3247 hiro
    if test "$VERSION" != "$macro_version"; then
829 3247 hiro
      if test -z "$macro_version"; then
830 3247 hiro
        cat >&2 <<_LT_EOF
831 3247 hiro
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
832 3247 hiro
$progname: definition of this LT_INIT comes from an older release.
833 3247 hiro
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
834 3247 hiro
$progname: and run autoconf again.
835 3247 hiro
_LT_EOF
836 3247 hiro
      else
837 3247 hiro
        cat >&2 <<_LT_EOF
838 3247 hiro
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
839 3247 hiro
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
840 3247 hiro
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
841 3247 hiro
$progname: and run autoconf again.
842 3247 hiro
_LT_EOF
843 1 hiro
      fi
844 3247 hiro
    else
845 3247 hiro
      cat >&2 <<_LT_EOF
846 3247 hiro
$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
847 3247 hiro
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
848 3247 hiro
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
849 3247 hiro
$progname: of $PACKAGE $VERSION and run autoconf again.
850 3247 hiro
_LT_EOF
851 3247 hiro
    fi
852 3247 hiro
853 3247 hiro
    exit $EXIT_MISMATCH
854 1 hiro
  fi
855 3247 hiro
}
856 1 hiro
857 3247 hiro
858 3247 hiro
## ----------- ##
859 3247 hiro
##    Main.    ##
860 3247 hiro
## ----------- ##
861 3247 hiro
862 3247 hiro
$opt_help || {
863 3247 hiro
  # Sanity checks first:
864 3247 hiro
  func_check_version_match
865 3247 hiro
866 3247 hiro
  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
867 3247 hiro
    func_fatal_configuration "not configured to build any kind of library"
868 3247 hiro
  fi
869 3247 hiro
870 3247 hiro
  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
871 3247 hiro
872 3247 hiro
873 3247 hiro
  # Darwin sucks
874 3247 hiro
  eval std_shrext=\"$shrext_cmds\"
875 3247 hiro
876 3247 hiro
877 1 hiro
  # Only execute mode is allowed to have -dlopen flags.
878 1 hiro
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
879 3247 hiro
    func_error "unrecognized option \`-dlopen'"
880 3247 hiro
    $ECHO "$help" 1>&2
881 1 hiro
    exit $EXIT_FAILURE
882 1 hiro
  fi
883 1 hiro
884 1 hiro
  # Change the help message to a mode-specific one.
885 1 hiro
  generic_help="$help"
886 3247 hiro
  help="Try \`$progname --help --mode=$mode' for more information."
887 3247 hiro
}
888 1 hiro
889 3247 hiro
890 3247 hiro
# func_lalib_p file
891 3247 hiro
# True iff FILE is a libtool `.la' library or `.lo' object file.
892 3247 hiro
# This function is only a basic sanity check; it will hardly flush out
893 3247 hiro
# determined imposters.
894 3247 hiro
func_lalib_p ()
895 3247 hiro
{
896 3247 hiro
    test -f "$1" &&
897 3247 hiro
      $SED -e 4q "$1" 2>/dev/null \
898 3247 hiro
        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
899 3247 hiro
}
900 3247 hiro
901 3247 hiro
# func_lalib_unsafe_p file
902 3247 hiro
# True iff FILE is a libtool `.la' library or `.lo' object file.
903 3247 hiro
# This function implements the same check as func_lalib_p without
904 3247 hiro
# resorting to external programs.  To this end, it redirects stdin and
905 3247 hiro
# closes it afterwards, without saving the original file descriptor.
906 3247 hiro
# As a safety measure, use it only where a negative result would be
907 3247 hiro
# fatal anyway.  Works if `file' does not exist.
908 3247 hiro
func_lalib_unsafe_p ()
909 3247 hiro
{
910 3247 hiro
    lalib_p=no
911 3247 hiro
    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
912 3247 hiro
	for lalib_p_l in 1 2 3 4
913 3247 hiro
	do
914 3247 hiro
	    read lalib_p_line
915 3247 hiro
	    case "$lalib_p_line" in
916 3247 hiro
		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
917 3247 hiro
	    esac
918 3247 hiro
	done
919 3247 hiro
	exec 0<&5 5<&-
920 3247 hiro
    fi
921 3247 hiro
    test "$lalib_p" = yes
922 3247 hiro
}
923 3247 hiro
924 3247 hiro
# func_ltwrapper_script_p file
925 3247 hiro
# True iff FILE is a libtool wrapper script
926 3247 hiro
# This function is only a basic sanity check; it will hardly flush out
927 3247 hiro
# determined imposters.
928 3247 hiro
func_ltwrapper_script_p ()
929 3247 hiro
{
930 3247 hiro
    func_lalib_p "$1"
931 3247 hiro
}
932 3247 hiro
933 3247 hiro
# func_ltwrapper_executable_p file
934 3247 hiro
# True iff FILE is a libtool wrapper executable
935 3247 hiro
# This function is only a basic sanity check; it will hardly flush out
936 3247 hiro
# determined imposters.
937 3247 hiro
func_ltwrapper_executable_p ()
938 3247 hiro
{
939 3247 hiro
    func_ltwrapper_exec_suffix=
940 3247 hiro
    case $1 in
941 3247 hiro
    *.exe) ;;
942 3247 hiro
    *) func_ltwrapper_exec_suffix=.exe ;;
943 3247 hiro
    esac
944 3247 hiro
    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
945 3247 hiro
}
946 3247 hiro
947 3247 hiro
# func_ltwrapper_scriptname file
948 3247 hiro
# Assumes file is an ltwrapper_executable
949 3247 hiro
# uses $file to determine the appropriate filename for a
950 3247 hiro
# temporary ltwrapper_script.
951 3247 hiro
func_ltwrapper_scriptname ()
952 3247 hiro
{
953 3247 hiro
    func_ltwrapper_scriptname_result=""
954 3247 hiro
    if func_ltwrapper_executable_p "$1"; then
955 3247 hiro
	func_dirname_and_basename "$1" "" "."
956 3247 hiro
	func_stripname '' '.exe' "$func_basename_result"
957 3247 hiro
	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
958 3247 hiro
    fi
959 3247 hiro
}
960 3247 hiro
961 3247 hiro
# func_ltwrapper_p file
962 3247 hiro
# True iff FILE is a libtool wrapper script or wrapper executable
963 3247 hiro
# This function is only a basic sanity check; it will hardly flush out
964 3247 hiro
# determined imposters.
965 3247 hiro
func_ltwrapper_p ()
966 3247 hiro
{
967 3247 hiro
    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
968 3247 hiro
}
969 3247 hiro
970 3247 hiro
971 3247 hiro
# func_execute_cmds commands fail_cmd
972 3247 hiro
# Execute tilde-delimited COMMANDS.
973 3247 hiro
# If FAIL_CMD is given, eval that upon failure.
974 3247 hiro
# FAIL_CMD may read-access the current command in variable CMD!
975 3247 hiro
func_execute_cmds ()
976 3247 hiro
{
977 3247 hiro
    $opt_debug
978 3247 hiro
    save_ifs=$IFS; IFS='~'
979 3247 hiro
    for cmd in $1; do
980 3247 hiro
      IFS=$save_ifs
981 3247 hiro
      eval cmd=\"$cmd\"
982 3247 hiro
      func_show_eval "$cmd" "${2-:}"
983 3247 hiro
    done
984 3247 hiro
    IFS=$save_ifs
985 3247 hiro
}
986 3247 hiro
987 3247 hiro
988 3247 hiro
# func_source file
989 3247 hiro
# Source FILE, adding directory component if necessary.
990 3247 hiro
# Note that it is not necessary on cygwin/mingw to append a dot to
991 3247 hiro
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
992 3247 hiro
# behavior happens only for exec(3), not for open(2)!  Also, sourcing
993 3247 hiro
# `FILE.' does not work on cygwin managed mounts.
994 3247 hiro
func_source ()
995 3247 hiro
{
996 3247 hiro
    $opt_debug
997 3247 hiro
    case $1 in
998 3247 hiro
    */* | *\\*)	. "$1" ;;
999 3247 hiro
    *)		. "./$1" ;;
1000 3247 hiro
    esac
1001 3247 hiro
}
1002 3247 hiro
1003 3247 hiro
1004 3247 hiro
# func_infer_tag arg
1005 3247 hiro
# Infer tagged configuration to use if any are available and
1006 3247 hiro
# if one wasn't chosen via the "--tag" command line option.
1007 3247 hiro
# Only attempt this if the compiler in the base compile
1008 3247 hiro
# command doesn't match the default compiler.
1009 3247 hiro
# arg is usually of the form 'gcc ...'
1010 3247 hiro
func_infer_tag ()
1011 3247 hiro
{
1012 3247 hiro
    $opt_debug
1013 3247 hiro
    if test -n "$available_tags" && test -z "$tagname"; then
1014 3247 hiro
      CC_quoted=
1015 3247 hiro
      for arg in $CC; do
1016 3247 hiro
        func_quote_for_eval "$arg"
1017 3247 hiro
	CC_quoted="$CC_quoted $func_quote_for_eval_result"
1018 3247 hiro
      done
1019 3247 hiro
      case $@ in
1020 3247 hiro
      # Blanks in the command may have been stripped by the calling shell,
1021 3247 hiro
      # but not from the CC environment variable when configure was run.
1022 3247 hiro
      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1023 3247 hiro
      # Blanks at the start of $base_compile will cause this to fail
1024 3247 hiro
      # if we don't check for them as well.
1025 3247 hiro
      *)
1026 3247 hiro
	for z in $available_tags; do
1027 3247 hiro
	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1028 3247 hiro
	    # Evaluate the configuration.
1029 3247 hiro
	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1030 3247 hiro
	    CC_quoted=
1031 3247 hiro
	    for arg in $CC; do
1032 3247 hiro
	      # Double-quote args containing other shell metacharacters.
1033 3247 hiro
	      func_quote_for_eval "$arg"
1034 3247 hiro
	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
1035 3247 hiro
	    done
1036 3247 hiro
	    case "$@ " in
1037 3247 hiro
	      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1038 3247 hiro
	      # The compiler in the base compile command matches
1039 3247 hiro
	      # the one in the tagged configuration.
1040 3247 hiro
	      # Assume this is the tagged configuration we want.
1041 3247 hiro
	      tagname=$z
1042 3247 hiro
	      break
1043 3247 hiro
	      ;;
1044 3247 hiro
	    esac
1045 3247 hiro
	  fi
1046 3247 hiro
	done
1047 3247 hiro
	# If $tagname still isn't set, then no tagged configuration
1048 3247 hiro
	# was found and let the user know that the "--tag" command
1049 3247 hiro
	# line option must be used.
1050 3247 hiro
	if test -z "$tagname"; then
1051 3247 hiro
	  func_echo "unable to infer tagged configuration"
1052 3247 hiro
	  func_fatal_error "specify a tag with \`--tag'"
1053 3247 hiro
#	else
1054 3247 hiro
#	  func_verbose "using $tagname tagged configuration"
1055 3247 hiro
	fi
1056 3247 hiro
	;;
1057 3247 hiro
      esac
1058 3247 hiro
    fi
1059 3247 hiro
}
1060 3247 hiro
1061 3247 hiro
1062 3247 hiro
1063 3247 hiro
# func_write_libtool_object output_name pic_name nonpic_name
1064 3247 hiro
# Create a libtool object file (analogous to a ".la" file),
1065 3247 hiro
# but don't create it if we're doing a dry run.
1066 3247 hiro
func_write_libtool_object ()
1067 3247 hiro
{
1068 3247 hiro
    write_libobj=${1}
1069 3247 hiro
    if test "$build_libtool_libs" = yes; then
1070 3247 hiro
      write_lobj=\'${2}\'
1071 3247 hiro
    else
1072 3247 hiro
      write_lobj=none
1073 3247 hiro
    fi
1074 3247 hiro
1075 3247 hiro
    if test "$build_old_libs" = yes; then
1076 3247 hiro
      write_oldobj=\'${3}\'
1077 3247 hiro
    else
1078 3247 hiro
      write_oldobj=none
1079 3247 hiro
    fi
1080 3247 hiro
1081 3247 hiro
    $opt_dry_run || {
1082 3247 hiro
      cat >${write_libobj}T <<EOF
1083 3247 hiro
# $write_libobj - a libtool object file
1084 3247 hiro
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1085 3247 hiro
#
1086 3247 hiro
# Please DO NOT delete this file!
1087 3247 hiro
# It is necessary for linking the library.
1088 3247 hiro
1089 3247 hiro
# Name of the PIC object.
1090 3247 hiro
pic_object=$write_lobj
1091 3247 hiro
1092 3247 hiro
# Name of the non-PIC object
1093 3247 hiro
non_pic_object=$write_oldobj
1094 3247 hiro
1095 3247 hiro
EOF
1096 3247 hiro
      $MV "${write_libobj}T" "${write_libobj}"
1097 3247 hiro
    }
1098 3247 hiro
}
1099 3247 hiro
1100 3247 hiro
# func_mode_compile arg...
1101 3247 hiro
func_mode_compile ()
1102 3247 hiro
{
1103 3247 hiro
    $opt_debug
1104 1 hiro
    # Get the compilation command and the source file.
1105 1 hiro
    base_compile=
1106 1 hiro
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
1107 1 hiro
    suppress_opt=yes
1108 1 hiro
    suppress_output=
1109 1 hiro
    arg_mode=normal
1110 1 hiro
    libobj=
1111 1 hiro
    later=
1112 3247 hiro
    pie_flag=
1113 1 hiro
1114 1 hiro
    for arg
1115 1 hiro
    do
1116 597 hiro
      case $arg_mode in
1117 1 hiro
      arg  )
1118 1 hiro
	# do not "continue".  Instead, add this to base_compile
1119 1 hiro
	lastarg="$arg"
1120 1 hiro
	arg_mode=normal
1121 1 hiro
	;;
1122 1 hiro
1123 1 hiro
      target )
1124 1 hiro
	libobj="$arg"
1125 1 hiro
	arg_mode=normal
1126 1 hiro
	continue
1127 1 hiro
	;;
1128 1 hiro
1129 1 hiro
      normal )
1130 1 hiro
	# Accept any command-line options.
1131 1 hiro
	case $arg in
1132 1 hiro
	-o)
1133 3247 hiro
	  test -n "$libobj" && \
1134 3247 hiro
	    func_fatal_error "you cannot specify \`-o' more than once"
1135 1 hiro
	  arg_mode=target
1136 1 hiro
	  continue
1137 1 hiro
	  ;;
1138 1 hiro
1139 3247 hiro
	-pie | -fpie | -fPIE)
1140 3247 hiro
          pie_flag="$pie_flag $arg"
1141 3247 hiro
	  continue
1142 3247 hiro
	  ;;
1143 3247 hiro
1144 3247 hiro
	-shared | -static | -prefer-pic | -prefer-non-pic)
1145 1 hiro
	  later="$later $arg"
1146 1 hiro
	  continue
1147 1 hiro
	  ;;
1148 1 hiro
1149 1 hiro
	-no-suppress)
1150 1 hiro
	  suppress_opt=no
1151 1 hiro
	  continue
1152 1 hiro
	  ;;
1153 1 hiro
1154 1 hiro
	-Xcompiler)
1155 1 hiro
	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
1156 1 hiro
	  continue      #  The current "srcfile" will either be retained or
1157 1 hiro
	  ;;            #  replaced later.  I would guess that would be a bug.
1158 1 hiro
1159 1 hiro
	-Wc,*)
1160 3247 hiro
	  func_stripname '-Wc,' '' "$arg"
1161 3247 hiro
	  args=$func_stripname_result
1162 1 hiro
	  lastarg=
1163 1 hiro
	  save_ifs="$IFS"; IFS=','
1164 3247 hiro
	  for arg in $args; do
1165 1 hiro
	    IFS="$save_ifs"
1166 3247 hiro
	    func_quote_for_eval "$arg"
1167 3247 hiro
	    lastarg="$lastarg $func_quote_for_eval_result"
1168 1 hiro
	  done
1169 1 hiro
	  IFS="$save_ifs"
1170 3247 hiro
	  func_stripname ' ' '' "$lastarg"
1171 3247 hiro
	  lastarg=$func_stripname_result
1172 1 hiro
1173 1 hiro
	  # Add the arguments to base_compile.
1174 1 hiro
	  base_compile="$base_compile $lastarg"
1175 1 hiro
	  continue
1176 1 hiro
	  ;;
1177 1 hiro
1178 3247 hiro
	*)
1179 1 hiro
	  # Accept the current argument as the source file.
1180 1 hiro
	  # The previous "srcfile" becomes the current argument.
1181 1 hiro
	  #
1182 1 hiro
	  lastarg="$srcfile"
1183 1 hiro
	  srcfile="$arg"
1184 1 hiro
	  ;;
1185 1 hiro
	esac  #  case $arg
1186 1 hiro
	;;
1187 1 hiro
      esac    #  case $arg_mode
1188 1 hiro
1189 1 hiro
      # Aesthetically quote the previous argument.
1190 3247 hiro
      func_quote_for_eval "$lastarg"
1191 3247 hiro
      base_compile="$base_compile $func_quote_for_eval_result"
1192 1 hiro
    done # for arg
1193 1 hiro
1194 1 hiro
    case $arg_mode in
1195 1 hiro
    arg)
1196 3247 hiro
      func_fatal_error "you must specify an argument for -Xcompile"
1197 1 hiro
      ;;
1198 1 hiro
    target)
1199 3247 hiro
      func_fatal_error "you must specify a target with \`-o'"
1200 1 hiro
      ;;
1201 1 hiro
    *)
1202 1 hiro
      # Get the name of the library object.
1203 3247 hiro
      test -z "$libobj" && {
1204 3247 hiro
	func_basename "$srcfile"
1205 3247 hiro
	libobj="$func_basename_result"
1206 3247 hiro
      }
1207 1 hiro
      ;;
1208 1 hiro
    esac
1209 1 hiro
1210 1 hiro
    # Recognize several different file suffixes.
1211 1 hiro
    # If the user specifies -o file.o, it is replaced with file.lo
1212 1 hiro
    case $libobj in
1213 3247 hiro
    *.[cCFSifmso] | \
1214 3247 hiro
    *.ada | *.adb | *.ads | *.asm | \
1215 3247 hiro
    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1216 3247 hiro
    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1217 3247 hiro
      func_xform "$libobj"
1218 3247 hiro
      libobj=$func_xform_result
1219 3247 hiro
      ;;
1220 1 hiro
    esac
1221 1 hiro
1222 1 hiro
    case $libobj in
1223 3247 hiro
    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1224 1 hiro
    *)
1225 3247 hiro
      func_fatal_error "cannot determine name of library object from \`$libobj'"
1226 1 hiro
      ;;
1227 1 hiro
    esac
1228 1 hiro
1229 1 hiro
    func_infer_tag $base_compile
1230 1 hiro
1231 1 hiro
    for arg in $later; do
1232 1 hiro
      case $arg in
1233 3247 hiro
      -shared)
1234 3247 hiro
	test "$build_libtool_libs" != yes && \
1235 3247 hiro
	  func_fatal_configuration "can not build a shared library"
1236 3247 hiro
	build_old_libs=no
1237 3247 hiro
	continue
1238 3247 hiro
	;;
1239 3247 hiro
1240 1 hiro
      -static)
1241 3247 hiro
	build_libtool_libs=no
1242 1 hiro
	build_old_libs=yes
1243 1 hiro
	continue
1244 1 hiro
	;;
1245 1 hiro
1246 1 hiro
      -prefer-pic)
1247 1 hiro
	pic_mode=yes
1248 1 hiro
	continue
1249 1 hiro
	;;
1250 1 hiro
1251 1 hiro
      -prefer-non-pic)
1252 1 hiro
	pic_mode=no
1253 1 hiro
	continue
1254 1 hiro
	;;
1255 1 hiro
      esac
1256 1 hiro
    done
1257 1 hiro
1258 3247 hiro
    func_quote_for_eval "$libobj"
1259 3247 hiro
    test "X$libobj" != "X$func_quote_for_eval_result" \
1260 3247 hiro
      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
1261 3247 hiro
      && func_warning "libobj name \`$libobj' may not contain shell special characters."
1262 3247 hiro
    func_dirname_and_basename "$obj" "/" ""
1263 3247 hiro
    objname="$func_basename_result"
1264 3247 hiro
    xdir="$func_dirname_result"
1265 1 hiro
    lobj=${xdir}$objdir/$objname
1266 1 hiro
1267 3247 hiro
    test -z "$base_compile" && \
1268 3247 hiro
      func_fatal_help "you must specify a compilation command"
1269 1 hiro
1270 1 hiro
    # Delete any leftover library objects.
1271 1 hiro
    if test "$build_old_libs" = yes; then
1272 1 hiro
      removelist="$obj $lobj $libobj ${libobj}T"
1273 1 hiro
    else
1274 1 hiro
      removelist="$lobj $libobj ${libobj}T"
1275 1 hiro
    fi
1276 1 hiro
1277 1 hiro
    # On Cygwin there's no "real" PIC flag so we must build both object types
1278 1 hiro
    case $host_os in
1279 3247 hiro
    cygwin* | mingw* | pw32* | os2* | cegcc*)
1280 1 hiro
      pic_mode=default
1281 1 hiro
      ;;
1282 1 hiro
    esac
1283 1 hiro
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1284 1 hiro
      # non-PIC code in shared libraries is not supported
1285 1 hiro
      pic_mode=default
1286 1 hiro
    fi
1287 1 hiro
1288 1 hiro
    # Calculate the filename of the output object if compiler does
1289 1 hiro
    # not support -o with -c
1290 1 hiro
    if test "$compiler_c_o" = no; then
1291 3247 hiro
      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1292 1 hiro
      lockfile="$output_obj.lock"
1293 1 hiro
    else
1294 1 hiro
      output_obj=
1295 1 hiro
      need_locks=no
1296 1 hiro
      lockfile=
1297 1 hiro
    fi
1298 1 hiro
1299 1 hiro
    # Lock this critical section if it is needed
1300 1 hiro
    # We use this script file to make the link, it avoids creating a new file
1301 1 hiro
    if test "$need_locks" = yes; then
1302 3247 hiro
      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1303 3247 hiro
	func_echo "Waiting for $lockfile to be removed"
1304 1 hiro
	sleep 2
1305 1 hiro
      done
1306 1 hiro
    elif test "$need_locks" = warn; then
1307 1 hiro
      if test -f "$lockfile"; then
1308 3247 hiro
	$ECHO "\
1309 1 hiro
*** ERROR, $lockfile exists and contains:
1310 1 hiro
`cat $lockfile 2>/dev/null`
1311 1 hiro
1312 1 hiro
This indicates that another process is trying to use the same
1313 1 hiro
temporary object file, and libtool could not work around it because
1314 1 hiro
your compiler does not support \`-c' and \`-o' together.  If you
1315 1 hiro
repeat this compilation, it may succeed, by chance, but you had better
1316 1 hiro
avoid parallel builds (make -j) in this platform, or get a better
1317 1 hiro
compiler."
1318 1 hiro
1319 3247 hiro
	$opt_dry_run || $RM $removelist
1320 1 hiro
	exit $EXIT_FAILURE
1321 1 hiro
      fi
1322 3247 hiro
      removelist="$removelist $output_obj"
1323 3247 hiro
      $ECHO "$srcfile" > "$lockfile"
1324 1 hiro
    fi
1325 1 hiro
1326 3247 hiro
    $opt_dry_run || $RM $removelist
1327 3247 hiro
    removelist="$removelist $lockfile"
1328 3247 hiro
    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1329 3247 hiro
1330 1 hiro
    if test -n "$fix_srcfile_path"; then
1331 1 hiro
      eval srcfile=\"$fix_srcfile_path\"
1332 1 hiro
    fi
1333 3247 hiro
    func_quote_for_eval "$srcfile"
1334 3247 hiro
    qsrcfile=$func_quote_for_eval_result
1335 1 hiro
1336 1 hiro
    # Only build a PIC object if we are building libtool libraries.
1337 1 hiro
    if test "$build_libtool_libs" = yes; then
1338 1 hiro
      # Without this assignment, base_compile gets emptied.
1339 1 hiro
      fbsd_hideous_sh_bug=$base_compile
1340 1 hiro
1341 1 hiro
      if test "$pic_mode" != no; then
1342 597 hiro
	command="$base_compile $qsrcfile $pic_flag"
1343 1 hiro
      else
1344 1 hiro
	# Don't build PIC code
1345 597 hiro
	command="$base_compile $qsrcfile"
1346 1 hiro
      fi
1347 1 hiro
1348 3247 hiro
      func_mkdir_p "$xdir$objdir"
1349 1 hiro
1350 1 hiro
      if test -z "$output_obj"; then
1351 1 hiro
	# Place PIC objects in $objdir
1352 1 hiro
	command="$command -o $lobj"
1353 1 hiro
      fi
1354 1 hiro
1355 3247 hiro
      func_show_eval_locale "$command"	\
1356 3247 hiro
          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1357 1 hiro
1358 1 hiro
      if test "$need_locks" = warn &&
1359 1 hiro
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1360 3247 hiro
	$ECHO "\
1361 1 hiro
*** ERROR, $lockfile contains:
1362 1 hiro
`cat $lockfile 2>/dev/null`
1363 1 hiro
1364 1 hiro
but it should contain:
1365 1 hiro
$srcfile
1366 1 hiro
1367 1 hiro
This indicates that another process is trying to use the same
1368 1 hiro
temporary object file, and libtool could not work around it because
1369 1 hiro
your compiler does not support \`-c' and \`-o' together.  If you
1370 1 hiro
repeat this compilation, it may succeed, by chance, but you had better
1371 1 hiro
avoid parallel builds (make -j) in this platform, or get a better
1372 1 hiro
compiler."
1373 1 hiro
1374 3247 hiro
	$opt_dry_run || $RM $removelist
1375 1 hiro
	exit $EXIT_FAILURE
1376 1 hiro
      fi
1377 1 hiro
1378 1 hiro
      # Just move the object if needed, then go on to compile the next one
1379 1 hiro
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1380 3247 hiro
	func_show_eval '$MV "$output_obj" "$lobj"' \
1381 3247 hiro
	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1382 1 hiro
      fi
1383 1 hiro
1384 1 hiro
      # Allow error messages only from the first compilation.
1385 1 hiro
      if test "$suppress_opt" = yes; then
1386 3247 hiro
	suppress_output=' >/dev/null 2>&1'
1387 1 hiro
      fi
1388 1 hiro
    fi
1389 1 hiro
1390 1 hiro
    # Only build a position-dependent object if we build old libraries.
1391 1 hiro
    if test "$build_old_libs" = yes; then
1392 1 hiro
      if test "$pic_mode" != yes; then
1393 1 hiro
	# Don't build PIC code
1394 3247 hiro
	command="$base_compile $qsrcfile$pie_flag"
1395 1 hiro
      else
1396 597 hiro
	command="$base_compile $qsrcfile $pic_flag"
1397 1 hiro
      fi
1398 1 hiro
      if test "$compiler_c_o" = yes; then
1399 1 hiro
	command="$command -o $obj"
1400 1 hiro
      fi
1401 1 hiro
1402 1 hiro
      # Suppress compiler output if we already did a PIC compilation.
1403 1 hiro
      command="$command$suppress_output"
1404 3247 hiro
      func_show_eval_locale "$command" \
1405 3247 hiro
        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1406 1 hiro
1407 1 hiro
      if test "$need_locks" = warn &&
1408 1 hiro
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1409 3247 hiro
	$ECHO "\
1410 1 hiro
*** ERROR, $lockfile contains:
1411 1 hiro
`cat $lockfile 2>/dev/null`
1412 1 hiro
1413 1 hiro
but it should contain:
1414 1 hiro
$srcfile
1415 1 hiro
1416 1 hiro
This indicates that another process is trying to use the same
1417 1 hiro
temporary object file, and libtool could not work around it because
1418 1 hiro
your compiler does not support \`-c' and \`-o' together.  If you
1419 1 hiro
repeat this compilation, it may succeed, by chance, but you had better
1420 1 hiro
avoid parallel builds (make -j) in this platform, or get a better
1421 1 hiro
compiler."
1422 1 hiro
1423 3247 hiro
	$opt_dry_run || $RM $removelist
1424 1 hiro
	exit $EXIT_FAILURE
1425 1 hiro
      fi
1426 1 hiro
1427 1 hiro
      # Just move the object if needed
1428 1 hiro
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1429 3247 hiro
	func_show_eval '$MV "$output_obj" "$obj"' \
1430 3247 hiro
	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1431 3247 hiro
      fi
1432 3247 hiro
    fi
1433 3247 hiro
1434 3247 hiro
    $opt_dry_run || {
1435 3247 hiro
      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1436 3247 hiro
1437 3247 hiro
      # Unlock the critical section if it was locked
1438 3247 hiro
      if test "$need_locks" != no; then
1439 3247 hiro
	removelist=$lockfile
1440 3247 hiro
        $RM "$lockfile"
1441 3247 hiro
      fi
1442 3247 hiro
    }
1443 3247 hiro
1444 3247 hiro
    exit $EXIT_SUCCESS
1445 3247 hiro
}
1446 3247 hiro
1447 3247 hiro
$opt_help || {
1448 3247 hiro
test "$mode" = compile && func_mode_compile ${1+"$@"}
1449 3247 hiro
}
1450 3247 hiro
1451 3247 hiro
func_mode_help ()
1452 3247 hiro
{
1453 3247 hiro
    # We need to display help for each of the modes.
1454 3247 hiro
    case $mode in
1455 3247 hiro
      "")
1456 3247 hiro
        # Generic help is extracted from the usage comments
1457 3247 hiro
        # at the start of this file.
1458 3247 hiro
        func_help
1459 3247 hiro
        ;;
1460 3247 hiro
1461 3247 hiro
      clean)
1462 3247 hiro
        $ECHO \
1463 3247 hiro
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1464 3247 hiro
1465 3247 hiro
Remove files from the build directory.
1466 3247 hiro
1467 3247 hiro
RM is the name of the program to use to delete files associated with each FILE
1468 3247 hiro
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
1469 3247 hiro
to RM.
1470 3247 hiro
1471 3247 hiro
If FILE is a libtool library, object or program, all the files associated
1472 3247 hiro
with it are deleted. Otherwise, only FILE itself is deleted using RM."
1473 3247 hiro
        ;;
1474 3247 hiro
1475 3247 hiro
      compile)
1476 3247 hiro
      $ECHO \
1477 3247 hiro
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1478 3247 hiro
1479 3247 hiro
Compile a source file into a libtool library object.
1480 3247 hiro
1481 3247 hiro
This mode accepts the following additional options:
1482 3247 hiro
1483 3247 hiro
  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
1484 3247 hiro
  -no-suppress      do not suppress compiler output for multiple passes
1485 3247 hiro
  -prefer-pic       try to building PIC objects only
1486 3247 hiro
  -prefer-non-pic   try to building non-PIC objects only
1487 3247 hiro
  -shared           do not build a \`.o' file suitable for static linking
1488 3247 hiro
  -static           only build a \`.o' file suitable for static linking
1489 3247 hiro
1490 3247 hiro
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1491 3247 hiro
from the given SOURCEFILE.
1492 3247 hiro
1493 3247 hiro
The output file name is determined by removing the directory component from
1494 3247 hiro
SOURCEFILE, then substituting the C source code suffix \`.c' with the
1495 3247 hiro
library object suffix, \`.lo'."
1496 3247 hiro
        ;;
1497 3247 hiro
1498 3247 hiro
      execute)
1499 3247 hiro
        $ECHO \
1500 3247 hiro
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1501 3247 hiro
1502 3247 hiro
Automatically set library path, then run a program.
1503 3247 hiro
1504 3247 hiro
This mode accepts the following additional options:
1505 3247 hiro
1506 3247 hiro
  -dlopen FILE      add the directory containing FILE to the library path
1507 3247 hiro
1508 3247 hiro
This mode sets the library path environment variable according to \`-dlopen'
1509 3247 hiro
flags.
1510 3247 hiro
1511 3247 hiro
If any of the ARGS are libtool executable wrappers, then they are translated
1512 3247 hiro
into their corresponding uninstalled binary, and any of their required library
1513 3247 hiro
directories are added to the library path.
1514 3247 hiro
1515 3247 hiro
Then, COMMAND is executed, with ARGS as arguments."
1516 3247 hiro
        ;;
1517 3247 hiro
1518 3247 hiro
      finish)
1519 3247 hiro
        $ECHO \
1520 3247 hiro
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1521 3247 hiro
1522 3247 hiro
Complete the installation of libtool libraries.
1523 3247 hiro
1524 3247 hiro
Each LIBDIR is a directory that contains libtool libraries.
1525 3247 hiro
1526 3247 hiro
The commands that this mode executes may require superuser privileges.  Use
1527 3247 hiro
the \`--dry-run' option if you just want to see what would be executed."
1528 3247 hiro
        ;;
1529 3247 hiro
1530 3247 hiro
      install)
1531 3247 hiro
        $ECHO \
1532 3247 hiro
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1533 3247 hiro
1534 3247 hiro
Install executables or libraries.
1535 3247 hiro
1536 3247 hiro
INSTALL-COMMAND is the installation command.  The first component should be
1537 3247 hiro
either the \`install' or \`cp' program.
1538 3247 hiro
1539 3247 hiro
The following components of INSTALL-COMMAND are treated specially:
1540 3247 hiro
1541 3247 hiro
  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
1542 3247 hiro
1543 3247 hiro
The rest of the components are interpreted as arguments to that command (only
1544 3247 hiro
BSD-compatible install options are recognized)."
1545 3247 hiro
        ;;
1546 3247 hiro
1547 3247 hiro
      link)
1548 3247 hiro
        $ECHO \
1549 3247 hiro
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1550 3247 hiro
1551 3247 hiro
Link object files or libraries together to form another library, or to
1552 3247 hiro
create an executable program.
1553 3247 hiro
1554 3247 hiro
LINK-COMMAND is a command using the C compiler that you would use to create
1555 3247 hiro
a program from several object files.
1556 3247 hiro
1557 3247 hiro
The following components of LINK-COMMAND are treated specially:
1558 3247 hiro
1559 3247 hiro
  -all-static       do not do any dynamic linking at all
1560 3247 hiro
  -avoid-version    do not add a version suffix if possible
1561 3247 hiro
  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
1562 3247 hiro
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
1563 3247 hiro
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1564 3247 hiro
  -export-symbols SYMFILE
1565 3247 hiro
                    try to export only the symbols listed in SYMFILE
1566 3247 hiro
  -export-symbols-regex REGEX
1567 3247 hiro
                    try to export only the symbols matching REGEX
1568 3247 hiro
  -LLIBDIR          search LIBDIR for required installed libraries
1569 3247 hiro
  -lNAME            OUTPUT-FILE requires the installed library libNAME
1570 3247 hiro
  -module           build a library that can dlopened
1571 3247 hiro
  -no-fast-install  disable the fast-install mode
1572 3247 hiro
  -no-install       link a not-installable executable
1573 3247 hiro
  -no-undefined     declare that a library does not refer to external symbols
1574 3247 hiro
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
1575 3247 hiro
  -objectlist FILE  Use a list of object files found in FILE to specify objects
1576 3247 hiro
  -precious-files-regex REGEX
1577 3247 hiro
                    don't remove output files matching REGEX
1578 3247 hiro
  -release RELEASE  specify package release information
1579 3247 hiro
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
1580 3247 hiro
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
1581 3247 hiro
  -shared           only do dynamic linking of libtool libraries
1582 3247 hiro
  -shrext SUFFIX    override the standard shared library file extension
1583 3247 hiro
  -static           do not do any dynamic linking of uninstalled libtool libraries
1584 3247 hiro
  -static-libtool-libs
1585 3247 hiro
                    do not do any dynamic linking of libtool libraries
1586 3247 hiro
  -version-info CURRENT[:REVISION[:AGE]]
1587 3247 hiro
                    specify library version info [each variable defaults to 0]
1588 3247 hiro
  -weak LIBNAME     declare that the target provides the LIBNAME interface
1589 3247 hiro
1590 3247 hiro
All other options (arguments beginning with \`-') are ignored.
1591 3247 hiro
1592 3247 hiro
Every other argument is treated as a filename.  Files ending in \`.la' are
1593 3247 hiro
treated as uninstalled libtool libraries, other files are standard or library
1594 3247 hiro
object files.
1595 3247 hiro
1596 3247 hiro
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1597 3247 hiro
only library objects (\`.lo' files) may be specified, and \`-rpath' is
1598 3247 hiro
required, except when creating a convenience library.
1599 3247 hiro
1600 3247 hiro
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1601 3247 hiro
using \`ar' and \`ranlib', or on Windows using \`lib'.
1602 3247 hiro
1603 3247 hiro
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1604 3247 hiro
is created, otherwise an executable program is created."
1605 3247 hiro
        ;;
1606 3247 hiro
1607 3247 hiro
      uninstall)
1608 3247 hiro
        $ECHO \
1609 3247 hiro
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1610 3247 hiro
1611 3247 hiro
Remove libraries from an installation directory.
1612 3247 hiro
1613 3247 hiro
RM is the name of the program to use to delete files associated with each FILE
1614 3247 hiro
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
1615 3247 hiro
to RM.
1616 3247 hiro
1617 3247 hiro
If FILE is a libtool library, all the files associated with it are deleted.
1618 3247 hiro
Otherwise, only FILE itself is deleted using RM."
1619 3247 hiro
        ;;
1620 3247 hiro
1621 3247 hiro
      *)
1622 3247 hiro
        func_fatal_help "invalid operation mode \`$mode'"
1623 3247 hiro
        ;;
1624 3247 hiro
    esac
1625 3247 hiro
1626 3247 hiro
    $ECHO
1627 3247 hiro
    $ECHO "Try \`$progname --help' for more information about other modes."
1628 3247 hiro
1629 3247 hiro
    exit $?
1630 3247 hiro
}
1631 3247 hiro
1632 3247 hiro
  # Now that we've collected a possible --mode arg, show help if necessary
1633 3247 hiro
  $opt_help && func_mode_help
1634 3247 hiro
1635 3247 hiro
1636 3247 hiro
# func_mode_execute arg...
1637 3247 hiro
func_mode_execute ()
1638 3247 hiro
{
1639 3247 hiro
    $opt_debug
1640 3247 hiro
    # The first argument is the command name.
1641 3247 hiro
    cmd="$nonopt"
1642 3247 hiro
    test -z "$cmd" && \
1643 3247 hiro
      func_fatal_help "you must specify a COMMAND"
1644 3247 hiro
1645 3247 hiro
    # Handle -dlopen flags immediately.
1646 3247 hiro
    for file in $execute_dlfiles; do
1647 3247 hiro
      test -f "$file" \
1648 3247 hiro
	|| func_fatal_help "\`$file' is not a file"
1649 3247 hiro
1650 3247 hiro
      dir=
1651 3247 hiro
      case $file in
1652 3247 hiro
      *.la)
1653 3247 hiro
	# Check to see that this really is a libtool archive.
1654 3247 hiro
	func_lalib_unsafe_p "$file" \
1655 3247 hiro
	  || func_fatal_help "\`$lib' is not a valid libtool archive"
1656 3247 hiro
1657 3247 hiro
	# Read the libtool library.
1658 3247 hiro
	dlname=
1659 3247 hiro
	library_names=
1660 3247 hiro
	func_source "$file"
1661 3247 hiro
1662 3247 hiro
	# Skip this library if it cannot be dlopened.
1663 3247 hiro
	if test -z "$dlname"; then
1664 3247 hiro
	  # Warn if it was a shared library.
1665 3247 hiro
	  test -n "$library_names" && \
1666 3247 hiro
	    func_warning "\`$file' was not linked with \`-export-dynamic'"
1667 3247 hiro
	  continue
1668 3247 hiro
	fi
1669 3247 hiro
1670 3247 hiro
	func_dirname "$file" "" "."
1671 3247 hiro
	dir="$func_dirname_result"
1672 3247 hiro
1673 3247 hiro
	if test -f "$dir/$objdir/$dlname"; then
1674 3247 hiro
	  dir="$dir/$objdir"
1675 1 hiro
	else
1676 3247 hiro
	  if test ! -f "$dir/$dlname"; then
1677 3247 hiro
	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1678 3247 hiro
	  fi
1679 1 hiro
	fi
1680 3247 hiro
	;;
1681 3247 hiro
1682 3247 hiro
      *.lo)
1683 3247 hiro
	# Just add the directory containing the .lo file.
1684 3247 hiro
	func_dirname "$file" "" "."
1685 3247 hiro
	dir="$func_dirname_result"
1686 3247 hiro
	;;
1687 3247 hiro
1688 3247 hiro
      *)
1689 3247 hiro
	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1690 3247 hiro
	continue
1691 3247 hiro
	;;
1692 3247 hiro
      esac
1693 3247 hiro
1694 3247 hiro
      # Get the absolute pathname.
1695 3247 hiro
      absdir=`cd "$dir" && pwd`
1696 3247 hiro
      test -n "$absdir" && dir="$absdir"
1697 3247 hiro
1698 3247 hiro
      # Now add the directory to shlibpath_var.
1699 3247 hiro
      if eval "test -z \"\$$shlibpath_var\""; then
1700 3247 hiro
	eval "$shlibpath_var=\"\$dir\""
1701 3247 hiro
      else
1702 3247 hiro
	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1703 1 hiro
      fi
1704 3247 hiro
    done
1705 1 hiro
1706 3247 hiro
    # This variable tells wrapper scripts just to set shlibpath_var
1707 3247 hiro
    # rather than running their programs.
1708 3247 hiro
    libtool_execute_magic="$magic"
1709 1 hiro
1710 3247 hiro
    # Check if any of the arguments is a wrapper script.
1711 3247 hiro
    args=
1712 3247 hiro
    for file
1713 3247 hiro
    do
1714 3247 hiro
      case $file in
1715 3247 hiro
      -*) ;;
1716 3247 hiro
      *)
1717 3247 hiro
	# Do a test to see if this is really a libtool program.
1718 3247 hiro
	if func_ltwrapper_script_p "$file"; then
1719 3247 hiro
	  func_source "$file"
1720 3247 hiro
	  # Transform arg to wrapped name.
1721 3247 hiro
	  file="$progdir/$program"
1722 3247 hiro
	elif func_ltwrapper_executable_p "$file"; then
1723 3247 hiro
	  func_ltwrapper_scriptname "$file"
1724 3247 hiro
	  func_source "$func_ltwrapper_scriptname_result"
1725 3247 hiro
	  # Transform arg to wrapped name.
1726 3247 hiro
	  file="$progdir/$program"
1727 3247 hiro
	fi
1728 3247 hiro
	;;
1729 3247 hiro
      esac
1730 3247 hiro
      # Quote arguments (to preserve shell metacharacters).
1731 3247 hiro
      func_quote_for_eval "$file"
1732 3247 hiro
      args="$args $func_quote_for_eval_result"
1733 3247 hiro
    done
1734 3247 hiro
1735 3247 hiro
    if test "X$opt_dry_run" = Xfalse; then
1736 3247 hiro
      if test -n "$shlibpath_var"; then
1737 3247 hiro
	# Export the shlibpath_var.
1738 3247 hiro
	eval "export $shlibpath_var"
1739 3247 hiro
      fi
1740 3247 hiro
1741 3247 hiro
      # Restore saved environment variables
1742 3247 hiro
      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1743 3247 hiro
      do
1744 3247 hiro
	eval "if test \"\${save_$lt_var+set}\" = set; then
1745 3247 hiro
                $lt_var=\$save_$lt_var; export $lt_var
1746 3247 hiro
	      else
1747 3247 hiro
		$lt_unset $lt_var
1748 3247 hiro
	      fi"
1749 3247 hiro
      done
1750 3247 hiro
1751 3247 hiro
      # Now prepare to actually exec the command.
1752 3247 hiro
      exec_cmd="\$cmd$args"
1753 1 hiro
    else
1754 3247 hiro
      # Display what would be done.
1755 3247 hiro
      if test -n "$shlibpath_var"; then
1756 3247 hiro
	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1757 3247 hiro
	$ECHO "export $shlibpath_var"
1758 3247 hiro
      fi
1759 3247 hiro
      $ECHO "$cmd$args"
1760 3247 hiro
      exit $EXIT_SUCCESS
1761 3247 hiro
    fi
1762 3247 hiro
}
1763 1 hiro
1764 3247 hiro
test "$mode" = execute && func_mode_execute ${1+"$@"}
1765 3247 hiro
1766 3247 hiro
1767 3247 hiro
# func_mode_finish arg...
1768 3247 hiro
func_mode_finish ()
1769 3247 hiro
{
1770 3247 hiro
    $opt_debug
1771 3247 hiro
    libdirs="$nonopt"
1772 3247 hiro
    admincmds=
1773 3247 hiro
1774 3247 hiro
    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1775 3247 hiro
      for dir
1776 3247 hiro
      do
1777 3247 hiro
	libdirs="$libdirs $dir"
1778 3247 hiro
      done
1779 3247 hiro
1780 3247 hiro
      for libdir in $libdirs; do
1781 3247 hiro
	if test -n "$finish_cmds"; then
1782 3247 hiro
	  # Do each command in the finish commands.
1783 3247 hiro
	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1784 3247 hiro
'"$cmd"'"'
1785 3247 hiro
	fi
1786 3247 hiro
	if test -n "$finish_eval"; then
1787 3247 hiro
	  # Do the single finish_eval.
1788 3247 hiro
	  eval cmds=\"$finish_eval\"
1789 3247 hiro
	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
1790 3247 hiro
       $cmds"
1791 3247 hiro
	fi
1792 3247 hiro
      done
1793 1 hiro
    fi
1794 1 hiro
1795 3247 hiro
    # Exit here if they wanted silent mode.
1796 3247 hiro
    $opt_silent && exit $EXIT_SUCCESS
1797 1 hiro
1798 3247 hiro
    $ECHO "X----------------------------------------------------------------------" | $Xsed
1799 3247 hiro
    $ECHO "Libraries have been installed in:"
1800 3247 hiro
    for libdir in $libdirs; do
1801 3247 hiro
      $ECHO "   $libdir"
1802 3247 hiro
    done
1803 3247 hiro
    $ECHO
1804 3247 hiro
    $ECHO "If you ever happen to want to link against installed libraries"
1805 3247 hiro
    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
1806 3247 hiro
    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
1807 3247 hiro
    $ECHO "flag during linking and do at least one of the following:"
1808 3247 hiro
    if test -n "$shlibpath_var"; then
1809 3247 hiro
      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
1810 3247 hiro
      $ECHO "     during execution"
1811 1 hiro
    fi
1812 3247 hiro
    if test -n "$runpath_var"; then
1813 3247 hiro
      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
1814 3247 hiro
      $ECHO "     during linking"
1815 3247 hiro
    fi
1816 3247 hiro
    if test -n "$hardcode_libdir_flag_spec"; then
1817 3247 hiro
      libdir=LIBDIR
1818 3247 hiro
      eval flag=\"$hardcode_libdir_flag_spec\"
1819 1 hiro
1820 3247 hiro
      $ECHO "   - use the \`$flag' linker flag"
1821 3247 hiro
    fi
1822 3247 hiro
    if test -n "$admincmds"; then
1823 3247 hiro
      $ECHO "   - have your system administrator run these commands:$admincmds"
1824 3247 hiro
    fi
1825 3247 hiro
    if test -f /etc/ld.so.conf; then
1826 3247 hiro
      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1827 3247 hiro
    fi
1828 3247 hiro
    $ECHO
1829 3247 hiro
1830 3247 hiro
    $ECHO "See any operating system documentation about shared libraries for"
1831 3247 hiro
    case $host in
1832 3247 hiro
      solaris2.[6789]|solaris2.1[0-9])
1833 3247 hiro
        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1834 3247 hiro
	$ECHO "pages."
1835 3247 hiro
	;;
1836 3247 hiro
      *)
1837 3247 hiro
        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
1838 3247 hiro
        ;;
1839 3247 hiro
    esac
1840 3247 hiro
    $ECHO "X----------------------------------------------------------------------" | $Xsed
1841 1 hiro
    exit $EXIT_SUCCESS
1842 3247 hiro
}
1843 3247 hiro
1844 3247 hiro
test "$mode" = finish && func_mode_finish ${1+"$@"}
1845 3247 hiro
1846 3247 hiro
1847 3247 hiro
# func_mode_install arg...
1848 3247 hiro
func_mode_install ()
1849 3247 hiro
{
1850 3247 hiro
    $opt_debug
1851 3247 hiro
    # There may be an optional sh(1) argument at the beginning of
1852 3247 hiro
    # install_prog (especially on Windows NT).
1853 3247 hiro
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
1854 3247 hiro
       # Allow the use of GNU shtool's install command.
1855 3247 hiro
       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
1856 3247 hiro
      # Aesthetically quote it.
1857 3247 hiro
      func_quote_for_eval "$nonopt"
1858 3247 hiro
      install_prog="$func_quote_for_eval_result "
1859 3247 hiro
      arg=$1
1860 3247 hiro
      shift
1861 3247 hiro
    else
1862 3247 hiro
      install_prog=
1863 3247 hiro
      arg=$nonopt
1864 3247 hiro
    fi
1865 3247 hiro
1866 3247 hiro
    # The real first argument should be the name of the installation program.
1867 3247 hiro
    # Aesthetically quote it.
1868 3247 hiro
    func_quote_for_eval "$arg"
1869 3247 hiro
    install_prog="$install_prog$func_quote_for_eval_result"
1870 3247 hiro
1871 3247 hiro
    # We need to accept at least all the BSD install flags.
1872 3247 hiro
    dest=
1873 3247 hiro
    files=
1874 3247 hiro
    opts=
1875 3247 hiro
    prev=
1876 3247 hiro
    install_type=
1877 3247 hiro
    isdir=no
1878 3247 hiro
    stripme=
1879 3247 hiro
    for arg
1880 3247 hiro
    do
1881 3247 hiro
      if test -n "$dest"; then
1882 3247 hiro
	files="$files $dest"
1883 3247 hiro
	dest=$arg
1884 3247 hiro
	continue
1885 3247 hiro
      fi
1886 3247 hiro
1887 3247 hiro
      case $arg in
1888 3247 hiro
      -d) isdir=yes ;;
1889 3247 hiro
      -f)
1890 3247 hiro
	case " $install_prog " in
1891 3247 hiro
	*[\\\ /]cp\ *) ;;
1892 3247 hiro
	*) prev=$arg ;;
1893 3247 hiro
	esac
1894 3247 hiro
	;;
1895 3247 hiro
      -g | -m | -o)
1896 3247 hiro
	prev=$arg
1897 3247 hiro
	;;
1898 3247 hiro
      -s)
1899 3247 hiro
	stripme=" -s"
1900 3247 hiro
	continue
1901 3247 hiro
	;;
1902 3247 hiro
      -*)
1903 3247 hiro
	;;
1904 3247 hiro
      *)
1905 3247 hiro
	# If the previous option needed an argument, then skip it.
1906 3247 hiro
	if test -n "$prev"; then
1907 3247 hiro
	  prev=
1908 3247 hiro
	else
1909 3247 hiro
	  dest=$arg
1910 3247 hiro
	  continue
1911 3247 hiro
	fi
1912 3247 hiro
	;;
1913 3247 hiro
      esac
1914 3247 hiro
1915 3247 hiro
      # Aesthetically quote the argument.
1916 3247 hiro
      func_quote_for_eval "$arg"
1917 3247 hiro
      install_prog="$install_prog $func_quote_for_eval_result"
1918 3247 hiro
    done
1919 3247 hiro
1920 3247 hiro
    test -z "$install_prog" && \
1921 3247 hiro
      func_fatal_help "you must specify an install program"
1922 3247 hiro
1923 3247 hiro
    test -n "$prev" && \
1924 3247 hiro
      func_fatal_help "the \`$prev' option requires an argument"
1925 3247 hiro
1926 3247 hiro
    if test -z "$files"; then
1927 3247 hiro
      if test -z "$dest"; then
1928 3247 hiro
	func_fatal_help "no file or destination specified"
1929 3247 hiro
      else
1930 3247 hiro
	func_fatal_help "you must specify a destination"
1931 3247 hiro
      fi
1932 3247 hiro
    fi
1933 3247 hiro
1934 3247 hiro
    # Strip any trailing slash from the destination.
1935 3247 hiro
    func_stripname '' '/' "$dest"
1936 3247 hiro
    dest=$func_stripname_result
1937 3247 hiro
1938 3247 hiro
    # Check to see that the destination is a directory.
1939 3247 hiro
    test -d "$dest" && isdir=yes
1940 3247 hiro
    if test "$isdir" = yes; then
1941 3247 hiro
      destdir="$dest"
1942 3247 hiro
      destname=
1943 3247 hiro
    else
1944 3247 hiro
      func_dirname_and_basename "$dest" "" "."
1945 3247 hiro
      destdir="$func_dirname_result"
1946 3247 hiro
      destname="$func_basename_result"
1947 3247 hiro
1948 3247 hiro
      # Not a directory, so check to see that there is only one file specified.
1949 3247 hiro
      set dummy $files; shift
1950 3247 hiro
      test "$#" -gt 1 && \
1951 3247 hiro
	func_fatal_help "\`$dest' is not a directory"
1952 3247 hiro
    fi
1953 3247 hiro
    case $destdir in
1954 3247 hiro
    [\\/]* | [A-Za-z]:[\\/]*) ;;
1955 3247 hiro
    *)
1956 3247 hiro
      for file in $files; do
1957 3247 hiro
	case $file in
1958 3247 hiro
	*.lo) ;;
1959 3247 hiro
	*)
1960 3247 hiro
	  func_fatal_help "\`$destdir' must be an absolute directory name"
1961 3247 hiro
	  ;;
1962 3247 hiro
	esac
1963 3247 hiro
      done
1964 3247 hiro
      ;;
1965 3247 hiro
    esac
1966 3247 hiro
1967 3247 hiro
    # This variable tells wrapper scripts just to set variables rather
1968 3247 hiro
    # than running their programs.
1969 3247 hiro
    libtool_install_magic="$magic"
1970 3247 hiro
1971 3247 hiro
    staticlibs=
1972 3247 hiro
    future_libdirs=
1973 3247 hiro
    current_libdirs=
1974 3247 hiro
    for file in $files; do
1975 3247 hiro
1976 3247 hiro
      # Do each installation.
1977 3247 hiro
      case $file in
1978 3247 hiro
      *.$libext)
1979 3247 hiro
	# Do the static libraries later.
1980 3247 hiro
	staticlibs="$staticlibs $file"
1981 3247 hiro
	;;
1982 3247 hiro
1983 3247 hiro
      *.la)
1984 3247 hiro
	# Check to see that this really is a libtool archive.
1985 3247 hiro
	func_lalib_unsafe_p "$file" \
1986 3247 hiro
	  || func_fatal_help "\`$file' is not a valid libtool archive"
1987 3247 hiro
1988 3247 hiro
	library_names=
1989 3247 hiro
	old_library=
1990 3247 hiro
	relink_command=
1991 3247 hiro
	func_source "$file"
1992 3247 hiro
1993 3247 hiro
	# Add the libdir to current_libdirs if it is the destination.
1994 3247 hiro
	if test "X$destdir" = "X$libdir"; then
1995 3247 hiro
	  case "$current_libdirs " in
1996 3247 hiro
	  *" $libdir "*) ;;
1997 3247 hiro
	  *) current_libdirs="$current_libdirs $libdir" ;;
1998 3247 hiro
	  esac
1999 3247 hiro
	else
2000 3247 hiro
	  # Note the libdir as a future libdir.
2001 3247 hiro
	  case "$future_libdirs " in
2002 3247 hiro
	  *" $libdir "*) ;;
2003 3247 hiro
	  *) future_libdirs="$future_libdirs $libdir" ;;
2004 3247 hiro
	  esac
2005 3247 hiro
	fi
2006 3247 hiro
2007 3247 hiro
	func_dirname "$file" "/" ""
2008 3247 hiro
	dir="$func_dirname_result"
2009 3247 hiro
	dir="$dir$objdir"
2010 3247 hiro
2011 3247 hiro
	if test -n "$relink_command"; then
2012 3247 hiro
	  # Determine the prefix the user has applied to our future dir.
2013 3247 hiro
	  inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2014 3247 hiro
2015 3247 hiro
	  # Don't allow the user to place us outside of our expected
2016 3247 hiro
	  # location b/c this prevents finding dependent libraries that
2017 3247 hiro
	  # are installed to the same prefix.
2018 3247 hiro
	  # At present, this check doesn't affect windows .dll's that
2019 3247 hiro
	  # are installed into $libdir/../bin (currently, that works fine)
2020 3247 hiro
	  # but it's something to keep an eye on.
2021 3247 hiro
	  test "$inst_prefix_dir" = "$destdir" && \
2022 3247 hiro
	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2023 3247 hiro
2024 3247 hiro
	  if test -n "$inst_prefix_dir"; then
2025 3247 hiro
	    # Stick the inst_prefix_dir data into the link command.
2026 3247 hiro
	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2027 3247 hiro
	  else
2028 3247 hiro
	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2029 3247 hiro
	  fi
2030 3247 hiro
2031 3247 hiro
	  func_warning "relinking \`$file'"
2032 3247 hiro
	  func_show_eval "$relink_command" \
2033 3247 hiro
	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2034 3247 hiro
	fi
2035 3247 hiro
2036 3247 hiro
	# See the names of the shared library.
2037 3247 hiro
	set dummy $library_names; shift
2038 3247 hiro
	if test -n "$1"; then
2039 3247 hiro
	  realname="$1"
2040 3247 hiro
	  shift
2041 3247 hiro
2042 3247 hiro
	  srcname="$realname"
2043 3247 hiro
	  test -n "$relink_command" && srcname="$realname"T
2044 3247 hiro
2045 3247 hiro
	  # Install the shared library and build the symlinks.
2046 3247 hiro
	  func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2047 3247 hiro
	      'exit $?'
2048 3247 hiro
	  tstripme="$stripme"
2049 3247 hiro
	  case $host_os in
2050 3247 hiro
	  cygwin* | mingw* | pw32* | cegcc*)
2051 3247 hiro
	    case $realname in
2052 3247 hiro
	    *.dll.a)
2053 3247 hiro
	      tstripme=""
2054 3247 hiro
	      ;;
2055 3247 hiro
	    esac
2056 3247 hiro
	    ;;
2057 3247 hiro
	  esac
2058 3247 hiro
	  if test -n "$tstripme" && test -n "$striplib"; then
2059 3247 hiro
	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
2060 3247 hiro
	  fi
2061 3247 hiro
2062 3247 hiro
	  if test "$#" -gt 0; then
2063 3247 hiro
	    # Delete the old symlinks, and create new ones.
2064 3247 hiro
	    # Try `ln -sf' first, because the `ln' binary might depend on
2065 3247 hiro
	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
2066 3247 hiro
	    # so we also need to try rm && ln -s.
2067 3247 hiro
	    for linkname
2068 3247 hiro
	    do
2069 3247 hiro
	      test "$linkname" != "$realname" \
2070 3247 hiro
		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2071 3247 hiro
	    done
2072 3247 hiro
	  fi
2073 3247 hiro
2074 3247 hiro
	  # Do each command in the postinstall commands.
2075 3247 hiro
	  lib="$destdir/$realname"
2076 3247 hiro
	  func_execute_cmds "$postinstall_cmds" 'exit $?'
2077 3247 hiro
	fi
2078 3247 hiro
2079 3247 hiro
	# Install the pseudo-library for information purposes.
2080 3247 hiro
	func_basename "$file"
2081 3247 hiro
	name="$func_basename_result"
2082 3247 hiro
	instname="$dir/$name"i
2083 3247 hiro
	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2084 3247 hiro
2085 3247 hiro
	# Maybe install the static library, too.
2086 3247 hiro
	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2087 3247 hiro
	;;
2088 3247 hiro
2089 3247 hiro
      *.lo)
2090 3247 hiro
	# Install (i.e. copy) a libtool object.
2091 3247 hiro
2092 3247 hiro
	# Figure out destination file name, if it wasn't already specified.
2093 3247 hiro
	if test -n "$destname"; then
2094 3247 hiro
	  destfile="$destdir/$destname"
2095 3247 hiro
	else
2096 3247 hiro
	  func_basename "$file"
2097 3247 hiro
	  destfile="$func_basename_result"
2098 3247 hiro
	  destfile="$destdir/$destfile"
2099 3247 hiro
	fi
2100 3247 hiro
2101 3247 hiro
	# Deduce the name of the destination old-style object file.
2102 3247 hiro
	case $destfile in
2103 3247 hiro
	*.lo)
2104 3247 hiro
	  func_lo2o "$destfile"
2105 3247 hiro
	  staticdest=$func_lo2o_result
2106 3247 hiro
	  ;;
2107 3247 hiro
	*.$objext)
2108 3247 hiro
	  staticdest="$destfile"
2109 3247 hiro
	  destfile=
2110 3247 hiro
	  ;;
2111 3247 hiro
	*)
2112 3247 hiro
	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
2113 3247 hiro
	  ;;
2114 3247 hiro
	esac
2115 3247 hiro
2116 3247 hiro
	# Install the libtool object if requested.
2117 3247 hiro
	test -n "$destfile" && \
2118 3247 hiro
	  func_show_eval "$install_prog $file $destfile" 'exit $?'
2119 3247 hiro
2120 3247 hiro
	# Install the old object if enabled.
2121 3247 hiro
	if test "$build_old_libs" = yes; then
2122 3247 hiro
	  # Deduce the name of the old-style object file.
2123 3247 hiro
	  func_lo2o "$file"
2124 3247 hiro
	  staticobj=$func_lo2o_result
2125 3247 hiro
	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2126 3247 hiro
	fi
2127 3247 hiro
	exit $EXIT_SUCCESS
2128 3247 hiro
	;;
2129 3247 hiro
2130 3247 hiro
      *)
2131 3247 hiro
	# Figure out destination file name, if it wasn't already specified.
2132 3247 hiro
	if test -n "$destname"; then
2133 3247 hiro
	  destfile="$destdir/$destname"
2134 3247 hiro
	else
2135 3247 hiro
	  func_basename "$file"
2136 3247 hiro
	  destfile="$func_basename_result"
2137 3247 hiro
	  destfile="$destdir/$destfile"
2138 3247 hiro
	fi
2139 3247 hiro
2140 3247 hiro
	# If the file is missing, and there is a .exe on the end, strip it
2141 3247 hiro
	# because it is most likely a libtool script we actually want to
2142 3247 hiro
	# install
2143 3247 hiro
	stripped_ext=""
2144 3247 hiro
	case $file in
2145 3247 hiro
	  *.exe)
2146 3247 hiro
	    if test ! -f "$file"; then
2147 3247 hiro
	      func_stripname '' '.exe' "$file"
2148 3247 hiro
	      file=$func_stripname_result
2149 3247 hiro
	      stripped_ext=".exe"
2150 3247 hiro
	    fi
2151 3247 hiro
	    ;;
2152 3247 hiro
	esac
2153 3247 hiro
2154 3247 hiro
	# Do a test to see if this is really a libtool program.
2155 3247 hiro
	case $host in
2156 3247 hiro
	*cygwin* | *mingw*)
2157 3247 hiro
	    if func_ltwrapper_executable_p "$file"; then
2158 3247 hiro
	      func_ltwrapper_scriptname "$file"
2159 3247 hiro
	      wrapper=$func_ltwrapper_scriptname_result
2160 3247 hiro
	    else
2161 3247 hiro
	      func_stripname '' '.exe' "$file"
2162 3247 hiro
	      wrapper=$func_stripname_result
2163 3247 hiro
	    fi
2164 3247 hiro
	    ;;
2165 3247 hiro
	*)
2166 3247 hiro
	    wrapper=$file
2167 3247 hiro
	    ;;
2168 3247 hiro
	esac
2169 3247 hiro
	if func_ltwrapper_script_p "$wrapper"; then
2170 3247 hiro
	  notinst_deplibs=
2171 3247 hiro
	  relink_command=
2172 3247 hiro
2173 3247 hiro
	  func_source "$wrapper"
2174 3247 hiro
2175 3247 hiro
	  # Check the variables that should have been set.
2176 3247 hiro
	  test -z "$generated_by_libtool_version" && \
2177 3247 hiro
	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2178 3247 hiro
2179 3247 hiro
	  finalize=yes
2180 3247 hiro
	  for lib in $notinst_deplibs; do
2181 3247 hiro
	    # Check to see that each library is installed.
2182 3247 hiro
	    libdir=
2183 3247 hiro
	    if test -f "$lib"; then
2184 3247 hiro
	      func_source "$lib"
2185 3247 hiro
	    fi
2186 3247 hiro
	    libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2187 3247 hiro
	    if test -n "$libdir" && test ! -f "$libfile"; then
2188 3247 hiro
	      func_warning "\`$lib' has not been installed in \`$libdir'"
2189 3247 hiro
	      finalize=no
2190 3247 hiro
	    fi
2191 3247 hiro
	  done
2192 3247 hiro
2193 3247 hiro
	  relink_command=
2194 3247 hiro
	  func_source "$wrapper"
2195 3247 hiro
2196 3247 hiro
	  outputname=
2197 3247 hiro
	  if test "$fast_install" = no && test -n "$relink_command"; then
2198 3247 hiro
	    $opt_dry_run || {
2199 3247 hiro
	      if test "$finalize" = yes; then
2200 3247 hiro
	        tmpdir=`func_mktempdir`
2201 3247 hiro
		func_basename "$file$stripped_ext"
2202 3247 hiro
		file="$func_basename_result"
2203 3247 hiro
	        outputname="$tmpdir/$file"
2204 3247 hiro
	        # Replace the output file specification.
2205 3247 hiro
	        relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2206 3247 hiro
2207 3247 hiro
	        $opt_silent || {
2208 3247 hiro
	          func_quote_for_expand "$relink_command"
2209 3247 hiro
		  eval "func_echo $func_quote_for_expand_result"
2210 3247 hiro
	        }
2211 3247 hiro
	        if eval "$relink_command"; then :
2212 3247 hiro
	          else
2213 3247 hiro
		  func_error "error: relink \`$file' with the above command before installing it"
2214 3247 hiro
		  $opt_dry_run || ${RM}r "$tmpdir"
2215 3247 hiro
		  continue
2216 3247 hiro
	        fi
2217 3247 hiro
	        file="$outputname"
2218 3247 hiro
	      else
2219 3247 hiro
	        func_warning "cannot relink \`$file'"
2220 3247 hiro
	      fi
2221 3247 hiro
	    }
2222 3247 hiro
	  else
2223 3247 hiro
	    # Install the binary that we compiled earlier.
2224 3247 hiro
	    file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2225 3247 hiro
	  fi
2226 3247 hiro
	fi
2227 3247 hiro
2228 3247 hiro
	# remove .exe since cygwin /usr/bin/install will append another
2229 3247 hiro
	# one anyway
2230 3247 hiro
	case $install_prog,$host in
2231 3247 hiro
	*/usr/bin/install*,*cygwin*)
2232 3247 hiro
	  case $file:$destfile in
2233 3247 hiro
	  *.exe:*.exe)
2234 3247 hiro
	    # this is ok
2235 3247 hiro
	    ;;
2236 3247 hiro
	  *.exe:*)
2237 3247 hiro
	    destfile=$destfile.exe
2238 3247 hiro
	    ;;
2239 3247 hiro
	  *:*.exe)
2240 3247 hiro
	    func_stripname '' '.exe' "$destfile"
2241 3247 hiro
	    destfile=$func_stripname_result
2242 3247 hiro
	    ;;
2243 3247 hiro
	  esac
2244 3247 hiro
	  ;;
2245 3247 hiro
	esac
2246 3247 hiro
	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2247 3247 hiro
	$opt_dry_run || if test -n "$outputname"; then
2248 3247 hiro
	  ${RM}r "$tmpdir"
2249 3247 hiro
	fi
2250 3247 hiro
	;;
2251 3247 hiro
      esac
2252 3247 hiro
    done
2253 3247 hiro
2254 3247 hiro
    for file in $staticlibs; do
2255 3247 hiro
      func_basename "$file"
2256 3247 hiro
      name="$func_basename_result"
2257 3247 hiro
2258 3247 hiro
      # Set up the ranlib parameters.
2259 3247 hiro
      oldlib="$destdir/$name"
2260 3247 hiro
2261 3247 hiro
      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2262 3247 hiro
2263 3247 hiro
      if test -n "$stripme" && test -n "$old_striplib"; then
2264 3247 hiro
	func_show_eval "$old_striplib $oldlib" 'exit $?'
2265 3247 hiro
      fi
2266 3247 hiro
2267 3247 hiro
      # Do each command in the postinstall commands.
2268 3247 hiro
      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2269 3247 hiro
    done
2270 3247 hiro
2271 3247 hiro
    test -n "$future_libdirs" && \
2272 3247 hiro
      func_warning "remember to run \`$progname --finish$future_libdirs'"
2273 3247 hiro
2274 3247 hiro
    if test -n "$current_libdirs"; then
2275 3247 hiro
      # Maybe just do a dry run.
2276 3247 hiro
      $opt_dry_run && current_libdirs=" -n$current_libdirs"
2277 3247 hiro
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2278 3247 hiro
    else
2279 3247 hiro
      exit $EXIT_SUCCESS
2280 3247 hiro
    fi
2281 3247 hiro
}
2282 3247 hiro
2283 3247 hiro
test "$mode" = install && func_mode_install ${1+"$@"}
2284 3247 hiro
2285 3247 hiro
2286 3247 hiro
# func_generate_dlsyms outputname originator pic_p
2287 3247 hiro
# Extract symbols from dlprefiles and create ${outputname}S.o with
2288 3247 hiro
# a dlpreopen symbol table.
2289 3247 hiro
func_generate_dlsyms ()
2290 3247 hiro
{
2291 3247 hiro
    $opt_debug
2292 3247 hiro
    my_outputname="$1"
2293 3247 hiro
    my_originator="$2"
2294 3247 hiro
    my_pic_p="${3-no}"
2295 3247 hiro
    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2296 3247 hiro
    my_dlsyms=
2297 3247 hiro
2298 3247 hiro
    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2299 3247 hiro
      if test -n "$NM" && test -n "$global_symbol_pipe"; then
2300 3247 hiro
	my_dlsyms="${my_outputname}S.c"
2301 3247 hiro
      else
2302 3247 hiro
	func_error "not configured to extract global symbols from dlpreopened files"
2303 3247 hiro
      fi
2304 3247 hiro
    fi
2305 3247 hiro
2306 3247 hiro
    if test -n "$my_dlsyms"; then
2307 3247 hiro
      case $my_dlsyms in
2308 3247 hiro
      "") ;;
2309 3247 hiro
      *.c)
2310 3247 hiro
	# Discover the nlist of each of the dlfiles.
2311 3247 hiro
	nlist="$output_objdir/${my_outputname}.nm"
2312 3247 hiro
2313 3247 hiro
	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2314 3247 hiro
2315 3247 hiro
	# Parse the name list into a source file.
2316 3247 hiro
	func_verbose "creating $output_objdir/$my_dlsyms"
2317 3247 hiro
2318 3247 hiro
	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2319 3247 hiro
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2320 3247 hiro
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2321 3247 hiro
2322 3247 hiro
#ifdef __cplusplus
2323 3247 hiro
extern \"C\" {
2324 3247 hiro
#endif
2325 3247 hiro
2326 3247 hiro
/* External symbol declarations for the compiler. */\
2327 3247 hiro
"
2328 3247 hiro
2329 3247 hiro
	if test "$dlself" = yes; then
2330 3247 hiro
	  func_verbose "generating symbol list for \`$output'"
2331 3247 hiro
2332 3247 hiro
	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2333 3247 hiro
2334 3247 hiro
	  # Add our own program objects to the symbol list.
2335 3247 hiro
	  progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2336 3247 hiro
	  for progfile in $progfiles; do
2337 3247 hiro
	    func_verbose "extracting global C symbols from \`$progfile'"
2338 3247 hiro
	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2339 3247 hiro
	  done
2340 3247 hiro
2341 3247 hiro
	  if test -n "$exclude_expsyms"; then
2342 3247 hiro
	    $opt_dry_run || {
2343 3247 hiro
	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2344 3247 hiro
	      eval '$MV "$nlist"T "$nlist"'
2345 3247 hiro
	    }
2346 3247 hiro
	  fi
2347 3247 hiro
2348 3247 hiro
	  if test -n "$export_symbols_regex"; then
2349 3247 hiro
	    $opt_dry_run || {
2350 3247 hiro
	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2351 3247 hiro
	      eval '$MV "$nlist"T "$nlist"'
2352 3247 hiro
	    }
2353 3247 hiro
	  fi
2354 3247 hiro
2355 3247 hiro
	  # Prepare the list of exported symbols
2356 3247 hiro
	  if test -z "$export_symbols"; then
2357 3247 hiro
	    export_symbols="$output_objdir/$outputname.exp"
2358 3247 hiro
	    $opt_dry_run || {
2359 3247 hiro
	      $RM $export_symbols
2360 3247 hiro
	      eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2361 3247 hiro
	      case $host in
2362 3247 hiro
	      *cygwin* | *mingw* | *cegcc* )
2363 3247 hiro
                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2364 3247 hiro
                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2365 3247 hiro
	        ;;
2366 3247 hiro
	      esac
2367 3247 hiro
	    }
2368 3247 hiro
	  else
2369 3247 hiro
	    $opt_dry_run || {
2370 3247 hiro
	      eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2371 3247 hiro
	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2372 3247 hiro
	      eval '$MV "$nlist"T "$nlist"'
2373 3247 hiro
	      case $host in
2374 3247 hiro
	        *cygwin | *mingw* | *cegcc* )
2375 3247 hiro
	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2376 3247 hiro
	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2377 3247 hiro
	          ;;
2378 3247 hiro
	      esac
2379 3247 hiro
	    }
2380 3247 hiro
	  fi
2381 3247 hiro
	fi
2382 3247 hiro
2383 3247 hiro
	for dlprefile in $dlprefiles; do
2384 3247 hiro
	  func_verbose "extracting global C symbols from \`$dlprefile'"
2385 3247 hiro
	  func_basename "$dlprefile"
2386 3247 hiro
	  name="$func_basename_result"
2387 3247 hiro
	  $opt_dry_run || {
2388 3247 hiro
	    eval '$ECHO ": $name " >> "$nlist"'
2389 3247 hiro
	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2390 3247 hiro
	  }
2391 3247 hiro
	done
2392 3247 hiro
2393 3247 hiro
	$opt_dry_run || {
2394 3247 hiro
	  # Make sure we have at least an empty file.
2395 3247 hiro
	  test -f "$nlist" || : > "$nlist"
2396 3247 hiro
2397 3247 hiro
	  if test -n "$exclude_expsyms"; then
2398 3247 hiro
	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2399 3247 hiro
	    $MV "$nlist"T "$nlist"
2400 3247 hiro
	  fi
2401 3247 hiro
2402 3247 hiro
	  # Try sorting and uniquifying the output.
2403 3247 hiro
	  if $GREP -v "^: " < "$nlist" |
2404 3247 hiro
	      if sort -k 3 </dev/null >/dev/null 2>&1; then
2405 3247 hiro
		sort -k 3
2406 3247 hiro
	      else
2407 3247 hiro
		sort +2
2408 3247 hiro
	      fi |
2409 3247 hiro
	      uniq > "$nlist"S; then
2410 3247 hiro
	    :
2411 3247 hiro
	  else
2412 3247 hiro
	    $GREP -v "^: " < "$nlist" > "$nlist"S
2413 3247 hiro
	  fi
2414 3247 hiro
2415 3247 hiro
	  if test -f "$nlist"S; then
2416 3247 hiro
	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2417 3247 hiro
	  else
2418 3247 hiro
	    $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2419 3247 hiro
	  fi
2420 3247 hiro
2421 3247 hiro
	  $ECHO >> "$output_objdir/$my_dlsyms" "\
2422 3247 hiro
2423 3247 hiro
/* The mapping between symbol names and symbols.  */
2424 3247 hiro
typedef struct {
2425 3247 hiro
  const char *name;
2426 3247 hiro
  void *address;
2427 3247 hiro
} lt_dlsymlist;
2428 3247 hiro
"
2429 3247 hiro
	  case $host in
2430 3247 hiro
	  *cygwin* | *mingw* | *cegcc* )
2431 3247 hiro
	    $ECHO >> "$output_objdir/$my_dlsyms" "\
2432 3247 hiro
/* DATA imports from DLLs on WIN32 con't be const, because
2433 3247 hiro
   runtime relocations are performed -- see ld's documentation
2434 3247 hiro
   on pseudo-relocs.  */"
2435 3247 hiro
	    lt_dlsym_const= ;;
2436 3247 hiro
	  *osf5*)
2437 3247 hiro
	    echo >> "$output_objdir/$my_dlsyms" "\
2438 3247 hiro
/* This system does not cope well with relocations in const data */"
2439 3247 hiro
	    lt_dlsym_const= ;;
2440 3247 hiro
	  *)
2441 3247 hiro
	    lt_dlsym_const=const ;;
2442 3247 hiro
	  esac
2443 3247 hiro
2444 3247 hiro
	  $ECHO >> "$output_objdir/$my_dlsyms" "\
2445 3247 hiro
extern $lt_dlsym_const lt_dlsymlist
2446 3247 hiro
lt_${my_prefix}_LTX_preloaded_symbols[];
2447 3247 hiro
$lt_dlsym_const lt_dlsymlist
2448 3247 hiro
lt_${my_prefix}_LTX_preloaded_symbols[] =
2449 3247 hiro
{\
2450 3247 hiro
  { \"$my_originator\", (void *) 0 },"
2451 3247 hiro
2452 3247 hiro
	  case $need_lib_prefix in
2453 3247 hiro
	  no)
2454 3247 hiro
	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2455 3247 hiro
	    ;;
2456 3247 hiro
	  *)
2457 3247 hiro
	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2458 3247 hiro
	    ;;
2459 3247 hiro
	  esac
2460 3247 hiro
	  $ECHO >> "$output_objdir/$my_dlsyms" "\
2461 3247 hiro
  {0, (void *) 0}
2462 3247 hiro
};
2463 3247 hiro
2464 3247 hiro
/* This works around a problem in FreeBSD linker */
2465 3247 hiro
#ifdef FREEBSD_WORKAROUND
2466 3247 hiro
static const void *lt_preloaded_setup() {
2467 3247 hiro
  return lt_${my_prefix}_LTX_preloaded_symbols;
2468 3247 hiro
}
2469 3247 hiro
#endif
2470 3247 hiro
2471 3247 hiro
#ifdef __cplusplus
2472 3247 hiro
}
2473 3247 hiro
#endif\
2474 3247 hiro
"
2475 3247 hiro
	} # !$opt_dry_run
2476 3247 hiro
2477 3247 hiro
	pic_flag_for_symtable=
2478 3247 hiro
	case "$compile_command " in
2479 3247 hiro
	*" -static "*) ;;
2480 3247 hiro
	*)
2481 3247 hiro
	  case $host in
2482 3247 hiro
	  # compiling the symbol table file with pic_flag works around
2483 3247 hiro
	  # a FreeBSD bug that causes programs to crash when -lm is
2484 3247 hiro
	  # linked before any other PIC object.  But we must not use
2485 3247 hiro
	  # pic_flag when linking with -static.  The problem exists in
2486 3247 hiro
	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2487 3247 hiro
	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2488 3247 hiro
	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2489 3247 hiro
	  *-*-hpux*)
2490 3247 hiro
	    pic_flag_for_symtable=" $pic_flag"  ;;
2491 3247 hiro
	  *)
2492 3247 hiro
	    if test "X$my_pic_p" != Xno; then
2493 3247 hiro
	      pic_flag_for_symtable=" $pic_flag"
2494 3247 hiro
	    fi
2495 3247 hiro
	    ;;
2496 3247 hiro
	  esac
2497 3247 hiro
	  ;;
2498 3247 hiro
	esac
2499 3247 hiro
	symtab_cflags=
2500 3247 hiro
	for arg in $LTCFLAGS; do
2501 3247 hiro
	  case $arg in
2502 3247 hiro
	  -pie | -fpie | -fPIE) ;;
2503 3247 hiro
	  *) symtab_cflags="$symtab_cflags $arg" ;;
2504 3247 hiro
	  esac
2505 3247 hiro
	done
2506 3247 hiro
2507 3247 hiro
	# Now compile the dynamic symbol file.
2508 3247 hiro
	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
2509 3247 hiro
2510 3247 hiro
	# Clean up the generated files.
2511 3247 hiro
	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
2512 3247 hiro
2513 3247 hiro
	# Transform the symbol file into the correct name.
2514 3247 hiro
	symfileobj="$output_objdir/${my_outputname}S.$objext"
2515 3247 hiro
	case $host in
2516 3247 hiro
	*cygwin* | *mingw* | *cegcc* )
2517 3247 hiro
	  if test -f "$output_objdir/$my_outputname.def"; then
2518 3247 hiro
	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2519 3247 hiro
	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2520 3247 hiro
	  else
2521 3247 hiro
	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2522 3247 hiro
	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2523 3247 hiro
	  fi
2524 3247 hiro
	  ;;
2525 3247 hiro
	*)
2526 3247 hiro
	  compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2527 3247 hiro
	  finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2528 3247 hiro
	  ;;
2529 3247 hiro
	esac
2530 3247 hiro
	;;
2531 3247 hiro
      *)
2532 3247 hiro
	func_fatal_error "unknown suffix for \`$my_dlsyms'"
2533 3247 hiro
	;;
2534 3247 hiro
      esac
2535 3247 hiro
    else
2536 3247 hiro
      # We keep going just in case the user didn't refer to
2537 3247 hiro
      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
2538 3247 hiro
      # really was required.
2539 3247 hiro
2540 3247 hiro
      # Nullify the symbol file.
2541 3247 hiro
      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2542 3247 hiro
      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2543 3247 hiro
    fi
2544 3247 hiro
}
2545 3247 hiro
2546 3247 hiro
# func_win32_libid arg
2547 3247 hiro
# return the library type of file 'arg'
2548 3247 hiro
#
2549 3247 hiro
# Need a lot of goo to handle *both* DLLs and import libs
2550 3247 hiro
# Has to be a shell function in order to 'eat' the argument
2551 3247 hiro
# that is supplied when $file_magic_command is called.
2552 3247 hiro
func_win32_libid ()
2553 3247 hiro
{
2554 3247 hiro
  $opt_debug
2555 3247 hiro
  win32_libid_type="unknown"
2556 3247 hiro
  win32_fileres=`file -L $1 2>/dev/null`
2557 3247 hiro
  case $win32_fileres in
2558 3247 hiro
  *ar\ archive\ import\ library*) # definitely import
2559 3247 hiro
    win32_libid_type="x86 archive import"
2560 1 hiro
    ;;
2561 3247 hiro
  *ar\ archive*) # could be an import, or static
2562 3247 hiro
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2563 3247 hiro
       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
2564 3247 hiro
      win32_nmres=`eval $NM -f posix -A $1 |
2565 3247 hiro
	$SED -n -e '
2566 3247 hiro
	    1,100{
2567 3247 hiro
		/ I /{
2568 3247 hiro
		    s,.*,import,
2569 3247 hiro
		    p
2570 3247 hiro
		    q
2571 3247 hiro
		}
2572 3247 hiro
	    }'`
2573 3247 hiro
      case $win32_nmres in
2574 3247 hiro
      import*)  win32_libid_type="x86 archive import";;
2575 3247 hiro
      *)        win32_libid_type="x86 archive static";;
2576 3247 hiro
      esac
2577 3247 hiro
    fi
2578 3247 hiro
    ;;
2579 3247 hiro
  *DLL*)
2580 3247 hiro
    win32_libid_type="x86 DLL"
2581 3247 hiro
    ;;
2582 3247 hiro
  *executable*) # but shell scripts are "executable" too...
2583 3247 hiro
    case $win32_fileres in
2584 3247 hiro
    *MS\ Windows\ PE\ Intel*)
2585 3247 hiro
      win32_libid_type="x86 DLL"
2586 3247 hiro
      ;;
2587 3247 hiro
    esac
2588 3247 hiro
    ;;
2589 3247 hiro
  esac
2590 3247 hiro
  $ECHO "$win32_libid_type"
2591 3247 hiro
}
2592 1 hiro
2593 3247 hiro
2594 3247 hiro
2595 3247 hiro
# func_extract_an_archive dir oldlib
2596 3247 hiro
func_extract_an_archive ()
2597 3247 hiro
{
2598 3247 hiro
    $opt_debug
2599 3247 hiro
    f_ex_an_ar_dir="$1"; shift
2600 3247 hiro
    f_ex_an_ar_oldlib="$1"
2601 3247 hiro
    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
2602 3247 hiro
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2603 3247 hiro
     :
2604 3247 hiro
    else
2605 3247 hiro
      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
2606 3247 hiro
    fi
2607 3247 hiro
}
2608 3247 hiro
2609 3247 hiro
2610 3247 hiro
# func_extract_archives gentop oldlib ...
2611 3247 hiro
func_extract_archives ()
2612 3247 hiro
{
2613 3247 hiro
    $opt_debug
2614 3247 hiro
    my_gentop="$1"; shift
2615 3247 hiro
    my_oldlibs=${1+"$@"}
2616 3247 hiro
    my_oldobjs=""
2617 3247 hiro
    my_xlib=""
2618 3247 hiro
    my_xabs=""
2619 3247 hiro
    my_xdir=""
2620 3247 hiro
2621 3247 hiro
    for my_xlib in $my_oldlibs; do
2622 3247 hiro
      # Extract the objects.
2623 3247 hiro
      case $my_xlib in
2624 3247 hiro
	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
2625 3247 hiro
	*) my_xabs=`pwd`"/$my_xlib" ;;
2626 3247 hiro
      esac
2627 3247 hiro
      func_basename "$my_xlib"
2628 3247 hiro
      my_xlib="$func_basename_result"
2629 3247 hiro
      my_xlib_u=$my_xlib
2630 3247 hiro
      while :; do
2631 3247 hiro
        case " $extracted_archives " in
2632 3247 hiro
	*" $my_xlib_u "*)
2633 3247 hiro
	  func_arith $extracted_serial + 1
2634 3247 hiro
	  extracted_serial=$func_arith_result
2635 3247 hiro
	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
2636 3247 hiro
	*) break ;;
2637 3247 hiro
	esac
2638 3247 hiro
      done
2639 3247 hiro
      extracted_archives="$extracted_archives $my_xlib_u"
2640 3247 hiro
      my_xdir="$my_gentop/$my_xlib_u"
2641 3247 hiro
2642 3247 hiro
      func_mkdir_p "$my_xdir"
2643 3247 hiro
2644 3247 hiro
      case $host in
2645 3247 hiro
      *-darwin*)
2646 3247 hiro
	func_verbose "Extracting $my_xabs"
2647 3247 hiro
	# Do not bother doing anything if just a dry run
2648 3247 hiro
	$opt_dry_run || {
2649 3247 hiro
	  darwin_orig_dir=`pwd`
2650 3247 hiro
	  cd $my_xdir || exit $?
2651 3247 hiro
	  darwin_archive=$my_xabs
2652 3247 hiro
	  darwin_curdir=`pwd`
2653 3247 hiro
	  darwin_base_archive=`basename "$darwin_archive"`
2654 3247 hiro
	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2655 3247 hiro
	  if test -n "$darwin_arches"; then
2656 3247 hiro
	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2657 3247 hiro
	    darwin_arch=
2658 3247 hiro
	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
2659 3247 hiro
	    for darwin_arch in  $darwin_arches ; do
2660 3247 hiro
	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2661 3247 hiro
	      $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2662 3247 hiro
	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2663 3247 hiro
	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
2664 3247 hiro
	      cd "$darwin_curdir"
2665 3247 hiro
	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
2666 3247 hiro
	    done # $darwin_arches
2667 3247 hiro
            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
2668 3247 hiro
	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
2669 3247 hiro
	    darwin_file=
2670 3247 hiro
	    darwin_files=
2671 3247 hiro
	    for darwin_file in $darwin_filelist; do
2672 3247 hiro
	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
2673 3247 hiro
	      $LIPO -create -output "$darwin_file" $darwin_files
2674 3247 hiro
	    done # $darwin_filelist
2675 3247 hiro
	    $RM -rf unfat-$$
2676 3247 hiro
	    cd "$darwin_orig_dir"
2677 3247 hiro
	  else
2678 3247 hiro
	    cd $darwin_orig_dir
2679 3247 hiro
	    func_extract_an_archive "$my_xdir" "$my_xabs"
2680 3247 hiro
	  fi # $darwin_arches
2681 3247 hiro
	} # !$opt_dry_run
2682 3247 hiro
	;;
2683 3247 hiro
      *)
2684 3247 hiro
        func_extract_an_archive "$my_xdir" "$my_xabs"
2685 3247 hiro
	;;
2686 3247 hiro
      esac
2687 3247 hiro
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2688 3247 hiro
    done
2689 3247 hiro
2690 3247 hiro
    func_extract_archives_result="$my_oldobjs"
2691 3247 hiro
}
2692 3247 hiro
2693 3247 hiro
2694 3247 hiro
2695 3247 hiro
# func_emit_wrapper_part1 [arg=no]
2696 3247 hiro
#
2697 3247 hiro
# Emit the first part of a libtool wrapper script on stdout.
2698 3247 hiro
# For more information, see the description associated with
2699 3247 hiro
# func_emit_wrapper(), below.
2700 3247 hiro
func_emit_wrapper_part1 ()
2701 3247 hiro
{
2702 3247 hiro
	func_emit_wrapper_part1_arg1=no
2703 3247 hiro
	if test -n "$1" ; then
2704 3247 hiro
	  func_emit_wrapper_part1_arg1=$1
2705 3247 hiro
	fi
2706 3247 hiro
2707 3247 hiro
	$ECHO "\
2708 3247 hiro
#! $SHELL
2709 3247 hiro
2710 3247 hiro
# $output - temporary wrapper script for $objdir/$outputname
2711 3247 hiro
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2712 3247 hiro
#
2713 3247 hiro
# The $output program cannot be directly executed until all the libtool
2714 3247 hiro
# libraries that it depends on are installed.
2715 3247 hiro
#
2716 3247 hiro
# This wrapper script should never be moved out of the build directory.
2717 3247 hiro
# If it is, it will not operate correctly.
2718 3247 hiro
2719 3247 hiro
# Sed substitution that helps us do robust quoting.  It backslashifies
2720 3247 hiro
# metacharacters that are still active within double-quoted strings.
2721 3247 hiro
Xsed='${SED} -e 1s/^X//'
2722 3247 hiro
sed_quote_subst='$sed_quote_subst'
2723 3247 hiro
2724 3247 hiro
# Be Bourne compatible
2725 3247 hiro
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
2726 3247 hiro
  emulate sh
2727 3247 hiro
  NULLCMD=:
2728 3247 hiro
  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
2729 3247 hiro
  # is contrary to our usage.  Disable this feature.
2730 3247 hiro
  alias -g '\${1+\"\$@\"}'='\"\$@\"'
2731 3247 hiro
  setopt NO_GLOB_SUBST
2732 3247 hiro
else
2733 3247 hiro
  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
2734 3247 hiro
fi
2735 3247 hiro
BIN_SH=xpg4; export BIN_SH # for Tru64
2736 3247 hiro
DUALCASE=1; export DUALCASE # for MKS sh
2737 3247 hiro
2738 3247 hiro
# The HP-UX ksh and POSIX shell print the target directory to stdout
2739 3247 hiro
# if CDPATH is set.
2740 3247 hiro
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2741 3247 hiro
2742 3247 hiro
relink_command=\"$relink_command\"
2743 3247 hiro
2744 3247 hiro
# This environment variable determines our operation mode.
2745 3247 hiro
if test \"\$libtool_install_magic\" = \"$magic\"; then
2746 3247 hiro
  # install mode needs the following variables:
2747 3247 hiro
  generated_by_libtool_version='$macro_version'
2748 3247 hiro
  notinst_deplibs='$notinst_deplibs'
2749 3247 hiro
else
2750 3247 hiro
  # When we are sourced in execute mode, \$file and \$ECHO are already set.
2751 3247 hiro
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
2752 3247 hiro
    ECHO=\"$qecho\"
2753 3247 hiro
    file=\"\$0\"
2754 3247 hiro
    # Make sure echo works.
2755 3247 hiro
    if test \"X\$1\" = X--no-reexec; then
2756 3247 hiro
      # Discard the --no-reexec flag, and continue.
2757 3247 hiro
      shift
2758 3247 hiro
    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
2759 3247 hiro
      # Yippee, \$ECHO works!
2760 3247 hiro
      :
2761 3247 hiro
    else
2762 3247 hiro
      # Restart under the correct shell, and then maybe \$ECHO will work.
2763 3247 hiro
      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2764 3247 hiro
    fi
2765 3247 hiro
  fi\
2766 3247 hiro
"
2767 3247 hiro
	$ECHO "\
2768 3247 hiro
2769 3247 hiro
  # Find the directory that this script lives in.
2770 3247 hiro
  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2771 3247 hiro
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2772 3247 hiro
2773 3247 hiro
  # Follow symbolic links until we get to the real thisdir.
2774 3247 hiro
  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
2775 3247 hiro
  while test -n \"\$file\"; do
2776 3247 hiro
    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2777 3247 hiro
2778 3247 hiro
    # If there was a directory component, then change thisdir.
2779 3247 hiro
    if test \"x\$destdir\" != \"x\$file\"; then
2780 3247 hiro
      case \"\$destdir\" in
2781 3247 hiro
      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2782 3247 hiro
      *) thisdir=\"\$thisdir/\$destdir\" ;;
2783 3247 hiro
      esac
2784 3247 hiro
    fi
2785 3247 hiro
2786 3247 hiro
    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2787 3247 hiro
    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
2788 3247 hiro
  done
2789 3247 hiro
"
2790 3247 hiro
}
2791 3247 hiro
# end: func_emit_wrapper_part1
2792 3247 hiro
2793 3247 hiro
# func_emit_wrapper_part2 [arg=no]
2794 3247 hiro
#
2795 3247 hiro
# Emit the second part of a libtool wrapper script on stdout.
2796 3247 hiro
# For more information, see the description associated with
2797 3247 hiro
# func_emit_wrapper(), below.
2798 3247 hiro
func_emit_wrapper_part2 ()
2799 3247 hiro
{
2800 3247 hiro
	func_emit_wrapper_part2_arg1=no
2801 3247 hiro
	if test -n "$1" ; then
2802 3247 hiro
	  func_emit_wrapper_part2_arg1=$1
2803 3247 hiro
	fi
2804 3247 hiro
2805 3247 hiro
	$ECHO "\
2806 3247 hiro
2807 3247 hiro
  # Usually 'no', except on cygwin/mingw when embedded into
2808 3247 hiro
  # the cwrapper.
2809 3247 hiro
  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
2810 3247 hiro
  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
2811 3247 hiro
    # special case for '.'
2812 3247 hiro
    if test \"\$thisdir\" = \".\"; then
2813 3247 hiro
      thisdir=\`pwd\`
2814 3247 hiro
    fi
2815 3247 hiro
    # remove .libs from thisdir
2816 3247 hiro
    case \"\$thisdir\" in
2817 3247 hiro
    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
2818 3247 hiro
    $objdir )   thisdir=. ;;
2819 3247 hiro
    esac
2820 3247 hiro
  fi
2821 3247 hiro
2822 3247 hiro
  # Try to get the absolute directory name.
2823 3247 hiro
  absdir=\`cd \"\$thisdir\" && pwd\`
2824 3247 hiro
  test -n \"\$absdir\" && thisdir=\"\$absdir\"
2825 3247 hiro
"
2826 3247 hiro
2827 3247 hiro
	if test "$fast_install" = yes; then
2828 3247 hiro
	  $ECHO "\
2829 3247 hiro
  program=lt-'$outputname'$exeext
2830 3247 hiro
  progdir=\"\$thisdir/$objdir\"
2831 3247 hiro
2832 3247 hiro
  if test ! -f \"\$progdir/\$program\" ||
2833 3247 hiro
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2834 3247 hiro
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2835 3247 hiro
2836 3247 hiro
    file=\"\$\$-\$program\"
2837 3247 hiro
2838 3247 hiro
    if test ! -d \"\$progdir\"; then
2839 3247 hiro
      $MKDIR \"\$progdir\"
2840 3247 hiro
    else
2841 3247 hiro
      $RM \"\$progdir/\$file\"
2842 3247 hiro
    fi"
2843 3247 hiro
2844 3247 hiro
	  $ECHO "\
2845 3247 hiro
2846 3247 hiro
    # relink executable if necessary
2847 3247 hiro
    if test -n \"\$relink_command\"; then
2848 3247 hiro
      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2849 3247 hiro
      else
2850 3247 hiro
	$ECHO \"\$relink_command_output\" >&2
2851 3247 hiro
	$RM \"\$progdir/\$file\"
2852 3247 hiro
	exit 1
2853 3247 hiro
      fi
2854 3247 hiro
    fi
2855 3247 hiro
2856 3247 hiro
    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2857 3247 hiro
    { $RM \"\$progdir/\$program\";
2858 3247 hiro
      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2859 3247 hiro
    $RM \"\$progdir/\$file\"
2860 3247 hiro
  fi"
2861 3247 hiro
	else
2862 3247 hiro
	  $ECHO "\
2863 3247 hiro
  program='$outputname'
2864 3247 hiro
  progdir=\"\$thisdir/$objdir\"
2865 3247 hiro
"
2866 3247 hiro
	fi
2867 3247 hiro
2868 3247 hiro
	$ECHO "\
2869 3247 hiro
2870 3247 hiro
  if test -f \"\$progdir/\$program\"; then"
2871 3247 hiro
2872 3247 hiro
	# Export our shlibpath_var if we have one.
2873 3247 hiro
	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2874 3247 hiro
	  $ECHO "\
2875 3247 hiro
    # Add our own library path to $shlibpath_var
2876 3247 hiro
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2877 3247 hiro
2878 3247 hiro
    # Some systems cannot cope with colon-terminated $shlibpath_var
2879 3247 hiro
    # The second colon is a workaround for a bug in BeOS R4 sed
2880 3247 hiro
    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2881 3247 hiro
2882 3247 hiro
    export $shlibpath_var
2883 3247 hiro
"
2884 3247 hiro
	fi
2885 3247 hiro
2886 3247 hiro
	# fixup the dll searchpath if we need to.
2887 3247 hiro
	if test -n "$dllsearchpath"; then