0
|
1 #! /bin/sh
|
|
2 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
|
|
3 ## by inline-source v2014-01-03.01
|
|
4
|
|
5 # libtool (GNU libtool) 2.4.5
|
|
6 # Provide generalized library-building support services.
|
|
7 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
|
8
|
|
9 # Copyright (C) 1996-2015 Free Software Foundation, Inc.
|
|
10 # This is free software; see the source for copying conditions. There is NO
|
|
11 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
12
|
|
13 # GNU Libtool is free software; you can redistribute it and/or modify
|
|
14 # it under the terms of the GNU General Public License as published by
|
|
15 # the Free Software Foundation; either version 2 of the License, or
|
|
16 # (at your option) any later version.
|
|
17 #
|
|
18 # As a special exception to the GNU General Public License,
|
|
19 # if you distribute this file as part of a program or library that
|
|
20 # is built using GNU Libtool, you may include this file under the
|
|
21 # same distribution terms that you use for the rest of that program.
|
|
22 #
|
|
23 # GNU Libtool is distributed in the hope that it will be useful, but
|
|
24 # WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
26 # General Public License for more details.
|
|
27 #
|
|
28 # You should have received a copy of the GNU General Public License
|
|
29 # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
30
|
|
31
|
|
32 PROGRAM=libtool
|
|
33 PACKAGE=libtool
|
|
34 VERSION=2.4.5
|
|
35 package_revision=2.4.5
|
|
36
|
|
37
|
|
38 ## ------ ##
|
|
39 ## Usage. ##
|
|
40 ## ------ ##
|
|
41
|
|
42 # Run './libtool --help' for help with using this script from the
|
|
43 # command line.
|
|
44
|
|
45
|
|
46 ## ------------------------------- ##
|
|
47 ## User overridable command paths. ##
|
|
48 ## ------------------------------- ##
|
|
49
|
|
50 # After configure completes, it has a better idea of some of the
|
|
51 # shell tools we need than the defaults used by the functions shared
|
|
52 # with bootstrap, so set those here where they can still be over-
|
|
53 # ridden by the user, but otherwise take precedence.
|
|
54
|
|
55 : ${AUTOCONF="autoconf"}
|
|
56 : ${AUTOMAKE="automake"}
|
|
57
|
|
58
|
|
59 ## -------------------------- ##
|
|
60 ## Source external libraries. ##
|
|
61 ## -------------------------- ##
|
|
62
|
|
63 # Much of our low-level functionality needs to be sourced from external
|
|
64 # libraries, which are installed to $pkgauxdir.
|
|
65
|
|
66 # Set a version string for this script.
|
|
67 scriptversion=2014-01-03.01; # UTC
|
|
68
|
|
69 # General shell script boiler plate, and helper functions.
|
|
70 # Written by Gary V. Vaughan, 2004
|
|
71
|
|
72 # Copyright (C) 2004-2015 Free Software Foundation, Inc.
|
|
73 # This is free software; see the source for copying conditions. There is NO
|
|
74 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
75
|
|
76 # This program is free software; you can redistribute it and/or modify
|
|
77 # it under the terms of the GNU General Public License as published by
|
|
78 # the Free Software Foundation; either version 3 of the License, or
|
|
79 # (at your option) any later version.
|
|
80
|
|
81 # As a special exception to the GNU General Public License, if you distribute
|
|
82 # this file as part of a program or library that is built using GNU Libtool,
|
|
83 # you may include this file under the same distribution terms that you use
|
|
84 # for the rest of that program.
|
|
85
|
|
86 # This program is distributed in the hope that it will be useful,
|
|
87 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
88 # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
|
|
89 # General Public License for more details.
|
|
90
|
|
91 # You should have received a copy of the GNU General Public License
|
|
92 # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
93
|
|
94 # Please report bugs or propose patches to gary@gnu.org.
|
|
95
|
|
96
|
|
97 ## ------ ##
|
|
98 ## Usage. ##
|
|
99 ## ------ ##
|
|
100
|
|
101 # Evaluate this file near the top of your script to gain access to
|
|
102 # the functions and variables defined here:
|
|
103 #
|
|
104 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
|
|
105 #
|
|
106 # If you need to override any of the default environment variable
|
|
107 # settings, do that before evaluating this file.
|
|
108
|
|
109
|
|
110 ## -------------------- ##
|
|
111 ## Shell normalisation. ##
|
|
112 ## -------------------- ##
|
|
113
|
|
114 # Some shells need a little help to be as Bourne compatible as possible.
|
|
115 # Before doing anything else, make sure all that help has been provided!
|
|
116
|
|
117 DUALCASE=1; export DUALCASE # for MKS sh
|
|
118 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
|
|
119 emulate sh
|
|
120 NULLCMD=:
|
|
121 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
|
|
122 # is contrary to our usage. Disable this feature.
|
|
123 alias -g '${1+"$@"}'='"$@"'
|
|
124 setopt NO_GLOB_SUBST
|
|
125 else
|
|
126 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
|
|
127 fi
|
|
128
|
|
129 # NLS nuisances: We save the old values in case they are required later.
|
|
130 _G_user_locale=
|
|
131 _G_safe_locale=
|
|
132 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
|
133 do
|
|
134 eval "if test set = \"\${$_G_var+set}\"; then
|
|
135 save_$_G_var=\$$_G_var
|
|
136 $_G_var=C
|
|
137 export $_G_var
|
|
138 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
|
|
139 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
|
|
140 fi"
|
|
141 done
|
|
142
|
|
143 # CDPATH.
|
|
144 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
|
145
|
|
146 # Make sure IFS has a sensible default
|
|
147 sp=' '
|
|
148 nl='
|
|
149 '
|
|
150 IFS="$sp $nl"
|
|
151
|
|
152 # There are apparently some retarded systems that use ';' as a PATH separator!
|
|
153 if test "${PATH_SEPARATOR+set}" != set; then
|
|
154 PATH_SEPARATOR=:
|
|
155 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
|
|
156 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
|
|
157 PATH_SEPARATOR=';'
|
|
158 }
|
|
159 fi
|
|
160
|
|
161
|
|
162
|
|
163 ## ------------------------- ##
|
|
164 ## Locate command utilities. ##
|
|
165 ## ------------------------- ##
|
|
166
|
|
167
|
|
168 # func_executable_p FILE
|
|
169 # ----------------------
|
|
170 # Check that FILE is an executable regular file.
|
|
171 func_executable_p ()
|
|
172 {
|
|
173 test -f "$1" && test -x "$1"
|
|
174 }
|
|
175
|
|
176
|
|
177 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
|
|
178 # --------------------------------------------
|
|
179 # Search for either a program that responds to --version with output
|
|
180 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
|
|
181 # trying all the directories in PATH with each of the elements of
|
|
182 # PROGS_LIST.
|
|
183 #
|
|
184 # CHECK_FUNC should accept the path to a candidate program, and
|
|
185 # set $func_check_prog_result if it truncates its output less than
|
|
186 # $_G_path_prog_max characters.
|
|
187 func_path_progs ()
|
|
188 {
|
|
189 _G_progs_list=$1
|
|
190 _G_check_func=$2
|
|
191 _G_PATH=${3-"$PATH"}
|
|
192
|
|
193 _G_path_prog_max=0
|
|
194 _G_path_prog_found=false
|
|
195 _G_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
|
196 for _G_dir in $_G_PATH; do
|
|
197 IFS=$_G_save_IFS
|
|
198 test -z "$_G_dir" && _G_dir=.
|
|
199 for _G_prog_name in $_G_progs_list; do
|
|
200 for _exeext in '' .EXE; do
|
|
201 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
|
|
202 func_executable_p "$_G_path_prog" || continue
|
|
203 case `"$_G_path_prog" --version 2>&1` in
|
|
204 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
|
|
205 *) $_G_check_func $_G_path_prog
|
|
206 func_path_progs_result=$func_check_prog_result
|
|
207 ;;
|
|
208 esac
|
|
209 $_G_path_prog_found && break 3
|
|
210 done
|
|
211 done
|
|
212 done
|
|
213 IFS=$_G_save_IFS
|
|
214 test -z "$func_path_progs_result" && {
|
|
215 echo "no acceptable sed could be found in \$PATH" >&2
|
|
216 exit 1
|
|
217 }
|
|
218 }
|
|
219
|
|
220
|
|
221 # We want to be able to use the functions in this file before configure
|
|
222 # has figured out where the best binaries are kept, which means we have
|
|
223 # to search for them ourselves - except when the results are already set
|
|
224 # where we skip the searches.
|
|
225
|
|
226 # Unless the user overrides by setting SED, search the path for either GNU
|
|
227 # sed, or the sed that truncates its output the least.
|
|
228 test -z "$SED" && {
|
|
229 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
|
|
230 for _G_i in 1 2 3 4 5 6 7; do
|
|
231 _G_sed_script=$_G_sed_script$nl$_G_sed_script
|
|
232 done
|
|
233 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
|
|
234 _G_sed_script=
|
|
235
|
|
236 func_check_prog_sed ()
|
|
237 {
|
|
238 _G_path_prog=$1
|
|
239
|
|
240 _G_count=0
|
|
241 printf 0123456789 >conftest.in
|
|
242 while :
|
|
243 do
|
|
244 cat conftest.in conftest.in >conftest.tmp
|
|
245 mv conftest.tmp conftest.in
|
|
246 cp conftest.in conftest.nl
|
|
247 echo '' >> conftest.nl
|
|
248 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
|
|
249 diff conftest.out conftest.nl >/dev/null 2>&1 || break
|
|
250 _G_count=`expr $_G_count + 1`
|
|
251 if test "$_G_count" -gt "$_G_path_prog_max"; then
|
|
252 # Best one so far, save it but keep looking for a better one
|
|
253 func_check_prog_result=$_G_path_prog
|
|
254 _G_path_prog_max=$_G_count
|
|
255 fi
|
|
256 # 10*(2^10) chars as input seems more than enough
|
|
257 test 10 -lt "$_G_count" && break
|
|
258 done
|
|
259 rm -f conftest.in conftest.tmp conftest.nl conftest.out
|
|
260 }
|
|
261
|
|
262 func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
|
|
263 rm -f conftest.sed
|
|
264 SED=$func_path_progs_result
|
|
265 }
|
|
266
|
|
267
|
|
268 # Unless the user overrides by setting GREP, search the path for either GNU
|
|
269 # grep, or the grep that truncates its output the least.
|
|
270 test -z "$GREP" && {
|
|
271 func_check_prog_grep ()
|
|
272 {
|
|
273 _G_path_prog=$1
|
|
274
|
|
275 _G_count=0
|
|
276 _G_path_prog_max=0
|
|
277 printf 0123456789 >conftest.in
|
|
278 while :
|
|
279 do
|
|
280 cat conftest.in conftest.in >conftest.tmp
|
|
281 mv conftest.tmp conftest.in
|
|
282 cp conftest.in conftest.nl
|
|
283 echo 'GREP' >> conftest.nl
|
|
284 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
|
|
285 diff conftest.out conftest.nl >/dev/null 2>&1 || break
|
|
286 _G_count=`expr $_G_count + 1`
|
|
287 if test "$_G_count" -gt "$_G_path_prog_max"; then
|
|
288 # Best one so far, save it but keep looking for a better one
|
|
289 func_check_prog_result=$_G_path_prog
|
|
290 _G_path_prog_max=$_G_count
|
|
291 fi
|
|
292 # 10*(2^10) chars as input seems more than enough
|
|
293 test 10 -lt "$_G_count" && break
|
|
294 done
|
|
295 rm -f conftest.in conftest.tmp conftest.nl conftest.out
|
|
296 }
|
|
297
|
|
298 func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
|
|
299 GREP=$func_path_progs_result
|
|
300 }
|
|
301
|
|
302
|
|
303 ## ------------------------------- ##
|
|
304 ## User overridable command paths. ##
|
|
305 ## ------------------------------- ##
|
|
306
|
|
307 # All uppercase variable names are used for environment variables. These
|
|
308 # variables can be overridden by the user before calling a script that
|
|
309 # uses them if a suitable command of that name is not already available
|
|
310 # in the command search PATH.
|
|
311
|
|
312 : ${CP="cp -f"}
|
|
313 : ${ECHO="printf %s\n"}
|
|
314 : ${EGREP="$GREP -E"}
|
|
315 : ${FGREP="$GREP -F"}
|
|
316 : ${LN_S="ln -s"}
|
|
317 : ${MAKE="make"}
|
|
318 : ${MKDIR="mkdir"}
|
|
319 : ${MV="mv -f"}
|
|
320 : ${RM="rm -f"}
|
|
321 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
|
|
322
|
|
323
|
|
324 ## -------------------- ##
|
|
325 ## Useful sed snippets. ##
|
|
326 ## -------------------- ##
|
|
327
|
|
328 sed_dirname='s|/[^/]*$||'
|
|
329 sed_basename='s|^.*/||'
|
|
330
|
|
331 # Sed substitution that helps us do robust quoting. It backslashifies
|
|
332 # metacharacters that are still active within double-quoted strings.
|
|
333 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
|
|
334
|
|
335 # Same as above, but do not quote variable references.
|
|
336 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
|
|
337
|
|
338 # Sed substitution that turns a string into a regex matching for the
|
|
339 # string literally.
|
|
340 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
|
|
341
|
|
342 # Sed substitution that converts a w32 file name or path
|
|
343 # that contains forward slashes, into one that contains
|
|
344 # (escaped) backslashes. A very naive implementation.
|
|
345 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
|
|
346
|
|
347 # Re-'\' parameter expansions in output of sed_double_quote_subst that
|
|
348 # were '\'-ed in input to the same. If an odd number of '\' preceded a
|
|
349 # '$' in input to sed_double_quote_subst, that '$' was protected from
|
|
350 # expansion. Since each input '\' is now two '\'s, look for any number
|
|
351 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
|
|
352 _G_bs='\\'
|
|
353 _G_bs2='\\\\'
|
|
354 _G_bs4='\\\\\\\\'
|
|
355 _G_dollar='\$'
|
|
356 sed_double_backslash="\
|
|
357 s/$_G_bs4/&\\
|
|
358 /g
|
|
359 s/^$_G_bs2$_G_dollar/$_G_bs&/
|
|
360 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
|
|
361 s/\n//g"
|
|
362
|
|
363
|
|
364 ## ----------------- ##
|
|
365 ## Global variables. ##
|
|
366 ## ----------------- ##
|
|
367
|
|
368 # Except for the global variables explicitly listed below, the following
|
|
369 # functions in the '^func_' namespace, and the '^require_' namespace
|
|
370 # variables initialised in the 'Resource management' section, sourcing
|
|
371 # this file will not pollute your global namespace with anything
|
|
372 # else. There's no portable way to scope variables in Bourne shell
|
|
373 # though, so actually running these functions will sometimes place
|
|
374 # results into a variable named after the function, and often use
|
|
375 # temporary variables in the '^_G_' namespace. If you are careful to
|
|
376 # avoid using those namespaces casually in your sourcing script, things
|
|
377 # should continue to work as you expect. And, of course, you can freely
|
|
378 # overwrite any of the functions or variables defined here before
|
|
379 # calling anything to customize them.
|
|
380
|
|
381 EXIT_SUCCESS=0
|
|
382 EXIT_FAILURE=1
|
|
383 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
|
|
384 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
|
|
385
|
|
386 # Allow overriding, eg assuming that you follow the convention of
|
|
387 # putting '$debug_cmd' at the start of all your functions, you can get
|
|
388 # bash to show function call trace with:
|
|
389 #
|
|
390 # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
|
|
391 debug_cmd=${debug_cmd-":"}
|
|
392 exit_cmd=:
|
|
393
|
|
394 # By convention, finish your script with:
|
|
395 #
|
|
396 # exit $exit_status
|
|
397 #
|
|
398 # so that you can set exit_status to non-zero if you want to indicate
|
|
399 # something went wrong during execution without actually bailing out at
|
|
400 # the point of failure.
|
|
401 exit_status=$EXIT_SUCCESS
|
|
402
|
|
403 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
|
|
404 # is ksh but when the shell is invoked as "sh" and the current value of
|
|
405 # the _XPG environment variable is not equal to 1 (one), the special
|
|
406 # positional parameter $0, within a function call, is the name of the
|
|
407 # function.
|
|
408 progpath=$0
|
|
409
|
|
410 # The name of this program.
|
|
411 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
|
|
412
|
|
413 # Make sure we have an absolute progpath for reexecution:
|
|
414 case $progpath in
|
|
415 [\\/]*|[A-Za-z]:\\*) ;;
|
|
416 *[\\/]*)
|
|
417 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
|
|
418 progdir=`cd "$progdir" && pwd`
|
|
419 progpath=$progdir/$progname
|
|
420 ;;
|
|
421 *)
|
|
422 _G_IFS=$IFS
|
|
423 IFS=${PATH_SEPARATOR-:}
|
|
424 for progdir in $PATH; do
|
|
425 IFS=$_G_IFS
|
|
426 test -x "$progdir/$progname" && break
|
|
427 done
|
|
428 IFS=$_G_IFS
|
|
429 test -n "$progdir" || progdir=`pwd`
|
|
430 progpath=$progdir/$progname
|
|
431 ;;
|
|
432 esac
|
|
433
|
|
434
|
|
435 ## ----------------- ##
|
|
436 ## Standard options. ##
|
|
437 ## ----------------- ##
|
|
438
|
|
439 # The following options affect the operation of the functions defined
|
|
440 # below, and should be set appropriately depending on run-time para-
|
|
441 # meters passed on the command line.
|
|
442
|
|
443 opt_dry_run=false
|
|
444 opt_quiet=false
|
|
445 opt_verbose=false
|
|
446
|
|
447 # Categories 'all' and 'none' are always available. Append any others
|
|
448 # you will pass as the first argument to func_warning from your own
|
|
449 # code.
|
|
450 warning_categories=
|
|
451
|
|
452 # By default, display warnings according to 'opt_warning_types'. Set
|
|
453 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
|
|
454 # treat the next displayed warning as a fatal error.
|
|
455 warning_func=func_warn_and_continue
|
|
456
|
|
457 # Set to 'all' to display all warnings, 'none' to suppress all
|
|
458 # warnings, or a space delimited list of some subset of
|
|
459 # 'warning_categories' to display only the listed warnings.
|
|
460 opt_warning_types=all
|
|
461
|
|
462
|
|
463 ## -------------------- ##
|
|
464 ## Resource management. ##
|
|
465 ## -------------------- ##
|
|
466
|
|
467 # This section contains definitions for functions that each ensure a
|
|
468 # particular resource (a file, or a non-empty configuration variable for
|
|
469 # example) is available, and if appropriate to extract default values
|
|
470 # from pertinent package files. Call them using their associated
|
|
471 # 'require_*' variable to ensure that they are executed, at most, once.
|
|
472 #
|
|
473 # It's entirely deliberate that calling these functions can set
|
|
474 # variables that don't obey the namespace limitations obeyed by the rest
|
|
475 # of this file, in order that that they be as useful as possible to
|
|
476 # callers.
|
|
477
|
|
478
|
|
479 # require_term_colors
|
|
480 # -------------------
|
|
481 # Allow display of bold text on terminals that support it.
|
|
482 require_term_colors=func_require_term_colors
|
|
483 func_require_term_colors ()
|
|
484 {
|
|
485 $debug_cmd
|
|
486
|
|
487 test -t 1 && {
|
|
488 # COLORTERM and USE_ANSI_COLORS environment variables take
|
|
489 # precedence, because most terminfo databases neglect to describe
|
|
490 # whether color sequences are supported.
|
|
491 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
|
|
492
|
|
493 if test 1 = "$USE_ANSI_COLORS"; then
|
|
494 # Standard ANSI escape sequences
|
|
495 tc_reset='[0m'
|
|
496 tc_bold='[1m'; tc_standout='[7m'
|
|
497 tc_red='[31m'; tc_green='[32m'
|
|
498 tc_blue='[34m'; tc_cyan='[36m'
|
|
499 else
|
|
500 # Otherwise trust the terminfo database after all.
|
|
501 test -n "`tput sgr0 2>/dev/null`" && {
|
|
502 tc_reset=`tput sgr0`
|
|
503 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
|
|
504 tc_standout=$tc_bold
|
|
505 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
|
|
506 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
|
|
507 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
|
|
508 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
|
|
509 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
|
|
510 }
|
|
511 fi
|
|
512 }
|
|
513
|
|
514 require_term_colors=:
|
|
515 }
|
|
516
|
|
517
|
|
518 ## ----------------- ##
|
|
519 ## Function library. ##
|
|
520 ## ----------------- ##
|
|
521
|
|
522 # This section contains a variety of useful functions to call in your
|
|
523 # scripts. Take note of the portable wrappers for features provided by
|
|
524 # some modern shells, which will fall back to slower equivalents on
|
|
525 # less featureful shells.
|
|
526
|
|
527
|
|
528 # func_append VAR VALUE
|
|
529 # ---------------------
|
|
530 # Append VALUE onto the existing contents of VAR.
|
|
531
|
|
532 # We should try to minimise forks, especially on Windows where they are
|
|
533 # unreasonably slow, so skip the feature probes when bash or zsh are
|
|
534 # being used:
|
|
535 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
|
|
536 : ${_G_HAVE_ARITH_OP="yes"}
|
|
537 : ${_G_HAVE_XSI_OPS="yes"}
|
|
538 # The += operator was introduced in bash 3.1
|
|
539 case $BASH_VERSION in
|
|
540 [12].* | 3.0 | 3.0*) ;;
|
|
541 *)
|
|
542 : ${_G_HAVE_PLUSEQ_OP="yes"}
|
|
543 ;;
|
|
544 esac
|
|
545 fi
|
|
546
|
|
547 # _G_HAVE_PLUSEQ_OP
|
|
548 # Can be empty, in which case the shell is probed, "yes" if += is
|
|
549 # useable or anything else if it does not work.
|
|
550 test -z "$_G_HAVE_PLUSEQ_OP" \
|
|
551 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
|
|
552 && _G_HAVE_PLUSEQ_OP=yes
|
|
553
|
|
554 if test yes = "$_G_HAVE_PLUSEQ_OP"
|
|
555 then
|
|
556 # This is an XSI compatible shell, allowing a faster implementation...
|
|
557 eval 'func_append ()
|
|
558 {
|
|
559 $debug_cmd
|
|
560
|
|
561 eval "$1+=\$2"
|
|
562 }'
|
|
563 else
|
|
564 # ...otherwise fall back to using expr, which is often a shell builtin.
|
|
565 func_append ()
|
|
566 {
|
|
567 $debug_cmd
|
|
568
|
|
569 eval "$1=\$$1\$2"
|
|
570 }
|
|
571 fi
|
|
572
|
|
573
|
|
574 # func_append_quoted VAR VALUE
|
|
575 # ----------------------------
|
|
576 # Quote VALUE and append to the end of shell variable VAR, separated
|
|
577 # by a space.
|
|
578 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
|
|
579 eval 'func_append_quoted ()
|
|
580 {
|
|
581 $debug_cmd
|
|
582
|
|
583 func_quote_for_eval "$2"
|
|
584 eval "$1+=\\ \$func_quote_for_eval_result"
|
|
585 }'
|
|
586 else
|
|
587 func_append_quoted ()
|
|
588 {
|
|
589 $debug_cmd
|
|
590
|
|
591 func_quote_for_eval "$2"
|
|
592 eval "$1=\$$1\\ \$func_quote_for_eval_result"
|
|
593 }
|
|
594 fi
|
|
595
|
|
596
|
|
597 # func_append_uniq VAR VALUE
|
|
598 # --------------------------
|
|
599 # Append unique VALUE onto the existing contents of VAR, assuming
|
|
600 # entries are delimited by the first character of VALUE. For example:
|
|
601 #
|
|
602 # func_append_uniq options " --another-option option-argument"
|
|
603 #
|
|
604 # will only append to $options if " --another-option option-argument "
|
|
605 # is not already present somewhere in $options already (note spaces at
|
|
606 # each end implied by leading space in second argument).
|
|
607 func_append_uniq ()
|
|
608 {
|
|
609 $debug_cmd
|
|
610
|
|
611 eval _G_current_value='`$ECHO $'$1'`'
|
|
612 _G_delim=`expr "$2" : '\(.\)'`
|
|
613
|
|
614 case $_G_delim$_G_current_value$_G_delim in
|
|
615 *"$2$_G_delim"*) ;;
|
|
616 *) func_append "$@" ;;
|
|
617 esac
|
|
618 }
|
|
619
|
|
620
|
|
621 # func_arith TERM...
|
|
622 # ------------------
|
|
623 # Set func_arith_result to the result of evaluating TERMs.
|
|
624 test -z "$_G_HAVE_ARITH_OP" \
|
|
625 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
|
|
626 && _G_HAVE_ARITH_OP=yes
|
|
627
|
|
628 if test yes = "$_G_HAVE_ARITH_OP"; then
|
|
629 eval 'func_arith ()
|
|
630 {
|
|
631 $debug_cmd
|
|
632
|
|
633 func_arith_result=$(( $* ))
|
|
634 }'
|
|
635 else
|
|
636 func_arith ()
|
|
637 {
|
|
638 $debug_cmd
|
|
639
|
|
640 func_arith_result=`expr "$@"`
|
|
641 }
|
|
642 fi
|
|
643
|
|
644
|
|
645 # func_basename FILE
|
|
646 # ------------------
|
|
647 # Set func_basename_result to FILE with everything up to and including
|
|
648 # the last / stripped.
|
|
649 if test yes = "$_G_HAVE_XSI_OPS"; then
|
|
650 # If this shell supports suffix pattern removal, then use it to avoid
|
|
651 # forking. Hide the definitions single quotes in case the shell chokes
|
|
652 # on unsupported syntax...
|
|
653 _b='func_basename_result=${1##*/}'
|
|
654 _d='case $1 in
|
|
655 */*) func_dirname_result=${1%/*}$2 ;;
|
|
656 * ) func_dirname_result=$3 ;;
|
|
657 esac'
|
|
658
|
|
659 else
|
|
660 # ...otherwise fall back to using sed.
|
|
661 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
|
|
662 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
|
|
663 if test "X$func_dirname_result" = "X$1"; then
|
|
664 func_dirname_result=$3
|
|
665 else
|
|
666 func_append func_dirname_result "$2"
|
|
667 fi'
|
|
668 fi
|
|
669
|
|
670 eval 'func_basename ()
|
|
671 {
|
|
672 $debug_cmd
|
|
673
|
|
674 '"$_b"'
|
|
675 }'
|
|
676
|
|
677
|
|
678 # func_dirname FILE APPEND NONDIR_REPLACEMENT
|
|
679 # -------------------------------------------
|
|
680 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
|
|
681 # otherwise set result to NONDIR_REPLACEMENT.
|
|
682 eval 'func_dirname ()
|
|
683 {
|
|
684 $debug_cmd
|
|
685
|
|
686 '"$_d"'
|
|
687 }'
|
|
688
|
|
689
|
|
690 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
|
|
691 # --------------------------------------------------------
|
|
692 # Perform func_basename and func_dirname in a single function
|
|
693 # call:
|
|
694 # dirname: Compute the dirname of FILE. If nonempty,
|
|
695 # add APPEND to the result, otherwise set result
|
|
696 # to NONDIR_REPLACEMENT.
|
|
697 # value returned in "$func_dirname_result"
|
|
698 # basename: Compute filename of FILE.
|
|
699 # value retuned in "$func_basename_result"
|
|
700 # For efficiency, we do not delegate to the functions above but instead
|
|
701 # duplicate the functionality here.
|
|
702 eval 'func_dirname_and_basename ()
|
|
703 {
|
|
704 $debug_cmd
|
|
705
|
|
706 '"$_b"'
|
|
707 '"$_d"'
|
|
708 }'
|
|
709
|
|
710
|
|
711 # func_echo ARG...
|
|
712 # ----------------
|
|
713 # Echo program name prefixed message.
|
|
714 func_echo ()
|
|
715 {
|
|
716 $debug_cmd
|
|
717
|
|
718 _G_message=$*
|
|
719
|
|
720 func_echo_IFS=$IFS
|
|
721 IFS=$nl
|
|
722 for _G_line in $_G_message; do
|
|
723 IFS=$func_echo_IFS
|
|
724 $ECHO "$progname: $_G_line"
|
|
725 done
|
|
726 IFS=$func_echo_IFS
|
|
727 }
|
|
728
|
|
729
|
|
730 # func_echo_all ARG...
|
|
731 # --------------------
|
|
732 # Invoke $ECHO with all args, space-separated.
|
|
733 func_echo_all ()
|
|
734 {
|
|
735 $ECHO "$*"
|
|
736 }
|
|
737
|
|
738
|
|
739 # func_echo_infix_1 INFIX ARG...
|
|
740 # ------------------------------
|
|
741 # Echo program name, followed by INFIX on the first line, with any
|
|
742 # additional lines not showing INFIX.
|
|
743 func_echo_infix_1 ()
|
|
744 {
|
|
745 $debug_cmd
|
|
746
|
|
747 $require_term_colors
|
|
748
|
|
749 _G_infix=$1; shift
|
|
750 _G_indent=$_G_infix
|
|
751 _G_prefix="$progname: $_G_infix: "
|
|
752 _G_message=$*
|
|
753
|
|
754 # Strip color escape sequences before counting printable length
|
|
755 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
|
|
756 do
|
|
757 test -n "$_G_tc" && {
|
|
758 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
|
|
759 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
|
|
760 }
|
|
761 done
|
|
762 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
|
|
763
|
|
764 func_echo_infix_1_IFS=$IFS
|
|
765 IFS=$nl
|
|
766 for _G_line in $_G_message; do
|
|
767 IFS=$func_echo_infix_1_IFS
|
|
768 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
|
|
769 _G_prefix=$_G_indent
|
|
770 done
|
|
771 IFS=$func_echo_infix_1_IFS
|
|
772 }
|
|
773
|
|
774
|
|
775 # func_error ARG...
|
|
776 # -----------------
|
|
777 # Echo program name prefixed message to standard error.
|
|
778 func_error ()
|
|
779 {
|
|
780 $debug_cmd
|
|
781
|
|
782 $require_term_colors
|
|
783
|
|
784 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
|
|
785 }
|
|
786
|
|
787
|
|
788 # func_fatal_error ARG...
|
|
789 # -----------------------
|
|
790 # Echo program name prefixed message to standard error, and exit.
|
|
791 func_fatal_error ()
|
|
792 {
|
|
793 $debug_cmd
|
|
794
|
|
795 func_error "$*"
|
|
796 exit $EXIT_FAILURE
|
|
797 }
|
|
798
|
|
799
|
|
800 # func_grep EXPRESSION FILENAME
|
|
801 # -----------------------------
|
|
802 # Check whether EXPRESSION matches any line of FILENAME, without output.
|
|
803 func_grep ()
|
|
804 {
|
|
805 $debug_cmd
|
|
806
|
|
807 $GREP "$1" "$2" >/dev/null 2>&1
|
|
808 }
|
|
809
|
|
810
|
|
811 # func_len STRING
|
|
812 # ---------------
|
|
813 # Set func_len_result to the length of STRING. STRING may not
|
|
814 # start with a hyphen.
|
|
815 test -z "$_G_HAVE_XSI_OPS" \
|
|
816 && (eval 'x=a/b/c;
|
|
817 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
|
|
818 && _G_HAVE_XSI_OPS=yes
|
|
819
|
|
820 if test yes = "$_G_HAVE_XSI_OPS"; then
|
|
821 eval 'func_len ()
|
|
822 {
|
|
823 $debug_cmd
|
|
824
|
|
825 func_len_result=${#1}
|
|
826 }'
|
|
827 else
|
|
828 func_len ()
|
|
829 {
|
|
830 $debug_cmd
|
|
831
|
|
832 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
|
|
833 }
|
|
834 fi
|
|
835
|
|
836
|
|
837 # func_mkdir_p DIRECTORY-PATH
|
|
838 # ---------------------------
|
|
839 # Make sure the entire path to DIRECTORY-PATH is available.
|
|
840 func_mkdir_p ()
|
|
841 {
|
|
842 $debug_cmd
|
|
843
|
|
844 _G_directory_path=$1
|
|
845 _G_dir_list=
|
|
846
|
|
847 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
|
|
848
|
|
849 # Protect directory names starting with '-'
|
|
850 case $_G_directory_path in
|
|
851 -*) _G_directory_path=./$_G_directory_path ;;
|
|
852 esac
|
|
853
|
|
854 # While some portion of DIR does not yet exist...
|
|
855 while test ! -d "$_G_directory_path"; do
|
|
856 # ...make a list in topmost first order. Use a colon delimited
|
|
857 # list incase some portion of path contains whitespace.
|
|
858 _G_dir_list=$_G_directory_path:$_G_dir_list
|
|
859
|
|
860 # If the last portion added has no slash in it, the list is done
|
|
861 case $_G_directory_path in */*) ;; *) break ;; esac
|
|
862
|
|
863 # ...otherwise throw away the child directory and loop
|
|
864 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
|
|
865 done
|
|
866 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
|
|
867
|
|
868 func_mkdir_p_IFS=$IFS; IFS=:
|
|
869 for _G_dir in $_G_dir_list; do
|
|
870 IFS=$func_mkdir_p_IFS
|
|
871 # mkdir can fail with a 'File exist' error if two processes
|
|
872 # try to create one of the directories concurrently. Don't
|
|
873 # stop in that case!
|
|
874 $MKDIR "$_G_dir" 2>/dev/null || :
|
|
875 done
|
|
876 IFS=$func_mkdir_p_IFS
|
|
877
|
|
878 # Bail out if we (or some other process) failed to create a directory.
|
|
879 test -d "$_G_directory_path" || \
|
|
880 func_fatal_error "Failed to create '$1'"
|
|
881 fi
|
|
882 }
|
|
883
|
|
884
|
|
885 # func_mktempdir [BASENAME]
|
|
886 # -------------------------
|
|
887 # Make a temporary directory that won't clash with other running
|
|
888 # libtool processes, and avoids race conditions if possible. If
|
|
889 # given, BASENAME is the basename for that directory.
|
|
890 func_mktempdir ()
|
|
891 {
|
|
892 $debug_cmd
|
|
893
|
|
894 _G_template=${TMPDIR-/tmp}/${1-$progname}
|
|
895
|
|
896 if test : = "$opt_dry_run"; then
|
|
897 # Return a directory name, but don't create it in dry-run mode
|
|
898 _G_tmpdir=$_G_template-$$
|
|
899 else
|
|
900
|
|
901 # If mktemp works, use that first and foremost
|
|
902 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
|
|
903
|
|
904 if test ! -d "$_G_tmpdir"; then
|
|
905 # Failing that, at least try and use $RANDOM to avoid a race
|
|
906 _G_tmpdir=$_G_template-${RANDOM-0}$$
|
|
907
|
|
908 func_mktempdir_umask=`umask`
|
|
909 umask 0077
|
|
910 $MKDIR "$_G_tmpdir"
|
|
911 umask $func_mktempdir_umask
|
|
912 fi
|
|
913
|
|
914 # If we're not in dry-run mode, bomb out on failure
|
|
915 test -d "$_G_tmpdir" || \
|
|
916 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
|
|
917 fi
|
|
918
|
|
919 $ECHO "$_G_tmpdir"
|
|
920 }
|
|
921
|
|
922
|
|
923 # func_normal_abspath PATH
|
|
924 # ------------------------
|
|
925 # Remove doubled-up and trailing slashes, "." path components,
|
|
926 # and cancel out any ".." path components in PATH after making
|
|
927 # it an absolute path.
|
|
928 func_normal_abspath ()
|
|
929 {
|
|
930 $debug_cmd
|
|
931
|
|
932 # These SED scripts presuppose an absolute path with a trailing slash.
|
|
933 _G_pathcar='s|^/\([^/]*\).*$|\1|'
|
|
934 _G_pathcdr='s|^/[^/]*||'
|
|
935 _G_removedotparts=':dotsl
|
|
936 s|/\./|/|g
|
|
937 t dotsl
|
|
938 s|/\.$|/|'
|
|
939 _G_collapseslashes='s|/\{1,\}|/|g'
|
|
940 _G_finalslash='s|/*$|/|'
|
|
941
|
|
942 # Start from root dir and reassemble the path.
|
|
943 func_normal_abspath_result=
|
|
944 func_normal_abspath_tpath=$1
|
|
945 func_normal_abspath_altnamespace=
|
|
946 case $func_normal_abspath_tpath in
|
|
947 "")
|
|
948 # Empty path, that just means $cwd.
|
|
949 func_stripname '' '/' "`pwd`"
|
|
950 func_normal_abspath_result=$func_stripname_result
|
|
951 return
|
|
952 ;;
|
|
953 # The next three entries are used to spot a run of precisely
|
|
954 # two leading slashes without using negated character classes;
|
|
955 # we take advantage of case's first-match behaviour.
|
|
956 ///*)
|
|
957 # Unusual form of absolute path, do nothing.
|
|
958 ;;
|
|
959 //*)
|
|
960 # Not necessarily an ordinary path; POSIX reserves leading '//'
|
|
961 # and for example Cygwin uses it to access remote file shares
|
|
962 # over CIFS/SMB, so we conserve a leading double slash if found.
|
|
963 func_normal_abspath_altnamespace=/
|
|
964 ;;
|
|
965 /*)
|
|
966 # Absolute path, do nothing.
|
|
967 ;;
|
|
968 *)
|
|
969 # Relative path, prepend $cwd.
|
|
970 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
|
|
971 ;;
|
|
972 esac
|
|
973
|
|
974 # Cancel out all the simple stuff to save iterations. We also want
|
|
975 # the path to end with a slash for ease of parsing, so make sure
|
|
976 # there is one (and only one) here.
|
|
977 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
|
|
978 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
|
|
979 while :; do
|
|
980 # Processed it all yet?
|
|
981 if test / = "$func_normal_abspath_tpath"; then
|
|
982 # If we ascended to the root using ".." the result may be empty now.
|
|
983 if test -z "$func_normal_abspath_result"; then
|
|
984 func_normal_abspath_result=/
|
|
985 fi
|
|
986 break
|
|
987 fi
|
|
988 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
|
|
989 -e "$_G_pathcar"`
|
|
990 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
|
|
991 -e "$_G_pathcdr"`
|
|
992 # Figure out what to do with it
|
|
993 case $func_normal_abspath_tcomponent in
|
|
994 "")
|
|
995 # Trailing empty path component, ignore it.
|
|
996 ;;
|
|
997 ..)
|
|
998 # Parent dir; strip last assembled component from result.
|
|
999 func_dirname "$func_normal_abspath_result"
|
|
1000 func_normal_abspath_result=$func_dirname_result
|
|
1001 ;;
|
|
1002 *)
|
|
1003 # Actual path component, append it.
|
|
1004 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
|
|
1005 ;;
|
|
1006 esac
|
|
1007 done
|
|
1008 # Restore leading double-slash if one was found on entry.
|
|
1009 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
|
|
1010 }
|
|
1011
|
|
1012
|
|
1013 # func_notquiet ARG...
|
|
1014 # --------------------
|
|
1015 # Echo program name prefixed message only when not in quiet mode.
|
|
1016 func_notquiet ()
|
|
1017 {
|
|
1018 $debug_cmd
|
|
1019
|
|
1020 $opt_quiet || func_echo ${1+"$@"}
|
|
1021
|
|
1022 # A bug in bash halts the script if the last line of a function
|
|
1023 # fails when set -e is in force, so we need another command to
|
|
1024 # work around that:
|
|
1025 :
|
|
1026 }
|
|
1027
|
|
1028
|
|
1029 # func_relative_path SRCDIR DSTDIR
|
|
1030 # --------------------------------
|
|
1031 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
|
|
1032 func_relative_path ()
|
|
1033 {
|
|
1034 $debug_cmd
|
|
1035
|
|
1036 func_relative_path_result=
|
|
1037 func_normal_abspath "$1"
|
|
1038 func_relative_path_tlibdir=$func_normal_abspath_result
|
|
1039 func_normal_abspath "$2"
|
|
1040 func_relative_path_tbindir=$func_normal_abspath_result
|
|
1041
|
|
1042 # Ascend the tree starting from libdir
|
|
1043 while :; do
|
|
1044 # check if we have found a prefix of bindir
|
|
1045 case $func_relative_path_tbindir in
|
|
1046 $func_relative_path_tlibdir)
|
|
1047 # found an exact match
|
|
1048 func_relative_path_tcancelled=
|
|
1049 break
|
|
1050 ;;
|
|
1051 $func_relative_path_tlibdir*)
|
|
1052 # found a matching prefix
|
|
1053 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
|
|
1054 func_relative_path_tcancelled=$func_stripname_result
|
|
1055 if test -z "$func_relative_path_result"; then
|
|
1056 func_relative_path_result=.
|
|
1057 fi
|
|
1058 break
|
|
1059 ;;
|
|
1060 *)
|
|
1061 func_dirname $func_relative_path_tlibdir
|
|
1062 func_relative_path_tlibdir=$func_dirname_result
|
|
1063 if test -z "$func_relative_path_tlibdir"; then
|
|
1064 # Have to descend all the way to the root!
|
|
1065 func_relative_path_result=../$func_relative_path_result
|
|
1066 func_relative_path_tcancelled=$func_relative_path_tbindir
|
|
1067 break
|
|
1068 fi
|
|
1069 func_relative_path_result=../$func_relative_path_result
|
|
1070 ;;
|
|
1071 esac
|
|
1072 done
|
|
1073
|
|
1074 # Now calculate path; take care to avoid doubling-up slashes.
|
|
1075 func_stripname '' '/' "$func_relative_path_result"
|
|
1076 func_relative_path_result=$func_stripname_result
|
|
1077 func_stripname '/' '/' "$func_relative_path_tcancelled"
|
|
1078 if test -n "$func_stripname_result"; then
|
|
1079 func_append func_relative_path_result "/$func_stripname_result"
|
|
1080 fi
|
|
1081
|
|
1082 # Normalisation. If bindir is libdir, return '.' else relative path.
|
|
1083 if test -n "$func_relative_path_result"; then
|
|
1084 func_stripname './' '' "$func_relative_path_result"
|
|
1085 func_relative_path_result=$func_stripname_result
|
|
1086 fi
|
|
1087
|
|
1088 test -n "$func_relative_path_result" || func_relative_path_result=.
|
|
1089
|
|
1090 :
|
|
1091 }
|
|
1092
|
|
1093
|
|
1094 # func_quote_for_eval ARG...
|
|
1095 # --------------------------
|
|
1096 # Aesthetically quote ARGs to be evaled later.
|
|
1097 # This function returns two values:
|
|
1098 # i) func_quote_for_eval_result
|
|
1099 # double-quoted, suitable for a subsequent eval
|
|
1100 # ii) func_quote_for_eval_unquoted_result
|
|
1101 # has all characters that are still active within double
|
|
1102 # quotes backslashified.
|
|
1103 func_quote_for_eval ()
|
|
1104 {
|
|
1105 $debug_cmd
|
|
1106
|
|
1107 func_quote_for_eval_unquoted_result=
|
|
1108 func_quote_for_eval_result=
|
|
1109 while test 0 -lt $#; do
|
|
1110 case $1 in
|
|
1111 *[\\\`\"\$]*)
|
|
1112 _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
|
|
1113 *)
|
|
1114 _G_unquoted_arg=$1 ;;
|
|
1115 esac
|
|
1116 if test -n "$func_quote_for_eval_unquoted_result"; then
|
|
1117 func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
|
|
1118 else
|
|
1119 func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
|
|
1120 fi
|
|
1121
|
|
1122 case $_G_unquoted_arg in
|
|
1123 # Double-quote args containing shell metacharacters to delay
|
|
1124 # word splitting, command substitution and variable expansion
|
|
1125 # for a subsequent eval.
|
|
1126 # Many Bourne shells cannot handle close brackets correctly
|
|
1127 # in scan sets, so we specify it separately.
|
|
1128 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
|
1129 _G_quoted_arg=\"$_G_unquoted_arg\"
|
|
1130 ;;
|
|
1131 *)
|
|
1132 _G_quoted_arg=$_G_unquoted_arg
|
|
1133 ;;
|
|
1134 esac
|
|
1135
|
|
1136 if test -n "$func_quote_for_eval_result"; then
|
|
1137 func_append func_quote_for_eval_result " $_G_quoted_arg"
|
|
1138 else
|
|
1139 func_append func_quote_for_eval_result "$_G_quoted_arg"
|
|
1140 fi
|
|
1141 shift
|
|
1142 done
|
|
1143 }
|
|
1144
|
|
1145
|
|
1146 # func_quote_for_expand ARG
|
|
1147 # -------------------------
|
|
1148 # Aesthetically quote ARG to be evaled later; same as above,
|
|
1149 # but do not quote variable references.
|
|
1150 func_quote_for_expand ()
|
|
1151 {
|
|
1152 $debug_cmd
|
|
1153
|
|
1154 case $1 in
|
|
1155 *[\\\`\"]*)
|
|
1156 _G_arg=`$ECHO "$1" | $SED \
|
|
1157 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
|
|
1158 *)
|
|
1159 _G_arg=$1 ;;
|
|
1160 esac
|
|
1161
|
|
1162 case $_G_arg in
|
|
1163 # Double-quote args containing shell metacharacters to delay
|
|
1164 # word splitting and command substitution for a subsequent eval.
|
|
1165 # Many Bourne shells cannot handle close brackets correctly
|
|
1166 # in scan sets, so we specify it separately.
|
|
1167 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
|
1168 _G_arg=\"$_G_arg\"
|
|
1169 ;;
|
|
1170 esac
|
|
1171
|
|
1172 func_quote_for_expand_result=$_G_arg
|
|
1173 }
|
|
1174
|
|
1175
|
|
1176 # func_stripname PREFIX SUFFIX NAME
|
|
1177 # ---------------------------------
|
|
1178 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
|
|
1179 # PREFIX and SUFFIX must not contain globbing or regex special
|
|
1180 # characters, hashes, percent signs, but SUFFIX may contain a leading
|
|
1181 # dot (in which case that matches only a dot).
|
|
1182 if test yes = "$_G_HAVE_XSI_OPS"; then
|
|
1183 eval 'func_stripname ()
|
|
1184 {
|
|
1185 $debug_cmd
|
|
1186
|
|
1187 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
|
|
1188 # positional parameters, so assign one to ordinary variable first.
|
|
1189 func_stripname_result=$3
|
|
1190 func_stripname_result=${func_stripname_result#"$1"}
|
|
1191 func_stripname_result=${func_stripname_result%"$2"}
|
|
1192 }'
|
|
1193 else
|
|
1194 func_stripname ()
|
|
1195 {
|
|
1196 $debug_cmd
|
|
1197
|
|
1198 case $2 in
|
|
1199 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
|
|
1200 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
|
|
1201 esac
|
|
1202 }
|
|
1203 fi
|
|
1204
|
|
1205
|
|
1206 # func_show_eval CMD [FAIL_EXP]
|
|
1207 # -----------------------------
|
|
1208 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
|
|
1209 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
|
|
1210 # is given, then evaluate it.
|
|
1211 func_show_eval ()
|
|
1212 {
|
|
1213 $debug_cmd
|
|
1214
|
|
1215 _G_cmd=$1
|
|
1216 _G_fail_exp=${2-':'}
|
|
1217
|
|
1218 func_quote_for_expand "$_G_cmd"
|
|
1219 eval "func_notquiet $func_quote_for_expand_result"
|
|
1220
|
|
1221 $opt_dry_run || {
|
|
1222 eval "$_G_cmd"
|
|
1223 _G_status=$?
|
|
1224 if test 0 -ne "$_G_status"; then
|
|
1225 eval "(exit $_G_status); $_G_fail_exp"
|
|
1226 fi
|
|
1227 }
|
|
1228 }
|
|
1229
|
|
1230
|
|
1231 # func_show_eval_locale CMD [FAIL_EXP]
|
|
1232 # ------------------------------------
|
|
1233 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
|
|
1234 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
|
|
1235 # is given, then evaluate it. Use the saved locale for evaluation.
|
|
1236 func_show_eval_locale ()
|
|
1237 {
|
|
1238 $debug_cmd
|
|
1239
|
|
1240 _G_cmd=$1
|
|
1241 _G_fail_exp=${2-':'}
|
|
1242
|
|
1243 $opt_quiet || {
|
|
1244 func_quote_for_expand "$_G_cmd"
|
|
1245 eval "func_echo $func_quote_for_expand_result"
|
|
1246 }
|
|
1247
|
|
1248 $opt_dry_run || {
|
|
1249 eval "$_G_user_locale
|
|
1250 $_G_cmd"
|
|
1251 _G_status=$?
|
|
1252 eval "$_G_safe_locale"
|
|
1253 if test 0 -ne "$_G_status"; then
|
|
1254 eval "(exit $_G_status); $_G_fail_exp"
|
|
1255 fi
|
|
1256 }
|
|
1257 }
|
|
1258
|
|
1259
|
|
1260 # func_tr_sh
|
|
1261 # ----------
|
|
1262 # Turn $1 into a string suitable for a shell variable name.
|
|
1263 # Result is stored in $func_tr_sh_result. All characters
|
|
1264 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
|
|
1265 # if $1 begins with a digit, a '_' is prepended as well.
|
|
1266 func_tr_sh ()
|
|
1267 {
|
|
1268 $debug_cmd
|
|
1269
|
|
1270 case $1 in
|
|
1271 [0-9]* | *[!a-zA-Z0-9_]*)
|
|
1272 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
|
|
1273 ;;
|
|
1274 * )
|
|
1275 func_tr_sh_result=$1
|
|
1276 ;;
|
|
1277 esac
|
|
1278 }
|
|
1279
|
|
1280
|
|
1281 # func_verbose ARG...
|
|
1282 # -------------------
|
|
1283 # Echo program name prefixed message in verbose mode only.
|
|
1284 func_verbose ()
|
|
1285 {
|
|
1286 $debug_cmd
|
|
1287
|
|
1288 $opt_verbose && func_echo "$*"
|
|
1289
|
|
1290 :
|
|
1291 }
|
|
1292
|
|
1293
|
|
1294 # func_warn_and_continue ARG...
|
|
1295 # -----------------------------
|
|
1296 # Echo program name prefixed warning message to standard error.
|
|
1297 func_warn_and_continue ()
|
|
1298 {
|
|
1299 $debug_cmd
|
|
1300
|
|
1301 $require_term_colors
|
|
1302
|
|
1303 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
|
|
1304 }
|
|
1305
|
|
1306
|
|
1307 # func_warning CATEGORY ARG...
|
|
1308 # ----------------------------
|
|
1309 # Echo program name prefixed warning message to standard error. Warning
|
|
1310 # messages can be filtered according to CATEGORY, where this function
|
|
1311 # elides messages where CATEGORY is not listed in the global variable
|
|
1312 # 'opt_warning_types'.
|
|
1313 func_warning ()
|
|
1314 {
|
|
1315 $debug_cmd
|
|
1316
|
|
1317 # CATEGORY must be in the warning_categories list!
|
|
1318 case " $warning_categories " in
|
|
1319 *" $1 "*) ;;
|
|
1320 *) func_internal_error "invalid warning category '$1'" ;;
|
|
1321 esac
|
|
1322
|
|
1323 _G_category=$1
|
|
1324 shift
|
|
1325
|
|
1326 case " $opt_warning_types " in
|
|
1327 *" $_G_category "*) $warning_func ${1+"$@"} ;;
|
|
1328 esac
|
|
1329 }
|
|
1330
|
|
1331
|
|
1332 # func_sort_ver VER1 VER2
|
|
1333 # -----------------------
|
|
1334 # 'sort -V' is not generally available.
|
|
1335 # Note this deviates from the version comparison in automake
|
|
1336 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
|
|
1337 # but this should suffice as we won't be specifying old
|
|
1338 # version formats or redundant trailing .0 in bootstrap.conf.
|
|
1339 # If we did want full compatibility then we should probably
|
|
1340 # use m4_version_compare from autoconf.
|
|
1341 func_sort_ver ()
|
|
1342 {
|
|
1343 $debug_cmd
|
|
1344
|
|
1345 printf '%s\n%s\n' "$1" "$2" \
|
|
1346 | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
|
|
1347 }
|
|
1348
|
|
1349 # func_lt_ver PREV CURR
|
|
1350 # ---------------------
|
|
1351 # Return true if PREV and CURR are in the correct order according to
|
|
1352 # func_sort_ver, otherwise false. Use it like this:
|
|
1353 #
|
|
1354 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
|
|
1355 func_lt_ver ()
|
|
1356 {
|
|
1357 $debug_cmd
|
|
1358
|
|
1359 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
|
|
1360 }
|
|
1361
|
|
1362
|
|
1363 # Local variables:
|
|
1364 # mode: shell-script
|
|
1365 # sh-indentation: 2
|
|
1366 # eval: (add-hook 'before-save-hook 'time-stamp)
|
|
1367 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
|
|
1368 # time-stamp-time-zone: "UTC"
|
|
1369 # End:
|
|
1370 #! /bin/sh
|
|
1371
|
|
1372 # Set a version string for this script.
|
|
1373 scriptversion=2014-01-07.03; # UTC
|
|
1374
|
|
1375 # A portable, pluggable option parser for Bourne shell.
|
|
1376 # Written by Gary V. Vaughan, 2010
|
|
1377
|
|
1378 # Copyright (C) 2010-2015 Free Software Foundation, Inc.
|
|
1379 # This is free software; see the source for copying conditions. There is NO
|
|
1380 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
1381
|
|
1382 # This program is free software: you can redistribute it and/or modify
|
|
1383 # it under the terms of the GNU General Public License as published by
|
|
1384 # the Free Software Foundation, either version 3 of the License, or
|
|
1385 # (at your option) any later version.
|
|
1386
|
|
1387 # This program is distributed in the hope that it will be useful,
|
|
1388 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1389 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1390 # GNU General Public License for more details.
|
|
1391
|
|
1392 # You should have received a copy of the GNU General Public License
|
|
1393 # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
1394
|
|
1395 # Please report bugs or propose patches to gary@gnu.org.
|
|
1396
|
|
1397
|
|
1398 ## ------ ##
|
|
1399 ## Usage. ##
|
|
1400 ## ------ ##
|
|
1401
|
|
1402 # This file is a library for parsing options in your shell scripts along
|
|
1403 # with assorted other useful supporting features that you can make use
|
|
1404 # of too.
|
|
1405 #
|
|
1406 # For the simplest scripts you might need only:
|
|
1407 #
|
|
1408 # #!/bin/sh
|
|
1409 # . relative/path/to/funclib.sh
|
|
1410 # . relative/path/to/options-parser
|
|
1411 # scriptversion=1.0
|
|
1412 # func_options ${1+"$@"}
|
|
1413 # eval set dummy "$func_options_result"; shift
|
|
1414 # ...rest of your script...
|
|
1415 #
|
|
1416 # In order for the '--version' option to work, you will need to have a
|
|
1417 # suitably formatted comment like the one at the top of this file
|
|
1418 # starting with '# Written by ' and ending with '# warranty; '.
|
|
1419 #
|
|
1420 # For '-h' and '--help' to work, you will also need a one line
|
|
1421 # description of your script's purpose in a comment directly above the
|
|
1422 # '# Written by ' line, like the one at the top of this file.
|
|
1423 #
|
|
1424 # The default options also support '--debug', which will turn on shell
|
|
1425 # execution tracing (see the comment above debug_cmd below for another
|
|
1426 # use), and '--verbose' and the func_verbose function to allow your script
|
|
1427 # to display verbose messages only when your user has specified
|
|
1428 # '--verbose'.
|
|
1429 #
|
|
1430 # After sourcing this file, you can plug processing for additional
|
|
1431 # options by amending the variables from the 'Configuration' section
|
|
1432 # below, and following the instructions in the 'Option parsing'
|
|
1433 # section further down.
|
|
1434
|
|
1435 ## -------------- ##
|
|
1436 ## Configuration. ##
|
|
1437 ## -------------- ##
|
|
1438
|
|
1439 # You should override these variables in your script after sourcing this
|
|
1440 # file so that they reflect the customisations you have added to the
|
|
1441 # option parser.
|
|
1442
|
|
1443 # The usage line for option parsing errors and the start of '-h' and
|
|
1444 # '--help' output messages. You can embed shell variables for delayed
|
|
1445 # expansion at the time the message is displayed, but you will need to
|
|
1446 # quote other shell meta-characters carefully to prevent them being
|
|
1447 # expanded when the contents are evaled.
|
|
1448 usage='$progpath [OPTION]...'
|
|
1449
|
|
1450 # Short help message in response to '-h' and '--help'. Add to this or
|
|
1451 # override it after sourcing this library to reflect the full set of
|
|
1452 # options your script accepts.
|
|
1453 usage_message="\
|
|
1454 --debug enable verbose shell tracing
|
|
1455 -W, --warnings=CATEGORY
|
|
1456 report the warnings falling in CATEGORY [all]
|
|
1457 -v, --verbose verbosely report processing
|
|
1458 --version print version information and exit
|
|
1459 -h, --help print short or long help message and exit
|
|
1460 "
|
|
1461
|
|
1462 # Additional text appended to 'usage_message' in response to '--help'.
|
|
1463 long_help_message="
|
|
1464 Warning categories include:
|
|
1465 'all' show all warnings
|
|
1466 'none' turn off all the warnings
|
|
1467 'error' warnings are treated as fatal errors"
|
|
1468
|
|
1469 # Help message printed before fatal option parsing errors.
|
|
1470 fatal_help="Try '\$progname --help' for more information."
|
|
1471
|
|
1472
|
|
1473
|
|
1474 ## ------------------------- ##
|
|
1475 ## Hook function management. ##
|
|
1476 ## ------------------------- ##
|
|
1477
|
|
1478 # This section contains functions for adding, removing, and running hooks
|
|
1479 # to the main code. A hook is just a named list of of function, that can
|
|
1480 # be run in order later on.
|
|
1481
|
|
1482 # func_hookable FUNC_NAME
|
|
1483 # -----------------------
|
|
1484 # Declare that FUNC_NAME will run hooks added with
|
|
1485 # 'func_add_hook FUNC_NAME ...'.
|
|
1486 func_hookable ()
|
|
1487 {
|
|
1488 $debug_cmd
|
|
1489
|
|
1490 func_append hookable_fns " $1"
|
|
1491 }
|
|
1492
|
|
1493
|
|
1494 # func_add_hook FUNC_NAME HOOK_FUNC
|
|
1495 # ---------------------------------
|
|
1496 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
|
|
1497 # first have been declared "hookable" by a call to 'func_hookable'.
|
|
1498 func_add_hook ()
|
|
1499 {
|
|
1500 $debug_cmd
|
|
1501
|
|
1502 case " $hookable_fns " in
|
|
1503 *" $1 "*) ;;
|
|
1504 *) func_fatal_error "'$1' does not accept hook functions." ;;
|
|
1505 esac
|
|
1506
|
|
1507 eval func_append ${1}_hooks '" $2"'
|
|
1508 }
|
|
1509
|
|
1510
|
|
1511 # func_remove_hook FUNC_NAME HOOK_FUNC
|
|
1512 # ------------------------------------
|
|
1513 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
|
|
1514 func_remove_hook ()
|
|
1515 {
|
|
1516 $debug_cmd
|
|
1517
|
|
1518 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
|
|
1519 }
|
|
1520
|
|
1521
|
|
1522 # func_run_hooks FUNC_NAME [ARG]...
|
|
1523 # ---------------------------------
|
|
1524 # Run all hook functions registered to FUNC_NAME.
|
|
1525 # It is assumed that the list of hook functions contains nothing more
|
|
1526 # than a whitespace-delimited list of legal shell function names, and
|
|
1527 # no effort is wasted trying to catch shell meta-characters or preserve
|
|
1528 # whitespace.
|
|
1529 func_run_hooks ()
|
|
1530 {
|
|
1531 $debug_cmd
|
|
1532
|
|
1533 case " $hookable_fns " in
|
|
1534 *" $1 "*) ;;
|
|
1535 *) func_fatal_error "'$1' does not support hook funcions.n" ;;
|
|
1536 esac
|
|
1537
|
|
1538 eval _G_hook_fns=\$$1_hooks; shift
|
|
1539
|
|
1540 for _G_hook in $_G_hook_fns; do
|
|
1541 eval $_G_hook '"$@"'
|
|
1542
|
|
1543 # store returned options list back into positional
|
|
1544 # parameters for next 'cmd' execution.
|
|
1545 eval _G_hook_result=\$${_G_hook}_result
|
|
1546 eval set dummy "$_G_hook_result"; shift
|
|
1547 done
|
|
1548
|
|
1549 func_quote_for_eval ${1+"$@"}
|
|
1550 func_run_hooks_result=$func_quote_for_eval_result
|
|
1551 }
|
|
1552
|
|
1553
|
|
1554
|
|
1555 ## --------------- ##
|
|
1556 ## Option parsing. ##
|
|
1557 ## --------------- ##
|
|
1558
|
|
1559 # In order to add your own option parsing hooks, you must accept the
|
|
1560 # full positional parameter list in your hook function, remove any
|
|
1561 # options that you action, and then pass back the remaining unprocessed
|
|
1562 # options in '<hooked_function_name>_result', escaped suitably for
|
|
1563 # 'eval'. Like this:
|
|
1564 #
|
|
1565 # my_options_prep ()
|
|
1566 # {
|
|
1567 # $debug_cmd
|
|
1568 #
|
|
1569 # # Extend the existing usage message.
|
|
1570 # usage_message=$usage_message'
|
|
1571 # -s, --silent don'\''t print informational messages
|
|
1572 # '
|
|
1573 #
|
|
1574 # func_quote_for_eval ${1+"$@"}
|
|
1575 # my_options_prep_result=$func_quote_for_eval_result
|
|
1576 # }
|
|
1577 # func_add_hook func_options_prep my_options_prep
|
|
1578 #
|
|
1579 #
|
|
1580 # my_silent_option ()
|
|
1581 # {
|
|
1582 # $debug_cmd
|
|
1583 #
|
|
1584 # # Note that for efficiency, we parse as many options as we can
|
|
1585 # # recognise in a loop before passing the remainder back to the
|
|
1586 # # caller on the first unrecognised argument we encounter.
|
|
1587 # while test $# -gt 0; do
|
|
1588 # opt=$1; shift
|
|
1589 # case $opt in
|
|
1590 # --silent|-s) opt_silent=: ;;
|
|
1591 # # Separate non-argument short options:
|
|
1592 # -s*) func_split_short_opt "$_G_opt"
|
|
1593 # set dummy "$func_split_short_opt_name" \
|
|
1594 # "-$func_split_short_opt_arg" ${1+"$@"}
|
|
1595 # shift
|
|
1596 # ;;
|
|
1597 # *) set dummy "$_G_opt" "$*"; shift; break ;;
|
|
1598 # esac
|
|
1599 # done
|
|
1600 #
|
|
1601 # func_quote_for_eval ${1+"$@"}
|
|
1602 # my_silent_option_result=$func_quote_for_eval_result
|
|
1603 # }
|
|
1604 # func_add_hook func_parse_options my_silent_option
|
|
1605 #
|
|
1606 #
|
|
1607 # my_option_validation ()
|
|
1608 # {
|
|
1609 # $debug_cmd
|
|
1610 #
|
|
1611 # $opt_silent && $opt_verbose && func_fatal_help "\
|
|
1612 # '--silent' and '--verbose' options are mutually exclusive."
|
|
1613 #
|
|
1614 # func_quote_for_eval ${1+"$@"}
|
|
1615 # my_option_validation_result=$func_quote_for_eval_result
|
|
1616 # }
|
|
1617 # func_add_hook func_validate_options my_option_validation
|
|
1618 #
|
|
1619 # You'll alse need to manually amend $usage_message to reflect the extra
|
|
1620 # options you parse. It's preferable to append if you can, so that
|
|
1621 # multiple option parsing hooks can be added safely.
|
|
1622
|
|
1623
|
|
1624 # func_options [ARG]...
|
|
1625 # ---------------------
|
|
1626 # All the functions called inside func_options are hookable. See the
|
|
1627 # individual implementations for details.
|
|
1628 func_hookable func_options
|
|
1629 func_options ()
|
|
1630 {
|
|
1631 $debug_cmd
|
|
1632
|
|
1633 func_options_prep ${1+"$@"}
|
|
1634 eval func_parse_options \
|
|
1635 ${func_options_prep_result+"$func_options_prep_result"}
|
|
1636 eval func_validate_options \
|
|
1637 ${func_parse_options_result+"$func_parse_options_result"}
|
|
1638
|
|
1639 eval func_run_hooks func_options \
|
|
1640 ${func_validate_options_result+"$func_validate_options_result"}
|
|
1641
|
|
1642 # save modified positional parameters for caller
|
|
1643 func_options_result=$func_run_hooks_result
|
|
1644 }
|
|
1645
|
|
1646
|
|
1647 # func_options_prep [ARG]...
|
|
1648 # --------------------------
|
|
1649 # All initialisations required before starting the option parse loop.
|
|
1650 # Note that when calling hook functions, we pass through the list of
|
|
1651 # positional parameters. If a hook function modifies that list, and
|
|
1652 # needs to propogate that back to rest of this script, then the complete
|
|
1653 # modified list must be put in 'func_run_hooks_result' before
|
|
1654 # returning.
|
|
1655 func_hookable func_options_prep
|
|
1656 func_options_prep ()
|
|
1657 {
|
|
1658 $debug_cmd
|
|
1659
|
|
1660 # Option defaults:
|
|
1661 opt_verbose=false
|
|
1662 opt_warning_types=
|
|
1663
|
|
1664 func_run_hooks func_options_prep ${1+"$@"}
|
|
1665
|
|
1666 # save modified positional parameters for caller
|
|
1667 func_options_prep_result=$func_run_hooks_result
|
|
1668 }
|
|
1669
|
|
1670
|
|
1671 # func_parse_options [ARG]...
|
|
1672 # ---------------------------
|
|
1673 # The main option parsing loop.
|
|
1674 func_hookable func_parse_options
|
|
1675 func_parse_options ()
|
|
1676 {
|
|
1677 $debug_cmd
|
|
1678
|
|
1679 func_parse_options_result=
|
|
1680
|
|
1681 # this just eases exit handling
|
|
1682 while test $# -gt 0; do
|
|
1683 # Defer to hook functions for initial option parsing, so they
|
|
1684 # get priority in the event of reusing an option name.
|
|
1685 func_run_hooks func_parse_options ${1+"$@"}
|
|
1686
|
|
1687 # Adjust func_parse_options positional parameters to match
|
|
1688 eval set dummy "$func_run_hooks_result"; shift
|
|
1689
|
|
1690 # Break out of the loop if we already parsed every option.
|
|
1691 test $# -gt 0 || break
|
|
1692
|
|
1693 _G_opt=$1
|
|
1694 shift
|
|
1695 case $_G_opt in
|
|
1696 --debug|-x) debug_cmd='set -x'
|
|
1697 func_echo "enabling shell trace mode"
|
|
1698 $debug_cmd
|
|
1699 ;;
|
|
1700
|
|
1701 --no-warnings|--no-warning|--no-warn)
|
|
1702 set dummy --warnings none ${1+"$@"}
|
|
1703 shift
|
|
1704 ;;
|
|
1705
|
|
1706 --warnings|--warning|-W)
|
|
1707 test $# = 0 && func_missing_arg $_G_opt && break
|
|
1708 case " $warning_categories $1" in
|
|
1709 *" $1 "*)
|
|
1710 # trailing space prevents matching last $1 above
|
|
1711 func_append_uniq opt_warning_types " $1"
|
|
1712 ;;
|
|
1713 *all)
|
|
1714 opt_warning_types=$warning_categories
|
|
1715 ;;
|
|
1716 *none)
|
|
1717 opt_warning_types=none
|
|
1718 warning_func=:
|
|
1719 ;;
|
|
1720 *error)
|
|
1721 opt_warning_types=$warning_categories
|
|
1722 warning_func=func_fatal_error
|
|
1723 ;;
|
|
1724 *)
|
|
1725 func_fatal_error \
|
|
1726 "unsupported warning category: '$1'"
|
|
1727 ;;
|
|
1728 esac
|
|
1729 shift
|
|
1730 ;;
|
|
1731
|
|
1732 --verbose|-v) opt_verbose=: ;;
|
|
1733 --version) func_version ;;
|
|
1734 -\?|-h) func_usage ;;
|
|
1735 --help) func_help ;;
|
|
1736
|
|
1737 # Separate optargs to long options (plugins may need this):
|
|
1738 --*=*) func_split_equals "$_G_opt"
|
|
1739 set dummy "$func_split_equals_lhs" \
|
|
1740 "$func_split_equals_rhs" ${1+"$@"}
|
|
1741 shift
|
|
1742 ;;
|
|
1743
|
|
1744 # Separate optargs to short options:
|
|
1745 -W*)
|
|
1746 func_split_short_opt "$_G_opt"
|
|
1747 set dummy "$func_split_short_opt_name" \
|
|
1748 "$func_split_short_opt_arg" ${1+"$@"}
|
|
1749 shift
|
|
1750 ;;
|
|
1751
|
|
1752 # Separate non-argument short options:
|
|
1753 -\?*|-h*|-v*|-x*)
|
|
1754 func_split_short_opt "$_G_opt"
|
|
1755 set dummy "$func_split_short_opt_name" \
|
|
1756 "-$func_split_short_opt_arg" ${1+"$@"}
|
|
1757 shift
|
|
1758 ;;
|
|
1759
|
|
1760 --) break ;;
|
|
1761 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
|
|
1762 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
|
|
1763 esac
|
|
1764 done
|
|
1765
|
|
1766 # save modified positional parameters for caller
|
|
1767 func_quote_for_eval ${1+"$@"}
|
|
1768 func_parse_options_result=$func_quote_for_eval_result
|
|
1769 }
|
|
1770
|
|
1771
|
|
1772 # func_validate_options [ARG]...
|
|
1773 # ------------------------------
|
|
1774 # Perform any sanity checks on option settings and/or unconsumed
|
|
1775 # arguments.
|
|
1776 func_hookable func_validate_options
|
|
1777 func_validate_options ()
|
|
1778 {
|
|
1779 $debug_cmd
|
|
1780
|
|
1781 # Display all warnings if -W was not given.
|
|
1782 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
|
|
1783
|
|
1784 func_run_hooks func_validate_options ${1+"$@"}
|
|
1785
|
|
1786 # Bail if the options were screwed!
|
|
1787 $exit_cmd $EXIT_FAILURE
|
|
1788
|
|
1789 # save modified positional parameters for caller
|
|
1790 func_validate_options_result=$func_run_hooks_result
|
|
1791 }
|
|
1792
|
|
1793
|
|
1794
|
|
1795 ## ----------------- ##
|
|
1796 ## Helper functions. ##
|
|
1797 ## ----------------- ##
|
|
1798
|
|
1799 # This section contains the helper functions used by the rest of the
|
|
1800 # hookable option parser framework in ascii-betical order.
|
|
1801
|
|
1802
|
|
1803 # func_fatal_help ARG...
|
|
1804 # ----------------------
|
|
1805 # Echo program name prefixed message to standard error, followed by
|
|
1806 # a help hint, and exit.
|
|
1807 func_fatal_help ()
|
|
1808 {
|
|
1809 $debug_cmd
|
|
1810
|
|
1811 eval \$ECHO \""Usage: $usage"\"
|
|
1812 eval \$ECHO \""$fatal_help"\"
|
|
1813 func_error ${1+"$@"}
|
|
1814 exit $EXIT_FAILURE
|
|
1815 }
|
|
1816
|
|
1817
|
|
1818 # func_help
|
|
1819 # ---------
|
|
1820 # Echo long help message to standard output and exit.
|
|
1821 func_help ()
|
|
1822 {
|
|
1823 $debug_cmd
|
|
1824
|
|
1825 func_usage_message
|
|
1826 $ECHO "$long_help_message"
|
|
1827 exit 0
|
|
1828 }
|
|
1829
|
|
1830
|
|
1831 # func_missing_arg ARGNAME
|
|
1832 # ------------------------
|
|
1833 # Echo program name prefixed message to standard error and set global
|
|
1834 # exit_cmd.
|
|
1835 func_missing_arg ()
|
|
1836 {
|
|
1837 $debug_cmd
|
|
1838
|
|
1839 func_error "Missing argument for '$1'."
|
|
1840 exit_cmd=exit
|
|
1841 }
|
|
1842
|
|
1843
|
|
1844 # func_split_equals STRING
|
|
1845 # ------------------------
|
|
1846 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
|
|
1847 # splitting STRING at the '=' sign.
|
|
1848 test -z "$_G_HAVE_XSI_OPS" \
|
|
1849 && (eval 'x=a/b/c;
|
|
1850 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
|
|
1851 && _G_HAVE_XSI_OPS=yes
|
|
1852
|
|
1853 if test yes = "$_G_HAVE_XSI_OPS"
|
|
1854 then
|
|
1855 # This is an XSI compatible shell, allowing a faster implementation...
|
|
1856 eval 'func_split_equals ()
|
|
1857 {
|
|
1858 $debug_cmd
|
|
1859
|
|
1860 func_split_equals_lhs=${1%%=*}
|
|
1861 func_split_equals_rhs=${1#*=}
|
|
1862 test "x$func_split_equals_lhs" = "x$1" \
|
|
1863 && func_split_equals_rhs=
|
|
1864 }'
|
|
1865 else
|
|
1866 # ...otherwise fall back to using expr, which is often a shell builtin.
|
|
1867 func_split_equals ()
|
|
1868 {
|
|
1869 $debug_cmd
|
|
1870
|
|
1871 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
|
|
1872 func_split_equals_rhs=
|
|
1873 test "x$func_split_equals_lhs" = "x$1" \
|
|
1874 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
|
|
1875 }
|
|
1876 fi #func_split_equals
|
|
1877
|
|
1878
|
|
1879 # func_split_short_opt SHORTOPT
|
|
1880 # -----------------------------
|
|
1881 # Set func_split_short_opt_name and func_split_short_opt_arg shell
|
|
1882 # variables after splitting SHORTOPT after the 2nd character.
|
|
1883 if test yes = "$_G_HAVE_XSI_OPS"
|
|
1884 then
|
|
1885 # This is an XSI compatible shell, allowing a faster implementation...
|
|
1886 eval 'func_split_short_opt ()
|
|
1887 {
|
|
1888 $debug_cmd
|
|
1889
|
|
1890 func_split_short_opt_arg=${1#??}
|
|
1891 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
|
|
1892 }'
|
|
1893 else
|
|
1894 # ...otherwise fall back to using expr, which is often a shell builtin.
|
|
1895 func_split_short_opt ()
|
|
1896 {
|
|
1897 $debug_cmd
|
|
1898
|
|
1899 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
|
|
1900 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
|
|
1901 }
|
|
1902 fi #func_split_short_opt
|
|
1903
|
|
1904
|
|
1905 # func_usage
|
|
1906 # ----------
|
|
1907 # Echo short help message to standard output and exit.
|
|
1908 func_usage ()
|
|
1909 {
|
|
1910 $debug_cmd
|
|
1911
|
|
1912 func_usage_message
|
|
1913 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
|
|
1914 exit 0
|
|
1915 }
|
|
1916
|
|
1917
|
|
1918 # func_usage_message
|
|
1919 # ------------------
|
|
1920 # Echo short help message to standard output.
|
|
1921 func_usage_message ()
|
|
1922 {
|
|
1923 $debug_cmd
|
|
1924
|
|
1925 eval \$ECHO \""Usage: $usage"\"
|
|
1926 echo
|
|
1927 $SED -n 's|^# ||
|
|
1928 /^Written by/{
|
|
1929 x;p;x
|
|
1930 }
|
|
1931 h
|
|
1932 /^Written by/q' < "$progpath"
|
|
1933 echo
|
|
1934 eval \$ECHO \""$usage_message"\"
|
|
1935 }
|
|
1936
|
|
1937
|
|
1938 # func_version
|
|
1939 # ------------
|
|
1940 # Echo version message to standard output and exit.
|
|
1941 func_version ()
|
|
1942 {
|
|
1943 $debug_cmd
|
|
1944
|
|
1945 printf '%s\n' "$progname $scriptversion"
|
|
1946 $SED -n '
|
|
1947 /(C)/!b go
|
|
1948 :more
|
|
1949 /\./!{
|
|
1950 N
|
|
1951 s|\n# | |
|
|
1952 b more
|
|
1953 }
|
|
1954 :go
|
|
1955 /^# Written by /,/# warranty; / {
|
|
1956 s|^# ||
|
|
1957 s|^# *$||
|
|
1958 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
|
|
1959 p
|
|
1960 }
|
|
1961 /^# Written by / {
|
|
1962 s|^# ||
|
|
1963 p
|
|
1964 }
|
|
1965 /^warranty; /q' < "$progpath"
|
|
1966
|
|
1967 exit $?
|
|
1968 }
|
|
1969
|
|
1970
|
|
1971 # Local variables:
|
|
1972 # mode: shell-script
|
|
1973 # sh-indentation: 2
|
|
1974 # eval: (add-hook 'before-save-hook 'time-stamp)
|
|
1975 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
|
|
1976 # time-stamp-time-zone: "UTC"
|
|
1977 # End:
|
|
1978
|
|
1979 # Set a version string.
|
|
1980 scriptversion='(GNU libtool) 2.4.5'
|
|
1981
|
|
1982
|
|
1983 # func_echo ARG...
|
|
1984 # ----------------
|
|
1985 # Libtool also displays the current mode in messages, so override
|
|
1986 # funclib.sh func_echo with this custom definition.
|
|
1987 func_echo ()
|
|
1988 {
|
|
1989 $debug_cmd
|
|
1990
|
|
1991 _G_message=$*
|
|
1992
|
|
1993 func_echo_IFS=$IFS
|
|
1994 IFS=$nl
|
|
1995 for _G_line in $_G_message; do
|
|
1996 IFS=$func_echo_IFS
|
|
1997 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
|
|
1998 done
|
|
1999 IFS=$func_echo_IFS
|
|
2000 }
|
|
2001
|
|
2002
|
|
2003 # func_warning ARG...
|
|
2004 # -------------------
|
|
2005 # Libtool warnings are not categorized, so override funclib.sh
|
|
2006 # func_warning with this simpler definition.
|
|
2007 func_warning ()
|
|
2008 {
|
|
2009 $debug_cmd
|
|
2010
|
|
2011 $warning_func ${1+"$@"}
|
|
2012 }
|
|
2013
|
|
2014
|
|
2015 ## ---------------- ##
|
|
2016 ## Options parsing. ##
|
|
2017 ## ---------------- ##
|
|
2018
|
|
2019 # Hook in the functions to make sure our own options are parsed during
|
|
2020 # the option parsing loop.
|
|
2021
|
|
2022 usage='$progpath [OPTION]... [MODE-ARG]...'
|
|
2023
|
|
2024 # Short help message in response to '-h'.
|
|
2025 usage_message="Options:
|
|
2026 --config show all configuration variables
|
|
2027 --debug enable verbose shell tracing
|
|
2028 -n, --dry-run display commands without modifying any files
|
|
2029 --features display basic configuration information and exit
|
|
2030 --mode=MODE use operation mode MODE
|
|
2031 --no-warnings equivalent to '-Wnone'
|
|
2032 --preserve-dup-deps don't remove duplicate dependency libraries
|
|
2033 --quiet, --silent don't print informational messages
|
|
2034 --tag=TAG use configuration variables from tag TAG
|
|
2035 -v, --verbose print more informational messages than default
|
|
2036 --version print version information
|
|
2037 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
|
|
2038 -h, --help, --help-all print short, long, or detailed help message
|
|
2039 "
|
|
2040
|
|
2041 # Additional text appended to 'usage_message' in response to '--help'.
|
|
2042 long_help_message=$long_help_message"
|
|
2043
|
|
2044 MODE must be one of the following:
|
|
2045
|
|
2046 clean remove files from the build directory
|
|
2047 compile compile a source file into a libtool object
|
|
2048 execute automatically set library path, then run a program
|
|
2049 finish complete the installation of libtool libraries
|
|
2050 install install libraries or executables
|
|
2051 link create a library or an executable
|
|
2052 uninstall remove libraries from an installed directory
|
|
2053
|
|
2054 MODE-ARGS vary depending on the MODE. When passed as first option,
|
|
2055 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
|
|
2056 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
|
|
2057
|
|
2058 When reporting a bug, please describe a test case to reproduce it and
|
|
2059 include the following information:
|
|
2060
|
|
2061 host-triplet: $host
|
|
2062 shell: $SHELL
|
|
2063 compiler: $LTCC
|
|
2064 compiler flags: $LTCFLAGS
|
|
2065 linker: $LD (gnu? $with_gnu_ld)
|
|
2066 version: $progname (GNU libtool) 2.4.5
|
|
2067 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
|
|
2068 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
|
|
2069
|
|
2070 Report bugs to <bug-libtool@gnu.org>.
|
|
2071 GNU libtool home page: <http://www.gnu.org/software/libtool/>.
|
|
2072 General help using GNU software: <http://www.gnu.org/gethelp/>."
|
|
2073
|
|
2074
|
|
2075 # func_lo2o OBJECT-NAME
|
|
2076 # ---------------------
|
|
2077 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
|
|
2078 # object suffix.
|
|
2079
|
|
2080 lo2o=s/\\.lo\$/.$objext/
|
|
2081 o2lo=s/\\.$objext\$/.lo/
|
|
2082
|
|
2083 if test yes = "$_G_HAVE_XSI_OPS"; then
|
|
2084 eval 'func_lo2o ()
|
|
2085 {
|
|
2086 case $1 in
|
|
2087 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
|
|
2088 * ) func_lo2o_result=$1 ;;
|
|
2089 esac
|
|
2090 }'
|
|
2091
|
|
2092 # func_xform LIBOBJ-OR-SOURCE
|
|
2093 # ---------------------------
|
|
2094 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
|
|
2095 # suffix to a '.lo' libtool-object suffix.
|
|
2096 eval 'func_xform ()
|
|
2097 {
|
|
2098 func_xform_result=${1%.*}.lo
|
|
2099 }'
|
|
2100 else
|
|
2101 # ...otherwise fall back to using sed.
|
|
2102 func_lo2o ()
|
|
2103 {
|
|
2104 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
|
|
2105 }
|
|
2106
|
|
2107 func_xform ()
|
|
2108 {
|
|
2109 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
|
|
2110 }
|
|
2111 fi
|
|
2112
|
|
2113
|
|
2114 # func_fatal_configuration ARG...
|
|
2115 # -------------------------------
|
|
2116 # Echo program name prefixed message to standard error, followed by
|
|
2117 # a configuration failure hint, and exit.
|
|
2118 func_fatal_configuration ()
|
|
2119 {
|
|
2120 func__fatal_error ${1+"$@"} \
|
|
2121 "See the $PACKAGE documentation for more information." \
|
|
2122 "Fatal configuration error."
|
|
2123 }
|
|
2124
|
|
2125
|
|
2126 # func_config
|
|
2127 # -----------
|
|
2128 # Display the configuration for all the tags in this script.
|
|
2129 func_config ()
|
|
2130 {
|
|
2131 re_begincf='^# ### BEGIN LIBTOOL'
|
|
2132 re_endcf='^# ### END LIBTOOL'
|
|
2133
|
|
2134 # Default configuration.
|
|
2135 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
|
|
2136
|
|
2137 # Now print the configurations for the tags.
|
|
2138 for tagname in $taglist; do
|
|
2139 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
|
|
2140 done
|
|
2141
|
|
2142 exit $?
|
|
2143 }
|
|
2144
|
|
2145
|
|
2146 # func_features
|
|
2147 # -------------
|
|
2148 # Display the features supported by this script.
|
|
2149 func_features ()
|
|
2150 {
|
|
2151 echo "host: $host"
|
|
2152 if test yes = "$build_libtool_libs"; then
|
|
2153 echo "enable shared libraries"
|
|
2154 else
|
|
2155 echo "disable shared libraries"
|
|
2156 fi
|
|
2157 if test yes = "$build_old_libs"; then
|
|
2158 echo "enable static libraries"
|
|
2159 else
|
|
2160 echo "disable static libraries"
|
|
2161 fi
|
|
2162
|
|
2163 exit $?
|
|
2164 }
|
|
2165
|
|
2166
|
|
2167 # func_enable_tag TAGNAME
|
|
2168 # -----------------------
|
|
2169 # Verify that TAGNAME is valid, and either flag an error and exit, or
|
|
2170 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
|
|
2171 # variable here.
|
|
2172 func_enable_tag ()
|
|
2173 {
|
|
2174 # Global variable:
|
|
2175 tagname=$1
|
|
2176
|
|
2177 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
|
|
2178 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
|
|
2179 sed_extractcf=/$re_begincf/,/$re_endcf/p
|
|
2180
|
|
2181 # Validate tagname.
|
|
2182 case $tagname in
|
|
2183 *[!-_A-Za-z0-9,/]*)
|
|
2184 func_fatal_error "invalid tag name: $tagname"
|
|
2185 ;;
|
|
2186 esac
|
|
2187
|
|
2188 # Don't test for the "default" C tag, as we know it's
|
|
2189 # there but not specially marked.
|
|
2190 case $tagname in
|
|
2191 CC) ;;
|
|
2192 *)
|
|
2193 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
|
|
2194 taglist="$taglist $tagname"
|
|
2195
|
|
2196 # Evaluate the configuration. Be careful to quote the path
|
|
2197 # and the sed script, to avoid splitting on whitespace, but
|
|
2198 # also don't use non-portable quotes within backquotes within
|
|
2199 # quotes we have to do it in 2 steps:
|
|
2200 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
|
|
2201 eval "$extractedcf"
|
|
2202 else
|
|
2203 func_error "ignoring unknown tag $tagname"
|
|
2204 fi
|
|
2205 ;;
|
|
2206 esac
|
|
2207 }
|
|
2208
|
|
2209
|
|
2210 # func_check_version_match
|
|
2211 # ------------------------
|
|
2212 # Ensure that we are using m4 macros, and libtool script from the same
|
|
2213 # release of libtool.
|
|
2214 func_check_version_match ()
|
|
2215 {
|
|
2216 if test "$package_revision" != "$macro_revision"; then
|
|
2217 if test "$VERSION" != "$macro_version"; then
|
|
2218 if test -z "$macro_version"; then
|
|
2219 cat >&2 <<_LT_EOF
|
|
2220 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
|
|
2221 $progname: definition of this LT_INIT comes from an older release.
|
|
2222 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
|
|
2223 $progname: and run autoconf again.
|
|
2224 _LT_EOF
|
|
2225 else
|
|
2226 cat >&2 <<_LT_EOF
|
|
2227 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
|
|
2228 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
|
|
2229 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
|
|
2230 $progname: and run autoconf again.
|
|
2231 _LT_EOF
|
|
2232 fi
|
|
2233 else
|
|
2234 cat >&2 <<_LT_EOF
|
|
2235 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
|
|
2236 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
|
|
2237 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
|
|
2238 $progname: of $PACKAGE $VERSION and run autoconf again.
|
|
2239 _LT_EOF
|
|
2240 fi
|
|
2241
|
|
2242 exit $EXIT_MISMATCH
|
|
2243 fi
|
|
2244 }
|
|
2245
|
|
2246
|
|
2247 # libtool_options_prep [ARG]...
|
|
2248 # -----------------------------
|
|
2249 # Preparation for options parsed by libtool.
|
|
2250 libtool_options_prep ()
|
|
2251 {
|
|
2252 $debug_mode
|
|
2253
|
|
2254 # Option defaults:
|
|
2255 opt_config=false
|
|
2256 opt_dlopen=
|
|
2257 opt_dry_run=false
|
|
2258 opt_help=false
|
|
2259 opt_mode=
|
|
2260 opt_preserve_dup_deps=false
|
|
2261 opt_quiet=false
|
|
2262
|
|
2263 nonopt=
|
|
2264 preserve_args=
|
|
2265
|
|
2266 # Shorthand for --mode=foo, only valid as the first argument
|
|
2267 case $1 in
|
|
2268 clean|clea|cle|cl)
|
|
2269 shift; set dummy --mode clean ${1+"$@"}; shift
|
|
2270 ;;
|
|
2271 compile|compil|compi|comp|com|co|c)
|
|
2272 shift; set dummy --mode compile ${1+"$@"}; shift
|
|
2273 ;;
|
|
2274 execute|execut|execu|exec|exe|ex|e)
|
|
2275 shift; set dummy --mode execute ${1+"$@"}; shift
|
|
2276 ;;
|
|
2277 finish|finis|fini|fin|fi|f)
|
|
2278 shift; set dummy --mode finish ${1+"$@"}; shift
|
|
2279 ;;
|
|
2280 install|instal|insta|inst|ins|in|i)
|
|
2281 shift; set dummy --mode install ${1+"$@"}; shift
|
|
2282 ;;
|
|
2283 link|lin|li|l)
|
|
2284 shift; set dummy --mode link ${1+"$@"}; shift
|
|
2285 ;;
|
|
2286 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
|
|
2287 shift; set dummy --mode uninstall ${1+"$@"}; shift
|
|
2288 ;;
|
|
2289 esac
|
|
2290
|
|
2291 # Pass back the list of options.
|
|
2292 func_quote_for_eval ${1+"$@"}
|
|
2293 libtool_options_prep_result=$func_quote_for_eval_result
|
|
2294 }
|
|
2295 func_add_hook func_options_prep libtool_options_prep
|
|
2296
|
|
2297
|
|
2298 # libtool_parse_options [ARG]...
|
|
2299 # ---------------------------------
|
|
2300 # Provide handling for libtool specific options.
|
|
2301 libtool_parse_options ()
|
|
2302 {
|
|
2303 $debug_cmd
|
|
2304
|
|
2305 # Perform our own loop to consume as many options as possible in
|
|
2306 # each iteration.
|
|
2307 while test $# -gt 0; do
|
|
2308 _G_opt=$1
|
|
2309 shift
|
|
2310 case $_G_opt in
|
|
2311 --dry-run|--dryrun|-n)
|
|
2312 opt_dry_run=:
|
|
2313 ;;
|
|
2314
|
|
2315 --config) func_config ;;
|
|
2316
|
|
2317 --dlopen|-dlopen)
|
|
2318 opt_dlopen="${opt_dlopen+$opt_dlopen
|
|
2319 }$1"
|
|
2320 shift
|
|
2321 ;;
|
|
2322
|
|
2323 --preserve-dup-deps)
|
|
2324 opt_preserve_dup_deps=: ;;
|
|
2325
|
|
2326 --features) func_features ;;
|
|
2327
|
|
2328 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
|
|
2329
|
|
2330 --help) opt_help=: ;;
|
|
2331
|
|
2332 --help-all) opt_help=': help-all' ;;
|
|
2333
|
|
2334 --mode) test $# = 0 && func_missing_arg $_G_opt && break
|
|
2335 opt_mode=$1
|
|
2336 case $1 in
|
|
2337 # Valid mode arguments:
|
|
2338 clean|compile|execute|finish|install|link|relink|uninstall) ;;
|
|
2339
|
|
2340 # Catch anything else as an error
|
|
2341 *) func_error "invalid argument for $_G_opt"
|
|
2342 exit_cmd=exit
|
|
2343 break
|
|
2344 ;;
|
|
2345 esac
|
|
2346 shift
|
|
2347 ;;
|
|
2348
|
|
2349 --no-silent|--no-quiet)
|
|
2350 opt_quiet=false
|
|
2351 func_append preserve_args " $_G_opt"
|
|
2352 ;;
|
|
2353
|
|
2354 --no-warnings|--no-warning|--no-warn)
|
|
2355 opt_warning=false
|
|
2356 func_append preserve_args " $_G_opt"
|
|
2357 ;;
|
|
2358
|
|
2359 --no-verbose)
|
|
2360 opt_verbose=false
|
|
2361 func_append preserve_args " $_G_opt"
|
|
2362 ;;
|
|
2363
|
|
2364 --silent|--quiet)
|
|
2365 opt_quiet=:
|
|
2366 opt_verbose=false
|
|
2367 func_append preserve_args " $_G_opt"
|
|
2368 ;;
|
|
2369
|
|
2370 --tag) test $# = 0 && func_missing_arg $_G_opt && break
|
|
2371 opt_tag=$1
|
|
2372 func_append preserve_args " $_G_opt $1"
|
|
2373 func_enable_tag "$1"
|
|
2374 shift
|
|
2375 ;;
|
|
2376
|
|
2377 --verbose|-v) opt_quiet=false
|
|
2378 opt_verbose=:
|
|
2379 func_append preserve_args " $_G_opt"
|
|
2380 ;;
|
|
2381
|
|
2382 # An option not handled by this hook function:
|
|
2383 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
|
|
2384 esac
|
|
2385 done
|
|
2386
|
|
2387
|
|
2388 # save modified positional parameters for caller
|
|
2389 func_quote_for_eval ${1+"$@"}
|
|
2390 libtool_parse_options_result=$func_quote_for_eval_result
|
|
2391 }
|
|
2392 func_add_hook func_parse_options libtool_parse_options
|
|
2393
|
|
2394
|
|
2395
|
|
2396 # libtool_validate_options [ARG]...
|
|
2397 # ---------------------------------
|
|
2398 # Perform any sanity checks on option settings and/or unconsumed
|
|
2399 # arguments.
|
|
2400 libtool_validate_options ()
|
|
2401 {
|
|
2402 # save first non-option argument
|
|
2403 if test 0 -lt $#; then
|
|
2404 nonopt=$1
|
|
2405 shift
|
|
2406 fi
|
|
2407
|
|
2408 # preserve --debug
|
|
2409 test : = "$debug_cmd" || func_append preserve_args " --debug"
|
|
2410
|
|
2411 case $host in
|
|
2412 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
|
|
2413 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
|
|
2414 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
|
|
2415 # don't eliminate duplications in $postdeps and $predeps
|
|
2416 opt_duplicate_compiler_generated_deps=:
|
|
2417 ;;
|
|
2418 *)
|
|
2419 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
|
|
2420 ;;
|
|
2421 esac
|
|
2422
|
|
2423 $opt_help || {
|
|
2424 # Sanity checks first:
|
|
2425 func_check_version_match
|
|
2426
|
|
2427 test yes != "$build_libtool_libs" \
|
|
2428 && test yes != "$build_old_libs" \
|
|
2429 && func_fatal_configuration "not configured to build any kind of library"
|
|
2430
|
|
2431 # Darwin sucks
|
|
2432 eval std_shrext=\"$shrext_cmds\"
|
|
2433
|
|
2434 # Only execute mode is allowed to have -dlopen flags.
|
|
2435 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
|
|
2436 func_error "unrecognized option '-dlopen'"
|
|
2437 $ECHO "$help" 1>&2
|
|
2438 exit $EXIT_FAILURE
|
|
2439 fi
|
|
2440
|
|
2441 # Change the help message to a mode-specific one.
|
|
2442 generic_help=$help
|
|
2443 help="Try '$progname --help --mode=$opt_mode' for more information."
|
|
2444 }
|
|
2445
|
|
2446 # Pass back the unparsed argument list
|
|
2447 func_quote_for_eval ${1+"$@"}
|
|
2448 libtool_validate_options_result=$func_quote_for_eval_result
|
|
2449 }
|
|
2450 func_add_hook func_validate_options libtool_validate_options
|
|
2451
|
|
2452
|
|
2453 # Process options as early as possible so that --help and --version
|
|
2454 # can return quickly.
|
|
2455 func_options ${1+"$@"}
|
|
2456 eval set dummy "$func_options_result"; shift
|
|
2457
|
|
2458
|
|
2459
|
|
2460 ## ----------- ##
|
|
2461 ## Main. ##
|
|
2462 ## ----------- ##
|
|
2463
|
|
2464 magic='%%%MAGIC variable%%%'
|
|
2465 magic_exe='%%%MAGIC EXE variable%%%'
|
|
2466
|
|
2467 # Global variables.
|
|
2468 extracted_archives=
|
|
2469 extracted_serial=0
|
|
2470
|
|
2471 # If this variable is set in any of the actions, the command in it
|
|
2472 # will be execed at the end. This prevents here-documents from being
|
|
2473 # left over by shells.
|
|
2474 exec_cmd=
|
|
2475
|
|
2476
|
|
2477 # A function that is used when there is no print builtin or printf.
|
|
2478 func_fallback_echo ()
|
|
2479 {
|
|
2480 eval 'cat <<_LTECHO_EOF
|
|
2481 $1
|
|
2482 _LTECHO_EOF'
|
|
2483 }
|
|
2484
|
|
2485 # func_generated_by_libtool
|
|
2486 # True iff stdin has been generated by Libtool. This function is only
|
|
2487 # a basic sanity check; it will hardly flush out determined imposters.
|
|
2488 func_generated_by_libtool_p ()
|
|
2489 {
|
|
2490 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
|
|
2491 }
|
|
2492
|
|
2493 # func_lalib_p file
|
|
2494 # True iff FILE is a libtool '.la' library or '.lo' object file.
|
|
2495 # This function is only a basic sanity check; it will hardly flush out
|
|
2496 # determined imposters.
|
|
2497 func_lalib_p ()
|
|
2498 {
|
|
2499 test -f "$1" &&
|
|
2500 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
|
|
2501 }
|
|
2502
|
|
2503 # func_lalib_unsafe_p file
|
|
2504 # True iff FILE is a libtool '.la' library or '.lo' object file.
|
|
2505 # This function implements the same check as func_lalib_p without
|
|
2506 # resorting to external programs. To this end, it redirects stdin and
|
|
2507 # closes it afterwards, without saving the original file descriptor.
|
|
2508 # As a safety measure, use it only where a negative result would be
|
|
2509 # fatal anyway. Works if 'file' does not exist.
|
|
2510 func_lalib_unsafe_p ()
|
|
2511 {
|
|
2512 lalib_p=no
|
|
2513 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
|
|
2514 for lalib_p_l in 1 2 3 4
|
|
2515 do
|
|
2516 read lalib_p_line
|
|
2517 case $lalib_p_line in
|
|
2518 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
|
|
2519 esac
|
|
2520 done
|
|
2521 exec 0<&5 5<&-
|
|
2522 fi
|
|
2523 test yes = "$lalib_p"
|
|
2524 }
|
|
2525
|
|
2526 # func_ltwrapper_script_p file
|
|
2527 # True iff FILE is a libtool wrapper script
|
|
2528 # This function is only a basic sanity check; it will hardly flush out
|
|
2529 # determined imposters.
|
|
2530 func_ltwrapper_script_p ()
|
|
2531 {
|
|
2532 test -f "$1" &&
|
|
2533 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
|
|
2534 }
|
|
2535
|
|
2536 # func_ltwrapper_executable_p file
|
|
2537 # True iff FILE is a libtool wrapper executable
|
|
2538 # This function is only a basic sanity check; it will hardly flush out
|
|
2539 # determined imposters.
|
|
2540 func_ltwrapper_executable_p ()
|
|
2541 {
|
|
2542 func_ltwrapper_exec_suffix=
|
|
2543 case $1 in
|
|
2544 *.exe) ;;
|
|
2545 *) func_ltwrapper_exec_suffix=.exe ;;
|
|
2546 esac
|
|
2547 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
|
|
2548 }
|
|
2549
|
|
2550 # func_ltwrapper_scriptname file
|
|
2551 # Assumes file is an ltwrapper_executable
|
|
2552 # uses $file to determine the appropriate filename for a
|
|
2553 # temporary ltwrapper_script.
|
|
2554 func_ltwrapper_scriptname ()
|
|
2555 {
|
|
2556 func_dirname_and_basename "$1" "" "."
|
|
2557 func_stripname '' '.exe' "$func_basename_result"
|
|
2558 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
|
|
2559 }
|
|
2560
|
|
2561 # func_ltwrapper_p file
|
|
2562 # True iff FILE is a libtool wrapper script or wrapper executable
|
|
2563 # This function is only a basic sanity check; it will hardly flush out
|
|
2564 # determined imposters.
|
|
2565 func_ltwrapper_p ()
|
|
2566 {
|
|
2567 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
|
|
2568 }
|
|
2569
|
|
2570
|
|
2571 # func_execute_cmds commands fail_cmd
|
|
2572 # Execute tilde-delimited COMMANDS.
|
|
2573 # If FAIL_CMD is given, eval that upon failure.
|
|
2574 # FAIL_CMD may read-access the current command in variable CMD!
|
|
2575 func_execute_cmds ()
|
|
2576 {
|
|
2577 $debug_cmd
|
|
2578
|
|
2579 save_ifs=$IFS; IFS='~'
|
|
2580 for cmd in $1; do
|
|
2581 IFS=$sp$nl
|
|
2582 eval cmd=\"$cmd\"
|
|
2583 IFS=$save_ifs
|
|
2584 func_show_eval "$cmd" "${2-:}"
|
|
2585 done
|
|
2586 IFS=$save_ifs
|
|
2587 }
|
|
2588
|
|
2589
|
|
2590 # func_source file
|
|
2591 # Source FILE, adding directory component if necessary.
|
|
2592 # Note that it is not necessary on cygwin/mingw to append a dot to
|
|
2593 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
|
|
2594 # behavior happens only for exec(3), not for open(2)! Also, sourcing
|
|
2595 # 'FILE.' does not work on cygwin managed mounts.
|
|
2596 func_source ()
|
|
2597 {
|
|
2598 $debug_cmd
|
|
2599
|
|
2600 case $1 in
|
|
2601 */* | *\\*) . "$1" ;;
|
|
2602 *) . "./$1" ;;
|
|
2603 esac
|
|
2604 }
|
|
2605
|
|
2606
|
|
2607 # func_resolve_sysroot PATH
|
|
2608 # Replace a leading = in PATH with a sysroot. Store the result into
|
|
2609 # func_resolve_sysroot_result
|
|
2610 func_resolve_sysroot ()
|
|
2611 {
|
|
2612 func_resolve_sysroot_result=$1
|
|
2613 case $func_resolve_sysroot_result in
|
|
2614 =*)
|
|
2615 func_stripname '=' '' "$func_resolve_sysroot_result"
|
|
2616 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
|
|
2617 ;;
|
|
2618 esac
|
|
2619 }
|
|
2620
|
|
2621 # func_replace_sysroot PATH
|
|
2622 # If PATH begins with the sysroot, replace it with = and
|
|
2623 # store the result into func_replace_sysroot_result.
|
|
2624 func_replace_sysroot ()
|
|
2625 {
|
|
2626 case $lt_sysroot:$1 in
|
|
2627 ?*:"$lt_sysroot"*)
|
|
2628 func_stripname "$lt_sysroot" '' "$1"
|
|
2629 func_replace_sysroot_result='='$func_stripname_result
|
|
2630 ;;
|
|
2631 *)
|
|
2632 # Including no sysroot.
|
|
2633 func_replace_sysroot_result=$1
|
|
2634 ;;
|
|
2635 esac
|
|
2636 }
|
|
2637
|
|
2638 # func_infer_tag arg
|
|
2639 # Infer tagged configuration to use if any are available and
|
|
2640 # if one wasn't chosen via the "--tag" command line option.
|
|
2641 # Only attempt this if the compiler in the base compile
|
|
2642 # command doesn't match the default compiler.
|
|
2643 # arg is usually of the form 'gcc ...'
|
|
2644 func_infer_tag ()
|
|
2645 {
|
|
2646 $debug_cmd
|
|
2647
|
|
2648 if test -n "$available_tags" && test -z "$tagname"; then
|
|
2649 CC_quoted=
|
|
2650 for arg in $CC; do
|
|
2651 func_append_quoted CC_quoted "$arg"
|
|
2652 done
|
|
2653 CC_expanded=`func_echo_all $CC`
|
|
2654 CC_quoted_expanded=`func_echo_all $CC_quoted`
|
|
2655 case $@ in
|
|
2656 # Blanks in the command may have been stripped by the calling shell,
|
|
2657 # but not from the CC environment variable when configure was run.
|
|
2658 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
|
|
2659 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
|
|
2660 # Blanks at the start of $base_compile will cause this to fail
|
|
2661 # if we don't check for them as well.
|
|
2662 *)
|
|
2663 for z in $available_tags; do
|
|
2664 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
|
|
2665 # Evaluate the configuration.
|
|
2666 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
|
|
2667 CC_quoted=
|
|
2668 for arg in $CC; do
|
|
2669 # Double-quote args containing other shell metacharacters.
|
|
2670 func_append_quoted CC_quoted "$arg"
|
|
2671 done
|
|
2672 CC_expanded=`func_echo_all $CC`
|
|
2673 CC_quoted_expanded=`func_echo_all $CC_quoted`
|
|
2674 case "$@ " in
|
|
2675 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
|
|
2676 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
|
|
2677 # The compiler in the base compile command matches
|
|
2678 # the one in the tagged configuration.
|
|
2679 # Assume this is the tagged configuration we want.
|
|
2680 tagname=$z
|
|
2681 break
|
|
2682 ;;
|
|
2683 esac
|
|
2684 fi
|
|
2685 done
|
|
2686 # If $tagname still isn't set, then no tagged configuration
|
|
2687 # was found and let the user know that the "--tag" command
|
|
2688 # line option must be used.
|
|
2689 if test -z "$tagname"; then
|
|
2690 func_echo "unable to infer tagged configuration"
|
|
2691 func_fatal_error "specify a tag with '--tag'"
|
|
2692 # else
|
|
2693 # func_verbose "using $tagname tagged configuration"
|
|
2694 fi
|
|
2695 ;;
|
|
2696 esac
|
|
2697 fi
|
|
2698 }
|
|
2699
|
|
2700
|
|
2701
|
|
2702 # func_write_libtool_object output_name pic_name nonpic_name
|
|
2703 # Create a libtool object file (analogous to a ".la" file),
|
|
2704 # but don't create it if we're doing a dry run.
|
|
2705 func_write_libtool_object ()
|
|
2706 {
|
|
2707 write_libobj=$1
|
|
2708 if test yes = "$build_libtool_libs"; then
|
|
2709 write_lobj=\'$2\'
|
|
2710 else
|
|
2711 write_lobj=none
|
|
2712 fi
|
|
2713
|
|
2714 if test yes = "$build_old_libs"; then
|
|
2715 write_oldobj=\'$3\'
|
|
2716 else
|
|
2717 write_oldobj=none
|
|
2718 fi
|
|
2719
|
|
2720 $opt_dry_run || {
|
|
2721 cat >${write_libobj}T <<EOF
|
|
2722 # $write_libobj - a libtool object file
|
|
2723 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
|
|
2724 #
|
|
2725 # Please DO NOT delete this file!
|
|
2726 # It is necessary for linking the library.
|
|
2727
|
|
2728 # Name of the PIC object.
|
|
2729 pic_object=$write_lobj
|
|
2730
|
|
2731 # Name of the non-PIC object
|
|
2732 non_pic_object=$write_oldobj
|
|
2733
|
|
2734 EOF
|
|
2735 $MV "${write_libobj}T" "$write_libobj"
|
|
2736 }
|
|
2737 }
|
|
2738
|
|
2739
|
|
2740 ##################################################
|
|
2741 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
|
|
2742 ##################################################
|
|
2743
|
|
2744 # func_convert_core_file_wine_to_w32 ARG
|
|
2745 # Helper function used by file name conversion functions when $build is *nix,
|
|
2746 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
|
|
2747 # correctly configured wine environment available, with the winepath program
|
|
2748 # in $build's $PATH.
|
|
2749 #
|
|
2750 # ARG is the $build file name to be converted to w32 format.
|
|
2751 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
|
|
2752 # be empty on error (or when ARG is empty)
|
|
2753 func_convert_core_file_wine_to_w32 ()
|
|
2754 {
|
|
2755 $debug_cmd
|
|
2756
|
|
2757 func_convert_core_file_wine_to_w32_result=$1
|
|
2758 if test -n "$1"; then
|
|
2759 # Unfortunately, winepath does not exit with a non-zero error code, so we
|
|
2760 # are forced to check the contents of stdout. On the other hand, if the
|
|
2761 # command is not found, the shell will set an exit code of 127 and print
|
|
2762 # *an error message* to stdout. So we must check for both error code of
|
|
2763 # zero AND non-empty stdout, which explains the odd construction:
|
|
2764 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
|
|
2765 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
|
|
2766 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
|
|
2767 $SED -e "$sed_naive_backslashify"`
|
|
2768 else
|
|
2769 func_convert_core_file_wine_to_w32_result=
|
|
2770 fi
|
|
2771 fi
|
|
2772 }
|
|
2773 # end: func_convert_core_file_wine_to_w32
|
|
2774
|
|
2775
|
|
2776 # func_convert_core_path_wine_to_w32 ARG
|
|
2777 # Helper function used by path conversion functions when $build is *nix, and
|
|
2778 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
|
|
2779 # configured wine environment available, with the winepath program in $build's
|
|
2780 # $PATH. Assumes ARG has no leading or trailing path separator characters.
|
|
2781 #
|
|
2782 # ARG is path to be converted from $build format to win32.
|
|
2783 # Result is available in $func_convert_core_path_wine_to_w32_result.
|
|
2784 # Unconvertible file (directory) names in ARG are skipped; if no directory names
|
|
2785 # are convertible, then the result may be empty.
|
|
2786 func_convert_core_path_wine_to_w32 ()
|
|
2787 {
|
|
2788 $debug_cmd
|
|
2789
|
|
2790 # unfortunately, winepath doesn't convert paths, only file names
|
|
2791 func_convert_core_path_wine_to_w32_result=
|
|
2792 if test -n "$1"; then
|
|
2793 oldIFS=$IFS
|
|
2794 IFS=:
|
|
2795 for func_convert_core_path_wine_to_w32_f in $1; do
|
|
2796 IFS=$oldIFS
|
|
2797 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
|
|
2798 if test -n "$func_convert_core_file_wine_to_w32_result"; then
|
|
2799 if test -z "$func_convert_core_path_wine_to_w32_result"; then
|
|
2800 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
|
|
2801 else
|
|
2802 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
|
|
2803 fi
|
|
2804 fi
|
|
2805 done
|
|
2806 IFS=$oldIFS
|
|
2807 fi
|
|
2808 }
|
|
2809 # end: func_convert_core_path_wine_to_w32
|
|
2810
|
|
2811
|
|
2812 # func_cygpath ARGS...
|
|
2813 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
|
|
2814 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
|
|
2815 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
|
|
2816 # (2), returns the Cygwin file name or path in func_cygpath_result (input
|
|
2817 # file name or path is assumed to be in w32 format, as previously converted
|
|
2818 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
|
|
2819 # or path in func_cygpath_result (input file name or path is assumed to be in
|
|
2820 # Cygwin format). Returns an empty string on error.
|
|
2821 #
|
|
2822 # ARGS are passed to cygpath, with the last one being the file name or path to
|
|
2823 # be converted.
|
|
2824 #
|
|
2825 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
|
|
2826 # environment variable; do not put it in $PATH.
|
|
2827 func_cygpath ()
|
|
2828 {
|
|
2829 $debug_cmd
|
|
2830
|
|
2831 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
|
|
2832 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
|
|
2833 if test "$?" -ne 0; then
|
|
2834 # on failure, ensure result is empty
|
|
2835 func_cygpath_result=
|
|
2836 fi
|
|
2837 else
|
|
2838 func_cygpath_result=
|
|
2839 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
|
|
2840 fi
|
|
2841 }
|
|
2842 #end: func_cygpath
|
|
2843
|
|
2844
|
|
2845 # func_convert_core_msys_to_w32 ARG
|
|
2846 # Convert file name or path ARG from MSYS format to w32 format. Return
|
|
2847 # result in func_convert_core_msys_to_w32_result.
|
|
2848 func_convert_core_msys_to_w32 ()
|
|
2849 {
|
|
2850 $debug_cmd
|
|
2851
|
|
2852 # awkward: cmd appends spaces to result
|
|
2853 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
|
|
2854 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
|
|
2855 }
|
|
2856 #end: func_convert_core_msys_to_w32
|
|
2857
|
|
2858
|
|
2859 # func_convert_file_check ARG1 ARG2
|
|
2860 # Verify that ARG1 (a file name in $build format) was converted to $host
|
|
2861 # format in ARG2. Otherwise, emit an error message, but continue (resetting
|
|
2862 # func_to_host_file_result to ARG1).
|
|
2863 func_convert_file_check ()
|
|
2864 {
|
|
2865 $debug_cmd
|
|
2866
|
|
2867 if test -z "$2" && test -n "$1"; then
|
|
2868 func_error "Could not determine host file name corresponding to"
|
|
2869 func_error " '$1'"
|
|
2870 func_error "Continuing, but uninstalled executables may not work."
|
|
2871 # Fallback:
|
|
2872 func_to_host_file_result=$1
|
|
2873 fi
|
|
2874 }
|
|
2875 # end func_convert_file_check
|
|
2876
|
|
2877
|
|
2878 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
|
|
2879 # Verify that FROM_PATH (a path in $build format) was converted to $host
|
|
2880 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
|
|
2881 # func_to_host_file_result to a simplistic fallback value (see below).
|
|
2882 func_convert_path_check ()
|
|
2883 {
|
|
2884 $debug_cmd
|
|
2885
|
|
2886 if test -z "$4" && test -n "$3"; then
|
|
2887 func_error "Could not determine the host path corresponding to"
|
|
2888 func_error " '$3'"
|
|
2889 func_error "Continuing, but uninstalled executables may not work."
|
|
2890 # Fallback. This is a deliberately simplistic "conversion" and
|
|
2891 # should not be "improved". See libtool.info.
|
|
2892 if test "x$1" != "x$2"; then
|
|
2893 lt_replace_pathsep_chars="s|$1|$2|g"
|
|
2894 func_to_host_path_result=`echo "$3" |
|
|
2895 $SED -e "$lt_replace_pathsep_chars"`
|
|
2896 else
|
|
2897 func_to_host_path_result=$3
|
|
2898 fi
|
|
2899 fi
|
|
2900 }
|
|
2901 # end func_convert_path_check
|
|
2902
|
|
2903
|
|
2904 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
|
|
2905 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
|
|
2906 # and appending REPL if ORIG matches BACKPAT.
|
|
2907 func_convert_path_front_back_pathsep ()
|
|
2908 {
|
|
2909 $debug_cmd
|
|
2910
|
|
2911 case $4 in
|
|
2912 $1 ) func_to_host_path_result=$3$func_to_host_path_result
|
|
2913 ;;
|
|
2914 esac
|
|
2915 case $4 in
|
|
2916 $2 ) func_append func_to_host_path_result "$3"
|
|
2917 ;;
|
|
2918 esac
|
|
2919 }
|
|
2920 # end func_convert_path_front_back_pathsep
|
|
2921
|
|
2922
|
|
2923 ##################################################
|
|
2924 # $build to $host FILE NAME CONVERSION FUNCTIONS #
|
|
2925 ##################################################
|
|
2926 # invoked via '$to_host_file_cmd ARG'
|
|
2927 #
|
|
2928 # In each case, ARG is the path to be converted from $build to $host format.
|
|
2929 # Result will be available in $func_to_host_file_result.
|
|
2930
|
|
2931
|
|
2932 # func_to_host_file ARG
|
|
2933 # Converts the file name ARG from $build format to $host format. Return result
|
|
2934 # in func_to_host_file_result.
|
|
2935 func_to_host_file ()
|
|
2936 {
|
|
2937 $debug_cmd
|
|
2938
|
|
2939 $to_host_file_cmd "$1"
|
|
2940 }
|
|
2941 # end func_to_host_file
|
|
2942
|
|
2943
|
|
2944 # func_to_tool_file ARG LAZY
|
|
2945 # converts the file name ARG from $build format to toolchain format. Return
|
|
2946 # result in func_to_tool_file_result. If the conversion in use is listed
|
|
2947 # in (the comma separated) LAZY, no conversion takes place.
|
|
2948 func_to_tool_file ()
|
|
2949 {
|
|
2950 $debug_cmd
|
|
2951
|
|
2952 case ,$2, in
|
|
2953 *,"$to_tool_file_cmd",*)
|
|
2954 func_to_tool_file_result=$1
|
|
2955 ;;
|
|
2956 *)
|
|
2957 $to_tool_file_cmd "$1"
|
|
2958 func_to_tool_file_result=$func_to_host_file_result
|
|
2959 ;;
|
|
2960 esac
|
|
2961 }
|
|
2962 # end func_to_tool_file
|
|
2963
|
|
2964
|
|
2965 # func_convert_file_noop ARG
|
|
2966 # Copy ARG to func_to_host_file_result.
|
|
2967 func_convert_file_noop ()
|
|
2968 {
|
|
2969 func_to_host_file_result=$1
|
|
2970 }
|
|
2971 # end func_convert_file_noop
|
|
2972
|
|
2973
|
|
2974 # func_convert_file_msys_to_w32 ARG
|
|
2975 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
|
|
2976 # conversion to w32 is not available inside the cwrapper. Returns result in
|
|
2977 # func_to_host_file_result.
|
|
2978 func_convert_file_msys_to_w32 ()
|
|
2979 {
|
|
2980 $debug_cmd
|
|
2981
|
|
2982 func_to_host_file_result=$1
|
|
2983 if test -n "$1"; then
|
|
2984 func_convert_core_msys_to_w32 "$1"
|
|
2985 func_to_host_file_result=$func_convert_core_msys_to_w32_result
|
|
2986 fi
|
|
2987 func_convert_file_check "$1" "$func_to_host_file_result"
|
|
2988 }
|
|
2989 # end func_convert_file_msys_to_w32
|
|
2990
|
|
2991
|
|
2992 # func_convert_file_cygwin_to_w32 ARG
|
|
2993 # Convert file name ARG from Cygwin to w32 format. Returns result in
|
|
2994 # func_to_host_file_result.
|
|
2995 func_convert_file_cygwin_to_w32 ()
|
|
2996 {
|
|
2997 $debug_cmd
|
|
2998
|
|
2999 func_to_host_file_result=$1
|
|
3000 if test -n "$1"; then
|
|
3001 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
|
|
3002 # LT_CYGPATH in this case.
|
|
3003 func_to_host_file_result=`cygpath -m "$1"`
|
|
3004 fi
|
|
3005 func_convert_file_check "$1" "$func_to_host_file_result"
|
|
3006 }
|
|
3007 # end func_convert_file_cygwin_to_w32
|
|
3008
|
|
3009
|
|
3010 # func_convert_file_nix_to_w32 ARG
|
|
3011 # Convert file name ARG from *nix to w32 format. Requires a wine environment
|
|
3012 # and a working winepath. Returns result in func_to_host_file_result.
|
|
3013 func_convert_file_nix_to_w32 ()
|
|
3014 {
|
|
3015 $debug_cmd
|
|
3016
|
|
3017 func_to_host_file_result=$1
|
|
3018 if test -n "$1"; then
|
|
3019 func_convert_core_file_wine_to_w32 "$1"
|
|
3020 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
|
|
3021 fi
|
|
3022 func_convert_file_check "$1" "$func_to_host_file_result"
|
|
3023 }
|
|
3024 # end func_convert_file_nix_to_w32
|
|
3025
|
|
3026
|
|
3027 # func_convert_file_msys_to_cygwin ARG
|
|
3028 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
|
|
3029 # Returns result in func_to_host_file_result.
|
|
3030 func_convert_file_msys_to_cygwin ()
|
|
3031 {
|
|
3032 $debug_cmd
|
|
3033
|
|
3034 func_to_host_file_result=$1
|
|
3035 if test -n "$1"; then
|
|
3036 func_convert_core_msys_to_w32 "$1"
|
|
3037 func_cygpath -u "$func_convert_core_msys_to_w32_result"
|
|
3038 func_to_host_file_result=$func_cygpath_result
|
|
3039 fi
|
|
3040 func_convert_file_check "$1" "$func_to_host_file_result"
|
|
3041 }
|
|
3042 # end func_convert_file_msys_to_cygwin
|
|
3043
|
|
3044
|
|
3045 # func_convert_file_nix_to_cygwin ARG
|
|
3046 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
|
|
3047 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
|
|
3048 # in func_to_host_file_result.
|
|
3049 func_convert_file_nix_to_cygwin ()
|
|
3050 {
|
|
3051 $debug_cmd
|
|
3052
|
|
3053 func_to_host_file_result=$1
|
|
3054 if test -n "$1"; then
|
|
3055 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
|
|
3056 func_convert_core_file_wine_to_w32 "$1"
|
|
3057 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
|
|
3058 func_to_host_file_result=$func_cygpath_result
|
|
3059 fi
|
|
3060 func_convert_file_check "$1" "$func_to_host_file_result"
|
|
3061 }
|
|
3062 # end func_convert_file_nix_to_cygwin
|
|
3063
|
|
3064
|
|
3065 #############################################
|
|
3066 # $build to $host PATH CONVERSION FUNCTIONS #
|
|
3067 #############################################
|
|
3068 # invoked via '$to_host_path_cmd ARG'
|
|
3069 #
|
|
3070 # In each case, ARG is the path to be converted from $build to $host format.
|
|
3071 # The result will be available in $func_to_host_path_result.
|
|
3072 #
|
|
3073 # Path separators are also converted from $build format to $host format. If
|
|
3074 # ARG begins or ends with a path separator character, it is preserved (but
|
|
3075 # converted to $host format) on output.
|
|
3076 #
|
|
3077 # All path conversion functions are named using the following convention:
|
|
3078 # file name conversion function : func_convert_file_X_to_Y ()
|
|
3079 # path conversion function : func_convert_path_X_to_Y ()
|
|
3080 # where, for any given $build/$host combination the 'X_to_Y' value is the
|
|
3081 # same. If conversion functions are added for new $build/$host combinations,
|
|
3082 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
|
|
3083 # will break.
|
|
3084
|
|
3085
|
|
3086 # func_init_to_host_path_cmd
|
|
3087 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
|
|
3088 # appropriate value, based on the value of $to_host_file_cmd.
|
|
3089 to_host_path_cmd=
|
|
3090 func_init_to_host_path_cmd ()
|
|
3091 {
|
|
3092 $debug_cmd
|
|
3093
|
|
3094 if test -z "$to_host_path_cmd"; then
|
|
3095 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
|
|
3096 to_host_path_cmd=func_convert_path_$func_stripname_result
|
|
3097 fi
|
|
3098 }
|
|
3099
|
|
3100
|
|
3101 # func_to_host_path ARG
|
|
3102 # Converts the path ARG from $build format to $host format. Return result
|
|
3103 # in func_to_host_path_result.
|
|
3104 func_to_host_path ()
|
|
3105 {
|
|
3106 $debug_cmd
|
|
3107
|
|
3108 func_init_to_host_path_cmd
|
|
3109 $to_host_path_cmd "$1"
|
|
3110 }
|
|
3111 # end func_to_host_path
|
|
3112
|
|
3113
|
|
3114 # func_convert_path_noop ARG
|
|
3115 # Copy ARG to func_to_host_path_result.
|
|
3116 func_convert_path_noop ()
|
|
3117 {
|
|
3118 func_to_host_path_result=$1
|
|
3119 }
|
|
3120 # end func_convert_path_noop
|
|
3121
|
|
3122
|
|
3123 # func_convert_path_msys_to_w32 ARG
|
|
3124 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
|
|
3125 # conversion to w32 is not available inside the cwrapper. Returns result in
|
|
3126 # func_to_host_path_result.
|
|
3127 func_convert_path_msys_to_w32 ()
|
|
3128 {
|
|
3129 $debug_cmd
|
|
3130
|
|
3131 func_to_host_path_result=$1
|
|
3132 if test -n "$1"; then
|
|
3133 # Remove leading and trailing path separator characters from ARG. MSYS
|
|
3134 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
|
|
3135 # and winepath ignores them completely.
|
|
3136 func_stripname : : "$1"
|
|
3137 func_to_host_path_tmp1=$func_stripname_result
|
|
3138 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
|
|
3139 func_to_host_path_result=$func_convert_core_msys_to_w32_result
|
|
3140 func_convert_path_check : ";" \
|
|
3141 "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
|
3142 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
|
|
3143 fi
|
|
3144 }
|
|
3145 # end func_convert_path_msys_to_w32
|
|
3146
|
|
3147
|
|
3148 # func_convert_path_cygwin_to_w32 ARG
|
|
3149 # Convert path ARG from Cygwin to w32 format. Returns result in
|
|
3150 # func_to_host_file_result.
|
|
3151 func_convert_path_cygwin_to_w32 ()
|
|
3152 {
|
|
3153 $debug_cmd
|
|
3154
|
|
3155 func_to_host_path_result=$1
|
|
3156 if test -n "$1"; then
|
|
3157 # See func_convert_path_msys_to_w32:
|
|
3158 func_stripname : : "$1"
|
|
3159 func_to_host_path_tmp1=$func_stripname_result
|
|
3160 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
|
|
3161 func_convert_path_check : ";" \
|
|
3162 "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
|
3163 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
|
|
3164 fi
|
|
3165 }
|
|
3166 # end func_convert_path_cygwin_to_w32
|
|
3167
|
|
3168
|
|
3169 # func_convert_path_nix_to_w32 ARG
|
|
3170 # Convert path ARG from *nix to w32 format. Requires a wine environment and
|
|
3171 # a working winepath. Returns result in func_to_host_file_result.
|
|
3172 func_convert_path_nix_to_w32 ()
|
|
3173 {
|
|
3174 $debug_cmd
|
|
3175
|
|
3176 func_to_host_path_result=$1
|
|
3177 if test -n "$1"; then
|
|
3178 # See func_convert_path_msys_to_w32:
|
|
3179 func_stripname : : "$1"
|
|
3180 func_to_host_path_tmp1=$func_stripname_result
|
|
3181 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
|
|
3182 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
|
|
3183 func_convert_path_check : ";" \
|
|
3184 "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
|
3185 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
|
|
3186 fi
|
|
3187 }
|
|
3188 # end func_convert_path_nix_to_w32
|
|
3189
|
|
3190
|
|
3191 # func_convert_path_msys_to_cygwin ARG
|
|
3192 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
|
|
3193 # Returns result in func_to_host_file_result.
|
|
3194 func_convert_path_msys_to_cygwin ()
|
|
3195 {
|
|
3196 $debug_cmd
|
|
3197
|
|
3198 func_to_host_path_result=$1
|
|
3199 if test -n "$1"; then
|
|
3200 # See func_convert_path_msys_to_w32:
|
|
3201 func_stripname : : "$1"
|
|
3202 func_to_host_path_tmp1=$func_stripname_result
|
|
3203 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
|
|
3204 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
|
|
3205 func_to_host_path_result=$func_cygpath_result
|
|
3206 func_convert_path_check : : \
|
|
3207 "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
|
3208 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
|
|
3209 fi
|
|
3210 }
|
|
3211 # end func_convert_path_msys_to_cygwin
|
|
3212
|
|
3213
|
|
3214 # func_convert_path_nix_to_cygwin ARG
|
|
3215 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
|
|
3216 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
|
|
3217 # func_to_host_file_result.
|
|
3218 func_convert_path_nix_to_cygwin ()
|
|
3219 {
|
|
3220 $debug_cmd
|
|
3221
|
|
3222 func_to_host_path_result=$1
|
|
3223 if test -n "$1"; then
|
|
3224 # Remove leading and trailing path separator characters from
|
|
3225 # ARG. msys behavior is inconsistent here, cygpath turns them
|
|
3226 # into '.;' and ';.', and winepath ignores them completely.
|
|
3227 func_stripname : : "$1"
|
|
3228 func_to_host_path_tmp1=$func_stripname_result
|
|
3229 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
|
|
3230 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
|
|
3231 func_to_host_path_result=$func_cygpath_result
|
|
3232 func_convert_path_check : : \
|
|
3233 "$func_to_host_path_tmp1" "$func_to_host_path_result"
|
|
3234 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
|
|
3235 fi
|
|
3236 }
|
|
3237 # end func_convert_path_nix_to_cygwin
|
|
3238
|
|
3239
|
|
3240 # func_dll_def_p FILE
|
|
3241 # True iff FILE is a Windows DLL '.def' file.
|
|
3242 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
|
|
3243 func_dll_def_p ()
|
|
3244 {
|
|
3245 $debug_cmd
|
|
3246
|
|
3247 func_dll_def_p_tmp=`$SED -n \
|
|
3248 -e 's/^[ ]*//' \
|
|
3249 -e '/^\(;.*\)*$/d' \
|
|
3250 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
|
|
3251 -e q \
|
|
3252 "$1"`
|
|
3253 test DEF = "$func_dll_def_p_tmp"
|
|
3254 }
|
|
3255
|
|
3256
|
|
3257 # func_mode_compile arg...
|
|
3258 func_mode_compile ()
|
|
3259 {
|
|
3260 $debug_cmd
|
|
3261
|
|
3262 # Get the compilation command and the source file.
|
|
3263 base_compile=
|
|
3264 srcfile=$nonopt # always keep a non-empty value in "srcfile"
|
|
3265 suppress_opt=yes
|
|
3266 suppress_output=
|
|
3267 arg_mode=normal
|
|
3268 libobj=
|
|
3269 later=
|
|
3270 pie_flag=
|
|
3271
|
|
3272 for arg
|
|
3273 do
|
|
3274 case $arg_mode in
|
|
3275 arg )
|
|
3276 # do not "continue". Instead, add this to base_compile
|
|
3277 lastarg=$arg
|
|
3278 arg_mode=normal
|
|
3279 ;;
|
|
3280
|
|
3281 target )
|
|
3282 libobj=$arg
|
|
3283 arg_mode=normal
|
|
3284 continue
|
|
3285 ;;
|
|
3286
|
|
3287 normal )
|
|
3288 # Accept any command-line options.
|
|
3289 case $arg in
|
|
3290 -o)
|
|
3291 test -n "$libobj" && \
|
|
3292 func_fatal_error "you cannot specify '-o' more than once"
|
|
3293 arg_mode=target
|
|
3294 continue
|
|
3295 ;;
|
|
3296
|
|
3297 -pie | -fpie | -fPIE)
|
|
3298 func_append pie_flag " $arg"
|
|
3299 continue
|
|
3300 ;;
|
|
3301
|
|
3302 -shared | -static | -prefer-pic | -prefer-non-pic)
|
|
3303 func_append later " $arg"
|
|
3304 continue
|
|
3305 ;;
|
|
3306
|
|
3307 -no-suppress)
|
|
3308 suppress_opt=no
|
|
3309 continue
|
|
3310 ;;
|
|
3311
|
|
3312 -Xcompiler)
|
|
3313 arg_mode=arg # the next one goes into the "base_compile" arg list
|
|
3314 continue # The current "srcfile" will either be retained or
|
|
3315 ;; # replaced later. I would guess that would be a bug.
|
|
3316
|
|
3317 -Wc,*)
|
|
3318 func_stripname '-Wc,' '' "$arg"
|
|
3319 args=$func_stripname_result
|
|
3320 lastarg=
|
|
3321 save_ifs=$IFS; IFS=,
|
|
3322 for arg in $args; do
|
|
3323 IFS=$save_ifs
|
|
3324 func_append_quoted lastarg "$arg"
|
|
3325 done
|
|
3326 IFS=$save_ifs
|
|
3327 func_stripname ' ' '' "$lastarg"
|
|
3328 lastarg=$func_stripname_result
|
|
3329
|
|
3330 # Add the arguments to base_compile.
|
|
3331 func_append base_compile " $lastarg"
|
|
3332 continue
|
|
3333 ;;
|
|
3334
|
|
3335 *)
|
|
3336 # Accept the current argument as the source file.
|
|
3337 # The previous "srcfile" becomes the current argument.
|
|
3338 #
|
|
3339 lastarg=$srcfile
|
|
3340 srcfile=$arg
|
|
3341 ;;
|
|
3342 esac # case $arg
|
|
3343 ;;
|
|
3344 esac # case $arg_mode
|
|
3345
|
|
3346 # Aesthetically quote the previous argument.
|
|
3347 func_append_quoted base_compile "$lastarg"
|
|
3348 done # for arg
|
|
3349
|
|
3350 case $arg_mode in
|
|
3351 arg)
|
|
3352 func_fatal_error "you must specify an argument for -Xcompile"
|
|
3353 ;;
|
|
3354 target)
|
|
3355 func_fatal_error "you must specify a target with '-o'"
|
|
3356 ;;
|
|
3357 *)
|
|
3358 # Get the name of the library object.
|
|
3359 test -z "$libobj" && {
|
|
3360 func_basename "$srcfile"
|
|
3361 libobj=$func_basename_result
|
|
3362 }
|
|
3363 ;;
|
|
3364 esac
|
|
3365
|
|
3366 # Recognize several different file suffixes.
|
|
3367 # If the user specifies -o file.o, it is replaced with file.lo
|
|
3368 case $libobj in
|
|
3369 *.[cCFSifmso] | \
|
|
3370 *.ada | *.adb | *.ads | *.asm | \
|
|
3371 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
|
|
3372 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
|
|
3373 func_xform "$libobj"
|
|
3374 libobj=$func_xform_result
|
|
3375 ;;
|
|
3376 esac
|
|
3377
|
|
3378 case $libobj in
|
|
3379 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
|
|
3380 *)
|
|
3381 func_fatal_error "cannot determine name of library object from '$libobj'"
|
|
3382 ;;
|
|
3383 esac
|
|
3384
|
|
3385 func_infer_tag $base_compile
|
|
3386
|
|
3387 for arg in $later; do
|
|
3388 case $arg in
|
|
3389 -shared)
|
|
3390 test yes = "$build_libtool_libs" \
|
|
3391 || func_fatal_configuration "cannot build a shared library"
|
|
3392 build_old_libs=no
|
|
3393 continue
|
|
3394 ;;
|
|
3395
|
|
3396 -static)
|
|
3397 build_libtool_libs=no
|
|
3398 build_old_libs=yes
|
|
3399 continue
|
|
3400 ;;
|
|
3401
|
|
3402 -prefer-pic)
|
|
3403 pic_mode=yes
|
|
3404 continue
|
|
3405 ;;
|
|
3406
|
|
3407 -prefer-non-pic)
|
|
3408 pic_mode=no
|
|
3409 continue
|
|
3410 ;;
|
|
3411 esac
|
|
3412 done
|
|
3413
|
|
3414 func_quote_for_eval "$libobj"
|
|
3415 test "X$libobj" != "X$func_quote_for_eval_result" \
|
|
3416 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
|
|
3417 && func_warning "libobj name '$libobj' may not contain shell special characters."
|
|
3418 func_dirname_and_basename "$obj" "/" ""
|
|
3419 objname=$func_basename_result
|
|
3420 xdir=$func_dirname_result
|
|
3421 lobj=$xdir$objdir/$objname
|
|
3422
|
|
3423 test -z "$base_compile" && \
|
|
3424 func_fatal_help "you must specify a compilation command"
|
|
3425
|
|
3426 # Delete any leftover library objects.
|
|
3427 if test yes = "$build_old_libs"; then
|
|
3428 removelist="$obj $lobj $libobj ${libobj}T"
|
|
3429 else
|
|
3430 removelist="$lobj $libobj ${libobj}T"
|
|
3431 fi
|
|
3432
|
|
3433 # On Cygwin there's no "real" PIC flag so we must build both object types
|
|
3434 case $host_os in
|
|
3435 cygwin* | mingw* | pw32* | os2* | cegcc*)
|
|
3436 pic_mode=default
|
|
3437 ;;
|
|
3438 esac
|
|
3439 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
|
|
3440 # non-PIC code in shared libraries is not supported
|
|
3441 pic_mode=default
|
|
3442 fi
|
|
3443
|
|
3444 # Calculate the filename of the output object if compiler does
|
|
3445 # not support -o with -c
|
|
3446 if test no = "$compiler_c_o"; then
|
|
3447 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
|
|
3448 lockfile=$output_obj.lock
|
|
3449 else
|
|
3450 output_obj=
|
|
3451 need_locks=no
|
|
3452 lockfile=
|
|
3453 fi
|
|
3454
|
|
3455 # Lock this critical section if it is needed
|
|
3456 # We use this script file to make the link, it avoids creating a new file
|
|
3457 if test yes = "$need_locks"; then
|
|
3458 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
|
|
3459 func_echo "Waiting for $lockfile to be removed"
|
|
3460 sleep 2
|
|
3461 done
|
|
3462 elif test warn = "$need_locks"; then
|
|
3463 if test -f "$lockfile"; then
|
|
3464 $ECHO "\
|
|
3465 *** ERROR, $lockfile exists and contains:
|
|
3466 `cat $lockfile 2>/dev/null`
|
|
3467
|
|
3468 This indicates that another process is trying to use the same
|
|
3469 temporary object file, and libtool could not work around it because
|
|
3470 your compiler does not support '-c' and '-o' together. If you
|
|
3471 repeat this compilation, it may succeed, by chance, but you had better
|
|
3472 avoid parallel builds (make -j) in this platform, or get a better
|
|
3473 compiler."
|
|
3474
|
|
3475 $opt_dry_run || $RM $removelist
|
|
3476 exit $EXIT_FAILURE
|
|
3477 fi
|
|
3478 func_append removelist " $output_obj"
|
|
3479 $ECHO "$srcfile" > "$lockfile"
|
|
3480 fi
|
|
3481
|
|
3482 $opt_dry_run || $RM $removelist
|
|
3483 func_append removelist " $lockfile"
|
|
3484 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
|
|
3485
|
|
3486 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
|
|
3487 srcfile=$func_to_tool_file_result
|
|
3488 func_quote_for_eval "$srcfile"
|
|
3489 qsrcfile=$func_quote_for_eval_result
|
|
3490
|
|
3491 # Only build a PIC object if we are building libtool libraries.
|
|
3492 if test yes = "$build_libtool_libs"; then
|
|
3493 # Without this assignment, base_compile gets emptied.
|
|
3494 fbsd_hideous_sh_bug=$base_compile
|
|
3495
|
|
3496 if test no != "$pic_mode"; then
|
|
3497 command="$base_compile $qsrcfile $pic_flag"
|
|
3498 else
|
|
3499 # Don't build PIC code
|
|
3500 command="$base_compile $qsrcfile"
|
|
3501 fi
|
|
3502
|
|
3503 func_mkdir_p "$xdir$objdir"
|
|
3504
|
|
3505 if test -z "$output_obj"; then
|
|
3506 # Place PIC objects in $objdir
|
|
3507 func_append command " -o $lobj"
|
|
3508 fi
|
|
3509
|
|
3510 func_show_eval_locale "$command" \
|
|
3511 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
|
|
3512
|
|
3513 if test warn = "$need_locks" &&
|
|
3514 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
|
|
3515 $ECHO "\
|
|
3516 *** ERROR, $lockfile contains:
|
|
3517 `cat $lockfile 2>/dev/null`
|
|
3518
|
|
3519 but it should contain:
|
|
3520 $srcfile
|
|
3521
|
|
3522 This indicates that another process is trying to use the same
|
|
3523 temporary object file, and libtool could not work around it because
|
|
3524 your compiler does not support '-c' and '-o' together. If you
|
|
3525 repeat this compilation, it may succeed, by chance, but you had better
|
|
3526 avoid parallel builds (make -j) in this platform, or get a better
|
|
3527 compiler."
|
|
3528
|
|
3529 $opt_dry_run || $RM $removelist
|
|
3530 exit $EXIT_FAILURE
|
|
3531 fi
|
|
3532
|
|
3533 # Just move the object if needed, then go on to compile the next one
|
|
3534 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
|
|
3535 func_show_eval '$MV "$output_obj" "$lobj"' \
|
|
3536 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
|
|
3537 fi
|
|
3538
|
|
3539 # Allow error messages only from the first compilation.
|
|
3540 if test yes = "$suppress_opt"; then
|
|
3541 suppress_output=' >/dev/null 2>&1'
|
|
3542 fi
|
|
3543 fi
|
|
3544
|
|
3545 # Only build a position-dependent object if we build old libraries.
|
|
3546 if test yes = "$build_old_libs"; then
|
|
3547 if test yes != "$pic_mode"; then
|
|
3548 # Don't build PIC code
|
|
3549 command="$base_compile $qsrcfile$pie_flag"
|
|
3550 else
|
|
3551 command="$base_compile $qsrcfile $pic_flag"
|
|
3552 fi
|
|
3553 if test yes = "$compiler_c_o"; then
|
|
3554 func_append command " -o $obj"
|
|
3555 fi
|
|
3556
|
|
3557 # Suppress compiler output if we already did a PIC compilation.
|
|
3558 func_append command "$suppress_output"
|
|
3559 func_show_eval_locale "$command" \
|
|
3560 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
|
|
3561
|
|
3562 if test warn = "$need_locks" &&
|
|
3563 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
|
|
3564 $ECHO "\
|
|
3565 *** ERROR, $lockfile contains:
|
|
3566 `cat $lockfile 2>/dev/null`
|
|
3567
|
|
3568 but it should contain:
|
|
3569 $srcfile
|
|
3570
|
|
3571 This indicates that another process is trying to use the same
|
|
3572 temporary object file, and libtool could not work around it because
|
|
3573 your compiler does not support '-c' and '-o' together. If you
|
|
3574 repeat this compilation, it may succeed, by chance, but you had better
|
|
3575 avoid parallel builds (make -j) in this platform, or get a better
|
|
3576 compiler."
|
|
3577
|
|
3578 $opt_dry_run || $RM $removelist
|
|
3579 exit $EXIT_FAILURE
|
|
3580 fi
|
|
3581
|
|
3582 # Just move the object if needed
|
|
3583 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
|
|
3584 func_show_eval '$MV "$output_obj" "$obj"' \
|
|
3585 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
|
|
3586 fi
|
|
3587 fi
|
|
3588
|
|
3589 $opt_dry_run || {
|
|
3590 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
|
|
3591
|
|
3592 # Unlock the critical section if it was locked
|
|
3593 if test no != "$need_locks"; then
|
|
3594 removelist=$lockfile
|
|
3595 $RM "$lockfile"
|
|
3596 fi
|
|
3597 }
|
|
3598
|
|
3599 exit $EXIT_SUCCESS
|
|
3600 }
|
|
3601
|
|
3602 $opt_help || {
|
|
3603 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
|
|
3604 }
|
|
3605
|
|
3606 func_mode_help ()
|
|
3607 {
|
|
3608 # We need to display help for each of the modes.
|
|
3609 case $opt_mode in
|
|
3610 "")
|
|
3611 # Generic help is extracted from the usage comments
|
|
3612 # at the start of this file.
|
|
3613 func_help
|
|
3614 ;;
|
|
3615
|
|
3616 clean)
|
|
3617 $ECHO \
|
|
3618 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
|
|
3619
|
|
3620 Remove files from the build directory.
|
|
3621
|
|
3622 RM is the name of the program to use to delete files associated with each FILE
|
|
3623 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
|
|
3624 to RM.
|
|
3625
|
|
3626 If FILE is a libtool library, object or program, all the files associated
|
|
3627 with it are deleted. Otherwise, only FILE itself is deleted using RM."
|
|
3628 ;;
|
|
3629
|
|
3630 compile)
|
|
3631 $ECHO \
|
|
3632 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
|
|
3633
|
|
3634 Compile a source file into a libtool library object.
|
|
3635
|
|
3636 This mode accepts the following additional options:
|
|
3637
|
|
3638 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
|
|
3639 -no-suppress do not suppress compiler output for multiple passes
|
|
3640 -prefer-pic try to build PIC objects only
|
|
3641 -prefer-non-pic try to build non-PIC objects only
|
|
3642 -shared do not build a '.o' file suitable for static linking
|
|
3643 -static only build a '.o' file suitable for static linking
|
|
3644 -Wc,FLAG pass FLAG directly to the compiler
|
|
3645
|
|
3646 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
|
|
3647 from the given SOURCEFILE.
|
|
3648
|
|
3649 The output file name is determined by removing the directory component from
|
|
3650 SOURCEFILE, then substituting the C source code suffix '.c' with the
|
|
3651 library object suffix, '.lo'."
|
|
3652 ;;
|
|
3653
|
|
3654 execute)
|
|
3655 $ECHO \
|
|
3656 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
|
|
3657
|
|
3658 Automatically set library path, then run a program.
|
|
3659
|
|
3660 This mode accepts the following additional options:
|
|
3661
|
|
3662 -dlopen FILE add the directory containing FILE to the library path
|
|
3663
|
|
3664 This mode sets the library path environment variable according to '-dlopen'
|
|
3665 flags.
|
|
3666
|
|
3667 If any of the ARGS are libtool executable wrappers, then they are translated
|
|
3668 into their corresponding uninstalled binary, and any of their required library
|
|
3669 directories are added to the library path.
|
|
3670
|
|
3671 Then, COMMAND is executed, with ARGS as arguments."
|
|
3672 ;;
|
|
3673
|
|
3674 finish)
|
|
3675 $ECHO \
|
|
3676 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
|
|
3677
|
|
3678 Complete the installation of libtool libraries.
|
|
3679
|
|
3680 Each LIBDIR is a directory that contains libtool libraries.
|
|
3681
|
|
3682 The commands that this mode executes may require superuser privileges. Use
|
|
3683 the '--dry-run' option if you just want to see what would be executed."
|
|
3684 ;;
|
|
3685
|
|
3686 install)
|
|
3687 $ECHO \
|
|
3688 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
|
|
3689
|
|
3690 Install executables or libraries.
|
|
3691
|
|
3692 INSTALL-COMMAND is the installation command. The first component should be
|
|
3693 either the 'install' or 'cp' program.
|
|
3694
|
|
3695 The following components of INSTALL-COMMAND are treated specially:
|
|
3696
|
|
3697 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
|
|
3698
|
|
3699 The rest of the components are interpreted as arguments to that command (only
|
|
3700 BSD-compatible install options are recognized)."
|
|
3701 ;;
|
|
3702
|
|
3703 link)
|
|
3704 $ECHO \
|
|
3705 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
|
|
3706
|
|
3707 Link object files or libraries together to form another library, or to
|
|
3708 create an executable program.
|
|
3709
|
|
3710 LINK-COMMAND is a command using the C compiler that you would use to create
|
|
3711 a program from several object files.
|
|
3712
|
|
3713 The following components of LINK-COMMAND are treated specially:
|
|
3714
|
|
3715 -all-static do not do any dynamic linking at all
|
|
3716 -avoid-version do not add a version suffix if possible
|
|
3717 -bindir BINDIR specify path to binaries directory (for systems where
|
|
3718 libraries must be found in the PATH setting at runtime)
|
|
3719 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
|
|
3720 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
|
|
3721 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
|
|
3722 -export-symbols SYMFILE
|
|
3723 try to export only the symbols listed in SYMFILE
|
|
3724 -export-symbols-regex REGEX
|
|
3725 try to export only the symbols matching REGEX
|
|
3726 -LLIBDIR search LIBDIR for required installed libraries
|
|
3727 -lNAME OUTPUT-FILE requires the installed library libNAME
|
|
3728 -module build a library that can dlopened
|
|
3729 -no-fast-install disable the fast-install mode
|
|
3730 -no-install link a not-installable executable
|
|
3731 -no-undefined declare that a library does not refer to external symbols
|
|
3732 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
|
|
3733 -objectlist FILE use a list of object files found in FILE to specify objects
|
|
3734 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
|
|
3735 -precious-files-regex REGEX
|
|
3736 don't remove output files matching REGEX
|
|
3737 -release RELEASE specify package release information
|
|
3738 -rpath LIBDIR the created library will eventually be installed in LIBDIR
|
|
3739 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
|
|
3740 -shared only do dynamic linking of libtool libraries
|
|
3741 -shrext SUFFIX override the standard shared library file extension
|
|
3742 -static do not do any dynamic linking of uninstalled libtool libraries
|
|
3743 -static-libtool-libs
|
|
3744 do not do any dynamic linking of libtool libraries
|
|
3745 -version-info CURRENT[:REVISION[:AGE]]
|
|
3746 specify library version info [each variable defaults to 0]
|
|
3747 -weak LIBNAME declare that the target provides the LIBNAME interface
|
|
3748 -Wc,FLAG
|
|
3749 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
|
|
3750 -Wl,FLAG
|
|
3751 -Xlinker FLAG pass linker-specific FLAG directly to the linker
|
|
3752 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
|
|
3753
|
|
3754 All other options (arguments beginning with '-') are ignored.
|
|
3755
|
|
3756 Every other argument is treated as a filename. Files ending in '.la' are
|
|
3757 treated as uninstalled libtool libraries, other files are standard or library
|
|
3758 object files.
|
|
3759
|
|
3760 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
|
|
3761 only library objects ('.lo' files) may be specified, and '-rpath' is
|
|
3762 required, except when creating a convenience library.
|
|
3763
|
|
3764 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
|
|
3765 using 'ar' and 'ranlib', or on Windows using 'lib'.
|
|
3766
|
|
3767 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
|
|
3768 is created, otherwise an executable program is created."
|
|
3769 ;;
|
|
3770
|
|
3771 uninstall)
|
|
3772 $ECHO \
|
|
3773 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
|
|
3774
|
|
3775 Remove libraries from an installation directory.
|
|
3776
|
|
3777 RM is the name of the program to use to delete files associated with each FILE
|
|
3778 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
|
|
3779 to RM.
|
|
3780
|
|
3781 If FILE is a libtool library, all the files associated with it are deleted.
|
|
3782 Otherwise, only FILE itself is deleted using RM."
|
|
3783 ;;
|
|
3784
|
|
3785 *)
|
|
3786 func_fatal_help "invalid operation mode '$opt_mode'"
|
|
3787 ;;
|
|
3788 esac
|
|
3789
|
|
3790 echo
|
|
3791 $ECHO "Try '$progname --help' for more information about other modes."
|
|
3792 }
|
|
3793
|
|
3794 # Now that we've collected a possible --mode arg, show help if necessary
|
|
3795 if $opt_help; then
|
|
3796 if test : = "$opt_help"; then
|
|
3797 func_mode_help
|
|
3798 else
|
|
3799 {
|
|
3800 func_help noexit
|
|
3801 for opt_mode in compile link execute install finish uninstall clean; do
|
|
3802 func_mode_help
|
|
3803 done
|
|
3804 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
|
|
3805 {
|
|
3806 func_help noexit
|
|
3807 for opt_mode in compile link execute install finish uninstall clean; do
|
|
3808 echo
|
|
3809 func_mode_help
|
|
3810 done
|
|
3811 } |
|
|
3812 $SED '1d
|
|
3813 /^When reporting/,/^Report/{
|
|
3814 H
|
|
3815 d
|
|
3816 }
|
|
3817 $x
|
|
3818 /information about other modes/d
|
|
3819 /more detailed .*MODE/d
|
|
3820 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
|
|
3821 fi
|
|
3822 exit $?
|
|
3823 fi
|
|
3824
|
|
3825
|
|
3826 # func_mode_execute arg...
|
|
3827 func_mode_execute ()
|
|
3828 {
|
|
3829 $debug_cmd
|
|
3830
|
|
3831 # The first argument is the command name.
|
|
3832 cmd=$nonopt
|
|
3833 test -z "$cmd" && \
|
|
3834 func_fatal_help "you must specify a COMMAND"
|
|
3835
|
|
3836 # Handle -dlopen flags immediately.
|
|
3837 for file in $opt_dlopen; do
|
|
3838 test -f "$file" \
|
|
3839 || func_fatal_help "'$file' is not a file"
|
|
3840
|
|
3841 dir=
|
|
3842 case $file in
|
|
3843 *.la)
|
|
3844 func_resolve_sysroot "$file"
|
|
3845 file=$func_resolve_sysroot_result
|
|
3846
|
|
3847 # Check to see that this really is a libtool archive.
|
|
3848 func_lalib_unsafe_p "$file" \
|
|
3849 || func_fatal_help "'$lib' is not a valid libtool archive"
|
|
3850
|
|
3851 # Read the libtool library.
|
|
3852 dlname=
|
|
3853 library_names=
|
|
3854 func_source "$file"
|
|
3855
|
|
3856 # Skip this library if it cannot be dlopened.
|
|
3857 if test -z "$dlname"; then
|
|
3858 # Warn if it was a shared library.
|
|
3859 test -n "$library_names" && \
|
|
3860 func_warning "'$file' was not linked with '-export-dynamic'"
|
|
3861 continue
|
|
3862 fi
|
|
3863
|
|
3864 func_dirname "$file" "" "."
|
|
3865 dir=$func_dirname_result
|
|
3866
|
|
3867 if test -f "$dir/$objdir/$dlname"; then
|
|
3868 func_append dir "/$objdir"
|
|
3869 else
|
|
3870 if test ! -f "$dir/$dlname"; then
|
|
3871 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
|
|
3872 fi
|
|
3873 fi
|
|
3874 ;;
|
|
3875
|
|
3876 *.lo)
|
|
3877 # Just add the directory containing the .lo file.
|
|
3878 func_dirname "$file" "" "."
|
|
3879 dir=$func_dirname_result
|
|
3880 ;;
|
|
3881
|
|
3882 *)
|
|
3883 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
|
|
3884 continue
|
|
3885 ;;
|
|
3886 esac
|
|
3887
|
|
3888 # Get the absolute pathname.
|
|
3889 absdir=`cd "$dir" && pwd`
|
|
3890 test -n "$absdir" && dir=$absdir
|
|
3891
|
|
3892 # Now add the directory to shlibpath_var.
|
|
3893 if eval "test -z \"\$$shlibpath_var\""; then
|
|
3894 eval "$shlibpath_var=\"\$dir\""
|
|
3895 else
|
|
3896 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
|
|
3897 fi
|
|
3898 done
|
|
3899
|
|
3900 # This variable tells wrapper scripts just to set shlibpath_var
|
|
3901 # rather than running their programs.
|
|
3902 libtool_execute_magic=$magic
|
|
3903
|
|
3904 # Check if any of the arguments is a wrapper script.
|
|
3905 args=
|
|
3906 for file
|
|
3907 do
|
|
3908 case $file in
|
|
3909 -* | *.la | *.lo ) ;;
|
|
3910 *)
|
|
3911 # Do a test to see if this is really a libtool program.
|
|
3912 if func_ltwrapper_script_p "$file"; then
|
|
3913 func_source "$file"
|
|
3914 # Transform arg to wrapped name.
|
|
3915 file=$progdir/$program
|
|
3916 elif func_ltwrapper_executable_p "$file"; then
|
|
3917 func_ltwrapper_scriptname "$file"
|
|
3918 func_source "$func_ltwrapper_scriptname_result"
|
|
3919 # Transform arg to wrapped name.
|
|
3920 file=$progdir/$program
|
|
3921 fi
|
|
3922 ;;
|
|
3923 esac
|
|
3924 # Quote arguments (to preserve shell metacharacters).
|
|
3925 func_append_quoted args "$file"
|
|
3926 done
|
|
3927
|
|
3928 if $opt_dry_run; then
|
|
3929 # Display what would be done.
|
|
3930 if test -n "$shlibpath_var"; then
|
|
3931 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
|
|
3932 echo "export $shlibpath_var"
|
|
3933 fi
|
|
3934 $ECHO "$cmd$args"
|
|
3935 exit $EXIT_SUCCESS
|
|
3936 else
|
|
3937 if test -n "$shlibpath_var"; then
|
|
3938 # Export the shlibpath_var.
|
|
3939 eval "export $shlibpath_var"
|
|
3940 fi
|
|
3941
|
|
3942 # Restore saved environment variables
|
|
3943 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
|
3944 do
|
|
3945 eval "if test \"\${save_$lt_var+set}\" = set; then
|
|
3946 $lt_var=\$save_$lt_var; export $lt_var
|
|
3947 else
|
|
3948 $lt_unset $lt_var
|
|
3949 fi"
|
|
3950 done
|
|
3951
|
|
3952 # Now prepare to actually exec the command.
|
|
3953 exec_cmd=\$cmd$args
|
|
3954 fi
|
|
3955 }
|
|
3956
|
|
3957 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
|
|
3958
|
|
3959
|
|
3960 # func_mode_finish arg...
|
|
3961 func_mode_finish ()
|
|
3962 {
|
|
3963 $debug_cmd
|
|
3964
|
|
3965 libs=
|
|
3966 libdirs=
|
|
3967 admincmds=
|
|
3968
|
|
3969 for opt in "$nonopt" ${1+"$@"}
|
|
3970 do
|
|
3971 if test -d "$opt"; then
|
|
3972 func_append libdirs " $opt"
|
|
3973
|
|
3974 elif test -f "$opt"; then
|
|
3975 if func_lalib_unsafe_p "$opt"; then
|
|
3976 func_append libs " $opt"
|
|
3977 else
|
|
3978 func_warning "'$opt' is not a valid libtool archive"
|
|
3979 fi
|
|
3980
|
|
3981 else
|
|
3982 func_fatal_error "invalid argument '$opt'"
|
|
3983 fi
|
|
3984 done
|
|
3985
|
|
3986 if test -n "$libs"; then
|
|
3987 if test -n "$lt_sysroot"; then
|
|
3988 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
|
|
3989 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
|
|
3990 else
|
|
3991 sysroot_cmd=
|
|
3992 fi
|
|
3993
|
|
3994 # Remove sysroot references
|
|
3995 if $opt_dry_run; then
|
|
3996 for lib in $libs; do
|
|
3997 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
|
|
3998 done
|
|
3999 else
|
|
4000 tmpdir=`func_mktempdir`
|
|
4001 for lib in $libs; do
|
|
4002 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
|
|
4003 > $tmpdir/tmp-la
|
|
4004 mv -f $tmpdir/tmp-la $lib
|
|
4005 done
|
|
4006 ${RM}r "$tmpdir"
|
|
4007 fi
|
|
4008 fi
|
|
4009
|
|
4010 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
|
|
4011 for libdir in $libdirs; do
|
|
4012 if test -n "$finish_cmds"; then
|
|
4013 # Do each command in the finish commands.
|
|
4014 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
|
|
4015 '"$cmd"'"'
|
|
4016 fi
|
|
4017 if test -n "$finish_eval"; then
|
|
4018 # Do the single finish_eval.
|
|
4019 eval cmds=\"$finish_eval\"
|
|
4020 $opt_dry_run || eval "$cmds" || func_append admincmds "
|
|
4021 $cmds"
|
|
4022 fi
|
|
4023 done
|
|
4024 fi
|
|
4025
|
|
4026 # Exit here if they wanted silent mode.
|
|
4027 $opt_quiet && exit $EXIT_SUCCESS
|
|
4028
|
|
4029 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
|
|
4030 echo "----------------------------------------------------------------------"
|
|
4031 echo "Libraries have been installed in:"
|
|
4032 for libdir in $libdirs; do
|
|
4033 $ECHO " $libdir"
|
|
4034 done
|
|
4035 echo
|
|
4036 echo "If you ever happen to want to link against installed libraries"
|
|
4037 echo "in a given directory, LIBDIR, you must either use libtool, and"
|
|
4038 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
|
|
4039 echo "flag during linking and do at least one of the following:"
|
|
4040 if test -n "$shlibpath_var"; then
|
|
4041 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
|
|
4042 echo " during execution"
|
|
4043 fi
|
|
4044 if test -n "$runpath_var"; then
|
|
4045 echo " - add LIBDIR to the '$runpath_var' environment variable"
|
|
4046 echo " during linking"
|
|
4047 fi
|
|
4048 if test -n "$hardcode_libdir_flag_spec"; then
|
|
4049 libdir=LIBDIR
|
|
4050 eval flag=\"$hardcode_libdir_flag_spec\"
|
|
4051
|
|
4052 $ECHO " - use the '$flag' linker flag"
|
|
4053 fi
|
|
4054 if test -n "$admincmds"; then
|
|
4055 $ECHO " - have your system administrator run these commands:$admincmds"
|
|
4056 fi
|
|
4057 if test -f /etc/ld.so.conf; then
|
|
4058 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
|
|
4059 fi
|
|
4060 echo
|
|
4061
|
|
4062 echo "See any operating system documentation about shared libraries for"
|
|
4063 case $host in
|
|
4064 solaris2.[6789]|solaris2.1[0-9])
|
|
4065 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
|
|
4066 echo "pages."
|
|
4067 ;;
|
|
4068 *)
|
|
4069 echo "more information, such as the ld(1) and ld.so(8) manual pages."
|
|
4070 ;;
|
|
4071 esac
|
|
4072 echo "----------------------------------------------------------------------"
|
|
4073 fi
|
|
4074 exit $EXIT_SUCCESS
|
|
4075 }
|
|
4076
|
|
4077 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
|
|
4078
|
|
4079
|
|
4080 # func_mode_install arg...
|
|
4081 func_mode_install ()
|
|
4082 {
|
|
4083 $debug_cmd
|
|
4084
|
|
4085 # There may be an optional sh(1) argument at the beginning of
|
|
4086 # install_prog (especially on Windows NT).
|
|
4087 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
|
|
4088 # Allow the use of GNU shtool's install command.
|
|
4089 case $nonopt in *shtool*) :;; *) false;; esac
|
|
4090 then
|
|
4091 # Aesthetically quote it.
|
|
4092 func_quote_for_eval "$nonopt"
|
|
4093 install_prog="$func_quote_for_eval_result "
|
|
4094 arg=$1
|
|
4095 shift
|
|
4096 else
|
|
4097 install_prog=
|
|
4098 arg=$nonopt
|
|
4099 fi
|
|
4100
|
|
4101 # The real first argument should be the name of the installation program.
|
|
4102 # Aesthetically quote it.
|
|
4103 func_quote_for_eval "$arg"
|
|
4104 func_append install_prog "$func_quote_for_eval_result"
|
|
4105 install_shared_prog=$install_prog
|
|
4106 case " $install_prog " in
|
|
4107 *[\\\ /]cp\ *) install_cp=: ;;
|
|
4108 *) install_cp=false ;;
|
|
4109 esac
|
|
4110
|
|
4111 # We need to accept at least all the BSD install flags.
|
|
4112 dest=
|
|
4113 files=
|
|
4114 opts=
|
|
4115 prev=
|
|
4116 install_type=
|
|
4117 isdir=false
|
|
4118 stripme=
|
|
4119 no_mode=:
|
|
4120 for arg
|
|
4121 do
|
|
4122 arg2=
|
|
4123 if test -n "$dest"; then
|
|
4124 func_append files " $dest"
|
|
4125 dest=$arg
|
|
4126 continue
|
|
4127 fi
|
|
4128
|
|
4129 case $arg in
|
|
4130 -d) isdir=: ;;
|
|
4131 -f)
|
|
4132 if $install_cp; then :; else
|
|
4133 prev=$arg
|
|
4134 fi
|
|
4135 ;;
|
|
4136 -g | -m | -o)
|
|
4137 prev=$arg
|
|
4138 ;;
|
|
4139 -s)
|
|
4140 stripme=" -s"
|
|
4141 continue
|
|
4142 ;;
|
|
4143 -*)
|
|
4144 ;;
|
|
4145 *)
|
|
4146 # If the previous option needed an argument, then skip it.
|
|
4147 if test -n "$prev"; then
|
|
4148 if test X-m = "X$prev" && test -n "$install_override_mode"; then
|
|
4149 arg2=$install_override_mode
|
|
4150 no_mode=false
|
|
4151 fi
|
|
4152 prev=
|
|
4153 else
|
|
4154 dest=$arg
|
|
4155 continue
|
|
4156 fi
|
|
4157 ;;
|
|
4158 esac
|
|
4159
|
|
4160 # Aesthetically quote the argument.
|
|
4161 func_quote_for_eval "$arg"
|
|
4162 func_append install_prog " $func_quote_for_eval_result"
|
|
4163 if test -n "$arg2"; then
|
|
4164 func_quote_for_eval "$arg2"
|
|
4165 fi
|
|
4166 func_append install_shared_prog " $func_quote_for_eval_result"
|
|
4167 done
|
|
4168
|
|
4169 test -z "$install_prog" && \
|
|
4170 func_fatal_help "you must specify an install program"
|
|
4171
|
|
4172 test -n "$prev" && \
|
|
4173 func_fatal_help "the '$prev' option requires an argument"
|
|
4174
|
|
4175 if test -n "$install_override_mode" && $no_mode; then
|
|
4176 if $install_cp; then :; else
|
|
4177 func_quote_for_eval "$install_override_mode"
|
|
4178 func_append install_shared_prog " -m $func_quote_for_eval_result"
|
|
4179 fi
|
|
4180 fi
|
|
4181
|
|
4182 if test -z "$files"; then
|
|
4183 if test -z "$dest"; then
|
|
4184 func_fatal_help "no file or destination specified"
|
|
4185 else
|
|
4186 func_fatal_help "you must specify a destination"
|
|
4187 fi
|
|
4188 fi
|
|
4189
|
|
4190 # Strip any trailing slash from the destination.
|
|
4191 func_stripname '' '/' "$dest"
|
|
4192 dest=$func_stripname_result
|
|
4193
|
|
4194 # Check to see that the destination is a directory.
|
|
4195 test -d "$dest" && isdir=:
|
|
4196 if $isdir; then
|
|
4197 destdir=$dest
|
|
4198 destname=
|
|
4199 else
|
|
4200 func_dirname_and_basename "$dest" "" "."
|
|
4201 destdir=$func_dirname_result
|
|
4202 destname=$func_basename_result
|
|
4203
|
|
4204 # Not a directory, so check to see that there is only one file specified.
|
|
4205 set dummy $files; shift
|
|
4206 test "$#" -gt 1 && \
|
|
4207 func_fatal_help "'$dest' is not a directory"
|
|
4208 fi
|
|
4209 case $destdir in
|
|
4210 [\\/]* | [A-Za-z]:[\\/]*) ;;
|
|
4211 *)
|
|
4212 for file in $files; do
|
|
4213 case $file in
|
|
4214 *.lo) ;;
|
|
4215 *)
|
|
4216 func_fatal_help "'$destdir' must be an absolute directory name"
|
|
4217 ;;
|
|
4218 esac
|
|
4219 done
|
|
4220 ;;
|
|
4221 esac
|
|
4222
|
|
4223 # This variable tells wrapper scripts just to set variables rather
|
|
4224 # than running their programs.
|
|
4225 libtool_install_magic=$magic
|
|
4226
|
|
4227 staticlibs=
|
|
4228 future_libdirs=
|
|
4229 current_libdirs=
|
|
4230 for file in $files; do
|
|
4231
|
|
4232 # Do each installation.
|
|
4233 case $file in
|
|
4234 *.$libext)
|
|
4235 # Do the static libraries later.
|
|
4236 func_append staticlibs " $file"
|
|
4237 ;;
|
|
4238
|
|
4239 *.la)
|
|
4240 func_resolve_sysroot "$file"
|
|
4241 file=$func_resolve_sysroot_result
|
|
4242
|
|
4243 # Check to see that this really is a libtool archive.
|
|
4244 func_lalib_unsafe_p "$file" \
|
|
4245 || func_fatal_help "'$file' is not a valid libtool archive"
|
|
4246
|
|
4247 library_names=
|
|
4248 old_library=
|
|
4249 relink_command=
|
|
4250 func_source "$file"
|
|
4251
|
|
4252 # Add the libdir to current_libdirs if it is the destination.
|
|
4253 if test "X$destdir" = "X$libdir"; then
|
|
4254 case "$current_libdirs " in
|
|
4255 *" $libdir "*) ;;
|
|
4256 *) func_append current_libdirs " $libdir" ;;
|
|
4257 esac
|
|
4258 else
|
|
4259 # Note the libdir as a future libdir.
|
|
4260 case "$future_libdirs " in
|
|
4261 *" $libdir "*) ;;
|
|
4262 *) func_append future_libdirs " $libdir" ;;
|
|
4263 esac
|
|
4264 fi
|
|
4265
|
|
4266 func_dirname "$file" "/" ""
|
|
4267 dir=$func_dirname_result
|
|
4268 func_append dir "$objdir"
|
|
4269
|
|
4270 if test -n "$relink_command"; then
|
|
4271 # Determine the prefix the user has applied to our future dir.
|
|
4272 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
|
|
4273
|
|
4274 # Don't allow the user to place us outside of our expected
|
|
4275 # location b/c this prevents finding dependent libraries that
|
|
4276 # are installed to the same prefix.
|
|
4277 # At present, this check doesn't affect windows .dll's that
|
|
4278 # are installed into $libdir/../bin (currently, that works fine)
|
|
4279 # but it's something to keep an eye on.
|
|
4280 test "$inst_prefix_dir" = "$destdir" && \
|
|
4281 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
|
|
4282
|
|
4283 if test -n "$inst_prefix_dir"; then
|
|
4284 # Stick the inst_prefix_dir data into the link command.
|
|
4285 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
|
|
4286 else
|
|
4287 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
|
|
4288 fi
|
|
4289
|
|
4290 func_warning "relinking '$file'"
|
|
4291 func_show_eval "$relink_command" \
|
|
4292 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
|
|
4293 fi
|
|
4294
|
|
4295 # See the names of the shared library.
|
|
4296 set dummy $library_names; shift
|
|
4297 if test -n "$1"; then
|
|
4298 realname=$1
|
|
4299 shift
|
|
4300
|
|
4301 srcname=$realname
|
|
4302 test -n "$relink_command" && srcname=${realname}T
|
|
4303
|
|
4304 # Install the shared library and build the symlinks.
|
|
4305 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
|
|
4306 'exit $?'
|
|
4307 tstripme=$stripme
|
|
4308 case $host_os in
|
|
4309 cygwin* | mingw* | pw32* | cegcc*)
|
|
4310 case $realname in
|
|
4311 *.dll.a)
|
|
4312 tstripme=
|
|
4313 ;;
|
|
4314 esac
|
|
4315 ;;
|
|
4316 os2*)
|
|
4317 case $realname in
|
|
4318 *_dll.a)
|
|
4319 tstripme=
|
|
4320 ;;
|
|
4321 esac
|
|
4322 ;;
|
|
4323 esac
|
|
4324 if test -n "$tstripme" && test -n "$striplib"; then
|
|
4325 func_show_eval "$striplib $destdir/$realname" 'exit $?'
|
|
4326 fi
|
|
4327
|
|
4328 if test "$#" -gt 0; then
|
|
4329 # Delete the old symlinks, and create new ones.
|
|
4330 # Try 'ln -sf' first, because the 'ln' binary might depend on
|
|
4331 # the symlink we replace! Solaris /bin/ln does not understand -f,
|
|
4332 # so we also need to try rm && ln -s.
|
|
4333 for linkname
|
|
4334 do
|
|
4335 test "$linkname" != "$realname" \
|
|
4336 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
|
|
4337 done
|
|
4338 fi
|
|
4339
|
|
4340 # Do each command in the postinstall commands.
|
|
4341 lib=$destdir/$realname
|
|
4342 func_execute_cmds "$postinstall_cmds" 'exit $?'
|
|
4343 fi
|
|
4344
|
|
4345 # Install the pseudo-library for information purposes.
|
|
4346 func_basename "$file"
|
|
4347 name=$func_basename_result
|
|
4348 instname=$dir/${name}i
|
|
4349 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
|
|
4350
|
|
4351 # Maybe install the static library, too.
|
|
4352 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
|
|
4353 ;;
|
|
4354
|
|
4355 *.lo)
|
|
4356 # Install (i.e. copy) a libtool object.
|
|
4357
|
|
4358 # Figure out destination file name, if it wasn't already specified.
|
|
4359 if test -n "$destname"; then
|
|
4360 destfile=$destdir/$destname
|
|
4361 else
|
|
4362 func_basename "$file"
|
|
4363 destfile=$func_basename_result
|
|
4364 destfile=$destdir/$destfile
|
|
4365 fi
|
|
4366
|
|
4367 # Deduce the name of the destination old-style object file.
|
|
4368 case $destfile in
|
|
4369 *.lo)
|
|
4370 func_lo2o "$destfile"
|
|
4371 staticdest=$func_lo2o_result
|
|
4372 ;;
|
|
4373 *.$objext)
|
|
4374 staticdest=$destfile
|
|
4375 destfile=
|
|
4376 ;;
|
|
4377 *)
|
|
4378 func_fatal_help "cannot copy a libtool object to '$destfile'"
|
|
4379 ;;
|
|
4380 esac
|
|
4381
|
|
4382 # Install the libtool object if requested.
|
|
4383 test -n "$destfile" && \
|
|
4384 func_show_eval "$install_prog $file $destfile" 'exit $?'
|
|
4385
|
|
4386 # Install the old object if enabled.
|
|
4387 if test yes = "$build_old_libs"; then
|
|
4388 # Deduce the name of the old-style object file.
|
|
4389 func_lo2o "$file"
|
|
4390 staticobj=$func_lo2o_result
|
|
4391 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
|
|
4392 fi
|
|
4393 exit $EXIT_SUCCESS
|
|
4394 ;;
|
|
4395
|
|
4396 *)
|
|
4397 # Figure out destination file name, if it wasn't already specified.
|
|
4398 if test -n "$destname"; then
|
|
4399 destfile=$destdir/$destname
|
|
4400 else
|
|
4401 func_basename "$file"
|
|
4402 destfile=$func_basename_result
|
|
4403 destfile=$destdir/$destfile
|
|
4404 fi
|
|
4405
|
|
4406 # If the file is missing, and there is a .exe on the end, strip it
|
|
4407 # because it is most likely a libtool script we actually want to
|
|
4408 # install
|
|
4409 stripped_ext=
|
|
4410 case $file in
|
|
4411 *.exe)
|
|
4412 if test ! -f "$file"; then
|
|
4413 func_stripname '' '.exe' "$file"
|
|
4414 file=$func_stripname_result
|
|
4415 stripped_ext=.exe
|
|
4416 fi
|
|
4417 ;;
|
|
4418 esac
|
|
4419
|
|
4420 # Do a test to see if this is really a libtool program.
|
|
4421 case $host in
|
|
4422 *cygwin* | *mingw*)
|
|
4423 if func_ltwrapper_executable_p "$file"; then
|
|
4424 func_ltwrapper_scriptname "$file"
|
|
4425 wrapper=$func_ltwrapper_scriptname_result
|
|
4426 else
|
|
4427 func_stripname '' '.exe' "$file"
|
|
4428 wrapper=$func_stripname_result
|
|
4429 fi
|
|
4430 ;;
|
|
4431 *)
|
|
4432 wrapper=$file
|
|
4433 ;;
|
|
4434 esac
|
|
4435 if func_ltwrapper_script_p "$wrapper"; then
|
|
4436 notinst_deplibs=
|
|
4437 relink_command=
|
|
4438
|
|
4439 func_source "$wrapper"
|
|
4440
|
|
4441 # Check the variables that should have been set.
|
|
4442 test -z "$generated_by_libtool_version" && \
|
|
4443 func_fatal_error "invalid libtool wrapper script '$wrapper'"
|
|
4444
|
|
4445 finalize=:
|
|
4446 for lib in $notinst_deplibs; do
|
|
4447 # Check to see that each library is installed.
|
|
4448 libdir=
|
|
4449 if test -f "$lib"; then
|
|
4450 func_source "$lib"
|
|
4451 fi
|
|
4452 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
|
|
4453 if test -n "$libdir" && test ! -f "$libfile"; then
|
|
4454 func_warning "'$lib' has not been installed in '$libdir'"
|
|
4455 finalize=false
|
|
4456 fi
|
|
4457 done
|
|
4458
|
|
4459 relink_command=
|
|
4460 func_source "$wrapper"
|
|
4461
|
|
4462 outputname=
|
|
4463 if test no = "$fast_install" && test -n "$relink_command"; then
|
|
4464 $opt_dry_run || {
|
|
4465 if $finalize; then
|
|
4466 tmpdir=`func_mktempdir`
|
|
4467 func_basename "$file$stripped_ext"
|
|
4468 file=$func_basename_result
|
|
4469 outputname=$tmpdir/$file
|
|
4470 # Replace the output file specification.
|
|
4471 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
|
|
4472
|
|
4473 $opt_quiet || {
|
|
4474 func_quote_for_expand "$relink_command"
|
|
4475 eval "func_echo $func_quote_for_expand_result"
|
|
4476 }
|
|
4477 if eval "$relink_command"; then :
|
|
4478 else
|
|
4479 func_error "error: relink '$file' with the above command before installing it"
|
|
4480 $opt_dry_run || ${RM}r "$tmpdir"
|
|
4481 continue
|
|
4482 fi
|
|
4483 file=$outputname
|
|
4484 else
|
|
4485 func_warning "cannot relink '$file'"
|
|
4486 fi
|
|
4487 }
|
|
4488 else
|
|
4489 # Install the binary that we compiled earlier.
|
|
4490 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
|
|
4491 fi
|
|
4492 fi
|
|
4493
|
|
4494 # remove .exe since cygwin /usr/bin/install will append another
|
|
4495 # one anyway
|
|
4496 case $install_prog,$host in
|
|
4497 */usr/bin/install*,*cygwin*)
|
|
4498 case $file:$destfile in
|
|
4499 *.exe:*.exe)
|
|
4500 # this is ok
|
|
4501 ;;
|
|
4502 *.exe:*)
|
|
4503 destfile=$destfile.exe
|
|
4504 ;;
|
|
4505 *:*.exe)
|
|
4506 func_stripname '' '.exe' "$destfile"
|
|
4507 destfile=$func_stripname_result
|
|
4508 ;;
|
|
4509 esac
|
|
4510 ;;
|
|
4511 esac
|
|
4512 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
|
|
4513 $opt_dry_run || if test -n "$outputname"; then
|
|
4514 ${RM}r "$tmpdir"
|
|
4515 fi
|
|
4516 ;;
|
|
4517 esac
|
|
4518 done
|
|
4519
|
|
4520 for file in $staticlibs; do
|
|
4521 func_basename "$file"
|
|
4522 name=$func_basename_result
|
|
4523
|
|
4524 # Set up the ranlib parameters.
|
|
4525 oldlib=$destdir/$name
|
|
4526 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
|
|
4527 tool_oldlib=$func_to_tool_file_result
|
|
4528
|
|
4529 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
|
|
4530
|
|
4531 if test -n "$stripme" && test -n "$old_striplib"; then
|
|
4532 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
|
|
4533 fi
|
|
4534
|
|
4535 # Do each command in the postinstall commands.
|
|
4536 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
|
|
4537 done
|
|
4538
|
|
4539 test -n "$future_libdirs" && \
|
|
4540 func_warning "remember to run '$progname --finish$future_libdirs'"
|
|
4541
|
|
4542 if test -n "$current_libdirs"; then
|
|
4543 # Maybe just do a dry run.
|
|
4544 $opt_dry_run && current_libdirs=" -n$current_libdirs"
|
|
4545 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
|
|
4546 else
|
|
4547 exit $EXIT_SUCCESS
|
|
4548 fi
|
|
4549 }
|
|
4550
|
|
4551 test install = "$opt_mode" && func_mode_install ${1+"$@"}
|
|
4552
|
|
4553
|
|
4554 # func_generate_dlsyms outputname originator pic_p
|
|
4555 # Extract symbols from dlprefiles and create ${outputname}S.o with
|
|
4556 # a dlpreopen symbol table.
|
|
4557 func_generate_dlsyms ()
|
|
4558 {
|
|
4559 $debug_cmd
|
|
4560
|
|
4561 my_outputname=$1
|
|
4562 my_originator=$2
|
|
4563 my_pic_p=${3-false}
|
|
4564 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
|
|
4565 my_dlsyms=
|
|
4566
|
|
4567 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
|
|
4568 if test -n "$NM" && test -n "$global_symbol_pipe"; then
|
|
4569 my_dlsyms=${my_outputname}S.c
|
|
4570 else
|
|
4571 func_error "not configured to extract global symbols from dlpreopened files"
|
|
4572 fi
|
|
4573 fi
|
|
4574
|
|
4575 if test -n "$my_dlsyms"; then
|
|
4576 case $my_dlsyms in
|
|
4577 "") ;;
|
|
4578 *.c)
|
|
4579 # Discover the nlist of each of the dlfiles.
|
|
4580 nlist=$output_objdir/$my_outputname.nm
|
|
4581
|
|
4582 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
|
|
4583
|
|
4584 # Parse the name list into a source file.
|
|
4585 func_verbose "creating $output_objdir/$my_dlsyms"
|
|
4586
|
|
4587 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
|
|
4588 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
|
|
4589 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
|
|
4590
|
|
4591 #ifdef __cplusplus
|
|
4592 extern \"C\" {
|
|
4593 #endif
|
|
4594
|
|
4595 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
|
|
4596 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
|
|
4597 #endif
|
|
4598
|
|
4599 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
|
|
4600 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
|
|
4601 /* DATA imports from DLLs on WIN32 can't be const, because runtime
|
|
4602 relocations are performed -- see ld's documentation on pseudo-relocs. */
|
|
4603 # define LT_DLSYM_CONST
|
|
4604 #elif defined __osf__
|
|
4605 /* This system does not cope well with relocations in const data. */
|
|
4606 # define LT_DLSYM_CONST
|
|
4607 #else
|
|
4608 # define LT_DLSYM_CONST const
|
|
4609 #endif
|
|
4610
|
|
4611 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
|
|
4612
|
|
4613 /* External symbol declarations for the compiler. */\
|
|
4614 "
|
|
4615
|
|
4616 if test yes = "$dlself"; then
|
|
4617 func_verbose "generating symbol list for '$output'"
|
|
4618
|
|
4619 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
|
|
4620
|
|
4621 # Add our own program objects to the symbol list.
|
|
4622 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
|
|
4623 for progfile in $progfiles; do
|
|
4624 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
|
|
4625 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
|
|
4626 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
|
|
4627 done
|
|
4628
|
|
4629 if test -n "$exclude_expsyms"; then
|
|
4630 $opt_dry_run || {
|
|
4631 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
|
|
4632 eval '$MV "$nlist"T "$nlist"'
|
|
4633 }
|
|
4634 fi
|
|
4635
|
|
4636 if test -n "$export_symbols_regex"; then
|
|
4637 $opt_dry_run || {
|
|
4638 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
|
|
4639 eval '$MV "$nlist"T "$nlist"'
|
|
4640 }
|
|
4641 fi
|
|
4642
|
|
4643 # Prepare the list of exported symbols
|
|
4644 if test -z "$export_symbols"; then
|
|
4645 export_symbols=$output_objdir/$outputname.exp
|
|
4646 $opt_dry_run || {
|
|
4647 $RM $export_symbols
|
|
4648 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
|
|
4649 case $host in
|
|
4650 *cygwin* | *mingw* | *cegcc* )
|
|
4651 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
|
|
4652 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
|
|
4653 ;;
|
|
4654 esac
|
|
4655 }
|
|
4656 else
|
|
4657 $opt_dry_run || {
|
|
4658 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
|
|
4659 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
|
|
4660 eval '$MV "$nlist"T "$nlist"'
|
|
4661 case $host in
|
|
4662 *cygwin* | *mingw* | *cegcc* )
|
|
4663 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
|
|
4664 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
|
|
4665 ;;
|
|
4666 esac
|
|
4667 }
|
|
4668 fi
|
|
4669 fi
|
|
4670
|
|
4671 for dlprefile in $dlprefiles; do
|
|
4672 func_verbose "extracting global C symbols from '$dlprefile'"
|
|
4673 func_basename "$dlprefile"
|
|
4674 name=$func_basename_result
|
|
4675 case $host in
|
|
4676 *cygwin* | *mingw* | *cegcc* )
|
|
4677 # if an import library, we need to obtain dlname
|
|
4678 if func_win32_import_lib_p "$dlprefile"; then
|
|
4679 func_tr_sh "$dlprefile"
|
|
4680 eval "curr_lafile=\$libfile_$func_tr_sh_result"
|
|
4681 dlprefile_dlbasename=
|
|
4682 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
|
|
4683 # Use subshell, to avoid clobbering current variable values
|
|
4684 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
|
|
4685 if test -n "$dlprefile_dlname"; then
|
|
4686 func_basename "$dlprefile_dlname"
|
|
4687 dlprefile_dlbasename=$func_basename_result
|
|
4688 else
|
|
4689 # no lafile. user explicitly requested -dlpreopen <import library>.
|
|
4690 $sharedlib_from_linklib_cmd "$dlprefile"
|
|
4691 dlprefile_dlbasename=$sharedlib_from_linklib_result
|
|
4692 fi
|
|
4693 fi
|
|
4694 $opt_dry_run || {
|
|
4695 if test -n "$dlprefile_dlbasename"; then
|
|
4696 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
|
|
4697 else
|
|
4698 func_warning "Could not compute DLL name from $name"
|
|
4699 eval '$ECHO ": $name " >> "$nlist"'
|
|
4700 fi
|
|
4701 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
|
|
4702 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
|
|
4703 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
|
|
4704 }
|
|
4705 else # not an import lib
|
|
4706 $opt_dry_run || {
|
|
4707 eval '$ECHO ": $name " >> "$nlist"'
|
|
4708 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
|
|
4709 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
|
|
4710 }
|
|
4711 fi
|
|
4712 ;;
|
|
4713 *)
|
|
4714 $opt_dry_run || {
|
|
4715 eval '$ECHO ": $name " >> "$nlist"'
|
|
4716 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
|
|
4717 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
|
|
4718 }
|
|
4719 ;;
|
|
4720 esac
|
|
4721 done
|
|
4722
|
|
4723 $opt_dry_run || {
|
|
4724 # Make sure we have at least an empty file.
|
|
4725 test -f "$nlist" || : > "$nlist"
|
|
4726
|
|
4727 if test -n "$exclude_expsyms"; then
|
|
4728 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
|
|
4729 $MV "$nlist"T "$nlist"
|
|
4730 fi
|
|
4731
|
|
4732 # Try sorting and uniquifying the output.
|
|
4733 if $GREP -v "^: " < "$nlist" |
|
|
4734 if sort -k 3 </dev/null >/dev/null 2>&1; then
|
|
4735 sort -k 3
|
|
4736 else
|
|
4737 sort +2
|
|
4738 fi |
|
|
4739 uniq > "$nlist"S; then
|
|
4740 :
|
|
4741 else
|
|
4742 $GREP -v "^: " < "$nlist" > "$nlist"S
|
|
4743 fi
|
|
4744
|
|
4745 if test -f "$nlist"S; then
|
|
4746 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
|
|
4747 else
|
|
4748 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
|
|
4749 fi
|
|
4750
|
|
4751 func_show_eval '$RM "${nlist}I"'
|
|
4752 if test -n "$global_symbol_to_import"; then
|
|
4753 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
|
|
4754 fi
|
|
4755
|
|
4756 echo >> "$output_objdir/$my_dlsyms" "\
|
|
4757
|
|
4758 /* The mapping between symbol names and symbols. */
|
|
4759 typedef struct {
|
|
4760 const char *name;
|
|
4761 void *address;
|
|
4762 } lt_dlsymlist;
|
|
4763 extern LT_DLSYM_CONST lt_dlsymlist
|
|
4764 lt_${my_prefix}_LTX_preloaded_symbols[];\
|
|
4765 "
|
|
4766
|
|
4767 if test -s "$nlist"I; then
|
|
4768 echo >> "$output_objdir/$my_dlsyms" "\
|
|
4769 static void lt_syminit(void)
|
|
4770 {
|
|
4771 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
|
|
4772 for (; symbol->name; ++symbol)
|
|
4773 {"
|
|
4774 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
|
|
4775 echo >> "$output_objdir/$my_dlsyms" "\
|
|
4776 }
|
|
4777 }"
|
|
4778 fi
|
|
4779 echo >> "$output_objdir/$my_dlsyms" "\
|
|
4780 LT_DLSYM_CONST lt_dlsymlist
|
|
4781 lt_${my_prefix}_LTX_preloaded_symbols[] =
|
|
4782 { {\"$my_originator\", (void *) 0},"
|
|
4783
|
|
4784 if test -s "$nlist"I; then
|
|
4785 echo >> "$output_objdir/$my_dlsyms" "\
|
|
4786 {\"@INIT@\", (void *) <_syminit},"
|
|
4787 fi
|
|
4788
|
|
4789 case $need_lib_prefix in
|
|
4790 no)
|
|
4791 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
|
|
4792 ;;
|
|
4793 *)
|
|
4794 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
|
|
4795 ;;
|
|
4796 esac
|
|
4797 echo >> "$output_objdir/$my_dlsyms" "\
|
|
4798 {0, (void *) 0}
|
|
4799 };
|
|
4800
|
|
4801 /* This works around a problem in FreeBSD linker */
|
|
4802 #ifdef FREEBSD_WORKAROUND
|
|
4803 static const void *lt_preloaded_setup() {
|
|
4804 return lt_${my_prefix}_LTX_preloaded_symbols;
|
|
4805 }
|
|
4806 #endif
|
|
4807
|
|
4808 #ifdef __cplusplus
|
|
4809 }
|
|
4810 #endif\
|
|
4811 "
|
|
4812 } # !$opt_dry_run
|
|
4813
|
|
4814 pic_flag_for_symtable=
|
|
4815 case "$compile_command " in
|
|
4816 *" -static "*) ;;
|
|
4817 *)
|
|
4818 case $host in
|
|
4819 # compiling the symbol table file with pic_flag works around
|
|
4820 # a FreeBSD bug that causes programs to crash when -lm is
|
|
4821 # linked before any other PIC object. But we must not use
|
|
4822 # pic_flag when linking with -static. The problem exists in
|
|
4823 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
|
|
4824 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
|
|
4825 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
|
|
4826 *-*-hpux*)
|
|
4827 pic_flag_for_symtable=" $pic_flag" ;;
|
|
4828 *)
|
|
4829 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
|
|
4830 ;;
|
|
4831 esac
|
|
4832 ;;
|
|
4833 esac
|
|
4834 symtab_cflags=
|
|
4835 for arg in $LTCFLAGS; do
|
|
4836 case $arg in
|
|
4837 -pie | -fpie | -fPIE) ;;
|
|
4838 *) func_append symtab_cflags " $arg" ;;
|
|
4839 esac
|
|
4840 done
|
|
4841
|
|
4842 # Now compile the dynamic symbol file.
|
|
4843 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
|
|
4844
|
|
4845 # Clean up the generated files.
|
|
4846 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
|
|
4847
|
|
4848 # Transform the symbol file into the correct name.
|
|
4849 symfileobj=$output_objdir/${my_outputname}S.$objext
|
|
4850 case $host in
|
|
4851 *cygwin* | *mingw* | *cegcc* )
|
|
4852 if test -f "$output_objdir/$my_outputname.def"; then
|
|
4853 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
|
|
4854 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
|
|
4855 else
|
|
4856 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
|
|
4857 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
|
|
4858 fi
|
|
4859 ;;
|
|
4860 *)
|
|
4861 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
|
|
4862 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
|
|
4863 ;;
|
|
4864 esac
|
|
4865 ;;
|
|
4866 *)
|
|
4867 func_fatal_error "unknown suffix for '$my_dlsyms'"
|
|
4868 ;;
|
|
4869 esac
|
|
4870 else
|
|
4871 # We keep going just in case the user didn't refer to
|
|
4872 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
|
|
4873 # really was required.
|
|
4874
|
|
4875 # Nullify the symbol file.
|
|
4876 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
|
|
4877 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
|
|
4878 fi
|
|
4879 }
|
|
4880
|
|
4881 # func_cygming_gnu_implib_p ARG
|
|
4882 # This predicate returns with zero status (TRUE) if
|
|
4883 # ARG is a GNU/binutils-style import library. Returns
|
|
4884 # with nonzero status (FALSE) otherwise.
|
|
4885 func_cygming_gnu_implib_p ()
|
|
4886 {
|
|
4887 $debug_cmd
|
|
4888
|
|
4889 func_to_tool_file "$1" func_convert_file_msys_to_w32
|
|
4890 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
|
|
4891 test -n "$func_cygming_gnu_implib_tmp"
|
|
4892 }
|
|
4893
|
|
4894 # func_cygming_ms_implib_p ARG
|
|
4895 # This predicate returns with zero status (TRUE) if
|
|
4896 # ARG is an MS-style import library. Returns
|
|
4897 # with nonzero status (FALSE) otherwise.
|
|
4898 func_cygming_ms_implib_p ()
|
|
4899 {
|
|
4900 $debug_cmd
|
|
4901
|
|
4902 func_to_tool_file "$1" func_convert_file_msys_to_w32
|
|
4903 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
|
|
4904 test -n "$func_cygming_ms_implib_tmp"
|
|
4905 }
|
|
4906
|
|
4907 # func_win32_libid arg
|
|
4908 # return the library type of file 'arg'
|
|
4909 #
|
|
4910 # Need a lot of goo to handle *both* DLLs and import libs
|
|
4911 # Has to be a shell function in order to 'eat' the argument
|
|
4912 # that is supplied when $file_magic_command is called.
|
|
4913 # Despite the name, also deal with 64 bit binaries.
|
|
4914 func_win32_libid ()
|
|
4915 {
|
|
4916 $debug_cmd
|
|
4917
|
|
4918 win32_libid_type=unknown
|
|
4919 win32_fileres=`file -L $1 2>/dev/null`
|
|
4920 case $win32_fileres in
|
|
4921 *ar\ archive\ import\ library*) # definitely import
|
|
4922 win32_libid_type="x86 archive import"
|
|
4923 ;;
|
|
4924 *ar\ archive*) # could be an import, or static
|
|
4925 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
|
|
4926 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
|
|
4927 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
|
|
4928 case $nm_interface in
|
|
4929 "MS dumpbin")
|
|
4930 if func_cygming_ms_implib_p "$1" ||
|
|
4931 func_cygming_gnu_implib_p "$1"
|
|
4932 then
|
|
4933 win32_nmres=import
|
|
4934 else
|
|
4935 win32_nmres=
|
|
4936 fi
|
|
4937 ;;
|
|
4938 *)
|
|
4939 func_to_tool_file "$1" func_convert_file_msys_to_w32
|
|
4940 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
|
|
4941 $SED -n -e '
|
|
4942 1,100{
|
|
4943 / I /{
|
|
4944 s|.*|import|
|
|
4945 p
|
|
4946 q
|
|
4947 }
|
|
4948 }'`
|
|
4949 ;;
|
|
4950 esac
|
|
4951 case $win32_nmres in
|
|
4952 import*) win32_libid_type="x86 archive import";;
|
|
4953 *) win32_libid_type="x86 archive static";;
|
|
4954 esac
|
|
4955 fi
|
|
4956 ;;
|
|
4957 *DLL*)
|
|
4958 win32_libid_type="x86 DLL"
|
|
4959 ;;
|
|
4960 *executable*) # but shell scripts are "executable" too...
|
|
4961 case $win32_fileres in
|
|
4962 *MS\ Windows\ PE\ Intel*)
|
|
4963 win32_libid_type="x86 DLL"
|
|
4964 ;;
|
|
4965 esac
|
|
4966 ;;
|
|
4967 esac
|
|
4968 $ECHO "$win32_libid_type"
|
|
4969 }
|
|
4970
|
|
4971 # func_cygming_dll_for_implib ARG
|
|
4972 #
|
|
4973 # Platform-specific function to extract the
|
|
4974 # name of the DLL associated with the specified
|
|
4975 # import library ARG.
|
|
4976 # Invoked by eval'ing the libtool variable
|
|
4977 # $sharedlib_from_linklib_cmd
|
|
4978 # Result is available in the variable
|
|
4979 # $sharedlib_from_linklib_result
|
|
4980 func_cygming_dll_for_implib ()
|
|
4981 {
|
|
4982 $debug_cmd
|
|
4983
|
|
4984 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
|
|
4985 }
|
|
4986
|
|
4987 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
|
|
4988 #
|
|
4989 # The is the core of a fallback implementation of a
|
|
4990 # platform-specific function to extract the name of the
|
|
4991 # DLL associated with the specified import library LIBNAME.
|
|
4992 #
|
|
4993 # SECTION_NAME is either .idata$6 or .idata$7, depending
|
|
4994 # on the platform and compiler that created the implib.
|
|
4995 #
|
|
4996 # Echos the name of the DLL associated with the
|
|
4997 # specified import library.
|
|
4998 func_cygming_dll_for_implib_fallback_core ()
|
|
4999 {
|
|
5000 $debug_cmd
|
|
5001
|
|
5002 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
|
|
5003 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
|
|
5004 $SED '/^Contents of section '"$match_literal"':/{
|
|
5005 # Place marker at beginning of archive member dllname section
|
|
5006 s/.*/====MARK====/
|
|
5007 p
|
|
5008 d
|
|
5009 }
|
|
5010 # These lines can sometimes be longer than 43 characters, but
|
|
5011 # are always uninteresting
|
|
5012 /:[ ]*file format pe[i]\{,1\}-/d
|
|
5013 /^In archive [^:]*:/d
|
|
5014 # Ensure marker is printed
|
|
5015 /^====MARK====/p
|
|
5016 # Remove all lines with less than 43 characters
|
|
5017 /^.\{43\}/!d
|
|
5018 # From remaining lines, remove first 43 characters
|
|
5019 s/^.\{43\}//' |
|
|
5020 $SED -n '
|
|
5021 # Join marker and all lines until next marker into a single line
|
|
5022 /^====MARK====/ b para
|
|
5023 H
|
|
5024 $ b para
|
|
5025 b
|
|
5026 :para
|
|
5027 x
|
|
5028 s/\n//g
|
|
5029 # Remove the marker
|
|
5030 s/^====MARK====//
|
|
5031 # Remove trailing dots and whitespace
|
|
5032 s/[\. \t]*$//
|
|
5033 # Print
|
|
5034 /./p' |
|
|
5035 # we now have a list, one entry per line, of the stringified
|
|
5036 # contents of the appropriate section of all members of the
|
|
5037 # archive that possess that section. Heuristic: eliminate
|
|
5038 # all those that have a first or second character that is
|
|
5039 # a '.' (that is, objdump's representation of an unprintable
|
|
5040 # character.) This should work for all archives with less than
|
|
5041 # 0x302f exports -- but will fail for DLLs whose name actually
|
|
5042 # begins with a literal '.' or a single character followed by
|
|
5043 # a '.'.
|
|
5044 #
|
|
5045 # Of those that remain, print the first one.
|
|
5046 $SED -e '/^\./d;/^.\./d;q'
|
|
5047 }
|
|
5048
|
|
5049 # func_cygming_dll_for_implib_fallback ARG
|
|
5050 # Platform-specific function to extract the
|
|
5051 # name of the DLL associated with the specified
|
|
5052 # import library ARG.
|
|
5053 #
|
|
5054 # This fallback implementation is for use when $DLLTOOL
|
|
5055 # does not support the --identify-strict option.
|
|
5056 # Invoked by eval'ing the libtool variable
|
|
5057 # $sharedlib_from_linklib_cmd
|
|
5058 # Result is available in the variable
|
|
5059 # $sharedlib_from_linklib_result
|
|
5060 func_cygming_dll_for_implib_fallback ()
|
|
5061 {
|
|
5062 $debug_cmd
|
|
5063
|
|
5064 if func_cygming_gnu_implib_p "$1"; then
|
|
5065 # binutils import library
|
|
5066 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
|
|
5067 elif func_cygming_ms_implib_p "$1"; then
|
|
5068 # ms-generated import library
|
|
5069 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
|
|
5070 else
|
|
5071 # unknown
|
|
5072 sharedlib_from_linklib_result=
|
|
5073 fi
|
|
5074 }
|
|
5075
|
|
5076
|
|
5077 # func_extract_an_archive dir oldlib
|
|
5078 func_extract_an_archive ()
|
|
5079 {
|
|
5080 $debug_cmd
|
|
5081
|
|
5082 f_ex_an_ar_dir=$1; shift
|
|
5083 f_ex_an_ar_oldlib=$1
|
|
5084 if test yes = "$lock_old_archive_extraction"; then
|
|
5085 lockfile=$f_ex_an_ar_oldlib.lock
|
|
5086 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
|
|
5087 func_echo "Waiting for $lockfile to be removed"
|
|
5088 sleep 2
|
|
5089 done
|
|
5090 fi
|
|
5091 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
|
|
5092 'stat=$?; rm -f "$lockfile"; exit $stat'
|
|
5093 if test yes = "$lock_old_archive_extraction"; then
|
|
5094 $opt_dry_run || rm -f "$lockfile"
|
|
5095 fi
|
|
5096 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
|
|
5097 :
|
|
5098 else
|
|
5099 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
|
|
5100 fi
|
|
5101 }
|
|
5102
|
|
5103
|
|
5104 # func_extract_archives gentop oldlib ...
|
|
5105 func_extract_archives ()
|
|
5106 {
|
|
5107 $debug_cmd
|
|
5108
|
|
5109 my_gentop=$1; shift
|
|
5110 my_oldlibs=${1+"$@"}
|
|
5111 my_oldobjs=
|
|
5112 my_xlib=
|
|
5113 my_xabs=
|
|
5114 my_xdir=
|
|
5115
|
|
5116 for my_xlib in $my_oldlibs; do
|
|
5117 # Extract the objects.
|
|
5118 case $my_xlib in
|
|
5119 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
|
|
5120 *) my_xabs=`pwd`"/$my_xlib" ;;
|
|
5121 esac
|
|
5122 func_basename "$my_xlib"
|
|
5123 my_xlib=$func_basename_result
|
|
5124 my_xlib_u=$my_xlib
|
|
5125 while :; do
|
|
5126 case " $extracted_archives " in
|
|
5127 *" $my_xlib_u "*)
|
|
5128 func_arith $extracted_serial + 1
|
|
5129 extracted_serial=$func_arith_result
|
|
5130 my_xlib_u=lt$extracted_serial-$my_xlib ;;
|
|
5131 *) break ;;
|
|
5132 esac
|
|
5133 done
|
|
5134 extracted_archives="$extracted_archives $my_xlib_u"
|
|
5135 my_xdir=$my_gentop/$my_xlib_u
|
|
5136
|
|
5137 func_mkdir_p "$my_xdir"
|
|
5138
|
|
5139 case $host in
|
|
5140 *-darwin*)
|
|
5141 func_verbose "Extracting $my_xabs"
|
|
5142 # Do not bother doing anything if just a dry run
|
|
5143 $opt_dry_run || {
|
|
5144 darwin_orig_dir=`pwd`
|
|
5145 cd $my_xdir || exit $?
|
|
5146 darwin_archive=$my_xabs
|
|
5147 darwin_curdir=`pwd`
|
|
5148 func_basename "$darwin_archive"
|
|
5149 darwin_base_archive=$func_basename_result
|
|
5150 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
|
|
5151 if test -n "$darwin_arches"; then
|
|
5152 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
|
|
5153 darwin_arch=
|
|
5154 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
|
|
5155 for darwin_arch in $darwin_arches; do
|
|
5156 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
|
|
5157 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
|
|
5158 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
|
|
5159 func_extract_an_archive "`pwd`" "$darwin_base_archive"
|
|
5160 cd "$darwin_curdir"
|
|
5161 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
|
|
5162 done # $darwin_arches
|
|
5163 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
|
|
5164 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
|
|
5165 darwin_file=
|
|
5166 darwin_files=
|
|
5167 for darwin_file in $darwin_filelist; do
|
|
5168 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
|
|
5169 $LIPO -create -output "$darwin_file" $darwin_files
|
|
5170 done # $darwin_filelist
|
|
5171 $RM -rf unfat-$$
|
|
5172 cd "$darwin_orig_dir"
|
|
5173 else
|
|
5174 cd $darwin_orig_dir
|
|
5175 func_extract_an_archive "$my_xdir" "$my_xabs"
|
|
5176 fi # $darwin_arches
|
|
5177 } # !$opt_dry_run
|
|
5178 ;;
|
|
5179 *)
|
|
5180 func_extract_an_archive "$my_xdir" "$my_xabs"
|
|
5181 ;;
|
|
5182 esac
|
|
5183 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
|
|
5184 done
|
|
5185
|
|
5186 func_extract_archives_result=$my_oldobjs
|
|
5187 }
|
|
5188
|
|
5189
|
|
5190 # func_emit_wrapper [arg=no]
|
|
5191 #
|
|
5192 # Emit a libtool wrapper script on stdout.
|
|
5193 # Don't directly open a file because we may want to
|
|
5194 # incorporate the script contents within a cygwin/mingw
|
|
5195 # wrapper executable. Must ONLY be called from within
|
|
5196 # func_mode_link because it depends on a number of variables
|
|
5197 # set therein.
|
|
5198 #
|
|
5199 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
|
|
5200 # variable will take. If 'yes', then the emitted script
|
|
5201 # will assume that the directory where it is stored is
|
|
5202 # the $objdir directory. This is a cygwin/mingw-specific
|
|
5203 # behavior.
|
|
5204 func_emit_wrapper ()
|
|
5205 {
|
|
5206 func_emit_wrapper_arg1=${1-no}
|
|
5207
|
|
5208 $ECHO "\
|
|
5209 #! $SHELL
|
|
5210
|
|
5211 # $output - temporary wrapper script for $objdir/$outputname
|
|
5212 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
|
|
5213 #
|
|
5214 # The $output program cannot be directly executed until all the libtool
|
|
5215 # libraries that it depends on are installed.
|
|
5216 #
|
|
5217 # This wrapper script should never be moved out of the build directory.
|
|
5218 # If it is, it will not operate correctly.
|
|
5219
|
|
5220 # Sed substitution that helps us do robust quoting. It backslashifies
|
|
5221 # metacharacters that are still active within double-quoted strings.
|
|
5222 sed_quote_subst='$sed_quote_subst'
|
|
5223
|
|
5224 # Be Bourne compatible
|
|
5225 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
|
|
5226 emulate sh
|
|
5227 NULLCMD=:
|
|
5228 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
|
|
5229 # is contrary to our usage. Disable this feature.
|
|
5230 alias -g '\${1+\"\$@\"}'='\"\$@\"'
|
|
5231 setopt NO_GLOB_SUBST
|
|
5232 else
|
|
5233 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
|
|
5234 fi
|
|
5235 BIN_SH=xpg4; export BIN_SH # for Tru64
|
|
5236 DUALCASE=1; export DUALCASE # for MKS sh
|
|
5237
|
|
5238 # The HP-UX ksh and POSIX shell print the target directory to stdout
|
|
5239 # if CDPATH is set.
|
|
5240 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
|
5241
|
|
5242 relink_command=\"$relink_command\"
|
|
5243
|
|
5244 # This environment variable determines our operation mode.
|
|
5245 if test \"\$libtool_install_magic\" = \"$magic\"; then
|
|
5246 # install mode needs the following variables:
|
|
5247 generated_by_libtool_version='$macro_version'
|
|
5248 notinst_deplibs='$notinst_deplibs'
|
|
5249 else
|
|
5250 # When we are sourced in execute mode, \$file and \$ECHO are already set.
|
|
5251 if test \"\$libtool_execute_magic\" != \"$magic\"; then
|
|
5252 file=\"\$0\""
|
|
5253
|
|
5254 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
|
|
5255 $ECHO "\
|
|
5256
|
|
5257 # A function that is used when there is no print builtin or printf.
|
|
5258 func_fallback_echo ()
|
|
5259 {
|
|
5260 eval 'cat <<_LTECHO_EOF
|
|
5261 \$1
|
|
5262 _LTECHO_EOF'
|
|
5263 }
|
|
5264 ECHO=\"$qECHO\"
|
|
5265 fi
|
|
5266
|
|
5267 # Very basic option parsing. These options are (a) specific to
|
|
5268 # the libtool wrapper, (b) are identical between the wrapper
|
|
5269 # /script/ and the wrapper /executable/ that is used only on
|
|
5270 # windows platforms, and (c) all begin with the string "--lt-"
|
|
5271 # (application programs are unlikely to have options that match
|
|
5272 # this pattern).
|
|
5273 #
|
|
5274 # There are only two supported options: --lt-debug and
|
|
5275 # --lt-dump-script. There is, deliberately, no --lt-help.
|
|
5276 #
|
|
5277 # The first argument to this parsing function should be the
|
|
5278 # script's $0 value, followed by "$@".
|
|
5279 lt_option_debug=
|
|
5280 func_parse_lt_options ()
|
|
5281 {
|
|
5282 lt_script_arg0=\$0
|
|
5283 shift
|
|
5284 for lt_opt
|
|
5285 do
|
|
5286 case \"\$lt_opt\" in
|
|
5287 --lt-debug) lt_option_debug=1 ;;
|
|
5288 --lt-dump-script)
|
|
5289 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
|
|
5290 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
|
|
5291 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
|
|
5292 cat \"\$lt_dump_D/\$lt_dump_F\"
|
|
5293 exit 0
|
|
5294 ;;
|
|
5295 --lt-*)
|
|
5296 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
|
|
5297 exit 1
|
|
5298 ;;
|
|
5299 esac
|
|
5300 done
|
|
5301
|
|
5302 # Print the debug banner immediately:
|
|
5303 if test -n \"\$lt_option_debug\"; then
|
|
5304 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
|
|
5305 fi
|
|
5306 }
|
|
5307
|
|
5308 # Used when --lt-debug. Prints its arguments to stdout
|
|
5309 # (redirection is the responsibility of the caller)
|
|
5310 func_lt_dump_args ()
|
|
5311 {
|
|
5312 lt_dump_args_N=1;
|
|
5313 for lt_arg
|
|
5314 do
|
|
5315 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
|
|
5316 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
|
|
5317 done
|
|
5318 }
|
|
5319
|
|
5320 # Core function for launching the target application
|
|
5321 func_exec_program_core ()
|
|
5322 {
|
|
5323 "
|
|
5324 case $host in
|
|
5325 # Backslashes separate directories on plain windows
|
|
5326 *-*-mingw | *-*-os2* | *-cegcc*)
|
|
5327 $ECHO "\
|
|
5328 if test -n \"\$lt_option_debug\"; then
|
|
5329 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
|
|
5330 func_lt_dump_args \${1+\"\$@\"} 1>&2
|
|
5331 fi
|
|
5332 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
|
|
5333 "
|
|
5334 ;;
|
|
5335
|
|
5336 *)
|
|
5337 $ECHO "\
|
|
5338 if test -n \"\$lt_option_debug\"; then
|
|
5339 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
|
|
5340 func_lt_dump_args \${1+\"\$@\"} 1>&2
|
|
5341 fi
|
|
5342 exec \"\$progdir/\$program\" \${1+\"\$@\"}
|
|
5343 "
|
|
5344 ;;
|
|
5345 esac
|
|
5346 $ECHO "\
|
|
5347 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
|
|
5348 exit 1
|
|
5349 }
|
|
5350
|
|
5351 # A function to encapsulate launching the target application
|
|
5352 # Strips options in the --lt-* namespace from \$@ and
|
|
5353 # launches target application with the remaining arguments.
|
|
5354 func_exec_program ()
|
|
5355 {
|
|
5356 case \" \$* \" in
|
|
5357 *\\ --lt-*)
|
|
5358 for lt_wr_arg
|
|
5359 do
|
|
5360 case \$lt_wr_arg in
|
|
5361 --lt-*) ;;
|
|
5362 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
|
|
5363 esac
|
|
5364 shift
|
|
5365 done ;;
|
|
5366 esac
|
|
5367 func_exec_program_core \${1+\"\$@\"}
|
|
5368 }
|
|
5369
|
|
5370 # Parse options
|
|
5371 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
|
|
5372
|
|
5373 # Find the directory that this script lives in.
|
|
5374 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
|
|
5375 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
|
|
5376
|
|
5377 # Follow symbolic links until we get to the real thisdir.
|
|
5378 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
|
|
5379 while test -n \"\$file\"; do
|
|
5380 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
|
|
5381
|
|
5382 # If there was a directory component, then change thisdir.
|
|
5383 if test \"x\$destdir\" != \"x\$file\"; then
|
|
5384 case \"\$destdir\" in
|
|
5385 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
|
|
5386 *) thisdir=\"\$thisdir/\$destdir\" ;;
|
|
5387 esac
|
|
5388 fi
|
|
5389
|
|
5390 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
|
|
5391 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
|
|
5392 done
|
|
5393
|
|
5394 # Usually 'no', except on cygwin/mingw when embedded into
|
|
5395 # the cwrapper.
|
|
5396 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
|
|
5397 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
|
|
5398 # special case for '.'
|
|
5399 if test \"\$thisdir\" = \".\"; then
|
|
5400 thisdir=\`pwd\`
|
|
5401 fi
|
|
5402 # remove .libs from thisdir
|
|
5403 case \"\$thisdir\" in
|
|
5404 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
|
|
5405 $objdir ) thisdir=. ;;
|
|
5406 esac
|
|
5407 fi
|
|
5408
|
|
5409 # Try to get the absolute directory name.
|
|
5410 absdir=\`cd \"\$thisdir\" && pwd\`
|
|
5411 test -n \"\$absdir\" && thisdir=\"\$absdir\"
|
|
5412 "
|
|
5413
|
|
5414 if test yes = "$fast_install"; then
|
|
5415 $ECHO "\
|
|
5416 program=lt-'$outputname'$exeext
|
|
5417 progdir=\"\$thisdir/$objdir\"
|
|
5418
|
|
5419 if test ! -f \"\$progdir/\$program\" ||
|
|
5420 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
|
|
5421 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
|
|
5422
|
|
5423 file=\"\$\$-\$program\"
|
|
5424
|
|
5425 if test ! -d \"\$progdir\"; then
|
|
5426 $MKDIR \"\$progdir\"
|
|
5427 else
|
|
5428 $RM \"\$progdir/\$file\"
|
|
5429 fi"
|
|
5430
|
|
5431 $ECHO "\
|
|
5432
|
|
5433 # relink executable if necessary
|
|
5434 if test -n \"\$relink_command\"; then
|
|
5435 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
|
|
5436 else
|
|
5437 \$ECHO \"\$relink_command_output\" >&2
|
|
5438 $RM \"\$progdir/\$file\"
|
|
5439 exit 1
|
|
5440 fi
|
|
5441 fi
|
|
5442
|
|
5443 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
|
|
5444 { $RM \"\$progdir/\$program\";
|
|
5445 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
|
|
5446 $RM \"\$progdir/\$file\"
|
|
5447 fi"
|
|
5448 else
|
|
5449 $ECHO "\
|
|
5450 program='$outputname'
|
|
5451 progdir=\"\$thisdir/$objdir\"
|
|
5452 "
|
|
5453 fi
|
|
5454
|
|
5455 $ECHO "\
|
|
5456
|
|
5457 if test -f \"\$progdir/\$program\"; then"
|
|
5458
|
|
5459 # fixup the dll searchpath if we need to.
|
|
5460 #
|
|
5461 # Fix the DLL searchpath if we need to. Do this before prepending
|
|
5462 # to shlibpath, because on Windows, both are PATH and uninstalled
|
|
5463 # libraries must come first.
|
|
5464 if test -n "$dllsearchpath"; then
|
|
5465 $ECHO "\
|
|
5466 # Add the dll search path components to the executable PATH
|
|
5467 PATH=$dllsearchpath:\$PATH
|
|
5468 "
|
|
5469 fi
|
|
5470
|
|
5471 # Export our shlibpath_var if we have one.
|
|
5472 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
|
|
5473 $ECHO "\
|
|
5474 # Add our own library path to $shlibpath_var
|
|
5475 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
|
|
5476
|
|
5477 # Some systems cannot cope with colon-terminated $shlibpath_var
|
|
5478 # The second colon is a workaround for a bug in BeOS R4 sed
|
|
5479 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
|
|
5480
|
|
5481 export $shlibpath_var
|
|
5482 "
|
|
5483 fi
|
|
5484
|
|
5485 $ECHO "\
|
|
5486 if test \"\$libtool_execute_magic\" != \"$magic\"; then
|
|
5487 # Run the actual program with our arguments.
|
|
5488 func_exec_program \${1+\"\$@\"}
|
|
5489 fi
|
|
5490 else
|
|
5491 # The program doesn't exist.
|
|
5492 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
|
|
5493 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
|
|
5494 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
|
|
5495 exit 1
|
|
5496 fi
|
|
5497 fi\
|
|
5498 "
|
|
5499 }
|
|
5500
|
|
5501
|
|
5502 # func_emit_cwrapperexe_src
|
|
5503 # emit the source code for a wrapper executable on stdout
|
|
5504 # Must ONLY be called from within func_mode_link because
|
|
5505 # it depends on a number of variable set therein.
|
|
5506 func_emit_cwrapperexe_src ()
|
|
5507 {
|
|
5508 cat <<EOF
|
|
5509
|
|
5510 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
|
|
5511 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
|
|
5512
|
|
5513 The $output program cannot be directly executed until all the libtool
|
|
5514 libraries that it depends on are installed.
|
|
5515
|
|
5516 This wrapper executable should never be moved out of the build directory.
|
|
5517 If it is, it will not operate correctly.
|
|
5518 */
|
|
5519 EOF
|
|
5520 cat <<"EOF"
|
|
5521 #ifdef _MSC_VER
|
|
5522 # define _CRT_SECURE_NO_DEPRECATE 1
|
|
5523 #endif
|
|
5524 #include <stdio.h>
|
|
5525 #include <stdlib.h>
|
|
5526 #ifdef _MSC_VER
|
|
5527 # include <direct.h>
|
|
5528 # include <process.h>
|
|
5529 # include <io.h>
|
|
5530 #else
|
|
5531 # include <unistd.h>
|
|
5532 # include <stdint.h>
|
|
5533 # ifdef __CYGWIN__
|
|
5534 # include <io.h>
|
|
5535 # endif
|
|
5536 #endif
|
|
5537 #include <malloc.h>
|
|
5538 #include <stdarg.h>
|
|
5539 #include <assert.h>
|
|
5540 #include <string.h>
|
|
5541 #include <ctype.h>
|
|
5542 #include <errno.h>
|
|
5543 #include <fcntl.h>
|
|
5544 #include <sys/stat.h>
|
|
5545
|
|
5546 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
|
|
5547
|
|
5548 /* declarations of non-ANSI functions */
|
|
5549 #if defined __MINGW32__
|
|
5550 # ifdef __STRICT_ANSI__
|
|
5551 int _putenv (const char *);
|
|
5552 # endif
|
|
5553 #elif defined __CYGWIN__
|
|
5554 # ifdef __STRICT_ANSI__
|
|
5555 char *realpath (const char *, char *);
|
|
5556 int putenv (char *);
|
|
5557 int setenv (const char *, const char *, int);
|
|
5558 # endif
|
|
5559 /* #elif defined other_platform || defined ... */
|
|
5560 #endif
|
|
5561
|
|
5562 /* portability defines, excluding path handling macros */
|
|
5563 #if defined _MSC_VER
|
|
5564 # define setmode _setmode
|
|
5565 # define stat _stat
|
|
5566 # define chmod _chmod
|
|
5567 # define getcwd _getcwd
|
|
5568 # define putenv _putenv
|
|
5569 # define S_IXUSR _S_IEXEC
|
|
5570 #elif defined __MINGW32__
|
|
5571 # define setmode _setmode
|
|
5572 # define stat _stat
|
|
5573 # define chmod _chmod
|
|
5574 # define getcwd _getcwd
|
|
5575 # define putenv _putenv
|
|
5576 #elif defined __CYGWIN__
|
|
5577 # define HAVE_SETENV
|
|
5578 # define FOPEN_WB "wb"
|
|
5579 /* #elif defined other platforms ... */
|
|
5580 #endif
|
|
5581
|
|
5582 #if defined PATH_MAX
|
|
5583 # define LT_PATHMAX PATH_MAX
|
|
5584 #elif defined MAXPATHLEN
|
|
5585 # define LT_PATHMAX MAXPATHLEN
|
|
5586 #else
|
|
5587 # define LT_PATHMAX 1024
|
|
5588 #endif
|
|
5589
|
|
5590 #ifndef S_IXOTH
|
|
5591 # define S_IXOTH 0
|
|
5592 #endif
|
|
5593 #ifndef S_IXGRP
|
|
5594 # define S_IXGRP 0
|
|
5595 #endif
|
|
5596
|
|
5597 /* path handling portability macros */
|
|
5598 #ifndef DIR_SEPARATOR
|
|
5599 # define DIR_SEPARATOR '/'
|
|
5600 # define PATH_SEPARATOR ':'
|
|
5601 #endif
|
|
5602
|
|
5603 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
|
|
5604 defined __OS2__
|
|
5605 # define HAVE_DOS_BASED_FILE_SYSTEM
|
|
5606 # define FOPEN_WB "wb"
|
|
5607 # ifndef DIR_SEPARATOR_2
|
|
5608 # define DIR_SEPARATOR_2 '\\'
|
|
5609 # endif
|
|
5610 # ifndef PATH_SEPARATOR_2
|
|
5611 # define PATH_SEPARATOR_2 ';'
|
|
5612 # endif
|
|
5613 #endif
|
|
5614
|
|
5615 #ifndef DIR_SEPARATOR_2
|
|
5616 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
|
|
5617 #else /* DIR_SEPARATOR_2 */
|
|
5618 # define IS_DIR_SEPARATOR(ch) \
|
|
5619 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
|
|
5620 #endif /* DIR_SEPARATOR_2 */
|
|
5621
|
|
5622 #ifndef PATH_SEPARATOR_2
|
|
5623 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
|
|
5624 #else /* PATH_SEPARATOR_2 */
|
|
5625 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
|
|
5626 #endif /* PATH_SEPARATOR_2 */
|
|
5627
|
|
5628 #ifndef FOPEN_WB
|
|
5629 # define FOPEN_WB "w"
|
|
5630 #endif
|
|
5631 #ifndef _O_BINARY
|
|
5632 # define _O_BINARY 0
|
|
5633 #endif
|
|
5634
|
|
5635 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
|
|
5636 #define XFREE(stale) do { \
|
|
5637 if (stale) { free (stale); stale = 0; } \
|
|
5638 } while (0)
|
|
5639
|
|
5640 #if defined LT_DEBUGWRAPPER
|
|
5641 static int lt_debug = 1;
|
|
5642 #else
|
|
5643 static int lt_debug = 0;
|
|
5644 #endif
|
|
5645
|
|
5646 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
|
|
5647
|
|
5648 void *xmalloc (size_t num);
|
|
5649 char *xstrdup (const char *string);
|
|
5650 const char *base_name (const char *name);
|
|
5651 char *find_executable (const char *wrapper);
|
|
5652 char *chase_symlinks (const char *pathspec);
|
|
5653 int make_executable (const char *path);
|
|
5654 int check_executable (const char *path);
|
|
5655 char *strendzap (char *str, const char *pat);
|
|
5656 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
|
|
5657 void lt_fatal (const char *file, int line, const char *message, ...);
|
|
5658 static const char *nonnull (const char *s);
|
|
5659 static const char *nonempty (const char *s);
|
|
5660 void lt_setenv (const char *name, const char *value);
|
|
5661 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
|
|
5662 void lt_update_exe_path (const char *name, const char *value);
|
|
5663 void lt_update_lib_path (const char *name, const char *value);
|
|
5664 char **prepare_spawn (char **argv);
|
|
5665 void lt_dump_script (FILE *f);
|
|
5666 EOF
|
|
5667
|
|
5668 cat <<EOF
|
|
5669 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
|
|
5670 # define externally_visible volatile
|
|
5671 #else
|
|
5672 # define externally_visible __attribute__((externally_visible)) volatile
|
|
5673 #endif
|
|
5674 externally_visible const char * MAGIC_EXE = "$magic_exe";
|
|
5675 const char * LIB_PATH_VARNAME = "$shlibpath_var";
|
|
5676 EOF
|
|
5677
|
|
5678 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
|
|
5679 func_to_host_path "$temp_rpath"
|
|
5680 cat <<EOF
|
|
5681 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
|
|
5682 EOF
|
|
5683 else
|
|
5684 cat <<"EOF"
|
|
5685 const char * LIB_PATH_VALUE = "";
|
|
5686 EOF
|
|
5687 fi
|
|
5688
|
|
5689 if test -n "$dllsearchpath"; then
|
|
5690 func_to_host_path "$dllsearchpath:"
|
|
5691 cat <<EOF
|
|
5692 const char * EXE_PATH_VARNAME = "PATH";
|
|
5693 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
|
|
5694 EOF
|
|
5695 else
|
|
5696 cat <<"EOF"
|
|
5697 const char * EXE_PATH_VARNAME = "";
|
|
5698 const char * EXE_PATH_VALUE = "";
|
|
5699 EOF
|
|
5700 fi
|
|
5701
|
|
5702 if test yes = "$fast_install"; then
|
|
5703 cat <<EOF
|
|
5704 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
|
|
5705 EOF
|
|
5706 else
|
|
5707 cat <<EOF
|
|
5708 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
|
|
5709 EOF
|
|
5710 fi
|
|
5711
|
|
5712
|
|
5713 cat <<"EOF"
|
|
5714
|
|
5715 #define LTWRAPPER_OPTION_PREFIX "--lt-"
|
|
5716
|
|
5717 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
|
|
5718 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
|
|
5719 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
|
|
5720
|
|
5721 int
|
|
5722 main (int argc, char *argv[])
|
|
5723 {
|
|
5724 char **newargz;
|
|
5725 int newargc;
|
|
5726 char *tmp_pathspec;
|
|
5727 char *actual_cwrapper_path;
|
|
5728 char *actual_cwrapper_name;
|
|
5729 char *target_name;
|
|
5730 char *lt_argv_zero;
|
|
5731 int rval = 127;
|
|
5732
|
|
5733 int i;
|
|
5734
|
|
5735 program_name = (char *) xstrdup (base_name (argv[0]));
|
|
5736 newargz = XMALLOC (char *, (size_t) argc + 1);
|
|
5737
|
|
5738 /* very simple arg parsing; don't want to rely on getopt
|
|
5739 * also, copy all non cwrapper options to newargz, except
|
|
5740 * argz[0], which is handled differently
|
|
5741 */
|
|
5742 newargc=0;
|
|
5743 for (i = 1; i < argc; i++)
|
|
5744 {
|
|
5745 if (STREQ (argv[i], dumpscript_opt))
|
|
5746 {
|
|
5747 EOF
|
|
5748 case $host in
|
|
5749 *mingw* | *cygwin* )
|
|
5750 # make stdout use "unix" line endings
|
|
5751 echo " setmode(1,_O_BINARY);"
|
|
5752 ;;
|
|
5753 esac
|
|
5754
|
|
5755 cat <<"EOF"
|
|
5756 lt_dump_script (stdout);
|
|
5757 return 0;
|
|
5758 }
|
|
5759 if (STREQ (argv[i], debug_opt))
|
|
5760 {
|
|
5761 lt_debug = 1;
|
|
5762 continue;
|
|
5763 }
|
|
5764 if (STREQ (argv[i], ltwrapper_option_prefix))
|
|
5765 {
|
|
5766 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
|
|
5767 namespace, but it is not one of the ones we know about and
|
|
5768 have already dealt with, above (inluding dump-script), then
|
|
5769 report an error. Otherwise, targets might begin to believe
|
|
5770 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
|
|
5771 namespace. The first time any user complains about this, we'll
|
|
5772 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
|
|
5773 or a configure.ac-settable value.
|
|
5774 */
|
|
5775 lt_fatal (__FILE__, __LINE__,
|
|
5776 "unrecognized %s option: '%s'",
|
|
5777 ltwrapper_option_prefix, argv[i]);
|
|
5778 }
|
|
5779 /* otherwise ... */
|
|
5780 newargz[++newargc] = xstrdup (argv[i]);
|
|
5781 }
|
|
5782 newargz[++newargc] = NULL;
|
|
5783
|
|
5784 EOF
|
|
5785 cat <<EOF
|
|
5786 /* The GNU banner must be the first non-error debug message */
|
|
5787 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
|
|
5788 EOF
|
|
5789 cat <<"EOF"
|
|
5790 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
|
|
5791 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
|
|
5792
|
|
5793 tmp_pathspec = find_executable (argv[0]);
|
|
5794 if (tmp_pathspec == NULL)
|
|
5795 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
|
|
5796 lt_debugprintf (__FILE__, __LINE__,
|
|
5797 "(main) found exe (before symlink chase) at: %s\n",
|
|
5798 tmp_pathspec);
|
|
5799
|
|
5800 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
|
|
5801 lt_debugprintf (__FILE__, __LINE__,
|
|
5802 "(main) found exe (after symlink chase) at: %s\n",
|
|
5803 actual_cwrapper_path);
|
|
5804 XFREE (tmp_pathspec);
|
|
5805
|
|
5806 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
|
|
5807 strendzap (actual_cwrapper_path, actual_cwrapper_name);
|
|
5808
|
|
5809 /* wrapper name transforms */
|
|
5810 strendzap (actual_cwrapper_name, ".exe");
|
|
5811 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
|
|
5812 XFREE (actual_cwrapper_name);
|
|
5813 actual_cwrapper_name = tmp_pathspec;
|
|
5814 tmp_pathspec = 0;
|
|
5815
|
|
5816 /* target_name transforms -- use actual target program name; might have lt- prefix */
|
|
5817 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
|
|
5818 strendzap (target_name, ".exe");
|
|
5819 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
|
|
5820 XFREE (target_name);
|
|
5821 target_name = tmp_pathspec;
|
|
5822 tmp_pathspec = 0;
|
|
5823
|
|
5824 lt_debugprintf (__FILE__, __LINE__,
|
|
5825 "(main) libtool target name: %s\n",
|
|
5826 target_name);
|
|
5827 EOF
|
|
5828
|
|
5829 cat <<EOF
|
|
5830 newargz[0] =
|
|
5831 XMALLOC (char, (strlen (actual_cwrapper_path) +
|
|
5832 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
|
|
5833 strcpy (newargz[0], actual_cwrapper_path);
|
|
5834 strcat (newargz[0], "$objdir");
|
|
5835 strcat (newargz[0], "/");
|
|
5836 EOF
|
|
5837
|
|
5838 cat <<"EOF"
|
|
5839 /* stop here, and copy so we don't have to do this twice */
|
|
5840 tmp_pathspec = xstrdup (newargz[0]);
|
|
5841
|
|
5842 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
|
|
5843 strcat (newargz[0], actual_cwrapper_name);
|
|
5844
|
|
5845 /* DO want the lt- prefix here if it exists, so use target_name */
|
|
5846 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
|
|
5847 XFREE (tmp_pathspec);
|
|
5848 tmp_pathspec = NULL;
|
|
5849 EOF
|
|
5850
|
|
5851 case $host_os in
|
|
5852 mingw*)
|
|
5853 cat <<"EOF"
|
|
5854 {
|
|
5855 char* p;
|
|
5856 while ((p = strchr (newargz[0], '\\')) != NULL)
|
|
5857 {
|
|
5858 *p = '/';
|
|
5859 }
|
|
5860 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
|
|
5861 {
|
|
5862 *p = '/';
|
|
5863 }
|
|
5864 }
|
|
5865 EOF
|
|
5866 ;;
|
|
5867 esac
|
|
5868
|
|
5869 cat <<"EOF"
|
|
5870 XFREE (target_name);
|
|
5871 XFREE (actual_cwrapper_path);
|
|
5872 XFREE (actual_cwrapper_name);
|
|
5873
|
|
5874 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
|
|
5875 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
|
|
5876 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
|
|
5877 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
|
|
5878 because on Windows, both *_VARNAMEs are PATH but uninstalled
|
|
5879 libraries must come first. */
|
|
5880 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
|
|
5881 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
|
|
5882
|
|
5883 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
|
|
5884 nonnull (lt_argv_zero));
|
|
5885 for (i = 0; i < newargc; i++)
|
|
5886 {
|
|
5887 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
|
|
5888 i, nonnull (newargz[i]));
|
|
5889 }
|
|
5890
|
|
5891 EOF
|
|
5892
|
|
5893 case $host_os in
|
|
5894 mingw*)
|
|
5895 cat <<"EOF"
|
|
5896 /* execv doesn't actually work on mingw as expected on unix */
|
|
5897 newargz = prepare_spawn (newargz);
|
|
5898 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
|
|
5899 if (rval == -1)
|
|
5900 {
|
|
5901 /* failed to start process */
|
|
5902 lt_debugprintf (__FILE__, __LINE__,
|
|
5903 "(main) failed to launch target \"%s\": %s\n",
|
|
5904 lt_argv_zero, nonnull (strerror (errno)));
|
|
5905 return 127;
|
|
5906 }
|
|
5907 return rval;
|
|
5908 EOF
|
|
5909 ;;
|
|
5910 *)
|
|
5911 cat <<"EOF"
|
|
5912 execv (lt_argv_zero, newargz);
|
|
5913 return rval; /* =127, but avoids unused variable warning */
|
|
5914 EOF
|
|
5915 ;;
|
|
5916 esac
|
|
5917
|
|
5918 cat <<"EOF"
|
|
5919 }
|
|
5920
|
|
5921 void *
|
|
5922 xmalloc (size_t num)
|
|
5923 {
|
|
5924 void *p = (void *) malloc (num);
|
|
5925 if (!p)
|
|
5926 lt_fatal (__FILE__, __LINE__, "memory exhausted");
|
|
5927
|
|
5928 return p;
|
|
5929 }
|
|
5930
|
|
5931 char *
|
|
5932 xstrdup (const char *string)
|
|
5933 {
|
|
5934 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
|
|
5935 string) : NULL;
|
|
5936 }
|
|
5937
|
|
5938 const char *
|
|
5939 base_name (const char *name)
|
|
5940 {
|
|
5941 const char *base;
|
|
5942
|
|
5943 #if defined HAVE_DOS_BASED_FILE_SYSTEM
|
|
5944 /* Skip over the disk name in MSDOS pathnames. */
|
|
5945 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
|
|
5946 name += 2;
|
|
5947 #endif
|
|
5948
|
|
5949 for (base = name; *name; name++)
|
|
5950 if (IS_DIR_SEPARATOR (*name))
|
|
5951 base = name + 1;
|
|
5952 return base;
|
|
5953 }
|
|
5954
|
|
5955 int
|
|
5956 check_executable (const char *path)
|
|
5957 {
|
|
5958 struct stat st;
|
|
5959
|
|
5960 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
|
|
5961 nonempty (path));
|
|
5962 if ((!path) || (!*path))
|
|
5963 return 0;
|
|
5964
|
|
5965 if ((stat (path, &st) >= 0)
|
|
5966 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
|
|
5967 return 1;
|
|
5968 else
|
|
5969 return 0;
|
|
5970 }
|
|
5971
|
|
5972 int
|
|
5973 make_executable (const char *path)
|
|
5974 {
|
|
5975 int rval = 0;
|
|
5976 struct stat st;
|
|
5977
|
|
5978 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
|
|
5979 nonempty (path));
|
|
5980 if ((!path) || (!*path))
|
|
5981 return 0;
|
|
5982
|
|
5983 if (stat (path, &st) >= 0)
|
|
5984 {
|
|
5985 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
|
|
5986 }
|
|
5987 return rval;
|
|
5988 }
|
|
5989
|
|
5990 /* Searches for the full path of the wrapper. Returns
|
|
5991 newly allocated full path name if found, NULL otherwise
|
|
5992 Does not chase symlinks, even on platforms that support them.
|
|
5993 */
|
|
5994 char *
|
|
5995 find_executable (const char *wrapper)
|
|
5996 {
|
|
5997 int has_slash = 0;
|
|
5998 const char *p;
|
|
5999 const char *p_next;
|
|
6000 /* static buffer for getcwd */
|
|
6001 char tmp[LT_PATHMAX + 1];
|
|
6002 size_t tmp_len;
|
|
6003 char *concat_name;
|
|
6004
|
|
6005 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
|
|
6006 nonempty (wrapper));
|
|
6007
|
|
6008 if ((wrapper == NULL) || (*wrapper == '\0'))
|
|
6009 return NULL;
|
|
6010
|
|
6011 /* Absolute path? */
|
|
6012 #if defined HAVE_DOS_BASED_FILE_SYSTEM
|
|
6013 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
|
|
6014 {
|
|
6015 concat_name = xstrdup (wrapper);
|
|
6016 if (check_executable (concat_name))
|
|
6017 return concat_name;
|
|
6018 XFREE (concat_name);
|
|
6019 }
|
|
6020 else
|
|
6021 {
|
|
6022 #endif
|
|
6023 if (IS_DIR_SEPARATOR (wrapper[0]))
|
|
6024 {
|
|
6025 concat_name = xstrdup (wrapper);
|
|
6026 if (check_executable (concat_name))
|
|
6027 return concat_name;
|
|
6028 XFREE (concat_name);
|
|
6029 }
|
|
6030 #if defined HAVE_DOS_BASED_FILE_SYSTEM
|
|
6031 }
|
|
6032 #endif
|
|
6033
|
|
6034 for (p = wrapper; *p; p++)
|
|
6035 if (*p == '/')
|
|
6036 {
|
|
6037 has_slash = 1;
|
|
6038 break;
|
|
6039 }
|
|
6040 if (!has_slash)
|
|
6041 {
|
|
6042 /* no slashes; search PATH */
|
|
6043 const char *path = getenv ("PATH");
|
|
6044 if (path != NULL)
|
|
6045 {
|
|
6046 for (p = path; *p; p = p_next)
|
|
6047 {
|
|
6048 const char *q;
|
|
6049 size_t p_len;
|
|
6050 for (q = p; *q; q++)
|
|
6051 if (IS_PATH_SEPARATOR (*q))
|
|
6052 break;
|
|
6053 p_len = (size_t) (q - p);
|
|
6054 p_next = (*q == '\0' ? q : q + 1);
|
|
6055 if (p_len == 0)
|
|
6056 {
|
|
6057 /* empty path: current directory */
|
|
6058 if (getcwd (tmp, LT_PATHMAX) == NULL)
|
|
6059 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
|
|
6060 nonnull (strerror (errno)));
|
|
6061 tmp_len = strlen (tmp);
|
|
6062 concat_name =
|
|
6063 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
|
|
6064 memcpy (concat_name, tmp, tmp_len);
|
|
6065 concat_name[tmp_len] = '/';
|
|
6066 strcpy (concat_name + tmp_len + 1, wrapper);
|
|
6067 }
|
|
6068 else
|
|
6069 {
|
|
6070 concat_name =
|
|
6071 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
|
|
6072 memcpy (concat_name, p, p_len);
|
|
6073 concat_name[p_len] = '/';
|
|
6074 strcpy (concat_name + p_len + 1, wrapper);
|
|
6075 }
|
|
6076 if (check_executable (concat_name))
|
|
6077 return concat_name;
|
|
6078 XFREE (concat_name);
|
|
6079 }
|
|
6080 }
|
|
6081 /* not found in PATH; assume curdir */
|
|
6082 }
|
|
6083 /* Relative path | not found in path: prepend cwd */
|
|
6084 if (getcwd (tmp, LT_PATHMAX) == NULL)
|
|
6085 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
|
|
6086 nonnull (strerror (errno)));
|
|
6087 tmp_len = strlen (tmp);
|
|
6088 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
|
|
6089 memcpy (concat_name, tmp, tmp_len);
|
|
6090 concat_name[tmp_len] = '/';
|
|
6091 strcpy (concat_name + tmp_len + 1, wrapper);
|
|
6092
|
|
6093 if (check_executable (concat_name))
|
|
6094 return concat_name;
|
|
6095 XFREE (concat_name);
|
|
6096 return NULL;
|
|
6097 }
|
|
6098
|
|
6099 char *
|
|
6100 chase_symlinks (const char *pathspec)
|
|
6101 {
|
|
6102 #ifndef S_ISLNK
|
|
6103 return xstrdup (pathspec);
|
|
6104 #else
|
|
6105 char buf[LT_PATHMAX];
|
|
6106 struct stat s;
|
|
6107 char *tmp_pathspec = xstrdup (pathspec);
|
|
6108 char *p;
|
|
6109 int has_symlinks = 0;
|
|
6110 while (strlen (tmp_pathspec) && !has_symlinks)
|
|
6111 {
|
|
6112 lt_debugprintf (__FILE__, __LINE__,
|
|
6113 "checking path component for symlinks: %s\n",
|
|
6114 tmp_pathspec);
|
|
6115 if (lstat (tmp_pathspec, &s) == 0)
|
|
6116 {
|
|
6117 if (S_ISLNK (s.st_mode) != 0)
|
|
6118 {
|
|
6119 has_symlinks = 1;
|
|
6120 break;
|
|
6121 }
|
|
6122
|
|
6123 /* search backwards for last DIR_SEPARATOR */
|
|
6124 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
|
|
6125 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
|
|
6126 p--;
|
|
6127 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
|
|
6128 {
|
|
6129 /* no more DIR_SEPARATORS left */
|
|
6130 break;
|
|
6131 }
|
|
6132 *p = '\0';
|
|
6133 }
|
|
6134 else
|
|
6135 {
|
|
6136 lt_fatal (__FILE__, __LINE__,
|
|
6137 "error accessing file \"%s\": %s",
|
|
6138 tmp_pathspec, nonnull (strerror (errno)));
|
|
6139 }
|
|
6140 }
|
|
6141 XFREE (tmp_pathspec);
|
|
6142
|
|
6143 if (!has_symlinks)
|
|
6144 {
|
|
6145 return xstrdup (pathspec);
|
|
6146 }
|
|
6147
|
|
6148 tmp_pathspec = realpath (pathspec, buf);
|
|
6149 if (tmp_pathspec == 0)
|
|
6150 {
|
|
6151 lt_fatal (__FILE__, __LINE__,
|
|
6152 "could not follow symlinks for %s", pathspec);
|
|
6153 }
|
|
6154 return xstrdup (tmp_pathspec);
|
|
6155 #endif
|
|
6156 }
|
|
6157
|
|
6158 char *
|
|
6159 strendzap (char *str, const char *pat)
|
|
6160 {
|
|
6161 size_t len, patlen;
|
|
6162
|
|
6163 assert (str != NULL);
|
|
6164 assert (pat != NULL);
|
|
6165
|
|
6166 len = strlen (str);
|
|
6167 patlen = strlen (pat);
|
|
6168
|
|
6169 if (patlen <= len)
|
|
6170 {
|
|
6171 str += len - patlen;
|
|
6172 if (STREQ (str, pat))
|
|
6173 *str = '\0';
|
|
6174 }
|
|
6175 return str;
|
|
6176 }
|
|
6177
|
|
6178 void
|
|
6179 lt_debugprintf (const char *file, int line, const char *fmt, ...)
|
|
6180 {
|
|
6181 va_list args;
|
|
6182 if (lt_debug)
|
|
6183 {
|
|
6184 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
|
|
6185 va_start (args, fmt);
|
|
6186 (void) vfprintf (stderr, fmt, args);
|
|
6187 va_end (args);
|
|
6188 }
|
|
6189 }
|
|
6190
|
|
6191 static void
|
|
6192 lt_error_core (int exit_status, const char *file,
|
|
6193 int line, const char *mode,
|
|
6194 const char *message, va_list ap)
|
|
6195 {
|
|
6196 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
|
|
6197 vfprintf (stderr, message, ap);
|
|
6198 fprintf (stderr, ".\n");
|
|
6199
|
|
6200 if (exit_status >= 0)
|
|
6201 exit (exit_status);
|
|
6202 }
|
|
6203
|
|
6204 void
|
|
6205 lt_fatal (const char *file, int line, const char *message, ...)
|
|
6206 {
|
|
6207 va_list ap;
|
|
6208 va_start (ap, message);
|
|
6209 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
|
|
6210 va_end (ap);
|
|
6211 }
|
|
6212
|
|
6213 static const char *
|
|
6214 nonnull (const char *s)
|
|
6215 {
|
|
6216 return s ? s : "(null)";
|
|
6217 }
|
|
6218
|
|
6219 static const char *
|
|
6220 nonempty (const char *s)
|
|
6221 {
|
|
6222 return (s && !*s) ? "(empty)" : nonnull (s);
|
|
6223 }
|
|
6224
|
|
6225 void
|
|
6226 lt_setenv (const char *name, const char *value)
|
|
6227 {
|
|
6228 lt_debugprintf (__FILE__, __LINE__,
|
|
6229 "(lt_setenv) setting '%s' to '%s'\n",
|
|
6230 nonnull (name), nonnull (value));
|
|
6231 {
|
|
6232 #ifdef HAVE_SETENV
|
|
6233 /* always make a copy, for consistency with !HAVE_SETENV */
|
|
6234 char *str = xstrdup (value);
|
|
6235 setenv (name, str, 1);
|
|
6236 #else
|
|
6237 size_t len = strlen (name) + 1 + strlen (value) + 1;
|
|
6238 char *str = XMALLOC (char, len);
|
|
6239 sprintf (str, "%s=%s", name, value);
|
|
6240 if (putenv (str) != EXIT_SUCCESS)
|
|
6241 {
|
|
6242 XFREE (str);
|
|
6243 }
|
|
6244 #endif
|
|
6245 }
|
|
6246 }
|
|
6247
|
|
6248 char *
|
|
6249 lt_extend_str (const char *orig_value, const char *add, int to_end)
|
|
6250 {
|
|
6251 char *new_value;
|
|
6252 if (orig_value && *orig_value)
|
|
6253 {
|
|
6254 size_t orig_value_len = strlen (orig_value);
|
|
6255 size_t add_len = strlen (add);
|
|
6256 new_value = XMALLOC (char, add_len + orig_value_len + 1);
|
|
6257 if (to_end)
|
|
6258 {
|
|
6259 strcpy (new_value, orig_value);
|
|
6260 strcpy (new_value + orig_value_len, add);
|
|
6261 }
|
|
6262 else
|
|
6263 {
|
|
6264 strcpy (new_value, add);
|
|
6265 strcpy (new_value + add_len, orig_value);
|
|
6266 }
|
|
6267 }
|
|
6268 else
|
|
6269 {
|
|
6270 new_value = xstrdup (add);
|
|
6271 }
|
|
6272 return new_value;
|
|
6273 }
|
|
6274
|
|
6275 void
|
|
6276 lt_update_exe_path (const char *name, const char *value)
|
|
6277 {
|
|
6278 lt_debugprintf (__FILE__, __LINE__,
|
|
6279 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
|
|
6280 nonnull (name), nonnull (value));
|
|
6281
|
|
6282 if (name && *name && value && *value)
|
|
6283 {
|
|
6284 char *new_value = lt_extend_str (getenv (name), value, 0);
|
|
6285 /* some systems can't cope with a ':'-terminated path #' */
|
|
6286 size_t len = strlen (new_value);
|
|
6287 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
|
|
6288 {
|
|
6289 new_value[--len] = '\0';
|
|
6290 }
|
|
6291 lt_setenv (name, new_value);
|
|
6292 XFREE (new_value);
|
|
6293 }
|
|
6294 }
|
|
6295
|
|
6296 void
|
|
6297 lt_update_lib_path (const char *name, const char *value)
|
|
6298 {
|
|
6299 lt_debugprintf (__FILE__, __LINE__,
|
|
6300 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
|
|
6301 nonnull (name), nonnull (value));
|
|
6302
|
|
6303 if (name && *name && value && *value)
|
|
6304 {
|
|
6305 char *new_value = lt_extend_str (getenv (name), value, 0);
|
|
6306 lt_setenv (name, new_value);
|
|
6307 XFREE (new_value);
|
|
6308 }
|
|
6309 }
|
|
6310
|
|
6311 EOF
|
|
6312 case $host_os in
|
|
6313 mingw*)
|
|
6314 cat <<"EOF"
|
|
6315
|
|
6316 /* Prepares an argument vector before calling spawn().
|
|
6317 Note that spawn() does not by itself call the command interpreter
|
|
6318 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
|
|
6319 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
|
6320 GetVersionEx(&v);
|
|
6321 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
|
|
6322 }) ? "cmd.exe" : "command.com").
|
|
6323 Instead it simply concatenates the arguments, separated by ' ', and calls
|
|
6324 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
|
|
6325 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
|
|
6326 special way:
|
|
6327 - Space and tab are interpreted as delimiters. They are not treated as
|
|
6328 delimiters if they are surrounded by double quotes: "...".
|
|
6329 - Unescaped double quotes are removed from the input. Their only effect is
|
|
6330 that within double quotes, space and tab are treated like normal
|
|
6331 characters.
|
|
6332 - Backslashes not followed by double quotes are not special.
|
|
6333 - But 2*n+1 backslashes followed by a double quote become
|
|
6334 n backslashes followed by a double quote (n >= 0):
|
|
6335 \" -> "
|
|
6336 \\\" -> \"
|
|
6337 \\\\\" -> \\"
|
|
6338 */
|
|
6339 #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
|
|
6340 #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
|
|
6341 char **
|
|
6342 prepare_spawn (char **argv)
|
|
6343 {
|
|
6344 size_t argc;
|
|
6345 char **new_argv;
|
|
6346 size_t i;
|
|
6347
|
|
6348 /* Count number of arguments. */
|
|
6349 for (argc = 0; argv[argc] != NULL; argc++)
|
|
6350 ;
|
|
6351
|
|
6352 /* Allocate new argument vector. */
|
|
6353 new_argv = XMALLOC (char *, argc + 1);
|
|
6354
|
|
6355 /* Put quoted arguments into the new argument vector. */
|
|
6356 for (i = 0; i < argc; i++)
|
|
6357 {
|
|
6358 const char *string = argv[i];
|
|
6359
|
|
6360 if (string[0] == '\0')
|
|
6361 new_argv[i] = xstrdup ("\"\"");
|
|
6362 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
|
|
6363 {
|
|
6364 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
|
|
6365 size_t length;
|
|
6366 unsigned int backslashes;
|
|
6367 const char *s;
|
|
6368 char *quoted_string;
|
|
6369 char *p;
|
|
6370
|
|
6371 length = 0;
|
|
6372 backslashes = 0;
|
|
6373 if (quote_around)
|
|
6374 length++;
|
|
6375 for (s = string; *s != '\0'; s++)
|
|
6376 {
|
|
6377 char c = *s;
|
|
6378 if (c == '"')
|
|
6379 length += backslashes + 1;
|
|
6380 length++;
|
|
6381 if (c == '\\')
|
|
6382 backslashes++;
|
|
6383 else
|
|
6384 backslashes = 0;
|
|
6385 }
|
|
6386 if (quote_around)
|
|
6387 length += backslashes + 1;
|
|
6388
|
|
6389 quoted_string = XMALLOC (char, length + 1);
|
|
6390
|
|
6391 p = quoted_string;
|
|
6392 backslashes = 0;
|
|
6393 if (quote_around)
|
|
6394 *p++ = '"';
|
|
6395 for (s = string; *s != '\0'; s++)
|
|
6396 {
|
|
6397 char c = *s;
|
|
6398 if (c == '"')
|
|
6399 {
|
|
6400 unsigned int j;
|
|
6401 for (j = backslashes + 1; j > 0; j--)
|
|
6402 *p++ = '\\';
|
|
6403 }
|
|
6404 *p++ = c;
|
|
6405 if (c == '\\')
|
|
6406 backslashes++;
|
|
6407 else
|
|
6408 backslashes = 0;
|
|
6409 }
|
|
6410 if (quote_around)
|
|
6411 {
|
|
6412 unsigned int j;
|
|
6413 for (j = backslashes; j > 0; j--)
|
|
6414 *p++ = '\\';
|
|
6415 *p++ = '"';
|
|
6416 }
|
|
6417 *p = '\0';
|
|
6418
|
|
6419 new_argv[i] = quoted_string;
|
|
6420 }
|
|
6421 else
|
|
6422 new_argv[i] = (char *) string;
|
|
6423 }
|
|
6424 new_argv[argc] = NULL;
|
|
6425
|
|
6426 return new_argv;
|
|
6427 }
|
|
6428 EOF
|
|
6429 ;;
|
|
6430 esac
|
|
6431
|
|
6432 cat <<"EOF"
|
|
6433 void lt_dump_script (FILE* f)
|
|
6434 {
|
|
6435 EOF
|
|
6436 func_emit_wrapper yes |
|
|
6437 $SED -n -e '
|
|
6438 s/^\(.\{79\}\)\(..*\)/\1\
|
|
6439 \2/
|
|
6440 h
|
|
6441 s/\([\\"]\)/\\\1/g
|
|
6442 s/$/\\n/
|
|
6443 s/\([^\n]*\).*/ fputs ("\1", f);/p
|
|
6444 g
|
|
6445 D'
|
|
6446 cat <<"EOF"
|
|
6447 }
|
|
6448 EOF
|
|
6449 }
|
|
6450 # end: func_emit_cwrapperexe_src
|
|
6451
|
|
6452 # func_win32_import_lib_p ARG
|
|
6453 # True if ARG is an import lib, as indicated by $file_magic_cmd
|
|
6454 func_win32_import_lib_p ()
|
|
6455 {
|
|
6456 $debug_cmd
|
|
6457
|
|
6458 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
|
|
6459 *import*) : ;;
|
|
6460 *) false ;;
|
|
6461 esac
|
|
6462 }
|
|
6463
|
|
6464 # func_suncc_cstd_abi
|
|
6465 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
|
|
6466 # Several compiler flags select an ABI that is incompatible with the
|
|
6467 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
|
|
6468 func_suncc_cstd_abi ()
|
|
6469 {
|
|
6470 $debug_cmd
|
|
6471
|
|
6472 case " $compile_command " in
|
|
6473 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
|
|
6474 suncc_use_cstd_abi=no
|
|
6475 ;;
|
|
6476 *)
|
|
6477 suncc_use_cstd_abi=yes
|
|
6478 ;;
|
|
6479 esac
|
|
6480 }
|
|
6481
|
|
6482 # func_mode_link arg...
|
|
6483 func_mode_link ()
|
|
6484 {
|
|
6485 $debug_cmd
|
|
6486
|
|
6487 case $host in
|
|
6488 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
|
6489 # It is impossible to link a dll without this setting, and
|
|
6490 # we shouldn't force the makefile maintainer to figure out
|
|
6491 # what system we are compiling for in order to pass an extra
|
|
6492 # flag for every libtool invocation.
|
|
6493 # allow_undefined=no
|
|
6494
|
|
6495 # FIXME: Unfortunately, there are problems with the above when trying
|
|
6496 # to make a dll that has undefined symbols, in which case not
|
|
6497 # even a static library is built. For now, we need to specify
|
|
6498 # -no-undefined on the libtool link line when we can be certain
|
|
6499 # that all symbols are satisfied, otherwise we get a static library.
|
|
6500 allow_undefined=yes
|
|
6501 ;;
|
|
6502 *)
|
|
6503 allow_undefined=yes
|
|
6504 ;;
|
|
6505 esac
|
|
6506 libtool_args=$nonopt
|
|
6507 base_compile="$nonopt $@"
|
|
6508 compile_command=$nonopt
|
|
6509 finalize_command=$nonopt
|
|
6510
|
|
6511 compile_rpath=
|
|
6512 finalize_rpath=
|
|
6513 compile_shlibpath=
|
|
6514 finalize_shlibpath=
|
|
6515 convenience=
|
|
6516 old_convenience=
|
|
6517 deplibs=
|
|
6518 old_deplibs=
|
|
6519 compiler_flags=
|
|
6520 linker_flags=
|
|
6521 dllsearchpath=
|
|
6522 lib_search_path=`pwd`
|
|
6523 inst_prefix_dir=
|
|
6524 new_inherited_linker_flags=
|
|
6525
|
|
6526 avoid_version=no
|
|
6527 bindir=
|
|
6528 dlfiles=
|
|
6529 dlprefiles=
|
|
6530 dlself=no
|
|
6531 export_dynamic=no
|
|
6532 export_symbols=
|
|
6533 export_symbols_regex=
|
|
6534 generated=
|
|
6535 libobjs=
|
|
6536 ltlibs=
|
|
6537 module=no
|
|
6538 no_install=no
|
|
6539 objs=
|
|
6540 os2dllname=
|
|
6541 non_pic_objects=
|
|
6542 precious_files_regex=
|
|
6543 prefer_static_libs=no
|
|
6544 preload=false
|
|
6545 prev=
|
|
6546 prevarg=
|
|
6547 release=
|
|
6548 rpath=
|
|
6549 xrpath=
|
|
6550 perm_rpath=
|
|
6551 temp_rpath=
|
|
6552 thread_safe=no
|
|
6553 vinfo=
|
|
6554 vinfo_number=no
|
|
6555 weak_libs=
|
|
6556 single_module=$wl-single_module
|
|
6557 func_infer_tag $base_compile
|
|
6558
|
|
6559 # We need to know -static, to get the right output filenames.
|
|
6560 for arg
|
|
6561 do
|
|
6562 case $arg in
|
|
6563 -shared)
|
|
6564 test yes != "$build_libtool_libs" \
|
|
6565 && func_fatal_configuration "cannot build a shared library"
|
|
6566 build_old_libs=no
|
|
6567 break
|
|
6568 ;;
|
|
6569 -all-static | -static | -static-libtool-libs)
|
|
6570 case $arg in
|
|
6571 -all-static)
|
|
6572 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
|
|
6573 func_warning "complete static linking is impossible in this configuration"
|
|
6574 fi
|
|
6575 if test -n "$link_static_flag"; then
|
|
6576 dlopen_self=$dlopen_self_static
|
|
6577 fi
|
|
6578 prefer_static_libs=yes
|
|
6579 ;;
|
|
6580 -static)
|
|
6581 if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
|
6582 dlopen_self=$dlopen_self_static
|
|
6583 fi
|
|
6584 prefer_static_libs=built
|
|
6585 ;;
|
|
6586 -static-libtool-libs)
|
|
6587 if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
|
6588 dlopen_self=$dlopen_self_static
|
|
6589 fi
|
|
6590 prefer_static_libs=yes
|
|
6591 ;;
|
|
6592 esac
|
|
6593 build_libtool_libs=no
|
|
6594 build_old_libs=yes
|
|
6595 break
|
|
6596 ;;
|
|
6597 esac
|
|
6598 done
|
|
6599
|
|
6600 # See if our shared archives depend on static archives.
|
|
6601 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
|
|
6602
|
|
6603 # Go through the arguments, transforming them on the way.
|
|
6604 while test "$#" -gt 0; do
|
|
6605 arg=$1
|
|
6606 shift
|
|
6607 func_quote_for_eval "$arg"
|
|
6608 qarg=$func_quote_for_eval_unquoted_result
|
|
6609 func_append libtool_args " $func_quote_for_eval_result"
|
|
6610
|
|
6611 # If the previous option needs an argument, assign it.
|
|
6612 if test -n "$prev"; then
|
|
6613 case $prev in
|
|
6614 output)
|
|
6615 func_append compile_command " @OUTPUT@"
|
|
6616 func_append finalize_command " @OUTPUT@"
|
|
6617 ;;
|
|
6618 esac
|
|
6619
|
|
6620 case $prev in
|
|
6621 bindir)
|
|
6622 bindir=$arg
|
|
6623 prev=
|
|
6624 continue
|
|
6625 ;;
|
|
6626 dlfiles|dlprefiles)
|
|
6627 $preload || {
|
|
6628 # Add the symbol object into the linking commands.
|
|
6629 func_append compile_command " @SYMFILE@"
|
|
6630 func_append finalize_command " @SYMFILE@"
|
|
6631 preload=:
|
|
6632 }
|
|
6633 case $arg in
|
|
6634 *.la | *.lo) ;; # We handle these cases below.
|
|
6635 force)
|
|
6636 if test no = "$dlself"; then
|
|
6637 dlself=needless
|
|
6638 export_dynamic=yes
|
|
6639 fi
|
|
6640 prev=
|
|
6641 continue
|
|
6642 ;;
|
|
6643 self)
|
|
6644 if test dlprefiles = "$prev"; then
|
|
6645 dlself=yes
|
|
6646 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
|
|
6647 dlself=yes
|
|
6648 else
|
|
6649 dlself=needless
|
|
6650 export_dynamic=yes
|
|
6651 fi
|
|
6652 prev=
|
|
6653 continue
|
|
6654 ;;
|
|
6655 *)
|
|
6656 if test dlfiles = "$prev"; then
|
|
6657 func_append dlfiles " $arg"
|
|
6658 else
|
|
6659 func_append dlprefiles " $arg"
|
|
6660 fi
|
|
6661 prev=
|
|
6662 continue
|
|
6663 ;;
|
|
6664 esac
|
|
6665 ;;
|
|
6666 expsyms)
|
|
6667 export_symbols=$arg
|
|
6668 test -f "$arg" \
|
|
6669 || func_fatal_error "symbol file '$arg' does not exist"
|
|
6670 prev=
|
|
6671 continue
|
|
6672 ;;
|
|
6673 expsyms_regex)
|
|
6674 export_symbols_regex=$arg
|
|
6675 prev=
|
|
6676 continue
|
|
6677 ;;
|
|
6678 framework)
|
|
6679 case $host in
|
|
6680 *-*-darwin*)
|
|
6681 case "$deplibs " in
|
|
6682 *" $qarg.ltframework "*) ;;
|
|
6683 *) func_append deplibs " $qarg.ltframework" # this is fixed later
|
|
6684 ;;
|
|
6685 esac
|
|
6686 ;;
|
|
6687 esac
|
|
6688 prev=
|
|
6689 continue
|
|
6690 ;;
|
|
6691 inst_prefix)
|
|
6692 inst_prefix_dir=$arg
|
|
6693 prev=
|
|
6694 continue
|
|
6695 ;;
|
|
6696 mllvm)
|
|
6697 # Clang does not use LLVM to link, so we can simply discard any
|
|
6698 # '-mllvm $arg' options when doing the link step.
|
|
6699 prev=
|
|
6700 continue
|
|
6701 ;;
|
|
6702 objectlist)
|
|
6703 if test -f "$arg"; then
|
|
6704 save_arg=$arg
|
|
6705 moreargs=
|
|
6706 for fil in `cat "$save_arg"`
|
|
6707 do
|
|
6708 # func_append moreargs " $fil"
|
|
6709 arg=$fil
|
|
6710 # A libtool-controlled object.
|
|
6711
|
|
6712 # Check to see that this really is a libtool object.
|
|
6713 if func_lalib_unsafe_p "$arg"; then
|
|
6714 pic_object=
|
|
6715 non_pic_object=
|
|
6716
|
|
6717 # Read the .lo file
|
|
6718 func_source "$arg"
|
|
6719
|
|
6720 if test -z "$pic_object" ||
|
|
6721 test -z "$non_pic_object" ||
|
|
6722 test none = "$pic_object" &&
|
|
6723 test none = "$non_pic_object"; then
|
|
6724 func_fatal_error "cannot find name of object for '$arg'"
|
|
6725 fi
|
|
6726
|
|
6727 # Extract subdirectory from the argument.
|
|
6728 func_dirname "$arg" "/" ""
|
|
6729 xdir=$func_dirname_result
|
|
6730
|
|
6731 if test none != "$pic_object"; then
|
|
6732 # Prepend the subdirectory the object is found in.
|
|
6733 pic_object=$xdir$pic_object
|
|
6734
|
|
6735 if test dlfiles = "$prev"; then
|
|
6736 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
|
|
6737 func_append dlfiles " $pic_object"
|
|
6738 prev=
|
|
6739 continue
|
|
6740 else
|
|
6741 # If libtool objects are unsupported, then we need to preload.
|
|
6742 prev=dlprefiles
|
|
6743 fi
|
|
6744 fi
|
|
6745
|
|
6746 # CHECK ME: I think I busted this. -Ossama
|
|
6747 if test dlprefiles = "$prev"; then
|
|
6748 # Preload the old-style object.
|
|
6749 func_append dlprefiles " $pic_object"
|
|
6750 prev=
|
|
6751 fi
|
|
6752
|
|
6753 # A PIC object.
|
|
6754 func_append libobjs " $pic_object"
|
|
6755 arg=$pic_object
|
|
6756 fi
|
|
6757
|
|
6758 # Non-PIC object.
|
|
6759 if test none != "$non_pic_object"; then
|
|
6760 # Prepend the subdirectory the object is found in.
|
|
6761 non_pic_object=$xdir$non_pic_object
|
|
6762
|
|
6763 # A standard non-PIC object
|
|
6764 func_append non_pic_objects " $non_pic_object"
|
|
6765 if test -z "$pic_object" || test none = "$pic_object"; then
|
|
6766 arg=$non_pic_object
|
|
6767 fi
|
|
6768 else
|
|
6769 # If the PIC object exists, use it instead.
|
|
6770 # $xdir was prepended to $pic_object above.
|
|
6771 non_pic_object=$pic_object
|
|
6772 func_append non_pic_objects " $non_pic_object"
|
|
6773 fi
|
|
6774 else
|
|
6775 # Only an error if not doing a dry-run.
|
|
6776 if $opt_dry_run; then
|
|
6777 # Extract subdirectory from the argument.
|
|
6778 func_dirname "$arg" "/" ""
|
|
6779 xdir=$func_dirname_result
|
|
6780
|
|
6781 func_lo2o "$arg"
|
|
6782 pic_object=$xdir$objdir/$func_lo2o_result
|
|
6783 non_pic_object=$xdir$func_lo2o_result
|
|
6784 func_append libobjs " $pic_object"
|
|
6785 func_append non_pic_objects " $non_pic_object"
|
|
6786 else
|
|
6787 func_fatal_error "'$arg' is not a valid libtool object"
|
|
6788 fi
|
|
6789 fi
|
|
6790 done
|
|
6791 else
|
|
6792 func_fatal_error "link input file '$arg' does not exist"
|
|
6793 fi
|
|
6794 arg=$save_arg
|
|
6795 prev=
|
|
6796 continue
|
|
6797 ;;
|
|
6798 os2dllname)
|
|
6799 os2dllname=$arg
|
|
6800 prev=
|
|
6801 continue
|
|
6802 ;;
|
|
6803 precious_regex)
|
|
6804 precious_files_regex=$arg
|
|
6805 prev=
|
|
6806 continue
|
|
6807 ;;
|
|
6808 release)
|
|
6809 release=-$arg
|
|
6810 prev=
|
|
6811 continue
|
|
6812 ;;
|
|
6813 rpath | xrpath)
|
|
6814 # We need an absolute path.
|
|
6815 case $arg in
|
|
6816 [\\/]* | [A-Za-z]:[\\/]*) ;;
|
|
6817 *)
|
|
6818 func_fatal_error "only absolute run-paths are allowed"
|
|
6819 ;;
|
|
6820 esac
|
|
6821 if test rpath = "$prev"; then
|
|
6822 case "$rpath " in
|
|
6823 *" $arg "*) ;;
|
|
6824 *) func_append rpath " $arg" ;;
|
|
6825 esac
|
|
6826 else
|
|
6827 case "$xrpath " in
|
|
6828 *" $arg "*) ;;
|
|
6829 *) func_append xrpath " $arg" ;;
|
|
6830 esac
|
|
6831 fi
|
|
6832 prev=
|
|
6833 continue
|
|
6834 ;;
|
|
6835 shrext)
|
|
6836 shrext_cmds=$arg
|
|
6837 prev=
|
|
6838 continue
|
|
6839 ;;
|
|
6840 weak)
|
|
6841 func_append weak_libs " $arg"
|
|
6842 prev=
|
|
6843 continue
|
|
6844 ;;
|
|
6845 xcclinker)
|
|
6846 func_append linker_flags " $qarg"
|
|
6847 func_append compiler_flags " $qarg"
|
|
6848 prev=
|
|
6849 func_append compile_command " $qarg"
|
|
6850 func_append finalize_command " $qarg"
|
|
6851 continue
|
|
6852 ;;
|
|
6853 xcompiler)
|
|
6854 func_append compiler_flags " $qarg"
|
|
6855 prev=
|
|
6856 func_append compile_command " $qarg"
|
|
6857 func_append finalize_command " $qarg"
|
|
6858 continue
|
|
6859 ;;
|
|
6860 xlinker)
|
|
6861 func_append linker_flags " $qarg"
|
|
6862 func_append compiler_flags " $wl$qarg"
|
|
6863 prev=
|
|
6864 func_append compile_command " $wl$qarg"
|
|
6865 func_append finalize_command " $wl$qarg"
|
|
6866 continue
|
|
6867 ;;
|
|
6868 *)
|
|
6869 eval "$prev=\"\$arg\""
|
|
6870 prev=
|
|
6871 continue
|
|
6872 ;;
|
|
6873 esac
|
|
6874 fi # test -n "$prev"
|
|
6875
|
|
6876 prevarg=$arg
|
|
6877
|
|
6878 case $arg in
|
|
6879 -all-static)
|
|
6880 if test -n "$link_static_flag"; then
|
|
6881 # See comment for -static flag below, for more details.
|
|
6882 func_append compile_command " $link_static_flag"
|
|
6883 func_append finalize_command " $link_static_flag"
|
|
6884 fi
|
|
6885 continue
|
|
6886 ;;
|
|
6887
|
|
6888 -allow-undefined)
|
|
6889 # FIXME: remove this flag sometime in the future.
|
|
6890 func_fatal_error "'-allow-undefined' must not be used because it is the default"
|
|
6891 ;;
|
|
6892
|
|
6893 -avoid-version)
|
|
6894 avoid_version=yes
|
|
6895 continue
|
|
6896 ;;
|
|
6897
|
|
6898 -bindir)
|
|
6899 prev=bindir
|
|
6900 continue
|
|
6901 ;;
|
|
6902
|
|
6903 -dlopen)
|
|
6904 prev=dlfiles
|
|
6905 continue
|
|
6906 ;;
|
|
6907
|
|
6908 -dlpreopen)
|
|
6909 prev=dlprefiles
|
|
6910 continue
|
|
6911 ;;
|
|
6912
|
|
6913 -export-dynamic)
|
|
6914 export_dynamic=yes
|
|
6915 continue
|
|
6916 ;;
|
|
6917
|
|
6918 -export-symbols | -export-symbols-regex)
|
|
6919 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
|
|
6920 func_fatal_error "more than one -exported-symbols argument is not allowed"
|
|
6921 fi
|
|
6922 if test X-export-symbols = "X$arg"; then
|
|
6923 prev=expsyms
|
|
6924 else
|
|
6925 prev=expsyms_regex
|
|
6926 fi
|
|
6927 continue
|
|
6928 ;;
|
|
6929
|
|
6930 -framework)
|
|
6931 prev=framework
|
|
6932 continue
|
|
6933 ;;
|
|
6934
|
|
6935 -inst-prefix-dir)
|
|
6936 prev=inst_prefix
|
|
6937 continue
|
|
6938 ;;
|
|
6939
|
|
6940 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
|
|
6941 # so, if we see these flags be careful not to treat them like -L
|
|
6942 -L[A-Z][A-Z]*:*)
|
|
6943 case $with_gcc/$host in
|
|
6944 no/*-*-irix* | /*-*-irix*)
|
|
6945 func_append compile_command " $arg"
|
|
6946 func_append finalize_command " $arg"
|
|
6947 ;;
|
|
6948 esac
|
|
6949 continue
|
|
6950 ;;
|
|
6951
|
|
6952 -L*)
|
|
6953 func_stripname "-L" '' "$arg"
|
|
6954 if test -z "$func_stripname_result"; then
|
|
6955 if test "$#" -gt 0; then
|
|
6956 func_fatal_error "require no space between '-L' and '$1'"
|
|
6957 else
|
|
6958 func_fatal_error "need path for '-L' option"
|
|
6959 fi
|
|
6960 fi
|
|
6961 func_resolve_sysroot "$func_stripname_result"
|
|
6962 dir=$func_resolve_sysroot_result
|
|
6963 # We need an absolute path.
|
|
6964 case $dir in
|
|
6965 [\\/]* | [A-Za-z]:[\\/]*) ;;
|
|
6966 *)
|
|
6967 absdir=`cd "$dir" && pwd`
|
|
6968 test -z "$absdir" && \
|
|
6969 func_fatal_error "cannot determine absolute directory name of '$dir'"
|
|
6970 dir=$absdir
|
|
6971 ;;
|
|
6972 esac
|
|
6973 case "$deplibs " in
|
|
6974 *" -L$dir "* | *" $arg "*)
|
|
6975 # Will only happen for absolute or sysroot arguments
|
|
6976 ;;
|
|
6977 *)
|
|
6978 # Preserve sysroot, but never include relative directories
|
|
6979 case $dir in
|
|
6980 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
|
|
6981 *) func_append deplibs " -L$dir" ;;
|
|
6982 esac
|
|
6983 func_append lib_search_path " $dir"
|
|
6984 ;;
|
|
6985 esac
|
|
6986 case $host in
|
|
6987 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
|
6988 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
|
|
6989 case :$dllsearchpath: in
|
|
6990 *":$dir:"*) ;;
|
|
6991 ::) dllsearchpath=$dir;;
|
|
6992 *) func_append dllsearchpath ":$dir";;
|
|
6993 esac
|
|
6994 case :$dllsearchpath: in
|
|
6995 *":$testbindir:"*) ;;
|
|
6996 ::) dllsearchpath=$testbindir;;
|
|
6997 *) func_append dllsearchpath ":$testbindir";;
|
|
6998 esac
|
|
6999 ;;
|
|
7000 esac
|
|
7001 continue
|
|
7002 ;;
|
|
7003
|
|
7004 -l*)
|
|
7005 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
|
|
7006 case $host in
|
|
7007 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
|
|
7008 # These systems don't actually have a C or math library (as such)
|
|
7009 continue
|
|
7010 ;;
|
|
7011 *-*-os2*)
|
|
7012 # These systems don't actually have a C library (as such)
|
|
7013 test X-lc = "X$arg" && continue
|
|
7014 ;;
|
|
7015 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
|
|
7016 # Do not include libc due to us having libc/libc_r.
|
|
7017 test X-lc = "X$arg" && continue
|
|
7018 ;;
|
|
7019 *-*-rhapsody* | *-*-darwin1.[012])
|
|
7020 # Rhapsody C and math libraries are in the System framework
|
|
7021 func_append deplibs " System.ltframework"
|
|
7022 continue
|
|
7023 ;;
|
|
7024 *-*-sco3.2v5* | *-*-sco5v6*)
|
|
7025 # Causes problems with __ctype
|
|
7026 test X-lc = "X$arg" && continue
|
|
7027 ;;
|
|
7028 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
|
|
7029 # Compiler inserts libc in the correct place for threads to work
|
|
7030 test X-lc = "X$arg" && continue
|
|
7031 ;;
|
|
7032 esac
|
|
7033 elif test X-lc_r = "X$arg"; then
|
|
7034 case $host in
|
|
7035 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
|
|
7036 # Do not include libc_r directly, use -pthread flag.
|
|
7037 continue
|
|
7038 ;;
|
|
7039 esac
|
|
7040 fi
|
|
7041 func_append deplibs " $arg"
|
|
7042 continue
|
|
7043 ;;
|
|
7044
|
|
7045 -mllvm)
|
|
7046 prev=mllvm
|
|
7047 continue
|
|
7048 ;;
|
|
7049
|
|
7050 -module)
|
|
7051 module=yes
|
|
7052 continue
|
|
7053 ;;
|
|
7054
|
|
7055 # Tru64 UNIX uses -model [arg] to determine the layout of C++
|
|
7056 # classes, name mangling, and exception handling.
|
|
7057 # Darwin uses the -arch flag to determine output architecture.
|
|
7058 -model|-arch|-isysroot|--sysroot)
|
|
7059 func_append compiler_flags " $arg"
|
|
7060 func_append compile_command " $arg"
|
|
7061 func_append finalize_command " $arg"
|
|
7062 prev=xcompiler
|
|
7063 continue
|
|
7064 ;;
|
|
7065
|
|
7066 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|
|
7067 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
|
|
7068 func_append compiler_flags " $arg"
|
|
7069 func_append compile_command " $arg"
|
|
7070 func_append finalize_command " $arg"
|
|
7071 case "$new_inherited_linker_flags " in
|
|
7072 *" $arg "*) ;;
|
|
7073 * ) func_append new_inherited_linker_flags " $arg" ;;
|
|
7074 esac
|
|
7075 continue
|
|
7076 ;;
|
|
7077
|
|
7078 -multi_module)
|
|
7079 single_module=$wl-multi_module
|
|
7080 continue
|
|
7081 ;;
|
|
7082
|
|
7083 -no-fast-install)
|
|
7084 fast_install=no
|
|
7085 continue
|
|
7086 ;;
|
|
7087
|
|
7088 -no-install)
|
|
7089 case $host in
|
|
7090 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
|
|
7091 # The PATH hackery in wrapper scripts is required on Windows
|
|
7092 # and Darwin in order for the loader to find any dlls it needs.
|
|
7093 func_warning "'-no-install' is ignored for $host"
|
|
7094 func_warning "assuming '-no-fast-install' instead"
|
|
7095 fast_install=no
|
|
7096 ;;
|
|
7097 *) no_install=yes ;;
|
|
7098 esac
|
|
7099 continue
|
|
7100 ;;
|
|
7101
|
|
7102 -no-undefined)
|
|
7103 allow_undefined=no
|
|
7104 continue
|
|
7105 ;;
|
|
7106
|
|
7107 -objectlist)
|
|
7108 prev=objectlist
|
|
7109 continue
|
|
7110 ;;
|
|
7111
|
|
7112 -os2dllname)
|
|
7113 prev=os2dllname
|
|
7114 continue
|
|
7115 ;;
|
|
7116
|
|
7117 -o) prev=output ;;
|
|
7118
|
|
7119 -precious-files-regex)
|
|
7120 prev=precious_regex
|
|
7121 continue
|
|
7122 ;;
|
|
7123
|
|
7124 -release)
|
|
7125 prev=release
|
|
7126 continue
|
|
7127 ;;
|
|
7128
|
|
7129 -rpath)
|
|
7130 prev=rpath
|
|
7131 continue
|
|
7132 ;;
|
|
7133
|
|
7134 -R)
|
|
7135 prev=xrpath
|
|
7136 continue
|
|
7137 ;;
|
|
7138
|
|
7139 -R*)
|
|
7140 func_stripname '-R' '' "$arg"
|
|
7141 dir=$func_stripname_result
|
|
7142 # We need an absolute path.
|
|
7143 case $dir in
|
|
7144 [\\/]* | [A-Za-z]:[\\/]*) ;;
|
|
7145 =*)
|
|
7146 func_stripname '=' '' "$dir"
|
|
7147 dir=$lt_sysroot$func_stripname_result
|
|
7148 ;;
|
|
7149 *)
|
|
7150 func_fatal_error "only absolute run-paths are allowed"
|
|
7151 ;;
|
|
7152 esac
|
|
7153 case "$xrpath " in
|
|
7154 *" $dir "*) ;;
|
|
7155 *) func_append xrpath " $dir" ;;
|
|
7156 esac
|
|
7157 continue
|
|
7158 ;;
|
|
7159
|
|
7160 -shared)
|
|
7161 # The effects of -shared are defined in a previous loop.
|
|
7162 continue
|
|
7163 ;;
|
|
7164
|
|
7165 -shrext)
|
|
7166 prev=shrext
|
|
7167 continue
|
|
7168 ;;
|
|
7169
|
|
7170 -static | -static-libtool-libs)
|
|
7171 # The effects of -static are defined in a previous loop.
|
|
7172 # We used to do the same as -all-static on platforms that
|
|
7173 # didn't have a PIC flag, but the assumption that the effects
|
|
7174 # would be equivalent was wrong. It would break on at least
|
|
7175 # Digital Unix and AIX.
|
|
7176 continue
|
|
7177 ;;
|
|
7178
|
|
7179 -thread-safe)
|
|
7180 thread_safe=yes
|
|
7181 continue
|
|
7182 ;;
|
|
7183
|
|
7184 -version-info)
|
|
7185 prev=vinfo
|
|
7186 continue
|
|
7187 ;;
|
|
7188
|
|
7189 -version-number)
|
|
7190 prev=vinfo
|
|
7191 vinfo_number=yes
|
|
7192 continue
|
|
7193 ;;
|
|
7194
|
|
7195 -weak)
|
|
7196 prev=weak
|
|
7197 continue
|
|
7198 ;;
|
|
7199
|
|
7200 -Wc,*)
|
|
7201 func_stripname '-Wc,' '' "$arg"
|
|
7202 args=$func_stripname_result
|
|
7203 arg=
|
|
7204 save_ifs=$IFS; IFS=,
|
|
7205 for flag in $args; do
|
|
7206 IFS=$save_ifs
|
|
7207 func_quote_for_eval "$flag"
|
|
7208 func_append arg " $func_quote_for_eval_result"
|
|
7209 func_append compiler_flags " $func_quote_for_eval_result"
|
|
7210 done
|
|
7211 IFS=$save_ifs
|
|
7212 func_stripname ' ' '' "$arg"
|
|
7213 arg=$func_stripname_result
|
|
7214 ;;
|
|
7215
|
|
7216 -Wl,*)
|
|
7217 func_stripname '-Wl,' '' "$arg"
|
|
7218 args=$func_stripname_result
|
|
7219 arg=
|
|
7220 save_ifs=$IFS; IFS=,
|
|
7221 for flag in $args; do
|
|
7222 IFS=$save_ifs
|
|
7223 func_quote_for_eval "$flag"
|
|
7224 func_append arg " $wl$func_quote_for_eval_result"
|
|
7225 func_append compiler_flags " $wl$func_quote_for_eval_result"
|
|
7226 func_append linker_flags " $func_quote_for_eval_result"
|
|
7227 done
|
|
7228 IFS=$save_ifs
|
|
7229 func_stripname ' ' '' "$arg"
|
|
7230 arg=$func_stripname_result
|
|
7231 ;;
|
|
7232
|
|
7233 -Xcompiler)
|
|
7234 prev=xcompiler
|
|
7235 continue
|
|
7236 ;;
|
|
7237
|
|
7238 -Xlinker)
|
|
7239 prev=xlinker
|
|
7240 continue
|
|
7241 ;;
|
|
7242
|
|
7243 -XCClinker)
|
|
7244 prev=xcclinker
|
|
7245 continue
|
|
7246 ;;
|
|
7247
|
|
7248 # -msg_* for osf cc
|
|
7249 -msg_*)
|
|
7250 func_quote_for_eval "$arg"
|
|
7251 arg=$func_quote_for_eval_result
|
|
7252 ;;
|
|
7253
|
|
7254 # Flags to be passed through unchanged, with rationale:
|
|
7255 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
|
|
7256 # -r[0-9][0-9]* specify processor for the SGI compiler
|
|
7257 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
|
|
7258 # +DA*, +DD* enable 64-bit mode for the HP compiler
|
|
7259 # -q* compiler args for the IBM compiler
|
|
7260 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
|
|
7261 # -F/path path to uninstalled frameworks, gcc on darwin
|
|
7262 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
|
|
7263 # -fstack-protector* stack protector flags for GCC
|
|
7264 # @file GCC response files
|
|
7265 # -tp=* Portland pgcc target processor selection
|
|
7266 # --sysroot=* for sysroot support
|
|
7267 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
|
|
7268 # -stdlib=* select c++ std lib with clang
|
|
7269 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
|
|
7270 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
|
|
7271 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
|
|
7272 func_quote_for_eval "$arg"
|
|
7273 arg=$func_quote_for_eval_result
|
|
7274 func_append compile_command " $arg"
|
|
7275 func_append finalize_command " $arg"
|
|
7276 func_append compiler_flags " $arg"
|
|
7277 continue
|
|
7278 ;;
|
|
7279
|
|
7280 -Z*)
|
|
7281 if test os2 = "`expr $host : '.*\(os2\)'`"; then
|
|
7282 # OS/2 uses -Zxxx to specify OS/2-specific options
|
|
7283 compiler_flags="$compiler_flags $arg"
|
|
7284 func_append compile_command " $arg"
|
|
7285 func_append finalize_command " $arg"
|
|
7286 case $arg in
|
|
7287 -Zlinker | -Zstack)
|
|
7288 prev=xcompiler
|
|
7289 ;;
|
|
7290 esac
|
|
7291 continue
|
|
7292 else
|
|
7293 # Otherwise treat like 'Some other compiler flag' below
|
|
7294 func_quote_for_eval "$arg"
|
|
7295 arg=$func_quote_for_eval_result
|
|
7296 fi
|
|
7297 ;;
|
|
7298
|
|
7299 # Some other compiler flag.
|
|
7300 -* | +*)
|
|
7301 func_quote_for_eval "$arg"
|
|
7302 arg=$func_quote_for_eval_result
|
|
7303 ;;
|
|
7304
|
|
7305 *.$objext)
|
|
7306 # A standard object.
|
|
7307 func_append objs " $arg"
|
|
7308 ;;
|
|
7309
|
|
7310 *.lo)
|
|
7311 # A libtool-controlled object.
|
|
7312
|
|
7313 # Check to see that this really is a libtool object.
|
|
7314 if func_lalib_unsafe_p "$arg"; then
|
|
7315 pic_object=
|
|
7316 non_pic_object=
|
|
7317
|
|
7318 # Read the .lo file
|
|
7319 func_source "$arg"
|
|
7320
|
|
7321 if test -z "$pic_object" ||
|
|
7322 test -z "$non_pic_object" ||
|
|
7323 test none = "$pic_object" &&
|
|
7324 test none = "$non_pic_object"; then
|
|
7325 func_fatal_error "cannot find name of object for '$arg'"
|
|
7326 fi
|
|
7327
|
|
7328 # Extract subdirectory from the argument.
|
|
7329 func_dirname "$arg" "/" ""
|
|
7330 xdir=$func_dirname_result
|
|
7331
|
|
7332 test none = "$pic_object" || {
|
|
7333 # Prepend the subdirectory the object is found in.
|
|
7334 pic_object=$xdir$pic_object
|
|
7335
|
|
7336 if test dlfiles = "$prev"; then
|
|
7337 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
|
|
7338 func_append dlfiles " $pic_object"
|
|
7339 prev=
|
|
7340 continue
|
|
7341 else
|
|
7342 # If libtool objects are unsupported, then we need to preload.
|
|
7343 prev=dlprefiles
|
|
7344 fi
|
|
7345 fi
|
|
7346
|
|
7347 # CHECK ME: I think I busted this. -Ossama
|
|
7348 if test dlprefiles = "$prev"; then
|
|
7349 # Preload the old-style object.
|
|
7350 func_append dlprefiles " $pic_object"
|
|
7351 prev=
|
|
7352 fi
|
|
7353
|
|
7354 # A PIC object.
|
|
7355 func_append libobjs " $pic_object"
|
|
7356 arg=$pic_object
|
|
7357 }
|
|
7358
|
|
7359 # Non-PIC object.
|
|
7360 if test none != "$non_pic_object"; then
|
|
7361 # Prepend the subdirectory the object is found in.
|
|
7362 non_pic_object=$xdir$non_pic_object
|
|
7363
|
|
7364 # A standard non-PIC object
|
|
7365 func_append non_pic_objects " $non_pic_object"
|
|
7366 if test -z "$pic_object" || test none = "$pic_object"; then
|
|
7367 arg=$non_pic_object
|
|
7368 fi
|
|
7369 else
|
|
7370 # If the PIC object exists, use it instead.
|
|
7371 # $xdir was prepended to $pic_object above.
|
|
7372 non_pic_object=$pic_object
|
|
7373 func_append non_pic_objects " $non_pic_object"
|
|
7374 fi
|
|
7375 else
|
|
7376 # Only an error if not doing a dry-run.
|
|
7377 if $opt_dry_run; then
|
|
7378 # Extract subdirectory from the argument.
|
|
7379 func_dirname "$arg" "/" ""
|
|
7380 xdir=$func_dirname_result
|
|
7381
|
|
7382 func_lo2o "$arg"
|
|
7383 pic_object=$xdir$objdir/$func_lo2o_result
|
|
7384 non_pic_object=$xdir$func_lo2o_result
|
|
7385 func_append libobjs " $pic_object"
|
|
7386 func_append non_pic_objects " $non_pic_object"
|
|
7387 else
|
|
7388 func_fatal_error "'$arg' is not a valid libtool object"
|
|
7389 fi
|
|
7390 fi
|
|
7391 ;;
|
|
7392
|
|
7393 *.$libext)
|
|
7394 # An archive.
|
|
7395 func_append deplibs " $arg"
|
|
7396 func_append old_deplibs " $arg"
|
|
7397 continue
|
|
7398 ;;
|
|
7399
|
|
7400 *.la)
|
|
7401 # A libtool-controlled library.
|
|
7402
|
|
7403 func_resolve_sysroot "$arg"
|
|
7404 if test dlfiles = "$prev"; then
|
|
7405 # This library was specified with -dlopen.
|
|
7406 func_append dlfiles " $func_resolve_sysroot_result"
|
|
7407 prev=
|
|
7408 elif test dlprefiles = "$prev"; then
|
|
7409 # The library was specified with -dlpreopen.
|
|
7410 func_append dlprefiles " $func_resolve_sysroot_result"
|
|
7411 prev=
|
|
7412 else
|
|
7413 func_append deplibs " $func_resolve_sysroot_result"
|
|
7414 fi
|
|
7415 continue
|
|
7416 ;;
|
|
7417
|
|
7418 # Some other compiler argument.
|
|
7419 *)
|
|
7420 # Unknown arguments in both finalize_command and compile_command need
|
|
7421 # to be aesthetically quoted because they are evaled later.
|
|
7422 func_quote_for_eval "$arg"
|
|
7423 arg=$func_quote_for_eval_result
|
|
7424 ;;
|
|
7425 esac # arg
|
|
7426
|
|
7427 # Now actually substitute the argument into the commands.
|
|
7428 if test -n "$arg"; then
|
|
7429 func_append compile_command " $arg"
|
|
7430 func_append finalize_command " $arg"
|
|
7431 fi
|
|
7432 done # argument parsing loop
|
|
7433
|
|
7434 test -n "$prev" && \
|
|
7435 func_fatal_help "the '$prevarg' option requires an argument"
|
|
7436
|
|
7437 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
|
|
7438 eval arg=\"$export_dynamic_flag_spec\"
|
|
7439 func_append compile_command " $arg"
|
|
7440 func_append finalize_command " $arg"
|
|
7441 fi
|
|
7442
|
|
7443 oldlibs=
|
|
7444 # calculate the name of the file, without its directory
|
|
7445 func_basename "$output"
|
|
7446 outputname=$func_basename_result
|
|
7447 libobjs_save=$libobjs
|
|
7448
|
|
7449 if test -n "$shlibpath_var"; then
|
|
7450 # get the directories listed in $shlibpath_var
|
|
7451 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
|
|
7452 else
|
|
7453 shlib_search_path=
|
|
7454 fi
|
|
7455 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
|
|
7456 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
|
|
7457
|
|
7458 # Definition is injected by LT_CONFIG during libtool generation.
|
|
7459 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
|
|
7460
|
|
7461 func_dirname "$output" "/" ""
|
|
7462 output_objdir=$func_dirname_result$objdir
|
|
7463 func_to_tool_file "$output_objdir/"
|
|
7464 tool_output_objdir=$func_to_tool_file_result
|
|
7465 # Create the object directory.
|
|
7466 func_mkdir_p "$output_objdir"
|
|
7467
|
|
7468 # Determine the type of output
|
|
7469 case $output in
|
|
7470 "")
|
|
7471 func_fatal_help "you must specify an output file"
|
|
7472 ;;
|
|
7473 *.$libext) linkmode=oldlib ;;
|
|
7474 *.lo | *.$objext) linkmode=obj ;;
|
|
7475 *.la) linkmode=lib ;;
|
|
7476 *) linkmode=prog ;; # Anything else should be a program.
|
|
7477 esac
|
|
7478
|
|
7479 specialdeplibs=
|
|
7480
|
|
7481 libs=
|
|
7482 # Find all interdependent deplibs by searching for libraries
|
|
7483 # that are linked more than once (e.g. -la -lb -la)
|
|
7484 for deplib in $deplibs; do
|
|
7485 if $opt_preserve_dup_deps; then
|
|
7486 case "$libs " in
|
|
7487 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
|
|
7488 esac
|
|
7489 fi
|
|
7490 func_append libs " $deplib"
|
|
7491 done
|
|
7492
|
|
7493 if test lib = "$linkmode"; then
|
|
7494 libs="$predeps $libs $compiler_lib_search_path $postdeps"
|
|
7495
|
|
7496 # Compute libraries that are listed more than once in $predeps
|
|
7497 # $postdeps and mark them as special (i.e., whose duplicates are
|
|
7498 # not to be eliminated).
|
|
7499 pre_post_deps=
|
|
7500 if $opt_duplicate_compiler_generated_deps; then
|
|
7501 for pre_post_dep in $predeps $postdeps; do
|
|
7502 case "$pre_post_deps " in
|
|
7503 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
|
|
7504 esac
|
|
7505 func_append pre_post_deps " $pre_post_dep"
|
|
7506 done
|
|
7507 fi
|
|
7508 pre_post_deps=
|
|
7509 fi
|
|
7510
|
|
7511 deplibs=
|
|
7512 newdependency_libs=
|
|
7513 newlib_search_path=
|
|
7514 need_relink=no # whether we're linking any uninstalled libtool libraries
|
|
7515 notinst_deplibs= # not-installed libtool libraries
|
|
7516 notinst_path= # paths that contain not-installed libtool libraries
|
|
7517
|
|
7518 case $linkmode in
|
|
7519 lib)
|
|
7520 passes="conv dlpreopen link"
|
|
7521 for file in $dlfiles $dlprefiles; do
|
|
7522 case $file in
|
|
7523 *.la) ;;
|
|
7524 *)
|
|
7525 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
|
|
7526 ;;
|
|
7527 esac
|
|
7528 done
|
|
7529 ;;
|
|
7530 prog)
|
|
7531 compile_deplibs=
|
|
7532 finalize_deplibs=
|
|
7533 alldeplibs=false
|
|
7534 newdlfiles=
|
|
7535 newdlprefiles=
|
|
7536 passes="conv scan dlopen dlpreopen link"
|
|
7537 ;;
|
|
7538 *) passes="conv"
|
|
7539 ;;
|
|
7540 esac
|
|
7541
|
|
7542 for pass in $passes; do
|
|
7543 # The preopen pass in lib mode reverses $deplibs; put it back here
|
|
7544 # so that -L comes before libs that need it for instance...
|
|
7545 if test lib,link = "$linkmode,$pass"; then
|
|
7546 ## FIXME: Find the place where the list is rebuilt in the wrong
|
|
7547 ## order, and fix it there properly
|
|
7548 tmp_deplibs=
|
|
7549 for deplib in $deplibs; do
|
|
7550 tmp_deplibs="$deplib $tmp_deplibs"
|
|
7551 done
|
|
7552 deplibs=$tmp_deplibs
|
|
7553 fi
|
|
7554
|
|
7555 if test lib,link = "$linkmode,$pass" ||
|
|
7556 test prog,scan = "$linkmode,$pass"; then
|
|
7557 libs=$deplibs
|
|
7558 deplibs=
|
|
7559 fi
|
|
7560 if test prog = "$linkmode"; then
|
|
7561 case $pass in
|
|
7562 dlopen) libs=$dlfiles ;;
|
|
7563 dlpreopen) libs=$dlprefiles ;;
|
|
7564 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
|
|
7565 esac
|
|
7566 fi
|
|
7567 if test lib,dlpreopen = "$linkmode,$pass"; then
|
|
7568 # Collect and forward deplibs of preopened libtool libs
|
|
7569 for lib in $dlprefiles; do
|
|
7570 # Ignore non-libtool-libs
|
|
7571 dependency_libs=
|
|
7572 func_resolve_sysroot "$lib"
|
|
7573 case $lib in
|
|
7574 *.la) func_source "$func_resolve_sysroot_result" ;;
|
|
7575 esac
|
|
7576
|
|
7577 # Collect preopened libtool deplibs, except any this library
|
|
7578 # has declared as weak libs
|
|
7579 for deplib in $dependency_libs; do
|
|
7580 func_basename "$deplib"
|
|
7581 deplib_base=$func_basename_result
|
|
7582 case " $weak_libs " in
|
|
7583 *" $deplib_base "*) ;;
|
|
7584 *) func_append deplibs " $deplib" ;;
|
|
7585 esac
|
|
7586 done
|
|
7587 done
|
|
7588 libs=$dlprefiles
|
|
7589 fi
|
|
7590 if test dlopen = "$pass"; then
|
|
7591 # Collect dlpreopened libraries
|
|
7592 save_deplibs=$deplibs
|
|
7593 deplibs=
|
|
7594 fi
|
|
7595
|
|
7596 for deplib in $libs; do
|
|
7597 lib=
|
|
7598 found=false
|
|
7599 case $deplib in
|
|
7600 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|
|
7601 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
|
|
7602 if test prog,link = "$linkmode,$pass"; then
|
|
7603 compile_deplibs="$deplib $compile_deplibs"
|
|
7604 finalize_deplibs="$deplib $finalize_deplibs"
|
|
7605 else
|
|
7606 func_append compiler_flags " $deplib"
|
|
7607 if test lib = "$linkmode"; then
|
|
7608 case "$new_inherited_linker_flags " in
|
|
7609 *" $deplib "*) ;;
|
|
7610 * ) func_append new_inherited_linker_flags " $deplib" ;;
|
|
7611 esac
|
|
7612 fi
|
|
7613 fi
|
|
7614 continue
|
|
7615 ;;
|
|
7616 -l*)
|
|
7617 if test lib != "$linkmode" && test prog != "$linkmode"; then
|
|
7618 func_warning "'-l' is ignored for archives/objects"
|
|
7619 continue
|
|
7620 fi
|
|
7621 func_stripname '-l' '' "$deplib"
|
|
7622 name=$func_stripname_result
|
|
7623 if test lib = "$linkmode"; then
|
|
7624 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
|
|
7625 else
|
|
7626 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
|
|
7627 fi
|
|
7628 for searchdir in $searchdirs; do
|
|
7629 for search_ext in .la $std_shrext .so .a; do
|
|
7630 # Search the libtool library
|
|
7631 lib=$searchdir/lib$name$search_ext
|
|
7632 if test -f "$lib"; then
|
|
7633 if test .la = "$search_ext"; then
|
|
7634 found=:
|
|
7635 else
|
|
7636 found=false
|
|
7637 fi
|
|
7638 break 2
|
|
7639 fi
|
|
7640 done
|
|
7641 done
|
|
7642 if $found; then
|
|
7643 # deplib is a libtool library
|
|
7644 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
|
|
7645 # We need to do some special things here, and not later.
|
|
7646 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
|
|
7647 case " $predeps $postdeps " in
|
|
7648 *" $deplib "*)
|
|
7649 if func_lalib_p "$lib"; then
|
|
7650 library_names=
|
|
7651 old_library=
|
|
7652 func_source "$lib"
|
|
7653 for l in $old_library $library_names; do
|
|
7654 ll=$l
|
|
7655 done
|
|
7656 if test "X$ll" = "X$old_library"; then # only static version available
|
|
7657 found=false
|
|
7658 func_dirname "$lib" "" "."
|
|
7659 ladir=$func_dirname_result
|
|
7660 lib=$ladir/$old_library
|
|
7661 if test prog,link = "$linkmode,$pass"; then
|
|
7662 compile_deplibs="$deplib $compile_deplibs"
|
|
7663 finalize_deplibs="$deplib $finalize_deplibs"
|
|
7664 else
|
|
7665 deplibs="$deplib $deplibs"
|
|
7666 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
|
|
7667 fi
|
|
7668 continue
|
|
7669 fi
|
|
7670 fi
|
|
7671 ;;
|
|
7672 *) ;;
|
|
7673 esac
|
|
7674 fi
|
|
7675 else
|
|
7676 # deplib doesn't seem to be a libtool library
|
|
7677 if test prog,link = "$linkmode,$pass"; then
|
|
7678 compile_deplibs="$deplib $compile_deplibs"
|
|
7679 finalize_deplibs="$deplib $finalize_deplibs"
|
|
7680 else
|
|
7681 deplibs="$deplib $deplibs"
|
|
7682 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
|
|
7683 fi
|
|
7684 continue
|
|
7685 fi
|
|
7686 ;; # -l
|
|
7687 *.ltframework)
|
|
7688 if test prog,link = "$linkmode,$pass"; then
|
|
7689 compile_deplibs="$deplib $compile_deplibs"
|
|
7690 finalize_deplibs="$deplib $finalize_deplibs"
|
|
7691 else
|
|
7692 deplibs="$deplib $deplibs"
|
|
7693 if test lib = "$linkmode"; then
|
|
7694 case "$new_inherited_linker_flags " in
|
|
7695 *" $deplib "*) ;;
|
|
7696 * ) func_append new_inherited_linker_flags " $deplib" ;;
|
|
7697 esac
|
|
7698 fi
|
|
7699 fi
|
|
7700 continue
|
|
7701 ;;
|
|
7702 -L*)
|
|
7703 case $linkmode in
|
|
7704 lib)
|
|
7705 deplibs="$deplib $deplibs"
|
|
7706 test conv = "$pass" && continue
|
|
7707 newdependency_libs="$deplib $newdependency_libs"
|
|
7708 func_stripname '-L' '' "$deplib"
|
|
7709 func_resolve_sysroot "$func_stripname_result"
|
|
7710 func_append newlib_search_path " $func_resolve_sysroot_result"
|
|
7711 ;;
|
|
7712 prog)
|
|
7713 if test conv = "$pass"; then
|
|
7714 deplibs="$deplib $deplibs"
|
|
7715 continue
|
|
7716 fi
|
|
7717 if test scan = "$pass"; then
|
|
7718 deplibs="$deplib $deplibs"
|
|
7719 else
|
|
7720 compile_deplibs="$deplib $compile_deplibs"
|
|
7721 finalize_deplibs="$deplib $finalize_deplibs"
|
|
7722 fi
|
|
7723 func_stripname '-L' '' "$deplib"
|
|
7724 func_resolve_sysroot "$func_stripname_result"
|
|
7725 func_append newlib_search_path " $func_resolve_sysroot_result"
|
|
7726 ;;
|
|
7727 *)
|
|
7728 func_warning "'-L' is ignored for archives/objects"
|
|
7729 ;;
|
|
7730 esac # linkmode
|
|
7731 continue
|
|
7732 ;; # -L
|
|
7733 -R*)
|
|
7734 if test link = "$pass"; then
|
|
7735 func_stripname '-R' '' "$deplib"
|
|
7736 func_resolve_sysroot "$func_stripname_result"
|
|
7737 dir=$func_resolve_sysroot_result
|
|
7738 # Make sure the xrpath contains only unique directories.
|
|
7739 case "$xrpath " in
|
|
7740 *" $dir "*) ;;
|
|
7741 *) func_append xrpath " $dir" ;;
|
|
7742 esac
|
|
7743 fi
|
|
7744 deplibs="$deplib $deplibs"
|
|
7745 continue
|
|
7746 ;;
|
|
7747 *.la)
|
|
7748 func_resolve_sysroot "$deplib"
|
|
7749 lib=$func_resolve_sysroot_result
|
|
7750 ;;
|
|
7751 *.$libext)
|
|
7752 if test conv = "$pass"; then
|
|
7753 deplibs="$deplib $deplibs"
|
|
7754 continue
|
|
7755 fi
|
|
7756 case $linkmode in
|
|
7757 lib)
|
|
7758 # Linking convenience modules into shared libraries is allowed,
|
|
7759 # but linking other static libraries is non-portable.
|
|
7760 case " $dlpreconveniencelibs " in
|
|
7761 *" $deplib "*) ;;
|
|
7762 *)
|
|
7763 valid_a_lib=false
|
|
7764 case $deplibs_check_method in
|
|
7765 match_pattern*)
|
|
7766 set dummy $deplibs_check_method; shift
|
|
7767 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
|
|
7768 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
|
|
7769 | $EGREP "$match_pattern_regex" > /dev/null; then
|
|
7770 valid_a_lib=:
|
|
7771 fi
|
|
7772 ;;
|
|
7773 pass_all)
|
|
7774 valid_a_lib=:
|
|
7775 ;;
|
|
7776 esac
|
|
7777 if $valid_a_lib; then
|
|
7778 echo
|
|
7779 $ECHO "*** Warning: Linking the shared library $output against the"
|
|
7780 $ECHO "*** static library $deplib is not portable!"
|
|
7781 deplibs="$deplib $deplibs"
|
|
7782 else
|
|
7783 echo
|
|
7784 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
|
|
7785 echo "*** I have the capability to make that library automatically link in when"
|
|
7786 echo "*** you link to this library. But I can only do this if you have a"
|
|
7787 echo "*** shared version of the library, which you do not appear to have"
|
|
7788 echo "*** because the file extensions .$libext of this argument makes me believe"
|
|
7789 echo "*** that it is just a static archive that I should not use here."
|
|
7790 fi
|
|
7791 ;;
|
|
7792 esac
|
|
7793 continue
|
|
7794 ;;
|
|
7795 prog)
|
|
7796 if test link != "$pass"; then
|
|
7797 deplibs="$deplib $deplibs"
|
|
7798 else
|
|
7799 compile_deplibs="$deplib $compile_deplibs"
|
|
7800 finalize_deplibs="$deplib $finalize_deplibs"
|
|
7801 fi
|
|
7802 continue
|
|
7803 ;;
|
|
7804 esac # linkmode
|
|
7805 ;; # *.$libext
|
|
7806 *.lo | *.$objext)
|
|
7807 if test conv = "$pass"; then
|
|
7808 deplibs="$deplib $deplibs"
|
|
7809 elif test prog = "$linkmode"; then
|
|
7810 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
|
|
7811 # If there is no dlopen support or we're linking statically,
|
|
7812 # we need to preload.
|
|
7813 func_append newdlprefiles " $deplib"
|
|
7814 compile_deplibs="$deplib $compile_deplibs"
|
|
7815 finalize_deplibs="$deplib $finalize_deplibs"
|
|
7816 else
|
|
7817 func_append newdlfiles " $deplib"
|
|
7818 fi
|
|
7819 fi
|
|
7820 continue
|
|
7821 ;;
|
|
7822 %DEPLIBS%)
|
|
7823 alldeplibs=:
|
|
7824 continue
|
|
7825 ;;
|
|
7826 esac # case $deplib
|
|
7827
|
|
7828 $found || test -f "$lib" \
|
|
7829 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
|
|
7830
|
|
7831 # Check to see that this really is a libtool archive.
|
|
7832 func_lalib_unsafe_p "$lib" \
|
|
7833 || func_fatal_error "'$lib' is not a valid libtool archive"
|
|
7834
|
|
7835 func_dirname "$lib" "" "."
|
|
7836 ladir=$func_dirname_result
|
|
7837
|
|
7838 dlname=
|
|
7839 dlopen=
|
|
7840 dlpreopen=
|
|
7841 libdir=
|
|
7842 library_names=
|
|
7843 old_library=
|
|
7844 inherited_linker_flags=
|
|
7845 # If the library was installed with an old release of libtool,
|
|
7846 # it will not redefine variables installed, or shouldnotlink
|
|
7847 installed=yes
|
|
7848 shouldnotlink=no
|
|
7849 avoidtemprpath=
|
|
7850
|
|
7851
|
|
7852 # Read the .la file
|
|
7853 func_source "$lib"
|
|
7854
|
|
7855 # Convert "-framework foo" to "foo.ltframework"
|
|
7856 if test -n "$inherited_linker_flags"; then
|
|
7857 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
|
|
7858 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
|
|
7859 case " $new_inherited_linker_flags " in
|
|
7860 *" $tmp_inherited_linker_flag "*) ;;
|
|
7861 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
|
|
7862 esac
|
|
7863 done
|
|
7864 fi
|
|
7865 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
|
7866 if test lib,link = "$linkmode,$pass" ||
|
|
7867 test prog,scan = "$linkmode,$pass" ||
|
|
7868 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
|
|
7869 test -n "$dlopen" && func_append dlfiles " $dlopen"
|
|
7870 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
|
|
7871 fi
|
|
7872
|
|
7873 if test conv = "$pass"; then
|
|
7874 # Only check for convenience libraries
|
|
7875 deplibs="$lib $deplibs"
|
|
7876 if test -z "$libdir"; then
|
|
7877 if test -z "$old_library"; then
|
|
7878 func_fatal_error "cannot find name of link library for '$lib'"
|
|
7879 fi
|
|
7880 # It is a libtool convenience library, so add in its objects.
|
|
7881 func_append convenience " $ladir/$objdir/$old_library"
|
|
7882 func_append old_convenience " $ladir/$objdir/$old_library"
|
|
7883 elif test prog != "$linkmode" && test lib != "$linkmode"; then
|
|
7884 func_fatal_error "'$lib' is not a convenience library"
|
|
7885 fi
|
|
7886 tmp_libs=
|
|
7887 for deplib in $dependency_libs; do
|
|
7888 deplibs="$deplib $deplibs"
|
|
7889 if $opt_preserve_dup_deps; then
|
|
7890 case "$tmp_libs " in
|
|
7891 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
|
|
7892 esac
|
|
7893 fi
|
|
7894 func_append tmp_libs " $deplib"
|
|
7895 done
|
|
7896 continue
|
|
7897 fi # $pass = conv
|
|
7898
|
|
7899
|
|
7900 # Get the name of the library we link against.
|
|
7901 linklib=
|
|
7902 if test -n "$old_library" &&
|
|
7903 { test yes = "$prefer_static_libs" ||
|
|
7904 test built,no = "$prefer_static_libs,$installed"; }; then
|
|
7905 linklib=$old_library
|
|
7906 else
|
|
7907 for l in $old_library $library_names; do
|
|
7908 linklib=$l
|
|
7909 done
|
|
7910 fi
|
|
7911 if test -z "$linklib"; then
|
|
7912 func_fatal_error "cannot find name of link library for '$lib'"
|
|
7913 fi
|
|
7914
|
|
7915 # This library was specified with -dlopen.
|
|
7916 if test dlopen = "$pass"; then
|
|
7917 test -z "$libdir" \
|
|
7918 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
|
|
7919 if test -z "$dlname" ||
|
|
7920 test yes != "$dlopen_support" ||
|
|
7921 test no = "$build_libtool_libs"
|
|
7922 then
|
|
7923 # If there is no dlname, no dlopen support or we're linking
|
|
7924 # statically, we need to preload. We also need to preload any
|
|
7925 # dependent libraries so libltdl's deplib preloader doesn't
|
|
7926 # bomb out in the load deplibs phase.
|
|
7927 func_append dlprefiles " $lib $dependency_libs"
|
|
7928 else
|
|
7929 func_append newdlfiles " $lib"
|
|
7930 fi
|
|
7931 continue
|
|
7932 fi # $pass = dlopen
|
|
7933
|
|
7934 # We need an absolute path.
|
|
7935 case $ladir in
|
|
7936 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
|
|
7937 *)
|
|
7938 abs_ladir=`cd "$ladir" && pwd`
|
|
7939 if test -z "$abs_ladir"; then
|
|
7940 func_warning "cannot determine absolute directory name of '$ladir'"
|
|
7941 func_warning "passing it literally to the linker, although it might fail"
|
|
7942 abs_ladir=$ladir
|
|
7943 fi
|
|
7944 ;;
|
|
7945 esac
|
|
7946 func_basename "$lib"
|
|
7947 laname=$func_basename_result
|
|
7948
|
|
7949 # Find the relevant object directory and library name.
|
|
7950 if test yes = "$installed"; then
|
|
7951 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
|
|
7952 func_warning "library '$lib' was moved."
|
|
7953 dir=$ladir
|
|
7954 absdir=$abs_ladir
|
|
7955 libdir=$abs_ladir
|
|
7956 else
|
|
7957 dir=$lt_sysroot$libdir
|
|
7958 absdir=$lt_sysroot$libdir
|
|
7959 fi
|
|
7960 test yes = "$hardcode_automatic" && avoidtemprpath=yes
|
|
7961 else
|
|
7962 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
|
|
7963 dir=$ladir
|
|
7964 absdir=$abs_ladir
|
|
7965 # Remove this search path later
|
|
7966 func_append notinst_path " $abs_ladir"
|
|
7967 else
|
|
7968 dir=$ladir/$objdir
|
|
7969 absdir=$abs_ladir/$objdir
|
|
7970 # Remove this search path later
|
|
7971 func_append notinst_path " $abs_ladir"
|
|
7972 fi
|
|
7973 fi # $installed = yes
|
|
7974 func_stripname 'lib' '.la' "$laname"
|
|
7975 name=$func_stripname_result
|
|
7976
|
|
7977 # This library was specified with -dlpreopen.
|
|
7978 if test dlpreopen = "$pass"; then
|
|
7979 if test -z "$libdir" && test prog = "$linkmode"; then
|
|
7980 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
|
|
7981 fi
|
|
7982 case $host in
|
|
7983 # special handling for platforms with PE-DLLs.
|
|
7984 *cygwin* | *mingw* | *cegcc* )
|
|
7985 # Linker will automatically link against shared library if both
|
|
7986 # static and shared are present. Therefore, ensure we extract
|
|
7987 # symbols from the import library if a shared library is present
|
|
7988 # (otherwise, the dlopen module name will be incorrect). We do
|
|
7989 # this by putting the import library name into $newdlprefiles.
|
|
7990 # We recover the dlopen module name by 'saving' the la file
|
|
7991 # name in a special purpose variable, and (later) extracting the
|
|
7992 # dlname from the la file.
|
|
7993 if test -n "$dlname"; then
|
|
7994 func_tr_sh "$dir/$linklib"
|
|
7995 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
|
|
7996 func_append newdlprefiles " $dir/$linklib"
|
|
7997 else
|
|
7998 func_append newdlprefiles " $dir/$old_library"
|
|
7999 # Keep a list of preopened convenience libraries to check
|
|
8000 # that they are being used correctly in the link pass.
|
|
8001 test -z "$libdir" && \
|
|
8002 func_append dlpreconveniencelibs " $dir/$old_library"
|
|
8003 fi
|
|
8004 ;;
|
|
8005 * )
|
|
8006 # Prefer using a static library (so that no silly _DYNAMIC symbols
|
|
8007 # are required to link).
|
|
8008 if test -n "$old_library"; then
|
|
8009 func_append newdlprefiles " $dir/$old_library"
|
|
8010 # Keep a list of preopened convenience libraries to check
|
|
8011 # that they are being used correctly in the link pass.
|
|
8012 test -z "$libdir" && \
|
|
8013 func_append dlpreconveniencelibs " $dir/$old_library"
|
|
8014 # Otherwise, use the dlname, so that lt_dlopen finds it.
|
|
8015 elif test -n "$dlname"; then
|
|
8016 func_append newdlprefiles " $dir/$dlname"
|
|
8017 else
|
|
8018 func_append newdlprefiles " $dir/$linklib"
|
|
8019 fi
|
|
8020 ;;
|
|
8021 esac
|
|
8022 fi # $pass = dlpreopen
|
|
8023
|
|
8024 if test -z "$libdir"; then
|
|
8025 # Link the convenience library
|
|
8026 if test lib = "$linkmode"; then
|
|
8027 deplibs="$dir/$old_library $deplibs"
|
|
8028 elif test prog,link = "$linkmode,$pass"; then
|
|
8029 compile_deplibs="$dir/$old_library $compile_deplibs"
|
|
8030 finalize_deplibs="$dir/$old_library $finalize_deplibs"
|
|
8031 else
|
|
8032 deplibs="$lib $deplibs" # used for prog,scan pass
|
|
8033 fi
|
|
8034 continue
|
|
8035 fi
|
|
8036
|
|
8037
|
|
8038 if test prog = "$linkmode" && test link != "$pass"; then
|
|
8039 func_append newlib_search_path " $ladir"
|
|
8040 deplibs="$lib $deplibs"
|
|
8041
|
|
8042 linkalldeplibs=false
|
|
8043 if test no != "$link_all_deplibs" || test -z "$library_names" ||
|
|
8044 test no = "$build_libtool_libs"; then
|
|
8045 linkalldeplibs=:
|
|
8046 fi
|
|
8047
|
|
8048 tmp_libs=
|
|
8049 for deplib in $dependency_libs; do
|
|
8050 case $deplib in
|
|
8051 -L*) func_stripname '-L' '' "$deplib"
|
|
8052 func_resolve_sysroot "$func_stripname_result"
|
|
8053 func_append newlib_search_path " $func_resolve_sysroot_result"
|
|
8054 ;;
|
|
8055 esac
|
|
8056 # Need to link against all dependency_libs?
|
|
8057 if $linkalldeplibs; then
|
|
8058 deplibs="$deplib $deplibs"
|
|
8059 else
|
|
8060 # Need to hardcode shared library paths
|
|
8061 # or/and link against static libraries
|
|
8062 newdependency_libs="$deplib $newdependency_libs"
|
|
8063 fi
|
|
8064 if $opt_preserve_dup_deps; then
|
|
8065 case "$tmp_libs " in
|
|
8066 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
|
|
8067 esac
|
|
8068 fi
|
|
8069 func_append tmp_libs " $deplib"
|
|
8070 done # for deplib
|
|
8071 continue
|
|
8072 fi # $linkmode = prog...
|
|
8073
|
|
8074 if test prog,link = "$linkmode,$pass"; then
|
|
8075 if test -n "$library_names" &&
|
|
8076 { { test no = "$prefer_static_libs" ||
|
|
8077 test built,yes = "$prefer_static_libs,$installed"; } ||
|
|
8078 test -z "$old_library"; }; then
|
|
8079 # We need to hardcode the library path
|
|
8080 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
|
|
8081 # Make sure the rpath contains only unique directories.
|
|
8082 case $temp_rpath: in
|
|
8083 *"$absdir:"*) ;;
|
|
8084 *) func_append temp_rpath "$absdir:" ;;
|
|
8085 esac
|
|
8086 fi
|
|
8087
|
|
8088 # Hardcode the library path.
|
|
8089 # Skip directories that are in the system default run-time
|
|
8090 # search path.
|
|
8091 case " $sys_lib_dlsearch_path " in
|
|
8092 *" $absdir "*) ;;
|
|
8093 *)
|
|
8094 case "$compile_rpath " in
|
|
8095 *" $absdir "*) ;;
|
|
8096 *) func_append compile_rpath " $absdir" ;;
|
|
8097 esac
|
|
8098 ;;
|
|
8099 esac
|
|
8100 case " $sys_lib_dlsearch_path " in
|
|
8101 *" $libdir "*) ;;
|
|
8102 *)
|
|
8103 case "$finalize_rpath " in
|
|
8104 *" $libdir "*) ;;
|
|
8105 *) func_append finalize_rpath " $libdir" ;;
|
|
8106 esac
|
|
8107 ;;
|
|
8108 esac
|
|
8109 fi # $linkmode,$pass = prog,link...
|
|
8110
|
|
8111 if $alldeplibs &&
|
|
8112 { test pass_all = "$deplibs_check_method" ||
|
|
8113 { test yes = "$build_libtool_libs" &&
|
|
8114 test -n "$library_names"; }; }; then
|
|
8115 # We only need to search for static libraries
|
|
8116 continue
|
|
8117 fi
|
|
8118 fi
|
|
8119
|
|
8120 link_static=no # Whether the deplib will be linked statically
|
|
8121 use_static_libs=$prefer_static_libs
|
|
8122 if test built = "$use_static_libs" && test yes = "$installed"; then
|
|
8123 use_static_libs=no
|
|
8124 fi
|
|
8125 if test -n "$library_names" &&
|
|
8126 { test no = "$use_static_libs" || test -z "$old_library"; }; then
|
|
8127 case $host in
|
|
8128 *cygwin* | *mingw* | *cegcc* | *os2*)
|
|
8129 # No point in relinking DLLs because paths are not encoded
|
|
8130 func_append notinst_deplibs " $lib"
|
|
8131 need_relink=no
|
|
8132 ;;
|
|
8133 *)
|
|
8134 if test no = "$installed"; then
|
|
8135 func_append notinst_deplibs " $lib"
|
|
8136 need_relink=yes
|
|
8137 fi
|
|
8138 ;;
|
|
8139 esac
|
|
8140 # This is a shared library
|
|
8141
|
|
8142 # Warn about portability, can't link against -module's on some
|
|
8143 # systems (darwin). Don't bleat about dlopened modules though!
|
|
8144 dlopenmodule=
|
|
8145 for dlpremoduletest in $dlprefiles; do
|
|
8146 if test "X$dlpremoduletest" = "X$lib"; then
|
|
8147 dlopenmodule=$dlpremoduletest
|
|
8148 break
|
|
8149 fi
|
|
8150 done
|
|
8151 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
|
|
8152 echo
|
|
8153 if test prog = "$linkmode"; then
|
|
8154 $ECHO "*** Warning: Linking the executable $output against the loadable module"
|
|
8155 else
|
|
8156 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
|
|
8157 fi
|
|
8158 $ECHO "*** $linklib is not portable!"
|
|
8159 fi
|
|
8160 if test lib = "$linkmode" &&
|
|
8161 test yes = "$hardcode_into_libs"; then
|
|
8162 # Hardcode the library path.
|
|
8163 # Skip directories that are in the system default run-time
|
|
8164 # search path.
|
|
8165 case " $sys_lib_dlsearch_path " in
|
|
8166 *" $absdir "*) ;;
|
|
8167 *)
|
|
8168 case "$compile_rpath " in
|
|
8169 *" $absdir "*) ;;
|
|
8170 *) func_append compile_rpath " $absdir" ;;
|
|
8171 esac
|
|
8172 ;;
|
|
8173 esac
|
|
8174 case " $sys_lib_dlsearch_path " in
|
|
8175 *" $libdir "*) ;;
|
|
8176 *)
|
|
8177 case "$finalize_rpath " in
|
|
8178 *" $libdir "*) ;;
|
|
8179 *) func_append finalize_rpath " $libdir" ;;
|
|
8180 esac
|
|
8181 ;;
|
|
8182 esac
|
|
8183 fi
|
|
8184
|
|
8185 if test -n "$old_archive_from_expsyms_cmds"; then
|
|
8186 # figure out the soname
|
|
8187 set dummy $library_names
|
|
8188 shift
|
|
8189 realname=$1
|
|
8190 shift
|
|
8191 libname=`eval "\\$ECHO \"$libname_spec\""`
|
|
8192 # use dlname if we got it. it's perfectly good, no?
|
|
8193 if test -n "$dlname"; then
|
|
8194 soname=$dlname
|
|
8195 elif test -n "$soname_spec"; then
|
|
8196 # bleh windows
|
|
8197 case $host in
|
|
8198 *cygwin* | mingw* | *cegcc* | *os2*)
|
|
8199 func_arith $current - $age
|
|
8200 major=$func_arith_result
|
|
8201 versuffix=-$major
|
|
8202 ;;
|
|
8203 esac
|
|
8204 eval soname=\"$soname_spec\"
|
|
8205 else
|
|
8206 soname=$realname
|
|
8207 fi
|
|
8208
|
|
8209 # Make a new name for the extract_expsyms_cmds to use
|
|
8210 soroot=$soname
|
|
8211 func_basename "$soroot"
|
|
8212 soname=$func_basename_result
|
|
8213 func_stripname 'lib' '.dll' "$soname"
|
|
8214 newlib=libimp-$func_stripname_result.a
|
|
8215
|
|
8216 # If the library has no export list, then create one now
|
|
8217 if test -f "$output_objdir/$soname-def"; then :
|
|
8218 else
|
|
8219 func_verbose "extracting exported symbol list from '$soname'"
|
|
8220 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
|
|
8221 fi
|
|
8222
|
|
8223 # Create $newlib
|
|
8224 if test -f "$output_objdir/$newlib"; then :; else
|
|
8225 func_verbose "generating import library for '$soname'"
|
|
8226 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
|
|
8227 fi
|
|
8228 # make sure the library variables are pointing to the new library
|
|
8229 dir=$output_objdir
|
|
8230 linklib=$newlib
|
|
8231 fi # test -n "$old_archive_from_expsyms_cmds"
|
|
8232
|
|
8233 if test prog = "$linkmode" || test relink != "$opt_mode"; then
|
|
8234 add_shlibpath=
|
|
8235 add_dir=
|
|
8236 add=
|
|
8237 lib_linked=yes
|
|
8238 case $hardcode_action in
|
|
8239 immediate | unsupported)
|
|
8240 if test no = "$hardcode_direct"; then
|
|
8241 add=$dir/$linklib
|
|
8242 case $host in
|
|
8243 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
|
|
8244 *-*-sysv4*uw2*) add_dir=-L$dir ;;
|
|
8245 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
|
|
8246 *-*-unixware7*) add_dir=-L$dir ;;
|
|
8247 *-*-darwin* )
|
|
8248 # if the lib is a (non-dlopened) module then we cannot
|
|
8249 # link against it, someone is ignoring the earlier warnings
|
|
8250 if /usr/bin/file -L $add 2> /dev/null |
|
|
8251 $GREP ": [^:]* bundle" >/dev/null; then
|
|
8252 if test "X$dlopenmodule" != "X$lib"; then
|
|
8253 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
|
|
8254 if test -z "$old_library"; then
|
|
8255 echo
|
|
8256 echo "*** And there doesn't seem to be a static archive available"
|
|
8257 echo "*** The link will probably fail, sorry"
|
|
8258 else
|
|
8259 add=$dir/$old_library
|
|
8260 fi
|
|
8261 elif test -n "$old_library"; then
|
|
8262 add=$dir/$old_library
|
|
8263 fi
|
|
8264 fi
|
|
8265 esac
|
|
8266 elif test no = "$hardcode_minus_L"; then
|
|
8267 case $host in
|
|
8268 *-*-sunos*) add_shlibpath=$dir ;;
|
|
8269 esac
|
|
8270 add_dir=-L$dir
|
|
8271 add=-l$name
|
|
8272 elif test no = "$hardcode_shlibpath_var"; then
|
|
8273 add_shlibpath=$dir
|
|
8274 add=-l$name
|
|
8275 else
|
|
8276 lib_linked=no
|
|
8277 fi
|
|
8278 ;;
|
|
8279 relink)
|
|
8280 if test yes = "$hardcode_direct" &&
|
|
8281 test no = "$hardcode_direct_absolute"; then
|
|
8282 add=$dir/$linklib
|
|
8283 elif test yes = "$hardcode_minus_L"; then
|
|
8284 add_dir=-L$absdir
|
|
8285 # Try looking first in the location we're being installed to.
|
|
8286 if test -n "$inst_prefix_dir"; then
|
|
8287 case $libdir in
|
|
8288 [\\/]*)
|
|
8289 func_append add_dir " -L$inst_prefix_dir$libdir"
|
|
8290 ;;
|
|
8291 esac
|
|
8292 fi
|
|
8293 add=-l$name
|
|
8294 elif test yes = "$hardcode_shlibpath_var"; then
|
|
8295 add_shlibpath=$dir
|
|
8296 add=-l$name
|
|
8297 else
|
|
8298 lib_linked=no
|
|
8299 fi
|
|
8300 ;;
|
|
8301 *) lib_linked=no ;;
|
|
8302 esac
|
|
8303
|
|
8304 if test yes != "$lib_linked"; then
|
|
8305 func_fatal_configuration "unsupported hardcode properties"
|
|
8306 fi
|
|
8307
|
|
8308 if test -n "$add_shlibpath"; then
|
|
8309 case :$compile_shlibpath: in
|
|
8310 *":$add_shlibpath:"*) ;;
|
|
8311 *) func_append compile_shlibpath "$add_shlibpath:" ;;
|
|
8312 esac
|
|
8313 fi
|
|
8314 if test prog = "$linkmode"; then
|
|
8315 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
|
|
8316 test -n "$add" && compile_deplibs="$add $compile_deplibs"
|
|
8317 else
|
|
8318 test -n "$add_dir" && deplibs="$add_dir $deplibs"
|
|
8319 test -n "$add" && deplibs="$add $deplibs"
|
|
8320 if test yes != "$hardcode_direct" &&
|
|
8321 test yes != "$hardcode_minus_L" &&
|
|
8322 test yes = "$hardcode_shlibpath_var"; then
|
|
8323 case :$finalize_shlibpath: in
|
|
8324 *":$libdir:"*) ;;
|
|
8325 *) func_append finalize_shlibpath "$libdir:" ;;
|
|
8326 esac
|
|
8327 fi
|
|
8328 fi
|
|
8329 fi
|
|
8330
|
|
8331 if test prog = "$linkmode" || test relink = "$opt_mode"; then
|
|
8332 add_shlibpath=
|
|
8333 add_dir=
|
|
8334 add=
|
|
8335 # Finalize command for both is simple: just hardcode it.
|
|
8336 if test yes = "$hardcode_direct" &&
|
|
8337 test no = "$hardcode_direct_absolute"; then
|
|
8338 add=$libdir/$linklib
|
|
8339 elif test yes = "$hardcode_minus_L"; then
|
|
8340 add_dir=-L$libdir
|
|
8341 add=-l$name
|
|
8342 elif test yes = "$hardcode_shlibpath_var"; then
|
|
8343 case :$finalize_shlibpath: in
|
|
8344 *":$libdir:"*) ;;
|
|
8345 *) func_append finalize_shlibpath "$libdir:" ;;
|
|
8346 esac
|
|
8347 add=-l$name
|
|
8348 elif test yes = "$hardcode_automatic"; then
|
|
8349 if test -n "$inst_prefix_dir" &&
|
|
8350 test -f "$inst_prefix_dir$libdir/$linklib"; then
|
|
8351 add=$inst_prefix_dir$libdir/$linklib
|
|
8352 else
|
|
8353 add=$libdir/$linklib
|
|
8354 fi
|
|
8355 else
|
|
8356 # We cannot seem to hardcode it, guess we'll fake it.
|
|
8357 add_dir=-L$libdir
|
|
8358 # Try looking first in the location we're being installed to.
|
|
8359 if test -n "$inst_prefix_dir"; then
|
|
8360 case $libdir in
|
|
8361 [\\/]*)
|
|
8362 func_append add_dir " -L$inst_prefix_dir$libdir"
|
|
8363 ;;
|
|
8364 esac
|
|
8365 fi
|
|
8366 add=-l$name
|
|
8367 fi
|
|
8368
|
|
8369 if test prog = "$linkmode"; then
|
|
8370 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
|
|
8371 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
|
|
8372 else
|
|
8373 test -n "$add_dir" && deplibs="$add_dir $deplibs"
|
|
8374 test -n "$add" && deplibs="$add $deplibs"
|
|
8375 fi
|
|
8376 fi
|
|
8377 elif test prog = "$linkmode"; then
|
|
8378 # Here we assume that one of hardcode_direct or hardcode_minus_L
|
|
8379 # is not unsupported. This is valid on all known static and
|
|
8380 # shared platforms.
|
|
8381 if test unsupported != "$hardcode_direct"; then
|
|
8382 test -n "$old_library" && linklib=$old_library
|
|
8383 compile_deplibs="$dir/$linklib $compile_deplibs"
|
|
8384 finalize_deplibs="$dir/$linklib $finalize_deplibs"
|
|
8385 else
|
|
8386 compile_deplibs="-l$name -L$dir $compile_deplibs"
|
|
8387 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
|
|
8388 fi
|
|
8389 elif test yes = "$build_libtool_libs"; then
|
|
8390 # Not a shared library
|
|
8391 if test pass_all != "$deplibs_check_method"; then
|
|
8392 # We're trying link a shared library against a static one
|
|
8393 # but the system doesn't support it.
|
|
8394
|
|
8395 # Just print a warning and add the library to dependency_libs so
|
|
8396 # that the program can be linked against the static library.
|
|
8397 echo
|
|
8398 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
|
|
8399 echo "*** I have the capability to make that library automatically link in when"
|
|
8400 echo "*** you link to this library. But I can only do this if you have a"
|
|
8401 echo "*** shared version of the library, which you do not appear to have."
|
|
8402 if test yes = "$module"; then
|
|
8403 echo "*** But as you try to build a module library, libtool will still create "
|
|
8404 echo "*** a static module, that should work as long as the dlopening application"
|
|
8405 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
|
|
8406 if test -z "$global_symbol_pipe"; then
|
|
8407 echo
|
|
8408 echo "*** However, this would only work if libtool was able to extract symbol"
|
|
8409 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
|
|
8410 echo "*** not find such a program. So, this module is probably useless."
|
|
8411 echo "*** 'nm' from GNU binutils and a full rebuild may help."
|
|
8412 fi
|
|
8413 if test no = "$build_old_libs"; then
|
|
8414 build_libtool_libs=module
|
|
8415 build_old_libs=yes
|
|
8416 else
|
|
8417 build_libtool_libs=no
|
|
8418 fi
|
|
8419 fi
|
|
8420 else
|
|
8421 deplibs="$dir/$old_library $deplibs"
|
|
8422 link_static=yes
|
|
8423 fi
|
|
8424 fi # link shared/static library?
|
|
8425
|
|
8426 if test lib = "$linkmode"; then
|
|
8427 if test -n "$dependency_libs" &&
|
|
8428 { test yes != "$hardcode_into_libs" ||
|
|
8429 test yes = "$build_old_libs" ||
|
|
8430 test yes = "$link_static"; }; then
|
|
8431 # Extract -R from dependency_libs
|
|
8432 temp_deplibs=
|
|
8433 for libdir in $dependency_libs; do
|
|
8434 case $libdir in
|
|
8435 -R*) func_stripname '-R' '' "$libdir"
|
|
8436 temp_xrpath=$func_stripname_result
|
|
8437 case " $xrpath " in
|
|
8438 *" $temp_xrpath "*) ;;
|
|
8439 *) func_append xrpath " $temp_xrpath";;
|
|
8440 esac;;
|
|
8441 *) func_append temp_deplibs " $libdir";;
|
|
8442 esac
|
|
8443 done
|
|
8444 dependency_libs=$temp_deplibs
|
|
8445 fi
|
|
8446
|
|
8447 func_append newlib_search_path " $absdir"
|
|
8448 # Link against this library
|
|
8449 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
|
|
8450 # ... and its dependency_libs
|
|
8451 tmp_libs=
|
|
8452 for deplib in $dependency_libs; do
|
|
8453 newdependency_libs="$deplib $newdependency_libs"
|
|
8454 case $deplib in
|
|
8455 -L*) func_stripname '-L' '' "$deplib"
|
|
8456 func_resolve_sysroot "$func_stripname_result";;
|
|
8457 *) func_resolve_sysroot "$deplib" ;;
|
|
8458 esac
|
|
8459 if $opt_preserve_dup_deps; then
|
|
8460 case "$tmp_libs " in
|
|
8461 *" $func_resolve_sysroot_result "*)
|
|
8462 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
|
|
8463 esac
|
|
8464 fi
|
|
8465 func_append tmp_libs " $func_resolve_sysroot_result"
|
|
8466 done
|
|
8467
|
|
8468 if test no != "$link_all_deplibs"; then
|
|
8469 # Add the search paths of all dependency libraries
|
|
8470 for deplib in $dependency_libs; do
|
|
8471 path=
|
|
8472 case $deplib in
|
|
8473 -L*) path=$deplib ;;
|
|
8474 *.la)
|
|
8475 func_resolve_sysroot "$deplib"
|
|
8476 deplib=$func_resolve_sysroot_result
|
|
8477 func_dirname "$deplib" "" "."
|
|
8478 dir=$func_dirname_result
|
|
8479 # We need an absolute path.
|
|
8480 case $dir in
|
|
8481 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
|
|
8482 *)
|
|
8483 absdir=`cd "$dir" && pwd`
|
|
8484 if test -z "$absdir"; then
|
|
8485 func_warning "cannot determine absolute directory name of '$dir'"
|
|
8486 absdir=$dir
|
|
8487 fi
|
|
8488 ;;
|
|
8489 esac
|
|
8490 if $GREP "^installed=no" $deplib > /dev/null; then
|
|
8491 case $host in
|
|
8492 *-*-darwin*)
|
|
8493 depdepl=
|
|
8494 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
|
|
8495 if test -n "$deplibrary_names"; then
|
|
8496 for tmp in $deplibrary_names; do
|
|
8497 depdepl=$tmp
|
|
8498 done
|
|
8499 if test -f "$absdir/$objdir/$depdepl"; then
|
|
8500 depdepl=$absdir/$objdir/$depdepl
|
|
8501 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
|
|
8502 if test -z "$darwin_install_name"; then
|
|
8503 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
|
|
8504 fi
|
|
8505 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
|
|
8506 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
|
|
8507 path=
|
|
8508 fi
|
|
8509 fi
|
|
8510 ;;
|
|
8511 *)
|
|
8512 path=-L$absdir/$objdir
|
|
8513 ;;
|
|
8514 esac
|
|
8515 else
|
|
8516 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
|
|
8517 test -z "$libdir" && \
|
|
8518 func_fatal_error "'$deplib' is not a valid libtool archive"
|
|
8519 test "$absdir" != "$libdir" && \
|
|
8520 func_warning "'$deplib' seems to be moved"
|
|
8521
|
|
8522 path=-L$absdir
|
|
8523 fi
|
|
8524 ;;
|
|
8525 esac
|
|
8526 case " $deplibs " in
|
|
8527 *" $path "*) ;;
|
|
8528 *) deplibs="$path $deplibs" ;;
|
|
8529 esac
|
|
8530 done
|
|
8531 fi # link_all_deplibs != no
|
|
8532 fi # linkmode = lib
|
|
8533 done # for deplib in $libs
|
|
8534 if test link = "$pass"; then
|
|
8535 if test prog = "$linkmode"; then
|
|
8536 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
|
|
8537 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
|
|
8538 else
|
|
8539 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
|
8540 fi
|
|
8541 fi
|
|
8542 dependency_libs=$newdependency_libs
|
|
8543 if test dlpreopen = "$pass"; then
|
|
8544 # Link the dlpreopened libraries before other libraries
|
|
8545 for deplib in $save_deplibs; do
|
|
8546 deplibs="$deplib $deplibs"
|
|
8547 done
|
|
8548 fi
|
|
8549 if test dlopen != "$pass"; then
|
|
8550 test conv = "$pass" || {
|
|
8551 # Make sure lib_search_path contains only unique directories.
|
|
8552 lib_search_path=
|
|
8553 for dir in $newlib_search_path; do
|
|
8554 case "$lib_search_path " in
|
|
8555 *" $dir "*) ;;
|
|
8556 *) func_append lib_search_path " $dir" ;;
|
|
8557 esac
|
|
8558 done
|
|
8559 newlib_search_path=
|
|
8560 }
|
|
8561
|
|
8562 if test prog,link = "$linkmode,$pass"; then
|
|
8563 vars="compile_deplibs finalize_deplibs"
|
|
8564 else
|
|
8565 vars=deplibs
|
|
8566 fi
|
|
8567 for var in $vars dependency_libs; do
|
|
8568 # Add libraries to $var in reverse order
|
|
8569 eval tmp_libs=\"\$$var\"
|
|
8570 new_libs=
|
|
8571 for deplib in $tmp_libs; do
|
|
8572 # FIXME: Pedantically, this is the right thing to do, so
|
|
8573 # that some nasty dependency loop isn't accidentally
|
|
8574 # broken:
|
|
8575 #new_libs="$deplib $new_libs"
|
|
8576 # Pragmatically, this seems to cause very few problems in
|
|
8577 # practice:
|
|
8578 case $deplib in
|
|
8579 -L*) new_libs="$deplib $new_libs" ;;
|
|
8580 -R*) ;;
|
|
8581 *)
|
|
8582 # And here is the reason: when a library appears more
|
|
8583 # than once as an explicit dependence of a library, or
|
|
8584 # is implicitly linked in more than once by the
|
|
8585 # compiler, it is considered special, and multiple
|
|
8586 # occurrences thereof are not removed. Compare this
|
|
8587 # with having the same library being listed as a
|
|
8588 # dependency of multiple other libraries: in this case,
|
|
8589 # we know (pedantically, we assume) the library does not
|
|
8590 # need to be listed more than once, so we keep only the
|
|
8591 # last copy. This is not always right, but it is rare
|
|
8592 # enough that we require users that really mean to play
|
|
8593 # such unportable linking tricks to link the library
|
|
8594 # using -Wl,-lname, so that libtool does not consider it
|
|
8595 # for duplicate removal.
|
|
8596 case " $specialdeplibs " in
|
|
8597 *" $deplib "*) new_libs="$deplib $new_libs" ;;
|
|
8598 *)
|
|
8599 case " $new_libs " in
|
|
8600 *" $deplib "*) ;;
|
|
8601 *) new_libs="$deplib $new_libs" ;;
|
|
8602 esac
|
|
8603 ;;
|
|
8604 esac
|
|
8605 ;;
|
|
8606 esac
|
|
8607 done
|
|
8608 tmp_libs=
|
|
8609 for deplib in $new_libs; do
|
|
8610 case $deplib in
|
|
8611 -L*)
|
|
8612 case " $tmp_libs " in
|
|
8613 *" $deplib "*) ;;
|
|
8614 *) func_append tmp_libs " $deplib" ;;
|
|
8615 esac
|
|
8616 ;;
|
|
8617 *) func_append tmp_libs " $deplib" ;;
|
|
8618 esac
|
|
8619 done
|
|
8620 eval $var=\"$tmp_libs\"
|
|
8621 done # for var
|
|
8622 fi
|
|
8623
|
|
8624 # Add Sun CC postdeps if required:
|
|
8625 test CXX = "$tagname" && {
|
|
8626 case $host_os in
|
|
8627 linux*)
|
|
8628 case `$CC -V 2>&1 | sed 5q` in
|
|
8629 *Sun\ C*) # Sun C++ 5.9
|
|
8630 func_suncc_cstd_abi
|
|
8631
|
|
8632 if test no != "$suncc_use_cstd_abi"; then
|
|
8633 func_append postdeps ' -library=Cstd -library=Crun'
|
|
8634 fi
|
|
8635 ;;
|
|
8636 esac
|
|
8637 ;;
|
|
8638
|
|
8639 solaris*)
|
|
8640 func_cc_basename "$CC"
|
|
8641 case $func_cc_basename_result in
|
|
8642 CC* | sunCC*)
|
|
8643 func_suncc_cstd_abi
|
|
8644
|
|
8645 if test no != "$suncc_use_cstd_abi"; then
|
|
8646 func_append postdeps ' -library=Cstd -library=Crun'
|
|
8647 fi
|
|
8648 ;;
|
|
8649 esac
|
|
8650 ;;
|
|
8651 esac
|
|
8652 }
|
|
8653
|
|
8654 # Last step: remove runtime libs from dependency_libs
|
|
8655 # (they stay in deplibs)
|
|
8656 tmp_libs=
|
|
8657 for i in $dependency_libs; do
|
|
8658 case " $predeps $postdeps $compiler_lib_search_path " in
|
|
8659 *" $i "*)
|
|
8660 i=
|
|
8661 ;;
|
|
8662 esac
|
|
8663 if test -n "$i"; then
|
|
8664 func_append tmp_libs " $i"
|
|
8665 fi
|
|
8666 done
|
|
8667 dependency_libs=$tmp_libs
|
|
8668 done # for pass
|
|
8669 if test prog = "$linkmode"; then
|
|
8670 dlfiles=$newdlfiles
|
|
8671 fi
|
|
8672 if test prog = "$linkmode" || test lib = "$linkmode"; then
|
|
8673 dlprefiles=$newdlprefiles
|
|
8674 fi
|
|
8675
|
|
8676 case $linkmode in
|
|
8677 oldlib)
|
|
8678 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
|
|
8679 func_warning "'-dlopen' is ignored for archives"
|
|
8680 fi
|
|
8681
|
|
8682 case " $deplibs" in
|
|
8683 *\ -l* | *\ -L*)
|
|
8684 func_warning "'-l' and '-L' are ignored for archives" ;;
|
|
8685 esac
|
|
8686
|
|
8687 test -n "$rpath" && \
|
|
8688 func_warning "'-rpath' is ignored for archives"
|
|
8689
|
|
8690 test -n "$xrpath" && \
|
|
8691 func_warning "'-R' is ignored for archives"
|
|
8692
|
|
8693 test -n "$vinfo" && \
|
|
8694 func_warning "'-version-info/-version-number' is ignored for archives"
|
|
8695
|
|
8696 test -n "$release" && \
|
|
8697 func_warning "'-release' is ignored for archives"
|
|
8698
|
|
8699 test -n "$export_symbols$export_symbols_regex" && \
|
|
8700 func_warning "'-export-symbols' is ignored for archives"
|
|
8701
|
|
8702 # Now set the variables for building old libraries.
|
|
8703 build_libtool_libs=no
|
|
8704 oldlibs=$output
|
|
8705 func_append objs "$old_deplibs"
|
|
8706 ;;
|
|
8707
|
|
8708 lib)
|
|
8709 # Make sure we only generate libraries of the form 'libNAME.la'.
|
|
8710 case $outputname in
|
|
8711 lib*)
|
|
8712 func_stripname 'lib' '.la' "$outputname"
|
|
8713 name=$func_stripname_result
|
|
8714 eval shared_ext=\"$shrext_cmds\"
|
|
8715 eval libname=\"$libname_spec\"
|
|
8716 ;;
|
|
8717 *)
|
|
8718 test no = "$module" \
|
|
8719 && func_fatal_help "libtool library '$output' must begin with 'lib'"
|
|
8720
|
|
8721 if test no != "$need_lib_prefix"; then
|
|
8722 # Add the "lib" prefix for modules if required
|
|
8723 func_stripname '' '.la' "$outputname"
|
|
8724 name=$func_stripname_result
|
|
8725 eval shared_ext=\"$shrext_cmds\"
|
|
8726 eval libname=\"$libname_spec\"
|
|
8727 else
|
|
8728 func_stripname '' '.la' "$outputname"
|
|
8729 libname=$func_stripname_result
|
|
8730 fi
|
|
8731 ;;
|
|
8732 esac
|
|
8733
|
|
8734 if test -n "$objs"; then
|
|
8735 if test pass_all != "$deplibs_check_method"; then
|
|
8736 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
|
|
8737 else
|
|
8738 echo
|
|
8739 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
|
|
8740 $ECHO "*** objects $objs is not portable!"
|
|
8741 func_append libobjs " $objs"
|
|
8742 fi
|
|
8743 fi
|
|
8744
|
|
8745 test no = "$dlself" \
|
|
8746 || func_warning "'-dlopen self' is ignored for libtool libraries"
|
|
8747
|
|
8748 set dummy $rpath
|
|
8749 shift
|
|
8750 test 1 -lt "$#" \
|
|
8751 && func_warning "ignoring multiple '-rpath's for a libtool library"
|
|
8752
|
|
8753 install_libdir=$1
|
|
8754
|
|
8755 oldlibs=
|
|
8756 if test -z "$rpath"; then
|
|
8757 if test yes = "$build_libtool_libs"; then
|
|
8758 # Building a libtool convenience library.
|
|
8759 # Some compilers have problems with a '.al' extension so
|
|
8760 # convenience libraries should have the same extension an
|
|
8761 # archive normally would.
|
|
8762 oldlibs="$output_objdir/$libname.$libext $oldlibs"
|
|
8763 build_libtool_libs=convenience
|
|
8764 build_old_libs=yes
|
|
8765 fi
|
|
8766
|
|
8767 test -n "$vinfo" && \
|
|
8768 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
|
|
8769
|
|
8770 test -n "$release" && \
|
|
8771 func_warning "'-release' is ignored for convenience libraries"
|
|
8772 else
|
|
8773
|
|
8774 # Parse the version information argument.
|
|
8775 save_ifs=$IFS; IFS=:
|
|
8776 set dummy $vinfo 0 0 0
|
|
8777 shift
|
|
8778 IFS=$save_ifs
|
|
8779
|
|
8780 test -n "$7" && \
|
|
8781 func_fatal_help "too many parameters to '-version-info'"
|
|
8782
|
|
8783 # convert absolute version numbers to libtool ages
|
|
8784 # this retains compatibility with .la files and attempts
|
|
8785 # to make the code below a bit more comprehensible
|
|
8786
|
|
8787 case $vinfo_number in
|
|
8788 yes)
|
|
8789 number_major=$1
|
|
8790 number_minor=$2
|
|
8791 number_revision=$3
|
|
8792 #
|
|
8793 # There are really only two kinds -- those that
|
|
8794 # use the current revision as the major version
|
|
8795 # and those that subtract age and use age as
|
|
8796 # a minor version. But, then there is irix
|
|
8797 # that has an extra 1 added just for fun
|
|
8798 #
|
|
8799 case $version_type in
|
|
8800 # correct linux to gnu/linux during the next big refactor
|
|
8801 darwin|freebsd-elf|linux|osf|windows|none)
|
|
8802 func_arith $number_major + $number_minor
|
|
8803 current=$func_arith_result
|
|
8804 age=$number_minor
|
|
8805 revision=$number_revision
|
|
8806 ;;
|
|
8807 freebsd-aout|qnx|sunos)
|
|
8808 current=$number_major
|
|
8809 revision=$number_minor
|
|
8810 age=0
|
|
8811 ;;
|
|
8812 irix|nonstopux)
|
|
8813 func_arith $number_major + $number_minor
|
|
8814 current=$func_arith_result
|
|
8815 age=$number_minor
|
|
8816 revision=$number_minor
|
|
8817 lt_irix_increment=no
|
|
8818 ;;
|
|
8819 esac
|
|
8820 ;;
|
|
8821 no)
|
|
8822 current=$1
|
|
8823 revision=$2
|
|
8824 age=$3
|
|
8825 ;;
|
|
8826 esac
|
|
8827
|
|
8828 # Check that each of the things are valid numbers.
|
|
8829 case $current in
|
|
8830 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]) ;;
|
|
8831 *)
|
|
8832 func_error "CURRENT '$current' must be a nonnegative integer"
|
|
8833 func_fatal_error "'$vinfo' is not valid version information"
|
|
8834 ;;
|
|
8835 esac
|
|
8836
|
|
8837 case $revision in
|
|
8838 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]) ;;
|
|
8839 *)
|
|
8840 func_error "REVISION '$revision' must be a nonnegative integer"
|
|
8841 func_fatal_error "'$vinfo' is not valid version information"
|
|
8842 ;;
|
|
8843 esac
|
|
8844
|
|
8845 case $age in
|
|
8846 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]) ;;
|
|
8847 *)
|
|
8848 func_error "AGE '$age' must be a nonnegative integer"
|
|
8849 func_fatal_error "'$vinfo' is not valid version information"
|
|
8850 ;;
|
|
8851 esac
|
|
8852
|
|
8853 if test "$age" -gt "$current"; then
|
|
8854 func_error "AGE '$age' is greater than the current interface number '$current'"
|
|
8855 func_fatal_error "'$vinfo' is not valid version information"
|
|
8856 fi
|
|
8857
|
|
8858 # Calculate the version variables.
|
|
8859 major=
|
|
8860 versuffix=
|
|
8861 verstring=
|
|
8862 case $version_type in
|
|
8863 none) ;;
|
|
8864
|
|
8865 darwin)
|
|
8866 # Like Linux, but with the current version available in
|
|
8867 # verstring for coding it into the library header
|
|
8868 func_arith $current - $age
|
|
8869 major=.$func_arith_result
|
|
8870 versuffix=$major.$age.$revision
|
|
8871 # Darwin ld doesn't like 0 for these options...
|
|
8872 func_arith $current + 1
|
|
8873 minor_current=$func_arith_result
|
|
8874 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
|
|
8875 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
|
|
8876 # On Darwin other compilers
|
|
8877 case $CC in
|
|
8878 nagfor*)
|
|
8879 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
|
|
8880 ;;
|
|
8881 *)
|
|
8882 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
|
|
8883 ;;
|
|
8884 esac
|
|
8885 ;;
|
|
8886
|
|
8887 freebsd-aout)
|
|
8888 major=.$current
|
|
8889 versuffix=.$current.$revision
|
|
8890 ;;
|
|
8891
|
|
8892 freebsd-elf)
|
|
8893 func_arith $current - $age
|
|
8894 major=.$func_arith_result
|
|
8895 versuffix=$major.$age.$revision
|
|
8896 ;;
|
|
8897
|
|
8898 irix | nonstopux)
|
|
8899 if test no = "$lt_irix_increment"; then
|
|
8900 func_arith $current - $age
|
|
8901 else
|
|
8902 func_arith $current - $age + 1
|
|
8903 fi
|
|
8904 major=$func_arith_result
|
|
8905
|
|
8906 case $version_type in
|
|
8907 nonstopux) verstring_prefix=nonstopux ;;
|
|
8908 *) verstring_prefix=sgi ;;
|
|
8909 esac
|
|
8910 verstring=$verstring_prefix$major.$revision
|
|
8911
|
|
8912 # Add in all the interfaces that we are compatible with.
|
|
8913 loop=$revision
|
|
8914 while test 0 -ne "$loop"; do
|
|
8915 func_arith $revision - $loop
|
|
8916 iface=$func_arith_result
|
|
8917 func_arith $loop - 1
|
|
8918 loop=$func_arith_result
|
|
8919 verstring=$verstring_prefix$major.$iface:$verstring
|
|
8920 done
|
|
8921
|
|
8922 # Before this point, $major must not contain '.'.
|
|
8923 major=.$major
|
|
8924 versuffix=$major.$revision
|
|
8925 ;;
|
|
8926
|
|
8927 linux) # correct to gnu/linux during the next big refactor
|
|
8928 func_arith $current - $age
|
|
8929 major=.$func_arith_result
|
|
8930 versuffix=$major.$age.$revision
|
|
8931 ;;
|
|
8932
|
|
8933 osf)
|
|
8934 func_arith $current - $age
|
|
8935 major=.$func_arith_result
|
|
8936 versuffix=.$current.$age.$revision
|
|
8937 verstring=$current.$age.$revision
|
|
8938
|
|
8939 # Add in all the interfaces that we are compatible with.
|
|
8940 loop=$age
|
|
8941 while test 0 -ne "$loop"; do
|
|
8942 func_arith $current - $loop
|
|
8943 iface=$func_arith_result
|
|
8944 func_arith $loop - 1
|
|
8945 loop=$func_arith_result
|
|
8946 verstring=$verstring:$iface.0
|
|
8947 done
|
|
8948
|
|
8949 # Make executables depend on our current version.
|
|
8950 func_append verstring ":$current.0"
|
|
8951 ;;
|
|
8952
|
|
8953 qnx)
|
|
8954 major=.$current
|
|
8955 versuffix=.$current
|
|
8956 ;;
|
|
8957
|
|
8958 sco)
|
|
8959 major=.$current
|
|
8960 versuffix=.$current
|
|
8961 ;;
|
|
8962
|
|
8963 sunos)
|
|
8964 major=.$current
|
|
8965 versuffix=.$current.$revision
|
|
8966 ;;
|
|
8967
|
|
8968 windows)
|
|
8969 # Use '-' rather than '.', since we only want one
|
|
8970 # extension on DOS 8.3 file systems.
|
|
8971 func_arith $current - $age
|
|
8972 major=$func_arith_result
|
|
8973 versuffix=-$major
|
|
8974 ;;
|
|
8975
|
|
8976 *)
|
|
8977 func_fatal_configuration "unknown library version type '$version_type'"
|
|
8978 ;;
|
|
8979 esac
|
|
8980
|
|
8981 # Clear the version info if we defaulted, and they specified a release.
|
|
8982 if test -z "$vinfo" && test -n "$release"; then
|
|
8983 major=
|
|
8984 case $version_type in
|
|
8985 darwin)
|
|
8986 # we can't check for "0.0" in archive_cmds due to quoting
|
|
8987 # problems, so we reset it completely
|
|
8988 verstring=
|
|
8989 ;;
|
|
8990 *)
|
|
8991 verstring=0.0
|
|
8992 ;;
|
|
8993 esac
|
|
8994 if test no = "$need_version"; then
|
|
8995 versuffix=
|
|
8996 else
|
|
8997 versuffix=.0.0
|
|
8998 fi
|
|
8999 fi
|
|
9000
|
|
9001 # Remove version info from name if versioning should be avoided
|
|
9002 if test yes,no = "$avoid_version,$need_version"; then
|
|
9003 major=
|
|
9004 versuffix=
|
|
9005 verstring=
|
|
9006 fi
|
|
9007
|
|
9008 # Check to see if the archive will have undefined symbols.
|
|
9009 if test yes = "$allow_undefined"; then
|
|
9010 if test unsupported = "$allow_undefined_flag"; then
|
|
9011 if test yes = "$build_old_libs"; then
|
|
9012 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
|
|
9013 build_libtool_libs=no
|
|
9014 else
|
|
9015 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
|
|
9016 fi
|
|
9017 fi
|
|
9018 else
|
|
9019 # Don't allow undefined symbols.
|
|
9020 allow_undefined_flag=$no_undefined_flag
|
|
9021 fi
|
|
9022
|
|
9023 fi
|
|
9024
|
|
9025 func_generate_dlsyms "$libname" "$libname" :
|
|
9026 func_append libobjs " $symfileobj"
|
|
9027 test " " = "$libobjs" && libobjs=
|
|
9028
|
|
9029 if test relink != "$opt_mode"; then
|
|
9030 # Remove our outputs, but don't remove object files since they
|
|
9031 # may have been created when compiling PIC objects.
|
|
9032 removelist=
|
|
9033 tempremovelist=`$ECHO "$output_objdir/*"`
|
|
9034 for p in $tempremovelist; do
|
|
9035 case $p in
|
|
9036 *.$objext | *.gcno)
|
|
9037 ;;
|
|
9038 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
|
|
9039 if test -n "$precious_files_regex"; then
|
|
9040 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
|
|
9041 then
|
|
9042 continue
|
|
9043 fi
|
|
9044 fi
|
|
9045 func_append removelist " $p"
|
|
9046 ;;
|
|
9047 *) ;;
|
|
9048 esac
|
|
9049 done
|
|
9050 test -n "$removelist" && \
|
|
9051 func_show_eval "${RM}r \$removelist"
|
|
9052 fi
|
|
9053
|
|
9054 # Now set the variables for building old libraries.
|
|
9055 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
|
|
9056 func_append oldlibs " $output_objdir/$libname.$libext"
|
|
9057
|
|
9058 # Transform .lo files to .o files.
|
|
9059 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
|
|
9060 fi
|
|
9061
|
|
9062 # Eliminate all temporary directories.
|
|
9063 #for path in $notinst_path; do
|
|
9064 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
|
|
9065 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
|
|
9066 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
|
|
9067 #done
|
|
9068
|
|
9069 if test -n "$xrpath"; then
|
|
9070 # If the user specified any rpath flags, then add them.
|
|
9071 temp_xrpath=
|
|
9072 for libdir in $xrpath; do
|
|
9073 func_replace_sysroot "$libdir"
|
|
9074 func_append temp_xrpath " -R$func_replace_sysroot_result"
|
|
9075 case "$finalize_rpath " in
|
|
9076 *" $libdir "*) ;;
|
|
9077 *) func_append finalize_rpath " $libdir" ;;
|
|
9078 esac
|
|
9079 done
|
|
9080 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
|
|
9081 dependency_libs="$temp_xrpath $dependency_libs"
|
|
9082 fi
|
|
9083 fi
|
|
9084
|
|
9085 # Make sure dlfiles contains only unique files that won't be dlpreopened
|
|
9086 old_dlfiles=$dlfiles
|
|
9087 dlfiles=
|
|
9088 for lib in $old_dlfiles; do
|
|
9089 case " $dlprefiles $dlfiles " in
|
|
9090 *" $lib "*) ;;
|
|
9091 *) func_append dlfiles " $lib" ;;
|
|
9092 esac
|
|
9093 done
|
|
9094
|
|
9095 # Make sure dlprefiles contains only unique files
|
|
9096 old_dlprefiles=$dlprefiles
|
|
9097 dlprefiles=
|
|
9098 for lib in $old_dlprefiles; do
|
|
9099 case "$dlprefiles " in
|
|
9100 *" $lib "*) ;;
|
|
9101 *) func_append dlprefiles " $lib" ;;
|
|
9102 esac
|
|
9103 done
|
|
9104
|
|
9105 if test yes = "$build_libtool_libs"; then
|
|
9106 if test -n "$rpath"; then
|
|
9107 case $host in
|
|
9108 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
|
|
9109 # these systems don't actually have a c library (as such)!
|
|
9110 ;;
|
|
9111 *-*-rhapsody* | *-*-darwin1.[012])
|
|
9112 # Rhapsody C library is in the System framework
|
|
9113 func_append deplibs " System.ltframework"
|
|
9114 ;;
|
|
9115 *-*-netbsd*)
|
|
9116 # Don't link with libc until the a.out ld.so is fixed.
|
|
9117 ;;
|
|
9118 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
|
|
9119 # Do not include libc due to us having libc/libc_r.
|
|
9120 ;;
|
|
9121 *-*-sco3.2v5* | *-*-sco5v6*)
|
|
9122 # Causes problems with __ctype
|
|
9123 ;;
|
|
9124 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
|
|
9125 # Compiler inserts libc in the correct place for threads to work
|
|
9126 ;;
|
|
9127 *)
|
|
9128 # Add libc to deplibs on all other systems if necessary.
|
|
9129 if test yes = "$build_libtool_need_lc"; then
|
|
9130 func_append deplibs " -lc"
|
|
9131 fi
|
|
9132 ;;
|
|
9133 esac
|
|
9134 fi
|
|
9135
|
|
9136 # Transform deplibs into only deplibs that can be linked in shared.
|
|
9137 name_save=$name
|
|
9138 libname_save=$libname
|
|
9139 release_save=$release
|
|
9140 versuffix_save=$versuffix
|
|
9141 major_save=$major
|
|
9142 # I'm not sure if I'm treating the release correctly. I think
|
|
9143 # release should show up in the -l (ie -lgmp5) so we don't want to
|
|
9144 # add it in twice. Is that correct?
|
|
9145 release=
|
|
9146 versuffix=
|
|
9147 major=
|
|
9148 newdeplibs=
|
|
9149 droppeddeps=no
|
|
9150 case $deplibs_check_method in
|
|
9151 pass_all)
|
|
9152 # Don't check for shared/static. Everything works.
|
|
9153 # This might be a little naive. We might want to check
|
|
9154 # whether the library exists or not. But this is on
|
|
9155 # osf3 & osf4 and I'm not really sure... Just
|
|
9156 # implementing what was already the behavior.
|
|
9157 newdeplibs=$deplibs
|
|
9158 ;;
|
|
9159 test_compile)
|
|
9160 # This code stresses the "libraries are programs" paradigm to its
|
|
9161 # limits. Maybe even breaks it. We compile a program, linking it
|
|
9162 # against the deplibs as a proxy for the library. Then we can check
|
|
9163 # whether they linked in statically or dynamically with ldd.
|
|
9164 $opt_dry_run || $RM conftest.c
|
|
9165 cat > conftest.c <<EOF
|
|
9166 int main() { return 0; }
|
|
9167 EOF
|
|
9168 $opt_dry_run || $RM conftest
|
|
9169 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
|
|
9170 ldd_output=`ldd conftest`
|
|
9171 for i in $deplibs; do
|
|
9172 case $i in
|
|
9173 -l*)
|
|
9174 func_stripname -l '' "$i"
|
|
9175 name=$func_stripname_result
|
|
9176 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
|
|
9177 case " $predeps $postdeps " in
|
|
9178 *" $i "*)
|
|
9179 func_append newdeplibs " $i"
|
|
9180 i=
|
|
9181 ;;
|
|
9182 esac
|
|
9183 fi
|
|
9184 if test -n "$i"; then
|
|
9185 libname=`eval "\\$ECHO \"$libname_spec\""`
|
|
9186 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
|
|
9187 set dummy $deplib_matches; shift
|
|
9188 deplib_match=$1
|
|
9189 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
|
|
9190 func_append newdeplibs " $i"
|
|
9191 else
|
|
9192 droppeddeps=yes
|
|
9193 echo
|
|
9194 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
|
|
9195 echo "*** I have the capability to make that library automatically link in when"
|
|
9196 echo "*** you link to this library. But I can only do this if you have a"
|
|
9197 echo "*** shared version of the library, which I believe you do not have"
|
|
9198 echo "*** because a test_compile did reveal that the linker did not use it for"
|
|
9199 echo "*** its dynamic dependency list that programs get resolved with at runtime."
|
|
9200 fi
|
|
9201 fi
|
|
9202 ;;
|
|
9203 *)
|
|
9204 func_append newdeplibs " $i"
|
|
9205 ;;
|
|
9206 esac
|
|
9207 done
|
|
9208 else
|
|
9209 # Error occurred in the first compile. Let's try to salvage
|
|
9210 # the situation: Compile a separate program for each library.
|
|
9211 for i in $deplibs; do
|
|
9212 case $i in
|
|
9213 -l*)
|
|
9214 func_stripname -l '' "$i"
|
|
9215 name=$func_stripname_result
|
|
9216 $opt_dry_run || $RM conftest
|
|
9217 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
|
|
9218 ldd_output=`ldd conftest`
|
|
9219 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
|
|
9220 case " $predeps $postdeps " in
|
|
9221 *" $i "*)
|
|
9222 func_append newdeplibs " $i"
|
|
9223 i=
|
|
9224 ;;
|
|
9225 esac
|
|
9226 fi
|
|
9227 if test -n "$i"; then
|
|
9228 libname=`eval "\\$ECHO \"$libname_spec\""`
|
|
9229 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
|
|
9230 set dummy $deplib_matches; shift
|
|
9231 deplib_match=$1
|
|
9232 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
|
|
9233 func_append newdeplibs " $i"
|
|
9234 else
|
|
9235 droppeddeps=yes
|
|
9236 echo
|
|
9237 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
|
|
9238 echo "*** I have the capability to make that library automatically link in when"
|
|
9239 echo "*** you link to this library. But I can only do this if you have a"
|
|
9240 echo "*** shared version of the library, which you do not appear to have"
|
|
9241 echo "*** because a test_compile did reveal that the linker did not use this one"
|
|
9242 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
|
|
9243 fi
|
|
9244 fi
|
|
9245 else
|
|
9246 droppeddeps=yes
|
|
9247 echo
|
|
9248 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
|
|
9249 echo "*** make it link in! You will probably need to install it or some"
|
|
9250 echo "*** library that it depends on before this library will be fully"
|
|
9251 echo "*** functional. Installing it before continuing would be even better."
|
|
9252 fi
|
|
9253 ;;
|
|
9254 *)
|
|
9255 func_append newdeplibs " $i"
|
|
9256 ;;
|
|
9257 esac
|
|
9258 done
|
|
9259 fi
|
|
9260 ;;
|
|
9261 file_magic*)
|
|
9262 set dummy $deplibs_check_method; shift
|
|
9263 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
|
|
9264 for a_deplib in $deplibs; do
|
|
9265 case $a_deplib in
|
|
9266 -l*)
|
|
9267 func_stripname -l '' "$a_deplib"
|
|
9268 name=$func_stripname_result
|
|
9269 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
|
|
9270 case " $predeps $postdeps " in
|
|
9271 *" $a_deplib "*)
|
|
9272 func_append newdeplibs " $a_deplib"
|
|
9273 a_deplib=
|
|
9274 ;;
|
|
9275 esac
|
|
9276 fi
|
|
9277 if test -n "$a_deplib"; then
|
|
9278 libname=`eval "\\$ECHO \"$libname_spec\""`
|
|
9279 if test -n "$file_magic_glob"; then
|
|
9280 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
|
|
9281 else
|
|
9282 libnameglob=$libname
|
|
9283 fi
|
|
9284 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
|
|
9285 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
|
|
9286 if test yes = "$want_nocaseglob"; then
|
|
9287 shopt -s nocaseglob
|
|
9288 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
|
|
9289 $nocaseglob
|
|
9290 else
|
|
9291 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
|
|
9292 fi
|
|
9293 for potent_lib in $potential_libs; do
|
|
9294 # Follow soft links.
|
|
9295 if ls -lLd "$potent_lib" 2>/dev/null |
|
|
9296 $GREP " -> " >/dev/null; then
|
|
9297 continue
|
|
9298 fi
|
|
9299 # The statement above tries to avoid entering an
|
|
9300 # endless loop below, in case of cyclic links.
|
|
9301 # We might still enter an endless loop, since a link
|
|
9302 # loop can be closed while we follow links,
|
|
9303 # but so what?
|
|
9304 potlib=$potent_lib
|
|
9305 while test -h "$potlib" 2>/dev/null; do
|
|
9306 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
|
|
9307 case $potliblink in
|
|
9308 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
|
|
9309 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
|
|
9310 esac
|
|
9311 done
|
|
9312 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
|
|
9313 $SED -e 10q |
|
|
9314 $EGREP "$file_magic_regex" > /dev/null; then
|
|
9315 func_append newdeplibs " $a_deplib"
|
|
9316 a_deplib=
|
|
9317 break 2
|
|
9318 fi
|
|
9319 done
|
|
9320 done
|
|
9321 fi
|
|
9322 if test -n "$a_deplib"; then
|
|
9323 droppeddeps=yes
|
|
9324 echo
|
|
9325 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
|
|
9326 echo "*** I have the capability to make that library automatically link in when"
|
|
9327 echo "*** you link to this library. But I can only do this if you have a"
|
|
9328 echo "*** shared version of the library, which you do not appear to have"
|
|
9329 echo "*** because I did check the linker path looking for a file starting"
|
|
9330 if test -z "$potlib"; then
|
|
9331 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
|
|
9332 else
|
|
9333 $ECHO "*** with $libname and none of the candidates passed a file format test"
|
|
9334 $ECHO "*** using a file magic. Last file checked: $potlib"
|
|
9335 fi
|
|
9336 fi
|
|
9337 ;;
|
|
9338 *)
|
|
9339 # Add a -L argument.
|
|
9340 func_append newdeplibs " $a_deplib"
|
|
9341 ;;
|
|
9342 esac
|
|
9343 done # Gone through all deplibs.
|
|
9344 ;;
|
|
9345 match_pattern*)
|
|
9346 set dummy $deplibs_check_method; shift
|
|
9347 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
|
|
9348 for a_deplib in $deplibs; do
|
|
9349 case $a_deplib in
|
|
9350 -l*)
|
|
9351 func_stripname -l '' "$a_deplib"
|
|
9352 name=$func_stripname_result
|
|
9353 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
|
|
9354 case " $predeps $postdeps " in
|
|
9355 *" $a_deplib "*)
|
|
9356 func_append newdeplibs " $a_deplib"
|
|
9357 a_deplib=
|
|
9358 ;;
|
|
9359 esac
|
|
9360 fi
|
|
9361 if test -n "$a_deplib"; then
|
|
9362 libname=`eval "\\$ECHO \"$libname_spec\""`
|
|
9363 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
|
|
9364 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
|
|
9365 for potent_lib in $potential_libs; do
|
|
9366 potlib=$potent_lib # see symlink-check above in file_magic test
|
|
9367 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
|
|
9368 $EGREP "$match_pattern_regex" > /dev/null; then
|
|
9369 func_append newdeplibs " $a_deplib"
|
|
9370 a_deplib=
|
|
9371 break 2
|
|
9372 fi
|
|
9373 done
|
|
9374 done
|
|
9375 fi
|
|
9376 if test -n "$a_deplib"; then
|
|
9377 droppeddeps=yes
|
|
9378 echo
|
|
9379 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
|
|
9380 echo "*** I have the capability to make that library automatically link in when"
|
|
9381 echo "*** you link to this library. But I can only do this if you have a"
|
|
9382 echo "*** shared version of the library, which you do not appear to have"
|
|
9383 echo "*** because I did check the linker path looking for a file starting"
|
|
9384 if test -z "$potlib"; then
|
|
9385 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
|
|
9386 else
|
|
9387 $ECHO "*** with $libname and none of the candidates passed a file format test"
|
|
9388 $ECHO "*** using a regex pattern. Last file checked: $potlib"
|
|
9389 fi
|
|
9390 fi
|
|
9391 ;;
|
|
9392 *)
|
|
9393 # Add a -L argument.
|
|
9394 func_append newdeplibs " $a_deplib"
|
|
9395 ;;
|
|
9396 esac
|
|
9397 done # Gone through all deplibs.
|
|
9398 ;;
|
|
9399 none | unknown | *)
|
|
9400 newdeplibs=
|
|
9401 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
|
|
9402 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
|
|
9403 for i in $predeps $postdeps; do
|
|
9404 # can't use Xsed below, because $i might contain '/'
|
|
9405 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
|
|
9406 done
|
|
9407 fi
|
|
9408 case $tmp_deplibs in
|
|
9409 *[!\ \ ]*)
|
|
9410 echo
|
|
9411 if test none = "$deplibs_check_method"; then
|
|
9412 echo "*** Warning: inter-library dependencies are not supported in this platform."
|
|
9413 else
|
|
9414 echo "*** Warning: inter-library dependencies are not known to be supported."
|
|
9415 fi
|
|
9416 echo "*** All declared inter-library dependencies are being dropped."
|
|
9417 droppeddeps=yes
|
|
9418 ;;
|
|
9419 esac
|
|
9420 ;;
|
|
9421 esac
|
|
9422 versuffix=$versuffix_save
|
|
9423 major=$major_save
|
|
9424 release=$release_save
|
|
9425 libname=$libname_save
|
|
9426 name=$name_save
|
|
9427
|
|
9428 case $host in
|
|
9429 *-*-rhapsody* | *-*-darwin1.[012])
|
|
9430 # On Rhapsody replace the C library with the System framework
|
|
9431 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
|
|
9432 ;;
|
|
9433 esac
|
|
9434
|
|
9435 if test yes = "$droppeddeps"; then
|
|
9436 if test yes = "$module"; then
|
|
9437 echo
|
|
9438 echo "*** Warning: libtool could not satisfy all declared inter-library"
|
|
9439 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
|
|
9440 echo "*** a static module, that should work as long as the dlopening"
|
|
9441 echo "*** application is linked with the -dlopen flag."
|
|
9442 if test -z "$global_symbol_pipe"; then
|
|
9443 echo
|
|
9444 echo "*** However, this would only work if libtool was able to extract symbol"
|
|
9445 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
|
|
9446 echo "*** not find such a program. So, this module is probably useless."
|
|
9447 echo "*** 'nm' from GNU binutils and a full rebuild may help."
|
|
9448 fi
|
|
9449 if test no = "$build_old_libs"; then
|
|
9450 oldlibs=$output_objdir/$libname.$libext
|
|
9451 build_libtool_libs=module
|
|
9452 build_old_libs=yes
|
|
9453 else
|
|
9454 build_libtool_libs=no
|
|
9455 fi
|
|
9456 else
|
|
9457 echo "*** The inter-library dependencies that have been dropped here will be"
|
|
9458 echo "*** automatically added whenever a program is linked with this library"
|
|
9459 echo "*** or is declared to -dlopen it."
|
|
9460
|
|
9461 if test no = "$allow_undefined"; then
|
|
9462 echo
|
|
9463 echo "*** Since this library must not contain undefined symbols,"
|
|
9464 echo "*** because either the platform does not support them or"
|
|
9465 echo "*** it was explicitly requested with -no-undefined,"
|
|
9466 echo "*** libtool will only create a static version of it."
|
|
9467 if test no = "$build_old_libs"; then
|
|
9468 oldlibs=$output_objdir/$libname.$libext
|
|
9469 build_libtool_libs=module
|
|
9470 build_old_libs=yes
|
|
9471 else
|
|
9472 build_libtool_libs=no
|
|
9473 fi
|
|
9474 fi
|
|
9475 fi
|
|
9476 fi
|
|
9477 # Done checking deplibs!
|
|
9478 deplibs=$newdeplibs
|
|
9479 fi
|
|
9480 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
|
|
9481 case $host in
|
|
9482 *-*-darwin*)
|
|
9483 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
|
9484 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
|
9485 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
|
9486 ;;
|
|
9487 esac
|
|
9488
|
|
9489 # move library search paths that coincide with paths to not yet
|
|
9490 # installed libraries to the beginning of the library search list
|
|
9491 new_libs=
|
|
9492 for path in $notinst_path; do
|
|
9493 case " $new_libs " in
|
|
9494 *" -L$path/$objdir "*) ;;
|
|
9495 *)
|
|
9496 case " $deplibs " in
|
|
9497 *" -L$path/$objdir "*)
|
|
9498 func_append new_libs " -L$path/$objdir" ;;
|
|
9499 esac
|
|
9500 ;;
|
|
9501 esac
|
|
9502 done
|
|
9503 for deplib in $deplibs; do
|
|
9504 case $deplib in
|
|
9505 -L*)
|
|
9506 case " $new_libs " in
|
|
9507 *" $deplib "*) ;;
|
|
9508 *) func_append new_libs " $deplib" ;;
|
|
9509 esac
|
|
9510 ;;
|
|
9511 *) func_append new_libs " $deplib" ;;
|
|
9512 esac
|
|
9513 done
|
|
9514 deplibs=$new_libs
|
|
9515
|
|
9516 # All the library-specific variables (install_libdir is set above).
|
|
9517 library_names=
|
|
9518 old_library=
|
|
9519 dlname=
|
|
9520
|
|
9521 # Test again, we may have decided not to build it any more
|
|
9522 if test yes = "$build_libtool_libs"; then
|
|
9523 # Remove $wl instances when linking with ld.
|
|
9524 # FIXME: should test the right _cmds variable.
|
|
9525 case $archive_cmds in
|
|
9526 *\$LD\ *) wl= ;;
|
|
9527 esac
|
|
9528 if test yes = "$hardcode_into_libs"; then
|
|
9529 # Hardcode the library paths
|
|
9530 hardcode_libdirs=
|
|
9531 dep_rpath=
|
|
9532 rpath=$finalize_rpath
|
|
9533 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
|
|
9534 for libdir in $rpath; do
|
|
9535 if test -n "$hardcode_libdir_flag_spec"; then
|
|
9536 if test -n "$hardcode_libdir_separator"; then
|
|
9537 func_replace_sysroot "$libdir"
|
|
9538 libdir=$func_replace_sysroot_result
|
|
9539 if test -z "$hardcode_libdirs"; then
|
|
9540 hardcode_libdirs=$libdir
|
|
9541 else
|
|
9542 # Just accumulate the unique libdirs.
|
|
9543 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
|
|
9544 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
|
|
9545 ;;
|
|
9546 *)
|
|
9547 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
|
|
9548 ;;
|
|
9549 esac
|
|
9550 fi
|
|
9551 else
|
|
9552 eval flag=\"$hardcode_libdir_flag_spec\"
|
|
9553 func_append dep_rpath " $flag"
|
|
9554 fi
|
|
9555 elif test -n "$runpath_var"; then
|
|
9556 case "$perm_rpath " in
|
|
9557 *" $libdir "*) ;;
|
|
9558 *) func_append perm_rpath " $libdir" ;;
|
|
9559 esac
|
|
9560 fi
|
|
9561 done
|
|
9562 # Substitute the hardcoded libdirs into the rpath.
|
|
9563 if test -n "$hardcode_libdir_separator" &&
|
|
9564 test -n "$hardcode_libdirs"; then
|
|
9565 libdir=$hardcode_libdirs
|
|
9566 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
|
|
9567 fi
|
|
9568 if test -n "$runpath_var" && test -n "$perm_rpath"; then
|
|
9569 # We should set the runpath_var.
|
|
9570 rpath=
|
|
9571 for dir in $perm_rpath; do
|
|
9572 func_append rpath "$dir:"
|
|
9573 done
|
|
9574 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
|
|
9575 fi
|
|
9576 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
|
|
9577 fi
|
|
9578
|
|
9579 shlibpath=$finalize_shlibpath
|
|
9580 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
|
|
9581 if test -n "$shlibpath"; then
|
|
9582 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
|
|
9583 fi
|
|
9584
|
|
9585 # Get the real and link names of the library.
|
|
9586 eval shared_ext=\"$shrext_cmds\"
|
|
9587 eval library_names=\"$library_names_spec\"
|
|
9588 set dummy $library_names
|
|
9589 shift
|
|
9590 realname=$1
|
|
9591 shift
|
|
9592
|
|
9593 if test -n "$soname_spec"; then
|
|
9594 eval soname=\"$soname_spec\"
|
|
9595 else
|
|
9596 soname=$realname
|
|
9597 fi
|
|
9598 if test -z "$dlname"; then
|
|
9599 dlname=$soname
|
|
9600 fi
|
|
9601
|
|
9602 lib=$output_objdir/$realname
|
|
9603 linknames=
|
|
9604 for link
|
|
9605 do
|
|
9606 func_append linknames " $link"
|
|
9607 done
|
|
9608
|
|
9609 # Use standard objects if they are pic
|
|
9610 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
|
|
9611 test "X$libobjs" = "X " && libobjs=
|
|
9612
|
|
9613 delfiles=
|
|
9614 if test -n "$export_symbols" && test -n "$include_expsyms"; then
|
|
9615 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
|
|
9616 export_symbols=$output_objdir/$libname.uexp
|
|
9617 func_append delfiles " $export_symbols"
|
|
9618 fi
|
|
9619
|
|
9620 orig_export_symbols=
|
|
9621 case $host_os in
|
|
9622 cygwin* | mingw* | cegcc*)
|
|
9623 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
|
|
9624 # exporting using user supplied symfile
|
|
9625 func_dll_def_p "$export_symbols" || {
|
|
9626 # and it's NOT already a .def file. Must figure out
|
|
9627 # which of the given symbols are data symbols and tag
|
|
9628 # them as such. So, trigger use of export_symbols_cmds.
|
|
9629 # export_symbols gets reassigned inside the "prepare
|
|
9630 # the list of exported symbols" if statement, so the
|
|
9631 # include_expsyms logic still works.
|
|
9632 orig_export_symbols=$export_symbols
|
|
9633 export_symbols=
|
|
9634 always_export_symbols=yes
|
|
9635 }
|
|
9636 fi
|
|
9637 ;;
|
|
9638 esac
|
|
9639
|
|
9640 # Prepare the list of exported symbols
|
|
9641 if test -z "$export_symbols"; then
|
|
9642 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
|
|
9643 func_verbose "generating symbol list for '$libname.la'"
|
|
9644 export_symbols=$output_objdir/$libname.exp
|
|
9645 $opt_dry_run || $RM $export_symbols
|
|
9646 cmds=$export_symbols_cmds
|
|
9647 save_ifs=$IFS; IFS='~'
|
|
9648 for cmd1 in $cmds; do
|
|
9649 IFS=$save_ifs
|
|
9650 # Take the normal branch if the nm_file_list_spec branch
|
|
9651 # doesn't work or if tool conversion is not needed.
|
|
9652 case $nm_file_list_spec~$to_tool_file_cmd in
|
|
9653 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
|
|
9654 try_normal_branch=yes
|
|
9655 eval cmd=\"$cmd1\"
|
|
9656 func_len " $cmd"
|
|
9657 len=$func_len_result
|
|
9658 ;;
|
|
9659 *)
|
|
9660 try_normal_branch=no
|
|
9661 ;;
|
|
9662 esac
|
|
9663 if test yes = "$try_normal_branch" \
|
|
9664 && { test "$len" -lt "$max_cmd_len" \
|
|
9665 || test "$max_cmd_len" -le -1; }
|
|
9666 then
|
|
9667 func_show_eval "$cmd" 'exit $?'
|
|
9668 skipped_export=false
|
|
9669 elif test -n "$nm_file_list_spec"; then
|
|
9670 func_basename "$output"
|
|
9671 output_la=$func_basename_result
|
|
9672 save_libobjs=$libobjs
|
|
9673 save_output=$output
|
|
9674 output=$output_objdir/$output_la.nm
|
|
9675 func_to_tool_file "$output"
|
|
9676 libobjs=$nm_file_list_spec$func_to_tool_file_result
|
|
9677 func_append delfiles " $output"
|
|
9678 func_verbose "creating $NM input file list: $output"
|
|
9679 for obj in $save_libobjs; do
|
|
9680 func_to_tool_file "$obj"
|
|
9681 $ECHO "$func_to_tool_file_result"
|
|
9682 done > "$output"
|
|
9683 eval cmd=\"$cmd1\"
|
|
9684 func_show_eval "$cmd" 'exit $?'
|
|
9685 output=$save_output
|
|
9686 libobjs=$save_libobjs
|
|
9687 skipped_export=false
|
|
9688 else
|
|
9689 # The command line is too long to execute in one step.
|
|
9690 func_verbose "using reloadable object file for export list..."
|
|
9691 skipped_export=:
|
|
9692 # Break out early, otherwise skipped_export may be
|
|
9693 # set to false by a later but shorter cmd.
|
|
9694 break
|
|
9695 fi
|
|
9696 done
|
|
9697 IFS=$save_ifs
|
|
9698 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
|
|
9699 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
|
|
9700 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
|
|
9701 fi
|
|
9702 fi
|
|
9703 fi
|
|
9704
|
|
9705 if test -n "$export_symbols" && test -n "$include_expsyms"; then
|
|
9706 tmp_export_symbols=$export_symbols
|
|
9707 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
|
|
9708 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
|
|
9709 fi
|
|
9710
|
|
9711 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
|
|
9712 # The given exports_symbols file has to be filtered, so filter it.
|
|
9713 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
|
|
9714 # FIXME: $output_objdir/$libname.filter potentially contains lots of
|
|
9715 # 's' commands, which not all seds can handle. GNU sed should be fine
|
|
9716 # though. Also, the filter scales superlinearly with the number of
|
|
9717 # global variables. join(1) would be nice here, but unfortunately
|
|
9718 # isn't a blessed tool.
|
|
9719 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
|
|
9720 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
|
|
9721 export_symbols=$output_objdir/$libname.def
|
|
9722 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
|
|
9723 fi
|
|
9724
|
|
9725 tmp_deplibs=
|
|
9726 for test_deplib in $deplibs; do
|
|
9727 case " $convenience " in
|
|
9728 *" $test_deplib "*) ;;
|
|
9729 *)
|
|
9730 func_append tmp_deplibs " $test_deplib"
|
|
9731 ;;
|
|
9732 esac
|
|
9733 done
|
|
9734 deplibs=$tmp_deplibs
|
|
9735
|
|
9736 if test -n "$convenience"; then
|
|
9737 if test -n "$whole_archive_flag_spec" &&
|
|
9738 test yes = "$compiler_needs_object" &&
|
|
9739 test -z "$libobjs"; then
|
|
9740 # extract the archives, so we have objects to list.
|
|
9741 # TODO: could optimize this to just extract one archive.
|
|
9742 whole_archive_flag_spec=
|
|
9743 fi
|
|
9744 if test -n "$whole_archive_flag_spec"; then
|
|
9745 save_libobjs=$libobjs
|
|
9746 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
|
|
9747 test "X$libobjs" = "X " && libobjs=
|
|
9748 else
|
|
9749 gentop=$output_objdir/${outputname}x
|
|
9750 func_append generated " $gentop"
|
|
9751
|
|
9752 func_extract_archives $gentop $convenience
|
|
9753 func_append libobjs " $func_extract_archives_result"
|
|
9754 test "X$libobjs" = "X " && libobjs=
|
|
9755 fi
|
|
9756 fi
|
|
9757
|
|
9758 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
|
|
9759 eval flag=\"$thread_safe_flag_spec\"
|
|
9760 func_append linker_flags " $flag"
|
|
9761 fi
|
|
9762
|
|
9763 # Make a backup of the uninstalled library when relinking
|
|
9764 if test relink = "$opt_mode"; then
|
|
9765 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
|
|
9766 fi
|
|
9767
|
|
9768 # Do each of the archive commands.
|
|
9769 if test yes = "$module" && test -n "$module_cmds"; then
|
|
9770 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
|
|
9771 eval test_cmds=\"$module_expsym_cmds\"
|
|
9772 cmds=$module_expsym_cmds
|
|
9773 else
|
|
9774 eval test_cmds=\"$module_cmds\"
|
|
9775 cmds=$module_cmds
|
|
9776 fi
|
|
9777 else
|
|
9778 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
|
|
9779 eval test_cmds=\"$archive_expsym_cmds\"
|
|
9780 cmds=$archive_expsym_cmds
|
|
9781 else
|
|
9782 eval test_cmds=\"$archive_cmds\"
|
|
9783 cmds=$archive_cmds
|
|
9784 fi
|
|
9785 fi
|
|
9786
|
|
9787 if test : != "$skipped_export" &&
|
|
9788 func_len " $test_cmds" &&
|
|
9789 len=$func_len_result &&
|
|
9790 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
|
|
9791 :
|
|
9792 else
|
|
9793 # The command line is too long to link in one step, link piecewise
|
|
9794 # or, if using GNU ld and skipped_export is not :, use a linker
|
|
9795 # script.
|
|
9796
|
|
9797 # Save the value of $output and $libobjs because we want to
|
|
9798 # use them later. If we have whole_archive_flag_spec, we
|
|
9799 # want to use save_libobjs as it was before
|
|
9800 # whole_archive_flag_spec was expanded, because we can't
|
|
9801 # assume the linker understands whole_archive_flag_spec.
|
|
9802 # This may have to be revisited, in case too many
|
|
9803 # convenience libraries get linked in and end up exceeding
|
|
9804 # the spec.
|
|
9805 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
|
|
9806 save_libobjs=$libobjs
|
|
9807 fi
|
|
9808 save_output=$output
|
|
9809 func_basename "$output"
|
|
9810 output_la=$func_basename_result
|
|
9811
|
|
9812 # Clear the reloadable object creation command queue and
|
|
9813 # initialize k to one.
|
|
9814 test_cmds=
|
|
9815 concat_cmds=
|
|
9816 objlist=
|
|
9817 last_robj=
|
|
9818 k=1
|
|
9819
|
|
9820 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
|
|
9821 output=$output_objdir/$output_la.lnkscript
|
|
9822 func_verbose "creating GNU ld script: $output"
|
|
9823 echo 'INPUT (' > $output
|
|
9824 for obj in $save_libobjs
|
|
9825 do
|
|
9826 func_to_tool_file "$obj"
|
|
9827 $ECHO "$func_to_tool_file_result" >> $output
|
|
9828 done
|
|
9829 echo ')' >> $output
|
|
9830 func_append delfiles " $output"
|
|
9831 func_to_tool_file "$output"
|
|
9832 output=$func_to_tool_file_result
|
|
9833 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
|
|
9834 output=$output_objdir/$output_la.lnk
|
|
9835 func_verbose "creating linker input file list: $output"
|
|
9836 : > $output
|
|
9837 set x $save_libobjs
|
|
9838 shift
|
|
9839 firstobj=
|
|
9840 if test yes = "$compiler_needs_object"; then
|
|
9841 firstobj="$1 "
|
|
9842 shift
|
|
9843 fi
|
|
9844 for obj
|
|
9845 do
|
|
9846 func_to_tool_file "$obj"
|
|
9847 $ECHO "$func_to_tool_file_result" >> $output
|
|
9848 done
|
|
9849 func_append delfiles " $output"
|
|
9850 func_to_tool_file "$output"
|
|
9851 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
|
|
9852 else
|
|
9853 if test -n "$save_libobjs"; then
|
|
9854 func_verbose "creating reloadable object files..."
|
|
9855 output=$output_objdir/$output_la-$k.$objext
|
|
9856 eval test_cmds=\"$reload_cmds\"
|
|
9857 func_len " $test_cmds"
|
|
9858 len0=$func_len_result
|
|
9859 len=$len0
|
|
9860
|
|
9861 # Loop over the list of objects to be linked.
|
|
9862 for obj in $save_libobjs
|
|
9863 do
|
|
9864 func_len " $obj"
|
|
9865 func_arith $len + $func_len_result
|
|
9866 len=$func_arith_result
|
|
9867 if test -z "$objlist" ||
|
|
9868 test "$len" -lt "$max_cmd_len"; then
|
|
9869 func_append objlist " $obj"
|
|
9870 else
|
|
9871 # The command $test_cmds is almost too long, add a
|
|
9872 # command to the queue.
|
|
9873 if test 1 -eq "$k"; then
|
|
9874 # The first file doesn't have a previous command to add.
|
|
9875 reload_objs=$objlist
|
|
9876 eval concat_cmds=\"$reload_cmds\"
|
|
9877 else
|
|
9878 # All subsequent reloadable object files will link in
|
|
9879 # the last one created.
|
|
9880 reload_objs="$objlist $last_robj"
|
|
9881 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
|
|
9882 fi
|
|
9883 last_robj=$output_objdir/$output_la-$k.$objext
|
|
9884 func_arith $k + 1
|
|
9885 k=$func_arith_result
|
|
9886 output=$output_objdir/$output_la-$k.$objext
|
|
9887 objlist=" $obj"
|
|
9888 func_len " $last_robj"
|
|
9889 func_arith $len0 + $func_len_result
|
|
9890 len=$func_arith_result
|
|
9891 fi
|
|
9892 done
|
|
9893 # Handle the remaining objects by creating one last
|
|
9894 # reloadable object file. All subsequent reloadable object
|
|
9895 # files will link in the last one created.
|
|
9896 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
|
|
9897 reload_objs="$objlist $last_robj"
|
|
9898 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
|
|
9899 if test -n "$last_robj"; then
|
|
9900 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
|
|
9901 fi
|
|
9902 func_append delfiles " $output"
|
|
9903
|
|
9904 else
|
|
9905 output=
|
|
9906 fi
|
|
9907
|
|
9908 ${skipped_export-false} && {
|
|
9909 func_verbose "generating symbol list for '$libname.la'"
|
|
9910 export_symbols=$output_objdir/$libname.exp
|
|
9911 $opt_dry_run || $RM $export_symbols
|
|
9912 libobjs=$output
|
|
9913 # Append the command to create the export file.
|
|
9914 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
|
|
9915 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
|
|
9916 if test -n "$last_robj"; then
|
|
9917 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
|
|
9918 fi
|
|
9919 }
|
|
9920
|
|
9921 test -n "$save_libobjs" &&
|
|
9922 func_verbose "creating a temporary reloadable object file: $output"
|
|
9923
|
|
9924 # Loop through the commands generated above and execute them.
|
|
9925 save_ifs=$IFS; IFS='~'
|
|
9926 for cmd in $concat_cmds; do
|
|
9927 IFS=$save_ifs
|
|
9928 $opt_quiet || {
|
|
9929 func_quote_for_expand "$cmd"
|
|
9930 eval "func_echo $func_quote_for_expand_result"
|
|
9931 }
|
|
9932 $opt_dry_run || eval "$cmd" || {
|
|
9933 lt_exit=$?
|
|
9934
|
|
9935 # Restore the uninstalled library and exit
|
|
9936 if test relink = "$opt_mode"; then
|
|
9937 ( cd "$output_objdir" && \
|
|
9938 $RM "${realname}T" && \
|
|
9939 $MV "${realname}U" "$realname" )
|
|
9940 fi
|
|
9941
|
|
9942 exit $lt_exit
|
|
9943 }
|
|
9944 done
|
|
9945 IFS=$save_ifs
|
|
9946
|
|
9947 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
|
|
9948 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
|
|
9949 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
|
|
9950 fi
|
|
9951 fi
|
|
9952
|
|
9953 ${skipped_export-false} && {
|
|
9954 if test -n "$export_symbols" && test -n "$include_expsyms"; then
|
|
9955 tmp_export_symbols=$export_symbols
|
|
9956 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
|
|
9957 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
|
|
9958 fi
|
|
9959
|
|
9960 if test -n "$orig_export_symbols"; then
|
|
9961 # The given exports_symbols file has to be filtered, so filter it.
|
|
9962 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
|
|
9963 # FIXME: $output_objdir/$libname.filter potentially contains lots of
|
|
9964 # 's' commands, which not all seds can handle. GNU sed should be fine
|
|
9965 # though. Also, the filter scales superlinearly with the number of
|
|
9966 # global variables. join(1) would be nice here, but unfortunately
|
|
9967 # isn't a blessed tool.
|
|
9968 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
|
|
9969 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
|
|
9970 export_symbols=$output_objdir/$libname.def
|
|
9971 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
|
|
9972 fi
|
|
9973 }
|
|
9974
|
|
9975 libobjs=$output
|
|
9976 # Restore the value of output.
|
|
9977 output=$save_output
|
|
9978
|
|
9979 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
|
|
9980 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
|
|
9981 test "X$libobjs" = "X " && libobjs=
|
|
9982 fi
|
|
9983 # Expand the library linking commands again to reset the
|
|
9984 # value of $libobjs for piecewise linking.
|
|
9985
|
|
9986 # Do each of the archive commands.
|
|
9987 if test yes = "$module" && test -n "$module_cmds"; then
|
|
9988 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
|
|
9989 cmds=$module_expsym_cmds
|
|
9990 else
|
|
9991 cmds=$module_cmds
|
|
9992 fi
|
|
9993 else
|
|
9994 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
|
|
9995 cmds=$archive_expsym_cmds
|
|
9996 else
|
|
9997 cmds=$archive_cmds
|
|
9998 fi
|
|
9999 fi
|
|
10000 fi
|
|
10001
|
|
10002 if test -n "$delfiles"; then
|
|
10003 # Append the command to remove temporary files to $cmds.
|
|
10004 eval cmds=\"\$cmds~\$RM $delfiles\"
|
|
10005 fi
|
|
10006
|
|
10007 # Add any objects from preloaded convenience libraries
|
|
10008 if test -n "$dlprefiles"; then
|
|
10009 gentop=$output_objdir/${outputname}x
|
|
10010 func_append generated " $gentop"
|
|
10011
|
|
10012 func_extract_archives $gentop $dlprefiles
|
|
10013 func_append libobjs " $func_extract_archives_result"
|
|
10014 test "X$libobjs" = "X " && libobjs=
|
|
10015 fi
|
|
10016
|
|
10017 save_ifs=$IFS; IFS='~'
|
|
10018 for cmd in $cmds; do
|
|
10019 IFS=$sp$nl
|
|
10020 eval cmd=\"$cmd\"
|
|
10021 IFS=$save_ifs
|
|
10022 $opt_quiet || {
|
|
10023 func_quote_for_expand "$cmd"
|
|
10024 eval "func_echo $func_quote_for_expand_result"
|
|
10025 }
|
|
10026 $opt_dry_run || eval "$cmd" || {
|
|
10027 lt_exit=$?
|
|
10028
|
|
10029 # Restore the uninstalled library and exit
|
|
10030 if test relink = "$opt_mode"; then
|
|
10031 ( cd "$output_objdir" && \
|
|
10032 $RM "${realname}T" && \
|
|
10033 $MV "${realname}U" "$realname" )
|
|
10034 fi
|
|
10035
|
|
10036 exit $lt_exit
|
|
10037 }
|
|
10038 done
|
|
10039 IFS=$save_ifs
|
|
10040
|
|
10041 # Restore the uninstalled library and exit
|
|
10042 if test relink = "$opt_mode"; then
|
|
10043 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
|
|
10044
|
|
10045 if test -n "$convenience"; then
|
|
10046 if test -z "$whole_archive_flag_spec"; then
|
|
10047 func_show_eval '${RM}r "$gentop"'
|
|
10048 fi
|
|
10049 fi
|
|
10050
|
|
10051 exit $EXIT_SUCCESS
|
|
10052 fi
|
|
10053
|
|
10054 # Create links to the real library.
|
|
10055 for linkname in $linknames; do
|
|
10056 if test "$realname" != "$linkname"; then
|
|
10057 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
|
|
10058 fi
|
|
10059 done
|
|
10060
|
|
10061 # If -module or -export-dynamic was specified, set the dlname.
|
|
10062 if test yes = "$module" || test yes = "$export_dynamic"; then
|
|
10063 # On all known operating systems, these are identical.
|
|
10064 dlname=$soname
|
|
10065 fi
|
|
10066 fi
|
|
10067 ;;
|
|
10068
|
|
10069 obj)
|
|
10070 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
|
|
10071 func_warning "'-dlopen' is ignored for objects"
|
|
10072 fi
|
|
10073
|
|
10074 case " $deplibs" in
|
|
10075 *\ -l* | *\ -L*)
|
|
10076 func_warning "'-l' and '-L' are ignored for objects" ;;
|
|
10077 esac
|
|
10078
|
|
10079 test -n "$rpath" && \
|
|
10080 func_warning "'-rpath' is ignored for objects"
|
|
10081
|
|
10082 test -n "$xrpath" && \
|
|
10083 func_warning "'-R' is ignored for objects"
|
|
10084
|
|
10085 test -n "$vinfo" && \
|
|
10086 func_warning "'-version-info' is ignored for objects"
|
|
10087
|
|
10088 test -n "$release" && \
|
|
10089 func_warning "'-release' is ignored for objects"
|
|
10090
|
|
10091 case $output in
|
|
10092 *.lo)
|
|
10093 test -n "$objs$old_deplibs" && \
|
|
10094 func_fatal_error "cannot build library object '$output' from non-libtool objects"
|
|
10095
|
|
10096 libobj=$output
|
|
10097 func_lo2o "$libobj"
|
|
10098 obj=$func_lo2o_result
|
|
10099 ;;
|
|
10100 *)
|
|
10101 libobj=
|
|
10102 obj=$output
|
|
10103 ;;
|
|
10104 esac
|
|
10105
|
|
10106 # Delete the old objects.
|
|
10107 $opt_dry_run || $RM $obj $libobj
|
|
10108
|
|
10109 # Objects from convenience libraries. This assumes
|
|
10110 # single-version convenience libraries. Whenever we create
|
|
10111 # different ones for PIC/non-PIC, this we'll have to duplicate
|
|
10112 # the extraction.
|
|
10113 reload_conv_objs=
|
|
10114 gentop=
|
|
10115 # if reload_cmds runs $LD directly, get rid of -Wl from
|
|
10116 # whole_archive_flag_spec and hope we can get by with turning comma
|
|
10117 # into space.
|
|
10118 case $reload_cmds in
|
|
10119 *\$LD[\ \$]*) wl= ;;
|
|
10120 esac
|
|
10121 if test -n "$convenience"; then
|
|
10122 if test -n "$whole_archive_flag_spec"; then
|
|
10123 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
|
|
10124 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
|
|
10125 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
|
|
10126 else
|
|
10127 gentop=$output_objdir/${obj}x
|
|
10128 func_append generated " $gentop"
|
|
10129
|
|
10130 func_extract_archives $gentop $convenience
|
|
10131 reload_conv_objs="$reload_objs $func_extract_archives_result"
|
|
10132 fi
|
|
10133 fi
|
|
10134
|
|
10135 # If we're not building shared, we need to use non_pic_objs
|
|
10136 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
|
|
10137
|
|
10138 # Create the old-style object.
|
|
10139 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
|
|
10140
|
|
10141 output=$obj
|
|
10142 func_execute_cmds "$reload_cmds" 'exit $?'
|
|
10143
|
|
10144 # Exit if we aren't doing a library object file.
|
|
10145 if test -z "$libobj"; then
|
|
10146 if test -n "$gentop"; then
|
|
10147 func_show_eval '${RM}r "$gentop"'
|
|
10148 fi
|
|
10149
|
|
10150 exit $EXIT_SUCCESS
|
|
10151 fi
|
|
10152
|
|
10153 test yes = "$build_libtool_libs" || {
|
|
10154 if test -n "$gentop"; then
|
|
10155 func_show_eval '${RM}r "$gentop"'
|
|
10156 fi
|
|
10157
|
|
10158 # Create an invalid libtool object if no PIC, so that we don't
|
|
10159 # accidentally link it into a program.
|
|
10160 # $show "echo timestamp > $libobj"
|
|
10161 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
|
|
10162 exit $EXIT_SUCCESS
|
|
10163 }
|
|
10164
|
|
10165 if test -n "$pic_flag" || test default != "$pic_mode"; then
|
|
10166 # Only do commands if we really have different PIC objects.
|
|
10167 reload_objs="$libobjs $reload_conv_objs"
|
|
10168 output=$libobj
|
|
10169 func_execute_cmds "$reload_cmds" 'exit $?'
|
|
10170 fi
|
|
10171
|
|
10172 if test -n "$gentop"; then
|
|
10173 func_show_eval '${RM}r "$gentop"'
|
|
10174 fi
|
|
10175
|
|
10176 exit $EXIT_SUCCESS
|
|
10177 ;;
|
|
10178
|
|
10179 prog)
|
|
10180 case $host in
|
|
10181 *cygwin*) func_stripname '' '.exe' "$output"
|
|
10182 output=$func_stripname_result.exe;;
|
|
10183 esac
|
|
10184 test -n "$vinfo" && \
|
|
10185 func_warning "'-version-info' is ignored for programs"
|
|
10186
|
|
10187 test -n "$release" && \
|
|
10188 func_warning "'-release' is ignored for programs"
|
|
10189
|
|
10190 $preload \
|
|
10191 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
|
|
10192 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
|
|
10193
|
|
10194 case $host in
|
|
10195 *-*-rhapsody* | *-*-darwin1.[012])
|
|
10196 # On Rhapsody replace the C library is the System framework
|
|
10197 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
|
|
10198 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
|
|
10199 ;;
|
|
10200 esac
|
|
10201
|
|
10202 case $host in
|
|
10203 *-*-darwin*)
|
|
10204 # Don't allow lazy linking, it breaks C++ global constructors
|
|
10205 # But is supposedly fixed on 10.4 or later (yay!).
|
|
10206 if test CXX = "$tagname"; then
|
|
10207 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
|
|
10208 10.[0123])
|
|
10209 func_append compile_command " $wl-bind_at_load"
|
|
10210 func_append finalize_command " $wl-bind_at_load"
|
|
10211 ;;
|
|
10212 esac
|
|
10213 fi
|
|
10214 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
|
|
10215 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
|
10216 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
|
|
10217 ;;
|
|
10218 esac
|
|
10219
|
|
10220
|
|
10221 # move library search paths that coincide with paths to not yet
|
|
10222 # installed libraries to the beginning of the library search list
|
|
10223 new_libs=
|
|
10224 for path in $notinst_path; do
|
|
10225 case " $new_libs " in
|
|
10226 *" -L$path/$objdir "*) ;;
|
|
10227 *)
|
|
10228 case " $compile_deplibs " in
|
|
10229 *" -L$path/$objdir "*)
|
|
10230 func_append new_libs " -L$path/$objdir" ;;
|
|
10231 esac
|
|
10232 ;;
|
|
10233 esac
|
|
10234 done
|
|
10235 for deplib in $compile_deplibs; do
|
|
10236 case $deplib in
|
|
10237 -L*)
|
|
10238 case " $new_libs " in
|
|
10239 *" $deplib "*) ;;
|
|
10240 *) func_append new_libs " $deplib" ;;
|
|
10241 esac
|
|
10242 ;;
|
|
10243 *) func_append new_libs " $deplib" ;;
|
|
10244 esac
|
|
10245 done
|
|
10246 compile_deplibs=$new_libs
|
|
10247
|
|
10248
|
|
10249 func_append compile_command " $compile_deplibs"
|
|
10250 func_append finalize_command " $finalize_deplibs"
|
|
10251
|
|
10252 if test -n "$rpath$xrpath"; then
|
|
10253 # If the user specified any rpath flags, then add them.
|
|
10254 for libdir in $rpath $xrpath; do
|
|
10255 # This is the magic to use -rpath.
|
|
10256 case "$finalize_rpath " in
|
|
10257 *" $libdir "*) ;;
|
|
10258 *) func_append finalize_rpath " $libdir" ;;
|
|
10259 esac
|
|
10260 done
|
|
10261 fi
|
|
10262
|
|
10263 # Now hardcode the library paths
|
|
10264 rpath=
|
|
10265 hardcode_libdirs=
|
|
10266 for libdir in $compile_rpath $finalize_rpath; do
|
|
10267 if test -n "$hardcode_libdir_flag_spec"; then
|
|
10268 if test -n "$hardcode_libdir_separator"; then
|
|
10269 if test -z "$hardcode_libdirs"; then
|
|
10270 hardcode_libdirs=$libdir
|
|
10271 else
|
|
10272 # Just accumulate the unique libdirs.
|
|
10273 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
|
|
10274 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
|
|
10275 ;;
|
|
10276 *)
|
|
10277 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
|
|
10278 ;;
|
|
10279 esac
|
|
10280 fi
|
|
10281 else
|
|
10282 eval flag=\"$hardcode_libdir_flag_spec\"
|
|
10283 func_append rpath " $flag"
|
|
10284 fi
|
|
10285 elif test -n "$runpath_var"; then
|
|
10286 case "$perm_rpath " in
|
|
10287 *" $libdir "*) ;;
|
|
10288 *) func_append perm_rpath " $libdir" ;;
|
|
10289 esac
|
|
10290 fi
|
|
10291 case $host in
|
|
10292 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
|
|
10293 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
|
|
10294 case :$dllsearchpath: in
|
|
10295 *":$libdir:"*) ;;
|
|
10296 ::) dllsearchpath=$libdir;;
|
|
10297 *) func_append dllsearchpath ":$libdir";;
|
|
10298 esac
|
|
10299 case :$dllsearchpath: in
|
|
10300 *":$testbindir:"*) ;;
|
|
10301 ::) dllsearchpath=$testbindir;;
|
|
10302 *) func_append dllsearchpath ":$testbindir";;
|
|
10303 esac
|
|
10304 ;;
|
|
10305 esac
|
|
10306 done
|
|
10307 # Substitute the hardcoded libdirs into the rpath.
|
|
10308 if test -n "$hardcode_libdir_separator" &&
|
|
10309 test -n "$hardcode_libdirs"; then
|
|
10310 libdir=$hardcode_libdirs
|
|
10311 eval rpath=\" $hardcode_libdir_flag_spec\"
|
|
10312 fi
|
|
10313 compile_rpath=$rpath
|
|
10314
|
|
10315 rpath=
|
|
10316 hardcode_libdirs=
|
|
10317 for libdir in $finalize_rpath; do
|
|
10318 if test -n "$hardcode_libdir_flag_spec"; then
|
|
10319 if test -n "$hardcode_libdir_separator"; then
|
|
10320 if test -z "$hardcode_libdirs"; then
|
|
10321 hardcode_libdirs=$libdir
|
|
10322 else
|
|
10323 # Just accumulate the unique libdirs.
|
|
10324 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
|
|
10325 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
|
|
10326 ;;
|
|
10327 *)
|
|
10328 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
|
|
10329 ;;
|
|
10330 esac
|
|
10331 fi
|
|
10332 else
|
|
10333 eval flag=\"$hardcode_libdir_flag_spec\"
|
|
10334 func_append rpath " $flag"
|
|
10335 fi
|
|
10336 elif test -n "$runpath_var"; then
|
|
10337 case "$finalize_perm_rpath " in
|
|
10338 *" $libdir "*) ;;
|
|
10339 *) func_append finalize_perm_rpath " $libdir" ;;
|
|
10340 esac
|
|
10341 fi
|
|
10342 done
|
|
10343 # Substitute the hardcoded libdirs into the rpath.
|
|
10344 if test -n "$hardcode_libdir_separator" &&
|
|
10345 test -n "$hardcode_libdirs"; then
|
|
10346 libdir=$hardcode_libdirs
|
|
10347 eval rpath=\" $hardcode_libdir_flag_spec\"
|
|
10348 fi
|
|
10349 finalize_rpath=$rpath
|
|
10350
|
|
10351 if test -n "$libobjs" && test yes = "$build_old_libs"; then
|
|
10352 # Transform all the library objects into standard objects.
|
|
10353 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
|
|
10354 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
|
|
10355 fi
|
|
10356
|
|
10357 func_generate_dlsyms "$outputname" "@PROGRAM@" false
|
|
10358
|
|
10359 # template prelinking step
|
|
10360 if test -n "$prelink_cmds"; then
|
|
10361 func_execute_cmds "$prelink_cmds" 'exit $?'
|
|
10362 fi
|
|
10363
|
|
10364 wrappers_required=:
|
|
10365 case $host in
|
|
10366 *cegcc* | *mingw32ce*)
|
|
10367 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
|
|
10368 wrappers_required=false
|
|
10369 ;;
|
|
10370 *cygwin* | *mingw* )
|
|
10371 test yes = "$build_libtool_libs" || wrappers_required=false
|
|
10372 ;;
|
|
10373 *)
|
|
10374 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
|
|
10375 wrappers_required=false
|
|
10376 fi
|
|
10377 ;;
|
|
10378 esac
|
|
10379 $wrappers_required || {
|
|
10380 # Replace the output file specification.
|
|
10381 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
|
|
10382 link_command=$compile_command$compile_rpath
|
|
10383
|
|
10384 # We have no uninstalled library dependencies, so finalize right now.
|
|
10385 exit_status=0
|
|
10386 func_show_eval "$link_command" 'exit_status=$?'
|
|
10387
|
|
10388 if test -n "$postlink_cmds"; then
|
|
10389 func_to_tool_file "$output"
|
|
10390 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
|
|
10391 func_execute_cmds "$postlink_cmds" 'exit $?'
|
|
10392 fi
|
|
10393
|
|
10394 # Delete the generated files.
|
|
10395 if test -f "$output_objdir/${outputname}S.$objext"; then
|
|
10396 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
|
|
10397 fi
|
|
10398
|
|
10399 exit $exit_status
|
|
10400 }
|
|
10401
|
|
10402 if test -n "$compile_shlibpath$finalize_shlibpath"; then
|
|
10403 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
|
|
10404 fi
|
|
10405 if test -n "$finalize_shlibpath"; then
|
|
10406 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
|
|
10407 fi
|
|
10408
|
|
10409 compile_var=
|
|
10410 finalize_var=
|
|
10411 if test -n "$runpath_var"; then
|
|
10412 if test -n "$perm_rpath"; then
|
|
10413 # We should set the runpath_var.
|
|
10414 rpath=
|
|
10415 for dir in $perm_rpath; do
|
|
10416 func_append rpath "$dir:"
|
|
10417 done
|
|
10418 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
|
|
10419 fi
|
|
10420 if test -n "$finalize_perm_rpath"; then
|
|
10421 # We should set the runpath_var.
|
|
10422 rpath=
|
|
10423 for dir in $finalize_perm_rpath; do
|
|
10424 func_append rpath "$dir:"
|
|
10425 done
|
|
10426 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
|
|
10427 fi
|
|
10428 fi
|
|
10429
|
|
10430 if test yes = "$no_install"; then
|
|
10431 # We don't need to create a wrapper script.
|
|
10432 link_command=$compile_var$compile_command$compile_rpath
|
|
10433 # Replace the output file specification.
|
|
10434 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
|
|
10435 # Delete the old output file.
|
|
10436 $opt_dry_run || $RM $output
|
|
10437 # Link the executable and exit
|
|
10438 func_show_eval "$link_command" 'exit $?'
|
|
10439
|
|
10440 if test -n "$postlink_cmds"; then
|
|
10441 func_to_tool_file "$output"
|
|
10442 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
|
|
10443 func_execute_cmds "$postlink_cmds" 'exit $?'
|
|
10444 fi
|
|
10445
|
|
10446 exit $EXIT_SUCCESS
|
|
10447 fi
|
|
10448
|
|
10449 case $hardcode_action,$fast_install in
|
|
10450 relink,*)
|
|
10451 # Fast installation is not supported
|
|
10452 link_command=$compile_var$compile_command$compile_rpath
|
|
10453 relink_command=$finalize_var$finalize_command$finalize_rpath
|
|
10454
|
|
10455 func_warning "this platform does not like uninstalled shared libraries"
|
|
10456 func_warning "'$output' will be relinked during installation"
|
|
10457 ;;
|
|
10458 *,yes)
|
|
10459 link_command=$finalize_var$compile_command$finalize_rpath
|
|
10460 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
|
|
10461 ;;
|
|
10462 *,no)
|
|
10463 link_command=$compile_var$compile_command$compile_rpath
|
|
10464 relink_command=$finalize_var$finalize_command$finalize_rpath
|
|
10465 ;;
|
|
10466 *,needless)
|
|
10467 link_command=$finalize_var$compile_command$finalize_rpath
|
|
10468 relink_command=
|
|
10469 ;;
|
|
10470 esac
|
|
10471
|
|
10472 # Replace the output file specification.
|
|
10473 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
|
|
10474
|
|
10475 # Delete the old output files.
|
|
10476 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
|
|
10477
|
|
10478 func_show_eval "$link_command" 'exit $?'
|
|
10479
|
|
10480 if test -n "$postlink_cmds"; then
|
|
10481 func_to_tool_file "$output_objdir/$outputname"
|
|
10482 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
|
|
10483 func_execute_cmds "$postlink_cmds" 'exit $?'
|
|
10484 fi
|
|
10485
|
|
10486 # Now create the wrapper script.
|
|
10487 func_verbose "creating $output"
|
|
10488
|
|
10489 # Quote the relink command for shipping.
|
|
10490 if test -n "$relink_command"; then
|
|
10491 # Preserve any variables that may affect compiler behavior
|
|
10492 for var in $variables_saved_for_relink; do
|
|
10493 if eval test -z \"\${$var+set}\"; then
|
|
10494 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
|
|
10495 elif eval var_value=\$$var; test -z "$var_value"; then
|
|
10496 relink_command="$var=; export $var; $relink_command"
|
|
10497 else
|
|
10498 func_quote_for_eval "$var_value"
|
|
10499 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
|
|
10500 fi
|
|
10501 done
|
|
10502 relink_command="(cd `pwd`; $relink_command)"
|
|
10503 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
|
|
10504 fi
|
|
10505
|
|
10506 # Only actually do things if not in dry run mode.
|
|
10507 $opt_dry_run || {
|
|
10508 # win32 will think the script is a binary if it has
|
|
10509 # a .exe suffix, so we strip it off here.
|
|
10510 case $output in
|
|
10511 *.exe) func_stripname '' '.exe' "$output"
|
|
10512 output=$func_stripname_result ;;
|
|
10513 esac
|
|
10514 # test for cygwin because mv fails w/o .exe extensions
|
|
10515 case $host in
|
|
10516 *cygwin*)
|
|
10517 exeext=.exe
|
|
10518 func_stripname '' '.exe' "$outputname"
|
|
10519 outputname=$func_stripname_result ;;
|
|
10520 *) exeext= ;;
|
|
10521 esac
|
|
10522 case $host in
|
|
10523 *cygwin* | *mingw* )
|
|
10524 func_dirname_and_basename "$output" "" "."
|
|
10525 output_name=$func_basename_result
|
|
10526 output_path=$func_dirname_result
|
|
10527 cwrappersource=$output_path/$objdir/lt-$output_name.c
|
|
10528 cwrapper=$output_path/$output_name.exe
|
|
10529 $RM $cwrappersource $cwrapper
|
|
10530 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
|
|
10531
|
|
10532 func_emit_cwrapperexe_src > $cwrappersource
|
|
10533
|
|
10534 # The wrapper executable is built using the $host compiler,
|
|
10535 # because it contains $host paths and files. If cross-
|
|
10536 # compiling, it, like the target executable, must be
|
|
10537 # executed on the $host or under an emulation environment.
|
|
10538 $opt_dry_run || {
|
|
10539 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
|
|
10540 $STRIP $cwrapper
|
|
10541 }
|
|
10542
|
|
10543 # Now, create the wrapper script for func_source use:
|
|
10544 func_ltwrapper_scriptname $cwrapper
|
|
10545 $RM $func_ltwrapper_scriptname_result
|
|
10546 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
|
|
10547 $opt_dry_run || {
|
|
10548 # note: this script will not be executed, so do not chmod.
|
|
10549 if test "x$build" = "x$host"; then
|
|
10550 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
|
|
10551 else
|
|
10552 func_emit_wrapper no > $func_ltwrapper_scriptname_result
|
|
10553 fi
|
|
10554 }
|
|
10555 ;;
|
|
10556 * )
|
|
10557 $RM $output
|
|
10558 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
|
|
10559
|
|
10560 func_emit_wrapper no > $output
|
|
10561 chmod +x $output
|
|
10562 ;;
|
|
10563 esac
|
|
10564 }
|
|
10565 exit $EXIT_SUCCESS
|
|
10566 ;;
|
|
10567 esac
|
|
10568
|
|
10569 # See if we need to build an old-fashioned archive.
|
|
10570 for oldlib in $oldlibs; do
|
|
10571
|
|
10572 case $build_libtool_libs in
|
|
10573 convenience)
|
|
10574 oldobjs="$libobjs_save $symfileobj"
|
|
10575 addlibs=$convenience
|
|
10576 build_libtool_libs=no
|
|
10577 ;;
|
|
10578 module)
|
|
10579 oldobjs=$libobjs_save
|
|
10580 addlibs=$old_convenience
|
|
10581 build_libtool_libs=no
|
|
10582 ;;
|
|
10583 *)
|
|
10584 oldobjs="$old_deplibs $non_pic_objects"
|
|
10585 $preload && test -f "$symfileobj" \
|
|
10586 && func_append oldobjs " $symfileobj"
|
|
10587 addlibs=$old_convenience
|
|
10588 ;;
|
|
10589 esac
|
|
10590
|
|
10591 if test -n "$addlibs"; then
|
|
10592 gentop=$output_objdir/${outputname}x
|
|
10593 func_append generated " $gentop"
|
|
10594
|
|
10595 func_extract_archives $gentop $addlibs
|
|
10596 func_append oldobjs " $func_extract_archives_result"
|
|
10597 fi
|
|
10598
|
|
10599 # Do each command in the archive commands.
|
|
10600 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
|
|
10601 cmds=$old_archive_from_new_cmds
|
|
10602 else
|
|
10603
|
|
10604 # Add any objects from preloaded convenience libraries
|
|
10605 if test -n "$dlprefiles"; then
|
|
10606 gentop=$output_objdir/${outputname}x
|
|
10607 func_append generated " $gentop"
|
|
10608
|
|
10609 func_extract_archives $gentop $dlprefiles
|
|
10610 func_append oldobjs " $func_extract_archives_result"
|
|
10611 fi
|
|
10612
|
|
10613 # POSIX demands no paths to be encoded in archives. We have
|
|
10614 # to avoid creating archives with duplicate basenames if we
|
|
10615 # might have to extract them afterwards, e.g., when creating a
|
|
10616 # static archive out of a convenience library, or when linking
|
|
10617 # the entirety of a libtool archive into another (currently
|
|
10618 # not supported by libtool).
|
|
10619 if (for obj in $oldobjs
|
|
10620 do
|
|
10621 func_basename "$obj"
|
|
10622 $ECHO "$func_basename_result"
|
|
10623 done | sort | sort -uc >/dev/null 2>&1); then
|
|
10624 :
|
|
10625 else
|
|
10626 echo "copying selected object files to avoid basename conflicts..."
|
|
10627 gentop=$output_objdir/${outputname}x
|
|
10628 func_append generated " $gentop"
|
|
10629 func_mkdir_p "$gentop"
|
|
10630 save_oldobjs=$oldobjs
|
|
10631 oldobjs=
|
|
10632 counter=1
|
|
10633 for obj in $save_oldobjs
|
|
10634 do
|
|
10635 func_basename "$obj"
|
|
10636 objbase=$func_basename_result
|
|
10637 case " $oldobjs " in
|
|
10638 " ") oldobjs=$obj ;;
|
|
10639 *[\ /]"$objbase "*)
|
|
10640 while :; do
|
|
10641 # Make sure we don't pick an alternate name that also
|
|
10642 # overlaps.
|
|
10643 newobj=lt$counter-$objbase
|
|
10644 func_arith $counter + 1
|
|
10645 counter=$func_arith_result
|
|
10646 case " $oldobjs " in
|
|
10647 *[\ /]"$newobj "*) ;;
|
|
10648 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
|
|
10649 esac
|
|
10650 done
|
|
10651 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
|
|
10652 func_append oldobjs " $gentop/$newobj"
|
|
10653 ;;
|
|
10654 *) func_append oldobjs " $obj" ;;
|
|
10655 esac
|
|
10656 done
|
|
10657 fi
|
|
10658 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
|
|
10659 tool_oldlib=$func_to_tool_file_result
|
|
10660 eval cmds=\"$old_archive_cmds\"
|
|
10661
|
|
10662 func_len " $cmds"
|
|
10663 len=$func_len_result
|
|
10664 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
|
|
10665 cmds=$old_archive_cmds
|
|
10666 elif test -n "$archiver_list_spec"; then
|
|
10667 func_verbose "using command file archive linking..."
|
|
10668 for obj in $oldobjs
|
|
10669 do
|
|
10670 func_to_tool_file "$obj"
|
|
10671 $ECHO "$func_to_tool_file_result"
|
|
10672 done > $output_objdir/$libname.libcmd
|
|
10673 func_to_tool_file "$output_objdir/$libname.libcmd"
|
|
10674 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
|
|
10675 cmds=$old_archive_cmds
|
|
10676 else
|
|
10677 # the command line is too long to link in one step, link in parts
|
|
10678 func_verbose "using piecewise archive linking..."
|
|
10679 save_RANLIB=$RANLIB
|
|
10680 RANLIB=:
|
|
10681 objlist=
|
|
10682 concat_cmds=
|
|
10683 save_oldobjs=$oldobjs
|
|
10684 oldobjs=
|
|
10685 # Is there a better way of finding the last object in the list?
|
|
10686 for obj in $save_oldobjs
|
|
10687 do
|
|
10688 last_oldobj=$obj
|
|
10689 done
|
|
10690 eval test_cmds=\"$old_archive_cmds\"
|
|
10691 func_len " $test_cmds"
|
|
10692 len0=$func_len_result
|
|
10693 len=$len0
|
|
10694 for obj in $save_oldobjs
|
|
10695 do
|
|
10696 func_len " $obj"
|
|
10697 func_arith $len + $func_len_result
|
|
10698 len=$func_arith_result
|
|
10699 func_append objlist " $obj"
|
|
10700 if test "$len" -lt "$max_cmd_len"; then
|
|
10701 :
|
|
10702 else
|
|
10703 # the above command should be used before it gets too long
|
|
10704 oldobjs=$objlist
|
|
10705 if test "$obj" = "$last_oldobj"; then
|
|
10706 RANLIB=$save_RANLIB
|
|
10707 fi
|
|
10708 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
|
|
10709 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
|
|
10710 objlist=
|
|
10711 len=$len0
|
|
10712 fi
|
|
10713 done
|
|
10714 RANLIB=$save_RANLIB
|
|
10715 oldobjs=$objlist
|
|
10716 if test -z "$oldobjs"; then
|
|
10717 eval cmds=\"\$concat_cmds\"
|
|
10718 else
|
|
10719 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
|
|
10720 fi
|
|
10721 fi
|
|
10722 fi
|
|
10723 func_execute_cmds "$cmds" 'exit $?'
|
|
10724 done
|
|
10725
|
|
10726 test -n "$generated" && \
|
|
10727 func_show_eval "${RM}r$generated"
|
|
10728
|
|
10729 # Now create the libtool archive.
|
|
10730 case $output in
|
|
10731 *.la)
|
|
10732 old_library=
|
|
10733 test yes = "$build_old_libs" && old_library=$libname.$libext
|
|
10734 func_verbose "creating $output"
|
|
10735
|
|
10736 # Preserve any variables that may affect compiler behavior
|
|
10737 for var in $variables_saved_for_relink; do
|
|
10738 if eval test -z \"\${$var+set}\"; then
|
|
10739 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
|
|
10740 elif eval var_value=\$$var; test -z "$var_value"; then
|
|
10741 relink_command="$var=; export $var; $relink_command"
|
|
10742 else
|
|
10743 func_quote_for_eval "$var_value"
|
|
10744 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
|
|
10745 fi
|
|
10746 done
|
|
10747 # Quote the link command for shipping.
|
|
10748 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
|
|
10749 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
|
|
10750 if test yes = "$hardcode_automatic"; then
|
|
10751 relink_command=
|
|
10752 fi
|
|
10753
|
|
10754 # Only create the output if not a dry run.
|
|
10755 $opt_dry_run || {
|
|
10756 for installed in no yes; do
|
|
10757 if test yes = "$installed"; then
|
|
10758 if test -z "$install_libdir"; then
|
|
10759 break
|
|
10760 fi
|
|
10761 output=$output_objdir/${outputname}i
|
|
10762 # Replace all uninstalled libtool libraries with the installed ones
|
|
10763 newdependency_libs=
|
|
10764 for deplib in $dependency_libs; do
|
|
10765 case $deplib in
|
|
10766 *.la)
|
|
10767 func_basename "$deplib"
|
|
10768 name=$func_basename_result
|
|
10769 func_resolve_sysroot "$deplib"
|
|
10770 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
|
|
10771 test -z "$libdir" && \
|
|
10772 func_fatal_error "'$deplib' is not a valid libtool archive"
|
|
10773 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
|
|
10774 ;;
|
|
10775 -L*)
|
|
10776 func_stripname -L '' "$deplib"
|
|
10777 func_replace_sysroot "$func_stripname_result"
|
|
10778 func_append newdependency_libs " -L$func_replace_sysroot_result"
|
|
10779 ;;
|
|
10780 -R*)
|
|
10781 func_stripname -R '' "$deplib"
|
|
10782 func_replace_sysroot "$func_stripname_result"
|
|
10783 func_append newdependency_libs " -R$func_replace_sysroot_result"
|
|
10784 ;;
|
|
10785 *) func_append newdependency_libs " $deplib" ;;
|
|
10786 esac
|
|
10787 done
|
|
10788 dependency_libs=$newdependency_libs
|
|
10789 newdlfiles=
|
|
10790
|
|
10791 for lib in $dlfiles; do
|
|
10792 case $lib in
|
|
10793 *.la)
|
|
10794 func_basename "$lib"
|
|
10795 name=$func_basename_result
|
|
10796 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
|
|
10797 test -z "$libdir" && \
|
|
10798 func_fatal_error "'$lib' is not a valid libtool archive"
|
|
10799 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
|
|
10800 ;;
|
|
10801 *) func_append newdlfiles " $lib" ;;
|
|
10802 esac
|
|
10803 done
|
|
10804 dlfiles=$newdlfiles
|
|
10805 newdlprefiles=
|
|
10806 for lib in $dlprefiles; do
|
|
10807 case $lib in
|
|
10808 *.la)
|
|
10809 # Only pass preopened files to the pseudo-archive (for
|
|
10810 # eventual linking with the app. that links it) if we
|
|
10811 # didn't already link the preopened objects directly into
|
|
10812 # the library:
|
|
10813 func_basename "$lib"
|
|
10814 name=$func_basename_result
|
|
10815 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
|
|
10816 test -z "$libdir" && \
|
|
10817 func_fatal_error "'$lib' is not a valid libtool archive"
|
|
10818 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
|
|
10819 ;;
|
|
10820 esac
|
|
10821 done
|
|
10822 dlprefiles=$newdlprefiles
|
|
10823 else
|
|
10824 newdlfiles=
|
|
10825 for lib in $dlfiles; do
|
|
10826 case $lib in
|
|
10827 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
|
|
10828 *) abs=`pwd`"/$lib" ;;
|
|
10829 esac
|
|
10830 func_append newdlfiles " $abs"
|
|
10831 done
|
|
10832 dlfiles=$newdlfiles
|
|
10833 newdlprefiles=
|
|
10834 for lib in $dlprefiles; do
|
|
10835 case $lib in
|
|
10836 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
|
|
10837 *) abs=`pwd`"/$lib" ;;
|
|
10838 esac
|
|
10839 func_append newdlprefiles " $abs"
|
|
10840 done
|
|
10841 dlprefiles=$newdlprefiles
|
|
10842 fi
|
|
10843 $RM $output
|
|
10844 # place dlname in correct position for cygwin
|
|
10845 # In fact, it would be nice if we could use this code for all target
|
|
10846 # systems that can't hard-code library paths into their executables
|
|
10847 # and that have no shared library path variable independent of PATH,
|
|
10848 # but it turns out we can't easily determine that from inspecting
|
|
10849 # libtool variables, so we have to hard-code the OSs to which it
|
|
10850 # applies here; at the moment, that means platforms that use the PE
|
|
10851 # object format with DLL files. See the long comment at the top of
|
|
10852 # tests/bindir.at for full details.
|
|
10853 tdlname=$dlname
|
|
10854 case $host,$output,$installed,$module,$dlname in
|
|
10855 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
|
|
10856 # If a -bindir argument was supplied, place the dll there.
|
|
10857 if test -n "$bindir"; then
|
|
10858 func_relative_path "$install_libdir" "$bindir"
|
|
10859 tdlname=$func_relative_path_result/$dlname
|
|
10860 else
|
|
10861 # Otherwise fall back on heuristic.
|
|
10862 tdlname=../bin/$dlname
|
|
10863 fi
|
|
10864 ;;
|
|
10865 esac
|
|
10866 $ECHO > $output "\
|
|
10867 # $outputname - a libtool library file
|
|
10868 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
|
|
10869 #
|
|
10870 # Please DO NOT delete this file!
|
|
10871 # It is necessary for linking the library.
|
|
10872
|
|
10873 # The name that we can dlopen(3).
|
|
10874 dlname='$tdlname'
|
|
10875
|
|
10876 # Names of this library.
|
|
10877 library_names='$library_names'
|
|
10878
|
|
10879 # The name of the static archive.
|
|
10880 old_library='$old_library'
|
|
10881
|
|
10882 # Linker flags that cannot go in dependency_libs.
|
|
10883 inherited_linker_flags='$new_inherited_linker_flags'
|
|
10884
|
|
10885 # Libraries that this one depends upon.
|
|
10886 dependency_libs='$dependency_libs'
|
|
10887
|
|
10888 # Names of additional weak libraries provided by this library
|
|
10889 weak_library_names='$weak_libs'
|
|
10890
|
|
10891 # Version information for $libname.
|
|
10892 current=$current
|
|
10893 age=$age
|
|
10894 revision=$revision
|
|
10895
|
|
10896 # Is this an already installed library?
|
|
10897 installed=$installed
|
|
10898
|
|
10899 # Should we warn about portability when linking against -modules?
|
|
10900 shouldnotlink=$module
|
|
10901
|
|
10902 # Files to dlopen/dlpreopen
|
|
10903 dlopen='$dlfiles'
|
|
10904 dlpreopen='$dlprefiles'
|
|
10905
|
|
10906 # Directory that this library needs to be installed in:
|
|
10907 libdir='$install_libdir'"
|
|
10908 if test no,yes = "$installed,$need_relink"; then
|
|
10909 $ECHO >> $output "\
|
|
10910 relink_command=\"$relink_command\""
|
|
10911 fi
|
|
10912 done
|
|
10913 }
|
|
10914
|
|
10915 # Do a symbolic link so that the libtool archive can be found in
|
|
10916 # LD_LIBRARY_PATH before the program is installed.
|
|
10917 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
|
|
10918 ;;
|
|
10919 esac
|
|
10920 exit $EXIT_SUCCESS
|
|
10921 }
|
|
10922
|
|
10923 if test link = "$opt_mode" || test relink = "$opt_mode"; then
|
|
10924 func_mode_link ${1+"$@"}
|
|
10925 fi
|
|
10926
|
|
10927
|
|
10928 # func_mode_uninstall arg...
|
|
10929 func_mode_uninstall ()
|
|
10930 {
|
|
10931 $debug_cmd
|
|
10932
|
|
10933 RM=$nonopt
|
|
10934 files=
|
|
10935 rmforce=false
|
|
10936 exit_status=0
|
|
10937
|
|
10938 # This variable tells wrapper scripts just to set variables rather
|
|
10939 # than running their programs.
|
|
10940 libtool_install_magic=$magic
|
|
10941
|
|
10942 for arg
|
|
10943 do
|
|
10944 case $arg in
|
|
10945 -f) func_append RM " $arg"; rmforce=: ;;
|
|
10946 -*) func_append RM " $arg" ;;
|
|
10947 *) func_append files " $arg" ;;
|
|
10948 esac
|
|
10949 done
|
|
10950
|
|
10951 test -z "$RM" && \
|
|
10952 func_fatal_help "you must specify an RM program"
|
|
10953
|
|
10954 rmdirs=
|
|
10955
|
|
10956 for file in $files; do
|
|
10957 func_dirname "$file" "" "."
|
|
10958 dir=$func_dirname_result
|
|
10959 if test . = "$dir"; then
|
|
10960 odir=$objdir
|
|
10961 else
|
|
10962 odir=$dir/$objdir
|
|
10963 fi
|
|
10964 func_basename "$file"
|
|
10965 name=$func_basename_result
|
|
10966 test uninstall = "$opt_mode" && odir=$dir
|
|
10967
|
|
10968 # Remember odir for removal later, being careful to avoid duplicates
|
|
10969 if test clean = "$opt_mode"; then
|
|
10970 case " $rmdirs " in
|
|
10971 *" $odir "*) ;;
|
|
10972 *) func_append rmdirs " $odir" ;;
|
|
10973 esac
|
|
10974 fi
|
|
10975
|
|
10976 # Don't error if the file doesn't exist and rm -f was used.
|
|
10977 if { test -L "$file"; } >/dev/null 2>&1 ||
|
|
10978 { test -h "$file"; } >/dev/null 2>&1 ||
|
|
10979 test -f "$file"; then
|
|
10980 :
|
|
10981 elif test -d "$file"; then
|
|
10982 exit_status=1
|
|
10983 continue
|
|
10984 elif $rmforce; then
|
|
10985 continue
|
|
10986 fi
|
|
10987
|
|
10988 rmfiles=$file
|
|
10989
|
|
10990 case $name in
|
|
10991 *.la)
|
|
10992 # Possibly a libtool archive, so verify it.
|
|
10993 if func_lalib_p "$file"; then
|
|
10994 func_source $dir/$name
|
|
10995
|
|
10996 # Delete the libtool libraries and symlinks.
|
|
10997 for n in $library_names; do
|
|
10998 func_append rmfiles " $odir/$n"
|
|
10999 done
|
|
11000 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
|
|
11001
|
|
11002 case $opt_mode in
|
|
11003 clean)
|
|
11004 case " $library_names " in
|
|
11005 *" $dlname "*) ;;
|
|
11006 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
|
|
11007 esac
|
|
11008 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
|
|
11009 ;;
|
|
11010 uninstall)
|
|
11011 if test -n "$library_names"; then
|
|
11012 # Do each command in the postuninstall commands.
|
|
11013 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
|
|
11014 fi
|
|
11015
|
|
11016 if test -n "$old_library"; then
|
|
11017 # Do each command in the old_postuninstall commands.
|
|
11018 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
|
|
11019 fi
|
|
11020 # FIXME: should reinstall the best remaining shared library.
|
|
11021 ;;
|
|
11022 esac
|
|
11023 fi
|
|
11024 ;;
|
|
11025
|
|
11026 *.lo)
|
|
11027 # Possibly a libtool object, so verify it.
|
|
11028 if func_lalib_p "$file"; then
|
|
11029
|
|
11030 # Read the .lo file
|
|
11031 func_source $dir/$name
|
|
11032
|
|
11033 # Add PIC object to the list of files to remove.
|
|
11034 if test -n "$pic_object" && test none != "$pic_object"; then
|
|
11035 func_append rmfiles " $dir/$pic_object"
|
|
11036 fi
|
|
11037
|
|
11038 # Add non-PIC object to the list of files to remove.
|
|
11039 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
|
|
11040 func_append rmfiles " $dir/$non_pic_object"
|
|
11041 fi
|
|
11042 fi
|
|
11043 ;;
|
|
11044
|
|
11045 *)
|
|
11046 if test clean = "$opt_mode"; then
|
|
11047 noexename=$name
|
|
11048 case $file in
|
|
11049 *.exe)
|
|
11050 func_stripname '' '.exe' "$file"
|
|
11051 file=$func_stripname_result
|
|
11052 func_stripname '' '.exe' "$name"
|
|
11053 noexename=$func_stripname_result
|
|
11054 # $file with .exe has already been added to rmfiles,
|
|
11055 # add $file without .exe
|
|
11056 func_append rmfiles " $file"
|
|
11057 ;;
|
|
11058 esac
|
|
11059 # Do a test to see if this is a libtool program.
|
|
11060 if func_ltwrapper_p "$file"; then
|
|
11061 if func_ltwrapper_executable_p "$file"; then
|
|
11062 func_ltwrapper_scriptname "$file"
|
|
11063 relink_command=
|
|
11064 func_source $func_ltwrapper_scriptname_result
|
|
11065 func_append rmfiles " $func_ltwrapper_scriptname_result"
|
|
11066 else
|
|
11067 relink_command=
|
|
11068 func_source $dir/$noexename
|
|
11069 fi
|
|
11070
|
|
11071 # note $name still contains .exe if it was in $file originally
|
|
11072 # as does the version of $file that was added into $rmfiles
|
|
11073 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
|
|
11074 if test yes = "$fast_install" && test -n "$relink_command"; then
|
|
11075 func_append rmfiles " $odir/lt-$name"
|
|
11076 fi
|
|
11077 if test "X$noexename" != "X$name"; then
|
|
11078 func_append rmfiles " $odir/lt-$noexename.c"
|
|
11079 fi
|
|
11080 fi
|
|
11081 fi
|
|
11082 ;;
|
|
11083 esac
|
|
11084 func_show_eval "$RM $rmfiles" 'exit_status=1'
|
|
11085 done
|
|
11086
|
|
11087 # Try to remove the $objdir's in the directories where we deleted files
|
|
11088 for dir in $rmdirs; do
|
|
11089 if test -d "$dir"; then
|
|
11090 func_show_eval "rmdir $dir >/dev/null 2>&1"
|
|
11091 fi
|
|
11092 done
|
|
11093
|
|
11094 exit $exit_status
|
|
11095 }
|
|
11096
|
|
11097 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
|
|
11098 func_mode_uninstall ${1+"$@"}
|
|
11099 fi
|
|
11100
|
|
11101 test -z "$opt_mode" && {
|
|
11102 help=$generic_help
|
|
11103 func_fatal_help "you must specify a MODE"
|
|
11104 }
|
|
11105
|
|
11106 test -z "$exec_cmd" && \
|
|
11107 func_fatal_help "invalid operation mode '$opt_mode'"
|
|
11108
|
|
11109 if test -n "$exec_cmd"; then
|
|
11110 eval exec "$exec_cmd"
|
|
11111 exit $EXIT_FAILURE
|
|
11112 fi
|
|
11113
|
|
11114 exit $exit_status
|
|
11115
|
|
11116
|
|
11117 # The TAGs below are defined such that we never get into a situation
|
|
11118 # where we disable both kinds of libraries. Given conflicting
|
|
11119 # choices, we go for a static library, that is the most portable,
|
|
11120 # since we can't tell whether shared libraries were disabled because
|
|
11121 # the user asked for that or because the platform doesn't support
|
|
11122 # them. This is particularly important on AIX, because we don't
|
|
11123 # support having both static and shared libraries enabled at the same
|
|
11124 # time on that platform, so we default to a shared-only configuration.
|
|
11125 # If a disable-shared tag is given, we'll fallback to a static-only
|
|
11126 # configuration. But we'll never go from static-only to shared-only.
|
|
11127
|
|
11128 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
|
|
11129 build_libtool_libs=no
|
|
11130 build_old_libs=yes
|
|
11131 # ### END LIBTOOL TAG CONFIG: disable-shared
|
|
11132
|
|
11133 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
|
|
11134 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
|
|
11135 # ### END LIBTOOL TAG CONFIG: disable-static
|
|
11136
|
|
11137 # Local Variables:
|
|
11138 # mode:shell-script
|
|
11139 # sh-indentation:2
|
|
11140 # End:
|