adam@0
|
1 # Generated from ltmain.m4sh.
|
adam@0
|
2
|
adam@0
|
3 # ltmain.sh (GNU libtool) 2.2.6b
|
adam@0
|
4 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
adam@0
|
5
|
adam@0
|
6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
|
adam@0
|
7 # This is free software; see the source for copying conditions. There is NO
|
adam@0
|
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
adam@0
|
9
|
adam@0
|
10 # GNU Libtool is free software; you can redistribute it and/or modify
|
adam@0
|
11 # it under the terms of the GNU General Public License as published by
|
adam@0
|
12 # the Free Software Foundation; either version 2 of the License, or
|
adam@0
|
13 # (at your option) any later version.
|
adam@0
|
14 #
|
adam@0
|
15 # As a special exception to the GNU General Public License,
|
adam@0
|
16 # if you distribute this file as part of a program or library that
|
adam@0
|
17 # is built using GNU Libtool, you may include this file under the
|
adam@0
|
18 # same distribution terms that you use for the rest of that program.
|
adam@0
|
19 #
|
adam@0
|
20 # GNU Libtool is distributed in the hope that it will be useful, but
|
adam@0
|
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
|
adam@0
|
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
adam@0
|
23 # General Public License for more details.
|
adam@0
|
24 #
|
adam@0
|
25 # You should have received a copy of the GNU General Public License
|
adam@0
|
26 # along with GNU Libtool; see the file COPYING. If not, a copy
|
adam@0
|
27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
|
adam@0
|
28 # or obtained by writing to the Free Software Foundation, Inc.,
|
adam@0
|
29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
adam@0
|
30
|
adam@0
|
31 # Usage: $progname [OPTION]... [MODE-ARG]...
|
adam@0
|
32 #
|
adam@0
|
33 # Provide generalized library-building support services.
|
adam@0
|
34 #
|
adam@0
|
35 # --config show all configuration variables
|
adam@0
|
36 # --debug enable verbose shell tracing
|
adam@0
|
37 # -n, --dry-run display commands without modifying any files
|
adam@0
|
38 # --features display basic configuration information and exit
|
adam@0
|
39 # --mode=MODE use operation mode MODE
|
adam@0
|
40 # --preserve-dup-deps don't remove duplicate dependency libraries
|
adam@0
|
41 # --quiet, --silent don't print informational messages
|
adam@0
|
42 # --tag=TAG use configuration variables from tag TAG
|
adam@0
|
43 # -v, --verbose print informational messages (default)
|
adam@0
|
44 # --version print version information
|
adam@0
|
45 # -h, --help print short or long help message
|
adam@0
|
46 #
|
adam@0
|
47 # MODE must be one of the following:
|
adam@0
|
48 #
|
adam@0
|
49 # clean remove files from the build directory
|
adam@0
|
50 # compile compile a source file into a libtool object
|
adam@0
|
51 # execute automatically set library path, then run a program
|
adam@0
|
52 # finish complete the installation of libtool libraries
|
adam@0
|
53 # install install libraries or executables
|
adam@0
|
54 # link create a library or an executable
|
adam@0
|
55 # uninstall remove libraries from an installed directory
|
adam@0
|
56 #
|
adam@0
|
57 # MODE-ARGS vary depending on the MODE.
|
adam@0
|
58 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
|
adam@0
|
59 #
|
adam@0
|
60 # When reporting a bug, please describe a test case to reproduce it and
|
adam@0
|
61 # include the following information:
|
adam@0
|
62 #
|
adam@0
|
63 # host-triplet: $host
|
adam@0
|
64 # shell: $SHELL
|
adam@0
|
65 # compiler: $LTCC
|
adam@0
|
66 # compiler flags: $LTCFLAGS
|
adam@0
|
67 # linker: $LD (gnu? $with_gnu_ld)
|
adam@0
|
68 # $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2
|
adam@0
|
69 # automake: $automake_version
|
adam@0
|
70 # autoconf: $autoconf_version
|
adam@0
|
71 #
|
adam@0
|
72 # Report bugs to <bug-libtool@gnu.org>.
|
adam@0
|
73
|
adam@0
|
74 PROGRAM=ltmain.sh
|
adam@0
|
75 PACKAGE=libtool
|
adam@0
|
76 VERSION="2.2.6b Debian-2.2.6b-2"
|
adam@0
|
77 TIMESTAMP=""
|
adam@0
|
78 package_revision=1.3017
|
adam@0
|
79
|
adam@0
|
80 # Be Bourne compatible
|
adam@0
|
81 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
adam@0
|
82 emulate sh
|
adam@0
|
83 NULLCMD=:
|
adam@0
|
84 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
|
adam@0
|
85 # is contrary to our usage. Disable this feature.
|
adam@0
|
86 alias -g '${1+"$@"}'='"$@"'
|
adam@0
|
87 setopt NO_GLOB_SUBST
|
adam@0
|
88 else
|
adam@0
|
89 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
|
adam@0
|
90 fi
|
adam@0
|
91 BIN_SH=xpg4; export BIN_SH # for Tru64
|
adam@0
|
92 DUALCASE=1; export DUALCASE # for MKS sh
|
adam@0
|
93
|
adam@0
|
94 # NLS nuisances: We save the old values to restore during execute mode.
|
adam@0
|
95 # Only set LANG and LC_ALL to C if already set.
|
adam@0
|
96 # These must not be set unconditionally because not all systems understand
|
adam@0
|
97 # e.g. LANG=C (notably SCO).
|
adam@0
|
98 lt_user_locale=
|
adam@0
|
99 lt_safe_locale=
|
adam@0
|
100 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
adam@0
|
101 do
|
adam@0
|
102 eval "if test \"\${$lt_var+set}\" = set; then
|
adam@0
|
103 save_$lt_var=\$$lt_var
|
adam@0
|
104 $lt_var=C
|
adam@0
|
105 export $lt_var
|
adam@0
|
106 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
|
adam@0
|
107 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
|
adam@0
|
108 fi"
|
adam@0
|
109 done
|
adam@0
|
110
|
adam@0
|
111 $lt_unset CDPATH
|
adam@0
|
112
|
adam@0
|
113
|
adam@0
|
114
|
adam@0
|
115
|
adam@0
|
116
|
adam@0
|
117 : ${CP="cp -f"}
|
adam@0
|
118 : ${ECHO="echo"}
|
adam@0
|
119 : ${EGREP="/bin/grep -E"}
|
adam@0
|
120 : ${FGREP="/bin/grep -F"}
|
adam@0
|
121 : ${GREP="/bin/grep"}
|
adam@0
|
122 : ${LN_S="ln -s"}
|
adam@0
|
123 : ${MAKE="make"}
|
adam@0
|
124 : ${MKDIR="mkdir"}
|
adam@0
|
125 : ${MV="mv -f"}
|
adam@0
|
126 : ${RM="rm -f"}
|
adam@0
|
127 : ${SED="/bin/sed"}
|
adam@0
|
128 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
|
adam@0
|
129 : ${Xsed="$SED -e 1s/^X//"}
|
adam@0
|
130
|
adam@0
|
131 # Global variables:
|
adam@0
|
132 EXIT_SUCCESS=0
|
adam@0
|
133 EXIT_FAILURE=1
|
adam@0
|
134 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
|
adam@0
|
135 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
|
adam@0
|
136
|
adam@0
|
137 exit_status=$EXIT_SUCCESS
|
adam@0
|
138
|
adam@0
|
139 # Make sure IFS has a sensible default
|
adam@0
|
140 lt_nl='
|
adam@0
|
141 '
|
adam@0
|
142 IFS=" $lt_nl"
|
adam@0
|
143
|
adam@0
|
144 dirname="s,/[^/]*$,,"
|
adam@0
|
145 basename="s,^.*/,,"
|
adam@0
|
146
|
adam@0
|
147 # func_dirname_and_basename file append nondir_replacement
|
adam@0
|
148 # perform func_basename and func_dirname in a single function
|
adam@0
|
149 # call:
|
adam@0
|
150 # dirname: Compute the dirname of FILE. If nonempty,
|
adam@0
|
151 # add APPEND to the result, otherwise set result
|
adam@0
|
152 # to NONDIR_REPLACEMENT.
|
adam@0
|
153 # value returned in "$func_dirname_result"
|
adam@0
|
154 # basename: Compute filename of FILE.
|
adam@0
|
155 # value retuned in "$func_basename_result"
|
adam@0
|
156 # Implementation must be kept synchronized with func_dirname
|
adam@0
|
157 # and func_basename. For efficiency, we do not delegate to
|
adam@0
|
158 # those functions but instead duplicate the functionality here.
|
adam@0
|
159 func_dirname_and_basename ()
|
adam@0
|
160 {
|
adam@0
|
161 # Extract subdirectory from the argument.
|
adam@0
|
162 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
|
adam@0
|
163 if test "X$func_dirname_result" = "X${1}"; then
|
adam@0
|
164 func_dirname_result="${3}"
|
adam@0
|
165 else
|
adam@0
|
166 func_dirname_result="$func_dirname_result${2}"
|
adam@0
|
167 fi
|
adam@0
|
168 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
|
adam@0
|
169 }
|
adam@0
|
170
|
adam@0
|
171 # Generated shell functions inserted here.
|
adam@0
|
172
|
adam@0
|
173 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
|
adam@0
|
174 # is ksh but when the shell is invoked as "sh" and the current value of
|
adam@0
|
175 # the _XPG environment variable is not equal to 1 (one), the special
|
adam@0
|
176 # positional parameter $0, within a function call, is the name of the
|
adam@0
|
177 # function.
|
adam@0
|
178 progpath="$0"
|
adam@0
|
179
|
adam@0
|
180 # The name of this program:
|
adam@0
|
181 # In the unlikely event $progname began with a '-', it would play havoc with
|
adam@0
|
182 # func_echo (imagine progname=-n), so we prepend ./ in that case:
|
adam@0
|
183 func_dirname_and_basename "$progpath"
|
adam@0
|
184 progname=$func_basename_result
|
adam@0
|
185 case $progname in
|
adam@0
|
186 -*) progname=./$progname ;;
|
adam@0
|
187 esac
|
adam@0
|
188
|
adam@0
|
189 # Make sure we have an absolute path for reexecution:
|
adam@0
|
190 case $progpath in
|
adam@0
|
191 [\\/]*|[A-Za-z]:\\*) ;;
|
adam@0
|
192 *[\\/]*)
|
adam@0
|
193 progdir=$func_dirname_result
|
adam@0
|
194 progdir=`cd "$progdir" && pwd`
|
adam@0
|
195 progpath="$progdir/$progname"
|
adam@0
|
196 ;;
|
adam@0
|
197 *)
|
adam@0
|
198 save_IFS="$IFS"
|
adam@0
|
199 IFS=:
|
adam@0
|
200 for progdir in $PATH; do
|
adam@0
|
201 IFS="$save_IFS"
|
adam@0
|
202 test -x "$progdir/$progname" && break
|
adam@0
|
203 done
|
adam@0
|
204 IFS="$save_IFS"
|
adam@0
|
205 test -n "$progdir" || progdir=`pwd`
|
adam@0
|
206 progpath="$progdir/$progname"
|
adam@0
|
207 ;;
|
adam@0
|
208 esac
|
adam@0
|
209
|
adam@0
|
210 # Sed substitution that helps us do robust quoting. It backslashifies
|
adam@0
|
211 # metacharacters that are still active within double-quoted strings.
|
adam@0
|
212 Xsed="${SED}"' -e 1s/^X//'
|
adam@0
|
213 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
|
adam@0
|
214
|
adam@0
|
215 # Same as above, but do not quote variable references.
|
adam@0
|
216 double_quote_subst='s/\(["`\\]\)/\\\1/g'
|
adam@0
|
217
|
adam@0
|
218 # Re-`\' parameter expansions in output of double_quote_subst that were
|
adam@0
|
219 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
|
adam@0
|
220 # in input to double_quote_subst, that '$' was protected from expansion.
|
adam@0
|
221 # Since each input `\' is now two `\'s, look for any number of runs of
|
adam@0
|
222 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
|
adam@0
|
223 bs='\\'
|
adam@0
|
224 bs2='\\\\'
|
adam@0
|
225 bs4='\\\\\\\\'
|
adam@0
|
226 dollar='\$'
|
adam@0
|
227 sed_double_backslash="\
|
adam@0
|
228 s/$bs4/&\\
|
adam@0
|
229 /g
|
adam@0
|
230 s/^$bs2$dollar/$bs&/
|
adam@0
|
231 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
|
adam@0
|
232 s/\n//g"
|
adam@0
|
233
|
adam@0
|
234 # Standard options:
|
adam@0
|
235 opt_dry_run=false
|
adam@0
|
236 opt_help=false
|
adam@0
|
237 opt_quiet=false
|
adam@0
|
238 opt_verbose=false
|
adam@0
|
239 opt_warning=:
|
adam@0
|
240
|
adam@0
|
241 # func_echo arg...
|
adam@0
|
242 # Echo program name prefixed message, along with the current mode
|
adam@0
|
243 # name if it has been set yet.
|
adam@0
|
244 func_echo ()
|
adam@0
|
245 {
|
adam@0
|
246 $ECHO "$progname${mode+: }$mode: $*"
|
adam@0
|
247 }
|
adam@0
|
248
|
adam@0
|
249 # func_verbose arg...
|
adam@0
|
250 # Echo program name prefixed message in verbose mode only.
|
adam@0
|
251 func_verbose ()
|
adam@0
|
252 {
|
adam@0
|
253 $opt_verbose && func_echo ${1+"$@"}
|
adam@0
|
254
|
adam@0
|
255 # A bug in bash halts the script if the last line of a function
|
adam@0
|
256 # fails when set -e is in force, so we need another command to
|
adam@0
|
257 # work around that:
|
adam@0
|
258 :
|
adam@0
|
259 }
|
adam@0
|
260
|
adam@0
|
261 # func_error arg...
|
adam@0
|
262 # Echo program name prefixed message to standard error.
|
adam@0
|
263 func_error ()
|
adam@0
|
264 {
|
adam@0
|
265 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
|
adam@0
|
266 }
|
adam@0
|
267
|
adam@0
|
268 # func_warning arg...
|
adam@0
|
269 # Echo program name prefixed warning message to standard error.
|
adam@0
|
270 func_warning ()
|
adam@0
|
271 {
|
adam@0
|
272 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
|
adam@0
|
273
|
adam@0
|
274 # bash bug again:
|
adam@0
|
275 :
|
adam@0
|
276 }
|
adam@0
|
277
|
adam@0
|
278 # func_fatal_error arg...
|
adam@0
|
279 # Echo program name prefixed message to standard error, and exit.
|
adam@0
|
280 func_fatal_error ()
|
adam@0
|
281 {
|
adam@0
|
282 func_error ${1+"$@"}
|
adam@0
|
283 exit $EXIT_FAILURE
|
adam@0
|
284 }
|
adam@0
|
285
|
adam@0
|
286 # func_fatal_help arg...
|
adam@0
|
287 # Echo program name prefixed message to standard error, followed by
|
adam@0
|
288 # a help hint, and exit.
|
adam@0
|
289 func_fatal_help ()
|
adam@0
|
290 {
|
adam@0
|
291 func_error ${1+"$@"}
|
adam@0
|
292 func_fatal_error "$help"
|
adam@0
|
293 }
|
adam@0
|
294 help="Try \`$progname --help' for more information." ## default
|
adam@0
|
295
|
adam@0
|
296
|
adam@0
|
297 # func_grep expression filename
|
adam@0
|
298 # Check whether EXPRESSION matches any line of FILENAME, without output.
|
adam@0
|
299 func_grep ()
|
adam@0
|
300 {
|
adam@0
|
301 $GREP "$1" "$2" >/dev/null 2>&1
|
adam@0
|
302 }
|
adam@0
|
303
|
adam@0
|
304
|
adam@0
|
305 # func_mkdir_p directory-path
|
adam@0
|
306 # Make sure the entire path to DIRECTORY-PATH is available.
|
adam@0
|
307 func_mkdir_p ()
|
adam@0
|
308 {
|
adam@0
|
309 my_directory_path="$1"
|
adam@0
|
310 my_dir_list=
|
adam@0
|
311
|
adam@0
|
312 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
|
adam@0
|
313
|
adam@0
|
314 # Protect directory names starting with `-'
|
adam@0
|
315 case $my_directory_path in
|
adam@0
|
316 -*) my_directory_path="./$my_directory_path" ;;
|
adam@0
|
317 esac
|
adam@0
|
318
|
adam@0
|
319 # While some portion of DIR does not yet exist...
|
adam@0
|
320 while test ! -d "$my_directory_path"; do
|
adam@0
|
321 # ...make a list in topmost first order. Use a colon delimited
|
adam@0
|
322 # list incase some portion of path contains whitespace.
|
adam@0
|
323 my_dir_list="$my_directory_path:$my_dir_list"
|
adam@0
|
324
|
adam@0
|
325 # If the last portion added has no slash in it, the list is done
|
adam@0
|
326 case $my_directory_path in */*) ;; *) break ;; esac
|
adam@0
|
327
|
adam@0
|
328 # ...otherwise throw away the child directory and loop
|
adam@0
|
329 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
|
adam@0
|
330 done
|
adam@0
|
331 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
|
adam@0
|
332
|
adam@0
|
333 save_mkdir_p_IFS="$IFS"; IFS=':'
|
adam@0
|
334 for my_dir in $my_dir_list; do
|
adam@0
|
335 IFS="$save_mkdir_p_IFS"
|
adam@0
|
336 # mkdir can fail with a `File exist' error if two processes
|
adam@0
|
337 # try to create one of the directories concurrently. Don't
|
adam@0
|
338 # stop in that case!
|
adam@0
|
339 $MKDIR "$my_dir" 2>/dev/null || :
|
adam@0
|
340 done
|
adam@0
|
341 IFS="$save_mkdir_p_IFS"
|
adam@0
|
342
|
adam@0
|
343 # Bail out if we (or some other process) failed to create a directory.
|
adam@0
|
344 test -d "$my_directory_path" || \
|
adam@0
|
345 func_fatal_error "Failed to create \`$1'"
|
adam@0
|
346 fi
|
adam@0
|
347 }
|
adam@0
|
348
|
adam@0
|
349
|
adam@0
|
350 # func_mktempdir [string]
|
adam@0
|
351 # Make a temporary directory that won't clash with other running
|
adam@0
|
352 # libtool processes, and avoids race conditions if possible. If
|
adam@0
|
353 # given, STRING is the basename for that directory.
|
adam@0
|
354 func_mktempdir ()
|
adam@0
|
355 {
|
adam@0
|
356 my_template="${TMPDIR-/tmp}/${1-$progname}"
|
adam@0
|
357
|
adam@0
|
358 if test "$opt_dry_run" = ":"; then
|
adam@0
|
359 # Return a directory name, but don't create it in dry-run mode
|
adam@0
|
360 my_tmpdir="${my_template}-$$"
|
adam@0
|
361 else
|
adam@0
|
362
|
adam@0
|
363 # If mktemp works, use that first and foremost
|
adam@0
|
364 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
|
adam@0
|
365
|
adam@0
|
366 if test ! -d "$my_tmpdir"; then
|
adam@0
|
367 # Failing that, at least try and use $RANDOM to avoid a race
|
adam@0
|
368 my_tmpdir="${my_template}-${RANDOM-0}$$"
|
adam@0
|
369
|
adam@0
|
370 save_mktempdir_umask=`umask`
|
adam@0
|
371 umask 0077
|
adam@0
|
372 $MKDIR "$my_tmpdir"
|
adam@0
|
373 umask $save_mktempdir_umask
|
adam@0
|
374 fi
|
adam@0
|
375
|
adam@0
|
376 # If we're not in dry-run mode, bomb out on failure
|
adam@0
|
377 test -d "$my_tmpdir" || \
|
adam@0
|
378 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
|
adam@0
|
379 fi
|
adam@0
|
380
|
adam@0
|
381 $ECHO "X$my_tmpdir" | $Xsed
|
adam@0
|
382 }
|
adam@0
|
383
|
adam@0
|
384
|
adam@0
|
385 # func_quote_for_eval arg
|
adam@0
|
386 # Aesthetically quote ARG to be evaled later.
|
adam@0
|
387 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
|
adam@0
|
388 # is double-quoted, suitable for a subsequent eval, whereas
|
adam@0
|
389 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
|
adam@0
|
390 # which are still active within double quotes backslashified.
|
adam@0
|
391 func_quote_for_eval ()
|
adam@0
|
392 {
|
adam@0
|
393 case $1 in
|
adam@0
|
394 *[\\\`\"\$]*)
|
adam@0
|
395 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
|
adam@0
|
396 *)
|
adam@0
|
397 func_quote_for_eval_unquoted_result="$1" ;;
|
adam@0
|
398 esac
|
adam@0
|
399
|
adam@0
|
400 case $func_quote_for_eval_unquoted_result in
|
adam@0
|
401 # Double-quote args containing shell metacharacters to delay
|
adam@0
|
402 # word splitting, command substitution and and variable
|
adam@0
|
403 # expansion for a subsequent eval.
|
adam@0
|
404 # Many Bourne shells cannot handle close brackets correctly
|
adam@0
|
405 # in scan sets, so we specify it separately.
|
adam@0
|
406 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
adam@0
|
407 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
|
adam@0
|
408 ;;
|
adam@0
|
409 *)
|
adam@0
|
410 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
|
adam@0
|
411 esac
|
adam@0
|
412 }
|
adam@0
|
413
|
adam@0
|
414
|
adam@0
|
415 # func_quote_for_expand arg
|
adam@0
|
416 # Aesthetically quote ARG to be evaled later; same as above,
|
adam@0
|
417 # but do not quote variable references.
|
adam@0
|
418 func_quote_for_expand ()
|
adam@0
|
419 {
|
adam@0
|
420 case $1 in
|
adam@0
|
421 *[\\\`\"]*)
|
adam@0
|
422 my_arg=`$ECHO "X$1" | $Xsed \
|
adam@0
|
423 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
|
adam@0
|
424 *)
|
adam@0
|
425 my_arg="$1" ;;
|
adam@0
|
426 esac
|
adam@0
|
427
|
adam@0
|
428 case $my_arg in
|
adam@0
|
429 # Double-quote args containing shell metacharacters to delay
|
adam@0
|
430 # word splitting and command substitution for a subsequent eval.
|
adam@0
|
431 # Many Bourne shells cannot handle close brackets correctly
|
adam@0
|
432 # in scan sets, so we specify it separately.
|
adam@0
|
433 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
adam@0
|
434 my_arg="\"$my_arg\""
|
adam@0
|
435 ;;
|
adam@0
|
436 esac
|
adam@0
|
437
|
adam@0
|
438 func_quote_for_expand_result="$my_arg"
|
adam@0
|
439 }
|
adam@0
|
440
|
adam@0
|
441
|
adam@0
|
442 # func_show_eval cmd [fail_exp]
|
adam@0
|
443 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
|
adam@0
|
444 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
|
adam@0
|
445 # is given, then evaluate it.
|
adam@0
|
446 func_show_eval ()
|
adam@0
|
447 {
|
adam@0
|
448 my_cmd="$1"
|
adam@0
|
449 my_fail_exp="${2-:}"
|
adam@0
|
450
|
adam@0
|
451 ${opt_silent-false} || {
|
adam@0
|
452 func_quote_for_expand "$my_cmd"
|
adam@0
|
453 eval "func_echo $func_quote_for_expand_result"
|
adam@0
|
454 }
|
adam@0
|
455
|
adam@0
|
456 if ${opt_dry_run-false}; then :; else
|
adam@0
|
457 eval "$my_cmd"
|
adam@0
|
458 my_status=$?
|
adam@0
|
459 if test "$my_status" -eq 0; then :; else
|
adam@0
|
460 eval "(exit $my_status); $my_fail_exp"
|
adam@0
|
461 fi
|
adam@0
|
462 fi
|
adam@0
|
463 }
|
adam@0
|
464
|
adam@0
|
465
|
adam@0
|
466 # func_show_eval_locale cmd [fail_exp]
|
adam@0
|
467 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
|
adam@0
|
468 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
|
adam@0
|
469 # is given, then evaluate it. Use the saved locale for evaluation.
|
adam@0
|
470 func_show_eval_locale ()
|
adam@0
|
471 {
|
adam@0
|
472 my_cmd="$1"
|
adam@0
|
473 my_fail_exp="${2-:}"
|
adam@0
|
474
|
adam@0
|
475 ${opt_silent-false} || {
|
adam@0
|
476 func_quote_for_expand "$my_cmd"
|
adam@0
|
477 eval "func_echo $func_quote_for_expand_result"
|
adam@0
|
478 }
|
adam@0
|
479
|
adam@0
|
480 if ${opt_dry_run-false}; then :; else
|
adam@0
|
481 eval "$lt_user_locale
|
adam@0
|
482 $my_cmd"
|
adam@0
|
483 my_status=$?
|
adam@0
|
484 eval "$lt_safe_locale"
|
adam@0
|
485 if test "$my_status" -eq 0; then :; else
|
adam@0
|
486 eval "(exit $my_status); $my_fail_exp"
|
adam@0
|
487 fi
|
adam@0
|
488 fi
|
adam@0
|
489 }
|
adam@0
|
490
|
adam@0
|
491
|
adam@0
|
492
|
adam@0
|
493
|
adam@0
|
494
|
adam@0
|
495 # func_version
|
adam@0
|
496 # Echo version message to standard output and exit.
|
adam@0
|
497 func_version ()
|
adam@0
|
498 {
|
adam@0
|
499 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
|
adam@0
|
500 s/^# //
|
adam@0
|
501 s/^# *$//
|
adam@0
|
502 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
|
adam@0
|
503 p
|
adam@0
|
504 }' < "$progpath"
|
adam@0
|
505 exit $?
|
adam@0
|
506 }
|
adam@0
|
507
|
adam@0
|
508 # func_usage
|
adam@0
|
509 # Echo short help message to standard output and exit.
|
adam@0
|
510 func_usage ()
|
adam@0
|
511 {
|
adam@0
|
512 $SED -n '/^# Usage:/,/# -h/ {
|
adam@0
|
513 s/^# //
|
adam@0
|
514 s/^# *$//
|
adam@0
|
515 s/\$progname/'$progname'/
|
adam@0
|
516 p
|
adam@0
|
517 }' < "$progpath"
|
adam@0
|
518 $ECHO
|
adam@0
|
519 $ECHO "run \`$progname --help | more' for full usage"
|
adam@0
|
520 exit $?
|
adam@0
|
521 }
|
adam@0
|
522
|
adam@0
|
523 # func_help
|
adam@0
|
524 # Echo long help message to standard output and exit.
|
adam@0
|
525 func_help ()
|
adam@0
|
526 {
|
adam@0
|
527 $SED -n '/^# Usage:/,/# Report bugs to/ {
|
adam@0
|
528 s/^# //
|
adam@0
|
529 s/^# *$//
|
adam@0
|
530 s*\$progname*'$progname'*
|
adam@0
|
531 s*\$host*'"$host"'*
|
adam@0
|
532 s*\$SHELL*'"$SHELL"'*
|
adam@0
|
533 s*\$LTCC*'"$LTCC"'*
|
adam@0
|
534 s*\$LTCFLAGS*'"$LTCFLAGS"'*
|
adam@0
|
535 s*\$LD*'"$LD"'*
|
adam@0
|
536 s/\$with_gnu_ld/'"$with_gnu_ld"'/
|
adam@0
|
537 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
|
adam@0
|
538 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
|
adam@0
|
539 p
|
adam@0
|
540 }' < "$progpath"
|
adam@0
|
541 exit $?
|
adam@0
|
542 }
|
adam@0
|
543
|
adam@0
|
544 # func_missing_arg argname
|
adam@0
|
545 # Echo program name prefixed message to standard error and set global
|
adam@0
|
546 # exit_cmd.
|
adam@0
|
547 func_missing_arg ()
|
adam@0
|
548 {
|
adam@0
|
549 func_error "missing argument for $1"
|
adam@0
|
550 exit_cmd=exit
|
adam@0
|
551 }
|
adam@0
|
552
|
adam@0
|
553 exit_cmd=:
|
adam@0
|
554
|
adam@0
|
555
|
adam@0
|
556
|
adam@0
|
557
|
adam@0
|
558
|
adam@0
|
559 # Check that we have a working $ECHO.
|
adam@0
|
560 if test "X$1" = X--no-reexec; then
|
adam@0
|
561 # Discard the --no-reexec flag, and continue.
|
adam@0
|
562 shift
|
adam@0
|
563 elif test "X$1" = X--fallback-echo; then
|
adam@0
|
564 # Avoid inline document here, it may be left over
|
adam@0
|
565 :
|
adam@0
|
566 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
|
adam@0
|
567 # Yippee, $ECHO works!
|
adam@0
|
568 :
|
adam@0
|
569 else
|
adam@0
|
570 # Restart under the correct shell, and then maybe $ECHO will work.
|
adam@0
|
571 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
|
adam@0
|
572 fi
|
adam@0
|
573
|
adam@0
|
574 if test "X$1" = X--fallback-echo; then
|
adam@0
|
575 # used as fallback echo
|
adam@0
|
576 shift
|
adam@0
|
577 cat <<EOF
|
adam@0
|
578 $*
|
adam@0
|
579 EOF
|
adam@0
|
580 exit $EXIT_SUCCESS
|
adam@0
|
581 fi
|
adam@0
|
582
|
adam@0
|
583 magic="%%%MAGIC variable%%%"
|
adam@0
|
584 magic_exe="%%%MAGIC EXE variable%%%"
|
adam@0
|
585
|
adam@0
|
586 # Global variables.
|
adam@0
|
587 # $mode is unset
|
adam@0
|
588 nonopt=
|
adam@0
|
589 execute_dlfiles=
|
adam@0
|
590 preserve_args=
|
adam@0
|
591 lo2o="s/\\.lo\$/.${objext}/"
|
adam@0
|
592 o2lo="s/\\.${objext}\$/.lo/"
|
adam@0
|
593 extracted_archives=
|
adam@0
|
594 extracted_serial=0
|
adam@0
|
595
|
adam@0
|
596 opt_dry_run=false
|
adam@0
|
597 opt_duplicate_deps=false
|
adam@0
|
598 opt_silent=false
|
adam@0
|
599 opt_debug=:
|
adam@0
|
600
|
adam@0
|
601 # If this variable is set in any of the actions, the command in it
|
adam@0
|
602 # will be execed at the end. This prevents here-documents from being
|
adam@0
|
603 # left over by shells.
|
adam@0
|
604 exec_cmd=
|
adam@0
|
605
|
adam@0
|
606 # func_fatal_configuration arg...
|
adam@0
|
607 # Echo program name prefixed message to standard error, followed by
|
adam@0
|
608 # a configuration failure hint, and exit.
|
adam@0
|
609 func_fatal_configuration ()
|
adam@0
|
610 {
|
adam@0
|
611 func_error ${1+"$@"}
|
adam@0
|
612 func_error "See the $PACKAGE documentation for more information."
|
adam@0
|
613 func_fatal_error "Fatal configuration error."
|
adam@0
|
614 }
|
adam@0
|
615
|
adam@0
|
616
|
adam@0
|
617 # func_config
|
adam@0
|
618 # Display the configuration for all the tags in this script.
|
adam@0
|
619 func_config ()
|
adam@0
|
620 {
|
adam@0
|
621 re_begincf='^# ### BEGIN LIBTOOL'
|
adam@0
|
622 re_endcf='^# ### END LIBTOOL'
|
adam@0
|
623
|
adam@0
|
624 # Default configuration.
|
adam@0
|
625 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
|
adam@0
|
626
|
adam@0
|
627 # Now print the configurations for the tags.
|
adam@0
|
628 for tagname in $taglist; do
|
adam@0
|
629 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
|
adam@0
|
630 done
|
adam@0
|
631
|
adam@0
|
632 exit $?
|
adam@0
|
633 }
|
adam@0
|
634
|
adam@0
|
635 # func_features
|
adam@0
|
636 # Display the features supported by this script.
|
adam@0
|
637 func_features ()
|
adam@0
|
638 {
|
adam@0
|
639 $ECHO "host: $host"
|
adam@0
|
640 if test "$build_libtool_libs" = yes; then
|
adam@0
|
641 $ECHO "enable shared libraries"
|
adam@0
|
642 else
|
adam@0
|
643 $ECHO "disable shared libraries"
|
adam@0
|
644 fi
|
adam@0
|
645 if test "$build_old_libs" = yes; then
|
adam@0
|
646 $ECHO "enable static libraries"
|
adam@0
|
647 else
|
adam@0
|
648 $ECHO "disable static libraries"
|
adam@0
|
649 fi
|
adam@0
|
650
|
adam@0
|
651 exit $?
|
adam@0
|
652 }
|
adam@0
|
653
|
adam@0
|
654 # func_enable_tag tagname
|
adam@0
|
655 # Verify that TAGNAME is valid, and either flag an error and exit, or
|
adam@0
|
656 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
|
adam@0
|
657 # variable here.
|
adam@0
|
658 func_enable_tag ()
|
adam@0
|
659 {
|
adam@0
|
660 # Global variable:
|
adam@0
|
661 tagname="$1"
|
adam@0
|
662
|
adam@0
|
663 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
|
adam@0
|
664 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
|
adam@0
|
665 sed_extractcf="/$re_begincf/,/$re_endcf/p"
|
adam@0
|
666
|
adam@0
|
667 # Validate tagname.
|
adam@0
|
668 case $tagname in
|
adam@0
|
669 *[!-_A-Za-z0-9,/]*)
|
adam@0
|
670 func_fatal_error "invalid tag name: $tagname"
|
adam@0
|
671 ;;
|
adam@0
|
672 esac
|
adam@0
|
673
|
adam@0
|
674 # Don't test for the "default" C tag, as we know it's
|
adam@0
|
675 # there but not specially marked.
|
adam@0
|
676 case $tagname in
|
adam@0
|
677 CC) ;;
|
adam@0
|
678 *)
|
adam@0
|
679 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
|
adam@0
|
680 taglist="$taglist $tagname"
|
adam@0
|
681
|
adam@0
|
682 # Evaluate the configuration. Be careful to quote the path
|
adam@0
|
683 # and the sed script, to avoid splitting on whitespace, but
|
adam@0
|
684 # also don't use non-portable quotes within backquotes within
|
adam@0
|
685 # quotes we have to do it in 2 steps:
|
adam@0
|
686 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
|
adam@0
|
687 eval "$extractedcf"
|
adam@0
|
688 else
|
adam@0
|
689 func_error "ignoring unknown tag $tagname"
|
adam@0
|
690 fi
|
adam@0
|
691 ;;
|
adam@0
|
692 esac
|
adam@0
|
693 }
|
adam@0
|
694
|
adam@0
|
695 # Parse options once, thoroughly. This comes as soon as possible in
|
adam@0
|
696 # the script to make things like `libtool --version' happen quickly.
|
adam@0
|
697 {
|
adam@0
|
698
|
adam@0
|
699 # Shorthand for --mode=foo, only valid as the first argument
|
adam@0
|
700 case $1 in
|
adam@0
|
701 clean|clea|cle|cl)
|
adam@0
|
702 shift; set dummy --mode clean ${1+"$@"}; shift
|
adam@0
|
703 ;;
|
adam@0
|
704 compile|compil|compi|comp|com|co|c)
|
adam@0
|
705 shift; set dummy --mode compile ${1+"$@"}; shift
|
adam@0
|
706 ;;
|
adam@0
|
707 execute|execut|execu|exec|exe|ex|e)
|
adam@0
|
708 shift; set dummy --mode execute ${1+"$@"}; shift
|
adam@0
|
709 ;;
|
adam@0
|
710 finish|finis|fini|fin|fi|f)
|
adam@0
|
711 shift; set dummy --mode finish ${1+"$@"}; shift
|
adam@0
|
712 ;;
|
adam@0
|
713 install|instal|insta|inst|ins|in|i)
|
adam@0
|
714 shift; set dummy --mode install ${1+"$@"}; shift
|
adam@0
|
715 ;;
|
adam@0
|
716 link|lin|li|l)
|
adam@0
|
717 shift; set dummy --mode link ${1+"$@"}; shift
|
adam@0
|
718 ;;
|
adam@0
|
719 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
|
adam@0
|
720 shift; set dummy --mode uninstall ${1+"$@"}; shift
|
adam@0
|
721 ;;
|
adam@0
|
722 esac
|
adam@0
|
723
|
adam@0
|
724 # Parse non-mode specific arguments:
|
adam@0
|
725 while test "$#" -gt 0; do
|
adam@0
|
726 opt="$1"
|
adam@0
|
727 shift
|
adam@0
|
728
|
adam@0
|
729 case $opt in
|
adam@0
|
730 --config) func_config ;;
|
adam@0
|
731
|
adam@0
|
732 --debug) preserve_args="$preserve_args $opt"
|
adam@0
|
733 func_echo "enabling shell trace mode"
|
adam@0
|
734 opt_debug='set -x'
|
adam@0
|
735 $opt_debug
|
adam@0
|
736 ;;
|
adam@0
|
737
|
adam@0
|
738 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
|
adam@0
|
739 execute_dlfiles="$execute_dlfiles $1"
|
adam@0
|
740 shift
|
adam@0
|
741 ;;
|
adam@0
|
742
|
adam@0
|
743 --dry-run | -n) opt_dry_run=: ;;
|
adam@0
|
744 --features) func_features ;;
|
adam@0
|
745 --finish) mode="finish" ;;
|
adam@0
|
746
|
adam@0
|
747 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
|
adam@0
|
748 case $1 in
|
adam@0
|
749 # Valid mode arguments:
|
adam@0
|
750 clean) ;;
|
adam@0
|
751 compile) ;;
|
adam@0
|
752 execute) ;;
|
adam@0
|
753 finish) ;;
|
adam@0
|
754 install) ;;
|
adam@0
|
755 link) ;;
|
adam@0
|
756 relink) ;;
|
adam@0
|
757 uninstall) ;;
|
adam@0
|
758
|
adam@0
|
759 # Catch anything else as an error
|
adam@0
|
760 *) func_error "invalid argument for $opt"
|
adam@0
|
761 exit_cmd=exit
|
adam@0
|
762 break
|
adam@0
|
763 ;;
|
adam@0
|
764 esac
|
adam@0
|
765
|
adam@0
|
766 mode="$1"
|
adam@0
|
767 shift
|
adam@0
|
768 ;;
|
adam@0
|
769
|
adam@0
|
770 --preserve-dup-deps)
|
adam@0
|
771 opt_duplicate_deps=: ;;
|
adam@0
|
772
|
adam@0
|
773 --quiet|--silent) preserve_args="$preserve_args $opt"
|
adam@0
|
774 opt_silent=:
|
adam@0
|
775 ;;
|
adam@0
|
776
|
adam@0
|
777 --verbose| -v) preserve_args="$preserve_args $opt"
|
adam@0
|
778 opt_silent=false
|
adam@0
|
779 ;;
|
adam@0
|
780
|
adam@0
|
781 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
|
adam@0
|
782 preserve_args="$preserve_args $opt $1"
|
adam@0
|
783 func_enable_tag "$1" # tagname is set here
|
adam@0
|
784 shift
|
adam@0
|
785 ;;
|
adam@0
|
786
|
adam@0
|
787 # Separate optargs to long options:
|
adam@0
|
788 -dlopen=*|--mode=*|--tag=*)
|
adam@0
|
789 func_opt_split "$opt"
|
adam@0
|
790 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
|
adam@0
|
791 shift
|
adam@0
|
792 ;;
|
adam@0
|
793
|
adam@0
|
794 -\?|-h) func_usage ;;
|
adam@0
|
795 --help) opt_help=: ;;
|
adam@0
|
796 --version) func_version ;;
|
adam@0
|
797
|
adam@0
|
798 -*) func_fatal_help "unrecognized option \`$opt'" ;;
|
adam@0
|
799
|
adam@0
|
800 *) nonopt="$opt"
|
adam@0
|
801 break
|
adam@0
|
802 ;;
|
adam@0
|
803 esac
|
adam@0
|
804 done
|
adam@0
|
805
|
adam@0
|
806
|
adam@0
|
807 case $host in
|
adam@0
|
808 *cygwin* | *mingw* | *pw32* | *cegcc*)
|
adam@0
|
809 # don't eliminate duplications in $postdeps and $predeps
|
adam@0
|
810 opt_duplicate_compiler_generated_deps=:
|
adam@0
|
811 ;;
|
adam@0
|
812 *)
|
adam@0
|
813 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
|
adam@0
|
814 ;;
|
adam@0
|
815 esac
|
adam@0
|
816
|
adam@0
|
817 # Having warned about all mis-specified options, bail out if
|
adam@0
|
818 # anything was wrong.
|
adam@0
|
819 $exit_cmd $EXIT_FAILURE
|
adam@0
|
820 }
|
adam@0
|
821
|
adam@0
|
822 # func_check_version_match
|
adam@0
|
823 # Ensure that we are using m4 macros, and libtool script from the same
|
adam@0
|
824 # release of libtool.
|
adam@0
|
825 func_check_version_match ()
|
adam@0
|
826 {
|
adam@0
|
827 if test "$package_revision" != "$macro_revision"; then
|
adam@0
|
828 if test "$VERSION" != "$macro_version"; then
|
adam@0
|
829 if test -z "$macro_version"; then
|
adam@0
|
830 cat >&2 <<_LT_EOF
|
adam@0
|
831 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
|
adam@0
|
832 $progname: definition of this LT_INIT comes from an older release.
|
adam@0
|
833 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
|
adam@0
|
834 $progname: and run autoconf again.
|
adam@0
|
835 _LT_EOF
|
adam@0
|
836 else
|
adam@0
|
837 cat >&2 <<_LT_EOF
|
adam@0
|
838 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
|
adam@0
|
839 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
|
adam@0
|
840 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
|
adam@0
|
841 $progname: and run autoconf again.
|
adam@0
|
842 _LT_EOF
|
adam@0
|
843 fi
|
adam@0
|
844 else
|
adam@0
|
845 cat >&2 <<_LT_EOF
|
adam@0
|
846 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
|
adam@0
|
847 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
|
adam@0
|
848 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
|
adam@0
|
849 $progname: of $PACKAGE $VERSION and run autoconf again.
|
adam@0
|
850 _LT_EOF
|
adam@0
|
851 fi
|
adam@0
|
852
|
adam@0
|
853 exit $EXIT_MISMATCH
|
adam@0
|
854 fi
|
adam@0
|
855 }
|
adam@0
|
856
|
adam@0
|
857
|
adam@0
|
858 ## ----------- ##
|
adam@0
|
859 ## Main. ##
|
adam@0
|
860 ## ----------- ##
|
adam@0
|
861
|
adam@0
|
862 $opt_help || {
|
adam@0
|
863 # Sanity checks first:
|
adam@0
|
864 func_check_version_match
|
adam@0
|
865
|
adam@0
|
866 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
|
adam@0
|
867 func_fatal_configuration "not configured to build any kind of library"
|
adam@0
|
868 fi
|
adam@0
|
869
|
adam@0
|
870 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
|
adam@0
|
871
|
adam@0
|
872
|
adam@0
|
873 # Darwin sucks
|
adam@0
|
874 eval std_shrext=\"$shrext_cmds\"
|
adam@0
|
875
|
adam@0
|
876
|
adam@0
|
877 # Only execute mode is allowed to have -dlopen flags.
|
adam@0
|
878 if test -n "$execute_dlfiles" && test "$mode" != execute; then
|
adam@0
|
879 func_error "unrecognized option \`-dlopen'"
|
adam@0
|
880 $ECHO "$help" 1>&2
|
adam@0
|
881 exit $EXIT_FAILURE
|
adam@0
|
882 fi
|
adam@0
|
883
|
adam@0
|
884 # Change the help message to a mode-specific one.
|
adam@0
|
885 generic_help="$help"
|
adam@0
|
886 help="Try \`$progname --help --mode=$mode' for more information."
|
adam@0
|
887 }
|
adam@0
|
888
|
adam@0
|
889
|
adam@0
|
890 # func_lalib_p file
|
adam@0
|
891 # True iff FILE is a libtool `.la' library or `.lo' object file.
|
adam@0
|
892 # This function is only a basic sanity check; it will hardly flush out
|
adam@0
|
893 # determined imposters.
|
adam@0
|
894 func_lalib_p ()
|
adam@0
|
895 {
|
adam@0
|
896 test -f "$1" &&
|
adam@0
|
897 $SED -e 4q "$1" 2>/dev/null \
|
adam@0
|
898 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
|
adam@0
|
899 }
|
adam@0
|
900
|
adam@0
|
901 # func_lalib_unsafe_p file
|
adam@0
|
902 # True iff FILE is a libtool `.la' library or `.lo' object file.
|
adam@0
|
903 # This function implements the same check as func_lalib_p without
|
adam@0
|
904 # resorting to external programs. To this end, it redirects stdin and
|
adam@0
|
905 # closes it afterwards, without saving the original file descriptor.
|
adam@0
|
906 # As a safety measure, use it only where a negative result would be
|
adam@0
|
907 # fatal anyway. Works if `file' does not exist.
|
adam@0
|
908 func_lalib_unsafe_p ()
|
adam@0
|
909 {
|
adam@0
|
910 lalib_p=no
|
adam@0
|
911 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
|
adam@0
|
912 for lalib_p_l in 1 2 3 4
|
adam@0
|
913 do
|
adam@0
|
914 read lalib_p_line
|
adam@0
|
915 case "$lalib_p_line" in
|
adam@0
|
916 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
|
adam@0
|
917 esac
|
adam@0
|
918 done
|
adam@0
|
919 exec 0<&5 5<&-
|
adam@0
|
920 fi
|
adam@0
|
921 test "$lalib_p" = yes
|
adam@0
|
922 }
|
adam@0
|
923
|
adam@0
|
924 # func_ltwrapper_script_p file
|
adam@0
|
925 # True iff FILE is a libtool wrapper script
|
adam@0
|
926 # This function is only a basic sanity check; it will hardly flush out
|
adam@0
|
927 # determined imposters.
|
adam@0
|
928 func_ltwrapper_script_p ()
|
adam@0
|
929 {
|
adam@0
|
930 func_lalib_p "$1"
|
adam@0
|
931 }
|
adam@0
|
932
|
adam@0
|
933 # func_ltwrapper_executable_p file
|
adam@0
|
934 # True iff FILE is a libtool wrapper executable
|
adam@0
|
935 # This function is only a basic sanity check; it will hardly flush out
|
adam@0
|
936 # determined imposters.
|
adam@0
|
937 func_ltwrapper_executable_p ()
|
adam@0
|
938 {
|
adam@0
|
939 func_ltwrapper_exec_suffix=
|
adam@0
|
940 case $1 in
|
adam@0
|
941 *.exe) ;;
|
adam@0
|
942 *) func_ltwrapper_exec_suffix=.exe ;;
|
adam@0
|
943 esac
|
adam@0
|
944 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
|
adam@0
|
945 }
|
adam@0
|
946
|
adam@0
|
947 # func_ltwrapper_scriptname file
|
adam@0
|
948 # Assumes file is an ltwrapper_executable
|
adam@0
|
949 # uses $file to determine the appropriate filename for a
|
adam@0
|
950 # temporary ltwrapper_script.
|
adam@0
|
951 func_ltwrapper_scriptname ()
|
adam@0
|
952 {
|
adam@0
|
953 func_ltwrapper_scriptname_result=""
|
adam@0
|
954 if func_ltwrapper_executable_p "$1"; then
|
adam@0
|
955 func_dirname_and_basename "$1" "" "."
|
adam@0
|
956 func_stripname '' '.exe' "$func_basename_result"
|
adam@0
|
957 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
|
adam@0
|
958 fi
|
adam@0
|
959 }
|
adam@0
|
960
|
adam@0
|
961 # func_ltwrapper_p file
|
adam@0
|
962 # True iff FILE is a libtool wrapper script or wrapper executable
|
adam@0
|
963 # This function is only a basic sanity check; it will hardly flush out
|
adam@0
|
964 # determined imposters.
|
adam@0
|
965 func_ltwrapper_p ()
|
adam@0
|
966 {
|
adam@0
|
967 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
|
adam@0
|
968 }
|
adam@0
|
969
|
adam@0
|
970
|
adam@0
|
971 # func_execute_cmds commands fail_cmd
|
adam@0
|
972 # Execute tilde-delimited COMMANDS.
|
adam@0
|
973 # If FAIL_CMD is given, eval that upon failure.
|
adam@0
|
974 # FAIL_CMD may read-access the current command in variable CMD!
|
adam@0
|
975 func_execute_cmds ()
|
adam@0
|
976 {
|
adam@0
|
977 $opt_debug
|
adam@0
|
978 save_ifs=$IFS; IFS='~'
|
adam@0
|
979 for cmd in $1; do
|
adam@0
|
980 IFS=$save_ifs
|
adam@0
|
981 eval cmd=\"$cmd\"
|
adam@0
|
982 func_show_eval "$cmd" "${2-:}"
|
adam@0
|
983 done
|
adam@0
|
984 IFS=$save_ifs
|
adam@0
|
985 }
|
adam@0
|
986
|
adam@0
|
987
|
adam@0
|
988 # func_source file
|
adam@0
|
989 # Source FILE, adding directory component if necessary.
|
adam@0
|
990 # Note that it is not necessary on cygwin/mingw to append a dot to
|
adam@0
|
991 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
|
adam@0
|
992 # behavior happens only for exec(3), not for open(2)! Also, sourcing
|
adam@0
|
993 # `FILE.' does not work on cygwin managed mounts.
|
adam@0
|
994 func_source ()
|
adam@0
|
995 {
|
adam@0
|
996 $opt_debug
|
adam@0
|
997 case $1 in
|
adam@0
|
998 */* | *\\*) . "$1" ;;
|
adam@0
|
999 *) . "./$1" ;;
|
adam@0
|
1000 esac
|
adam@0
|
1001 }
|
adam@0
|
1002
|
adam@0
|
1003
|
adam@0
|
1004 # func_infer_tag arg
|
adam@0
|
1005 # Infer tagged configuration to use if any are available and
|
adam@0
|
1006 # if one wasn't chosen via the "--tag" command line option.
|
adam@0
|
1007 # Only attempt this if the compiler in the base compile
|
adam@0
|
1008 # command doesn't match the default compiler.
|
adam@0
|
1009 # arg is usually of the form 'gcc ...'
|
adam@0
|
1010 func_infer_tag ()
|
adam@0
|
1011 {
|
adam@0
|
1012 $opt_debug
|
adam@0
|
1013 if test -n "$available_tags" && test -z "$tagname"; then
|
adam@0
|
1014 CC_quoted=
|
adam@0
|
1015 for arg in $CC; do
|
adam@0
|
1016 func_quote_for_eval "$arg"
|
adam@0
|
1017 CC_quoted="$CC_quoted $func_quote_for_eval_result"
|
adam@0
|
1018 done
|
adam@0
|
1019 case $@ in
|
adam@0
|
1020 # Blanks in the command may have been stripped by the calling shell,
|
adam@0
|
1021 # but not from the CC environment variable when configure was run.
|
adam@0
|
1022 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
|
adam@0
|
1023 # Blanks at the start of $base_compile will cause this to fail
|
adam@0
|
1024 # if we don't check for them as well.
|
adam@0
|
1025 *)
|
adam@0
|
1026 for z in $available_tags; do
|
adam@0
|
1027 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
|
adam@0
|
1028 # Evaluate the configuration.
|
adam@0
|
1029 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
|
adam@0
|
1030 CC_quoted=
|
adam@0
|
1031 for arg in $CC; do
|
adam@0
|
1032 # Double-quote args containing other shell metacharacters.
|
adam@0
|
1033 func_quote_for_eval "$arg"
|
adam@0
|
1034 CC_quoted="$CC_quoted $func_quote_for_eval_result"
|
adam@0
|
1035 done
|
adam@0
|
1036 case "$@ " in
|
adam@0
|
1037 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
|
adam@0
|
1038 # The compiler in the base compile command matches
|
adam@0
|
1039 # the one in the tagged configuration.
|
adam@0
|
1040 # Assume this is the tagged configuration we want.
|
adam@0
|
1041 tagname=$z
|
adam@0
|
1042 break
|
adam@0
|
1043 ;;
|
adam@0
|
1044 esac
|
adam@0
|
1045 fi
|
adam@0
|
1046 done
|
adam@0
|
1047 # If $tagname still isn't set, then no tagged configuration
|
adam@0
|
1048 # was found and let the user know that the "--tag" command
|
adam@0
|
1049 # line option must be used.
|
adam@0
|
1050 if test -z "$tagname"; then
|
adam@0
|
1051 func_echo "unable to infer tagged configuration"
|
adam@0
|
1052 func_fatal_error "specify a tag with \`--tag'"
|
adam@0
|
1053 # else
|
adam@0
|
1054 # func_verbose "using $tagname tagged configuration"
|
adam@0
|
1055 fi
|
adam@0
|
1056 ;;
|
adam@0
|
1057 esac
|
adam@0
|
1058 fi
|
adam@0
|
1059 }
|
adam@0
|
1060
|
adam@0
|
1061
|
adam@0
|
1062
|
adam@0
|
1063 # func_write_libtool_object output_name pic_name nonpic_name
|
adam@0
|
1064 # Create a libtool object file (analogous to a ".la" file),
|
adam@0
|
1065 # but don't create it if we're doing a dry run.
|
adam@0
|
1066 func_write_libtool_object ()
|
adam@0
|
1067 {
|
adam@0
|
1068 write_libobj=${1}
|
adam@0
|
1069 if test "$build_libtool_libs" = yes; then
|
adam@0
|
1070 write_lobj=\'${2}\'
|
adam@0
|
1071 else
|
adam@0
|
1072 write_lobj=none
|
adam@0
|
1073 fi
|
adam@0
|
1074
|
adam@0
|
1075 if test "$build_old_libs" = yes; then
|
adam@0
|
1076 write_oldobj=\'${3}\'
|
adam@0
|
1077 else
|
adam@0
|
1078 write_oldobj=none
|
adam@0
|
1079 fi
|
adam@0
|
1080
|
adam@0
|
1081 $opt_dry_run || {
|
adam@0
|
1082 cat >${write_libobj}T <<EOF
|
adam@0
|
1083 # $write_libobj - a libtool object file
|
adam@0
|
1084 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
|
adam@0
|
1085 #
|
adam@0
|
1086 # Please DO NOT delete this file!
|
adam@0
|
1087 # It is necessary for linking the library.
|
adam@0
|
1088
|
adam@0
|
1089 # Name of the PIC object.
|
adam@0
|
1090 pic_object=$write_lobj
|
adam@0
|
1091
|
adam@0
|
1092 # Name of the non-PIC object
|
adam@0
|
1093 non_pic_object=$write_oldobj
|
adam@0
|
1094
|
adam@0
|
1095 EOF
|
adam@0
|
1096 $MV "${write_libobj}T" "${write_libobj}"
|
adam@0
|
1097 }
|
adam@0
|
1098 }
|
adam@0
|
1099
|
adam@0
|
1100 # func_mode_compile arg...
|
adam@0
|
1101 func_mode_compile ()
|
adam@0
|
1102 {
|
adam@0
|
1103 $opt_debug
|
adam@0
|
1104 # Get the compilation command and the source file.
|
adam@0
|
1105 base_compile=
|
adam@0
|
1106 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
|
adam@0
|
1107 suppress_opt=yes
|
adam@0
|
1108 suppress_output=
|
adam@0
|
1109 arg_mode=normal
|
adam@0
|
1110 libobj=
|
adam@0
|
1111 later=
|
adam@0
|
1112 pie_flag=
|
adam@0
|
1113
|
adam@0
|
1114 for arg
|
adam@0
|
1115 do
|
adam@0
|
1116 case $arg_mode in
|
adam@0
|
1117 arg )
|
adam@0
|
1118 # do not "continue". Instead, add this to base_compile
|
adam@0
|
1119 lastarg="$arg"
|
adam@0
|
1120 arg_mode=normal
|
adam@0
|
1121 ;;
|
adam@0
|
1122
|
adam@0
|
1123 target )
|
adam@0
|
1124 libobj="$arg"
|
adam@0
|
1125 arg_mode=normal
|
adam@0
|
1126 continue
|
adam@0
|
1127 ;;
|
adam@0
|
1128
|
adam@0
|
1129 normal )
|
adam@0
|
1130 # Accept any command-line options.
|
adam@0
|
1131 case $arg in
|
adam@0
|
1132 -o)
|
adam@0
|
1133 test -n "$libobj" && \
|
adam@0
|
1134 func_fatal_error "you cannot specify \`-o' more than once"
|
adam@0
|
1135 arg_mode=target
|
adam@0
|
1136 continue
|
adam@0
|
1137 ;;
|
adam@0
|
1138
|
adam@0
|
1139 -pie | -fpie | -fPIE)
|
adam@0
|
1140 pie_flag="$pie_flag $arg"
|
adam@0
|
1141 continue
|
adam@0
|
1142 ;;
|
adam@0
|
1143
|
adam@0
|
1144 -shared | -static | -prefer-pic | -prefer-non-pic)
|
adam@0
|
1145 later="$later $arg"
|
adam@0
|
1146 continue
|
adam@0
|
1147 ;;
|
adam@0
|
1148
|
adam@0
|
1149 -no-suppress)
|
adam@0
|
1150 suppress_opt=no
|
adam@0
|
1151 continue
|
adam@0
|
1152 ;;
|
adam@0
|
1153
|
adam@0
|
1154 -Xcompiler)
|
adam@0
|
1155 arg_mode=arg # the next one goes into the "base_compile" arg list
|
adam@0
|
1156 continue # The current "srcfile" will either be retained or
|
adam@0
|
1157 ;; # replaced later. I would guess that would be a bug.
|
adam@0
|
1158
|
adam@0
|
1159 -Wc,*)
|
adam@0
|
1160 func_stripname '-Wc,' '' "$arg"
|
adam@0
|
1161 args=$func_stripname_result
|
adam@0
|
1162 lastarg=
|
adam@0
|
1163 save_ifs="$IFS"; IFS=','
|
adam@0
|
1164 for arg in $args; do
|
adam@0
|
1165 IFS="$save_ifs"
|
adam@0
|
1166 func_quote_for_eval "$arg"
|
adam@0
|
1167 lastarg="$lastarg $func_quote_for_eval_result"
|
adam@0
|
1168 done
|
adam@0
|
1169 IFS="$save_ifs"
|
adam@0
|
1170 func_stripname ' ' '' "$lastarg"
|
adam@0
|
1171 lastarg=$func_stripname_result
|
adam@0
|
1172
|
adam@0
|
1173 # Add the arguments to base_compile.
|
adam@0
|
1174 base_compile="$base_compile $lastarg"
|
adam@0
|
1175 continue
|
adam@0
|
1176 ;;
|
adam@0
|
1177
|
adam@0
|
1178 *)
|
adam@0
|
1179 # Accept the current argument as the source file.
|
adam@0
|
1180 # The previous "srcfile" becomes the current argument.
|
adam@0
|
1181 #
|
adam@0
|
1182 lastarg="$srcfile"
|
adam@0
|
1183 srcfile="$arg"
|
adam@0
|
1184 ;;
|
adam@0
|
1185 esac # case $arg
|
adam@0
|
1186 ;;
|
adam@0
|
1187 esac # case $arg_mode
|
adam@0
|
1188
|
adam@0
|
1189 # Aesthetically quote the previous argument.
|
adam@0
|
1190 func_quote_for_eval "$lastarg"
|
adam@0
|
1191 base_compile="$base_compile $func_quote_for_eval_result"
|
adam@0
|
1192 done # for arg
|
adam@0
|
1193
|
adam@0
|
1194 case $arg_mode in
|
adam@0
|
1195 arg)
|
adam@0
|
1196 func_fatal_error "you must specify an argument for -Xcompile"
|
adam@0
|
1197 ;;
|
adam@0
|
1198 target)
|
adam@0
|
1199 func_fatal_error "you must specify a target with \`-o'"
|
adam@0
|
1200 ;;
|
adam@0
|
1201 *)
|
adam@0
|
1202 # Get the name of the library object.
|
adam@0
|
1203 test -z "$libobj" && {
|
adam@0
|
1204 func_basename "$srcfile"
|
adam@0
|
1205 libobj="$func_basename_result"
|
adam@0
|
1206 }
|
adam@0
|
1207 ;;
|
adam@0
|
1208 esac
|
adam@0
|
1209
|
adam@0
|
1210 # Recognize several different file suffixes.
|
adam@0
|
1211 # If the user specifies -o file.o, it is replaced with file.lo
|
adam@0
|
1212 case $libobj in
|
adam@0
|
1213 *.[cCFSifmso] | \
|
adam@0
|
1214 *.ada | *.adb | *.ads | *.asm | \
|
adam@0
|
1215 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
|
adam@0
|
1216 *.[fF][09]? | *.for | *.java | *.obj | *.sx)
|
adam@0
|
1217 func_xform "$libobj"
|
adam@0
|
1218 libobj=$func_xform_result
|
adam@0
|
1219 ;;
|
adam@0
|
1220 esac
|
adam@0
|
1221
|
adam@0
|
1222 case $libobj in
|
adam@0
|
1223 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
|
adam@0
|
1224 *)
|
adam@0
|
1225 func_fatal_error "cannot determine name of library object from \`$libobj'"
|
adam@0
|
1226 ;;
|
adam@0
|
1227 esac
|
adam@0
|
1228
|
adam@0
|
1229 func_infer_tag $base_compile
|
adam@0
|
1230
|
adam@0
|
1231 for arg in $later; do
|
adam@0
|
1232 case $arg in
|
adam@0
|
1233 -shared)
|
adam@0
|
1234 test "$build_libtool_libs" != yes && \
|
adam@0
|
1235 func_fatal_configuration "can not build a shared library"
|
adam@0
|
1236 build_old_libs=no
|
adam@0
|
1237 continue
|
adam@0
|
1238 ;;
|
adam@0
|
1239
|
adam@0
|
1240 -static)
|
adam@0
|
1241 build_libtool_libs=no
|
adam@0
|
1242 build_old_libs=yes
|
adam@0
|
1243 continue
|
adam@0
|
1244 ;;
|
adam@0
|
1245
|
adam@0
|
1246 -prefer-pic)
|
adam@0
|
1247 pic_mode=yes
|
adam@0
|
1248 continue
|
adam@0
|
1249 ;;
|
adam@0
|
1250
|
adam@0
|
1251 -prefer-non-pic)
|
adam@0
|
1252 pic_mode=no
|
adam@0
|
1253 continue
|
adam@0
|
1254 ;;
|
adam@0
|
1255 esac
|
adam@0
|
1256 done
|
adam@0
|
1257
|
adam@0
|
1258 func_quote_for_eval "$libobj"
|
adam@0
|
1259 test "X$libobj" != "X$func_quote_for_eval_result" \
|
adam@0
|
1260 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
|
adam@0
|
1261 && func_warning "libobj name \`$libobj' may not contain shell special characters."
|
adam@0
|
1262 func_dirname_and_basename "$obj" "/" ""
|
adam@0
|
1263 objname="$func_basename_result"
|
adam@0
|
1264 xdir="$func_dirname_result"
|
adam@0
|
1265 lobj=${xdir}$objdir/$objname
|
adam@0
|
1266
|
adam@0
|
1267 test -z "$base_compile" && \
|
adam@0
|
1268 func_fatal_help "you must specify a compilation command"
|
adam@0
|
1269
|
adam@0
|
1270 # Delete any leftover library objects.
|
adam@0
|
1271 if test "$build_old_libs" = yes; then
|
adam@0
|
1272 removelist="$obj $lobj $libobj ${libobj}T"
|
adam@0
|
1273 else
|
adam@0
|
1274 removelist="$lobj $libobj ${libobj}T"
|
adam@0
|
1275 fi
|
adam@0
|
1276
|
adam@0
|
1277 # On Cygwin there's no "real" PIC flag so we must build both object types
|
adam@0
|
1278 case $host_os in
|
adam@0
|
1279 cygwin* | mingw* | pw32* | os2* | cegcc*)
|
adam@0
|
1280 pic_mode=default
|
adam@0
|
1281 ;;
|
adam@0
|
1282 esac
|
adam@0
|
1283 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
|
adam@0
|
1284 # non-PIC code in shared libraries is not supported
|
adam@0
|
1285 pic_mode=default
|
adam@0
|
1286 fi
|
adam@0
|
1287
|
adam@0
|
1288 # Calculate the filename of the output object if compiler does
|
adam@0
|
1289 # not support -o with -c
|
adam@0
|
1290 if test "$compiler_c_o" = no; then
|
adam@0
|
1291 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
|
adam@0
|
1292 lockfile="$output_obj.lock"
|
adam@0
|
1293 else
|
adam@0
|
1294 output_obj=
|
adam@0
|
1295 need_locks=no
|
adam@0
|
1296 lockfile=
|
adam@0
|
1297 fi
|
adam@0
|
1298
|
adam@0
|
1299 # Lock this critical section if it is needed
|
adam@0
|
1300 # We use this script file to make the link, it avoids creating a new file
|
adam@0
|
1301 if test "$need_locks" = yes; then
|
adam@0
|
1302 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
|
adam@0
|
1303 func_echo "Waiting for $lockfile to be removed"
|
adam@0
|
1304 sleep 2
|
adam@0
|
1305 done
|
adam@0
|
1306 elif test "$need_locks" = warn; then
|
adam@0
|
1307 if test -f "$lockfile"; then
|
adam@0
|
1308 $ECHO "\
|
adam@0
|
1309 *** ERROR, $lockfile exists and contains:
|
adam@0
|
1310 `cat $lockfile 2>/dev/null`
|
adam@0
|
1311
|
adam@0
|
1312 This indicates that another process is trying to use the same
|
adam@0
|
1313 temporary object file, and libtool could not work around it because
|
adam@0
|
1314 your compiler does not support \`-c' and \`-o' together. If you
|
adam@0
|
1315 repeat this compilation, it may succeed, by chance, but you had better
|
adam@0
|
1316 avoid parallel builds (make -j) in this platform, or get a better
|
adam@0
|
1317 compiler."
|
adam@0
|
1318
|
adam@0
|
1319 $opt_dry_run || $RM $removelist
|
adam@0
|
1320 exit $EXIT_FAILURE
|
adam@0
|
1321 fi
|
adam@0
|
1322 removelist="$removelist $output_obj"
|
adam@0
|
1323 $ECHO "$srcfile" > "$lockfile"
|
adam@0
|
1324 fi
|
adam@0
|
1325
|
adam@0
|
1326 $opt_dry_run || $RM $removelist
|
adam@0
|
1327 removelist="$removelist $lockfile"
|
adam@0
|
1328 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
|
adam@0
|
1329
|
adam@0
|
1330 if test -n "$fix_srcfile_path"; then
|
adam@0
|
1331 eval srcfile=\"$fix_srcfile_path\"
|
adam@0
|
1332 fi
|
adam@0
|
1333 func_quote_for_eval "$srcfile"
|
adam@0
|
1334 qsrcfile=$func_quote_for_eval_result
|
adam@0
|
1335
|
adam@0
|
1336 # Only build a PIC object if we are building libtool libraries.
|
adam@0
|
1337 if test "$build_libtool_libs" = yes; then
|
adam@0
|
1338 # Without this assignment, base_compile gets emptied.
|
adam@0
|
1339 fbsd_hideous_sh_bug=$base_compile
|
adam@0
|
1340
|
adam@0
|
1341 if test "$pic_mode" != no; then
|
adam@0
|
1342 command="$base_compile $qsrcfile $pic_flag"
|
adam@0
|
1343 else
|
adam@0
|
1344 # Don't build PIC code
|
adam@0
|
1345 command="$base_compile $qsrcfile"
|
adam@0
|
1346 fi
|
adam@0
|
1347
|
adam@0
|
1348 func_mkdir_p "$xdir$objdir"
|
adam@0
|
1349
|
adam@0
|
1350 if test -z "$output_obj"; then
|
adam@0
|
1351 # Place PIC objects in $objdir
|
adam@0
|
1352 command="$command -o $lobj"
|
adam@0
|
1353 fi
|
adam@0
|
1354
|
adam@0
|
1355 func_show_eval_locale "$command" \
|
adam@0
|
1356 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
|
adam@0
|
1357
|
adam@0
|
1358 if test "$need_locks" = warn &&
|
adam@0
|
1359 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
|
adam@0
|
1360 $ECHO "\
|
adam@0
|
1361 *** ERROR, $lockfile contains:
|
adam@0
|
1362 `cat $lockfile 2>/dev/null`
|
adam@0
|
1363
|
adam@0
|
1364 but it should contain:
|
adam@0
|
1365 $srcfile
|
adam@0
|
1366
|
adam@0
|
1367 This indicates that another process is trying to use the same
|
adam@0
|
1368 temporary object file, and libtool could not work around it because
|
adam@0
|
1369 your compiler does not support \`-c' and \`-o' together. If you
|
adam@0
|
1370 repeat this compilation, it may succeed, by chance, but you had better
|
adam@0
|
1371 avoid parallel builds (make -j) in this platform, or get a better
|
adam@0
|
1372 compiler."
|
adam@0
|
1373
|
adam@0
|
1374 $opt_dry_run || $RM $removelist
|
adam@0
|
1375 exit $EXIT_FAILURE
|
adam@0
|
1376 fi
|
adam@0
|
1377
|
adam@0
|
1378 # Just move the object if needed, then go on to compile the next one
|
adam@0
|
1379 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
|
adam@0
|
1380 func_show_eval '$MV "$output_obj" "$lobj"' \
|
adam@0
|
1381 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
|
adam@0
|
1382 fi
|
adam@0
|
1383
|
adam@0
|
1384 # Allow error messages only from the first compilation.
|
adam@0
|
1385 if test "$suppress_opt" = yes; then
|
adam@0
|
1386 suppress_output=' >/dev/null 2>&1'
|
adam@0
|
1387 fi
|
adam@0
|
1388 fi
|
adam@0
|
1389
|
adam@0
|
1390 # Only build a position-dependent object if we build old libraries.
|
adam@0
|
1391 if test "$build_old_libs" = yes; then
|
adam@0
|
1392 if test "$pic_mode" != yes; then
|
adam@0
|
1393 # Don't build PIC code
|
adam@0
|
1394 command="$base_compile $qsrcfile$pie_flag"
|
adam@0
|
1395 else
|
adam@0
|
1396 command="$base_compile $qsrcfile $pic_flag"
|
adam@0
|
1397 fi
|
adam@0
|
1398 if test "$compiler_c_o" = yes; then
|
adam@0
|
1399 command="$command -o $obj"
|
adam@0
|
1400 fi
|
adam@0
|
1401
|
adam@0
|
1402 # Suppress compiler output if we already did a PIC compilation.
|
adam@0
|
1403 command="$command$suppress_output"
|
adam@0
|
1404 func_show_eval_locale "$command" \
|
adam@0
|
1405 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
|
adam@0
|
1406
|
adam@0
|
1407 if test "$need_locks" = warn &&
|
adam@0
|
1408 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
|
adam@0
|
1409 $ECHO "\
|
adam@0
|
1410 *** ERROR, $lockfile contains:
|
adam@0
|
1411 `cat $lockfile 2>/dev/null`
|
adam@0
|
1412
|
adam@0
|
1413 but it should contain:
|
adam@0
|
1414 $srcfile
|
adam@0
|
1415
|
adam@0
|
1416 This indicates that another process is trying to use the same
|
adam@0
|
1417 temporary object file, and libtool could not work around it because
|
adam@0
|
1418 your compiler does not support \`-c' and \`-o' together. If you
|
adam@0
|
1419 repeat this compilation, it may succeed, by chance, but you had better
|
adam@0
|
1420 avoid parallel builds (make -j) in this platform, or get a better
|
adam@0
|
1421 compiler."
|
adam@0
|
1422
|
adam@0
|
1423 $opt_dry_run || $RM $removelist
|
adam@0
|
1424 exit $EXIT_FAILURE
|
adam@0
|
1425 fi
|
adam@0
|
1426
|
adam@0
|
1427 # Just move the object if needed
|
adam@0
|
1428 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
|
adam@0
|
1429 func_show_eval '$MV "$output_obj" "$obj"' \
|
adam@0
|
1430 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
|
adam@0
|
1431 fi
|
adam@0
|
1432 fi
|
adam@0
|
1433
|
adam@0
|
1434 $opt_dry_run || {
|
adam@0
|
1435 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
|
adam@0
|
1436
|
adam@0
|
1437 # Unlock the critical section if it was locked
|
adam@0
|
1438 if test "$need_locks" != no; then
|
adam@0
|
1439 removelist=$lockfile
|
adam@0
|
1440 $RM "$lockfile"
|
adam@0
|
1441 fi
|
adam@0
|
1442 }
|
adam@0
|
1443
|
adam@0
|
1444 exit $EXIT_SUCCESS
|
adam@0
|
1445 }
|
adam@0
|
1446
|
adam@0
|
1447 $opt_help || {
|
adam@0
|
1448 test "$mode" = compile && func_mode_compile ${1+"$@"}
|
adam@0
|
1449 }
|
adam@0
|
1450
|
adam@0
|
1451 func_mode_help ()
|
adam@0
|
1452 {
|
adam@0
|
1453 # We need to display help for each of the modes.
|
adam@0
|
1454 case $mode in
|
adam@0
|
1455 "")
|
adam@0
|
1456 # Generic help is extracted from the usage comments
|
adam@0
|
1457 # at the start of this file.
|
adam@0
|
1458 func_help
|
adam@0
|
1459 ;;
|
adam@0
|
1460
|
adam@0
|
1461 clean)
|
adam@0
|
1462 $ECHO \
|
adam@0
|
1463 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
|
adam@0
|
1464
|
adam@0
|
1465 Remove files from the build directory.
|
adam@0
|
1466
|
adam@0
|
1467 RM is the name of the program to use to delete files associated with each FILE
|
adam@0
|
1468 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
|
adam@0
|
1469 to RM.
|
adam@0
|
1470
|
adam@0
|
1471 If FILE is a libtool library, object or program, all the files associated
|
adam@0
|
1472 with it are deleted. Otherwise, only FILE itself is deleted using RM."
|
adam@0
|
1473 ;;
|
adam@0
|
1474
|
adam@0
|
1475 compile)
|
adam@0
|
1476 $ECHO \
|
adam@0
|
1477 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
|
adam@0
|
1478
|
adam@0
|
1479 Compile a source file into a libtool library object.
|
adam@0
|
1480
|
adam@0
|
1481 This mode accepts the following additional options:
|
adam@0
|
1482
|
adam@0
|
1483 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
|
adam@0
|
1484 -no-suppress do not suppress compiler output for multiple passes
|
adam@0
|
1485 -prefer-pic try to building PIC objects only
|
adam@0
|
1486 -prefer-non-pic try to building non-PIC objects only
|
adam@0
|
1487 -shared do not build a \`.o' file suitable for static linking
|
adam@0
|
1488 -static only build a \`.o' file suitable for static linking
|
adam@0
|
1489
|
adam@0
|
1490 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
|
adam@0
|
1491 from the given SOURCEFILE.
|
adam@0
|
1492
|
adam@0
|
1493 The output file name is determined by removing the directory component from
|
adam@0
|
1494 SOURCEFILE, then substituting the C source code suffix \`.c' with the
|
adam@0
|
1495 library object suffix, \`.lo'."
|
adam@0
|
1496 ;;
|
adam@0
|
1497
|
adam@0
|
1498 execute)
|
adam@0
|
1499 $ECHO \
|
adam@0
|
1500 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
|
adam@0
|
1501
|
adam@0
|
1502 Automatically set library path, then run a program.
|
adam@0
|
1503
|
adam@0
|
1504 This mode accepts the following additional options:
|
adam@0
|
1505
|
adam@0
|
1506 -dlopen FILE add the directory containing FILE to the library path
|
adam@0
|
1507
|
adam@0
|
1508 This mode sets the library path environment variable according to \`-dlopen'
|
adam@0
|
1509 flags.
|
adam@0
|
1510
|
adam@0
|
1511 If any of the ARGS are libtool executable wrappers, then they are translated
|
adam@0
|
1512 into their corresponding uninstalled binary, and any of their required library
|
adam@0
|
1513 directories are added to the library path.
|
adam@0
|
1514
|
adam@0
|
1515 Then, COMMAND is executed, with ARGS as arguments."
|
adam@0
|
1516 ;;
|
adam@0
|
1517
|
adam@0
|
1518 finish)
|
adam@0
|
1519 $ECHO \
|
adam@0
|
1520 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
|
adam@0
|
1521
|
adam@0
|
1522 Complete the installation of libtool libraries.
|
adam@0
|
1523
|
adam@0
|
1524 Each LIBDIR is a directory that contains libtool libraries.
|
adam@0
|
1525
|
adam@0
|
1526 The commands that this mode executes may require superuser privileges. Use
|
adam@0
|
1527 the \`--dry-run' option if you just want to see what would be executed."
|
adam@0
|
1528 ;;
|
adam@0
|
1529
|
adam@0
|
1530 install)
|
adam@0
|
1531 $ECHO \
|
adam@0
|
1532 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
|
adam@0
|
1533
|
adam@0
|
1534 Install executables or libraries.
|
adam@0
|
1535
|
adam@0
|
1536 INSTALL-COMMAND is the installation command. The first component should be
|
adam@0
|
1537 either the \`install' or \`cp' program.
|
adam@0
|
1538
|
adam@0
|
1539 The following components of INSTALL-COMMAND are treated specially:
|
adam@0
|
1540
|
adam@0
|
1541 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
|
adam@0
|
1542
|
adam@0
|
1543 The rest of the components are interpreted as arguments to that command (only
|
adam@0
|
1544 BSD-compatible install options are recognized)."
|
adam@0
|
1545 ;;
|
adam@0
|
1546
|
adam@0
|
1547 link)
|
adam@0
|
1548 $ECHO \
|
adam@0
|
1549 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
|
adam@0
|
1550
|
adam@0
|
1551 Link object files or libraries together to form another library, or to
|
adam@0
|
1552 create an executable program.
|
adam@0
|
1553
|
adam@0
|
1554 LINK-COMMAND is a command using the C compiler that you would use to create
|
adam@0
|
1555 a program from several object files.
|
adam@0
|
1556
|
adam@0
|
1557 The following components of LINK-COMMAND are treated specially:
|
adam@0
|
1558
|
adam@0
|
1559 -all-static do not do any dynamic linking at all
|
adam@0
|
1560 -avoid-version do not add a version suffix if possible
|
adam@0
|
1561 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
|
adam@0
|
1562 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
|
adam@0
|
1563 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
|
adam@0
|
1564 -export-symbols SYMFILE
|
adam@0
|
1565 try to export only the symbols listed in SYMFILE
|
adam@0
|
1566 -export-symbols-regex REGEX
|
adam@0
|
1567 try to export only the symbols matching REGEX
|
adam@0
|
1568 -LLIBDIR search LIBDIR for required installed libraries
|
adam@0
|
1569 -lNAME OUTPUT-FILE requires the installed library libNAME
|
adam@0
|
1570 -module build a library that can dlopened
|
adam@0
|
1571 -no-fast-install disable the fast-install mode
|
adam@0
|
1572 -no-install link a not-installable executable
|
adam@0
|
1573 -no-undefined declare that a library does not refer to external symbols
|
adam@0
|
1574 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
|
adam@0
|
1575 -objectlist FILE Use a list of object files found in FILE to specify objects
|
adam@0
|
1576 -precious-files-regex REGEX
|
adam@0
|
1577 don't remove output files matching REGEX
|
adam@0
|
1578 -release RELEASE specify package release information
|
adam@0
|
1579 -rpath LIBDIR the created library will eventually be installed in LIBDIR
|
adam@0
|
1580 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
|
adam@0
|
1581 -shared only do dynamic linking of libtool libraries
|
adam@0
|
1582 -shrext SUFFIX override the standard shared library file extension
|
adam@0
|
1583 -static do not do any dynamic linking of uninstalled libtool libraries
|
adam@0
|
1584 -static-libtool-libs
|
adam@0
|
1585 do not do any dynamic linking of libtool libraries
|
adam@0
|
1586 -version-info CURRENT[:REVISION[:AGE]]
|
adam@0
|
1587 specify library version info [each variable defaults to 0]
|
adam@0
|
1588 -weak LIBNAME declare that the target provides the LIBNAME interface
|
adam@0
|
1589
|
adam@0
|
1590 All other options (arguments beginning with \`-') are ignored.
|
adam@0
|
1591
|
adam@0
|
1592 Every other argument is treated as a filename. Files ending in \`.la' are
|
adam@0
|
1593 treated as uninstalled libtool libraries, other files are standard or library
|
adam@0
|
1594 object files.
|
adam@0
|
1595
|
adam@0
|
1596 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
|
adam@0
|
1597 only library objects (\`.lo' files) may be specified, and \`-rpath' is
|
adam@0
|
1598 required, except when creating a convenience library.
|
adam@0
|
1599
|
adam@0
|
1600 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
|
adam@0
|
1601 using \`ar' and \`ranlib', or on Windows using \`lib'.
|
adam@0
|
1602
|
adam@0
|
1603 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
|
adam@0
|
1604 is created, otherwise an executable program is created."
|
adam@0
|
1605 ;;
|
adam@0
|
1606
|
adam@0
|
1607 uninstall)
|
adam@0
|
1608 $ECHO \
|
adam@0
|
1609 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
|
adam@0
|
1610
|
adam@0
|
1611 Remove libraries from an installation directory.
|
adam@0
|
1612
|
adam@0
|
1613 RM is the name of the program to use to delete files associated with each FILE
|
adam@0
|
1614 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
|
adam@0
|
1615 to RM.
|
adam@0
|
1616
|
adam@0
|
1617 If FILE is a libtool library, all the files associated with it are deleted.
|
adam@0
|
1618 Otherwise, only FILE itself is deleted using RM."
|
adam@0
|
1619 ;;
|
adam@0
|
1620
|
adam@0
|
1621 *)
|
adam@0
|
1622 func_fatal_help "invalid operation mode \`$mode'"
|
adam@0
|
1623 ;;
|
adam@0
|
1624 esac
|
adam@0
|
1625
|
adam@0
|
1626 $ECHO
|
adam@0
|
1627 $ECHO "Try \`$progname --help' for more information about other modes."
|
adam@0
|
1628
|
adam@0
|
1629 exit $?
|
adam@0
|
1630 }
|
adam@0
|
1631
|
adam@0
|
1632 # Now that we've collected a possible --mode arg, show help if necessary
|
adam@0
|
1633 $opt_help && func_mode_help
|
adam@0
|
1634
|
adam@0
|
1635
|
adam@0
|
1636 # func_mode_execute arg...
|
adam@0
|
1637 func_mode_execute ()
|
adam@0
|
1638 {
|
adam@0
|
1639 $opt_debug
|
adam@0
|
1640 # The first argument is the command name.
|
adam@0
|
1641 cmd="$nonopt"
|
adam@0
|
1642 test -z "$cmd" && \
|
adam@0
|
1643 func_fatal_help "you must specify a COMMAND"
|
adam@0
|
1644
|
adam@0
|
1645 # Handle -dlopen flags immediately.
|
adam@0
|
1646 for file in $execute_dlfiles; do
|
adam@0
|
1647 test -f "$file" \
|
adam@0
|
1648 || func_fatal_help "\`$file' is not a file"
|
adam@0
|
1649
|
adam@0
|
1650 dir=
|
adam@0
|
1651 case $file in
|
adam@0
|
1652 *.la)
|
adam@0
|
1653 # Check to see that this really is a libtool archive.
|
adam@0
|
1654 func_lalib_unsafe_p "$file" \
|
adam@0
|
1655 || func_fatal_help "\`$lib' is not a valid libtool archive"
|
adam@0
|
1656
|
adam@0
|
1657 # Read the libtool library.
|
adam@0
|
1658 dlname=
|
adam@0
|
1659 library_names=
|
adam@0
|
1660 func_source "$file"
|
adam@0
|
1661
|
adam@0
|
1662 # Skip this library if it cannot be dlopened.
|
adam@0
|
1663 if test -z "$dlname"; then
|
adam@0
|
1664 # Warn if it was a shared library.
|
adam@0
|
1665 test -n "$library_names" && \
|
adam@0
|
1666 func_warning "\`$file' was not linked with \`-export-dynamic'"
|
adam@0
|
1667 continue
|
adam@0
|
1668 fi
|
adam@0
|
1669
|
adam@0
|
1670 func_dirname "$file" "" "."
|
adam@0
|
1671 dir="$func_dirname_result"
|
adam@0
|
1672
|
adam@0
|
1673 if test -f "$dir/$objdir/$dlname"; then
|
adam@0
|
1674 dir="$dir/$objdir"
|
adam@0
|
1675 else
|
adam@0
|
1676 if test ! -f "$dir/$dlname"; then
|
adam@0
|
1677 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
|
adam@0
|
1678 fi
|
adam@0
|
1679 fi
|
adam@0
|
1680 ;;
|
adam@0
|
1681
|
adam@0
|
1682 *.lo)
|
adam@0
|
1683 # Just add the directory containing the .lo file.
|
adam@0
|
1684 func_dirname "$file" "" "."
|
adam@0
|
1685 dir="$func_dirname_result"
|
adam@0
|
1686 ;;
|
adam@0
|
1687
|
adam@0
|
1688 *)
|
adam@0
|
1689 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
|
adam@0
|
1690 continue
|
adam@0
|
1691 ;;
|
adam@0
|
1692 esac
|
adam@0
|
1693
|
adam@0
|
1694 # Get the absolute pathname.
|
adam@0
|
1695 absdir=`cd "$dir" && pwd`
|
adam@0
|
1696 test -n "$absdir" && dir="$absdir"
|
adam@0
|
1697
|
adam@0
|
1698 # Now add the directory to shlibpath_var.
|
adam@0
|
1699 if eval "test -z \"\$$shlibpath_var\""; then
|
adam@0
|
1700 eval "$shlibpath_var=\"\$dir\""
|
adam@0
|
1701 else
|
adam@0
|
1702 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
|
adam@0
|
1703 fi
|
adam@0
|
1704 done
|
adam@0
|
1705
|
adam@0
|
1706 # This variable tells wrapper scripts just to set shlibpath_var
|
adam@0
|
1707 # rather than running their programs.
|
adam@0
|
1708 libtool_execute_magic="$magic"
|
adam@0
|
1709
|
adam@0
|
1710 # Check if any of the arguments is a wrapper script.
|
adam@0
|
1711 args=
|
adam@0
|
1712 for file
|
adam@0
|
1713 do
|
adam@0
|
1714 case $file in
|
adam@0
|
1715 -*) ;;
|
adam@0
|
1716 *)
|
adam@0
|
1717 # Do a test to see if this is really a libtool program.
|
adam@0
|
1718 if func_ltwrapper_script_p "$file"; then
|
adam@0
|
1719 func_source "$file"
|
adam@0
|
1720 # Transform arg to wrapped name.
|
adam@0
|
1721 file="$progdir/$program"
|
adam@0
|
1722 elif func_ltwrapper_executable_p "$file"; then
|
adam@0
|
1723 func_ltwrapper_scriptname "$file"
|
adam@0
|
1724 func_source "$func_ltwrapper_scriptname_result"
|
adam@0
|
1725 # Transform arg to wrapped name.
|
adam@0
|
1726 file="$progdir/$program"
|
adam@0
|
1727 fi
|
adam@0
|
1728 ;;
|
adam@0
|
1729 esac
|
adam@0
|
1730 # Quote arguments (to preserve shell metacharacters).
|
adam@0
|
1731 func_quote_for_eval "$file"
|
adam@0
|
1732 args="$args $func_quote_for_eval_result"
|
adam@0
|
1733 done
|
adam@0
|
1734
|
adam@0
|
1735 if test "X$opt_dry_run" = Xfalse; then
|
adam@0
|
1736 if test -n "$shlibpath_var"; then
|
adam@0
|
1737 # Export the shlibpath_var.
|
adam@0
|
1738 eval "export $shlibpath_var"
|
adam@0
|
1739 fi
|
adam@0
|
1740
|
adam@0
|
1741 # Restore saved environment variables
|
adam@0
|
1742 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
adam@0
|
1743 do
|
adam@0
|
1744 eval "if test \"\${save_$lt_var+set}\" = set; then
|
adam@0
|
1745 $lt_var=\$save_$lt_var; export $lt_var
|
adam@0
|
1746 else
|
adam@0
|
1747 $lt_unset $lt_var
|
adam@0
|
1748 fi"
|
adam@0
|
1749 done
|
adam@0
|
1750
|
adam@0
|
1751 # Now prepare to actually exec the command.
|
adam@0
|
1752 exec_cmd="\$cmd$args"
|
adam@0
|
1753 else
|
adam@0
|
1754 # Display what would be done.
|
adam@0
|
1755 if test -n "$shlibpath_var"; then
|
adam@0
|
1756 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
|
adam@0
|
1757 $ECHO "export $shlibpath_var"
|
adam@0
|
1758 fi
|
adam@0
|
1759 $ECHO "$cmd$args"
|
adam@0
|
1760 exit $EXIT_SUCCESS
|
adam@0
|
1761 fi
|
adam@0
|
1762 }
|
adam@0
|
1763
|
adam@0
|
1764 test "$mode" = execute && func_mode_execute ${1+"$@"}
|
adam@0
|
1765
|
adam@0
|
1766
|
adam@0
|
1767 # func_mode_finish arg...
|
adam@0
|
1768 func_mode_finish ()
|
adam@0
|
1769 {
|
adam@0
|
1770 $opt_debug
|
adam@0
|
1771 libdirs="$nonopt"
|
adam@0
|
1772 admincmds=
|
adam@0
|
1773
|
adam@0
|
1774 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
|
adam@0
|
1775 for dir
|
adam@0
|
1776 do
|
adam@0
|
1777 libdirs="$libdirs $dir"
|
adam@0
|
1778 done
|
adam@0
|
1779
|
adam@0
|
1780 for libdir in $libdirs; do
|
adam@0
|
1781 if test -n "$finish_cmds"; then
|
adam@0
|
1782 # Do each command in the finish commands.
|
adam@0
|
1783 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
|
adam@0
|
1784 '"$cmd"'"'
|
adam@0
|
1785 fi
|
adam@0
|
1786 if test -n "$finish_eval"; then
|
adam@0
|
1787 # Do the single finish_eval.
|
adam@0
|
1788 eval cmds=\"$finish_eval\"
|
adam@0
|
1789 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
|
adam@0
|
1790 $cmds"
|
adam@0
|
1791 fi
|
adam@0
|
1792 done
|
adam@0
|
1793 fi
|
adam@0
|
1794
|
adam@0
|
1795 # Exit here if they wanted silent mode.
|
adam@0
|
1796 $opt_silent && exit $EXIT_SUCCESS
|
adam@0
|
1797
|
adam@0
|
1798 $ECHO "X----------------------------------------------------------------------" | $Xsed
|
adam@0
|
1799 $ECHO "Libraries have been installed in:"
|
adam@0
|
1800 for libdir in $libdirs; do
|
adam@0
|
1801 $ECHO " $libdir"
|
adam@0
|
1802 done
|
adam@0
|
1803 $ECHO
|
adam@0
|
1804 $ECHO "If you ever happen to want to link against installed libraries"
|
adam@0
|
1805 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
|
adam@0
|
1806 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
|
adam@0
|
1807 $ECHO "flag during linking and do at least one of the following:"
|
adam@0
|
1808 if test -n "$shlibpath_var"; then
|
adam@0
|
1809 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
|
adam@0
|
1810 $ECHO " during execution"
|
adam@0
|
1811 fi
|
adam@0
|
1812 if test -n "$runpath_var"; then
|
adam@0
|
1813 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
|
adam@0
|
1814 $ECHO " during linking"
|
adam@0
|
1815 fi
|
adam@0
|
1816 if test -n "$hardcode_libdir_flag_spec"; then
|
adam@0
|
1817 libdir=LIBDIR
|
adam@0
|
1818 eval flag=\"$hardcode_libdir_flag_spec\"
|
adam@0
|
1819
|
adam@0
|
1820 $ECHO " - use the \`$flag' linker flag"
|
adam@0
|
1821 fi
|
adam@0
|
1822 if test -n "$admincmds"; then
|
adam@0
|
1823 $ECHO " - have your system administrator run these commands:$admincmds"
|
adam@0
|
1824 fi
|
adam@0
|
1825 if test -f /etc/ld.so.conf; then
|
adam@0
|
1826 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
|
adam@0
|
1827 fi
|
adam@0
|
1828 $ECHO
|
adam@0
|
1829
|
adam@0
|
1830 $ECHO "See any operating system documentation about shared libraries for"
|
adam@0
|
1831 case $host in
|
adam@0
|
1832 solaris2.[6789]|solaris2.1[0-9])
|
adam@0
|
1833 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
|
adam@0
|
1834 $ECHO "pages."
|
adam@0
|
1835 ;;
|
adam@0
|
1836 *)
|
adam@0
|
1837 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
|
adam@0
|
1838 ;;
|
adam@0
|
1839 esac
|
adam@0
|
1840 $ECHO "X----------------------------------------------------------------------" | $Xsed
|
adam@0
|
1841 exit $EXIT_SUCCESS
|
adam@0
|
1842 }
|
adam@0
|
1843
|
adam@0
|
1844 test "$mode" = finish && func_mode_finish ${1+"$@"}
|
adam@0
|
1845
|
adam@0
|
1846
|
adam@0
|
1847 # func_mode_install arg...
|
adam@0
|
1848 func_mode_install ()
|
adam@0
|
1849 {
|
adam@0
|
1850 $opt_debug
|
adam@0
|
1851 # There may be an optional sh(1) argument at the beginning of
|
adam@0
|
1852 # install_prog (especially on Windows NT).
|
adam@0
|
1853 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
|
adam@0
|
1854 # Allow the use of GNU shtool's install command.
|
adam@0
|
1855 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
|
adam@0
|
1856 # Aesthetically quote it.
|
adam@0
|
1857 func_quote_for_eval "$nonopt"
|
adam@0
|
1858 install_prog="$func_quote_for_eval_result "
|
adam@0
|
1859 arg=$1
|
adam@0
|
1860 shift
|
adam@0
|
1861 else
|
adam@0
|
1862 install_prog=
|
adam@0
|
1863 arg=$nonopt
|
adam@0
|
1864 fi
|
adam@0
|
1865
|
adam@0
|
1866 # The real first argument should be the name of the installation program.
|
adam@0
|
1867 # Aesthetically quote it.
|
adam@0
|
1868 func_quote_for_eval "$arg"
|
adam@0
|
1869 install_prog="$install_prog$func_quote_for_eval_result"
|
adam@0
|
1870
|
adam@0
|
1871 # We need to accept at least all the BSD install flags.
|
adam@0
|
1872 dest=
|
adam@0
|
1873 files=
|
adam@0
|
1874 opts=
|
adam@0
|
1875 prev=
|
adam@0
|
1876 install_type=
|
adam@0
|
1877 isdir=no
|
adam@0
|
1878 stripme=
|
adam@0
|
1879 for arg
|
adam@0
|
1880 do
|
adam@0
|
1881 if test -n "$dest"; then
|
adam@0
|
1882 files="$files $dest"
|
adam@0
|
1883 dest=$arg
|
adam@0
|
1884 continue
|
adam@0
|
1885 fi
|
adam@0
|
1886
|
adam@0
|
1887 case $arg in
|
adam@0
|
1888 -d) isdir=yes ;;
|
adam@0
|
1889 -f)
|
adam@0
|
1890 case " $install_prog " in
|
adam@0
|
1891 *[\\\ /]cp\ *) ;;
|
adam@0
|
1892 *) prev=$arg ;;
|
adam@0
|
1893 esac
|
adam@0
|
1894 ;;
|
adam@0
|
1895 -g | -m | -o)
|
adam@0
|
1896 prev=$arg
|
adam@0
|
1897 ;;
|
adam@0
|
1898 -s)
|
adam@0
|
1899 stripme=" -s"
|
adam@0
|
1900 continue
|
adam@0
|
1901 ;;
|
adam@0
|
1902 -*)
|
adam@0
|
1903 ;;
|
adam@0
|
1904 *)
|
adam@0
|
1905 # If the previous option needed an argument, then skip it.
|
adam@0
|
1906 if test -n "$prev"; then
|
adam@0
|
1907 prev=
|
adam@0
|
1908 else
|
adam@0
|
1909 dest=$arg
|
adam@0
|
1910 continue
|
adam@0
|
1911 fi
|
adam@0
|
1912 ;;
|
adam@0
|
1913 esac
|
adam@0
|
1914
|
adam@0
|
1915 # Aesthetically quote the argument.
|
adam@0
|
1916 func_quote_for_eval "$arg"
|
adam@0
|
1917 install_prog="$install_prog $func_quote_for_eval_result"
|
adam@0
|
1918 done
|
adam@0
|
1919
|
adam@0
|
1920 test -z "$install_prog" && \
|
adam@0
|
1921 func_fatal_help "you must specify an install program"
|
adam@0
|
1922
|
adam@0
|
1923 test -n "$prev" && \
|
adam@0
|
1924 func_fatal_help "the \`$prev' option requires an argument"
|
adam@0
|
1925
|
adam@0
|
1926 if test -z "$files"; then
|
adam@0
|
1927 if test -z "$dest"; then
|
adam@0
|
1928 func_fatal_help "no file or destination specified"
|
adam@0
|
1929 else
|
adam@0
|
1930 func_fatal_help "you must specify a destination"
|
adam@0
|
1931 fi
|
adam@0
|
1932 fi
|
adam@0
|
1933
|
adam@0
|
1934 # Strip any trailing slash from the destination.
|
adam@0
|
1935 func_stripname '' '/' "$dest"
|
adam@0
|
1936 dest=$func_stripname_result
|
adam@0
|
1937
|
adam@0
|
1938 # Check to see that the destination is a directory.
|
adam@0
|
1939 test -d "$dest" && isdir=yes
|
adam@0
|
1940 if test "$isdir" = yes; then
|
adam@0
|
1941 destdir="$dest"
|
adam@0
|
1942 destname=
|
adam@0
|
1943 else
|
adam@0
|
1944 func_dirname_and_basename "$dest" "" "."
|
adam@0
|
1945 destdir="$func_dirname_result"
|
adam@0
|
1946 destname="$func_basename_result"
|
adam@0
|
1947
|
adam@0
|
1948 # Not a directory, so check to see that there is only one file specified.
|
adam@0
|
1949 set dummy $files; shift
|
adam@0
|
1950 test "$#" -gt 1 && \
|
adam@0
|
1951 func_fatal_help "\`$dest' is not a directory"
|
adam@0
|
1952 fi
|
adam@0
|
1953 case $destdir in
|
adam@0
|
1954 [\\/]* | [A-Za-z]:[\\/]*) ;;
|
adam@0
|
1955 *)
|
adam@0
|
1956 for file in $files; do
|
adam@0
|
1957 case $file in
|
adam@0
|
1958 *.lo) ;;
|
adam@0
|
1959 *)
|
adam@0
|
1960 func_fatal_help "\`$destdir' must be an absolute directory name"
|
adam@0
|
1961 ;;
|
adam@0
|
1962 esac
|
adam@0
|
1963 done
|
adam@0
|
1964 ;;
|
adam@0
|
1965 esac
|
adam@0
|
1966
|
adam@0
|
1967 # This variable tells wrapper scripts just to set variables rather
|
adam@0
|
1968 # than running their programs.
|
adam@0
|
1969 libtool_install_magic="$magic"
|
adam@0
|
1970
|
adam@0
|
1971 staticlibs=
|
adam@0
|
1972 future_libdirs=
|
adam@0
|
1973 current_libdirs=
|
adam@0
|
1974 for file in $files; do
|
adam@0
|
1975
|
adam@0
|
1976 # Do each installation.
|
adam@0
|
1977 case $file in
|
adam@0
|
1978 *.$libext)
|
adam@0
|
1979 # Do the static libraries later.
|
adam@0
|
1980 staticlibs="$staticlibs $file"
|
adam@0
|
1981 ;;
|
adam@0
|
1982
|
adam@0
|
1983 *.la)
|
adam@0
|
1984 # Check to see that this really is a libtool archive.
|
adam@0
|
1985 func_lalib_unsafe_p "$file" \
|
adam@0
|
1986 || func_fatal_help "\`$file' is not a valid libtool archive"
|
adam@0
|
1987
|
adam@0
|
1988 library_names=
|
adam@0
|
1989 old_library=
|
adam@0
|
1990 relink_command=
|
adam@0
|
1991 func_source "$file"
|
adam@0
|
1992
|
adam@0
|
1993 # Add the libdir to current_libdirs if it is the destination.
|
adam@0
|
1994 if test "X$destdir" = "X$libdir"; then
|
adam@0
|
1995 case "$current_libdirs " in
|
adam@0
|
1996 *" $libdir "*) ;;
|
adam@0
|
1997 *) current_libdirs="$current_libdirs $libdir" ;;
|
adam@0
|
1998 esac
|
adam@0
|
1999 else
|
adam@0
|
2000 # Note the libdir as a future libdir.
|
adam@0
|
2001 case "$future_libdirs " in
|
adam@0
|
2002 *" $libdir "*) ;;
|
adam@0
|
2003 *) future_libdirs="$future_libdirs $libdir" ;;
|
adam@0
|
2004 esac
|
adam@0
|
2005 fi
|
adam@0
|
2006
|
adam@0
|
2007 func_dirname "$file" "/" ""
|
adam@0
|
2008 dir="$func_dirname_result"
|
adam@0
|
2009 dir="$dir$objdir"
|
adam@0
|
2010
|
adam@0
|
2011 if test -n "$relink_command"; then
|
adam@0
|
2012 # Determine the prefix the user has applied to our future dir.
|
adam@0
|
2013 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
|
adam@0
|
2014
|
adam@0
|
2015 # Don't allow the user to place us outside of our expected
|
adam@0
|
2016 # location b/c this prevents finding dependent libraries that
|
adam@0
|
2017 # are installed to the same prefix.
|
adam@0
|
2018 # At present, this check doesn't affect windows .dll's that
|
adam@0
|
2019 # are installed into $libdir/../bin (currently, that works fine)
|
adam@0
|
2020 # but it's something to keep an eye on.
|
adam@0
|
2021 test "$inst_prefix_dir" = "$destdir" && \
|
adam@0
|
2022 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
|
adam@0
|
2023
|
adam@0
|
2024 if test -n "$inst_prefix_dir"; then
|
adam@0
|
2025 # Stick the inst_prefix_dir data into the link command.
|
adam@0
|
2026 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
|
adam@0
|
2027 else
|
adam@0
|
2028 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
|
adam@0
|
2029 fi
|
adam@0
|
2030
|
adam@0
|
2031 func_warning "relinking \`$file'"
|
adam@0
|
2032 func_show_eval "$relink_command" \
|
adam@0
|
2033 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
|
adam@0
|
2034 fi
|
adam@0
|
2035
|
adam@0
|
2036 # See the names of the shared library.
|
adam@0
|
2037 set dummy $library_names; shift
|
adam@0
|
2038 if test -n "$1"; then
|
adam@0
|
2039 realname="$1"
|
adam@0
|
2040 shift
|
adam@0
|
2041
|
adam@0
|
2042 srcname="$realname"
|
adam@0
|
2043 test -n "$relink_command" && srcname="$realname"T
|
adam@0
|
2044
|
adam@0
|
2045 # Install the shared library and build the symlinks.
|
adam@0
|
2046 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
|
adam@0
|
2047 'exit $?'
|
adam@0
|
2048 tstripme="$stripme"
|
adam@0
|
2049 case $host_os in
|
adam@0
|
2050 cygwin* | mingw* | pw32* | cegcc*)
|
adam@0
|
2051 case $realname in
|
adam@0
|
2052 *.dll.a)
|
adam@0
|
2053 tstripme=""
|
adam@0
|
2054 ;;
|
adam@0
|
2055 esac
|
adam@0
|
2056 ;;
|
adam@0
|
2057 esac
|
adam@0
|
2058 if test -n "$tstripme" && test -n "$striplib"; then
|
adam@0
|
2059 func_show_eval "$striplib $destdir/$realname" 'exit $?'
|
adam@0
|
2060 fi
|
adam@0
|
2061
|
adam@0
|
2062 if test "$#" -gt 0; then
|
adam@0
|
2063 # Delete the old symlinks, and create new ones.
|
adam@0
|
2064 # Try `ln -sf' first, because the `ln' binary might depend on
|
adam@0
|
2065 # the symlink we replace! Solaris /bin/ln does not understand -f,
|
adam@0
|
2066 # so we also need to try rm && ln -s.
|
adam@0
|
2067 for linkname
|
adam@0
|
2068 do
|
adam@0
|
2069 test "$linkname" != "$realname" \
|
adam@0
|
2070 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
|
adam@0
|
2071 done
|
adam@0
|
2072 fi
|
adam@0
|
2073
|
adam@0
|
2074 # Do each command in the postinstall commands.
|
adam@0
|
2075 lib="$destdir/$realname"
|
adam@0
|
2076 func_execute_cmds "$postinstall_cmds" 'exit $?'
|
adam@0
|
2077 fi
|
adam@0
|
2078
|
adam@0
|
2079 # Install the pseudo-library for information purposes.
|
adam@0
|
2080 func_basename "$file"
|
adam@0
|
2081 name="$func_basename_result"
|
adam@0
|
2082 instname="$dir/$name"i
|
adam@0
|
2083 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
|
adam@0
|
2084
|
adam@0
|
2085 # Maybe install the static library, too.
|
adam@0
|
2086 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
|
adam@0
|
2087 ;;
|
adam@0
|
2088
|
adam@0
|
2089 *.lo)
|
adam@0
|
2090 # Install (i.e. copy) a libtool object.
|
adam@0
|
2091
|
adam@0
|
2092 # Figure out destination file name, if it wasn't already specified.
|
adam@0
|
2093 if test -n "$destname"; then
|
adam@0
|
2094 destfile="$destdir/$destname"
|
adam@0
|
2095 else
|
adam@0
|
2096 func_basename "$file"
|
adam@0
|
2097 destfile="$func_basename_result"
|
adam@0
|
2098 destfile="$destdir/$destfile"
|
adam@0
|
2099 fi
|
adam@0
|
2100
|
adam@0
|
2101 # Deduce the name of the destination old-style object file.
|
adam@0
|
2102 case $destfile in
|
adam@0
|
2103 *.lo)
|
adam@0
|
2104 func_lo2o "$destfile"
|
adam@0
|
2105 staticdest=$func_lo2o_result
|
adam@0
|
2106 ;;
|
adam@0
|
2107 *.$objext)
|
adam@0
|
2108 staticdest="$destfile"
|
adam@0
|
2109 destfile=
|
adam@0
|
2110 ;;
|
adam@0
|
2111 *)
|
adam@0
|
2112 func_fatal_help "cannot copy a libtool object to \`$destfile'"
|
adam@0
|
2113 ;;
|
adam@0
|
2114 esac
|
adam@0
|
2115
|
adam@0
|
2116 # Install the libtool object if requested.
|
adam@0
|
2117 test -n "$destfile" && \
|
adam@0
|
2118 func_show_eval "$install_prog $file $destfile" 'exit $?'
|
adam@0
|
2119
|
adam@0
|
2120 # Install the old object if enabled.
|
adam@0
|
2121 if test "$build_old_libs" = yes; then
|
adam@0
|
2122 # Deduce the name of the old-style object file.
|
adam@0
|
2123 func_lo2o "$file"
|
adam@0
|
2124 staticobj=$func_lo2o_result
|
adam@0
|
2125 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
|
adam@0
|
2126 fi
|
adam@0
|
2127 exit $EXIT_SUCCESS
|
adam@0
|
2128 ;;
|
adam@0
|
2129
|
adam@0
|
2130 *)
|
adam@0
|
2131 # Figure out destination file name, if it wasn't already specified.
|
adam@0
|
2132 if test -n "$destname"; then
|
adam@0
|
2133 destfile="$destdir/$destname"
|
adam@0
|
2134 else
|
adam@0
|
2135 func_basename "$file"
|
adam@0
|
2136 destfile="$func_basename_result"
|
adam@0
|
2137 destfile="$destdir/$destfile"
|
adam@0
|
2138 fi
|
adam@0
|
2139
|
adam@0
|
2140 # If the file is missing, and there is a .exe on the end, strip it
|
adam@0
|
2141 # because it is most likely a libtool script we actually want to
|
adam@0
|
2142 # install
|
adam@0
|
2143 stripped_ext=""
|
adam@0
|
2144 case $file in
|
adam@0
|
2145 *.exe)
|
adam@0
|
2146 if test ! -f "$file"; then
|
adam@0
|
2147 func_stripname '' '.exe' "$file"
|
adam@0
|
2148 file=$func_stripname_result
|
adam@0
|
2149 stripped_ext=".exe"
|
adam@0
|
2150 fi
|
adam@0
|
2151 ;;
|
adam@0
|
2152 esac
|
adam@0
|
2153
|
adam@0
|
2154 # Do a test to see if this is really a libtool program.
|
adam@0
|
2155 case $host in
|
adam@0
|
2156 *cygwin* | *mingw*)
|
adam@0
|
2157 if func_ltwrapper_executable_p "$file"; then
|
adam@0
|
2158 func_ltwrapper_scriptname "$file"
|
adam@0
|
2159 wrapper=$func_ltwrapper_scriptname_result
|
adam@0
|
2160 else
|
adam@0
|
2161 func_stripname '' '.exe' "$file"
|
adam@0
|
2162 wrapper=$func_stripname_result
|
adam@0
|
2163 fi
|
adam@0
|
2164 ;;
|
adam@0
|
2165 *)
|
adam@0
|
2166 wrapper=$file
|
adam@0
|
2167 ;;
|
adam@0
|
2168 esac
|
adam@0
|
2169 if func_ltwrapper_script_p "$wrapper"; then
|
adam@0
|
2170 notinst_deplibs=
|
adam@0
|
2171 relink_command=
|
adam@0
|
2172
|
adam@0
|
2173 func_source "$wrapper"
|
adam@0
|
2174
|
adam@0
|
2175 # Check the variables that should have been set.
|
adam@0
|
2176 test -z "$generated_by_libtool_version" && \
|
adam@0
|
2177 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
|
adam@0
|
2178
|
adam@0
|
2179 finalize=yes
|
adam@0
|
2180 for lib in $notinst_deplibs; do
|
adam@0
|
2181 # Check to see that each library is installed.
|
adam@0
|
2182 libdir=
|
adam@0
|
2183 if test -f "$lib"; then
|
adam@0
|
2184 func_source "$lib"
|
adam@0
|
2185 fi
|
adam@0
|
2186 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
|
adam@0
|
2187 if test -n "$libdir" && test ! -f "$libfile"; then
|
adam@0
|
2188 func_warning "\`$lib' has not been installed in \`$libdir'"
|
adam@0
|
2189 finalize=no
|
adam@0
|
2190 fi
|
adam@0
|
2191 done
|
adam@0
|
2192
|
adam@0
|
2193 relink_command=
|
adam@0
|
2194 func_source "$wrapper"
|
adam@0
|
2195
|
adam@0
|
2196 outputname=
|
adam@0
|
2197 if test "$fast_install" = no && test -n "$relink_command"; then
|
adam@0
|
2198 $opt_dry_run || {
|
adam@0
|
2199 if test "$finalize" = yes; then
|
adam@0
|
2200 tmpdir=`func_mktempdir`
|
adam@0
|
2201 func_basename "$file$stripped_ext"
|
adam@0
|
2202 file="$func_basename_result"
|
adam@0
|
2203 outputname="$tmpdir/$file"
|
adam@0
|
2204 # Replace the output file specification.
|
adam@0
|
2205 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
|
adam@0
|
2206
|
adam@0
|
2207 $opt_silent || {
|
adam@0
|
2208 func_quote_for_expand "$relink_command"
|
adam@0
|
2209 eval "func_echo $func_quote_for_expand_result"
|
adam@0
|
2210 }
|
adam@0
|
2211 if eval "$relink_command"; then :
|
adam@0
|
2212 else
|
adam@0
|
2213 func_error "error: relink \`$file' with the above command before installing it"
|
adam@0
|
2214 $opt_dry_run || ${RM}r "$tmpdir"
|
adam@0
|
2215 continue
|
adam@0
|
2216 fi
|
adam@0
|
2217 file="$outputname"
|
adam@0
|
2218 else
|
adam@0
|
2219 func_warning "cannot relink \`$file'"
|
adam@0
|
2220 fi
|
adam@0
|
2221 }
|
adam@0
|
2222 else
|
adam@0
|
2223 # Install the binary that we compiled earlier.
|
adam@0
|
2224 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
|
adam@0
|
2225 fi
|
adam@0
|
2226 fi
|
adam@0
|
2227
|
adam@0
|
2228 # remove .exe since cygwin /usr/bin/install will append another
|
adam@0
|
2229 # one anyway
|
adam@0
|
2230 case $install_prog,$host in
|
adam@0
|
2231 */usr/bin/install*,*cygwin*)
|
adam@0
|
2232 case $file:$destfile in
|
adam@0
|
2233 *.exe:*.exe)
|
adam@0
|
2234 # this is ok
|
adam@0
|
2235 ;;
|
adam@0
|
2236 *.exe:*)
|
adam@0
|
2237 destfile=$destfile.exe
|
adam@0
|
2238 ;;
|
adam@0
|
2239 *:*.exe)
|
adam@0
|
2240 func_stripname '' '.exe' "$destfile"
|
adam@0
|
2241 destfile=$func_stripname_result
|
adam@0
|
2242 ;;
|
adam@0
|
2243 esac
|
adam@0
|
2244 ;;
|
adam@0
|
2245 esac
|
adam@0
|
2246 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
|
adam@0
|
2247 $opt_dry_run || if test -n "$outputname"; then
|
adam@0
|
2248 ${RM}r "$tmpdir"
|
adam@0
|
2249 fi
|
adam@0
|
2250 ;;
|
adam@0
|
2251 esac
|
adam@0
|
2252 done
|
adam@0
|
2253
|
adam@0
|
2254 for file in $staticlibs; do
|
adam@0
|
2255 func_basename "$file"
|
adam@0
|
2256 name="$func_basename_result"
|
adam@0
|
2257
|
adam@0
|
2258 # Set up the ranlib parameters.
|
adam@0
|
2259 oldlib="$destdir/$name"
|
adam@0
|
2260
|
adam@0
|
2261 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
|
adam@0
|
2262
|
adam@0
|
2263 if test -n "$stripme" && test -n "$old_striplib"; then
|
adam@0
|
2264 func_show_eval "$old_striplib $oldlib" 'exit $?'
|
adam@0
|
2265 fi
|
adam@0
|
2266
|
adam@0
|
2267 # Do each command in the postinstall commands.
|
adam@0
|
2268 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
|
adam@0
|
2269 done
|
adam@0
|
2270
|
adam@0
|
2271 test -n "$future_libdirs" && \
|
adam@0
|
2272 func_warning "remember to run \`$progname --finish$future_libdirs'"
|
adam@0
|
2273
|
adam@0
|
2274 if test -n "$current_libdirs"; then
|
adam@0
|
2275 # Maybe just do a dry run.
|
adam@0
|
2276 $opt_dry_run && current_libdirs=" -n$current_libdirs"
|
adam@0
|
2277 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
|
adam@0
|
2278 else
|
adam@0
|
2279 exit $EXIT_SUCCESS
|
adam@0
|
2280 fi
|
adam@0
|
2281 }
|
adam@0
|
2282
|
adam@0
|
2283 test "$mode" = install && func_mode_install ${1+"$@"}
|
adam@0
|
2284
|
adam@0
|
2285
|
adam@0
|
2286 # func_generate_dlsyms outputname originator pic_p
|
adam@0
|
2287 # Extract symbols from dlprefiles and create ${outputname}S.o with
|
adam@0
|
2288 # a dlpreopen symbol table.
|
adam@0
|
2289 func_generate_dlsyms ()
|
adam@0
|
2290 {
|
adam@0
|
2291 $opt_debug
|
adam@0
|
2292 my_outputname="$1"
|
adam@0
|
2293 my_originator="$2"
|
adam@0
|
2294 my_pic_p="${3-no}"
|
adam@0
|
2295 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
|
adam@0
|
2296 my_dlsyms=
|
adam@0
|
2297
|
adam@0
|
2298 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
|
adam@0
|
2299 if test -n "$NM" && test -n "$global_symbol_pipe"; then
|
adam@0
|
2300 my_dlsyms="${my_outputname}S.c"
|
adam@0
|
2301 else
|
adam@0
|
2302 func_error "not configured to extract global symbols from dlpreopened files"
|
adam@0
|
2303 fi
|
adam@0
|
2304 fi
|
adam@0
|
2305
|
adam@0
|
2306 if test -n "$my_dlsyms"; then
|
adam@0
|
2307 case $my_dlsyms in
|
adam@0
|
2308 "") ;;
|
adam@0
|
2309 *.c)
|
adam@0
|
2310 # Discover the nlist of each of the dlfiles.
|
adam@0
|
2311 nlist="$output_objdir/${my_outputname}.nm"
|
adam@0
|
2312
|
adam@0
|
2313 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
|
adam@0
|
2314
|
adam@0
|
2315 # Parse the name list into a source file.
|
adam@0
|
2316 func_verbose "creating $output_objdir/$my_dlsyms"
|
adam@0
|
2317
|
adam@0
|
2318 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
|
adam@0
|
2319 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
|
adam@0
|
2320 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
|
adam@0
|
2321
|
adam@0
|
2322 #ifdef __cplusplus
|
adam@0
|
2323 extern \"C\" {
|
adam@0
|
2324 #endif
|
adam@0
|
2325
|
adam@0
|
2326 /* External symbol declarations for the compiler. */\
|
adam@0
|
2327 "
|
adam@0
|
2328
|
adam@0
|
2329 if test "$dlself" = yes; then
|
adam@0
|
2330 func_verbose "generating symbol list for \`$output'"
|
adam@0
|
2331
|
adam@0
|
2332 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
|
adam@0
|
2333
|
adam@0
|
2334 # Add our own program objects to the symbol list.
|
adam@0
|
2335 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
|
adam@0
|
2336 for progfile in $progfiles; do
|
adam@0
|
2337 func_verbose "extracting global C symbols from \`$progfile'"
|
adam@0
|
2338 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
|
adam@0
|
2339 done
|
adam@0
|
2340
|
adam@0
|
2341 if test -n "$exclude_expsyms"; then
|
adam@0
|
2342 $opt_dry_run || {
|
adam@0
|
2343 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
|
adam@0
|
2344 eval '$MV "$nlist"T "$nlist"'
|
adam@0
|
2345 }
|
adam@0
|
2346 fi
|
adam@0
|
2347
|
adam@0
|
2348 if test -n "$export_symbols_regex"; then
|
adam@0
|
2349 $opt_dry_run || {
|
adam@0
|
2350 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
|
adam@0
|
2351 eval '$MV "$nlist"T "$nlist"'
|
adam@0
|
2352 }
|
adam@0
|
2353 fi
|
adam@0
|
2354
|
adam@0
|
2355 # Prepare the list of exported symbols
|
adam@0
|
2356 if test -z "$export_symbols"; then
|
adam@0
|
2357 export_symbols="$output_objdir/$outputname.exp"
|
adam@0
|
2358 $opt_dry_run || {
|
adam@0
|
2359 $RM $export_symbols
|
adam@0
|
2360 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
|
adam@0
|
2361 case $host in
|
adam@0
|
2362 *cygwin* | *mingw* | *cegcc* )
|
adam@0
|
2363 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
|
adam@0
|
2364 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
|
adam@0
|
2365 ;;
|
adam@0
|
2366 esac
|
adam@0
|
2367 }
|
adam@0
|
2368 else
|
adam@0
|
2369 $opt_dry_run || {
|
adam@0
|
2370 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
|
adam@0
|
2371 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
|
adam@0
|
2372 eval '$MV "$nlist"T "$nlist"'
|
adam@0
|
2373 case $host in
|
adam@0
|
2374 *cygwin | *mingw* | *cegcc* )
|
adam@0
|
2375 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
|
adam@0
|
2376 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
|
adam@0
|
2377 ;;
|
adam@0
|
2378 esac
|
adam@0
|
2379 }
|
adam@0
|
2380 fi
|
adam@0
|
2381 fi
|
adam@0
|
2382
|
adam@0
|
2383 for dlprefile in $dlprefiles; do
|
adam@0
|
2384 func_verbose "extracting global C symbols from \`$dlprefile'"
|
adam@0
|
2385 func_basename "$dlprefile"
|
adam@0
|
2386 name="$func_basename_result"
|
adam@0
|
2387 $opt_dry_run || {
|
adam@0
|
2388 eval '$ECHO ": $name " >> "$nlist"'
|
adam@0
|
2389 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
|
adam@0
|
2390 }
|
adam@0
|
2391 done
|
adam@0
|
2392
|
adam@0
|
2393 $opt_dry_run || {
|
adam@0
|
2394 # Make sure we have at least an empty file.
|
adam@0
|
2395 test -f "$nlist" || : > "$nlist"
|
adam@0
|
2396
|
adam@0
|
2397 if test -n "$exclude_expsyms"; then
|
adam@0
|
2398 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
|
adam@0
|
2399 $MV "$nlist"T "$nlist"
|
adam@0
|
2400 fi
|
adam@0
|
2401
|
adam@0
|
2402 # Try sorting and uniquifying the output.
|
adam@0
|
2403 if $GREP -v "^: " < "$nlist" |
|
adam@0
|
2404 if sort -k 3 </dev/null >/dev/null 2>&1; then
|
adam@0
|
2405 sort -k 3
|
adam@0
|
2406 else
|
adam@0
|
2407 sort +2
|
adam@0
|
2408 fi |
|
adam@0
|
2409 uniq > "$nlist"S; then
|
adam@0
|
2410 :
|
adam@0
|
2411 else
|
adam@0
|
2412 $GREP -v "^: " < "$nlist" > "$nlist"S
|
adam@0
|
2413 fi
|
adam@0
|
2414
|
adam@0
|
2415 if test -f "$nlist"S; then
|
adam@0
|
2416 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
|
adam@0
|
2417 else
|
adam@0
|
2418 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
|
adam@0
|
2419 fi
|
adam@0
|
2420
|
adam@0
|
2421 $ECHO >> "$output_objdir/$my_dlsyms" "\
|
adam@0
|
2422
|
adam@0
|
2423 /* The mapping between symbol names and symbols. */
|
adam@0
|
2424 typedef struct {
|
adam@0
|
2425 const char *name;
|
adam@0
|
2426 void *address;
|
adam@0
|
2427 } lt_dlsymlist;
|
adam@0
|
2428 "
|
adam@0
|
2429 case $host in
|
adam@0
|
2430 *cygwin* | *mingw* | *cegcc* )
|
adam@0
|
2431 $ECHO >> "$output_objdir/$my_dlsyms" "\
|
adam@0
|
2432 /* DATA imports from DLLs on WIN32 con't be const, because
|
adam@0
|
2433 runtime relocations are performed -- see ld's documentation
|
adam@0
|
2434 on pseudo-relocs. */"
|
adam@0
|
2435 lt_dlsym_const= ;;
|
adam@0
|
2436 *osf5*)
|
adam@0
|
2437 echo >> "$output_objdir/$my_dlsyms" "\
|
adam@0
|
2438 /* This system does not cope well with relocations in const data */"
|
adam@0
|
2439 lt_dlsym_const= ;;
|
adam@0
|
2440 *)
|
adam@0
|
2441 lt_dlsym_const=const ;;
|
adam@0
|
2442 esac
|
adam@0
|
2443
|
adam@0
|
2444 $ECHO >> "$output_objdir/$my_dlsyms" "\
|
adam@0
|
2445 extern $lt_dlsym_const lt_dlsymlist
|
adam@0
|
2446 lt_${my_prefix}_LTX_preloaded_symbols[];
|
adam@0
|
2447 $lt_dlsym_const lt_dlsymlist
|
adam@0
|
2448 lt_${my_prefix}_LTX_preloaded_symbols[] =
|
adam@0
|
2449 {\
|
adam@0
|
2450 { \"$my_originator\", (void *) 0 },"
|
adam@0
|
2451
|
adam@0
|
2452 case $need_lib_prefix in
|
adam@0
|
2453 no)
|
adam@0
|
2454 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
|
adam@0
|
2455 ;;
|
adam@0
|
2456 *)
|
adam@0
|
2457 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
|
adam@0
|
2458 ;;
|
adam@0
|
2459 esac
|
adam@0
|
2460 $ECHO >> "$output_objdir/$my_dlsyms" "\
|
adam@0
|
2461 {0, (void *) 0}
|
adam@0
|
2462 };
|
adam@0
|
2463
|
adam@0
|
2464 /* This works around a problem in FreeBSD linker */
|
adam@0
|
2465 #ifdef FREEBSD_WORKAROUND
|
adam@0
|
2466 static const void *lt_preloaded_setup() {
|
adam@0
|
2467 return lt_${my_prefix}_LTX_preloaded_symbols;
|
adam@0
|
2468 }
|
adam@0
|
2469 #endif
|
adam@0
|
2470
|
adam@0
|
2471 #ifdef __cplusplus
|
adam@0
|
2472 }
|
adam@0
|
2473 #endif\
|
adam@0
|
2474 "
|
adam@0
|
2475 } # !$opt_dry_run
|
adam@0
|
2476
|
adam@0
|
2477 pic_flag_for_symtable=
|
adam@0
|
2478 case "$compile_command " in
|
adam@0
|
2479 *" -static "*) ;;
|
adam@0
|
2480 *)
|
adam@0
|
2481 case $host in
|
adam@0
|
2482 # compiling the symbol table file with pic_flag works around
|
adam@0
|
2483 # a FreeBSD bug that causes programs to crash when -lm is
|
adam@0
|
2484 # linked before any other PIC object. But we must not use
|
adam@0
|
2485 # pic_flag when linking with -static. The problem exists in
|
adam@0
|
2486 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
|
adam@0
|
2487 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
|
adam@0
|
2488 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
|
adam@0
|
2489 *-*-hpux*)
|
adam@0
|
2490 pic_flag_for_symtable=" $pic_flag" ;;
|
adam@0
|
2491 *)
|
adam@0
|
2492 if test "X$my_pic_p" != Xno; then
|
adam@0
|
2493 pic_flag_for_symtable=" $pic_flag"
|
adam@0
|
2494 fi
|
adam@0
|
2495 ;;
|
adam@0
|
2496 esac
|
adam@0
|
2497 ;;
|
adam@0
|
2498 esac
|
adam@0
|
2499 symtab_cflags=
|
adam@0
|
2500 for arg in $LTCFLAGS; do
|
adam@0
|
2501 case $arg in
|
adam@0
|
2502 -pie | -fpie | -fPIE) ;;
|
adam@0
|
2503 *) symtab_cflags="$symtab_cflags $arg" ;;
|
adam@0
|
2504 esac
|
adam@0
|
2505 done
|
adam@0
|
2506
|
adam@0
|
2507 # Now compile the dynamic symbol file.
|
adam@0
|
2508 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
|
adam@0
|
2509
|
adam@0
|
2510 # Clean up the generated files.
|
adam@0
|
2511 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
|
adam@0
|
2512
|
adam@0
|
2513 # Transform the symbol file into the correct name.
|
adam@0
|
2514 symfileobj="$output_objdir/${my_outputname}S.$objext"
|
adam@0
|
2515 case $host in
|
adam@0
|
2516 *cygwin* | *mingw* | *cegcc* )
|
adam@0
|
2517 if test -f "$output_objdir/$my_outputname.def"; then
|
adam@0
|
2518 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
|
adam@0
|
2519 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
|
adam@0
|
2520 else
|
adam@0
|
2521 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
|
adam@0
|
2522 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
|
adam@0
|
2523 fi
|
adam@0
|
2524 ;;
|
adam@0
|
2525 *)
|
adam@0
|
2526 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
|
adam@0
|
2527 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
|
adam@0
|
2528 ;;
|
adam@0
|
2529 esac
|
adam@0
|
2530 ;;
|
adam@0
|
2531 *)
|
adam@0
|
2532 func_fatal_error "unknown suffix for \`$my_dlsyms'"
|
adam@0
|
2533 ;;
|
adam@0
|
2534 esac
|
adam@0
|
2535 else
|
adam@0
|
2536 # We keep going just in case the user didn't refer to
|
adam@0
|
2537 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
|
adam@0
|
2538 # really was required.
|
adam@0
|
2539
|
adam@0
|
2540 # Nullify the symbol file.
|
adam@0
|
2541 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
|
adam@0
|
2542 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
|
adam@0
|
2543 fi
|
adam@0
|
2544 }
|
adam@0
|
2545
|
adam@0
|
2546 # func_win32_libid arg
|
adam@0
|
2547 # return the library type of file 'arg'
|
adam@0
|
2548 #
|
adam@0
|
2549 # Need a lot of goo to handle *both* DLLs and import libs
|
adam@0
|
2550 # Has to be a shell function in order to 'eat' the argument
|
adam@0
|
2551 # that is supplied when $file_magic_command is called.
|
adam@0
|
2552 func_win32_libid ()
|
adam@0
|
2553 {
|
adam@0
|
2554 $opt_debug
|
adam@0
|
2555 win32_libid_type="unknown"
|
adam@0
|
2556 win32_fileres=`file -L $1 2>/dev/null`
|
adam@0
|
2557 case $win32_fileres in
|
adam@0
|
2558 *ar\ archive\ import\ library*) # definitely import
|
adam@0
|
2559 win32_libid_type="x86 archive import"
|
adam@0
|
2560 ;;
|
adam@0
|
2561 *ar\ archive*) # could be an import, or static
|
adam@0
|
2562 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
|
adam@0
|
2563 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
|
adam@0
|
2564 win32_nmres=`eval $NM -f posix -A $1 |
|
adam@0
|
2565 $SED -n -e '
|
adam@0
|
2566 1,100{
|
adam@0
|
2567 / I /{
|
adam@0
|
2568 s,.*,import,
|
adam@0
|
2569 p
|
adam@0
|
2570 q
|
adam@0
|
2571 }
|
adam@0
|
2572 }'`
|
adam@0
|
2573 case $win32_nmres in
|
adam@0
|
2574 import*) win32_libid_type="x86 archive import";;
|
adam@0
|
2575 *) win32_libid_type="x86 archive static";;
|
adam@0
|
2576 esac
|
adam@0
|
2577 fi
|
adam@0
|
2578 ;;
|
adam@0
|
2579 *DLL*)
|
adam@0
|
2580 win32_libid_type="x86 DLL"
|
adam@0
|
2581 ;;
|
adam@0
|
2582 *executable*) # but shell scripts are "executable" too...
|
adam@0
|
2583 case $win32_fileres in
|
adam@0
|
2584 *MS\ Windows\ PE\ Intel*)
|
adam@0
|
2585 win32_libid_type="x86 DLL"
|
adam@0
|
2586 ;;
|
adam@0
|
2587 esac
|
adam@0
|
2588 ;;
|
adam@0
|
2589 esac
|
adam@0
|
2590 $ECHO "$win32_libid_type"
|
adam@0
|
2591 }
|
adam@0
|
2592
|
adam@0
|
2593
|
adam@0
|
2594
|
adam@0
|
2595 # func_extract_an_archive dir oldlib
|
adam@0
|
2596 func_extract_an_archive ()
|
adam@0
|
2597 {
|
adam@0
|
2598 $opt_debug
|
adam@0
|
2599 f_ex_an_ar_dir="$1"; shift
|
adam@0
|
2600 f_ex_an_ar_oldlib="$1"
|
adam@0
|
2601 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
|
adam@0
|
2602 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
|
adam@0
|
2603 :
|
adam@0
|
2604 else
|
adam@0
|
2605 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
|
adam@0
|
2606 fi
|
adam@0
|
2607 }
|
adam@0
|
2608
|
adam@0
|
2609
|
adam@0
|
2610 # func_extract_archives gentop oldlib ...
|
adam@0
|
2611 func_extract_archives ()
|
adam@0
|
2612 {
|
adam@0
|
2613 $opt_debug
|
adam@0
|
2614 my_gentop="$1"; shift
|
adam@0
|
2615 my_oldlibs=${1+"$@"}
|
adam@0
|
2616 my_oldobjs=""
|
adam@0
|
2617 my_xlib=""
|
adam@0
|
2618 my_xabs=""
|
adam@0
|
2619 my_xdir=""
|
adam@0
|
2620
|
adam@0
|
2621 for my_xlib in $my_oldlibs; do
|
adam@0
|
2622 # Extract the objects.
|
adam@0
|
2623 case $my_xlib in
|
adam@0
|
2624 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
|
adam@0
|
2625 *) my_xabs=`pwd`"/$my_xlib" ;;
|
adam@0
|
2626 esac
|
adam@0
|
2627 func_basename "$my_xlib"
|
adam@0
|
2628 my_xlib="$func_basename_result"
|
adam@0
|
2629 my_xlib_u=$my_xlib
|
adam@0
|
2630 while :; do
|
adam@0
|
2631 case " $extracted_archives " in
|
adam@0
|
2632 *" $my_xlib_u "*)
|
adam@0
|
2633 func_arith $extracted_serial + 1
|
adam@0
|
2634 extracted_serial=$func_arith_result
|
adam@0
|
2635 my_xlib_u=lt$extracted_serial-$my_xlib ;;
|
adam@0
|
2636 *) break ;;
|
adam@0
|
2637 esac
|
adam@0
|
2638 done
|
adam@0
|
2639 extracted_archives="$extracted_archives $my_xlib_u"
|
adam@0
|
2640 my_xdir="$my_gentop/$my_xlib_u"
|
adam@0
|
2641
|
adam@0
|
2642 func_mkdir_p "$my_xdir"
|
adam@0
|
2643
|
adam@0
|
2644 case $host in
|
adam@0
|
2645 *-darwin*)
|
adam@0
|
2646 func_verbose "Extracting $my_xabs"
|
adam@0
|
2647 # Do not bother doing anything if just a dry run
|
adam@0
|
2648 $opt_dry_run || {
|
adam@0
|
2649 darwin_orig_dir=`pwd`
|
adam@0
|
2650 cd $my_xdir || exit $?
|
adam@0
|
2651 darwin_archive=$my_xabs
|
adam@0
|
2652 darwin_curdir=`pwd`
|
adam@0
|
2653 darwin_base_archive=`basename "$darwin_archive"`
|
adam@0
|
2654 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
|
adam@0
|
2655 if test -n "$darwin_arches"; then
|
adam@0
|
2656 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
|
adam@0
|
2657 darwin_arch=
|
adam@0
|
2658 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
|
adam@0
|
2659 for darwin_arch in $darwin_arches ; do
|
adam@0
|
2660 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
|
adam@0
|
2661 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
|
adam@0
|
2662 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
|
adam@0
|
2663 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
|
adam@0
|
2664 cd "$darwin_curdir"
|
adam@0
|
2665 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
|
adam@0
|
2666 done # $darwin_arches
|
adam@0
|
2667 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
|
adam@0
|
2668 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
|
adam@0
|
2669 darwin_file=
|
adam@0
|
2670 darwin_files=
|
adam@0
|
2671 for darwin_file in $darwin_filelist; do
|
adam@0
|
2672 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
|
adam@0
|
2673 $LIPO -create -output "$darwin_file" $darwin_files
|
adam@0
|
2674 done # $darwin_filelist
|
adam@0
|
2675 $RM -rf unfat-$$
|
adam@0
|
2676 cd "$darwin_orig_dir"
|
adam@0
|
2677 else
|
adam@0
|
2678 cd $darwin_orig_dir
|
adam@0
|
2679 func_extract_an_archive "$my_xdir" "$my_xabs"
|
adam@0
|
2680 fi # $darwin_arches
|
adam@0
|
2681 } # !$opt_dry_run
|
adam@0
|
2682 ;;
|
adam@0
|
2683 *)
|
adam@0
|
2684 func_extract_an_archive "$my_xdir" "$my_xabs"
|
adam@0
|
2685 ;;
|
adam@0
|
2686 esac
|
adam@0
|
2687 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
|
adam@0
|
2688 done
|
adam@0
|
2689
|
adam@0
|
2690 func_extract_archives_result="$my_oldobjs"
|
adam@0
|
2691 }
|
adam@0
|
2692
|
adam@0
|
2693
|
adam@0
|
2694
|
adam@0
|
2695 # func_emit_wrapper_part1 [arg=no]
|
adam@0
|
2696 #
|
adam@0
|
2697 # Emit the first part of a libtool wrapper script on stdout.
|
adam@0
|
2698 # For more information, see the description associated with
|
adam@0
|
2699 # func_emit_wrapper(), below.
|
adam@0
|
2700 func_emit_wrapper_part1 ()
|
adam@0
|
2701 {
|
adam@0
|
2702 func_emit_wrapper_part1_arg1=no
|
adam@0
|
2703 if test -n "$1" ; then
|
adam@0
|
2704 func_emit_wrapper_part1_arg1=$1
|
adam@0
|
2705 fi
|
adam@0
|
2706
|
adam@0
|
2707 $ECHO "\
|
adam@0
|
2708 #! $SHELL
|
adam@0
|
2709
|
adam@0
|
2710 # $output - temporary wrapper script for $objdir/$outputname
|
adam@0
|
2711 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
|
adam@0
|
2712 #
|
adam@0
|
2713 # The $output program cannot be directly executed until all the libtool
|
adam@0
|
2714 # libraries that it depends on are installed.
|
adam@0
|
2715 #
|
adam@0
|
2716 # This wrapper script should never be moved out of the build directory.
|
adam@0
|
2717 # If it is, it will not operate correctly.
|
adam@0
|
2718
|
adam@0
|
2719 # Sed substitution that helps us do robust quoting. It backslashifies
|
adam@0
|
2720 # metacharacters that are still active within double-quoted strings.
|
adam@0
|
2721 Xsed='${SED} -e 1s/^X//'
|
adam@0
|
2722 sed_quote_subst='$sed_quote_subst'
|
adam@0
|
2723
|
adam@0
|
2724 # Be Bourne compatible
|
adam@0
|
2725 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
|
adam@0
|
2726 emulate sh
|
adam@0
|
2727 NULLCMD=:
|
adam@0
|
2728 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
|
adam@0
|
2729 # is contrary to our usage. Disable this feature.
|
adam@0
|
2730 alias -g '\${1+\"\$@\"}'='\"\$@\"'
|
adam@0
|
2731 setopt NO_GLOB_SUBST
|
adam@0
|
2732 else
|
adam@0
|
2733 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
|
adam@0
|
2734 fi
|
adam@0
|
2735 BIN_SH=xpg4; export BIN_SH # for Tru64
|
adam@0
|
2736 DUALCASE=1; export DUALCASE # for MKS sh
|
adam@0
|
2737
|
adam@0
|
2738 # The HP-UX ksh and POSIX shell print the target directory to stdout
|
adam@0
|
2739 # if CDPATH is set.
|
adam@0
|
2740 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
adam@0
|
2741
|
adam@0
|
2742 relink_command=\"$relink_command\"
|
adam@0
|
2743
|
adam@0
|
2744 # This environment variable determines our operation mode.
|
adam@0
|
2745 if test \"\$libtool_install_magic\" = \"$magic\"; then
|
adam@0
|
2746 # install mode needs the following variables:
|
adam@0
|
2747 generated_by_libtool_version='$macro_version'
|
adam@0
|
2748 notinst_deplibs='$notinst_deplibs'
|
adam@0
|
2749 else
|
adam@0
|
2750 # When we are sourced in execute mode, \$file and \$ECHO are already set.
|
adam@0
|
2751 if test \"\$libtool_execute_magic\" != \"$magic\"; then
|
adam@0
|
2752 ECHO=\"$qecho\"
|
adam@0
|
2753 file=\"\$0\"
|
adam@0
|
2754 # Make sure echo works.
|
adam@0
|
2755 if test \"X\$1\" = X--no-reexec; then
|
adam@0
|
2756 # Discard the --no-reexec flag, and continue.
|
adam@0
|
2757 shift
|
adam@0
|
2758 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
|
adam@0
|
2759 # Yippee, \$ECHO works!
|
adam@0
|
2760 :
|
adam@0
|
2761 else
|
adam@0
|
2762 # Restart under the correct shell, and then maybe \$ECHO will work.
|
adam@0
|
2763 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
|
adam@0
|
2764 fi
|
adam@0
|
2765 fi\
|
adam@0
|
2766 "
|
adam@0
|
2767 $ECHO "\
|
adam@0
|
2768
|
adam@0
|
2769 # Find the directory that this script lives in.
|
adam@0
|
2770 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
|
adam@0
|
2771 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
|
adam@0
|
2772
|
adam@0
|
2773 # Follow symbolic links until we get to the real thisdir.
|
adam@0
|
2774 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
|
adam@0
|
2775 while test -n \"\$file\"; do
|
adam@0
|
2776 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
|
adam@0
|
2777
|
adam@0
|
2778 # If there was a directory component, then change thisdir.
|
adam@0
|
2779 if test \"x\$destdir\" != \"x\$file\"; then
|
adam@0
|
2780 case \"\$destdir\" in
|
adam@0
|
2781 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
|
adam@0
|
2782 *) thisdir=\"\$thisdir/\$destdir\" ;;
|
adam@0
|
2783 esac
|
adam@0
|
2784 fi
|
adam@0
|
2785
|
adam@0
|
2786 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
|
adam@0
|
2787 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
|
adam@0
|
2788 done
|
adam@0
|
2789 "
|
adam@0
|
2790 }
|
adam@0
|
2791 # end: func_emit_wrapper_part1
|
adam@0
|
2792
|
adam@0
|
2793 # func_emit_wrapper_part2 [arg=no]
|
adam@0
|
2794 #
|
adam@0
|
2795 # Emit the second part of a libtool wrapper script on stdout.
|
adam@0
|
2796 # For more information, see the description associated with
|
adam@0
|
2797 # func_emit_wrapper(), below.
|
adam@0
|
2798 func_emit_wrapper_part2 ()
|
adam@0
|
2799 {
|
adam@0
|
2800 func_emit_wrapper_part2_arg1=no
|
adam@0
|
2801 if test -n "$1" ; then
|
adam@0
|
2802 func_emit_wrapper_part2_arg1=$1
|
adam@0
|
2803 fi
|
adam@0
|
2804
|
adam@0
|
2805 $ECHO "\
|
adam@0
|
2806
|
adam@0
|
2807 # Usually 'no', except on cygwin/mingw when embedded into
|
adam@0
|
2808 # the cwrapper.
|
adam@0
|
2809 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
|
adam@0
|
2810 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
|
adam@0
|
2811 # special case for '.'
|
adam@0
|
2812 if test \"\$thisdir\" = \".\"; then
|
adam@0
|
2813 thisdir=\`pwd\`
|
adam@0
|
2814 fi
|
adam@0
|
2815 # remove .libs from thisdir
|
adam@0
|
2816 case \"\$thisdir\" in
|
adam@0
|
2817 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
|
adam@0
|
2818 $objdir ) thisdir=. ;;
|
adam@0
|
2819 esac
|
adam@0
|
2820 fi
|
adam@0
|
2821
|
adam@0
|
2822 # Try to get the absolute directory name.
|
adam@0
|
2823 absdir=\`cd \"\$thisdir\" && pwd\`
|
adam@0
|
2824 test -n \"\$absdir\" && thisdir=\"\$absdir\"
|
adam@0
|
2825 "
|
adam@0
|
2826
|
adam@0
|
2827 if test "$fast_install" = yes; then
|
adam@0
|
2828 $ECHO "\
|
adam@0
|
2829 program=lt-'$outputname'$exeext
|
adam@0
|
2830 progdir=\"\$thisdir/$objdir\"
|
adam@0
|
2831
|
adam@0
|
2832 if test ! -f \"\$progdir/\$program\" ||
|
adam@0
|
2833 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
|
adam@0
|
2834 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
|
adam@0
|
2835
|
adam@0
|
2836 file=\"\$\$-\$program\"
|
adam@0
|
2837
|
adam@0
|
2838 if test ! -d \"\$progdir\"; then
|
adam@0
|
2839 $MKDIR \"\$progdir\"
|
adam@0
|
2840 else
|
adam@0
|
2841 $RM \"\$progdir/\$file\"
|
adam@0
|
2842 fi"
|
adam@0
|
2843
|
adam@0
|
2844 $ECHO "\
|
adam@0
|
2845
|
adam@0
|
2846 # relink executable if necessary
|
adam@0
|
2847 if test -n \"\$relink_command\"; then
|
adam@0
|
2848 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
|
adam@0
|
2849 else
|
adam@0
|
2850 $ECHO \"\$relink_command_output\" >&2
|
adam@0
|
2851 $RM \"\$progdir/\$file\"
|
adam@0
|
2852 exit 1
|
adam@0
|
2853 fi
|
adam@0
|
2854 fi
|
adam@0
|
2855
|
adam@0
|
2856 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
|
adam@0
|
2857 { $RM \"\$progdir/\$program\";
|
adam@0
|
2858 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
|
adam@0
|
2859 $RM \"\$progdir/\$file\"
|
adam@0
|
2860 fi"
|
adam@0
|
2861 else
|
adam@0
|
2862 $ECHO "\
|
adam@0
|
2863 program='$outputname'
|
adam@0
|
2864 progdir=\"\$thisdir/$objdir\"
|
adam@0
|
2865 "
|
adam@0
|
2866 fi
|
adam@0
|
2867
|
adam@0
|
2868 $ECHO "\
|
adam@0
|
2869
|
adam@0
|
2870 if test -f \"\$progdir/\$program\"; then"
|
adam@0
|
2871
|
adam@0
|
2872 # Export our shlibpath_var if we have one.
|
adam@0
|
2873 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
|
adam@0
|
2874 $ECHO "\
|
adam@0
|
2875 # Add our own library path to $shlibpath_var
|
adam@0
|
2876 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
|
adam@0
|
2877
|
adam@0
|
2878 # Some systems cannot cope with colon-terminated $shlibpath_var
|
adam@0
|
2879 # The second colon is a workaround for a bug in BeOS R4 sed
|
adam@0
|
2880 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
|
adam@0
|
2881
|
adam@0
|
2882 export $shlibpath_var
|
adam@0
|
2883 "
|
adam@0
|
2884 fi
|
adam@0
|
2885
|
adam@0
|
2886 # fixup the dll searchpath if we need to.
|
adam@0
|
2887 if test -n "$dllsearchpath"; then
|
adam@0
|
2888 $ECHO "\
|
adam@0
|
2889 # Add the dll search path components to the executable PATH
|
adam@0
|
2890 PATH=$dllsearchpath:\$PATH
|
adam@0
|
2891 "
|
adam@0
|
2892 fi
|
adam@0
|
2893
|
adam@0
|
2894 $ECHO "\
|
adam@0
|
2895 if test \"\$libtool_execute_magic\" != \"$magic\"; then
|
adam@0
|
2896 # Run the actual program with our arguments.
|
adam@0
|
2897 "
|
adam@0
|
2898 case $host in
|
adam@0
|
2899 # Backslashes separate directories on plain windows
|
adam@0
|
2900 *-*-mingw | *-*-os2* | *-cegcc*)
|
adam@0
|
2901 $ECHO "\
|
adam@0
|
2902 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
|
adam@0
|
2903 "
|
adam@0
|
2904 ;;
|
adam@0
|
2905
|
adam@0
|
2906 *)
|
adam@0
|
2907 $ECHO "\
|
adam@0
|
2908 exec \"\$progdir/\$program\" \${1+\"\$@\"}
|
adam@0
|
2909 "
|
adam@0
|
2910 ;;
|
adam@0
|
2911 esac
|
adam@0
|
2912 $ECHO "\
|
adam@0
|
2913 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
|
adam@0
|
2914 exit 1
|
adam@0
|
2915 fi
|
adam@0
|
2916 else
|
adam@0
|
2917 # The program doesn't exist.
|
adam@0
|
2918 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
|
adam@0
|
2919 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
|
adam@0
|
2920 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
|
adam@0
|
2921 exit 1
|
adam@0
|
2922 fi
|
adam@0
|
2923 fi\
|
adam@0
|
2924 "
|
adam@0
|
2925 }
|
adam@0
|
2926 # end: func_emit_wrapper_part2
|
adam@0
|
2927
|
adam@0
|
2928
|
adam@0
|
2929 # func_emit_wrapper [arg=no]
|
adam@0
|
2930 #
|
adam@0
|
2931 # Emit a libtool wrapper script on stdout.
|
adam@0
|
2932 # Don't directly open a file because we may want to
|
adam@0
|
2933 # incorporate the script contents within a cygwin/mingw
|
adam@0
|
2934 # wrapper executable. Must ONLY be called from within
|
adam@0
|
2935 # func_mode_link because it depends on a number of variables
|
adam@0
|
2936 # set therein.
|
adam@0
|
2937 #
|
adam@0
|
2938 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
|
adam@0
|
2939 # variable will take. If 'yes', then the emitted script
|
adam@0
|
2940 # will assume that the directory in which it is stored is
|
adam@0
|
2941 # the $objdir directory. This is a cygwin/mingw-specific
|
adam@0
|
2942 # behavior.
|
adam@0
|
2943 func_emit_wrapper ()
|
adam@0
|
2944 {
|
adam@0
|
2945 func_emit_wrapper_arg1=no
|
adam@0
|
2946 if test -n "$1" ; then
|
adam@0
|
2947 func_emit_wrapper_arg1=$1
|
adam@0
|
2948 fi
|
adam@0
|
2949
|
adam@0
|
2950 # split this up so that func_emit_cwrapperexe_src
|
adam@0
|
2951 # can call each part independently.
|
adam@0
|
2952 func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
|
adam@0
|
2953 func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
|
adam@0
|
2954 }
|
adam@0
|
2955
|
adam@0
|
2956
|
adam@0
|
2957 # func_to_host_path arg
|
adam@0
|
2958 #
|
adam@0
|
2959 # Convert paths to host format when used with build tools.
|
adam@0
|
2960 # Intended for use with "native" mingw (where libtool itself
|
adam@0
|
2961 # is running under the msys shell), or in the following cross-
|
adam@0
|
2962 # build environments:
|
adam@0
|
2963 # $build $host
|
adam@0
|
2964 # mingw (msys) mingw [e.g. native]
|
adam@0
|
2965 # cygwin mingw
|
adam@0
|
2966 # *nix + wine mingw
|
adam@0
|
2967 # where wine is equipped with the `winepath' executable.
|
adam@0
|
2968 # In the native mingw case, the (msys) shell automatically
|
adam@0
|
2969 # converts paths for any non-msys applications it launches,
|
adam@0
|
2970 # but that facility isn't available from inside the cwrapper.
|
adam@0
|
2971 # Similar accommodations are necessary for $host mingw and
|
adam@0
|
2972 # $build cygwin. Calling this function does no harm for other
|
adam@0
|
2973 # $host/$build combinations not listed above.
|
adam@0
|
2974 #
|
adam@0
|
2975 # ARG is the path (on $build) that should be converted to
|
adam@0
|
2976 # the proper representation for $host. The result is stored
|
adam@0
|
2977 # in $func_to_host_path_result.
|
adam@0
|
2978 func_to_host_path ()
|
adam@0
|
2979 {
|
adam@0
|
2980 func_to_host_path_result="$1"
|
adam@0
|
2981 if test -n "$1" ; then
|
adam@0
|
2982 case $host in
|
adam@0
|
2983 *mingw* )
|
adam@0
|
2984 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
|
adam@0
|
2985 case $build in
|
adam@0
|
2986 *mingw* ) # actually, msys
|
adam@0
|
2987 # awkward: cmd appends spaces to result
|
adam@0
|
2988 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
|
adam@0
|
2989 func_to_host_path_tmp1=`( cmd //c echo "$1" |\
|
adam@0
|
2990 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
|
adam@0
|
2991 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
|
adam@0
|
2992 $SED -e "$lt_sed_naive_backslashify"`
|
adam@0
|
2993 ;;
|
adam@0
|
2994 *cygwin* )
|
adam@0
|
2995 func_to_host_path_tmp1=`cygpath -w "$1"`
|
adam@0
|
2996 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
|
adam@0
|
2997 $SED -e "$lt_sed_naive_backslashify"`
|
adam@0
|
2998 ;;
|
adam@0
|
2999 * )
|
adam@0
|
3000 # Unfortunately, winepath does not exit with a non-zero
|
adam@0
|
3001 # error code, so we are forced to check the contents of
|
adam@0
|
3002 # stdout. On the other hand, if the command is not
|
adam@0
|
3003 # found, the shell will set an exit code of 127 and print
|
adam@0
|
3004 # *an error message* to stdout. So we must check for both
|
adam@0
|
3005 # error code of zero AND non-empty stdout, which explains
|
adam@0
|
3006 # the odd construction:
|
adam@0
|
3007 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
|
adam@0
|
3008 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
|
adam@0
|
3009 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
|
adam@0
|
3010 $SED -e "$lt_sed_naive_backslashify"`
|
adam@0
|
3011 else
|
adam@0
|
3012 # Allow warning below.
|
adam@0
|
3013 func_to_host_path_result=""
|
adam@0
|
3014 fi
|
adam@0
|
3015 ;;
|
adam@0
|
3016 esac
|
adam@0
|
3017 if test -z "$func_to_host_path_result" ; then
|
adam@0
|
3018 func_error "Could not determine host path corresponding to"
|
adam@0
|
3019 func_error " '$1'"
|
adam@0
|
3020 func_error "Continuing, but uninstalled executables may not work."
|
adam@0
|
3021 # Fallback:
|
adam@0
|
3022 func_to_host_path_result="$1"
|
adam@0
|
3023 fi
|
adam@0
|
3024 ;;
|
adam@0
|
3025 esac
|
adam@0
|
3026 fi
|
adam@0
|
3027 }
|
adam@0
|
3028 # end: func_to_host_path
|
adam@0
|
3029
|
adam@0
|
3030 # func_to_host_pathlist arg
|
adam@0
|
3031 #
|
adam@0
|
3032 # Convert pathlists to host format when used with build tools.
|
adam@0
|
3033 # See func_to_host_path(), above. This function supports the
|
adam@0
|
3034 # following $build/$host combinations (but does no harm for
|
adam@0
|
3035 # combinations not listed here):
|
adam@0
|
3036 # $build $host
|
adam@0
|
3037 # mingw (msys) mingw [e.g. native]
|
adam@0
|
3038 # cygwin mingw
|
adam@0
|
3039 # *nix + wine mingw
|
adam@0
|
3040 #
|
adam@0
|
3041 # Path separators are also converted from $build format to
|
adam@0
|
3042 # $host format. If ARG begins or ends with a path separator
|
adam@0
|
3043 # character, it is preserved (but converted to $host format)
|
adam@0
|
3044 # on output.
|
adam@0
|
3045 #
|
adam@0
|
3046 # ARG is a pathlist (on $build) that should be converted to
|
adam@0
|
3047 # the proper representation on $host. The result is stored
|
adam@0
|
3048 # in $func_to_host_pathlist_result.
|
adam@0
|
3049 func_to_host_pathlist ()
|
adam@0
|
3050 {
|
adam@0
|
3051 func_to_host_pathlist_result="$1"
|
adam@0
|
3052 if test -n "$1" ; then
|
adam@0
|
3053 case $host in
|
adam@0
|
3054 *mingw* )
|
adam@0
|
3055 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
|
adam@0
|
3056 # Remove leading and trailing path separator characters from
|
adam@0
|
3057 # ARG. msys behavior is inconsistent here, cygpath turns them
|
adam@0
|
3058 # into '.;' and ';.', and winepath ignores them completely.
|
adam@0
|
3059 func_to_host_pathlist_tmp2="$1"
|
adam@0
|
3060 # Once set for this call, this variable should not be
|
adam@0
|
3061 # reassigned. It is used in tha fallback case.
|
adam@0
|
3062 func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
|
adam@0
|
3063 $SED -e 's|^:*||' -e 's|:*$||'`
|
adam@0
|
3064 case $build in
|
adam@0
|
3065 *mingw* ) # Actually, msys.
|
adam@0
|
3066 # Awkward: cmd appends spaces to result.
|
adam@0
|
3067 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
|
adam@0
|
3068 func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
|
adam@0
|
3069 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
|
adam@0
|
3070 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
|
adam@0
|
3071 $SED -e "$lt_sed_naive_backslashify"`
|
adam@0
|
3072 ;;
|
adam@0
|
3073 *cygwin* )
|
adam@0
|
3074 func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
|
adam@0
|
3075 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
|
adam@0
|
3076 $SED -e "$lt_sed_naive_backslashify"`
|
adam@0
|
3077 ;;
|
adam@0
|
3078 * )
|
adam@0
|
3079 # unfortunately, winepath doesn't convert pathlists
|
adam@0
|
3080 func_to_host_pathlist_result=""
|
adam@0
|
3081 func_to_host_pathlist_oldIFS=$IFS
|
adam@0
|
3082 IFS=:
|
adam@0
|
3083 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
|
adam@0
|
3084 IFS=$func_to_host_pathlist_oldIFS
|
adam@0
|
3085 if test -n "$func_to_host_pathlist_f" ; then
|
adam@0
|
3086 func_to_host_path "$func_to_host_pathlist_f"
|
adam@0
|
3087 if test -n "$func_to_host_path_result" ; then
|
adam@0
|
3088 if test -z "$func_to_host_pathlist_result" ; then
|
adam@0
|
3089 func_to_host_pathlist_result="$func_to_host_path_result"
|
adam@0
|
3090 else
|
adam@0
|
3091 func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
|
adam@0
|
3092 fi
|
adam@0
|
3093 fi
|
adam@0
|
3094 fi
|
adam@0
|
3095 IFS=:
|
adam@0
|
3096 done
|
adam@0
|
3097 IFS=$func_to_host_pathlist_oldIFS
|
adam@0
|
3098 ;;
|
adam@0
|
3099 esac
|
adam@0
|
3100 if test -z "$func_to_host_pathlist_result" ; then
|
adam@0
|
3101 func_error "Could not determine the host path(s) corresponding to"
|
adam@0
|
3102 func_error " '$1'"
|
adam@0
|
3103 func_error "Continuing, but uninstalled executables may not work."
|
adam@0
|
3104 # Fallback. This may break if $1 contains DOS-style drive
|
adam@0
|
3105 # specifications. The fix is not to complicate the expression
|
adam@0
|
3106 # below, but for the user to provide a working wine installation
|
adam@0
|
3107 # with winepath so that path translation in the cross-to-mingw
|
adam@0
|
3108 # case works properly.
|
adam@0
|
3109 lt_replace_pathsep_nix_to_dos="s|:|;|g"
|
adam@0
|
3110 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
|
adam@0
|
3111 $SED -e "$lt_replace_pathsep_nix_to_dos"`
|
adam@0
|
3112 fi
|
adam@0
|
3113 # Now, add the leading and trailing path separators back
|
adam@0
|
3114 case "$1" in
|
adam@0
|
3115 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
|
adam@0
|
3116 ;;
|
adam@0
|
3117 esac
|
adam@0
|
3118 case "$1" in
|
adam@0
|
3119 *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
|
adam@0
|
3120 ;;
|
adam@0
|
3121 esac
|
adam@0
|
3122 ;;
|
adam@0
|
3123 esac
|
adam@0
|
3124 fi
|
adam@0
|
3125 }
|
adam@0
|
3126 # end: func_to_host_pathlist
|
adam@0
|
3127
|
adam@0
|
3128 # func_emit_cwrapperexe_src
|
adam@0
|
3129 # emit the source code for a wrapper executable on stdout
|
adam@0
|
3130 # Must ONLY be called from within func_mode_link because
|
adam@0
|
3131 # it depends on a number of variable set therein.
|
adam@0
|
3132 func_emit_cwrapperexe_src ()
|
adam@0
|
3133 {
|
adam@0
|
3134 cat <<EOF
|
adam@0
|
3135
|
adam@0
|
3136 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
|
adam@0
|
3137 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
|
adam@0
|
3138
|
adam@0
|
3139 The $output program cannot be directly executed until all the libtool
|
adam@0
|
3140 libraries that it depends on are installed.
|
adam@0
|
3141
|
adam@0
|
3142 This wrapper executable should never be moved out of the build directory.
|
adam@0
|
3143 If it is, it will not operate correctly.
|
adam@0
|
3144
|
adam@0
|
3145 Currently, it simply execs the wrapper *script* "$SHELL $output",
|
adam@0
|
3146 but could eventually absorb all of the scripts functionality and
|
adam@0
|
3147 exec $objdir/$outputname directly.
|
adam@0
|
3148 */
|
adam@0
|
3149 EOF
|
adam@0
|
3150 cat <<"EOF"
|
adam@0
|
3151 #include <stdio.h>
|
adam@0
|
3152 #include <stdlib.h>
|
adam@0
|
3153 #ifdef _MSC_VER
|
adam@0
|
3154 # include <direct.h>
|
adam@0
|
3155 # include <process.h>
|
adam@0
|
3156 # include <io.h>
|
adam@0
|
3157 # define setmode _setmode
|
adam@0
|
3158 #else
|
adam@0
|
3159 # include <unistd.h>
|
adam@0
|
3160 # include <stdint.h>
|
adam@0
|
3161 # ifdef __CYGWIN__
|
adam@0
|
3162 # include <io.h>
|
adam@0
|
3163 # define HAVE_SETENV
|
adam@0
|
3164 # ifdef __STRICT_ANSI__
|
adam@0
|
3165 char *realpath (const char *, char *);
|
adam@0
|
3166 int putenv (char *);
|
adam@0
|
3167 int setenv (const char *, const char *, int);
|
adam@0
|
3168 # endif
|
adam@0
|
3169 # endif
|
adam@0
|
3170 #endif
|
adam@0
|
3171 #include <malloc.h>
|
adam@0
|
3172 #include <stdarg.h>
|
adam@0
|
3173 #include <assert.h>
|
adam@0
|
3174 #include <string.h>
|
adam@0
|
3175 #include <ctype.h>
|
adam@0
|
3176 #include <errno.h>
|
adam@0
|
3177 #include <fcntl.h>
|
adam@0
|
3178 #include <sys/stat.h>
|
adam@0
|
3179
|
adam@0
|
3180 #if defined(PATH_MAX)
|
adam@0
|
3181 # define LT_PATHMAX PATH_MAX
|
adam@0
|
3182 #elif defined(MAXPATHLEN)
|
adam@0
|
3183 # define LT_PATHMAX MAXPATHLEN
|
adam@0
|
3184 #else
|
adam@0
|
3185 # define LT_PATHMAX 1024
|
adam@0
|
3186 #endif
|
adam@0
|
3187
|
adam@0
|
3188 #ifndef S_IXOTH
|
adam@0
|
3189 # define S_IXOTH 0
|
adam@0
|
3190 #endif
|
adam@0
|
3191 #ifndef S_IXGRP
|
adam@0
|
3192 # define S_IXGRP 0
|
adam@0
|
3193 #endif
|
adam@0
|
3194
|
adam@0
|
3195 #ifdef _MSC_VER
|
adam@0
|
3196 # define S_IXUSR _S_IEXEC
|
adam@0
|
3197 # define stat _stat
|
adam@0
|
3198 # ifndef _INTPTR_T_DEFINED
|
adam@0
|
3199 # define intptr_t int
|
adam@0
|
3200 # endif
|
adam@0
|
3201 #endif
|
adam@0
|
3202
|
adam@0
|
3203 #ifndef DIR_SEPARATOR
|
adam@0
|
3204 # define DIR_SEPARATOR '/'
|
adam@0
|
3205 # define PATH_SEPARATOR ':'
|
adam@0
|
3206 #endif
|
adam@0
|
3207
|
adam@0
|
3208 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
|
adam@0
|
3209 defined (__OS2__)
|
adam@0
|
3210 # define HAVE_DOS_BASED_FILE_SYSTEM
|
adam@0
|
3211 # define FOPEN_WB "wb"
|
adam@0
|
3212 # ifndef DIR_SEPARATOR_2
|
adam@0
|
3213 # define DIR_SEPARATOR_2 '\\'
|
adam@0
|
3214 # endif
|
adam@0
|
3215 # ifndef PATH_SEPARATOR_2
|
adam@0
|
3216 # define PATH_SEPARATOR_2 ';'
|
adam@0
|
3217 # endif
|
adam@0
|
3218 #endif
|
adam@0
|
3219
|
adam@0
|
3220 #ifndef DIR_SEPARATOR_2
|
adam@0
|
3221 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
|
adam@0
|
3222 #else /* DIR_SEPARATOR_2 */
|
adam@0
|
3223 # define IS_DIR_SEPARATOR(ch) \
|
adam@0
|
3224 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
|
adam@0
|
3225 #endif /* DIR_SEPARATOR_2 */
|
adam@0
|
3226
|
adam@0
|
3227 #ifndef PATH_SEPARATOR_2
|
adam@0
|
3228 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
|
adam@0
|
3229 #else /* PATH_SEPARATOR_2 */
|
adam@0
|
3230 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
|
adam@0
|
3231 #endif /* PATH_SEPARATOR_2 */
|
adam@0
|
3232
|
adam@0
|
3233 #ifdef __CYGWIN__
|
adam@0
|
3234 # define FOPEN_WB "wb"
|
adam@0
|
3235 #endif
|
adam@0
|
3236
|
adam@0
|
3237 #ifndef FOPEN_WB
|
adam@0
|
3238 # define FOPEN_WB "w"
|
adam@0
|
3239 #endif
|
adam@0
|
3240 #ifndef _O_BINARY
|
adam@0
|
3241 # define _O_BINARY 0
|
adam@0
|
3242 #endif
|
adam@0
|
3243
|
adam@0
|
3244 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
|
adam@0
|
3245 #define XFREE(stale) do { \
|
adam@0
|
3246 if (stale) { free ((void *) stale); stale = 0; } \
|
adam@0
|
3247 } while (0)
|
adam@0
|
3248
|
adam@0
|
3249 #undef LTWRAPPER_DEBUGPRINTF
|
adam@0
|
3250 #if defined DEBUGWRAPPER
|
adam@0
|
3251 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
|
adam@0
|
3252 static void
|
adam@0
|
3253 ltwrapper_debugprintf (const char *fmt, ...)
|
adam@0
|
3254 {
|
adam@0
|
3255 va_list args;
|
adam@0
|
3256 va_start (args, fmt);
|
adam@0
|
3257 (void) vfprintf (stderr, fmt, args);
|
adam@0
|
3258 va_end (args);
|
adam@0
|
3259 }
|
adam@0
|
3260 #else
|
adam@0
|
3261 # define LTWRAPPER_DEBUGPRINTF(args)
|
adam@0
|
3262 #endif
|
adam@0
|
3263
|
adam@0
|
3264 const char *program_name = NULL;
|
adam@0
|
3265
|
adam@0
|
3266 void *xmalloc (size_t num);
|
adam@0
|
3267 char *xstrdup (const char *string);
|
adam@0
|
3268 const char *base_name (const char *name);
|
adam@0
|
3269 char *find_executable (const char *wrapper);
|
adam@0
|
3270 char *chase_symlinks (const char *pathspec);
|
adam@0
|
3271 int make_executable (const char *path);
|
adam@0
|
3272 int check_executable (const char *path);
|
adam@0
|
3273 char *strendzap (char *str, const char *pat);
|
adam@0
|
3274 void lt_fatal (const char *message, ...);
|
adam@0
|
3275 void lt_setenv (const char *name, const char *value);
|
adam@0
|
3276 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
|
adam@0
|
3277 void lt_opt_process_env_set (const char *arg);
|
adam@0
|
3278 void lt_opt_process_env_prepend (const char *arg);
|
adam@0
|
3279 void lt_opt_process_env_append (const char *arg);
|
adam@0
|
3280 int lt_split_name_value (const char *arg, char** name, char** value);
|
adam@0
|
3281 void lt_update_exe_path (const char *name, const char *value);
|
adam@0
|
3282 void lt_update_lib_path (const char *name, const char *value);
|
adam@0
|
3283
|
adam@0
|
3284 static const char *script_text_part1 =
|
adam@0
|
3285 EOF
|
adam@0
|
3286
|
adam@0
|
3287 func_emit_wrapper_part1 yes |
|
adam@0
|
3288 $SED -e 's/\([\\"]\)/\\\1/g' \
|
adam@0
|
3289 -e 's/^/ "/' -e 's/$/\\n"/'
|
adam@0
|
3290 echo ";"
|
adam@0
|
3291 cat <<EOF
|
adam@0
|
3292
|
adam@0
|
3293 static const char *script_text_part2 =
|
adam@0
|
3294 EOF
|
adam@0
|
3295 func_emit_wrapper_part2 yes |
|
adam@0
|
3296 $SED -e 's/\([\\"]\)/\\\1/g' \
|
adam@0
|
3297 -e 's/^/ "/' -e 's/$/\\n"/'
|
adam@0
|
3298 echo ";"
|
adam@0
|
3299
|
adam@0
|
3300 cat <<EOF
|
adam@0
|
3301 const char * MAGIC_EXE = "$magic_exe";
|
adam@0
|
3302 const char * LIB_PATH_VARNAME = "$shlibpath_var";
|
adam@0
|
3303 EOF
|
adam@0
|
3304
|
adam@0
|
3305 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
|
adam@0
|
3306 func_to_host_pathlist "$temp_rpath"
|
adam@0
|
3307 cat <<EOF
|
adam@0
|
3308 const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
|
adam@0
|
3309 EOF
|
adam@0
|
3310 else
|
adam@0
|
3311 cat <<"EOF"
|
adam@0
|
3312 const char * LIB_PATH_VALUE = "";
|
adam@0
|
3313 EOF
|
adam@0
|
3314 fi
|
adam@0
|
3315
|
adam@0
|
3316 if test -n "$dllsearchpath"; then
|
adam@0
|
3317 func_to_host_pathlist "$dllsearchpath:"
|
adam@0
|
3318 cat <<EOF
|
adam@0
|
3319 const char * EXE_PATH_VARNAME = "PATH";
|
adam@0
|
3320 const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
|
adam@0
|
3321 EOF
|
adam@0
|
3322 else
|
adam@0
|
3323 cat <<"EOF"
|
adam@0
|
3324 const char * EXE_PATH_VARNAME = "";
|
adam@0
|
3325 const char * EXE_PATH_VALUE = "";
|
adam@0
|
3326 EOF
|
adam@0
|
3327 fi
|
adam@0
|
3328
|
adam@0
|
3329 if test "$fast_install" = yes; then
|
adam@0
|
3330 cat <<EOF
|
adam@0
|
3331 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
|
adam@0
|
3332 EOF
|
adam@0
|
3333 else
|
adam@0
|
3334 cat <<EOF
|
adam@0
|
3335 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
|
adam@0
|
3336 EOF
|
adam@0
|
3337 fi
|
adam@0
|
3338
|
adam@0
|
3339
|
adam@0
|
3340 cat <<"EOF"
|
adam@0
|
3341
|
adam@0
|
3342 #define LTWRAPPER_OPTION_PREFIX "--lt-"
|
adam@0
|
3343 #define LTWRAPPER_OPTION_PREFIX_LENGTH 5
|
adam@0
|
3344
|
adam@0
|
3345 static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
|
adam@0
|
3346 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
|
adam@0
|
3347
|
adam@0
|
3348 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
|
adam@0
|
3349
|
adam@0
|
3350 static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
|
adam@0
|
3351 static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
|
adam@0
|
3352 /* argument is putenv-style "foo=bar", value of foo is set to bar */
|
adam@0
|
3353
|
adam@0
|
3354 static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
|
adam@0
|
3355 static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
|
adam@0
|
3356 /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
|
adam@0
|
3357
|
adam@0
|
3358 static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
|
adam@0
|
3359 static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
|
adam@0
|
3360 /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
|
adam@0
|
3361
|
adam@0
|
3362 int
|
adam@0
|
3363 main (int argc, char *argv[])
|
adam@0
|
3364 {
|
adam@0
|
3365 char **newargz;
|
adam@0
|
3366 int newargc;
|
adam@0
|
3367 char *tmp_pathspec;
|
adam@0
|
3368 char *actual_cwrapper_path;
|
adam@0
|
3369 char *actual_cwrapper_name;
|
adam@0
|
3370 char *target_name;
|
adam@0
|
3371 char *lt_argv_zero;
|
adam@0
|
3372 intptr_t rval = 127;
|
adam@0
|
3373
|
adam@0
|
3374 int i;
|
adam@0
|
3375
|
adam@0
|
3376 program_name = (char *) xstrdup (base_name (argv[0]));
|
adam@0
|
3377 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
|
adam@0
|
3378 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
|
adam@0
|
3379
|
adam@0
|
3380 /* very simple arg parsing; don't want to rely on getopt */
|
adam@0
|
3381 for (i = 1; i < argc; i++)
|
adam@0
|
3382 {
|
adam@0
|
3383 if (strcmp (argv[i], dumpscript_opt) == 0)
|
adam@0
|
3384 {
|
adam@0
|
3385 EOF
|
adam@0
|
3386 case "$host" in
|
adam@0
|
3387 *mingw* | *cygwin* )
|
adam@0
|
3388 # make stdout use "unix" line endings
|
adam@0
|
3389 echo " setmode(1,_O_BINARY);"
|
adam@0
|
3390 ;;
|
adam@0
|
3391 esac
|
adam@0
|
3392
|
adam@0
|
3393 cat <<"EOF"
|
adam@0
|
3394 printf ("%s", script_text_part1);
|
adam@0
|
3395 printf ("%s", script_text_part2);
|
adam@0
|
3396 return 0;
|
adam@0
|
3397 }
|
adam@0
|
3398 }
|
adam@0
|
3399
|
adam@0
|
3400 newargz = XMALLOC (char *, argc + 1);
|
adam@0
|
3401 tmp_pathspec = find_executable (argv[0]);
|
adam@0
|
3402 if (tmp_pathspec == NULL)
|
adam@0
|
3403 lt_fatal ("Couldn't find %s", argv[0]);
|
adam@0
|
3404 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
|
adam@0
|
3405 tmp_pathspec));
|
adam@0
|
3406
|
adam@0
|
3407 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
|
adam@0
|
3408 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
|
adam@0
|
3409 actual_cwrapper_path));
|
adam@0
|
3410 XFREE (tmp_pathspec);
|
adam@0
|
3411
|
adam@0
|
3412 actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
|
adam@0
|
3413 strendzap (actual_cwrapper_path, actual_cwrapper_name);
|
adam@0
|
3414
|
adam@0
|
3415 /* wrapper name transforms */
|
adam@0
|
3416 strendzap (actual_cwrapper_name, ".exe");
|
adam@0
|
3417 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
|
adam@0
|
3418 XFREE (actual_cwrapper_name);
|
adam@0
|
3419 actual_cwrapper_name = tmp_pathspec;
|
adam@0
|
3420 tmp_pathspec = 0;
|
adam@0
|
3421
|
adam@0
|
3422 /* target_name transforms -- use actual target program name; might have lt- prefix */
|
adam@0
|
3423 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
|
adam@0
|
3424 strendzap (target_name, ".exe");
|
adam@0
|
3425 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
|
adam@0
|
3426 XFREE (target_name);
|
adam@0
|
3427 target_name = tmp_pathspec;
|
adam@0
|
3428 tmp_pathspec = 0;
|
adam@0
|
3429
|
adam@0
|
3430 LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
|
adam@0
|
3431 target_name));
|
adam@0
|
3432 EOF
|
adam@0
|
3433
|
adam@0
|
3434 cat <<EOF
|
adam@0
|
3435 newargz[0] =
|
adam@0
|
3436 XMALLOC (char, (strlen (actual_cwrapper_path) +
|
adam@0
|
3437 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
|
adam@0
|
3438 strcpy (newargz[0], actual_cwrapper_path);
|
adam@0
|
3439 strcat (newargz[0], "$objdir");
|
adam@0
|
3440 strcat (newargz[0], "/");
|
adam@0
|
3441 EOF
|
adam@0
|
3442
|
adam@0
|
3443 cat <<"EOF"
|
adam@0
|
3444 /* stop here, and copy so we don't have to do this twice */
|
adam@0
|
3445 tmp_pathspec = xstrdup (newargz[0]);
|
adam@0
|
3446
|
adam@0
|
3447 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
|
adam@0
|
3448 strcat (newargz[0], actual_cwrapper_name);
|
adam@0
|
3449
|
adam@0
|
3450 /* DO want the lt- prefix here if it exists, so use target_name */
|
adam@0
|
3451 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
|
adam@0
|
3452 XFREE (tmp_pathspec);
|
adam@0
|
3453 tmp_pathspec = NULL;
|
adam@0
|
3454 EOF
|
adam@0
|
3455
|
adam@0
|
3456 case $host_os in
|
adam@0
|
3457 mingw*)
|
adam@0
|
3458 cat <<"EOF"
|
adam@0
|
3459 {
|
adam@0
|
3460 char* p;
|
adam@0
|
3461 while ((p = strchr (newargz[0], '\\')) != NULL)
|
adam@0
|
3462 {
|
adam@0
|
3463 *p = '/';
|
adam@0
|
3464 }
|
adam@0
|
3465 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
|
adam@0
|
3466 {
|
adam@0
|
3467 *p = '/';
|
adam@0
|
3468 }
|
adam@0
|
3469 }
|
adam@0
|
3470 EOF
|
adam@0
|
3471 ;;
|
adam@0
|
3472 esac
|
adam@0
|
3473
|
adam@0
|
3474 cat <<"EOF"
|
adam@0
|
3475 XFREE (target_name);
|
adam@0
|
3476 XFREE (actual_cwrapper_path);
|
adam@0
|
3477 XFREE (actual_cwrapper_name);
|
adam@0
|
3478
|
adam@0
|
3479 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
|
adam@0
|
3480 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
|
adam@0
|
3481 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
|
adam@0
|
3482 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
|
adam@0
|
3483
|
adam@0
|
3484 newargc=0;
|
adam@0
|
3485 for (i = 1; i < argc; i++)
|
adam@0
|
3486 {
|
adam@0
|
3487 if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
|
adam@0
|
3488 {
|
adam@0
|
3489 if (argv[i][env_set_opt_len] == '=')
|
adam@0
|
3490 {
|
adam@0
|
3491 const char *p = argv[i] + env_set_opt_len + 1;
|
adam@0
|
3492 lt_opt_process_env_set (p);
|
adam@0
|
3493 }
|
adam@0
|
3494 else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
|
adam@0
|
3495 {
|
adam@0
|
3496 lt_opt_process_env_set (argv[++i]); /* don't copy */
|
adam@0
|
3497 }
|
adam@0
|
3498 else
|
adam@0
|
3499 lt_fatal ("%s missing required argument", env_set_opt);
|
adam@0
|
3500 continue;
|
adam@0
|
3501 }
|
adam@0
|
3502 if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
|
adam@0
|
3503 {
|
adam@0
|
3504 if (argv[i][env_prepend_opt_len] == '=')
|
adam@0
|
3505 {
|
adam@0
|
3506 const char *p = argv[i] + env_prepend_opt_len + 1;
|
adam@0
|
3507 lt_opt_process_env_prepend (p);
|
adam@0
|
3508 }
|
adam@0
|
3509 else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
|
adam@0
|
3510 {
|
adam@0
|
3511 lt_opt_process_env_prepend (argv[++i]); /* don't copy */
|
adam@0
|
3512 }
|
adam@0
|
3513 else
|
adam@0
|
3514 lt_fatal ("%s missing required argument", env_prepend_opt);
|
adam@0
|
3515 continue;
|
adam@0
|
3516 }
|
adam@0
|
3517 if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
|
adam@0
|
3518 {
|
adam@0
|
3519 if (argv[i][env_append_opt_len] == '=')
|
adam@0
|
3520 {
|
adam@0
|
3521 const char *p = argv[i] + env_append_opt_len + 1;
|
adam@0
|
3522 lt_opt_process_env_append (p);
|
adam@0
|
3523 }
|
adam@0
|
3524 else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
|
adam@0
|
3525 {
|
adam@0
|
3526 lt_opt_process_env_append (argv[++i]); /* don't copy */
|
adam@0
|
3527 }
|
adam@0
|
3528 else
|
adam@0
|
3529 lt_fatal ("%s missing required argument", env_append_opt);
|
adam@0
|
3530 continue;
|
adam@0
|
3531 }
|
adam@0
|
3532 if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
|
adam@0
|
3533 {
|
adam@0
|
3534 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
|
adam@0
|
3535 namespace, but it is not one of the ones we know about and
|
adam@0
|
3536 have already dealt with, above (inluding dump-script), then
|
adam@0
|
3537 report an error. Otherwise, targets might begin to believe
|
adam@0
|
3538 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
|
adam@0
|
3539 namespace. The first time any user complains about this, we'll
|
adam@0
|
3540 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
|
adam@0
|
3541 or a configure.ac-settable value.
|
adam@0
|
3542 */
|
adam@0
|
3543 lt_fatal ("Unrecognized option in %s namespace: '%s'",
|
adam@0
|
3544 ltwrapper_option_prefix, argv[i]);
|
adam@0
|
3545 }
|
adam@0
|
3546 /* otherwise ... */
|
adam@0
|
3547 newargz[++newargc] = xstrdup (argv[i]);
|
adam@0
|
3548 }
|
adam@0
|
3549 newargz[++newargc] = NULL;
|
adam@0
|
3550
|
adam@0
|
3551 LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
|
adam@0
|
3552 for (i = 0; i < newargc; i++)
|
adam@0
|
3553 {
|
adam@0
|
3554 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
|
adam@0
|
3555 }
|
adam@0
|
3556
|
adam@0
|
3557 EOF
|
adam@0
|
3558
|
adam@0
|
3559 case $host_os in
|
adam@0
|
3560 mingw*)
|
adam@0
|
3561 cat <<"EOF"
|
adam@0
|
3562 /* execv doesn't actually work on mingw as expected on unix */
|
adam@0
|
3563 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
|
adam@0
|
3564 if (rval == -1)
|
adam@0
|
3565 {
|
adam@0
|
3566 /* failed to start process */
|
adam@0
|
3567 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
|
adam@0
|
3568 return 127;
|
adam@0
|
3569 }
|
adam@0
|
3570 return rval;
|
adam@0
|
3571 EOF
|
adam@0
|
3572 ;;
|
adam@0
|
3573 *)
|
adam@0
|
3574 cat <<"EOF"
|
adam@0
|
3575 execv (lt_argv_zero, newargz);
|
adam@0
|
3576 return rval; /* =127, but avoids unused variable warning */
|
adam@0
|
3577 EOF
|
adam@0
|
3578 ;;
|
adam@0
|
3579 esac
|
adam@0
|
3580
|
adam@0
|
3581 cat <<"EOF"
|
adam@0
|
3582 }
|
adam@0
|
3583
|
adam@0
|
3584 void *
|
adam@0
|
3585 xmalloc (size_t num)
|
adam@0
|
3586 {
|
adam@0
|
3587 void *p = (void *) malloc (num);
|
adam@0
|
3588 if (!p)
|
adam@0
|
3589 lt_fatal ("Memory exhausted");
|
adam@0
|
3590
|
adam@0
|
3591 return p;
|
adam@0
|
3592 }
|
adam@0
|
3593
|
adam@0
|
3594 char *
|
adam@0
|
3595 xstrdup (const char *string)
|
adam@0
|
3596 {
|
adam@0
|
3597 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
|
adam@0
|
3598 string) : NULL;
|
adam@0
|
3599 }
|
adam@0
|
3600
|
adam@0
|
3601 const char *
|
adam@0
|
3602 base_name (const char *name)
|
adam@0
|
3603 {
|
adam@0
|
3604 const char *base;
|
adam@0
|
3605
|
adam@0
|
3606 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
|
adam@0
|
3607 /* Skip over the disk name in MSDOS pathnames. */
|
adam@0
|
3608 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
|
adam@0
|
3609 name += 2;
|
adam@0
|
3610 #endif
|
adam@0
|
3611
|
adam@0
|
3612 for (base = name; *name; name++)
|
adam@0
|
3613 if (IS_DIR_SEPARATOR (*name))
|
adam@0
|
3614 base = name + 1;
|
adam@0
|
3615 return base;
|
adam@0
|
3616 }
|
adam@0
|
3617
|
adam@0
|
3618 int
|
adam@0
|
3619 check_executable (const char *path)
|
adam@0
|
3620 {
|
adam@0
|
3621 struct stat st;
|
adam@0
|
3622
|
adam@0
|
3623 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
|
adam@0
|
3624 path ? (*path ? path : "EMPTY!") : "NULL!"));
|
adam@0
|
3625 if ((!path) || (!*path))
|
adam@0
|
3626 return 0;
|
adam@0
|
3627
|
adam@0
|
3628 if ((stat (path, &st) >= 0)
|
adam@0
|
3629 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
|
adam@0
|
3630 return 1;
|
adam@0
|
3631 else
|
adam@0
|
3632 return 0;
|
adam@0
|
3633 }
|
adam@0
|
3634
|
adam@0
|
3635 int
|
adam@0
|
3636 make_executable (const char *path)
|
adam@0
|
3637 {
|
adam@0
|
3638 int rval = 0;
|
adam@0
|
3639 struct stat st;
|
adam@0
|
3640
|
adam@0
|
3641 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
|
adam@0
|
3642 path ? (*path ? path : "EMPTY!") : "NULL!"));
|
adam@0
|
3643 if ((!path) || (!*path))
|
adam@0
|
3644 return 0;
|
adam@0
|
3645
|
adam@0
|
3646 if (stat (path, &st) >= 0)
|
adam@0
|
3647 {
|
adam@0
|
3648 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
|
adam@0
|
3649 }
|
adam@0
|
3650 return rval;
|
adam@0
|
3651 }
|
adam@0
|
3652
|
adam@0
|
3653 /* Searches for the full path of the wrapper. Returns
|
adam@0
|
3654 newly allocated full path name if found, NULL otherwise
|
adam@0
|
3655 Does not chase symlinks, even on platforms that support them.
|
adam@0
|
3656 */
|
adam@0
|
3657 char *
|
adam@0
|
3658 find_executable (const char *wrapper)
|
adam@0
|
3659 {
|
adam@0
|
3660 int has_slash = 0;
|
adam@0
|
3661 const char *p;
|
adam@0
|
3662 const char *p_next;
|
adam@0
|
3663 /* static buffer for getcwd */
|
adam@0
|
3664 char tmp[LT_PATHMAX + 1];
|
adam@0
|
3665 int tmp_len;
|
adam@0
|
3666 char *concat_name;
|
adam@0
|
3667
|
adam@0
|
3668 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
|
adam@0
|
3669 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
|
adam@0
|
3670
|
adam@0
|
3671 if ((wrapper == NULL) || (*wrapper == '\0'))
|
adam@0
|
3672 return NULL;
|
adam@0
|
3673
|
adam@0
|
3674 /* Absolute path? */
|
adam@0
|
3675 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
|
adam@0
|
3676 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
|
adam@0
|
3677 {
|
adam@0
|
3678 concat_name = xstrdup (wrapper);
|
adam@0
|
3679 if (check_executable (concat_name))
|
adam@0
|
3680 return concat_name;
|
adam@0
|
3681 XFREE (concat_name);
|
adam@0
|
3682 }
|
adam@0
|
3683 else
|
adam@0
|
3684 {
|
adam@0
|
3685 #endif
|
adam@0
|
3686 if (IS_DIR_SEPARATOR (wrapper[0]))
|
adam@0
|
3687 {
|
adam@0
|
3688 concat_name = xstrdup (wrapper);
|
adam@0
|
3689 if (check_executable (concat_name))
|
adam@0
|
3690 return concat_name;
|
adam@0
|
3691 XFREE (concat_name);
|
adam@0
|
3692 }
|
adam@0
|
3693 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
|
adam@0
|
3694 }
|
adam@0
|
3695 #endif
|
adam@0
|
3696
|
adam@0
|
3697 for (p = wrapper; *p; p++)
|
adam@0
|
3698 if (*p == '/')
|
adam@0
|
3699 {
|
adam@0
|
3700 has_slash = 1;
|
adam@0
|
3701 break;
|
adam@0
|
3702 }
|
adam@0
|
3703 if (!has_slash)
|
adam@0
|
3704 {
|
adam@0
|
3705 /* no slashes; search PATH */
|
adam@0
|
3706 const char *path = getenv ("PATH");
|
adam@0
|
3707 if (path != NULL)
|
adam@0
|
3708 {
|
adam@0
|
3709 for (p = path; *p; p = p_next)
|
adam@0
|
3710 {
|
adam@0
|
3711 const char *q;
|
adam@0
|
3712 size_t p_len;
|
adam@0
|
3713 for (q = p; *q; q++)
|
adam@0
|
3714 if (IS_PATH_SEPARATOR (*q))
|
adam@0
|
3715 break;
|
adam@0
|
3716 p_len = q - p;
|
adam@0
|
3717 p_next = (*q == '\0' ? q : q + 1);
|
adam@0
|
3718 if (p_len == 0)
|
adam@0
|
3719 {
|
adam@0
|
3720 /* empty path: current directory */
|
adam@0
|
3721 if (getcwd (tmp, LT_PATHMAX) == NULL)
|
adam@0
|
3722 lt_fatal ("getcwd failed");
|
adam@0
|
3723 tmp_len = strlen (tmp);
|
adam@0
|
3724 concat_name =
|
adam@0
|
3725 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
|
adam@0
|
3726 memcpy (concat_name, tmp, tmp_len);
|
adam@0
|
3727 concat_name[tmp_len] = '/';
|
adam@0
|
3728 strcpy (concat_name + tmp_len + 1, wrapper);
|
adam@0
|
3729 }
|
adam@0
|
3730 else
|
adam@0
|
3731 {
|
adam@0
|
3732 concat_name =
|
adam@0
|
3733 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
|
adam@0
|
3734 memcpy (concat_name, p, p_len);
|
adam@0
|
3735 concat_name[p_len] = '/';
|
adam@0
|
3736 strcpy (concat_name + p_len + 1, wrapper);
|
adam@0
|
3737 }
|
adam@0
|
3738 if (check_executable (concat_name))
|
adam@0
|
3739 return concat_name;
|
adam@0
|
3740 XFREE (concat_name);
|
adam@0
|
3741 }
|
adam@0
|
3742 }
|
adam@0
|
3743 /* not found in PATH; assume curdir */
|
adam@0
|
3744 }
|
adam@0
|
3745 /* Relative path | not found in path: prepend cwd */
|
adam@0
|
3746 if (getcwd (tmp, LT_PATHMAX) == NULL)
|
adam@0
|
3747 lt_fatal ("getcwd failed");
|
adam@0
|
3748 tmp_len = strlen (tmp);
|
adam@0
|
3749 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
|
adam@0
|
3750 memcpy (concat_name, tmp, tmp_len);
|
adam@0
|
3751 concat_name[tmp_len] = '/';
|
adam@0
|
3752 strcpy (concat_name + tmp_len + 1, wrapper);
|
adam@0
|
3753
|
adam@0
|
3754 if (check_executable (concat_name))
|
adam@0
|
3755 return concat_name;
|
adam@0
|
3756 XFREE (concat_name);
|
adam@0
|
3757 return NULL;
|
adam@0
|
3758 }
|
adam@0
|
3759
|
adam@0
|
3760 char *
|
adam@0
|
3761 chase_symlinks (const char *pathspec)
|
adam@0
|
3762 {
|
adam@0
|
3763 #ifndef S_ISLNK
|
adam@0
|
3764 return xstrdup (pathspec);
|
adam@0
|
3765 #else
|
adam@0
|
3766 char buf[LT_PATHMAX];
|
adam@0
|
3767 struct stat s;
|
adam@0
|
3768 char *tmp_pathspec = xstrdup (pathspec);
|
adam@0
|
3769 char *p;
|
adam@0
|
3770 int has_symlinks = 0;
|
adam@0
|
3771 while (strlen (tmp_pathspec) && !has_symlinks)
|
adam@0
|
3772 {
|
adam@0
|
3773 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
|
adam@0
|
3774 tmp_pathspec));
|
adam@0
|
3775 if (lstat (tmp_pathspec, &s) == 0)
|
adam@0
|
3776 {
|
adam@0
|
3777 if (S_ISLNK (s.st_mode) != 0)
|
adam@0
|
3778 {
|
adam@0
|
3779 has_symlinks = 1;
|
adam@0
|
3780 break;
|
adam@0
|
3781 }
|
adam@0
|
3782
|
adam@0
|
3783 /* search backwards for last DIR_SEPARATOR */
|
adam@0
|
3784 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
|
adam@0
|
3785 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
|
adam@0
|
3786 p--;
|
adam@0
|
3787 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
|
adam@0
|
3788 {
|
adam@0
|
3789 /* no more DIR_SEPARATORS left */
|
adam@0
|
3790 break;
|
adam@0
|
3791 }
|
adam@0
|
3792 *p = '\0';
|
adam@0
|
3793 }
|
adam@0
|
3794 else
|
adam@0
|
3795 {
|
adam@0
|
3796 char *errstr = strerror (errno);
|
adam@0
|
3797 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
|
adam@0
|
3798 }
|
adam@0
|
3799 }
|
adam@0
|
3800 XFREE (tmp_pathspec);
|
adam@0
|
3801
|
adam@0
|
3802 if (!has_symlinks)
|
adam@0
|
3803 {
|
adam@0
|
3804 return xstrdup (pathspec);
|
adam@0
|
3805 }
|
adam@0
|
3806
|
adam@0
|
3807 tmp_pathspec = realpath (pathspec, buf);
|
adam@0
|
3808 if (tmp_pathspec == 0)
|
adam@0
|
3809 {
|
adam@0
|
3810 lt_fatal ("Could not follow symlinks for %s", pathspec);
|
adam@0
|
3811 }
|
adam@0
|
3812 return xstrdup (tmp_pathspec);
|
adam@0
|
3813 #endif
|
adam@0
|
3814 }
|
adam@0
|
3815
|
adam@0
|
3816 char *
|
adam@0
|
3817 strendzap (char *str, const char *pat)
|
adam@0
|
3818 {
|
adam@0
|
3819 size_t len, patlen;
|
adam@0
|
3820
|
adam@0
|
3821 assert (str != NULL);
|
adam@0
|
3822 assert (pat != NULL);
|
adam@0
|
3823
|
adam@0
|
3824 len = strlen (str);
|
adam@0
|
3825 patlen = strlen (pat);
|
adam@0
|
3826
|
adam@0
|
3827 if (patlen <= len)
|
adam@0
|
3828 {
|
adam@0
|
3829 str += len - patlen;
|
adam@0
|
3830 if (strcmp (str, pat) == 0)
|
adam@0
|
3831 *str = '\0';
|
adam@0
|
3832 }
|
adam@0
|
3833 return str;
|
adam@0
|
3834 }
|
adam@0
|
3835
|
adam@0
|
3836 static void
|
adam@0
|
3837 lt_error_core (int exit_status, const char *mode,
|
adam@0
|
3838 const char *message, va_list ap)
|
adam@0
|
3839 {
|
adam@0
|
3840 fprintf (stderr, "%s: %s: ", program_name, mode);
|
adam@0
|
3841 vfprintf (stderr, message, ap);
|
adam@0
|
3842 fprintf (stderr, ".\n");
|
adam@0
|
3843
|
adam@0
|
3844 if (exit_status >= 0)
|
adam@0
|
3845 exit (exit_status);
|
adam@0
|
3846 }
|
adam@0
|
3847
|
adam@0
|
3848 void
|
adam@0
|
3849 lt_fatal (const char *message, ...)
|
adam@0
|
3850 {
|
adam@0
|
3851 va_list ap;
|
adam@0
|
3852 va_start (ap, message);
|
adam@0
|
3853 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
|
adam@0
|
3854 va_end (ap);
|
adam@0
|
3855 }
|
adam@0
|
3856
|
adam@0
|
3857 void
|
adam@0
|
3858 lt_setenv (const char *name, const char *value)
|
adam@0
|
3859 {
|
adam@0
|
3860 LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
|
adam@0
|
3861 (name ? name : "<NULL>"),
|
adam@0
|
3862 (value ? value : "<NULL>")));
|
adam@0
|
3863 {
|
adam@0
|
3864 #ifdef HAVE_SETENV
|
adam@0
|
3865 /* always make a copy, for consistency with !HAVE_SETENV */
|
adam@0
|
3866 char *str = xstrdup (value);
|
adam@0
|
3867 setenv (name, str, 1);
|
adam@0
|
3868 #else
|
adam@0
|
3869 int len = strlen (name) + 1 + strlen (value) + 1;
|
adam@0
|
3870 char *str = XMALLOC (char, len);
|
adam@0
|
3871 sprintf (str, "%s=%s", name, value);
|
adam@0
|
3872 if (putenv (str) != EXIT_SUCCESS)
|
adam@0
|
3873 {
|
adam@0
|
3874 XFREE (str);
|
adam@0
|
3875 }
|
adam@0
|
3876 #endif
|
adam@0
|
3877 }
|
adam@0
|
3878 }
|
adam@0
|
3879
|
adam@0
|
3880 char *
|
adam@0
|
3881 lt_extend_str (const char *orig_value, const char *add, int to_end)
|
adam@0
|
3882 {
|
adam@0
|
3883 char *new_value;
|
adam@0
|
3884 if (orig_value && *orig_value)
|
adam@0
|
3885 {
|
adam@0
|
3886 int orig_value_len = strlen (orig_value);
|
adam@0
|
3887 int add_len = strlen (add);
|
adam@0
|
3888 new_value = XMALLOC (char, add_len + orig_value_len + 1);
|
adam@0
|
3889 if (to_end)
|
adam@0
|
3890 {
|
adam@0
|
3891 strcpy (new_value, orig_value);
|
adam@0
|
3892 strcpy (new_value + orig_value_len, add);
|
adam@0
|
3893 }
|
adam@0
|
3894 else
|
adam@0
|
3895 {
|
adam@0
|
3896 strcpy (new_value, add);
|
adam@0
|
3897 strcpy (new_value + add_len, orig_value);
|
adam@0
|
3898 }
|
adam@0
|
3899 }
|
adam@0
|
3900 else
|
adam@0
|
3901 {
|
adam@0
|
3902 new_value = xstrdup (add);
|
adam@0
|
3903 }
|
adam@0
|
3904 return new_value;
|
adam@0
|
3905 }
|
adam@0
|
3906
|
adam@0
|
3907 int
|
adam@0
|
3908 lt_split_name_value (const char *arg, char** name, char** value)
|
adam@0
|
3909 {
|
adam@0
|
3910 const char *p;
|
adam@0
|
3911 int len;
|
adam@0
|
3912 if (!arg || !*arg)
|
adam@0
|
3913 return 1;
|
adam@0
|
3914
|
adam@0
|
3915 p = strchr (arg, (int)'=');
|
adam@0
|
3916
|
adam@0
|
3917 if (!p)
|
adam@0
|
3918 return 1;
|
adam@0
|
3919
|
adam@0
|
3920 *value = xstrdup (++p);
|
adam@0
|
3921
|
adam@0
|
3922 len = strlen (arg) - strlen (*value);
|
adam@0
|
3923 *name = XMALLOC (char, len);
|
adam@0
|
3924 strncpy (*name, arg, len-1);
|
adam@0
|
3925 (*name)[len - 1] = '\0';
|
adam@0
|
3926
|
adam@0
|
3927 return 0;
|
adam@0
|
3928 }
|
adam@0
|
3929
|
adam@0
|
3930 void
|
adam@0
|
3931 lt_opt_process_env_set (const char *arg)
|
adam@0
|
3932 {
|
adam@0
|
3933 char *name = NULL;
|
adam@0
|
3934 char *value = NULL;
|
adam@0
|
3935
|
adam@0
|
3936 if (lt_split_name_value (arg, &name, &value) != 0)
|
adam@0
|
3937 {
|
adam@0
|
3938 XFREE (name);
|
adam@0
|
3939 XFREE (value);
|
adam@0
|
3940 lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
|
adam@0
|
3941 }
|
adam@0
|
3942
|
adam@0
|
3943 lt_setenv (name, value);
|
adam@0
|
3944 XFREE (name);
|
adam@0
|
3945 XFREE (value);
|
adam@0
|
3946 }
|
adam@0
|
3947
|
adam@0
|
3948 void
|
adam@0
|
3949 lt_opt_process_env_prepend (const char *arg)
|
adam@0
|
3950 {
|
adam@0
|
3951 char *name = NULL;
|
adam@0
|
3952 char *value = NULL;
|
adam@0
|
3953 char *new_value = NULL;
|
adam@0
|
3954
|
adam@0
|
3955 if (lt_split_name_value (arg, &name, &value) != 0)
|
adam@0
|
3956 {
|
adam@0
|
3957 XFREE (name);
|
adam@0
|
3958 XFREE (value);
|
adam@0
|
3959 lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
|
adam@0
|
3960 }
|
adam@0
|
3961
|
adam@0
|
3962 new_value = lt_extend_str (getenv (name), value, 0);
|
adam@0
|
3963 lt_setenv (name, new_value);
|
adam@0
|
3964 XFREE (new_value);
|
adam@0
|
3965 XFREE (name);
|
adam@0
|
3966 XFREE (value);
|
adam@0
|
3967 }
|
adam@0
|
3968
|
adam@0
|
3969 void
|
adam@0
|
3970 lt_opt_process_env_append (const char *arg)
|
adam@0
|
3971 {
|
adam@0
|
3972 char *name = NULL;
|
adam@0
|
3973 char *value = NULL;
|
adam@0
|
3974 char *new_value = NULL;
|
adam@0
|
3975
|
adam@0
|
3976 if (lt_split_name_value (arg, &name, &value) != 0)
|
adam@0
|
3977 {
|
adam@0
|
3978 XFREE (name);
|
adam@0
|
3979 XFREE (value);
|
adam@0
|
3980 lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
|
adam@0
|
3981 }
|
adam@0
|
3982
|
adam@0
|
3983 new_value = lt_extend_str (getenv (name), value, 1);
|
adam@0
|
3984 lt_setenv (name, new_value);
|
adam@0
|
3985 XFREE (new_value);
|
adam@0
|
3986 XFREE (name);
|
adam@0
|
3987 XFREE (value);
|
adam@0
|
3988 }
|
adam@0
|
3989
|
adam@0
|
3990 void
|
adam@0
|
3991 lt_update_exe_path (const char *name, const char *value)
|
adam@0
|
3992 {
|
adam@0
|
3993 LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
|
adam@0
|
3994 (name ? name : "<NULL>"),
|
adam@0
|
3995 (value ? value : "<NULL>")));
|
adam@0
|
3996
|
adam@0
|
3997 if (name && *name && value && *value)
|
adam@0
|
3998 {
|
adam@0
|
3999 char *new_value = lt_extend_str (getenv (name), value, 0);
|
adam@0
|
4000 /* some systems can't cope with a ':'-terminated path #' */
|
adam@0
|
4001 int len = strlen (new_value);
|
adam@0
|
4002 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
|
adam@0
|
4003 {
|
adam@0
|
4004 new_value[len-1] = '\0';
|
adam@0
|
4005 }
|
adam@0
|
4006 lt_setenv (name, new_value);
|
adam@0
|
4007 XFREE (new_value);
|
adam@0
|
4008 }
|
adam@0
|
4009 }
|
adam@0
|
4010
|
adam@0
|
4011 void
|
adam@0
|
4012 lt_update_lib_path (const char *name, const char *value)
|
adam@0
|
4013 {
|
adam@0
|
4014 LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
|
adam@0
|
4015 (name ? name : "<NULL>"),
|
adam@0
|
4016 (value ? value : "<NULL>")));
|
adam@0
|
4017
|
adam@0
|
4018 if (name && *name && value && *value)
|
adam@0
|
4019 {
|
adam@0
|
4020 char *new_value = lt_extend_str (getenv (name), value, 0);
|
adam@0
|
4021 lt_setenv (name, new_value);
|
adam@0
|
4022 XFREE (new_value);
|
adam@0
|
4023 }
|
adam@0
|
4024 }
|
adam@0
|
4025
|
adam@0
|
4026
|
adam@0
|
4027 EOF
|
adam@0
|
4028 }
|
adam@0
|
4029 # end: func_emit_cwrapperexe_src
|
adam@0
|
4030
|
adam@0
|
4031 # func_mode_link arg...
|
adam@0
|
4032 func_mode_link ()
|
adam@0
|
4033 {
|
adam@0
|
4034 $opt_debug
|
adam@0
|
4035 case $host in
|
adam@0
|
4036 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
adam@0
|
4037 # It is impossible to link a dll without this setting, and
|
adam@0
|
4038 # we shouldn't force the makefile maintainer to figure out
|
adam@0
|
4039 # which system we are compiling for in order to pass an extra
|
adam@0
|
4040 # flag for every libtool invocation.
|
adam@0
|
4041 # allow_undefined=no
|
adam@0
|
4042
|
adam@0
|
4043 # FIXME: Unfortunately, there are problems with the above when trying
|
adam@0
|
4044 # to make a dll which has undefined symbols, in which case not
|
adam@0
|
4045 # even a static library is built. For now, we need to specify
|
adam@0
|
4046 # -no-undefined on the libtool link line when we can be certain
|
adam@0
|
4047 # that all symbols are satisfied, otherwise we get a static library.
|
adam@0
|
4048 allow_undefined=yes
|
adam@0
|
4049 ;;
|
adam@0
|
4050 *)
|
adam@0
|
4051 allow_undefined=yes
|
adam@0
|
4052 ;;
|
adam@0
|
4053 esac
|
adam@0
|
4054 libtool_args=$nonopt
|
adam@0
|
4055 base_compile="$nonopt $@"
|
adam@0
|
4056 compile_command=$nonopt
|
adam@0
|
4057 finalize_command=$nonopt
|
adam@0
|
4058
|
adam@0
|
4059 compile_rpath=
|
adam@0
|
4060 finalize_rpath=
|
adam@0
|
4061 compile_shlibpath=
|
adam@0
|
4062 finalize_shlibpath=
|
adam@0
|
4063 convenience=
|
adam@0
|
4064 old_convenience=
|
adam@0
|
4065 deplibs=
|
adam@0
|
4066 old_deplibs=
|
adam@0
|
4067 compiler_flags=
|
adam@0
|
4068 linker_flags=
|
adam@0
|
4069 dllsearchpath=
|
adam@0
|
4070 lib_search_path=`pwd`
|
adam@0
|
4071 inst_prefix_dir=
|
adam@0
|
4072 new_inherited_linker_flags=
|
adam@0
|
4073
|
adam@0
|
4074 avoid_version=no
|
adam@0
|
4075 dlfiles=
|
adam@0
|
4076 dlprefiles=
|
adam@0
|
4077 dlself=no
|
adam@0
|
4078 export_dynamic=no
|
adam@0
|
4079 export_symbols=
|
adam@0
|
4080 export_symbols_regex=
|
adam@0
|
4081 generated=
|
adam@0
|
4082 libobjs=
|
adam@0
|
4083 ltlibs=
|
adam@0
|
4084 module=no
|
adam@0
|
4085 no_install=no
|
adam@0
|
4086 objs=
|
adam@0
|
4087 non_pic_objects=
|
adam@0
|
4088 precious_files_regex=
|
adam@0
|
4089 prefer_static_libs=no
|
adam@0
|
4090 preload=no
|
adam@0
|
4091 prev=
|
adam@0
|
4092 prevarg=
|
adam@0
|
4093 release=
|
adam@0
|
4094 rpath=
|
adam@0
|
4095 xrpath=
|
adam@0
|
4096 perm_rpath=
|
adam@0
|
4097 temp_rpath=
|
adam@0
|
4098 thread_safe=no
|
adam@0
|
4099 vinfo=
|
adam@0
|
4100 vinfo_number=no
|
adam@0
|
4101 weak_libs=
|
adam@0
|
4102 single_module="${wl}-single_module"
|
adam@0
|
4103 func_infer_tag $base_compile
|
adam@0
|
4104
|
adam@0
|
4105 # We need to know -static, to get the right output filenames.
|
adam@0
|
4106 for arg
|
adam@0
|
4107 do
|
adam@0
|
4108 case $arg in
|
adam@0
|
4109 -shared)
|
adam@0
|
4110 test "$build_libtool_libs" != yes && \
|
adam@0
|
4111 func_fatal_configuration "can not build a shared library"
|
adam@0
|
4112 build_old_libs=no
|
adam@0
|
4113 break
|
adam@0
|
4114 ;;
|
adam@0
|
4115 -all-static | -static | -static-libtool-libs)
|
adam@0
|
4116 case $arg in
|
adam@0
|
4117 -all-static)
|
adam@0
|
4118 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
|
adam@0
|
4119 func_warning "complete static linking is impossible in this configuration"
|
adam@0
|
4120 fi
|
adam@0
|
4121 if test -n "$link_static_flag"; then
|
adam@0
|
4122 dlopen_self=$dlopen_self_static
|
adam@0
|
4123 fi
|
adam@0
|
4124 prefer_static_libs=yes
|
adam@0
|
4125 ;;
|
adam@0
|
4126 -static)
|
adam@0
|
4127 if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
adam@0
|
4128 dlopen_self=$dlopen_self_static
|
adam@0
|
4129 fi
|
adam@0
|
4130 prefer_static_libs=built
|
adam@0
|
4131 ;;
|
adam@0
|
4132 -static-libtool-libs)
|
adam@0
|
4133 if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
adam@0
|
4134 dlopen_self=$dlopen_self_static
|
adam@0
|
4135 fi
|
adam@0
|
4136 prefer_static_libs=yes
|
adam@0
|
4137 ;;
|
adam@0
|
4138 esac
|
adam@0
|
4139 build_libtool_libs=no
|
adam@0
|
4140 build_old_libs=yes
|
adam@0
|
4141 break
|
adam@0
|
4142 ;;
|
adam@0
|
4143 esac
|
adam@0
|
4144 done
|
adam@0
|
4145
|
adam@0
|
4146 # See if our shared archives depend on static archives.
|
adam@0
|
4147 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
|
adam@0
|
4148
|
adam@0
|
4149 # Go through the arguments, transforming them on the way.
|
adam@0
|
4150 while test "$#" -gt 0; do
|
adam@0
|
4151 arg="$1"
|
adam@0
|
4152 shift
|
adam@0
|
4153 func_quote_for_eval "$arg"
|
adam@0
|
4154 qarg=$func_quote_for_eval_unquoted_result
|
adam@0
|
4155 func_append libtool_args " $func_quote_for_eval_result"
|
adam@0
|
4156
|
adam@0
|
4157 # If the previous option needs an argument, assign it.
|
adam@0
|
4158 if test -n "$prev"; then
|
adam@0
|
4159 case $prev in
|
adam@0
|
4160 output)
|
adam@0
|
4161 func_append compile_command " @OUTPUT@"
|
adam@0
|
4162 func_append finalize_command " @OUTPUT@"
|
adam@0
|
4163 ;;
|
adam@0
|
4164 esac
|
adam@0
|
4165
|
adam@0
|
4166 case $prev in
|
adam@0
|
4167 dlfiles|dlprefiles)
|
adam@0
|
4168 if test "$preload" = no; then
|
adam@0
|
4169 # Add the symbol object into the linking commands.
|
adam@0
|
4170 func_append compile_command " @SYMFILE@"
|
adam@0
|
4171 func_append finalize_command " @SYMFILE@"
|
adam@0
|
4172 preload=yes
|
adam@0
|
4173 fi
|
adam@0
|
4174 case $arg in
|
adam@0
|
4175 *.la | *.lo) ;; # We handle these cases below.
|
adam@0
|
4176 force)
|
adam@0
|
4177 if test "$dlself" = no; then
|
adam@0
|
4178 dlself=needless
|
adam@0
|
4179 export_dynamic=yes
|
adam@0
|
4180 fi
|
adam@0
|
4181 prev=
|
adam@0
|
4182 continue
|
adam@0
|
4183 ;;
|
adam@0
|
4184 self)
|
adam@0
|
4185 if test "$prev" = dlprefiles; then
|
adam@0
|
4186 dlself=yes
|
adam@0
|
4187 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
|
adam@0
|
4188 dlself=yes
|
adam@0
|
4189 else
|
adam@0
|
4190 dlself=needless
|
adam@0
|
4191 export_dynamic=yes
|
adam@0
|
4192 fi
|
adam@0
|
4193 prev=
|
adam@0
|
4194 continue
|
adam@0
|
4195 ;;
|
adam@0
|
4196 *)
|
adam@0
|
4197 if test "$prev" = dlfiles; then
|
adam@0
|
4198 dlfiles="$dlfiles $arg"
|
adam@0
|
4199 else
|
adam@0
|
4200 dlprefiles="$dlprefiles $arg"
|
adam@0
|
4201 fi
|
adam@0
|
4202 prev=
|
adam@0
|
4203 continue
|
adam@0
|
4204 ;;
|
adam@0
|
4205 esac
|
adam@0
|
4206 ;;
|
adam@0
|
4207 expsyms)
|
adam@0
|
4208 export_symbols="$arg"
|
adam@0
|
4209 test -f "$arg" \
|
adam@0
|
4210 || func_fatal_error "symbol file \`$arg' does not exist"
|
adam@0
|
4211 prev=
|
adam@0
|
4212 continue
|
adam@0
|
4213 ;;
|
adam@0
|
4214 expsyms_regex)
|
adam@0
|
4215 export_symbols_regex="$arg"
|
adam@0
|
4216 prev=
|
adam@0
|
4217 continue
|
adam@0
|
4218 ;;
|
adam@0
|
4219 framework)
|
adam@0
|
4220 case $host in
|
adam@0
|
4221 *-*-darwin*)
|
adam@0
|
4222 case "$deplibs " in
|
adam@0
|
4223 *" $qarg.ltframework "*) ;;
|
adam@0
|
4224 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
|
adam@0
|
4225 ;;
|
adam@0
|
4226 esac
|
adam@0
|
4227 ;;
|
adam@0
|
4228 esac
|
adam@0
|
4229 prev=
|
adam@0
|
4230 continue
|
adam@0
|
4231 ;;
|
adam@0
|
4232 inst_prefix)
|
adam@0
|
4233 inst_prefix_dir="$arg"
|
adam@0
|
4234 prev=
|
adam@0
|
4235 continue
|
adam@0
|
4236 ;;
|
adam@0
|
4237 objectlist)
|
adam@0
|
4238 if test -f "$arg"; then
|
adam@0
|
4239 save_arg=$arg
|
adam@0
|
4240 moreargs=
|
adam@0
|
4241 for fil in `cat "$save_arg"`
|
adam@0
|
4242 do
|
adam@0
|
4243 # moreargs="$moreargs $fil"
|
adam@0
|
4244 arg=$fil
|
adam@0
|
4245 # A libtool-controlled object.
|
adam@0
|
4246
|
adam@0
|
4247 # Check to see that this really is a libtool object.
|
adam@0
|
4248 if func_lalib_unsafe_p "$arg"; then
|
adam@0
|
4249 pic_object=
|
adam@0
|
4250 non_pic_object=
|
adam@0
|
4251
|
adam@0
|
4252 # Read the .lo file
|
adam@0
|
4253 func_source "$arg"
|
adam@0
|
4254
|
adam@0
|
4255 if test -z "$pic_object" ||
|
adam@0
|
4256 test -z "$non_pic_object" ||
|
adam@0
|
4257 test "$pic_object" = none &&
|
adam@0
|
4258 test "$non_pic_object" = none; then
|
adam@0
|
4259 func_fatal_error "cannot find name of object for \`$arg'"
|
adam@0
|
4260 fi
|
adam@0
|
4261
|
adam@0
|
4262 # Extract subdirectory from the argument.
|
adam@0
|
4263 func_dirname "$arg" "/" ""
|
adam@0
|
4264 xdir="$func_dirname_result"
|
adam@0
|
4265
|
adam@0
|
4266 if test "$pic_object" != none; then
|
adam@0
|
4267 # Prepend the subdirectory the object is found in.
|
adam@0
|
4268 pic_object="$xdir$pic_object"
|
adam@0
|
4269
|
adam@0
|
4270 if test "$prev" = dlfiles; then
|
adam@0
|
4271 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
|
adam@0
|
4272 dlfiles="$dlfiles $pic_object"
|
adam@0
|
4273 prev=
|
adam@0
|
4274 continue
|
adam@0
|
4275 else
|
adam@0
|
4276 # If libtool objects are unsupported, then we need to preload.
|
adam@0
|
4277 prev=dlprefiles
|
adam@0
|
4278 fi
|
adam@0
|
4279 fi
|
adam@0
|
4280
|
adam@0
|
4281 # CHECK ME: I think I busted this. -Ossama
|
adam@0
|
4282 if test "$prev" = dlprefiles; then
|
adam@0
|
4283 # Preload the old-style object.
|
adam@0
|
4284 dlprefiles="$dlprefiles $pic_object"
|
adam@0
|
4285 prev=
|
adam@0
|
4286 fi
|
adam@0
|
4287
|
adam@0
|
4288 # A PIC object.
|
adam@0
|
4289 func_append libobjs " $pic_object"
|
adam@0
|
4290 arg="$pic_object"
|
adam@0
|
4291 fi
|
adam@0
|
4292
|
adam@0
|
4293 # Non-PIC object.
|
adam@0
|
4294 if test "$non_pic_object" != none; then
|
adam@0
|
4295 # Prepend the subdirectory the object is found in.
|
adam@0
|
4296 non_pic_object="$xdir$non_pic_object"
|
adam@0
|
4297
|
adam@0
|
4298 # A standard non-PIC object
|
adam@0
|
4299 func_append non_pic_objects " $non_pic_object"
|
adam@0
|
4300 if test -z "$pic_object" || test "$pic_object" = none ; then
|
adam@0
|
4301 arg="$non_pic_object"
|
adam@0
|
4302 fi
|
adam@0
|
4303 else
|
adam@0
|
4304 # If the PIC object exists, use it instead.
|
adam@0
|
4305 # $xdir was prepended to $pic_object above.
|
adam@0
|
4306 non_pic_object="$pic_object"
|
adam@0
|
4307 func_append non_pic_objects " $non_pic_object"
|
adam@0
|
4308 fi
|
adam@0
|
4309 else
|
adam@0
|
4310 # Only an error if not doing a dry-run.
|
adam@0
|
4311 if $opt_dry_run; then
|
adam@0
|
4312 # Extract subdirectory from the argument.
|
adam@0
|
4313 func_dirname "$arg" "/" ""
|
adam@0
|
4314 xdir="$func_dirname_result"
|
adam@0
|
4315
|
adam@0
|
4316 func_lo2o "$arg"
|
adam@0
|
4317 pic_object=$xdir$objdir/$func_lo2o_result
|
adam@0
|
4318 non_pic_object=$xdir$func_lo2o_result
|
adam@0
|
4319 func_append libobjs " $pic_object"
|
adam@0
|
4320 func_append non_pic_objects " $non_pic_object"
|
adam@0
|
4321 else
|
adam@0
|
4322 func_fatal_error "\`$arg' is not a valid libtool object"
|
adam@0
|
4323 fi
|
adam@0
|
4324 fi
|
adam@0
|
4325 done
|
adam@0
|
4326 else
|
adam@0
|
4327 func_fatal_error "link input file \`$arg' does not exist"
|
adam@0
|
4328 fi
|
adam@0
|
4329 arg=$save_arg
|
adam@0
|
4330 prev=
|
adam@0
|
4331 continue
|
adam@0
|
4332 ;;
|
adam@0
|
4333 precious_regex)
|
adam@0
|
4334 precious_files_regex="$arg"
|
adam@0
|
4335 prev=
|
adam@0
|
4336 continue
|
adam@0
|
4337 ;;
|
adam@0
|
4338 release)
|
adam@0
|
4339 release="-$arg"
|
adam@0
|
4340 prev=
|
adam@0
|
4341 continue
|
adam@0
|
4342 ;;
|
adam@0
|
4343 rpath | xrpath)
|
adam@0
|
4344 # We need an absolute path.
|
adam@0
|
4345 case $arg in
|
adam@0
|
4346 [\\/]* | [A-Za-z]:[\\/]*) ;;
|
adam@0
|
4347 *)
|
adam@0
|
4348 func_fatal_error "only absolute run-paths are allowed"
|
adam@0
|
4349 ;;
|
adam@0
|
4350 esac
|
adam@0
|
4351 if test "$prev" = rpath; then
|
adam@0
|
4352 case "$rpath " in
|
adam@0
|
4353 *" $arg "*) ;;
|
adam@0
|
4354 *) rpath="$rpath $arg" ;;
|
adam@0
|
4355 esac
|
adam@0
|
4356 else
|
adam@0
|
4357 case "$xrpath " in
|
adam@0
|
4358 *" $arg "*) ;;
|
adam@0
|
4359 *) xrpath="$xrpath $arg" ;;
|
adam@0
|
4360 esac
|
adam@0
|
4361 fi
|
adam@0
|
4362 prev=
|
adam@0
|
4363 continue
|
adam@0
|
4364 ;;
|
adam@0
|
4365 shrext)
|
adam@0
|
4366 shrext_cmds="$arg"
|
adam@0
|
4367 prev=
|
adam@0
|
4368 continue
|
adam@0
|
4369 ;;
|
adam@0
|
4370 weak)
|
adam@0
|
4371 weak_libs="$weak_libs $arg"
|
adam@0
|
4372 prev=
|
adam@0
|
4373 continue
|
adam@0
|
4374 ;;
|
adam@0
|
4375 xcclinker)
|
adam@0
|
4376 linker_flags="$linker_flags $qarg"
|
adam@0
|
4377 compiler_flags="$compiler_flags $qarg"
|
adam@0
|
4378 prev=
|
adam@0
|
4379 func_append compile_command " $qarg"
|
adam@0
|
4380 func_append finalize_command " $qarg"
|
adam@0
|
4381 continue
|
adam@0
|
4382 ;;
|
adam@0
|
4383 xcompiler)
|
adam@0
|
4384 compiler_flags="$compiler_flags $qarg"
|
adam@0
|
4385 prev=
|
adam@0
|
4386 func_append compile_command " $qarg"
|
adam@0
|
4387 func_append finalize_command " $qarg"
|
adam@0
|
4388 continue
|
adam@0
|
4389 ;;
|
adam@0
|
4390 xlinker)
|
adam@0
|
4391 linker_flags="$linker_flags $qarg"
|
adam@0
|
4392 compiler_flags="$compiler_flags $wl$qarg"
|
adam@0
|
4393 prev=
|
adam@0
|
4394 func_append compile_command " $wl$qarg"
|
adam@0
|
4395 func_append finalize_command " $wl$qarg"
|
adam@0
|
4396 continue
|
adam@0
|
4397 ;;
|
adam@0
|
4398 *)
|
adam@0
|
4399 eval "$prev=\"\$arg\""
|
adam@0
|
4400 prev=
|
adam@0
|
4401 continue
|
adam@0
|
4402 ;;
|
adam@0
|
4403 esac
|
adam@0
|
4404 fi # test -n "$prev"
|
adam@0
|
4405
|
adam@0
|
4406 prevarg="$arg"
|
adam@0
|
4407
|
adam@0
|
4408 case $arg in
|
adam@0
|
4409 -all-static)
|
adam@0
|
4410 if test -n "$link_static_flag"; then
|
adam@0
|
4411 # See comment for -static flag below, for more details.
|
adam@0
|
4412 func_append compile_command " $link_static_flag"
|
adam@0
|
4413 func_append finalize_command " $link_static_flag"
|
adam@0
|
4414 fi
|
adam@0
|
4415 continue
|
adam@0
|
4416 ;;
|
adam@0
|
4417
|
adam@0
|
4418 -allow-undefined)
|
adam@0
|
4419 # FIXME: remove this flag sometime in the future.
|
adam@0
|
4420 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
|
adam@0
|
4421 ;;
|
adam@0
|
4422
|
adam@0
|
4423 -avoid-version)
|
adam@0
|
4424 avoid_version=yes
|
adam@0
|
4425 continue
|
adam@0
|
4426 ;;
|
adam@0
|
4427
|
adam@0
|
4428 -dlopen)
|
adam@0
|
4429 prev=dlfiles
|
adam@0
|
4430 continue
|
adam@0
|
4431 ;;
|
adam@0
|
4432
|
adam@0
|
4433 -dlpreopen)
|
adam@0
|
4434 prev=dlprefiles
|
adam@0
|
4435 continue
|
adam@0
|
4436 ;;
|
adam@0
|
4437
|
adam@0
|
4438 -export-dynamic)
|
adam@0
|
4439 export_dynamic=yes
|
adam@0
|
4440 continue
|
adam@0
|
4441 ;;
|
adam@0
|
4442
|
adam@0
|
4443 -export-symbols | -export-symbols-regex)
|
adam@0
|
4444 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
|
adam@0
|
4445 func_fatal_error "more than one -exported-symbols argument is not allowed"
|
adam@0
|
4446 fi
|
adam@0
|
4447 if test "X$arg" = "X-export-symbols"; then
|
adam@0
|
4448 prev=expsyms
|
adam@0
|
4449 else
|
adam@0
|
4450 prev=expsyms_regex
|
adam@0
|
4451 fi
|
adam@0
|
4452 continue
|
adam@0
|
4453 ;;
|
adam@0
|
4454
|
adam@0
|
4455 -framework)
|
adam@0
|
4456 prev=framework
|
adam@0
|
4457 continue
|
adam@0
|
4458 ;;
|
adam@0
|
4459
|
adam@0
|
4460 -inst-prefix-dir)
|
adam@0
|
4461 prev=inst_prefix
|
adam@0
|
4462 continue
|
adam@0
|
4463 ;;
|
adam@0
|
4464
|
adam@0
|
4465 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
|
adam@0
|
4466 # so, if we see these flags be careful not to treat them like -L
|
adam@0
|
4467 -L[A-Z][A-Z]*:*)
|
adam@0
|
4468 case $with_gcc/$host in
|
adam@0
|
4469 no/*-*-irix* | /*-*-irix*)
|
adam@0
|
4470 func_append compile_command " $arg"
|
adam@0
|
4471 func_append finalize_command " $arg"
|
adam@0
|
4472 ;;
|
adam@0
|
4473 esac
|
adam@0
|
4474 continue
|
adam@0
|
4475 ;;
|
adam@0
|
4476
|
adam@0
|
4477 -L*)
|
adam@0
|
4478 func_stripname '-L' '' "$arg"
|
adam@0
|
4479 dir=$func_stripname_result
|
adam@0
|
4480 if test -z "$dir"; then
|
adam@0
|
4481 if test "$#" -gt 0; then
|
adam@0
|
4482 func_fatal_error "require no space between \`-L' and \`$1'"
|
adam@0
|
4483 else
|
adam@0
|
4484 func_fatal_error "need path for \`-L' option"
|
adam@0
|
4485 fi
|
adam@0
|
4486 fi
|
adam@0
|
4487 # We need an absolute path.
|
adam@0
|
4488 case $dir in
|
adam@0
|
4489 [\\/]* | [A-Za-z]:[\\/]*) ;;
|
adam@0
|
4490 *)
|
adam@0
|
4491 absdir=`cd "$dir" && pwd`
|
adam@0
|
4492 test -z "$absdir" && \
|
adam@0
|
4493 func_fatal_error "cannot determine absolute directory name of \`$dir'"
|
adam@0
|
4494 dir="$absdir"
|
adam@0
|
4495 ;;
|
adam@0
|
4496 esac
|
adam@0
|
4497 case "$deplibs " in
|
adam@0
|
4498 *" -L$dir "*) ;;
|
adam@0
|
4499 *)
|
adam@0
|
4500 deplibs="$deplibs -L$dir"
|
adam@0
|
4501 lib_search_path="$lib_search_path $dir"
|
adam@0
|
4502 ;;
|
adam@0
|
4503 esac
|
adam@0
|
4504 case $host in
|
adam@0
|
4505 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
adam@0
|
4506 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
|
adam@0
|
4507 case :$dllsearchpath: in
|
adam@0
|
4508 *":$dir:"*) ;;
|
adam@0
|
4509 ::) dllsearchpath=$dir;;
|
adam@0
|
4510 *) dllsearchpath="$dllsearchpath:$dir";;
|
adam@0
|
4511 esac
|
adam@0
|
4512 case :$dllsearchpath: in
|
adam@0
|
4513 *":$testbindir:"*) ;;
|
adam@0
|
4514 ::) dllsearchpath=$testbindir;;
|
adam@0
|
4515 *) dllsearchpath="$dllsearchpath:$testbindir";;
|
adam@0
|
4516 esac
|
adam@0
|
4517 ;;
|
adam@0
|
4518 esac
|
adam@0
|
4519 continue
|
adam@0
|
4520 ;;
|
adam@0
|
4521
|
adam@0
|
4522 -l*)
|
adam@0
|
4523 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
|
adam@0
|
4524 case $host in
|
adam@0
|
4525 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
|
adam@0
|
4526 # These systems don't actually have a C or math library (as such)
|
adam@0
|
4527 continue
|
adam@0
|
4528 ;;
|
adam@0
|
4529 *-*-os2*)
|
adam@0
|
4530 # These systems don't actually have a C library (as such)
|
adam@0
|
4531 test "X$arg" = "X-lc" && continue
|
adam@0
|
4532 ;;
|
adam@0
|
4533 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
|
adam@0
|
4534 # Do not include libc due to us having libc/libc_r.
|
adam@0
|
4535 test "X$arg" = "X-lc" && continue
|
adam@0
|
4536 ;;
|
adam@0
|
4537 *-*-rhapsody* | *-*-darwin1.[012])
|
adam@0
|
4538 # Rhapsody C and math libraries are in the System framework
|
adam@0
|
4539 deplibs="$deplibs System.ltframework"
|
adam@0
|
4540 continue
|
adam@0
|
4541 ;;
|
adam@0
|
4542 *-*-sco3.2v5* | *-*-sco5v6*)
|
adam@0
|
4543 # Causes problems with __ctype
|
adam@0
|
4544 test "X$arg" = "X-lc" && continue
|
adam@0
|
4545 ;;
|
adam@0
|
4546 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
|
adam@0
|
4547 # Compiler inserts libc in the correct place for threads to work
|
adam@0
|
4548 test "X$arg" = "X-lc" && continue
|
adam@0
|
4549 ;;
|
adam@0
|
4550 esac
|
adam@0
|
4551 elif test "X$arg" = "X-lc_r"; then
|
adam@0
|
4552 case $host in
|
adam@0
|
4553 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
|
adam@0
|
4554 # Do not include libc_r directly, use -pthread flag.
|
adam@0
|
4555 continue
|
adam@0
|
4556 ;;
|
adam@0
|
4557 esac
|
adam@0
|
4558 fi
|
adam@0
|
4559 deplibs="$deplibs $arg"
|
adam@0
|
4560 continue
|
adam@0
|
4561 ;;
|
adam@0
|
4562
|
adam@0
|
4563 -module)
|
adam@0
|
4564 module=yes
|
adam@0
|
4565 continue
|
adam@0
|
4566 ;;
|
adam@0
|
4567
|
adam@0
|
4568 # Tru64 UNIX uses -model [arg] to determine the layout of C++
|
adam@0
|
4569 # classes, name mangling, and exception handling.
|
adam@0
|
4570 # Darwin uses the -arch flag to determine output architecture.
|
adam@0
|
4571 -model|-arch|-isysroot)
|
adam@0
|
4572 compiler_flags="$compiler_flags $arg"
|
adam@0
|
4573 func_append compile_command " $arg"
|
adam@0
|
4574 func_append finalize_command " $arg"
|
adam@0
|
4575 prev=xcompiler
|
adam@0
|
4576 continue
|
adam@0
|
4577 ;;
|
adam@0
|
4578
|
adam@0
|
4579 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
|
adam@0
|
4580 compiler_flags="$compiler_flags $arg"
|
adam@0
|
4581 func_append compile_command " $arg"
|
adam@0
|
4582 func_append finalize_command " $arg"
|
adam@0
|
4583 case "$new_inherited_linker_flags " in
|
adam@0
|
4584 *" $arg "*) ;;
|
adam@0
|
4585 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
|
adam@0
|
4586 esac
|
adam@0
|
4587 continue
|
adam@0
|
4588 ;;
|
adam@0
|
4589
|
adam@0
|
4590 -multi_module)
|
adam@0
|
4591 single_module="${wl}-multi_module"
|
adam@0
|
4592 continue
|
adam@0
|
4593 ;;
|
adam@0
|
4594
|
adam@0
|
4595 -no-fast-install)
|
adam@0
|
4596 fast_install=no
|
adam@0
|
4597 continue
|
adam@0
|
4598 ;;
|
adam@0
|
4599
|
adam@0
|
4600 -no-install)
|
adam@0
|
4601 case $host in
|
adam@0
|
4602 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
|
adam@0
|
4603 # The PATH hackery in wrapper scripts is required on Windows
|
adam@0
|
4604 # and Darwin in order for the loader to find any dlls it needs.
|
adam@0
|
4605 func_warning "\`-no-install' is ignored for $host"
|
adam@0
|
4606 func_warning "assuming \`-no-fast-install' instead"
|
adam@0
|
4607 fast_install=no
|
adam@0
|
4608 ;;
|
adam@0
|
4609 *) no_install=yes ;;
|
adam@0
|
4610 esac
|
adam@0
|
4611 continue
|
adam@0
|
4612 ;;
|
adam@0
|
4613
|
adam@0
|
4614 -no-undefined)
|
adam@0
|
4615 allow_undefined=no
|
adam@0
|
4616 continue
|
adam@0
|
4617 ;;
|
adam@0
|
4618
|
adam@0
|
4619 -objectlist)
|
adam@0
|
4620 prev=objectlist
|
adam@0
|
4621 continue
|
adam@0
|
4622 ;;
|
adam@0
|
4623
|
adam@0
|
4624 -o) prev=output ;;
|
adam@0
|
4625
|
adam@0
|
4626 -precious-files-regex)
|
adam@0
|
4627 prev=precious_regex
|
adam@0
|
4628 continue
|
adam@0
|
4629 ;;
|
adam@0
|
4630
|
adam@0
|
4631 -release)
|
adam@0
|
4632 prev=release
|
adam@0
|
4633 continue
|
adam@0
|
4634 ;;
|
adam@0
|
4635
|
adam@0
|
4636 -rpath)
|
adam@0
|
4637 prev=rpath
|
adam@0
|
4638 continue
|
adam@0
|
4639 ;;
|
adam@0
|
4640
|
adam@0
|
4641 -R)
|
adam@0
|
4642 prev=xrpath
|
adam@0
|
4643 continue
|
adam@0
|
4644 ;;
|
adam@0
|
4645
|
adam@0
|
4646 -R*)
|
adam@0
|
4647 func_stripname '-R' '' "$arg"
|
adam@0
|
4648 dir=$func_stripname_result
|
adam@0
|
4649 # We need an absolute path.
|
adam@0
|
4650 case $dir in
|
adam@0
|
4651 [\\/]* | [A-Za-z]:[\\/]*) ;;
|
adam@0
|
4652 *)
|
adam@0
|
4653 func_fatal_error "only absolute run-paths are allowed"
|
adam@0
|
4654 ;;
|
adam@0
|
4655 esac
|
adam@0
|
4656 case "$xrpath " in
|
adam@0
|
4657 *" $dir "*) ;;
|
adam@0
|
4658 *) xrpath="$xrpath $dir" ;;
|
adam@0
|
4659 esac
|
adam@0
|
4660 continue
|
adam@0
|
4661 ;;
|
adam@0
|
4662
|
adam@0
|
4663 -shared)
|
adam@0
|
4664 # The effects of -shared are defined in a previous loop.
|
adam@0
|
4665 continue
|
adam@0
|
4666 ;;
|
adam@0
|
4667
|
adam@0
|
4668 -shrext)
|
adam@0
|
4669 prev=shrext
|
adam@0
|
4670 continue
|
adam@0
|
4671 ;;
|
adam@0
|
4672
|
adam@0
|
4673 -static | -static-libtool-libs)
|
adam@0
|
4674 # The effects of -static are defined in a previous loop.
|
adam@0
|
4675 # We used to do the same as -all-static on platforms that
|
adam@0
|
4676 # didn't have a PIC flag, but the assumption that the effects
|
adam@0
|
4677 # would be equivalent was wrong. It would break on at least
|
adam@0
|
4678 # Digital Unix and AIX.
|
adam@0
|
4679 continue
|
adam@0
|
4680 ;;
|
adam@0
|
4681
|
adam@0
|
4682 -thread-safe)
|
adam@0
|
4683 thread_safe=yes
|
adam@0
|
4684 continue
|
adam@0
|
4685 ;;
|
adam@0
|
4686
|
adam@0
|
4687 -version-info)
|
adam@0
|
4688 prev=vinfo
|
adam@0
|
4689 continue
|
adam@0
|
4690 ;;
|
adam@0
|
4691
|
adam@0
|
4692 -version-number)
|
adam@0
|
4693 prev=vinfo
|
adam@0
|
4694 vinfo_number=yes
|
adam@0
|
4695 continue
|
adam@0
|
4696 ;;
|
adam@0
|
4697
|
adam@0
|
4698 -weak)
|
adam@0
|
4699 prev=weak
|
adam@0
|
4700 continue
|
adam@0
|
4701 ;;
|
adam@0
|
4702
|
adam@0
|
4703 -Wc,*)
|
adam@0
|
4704 func_stripname '-Wc,' '' "$arg"
|
adam@0
|
4705 args=$func_stripname_result
|
adam@0
|
4706 arg=
|
adam@0
|
4707 save_ifs="$IFS"; IFS=','
|
adam@0
|
4708 for flag in $args; do
|
adam@0
|
4709 IFS="$save_ifs"
|
adam@0
|
4710 func_quote_for_eval "$flag"
|
adam@0
|
4711 arg="$arg $wl$func_quote_for_eval_result"
|
adam@0
|
4712 compiler_flags="$compiler_flags $func_quote_for_eval_result"
|
adam@0
|
4713 done
|
adam@0
|
4714 IFS="$save_ifs"
|
adam@0
|
4715 func_stripname ' ' '' "$arg"
|
adam@0
|
4716 arg=$func_stripname_result
|
adam@0
|
4717 ;;
|
adam@0
|
4718
|
adam@0
|
4719 -Wl,*)
|
adam@0
|
4720 func_stripname '-Wl,' '' "$arg"
|
adam@0
|
4721 args=$func_stripname_result
|
adam@0
|
4722 arg=
|
adam@0
|
4723 save_ifs="$IFS"; IFS=','
|
adam@0
|
4724 for flag in $args; do
|
adam@0
|
4725 IFS="$save_ifs"
|
adam@0
|
4726 func_quote_for_eval "$flag"
|
adam@0
|
4727 arg="$arg $wl$func_quote_for_eval_result"
|
adam@0
|
4728 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
|
adam@0
|
4729 linker_flags="$linker_flags $func_quote_for_eval_result"
|
adam@0
|
4730 done
|
adam@0
|
4731 IFS="$save_ifs"
|
adam@0
|
4732 func_stripname ' ' '' "$arg"
|
adam@0
|
4733 arg=$func_stripname_result
|
adam@0
|
4734 ;;
|
adam@0
|
4735
|
adam@0
|
4736 -Xcompiler)
|
adam@0
|
4737 prev=xcompiler
|
adam@0
|
4738 continue
|
adam@0
|
4739 ;;
|
adam@0
|
4740
|
adam@0
|
4741 -Xlinker)
|
adam@0
|
4742 prev=xlinker
|
adam@0
|
4743 continue
|
adam@0
|
4744 ;;
|
adam@0
|
4745
|
adam@0
|
4746 -XCClinker)
|
adam@0
|
4747 prev=xcclinker
|
adam@0
|
4748 continue
|
adam@0
|
4749 ;;
|
adam@0
|
4750
|
adam@0
|
4751 # -msg_* for osf cc
|
adam@0
|
4752 -msg_*)
|
adam@0
|
4753 func_quote_for_eval "$arg"
|
adam@0
|
4754 arg="$func_quote_for_eval_result"
|
adam@0
|
4755 ;;
|
adam@0
|
4756
|
adam@0
|
4757 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
|
adam@0
|
4758 # -r[0-9][0-9]* specifies the processor on the SGI compiler
|
adam@0
|
4759 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
|
adam@0
|
4760 # +DA*, +DD* enable 64-bit mode on the HP compiler
|
adam@0
|
4761 # -q* pass through compiler args for the IBM compiler
|
adam@0
|
4762 # -m*, -t[45]*, -txscale* pass through architecture-specific
|
adam@0
|
4763 # compiler args for GCC
|
adam@0
|
4764 # -F/path gives path to uninstalled frameworks, gcc on darwin
|
adam@0
|
4765 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
|
adam@0
|
4766 # @file GCC response files
|
adam@0
|
4767 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
|
adam@0
|
4768 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
|
adam@0
|
4769 func_quote_for_eval "$arg"
|
adam@0
|
4770 arg="$func_quote_for_eval_result"
|
adam@0
|
4771 func_append compile_command " $arg"
|
adam@0
|
4772 func_append finalize_command " $arg"
|
adam@0
|
4773 compiler_flags="$compiler_flags $arg"
|
adam@0
|
4774 continue
|
adam@0
|
4775 ;;
|
adam@0
|
4776
|
adam@0
|
4777 # Some other compiler flag.
|
adam@0
|
4778 -* | +*)
|
adam@0
|
4779 func_quote_for_eval "$arg"
|
adam@0
|
4780 arg="$func_quote_for_eval_result"
|
adam@0
|
4781 ;;
|
adam@0
|
4782
|
adam@0
|
4783 *.$objext)
|
adam@0
|
4784 # A standard object.
|
adam@0
|
4785 objs="$objs $arg"
|
adam@0
|
4786 ;;
|
adam@0
|
4787
|
adam@0
|
4788 *.lo)
|
adam@0
|
4789 # A libtool-controlled object.
|
adam@0
|
4790
|
adam@0
|
4791 # Check to see that this really is a libtool object.
|
adam@0
|
4792 if func_lalib_unsafe_p "$arg"; then
|
adam@0
|
4793 pic_object=
|
adam@0
|
4794 non_pic_object=
|
adam@0
|
4795
|
adam@0
|
4796 # Read the .lo file
|
adam@0
|
4797 func_source "$arg"
|
adam@0
|
4798
|
adam@0
|
4799 if test -z "$pic_object" ||
|
adam@0
|
4800 test -z "$non_pic_object" ||
|
adam@0
|
4801 test "$pic_object" = none &&
|
adam@0
|
4802 test "$non_pic_object" = none; then
|
adam@0
|
4803 func_fatal_error "cannot find name of object for \`$arg'"
|
adam@0
|
4804 fi
|
adam@0
|
4805
|
adam@0
|
4806 # Extract subdirectory from the argument.
|
adam@0
|
4807 func_dirname "$arg" "/" ""
|
adam@0
|
4808 xdir="$func_dirname_result"
|
adam@0
|
4809
|
adam@0
|
4810 if test "$pic_object" != none; then
|
adam@0
|
4811 # Prepend the subdirectory the object is found in.
|
adam@0
|
4812 pic_object="$xdir$pic_object"
|
adam@0
|
4813
|
adam@0
|
4814 if test "$prev" = dlfiles; then
|
adam@0
|
4815 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
|
adam@0
|
4816 dlfiles="$dlfiles $pic_object"
|
adam@0
|
4817 prev=
|
adam@0
|
4818 continue
|
adam@0
|
4819 else
|
adam@0
|
4820 # If libtool objects are unsupported, then we need to preload.
|
adam@0
|
4821 prev=dlprefiles
|
adam@0
|
4822 fi
|
adam@0
|
4823 fi
|
adam@0
|
4824
|
adam@0
|
4825 # CHECK ME: I think I busted this. -Ossama
|
adam@0
|
4826 if test "$prev" = dlprefiles; then
|
adam@0
|
4827 # Preload the old-style object.
|
adam@0
|
4828 dlprefiles="$dlprefiles $pic_object"
|
adam@0
|
4829 prev=
|
adam@0
|
4830 fi
|
adam@0
|
4831
|
adam@0
|
4832 # A PIC object.
|
adam@0
|
4833 func_append libobjs " $pic_object"
|
adam@0
|
4834 arg="$pic_object"
|
adam@0
|
4835 fi
|
adam@0
|
4836
|
adam@0
|
4837 # Non-PIC object.
|
adam@0
|
4838 if test "$non_pic_object" != none; then
|
adam@0
|
4839 # Prepend the subdirectory the object is found in.
|
adam@0
|
4840 non_pic_object="$xdir$non_pic_object"
|
adam@0
|
4841
|
adam@0
|
4842 # A standard non-PIC object
|
adam@0
|
4843 func_append non_pic_objects " $non_pic_object"
|
adam@0
|
4844 if test -z "$pic_object" || test "$pic_object" = none ; then
|
adam@0
|
4845 arg="$non_pic_object"
|
adam@0
|
4846 fi
|
adam@0
|
4847 else
|
adam@0
|
4848 # If the PIC object exists, use it instead.
|
adam@0
|
4849 # $xdir was prepended to $pic_object above.
|
adam@0
|
4850 non_pic_object="$pic_object"
|
adam@0
|
4851 func_append non_pic_objects " $non_pic_object"
|
adam@0
|
4852 fi
|
adam@0
|
4853 else
|
adam@0
|
4854 # Only an error if not doing a dry-run.
|
adam@0
|
4855 if $opt_dry_run; then
|
adam@0
|
4856 # Extract subdirectory from the argument.
|
adam@0
|
4857 func_dirname "$arg" "/" ""
|
adam@0
|
4858 xdir="$func_dirname_result"
|
adam@0
|
4859
|
adam@0
|
4860 func_lo2o "$arg"
|
adam@0
|
4861 pic_object=$xdir$objdir/$func_lo2o_result
|
adam@0
|
4862 non_pic_object=$xdir$func_lo2o_result
|
adam@0
|
4863 func_append libobjs " $pic_object"
|
adam@0
|
4864 func_append non_pic_objects " $non_pic_object"
|
adam@0
|
4865 else
|
adam@0
|
4866 func_fatal_error "\`$arg' is not a valid libtool object"
|
adam@0
|
4867 fi
|
adam@0
|
4868 fi
|
adam@0
|
4869 ;;
|
adam@0
|
4870
|
adam@0
|
4871 *.$libext)
|
adam@0
|
4872 # An archive.
|
adam@0
|
4873 deplibs="$deplibs $arg"
|
adam@0
|
4874 old_deplibs="$old_deplibs $arg"
|
adam@0
|
4875 continue
|
adam@0
|
4876 ;;
|
adam@0
|
4877
|
adam@0
|
4878 *.la)
|
adam@0
|
4879 # A libtool-controlled library.
|
adam@0
|
4880
|
adam@0
|
4881 if test "$prev" = dlfiles; then
|
adam@0
|
4882 # This library was specified with -dlopen.
|
adam@0
|
4883 dlfiles="$dlfiles $arg"
|
adam@0
|
4884 prev=
|
adam@0
|
4885 elif test "$prev" = dlprefiles; then
|
adam@0
|
4886 # The library was specified with -dlpreopen.
|
adam@0
|
4887 dlprefiles="$dlprefiles $arg"
|
adam@0
|
4888 prev=
|
adam@0
|
4889 else
|
adam@0
|
4890 deplibs="$deplibs $arg"
|
adam@0
|
4891 fi
|
adam@0
|
4892 continue
|
adam@0
|
4893 ;;
|
adam@0
|
4894
|
adam@0
|
4895 # Some other compiler argument.
|
adam@0
|
4896 *)
|
adam@0
|
4897 # Unknown arguments in both finalize_command and compile_command need
|
adam@0
|
4898 # to be aesthetically quoted because they are evaled later.
|
adam@0
|
4899 func_quote_for_eval "$arg"
|
adam@0
|
4900 arg="$func_quote_for_eval_result"
|
adam@0
|
4901 ;;
|
adam@0
|
4902 esac # arg
|
adam@0
|
4903
|
adam@0
|
4904 # Now actually substitute the argument into the commands.
|
adam@0
|
4905 if test -n "$arg"; then
|
adam@0
|
4906 func_append compile_command " $arg"
|
adam@0
|
4907 func_append finalize_command " $arg"
|
adam@0
|
4908 fi
|
adam@0
|
4909 done # argument parsing loop
|
adam@0
|
4910
|
adam@0
|
4911 test -n "$prev" && \
|
adam@0
|
4912 func_fatal_help "the \`$prevarg' option requires an argument"
|
adam@0
|
4913
|
adam@0
|
4914 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
|
adam@0
|
4915 eval arg=\"$export_dynamic_flag_spec\"
|
adam@0
|
4916 func_append compile_command " $arg"
|
adam@0
|
4917 func_append finalize_command " $arg"
|
adam@0
|
4918 fi
|
adam@0
|
4919
|
adam@0
|
4920 oldlibs=
|
adam@0
|
4921 # calculate the name of the file, without its directory
|
adam@0
|
4922 func_basename "$output"
|
adam@0
|
4923 outputname="$func_basename_result"
|
adam@0
|
4924 libobjs_save="$libobjs"
|
adam@0
|
4925
|
adam@0
|
4926 if test -n "$shlibpath_var"; then
|
adam@0
|
4927 # get the directories listed in $shlibpath_var
|
adam@0
|
4928 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
|
adam@0
|
4929 else
|
adam@0
|
4930 shlib_search_path=
|
adam@0
|
4931 fi
|
adam@0
|
4932 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
|
adam@0
|
4933 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
|
adam@0
|
4934
|
adam@0
|
4935 func_dirname "$output" "/" ""
|
adam@0
|
4936 output_objdir="$func_dirname_result$objdir"
|
adam@0
|
4937 # Create the object directory.
|
adam@0
|
4938 func_mkdir_p "$output_objdir"
|
adam@0
|
4939
|
adam@0
|
4940 # Determine the type of output
|
adam@0
|
4941 case $output in
|
adam@0
|
4942 "")
|
adam@0
|
4943 func_fatal_help "you must specify an output file"
|
adam@0
|
4944 ;;
|
adam@0
|
4945 *.$libext) linkmode=oldlib ;;
|
adam@0
|
4946 *.lo | *.$objext) linkmode=obj ;;
|
adam@0
|
4947 *.la) linkmode=lib ;;
|
adam@0
|
4948 *) linkmode=prog ;; # Anything else should be a program.
|
adam@0
|
4949 esac
|
adam@0
|
4950
|
adam@0
|
4951 specialdeplibs=
|
adam@0
|
4952
|
adam@0
|
4953 libs=
|
adam@0
|
4954 # Find all interdependent deplibs by searching for libraries
|
adam@0
|
4955 # that are linked more than once (e.g. -la -lb -la)
|
adam@0
|
4956 for deplib in $deplibs; do
|
adam@0
|
4957 if $opt_duplicate_deps ; then
|
adam@0
|
4958 case "$libs " in
|
adam@0
|
4959 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
|
adam@0
|
4960 esac
|
adam@0
|
4961 fi
|
adam@0
|
4962 libs="$libs $deplib"
|
adam@0
|
4963 done
|
adam@0
|
4964
|
adam@0
|
4965 if test "$linkmode" = lib; then
|
adam@0
|
4966 libs="$predeps $libs $compiler_lib_search_path $postdeps"
|
adam@0
|
4967
|
adam@0
|
4968 # Compute libraries that are listed more than once in $predeps
|
adam@0
|
4969 # $postdeps and mark them as special (i.e., whose duplicates are
|
adam@0
|
4970 # not to be eliminated).
|
adam@0
|
4971 pre_post_deps=
|
adam@0
|
4972 if $opt_duplicate_compiler_generated_deps; then
|
adam@0
|
4973 for pre_post_dep in $predeps $postdeps; do
|
adam@0
|
4974 case "$pre_post_deps " in
|
adam@0
|
4975 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
|
adam@0
|
4976 esac
|
adam@0
|
4977 pre_post_deps="$pre_post_deps $pre_post_dep"
|
adam@0
|
4978 done
|
adam@0
|
4979 fi
|
adam@0
|
4980 pre_post_deps=
|
adam@0
|
4981 fi
|
adam@0
|
4982
|
adam@0
|
4983 deplibs=
|
adam@0
|
4984 newdependency_libs=
|
adam@0
|
4985 newlib_search_path=
|
adam@0
|
4986 need_relink=no # whether we're linking any uninstalled libtool libraries
|
adam@0
|
4987 notinst_deplibs= # not-installed libtool libraries
|
adam@0
|
4988 notinst_path= # paths that contain not-installed libtool libraries
|
adam@0
|
4989
|
adam@0
|
4990 case $linkmode in
|
adam@0
|
4991 lib)
|
adam@0
|
4992 passes="conv dlpreopen link"
|
adam@0
|
4993 for file in $dlfiles $dlprefiles; do
|
adam@0
|
4994 case $file in
|
adam@0
|
4995 *.la) ;;
|
adam@0
|
4996 *)
|
adam@0
|
4997 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
|
adam@0
|
4998 ;;
|
adam@0
|
4999 esac
|
adam@0
|
5000 done
|
adam@0
|
5001 ;;
|
adam@0
|
5002 prog)
|
adam@0
|
5003 compile_deplibs=
|
adam@0
|
5004 finalize_deplibs=
|
adam@0
|
5005 alldeplibs=no
|
adam@0
|
5006 newdlfiles=
|
adam@0
|
5007 newdlprefiles=
|
adam@0
|
5008 passes="conv scan dlopen dlpreopen link"
|
adam@0
|
5009 ;;
|
adam@0
|
5010 *) passes="conv"
|
adam@0
|
5011 ;;
|
adam@0
|
5012 esac
|
adam@0
|
5013
|
adam@0
|
5014 for pass in $passes; do
|
adam@0
|
5015 # The preopen pass in lib mode reverses $deplibs; put it back here
|
adam@0
|
5016 # so that -L comes before libs that need it for instance...
|
adam@0
|
5017 if test "$linkmode,$pass" = "lib,link"; then
|
adam@0
|
5018 ## FIXME: Find the place where the list is rebuilt in the wrong
|
adam@0
|
5019 ## order, and fix it there properly
|
adam@0
|
5020 tmp_deplibs=
|
adam@0
|
5021 for deplib in $deplibs; do
|
adam@0
|
5022 tmp_deplibs="$deplib $tmp_deplibs"
|
adam@0
|
5023 done
|
adam@0
|
5024 deplibs="$tmp_deplibs"
|
adam@0
|
5025 fi
|
adam@0
|
5026
|
adam@0
|
5027 if test "$linkmode,$pass" = "lib,link" ||
|
adam@0
|
5028 test "$linkmode,$pass" = "prog,scan"; then
|
adam@0
|
5029 libs="$deplibs"
|
adam@0
|
5030 deplibs=
|
adam@0
|
5031 fi
|
adam@0
|
5032 if test "$linkmode" = prog; then
|
adam@0
|
5033 case $pass in
|
adam@0
|
5034 dlopen) libs="$dlfiles" ;;
|
adam@0
|
5035 dlpreopen) libs="$dlprefiles" ;;
|
adam@0
|
5036 link)
|
adam@0
|
5037 libs="$deplibs %DEPLIBS%"
|
adam@0
|
5038 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
|
adam@0
|
5039 ;;
|
adam@0
|
5040 esac
|
adam@0
|
5041 fi
|
adam@0
|
5042 if test "$linkmode,$pass" = "lib,dlpreopen"; then
|
adam@0
|
5043 # Collect and forward deplibs of preopened libtool libs
|
adam@0
|
5044 for lib in $dlprefiles; do
|
adam@0
|
5045 # Ignore non-libtool-libs
|
adam@0
|
5046 dependency_libs=
|
adam@0
|
5047 case $lib in
|
adam@0
|
5048 *.la) func_source "$lib" ;;
|
adam@0
|
5049 esac
|
adam@0
|
5050
|
adam@0
|
5051 # Collect preopened libtool deplibs, except any this library
|
adam@0
|
5052 # has declared as weak libs
|
adam@0
|
5053 for deplib in $dependency_libs; do
|
adam@0
|
5054 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
|
adam@0
|
5055 case " $weak_libs " in
|
adam@0
|
5056 *" $deplib_base "*) ;;
|
adam@0
|
5057 *) deplibs="$deplibs $deplib" ;;
|
adam@0
|
5058 esac
|
adam@0
|
5059 done
|
adam@0
|
5060 done
|
adam@0
|
5061 libs="$dlprefiles"
|
adam@0
|
5062 fi
|
adam@0
|
5063 if test "$pass" = dlopen; then
|
adam@0
|
5064 # Collect dlpreopened libraries
|
adam@0
|
5065 save_deplibs="$deplibs"
|
adam@0
|
5066 deplibs=
|
adam@0
|
5067 fi
|
adam@0
|
5068
|
adam@0
|
5069 for deplib in $libs; do
|
adam@0
|
5070 lib=
|
adam@0
|
5071 found=no
|
adam@0
|
5072 case $deplib in
|
adam@0
|
5073 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
|
adam@0
|
5074 if test "$linkmode,$pass" = "prog,link"; then
|
adam@0
|
5075 compile_deplibs="$deplib $compile_deplibs"
|
adam@0
|
5076 finalize_deplibs="$deplib $finalize_deplibs"
|
adam@0
|
5077 else
|
adam@0
|
5078 compiler_flags="$compiler_flags $deplib"
|
adam@0
|
5079 if test "$linkmode" = lib ; then
|
adam@0
|
5080 case "$new_inherited_linker_flags " in
|
adam@0
|
5081 *" $deplib "*) ;;
|
adam@0
|
5082 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
|
adam@0
|
5083 esac
|
adam@0
|
5084 fi
|
adam@0
|
5085 fi
|
adam@0
|
5086 continue
|
adam@0
|
5087 ;;
|
adam@0
|
5088 -l*)
|
adam@0
|
5089 if test "$linkmode" != lib && test "$linkmode" != prog; then
|
adam@0
|
5090 func_warning "\`-l' is ignored for archives/objects"
|
adam@0
|
5091 continue
|
adam@0
|
5092 fi
|
adam@0
|
5093 func_stripname '-l' '' "$deplib"
|
adam@0
|
5094 name=$func_stripname_result
|
adam@0
|
5095 if test "$linkmode" = lib; then
|
adam@0
|
5096 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
|
adam@0
|
5097 else
|
adam@0
|
5098 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
|
adam@0
|
5099 fi
|
adam@0
|
5100 for searchdir in $searchdirs; do
|
adam@0
|
5101 for search_ext in .la $std_shrext .so .a; do
|
adam@0
|
5102 # Search the libtool library
|
adam@0
|
5103 lib="$searchdir/lib${name}${search_ext}"
|
adam@0
|
5104 if test -f "$lib"; then
|
adam@0
|
5105 if test "$search_ext" = ".la"; then
|
adam@0
|
5106 found=yes
|
adam@0
|
5107 else
|
adam@0
|
5108 found=no
|
adam@0
|
5109 fi
|
adam@0
|
5110 break 2
|
adam@0
|
5111 fi
|
adam@0
|
5112 done
|
adam@0
|
5113 done
|
adam@0
|
5114 if test "$found" != yes; then
|
adam@0
|
5115 # deplib doesn't seem to be a libtool library
|
adam@0
|
5116 if test "$linkmode,$pass" = "prog,link"; then
|
adam@0
|
5117 compile_deplibs="$deplib $compile_deplibs"
|
adam@0
|
5118 finalize_deplibs="$deplib $finalize_deplibs"
|
adam@0
|
5119 else
|
adam@0
|
5120 deplibs="$deplib $deplibs"
|
adam@0
|
5121 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
|
adam@0
|
5122 fi
|
adam@0
|
5123 continue
|
adam@0
|
5124 else # deplib is a libtool library
|
adam@0
|
5125 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
|
adam@0
|
5126 # We need to do some special things here, and not later.
|
adam@0
|
5127 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
adam@0
|
5128 case " $predeps $postdeps " in
|
adam@0
|
5129 *" $deplib "*)
|
adam@0
|
5130 if func_lalib_p "$lib"; then
|
adam@0
|
5131 library_names=
|
adam@0
|
5132 old_library=
|
adam@0
|
5133 func_source "$lib"
|
adam@0
|
5134 for l in $old_library $library_names; do
|
adam@0
|
5135 ll="$l"
|
adam@0
|
5136 done
|
adam@0
|
5137 if test "X$ll" = "X$old_library" ; then # only static version available
|
adam@0
|
5138 found=no
|
adam@0
|
5139 func_dirname "$lib" "" "."
|
adam@0
|
5140 ladir="$func_dirname_result"
|
adam@0
|
5141 lib=$ladir/$old_library
|
adam@0
|
5142 if test "$linkmode,$pass" = "prog,link"; then
|
adam@0
|
5143 compile_deplibs="$deplib $compile_deplibs"
|
adam@0
|
5144 finalize_deplibs="$deplib $finalize_deplibs"
|
adam@0
|
5145 else
|
adam@0
|
5146 deplibs="$deplib $deplibs"
|
adam@0
|
5147 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
|
adam@0
|
5148 fi
|
adam@0
|
5149 continue
|
adam@0
|
5150 fi
|
adam@0
|
5151 fi
|
adam@0
|
5152 ;;
|
adam@0
|
5153 *) ;;
|
adam@0
|
5154 esac
|
adam@0
|
5155 fi
|
adam@0
|
5156 fi
|
adam@0
|
5157 ;; # -l
|
adam@0
|
5158 *.ltframework)
|
adam@0
|
5159 if test "$linkmode,$pass" = "prog,link"; then
|
adam@0
|
5160 compile_deplibs="$deplib $compile_deplibs"
|
adam@0
|
5161 finalize_deplibs="$deplib $finalize_deplibs"
|
adam@0
|
5162 else
|
adam@0
|
5163 deplibs="$deplib $deplibs"
|
adam@0
|
5164 if test "$linkmode" = lib ; then
|
adam@0
|
5165 case "$new_inherited_linker_flags " in
|
adam@0
|
5166 *" $deplib "*) ;;
|
adam@0
|
5167 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
|
adam@0
|
5168 esac
|
adam@0
|
5169 fi
|
adam@0
|
5170 fi
|
adam@0
|
5171 continue
|
adam@0
|
5172 ;;
|
adam@0
|
5173 -L*)
|
adam@0
|
5174 case $linkmode in
|
adam@0
|
5175 lib)
|
adam@0
|
5176 deplibs="$deplib $deplibs"
|
adam@0
|
5177 test "$pass" = conv && continue
|
adam@0
|
5178 newdependency_libs="$deplib $newdependency_libs"
|
adam@0
|
5179 func_stripname '-L' '' "$deplib"
|
adam@0
|
5180 newlib_search_path="$newlib_search_path $func_stripname_result"
|
adam@0
|
5181 ;;
|
adam@0
|
5182 prog)
|
adam@0
|
5183 if test "$pass" = conv; then
|
adam@0
|
5184 deplibs="$deplib $deplibs"
|
adam@0
|
5185 continue
|
adam@0
|
5186 fi
|
adam@0
|
5187 if test "$pass" = scan; then
|
adam@0
|
5188 deplibs="$deplib $deplibs"
|
adam@0
|
5189 else
|
adam@0
|
5190 compile_deplibs="$deplib $compile_deplibs"
|
adam@0
|
5191 finalize_deplibs="$deplib $finalize_deplibs"
|
adam@0
|
5192 fi
|
adam@0
|
5193 func_stripname '-L' '' "$deplib"
|
adam@0
|
5194 newlib_search_path="$newlib_search_path $func_stripname_result"
|
adam@0
|
5195 ;;
|
adam@0
|
5196 *)
|
adam@0
|
5197 func_warning "\`-L' is ignored for archives/objects"
|
adam@0
|
5198 ;;
|
adam@0
|
5199 esac # linkmode
|
adam@0
|
5200 continue
|
adam@0
|
5201 ;; # -L
|
adam@0
|
5202 -R*)
|
adam@0
|
5203 if test "$pass" = link; then
|
adam@0
|
5204 func_stripname '-R' '' "$deplib"
|
adam@0
|
5205 dir=$func_stripname_result
|
adam@0
|
5206 # Make sure the xrpath contains only unique directories.
|
adam@0
|
5207 case "$xrpath " in
|
adam@0
|
5208 *" $dir "*) ;;
|
adam@0
|
5209 *) xrpath="$xrpath $dir" ;;
|
adam@0
|
5210 esac
|
adam@0
|
5211 fi
|
adam@0
|
5212 deplibs="$deplib $deplibs"
|
adam@0
|
5213 continue
|
adam@0
|
5214 ;;
|
adam@0
|
5215 *.la) lib="$deplib" ;;
|
adam@0
|
5216 *.$libext)
|
adam@0
|
5217 if test "$pass" = conv; then
|
adam@0
|
5218 deplibs="$deplib $deplibs"
|
adam@0
|
5219 continue
|
adam@0
|
5220 fi
|
adam@0
|
5221 case $linkmode in
|
adam@0
|
5222 lib)
|
adam@0
|
5223 # Linking convenience modules into shared libraries is allowed,
|
adam@0
|
5224 # but linking other static libraries is non-portable.
|
adam@0
|
5225 case " $dlpreconveniencelibs " in
|
adam@0
|
5226 *" $deplib "*) ;;
|
adam@0
|
5227 *)
|
adam@0
|
5228 valid_a_lib=no
|
adam@0
|
5229 case $deplibs_check_method in
|
adam@0
|
5230 match_pattern*)
|
adam@0
|
5231 set dummy $deplibs_check_method; shift
|
adam@0
|
5232 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
|
adam@0
|
5233 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
|
adam@0
|
5234 | $EGREP "$match_pattern_regex" > /dev/null; then
|
adam@0
|
5235 valid_a_lib=yes
|
adam@0
|
5236 fi
|
adam@0
|
5237 ;;
|
adam@0
|
5238 pass_all)
|
adam@0
|
5239 valid_a_lib=yes
|
adam@0
|
5240 ;;
|
adam@0
|
5241 esac
|
adam@0
|
5242 if test "$valid_a_lib" != yes; then
|
adam@0
|
5243 $ECHO
|
adam@0
|
5244 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
|
adam@0
|
5245 $ECHO "*** I have the capability to make that library automatically link in when"
|
adam@0
|
5246 $ECHO "*** you link to this library. But I can only do this if you have a"
|
adam@0
|
5247 $ECHO "*** shared version of the library, which you do not appear to have"
|
adam@0
|
5248 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
|
adam@0
|
5249 $ECHO "*** that it is just a static archive that I should not use here."
|
adam@0
|
5250 else
|
adam@0
|
5251 $ECHO
|
adam@0
|
5252 $ECHO "*** Warning: Linking the shared library $output against the"
|
adam@0
|
5253 $ECHO "*** static library $deplib is not portable!"
|
adam@0
|
5254 deplibs="$deplib $deplibs"
|
adam@0
|
5255 fi
|
adam@0
|
5256 ;;
|
adam@0
|
5257 esac
|
adam@0
|
5258 continue
|
adam@0
|
5259 ;;
|
adam@0
|
5260 prog)
|
adam@0
|
5261 if test "$pass" != link; then
|
adam@0
|
5262 deplibs="$deplib $deplibs"
|
adam@0
|
5263 else
|
adam@0
|
5264 compile_deplibs="$deplib $compile_deplibs"
|
adam@0
|
5265 finalize_deplibs="$deplib $finalize_deplibs"
|
adam@0
|
5266 fi
|
adam@0
|
5267 continue
|
adam@0
|
5268 ;;
|
adam@0
|
5269 esac # linkmode
|
adam@0
|
5270 ;; # *.$libext
|
adam@0
|
5271 *.lo | *.$objext)
|
adam@0
|
5272 if test "$pass" = conv; then
|
adam@0
|
5273 deplibs="$deplib $deplibs"
|
adam@0
|
5274 elif test "$linkmode" = prog; then
|
adam@0
|
5275 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
|
adam@0
|
5276 # If there is no dlopen support or we're linking statically,
|
adam@0
|
5277 # we need to preload.
|
adam@0
|
5278 newdlprefiles="$newdlprefiles $deplib"
|
adam@0
|
5279 compile_deplibs="$deplib $compile_deplibs"
|
adam@0
|
5280 finalize_deplibs="$deplib $finalize_deplibs"
|
adam@0
|
5281 else
|
adam@0
|
5282 newdlfiles="$newdlfiles $deplib"
|
adam@0
|
5283 fi
|
adam@0
|
5284 fi
|
adam@0
|
5285 continue
|
adam@0
|
5286 ;;
|
adam@0
|
5287 %DEPLIBS%)
|
adam@0
|
5288 alldeplibs=yes
|
adam@0
|
5289 continue
|
adam@0
|
5290 ;;
|
adam@0
|
5291 esac # case $deplib
|
adam@0
|
5292
|
adam@0
|
5293 if test "$found" = yes || test -f "$lib"; then :
|
adam@0
|
5294 else
|
adam@0
|
5295 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
|
adam@0
|
5296 fi
|
adam@0
|
5297
|
adam@0
|
5298 # Check to see that this really is a libtool archive.
|
adam@0
|
5299 func_lalib_unsafe_p "$lib" \
|
adam@0
|
5300 || func_fatal_error "\`$lib' is not a valid libtool archive"
|
adam@0
|
5301
|
adam@0
|
5302 func_dirname "$lib" "" "."
|
adam@0
|
5303 ladir="$func_dirname_result"
|
adam@0
|
5304
|
adam@0
|
5305 dlname=
|
adam@0
|
5306 dlopen=
|
adam@0
|
5307 dlpreopen=
|
adam@0
|
5308 libdir=
|
adam@0
|
5309 library_names=
|
adam@0
|
5310 old_library=
|
adam@0
|
5311 inherited_linker_flags=
|
adam@0
|
5312 # If the library was installed with an old release of libtool,
|
adam@0
|
5313 # it will not redefine variables installed, or shouldnotlink
|
adam@0
|
5314 installed=yes
|
adam@0
|
5315 shouldnotlink=no
|
adam@0
|
5316 avoidtemprpath=
|
adam@0
|
5317
|
adam@0
|
5318
|
adam@0
|
5319 # Read the .la file
|
adam@0
|
5320 func_source "$lib"
|
adam@0
|
5321
|
adam@0
|
5322 # Convert "-framework foo" to "foo.ltframework"
|
adam@0
|
5323 if test -n "$inherited_linker_flags"; then
|
adam@0
|
5324 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
|
adam@0
|
5325 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
|
adam@0
|
5326 case " $new_inherited_linker_flags " in
|
adam@0
|
5327 *" $tmp_inherited_linker_flag "*) ;;
|
adam@0
|
5328 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
|
adam@0
|
5329 esac
|
adam@0
|
5330 done
|
adam@0
|
5331 fi
|
adam@0
|
5332 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
adam@0
|
5333 if test "$linkmode,$pass" = "lib,link" ||
|
adam@0
|
5334 test "$linkmode,$pass" = "prog,scan" ||
|
adam@0
|
5335 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
|
adam@0
|
5336 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
|
adam@0
|
5337 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
|
adam@0
|
5338 fi
|
adam@0
|
5339
|
adam@0
|
5340 if test "$pass" = conv; then
|
adam@0
|
5341 # Only check for convenience libraries
|
adam@0
|
5342 deplibs="$lib $deplibs"
|
adam@0
|
5343 if test -z "$libdir"; then
|
adam@0
|
5344 if test -z "$old_library"; then
|
adam@0
|
5345 func_fatal_error "cannot find name of link library for \`$lib'"
|
adam@0
|
5346 fi
|
adam@0
|
5347 # It is a libtool convenience library, so add in its objects.
|
adam@0
|
5348 convenience="$convenience $ladir/$objdir/$old_library"
|
adam@0
|
5349 old_convenience="$old_convenience $ladir/$objdir/$old_library"
|
adam@0
|
5350 tmp_libs=
|
adam@0
|
5351 for deplib in $dependency_libs; do
|
adam@0
|
5352 deplibs="$deplib $deplibs"
|
adam@0
|
5353 if $opt_duplicate_deps ; then
|
adam@0
|
5354 case "$tmp_libs " in
|
adam@0
|
5355 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
|
adam@0
|
5356 esac
|
adam@0
|
5357 fi
|
adam@0
|
5358 tmp_libs="$tmp_libs $deplib"
|
adam@0
|
5359 done
|
adam@0
|
5360 elif test "$linkmode" != prog && test "$linkmode" != lib; then
|
adam@0
|
5361 func_fatal_error "\`$lib' is not a convenience library"
|
adam@0
|
5362 fi
|
adam@0
|
5363 continue
|
adam@0
|
5364 fi # $pass = conv
|
adam@0
|
5365
|
adam@0
|
5366
|
adam@0
|
5367 # Get the name of the library we link against.
|
adam@0
|
5368 linklib=
|
adam@0
|
5369 for l in $old_library $library_names; do
|
adam@0
|
5370 linklib="$l"
|
adam@0
|
5371 done
|
adam@0
|
5372 if test -z "$linklib"; then
|
adam@0
|
5373 func_fatal_error "cannot find name of link library for \`$lib'"
|
adam@0
|
5374 fi
|
adam@0
|
5375
|
adam@0
|
5376 # This library was specified with -dlopen.
|
adam@0
|
5377 if test "$pass" = dlopen; then
|
adam@0
|
5378 if test -z "$libdir"; then
|
adam@0
|
5379 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
|
adam@0
|
5380 fi
|
adam@0
|
5381 if test -z "$dlname" ||
|
adam@0
|
5382 test "$dlopen_support" != yes ||
|
adam@0
|
5383 test "$build_libtool_libs" = no; then
|
adam@0
|
5384 # If there is no dlname, no dlopen support or we're linking
|
adam@0
|
5385 # statically, we need to preload. We also need to preload any
|
adam@0
|
5386 # dependent libraries so libltdl's deplib preloader doesn't
|
adam@0
|
5387 # bomb out in the load deplibs phase.
|
adam@0
|
5388 dlprefiles="$dlprefiles $lib $dependency_libs"
|
adam@0
|
5389 else
|
adam@0
|
5390 newdlfiles="$newdlfiles $lib"
|
adam@0
|
5391 fi
|
adam@0
|
5392 continue
|
adam@0
|
5393 fi # $pass = dlopen
|
adam@0
|
5394
|
adam@0
|
5395 # We need an absolute path.
|
adam@0
|
5396 case $ladir in
|
adam@0
|
5397 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
|
adam@0
|
5398 *)
|
adam@0
|
5399 abs_ladir=`cd "$ladir" && pwd`
|
adam@0
|
5400 if test -z "$abs_ladir"; then
|
adam@0
|
5401 func_warning "cannot determine absolute directory name of \`$ladir'"
|
adam@0
|
5402 func_warning "passing it literally to the linker, although it might fail"
|
adam@0
|
5403 abs_ladir="$ladir"
|
adam@0
|
5404 fi
|
adam@0
|
5405 ;;
|
adam@0
|
5406 esac
|
adam@0
|
5407 func_basename "$lib"
|
adam@0
|
5408 laname="$func_basename_result"
|
adam@0
|
5409
|
adam@0
|
5410 # Find the relevant object directory and library name.
|
adam@0
|
5411 if test "X$installed" = Xyes; then
|
adam@0
|
5412 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
|
adam@0
|
5413 func_warning "library \`$lib' was moved."
|
adam@0
|
5414 dir="$ladir"
|
adam@0
|
5415 absdir="$abs_ladir"
|
adam@0
|
5416 libdir="$abs_ladir"
|
adam@0
|
5417 else
|
adam@0
|
5418 dir="$libdir"
|
adam@0
|
5419 absdir="$libdir"
|
adam@0
|
5420 fi
|
adam@0
|
5421 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
|
adam@0
|
5422 else
|
adam@0
|
5423 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
|
adam@0
|
5424 dir="$ladir"
|
adam@0
|
5425 absdir="$abs_ladir"
|
adam@0
|
5426 # Remove this search path later
|
adam@0
|
5427 notinst_path="$notinst_path $abs_ladir"
|
adam@0
|
5428 else
|
adam@0
|
5429 dir="$ladir/$objdir"
|
adam@0
|
5430 absdir="$abs_ladir/$objdir"
|
adam@0
|
5431 # Remove this search path later
|
adam@0
|
5432 notinst_path="$notinst_path $abs_ladir"
|
adam@0
|
5433 fi
|
adam@0
|
5434 fi # $installed = yes
|
adam@0
|
5435 func_stripname 'lib' '.la' "$laname"
|
adam@0
|
5436 name=$func_stripname_result
|
adam@0
|
5437
|
adam@0
|
5438 # This library was specified with -dlpreopen.
|
adam@0
|
5439 if test "$pass" = dlpreopen; then
|
adam@0
|
5440 if test -z "$libdir" && test "$linkmode" = prog; then
|
adam@0
|
5441 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
|
adam@0
|
5442 fi
|
adam@0
|
5443 # Prefer using a static library (so that no silly _DYNAMIC symbols
|
adam@0
|
5444 # are required to link).
|
adam@0
|
5445 if test -n "$old_library"; then
|
adam@0
|
5446 newdlprefiles="$newdlprefiles $dir/$old_library"
|
adam@0
|
5447 # Keep a list of preopened convenience libraries to check
|
adam@0
|
5448 # that they are being used correctly in the link pass.
|
adam@0
|
5449 test -z "$libdir" && \
|
adam@0
|
5450 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
|
adam@0
|
5451 # Otherwise, use the dlname, so that lt_dlopen finds it.
|
adam@0
|
5452 elif test -n "$dlname"; then
|
adam@0
|
5453 newdlprefiles="$newdlprefiles $dir/$dlname"
|
adam@0
|
5454 else
|
adam@0
|
5455 newdlprefiles="$newdlprefiles $dir/$linklib"
|
adam@0
|
5456 fi
|
adam@0
|
5457 fi # $pass = dlpreopen
|
adam@0
|
5458
|
adam@0
|
5459 if test -z "$libdir"; then
|
adam@0
|
5460 # Link the convenience library
|
adam@0
|
5461 if test "$linkmode" = lib; then
|
adam@0
|
5462 deplibs="$dir/$old_library $deplibs"
|
adam@0
|
5463 elif test "$linkmode,$pass" = "prog,link"; then
|
adam@0
|
5464 compile_deplibs="$dir/$old_library $compile_deplibs"
|
adam@0
|
5465 finalize_deplibs="$dir/$old_library $finalize_deplibs"
|
adam@0
|
5466 else
|
adam@0
|
5467 deplibs="$lib $deplibs" # used for prog,scan pass
|
adam@0
|
5468 fi
|
adam@0
|
5469 continue
|
adam@0
|
5470 fi
|
adam@0
|
5471
|
adam@0
|
5472
|
adam@0
|
5473 if test "$linkmode" = prog && test "$pass" != link; then
|
adam@0
|
5474 newlib_search_path="$newlib_search_path $ladir"
|
adam@0
|
5475 deplibs="$lib $deplibs"
|
adam@0
|
5476
|
adam@0
|
5477 linkalldeplibs=no
|
adam@0
|
5478 if test "$link_all_deplibs" != no || test -z "$library_names" ||
|
adam@0
|
5479 test "$build_libtool_libs" = no; then
|
adam@0
|
5480 linkalldeplibs=yes
|
adam@0
|
5481 fi
|
adam@0
|
5482
|
adam@0
|
5483 tmp_libs=
|
adam@0
|
5484 for deplib in $dependency_libs; do
|
adam@0
|
5485 case $deplib in
|
adam@0
|
5486 -L*) func_stripname '-L' '' "$deplib"
|
adam@0
|
5487 newlib_search_path="$newlib_search_path $func_stripname_result"
|
adam@0
|
5488 ;;
|
adam@0
|
5489 esac
|
adam@0
|
5490 # Need to link against all dependency_libs?
|
adam@0
|
5491 if test "$linkalldeplibs" = yes; then
|
adam@0
|
5492 deplibs="$deplib $deplibs"
|
adam@0
|
5493 else
|
adam@0
|
5494 # Need to hardcode shared library paths
|
adam@0
|
5495 # or/and link against static libraries
|
adam@0
|
5496 newdependency_libs="$deplib $newdependency_libs"
|
adam@0
|
5497 fi
|
adam@0
|
5498 if $opt_duplicate_deps ; then
|
adam@0
|
5499 case "$tmp_libs " in
|
adam@0
|
5500 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
|
adam@0
|
5501 esac
|
adam@0
|
5502 fi
|
adam@0
|
5503 tmp_libs="$tmp_libs $deplib"
|
adam@0
|
5504 done # for deplib
|
adam@0
|
5505 continue
|
adam@0
|
5506 fi # $linkmode = prog...
|
adam@0
|
5507
|
adam@0
|
5508 if test "$linkmode,$pass" = "prog,link"; then
|
adam@0
|
5509 if test -n "$library_names" &&
|
adam@0
|
5510 { { test "$prefer_static_libs" = no ||
|
adam@0
|
5511 test "$prefer_static_libs,$installed" = "built,yes"; } ||
|
adam@0
|
5512 test -z "$old_library"; }; then
|
adam@0
|
5513 # We need to hardcode the library path
|
adam@0
|
5514 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
|
adam@0
|
5515 # Make sure the rpath contains only unique directories.
|
adam@0
|
5516 case "$temp_rpath:" in
|
adam@0
|
5517 *"$absdir:"*) ;;
|
adam@0
|
5518 *) temp_rpath="$temp_rpath$absdir:" ;;
|
adam@0
|
5519 esac
|
adam@0
|
5520 fi
|
adam@0
|
5521
|
adam@0
|
5522 # Hardcode the library path.
|
adam@0
|
5523 # Skip directories that are in the system default run-time
|
adam@0
|
5524 # search path.
|
adam@0
|
5525 case " $sys_lib_dlsearch_path " in
|
adam@0
|
5526 *" $absdir "*) ;;
|
adam@0
|
5527 *)
|
adam@0
|
5528 case "$compile_rpath " in
|
adam@0
|
5529 *" $absdir "*) ;;
|
adam@0
|
5530 *) compile_rpath="$compile_rpath $absdir"
|
adam@0
|
5531 esac
|
adam@0
|
5532 ;;
|
adam@0
|
5533 esac
|
adam@0
|
5534 case " $sys_lib_dlsearch_path " in
|
adam@0
|
5535 *" $libdir "*) ;;
|
adam@0
|
5536 *)
|
adam@0
|
5537 case "$finalize_rpath " in
|
adam@0
|
5538 *" $libdir "*) ;;
|
adam@0
|
5539 *) finalize_rpath="$finalize_rpath $libdir"
|
adam@0
|
5540 esac
|
adam@0
|
5541 ;;
|
adam@0
|
5542 esac
|
adam@0
|
5543 fi # $linkmode,$pass = prog,link...
|
adam@0
|
5544
|
adam@0
|
5545 if test "$alldeplibs" = yes &&
|
adam@0
|
5546 { test "$deplibs_check_method" = pass_all ||
|
adam@0
|
5547 { test "$build_libtool_libs" = yes &&
|
adam@0
|
5548 test -n "$library_names"; }; }; then
|
adam@0
|
5549 # We only need to search for static libraries
|
adam@0
|
5550 continue
|
adam@0
|
5551 fi
|
adam@0
|
5552 fi
|
adam@0
|
5553
|
adam@0
|
5554 link_static=no # Whether the deplib will be linked statically
|
adam@0
|
5555 use_static_libs=$prefer_static_libs
|
adam@0
|
5556 if test "$use_static_libs" = built && test "$installed" = yes; then
|
adam@0
|
5557 use_static_libs=no
|
adam@0
|
5558 fi
|
adam@0
|
5559 if test -n "$library_names" &&
|
adam@0
|
5560 { test "$use_static_libs" = no || test -z "$old_library"; }; then
|
adam@0
|
5561 case $host in
|
adam@0
|
5562 *cygwin* | *mingw* | *cegcc*)
|
adam@0
|
5563 # No point in relinking DLLs because paths are not encoded
|
adam@0
|
5564 notinst_deplibs="$notinst_deplibs $lib"
|
adam@0
|
5565 need_relink=no
|
adam@0
|
5566 ;;
|
adam@0
|
5567 *)
|
adam@0
|
5568 if test "$installed" = no; then
|
adam@0
|
5569 notinst_deplibs="$notinst_deplibs $lib"
|
adam@0
|
5570 need_relink=yes
|
adam@0
|
5571 fi
|
adam@0
|
5572 ;;
|
adam@0
|
5573 esac
|
adam@0
|
5574 # This is a shared library
|
adam@0
|
5575
|
adam@0
|
5576 # Warn about portability, can't link against -module's on some
|
adam@0
|
5577 # systems (darwin). Don't bleat about dlopened modules though!
|
adam@0
|
5578 dlopenmodule=""
|
adam@0
|
5579 for dlpremoduletest in $dlprefiles; do
|
adam@0
|
5580 if test "X$dlpremoduletest" = "X$lib"; then
|
adam@0
|
5581 dlopenmodule="$dlpremoduletest"
|
adam@0
|
5582 break
|
adam@0
|
5583 fi
|
adam@0
|
5584 done
|
adam@0
|
5585 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
|
adam@0
|
5586 $ECHO
|
adam@0
|
5587 if test "$linkmode" = prog; then
|
adam@0
|
5588 $ECHO "*** Warning: Linking the executable $output against the loadable module"
|
adam@0
|
5589 else
|
adam@0
|
5590 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
|
adam@0
|
5591 fi
|
adam@0
|
5592 $ECHO "*** $linklib is not portable!"
|
adam@0
|
5593 fi
|
adam@0
|
5594 if test "$linkmode" = lib &&
|
adam@0
|
5595 test "$hardcode_into_libs" = yes; then
|
adam@0
|
5596 # Hardcode the library path.
|
adam@0
|
5597 # Skip directories that are in the system default run-time
|
adam@0
|
5598 # search path.
|
adam@0
|
5599 case " $sys_lib_dlsearch_path " in
|
adam@0
|
5600 *" $absdir "*) ;;
|
adam@0
|
5601 *)
|
adam@0
|
5602 case "$compile_rpath " in
|
adam@0
|
5603 *" $absdir "*) ;;
|
adam@0
|
5604 *) compile_rpath="$compile_rpath $absdir"
|
adam@0
|
5605 esac
|
adam@0
|
5606 ;;
|
adam@0
|
5607 esac
|
adam@0
|
5608 case " $sys_lib_dlsearch_path " in
|
adam@0
|
5609 *" $libdir "*) ;;
|
adam@0
|
5610 *)
|
adam@0
|
5611 case "$finalize_rpath " in
|
adam@0
|
5612 *" $libdir "*) ;;
|
adam@0
|
5613 *) finalize_rpath="$finalize_rpath $libdir"
|
adam@0
|
5614 esac
|
adam@0
|
5615 ;;
|
adam@0
|
5616 esac
|
adam@0
|
5617 fi
|
adam@0
|
5618
|
adam@0
|
5619 if test -n "$old_archive_from_expsyms_cmds"; then
|
adam@0
|
5620 # figure out the soname
|
adam@0
|
5621 set dummy $library_names
|
adam@0
|
5622 shift
|
adam@0
|
5623 realname="$1"
|
adam@0
|
5624 shift
|
adam@0
|
5625 libname=`eval "\\$ECHO \"$libname_spec\""`
|
adam@0
|
5626 # use dlname if we got it. it's perfectly good, no?
|
adam@0
|
5627 if test -n "$dlname"; then
|
adam@0
|
5628 soname="$dlname"
|
adam@0
|
5629 elif test -n "$soname_spec"; then
|
adam@0
|
5630 # bleh windows
|
adam@0
|
5631 case $host in
|
adam@0
|
5632 *cygwin* | mingw* | *cegcc*)
|
adam@0
|
5633 func_arith $current - $age
|
adam@0
|
5634 major=$func_arith_result
|
adam@0
|
5635 versuffix="-$major"
|
adam@0
|
5636 ;;
|
adam@0
|
5637 esac
|
adam@0
|
5638 eval soname=\"$soname_spec\"
|
adam@0
|
5639 else
|
adam@0
|
5640 soname="$realname"
|
adam@0
|
5641 fi
|
adam@0
|
5642
|
adam@0
|
5643 # Make a new name for the extract_expsyms_cmds to use
|
adam@0
|
5644 soroot="$soname"
|
adam@0
|
5645 func_basename "$soroot"
|
adam@0
|
5646 soname="$func_basename_result"
|
adam@0
|
5647 func_stripname 'lib' '.dll' "$soname"
|
adam@0
|
5648 newlib=libimp-$func_stripname_result.a
|
adam@0
|
5649
|
adam@0
|
5650 # If the library has no export list, then create one now
|
adam@0
|
5651 if test -f "$output_objdir/$soname-def"; then :
|
adam@0
|
5652 else
|
adam@0
|
5653 func_verbose "extracting exported symbol list from \`$soname'"
|
adam@0
|
5654 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
|
adam@0
|
5655 fi
|
adam@0
|
5656
|
adam@0
|
5657 # Create $newlib
|
adam@0
|
5658 if test -f "$output_objdir/$newlib"; then :; else
|
adam@0
|
5659 func_verbose "generating import library for \`$soname'"
|
adam@0
|
5660 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
|
adam@0
|
5661 fi
|
adam@0
|
5662 # make sure the library variables are pointing to the new library
|
adam@0
|
5663 dir=$output_objdir
|
adam@0
|
5664 linklib=$newlib
|
adam@0
|
5665 fi # test -n "$old_archive_from_expsyms_cmds"
|
adam@0
|
5666
|
adam@0
|
5667 if test "$linkmode" = prog || test "$mode" != relink; then
|
adam@0
|
5668 add_shlibpath=
|
adam@0
|
5669 add_dir=
|
adam@0
|
5670 add=
|
adam@0
|
5671 lib_linked=yes
|
adam@0
|
5672 case $hardcode_action in
|
adam@0
|
5673 immediate | unsupported)
|
adam@0
|
5674 if test "$hardcode_direct" = no; then
|
adam@0
|
5675 add="$dir/$linklib"
|
adam@0
|
5676 case $host in
|
adam@0
|
5677 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
|
adam@0
|
5678 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
|
adam@0
|
5679 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
|
adam@0
|
5680 *-*-unixware7*) add_dir="-L$dir" ;;
|
adam@0
|
5681 *-*-darwin* )
|
adam@0
|
5682 # if the lib is a (non-dlopened) module then we can not
|
adam@0
|
5683 # link against it, someone is ignoring the earlier warnings
|
adam@0
|
5684 if /usr/bin/file -L $add 2> /dev/null |
|
adam@0
|
5685 $GREP ": [^:]* bundle" >/dev/null ; then
|
adam@0
|
5686 if test "X$dlopenmodule" != "X$lib"; then
|
adam@0
|
5687 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
|
adam@0
|
5688 if test -z "$old_library" ; then
|
adam@0
|
5689 $ECHO
|
adam@0
|
5690 $ECHO "*** And there doesn't seem to be a static archive available"
|
adam@0
|
5691 $ECHO "*** The link will probably fail, sorry"
|
adam@0
|
5692 else
|
adam@0
|
5693 add="$dir/$old_library"
|
adam@0
|
5694 fi
|
adam@0
|
5695 elif test -n "$old_library"; then
|
adam@0
|
5696 add="$dir/$old_library"
|
adam@0
|
5697 fi
|
adam@0
|
5698 fi
|
adam@0
|
5699 esac
|
adam@0
|
5700 elif test "$hardcode_minus_L" = no; then
|
adam@0
|
5701 case $host in
|
adam@0
|
5702 *-*-sunos*) add_shlibpath="$dir" ;;
|
adam@0
|
5703 esac
|
adam@0
|
5704 add_dir="-L$dir"
|
adam@0
|
5705 add="-l$name"
|
adam@0
|
5706 elif test "$hardcode_shlibpath_var" = no; then
|
adam@0
|
5707 add_shlibpath="$dir"
|
adam@0
|
5708 add="-l$name"
|
adam@0
|
5709 else
|
adam@0
|
5710 lib_linked=no
|
adam@0
|
5711 fi
|
adam@0
|
5712 ;;
|
adam@0
|
5713 relink)
|
adam@0
|
5714 if test "$hardcode_direct" = yes &&
|
adam@0
|
5715 test "$hardcode_direct_absolute" = no; then
|
adam@0
|
5716 add="$dir/$linklib"
|
adam@0
|
5717 elif test "$hardcode_minus_L" = yes; then
|
adam@0
|
5718 add_dir="-L$dir"
|
adam@0
|
5719 # Try looking first in the location we're being installed to.
|
adam@0
|
5720 if test -n "$inst_prefix_dir"; then
|
adam@0
|
5721 case $libdir in
|
adam@0
|
5722 [\\/]*)
|
adam@0
|
5723 add_dir="$add_dir -L$inst_prefix_dir$libdir"
|
adam@0
|
5724 ;;
|
adam@0
|
5725 esac
|
adam@0
|
5726 fi
|
adam@0
|
5727 add="-l$name"
|
adam@0
|
5728 elif test "$hardcode_shlibpath_var" = yes; then
|
adam@0
|
5729 add_shlibpath="$dir"
|
adam@0
|
5730 add="-l$name"
|
adam@0
|
5731 else
|
adam@0
|
5732 lib_linked=no
|
adam@0
|
5733 fi
|
adam@0
|
5734 ;;
|
adam@0
|
5735 *) lib_linked=no ;;
|
adam@0
|
5736 esac
|
adam@0
|
5737
|
adam@0
|
5738 if test "$lib_linked" != yes; then
|
adam@0
|
5739 func_fatal_configuration "unsupported hardcode properties"
|
adam@0
|
5740 fi
|
adam@0
|
5741
|
adam@0
|
5742 if test -n "$add_shlibpath"; then
|
adam@0
|
5743 case :$compile_shlibpath: in
|
adam@0
|
5744 *":$add_shlibpath:"*) ;;
|
adam@0
|
5745 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
|
adam@0
|
5746 esac
|
adam@0
|
5747 fi
|
adam@0
|
5748 if test "$linkmode" = prog; then
|
adam@0
|
5749 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
|
adam@0
|
5750 test -n "$add" && compile_deplibs="$add $compile_deplibs"
|
adam@0
|
5751 else
|
adam@0
|
5752 test -n "$add_dir" && deplibs="$add_dir $deplibs"
|
adam@0
|
5753 test -n "$add" && deplibs="$add $deplibs"
|
adam@0
|
5754 if test "$hardcode_direct" != yes &&
|
adam@0
|
5755 test "$hardcode_minus_L" != yes &&
|
adam@0
|
5756 test "$hardcode_shlibpath_var" = yes; then
|
adam@0
|
5757 case :$finalize_shlibpath: in
|
adam@0
|
5758 *":$libdir:"*) ;;
|
adam@0
|
5759 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
|
adam@0
|
5760 esac
|
adam@0
|
5761 fi
|
adam@0
|
5762 fi
|
adam@0
|
5763 fi
|
adam@0
|
5764
|
adam@0
|
5765 if test "$linkmode" = prog || test "$mode" = relink; then
|
adam@0
|
5766 add_shlibpath=
|
adam@0
|
5767 add_dir=
|
adam@0
|
5768 add=
|
adam@0
|
5769 # Finalize command for both is simple: just hardcode it.
|
adam@0
|
5770 if test "$hardcode_direct" = yes &&
|
adam@0
|
5771 test "$hardcode_direct_absolute" = no; then
|
adam@0
|
5772 add="$libdir/$linklib"
|
adam@0
|
5773 elif test "$hardcode_minus_L" = yes; then
|
adam@0
|
5774 add_dir="-L$libdir"
|
adam@0
|
5775 add="-l$name"
|
adam@0
|
5776 elif test "$hardcode_shlibpath_var" = yes; then
|
adam@0
|
5777 case :$finalize_shlibpath: in
|
adam@0
|
5778 *":$libdir:"*) ;;
|
adam@0
|
5779 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
|
adam@0
|
5780 esac
|
adam@0
|
5781 add="-l$name"
|
adam@0
|
5782 elif test "$hardcode_automatic" = yes; then
|
adam@0
|
5783 if test -n "$inst_prefix_dir" &&
|
adam@0
|
5784 test -f "$inst_prefix_dir$libdir/$linklib" ; then
|
adam@0
|
5785 add="$inst_prefix_dir$libdir/$linklib"
|
adam@0
|
5786 else
|
adam@0
|
5787 add="$libdir/$linklib"
|
adam@0
|
5788 fi
|
adam@0
|
5789 else
|
adam@0
|
5790 # We cannot seem to hardcode it, guess we'll fake it.
|
adam@0
|
5791 add_dir="-L$libdir"
|
adam@0
|
5792 # Try looking first in the location we're being installed to.
|
adam@0
|
5793 if test -n "$inst_prefix_dir"; then
|
adam@0
|
5794 case $libdir in
|
adam@0
|
5795 [\\/]*)
|
adam@0
|
5796 add_dir="$add_dir -L$inst_prefix_dir$libdir"
|
adam@0
|
5797 ;;
|
adam@0
|
5798 esac
|
adam@0
|
5799 fi
|
adam@0
|
5800 add="-l$name"
|
adam@0
|
5801 fi
|
adam@0
|
5802
|
adam@0
|
5803 if test "$linkmode" = prog; then
|
adam@0
|
5804 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
|
adam@0
|
5805 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
|
adam@0
|
5806 else
|
adam@0
|
5807 test -n "$add_dir" && deplibs="$add_dir $deplibs"
|
adam@0
|
5808 test -n "$add" && deplibs="$add $deplibs"
|
adam@0
|
5809 fi
|
adam@0
|
5810 fi
|
adam@0
|
5811 elif test "$linkmode" = prog; then
|
adam@0
|
5812 # Here we assume that one of hardcode_direct or hardcode_minus_L
|
adam@0
|
5813 # is not unsupported. This is valid on all known static and
|
adam@0
|
5814 # shared platforms.
|
adam@0
|
5815 if test "$hardcode_direct" != unsupported; then
|
adam@0
|
5816 test -n "$old_library" && linklib="$old_library"
|
adam@0
|
5817 compile_deplibs="$dir/$linklib $compile_deplibs"
|
adam@0
|
5818 finalize_deplibs="$dir/$linklib $finalize_deplibs"
|
adam@0
|
5819 else
|
adam@0
|
5820 compile_deplibs="-l$name -L$dir $compile_deplibs"
|
adam@0
|
5821 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
|
adam@0
|
5822 fi
|
adam@0
|
5823 elif test "$build_libtool_libs" = yes; then
|
adam@0
|
5824 # Not a shared library
|
adam@0
|
5825 if test "$deplibs_check_method" != pass_all; then
|
adam@0
|
5826 # We're trying link a shared library against a static one
|
adam@0
|
5827 # but the system doesn't support it.
|
adam@0
|
5828
|
adam@0
|
5829 # Just print a warning and add the library to dependency_libs so
|
adam@0
|
5830 # that the program can be linked against the static library.
|
adam@0
|
5831 $ECHO
|
adam@0
|
5832 $ECHO "*** Warning: This system can not link to static lib archive $lib."
|
adam@0
|
5833 $ECHO "*** I have the capability to make that library automatically link in when"
|
adam@0
|
5834 $ECHO "*** you link to this library. But I can only do this if you have a"
|
adam@0
|
5835 $ECHO "*** shared version of the library, which you do not appear to have."
|
adam@0
|
5836 if test "$module" = yes; then
|
adam@0
|
5837 $ECHO "*** But as you try to build a module library, libtool will still create "
|
adam@0
|
5838 $ECHO "*** a static module, that should work as long as the dlopening application"
|
adam@0
|
5839 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
|
adam@0
|
5840 if test -z "$global_symbol_pipe"; then
|
adam@0
|
5841 $ECHO
|
adam@0
|
5842 $ECHO "*** However, this would only work if libtool was able to extract symbol"
|
adam@0
|
5843 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
|
adam@0
|
5844 $ECHO "*** not find such a program. So, this module is probably useless."
|
adam@0
|
5845 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
|
adam@0
|
5846 fi
|
adam@0
|
5847 if test "$build_old_libs" = no; then
|
adam@0
|
5848 build_libtool_libs=module
|
adam@0
|
5849 build_old_libs=yes
|
adam@0
|
5850 else
|
adam@0
|
5851 build_libtool_libs=no
|
adam@0
|
5852 fi
|
adam@0
|
5853 fi
|
adam@0
|
5854 else
|
adam@0
|
5855 deplibs="$dir/$old_library $deplibs"
|
adam@0
|
5856 link_static=yes
|
adam@0
|
5857 fi
|
adam@0
|
5858 fi # link shared/static library?
|
adam@0
|
5859
|
adam@0
|
5860 if test "$linkmode" = lib; then
|
adam@0
|
5861 if test -n "$dependency_libs" &&
|
adam@0
|
5862 { test "$hardcode_into_libs" != yes ||
|
adam@0
|
5863 test "$build_old_libs" = yes ||
|
adam@0
|
5864 test "$link_static" = yes; }; then
|
adam@0
|
5865 # Extract -R from dependency_libs
|
adam@0
|
5866 temp_deplibs=
|
adam@0
|
5867 for libdir in $dependency_libs; do
|
adam@0
|
5868 case $libdir in
|
adam@0
|
5869 -R*) func_stripname '-R' '' "$libdir"
|
adam@0
|
5870 temp_xrpath=$func_stripname_result
|
adam@0
|
5871 case " $xrpath " in
|
adam@0
|
5872 *" $temp_xrpath "*) ;;
|
adam@0
|
5873 *) xrpath="$xrpath $temp_xrpath";;
|
adam@0
|
5874 esac;;
|
adam@0
|
5875 *) temp_deplibs="$temp_deplibs $libdir";;
|
adam@0
|
5876 esac
|
adam@0
|
5877 done
|
adam@0
|
5878 dependency_libs="$temp_deplibs"
|
adam@0
|
5879 fi
|
adam@0
|
5880
|
adam@0
|
5881 newlib_search_path="$newlib_search_path $absdir"
|
adam@0
|
5882 # Link against this library
|
adam@0
|
5883 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
|
adam@0
|
5884 # ... and its dependency_libs
|
adam@0
|
5885 tmp_libs=
|
adam@0
|
5886 for deplib in $dependency_libs; do
|
adam@0
|
5887 newdependency_libs="$deplib $newdependency_libs"
|
adam@0
|
5888 if $opt_duplicate_deps ; then
|
adam@0
|
5889 case "$tmp_libs " in
|
adam@0
|
5890 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
|
adam@0
|
5891 esac
|
adam@0
|
5892 fi
|
adam@0
|
5893 tmp_libs="$tmp_libs $deplib"
|
adam@0
|
5894 done
|
adam@0
|
5895
|
adam@0
|
5896 if test "$link_all_deplibs" != no; then
|
adam@0
|
5897 # Add the search paths of all dependency libraries
|
adam@0
|
5898 for deplib in $dependency_libs; do
|
adam@0
|
5899 path=
|
adam@0
|
5900 case $deplib in
|
adam@0
|
5901 -L*) path="$deplib" ;;
|
adam@0
|
5902 *.la)
|
adam@0
|
5903 func_dirname "$deplib" "" "."
|
adam@0
|
5904 dir="$func_dirname_result"
|
adam@0
|
5905 # We need an absolute path.
|
adam@0
|
5906 case $dir in
|
adam@0
|
5907 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
|
adam@0
|
5908 *)
|
adam@0
|
5909 absdir=`cd "$dir" && pwd`
|
adam@0
|
5910 if test -z "$absdir"; then
|
adam@0
|
5911 func_warning "cannot determine absolute directory name of \`$dir'"
|
adam@0
|
5912 absdir="$dir"
|
adam@0
|
5913 fi
|
adam@0
|
5914 ;;
|
adam@0
|
5915 esac
|
adam@0
|
5916 if $GREP "^installed=no" $deplib > /dev/null; then
|
adam@0
|
5917 case $host in
|
adam@0
|
5918 *-*-darwin*)
|
adam@0
|
5919 depdepl=
|
adam@0
|
5920 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
|
adam@0
|
5921 if test -n "$deplibrary_names" ; then
|
adam@0
|
5922 for tmp in $deplibrary_names ; do
|
adam@0
|
5923 depdepl=$tmp
|
adam@0
|
5924 done
|
adam@0
|
5925 if test -f "$absdir/$objdir/$depdepl" ; then
|
adam@0
|
5926 depdepl="$absdir/$objdir/$depdepl"
|
adam@0
|
5927 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
|
adam@0
|
5928 if test -z "$darwin_install_name"; then
|
adam@0
|
5929 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
|
adam@0
|
5930 fi
|
adam@0
|
5931 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
|
adam@0
|
5932 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
|
adam@0
|
5933 path=
|
adam@0
|
5934 fi
|
adam@0
|
5935 fi
|
adam@0
|
5936 ;;
|
adam@0
|
5937 *)
|
adam@0
|
5938 path="-L$absdir/$objdir"
|
adam@0
|
5939 ;;
|
adam@0
|
5940 esac
|
adam@0
|
5941 else
|
adam@0
|
5942 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
|
adam@0
|
5943 test -z "$libdir" && \
|
adam@0
|
5944 func_fatal_error "\`$deplib' is not a valid libtool archive"
|
adam@0
|
5945 test "$absdir" != "$libdir" && \
|
adam@0
|
5946 func_warning "\`$deplib' seems to be moved"
|
adam@0
|
5947
|
adam@0
|
5948 path="-L$absdir"
|
adam@0
|
5949 fi
|
adam@0
|
5950 ;;
|
adam@0
|
5951 esac
|
adam@0
|
5952 case " $deplibs " in
|
adam@0
|
5953 *" $path "*) ;;
|
adam@0
|
5954 *) deplibs="$path $deplibs" ;;
|
adam@0
|
5955 esac
|
adam@0
|
5956 done
|
adam@0
|
5957 fi # link_all_deplibs != no
|
adam@0
|
5958 fi # linkmode = lib
|
adam@0
|
5959 done # for deplib in $libs
|
adam@0
|
5960 if test "$pass" = link; then
|
adam@0
|
5961 if test "$linkmode" = "prog"; then
|
adam@0
|
5962 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
|
adam@0
|
5963 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
|
adam@0
|
5964 else
|
adam@0
|
5965 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
adam@0
|
5966 fi
|
adam@0
|
5967 fi
|
adam@0
|
5968 dependency_libs="$newdependency_libs"
|
adam@0
|
5969 if test "$pass" = dlpreopen; then
|
adam@0
|
5970 # Link the dlpreopened libraries before other libraries
|
adam@0
|
5971 for deplib in $save_deplibs; do
|
adam@0
|
5972 deplibs="$deplib $deplibs"
|
adam@0
|
5973 done
|
adam@0
|
5974 fi
|
adam@0
|
5975 if test "$pass" != dlopen; then
|
adam@0
|
5976 if test "$pass" != conv; then
|
adam@0
|
5977 # Make sure lib_search_path contains only unique directories.
|
adam@0
|
5978 lib_search_path=
|
adam@0
|
5979 for dir in $newlib_search_path; do
|
adam@0
|
5980 case "$lib_search_path " in
|
adam@0
|
5981 *" $dir "*) ;;
|
adam@0
|
5982 *) lib_search_path="$lib_search_path $dir" ;;
|
adam@0
|
5983 esac
|
adam@0
|
5984 done
|
adam@0
|
5985 newlib_search_path=
|
adam@0
|
5986 fi
|
adam@0
|
5987
|
adam@0
|
5988 if test "$linkmode,$pass" != "prog,link"; then
|
adam@0
|
5989 vars="deplibs"
|
adam@0
|
5990 else
|
adam@0
|
5991 vars="compile_deplibs finalize_deplibs"
|
adam@0
|
5992 fi
|
adam@0
|
5993 for var in $vars dependency_libs; do
|
adam@0
|
5994 # Add libraries to $var in reverse order
|
adam@0
|
5995 eval tmp_libs=\"\$$var\"
|
adam@0
|
5996 new_libs=
|
adam@0
|
5997 for deplib in $tmp_libs; do
|
adam@0
|
5998 # FIXME: Pedantically, this is the right thing to do, so
|
adam@0
|
5999 # that some nasty dependency loop isn't accidentally
|
adam@0
|
6000 # broken:
|
adam@0
|
6001 #new_libs="$deplib $new_libs"
|
adam@0
|
6002 # Pragmatically, this seems to cause very few problems in
|
adam@0
|
6003 # practice:
|
adam@0
|
6004 case $deplib in
|
adam@0
|
6005 -L*) new_libs="$deplib $new_libs" ;;
|
adam@0
|
6006 -R*) ;;
|
adam@0
|
6007 *)
|
adam@0
|
6008 # And here is the reason: when a library appears more
|
adam@0
|
6009 # than once as an explicit dependence of a library, or
|
adam@0
|
6010 # is implicitly linked in more than once by the
|
adam@0
|
6011 # compiler, it is considered special, and multiple
|
adam@0
|
6012 # occurrences thereof are not removed. Compare this
|
adam@0
|
6013 # with having the same library being listed as a
|
adam@0
|
6014 # dependency of multiple other libraries: in this case,
|
adam@0
|
6015 # we know (pedantically, we assume) the library does not
|
adam@0
|
6016 # need to be listed more than once, so we keep only the
|
adam@0
|
6017 # last copy. This is not always right, but it is rare
|
adam@0
|
6018 # enough that we require users that really mean to play
|
adam@0
|
6019 # such unportable linking tricks to link the library
|
adam@0
|
6020 # using -Wl,-lname, so that libtool does not consider it
|
adam@0
|
6021 # for duplicate removal.
|
adam@0
|
6022 case " $specialdeplibs " in
|
adam@0
|
6023 *" $deplib "*) new_libs="$deplib $new_libs" ;;
|
adam@0
|
6024 *)
|
adam@0
|
6025 case " $new_libs " in
|
adam@0
|
6026 *" $deplib "*) ;;
|
adam@0
|
6027 *) new_libs="$deplib $new_libs" ;;
|
adam@0
|
6028 esac
|
adam@0
|
6029 ;;
|
adam@0
|
6030 esac
|
adam@0
|
6031 ;;
|
adam@0
|
6032 esac
|
adam@0
|
6033 done
|
adam@0
|
6034 tmp_libs=
|
adam@0
|
6035 for deplib in $new_libs; do
|
adam@0
|
6036 case $deplib in
|
adam@0
|
6037 -L*)
|
adam@0
|
6038 case " $tmp_libs " in
|
adam@0
|
6039 *" $deplib "*) ;;
|
adam@0
|
6040 *) tmp_libs="$tmp_libs $deplib" ;;
|
adam@0
|
6041 esac
|
adam@0
|
6042 ;;
|
adam@0
|
6043 *) tmp_libs="$tmp_libs $deplib" ;;
|
adam@0
|
6044 esac
|
adam@0
|
6045 done
|
adam@0
|
6046 eval $var=\"$tmp_libs\"
|
adam@0
|
6047 done # for var
|
adam@0
|
6048 fi
|
adam@0
|
6049 # Last step: remove runtime libs from dependency_libs
|
adam@0
|
6050 # (they stay in deplibs)
|
adam@0
|
6051 tmp_libs=
|
adam@0
|
6052 for i in $dependency_libs ; do
|
adam@0
|
6053 case " $predeps $postdeps $compiler_lib_search_path " in
|
adam@0
|
6054 *" $i "*)
|
adam@0
|
6055 i=""
|
adam@0
|
6056 ;;
|
adam@0
|
6057 esac
|
adam@0
|
6058 if test -n "$i" ; then
|
adam@0
|
6059 tmp_libs="$tmp_libs $i"
|
adam@0
|
6060 fi
|
adam@0
|
6061 done
|
adam@0
|
6062 dependency_libs=$tmp_libs
|
adam@0
|
6063 done # for pass
|
adam@0
|
6064 if test "$linkmode" = prog; then
|
adam@0
|
6065 dlfiles="$newdlfiles"
|
adam@0
|
6066 fi
|
adam@0
|
6067 if test "$linkmode" = prog || test "$linkmode" = lib; then
|
adam@0
|
6068 dlprefiles="$newdlprefiles"
|
adam@0
|
6069 fi
|
adam@0
|
6070
|
adam@0
|
6071 case $linkmode in
|
adam@0
|
6072 oldlib)
|
adam@0
|
6073 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
|
adam@0
|
6074 func_warning "\`-dlopen' is ignored for archives"
|
adam@0
|
6075 fi
|
adam@0
|
6076
|
adam@0
|
6077 case " $deplibs" in
|
adam@0
|
6078 *\ -l* | *\ -L*)
|
adam@0
|
6079 func_warning "\`-l' and \`-L' are ignored for archives" ;;
|
adam@0
|
6080 esac
|
adam@0
|
6081
|
adam@0
|
6082 test -n "$rpath" && \
|
adam@0
|
6083 func_warning "\`-rpath' is ignored for archives"
|
adam@0
|
6084
|
adam@0
|
6085 test -n "$xrpath" && \
|
adam@0
|
6086 func_warning "\`-R' is ignored for archives"
|
adam@0
|
6087
|
adam@0
|
6088 test -n "$vinfo" && \
|
adam@0
|
6089 func_warning "\`-version-info/-version-number' is ignored for archives"
|
adam@0
|
6090
|
adam@0
|
6091 test -n "$release" && \
|
adam@0
|
6092 func_warning "\`-release' is ignored for archives"
|
adam@0
|
6093
|
adam@0
|
6094 test -n "$export_symbols$export_symbols_regex" && \
|
adam@0
|
6095 func_warning "\`-export-symbols' is ignored for archives"
|
adam@0
|
6096
|
adam@0
|
6097 # Now set the variables for building old libraries.
|
adam@0
|
6098 build_libtool_libs=no
|
adam@0
|
6099 oldlibs="$output"
|
adam@0
|
6100 objs="$objs$old_deplibs"
|
adam@0
|
6101 ;;
|
adam@0
|
6102
|
adam@0
|
6103 lib)
|
adam@0
|
6104 # Make sure we only generate libraries of the form `libNAME.la'.
|
adam@0
|
6105 case $outputname in
|
adam@0
|
6106 lib*)
|
adam@0
|
6107 func_stripname 'lib' '.la' "$outputname"
|
adam@0
|
6108 name=$func_stripname_result
|
adam@0
|
6109 eval shared_ext=\"$shrext_cmds\"
|
adam@0
|
6110 eval libname=\"$libname_spec\"
|
adam@0
|
6111 ;;
|
adam@0
|
6112 *)
|
adam@0
|
6113 test "$module" = no && \
|
adam@0
|
6114 func_fatal_help "libtool library \`$output' must begin with \`lib'"
|
adam@0
|
6115
|
adam@0
|
6116 if test "$need_lib_prefix" != no; then
|
adam@0
|
6117 # Add the "lib" prefix for modules if required
|
adam@0
|
6118 func_stripname '' '.la' "$outputname"
|
adam@0
|
6119 name=$func_stripname_result
|
adam@0
|
6120 eval shared_ext=\"$shrext_cmds\"
|
adam@0
|
6121 eval libname=\"$libname_spec\"
|
adam@0
|
6122 else
|
adam@0
|
6123 func_stripname '' '.la' "$outputname"
|
adam@0
|
6124 libname=$func_stripname_result
|
adam@0
|
6125 fi
|
adam@0
|
6126 ;;
|
adam@0
|
6127 esac
|
adam@0
|
6128
|
adam@0
|
6129 if test -n "$objs"; then
|
adam@0
|
6130 if test "$deplibs_check_method" != pass_all; then
|
adam@0
|
6131 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
|
adam@0
|
6132 else
|
adam@0
|
6133 $ECHO
|
adam@0
|
6134 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
|
adam@0
|
6135 $ECHO "*** objects $objs is not portable!"
|
adam@0
|
6136 libobjs="$libobjs $objs"
|
adam@0
|
6137 fi
|
adam@0
|
6138 fi
|
adam@0
|
6139
|
adam@0
|
6140 test "$dlself" != no && \
|
adam@0
|
6141 func_warning "\`-dlopen self' is ignored for libtool libraries"
|
adam@0
|
6142
|
adam@0
|
6143 set dummy $rpath
|
adam@0
|
6144 shift
|
adam@0
|
6145 test "$#" -gt 1 && \
|
adam@0
|
6146 func_warning "ignoring multiple \`-rpath's for a libtool library"
|
adam@0
|
6147
|
adam@0
|
6148 install_libdir="$1"
|
adam@0
|
6149
|
adam@0
|
6150 oldlibs=
|
adam@0
|
6151 if test -z "$rpath"; then
|
adam@0
|
6152 if test "$build_libtool_libs" = yes; then
|
adam@0
|
6153 # Building a libtool convenience library.
|
adam@0
|
6154 # Some compilers have problems with a `.al' extension so
|
adam@0
|
6155 # convenience libraries should have the same extension an
|
adam@0
|
6156 # archive normally would.
|
adam@0
|
6157 oldlibs="$output_objdir/$libname.$libext $oldlibs"
|
adam@0
|
6158 build_libtool_libs=convenience
|
adam@0
|
6159 build_old_libs=yes
|
adam@0
|
6160 fi
|
adam@0
|
6161
|
adam@0
|
6162 test -n "$vinfo" && \
|
adam@0
|
6163 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
|
adam@0
|
6164
|
adam@0
|
6165 test -n "$release" && \
|
adam@0
|
6166 func_warning "\`-release' is ignored for convenience libraries"
|
adam@0
|
6167 else
|
adam@0
|
6168
|
adam@0
|
6169 # Parse the version information argument.
|
adam@0
|
6170 save_ifs="$IFS"; IFS=':'
|
adam@0
|
6171 set dummy $vinfo 0 0 0
|
adam@0
|
6172 shift
|
adam@0
|
6173 IFS="$save_ifs"
|
adam@0
|
6174
|
adam@0
|
6175 test -n "$7" && \
|
adam@0
|
6176 func_fatal_help "too many parameters to \`-version-info'"
|
adam@0
|
6177
|
adam@0
|
6178 # convert absolute version numbers to libtool ages
|
adam@0
|
6179 # this retains compatibility with .la files and attempts
|
adam@0
|
6180 # to make the code below a bit more comprehensible
|
adam@0
|
6181
|
adam@0
|
6182 case $vinfo_number in
|
adam@0
|
6183 yes)
|
adam@0
|
6184 number_major="$1"
|
adam@0
|
6185 number_minor="$2"
|
adam@0
|
6186 number_revision="$3"
|
adam@0
|
6187 #
|
adam@0
|
6188 # There are really only two kinds -- those that
|
adam@0
|
6189 # use the current revision as the major version
|
adam@0
|
6190 # and those that subtract age and use age as
|
adam@0
|
6191 # a minor version. But, then there is irix
|
adam@0
|
6192 # which has an extra 1 added just for fun
|
adam@0
|
6193 #
|
adam@0
|
6194 case $version_type in
|
adam@0
|
6195 darwin|linux|osf|windows|none)
|
adam@0
|
6196 func_arith $number_major + $number_minor
|
adam@0
|
6197 current=$func_arith_result
|
adam@0
|
6198 age="$number_minor"
|
adam@0
|
6199 revision="$number_revision"
|
adam@0
|
6200 ;;
|
adam@0
|
6201 freebsd-aout|freebsd-elf|sunos)
|
adam@0
|
6202 current="$number_major"
|
adam@0
|
6203 revision="$number_minor"
|
adam@0
|
6204 age="0"
|
adam@0
|
6205 ;;
|
adam@0
|
6206 irix|nonstopux)
|
adam@0
|
6207 func_arith $number_major + $number_minor
|
adam@0
|
6208 current=$func_arith_result
|
adam@0
|
6209 age="$number_minor"
|
adam@0
|
6210 revision="$number_minor"
|
adam@0
|
6211 lt_irix_increment=no
|
adam@0
|
6212 ;;
|
adam@0
|
6213 *)
|
adam@0
|
6214 func_fatal_configuration "$modename: unknown library version type \`$version_type'"
|
adam@0
|
6215 ;;
|
adam@0
|
6216 esac
|
adam@0
|
6217 ;;
|
adam@0
|
6218 no)
|
adam@0
|
6219 current="$1"
|
adam@0
|
6220 revision="$2"
|
adam@0
|
6221 age="$3"
|
adam@0
|
6222 ;;
|
adam@0
|
6223 esac
|
adam@0
|
6224
|
adam@0
|
6225 # Check that each of the things are valid numbers.
|
adam@0
|
6226 case $current in
|
adam@0
|
6227 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]) ;;
|
adam@0
|
6228 *)
|
adam@0
|
6229 func_error "CURRENT \`$current' must be a nonnegative integer"
|
adam@0
|
6230 func_fatal_error "\`$vinfo' is not valid version information"
|
adam@0
|
6231 ;;
|
adam@0
|
6232 esac
|
adam@0
|
6233
|
adam@0
|
6234 case $revision in
|
adam@0
|
6235 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]) ;;
|
adam@0
|
6236 *)
|
adam@0
|
6237 func_error "REVISION \`$revision' must be a nonnegative integer"
|
adam@0
|
6238 func_fatal_error "\`$vinfo' is not valid version information"
|
adam@0
|
6239 ;;
|
adam@0
|
6240 esac
|
adam@0
|
6241
|
adam@0
|
6242 case $age in
|
adam@0
|
6243 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]) ;;
|
adam@0
|
6244 *)
|
adam@0
|
6245 func_error "AGE \`$age' must be a nonnegative integer"
|
adam@0
|
6246 func_fatal_error "\`$vinfo' is not valid version information"
|
adam@0
|
6247 ;;
|
adam@0
|
6248 esac
|
adam@0
|
6249
|
adam@0
|
6250 if test "$age" -gt "$current"; then
|
adam@0
|
6251 func_error "AGE \`$age' is greater than the current interface number \`$current'"
|
adam@0
|
6252 func_fatal_error "\`$vinfo' is not valid version information"
|
adam@0
|
6253 fi
|
adam@0
|
6254
|
adam@0
|
6255 # Calculate the version variables.
|
adam@0
|
6256 major=
|
adam@0
|
6257 versuffix=
|
adam@0
|
6258 verstring=
|
adam@0
|
6259 case $version_type in
|
adam@0
|
6260 none) ;;
|
adam@0
|
6261
|
adam@0
|
6262 darwin)
|
adam@0
|
6263 # Like Linux, but with the current version available in
|
adam@0
|
6264 # verstring for coding it into the library header
|
adam@0
|
6265 func_arith $current - $age
|
adam@0
|
6266 major=.$func_arith_result
|
adam@0
|
6267 versuffix="$major.$age.$revision"
|
adam@0
|
6268 # Darwin ld doesn't like 0 for these options...
|
adam@0
|
6269 func_arith $current + 1
|
adam@0
|
6270 minor_current=$func_arith_result
|
adam@0
|
6271 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
|
adam@0
|
6272 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
|
adam@0
|
6273 ;;
|
adam@0
|
6274
|
adam@0
|
6275 freebsd-aout)
|
adam@0
|
6276 major=".$current"
|
adam@0
|
6277 versuffix=".$current.$revision";
|
adam@0
|
6278 ;;
|
adam@0
|
6279
|
adam@0
|
6280 freebsd-elf)
|
adam@0
|
6281 major=".$current"
|
adam@0
|
6282 versuffix=".$current"
|
adam@0
|
6283 ;;
|
adam@0
|
6284
|
adam@0
|
6285 irix | nonstopux)
|
adam@0
|
6286 if test "X$lt_irix_increment" = "Xno"; then
|
adam@0
|
6287 func_arith $current - $age
|
adam@0
|
6288 else
|
adam@0
|
6289 func_arith $current - $age + 1
|
adam@0
|
6290 fi
|
adam@0
|
6291 major=$func_arith_result
|
adam@0
|
6292
|
adam@0
|
6293 case $version_type in
|
adam@0
|
6294 nonstopux) verstring_prefix=nonstopux ;;
|
adam@0
|
6295 *) verstring_prefix=sgi ;;
|
adam@0
|
6296 esac
|
adam@0
|
6297 verstring="$verstring_prefix$major.$revision"
|
adam@0
|
6298
|
adam@0
|
6299 # Add in all the interfaces that we are compatible with.
|
adam@0
|
6300 loop=$revision
|
adam@0
|
6301 while test "$loop" -ne 0; do
|
adam@0
|
6302 func_arith $revision - $loop
|
adam@0
|
6303 iface=$func_arith_result
|
adam@0
|
6304 func_arith $loop - 1
|
adam@0
|
6305 loop=$func_arith_result
|
adam@0
|
6306 verstring="$verstring_prefix$major.$iface:$verstring"
|
adam@0
|
6307 done
|
adam@0
|
6308
|
adam@0
|
6309 # Before this point, $major must not contain `.'.
|
adam@0
|
6310 major=.$major
|
adam@0
|
6311 versuffix="$major.$revision"
|
adam@0
|
6312 ;;
|
adam@0
|
6313
|
adam@0
|
6314 linux)
|
adam@0
|
6315 func_arith $current - $age
|
adam@0
|
6316 major=.$func_arith_result
|
adam@0
|
6317 versuffix="$major.$age.$revision"
|
adam@0
|
6318 ;;
|
adam@0
|
6319
|
adam@0
|
6320 osf)
|
adam@0
|
6321 func_arith $current - $age
|
adam@0
|
6322 major=.$func_arith_result
|
adam@0
|
6323 versuffix=".$current.$age.$revision"
|
adam@0
|
6324 verstring="$current.$age.$revision"
|
adam@0
|
6325
|
adam@0
|
6326 # Add in all the interfaces that we are compatible with.
|
adam@0
|
6327 loop=$age
|
adam@0
|
6328 while test "$loop" -ne 0; do
|
adam@0
|
6329 func_arith $current - $loop
|
adam@0
|
6330 iface=$func_arith_result
|
adam@0
|
6331 func_arith $loop - 1
|
adam@0
|
6332 loop=$func_arith_result
|
adam@0
|
6333 verstring="$verstring:${iface}.0"
|
adam@0
|
6334 done
|
adam@0
|
6335
|
adam@0
|
6336 # Make executables depend on our current version.
|
adam@0
|
6337 verstring="$verstring:${current}.0"
|
adam@0
|
6338 ;;
|
adam@0
|
6339
|
adam@0
|
6340 qnx)
|
adam@0
|
6341 major=".$current"
|
adam@0
|
6342 versuffix=".$current"
|
adam@0
|
6343 ;;
|
adam@0
|
6344
|
adam@0
|
6345 sunos)
|
adam@0
|
6346 major=".$current"
|
adam@0
|
6347 versuffix=".$current.$revision"
|
adam@0
|
6348 ;;
|
adam@0
|
6349
|
adam@0
|
6350 windows)
|
adam@0
|
6351 # Use '-' rather than '.', since we only want one
|
adam@0
|
6352 # extension on DOS 8.3 filesystems.
|
adam@0
|
6353 func_arith $current - $age
|
adam@0
|
6354 major=$func_arith_result
|
adam@0
|
6355 versuffix="-$major"
|
adam@0
|
6356 ;;
|
adam@0
|
6357
|
adam@0
|
6358 *)
|
adam@0
|
6359 func_fatal_configuration "unknown library version type \`$version_type'"
|
adam@0
|
6360 ;;
|
adam@0
|
6361 esac
|
adam@0
|
6362
|
adam@0
|
6363 # Clear the version info if we defaulted, and they specified a release.
|
adam@0
|
6364 if test -z "$vinfo" && test -n "$release"; then
|
adam@0
|
6365 major=
|
adam@0
|
6366 case $version_type in
|
adam@0
|
6367 darwin)
|
adam@0
|
6368 # we can't check for "0.0" in archive_cmds due to quoting
|
adam@0
|
6369 # problems, so we reset it completely
|
adam@0
|
6370 verstring=
|
adam@0
|
6371 ;;
|
adam@0
|
6372 *)
|
adam@0
|
6373 verstring="0.0"
|
adam@0
|
6374 ;;
|
adam@0
|
6375 esac
|
adam@0
|
6376 if test "$need_version" = no; then
|
adam@0
|
6377 versuffix=
|
adam@0
|
6378 else
|
adam@0
|
6379 versuffix=".0.0"
|
adam@0
|
6380 fi
|
adam@0
|
6381 fi
|
adam@0
|
6382
|
adam@0
|
6383 # Remove version info from name if versioning should be avoided
|
adam@0
|
6384 if test "$avoid_version" = yes && test "$need_version" = no; then
|
adam@0
|
6385 major=
|
adam@0
|
6386 versuffix=
|
adam@0
|
6387 verstring=""
|
adam@0
|
6388 fi
|
adam@0
|
6389
|
adam@0
|
6390 # Check to see if the archive will have undefined symbols.
|
adam@0
|
6391 if test "$allow_undefined" = yes; then
|
adam@0
|
6392 if test "$allow_undefined_flag" = unsupported; then
|
adam@0
|
6393 func_warning "undefined symbols not allowed in $host shared libraries"
|
adam@0
|
6394 build_libtool_libs=no
|
adam@0
|
6395 build_old_libs=yes
|
adam@0
|
6396 fi
|
adam@0
|
6397 else
|
adam@0
|
6398 # Don't allow undefined symbols.
|
adam@0
|
6399 allow_undefined_flag="$no_undefined_flag"
|
adam@0
|
6400 fi
|
adam@0
|
6401
|
adam@0
|
6402 fi
|
adam@0
|
6403
|
adam@0
|
6404 func_generate_dlsyms "$libname" "$libname" "yes"
|
adam@0
|
6405 libobjs="$libobjs $symfileobj"
|
adam@0
|
6406 test "X$libobjs" = "X " && libobjs=
|
adam@0
|
6407
|
adam@0
|
6408 if test "$mode" != relink; then
|
adam@0
|
6409 # Remove our outputs, but don't remove object files since they
|
adam@0
|
6410 # may have been created when compiling PIC objects.
|
adam@0
|
6411 removelist=
|
adam@0
|
6412 tempremovelist=`$ECHO "$output_objdir/*"`
|
adam@0
|
6413 for p in $tempremovelist; do
|
adam@0
|
6414 case $p in
|
adam@0
|
6415 *.$objext | *.gcno)
|
adam@0
|
6416 ;;
|
adam@0
|
6417 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
|
adam@0
|
6418 if test "X$precious_files_regex" != "X"; then
|
adam@0
|
6419 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
|
adam@0
|
6420 then
|
adam@0
|
6421 continue
|
adam@0
|
6422 fi
|
adam@0
|
6423 fi
|
adam@0
|
6424 removelist="$removelist $p"
|
adam@0
|
6425 ;;
|
adam@0
|
6426 *) ;;
|
adam@0
|
6427 esac
|
adam@0
|
6428 done
|
adam@0
|
6429 test -n "$removelist" && \
|
adam@0
|
6430 func_show_eval "${RM}r \$removelist"
|
adam@0
|
6431 fi
|
adam@0
|
6432
|
adam@0
|
6433 # Now set the variables for building old libraries.
|
adam@0
|
6434 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
|
adam@0
|
6435 oldlibs="$oldlibs $output_objdir/$libname.$libext"
|
adam@0
|
6436
|
adam@0
|
6437 # Transform .lo files to .o files.
|
adam@0
|
6438 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
|
adam@0
|
6439 fi
|
adam@0
|
6440
|
adam@0
|
6441 # Eliminate all temporary directories.
|
adam@0
|
6442 #for path in $notinst_path; do
|
adam@0
|
6443 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
|
adam@0
|
6444 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
|
adam@0
|
6445 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
|
adam@0
|
6446 #done
|
adam@0
|
6447
|
adam@0
|
6448 if test -n "$xrpath"; then
|
adam@0
|
6449 # If the user specified any rpath flags, then add them.
|
adam@0
|
6450 temp_xrpath=
|
adam@0
|
6451 for libdir in $xrpath; do
|
adam@0
|
6452 temp_xrpath="$temp_xrpath -R$libdir"
|
adam@0
|
6453 case "$finalize_rpath " in
|
adam@0
|
6454 *" $libdir "*) ;;
|
adam@0
|
6455 *) finalize_rpath="$finalize_rpath $libdir" ;;
|
adam@0
|
6456 esac
|
adam@0
|
6457 done
|
adam@0
|
6458 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
|
adam@0
|
6459 dependency_libs="$temp_xrpath $dependency_libs"
|
adam@0
|
6460 fi
|
adam@0
|
6461 fi
|
adam@0
|
6462
|
adam@0
|
6463 # Make sure dlfiles contains only unique files that won't be dlpreopened
|
adam@0
|
6464 old_dlfiles="$dlfiles"
|
adam@0
|
6465 dlfiles=
|
adam@0
|
6466 for lib in $old_dlfiles; do
|
adam@0
|
6467 case " $dlprefiles $dlfiles " in
|
adam@0
|
6468 *" $lib "*) ;;
|
adam@0
|
6469 *) dlfiles="$dlfiles $lib" ;;
|
adam@0
|
6470 esac
|
adam@0
|
6471 done
|
adam@0
|
6472
|
adam@0
|
6473 # Make sure dlprefiles contains only unique files
|
adam@0
|
6474 old_dlprefiles="$dlprefiles"
|
adam@0
|
6475 dlprefiles=
|
adam@0
|
6476 for lib in $old_dlprefiles; do
|
adam@0
|
6477 case "$dlprefiles " in
|
adam@0
|
6478 *" $lib "*) ;;
|
adam@0
|
6479 *) dlprefiles="$dlprefiles $lib" ;;
|
adam@0
|
6480 esac
|
adam@0
|
6481 done
|
adam@0
|
6482
|
adam@0
|
6483 if test "$build_libtool_libs" = yes; then
|
adam@0
|
6484 if test -n "$rpath"; then
|
adam@0
|
6485 case $host in
|
adam@0
|
6486 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
|
adam@0
|
6487 # these systems don't actually have a c library (as such)!
|
adam@0
|
6488 ;;
|
adam@0
|
6489 *-*-rhapsody* | *-*-darwin1.[012])
|
adam@0
|
6490 # Rhapsody C library is in the System framework
|
adam@0
|
6491 deplibs="$deplibs System.ltframework"
|
adam@0
|
6492 ;;
|
adam@0
|
6493 *-*-netbsd*)
|
adam@0
|
6494 # Don't link with libc until the a.out ld.so is fixed.
|
adam@0
|
6495 ;;
|
adam@0
|
6496 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
|
adam@0
|
6497 # Do not include libc due to us having libc/libc_r.
|
adam@0
|
6498 ;;
|
adam@0
|
6499 *-*-sco3.2v5* | *-*-sco5v6*)
|
adam@0
|
6500 # Causes problems with __ctype
|
adam@0
|
6501 ;;
|
adam@0
|
6502 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
|
adam@0
|
6503 # Compiler inserts libc in the correct place for threads to work
|
adam@0
|
6504 ;;
|
adam@0
|
6505 *)
|
adam@0
|
6506 # Add libc to deplibs on all other systems if necessary.
|
adam@0
|
6507 if test "$build_libtool_need_lc" = "yes"; then
|
adam@0
|
6508 deplibs="$deplibs -lc"
|
adam@0
|
6509 fi
|
adam@0
|
6510 ;;
|
adam@0
|
6511 esac
|
adam@0
|
6512 fi
|
adam@0
|
6513
|
adam@0
|
6514 # Transform deplibs into only deplibs that can be linked in shared.
|
adam@0
|
6515 name_save=$name
|
adam@0
|
6516 libname_save=$libname
|
adam@0
|
6517 release_save=$release
|
adam@0
|
6518 versuffix_save=$versuffix
|
adam@0
|
6519 major_save=$major
|
adam@0
|
6520 # I'm not sure if I'm treating the release correctly. I think
|
adam@0
|
6521 # release should show up in the -l (ie -lgmp5) so we don't want to
|
adam@0
|
6522 # add it in twice. Is that correct?
|
adam@0
|
6523 release=""
|
adam@0
|
6524 versuffix=""
|
adam@0
|
6525 major=""
|
adam@0
|
6526 newdeplibs=
|
adam@0
|
6527 droppeddeps=no
|
adam@0
|
6528 case $deplibs_check_method in
|
adam@0
|
6529 pass_all)
|
adam@0
|
6530 # Don't check for shared/static. Everything works.
|
adam@0
|
6531 # This might be a little naive. We might want to check
|
adam@0
|
6532 # whether the library exists or not. But this is on
|
adam@0
|
6533 # osf3 & osf4 and I'm not really sure... Just
|
adam@0
|
6534 # implementing what was already the behavior.
|
adam@0
|
6535 newdeplibs=$deplibs
|
adam@0
|
6536 ;;
|
adam@0
|
6537 test_compile)
|
adam@0
|
6538 # This code stresses the "libraries are programs" paradigm to its
|
adam@0
|
6539 # limits. Maybe even breaks it. We compile a program, linking it
|
adam@0
|
6540 # against the deplibs as a proxy for the library. Then we can check
|
adam@0
|
6541 # whether they linked in statically or dynamically with ldd.
|
adam@0
|
6542 $opt_dry_run || $RM conftest.c
|
adam@0
|
6543 cat > conftest.c <<EOF
|
adam@0
|
6544 int main() { return 0; }
|
adam@0
|
6545 EOF
|
adam@0
|
6546 $opt_dry_run || $RM conftest
|
adam@0
|
6547 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
|
adam@0
|
6548 ldd_output=`ldd conftest`
|
adam@0
|
6549 for i in $deplibs; do
|
adam@0
|
6550 case $i in
|
adam@0
|
6551 -l*)
|
adam@0
|
6552 func_stripname -l '' "$i"
|
adam@0
|
6553 name=$func_stripname_result
|
adam@0
|
6554 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
adam@0
|
6555 case " $predeps $postdeps " in
|
adam@0
|
6556 *" $i "*)
|
adam@0
|
6557 newdeplibs="$newdeplibs $i"
|
adam@0
|
6558 i=""
|
adam@0
|
6559 ;;
|
adam@0
|
6560 esac
|
adam@0
|
6561 fi
|
adam@0
|
6562 if test -n "$i" ; then
|
adam@0
|
6563 libname=`eval "\\$ECHO \"$libname_spec\""`
|
adam@0
|
6564 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
|
adam@0
|
6565 set dummy $deplib_matches; shift
|
adam@0
|
6566 deplib_match=$1
|
adam@0
|
6567 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
|
adam@0
|
6568 newdeplibs="$newdeplibs $i"
|
adam@0
|
6569 else
|
adam@0
|
6570 droppeddeps=yes
|
adam@0
|
6571 $ECHO
|
adam@0
|
6572 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
|
adam@0
|
6573 $ECHO "*** I have the capability to make that library automatically link in when"
|
adam@0
|
6574 $ECHO "*** you link to this library. But I can only do this if you have a"
|
adam@0
|
6575 $ECHO "*** shared version of the library, which I believe you do not have"
|
adam@0
|
6576 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
|
adam@0
|
6577 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
|
adam@0
|
6578 fi
|
adam@0
|
6579 fi
|
adam@0
|
6580 ;;
|
adam@0
|
6581 *)
|
adam@0
|
6582 newdeplibs="$newdeplibs $i"
|
adam@0
|
6583 ;;
|
adam@0
|
6584 esac
|
adam@0
|
6585 done
|
adam@0
|
6586 else
|
adam@0
|
6587 # Error occurred in the first compile. Let's try to salvage
|
adam@0
|
6588 # the situation: Compile a separate program for each library.
|
adam@0
|
6589 for i in $deplibs; do
|
adam@0
|
6590 case $i in
|
adam@0
|
6591 -l*)
|
adam@0
|
6592 func_stripname -l '' "$i"
|
adam@0
|
6593 name=$func_stripname_result
|
adam@0
|
6594 $opt_dry_run || $RM conftest
|
adam@0
|
6595 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
|
adam@0
|
6596 ldd_output=`ldd conftest`
|
adam@0
|
6597 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
adam@0
|
6598 case " $predeps $postdeps " in
|
adam@0
|
6599 *" $i "*)
|
adam@0
|
6600 newdeplibs="$newdeplibs $i"
|
adam@0
|
6601 i=""
|
adam@0
|
6602 ;;
|
adam@0
|
6603 esac
|
adam@0
|
6604 fi
|
adam@0
|
6605 if test -n "$i" ; then
|
adam@0
|
6606 libname=`eval "\\$ECHO \"$libname_spec\""`
|
adam@0
|
6607 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
|
adam@0
|
6608 set dummy $deplib_matches; shift
|
adam@0
|
6609 deplib_match=$1
|
adam@0
|
6610 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
|
adam@0
|
6611 newdeplibs="$newdeplibs $i"
|
adam@0
|
6612 else
|
adam@0
|
6613 droppeddeps=yes
|
adam@0
|
6614 $ECHO
|
adam@0
|
6615 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
|
adam@0
|
6616 $ECHO "*** I have the capability to make that library automatically link in when"
|
adam@0
|
6617 $ECHO "*** you link to this library. But I can only do this if you have a"
|
adam@0
|
6618 $ECHO "*** shared version of the library, which you do not appear to have"
|
adam@0
|
6619 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
|
adam@0
|
6620 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
|
adam@0
|
6621 fi
|
adam@0
|
6622 fi
|
adam@0
|
6623 else
|
adam@0
|
6624 droppeddeps=yes
|
adam@0
|
6625 $ECHO
|
adam@0
|
6626 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
|
adam@0
|
6627 $ECHO "*** make it link in! You will probably need to install it or some"
|
adam@0
|
6628 $ECHO "*** library that it depends on before this library will be fully"
|
adam@0
|
6629 $ECHO "*** functional. Installing it before continuing would be even better."
|
adam@0
|
6630 fi
|
adam@0
|
6631 ;;
|
adam@0
|
6632 *)
|
adam@0
|
6633 newdeplibs="$newdeplibs $i"
|
adam@0
|
6634 ;;
|
adam@0
|
6635 esac
|
adam@0
|
6636 done
|
adam@0
|
6637 fi
|
adam@0
|
6638 ;;
|
adam@0
|
6639 file_magic*)
|
adam@0
|
6640 set dummy $deplibs_check_method; shift
|
adam@0
|
6641 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
|
adam@0
|
6642 for a_deplib in $deplibs; do
|
adam@0
|
6643 case $a_deplib in
|
adam@0
|
6644 -l*)
|
adam@0
|
6645 func_stripname -l '' "$a_deplib"
|
adam@0
|
6646 name=$func_stripname_result
|
adam@0
|
6647 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
adam@0
|
6648 case " $predeps $postdeps " in
|
adam@0
|
6649 *" $a_deplib "*)
|
adam@0
|
6650 newdeplibs="$newdeplibs $a_deplib"
|
adam@0
|
6651 a_deplib=""
|
adam@0
|
6652 ;;
|
adam@0
|
6653 esac
|
adam@0
|
6654 fi
|
adam@0
|
6655 if test -n "$a_deplib" ; then
|
adam@0
|
6656 libname=`eval "\\$ECHO \"$libname_spec\""`
|
adam@0
|
6657 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
|
adam@0
|
6658 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
|
adam@0
|
6659 for potent_lib in $potential_libs; do
|
adam@0
|
6660 # Follow soft links.
|
adam@0
|
6661 if ls -lLd "$potent_lib" 2>/dev/null |
|
adam@0
|
6662 $GREP " -> " >/dev/null; then
|
adam@0
|
6663 continue
|
adam@0
|
6664 fi
|
adam@0
|
6665 # The statement above tries to avoid entering an
|
adam@0
|
6666 # endless loop below, in case of cyclic links.
|
adam@0
|
6667 # We might still enter an endless loop, since a link
|
adam@0
|
6668 # loop can be closed while we follow links,
|
adam@0
|
6669 # but so what?
|
adam@0
|
6670 potlib="$potent_lib"
|
adam@0
|
6671 while test -h "$potlib" 2>/dev/null; do
|
adam@0
|
6672 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
|
adam@0
|
6673 case $potliblink in
|
adam@0
|
6674 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
|
adam@0
|
6675 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
|
adam@0
|
6676 esac
|
adam@0
|
6677 done
|
adam@0
|
6678 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
|
adam@0
|
6679 $SED -e 10q |
|
adam@0
|
6680 $EGREP "$file_magic_regex" > /dev/null; then
|
adam@0
|
6681 newdeplibs="$newdeplibs $a_deplib"
|
adam@0
|
6682 a_deplib=""
|
adam@0
|
6683 break 2
|
adam@0
|
6684 fi
|
adam@0
|
6685 done
|
adam@0
|
6686 done
|
adam@0
|
6687 fi
|
adam@0
|
6688 if test -n "$a_deplib" ; then
|
adam@0
|
6689 droppeddeps=yes
|
adam@0
|
6690 $ECHO
|
adam@0
|
6691 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
|
adam@0
|
6692 $ECHO "*** I have the capability to make that library automatically link in when"
|
adam@0
|
6693 $ECHO "*** you link to this library. But I can only do this if you have a"
|
adam@0
|
6694 $ECHO "*** shared version of the library, which you do not appear to have"
|
adam@0
|
6695 $ECHO "*** because I did check the linker path looking for a file starting"
|
adam@0
|
6696 if test -z "$potlib" ; then
|
adam@0
|
6697 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
|
adam@0
|
6698 else
|
adam@0
|
6699 $ECHO "*** with $libname and none of the candidates passed a file format test"
|
adam@0
|
6700 $ECHO "*** using a file magic. Last file checked: $potlib"
|
adam@0
|
6701 fi
|
adam@0
|
6702 fi
|
adam@0
|
6703 ;;
|
adam@0
|
6704 *)
|
adam@0
|
6705 # Add a -L argument.
|
adam@0
|
6706 newdeplibs="$newdeplibs $a_deplib"
|
adam@0
|
6707 ;;
|
adam@0
|
6708 esac
|
adam@0
|
6709 done # Gone through all deplibs.
|
adam@0
|
6710 ;;
|
adam@0
|
6711 match_pattern*)
|
adam@0
|
6712 set dummy $deplibs_check_method; shift
|
adam@0
|
6713 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
|
adam@0
|
6714 for a_deplib in $deplibs; do
|
adam@0
|
6715 case $a_deplib in
|
adam@0
|
6716 -l*)
|
adam@0
|
6717 func_stripname -l '' "$a_deplib"
|
adam@0
|
6718 name=$func_stripname_result
|
adam@0
|
6719 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
adam@0
|
6720 case " $predeps $postdeps " in
|
adam@0
|
6721 *" $a_deplib "*)
|
adam@0
|
6722 newdeplibs="$newdeplibs $a_deplib"
|
adam@0
|
6723 a_deplib=""
|
adam@0
|
6724 ;;
|
adam@0
|
6725 esac
|
adam@0
|
6726 fi
|
adam@0
|
6727 if test -n "$a_deplib" ; then
|
adam@0
|
6728 libname=`eval "\\$ECHO \"$libname_spec\""`
|
adam@0
|
6729 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
|
adam@0
|
6730 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
|
adam@0
|
6731 for potent_lib in $potential_libs; do
|
adam@0
|
6732 potlib="$potent_lib" # see symlink-check above in file_magic test
|
adam@0
|
6733 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
|
adam@0
|
6734 $EGREP "$match_pattern_regex" > /dev/null; then
|
adam@0
|
6735 newdeplibs="$newdeplibs $a_deplib"
|
adam@0
|
6736 a_deplib=""
|
adam@0
|
6737 break 2
|
adam@0
|
6738 fi
|
adam@0
|
6739 done
|
adam@0
|
6740 done
|
adam@0
|
6741 fi
|
adam@0
|
6742 if test -n "$a_deplib" ; then
|
adam@0
|
6743 droppeddeps=yes
|
adam@0
|
6744 $ECHO
|
adam@0
|
6745 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
|
adam@0
|
6746 $ECHO "*** I have the capability to make that library automatically link in when"
|
adam@0
|
6747 $ECHO "*** you link to this library. But I can only do this if you have a"
|
adam@0
|
6748 $ECHO "*** shared version of the library, which you do not appear to have"
|
adam@0
|
6749 $ECHO "*** because I did check the linker path looking for a file starting"
|
adam@0
|
6750 if test -z "$potlib" ; then
|
adam@0
|
6751 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
|
adam@0
|
6752 else
|
adam@0
|
6753 $ECHO "*** with $libname and none of the candidates passed a file format test"
|
adam@0
|
6754 $ECHO "*** using a regex pattern. Last file checked: $potlib"
|
adam@0
|
6755 fi
|
adam@0
|
6756 fi
|
adam@0
|
6757 ;;
|
adam@0
|
6758 *)
|
adam@0
|
6759 # Add a -L argument.
|
adam@0
|
6760 newdeplibs="$newdeplibs $a_deplib"
|
adam@0
|
6761 ;;
|
adam@0
|
6762 esac
|
adam@0
|
6763 done # Gone through all deplibs.
|
adam@0
|
6764 ;;
|
adam@0
|
6765 none | unknown | *)
|
adam@0
|
6766 newdeplibs=""
|
adam@0
|
6767 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
|
adam@0
|
6768 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
|
adam@0
|
6769 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
adam@0
|
6770 for i in $predeps $postdeps ; do
|
adam@0
|
6771 # can't use Xsed below, because $i might contain '/'
|
adam@0
|
6772 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
|
adam@0
|
6773 done
|
adam@0
|
6774 fi
|
adam@0
|
6775 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
|
adam@0
|
6776 $GREP . >/dev/null; then
|
adam@0
|
6777 $ECHO
|
adam@0
|
6778 if test "X$deplibs_check_method" = "Xnone"; then
|
adam@0
|
6779 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
|
adam@0
|
6780 else
|
adam@0
|
6781 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
|
adam@0
|
6782 fi
|
adam@0
|
6783 $ECHO "*** All declared inter-library dependencies are being dropped."
|
adam@0
|
6784 droppeddeps=yes
|
adam@0
|
6785 fi
|
adam@0
|
6786 ;;
|
adam@0
|
6787 esac
|
adam@0
|
6788 versuffix=$versuffix_save
|
adam@0
|
6789 major=$major_save
|
adam@0
|
6790 release=$release_save
|
adam@0
|
6791 libname=$libname_save
|
adam@0
|
6792 name=$name_save
|
adam@0
|
6793
|
adam@0
|
6794 case $host in
|
adam@0
|
6795 *-*-rhapsody* | *-*-darwin1.[012])
|
adam@0
|
6796 # On Rhapsody replace the C library with the System framework
|
adam@0
|
6797 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
|
adam@0
|
6798 ;;
|
adam@0
|
6799 esac
|
adam@0
|
6800
|
adam@0
|
6801 if test "$droppeddeps" = yes; then
|
adam@0
|
6802 if test "$module" = yes; then
|
adam@0
|
6803 $ECHO
|
adam@0
|
6804 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
|
adam@0
|
6805 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
|
adam@0
|
6806 $ECHO "*** a static module, that should work as long as the dlopening"
|
adam@0
|
6807 $ECHO "*** application is linked with the -dlopen flag."
|
adam@0
|
6808 if test -z "$global_symbol_pipe"; then
|
adam@0
|
6809 $ECHO
|
adam@0
|
6810 $ECHO "*** However, this would only work if libtool was able to extract symbol"
|
adam@0
|
6811 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
|
adam@0
|
6812 $ECHO "*** not find such a program. So, this module is probably useless."
|
adam@0
|
6813 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
|
adam@0
|
6814 fi
|
adam@0
|
6815 if test "$build_old_libs" = no; then
|
adam@0
|
6816 oldlibs="$output_objdir/$libname.$libext"
|
adam@0
|
6817 build_libtool_libs=module
|
adam@0
|
6818 build_old_libs=yes
|
adam@0
|
6819 else
|
adam@0
|
6820 build_libtool_libs=no
|
adam@0
|
6821 fi
|
adam@0
|
6822 else
|
adam@0
|
6823 $ECHO "*** The inter-library dependencies that have been dropped here will be"
|
adam@0
|
6824 $ECHO "*** automatically added whenever a program is linked with this library"
|
adam@0
|
6825 $ECHO "*** or is declared to -dlopen it."
|
adam@0
|
6826
|
adam@0
|
6827 if test "$allow_undefined" = no; then
|
adam@0
|
6828 $ECHO
|
adam@0
|
6829 $ECHO "*** Since this library must not contain undefined symbols,"
|
adam@0
|
6830 $ECHO "*** because either the platform does not support them or"
|
adam@0
|
6831 $ECHO "*** it was explicitly requested with -no-undefined,"
|
adam@0
|
6832 $ECHO "*** libtool will only create a static version of it."
|
adam@0
|
6833 if test "$build_old_libs" = no; then
|
adam@0
|
6834 oldlibs="$output_objdir/$libname.$libext"
|
adam@0
|
6835 build_libtool_libs=module
|
adam@0
|
6836 build_old_libs=yes
|
adam@0
|
6837 else
|
adam@0
|
6838 build_libtool_libs=no
|
adam@0
|
6839 fi
|
adam@0
|
6840 fi
|
adam@0
|
6841 fi
|
adam@0
|
6842 fi
|
adam@0
|
6843 # Done checking deplibs!
|
adam@0
|
6844 deplibs=$newdeplibs
|
adam@0
|
6845 fi
|
adam@0
|
6846 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
|
adam@0
|
6847 case $host in
|
adam@0
|
6848 *-*-darwin*)
|
adam@0
|
6849 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
adam@0
|
6850 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
adam@0
|
6851 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
adam@0
|
6852 ;;
|
adam@0
|
6853 esac
|
adam@0
|
6854
|
adam@0
|
6855 # move library search paths that coincide with paths to not yet
|
adam@0
|
6856 # installed libraries to the beginning of the library search list
|
adam@0
|
6857 new_libs=
|
adam@0
|
6858 for path in $notinst_path; do
|
adam@0
|
6859 case " $new_libs " in
|
adam@0
|
6860 *" -L$path/$objdir "*) ;;
|
adam@0
|
6861 *)
|
adam@0
|
6862 case " $deplibs " in
|
adam@0
|
6863 *" -L$path/$objdir "*)
|
adam@0
|
6864 new_libs="$new_libs -L$path/$objdir" ;;
|
adam@0
|
6865 esac
|
adam@0
|
6866 ;;
|
adam@0
|
6867 esac
|
adam@0
|
6868 done
|
adam@0
|
6869 for deplib in $deplibs; do
|
adam@0
|
6870 case $deplib in
|
adam@0
|
6871 -L*)
|
adam@0
|
6872 case " $new_libs " in
|
adam@0
|
6873 *" $deplib "*) ;;
|
adam@0
|
6874 *) new_libs="$new_libs $deplib" ;;
|
adam@0
|
6875 esac
|
adam@0
|
6876 ;;
|
adam@0
|
6877 *) new_libs="$new_libs $deplib" ;;
|
adam@0
|
6878 esac
|
adam@0
|
6879 done
|
adam@0
|
6880 deplibs="$new_libs"
|
adam@0
|
6881
|
adam@0
|
6882 # All the library-specific variables (install_libdir is set above).
|
adam@0
|
6883 library_names=
|
adam@0
|
6884 old_library=
|
adam@0
|
6885 dlname=
|
adam@0
|
6886
|
adam@0
|
6887 # Test again, we may have decided not to build it any more
|
adam@0
|
6888 if test "$build_libtool_libs" = yes; then
|
adam@0
|
6889 if test "$hardcode_into_libs" = yes; then
|
adam@0
|
6890 # Hardcode the library paths
|
adam@0
|
6891 hardcode_libdirs=
|
adam@0
|
6892 dep_rpath=
|
adam@0
|
6893 rpath="$finalize_rpath"
|
adam@0
|
6894 test "$mode" != relink && rpath="$compile_rpath$rpath"
|
adam@0
|
6895 for libdir in $rpath; do
|
adam@0
|
6896 if test -n "$hardcode_libdir_flag_spec"; then
|
adam@0
|
6897 if test -n "$hardcode_libdir_separator"; then
|
adam@0
|
6898 if test -z "$hardcode_libdirs"; then
|
adam@0
|
6899 hardcode_libdirs="$libdir"
|
adam@0
|
6900 else
|
adam@0
|
6901 # Just accumulate the unique libdirs.
|
adam@0
|
6902 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
|
adam@0
|
6903 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
|
adam@0
|
6904 ;;
|
adam@0
|
6905 *)
|
adam@0
|
6906 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
|
adam@0
|
6907 ;;
|
adam@0
|
6908 esac
|
adam@0
|
6909 fi
|
adam@0
|
6910 else
|
adam@0
|
6911 eval flag=\"$hardcode_libdir_flag_spec\"
|
adam@0
|
6912 dep_rpath="$dep_rpath $flag"
|
adam@0
|
6913 fi
|
adam@0
|
6914 elif test -n "$runpath_var"; then
|
adam@0
|
6915 case "$perm_rpath " in
|
adam@0
|
6916 *" $libdir "*) ;;
|
adam@0
|
6917 *) perm_rpath="$perm_rpath $libdir" ;;
|
adam@0
|
6918 esac
|
adam@0
|
6919 fi
|
adam@0
|
6920 done
|
adam@0
|
6921 # Substitute the hardcoded libdirs into the rpath.
|
adam@0
|
6922 if test -n "$hardcode_libdir_separator" &&
|
adam@0
|
6923 test -n "$hardcode_libdirs"; then
|
adam@0
|
6924 libdir="$hardcode_libdirs"
|
adam@0
|
6925 if test -n "$hardcode_libdir_flag_spec_ld"; then
|
adam@0
|
6926 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
|
adam@0
|
6927 else
|
adam@0
|
6928 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
|
adam@0
|
6929 fi
|
adam@0
|
6930 fi
|
adam@0
|
6931 if test -n "$runpath_var" && test -n "$perm_rpath"; then
|
adam@0
|
6932 # We should set the runpath_var.
|
adam@0
|
6933 rpath=
|
adam@0
|
6934 for dir in $perm_rpath; do
|
adam@0
|
6935 rpath="$rpath$dir:"
|
adam@0
|
6936 done
|
adam@0
|
6937 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
|
adam@0
|
6938 fi
|
adam@0
|
6939 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
|
adam@0
|
6940 fi
|
adam@0
|
6941
|
adam@0
|
6942 shlibpath="$finalize_shlibpath"
|
adam@0
|
6943 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
|
adam@0
|
6944 if test -n "$shlibpath"; then
|
adam@0
|
6945 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
|
adam@0
|
6946 fi
|
adam@0
|
6947
|
adam@0
|
6948 # Get the real and link names of the library.
|
adam@0
|
6949 eval shared_ext=\"$shrext_cmds\"
|
adam@0
|
6950 eval library_names=\"$library_names_spec\"
|
adam@0
|
6951 set dummy $library_names
|
adam@0
|
6952 shift
|
adam@0
|
6953 realname="$1"
|
adam@0
|
6954 shift
|
adam@0
|
6955
|
adam@0
|
6956 if test -n "$soname_spec"; then
|
adam@0
|
6957 eval soname=\"$soname_spec\"
|
adam@0
|
6958 else
|
adam@0
|
6959 soname="$realname"
|
adam@0
|
6960 fi
|
adam@0
|
6961 if test -z "$dlname"; then
|
adam@0
|
6962 dlname=$soname
|
adam@0
|
6963 fi
|
adam@0
|
6964
|
adam@0
|
6965 lib="$output_objdir/$realname"
|
adam@0
|
6966 linknames=
|
adam@0
|
6967 for link
|
adam@0
|
6968 do
|
adam@0
|
6969 linknames="$linknames $link"
|
adam@0
|
6970 done
|
adam@0
|
6971
|
adam@0
|
6972 # Use standard objects if they are pic
|
adam@0
|
6973 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
|
adam@0
|
6974 test "X$libobjs" = "X " && libobjs=
|
adam@0
|
6975
|
adam@0
|
6976 delfiles=
|
adam@0
|
6977 if test -n "$export_symbols" && test -n "$include_expsyms"; then
|
adam@0
|
6978 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
|
adam@0
|
6979 export_symbols="$output_objdir/$libname.uexp"
|
adam@0
|
6980 delfiles="$delfiles $export_symbols"
|
adam@0
|
6981 fi
|
adam@0
|
6982
|
adam@0
|
6983 orig_export_symbols=
|
adam@0
|
6984 case $host_os in
|
adam@0
|
6985 cygwin* | mingw* | cegcc*)
|
adam@0
|
6986 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
|
adam@0
|
6987 # exporting using user supplied symfile
|
adam@0
|
6988 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
|
adam@0
|
6989 # and it's NOT already a .def file. Must figure out
|
adam@0
|
6990 # which of the given symbols are data symbols and tag
|
adam@0
|
6991 # them as such. So, trigger use of export_symbols_cmds.
|
adam@0
|
6992 # export_symbols gets reassigned inside the "prepare
|
adam@0
|
6993 # the list of exported symbols" if statement, so the
|
adam@0
|
6994 # include_expsyms logic still works.
|
adam@0
|
6995 orig_export_symbols="$export_symbols"
|
adam@0
|
6996 export_symbols=
|
adam@0
|
6997 always_export_symbols=yes
|
adam@0
|
6998 fi
|
adam@0
|
6999 fi
|
adam@0
|
7000 ;;
|
adam@0
|
7001 esac
|
adam@0
|
7002
|
adam@0
|
7003 # Prepare the list of exported symbols
|
adam@0
|
7004 if test -z "$export_symbols"; then
|
adam@0
|
7005 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
|
adam@0
|
7006 func_verbose "generating symbol list for \`$libname.la'"
|
adam@0
|
7007 export_symbols="$output_objdir/$libname.exp"
|
adam@0
|
7008 $opt_dry_run || $RM $export_symbols
|
adam@0
|
7009 cmds=$export_symbols_cmds
|
adam@0
|
7010 save_ifs="$IFS"; IFS='~'
|
adam@0
|
7011 for cmd in $cmds; do
|
adam@0
|
7012 IFS="$save_ifs"
|
adam@0
|
7013 eval cmd=\"$cmd\"
|
adam@0
|
7014 func_len " $cmd"
|
adam@0
|
7015 len=$func_len_result
|
adam@0
|
7016 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
|
adam@0
|
7017 func_show_eval "$cmd" 'exit $?'
|
adam@0
|
7018 skipped_export=false
|
adam@0
|
7019 else
|
adam@0
|
7020 # The command line is too long to execute in one step.
|
adam@0
|
7021 func_verbose "using reloadable object file for export list..."
|
adam@0
|
7022 skipped_export=:
|
adam@0
|
7023 # Break out early, otherwise skipped_export may be
|
adam@0
|
7024 # set to false by a later but shorter cmd.
|
adam@0
|
7025 break
|
adam@0
|
7026 fi
|
adam@0
|
7027 done
|
adam@0
|
7028 IFS="$save_ifs"
|
adam@0
|
7029 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
|
adam@0
|
7030 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
|
adam@0
|
7031 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
|
adam@0
|
7032 fi
|
adam@0
|
7033 fi
|
adam@0
|
7034 fi
|
adam@0
|
7035
|
adam@0
|
7036 if test -n "$export_symbols" && test -n "$include_expsyms"; then
|
adam@0
|
7037 tmp_export_symbols="$export_symbols"
|
adam@0
|
7038 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
|
adam@0
|
7039 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
|
adam@0
|
7040 fi
|
adam@0
|
7041
|
adam@0
|
7042 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
|
adam@0
|
7043 # The given exports_symbols file has to be filtered, so filter it.
|
adam@0
|
7044 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
|
adam@0
|
7045 # FIXME: $output_objdir/$libname.filter potentially contains lots of
|
adam@0
|
7046 # 's' commands which not all seds can handle. GNU sed should be fine
|
adam@0
|
7047 # though. Also, the filter scales superlinearly with the number of
|
adam@0
|
7048 # global variables. join(1) would be nice here, but unfortunately
|
adam@0
|
7049 # isn't a blessed tool.
|
adam@0
|
7050 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
|
adam@0
|
7051 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
|
adam@0
|
7052 export_symbols=$output_objdir/$libname.def
|
adam@0
|
7053 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
|
adam@0
|
7054 fi
|
adam@0
|
7055
|
adam@0
|
7056 tmp_deplibs=
|
adam@0
|
7057 for test_deplib in $deplibs; do
|
adam@0
|
7058 case " $convenience " in
|
adam@0
|
7059 *" $test_deplib "*) ;;
|
adam@0
|
7060 *)
|
adam@0
|
7061 tmp_deplibs="$tmp_deplibs $test_deplib"
|
adam@0
|
7062 ;;
|
adam@0
|
7063 esac
|
adam@0
|
7064 done
|
adam@0
|
7065 deplibs="$tmp_deplibs"
|
adam@0
|
7066
|
adam@0
|
7067 if test -n "$convenience"; then
|
adam@0
|
7068 if test -n "$whole_archive_flag_spec" &&
|
adam@0
|
7069 test "$compiler_needs_object" = yes &&
|
adam@0
|
7070 test -z "$libobjs"; then
|
adam@0
|
7071 # extract the archives, so we have objects to list.
|
adam@0
|
7072 # TODO: could optimize this to just extract one archive.
|
adam@0
|
7073 whole_archive_flag_spec=
|
adam@0
|
7074 fi
|
adam@0
|
7075 if test -n "$whole_archive_flag_spec"; then
|
adam@0
|
7076 save_libobjs=$libobjs
|
adam@0
|
7077 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
|
adam@0
|
7078 test "X$libobjs" = "X " && libobjs=
|
adam@0
|
7079 else
|
adam@0
|
7080 gentop="$output_objdir/${outputname}x"
|
adam@0
|
7081 generated="$generated $gentop"
|
adam@0
|
7082
|
adam@0
|
7083 func_extract_archives $gentop $convenience
|
adam@0
|
7084 libobjs="$libobjs $func_extract_archives_result"
|
adam@0
|
7085 test "X$libobjs" = "X " && libobjs=
|
adam@0
|
7086 fi
|
adam@0
|
7087 fi
|
adam@0
|
7088
|
adam@0
|
7089 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
|
adam@0
|
7090 eval flag=\"$thread_safe_flag_spec\"
|
adam@0
|
7091 linker_flags="$linker_flags $flag"
|
adam@0
|
7092 fi
|
adam@0
|
7093
|
adam@0
|
7094 # Make a backup of the uninstalled library when relinking
|
adam@0
|
7095 if test "$mode" = relink; then
|
adam@0
|
7096 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
|
adam@0
|
7097 fi
|
adam@0
|
7098
|
adam@0
|
7099 # Do each of the archive commands.
|
adam@0
|
7100 if test "$module" = yes && test -n "$module_cmds" ; then
|
adam@0
|
7101 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
|
adam@0
|
7102 eval test_cmds=\"$module_expsym_cmds\"
|
adam@0
|
7103 cmds=$module_expsym_cmds
|
adam@0
|
7104 else
|
adam@0
|
7105 eval test_cmds=\"$module_cmds\"
|
adam@0
|
7106 cmds=$module_cmds
|
adam@0
|
7107 fi
|
adam@0
|
7108 else
|
adam@0
|
7109 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
|
adam@0
|
7110 eval test_cmds=\"$archive_expsym_cmds\"
|
adam@0
|
7111 cmds=$archive_expsym_cmds
|
adam@0
|
7112 else
|
adam@0
|
7113 eval test_cmds=\"$archive_cmds\"
|
adam@0
|
7114 cmds=$archive_cmds
|
adam@0
|
7115 fi
|
adam@0
|
7116 fi
|
adam@0
|
7117
|
adam@0
|
7118 if test "X$skipped_export" != "X:" &&
|
adam@0
|
7119 func_len " $test_cmds" &&
|
adam@0
|
7120 len=$func_len_result &&
|
adam@0
|
7121 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
|
adam@0
|
7122 :
|
adam@0
|
7123 else
|
adam@0
|
7124 # The command line is too long to link in one step, link piecewise
|
adam@0
|
7125 # or, if using GNU ld and skipped_export is not :, use a linker
|
adam@0
|
7126 # script.
|
adam@0
|
7127
|
adam@0
|
7128 # Save the value of $output and $libobjs because we want to
|
adam@0
|
7129 # use them later. If we have whole_archive_flag_spec, we
|
adam@0
|
7130 # want to use save_libobjs as it was before
|
adam@0
|
7131 # whole_archive_flag_spec was expanded, because we can't
|
adam@0
|
7132 # assume the linker understands whole_archive_flag_spec.
|
adam@0
|
7133 # This may have to be revisited, in case too many
|
adam@0
|
7134 # convenience libraries get linked in and end up exceeding
|
adam@0
|
7135 # the spec.
|
adam@0
|
7136 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
|
adam@0
|
7137 save_libobjs=$libobjs
|
adam@0
|
7138 fi
|
adam@0
|
7139 save_output=$output
|
adam@0
|
7140 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
|
adam@0
|
7141
|
adam@0
|
7142 # Clear the reloadable object creation command queue and
|
adam@0
|
7143 # initialize k to one.
|
adam@0
|
7144 test_cmds=
|
adam@0
|
7145 concat_cmds=
|
adam@0
|
7146 objlist=
|
adam@0
|
7147 last_robj=
|
adam@0
|
7148 k=1
|
adam@0
|
7149
|
adam@0
|
7150 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
|
adam@0
|
7151 output=${output_objdir}/${output_la}.lnkscript
|
adam@0
|
7152 func_verbose "creating GNU ld script: $output"
|
adam@0
|
7153 $ECHO 'INPUT (' > $output
|
adam@0
|
7154 for obj in $save_libobjs
|
adam@0
|
7155 do
|
adam@0
|
7156 $ECHO "$obj" >> $output
|
adam@0
|
7157 done
|
adam@0
|
7158 $ECHO ')' >> $output
|
adam@0
|
7159 delfiles="$delfiles $output"
|
adam@0
|
7160 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
|
adam@0
|
7161 output=${output_objdir}/${output_la}.lnk
|
adam@0
|
7162 func_verbose "creating linker input file list: $output"
|
adam@0
|
7163 : > $output
|
adam@0
|
7164 set x $save_libobjs
|
adam@0
|
7165 shift
|
adam@0
|
7166 firstobj=
|
adam@0
|
7167 if test "$compiler_needs_object" = yes; then
|
adam@0
|
7168 firstobj="$1 "
|
adam@0
|
7169 shift
|
adam@0
|
7170 fi
|
adam@0
|
7171 for obj
|
adam@0
|
7172 do
|
adam@0
|
7173 $ECHO "$obj" >> $output
|
adam@0
|
7174 done
|
adam@0
|
7175 delfiles="$delfiles $output"
|
adam@0
|
7176 output=$firstobj\"$file_list_spec$output\"
|
adam@0
|
7177 else
|
adam@0
|
7178 if test -n "$save_libobjs"; then
|
adam@0
|
7179 func_verbose "creating reloadable object files..."
|
adam@0
|
7180 output=$output_objdir/$output_la-${k}.$objext
|
adam@0
|
7181 eval test_cmds=\"$reload_cmds\"
|
adam@0
|
7182 func_len " $test_cmds"
|
adam@0
|
7183 len0=$func_len_result
|
adam@0
|
7184 len=$len0
|
adam@0
|
7185
|
adam@0
|
7186 # Loop over the list of objects to be linked.
|
adam@0
|
7187 for obj in $save_libobjs
|
adam@0
|
7188 do
|
adam@0
|
7189 func_len " $obj"
|
adam@0
|
7190 func_arith $len + $func_len_result
|
adam@0
|
7191 len=$func_arith_result
|
adam@0
|
7192 if test "X$objlist" = X ||
|
adam@0
|
7193 test "$len" -lt "$max_cmd_len"; then
|
adam@0
|
7194 func_append objlist " $obj"
|
adam@0
|
7195 else
|
adam@0
|
7196 # The command $test_cmds is almost too long, add a
|
adam@0
|
7197 # command to the queue.
|
adam@0
|
7198 if test "$k" -eq 1 ; then
|
adam@0
|
7199 # The first file doesn't have a previous command to add.
|
adam@0
|
7200 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
|
adam@0
|
7201 else
|
adam@0
|
7202 # All subsequent reloadable object files will link in
|
adam@0
|
7203 # the last one created.
|
adam@0
|
7204 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
|
adam@0
|
7205 fi
|
adam@0
|
7206 last_robj=$output_objdir/$output_la-${k}.$objext
|
adam@0
|
7207 func_arith $k + 1
|
adam@0
|
7208 k=$func_arith_result
|
adam@0
|
7209 output=$output_objdir/$output_la-${k}.$objext
|
adam@0
|
7210 objlist=$obj
|
adam@0
|
7211 func_len " $last_robj"
|
adam@0
|
7212 func_arith $len0 + $func_len_result
|
adam@0
|
7213 len=$func_arith_result
|
adam@0
|
7214 fi
|
adam@0
|
7215 done
|
adam@0
|
7216 # Handle the remaining objects by creating one last
|
adam@0
|
7217 # reloadable object file. All subsequent reloadable object
|
adam@0
|
7218 # files will link in the last one created.
|
adam@0
|
7219 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
|
adam@0
|
7220 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
|
adam@0
|
7221 if test -n "$last_robj"; then
|
adam@0
|
7222 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
|
adam@0
|
7223 fi
|
adam@0
|
7224 delfiles="$delfiles $output"
|
adam@0
|
7225
|
adam@0
|
7226 else
|
adam@0
|
7227 output=
|
adam@0
|
7228 fi
|
adam@0
|
7229
|
adam@0
|
7230 if ${skipped_export-false}; then
|
adam@0
|
7231 func_verbose "generating symbol list for \`$libname.la'"
|
adam@0
|
7232 export_symbols="$output_objdir/$libname.exp"
|
adam@0
|
7233 $opt_dry_run || $RM $export_symbols
|
adam@0
|
7234 libobjs=$output
|
adam@0
|
7235 # Append the command to create the export file.
|
adam@0
|
7236 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
|
adam@0
|
7237 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
|
adam@0
|
7238 if test -n "$last_robj"; then
|
adam@0
|
7239 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
|
adam@0
|
7240 fi
|
adam@0
|
7241 fi
|
adam@0
|
7242
|
adam@0
|
7243 test -n "$save_libobjs" &&
|
adam@0
|
7244 func_verbose "creating a temporary reloadable object file: $output"
|
adam@0
|
7245
|
adam@0
|
7246 # Loop through the commands generated above and execute them.
|
adam@0
|
7247 save_ifs="$IFS"; IFS='~'
|
adam@0
|
7248 for cmd in $concat_cmds; do
|
adam@0
|
7249 IFS="$save_ifs"
|
adam@0
|
7250 $opt_silent || {
|
adam@0
|
7251 func_quote_for_expand "$cmd"
|
adam@0
|
7252 eval "func_echo $func_quote_for_expand_result"
|
adam@0
|
7253 }
|
adam@0
|
7254 $opt_dry_run || eval "$cmd" || {
|
adam@0
|
7255 lt_exit=$?
|
adam@0
|
7256
|
adam@0
|
7257 # Restore the uninstalled library and exit
|
adam@0
|
7258 if test "$mode" = relink; then
|
adam@0
|
7259 ( cd "$output_objdir" && \
|
adam@0
|
7260 $RM "${realname}T" && \
|
adam@0
|
7261 $MV "${realname}U" "$realname" )
|
adam@0
|
7262 fi
|
adam@0
|
7263
|
adam@0
|
7264 exit $lt_exit
|
adam@0
|
7265 }
|
adam@0
|
7266 done
|
adam@0
|
7267 IFS="$save_ifs"
|
adam@0
|
7268
|
adam@0
|
7269 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
|
adam@0
|
7270 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
|
adam@0
|
7271 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
|
adam@0
|
7272 fi
|
adam@0
|
7273 fi
|
adam@0
|
7274
|
adam@0
|
7275 if ${skipped_export-false}; then
|
adam@0
|
7276 if test -n "$export_symbols" && test -n "$include_expsyms"; then
|
adam@0
|
7277 tmp_export_symbols="$export_symbols"
|
adam@0
|
7278 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
|
adam@0
|
7279 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
|
adam@0
|
7280 fi
|
adam@0
|
7281
|
adam@0
|
7282 if test -n "$orig_export_symbols"; then
|
adam@0
|
7283 # The given exports_symbols file has to be filtered, so filter it.
|
adam@0
|
7284 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
|
adam@0
|
7285 # FIXME: $output_objdir/$libname.filter potentially contains lots of
|
adam@0
|
7286 # 's' commands which not all seds can handle. GNU sed should be fine
|
adam@0
|
7287 # though. Also, the filter scales superlinearly with the number of
|
adam@0
|
7288 # global variables. join(1) would be nice here, but unfortunately
|
adam@0
|
7289 # isn't a blessed tool.
|
adam@0
|
7290 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
|
adam@0
|
7291 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
|
adam@0
|
7292 export_symbols=$output_objdir/$libname.def
|
adam@0
|
7293 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
|
adam@0
|
7294 fi
|
adam@0
|
7295 fi
|
adam@0
|
7296
|
adam@0
|
7297 libobjs=$output
|
adam@0
|
7298 # Restore the value of output.
|
adam@0
|
7299 output=$save_output
|
adam@0
|
7300
|
adam@0
|
7301 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
|
adam@0
|
7302 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
|
adam@0
|
7303 test "X$libobjs" = "X " && libobjs=
|
adam@0
|
7304 fi
|
adam@0
|
7305 # Expand the library linking commands again to reset the
|
adam@0
|
7306 # value of $libobjs for piecewise linking.
|
adam@0
|
7307
|
adam@0
|
7308 # Do each of the archive commands.
|
adam@0
|
7309 if test "$module" = yes && test -n "$module_cmds" ; then
|
adam@0
|
7310 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
|
adam@0
|
7311 cmds=$module_expsym_cmds
|
adam@0
|
7312 else
|
adam@0
|
7313 cmds=$module_cmds
|
adam@0
|
7314 fi
|
adam@0
|
7315 else
|
adam@0
|
7316 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
|
adam@0
|
7317 cmds=$archive_expsym_cmds
|
adam@0
|
7318 else
|
adam@0
|
7319 cmds=$archive_cmds
|
adam@0
|
7320 fi
|
adam@0
|
7321 fi
|
adam@0
|
7322 fi
|
adam@0
|
7323
|
adam@0
|
7324 if test -n "$delfiles"; then
|
adam@0
|
7325 # Append the command to remove temporary files to $cmds.
|
adam@0
|
7326 eval cmds=\"\$cmds~\$RM $delfiles\"
|
adam@0
|
7327 fi
|
adam@0
|
7328
|
adam@0
|
7329 # Add any objects from preloaded convenience libraries
|
adam@0
|
7330 if test -n "$dlprefiles"; then
|
adam@0
|
7331 gentop="$output_objdir/${outputname}x"
|
adam@0
|
7332 generated="$generated $gentop"
|
adam@0
|
7333
|
adam@0
|
7334 func_extract_archives $gentop $dlprefiles
|
adam@0
|
7335 libobjs="$libobjs $func_extract_archives_result"
|
adam@0
|
7336 test "X$libobjs" = "X " && libobjs=
|
adam@0
|
7337 fi
|
adam@0
|
7338
|
adam@0
|
7339 save_ifs="$IFS"; IFS='~'
|
adam@0
|
7340 for cmd in $cmds; do
|
adam@0
|
7341 IFS="$save_ifs"
|
adam@0
|
7342 eval cmd=\"$cmd\"
|
adam@0
|
7343 $opt_silent || {
|
adam@0
|
7344 func_quote_for_expand "$cmd"
|
adam@0
|
7345 eval "func_echo $func_quote_for_expand_result"
|
adam@0
|
7346 }
|
adam@0
|
7347 $opt_dry_run || eval "$cmd" || {
|
adam@0
|
7348 lt_exit=$?
|
adam@0
|
7349
|
adam@0
|
7350 # Restore the uninstalled library and exit
|
adam@0
|
7351 if test "$mode" = relink; then
|
adam@0
|
7352 ( cd "$output_objdir" && \
|
adam@0
|
7353 $RM "${realname}T" && \
|
adam@0
|
7354 $MV "${realname}U" "$realname" )
|
adam@0
|
7355 fi
|
adam@0
|
7356
|
adam@0
|
7357 exit $lt_exit
|
adam@0
|
7358 }
|
adam@0
|
7359 done
|
adam@0
|
7360 IFS="$save_ifs"
|
adam@0
|
7361
|
adam@0
|
7362 # Restore the uninstalled library and exit
|
adam@0
|
7363 if test "$mode" = relink; then
|
adam@0
|
7364 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
|
adam@0
|
7365
|
adam@0
|
7366 if test -n "$convenience"; then
|
adam@0
|
7367 if test -z "$whole_archive_flag_spec"; then
|
adam@0
|
7368 func_show_eval '${RM}r "$gentop"'
|
adam@0
|
7369 fi
|
adam@0
|
7370 fi
|
adam@0
|
7371
|
adam@0
|
7372 exit $EXIT_SUCCESS
|
adam@0
|
7373 fi
|
adam@0
|
7374
|
adam@0
|
7375 # Create links to the real library.
|
adam@0
|
7376 for linkname in $linknames; do
|
adam@0
|
7377 if test "$realname" != "$linkname"; then
|
adam@0
|
7378 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
|
adam@0
|
7379 fi
|
adam@0
|
7380 done
|
adam@0
|
7381
|
adam@0
|
7382 # If -module or -export-dynamic was specified, set the dlname.
|
adam@0
|
7383 if test "$module" = yes || test "$export_dynamic" = yes; then
|
adam@0
|
7384 # On all known operating systems, these are identical.
|
adam@0
|
7385 dlname="$soname"
|
adam@0
|
7386 fi
|
adam@0
|
7387 fi
|
adam@0
|
7388 ;;
|
adam@0
|
7389
|
adam@0
|
7390 obj)
|
adam@0
|
7391 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
|
adam@0
|
7392 func_warning "\`-dlopen' is ignored for objects"
|
adam@0
|
7393 fi
|
adam@0
|
7394
|
adam@0
|
7395 case " $deplibs" in
|
adam@0
|
7396 *\ -l* | *\ -L*)
|
adam@0
|
7397 func_warning "\`-l' and \`-L' are ignored for objects" ;;
|
adam@0
|
7398 esac
|
adam@0
|
7399
|
adam@0
|
7400 test -n "$rpath" && \
|
adam@0
|
7401 func_warning "\`-rpath' is ignored for objects"
|
adam@0
|
7402
|
adam@0
|
7403 test -n "$xrpath" && \
|
adam@0
|
7404 func_warning "\`-R' is ignored for objects"
|
adam@0
|
7405
|
adam@0
|
7406 test -n "$vinfo" && \
|
adam@0
|
7407 func_warning "\`-version-info' is ignored for objects"
|
adam@0
|
7408
|
adam@0
|
7409 test -n "$release" && \
|
adam@0
|
7410 func_warning "\`-release' is ignored for objects"
|
adam@0
|
7411
|
adam@0
|
7412 case $output in
|
adam@0
|
7413 *.lo)
|
adam@0
|
7414 test -n "$objs$old_deplibs" && \
|
adam@0
|
7415 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
|
adam@0
|
7416
|
adam@0
|
7417 libobj=$output
|
adam@0
|
7418 func_lo2o "$libobj"
|
adam@0
|
7419 obj=$func_lo2o_result
|
adam@0
|
7420 ;;
|
adam@0
|
7421 *)
|
adam@0
|
7422 libobj=
|
adam@0
|
7423 obj="$output"
|
adam@0
|
7424 ;;
|
adam@0
|
7425 esac
|
adam@0
|
7426
|
adam@0
|
7427 # Delete the old objects.
|
adam@0
|
7428 $opt_dry_run || $RM $obj $libobj
|
adam@0
|
7429
|
adam@0
|
7430 # Objects from convenience libraries. This assumes
|
adam@0
|
7431 # single-version convenience libraries. Whenever we create
|
adam@0
|
7432 # different ones for PIC/non-PIC, this we'll have to duplicate
|
adam@0
|
7433 # the extraction.
|
adam@0
|
7434 reload_conv_objs=
|
adam@0
|
7435 gentop=
|
adam@0
|
7436 # reload_cmds runs $LD directly, so let us get rid of
|
adam@0
|
7437 # -Wl from whole_archive_flag_spec and hope we can get by with
|
adam@0
|
7438 # turning comma into space..
|
adam@0
|
7439 wl=
|
adam@0
|
7440
|
adam@0
|
7441 if test -n "$convenience"; then
|
adam@0
|
7442 if test -n "$whole_archive_flag_spec"; then
|
adam@0
|
7443 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
|
adam@0
|
7444 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
|
adam@0
|
7445 else
|
adam@0
|
7446 gentop="$output_objdir/${obj}x"
|
adam@0
|
7447 generated="$generated $gentop"
|
adam@0
|
7448
|
adam@0
|
7449 func_extract_archives $gentop $convenience
|
adam@0
|
7450 reload_conv_objs="$reload_objs $func_extract_archives_result"
|
adam@0
|
7451 fi
|
adam@0
|
7452 fi
|
adam@0
|
7453
|
adam@0
|
7454 # Create the old-style object.
|
adam@0
|
7455 reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
|
adam@0
|
7456
|
adam@0
|
7457 output="$obj"
|
adam@0
|
7458 func_execute_cmds "$reload_cmds" 'exit $?'
|
adam@0
|
7459
|
adam@0
|
7460 # Exit if we aren't doing a library object file.
|
adam@0
|
7461 if test -z "$libobj"; then
|
adam@0
|
7462 if test -n "$gentop"; then
|
adam@0
|
7463 func_show_eval '${RM}r "$gentop"'
|
adam@0
|
7464 fi
|
adam@0
|
7465
|
adam@0
|
7466 exit $EXIT_SUCCESS
|
adam@0
|
7467 fi
|
adam@0
|
7468
|
adam@0
|
7469 if test "$build_libtool_libs" != yes; then
|
adam@0
|
7470 if test -n "$gentop"; then
|
adam@0
|
7471 func_show_eval '${RM}r "$gentop"'
|
adam@0
|
7472 fi
|
adam@0
|
7473
|
adam@0
|
7474 # Create an invalid libtool object if no PIC, so that we don't
|
adam@0
|
7475 # accidentally link it into a program.
|
adam@0
|
7476 # $show "echo timestamp > $libobj"
|
adam@0
|
7477 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
|
adam@0
|
7478 exit $EXIT_SUCCESS
|
adam@0
|
7479 fi
|
adam@0
|
7480
|
adam@0
|
7481 if test -n "$pic_flag" || test "$pic_mode" != default; then
|
adam@0
|
7482 # Only do commands if we really have different PIC objects.
|
adam@0
|
7483 reload_objs="$libobjs $reload_conv_objs"
|
adam@0
|
7484 output="$libobj"
|
adam@0
|
7485 func_execute_cmds "$reload_cmds" 'exit $?'
|
adam@0
|
7486 fi
|
adam@0
|
7487
|
adam@0
|
7488 if test -n "$gentop"; then
|
adam@0
|
7489 func_show_eval '${RM}r "$gentop"'
|
adam@0
|
7490 fi
|
adam@0
|
7491
|
adam@0
|
7492 exit $EXIT_SUCCESS
|
adam@0
|
7493 ;;
|
adam@0
|
7494
|
adam@0
|
7495 prog)
|
adam@0
|
7496 case $host in
|
adam@0
|
7497 *cygwin*) func_stripname '' '.exe' "$output"
|
adam@0
|
7498 output=$func_stripname_result.exe;;
|
adam@0
|
7499 esac
|
adam@0
|
7500 test -n "$vinfo" && \
|
adam@0
|
7501 func_warning "\`-version-info' is ignored for programs"
|
adam@0
|
7502
|
adam@0
|
7503 test -n "$release" && \
|
adam@0
|
7504 func_warning "\`-release' is ignored for programs"
|
adam@0
|
7505
|
adam@0
|
7506 test "$preload" = yes \
|
adam@0
|
7507 && test "$dlopen_support" = unknown \
|
adam@0
|
7508 && test "$dlopen_self" = unknown \
|
adam@0
|
7509 && test "$dlopen_self_static" = unknown && \
|
adam@0
|
7510 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
|
adam@0
|
7511
|
adam@0
|
7512 case $host in
|
adam@0
|
7513 *-*-rhapsody* | *-*-darwin1.[012])
|
adam@0
|
7514 # On Rhapsody replace the C library is the System framework
|
adam@0
|
7515 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
|
adam@0
|
7516 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
|
adam@0
|
7517 ;;
|
adam@0
|
7518 esac
|
adam@0
|
7519
|
adam@0
|
7520 case $host in
|
adam@0
|
7521 *-*-darwin*)
|
adam@0
|
7522 # Don't allow lazy linking, it breaks C++ global constructors
|
adam@0
|
7523 # But is supposedly fixed on 10.4 or later (yay!).
|
adam@0
|
7524 if test "$tagname" = CXX ; then
|
adam@0
|
7525 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
|
adam@0
|
7526 10.[0123])
|
adam@0
|
7527 compile_command="$compile_command ${wl}-bind_at_load"
|
adam@0
|
7528 finalize_command="$finalize_command ${wl}-bind_at_load"
|
adam@0
|
7529 ;;
|
adam@0
|
7530 esac
|
adam@0
|
7531 fi
|
adam@0
|
7532 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
|
adam@0
|
7533 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
adam@0
|
7534 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
adam@0
|
7535 ;;
|
adam@0
|
7536 esac
|
adam@0
|
7537
|
adam@0
|
7538
|
adam@0
|
7539 # move library search paths that coincide with paths to not yet
|
adam@0
|
7540 # installed libraries to the beginning of the library search list
|
adam@0
|
7541 new_libs=
|
adam@0
|
7542 for path in $notinst_path; do
|
adam@0
|
7543 case " $new_libs " in
|
adam@0
|
7544 *" -L$path/$objdir "*) ;;
|
adam@0
|
7545 *)
|
adam@0
|
7546 case " $compile_deplibs " in
|
adam@0
|
7547 *" -L$path/$objdir "*)
|
adam@0
|
7548 new_libs="$new_libs -L$path/$objdir" ;;
|
adam@0
|
7549 esac
|
adam@0
|
7550 ;;
|
adam@0
|
7551 esac
|
adam@0
|
7552 done
|
adam@0
|
7553 for deplib in $compile_deplibs; do
|
adam@0
|
7554 case $deplib in
|
adam@0
|
7555 -L*)
|
adam@0
|
7556 case " $new_libs " in
|
adam@0
|
7557 *" $deplib "*) ;;
|
adam@0
|
7558 *) new_libs="$new_libs $deplib" ;;
|
adam@0
|
7559 esac
|
adam@0
|
7560 ;;
|
adam@0
|
7561 *) new_libs="$new_libs $deplib" ;;
|
adam@0
|
7562 esac
|
adam@0
|
7563 done
|
adam@0
|
7564 compile_deplibs="$new_libs"
|
adam@0
|
7565
|
adam@0
|
7566
|
adam@0
|
7567 compile_command="$compile_command $compile_deplibs"
|
adam@0
|
7568 finalize_command="$finalize_command $finalize_deplibs"
|
adam@0
|
7569
|
adam@0
|
7570 if test -n "$rpath$xrpath"; then
|
adam@0
|
7571 # If the user specified any rpath flags, then add them.
|
adam@0
|
7572 for libdir in $rpath $xrpath; do
|
adam@0
|
7573 # This is the magic to use -rpath.
|
adam@0
|
7574 case "$finalize_rpath " in
|
adam@0
|
7575 *" $libdir "*) ;;
|
adam@0
|
7576 *) finalize_rpath="$finalize_rpath $libdir" ;;
|
adam@0
|
7577 esac
|
adam@0
|
7578 done
|
adam@0
|
7579 fi
|
adam@0
|
7580
|
adam@0
|
7581 # Now hardcode the library paths
|
adam@0
|
7582 rpath=
|
adam@0
|
7583 hardcode_libdirs=
|
adam@0
|
7584 for libdir in $compile_rpath $finalize_rpath; do
|
adam@0
|
7585 if test -n "$hardcode_libdir_flag_spec"; then
|
adam@0
|
7586 if test -n "$hardcode_libdir_separator"; then
|
adam@0
|
7587 if test -z "$hardcode_libdirs"; then
|
adam@0
|
7588 hardcode_libdirs="$libdir"
|
adam@0
|
7589 else
|
adam@0
|
7590 # Just accumulate the unique libdirs.
|
adam@0
|
7591 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
|
adam@0
|
7592 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
|
adam@0
|
7593 ;;
|
adam@0
|
7594 *)
|
adam@0
|
7595 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
|
adam@0
|
7596 ;;
|
adam@0
|
7597 esac
|
adam@0
|
7598 fi
|
adam@0
|
7599 else
|
adam@0
|
7600 eval flag=\"$hardcode_libdir_flag_spec\"
|
adam@0
|
7601 rpath="$rpath $flag"
|
adam@0
|
7602 fi
|
adam@0
|
7603 elif test -n "$runpath_var"; then
|
adam@0
|
7604 case "$perm_rpath " in
|
adam@0
|
7605 *" $libdir "*) ;;
|
adam@0
|
7606 *) perm_rpath="$perm_rpath $libdir" ;;
|
adam@0
|
7607 esac
|
adam@0
|
7608 fi
|
adam@0
|
7609 case $host in
|
adam@0
|
7610 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
adam@0
|
7611 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
|
adam@0
|
7612 case :$dllsearchpath: in
|
adam@0
|
7613 *":$libdir:"*) ;;
|
adam@0
|
7614 ::) dllsearchpath=$libdir;;
|
adam@0
|
7615 *) dllsearchpath="$dllsearchpath:$libdir";;
|
adam@0
|
7616 esac
|
adam@0
|
7617 case :$dllsearchpath: in
|
adam@0
|
7618 *":$testbindir:"*) ;;
|
adam@0
|
7619 ::) dllsearchpath=$testbindir;;
|
adam@0
|
7620 *) dllsearchpath="$dllsearchpath:$testbindir";;
|
adam@0
|
7621 esac
|
adam@0
|
7622 ;;
|
adam@0
|
7623 esac
|
adam@0
|
7624 done
|
adam@0
|
7625 # Substitute the hardcoded libdirs into the rpath.
|
adam@0
|
7626 if test -n "$hardcode_libdir_separator" &&
|
adam@0
|
7627 test -n "$hardcode_libdirs"; then
|
adam@0
|
7628 libdir="$hardcode_libdirs"
|
adam@0
|
7629 eval rpath=\" $hardcode_libdir_flag_spec\"
|
adam@0
|
7630 fi
|
adam@0
|
7631 compile_rpath="$rpath"
|
adam@0
|
7632
|
adam@0
|
7633 rpath=
|
adam@0
|
7634 hardcode_libdirs=
|
adam@0
|
7635 for libdir in $finalize_rpath; do
|
adam@0
|
7636 if test -n "$hardcode_libdir_flag_spec"; then
|
adam@0
|
7637 if test -n "$hardcode_libdir_separator"; then
|
adam@0
|
7638 if test -z "$hardcode_libdirs"; then
|
adam@0
|
7639 hardcode_libdirs="$libdir"
|
adam@0
|
7640 else
|
adam@0
|
7641 # Just accumulate the unique libdirs.
|
adam@0
|
7642 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
|
adam@0
|
7643 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
|
adam@0
|
7644 ;;
|
adam@0
|
7645 *)
|
adam@0
|
7646 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
|
adam@0
|
7647 ;;
|
adam@0
|
7648 esac
|
adam@0
|
7649 fi
|
adam@0
|
7650 else
|
adam@0
|
7651 eval flag=\"$hardcode_libdir_flag_spec\"
|
adam@0
|
7652 rpath="$rpath $flag"
|
adam@0
|
7653 fi
|
adam@0
|
7654 elif test -n "$runpath_var"; then
|
adam@0
|
7655 case "$finalize_perm_rpath " in
|
adam@0
|
7656 *" $libdir "*) ;;
|
adam@0
|
7657 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
|
adam@0
|
7658 esac
|
adam@0
|
7659 fi
|
adam@0
|
7660 done
|
adam@0
|
7661 # Substitute the hardcoded libdirs into the rpath.
|
adam@0
|
7662 if test -n "$hardcode_libdir_separator" &&
|
adam@0
|
7663 test -n "$hardcode_libdirs"; then
|
adam@0
|
7664 libdir="$hardcode_libdirs"
|
adam@0
|
7665 eval rpath=\" $hardcode_libdir_flag_spec\"
|
adam@0
|
7666 fi
|
adam@0
|
7667 finalize_rpath="$rpath"
|
adam@0
|
7668
|
adam@0
|
7669 if test -n "$libobjs" && test "$build_old_libs" = yes; then
|
adam@0
|
7670 # Transform all the library objects into standard objects.
|
adam@0
|
7671 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
|
adam@0
|
7672 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
|
adam@0
|
7673 fi
|
adam@0
|
7674
|
adam@0
|
7675 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
|
adam@0
|
7676
|
adam@0
|
7677 # template prelinking step
|
adam@0
|
7678 if test -n "$prelink_cmds"; then
|
adam@0
|
7679 func_execute_cmds "$prelink_cmds" 'exit $?'
|
adam@0
|
7680 fi
|
adam@0
|
7681
|
adam@0
|
7682 wrappers_required=yes
|
adam@0
|
7683 case $host in
|
adam@0
|
7684 *cygwin* | *mingw* )
|
adam@0
|
7685 if test "$build_libtool_libs" != yes; then
|
adam@0
|
7686 wrappers_required=no
|
adam@0
|
7687 fi
|
adam@0
|
7688 ;;
|
adam@0
|
7689 *cegcc)
|
adam@0
|
7690 # Disable wrappers for cegcc, we are cross compiling anyway.
|
adam@0
|
7691 wrappers_required=no
|
adam@0
|
7692 ;;
|
adam@0
|
7693 *)
|
adam@0
|
7694 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
|
adam@0
|
7695 wrappers_required=no
|
adam@0
|
7696 fi
|
adam@0
|
7697 ;;
|
adam@0
|
7698 esac
|
adam@0
|
7699 if test "$wrappers_required" = no; then
|
adam@0
|
7700 # Replace the output file specification.
|
adam@0
|
7701 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
|
adam@0
|
7702 link_command="$compile_command$compile_rpath"
|
adam@0
|
7703
|
adam@0
|
7704 # We have no uninstalled library dependencies, so finalize right now.
|
adam@0
|
7705 exit_status=0
|
adam@0
|
7706 func_show_eval "$link_command" 'exit_status=$?'
|
adam@0
|
7707
|
adam@0
|
7708 # Delete the generated files.
|
adam@0
|
7709 if test -f "$output_objdir/${outputname}S.${objext}"; then
|
adam@0
|
7710 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
|
adam@0
|
7711 fi
|
adam@0
|
7712
|
adam@0
|
7713 exit $exit_status
|
adam@0
|
7714 fi
|
adam@0
|
7715
|
adam@0
|
7716 if test -n "$compile_shlibpath$finalize_shlibpath"; then
|
adam@0
|
7717 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
|
adam@0
|
7718 fi
|
adam@0
|
7719 if test -n "$finalize_shlibpath"; then
|
adam@0
|
7720 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
|
adam@0
|
7721 fi
|
adam@0
|
7722
|
adam@0
|
7723 compile_var=
|
adam@0
|
7724 finalize_var=
|
adam@0
|
7725 if test -n "$runpath_var"; then
|
adam@0
|
7726 if test -n "$perm_rpath"; then
|
adam@0
|
7727 # We should set the runpath_var.
|
adam@0
|
7728 rpath=
|
adam@0
|
7729 for dir in $perm_rpath; do
|
adam@0
|
7730 rpath="$rpath$dir:"
|
adam@0
|
7731 done
|
adam@0
|
7732 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
|
adam@0
|
7733 fi
|
adam@0
|
7734 if test -n "$finalize_perm_rpath"; then
|
adam@0
|
7735 # We should set the runpath_var.
|
adam@0
|
7736 rpath=
|
adam@0
|
7737 for dir in $finalize_perm_rpath; do
|
adam@0
|
7738 rpath="$rpath$dir:"
|
adam@0
|
7739 done
|
adam@0
|
7740 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
|
adam@0
|
7741 fi
|
adam@0
|
7742 fi
|
adam@0
|
7743
|
adam@0
|
7744 if test "$no_install" = yes; then
|
adam@0
|
7745 # We don't need to create a wrapper script.
|
adam@0
|
7746 link_command="$compile_var$compile_command$compile_rpath"
|
adam@0
|
7747 # Replace the output file specification.
|
adam@0
|
7748 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
|
adam@0
|
7749 # Delete the old output file.
|
adam@0
|
7750 $opt_dry_run || $RM $output
|
adam@0
|
7751 # Link the executable and exit
|
adam@0
|
7752 func_show_eval "$link_command" 'exit $?'
|
adam@0
|
7753 exit $EXIT_SUCCESS
|
adam@0
|
7754 fi
|
adam@0
|
7755
|
adam@0
|
7756 if test "$hardcode_action" = relink; then
|
adam@0
|
7757 # Fast installation is not supported
|
adam@0
|
7758 link_command="$compile_var$compile_command$compile_rpath"
|
adam@0
|
7759 relink_command="$finalize_var$finalize_command$finalize_rpath"
|
adam@0
|
7760
|
adam@0
|
7761 func_warning "this platform does not like uninstalled shared libraries"
|
adam@0
|
7762 func_warning "\`$output' will be relinked during installation"
|
adam@0
|
7763 else
|
adam@0
|
7764 if test "$fast_install" != no; then
|
adam@0
|
7765 link_command="$finalize_var$compile_command$finalize_rpath"
|
adam@0
|
7766 if test "$fast_install" = yes; then
|
adam@0
|
7767 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
|
adam@0
|
7768 else
|
adam@0
|
7769 # fast_install is set to needless
|
adam@0
|
7770 relink_command=
|
adam@0
|
7771 fi
|
adam@0
|
7772 else
|
adam@0
|
7773 link_command="$compile_var$compile_command$compile_rpath"
|
adam@0
|
7774 relink_command="$finalize_var$finalize_command$finalize_rpath"
|
adam@0
|
7775 fi
|
adam@0
|
7776 fi
|
adam@0
|
7777
|
adam@0
|
7778 # Replace the output file specification.
|
adam@0
|
7779 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
|
adam@0
|
7780
|
adam@0
|
7781 # Delete the old output files.
|
adam@0
|
7782 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
|
adam@0
|
7783
|
adam@0
|
7784 func_show_eval "$link_command" 'exit $?'
|
adam@0
|
7785
|
adam@0
|
7786 # Now create the wrapper script.
|
adam@0
|
7787 func_verbose "creating $output"
|
adam@0
|
7788
|
adam@0
|
7789 # Quote the relink command for shipping.
|
adam@0
|
7790 if test -n "$relink_command"; then
|
adam@0
|
7791 # Preserve any variables that may affect compiler behavior
|
adam@0
|
7792 for var in $variables_saved_for_relink; do
|
adam@0
|
7793 if eval test -z \"\${$var+set}\"; then
|
adam@0
|
7794 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
|
adam@0
|
7795 elif eval var_value=\$$var; test -z "$var_value"; then
|
adam@0
|
7796 relink_command="$var=; export $var; $relink_command"
|
adam@0
|
7797 else
|
adam@0
|
7798 func_quote_for_eval "$var_value"
|
adam@0
|
7799 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
|
adam@0
|
7800 fi
|
adam@0
|
7801 done
|
adam@0
|
7802 relink_command="(cd `pwd`; $relink_command)"
|
adam@0
|
7803 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
|
adam@0
|
7804 fi
|
adam@0
|
7805
|
adam@0
|
7806 # Quote $ECHO for shipping.
|
adam@0
|
7807 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
|
adam@0
|
7808 case $progpath in
|
adam@0
|
7809 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
|
adam@0
|
7810 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
|
adam@0
|
7811 esac
|
adam@0
|
7812 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
|
adam@0
|
7813 else
|
adam@0
|
7814 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
|
adam@0
|
7815 fi
|
adam@0
|
7816
|
adam@0
|
7817 # Only actually do things if not in dry run mode.
|
adam@0
|
7818 $opt_dry_run || {
|
adam@0
|
7819 # win32 will think the script is a binary if it has
|
adam@0
|
7820 # a .exe suffix, so we strip it off here.
|
adam@0
|
7821 case $output in
|
adam@0
|
7822 *.exe) func_stripname '' '.exe' "$output"
|
adam@0
|
7823 output=$func_stripname_result ;;
|
adam@0
|
7824 esac
|
adam@0
|
7825 # test for cygwin because mv fails w/o .exe extensions
|
adam@0
|
7826 case $host in
|
adam@0
|
7827 *cygwin*)
|
adam@0
|
7828 exeext=.exe
|
adam@0
|
7829 func_stripname '' '.exe' "$outputname"
|
adam@0
|
7830 outputname=$func_stripname_result ;;
|
adam@0
|
7831 *) exeext= ;;
|
adam@0
|
7832 esac
|
adam@0
|
7833 case $host in
|
adam@0
|
7834 *cygwin* | *mingw* )
|
adam@0
|
7835 func_dirname_and_basename "$output" "" "."
|
adam@0
|
7836 output_name=$func_basename_result
|
adam@0
|
7837 output_path=$func_dirname_result
|
adam@0
|
7838 cwrappersource="$output_path/$objdir/lt-$output_name.c"
|
adam@0
|
7839 cwrapper="$output_path/$output_name.exe"
|
adam@0
|
7840 $RM $cwrappersource $cwrapper
|
adam@0
|
7841 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
|
adam@0
|
7842
|
adam@0
|
7843 func_emit_cwrapperexe_src > $cwrappersource
|
adam@0
|
7844
|
adam@0
|
7845 # The wrapper executable is built using the $host compiler,
|
adam@0
|
7846 # because it contains $host paths and files. If cross-
|
adam@0
|
7847 # compiling, it, like the target executable, must be
|
adam@0
|
7848 # executed on the $host or under an emulation environment.
|
adam@0
|
7849 $opt_dry_run || {
|
adam@0
|
7850 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
|
adam@0
|
7851 $STRIP $cwrapper
|
adam@0
|
7852 }
|
adam@0
|
7853
|
adam@0
|
7854 # Now, create the wrapper script for func_source use:
|
adam@0
|
7855 func_ltwrapper_scriptname $cwrapper
|
adam@0
|
7856 $RM $func_ltwrapper_scriptname_result
|
adam@0
|
7857 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
|
adam@0
|
7858 $opt_dry_run || {
|
adam@0
|
7859 # note: this script will not be executed, so do not chmod.
|
adam@0
|
7860 if test "x$build" = "x$host" ; then
|
adam@0
|
7861 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
|
adam@0
|
7862 else
|
adam@0
|
7863 func_emit_wrapper no > $func_ltwrapper_scriptname_result
|
adam@0
|
7864 fi
|
adam@0
|
7865 }
|
adam@0
|
7866 ;;
|
adam@0
|
7867 * )
|
adam@0
|
7868 $RM $output
|
adam@0
|
7869 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
|
adam@0
|
7870
|
adam@0
|
7871 func_emit_wrapper no > $output
|
adam@0
|
7872 chmod +x $output
|
adam@0
|
7873 ;;
|
adam@0
|
7874 esac
|
adam@0
|
7875 }
|
adam@0
|
7876 exit $EXIT_SUCCESS
|
adam@0
|
7877 ;;
|
adam@0
|
7878 esac
|
adam@0
|
7879
|
adam@0
|
7880 # See if we need to build an old-fashioned archive.
|
adam@0
|
7881 for oldlib in $oldlibs; do
|
adam@0
|
7882
|
adam@0
|
7883 if test "$build_libtool_libs" = convenience; then
|
adam@0
|
7884 oldobjs="$libobjs_save $symfileobj"
|
adam@0
|
7885 addlibs="$convenience"
|
adam@0
|
7886 build_libtool_libs=no
|
adam@0
|
7887 else
|
adam@0
|
7888 if test "$build_libtool_libs" = module; then
|
adam@0
|
7889 oldobjs="$libobjs_save"
|
adam@0
|
7890 build_libtool_libs=no
|
adam@0
|
7891 else
|
adam@0
|
7892 oldobjs="$old_deplibs $non_pic_objects"
|
adam@0
|
7893 if test "$preload" = yes && test -f "$symfileobj"; then
|
adam@0
|
7894 oldobjs="$oldobjs $symfileobj"
|
adam@0
|
7895 fi
|
adam@0
|
7896 fi
|
adam@0
|
7897 addlibs="$old_convenience"
|
adam@0
|
7898 fi
|
adam@0
|
7899
|
adam@0
|
7900 if test -n "$addlibs"; then
|
adam@0
|
7901 gentop="$output_objdir/${outputname}x"
|
adam@0
|
7902 generated="$generated $gentop"
|
adam@0
|
7903
|
adam@0
|
7904 func_extract_archives $gentop $addlibs
|
adam@0
|
7905 oldobjs="$oldobjs $func_extract_archives_result"
|
adam@0
|
7906 fi
|
adam@0
|
7907
|
adam@0
|
7908 # Do each command in the archive commands.
|
adam@0
|
7909 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
|
adam@0
|
7910 cmds=$old_archive_from_new_cmds
|
adam@0
|
7911 else
|
adam@0
|
7912
|
adam@0
|
7913 # Add any objects from preloaded convenience libraries
|
adam@0
|
7914 if test -n "$dlprefiles"; then
|
adam@0
|
7915 gentop="$output_objdir/${outputname}x"
|
adam@0
|
7916 generated="$generated $gentop"
|
adam@0
|
7917
|
adam@0
|
7918 func_extract_archives $gentop $dlprefiles
|
adam@0
|
7919 oldobjs="$oldobjs $func_extract_archives_result"
|
adam@0
|
7920 fi
|
adam@0
|
7921
|
adam@0
|
7922 # POSIX demands no paths to be encoded in archives. We have
|
adam@0
|
7923 # to avoid creating archives with duplicate basenames if we
|
adam@0
|
7924 # might have to extract them afterwards, e.g., when creating a
|
adam@0
|
7925 # static archive out of a convenience library, or when linking
|
adam@0
|
7926 # the entirety of a libtool archive into another (currently
|
adam@0
|
7927 # not supported by libtool).
|
adam@0
|
7928 if (for obj in $oldobjs
|
adam@0
|
7929 do
|
adam@0
|
7930 func_basename "$obj"
|
adam@0
|
7931 $ECHO "$func_basename_result"
|
adam@0
|
7932 done | sort | sort -uc >/dev/null 2>&1); then
|
adam@0
|
7933 :
|
adam@0
|
7934 else
|
adam@0
|
7935 $ECHO "copying selected object files to avoid basename conflicts..."
|
adam@0
|
7936 gentop="$output_objdir/${outputname}x"
|
adam@0
|
7937 generated="$generated $gentop"
|
adam@0
|
7938 func_mkdir_p "$gentop"
|
adam@0
|
7939 save_oldobjs=$oldobjs
|
adam@0
|
7940 oldobjs=
|
adam@0
|
7941 counter=1
|
adam@0
|
7942 for obj in $save_oldobjs
|
adam@0
|
7943 do
|
adam@0
|
7944 func_basename "$obj"
|
adam@0
|
7945 objbase="$func_basename_result"
|
adam@0
|
7946 case " $oldobjs " in
|
adam@0
|
7947 " ") oldobjs=$obj ;;
|
adam@0
|
7948 *[\ /]"$objbase "*)
|
adam@0
|
7949 while :; do
|
adam@0
|
7950 # Make sure we don't pick an alternate name that also
|
adam@0
|
7951 # overlaps.
|
adam@0
|
7952 newobj=lt$counter-$objbase
|
adam@0
|
7953 func_arith $counter + 1
|
adam@0
|
7954 counter=$func_arith_result
|
adam@0
|
7955 case " $oldobjs " in
|
adam@0
|
7956 *[\ /]"$newobj "*) ;;
|
adam@0
|
7957 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
|
adam@0
|
7958 esac
|
adam@0
|
7959 done
|
adam@0
|
7960 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
|
adam@0
|
7961 oldobjs="$oldobjs $gentop/$newobj"
|
adam@0
|
7962 ;;
|
adam@0
|
7963 *) oldobjs="$oldobjs $obj" ;;
|
adam@0
|
7964 esac
|
adam@0
|
7965 done
|
adam@0
|
7966 fi
|
adam@0
|
7967 eval cmds=\"$old_archive_cmds\"
|
adam@0
|
7968
|
adam@0
|
7969 func_len " $cmds"
|
adam@0
|
7970 len=$func_len_result
|
adam@0
|
7971 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
|
adam@0
|
7972 cmds=$old_archive_cmds
|
adam@0
|
7973 else
|
adam@0
|
7974 # the command line is too long to link in one step, link in parts
|
adam@0
|
7975 func_verbose "using piecewise archive linking..."
|
adam@0
|
7976 save_RANLIB=$RANLIB
|
adam@0
|
7977 RANLIB=:
|
adam@0
|
7978 objlist=
|
adam@0
|
7979 concat_cmds=
|
adam@0
|
7980 save_oldobjs=$oldobjs
|
adam@0
|
7981 oldobjs=
|
adam@0
|
7982 # Is there a better way of finding the last object in the list?
|
adam@0
|
7983 for obj in $save_oldobjs
|
adam@0
|
7984 do
|
adam@0
|
7985 last_oldobj=$obj
|
adam@0
|
7986 done
|
adam@0
|
7987 eval test_cmds=\"$old_archive_cmds\"
|
adam@0
|
7988 func_len " $test_cmds"
|
adam@0
|
7989 len0=$func_len_result
|
adam@0
|
7990 len=$len0
|
adam@0
|
7991 for obj in $save_oldobjs
|
adam@0
|
7992 do
|
adam@0
|
7993 func_len " $obj"
|
adam@0
|
7994 func_arith $len + $func_len_result
|
adam@0
|
7995 len=$func_arith_result
|
adam@0
|
7996 func_append objlist " $obj"
|
adam@0
|
7997 if test "$len" -lt "$max_cmd_len"; then
|
adam@0
|
7998 :
|
adam@0
|
7999 else
|
adam@0
|
8000 # the above command should be used before it gets too long
|
adam@0
|
8001 oldobjs=$objlist
|
adam@0
|
8002 if test "$obj" = "$last_oldobj" ; then
|
adam@0
|
8003 RANLIB=$save_RANLIB
|
adam@0
|
8004 fi
|
adam@0
|
8005 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
|
adam@0
|
8006 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
|
adam@0
|
8007 objlist=
|
adam@0
|
8008 len=$len0
|
adam@0
|
8009 fi
|
adam@0
|
8010 done
|
adam@0
|
8011 RANLIB=$save_RANLIB
|
adam@0
|
8012 oldobjs=$objlist
|
adam@0
|
8013 if test "X$oldobjs" = "X" ; then
|
adam@0
|
8014 eval cmds=\"\$concat_cmds\"
|
adam@0
|
8015 else
|
adam@0
|
8016 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
|
adam@0
|
8017 fi
|
adam@0
|
8018 fi
|
adam@0
|
8019 fi
|
adam@0
|
8020 func_execute_cmds "$cmds" 'exit $?'
|
adam@0
|
8021 done
|
adam@0
|
8022
|
adam@0
|
8023 test -n "$generated" && \
|
adam@0
|
8024 func_show_eval "${RM}r$generated"
|
adam@0
|
8025
|
adam@0
|
8026 # Now create the libtool archive.
|
adam@0
|
8027 case $output in
|
adam@0
|
8028 *.la)
|
adam@0
|
8029 old_library=
|
adam@0
|
8030 test "$build_old_libs" = yes && old_library="$libname.$libext"
|
adam@0
|
8031 func_verbose "creating $output"
|
adam@0
|
8032
|
adam@0
|
8033 # Preserve any variables that may affect compiler behavior
|
adam@0
|
8034 for var in $variables_saved_for_relink; do
|
adam@0
|
8035 if eval test -z \"\${$var+set}\"; then
|
adam@0
|
8036 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
|
adam@0
|
8037 elif eval var_value=\$$var; test -z "$var_value"; then
|
adam@0
|
8038 relink_command="$var=; export $var; $relink_command"
|
adam@0
|
8039 else
|
adam@0
|
8040 func_quote_for_eval "$var_value"
|
adam@0
|
8041 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
|
adam@0
|
8042 fi
|
adam@0
|
8043 done
|
adam@0
|
8044 # Quote the link command for shipping.
|
adam@0
|
8045 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
|
adam@0
|
8046 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
|
adam@0
|
8047 if test "$hardcode_automatic" = yes ; then
|
adam@0
|
8048 relink_command=
|
adam@0
|
8049 fi
|
adam@0
|
8050
|
adam@0
|
8051 # Only create the output if not a dry run.
|
adam@0
|
8052 $opt_dry_run || {
|
adam@0
|
8053 for installed in no yes; do
|
adam@0
|
8054 if test "$installed" = yes; then
|
adam@0
|
8055 if test -z "$install_libdir"; then
|
adam@0
|
8056 break
|
adam@0
|
8057 fi
|
adam@0
|
8058 output="$output_objdir/$outputname"i
|
adam@0
|
8059 # Replace all uninstalled libtool libraries with the installed ones
|
adam@0
|
8060 newdependency_libs=
|
adam@0
|
8061 for deplib in $dependency_libs; do
|
adam@0
|
8062 case $deplib in
|
adam@0
|
8063 *.la)
|
adam@0
|
8064 func_basename "$deplib"
|
adam@0
|
8065 name="$func_basename_result"
|
adam@0
|
8066 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
|
adam@0
|
8067 test -z "$libdir" && \
|
adam@0
|
8068 func_fatal_error "\`$deplib' is not a valid libtool archive"
|
adam@0
|
8069 newdependency_libs="$newdependency_libs $libdir/$name"
|
adam@0
|
8070 ;;
|
adam@0
|
8071 *) newdependency_libs="$newdependency_libs $deplib" ;;
|
adam@0
|
8072 esac
|
adam@0
|
8073 done
|
adam@0
|
8074 dependency_libs="$newdependency_libs"
|
adam@0
|
8075 newdlfiles=
|
adam@0
|
8076
|
adam@0
|
8077 for lib in $dlfiles; do
|
adam@0
|
8078 case $lib in
|
adam@0
|
8079 *.la)
|
adam@0
|
8080 func_basename "$lib"
|
adam@0
|
8081 name="$func_basename_result"
|
adam@0
|
8082 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
|
adam@0
|
8083 test -z "$libdir" && \
|
adam@0
|
8084 func_fatal_error "\`$lib' is not a valid libtool archive"
|
adam@0
|
8085 newdlfiles="$newdlfiles $libdir/$name"
|
adam@0
|
8086 ;;
|
adam@0
|
8087 *) newdlfiles="$newdlfiles $lib" ;;
|
adam@0
|
8088 esac
|
adam@0
|
8089 done
|
adam@0
|
8090 dlfiles="$newdlfiles"
|
adam@0
|
8091 newdlprefiles=
|
adam@0
|
8092 for lib in $dlprefiles; do
|
adam@0
|
8093 case $lib in
|
adam@0
|
8094 *.la)
|
adam@0
|
8095 # Only pass preopened files to the pseudo-archive (for
|
adam@0
|
8096 # eventual linking with the app. that links it) if we
|
adam@0
|
8097 # didn't already link the preopened objects directly into
|
adam@0
|
8098 # the library:
|
adam@0
|
8099 func_basename "$lib"
|
adam@0
|
8100 name="$func_basename_result"
|
adam@0
|
8101 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
|
adam@0
|
8102 test -z "$libdir" && \
|
adam@0
|
8103 func_fatal_error "\`$lib' is not a valid libtool archive"
|
adam@0
|
8104 newdlprefiles="$newdlprefiles $libdir/$name"
|
adam@0
|
8105 ;;
|
adam@0
|
8106 esac
|
adam@0
|
8107 done
|
adam@0
|
8108 dlprefiles="$newdlprefiles"
|
adam@0
|
8109 else
|
adam@0
|
8110 newdlfiles=
|
adam@0
|
8111 for lib in $dlfiles; do
|
adam@0
|
8112 case $lib in
|
adam@0
|
8113 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
|
adam@0
|
8114 *) abs=`pwd`"/$lib" ;;
|
adam@0
|
8115 esac
|
adam@0
|
8116 newdlfiles="$newdlfiles $abs"
|
adam@0
|
8117 done
|
adam@0
|
8118 dlfiles="$newdlfiles"
|
adam@0
|
8119 newdlprefiles=
|
adam@0
|
8120 for lib in $dlprefiles; do
|
adam@0
|
8121 case $lib in
|
adam@0
|
8122 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
|
adam@0
|
8123 *) abs=`pwd`"/$lib" ;;
|
adam@0
|
8124 esac
|
adam@0
|
8125 newdlprefiles="$newdlprefiles $abs"
|
adam@0
|
8126 done
|
adam@0
|
8127 dlprefiles="$newdlprefiles"
|
adam@0
|
8128 fi
|
adam@0
|
8129 $RM $output
|
adam@0
|
8130 # place dlname in correct position for cygwin
|
adam@0
|
8131 tdlname=$dlname
|
adam@0
|
8132 case $host,$output,$installed,$module,$dlname in
|
adam@0
|
8133 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
|
adam@0
|
8134 esac
|
adam@0
|
8135 $ECHO > $output "\
|
adam@0
|
8136 # $outputname - a libtool library file
|
adam@0
|
8137 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
|
adam@0
|
8138 #
|
adam@0
|
8139 # Please DO NOT delete this file!
|
adam@0
|
8140 # It is necessary for linking the library.
|
adam@0
|
8141
|
adam@0
|
8142 # The name that we can dlopen(3).
|
adam@0
|
8143 dlname='$tdlname'
|
adam@0
|
8144
|
adam@0
|
8145 # Names of this library.
|
adam@0
|
8146 library_names='$library_names'
|
adam@0
|
8147
|
adam@0
|
8148 # The name of the static archive.
|
adam@0
|
8149 old_library='$old_library'
|
adam@0
|
8150
|
adam@0
|
8151 # Linker flags that can not go in dependency_libs.
|
adam@0
|
8152 inherited_linker_flags='$new_inherited_linker_flags'
|
adam@0
|
8153
|
adam@0
|
8154 # Libraries that this one depends upon.
|
adam@0
|
8155 dependency_libs='$dependency_libs'
|
adam@0
|
8156
|
adam@0
|
8157 # Names of additional weak libraries provided by this library
|
adam@0
|
8158 weak_library_names='$weak_libs'
|
adam@0
|
8159
|
adam@0
|
8160 # Version information for $libname.
|
adam@0
|
8161 current=$current
|
adam@0
|
8162 age=$age
|
adam@0
|
8163 revision=$revision
|
adam@0
|
8164
|
adam@0
|
8165 # Is this an already installed library?
|
adam@0
|
8166 installed=$installed
|
adam@0
|
8167
|
adam@0
|
8168 # Should we warn about portability when linking against -modules?
|
adam@0
|
8169 shouldnotlink=$module
|
adam@0
|
8170
|
adam@0
|
8171 # Files to dlopen/dlpreopen
|
adam@0
|
8172 dlopen='$dlfiles'
|
adam@0
|
8173 dlpreopen='$dlprefiles'
|
adam@0
|
8174
|
adam@0
|
8175 # Directory that this library needs to be installed in:
|
adam@0
|
8176 libdir='$install_libdir'"
|
adam@0
|
8177 if test "$installed" = no && test "$need_relink" = yes; then
|
adam@0
|
8178 $ECHO >> $output "\
|
adam@0
|
8179 relink_command=\"$relink_command\""
|
adam@0
|
8180 fi
|
adam@0
|
8181 done
|
adam@0
|
8182 }
|
adam@0
|
8183
|
adam@0
|
8184 # Do a symbolic link so that the libtool archive can be found in
|
adam@0
|
8185 # LD_LIBRARY_PATH before the program is installed.
|
adam@0
|
8186 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
|
adam@0
|
8187 ;;
|
adam@0
|
8188 esac
|
adam@0
|
8189 exit $EXIT_SUCCESS
|
adam@0
|
8190 }
|
adam@0
|
8191
|
adam@0
|
8192 { test "$mode" = link || test "$mode" = relink; } &&
|
adam@0
|
8193 func_mode_link ${1+"$@"}
|
adam@0
|
8194
|
adam@0
|
8195
|
adam@0
|
8196 # func_mode_uninstall arg...
|
adam@0
|
8197 func_mode_uninstall ()
|
adam@0
|
8198 {
|
adam@0
|
8199 $opt_debug
|
adam@0
|
8200 RM="$nonopt"
|
adam@0
|
8201 files=
|
adam@0
|
8202 rmforce=
|
adam@0
|
8203 exit_status=0
|
adam@0
|
8204
|
adam@0
|
8205 # This variable tells wrapper scripts just to set variables rather
|
adam@0
|
8206 # than running their programs.
|
adam@0
|
8207 libtool_install_magic="$magic"
|
adam@0
|
8208
|
adam@0
|
8209 for arg
|
adam@0
|
8210 do
|
adam@0
|
8211 case $arg in
|
adam@0
|
8212 -f) RM="$RM $arg"; rmforce=yes ;;
|
adam@0
|
8213 -*) RM="$RM $arg" ;;
|
adam@0
|
8214 *) files="$files $arg" ;;
|
adam@0
|
8215 esac
|
adam@0
|
8216 done
|
adam@0
|
8217
|
adam@0
|
8218 test -z "$RM" && \
|
adam@0
|
8219 func_fatal_help "you must specify an RM program"
|
adam@0
|
8220
|
adam@0
|
8221 rmdirs=
|
adam@0
|
8222
|
adam@0
|
8223 origobjdir="$objdir"
|
adam@0
|
8224 for file in $files; do
|
adam@0
|
8225 func_dirname "$file" "" "."
|
adam@0
|
8226 dir="$func_dirname_result"
|
adam@0
|
8227 if test "X$dir" = X.; then
|
adam@0
|
8228 objdir="$origobjdir"
|
adam@0
|
8229 else
|
adam@0
|
8230 objdir="$dir/$origobjdir"
|
adam@0
|
8231 fi
|
adam@0
|
8232 func_basename "$file"
|
adam@0
|
8233 name="$func_basename_result"
|
adam@0
|
8234 test "$mode" = uninstall && objdir="$dir"
|
adam@0
|
8235
|
adam@0
|
8236 # Remember objdir for removal later, being careful to avoid duplicates
|
adam@0
|
8237 if test "$mode" = clean; then
|
adam@0
|
8238 case " $rmdirs " in
|
adam@0
|
8239 *" $objdir "*) ;;
|
adam@0
|
8240 *) rmdirs="$rmdirs $objdir" ;;
|
adam@0
|
8241 esac
|
adam@0
|
8242 fi
|
adam@0
|
8243
|
adam@0
|
8244 # Don't error if the file doesn't exist and rm -f was used.
|
adam@0
|
8245 if { test -L "$file"; } >/dev/null 2>&1 ||
|
adam@0
|
8246 { test -h "$file"; } >/dev/null 2>&1 ||
|
adam@0
|
8247 test -f "$file"; then
|
adam@0
|
8248 :
|
adam@0
|
8249 elif test -d "$file"; then
|
adam@0
|
8250 exit_status=1
|
adam@0
|
8251 continue
|
adam@0
|
8252 elif test "$rmforce" = yes; then
|
adam@0
|
8253 continue
|
adam@0
|
8254 fi
|
adam@0
|
8255
|
adam@0
|
8256 rmfiles="$file"
|
adam@0
|
8257
|
adam@0
|
8258 case $name in
|
adam@0
|
8259 *.la)
|
adam@0
|
8260 # Possibly a libtool archive, so verify it.
|
adam@0
|
8261 if func_lalib_p "$file"; then
|
adam@0
|
8262 func_source $dir/$name
|
adam@0
|
8263
|
adam@0
|
8264 # Delete the libtool libraries and symlinks.
|
adam@0
|
8265 for n in $library_names; do
|
adam@0
|
8266 rmfiles="$rmfiles $objdir/$n"
|
adam@0
|
8267 done
|
adam@0
|
8268 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
|
adam@0
|
8269
|
adam@0
|
8270 case "$mode" in
|
adam@0
|
8271 clean)
|
adam@0
|
8272 case " $library_names " in
|
adam@0
|
8273 # " " in the beginning catches empty $dlname
|
adam@0
|
8274 *" $dlname "*) ;;
|
adam@0
|
8275 *) rmfiles="$rmfiles $objdir/$dlname" ;;
|
adam@0
|
8276 esac
|
adam@0
|
8277 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
|
adam@0
|
8278 ;;
|
adam@0
|
8279 uninstall)
|
adam@0
|
8280 if test -n "$library_names"; then
|
adam@0
|
8281 # Do each command in the postuninstall commands.
|
adam@0
|
8282 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
|
adam@0
|
8283 fi
|
adam@0
|
8284
|
adam@0
|
8285 if test -n "$old_library"; then
|
adam@0
|
8286 # Do each command in the old_postuninstall commands.
|
adam@0
|
8287 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
|
adam@0
|
8288 fi
|
adam@0
|
8289 # FIXME: should reinstall the best remaining shared library.
|
adam@0
|
8290 ;;
|
adam@0
|
8291 esac
|
adam@0
|
8292 fi
|
adam@0
|
8293 ;;
|
adam@0
|
8294
|
adam@0
|
8295 *.lo)
|
adam@0
|
8296 # Possibly a libtool object, so verify it.
|
adam@0
|
8297 if func_lalib_p "$file"; then
|
adam@0
|
8298
|
adam@0
|
8299 # Read the .lo file
|
adam@0
|
8300 func_source $dir/$name
|
adam@0
|
8301
|
adam@0
|
8302 # Add PIC object to the list of files to remove.
|
adam@0
|
8303 if test -n "$pic_object" &&
|
adam@0
|
8304 test "$pic_object" != none; then
|
adam@0
|
8305 rmfiles="$rmfiles $dir/$pic_object"
|
adam@0
|
8306 fi
|
adam@0
|
8307
|
adam@0
|
8308 # Add non-PIC object to the list of files to remove.
|
adam@0
|
8309 if test -n "$non_pic_object" &&
|
adam@0
|
8310 test "$non_pic_object" != none; then
|
adam@0
|
8311 rmfiles="$rmfiles $dir/$non_pic_object"
|
adam@0
|
8312 fi
|
adam@0
|
8313 fi
|
adam@0
|
8314 ;;
|
adam@0
|
8315
|
adam@0
|
8316 *)
|
adam@0
|
8317 if test "$mode" = clean ; then
|
adam@0
|
8318 noexename=$name
|
adam@0
|
8319 case $file in
|
adam@0
|
8320 *.exe)
|
adam@0
|
8321 func_stripname '' '.exe' "$file"
|
adam@0
|
8322 file=$func_stripname_result
|
adam@0
|
8323 func_stripname '' '.exe' "$name"
|
adam@0
|
8324 noexename=$func_stripname_result
|
adam@0
|
8325 # $file with .exe has already been added to rmfiles,
|
adam@0
|
8326 # add $file without .exe
|
adam@0
|
8327 rmfiles="$rmfiles $file"
|
adam@0
|
8328 ;;
|
adam@0
|
8329 esac
|
adam@0
|
8330 # Do a test to see if this is a libtool program.
|
adam@0
|
8331 if func_ltwrapper_p "$file"; then
|
adam@0
|
8332 if func_ltwrapper_executable_p "$file"; then
|
adam@0
|
8333 func_ltwrapper_scriptname "$file"
|
adam@0
|
8334 relink_command=
|
adam@0
|
8335 func_source $func_ltwrapper_scriptname_result
|
adam@0
|
8336 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
|
adam@0
|
8337 else
|
adam@0
|
8338 relink_command=
|
adam@0
|
8339 func_source $dir/$noexename
|
adam@0
|
8340 fi
|
adam@0
|
8341
|
adam@0
|
8342 # note $name still contains .exe if it was in $file originally
|
adam@0
|
8343 # as does the version of $file that was added into $rmfiles
|
adam@0
|
8344 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
|
adam@0
|
8345 if test "$fast_install" = yes && test -n "$relink_command"; then
|
adam@0
|
8346 rmfiles="$rmfiles $objdir/lt-$name"
|
adam@0
|
8347 fi
|
adam@0
|
8348 if test "X$noexename" != "X$name" ; then
|
adam@0
|
8349 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
|
adam@0
|
8350 fi
|
adam@0
|
8351 fi
|
adam@0
|
8352 fi
|
adam@0
|
8353 ;;
|
adam@0
|
8354 esac
|
adam@0
|
8355 func_show_eval "$RM $rmfiles" 'exit_status=1'
|
adam@0
|
8356 done
|
adam@0
|
8357 objdir="$origobjdir"
|
adam@0
|
8358
|
adam@0
|
8359 # Try to remove the ${objdir}s in the directories where we deleted files
|
adam@0
|
8360 for dir in $rmdirs; do
|
adam@0
|
8361 if test -d "$dir"; then
|
adam@0
|
8362 func_show_eval "rmdir $dir >/dev/null 2>&1"
|
adam@0
|
8363 fi
|
adam@0
|
8364 done
|
adam@0
|
8365
|
adam@0
|
8366 exit $exit_status
|
adam@0
|
8367 }
|
adam@0
|
8368
|
adam@0
|
8369 { test "$mode" = uninstall || test "$mode" = clean; } &&
|
adam@0
|
8370 func_mode_uninstall ${1+"$@"}
|
adam@0
|
8371
|
adam@0
|
8372 test -z "$mode" && {
|
adam@0
|
8373 help="$generic_help"
|
adam@0
|
8374 func_fatal_help "you must specify a MODE"
|
adam@0
|
8375 }
|
adam@0
|
8376
|
adam@0
|
8377 test -z "$exec_cmd" && \
|
adam@0
|
8378 func_fatal_help "invalid operation mode \`$mode'"
|
adam@0
|
8379
|
adam@0
|
8380 if test -n "$exec_cmd"; then
|
adam@0
|
8381 eval exec "$exec_cmd"
|
adam@0
|
8382 exit $EXIT_FAILURE
|
adam@0
|
8383 fi
|
adam@0
|
8384
|
adam@0
|
8385 exit $exit_status
|
adam@0
|
8386
|
adam@0
|
8387
|
adam@0
|
8388 # The TAGs below are defined such that we never get into a situation
|
adam@0
|
8389 # in which we disable both kinds of libraries. Given conflicting
|
adam@0
|
8390 # choices, we go for a static library, that is the most portable,
|
adam@0
|
8391 # since we can't tell whether shared libraries were disabled because
|
adam@0
|
8392 # the user asked for that or because the platform doesn't support
|
adam@0
|
8393 # them. This is particularly important on AIX, because we don't
|
adam@0
|
8394 # support having both static and shared libraries enabled at the same
|
adam@0
|
8395 # time on that platform, so we default to a shared-only configuration.
|
adam@0
|
8396 # If a disable-shared tag is given, we'll fallback to a static-only
|
adam@0
|
8397 # configuration. But we'll never go from static-only to shared-only.
|
adam@0
|
8398
|
adam@0
|
8399 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
|
adam@0
|
8400 build_libtool_libs=no
|
adam@0
|
8401 build_old_libs=yes
|
adam@0
|
8402 # ### END LIBTOOL TAG CONFIG: disable-shared
|
adam@0
|
8403
|
adam@0
|
8404 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
|
adam@0
|
8405 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
|
adam@0
|
8406 # ### END LIBTOOL TAG CONFIG: disable-static
|
adam@0
|
8407
|
adam@0
|
8408 # Local Variables:
|
adam@0
|
8409 # mode:shell-script
|
adam@0
|
8410 # sh-indentation:2
|
adam@0
|
8411 # End:
|
adam@0
|
8412 # vi:sw=2
|
adam@0
|
8413
|