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