lemon-project-template-glpk

comparison deps/glpk/ltmain.sh @ 9:33de93886c88

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