OSDN Git Service

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