~ubuntu-branches/ubuntu/saucy/cpptest/saucy

« back to all changes in this revision

Viewing changes to config/ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-05-12 20:21:46 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100512202146-vwt55nfazbor3xvb
Tags: 1.1.1-0ubuntu1
* New upstream release.
* Switch to debhelper 7.
* Switch to debian 3.0 (quilt) format.
* Update debian/copyright.
* Refresh patches.
* Bump Standards.

Show diffs side-by-side

added added

removed removed

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