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