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