cannam@89
|
1 # Generated from ltmain.m4sh.
|
cannam@89
|
2
|
cannam@89
|
3 # ltmain.sh (GNU libtool) 2.2.4
|
cannam@89
|
4 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
cannam@89
|
5
|
cannam@89
|
6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
|
cannam@89
|
7 # This is free software; see the source for copying conditions. There is NO
|
cannam@89
|
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
cannam@89
|
9
|
cannam@89
|
10 # GNU Libtool is free software; you can redistribute it and/or modify
|
cannam@89
|
11 # it under the terms of the GNU General Public License as published by
|
cannam@89
|
12 # the Free Software Foundation; either version 2 of the License, or
|
cannam@89
|
13 # (at your option) any later version.
|
cannam@89
|
14 #
|
cannam@89
|
15 # As a special exception to the GNU General Public License,
|
cannam@89
|
16 # if you distribute this file as part of a program or library that
|
cannam@89
|
17 # is built using GNU Libtool, you may include this file under the
|
cannam@89
|
18 # same distribution terms that you use for the rest of that program.
|
cannam@89
|
19 #
|
cannam@89
|
20 # GNU Libtool is distributed in the hope that it will be useful, but
|
cannam@89
|
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
|
cannam@89
|
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
cannam@89
|
23 # General Public License for more details.
|
cannam@89
|
24 #
|
cannam@89
|
25 # You should have received a copy of the GNU General Public License
|
cannam@89
|
26 # along with GNU Libtool; see the file COPYING. If not, a copy
|
cannam@89
|
27 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
|
cannam@89
|
28 # or obtained by writing to the Free Software Foundation, Inc.,
|
cannam@89
|
29 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
cannam@89
|
30
|
cannam@89
|
31 # Usage: $progname [OPTION]... [MODE-ARG]...
|
cannam@89
|
32 #
|
cannam@89
|
33 # Provide generalized library-building support services.
|
cannam@89
|
34 #
|
cannam@89
|
35 # --config show all configuration variables
|
cannam@89
|
36 # --debug enable verbose shell tracing
|
cannam@89
|
37 # -n, --dry-run display commands without modifying any files
|
cannam@89
|
38 # --features display basic configuration information and exit
|
cannam@89
|
39 # --mode=MODE use operation mode MODE
|
cannam@89
|
40 # --preserve-dup-deps don't remove duplicate dependency libraries
|
cannam@89
|
41 # --quiet, --silent don't print informational messages
|
cannam@89
|
42 # --tag=TAG use configuration variables from tag TAG
|
cannam@89
|
43 # -v, --verbose print informational messages (default)
|
cannam@89
|
44 # --version print version information
|
cannam@89
|
45 # -h, --help print short or long help message
|
cannam@89
|
46 #
|
cannam@89
|
47 # MODE must be one of the following:
|
cannam@89
|
48 #
|
cannam@89
|
49 # clean remove files from the build directory
|
cannam@89
|
50 # compile compile a source file into a libtool object
|
cannam@89
|
51 # execute automatically set library path, then run a program
|
cannam@89
|
52 # finish complete the installation of libtool libraries
|
cannam@89
|
53 # install install libraries or executables
|
cannam@89
|
54 # link create a library or an executable
|
cannam@89
|
55 # uninstall remove libraries from an installed directory
|
cannam@89
|
56 #
|
cannam@89
|
57 # MODE-ARGS vary depending on the MODE.
|
cannam@89
|
58 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
|
cannam@89
|
59 #
|
cannam@89
|
60 # When reporting a bug, please describe a test case to reproduce it and
|
cannam@89
|
61 # include the following information:
|
cannam@89
|
62 #
|
cannam@89
|
63 # host-triplet: $host
|
cannam@89
|
64 # shell: $SHELL
|
cannam@89
|
65 # compiler: $LTCC
|
cannam@89
|
66 # compiler flags: $LTCFLAGS
|
cannam@89
|
67 # linker: $LD (gnu? $with_gnu_ld)
|
cannam@89
|
68 # $progname: (GNU libtool) 2.2.4 Debian-2.2.4-0ubuntu4
|
cannam@89
|
69 # automake: $automake_version
|
cannam@89
|
70 # autoconf: $autoconf_version
|
cannam@89
|
71 #
|
cannam@89
|
72 # Report bugs to <bug-libtool@gnu.org>.
|
cannam@89
|
73
|
cannam@89
|
74 PROGRAM=ltmain.sh
|
cannam@89
|
75 PACKAGE=libtool
|
cannam@89
|
76 VERSION="2.2.4 Debian-2.2.4-0ubuntu4"
|
cannam@89
|
77 TIMESTAMP=""
|
cannam@89
|
78 package_revision=1.2976
|
cannam@89
|
79
|
cannam@89
|
80 # Be Bourne compatible
|
cannam@89
|
81 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
cannam@89
|
82 emulate sh
|
cannam@89
|
83 NULLCMD=:
|
cannam@89
|
84 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
|
cannam@89
|
85 # is contrary to our usage. Disable this feature.
|
cannam@89
|
86 alias -g '${1+"$@"}'='"$@"'
|
cannam@89
|
87 setopt NO_GLOB_SUBST
|
cannam@89
|
88 else
|
cannam@89
|
89 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
|
cannam@89
|
90 fi
|
cannam@89
|
91 BIN_SH=xpg4; export BIN_SH # for Tru64
|
cannam@89
|
92 DUALCASE=1; export DUALCASE # for MKS sh
|
cannam@89
|
93
|
cannam@89
|
94 # NLS nuisances: We save the old values to restore during execute mode.
|
cannam@89
|
95 # Only set LANG and LC_ALL to C if already set.
|
cannam@89
|
96 # These must not be set unconditionally because not all systems understand
|
cannam@89
|
97 # e.g. LANG=C (notably SCO).
|
cannam@89
|
98 lt_user_locale=
|
cannam@89
|
99 lt_safe_locale=
|
cannam@89
|
100 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
cannam@89
|
101 do
|
cannam@89
|
102 eval "if test \"\${$lt_var+set}\" = set; then
|
cannam@89
|
103 save_$lt_var=\$$lt_var
|
cannam@89
|
104 $lt_var=C
|
cannam@89
|
105 export $lt_var
|
cannam@89
|
106 lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
|
cannam@89
|
107 lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
|
cannam@89
|
108 fi"
|
cannam@89
|
109 done
|
cannam@89
|
110
|
cannam@89
|
111 $lt_unset CDPATH
|
cannam@89
|
112
|
cannam@89
|
113
|
cannam@89
|
114
|
cannam@89
|
115
|
cannam@89
|
116
|
cannam@89
|
117 : ${CP="cp -f"}
|
cannam@89
|
118 : ${ECHO="echo"}
|
cannam@89
|
119 : ${EGREP="/bin/grep -E"}
|
cannam@89
|
120 : ${FGREP="/bin/grep -F"}
|
cannam@89
|
121 : ${GREP="/bin/grep"}
|
cannam@89
|
122 : ${LN_S="ln -s"}
|
cannam@89
|
123 : ${MAKE="make"}
|
cannam@89
|
124 : ${MKDIR="mkdir"}
|
cannam@89
|
125 : ${MV="mv -f"}
|
cannam@89
|
126 : ${RM="rm -f"}
|
cannam@89
|
127 : ${SED="/bin/sed"}
|
cannam@89
|
128 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
|
cannam@89
|
129 : ${Xsed="$SED -e 1s/^X//"}
|
cannam@89
|
130
|
cannam@89
|
131 # Global variables:
|
cannam@89
|
132 EXIT_SUCCESS=0
|
cannam@89
|
133 EXIT_FAILURE=1
|
cannam@89
|
134 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
|
cannam@89
|
135 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
|
cannam@89
|
136
|
cannam@89
|
137 exit_status=$EXIT_SUCCESS
|
cannam@89
|
138
|
cannam@89
|
139 # Make sure IFS has a sensible default
|
cannam@89
|
140 lt_nl='
|
cannam@89
|
141 '
|
cannam@89
|
142 IFS=" $lt_nl"
|
cannam@89
|
143
|
cannam@89
|
144 dirname="s,/[^/]*$,,"
|
cannam@89
|
145 basename="s,^.*/,,"
|
cannam@89
|
146
|
cannam@89
|
147 # func_dirname_and_basename file append nondir_replacement
|
cannam@89
|
148 # perform func_basename and func_dirname in a single function
|
cannam@89
|
149 # call:
|
cannam@89
|
150 # dirname: Compute the dirname of FILE. If nonempty,
|
cannam@89
|
151 # add APPEND to the result, otherwise set result
|
cannam@89
|
152 # to NONDIR_REPLACEMENT.
|
cannam@89
|
153 # value returned in "$func_dirname_result"
|
cannam@89
|
154 # basename: Compute filename of FILE.
|
cannam@89
|
155 # value retuned in "$func_basename_result"
|
cannam@89
|
156 # Implementation must be kept synchronized with func_dirname
|
cannam@89
|
157 # and func_basename. For efficiency, we do not delegate to
|
cannam@89
|
158 # those functions but instead duplicate the functionality here.
|
cannam@89
|
159 func_dirname_and_basename ()
|
cannam@89
|
160 {
|
cannam@89
|
161 # Extract subdirectory from the argument.
|
cannam@89
|
162 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
|
cannam@89
|
163 if test "X$func_dirname_result" = "X${1}"; then
|
cannam@89
|
164 func_dirname_result="${3}"
|
cannam@89
|
165 else
|
cannam@89
|
166 func_dirname_result="$func_dirname_result${2}"
|
cannam@89
|
167 fi
|
cannam@89
|
168 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
|
cannam@89
|
169 }
|
cannam@89
|
170
|
cannam@89
|
171 # Generated shell functions inserted here.
|
cannam@89
|
172
|
cannam@89
|
173 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
|
cannam@89
|
174 # is ksh but when the shell is invoked as "sh" and the current value of
|
cannam@89
|
175 # the _XPG environment variable is not equal to 1 (one), the special
|
cannam@89
|
176 # positional parameter $0, within a function call, is the name of the
|
cannam@89
|
177 # function.
|
cannam@89
|
178 progpath="$0"
|
cannam@89
|
179
|
cannam@89
|
180 # The name of this program:
|
cannam@89
|
181 # In the unlikely event $progname began with a '-', it would play havoc with
|
cannam@89
|
182 # func_echo (imagine progname=-n), so we prepend ./ in that case:
|
cannam@89
|
183 func_dirname_and_basename "$progpath"
|
cannam@89
|
184 progname=$func_basename_result
|
cannam@89
|
185 case $progname in
|
cannam@89
|
186 -*) progname=./$progname ;;
|
cannam@89
|
187 esac
|
cannam@89
|
188
|
cannam@89
|
189 # Make sure we have an absolute path for reexecution:
|
cannam@89
|
190 case $progpath in
|
cannam@89
|
191 [\\/]*|[A-Za-z]:\\*) ;;
|
cannam@89
|
192 *[\\/]*)
|
cannam@89
|
193 progdir=$func_dirname_result
|
cannam@89
|
194 progdir=`cd "$progdir" && pwd`
|
cannam@89
|
195 progpath="$progdir/$progname"
|
cannam@89
|
196 ;;
|
cannam@89
|
197 *)
|
cannam@89
|
198 save_IFS="$IFS"
|
cannam@89
|
199 IFS=:
|
cannam@89
|
200 for progdir in $PATH; do
|
cannam@89
|
201 IFS="$save_IFS"
|
cannam@89
|
202 test -x "$progdir/$progname" && break
|
cannam@89
|
203 done
|
cannam@89
|
204 IFS="$save_IFS"
|
cannam@89
|
205 test -n "$progdir" || progdir=`pwd`
|
cannam@89
|
206 progpath="$progdir/$progname"
|
cannam@89
|
207 ;;
|
cannam@89
|
208 esac
|
cannam@89
|
209
|
cannam@89
|
210 # Sed substitution that helps us do robust quoting. It backslashifies
|
cannam@89
|
211 # metacharacters that are still active within double-quoted strings.
|
cannam@89
|
212 Xsed="${SED}"' -e 1s/^X//'
|
cannam@89
|
213 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
|
cannam@89
|
214
|
cannam@89
|
215 # Same as above, but do not quote variable references.
|
cannam@89
|
216 double_quote_subst='s/\(["`\\]\)/\\\1/g'
|
cannam@89
|
217
|
cannam@89
|
218 # Re-`\' parameter expansions in output of double_quote_subst that were
|
cannam@89
|
219 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
|
cannam@89
|
220 # in input to double_quote_subst, that '$' was protected from expansion.
|
cannam@89
|
221 # Since each input `\' is now two `\'s, look for any number of runs of
|
cannam@89
|
222 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
|
cannam@89
|
223 bs='\\'
|
cannam@89
|
224 bs2='\\\\'
|
cannam@89
|
225 bs4='\\\\\\\\'
|
cannam@89
|
226 dollar='\$'
|
cannam@89
|
227 sed_double_backslash="\
|
cannam@89
|
228 s/$bs4/&\\
|
cannam@89
|
229 /g
|
cannam@89
|
230 s/^$bs2$dollar/$bs&/
|
cannam@89
|
231 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
|
cannam@89
|
232 s/\n//g"
|
cannam@89
|
233
|
cannam@89
|
234 # Standard options:
|
cannam@89
|
235 opt_dry_run=false
|
cannam@89
|
236 opt_help=false
|
cannam@89
|
237 opt_quiet=false
|
cannam@89
|
238 opt_verbose=false
|
cannam@89
|
239 opt_warning=:
|
cannam@89
|
240
|
cannam@89
|
241 # func_echo arg...
|
cannam@89
|
242 # Echo program name prefixed message, along with the current mode
|
cannam@89
|
243 # name if it has been set yet.
|
cannam@89
|
244 func_echo ()
|
cannam@89
|
245 {
|
cannam@89
|
246 $ECHO "$progname${mode+: }$mode: $*"
|
cannam@89
|
247 }
|
cannam@89
|
248
|
cannam@89
|
249 # func_verbose arg...
|
cannam@89
|
250 # Echo program name prefixed message in verbose mode only.
|
cannam@89
|
251 func_verbose ()
|
cannam@89
|
252 {
|
cannam@89
|
253 $opt_verbose && func_echo ${1+"$@"}
|
cannam@89
|
254
|
cannam@89
|
255 # A bug in bash halts the script if the last line of a function
|
cannam@89
|
256 # fails when set -e is in force, so we need another command to
|
cannam@89
|
257 # work around that:
|
cannam@89
|
258 :
|
cannam@89
|
259 }
|
cannam@89
|
260
|
cannam@89
|
261 # func_error arg...
|
cannam@89
|
262 # Echo program name prefixed message to standard error.
|
cannam@89
|
263 func_error ()
|
cannam@89
|
264 {
|
cannam@89
|
265 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
|
cannam@89
|
266 }
|
cannam@89
|
267
|
cannam@89
|
268 # func_warning arg...
|
cannam@89
|
269 # Echo program name prefixed warning message to standard error.
|
cannam@89
|
270 func_warning ()
|
cannam@89
|
271 {
|
cannam@89
|
272 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
|
cannam@89
|
273
|
cannam@89
|
274 # bash bug again:
|
cannam@89
|
275 :
|
cannam@89
|
276 }
|
cannam@89
|
277
|
cannam@89
|
278 # func_fatal_error arg...
|
cannam@89
|
279 # Echo program name prefixed message to standard error, and exit.
|
cannam@89
|
280 func_fatal_error ()
|
cannam@89
|
281 {
|
cannam@89
|
282 func_error ${1+"$@"}
|
cannam@89
|
283 exit $EXIT_FAILURE
|
cannam@89
|
284 }
|
cannam@89
|
285
|
cannam@89
|
286 # func_fatal_help arg...
|
cannam@89
|
287 # Echo program name prefixed message to standard error, followed by
|
cannam@89
|
288 # a help hint, and exit.
|
cannam@89
|
289 func_fatal_help ()
|
cannam@89
|
290 {
|
cannam@89
|
291 func_error ${1+"$@"}
|
cannam@89
|
292 func_fatal_error "$help"
|
cannam@89
|
293 }
|
cannam@89
|
294 help="Try \`$progname --help' for more information." ## default
|
cannam@89
|
295
|
cannam@89
|
296
|
cannam@89
|
297 # func_grep expression filename
|
cannam@89
|
298 # Check whether EXPRESSION matches any line of FILENAME, without output.
|
cannam@89
|
299 func_grep ()
|
cannam@89
|
300 {
|
cannam@89
|
301 $GREP "$1" "$2" >/dev/null 2>&1
|
cannam@89
|
302 }
|
cannam@89
|
303
|
cannam@89
|
304
|
cannam@89
|
305 # func_mkdir_p directory-path
|
cannam@89
|
306 # Make sure the entire path to DIRECTORY-PATH is available.
|
cannam@89
|
307 func_mkdir_p ()
|
cannam@89
|
308 {
|
cannam@89
|
309 my_directory_path="$1"
|
cannam@89
|
310 my_dir_list=
|
cannam@89
|
311
|
cannam@89
|
312 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
|
cannam@89
|
313
|
cannam@89
|
314 # Protect directory names starting with `-'
|
cannam@89
|
315 case $my_directory_path in
|
cannam@89
|
316 -*) my_directory_path="./$my_directory_path" ;;
|
cannam@89
|
317 esac
|
cannam@89
|
318
|
cannam@89
|
319 # While some portion of DIR does not yet exist...
|
cannam@89
|
320 while test ! -d "$my_directory_path"; do
|
cannam@89
|
321 # ...make a list in topmost first order. Use a colon delimited
|
cannam@89
|
322 # list incase some portion of path contains whitespace.
|
cannam@89
|
323 my_dir_list="$my_directory_path:$my_dir_list"
|
cannam@89
|
324
|
cannam@89
|
325 # If the last portion added has no slash in it, the list is done
|
cannam@89
|
326 case $my_directory_path in */*) ;; *) break ;; esac
|
cannam@89
|
327
|
cannam@89
|
328 # ...otherwise throw away the child directory and loop
|
cannam@89
|
329 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
|
cannam@89
|
330 done
|
cannam@89
|
331 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
|
cannam@89
|
332
|
cannam@89
|
333 save_mkdir_p_IFS="$IFS"; IFS=':'
|
cannam@89
|
334 for my_dir in $my_dir_list; do
|
cannam@89
|
335 IFS="$save_mkdir_p_IFS"
|
cannam@89
|
336 # mkdir can fail with a `File exist' error if two processes
|
cannam@89
|
337 # try to create one of the directories concurrently. Don't
|
cannam@89
|
338 # stop in that case!
|
cannam@89
|
339 $MKDIR "$my_dir" 2>/dev/null || :
|
cannam@89
|
340 done
|
cannam@89
|
341 IFS="$save_mkdir_p_IFS"
|
cannam@89
|
342
|
cannam@89
|
343 # Bail out if we (or some other process) failed to create a directory.
|
cannam@89
|
344 test -d "$my_directory_path" || \
|
cannam@89
|
345 func_fatal_error "Failed to create \`$1'"
|
cannam@89
|
346 fi
|
cannam@89
|
347 }
|
cannam@89
|
348
|
cannam@89
|
349
|
cannam@89
|
350 # func_mktempdir [string]
|
cannam@89
|
351 # Make a temporary directory that won't clash with other running
|
cannam@89
|
352 # libtool processes, and avoids race conditions if possible. If
|
cannam@89
|
353 # given, STRING is the basename for that directory.
|
cannam@89
|
354 func_mktempdir ()
|
cannam@89
|
355 {
|
cannam@89
|
356 my_template="${TMPDIR-/tmp}/${1-$progname}"
|
cannam@89
|
357
|
cannam@89
|
358 if test "$opt_dry_run" = ":"; then
|
cannam@89
|
359 # Return a directory name, but don't create it in dry-run mode
|
cannam@89
|
360 my_tmpdir="${my_template}-$$"
|
cannam@89
|
361 else
|
cannam@89
|
362
|
cannam@89
|
363 # If mktemp works, use that first and foremost
|
cannam@89
|
364 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
|
cannam@89
|
365
|
cannam@89
|
366 if test ! -d "$my_tmpdir"; then
|
cannam@89
|
367 # Failing that, at least try and use $RANDOM to avoid a race
|
cannam@89
|
368 my_tmpdir="${my_template}-${RANDOM-0}$$"
|
cannam@89
|
369
|
cannam@89
|
370 save_mktempdir_umask=`umask`
|
cannam@89
|
371 umask 0077
|
cannam@89
|
372 $MKDIR "$my_tmpdir"
|
cannam@89
|
373 umask $save_mktempdir_umask
|
cannam@89
|
374 fi
|
cannam@89
|
375
|
cannam@89
|
376 # If we're not in dry-run mode, bomb out on failure
|
cannam@89
|
377 test -d "$my_tmpdir" || \
|
cannam@89
|
378 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
|
cannam@89
|
379 fi
|
cannam@89
|
380
|
cannam@89
|
381 $ECHO "X$my_tmpdir" | $Xsed
|
cannam@89
|
382 }
|
cannam@89
|
383
|
cannam@89
|
384
|
cannam@89
|
385 # func_quote_for_eval arg
|
cannam@89
|
386 # Aesthetically quote ARG to be evaled later.
|
cannam@89
|
387 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
|
cannam@89
|
388 # is double-quoted, suitable for a subsequent eval, whereas
|
cannam@89
|
389 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
|
cannam@89
|
390 # which are still active within double quotes backslashified.
|
cannam@89
|
391 func_quote_for_eval ()
|
cannam@89
|
392 {
|
cannam@89
|
393 case $1 in
|
cannam@89
|
394 *[\\\`\"\$]*)
|
cannam@89
|
395 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
|
cannam@89
|
396 *)
|
cannam@89
|
397 func_quote_for_eval_unquoted_result="$1" ;;
|
cannam@89
|
398 esac
|
cannam@89
|
399
|
cannam@89
|
400 case $func_quote_for_eval_unquoted_result in
|
cannam@89
|
401 # Double-quote args containing shell metacharacters to delay
|
cannam@89
|
402 # word splitting, command substitution and and variable
|
cannam@89
|
403 # expansion for a subsequent eval.
|
cannam@89
|
404 # Many Bourne shells cannot handle close brackets correctly
|
cannam@89
|
405 # in scan sets, so we specify it separately.
|
cannam@89
|
406 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
cannam@89
|
407 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
|
cannam@89
|
408 ;;
|
cannam@89
|
409 *)
|
cannam@89
|
410 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
|
cannam@89
|
411 esac
|
cannam@89
|
412 }
|
cannam@89
|
413
|
cannam@89
|
414
|
cannam@89
|
415 # func_quote_for_expand arg
|
cannam@89
|
416 # Aesthetically quote ARG to be evaled later; same as above,
|
cannam@89
|
417 # but do not quote variable references.
|
cannam@89
|
418 func_quote_for_expand ()
|
cannam@89
|
419 {
|
cannam@89
|
420 case $1 in
|
cannam@89
|
421 *[\\\`\"]*)
|
cannam@89
|
422 my_arg=`$ECHO "X$1" | $Xsed \
|
cannam@89
|
423 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
|
cannam@89
|
424 *)
|
cannam@89
|
425 my_arg="$1" ;;
|
cannam@89
|
426 esac
|
cannam@89
|
427
|
cannam@89
|
428 case $my_arg in
|
cannam@89
|
429 # Double-quote args containing shell metacharacters to delay
|
cannam@89
|
430 # word splitting and command substitution for a subsequent eval.
|
cannam@89
|
431 # Many Bourne shells cannot handle close brackets correctly
|
cannam@89
|
432 # in scan sets, so we specify it separately.
|
cannam@89
|
433 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
cannam@89
|
434 my_arg="\"$my_arg\""
|
cannam@89
|
435 ;;
|
cannam@89
|
436 esac
|
cannam@89
|
437
|
cannam@89
|
438 func_quote_for_expand_result="$my_arg"
|
cannam@89
|
439 }
|
cannam@89
|
440
|
cannam@89
|
441
|
cannam@89
|
442 # func_show_eval cmd [fail_exp]
|
cannam@89
|
443 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
|
cannam@89
|
444 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
|
cannam@89
|
445 # is given, then evaluate it.
|
cannam@89
|
446 func_show_eval ()
|
cannam@89
|
447 {
|
cannam@89
|
448 my_cmd="$1"
|
cannam@89
|
449 my_fail_exp="${2-:}"
|
cannam@89
|
450
|
cannam@89
|
451 ${opt_silent-false} || {
|
cannam@89
|
452 func_quote_for_expand "$my_cmd"
|
cannam@89
|
453 eval "func_echo $func_quote_for_expand_result"
|
cannam@89
|
454 }
|
cannam@89
|
455
|
cannam@89
|
456 if ${opt_dry_run-false}; then :; else
|
cannam@89
|
457 eval "$my_cmd"
|
cannam@89
|
458 my_status=$?
|
cannam@89
|
459 if test "$my_status" -eq 0; then :; else
|
cannam@89
|
460 eval "(exit $my_status); $my_fail_exp"
|
cannam@89
|
461 fi
|
cannam@89
|
462 fi
|
cannam@89
|
463 }
|
cannam@89
|
464
|
cannam@89
|
465
|
cannam@89
|
466 # func_show_eval_locale cmd [fail_exp]
|
cannam@89
|
467 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
|
cannam@89
|
468 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
|
cannam@89
|
469 # is given, then evaluate it. Use the saved locale for evaluation.
|
cannam@89
|
470 func_show_eval_locale ()
|
cannam@89
|
471 {
|
cannam@89
|
472 my_cmd="$1"
|
cannam@89
|
473 my_fail_exp="${2-:}"
|
cannam@89
|
474
|
cannam@89
|
475 ${opt_silent-false} || {
|
cannam@89
|
476 func_quote_for_expand "$my_cmd"
|
cannam@89
|
477 eval "func_echo $func_quote_for_expand_result"
|
cannam@89
|
478 }
|
cannam@89
|
479
|
cannam@89
|
480 if ${opt_dry_run-false}; then :; else
|
cannam@89
|
481 eval "$lt_user_locale
|
cannam@89
|
482 $my_cmd"
|
cannam@89
|
483 my_status=$?
|
cannam@89
|
484 eval "$lt_safe_locale"
|
cannam@89
|
485 if test "$my_status" -eq 0; then :; else
|
cannam@89
|
486 eval "(exit $my_status); $my_fail_exp"
|
cannam@89
|
487 fi
|
cannam@89
|
488 fi
|
cannam@89
|
489 }
|
cannam@89
|
490
|
cannam@89
|
491
|
cannam@89
|
492
|
cannam@89
|
493
|
cannam@89
|
494
|
cannam@89
|
495 # func_version
|
cannam@89
|
496 # Echo version message to standard output and exit.
|
cannam@89
|
497 func_version ()
|
cannam@89
|
498 {
|
cannam@89
|
499 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
|
cannam@89
|
500 s/^# //
|
cannam@89
|
501 s/^# *$//
|
cannam@89
|
502 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
|
cannam@89
|
503 p
|
cannam@89
|
504 }' < "$progpath"
|
cannam@89
|
505 exit $?
|
cannam@89
|
506 }
|
cannam@89
|
507
|
cannam@89
|
508 # func_usage
|
cannam@89
|
509 # Echo short help message to standard output and exit.
|
cannam@89
|
510 func_usage ()
|
cannam@89
|
511 {
|
cannam@89
|
512 $SED -n '/^# Usage:/,/# -h/ {
|
cannam@89
|
513 s/^# //
|
cannam@89
|
514 s/^# *$//
|
cannam@89
|
515 s/\$progname/'$progname'/
|
cannam@89
|
516 p
|
cannam@89
|
517 }' < "$progpath"
|
cannam@89
|
518 $ECHO
|
cannam@89
|
519 $ECHO "run \`$progname --help | more' for full usage"
|
cannam@89
|
520 exit $?
|
cannam@89
|
521 }
|
cannam@89
|
522
|
cannam@89
|
523 # func_help
|
cannam@89
|
524 # Echo long help message to standard output and exit.
|
cannam@89
|
525 func_help ()
|
cannam@89
|
526 {
|
cannam@89
|
527 $SED -n '/^# Usage:/,/# Report bugs to/ {
|
cannam@89
|
528 s/^# //
|
cannam@89
|
529 s/^# *$//
|
cannam@89
|
530 s*\$progname*'$progname'*
|
cannam@89
|
531 s*\$host*'"$host"'*
|
cannam@89
|
532 s*\$SHELL*'"$SHELL"'*
|
cannam@89
|
533 s*\$LTCC*'"$LTCC"'*
|
cannam@89
|
534 s*\$LTCFLAGS*'"$LTCFLAGS"'*
|
cannam@89
|
535 s*\$LD*'"$LD"'*
|
cannam@89
|
536 s/\$with_gnu_ld/'"$with_gnu_ld"'/
|
cannam@89
|
537 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
|
cannam@89
|
538 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
|
cannam@89
|
539 p
|
cannam@89
|
540 }' < "$progpath"
|
cannam@89
|
541 exit $?
|
cannam@89
|
542 }
|
cannam@89
|
543
|
cannam@89
|
544 # func_missing_arg argname
|
cannam@89
|
545 # Echo program name prefixed message to standard error and set global
|
cannam@89
|
546 # exit_cmd.
|
cannam@89
|
547 func_missing_arg ()
|
cannam@89
|
548 {
|
cannam@89
|
549 func_error "missing argument for $1"
|
cannam@89
|
550 exit_cmd=exit
|
cannam@89
|
551 }
|
cannam@89
|
552
|
cannam@89
|
553 exit_cmd=:
|
cannam@89
|
554
|
cannam@89
|
555
|
cannam@89
|
556
|
cannam@89
|
557
|
cannam@89
|
558
|
cannam@89
|
559 # Check that we have a working $ECHO.
|
cannam@89
|
560 if test "X$1" = X--no-reexec; then
|
cannam@89
|
561 # Discard the --no-reexec flag, and continue.
|
cannam@89
|
562 shift
|
cannam@89
|
563 elif test "X$1" = X--fallback-echo; then
|
cannam@89
|
564 # Avoid inline document here, it may be left over
|
cannam@89
|
565 :
|
cannam@89
|
566 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
|
cannam@89
|
567 # Yippee, $ECHO works!
|
cannam@89
|
568 :
|
cannam@89
|
569 else
|
cannam@89
|
570 # Restart under the correct shell, and then maybe $ECHO will work.
|
cannam@89
|
571 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
|
cannam@89
|
572 fi
|
cannam@89
|
573
|
cannam@89
|
574 if test "X$1" = X--fallback-echo; then
|
cannam@89
|
575 # used as fallback echo
|
cannam@89
|
576 shift
|
cannam@89
|
577 cat <<EOF
|
cannam@89
|
578 $*
|
cannam@89
|
579 EOF
|
cannam@89
|
580 exit $EXIT_SUCCESS
|
cannam@89
|
581 fi
|
cannam@89
|
582
|
cannam@89
|
583 magic="%%%MAGIC variable%%%"
|
cannam@89
|
584 magic_exe="%%%MAGIC EXE variable%%%"
|
cannam@89
|
585
|
cannam@89
|
586 # Global variables.
|
cannam@89
|
587 # $mode is unset
|
cannam@89
|
588 nonopt=
|
cannam@89
|
589 execute_dlfiles=
|
cannam@89
|
590 preserve_args=
|
cannam@89
|
591 lo2o="s/\\.lo\$/.${objext}/"
|
cannam@89
|
592 o2lo="s/\\.${objext}\$/.lo/"
|
cannam@89
|
593 extracted_archives=
|
cannam@89
|
594 extracted_serial=0
|
cannam@89
|
595
|
cannam@89
|
596 opt_dry_run=false
|
cannam@89
|
597 opt_duplicate_deps=false
|
cannam@89
|
598 opt_silent=false
|
cannam@89
|
599 opt_debug=:
|
cannam@89
|
600
|
cannam@89
|
601 # If this variable is set in any of the actions, the command in it
|
cannam@89
|
602 # will be execed at the end. This prevents here-documents from being
|
cannam@89
|
603 # left over by shells.
|
cannam@89
|
604 exec_cmd=
|
cannam@89
|
605
|
cannam@89
|
606 # func_fatal_configuration arg...
|
cannam@89
|
607 # Echo program name prefixed message to standard error, followed by
|
cannam@89
|
608 # a configuration failure hint, and exit.
|
cannam@89
|
609 func_fatal_configuration ()
|
cannam@89
|
610 {
|
cannam@89
|
611 func_error ${1+"$@"}
|
cannam@89
|
612 func_error "See the $PACKAGE documentation for more information."
|
cannam@89
|
613 func_fatal_error "Fatal configuration error."
|
cannam@89
|
614 }
|
cannam@89
|
615
|
cannam@89
|
616
|
cannam@89
|
617 # func_config
|
cannam@89
|
618 # Display the configuration for all the tags in this script.
|
cannam@89
|
619 func_config ()
|
cannam@89
|
620 {
|
cannam@89
|
621 re_begincf='^# ### BEGIN LIBTOOL'
|
cannam@89
|
622 re_endcf='^# ### END LIBTOOL'
|
cannam@89
|
623
|
cannam@89
|
624 # Default configuration.
|
cannam@89
|
625 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
|
cannam@89
|
626
|
cannam@89
|
627 # Now print the configurations for the tags.
|
cannam@89
|
628 for tagname in $taglist; do
|
cannam@89
|
629 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
|
cannam@89
|
630 done
|
cannam@89
|
631
|
cannam@89
|
632 exit $?
|
cannam@89
|
633 }
|
cannam@89
|
634
|
cannam@89
|
635 # func_features
|
cannam@89
|
636 # Display the features supported by this script.
|
cannam@89
|
637 func_features ()
|
cannam@89
|
638 {
|
cannam@89
|
639 $ECHO "host: $host"
|
cannam@89
|
640 if test "$build_libtool_libs" = yes; then
|
cannam@89
|
641 $ECHO "enable shared libraries"
|
cannam@89
|
642 else
|
cannam@89
|
643 $ECHO "disable shared libraries"
|
cannam@89
|
644 fi
|
cannam@89
|
645 if test "$build_old_libs" = yes; then
|
cannam@89
|
646 $ECHO "enable static libraries"
|
cannam@89
|
647 else
|
cannam@89
|
648 $ECHO "disable static libraries"
|
cannam@89
|
649 fi
|
cannam@89
|
650
|
cannam@89
|
651 exit $?
|
cannam@89
|
652 }
|
cannam@89
|
653
|
cannam@89
|
654 # func_enable_tag tagname
|
cannam@89
|
655 # Verify that TAGNAME is valid, and either flag an error and exit, or
|
cannam@89
|
656 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
|
cannam@89
|
657 # variable here.
|
cannam@89
|
658 func_enable_tag ()
|
cannam@89
|
659 {
|
cannam@89
|
660 # Global variable:
|
cannam@89
|
661 tagname="$1"
|
cannam@89
|
662
|
cannam@89
|
663 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
|
cannam@89
|
664 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
|
cannam@89
|
665 sed_extractcf="/$re_begincf/,/$re_endcf/p"
|
cannam@89
|
666
|
cannam@89
|
667 # Validate tagname.
|
cannam@89
|
668 case $tagname in
|
cannam@89
|
669 *[!-_A-Za-z0-9,/]*)
|
cannam@89
|
670 func_fatal_error "invalid tag name: $tagname"
|
cannam@89
|
671 ;;
|
cannam@89
|
672 esac
|
cannam@89
|
673
|
cannam@89
|
674 # Don't test for the "default" C tag, as we know it's
|
cannam@89
|
675 # there but not specially marked.
|
cannam@89
|
676 case $tagname in
|
cannam@89
|
677 CC) ;;
|
cannam@89
|
678 *)
|
cannam@89
|
679 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
|
cannam@89
|
680 taglist="$taglist $tagname"
|
cannam@89
|
681
|
cannam@89
|
682 # Evaluate the configuration. Be careful to quote the path
|
cannam@89
|
683 # and the sed script, to avoid splitting on whitespace, but
|
cannam@89
|
684 # also don't use non-portable quotes within backquotes within
|
cannam@89
|
685 # quotes we have to do it in 2 steps:
|
cannam@89
|
686 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
|
cannam@89
|
687 eval "$extractedcf"
|
cannam@89
|
688 else
|
cannam@89
|
689 func_error "ignoring unknown tag $tagname"
|
cannam@89
|
690 fi
|
cannam@89
|
691 ;;
|
cannam@89
|
692 esac
|
cannam@89
|
693 }
|
cannam@89
|
694
|
cannam@89
|
695 # Parse options once, thoroughly. This comes as soon as possible in
|
cannam@89
|
696 # the script to make things like `libtool --version' happen quickly.
|
cannam@89
|
697 {
|
cannam@89
|
698
|
cannam@89
|
699 # Shorthand for --mode=foo, only valid as the first argument
|
cannam@89
|
700 case $1 in
|
cannam@89
|
701 clean|clea|cle|cl)
|
cannam@89
|
702 shift; set dummy --mode clean ${1+"$@"}; shift
|
cannam@89
|
703 ;;
|
cannam@89
|
704 compile|compil|compi|comp|com|co|c)
|
cannam@89
|
705 shift; set dummy --mode compile ${1+"$@"}; shift
|
cannam@89
|
706 ;;
|
cannam@89
|
707 execute|execut|execu|exec|exe|ex|e)
|
cannam@89
|
708 shift; set dummy --mode execute ${1+"$@"}; shift
|
cannam@89
|
709 ;;
|
cannam@89
|
710 finish|finis|fini|fin|fi|f)
|
cannam@89
|
711 shift; set dummy --mode finish ${1+"$@"}; shift
|
cannam@89
|
712 ;;
|
cannam@89
|
713 install|instal|insta|inst|ins|in|i)
|
cannam@89
|
714 shift; set dummy --mode install ${1+"$@"}; shift
|
cannam@89
|
715 ;;
|
cannam@89
|
716 link|lin|li|l)
|
cannam@89
|
717 shift; set dummy --mode link ${1+"$@"}; shift
|
cannam@89
|
718 ;;
|
cannam@89
|
719 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
|
cannam@89
|
720 shift; set dummy --mode uninstall ${1+"$@"}; shift
|
cannam@89
|
721 ;;
|
cannam@89
|
722 esac
|
cannam@89
|
723
|
cannam@89
|
724 # Parse non-mode specific arguments:
|
cannam@89
|
725 while test "$#" -gt 0; do
|
cannam@89
|
726 opt="$1"
|
cannam@89
|
727 shift
|
cannam@89
|
728
|
cannam@89
|
729 case $opt in
|
cannam@89
|
730 --config) func_config ;;
|
cannam@89
|
731
|
cannam@89
|
732 --debug) preserve_args="$preserve_args $opt"
|
cannam@89
|
733 func_echo "enabling shell trace mode"
|
cannam@89
|
734 opt_debug='set -x'
|
cannam@89
|
735 $opt_debug
|
cannam@89
|
736 ;;
|
cannam@89
|
737
|
cannam@89
|
738 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
|
cannam@89
|
739 execute_dlfiles="$execute_dlfiles $1"
|
cannam@89
|
740 shift
|
cannam@89
|
741 ;;
|
cannam@89
|
742
|
cannam@89
|
743 --dry-run | -n) opt_dry_run=: ;;
|
cannam@89
|
744 --features) func_features ;;
|
cannam@89
|
745 --finish) mode="finish" ;;
|
cannam@89
|
746
|
cannam@89
|
747 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
|
cannam@89
|
748 case $1 in
|
cannam@89
|
749 # Valid mode arguments:
|
cannam@89
|
750 clean) ;;
|
cannam@89
|
751 compile) ;;
|
cannam@89
|
752 execute) ;;
|
cannam@89
|
753 finish) ;;
|
cannam@89
|
754 install) ;;
|
cannam@89
|
755 link) ;;
|
cannam@89
|
756 relink) ;;
|
cannam@89
|
757 uninstall) ;;
|
cannam@89
|
758
|
cannam@89
|
759 # Catch anything else as an error
|
cannam@89
|
760 *) func_error "invalid argument for $opt"
|
cannam@89
|
761 exit_cmd=exit
|
cannam@89
|
762 break
|
cannam@89
|
763 ;;
|
cannam@89
|
764 esac
|
cannam@89
|
765
|
cannam@89
|
766 mode="$1"
|
cannam@89
|
767 shift
|
cannam@89
|
768 ;;
|
cannam@89
|
769
|
cannam@89
|
770 --preserve-dup-deps)
|
cannam@89
|
771 opt_duplicate_deps=: ;;
|
cannam@89
|
772
|
cannam@89
|
773 --quiet|--silent) preserve_args="$preserve_args $opt"
|
cannam@89
|
774 opt_silent=:
|
cannam@89
|
775 ;;
|
cannam@89
|
776
|
cannam@89
|
777 --verbose| -v) preserve_args="$preserve_args $opt"
|
cannam@89
|
778 opt_silent=false
|
cannam@89
|
779 ;;
|
cannam@89
|
780
|
cannam@89
|
781 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
|
cannam@89
|
782 preserve_args="$preserve_args $opt $1"
|
cannam@89
|
783 func_enable_tag "$1" # tagname is set here
|
cannam@89
|
784 shift
|
cannam@89
|
785 ;;
|
cannam@89
|
786
|
cannam@89
|
787 # Separate optargs to long options:
|
cannam@89
|
788 -dlopen=*|--mode=*|--tag=*)
|
cannam@89
|
789 func_opt_split "$opt"
|
cannam@89
|
790 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
|
cannam@89
|
791 shift
|
cannam@89
|
792 ;;
|
cannam@89
|
793
|
cannam@89
|
794 -\?|-h) func_usage ;;
|
cannam@89
|
795 --help) opt_help=: ;;
|
cannam@89
|
796 --version) func_version ;;
|
cannam@89
|
797
|
cannam@89
|
798 -*) func_fatal_help "unrecognized option \`$opt'" ;;
|
cannam@89
|
799
|
cannam@89
|
800 *) nonopt="$opt"
|
cannam@89
|
801 break
|
cannam@89
|
802 ;;
|
cannam@89
|
803 esac
|
cannam@89
|
804 done
|
cannam@89
|
805
|
cannam@89
|
806
|
cannam@89
|
807 case $host in
|
cannam@89
|
808 *cygwin* | *mingw* | *pw32*)
|
cannam@89
|
809 # don't eliminate duplications in $postdeps and $predeps
|
cannam@89
|
810 opt_duplicate_compiler_generated_deps=:
|
cannam@89
|
811 ;;
|
cannam@89
|
812 *)
|
cannam@89
|
813 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
|
cannam@89
|
814 ;;
|
cannam@89
|
815 esac
|
cannam@89
|
816
|
cannam@89
|
817 # Having warned about all mis-specified options, bail out if
|
cannam@89
|
818 # anything was wrong.
|
cannam@89
|
819 $exit_cmd $EXIT_FAILURE
|
cannam@89
|
820 }
|
cannam@89
|
821
|
cannam@89
|
822 # func_check_version_match
|
cannam@89
|
823 # Ensure that we are using m4 macros, and libtool script from the same
|
cannam@89
|
824 # release of libtool.
|
cannam@89
|
825 func_check_version_match ()
|
cannam@89
|
826 {
|
cannam@89
|
827 if test "$package_revision" != "$macro_revision"; then
|
cannam@89
|
828 if test "$VERSION" != "$macro_version"; then
|
cannam@89
|
829 if test -z "$macro_version"; then
|
cannam@89
|
830 cat >&2 <<_LT_EOF
|
cannam@89
|
831 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
|
cannam@89
|
832 $progname: definition of this LT_INIT comes from an older release.
|
cannam@89
|
833 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
|
cannam@89
|
834 $progname: and run autoconf again.
|
cannam@89
|
835 _LT_EOF
|
cannam@89
|
836 else
|
cannam@89
|
837 cat >&2 <<_LT_EOF
|
cannam@89
|
838 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
|
cannam@89
|
839 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
|
cannam@89
|
840 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
|
cannam@89
|
841 $progname: and run autoconf again.
|
cannam@89
|
842 _LT_EOF
|
cannam@89
|
843 fi
|
cannam@89
|
844 else
|
cannam@89
|
845 cat >&2 <<_LT_EOF
|
cannam@89
|
846 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
|
cannam@89
|
847 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
|
cannam@89
|
848 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
|
cannam@89
|
849 $progname: of $PACKAGE $VERSION and run autoconf again.
|
cannam@89
|
850 _LT_EOF
|
cannam@89
|
851 fi
|
cannam@89
|
852
|
cannam@89
|
853 exit $EXIT_MISMATCH
|
cannam@89
|
854 fi
|
cannam@89
|
855 }
|
cannam@89
|
856
|
cannam@89
|
857
|
cannam@89
|
858 ## ----------- ##
|
cannam@89
|
859 ## Main. ##
|
cannam@89
|
860 ## ----------- ##
|
cannam@89
|
861
|
cannam@89
|
862 $opt_help || {
|
cannam@89
|
863 # Sanity checks first:
|
cannam@89
|
864 func_check_version_match
|
cannam@89
|
865
|
cannam@89
|
866 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
|
cannam@89
|
867 func_fatal_configuration "not configured to build any kind of library"
|
cannam@89
|
868 fi
|
cannam@89
|
869
|
cannam@89
|
870 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
|
cannam@89
|
871
|
cannam@89
|
872
|
cannam@89
|
873 # Darwin sucks
|
cannam@89
|
874 eval std_shrext=\"$shrext_cmds\"
|
cannam@89
|
875
|
cannam@89
|
876
|
cannam@89
|
877 # Only execute mode is allowed to have -dlopen flags.
|
cannam@89
|
878 if test -n "$execute_dlfiles" && test "$mode" != execute; then
|
cannam@89
|
879 func_error "unrecognized option \`-dlopen'"
|
cannam@89
|
880 $ECHO "$help" 1>&2
|
cannam@89
|
881 exit $EXIT_FAILURE
|
cannam@89
|
882 fi
|
cannam@89
|
883
|
cannam@89
|
884 # Change the help message to a mode-specific one.
|
cannam@89
|
885 generic_help="$help"
|
cannam@89
|
886 help="Try \`$progname --help --mode=$mode' for more information."
|
cannam@89
|
887 }
|
cannam@89
|
888
|
cannam@89
|
889
|
cannam@89
|
890 # func_lalib_p file
|
cannam@89
|
891 # True iff FILE is a libtool `.la' library or `.lo' object file.
|
cannam@89
|
892 # This function is only a basic sanity check; it will hardly flush out
|
cannam@89
|
893 # determined imposters.
|
cannam@89
|
894 func_lalib_p ()
|
cannam@89
|
895 {
|
cannam@89
|
896 $SED -e 4q "$1" 2>/dev/null \
|
cannam@89
|
897 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
|
cannam@89
|
898 }
|
cannam@89
|
899
|
cannam@89
|
900 # func_lalib_unsafe_p file
|
cannam@89
|
901 # True iff FILE is a libtool `.la' library or `.lo' object file.
|
cannam@89
|
902 # This function implements the same check as func_lalib_p without
|
cannam@89
|
903 # resorting to external programs. To this end, it redirects stdin and
|
cannam@89
|
904 # closes it afterwards, without saving the original file descriptor.
|
cannam@89
|
905 # As a safety measure, use it only where a negative result would be
|
cannam@89
|
906 # fatal anyway. Works if `file' does not exist.
|
cannam@89
|
907 func_lalib_unsafe_p ()
|
cannam@89
|
908 {
|
cannam@89
|
909 lalib_p=no
|
cannam@89
|
910 if test -r "$1" && exec 5<&0 <"$1"; then
|
cannam@89
|
911 for lalib_p_l in 1 2 3 4
|
cannam@89
|
912 do
|
cannam@89
|
913 read lalib_p_line
|
cannam@89
|
914 case "$lalib_p_line" in
|
cannam@89
|
915 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
|
cannam@89
|
916 esac
|
cannam@89
|
917 done
|
cannam@89
|
918 exec 0<&5 5<&-
|
cannam@89
|
919 fi
|
cannam@89
|
920 test "$lalib_p" = yes
|
cannam@89
|
921 }
|
cannam@89
|
922
|
cannam@89
|
923 # func_ltwrapper_script_p file
|
cannam@89
|
924 # True iff FILE is a libtool wrapper script
|
cannam@89
|
925 # This function is only a basic sanity check; it will hardly flush out
|
cannam@89
|
926 # determined imposters.
|
cannam@89
|
927 func_ltwrapper_script_p ()
|
cannam@89
|
928 {
|
cannam@89
|
929 func_lalib_p "$1"
|
cannam@89
|
930 }
|
cannam@89
|
931
|
cannam@89
|
932 # func_ltwrapper_executable_p file
|
cannam@89
|
933 # True iff FILE is a libtool wrapper executable
|
cannam@89
|
934 # This function is only a basic sanity check; it will hardly flush out
|
cannam@89
|
935 # determined imposters.
|
cannam@89
|
936 func_ltwrapper_executable_p ()
|
cannam@89
|
937 {
|
cannam@89
|
938 func_ltwrapper_exec_suffix=
|
cannam@89
|
939 case $1 in
|
cannam@89
|
940 *.exe) ;;
|
cannam@89
|
941 *) func_ltwrapper_exec_suffix=.exe ;;
|
cannam@89
|
942 esac
|
cannam@89
|
943 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
|
cannam@89
|
944 }
|
cannam@89
|
945
|
cannam@89
|
946 # func_ltwrapper_scriptname file
|
cannam@89
|
947 # Assumes file is an ltwrapper_executable
|
cannam@89
|
948 # uses $file to determine the appropriate filename for a
|
cannam@89
|
949 # temporary ltwrapper_script.
|
cannam@89
|
950 func_ltwrapper_scriptname ()
|
cannam@89
|
951 {
|
cannam@89
|
952 func_ltwrapper_scriptname_result=""
|
cannam@89
|
953 if func_ltwrapper_executable_p "$1"; then
|
cannam@89
|
954 func_dirname_and_basename "$1" "" "."
|
cannam@89
|
955 func_stripname '' '.exe' "$func_basename_result"
|
cannam@89
|
956 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
|
cannam@89
|
957 fi
|
cannam@89
|
958 }
|
cannam@89
|
959
|
cannam@89
|
960 # func_ltwrapper_p file
|
cannam@89
|
961 # True iff FILE is a libtool wrapper script or wrapper executable
|
cannam@89
|
962 # This function is only a basic sanity check; it will hardly flush out
|
cannam@89
|
963 # determined imposters.
|
cannam@89
|
964 func_ltwrapper_p ()
|
cannam@89
|
965 {
|
cannam@89
|
966 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
|
cannam@89
|
967 }
|
cannam@89
|
968
|
cannam@89
|
969
|
cannam@89
|
970 # func_execute_cmds commands fail_cmd
|
cannam@89
|
971 # Execute tilde-delimited COMMANDS.
|
cannam@89
|
972 # If FAIL_CMD is given, eval that upon failure.
|
cannam@89
|
973 # FAIL_CMD may read-access the current command in variable CMD!
|
cannam@89
|
974 func_execute_cmds ()
|
cannam@89
|
975 {
|
cannam@89
|
976 $opt_debug
|
cannam@89
|
977 save_ifs=$IFS; IFS='~'
|
cannam@89
|
978 for cmd in $1; do
|
cannam@89
|
979 IFS=$save_ifs
|
cannam@89
|
980 eval cmd=\"$cmd\"
|
cannam@89
|
981 func_show_eval "$cmd" "${2-:}"
|
cannam@89
|
982 done
|
cannam@89
|
983 IFS=$save_ifs
|
cannam@89
|
984 }
|
cannam@89
|
985
|
cannam@89
|
986
|
cannam@89
|
987 # func_source file
|
cannam@89
|
988 # Source FILE, adding directory component if necessary.
|
cannam@89
|
989 # Note that it is not necessary on cygwin/mingw to append a dot to
|
cannam@89
|
990 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
|
cannam@89
|
991 # behavior happens only for exec(3), not for open(2)! Also, sourcing
|
cannam@89
|
992 # `FILE.' does not work on cygwin managed mounts.
|
cannam@89
|
993 func_source ()
|
cannam@89
|
994 {
|
cannam@89
|
995 $opt_debug
|
cannam@89
|
996 case $1 in
|
cannam@89
|
997 */* | *\\*) . "$1" ;;
|
cannam@89
|
998 *) . "./$1" ;;
|
cannam@89
|
999 esac
|
cannam@89
|
1000 }
|
cannam@89
|
1001
|
cannam@89
|
1002
|
cannam@89
|
1003 # func_infer_tag arg
|
cannam@89
|
1004 # Infer tagged configuration to use if any are available and
|
cannam@89
|
1005 # if one wasn't chosen via the "--tag" command line option.
|
cannam@89
|
1006 # Only attempt this if the compiler in the base compile
|
cannam@89
|
1007 # command doesn't match the default compiler.
|
cannam@89
|
1008 # arg is usually of the form 'gcc ...'
|
cannam@89
|
1009 func_infer_tag ()
|
cannam@89
|
1010 {
|
cannam@89
|
1011 $opt_debug
|
cannam@89
|
1012 if test -n "$available_tags" && test -z "$tagname"; then
|
cannam@89
|
1013 CC_quoted=
|
cannam@89
|
1014 for arg in $CC; do
|
cannam@89
|
1015 func_quote_for_eval "$arg"
|
cannam@89
|
1016 CC_quoted="$CC_quoted $func_quote_for_eval_result"
|
cannam@89
|
1017 done
|
cannam@89
|
1018 case $@ in
|
cannam@89
|
1019 # Blanks in the command may have been stripped by the calling shell,
|
cannam@89
|
1020 # but not from the CC environment variable when configure was run.
|
cannam@89
|
1021 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
|
cannam@89
|
1022 # Blanks at the start of $base_compile will cause this to fail
|
cannam@89
|
1023 # if we don't check for them as well.
|
cannam@89
|
1024 *)
|
cannam@89
|
1025 for z in $available_tags; do
|
cannam@89
|
1026 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
|
cannam@89
|
1027 # Evaluate the configuration.
|
cannam@89
|
1028 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
|
cannam@89
|
1029 CC_quoted=
|
cannam@89
|
1030 for arg in $CC; do
|
cannam@89
|
1031 # Double-quote args containing other shell metacharacters.
|
cannam@89
|
1032 func_quote_for_eval "$arg"
|
cannam@89
|
1033 CC_quoted="$CC_quoted $func_quote_for_eval_result"
|
cannam@89
|
1034 done
|
cannam@89
|
1035 case "$@ " in
|
cannam@89
|
1036 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
|
cannam@89
|
1037 # The compiler in the base compile command matches
|
cannam@89
|
1038 # the one in the tagged configuration.
|
cannam@89
|
1039 # Assume this is the tagged configuration we want.
|
cannam@89
|
1040 tagname=$z
|
cannam@89
|
1041 break
|
cannam@89
|
1042 ;;
|
cannam@89
|
1043 esac
|
cannam@89
|
1044 fi
|
cannam@89
|
1045 done
|
cannam@89
|
1046 # If $tagname still isn't set, then no tagged configuration
|
cannam@89
|
1047 # was found and let the user know that the "--tag" command
|
cannam@89
|
1048 # line option must be used.
|
cannam@89
|
1049 if test -z "$tagname"; then
|
cannam@89
|
1050 func_echo "unable to infer tagged configuration"
|
cannam@89
|
1051 func_fatal_error "specify a tag with \`--tag'"
|
cannam@89
|
1052 # else
|
cannam@89
|
1053 # func_verbose "using $tagname tagged configuration"
|
cannam@89
|
1054 fi
|
cannam@89
|
1055 ;;
|
cannam@89
|
1056 esac
|
cannam@89
|
1057 fi
|
cannam@89
|
1058 }
|
cannam@89
|
1059
|
cannam@89
|
1060
|
cannam@89
|
1061
|
cannam@89
|
1062 # func_write_libtool_object output_name pic_name nonpic_name
|
cannam@89
|
1063 # Create a libtool object file (analogous to a ".la" file),
|
cannam@89
|
1064 # but don't create it if we're doing a dry run.
|
cannam@89
|
1065 func_write_libtool_object ()
|
cannam@89
|
1066 {
|
cannam@89
|
1067 write_libobj=${1}
|
cannam@89
|
1068 if test "$build_libtool_libs" = yes; then
|
cannam@89
|
1069 write_lobj=\'${2}\'
|
cannam@89
|
1070 else
|
cannam@89
|
1071 write_lobj=none
|
cannam@89
|
1072 fi
|
cannam@89
|
1073
|
cannam@89
|
1074 if test "$build_old_libs" = yes; then
|
cannam@89
|
1075 write_oldobj=\'${3}\'
|
cannam@89
|
1076 else
|
cannam@89
|
1077 write_oldobj=none
|
cannam@89
|
1078 fi
|
cannam@89
|
1079
|
cannam@89
|
1080 $opt_dry_run || {
|
cannam@89
|
1081 cat >${write_libobj}T <<EOF
|
cannam@89
|
1082 # $write_libobj - a libtool object file
|
cannam@89
|
1083 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
|
cannam@89
|
1084 #
|
cannam@89
|
1085 # Please DO NOT delete this file!
|
cannam@89
|
1086 # It is necessary for linking the library.
|
cannam@89
|
1087
|
cannam@89
|
1088 # Name of the PIC object.
|
cannam@89
|
1089 pic_object=$write_lobj
|
cannam@89
|
1090
|
cannam@89
|
1091 # Name of the non-PIC object
|
cannam@89
|
1092 non_pic_object=$write_oldobj
|
cannam@89
|
1093
|
cannam@89
|
1094 EOF
|
cannam@89
|
1095 $MV "${write_libobj}T" "${write_libobj}"
|
cannam@89
|
1096 }
|
cannam@89
|
1097 }
|
cannam@89
|
1098
|
cannam@89
|
1099 # func_mode_compile arg...
|
cannam@89
|
1100 func_mode_compile ()
|
cannam@89
|
1101 {
|
cannam@89
|
1102 $opt_debug
|
cannam@89
|
1103 # Get the compilation command and the source file.
|
cannam@89
|
1104 base_compile=
|
cannam@89
|
1105 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
|
cannam@89
|
1106 suppress_opt=yes
|
cannam@89
|
1107 suppress_output=
|
cannam@89
|
1108 arg_mode=normal
|
cannam@89
|
1109 libobj=
|
cannam@89
|
1110 later=
|
cannam@89
|
1111 pie_flag=
|
cannam@89
|
1112
|
cannam@89
|
1113 for arg
|
cannam@89
|
1114 do
|
cannam@89
|
1115 case $arg_mode in
|
cannam@89
|
1116 arg )
|
cannam@89
|
1117 # do not "continue". Instead, add this to base_compile
|
cannam@89
|
1118 lastarg="$arg"
|
cannam@89
|
1119 arg_mode=normal
|
cannam@89
|
1120 ;;
|
cannam@89
|
1121
|
cannam@89
|
1122 target )
|
cannam@89
|
1123 libobj="$arg"
|
cannam@89
|
1124 arg_mode=normal
|
cannam@89
|
1125 continue
|
cannam@89
|
1126 ;;
|
cannam@89
|
1127
|
cannam@89
|
1128 normal )
|
cannam@89
|
1129 # Accept any command-line options.
|
cannam@89
|
1130 case $arg in
|
cannam@89
|
1131 -o)
|
cannam@89
|
1132 test -n "$libobj" && \
|
cannam@89
|
1133 func_fatal_error "you cannot specify \`-o' more than once"
|
cannam@89
|
1134 arg_mode=target
|
cannam@89
|
1135 continue
|
cannam@89
|
1136 ;;
|
cannam@89
|
1137
|
cannam@89
|
1138 -pie | -fpie | -fPIE)
|
cannam@89
|
1139 pie_flag="$pie_flag $arg"
|
cannam@89
|
1140 continue
|
cannam@89
|
1141 ;;
|
cannam@89
|
1142
|
cannam@89
|
1143 -shared | -static | -prefer-pic | -prefer-non-pic)
|
cannam@89
|
1144 later="$later $arg"
|
cannam@89
|
1145 continue
|
cannam@89
|
1146 ;;
|
cannam@89
|
1147
|
cannam@89
|
1148 -no-suppress)
|
cannam@89
|
1149 suppress_opt=no
|
cannam@89
|
1150 continue
|
cannam@89
|
1151 ;;
|
cannam@89
|
1152
|
cannam@89
|
1153 -Xcompiler)
|
cannam@89
|
1154 arg_mode=arg # the next one goes into the "base_compile" arg list
|
cannam@89
|
1155 continue # The current "srcfile" will either be retained or
|
cannam@89
|
1156 ;; # replaced later. I would guess that would be a bug.
|
cannam@89
|
1157
|
cannam@89
|
1158 -Wc,*)
|
cannam@89
|
1159 func_stripname '-Wc,' '' "$arg"
|
cannam@89
|
1160 args=$func_stripname_result
|
cannam@89
|
1161 lastarg=
|
cannam@89
|
1162 save_ifs="$IFS"; IFS=','
|
cannam@89
|
1163 for arg in $args; do
|
cannam@89
|
1164 IFS="$save_ifs"
|
cannam@89
|
1165 func_quote_for_eval "$arg"
|
cannam@89
|
1166 lastarg="$lastarg $func_quote_for_eval_result"
|
cannam@89
|
1167 done
|
cannam@89
|
1168 IFS="$save_ifs"
|
cannam@89
|
1169 func_stripname ' ' '' "$lastarg"
|
cannam@89
|
1170 lastarg=$func_stripname_result
|
cannam@89
|
1171
|
cannam@89
|
1172 # Add the arguments to base_compile.
|
cannam@89
|
1173 base_compile="$base_compile $lastarg"
|
cannam@89
|
1174 continue
|
cannam@89
|
1175 ;;
|
cannam@89
|
1176
|
cannam@89
|
1177 *)
|
cannam@89
|
1178 # Accept the current argument as the source file.
|
cannam@89
|
1179 # The previous "srcfile" becomes the current argument.
|
cannam@89
|
1180 #
|
cannam@89
|
1181 lastarg="$srcfile"
|
cannam@89
|
1182 srcfile="$arg"
|
cannam@89
|
1183 ;;
|
cannam@89
|
1184 esac # case $arg
|
cannam@89
|
1185 ;;
|
cannam@89
|
1186 esac # case $arg_mode
|
cannam@89
|
1187
|
cannam@89
|
1188 # Aesthetically quote the previous argument.
|
cannam@89
|
1189 func_quote_for_eval "$lastarg"
|
cannam@89
|
1190 base_compile="$base_compile $func_quote_for_eval_result"
|
cannam@89
|
1191 done # for arg
|
cannam@89
|
1192
|
cannam@89
|
1193 case $arg_mode in
|
cannam@89
|
1194 arg)
|
cannam@89
|
1195 func_fatal_error "you must specify an argument for -Xcompile"
|
cannam@89
|
1196 ;;
|
cannam@89
|
1197 target)
|
cannam@89
|
1198 func_fatal_error "you must specify a target with \`-o'"
|
cannam@89
|
1199 ;;
|
cannam@89
|
1200 *)
|
cannam@89
|
1201 # Get the name of the library object.
|
cannam@89
|
1202 test -z "$libobj" && {
|
cannam@89
|
1203 func_basename "$srcfile"
|
cannam@89
|
1204 libobj="$func_basename_result"
|
cannam@89
|
1205 }
|
cannam@89
|
1206 ;;
|
cannam@89
|
1207 esac
|
cannam@89
|
1208
|
cannam@89
|
1209 # Recognize several different file suffixes.
|
cannam@89
|
1210 # If the user specifies -o file.o, it is replaced with file.lo
|
cannam@89
|
1211 case $libobj in
|
cannam@89
|
1212 *.[cCFSifmso] | \
|
cannam@89
|
1213 *.ada | *.adb | *.ads | *.asm | \
|
cannam@89
|
1214 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
|
cannam@89
|
1215 *.[fF][09]? | *.for | *.java | *.obj | *.sx)
|
cannam@89
|
1216 func_xform "$libobj"
|
cannam@89
|
1217 libobj=$func_xform_result
|
cannam@89
|
1218 ;;
|
cannam@89
|
1219 esac
|
cannam@89
|
1220
|
cannam@89
|
1221 case $libobj in
|
cannam@89
|
1222 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
|
cannam@89
|
1223 *)
|
cannam@89
|
1224 func_fatal_error "cannot determine name of library object from \`$libobj'"
|
cannam@89
|
1225 ;;
|
cannam@89
|
1226 esac
|
cannam@89
|
1227
|
cannam@89
|
1228 func_infer_tag $base_compile
|
cannam@89
|
1229
|
cannam@89
|
1230 for arg in $later; do
|
cannam@89
|
1231 case $arg in
|
cannam@89
|
1232 -shared)
|
cannam@89
|
1233 test "$build_libtool_libs" != yes && \
|
cannam@89
|
1234 func_fatal_configuration "can not build a shared library"
|
cannam@89
|
1235 build_old_libs=no
|
cannam@89
|
1236 continue
|
cannam@89
|
1237 ;;
|
cannam@89
|
1238
|
cannam@89
|
1239 -static)
|
cannam@89
|
1240 build_libtool_libs=no
|
cannam@89
|
1241 build_old_libs=yes
|
cannam@89
|
1242 continue
|
cannam@89
|
1243 ;;
|
cannam@89
|
1244
|
cannam@89
|
1245 -prefer-pic)
|
cannam@89
|
1246 pic_mode=yes
|
cannam@89
|
1247 continue
|
cannam@89
|
1248 ;;
|
cannam@89
|
1249
|
cannam@89
|
1250 -prefer-non-pic)
|
cannam@89
|
1251 pic_mode=no
|
cannam@89
|
1252 continue
|
cannam@89
|
1253 ;;
|
cannam@89
|
1254 esac
|
cannam@89
|
1255 done
|
cannam@89
|
1256
|
cannam@89
|
1257 func_quote_for_eval "$libobj"
|
cannam@89
|
1258 test "X$libobj" != "X$func_quote_for_eval_result" \
|
cannam@89
|
1259 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
|
cannam@89
|
1260 && func_warning "libobj name \`$libobj' may not contain shell special characters."
|
cannam@89
|
1261 func_dirname_and_basename "$obj" "/" ""
|
cannam@89
|
1262 objname="$func_basename_result"
|
cannam@89
|
1263 xdir="$func_dirname_result"
|
cannam@89
|
1264 lobj=${xdir}$objdir/$objname
|
cannam@89
|
1265
|
cannam@89
|
1266 test -z "$base_compile" && \
|
cannam@89
|
1267 func_fatal_help "you must specify a compilation command"
|
cannam@89
|
1268
|
cannam@89
|
1269 # Delete any leftover library objects.
|
cannam@89
|
1270 if test "$build_old_libs" = yes; then
|
cannam@89
|
1271 removelist="$obj $lobj $libobj ${libobj}T"
|
cannam@89
|
1272 else
|
cannam@89
|
1273 removelist="$lobj $libobj ${libobj}T"
|
cannam@89
|
1274 fi
|
cannam@89
|
1275
|
cannam@89
|
1276 # On Cygwin there's no "real" PIC flag so we must build both object types
|
cannam@89
|
1277 case $host_os in
|
cannam@89
|
1278 cygwin* | mingw* | pw32* | os2*)
|
cannam@89
|
1279 pic_mode=default
|
cannam@89
|
1280 ;;
|
cannam@89
|
1281 esac
|
cannam@89
|
1282 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
|
cannam@89
|
1283 # non-PIC code in shared libraries is not supported
|
cannam@89
|
1284 pic_mode=default
|
cannam@89
|
1285 fi
|
cannam@89
|
1286
|
cannam@89
|
1287 # Calculate the filename of the output object if compiler does
|
cannam@89
|
1288 # not support -o with -c
|
cannam@89
|
1289 if test "$compiler_c_o" = no; then
|
cannam@89
|
1290 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
|
cannam@89
|
1291 lockfile="$output_obj.lock"
|
cannam@89
|
1292 else
|
cannam@89
|
1293 output_obj=
|
cannam@89
|
1294 need_locks=no
|
cannam@89
|
1295 lockfile=
|
cannam@89
|
1296 fi
|
cannam@89
|
1297
|
cannam@89
|
1298 # Lock this critical section if it is needed
|
cannam@89
|
1299 # We use this script file to make the link, it avoids creating a new file
|
cannam@89
|
1300 if test "$need_locks" = yes; then
|
cannam@89
|
1301 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
|
cannam@89
|
1302 func_echo "Waiting for $lockfile to be removed"
|
cannam@89
|
1303 sleep 2
|
cannam@89
|
1304 done
|
cannam@89
|
1305 elif test "$need_locks" = warn; then
|
cannam@89
|
1306 if test -f "$lockfile"; then
|
cannam@89
|
1307 $ECHO "\
|
cannam@89
|
1308 *** ERROR, $lockfile exists and contains:
|
cannam@89
|
1309 `cat $lockfile 2>/dev/null`
|
cannam@89
|
1310
|
cannam@89
|
1311 This indicates that another process is trying to use the same
|
cannam@89
|
1312 temporary object file, and libtool could not work around it because
|
cannam@89
|
1313 your compiler does not support \`-c' and \`-o' together. If you
|
cannam@89
|
1314 repeat this compilation, it may succeed, by chance, but you had better
|
cannam@89
|
1315 avoid parallel builds (make -j) in this platform, or get a better
|
cannam@89
|
1316 compiler."
|
cannam@89
|
1317
|
cannam@89
|
1318 $opt_dry_run || $RM $removelist
|
cannam@89
|
1319 exit $EXIT_FAILURE
|
cannam@89
|
1320 fi
|
cannam@89
|
1321 removelist="$removelist $output_obj"
|
cannam@89
|
1322 $ECHO "$srcfile" > "$lockfile"
|
cannam@89
|
1323 fi
|
cannam@89
|
1324
|
cannam@89
|
1325 $opt_dry_run || $RM $removelist
|
cannam@89
|
1326 removelist="$removelist $lockfile"
|
cannam@89
|
1327 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
|
cannam@89
|
1328
|
cannam@89
|
1329 if test -n "$fix_srcfile_path"; then
|
cannam@89
|
1330 eval srcfile=\"$fix_srcfile_path\"
|
cannam@89
|
1331 fi
|
cannam@89
|
1332 func_quote_for_eval "$srcfile"
|
cannam@89
|
1333 qsrcfile=$func_quote_for_eval_result
|
cannam@89
|
1334
|
cannam@89
|
1335 # Only build a PIC object if we are building libtool libraries.
|
cannam@89
|
1336 if test "$build_libtool_libs" = yes; then
|
cannam@89
|
1337 # Without this assignment, base_compile gets emptied.
|
cannam@89
|
1338 fbsd_hideous_sh_bug=$base_compile
|
cannam@89
|
1339
|
cannam@89
|
1340 if test "$pic_mode" != no; then
|
cannam@89
|
1341 command="$base_compile $qsrcfile $pic_flag"
|
cannam@89
|
1342 else
|
cannam@89
|
1343 # Don't build PIC code
|
cannam@89
|
1344 command="$base_compile $qsrcfile"
|
cannam@89
|
1345 fi
|
cannam@89
|
1346
|
cannam@89
|
1347 func_mkdir_p "$xdir$objdir"
|
cannam@89
|
1348
|
cannam@89
|
1349 if test -z "$output_obj"; then
|
cannam@89
|
1350 # Place PIC objects in $objdir
|
cannam@89
|
1351 command="$command -o $lobj"
|
cannam@89
|
1352 fi
|
cannam@89
|
1353
|
cannam@89
|
1354 func_show_eval_locale "$command" \
|
cannam@89
|
1355 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
|
cannam@89
|
1356
|
cannam@89
|
1357 if test "$need_locks" = warn &&
|
cannam@89
|
1358 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
|
cannam@89
|
1359 $ECHO "\
|
cannam@89
|
1360 *** ERROR, $lockfile contains:
|
cannam@89
|
1361 `cat $lockfile 2>/dev/null`
|
cannam@89
|
1362
|
cannam@89
|
1363 but it should contain:
|
cannam@89
|
1364 $srcfile
|
cannam@89
|
1365
|
cannam@89
|
1366 This indicates that another process is trying to use the same
|
cannam@89
|
1367 temporary object file, and libtool could not work around it because
|
cannam@89
|
1368 your compiler does not support \`-c' and \`-o' together. If you
|
cannam@89
|
1369 repeat this compilation, it may succeed, by chance, but you had better
|
cannam@89
|
1370 avoid parallel builds (make -j) in this platform, or get a better
|
cannam@89
|
1371 compiler."
|
cannam@89
|
1372
|
cannam@89
|
1373 $opt_dry_run || $RM $removelist
|
cannam@89
|
1374 exit $EXIT_FAILURE
|
cannam@89
|
1375 fi
|
cannam@89
|
1376
|
cannam@89
|
1377 # Just move the object if needed, then go on to compile the next one
|
cannam@89
|
1378 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
|
cannam@89
|
1379 func_show_eval '$MV "$output_obj" "$lobj"' \
|
cannam@89
|
1380 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
|
cannam@89
|
1381 fi
|
cannam@89
|
1382
|
cannam@89
|
1383 # Allow error messages only from the first compilation.
|
cannam@89
|
1384 if test "$suppress_opt" = yes; then
|
cannam@89
|
1385 suppress_output=' >/dev/null 2>&1'
|
cannam@89
|
1386 fi
|
cannam@89
|
1387 fi
|
cannam@89
|
1388
|
cannam@89
|
1389 # Only build a position-dependent object if we build old libraries.
|
cannam@89
|
1390 if test "$build_old_libs" = yes; then
|
cannam@89
|
1391 if test "$pic_mode" != yes; then
|
cannam@89
|
1392 # Don't build PIC code
|
cannam@89
|
1393 command="$base_compile $qsrcfile$pie_flag"
|
cannam@89
|
1394 else
|
cannam@89
|
1395 command="$base_compile $qsrcfile $pic_flag"
|
cannam@89
|
1396 fi
|
cannam@89
|
1397 if test "$compiler_c_o" = yes; then
|
cannam@89
|
1398 command="$command -o $obj"
|
cannam@89
|
1399 fi
|
cannam@89
|
1400
|
cannam@89
|
1401 # Suppress compiler output if we already did a PIC compilation.
|
cannam@89
|
1402 command="$command$suppress_output"
|
cannam@89
|
1403 func_show_eval_locale "$command" \
|
cannam@89
|
1404 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
|
cannam@89
|
1405
|
cannam@89
|
1406 if test "$need_locks" = warn &&
|
cannam@89
|
1407 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
|
cannam@89
|
1408 $ECHO "\
|
cannam@89
|
1409 *** ERROR, $lockfile contains:
|
cannam@89
|
1410 `cat $lockfile 2>/dev/null`
|
cannam@89
|
1411
|
cannam@89
|
1412 but it should contain:
|
cannam@89
|
1413 $srcfile
|
cannam@89
|
1414
|
cannam@89
|
1415 This indicates that another process is trying to use the same
|
cannam@89
|
1416 temporary object file, and libtool could not work around it because
|
cannam@89
|
1417 your compiler does not support \`-c' and \`-o' together. If you
|
cannam@89
|
1418 repeat this compilation, it may succeed, by chance, but you had better
|
cannam@89
|
1419 avoid parallel builds (make -j) in this platform, or get a better
|
cannam@89
|
1420 compiler."
|
cannam@89
|
1421
|
cannam@89
|
1422 $opt_dry_run || $RM $removelist
|
cannam@89
|
1423 exit $EXIT_FAILURE
|
cannam@89
|
1424 fi
|
cannam@89
|
1425
|
cannam@89
|
1426 # Just move the object if needed
|
cannam@89
|
1427 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
|
cannam@89
|
1428 func_show_eval '$MV "$output_obj" "$obj"' \
|
cannam@89
|
1429 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
|
cannam@89
|
1430 fi
|
cannam@89
|
1431 fi
|
cannam@89
|
1432
|
cannam@89
|
1433 $opt_dry_run || {
|
cannam@89
|
1434 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
|
cannam@89
|
1435
|
cannam@89
|
1436 # Unlock the critical section if it was locked
|
cannam@89
|
1437 if test "$need_locks" != no; then
|
cannam@89
|
1438 removelist=$lockfile
|
cannam@89
|
1439 $RM "$lockfile"
|
cannam@89
|
1440 fi
|
cannam@89
|
1441 }
|
cannam@89
|
1442
|
cannam@89
|
1443 exit $EXIT_SUCCESS
|
cannam@89
|
1444 }
|
cannam@89
|
1445
|
cannam@89
|
1446 $opt_help || {
|
cannam@89
|
1447 test "$mode" = compile && func_mode_compile ${1+"$@"}
|
cannam@89
|
1448 }
|
cannam@89
|
1449
|
cannam@89
|
1450 func_mode_help ()
|
cannam@89
|
1451 {
|
cannam@89
|
1452 # We need to display help for each of the modes.
|
cannam@89
|
1453 case $mode in
|
cannam@89
|
1454 "")
|
cannam@89
|
1455 # Generic help is extracted from the usage comments
|
cannam@89
|
1456 # at the start of this file.
|
cannam@89
|
1457 func_help
|
cannam@89
|
1458 ;;
|
cannam@89
|
1459
|
cannam@89
|
1460 clean)
|
cannam@89
|
1461 $ECHO \
|
cannam@89
|
1462 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
|
cannam@89
|
1463
|
cannam@89
|
1464 Remove files from the build directory.
|
cannam@89
|
1465
|
cannam@89
|
1466 RM is the name of the program to use to delete files associated with each FILE
|
cannam@89
|
1467 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
|
cannam@89
|
1468 to RM.
|
cannam@89
|
1469
|
cannam@89
|
1470 If FILE is a libtool library, object or program, all the files associated
|
cannam@89
|
1471 with it are deleted. Otherwise, only FILE itself is deleted using RM."
|
cannam@89
|
1472 ;;
|
cannam@89
|
1473
|
cannam@89
|
1474 compile)
|
cannam@89
|
1475 $ECHO \
|
cannam@89
|
1476 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
|
cannam@89
|
1477
|
cannam@89
|
1478 Compile a source file into a libtool library object.
|
cannam@89
|
1479
|
cannam@89
|
1480 This mode accepts the following additional options:
|
cannam@89
|
1481
|
cannam@89
|
1482 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
|
cannam@89
|
1483 -no-suppress do not suppress compiler output for multiple passes
|
cannam@89
|
1484 -prefer-pic try to building PIC objects only
|
cannam@89
|
1485 -prefer-non-pic try to building non-PIC objects only
|
cannam@89
|
1486 -shared do not build a \`.o' file suitable for static linking
|
cannam@89
|
1487 -static only build a \`.o' file suitable for static linking
|
cannam@89
|
1488
|
cannam@89
|
1489 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
|
cannam@89
|
1490 from the given SOURCEFILE.
|
cannam@89
|
1491
|
cannam@89
|
1492 The output file name is determined by removing the directory component from
|
cannam@89
|
1493 SOURCEFILE, then substituting the C source code suffix \`.c' with the
|
cannam@89
|
1494 library object suffix, \`.lo'."
|
cannam@89
|
1495 ;;
|
cannam@89
|
1496
|
cannam@89
|
1497 execute)
|
cannam@89
|
1498 $ECHO \
|
cannam@89
|
1499 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
|
cannam@89
|
1500
|
cannam@89
|
1501 Automatically set library path, then run a program.
|
cannam@89
|
1502
|
cannam@89
|
1503 This mode accepts the following additional options:
|
cannam@89
|
1504
|
cannam@89
|
1505 -dlopen FILE add the directory containing FILE to the library path
|
cannam@89
|
1506
|
cannam@89
|
1507 This mode sets the library path environment variable according to \`-dlopen'
|
cannam@89
|
1508 flags.
|
cannam@89
|
1509
|
cannam@89
|
1510 If any of the ARGS are libtool executable wrappers, then they are translated
|
cannam@89
|
1511 into their corresponding uninstalled binary, and any of their required library
|
cannam@89
|
1512 directories are added to the library path.
|
cannam@89
|
1513
|
cannam@89
|
1514 Then, COMMAND is executed, with ARGS as arguments."
|
cannam@89
|
1515 ;;
|
cannam@89
|
1516
|
cannam@89
|
1517 finish)
|
cannam@89
|
1518 $ECHO \
|
cannam@89
|
1519 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
|
cannam@89
|
1520
|
cannam@89
|
1521 Complete the installation of libtool libraries.
|
cannam@89
|
1522
|
cannam@89
|
1523 Each LIBDIR is a directory that contains libtool libraries.
|
cannam@89
|
1524
|
cannam@89
|
1525 The commands that this mode executes may require superuser privileges. Use
|
cannam@89
|
1526 the \`--dry-run' option if you just want to see what would be executed."
|
cannam@89
|
1527 ;;
|
cannam@89
|
1528
|
cannam@89
|
1529 install)
|
cannam@89
|
1530 $ECHO \
|
cannam@89
|
1531 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
|
cannam@89
|
1532
|
cannam@89
|
1533 Install executables or libraries.
|
cannam@89
|
1534
|
cannam@89
|
1535 INSTALL-COMMAND is the installation command. The first component should be
|
cannam@89
|
1536 either the \`install' or \`cp' program.
|
cannam@89
|
1537
|
cannam@89
|
1538 The following components of INSTALL-COMMAND are treated specially:
|
cannam@89
|
1539
|
cannam@89
|
1540 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
|
cannam@89
|
1541
|
cannam@89
|
1542 The rest of the components are interpreted as arguments to that command (only
|
cannam@89
|
1543 BSD-compatible install options are recognized)."
|
cannam@89
|
1544 ;;
|
cannam@89
|
1545
|
cannam@89
|
1546 link)
|
cannam@89
|
1547 $ECHO \
|
cannam@89
|
1548 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
|
cannam@89
|
1549
|
cannam@89
|
1550 Link object files or libraries together to form another library, or to
|
cannam@89
|
1551 create an executable program.
|
cannam@89
|
1552
|
cannam@89
|
1553 LINK-COMMAND is a command using the C compiler that you would use to create
|
cannam@89
|
1554 a program from several object files.
|
cannam@89
|
1555
|
cannam@89
|
1556 The following components of LINK-COMMAND are treated specially:
|
cannam@89
|
1557
|
cannam@89
|
1558 -all-static do not do any dynamic linking at all
|
cannam@89
|
1559 -avoid-version do not add a version suffix if possible
|
cannam@89
|
1560 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
|
cannam@89
|
1561 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
|
cannam@89
|
1562 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
|
cannam@89
|
1563 -export-symbols SYMFILE
|
cannam@89
|
1564 try to export only the symbols listed in SYMFILE
|
cannam@89
|
1565 -export-symbols-regex REGEX
|
cannam@89
|
1566 try to export only the symbols matching REGEX
|
cannam@89
|
1567 -LLIBDIR search LIBDIR for required installed libraries
|
cannam@89
|
1568 -lNAME OUTPUT-FILE requires the installed library libNAME
|
cannam@89
|
1569 -module build a library that can dlopened
|
cannam@89
|
1570 -no-fast-install disable the fast-install mode
|
cannam@89
|
1571 -no-install link a not-installable executable
|
cannam@89
|
1572 -no-undefined declare that a library does not refer to external symbols
|
cannam@89
|
1573 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
|
cannam@89
|
1574 -objectlist FILE Use a list of object files found in FILE to specify objects
|
cannam@89
|
1575 -precious-files-regex REGEX
|
cannam@89
|
1576 don't remove output files matching REGEX
|
cannam@89
|
1577 -release RELEASE specify package release information
|
cannam@89
|
1578 -rpath LIBDIR the created library will eventually be installed in LIBDIR
|
cannam@89
|
1579 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
|
cannam@89
|
1580 -shared only do dynamic linking of libtool libraries
|
cannam@89
|
1581 -shrext SUFFIX override the standard shared library file extension
|
cannam@89
|
1582 -static do not do any dynamic linking of uninstalled libtool libraries
|
cannam@89
|
1583 -static-libtool-libs
|
cannam@89
|
1584 do not do any dynamic linking of libtool libraries
|
cannam@89
|
1585 -version-info CURRENT[:REVISION[:AGE]]
|
cannam@89
|
1586 specify library version info [each variable defaults to 0]
|
cannam@89
|
1587 -weak LIBNAME declare that the target provides the LIBNAME interface
|
cannam@89
|
1588
|
cannam@89
|
1589 All other options (arguments beginning with \`-') are ignored.
|
cannam@89
|
1590
|
cannam@89
|
1591 Every other argument is treated as a filename. Files ending in \`.la' are
|
cannam@89
|
1592 treated as uninstalled libtool libraries, other files are standard or library
|
cannam@89
|
1593 object files.
|
cannam@89
|
1594
|
cannam@89
|
1595 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
|
cannam@89
|
1596 only library objects (\`.lo' files) may be specified, and \`-rpath' is
|
cannam@89
|
1597 required, except when creating a convenience library.
|
cannam@89
|
1598
|
cannam@89
|
1599 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
|
cannam@89
|
1600 using \`ar' and \`ranlib', or on Windows using \`lib'.
|
cannam@89
|
1601
|
cannam@89
|
1602 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
|
cannam@89
|
1603 is created, otherwise an executable program is created."
|
cannam@89
|
1604 ;;
|
cannam@89
|
1605
|
cannam@89
|
1606 uninstall)
|
cannam@89
|
1607 $ECHO \
|
cannam@89
|
1608 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
|
cannam@89
|
1609
|
cannam@89
|
1610 Remove libraries from an installation directory.
|
cannam@89
|
1611
|
cannam@89
|
1612 RM is the name of the program to use to delete files associated with each FILE
|
cannam@89
|
1613 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
|
cannam@89
|
1614 to RM.
|
cannam@89
|
1615
|
cannam@89
|
1616 If FILE is a libtool library, all the files associated with it are deleted.
|
cannam@89
|
1617 Otherwise, only FILE itself is deleted using RM."
|
cannam@89
|
1618 ;;
|
cannam@89
|
1619
|
cannam@89
|
1620 *)
|
cannam@89
|
1621 func_fatal_help "invalid operation mode \`$mode'"
|
cannam@89
|
1622 ;;
|
cannam@89
|
1623 esac
|
cannam@89
|
1624
|
cannam@89
|
1625 $ECHO
|
cannam@89
|
1626 $ECHO "Try \`$progname --help' for more information about other modes."
|
cannam@89
|
1627
|
cannam@89
|
1628 exit $?
|
cannam@89
|
1629 }
|
cannam@89
|
1630
|
cannam@89
|
1631 # Now that we've collected a possible --mode arg, show help if necessary
|
cannam@89
|
1632 $opt_help && func_mode_help
|
cannam@89
|
1633
|
cannam@89
|
1634
|
cannam@89
|
1635 # func_mode_execute arg...
|
cannam@89
|
1636 func_mode_execute ()
|
cannam@89
|
1637 {
|
cannam@89
|
1638 $opt_debug
|
cannam@89
|
1639 # The first argument is the command name.
|
cannam@89
|
1640 cmd="$nonopt"
|
cannam@89
|
1641 test -z "$cmd" && \
|
cannam@89
|
1642 func_fatal_help "you must specify a COMMAND"
|
cannam@89
|
1643
|
cannam@89
|
1644 # Handle -dlopen flags immediately.
|
cannam@89
|
1645 for file in $execute_dlfiles; do
|
cannam@89
|
1646 test -f "$file" \
|
cannam@89
|
1647 || func_fatal_help "\`$file' is not a file"
|
cannam@89
|
1648
|
cannam@89
|
1649 dir=
|
cannam@89
|
1650 case $file in
|
cannam@89
|
1651 *.la)
|
cannam@89
|
1652 # Check to see that this really is a libtool archive.
|
cannam@89
|
1653 func_lalib_unsafe_p "$file" \
|
cannam@89
|
1654 || func_fatal_help "\`$lib' is not a valid libtool archive"
|
cannam@89
|
1655
|
cannam@89
|
1656 # Read the libtool library.
|
cannam@89
|
1657 dlname=
|
cannam@89
|
1658 library_names=
|
cannam@89
|
1659 func_source "$file"
|
cannam@89
|
1660
|
cannam@89
|
1661 # Skip this library if it cannot be dlopened.
|
cannam@89
|
1662 if test -z "$dlname"; then
|
cannam@89
|
1663 # Warn if it was a shared library.
|
cannam@89
|
1664 test -n "$library_names" && \
|
cannam@89
|
1665 func_warning "\`$file' was not linked with \`-export-dynamic'"
|
cannam@89
|
1666 continue
|
cannam@89
|
1667 fi
|
cannam@89
|
1668
|
cannam@89
|
1669 func_dirname "$file" "" "."
|
cannam@89
|
1670 dir="$func_dirname_result"
|
cannam@89
|
1671
|
cannam@89
|
1672 if test -f "$dir/$objdir/$dlname"; then
|
cannam@89
|
1673 dir="$dir/$objdir"
|
cannam@89
|
1674 else
|
cannam@89
|
1675 if test ! -f "$dir/$dlname"; then
|
cannam@89
|
1676 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
|
cannam@89
|
1677 fi
|
cannam@89
|
1678 fi
|
cannam@89
|
1679 ;;
|
cannam@89
|
1680
|
cannam@89
|
1681 *.lo)
|
cannam@89
|
1682 # Just add the directory containing the .lo file.
|
cannam@89
|
1683 func_dirname "$file" "" "."
|
cannam@89
|
1684 dir="$func_dirname_result"
|
cannam@89
|
1685 ;;
|
cannam@89
|
1686
|
cannam@89
|
1687 *)
|
cannam@89
|
1688 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
|
cannam@89
|
1689 continue
|
cannam@89
|
1690 ;;
|
cannam@89
|
1691 esac
|
cannam@89
|
1692
|
cannam@89
|
1693 # Get the absolute pathname.
|
cannam@89
|
1694 absdir=`cd "$dir" && pwd`
|
cannam@89
|
1695 test -n "$absdir" && dir="$absdir"
|
cannam@89
|
1696
|
cannam@89
|
1697 # Now add the directory to shlibpath_var.
|
cannam@89
|
1698 if eval "test -z \"\$$shlibpath_var\""; then
|
cannam@89
|
1699 eval "$shlibpath_var=\"\$dir\""
|
cannam@89
|
1700 else
|
cannam@89
|
1701 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
|
cannam@89
|
1702 fi
|
cannam@89
|
1703 done
|
cannam@89
|
1704
|
cannam@89
|
1705 # This variable tells wrapper scripts just to set shlibpath_var
|
cannam@89
|
1706 # rather than running their programs.
|
cannam@89
|
1707 libtool_execute_magic="$magic"
|
cannam@89
|
1708
|
cannam@89
|
1709 # Check if any of the arguments is a wrapper script.
|
cannam@89
|
1710 args=
|
cannam@89
|
1711 for file
|
cannam@89
|
1712 do
|
cannam@89
|
1713 case $file in
|
cannam@89
|
1714 -*) ;;
|
cannam@89
|
1715 *)
|
cannam@89
|
1716 # Do a test to see if this is really a libtool program.
|
cannam@89
|
1717 if func_ltwrapper_script_p "$file"; then
|
cannam@89
|
1718 func_source "$file"
|
cannam@89
|
1719 # Transform arg to wrapped name.
|
cannam@89
|
1720 file="$progdir/$program"
|
cannam@89
|
1721 elif func_ltwrapper_executable_p "$file"; then
|
cannam@89
|
1722 func_ltwrapper_scriptname "$file"
|
cannam@89
|
1723 func_source "$func_ltwrapper_scriptname_result"
|
cannam@89
|
1724 # Transform arg to wrapped name.
|
cannam@89
|
1725 file="$progdir/$program"
|
cannam@89
|
1726 fi
|
cannam@89
|
1727 ;;
|
cannam@89
|
1728 esac
|
cannam@89
|
1729 # Quote arguments (to preserve shell metacharacters).
|
cannam@89
|
1730 func_quote_for_eval "$file"
|
cannam@89
|
1731 args="$args $func_quote_for_eval_result"
|
cannam@89
|
1732 done
|
cannam@89
|
1733
|
cannam@89
|
1734 if test "X$opt_dry_run" = Xfalse; then
|
cannam@89
|
1735 if test -n "$shlibpath_var"; then
|
cannam@89
|
1736 # Export the shlibpath_var.
|
cannam@89
|
1737 eval "export $shlibpath_var"
|
cannam@89
|
1738 fi
|
cannam@89
|
1739
|
cannam@89
|
1740 # Restore saved environment variables
|
cannam@89
|
1741 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
cannam@89
|
1742 do
|
cannam@89
|
1743 eval "if test \"\${save_$lt_var+set}\" = set; then
|
cannam@89
|
1744 $lt_var=\$save_$lt_var; export $lt_var
|
cannam@89
|
1745 else
|
cannam@89
|
1746 $lt_unset $lt_var
|
cannam@89
|
1747 fi"
|
cannam@89
|
1748 done
|
cannam@89
|
1749
|
cannam@89
|
1750 # Now prepare to actually exec the command.
|
cannam@89
|
1751 exec_cmd="\$cmd$args"
|
cannam@89
|
1752 else
|
cannam@89
|
1753 # Display what would be done.
|
cannam@89
|
1754 if test -n "$shlibpath_var"; then
|
cannam@89
|
1755 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
|
cannam@89
|
1756 $ECHO "export $shlibpath_var"
|
cannam@89
|
1757 fi
|
cannam@89
|
1758 $ECHO "$cmd$args"
|
cannam@89
|
1759 exit $EXIT_SUCCESS
|
cannam@89
|
1760 fi
|
cannam@89
|
1761 }
|
cannam@89
|
1762
|
cannam@89
|
1763 test "$mode" = execute && func_mode_execute ${1+"$@"}
|
cannam@89
|
1764
|
cannam@89
|
1765
|
cannam@89
|
1766 # func_mode_finish arg...
|
cannam@89
|
1767 func_mode_finish ()
|
cannam@89
|
1768 {
|
cannam@89
|
1769 $opt_debug
|
cannam@89
|
1770 libdirs="$nonopt"
|
cannam@89
|
1771 admincmds=
|
cannam@89
|
1772
|
cannam@89
|
1773 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
|
cannam@89
|
1774 for dir
|
cannam@89
|
1775 do
|
cannam@89
|
1776 libdirs="$libdirs $dir"
|
cannam@89
|
1777 done
|
cannam@89
|
1778
|
cannam@89
|
1779 for libdir in $libdirs; do
|
cannam@89
|
1780 if test -n "$finish_cmds"; then
|
cannam@89
|
1781 # Do each command in the finish commands.
|
cannam@89
|
1782 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
|
cannam@89
|
1783 '"$cmd"'"'
|
cannam@89
|
1784 fi
|
cannam@89
|
1785 if test -n "$finish_eval"; then
|
cannam@89
|
1786 # Do the single finish_eval.
|
cannam@89
|
1787 eval cmds=\"$finish_eval\"
|
cannam@89
|
1788 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
|
cannam@89
|
1789 $cmds"
|
cannam@89
|
1790 fi
|
cannam@89
|
1791 done
|
cannam@89
|
1792 fi
|
cannam@89
|
1793
|
cannam@89
|
1794 # Exit here if they wanted silent mode.
|
cannam@89
|
1795 $opt_silent && exit $EXIT_SUCCESS
|
cannam@89
|
1796
|
cannam@89
|
1797 $ECHO "X----------------------------------------------------------------------" | $Xsed
|
cannam@89
|
1798 $ECHO "Libraries have been installed in:"
|
cannam@89
|
1799 for libdir in $libdirs; do
|
cannam@89
|
1800 $ECHO " $libdir"
|
cannam@89
|
1801 done
|
cannam@89
|
1802 $ECHO
|
cannam@89
|
1803 $ECHO "If you ever happen to want to link against installed libraries"
|
cannam@89
|
1804 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
|
cannam@89
|
1805 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
|
cannam@89
|
1806 $ECHO "flag during linking and do at least one of the following:"
|
cannam@89
|
1807 if test -n "$shlibpath_var"; then
|
cannam@89
|
1808 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
|
cannam@89
|
1809 $ECHO " during execution"
|
cannam@89
|
1810 fi
|
cannam@89
|
1811 if test -n "$runpath_var"; then
|
cannam@89
|
1812 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
|
cannam@89
|
1813 $ECHO " during linking"
|
cannam@89
|
1814 fi
|
cannam@89
|
1815 if test -n "$hardcode_libdir_flag_spec"; then
|
cannam@89
|
1816 libdir=LIBDIR
|
cannam@89
|
1817 eval flag=\"$hardcode_libdir_flag_spec\"
|
cannam@89
|
1818
|
cannam@89
|
1819 $ECHO " - use the \`$flag' linker flag"
|
cannam@89
|
1820 fi
|
cannam@89
|
1821 if test -n "$admincmds"; then
|
cannam@89
|
1822 $ECHO " - have your system administrator run these commands:$admincmds"
|
cannam@89
|
1823 fi
|
cannam@89
|
1824 if test -f /etc/ld.so.conf; then
|
cannam@89
|
1825 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
|
cannam@89
|
1826 fi
|
cannam@89
|
1827 $ECHO
|
cannam@89
|
1828
|
cannam@89
|
1829 $ECHO "See any operating system documentation about shared libraries for"
|
cannam@89
|
1830 case $host in
|
cannam@89
|
1831 solaris2.[6789]|solaris2.1[0-9])
|
cannam@89
|
1832 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
|
cannam@89
|
1833 $ECHO "pages."
|
cannam@89
|
1834 ;;
|
cannam@89
|
1835 *)
|
cannam@89
|
1836 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
|
cannam@89
|
1837 ;;
|
cannam@89
|
1838 esac
|
cannam@89
|
1839 $ECHO "X----------------------------------------------------------------------" | $Xsed
|
cannam@89
|
1840 exit $EXIT_SUCCESS
|
cannam@89
|
1841 }
|
cannam@89
|
1842
|
cannam@89
|
1843 test "$mode" = finish && func_mode_finish ${1+"$@"}
|
cannam@89
|
1844
|
cannam@89
|
1845
|
cannam@89
|
1846 # func_mode_install arg...
|
cannam@89
|
1847 func_mode_install ()
|
cannam@89
|
1848 {
|
cannam@89
|
1849 $opt_debug
|
cannam@89
|
1850 # There may be an optional sh(1) argument at the beginning of
|
cannam@89
|
1851 # install_prog (especially on Windows NT).
|
cannam@89
|
1852 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
|
cannam@89
|
1853 # Allow the use of GNU shtool's install command.
|
cannam@89
|
1854 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
|
cannam@89
|
1855 # Aesthetically quote it.
|
cannam@89
|
1856 func_quote_for_eval "$nonopt"
|
cannam@89
|
1857 install_prog="$func_quote_for_eval_result "
|
cannam@89
|
1858 arg=$1
|
cannam@89
|
1859 shift
|
cannam@89
|
1860 else
|
cannam@89
|
1861 install_prog=
|
cannam@89
|
1862 arg=$nonopt
|
cannam@89
|
1863 fi
|
cannam@89
|
1864
|
cannam@89
|
1865 # The real first argument should be the name of the installation program.
|
cannam@89
|
1866 # Aesthetically quote it.
|
cannam@89
|
1867 func_quote_for_eval "$arg"
|
cannam@89
|
1868 install_prog="$install_prog$func_quote_for_eval_result"
|
cannam@89
|
1869
|
cannam@89
|
1870 # We need to accept at least all the BSD install flags.
|
cannam@89
|
1871 dest=
|
cannam@89
|
1872 files=
|
cannam@89
|
1873 opts=
|
cannam@89
|
1874 prev=
|
cannam@89
|
1875 install_type=
|
cannam@89
|
1876 isdir=no
|
cannam@89
|
1877 stripme=
|
cannam@89
|
1878 for arg
|
cannam@89
|
1879 do
|
cannam@89
|
1880 if test -n "$dest"; then
|
cannam@89
|
1881 files="$files $dest"
|
cannam@89
|
1882 dest=$arg
|
cannam@89
|
1883 continue
|
cannam@89
|
1884 fi
|
cannam@89
|
1885
|
cannam@89
|
1886 case $arg in
|
cannam@89
|
1887 -d) isdir=yes ;;
|
cannam@89
|
1888 -f)
|
cannam@89
|
1889 case " $install_prog " in
|
cannam@89
|
1890 *[\\\ /]cp\ *) ;;
|
cannam@89
|
1891 *) prev=$arg ;;
|
cannam@89
|
1892 esac
|
cannam@89
|
1893 ;;
|
cannam@89
|
1894 -g | -m | -o)
|
cannam@89
|
1895 prev=$arg
|
cannam@89
|
1896 ;;
|
cannam@89
|
1897 -s)
|
cannam@89
|
1898 stripme=" -s"
|
cannam@89
|
1899 continue
|
cannam@89
|
1900 ;;
|
cannam@89
|
1901 -*)
|
cannam@89
|
1902 ;;
|
cannam@89
|
1903 *)
|
cannam@89
|
1904 # If the previous option needed an argument, then skip it.
|
cannam@89
|
1905 if test -n "$prev"; then
|
cannam@89
|
1906 prev=
|
cannam@89
|
1907 else
|
cannam@89
|
1908 dest=$arg
|
cannam@89
|
1909 continue
|
cannam@89
|
1910 fi
|
cannam@89
|
1911 ;;
|
cannam@89
|
1912 esac
|
cannam@89
|
1913
|
cannam@89
|
1914 # Aesthetically quote the argument.
|
cannam@89
|
1915 func_quote_for_eval "$arg"
|
cannam@89
|
1916 install_prog="$install_prog $func_quote_for_eval_result"
|
cannam@89
|
1917 done
|
cannam@89
|
1918
|
cannam@89
|
1919 test -z "$install_prog" && \
|
cannam@89
|
1920 func_fatal_help "you must specify an install program"
|
cannam@89
|
1921
|
cannam@89
|
1922 test -n "$prev" && \
|
cannam@89
|
1923 func_fatal_help "the \`$prev' option requires an argument"
|
cannam@89
|
1924
|
cannam@89
|
1925 if test -z "$files"; then
|
cannam@89
|
1926 if test -z "$dest"; then
|
cannam@89
|
1927 func_fatal_help "no file or destination specified"
|
cannam@89
|
1928 else
|
cannam@89
|
1929 func_fatal_help "you must specify a destination"
|
cannam@89
|
1930 fi
|
cannam@89
|
1931 fi
|
cannam@89
|
1932
|
cannam@89
|
1933 # Strip any trailing slash from the destination.
|
cannam@89
|
1934 func_stripname '' '/' "$dest"
|
cannam@89
|
1935 dest=$func_stripname_result
|
cannam@89
|
1936
|
cannam@89
|
1937 # Check to see that the destination is a directory.
|
cannam@89
|
1938 test -d "$dest" && isdir=yes
|
cannam@89
|
1939 if test "$isdir" = yes; then
|
cannam@89
|
1940 destdir="$dest"
|
cannam@89
|
1941 destname=
|
cannam@89
|
1942 else
|
cannam@89
|
1943 func_dirname_and_basename "$dest" "" "."
|
cannam@89
|
1944 destdir="$func_dirname_result"
|
cannam@89
|
1945 destname="$func_basename_result"
|
cannam@89
|
1946
|
cannam@89
|
1947 # Not a directory, so check to see that there is only one file specified.
|
cannam@89
|
1948 set dummy $files; shift
|
cannam@89
|
1949 test "$#" -gt 1 && \
|
cannam@89
|
1950 func_fatal_help "\`$dest' is not a directory"
|
cannam@89
|
1951 fi
|
cannam@89
|
1952 case $destdir in
|
cannam@89
|
1953 [\\/]* | [A-Za-z]:[\\/]*) ;;
|
cannam@89
|
1954 *)
|
cannam@89
|
1955 for file in $files; do
|
cannam@89
|
1956 case $file in
|
cannam@89
|
1957 *.lo) ;;
|
cannam@89
|
1958 *)
|
cannam@89
|
1959 func_fatal_help "\`$destdir' must be an absolute directory name"
|
cannam@89
|
1960 ;;
|
cannam@89
|
1961 esac
|
cannam@89
|
1962 done
|
cannam@89
|
1963 ;;
|
cannam@89
|
1964 esac
|
cannam@89
|
1965
|
cannam@89
|
1966 # This variable tells wrapper scripts just to set variables rather
|
cannam@89
|
1967 # than running their programs.
|
cannam@89
|
1968 libtool_install_magic="$magic"
|
cannam@89
|
1969
|
cannam@89
|
1970 staticlibs=
|
cannam@89
|
1971 future_libdirs=
|
cannam@89
|
1972 current_libdirs=
|
cannam@89
|
1973 for file in $files; do
|
cannam@89
|
1974
|
cannam@89
|
1975 # Do each installation.
|
cannam@89
|
1976 case $file in
|
cannam@89
|
1977 *.$libext)
|
cannam@89
|
1978 # Do the static libraries later.
|
cannam@89
|
1979 staticlibs="$staticlibs $file"
|
cannam@89
|
1980 ;;
|
cannam@89
|
1981
|
cannam@89
|
1982 *.la)
|
cannam@89
|
1983 # Check to see that this really is a libtool archive.
|
cannam@89
|
1984 func_lalib_unsafe_p "$file" \
|
cannam@89
|
1985 || func_fatal_help "\`$file' is not a valid libtool archive"
|
cannam@89
|
1986
|
cannam@89
|
1987 library_names=
|
cannam@89
|
1988 old_library=
|
cannam@89
|
1989 relink_command=
|
cannam@89
|
1990 func_source "$file"
|
cannam@89
|
1991
|
cannam@89
|
1992 # Add the libdir to current_libdirs if it is the destination.
|
cannam@89
|
1993 if test "X$destdir" = "X$libdir"; then
|
cannam@89
|
1994 case "$current_libdirs " in
|
cannam@89
|
1995 *" $libdir "*) ;;
|
cannam@89
|
1996 *) current_libdirs="$current_libdirs $libdir" ;;
|
cannam@89
|
1997 esac
|
cannam@89
|
1998 else
|
cannam@89
|
1999 # Note the libdir as a future libdir.
|
cannam@89
|
2000 case "$future_libdirs " in
|
cannam@89
|
2001 *" $libdir "*) ;;
|
cannam@89
|
2002 *) future_libdirs="$future_libdirs $libdir" ;;
|
cannam@89
|
2003 esac
|
cannam@89
|
2004 fi
|
cannam@89
|
2005
|
cannam@89
|
2006 func_dirname "$file" "/" ""
|
cannam@89
|
2007 dir="$func_dirname_result"
|
cannam@89
|
2008 dir="$dir$objdir"
|
cannam@89
|
2009
|
cannam@89
|
2010 if test -n "$relink_command"; then
|
cannam@89
|
2011 # Determine the prefix the user has applied to our future dir.
|
cannam@89
|
2012 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
|
cannam@89
|
2013
|
cannam@89
|
2014 # Don't allow the user to place us outside of our expected
|
cannam@89
|
2015 # location b/c this prevents finding dependent libraries that
|
cannam@89
|
2016 # are installed to the same prefix.
|
cannam@89
|
2017 # At present, this check doesn't affect windows .dll's that
|
cannam@89
|
2018 # are installed into $libdir/../bin (currently, that works fine)
|
cannam@89
|
2019 # but it's something to keep an eye on.
|
cannam@89
|
2020 test "$inst_prefix_dir" = "$destdir" && \
|
cannam@89
|
2021 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
|
cannam@89
|
2022
|
cannam@89
|
2023 if test -n "$inst_prefix_dir"; then
|
cannam@89
|
2024 # Stick the inst_prefix_dir data into the link command.
|
cannam@89
|
2025 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
|
cannam@89
|
2026 else
|
cannam@89
|
2027 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
|
cannam@89
|
2028 fi
|
cannam@89
|
2029
|
cannam@89
|
2030 func_warning "relinking \`$file'"
|
cannam@89
|
2031 func_show_eval "$relink_command" \
|
cannam@89
|
2032 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
|
cannam@89
|
2033 fi
|
cannam@89
|
2034
|
cannam@89
|
2035 # See the names of the shared library.
|
cannam@89
|
2036 set dummy $library_names; shift
|
cannam@89
|
2037 if test -n "$1"; then
|
cannam@89
|
2038 realname="$1"
|
cannam@89
|
2039 shift
|
cannam@89
|
2040
|
cannam@89
|
2041 srcname="$realname"
|
cannam@89
|
2042 test -n "$relink_command" && srcname="$realname"T
|
cannam@89
|
2043
|
cannam@89
|
2044 # Install the shared library and build the symlinks.
|
cannam@89
|
2045 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
|
cannam@89
|
2046 'exit $?'
|
cannam@89
|
2047 tstripme="$stripme"
|
cannam@89
|
2048 case $host_os in
|
cannam@89
|
2049 cygwin* | mingw* | pw32*)
|
cannam@89
|
2050 case $realname in
|
cannam@89
|
2051 *.dll.a)
|
cannam@89
|
2052 tstripme=""
|
cannam@89
|
2053 ;;
|
cannam@89
|
2054 esac
|
cannam@89
|
2055 ;;
|
cannam@89
|
2056 esac
|
cannam@89
|
2057 if test -n "$tstripme" && test -n "$striplib"; then
|
cannam@89
|
2058 func_show_eval "$striplib $destdir/$realname" 'exit $?'
|
cannam@89
|
2059 fi
|
cannam@89
|
2060
|
cannam@89
|
2061 if test "$#" -gt 0; then
|
cannam@89
|
2062 # Delete the old symlinks, and create new ones.
|
cannam@89
|
2063 # Try `ln -sf' first, because the `ln' binary might depend on
|
cannam@89
|
2064 # the symlink we replace! Solaris /bin/ln does not understand -f,
|
cannam@89
|
2065 # so we also need to try rm && ln -s.
|
cannam@89
|
2066 for linkname
|
cannam@89
|
2067 do
|
cannam@89
|
2068 test "$linkname" != "$realname" \
|
cannam@89
|
2069 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
|
cannam@89
|
2070 done
|
cannam@89
|
2071 fi
|
cannam@89
|
2072
|
cannam@89
|
2073 # Do each command in the postinstall commands.
|
cannam@89
|
2074 lib="$destdir/$realname"
|
cannam@89
|
2075 func_execute_cmds "$postinstall_cmds" 'exit $?'
|
cannam@89
|
2076 fi
|
cannam@89
|
2077
|
cannam@89
|
2078 # Install the pseudo-library for information purposes.
|
cannam@89
|
2079 func_basename "$file"
|
cannam@89
|
2080 name="$func_basename_result"
|
cannam@89
|
2081 instname="$dir/$name"i
|
cannam@89
|
2082 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
|
cannam@89
|
2083
|
cannam@89
|
2084 # Maybe install the static library, too.
|
cannam@89
|
2085 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
|
cannam@89
|
2086 ;;
|
cannam@89
|
2087
|
cannam@89
|
2088 *.lo)
|
cannam@89
|
2089 # Install (i.e. copy) a libtool object.
|
cannam@89
|
2090
|
cannam@89
|
2091 # Figure out destination file name, if it wasn't already specified.
|
cannam@89
|
2092 if test -n "$destname"; then
|
cannam@89
|
2093 destfile="$destdir/$destname"
|
cannam@89
|
2094 else
|
cannam@89
|
2095 func_basename "$file"
|
cannam@89
|
2096 destfile="$func_basename_result"
|
cannam@89
|
2097 destfile="$destdir/$destfile"
|
cannam@89
|
2098 fi
|
cannam@89
|
2099
|
cannam@89
|
2100 # Deduce the name of the destination old-style object file.
|
cannam@89
|
2101 case $destfile in
|
cannam@89
|
2102 *.lo)
|
cannam@89
|
2103 func_lo2o "$destfile"
|
cannam@89
|
2104 staticdest=$func_lo2o_result
|
cannam@89
|
2105 ;;
|
cannam@89
|
2106 *.$objext)
|
cannam@89
|
2107 staticdest="$destfile"
|
cannam@89
|
2108 destfile=
|
cannam@89
|
2109 ;;
|
cannam@89
|
2110 *)
|
cannam@89
|
2111 func_fatal_help "cannot copy a libtool object to \`$destfile'"
|
cannam@89
|
2112 ;;
|
cannam@89
|
2113 esac
|
cannam@89
|
2114
|
cannam@89
|
2115 # Install the libtool object if requested.
|
cannam@89
|
2116 test -n "$destfile" && \
|
cannam@89
|
2117 func_show_eval "$install_prog $file $destfile" 'exit $?'
|
cannam@89
|
2118
|
cannam@89
|
2119 # Install the old object if enabled.
|
cannam@89
|
2120 if test "$build_old_libs" = yes; then
|
cannam@89
|
2121 # Deduce the name of the old-style object file.
|
cannam@89
|
2122 func_lo2o "$file"
|
cannam@89
|
2123 staticobj=$func_lo2o_result
|
cannam@89
|
2124 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
|
cannam@89
|
2125 fi
|
cannam@89
|
2126 exit $EXIT_SUCCESS
|
cannam@89
|
2127 ;;
|
cannam@89
|
2128
|
cannam@89
|
2129 *)
|
cannam@89
|
2130 # Figure out destination file name, if it wasn't already specified.
|
cannam@89
|
2131 if test -n "$destname"; then
|
cannam@89
|
2132 destfile="$destdir/$destname"
|
cannam@89
|
2133 else
|
cannam@89
|
2134 func_basename "$file"
|
cannam@89
|
2135 destfile="$func_basename_result"
|
cannam@89
|
2136 destfile="$destdir/$destfile"
|
cannam@89
|
2137 fi
|
cannam@89
|
2138
|
cannam@89
|
2139 # If the file is missing, and there is a .exe on the end, strip it
|
cannam@89
|
2140 # because it is most likely a libtool script we actually want to
|
cannam@89
|
2141 # install
|
cannam@89
|
2142 stripped_ext=""
|
cannam@89
|
2143 case $file in
|
cannam@89
|
2144 *.exe)
|
cannam@89
|
2145 if test ! -f "$file"; then
|
cannam@89
|
2146 func_stripname '' '.exe' "$file"
|
cannam@89
|
2147 file=$func_stripname_result
|
cannam@89
|
2148 stripped_ext=".exe"
|
cannam@89
|
2149 fi
|
cannam@89
|
2150 ;;
|
cannam@89
|
2151 esac
|
cannam@89
|
2152
|
cannam@89
|
2153 # Do a test to see if this is really a libtool program.
|
cannam@89
|
2154 case $host in
|
cannam@89
|
2155 *cygwin*|*mingw*)
|
cannam@89
|
2156 if func_ltwrapper_executable_p "$file"; then
|
cannam@89
|
2157 func_ltwrapper_scriptname "$file"
|
cannam@89
|
2158 wrapper=$func_ltwrapper_scriptname_result
|
cannam@89
|
2159 else
|
cannam@89
|
2160 func_stripname '' '.exe' "$file"
|
cannam@89
|
2161 wrapper=$func_stripname_result
|
cannam@89
|
2162 fi
|
cannam@89
|
2163 ;;
|
cannam@89
|
2164 *)
|
cannam@89
|
2165 wrapper=$file
|
cannam@89
|
2166 ;;
|
cannam@89
|
2167 esac
|
cannam@89
|
2168 if func_ltwrapper_script_p "$wrapper"; then
|
cannam@89
|
2169 notinst_deplibs=
|
cannam@89
|
2170 relink_command=
|
cannam@89
|
2171
|
cannam@89
|
2172 func_source "$wrapper"
|
cannam@89
|
2173
|
cannam@89
|
2174 # Check the variables that should have been set.
|
cannam@89
|
2175 test -z "$generated_by_libtool_version" && \
|
cannam@89
|
2176 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
|
cannam@89
|
2177
|
cannam@89
|
2178 finalize=yes
|
cannam@89
|
2179 for lib in $notinst_deplibs; do
|
cannam@89
|
2180 # Check to see that each library is installed.
|
cannam@89
|
2181 libdir=
|
cannam@89
|
2182 if test -f "$lib"; then
|
cannam@89
|
2183 func_source "$lib"
|
cannam@89
|
2184 fi
|
cannam@89
|
2185 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
|
cannam@89
|
2186 if test -n "$libdir" && test ! -f "$libfile"; then
|
cannam@89
|
2187 func_warning "\`$lib' has not been installed in \`$libdir'"
|
cannam@89
|
2188 finalize=no
|
cannam@89
|
2189 fi
|
cannam@89
|
2190 done
|
cannam@89
|
2191
|
cannam@89
|
2192 relink_command=
|
cannam@89
|
2193 func_source "$wrapper"
|
cannam@89
|
2194
|
cannam@89
|
2195 outputname=
|
cannam@89
|
2196 if test "$fast_install" = no && test -n "$relink_command"; then
|
cannam@89
|
2197 $opt_dry_run || {
|
cannam@89
|
2198 if test "$finalize" = yes; then
|
cannam@89
|
2199 tmpdir=`func_mktempdir`
|
cannam@89
|
2200 func_basename "$file$stripped_ext"
|
cannam@89
|
2201 file="$func_basename_result"
|
cannam@89
|
2202 outputname="$tmpdir/$file"
|
cannam@89
|
2203 # Replace the output file specification.
|
cannam@89
|
2204 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
|
cannam@89
|
2205
|
cannam@89
|
2206 $opt_silent || {
|
cannam@89
|
2207 func_quote_for_expand "$relink_command"
|
cannam@89
|
2208 eval "func_echo $func_quote_for_expand_result"
|
cannam@89
|
2209 }
|
cannam@89
|
2210 if eval "$relink_command"; then :
|
cannam@89
|
2211 else
|
cannam@89
|
2212 func_error "error: relink \`$file' with the above command before installing it"
|
cannam@89
|
2213 $opt_dry_run || ${RM}r "$tmpdir"
|
cannam@89
|
2214 continue
|
cannam@89
|
2215 fi
|
cannam@89
|
2216 file="$outputname"
|
cannam@89
|
2217 else
|
cannam@89
|
2218 func_warning "cannot relink \`$file'"
|
cannam@89
|
2219 fi
|
cannam@89
|
2220 }
|
cannam@89
|
2221 else
|
cannam@89
|
2222 # Install the binary that we compiled earlier.
|
cannam@89
|
2223 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
|
cannam@89
|
2224 fi
|
cannam@89
|
2225 fi
|
cannam@89
|
2226
|
cannam@89
|
2227 # remove .exe since cygwin /usr/bin/install will append another
|
cannam@89
|
2228 # one anyway
|
cannam@89
|
2229 case $install_prog,$host in
|
cannam@89
|
2230 */usr/bin/install*,*cygwin*)
|
cannam@89
|
2231 case $file:$destfile in
|
cannam@89
|
2232 *.exe:*.exe)
|
cannam@89
|
2233 # this is ok
|
cannam@89
|
2234 ;;
|
cannam@89
|
2235 *.exe:*)
|
cannam@89
|
2236 destfile=$destfile.exe
|
cannam@89
|
2237 ;;
|
cannam@89
|
2238 *:*.exe)
|
cannam@89
|
2239 func_stripname '' '.exe' "$destfile"
|
cannam@89
|
2240 destfile=$func_stripname_result
|
cannam@89
|
2241 ;;
|
cannam@89
|
2242 esac
|
cannam@89
|
2243 ;;
|
cannam@89
|
2244 esac
|
cannam@89
|
2245 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
|
cannam@89
|
2246 $opt_dry_run || if test -n "$outputname"; then
|
cannam@89
|
2247 ${RM}r "$tmpdir"
|
cannam@89
|
2248 fi
|
cannam@89
|
2249 ;;
|
cannam@89
|
2250 esac
|
cannam@89
|
2251 done
|
cannam@89
|
2252
|
cannam@89
|
2253 for file in $staticlibs; do
|
cannam@89
|
2254 func_basename "$file"
|
cannam@89
|
2255 name="$func_basename_result"
|
cannam@89
|
2256
|
cannam@89
|
2257 # Set up the ranlib parameters.
|
cannam@89
|
2258 oldlib="$destdir/$name"
|
cannam@89
|
2259
|
cannam@89
|
2260 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
|
cannam@89
|
2261
|
cannam@89
|
2262 if test -n "$stripme" && test -n "$old_striplib"; then
|
cannam@89
|
2263 func_show_eval "$old_striplib $oldlib" 'exit $?'
|
cannam@89
|
2264 fi
|
cannam@89
|
2265
|
cannam@89
|
2266 # Do each command in the postinstall commands.
|
cannam@89
|
2267 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
|
cannam@89
|
2268 done
|
cannam@89
|
2269
|
cannam@89
|
2270 test -n "$future_libdirs" && \
|
cannam@89
|
2271 func_warning "remember to run \`$progname --finish$future_libdirs'"
|
cannam@89
|
2272
|
cannam@89
|
2273 if test -n "$current_libdirs"; then
|
cannam@89
|
2274 # Maybe just do a dry run.
|
cannam@89
|
2275 $opt_dry_run && current_libdirs=" -n$current_libdirs"
|
cannam@89
|
2276 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
|
cannam@89
|
2277 else
|
cannam@89
|
2278 exit $EXIT_SUCCESS
|
cannam@89
|
2279 fi
|
cannam@89
|
2280 }
|
cannam@89
|
2281
|
cannam@89
|
2282 test "$mode" = install && func_mode_install ${1+"$@"}
|
cannam@89
|
2283
|
cannam@89
|
2284
|
cannam@89
|
2285 # func_generate_dlsyms outputname originator pic_p
|
cannam@89
|
2286 # Extract symbols from dlprefiles and create ${outputname}S.o with
|
cannam@89
|
2287 # a dlpreopen symbol table.
|
cannam@89
|
2288 func_generate_dlsyms ()
|
cannam@89
|
2289 {
|
cannam@89
|
2290 $opt_debug
|
cannam@89
|
2291 my_outputname="$1"
|
cannam@89
|
2292 my_originator="$2"
|
cannam@89
|
2293 my_pic_p="${3-no}"
|
cannam@89
|
2294 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
|
cannam@89
|
2295 my_dlsyms=
|
cannam@89
|
2296
|
cannam@89
|
2297 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
|
cannam@89
|
2298 if test -n "$NM" && test -n "$global_symbol_pipe"; then
|
cannam@89
|
2299 my_dlsyms="${my_outputname}S.c"
|
cannam@89
|
2300 else
|
cannam@89
|
2301 func_error "not configured to extract global symbols from dlpreopened files"
|
cannam@89
|
2302 fi
|
cannam@89
|
2303 fi
|
cannam@89
|
2304
|
cannam@89
|
2305 if test -n "$my_dlsyms"; then
|
cannam@89
|
2306 case $my_dlsyms in
|
cannam@89
|
2307 "") ;;
|
cannam@89
|
2308 *.c)
|
cannam@89
|
2309 # Discover the nlist of each of the dlfiles.
|
cannam@89
|
2310 nlist="$output_objdir/${my_outputname}.nm"
|
cannam@89
|
2311
|
cannam@89
|
2312 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
|
cannam@89
|
2313
|
cannam@89
|
2314 # Parse the name list into a source file.
|
cannam@89
|
2315 func_verbose "creating $output_objdir/$my_dlsyms"
|
cannam@89
|
2316
|
cannam@89
|
2317 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
|
cannam@89
|
2318 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
|
cannam@89
|
2319 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
|
cannam@89
|
2320
|
cannam@89
|
2321 #ifdef __cplusplus
|
cannam@89
|
2322 extern \"C\" {
|
cannam@89
|
2323 #endif
|
cannam@89
|
2324
|
cannam@89
|
2325 /* External symbol declarations for the compiler. */\
|
cannam@89
|
2326 "
|
cannam@89
|
2327
|
cannam@89
|
2328 if test "$dlself" = yes; then
|
cannam@89
|
2329 func_verbose "generating symbol list for \`$output'"
|
cannam@89
|
2330
|
cannam@89
|
2331 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
|
cannam@89
|
2332
|
cannam@89
|
2333 # Add our own program objects to the symbol list.
|
cannam@89
|
2334 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
|
cannam@89
|
2335 for progfile in $progfiles; do
|
cannam@89
|
2336 func_verbose "extracting global C symbols from \`$progfile'"
|
cannam@89
|
2337 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
|
cannam@89
|
2338 done
|
cannam@89
|
2339
|
cannam@89
|
2340 if test -n "$exclude_expsyms"; then
|
cannam@89
|
2341 $opt_dry_run || {
|
cannam@89
|
2342 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
|
cannam@89
|
2343 eval '$MV "$nlist"T "$nlist"'
|
cannam@89
|
2344 }
|
cannam@89
|
2345 fi
|
cannam@89
|
2346
|
cannam@89
|
2347 if test -n "$export_symbols_regex"; then
|
cannam@89
|
2348 $opt_dry_run || {
|
cannam@89
|
2349 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
|
cannam@89
|
2350 eval '$MV "$nlist"T "$nlist"'
|
cannam@89
|
2351 }
|
cannam@89
|
2352 fi
|
cannam@89
|
2353
|
cannam@89
|
2354 # Prepare the list of exported symbols
|
cannam@89
|
2355 if test -z "$export_symbols"; then
|
cannam@89
|
2356 export_symbols="$output_objdir/$outputname.exp"
|
cannam@89
|
2357 $opt_dry_run || {
|
cannam@89
|
2358 $RM $export_symbols
|
cannam@89
|
2359 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
|
cannam@89
|
2360 case $host in
|
cannam@89
|
2361 *cygwin* | *mingw* )
|
cannam@89
|
2362 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
|
cannam@89
|
2363 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
|
cannam@89
|
2364 ;;
|
cannam@89
|
2365 esac
|
cannam@89
|
2366 }
|
cannam@89
|
2367 else
|
cannam@89
|
2368 $opt_dry_run || {
|
cannam@89
|
2369 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
|
cannam@89
|
2370 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
|
cannam@89
|
2371 eval '$MV "$nlist"T "$nlist"'
|
cannam@89
|
2372 case $host in
|
cannam@89
|
2373 *cygwin | *mingw* )
|
cannam@89
|
2374 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
|
cannam@89
|
2375 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
|
cannam@89
|
2376 ;;
|
cannam@89
|
2377 esac
|
cannam@89
|
2378 }
|
cannam@89
|
2379 fi
|
cannam@89
|
2380 fi
|
cannam@89
|
2381
|
cannam@89
|
2382 for dlprefile in $dlprefiles; do
|
cannam@89
|
2383 func_verbose "extracting global C symbols from \`$dlprefile'"
|
cannam@89
|
2384 func_basename "$dlprefile"
|
cannam@89
|
2385 name="$func_basename_result"
|
cannam@89
|
2386 $opt_dry_run || {
|
cannam@89
|
2387 eval '$ECHO ": $name " >> "$nlist"'
|
cannam@89
|
2388 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
|
cannam@89
|
2389 }
|
cannam@89
|
2390 done
|
cannam@89
|
2391
|
cannam@89
|
2392 $opt_dry_run || {
|
cannam@89
|
2393 # Make sure we have at least an empty file.
|
cannam@89
|
2394 test -f "$nlist" || : > "$nlist"
|
cannam@89
|
2395
|
cannam@89
|
2396 if test -n "$exclude_expsyms"; then
|
cannam@89
|
2397 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
|
cannam@89
|
2398 $MV "$nlist"T "$nlist"
|
cannam@89
|
2399 fi
|
cannam@89
|
2400
|
cannam@89
|
2401 # Try sorting and uniquifying the output.
|
cannam@89
|
2402 if $GREP -v "^: " < "$nlist" |
|
cannam@89
|
2403 if sort -k 3 </dev/null >/dev/null 2>&1; then
|
cannam@89
|
2404 sort -k 3
|
cannam@89
|
2405 else
|
cannam@89
|
2406 sort +2
|
cannam@89
|
2407 fi |
|
cannam@89
|
2408 uniq > "$nlist"S; then
|
cannam@89
|
2409 :
|
cannam@89
|
2410 else
|
cannam@89
|
2411 $GREP -v "^: " < "$nlist" > "$nlist"S
|
cannam@89
|
2412 fi
|
cannam@89
|
2413
|
cannam@89
|
2414 if test -f "$nlist"S; then
|
cannam@89
|
2415 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
|
cannam@89
|
2416 else
|
cannam@89
|
2417 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
|
cannam@89
|
2418 fi
|
cannam@89
|
2419
|
cannam@89
|
2420 $ECHO >> "$output_objdir/$my_dlsyms" "\
|
cannam@89
|
2421
|
cannam@89
|
2422 /* The mapping between symbol names and symbols. */
|
cannam@89
|
2423 typedef struct {
|
cannam@89
|
2424 const char *name;
|
cannam@89
|
2425 void *address;
|
cannam@89
|
2426 } lt_dlsymlist;
|
cannam@89
|
2427 "
|
cannam@89
|
2428 case $host in
|
cannam@89
|
2429 *cygwin* | *mingw* )
|
cannam@89
|
2430 $ECHO >> "$output_objdir/$my_dlsyms" "\
|
cannam@89
|
2431 /* DATA imports from DLLs on WIN32 con't be const, because
|
cannam@89
|
2432 runtime relocations are performed -- see ld's documentation
|
cannam@89
|
2433 on pseudo-relocs. */"
|
cannam@89
|
2434 lt_dlsym_const= ;;
|
cannam@89
|
2435 *osf5*)
|
cannam@89
|
2436 echo >> "$output_objdir/$my_dlsyms" "\
|
cannam@89
|
2437 /* This system does not cope well with relocations in const data */"
|
cannam@89
|
2438 lt_dlsym_const= ;;
|
cannam@89
|
2439 *)
|
cannam@89
|
2440 lt_dlsym_const=const ;;
|
cannam@89
|
2441 esac
|
cannam@89
|
2442
|
cannam@89
|
2443 $ECHO >> "$output_objdir/$my_dlsyms" "\
|
cannam@89
|
2444 extern $lt_dlsym_const lt_dlsymlist
|
cannam@89
|
2445 lt_${my_prefix}_LTX_preloaded_symbols[];
|
cannam@89
|
2446 $lt_dlsym_const lt_dlsymlist
|
cannam@89
|
2447 lt_${my_prefix}_LTX_preloaded_symbols[] =
|
cannam@89
|
2448 {\
|
cannam@89
|
2449 { \"$my_originator\", (void *) 0 },"
|
cannam@89
|
2450
|
cannam@89
|
2451 case $need_lib_prefix in
|
cannam@89
|
2452 no)
|
cannam@89
|
2453 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
|
cannam@89
|
2454 ;;
|
cannam@89
|
2455 *)
|
cannam@89
|
2456 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
|
cannam@89
|
2457 ;;
|
cannam@89
|
2458 esac
|
cannam@89
|
2459 $ECHO >> "$output_objdir/$my_dlsyms" "\
|
cannam@89
|
2460 {0, (void *) 0}
|
cannam@89
|
2461 };
|
cannam@89
|
2462
|
cannam@89
|
2463 /* This works around a problem in FreeBSD linker */
|
cannam@89
|
2464 #ifdef FREEBSD_WORKAROUND
|
cannam@89
|
2465 static const void *lt_preloaded_setup() {
|
cannam@89
|
2466 return lt_${my_prefix}_LTX_preloaded_symbols;
|
cannam@89
|
2467 }
|
cannam@89
|
2468 #endif
|
cannam@89
|
2469
|
cannam@89
|
2470 #ifdef __cplusplus
|
cannam@89
|
2471 }
|
cannam@89
|
2472 #endif\
|
cannam@89
|
2473 "
|
cannam@89
|
2474 } # !$opt_dry_run
|
cannam@89
|
2475
|
cannam@89
|
2476 pic_flag_for_symtable=
|
cannam@89
|
2477 case "$compile_command " in
|
cannam@89
|
2478 *" -static "*) ;;
|
cannam@89
|
2479 *)
|
cannam@89
|
2480 case $host in
|
cannam@89
|
2481 # compiling the symbol table file with pic_flag works around
|
cannam@89
|
2482 # a FreeBSD bug that causes programs to crash when -lm is
|
cannam@89
|
2483 # linked before any other PIC object. But we must not use
|
cannam@89
|
2484 # pic_flag when linking with -static. The problem exists in
|
cannam@89
|
2485 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
|
cannam@89
|
2486 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
|
cannam@89
|
2487 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
|
cannam@89
|
2488 *-*-hpux*)
|
cannam@89
|
2489 pic_flag_for_symtable=" $pic_flag" ;;
|
cannam@89
|
2490 *)
|
cannam@89
|
2491 if test "X$my_pic_p" != Xno; then
|
cannam@89
|
2492 pic_flag_for_symtable=" $pic_flag"
|
cannam@89
|
2493 fi
|
cannam@89
|
2494 ;;
|
cannam@89
|
2495 esac
|
cannam@89
|
2496 ;;
|
cannam@89
|
2497 esac
|
cannam@89
|
2498 symtab_cflags=
|
cannam@89
|
2499 for arg in $LTCFLAGS; do
|
cannam@89
|
2500 case $arg in
|
cannam@89
|
2501 -pie | -fpie | -fPIE) ;;
|
cannam@89
|
2502 *) symtab_cflags="$symtab_cflags $arg" ;;
|
cannam@89
|
2503 esac
|
cannam@89
|
2504 done
|
cannam@89
|
2505
|
cannam@89
|
2506 # Now compile the dynamic symbol file.
|
cannam@89
|
2507 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
|
cannam@89
|
2508
|
cannam@89
|
2509 # Clean up the generated files.
|
cannam@89
|
2510 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
|
cannam@89
|
2511
|
cannam@89
|
2512 # Transform the symbol file into the correct name.
|
cannam@89
|
2513 symfileobj="$output_objdir/${my_outputname}S.$objext"
|
cannam@89
|
2514 case $host in
|
cannam@89
|
2515 *cygwin* | *mingw* )
|
cannam@89
|
2516 if test -f "$output_objdir/$my_outputname.def"; then
|
cannam@89
|
2517 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
|
cannam@89
|
2518 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
|
cannam@89
|
2519 else
|
cannam@89
|
2520 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
|
cannam@89
|
2521 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
|
cannam@89
|
2522 fi
|
cannam@89
|
2523 ;;
|
cannam@89
|
2524 *)
|
cannam@89
|
2525 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
|
cannam@89
|
2526 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
|
cannam@89
|
2527 ;;
|
cannam@89
|
2528 esac
|
cannam@89
|
2529 ;;
|
cannam@89
|
2530 *)
|
cannam@89
|
2531 func_fatal_error "unknown suffix for \`$my_dlsyms'"
|
cannam@89
|
2532 ;;
|
cannam@89
|
2533 esac
|
cannam@89
|
2534 else
|
cannam@89
|
2535 # We keep going just in case the user didn't refer to
|
cannam@89
|
2536 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
|
cannam@89
|
2537 # really was required.
|
cannam@89
|
2538
|
cannam@89
|
2539 # Nullify the symbol file.
|
cannam@89
|
2540 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
|
cannam@89
|
2541 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
|
cannam@89
|
2542 fi
|
cannam@89
|
2543 }
|
cannam@89
|
2544
|
cannam@89
|
2545 # func_win32_libid arg
|
cannam@89
|
2546 # return the library type of file 'arg'
|
cannam@89
|
2547 #
|
cannam@89
|
2548 # Need a lot of goo to handle *both* DLLs and import libs
|
cannam@89
|
2549 # Has to be a shell function in order to 'eat' the argument
|
cannam@89
|
2550 # that is supplied when $file_magic_command is called.
|
cannam@89
|
2551 func_win32_libid ()
|
cannam@89
|
2552 {
|
cannam@89
|
2553 $opt_debug
|
cannam@89
|
2554 win32_libid_type="unknown"
|
cannam@89
|
2555 win32_fileres=`file -L $1 2>/dev/null`
|
cannam@89
|
2556 case $win32_fileres in
|
cannam@89
|
2557 *ar\ archive\ import\ library*) # definitely import
|
cannam@89
|
2558 win32_libid_type="x86 archive import"
|
cannam@89
|
2559 ;;
|
cannam@89
|
2560 *ar\ archive*) # could be an import, or static
|
cannam@89
|
2561 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
|
cannam@89
|
2562 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
|
cannam@89
|
2563 win32_nmres=`eval $NM -f posix -A $1 |
|
cannam@89
|
2564 $SED -n -e '
|
cannam@89
|
2565 1,100{
|
cannam@89
|
2566 / I /{
|
cannam@89
|
2567 s,.*,import,
|
cannam@89
|
2568 p
|
cannam@89
|
2569 q
|
cannam@89
|
2570 }
|
cannam@89
|
2571 }'`
|
cannam@89
|
2572 case $win32_nmres in
|
cannam@89
|
2573 import*) win32_libid_type="x86 archive import";;
|
cannam@89
|
2574 *) win32_libid_type="x86 archive static";;
|
cannam@89
|
2575 esac
|
cannam@89
|
2576 fi
|
cannam@89
|
2577 ;;
|
cannam@89
|
2578 *DLL*)
|
cannam@89
|
2579 win32_libid_type="x86 DLL"
|
cannam@89
|
2580 ;;
|
cannam@89
|
2581 *executable*) # but shell scripts are "executable" too...
|
cannam@89
|
2582 case $win32_fileres in
|
cannam@89
|
2583 *MS\ Windows\ PE\ Intel*)
|
cannam@89
|
2584 win32_libid_type="x86 DLL"
|
cannam@89
|
2585 ;;
|
cannam@89
|
2586 esac
|
cannam@89
|
2587 ;;
|
cannam@89
|
2588 esac
|
cannam@89
|
2589 $ECHO "$win32_libid_type"
|
cannam@89
|
2590 }
|
cannam@89
|
2591
|
cannam@89
|
2592
|
cannam@89
|
2593
|
cannam@89
|
2594 # func_extract_an_archive dir oldlib
|
cannam@89
|
2595 func_extract_an_archive ()
|
cannam@89
|
2596 {
|
cannam@89
|
2597 $opt_debug
|
cannam@89
|
2598 f_ex_an_ar_dir="$1"; shift
|
cannam@89
|
2599 f_ex_an_ar_oldlib="$1"
|
cannam@89
|
2600 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
|
cannam@89
|
2601 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
|
cannam@89
|
2602 :
|
cannam@89
|
2603 else
|
cannam@89
|
2604 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
|
cannam@89
|
2605 fi
|
cannam@89
|
2606 }
|
cannam@89
|
2607
|
cannam@89
|
2608
|
cannam@89
|
2609 # func_extract_archives gentop oldlib ...
|
cannam@89
|
2610 func_extract_archives ()
|
cannam@89
|
2611 {
|
cannam@89
|
2612 $opt_debug
|
cannam@89
|
2613 my_gentop="$1"; shift
|
cannam@89
|
2614 my_oldlibs=${1+"$@"}
|
cannam@89
|
2615 my_oldobjs=""
|
cannam@89
|
2616 my_xlib=""
|
cannam@89
|
2617 my_xabs=""
|
cannam@89
|
2618 my_xdir=""
|
cannam@89
|
2619
|
cannam@89
|
2620 for my_xlib in $my_oldlibs; do
|
cannam@89
|
2621 # Extract the objects.
|
cannam@89
|
2622 case $my_xlib in
|
cannam@89
|
2623 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
|
cannam@89
|
2624 *) my_xabs=`pwd`"/$my_xlib" ;;
|
cannam@89
|
2625 esac
|
cannam@89
|
2626 func_basename "$my_xlib"
|
cannam@89
|
2627 my_xlib="$func_basename_result"
|
cannam@89
|
2628 my_xlib_u=$my_xlib
|
cannam@89
|
2629 while :; do
|
cannam@89
|
2630 case " $extracted_archives " in
|
cannam@89
|
2631 *" $my_xlib_u "*)
|
cannam@89
|
2632 func_arith $extracted_serial + 1
|
cannam@89
|
2633 extracted_serial=$func_arith_result
|
cannam@89
|
2634 my_xlib_u=lt$extracted_serial-$my_xlib ;;
|
cannam@89
|
2635 *) break ;;
|
cannam@89
|
2636 esac
|
cannam@89
|
2637 done
|
cannam@89
|
2638 extracted_archives="$extracted_archives $my_xlib_u"
|
cannam@89
|
2639 my_xdir="$my_gentop/$my_xlib_u"
|
cannam@89
|
2640
|
cannam@89
|
2641 func_mkdir_p "$my_xdir"
|
cannam@89
|
2642
|
cannam@89
|
2643 case $host in
|
cannam@89
|
2644 *-darwin*)
|
cannam@89
|
2645 func_verbose "Extracting $my_xabs"
|
cannam@89
|
2646 # Do not bother doing anything if just a dry run
|
cannam@89
|
2647 $opt_dry_run || {
|
cannam@89
|
2648 darwin_orig_dir=`pwd`
|
cannam@89
|
2649 cd $my_xdir || exit $?
|
cannam@89
|
2650 darwin_archive=$my_xabs
|
cannam@89
|
2651 darwin_curdir=`pwd`
|
cannam@89
|
2652 darwin_base_archive=`basename "$darwin_archive"`
|
cannam@89
|
2653 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
|
cannam@89
|
2654 if test -n "$darwin_arches"; then
|
cannam@89
|
2655 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
|
cannam@89
|
2656 darwin_arch=
|
cannam@89
|
2657 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
|
cannam@89
|
2658 for darwin_arch in $darwin_arches ; do
|
cannam@89
|
2659 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
|
cannam@89
|
2660 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
|
cannam@89
|
2661 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
|
cannam@89
|
2662 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
|
cannam@89
|
2663 cd "$darwin_curdir"
|
cannam@89
|
2664 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
|
cannam@89
|
2665 done # $darwin_arches
|
cannam@89
|
2666 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
|
cannam@89
|
2667 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
|
cannam@89
|
2668 darwin_file=
|
cannam@89
|
2669 darwin_files=
|
cannam@89
|
2670 for darwin_file in $darwin_filelist; do
|
cannam@89
|
2671 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
|
cannam@89
|
2672 $LIPO -create -output "$darwin_file" $darwin_files
|
cannam@89
|
2673 done # $darwin_filelist
|
cannam@89
|
2674 $RM -rf unfat-$$
|
cannam@89
|
2675 cd "$darwin_orig_dir"
|
cannam@89
|
2676 else
|
cannam@89
|
2677 cd $darwin_orig_dir
|
cannam@89
|
2678 func_extract_an_archive "$my_xdir" "$my_xabs"
|
cannam@89
|
2679 fi # $darwin_arches
|
cannam@89
|
2680 } # !$opt_dry_run
|
cannam@89
|
2681 ;;
|
cannam@89
|
2682 *)
|
cannam@89
|
2683 func_extract_an_archive "$my_xdir" "$my_xabs"
|
cannam@89
|
2684 ;;
|
cannam@89
|
2685 esac
|
cannam@89
|
2686 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
|
cannam@89
|
2687 done
|
cannam@89
|
2688
|
cannam@89
|
2689 func_extract_archives_result="$my_oldobjs"
|
cannam@89
|
2690 }
|
cannam@89
|
2691
|
cannam@89
|
2692
|
cannam@89
|
2693
|
cannam@89
|
2694 # func_emit_wrapper arg
|
cannam@89
|
2695 #
|
cannam@89
|
2696 # emit a libtool wrapper script on stdout
|
cannam@89
|
2697 # don't directly open a file because we may want to
|
cannam@89
|
2698 # incorporate the script contents within a cygwin/mingw
|
cannam@89
|
2699 # wrapper executable. Must ONLY be called from within
|
cannam@89
|
2700 # func_mode_link because it depends on a number of variable
|
cannam@89
|
2701 # set therein.
|
cannam@89
|
2702 #
|
cannam@89
|
2703 # arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
|
cannam@89
|
2704 # variable will take. If 'yes', then the emitted script
|
cannam@89
|
2705 # will assume that the directory in which it is stored is
|
cannam@89
|
2706 # the '.lib' directory. This is a cygwin/mingw-specific
|
cannam@89
|
2707 # behavior.
|
cannam@89
|
2708 func_emit_wrapper ()
|
cannam@89
|
2709 {
|
cannam@89
|
2710 func_emit_wrapper_arg1=no
|
cannam@89
|
2711 if test -n "$1" ; then
|
cannam@89
|
2712 func_emit_wrapper_arg1=$1
|
cannam@89
|
2713 fi
|
cannam@89
|
2714
|
cannam@89
|
2715 $ECHO "\
|
cannam@89
|
2716 #! $SHELL
|
cannam@89
|
2717
|
cannam@89
|
2718 # $output - temporary wrapper script for $objdir/$outputname
|
cannam@89
|
2719 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
|
cannam@89
|
2720 #
|
cannam@89
|
2721 # The $output program cannot be directly executed until all the libtool
|
cannam@89
|
2722 # libraries that it depends on are installed.
|
cannam@89
|
2723 #
|
cannam@89
|
2724 # This wrapper script should never be moved out of the build directory.
|
cannam@89
|
2725 # If it is, it will not operate correctly.
|
cannam@89
|
2726
|
cannam@89
|
2727 # Sed substitution that helps us do robust quoting. It backslashifies
|
cannam@89
|
2728 # metacharacters that are still active within double-quoted strings.
|
cannam@89
|
2729 Xsed='${SED} -e 1s/^X//'
|
cannam@89
|
2730 sed_quote_subst='$sed_quote_subst'
|
cannam@89
|
2731
|
cannam@89
|
2732 # Be Bourne compatible
|
cannam@89
|
2733 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
|
cannam@89
|
2734 emulate sh
|
cannam@89
|
2735 NULLCMD=:
|
cannam@89
|
2736 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
|
cannam@89
|
2737 # is contrary to our usage. Disable this feature.
|
cannam@89
|
2738 alias -g '\${1+\"\$@\"}'='\"\$@\"'
|
cannam@89
|
2739 setopt NO_GLOB_SUBST
|
cannam@89
|
2740 else
|
cannam@89
|
2741 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
|
cannam@89
|
2742 fi
|
cannam@89
|
2743 BIN_SH=xpg4; export BIN_SH # for Tru64
|
cannam@89
|
2744 DUALCASE=1; export DUALCASE # for MKS sh
|
cannam@89
|
2745
|
cannam@89
|
2746 # The HP-UX ksh and POSIX shell print the target directory to stdout
|
cannam@89
|
2747 # if CDPATH is set.
|
cannam@89
|
2748 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
cannam@89
|
2749
|
cannam@89
|
2750 relink_command=\"$relink_command\"
|
cannam@89
|
2751
|
cannam@89
|
2752 # This environment variable determines our operation mode.
|
cannam@89
|
2753 if test \"\$libtool_install_magic\" = \"$magic\"; then
|
cannam@89
|
2754 # install mode needs the following variables:
|
cannam@89
|
2755 generated_by_libtool_version='$macro_version'
|
cannam@89
|
2756 notinst_deplibs='$notinst_deplibs'
|
cannam@89
|
2757 else
|
cannam@89
|
2758 # When we are sourced in execute mode, \$file and \$ECHO are already set.
|
cannam@89
|
2759 if test \"\$libtool_execute_magic\" != \"$magic\"; then
|
cannam@89
|
2760 ECHO=\"$qecho\"
|
cannam@89
|
2761 file=\"\$0\"
|
cannam@89
|
2762 # Make sure echo works.
|
cannam@89
|
2763 if test \"X\$1\" = X--no-reexec; then
|
cannam@89
|
2764 # Discard the --no-reexec flag, and continue.
|
cannam@89
|
2765 shift
|
cannam@89
|
2766 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
|
cannam@89
|
2767 # Yippee, \$ECHO works!
|
cannam@89
|
2768 :
|
cannam@89
|
2769 else
|
cannam@89
|
2770 # Restart under the correct shell, and then maybe \$ECHO will work.
|
cannam@89
|
2771 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
|
cannam@89
|
2772 fi
|
cannam@89
|
2773 fi\
|
cannam@89
|
2774 "
|
cannam@89
|
2775 $ECHO "\
|
cannam@89
|
2776
|
cannam@89
|
2777 # Find the directory that this script lives in.
|
cannam@89
|
2778 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
|
cannam@89
|
2779 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
|
cannam@89
|
2780
|
cannam@89
|
2781 # Follow symbolic links until we get to the real thisdir.
|
cannam@89
|
2782 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
|
cannam@89
|
2783 while test -n \"\$file\"; do
|
cannam@89
|
2784 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
|
cannam@89
|
2785
|
cannam@89
|
2786 # If there was a directory component, then change thisdir.
|
cannam@89
|
2787 if test \"x\$destdir\" != \"x\$file\"; then
|
cannam@89
|
2788 case \"\$destdir\" in
|
cannam@89
|
2789 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
|
cannam@89
|
2790 *) thisdir=\"\$thisdir/\$destdir\" ;;
|
cannam@89
|
2791 esac
|
cannam@89
|
2792 fi
|
cannam@89
|
2793
|
cannam@89
|
2794 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
|
cannam@89
|
2795 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
|
cannam@89
|
2796 done
|
cannam@89
|
2797
|
cannam@89
|
2798 # Usually 'no', except on cygwin/mingw when embedded into
|
cannam@89
|
2799 # the cwrapper.
|
cannam@89
|
2800 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
|
cannam@89
|
2801 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
|
cannam@89
|
2802 # special case for '.'
|
cannam@89
|
2803 if test \"\$thisdir\" = \".\"; then
|
cannam@89
|
2804 thisdir=\`pwd\`
|
cannam@89
|
2805 fi
|
cannam@89
|
2806 # remove .libs from thisdir
|
cannam@89
|
2807 case \"\$thisdir\" in
|
cannam@89
|
2808 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
|
cannam@89
|
2809 $objdir ) thisdir=. ;;
|
cannam@89
|
2810 esac
|
cannam@89
|
2811 fi
|
cannam@89
|
2812
|
cannam@89
|
2813 # Try to get the absolute directory name.
|
cannam@89
|
2814 absdir=\`cd \"\$thisdir\" && pwd\`
|
cannam@89
|
2815 test -n \"\$absdir\" && thisdir=\"\$absdir\"
|
cannam@89
|
2816 "
|
cannam@89
|
2817
|
cannam@89
|
2818 if test "$fast_install" = yes; then
|
cannam@89
|
2819 $ECHO "\
|
cannam@89
|
2820 program=lt-'$outputname'$exeext
|
cannam@89
|
2821 progdir=\"\$thisdir/$objdir\"
|
cannam@89
|
2822
|
cannam@89
|
2823 if test ! -f \"\$progdir/\$program\" ||
|
cannam@89
|
2824 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
|
cannam@89
|
2825 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
|
cannam@89
|
2826
|
cannam@89
|
2827 file=\"\$\$-\$program\"
|
cannam@89
|
2828
|
cannam@89
|
2829 if test ! -d \"\$progdir\"; then
|
cannam@89
|
2830 $MKDIR \"\$progdir\"
|
cannam@89
|
2831 else
|
cannam@89
|
2832 $RM \"\$progdir/\$file\"
|
cannam@89
|
2833 fi"
|
cannam@89
|
2834
|
cannam@89
|
2835 $ECHO "\
|
cannam@89
|
2836
|
cannam@89
|
2837 # relink executable if necessary
|
cannam@89
|
2838 if test -n \"\$relink_command\"; then
|
cannam@89
|
2839 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
|
cannam@89
|
2840 else
|
cannam@89
|
2841 $ECHO \"\$relink_command_output\" >&2
|
cannam@89
|
2842 $RM \"\$progdir/\$file\"
|
cannam@89
|
2843 exit 1
|
cannam@89
|
2844 fi
|
cannam@89
|
2845 fi
|
cannam@89
|
2846
|
cannam@89
|
2847 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
|
cannam@89
|
2848 { $RM \"\$progdir/\$program\";
|
cannam@89
|
2849 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
|
cannam@89
|
2850 $RM \"\$progdir/\$file\"
|
cannam@89
|
2851 fi"
|
cannam@89
|
2852 else
|
cannam@89
|
2853 $ECHO "\
|
cannam@89
|
2854 program='$outputname'
|
cannam@89
|
2855 progdir=\"\$thisdir/$objdir\"
|
cannam@89
|
2856 "
|
cannam@89
|
2857 fi
|
cannam@89
|
2858
|
cannam@89
|
2859 $ECHO "\
|
cannam@89
|
2860
|
cannam@89
|
2861 if test -f \"\$progdir/\$program\"; then"
|
cannam@89
|
2862
|
cannam@89
|
2863 # Export our shlibpath_var if we have one.
|
cannam@89
|
2864 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
|
cannam@89
|
2865 $ECHO "\
|
cannam@89
|
2866 # Add our own library path to $shlibpath_var
|
cannam@89
|
2867 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
|
cannam@89
|
2868
|
cannam@89
|
2869 # Some systems cannot cope with colon-terminated $shlibpath_var
|
cannam@89
|
2870 # The second colon is a workaround for a bug in BeOS R4 sed
|
cannam@89
|
2871 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
|
cannam@89
|
2872
|
cannam@89
|
2873 export $shlibpath_var
|
cannam@89
|
2874 "
|
cannam@89
|
2875 fi
|
cannam@89
|
2876
|
cannam@89
|
2877 # fixup the dll searchpath if we need to.
|
cannam@89
|
2878 if test -n "$dllsearchpath"; then
|
cannam@89
|
2879 $ECHO "\
|
cannam@89
|
2880 # Add the dll search path components to the executable PATH
|
cannam@89
|
2881 PATH=$dllsearchpath:\$PATH
|
cannam@89
|
2882 "
|
cannam@89
|
2883 fi
|
cannam@89
|
2884
|
cannam@89
|
2885 $ECHO "\
|
cannam@89
|
2886 if test \"\$libtool_execute_magic\" != \"$magic\"; then
|
cannam@89
|
2887 # Run the actual program with our arguments.
|
cannam@89
|
2888 "
|
cannam@89
|
2889 case $host in
|
cannam@89
|
2890 # Backslashes separate directories on plain windows
|
cannam@89
|
2891 *-*-mingw | *-*-os2*)
|
cannam@89
|
2892 $ECHO "\
|
cannam@89
|
2893 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
|
cannam@89
|
2894 "
|
cannam@89
|
2895 ;;
|
cannam@89
|
2896
|
cannam@89
|
2897 *)
|
cannam@89
|
2898 $ECHO "\
|
cannam@89
|
2899 exec \"\$progdir/\$program\" \${1+\"\$@\"}
|
cannam@89
|
2900 "
|
cannam@89
|
2901 ;;
|
cannam@89
|
2902 esac
|
cannam@89
|
2903 $ECHO "\
|
cannam@89
|
2904 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
|
cannam@89
|
2905 exit 1
|
cannam@89
|
2906 fi
|
cannam@89
|
2907 else
|
cannam@89
|
2908 # The program doesn't exist.
|
cannam@89
|
2909 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
|
cannam@89
|
2910 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
|
cannam@89
|
2911 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
|
cannam@89
|
2912 exit 1
|
cannam@89
|
2913 fi
|
cannam@89
|
2914 fi\
|
cannam@89
|
2915 "
|
cannam@89
|
2916 }
|
cannam@89
|
2917 # end: func_emit_wrapper
|
cannam@89
|
2918
|
cannam@89
|
2919 # func_emit_cwrapperexe_src
|
cannam@89
|
2920 # emit the source code for a wrapper executable on stdout
|
cannam@89
|
2921 # Must ONLY be called from within func_mode_link because
|
cannam@89
|
2922 # it depends on a number of variable set therein.
|
cannam@89
|
2923 func_emit_cwrapperexe_src ()
|
cannam@89
|
2924 {
|
cannam@89
|
2925 cat <<EOF
|
cannam@89
|
2926
|
cannam@89
|
2927 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
|
cannam@89
|
2928 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
|
cannam@89
|
2929
|
cannam@89
|
2930 The $output program cannot be directly executed until all the libtool
|
cannam@89
|
2931 libraries that it depends on are installed.
|
cannam@89
|
2932
|
cannam@89
|
2933 This wrapper executable should never be moved out of the build directory.
|
cannam@89
|
2934 If it is, it will not operate correctly.
|
cannam@89
|
2935
|
cannam@89
|
2936 Currently, it simply execs the wrapper *script* "$SHELL $output",
|
cannam@89
|
2937 but could eventually absorb all of the scripts functionality and
|
cannam@89
|
2938 exec $objdir/$outputname directly.
|
cannam@89
|
2939 */
|
cannam@89
|
2940 EOF
|
cannam@89
|
2941 cat <<"EOF"
|
cannam@89
|
2942 #include <stdio.h>
|
cannam@89
|
2943 #include <stdlib.h>
|
cannam@89
|
2944 #ifdef _MSC_VER
|
cannam@89
|
2945 # include <direct.h>
|
cannam@89
|
2946 # include <process.h>
|
cannam@89
|
2947 # include <io.h>
|
cannam@89
|
2948 # define setmode _setmode
|
cannam@89
|
2949 #else
|
cannam@89
|
2950 # include <unistd.h>
|
cannam@89
|
2951 # include <stdint.h>
|
cannam@89
|
2952 # ifdef __CYGWIN__
|
cannam@89
|
2953 # include <io.h>
|
cannam@89
|
2954 # endif
|
cannam@89
|
2955 #endif
|
cannam@89
|
2956 #include <malloc.h>
|
cannam@89
|
2957 #include <stdarg.h>
|
cannam@89
|
2958 #include <assert.h>
|
cannam@89
|
2959 #include <string.h>
|
cannam@89
|
2960 #include <ctype.h>
|
cannam@89
|
2961 #include <errno.h>
|
cannam@89
|
2962 #include <fcntl.h>
|
cannam@89
|
2963 #include <sys/stat.h>
|
cannam@89
|
2964
|
cannam@89
|
2965 #if defined(PATH_MAX)
|
cannam@89
|
2966 # define LT_PATHMAX PATH_MAX
|
cannam@89
|
2967 #elif defined(MAXPATHLEN)
|
cannam@89
|
2968 # define LT_PATHMAX MAXPATHLEN
|
cannam@89
|
2969 #else
|
cannam@89
|
2970 # define LT_PATHMAX 1024
|
cannam@89
|
2971 #endif
|
cannam@89
|
2972
|
cannam@89
|
2973 #ifndef S_IXOTH
|
cannam@89
|
2974 # define S_IXOTH 0
|
cannam@89
|
2975 #endif
|
cannam@89
|
2976 #ifndef S_IXGRP
|
cannam@89
|
2977 # define S_IXGRP 0
|
cannam@89
|
2978 #endif
|
cannam@89
|
2979
|
cannam@89
|
2980 #ifdef _MSC_VER
|
cannam@89
|
2981 # define S_IXUSR _S_IEXEC
|
cannam@89
|
2982 # define stat _stat
|
cannam@89
|
2983 # ifndef _INTPTR_T_DEFINED
|
cannam@89
|
2984 # define intptr_t int
|
cannam@89
|
2985 # endif
|
cannam@89
|
2986 #endif
|
cannam@89
|
2987
|
cannam@89
|
2988 #ifndef DIR_SEPARATOR
|
cannam@89
|
2989 # define DIR_SEPARATOR '/'
|
cannam@89
|
2990 # define PATH_SEPARATOR ':'
|
cannam@89
|
2991 #endif
|
cannam@89
|
2992
|
cannam@89
|
2993 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
|
cannam@89
|
2994 defined (__OS2__)
|
cannam@89
|
2995 # define HAVE_DOS_BASED_FILE_SYSTEM
|
cannam@89
|
2996 # define FOPEN_WB "wb"
|
cannam@89
|
2997 # ifndef DIR_SEPARATOR_2
|
cannam@89
|
2998 # define DIR_SEPARATOR_2 '\\'
|
cannam@89
|
2999 # endif
|
cannam@89
|
3000 # ifndef PATH_SEPARATOR_2
|
cannam@89
|
3001 # define PATH_SEPARATOR_2 ';'
|
cannam@89
|
3002 # endif
|
cannam@89
|
3003 #endif
|
cannam@89
|
3004
|
cannam@89
|
3005 #ifndef DIR_SEPARATOR_2
|
cannam@89
|
3006 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
|
cannam@89
|
3007 #else /* DIR_SEPARATOR_2 */
|
cannam@89
|
3008 # define IS_DIR_SEPARATOR(ch) \
|
cannam@89
|
3009 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
|
cannam@89
|
3010 #endif /* DIR_SEPARATOR_2 */
|
cannam@89
|
3011
|
cannam@89
|
3012 #ifndef PATH_SEPARATOR_2
|
cannam@89
|
3013 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
|
cannam@89
|
3014 #else /* PATH_SEPARATOR_2 */
|
cannam@89
|
3015 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
|
cannam@89
|
3016 #endif /* PATH_SEPARATOR_2 */
|
cannam@89
|
3017
|
cannam@89
|
3018 #ifdef __CYGWIN__
|
cannam@89
|
3019 # define FOPEN_WB "wb"
|
cannam@89
|
3020 #endif
|
cannam@89
|
3021
|
cannam@89
|
3022 #ifndef FOPEN_WB
|
cannam@89
|
3023 # define FOPEN_WB "w"
|
cannam@89
|
3024 #endif
|
cannam@89
|
3025 #ifndef _O_BINARY
|
cannam@89
|
3026 # define _O_BINARY 0
|
cannam@89
|
3027 #endif
|
cannam@89
|
3028
|
cannam@89
|
3029 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
|
cannam@89
|
3030 #define XFREE(stale) do { \
|
cannam@89
|
3031 if (stale) { free ((void *) stale); stale = 0; } \
|
cannam@89
|
3032 } while (0)
|
cannam@89
|
3033
|
cannam@89
|
3034 #undef LTWRAPPER_DEBUGPRINTF
|
cannam@89
|
3035 #if defined DEBUGWRAPPER
|
cannam@89
|
3036 # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
|
cannam@89
|
3037 static void
|
cannam@89
|
3038 ltwrapper_debugprintf (const char *fmt, ...)
|
cannam@89
|
3039 {
|
cannam@89
|
3040 va_list args;
|
cannam@89
|
3041 va_start (args, fmt);
|
cannam@89
|
3042 (void) vfprintf (stderr, fmt, args);
|
cannam@89
|
3043 va_end (args);
|
cannam@89
|
3044 }
|
cannam@89
|
3045 #else
|
cannam@89
|
3046 # define LTWRAPPER_DEBUGPRINTF(args)
|
cannam@89
|
3047 #endif
|
cannam@89
|
3048
|
cannam@89
|
3049 const char *program_name = NULL;
|
cannam@89
|
3050
|
cannam@89
|
3051 void *xmalloc (size_t num);
|
cannam@89
|
3052 char *xstrdup (const char *string);
|
cannam@89
|
3053 const char *base_name (const char *name);
|
cannam@89
|
3054 char *find_executable (const char *wrapper);
|
cannam@89
|
3055 char *chase_symlinks (const char *pathspec);
|
cannam@89
|
3056 int make_executable (const char *path);
|
cannam@89
|
3057 int check_executable (const char *path);
|
cannam@89
|
3058 char *strendzap (char *str, const char *pat);
|
cannam@89
|
3059 void lt_fatal (const char *message, ...);
|
cannam@89
|
3060
|
cannam@89
|
3061 static const char *script_text =
|
cannam@89
|
3062 EOF
|
cannam@89
|
3063
|
cannam@89
|
3064 func_emit_wrapper yes |
|
cannam@89
|
3065 $SED -e 's/\([\\"]\)/\\\1/g' \
|
cannam@89
|
3066 -e 's/^/ "/' -e 's/$/\\n"/'
|
cannam@89
|
3067 echo ";"
|
cannam@89
|
3068
|
cannam@89
|
3069 cat <<EOF
|
cannam@89
|
3070 const char * MAGIC_EXE = "$magic_exe";
|
cannam@89
|
3071
|
cannam@89
|
3072 int
|
cannam@89
|
3073 main (int argc, char *argv[])
|
cannam@89
|
3074 {
|
cannam@89
|
3075 char **newargz;
|
cannam@89
|
3076 char *tmp_pathspec;
|
cannam@89
|
3077 char *actual_cwrapper_path;
|
cannam@89
|
3078 char *shwrapper_name;
|
cannam@89
|
3079 intptr_t rval = 127;
|
cannam@89
|
3080 FILE *shwrapper;
|
cannam@89
|
3081
|
cannam@89
|
3082 const char *dumpscript_opt = "--lt-dump-script";
|
cannam@89
|
3083 int i;
|
cannam@89
|
3084
|
cannam@89
|
3085 program_name = (char *) xstrdup (base_name (argv[0]));
|
cannam@89
|
3086 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
|
cannam@89
|
3087 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
|
cannam@89
|
3088
|
cannam@89
|
3089 /* very simple arg parsing; don't want to rely on getopt */
|
cannam@89
|
3090 for (i = 1; i < argc; i++)
|
cannam@89
|
3091 {
|
cannam@89
|
3092 if (strcmp (argv[i], dumpscript_opt) == 0)
|
cannam@89
|
3093 {
|
cannam@89
|
3094 EOF
|
cannam@89
|
3095 case "$host" in
|
cannam@89
|
3096 *mingw* | *cygwin* )
|
cannam@89
|
3097 # make stdout use "unix" line endings
|
cannam@89
|
3098 echo " setmode(1,_O_BINARY);"
|
cannam@89
|
3099 ;;
|
cannam@89
|
3100 esac
|
cannam@89
|
3101
|
cannam@89
|
3102 cat <<EOF
|
cannam@89
|
3103 printf ("%s", script_text);
|
cannam@89
|
3104 return 0;
|
cannam@89
|
3105 }
|
cannam@89
|
3106 }
|
cannam@89
|
3107
|
cannam@89
|
3108 newargz = XMALLOC (char *, argc + 2);
|
cannam@89
|
3109 EOF
|
cannam@89
|
3110
|
cannam@89
|
3111 if test -n "$TARGETSHELL" ; then
|
cannam@89
|
3112 # no path translation at all
|
cannam@89
|
3113 lt_newargv0=$TARGETSHELL
|
cannam@89
|
3114 else
|
cannam@89
|
3115 case "$host" in
|
cannam@89
|
3116 *mingw* )
|
cannam@89
|
3117 # awkward: cmd appends spaces to result
|
cannam@89
|
3118 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
|
cannam@89
|
3119 lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL`
|
cannam@89
|
3120 case $lt_newargv0 in
|
cannam@89
|
3121 *.exe | *.EXE) ;;
|
cannam@89
|
3122 *) lt_newargv0=$lt_newargv0.exe ;;
|
cannam@89
|
3123 esac
|
cannam@89
|
3124 ;;
|
cannam@89
|
3125 * ) lt_newargv0=$SHELL ;;
|
cannam@89
|
3126 esac
|
cannam@89
|
3127 fi
|
cannam@89
|
3128
|
cannam@89
|
3129 cat <<EOF
|
cannam@89
|
3130 newargz[0] = (char *) xstrdup ("$lt_newargv0");
|
cannam@89
|
3131 EOF
|
cannam@89
|
3132
|
cannam@89
|
3133 cat <<"EOF"
|
cannam@89
|
3134 tmp_pathspec = find_executable (argv[0]);
|
cannam@89
|
3135 if (tmp_pathspec == NULL)
|
cannam@89
|
3136 lt_fatal ("Couldn't find %s", argv[0]);
|
cannam@89
|
3137 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
|
cannam@89
|
3138 tmp_pathspec));
|
cannam@89
|
3139
|
cannam@89
|
3140 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
|
cannam@89
|
3141 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
|
cannam@89
|
3142 actual_cwrapper_path));
|
cannam@89
|
3143 XFREE (tmp_pathspec);
|
cannam@89
|
3144
|
cannam@89
|
3145 shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
|
cannam@89
|
3146 strendzap (actual_cwrapper_path, shwrapper_name);
|
cannam@89
|
3147
|
cannam@89
|
3148 /* shwrapper_name transforms */
|
cannam@89
|
3149 strendzap (shwrapper_name, ".exe");
|
cannam@89
|
3150 tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) +
|
cannam@89
|
3151 strlen ("_ltshwrapperTMP") + 1));
|
cannam@89
|
3152 strcpy (tmp_pathspec, shwrapper_name);
|
cannam@89
|
3153 strcat (tmp_pathspec, "_ltshwrapperTMP");
|
cannam@89
|
3154 XFREE (shwrapper_name);
|
cannam@89
|
3155 shwrapper_name = tmp_pathspec;
|
cannam@89
|
3156 tmp_pathspec = 0;
|
cannam@89
|
3157 LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
|
cannam@89
|
3158 shwrapper_name));
|
cannam@89
|
3159 EOF
|
cannam@89
|
3160
|
cannam@89
|
3161 cat <<EOF
|
cannam@89
|
3162 newargz[1] =
|
cannam@89
|
3163 XMALLOC (char, (strlen (actual_cwrapper_path) +
|
cannam@89
|
3164 strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1));
|
cannam@89
|
3165 strcpy (newargz[1], actual_cwrapper_path);
|
cannam@89
|
3166 strcat (newargz[1], "$objdir");
|
cannam@89
|
3167 strcat (newargz[1], "/");
|
cannam@89
|
3168 strcat (newargz[1], shwrapper_name);
|
cannam@89
|
3169 EOF
|
cannam@89
|
3170
|
cannam@89
|
3171
|
cannam@89
|
3172 case $host_os in
|
cannam@89
|
3173 mingw*)
|
cannam@89
|
3174 cat <<"EOF"
|
cannam@89
|
3175 {
|
cannam@89
|
3176 char* p;
|
cannam@89
|
3177 while ((p = strchr (newargz[1], '\\')) != NULL)
|
cannam@89
|
3178 {
|
cannam@89
|
3179 *p = '/';
|
cannam@89
|
3180 }
|
cannam@89
|
3181 }
|
cannam@89
|
3182 EOF
|
cannam@89
|
3183 ;;
|
cannam@89
|
3184 esac
|
cannam@89
|
3185
|
cannam@89
|
3186 cat <<"EOF"
|
cannam@89
|
3187 XFREE (shwrapper_name);
|
cannam@89
|
3188 XFREE (actual_cwrapper_path);
|
cannam@89
|
3189
|
cannam@89
|
3190 /* always write in binary mode */
|
cannam@89
|
3191 if ((shwrapper = fopen (newargz[1], FOPEN_WB)) == 0)
|
cannam@89
|
3192 {
|
cannam@89
|
3193 lt_fatal ("Could not open %s for writing", newargz[1]);
|
cannam@89
|
3194 }
|
cannam@89
|
3195 fprintf (shwrapper, "%s", script_text);
|
cannam@89
|
3196 fclose (shwrapper);
|
cannam@89
|
3197
|
cannam@89
|
3198 make_executable (newargz[1]);
|
cannam@89
|
3199
|
cannam@89
|
3200 for (i = 1; i < argc; i++)
|
cannam@89
|
3201 newargz[i + 1] = xstrdup (argv[i]);
|
cannam@89
|
3202 newargz[argc + 1] = NULL;
|
cannam@89
|
3203
|
cannam@89
|
3204 for (i = 0; i < argc + 1; i++)
|
cannam@89
|
3205 {
|
cannam@89
|
3206 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, newargz[i]));
|
cannam@89
|
3207 }
|
cannam@89
|
3208
|
cannam@89
|
3209 EOF
|
cannam@89
|
3210
|
cannam@89
|
3211 case $host_os in
|
cannam@89
|
3212 mingw*)
|
cannam@89
|
3213 cat <<EOF
|
cannam@89
|
3214 /* execv doesn't actually work on mingw as expected on unix */
|
cannam@89
|
3215 rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz);
|
cannam@89
|
3216 if (rval == -1)
|
cannam@89
|
3217 {
|
cannam@89
|
3218 /* failed to start process */
|
cannam@89
|
3219 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno));
|
cannam@89
|
3220 return 127;
|
cannam@89
|
3221 }
|
cannam@89
|
3222 return rval;
|
cannam@89
|
3223 }
|
cannam@89
|
3224 EOF
|
cannam@89
|
3225 ;;
|
cannam@89
|
3226 *)
|
cannam@89
|
3227 cat <<EOF
|
cannam@89
|
3228 execv ("$lt_newargv0", newargz);
|
cannam@89
|
3229 return rval; /* =127, but avoids unused variable warning */
|
cannam@89
|
3230 }
|
cannam@89
|
3231 EOF
|
cannam@89
|
3232 ;;
|
cannam@89
|
3233 esac
|
cannam@89
|
3234
|
cannam@89
|
3235 cat <<"EOF"
|
cannam@89
|
3236
|
cannam@89
|
3237 void *
|
cannam@89
|
3238 xmalloc (size_t num)
|
cannam@89
|
3239 {
|
cannam@89
|
3240 void *p = (void *) malloc (num);
|
cannam@89
|
3241 if (!p)
|
cannam@89
|
3242 lt_fatal ("Memory exhausted");
|
cannam@89
|
3243
|
cannam@89
|
3244 return p;
|
cannam@89
|
3245 }
|
cannam@89
|
3246
|
cannam@89
|
3247 char *
|
cannam@89
|
3248 xstrdup (const char *string)
|
cannam@89
|
3249 {
|
cannam@89
|
3250 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
|
cannam@89
|
3251 string) : NULL;
|
cannam@89
|
3252 }
|
cannam@89
|
3253
|
cannam@89
|
3254 const char *
|
cannam@89
|
3255 base_name (const char *name)
|
cannam@89
|
3256 {
|
cannam@89
|
3257 const char *base;
|
cannam@89
|
3258
|
cannam@89
|
3259 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
|
cannam@89
|
3260 /* Skip over the disk name in MSDOS pathnames. */
|
cannam@89
|
3261 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
|
cannam@89
|
3262 name += 2;
|
cannam@89
|
3263 #endif
|
cannam@89
|
3264
|
cannam@89
|
3265 for (base = name; *name; name++)
|
cannam@89
|
3266 if (IS_DIR_SEPARATOR (*name))
|
cannam@89
|
3267 base = name + 1;
|
cannam@89
|
3268 return base;
|
cannam@89
|
3269 }
|
cannam@89
|
3270
|
cannam@89
|
3271 int
|
cannam@89
|
3272 check_executable (const char *path)
|
cannam@89
|
3273 {
|
cannam@89
|
3274 struct stat st;
|
cannam@89
|
3275
|
cannam@89
|
3276 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
|
cannam@89
|
3277 path ? (*path ? path : "EMPTY!") : "NULL!"));
|
cannam@89
|
3278 if ((!path) || (!*path))
|
cannam@89
|
3279 return 0;
|
cannam@89
|
3280
|
cannam@89
|
3281 if ((stat (path, &st) >= 0)
|
cannam@89
|
3282 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
|
cannam@89
|
3283 return 1;
|
cannam@89
|
3284 else
|
cannam@89
|
3285 return 0;
|
cannam@89
|
3286 }
|
cannam@89
|
3287
|
cannam@89
|
3288 int
|
cannam@89
|
3289 make_executable (const char *path)
|
cannam@89
|
3290 {
|
cannam@89
|
3291 int rval = 0;
|
cannam@89
|
3292 struct stat st;
|
cannam@89
|
3293
|
cannam@89
|
3294 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
|
cannam@89
|
3295 path ? (*path ? path : "EMPTY!") : "NULL!"));
|
cannam@89
|
3296 if ((!path) || (!*path))
|
cannam@89
|
3297 return 0;
|
cannam@89
|
3298
|
cannam@89
|
3299 if (stat (path, &st) >= 0)
|
cannam@89
|
3300 {
|
cannam@89
|
3301 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
|
cannam@89
|
3302 }
|
cannam@89
|
3303 return rval;
|
cannam@89
|
3304 }
|
cannam@89
|
3305
|
cannam@89
|
3306 /* Searches for the full path of the wrapper. Returns
|
cannam@89
|
3307 newly allocated full path name if found, NULL otherwise
|
cannam@89
|
3308 Does not chase symlinks, even on platforms that support them.
|
cannam@89
|
3309 */
|
cannam@89
|
3310 char *
|
cannam@89
|
3311 find_executable (const char *wrapper)
|
cannam@89
|
3312 {
|
cannam@89
|
3313 int has_slash = 0;
|
cannam@89
|
3314 const char *p;
|
cannam@89
|
3315 const char *p_next;
|
cannam@89
|
3316 /* static buffer for getcwd */
|
cannam@89
|
3317 char tmp[LT_PATHMAX + 1];
|
cannam@89
|
3318 int tmp_len;
|
cannam@89
|
3319 char *concat_name;
|
cannam@89
|
3320
|
cannam@89
|
3321 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
|
cannam@89
|
3322 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
|
cannam@89
|
3323
|
cannam@89
|
3324 if ((wrapper == NULL) || (*wrapper == '\0'))
|
cannam@89
|
3325 return NULL;
|
cannam@89
|
3326
|
cannam@89
|
3327 /* Absolute path? */
|
cannam@89
|
3328 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
|
cannam@89
|
3329 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
|
cannam@89
|
3330 {
|
cannam@89
|
3331 concat_name = xstrdup (wrapper);
|
cannam@89
|
3332 if (check_executable (concat_name))
|
cannam@89
|
3333 return concat_name;
|
cannam@89
|
3334 XFREE (concat_name);
|
cannam@89
|
3335 }
|
cannam@89
|
3336 else
|
cannam@89
|
3337 {
|
cannam@89
|
3338 #endif
|
cannam@89
|
3339 if (IS_DIR_SEPARATOR (wrapper[0]))
|
cannam@89
|
3340 {
|
cannam@89
|
3341 concat_name = xstrdup (wrapper);
|
cannam@89
|
3342 if (check_executable (concat_name))
|
cannam@89
|
3343 return concat_name;
|
cannam@89
|
3344 XFREE (concat_name);
|
cannam@89
|
3345 }
|
cannam@89
|
3346 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
|
cannam@89
|
3347 }
|
cannam@89
|
3348 #endif
|
cannam@89
|
3349
|
cannam@89
|
3350 for (p = wrapper; *p; p++)
|
cannam@89
|
3351 if (*p == '/')
|
cannam@89
|
3352 {
|
cannam@89
|
3353 has_slash = 1;
|
cannam@89
|
3354 break;
|
cannam@89
|
3355 }
|
cannam@89
|
3356 if (!has_slash)
|
cannam@89
|
3357 {
|
cannam@89
|
3358 /* no slashes; search PATH */
|
cannam@89
|
3359 const char *path = getenv ("PATH");
|
cannam@89
|
3360 if (path != NULL)
|
cannam@89
|
3361 {
|
cannam@89
|
3362 for (p = path; *p; p = p_next)
|
cannam@89
|
3363 {
|
cannam@89
|
3364 const char *q;
|
cannam@89
|
3365 size_t p_len;
|
cannam@89
|
3366 for (q = p; *q; q++)
|
cannam@89
|
3367 if (IS_PATH_SEPARATOR (*q))
|
cannam@89
|
3368 break;
|
cannam@89
|
3369 p_len = q - p;
|
cannam@89
|
3370 p_next = (*q == '\0' ? q : q + 1);
|
cannam@89
|
3371 if (p_len == 0)
|
cannam@89
|
3372 {
|
cannam@89
|
3373 /* empty path: current directory */
|
cannam@89
|
3374 if (getcwd (tmp, LT_PATHMAX) == NULL)
|
cannam@89
|
3375 lt_fatal ("getcwd failed");
|
cannam@89
|
3376 tmp_len = strlen (tmp);
|
cannam@89
|
3377 concat_name =
|
cannam@89
|
3378 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
|
cannam@89
|
3379 memcpy (concat_name, tmp, tmp_len);
|
cannam@89
|
3380 concat_name[tmp_len] = '/';
|
cannam@89
|
3381 strcpy (concat_name + tmp_len + 1, wrapper);
|
cannam@89
|
3382 }
|
cannam@89
|
3383 else
|
cannam@89
|
3384 {
|
cannam@89
|
3385 concat_name =
|
cannam@89
|
3386 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
|
cannam@89
|
3387 memcpy (concat_name, p, p_len);
|
cannam@89
|
3388 concat_name[p_len] = '/';
|
cannam@89
|
3389 strcpy (concat_name + p_len + 1, wrapper);
|
cannam@89
|
3390 }
|
cannam@89
|
3391 if (check_executable (concat_name))
|
cannam@89
|
3392 return concat_name;
|
cannam@89
|
3393 XFREE (concat_name);
|
cannam@89
|
3394 }
|
cannam@89
|
3395 }
|
cannam@89
|
3396 /* not found in PATH; assume curdir */
|
cannam@89
|
3397 }
|
cannam@89
|
3398 /* Relative path | not found in path: prepend cwd */
|
cannam@89
|
3399 if (getcwd (tmp, LT_PATHMAX) == NULL)
|
cannam@89
|
3400 lt_fatal ("getcwd failed");
|
cannam@89
|
3401 tmp_len = strlen (tmp);
|
cannam@89
|
3402 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
|
cannam@89
|
3403 memcpy (concat_name, tmp, tmp_len);
|
cannam@89
|
3404 concat_name[tmp_len] = '/';
|
cannam@89
|
3405 strcpy (concat_name + tmp_len + 1, wrapper);
|
cannam@89
|
3406
|
cannam@89
|
3407 if (check_executable (concat_name))
|
cannam@89
|
3408 return concat_name;
|
cannam@89
|
3409 XFREE (concat_name);
|
cannam@89
|
3410 return NULL;
|
cannam@89
|
3411 }
|
cannam@89
|
3412
|
cannam@89
|
3413 char *
|
cannam@89
|
3414 chase_symlinks (const char *pathspec)
|
cannam@89
|
3415 {
|
cannam@89
|
3416 #ifndef S_ISLNK
|
cannam@89
|
3417 return xstrdup (pathspec);
|
cannam@89
|
3418 #else
|
cannam@89
|
3419 char buf[LT_PATHMAX];
|
cannam@89
|
3420 struct stat s;
|
cannam@89
|
3421 char *tmp_pathspec = xstrdup (pathspec);
|
cannam@89
|
3422 char *p;
|
cannam@89
|
3423 int has_symlinks = 0;
|
cannam@89
|
3424 while (strlen (tmp_pathspec) && !has_symlinks)
|
cannam@89
|
3425 {
|
cannam@89
|
3426 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
|
cannam@89
|
3427 tmp_pathspec));
|
cannam@89
|
3428 if (lstat (tmp_pathspec, &s) == 0)
|
cannam@89
|
3429 {
|
cannam@89
|
3430 if (S_ISLNK (s.st_mode) != 0)
|
cannam@89
|
3431 {
|
cannam@89
|
3432 has_symlinks = 1;
|
cannam@89
|
3433 break;
|
cannam@89
|
3434 }
|
cannam@89
|
3435
|
cannam@89
|
3436 /* search backwards for last DIR_SEPARATOR */
|
cannam@89
|
3437 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
|
cannam@89
|
3438 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
|
cannam@89
|
3439 p--;
|
cannam@89
|
3440 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
|
cannam@89
|
3441 {
|
cannam@89
|
3442 /* no more DIR_SEPARATORS left */
|
cannam@89
|
3443 break;
|
cannam@89
|
3444 }
|
cannam@89
|
3445 *p = '\0';
|
cannam@89
|
3446 }
|
cannam@89
|
3447 else
|
cannam@89
|
3448 {
|
cannam@89
|
3449 char *errstr = strerror (errno);
|
cannam@89
|
3450 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
|
cannam@89
|
3451 }
|
cannam@89
|
3452 }
|
cannam@89
|
3453 XFREE (tmp_pathspec);
|
cannam@89
|
3454
|
cannam@89
|
3455 if (!has_symlinks)
|
cannam@89
|
3456 {
|
cannam@89
|
3457 return xstrdup (pathspec);
|
cannam@89
|
3458 }
|
cannam@89
|
3459
|
cannam@89
|
3460 tmp_pathspec = realpath (pathspec, buf);
|
cannam@89
|
3461 if (tmp_pathspec == 0)
|
cannam@89
|
3462 {
|
cannam@89
|
3463 lt_fatal ("Could not follow symlinks for %s", pathspec);
|
cannam@89
|
3464 }
|
cannam@89
|
3465 return xstrdup (tmp_pathspec);
|
cannam@89
|
3466 #endif
|
cannam@89
|
3467 }
|
cannam@89
|
3468
|
cannam@89
|
3469 char *
|
cannam@89
|
3470 strendzap (char *str, const char *pat)
|
cannam@89
|
3471 {
|
cannam@89
|
3472 size_t len, patlen;
|
cannam@89
|
3473
|
cannam@89
|
3474 assert (str != NULL);
|
cannam@89
|
3475 assert (pat != NULL);
|
cannam@89
|
3476
|
cannam@89
|
3477 len = strlen (str);
|
cannam@89
|
3478 patlen = strlen (pat);
|
cannam@89
|
3479
|
cannam@89
|
3480 if (patlen <= len)
|
cannam@89
|
3481 {
|
cannam@89
|
3482 str += len - patlen;
|
cannam@89
|
3483 if (strcmp (str, pat) == 0)
|
cannam@89
|
3484 *str = '\0';
|
cannam@89
|
3485 }
|
cannam@89
|
3486 return str;
|
cannam@89
|
3487 }
|
cannam@89
|
3488
|
cannam@89
|
3489 static void
|
cannam@89
|
3490 lt_error_core (int exit_status, const char *mode,
|
cannam@89
|
3491 const char *message, va_list ap)
|
cannam@89
|
3492 {
|
cannam@89
|
3493 fprintf (stderr, "%s: %s: ", program_name, mode);
|
cannam@89
|
3494 vfprintf (stderr, message, ap);
|
cannam@89
|
3495 fprintf (stderr, ".\n");
|
cannam@89
|
3496
|
cannam@89
|
3497 if (exit_status >= 0)
|
cannam@89
|
3498 exit (exit_status);
|
cannam@89
|
3499 }
|
cannam@89
|
3500
|
cannam@89
|
3501 void
|
cannam@89
|
3502 lt_fatal (const char *message, ...)
|
cannam@89
|
3503 {
|
cannam@89
|
3504 va_list ap;
|
cannam@89
|
3505 va_start (ap, message);
|
cannam@89
|
3506 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
|
cannam@89
|
3507 va_end (ap);
|
cannam@89
|
3508 }
|
cannam@89
|
3509 EOF
|
cannam@89
|
3510 }
|
cannam@89
|
3511 # end: func_emit_cwrapperexe_src
|
cannam@89
|
3512
|
cannam@89
|
3513 # func_mode_link arg...
|
cannam@89
|
3514 func_mode_link ()
|
cannam@89
|
3515 {
|
cannam@89
|
3516 $opt_debug
|
cannam@89
|
3517 case $host in
|
cannam@89
|
3518 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
|
cannam@89
|
3519 # It is impossible to link a dll without this setting, and
|
cannam@89
|
3520 # we shouldn't force the makefile maintainer to figure out
|
cannam@89
|
3521 # which system we are compiling for in order to pass an extra
|
cannam@89
|
3522 # flag for every libtool invocation.
|
cannam@89
|
3523 # allow_undefined=no
|
cannam@89
|
3524
|
cannam@89
|
3525 # FIXME: Unfortunately, there are problems with the above when trying
|
cannam@89
|
3526 # to make a dll which has undefined symbols, in which case not
|
cannam@89
|
3527 # even a static library is built. For now, we need to specify
|
cannam@89
|
3528 # -no-undefined on the libtool link line when we can be certain
|
cannam@89
|
3529 # that all symbols are satisfied, otherwise we get a static library.
|
cannam@89
|
3530 allow_undefined=yes
|
cannam@89
|
3531 ;;
|
cannam@89
|
3532 *)
|
cannam@89
|
3533 allow_undefined=yes
|
cannam@89
|
3534 ;;
|
cannam@89
|
3535 esac
|
cannam@89
|
3536 libtool_args=$nonopt
|
cannam@89
|
3537 base_compile="$nonopt $@"
|
cannam@89
|
3538 compile_command=$nonopt
|
cannam@89
|
3539 finalize_command=$nonopt
|
cannam@89
|
3540
|
cannam@89
|
3541 compile_rpath=
|
cannam@89
|
3542 finalize_rpath=
|
cannam@89
|
3543 compile_shlibpath=
|
cannam@89
|
3544 finalize_shlibpath=
|
cannam@89
|
3545 convenience=
|
cannam@89
|
3546 old_convenience=
|
cannam@89
|
3547 deplibs=
|
cannam@89
|
3548 old_deplibs=
|
cannam@89
|
3549 compiler_flags=
|
cannam@89
|
3550 linker_flags=
|
cannam@89
|
3551 dllsearchpath=
|
cannam@89
|
3552 lib_search_path=`pwd`
|
cannam@89
|
3553 inst_prefix_dir=
|
cannam@89
|
3554 new_inherited_linker_flags=
|
cannam@89
|
3555
|
cannam@89
|
3556 avoid_version=no
|
cannam@89
|
3557 dlfiles=
|
cannam@89
|
3558 dlprefiles=
|
cannam@89
|
3559 dlself=no
|
cannam@89
|
3560 export_dynamic=no
|
cannam@89
|
3561 export_symbols=
|
cannam@89
|
3562 export_symbols_regex=
|
cannam@89
|
3563 generated=
|
cannam@89
|
3564 libobjs=
|
cannam@89
|
3565 ltlibs=
|
cannam@89
|
3566 module=no
|
cannam@89
|
3567 no_install=no
|
cannam@89
|
3568 objs=
|
cannam@89
|
3569 non_pic_objects=
|
cannam@89
|
3570 precious_files_regex=
|
cannam@89
|
3571 prefer_static_libs=no
|
cannam@89
|
3572 preload=no
|
cannam@89
|
3573 prev=
|
cannam@89
|
3574 prevarg=
|
cannam@89
|
3575 release=
|
cannam@89
|
3576 rpath=
|
cannam@89
|
3577 xrpath=
|
cannam@89
|
3578 perm_rpath=
|
cannam@89
|
3579 temp_rpath=
|
cannam@89
|
3580 thread_safe=no
|
cannam@89
|
3581 vinfo=
|
cannam@89
|
3582 vinfo_number=no
|
cannam@89
|
3583 weak_libs=
|
cannam@89
|
3584 single_module="${wl}-single_module"
|
cannam@89
|
3585 func_infer_tag $base_compile
|
cannam@89
|
3586
|
cannam@89
|
3587 # We need to know -static, to get the right output filenames.
|
cannam@89
|
3588 for arg
|
cannam@89
|
3589 do
|
cannam@89
|
3590 case $arg in
|
cannam@89
|
3591 -shared)
|
cannam@89
|
3592 test "$build_libtool_libs" != yes && \
|
cannam@89
|
3593 func_fatal_configuration "can not build a shared library"
|
cannam@89
|
3594 build_old_libs=no
|
cannam@89
|
3595 break
|
cannam@89
|
3596 ;;
|
cannam@89
|
3597 -all-static | -static | -static-libtool-libs)
|
cannam@89
|
3598 case $arg in
|
cannam@89
|
3599 -all-static)
|
cannam@89
|
3600 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
|
cannam@89
|
3601 func_warning "complete static linking is impossible in this configuration"
|
cannam@89
|
3602 fi
|
cannam@89
|
3603 if test -n "$link_static_flag"; then
|
cannam@89
|
3604 dlopen_self=$dlopen_self_static
|
cannam@89
|
3605 fi
|
cannam@89
|
3606 prefer_static_libs=yes
|
cannam@89
|
3607 ;;
|
cannam@89
|
3608 -static)
|
cannam@89
|
3609 if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
cannam@89
|
3610 dlopen_self=$dlopen_self_static
|
cannam@89
|
3611 fi
|
cannam@89
|
3612 prefer_static_libs=built
|
cannam@89
|
3613 ;;
|
cannam@89
|
3614 -static-libtool-libs)
|
cannam@89
|
3615 if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
cannam@89
|
3616 dlopen_self=$dlopen_self_static
|
cannam@89
|
3617 fi
|
cannam@89
|
3618 prefer_static_libs=yes
|
cannam@89
|
3619 ;;
|
cannam@89
|
3620 esac
|
cannam@89
|
3621 build_libtool_libs=no
|
cannam@89
|
3622 build_old_libs=yes
|
cannam@89
|
3623 break
|
cannam@89
|
3624 ;;
|
cannam@89
|
3625 esac
|
cannam@89
|
3626 done
|
cannam@89
|
3627
|
cannam@89
|
3628 # See if our shared archives depend on static archives.
|
cannam@89
|
3629 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
|
cannam@89
|
3630
|
cannam@89
|
3631 # Go through the arguments, transforming them on the way.
|
cannam@89
|
3632 while test "$#" -gt 0; do
|
cannam@89
|
3633 arg="$1"
|
cannam@89
|
3634 shift
|
cannam@89
|
3635 func_quote_for_eval "$arg"
|
cannam@89
|
3636 qarg=$func_quote_for_eval_unquoted_result
|
cannam@89
|
3637 func_append libtool_args " $func_quote_for_eval_result"
|
cannam@89
|
3638
|
cannam@89
|
3639 # If the previous option needs an argument, assign it.
|
cannam@89
|
3640 if test -n "$prev"; then
|
cannam@89
|
3641 case $prev in
|
cannam@89
|
3642 output)
|
cannam@89
|
3643 func_append compile_command " @OUTPUT@"
|
cannam@89
|
3644 func_append finalize_command " @OUTPUT@"
|
cannam@89
|
3645 ;;
|
cannam@89
|
3646 esac
|
cannam@89
|
3647
|
cannam@89
|
3648 case $prev in
|
cannam@89
|
3649 dlfiles|dlprefiles)
|
cannam@89
|
3650 if test "$preload" = no; then
|
cannam@89
|
3651 # Add the symbol object into the linking commands.
|
cannam@89
|
3652 func_append compile_command " @SYMFILE@"
|
cannam@89
|
3653 func_append finalize_command " @SYMFILE@"
|
cannam@89
|
3654 preload=yes
|
cannam@89
|
3655 fi
|
cannam@89
|
3656 case $arg in
|
cannam@89
|
3657 *.la | *.lo) ;; # We handle these cases below.
|
cannam@89
|
3658 force)
|
cannam@89
|
3659 if test "$dlself" = no; then
|
cannam@89
|
3660 dlself=needless
|
cannam@89
|
3661 export_dynamic=yes
|
cannam@89
|
3662 fi
|
cannam@89
|
3663 prev=
|
cannam@89
|
3664 continue
|
cannam@89
|
3665 ;;
|
cannam@89
|
3666 self)
|
cannam@89
|
3667 if test "$prev" = dlprefiles; then
|
cannam@89
|
3668 dlself=yes
|
cannam@89
|
3669 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
|
cannam@89
|
3670 dlself=yes
|
cannam@89
|
3671 else
|
cannam@89
|
3672 dlself=needless
|
cannam@89
|
3673 export_dynamic=yes
|
cannam@89
|
3674 fi
|
cannam@89
|
3675 prev=
|
cannam@89
|
3676 continue
|
cannam@89
|
3677 ;;
|
cannam@89
|
3678 *)
|
cannam@89
|
3679 if test "$prev" = dlfiles; then
|
cannam@89
|
3680 dlfiles="$dlfiles $arg"
|
cannam@89
|
3681 else
|
cannam@89
|
3682 dlprefiles="$dlprefiles $arg"
|
cannam@89
|
3683 fi
|
cannam@89
|
3684 prev=
|
cannam@89
|
3685 continue
|
cannam@89
|
3686 ;;
|
cannam@89
|
3687 esac
|
cannam@89
|
3688 ;;
|
cannam@89
|
3689 expsyms)
|
cannam@89
|
3690 export_symbols="$arg"
|
cannam@89
|
3691 test -f "$arg" \
|
cannam@89
|
3692 || func_fatal_error "symbol file \`$arg' does not exist"
|
cannam@89
|
3693 prev=
|
cannam@89
|
3694 continue
|
cannam@89
|
3695 ;;
|
cannam@89
|
3696 expsyms_regex)
|
cannam@89
|
3697 export_symbols_regex="$arg"
|
cannam@89
|
3698 prev=
|
cannam@89
|
3699 continue
|
cannam@89
|
3700 ;;
|
cannam@89
|
3701 framework)
|
cannam@89
|
3702 case $host in
|
cannam@89
|
3703 *-*-darwin*)
|
cannam@89
|
3704 case "$deplibs " in
|
cannam@89
|
3705 *" $qarg.ltframework "*) ;;
|
cannam@89
|
3706 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
|
cannam@89
|
3707 ;;
|
cannam@89
|
3708 esac
|
cannam@89
|
3709 ;;
|
cannam@89
|
3710 esac
|
cannam@89
|
3711 prev=
|
cannam@89
|
3712 continue
|
cannam@89
|
3713 ;;
|
cannam@89
|
3714 inst_prefix)
|
cannam@89
|
3715 inst_prefix_dir="$arg"
|
cannam@89
|
3716 prev=
|
cannam@89
|
3717 continue
|
cannam@89
|
3718 ;;
|
cannam@89
|
3719 objectlist)
|
cannam@89
|
3720 if test -f "$arg"; then
|
cannam@89
|
3721 save_arg=$arg
|
cannam@89
|
3722 moreargs=
|
cannam@89
|
3723 for fil in `cat "$save_arg"`
|
cannam@89
|
3724 do
|
cannam@89
|
3725 # moreargs="$moreargs $fil"
|
cannam@89
|
3726 arg=$fil
|
cannam@89
|
3727 # A libtool-controlled object.
|
cannam@89
|
3728
|
cannam@89
|
3729 # Check to see that this really is a libtool object.
|
cannam@89
|
3730 if func_lalib_unsafe_p "$arg"; then
|
cannam@89
|
3731 pic_object=
|
cannam@89
|
3732 non_pic_object=
|
cannam@89
|
3733
|
cannam@89
|
3734 # Read the .lo file
|
cannam@89
|
3735 func_source "$arg"
|
cannam@89
|
3736
|
cannam@89
|
3737 if test -z "$pic_object" ||
|
cannam@89
|
3738 test -z "$non_pic_object" ||
|
cannam@89
|
3739 test "$pic_object" = none &&
|
cannam@89
|
3740 test "$non_pic_object" = none; then
|
cannam@89
|
3741 func_fatal_error "cannot find name of object for \`$arg'"
|
cannam@89
|
3742 fi
|
cannam@89
|
3743
|
cannam@89
|
3744 # Extract subdirectory from the argument.
|
cannam@89
|
3745 func_dirname "$arg" "/" ""
|
cannam@89
|
3746 xdir="$func_dirname_result"
|
cannam@89
|
3747
|
cannam@89
|
3748 if test "$pic_object" != none; then
|
cannam@89
|
3749 # Prepend the subdirectory the object is found in.
|
cannam@89
|
3750 pic_object="$xdir$pic_object"
|
cannam@89
|
3751
|
cannam@89
|
3752 if test "$prev" = dlfiles; then
|
cannam@89
|
3753 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
|
cannam@89
|
3754 dlfiles="$dlfiles $pic_object"
|
cannam@89
|
3755 prev=
|
cannam@89
|
3756 continue
|
cannam@89
|
3757 else
|
cannam@89
|
3758 # If libtool objects are unsupported, then we need to preload.
|
cannam@89
|
3759 prev=dlprefiles
|
cannam@89
|
3760 fi
|
cannam@89
|
3761 fi
|
cannam@89
|
3762
|
cannam@89
|
3763 # CHECK ME: I think I busted this. -Ossama
|
cannam@89
|
3764 if test "$prev" = dlprefiles; then
|
cannam@89
|
3765 # Preload the old-style object.
|
cannam@89
|
3766 dlprefiles="$dlprefiles $pic_object"
|
cannam@89
|
3767 prev=
|
cannam@89
|
3768 fi
|
cannam@89
|
3769
|
cannam@89
|
3770 # A PIC object.
|
cannam@89
|
3771 func_append libobjs " $pic_object"
|
cannam@89
|
3772 arg="$pic_object"
|
cannam@89
|
3773 fi
|
cannam@89
|
3774
|
cannam@89
|
3775 # Non-PIC object.
|
cannam@89
|
3776 if test "$non_pic_object" != none; then
|
cannam@89
|
3777 # Prepend the subdirectory the object is found in.
|
cannam@89
|
3778 non_pic_object="$xdir$non_pic_object"
|
cannam@89
|
3779
|
cannam@89
|
3780 # A standard non-PIC object
|
cannam@89
|
3781 func_append non_pic_objects " $non_pic_object"
|
cannam@89
|
3782 if test -z "$pic_object" || test "$pic_object" = none ; then
|
cannam@89
|
3783 arg="$non_pic_object"
|
cannam@89
|
3784 fi
|
cannam@89
|
3785 else
|
cannam@89
|
3786 # If the PIC object exists, use it instead.
|
cannam@89
|
3787 # $xdir was prepended to $pic_object above.
|
cannam@89
|
3788 non_pic_object="$pic_object"
|
cannam@89
|
3789 func_append non_pic_objects " $non_pic_object"
|
cannam@89
|
3790 fi
|
cannam@89
|
3791 else
|
cannam@89
|
3792 # Only an error if not doing a dry-run.
|
cannam@89
|
3793 if $opt_dry_run; then
|
cannam@89
|
3794 # Extract subdirectory from the argument.
|
cannam@89
|
3795 func_dirname "$arg" "/" ""
|
cannam@89
|
3796 xdir="$func_dirname_result"
|
cannam@89
|
3797
|
cannam@89
|
3798 func_lo2o "$arg"
|
cannam@89
|
3799 pic_object=$xdir$objdir/$func_lo2o_result
|
cannam@89
|
3800 non_pic_object=$xdir$func_lo2o_result
|
cannam@89
|
3801 func_append libobjs " $pic_object"
|
cannam@89
|
3802 func_append non_pic_objects " $non_pic_object"
|
cannam@89
|
3803 else
|
cannam@89
|
3804 func_fatal_error "\`$arg' is not a valid libtool object"
|
cannam@89
|
3805 fi
|
cannam@89
|
3806 fi
|
cannam@89
|
3807 done
|
cannam@89
|
3808 else
|
cannam@89
|
3809 func_fatal_error "link input file \`$arg' does not exist"
|
cannam@89
|
3810 fi
|
cannam@89
|
3811 arg=$save_arg
|
cannam@89
|
3812 prev=
|
cannam@89
|
3813 continue
|
cannam@89
|
3814 ;;
|
cannam@89
|
3815 precious_regex)
|
cannam@89
|
3816 precious_files_regex="$arg"
|
cannam@89
|
3817 prev=
|
cannam@89
|
3818 continue
|
cannam@89
|
3819 ;;
|
cannam@89
|
3820 release)
|
cannam@89
|
3821 release="-$arg"
|
cannam@89
|
3822 prev=
|
cannam@89
|
3823 continue
|
cannam@89
|
3824 ;;
|
cannam@89
|
3825 rpath | xrpath)
|
cannam@89
|
3826 # We need an absolute path.
|
cannam@89
|
3827 case $arg in
|
cannam@89
|
3828 [\\/]* | [A-Za-z]:[\\/]*) ;;
|
cannam@89
|
3829 *)
|
cannam@89
|
3830 func_fatal_error "only absolute run-paths are allowed"
|
cannam@89
|
3831 ;;
|
cannam@89
|
3832 esac
|
cannam@89
|
3833 if test "$prev" = rpath; then
|
cannam@89
|
3834 case "$rpath " in
|
cannam@89
|
3835 *" $arg "*) ;;
|
cannam@89
|
3836 *) rpath="$rpath $arg" ;;
|
cannam@89
|
3837 esac
|
cannam@89
|
3838 else
|
cannam@89
|
3839 case "$xrpath " in
|
cannam@89
|
3840 *" $arg "*) ;;
|
cannam@89
|
3841 *) xrpath="$xrpath $arg" ;;
|
cannam@89
|
3842 esac
|
cannam@89
|
3843 fi
|
cannam@89
|
3844 prev=
|
cannam@89
|
3845 continue
|
cannam@89
|
3846 ;;
|
cannam@89
|
3847 shrext)
|
cannam@89
|
3848 shrext_cmds="$arg"
|
cannam@89
|
3849 prev=
|
cannam@89
|
3850 continue
|
cannam@89
|
3851 ;;
|
cannam@89
|
3852 weak)
|
cannam@89
|
3853 weak_libs="$weak_libs $arg"
|
cannam@89
|
3854 prev=
|
cannam@89
|
3855 continue
|
cannam@89
|
3856 ;;
|
cannam@89
|
3857 xcclinker)
|
cannam@89
|
3858 linker_flags="$linker_flags $qarg"
|
cannam@89
|
3859 compiler_flags="$compiler_flags $qarg"
|
cannam@89
|
3860 prev=
|
cannam@89
|
3861 func_append compile_command " $qarg"
|
cannam@89
|
3862 func_append finalize_command " $qarg"
|
cannam@89
|
3863 continue
|
cannam@89
|
3864 ;;
|
cannam@89
|
3865 xcompiler)
|
cannam@89
|
3866 compiler_flags="$compiler_flags $qarg"
|
cannam@89
|
3867 prev=
|
cannam@89
|
3868 func_append compile_command " $qarg"
|
cannam@89
|
3869 func_append finalize_command " $qarg"
|
cannam@89
|
3870 continue
|
cannam@89
|
3871 ;;
|
cannam@89
|
3872 xlinker)
|
cannam@89
|
3873 linker_flags="$linker_flags $qarg"
|
cannam@89
|
3874 compiler_flags="$compiler_flags $wl$qarg"
|
cannam@89
|
3875 prev=
|
cannam@89
|
3876 func_append compile_command " $wl$qarg"
|
cannam@89
|
3877 func_append finalize_command " $wl$qarg"
|
cannam@89
|
3878 continue
|
cannam@89
|
3879 ;;
|
cannam@89
|
3880 *)
|
cannam@89
|
3881 eval "$prev=\"\$arg\""
|
cannam@89
|
3882 prev=
|
cannam@89
|
3883 continue
|
cannam@89
|
3884 ;;
|
cannam@89
|
3885 esac
|
cannam@89
|
3886 fi # test -n "$prev"
|
cannam@89
|
3887
|
cannam@89
|
3888 prevarg="$arg"
|
cannam@89
|
3889
|
cannam@89
|
3890 case $arg in
|
cannam@89
|
3891 -all-static)
|
cannam@89
|
3892 if test -n "$link_static_flag"; then
|
cannam@89
|
3893 # See comment for -static flag below, for more details.
|
cannam@89
|
3894 func_append compile_command " $link_static_flag"
|
cannam@89
|
3895 func_append finalize_command " $link_static_flag"
|
cannam@89
|
3896 fi
|
cannam@89
|
3897 continue
|
cannam@89
|
3898 ;;
|
cannam@89
|
3899
|
cannam@89
|
3900 -allow-undefined)
|
cannam@89
|
3901 # FIXME: remove this flag sometime in the future.
|
cannam@89
|
3902 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
|
cannam@89
|
3903 ;;
|
cannam@89
|
3904
|
cannam@89
|
3905 -avoid-version)
|
cannam@89
|
3906 avoid_version=yes
|
cannam@89
|
3907 continue
|
cannam@89
|
3908 ;;
|
cannam@89
|
3909
|
cannam@89
|
3910 -dlopen)
|
cannam@89
|
3911 prev=dlfiles
|
cannam@89
|
3912 continue
|
cannam@89
|
3913 ;;
|
cannam@89
|
3914
|
cannam@89
|
3915 -dlpreopen)
|
cannam@89
|
3916 prev=dlprefiles
|
cannam@89
|
3917 continue
|
cannam@89
|
3918 ;;
|
cannam@89
|
3919
|
cannam@89
|
3920 -export-dynamic)
|
cannam@89
|
3921 export_dynamic=yes
|
cannam@89
|
3922 continue
|
cannam@89
|
3923 ;;
|
cannam@89
|
3924
|
cannam@89
|
3925 -export-symbols | -export-symbols-regex)
|
cannam@89
|
3926 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
|
cannam@89
|
3927 func_fatal_error "more than one -exported-symbols argument is not allowed"
|
cannam@89
|
3928 fi
|
cannam@89
|
3929 if test "X$arg" = "X-export-symbols"; then
|
cannam@89
|
3930 prev=expsyms
|
cannam@89
|
3931 else
|
cannam@89
|
3932 prev=expsyms_regex
|
cannam@89
|
3933 fi
|
cannam@89
|
3934 continue
|
cannam@89
|
3935 ;;
|
cannam@89
|
3936
|
cannam@89
|
3937 -framework)
|
cannam@89
|
3938 prev=framework
|
cannam@89
|
3939 continue
|
cannam@89
|
3940 ;;
|
cannam@89
|
3941
|
cannam@89
|
3942 -inst-prefix-dir)
|
cannam@89
|
3943 prev=inst_prefix
|
cannam@89
|
3944 continue
|
cannam@89
|
3945 ;;
|
cannam@89
|
3946
|
cannam@89
|
3947 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
|
cannam@89
|
3948 # so, if we see these flags be careful not to treat them like -L
|
cannam@89
|
3949 -L[A-Z][A-Z]*:*)
|
cannam@89
|
3950 case $with_gcc/$host in
|
cannam@89
|
3951 no/*-*-irix* | /*-*-irix*)
|
cannam@89
|
3952 func_append compile_command " $arg"
|
cannam@89
|
3953 func_append finalize_command " $arg"
|
cannam@89
|
3954 ;;
|
cannam@89
|
3955 esac
|
cannam@89
|
3956 continue
|
cannam@89
|
3957 ;;
|
cannam@89
|
3958
|
cannam@89
|
3959 -L*)
|
cannam@89
|
3960 func_stripname '-L' '' "$arg"
|
cannam@89
|
3961 dir=$func_stripname_result
|
cannam@89
|
3962 # We need an absolute path.
|
cannam@89
|
3963 case $dir in
|
cannam@89
|
3964 [\\/]* | [A-Za-z]:[\\/]*) ;;
|
cannam@89
|
3965 *)
|
cannam@89
|
3966 absdir=`cd "$dir" && pwd`
|
cannam@89
|
3967 test -z "$absdir" && \
|
cannam@89
|
3968 func_fatal_error "cannot determine absolute directory name of \`$dir'"
|
cannam@89
|
3969 dir="$absdir"
|
cannam@89
|
3970 ;;
|
cannam@89
|
3971 esac
|
cannam@89
|
3972 case "$deplibs " in
|
cannam@89
|
3973 *" -L$dir "*) ;;
|
cannam@89
|
3974 *)
|
cannam@89
|
3975 deplibs="$deplibs -L$dir"
|
cannam@89
|
3976 lib_search_path="$lib_search_path $dir"
|
cannam@89
|
3977 ;;
|
cannam@89
|
3978 esac
|
cannam@89
|
3979 case $host in
|
cannam@89
|
3980 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
|
cannam@89
|
3981 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
|
cannam@89
|
3982 case :$dllsearchpath: in
|
cannam@89
|
3983 *":$dir:"*) ;;
|
cannam@89
|
3984 *) dllsearchpath="$dllsearchpath:$dir";;
|
cannam@89
|
3985 esac
|
cannam@89
|
3986 case :$dllsearchpath: in
|
cannam@89
|
3987 *":$testbindir:"*) ;;
|
cannam@89
|
3988 *) dllsearchpath="$dllsearchpath:$testbindir";;
|
cannam@89
|
3989 esac
|
cannam@89
|
3990 ;;
|
cannam@89
|
3991 esac
|
cannam@89
|
3992 continue
|
cannam@89
|
3993 ;;
|
cannam@89
|
3994
|
cannam@89
|
3995 -l*)
|
cannam@89
|
3996 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
|
cannam@89
|
3997 case $host in
|
cannam@89
|
3998 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
|
cannam@89
|
3999 # These systems don't actually have a C or math library (as such)
|
cannam@89
|
4000 continue
|
cannam@89
|
4001 ;;
|
cannam@89
|
4002 *-*-os2*)
|
cannam@89
|
4003 # These systems don't actually have a C library (as such)
|
cannam@89
|
4004 test "X$arg" = "X-lc" && continue
|
cannam@89
|
4005 ;;
|
cannam@89
|
4006 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
|
cannam@89
|
4007 # Do not include libc due to us having libc/libc_r.
|
cannam@89
|
4008 test "X$arg" = "X-lc" && continue
|
cannam@89
|
4009 ;;
|
cannam@89
|
4010 *-*-rhapsody* | *-*-darwin1.[012])
|
cannam@89
|
4011 # Rhapsody C and math libraries are in the System framework
|
cannam@89
|
4012 deplibs="$deplibs System.ltframework"
|
cannam@89
|
4013 continue
|
cannam@89
|
4014 ;;
|
cannam@89
|
4015 *-*-sco3.2v5* | *-*-sco5v6*)
|
cannam@89
|
4016 # Causes problems with __ctype
|
cannam@89
|
4017 test "X$arg" = "X-lc" && continue
|
cannam@89
|
4018 ;;
|
cannam@89
|
4019 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
|
cannam@89
|
4020 # Compiler inserts libc in the correct place for threads to work
|
cannam@89
|
4021 test "X$arg" = "X-lc" && continue
|
cannam@89
|
4022 ;;
|
cannam@89
|
4023 esac
|
cannam@89
|
4024 elif test "X$arg" = "X-lc_r"; then
|
cannam@89
|
4025 case $host in
|
cannam@89
|
4026 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
|
cannam@89
|
4027 # Do not include libc_r directly, use -pthread flag.
|
cannam@89
|
4028 continue
|
cannam@89
|
4029 ;;
|
cannam@89
|
4030 esac
|
cannam@89
|
4031 fi
|
cannam@89
|
4032 deplibs="$deplibs $arg"
|
cannam@89
|
4033 continue
|
cannam@89
|
4034 ;;
|
cannam@89
|
4035
|
cannam@89
|
4036 -module)
|
cannam@89
|
4037 module=yes
|
cannam@89
|
4038 continue
|
cannam@89
|
4039 ;;
|
cannam@89
|
4040
|
cannam@89
|
4041 # Tru64 UNIX uses -model [arg] to determine the layout of C++
|
cannam@89
|
4042 # classes, name mangling, and exception handling.
|
cannam@89
|
4043 # Darwin uses the -arch flag to determine output architecture.
|
cannam@89
|
4044 -model|-arch|-isysroot)
|
cannam@89
|
4045 compiler_flags="$compiler_flags $arg"
|
cannam@89
|
4046 func_append compile_command " $arg"
|
cannam@89
|
4047 func_append finalize_command " $arg"
|
cannam@89
|
4048 prev=xcompiler
|
cannam@89
|
4049 continue
|
cannam@89
|
4050 ;;
|
cannam@89
|
4051
|
cannam@89
|
4052 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
|
cannam@89
|
4053 compiler_flags="$compiler_flags $arg"
|
cannam@89
|
4054 func_append compile_command " $arg"
|
cannam@89
|
4055 func_append finalize_command " $arg"
|
cannam@89
|
4056 case "$new_inherited_linker_flags " in
|
cannam@89
|
4057 *" $arg "*) ;;
|
cannam@89
|
4058 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
|
cannam@89
|
4059 esac
|
cannam@89
|
4060 continue
|
cannam@89
|
4061 ;;
|
cannam@89
|
4062
|
cannam@89
|
4063 -multi_module)
|
cannam@89
|
4064 single_module="${wl}-multi_module"
|
cannam@89
|
4065 continue
|
cannam@89
|
4066 ;;
|
cannam@89
|
4067
|
cannam@89
|
4068 -no-fast-install)
|
cannam@89
|
4069 fast_install=no
|
cannam@89
|
4070 continue
|
cannam@89
|
4071 ;;
|
cannam@89
|
4072
|
cannam@89
|
4073 -no-install)
|
cannam@89
|
4074 case $host in
|
cannam@89
|
4075 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
|
cannam@89
|
4076 # The PATH hackery in wrapper scripts is required on Windows
|
cannam@89
|
4077 # and Darwin in order for the loader to find any dlls it needs.
|
cannam@89
|
4078 func_warning "\`-no-install' is ignored for $host"
|
cannam@89
|
4079 func_warning "assuming \`-no-fast-install' instead"
|
cannam@89
|
4080 fast_install=no
|
cannam@89
|
4081 ;;
|
cannam@89
|
4082 *) no_install=yes ;;
|
cannam@89
|
4083 esac
|
cannam@89
|
4084 continue
|
cannam@89
|
4085 ;;
|
cannam@89
|
4086
|
cannam@89
|
4087 -no-undefined)
|
cannam@89
|
4088 allow_undefined=no
|
cannam@89
|
4089 continue
|
cannam@89
|
4090 ;;
|
cannam@89
|
4091
|
cannam@89
|
4092 -objectlist)
|
cannam@89
|
4093 prev=objectlist
|
cannam@89
|
4094 continue
|
cannam@89
|
4095 ;;
|
cannam@89
|
4096
|
cannam@89
|
4097 -o) prev=output ;;
|
cannam@89
|
4098
|
cannam@89
|
4099 -precious-files-regex)
|
cannam@89
|
4100 prev=precious_regex
|
cannam@89
|
4101 continue
|
cannam@89
|
4102 ;;
|
cannam@89
|
4103
|
cannam@89
|
4104 -release)
|
cannam@89
|
4105 prev=release
|
cannam@89
|
4106 continue
|
cannam@89
|
4107 ;;
|
cannam@89
|
4108
|
cannam@89
|
4109 -rpath)
|
cannam@89
|
4110 prev=rpath
|
cannam@89
|
4111 continue
|
cannam@89
|
4112 ;;
|
cannam@89
|
4113
|
cannam@89
|
4114 -R)
|
cannam@89
|
4115 prev=xrpath
|
cannam@89
|
4116 continue
|
cannam@89
|
4117 ;;
|
cannam@89
|
4118
|
cannam@89
|
4119 -R*)
|
cannam@89
|
4120 func_stripname '-R' '' "$arg"
|
cannam@89
|
4121 dir=$func_stripname_result
|
cannam@89
|
4122 # We need an absolute path.
|
cannam@89
|
4123 case $dir in
|
cannam@89
|
4124 [\\/]* | [A-Za-z]:[\\/]*) ;;
|
cannam@89
|
4125 *)
|
cannam@89
|
4126 func_fatal_error "only absolute run-paths are allowed"
|
cannam@89
|
4127 ;;
|
cannam@89
|
4128 esac
|
cannam@89
|
4129 case "$xrpath " in
|
cannam@89
|
4130 *" $dir "*) ;;
|
cannam@89
|
4131 *) xrpath="$xrpath $dir" ;;
|
cannam@89
|
4132 esac
|
cannam@89
|
4133 continue
|
cannam@89
|
4134 ;;
|
cannam@89
|
4135
|
cannam@89
|
4136 -shared)
|
cannam@89
|
4137 # The effects of -shared are defined in a previous loop.
|
cannam@89
|
4138 continue
|
cannam@89
|
4139 ;;
|
cannam@89
|
4140
|
cannam@89
|
4141 -shrext)
|
cannam@89
|
4142 prev=shrext
|
cannam@89
|
4143 continue
|
cannam@89
|
4144 ;;
|
cannam@89
|
4145
|
cannam@89
|
4146 -static | -static-libtool-libs)
|
cannam@89
|
4147 # The effects of -static are defined in a previous loop.
|
cannam@89
|
4148 # We used to do the same as -all-static on platforms that
|
cannam@89
|
4149 # didn't have a PIC flag, but the assumption that the effects
|
cannam@89
|
4150 # would be equivalent was wrong. It would break on at least
|
cannam@89
|
4151 # Digital Unix and AIX.
|
cannam@89
|
4152 continue
|
cannam@89
|
4153 ;;
|
cannam@89
|
4154
|
cannam@89
|
4155 -thread-safe)
|
cannam@89
|
4156 thread_safe=yes
|
cannam@89
|
4157 continue
|
cannam@89
|
4158 ;;
|
cannam@89
|
4159
|
cannam@89
|
4160 -version-info)
|
cannam@89
|
4161 prev=vinfo
|
cannam@89
|
4162 continue
|
cannam@89
|
4163 ;;
|
cannam@89
|
4164
|
cannam@89
|
4165 -version-number)
|
cannam@89
|
4166 prev=vinfo
|
cannam@89
|
4167 vinfo_number=yes
|
cannam@89
|
4168 continue
|
cannam@89
|
4169 ;;
|
cannam@89
|
4170
|
cannam@89
|
4171 -weak)
|
cannam@89
|
4172 prev=weak
|
cannam@89
|
4173 continue
|
cannam@89
|
4174 ;;
|
cannam@89
|
4175
|
cannam@89
|
4176 -Wc,*)
|
cannam@89
|
4177 func_stripname '-Wc,' '' "$arg"
|
cannam@89
|
4178 args=$func_stripname_result
|
cannam@89
|
4179 arg=
|
cannam@89
|
4180 save_ifs="$IFS"; IFS=','
|
cannam@89
|
4181 for flag in $args; do
|
cannam@89
|
4182 IFS="$save_ifs"
|
cannam@89
|
4183 func_quote_for_eval "$flag"
|
cannam@89
|
4184 arg="$arg $wl$func_quote_for_eval_result"
|
cannam@89
|
4185 compiler_flags="$compiler_flags $func_quote_for_eval_result"
|
cannam@89
|
4186 done
|
cannam@89
|
4187 IFS="$save_ifs"
|
cannam@89
|
4188 func_stripname ' ' '' "$arg"
|
cannam@89
|
4189 arg=$func_stripname_result
|
cannam@89
|
4190 ;;
|
cannam@89
|
4191
|
cannam@89
|
4192 -Wl,*)
|
cannam@89
|
4193 func_stripname '-Wl,' '' "$arg"
|
cannam@89
|
4194 args=$func_stripname_result
|
cannam@89
|
4195 arg=
|
cannam@89
|
4196 save_ifs="$IFS"; IFS=','
|
cannam@89
|
4197 for flag in $args; do
|
cannam@89
|
4198 IFS="$save_ifs"
|
cannam@89
|
4199 func_quote_for_eval "$flag"
|
cannam@89
|
4200 arg="$arg $wl$func_quote_for_eval_result"
|
cannam@89
|
4201 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
|
cannam@89
|
4202 linker_flags="$linker_flags $func_quote_for_eval_result"
|
cannam@89
|
4203 done
|
cannam@89
|
4204 IFS="$save_ifs"
|
cannam@89
|
4205 func_stripname ' ' '' "$arg"
|
cannam@89
|
4206 arg=$func_stripname_result
|
cannam@89
|
4207 ;;
|
cannam@89
|
4208
|
cannam@89
|
4209 -Xcompiler)
|
cannam@89
|
4210 prev=xcompiler
|
cannam@89
|
4211 continue
|
cannam@89
|
4212 ;;
|
cannam@89
|
4213
|
cannam@89
|
4214 -Xlinker)
|
cannam@89
|
4215 prev=xlinker
|
cannam@89
|
4216 continue
|
cannam@89
|
4217 ;;
|
cannam@89
|
4218
|
cannam@89
|
4219 -XCClinker)
|
cannam@89
|
4220 prev=xcclinker
|
cannam@89
|
4221 continue
|
cannam@89
|
4222 ;;
|
cannam@89
|
4223
|
cannam@89
|
4224 # -msg_* for osf cc
|
cannam@89
|
4225 -msg_*)
|
cannam@89
|
4226 func_quote_for_eval "$arg"
|
cannam@89
|
4227 arg="$func_quote_for_eval_result"
|
cannam@89
|
4228 ;;
|
cannam@89
|
4229
|
cannam@89
|
4230 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
|
cannam@89
|
4231 # -r[0-9][0-9]* specifies the processor on the SGI compiler
|
cannam@89
|
4232 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
|
cannam@89
|
4233 # +DA*, +DD* enable 64-bit mode on the HP compiler
|
cannam@89
|
4234 # -q* pass through compiler args for the IBM compiler
|
cannam@89
|
4235 # -m*, -t[45]*, -txscale* pass through architecture-specific
|
cannam@89
|
4236 # compiler args for GCC
|
cannam@89
|
4237 # -F/path gives path to uninstalled frameworks, gcc on darwin
|
cannam@89
|
4238 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
|
cannam@89
|
4239 # @file GCC response files
|
cannam@89
|
4240 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
|
cannam@89
|
4241 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
|
cannam@89
|
4242 func_quote_for_eval "$arg"
|
cannam@89
|
4243 arg="$func_quote_for_eval_result"
|
cannam@89
|
4244 func_append compile_command " $arg"
|
cannam@89
|
4245 func_append finalize_command " $arg"
|
cannam@89
|
4246 compiler_flags="$compiler_flags $arg"
|
cannam@89
|
4247 continue
|
cannam@89
|
4248 ;;
|
cannam@89
|
4249
|
cannam@89
|
4250 # Some other compiler flag.
|
cannam@89
|
4251 -* | +*)
|
cannam@89
|
4252 func_quote_for_eval "$arg"
|
cannam@89
|
4253 arg="$func_quote_for_eval_result"
|
cannam@89
|
4254 ;;
|
cannam@89
|
4255
|
cannam@89
|
4256 *.$objext)
|
cannam@89
|
4257 # A standard object.
|
cannam@89
|
4258 objs="$objs $arg"
|
cannam@89
|
4259 ;;
|
cannam@89
|
4260
|
cannam@89
|
4261 *.lo)
|
cannam@89
|
4262 # A libtool-controlled object.
|
cannam@89
|
4263
|
cannam@89
|
4264 # Check to see that this really is a libtool object.
|
cannam@89
|
4265 if func_lalib_unsafe_p "$arg"; then
|
cannam@89
|
4266 pic_object=
|
cannam@89
|
4267 non_pic_object=
|
cannam@89
|
4268
|
cannam@89
|
4269 # Read the .lo file
|
cannam@89
|
4270 func_source "$arg"
|
cannam@89
|
4271
|
cannam@89
|
4272 if test -z "$pic_object" ||
|
cannam@89
|
4273 test -z "$non_pic_object" ||
|
cannam@89
|
4274 test "$pic_object" = none &&
|
cannam@89
|
4275 test "$non_pic_object" = none; then
|
cannam@89
|
4276 func_fatal_error "cannot find name of object for \`$arg'"
|
cannam@89
|
4277 fi
|
cannam@89
|
4278
|
cannam@89
|
4279 # Extract subdirectory from the argument.
|
cannam@89
|
4280 func_dirname "$arg" "/" ""
|
cannam@89
|
4281 xdir="$func_dirname_result"
|
cannam@89
|
4282
|
cannam@89
|
4283 if test "$pic_object" != none; then
|
cannam@89
|
4284 # Prepend the subdirectory the object is found in.
|
cannam@89
|
4285 pic_object="$xdir$pic_object"
|
cannam@89
|
4286
|
cannam@89
|
4287 if test "$prev" = dlfiles; then
|
cannam@89
|
4288 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
|
cannam@89
|
4289 dlfiles="$dlfiles $pic_object"
|
cannam@89
|
4290 prev=
|
cannam@89
|
4291 continue
|
cannam@89
|
4292 else
|
cannam@89
|
4293 # If libtool objects are unsupported, then we need to preload.
|
cannam@89
|
4294 prev=dlprefiles
|
cannam@89
|
4295 fi
|
cannam@89
|
4296 fi
|
cannam@89
|
4297
|
cannam@89
|
4298 # CHECK ME: I think I busted this. -Ossama
|
cannam@89
|
4299 if test "$prev" = dlprefiles; then
|
cannam@89
|
4300 # Preload the old-style object.
|
cannam@89
|
4301 dlprefiles="$dlprefiles $pic_object"
|
cannam@89
|
4302 prev=
|
cannam@89
|
4303 fi
|
cannam@89
|
4304
|
cannam@89
|
4305 # A PIC object.
|
cannam@89
|
4306 func_append libobjs " $pic_object"
|
cannam@89
|
4307 arg="$pic_object"
|
cannam@89
|
4308 fi
|
cannam@89
|
4309
|
cannam@89
|
4310 # Non-PIC object.
|
cannam@89
|
4311 if test "$non_pic_object" != none; then
|
cannam@89
|
4312 # Prepend the subdirectory the object is found in.
|
cannam@89
|
4313 non_pic_object="$xdir$non_pic_object"
|
cannam@89
|
4314
|
cannam@89
|
4315 # A standard non-PIC object
|
cannam@89
|
4316 func_append non_pic_objects " $non_pic_object"
|
cannam@89
|
4317 if test -z "$pic_object" || test "$pic_object" = none ; then
|
cannam@89
|
4318 arg="$non_pic_object"
|
cannam@89
|
4319 fi
|
cannam@89
|
4320 else
|
cannam@89
|
4321 # If the PIC object exists, use it instead.
|
cannam@89
|
4322 # $xdir was prepended to $pic_object above.
|
cannam@89
|
4323 non_pic_object="$pic_object"
|
cannam@89
|
4324 func_append non_pic_objects " $non_pic_object"
|
cannam@89
|
4325 fi
|
cannam@89
|
4326 else
|
cannam@89
|
4327 # Only an error if not doing a dry-run.
|
cannam@89
|
4328 if $opt_dry_run; then
|
cannam@89
|
4329 # Extract subdirectory from the argument.
|
cannam@89
|
4330 func_dirname "$arg" "/" ""
|
cannam@89
|
4331 xdir="$func_dirname_result"
|
cannam@89
|
4332
|
cannam@89
|
4333 func_lo2o "$arg"
|
cannam@89
|
4334 pic_object=$xdir$objdir/$func_lo2o_result
|
cannam@89
|
4335 non_pic_object=$xdir$func_lo2o_result
|
cannam@89
|
4336 func_append libobjs " $pic_object"
|
cannam@89
|
4337 func_append non_pic_objects " $non_pic_object"
|
cannam@89
|
4338 else
|
cannam@89
|
4339 func_fatal_error "\`$arg' is not a valid libtool object"
|
cannam@89
|
4340 fi
|
cannam@89
|
4341 fi
|
cannam@89
|
4342 ;;
|
cannam@89
|
4343
|
cannam@89
|
4344 *.$libext)
|
cannam@89
|
4345 # An archive.
|
cannam@89
|
4346 deplibs="$deplibs $arg"
|
cannam@89
|
4347 old_deplibs="$old_deplibs $arg"
|
cannam@89
|
4348 continue
|
cannam@89
|
4349 ;;
|
cannam@89
|
4350
|
cannam@89
|
4351 *.la)
|
cannam@89
|
4352 # A libtool-controlled library.
|
cannam@89
|
4353
|
cannam@89
|
4354 if test "$prev" = dlfiles; then
|
cannam@89
|
4355 # This library was specified with -dlopen.
|
cannam@89
|
4356 dlfiles="$dlfiles $arg"
|
cannam@89
|
4357 prev=
|
cannam@89
|
4358 elif test "$prev" = dlprefiles; then
|
cannam@89
|
4359 # The library was specified with -dlpreopen.
|
cannam@89
|
4360 dlprefiles="$dlprefiles $arg"
|
cannam@89
|
4361 prev=
|
cannam@89
|
4362 else
|
cannam@89
|
4363 deplibs="$deplibs $arg"
|
cannam@89
|
4364 fi
|
cannam@89
|
4365 continue
|
cannam@89
|
4366 ;;
|
cannam@89
|
4367
|
cannam@89
|
4368 # Some other compiler argument.
|
cannam@89
|
4369 *)
|
cannam@89
|
4370 # Unknown arguments in both finalize_command and compile_command need
|
cannam@89
|
4371 # to be aesthetically quoted because they are evaled later.
|
cannam@89
|
4372 func_quote_for_eval "$arg"
|
cannam@89
|
4373 arg="$func_quote_for_eval_result"
|
cannam@89
|
4374 ;;
|
cannam@89
|
4375 esac # arg
|
cannam@89
|
4376
|
cannam@89
|
4377 # Now actually substitute the argument into the commands.
|
cannam@89
|
4378 if test -n "$arg"; then
|
cannam@89
|
4379 func_append compile_command " $arg"
|
cannam@89
|
4380 func_append finalize_command " $arg"
|
cannam@89
|
4381 fi
|
cannam@89
|
4382 done # argument parsing loop
|
cannam@89
|
4383
|
cannam@89
|
4384 test -n "$prev" && \
|
cannam@89
|
4385 func_fatal_help "the \`$prevarg' option requires an argument"
|
cannam@89
|
4386
|
cannam@89
|
4387 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
|
cannam@89
|
4388 eval arg=\"$export_dynamic_flag_spec\"
|
cannam@89
|
4389 func_append compile_command " $arg"
|
cannam@89
|
4390 func_append finalize_command " $arg"
|
cannam@89
|
4391 fi
|
cannam@89
|
4392
|
cannam@89
|
4393 oldlibs=
|
cannam@89
|
4394 # calculate the name of the file, without its directory
|
cannam@89
|
4395 func_basename "$output"
|
cannam@89
|
4396 outputname="$func_basename_result"
|
cannam@89
|
4397 libobjs_save="$libobjs"
|
cannam@89
|
4398
|
cannam@89
|
4399 if test -n "$shlibpath_var"; then
|
cannam@89
|
4400 # get the directories listed in $shlibpath_var
|
cannam@89
|
4401 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
|
cannam@89
|
4402 else
|
cannam@89
|
4403 shlib_search_path=
|
cannam@89
|
4404 fi
|
cannam@89
|
4405 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
|
cannam@89
|
4406 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
|
cannam@89
|
4407
|
cannam@89
|
4408 func_dirname "$output" "/" ""
|
cannam@89
|
4409 output_objdir="$func_dirname_result$objdir"
|
cannam@89
|
4410 # Create the object directory.
|
cannam@89
|
4411 func_mkdir_p "$output_objdir"
|
cannam@89
|
4412
|
cannam@89
|
4413 # Determine the type of output
|
cannam@89
|
4414 case $output in
|
cannam@89
|
4415 "")
|
cannam@89
|
4416 func_fatal_help "you must specify an output file"
|
cannam@89
|
4417 ;;
|
cannam@89
|
4418 *.$libext) linkmode=oldlib ;;
|
cannam@89
|
4419 *.lo | *.$objext) linkmode=obj ;;
|
cannam@89
|
4420 *.la) linkmode=lib ;;
|
cannam@89
|
4421 *) linkmode=prog ;; # Anything else should be a program.
|
cannam@89
|
4422 esac
|
cannam@89
|
4423
|
cannam@89
|
4424 specialdeplibs=
|
cannam@89
|
4425
|
cannam@89
|
4426 libs=
|
cannam@89
|
4427 # Find all interdependent deplibs by searching for libraries
|
cannam@89
|
4428 # that are linked more than once (e.g. -la -lb -la)
|
cannam@89
|
4429 for deplib in $deplibs; do
|
cannam@89
|
4430 if $opt_duplicate_deps ; then
|
cannam@89
|
4431 case "$libs " in
|
cannam@89
|
4432 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
|
cannam@89
|
4433 esac
|
cannam@89
|
4434 fi
|
cannam@89
|
4435 libs="$libs $deplib"
|
cannam@89
|
4436 done
|
cannam@89
|
4437
|
cannam@89
|
4438 if test "$linkmode" = lib; then
|
cannam@89
|
4439 libs="$predeps $libs $compiler_lib_search_path $postdeps"
|
cannam@89
|
4440
|
cannam@89
|
4441 # Compute libraries that are listed more than once in $predeps
|
cannam@89
|
4442 # $postdeps and mark them as special (i.e., whose duplicates are
|
cannam@89
|
4443 # not to be eliminated).
|
cannam@89
|
4444 pre_post_deps=
|
cannam@89
|
4445 if $opt_duplicate_compiler_generated_deps; then
|
cannam@89
|
4446 for pre_post_dep in $predeps $postdeps; do
|
cannam@89
|
4447 case "$pre_post_deps " in
|
cannam@89
|
4448 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
|
cannam@89
|
4449 esac
|
cannam@89
|
4450 pre_post_deps="$pre_post_deps $pre_post_dep"
|
cannam@89
|
4451 done
|
cannam@89
|
4452 fi
|
cannam@89
|
4453 pre_post_deps=
|
cannam@89
|
4454 fi
|
cannam@89
|
4455
|
cannam@89
|
4456 deplibs=
|
cannam@89
|
4457 newdependency_libs=
|
cannam@89
|
4458 newlib_search_path=
|
cannam@89
|
4459 need_relink=no # whether we're linking any uninstalled libtool libraries
|
cannam@89
|
4460 notinst_deplibs= # not-installed libtool libraries
|
cannam@89
|
4461 notinst_path= # paths that contain not-installed libtool libraries
|
cannam@89
|
4462
|
cannam@89
|
4463 case $linkmode in
|
cannam@89
|
4464 lib)
|
cannam@89
|
4465 passes="conv dlpreopen link"
|
cannam@89
|
4466 for file in $dlfiles $dlprefiles; do
|
cannam@89
|
4467 case $file in
|
cannam@89
|
4468 *.la) ;;
|
cannam@89
|
4469 *)
|
cannam@89
|
4470 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
|
cannam@89
|
4471 ;;
|
cannam@89
|
4472 esac
|
cannam@89
|
4473 done
|
cannam@89
|
4474 ;;
|
cannam@89
|
4475 prog)
|
cannam@89
|
4476 compile_deplibs=
|
cannam@89
|
4477 finalize_deplibs=
|
cannam@89
|
4478 alldeplibs=no
|
cannam@89
|
4479 newdlfiles=
|
cannam@89
|
4480 newdlprefiles=
|
cannam@89
|
4481 passes="conv scan dlopen dlpreopen link"
|
cannam@89
|
4482 ;;
|
cannam@89
|
4483 *) passes="conv"
|
cannam@89
|
4484 ;;
|
cannam@89
|
4485 esac
|
cannam@89
|
4486
|
cannam@89
|
4487 for pass in $passes; do
|
cannam@89
|
4488 # The preopen pass in lib mode reverses $deplibs; put it back here
|
cannam@89
|
4489 # so that -L comes before libs that need it for instance...
|
cannam@89
|
4490 if test "$linkmode,$pass" = "lib,link"; then
|
cannam@89
|
4491 ## FIXME: Find the place where the list is rebuilt in the wrong
|
cannam@89
|
4492 ## order, and fix it there properly
|
cannam@89
|
4493 tmp_deplibs=
|
cannam@89
|
4494 for deplib in $deplibs; do
|
cannam@89
|
4495 tmp_deplibs="$deplib $tmp_deplibs"
|
cannam@89
|
4496 done
|
cannam@89
|
4497 deplibs="$tmp_deplibs"
|
cannam@89
|
4498 fi
|
cannam@89
|
4499
|
cannam@89
|
4500 if test "$linkmode,$pass" = "lib,link" ||
|
cannam@89
|
4501 test "$linkmode,$pass" = "prog,scan"; then
|
cannam@89
|
4502 libs="$deplibs"
|
cannam@89
|
4503 deplibs=
|
cannam@89
|
4504 fi
|
cannam@89
|
4505 if test "$linkmode" = prog; then
|
cannam@89
|
4506 case $pass in
|
cannam@89
|
4507 dlopen) libs="$dlfiles" ;;
|
cannam@89
|
4508 dlpreopen) libs="$dlprefiles" ;;
|
cannam@89
|
4509 link)
|
cannam@89
|
4510 libs="$deplibs %DEPLIBS%"
|
cannam@89
|
4511 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
|
cannam@89
|
4512 ;;
|
cannam@89
|
4513 esac
|
cannam@89
|
4514 fi
|
cannam@89
|
4515 if test "$linkmode,$pass" = "lib,dlpreopen"; then
|
cannam@89
|
4516 # Collect and forward deplibs of preopened libtool libs
|
cannam@89
|
4517 for lib in $dlprefiles; do
|
cannam@89
|
4518 # Ignore non-libtool-libs
|
cannam@89
|
4519 dependency_libs=
|
cannam@89
|
4520 case $lib in
|
cannam@89
|
4521 *.la) func_source "$lib" ;;
|
cannam@89
|
4522 esac
|
cannam@89
|
4523
|
cannam@89
|
4524 # Collect preopened libtool deplibs, except any this library
|
cannam@89
|
4525 # has declared as weak libs
|
cannam@89
|
4526 for deplib in $dependency_libs; do
|
cannam@89
|
4527 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
|
cannam@89
|
4528 case " $weak_libs " in
|
cannam@89
|
4529 *" $deplib_base "*) ;;
|
cannam@89
|
4530 *) deplibs="$deplibs $deplib" ;;
|
cannam@89
|
4531 esac
|
cannam@89
|
4532 done
|
cannam@89
|
4533 done
|
cannam@89
|
4534 libs="$dlprefiles"
|
cannam@89
|
4535 fi
|
cannam@89
|
4536 if test "$pass" = dlopen; then
|
cannam@89
|
4537 # Collect dlpreopened libraries
|
cannam@89
|
4538 save_deplibs="$deplibs"
|
cannam@89
|
4539 deplibs=
|
cannam@89
|
4540 fi
|
cannam@89
|
4541
|
cannam@89
|
4542 for deplib in $libs; do
|
cannam@89
|
4543 lib=
|
cannam@89
|
4544 found=no
|
cannam@89
|
4545 case $deplib in
|
cannam@89
|
4546 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
|
cannam@89
|
4547 if test "$linkmode,$pass" = "prog,link"; then
|
cannam@89
|
4548 compile_deplibs="$deplib $compile_deplibs"
|
cannam@89
|
4549 finalize_deplibs="$deplib $finalize_deplibs"
|
cannam@89
|
4550 else
|
cannam@89
|
4551 compiler_flags="$compiler_flags $deplib"
|
cannam@89
|
4552 if test "$linkmode" = lib ; then
|
cannam@89
|
4553 case "$new_inherited_linker_flags " in
|
cannam@89
|
4554 *" $deplib "*) ;;
|
cannam@89
|
4555 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
|
cannam@89
|
4556 esac
|
cannam@89
|
4557 fi
|
cannam@89
|
4558 fi
|
cannam@89
|
4559 continue
|
cannam@89
|
4560 ;;
|
cannam@89
|
4561 -l*)
|
cannam@89
|
4562 if test "$linkmode" != lib && test "$linkmode" != prog; then
|
cannam@89
|
4563 func_warning "\`-l' is ignored for archives/objects"
|
cannam@89
|
4564 continue
|
cannam@89
|
4565 fi
|
cannam@89
|
4566 func_stripname '-l' '' "$deplib"
|
cannam@89
|
4567 name=$func_stripname_result
|
cannam@89
|
4568 if test "$linkmode" = lib; then
|
cannam@89
|
4569 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
|
cannam@89
|
4570 else
|
cannam@89
|
4571 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
|
cannam@89
|
4572 fi
|
cannam@89
|
4573 for searchdir in $searchdirs; do
|
cannam@89
|
4574 for search_ext in .la $std_shrext .so .a; do
|
cannam@89
|
4575 # Search the libtool library
|
cannam@89
|
4576 lib="$searchdir/lib${name}${search_ext}"
|
cannam@89
|
4577 if test -f "$lib"; then
|
cannam@89
|
4578 if test "$search_ext" = ".la"; then
|
cannam@89
|
4579 found=yes
|
cannam@89
|
4580 else
|
cannam@89
|
4581 found=no
|
cannam@89
|
4582 fi
|
cannam@89
|
4583 break 2
|
cannam@89
|
4584 fi
|
cannam@89
|
4585 done
|
cannam@89
|
4586 done
|
cannam@89
|
4587 if test "$found" != yes; then
|
cannam@89
|
4588 # deplib doesn't seem to be a libtool library
|
cannam@89
|
4589 if test "$linkmode,$pass" = "prog,link"; then
|
cannam@89
|
4590 compile_deplibs="$deplib $compile_deplibs"
|
cannam@89
|
4591 finalize_deplibs="$deplib $finalize_deplibs"
|
cannam@89
|
4592 else
|
cannam@89
|
4593 deplibs="$deplib $deplibs"
|
cannam@89
|
4594 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
|
cannam@89
|
4595 fi
|
cannam@89
|
4596 continue
|
cannam@89
|
4597 else # deplib is a libtool library
|
cannam@89
|
4598 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
|
cannam@89
|
4599 # We need to do some special things here, and not later.
|
cannam@89
|
4600 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
cannam@89
|
4601 case " $predeps $postdeps " in
|
cannam@89
|
4602 *" $deplib "*)
|
cannam@89
|
4603 if func_lalib_p "$lib"; then
|
cannam@89
|
4604 library_names=
|
cannam@89
|
4605 old_library=
|
cannam@89
|
4606 func_source "$lib"
|
cannam@89
|
4607 for l in $old_library $library_names; do
|
cannam@89
|
4608 ll="$l"
|
cannam@89
|
4609 done
|
cannam@89
|
4610 if test "X$ll" = "X$old_library" ; then # only static version available
|
cannam@89
|
4611 found=no
|
cannam@89
|
4612 func_dirname "$lib" "" "."
|
cannam@89
|
4613 ladir="$func_dirname_result"
|
cannam@89
|
4614 lib=$ladir/$old_library
|
cannam@89
|
4615 if test "$linkmode,$pass" = "prog,link"; then
|
cannam@89
|
4616 compile_deplibs="$deplib $compile_deplibs"
|
cannam@89
|
4617 finalize_deplibs="$deplib $finalize_deplibs"
|
cannam@89
|
4618 else
|
cannam@89
|
4619 deplibs="$deplib $deplibs"
|
cannam@89
|
4620 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
|
cannam@89
|
4621 fi
|
cannam@89
|
4622 continue
|
cannam@89
|
4623 fi
|
cannam@89
|
4624 fi
|
cannam@89
|
4625 ;;
|
cannam@89
|
4626 *) ;;
|
cannam@89
|
4627 esac
|
cannam@89
|
4628 fi
|
cannam@89
|
4629 fi
|
cannam@89
|
4630 ;; # -l
|
cannam@89
|
4631 *.ltframework)
|
cannam@89
|
4632 if test "$linkmode,$pass" = "prog,link"; then
|
cannam@89
|
4633 compile_deplibs="$deplib $compile_deplibs"
|
cannam@89
|
4634 finalize_deplibs="$deplib $finalize_deplibs"
|
cannam@89
|
4635 else
|
cannam@89
|
4636 deplibs="$deplib $deplibs"
|
cannam@89
|
4637 if test "$linkmode" = lib ; then
|
cannam@89
|
4638 case "$new_inherited_linker_flags " in
|
cannam@89
|
4639 *" $deplib "*) ;;
|
cannam@89
|
4640 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
|
cannam@89
|
4641 esac
|
cannam@89
|
4642 fi
|
cannam@89
|
4643 fi
|
cannam@89
|
4644 continue
|
cannam@89
|
4645 ;;
|
cannam@89
|
4646 -L*)
|
cannam@89
|
4647 case $linkmode in
|
cannam@89
|
4648 lib)
|
cannam@89
|
4649 deplibs="$deplib $deplibs"
|
cannam@89
|
4650 test "$pass" = conv && continue
|
cannam@89
|
4651 newdependency_libs="$deplib $newdependency_libs"
|
cannam@89
|
4652 func_stripname '-L' '' "$deplib"
|
cannam@89
|
4653 newlib_search_path="$newlib_search_path $func_stripname_result"
|
cannam@89
|
4654 ;;
|
cannam@89
|
4655 prog)
|
cannam@89
|
4656 if test "$pass" = conv; then
|
cannam@89
|
4657 deplibs="$deplib $deplibs"
|
cannam@89
|
4658 continue
|
cannam@89
|
4659 fi
|
cannam@89
|
4660 if test "$pass" = scan; then
|
cannam@89
|
4661 deplibs="$deplib $deplibs"
|
cannam@89
|
4662 else
|
cannam@89
|
4663 compile_deplibs="$deplib $compile_deplibs"
|
cannam@89
|
4664 finalize_deplibs="$deplib $finalize_deplibs"
|
cannam@89
|
4665 fi
|
cannam@89
|
4666 func_stripname '-L' '' "$deplib"
|
cannam@89
|
4667 newlib_search_path="$newlib_search_path $func_stripname_result"
|
cannam@89
|
4668 ;;
|
cannam@89
|
4669 *)
|
cannam@89
|
4670 func_warning "\`-L' is ignored for archives/objects"
|
cannam@89
|
4671 ;;
|
cannam@89
|
4672 esac # linkmode
|
cannam@89
|
4673 continue
|
cannam@89
|
4674 ;; # -L
|
cannam@89
|
4675 -R*)
|
cannam@89
|
4676 if test "$pass" = link; then
|
cannam@89
|
4677 func_stripname '-R' '' "$deplib"
|
cannam@89
|
4678 dir=$func_stripname_result
|
cannam@89
|
4679 # Make sure the xrpath contains only unique directories.
|
cannam@89
|
4680 case "$xrpath " in
|
cannam@89
|
4681 *" $dir "*) ;;
|
cannam@89
|
4682 *) xrpath="$xrpath $dir" ;;
|
cannam@89
|
4683 esac
|
cannam@89
|
4684 fi
|
cannam@89
|
4685 deplibs="$deplib $deplibs"
|
cannam@89
|
4686 continue
|
cannam@89
|
4687 ;;
|
cannam@89
|
4688 *.la) lib="$deplib" ;;
|
cannam@89
|
4689 *.$libext)
|
cannam@89
|
4690 if test "$pass" = conv; then
|
cannam@89
|
4691 deplibs="$deplib $deplibs"
|
cannam@89
|
4692 continue
|
cannam@89
|
4693 fi
|
cannam@89
|
4694 case $linkmode in
|
cannam@89
|
4695 lib)
|
cannam@89
|
4696 # Linking convenience modules into shared libraries is allowed,
|
cannam@89
|
4697 # but linking other static libraries is non-portable.
|
cannam@89
|
4698 case " $dlpreconveniencelibs " in
|
cannam@89
|
4699 *" $deplib "*) ;;
|
cannam@89
|
4700 *)
|
cannam@89
|
4701 valid_a_lib=no
|
cannam@89
|
4702 case $deplibs_check_method in
|
cannam@89
|
4703 match_pattern*)
|
cannam@89
|
4704 set dummy $deplibs_check_method; shift
|
cannam@89
|
4705 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
|
cannam@89
|
4706 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
|
cannam@89
|
4707 | $EGREP "$match_pattern_regex" > /dev/null; then
|
cannam@89
|
4708 valid_a_lib=yes
|
cannam@89
|
4709 fi
|
cannam@89
|
4710 ;;
|
cannam@89
|
4711 pass_all)
|
cannam@89
|
4712 valid_a_lib=yes
|
cannam@89
|
4713 ;;
|
cannam@89
|
4714 esac
|
cannam@89
|
4715 if test "$valid_a_lib" != yes; then
|
cannam@89
|
4716 $ECHO
|
cannam@89
|
4717 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
|
cannam@89
|
4718 $ECHO "*** I have the capability to make that library automatically link in when"
|
cannam@89
|
4719 $ECHO "*** you link to this library. But I can only do this if you have a"
|
cannam@89
|
4720 $ECHO "*** shared version of the library, which you do not appear to have"
|
cannam@89
|
4721 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
|
cannam@89
|
4722 $ECHO "*** that it is just a static archive that I should not use here."
|
cannam@89
|
4723 else
|
cannam@89
|
4724 $ECHO
|
cannam@89
|
4725 $ECHO "*** Warning: Linking the shared library $output against the"
|
cannam@89
|
4726 $ECHO "*** static library $deplib is not portable!"
|
cannam@89
|
4727 deplibs="$deplib $deplibs"
|
cannam@89
|
4728 fi
|
cannam@89
|
4729 ;;
|
cannam@89
|
4730 esac
|
cannam@89
|
4731 continue
|
cannam@89
|
4732 ;;
|
cannam@89
|
4733 prog)
|
cannam@89
|
4734 if test "$pass" != link; then
|
cannam@89
|
4735 deplibs="$deplib $deplibs"
|
cannam@89
|
4736 else
|
cannam@89
|
4737 compile_deplibs="$deplib $compile_deplibs"
|
cannam@89
|
4738 finalize_deplibs="$deplib $finalize_deplibs"
|
cannam@89
|
4739 fi
|
cannam@89
|
4740 continue
|
cannam@89
|
4741 ;;
|
cannam@89
|
4742 esac # linkmode
|
cannam@89
|
4743 ;; # *.$libext
|
cannam@89
|
4744 *.lo | *.$objext)
|
cannam@89
|
4745 if test "$pass" = conv; then
|
cannam@89
|
4746 deplibs="$deplib $deplibs"
|
cannam@89
|
4747 elif test "$linkmode" = prog; then
|
cannam@89
|
4748 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
|
cannam@89
|
4749 # If there is no dlopen support or we're linking statically,
|
cannam@89
|
4750 # we need to preload.
|
cannam@89
|
4751 newdlprefiles="$newdlprefiles $deplib"
|
cannam@89
|
4752 compile_deplibs="$deplib $compile_deplibs"
|
cannam@89
|
4753 finalize_deplibs="$deplib $finalize_deplibs"
|
cannam@89
|
4754 else
|
cannam@89
|
4755 newdlfiles="$newdlfiles $deplib"
|
cannam@89
|
4756 fi
|
cannam@89
|
4757 fi
|
cannam@89
|
4758 continue
|
cannam@89
|
4759 ;;
|
cannam@89
|
4760 %DEPLIBS%)
|
cannam@89
|
4761 alldeplibs=yes
|
cannam@89
|
4762 continue
|
cannam@89
|
4763 ;;
|
cannam@89
|
4764 esac # case $deplib
|
cannam@89
|
4765
|
cannam@89
|
4766 if test "$found" = yes || test -f "$lib"; then :
|
cannam@89
|
4767 else
|
cannam@89
|
4768 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
|
cannam@89
|
4769 fi
|
cannam@89
|
4770
|
cannam@89
|
4771 # Check to see that this really is a libtool archive.
|
cannam@89
|
4772 func_lalib_unsafe_p "$lib" \
|
cannam@89
|
4773 || func_fatal_error "\`$lib' is not a valid libtool archive"
|
cannam@89
|
4774
|
cannam@89
|
4775 func_dirname "$lib" "" "."
|
cannam@89
|
4776 ladir="$func_dirname_result"
|
cannam@89
|
4777
|
cannam@89
|
4778 dlname=
|
cannam@89
|
4779 dlopen=
|
cannam@89
|
4780 dlpreopen=
|
cannam@89
|
4781 libdir=
|
cannam@89
|
4782 library_names=
|
cannam@89
|
4783 old_library=
|
cannam@89
|
4784 inherited_linker_flags=
|
cannam@89
|
4785 # If the library was installed with an old release of libtool,
|
cannam@89
|
4786 # it will not redefine variables installed, or shouldnotlink
|
cannam@89
|
4787 installed=yes
|
cannam@89
|
4788 shouldnotlink=no
|
cannam@89
|
4789 avoidtemprpath=
|
cannam@89
|
4790
|
cannam@89
|
4791
|
cannam@89
|
4792 # Read the .la file
|
cannam@89
|
4793 func_source "$lib"
|
cannam@89
|
4794
|
cannam@89
|
4795 # Convert "-framework foo" to "foo.ltframework"
|
cannam@89
|
4796 if test -n "$inherited_linker_flags"; then
|
cannam@89
|
4797 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
|
cannam@89
|
4798 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
|
cannam@89
|
4799 case " $new_inherited_linker_flags " in
|
cannam@89
|
4800 *" $tmp_inherited_linker_flag "*) ;;
|
cannam@89
|
4801 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
|
cannam@89
|
4802 esac
|
cannam@89
|
4803 done
|
cannam@89
|
4804 fi
|
cannam@89
|
4805 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
cannam@89
|
4806 if test "$linkmode,$pass" = "lib,link" ||
|
cannam@89
|
4807 test "$linkmode,$pass" = "prog,scan" ||
|
cannam@89
|
4808 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
|
cannam@89
|
4809 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
|
cannam@89
|
4810 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
|
cannam@89
|
4811 fi
|
cannam@89
|
4812
|
cannam@89
|
4813 if test "$pass" = conv; then
|
cannam@89
|
4814 # Only check for convenience libraries
|
cannam@89
|
4815 deplibs="$lib $deplibs"
|
cannam@89
|
4816 if test -z "$libdir"; then
|
cannam@89
|
4817 if test -z "$old_library"; then
|
cannam@89
|
4818 func_fatal_error "cannot find name of link library for \`$lib'"
|
cannam@89
|
4819 fi
|
cannam@89
|
4820 # It is a libtool convenience library, so add in its objects.
|
cannam@89
|
4821 convenience="$convenience $ladir/$objdir/$old_library"
|
cannam@89
|
4822 old_convenience="$old_convenience $ladir/$objdir/$old_library"
|
cannam@89
|
4823 elif test "$linkmode" != prog && test "$linkmode" != lib; then
|
cannam@89
|
4824 func_fatal_error "\`$lib' is not a convenience library"
|
cannam@89
|
4825 fi
|
cannam@89
|
4826 tmp_libs=
|
cannam@89
|
4827 for deplib in $dependency_libs; do
|
cannam@89
|
4828 deplibs="$deplib $deplibs"
|
cannam@89
|
4829 if $opt_duplicate_deps ; then
|
cannam@89
|
4830 case "$tmp_libs " in
|
cannam@89
|
4831 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
|
cannam@89
|
4832 esac
|
cannam@89
|
4833 fi
|
cannam@89
|
4834 tmp_libs="$tmp_libs $deplib"
|
cannam@89
|
4835 done
|
cannam@89
|
4836 continue
|
cannam@89
|
4837 fi # $pass = conv
|
cannam@89
|
4838
|
cannam@89
|
4839
|
cannam@89
|
4840 # Get the name of the library we link against.
|
cannam@89
|
4841 linklib=
|
cannam@89
|
4842 for l in $old_library $library_names; do
|
cannam@89
|
4843 linklib="$l"
|
cannam@89
|
4844 done
|
cannam@89
|
4845 if test -z "$linklib"; then
|
cannam@89
|
4846 func_fatal_error "cannot find name of link library for \`$lib'"
|
cannam@89
|
4847 fi
|
cannam@89
|
4848
|
cannam@89
|
4849 # This library was specified with -dlopen.
|
cannam@89
|
4850 if test "$pass" = dlopen; then
|
cannam@89
|
4851 if test -z "$libdir"; then
|
cannam@89
|
4852 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
|
cannam@89
|
4853 fi
|
cannam@89
|
4854 if test -z "$dlname" ||
|
cannam@89
|
4855 test "$dlopen_support" != yes ||
|
cannam@89
|
4856 test "$build_libtool_libs" = no; then
|
cannam@89
|
4857 # If there is no dlname, no dlopen support or we're linking
|
cannam@89
|
4858 # statically, we need to preload. We also need to preload any
|
cannam@89
|
4859 # dependent libraries so libltdl's deplib preloader doesn't
|
cannam@89
|
4860 # bomb out in the load deplibs phase.
|
cannam@89
|
4861 dlprefiles="$dlprefiles $lib $dependency_libs"
|
cannam@89
|
4862 else
|
cannam@89
|
4863 newdlfiles="$newdlfiles $lib"
|
cannam@89
|
4864 fi
|
cannam@89
|
4865 continue
|
cannam@89
|
4866 fi # $pass = dlopen
|
cannam@89
|
4867
|
cannam@89
|
4868 # We need an absolute path.
|
cannam@89
|
4869 case $ladir in
|
cannam@89
|
4870 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
|
cannam@89
|
4871 *)
|
cannam@89
|
4872 abs_ladir=`cd "$ladir" && pwd`
|
cannam@89
|
4873 if test -z "$abs_ladir"; then
|
cannam@89
|
4874 func_warning "cannot determine absolute directory name of \`$ladir'"
|
cannam@89
|
4875 func_warning "passing it literally to the linker, although it might fail"
|
cannam@89
|
4876 abs_ladir="$ladir"
|
cannam@89
|
4877 fi
|
cannam@89
|
4878 ;;
|
cannam@89
|
4879 esac
|
cannam@89
|
4880 func_basename "$lib"
|
cannam@89
|
4881 laname="$func_basename_result"
|
cannam@89
|
4882
|
cannam@89
|
4883 # Find the relevant object directory and library name.
|
cannam@89
|
4884 if test "X$installed" = Xyes; then
|
cannam@89
|
4885 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
|
cannam@89
|
4886 func_warning "library \`$lib' was moved."
|
cannam@89
|
4887 dir="$ladir"
|
cannam@89
|
4888 absdir="$abs_ladir"
|
cannam@89
|
4889 libdir="$abs_ladir"
|
cannam@89
|
4890 else
|
cannam@89
|
4891 dir="$libdir"
|
cannam@89
|
4892 absdir="$libdir"
|
cannam@89
|
4893 fi
|
cannam@89
|
4894 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
|
cannam@89
|
4895 else
|
cannam@89
|
4896 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
|
cannam@89
|
4897 dir="$ladir"
|
cannam@89
|
4898 absdir="$abs_ladir"
|
cannam@89
|
4899 # Remove this search path later
|
cannam@89
|
4900 notinst_path="$notinst_path $abs_ladir"
|
cannam@89
|
4901 else
|
cannam@89
|
4902 dir="$ladir/$objdir"
|
cannam@89
|
4903 absdir="$abs_ladir/$objdir"
|
cannam@89
|
4904 # Remove this search path later
|
cannam@89
|
4905 notinst_path="$notinst_path $abs_ladir"
|
cannam@89
|
4906 fi
|
cannam@89
|
4907 fi # $installed = yes
|
cannam@89
|
4908 func_stripname 'lib' '.la' "$laname"
|
cannam@89
|
4909 name=$func_stripname_result
|
cannam@89
|
4910
|
cannam@89
|
4911 # This library was specified with -dlpreopen.
|
cannam@89
|
4912 if test "$pass" = dlpreopen; then
|
cannam@89
|
4913 if test -z "$libdir" && test "$linkmode" = prog; then
|
cannam@89
|
4914 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
|
cannam@89
|
4915 fi
|
cannam@89
|
4916 # Prefer using a static library (so that no silly _DYNAMIC symbols
|
cannam@89
|
4917 # are required to link).
|
cannam@89
|
4918 if test -n "$old_library"; then
|
cannam@89
|
4919 newdlprefiles="$newdlprefiles $dir/$old_library"
|
cannam@89
|
4920 # Keep a list of preopened convenience libraries to check
|
cannam@89
|
4921 # that they are being used correctly in the link pass.
|
cannam@89
|
4922 test -z "$libdir" && \
|
cannam@89
|
4923 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
|
cannam@89
|
4924 # Otherwise, use the dlname, so that lt_dlopen finds it.
|
cannam@89
|
4925 elif test -n "$dlname"; then
|
cannam@89
|
4926 newdlprefiles="$newdlprefiles $dir/$dlname"
|
cannam@89
|
4927 else
|
cannam@89
|
4928 newdlprefiles="$newdlprefiles $dir/$linklib"
|
cannam@89
|
4929 fi
|
cannam@89
|
4930 fi # $pass = dlpreopen
|
cannam@89
|
4931
|
cannam@89
|
4932 if test -z "$libdir"; then
|
cannam@89
|
4933 # Link the convenience library
|
cannam@89
|
4934 if test "$linkmode" = lib; then
|
cannam@89
|
4935 deplibs="$dir/$old_library $deplibs"
|
cannam@89
|
4936 elif test "$linkmode,$pass" = "prog,link"; then
|
cannam@89
|
4937 compile_deplibs="$dir/$old_library $compile_deplibs"
|
cannam@89
|
4938 finalize_deplibs="$dir/$old_library $finalize_deplibs"
|
cannam@89
|
4939 else
|
cannam@89
|
4940 deplibs="$lib $deplibs" # used for prog,scan pass
|
cannam@89
|
4941 fi
|
cannam@89
|
4942 continue
|
cannam@89
|
4943 fi
|
cannam@89
|
4944
|
cannam@89
|
4945
|
cannam@89
|
4946 if test "$linkmode" = prog && test "$pass" != link; then
|
cannam@89
|
4947 newlib_search_path="$newlib_search_path $ladir"
|
cannam@89
|
4948 deplibs="$lib $deplibs"
|
cannam@89
|
4949
|
cannam@89
|
4950 linkalldeplibs=no
|
cannam@89
|
4951 if test "$link_all_deplibs" != no || test -z "$library_names" ||
|
cannam@89
|
4952 test "$build_libtool_libs" = no; then
|
cannam@89
|
4953 linkalldeplibs=yes
|
cannam@89
|
4954 fi
|
cannam@89
|
4955
|
cannam@89
|
4956 tmp_libs=
|
cannam@89
|
4957 for deplib in $dependency_libs; do
|
cannam@89
|
4958 case $deplib in
|
cannam@89
|
4959 -L*) func_stripname '-L' '' "$deplib"
|
cannam@89
|
4960 newlib_search_path="$newlib_search_path $func_stripname_result"
|
cannam@89
|
4961 ;;
|
cannam@89
|
4962 esac
|
cannam@89
|
4963 # Need to link against all dependency_libs?
|
cannam@89
|
4964 if test "$linkalldeplibs" = yes; then
|
cannam@89
|
4965 deplibs="$deplib $deplibs"
|
cannam@89
|
4966 else
|
cannam@89
|
4967 # Need to hardcode shared library paths
|
cannam@89
|
4968 # or/and link against static libraries
|
cannam@89
|
4969 newdependency_libs="$deplib $newdependency_libs"
|
cannam@89
|
4970 fi
|
cannam@89
|
4971 if $opt_duplicate_deps ; then
|
cannam@89
|
4972 case "$tmp_libs " in
|
cannam@89
|
4973 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
|
cannam@89
|
4974 esac
|
cannam@89
|
4975 fi
|
cannam@89
|
4976 tmp_libs="$tmp_libs $deplib"
|
cannam@89
|
4977 done # for deplib
|
cannam@89
|
4978 continue
|
cannam@89
|
4979 fi # $linkmode = prog...
|
cannam@89
|
4980
|
cannam@89
|
4981 if test "$linkmode,$pass" = "prog,link"; then
|
cannam@89
|
4982 if test -n "$library_names" &&
|
cannam@89
|
4983 { { test "$prefer_static_libs" = no ||
|
cannam@89
|
4984 test "$prefer_static_libs,$installed" = "built,yes"; } ||
|
cannam@89
|
4985 test -z "$old_library"; }; then
|
cannam@89
|
4986 # We need to hardcode the library path
|
cannam@89
|
4987 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
|
cannam@89
|
4988 # Make sure the rpath contains only unique directories.
|
cannam@89
|
4989 case "$temp_rpath:" in
|
cannam@89
|
4990 *"$absdir:"*) ;;
|
cannam@89
|
4991 *) temp_rpath="$temp_rpath$absdir:" ;;
|
cannam@89
|
4992 esac
|
cannam@89
|
4993 fi
|
cannam@89
|
4994
|
cannam@89
|
4995 # Hardcode the library path.
|
cannam@89
|
4996 # Skip directories that are in the system default run-time
|
cannam@89
|
4997 # search path.
|
cannam@89
|
4998 case " $sys_lib_dlsearch_path " in
|
cannam@89
|
4999 *" $absdir "*) ;;
|
cannam@89
|
5000 *)
|
cannam@89
|
5001 case "$compile_rpath " in
|
cannam@89
|
5002 *" $absdir "*) ;;
|
cannam@89
|
5003 *) compile_rpath="$compile_rpath $absdir"
|
cannam@89
|
5004 esac
|
cannam@89
|
5005 ;;
|
cannam@89
|
5006 esac
|
cannam@89
|
5007 case " $sys_lib_dlsearch_path " in
|
cannam@89
|
5008 *" $libdir "*) ;;
|
cannam@89
|
5009 *)
|
cannam@89
|
5010 case "$finalize_rpath " in
|
cannam@89
|
5011 *" $libdir "*) ;;
|
cannam@89
|
5012 *) finalize_rpath="$finalize_rpath $libdir"
|
cannam@89
|
5013 esac
|
cannam@89
|
5014 ;;
|
cannam@89
|
5015 esac
|
cannam@89
|
5016 fi # $linkmode,$pass = prog,link...
|
cannam@89
|
5017
|
cannam@89
|
5018 if test "$alldeplibs" = yes &&
|
cannam@89
|
5019 { test "$deplibs_check_method" = pass_all ||
|
cannam@89
|
5020 { test "$build_libtool_libs" = yes &&
|
cannam@89
|
5021 test -n "$library_names"; }; }; then
|
cannam@89
|
5022 # We only need to search for static libraries
|
cannam@89
|
5023 continue
|
cannam@89
|
5024 fi
|
cannam@89
|
5025 fi
|
cannam@89
|
5026
|
cannam@89
|
5027 link_static=no # Whether the deplib will be linked statically
|
cannam@89
|
5028 use_static_libs=$prefer_static_libs
|
cannam@89
|
5029 if test "$use_static_libs" = built && test "$installed" = yes; then
|
cannam@89
|
5030 use_static_libs=no
|
cannam@89
|
5031 fi
|
cannam@89
|
5032 if test -n "$library_names" &&
|
cannam@89
|
5033 { test "$use_static_libs" = no || test -z "$old_library"; }; then
|
cannam@89
|
5034 case $host in
|
cannam@89
|
5035 *cygwin* | *mingw*)
|
cannam@89
|
5036 # No point in relinking DLLs because paths are not encoded
|
cannam@89
|
5037 notinst_deplibs="$notinst_deplibs $lib"
|
cannam@89
|
5038 need_relink=no
|
cannam@89
|
5039 ;;
|
cannam@89
|
5040 *)
|
cannam@89
|
5041 if test "$installed" = no; then
|
cannam@89
|
5042 notinst_deplibs="$notinst_deplibs $lib"
|
cannam@89
|
5043 need_relink=yes
|
cannam@89
|
5044 fi
|
cannam@89
|
5045 ;;
|
cannam@89
|
5046 esac
|
cannam@89
|
5047 # This is a shared library
|
cannam@89
|
5048
|
cannam@89
|
5049 # Warn about portability, can't link against -module's on some
|
cannam@89
|
5050 # systems (darwin). Don't bleat about dlopened modules though!
|
cannam@89
|
5051 dlopenmodule=""
|
cannam@89
|
5052 for dlpremoduletest in $dlprefiles; do
|
cannam@89
|
5053 if test "X$dlpremoduletest" = "X$lib"; then
|
cannam@89
|
5054 dlopenmodule="$dlpremoduletest"
|
cannam@89
|
5055 break
|
cannam@89
|
5056 fi
|
cannam@89
|
5057 done
|
cannam@89
|
5058 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
|
cannam@89
|
5059 $ECHO
|
cannam@89
|
5060 if test "$linkmode" = prog; then
|
cannam@89
|
5061 $ECHO "*** Warning: Linking the executable $output against the loadable module"
|
cannam@89
|
5062 else
|
cannam@89
|
5063 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
|
cannam@89
|
5064 fi
|
cannam@89
|
5065 $ECHO "*** $linklib is not portable!"
|
cannam@89
|
5066 fi
|
cannam@89
|
5067 if test "$linkmode" = lib &&
|
cannam@89
|
5068 test "$hardcode_into_libs" = yes; then
|
cannam@89
|
5069 # Hardcode the library path.
|
cannam@89
|
5070 # Skip directories that are in the system default run-time
|
cannam@89
|
5071 # search path.
|
cannam@89
|
5072 case " $sys_lib_dlsearch_path " in
|
cannam@89
|
5073 *" $absdir "*) ;;
|
cannam@89
|
5074 *)
|
cannam@89
|
5075 case "$compile_rpath " in
|
cannam@89
|
5076 *" $absdir "*) ;;
|
cannam@89
|
5077 *) compile_rpath="$compile_rpath $absdir"
|
cannam@89
|
5078 esac
|
cannam@89
|
5079 ;;
|
cannam@89
|
5080 esac
|
cannam@89
|
5081 case " $sys_lib_dlsearch_path " in
|
cannam@89
|
5082 *" $libdir "*) ;;
|
cannam@89
|
5083 *)
|
cannam@89
|
5084 case "$finalize_rpath " in
|
cannam@89
|
5085 *" $libdir "*) ;;
|
cannam@89
|
5086 *) finalize_rpath="$finalize_rpath $libdir"
|
cannam@89
|
5087 esac
|
cannam@89
|
5088 ;;
|
cannam@89
|
5089 esac
|
cannam@89
|
5090 fi
|
cannam@89
|
5091
|
cannam@89
|
5092 if test -n "$old_archive_from_expsyms_cmds"; then
|
cannam@89
|
5093 # figure out the soname
|
cannam@89
|
5094 set dummy $library_names
|
cannam@89
|
5095 shift
|
cannam@89
|
5096 realname="$1"
|
cannam@89
|
5097 shift
|
cannam@89
|
5098 libname=`eval "\\$ECHO \"$libname_spec\""`
|
cannam@89
|
5099 # use dlname if we got it. it's perfectly good, no?
|
cannam@89
|
5100 if test -n "$dlname"; then
|
cannam@89
|
5101 soname="$dlname"
|
cannam@89
|
5102 elif test -n "$soname_spec"; then
|
cannam@89
|
5103 # bleh windows
|
cannam@89
|
5104 case $host in
|
cannam@89
|
5105 *cygwin* | mingw*)
|
cannam@89
|
5106 func_arith $current - $age
|
cannam@89
|
5107 major=$func_arith_result
|
cannam@89
|
5108 versuffix="-$major"
|
cannam@89
|
5109 ;;
|
cannam@89
|
5110 esac
|
cannam@89
|
5111 eval soname=\"$soname_spec\"
|
cannam@89
|
5112 else
|
cannam@89
|
5113 soname="$realname"
|
cannam@89
|
5114 fi
|
cannam@89
|
5115
|
cannam@89
|
5116 # Make a new name for the extract_expsyms_cmds to use
|
cannam@89
|
5117 soroot="$soname"
|
cannam@89
|
5118 func_basename "$soroot"
|
cannam@89
|
5119 soname="$func_basename_result"
|
cannam@89
|
5120 func_stripname 'lib' '.dll' "$soname"
|
cannam@89
|
5121 newlib=libimp-$func_stripname_result.a
|
cannam@89
|
5122
|
cannam@89
|
5123 # If the library has no export list, then create one now
|
cannam@89
|
5124 if test -f "$output_objdir/$soname-def"; then :
|
cannam@89
|
5125 else
|
cannam@89
|
5126 func_verbose "extracting exported symbol list from \`$soname'"
|
cannam@89
|
5127 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
|
cannam@89
|
5128 fi
|
cannam@89
|
5129
|
cannam@89
|
5130 # Create $newlib
|
cannam@89
|
5131 if test -f "$output_objdir/$newlib"; then :; else
|
cannam@89
|
5132 func_verbose "generating import library for \`$soname'"
|
cannam@89
|
5133 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
|
cannam@89
|
5134 fi
|
cannam@89
|
5135 # make sure the library variables are pointing to the new library
|
cannam@89
|
5136 dir=$output_objdir
|
cannam@89
|
5137 linklib=$newlib
|
cannam@89
|
5138 fi # test -n "$old_archive_from_expsyms_cmds"
|
cannam@89
|
5139
|
cannam@89
|
5140 if test "$linkmode" = prog || test "$mode" != relink; then
|
cannam@89
|
5141 add_shlibpath=
|
cannam@89
|
5142 add_dir=
|
cannam@89
|
5143 add=
|
cannam@89
|
5144 lib_linked=yes
|
cannam@89
|
5145 case $hardcode_action in
|
cannam@89
|
5146 immediate | unsupported)
|
cannam@89
|
5147 if test "$hardcode_direct" = no; then
|
cannam@89
|
5148 add="$dir/$linklib"
|
cannam@89
|
5149 case $host in
|
cannam@89
|
5150 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
|
cannam@89
|
5151 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
|
cannam@89
|
5152 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
|
cannam@89
|
5153 *-*-unixware7*) add_dir="-L$dir" ;;
|
cannam@89
|
5154 *-*-darwin* )
|
cannam@89
|
5155 # if the lib is a (non-dlopened) module then we can not
|
cannam@89
|
5156 # link against it, someone is ignoring the earlier warnings
|
cannam@89
|
5157 if /usr/bin/file -L $add 2> /dev/null |
|
cannam@89
|
5158 $GREP ": [^:]* bundle" >/dev/null ; then
|
cannam@89
|
5159 if test "X$dlopenmodule" != "X$lib"; then
|
cannam@89
|
5160 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
|
cannam@89
|
5161 if test -z "$old_library" ; then
|
cannam@89
|
5162 $ECHO
|
cannam@89
|
5163 $ECHO "*** And there doesn't seem to be a static archive available"
|
cannam@89
|
5164 $ECHO "*** The link will probably fail, sorry"
|
cannam@89
|
5165 else
|
cannam@89
|
5166 add="$dir/$old_library"
|
cannam@89
|
5167 fi
|
cannam@89
|
5168 elif test -n "$old_library"; then
|
cannam@89
|
5169 add="$dir/$old_library"
|
cannam@89
|
5170 fi
|
cannam@89
|
5171 fi
|
cannam@89
|
5172 esac
|
cannam@89
|
5173 elif test "$hardcode_minus_L" = no; then
|
cannam@89
|
5174 case $host in
|
cannam@89
|
5175 *-*-sunos*) add_shlibpath="$dir" ;;
|
cannam@89
|
5176 esac
|
cannam@89
|
5177 add_dir="-L$dir"
|
cannam@89
|
5178 add="-l$name"
|
cannam@89
|
5179 elif test "$hardcode_shlibpath_var" = no; then
|
cannam@89
|
5180 add_shlibpath="$dir"
|
cannam@89
|
5181 add="-l$name"
|
cannam@89
|
5182 else
|
cannam@89
|
5183 lib_linked=no
|
cannam@89
|
5184 fi
|
cannam@89
|
5185 ;;
|
cannam@89
|
5186 relink)
|
cannam@89
|
5187 if test "$hardcode_direct" = yes &&
|
cannam@89
|
5188 test "$hardcode_direct_absolute" = no; then
|
cannam@89
|
5189 add="$dir/$linklib"
|
cannam@89
|
5190 elif test "$hardcode_minus_L" = yes; then
|
cannam@89
|
5191 add_dir="-L$dir"
|
cannam@89
|
5192 # Try looking first in the location we're being installed to.
|
cannam@89
|
5193 if test -n "$inst_prefix_dir"; then
|
cannam@89
|
5194 case $libdir in
|
cannam@89
|
5195 [\\/]*)
|
cannam@89
|
5196 add_dir="$add_dir -L$inst_prefix_dir$libdir"
|
cannam@89
|
5197 ;;
|
cannam@89
|
5198 esac
|
cannam@89
|
5199 fi
|
cannam@89
|
5200 add="-l$name"
|
cannam@89
|
5201 elif test "$hardcode_shlibpath_var" = yes; then
|
cannam@89
|
5202 add_shlibpath="$dir"
|
cannam@89
|
5203 add="-l$name"
|
cannam@89
|
5204 else
|
cannam@89
|
5205 lib_linked=no
|
cannam@89
|
5206 fi
|
cannam@89
|
5207 ;;
|
cannam@89
|
5208 *) lib_linked=no ;;
|
cannam@89
|
5209 esac
|
cannam@89
|
5210
|
cannam@89
|
5211 if test "$lib_linked" != yes; then
|
cannam@89
|
5212 func_fatal_configuration "unsupported hardcode properties"
|
cannam@89
|
5213 fi
|
cannam@89
|
5214
|
cannam@89
|
5215 if test -n "$add_shlibpath"; then
|
cannam@89
|
5216 case :$compile_shlibpath: in
|
cannam@89
|
5217 *":$add_shlibpath:"*) ;;
|
cannam@89
|
5218 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
|
cannam@89
|
5219 esac
|
cannam@89
|
5220 fi
|
cannam@89
|
5221 if test "$linkmode" = prog; then
|
cannam@89
|
5222 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
|
cannam@89
|
5223 test -n "$add" && compile_deplibs="$add $compile_deplibs"
|
cannam@89
|
5224 else
|
cannam@89
|
5225 test -n "$add_dir" && deplibs="$add_dir $deplibs"
|
cannam@89
|
5226 test -n "$add" && deplibs="$add $deplibs"
|
cannam@89
|
5227 if test "$hardcode_direct" != yes &&
|
cannam@89
|
5228 test "$hardcode_minus_L" != yes &&
|
cannam@89
|
5229 test "$hardcode_shlibpath_var" = yes; then
|
cannam@89
|
5230 case :$finalize_shlibpath: in
|
cannam@89
|
5231 *":$libdir:"*) ;;
|
cannam@89
|
5232 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
|
cannam@89
|
5233 esac
|
cannam@89
|
5234 fi
|
cannam@89
|
5235 fi
|
cannam@89
|
5236 fi
|
cannam@89
|
5237
|
cannam@89
|
5238 if test "$linkmode" = prog || test "$mode" = relink; then
|
cannam@89
|
5239 add_shlibpath=
|
cannam@89
|
5240 add_dir=
|
cannam@89
|
5241 add=
|
cannam@89
|
5242 # Finalize command for both is simple: just hardcode it.
|
cannam@89
|
5243 if test "$hardcode_direct" = yes &&
|
cannam@89
|
5244 test "$hardcode_direct_absolute" = no; then
|
cannam@89
|
5245 add="$libdir/$linklib"
|
cannam@89
|
5246 elif test "$hardcode_minus_L" = yes; then
|
cannam@89
|
5247 add_dir="-L$libdir"
|
cannam@89
|
5248 add="-l$name"
|
cannam@89
|
5249 elif test "$hardcode_shlibpath_var" = yes; then
|
cannam@89
|
5250 case :$finalize_shlibpath: in
|
cannam@89
|
5251 *":$libdir:"*) ;;
|
cannam@89
|
5252 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
|
cannam@89
|
5253 esac
|
cannam@89
|
5254 add="-l$name"
|
cannam@89
|
5255 elif test "$hardcode_automatic" = yes; then
|
cannam@89
|
5256 if test -n "$inst_prefix_dir" &&
|
cannam@89
|
5257 test -f "$inst_prefix_dir$libdir/$linklib" ; then
|
cannam@89
|
5258 add="$inst_prefix_dir$libdir/$linklib"
|
cannam@89
|
5259 else
|
cannam@89
|
5260 add="$libdir/$linklib"
|
cannam@89
|
5261 fi
|
cannam@89
|
5262 else
|
cannam@89
|
5263 # We cannot seem to hardcode it, guess we'll fake it.
|
cannam@89
|
5264 add_dir="-L$libdir"
|
cannam@89
|
5265 # Try looking first in the location we're being installed to.
|
cannam@89
|
5266 if test -n "$inst_prefix_dir"; then
|
cannam@89
|
5267 case $libdir in
|
cannam@89
|
5268 [\\/]*)
|
cannam@89
|
5269 add_dir="$add_dir -L$inst_prefix_dir$libdir"
|
cannam@89
|
5270 ;;
|
cannam@89
|
5271 esac
|
cannam@89
|
5272 fi
|
cannam@89
|
5273 add="-l$name"
|
cannam@89
|
5274 fi
|
cannam@89
|
5275
|
cannam@89
|
5276 if test "$linkmode" = prog; then
|
cannam@89
|
5277 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
|
cannam@89
|
5278 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
|
cannam@89
|
5279 else
|
cannam@89
|
5280 test -n "$add_dir" && deplibs="$add_dir $deplibs"
|
cannam@89
|
5281 test -n "$add" && deplibs="$add $deplibs"
|
cannam@89
|
5282 fi
|
cannam@89
|
5283 fi
|
cannam@89
|
5284 elif test "$linkmode" = prog; then
|
cannam@89
|
5285 # Here we assume that one of hardcode_direct or hardcode_minus_L
|
cannam@89
|
5286 # is not unsupported. This is valid on all known static and
|
cannam@89
|
5287 # shared platforms.
|
cannam@89
|
5288 if test "$hardcode_direct" != unsupported; then
|
cannam@89
|
5289 test -n "$old_library" && linklib="$old_library"
|
cannam@89
|
5290 compile_deplibs="$dir/$linklib $compile_deplibs"
|
cannam@89
|
5291 finalize_deplibs="$dir/$linklib $finalize_deplibs"
|
cannam@89
|
5292 else
|
cannam@89
|
5293 compile_deplibs="-l$name -L$dir $compile_deplibs"
|
cannam@89
|
5294 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
|
cannam@89
|
5295 fi
|
cannam@89
|
5296 elif test "$build_libtool_libs" = yes; then
|
cannam@89
|
5297 # Not a shared library
|
cannam@89
|
5298 if test "$deplibs_check_method" != pass_all; then
|
cannam@89
|
5299 # We're trying link a shared library against a static one
|
cannam@89
|
5300 # but the system doesn't support it.
|
cannam@89
|
5301
|
cannam@89
|
5302 # Just print a warning and add the library to dependency_libs so
|
cannam@89
|
5303 # that the program can be linked against the static library.
|
cannam@89
|
5304 $ECHO
|
cannam@89
|
5305 $ECHO "*** Warning: This system can not link to static lib archive $lib."
|
cannam@89
|
5306 $ECHO "*** I have the capability to make that library automatically link in when"
|
cannam@89
|
5307 $ECHO "*** you link to this library. But I can only do this if you have a"
|
cannam@89
|
5308 $ECHO "*** shared version of the library, which you do not appear to have."
|
cannam@89
|
5309 if test "$module" = yes; then
|
cannam@89
|
5310 $ECHO "*** But as you try to build a module library, libtool will still create "
|
cannam@89
|
5311 $ECHO "*** a static module, that should work as long as the dlopening application"
|
cannam@89
|
5312 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
|
cannam@89
|
5313 if test -z "$global_symbol_pipe"; then
|
cannam@89
|
5314 $ECHO
|
cannam@89
|
5315 $ECHO "*** However, this would only work if libtool was able to extract symbol"
|
cannam@89
|
5316 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
|
cannam@89
|
5317 $ECHO "*** not find such a program. So, this module is probably useless."
|
cannam@89
|
5318 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
|
cannam@89
|
5319 fi
|
cannam@89
|
5320 if test "$build_old_libs" = no; then
|
cannam@89
|
5321 build_libtool_libs=module
|
cannam@89
|
5322 build_old_libs=yes
|
cannam@89
|
5323 else
|
cannam@89
|
5324 build_libtool_libs=no
|
cannam@89
|
5325 fi
|
cannam@89
|
5326 fi
|
cannam@89
|
5327 else
|
cannam@89
|
5328 deplibs="$dir/$old_library $deplibs"
|
cannam@89
|
5329 link_static=yes
|
cannam@89
|
5330 fi
|
cannam@89
|
5331 fi # link shared/static library?
|
cannam@89
|
5332
|
cannam@89
|
5333 if test "$linkmode" = lib; then
|
cannam@89
|
5334 if test -n "$dependency_libs" &&
|
cannam@89
|
5335 { test "$hardcode_into_libs" != yes ||
|
cannam@89
|
5336 test "$build_old_libs" = yes ||
|
cannam@89
|
5337 test "$link_static" = yes; }; then
|
cannam@89
|
5338 # Extract -R from dependency_libs
|
cannam@89
|
5339 temp_deplibs=
|
cannam@89
|
5340 for libdir in $dependency_libs; do
|
cannam@89
|
5341 case $libdir in
|
cannam@89
|
5342 -R*) func_stripname '-R' '' "$libdir"
|
cannam@89
|
5343 temp_xrpath=$func_stripname_result
|
cannam@89
|
5344 case " $xrpath " in
|
cannam@89
|
5345 *" $temp_xrpath "*) ;;
|
cannam@89
|
5346 *) xrpath="$xrpath $temp_xrpath";;
|
cannam@89
|
5347 esac;;
|
cannam@89
|
5348 *) temp_deplibs="$temp_deplibs $libdir";;
|
cannam@89
|
5349 esac
|
cannam@89
|
5350 done
|
cannam@89
|
5351 dependency_libs="$temp_deplibs"
|
cannam@89
|
5352 fi
|
cannam@89
|
5353
|
cannam@89
|
5354 newlib_search_path="$newlib_search_path $absdir"
|
cannam@89
|
5355 # Link against this library
|
cannam@89
|
5356 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
|
cannam@89
|
5357 # ... and its dependency_libs
|
cannam@89
|
5358 tmp_libs=
|
cannam@89
|
5359 for deplib in $dependency_libs; do
|
cannam@89
|
5360 newdependency_libs="$deplib $newdependency_libs"
|
cannam@89
|
5361 if $opt_duplicate_deps ; then
|
cannam@89
|
5362 case "$tmp_libs " in
|
cannam@89
|
5363 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
|
cannam@89
|
5364 esac
|
cannam@89
|
5365 fi
|
cannam@89
|
5366 tmp_libs="$tmp_libs $deplib"
|
cannam@89
|
5367 done
|
cannam@89
|
5368
|
cannam@89
|
5369 if test "$link_all_deplibs" != no; then
|
cannam@89
|
5370 # Add the search paths of all dependency libraries
|
cannam@89
|
5371 for deplib in $dependency_libs; do
|
cannam@89
|
5372 case $deplib in
|
cannam@89
|
5373 -L*) path="$deplib" ;;
|
cannam@89
|
5374 *.la)
|
cannam@89
|
5375 func_dirname "$deplib" "" "."
|
cannam@89
|
5376 dir="$func_dirname_result"
|
cannam@89
|
5377 # We need an absolute path.
|
cannam@89
|
5378 case $dir in
|
cannam@89
|
5379 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
|
cannam@89
|
5380 *)
|
cannam@89
|
5381 absdir=`cd "$dir" && pwd`
|
cannam@89
|
5382 if test -z "$absdir"; then
|
cannam@89
|
5383 func_warning "cannot determine absolute directory name of \`$dir'"
|
cannam@89
|
5384 absdir="$dir"
|
cannam@89
|
5385 fi
|
cannam@89
|
5386 ;;
|
cannam@89
|
5387 esac
|
cannam@89
|
5388 if $GREP "^installed=no" $deplib > /dev/null; then
|
cannam@89
|
5389 case $host in
|
cannam@89
|
5390 *-*-darwin*)
|
cannam@89
|
5391 depdepl=
|
cannam@89
|
5392 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
|
cannam@89
|
5393 if test -n "$deplibrary_names" ; then
|
cannam@89
|
5394 for tmp in $deplibrary_names ; do
|
cannam@89
|
5395 depdepl=$tmp
|
cannam@89
|
5396 done
|
cannam@89
|
5397 if test -f "$absdir/$objdir/$depdepl" ; then
|
cannam@89
|
5398 depdepl="$absdir/$objdir/$depdepl"
|
cannam@89
|
5399 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
|
cannam@89
|
5400 if test -z "$darwin_install_name"; then
|
cannam@89
|
5401 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
|
cannam@89
|
5402 fi
|
cannam@89
|
5403 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
|
cannam@89
|
5404 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
|
cannam@89
|
5405 path=
|
cannam@89
|
5406 fi
|
cannam@89
|
5407 fi
|
cannam@89
|
5408 ;;
|
cannam@89
|
5409 *)
|
cannam@89
|
5410 path="-L$absdir/$objdir"
|
cannam@89
|
5411 ;;
|
cannam@89
|
5412 esac
|
cannam@89
|
5413 else
|
cannam@89
|
5414 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
|
cannam@89
|
5415 test -z "$libdir" && \
|
cannam@89
|
5416 func_fatal_error "\`$deplib' is not a valid libtool archive"
|
cannam@89
|
5417 test "$absdir" != "$libdir" && \
|
cannam@89
|
5418 func_warning "\`$deplib' seems to be moved"
|
cannam@89
|
5419
|
cannam@89
|
5420 path="-L$absdir"
|
cannam@89
|
5421 fi
|
cannam@89
|
5422 ;;
|
cannam@89
|
5423 esac
|
cannam@89
|
5424 case " $deplibs " in
|
cannam@89
|
5425 *" $path "*) ;;
|
cannam@89
|
5426 *) deplibs="$path $deplibs" ;;
|
cannam@89
|
5427 esac
|
cannam@89
|
5428 done
|
cannam@89
|
5429 fi # link_all_deplibs != no
|
cannam@89
|
5430 fi # linkmode = lib
|
cannam@89
|
5431 done # for deplib in $libs
|
cannam@89
|
5432 if test "$pass" = link; then
|
cannam@89
|
5433 if test "$linkmode" = "prog"; then
|
cannam@89
|
5434 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
|
cannam@89
|
5435 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
|
cannam@89
|
5436 else
|
cannam@89
|
5437 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
cannam@89
|
5438 fi
|
cannam@89
|
5439 fi
|
cannam@89
|
5440 dependency_libs="$newdependency_libs"
|
cannam@89
|
5441 if test "$pass" = dlpreopen; then
|
cannam@89
|
5442 # Link the dlpreopened libraries before other libraries
|
cannam@89
|
5443 for deplib in $save_deplibs; do
|
cannam@89
|
5444 deplibs="$deplib $deplibs"
|
cannam@89
|
5445 done
|
cannam@89
|
5446 fi
|
cannam@89
|
5447 if test "$pass" != dlopen; then
|
cannam@89
|
5448 if test "$pass" != conv; then
|
cannam@89
|
5449 # Make sure lib_search_path contains only unique directories.
|
cannam@89
|
5450 lib_search_path=
|
cannam@89
|
5451 for dir in $newlib_search_path; do
|
cannam@89
|
5452 case "$lib_search_path " in
|
cannam@89
|
5453 *" $dir "*) ;;
|
cannam@89
|
5454 *) lib_search_path="$lib_search_path $dir" ;;
|
cannam@89
|
5455 esac
|
cannam@89
|
5456 done
|
cannam@89
|
5457 newlib_search_path=
|
cannam@89
|
5458 fi
|
cannam@89
|
5459
|
cannam@89
|
5460 if test "$linkmode,$pass" != "prog,link"; then
|
cannam@89
|
5461 vars="deplibs"
|
cannam@89
|
5462 else
|
cannam@89
|
5463 vars="compile_deplibs finalize_deplibs"
|
cannam@89
|
5464 fi
|
cannam@89
|
5465 for var in $vars dependency_libs; do
|
cannam@89
|
5466 # Add libraries to $var in reverse order
|
cannam@89
|
5467 eval tmp_libs=\"\$$var\"
|
cannam@89
|
5468 new_libs=
|
cannam@89
|
5469 for deplib in $tmp_libs; do
|
cannam@89
|
5470 # FIXME: Pedantically, this is the right thing to do, so
|
cannam@89
|
5471 # that some nasty dependency loop isn't accidentally
|
cannam@89
|
5472 # broken:
|
cannam@89
|
5473 #new_libs="$deplib $new_libs"
|
cannam@89
|
5474 # Pragmatically, this seems to cause very few problems in
|
cannam@89
|
5475 # practice:
|
cannam@89
|
5476 case $deplib in
|
cannam@89
|
5477 -L*) new_libs="$deplib $new_libs" ;;
|
cannam@89
|
5478 -R*) ;;
|
cannam@89
|
5479 *)
|
cannam@89
|
5480 # And here is the reason: when a library appears more
|
cannam@89
|
5481 # than once as an explicit dependence of a library, or
|
cannam@89
|
5482 # is implicitly linked in more than once by the
|
cannam@89
|
5483 # compiler, it is considered special, and multiple
|
cannam@89
|
5484 # occurrences thereof are not removed. Compare this
|
cannam@89
|
5485 # with having the same library being listed as a
|
cannam@89
|
5486 # dependency of multiple other libraries: in this case,
|
cannam@89
|
5487 # we know (pedantically, we assume) the library does not
|
cannam@89
|
5488 # need to be listed more than once, so we keep only the
|
cannam@89
|
5489 # last copy. This is not always right, but it is rare
|
cannam@89
|
5490 # enough that we require users that really mean to play
|
cannam@89
|
5491 # such unportable linking tricks to link the library
|
cannam@89
|
5492 # using -Wl,-lname, so that libtool does not consider it
|
cannam@89
|
5493 # for duplicate removal.
|
cannam@89
|
5494 case " $specialdeplibs " in
|
cannam@89
|
5495 *" $deplib "*) new_libs="$deplib $new_libs" ;;
|
cannam@89
|
5496 *)
|
cannam@89
|
5497 case " $new_libs " in
|
cannam@89
|
5498 *" $deplib "*) ;;
|
cannam@89
|
5499 *) new_libs="$deplib $new_libs" ;;
|
cannam@89
|
5500 esac
|
cannam@89
|
5501 ;;
|
cannam@89
|
5502 esac
|
cannam@89
|
5503 ;;
|
cannam@89
|
5504 esac
|
cannam@89
|
5505 done
|
cannam@89
|
5506 tmp_libs=
|
cannam@89
|
5507 for deplib in $new_libs; do
|
cannam@89
|
5508 case $deplib in
|
cannam@89
|
5509 -L*)
|
cannam@89
|
5510 case " $tmp_libs " in
|
cannam@89
|
5511 *" $deplib "*) ;;
|
cannam@89
|
5512 *) tmp_libs="$tmp_libs $deplib" ;;
|
cannam@89
|
5513 esac
|
cannam@89
|
5514 ;;
|
cannam@89
|
5515 *) tmp_libs="$tmp_libs $deplib" ;;
|
cannam@89
|
5516 esac
|
cannam@89
|
5517 done
|
cannam@89
|
5518 eval $var=\"$tmp_libs\"
|
cannam@89
|
5519 done # for var
|
cannam@89
|
5520 fi
|
cannam@89
|
5521 # Last step: remove runtime libs from dependency_libs
|
cannam@89
|
5522 # (they stay in deplibs)
|
cannam@89
|
5523 tmp_libs=
|
cannam@89
|
5524 for i in $dependency_libs ; do
|
cannam@89
|
5525 case " $predeps $postdeps $compiler_lib_search_path " in
|
cannam@89
|
5526 *" $i "*)
|
cannam@89
|
5527 i=""
|
cannam@89
|
5528 ;;
|
cannam@89
|
5529 esac
|
cannam@89
|
5530 if test -n "$i" ; then
|
cannam@89
|
5531 tmp_libs="$tmp_libs $i"
|
cannam@89
|
5532 fi
|
cannam@89
|
5533 done
|
cannam@89
|
5534 dependency_libs=$tmp_libs
|
cannam@89
|
5535 done # for pass
|
cannam@89
|
5536 if test "$linkmode" = prog; then
|
cannam@89
|
5537 dlfiles="$newdlfiles"
|
cannam@89
|
5538 fi
|
cannam@89
|
5539 if test "$linkmode" = prog || test "$linkmode" = lib; then
|
cannam@89
|
5540 dlprefiles="$newdlprefiles"
|
cannam@89
|
5541 fi
|
cannam@89
|
5542
|
cannam@89
|
5543 case $linkmode in
|
cannam@89
|
5544 oldlib)
|
cannam@89
|
5545 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
|
cannam@89
|
5546 func_warning "\`-dlopen' is ignored for archives"
|
cannam@89
|
5547 fi
|
cannam@89
|
5548
|
cannam@89
|
5549 case " $deplibs" in
|
cannam@89
|
5550 *\ -l* | *\ -L*)
|
cannam@89
|
5551 func_warning "\`-l' and \`-L' are ignored for archives" ;;
|
cannam@89
|
5552 esac
|
cannam@89
|
5553
|
cannam@89
|
5554 test -n "$rpath" && \
|
cannam@89
|
5555 func_warning "\`-rpath' is ignored for archives"
|
cannam@89
|
5556
|
cannam@89
|
5557 test -n "$xrpath" && \
|
cannam@89
|
5558 func_warning "\`-R' is ignored for archives"
|
cannam@89
|
5559
|
cannam@89
|
5560 test -n "$vinfo" && \
|
cannam@89
|
5561 func_warning "\`-version-info/-version-number' is ignored for archives"
|
cannam@89
|
5562
|
cannam@89
|
5563 test -n "$release" && \
|
cannam@89
|
5564 func_warning "\`-release' is ignored for archives"
|
cannam@89
|
5565
|
cannam@89
|
5566 test -n "$export_symbols$export_symbols_regex" && \
|
cannam@89
|
5567 func_warning "\`-export-symbols' is ignored for archives"
|
cannam@89
|
5568
|
cannam@89
|
5569 # Now set the variables for building old libraries.
|
cannam@89
|
5570 build_libtool_libs=no
|
cannam@89
|
5571 oldlibs="$output"
|
cannam@89
|
5572 objs="$objs$old_deplibs"
|
cannam@89
|
5573 ;;
|
cannam@89
|
5574
|
cannam@89
|
5575 lib)
|
cannam@89
|
5576 # Make sure we only generate libraries of the form `libNAME.la'.
|
cannam@89
|
5577 case $outputname in
|
cannam@89
|
5578 lib*)
|
cannam@89
|
5579 func_stripname 'lib' '.la' "$outputname"
|
cannam@89
|
5580 name=$func_stripname_result
|
cannam@89
|
5581 eval shared_ext=\"$shrext_cmds\"
|
cannam@89
|
5582 eval libname=\"$libname_spec\"
|
cannam@89
|
5583 ;;
|
cannam@89
|
5584 *)
|
cannam@89
|
5585 test "$module" = no && \
|
cannam@89
|
5586 func_fatal_help "libtool library \`$output' must begin with \`lib'"
|
cannam@89
|
5587
|
cannam@89
|
5588 if test "$need_lib_prefix" != no; then
|
cannam@89
|
5589 # Add the "lib" prefix for modules if required
|
cannam@89
|
5590 func_stripname '' '.la' "$outputname"
|
cannam@89
|
5591 name=$func_stripname_result
|
cannam@89
|
5592 eval shared_ext=\"$shrext_cmds\"
|
cannam@89
|
5593 eval libname=\"$libname_spec\"
|
cannam@89
|
5594 else
|
cannam@89
|
5595 func_stripname '' '.la' "$outputname"
|
cannam@89
|
5596 libname=$func_stripname_result
|
cannam@89
|
5597 fi
|
cannam@89
|
5598 ;;
|
cannam@89
|
5599 esac
|
cannam@89
|
5600
|
cannam@89
|
5601 if test -n "$objs"; then
|
cannam@89
|
5602 if test "$deplibs_check_method" != pass_all; then
|
cannam@89
|
5603 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
|
cannam@89
|
5604 else
|
cannam@89
|
5605 $ECHO
|
cannam@89
|
5606 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
|
cannam@89
|
5607 $ECHO "*** objects $objs is not portable!"
|
cannam@89
|
5608 libobjs="$libobjs $objs"
|
cannam@89
|
5609 fi
|
cannam@89
|
5610 fi
|
cannam@89
|
5611
|
cannam@89
|
5612 test "$dlself" != no && \
|
cannam@89
|
5613 func_warning "\`-dlopen self' is ignored for libtool libraries"
|
cannam@89
|
5614
|
cannam@89
|
5615 set dummy $rpath
|
cannam@89
|
5616 shift
|
cannam@89
|
5617 test "$#" -gt 1 && \
|
cannam@89
|
5618 func_warning "ignoring multiple \`-rpath's for a libtool library"
|
cannam@89
|
5619
|
cannam@89
|
5620 install_libdir="$1"
|
cannam@89
|
5621
|
cannam@89
|
5622 oldlibs=
|
cannam@89
|
5623 if test -z "$rpath"; then
|
cannam@89
|
5624 if test "$build_libtool_libs" = yes; then
|
cannam@89
|
5625 # Building a libtool convenience library.
|
cannam@89
|
5626 # Some compilers have problems with a `.al' extension so
|
cannam@89
|
5627 # convenience libraries should have the same extension an
|
cannam@89
|
5628 # archive normally would.
|
cannam@89
|
5629 oldlibs="$output_objdir/$libname.$libext $oldlibs"
|
cannam@89
|
5630 build_libtool_libs=convenience
|
cannam@89
|
5631 build_old_libs=yes
|
cannam@89
|
5632 fi
|
cannam@89
|
5633
|
cannam@89
|
5634 test -n "$vinfo" && \
|
cannam@89
|
5635 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
|
cannam@89
|
5636
|
cannam@89
|
5637 test -n "$release" && \
|
cannam@89
|
5638 func_warning "\`-release' is ignored for convenience libraries"
|
cannam@89
|
5639 else
|
cannam@89
|
5640
|
cannam@89
|
5641 # Parse the version information argument.
|
cannam@89
|
5642 save_ifs="$IFS"; IFS=':'
|
cannam@89
|
5643 set dummy $vinfo 0 0 0
|
cannam@89
|
5644 shift
|
cannam@89
|
5645 IFS="$save_ifs"
|
cannam@89
|
5646
|
cannam@89
|
5647 test -n "$7" && \
|
cannam@89
|
5648 func_fatal_help "too many parameters to \`-version-info'"
|
cannam@89
|
5649
|
cannam@89
|
5650 # convert absolute version numbers to libtool ages
|
cannam@89
|
5651 # this retains compatibility with .la files and attempts
|
cannam@89
|
5652 # to make the code below a bit more comprehensible
|
cannam@89
|
5653
|
cannam@89
|
5654 case $vinfo_number in
|
cannam@89
|
5655 yes)
|
cannam@89
|
5656 number_major="$1"
|
cannam@89
|
5657 number_minor="$2"
|
cannam@89
|
5658 number_revision="$3"
|
cannam@89
|
5659 #
|
cannam@89
|
5660 # There are really only two kinds -- those that
|
cannam@89
|
5661 # use the current revision as the major version
|
cannam@89
|
5662 # and those that subtract age and use age as
|
cannam@89
|
5663 # a minor version. But, then there is irix
|
cannam@89
|
5664 # which has an extra 1 added just for fun
|
cannam@89
|
5665 #
|
cannam@89
|
5666 case $version_type in
|
cannam@89
|
5667 darwin|linux|osf|windows|none)
|
cannam@89
|
5668 func_arith $number_major + $number_minor
|
cannam@89
|
5669 current=$func_arith_result
|
cannam@89
|
5670 age="$number_minor"
|
cannam@89
|
5671 revision="$number_revision"
|
cannam@89
|
5672 ;;
|
cannam@89
|
5673 freebsd-aout|freebsd-elf|sunos)
|
cannam@89
|
5674 current="$number_major"
|
cannam@89
|
5675 revision="$number_minor"
|
cannam@89
|
5676 age="0"
|
cannam@89
|
5677 ;;
|
cannam@89
|
5678 irix|nonstopux)
|
cannam@89
|
5679 func_arith $number_major + $number_minor
|
cannam@89
|
5680 current=$func_arith_result
|
cannam@89
|
5681 age="$number_minor"
|
cannam@89
|
5682 revision="$number_minor"
|
cannam@89
|
5683 lt_irix_increment=no
|
cannam@89
|
5684 ;;
|
cannam@89
|
5685 *)
|
cannam@89
|
5686 func_fatal_configuration "$modename: unknown library version type \`$version_type'"
|
cannam@89
|
5687 ;;
|
cannam@89
|
5688 esac
|
cannam@89
|
5689 ;;
|
cannam@89
|
5690 no)
|
cannam@89
|
5691 current="$1"
|
cannam@89
|
5692 revision="$2"
|
cannam@89
|
5693 age="$3"
|
cannam@89
|
5694 ;;
|
cannam@89
|
5695 esac
|
cannam@89
|
5696
|
cannam@89
|
5697 # Check that each of the things are valid numbers.
|
cannam@89
|
5698 case $current in
|
cannam@89
|
5699 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]) ;;
|
cannam@89
|
5700 *)
|
cannam@89
|
5701 func_error "CURRENT \`$current' must be a nonnegative integer"
|
cannam@89
|
5702 func_fatal_error "\`$vinfo' is not valid version information"
|
cannam@89
|
5703 ;;
|
cannam@89
|
5704 esac
|
cannam@89
|
5705
|
cannam@89
|
5706 case $revision in
|
cannam@89
|
5707 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]) ;;
|
cannam@89
|
5708 *)
|
cannam@89
|
5709 func_error "REVISION \`$revision' must be a nonnegative integer"
|
cannam@89
|
5710 func_fatal_error "\`$vinfo' is not valid version information"
|
cannam@89
|
5711 ;;
|
cannam@89
|
5712 esac
|
cannam@89
|
5713
|
cannam@89
|
5714 case $age in
|
cannam@89
|
5715 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]) ;;
|
cannam@89
|
5716 *)
|
cannam@89
|
5717 func_error "AGE \`$age' must be a nonnegative integer"
|
cannam@89
|
5718 func_fatal_error "\`$vinfo' is not valid version information"
|
cannam@89
|
5719 ;;
|
cannam@89
|
5720 esac
|
cannam@89
|
5721
|
cannam@89
|
5722 if test "$age" -gt "$current"; then
|
cannam@89
|
5723 func_error "AGE \`$age' is greater than the current interface number \`$current'"
|
cannam@89
|
5724 func_fatal_error "\`$vinfo' is not valid version information"
|
cannam@89
|
5725 fi
|
cannam@89
|
5726
|
cannam@89
|
5727 # Calculate the version variables.
|
cannam@89
|
5728 major=
|
cannam@89
|
5729 versuffix=
|
cannam@89
|
5730 verstring=
|
cannam@89
|
5731 case $version_type in
|
cannam@89
|
5732 none) ;;
|
cannam@89
|
5733
|
cannam@89
|
5734 darwin)
|
cannam@89
|
5735 # Like Linux, but with the current version available in
|
cannam@89
|
5736 # verstring for coding it into the library header
|
cannam@89
|
5737 func_arith $current - $age
|
cannam@89
|
5738 major=.$func_arith_result
|
cannam@89
|
5739 versuffix="$major.$age.$revision"
|
cannam@89
|
5740 # Darwin ld doesn't like 0 for these options...
|
cannam@89
|
5741 func_arith $current + 1
|
cannam@89
|
5742 minor_current=$func_arith_result
|
cannam@89
|
5743 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
|
cannam@89
|
5744 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
|
cannam@89
|
5745 ;;
|
cannam@89
|
5746
|
cannam@89
|
5747 freebsd-aout)
|
cannam@89
|
5748 major=".$current"
|
cannam@89
|
5749 versuffix=".$current.$revision";
|
cannam@89
|
5750 ;;
|
cannam@89
|
5751
|
cannam@89
|
5752 freebsd-elf)
|
cannam@89
|
5753 major=".$current"
|
cannam@89
|
5754 versuffix=".$current"
|
cannam@89
|
5755 ;;
|
cannam@89
|
5756
|
cannam@89
|
5757 irix | nonstopux)
|
cannam@89
|
5758 if test "X$lt_irix_increment" = "Xno"; then
|
cannam@89
|
5759 func_arith $current - $age
|
cannam@89
|
5760 else
|
cannam@89
|
5761 func_arith $current - $age + 1
|
cannam@89
|
5762 fi
|
cannam@89
|
5763 major=$func_arith_result
|
cannam@89
|
5764
|
cannam@89
|
5765 case $version_type in
|
cannam@89
|
5766 nonstopux) verstring_prefix=nonstopux ;;
|
cannam@89
|
5767 *) verstring_prefix=sgi ;;
|
cannam@89
|
5768 esac
|
cannam@89
|
5769 verstring="$verstring_prefix$major.$revision"
|
cannam@89
|
5770
|
cannam@89
|
5771 # Add in all the interfaces that we are compatible with.
|
cannam@89
|
5772 loop=$revision
|
cannam@89
|
5773 while test "$loop" -ne 0; do
|
cannam@89
|
5774 func_arith $revision - $loop
|
cannam@89
|
5775 iface=$func_arith_result
|
cannam@89
|
5776 func_arith $loop - 1
|
cannam@89
|
5777 loop=$func_arith_result
|
cannam@89
|
5778 verstring="$verstring_prefix$major.$iface:$verstring"
|
cannam@89
|
5779 done
|
cannam@89
|
5780
|
cannam@89
|
5781 # Before this point, $major must not contain `.'.
|
cannam@89
|
5782 major=.$major
|
cannam@89
|
5783 versuffix="$major.$revision"
|
cannam@89
|
5784 ;;
|
cannam@89
|
5785
|
cannam@89
|
5786 linux)
|
cannam@89
|
5787 func_arith $current - $age
|
cannam@89
|
5788 major=.$func_arith_result
|
cannam@89
|
5789 versuffix="$major.$age.$revision"
|
cannam@89
|
5790 ;;
|
cannam@89
|
5791
|
cannam@89
|
5792 osf)
|
cannam@89
|
5793 func_arith $current - $age
|
cannam@89
|
5794 major=.$func_arith_result
|
cannam@89
|
5795 versuffix=".$current.$age.$revision"
|
cannam@89
|
5796 verstring="$current.$age.$revision"
|
cannam@89
|
5797
|
cannam@89
|
5798 # Add in all the interfaces that we are compatible with.
|
cannam@89
|
5799 loop=$age
|
cannam@89
|
5800 while test "$loop" -ne 0; do
|
cannam@89
|
5801 func_arith $current - $loop
|
cannam@89
|
5802 iface=$func_arith_result
|
cannam@89
|
5803 func_arith $loop - 1
|
cannam@89
|
5804 loop=$func_arith_result
|
cannam@89
|
5805 verstring="$verstring:${iface}.0"
|
cannam@89
|
5806 done
|
cannam@89
|
5807
|
cannam@89
|
5808 # Make executables depend on our current version.
|
cannam@89
|
5809 verstring="$verstring:${current}.0"
|
cannam@89
|
5810 ;;
|
cannam@89
|
5811
|
cannam@89
|
5812 qnx)
|
cannam@89
|
5813 major=".$current"
|
cannam@89
|
5814 versuffix=".$current"
|
cannam@89
|
5815 ;;
|
cannam@89
|
5816
|
cannam@89
|
5817 sunos)
|
cannam@89
|
5818 major=".$current"
|
cannam@89
|
5819 versuffix=".$current.$revision"
|
cannam@89
|
5820 ;;
|
cannam@89
|
5821
|
cannam@89
|
5822 windows)
|
cannam@89
|
5823 # Use '-' rather than '.', since we only want one
|
cannam@89
|
5824 # extension on DOS 8.3 filesystems.
|
cannam@89
|
5825 func_arith $current - $age
|
cannam@89
|
5826 major=$func_arith_result
|
cannam@89
|
5827 versuffix="-$major"
|
cannam@89
|
5828 ;;
|
cannam@89
|
5829
|
cannam@89
|
5830 *)
|
cannam@89
|
5831 func_fatal_configuration "unknown library version type \`$version_type'"
|
cannam@89
|
5832 ;;
|
cannam@89
|
5833 esac
|
cannam@89
|
5834
|
cannam@89
|
5835 # Clear the version info if we defaulted, and they specified a release.
|
cannam@89
|
5836 if test -z "$vinfo" && test -n "$release"; then
|
cannam@89
|
5837 major=
|
cannam@89
|
5838 case $version_type in
|
cannam@89
|
5839 darwin)
|
cannam@89
|
5840 # we can't check for "0.0" in archive_cmds due to quoting
|
cannam@89
|
5841 # problems, so we reset it completely
|
cannam@89
|
5842 verstring=
|
cannam@89
|
5843 ;;
|
cannam@89
|
5844 *)
|
cannam@89
|
5845 verstring="0.0"
|
cannam@89
|
5846 ;;
|
cannam@89
|
5847 esac
|
cannam@89
|
5848 if test "$need_version" = no; then
|
cannam@89
|
5849 versuffix=
|
cannam@89
|
5850 else
|
cannam@89
|
5851 versuffix=".0.0"
|
cannam@89
|
5852 fi
|
cannam@89
|
5853 fi
|
cannam@89
|
5854
|
cannam@89
|
5855 # Remove version info from name if versioning should be avoided
|
cannam@89
|
5856 if test "$avoid_version" = yes && test "$need_version" = no; then
|
cannam@89
|
5857 major=
|
cannam@89
|
5858 versuffix=
|
cannam@89
|
5859 verstring=""
|
cannam@89
|
5860 fi
|
cannam@89
|
5861
|
cannam@89
|
5862 # Check to see if the archive will have undefined symbols.
|
cannam@89
|
5863 if test "$allow_undefined" = yes; then
|
cannam@89
|
5864 if test "$allow_undefined_flag" = unsupported; then
|
cannam@89
|
5865 func_warning "undefined symbols not allowed in $host shared libraries"
|
cannam@89
|
5866 build_libtool_libs=no
|
cannam@89
|
5867 build_old_libs=yes
|
cannam@89
|
5868 fi
|
cannam@89
|
5869 else
|
cannam@89
|
5870 # Don't allow undefined symbols.
|
cannam@89
|
5871 allow_undefined_flag="$no_undefined_flag"
|
cannam@89
|
5872 fi
|
cannam@89
|
5873
|
cannam@89
|
5874 fi
|
cannam@89
|
5875
|
cannam@89
|
5876 func_generate_dlsyms "$libname" "$libname" "yes"
|
cannam@89
|
5877 libobjs="$libobjs $symfileobj"
|
cannam@89
|
5878 test "X$libobjs" = "X " && libobjs=
|
cannam@89
|
5879
|
cannam@89
|
5880 if test "$mode" != relink; then
|
cannam@89
|
5881 # Remove our outputs, but don't remove object files since they
|
cannam@89
|
5882 # may have been created when compiling PIC objects.
|
cannam@89
|
5883 removelist=
|
cannam@89
|
5884 tempremovelist=`$ECHO "$output_objdir/*"`
|
cannam@89
|
5885 for p in $tempremovelist; do
|
cannam@89
|
5886 case $p in
|
cannam@89
|
5887 *.$objext)
|
cannam@89
|
5888 ;;
|
cannam@89
|
5889 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
|
cannam@89
|
5890 if test "X$precious_files_regex" != "X"; then
|
cannam@89
|
5891 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
|
cannam@89
|
5892 then
|
cannam@89
|
5893 continue
|
cannam@89
|
5894 fi
|
cannam@89
|
5895 fi
|
cannam@89
|
5896 removelist="$removelist $p"
|
cannam@89
|
5897 ;;
|
cannam@89
|
5898 *) ;;
|
cannam@89
|
5899 esac
|
cannam@89
|
5900 done
|
cannam@89
|
5901 test -n "$removelist" && \
|
cannam@89
|
5902 func_show_eval "${RM}r \$removelist"
|
cannam@89
|
5903 fi
|
cannam@89
|
5904
|
cannam@89
|
5905 # Now set the variables for building old libraries.
|
cannam@89
|
5906 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
|
cannam@89
|
5907 oldlibs="$oldlibs $output_objdir/$libname.$libext"
|
cannam@89
|
5908
|
cannam@89
|
5909 # Transform .lo files to .o files.
|
cannam@89
|
5910 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
|
cannam@89
|
5911 fi
|
cannam@89
|
5912
|
cannam@89
|
5913 # Eliminate all temporary directories.
|
cannam@89
|
5914 #for path in $notinst_path; do
|
cannam@89
|
5915 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
|
cannam@89
|
5916 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
|
cannam@89
|
5917 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
|
cannam@89
|
5918 #done
|
cannam@89
|
5919
|
cannam@89
|
5920 if test -n "$xrpath"; then
|
cannam@89
|
5921 # If the user specified any rpath flags, then add them.
|
cannam@89
|
5922 temp_xrpath=
|
cannam@89
|
5923 for libdir in $xrpath; do
|
cannam@89
|
5924 temp_xrpath="$temp_xrpath -R$libdir"
|
cannam@89
|
5925 case "$finalize_rpath " in
|
cannam@89
|
5926 *" $libdir "*) ;;
|
cannam@89
|
5927 *) finalize_rpath="$finalize_rpath $libdir" ;;
|
cannam@89
|
5928 esac
|
cannam@89
|
5929 done
|
cannam@89
|
5930 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
|
cannam@89
|
5931 dependency_libs="$temp_xrpath $dependency_libs"
|
cannam@89
|
5932 fi
|
cannam@89
|
5933 fi
|
cannam@89
|
5934
|
cannam@89
|
5935 # Make sure dlfiles contains only unique files that won't be dlpreopened
|
cannam@89
|
5936 old_dlfiles="$dlfiles"
|
cannam@89
|
5937 dlfiles=
|
cannam@89
|
5938 for lib in $old_dlfiles; do
|
cannam@89
|
5939 case " $dlprefiles $dlfiles " in
|
cannam@89
|
5940 *" $lib "*) ;;
|
cannam@89
|
5941 *) dlfiles="$dlfiles $lib" ;;
|
cannam@89
|
5942 esac
|
cannam@89
|
5943 done
|
cannam@89
|
5944
|
cannam@89
|
5945 # Make sure dlprefiles contains only unique files
|
cannam@89
|
5946 old_dlprefiles="$dlprefiles"
|
cannam@89
|
5947 dlprefiles=
|
cannam@89
|
5948 for lib in $old_dlprefiles; do
|
cannam@89
|
5949 case "$dlprefiles " in
|
cannam@89
|
5950 *" $lib "*) ;;
|
cannam@89
|
5951 *) dlprefiles="$dlprefiles $lib" ;;
|
cannam@89
|
5952 esac
|
cannam@89
|
5953 done
|
cannam@89
|
5954
|
cannam@89
|
5955 if test "$build_libtool_libs" = yes; then
|
cannam@89
|
5956 if test -n "$rpath"; then
|
cannam@89
|
5957 case $host in
|
cannam@89
|
5958 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
|
cannam@89
|
5959 # these systems don't actually have a c library (as such)!
|
cannam@89
|
5960 ;;
|
cannam@89
|
5961 *-*-rhapsody* | *-*-darwin1.[012])
|
cannam@89
|
5962 # Rhapsody C library is in the System framework
|
cannam@89
|
5963 deplibs="$deplibs System.ltframework"
|
cannam@89
|
5964 ;;
|
cannam@89
|
5965 *-*-netbsd*)
|
cannam@89
|
5966 # Don't link with libc until the a.out ld.so is fixed.
|
cannam@89
|
5967 ;;
|
cannam@89
|
5968 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
|
cannam@89
|
5969 # Do not include libc due to us having libc/libc_r.
|
cannam@89
|
5970 ;;
|
cannam@89
|
5971 *-*-sco3.2v5* | *-*-sco5v6*)
|
cannam@89
|
5972 # Causes problems with __ctype
|
cannam@89
|
5973 ;;
|
cannam@89
|
5974 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
|
cannam@89
|
5975 # Compiler inserts libc in the correct place for threads to work
|
cannam@89
|
5976 ;;
|
cannam@89
|
5977 *)
|
cannam@89
|
5978 # Add libc to deplibs on all other systems if necessary.
|
cannam@89
|
5979 if test "$build_libtool_need_lc" = "yes"; then
|
cannam@89
|
5980 deplibs="$deplibs -lc"
|
cannam@89
|
5981 fi
|
cannam@89
|
5982 ;;
|
cannam@89
|
5983 esac
|
cannam@89
|
5984 fi
|
cannam@89
|
5985
|
cannam@89
|
5986 # Transform deplibs into only deplibs that can be linked in shared.
|
cannam@89
|
5987 name_save=$name
|
cannam@89
|
5988 libname_save=$libname
|
cannam@89
|
5989 release_save=$release
|
cannam@89
|
5990 versuffix_save=$versuffix
|
cannam@89
|
5991 major_save=$major
|
cannam@89
|
5992 # I'm not sure if I'm treating the release correctly. I think
|
cannam@89
|
5993 # release should show up in the -l (ie -lgmp5) so we don't want to
|
cannam@89
|
5994 # add it in twice. Is that correct?
|
cannam@89
|
5995 release=""
|
cannam@89
|
5996 versuffix=""
|
cannam@89
|
5997 major=""
|
cannam@89
|
5998 newdeplibs=
|
cannam@89
|
5999 droppeddeps=no
|
cannam@89
|
6000 case $deplibs_check_method in
|
cannam@89
|
6001 pass_all)
|
cannam@89
|
6002 # Don't check for shared/static. Everything works.
|
cannam@89
|
6003 # This might be a little naive. We might want to check
|
cannam@89
|
6004 # whether the library exists or not. But this is on
|
cannam@89
|
6005 # osf3 & osf4 and I'm not really sure... Just
|
cannam@89
|
6006 # implementing what was already the behavior.
|
cannam@89
|
6007 newdeplibs=$deplibs
|
cannam@89
|
6008 ;;
|
cannam@89
|
6009 test_compile)
|
cannam@89
|
6010 # This code stresses the "libraries are programs" paradigm to its
|
cannam@89
|
6011 # limits. Maybe even breaks it. We compile a program, linking it
|
cannam@89
|
6012 # against the deplibs as a proxy for the library. Then we can check
|
cannam@89
|
6013 # whether they linked in statically or dynamically with ldd.
|
cannam@89
|
6014 $opt_dry_run || $RM conftest.c
|
cannam@89
|
6015 cat > conftest.c <<EOF
|
cannam@89
|
6016 int main() { return 0; }
|
cannam@89
|
6017 EOF
|
cannam@89
|
6018 $opt_dry_run || $RM conftest
|
cannam@89
|
6019 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
|
cannam@89
|
6020 ldd_output=`ldd conftest`
|
cannam@89
|
6021 for i in $deplibs; do
|
cannam@89
|
6022 case $i in
|
cannam@89
|
6023 -l*)
|
cannam@89
|
6024 func_stripname -l '' "$i"
|
cannam@89
|
6025 name=$func_stripname_result
|
cannam@89
|
6026 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
cannam@89
|
6027 case " $predeps $postdeps " in
|
cannam@89
|
6028 *" $i "*)
|
cannam@89
|
6029 newdeplibs="$newdeplibs $i"
|
cannam@89
|
6030 i=""
|
cannam@89
|
6031 ;;
|
cannam@89
|
6032 esac
|
cannam@89
|
6033 fi
|
cannam@89
|
6034 if test -n "$i" ; then
|
cannam@89
|
6035 libname=`eval "\\$ECHO \"$libname_spec\""`
|
cannam@89
|
6036 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
|
cannam@89
|
6037 set dummy $deplib_matches; shift
|
cannam@89
|
6038 deplib_match=$1
|
cannam@89
|
6039 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
|
cannam@89
|
6040 newdeplibs="$newdeplibs $i"
|
cannam@89
|
6041 else
|
cannam@89
|
6042 droppeddeps=yes
|
cannam@89
|
6043 $ECHO
|
cannam@89
|
6044 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
|
cannam@89
|
6045 $ECHO "*** I have the capability to make that library automatically link in when"
|
cannam@89
|
6046 $ECHO "*** you link to this library. But I can only do this if you have a"
|
cannam@89
|
6047 $ECHO "*** shared version of the library, which I believe you do not have"
|
cannam@89
|
6048 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
|
cannam@89
|
6049 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
|
cannam@89
|
6050 fi
|
cannam@89
|
6051 fi
|
cannam@89
|
6052 ;;
|
cannam@89
|
6053 *)
|
cannam@89
|
6054 newdeplibs="$newdeplibs $i"
|
cannam@89
|
6055 ;;
|
cannam@89
|
6056 esac
|
cannam@89
|
6057 done
|
cannam@89
|
6058 else
|
cannam@89
|
6059 # Error occurred in the first compile. Let's try to salvage
|
cannam@89
|
6060 # the situation: Compile a separate program for each library.
|
cannam@89
|
6061 for i in $deplibs; do
|
cannam@89
|
6062 case $i in
|
cannam@89
|
6063 -l*)
|
cannam@89
|
6064 func_stripname -l '' "$i"
|
cannam@89
|
6065 name=$func_stripname_result
|
cannam@89
|
6066 $opt_dry_run || $RM conftest
|
cannam@89
|
6067 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
|
cannam@89
|
6068 ldd_output=`ldd conftest`
|
cannam@89
|
6069 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
cannam@89
|
6070 case " $predeps $postdeps " in
|
cannam@89
|
6071 *" $i "*)
|
cannam@89
|
6072 newdeplibs="$newdeplibs $i"
|
cannam@89
|
6073 i=""
|
cannam@89
|
6074 ;;
|
cannam@89
|
6075 esac
|
cannam@89
|
6076 fi
|
cannam@89
|
6077 if test -n "$i" ; then
|
cannam@89
|
6078 libname=`eval "\\$ECHO \"$libname_spec\""`
|
cannam@89
|
6079 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
|
cannam@89
|
6080 set dummy $deplib_matches; shift
|
cannam@89
|
6081 deplib_match=$1
|
cannam@89
|
6082 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
|
cannam@89
|
6083 newdeplibs="$newdeplibs $i"
|
cannam@89
|
6084 else
|
cannam@89
|
6085 droppeddeps=yes
|
cannam@89
|
6086 $ECHO
|
cannam@89
|
6087 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
|
cannam@89
|
6088 $ECHO "*** I have the capability to make that library automatically link in when"
|
cannam@89
|
6089 $ECHO "*** you link to this library. But I can only do this if you have a"
|
cannam@89
|
6090 $ECHO "*** shared version of the library, which you do not appear to have"
|
cannam@89
|
6091 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
|
cannam@89
|
6092 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
|
cannam@89
|
6093 fi
|
cannam@89
|
6094 fi
|
cannam@89
|
6095 else
|
cannam@89
|
6096 droppeddeps=yes
|
cannam@89
|
6097 $ECHO
|
cannam@89
|
6098 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
|
cannam@89
|
6099 $ECHO "*** make it link in! You will probably need to install it or some"
|
cannam@89
|
6100 $ECHO "*** library that it depends on before this library will be fully"
|
cannam@89
|
6101 $ECHO "*** functional. Installing it before continuing would be even better."
|
cannam@89
|
6102 fi
|
cannam@89
|
6103 ;;
|
cannam@89
|
6104 *)
|
cannam@89
|
6105 newdeplibs="$newdeplibs $i"
|
cannam@89
|
6106 ;;
|
cannam@89
|
6107 esac
|
cannam@89
|
6108 done
|
cannam@89
|
6109 fi
|
cannam@89
|
6110 ;;
|
cannam@89
|
6111 file_magic*)
|
cannam@89
|
6112 set dummy $deplibs_check_method; shift
|
cannam@89
|
6113 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
|
cannam@89
|
6114 for a_deplib in $deplibs; do
|
cannam@89
|
6115 case $a_deplib in
|
cannam@89
|
6116 -l*)
|
cannam@89
|
6117 func_stripname -l '' "$a_deplib"
|
cannam@89
|
6118 name=$func_stripname_result
|
cannam@89
|
6119 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
cannam@89
|
6120 case " $predeps $postdeps " in
|
cannam@89
|
6121 *" $a_deplib "*)
|
cannam@89
|
6122 newdeplibs="$newdeplibs $a_deplib"
|
cannam@89
|
6123 a_deplib=""
|
cannam@89
|
6124 ;;
|
cannam@89
|
6125 esac
|
cannam@89
|
6126 fi
|
cannam@89
|
6127 if test -n "$a_deplib" ; then
|
cannam@89
|
6128 libname=`eval "\\$ECHO \"$libname_spec\""`
|
cannam@89
|
6129 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
|
cannam@89
|
6130 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
|
cannam@89
|
6131 for potent_lib in $potential_libs; do
|
cannam@89
|
6132 # Follow soft links.
|
cannam@89
|
6133 if ls -lLd "$potent_lib" 2>/dev/null |
|
cannam@89
|
6134 $GREP " -> " >/dev/null; then
|
cannam@89
|
6135 continue
|
cannam@89
|
6136 fi
|
cannam@89
|
6137 # The statement above tries to avoid entering an
|
cannam@89
|
6138 # endless loop below, in case of cyclic links.
|
cannam@89
|
6139 # We might still enter an endless loop, since a link
|
cannam@89
|
6140 # loop can be closed while we follow links,
|
cannam@89
|
6141 # but so what?
|
cannam@89
|
6142 potlib="$potent_lib"
|
cannam@89
|
6143 while test -h "$potlib" 2>/dev/null; do
|
cannam@89
|
6144 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
|
cannam@89
|
6145 case $potliblink in
|
cannam@89
|
6146 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
|
cannam@89
|
6147 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
|
cannam@89
|
6148 esac
|
cannam@89
|
6149 done
|
cannam@89
|
6150 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
|
cannam@89
|
6151 $SED -e 10q |
|
cannam@89
|
6152 $EGREP "$file_magic_regex" > /dev/null; then
|
cannam@89
|
6153 newdeplibs="$newdeplibs $a_deplib"
|
cannam@89
|
6154 a_deplib=""
|
cannam@89
|
6155 break 2
|
cannam@89
|
6156 fi
|
cannam@89
|
6157 done
|
cannam@89
|
6158 done
|
cannam@89
|
6159 fi
|
cannam@89
|
6160 if test -n "$a_deplib" ; then
|
cannam@89
|
6161 droppeddeps=yes
|
cannam@89
|
6162 $ECHO
|
cannam@89
|
6163 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
|
cannam@89
|
6164 $ECHO "*** I have the capability to make that library automatically link in when"
|
cannam@89
|
6165 $ECHO "*** you link to this library. But I can only do this if you have a"
|
cannam@89
|
6166 $ECHO "*** shared version of the library, which you do not appear to have"
|
cannam@89
|
6167 $ECHO "*** because I did check the linker path looking for a file starting"
|
cannam@89
|
6168 if test -z "$potlib" ; then
|
cannam@89
|
6169 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
|
cannam@89
|
6170 else
|
cannam@89
|
6171 $ECHO "*** with $libname and none of the candidates passed a file format test"
|
cannam@89
|
6172 $ECHO "*** using a file magic. Last file checked: $potlib"
|
cannam@89
|
6173 fi
|
cannam@89
|
6174 fi
|
cannam@89
|
6175 ;;
|
cannam@89
|
6176 *)
|
cannam@89
|
6177 # Add a -L argument.
|
cannam@89
|
6178 newdeplibs="$newdeplibs $a_deplib"
|
cannam@89
|
6179 ;;
|
cannam@89
|
6180 esac
|
cannam@89
|
6181 done # Gone through all deplibs.
|
cannam@89
|
6182 ;;
|
cannam@89
|
6183 match_pattern*)
|
cannam@89
|
6184 set dummy $deplibs_check_method; shift
|
cannam@89
|
6185 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
|
cannam@89
|
6186 for a_deplib in $deplibs; do
|
cannam@89
|
6187 case $a_deplib in
|
cannam@89
|
6188 -l*)
|
cannam@89
|
6189 func_stripname -l '' "$a_deplib"
|
cannam@89
|
6190 name=$func_stripname_result
|
cannam@89
|
6191 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
cannam@89
|
6192 case " $predeps $postdeps " in
|
cannam@89
|
6193 *" $a_deplib "*)
|
cannam@89
|
6194 newdeplibs="$newdeplibs $a_deplib"
|
cannam@89
|
6195 a_deplib=""
|
cannam@89
|
6196 ;;
|
cannam@89
|
6197 esac
|
cannam@89
|
6198 fi
|
cannam@89
|
6199 if test -n "$a_deplib" ; then
|
cannam@89
|
6200 libname=`eval "\\$ECHO \"$libname_spec\""`
|
cannam@89
|
6201 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
|
cannam@89
|
6202 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
|
cannam@89
|
6203 for potent_lib in $potential_libs; do
|
cannam@89
|
6204 potlib="$potent_lib" # see symlink-check above in file_magic test
|
cannam@89
|
6205 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
|
cannam@89
|
6206 $EGREP "$match_pattern_regex" > /dev/null; then
|
cannam@89
|
6207 newdeplibs="$newdeplibs $a_deplib"
|
cannam@89
|
6208 a_deplib=""
|
cannam@89
|
6209 break 2
|
cannam@89
|
6210 fi
|
cannam@89
|
6211 done
|
cannam@89
|
6212 done
|
cannam@89
|
6213 fi
|
cannam@89
|
6214 if test -n "$a_deplib" ; then
|
cannam@89
|
6215 droppeddeps=yes
|
cannam@89
|
6216 $ECHO
|
cannam@89
|
6217 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
|
cannam@89
|
6218 $ECHO "*** I have the capability to make that library automatically link in when"
|
cannam@89
|
6219 $ECHO "*** you link to this library. But I can only do this if you have a"
|
cannam@89
|
6220 $ECHO "*** shared version of the library, which you do not appear to have"
|
cannam@89
|
6221 $ECHO "*** because I did check the linker path looking for a file starting"
|
cannam@89
|
6222 if test -z "$potlib" ; then
|
cannam@89
|
6223 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
|
cannam@89
|
6224 else
|
cannam@89
|
6225 $ECHO "*** with $libname and none of the candidates passed a file format test"
|
cannam@89
|
6226 $ECHO "*** using a regex pattern. Last file checked: $potlib"
|
cannam@89
|
6227 fi
|
cannam@89
|
6228 fi
|
cannam@89
|
6229 ;;
|
cannam@89
|
6230 *)
|
cannam@89
|
6231 # Add a -L argument.
|
cannam@89
|
6232 newdeplibs="$newdeplibs $a_deplib"
|
cannam@89
|
6233 ;;
|
cannam@89
|
6234 esac
|
cannam@89
|
6235 done # Gone through all deplibs.
|
cannam@89
|
6236 ;;
|
cannam@89
|
6237 none | unknown | *)
|
cannam@89
|
6238 newdeplibs=""
|
cannam@89
|
6239 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
|
cannam@89
|
6240 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
|
cannam@89
|
6241 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
cannam@89
|
6242 for i in $predeps $postdeps ; do
|
cannam@89
|
6243 # can't use Xsed below, because $i might contain '/'
|
cannam@89
|
6244 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
|
cannam@89
|
6245 done
|
cannam@89
|
6246 fi
|
cannam@89
|
6247 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
|
cannam@89
|
6248 $GREP . >/dev/null; then
|
cannam@89
|
6249 $ECHO
|
cannam@89
|
6250 if test "X$deplibs_check_method" = "Xnone"; then
|
cannam@89
|
6251 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
|
cannam@89
|
6252 else
|
cannam@89
|
6253 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
|
cannam@89
|
6254 fi
|
cannam@89
|
6255 $ECHO "*** All declared inter-library dependencies are being dropped."
|
cannam@89
|
6256 droppeddeps=yes
|
cannam@89
|
6257 fi
|
cannam@89
|
6258 ;;
|
cannam@89
|
6259 esac
|
cannam@89
|
6260 versuffix=$versuffix_save
|
cannam@89
|
6261 major=$major_save
|
cannam@89
|
6262 release=$release_save
|
cannam@89
|
6263 libname=$libname_save
|
cannam@89
|
6264 name=$name_save
|
cannam@89
|
6265
|
cannam@89
|
6266 case $host in
|
cannam@89
|
6267 *-*-rhapsody* | *-*-darwin1.[012])
|
cannam@89
|
6268 # On Rhapsody replace the C library with the System framework
|
cannam@89
|
6269 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
|
cannam@89
|
6270 ;;
|
cannam@89
|
6271 esac
|
cannam@89
|
6272
|
cannam@89
|
6273 if test "$droppeddeps" = yes; then
|
cannam@89
|
6274 if test "$module" = yes; then
|
cannam@89
|
6275 $ECHO
|
cannam@89
|
6276 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
|
cannam@89
|
6277 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
|
cannam@89
|
6278 $ECHO "*** a static module, that should work as long as the dlopening"
|
cannam@89
|
6279 $ECHO "*** application is linked with the -dlopen flag."
|
cannam@89
|
6280 if test -z "$global_symbol_pipe"; then
|
cannam@89
|
6281 $ECHO
|
cannam@89
|
6282 $ECHO "*** However, this would only work if libtool was able to extract symbol"
|
cannam@89
|
6283 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
|
cannam@89
|
6284 $ECHO "*** not find such a program. So, this module is probably useless."
|
cannam@89
|
6285 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
|
cannam@89
|
6286 fi
|
cannam@89
|
6287 if test "$build_old_libs" = no; then
|
cannam@89
|
6288 oldlibs="$output_objdir/$libname.$libext"
|
cannam@89
|
6289 build_libtool_libs=module
|
cannam@89
|
6290 build_old_libs=yes
|
cannam@89
|
6291 else
|
cannam@89
|
6292 build_libtool_libs=no
|
cannam@89
|
6293 fi
|
cannam@89
|
6294 else
|
cannam@89
|
6295 $ECHO "*** The inter-library dependencies that have been dropped here will be"
|
cannam@89
|
6296 $ECHO "*** automatically added whenever a program is linked with this library"
|
cannam@89
|
6297 $ECHO "*** or is declared to -dlopen it."
|
cannam@89
|
6298
|
cannam@89
|
6299 if test "$allow_undefined" = no; then
|
cannam@89
|
6300 $ECHO
|
cannam@89
|
6301 $ECHO "*** Since this library must not contain undefined symbols,"
|
cannam@89
|
6302 $ECHO "*** because either the platform does not support them or"
|
cannam@89
|
6303 $ECHO "*** it was explicitly requested with -no-undefined,"
|
cannam@89
|
6304 $ECHO "*** libtool will only create a static version of it."
|
cannam@89
|
6305 if test "$build_old_libs" = no; then
|
cannam@89
|
6306 oldlibs="$output_objdir/$libname.$libext"
|
cannam@89
|
6307 build_libtool_libs=module
|
cannam@89
|
6308 build_old_libs=yes
|
cannam@89
|
6309 else
|
cannam@89
|
6310 build_libtool_libs=no
|
cannam@89
|
6311 fi
|
cannam@89
|
6312 fi
|
cannam@89
|
6313 fi
|
cannam@89
|
6314 fi
|
cannam@89
|
6315 # Done checking deplibs!
|
cannam@89
|
6316 deplibs=$newdeplibs
|
cannam@89
|
6317 fi
|
cannam@89
|
6318 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
|
cannam@89
|
6319 case $host in
|
cannam@89
|
6320 *-*-darwin*)
|
cannam@89
|
6321 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
cannam@89
|
6322 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
cannam@89
|
6323 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
cannam@89
|
6324 ;;
|
cannam@89
|
6325 esac
|
cannam@89
|
6326
|
cannam@89
|
6327 # move library search paths that coincide with paths to not yet
|
cannam@89
|
6328 # installed libraries to the beginning of the library search list
|
cannam@89
|
6329 new_libs=
|
cannam@89
|
6330 for path in $notinst_path; do
|
cannam@89
|
6331 case " $new_libs " in
|
cannam@89
|
6332 *" -L$path/$objdir "*) ;;
|
cannam@89
|
6333 *)
|
cannam@89
|
6334 case " $deplibs " in
|
cannam@89
|
6335 *" -L$path/$objdir "*)
|
cannam@89
|
6336 new_libs="$new_libs -L$path/$objdir" ;;
|
cannam@89
|
6337 esac
|
cannam@89
|
6338 ;;
|
cannam@89
|
6339 esac
|
cannam@89
|
6340 done
|
cannam@89
|
6341 for deplib in $deplibs; do
|
cannam@89
|
6342 case $deplib in
|
cannam@89
|
6343 -L*)
|
cannam@89
|
6344 case " $new_libs " in
|
cannam@89
|
6345 *" $deplib "*) ;;
|
cannam@89
|
6346 *) new_libs="$new_libs $deplib" ;;
|
cannam@89
|
6347 esac
|
cannam@89
|
6348 ;;
|
cannam@89
|
6349 *) new_libs="$new_libs $deplib" ;;
|
cannam@89
|
6350 esac
|
cannam@89
|
6351 done
|
cannam@89
|
6352 deplibs="$new_libs"
|
cannam@89
|
6353
|
cannam@89
|
6354 # All the library-specific variables (install_libdir is set above).
|
cannam@89
|
6355 library_names=
|
cannam@89
|
6356 old_library=
|
cannam@89
|
6357 dlname=
|
cannam@89
|
6358
|
cannam@89
|
6359 # Test again, we may have decided not to build it any more
|
cannam@89
|
6360 if test "$build_libtool_libs" = yes; then
|
cannam@89
|
6361 if test "$hardcode_into_libs" = yes; then
|
cannam@89
|
6362 # Hardcode the library paths
|
cannam@89
|
6363 hardcode_libdirs=
|
cannam@89
|
6364 dep_rpath=
|
cannam@89
|
6365 rpath="$finalize_rpath"
|
cannam@89
|
6366 test "$mode" != relink && rpath="$compile_rpath$rpath"
|
cannam@89
|
6367 for libdir in $rpath; do
|
cannam@89
|
6368 if test -n "$hardcode_libdir_flag_spec"; then
|
cannam@89
|
6369 if test -n "$hardcode_libdir_separator"; then
|
cannam@89
|
6370 if test -z "$hardcode_libdirs"; then
|
cannam@89
|
6371 hardcode_libdirs="$libdir"
|
cannam@89
|
6372 else
|
cannam@89
|
6373 # Just accumulate the unique libdirs.
|
cannam@89
|
6374 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
|
cannam@89
|
6375 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
|
cannam@89
|
6376 ;;
|
cannam@89
|
6377 *)
|
cannam@89
|
6378 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
|
cannam@89
|
6379 ;;
|
cannam@89
|
6380 esac
|
cannam@89
|
6381 fi
|
cannam@89
|
6382 else
|
cannam@89
|
6383 eval flag=\"$hardcode_libdir_flag_spec\"
|
cannam@89
|
6384 dep_rpath="$dep_rpath $flag"
|
cannam@89
|
6385 fi
|
cannam@89
|
6386 elif test -n "$runpath_var"; then
|
cannam@89
|
6387 case "$perm_rpath " in
|
cannam@89
|
6388 *" $libdir "*) ;;
|
cannam@89
|
6389 *) perm_rpath="$perm_rpath $libdir" ;;
|
cannam@89
|
6390 esac
|
cannam@89
|
6391 fi
|
cannam@89
|
6392 done
|
cannam@89
|
6393 # Substitute the hardcoded libdirs into the rpath.
|
cannam@89
|
6394 if test -n "$hardcode_libdir_separator" &&
|
cannam@89
|
6395 test -n "$hardcode_libdirs"; then
|
cannam@89
|
6396 libdir="$hardcode_libdirs"
|
cannam@89
|
6397 if test -n "$hardcode_libdir_flag_spec_ld"; then
|
cannam@89
|
6398 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
|
cannam@89
|
6399 else
|
cannam@89
|
6400 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
|
cannam@89
|
6401 fi
|
cannam@89
|
6402 fi
|
cannam@89
|
6403 if test -n "$runpath_var" && test -n "$perm_rpath"; then
|
cannam@89
|
6404 # We should set the runpath_var.
|
cannam@89
|
6405 rpath=
|
cannam@89
|
6406 for dir in $perm_rpath; do
|
cannam@89
|
6407 rpath="$rpath$dir:"
|
cannam@89
|
6408 done
|
cannam@89
|
6409 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
|
cannam@89
|
6410 fi
|
cannam@89
|
6411 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
|
cannam@89
|
6412 fi
|
cannam@89
|
6413
|
cannam@89
|
6414 shlibpath="$finalize_shlibpath"
|
cannam@89
|
6415 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
|
cannam@89
|
6416 if test -n "$shlibpath"; then
|
cannam@89
|
6417 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
|
cannam@89
|
6418 fi
|
cannam@89
|
6419
|
cannam@89
|
6420 # Get the real and link names of the library.
|
cannam@89
|
6421 eval shared_ext=\"$shrext_cmds\"
|
cannam@89
|
6422 eval library_names=\"$library_names_spec\"
|
cannam@89
|
6423 set dummy $library_names
|
cannam@89
|
6424 shift
|
cannam@89
|
6425 realname="$1"
|
cannam@89
|
6426 shift
|
cannam@89
|
6427
|
cannam@89
|
6428 if test -n "$soname_spec"; then
|
cannam@89
|
6429 eval soname=\"$soname_spec\"
|
cannam@89
|
6430 else
|
cannam@89
|
6431 soname="$realname"
|
cannam@89
|
6432 fi
|
cannam@89
|
6433 if test -z "$dlname"; then
|
cannam@89
|
6434 dlname=$soname
|
cannam@89
|
6435 fi
|
cannam@89
|
6436
|
cannam@89
|
6437 lib="$output_objdir/$realname"
|
cannam@89
|
6438 linknames=
|
cannam@89
|
6439 for link
|
cannam@89
|
6440 do
|
cannam@89
|
6441 linknames="$linknames $link"
|
cannam@89
|
6442 done
|
cannam@89
|
6443
|
cannam@89
|
6444 # Use standard objects if they are pic
|
cannam@89
|
6445 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
|
cannam@89
|
6446 test "X$libobjs" = "X " && libobjs=
|
cannam@89
|
6447
|
cannam@89
|
6448 delfiles=
|
cannam@89
|
6449 if test -n "$export_symbols" && test -n "$include_expsyms"; then
|
cannam@89
|
6450 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
|
cannam@89
|
6451 export_symbols="$output_objdir/$libname.uexp"
|
cannam@89
|
6452 delfiles="$delfiles $export_symbols"
|
cannam@89
|
6453 fi
|
cannam@89
|
6454
|
cannam@89
|
6455 orig_export_symbols=
|
cannam@89
|
6456 case $host_os in
|
cannam@89
|
6457 cygwin* | mingw*)
|
cannam@89
|
6458 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
|
cannam@89
|
6459 # exporting using user supplied symfile
|
cannam@89
|
6460 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
|
cannam@89
|
6461 # and it's NOT already a .def file. Must figure out
|
cannam@89
|
6462 # which of the given symbols are data symbols and tag
|
cannam@89
|
6463 # them as such. So, trigger use of export_symbols_cmds.
|
cannam@89
|
6464 # export_symbols gets reassigned inside the "prepare
|
cannam@89
|
6465 # the list of exported symbols" if statement, so the
|
cannam@89
|
6466 # include_expsyms logic still works.
|
cannam@89
|
6467 orig_export_symbols="$export_symbols"
|
cannam@89
|
6468 export_symbols=
|
cannam@89
|
6469 always_export_symbols=yes
|
cannam@89
|
6470 fi
|
cannam@89
|
6471 fi
|
cannam@89
|
6472 ;;
|
cannam@89
|
6473 esac
|
cannam@89
|
6474
|
cannam@89
|
6475 # Prepare the list of exported symbols
|
cannam@89
|
6476 if test -z "$export_symbols"; then
|
cannam@89
|
6477 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
|
cannam@89
|
6478 func_verbose "generating symbol list for \`$libname.la'"
|
cannam@89
|
6479 export_symbols="$output_objdir/$libname.exp"
|
cannam@89
|
6480 $opt_dry_run || $RM $export_symbols
|
cannam@89
|
6481 cmds=$export_symbols_cmds
|
cannam@89
|
6482 save_ifs="$IFS"; IFS='~'
|
cannam@89
|
6483 for cmd in $cmds; do
|
cannam@89
|
6484 IFS="$save_ifs"
|
cannam@89
|
6485 eval cmd=\"$cmd\"
|
cannam@89
|
6486 func_len " $cmd"
|
cannam@89
|
6487 len=$func_len_result
|
cannam@89
|
6488 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
|
cannam@89
|
6489 func_show_eval "$cmd" 'exit $?'
|
cannam@89
|
6490 skipped_export=false
|
cannam@89
|
6491 else
|
cannam@89
|
6492 # The command line is too long to execute in one step.
|
cannam@89
|
6493 func_verbose "using reloadable object file for export list..."
|
cannam@89
|
6494 skipped_export=:
|
cannam@89
|
6495 # Break out early, otherwise skipped_export may be
|
cannam@89
|
6496 # set to false by a later but shorter cmd.
|
cannam@89
|
6497 break
|
cannam@89
|
6498 fi
|
cannam@89
|
6499 done
|
cannam@89
|
6500 IFS="$save_ifs"
|
cannam@89
|
6501 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
|
cannam@89
|
6502 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
|
cannam@89
|
6503 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
|
cannam@89
|
6504 fi
|
cannam@89
|
6505 fi
|
cannam@89
|
6506 fi
|
cannam@89
|
6507
|
cannam@89
|
6508 if test -n "$export_symbols" && test -n "$include_expsyms"; then
|
cannam@89
|
6509 tmp_export_symbols="$export_symbols"
|
cannam@89
|
6510 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
|
cannam@89
|
6511 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
|
cannam@89
|
6512 fi
|
cannam@89
|
6513
|
cannam@89
|
6514 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
|
cannam@89
|
6515 # The given exports_symbols file has to be filtered, so filter it.
|
cannam@89
|
6516 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
|
cannam@89
|
6517 # FIXME: $output_objdir/$libname.filter potentially contains lots of
|
cannam@89
|
6518 # 's' commands which not all seds can handle. GNU sed should be fine
|
cannam@89
|
6519 # though. Also, the filter scales superlinearly with the number of
|
cannam@89
|
6520 # global variables. join(1) would be nice here, but unfortunately
|
cannam@89
|
6521 # isn't a blessed tool.
|
cannam@89
|
6522 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
|
cannam@89
|
6523 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
|
cannam@89
|
6524 export_symbols=$output_objdir/$libname.def
|
cannam@89
|
6525 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
|
cannam@89
|
6526 fi
|
cannam@89
|
6527
|
cannam@89
|
6528 tmp_deplibs=
|
cannam@89
|
6529 for test_deplib in $deplibs; do
|
cannam@89
|
6530 case " $convenience " in
|
cannam@89
|
6531 *" $test_deplib "*) ;;
|
cannam@89
|
6532 *)
|
cannam@89
|
6533 tmp_deplibs="$tmp_deplibs $test_deplib"
|
cannam@89
|
6534 ;;
|
cannam@89
|
6535 esac
|
cannam@89
|
6536 done
|
cannam@89
|
6537 deplibs="$tmp_deplibs"
|
cannam@89
|
6538
|
cannam@89
|
6539 if test -n "$convenience"; then
|
cannam@89
|
6540 if test -n "$whole_archive_flag_spec" &&
|
cannam@89
|
6541 test "$compiler_needs_object" = yes &&
|
cannam@89
|
6542 test -z "$libobjs"; then
|
cannam@89
|
6543 # extract the archives, so we have objects to list.
|
cannam@89
|
6544 # TODO: could optimize this to just extract one archive.
|
cannam@89
|
6545 whole_archive_flag_spec=
|
cannam@89
|
6546 fi
|
cannam@89
|
6547 if test -n "$whole_archive_flag_spec"; then
|
cannam@89
|
6548 save_libobjs=$libobjs
|
cannam@89
|
6549 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
|
cannam@89
|
6550 test "X$libobjs" = "X " && libobjs=
|
cannam@89
|
6551 else
|
cannam@89
|
6552 gentop="$output_objdir/${outputname}x"
|
cannam@89
|
6553 generated="$generated $gentop"
|
cannam@89
|
6554
|
cannam@89
|
6555 func_extract_archives $gentop $convenience
|
cannam@89
|
6556 libobjs="$libobjs $func_extract_archives_result"
|
cannam@89
|
6557 test "X$libobjs" = "X " && libobjs=
|
cannam@89
|
6558 fi
|
cannam@89
|
6559 fi
|
cannam@89
|
6560
|
cannam@89
|
6561 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
|
cannam@89
|
6562 eval flag=\"$thread_safe_flag_spec\"
|
cannam@89
|
6563 linker_flags="$linker_flags $flag"
|
cannam@89
|
6564 fi
|
cannam@89
|
6565
|
cannam@89
|
6566 # Make a backup of the uninstalled library when relinking
|
cannam@89
|
6567 if test "$mode" = relink; then
|
cannam@89
|
6568 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
|
cannam@89
|
6569 fi
|
cannam@89
|
6570
|
cannam@89
|
6571 # Do each of the archive commands.
|
cannam@89
|
6572 if test "$module" = yes && test -n "$module_cmds" ; then
|
cannam@89
|
6573 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
|
cannam@89
|
6574 eval test_cmds=\"$module_expsym_cmds\"
|
cannam@89
|
6575 cmds=$module_expsym_cmds
|
cannam@89
|
6576 else
|
cannam@89
|
6577 eval test_cmds=\"$module_cmds\"
|
cannam@89
|
6578 cmds=$module_cmds
|
cannam@89
|
6579 fi
|
cannam@89
|
6580 else
|
cannam@89
|
6581 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
|
cannam@89
|
6582 eval test_cmds=\"$archive_expsym_cmds\"
|
cannam@89
|
6583 cmds=$archive_expsym_cmds
|
cannam@89
|
6584 else
|
cannam@89
|
6585 eval test_cmds=\"$archive_cmds\"
|
cannam@89
|
6586 cmds=$archive_cmds
|
cannam@89
|
6587 fi
|
cannam@89
|
6588 fi
|
cannam@89
|
6589
|
cannam@89
|
6590 if test "X$skipped_export" != "X:" &&
|
cannam@89
|
6591 func_len " $test_cmds" &&
|
cannam@89
|
6592 len=$func_len_result &&
|
cannam@89
|
6593 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
|
cannam@89
|
6594 :
|
cannam@89
|
6595 else
|
cannam@89
|
6596 # The command line is too long to link in one step, link piecewise
|
cannam@89
|
6597 # or, if using GNU ld and skipped_export is not :, use a linker
|
cannam@89
|
6598 # script.
|
cannam@89
|
6599
|
cannam@89
|
6600 # Save the value of $output and $libobjs because we want to
|
cannam@89
|
6601 # use them later. If we have whole_archive_flag_spec, we
|
cannam@89
|
6602 # want to use save_libobjs as it was before
|
cannam@89
|
6603 # whole_archive_flag_spec was expanded, because we can't
|
cannam@89
|
6604 # assume the linker understands whole_archive_flag_spec.
|
cannam@89
|
6605 # This may have to be revisited, in case too many
|
cannam@89
|
6606 # convenience libraries get linked in and end up exceeding
|
cannam@89
|
6607 # the spec.
|
cannam@89
|
6608 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
|
cannam@89
|
6609 save_libobjs=$libobjs
|
cannam@89
|
6610 fi
|
cannam@89
|
6611 save_output=$output
|
cannam@89
|
6612 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
|
cannam@89
|
6613
|
cannam@89
|
6614 # Clear the reloadable object creation command queue and
|
cannam@89
|
6615 # initialize k to one.
|
cannam@89
|
6616 test_cmds=
|
cannam@89
|
6617 concat_cmds=
|
cannam@89
|
6618 objlist=
|
cannam@89
|
6619 last_robj=
|
cannam@89
|
6620 k=1
|
cannam@89
|
6621
|
cannam@89
|
6622 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
|
cannam@89
|
6623 output=${output_objdir}/${output_la}.lnkscript
|
cannam@89
|
6624 func_verbose "creating GNU ld script: $output"
|
cannam@89
|
6625 $ECHO 'INPUT (' > $output
|
cannam@89
|
6626 for obj in $save_libobjs
|
cannam@89
|
6627 do
|
cannam@89
|
6628 $ECHO "$obj" >> $output
|
cannam@89
|
6629 done
|
cannam@89
|
6630 $ECHO ')' >> $output
|
cannam@89
|
6631 delfiles="$delfiles $output"
|
cannam@89
|
6632 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
|
cannam@89
|
6633 output=${output_objdir}/${output_la}.lnk
|
cannam@89
|
6634 func_verbose "creating linker input file list: $output"
|
cannam@89
|
6635 : > $output
|
cannam@89
|
6636 set x $save_libobjs
|
cannam@89
|
6637 shift
|
cannam@89
|
6638 firstobj=
|
cannam@89
|
6639 if test "$compiler_needs_object" = yes; then
|
cannam@89
|
6640 firstobj="$1 "
|
cannam@89
|
6641 shift
|
cannam@89
|
6642 fi
|
cannam@89
|
6643 for obj
|
cannam@89
|
6644 do
|
cannam@89
|
6645 $ECHO "$obj" >> $output
|
cannam@89
|
6646 done
|
cannam@89
|
6647 delfiles="$delfiles $output"
|
cannam@89
|
6648 output=$firstobj\"$file_list_spec$output\"
|
cannam@89
|
6649 else
|
cannam@89
|
6650 if test -n "$save_libobjs"; then
|
cannam@89
|
6651 func_verbose "creating reloadable object files..."
|
cannam@89
|
6652 output=$output_objdir/$output_la-${k}.$objext
|
cannam@89
|
6653 eval test_cmds=\"$reload_cmds\"
|
cannam@89
|
6654 func_len " $test_cmds"
|
cannam@89
|
6655 len0=$func_len_result
|
cannam@89
|
6656 len=$len0
|
cannam@89
|
6657
|
cannam@89
|
6658 # Loop over the list of objects to be linked.
|
cannam@89
|
6659 for obj in $save_libobjs
|
cannam@89
|
6660 do
|
cannam@89
|
6661 func_len " $obj"
|
cannam@89
|
6662 func_arith $len + $func_len_result
|
cannam@89
|
6663 len=$func_arith_result
|
cannam@89
|
6664 if test "X$objlist" = X ||
|
cannam@89
|
6665 test "$len" -lt "$max_cmd_len"; then
|
cannam@89
|
6666 func_append objlist " $obj"
|
cannam@89
|
6667 else
|
cannam@89
|
6668 # The command $test_cmds is almost too long, add a
|
cannam@89
|
6669 # command to the queue.
|
cannam@89
|
6670 if test "$k" -eq 1 ; then
|
cannam@89
|
6671 # The first file doesn't have a previous command to add.
|
cannam@89
|
6672 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
|
cannam@89
|
6673 else
|
cannam@89
|
6674 # All subsequent reloadable object files will link in
|
cannam@89
|
6675 # the last one created.
|
cannam@89
|
6676 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
|
cannam@89
|
6677 fi
|
cannam@89
|
6678 last_robj=$output_objdir/$output_la-${k}.$objext
|
cannam@89
|
6679 func_arith $k + 1
|
cannam@89
|
6680 k=$func_arith_result
|
cannam@89
|
6681 output=$output_objdir/$output_la-${k}.$objext
|
cannam@89
|
6682 objlist=$obj
|
cannam@89
|
6683 func_len " $last_robj"
|
cannam@89
|
6684 func_arith $len0 + $func_len_result
|
cannam@89
|
6685 len=$func_arith_result
|
cannam@89
|
6686 fi
|
cannam@89
|
6687 done
|
cannam@89
|
6688 # Handle the remaining objects by creating one last
|
cannam@89
|
6689 # reloadable object file. All subsequent reloadable object
|
cannam@89
|
6690 # files will link in the last one created.
|
cannam@89
|
6691 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
|
cannam@89
|
6692 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
|
cannam@89
|
6693 if test -n "$last_robj"; then
|
cannam@89
|
6694 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
|
cannam@89
|
6695 fi
|
cannam@89
|
6696 delfiles="$delfiles $output"
|
cannam@89
|
6697
|
cannam@89
|
6698 else
|
cannam@89
|
6699 output=
|
cannam@89
|
6700 fi
|
cannam@89
|
6701
|
cannam@89
|
6702 if ${skipped_export-false}; then
|
cannam@89
|
6703 func_verbose "generating symbol list for \`$libname.la'"
|
cannam@89
|
6704 export_symbols="$output_objdir/$libname.exp"
|
cannam@89
|
6705 $opt_dry_run || $RM $export_symbols
|
cannam@89
|
6706 libobjs=$output
|
cannam@89
|
6707 # Append the command to create the export file.
|
cannam@89
|
6708 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
|
cannam@89
|
6709 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
|
cannam@89
|
6710 if test -n "$last_robj"; then
|
cannam@89
|
6711 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
|
cannam@89
|
6712 fi
|
cannam@89
|
6713 fi
|
cannam@89
|
6714
|
cannam@89
|
6715 test -n "$save_libobjs" &&
|
cannam@89
|
6716 func_verbose "creating a temporary reloadable object file: $output"
|
cannam@89
|
6717
|
cannam@89
|
6718 # Loop through the commands generated above and execute them.
|
cannam@89
|
6719 save_ifs="$IFS"; IFS='~'
|
cannam@89
|
6720 for cmd in $concat_cmds; do
|
cannam@89
|
6721 IFS="$save_ifs"
|
cannam@89
|
6722 $opt_silent || {
|
cannam@89
|
6723 func_quote_for_expand "$cmd"
|
cannam@89
|
6724 eval "func_echo $func_quote_for_expand_result"
|
cannam@89
|
6725 }
|
cannam@89
|
6726 $opt_dry_run || eval "$cmd" || {
|
cannam@89
|
6727 lt_exit=$?
|
cannam@89
|
6728
|
cannam@89
|
6729 # Restore the uninstalled library and exit
|
cannam@89
|
6730 if test "$mode" = relink; then
|
cannam@89
|
6731 ( cd "$output_objdir" && \
|
cannam@89
|
6732 $RM "${realname}T" && \
|
cannam@89
|
6733 $MV "${realname}U" "$realname" )
|
cannam@89
|
6734 fi
|
cannam@89
|
6735
|
cannam@89
|
6736 exit $lt_exit
|
cannam@89
|
6737 }
|
cannam@89
|
6738 done
|
cannam@89
|
6739 IFS="$save_ifs"
|
cannam@89
|
6740
|
cannam@89
|
6741 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
|
cannam@89
|
6742 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
|
cannam@89
|
6743 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
|
cannam@89
|
6744 fi
|
cannam@89
|
6745 fi
|
cannam@89
|
6746
|
cannam@89
|
6747 if ${skipped_export-false}; then
|
cannam@89
|
6748 if test -n "$export_symbols" && test -n "$include_expsyms"; then
|
cannam@89
|
6749 tmp_export_symbols="$export_symbols"
|
cannam@89
|
6750 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
|
cannam@89
|
6751 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
|
cannam@89
|
6752 fi
|
cannam@89
|
6753
|
cannam@89
|
6754 if test -n "$orig_export_symbols"; then
|
cannam@89
|
6755 # The given exports_symbols file has to be filtered, so filter it.
|
cannam@89
|
6756 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
|
cannam@89
|
6757 # FIXME: $output_objdir/$libname.filter potentially contains lots of
|
cannam@89
|
6758 # 's' commands which not all seds can handle. GNU sed should be fine
|
cannam@89
|
6759 # though. Also, the filter scales superlinearly with the number of
|
cannam@89
|
6760 # global variables. join(1) would be nice here, but unfortunately
|
cannam@89
|
6761 # isn't a blessed tool.
|
cannam@89
|
6762 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
|
cannam@89
|
6763 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
|
cannam@89
|
6764 export_symbols=$output_objdir/$libname.def
|
cannam@89
|
6765 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
|
cannam@89
|
6766 fi
|
cannam@89
|
6767 fi
|
cannam@89
|
6768
|
cannam@89
|
6769 libobjs=$output
|
cannam@89
|
6770 # Restore the value of output.
|
cannam@89
|
6771 output=$save_output
|
cannam@89
|
6772
|
cannam@89
|
6773 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
|
cannam@89
|
6774 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
|
cannam@89
|
6775 test "X$libobjs" = "X " && libobjs=
|
cannam@89
|
6776 fi
|
cannam@89
|
6777 # Expand the library linking commands again to reset the
|
cannam@89
|
6778 # value of $libobjs for piecewise linking.
|
cannam@89
|
6779
|
cannam@89
|
6780 # Do each of the archive commands.
|
cannam@89
|
6781 if test "$module" = yes && test -n "$module_cmds" ; then
|
cannam@89
|
6782 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
|
cannam@89
|
6783 cmds=$module_expsym_cmds
|
cannam@89
|
6784 else
|
cannam@89
|
6785 cmds=$module_cmds
|
cannam@89
|
6786 fi
|
cannam@89
|
6787 else
|
cannam@89
|
6788 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
|
cannam@89
|
6789 cmds=$archive_expsym_cmds
|
cannam@89
|
6790 else
|
cannam@89
|
6791 cmds=$archive_cmds
|
cannam@89
|
6792 fi
|
cannam@89
|
6793 fi
|
cannam@89
|
6794 fi
|
cannam@89
|
6795
|
cannam@89
|
6796 if test -n "$delfiles"; then
|
cannam@89
|
6797 # Append the command to remove temporary files to $cmds.
|
cannam@89
|
6798 eval cmds=\"\$cmds~\$RM $delfiles\"
|
cannam@89
|
6799 fi
|
cannam@89
|
6800
|
cannam@89
|
6801 # Add any objects from preloaded convenience libraries
|
cannam@89
|
6802 if test -n "$dlprefiles"; then
|
cannam@89
|
6803 gentop="$output_objdir/${outputname}x"
|
cannam@89
|
6804 generated="$generated $gentop"
|
cannam@89
|
6805
|
cannam@89
|
6806 func_extract_archives $gentop $dlprefiles
|
cannam@89
|
6807 libobjs="$libobjs $func_extract_archives_result"
|
cannam@89
|
6808 test "X$libobjs" = "X " && libobjs=
|
cannam@89
|
6809 fi
|
cannam@89
|
6810
|
cannam@89
|
6811 save_ifs="$IFS"; IFS='~'
|
cannam@89
|
6812 for cmd in $cmds; do
|
cannam@89
|
6813 IFS="$save_ifs"
|
cannam@89
|
6814 eval cmd=\"$cmd\"
|
cannam@89
|
6815 $opt_silent || {
|
cannam@89
|
6816 func_quote_for_expand "$cmd"
|
cannam@89
|
6817 eval "func_echo $func_quote_for_expand_result"
|
cannam@89
|
6818 }
|
cannam@89
|
6819 $opt_dry_run || eval "$cmd" || {
|
cannam@89
|
6820 lt_exit=$?
|
cannam@89
|
6821
|
cannam@89
|
6822 # Restore the uninstalled library and exit
|
cannam@89
|
6823 if test "$mode" = relink; then
|
cannam@89
|
6824 ( cd "$output_objdir" && \
|
cannam@89
|
6825 $RM "${realname}T" && \
|
cannam@89
|
6826 $MV "${realname}U" "$realname" )
|
cannam@89
|
6827 fi
|
cannam@89
|
6828
|
cannam@89
|
6829 exit $lt_exit
|
cannam@89
|
6830 }
|
cannam@89
|
6831 done
|
cannam@89
|
6832 IFS="$save_ifs"
|
cannam@89
|
6833
|
cannam@89
|
6834 # Restore the uninstalled library and exit
|
cannam@89
|
6835 if test "$mode" = relink; then
|
cannam@89
|
6836 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
|
cannam@89
|
6837
|
cannam@89
|
6838 if test -n "$convenience"; then
|
cannam@89
|
6839 if test -z "$whole_archive_flag_spec"; then
|
cannam@89
|
6840 func_show_eval '${RM}r "$gentop"'
|
cannam@89
|
6841 fi
|
cannam@89
|
6842 fi
|
cannam@89
|
6843
|
cannam@89
|
6844 exit $EXIT_SUCCESS
|
cannam@89
|
6845 fi
|
cannam@89
|
6846
|
cannam@89
|
6847 # Create links to the real library.
|
cannam@89
|
6848 for linkname in $linknames; do
|
cannam@89
|
6849 if test "$realname" != "$linkname"; then
|
cannam@89
|
6850 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
|
cannam@89
|
6851 fi
|
cannam@89
|
6852 done
|
cannam@89
|
6853
|
cannam@89
|
6854 # If -module or -export-dynamic was specified, set the dlname.
|
cannam@89
|
6855 if test "$module" = yes || test "$export_dynamic" = yes; then
|
cannam@89
|
6856 # On all known operating systems, these are identical.
|
cannam@89
|
6857 dlname="$soname"
|
cannam@89
|
6858 fi
|
cannam@89
|
6859 fi
|
cannam@89
|
6860 ;;
|
cannam@89
|
6861
|
cannam@89
|
6862 obj)
|
cannam@89
|
6863 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
|
cannam@89
|
6864 func_warning "\`-dlopen' is ignored for objects"
|
cannam@89
|
6865 fi
|
cannam@89
|
6866
|
cannam@89
|
6867 case " $deplibs" in
|
cannam@89
|
6868 *\ -l* | *\ -L*)
|
cannam@89
|
6869 func_warning "\`-l' and \`-L' are ignored for objects" ;;
|
cannam@89
|
6870 esac
|
cannam@89
|
6871
|
cannam@89
|
6872 test -n "$rpath" && \
|
cannam@89
|
6873 func_warning "\`-rpath' is ignored for objects"
|
cannam@89
|
6874
|
cannam@89
|
6875 test -n "$xrpath" && \
|
cannam@89
|
6876 func_warning "\`-R' is ignored for objects"
|
cannam@89
|
6877
|
cannam@89
|
6878 test -n "$vinfo" && \
|
cannam@89
|
6879 func_warning "\`-version-info' is ignored for objects"
|
cannam@89
|
6880
|
cannam@89
|
6881 test -n "$release" && \
|
cannam@89
|
6882 func_warning "\`-release' is ignored for objects"
|
cannam@89
|
6883
|
cannam@89
|
6884 case $output in
|
cannam@89
|
6885 *.lo)
|
cannam@89
|
6886 test -n "$objs$old_deplibs" && \
|
cannam@89
|
6887 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
|
cannam@89
|
6888
|
cannam@89
|
6889 libobj=$output
|
cannam@89
|
6890 func_lo2o "$libobj"
|
cannam@89
|
6891 obj=$func_lo2o_result
|
cannam@89
|
6892 ;;
|
cannam@89
|
6893 *)
|
cannam@89
|
6894 libobj=
|
cannam@89
|
6895 obj="$output"
|
cannam@89
|
6896 ;;
|
cannam@89
|
6897 esac
|
cannam@89
|
6898
|
cannam@89
|
6899 # Delete the old objects.
|
cannam@89
|
6900 $opt_dry_run || $RM $obj $libobj
|
cannam@89
|
6901
|
cannam@89
|
6902 # Objects from convenience libraries. This assumes
|
cannam@89
|
6903 # single-version convenience libraries. Whenever we create
|
cannam@89
|
6904 # different ones for PIC/non-PIC, this we'll have to duplicate
|
cannam@89
|
6905 # the extraction.
|
cannam@89
|
6906 reload_conv_objs=
|
cannam@89
|
6907 gentop=
|
cannam@89
|
6908 # reload_cmds runs $LD directly, so let us get rid of
|
cannam@89
|
6909 # -Wl from whole_archive_flag_spec and hope we can get by with
|
cannam@89
|
6910 # turning comma into space..
|
cannam@89
|
6911 wl=
|
cannam@89
|
6912
|
cannam@89
|
6913 if test -n "$convenience"; then
|
cannam@89
|
6914 if test -n "$whole_archive_flag_spec"; then
|
cannam@89
|
6915 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
|
cannam@89
|
6916 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
|
cannam@89
|
6917 else
|
cannam@89
|
6918 gentop="$output_objdir/${obj}x"
|
cannam@89
|
6919 generated="$generated $gentop"
|
cannam@89
|
6920
|
cannam@89
|
6921 func_extract_archives $gentop $convenience
|
cannam@89
|
6922 reload_conv_objs="$reload_objs $func_extract_archives_result"
|
cannam@89
|
6923 fi
|
cannam@89
|
6924 fi
|
cannam@89
|
6925
|
cannam@89
|
6926 # Create the old-style object.
|
cannam@89
|
6927 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
|
cannam@89
|
6928
|
cannam@89
|
6929 output="$obj"
|
cannam@89
|
6930 func_execute_cmds "$reload_cmds" 'exit $?'
|
cannam@89
|
6931
|
cannam@89
|
6932 # Exit if we aren't doing a library object file.
|
cannam@89
|
6933 if test -z "$libobj"; then
|
cannam@89
|
6934 if test -n "$gentop"; then
|
cannam@89
|
6935 func_show_eval '${RM}r "$gentop"'
|
cannam@89
|
6936 fi
|
cannam@89
|
6937
|
cannam@89
|
6938 exit $EXIT_SUCCESS
|
cannam@89
|
6939 fi
|
cannam@89
|
6940
|
cannam@89
|
6941 if test "$build_libtool_libs" != yes; then
|
cannam@89
|
6942 if test -n "$gentop"; then
|
cannam@89
|
6943 func_show_eval '${RM}r "$gentop"'
|
cannam@89
|
6944 fi
|
cannam@89
|
6945
|
cannam@89
|
6946 # Create an invalid libtool object if no PIC, so that we don't
|
cannam@89
|
6947 # accidentally link it into a program.
|
cannam@89
|
6948 # $show "echo timestamp > $libobj"
|
cannam@89
|
6949 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
|
cannam@89
|
6950 exit $EXIT_SUCCESS
|
cannam@89
|
6951 fi
|
cannam@89
|
6952
|
cannam@89
|
6953 if test -n "$pic_flag" || test "$pic_mode" != default; then
|
cannam@89
|
6954 # Only do commands if we really have different PIC objects.
|
cannam@89
|
6955 reload_objs="$libobjs $reload_conv_objs"
|
cannam@89
|
6956 output="$libobj"
|
cannam@89
|
6957 func_execute_cmds "$reload_cmds" 'exit $?'
|
cannam@89
|
6958 fi
|
cannam@89
|
6959
|
cannam@89
|
6960 if test -n "$gentop"; then
|
cannam@89
|
6961 func_show_eval '${RM}r "$gentop"'
|
cannam@89
|
6962 fi
|
cannam@89
|
6963
|
cannam@89
|
6964 exit $EXIT_SUCCESS
|
cannam@89
|
6965 ;;
|
cannam@89
|
6966
|
cannam@89
|
6967 prog)
|
cannam@89
|
6968 case $host in
|
cannam@89
|
6969 *cygwin*) func_stripname '' '.exe' "$output"
|
cannam@89
|
6970 output=$func_stripname_result.exe;;
|
cannam@89
|
6971 esac
|
cannam@89
|
6972 test -n "$vinfo" && \
|
cannam@89
|
6973 func_warning "\`-version-info' is ignored for programs"
|
cannam@89
|
6974
|
cannam@89
|
6975 test -n "$release" && \
|
cannam@89
|
6976 func_warning "\`-release' is ignored for programs"
|
cannam@89
|
6977
|
cannam@89
|
6978 test "$preload" = yes \
|
cannam@89
|
6979 && test "$dlopen_support" = unknown \
|
cannam@89
|
6980 && test "$dlopen_self" = unknown \
|
cannam@89
|
6981 && test "$dlopen_self_static" = unknown && \
|
cannam@89
|
6982 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
|
cannam@89
|
6983
|
cannam@89
|
6984 case $host in
|
cannam@89
|
6985 *-*-rhapsody* | *-*-darwin1.[012])
|
cannam@89
|
6986 # On Rhapsody replace the C library is the System framework
|
cannam@89
|
6987 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
|
cannam@89
|
6988 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
|
cannam@89
|
6989 ;;
|
cannam@89
|
6990 esac
|
cannam@89
|
6991
|
cannam@89
|
6992 case $host in
|
cannam@89
|
6993 *-*-darwin*)
|
cannam@89
|
6994 # Don't allow lazy linking, it breaks C++ global constructors
|
cannam@89
|
6995 # But is supposedly fixed on 10.4 or later (yay!).
|
cannam@89
|
6996 if test "$tagname" = CXX ; then
|
cannam@89
|
6997 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
|
cannam@89
|
6998 10.[0123])
|
cannam@89
|
6999 compile_command="$compile_command ${wl}-bind_at_load"
|
cannam@89
|
7000 finalize_command="$finalize_command ${wl}-bind_at_load"
|
cannam@89
|
7001 ;;
|
cannam@89
|
7002 esac
|
cannam@89
|
7003 fi
|
cannam@89
|
7004 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
|
cannam@89
|
7005 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
cannam@89
|
7006 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
|
cannam@89
|
7007 ;;
|
cannam@89
|
7008 esac
|
cannam@89
|
7009
|
cannam@89
|
7010
|
cannam@89
|
7011 # move library search paths that coincide with paths to not yet
|
cannam@89
|
7012 # installed libraries to the beginning of the library search list
|
cannam@89
|
7013 new_libs=
|
cannam@89
|
7014 for path in $notinst_path; do
|
cannam@89
|
7015 case " $new_libs " in
|
cannam@89
|
7016 *" -L$path/$objdir "*) ;;
|
cannam@89
|
7017 *)
|
cannam@89
|
7018 case " $compile_deplibs " in
|
cannam@89
|
7019 *" -L$path/$objdir "*)
|
cannam@89
|
7020 new_libs="$new_libs -L$path/$objdir" ;;
|
cannam@89
|
7021 esac
|
cannam@89
|
7022 ;;
|
cannam@89
|
7023 esac
|
cannam@89
|
7024 done
|
cannam@89
|
7025 for deplib in $compile_deplibs; do
|
cannam@89
|
7026 case $deplib in
|
cannam@89
|
7027 -L*)
|
cannam@89
|
7028 case " $new_libs " in
|
cannam@89
|
7029 *" $deplib "*) ;;
|
cannam@89
|
7030 *) new_libs="$new_libs $deplib" ;;
|
cannam@89
|
7031 esac
|
cannam@89
|
7032 ;;
|
cannam@89
|
7033 *) new_libs="$new_libs $deplib" ;;
|
cannam@89
|
7034 esac
|
cannam@89
|
7035 done
|
cannam@89
|
7036 compile_deplibs="$new_libs"
|
cannam@89
|
7037
|
cannam@89
|
7038
|
cannam@89
|
7039 compile_command="$compile_command $compile_deplibs"
|
cannam@89
|
7040 finalize_command="$finalize_command $finalize_deplibs"
|
cannam@89
|
7041
|
cannam@89
|
7042 if test -n "$rpath$xrpath"; then
|
cannam@89
|
7043 # If the user specified any rpath flags, then add them.
|
cannam@89
|
7044 for libdir in $rpath $xrpath; do
|
cannam@89
|
7045 # This is the magic to use -rpath.
|
cannam@89
|
7046 case "$finalize_rpath " in
|
cannam@89
|
7047 *" $libdir "*) ;;
|
cannam@89
|
7048 *) finalize_rpath="$finalize_rpath $libdir" ;;
|
cannam@89
|
7049 esac
|
cannam@89
|
7050 done
|
cannam@89
|
7051 fi
|
cannam@89
|
7052
|
cannam@89
|
7053 # Now hardcode the library paths
|
cannam@89
|
7054 rpath=
|
cannam@89
|
7055 hardcode_libdirs=
|
cannam@89
|
7056 for libdir in $compile_rpath $finalize_rpath; do
|
cannam@89
|
7057 if test -n "$hardcode_libdir_flag_spec"; then
|
cannam@89
|
7058 if test -n "$hardcode_libdir_separator"; then
|
cannam@89
|
7059 if test -z "$hardcode_libdirs"; then
|
cannam@89
|
7060 hardcode_libdirs="$libdir"
|
cannam@89
|
7061 else
|
cannam@89
|
7062 # Just accumulate the unique libdirs.
|
cannam@89
|
7063 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
|
cannam@89
|
7064 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
|
cannam@89
|
7065 ;;
|
cannam@89
|
7066 *)
|
cannam@89
|
7067 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
|
cannam@89
|
7068 ;;
|
cannam@89
|
7069 esac
|
cannam@89
|
7070 fi
|
cannam@89
|
7071 else
|
cannam@89
|
7072 eval flag=\"$hardcode_libdir_flag_spec\"
|
cannam@89
|
7073 rpath="$rpath $flag"
|
cannam@89
|
7074 fi
|
cannam@89
|
7075 elif test -n "$runpath_var"; then
|
cannam@89
|
7076 case "$perm_rpath " in
|
cannam@89
|
7077 *" $libdir "*) ;;
|
cannam@89
|
7078 *) perm_rpath="$perm_rpath $libdir" ;;
|
cannam@89
|
7079 esac
|
cannam@89
|
7080 fi
|
cannam@89
|
7081 case $host in
|
cannam@89
|
7082 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
|
cannam@89
|
7083 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
|
cannam@89
|
7084 case :$dllsearchpath: in
|
cannam@89
|
7085 *":$libdir:"*) ;;
|
cannam@89
|
7086 *) dllsearchpath="$dllsearchpath:$libdir";;
|
cannam@89
|
7087 esac
|
cannam@89
|
7088 case :$dllsearchpath: in
|
cannam@89
|
7089 *":$testbindir:"*) ;;
|
cannam@89
|
7090 *) dllsearchpath="$dllsearchpath:$testbindir";;
|
cannam@89
|
7091 esac
|
cannam@89
|
7092 ;;
|
cannam@89
|
7093 esac
|
cannam@89
|
7094 done
|
cannam@89
|
7095 # Substitute the hardcoded libdirs into the rpath.
|
cannam@89
|
7096 if test -n "$hardcode_libdir_separator" &&
|
cannam@89
|
7097 test -n "$hardcode_libdirs"; then
|
cannam@89
|
7098 libdir="$hardcode_libdirs"
|
cannam@89
|
7099 eval rpath=\" $hardcode_libdir_flag_spec\"
|
cannam@89
|
7100 fi
|
cannam@89
|
7101 compile_rpath="$rpath"
|
cannam@89
|
7102
|
cannam@89
|
7103 rpath=
|
cannam@89
|
7104 hardcode_libdirs=
|
cannam@89
|
7105 for libdir in $finalize_rpath; do
|
cannam@89
|
7106 if test -n "$hardcode_libdir_flag_spec"; then
|
cannam@89
|
7107 if test -n "$hardcode_libdir_separator"; then
|
cannam@89
|
7108 if test -z "$hardcode_libdirs"; then
|
cannam@89
|
7109 hardcode_libdirs="$libdir"
|
cannam@89
|
7110 else
|
cannam@89
|
7111 # Just accumulate the unique libdirs.
|
cannam@89
|
7112 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
|
cannam@89
|
7113 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
|
cannam@89
|
7114 ;;
|
cannam@89
|
7115 *)
|
cannam@89
|
7116 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
|
cannam@89
|
7117 ;;
|
cannam@89
|
7118 esac
|
cannam@89
|
7119 fi
|
cannam@89
|
7120 else
|
cannam@89
|
7121 eval flag=\"$hardcode_libdir_flag_spec\"
|
cannam@89
|
7122 rpath="$rpath $flag"
|
cannam@89
|
7123 fi
|
cannam@89
|
7124 elif test -n "$runpath_var"; then
|
cannam@89
|
7125 case "$finalize_perm_rpath " in
|
cannam@89
|
7126 *" $libdir "*) ;;
|
cannam@89
|
7127 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
|
cannam@89
|
7128 esac
|
cannam@89
|
7129 fi
|
cannam@89
|
7130 done
|
cannam@89
|
7131 # Substitute the hardcoded libdirs into the rpath.
|
cannam@89
|
7132 if test -n "$hardcode_libdir_separator" &&
|
cannam@89
|
7133 test -n "$hardcode_libdirs"; then
|
cannam@89
|
7134 libdir="$hardcode_libdirs"
|
cannam@89
|
7135 eval rpath=\" $hardcode_libdir_flag_spec\"
|
cannam@89
|
7136 fi
|
cannam@89
|
7137 finalize_rpath="$rpath"
|
cannam@89
|
7138
|
cannam@89
|
7139 if test -n "$libobjs" && test "$build_old_libs" = yes; then
|
cannam@89
|
7140 # Transform all the library objects into standard objects.
|
cannam@89
|
7141 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
|
cannam@89
|
7142 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
|
cannam@89
|
7143 fi
|
cannam@89
|
7144
|
cannam@89
|
7145 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
|
cannam@89
|
7146
|
cannam@89
|
7147 # template prelinking step
|
cannam@89
|
7148 if test -n "$prelink_cmds"; then
|
cannam@89
|
7149 func_execute_cmds "$prelink_cmds" 'exit $?'
|
cannam@89
|
7150 fi
|
cannam@89
|
7151
|
cannam@89
|
7152 wrappers_required=yes
|
cannam@89
|
7153 case $host in
|
cannam@89
|
7154 *cygwin* | *mingw* )
|
cannam@89
|
7155 if test "$build_libtool_libs" != yes; then
|
cannam@89
|
7156 wrappers_required=no
|
cannam@89
|
7157 fi
|
cannam@89
|
7158 ;;
|
cannam@89
|
7159 *)
|
cannam@89
|
7160 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
|
cannam@89
|
7161 wrappers_required=no
|
cannam@89
|
7162 fi
|
cannam@89
|
7163 ;;
|
cannam@89
|
7164 esac
|
cannam@89
|
7165 if test "$wrappers_required" = no; then
|
cannam@89
|
7166 # Replace the output file specification.
|
cannam@89
|
7167 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
|
cannam@89
|
7168 link_command="$compile_command$compile_rpath"
|
cannam@89
|
7169
|
cannam@89
|
7170 # We have no uninstalled library dependencies, so finalize right now.
|
cannam@89
|
7171 exit_status=0
|
cannam@89
|
7172 func_show_eval "$link_command" 'exit_status=$?'
|
cannam@89
|
7173
|
cannam@89
|
7174 # Delete the generated files.
|
cannam@89
|
7175 if test -f "$output_objdir/${outputname}S.${objext}"; then
|
cannam@89
|
7176 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
|
cannam@89
|
7177 fi
|
cannam@89
|
7178
|
cannam@89
|
7179 exit $exit_status
|
cannam@89
|
7180 fi
|
cannam@89
|
7181
|
cannam@89
|
7182 if test -n "$compile_shlibpath$finalize_shlibpath"; then
|
cannam@89
|
7183 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
|
cannam@89
|
7184 fi
|
cannam@89
|
7185 if test -n "$finalize_shlibpath"; then
|
cannam@89
|
7186 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
|
cannam@89
|
7187 fi
|
cannam@89
|
7188
|
cannam@89
|
7189 compile_var=
|
cannam@89
|
7190 finalize_var=
|
cannam@89
|
7191 if test -n "$runpath_var"; then
|
cannam@89
|
7192 if test -n "$perm_rpath"; then
|
cannam@89
|
7193 # We should set the runpath_var.
|
cannam@89
|
7194 rpath=
|
cannam@89
|
7195 for dir in $perm_rpath; do
|
cannam@89
|
7196 rpath="$rpath$dir:"
|
cannam@89
|
7197 done
|
cannam@89
|
7198 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
|
cannam@89
|
7199 fi
|
cannam@89
|
7200 if test -n "$finalize_perm_rpath"; then
|
cannam@89
|
7201 # We should set the runpath_var.
|
cannam@89
|
7202 rpath=
|
cannam@89
|
7203 for dir in $finalize_perm_rpath; do
|
cannam@89
|
7204 rpath="$rpath$dir:"
|
cannam@89
|
7205 done
|
cannam@89
|
7206 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
|
cannam@89
|
7207 fi
|
cannam@89
|
7208 fi
|
cannam@89
|
7209
|
cannam@89
|
7210 if test "$no_install" = yes; then
|
cannam@89
|
7211 # We don't need to create a wrapper script.
|
cannam@89
|
7212 link_command="$compile_var$compile_command$compile_rpath"
|
cannam@89
|
7213 # Replace the output file specification.
|
cannam@89
|
7214 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
|
cannam@89
|
7215 # Delete the old output file.
|
cannam@89
|
7216 $opt_dry_run || $RM $output
|
cannam@89
|
7217 # Link the executable and exit
|
cannam@89
|
7218 func_show_eval "$link_command" 'exit $?'
|
cannam@89
|
7219 exit $EXIT_SUCCESS
|
cannam@89
|
7220 fi
|
cannam@89
|
7221
|
cannam@89
|
7222 if test "$hardcode_action" = relink; then
|
cannam@89
|
7223 # Fast installation is not supported
|
cannam@89
|
7224 link_command="$compile_var$compile_command$compile_rpath"
|
cannam@89
|
7225 relink_command="$finalize_var$finalize_command$finalize_rpath"
|
cannam@89
|
7226
|
cannam@89
|
7227 func_warning "this platform does not like uninstalled shared libraries"
|
cannam@89
|
7228 func_warning "\`$output' will be relinked during installation"
|
cannam@89
|
7229 else
|
cannam@89
|
7230 if test "$fast_install" != no; then
|
cannam@89
|
7231 link_command="$finalize_var$compile_command$finalize_rpath"
|
cannam@89
|
7232 if test "$fast_install" = yes; then
|
cannam@89
|
7233 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
|
cannam@89
|
7234 else
|
cannam@89
|
7235 # fast_install is set to needless
|
cannam@89
|
7236 relink_command=
|
cannam@89
|
7237 fi
|
cannam@89
|
7238 else
|
cannam@89
|
7239 link_command="$compile_var$compile_command$compile_rpath"
|
cannam@89
|
7240 relink_command="$finalize_var$finalize_command$finalize_rpath"
|
cannam@89
|
7241 fi
|
cannam@89
|
7242 fi
|
cannam@89
|
7243
|
cannam@89
|
7244 # Replace the output file specification.
|
cannam@89
|
7245 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
|
cannam@89
|
7246
|
cannam@89
|
7247 # Delete the old output files.
|
cannam@89
|
7248 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
|
cannam@89
|
7249
|
cannam@89
|
7250 func_show_eval "$link_command" 'exit $?'
|
cannam@89
|
7251
|
cannam@89
|
7252 # Now create the wrapper script.
|
cannam@89
|
7253 func_verbose "creating $output"
|
cannam@89
|
7254
|
cannam@89
|
7255 # Quote the relink command for shipping.
|
cannam@89
|
7256 if test -n "$relink_command"; then
|
cannam@89
|
7257 # Preserve any variables that may affect compiler behavior
|
cannam@89
|
7258 for var in $variables_saved_for_relink; do
|
cannam@89
|
7259 if eval test -z \"\${$var+set}\"; then
|
cannam@89
|
7260 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
|
cannam@89
|
7261 elif eval var_value=\$$var; test -z "$var_value"; then
|
cannam@89
|
7262 relink_command="$var=; export $var; $relink_command"
|
cannam@89
|
7263 else
|
cannam@89
|
7264 func_quote_for_eval "$var_value"
|
cannam@89
|
7265 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
|
cannam@89
|
7266 fi
|
cannam@89
|
7267 done
|
cannam@89
|
7268 relink_command="(cd `pwd`; $relink_command)"
|
cannam@89
|
7269 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
|
cannam@89
|
7270 fi
|
cannam@89
|
7271
|
cannam@89
|
7272 # Quote $ECHO for shipping.
|
cannam@89
|
7273 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
|
cannam@89
|
7274 case $progpath in
|
cannam@89
|
7275 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
|
cannam@89
|
7276 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
|
cannam@89
|
7277 esac
|
cannam@89
|
7278 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
|
cannam@89
|
7279 else
|
cannam@89
|
7280 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
|
cannam@89
|
7281 fi
|
cannam@89
|
7282
|
cannam@89
|
7283 # Only actually do things if not in dry run mode.
|
cannam@89
|
7284 $opt_dry_run || {
|
cannam@89
|
7285 # win32 will think the script is a binary if it has
|
cannam@89
|
7286 # a .exe suffix, so we strip it off here.
|
cannam@89
|
7287 case $output in
|
cannam@89
|
7288 *.exe) func_stripname '' '.exe' "$output"
|
cannam@89
|
7289 output=$func_stripname_result ;;
|
cannam@89
|
7290 esac
|
cannam@89
|
7291 # test for cygwin because mv fails w/o .exe extensions
|
cannam@89
|
7292 case $host in
|
cannam@89
|
7293 *cygwin*)
|
cannam@89
|
7294 exeext=.exe
|
cannam@89
|
7295 func_stripname '' '.exe' "$outputname"
|
cannam@89
|
7296 outputname=$func_stripname_result ;;
|
cannam@89
|
7297 *) exeext= ;;
|
cannam@89
|
7298 esac
|
cannam@89
|
7299 case $host in
|
cannam@89
|
7300 *cygwin* | *mingw* )
|
cannam@89
|
7301 func_dirname_and_basename "$output" "" "."
|
cannam@89
|
7302 output_name=$func_basename_result
|
cannam@89
|
7303 output_path=$func_dirname_result
|
cannam@89
|
7304 cwrappersource="$output_path/$objdir/lt-$output_name.c"
|
cannam@89
|
7305 cwrapper="$output_path/$output_name.exe"
|
cannam@89
|
7306 $RM $cwrappersource $cwrapper
|
cannam@89
|
7307 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
|
cannam@89
|
7308
|
cannam@89
|
7309 func_emit_cwrapperexe_src > $cwrappersource
|
cannam@89
|
7310
|
cannam@89
|
7311 # we should really use a build-platform specific compiler
|
cannam@89
|
7312 # here, but OTOH, the wrappers (shell script and this C one)
|
cannam@89
|
7313 # are only useful if you want to execute the "real" binary.
|
cannam@89
|
7314 # Since the "real" binary is built for $host, then this
|
cannam@89
|
7315 # wrapper might as well be built for $host, too.
|
cannam@89
|
7316 $opt_dry_run || {
|
cannam@89
|
7317 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
|
cannam@89
|
7318 $STRIP $cwrapper
|
cannam@89
|
7319 }
|
cannam@89
|
7320
|
cannam@89
|
7321 # Now, create the wrapper script for func_source use:
|
cannam@89
|
7322 func_ltwrapper_scriptname $cwrapper
|
cannam@89
|
7323 $RM $func_ltwrapper_scriptname_result
|
cannam@89
|
7324 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
|
cannam@89
|
7325 $opt_dry_run || {
|
cannam@89
|
7326 # note: this script will not be executed, so do not chmod.
|
cannam@89
|
7327 if test "x$build" = "x$host" ; then
|
cannam@89
|
7328 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
|
cannam@89
|
7329 else
|
cannam@89
|
7330 func_emit_wrapper no > $func_ltwrapper_scriptname_result
|
cannam@89
|
7331 fi
|
cannam@89
|
7332 }
|
cannam@89
|
7333 ;;
|
cannam@89
|
7334 * )
|
cannam@89
|
7335 $RM $output
|
cannam@89
|
7336 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
|
cannam@89
|
7337
|
cannam@89
|
7338 func_emit_wrapper no > $output
|
cannam@89
|
7339 chmod +x $output
|
cannam@89
|
7340 ;;
|
cannam@89
|
7341 esac
|
cannam@89
|
7342 }
|
cannam@89
|
7343 exit $EXIT_SUCCESS
|
cannam@89
|
7344 ;;
|
cannam@89
|
7345 esac
|
cannam@89
|
7346
|
cannam@89
|
7347 # See if we need to build an old-fashioned archive.
|
cannam@89
|
7348 for oldlib in $oldlibs; do
|
cannam@89
|
7349
|
cannam@89
|
7350 if test "$build_libtool_libs" = convenience; then
|
cannam@89
|
7351 oldobjs="$libobjs_save $symfileobj"
|
cannam@89
|
7352 addlibs="$convenience"
|
cannam@89
|
7353 build_libtool_libs=no
|
cannam@89
|
7354 else
|
cannam@89
|
7355 if test "$build_libtool_libs" = module; then
|
cannam@89
|
7356 oldobjs="$libobjs_save"
|
cannam@89
|
7357 build_libtool_libs=no
|
cannam@89
|
7358 else
|
cannam@89
|
7359 oldobjs="$old_deplibs $non_pic_objects"
|
cannam@89
|
7360 if test "$preload" = yes && test -f "$symfileobj"; then
|
cannam@89
|
7361 oldobjs="$oldobjs $symfileobj"
|
cannam@89
|
7362 fi
|
cannam@89
|
7363 fi
|
cannam@89
|
7364 addlibs="$old_convenience"
|
cannam@89
|
7365 fi
|
cannam@89
|
7366
|
cannam@89
|
7367 if test -n "$addlibs"; then
|
cannam@89
|
7368 gentop="$output_objdir/${outputname}x"
|
cannam@89
|
7369 generated="$generated $gentop"
|
cannam@89
|
7370
|
cannam@89
|
7371 func_extract_archives $gentop $addlibs
|
cannam@89
|
7372 oldobjs="$oldobjs $func_extract_archives_result"
|
cannam@89
|
7373 fi
|
cannam@89
|
7374
|
cannam@89
|
7375 # Do each command in the archive commands.
|
cannam@89
|
7376 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
|
cannam@89
|
7377 cmds=$old_archive_from_new_cmds
|
cannam@89
|
7378 else
|
cannam@89
|
7379
|
cannam@89
|
7380 # Add any objects from preloaded convenience libraries
|
cannam@89
|
7381 if test -n "$dlprefiles"; then
|
cannam@89
|
7382 gentop="$output_objdir/${outputname}x"
|
cannam@89
|
7383 generated="$generated $gentop"
|
cannam@89
|
7384
|
cannam@89
|
7385 func_extract_archives $gentop $dlprefiles
|
cannam@89
|
7386 oldobjs="$oldobjs $func_extract_archives_result"
|
cannam@89
|
7387 fi
|
cannam@89
|
7388
|
cannam@89
|
7389 # POSIX demands no paths to be encoded in archives. We have
|
cannam@89
|
7390 # to avoid creating archives with duplicate basenames if we
|
cannam@89
|
7391 # might have to extract them afterwards, e.g., when creating a
|
cannam@89
|
7392 # static archive out of a convenience library, or when linking
|
cannam@89
|
7393 # the entirety of a libtool archive into another (currently
|
cannam@89
|
7394 # not supported by libtool).
|
cannam@89
|
7395 if (for obj in $oldobjs
|
cannam@89
|
7396 do
|
cannam@89
|
7397 func_basename "$obj"
|
cannam@89
|
7398 $ECHO "$func_basename_result"
|
cannam@89
|
7399 done | sort | sort -uc >/dev/null 2>&1); then
|
cannam@89
|
7400 :
|
cannam@89
|
7401 else
|
cannam@89
|
7402 $ECHO "copying selected object files to avoid basename conflicts..."
|
cannam@89
|
7403 gentop="$output_objdir/${outputname}x"
|
cannam@89
|
7404 generated="$generated $gentop"
|
cannam@89
|
7405 func_mkdir_p "$gentop"
|
cannam@89
|
7406 save_oldobjs=$oldobjs
|
cannam@89
|
7407 oldobjs=
|
cannam@89
|
7408 counter=1
|
cannam@89
|
7409 for obj in $save_oldobjs
|
cannam@89
|
7410 do
|
cannam@89
|
7411 func_basename "$obj"
|
cannam@89
|
7412 objbase="$func_basename_result"
|
cannam@89
|
7413 case " $oldobjs " in
|
cannam@89
|
7414 " ") oldobjs=$obj ;;
|
cannam@89
|
7415 *[\ /]"$objbase "*)
|
cannam@89
|
7416 while :; do
|
cannam@89
|
7417 # Make sure we don't pick an alternate name that also
|
cannam@89
|
7418 # overlaps.
|
cannam@89
|
7419 newobj=lt$counter-$objbase
|
cannam@89
|
7420 func_arith $counter + 1
|
cannam@89
|
7421 counter=$func_arith_result
|
cannam@89
|
7422 case " $oldobjs " in
|
cannam@89
|
7423 *[\ /]"$newobj "*) ;;
|
cannam@89
|
7424 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
|
cannam@89
|
7425 esac
|
cannam@89
|
7426 done
|
cannam@89
|
7427 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
|
cannam@89
|
7428 oldobjs="$oldobjs $gentop/$newobj"
|
cannam@89
|
7429 ;;
|
cannam@89
|
7430 *) oldobjs="$oldobjs $obj" ;;
|
cannam@89
|
7431 esac
|
cannam@89
|
7432 done
|
cannam@89
|
7433 fi
|
cannam@89
|
7434 eval cmds=\"$old_archive_cmds\"
|
cannam@89
|
7435
|
cannam@89
|
7436 func_len " $cmds"
|
cannam@89
|
7437 len=$func_len_result
|
cannam@89
|
7438 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
|
cannam@89
|
7439 cmds=$old_archive_cmds
|
cannam@89
|
7440 else
|
cannam@89
|
7441 # the command line is too long to link in one step, link in parts
|
cannam@89
|
7442 func_verbose "using piecewise archive linking..."
|
cannam@89
|
7443 save_RANLIB=$RANLIB
|
cannam@89
|
7444 RANLIB=:
|
cannam@89
|
7445 objlist=
|
cannam@89
|
7446 concat_cmds=
|
cannam@89
|
7447 save_oldobjs=$oldobjs
|
cannam@89
|
7448 oldobjs=
|
cannam@89
|
7449 # Is there a better way of finding the last object in the list?
|
cannam@89
|
7450 for obj in $save_oldobjs
|
cannam@89
|
7451 do
|
cannam@89
|
7452 last_oldobj=$obj
|
cannam@89
|
7453 done
|
cannam@89
|
7454 eval test_cmds=\"$old_archive_cmds\"
|
cannam@89
|
7455 func_len " $test_cmds"
|
cannam@89
|
7456 len0=$func_len_result
|
cannam@89
|
7457 len=$len0
|
cannam@89
|
7458 for obj in $save_oldobjs
|
cannam@89
|
7459 do
|
cannam@89
|
7460 func_len " $obj"
|
cannam@89
|
7461 func_arith $len + $func_len_result
|
cannam@89
|
7462 len=$func_arith_result
|
cannam@89
|
7463 func_append objlist " $obj"
|
cannam@89
|
7464 if test "$len" -lt "$max_cmd_len"; then
|
cannam@89
|
7465 :
|
cannam@89
|
7466 else
|
cannam@89
|
7467 # the above command should be used before it gets too long
|
cannam@89
|
7468 oldobjs=$objlist
|
cannam@89
|
7469 if test "$obj" = "$last_oldobj" ; then
|
cannam@89
|
7470 RANLIB=$save_RANLIB
|
cannam@89
|
7471 fi
|
cannam@89
|
7472 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
|
cannam@89
|
7473 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
|
cannam@89
|
7474 objlist=
|
cannam@89
|
7475 len=$len0
|
cannam@89
|
7476 fi
|
cannam@89
|
7477 done
|
cannam@89
|
7478 RANLIB=$save_RANLIB
|
cannam@89
|
7479 oldobjs=$objlist
|
cannam@89
|
7480 if test "X$oldobjs" = "X" ; then
|
cannam@89
|
7481 eval cmds=\"\$concat_cmds\"
|
cannam@89
|
7482 else
|
cannam@89
|
7483 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
|
cannam@89
|
7484 fi
|
cannam@89
|
7485 fi
|
cannam@89
|
7486 fi
|
cannam@89
|
7487 func_execute_cmds "$cmds" 'exit $?'
|
cannam@89
|
7488 done
|
cannam@89
|
7489
|
cannam@89
|
7490 test -n "$generated" && \
|
cannam@89
|
7491 func_show_eval "${RM}r$generated"
|
cannam@89
|
7492
|
cannam@89
|
7493 # Now create the libtool archive.
|
cannam@89
|
7494 case $output in
|
cannam@89
|
7495 *.la)
|
cannam@89
|
7496 old_library=
|
cannam@89
|
7497 test "$build_old_libs" = yes && old_library="$libname.$libext"
|
cannam@89
|
7498 func_verbose "creating $output"
|
cannam@89
|
7499
|
cannam@89
|
7500 # Preserve any variables that may affect compiler behavior
|
cannam@89
|
7501 for var in $variables_saved_for_relink; do
|
cannam@89
|
7502 if eval test -z \"\${$var+set}\"; then
|
cannam@89
|
7503 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
|
cannam@89
|
7504 elif eval var_value=\$$var; test -z "$var_value"; then
|
cannam@89
|
7505 relink_command="$var=; export $var; $relink_command"
|
cannam@89
|
7506 else
|
cannam@89
|
7507 func_quote_for_eval "$var_value"
|
cannam@89
|
7508 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
|
cannam@89
|
7509 fi
|
cannam@89
|
7510 done
|
cannam@89
|
7511 # Quote the link command for shipping.
|
cannam@89
|
7512 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
|
cannam@89
|
7513 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
|
cannam@89
|
7514 if test "$hardcode_automatic" = yes ; then
|
cannam@89
|
7515 relink_command=
|
cannam@89
|
7516 fi
|
cannam@89
|
7517
|
cannam@89
|
7518 # Only create the output if not a dry run.
|
cannam@89
|
7519 $opt_dry_run || {
|
cannam@89
|
7520 for installed in no yes; do
|
cannam@89
|
7521 if test "$installed" = yes; then
|
cannam@89
|
7522 if test -z "$install_libdir"; then
|
cannam@89
|
7523 break
|
cannam@89
|
7524 fi
|
cannam@89
|
7525 output="$output_objdir/$outputname"i
|
cannam@89
|
7526 # Replace all uninstalled libtool libraries with the installed ones
|
cannam@89
|
7527 newdependency_libs=
|
cannam@89
|
7528 for deplib in $dependency_libs; do
|
cannam@89
|
7529 case $deplib in
|
cannam@89
|
7530 *.la)
|
cannam@89
|
7531 func_basename "$deplib"
|
cannam@89
|
7532 name="$func_basename_result"
|
cannam@89
|
7533 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
|
cannam@89
|
7534 test -z "$libdir" && \
|
cannam@89
|
7535 func_fatal_error "\`$deplib' is not a valid libtool archive"
|
cannam@89
|
7536 newdependency_libs="$newdependency_libs $libdir/$name"
|
cannam@89
|
7537 ;;
|
cannam@89
|
7538 *) newdependency_libs="$newdependency_libs $deplib" ;;
|
cannam@89
|
7539 esac
|
cannam@89
|
7540 done
|
cannam@89
|
7541 dependency_libs="$newdependency_libs"
|
cannam@89
|
7542 newdlfiles=
|
cannam@89
|
7543
|
cannam@89
|
7544 for lib in $dlfiles; do
|
cannam@89
|
7545 case $lib in
|
cannam@89
|
7546 *.la)
|
cannam@89
|
7547 func_basename "$lib"
|
cannam@89
|
7548 name="$func_basename_result"
|
cannam@89
|
7549 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
|
cannam@89
|
7550 test -z "$libdir" && \
|
cannam@89
|
7551 func_fatal_error "\`$lib' is not a valid libtool archive"
|
cannam@89
|
7552 newdlfiles="$newdlfiles $libdir/$name"
|
cannam@89
|
7553 ;;
|
cannam@89
|
7554 *) newdlfiles="$newdlfiles $lib" ;;
|
cannam@89
|
7555 esac
|
cannam@89
|
7556 done
|
cannam@89
|
7557 dlfiles="$newdlfiles"
|
cannam@89
|
7558 newdlprefiles=
|
cannam@89
|
7559 for lib in $dlprefiles; do
|
cannam@89
|
7560 case $lib in
|
cannam@89
|
7561 *.la)
|
cannam@89
|
7562 # Only pass preopened files to the pseudo-archive (for
|
cannam@89
|
7563 # eventual linking with the app. that links it) if we
|
cannam@89
|
7564 # didn't already link the preopened objects directly into
|
cannam@89
|
7565 # the library:
|
cannam@89
|
7566 func_basename "$lib"
|
cannam@89
|
7567 name="$func_basename_result"
|
cannam@89
|
7568 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
|
cannam@89
|
7569 test -z "$libdir" && \
|
cannam@89
|
7570 func_fatal_error "\`$lib' is not a valid libtool archive"
|
cannam@89
|
7571 newdlprefiles="$newdlprefiles $libdir/$name"
|
cannam@89
|
7572 ;;
|
cannam@89
|
7573 esac
|
cannam@89
|
7574 done
|
cannam@89
|
7575 dlprefiles="$newdlprefiles"
|
cannam@89
|
7576 else
|
cannam@89
|
7577 newdlfiles=
|
cannam@89
|
7578 for lib in $dlfiles; do
|
cannam@89
|
7579 case $lib in
|
cannam@89
|
7580 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
|
cannam@89
|
7581 *) abs=`pwd`"/$lib" ;;
|
cannam@89
|
7582 esac
|
cannam@89
|
7583 newdlfiles="$newdlfiles $abs"
|
cannam@89
|
7584 done
|
cannam@89
|
7585 dlfiles="$newdlfiles"
|
cannam@89
|
7586 newdlprefiles=
|
cannam@89
|
7587 for lib in $dlprefiles; do
|
cannam@89
|
7588 case $lib in
|
cannam@89
|
7589 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
|
cannam@89
|
7590 *) abs=`pwd`"/$lib" ;;
|
cannam@89
|
7591 esac
|
cannam@89
|
7592 newdlprefiles="$newdlprefiles $abs"
|
cannam@89
|
7593 done
|
cannam@89
|
7594 dlprefiles="$newdlprefiles"
|
cannam@89
|
7595 fi
|
cannam@89
|
7596 $RM $output
|
cannam@89
|
7597 # place dlname in correct position for cygwin
|
cannam@89
|
7598 tdlname=$dlname
|
cannam@89
|
7599 case $host,$output,$installed,$module,$dlname in
|
cannam@89
|
7600 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
|
cannam@89
|
7601 esac
|
cannam@89
|
7602 $ECHO > $output "\
|
cannam@89
|
7603 # $outputname - a libtool library file
|
cannam@89
|
7604 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
|
cannam@89
|
7605 #
|
cannam@89
|
7606 # Please DO NOT delete this file!
|
cannam@89
|
7607 # It is necessary for linking the library.
|
cannam@89
|
7608
|
cannam@89
|
7609 # The name that we can dlopen(3).
|
cannam@89
|
7610 dlname='$tdlname'
|
cannam@89
|
7611
|
cannam@89
|
7612 # Names of this library.
|
cannam@89
|
7613 library_names='$library_names'
|
cannam@89
|
7614
|
cannam@89
|
7615 # The name of the static archive.
|
cannam@89
|
7616 old_library='$old_library'
|
cannam@89
|
7617
|
cannam@89
|
7618 # Linker flags that can not go in dependency_libs.
|
cannam@89
|
7619 inherited_linker_flags='$new_inherited_linker_flags'
|
cannam@89
|
7620
|
cannam@89
|
7621 # Libraries that this one depends upon.
|
cannam@89
|
7622 dependency_libs='$dependency_libs'
|
cannam@89
|
7623
|
cannam@89
|
7624 # Names of additional weak libraries provided by this library
|
cannam@89
|
7625 weak_library_names='$weak_libs'
|
cannam@89
|
7626
|
cannam@89
|
7627 # Version information for $libname.
|
cannam@89
|
7628 current=$current
|
cannam@89
|
7629 age=$age
|
cannam@89
|
7630 revision=$revision
|
cannam@89
|
7631
|
cannam@89
|
7632 # Is this an already installed library?
|
cannam@89
|
7633 installed=$installed
|
cannam@89
|
7634
|
cannam@89
|
7635 # Should we warn about portability when linking against -modules?
|
cannam@89
|
7636 shouldnotlink=$module
|
cannam@89
|
7637
|
cannam@89
|
7638 # Files to dlopen/dlpreopen
|
cannam@89
|
7639 dlopen='$dlfiles'
|
cannam@89
|
7640 dlpreopen='$dlprefiles'
|
cannam@89
|
7641
|
cannam@89
|
7642 # Directory that this library needs to be installed in:
|
cannam@89
|
7643 libdir='$install_libdir'"
|
cannam@89
|
7644 if test "$installed" = no && test "$need_relink" = yes; then
|
cannam@89
|
7645 $ECHO >> $output "\
|
cannam@89
|
7646 relink_command=\"$relink_command\""
|
cannam@89
|
7647 fi
|
cannam@89
|
7648 done
|
cannam@89
|
7649 }
|
cannam@89
|
7650
|
cannam@89
|
7651 # Do a symbolic link so that the libtool archive can be found in
|
cannam@89
|
7652 # LD_LIBRARY_PATH before the program is installed.
|
cannam@89
|
7653 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
|
cannam@89
|
7654 ;;
|
cannam@89
|
7655 esac
|
cannam@89
|
7656 exit $EXIT_SUCCESS
|
cannam@89
|
7657 }
|
cannam@89
|
7658
|
cannam@89
|
7659 { test "$mode" = link || test "$mode" = relink; } &&
|
cannam@89
|
7660 func_mode_link ${1+"$@"}
|
cannam@89
|
7661
|
cannam@89
|
7662
|
cannam@89
|
7663 # func_mode_uninstall arg...
|
cannam@89
|
7664 func_mode_uninstall ()
|
cannam@89
|
7665 {
|
cannam@89
|
7666 $opt_debug
|
cannam@89
|
7667 RM="$nonopt"
|
cannam@89
|
7668 files=
|
cannam@89
|
7669 rmforce=
|
cannam@89
|
7670 exit_status=0
|
cannam@89
|
7671
|
cannam@89
|
7672 # This variable tells wrapper scripts just to set variables rather
|
cannam@89
|
7673 # than running their programs.
|
cannam@89
|
7674 libtool_install_magic="$magic"
|
cannam@89
|
7675
|
cannam@89
|
7676 for arg
|
cannam@89
|
7677 do
|
cannam@89
|
7678 case $arg in
|
cannam@89
|
7679 -f) RM="$RM $arg"; rmforce=yes ;;
|
cannam@89
|
7680 -*) RM="$RM $arg" ;;
|
cannam@89
|
7681 *) files="$files $arg" ;;
|
cannam@89
|
7682 esac
|
cannam@89
|
7683 done
|
cannam@89
|
7684
|
cannam@89
|
7685 test -z "$RM" && \
|
cannam@89
|
7686 func_fatal_help "you must specify an RM program"
|
cannam@89
|
7687
|
cannam@89
|
7688 rmdirs=
|
cannam@89
|
7689
|
cannam@89
|
7690 origobjdir="$objdir"
|
cannam@89
|
7691 for file in $files; do
|
cannam@89
|
7692 func_dirname "$file" "" "."
|
cannam@89
|
7693 dir="$func_dirname_result"
|
cannam@89
|
7694 if test "X$dir" = X.; then
|
cannam@89
|
7695 objdir="$origobjdir"
|
cannam@89
|
7696 else
|
cannam@89
|
7697 objdir="$dir/$origobjdir"
|
cannam@89
|
7698 fi
|
cannam@89
|
7699 func_basename "$file"
|
cannam@89
|
7700 name="$func_basename_result"
|
cannam@89
|
7701 test "$mode" = uninstall && objdir="$dir"
|
cannam@89
|
7702
|
cannam@89
|
7703 # Remember objdir for removal later, being careful to avoid duplicates
|
cannam@89
|
7704 if test "$mode" = clean; then
|
cannam@89
|
7705 case " $rmdirs " in
|
cannam@89
|
7706 *" $objdir "*) ;;
|
cannam@89
|
7707 *) rmdirs="$rmdirs $objdir" ;;
|
cannam@89
|
7708 esac
|
cannam@89
|
7709 fi
|
cannam@89
|
7710
|
cannam@89
|
7711 # Don't error if the file doesn't exist and rm -f was used.
|
cannam@89
|
7712 if { test -L "$file"; } >/dev/null 2>&1 ||
|
cannam@89
|
7713 { test -h "$file"; } >/dev/null 2>&1 ||
|
cannam@89
|
7714 test -f "$file"; then
|
cannam@89
|
7715 :
|
cannam@89
|
7716 elif test -d "$file"; then
|
cannam@89
|
7717 exit_status=1
|
cannam@89
|
7718 continue
|
cannam@89
|
7719 elif test "$rmforce" = yes; then
|
cannam@89
|
7720 continue
|
cannam@89
|
7721 fi
|
cannam@89
|
7722
|
cannam@89
|
7723 rmfiles="$file"
|
cannam@89
|
7724
|
cannam@89
|
7725 case $name in
|
cannam@89
|
7726 *.la)
|
cannam@89
|
7727 # Possibly a libtool archive, so verify it.
|
cannam@89
|
7728 if func_lalib_p "$file"; then
|
cannam@89
|
7729 func_source $dir/$name
|
cannam@89
|
7730
|
cannam@89
|
7731 # Delete the libtool libraries and symlinks.
|
cannam@89
|
7732 for n in $library_names; do
|
cannam@89
|
7733 rmfiles="$rmfiles $objdir/$n"
|
cannam@89
|
7734 done
|
cannam@89
|
7735 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
|
cannam@89
|
7736
|
cannam@89
|
7737 case "$mode" in
|
cannam@89
|
7738 clean)
|
cannam@89
|
7739 case " $library_names " in
|
cannam@89
|
7740 # " " in the beginning catches empty $dlname
|
cannam@89
|
7741 *" $dlname "*) ;;
|
cannam@89
|
7742 *) rmfiles="$rmfiles $objdir/$dlname" ;;
|
cannam@89
|
7743 esac
|
cannam@89
|
7744 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
|
cannam@89
|
7745 ;;
|
cannam@89
|
7746 uninstall)
|
cannam@89
|
7747 if test -n "$library_names"; then
|
cannam@89
|
7748 # Do each command in the postuninstall commands.
|
cannam@89
|
7749 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
|
cannam@89
|
7750 fi
|
cannam@89
|
7751
|
cannam@89
|
7752 if test -n "$old_library"; then
|
cannam@89
|
7753 # Do each command in the old_postuninstall commands.
|
cannam@89
|
7754 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
|
cannam@89
|
7755 fi
|
cannam@89
|
7756 # FIXME: should reinstall the best remaining shared library.
|
cannam@89
|
7757 ;;
|
cannam@89
|
7758 esac
|
cannam@89
|
7759 fi
|
cannam@89
|
7760 ;;
|
cannam@89
|
7761
|
cannam@89
|
7762 *.lo)
|
cannam@89
|
7763 # Possibly a libtool object, so verify it.
|
cannam@89
|
7764 if func_lalib_p "$file"; then
|
cannam@89
|
7765
|
cannam@89
|
7766 # Read the .lo file
|
cannam@89
|
7767 func_source $dir/$name
|
cannam@89
|
7768
|
cannam@89
|
7769 # Add PIC object to the list of files to remove.
|
cannam@89
|
7770 if test -n "$pic_object" &&
|
cannam@89
|
7771 test "$pic_object" != none; then
|
cannam@89
|
7772 rmfiles="$rmfiles $dir/$pic_object"
|
cannam@89
|
7773 fi
|
cannam@89
|
7774
|
cannam@89
|
7775 # Add non-PIC object to the list of files to remove.
|
cannam@89
|
7776 if test -n "$non_pic_object" &&
|
cannam@89
|
7777 test "$non_pic_object" != none; then
|
cannam@89
|
7778 rmfiles="$rmfiles $dir/$non_pic_object"
|
cannam@89
|
7779 fi
|
cannam@89
|
7780 fi
|
cannam@89
|
7781 ;;
|
cannam@89
|
7782
|
cannam@89
|
7783 *)
|
cannam@89
|
7784 if test "$mode" = clean ; then
|
cannam@89
|
7785 noexename=$name
|
cannam@89
|
7786 case $file in
|
cannam@89
|
7787 *.exe)
|
cannam@89
|
7788 func_stripname '' '.exe' "$file"
|
cannam@89
|
7789 file=$func_stripname_result
|
cannam@89
|
7790 func_stripname '' '.exe' "$name"
|
cannam@89
|
7791 noexename=$func_stripname_result
|
cannam@89
|
7792 # $file with .exe has already been added to rmfiles,
|
cannam@89
|
7793 # add $file without .exe
|
cannam@89
|
7794 rmfiles="$rmfiles $file"
|
cannam@89
|
7795 ;;
|
cannam@89
|
7796 esac
|
cannam@89
|
7797 # Do a test to see if this is a libtool program.
|
cannam@89
|
7798 if func_ltwrapper_p "$file"; then
|
cannam@89
|
7799 if func_ltwrapper_executable_p "$file"; then
|
cannam@89
|
7800 func_ltwrapper_scriptname "$file"
|
cannam@89
|
7801 relink_command=
|
cannam@89
|
7802 func_source $func_ltwrapper_scriptname_result
|
cannam@89
|
7803 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
|
cannam@89
|
7804 else
|
cannam@89
|
7805 relink_command=
|
cannam@89
|
7806 func_source $dir/$noexename
|
cannam@89
|
7807 fi
|
cannam@89
|
7808
|
cannam@89
|
7809 # note $name still contains .exe if it was in $file originally
|
cannam@89
|
7810 # as does the version of $file that was added into $rmfiles
|
cannam@89
|
7811 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
|
cannam@89
|
7812 if test "$fast_install" = yes && test -n "$relink_command"; then
|
cannam@89
|
7813 rmfiles="$rmfiles $objdir/lt-$name"
|
cannam@89
|
7814 fi
|
cannam@89
|
7815 if test "X$noexename" != "X$name" ; then
|
cannam@89
|
7816 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
|
cannam@89
|
7817 fi
|
cannam@89
|
7818 fi
|
cannam@89
|
7819 fi
|
cannam@89
|
7820 ;;
|
cannam@89
|
7821 esac
|
cannam@89
|
7822 func_show_eval "$RM $rmfiles" 'exit_status=1'
|
cannam@89
|
7823 done
|
cannam@89
|
7824 objdir="$origobjdir"
|
cannam@89
|
7825
|
cannam@89
|
7826 # Try to remove the ${objdir}s in the directories where we deleted files
|
cannam@89
|
7827 for dir in $rmdirs; do
|
cannam@89
|
7828 if test -d "$dir"; then
|
cannam@89
|
7829 func_show_eval "rmdir $dir >/dev/null 2>&1"
|
cannam@89
|
7830 fi
|
cannam@89
|
7831 done
|
cannam@89
|
7832
|
cannam@89
|
7833 exit $exit_status
|
cannam@89
|
7834 }
|
cannam@89
|
7835
|
cannam@89
|
7836 { test "$mode" = uninstall || test "$mode" = clean; } &&
|
cannam@89
|
7837 func_mode_uninstall ${1+"$@"}
|
cannam@89
|
7838
|
cannam@89
|
7839 test -z "$mode" && {
|
cannam@89
|
7840 help="$generic_help"
|
cannam@89
|
7841 func_fatal_help "you must specify a MODE"
|
cannam@89
|
7842 }
|
cannam@89
|
7843
|
cannam@89
|
7844 test -z "$exec_cmd" && \
|
cannam@89
|
7845 func_fatal_help "invalid operation mode \`$mode'"
|
cannam@89
|
7846
|
cannam@89
|
7847 if test -n "$exec_cmd"; then
|
cannam@89
|
7848 eval exec "$exec_cmd"
|
cannam@89
|
7849 exit $EXIT_FAILURE
|
cannam@89
|
7850 fi
|
cannam@89
|
7851
|
cannam@89
|
7852 exit $exit_status
|
cannam@89
|
7853
|
cannam@89
|
7854
|
cannam@89
|
7855 # The TAGs below are defined such that we never get into a situation
|
cannam@89
|
7856 # in which we disable both kinds of libraries. Given conflicting
|
cannam@89
|
7857 # choices, we go for a static library, that is the most portable,
|
cannam@89
|
7858 # since we can't tell whether shared libraries were disabled because
|
cannam@89
|
7859 # the user asked for that or because the platform doesn't support
|
cannam@89
|
7860 # them. This is particularly important on AIX, because we don't
|
cannam@89
|
7861 # support having both static and shared libraries enabled at the same
|
cannam@89
|
7862 # time on that platform, so we default to a shared-only configuration.
|
cannam@89
|
7863 # If a disable-shared tag is given, we'll fallback to a static-only
|
cannam@89
|
7864 # configuration. But we'll never go from static-only to shared-only.
|
cannam@89
|
7865
|
cannam@89
|
7866 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
|
cannam@89
|
7867 build_libtool_libs=no
|
cannam@89
|
7868 build_old_libs=yes
|
cannam@89
|
7869 # ### END LIBTOOL TAG CONFIG: disable-shared
|
cannam@89
|
7870
|
cannam@89
|
7871 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
|
cannam@89
|
7872 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
|
cannam@89
|
7873 # ### END LIBTOOL TAG CONFIG: disable-static
|
cannam@89
|
7874
|
cannam@89
|
7875 # Local Variables:
|
cannam@89
|
7876 # mode:shell-script
|
cannam@89
|
7877 # sh-indentation:2
|
cannam@89
|
7878 # End:
|
cannam@89
|
7879 # vi:sw=2
|
cannam@89
|
7880
|