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