~ubuntu-branches/ubuntu/precise/xfce4-power-manager/precise

2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
1
# libtool (GNU libtool) 2.4
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
3
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
5
# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
6
# This is free software; see the source for copying conditions.  There is NO
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
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,
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
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
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
#
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
49
# MODE must be one of the following:
50
#
51
#         clean              remove files from the build directory
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
#
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
59
# MODE-ARGS vary depending on the MODE.  When passed as first option,
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
67
#         shell:		$SHELL
68
#         compiler:		$LTCC
69
#         compiler flags:		$LTCFLAGS
70
#         linker:		$LD (gnu? $with_gnu_ld)
71
#         $progname:	(GNU libtool) 2.4
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
72
#         automake:	$automake_version
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
73
#         autoconf:	$autoconf_version
74
#
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
75
# Report bugs to <bug-libtool@gnu.org>.
76
# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
77
# General help using GNU software: <http://www.gnu.org/gethelp/>.
78
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
79
PROGRAM=libtool
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
80
PACKAGE=libtool
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
81
VERSION=2.4
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
82
TIMESTAMP=""
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
83
package_revision=1.3293
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
84
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
85
# Be Bourne compatible
86
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
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.
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
108
lt_user_locale=
109
lt_safe_locale=
110
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
111
do
112
  eval "if test \"\${$lt_var+set}\" = set; then
113
          save_$lt_var=\$$lt_var
114
          $lt_var=C
115
	  export $lt_var
116
	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
117
	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
118
	fi"
119
done
120
LC_ALL=C
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
121
LANGUAGE=C
122
export LANGUAGE LC_ALL
123
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
124
$lt_unset CDPATH
125
126
127
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
134
135
136
: ${CP="cp -f"}
137
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
138
: ${EGREP="grep -E"}
139
: ${FGREP="grep -F"}
140
: ${GREP="grep"}
141
: ${LN_S="ln -s"}
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
142
: ${MAKE="make"}
143
: ${MKDIR="mkdir"}
144
: ${MV="mv -f"}
145
: ${RM="rm -f"}
146
: ${SED="sed"}
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
147
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
158
# Make sure IFS has a sensible default
159
lt_nl='
160
'
161
IFS=" 	$lt_nl"
162
163
dirname="s,/[^/]*$,,"
164
basename="s,^.*/,,"
165
166
# func_dirname file append nondir_replacement
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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.
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
227
# These SED scripts presuppose an absolute path with a trailing slash.
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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: }$*"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
446
}
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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...
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
461
# Invoke $ECHO with all args, space-separated.
462
func_echo_all ()
463
{
464
    $ECHO "$*"
465
}
466
467
# func_error arg...
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
468
# Echo program name prefixed message to standard error.
469
func_error ()
470
{
471
    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
472
}
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
479
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
536
      done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
537
      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
538
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
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
565
      # Return a directory name, but don't create it in dry-run mode
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
574
        my_tmpdir="${my_template}-${RANDOM-0}$$"
575
576
        save_mktempdir_umask=`umask`
577
        umask 0077
578
        $MKDIR "$my_tmpdir"
579
        umask $save_mktempdir_umask
580
      fi
581
582
      # If we're not in dry-run mode, bomb out on failure
583
      test -d "$my_tmpdir" || \
584
        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
585
    fi
586
587
    $ECHO "$my_tmpdir"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
588
}
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"` ;;
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
602
      *)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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 \
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
629
	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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
714
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
715
# func_version
716
# Echo version message to standard output and exit.
717
func_version ()
718
{
719
    $opt_debug
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
720
721
    $SED -n '/(C)/!b go
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
722
	:more
723
	/\./!{
724
	  N
725
	  s/\n# / /
726
	  b more
727
	}
728
	:go
729
	/^# '$PROGRAM' (GNU /,/# warranty; / {
730
        s/^# //
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
743
744
    $SED -n '/^# Usage:/,/^#  *.*--help/ {
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
745
        s/^# //
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
746
	s/^# *$//
747
	s/\$progname/'$progname'/
748
	p
749
    }' < "$progpath"
750
    echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
751
    $ECHO "run \`$progname --help | more' for full usage"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
752
    exit $?
753
}
754
755
# func_help [NOEXIT]
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
756
# Echo long help message to standard output and exit,
757
# unless 'noexit' is passed as argument.
758
func_help ()
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
759
{
760
    $opt_debug
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
761
762
    $SED -n '/^# Usage:/,/# Report bugs to/ {
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
763
	:print
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
764
        s/^# //
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
777
     }
778
     /^# .* home page:/b print
779
     /^# General help using/b print
780
     ' < "$progpath"
781
    ret=$?
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
782
    if test -z "$1"; then
783
      exit $ret
784
    fi
785
}
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
793
794
    func_error "missing argument for $1."
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
795
    exit_cmd=exit
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
796
}
797
798
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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=:
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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...
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
926
    if test "$build_libtool_libs" = yes; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
927
      echo "enable shared libraries"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
928
    else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
929
      echo "disable shared libraries"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
930
    fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
931
    if test "$build_old_libs" = yes; then
932
      echo "enable static libraries"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
933
    else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
934
      echo "disable static libraries"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
935
    fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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
## ----------- ##
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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" "" "."
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
1289
    func_stripname '' '.exe' "$func_basename_result"
1290
    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
1291
}
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
}
1334
1335
1336
# func_resolve_sysroot PATH
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
1376
    if test -n "$available_tags" && test -z "$tagname"; then
1377
      CC_quoted=
1378
      for arg in $CC; do
1379
	func_append_quoted CC_quoted "$arg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
1380
      done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
1381
      CC_expanded=`func_echo_all $CC`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
1382
      CC_quoted_expanded=`func_echo_all $CC_quoted`
1383
      case $@ in
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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 "* | \
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
1387
      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
1388
      # Blanks at the start of $base_compile will cause this to fail
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
1393
	    # Evaluate the configuration.
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.
1398
	      func_append_quoted CC_quoted "$arg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
1399
	    done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
1400
	    CC_expanded=`func_echo_all $CC`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
1401
	    CC_quoted_expanded=`func_echo_all $CC_quoted`
1402
	    case "$@ " in
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
1403
	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
1404
	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
1405
	      # The compiler in the base compile command matches
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
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
1437
      write_lobj=\'${2}\'
1438
    else
1439
      write_lobj=none
1440
    fi
1441
1442
    if test "$build_old_libs" = yes; then
1443
      write_oldobj=\'${3}\'
1444
    else
1445
      write_oldobj=none
1446
    fi
1447
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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...
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
1948
func_mode_compile ()
1949
{
1950
    $opt_debug
1951
    # Get the compilation command and the source file.
1952
    base_compile=
1953
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
1954
    suppress_opt=yes
1955
    suppress_output=
1956
    arg_mode=normal
1957
    libobj=
1958
    later=
1959
    pie_flag=
1960
1961
    for arg
1962
    do
1963
      case $arg_mode in
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"
1972
	arg_mode=normal
1973
	continue
1974
	;;
1975
1976
      normal )
1977
	# Accept any command-line options.
1978
	case $arg in
1979
	-o)
1980
	  test -n "$libobj" && \
1981
	    func_fatal_error "you cannot specify \`-o' more than once"
1982
	  arg_mode=target
1983
	  continue
1984
	  ;;
1985
1986
	-pie | -fpie | -fPIE)
1987
          func_append pie_flag " $arg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
1988
	  continue
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
1989
	  ;;
1990
1991
	-shared | -static | -prefer-pic | -prefer-non-pic)
1992
	  func_append later " $arg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
1993
	  continue
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2008
	  args=$func_stripname_result
2009
	  lastarg=
2010
	  save_ifs="$IFS"; IFS=','
2011
	  for arg in $args; do
2012
	    IFS="$save_ifs"
2013
	    func_append_quoted lastarg "$arg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2014
	  done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2015
	  IFS="$save_ifs"
2016
	  func_stripname ' ' '' "$lastarg"
2017
	  lastarg=$func_stripname_result
2018
2019
	  # Add the arguments to base_compile.
2020
	  func_append base_compile " $lastarg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2021
	  continue
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2022
	  ;;
2023
2024
	*)
2025
	  # Accept the current argument as the source file.
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
2035
      # Aesthetically quote the previous argument.
2036
      func_append_quoted base_compile "$lastarg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2037
    done # for arg
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2038
2039
    case $arg_mode in
2040
    arg)
2041
      func_fatal_error "you must specify an argument for -Xcompile"
2042
      ;;
2043
    target)
2044
      func_fatal_error "you must specify a target with \`-o'"
2045
      ;;
2046
    *)
2047
      # Get the name of the library object.
2048
      test -z "$libobj" && {
2049
	func_basename "$srcfile"
2050
	libobj="$func_basename_result"
2051
      }
2052
      ;;
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] | \
2059
    *.ada | *.adb | *.ads | *.asm | \
2060
    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
2061
    *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2062
      func_xform "$libobj"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2063
      libobj=$func_xform_result
2064
      ;;
2065
    esac
2066
2067
    case $libobj in
2068
    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
2069
    *)
2070
      func_fatal_error "cannot determine name of library object from \`$libobj'"
2071
      ;;
2072
    esac
2073
2074
    func_infer_tag $base_compile
2075
2076
    for arg in $later; do
2077
      case $arg in
2078
      -shared)
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)
2086
	build_libtool_libs=no
2087
	build_old_libs=yes
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"
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
2111
2112
    test -z "$base_compile" && \
2113
      func_fatal_help "you must specify a compilation command"
2114
2115
    # Delete any leftover library objects.
2116
    if test "$build_old_libs" = yes; then
2117
      removelist="$obj $lobj $libobj ${libobj}T"
2118
    else
2119
      removelist="$lobj $libobj ${libobj}T"
2120
    fi
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*)
2125
      pic_mode=default
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}
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2137
      lockfile="$output_obj.lock"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2138
    else
2139
      output_obj=
2140
      need_locks=no
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
2148
	func_echo "Waiting for $lockfile to be removed"
2149
	sleep 2
2150
      done
2151
    elif test "$need_locks" = warn; then
2152
      if test -f "$lockfile"; then
2153
	$ECHO "\
2154
*** ERROR, $lockfile exists and contains:
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
2165
	exit $EXIT_FAILURE
2166
      fi
2167
      func_append removelist " $output_obj"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2168
      $ECHO "$srcfile" > "$lockfile"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2169
    fi
2170
2171
    $opt_dry_run || $RM $removelist
2172
    func_append removelist " $lockfile"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2173
    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2174
2175
    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2176
    srcfile=$func_to_tool_file_result
2177
    func_quote_for_eval "$srcfile"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2178
    qsrcfile=$func_quote_for_eval_result
2179
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"
2187
      else
2188
	# Don't build PIC code
2189
	command="$base_compile $qsrcfile"
2190
      fi
2191
2192
      func_mkdir_p "$xdir$objdir"
2193
2194
      if test -z "$output_obj"; then
2195
	# Place PIC objects in $objdir
2196
	func_append command " -o $lobj"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2197
      fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2198
2199
      func_show_eval_locale "$command"	\
2200
          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
2201
2202
      if test "$need_locks" = warn &&
2203
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2204
	$ECHO "\
2205
*** ERROR, $lockfile contains:
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
2219
	exit $EXIT_FAILURE
2220
      fi
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
2224
	func_show_eval '$MV "$output_obj" "$lobj"' \
2225
	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
2226
      fi
2227
2228
      # Allow error messages only from the first compilation.
2229
      if test "$suppress_opt" = yes; then
2230
	suppress_output=' >/dev/null 2>&1'
2231
      fi
2232
    fi
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"
2239
      else
2240
	command="$base_compile $qsrcfile $pic_flag"
2241
      fi
2242
      if test "$compiler_c_o" = yes; then
2243
	func_append command " -o $obj"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2244
      fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2245
2246
      # Suppress compiler output if we already did a PIC compilation.
2247
      func_append command "$suppress_output"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2248
      func_show_eval_locale "$command" \
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2249
        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
2250
2251
      if test "$need_locks" = warn &&
2252
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
2253
	$ECHO "\
2254
*** ERROR, $lockfile contains:
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
2268
	exit $EXIT_FAILURE
2269
      fi
2270
2271
      # Just move the object if needed
2272
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
2273
	func_show_eval '$MV "$output_obj" "$obj"' \
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+"$@"}
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2293
}
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2294
2295
func_mode_help ()
2296
{
2297
    # We need to display help for each of the modes.
2298
    case $opt_mode in
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2299
      "")
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2330
  -prefer-non-pic   try to build non-PIC objects only
2331
  -shared           do not build a \`.o' file suitable for static linking
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2332
  -static           only build a \`.o' file suitable for static linking
2333
  -Wc,FLAG          pass FLAG directly to the compiler
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2334
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2387
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2407
                    libraries must be found in the PATH setting at runtime)
2408
  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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'"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2475
        ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2476
    esac
2477
2478
    echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2479
    $ECHO "Try \`$progname --help' for more information about other modes."
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2480
}
2481
2482
# Now that we've collected a possible --mode arg, show help if necessary
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2490
	func_mode_help
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2496
	echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2525
      test -f "$file" \
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2526
	|| func_fatal_help "\`$file' is not a file"
2527
2528
      dir=
2529
      case $file in
2530
      *.la)
2531
	func_resolve_sysroot "$file"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2532
	file=$func_resolve_sysroot_result
2533
2534
	# Check to see that this really is a libtool archive.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2556
	else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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 ) ;;
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2597
      *)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2613
    done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2638
      fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2639
      $ECHO "$cmd$args"
2640
      exit $EXIT_SUCCESS
2641
    fi
2642
}
2643
2644
test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2645
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2646
2647
# func_mode_finish arg...
2648
func_mode_finish ()
2649
{
2650
    $opt_debug
2651
    libs=
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2652
    libdirs=
2653
    admincmds=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2654
2655
    for opt in "$nonopt" ${1+"$@"}
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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 "
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2707
       $cmds"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2761
}
2762
2763
test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2764
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2775
      # Aesthetically quote it.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2789
    install_shared_prog=$install_prog
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2790
    case " $install_prog " in
2791
      *[\\\ /]cp\ *) install_cp=: ;;
2792
      *) install_cp=false ;;
2793
    esac
2794
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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=:
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2804
    for arg
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2805
    do
2806
      arg2=
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2807
      if test -n "$dest"; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2808
	func_append files " $dest"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2809
	dest=$arg
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2810
	continue
2811
      fi
2812
2813
      case $arg in
2814
      -d) isdir=yes ;;
2815
      -f)
2816
	if $install_cp; then :; else
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2817
	  prev=$arg
2818
	fi
2819
	;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2833
	    arg2=$install_override_mode
2834
	    no_mode=false
2835
	  fi
2836
	  prev=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2847
      if test -n "$arg2"; then
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2848
	func_quote_for_eval "$arg2"
2849
      fi
2850
      func_append install_shared_prog " $func_quote_for_eval_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2851
    done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2863
      fi
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2864
    fi
2865
2866
    if test -z "$files"; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2921
	;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2922
2923
      *.la)
2924
	func_resolve_sysroot "$file"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2925
	file=$func_resolve_sysroot_result
2926
2927
	# Check to see that this really is a libtool archive.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2941
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2942
	else
2943
	  # Note the libdir as a future libdir.
2944
	  case "$future_libdirs " in
2945
	  *" $libdir "*) ;;
2946
	  *) func_append future_libdirs " $libdir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2947
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2948
	fi
2949
2950
	func_dirname "$file" "/" ""
2951
	dir="$func_dirname_result"
2952
	func_append dir "$objdir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
2953
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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\$%%"`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2957
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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%"`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2970
	  else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
2971
	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2972
	  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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" \
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
2990
	      'exit $?'
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
3030
	;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3130
	    if test -n "$libdir" && test ! -f "$libfile"; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3149
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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%"`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3168
	  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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+"$@"}
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
3227
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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))
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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.  */
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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. */\
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3295
	  for progfile in $progfiles; do
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
3296
	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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* )
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3335
	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3421
	  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
3422
3423
	  echo >> "$output_objdir/$my_dlsyms" "\
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3424
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
3431
lt_${my_prefix}_LTX_preloaded_symbols[];
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
3432
LT_DLSYM_CONST lt_dlsymlist
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
3433
lt_${my_prefix}_LTX_preloaded_symbols[] =
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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" "\
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3446
  {0, (void *) 0}
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
3489
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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%"`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3504
	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
3505
	  else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
3506
	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3507
	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3508
	  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
3509
	  ;;
3510
	*)
3511
	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3512
	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
3513
	  ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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@%%"`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3527
      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
3528
    fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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.
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3538
func_win32_libid ()
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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.
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3549
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
3550
       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3551
      func_to_tool_file "$1" func_convert_file_msys_to_w32
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
3552
      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
3553
	$SED -n -e '
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3797
	      $LIPO -create -output "$darwin_file" $darwin_files
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3812
    done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
3813
3814
    func_extract_archives_result="$my_oldobjs"
3815
}
3816
3817
3818
# func_emit_wrapper [arg=no]
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
{
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
3834
	func_emit_wrapper_arg1=${1-no}
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
3835
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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\""
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
3998
  # Find the directory that this script lives in.
3999
  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4000
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4001
4002
  # Follow symbolic links until we get to the real thisdir.
4003
  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4004
  while test -n \"\$file\"; do
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4005
    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4006
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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%^.*/%%'\`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4016
    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
4017
  done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4018
4019
  # Usually 'no', except on cygwin/mingw when embedded into
4020
  # the cwrapper.
4021
  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4022
  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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%[\\\\/][^\\\\/]*$%%'\` ;;
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4030
    $objdir )   thisdir=. ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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.
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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/::*\$//'\`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4105
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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+\"\$@\"}
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4114
    fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4120
    exit 1
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4121
  fi
4122
fi\
4123
"
4124
}
4125
4126
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4147
# define _CRT_SECURE_NO_DEPRECATE 1
4148
#endif
4149
#include <stdio.h>
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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 */
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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 */
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4225
#ifndef DIR_SEPARATOR
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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)
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4268
static int lt_debug = 1;
4269
#else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4270
static int lt_debug = 0;
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4271
#endif
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4272
4273
const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4274
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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, ...);
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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);
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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);
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4292
void lt_dump_script (FILE *f);
4293
EOF
4294
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4295
	    cat <<EOF
4296
volatile const char * MAGIC_EXE = "$magic_exe";
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
4297
const char * LIB_PATH_VARNAME = "$shlibpath_var";
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
4302
	      cat <<EOF
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4303
const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
4304
EOF
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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:"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
4313
	      cat <<EOF
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4314
const char * EXE_PATH_VARNAME = "PATH";
4315
const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
4316
EOF
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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";
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4342
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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);
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4359
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4360
  /* very simple arg parsing; don't want to rely on getopt
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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++)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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);
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4379
	  return 0;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4380
	}
4381
      if (strcmp (argv[i], debug_opt) == 0)
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
    }
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4404
  newargz[++newargc] = NULL;
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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]);
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4416
  if (tmp_pathspec == NULL)
4417
    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4418
  lt_debugprintf (__FILE__, __LINE__,
4419
                  "(main) found exe (before symlink chase) at: %s\n",
4420
		  tmp_pathspec);
4421
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4422
  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
4423
  lt_debugprintf (__FILE__, __LINE__,
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4424
                  "(main) found exe (after symlink chase) at: %s\n",
4425
		  actual_cwrapper_path);
4426
  XFREE (tmp_pathspec);
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4427
4428
  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4429
  strendzap (actual_cwrapper_path, actual_cwrapper_name);
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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__,
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4447
		  "(main) libtool target name: %s\n",
4448
		  target_name);
4449
EOF
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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);
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4504
4505
  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4506
		  nonnull (lt_argv_zero));
4507
  for (i = 0; i < newargc; i++)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4508
    {
4509
      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4510
		      i, nonnull (newargz[i]));
4511
    }
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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);
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4520
  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4521
  if (rval == -1)
4522
    {
4523
      /* failed to start process */
4524
      lt_debugprintf (__FILE__, __LINE__,
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4525
		      "(main) failed to launch target \"%s\": %s\n",
4526
		      lt_argv_zero, nonnull (strerror (errno)));
4527
      return 127;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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");
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4549
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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",
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4583
                  nonempty (path));
4584
  if ((!path) || (!*path))
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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",
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4601
                  nonempty (path));
4602
  if ((!path) || (!*path))
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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",
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4628
                  nonempty (wrapper));
4629
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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",
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4682
                              nonnull (strerror (errno)));
4683
		  tmp_len = strlen (tmp);
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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",
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4708
              nonnull (strerror (errno)));
4709
  tmp_len = strlen (tmp);
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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__,
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4735
		      "checking path component for symlinks: %s\n",
