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