Revision 3247 ltmain.sh

View differences:

ltmain.sh
1
# ltmain.sh - Provide generalized library-building support services.
2
# NOTE: Changing this file will not affect anything until you rerun configure.
3
#
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5
# 2007, 2008  Free Software Foundation, Inc.
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7
#
8
# This program is free software; you can redistribute it and/or modify
1
# Generated from ltmain.m4sh.
2

  
3
# ltmain.sh (GNU libtool) 2.2.6b
4
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
5

  
6
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
7
# This is free software; see the source for copying conditions.  There is NO
8
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9

  
10
# GNU Libtool is free software; you can redistribute it and/or modify
9 11
# it under the terms of the GNU General Public License as published by
10 12
# the Free Software Foundation; either version 2 of the License, or
11 13
# (at your option) any later version.
12 14
#
13
# This program is distributed in the hope that it will be useful, but
15
# As a special exception to the GNU General Public License,
16
# if you distribute this file as part of a program or library that
17
# is built using GNU Libtool, you may include this file under the
18
# same distribution terms that you use for the rest of that program.
19
#
20
# GNU Libtool is distributed in the hope that it will be useful, but
14 21
# WITHOUT ANY WARRANTY; without even the implied warranty of
15 22
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 23
# General Public License for more details.
17 24
#
18 25
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
# along with GNU Libtool; see the file COPYING.  If not, a copy
27
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
28
# or obtained by writing to the Free Software Foundation, Inc.,
29
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30

  
31
# Usage: $progname [OPTION]... [MODE-ARG]...
21 32
#
22
# As a special exception to the GNU General Public License, if you
23
# distribute this file as part of a program that contains a
24
# configuration script generated by Autoconf, you may include it under
25
# the same distribution terms that you use for the rest of that program.
33
# Provide generalized library-building support services.
34
#
35
#     --config             show all configuration variables
36
#     --debug              enable verbose shell tracing
37
# -n, --dry-run            display commands without modifying any files
38
#     --features           display basic configuration information and exit
39
#     --mode=MODE          use operation mode MODE
40
#     --preserve-dup-deps  don't remove duplicate dependency libraries
41
#     --quiet, --silent    don't print informational messages
42
#     --tag=TAG            use configuration variables from tag TAG
43
# -v, --verbose            print informational messages (default)
44
#     --version            print version information
45
# -h, --help               print short or long help message
46
#
47
# MODE must be one of the following:
48
#
49
#       clean              remove files from the build directory
50
#       compile            compile a source file into a libtool object
51
#       execute            automatically set library path, then run a program
52
#       finish             complete the installation of libtool libraries
53
#       install            install libraries or executables
54
#       link               create a library or an executable
55
#       uninstall          remove libraries from an installed directory
56
#
57
# MODE-ARGS vary depending on the MODE.
58
# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
59
#
60
# When reporting a bug, please describe a test case to reproduce it and
61
# include the following information:
62
#
63
#       host-triplet:	$host
64
#       shell:		$SHELL
65
#       compiler:		$LTCC
66
#       compiler flags:		$LTCFLAGS
67
#       linker:		$LD (gnu? $with_gnu_ld)
68
#       $progname:		(GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
69
#       automake:		$automake_version
70
#       autoconf:		$autoconf_version
71
#
72
# Report bugs to <bug-libtool@gnu.org>.
26 73

  
27
basename="s,^.*/,,g"
28

  
29
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30
# is ksh but when the shell is invoked as "sh" and the current value of
31
# the _XPG environment variable is not equal to 1 (one), the special
32
# positional parameter $0, within a function call, is the name of the
33
# function.
34
progpath="$0"
35

  
36
# The name of this program:
37
progname=`echo "$progpath" | $SED $basename`
38
modename="$progname"
39

  
40
# Global variables:
41
EXIT_SUCCESS=0
42
EXIT_FAILURE=1
43

  
44 74
PROGRAM=ltmain.sh
45 75
PACKAGE=libtool
46
VERSION="1.5.26 Debian 1.5.26-1ubuntu1"
47
TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
76
VERSION="2.2.6b Debian-2.2.6b-2ubuntu1"
77
TIMESTAMP=""
78
package_revision=1.3017
48 79

  
49
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
80
# Be Bourne compatible
50 81
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
51 82
  emulate sh
52 83
  NULLCMD=:
......
60 91
BIN_SH=xpg4; export BIN_SH # for Tru64
61 92
DUALCASE=1; export DUALCASE # for MKS sh
62 93

  
63
# Check that we have a working $echo.
64
if test "X$1" = X--no-reexec; then
65
  # Discard the --no-reexec flag, and continue.
66
  shift
67
elif test "X$1" = X--fallback-echo; then
68
  # Avoid inline document here, it may be left over
69
  :
70
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71
  # Yippee, $echo works!
72
  :
73
else
74
  # Restart under the correct shell, and then maybe $echo will work.
75
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
76
fi
77

  
78
if test "X$1" = X--fallback-echo; then
79
  # used as fallback echo
80
  shift
81
  cat <<EOF
82
$*
83
EOF
84
  exit $EXIT_SUCCESS
85
fi
86

  
87
default_mode=
88
help="Try \`$progname --help' for more information."
89
magic="%%%MAGIC variable%%%"
90
mkdir="mkdir"
91
mv="mv -f"
92
rm="rm -f"
93

  
94
# Sed substitution that helps us do robust quoting.  It backslashifies
95
# metacharacters that are still active within double-quoted strings.
96
Xsed="${SED}"' -e 1s/^X//'
97
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98
# test EBCDIC or ASCII
99
case `echo X|tr X '\101'` in
100
 A) # ASCII based system
101
    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
102
  SP2NL='tr \040 \012'
103
  NL2SP='tr \015\012 \040\040'
104
  ;;
105
 *) # EBCDIC based system
106
  SP2NL='tr \100 \n'
107
  NL2SP='tr \r\n \100\100'
