Debian Codegraph @

libtool

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