Subversion Repositories svnkaklik

Rev

Go to most recent revision | Details | Last modification | View Log

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