108
  ;;
109
esac
110

  
111
# NLS nuisances.
94
# NLS nuisances: We save the old values to restore during execute mode.
112 95
# Only set LANG and LC_ALL to C if already set.
113 96
# These must not be set unconditionally because not all systems understand
114 97
# e.g. LANG=C (notably SCO).
115
# We save the old values to restore during execute mode.
116
lt_env=
98
lt_user_locale=
99
lt_safe_locale=
117 100
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118 101
do
119 102
  eval "if test \"\${$lt_var+set}\" = set; then
120
	  save_$lt_var=\$$lt_var
121
	  lt_env=\"$lt_var=\$$lt_var \$lt_env\"
122
	  $lt_var=C
103
          save_$lt_var=\$$lt_var
104
          $lt_var=C
123 105
	  export $lt_var
106
	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
107
	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
124 108
	fi"
125 109
done
126 110

  
127
if test -n "$lt_env"; then
128
  lt_env="env $lt_env"
129
fi
111
$lt_unset CDPATH
130 112

  
113

  
114

  
115

  
116

  
117
: ${CP="cp -f"}
118
: ${ECHO="echo"}
119
: ${EGREP="/bin/grep -E"}
120
: ${FGREP="/bin/grep -F"}
121
: ${GREP="/bin/grep"}
122
: ${LN_S="ln -s"}
123
: ${MAKE="make"}
124
: ${MKDIR="mkdir"}
125
: ${MV="mv -f"}
126
: ${RM="rm -f"}
127
: ${SED="/bin/sed"}
128
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
129
: ${Xsed="$SED -e 1s/^X//"}
130

  
131
# Global variables:
132
EXIT_SUCCESS=0
133
EXIT_FAILURE=1
134
EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
135
EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
136

  
137
exit_status=$EXIT_SUCCESS
138

  
131 139
# Make sure IFS has a sensible default
132 140
lt_nl='
133 141
'
134 142
IFS=" 	$lt_nl"
135 143

  
136
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
137
  $echo "$modename: not configured to build any kind of library" 1>&2
138
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
139
  exit $EXIT_FAILURE
140
fi
144
dirname="s,/[^/]*$,,"
145
basename="s,^.*/,,"
141 146

  
142
# Global variables.
143
mode=$default_mode
144
nonopt=
145
prev=
146
prevopt=
147
run=
148
show="$echo"
149
show_help=
150
execute_dlfiles=
151
duplicate_deps=no
152
preserve_args=
153
lo2o="s/\\.lo\$/.${objext}/"
154
o2lo="s/\\.${objext}\$/.lo/"
155
extracted_archives=
156
extracted_serial=0
147
# func_dirname_and_basename file append nondir_replacement
148
# perform func_basename and func_dirname in a single function
149
# call:
150
#   dirname:  Compute the dirname of FILE.  If nonempty,
151
#             add APPEND to the result, otherwise set result
152
#             to NONDIR_REPLACEMENT.
153
#             value returned in "$func_dirname_result"
154
#   basename: Compute filename of FILE.
155
#             value retuned in "$func_basename_result"
156
# Implementation must be kept synchronized with func_dirname
157
# and func_basename. For efficiency, we do not delegate to
158
# those functions but instead duplicate the functionality here.
159
func_dirname_and_basename ()
160
{
161
  # Extract subdirectory from the argument.
162
  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
163
  if test "X$func_dirname_result" = "X${1}"; then
164
    func_dirname_result="${3}"
165
  else
166
    func_dirname_result="$func_dirname_result${2}"
167
  fi
168
  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
169
}
157 170

  
158
#####################################
159
# Shell function definitions:
160
# This seems to be the best place for them
171
# Generated shell functions inserted here.
161 172

  
173
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
174
# is ksh but when the shell is invoked as "sh" and the current value of
175
# the _XPG environment variable is not equal to 1 (one), the special
176
# positional parameter $0, within a function call, is the name of the
177
# function.
178
progpath="$0"
179

  
180
# The name of this program:
181
# In the unlikely event $progname began with a '-', it would play havoc with
182
# func_echo (imagine progname=-n), so we prepend ./ in that case:
183
func_dirname_and_basename "$progpath"
184
progname=$func_basename_result
185
case $progname in
186
  -*) progname=./$progname ;;
187
esac
188

  
189
# Make sure we have an absolute path for reexecution:
190
case $progpath in
191
  [\\/]*|[A-Za-z]:\\*) ;;
192
  *[\\/]*)
193
     progdir=$func_dirname_result
194
     progdir=`cd "$progdir" && pwd`
195
     progpath="$progdir/$progname"
196
     ;;
197
  *)
198
     save_IFS="$IFS"
199
     IFS=:
200
     for progdir in $PATH; do
201
       IFS="$save_IFS"
202
       test -x "$progdir/$progname" && break
203
     done
204
     IFS="$save_IFS"
205
     test -n "$progdir" || progdir=`pwd`
206
     progpath="$progdir/$progname"
207
     ;;
208
esac
209

  
210
# Sed substitution that helps us do robust quoting.  It backslashifies
211
# metacharacters that are still active within double-quoted strings.
212
Xsed="${SED}"' -e 1s/^X//'
213
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
214

  
215
# Same as above, but do not quote variable references.
216
double_quote_subst='s/\(["`\\]\)/\\\1/g'
217

  
218
# Re-`\' parameter expansions in output of double_quote_subst that were
219
# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
220
# in input to double_quote_subst, that '$' was protected from expansion.
221
# Since each input `\' is now two `\'s, look for any number of runs of
222
# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
223
bs='\\'
224
bs2='\\\\'
225
bs4='\\\\\\\\'
226
dollar='\$'
227
sed_double_backslash="\
228
  s/$bs4/&\\
229
/g
230
  s/^$bs2$dollar/$bs&/
231
  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
232
  s/\n//g"
