Debian Codegraph @

libtool

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