4736
		      tmp_pathspec);
4737
      if (lstat (tmp_pathspec, &s) == 0)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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__,
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4759
		    "error accessing file \"%s\": %s",
4760
		    tmp_pathspec, nonnull (strerror (errno)));
4761
	}
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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__,
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4774
		"could not follow symlinks for %s", pathspec);
4775
    }
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4814
lt_error_core (int exit_status, const char *file,
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4815
	       int line, const char *mode,
4816
	       const char *message, va_list ap)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4817
{
4818
  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4819
  vfprintf (stderr, message, ap);
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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, ...)
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4828
{
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4829
  va_list ap;
4830
  va_start (ap, message);
4831
  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4832
  va_end (ap);
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4833
}
4834
4835
static const char *
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
4848
lt_setenv (const char *name, const char *value)
4849
{
4850
  lt_debugprintf (__FILE__, __LINE__,
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4851
		  "(lt_setenv) setting '%s' to '%s'\n",
4852
                  nonnull (name), nonnull (value));
4853
  {
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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__,
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4901
		  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4902
                  nonnull (name), nonnull (value));
4903
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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__,
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
4922
		  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4923
                  nonnull (name), nonnull (value));
4924
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5065
}
5066
# end: func_emit_cwrapperexe_src
5067
5068
# func_win32_import_lib_p ARG
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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...
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
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.
5089
      # allow_undefined=no
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
5103
    base_compile="$nonopt $@"
5104
    compile_command=$nonopt
5105
    finalize_command=$nonopt
5106
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=
5120
    new_inherited_linker_flags=
5121
5122
    avoid_version=no
5123
    bindir=
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
5124
    dlfiles=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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=
5137
    precious_files_regex=
5138
    prefer_static_libs=no
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
5150
    weak_libs=
5151
    single_module="${wl}-single_module"
5152
    func_infer_tag $base_compile
5153
5154
    # We need to know -static, to get the right output filenames.
5155
    for arg
5156
    do
5157
      case $arg in
5158
      -shared)
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)
5165
	case $arg in
5166
	-all-static)
5167
	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
5168
	    func_warning "complete static linking is impossible in this configuration"
5169
	  fi
5170
	  if test -n "$link_static_flag"; then
5171
	    dlopen_self=$dlopen_self_static
5172
	  fi
5173
	  prefer_static_libs=yes
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
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
5200
      arg="$1"
5201
      shift
5202
      func_quote_for_eval "$arg"
5203
      qarg=$func_quote_for_eval_unquoted_result
5204
      func_append libtool_args " $func_quote_for_eval_result"
5205
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@"
5211
	  func_append finalize_command " @OUTPUT@"
5212
	  ;;
5213
	esac
5214
5215
	case $prev in
5216
	bindir)
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
5217
	  bindir="$arg"
5218
	  prev=
5219
	  continue
5220
	  ;;
5221
	dlfiles|dlprefiles)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5222
	  if test "$preload" = no; then
5223
	    # Add the symbol object into the linking commands.
5224
	    func_append compile_command " @SYMFILE@"
5225
	    func_append finalize_command " @SYMFILE@"
5226
	    preload=yes
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5253
	    else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5254
	      func_append dlprefiles " $arg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5255
	    fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5256
	    prev=
5257
	    continue
5258
	    ;;
5259
	  esac
5260
	  ;;
5261
	expsyms)
5262
	  export_symbols="$arg"
5263
	  test -f "$arg" \
5264
	    || func_fatal_error "symbol file \`$arg' does not exist"
5265
	  prev=
5266
	  continue
5267
	  ;;
5268
	expsyms_regex)
5269
	  export_symbols_regex="$arg"
5270
	  prev=
5271
	  continue
5272
	  ;;
5273
	framework)
5274
	  case $host in
5275
	    *-*-darwin*)
5276
	      case "$deplibs " in
5277
		*" $qarg.ltframework "*) ;;
5278
		*) func_append deplibs " $qarg.ltframework" # this is fixed later
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5279
		   ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5280
	      esac
5281
	      ;;
5282
	  esac
5283
	  prev=
5284
	  continue
5285
	  ;;
5286
	inst_prefix)
5287
	  inst_prefix_dir="$arg"
5288
	  prev=
5289
	  continue
5290
	  ;;
5291
	objectlist)
5292
	  if test -f "$arg"; then
5293
	    save_arg=$arg
5294
	    moreargs=
5295
	    for fil in `cat "$save_arg"`
5296
	    do
5297
#	      func_append moreargs " $fil"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5298
	      arg=$fil
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
5303
		pic_object=
5304
		non_pic_object=
5305
5306
		# Read the .lo file
5307
		func_source "$arg"
5308
5309
		if test -z "$pic_object" ||
5310
		   test -z "$non_pic_object" ||
5311
		   test "$pic_object" = none &&
5312
		   test "$non_pic_object" = none; then
5313
		  func_fatal_error "cannot find name of object for \`$arg'"
5314
		fi
5315
5316
		# Extract subdirectory from the argument.
5317
		func_dirname "$arg" "/" ""
5318
		xdir="$func_dirname_result"
5319
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5327
		      prev=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5339
		    prev=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5340
		  fi
5341
5342
		  # A PIC object.
5343
		  func_append libobjs " $pic_object"
5344
		  arg="$pic_object"
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"
5354
		  if test -z "$pic_object" || test "$pic_object" = none ; then
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"
5362
		fi
5363
	      else
5364
		# Only an error if not doing a dry-run.
5365
		if $opt_dry_run; then
5366
		  # Extract subdirectory from the argument.
5367
		  func_dirname "$arg" "/" ""
5368
		  xdir="$func_dirname_result"
5369
5370
		  func_lo2o "$arg"
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
5378
	      fi
5379
	    done
5380
	  else
5381
	    func_fatal_error "link input file \`$arg' does not exist"
5382
	  fi
5383
	  arg=$save_arg
5384
	  prev=
5385
	  continue
5386
	  ;;
5387
	precious_regex)
5388
	  precious_files_regex="$arg"
5389
	  prev=
5390
	  continue
5391
	  ;;
5392
	release)
5393
	  release="-$arg"
5394
	  prev=
5395
	  continue
5396
	  ;;
5397
	rpath | xrpath)
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"
5403
	    ;;
5404
	  esac
5405
	  if test "$prev" = rpath; then
5406
	    case "$rpath " in
5407
	    *" $arg "*) ;;
5408
	    *) func_append rpath " $arg" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5409
	    esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5410
	  else
5411
	    case "$xrpath " in
5412
	    *" $arg "*) ;;
5413
	    *) func_append xrpath " $arg" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5414
	    esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5415
	  fi
5416
	  prev=
5417
	  continue
5418
	  ;;
5419
	shrext)
5420
	  shrext_cmds="$arg"
5421
	  prev=
5422
	  continue
5423
	  ;;
5424
	weak)
5425
	  func_append weak_libs " $arg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5426
	  prev=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5427
	  continue
5428
	  ;;
5429
	xcclinker)
5430
	  func_append linker_flags " $qarg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5431
	  func_append compiler_flags " $qarg"
5432
	  prev=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5433
	  func_append compile_command " $qarg"
5434
	  func_append finalize_command " $qarg"
5435
	  continue
5436
	  ;;
5437
	xcompiler)
5438
	  func_append compiler_flags " $qarg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5439
	  prev=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5440
	  func_append compile_command " $qarg"
5441
	  func_append finalize_command " $qarg"
5442
	  continue
5443
	  ;;
5444
	xlinker)
5445
	  func_append linker_flags " $qarg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5446
	  func_append compiler_flags " $wl$qarg"
5447
	  prev=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5448
	  func_append compile_command " $wl$qarg"
5449
	  func_append finalize_command " $wl$qarg"
5450
	  continue
5451
	  ;;
5452
	*)
5453
	  eval "$prev=\"\$arg\""
5454
	  prev=
5455
	  continue
5456
	  ;;
5457
	esac
5458
      fi # test -n "$prev"
5459
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.
5466
	  func_append compile_command " $link_static_flag"
5467
	  func_append finalize_command " $link_static_flag"
5468
	fi
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"
5475
	;;
5476
5477
      -avoid-version)
5478
	avoid_version=yes
5479
	continue
5480
	;;
5481
5482
      -bindir)
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
5483
	prev=bindir
5484
	continue
5485
	;;
5486
5487
      -dlopen)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
5505
	fi
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)
5515
	prev=framework
5516
	continue
5517
	;;
5518
5519
      -inst-prefix-dir)
5520
	prev=inst_prefix
5521
	continue
5522
	;;
5523
5524
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
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*)
5529
	  func_append compile_command " $arg"
5530
	  func_append finalize_command " $arg"
5531
	  ;;
5532
	esac
5533
	continue
5534
	;;
5535
5536
      -L*)
5537
	func_stripname "-L" '' "$arg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5538
	if test -z "$func_stripname_result"; then
5539
	  if test "$#" -gt 0; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5546
	dir=$func_resolve_sysroot_result
5547
	# We need an absolute path.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5548
	case $dir in
5549
	[\\/]* | [A-Za-z]:[\\/]*) ;;
5550
	*)
5551
	  absdir=`cd "$dir" && pwd`
5552
	  test -z "$absdir" && \
5553
	    func_fatal_error "cannot determine absolute directory name of \`$dir'"
5554
	  dir="$absdir"
5555
	  ;;
5556
	esac
5557
	case "$deplibs " in
5558
	*" -L$dir "* | *" $arg "*)
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5559
	  # Will only happen for absolute or sysroot arguments
5560
	  ;;
5561
	*)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5562
	  # Preserve sysroot, but never include relative directories
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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
	  ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5569
	esac
5570
	case $host in
5571
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
5572
	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
5573
	  case :$dllsearchpath: in
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5574
	  *":$dir:"*) ;;
5575
	  ::) dllsearchpath=$dir;;
5576
	  *) func_append dllsearchpath ":$dir";;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5577
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5578
	  case :$dllsearchpath: in
5579
	  *":$testbindir:"*) ;;
5580
	  ::) dllsearchpath=$testbindir;;
5581
	  *) func_append dllsearchpath ":$testbindir";;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5582
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5583
	  ;;
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*)
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
5592
	    # These systems don't actually have a C or math library (as such)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5593
	    continue
5594
	    ;;
5595
	  *-*-os2*)
5596
	    # These systems don't actually have a C library (as such)
5597
	    test "X$arg" = "X-lc" && continue
5598
	    ;;
5599
	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5600
	    # Do not include libc due to us having libc/libc_r.
5601
	    test "X$arg" = "X-lc" && continue
5602
	    ;;
5603
	  *-*-rhapsody* | *-*-darwin1.[012])
5604
	    # Rhapsody C and math libraries are in the System framework
5605
	    func_append deplibs " System.ltframework"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5606
	    continue
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5607
	    ;;
5608
	  *-*-sco3.2v5* | *-*-sco5v6*)
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
5617
	elif test "X$arg" = "X-lc_r"; then
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
5625
	func_append deplibs " $arg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5626
	continue
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5627
	;;
5628
5629
      -module)
5630
	module=yes
5631
	continue
5632
	;;
5633
5634
      # Tru64 UNIX uses -model [arg] to determine the layout of C++
5635
      # classes, name mangling, and exception handling.
5636
      # Darwin uses the -arch flag to determine output architecture.
5637
      -model|-arch|-isysroot|--sysroot)
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5638
	func_append compiler_flags " $arg"
5639
	func_append compile_command " $arg"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5640
	func_append finalize_command " $arg"
5641
	prev=xcompiler
5642
	continue
5643
	;;
5644
5645
      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
5646
	func_append compiler_flags " $arg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5647
	func_append compile_command " $arg"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5648
	func_append finalize_command " $arg"
5649
	case "$new_inherited_linker_flags " in
5650
	    *" $arg "*) ;;
5651
	    * ) func_append new_inherited_linker_flags " $arg" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5652
	esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5653
	continue
5654
	;;
5655
5656
      -multi_module)
5657
	single_module="${wl}-multi_module"
5658
	continue
5659
	;;
5660
5661
      -no-fast-install)
5662
	fast_install=no
5663
	continue
5664
	;;
5665
5666
      -no-install)
5667
	case $host in
5668
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
5669
	  # The PATH hackery in wrapper scripts is required on Windows
5670
	  # and Darwin in order for the loader to find any dlls it needs.
5671
	  func_warning "\`-no-install' is ignored for $host"
5672
	  func_warning "assuming \`-no-fast-install' instead"
5673
	  fast_install=no
5674
	  ;;
5675
	*) no_install=yes ;;
5676
	esac
5677
	continue
5678
	;;
5679
5680
      -no-undefined)
5681
	allow_undefined=no
5682
	continue
5683
	;;
5684
5685
      -objectlist)
5686
	prev=objectlist
5687
	continue
5688
	;;
5689
5690
      -o) prev=output ;;
5691
5692
      -precious-files-regex)
5693
	prev=precious_regex
5694
	continue
5695
	;;
5696
5697
      -release)
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"
5714
	dir=$func_stripname_result
5715
	# We need an absolute path.
5716
	case $dir in
5717
	[\\/]* | [A-Za-z]:[\\/]*) ;;
5718
	=*)
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5719
	  func_stripname '=' '' "$dir"
5720
	  dir=$lt_sysroot$func_stripname_result
5721
	  ;;
5722
	*)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5723
	  func_fatal_error "only absolute run-paths are allowed"
5724
	  ;;
5725
	esac
5726
	case "$xrpath " in
5727
	*" $dir "*) ;;
5728
	*) func_append xrpath " $dir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5729
	esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5730
	continue
5731
	;;
5732
5733
      -shared)
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)
5744
	# The effects of -static are defined in a previous loop.
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
5762
      -version-number)
5763
	prev=vinfo
5764
	vinfo_number=yes
5765
	continue
5766
	;;
5767
5768
      -weak)
5769
        prev=weak
5770
	continue
5771
	;;
5772
5773
      -Wc,*)
5774
	func_stripname '-Wc,' '' "$arg"
5775
	args=$func_stripname_result
5776
	arg=
5777
	save_ifs="$IFS"; IFS=','
5778
	for flag in $args; do
5779
	  IFS="$save_ifs"
5780
          func_quote_for_eval "$flag"
5781
	  func_append arg " $func_quote_for_eval_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5782
	  func_append compiler_flags " $func_quote_for_eval_result"
5783
	done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5784
	IFS="$save_ifs"
5785
	func_stripname ' ' '' "$arg"
5786
	arg=$func_stripname_result
5787
	;;
5788
5789
      -Wl,*)
5790
	func_stripname '-Wl,' '' "$arg"
5791
	args=$func_stripname_result
5792
	arg=
5793
	save_ifs="$IFS"; IFS=','
5794
	for flag in $args; do
5795
	  IFS="$save_ifs"
5796
          func_quote_for_eval "$flag"
5797
	  func_append arg " $wl$func_quote_for_eval_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5798
	  func_append compiler_flags " $wl$func_quote_for_eval_result"
5799
	  func_append linker_flags " $func_quote_for_eval_result"
5800
	done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5801
	IFS="$save_ifs"
5802
	func_stripname ' ' '' "$arg"
5803
	arg=$func_stripname_result
5804
	;;
5805
5806
      -Xcompiler)
5807
	prev=xcompiler
5808
	continue
5809
	;;
5810
5811
      -Xlinker)
5812
	prev=xlinker
5813
	continue
5814
	;;
5815
5816
      -XCClinker)
5817
	prev=xcclinker
5818
	continue
5819
	;;
5820
5821
      # -msg_* for osf cc
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:
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
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*| \
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5841
      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5842
      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
5843
        func_quote_for_eval "$arg"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5848
        continue
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5849
        ;;
5850
5851
      # Some other compiler flag.
5852
      -* | +*)
5853
        func_quote_for_eval "$arg"
5854
	arg="$func_quote_for_eval_result"
5855
	;;
5856
5857
      *.$objext)
5858
	# A standard object.
5859
	func_append objs " $arg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5860
	;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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
5867
	  pic_object=
5868
	  non_pic_object=
5869
5870
	  # Read the .lo file
5871
	  func_source "$arg"
5872
5873
	  if test -z "$pic_object" ||
5874
	     test -z "$non_pic_object" ||
5875
	     test "$pic_object" = none &&
5876
	     test "$non_pic_object" = none; then
5877
	    func_fatal_error "cannot find name of object for \`$arg'"
5878
	  fi
5879
5880
	  # Extract subdirectory from the argument.
5881
	  func_dirname "$arg" "/" ""
5882
	  xdir="$func_dirname_result"
5883
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5891
		prev=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5903
	      prev=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5904
	    fi
5905
5906
	    # A PIC object.
5907
	    func_append libobjs " $pic_object"
5908
	    arg="$pic_object"
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"
5918
	    if test -z "$pic_object" || test "$pic_object" = none ; then
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"
5926
	  fi
5927
	else
5928
	  # Only an error if not doing a dry-run.
5929
	  if $opt_dry_run; then
5930
	    # Extract subdirectory from the argument.
5931
	    func_dirname "$arg" "/" ""
5932
	    xdir="$func_dirname_result"
5933
5934
	    func_lo2o "$arg"
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
5942
	fi
5943
	;;
5944
5945
      *.$libext)
5946
	# An archive.
5947
	func_append deplibs " $arg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5948
	func_append old_deplibs " $arg"
5949
	continue
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5950
	;;
5951
5952
      *.la)
5953
	# A libtool-controlled library.
5954
5955
	func_resolve_sysroot "$arg"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5956
	if test "$prev" = dlfiles; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5957
	  # This library was specified with -dlopen.
5958
	  func_append dlfiles " $func_resolve_sysroot_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5959
	  prev=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5960
	elif test "$prev" = dlprefiles; then
5961
	  # The library was specified with -dlpreopen.
5962
	  func_append dlprefiles " $func_resolve_sysroot_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5963
	  prev=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
5964
	else
5965
	  func_append deplibs " $func_resolve_sysroot_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
5966
	fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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"
5975
	arg="$func_quote_for_eval_result"
5976
	;;
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"
5982
	func_append finalize_command " $arg"
5983
      fi
5984
    done # argument parsing loop
5985
5986
    test -n "$prev" && \
5987
      func_fatal_help "the \`$prevarg' option requires an argument"
5988
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"
5992
      func_append finalize_command " $arg"
5993
    fi
5994
5995
    oldlibs=
5996
    # calculate the name of the file, without its directory
5997
    func_basename "$output"
5998
    outputname="$func_basename_result"
5999
    libobjs_save="$libobjs"
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\'\`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6004
    else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
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" "/" ""
6011
    output_objdir="$func_dirname_result$objdir"
6012
    func_to_tool_file "$output_objdir/"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6013
    tool_output_objdir=$func_to_tool_file_result
6014
    # Create the object directory.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6015
    func_mkdir_p "$output_objdir"
6016
6017
    # Determine the type of output
6018
    case $output in
6019
    "")
6020
      func_fatal_help "you must specify an output file"
6021
      ;;
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
6030
    libs=
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
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6035
	case "$libs " in
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6036
	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6037
	esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6038
      fi
6039
      func_append libs " $deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6040
    done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6041
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
6050
	for pre_post_dep in $predeps $postdeps; do
6051
	  case "$pre_post_deps " in
6052
	  *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6053
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6054
	  func_append pre_post_deps " $pre_post_dep"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6055
	done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6056
      fi
6057
      pre_post_deps=
6058
    fi
6059
6060
    deplibs=
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
6066
6067
    case $linkmode in
6068
    lib)
6069
	passes="conv dlpreopen link"
6070
	for file in $dlfiles $dlprefiles; do
6071
	  case $file in
6072
	  *.la) ;;
6073
	  *)
6074
	    func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
6075
	    ;;
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
6091
    for pass in $passes; do
6092
      # The preopen pass in lib mode reverses $deplibs; put it back here
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" ||
6105
	 test "$linkmode,$pass" = "prog,scan"; then
6106
	libs="$deplibs"
6107
	deplibs=
6108
      fi
6109
      if test "$linkmode" = prog; then
6110
	case $pass in
6111
	dlopen) libs="$dlfiles" ;;
6112
	dlpreopen) libs="$dlprefiles" ;;
6113
	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2.3.2 by Yves-Alexis Perez
Import upstream version 0.8.4
6114
	esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6115
      fi
6116
      if test "$linkmode,$pass" = "lib,dlpreopen"; then
6117
	# Collect and forward deplibs of preopened libtool libs
6118
	for lib in $dlprefiles; do
6119
	  # Ignore non-libtool-libs
6120
	  dependency_libs=
6121
	  func_resolve_sysroot "$lib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6122
	  case $lib in
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6123
	  *.la)	func_source "$func_resolve_sysroot_result" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6124
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6125
6126
	  # Collect preopened libtool deplibs, except any this library
6127
	  # has declared as weak libs
6128
	  for deplib in $dependency_libs; do
6129
	    func_basename "$deplib"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6130
            deplib_base=$func_basename_result
6131
	    case " $weak_libs " in
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6132
	    *" $deplib_base "*) ;;
6133
	    *) func_append deplibs " $deplib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6134
	    esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6135
	  done
6136
	done
6137
	libs="$dlprefiles"
6138
      fi
6139
      if test "$pass" = dlopen; then
6140
	# Collect dlpreopened libraries
6141
	save_deplibs="$deplibs"
6142
	deplibs=
6143
      fi
6144
6145
      for deplib in $libs; do
6146
	lib=
6147
	found=no
6148
	case $deplib in
6149
	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
6150
	  if test "$linkmode,$pass" = "prog,link"; then
6151
	    compile_deplibs="$deplib $compile_deplibs"
6152
	    finalize_deplibs="$deplib $finalize_deplibs"
6153
	  else
6154
	    func_append compiler_flags " $deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6155
	    if test "$linkmode" = lib ; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6156
		case "$new_inherited_linker_flags " in
6157
		    *" $deplib "*) ;;
6158
		    * ) func_append new_inherited_linker_flags " $deplib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6159
		esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6160
	    fi
6161
	  fi
6162
	  continue
6163
	  ;;
6164
	-l*)
6165
	  if test "$linkmode" != lib && test "$linkmode" != prog; then
6166
	    func_warning "\`-l' is ignored for archives/objects"
6167
	    continue
6168
	  fi
6169
	  func_stripname '-l' '' "$deplib"
6170
	  name=$func_stripname_result
6171
	  if test "$linkmode" = lib; then
6172
	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
6173
	  else
6174
	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
6175
	  fi
6176
	  for searchdir in $searchdirs; do
6177
	    for search_ext in .la $std_shrext .so .a; do
6178
	      # Search the libtool library
6179
	      lib="$searchdir/lib${name}${search_ext}"
6180
	      if test -f "$lib"; then
6181
		if test "$search_ext" = ".la"; then
6182
		  found=yes
6183
		else
6184
		  found=no
6185
		fi
6186
		break 2
6187
	      fi
6188
	    done
6189
	  done
6190
	  if test "$found" != yes; then
6191
	    # deplib doesn't seem to be a libtool library
6192
	    if test "$linkmode,$pass" = "prog,link"; then
6193
	      compile_deplibs="$deplib $compile_deplibs"
6194
	      finalize_deplibs="$deplib $finalize_deplibs"
6195
	    else
6196
	      deplibs="$deplib $deplibs"
6197
	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6198
	    fi
6199
	    continue
6200
	  else # deplib is a libtool library
6201
	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
6202
	    # We need to do some special things here, and not later.
6203
	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6204
	      case " $predeps $postdeps " in
6205
	      *" $deplib "*)
6206
		if func_lalib_p "$lib"; then
6207
		  library_names=
6208
		  old_library=
6209
		  func_source "$lib"
6210
		  for l in $old_library $library_names; do
6211
		    ll="$l"
6212
		  done
6213
		  if test "X$ll" = "X$old_library" ; then # only static version available
6214
		    found=no
6215
		    func_dirname "$lib" "" "."
6216
		    ladir="$func_dirname_result"
6217
		    lib=$ladir/$old_library
6218
		    if test "$linkmode,$pass" = "prog,link"; then
6219
		      compile_deplibs="$deplib $compile_deplibs"
6220
		      finalize_deplibs="$deplib $finalize_deplibs"
6221
		    else
6222
		      deplibs="$deplib $deplibs"
6223
		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
6224
		    fi
6225
		    continue
6226
		  fi
6227
		fi
6228
		;;
6229
	      *) ;;
6230
	      esac
6231
	    fi
6232
	  fi
6233
	  ;; # -l
6234
	*.ltframework)
6235
	  if test "$linkmode,$pass" = "prog,link"; then
6236
	    compile_deplibs="$deplib $compile_deplibs"
6237
	    finalize_deplibs="$deplib $finalize_deplibs"
6238
	  else
6239
	    deplibs="$deplib $deplibs"
6240
	    if test "$linkmode" = lib ; then
6241
		case "$new_inherited_linker_flags " in
6242
		    *" $deplib "*) ;;
6243
		    * ) func_append new_inherited_linker_flags " $deplib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6244
		esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6245
	    fi
6246
	  fi
6247
	  continue
6248
	  ;;
6249
	-L*)
6250
	  case $linkmode in
6251
	  lib)
6252
	    deplibs="$deplib $deplibs"
6253
	    test "$pass" = conv && continue
6254
	    newdependency_libs="$deplib $newdependency_libs"
6255
	    func_stripname '-L' '' "$deplib"
6256
	    func_resolve_sysroot "$func_stripname_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6257
	    func_append newlib_search_path " $func_resolve_sysroot_result"
6258
	    ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6259
	  prog)
6260
	    if test "$pass" = conv; then
6261
	      deplibs="$deplib $deplibs"
6262
	      continue
6263
	    fi
6264
	    if test "$pass" = scan; then
6265
	      deplibs="$deplib $deplibs"
6266
	    else
6267
	      compile_deplibs="$deplib $compile_deplibs"
6268
	      finalize_deplibs="$deplib $finalize_deplibs"
6269
	    fi
6270
	    func_stripname '-L' '' "$deplib"
6271
	    func_resolve_sysroot "$func_stripname_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6272
	    func_append newlib_search_path " $func_resolve_sysroot_result"
6273
	    ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6274
	  *)
6275
	    func_warning "\`-L' is ignored for archives/objects"
6276
	    ;;
6277
	  esac # linkmode
6278
	  continue
6279
	  ;; # -L
6280
	-R*)
6281
	  if test "$pass" = link; then
6282
	    func_stripname '-R' '' "$deplib"
6283
	    func_resolve_sysroot "$func_stripname_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6284
	    dir=$func_resolve_sysroot_result
6285
	    # Make sure the xrpath contains only unique directories.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6286
	    case "$xrpath " in
6287
	    *" $dir "*) ;;
6288
	    *) func_append xrpath " $dir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6289
	    esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6290
	  fi
6291
	  deplibs="$deplib $deplibs"
6292
	  continue
6293
	  ;;
6294
	*.la)
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6295
	  func_resolve_sysroot "$deplib"
6296
	  lib=$func_resolve_sysroot_result
6297
	  ;;
6298
	*.$libext)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6299
	  if test "$pass" = conv; then
6300
	    deplibs="$deplib $deplibs"
6301
	    continue
6302
	  fi
6303
	  case $linkmode in
6304
	  lib)
6305
	    # Linking convenience modules into shared libraries is allowed,
6306
	    # but linking other static libraries is non-portable.
6307
	    case " $dlpreconveniencelibs " in
6308
	    *" $deplib "*) ;;
6309
	    *)
6310
	      valid_a_lib=no
6311
	      case $deplibs_check_method in
6312
		match_pattern*)
6313
		  set dummy $deplibs_check_method; shift
6314
		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
6315
		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6316
		    | $EGREP "$match_pattern_regex" > /dev/null; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6317
		    valid_a_lib=yes
6318
		  fi
6319
		;;
6320
		pass_all)
6321
		  valid_a_lib=yes
6322
		;;
6323
	      esac
6324
	      if test "$valid_a_lib" != yes; then
6325
		echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6326
		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6327
		echo "*** I have the capability to make that library automatically link in when"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6328
		echo "*** you link to this library.  But I can only do this if you have a"
6329
		echo "*** shared version of the library, which you do not appear to have"
6330
		echo "*** because the file extensions .$libext of this argument makes me believe"
6331
		echo "*** that it is just a static archive that I should not use here."
6332
	      else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6333
		echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6334
		$ECHO "*** Warning: Linking the shared library $output against the"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6335
		$ECHO "*** static library $deplib is not portable!"
6336
		deplibs="$deplib $deplibs"
6337
	      fi
6338
	      ;;
6339
	    esac
6340
	    continue
6341
	    ;;
6342
	  prog)
6343
	    if test "$pass" != link; then
6344
	      deplibs="$deplib $deplibs"
6345
	    else
6346
	      compile_deplibs="$deplib $compile_deplibs"
6347
	      finalize_deplibs="$deplib $finalize_deplibs"
6348
	    fi
6349
	    continue
6350
	    ;;
6351
	  esac # linkmode
6352
	  ;; # *.$libext
6353
	*.lo | *.$objext)
6354
	  if test "$pass" = conv; then
6355
	    deplibs="$deplib $deplibs"
6356
	  elif test "$linkmode" = prog; then
6357
	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
6358
	      # If there is no dlopen support or we're linking statically,
6359
	      # we need to preload.
6360
	      func_append newdlprefiles " $deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6361
	      compile_deplibs="$deplib $compile_deplibs"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6362
	      finalize_deplibs="$deplib $finalize_deplibs"
6363
	    else
6364
	      func_append newdlfiles " $deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6365
	    fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6366
	  fi
6367
	  continue
6368
	  ;;
6369
	%DEPLIBS%)
6370
	  alldeplibs=yes
6371
	  continue
6372
	  ;;
6373
	esac # case $deplib
6374
6375
	if test "$found" = yes || test -f "$lib"; then :
6376
	else
6377
	  func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
6378
	fi
6379
6380
	# Check to see that this really is a libtool archive.
6381
	func_lalib_unsafe_p "$lib" \
6382
	  || func_fatal_error "\`$lib' is not a valid libtool archive"
6383
6384
	func_dirname "$lib" "" "."
6385
	ladir="$func_dirname_result"
6386
6387
	dlname=
6388
	dlopen=
6389
	dlpreopen=
6390
	libdir=
6391
	library_names=
6392
	old_library=
6393
	inherited_linker_flags=
6394
	# If the library was installed with an old release of libtool,
6395
	# it will not redefine variables installed, or shouldnotlink
6396
	installed=yes
6397
	shouldnotlink=no
6398
	avoidtemprpath=
6399
6400
6401
	# Read the .la file
6402
	func_source "$lib"
6403
6404
	# Convert "-framework foo" to "foo.ltframework"
6405
	if test -n "$inherited_linker_flags"; then
6406
	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6407
	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6408
	    case " $new_inherited_linker_flags " in
6409
	      *" $tmp_inherited_linker_flag "*) ;;
6410
	      *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6411
	    esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6412
	  done
6413
	fi
6414
	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6415
	if test "$linkmode,$pass" = "lib,link" ||
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6416
	   test "$linkmode,$pass" = "prog,scan" ||
6417
	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
6418
	  test -n "$dlopen" && func_append dlfiles " $dlopen"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6419
	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
6420
	fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6421
6422
	if test "$pass" = conv; then
6423
	  # Only check for convenience libraries
6424
	  deplibs="$lib $deplibs"
6425
	  if test -z "$libdir"; then
6426
	    if test -z "$old_library"; then
6427
	      func_fatal_error "cannot find name of link library for \`$lib'"
6428
	    fi
6429
	    # It is a libtool convenience library, so add in its objects.
6430
	    func_append convenience " $ladir/$objdir/$old_library"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6431
	    func_append old_convenience " $ladir/$objdir/$old_library"
6432
	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6433
	    func_fatal_error "\`$lib' is not a convenience library"
6434
	  fi
6435
	  tmp_libs=
6436
	  for deplib in $dependency_libs; do
6437
	    deplibs="$deplib $deplibs"
6438
	    if $opt_preserve_dup_deps ; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6439
	      case "$tmp_libs " in
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6440
	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6441
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6442
	    fi
6443
	    func_append tmp_libs " $deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6444
	  done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6445
	  continue
6446
	fi # $pass = conv
6447
6448
6449
	# Get the name of the library we link against.
6450
	linklib=
6451
	if test -n "$old_library" &&
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6452
	   { test "$prefer_static_libs" = yes ||
6453
	     test "$prefer_static_libs,$installed" = "built,no"; }; then
6454
	  linklib=$old_library
6455
	else
6456
	  for l in $old_library $library_names; do
6457
	    linklib="$l"
6458
	  done
6459
	fi
6460
	if test -z "$linklib"; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6461
	  func_fatal_error "cannot find name of link library for \`$lib'"
6462
	fi
6463
6464
	# This library was specified with -dlopen.
6465
	if test "$pass" = dlopen; then
6466
	  if test -z "$libdir"; then
6467
	    func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
6468
	  fi
6469
	  if test -z "$dlname" ||
6470
	     test "$dlopen_support" != yes ||
6471
	     test "$build_libtool_libs" = no; then
6472
	    # If there is no dlname, no dlopen support or we're linking
6473
	    # statically, we need to preload.  We also need to preload any
6474
	    # dependent libraries so libltdl's deplib preloader doesn't
6475
	    # bomb out in the load deplibs phase.
6476
	    func_append dlprefiles " $lib $dependency_libs"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6477
	  else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6478
	    func_append newdlfiles " $lib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6479
	  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6480
	  continue
6481
	fi # $pass = dlopen
6482
6483
	# We need an absolute path.
6484
	case $ladir in
6485
	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
6486
	*)
6487
	  abs_ladir=`cd "$ladir" && pwd`
6488
	  if test -z "$abs_ladir"; then
6489
	    func_warning "cannot determine absolute directory name of \`$ladir'"
6490
	    func_warning "passing it literally to the linker, although it might fail"
6491
	    abs_ladir="$ladir"
6492
	  fi
6493
	  ;;
6494
	esac
6495
	func_basename "$lib"
6496
	laname="$func_basename_result"
6497
6498
	# Find the relevant object directory and library name.
6499
	if test "X$installed" = Xyes; then
6500
	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6501
	    func_warning "library \`$lib' was moved."
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6502
	    dir="$ladir"
6503
	    absdir="$abs_ladir"
6504
	    libdir="$abs_ladir"
6505
	  else
6506
	    dir="$lt_sysroot$libdir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6507
	    absdir="$lt_sysroot$libdir"
6508
	  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6509
	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
6510
	else
6511
	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
6512
	    dir="$ladir"
6513
	    absdir="$abs_ladir"
6514
	    # Remove this search path later
6515
	    func_append notinst_path " $abs_ladir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6516
	  else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6517
	    dir="$ladir/$objdir"
6518
	    absdir="$abs_ladir/$objdir"
6519
	    # Remove this search path later
6520
	    func_append notinst_path " $abs_ladir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6521
	  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6522
	fi # $installed = yes
6523
	func_stripname 'lib' '.la' "$laname"
6524
	name=$func_stripname_result
6525
6526
	# This library was specified with -dlpreopen.
6527
	if test "$pass" = dlpreopen; then
6528
	  if test -z "$libdir" && test "$linkmode" = prog; then
6529
	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
6530
	  fi
6531
	  case "$host" in
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6532
	    # special handling for platforms with PE-DLLs.
6533
	    *cygwin* | *mingw* | *cegcc* )
6534
	      # Linker will automatically link against shared library if both
6535
	      # static and shared are present.  Therefore, ensure we extract
6536
	      # symbols from the import library if a shared library is present
6537
	      # (otherwise, the dlopen module name will be incorrect).  We do
6538
	      # this by putting the import library name into $newdlprefiles.
6539
	      # We recover the dlopen module name by 'saving' the la file
6540
	      # name in a special purpose variable, and (later) extracting the
6541
	      # dlname from the la file.
6542
	      if test -n "$dlname"; then
6543
	        func_tr_sh "$dir/$linklib"
6544
	        eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
6545
	        func_append newdlprefiles " $dir/$linklib"
6546
	      else
6547
	        func_append newdlprefiles " $dir/$old_library"
6548
	        # Keep a list of preopened convenience libraries to check
6549
	        # that they are being used correctly in the link pass.
6550
	        test -z "$libdir" && \
6551
	          func_append dlpreconveniencelibs " $dir/$old_library"
6552
	      fi
6553
	    ;;
6554
	    * )
6555
	      # Prefer using a static library (so that no silly _DYNAMIC symbols
6556
	      # are required to link).
6557
	      if test -n "$old_library"; then
6558
	        func_append newdlprefiles " $dir/$old_library"
6559
	        # Keep a list of preopened convenience libraries to check
6560
	        # that they are being used correctly in the link pass.
6561
	        test -z "$libdir" && \
6562
	          func_append dlpreconveniencelibs " $dir/$old_library"
6563
	      # Otherwise, use the dlname, so that lt_dlopen finds it.
6564
	      elif test -n "$dlname"; then
6565
	        func_append newdlprefiles " $dir/$dlname"
6566
	      else
6567
	        func_append newdlprefiles " $dir/$linklib"
6568
	      fi
6569
	    ;;
6570
	  esac
6571
	fi # $pass = dlpreopen
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6572
6573
	if test -z "$libdir"; then
6574
	  # Link the convenience library
6575
	  if test "$linkmode" = lib; then
6576
	    deplibs="$dir/$old_library $deplibs"
6577
	  elif test "$linkmode,$pass" = "prog,link"; then
6578
	    compile_deplibs="$dir/$old_library $compile_deplibs"
6579
	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
6580
	  else
6581
	    deplibs="$lib $deplibs" # used for prog,scan pass
6582
	  fi
6583
	  continue
6584
	fi
6585
6586
6587
	if test "$linkmode" = prog && test "$pass" != link; then
6588
	  func_append newlib_search_path " $ladir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6589
	  deplibs="$lib $deplibs"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6590
6591
	  linkalldeplibs=no
6592
	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
6593
	     test "$build_libtool_libs" = no; then
6594
	    linkalldeplibs=yes
6595
	  fi
6596
6597
	  tmp_libs=
6598
	  for deplib in $dependency_libs; do
6599
	    case $deplib in
6600
	    -L*) func_stripname '-L' '' "$deplib"
6601
	         func_resolve_sysroot "$func_stripname_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6602
	         func_append newlib_search_path " $func_resolve_sysroot_result"
6603
		 ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6604
	    esac
6605
	    # Need to link against all dependency_libs?
6606
	    if test "$linkalldeplibs" = yes; then
6607
	      deplibs="$deplib $deplibs"
6608
	    else
6609
	      # Need to hardcode shared library paths
6610
	      # or/and link against static libraries
6611
	      newdependency_libs="$deplib $newdependency_libs"
6612
	    fi
6613
	    if $opt_preserve_dup_deps ; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6614
	      case "$tmp_libs " in
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6615
	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6616
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6617
	    fi
6618
	    func_append tmp_libs " $deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6619
	  done # for deplib
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6620
	  continue
6621
	fi # $linkmode = prog...
6622
6623
	if test "$linkmode,$pass" = "prog,link"; then
6624
	  if test -n "$library_names" &&
6625
	     { { test "$prefer_static_libs" = no ||
6626
	         test "$prefer_static_libs,$installed" = "built,yes"; } ||
6627
	       test -z "$old_library"; }; then
6628
	    # We need to hardcode the library path
6629
	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
6630
	      # Make sure the rpath contains only unique directories.
6631
	      case "$temp_rpath:" in
6632
	      *"$absdir:"*) ;;
6633
	      *) func_append temp_rpath "$absdir:" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6634
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6635
	    fi
6636
6637
	    # Hardcode the library path.
6638
	    # Skip directories that are in the system default run-time
6639
	    # search path.
6640
	    case " $sys_lib_dlsearch_path " in
6641
	    *" $absdir "*) ;;
6642
	    *)
6643
	      case "$compile_rpath " in
6644
	      *" $absdir "*) ;;
6645
	      *) func_append compile_rpath " $absdir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6646
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6647
	      ;;
6648
	    esac
6649
	    case " $sys_lib_dlsearch_path " in
6650
	    *" $libdir "*) ;;
6651
	    *)
6652
	      case "$finalize_rpath " in
6653
	      *" $libdir "*) ;;
6654
	      *) func_append finalize_rpath " $libdir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6655
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6656
	      ;;
6657
	    esac
6658
	  fi # $linkmode,$pass = prog,link...
6659
6660
	  if test "$alldeplibs" = yes &&
6661
	     { test "$deplibs_check_method" = pass_all ||
6662
	       { test "$build_libtool_libs" = yes &&
6663
		 test -n "$library_names"; }; }; then
6664
	    # We only need to search for static libraries
6665
	    continue
6666
	  fi
6667
	fi
6668
6669
	link_static=no # Whether the deplib will be linked statically
6670
	use_static_libs=$prefer_static_libs
6671
	if test "$use_static_libs" = built && test "$installed" = yes; then
6672
	  use_static_libs=no
6673
	fi
6674
	if test -n "$library_names" &&
6675
	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
6676
	  case $host in
6677
	  *cygwin* | *mingw* | *cegcc*)
6678
	      # No point in relinking DLLs because paths are not encoded
6679
	      func_append notinst_deplibs " $lib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6680
	      need_relink=no
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6681
	    ;;
6682
	  *)
6683
	    if test "$installed" = no; then
6684
	      func_append notinst_deplibs " $lib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6685
	      need_relink=yes
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6686
	    fi
6687
	    ;;
6688
	  esac
6689
	  # This is a shared library
6690
6691
	  # Warn about portability, can't link against -module's on some
6692
	  # systems (darwin).  Don't bleat about dlopened modules though!
6693
	  dlopenmodule=""
6694
	  for dlpremoduletest in $dlprefiles; do
6695
	    if test "X$dlpremoduletest" = "X$lib"; then
6696
	      dlopenmodule="$dlpremoduletest"
6697
	      break
6698
	    fi
6699
	  done
6700
	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
6701
	    echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6702
	    if test "$linkmode" = prog; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6703
	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
6704
	    else
6705
	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
6706
	    fi
6707
	    $ECHO "*** $linklib is not portable!"
6708
	  fi
6709
	  if test "$linkmode" = lib &&
6710
	     test "$hardcode_into_libs" = yes; then
6711
	    # Hardcode the library path.
6712
	    # Skip directories that are in the system default run-time
6713
	    # search path.
6714
	    case " $sys_lib_dlsearch_path " in
6715
	    *" $absdir "*) ;;
6716
	    *)
6717
	      case "$compile_rpath " in
6718
	      *" $absdir "*) ;;
6719
	      *) func_append compile_rpath " $absdir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6720
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6721
	      ;;
6722
	    esac
6723
	    case " $sys_lib_dlsearch_path " in
6724
	    *" $libdir "*) ;;
6725
	    *)
6726
	      case "$finalize_rpath " in
6727
	      *" $libdir "*) ;;
6728
	      *) func_append finalize_rpath " $libdir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6729
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6730
	      ;;
6731
	    esac
6732
	  fi
6733
6734
	  if test -n "$old_archive_from_expsyms_cmds"; then
6735
	    # figure out the soname
6736
	    set dummy $library_names
6737
	    shift
6738
	    realname="$1"
6739
	    shift
6740
	    libname=`eval "\\$ECHO \"$libname_spec\""`
6741
	    # use dlname if we got it. it's perfectly good, no?
6742
	    if test -n "$dlname"; then
6743
	      soname="$dlname"
6744
	    elif test -n "$soname_spec"; then
6745
	      # bleh windows
6746
	      case $host in
6747
	      *cygwin* | mingw* | *cegcc*)
6748
	        func_arith $current - $age
6749
		major=$func_arith_result
6750
		versuffix="-$major"
6751
		;;
6752
	      esac
6753
	      eval soname=\"$soname_spec\"
6754
	    else
6755
	      soname="$realname"
6756
	    fi
6757
6758
	    # Make a new name for the extract_expsyms_cmds to use
6759
	    soroot="$soname"
6760
	    func_basename "$soroot"
6761
	    soname="$func_basename_result"
6762
	    func_stripname 'lib' '.dll' "$soname"
6763
	    newlib=libimp-$func_stripname_result.a
6764
6765
	    # If the library has no export list, then create one now
6766
	    if test -f "$output_objdir/$soname-def"; then :
6767
	    else
6768
	      func_verbose "extracting exported symbol list from \`$soname'"
6769
	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
6770
	    fi
6771
6772
	    # Create $newlib
6773
	    if test -f "$output_objdir/$newlib"; then :; else
6774
	      func_verbose "generating import library for \`$soname'"
6775
	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
6776
	    fi
6777
	    # make sure the library variables are pointing to the new library
6778
	    dir=$output_objdir
6779
	    linklib=$newlib
6780
	  fi # test -n "$old_archive_from_expsyms_cmds"
6781
6782
	  if test "$linkmode" = prog || test "$opt_mode" != relink; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6783
	    add_shlibpath=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6784
	    add_dir=
6785
	    add=
6786
	    lib_linked=yes
6787
	    case $hardcode_action in
6788
	    immediate | unsupported)
6789
	      if test "$hardcode_direct" = no; then
6790
		add="$dir/$linklib"
6791
		case $host in
6792
		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
6793
		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
6794
		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
6795
		    *-*-unixware7*) add_dir="-L$dir" ;;
6796
		  *-*-darwin* )
6797
		    # if the lib is a (non-dlopened) module then we can not
6798
		    # link against it, someone is ignoring the earlier warnings
6799
		    if /usr/bin/file -L $add 2> /dev/null |
6800
			 $GREP ": [^:]* bundle" >/dev/null ; then
6801
		      if test "X$dlopenmodule" != "X$lib"; then
6802
			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
6803
			if test -z "$old_library" ; then
6804
			  echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6805
			  echo "*** And there doesn't seem to be a static archive available"
6806
			  echo "*** The link will probably fail, sorry"
6807
			else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6808
			  add="$dir/$old_library"
6809
			fi
6810
		      elif test -n "$old_library"; then
6811
			add="$dir/$old_library"
6812
		      fi
6813
		    fi
6814
		esac
6815
	      elif test "$hardcode_minus_L" = no; then
6816
		case $host in
6817
		*-*-sunos*) add_shlibpath="$dir" ;;
6818
		esac
6819
		add_dir="-L$dir"
6820
		add="-l$name"
6821
	      elif test "$hardcode_shlibpath_var" = no; then
6822
		add_shlibpath="$dir"
6823
		add="-l$name"
6824
	      else
6825
		lib_linked=no
6826
	      fi
6827
	      ;;
6828
	    relink)
6829
	      if test "$hardcode_direct" = yes &&
6830
	         test "$hardcode_direct_absolute" = no; then
6831
		add="$dir/$linklib"
6832
	      elif test "$hardcode_minus_L" = yes; then
6833
		add_dir="-L$dir"
6834
		# Try looking first in the location we're being installed to.
6835
		if test -n "$inst_prefix_dir"; then
6836
		  case $libdir in
6837
		    [\\/]*)
6838
		      func_append add_dir " -L$inst_prefix_dir$libdir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6839
		      ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6840
		  esac
6841
		fi
6842
		add="-l$name"
6843
	      elif test "$hardcode_shlibpath_var" = yes; then
6844
		add_shlibpath="$dir"
6845
		add="-l$name"
6846
	      else
6847
		lib_linked=no
6848
	      fi
6849
	      ;;
6850
	    *) lib_linked=no ;;
6851
	    esac
6852
6853
	    if test "$lib_linked" != yes; then
6854
	      func_fatal_configuration "unsupported hardcode properties"
6855
	    fi
6856
6857
	    if test -n "$add_shlibpath"; then
6858
	      case :$compile_shlibpath: in
6859
	      *":$add_shlibpath:"*) ;;
6860
	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6861
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6862
	    fi
6863
	    if test "$linkmode" = prog; then
6864
	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
6865
	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
6866
	    else
6867
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
6868
	      test -n "$add" && deplibs="$add $deplibs"
6869
	      if test "$hardcode_direct" != yes &&
6870
		 test "$hardcode_minus_L" != yes &&
6871
		 test "$hardcode_shlibpath_var" = yes; then
6872
		case :$finalize_shlibpath: in
6873
		*":$libdir:"*) ;;
6874
		*) func_append finalize_shlibpath "$libdir:" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6875
		esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6876
	      fi
6877
	    fi
6878
	  fi
6879
6880
	  if test "$linkmode" = prog || test "$opt_mode" = relink; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6881
	    add_shlibpath=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6882
	    add_dir=
6883
	    add=
6884
	    # Finalize command for both is simple: just hardcode it.
6885
	    if test "$hardcode_direct" = yes &&
6886
	       test "$hardcode_direct_absolute" = no; then
6887
	      add="$libdir/$linklib"
6888
	    elif test "$hardcode_minus_L" = yes; then
6889
	      add_dir="-L$libdir"
6890
	      add="-l$name"
6891
	    elif test "$hardcode_shlibpath_var" = yes; then
6892
	      case :$finalize_shlibpath: in
6893
	      *":$libdir:"*) ;;
6894
	      *) func_append finalize_shlibpath "$libdir:" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6895
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6896
	      add="-l$name"
6897
	    elif test "$hardcode_automatic" = yes; then
6898
	      if test -n "$inst_prefix_dir" &&
6899
		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
6900
		add="$inst_prefix_dir$libdir/$linklib"
6901
	      else
6902
		add="$libdir/$linklib"
6903
	      fi
6904
	    else
6905
	      # We cannot seem to hardcode it, guess we'll fake it.
6906
	      add_dir="-L$libdir"
6907
	      # Try looking first in the location we're being installed to.
6908
	      if test -n "$inst_prefix_dir"; then
6909
		case $libdir in
6910
		  [\\/]*)
6911
		    func_append add_dir " -L$inst_prefix_dir$libdir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6912
		    ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6913
		esac
6914
	      fi
6915
	      add="-l$name"
6916
	    fi
6917
6918
	    if test "$linkmode" = prog; then
6919
	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
6920
	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
6921
	    else
6922
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
6923
	      test -n "$add" && deplibs="$add $deplibs"
6924
	    fi
6925
	  fi
6926
	elif test "$linkmode" = prog; then
6927
	  # Here we assume that one of hardcode_direct or hardcode_minus_L
6928
	  # is not unsupported.  This is valid on all known static and
6929
	  # shared platforms.
6930
	  if test "$hardcode_direct" != unsupported; then
6931
	    test -n "$old_library" && linklib="$old_library"
6932
	    compile_deplibs="$dir/$linklib $compile_deplibs"
6933
	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
6934
	  else
6935
	    compile_deplibs="-l$name -L$dir $compile_deplibs"
6936
	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
6937
	  fi
6938
	elif test "$build_libtool_libs" = yes; then
6939
	  # Not a shared library
6940
	  if test "$deplibs_check_method" != pass_all; then
6941
	    # We're trying link a shared library against a static one
6942
	    # but the system doesn't support it.
6943
6944
	    # Just print a warning and add the library to dependency_libs so
6945
	    # that the program can be linked against the static library.
6946
	    echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6947
	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6948
	    echo "*** I have the capability to make that library automatically link in when"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6949
	    echo "*** you link to this library.  But I can only do this if you have a"
6950
	    echo "*** shared version of the library, which you do not appear to have."
6951
	    if test "$module" = yes; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6952
	      echo "*** But as you try to build a module library, libtool will still create "
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6953
	      echo "*** a static module, that should work as long as the dlopening application"
6954
	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
6955
	      if test -z "$global_symbol_pipe"; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6956
		echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
6957
		echo "*** However, this would only work if libtool was able to extract symbol"
6958
		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
6959
		echo "*** not find such a program.  So, this module is probably useless."
6960
		echo "*** \`nm' from GNU binutils and a full rebuild may help."
6961
	      fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6962
	      if test "$build_old_libs" = no; then
6963
		build_libtool_libs=module
6964
		build_old_libs=yes
6965
	      else
6966
		build_libtool_libs=no
6967
	      fi
6968
	    fi
6969
	  else
6970
	    deplibs="$dir/$old_library $deplibs"
6971
	    link_static=yes
6972
	  fi
6973
	fi # link shared/static library?
6974
6975
	if test "$linkmode" = lib; then
6976
	  if test -n "$dependency_libs" &&
6977
	     { test "$hardcode_into_libs" != yes ||
6978
	       test "$build_old_libs" = yes ||
6979
	       test "$link_static" = yes; }; then
6980
	    # Extract -R from dependency_libs
6981
	    temp_deplibs=
6982
	    for libdir in $dependency_libs; do
6983
	      case $libdir in
6984
	      -R*) func_stripname '-R' '' "$libdir"
6985
	           temp_xrpath=$func_stripname_result
6986
		   case " $xrpath " in
6987
		   *" $temp_xrpath "*) ;;
6988
		   *) func_append xrpath " $temp_xrpath";;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6989
		   esac;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6990
	      *) func_append temp_deplibs " $libdir";;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6991
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6992
	    done
6993
	    dependency_libs="$temp_deplibs"
6994
	  fi
6995
6996
	  func_append newlib_search_path " $absdir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
6997
	  # Link against this library
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
6998
	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
6999
	  # ... and its dependency_libs
7000
	  tmp_libs=
7001
	  for deplib in $dependency_libs; do
7002
	    newdependency_libs="$deplib $newdependency_libs"
7003
	    case $deplib in
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7004
              -L*) func_stripname '-L' '' "$deplib"
7005
                   func_resolve_sysroot "$func_stripname_result";;
7006
              *) func_resolve_sysroot "$deplib" ;;
7007
            esac
7008
	    if $opt_preserve_dup_deps ; then
7009
	      case "$tmp_libs " in
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7010
	      *" $func_resolve_sysroot_result "*)
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7011
                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
7012
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7013
	    fi
7014
	    func_append tmp_libs " $func_resolve_sysroot_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7015
	  done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7016
7017
	  if test "$link_all_deplibs" != no; then
7018
	    # Add the search paths of all dependency libraries
7019
	    for deplib in $dependency_libs; do
7020
	      path=
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7021
	      case $deplib in
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7022
	      -L*) path="$deplib" ;;
7023
	      *.la)
7024
	        func_resolve_sysroot "$deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7025
	        deplib=$func_resolve_sysroot_result
7026
	        func_dirname "$deplib" "" "."
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7027
		dir=$func_dirname_result
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7028
		# We need an absolute path.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7029
		case $dir in
7030
		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
7031
		*)
7032
		  absdir=`cd "$dir" && pwd`
7033
		  if test -z "$absdir"; then
7034
		    func_warning "cannot determine absolute directory name of \`$dir'"
7035
		    absdir="$dir"
7036
		  fi
7037
		  ;;
7038
		esac
7039
		if $GREP "^installed=no" $deplib > /dev/null; then
7040
		case $host in
7041
		*-*-darwin*)
7042
		  depdepl=
7043
		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
7044
		  if test -n "$deplibrary_names" ; then
7045
		    for tmp in $deplibrary_names ; do
7046
		      depdepl=$tmp
7047
		    done
7048
		    if test -f "$absdir/$objdir/$depdepl" ; then
7049
		      depdepl="$absdir/$objdir/$depdepl"
7050
		      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
7051
                      if test -z "$darwin_install_name"; then
7052
                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
7053
                      fi
7054
		      func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7055
		      func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
7056
		      path=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7057
		    fi
7058
		  fi
7059
		  ;;
7060
		*)
7061
		  path="-L$absdir/$objdir"
7062
		  ;;
7063
		esac
7064
		else
7065
		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7066
		  test -z "$libdir" && \
7067
		    func_fatal_error "\`$deplib' is not a valid libtool archive"
7068
		  test "$absdir" != "$libdir" && \
7069
		    func_warning "\`$deplib' seems to be moved"
7070
7071
		  path="-L$absdir"
7072
		fi
7073
		;;
7074
	      esac
7075
	      case " $deplibs " in
7076
	      *" $path "*) ;;
7077
	      *) deplibs="$path $deplibs" ;;
7078
	      esac
7079
	    done
7080
	  fi # link_all_deplibs != no
7081
	fi # linkmode = lib
7082
      done # for deplib in $libs
7083
      if test "$pass" = link; then
7084
	if test "$linkmode" = "prog"; then
7085
	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
7086
	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
7087
	else
7088
	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7089
	fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7090
      fi
7091
      dependency_libs="$newdependency_libs"
7092
      if test "$pass" = dlpreopen; then
7093
	# Link the dlpreopened libraries before other libraries
7094
	for deplib in $save_deplibs; do
7095
	  deplibs="$deplib $deplibs"
7096
	done
7097
      fi
7098
      if test "$pass" != dlopen; then
7099
	if test "$pass" != conv; then
7100
	  # Make sure lib_search_path contains only unique directories.
7101
	  lib_search_path=
7102
	  for dir in $newlib_search_path; do
7103
	    case "$lib_search_path " in
7104
	    *" $dir "*) ;;
7105
	    *) func_append lib_search_path " $dir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7106
	    esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7107
	  done
7108
	  newlib_search_path=
7109
	fi
7110
7111
	if test "$linkmode,$pass" != "prog,link"; then
7112
	  vars="deplibs"
7113
	else
7114
	  vars="compile_deplibs finalize_deplibs"
7115
	fi
7116
	for var in $vars dependency_libs; do
7117
	  # Add libraries to $var in reverse order
7118
	  eval tmp_libs=\"\$$var\"
7119
	  new_libs=
7120
	  for deplib in $tmp_libs; do
7121
	    # FIXME: Pedantically, this is the right thing to do, so
7122
	    #        that some nasty dependency loop isn't accidentally
7123
	    #        broken:
7124
	    #new_libs="$deplib $new_libs"
7125
	    # Pragmatically, this seems to cause very few problems in
7126
	    # practice:
7127
	    case $deplib in
7128
	    -L*) new_libs="$deplib $new_libs" ;;
7129
	    -R*) ;;
7130
	    *)
7131
	      # And here is the reason: when a library appears more
7132
	      # than once as an explicit dependence of a library, or
7133
	      # is implicitly linked in more than once by the
7134
	      # compiler, it is considered special, and multiple
7135
	      # occurrences thereof are not removed.  Compare this
7136
	      # with having the same library being listed as a
7137
	      # dependency of multiple other libraries: in this case,
7138
	      # we know (pedantically, we assume) the library does not
7139
	      # need to be listed more than once, so we keep only the
7140
	      # last copy.  This is not always right, but it is rare
7141
	      # enough that we require users that really mean to play
7142
	      # such unportable linking tricks to link the library
7143
	      # using -Wl,-lname, so that libtool does not consider it
7144
	      # for duplicate removal.
7145
	      case " $specialdeplibs " in
7146
	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
7147
	      *)
7148
		case " $new_libs " in
7149
		*" $deplib "*) ;;
7150
		*) new_libs="$deplib $new_libs" ;;
7151
		esac
7152
		;;
7153
	      esac
7154
	      ;;
7155
	    esac
7156
	  done
7157
	  tmp_libs=
7158
	  for deplib in $new_libs; do
7159
	    case $deplib in
7160
	    -L*)
7161
	      case " $tmp_libs " in
7162
	      *" $deplib "*) ;;
7163
	      *) func_append tmp_libs " $deplib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7164
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7165
	      ;;
7166
	    *) func_append tmp_libs " $deplib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7167
	    esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7168
	  done
7169
	  eval $var=\"$tmp_libs\"
7170
	done # for var
7171
      fi
7172
      # Last step: remove runtime libs from dependency_libs
7173
      # (they stay in deplibs)
7174
      tmp_libs=
7175
      for i in $dependency_libs ; do
7176
	case " $predeps $postdeps $compiler_lib_search_path " in
7177
	*" $i "*)
7178
	  i=""
7179
	  ;;
7180
	esac
7181
	if test -n "$i" ; then
7182
	  func_append tmp_libs " $i"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7183
	fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7184
      done
7185
      dependency_libs=$tmp_libs
7186
    done # for pass
7187
    if test "$linkmode" = prog; then
7188
      dlfiles="$newdlfiles"
7189
    fi
7190
    if test "$linkmode" = prog || test "$linkmode" = lib; then
7191
      dlprefiles="$newdlprefiles"
7192
    fi
7193
7194
    case $linkmode in
7195
    oldlib)
7196
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
7197
	func_warning "\`-dlopen' is ignored for archives"
7198
      fi
7199
7200
      case " $deplibs" in
7201
      *\ -l* | *\ -L*)
7202
	func_warning "\`-l' and \`-L' are ignored for archives" ;;
7203
      esac
7204
7205
      test -n "$rpath" && \
7206
	func_warning "\`-rpath' is ignored for archives"
7207
7208
      test -n "$xrpath" && \
7209
	func_warning "\`-R' is ignored for archives"
7210
7211
      test -n "$vinfo" && \
7212
	func_warning "\`-version-info/-version-number' is ignored for archives"
7213
7214
      test -n "$release" && \
7215
	func_warning "\`-release' is ignored for archives"
7216
7217
      test -n "$export_symbols$export_symbols_regex" && \
7218
	func_warning "\`-export-symbols' is ignored for archives"
7219
7220
      # Now set the variables for building old libraries.
7221
      build_libtool_libs=no
7222
      oldlibs="$output"
7223
      func_append objs "$old_deplibs"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7224
      ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7225
7226
    lib)
7227
      # Make sure we only generate libraries of the form `libNAME.la'.
7228
      case $outputname in
7229
      lib*)
7230
	func_stripname 'lib' '.la' "$outputname"
7231
	name=$func_stripname_result
7232
	eval shared_ext=\"$shrext_cmds\"
7233
	eval libname=\"$libname_spec\"
7234
	;;
7235
      *)
7236
	test "$module" = no && \
7237
	  func_fatal_help "libtool library \`$output' must begin with \`lib'"
7238
7239
	if test "$need_lib_prefix" != no; then
7240
	  # Add the "lib" prefix for modules if required
7241
	  func_stripname '' '.la' "$outputname"
7242
	  name=$func_stripname_result
7243
	  eval shared_ext=\"$shrext_cmds\"
7244
	  eval libname=\"$libname_spec\"
7245
	else
7246
	  func_stripname '' '.la' "$outputname"
7247
	  libname=$func_stripname_result
7248
	fi
7249
	;;
7250
      esac
7251
7252
      if test -n "$objs"; then
7253
	if test "$deplibs_check_method" != pass_all; then
7254
	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
7255
	else
7256
	  echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7257
	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7258
	  $ECHO "*** objects $objs is not portable!"
7259
	  func_append libobjs " $objs"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7260
	fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7261
      fi
7262
7263
      test "$dlself" != no && \
7264
	func_warning "\`-dlopen self' is ignored for libtool libraries"
7265
7266
      set dummy $rpath
7267
      shift
7268
      test "$#" -gt 1 && \
7269
	func_warning "ignoring multiple \`-rpath's for a libtool library"
7270
7271
      install_libdir="$1"
7272
7273
      oldlibs=
7274
      if test -z "$rpath"; then
7275
	if test "$build_libtool_libs" = yes; then
7276
	  # Building a libtool convenience library.
7277
	  # Some compilers have problems with a `.al' extension so
7278
	  # convenience libraries should have the same extension an
7279
	  # archive normally would.
7280
	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
7281
	  build_libtool_libs=convenience
7282
	  build_old_libs=yes
7283
	fi
7284
7285
	test -n "$vinfo" && \
7286
	  func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
7287
7288
	test -n "$release" && \
7289
	  func_warning "\`-release' is ignored for convenience libraries"
7290
      else
7291
7292
	# Parse the version information argument.
7293
	save_ifs="$IFS"; IFS=':'
7294
	set dummy $vinfo 0 0 0
7295
	shift
7296
	IFS="$save_ifs"
7297
7298
	test -n "$7" && \
7299
	  func_fatal_help "too many parameters to \`-version-info'"
7300
7301
	# convert absolute version numbers to libtool ages
7302
	# this retains compatibility with .la files and attempts
7303
	# to make the code below a bit more comprehensible
7304
7305
	case $vinfo_number in
7306
	yes)
7307
	  number_major="$1"
7308
	  number_minor="$2"
7309
	  number_revision="$3"
7310
	  #
7311
	  # There are really only two kinds -- those that
7312
	  # use the current revision as the major version
7313
	  # and those that subtract age and use age as
7314
	  # a minor version.  But, then there is irix
7315
	  # which has an extra 1 added just for fun
7316
	  #
7317
	  case $version_type in
7318
	  darwin|linux|osf|windows|none)
7319
	    func_arith $number_major + $number_minor
7320
	    current=$func_arith_result
7321
	    age="$number_minor"
7322
	    revision="$number_revision"
7323
	    ;;
7324
	  freebsd-aout|freebsd-elf|qnx|sunos)
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7325
	    current="$number_major"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7326
	    revision="$number_minor"
7327
	    age="0"
7328
	    ;;
7329
	  irix|nonstopux)
7330
	    func_arith $number_major + $number_minor
7331
	    current=$func_arith_result
7332
	    age="$number_minor"
7333
	    revision="$number_minor"
7334
	    lt_irix_increment=no
7335
	    ;;
7336
	  esac
7337
	  ;;
7338
	no)
7339
	  current="$1"
7340
	  revision="$2"
7341
	  age="$3"
7342
	  ;;
7343
	esac
7344
7345
	# Check that each of the things are valid numbers.
7346
	case $current in
7347
	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]) ;;
7348
	*)
7349
	  func_error "CURRENT \`$current' must be a nonnegative integer"
7350
	  func_fatal_error "\`$vinfo' is not valid version information"
7351
	  ;;
7352
	esac
7353
7354
	case $revision in
7355
	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]) ;;
7356
	*)
7357
	  func_error "REVISION \`$revision' must be a nonnegative integer"
7358
	  func_fatal_error "\`$vinfo' is not valid version information"
7359
	  ;;
7360
	esac
7361
7362
	case $age in
7363
	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]) ;;
7364
	*)
7365
	  func_error "AGE \`$age' must be a nonnegative integer"
7366
	  func_fatal_error "\`$vinfo' is not valid version information"
7367
	  ;;
7368
	esac
7369
7370
	if test "$age" -gt "$current"; then
7371
	  func_error "AGE \`$age' is greater than the current interface number \`$current'"
7372
	  func_fatal_error "\`$vinfo' is not valid version information"
7373
	fi
7374
7375
	# Calculate the version variables.
7376
	major=
7377
	versuffix=
7378
	verstring=
7379
	case $version_type in
7380
	none) ;;
7381
7382
	darwin)
7383
	  # Like Linux, but with the current version available in
7384
	  # verstring for coding it into the library header
7385
	  func_arith $current - $age
7386
	  major=.$func_arith_result
7387
	  versuffix="$major.$age.$revision"
7388
	  # Darwin ld doesn't like 0 for these options...
7389
	  func_arith $current + 1
7390
	  minor_current=$func_arith_result
7391
	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
7392
	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
7393
	  ;;
7394
7395
	freebsd-aout)
7396
	  major=".$current"
7397
	  versuffix=".$current.$revision";
7398
	  ;;
7399
7400
	freebsd-elf)
7401
	  major=".$current"
7402
	  versuffix=".$current"
7403
	  ;;
7404
7405
	irix | nonstopux)
7406
	  if test "X$lt_irix_increment" = "Xno"; then
7407
	    func_arith $current - $age
7408
	  else
7409
	    func_arith $current - $age + 1
7410
	  fi
7411
	  major=$func_arith_result
7412
7413
	  case $version_type in
7414
	    nonstopux) verstring_prefix=nonstopux ;;
7415
	    *)         verstring_prefix=sgi ;;
7416
	  esac
7417
	  verstring="$verstring_prefix$major.$revision"
7418
7419
	  # Add in all the interfaces that we are compatible with.
7420
	  loop=$revision
7421
	  while test "$loop" -ne 0; do
7422
	    func_arith $revision - $loop
7423
	    iface=$func_arith_result
7424
	    func_arith $loop - 1
7425
	    loop=$func_arith_result
7426
	    verstring="$verstring_prefix$major.$iface:$verstring"
7427
	  done
7428
7429
	  # Before this point, $major must not contain `.'.
7430
	  major=.$major
7431
	  versuffix="$major.$revision"
7432
	  ;;
7433
7434
	linux)
7435
	  func_arith $current - $age
7436
	  major=.$func_arith_result
7437
	  versuffix="$major.$age.$revision"
7438
	  ;;
7439
7440
	osf)
7441
	  func_arith $current - $age
7442
	  major=.$func_arith_result
7443
	  versuffix=".$current.$age.$revision"
7444
	  verstring="$current.$age.$revision"
7445
7446
	  # Add in all the interfaces that we are compatible with.
7447
	  loop=$age
7448
	  while test "$loop" -ne 0; do
7449
	    func_arith $current - $loop
7450
	    iface=$func_arith_result
7451
	    func_arith $loop - 1
7452
	    loop=$func_arith_result
7453
	    verstring="$verstring:${iface}.0"
7454
	  done
7455
7456
	  # Make executables depend on our current version.
7457
	  func_append verstring ":${current}.0"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7458
	  ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7459
7460
	qnx)
7461
	  major=".$current"
7462
	  versuffix=".$current"
7463
	  ;;
7464
7465
	sunos)
7466
	  major=".$current"
7467
	  versuffix=".$current.$revision"
7468
	  ;;
7469
7470
	windows)
7471
	  # Use '-' rather than '.', since we only want one
7472
	  # extension on DOS 8.3 filesystems.
7473
	  func_arith $current - $age
7474
	  major=$func_arith_result
7475
	  versuffix="-$major"
7476
	  ;;
7477
7478
	*)
7479
	  func_fatal_configuration "unknown library version type \`$version_type'"
7480
	  ;;
7481
	esac
7482
7483
	# Clear the version info if we defaulted, and they specified a release.
7484
	if test -z "$vinfo" && test -n "$release"; then
7485
	  major=
7486
	  case $version_type in
7487
	  darwin)
7488
	    # we can't check for "0.0" in archive_cmds due to quoting
7489
	    # problems, so we reset it completely
7490
	    verstring=
7491
	    ;;
7492
	  *)
7493
	    verstring="0.0"
7494
	    ;;
7495
	  esac
7496
	  if test "$need_version" = no; then
7497
	    versuffix=
7498
	  else
7499
	    versuffix=".0.0"
7500
	  fi
7501
	fi
7502
7503
	# Remove version info from name if versioning should be avoided
7504
	if test "$avoid_version" = yes && test "$need_version" = no; then
7505
	  major=
7506
	  versuffix=
7507
	  verstring=""
7508
	fi
7509
7510
	# Check to see if the archive will have undefined symbols.
7511
	if test "$allow_undefined" = yes; then
7512
	  if test "$allow_undefined_flag" = unsupported; then
7513
	    func_warning "undefined symbols not allowed in $host shared libraries"
7514
	    build_libtool_libs=no
7515
	    build_old_libs=yes
7516
	  fi
7517
	else
7518
	  # Don't allow undefined symbols.
7519
	  allow_undefined_flag="$no_undefined_flag"
7520
	fi
7521
7522
      fi
7523
7524
      func_generate_dlsyms "$libname" "$libname" "yes"
7525
      func_append libobjs " $symfileobj"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7526
      test "X$libobjs" = "X " && libobjs=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7527
7528
      if test "$opt_mode" != relink; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7529
	# Remove our outputs, but don't remove object files since they
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7530
	# may have been created when compiling PIC objects.
7531
	removelist=
7532
	tempremovelist=`$ECHO "$output_objdir/*"`
7533
	for p in $tempremovelist; do
7534
	  case $p in
7535
	    *.$objext | *.gcno)
7536
	       ;;
7537
	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
7538
	       if test "X$precious_files_regex" != "X"; then
7539
		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
7540
		 then
7541
		   continue
7542
		 fi
7543
	       fi
7544
	       func_append removelist " $p"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7545
	       ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7546
	    *) ;;
7547
	  esac
7548
	done
7549
	test -n "$removelist" && \
7550
	  func_show_eval "${RM}r \$removelist"
7551
      fi
7552
7553
      # Now set the variables for building old libraries.
7554
      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
7555
	func_append oldlibs " $output_objdir/$libname.$libext"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7556
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7557
	# Transform .lo files to .o files.
7558
	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7559
      fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7560
7561
      # Eliminate all temporary directories.
7562
      #for path in $notinst_path; do
7563
      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7564
      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
7565
      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
7566
      #done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7567
7568
      if test -n "$xrpath"; then
7569
	# If the user specified any rpath flags, then add them.
7570
	temp_xrpath=
7571
	for libdir in $xrpath; do
7572
	  func_replace_sysroot "$libdir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7573
	  func_append temp_xrpath " -R$func_replace_sysroot_result"
7574
	  case "$finalize_rpath " in
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7575
	  *" $libdir "*) ;;
7576
	  *) func_append finalize_rpath " $libdir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7577
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7578
	done
7579
	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
7580
	  dependency_libs="$temp_xrpath $dependency_libs"
7581
	fi
7582
      fi
7583
7584
      # Make sure dlfiles contains only unique files that won't be dlpreopened
7585
      old_dlfiles="$dlfiles"
7586
      dlfiles=
7587
      for lib in $old_dlfiles; do
7588
	case " $dlprefiles $dlfiles " in
7589
	*" $lib "*) ;;
7590
	*) func_append dlfiles " $lib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7591
	esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7592
      done
7593
7594
      # Make sure dlprefiles contains only unique files
7595
      old_dlprefiles="$dlprefiles"
7596
      dlprefiles=
7597
      for lib in $old_dlprefiles; do
7598
	case "$dlprefiles " in
7599
	*" $lib "*) ;;
7600
	*) func_append dlprefiles " $lib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7601
	esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7602
      done
7603
7604
      if test "$build_libtool_libs" = yes; then
7605
	if test -n "$rpath"; then
7606
	  case $host in
7607
	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7608
	    # these systems don't actually have a c library (as such)!
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7609
	    ;;
7610
	  *-*-rhapsody* | *-*-darwin1.[012])
7611
	    # Rhapsody C library is in the System framework
7612
	    func_append deplibs " System.ltframework"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7613
	    ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7614
	  *-*-netbsd*)
7615
	    # Don't link with libc until the a.out ld.so is fixed.
7616
	    ;;
7617
	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
7618
	    # Do not include libc due to us having libc/libc_r.
7619
	    ;;
7620
	  *-*-sco3.2v5* | *-*-sco5v6*)
7621
	    # Causes problems with __ctype
7622
	    ;;
7623
	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7624
	    # Compiler inserts libc in the correct place for threads to work
7625
	    ;;
7626
	  *)
7627
	    # Add libc to deplibs on all other systems if necessary.
7628
	    if test "$build_libtool_need_lc" = "yes"; then
7629
	      func_append deplibs " -lc"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7630
	    fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7631
	    ;;
7632
	  esac
7633
	fi
7634
7635
	# Transform deplibs into only deplibs that can be linked in shared.
7636
	name_save=$name
7637
	libname_save=$libname
7638
	release_save=$release
7639
	versuffix_save=$versuffix
7640
	major_save=$major
7641
	# I'm not sure if I'm treating the release correctly.  I think
7642
	# release should show up in the -l (ie -lgmp5) so we don't want to
7643
	# add it in twice.  Is that correct?
7644
	release=""
7645
	versuffix=""
7646
	major=""
7647
	newdeplibs=
7648
	droppeddeps=no
7649
	case $deplibs_check_method in
7650
	pass_all)
7651
	  # Don't check for shared/static.  Everything works.
7652
	  # This might be a little naive.  We might want to check
7653
	  # whether the library exists or not.  But this is on
7654
	  # osf3 & osf4 and I'm not really sure... Just
7655
	  # implementing what was already the behavior.
7656
	  newdeplibs=$deplibs
7657
	  ;;
7658
	test_compile)
7659
	  # This code stresses the "libraries are programs" paradigm to its
7660
	  # limits. Maybe even breaks it.  We compile a program, linking it
7661
	  # against the deplibs as a proxy for the library.  Then we can check
7662
	  # whether they linked in statically or dynamically with ldd.
7663
	  $opt_dry_run || $RM conftest.c
7664
	  cat > conftest.c <<EOF
7665
	  int main() { return 0; }
7666
EOF
7667
	  $opt_dry_run || $RM conftest
7668
	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
7669
	    ldd_output=`ldd conftest`
7670
	    for i in $deplibs; do
7671
	      case $i in
7672
	      -l*)
7673
		func_stripname -l '' "$i"
7674
		name=$func_stripname_result
7675
		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7676
		  case " $predeps $postdeps " in
7677
		  *" $i "*)
7678
		    func_append newdeplibs " $i"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7679
		    i=""
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7680
		    ;;
7681
		  esac
7682
		fi
7683
		if test -n "$i" ; then
7684
		  libname=`eval "\\$ECHO \"$libname_spec\""`
7685
		  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7686
		  set dummy $deplib_matches; shift
7687
		  deplib_match=$1
7688
		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7689
		    func_append newdeplibs " $i"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7690
		  else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7691
		    droppeddeps=yes
7692
		    echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7693
		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7694
		    echo "*** I have the capability to make that library automatically link in when"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7695
		    echo "*** you link to this library.  But I can only do this if you have a"
7696
		    echo "*** shared version of the library, which I believe you do not have"
7697
		    echo "*** because a test_compile did reveal that the linker did not use it for"
7698
		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
7699
		  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7700
		fi
7701
		;;
7702
	      *)
7703
		func_append newdeplibs " $i"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7704
		;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7705
	      esac
7706
	    done
7707
	  else
7708
	    # Error occurred in the first compile.  Let's try to salvage
7709
	    # the situation: Compile a separate program for each library.
7710
	    for i in $deplibs; do
7711
	      case $i in
7712
	      -l*)
7713
		func_stripname -l '' "$i"
7714
		name=$func_stripname_result
7715
		$opt_dry_run || $RM conftest
7716
		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
7717
		  ldd_output=`ldd conftest`
7718
		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7719
		    case " $predeps $postdeps " in
7720
		    *" $i "*)
7721
		      func_append newdeplibs " $i"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7722
		      i=""
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7723
		      ;;
7724
		    esac
7725
		  fi
7726
		  if test -n "$i" ; then
7727
		    libname=`eval "\\$ECHO \"$libname_spec\""`
7728
		    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
7729
		    set dummy $deplib_matches; shift
7730
		    deplib_match=$1
7731
		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
7732
		      func_append newdeplibs " $i"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7733
		    else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7734
		      droppeddeps=yes
7735
		      echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7736
		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7737
		      echo "*** I have the capability to make that library automatically link in when"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7738
		      echo "*** you link to this library.  But I can only do this if you have a"
7739
		      echo "*** shared version of the library, which you do not appear to have"
7740
		      echo "*** because a test_compile did reveal that the linker did not use this one"
7741
		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
7742
		    fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7743
		  fi
7744
		else
7745
		  droppeddeps=yes
7746
		  echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7747
		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7748
		  echo "*** make it link in!  You will probably need to install it or some"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7749
		  echo "*** library that it depends on before this library will be fully"
7750
		  echo "*** functional.  Installing it before continuing would be even better."
7751
		fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7752
		;;
7753
	      *)
7754
		func_append newdeplibs " $i"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7755
		;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7756
	      esac
7757
	    done
7758
	  fi
7759
	  ;;
7760
	file_magic*)
7761
	  set dummy $deplibs_check_method; shift
7762
	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7763
	  for a_deplib in $deplibs; do
7764
	    case $a_deplib in
7765
	    -l*)
7766
	      func_stripname -l '' "$a_deplib"
7767
	      name=$func_stripname_result
7768
	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7769
		case " $predeps $postdeps " in
7770
		*" $a_deplib "*)
7771
		  func_append newdeplibs " $a_deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7772
		  a_deplib=""
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7773
		  ;;
7774
		esac
7775
	      fi
7776
	      if test -n "$a_deplib" ; then
7777
		libname=`eval "\\$ECHO \"$libname_spec\""`
7778
		if test -n "$file_magic_glob"; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7779
		  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
7780
		else
7781
		  libnameglob=$libname
7782
		fi
7783
		test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
7784
		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7785
		  if test "$want_nocaseglob" = yes; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7786
		    shopt -s nocaseglob
7787
		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7788
		    $nocaseglob
7789
		  else
7790
		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
7791
		  fi
7792
		  for potent_lib in $potential_libs; do
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7793
		      # Follow soft links.
7794
		      if ls -lLd "$potent_lib" 2>/dev/null |
7795
			 $GREP " -> " >/dev/null; then
7796
			continue
7797
		      fi
7798
		      # The statement above tries to avoid entering an
7799
		      # endless loop below, in case of cyclic links.
7800
		      # We might still enter an endless loop, since a link
7801
		      # loop can be closed while we follow links,
7802
		      # but so what?
7803
		      potlib="$potent_lib"
7804
		      while test -h "$potlib" 2>/dev/null; do
7805
			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
7806
			case $potliblink in
7807
			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
7808
			*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7809
			esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7810
		      done
7811
		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
7812
			 $SED -e 10q |
7813
			 $EGREP "$file_magic_regex" > /dev/null; then
7814
			func_append newdeplibs " $a_deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7815
			a_deplib=""
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7816
			break 2
7817
		      fi
7818
		  done
7819
		done
7820
	      fi
7821
	      if test -n "$a_deplib" ; then
7822
		droppeddeps=yes
7823
		echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7824
		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7825
		echo "*** I have the capability to make that library automatically link in when"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7826
		echo "*** you link to this library.  But I can only do this if you have a"
7827
		echo "*** shared version of the library, which you do not appear to have"
7828
		echo "*** because I did check the linker path looking for a file starting"
7829
		if test -z "$potlib" ; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7830
		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
7831
		else
7832
		  $ECHO "*** with $libname and none of the candidates passed a file format test"
7833
		  $ECHO "*** using a file magic. Last file checked: $potlib"
7834
		fi
7835
	      fi
7836
	      ;;
7837
	    *)
7838
	      # Add a -L argument.
7839
	      func_append newdeplibs " $a_deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7840
	      ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7841
	    esac
7842
	  done # Gone through all deplibs.
7843
	  ;;
7844
	match_pattern*)
7845
	  set dummy $deplibs_check_method; shift
7846
	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7847
	  for a_deplib in $deplibs; do
7848
	    case $a_deplib in
7849
	    -l*)
7850
	      func_stripname -l '' "$a_deplib"
7851
	      name=$func_stripname_result
7852
	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
7853
		case " $predeps $postdeps " in
7854
		*" $a_deplib "*)
7855
		  func_append newdeplibs " $a_deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7856
		  a_deplib=""
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7857
		  ;;
7858
		esac
7859
	      fi
7860
	      if test -n "$a_deplib" ; then
7861
		libname=`eval "\\$ECHO \"$libname_spec\""`
7862
		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
7863
		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
7864
		  for potent_lib in $potential_libs; do
7865
		    potlib="$potent_lib" # see symlink-check above in file_magic test
7866
		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7867
		       $EGREP "$match_pattern_regex" > /dev/null; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7868
		      func_append newdeplibs " $a_deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7869
		      a_deplib=""
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7870
		      break 2
7871
		    fi
7872
		  done
7873
		done
7874
	      fi
7875
	      if test -n "$a_deplib" ; then
7876
		droppeddeps=yes
7877
		echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7878
		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7879
		echo "*** I have the capability to make that library automatically link in when"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7880
		echo "*** you link to this library.  But I can only do this if you have a"
7881
		echo "*** shared version of the library, which you do not appear to have"
7882
		echo "*** because I did check the linker path looking for a file starting"
7883
		if test -z "$potlib" ; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7884
		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
7885
		else
7886
		  $ECHO "*** with $libname and none of the candidates passed a file format test"
7887
		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
7888
		fi
7889
	      fi
7890
	      ;;
7891
	    *)
7892
	      # Add a -L argument.
7893
	      func_append newdeplibs " $a_deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7894
	      ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7895
	    esac
7896
	  done # Gone through all deplibs.
7897
	  ;;
7898
	none | unknown | *)
7899
	  newdeplibs=""
7900
	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7901
	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7902
	    for i in $predeps $postdeps ; do
7903
	      # can't use Xsed below, because $i might contain '/'
7904
	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7905
	    done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7906
	  fi
7907
	  case $tmp_deplibs in
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7908
	  *[!\	\ ]*)
7909
	    echo
7910
	    if test "X$deplibs_check_method" = "Xnone"; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7911
	      echo "*** Warning: inter-library dependencies are not supported in this platform."
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7912
	    else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7913
	      echo "*** Warning: inter-library dependencies are not known to be supported."
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7914
	    fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7915
	    echo "*** All declared inter-library dependencies are being dropped."
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7916
	    droppeddeps=yes
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7917
	    ;;
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7918
	  esac
7919
	  ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7920
	esac
7921
	versuffix=$versuffix_save
7922
	major=$major_save
7923
	release=$release_save
7924
	libname=$libname_save
7925
	name=$name_save
7926
7927
	case $host in
7928
	*-*-rhapsody* | *-*-darwin1.[012])
7929
	  # On Rhapsody replace the C library with the System framework
7930
	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7931
	  ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7932
	esac
7933
7934
	if test "$droppeddeps" = yes; then
7935
	  if test "$module" = yes; then
7936
	    echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7937
	    echo "*** Warning: libtool could not satisfy all declared inter-library"
7938
	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7939
	    echo "*** a static module, that should work as long as the dlopening"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7940
	    echo "*** application is linked with the -dlopen flag."
7941
	    if test -z "$global_symbol_pipe"; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7942
	      echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7943
	      echo "*** However, this would only work if libtool was able to extract symbol"
7944
	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
7945
	      echo "*** not find such a program.  So, this module is probably useless."
7946
	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
7947
	    fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7948
	    if test "$build_old_libs" = no; then
7949
	      oldlibs="$output_objdir/$libname.$libext"
7950
	      build_libtool_libs=module
7951
	      build_old_libs=yes
7952
	    else
7953
	      build_libtool_libs=no
7954
	    fi
7955
	  else
7956
	    echo "*** The inter-library dependencies that have been dropped here will be"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7957
	    echo "*** automatically added whenever a program is linked with this library"
7958
	    echo "*** or is declared to -dlopen it."
7959
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7960
	    if test "$allow_undefined" = no; then
7961
	      echo
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7962
	      echo "*** Since this library must not contain undefined symbols,"
7963
	      echo "*** because either the platform does not support them or"
7964
	      echo "*** it was explicitly requested with -no-undefined,"
7965
	      echo "*** libtool will only create a static version of it."
7966
	      if test "$build_old_libs" = no; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7967
		oldlibs="$output_objdir/$libname.$libext"
7968
		build_libtool_libs=module
7969
		build_old_libs=yes
7970
	      else
7971
		build_libtool_libs=no
7972
	      fi
7973
	    fi
7974
	  fi
7975
	fi
7976
	# Done checking deplibs!
7977
	deplibs=$newdeplibs
7978
      fi
7979
      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7980
      case $host in
7981
	*-*-darwin*)
7982
	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
7983
	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7984
	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7985
	  ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7986
      esac
7987
7988
      # move library search paths that coincide with paths to not yet
7989
      # installed libraries to the beginning of the library search list
7990
      new_libs=
7991
      for path in $notinst_path; do
7992
	case " $new_libs " in
7993
	*" -L$path/$objdir "*) ;;
7994
	*)
7995
	  case " $deplibs " in
7996
	  *" -L$path/$objdir "*)
7997
	    func_append new_libs " -L$path/$objdir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
7998
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
7999
	  ;;
8000
	esac
8001
      done
8002
      for deplib in $deplibs; do
8003
	case $deplib in
8004
	-L*)
8005
	  case " $new_libs " in
8006
	  *" $deplib "*) ;;
8007
	  *) func_append new_libs " $deplib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8008
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8009
	  ;;
8010
	*) func_append new_libs " $deplib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8011
	esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8012
      done
8013
      deplibs="$new_libs"
8014
8015
      # All the library-specific variables (install_libdir is set above).
8016
      library_names=
8017
      old_library=
8018
      dlname=
8019
8020
      # Test again, we may have decided not to build it any more
8021
      if test "$build_libtool_libs" = yes; then
8022
	if test "$hardcode_into_libs" = yes; then
8023
	  # Hardcode the library paths
8024
	  hardcode_libdirs=
8025
	  dep_rpath=
8026
	  rpath="$finalize_rpath"
8027
	  test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8028
	  for libdir in $rpath; do
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8029
	    if test -n "$hardcode_libdir_flag_spec"; then
8030
	      if test -n "$hardcode_libdir_separator"; then
8031
		func_replace_sysroot "$libdir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8032
		libdir=$func_replace_sysroot_result
8033
		if test -z "$hardcode_libdirs"; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8034
		  hardcode_libdirs="$libdir"
8035
		else
8036
		  # Just accumulate the unique libdirs.
8037
		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8038
		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8039
		    ;;
8040
		  *)
8041
		    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8042
		    ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8043
		  esac
8044
		fi
8045
	      else
8046
		eval flag=\"$hardcode_libdir_flag_spec\"
8047
		func_append dep_rpath " $flag"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8048
	      fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8049
	    elif test -n "$runpath_var"; then
8050
	      case "$perm_rpath " in
8051
	      *" $libdir "*) ;;
8052
	      *) func_apped perm_rpath " $libdir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8053
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8054
	    fi
8055
	  done
8056
	  # Substitute the hardcoded libdirs into the rpath.
8057
	  if test -n "$hardcode_libdir_separator" &&
8058
	     test -n "$hardcode_libdirs"; then
8059
	    libdir="$hardcode_libdirs"
8060
	    if test -n "$hardcode_libdir_flag_spec_ld"; then
8061
	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
8062
	    else
8063
	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
8064
	    fi
8065
	  fi
8066
	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
8067
	    # We should set the runpath_var.
8068
	    rpath=
8069
	    for dir in $perm_rpath; do
8070
	      func_append rpath "$dir:"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8071
	    done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8072
	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
8073
	  fi
8074
	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
8075
	fi
8076
8077
	shlibpath="$finalize_shlibpath"
8078
	test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8079
	if test -n "$shlibpath"; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8080
	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
8081
	fi
8082
8083
	# Get the real and link names of the library.
8084
	eval shared_ext=\"$shrext_cmds\"
8085
	eval library_names=\"$library_names_spec\"
8086
	set dummy $library_names
8087
	shift
8088
	realname="$1"
8089
	shift
8090
8091
	if test -n "$soname_spec"; then
8092
	  eval soname=\"$soname_spec\"
8093
	else
8094
	  soname="$realname"
8095
	fi
8096
	if test -z "$dlname"; then
8097
	  dlname=$soname
8098
	fi
8099
8100
	lib="$output_objdir/$realname"
8101
	linknames=
8102
	for link
8103
	do
8104
	  func_append linknames " $link"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8105
	done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8106
8107
	# Use standard objects if they are pic
8108
	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8109
	test "X$libobjs" = "X " && libobjs=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8110
8111
	delfiles=
8112
	if test -n "$export_symbols" && test -n "$include_expsyms"; then
8113
	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
8114
	  export_symbols="$output_objdir/$libname.uexp"
8115
	  func_append delfiles " $export_symbols"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8116
	fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8117
8118
	orig_export_symbols=
8119
	case $host_os in
8120
	cygwin* | mingw* | cegcc*)
8121
	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
8122
	    # exporting using user supplied symfile
8123
	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
8124
	      # and it's NOT already a .def file. Must figure out
8125
	      # which of the given symbols are data symbols and tag
8126
	      # them as such. So, trigger use of export_symbols_cmds.
8127
	      # export_symbols gets reassigned inside the "prepare
8128
	      # the list of exported symbols" if statement, so the
8129
	      # include_expsyms logic still works.
8130
	      orig_export_symbols="$export_symbols"
8131
	      export_symbols=
8132
	      always_export_symbols=yes
8133
	    fi
8134
	  fi
8135
	  ;;
8136
	esac
8137
8138
	# Prepare the list of exported symbols
8139
	if test -z "$export_symbols"; then
8140
	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
8141
	    func_verbose "generating symbol list for \`$libname.la'"
8142
	    export_symbols="$output_objdir/$libname.exp"
8143
	    $opt_dry_run || $RM $export_symbols
8144
	    cmds=$export_symbols_cmds
8145
	    save_ifs="$IFS"; IFS='~'
8146
	    for cmd1 in $cmds; do
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8147
	      IFS="$save_ifs"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8148
	      # Take the normal branch if the nm_file_list_spec branch
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8149
	      # doesn't work or if tool conversion is not needed.
8150
	      case $nm_file_list_spec~$to_tool_file_cmd in
8151
		*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
8152
		  try_normal_branch=yes
8153
		  eval cmd=\"$cmd1\"
8154
		  func_len " $cmd"
8155
		  len=$func_len_result
8156
		  ;;
8157
		*)
8158
		  try_normal_branch=no
8159
		  ;;
8160
	      esac
8161
	      if test "$try_normal_branch" = yes \
8162
		 && { test "$len" -lt "$max_cmd_len" \
8163
		      || test "$max_cmd_len" -le -1; }
8164
	      then
8165
		func_show_eval "$cmd" 'exit $?'
8166
		skipped_export=false
8167
	      elif test -n "$nm_file_list_spec"; then
8168
		func_basename "$output"
8169
		output_la=$func_basename_result
8170
		save_libobjs=$libobjs
8171
		save_output=$output
8172
		output=${output_objdir}/${output_la}.nm
8173
		func_to_tool_file "$output"
8174
		libobjs=$nm_file_list_spec$func_to_tool_file_result
8175
		func_append delfiles " $output"
8176
		func_verbose "creating $NM input file list: $output"
8177
		for obj in $save_libobjs; do
8178
		  func_to_tool_file "$obj"
8179
		  $ECHO "$func_to_tool_file_result"
8180
		done > "$output"
8181
		eval cmd=\"$cmd1\"
8182
		func_show_eval "$cmd" 'exit $?'
8183
		output=$save_output
8184
		libobjs=$save_libobjs
8185
		skipped_export=false
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8186
	      else
8187
		# The command line is too long to execute in one step.
8188
		func_verbose "using reloadable object file for export list..."
8189
		skipped_export=:
8190
		# Break out early, otherwise skipped_export may be
8191
		# set to false by a later but shorter cmd.
8192
		break
8193
	      fi
8194
	    done
8195
	    IFS="$save_ifs"
8196
	    if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
8197
	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8198
	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8199
	    fi
8200
	  fi
8201
	fi
8202
8203
	if test -n "$export_symbols" && test -n "$include_expsyms"; then
8204
	  tmp_export_symbols="$export_symbols"
8205
	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8206
	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8207
	fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8208
8209
	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
8210
	  # The given exports_symbols file has to be filtered, so filter it.
8211
	  func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8212
	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
8213
	  # 's' commands which not all seds can handle. GNU sed should be fine
8214
	  # though. Also, the filter scales superlinearly with the number of
8215
	  # global variables. join(1) would be nice here, but unfortunately
8216
	  # isn't a blessed tool.
8217
	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8218
	  func_append delfiles " $export_symbols $output_objdir/$libname.filter"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8219
	  export_symbols=$output_objdir/$libname.def
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8220
	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8221
	fi
8222
8223
	tmp_deplibs=
8224
	for test_deplib in $deplibs; do
8225
	  case " $convenience " in
8226
	  *" $test_deplib "*) ;;
8227
	  *)
8228
	    func_append tmp_deplibs " $test_deplib"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8229
	    ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8230
	  esac
8231
	done
8232
	deplibs="$tmp_deplibs"
8233
8234
	if test -n "$convenience"; then
8235
	  if test -n "$whole_archive_flag_spec" &&
8236
	    test "$compiler_needs_object" = yes &&
8237
	    test -z "$libobjs"; then
8238
	    # extract the archives, so we have objects to list.
8239
	    # TODO: could optimize this to just extract one archive.
8240
	    whole_archive_flag_spec=
8241
	  fi
8242
	  if test -n "$whole_archive_flag_spec"; then
8243
	    save_libobjs=$libobjs
8244
	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8245
	    test "X$libobjs" = "X " && libobjs=
8246
	  else
8247
	    gentop="$output_objdir/${outputname}x"
8248
	    func_append generated " $gentop"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8249
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8250
	    func_extract_archives $gentop $convenience
8251
	    func_append libobjs " $func_extract_archives_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8252
	    test "X$libobjs" = "X " && libobjs=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8253
	  fi
8254
	fi
8255
8256
	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
8257
	  eval flag=\"$thread_safe_flag_spec\"
8258
	  func_append linker_flags " $flag"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8259
	fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8260
8261
	# Make a backup of the uninstalled library when relinking
8262
	if test "$opt_mode" = relink; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8263
	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8264
	fi
8265
8266
	# Do each of the archive commands.
8267
	if test "$module" = yes && test -n "$module_cmds" ; then
8268
	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8269
	    eval test_cmds=\"$module_expsym_cmds\"
8270
	    cmds=$module_expsym_cmds
8271
	  else
8272
	    eval test_cmds=\"$module_cmds\"
8273
	    cmds=$module_cmds
8274
	  fi
8275
	else
8276
	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8277
	    eval test_cmds=\"$archive_expsym_cmds\"
8278
	    cmds=$archive_expsym_cmds
8279
	  else
8280
	    eval test_cmds=\"$archive_cmds\"
8281
	    cmds=$archive_cmds
8282
	  fi
8283
	fi
8284
8285
	if test "X$skipped_export" != "X:" &&
8286
	   func_len " $test_cmds" &&
8287
	   len=$func_len_result &&
8288
	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
8289
	  :
8290
	else
8291
	  # The command line is too long to link in one step, link piecewise
8292
	  # or, if using GNU ld and skipped_export is not :, use a linker
8293
	  # script.
8294
8295
	  # Save the value of $output and $libobjs because we want to
8296
	  # use them later.  If we have whole_archive_flag_spec, we
8297
	  # want to use save_libobjs as it was before
8298
	  # whole_archive_flag_spec was expanded, because we can't
8299
	  # assume the linker understands whole_archive_flag_spec.
8300
	  # This may have to be revisited, in case too many
8301
	  # convenience libraries get linked in and end up exceeding
8302
	  # the spec.
8303
	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
8304
	    save_libobjs=$libobjs
8305
	  fi
8306
	  save_output=$output
8307
	  func_basename "$output"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8308
	  output_la=$func_basename_result
8309
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8310
	  # Clear the reloadable object creation command queue and
8311
	  # initialize k to one.
8312
	  test_cmds=
8313
	  concat_cmds=
8314
	  objlist=
8315
	  last_robj=
8316
	  k=1
8317
8318
	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
8319
	    output=${output_objdir}/${output_la}.lnkscript
8320
	    func_verbose "creating GNU ld script: $output"
8321
	    echo 'INPUT (' > $output
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8322
	    for obj in $save_libobjs
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8323
	    do
8324
	      func_to_tool_file "$obj"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8325
	      $ECHO "$func_to_tool_file_result" >> $output
8326
	    done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8327
	    echo ')' >> $output
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8328
	    func_append delfiles " $output"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8329
	    func_to_tool_file "$output"
8330
	    output=$func_to_tool_file_result
8331
	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8332
	    output=${output_objdir}/${output_la}.lnk
8333
	    func_verbose "creating linker input file list: $output"
8334
	    : > $output
8335
	    set x $save_libobjs
8336
	    shift
8337
	    firstobj=
8338
	    if test "$compiler_needs_object" = yes; then
8339
	      firstobj="$1 "
8340
	      shift
8341
	    fi
8342
	    for obj
8343
	    do
8344
	      func_to_tool_file "$obj"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8345
	      $ECHO "$func_to_tool_file_result" >> $output
8346
	    done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8347
	    func_append delfiles " $output"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8348
	    func_to_tool_file "$output"
8349
	    output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
8350
	  else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8351
	    if test -n "$save_libobjs"; then
8352
	      func_verbose "creating reloadable object files..."
8353
	      output=$output_objdir/$output_la-${k}.$objext
8354
	      eval test_cmds=\"$reload_cmds\"
8355
	      func_len " $test_cmds"
8356
	      len0=$func_len_result
8357
	      len=$len0
8358
8359
	      # Loop over the list of objects to be linked.
8360
	      for obj in $save_libobjs
8361
	      do
8362
		func_len " $obj"
8363
		func_arith $len + $func_len_result
8364
		len=$func_arith_result
8365
		if test "X$objlist" = X ||
8366
		   test "$len" -lt "$max_cmd_len"; then
8367
		  func_append objlist " $obj"
8368
		else
8369
		  # The command $test_cmds is almost too long, add a
8370
		  # command to the queue.
8371
		  if test "$k" -eq 1 ; then
8372
		    # The first file doesn't have a previous command to add.
8373
		    reload_objs=$objlist
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8374
		    eval concat_cmds=\"$reload_cmds\"
8375
		  else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8376
		    # All subsequent reloadable object files will link in
8377
		    # the last one created.
8378
		    reload_objs="$objlist $last_robj"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8379
		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
8380
		  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8381
		  last_robj=$output_objdir/$output_la-${k}.$objext
8382
		  func_arith $k + 1
8383
		  k=$func_arith_result
8384
		  output=$output_objdir/$output_la-${k}.$objext
8385
		  objlist=" $obj"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8386
		  func_len " $last_robj"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8387
		  func_arith $len0 + $func_len_result
8388
		  len=$func_arith_result
8389
		fi
8390
	      done
8391
	      # Handle the remaining objects by creating one last
8392
	      # reloadable object file.  All subsequent reloadable object
8393
	      # files will link in the last one created.
8394
	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8395
	      reload_objs="$objlist $last_robj"
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8396
	      eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
8397
	      if test -n "$last_robj"; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8398
	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
8399
	      fi
8400
	      func_append delfiles " $output"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8401
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8402
	    else
8403
	      output=
8404
	    fi
8405
8406
	    if ${skipped_export-false}; then
8407
	      func_verbose "generating symbol list for \`$libname.la'"
8408
	      export_symbols="$output_objdir/$libname.exp"
8409
	      $opt_dry_run || $RM $export_symbols
8410
	      libobjs=$output
8411
	      # Append the command to create the export file.
8412
	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8413
	      eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
8414
	      if test -n "$last_robj"; then
8415
		eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
8416
	      fi
8417
	    fi
8418
8419
	    test -n "$save_libobjs" &&
8420
	      func_verbose "creating a temporary reloadable object file: $output"
8421
8422
	    # Loop through the commands generated above and execute them.
8423
	    save_ifs="$IFS"; IFS='~'
8424
	    for cmd in $concat_cmds; do
8425
	      IFS="$save_ifs"
8426
	      $opt_silent || {
8427
		  func_quote_for_expand "$cmd"
8428
		  eval "func_echo $func_quote_for_expand_result"
8429
	      }
8430
	      $opt_dry_run || eval "$cmd" || {
8431
		lt_exit=$?
8432
8433
		# Restore the uninstalled library and exit
8434
		if test "$opt_mode" = relink; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8435
		  ( cd "$output_objdir" && \
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8436
		    $RM "${realname}T" && \
8437
		    $MV "${realname}U" "$realname" )
8438
		fi
8439
8440
		exit $lt_exit
8441
	      }
8442
	    done
8443
	    IFS="$save_ifs"
8444
8445
	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
8446
	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
8447
	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
8448
	    fi
8449
	  fi
8450
8451
          if ${skipped_export-false}; then
8452
	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
8453
	      tmp_export_symbols="$export_symbols"
8454
	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
8455
	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8456
	    fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8457
8458
	    if test -n "$orig_export_symbols"; then
8459
	      # The given exports_symbols file has to be filtered, so filter it.
8460
	      func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
8461
	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
8462
	      # 's' commands which not all seds can handle. GNU sed should be fine
8463
	      # though. Also, the filter scales superlinearly with the number of
8464
	      # global variables. join(1) would be nice here, but unfortunately
8465
	      # isn't a blessed tool.
8466
	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
8467
	      func_append delfiles " $export_symbols $output_objdir/$libname.filter"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8468
	      export_symbols=$output_objdir/$libname.def
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8469
	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
8470
	    fi
8471
	  fi
8472
8473
	  libobjs=$output
8474
	  # Restore the value of output.
8475
	  output=$save_output
8476
8477
	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
8478
	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
8479
	    test "X$libobjs" = "X " && libobjs=
8480
	  fi
8481
	  # Expand the library linking commands again to reset the
8482
	  # value of $libobjs for piecewise linking.
8483
8484
	  # Do each of the archive commands.
8485
	  if test "$module" = yes && test -n "$module_cmds" ; then
8486
	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
8487
	      cmds=$module_expsym_cmds
8488
	    else
8489
	      cmds=$module_cmds
8490
	    fi
8491
	  else
8492
	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
8493
	      cmds=$archive_expsym_cmds
8494
	    else
8495
	      cmds=$archive_cmds
8496
	    fi
8497
	  fi
8498
	fi
8499
8500
	if test -n "$delfiles"; then
8501
	  # Append the command to remove temporary files to $cmds.
8502
	  eval cmds=\"\$cmds~\$RM $delfiles\"
8503
	fi
8504
8505
	# Add any objects from preloaded convenience libraries
8506
	if test -n "$dlprefiles"; then
8507
	  gentop="$output_objdir/${outputname}x"
8508
	  func_append generated " $gentop"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8509
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8510
	  func_extract_archives $gentop $dlprefiles
8511
	  func_append libobjs " $func_extract_archives_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8512
	  test "X$libobjs" = "X " && libobjs=
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8513
	fi
8514
8515
	save_ifs="$IFS"; IFS='~'
8516
	for cmd in $cmds; do
8517
	  IFS="$save_ifs"
8518
	  eval cmd=\"$cmd\"
8519
	  $opt_silent || {
8520
	    func_quote_for_expand "$cmd"
8521
	    eval "func_echo $func_quote_for_expand_result"
8522
	  }
8523
	  $opt_dry_run || eval "$cmd" || {
8524
	    lt_exit=$?
8525
8526
	    # Restore the uninstalled library and exit
8527
	    if test "$opt_mode" = relink; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8528
	      ( cd "$output_objdir" && \
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8529
	        $RM "${realname}T" && \
8530
		$MV "${realname}U" "$realname" )
8531
	    fi
8532
8533
	    exit $lt_exit
8534
	  }
8535
	done
8536
	IFS="$save_ifs"
8537
8538
	# Restore the uninstalled library and exit
8539
	if test "$opt_mode" = relink; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8540
	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8541
8542
	  if test -n "$convenience"; then
8543
	    if test -z "$whole_archive_flag_spec"; then
8544
	      func_show_eval '${RM}r "$gentop"'
8545
	    fi
8546
	  fi
8547
8548
	  exit $EXIT_SUCCESS
8549
	fi
8550
8551
	# Create links to the real library.
8552
	for linkname in $linknames; do
8553
	  if test "$realname" != "$linkname"; then
8554
	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
8555
	  fi
8556
	done
8557
8558
	# If -module or -export-dynamic was specified, set the dlname.
8559
	if test "$module" = yes || test "$export_dynamic" = yes; then
8560
	  # On all known operating systems, these are identical.
8561
	  dlname="$soname"
8562
	fi
8563
      fi
8564
      ;;
8565
8566
    obj)
8567
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
8568
	func_warning "\`-dlopen' is ignored for objects"
8569
      fi
8570
8571
      case " $deplibs" in
8572
      *\ -l* | *\ -L*)
8573
	func_warning "\`-l' and \`-L' are ignored for objects" ;;
8574
      esac
8575
8576
      test -n "$rpath" && \
8577
	func_warning "\`-rpath' is ignored for objects"
8578
8579
      test -n "$xrpath" && \
8580
	func_warning "\`-R' is ignored for objects"
8581
8582
      test -n "$vinfo" && \
8583
	func_warning "\`-version-info' is ignored for objects"
8584
8585
      test -n "$release" && \
8586
	func_warning "\`-release' is ignored for objects"
8587
8588
      case $output in
8589
      *.lo)
8590
	test -n "$objs$old_deplibs" && \
8591
	  func_fatal_error "cannot build library object \`$output' from non-libtool objects"
8592
8593
	libobj=$output
8594
	func_lo2o "$libobj"
8595
	obj=$func_lo2o_result
8596
	;;
8597
      *)
8598
	libobj=
8599
	obj="$output"
8600
	;;
8601
      esac
8602
8603
      # Delete the old objects.
8604
      $opt_dry_run || $RM $obj $libobj
8605
8606
      # Objects from convenience libraries.  This assumes
8607
      # single-version convenience libraries.  Whenever we create
8608
      # different ones for PIC/non-PIC, this we'll have to duplicate
8609
      # the extraction.
8610
      reload_conv_objs=
8611
      gentop=
8612
      # reload_cmds runs $LD directly, so let us get rid of
8613
      # -Wl from whole_archive_flag_spec and hope we can get by with
8614
      # turning comma into space..
8615
      wl=
8616
8617
      if test -n "$convenience"; then
8618
	if test -n "$whole_archive_flag_spec"; then
8619
	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
8620
	  reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8621
	else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8622
	  gentop="$output_objdir/${obj}x"
8623
	  func_append generated " $gentop"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8624
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8625
	  func_extract_archives $gentop $convenience
8626
	  reload_conv_objs="$reload_objs $func_extract_archives_result"
8627
	fi
8628
      fi
8629
8630
      # If we're not building shared, we need to use non_pic_objs
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8631
      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
8632
8633
      # Create the old-style object.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8634
      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8635
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8636
      output="$obj"
8637
      func_execute_cmds "$reload_cmds" 'exit $?'
8638
8639
      # Exit if we aren't doing a library object file.
8640
      if test -z "$libobj"; then
8641
	if test -n "$gentop"; then
8642
	  func_show_eval '${RM}r "$gentop"'
8643
	fi
8644
8645
	exit $EXIT_SUCCESS
8646
      fi
8647
8648
      if test "$build_libtool_libs" != yes; then
8649
	if test -n "$gentop"; then
8650
	  func_show_eval '${RM}r "$gentop"'
8651
	fi
8652
8653
	# Create an invalid libtool object if no PIC, so that we don't
8654
	# accidentally link it into a program.
8655
	# $show "echo timestamp > $libobj"
8656
	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
8657
	exit $EXIT_SUCCESS
8658
      fi
8659
8660
      if test -n "$pic_flag" || test "$pic_mode" != default; then
8661
	# Only do commands if we really have different PIC objects.
8662
	reload_objs="$libobjs $reload_conv_objs"
8663
	output="$libobj"
8664
	func_execute_cmds "$reload_cmds" 'exit $?'
8665
      fi
8666
8667
      if test -n "$gentop"; then
8668
	func_show_eval '${RM}r "$gentop"'
8669
      fi
8670
8671
      exit $EXIT_SUCCESS
8672
      ;;
8673
8674
    prog)
8675
      case $host in
8676
	*cygwin*) func_stripname '' '.exe' "$output"
8677
	          output=$func_stripname_result.exe;;
8678
      esac
8679
      test -n "$vinfo" && \
8680
	func_warning "\`-version-info' is ignored for programs"
8681
8682
      test -n "$release" && \
8683
	func_warning "\`-release' is ignored for programs"
8684
8685
      test "$preload" = yes \
8686
        && test "$dlopen_support" = unknown \
8687
	&& test "$dlopen_self" = unknown \
8688
	&& test "$dlopen_self_static" = unknown && \
8689
	  func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
8690
8691
      case $host in
8692
      *-*-rhapsody* | *-*-darwin1.[012])
8693
	# On Rhapsody replace the C library is the System framework
8694
	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8695
	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
8696
	;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8697
      esac
8698
8699
      case $host in
8700
      *-*-darwin*)
8701
	# Don't allow lazy linking, it breaks C++ global constructors
8702
	# But is supposedly fixed on 10.4 or later (yay!).
8703
	if test "$tagname" = CXX ; then
8704
	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
8705
	    10.[0123])
8706
	      func_append compile_command " ${wl}-bind_at_load"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8707
	      func_append finalize_command " ${wl}-bind_at_load"
8708
	    ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8709
	  esac
8710
	fi
8711
	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
8712
	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8713
	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8714
	;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8715
      esac
8716
8717
8718
      # move library search paths that coincide with paths to not yet
8719
      # installed libraries to the beginning of the library search list
8720
      new_libs=
8721
      for path in $notinst_path; do
8722
	case " $new_libs " in
8723
	*" -L$path/$objdir "*) ;;
8724
	*)
8725
	  case " $compile_deplibs " in
8726
	  *" -L$path/$objdir "*)
8727
	    func_append new_libs " -L$path/$objdir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8728
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8729
	  ;;
8730
	esac
8731
      done
8732
      for deplib in $compile_deplibs; do
8733
	case $deplib in
8734
	-L*)
8735
	  case " $new_libs " in
8736
	  *" $deplib "*) ;;
8737
	  *) func_append new_libs " $deplib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8738
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8739
	  ;;
8740
	*) func_append new_libs " $deplib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8741
	esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8742
      done
8743
      compile_deplibs="$new_libs"
8744
8745
8746
      func_append compile_command " $compile_deplibs"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8747
      func_append finalize_command " $finalize_deplibs"
8748
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8749
      if test -n "$rpath$xrpath"; then
8750
	# If the user specified any rpath flags, then add them.
8751
	for libdir in $rpath $xrpath; do
8752
	  # This is the magic to use -rpath.
8753
	  case "$finalize_rpath " in
8754
	  *" $libdir "*) ;;
8755
	  *) func_append finalize_rpath " $libdir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8756
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8757
	done
8758
      fi
8759
8760
      # Now hardcode the library paths
8761
      rpath=
8762
      hardcode_libdirs=
8763
      for libdir in $compile_rpath $finalize_rpath; do
8764
	if test -n "$hardcode_libdir_flag_spec"; then
8765
	  if test -n "$hardcode_libdir_separator"; then
8766
	    if test -z "$hardcode_libdirs"; then
8767
	      hardcode_libdirs="$libdir"
8768
	    else
8769
	      # Just accumulate the unique libdirs.
8770
	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8771
	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8772
		;;
8773
	      *)
8774
		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8775
		;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8776
	      esac
8777
	    fi
8778
	  else
8779
	    eval flag=\"$hardcode_libdir_flag_spec\"
8780
	    func_append rpath " $flag"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8781
	  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8782
	elif test -n "$runpath_var"; then
8783
	  case "$perm_rpath " in
8784
	  *" $libdir "*) ;;
8785
	  *) func_append perm_rpath " $libdir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8786
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8787
	fi
8788
	case $host in
8789
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
8790
	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
8791
	  case :$dllsearchpath: in
8792
	  *":$libdir:"*) ;;
8793
	  ::) dllsearchpath=$libdir;;
8794
	  *) func_append dllsearchpath ":$libdir";;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8795
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8796
	  case :$dllsearchpath: in
8797
	  *":$testbindir:"*) ;;
8798
	  ::) dllsearchpath=$testbindir;;
8799
	  *) func_append dllsearchpath ":$testbindir";;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8800
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8801
	  ;;
8802
	esac
8803
      done
8804
      # Substitute the hardcoded libdirs into the rpath.
8805
      if test -n "$hardcode_libdir_separator" &&
8806
	 test -n "$hardcode_libdirs"; then
8807
	libdir="$hardcode_libdirs"
8808
	eval rpath=\" $hardcode_libdir_flag_spec\"
8809
      fi
8810
      compile_rpath="$rpath"
8811
8812
      rpath=
8813
      hardcode_libdirs=
8814
      for libdir in $finalize_rpath; do
8815
	if test -n "$hardcode_libdir_flag_spec"; then
8816
	  if test -n "$hardcode_libdir_separator"; then
8817
	    if test -z "$hardcode_libdirs"; then
8818
	      hardcode_libdirs="$libdir"
8819
	    else
8820
	      # Just accumulate the unique libdirs.
8821
	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
8822
	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
8823
		;;
8824
	      *)
8825
		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8826
		;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8827
	      esac
8828
	    fi
8829
	  else
8830
	    eval flag=\"$hardcode_libdir_flag_spec\"
8831
	    func_append rpath " $flag"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8832
	  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8833
	elif test -n "$runpath_var"; then
8834
	  case "$finalize_perm_rpath " in
8835
	  *" $libdir "*) ;;
8836
	  *) func_append finalize_perm_rpath " $libdir" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8837
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8838
	fi
8839
      done
8840
      # Substitute the hardcoded libdirs into the rpath.
8841
      if test -n "$hardcode_libdir_separator" &&
8842
	 test -n "$hardcode_libdirs"; then
8843
	libdir="$hardcode_libdirs"
8844
	eval rpath=\" $hardcode_libdir_flag_spec\"
8845
      fi
8846
      finalize_rpath="$rpath"
8847
8848
      if test -n "$libobjs" && test "$build_old_libs" = yes; then
8849
	# Transform all the library objects into standard objects.
8850
	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8851
	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
8852
      fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8853
8854
      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
8855
8856
      # template prelinking step
8857
      if test -n "$prelink_cmds"; then
8858
	func_execute_cmds "$prelink_cmds" 'exit $?'
8859
      fi
8860
8861
      wrappers_required=yes
8862
      case $host in
8863
      *cegcc* | *mingw32ce*)
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8864
        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
8865
        wrappers_required=no
8866
        ;;
8867
      *cygwin* | *mingw* )
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8868
        if test "$build_libtool_libs" != yes; then
8869
          wrappers_required=no
8870
        fi
8871
        ;;
8872
      *)
8873
        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
8874
          wrappers_required=no
8875
        fi
8876
        ;;
8877
      esac
8878
      if test "$wrappers_required" = no; then
8879
	# Replace the output file specification.
8880
	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8881
	link_command="$compile_command$compile_rpath"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8882
8883
	# We have no uninstalled library dependencies, so finalize right now.
8884
	exit_status=0
8885
	func_show_eval "$link_command" 'exit_status=$?'
8886
8887
	if test -n "$postlink_cmds"; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8888
	  func_to_tool_file "$output"
8889
	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8890
	  func_execute_cmds "$postlink_cmds" 'exit $?'
8891
	fi
8892
8893
	# Delete the generated files.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8894
	if test -f "$output_objdir/${outputname}S.${objext}"; then
8895
	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
8896
	fi
8897
8898
	exit $exit_status
8899
      fi
8900
8901
      if test -n "$compile_shlibpath$finalize_shlibpath"; then
8902
	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
8903
      fi
8904
      if test -n "$finalize_shlibpath"; then
8905
	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
8906
      fi
8907
8908
      compile_var=
8909
      finalize_var=
8910
      if test -n "$runpath_var"; then
8911
	if test -n "$perm_rpath"; then
8912
	  # We should set the runpath_var.
8913
	  rpath=
8914
	  for dir in $perm_rpath; do
8915
	    func_append rpath "$dir:"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8916
	  done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8917
	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
8918
	fi
8919
	if test -n "$finalize_perm_rpath"; then
8920
	  # We should set the runpath_var.
8921
	  rpath=
8922
	  for dir in $finalize_perm_rpath; do
8923
	    func_append rpath "$dir:"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8924
	  done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8925
	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
8926
	fi
8927
      fi
8928
8929
      if test "$no_install" = yes; then
8930
	# We don't need to create a wrapper script.
8931
	link_command="$compile_var$compile_command$compile_rpath"
8932
	# Replace the output file specification.
8933
	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8934
	# Delete the old output file.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8935
	$opt_dry_run || $RM $output
8936
	# Link the executable and exit
8937
	func_show_eval "$link_command" 'exit $?'
8938
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8939
	if test -n "$postlink_cmds"; then
8940
	  func_to_tool_file "$output"
8941
	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
8942
	  func_execute_cmds "$postlink_cmds" 'exit $?'
8943
	fi
8944
8945
	exit $EXIT_SUCCESS
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8946
      fi
8947
8948
      if test "$hardcode_action" = relink; then
8949
	# Fast installation is not supported
8950
	link_command="$compile_var$compile_command$compile_rpath"
8951
	relink_command="$finalize_var$finalize_command$finalize_rpath"
8952
8953
	func_warning "this platform does not like uninstalled shared libraries"
8954
	func_warning "\`$output' will be relinked during installation"
8955
      else
8956
	if test "$fast_install" != no; then
8957
	  link_command="$finalize_var$compile_command$finalize_rpath"
8958
	  if test "$fast_install" = yes; then
8959
	    relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8960
	  else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8961
	    # fast_install is set to needless
8962
	    relink_command=
8963
	  fi
8964
	else
8965
	  link_command="$compile_var$compile_command$compile_rpath"
8966
	  relink_command="$finalize_var$finalize_command$finalize_rpath"
8967
	fi
8968
      fi
8969
8970
      # Replace the output file specification.
8971
      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
8972
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8973
      # Delete the old output files.
8974
      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
8975
8976
      func_show_eval "$link_command" 'exit $?'
8977
8978
      if test -n "$postlink_cmds"; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
8979
	func_to_tool_file "$output_objdir/$outputname"
8980
	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'`
8981
	func_execute_cmds "$postlink_cmds" 'exit $?'
8982
      fi
8983
8984
      # Now create the wrapper script.
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
8985
      func_verbose "creating $output"
8986
8987
      # Quote the relink command for shipping.
8988
      if test -n "$relink_command"; then
8989
	# Preserve any variables that may affect compiler behavior
8990
	for var in $variables_saved_for_relink; do
8991
	  if eval test -z \"\${$var+set}\"; then
8992
	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
8993
	  elif eval var_value=\$$var; test -z "$var_value"; then
8994
	    relink_command="$var=; export $var; $relink_command"
8995
	  else
8996
	    func_quote_for_eval "$var_value"
8997
	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
8998
	  fi
8999
	done
9000
	relink_command="(cd `pwd`; $relink_command)"
9001
	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
9002
      fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9003
9004
      # Only actually do things if not in dry run mode.
9005
      $opt_dry_run || {
9006
	# win32 will think the script is a binary if it has
9007
	# a .exe suffix, so we strip it off here.
9008
	case $output in
9009
	  *.exe) func_stripname '' '.exe' "$output"
9010
	         output=$func_stripname_result ;;
9011
	esac
9012
	# test for cygwin because mv fails w/o .exe extensions
9013
	case $host in
9014
	  *cygwin*)
9015
	    exeext=.exe
9016
	    func_stripname '' '.exe' "$outputname"
9017
	    outputname=$func_stripname_result ;;
9018
	  *) exeext= ;;
9019
	esac
9020
	case $host in
9021
	  *cygwin* | *mingw* )
9022
	    func_dirname_and_basename "$output" "" "."
9023
	    output_name=$func_basename_result
9024
	    output_path=$func_dirname_result
9025
	    cwrappersource="$output_path/$objdir/lt-$output_name.c"
9026
	    cwrapper="$output_path/$output_name.exe"
9027
	    $RM $cwrappersource $cwrapper
9028
	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
9029
9030
	    func_emit_cwrapperexe_src > $cwrappersource
9031
9032
	    # The wrapper executable is built using the $host compiler,
9033
	    # because it contains $host paths and files. If cross-
9034
	    # compiling, it, like the target executable, must be
9035
	    # executed on the $host or under an emulation environment.
9036
	    $opt_dry_run || {
9037
	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
9038
	      $STRIP $cwrapper
9039
	    }
9040
9041
	    # Now, create the wrapper script for func_source use:
9042
	    func_ltwrapper_scriptname $cwrapper
9043
	    $RM $func_ltwrapper_scriptname_result
9044
	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
9045
	    $opt_dry_run || {
9046
	      # note: this script will not be executed, so do not chmod.
9047
	      if test "x$build" = "x$host" ; then
9048
		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
9049
	      else
9050
		func_emit_wrapper no > $func_ltwrapper_scriptname_result
9051
	      fi
9052
	    }
9053
	  ;;
9054
	  * )
9055
	    $RM $output
9056
	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
9057
9058
	    func_emit_wrapper no > $output
9059
	    chmod +x $output
9060
	  ;;
9061
	esac
9062
      }
9063
      exit $EXIT_SUCCESS
9064
      ;;
9065
    esac
9066
9067
    # See if we need to build an old-fashioned archive.
9068
    for oldlib in $oldlibs; do
9069
9070
      if test "$build_libtool_libs" = convenience; then
9071
	oldobjs="$libobjs_save $symfileobj"
9072
	addlibs="$convenience"
9073
	build_libtool_libs=no
9074
      else
9075
	if test "$build_libtool_libs" = module; then
9076
	  oldobjs="$libobjs_save"
9077
	  build_libtool_libs=no
9078
	else
9079
	  oldobjs="$old_deplibs $non_pic_objects"
9080
	  if test "$preload" = yes && test -f "$symfileobj"; then
9081
	    func_append oldobjs " $symfileobj"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9082
	  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9083
	fi
9084
	addlibs="$old_convenience"
9085
      fi
9086
9087
      if test -n "$addlibs"; then
9088
	gentop="$output_objdir/${outputname}x"
9089
	func_append generated " $gentop"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9090
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9091
	func_extract_archives $gentop $addlibs
9092
	func_append oldobjs " $func_extract_archives_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9093
      fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9094
9095
      # Do each command in the archive commands.
9096
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
9097
	cmds=$old_archive_from_new_cmds
9098
      else
9099
9100
	# Add any objects from preloaded convenience libraries
9101
	if test -n "$dlprefiles"; then
9102
	  gentop="$output_objdir/${outputname}x"
9103
	  func_append generated " $gentop"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9104
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9105
	  func_extract_archives $gentop $dlprefiles
9106
	  func_append oldobjs " $func_extract_archives_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9107
	fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9108
9109
	# POSIX demands no paths to be encoded in archives.  We have
9110
	# to avoid creating archives with duplicate basenames if we
9111
	# might have to extract them afterwards, e.g., when creating a
9112
	# static archive out of a convenience library, or when linking
9113
	# the entirety of a libtool archive into another (currently
9114
	# not supported by libtool).
9115
	if (for obj in $oldobjs
9116
	    do
9117
	      func_basename "$obj"
9118
	      $ECHO "$func_basename_result"
9119
	    done | sort | sort -uc >/dev/null 2>&1); then
9120
	  :
9121
	else
9122
	  echo "copying selected object files to avoid basename conflicts..."
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
9123
	  gentop="$output_objdir/${outputname}x"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9124
	  func_append generated " $gentop"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9125
	  func_mkdir_p "$gentop"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9126
	  save_oldobjs=$oldobjs
9127
	  oldobjs=
9128
	  counter=1
9129
	  for obj in $save_oldobjs
9130
	  do
9131
	    func_basename "$obj"
9132
	    objbase="$func_basename_result"
9133
	    case " $oldobjs " in
9134
	    " ") oldobjs=$obj ;;
9135
	    *[\ /]"$objbase "*)
9136
	      while :; do
9137
		# Make sure we don't pick an alternate name that also
9138
		# overlaps.
9139
		newobj=lt$counter-$objbase
9140
		func_arith $counter + 1
9141
		counter=$func_arith_result
9142
		case " $oldobjs " in
9143
		*[\ /]"$newobj "*) ;;
9144
		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
9145
		esac
9146
	      done
9147
	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
9148
	      func_append oldobjs " $gentop/$newobj"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9149
	      ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9150
	    *) func_append oldobjs " $obj" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9151
	    esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9152
	  done
9153
	fi
9154
	eval cmds=\"$old_archive_cmds\"
9155
9156
	func_len " $cmds"
9157
	len=$func_len_result
9158
	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9159
	  cmds=$old_archive_cmds
9160
	elif test -n "$archiver_list_spec"; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9161
	  func_verbose "using command file archive linking..."
9162
	  for obj in $oldobjs
9163
	  do
9164
	    func_to_tool_file "$obj"
9165
	    $ECHO "$func_to_tool_file_result"
9166
	  done > $output_objdir/$libname.libcmd
9167
	  func_to_tool_file "$output_objdir/$libname.libcmd"
9168
	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
9169
	  cmds=$old_archive_cmds
9170
	else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9171
	  # the command line is too long to link in one step, link in parts
9172
	  func_verbose "using piecewise archive linking..."
9173
	  save_RANLIB=$RANLIB
9174
	  RANLIB=:
9175
	  objlist=
9176
	  concat_cmds=
9177
	  save_oldobjs=$oldobjs
9178
	  oldobjs=
9179
	  # Is there a better way of finding the last object in the list?
9180
	  for obj in $save_oldobjs
9181
	  do
9182
	    last_oldobj=$obj
9183
	  done
9184
	  eval test_cmds=\"$old_archive_cmds\"
9185
	  func_len " $test_cmds"
9186
	  len0=$func_len_result
9187
	  len=$len0
9188
	  for obj in $save_oldobjs
9189
	  do
9190
	    func_len " $obj"
9191
	    func_arith $len + $func_len_result
9192
	    len=$func_arith_result
9193
	    func_append objlist " $obj"
9194
	    if test "$len" -lt "$max_cmd_len"; then
9195
	      :
9196
	    else
9197
	      # the above command should be used before it gets too long
9198
	      oldobjs=$objlist
9199
	      if test "$obj" = "$last_oldobj" ; then
9200
		RANLIB=$save_RANLIB
9201
	      fi
9202
	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9203
	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
9204
	      objlist=
9205
	      len=$len0
9206
	    fi
9207
	  done
9208
	  RANLIB=$save_RANLIB
9209
	  oldobjs=$objlist
9210
	  if test "X$oldobjs" = "X" ; then
9211
	    eval cmds=\"\$concat_cmds\"
9212
	  else
9213
	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
9214
	  fi
9215
	fi
9216
      fi
9217
      func_execute_cmds "$cmds" 'exit $?'
9218
    done
9219
9220
    test -n "$generated" && \
9221
      func_show_eval "${RM}r$generated"
9222
9223
    # Now create the libtool archive.
9224
    case $output in
9225
    *.la)
9226
      old_library=
9227
      test "$build_old_libs" = yes && old_library="$libname.$libext"
9228
      func_verbose "creating $output"
9229
9230
      # Preserve any variables that may affect compiler behavior
9231
      for var in $variables_saved_for_relink; do
9232
	if eval test -z \"\${$var+set}\"; then
9233
	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
9234
	elif eval var_value=\$$var; test -z "$var_value"; then
9235
	  relink_command="$var=; export $var; $relink_command"
9236
	else
9237
	  func_quote_for_eval "$var_value"
9238
	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
9239
	fi
9240
      done
9241
      # Quote the link command for shipping.
9242
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
9243
      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
9244
      if test "$hardcode_automatic" = yes ; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9245
	relink_command=
9246
      fi
9247
9248
      # Only create the output if not a dry run.
9249
      $opt_dry_run || {
9250
	for installed in no yes; do
9251
	  if test "$installed" = yes; then
9252
	    if test -z "$install_libdir"; then
9253
	      break
9254
	    fi
9255
	    output="$output_objdir/$outputname"i
9256
	    # Replace all uninstalled libtool libraries with the installed ones
9257
	    newdependency_libs=
9258
	    for deplib in $dependency_libs; do
9259
	      case $deplib in
9260
	      *.la)
9261
		func_basename "$deplib"
9262
		name="$func_basename_result"
9263
		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
9264
		test -z "$libdir" && \
9265
		  func_fatal_error "\`$deplib' is not a valid libtool archive"
9266
		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9267
		;;
9268
	      -L*)
9269
		func_stripname -L '' "$deplib"
9270
		func_replace_sysroot "$func_stripname_result"
9271
		func_append newdependency_libs " -L$func_replace_sysroot_result"
9272
		;;
9273
	      -R*)
9274
		func_stripname -R '' "$deplib"
9275
		func_replace_sysroot "$func_stripname_result"
9276
		func_append newdependency_libs " -R$func_replace_sysroot_result"
9277
		;;
9278
	      *) func_append newdependency_libs " $deplib" ;;
9279
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9280
	    done
9281
	    dependency_libs="$newdependency_libs"
9282
	    newdlfiles=
9283
9284
	    for lib in $dlfiles; do
9285
	      case $lib in
9286
	      *.la)
9287
	        func_basename "$lib"
9288
		name="$func_basename_result"
9289
		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9290
		test -z "$libdir" && \
9291
		  func_fatal_error "\`$lib' is not a valid libtool archive"
9292
		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9293
		;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9294
	      *) func_append newdlfiles " $lib" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9295
	      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9296
	    done
9297
	    dlfiles="$newdlfiles"
9298
	    newdlprefiles=
9299
	    for lib in $dlprefiles; do
9300
	      case $lib in
9301
	      *.la)
9302
		# Only pass preopened files to the pseudo-archive (for
9303
		# eventual linking with the app. that links it) if we
9304
		# didn't already link the preopened objects directly into
9305
		# the library:
9306
		func_basename "$lib"
9307
		name="$func_basename_result"
9308
		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
9309
		test -z "$libdir" && \
9310
		  func_fatal_error "\`$lib' is not a valid libtool archive"
9311
		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9312
		;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9313
	      esac
9314
	    done
9315
	    dlprefiles="$newdlprefiles"
9316
	  else
9317
	    newdlfiles=
9318
	    for lib in $dlfiles; do
9319
	      case $lib in
9320
		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9321
		*) abs=`pwd`"/$lib" ;;
9322
	      esac
9323
	      func_append newdlfiles " $abs"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9324
	    done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9325
	    dlfiles="$newdlfiles"
9326
	    newdlprefiles=
9327
	    for lib in $dlprefiles; do
9328
	      case $lib in
9329
		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
9330
		*) abs=`pwd`"/$lib" ;;
9331
	      esac
9332
	      func_append newdlprefiles " $abs"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9333
	    done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9334
	    dlprefiles="$newdlprefiles"
9335
	  fi
9336
	  $RM $output
9337
	  # place dlname in correct position for cygwin
9338
	  # In fact, it would be nice if we could use this code for all target
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
9339
	  # systems that can't hard-code library paths into their executables
9340
	  # and that have no shared library path variable independent of PATH,
9341
	  # but it turns out we can't easily determine that from inspecting
9342
	  # libtool variables, so we have to hard-code the OSs to which it
9343
	  # applies here; at the moment, that means platforms that use the PE
9344
	  # object format with DLL files.  See the long comment at the top of
9345
	  # tests/bindir.at for full details.
9346
	  tdlname=$dlname
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9347
	  case $host,$output,$installed,$module,$dlname in
9348
	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
2.3.5 by Lionel Le Folgoc
Import upstream version 1.0.1
9349
	      # If a -bindir argument was supplied, place the dll there.
9350
	      if test "x$bindir" != x ;
9351
	      then
9352
		func_relative_path "$install_libdir" "$bindir"
9353
		tdlname=$func_relative_path_result$dlname
9354
	      else
9355
		# Otherwise fall back on heuristic.
9356
		tdlname=../bin/$dlname
9357
	      fi
9358
	      ;;
9359
	  esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9360
	  $ECHO > $output "\
9361
# $outputname - a libtool library file
9362
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
9363
#
9364
# Please DO NOT delete this file!
9365
# It is necessary for linking the library.
9366
9367
# The name that we can dlopen(3).
9368
dlname='$tdlname'
9369
9370
# Names of this library.
9371
library_names='$library_names'
9372
9373
# The name of the static archive.
9374
old_library='$old_library'
9375
9376
# Linker flags that can not go in dependency_libs.
9377
inherited_linker_flags='$new_inherited_linker_flags'
9378
9379
# Libraries that this one depends upon.
9380
dependency_libs='$dependency_libs'
9381
9382
# Names of additional weak libraries provided by this library
9383
weak_library_names='$weak_libs'
9384
9385
# Version information for $libname.
9386
current=$current
9387
age=$age
9388
revision=$revision
9389
9390
# Is this an already installed library?
9391
installed=$installed
9392
9393
# Should we warn about portability when linking against -modules?
9394
shouldnotlink=$module
9395
9396
# Files to dlopen/dlpreopen
9397
dlopen='$dlfiles'
9398
dlpreopen='$dlprefiles'
9399
9400
# Directory that this library needs to be installed in:
9401
libdir='$install_libdir'"
9402
	  if test "$installed" = no && test "$need_relink" = yes; then
9403
	    $ECHO >> $output "\
9404
relink_command=\"$relink_command\""
9405
	  fi
9406
	done
9407
      }
9408
9409
      # Do a symbolic link so that the libtool archive can be found in
9410
      # LD_LIBRARY_PATH before the program is installed.
9411
      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
9412
      ;;
9413
    esac
9414
    exit $EXIT_SUCCESS
9415
}
9416
9417
{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9418
    func_mode_link ${1+"$@"}
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9419
9420
9421
# func_mode_uninstall arg...
9422
func_mode_uninstall ()
9423
{
9424
    $opt_debug
9425
    RM="$nonopt"
9426
    files=
9427
    rmforce=
9428
    exit_status=0
9429
9430
    # This variable tells wrapper scripts just to set variables rather
9431
    # than running their programs.
9432
    libtool_install_magic="$magic"
9433
9434
    for arg
9435
    do
9436
      case $arg in
9437
      -f) func_append RM " $arg"; rmforce=yes ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9438
      -*) func_append RM " $arg" ;;
9439
      *) func_append files " $arg" ;;
9440
      esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9441
    done
9442
9443
    test -z "$RM" && \
9444
      func_fatal_help "you must specify an RM program"
9445
9446
    rmdirs=
9447
9448
    for file in $files; do
9449
      func_dirname "$file" "" "."
9450
      dir="$func_dirname_result"
9451
      if test "X$dir" = X.; then
9452
	odir="$objdir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9453
      else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9454
	odir="$dir/$objdir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9455
      fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9456
      func_basename "$file"
9457
      name="$func_basename_result"
9458
      test "$opt_mode" = uninstall && odir="$dir"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9459
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9460
      # Remember odir for removal later, being careful to avoid duplicates
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9461
      if test "$opt_mode" = clean; then
9462
	case " $rmdirs " in
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9463
	  *" $odir "*) ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9464
	  *) func_append rmdirs " $odir" ;;
9465
	esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9466
      fi
9467
9468
      # Don't error if the file doesn't exist and rm -f was used.
9469
      if { test -L "$file"; } >/dev/null 2>&1 ||
9470
	 { test -h "$file"; } >/dev/null 2>&1 ||
9471
	 test -f "$file"; then
9472
	:
9473
      elif test -d "$file"; then
9474
	exit_status=1
9475
	continue
9476
      elif test "$rmforce" = yes; then
9477
	continue
9478
      fi
9479
9480
      rmfiles="$file"
9481
9482
      case $name in
9483
      *.la)
9484
	# Possibly a libtool archive, so verify it.
9485
	if func_lalib_p "$file"; then
9486
	  func_source $dir/$name
9487
9488
	  # Delete the libtool libraries and symlinks.
9489
	  for n in $library_names; do
9490
	    func_append rmfiles " $odir/$n"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9491
	  done
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9492
	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9493
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9494
	  case "$opt_mode" in
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9495
	  clean)
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9496
	    case " $library_names " in
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9497
	    *" $dlname "*) ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9498
	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9499
	    esac
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9500
	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9501
	    ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9502
	  uninstall)
9503
	    if test -n "$library_names"; then
9504
	      # Do each command in the postuninstall commands.
9505
	      func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9506
	    fi
9507
9508
	    if test -n "$old_library"; then
9509
	      # Do each command in the old_postuninstall commands.
9510
	      func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
9511
	    fi
9512
	    # FIXME: should reinstall the best remaining shared library.
9513
	    ;;
9514
	  esac
9515
	fi
9516
	;;
9517
9518
      *.lo)
9519
	# Possibly a libtool object, so verify it.
9520
	if func_lalib_p "$file"; then
9521
9522
	  # Read the .lo file
9523
	  func_source $dir/$name
9524
9525
	  # Add PIC object to the list of files to remove.
9526
	  if test -n "$pic_object" &&
9527
	     test "$pic_object" != none; then
9528
	    func_append rmfiles " $dir/$pic_object"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9529
	  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9530
9531
	  # Add non-PIC object to the list of files to remove.
9532
	  if test -n "$non_pic_object" &&
9533
	     test "$non_pic_object" != none; then
9534
	    func_append rmfiles " $dir/$non_pic_object"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9535
	  fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9536
	fi
9537
	;;
9538
9539
      *)
9540
	if test "$opt_mode" = clean ; then
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9541
	  noexename=$name
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9542
	  case $file in
9543
	  *.exe)
9544
	    func_stripname '' '.exe' "$file"
9545
	    file=$func_stripname_result
9546
	    func_stripname '' '.exe' "$name"
9547
	    noexename=$func_stripname_result
9548
	    # $file with .exe has already been added to rmfiles,
9549
	    # add $file without .exe
9550
	    func_append rmfiles " $file"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9551
	    ;;
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9552
	  esac
9553
	  # Do a test to see if this is a libtool program.
9554
	  if func_ltwrapper_p "$file"; then
9555
	    if func_ltwrapper_executable_p "$file"; then
9556
	      func_ltwrapper_scriptname "$file"
9557
	      relink_command=
9558
	      func_source $func_ltwrapper_scriptname_result
9559
	      func_append rmfiles " $func_ltwrapper_scriptname_result"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9560
	    else
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9561
	      relink_command=
9562
	      func_source $dir/$noexename
9563
	    fi
9564
9565
	    # note $name still contains .exe if it was in $file originally
9566
	    # as does the version of $file that was added into $rmfiles
9567
	    func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9568
	    if test "$fast_install" = yes && test -n "$relink_command"; then
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9569
	      func_append rmfiles " $odir/lt-$name"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9570
	    fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9571
	    if test "X$noexename" != "X$name" ; then
9572
	      func_append rmfiles " $odir/lt-${noexename}.c"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9573
	    fi
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9574
	  fi
9575
	fi
9576
	;;
9577
      esac
9578
      func_show_eval "$RM $rmfiles" 'exit_status=1'
9579
    done
9580
9581
    # Try to remove the ${objdir}s in the directories where we deleted files
9582
    for dir in $rmdirs; do
9583
      if test -d "$dir"; then
9584
	func_show_eval "rmdir $dir >/dev/null 2>&1"
9585
      fi
9586
    done
9587
9588
    exit $exit_status
9589
}
9590
9591
{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9592
    func_mode_uninstall ${1+"$@"}
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9593
9594
test -z "$opt_mode" && {
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9595
  help="$generic_help"
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9596
  func_fatal_help "you must specify a MODE"
9597
}
9598
9599
test -z "$exec_cmd" && \
9600
  func_fatal_help "invalid operation mode \`$opt_mode'"
2.3.6 by Lionel Le Folgoc
Import upstream version 1.0.3
9601
2.1.1 by Yves-Alexis Perez
Import upstream version 0.8.0~rc2
9602
if test -n "$exec_cmd"; then
9603
  eval exec "$exec_cmd"
9604
  exit $EXIT_FAILURE
9605
fi
9606
9607
exit $exit_status
9608
9609
9610
# The TAGs below are defined such that we never get into a situation
9611
# in which we disable both kinds of libraries.  Given conflicting
9612
# choices, we go for a static library, that is the most portable,
9613
# since we can't tell whether shared libraries were disabled because
9614
# the user asked for that or because the platform doesn't support
9615
# them.  This is particularly important on AIX, because we don't
9616
# support having both static and shared libraries enabled at the same
9617
# time on that platform, so we default to a shared-only configuration.
9618
# If a disable-shared tag is given, we'll fallback to a static-only
9619
# configuration.  But we'll never go from static-only to shared-only.
9620
9621
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
9622
build_libtool_libs=no
9623
build_old_libs=yes
9624
# ### END LIBTOOL TAG CONFIG: disable-shared
9625
9626
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
9627
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
9628
# ### END LIBTOOL TAG CONFIG: disable-static
9629
9630
# Local Variables:
9631
# mode:shell-script
9632
# sh-indentation:2
9633
# End:
9634
# vi:sw=2
9635
9636