233

  
234
# Standard options:
235
opt_dry_run=false
236
opt_help=false
237
opt_quiet=false
238
opt_verbose=false
239
opt_warning=:
240

  
241
# func_echo arg...
242
# Echo program name prefixed message, along with the current mode
243
# name if it has been set yet.
244
func_echo ()
245
{
246
    $ECHO "$progname${mode+: }$mode: $*"
247
}
248

  
249
# func_verbose arg...
250
# Echo program name prefixed message in verbose mode only.
251
func_verbose ()
252
{
253
    $opt_verbose && func_echo ${1+"$@"}
254

  
255
    # A bug in bash halts the script if the last line of a function
256
    # fails when set -e is in force, so we need another command to
257
    # work around that:
258
    :
259
}
260

  
261
# func_error arg...
262
# Echo program name prefixed message to standard error.
263
func_error ()
264
{
265
    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
266
}
267

  
268
# func_warning arg...
269
# Echo program name prefixed warning message to standard error.
270
func_warning ()
271
{
272
    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
273

  
274
    # bash bug again:
275
    :
276
}
277

  
278
# func_fatal_error arg...
279
# Echo program name prefixed message to standard error, and exit.
280
func_fatal_error ()
281
{
282
    func_error ${1+"$@"}
283
    exit $EXIT_FAILURE
284
}
285

  
286
# func_fatal_help arg...
287
# Echo program name prefixed message to standard error, followed by
288
# a help hint, and exit.
289
func_fatal_help ()
290
{
291
    func_error ${1+"$@"}
292
    func_fatal_error "$help"
293
}
294
help="Try \`$progname --help' for more information."  ## default
295

  
296

  
297
# func_grep expression filename
298
# Check whether EXPRESSION matches any line of FILENAME, without output.
299
func_grep ()
300
{
301
    $GREP "$1" "$2" >/dev/null 2>&1
302
}
303

  
304

  
305
# func_mkdir_p directory-path
306
# Make sure the entire path to DIRECTORY-PATH is available.
307
func_mkdir_p ()
308
{
309
    my_directory_path="$1"
310
    my_dir_list=
311

  
312
    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
313

  
314
      # Protect directory names starting with `-'
315
      case $my_directory_path in
316
        -*) my_directory_path="./$my_directory_path" ;;
317
      esac
318

  
319
      # While some portion of DIR does not yet exist...
320
      while test ! -d "$my_directory_path"; do
321
        # ...make a list in topmost first order.  Use a colon delimited
322
	# list incase some portion of path contains whitespace.
323
        my_dir_list="$my_directory_path:$my_dir_list"
324

  
325
        # If the last portion added has no slash in it, the list is done
