~xubuntu-dev/libxfce4util/lucid

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2009-03-01 11:15:01 UTC
  • mfrom: (1.2.15 upstream) (2.1.4 experimental)
  • Revision ID: james.westby@ubuntu.com-20090301111501-juomjm1q691anbtk
Tags: 4.6.0-1ubuntu1
* Merge Xfce 4.6.0 final with Debian experimental, remaining Ubuntu changes:
  - debian/control: added gtk-doc-tools to build-deps
  - debian/rules: pass --enable-gtk-doc to ./configure
  - debian/patches:
    + 01_add-xubuntu-in-config-dirs.patch: append "/etc/xdg/xubuntu" to the
      list of config directories
    + 02_add-mythbuntu-in-config-dirs.patch: append "/etc/xdg/mythbuntu" to
      the list of config directories
    + series:
      . don't apply 01_add-desktop-base-in-config-dirs.patch
      . refreshed.

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