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