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