326
        case $my_directory_path in */*) ;; *) break ;; esac
327

  
328
        # ...otherwise throw away the child directory and loop
329
        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
330
      done
331
      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
332

  
333
      save_mkdir_p_IFS="$IFS"; IFS=':'
334
      for my_dir in $my_dir_list; do
335
	IFS="$save_mkdir_p_IFS"
336
        # mkdir can fail with a `File exist' error if two processes
337
        # try to create one of the directories concurrently.  Don't
338
        # stop in that case!
339
        $MKDIR "$my_dir" 2>/dev/null || :
340
      done
341
      IFS="$save_mkdir_p_IFS"
342

  
343
      # Bail out if we (or some other process) failed to create a directory.
344
      test -d "$my_directory_path" || \
345
        func_fatal_error "Failed to create \`$1'"
346
    fi
347
}
348

  
349

  
162 350
# func_mktempdir [string]
163 351
# Make a temporary directory that won't clash with other running
164 352
# libtool processes, and avoids race conditions if possible.  If
......
167 355
{
168 356
    my_template="${TMPDIR-/tmp}/${1-$progname}"
169 357

  
170
    if test "$run" = ":"; then
358
    if test "$opt_dry_run" = ":"; then
171 359
      # Return a directory name, but don't create it in dry-run mode
172 360
      my_tmpdir="${my_template}-$$"
173 361
    else
......
176 364
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
177 365

  
178 366
      if test ! -d "$my_tmpdir"; then
179
	# Failing that, at least try and use $RANDOM to avoid a race
180
	my_tmpdir="${my_template}-${RANDOM-0}$$"
367
        # Failing that, at least try and use $RANDOM to avoid a race
368
        my_tmpdir="${my_template}-${RANDOM-0}$$"
181 369

  
182
	save_mktempdir_umask=`umask`
183
	umask 0077
184
	$mkdir "$my_tmpdir"
185
	umask $save_mktempdir_umask
370
        save_mktempdir_umask=`umask`
371
        umask 0077
372
        $MKDIR "$my_tmpdir"
373
        umask $save_mktempdir_umask
186 374
      fi
187 375

  
188 376
      # If we're not in dry-run mode, bomb out on failure
189
      test -d "$my_tmpdir" || {
190
        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
191
	exit $EXIT_FAILURE
192
      }
377
      test -d "$my_tmpdir" || \
378
        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
193 379
    fi
194 380

  
195
    $echo "X$my_tmpdir" | $Xsed
381
    $ECHO "X$my_tmpdir" | $Xsed
196 382
}
197 383

  
198 384

  
199
# func_win32_libid arg
200
# return the library type of file 'arg'
201
#
202
# Need a lot of goo to handle *both* DLLs and import libs
203
# Has to be a shell function in order to 'eat' the argument
204
# that is supplied when $file_magic_command is called.
205
func_win32_libid ()
385
# func_quote_for_eval arg
386
# Aesthetically quote ARG to be evaled later.
387
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
388
# is double-quoted, suitable for a subsequent eval, whereas
389
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
390
# which are still active within double quotes backslashified.
391
func_quote_for_eval ()
206 392
{
207
  win32_libid_type="unknown"
208
  win32_fileres=`file -L $1 2>/dev/null`
209
  case $win32_fileres in
210
  *ar\ archive\ import\ library*) # definitely import
211
    win32_libid_type="x86 archive import"
212
    ;;
213
  *ar\ archive*) # could be an import, or static
214
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
215
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
216
      win32_nmres=`eval $NM -f posix -A $1 | \
217
	$SED -n -e '1,100{
218
		/ I /{
219
			s,.*,import,
220
			p
221
			q
222
			}
223
		}'`
224
      case $win32_nmres in
225
      import*)  win32_libid_type="x86 archive import";;
226
      *)        win32_libid_type="x86 archive static";;
227
      esac
228
    fi
229
    ;;
230
  *DLL*)
231
    win32_libid_type="x86 DLL"
232
    ;;
233
  *executable*) # but shell scripts are "executable" too...
234
    case $win32_fileres in
235
    *MS\ Windows\ PE\ Intel*)
236
      win32_libid_type="x86 DLL"
237
      ;;
393
    case $1 in
394
      *[\\\`\"\$]*)
395
	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
396
      *)
397
        func_quote_for_eval_unquoted_result="$1" ;;
238 398
    esac
239
    ;;
240
  esac
241
  $echo $win32_libid_type
399

  
400
    case $func_quote_for_eval_unquoted_result in
401
      # Double-quote args containing shell metacharacters to delay
402
      # word splitting, command substitution and and variable
403
      # expansion for a subsequent eval.
404
      # Many Bourne shells cannot handle close brackets correctly
405
      # in scan sets, so we specify it separately.
406
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
407
        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
408
        ;;
409
      *)
410
        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
411
    esac
242 412
}
243 413

  
244 414

  
245
# func_infer_tag arg
246
# Infer tagged configuration to use if any are available and
247
# if one wasn't chosen via the "--tag" command line option.
248
# Only attempt this if the compiler in the base compile
249
# command doesn't match the default compiler.
250
# arg is usually of the form 'gcc ...'
251
func_infer_tag ()
415
# func_quote_for_expand arg
416
# Aesthetically quote ARG to be evaled later; same as above,
417
# but do not quote variable references.
418
func_quote_for_expand ()
252 419
{
253
    if test -n "$available_tags" && test -z "$tagname"; then
254
      CC_quoted=
255
      for arg in $CC; do
256
	case $arg in
257
	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
258
	  arg="\"$arg\""
259
	  ;;
260
	esac
261
	CC_quoted="$CC_quoted $arg"
262
      done
263
      case $@ in
264
      # Blanks in the command may have been stripped by the calling shell,
265
      # but not from the CC environment variable when configure was run.
266
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
267
      # Blanks at the start of $base_compile will cause this to fail
268
      # if we don't check for them as well.
420
    case $1 in
421
      *[\\\`\"]*)
422
	my_arg=`$ECHO "X$1" | $Xsed \
423
	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
269 424
      *)
270
	for z in $available_tags; do
271
	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
272
	    # Evaluate the configuration.
273
	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
274
	    CC_quoted=
275
	    for arg in $CC; do
276
	    # Double-quote args containing other shell metacharacters.
277
	    case $arg in
278
	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
279
	      arg="\"$arg\""
280
	      ;;
281
	    esac
282
	    CC_quoted="$CC_quoted $arg"
283
	  done
284
	    case "$@ " in
285
	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
286
	      # The compiler in the base compile command matches
287
	      # the one in the tagged configuration.
288
	      # Assume this is the tagged configuration we want.
289
	      tagname=$z
290
	      break
291
	      ;;
292
	    esac
293
	  fi
294
	done
295
	# If $tagname still isn't set, then no tagged configuration
296
	# was found and let the user know that the "--tag" command
297
	# line option must be used.
298
	if test -z "$tagname"; then
299
	  $echo "$modename: unable to infer tagged configuration"
300
	  $echo "$modename: specify a tag with \`--tag'" 1>&2
301
	  exit $EXIT_FAILURE
302
#        else
303
#          $echo "$modename: using $tagname tagged configuration"
304
	fi
305
	;;
306
      esac
307
    fi
425
        my_arg="$1" ;;
426
    esac
427

  
428
    case $my_arg in
429
      # Double-quote args containing shell metacharacters to delay
430
      # word splitting and command substitution for a subsequent eval.
431
      # Many Bourne shells cannot handle close brackets correctly
432
      # in scan sets, so we specify it separately.
433
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
434
        my_arg="\"$my_arg\""
435
        ;;
436
    esac
437

  
438
    func_quote_for_expand_result="$my_arg"
308 439
}
309 440

  
310 441

  
311
# func_extract_an_archive dir oldlib
312
func_extract_an_archive ()
442
# func_show_eval cmd [fail_exp]
443
# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
444
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
445
# is given, then evaluate it.
446
func_show_eval ()
313 447
{
314
    f_ex_an_ar_dir="$1"; shift
315
    f_ex_an_ar_oldlib="$1"
448
    my_cmd="$1"
449
    my_fail_exp="${2-:}"
316 450

  
317
    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
318
    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
319
    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
320
     :
321
    else
322
      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
323
      exit $EXIT_FAILURE
451
    ${opt_silent-false} || {
452
      func_quote_for_expand "$my_cmd"
453
      eval "func_echo $func_quote_for_expand_result"
454
    }
455

  
456
    if ${opt_dry_run-false}; then :; else
457
      eval "$my_cmd"
458
      my_status=$?
459
      if test "$my_status" -eq 0; then :; else
460
	eval "(exit $my_status); $my_fail_exp"
461
      fi
324 462
    fi
325 463
}
326 464

  
327
# func_extract_archives gentop oldlib ...
328
func_extract_archives ()
465

  
466
# func_show_eval_locale cmd [fail_exp]
467
# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
468
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
469
# is given, then evaluate it.  Use the saved locale for evaluation.
470
func_show_eval_locale ()
329 471
{
330
    my_gentop="$1"; shift
331
    my_oldlibs=${1+"$@"}
332
    my_oldobjs=""
333
    my_xlib=""
334
    my_xabs=""
335
    my_xdir=""
336
    my_status=""
472
    my_cmd="$1"
473
    my_fail_exp="${2-:}"
337 474

  
338
    $show "${rm}r $my_gentop"
339
    $run ${rm}r "$my_gentop"
340
    $show "$mkdir $my_gentop"
341
    $run $mkdir "$my_gentop"
342
    my_status=$?
343
    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
344
      exit $my_status
475
    ${opt_silent-false} || {
476
      func_quote_for_expand "$my_cmd"
477
      eval "func_echo $func_quote_for_expand_result"
478
    }
479

  
480
    if ${opt_dry_run-false}; then :; else
481
      eval "$lt_user_locale
482
	    $my_cmd"
483
      my_status=$?
484
      eval "$lt_safe_locale"
485
      if test "$my_status" -eq 0; then :; else
486
	eval "(exit $my_status); $my_fail_exp"
487
      fi
345 488
    fi
489
}
346 490

  
347
    for my_xlib in $my_oldlibs; do
348
      # Extract the objects.
349
      case $my_xlib in
350
	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
351
	*) my_xabs=`pwd`"/$my_xlib" ;;
352
      esac
353
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
354
      my_xlib_u=$my_xlib
355
      while :; do
356
        case " $extracted_archives " in
357
	*" $my_xlib_u "*)
358
	  extracted_serial=`expr $extracted_serial + 1`
359
	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
360
	*) break ;;
361
	esac
362
      done
363
      extracted_archives="$extracted_archives $my_xlib_u"
364
      my_xdir="$my_gentop/$my_xlib_u"
365 491

  
366
      $show "${rm}r $my_xdir"
367
      $run ${rm}r "$my_xdir"
368
      $show "$mkdir $my_xdir"
369
      $run $mkdir "$my_xdir"
370
      exit_status=$?
371
      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
372
	exit $exit_status
373
      fi
374
      case $host in
375
      *-darwin*)
376
	$show "Extracting $my_xabs"
377
	# Do not bother doing anything if just a dry run
378
	if test -z "$run"; then
379
	  darwin_orig_dir=`pwd`
380
	  cd $my_xdir || exit $?
381
	  darwin_archive=$my_xabs
382
	  darwin_curdir=`pwd`
383
	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
384
	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
385
	  if test -n "$darwin_arches"; then 
386
	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
387
	    darwin_arch=
388
	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
389
	    for darwin_arch in  $darwin_arches ; do
390
	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
391
	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
392
	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
393
	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
394
	      cd "$darwin_curdir"
395
	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
396
	    done # $darwin_arches
397
      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
398
	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
399
	    darwin_file=
400
	    darwin_files=
401
	    for darwin_file in $darwin_filelist; do
402
	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
403
	      lipo -create -output "$darwin_file" $darwin_files
404
	    done # $darwin_filelist
405
	    ${rm}r unfat-$$
406
	    cd "$darwin_orig_dir"
407
	  else
408
	    cd "$darwin_orig_dir"
409
 	    func_extract_an_archive "$my_xdir" "$my_xabs"
410
	  fi # $darwin_arches
411
	fi # $run
412
	;;
413
      *)
414
        func_extract_an_archive "$my_xdir" "$my_xabs"
415
        ;;
416
      esac
417
      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
418
    done
419
    func_extract_archives_result="$my_oldobjs"
492

  
493

  
494

  
495
# func_version
496
# Echo version message to standard output and exit.
497
func_version ()
498
{
499
    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
500
        s/^# //
501
	s/^# *$//
502
        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
503
        p
504
     }' < "$progpath"
505
     exit $?
420 506
}
421
# End of Shell function definitions
422
#####################################
423 507

  
424
# Darwin sucks
425
eval std_shrext=\"$shrext_cmds\"
508
# func_usage
509
# Echo short help message to standard output and exit.
510
func_usage ()
511
{
512
    $SED -n '/^# Usage:/,/# -h/ {
513
        s/^# //
514
	s/^# *$//
515
	s/\$progname/'$progname'/
516
	p
517
    }' < "$progpath"
518
    $ECHO
519
    $ECHO "run \`$progname --help | more' for full usage"
520
    exit $?
521
}
426 522

  
427
disable_libs=no
523
# func_help
524
# Echo long help message to standard output and exit.
525
func_help ()
526
{
527
    $SED -n '/^# Usage:/,/# Report bugs to/ {
528
        s/^# //
529
	s/^# *$//
530
	s*\$progname*'$progname'*
531
	s*\$host*'"$host"'*
532
	s*\$SHELL*'"$SHELL"'*
533
	s*\$LTCC*'"$LTCC"'*
534
	s*\$LTCFLAGS*'"$LTCFLAGS"'*
535
	s*\$LD*'"$LD"'*
536
	s/\$with_gnu_ld/'"$with_gnu_ld"'/
537
	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
538
	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
539
	p
540
     }' < "$progpath"
541
    exit $?
542
}
428 543

  
429
# Parse our command line options once, thoroughly.
430
while test "$#" -gt 0
431
do
432
  arg="$1"
544
# func_missing_arg argname
545
# Echo program name prefixed message to standard error and set global
546
# exit_cmd.
547
func_missing_arg ()
548
{
549
    func_error "missing argument for $1"
550
    exit_cmd=exit
551
}
552

  
553
exit_cmd=:
554

  
555

  
556

  
557

  
558

  
559
# Check that we have a working $ECHO.
560
if test "X$1" = X--no-reexec; then
561
  # Discard the --no-reexec flag, and continue.
433 562
  shift
563
elif test "X$1" = X--fallback-echo; then
564
  # Avoid inline document here, it may be left over
565
  :
566
elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
567
  # Yippee, $ECHO works!
568
  :
569
else
570
  # Restart under the correct shell, and then maybe $ECHO will work.
571
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
572
fi
434 573

  
435
  case $arg in
436
  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
437
  *) optarg= ;;
438
  esac
574
if test "X$1" = X--fallback-echo; then
575
  # used as fallback echo
576
  shift
577
  cat <<EOF
578
$*
579
EOF
580
  exit $EXIT_SUCCESS
581
fi
439 582

  
440
  # If the previous option needs an argument, assign it.
441
  if test -n "$prev"; then
442
    case $prev in
443
    execute_dlfiles)
444
      execute_dlfiles="$execute_dlfiles $arg"
445
      ;;
446
    tag)
447
      tagname="$arg"
448
      preserve_args="${preserve_args}=$arg"
583
magic="%%%MAGIC variable%%%"
584
magic_exe="%%%MAGIC EXE variable%%%"
449 585

  
450
      # Check whether tagname contains only valid characters
451
      case $tagname in
452
      *[!-_A-Za-z0-9,/]*)
453
	$echo "$progname: invalid tag name: $tagname" 1>&2
454
	exit $EXIT_FAILURE
455
	;;
456
      esac
586
# Global variables.
587
# $mode is unset
588
nonopt=
589
execute_dlfiles=
590
preserve_args=
591
lo2o="s/\\.lo\$/.${objext}/"
592
o2lo="s/\\.${objext}\$/.lo/"
593
extracted_archives=
594
extracted_serial=0
457 595

  
458
      case $tagname in
459
      CC)
460
	# Don't test for the "default" C tag, as we know, it's there, but
461
	# not specially marked.
462
	;;
463
      *)
464
	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
465
	  taglist="$taglist $tagname"
466
	  # Evaluate the configuration.
467
	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
468
	else
469
	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
470
	fi
471
	;;
472
      esac
473
      ;;
474
    *)
475
      eval "$prev=\$arg"
476
      ;;
477
    esac
596
opt_dry_run=false
597
opt_duplicate_deps=false
598
opt_silent=false
599
opt_debug=:
478 600

  
479
    prev=
480
    prevopt=
481
    continue
482
  fi
601
# If this variable is set in any of the actions, the command in it
602
# will be execed at the end.  This prevents here-documents from being
603
# left over by shells.
604
exec_cmd=
483 605

  
484
  # Have we seen a non-optional argument yet?
485
  case $arg in
486
  --help)
487
    show_help=yes
488
    ;;
606
# func_fatal_configuration arg...
607
# Echo program name prefixed message to standard error, followed by
608
# a configuration failure hint, and exit.
609
func_fatal_configuration ()
610
{
611
    func_error ${1+"$@"}
612
    func_error "See the $PACKAGE documentation for more information."
613
    func_fatal_error "Fatal configuration error."
614
}
489 615

  
490
  --version)
491
    echo "\
492
$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
493 616

  
494
Copyright (C) 2008  Free Software Foundation, Inc.
495
This is free software; see the source for copying conditions.  There is NO
496
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
497
    exit $?
498
    ;;
617
# func_config
618
# Display the configuration for all the tags in this script.
619
func_config ()
620
{
621
    re_begincf='^# ### BEGIN LIBTOOL'
622
    re_endcf='^# ### END LIBTOOL'
499 623

  
500
  --config)
501
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
624
    # Default configuration.
625
    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
626

  
502 627
    # Now print the configurations for the tags.
503 628
    for tagname in $taglist; do
504
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
629
      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
505 630
    done
631

  
506 632
    exit $?
507
    ;;
633
}
508 634

  
509
  --debug)
510
    $echo "$progname: enabling shell trace mode"
511
    set -x
512
    preserve_args="$preserve_args $arg"
513
    ;;
514

  
515
  --dry-run | -n)
516
    run=:
517
    ;;
518

  
519
  --features)
520
    $echo "host: $host"
635
# func_features
636
# Display the features supported by this script.
637
func_features ()
638
{
639
    $ECHO "host: $host"
521 640
    if test "$build_libtool_libs" = yes; then
522
      $echo "enable shared libraries"
641
      $ECHO "enable shared libraries"
523 642
    else
524
      $echo "disable shared libraries"
643
      $ECHO "disable shared libraries"
525 644
    fi
526 645
    if test "$build_old_libs" = yes; then
527
      $echo "enable static libraries"
646
      $ECHO "enable static libraries"
528 647
    else
529
      $echo "disable static libraries"
648
      $ECHO "disable static libraries"
530 649
    fi
650

  
531 651
    exit $?
532
    ;;
652
}
533 653

  
534
  --finish) mode="finish" ;;
654
# func_enable_tag tagname
655
# Verify that TAGNAME is valid, and either flag an error and exit, or
656
# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
657
# variable here.
658
func_enable_tag ()
659
{
660
  # Global variable:
661
  tagname="$1"
535 662

  
536
  --mode) prevopt="--mode" prev=mode ;;
537
  --mode=*) mode="$optarg" ;;
663
  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
664
  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
665
  sed_extractcf="/$re_begincf/,/$re_endcf/p"
538 666

  
539
  --preserve-dup-deps) duplicate_deps="yes" ;;
667
  # Validate tagname.
668
  case $tagname in
669
    *[!-_A-Za-z0-9,/]*)
670
      func_fatal_error "invalid tag name: $tagname"
671
      ;;
672
  esac
540 673

  
541
  --quiet | --silent)
542
    show=:
543
    preserve_args="$preserve_args $arg"
544
    ;;
674
  # Don't test for the "default" C tag, as we know it's
675
  # there but not specially marked.
676
  case $tagname in
677
    CC) ;;
678
    *)
679
      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
680
	taglist="$taglist $tagname"
545 681

  
546
  --tag)
547
    prevopt="--tag"
548
    prev=tag
549
    preserve_args="$preserve_args --tag"
682
	# Evaluate the configuration.  Be careful to quote the path
683
	# and the sed script, to avoid splitting on whitespace, but
684
	# also don't use non-portable quotes within backquotes within
685
	# quotes we have to do it in 2 steps:
686
	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
687
	eval "$extractedcf"
688
      else
689
	func_error "ignoring unknown tag $tagname"
690
      fi
691
      ;;
692
  esac
693
}
694

  
695
# Parse options once, thoroughly.  This comes as soon as possible in
696
# the script to make things like `libtool --version' happen quickly.
697
{
698

  
699
  # Shorthand for --mode=foo, only valid as the first argument
700
  case $1 in
701
  clean|clea|cle|cl)
702
    shift; set dummy --mode clean ${1+"$@"}; shift
550 703
    ;;
551
  --tag=*)
552
    set tag "$optarg" ${1+"$@"}
553
    shift
554
    prev=tag
555
    preserve_args="$preserve_args --tag"
704
  compile|compil|compi|comp|com|co|c)
705
    shift; set dummy --mode compile ${1+"$@"}; shift
556 706
    ;;
557

  
558
  -dlopen)
559
    prevopt="-dlopen"
560
    prev=execute_dlfiles
707
  execute|execut|execu|exec|exe|ex|e)
708
    shift; set dummy --mode execute ${1+"$@"}; shift
561 709
    ;;
562

  
563
  -*)
564
    $echo "$modename: unrecognized option \`$arg'" 1>&2
565
    $echo "$help" 1>&2
566
    exit $EXIT_FAILURE
710
  finish|finis|fini|fin|fi|f)
711
    shift; set dummy --mode finish ${1+"$@"}; shift
567 712
    ;;
568

  
569
  *)
570
    nonopt="$arg"
571
    break
713
  install|instal|insta|inst|ins|in|i)
714
    shift; set dummy --mode install ${1+"$@"}; shift
572 715
    ;;
716
  link|lin|li|l)
717
    shift; set dummy --mode link ${1+"$@"}; shift
718
    ;;
719
  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
720
    shift; set dummy --mode uninstall ${1+"$@"}; shift
721
    ;;
573 722
  esac
574
done
575 723

  
576
if test -n "$prevopt"; then
577
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
578
  $echo "$help" 1>&2
579
  exit $EXIT_FAILURE
580
fi
724
  # Parse non-mode specific arguments:
725
  while test "$#" -gt 0; do
726
    opt="$1"
727
    shift
581 728

  
582
case $disable_libs in
583
no) 
584
  ;;
585
shared)
586
  build_libtool_libs=no
587
  build_old_libs=yes
588
  ;;
589
static)
590
  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
591
  ;;
592
esac
729
    case $opt in
730
      --config)		func_config					;;
593 731

  
594
# If this variable is set in any of the actions, the command in it
595
# will be execed at the end.  This prevents here-documents from being
596
# left over by shells.
597
exec_cmd=
732
      --debug)		preserve_args="$preserve_args $opt"
733
			func_echo "enabling shell trace mode"
734
			opt_debug='set -x'
735
			$opt_debug
736
			;;
598 737

  
599
if test -z "$show_help"; then
738
      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
739
			execute_dlfiles="$execute_dlfiles $1"
740
			shift
741
			;;
600 742

  
601
  # Infer the operation mode.
602
  if test -z "$mode"; then
603
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
604
    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
605
    case $nonopt in
606
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
607
      mode=link
608
      for arg
609
      do
610
	case $arg in
611
	-c)
612
	   mode=compile
613
	   break
614
	   ;;
615
	esac
616
      done
743
      --dry-run | -n)	opt_dry_run=:					;;
744
      --features)       func_features					;;
745
      --finish)		mode="finish"					;;
746

  
747
      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
748
			case $1 in
749
			  # Valid mode arguments:
750
			  clean)	;;
751
			  compile)	;;
752
			  execute)	;;
753
			  finish)	;;
754
			  install)	;;
755
			  link)		;;
756
			  relink)	;;
757
			  uninstall)	;;
758

  
759
			  # Catch anything else as an error
760
			  *) func_error "invalid argument for $opt"
761
			     exit_cmd=exit
762
			     break
763
			     ;;
764
		        esac
765

  
766
			mode="$1"
767
			shift
768
			;;
769

  
770
      --preserve-dup-deps)
771
			opt_duplicate_deps=:				;;
772

  
773
      --quiet|--silent)	preserve_args="$preserve_args $opt"
774
			opt_silent=:
775
			;;
776

  
777
      --verbose| -v)	preserve_args="$preserve_args $opt"
778
			opt_silent=false
779
			;;
780

  
781
      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
782
			preserve_args="$preserve_args $opt $1"
783
			func_enable_tag "$1"	# tagname is set here
784
			shift
785
			;;
786

  
787
      # Separate optargs to long options:
788
      -dlopen=*|--mode=*|--tag=*)
789
			func_opt_split "$opt"
790
			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
791
			shift
792
			;;
793

  
794
      -\?|-h)		func_usage					;;
795
      --help)		opt_help=:					;;
796
      --version)	func_version					;;
797

  
798
      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
799

  
800
      *)		nonopt="$opt"
801
			break
802
			;;
803
    esac
804
  done
805

  
806

  
807
  case $host in
808
    *cygwin* | *mingw* | *pw32* | *cegcc*)
809
      # don't eliminate duplications in $postdeps and $predeps
810
      opt_duplicate_compiler_generated_deps=:
617 811
      ;;
618
    *db | *dbx | *strace | *truss)
619
      mode=execute
812
    *)
813
      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
620 814
      ;;
621
    *install*|cp|mv)
622
      mode=install
623
      ;;
624
    *rm)
625
      mode=uninstall
626
      ;;
627
    *)
628
      # If we have no mode, but dlfiles were specified, then do execute mode.
629
      test -n "$execute_dlfiles" && mode=execute
815
  esac
630 816

  
631
      # Just use the default operation mode.
632
      if test -z "$mode"; then
633
	if test -n "$nonopt"; then
634
	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
635
	else
636
	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
637
	fi
817
  # Having warned about all mis-specified options, bail out if
818
  # anything was wrong.
819
  $exit_cmd $EXIT_FAILURE
820
}
821

  
822
# func_check_version_match
823
# Ensure that we are using m4 macros, and libtool script from the same
824
# release of libtool.
825
func_check_version_match ()
826
{
827
  if test "$package_revision" != "$macro_revision"; then
828
    if test "$VERSION" != "$macro_version"; then
829
      if test -z "$macro_version"; then
830
        cat >&2 <<_LT_EOF
831
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
832
$progname: definition of this LT_INIT comes from an older release.
833
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
834
$progname: and run autoconf again.
835
_LT_EOF
836
      else
837
        cat >&2 <<_LT_EOF
838
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
839
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
840
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
841
$progname: and run autoconf again.
842
_LT_EOF
638 843
      fi
639
      ;;
640
    esac
844
    else
845
      cat >&2 <<_LT_EOF
846
$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
847
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
848
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
849
$progname: of $PACKAGE $VERSION and run autoconf again.
850
_LT_EOF
851
    fi
852

  
853
    exit $EXIT_MISMATCH
641 854
  fi
855
}
642 856

  
857

  
858
## ----------- ##
859
##    Main.    ##
860
## ----------- ##
861

  
862
$opt_help || {
863
  # Sanity checks first:
864
  func_check_version_match
865

  
866
  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
867
    func_fatal_configuration "not configured to build any kind of library"
868
  fi
869

  
870
  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
871

  
872

  
873
  # Darwin sucks
874
  eval std_shrext=\"$shrext_cmds\"
875

  
876

  
643 877
  # Only execute mode is allowed to have -dlopen flags.
644 878
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
645
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
646
    $echo "$help" 1>&2
879
    func_error "unrecognized option \`-dlopen'"
880
    $ECHO "$help" 1>&2
647 881
    exit $EXIT_FAILURE
648 882
  fi
649 883

  
650 884
  # Change the help message to a mode-specific one.
651 885
  generic_help="$help"
652
  help="Try \`$modename --help --mode=$mode' for more information."
886
  help="Try \`$progname --help --mode=$mode' for more information."
887
}
653 888

  
654
  # These modes are in order of execution frequency so that they run quickly.
655
  case $mode in
656
  # libtool compile mode
657
  compile)
658
    modename="$modename: compile"
889

  
890
# func_lalib_p file
891
# True iff FILE is a libtool `.la' library or `.lo' object file.
892
# This function is only a basic sanity check; it will hardly flush out
893
# determined imposters.
894
func_lalib_p ()
895
{
896
    test -f "$1" &&
897
      $SED -e 4q "$1" 2>/dev/null \
898
        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
899
}
900

  
901
# func_lalib_unsafe_p file
902
# True iff FILE is a libtool `.la' library or `.lo' object file.
903
# This function implements the same check as func_lalib_p without
904
# resorting to external programs.  To this end, it redirects stdin and
905
# closes it afterwards, without saving the original file descriptor.
906
# As a safety measure, use it only where a negative result would be
907
# fatal anyway.  Works if `file' does not exist.
908
func_lalib_unsafe_p ()
909
{
910
    lalib_p=no
911
    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
912
	for lalib_p_l in 1 2 3 4
913
	do
914
	    read lalib_p_line
915
	    case "$lalib_p_line" in
916
		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
917
	    esac
918
	done
919
	exec 0<&5 5<&-
920
    fi
921
    test "$lalib_p" = yes
922
}
923

  
924
# func_ltwrapper_script_p file
925
# True iff FILE is a libtool wrapper script
926
# This function is only a basic sanity check; it will hardly flush out
927
# determined imposters.
928
func_ltwrapper_script_p ()
929
{
930
    func_lalib_p "$1"
931
}
932

  
933
# func_ltwrapper_executable_p file
934
# True iff FILE is a libtool wrapper executable
935
# This function is only a basic sanity check; it will hardly flush out
936
# determined imposters.
937
func_ltwrapper_executable_p ()
938
{
939
    func_ltwrapper_exec_suffix=
940
    case $1 in
941
    *.exe) ;;
942
    *) func_ltwrapper_exec_suffix=.exe ;;
943
    esac
944
    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
945
}
946

  
947
# func_ltwrapper_scriptname file
948
# Assumes file is an ltwrapper_executable
949
# uses $file to determine the appropriate filename for a
950
# temporary ltwrapper_script.
951
func_ltwrapper_scriptname ()
952
{
953
    func_ltwrapper_scriptname_result=""
954
    if func_ltwrapper_executable_p "$1"; then
955
	func_dirname_and_basename "$1" "" "."
956
	func_stripname '' '.exe' "$func_basename_result"
957
	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
958
    fi
959
}
960

  
961
# func_ltwrapper_p file
962
# True iff FILE is a libtool wrapper script or wrapper executable
963
# This function is only a basic sanity check; it will hardly flush out
964
# determined imposters.
965
func_ltwrapper_p ()
966
{
967
    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
968
}
969

  
970

  
971
# func_execute_cmds commands fail_cmd
972
# Execute tilde-delimited COMMANDS.
973
# If FAIL_CMD is given, eval that upon failure.
974
# FAIL_CMD may read-access the current command in variable CMD!
975
func_execute_cmds ()
976
{
977
    $opt_debug
978
    save_ifs=$IFS; IFS='~'
979
    for cmd in $1; do
980
      IFS=$save_ifs
981
      eval cmd=\"$cmd\"
982
      func_show_eval "$cmd" "${2-:}"
983
    done
984
    IFS=$save_ifs
985
}
986

  
987

  
988
# func_source file
989
# Source FILE, adding directory component if necessary.
990
# Note that it is not necessary on cygwin/mingw to append a dot to
991
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
992
# behavior happens only for exec(3), not for open(2)!  Also, sourcing
993
# `FILE.' does not work on cygwin managed mounts.
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff