~ubuntu-branches/ubuntu/trusty/openvpn/trusty

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