~ubuntu-branches/ubuntu/oneiric/gconf/oneiric

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