blob: 0634c4bccce12e53a48e3ba015df80305b579618 [file] [log] [blame]
mlcreech636a9952008-05-05 22:52:56 +00001# Generated from ltmain.m4sh.
2
vapier6acb2cf2009-01-28 04:46:28 +00003# ltmain.sh (GNU libtool) 2.2.6
mlcreech636a9952008-05-05 22:52:56 +00004# 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
drh71eb93e2001-09-28 01:34:43 +000011# 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#
mlcreech636a9952008-05-05 22:52:56 +000015# 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
drh71eb93e2001-09-28 01:34:43 +000021# 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
mlcreech636a9952008-05-05 22:52:56 +000026# 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.
drh71eb93e2001-09-28 01:34:43 +000030
mlcreech636a9952008-05-05 22:52:56 +000031# 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)
vapier6acb2cf2009-01-28 04:46:28 +000068# $progname: (GNU libtool) 2.2.6
mlcreech636a9952008-05-05 22:52:56 +000069# automake: $automake_version
70# autoconf: $autoconf_version
71#
72# Report bugs to <bug-libtool@gnu.org>.
73
74PROGRAM=ltmain.sh
75PACKAGE=libtool
vapier6acb2cf2009-01-28 04:46:28 +000076VERSION=2.2.6
mlcreech636a9952008-05-05 22:52:56 +000077TIMESTAMP=""
vapier6acb2cf2009-01-28 04:46:28 +000078package_revision=1.3012
mlcreech636a9952008-05-05 22:52:56 +000079
80# Be Bourne compatible
81if 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
88else
89 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
90fi
91BIN_SH=xpg4; export BIN_SH # for Tru64
92DUALCASE=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).
98lt_user_locale=
99lt_safe_locale=
100for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
101do
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"
109done
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:
132EXIT_SUCCESS=0
133EXIT_FAILURE=1
134EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
135EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
136
137exit_status=$EXIT_SUCCESS
138
139# Make sure IFS has a sensible default
140lt_nl='
141'
142IFS=" $lt_nl"
143
144dirname="s,/[^/]*$,,"
145basename="s,^.*/,,"
146
147# func_dirname_and_basename file append nondir_replacement
148# perform func_basename and func_dirname in a single function
149# call:
150# dirname: Compute the dirname of FILE. If nonempty,
151# add APPEND to the result, otherwise set result
152# to NONDIR_REPLACEMENT.
153# value returned in "$func_dirname_result"
154# basename: Compute filename of FILE.
155# value retuned in "$func_basename_result"
156# Implementation must be kept synchronized with func_dirname
157# and func_basename. For efficiency, we do not delegate to
158# those functions but instead duplicate the functionality here.
159func_dirname_and_basename ()
160{
161 # Extract subdirectory from the argument.
162 func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
163 if test "X$func_dirname_result" = "X${1}"; then
164 func_dirname_result="${3}"
165 else
166 func_dirname_result="$func_dirname_result${2}"
167 fi
168 func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
169}
170
171# Generated shell functions inserted here.
vapier7f19c022007-02-17 14:46:31 +0000172
173# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
174# is ksh but when the shell is invoked as "sh" and the current value of
175# the _XPG environment variable is not equal to 1 (one), the special
176# positional parameter $0, within a function call, is the name of the
177# function.
178progpath="$0"
179
vapier7f19c022007-02-17 14:46:31 +0000180# The name of this program:
mlcreech636a9952008-05-05 22:52:56 +0000181# In the unlikely event $progname began with a '-', it would play havoc with
182# func_echo (imagine progname=-n), so we prepend ./ in that case:
183func_dirname_and_basename "$progpath"
184progname=$func_basename_result
185case $progname in
186 -*) progname=./$progname ;;
187esac
vapier7f19c022007-02-17 14:46:31 +0000188
mlcreech636a9952008-05-05 22:52:56 +0000189# Make sure we have an absolute path for reexecution:
190case $progpath in
191 [\\/]*|[A-Za-z]:\\*) ;;
192 *[\\/]*)
193 progdir=$func_dirname_result
194 progdir=`cd "$progdir" && pwd`
195 progpath="$progdir/$progname"
196 ;;
197 *)
198 save_IFS="$IFS"
199 IFS=:
200 for progdir in $PATH; do
201 IFS="$save_IFS"
202 test -x "$progdir/$progname" && break
203 done
204 IFS="$save_IFS"
205 test -n "$progdir" || progdir=`pwd`
206 progpath="$progdir/$progname"
207 ;;
208esac
vapier7f19c022007-02-17 14:46:31 +0000209
mlcreech636a9952008-05-05 22:52:56 +0000210# Sed substitution that helps us do robust quoting. It backslashifies
211# metacharacters that are still active within double-quoted strings.
212Xsed="${SED}"' -e 1s/^X//'
213sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
vapier7f19c022007-02-17 14:46:31 +0000214
mlcreech636a9952008-05-05 22:52:56 +0000215# Same as above, but do not quote variable references.
216double_quote_subst='s/\(["`\\]\)/\\\1/g'
vapier7f19c022007-02-17 14:46:31 +0000217
mlcreech636a9952008-05-05 22:52:56 +0000218# Re-`\' parameter expansions in output of double_quote_subst that were
219# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
220# in input to double_quote_subst, that '$' was protected from expansion.
221# Since each input `\' is now two `\'s, look for any number of runs of
222# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
223bs='\\'
224bs2='\\\\'
225bs4='\\\\\\\\'
226dollar='\$'
227sed_double_backslash="\
228 s/$bs4/&\\
229/g
230 s/^$bs2$dollar/$bs&/
231 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
232 s/\n//g"
233
234# Standard options:
235opt_dry_run=false
236opt_help=false
237opt_quiet=false
238opt_verbose=false
239opt_warning=:
240
241# func_echo arg...
242# Echo program name prefixed message, along with the current mode
243# name if it has been set yet.
244func_echo ()
245{
246 $ECHO "$progname${mode+: }$mode: $*"
247}
248
249# func_verbose arg...
250# Echo program name prefixed message in verbose mode only.
251func_verbose ()
252{
253 $opt_verbose && func_echo ${1+"$@"}
254
255 # A bug in bash halts the script if the last line of a function
256 # fails when set -e is in force, so we need another command to
257 # work around that:
258 :
259}
260
261# func_error arg...
262# Echo program name prefixed message to standard error.
263func_error ()
264{
265 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
266}
267
268# func_warning arg...
269# Echo program name prefixed warning message to standard error.
270func_warning ()
271{
272 $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
273
274 # bash bug again:
275 :
276}
277
278# func_fatal_error arg...
279# Echo program name prefixed message to standard error, and exit.
280func_fatal_error ()
281{
282 func_error ${1+"$@"}
283 exit $EXIT_FAILURE
284}
285
286# func_fatal_help arg...
287# Echo program name prefixed message to standard error, followed by
288# a help hint, and exit.
289func_fatal_help ()
290{
291 func_error ${1+"$@"}
292 func_fatal_error "$help"
293}
294help="Try \`$progname --help' for more information." ## default
295
296
297# func_grep expression filename
298# Check whether EXPRESSION matches any line of FILENAME, without output.
299func_grep ()
300{
301 $GREP "$1" "$2" >/dev/null 2>&1
302}
303
304
305# func_mkdir_p directory-path
306# Make sure the entire path to DIRECTORY-PATH is available.
307func_mkdir_p ()
308{
309 my_directory_path="$1"
310 my_dir_list=
311
312 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
313
314 # Protect directory names starting with `-'
315 case $my_directory_path in
316 -*) my_directory_path="./$my_directory_path" ;;
317 esac
318
319 # While some portion of DIR does not yet exist...
320 while test ! -d "$my_directory_path"; do
321 # ...make a list in topmost first order. Use a colon delimited
322 # list incase some portion of path contains whitespace.
323 my_dir_list="$my_directory_path:$my_dir_list"
324
325 # If the last portion added has no slash in it, the list is done
326 case $my_directory_path in */*) ;; *) break ;; esac
327
328 # ...otherwise throw away the child directory and loop
329 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
330 done
331 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
332
333 save_mkdir_p_IFS="$IFS"; IFS=':'
334 for my_dir in $my_dir_list; do
335 IFS="$save_mkdir_p_IFS"
336 # mkdir can fail with a `File exist' error if two processes
337 # try to create one of the directories concurrently. Don't
338 # stop in that case!
339 $MKDIR "$my_dir" 2>/dev/null || :
340 done
341 IFS="$save_mkdir_p_IFS"
342
343 # Bail out if we (or some other process) failed to create a directory.
344 test -d "$my_directory_path" || \
345 func_fatal_error "Failed to create \`$1'"
346 fi
347}
348
349
350# func_mktempdir [string]
351# Make a temporary directory that won't clash with other running
352# libtool processes, and avoids race conditions if possible. If
353# given, STRING is the basename for that directory.
354func_mktempdir ()
355{
356 my_template="${TMPDIR-/tmp}/${1-$progname}"
357
358 if test "$opt_dry_run" = ":"; then
359 # Return a directory name, but don't create it in dry-run mode
360 my_tmpdir="${my_template}-$$"
361 else
362
363 # If mktemp works, use that first and foremost
364 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
365
366 if test ! -d "$my_tmpdir"; then
367 # Failing that, at least try and use $RANDOM to avoid a race
368 my_tmpdir="${my_template}-${RANDOM-0}$$"
369
370 save_mktempdir_umask=`umask`
371 umask 0077
372 $MKDIR "$my_tmpdir"
373 umask $save_mktempdir_umask
374 fi
375
376 # If we're not in dry-run mode, bomb out on failure
377 test -d "$my_tmpdir" || \
378 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
379 fi
380
381 $ECHO "X$my_tmpdir" | $Xsed
382}
383
384
385# func_quote_for_eval arg
386# Aesthetically quote ARG to be evaled later.
387# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
388# is double-quoted, suitable for a subsequent eval, whereas
389# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
390# which are still active within double quotes backslashified.
391func_quote_for_eval ()
392{
393 case $1 in
394 *[\\\`\"\$]*)
395 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
396 *)
397 func_quote_for_eval_unquoted_result="$1" ;;
398 esac
399
400 case $func_quote_for_eval_unquoted_result in
401 # Double-quote args containing shell metacharacters to delay
402 # word splitting, command substitution and and variable
403 # expansion for a subsequent eval.
404 # Many Bourne shells cannot handle close brackets correctly
405 # in scan sets, so we specify it separately.
406 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
407 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
408 ;;
409 *)
410 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
411 esac
412}
413
414
415# func_quote_for_expand arg
416# Aesthetically quote ARG to be evaled later; same as above,
417# but do not quote variable references.
418func_quote_for_expand ()
419{
420 case $1 in
421 *[\\\`\"]*)
422 my_arg=`$ECHO "X$1" | $Xsed \
423 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
424 *)
425 my_arg="$1" ;;
426 esac
427
428 case $my_arg in
429 # Double-quote args containing shell metacharacters to delay
430 # word splitting and command substitution for a subsequent eval.
431 # Many Bourne shells cannot handle close brackets correctly
432 # in scan sets, so we specify it separately.
433 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
434 my_arg="\"$my_arg\""
435 ;;
436 esac
437
438 func_quote_for_expand_result="$my_arg"
439}
440
441
442# func_show_eval cmd [fail_exp]
443# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
444# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
445# is given, then evaluate it.
446func_show_eval ()
447{
448 my_cmd="$1"
449 my_fail_exp="${2-:}"
450
451 ${opt_silent-false} || {
452 func_quote_for_expand "$my_cmd"
453 eval "func_echo $func_quote_for_expand_result"
454 }
455
456 if ${opt_dry_run-false}; then :; else
457 eval "$my_cmd"
458 my_status=$?
459 if test "$my_status" -eq 0; then :; else
460 eval "(exit $my_status); $my_fail_exp"
461 fi
462 fi
463}
464
465
466# func_show_eval_locale cmd [fail_exp]
467# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
468# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
469# is given, then evaluate it. Use the saved locale for evaluation.
470func_show_eval_locale ()
471{
472 my_cmd="$1"
473 my_fail_exp="${2-:}"
474
475 ${opt_silent-false} || {
476 func_quote_for_expand "$my_cmd"
477 eval "func_echo $func_quote_for_expand_result"
478 }
479
480 if ${opt_dry_run-false}; then :; else
481 eval "$lt_user_locale
482 $my_cmd"
483 my_status=$?
484 eval "$lt_safe_locale"
485 if test "$my_status" -eq 0; then :; else
486 eval "(exit $my_status); $my_fail_exp"
487 fi
488 fi
489}
490
491
492
493
494
495# func_version
496# Echo version message to standard output and exit.
497func_version ()
498{
499 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
500 s/^# //
501 s/^# *$//
502 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
503 p
504 }' < "$progpath"
505 exit $?
506}
507
508# func_usage
509# Echo short help message to standard output and exit.
510func_usage ()
511{
512 $SED -n '/^# Usage:/,/# -h/ {
513 s/^# //
514 s/^# *$//
515 s/\$progname/'$progname'/
516 p
517 }' < "$progpath"
518 $ECHO
519 $ECHO "run \`$progname --help | more' for full usage"
520 exit $?
521}
522
523# func_help
524# Echo long help message to standard output and exit.
525func_help ()
526{
527 $SED -n '/^# Usage:/,/# Report bugs to/ {
528 s/^# //
529 s/^# *$//
530 s*\$progname*'$progname'*
531 s*\$host*'"$host"'*
532 s*\$SHELL*'"$SHELL"'*
533 s*\$LTCC*'"$LTCC"'*
534 s*\$LTCFLAGS*'"$LTCFLAGS"'*
535 s*\$LD*'"$LD"'*
536 s/\$with_gnu_ld/'"$with_gnu_ld"'/
537 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
538 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
539 p
540 }' < "$progpath"
541 exit $?
542}
543
544# func_missing_arg argname
545# Echo program name prefixed message to standard error and set global
546# exit_cmd.
547func_missing_arg ()
548{
549 func_error "missing argument for $1"
550 exit_cmd=exit
551}
552
553exit_cmd=:
554
555
556
557
558
559# Check that we have a working $ECHO.
drh71eb93e2001-09-28 01:34:43 +0000560if test "X$1" = X--no-reexec; then
561 # Discard the --no-reexec flag, and continue.
562 shift
563elif test "X$1" = X--fallback-echo; then
564 # Avoid inline document here, it may be left over
565 :
mlcreech636a9952008-05-05 22:52:56 +0000566elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
567 # Yippee, $ECHO works!
drh71eb93e2001-09-28 01:34:43 +0000568 :
569else
mlcreech636a9952008-05-05 22:52:56 +0000570 # Restart under the correct shell, and then maybe $ECHO will work.
vapier7f19c022007-02-17 14:46:31 +0000571 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
drh71eb93e2001-09-28 01:34:43 +0000572fi
mlcreech636a9952008-05-05 22:52:56 +0000573# Same for EGREP, and just to be sure, do LTCC as well
574if test "x$EGREP" = x ; then
575 EGREP=egrep
576fi
577if test "x$LTCC" = x ; then
578 LTCC=${CC-gcc}
579fi
drh71eb93e2001-09-28 01:34:43 +0000580
581if test "X$1" = X--fallback-echo; then
582 # used as fallback echo
583 shift
584 cat <<EOF
585$*
586EOF
vapier7f19c022007-02-17 14:46:31 +0000587 exit $EXIT_SUCCESS
drh71eb93e2001-09-28 01:34:43 +0000588fi
589
drh71eb93e2001-09-28 01:34:43 +0000590magic="%%%MAGIC variable%%%"
mlcreech636a9952008-05-05 22:52:56 +0000591magic_exe="%%%MAGIC EXE variable%%%"
drh71eb93e2001-09-28 01:34:43 +0000592
593# Global variables.
mlcreech636a9952008-05-05 22:52:56 +0000594# $mode is unset
drh71eb93e2001-09-28 01:34:43 +0000595nonopt=
drh71eb93e2001-09-28 01:34:43 +0000596execute_dlfiles=
vapier7f19c022007-02-17 14:46:31 +0000597preserve_args=
drh71eb93e2001-09-28 01:34:43 +0000598lo2o="s/\\.lo\$/.${objext}/"
599o2lo="s/\\.${objext}\$/.lo/"
mlcreech636a9952008-05-05 22:52:56 +0000600extracted_archives=
601extracted_serial=0
drh71eb93e2001-09-28 01:34:43 +0000602
mlcreech636a9952008-05-05 22:52:56 +0000603opt_dry_run=false
604opt_duplicate_deps=false
605opt_silent=false
606opt_debug=:
vapier7f19c022007-02-17 14:46:31 +0000607
mlcreech636a9952008-05-05 22:52:56 +0000608# If this variable is set in any of the actions, the command in it
609# will be execed at the end. This prevents here-documents from being
610# left over by shells.
611exec_cmd=
a.rottmann964dbb12004-02-26 19:47:42 +0000612
mlcreech636a9952008-05-05 22:52:56 +0000613# func_fatal_configuration arg...
614# Echo program name prefixed message to standard error, followed by
615# a configuration failure hint, and exit.
616func_fatal_configuration ()
vapier7f19c022007-02-17 14:46:31 +0000617{
mlcreech636a9952008-05-05 22:52:56 +0000618 func_error ${1+"$@"}
619 func_error "See the $PACKAGE documentation for more information."
620 func_fatal_error "Fatal configuration error."
vapier7f19c022007-02-17 14:46:31 +0000621}
622
623
mlcreech636a9952008-05-05 22:52:56 +0000624# func_config
625# Display the configuration for all the tags in this script.
626func_config ()
vapier7f19c022007-02-17 14:46:31 +0000627{
mlcreech636a9952008-05-05 22:52:56 +0000628 re_begincf='^# ### BEGIN LIBTOOL'
629 re_endcf='^# ### END LIBTOOL'
630
631 # Default configuration.
632 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
633
634 # Now print the configurations for the tags.
635 for tagname in $taglist; do
636 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
637 done
638
639 exit $?
640}
641
642# func_features
643# Display the features supported by this script.
644func_features ()
645{
646 $ECHO "host: $host"
647 if test "$build_libtool_libs" = yes; then
648 $ECHO "enable shared libraries"
649 else
650 $ECHO "disable shared libraries"
a.rottmann964dbb12004-02-26 19:47:42 +0000651 fi
mlcreech636a9952008-05-05 22:52:56 +0000652 if test "$build_old_libs" = yes; then
653 $ECHO "enable static libraries"
654 else
655 $ECHO "disable static libraries"
656 fi
657
658 exit $?
659}
660
661# func_enable_tag tagname
662# Verify that TAGNAME is valid, and either flag an error and exit, or
663# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
664# variable here.
665func_enable_tag ()
666{
667 # Global variable:
668 tagname="$1"
669
670 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
671 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
672 sed_extractcf="/$re_begincf/,/$re_endcf/p"
673
674 # Validate tagname.
675 case $tagname in
676 *[!-_A-Za-z0-9,/]*)
677 func_fatal_error "invalid tag name: $tagname"
a.rottmann964dbb12004-02-26 19:47:42 +0000678 ;;
mlcreech636a9952008-05-05 22:52:56 +0000679 esac
680
681 # Don't test for the "default" C tag, as we know it's
682 # there but not specially marked.
683 case $tagname in
684 CC) ;;
685 *)
686 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
687 taglist="$taglist $tagname"
688
689 # Evaluate the configuration. Be careful to quote the path
690 # and the sed script, to avoid splitting on whitespace, but
691 # also don't use non-portable quotes within backquotes within
692 # quotes we have to do it in 2 steps:
693 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
694 eval "$extractedcf"
695 else
696 func_error "ignoring unknown tag $tagname"
697 fi
698 ;;
699 esac
700}
701
702# Parse options once, thoroughly. This comes as soon as possible in
703# the script to make things like `libtool --version' happen quickly.
704{
705
706 # Shorthand for --mode=foo, only valid as the first argument
707 case $1 in
708 clean|clea|cle|cl)
709 shift; set dummy --mode clean ${1+"$@"}; shift
710 ;;
711 compile|compil|compi|comp|com|co|c)
712 shift; set dummy --mode compile ${1+"$@"}; shift
713 ;;
714 execute|execut|execu|exec|exe|ex|e)
715 shift; set dummy --mode execute ${1+"$@"}; shift
716 ;;
717 finish|finis|fini|fin|fi|f)
718 shift; set dummy --mode finish ${1+"$@"}; shift
719 ;;
720 install|instal|insta|inst|ins|in|i)
721 shift; set dummy --mode install ${1+"$@"}; shift
722 ;;
723 link|lin|li|l)
724 shift; set dummy --mode link ${1+"$@"}; shift
725 ;;
726 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
727 shift; set dummy --mode uninstall ${1+"$@"}; shift
a.rottmann964dbb12004-02-26 19:47:42 +0000728 ;;
729 esac
mlcreech636a9952008-05-05 22:52:56 +0000730
731 # Parse non-mode specific arguments:
732 while test "$#" -gt 0; do
733 opt="$1"
734 shift
735
736 case $opt in
737 --config) func_config ;;
738
739 --debug) preserve_args="$preserve_args $opt"
740 func_echo "enabling shell trace mode"
741 opt_debug='set -x'
742 $opt_debug
743 ;;
744
745 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
746 execute_dlfiles="$execute_dlfiles $1"
747 shift
748 ;;
749
750 --dry-run | -n) opt_dry_run=: ;;
751 --features) func_features ;;
752 --finish) mode="finish" ;;
753
754 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
755 case $1 in
756 # Valid mode arguments:
757 clean) ;;
758 compile) ;;
759 execute) ;;
760 finish) ;;
761 install) ;;
762 link) ;;
763 relink) ;;
764 uninstall) ;;
765
766 # Catch anything else as an error
767 *) func_error "invalid argument for $opt"
768 exit_cmd=exit
769 break
770 ;;
771 esac
772
773 mode="$1"
774 shift
775 ;;
776
777 --preserve-dup-deps)
778 opt_duplicate_deps=: ;;
779
780 --quiet|--silent) preserve_args="$preserve_args $opt"
781 opt_silent=:
782 ;;
783
784 --verbose| -v) preserve_args="$preserve_args $opt"
785 opt_silent=false
786 ;;
787
788 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
789 preserve_args="$preserve_args $opt $1"
790 func_enable_tag "$1" # tagname is set here
791 shift
792 ;;
793
794 # Separate optargs to long options:
795 -dlopen=*|--mode=*|--tag=*)
796 func_opt_split "$opt"
797 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
798 shift
799 ;;
800
801 -\?|-h) func_usage ;;
802 --help) opt_help=: ;;
803 --version) func_version ;;
804
805 -*) func_fatal_help "unrecognized option \`$opt'" ;;
806
807 *) nonopt="$opt"
808 break
809 ;;
810 esac
811 done
812
813
814 case $host in
vapier6acb2cf2009-01-28 04:46:28 +0000815 *cygwin* | *mingw* | *pw32* | *cegcc*)
mlcreech636a9952008-05-05 22:52:56 +0000816 # don't eliminate duplications in $postdeps and $predeps
817 opt_duplicate_compiler_generated_deps=:
818 ;;
819 *)
820 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
821 ;;
822 esac
823
824 # Having warned about all mis-specified options, bail out if
825 # anything was wrong.
826 $exit_cmd $EXIT_FAILURE
827}
828
829# func_check_version_match
830# Ensure that we are using m4 macros, and libtool script from the same
831# release of libtool.
832func_check_version_match ()
833{
834 if test "$package_revision" != "$macro_revision"; then
835 if test "$VERSION" != "$macro_version"; then
836 if test -z "$macro_version"; then
837 cat >&2 <<_LT_EOF
838$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
839$progname: definition of this LT_INIT comes from an older release.
840$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
841$progname: and run autoconf again.
842_LT_EOF
843 else
844 cat >&2 <<_LT_EOF
845$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
846$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
847$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
848$progname: and run autoconf again.
849_LT_EOF
850 fi
851 else
852 cat >&2 <<_LT_EOF
853$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
854$progname: but the definition of this LT_INIT comes from revision $macro_revision.
855$progname: You should recreate aclocal.m4 with macros from revision $package_revision
856$progname: of $PACKAGE $VERSION and run autoconf again.
857_LT_EOF
858 fi
859
860 exit $EXIT_MISMATCH
861 fi
862}
863
864
865## ----------- ##
866## Main. ##
867## ----------- ##
868
869$opt_help || {
870 # Sanity checks first:
871 func_check_version_match
872
873 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
874 func_fatal_configuration "not configured to build any kind of library"
875 fi
876
877 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
878
879
880 # Darwin sucks
881 eval std_shrext=\"$shrext_cmds\"
882
883
884 # Only execute mode is allowed to have -dlopen flags.
885 if test -n "$execute_dlfiles" && test "$mode" != execute; then
886 func_error "unrecognized option \`-dlopen'"
887 $ECHO "$help" 1>&2
888 exit $EXIT_FAILURE
889 fi
890
891 # Change the help message to a mode-specific one.
892 generic_help="$help"
893 help="Try \`$progname --help --mode=$mode' for more information."
894}
895
896
897# func_lalib_p file
898# True iff FILE is a libtool `.la' library or `.lo' object file.
899# This function is only a basic sanity check; it will hardly flush out
900# determined imposters.
901func_lalib_p ()
902{
vapier6acb2cf2009-01-28 04:46:28 +0000903 test -f "$1" &&
904 $SED -e 4q "$1" 2>/dev/null \
905 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
mlcreech636a9952008-05-05 22:52:56 +0000906}
907
908# func_lalib_unsafe_p file
909# True iff FILE is a libtool `.la' library or `.lo' object file.
910# This function implements the same check as func_lalib_p without
911# resorting to external programs. To this end, it redirects stdin and
912# closes it afterwards, without saving the original file descriptor.
913# As a safety measure, use it only where a negative result would be
914# fatal anyway. Works if `file' does not exist.
915func_lalib_unsafe_p ()
916{
917 lalib_p=no
vapier6acb2cf2009-01-28 04:46:28 +0000918 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
mlcreech636a9952008-05-05 22:52:56 +0000919 for lalib_p_l in 1 2 3 4
920 do
921 read lalib_p_line
922 case "$lalib_p_line" in
923 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
924 esac
925 done
926 exec 0<&5 5<&-
927 fi
928 test "$lalib_p" = yes
929}
930
931# func_ltwrapper_script_p file
932# True iff FILE is a libtool wrapper script
933# This function is only a basic sanity check; it will hardly flush out
934# determined imposters.
935func_ltwrapper_script_p ()
936{
937 func_lalib_p "$1"
938}
939
940# func_ltwrapper_executable_p file
941# True iff FILE is a libtool wrapper executable
942# This function is only a basic sanity check; it will hardly flush out
943# determined imposters.
944func_ltwrapper_executable_p ()
945{
946 func_ltwrapper_exec_suffix=
947 case $1 in
948 *.exe) ;;
949 *) func_ltwrapper_exec_suffix=.exe ;;
950 esac
951 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
952}
953
954# func_ltwrapper_scriptname file
955# Assumes file is an ltwrapper_executable
956# uses $file to determine the appropriate filename for a
957# temporary ltwrapper_script.
958func_ltwrapper_scriptname ()
959{
960 func_ltwrapper_scriptname_result=""
961 if func_ltwrapper_executable_p "$1"; then
962 func_dirname_and_basename "$1" "" "."
963 func_stripname '' '.exe' "$func_basename_result"
964 func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
965 fi
966}
967
968# func_ltwrapper_p file
969# True iff FILE is a libtool wrapper script or wrapper executable
970# This function is only a basic sanity check; it will hardly flush out
971# determined imposters.
972func_ltwrapper_p ()
973{
974 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
975}
976
977
978# func_execute_cmds commands fail_cmd
979# Execute tilde-delimited COMMANDS.
980# If FAIL_CMD is given, eval that upon failure.
981# FAIL_CMD may read-access the current command in variable CMD!
982func_execute_cmds ()
983{
984 $opt_debug
985 save_ifs=$IFS; IFS='~'
986 for cmd in $1; do
987 IFS=$save_ifs
988 eval cmd=\"$cmd\"
989 func_show_eval "$cmd" "${2-:}"
990 done
991 IFS=$save_ifs
992}
993
994
995# func_source file
996# Source FILE, adding directory component if necessary.
997# Note that it is not necessary on cygwin/mingw to append a dot to
998# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
999# behavior happens only for exec(3), not for open(2)! Also, sourcing
1000# `FILE.' does not work on cygwin managed mounts.
1001func_source ()
1002{
1003 $opt_debug
1004 case $1 in
1005 */* | *\\*) . "$1" ;;
1006 *) . "./$1" ;;
1007 esac
a.rottmann964dbb12004-02-26 19:47:42 +00001008}
1009
vapier7f19c022007-02-17 14:46:31 +00001010
1011# func_infer_tag arg
1012# Infer tagged configuration to use if any are available and
1013# if one wasn't chosen via the "--tag" command line option.
1014# Only attempt this if the compiler in the base compile
1015# command doesn't match the default compiler.
1016# arg is usually of the form 'gcc ...'
1017func_infer_tag ()
1018{
mlcreech636a9952008-05-05 22:52:56 +00001019 $opt_debug
vapier7f19c022007-02-17 14:46:31 +00001020 if test -n "$available_tags" && test -z "$tagname"; then
1021 CC_quoted=
1022 for arg in $CC; do
mlcreech636a9952008-05-05 22:52:56 +00001023 func_quote_for_eval "$arg"
1024 CC_quoted="$CC_quoted $func_quote_for_eval_result"
vapier7f19c022007-02-17 14:46:31 +00001025 done
1026 case $@ in
1027 # Blanks in the command may have been stripped by the calling shell,
1028 # but not from the CC environment variable when configure was run.
mlcreech636a9952008-05-05 22:52:56 +00001029 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
vapier7f19c022007-02-17 14:46:31 +00001030 # Blanks at the start of $base_compile will cause this to fail
1031 # if we don't check for them as well.
1032 *)
1033 for z in $available_tags; do
mlcreech636a9952008-05-05 22:52:56 +00001034 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
vapier7f19c022007-02-17 14:46:31 +00001035 # Evaluate the configuration.
1036 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1037 CC_quoted=
1038 for arg in $CC; do
mlcreech636a9952008-05-05 22:52:56 +00001039 # Double-quote args containing other shell metacharacters.
1040 func_quote_for_eval "$arg"
1041 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1042 done
vapier7f19c022007-02-17 14:46:31 +00001043 case "$@ " in
mlcreech636a9952008-05-05 22:52:56 +00001044 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
vapier7f19c022007-02-17 14:46:31 +00001045 # The compiler in the base compile command matches
1046 # the one in the tagged configuration.
1047 # Assume this is the tagged configuration we want.
1048 tagname=$z
1049 break
1050 ;;
1051 esac
1052 fi
1053 done
1054 # If $tagname still isn't set, then no tagged configuration
1055 # was found and let the user know that the "--tag" command
1056 # line option must be used.
1057 if test -z "$tagname"; then
mlcreech636a9952008-05-05 22:52:56 +00001058 func_echo "unable to infer tagged configuration"
1059 func_fatal_error "specify a tag with \`--tag'"
1060# else
1061# func_verbose "using $tagname tagged configuration"
vapier7f19c022007-02-17 14:46:31 +00001062 fi
1063 ;;
1064 esac
1065 fi
1066}
1067
1068
mlcreech636a9952008-05-05 22:52:56 +00001069
1070# func_write_libtool_object output_name pic_name nonpic_name
1071# Create a libtool object file (analogous to a ".la" file),
1072# but don't create it if we're doing a dry run.
1073func_write_libtool_object ()
vapier7f19c022007-02-17 14:46:31 +00001074{
mlcreech636a9952008-05-05 22:52:56 +00001075 write_libobj=${1}
drh71eb93e2001-09-28 01:34:43 +00001076 if test "$build_libtool_libs" = yes; then
mlcreech636a9952008-05-05 22:52:56 +00001077 write_lobj=\'${2}\'
drh71eb93e2001-09-28 01:34:43 +00001078 else
mlcreech636a9952008-05-05 22:52:56 +00001079 write_lobj=none
drh71eb93e2001-09-28 01:34:43 +00001080 fi
mlcreech636a9952008-05-05 22:52:56 +00001081
drh71eb93e2001-09-28 01:34:43 +00001082 if test "$build_old_libs" = yes; then
mlcreech636a9952008-05-05 22:52:56 +00001083 write_oldobj=\'${3}\'
drh71eb93e2001-09-28 01:34:43 +00001084 else
mlcreech636a9952008-05-05 22:52:56 +00001085 write_oldobj=none
drh71eb93e2001-09-28 01:34:43 +00001086 fi
drh71eb93e2001-09-28 01:34:43 +00001087
mlcreech636a9952008-05-05 22:52:56 +00001088 $opt_dry_run || {
1089 cat >${write_libobj}T <<EOF
1090# $write_libobj - a libtool object file
1091# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1092#
1093# Please DO NOT delete this file!
1094# It is necessary for linking the library.
drh71eb93e2001-09-28 01:34:43 +00001095
mlcreech636a9952008-05-05 22:52:56 +00001096# Name of the PIC object.
1097pic_object=$write_lobj
drh71eb93e2001-09-28 01:34:43 +00001098
mlcreech636a9952008-05-05 22:52:56 +00001099# Name of the non-PIC object
1100non_pic_object=$write_oldobj
a.rottmann62507b62003-03-24 09:40:34 +00001101
mlcreech636a9952008-05-05 22:52:56 +00001102EOF
1103 $MV "${write_libobj}T" "${write_libobj}"
1104 }
1105}
a.rottmann964dbb12004-02-26 19:47:42 +00001106
mlcreech636a9952008-05-05 22:52:56 +00001107# func_mode_compile arg...
1108func_mode_compile ()
1109{
1110 $opt_debug
drh71eb93e2001-09-28 01:34:43 +00001111 # Get the compilation command and the source file.
1112 base_compile=
a.rottmann964dbb12004-02-26 19:47:42 +00001113 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1114 suppress_opt=yes
drh71eb93e2001-09-28 01:34:43 +00001115 suppress_output=
a.rottmann964dbb12004-02-26 19:47:42 +00001116 arg_mode=normal
1117 libobj=
1118 later=
mlcreech636a9952008-05-05 22:52:56 +00001119 pie_flag=
drh71eb93e2001-09-28 01:34:43 +00001120
drh71eb93e2001-09-28 01:34:43 +00001121 for arg
1122 do
vapier7f19c022007-02-17 14:46:31 +00001123 case $arg_mode in
a.rottmann964dbb12004-02-26 19:47:42 +00001124 arg )
1125 # do not "continue". Instead, add this to base_compile
1126 lastarg="$arg"
1127 arg_mode=normal
1128 ;;
drh71eb93e2001-09-28 01:34:43 +00001129
a.rottmann964dbb12004-02-26 19:47:42 +00001130 target )
1131 libobj="$arg"
1132 arg_mode=normal
drh71eb93e2001-09-28 01:34:43 +00001133 continue
1134 ;;
a.rottmann964dbb12004-02-26 19:47:42 +00001135
1136 normal )
1137 # Accept any command-line options.
1138 case $arg in
1139 -o)
mlcreech636a9952008-05-05 22:52:56 +00001140 test -n "$libobj" && \
1141 func_fatal_error "you cannot specify \`-o' more than once"
a.rottmann964dbb12004-02-26 19:47:42 +00001142 arg_mode=target
1143 continue
1144 ;;
1145
mlcreech636a9952008-05-05 22:52:56 +00001146 -pie | -fpie | -fPIE)
1147 pie_flag="$pie_flag $arg"
1148 continue
1149 ;;
1150
1151 -shared | -static | -prefer-pic | -prefer-non-pic)
a.rottmann964dbb12004-02-26 19:47:42 +00001152 later="$later $arg"
1153 continue
1154 ;;
1155
1156 -no-suppress)
1157 suppress_opt=no
1158 continue
1159 ;;
1160
1161 -Xcompiler)
1162 arg_mode=arg # the next one goes into the "base_compile" arg list
1163 continue # The current "srcfile" will either be retained or
1164 ;; # replaced later. I would guess that would be a bug.
1165
1166 -Wc,*)
mlcreech636a9952008-05-05 22:52:56 +00001167 func_stripname '-Wc,' '' "$arg"
1168 args=$func_stripname_result
a.rottmann964dbb12004-02-26 19:47:42 +00001169 lastarg=
1170 save_ifs="$IFS"; IFS=','
mlcreech636a9952008-05-05 22:52:56 +00001171 for arg in $args; do
a.rottmann964dbb12004-02-26 19:47:42 +00001172 IFS="$save_ifs"
mlcreech636a9952008-05-05 22:52:56 +00001173 func_quote_for_eval "$arg"
1174 lastarg="$lastarg $func_quote_for_eval_result"
a.rottmann964dbb12004-02-26 19:47:42 +00001175 done
1176 IFS="$save_ifs"
mlcreech636a9952008-05-05 22:52:56 +00001177 func_stripname ' ' '' "$lastarg"
1178 lastarg=$func_stripname_result
a.rottmann964dbb12004-02-26 19:47:42 +00001179
1180 # Add the arguments to base_compile.
1181 base_compile="$base_compile $lastarg"
1182 continue
1183 ;;
1184
mlcreech636a9952008-05-05 22:52:56 +00001185 *)
a.rottmann964dbb12004-02-26 19:47:42 +00001186 # Accept the current argument as the source file.
1187 # The previous "srcfile" becomes the current argument.
1188 #
1189 lastarg="$srcfile"
1190 srcfile="$arg"
1191 ;;
1192 esac # case $arg
1193 ;;
1194 esac # case $arg_mode
1195
1196 # Aesthetically quote the previous argument.
mlcreech636a9952008-05-05 22:52:56 +00001197 func_quote_for_eval "$lastarg"
1198 base_compile="$base_compile $func_quote_for_eval_result"
a.rottmann964dbb12004-02-26 19:47:42 +00001199 done # for arg
drh71eb93e2001-09-28 01:34:43 +00001200
a.rottmann964dbb12004-02-26 19:47:42 +00001201 case $arg_mode in
1202 arg)
mlcreech636a9952008-05-05 22:52:56 +00001203 func_fatal_error "you must specify an argument for -Xcompile"
a.rottmann964dbb12004-02-26 19:47:42 +00001204 ;;
1205 target)
mlcreech636a9952008-05-05 22:52:56 +00001206 func_fatal_error "you must specify a target with \`-o'"
a.rottmann964dbb12004-02-26 19:47:42 +00001207 ;;
1208 *)
1209 # Get the name of the library object.
mlcreech636a9952008-05-05 22:52:56 +00001210 test -z "$libobj" && {
1211 func_basename "$srcfile"
1212 libobj="$func_basename_result"
1213 }
a.rottmann964dbb12004-02-26 19:47:42 +00001214 ;;
1215 esac
1216
1217 # Recognize several different file suffixes.
1218 # If the user specifies -o file.o, it is replaced with file.lo
a.rottmann964dbb12004-02-26 19:47:42 +00001219 case $libobj in
mlcreech636a9952008-05-05 22:52:56 +00001220 *.[cCFSifmso] | \
1221 *.ada | *.adb | *.ads | *.asm | \
1222 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
1223 *.[fF][09]? | *.for | *.java | *.obj | *.sx)
1224 func_xform "$libobj"
1225 libobj=$func_xform_result
1226 ;;
a.rottmann964dbb12004-02-26 19:47:42 +00001227 esac
1228
a.rottmann964dbb12004-02-26 19:47:42 +00001229 case $libobj in
mlcreech636a9952008-05-05 22:52:56 +00001230 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
a.rottmann964dbb12004-02-26 19:47:42 +00001231 *)
mlcreech636a9952008-05-05 22:52:56 +00001232 func_fatal_error "cannot determine name of library object from \`$libobj'"
a.rottmann964dbb12004-02-26 19:47:42 +00001233 ;;
1234 esac
1235
vapier7f19c022007-02-17 14:46:31 +00001236 func_infer_tag $base_compile
a.rottmann964dbb12004-02-26 19:47:42 +00001237
1238 for arg in $later; do
1239 case $arg in
mlcreech636a9952008-05-05 22:52:56 +00001240 -shared)
1241 test "$build_libtool_libs" != yes && \
1242 func_fatal_configuration "can not build a shared library"
1243 build_old_libs=no
1244 continue
1245 ;;
1246
drh71eb93e2001-09-28 01:34:43 +00001247 -static)
mlcreech636a9952008-05-05 22:52:56 +00001248 build_libtool_libs=no
drh71eb93e2001-09-28 01:34:43 +00001249 build_old_libs=yes
1250 continue
1251 ;;
1252
1253 -prefer-pic)
1254 pic_mode=yes
1255 continue
1256 ;;
1257
1258 -prefer-non-pic)
1259 pic_mode=no
1260 continue
1261 ;;
drh71eb93e2001-09-28 01:34:43 +00001262 esac
drh71eb93e2001-09-28 01:34:43 +00001263 done
1264
mlcreech636a9952008-05-05 22:52:56 +00001265 func_quote_for_eval "$libobj"
1266 test "X$libobj" != "X$func_quote_for_eval_result" \
1267 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1268 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1269 func_dirname_and_basename "$obj" "/" ""
1270 objname="$func_basename_result"
1271 xdir="$func_dirname_result"
a.rottmann964dbb12004-02-26 19:47:42 +00001272 lobj=${xdir}$objdir/$objname
drh71eb93e2001-09-28 01:34:43 +00001273
mlcreech636a9952008-05-05 22:52:56 +00001274 test -z "$base_compile" && \
1275 func_fatal_help "you must specify a compilation command"
drh71eb93e2001-09-28 01:34:43 +00001276
1277 # Delete any leftover library objects.
1278 if test "$build_old_libs" = yes; then
a.rottmann964dbb12004-02-26 19:47:42 +00001279 removelist="$obj $lobj $libobj ${libobj}T"
drh71eb93e2001-09-28 01:34:43 +00001280 else
a.rottmann964dbb12004-02-26 19:47:42 +00001281 removelist="$lobj $libobj ${libobj}T"
drh71eb93e2001-09-28 01:34:43 +00001282 fi
1283
drh71eb93e2001-09-28 01:34:43 +00001284 # On Cygwin there's no "real" PIC flag so we must build both object types
1285 case $host_os in
vapier6acb2cf2009-01-28 04:46:28 +00001286 cygwin* | mingw* | pw32* | os2* | cegcc*)
drh71eb93e2001-09-28 01:34:43 +00001287 pic_mode=default
1288 ;;
1289 esac
1290 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1291 # non-PIC code in shared libraries is not supported
1292 pic_mode=default
1293 fi
1294
1295 # Calculate the filename of the output object if compiler does
1296 # not support -o with -c
1297 if test "$compiler_c_o" = no; then
mlcreech636a9952008-05-05 22:52:56 +00001298 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
drh71eb93e2001-09-28 01:34:43 +00001299 lockfile="$output_obj.lock"
drh71eb93e2001-09-28 01:34:43 +00001300 else
a.rottmann964dbb12004-02-26 19:47:42 +00001301 output_obj=
drh71eb93e2001-09-28 01:34:43 +00001302 need_locks=no
1303 lockfile=
1304 fi
1305
1306 # Lock this critical section if it is needed
1307 # We use this script file to make the link, it avoids creating a new file
1308 if test "$need_locks" = yes; then
mlcreech636a9952008-05-05 22:52:56 +00001309 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1310 func_echo "Waiting for $lockfile to be removed"
drh71eb93e2001-09-28 01:34:43 +00001311 sleep 2
1312 done
1313 elif test "$need_locks" = warn; then
1314 if test -f "$lockfile"; then
mlcreech636a9952008-05-05 22:52:56 +00001315 $ECHO "\
drh71eb93e2001-09-28 01:34:43 +00001316*** ERROR, $lockfile exists and contains:
1317`cat $lockfile 2>/dev/null`
1318
1319This indicates that another process is trying to use the same
1320temporary object file, and libtool could not work around it because
1321your compiler does not support \`-c' and \`-o' together. If you
1322repeat this compilation, it may succeed, by chance, but you had better
1323avoid parallel builds (make -j) in this platform, or get a better
1324compiler."
1325
mlcreech636a9952008-05-05 22:52:56 +00001326 $opt_dry_run || $RM $removelist
vapier7f19c022007-02-17 14:46:31 +00001327 exit $EXIT_FAILURE
drh71eb93e2001-09-28 01:34:43 +00001328 fi
mlcreech636a9952008-05-05 22:52:56 +00001329 removelist="$removelist $output_obj"
1330 $ECHO "$srcfile" > "$lockfile"
drh71eb93e2001-09-28 01:34:43 +00001331 fi
1332
mlcreech636a9952008-05-05 22:52:56 +00001333 $opt_dry_run || $RM $removelist
1334 removelist="$removelist $lockfile"
1335 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
1336
drh71eb93e2001-09-28 01:34:43 +00001337 if test -n "$fix_srcfile_path"; then
1338 eval srcfile=\"$fix_srcfile_path\"
1339 fi
mlcreech636a9952008-05-05 22:52:56 +00001340 func_quote_for_eval "$srcfile"
1341 qsrcfile=$func_quote_for_eval_result
a.rottmann964dbb12004-02-26 19:47:42 +00001342
drh71eb93e2001-09-28 01:34:43 +00001343 # Only build a PIC object if we are building libtool libraries.
1344 if test "$build_libtool_libs" = yes; then
1345 # Without this assignment, base_compile gets emptied.
1346 fbsd_hideous_sh_bug=$base_compile
1347
1348 if test "$pic_mode" != no; then
vapier7f19c022007-02-17 14:46:31 +00001349 command="$base_compile $qsrcfile $pic_flag"
drh71eb93e2001-09-28 01:34:43 +00001350 else
1351 # Don't build PIC code
vapier7f19c022007-02-17 14:46:31 +00001352 command="$base_compile $qsrcfile"
drh71eb93e2001-09-28 01:34:43 +00001353 fi
1354
mlcreech636a9952008-05-05 22:52:56 +00001355 func_mkdir_p "$xdir$objdir"
a.rottmann964dbb12004-02-26 19:47:42 +00001356
1357 if test -z "$output_obj"; then
1358 # Place PIC objects in $objdir
1359 command="$command -o $lobj"
drh71eb93e2001-09-28 01:34:43 +00001360 fi
1361
mlcreech636a9952008-05-05 22:52:56 +00001362 func_show_eval_locale "$command" \
1363 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
drh71eb93e2001-09-28 01:34:43 +00001364
1365 if test "$need_locks" = warn &&
a.rottmann964dbb12004-02-26 19:47:42 +00001366 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
mlcreech636a9952008-05-05 22:52:56 +00001367 $ECHO "\
drh71eb93e2001-09-28 01:34:43 +00001368*** ERROR, $lockfile contains:
1369`cat $lockfile 2>/dev/null`
1370
1371but it should contain:
1372$srcfile
1373
1374This indicates that another process is trying to use the same
1375temporary object file, and libtool could not work around it because
1376your compiler does not support \`-c' and \`-o' together. If you
1377repeat this compilation, it may succeed, by chance, but you had better
1378avoid parallel builds (make -j) in this platform, or get a better
1379compiler."
1380
mlcreech636a9952008-05-05 22:52:56 +00001381 $opt_dry_run || $RM $removelist
vapier7f19c022007-02-17 14:46:31 +00001382 exit $EXIT_FAILURE
drh71eb93e2001-09-28 01:34:43 +00001383 fi
1384
1385 # Just move the object if needed, then go on to compile the next one
a.rottmann964dbb12004-02-26 19:47:42 +00001386 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
mlcreech636a9952008-05-05 22:52:56 +00001387 func_show_eval '$MV "$output_obj" "$lobj"' \
1388 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
drh71eb93e2001-09-28 01:34:43 +00001389 fi
1390
drh71eb93e2001-09-28 01:34:43 +00001391 # Allow error messages only from the first compilation.
a.rottmann964dbb12004-02-26 19:47:42 +00001392 if test "$suppress_opt" = yes; then
mlcreech636a9952008-05-05 22:52:56 +00001393 suppress_output=' >/dev/null 2>&1'
a.rottmann964dbb12004-02-26 19:47:42 +00001394 fi
drh71eb93e2001-09-28 01:34:43 +00001395 fi
1396
1397 # Only build a position-dependent object if we build old libraries.
1398 if test "$build_old_libs" = yes; then
1399 if test "$pic_mode" != yes; then
1400 # Don't build PIC code
mlcreech636a9952008-05-05 22:52:56 +00001401 command="$base_compile $qsrcfile$pie_flag"
drh71eb93e2001-09-28 01:34:43 +00001402 else
vapier7f19c022007-02-17 14:46:31 +00001403 command="$base_compile $qsrcfile $pic_flag"
drh71eb93e2001-09-28 01:34:43 +00001404 fi
1405 if test "$compiler_c_o" = yes; then
1406 command="$command -o $obj"
1407 fi
1408
1409 # Suppress compiler output if we already did a PIC compilation.
1410 command="$command$suppress_output"
mlcreech636a9952008-05-05 22:52:56 +00001411 func_show_eval_locale "$command" \
1412 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
drh71eb93e2001-09-28 01:34:43 +00001413
1414 if test "$need_locks" = warn &&
a.rottmann964dbb12004-02-26 19:47:42 +00001415 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
mlcreech636a9952008-05-05 22:52:56 +00001416 $ECHO "\
drh71eb93e2001-09-28 01:34:43 +00001417*** ERROR, $lockfile contains:
1418`cat $lockfile 2>/dev/null`
1419
1420but it should contain:
1421$srcfile
1422
1423This indicates that another process is trying to use the same
1424temporary object file, and libtool could not work around it because
1425your compiler does not support \`-c' and \`-o' together. If you
1426repeat this compilation, it may succeed, by chance, but you had better
1427avoid parallel builds (make -j) in this platform, or get a better
1428compiler."
1429
mlcreech636a9952008-05-05 22:52:56 +00001430 $opt_dry_run || $RM $removelist
vapier7f19c022007-02-17 14:46:31 +00001431 exit $EXIT_FAILURE
drh71eb93e2001-09-28 01:34:43 +00001432 fi
1433
1434 # Just move the object if needed
a.rottmann964dbb12004-02-26 19:47:42 +00001435 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
mlcreech636a9952008-05-05 22:52:56 +00001436 func_show_eval '$MV "$output_obj" "$obj"' \
1437 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
drh71eb93e2001-09-28 01:34:43 +00001438 fi
drh71eb93e2001-09-28 01:34:43 +00001439 fi
1440
mlcreech636a9952008-05-05 22:52:56 +00001441 $opt_dry_run || {
1442 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
a.rottmann964dbb12004-02-26 19:47:42 +00001443
mlcreech636a9952008-05-05 22:52:56 +00001444 # Unlock the critical section if it was locked
1445 if test "$need_locks" != no; then
1446 removelist=$lockfile
1447 $RM "$lockfile"
1448 fi
1449 }
drh71eb93e2001-09-28 01:34:43 +00001450
vapier7f19c022007-02-17 14:46:31 +00001451 exit $EXIT_SUCCESS
mlcreech636a9952008-05-05 22:52:56 +00001452}
drh71eb93e2001-09-28 01:34:43 +00001453
mlcreech636a9952008-05-05 22:52:56 +00001454$opt_help || {
1455test "$mode" = compile && func_mode_compile ${1+"$@"}
1456}
1457
1458func_mode_help ()
1459{
1460 # We need to display help for each of the modes.
1461 case $mode in
1462 "")
1463 # Generic help is extracted from the usage comments
1464 # at the start of this file.
1465 func_help
1466 ;;
1467
1468 clean)
1469 $ECHO \
1470"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
1471
1472Remove files from the build directory.
1473
1474RM is the name of the program to use to delete files associated with each FILE
1475(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1476to RM.
1477
1478If FILE is a libtool library, object or program, all the files associated
1479with it are deleted. Otherwise, only FILE itself is deleted using RM."
1480 ;;
1481
1482 compile)
1483 $ECHO \
1484"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
1485
1486Compile a source file into a libtool library object.
1487
1488This mode accepts the following additional options:
1489
1490 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
1491 -no-suppress do not suppress compiler output for multiple passes
1492 -prefer-pic try to building PIC objects only
1493 -prefer-non-pic try to building non-PIC objects only
1494 -shared do not build a \`.o' file suitable for static linking
1495 -static only build a \`.o' file suitable for static linking
1496
1497COMPILE-COMMAND is a command to be used in creating a \`standard' object file
1498from the given SOURCEFILE.
1499
1500The output file name is determined by removing the directory component from
1501SOURCEFILE, then substituting the C source code suffix \`.c' with the
1502library object suffix, \`.lo'."
1503 ;;
1504
1505 execute)
1506 $ECHO \
1507"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
1508
1509Automatically set library path, then run a program.
1510
1511This mode accepts the following additional options:
1512
1513 -dlopen FILE add the directory containing FILE to the library path
1514
1515This mode sets the library path environment variable according to \`-dlopen'
1516flags.
1517
1518If any of the ARGS are libtool executable wrappers, then they are translated
1519into their corresponding uninstalled binary, and any of their required library
1520directories are added to the library path.
1521
1522Then, COMMAND is executed, with ARGS as arguments."
1523 ;;
1524
1525 finish)
1526 $ECHO \
1527"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
1528
1529Complete the installation of libtool libraries.
1530
1531Each LIBDIR is a directory that contains libtool libraries.
1532
1533The commands that this mode executes may require superuser privileges. Use
1534the \`--dry-run' option if you just want to see what would be executed."
1535 ;;
1536
1537 install)
1538 $ECHO \
1539"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
1540
1541Install executables or libraries.
1542
1543INSTALL-COMMAND is the installation command. The first component should be
1544either the \`install' or \`cp' program.
1545
1546The following components of INSTALL-COMMAND are treated specially:
1547
1548 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
1549
1550The rest of the components are interpreted as arguments to that command (only
1551BSD-compatible install options are recognized)."
1552 ;;
1553
1554 link)
1555 $ECHO \
1556"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
1557
1558Link object files or libraries together to form another library, or to
1559create an executable program.
1560
1561LINK-COMMAND is a command using the C compiler that you would use to create
1562a program from several object files.
1563
1564The following components of LINK-COMMAND are treated specially:
1565
1566 -all-static do not do any dynamic linking at all
1567 -avoid-version do not add a version suffix if possible
1568 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
1569 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
1570 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
1571 -export-symbols SYMFILE
1572 try to export only the symbols listed in SYMFILE
1573 -export-symbols-regex REGEX
1574 try to export only the symbols matching REGEX
1575 -LLIBDIR search LIBDIR for required installed libraries
1576 -lNAME OUTPUT-FILE requires the installed library libNAME
1577 -module build a library that can dlopened
1578 -no-fast-install disable the fast-install mode
1579 -no-install link a not-installable executable
1580 -no-undefined declare that a library does not refer to external symbols
1581 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
1582 -objectlist FILE Use a list of object files found in FILE to specify objects
1583 -precious-files-regex REGEX
1584 don't remove output files matching REGEX
1585 -release RELEASE specify package release information
1586 -rpath LIBDIR the created library will eventually be installed in LIBDIR
1587 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
1588 -shared only do dynamic linking of libtool libraries
1589 -shrext SUFFIX override the standard shared library file extension
1590 -static do not do any dynamic linking of uninstalled libtool libraries
1591 -static-libtool-libs
1592 do not do any dynamic linking of libtool libraries
1593 -version-info CURRENT[:REVISION[:AGE]]
1594 specify library version info [each variable defaults to 0]
1595 -weak LIBNAME declare that the target provides the LIBNAME interface
1596
1597All other options (arguments beginning with \`-') are ignored.
1598
1599Every other argument is treated as a filename. Files ending in \`.la' are
1600treated as uninstalled libtool libraries, other files are standard or library
1601object files.
1602
1603If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
1604only library objects (\`.lo' files) may be specified, and \`-rpath' is
1605required, except when creating a convenience library.
1606
1607If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
1608using \`ar' and \`ranlib', or on Windows using \`lib'.
1609
1610If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
1611is created, otherwise an executable program is created."
1612 ;;
1613
1614 uninstall)
1615 $ECHO \
1616"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
1617
1618Remove libraries from an installation directory.
1619
1620RM is the name of the program to use to delete files associated with each FILE
1621(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
1622to RM.
1623
1624If FILE is a libtool library, all the files associated with it are deleted.
1625Otherwise, only FILE itself is deleted using RM."
1626 ;;
1627
1628 *)
1629 func_fatal_help "invalid operation mode \`$mode'"
1630 ;;
1631 esac
1632
1633 $ECHO
1634 $ECHO "Try \`$progname --help' for more information about other modes."
1635
1636 exit $?
1637}
1638
1639 # Now that we've collected a possible --mode arg, show help if necessary
1640 $opt_help && func_mode_help
1641
1642
1643# func_mode_execute arg...
1644func_mode_execute ()
1645{
1646 $opt_debug
1647 # The first argument is the command name.
1648 cmd="$nonopt"
1649 test -z "$cmd" && \
1650 func_fatal_help "you must specify a COMMAND"
1651
1652 # Handle -dlopen flags immediately.
1653 for file in $execute_dlfiles; do
1654 test -f "$file" \
1655 || func_fatal_help "\`$file' is not a file"
1656
1657 dir=
1658 case $file in
1659 *.la)
1660 # Check to see that this really is a libtool archive.
1661 func_lalib_unsafe_p "$file" \
1662 || func_fatal_help "\`$lib' is not a valid libtool archive"
1663
1664 # Read the libtool library.
1665 dlname=
1666 library_names=
1667 func_source "$file"
1668
1669 # Skip this library if it cannot be dlopened.
1670 if test -z "$dlname"; then
1671 # Warn if it was a shared library.
1672 test -n "$library_names" && \
1673 func_warning "\`$file' was not linked with \`-export-dynamic'"
1674 continue
1675 fi
1676
1677 func_dirname "$file" "" "."
1678 dir="$func_dirname_result"
1679
1680 if test -f "$dir/$objdir/$dlname"; then
1681 dir="$dir/$objdir"
1682 else
1683 if test ! -f "$dir/$dlname"; then
1684 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1685 fi
1686 fi
1687 ;;
1688
1689 *.lo)
1690 # Just add the directory containing the .lo file.
1691 func_dirname "$file" "" "."
1692 dir="$func_dirname_result"
1693 ;;
1694
1695 *)
1696 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1697 continue
1698 ;;
1699 esac
1700
1701 # Get the absolute pathname.
1702 absdir=`cd "$dir" && pwd`
1703 test -n "$absdir" && dir="$absdir"
1704
1705 # Now add the directory to shlibpath_var.
1706 if eval "test -z \"\$$shlibpath_var\""; then
1707 eval "$shlibpath_var=\"\$dir\""
1708 else
1709 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1710 fi
1711 done
1712
1713 # This variable tells wrapper scripts just to set shlibpath_var
1714 # rather than running their programs.
1715 libtool_execute_magic="$magic"
1716
1717 # Check if any of the arguments is a wrapper script.
1718 args=
1719 for file
1720 do
1721 case $file in
1722 -*) ;;
1723 *)
1724 # Do a test to see if this is really a libtool program.
1725 if func_ltwrapper_script_p "$file"; then
1726 func_source "$file"
1727 # Transform arg to wrapped name.
1728 file="$progdir/$program"
1729 elif func_ltwrapper_executable_p "$file"; then
1730 func_ltwrapper_scriptname "$file"
1731 func_source "$func_ltwrapper_scriptname_result"
1732 # Transform arg to wrapped name.
1733 file="$progdir/$program"
1734 fi
1735 ;;
1736 esac
1737 # Quote arguments (to preserve shell metacharacters).
1738 func_quote_for_eval "$file"
1739 args="$args $func_quote_for_eval_result"
1740 done
1741
1742 if test "X$opt_dry_run" = Xfalse; then
1743 if test -n "$shlibpath_var"; then
1744 # Export the shlibpath_var.
1745 eval "export $shlibpath_var"
1746 fi
1747
1748 # Restore saved environment variables
1749 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1750 do
1751 eval "if test \"\${save_$lt_var+set}\" = set; then
1752 $lt_var=\$save_$lt_var; export $lt_var
1753 else
1754 $lt_unset $lt_var
1755 fi"
1756 done
1757
1758 # Now prepare to actually exec the command.
1759 exec_cmd="\$cmd$args"
1760 else
1761 # Display what would be done.
1762 if test -n "$shlibpath_var"; then
1763 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1764 $ECHO "export $shlibpath_var"
1765 fi
1766 $ECHO "$cmd$args"
1767 exit $EXIT_SUCCESS
1768 fi
1769}
1770
1771test "$mode" = execute && func_mode_execute ${1+"$@"}
1772
1773
1774# func_mode_finish arg...
1775func_mode_finish ()
1776{
1777 $opt_debug
1778 libdirs="$nonopt"
1779 admincmds=
1780
1781 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1782 for dir
1783 do
1784 libdirs="$libdirs $dir"
1785 done
1786
1787 for libdir in $libdirs; do
1788 if test -n "$finish_cmds"; then
1789 # Do each command in the finish commands.
1790 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1791'"$cmd"'"'
1792 fi
1793 if test -n "$finish_eval"; then
1794 # Do the single finish_eval.
1795 eval cmds=\"$finish_eval\"
1796 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
1797 $cmds"
1798 fi
1799 done
1800 fi
1801
1802 # Exit here if they wanted silent mode.
1803 $opt_silent && exit $EXIT_SUCCESS
1804
1805 $ECHO "X----------------------------------------------------------------------" | $Xsed
1806 $ECHO "Libraries have been installed in:"
1807 for libdir in $libdirs; do
1808 $ECHO " $libdir"
1809 done
1810 $ECHO
1811 $ECHO "If you ever happen to want to link against installed libraries"
1812 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
1813 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
1814 $ECHO "flag during linking and do at least one of the following:"
1815 if test -n "$shlibpath_var"; then
1816 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
1817 $ECHO " during execution"
1818 fi
1819 if test -n "$runpath_var"; then
1820 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
1821 $ECHO " during linking"
1822 fi
1823 if test -n "$hardcode_libdir_flag_spec"; then
1824 libdir=LIBDIR
1825 eval flag=\"$hardcode_libdir_flag_spec\"
1826
1827 $ECHO " - use the \`$flag' linker flag"
1828 fi
1829 if test -n "$admincmds"; then
1830 $ECHO " - have your system administrator run these commands:$admincmds"
1831 fi
1832 if test -f /etc/ld.so.conf; then
1833 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1834 fi
1835 $ECHO
1836
1837 $ECHO "See any operating system documentation about shared libraries for"
1838 case $host in
1839 solaris2.[6789]|solaris2.1[0-9])
1840 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1841 $ECHO "pages."
1842 ;;
1843 *)
1844 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
1845 ;;
1846 esac
1847 $ECHO "X----------------------------------------------------------------------" | $Xsed
1848 exit $EXIT_SUCCESS
1849}
1850
1851test "$mode" = finish && func_mode_finish ${1+"$@"}
1852
1853
1854# func_mode_install arg...
1855func_mode_install ()
1856{
1857 $opt_debug
1858 # There may be an optional sh(1) argument at the beginning of
1859 # install_prog (especially on Windows NT).
1860 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
1861 # Allow the use of GNU shtool's install command.
1862 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
1863 # Aesthetically quote it.
1864 func_quote_for_eval "$nonopt"
1865 install_prog="$func_quote_for_eval_result "
1866 arg=$1
1867 shift
1868 else
1869 install_prog=
1870 arg=$nonopt
1871 fi
1872
1873 # The real first argument should be the name of the installation program.
1874 # Aesthetically quote it.
1875 func_quote_for_eval "$arg"
1876 install_prog="$install_prog$func_quote_for_eval_result"
1877
1878 # We need to accept at least all the BSD install flags.
1879 dest=
1880 files=
1881 opts=
1882 prev=
1883 install_type=
1884 isdir=no
1885 stripme=
1886 for arg
1887 do
1888 if test -n "$dest"; then
1889 files="$files $dest"
1890 dest=$arg
1891 continue
1892 fi
1893
1894 case $arg in
1895 -d) isdir=yes ;;
1896 -f)
1897 case " $install_prog " in
1898 *[\\\ /]cp\ *) ;;
1899 *) prev=$arg ;;
1900 esac
1901 ;;
1902 -g | -m | -o)
1903 prev=$arg
1904 ;;
1905 -s)
1906 stripme=" -s"
1907 continue
1908 ;;
1909 -*)
1910 ;;
1911 *)
1912 # If the previous option needed an argument, then skip it.
1913 if test -n "$prev"; then
1914 prev=
1915 else
1916 dest=$arg
1917 continue
1918 fi
1919 ;;
1920 esac
1921
1922 # Aesthetically quote the argument.
1923 func_quote_for_eval "$arg"
1924 install_prog="$install_prog $func_quote_for_eval_result"
1925 done
1926
1927 test -z "$install_prog" && \
1928 func_fatal_help "you must specify an install program"
1929
1930 test -n "$prev" && \
1931 func_fatal_help "the \`$prev' option requires an argument"
1932
1933 if test -z "$files"; then
1934 if test -z "$dest"; then
1935 func_fatal_help "no file or destination specified"
1936 else
1937 func_fatal_help "you must specify a destination"
1938 fi
1939 fi
1940
1941 # Strip any trailing slash from the destination.
1942 func_stripname '' '/' "$dest"
1943 dest=$func_stripname_result
1944
1945 # Check to see that the destination is a directory.
1946 test -d "$dest" && isdir=yes
1947 if test "$isdir" = yes; then
1948 destdir="$dest"
1949 destname=
1950 else
1951 func_dirname_and_basename "$dest" "" "."
1952 destdir="$func_dirname_result"
1953 destname="$func_basename_result"
1954
1955 # Not a directory, so check to see that there is only one file specified.
1956 set dummy $files; shift
1957 test "$#" -gt 1 && \
1958 func_fatal_help "\`$dest' is not a directory"
1959 fi
1960 case $destdir in
1961 [\\/]* | [A-Za-z]:[\\/]*) ;;
1962 *)
1963 for file in $files; do
1964 case $file in
1965 *.lo) ;;
1966 *)
1967 func_fatal_help "\`$destdir' must be an absolute directory name"
1968 ;;
1969 esac
1970 done
1971 ;;
1972 esac
1973
1974 # This variable tells wrapper scripts just to set variables rather
1975 # than running their programs.
1976 libtool_install_magic="$magic"
1977
1978 staticlibs=
1979 future_libdirs=
1980 current_libdirs=
1981 for file in $files; do
1982
1983 # Do each installation.
1984 case $file in
1985 *.$libext)
1986 # Do the static libraries later.
1987 staticlibs="$staticlibs $file"
1988 ;;
1989
1990 *.la)
1991 # Check to see that this really is a libtool archive.
1992 func_lalib_unsafe_p "$file" \
1993 || func_fatal_help "\`$file' is not a valid libtool archive"
1994
1995 library_names=
1996 old_library=
1997 relink_command=
1998 func_source "$file"
1999
2000 # Add the libdir to current_libdirs if it is the destination.
2001 if test "X$destdir" = "X$libdir"; then
2002 case "$current_libdirs " in
2003 *" $libdir "*) ;;
2004 *) current_libdirs="$current_libdirs $libdir" ;;
2005 esac
2006 else
2007 # Note the libdir as a future libdir.
2008 case "$future_libdirs " in
2009 *" $libdir "*) ;;
2010 *) future_libdirs="$future_libdirs $libdir" ;;
2011 esac
2012 fi
2013
2014 func_dirname "$file" "/" ""
2015 dir="$func_dirname_result"
2016 dir="$dir$objdir"
2017
2018 if test -n "$relink_command"; then
2019 # Determine the prefix the user has applied to our future dir.
2020 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2021
2022 # Don't allow the user to place us outside of our expected
2023 # location b/c this prevents finding dependent libraries that
2024 # are installed to the same prefix.
2025 # At present, this check doesn't affect windows .dll's that
2026 # are installed into $libdir/../bin (currently, that works fine)
2027 # but it's something to keep an eye on.
2028 test "$inst_prefix_dir" = "$destdir" && \
2029 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2030
2031 if test -n "$inst_prefix_dir"; then
2032 # Stick the inst_prefix_dir data into the link command.
2033 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2034 else
2035 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2036 fi
2037
2038 func_warning "relinking \`$file'"
2039 func_show_eval "$relink_command" \
2040 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2041 fi
2042
2043 # See the names of the shared library.
2044 set dummy $library_names; shift
2045 if test -n "$1"; then
2046 realname="$1"
2047 shift
2048
2049 srcname="$realname"
2050 test -n "$relink_command" && srcname="$realname"T
2051
2052 # Install the shared library and build the symlinks.
2053 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2054 'exit $?'
2055 tstripme="$stripme"
2056 case $host_os in
vapier6acb2cf2009-01-28 04:46:28 +00002057 cygwin* | mingw* | pw32* | cegcc*)
mlcreech636a9952008-05-05 22:52:56 +00002058 case $realname in
2059 *.dll.a)
2060 tstripme=""
2061 ;;
2062 esac
2063 ;;
2064 esac
2065 if test -n "$tstripme" && test -n "$striplib"; then
2066 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2067 fi
2068
2069 if test "$#" -gt 0; then
2070 # Delete the old symlinks, and create new ones.
2071 # Try `ln -sf' first, because the `ln' binary might depend on
2072 # the symlink we replace! Solaris /bin/ln does not understand -f,
2073 # so we also need to try rm && ln -s.
2074 for linkname
2075 do
2076 test "$linkname" != "$realname" \
2077 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2078 done
2079 fi
2080
2081 # Do each command in the postinstall commands.
2082 lib="$destdir/$realname"
2083 func_execute_cmds "$postinstall_cmds" 'exit $?'
2084 fi
2085
2086 # Install the pseudo-library for information purposes.
2087 func_basename "$file"
2088 name="$func_basename_result"
2089 instname="$dir/$name"i
2090 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2091
2092 # Maybe install the static library, too.
2093 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2094 ;;
2095
2096 *.lo)
2097 # Install (i.e. copy) a libtool object.
2098
2099 # Figure out destination file name, if it wasn't already specified.
2100 if test -n "$destname"; then
2101 destfile="$destdir/$destname"
2102 else
2103 func_basename "$file"
2104 destfile="$func_basename_result"
2105 destfile="$destdir/$destfile"
2106 fi
2107
2108 # Deduce the name of the destination old-style object file.
2109 case $destfile in
2110 *.lo)
2111 func_lo2o "$destfile"
2112 staticdest=$func_lo2o_result
2113 ;;
2114 *.$objext)
2115 staticdest="$destfile"
2116 destfile=
2117 ;;
2118 *)
2119 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2120 ;;
2121 esac
2122
2123 # Install the libtool object if requested.
2124 test -n "$destfile" && \
2125 func_show_eval "$install_prog $file $destfile" 'exit $?'
2126
2127 # Install the old object if enabled.
2128 if test "$build_old_libs" = yes; then
2129 # Deduce the name of the old-style object file.
2130 func_lo2o "$file"
2131 staticobj=$func_lo2o_result
2132 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2133 fi
2134 exit $EXIT_SUCCESS
2135 ;;
2136
2137 *)
2138 # Figure out destination file name, if it wasn't already specified.
2139 if test -n "$destname"; then
2140 destfile="$destdir/$destname"
2141 else
2142 func_basename "$file"
2143 destfile="$func_basename_result"
2144 destfile="$destdir/$destfile"
2145 fi
2146
2147 # If the file is missing, and there is a .exe on the end, strip it
2148 # because it is most likely a libtool script we actually want to
2149 # install
2150 stripped_ext=""
2151 case $file in
2152 *.exe)
2153 if test ! -f "$file"; then
2154 func_stripname '' '.exe' "$file"
2155 file=$func_stripname_result
2156 stripped_ext=".exe"
2157 fi
2158 ;;
2159 esac
2160
2161 # Do a test to see if this is really a libtool program.
2162 case $host in
vapier6acb2cf2009-01-28 04:46:28 +00002163 *cygwin* | *mingw*)
mlcreech636a9952008-05-05 22:52:56 +00002164 if func_ltwrapper_executable_p "$file"; then
2165 func_ltwrapper_scriptname "$file"
2166 wrapper=$func_ltwrapper_scriptname_result
2167 else
2168 func_stripname '' '.exe' "$file"
2169 wrapper=$func_stripname_result
2170 fi
2171 ;;
2172 *)
2173 wrapper=$file
2174 ;;
2175 esac
2176 if func_ltwrapper_script_p "$wrapper"; then
2177 notinst_deplibs=
2178 relink_command=
2179
2180 func_source "$wrapper"
2181
2182 # Check the variables that should have been set.
2183 test -z "$generated_by_libtool_version" && \
2184 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2185
2186 finalize=yes
2187 for lib in $notinst_deplibs; do
2188 # Check to see that each library is installed.
2189 libdir=
2190 if test -f "$lib"; then
2191 func_source "$lib"
2192 fi
2193 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2194 if test -n "$libdir" && test ! -f "$libfile"; then
2195 func_warning "\`$lib' has not been installed in \`$libdir'"
2196 finalize=no
2197 fi
2198 done
2199
2200 relink_command=
2201 func_source "$wrapper"
2202
2203 outputname=
2204 if test "$fast_install" = no && test -n "$relink_command"; then
2205 $opt_dry_run || {
2206 if test "$finalize" = yes; then
2207 tmpdir=`func_mktempdir`
2208 func_basename "$file$stripped_ext"
2209 file="$func_basename_result"
2210 outputname="$tmpdir/$file"
2211 # Replace the output file specification.
2212 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2213
2214 $opt_silent || {
2215 func_quote_for_expand "$relink_command"
2216 eval "func_echo $func_quote_for_expand_result"
2217 }
2218 if eval "$relink_command"; then :
2219 else
2220 func_error "error: relink \`$file' with the above command before installing it"
2221 $opt_dry_run || ${RM}r "$tmpdir"
2222 continue
2223 fi
2224 file="$outputname"
2225 else
2226 func_warning "cannot relink \`$file'"
2227 fi
2228 }
2229 else
2230 # Install the binary that we compiled earlier.
2231 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2232 fi
2233 fi
2234
2235 # remove .exe since cygwin /usr/bin/install will append another
2236 # one anyway
2237 case $install_prog,$host in
2238 */usr/bin/install*,*cygwin*)
2239 case $file:$destfile in
2240 *.exe:*.exe)
2241 # this is ok
2242 ;;
2243 *.exe:*)
2244 destfile=$destfile.exe
2245 ;;
2246 *:*.exe)
2247 func_stripname '' '.exe' "$destfile"
2248 destfile=$func_stripname_result
2249 ;;
2250 esac
2251 ;;
2252 esac
2253 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2254 $opt_dry_run || if test -n "$outputname"; then
2255 ${RM}r "$tmpdir"
2256 fi
2257 ;;
2258 esac
2259 done
2260
2261 for file in $staticlibs; do
2262 func_basename "$file"
2263 name="$func_basename_result"
2264
2265 # Set up the ranlib parameters.
2266 oldlib="$destdir/$name"
2267
2268 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2269
2270 if test -n "$stripme" && test -n "$old_striplib"; then
2271 func_show_eval "$old_striplib $oldlib" 'exit $?'
2272 fi
2273
2274 # Do each command in the postinstall commands.
2275 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2276 done
2277
2278 test -n "$future_libdirs" && \
2279 func_warning "remember to run \`$progname --finish$future_libdirs'"
2280
2281 if test -n "$current_libdirs"; then
2282 # Maybe just do a dry run.
2283 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2284 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2285 else
2286 exit $EXIT_SUCCESS
2287 fi
2288}
2289
2290test "$mode" = install && func_mode_install ${1+"$@"}
2291
2292
2293# func_generate_dlsyms outputname originator pic_p
2294# Extract symbols from dlprefiles and create ${outputname}S.o with
2295# a dlpreopen symbol table.
2296func_generate_dlsyms ()
2297{
2298 $opt_debug
2299 my_outputname="$1"
2300 my_originator="$2"
2301 my_pic_p="${3-no}"
2302 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
2303 my_dlsyms=
2304
2305 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2306 if test -n "$NM" && test -n "$global_symbol_pipe"; then
2307 my_dlsyms="${my_outputname}S.c"
2308 else
2309 func_error "not configured to extract global symbols from dlpreopened files"
2310 fi
2311 fi
2312
2313 if test -n "$my_dlsyms"; then
2314 case $my_dlsyms in
2315 "") ;;
2316 *.c)
2317 # Discover the nlist of each of the dlfiles.
2318 nlist="$output_objdir/${my_outputname}.nm"
2319
2320 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
2321
2322 # Parse the name list into a source file.
2323 func_verbose "creating $output_objdir/$my_dlsyms"
2324
2325 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
2326/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
2327/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
2328
2329#ifdef __cplusplus
2330extern \"C\" {
2331#endif
2332
2333/* External symbol declarations for the compiler. */\
2334"
2335
2336 if test "$dlself" = yes; then
2337 func_verbose "generating symbol list for \`$output'"
2338
2339 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
2340
2341 # Add our own program objects to the symbol list.
2342 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2343 for progfile in $progfiles; do
2344 func_verbose "extracting global C symbols from \`$progfile'"
2345 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
2346 done
2347
2348 if test -n "$exclude_expsyms"; then
2349 $opt_dry_run || {
2350 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2351 eval '$MV "$nlist"T "$nlist"'
2352 }
2353 fi
2354
2355 if test -n "$export_symbols_regex"; then
2356 $opt_dry_run || {
2357 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2358 eval '$MV "$nlist"T "$nlist"'
2359 }
2360 fi
2361
2362 # Prepare the list of exported symbols
2363 if test -z "$export_symbols"; then
2364 export_symbols="$output_objdir/$outputname.exp"
2365 $opt_dry_run || {
2366 $RM $export_symbols
2367 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
2368 case $host in
vapier6acb2cf2009-01-28 04:46:28 +00002369 *cygwin* | *mingw* | *cegcc* )
mlcreech636a9952008-05-05 22:52:56 +00002370 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2371 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
2372 ;;
2373 esac
2374 }
2375 else
2376 $opt_dry_run || {
2377 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
2378 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
2379 eval '$MV "$nlist"T "$nlist"'
2380 case $host in
vapier6acb2cf2009-01-28 04:46:28 +00002381 *cygwin | *mingw* | *cegcc* )
mlcreech636a9952008-05-05 22:52:56 +00002382 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
2383 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
2384 ;;
2385 esac
2386 }
2387 fi
2388 fi
2389
2390 for dlprefile in $dlprefiles; do
2391 func_verbose "extracting global C symbols from \`$dlprefile'"
2392 func_basename "$dlprefile"
2393 name="$func_basename_result"
2394 $opt_dry_run || {
2395 eval '$ECHO ": $name " >> "$nlist"'
2396 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
2397 }
2398 done
2399
2400 $opt_dry_run || {
2401 # Make sure we have at least an empty file.
2402 test -f "$nlist" || : > "$nlist"
2403
2404 if test -n "$exclude_expsyms"; then
2405 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
2406 $MV "$nlist"T "$nlist"
2407 fi
2408
2409 # Try sorting and uniquifying the output.
2410 if $GREP -v "^: " < "$nlist" |
2411 if sort -k 3 </dev/null >/dev/null 2>&1; then
2412 sort -k 3
2413 else
2414 sort +2
2415 fi |
2416 uniq > "$nlist"S; then
2417 :
2418 else
2419 $GREP -v "^: " < "$nlist" > "$nlist"S
2420 fi
2421
2422 if test -f "$nlist"S; then
2423 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
2424 else
2425 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
2426 fi
2427
2428 $ECHO >> "$output_objdir/$my_dlsyms" "\
2429
2430/* The mapping between symbol names and symbols. */
2431typedef struct {
2432 const char *name;
2433 void *address;
2434} lt_dlsymlist;
2435"
2436 case $host in
vapier6acb2cf2009-01-28 04:46:28 +00002437 *cygwin* | *mingw* | *cegcc* )
mlcreech636a9952008-05-05 22:52:56 +00002438 $ECHO >> "$output_objdir/$my_dlsyms" "\
2439/* DATA imports from DLLs on WIN32 con't be const, because
2440 runtime relocations are performed -- see ld's documentation
2441 on pseudo-relocs. */"
2442 lt_dlsym_const= ;;
2443 *osf5*)
2444 echo >> "$output_objdir/$my_dlsyms" "\
2445/* This system does not cope well with relocations in const data */"
2446 lt_dlsym_const= ;;
2447 *)
2448 lt_dlsym_const=const ;;
2449 esac
2450
2451 $ECHO >> "$output_objdir/$my_dlsyms" "\
2452extern $lt_dlsym_const lt_dlsymlist
2453lt_${my_prefix}_LTX_preloaded_symbols[];
2454$lt_dlsym_const lt_dlsymlist
2455lt_${my_prefix}_LTX_preloaded_symbols[] =
2456{\
2457 { \"$my_originator\", (void *) 0 },"
2458
2459 case $need_lib_prefix in
2460 no)
2461 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
2462 ;;
2463 *)
2464 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
2465 ;;
2466 esac
2467 $ECHO >> "$output_objdir/$my_dlsyms" "\
2468 {0, (void *) 0}
2469};
2470
2471/* This works around a problem in FreeBSD linker */
2472#ifdef FREEBSD_WORKAROUND
2473static const void *lt_preloaded_setup() {
2474 return lt_${my_prefix}_LTX_preloaded_symbols;
2475}
2476#endif
2477
2478#ifdef __cplusplus
2479}
2480#endif\
2481"
2482 } # !$opt_dry_run
2483
2484 pic_flag_for_symtable=
2485 case "$compile_command " in
2486 *" -static "*) ;;
2487 *)
2488 case $host in
2489 # compiling the symbol table file with pic_flag works around
2490 # a FreeBSD bug that causes programs to crash when -lm is
2491 # linked before any other PIC object. But we must not use
2492 # pic_flag when linking with -static. The problem exists in
2493 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2494 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2495 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
2496 *-*-hpux*)
2497 pic_flag_for_symtable=" $pic_flag" ;;
2498 *)
2499 if test "X$my_pic_p" != Xno; then
2500 pic_flag_for_symtable=" $pic_flag"
2501 fi
2502 ;;
2503 esac
2504 ;;
2505 esac
2506 symtab_cflags=
2507 for arg in $LTCFLAGS; do
2508 case $arg in
2509 -pie | -fpie | -fPIE) ;;
2510 *) symtab_cflags="$symtab_cflags $arg" ;;
2511 esac
2512 done
2513
2514 # Now compile the dynamic symbol file.
2515 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
2516
2517 # Clean up the generated files.
2518 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
2519
2520 # Transform the symbol file into the correct name.
2521 symfileobj="$output_objdir/${my_outputname}S.$objext"
2522 case $host in
vapier6acb2cf2009-01-28 04:46:28 +00002523 *cygwin* | *mingw* | *cegcc* )
mlcreech636a9952008-05-05 22:52:56 +00002524 if test -f "$output_objdir/$my_outputname.def"; then
2525 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2526 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
2527 else
2528 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2529 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2530 fi
2531 ;;
2532 *)
2533 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2534 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
2535 ;;
2536 esac
2537 ;;
2538 *)
2539 func_fatal_error "unknown suffix for \`$my_dlsyms'"
2540 ;;
2541 esac
2542 else
2543 # We keep going just in case the user didn't refer to
2544 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
2545 # really was required.
2546
2547 # Nullify the symbol file.
2548 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2549 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2550 fi
2551}
2552
2553# func_win32_libid arg
2554# return the library type of file 'arg'
2555#
2556# Need a lot of goo to handle *both* DLLs and import libs
2557# Has to be a shell function in order to 'eat' the argument
2558# that is supplied when $file_magic_command is called.
2559func_win32_libid ()
2560{
2561 $opt_debug
2562 win32_libid_type="unknown"
2563 win32_fileres=`file -L $1 2>/dev/null`
2564 case $win32_fileres in
2565 *ar\ archive\ import\ library*) # definitely import
2566 win32_libid_type="x86 archive import"
2567 ;;
2568 *ar\ archive*) # could be an import, or static
2569 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
2570 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
2571 win32_nmres=`eval $NM -f posix -A $1 |
2572 $SED -n -e '
2573 1,100{
2574 / I /{
2575 s,.*,import,
2576 p
2577 q
2578 }
2579 }'`
2580 case $win32_nmres in
2581 import*) win32_libid_type="x86 archive import";;
2582 *) win32_libid_type="x86 archive static";;
2583 esac
2584 fi
2585 ;;
2586 *DLL*)
2587 win32_libid_type="x86 DLL"
2588 ;;
2589 *executable*) # but shell scripts are "executable" too...
2590 case $win32_fileres in
2591 *MS\ Windows\ PE\ Intel*)
2592 win32_libid_type="x86 DLL"
2593 ;;
2594 esac
2595 ;;
2596 esac
2597 $ECHO "$win32_libid_type"
2598}
2599
2600
2601
2602# func_extract_an_archive dir oldlib
2603func_extract_an_archive ()
2604{
2605 $opt_debug
2606 f_ex_an_ar_dir="$1"; shift
2607 f_ex_an_ar_oldlib="$1"
2608 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
2609 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2610 :
2611 else
2612 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
2613 fi
2614}
2615
2616
2617# func_extract_archives gentop oldlib ...
2618func_extract_archives ()
2619{
2620 $opt_debug
2621 my_gentop="$1"; shift
2622 my_oldlibs=${1+"$@"}
2623 my_oldobjs=""
2624 my_xlib=""
2625 my_xabs=""
2626 my_xdir=""
2627
2628 for my_xlib in $my_oldlibs; do
2629 # Extract the objects.
2630 case $my_xlib in
2631 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
2632 *) my_xabs=`pwd`"/$my_xlib" ;;
2633 esac
2634 func_basename "$my_xlib"
2635 my_xlib="$func_basename_result"
2636 my_xlib_u=$my_xlib
2637 while :; do
2638 case " $extracted_archives " in
2639 *" $my_xlib_u "*)
2640 func_arith $extracted_serial + 1
2641 extracted_serial=$func_arith_result
2642 my_xlib_u=lt$extracted_serial-$my_xlib ;;
2643 *) break ;;
2644 esac
2645 done
2646 extracted_archives="$extracted_archives $my_xlib_u"
2647 my_xdir="$my_gentop/$my_xlib_u"
2648
2649 func_mkdir_p "$my_xdir"
2650
2651 case $host in
2652 *-darwin*)
2653 func_verbose "Extracting $my_xabs"
2654 # Do not bother doing anything if just a dry run
2655 $opt_dry_run || {
2656 darwin_orig_dir=`pwd`
2657 cd $my_xdir || exit $?
2658 darwin_archive=$my_xabs
2659 darwin_curdir=`pwd`
2660 darwin_base_archive=`basename "$darwin_archive"`
2661 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
2662 if test -n "$darwin_arches"; then
2663 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
2664 darwin_arch=
2665 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
2666 for darwin_arch in $darwin_arches ; do
2667 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2668 $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
2669 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
2670 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
2671 cd "$darwin_curdir"
2672 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
2673 done # $darwin_arches
2674 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
2675 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
2676 darwin_file=
2677 darwin_files=
2678 for darwin_file in $darwin_filelist; do
2679 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
2680 $LIPO -create -output "$darwin_file" $darwin_files
2681 done # $darwin_filelist
2682 $RM -rf unfat-$$
2683 cd "$darwin_orig_dir"
2684 else
2685 cd $darwin_orig_dir
2686 func_extract_an_archive "$my_xdir" "$my_xabs"
2687 fi # $darwin_arches
2688 } # !$opt_dry_run
2689 ;;
2690 *)
2691 func_extract_an_archive "$my_xdir" "$my_xabs"
2692 ;;
2693 esac
2694 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
2695 done
2696
2697 func_extract_archives_result="$my_oldobjs"
2698}
2699
2700
2701
vapier6acb2cf2009-01-28 04:46:28 +00002702# func_emit_wrapper_part1 [arg=no]
mlcreech636a9952008-05-05 22:52:56 +00002703#
vapier6acb2cf2009-01-28 04:46:28 +00002704# Emit the first part of a libtool wrapper script on stdout.
2705# For more information, see the description associated with
2706# func_emit_wrapper(), below.
2707func_emit_wrapper_part1 ()
mlcreech636a9952008-05-05 22:52:56 +00002708{
vapier6acb2cf2009-01-28 04:46:28 +00002709 func_emit_wrapper_part1_arg1=no
mlcreech636a9952008-05-05 22:52:56 +00002710 if test -n "$1" ; then
vapier6acb2cf2009-01-28 04:46:28 +00002711 func_emit_wrapper_part1_arg1=$1
mlcreech636a9952008-05-05 22:52:56 +00002712 fi
2713
2714 $ECHO "\
2715#! $SHELL
2716
2717# $output - temporary wrapper script for $objdir/$outputname
2718# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
2719#
2720# The $output program cannot be directly executed until all the libtool
2721# libraries that it depends on are installed.
2722#
2723# This wrapper script should never be moved out of the build directory.
2724# If it is, it will not operate correctly.
2725
2726# Sed substitution that helps us do robust quoting. It backslashifies
2727# metacharacters that are still active within double-quoted strings.
2728Xsed='${SED} -e 1s/^X//'
2729sed_quote_subst='$sed_quote_subst'
2730
2731# Be Bourne compatible
2732if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
2733 emulate sh
2734 NULLCMD=:
2735 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
2736 # is contrary to our usage. Disable this feature.
2737 alias -g '\${1+\"\$@\"}'='\"\$@\"'
2738 setopt NO_GLOB_SUBST
2739else
2740 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
2741fi
2742BIN_SH=xpg4; export BIN_SH # for Tru64
2743DUALCASE=1; export DUALCASE # for MKS sh
2744
2745# The HP-UX ksh and POSIX shell print the target directory to stdout
2746# if CDPATH is set.
2747(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
2748
2749relink_command=\"$relink_command\"
2750
2751# This environment variable determines our operation mode.
2752if test \"\$libtool_install_magic\" = \"$magic\"; then
2753 # install mode needs the following variables:
2754 generated_by_libtool_version='$macro_version'
2755 notinst_deplibs='$notinst_deplibs'
2756else
2757 # When we are sourced in execute mode, \$file and \$ECHO are already set.
2758 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2759 ECHO=\"$qecho\"
2760 file=\"\$0\"
2761 # Make sure echo works.
2762 if test \"X\$1\" = X--no-reexec; then
2763 # Discard the --no-reexec flag, and continue.
2764 shift
2765 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
2766 # Yippee, \$ECHO works!
2767 :
2768 else
2769 # Restart under the correct shell, and then maybe \$ECHO will work.
2770 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
2771 fi
2772 fi\
2773"
2774 $ECHO "\
2775
2776 # Find the directory that this script lives in.
2777 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
2778 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
2779
2780 # Follow symbolic links until we get to the real thisdir.
2781 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
2782 while test -n \"\$file\"; do
2783 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2784
2785 # If there was a directory component, then change thisdir.
2786 if test \"x\$destdir\" != \"x\$file\"; then
2787 case \"\$destdir\" in
2788 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2789 *) thisdir=\"\$thisdir/\$destdir\" ;;
2790 esac
2791 fi
2792
2793 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2794 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
2795 done
vapier6acb2cf2009-01-28 04:46:28 +00002796"
2797}
2798# end: func_emit_wrapper_part1
2799
2800# func_emit_wrapper_part2 [arg=no]
2801#
2802# Emit the second part of a libtool wrapper script on stdout.
2803# For more information, see the description associated with
2804# func_emit_wrapper(), below.
2805func_emit_wrapper_part2 ()
2806{
2807 func_emit_wrapper_part2_arg1=no
2808 if test -n "$1" ; then
2809 func_emit_wrapper_part2_arg1=$1
2810 fi
2811
2812 $ECHO "\
mlcreech636a9952008-05-05 22:52:56 +00002813
2814 # Usually 'no', except on cygwin/mingw when embedded into
2815 # the cwrapper.
vapier6acb2cf2009-01-28 04:46:28 +00002816 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
mlcreech636a9952008-05-05 22:52:56 +00002817 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
2818 # special case for '.'
2819 if test \"\$thisdir\" = \".\"; then
2820 thisdir=\`pwd\`
2821 fi
2822 # remove .libs from thisdir
2823 case \"\$thisdir\" in
2824 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
2825 $objdir ) thisdir=. ;;
2826 esac
2827 fi
2828
2829 # Try to get the absolute directory name.
2830 absdir=\`cd \"\$thisdir\" && pwd\`
2831 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2832"
2833
2834 if test "$fast_install" = yes; then
2835 $ECHO "\
2836 program=lt-'$outputname'$exeext
2837 progdir=\"\$thisdir/$objdir\"
2838
2839 if test ! -f \"\$progdir/\$program\" ||
2840 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
2841 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2842
2843 file=\"\$\$-\$program\"
2844
2845 if test ! -d \"\$progdir\"; then
2846 $MKDIR \"\$progdir\"
2847 else
2848 $RM \"\$progdir/\$file\"
2849 fi"
2850
2851 $ECHO "\
2852
2853 # relink executable if necessary
2854 if test -n \"\$relink_command\"; then
2855 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
2856 else
2857 $ECHO \"\$relink_command_output\" >&2
2858 $RM \"\$progdir/\$file\"
2859 exit 1
2860 fi
2861 fi
2862
2863 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
2864 { $RM \"\$progdir/\$program\";
2865 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2866 $RM \"\$progdir/\$file\"
2867 fi"
2868 else
2869 $ECHO "\
2870 program='$outputname'
2871 progdir=\"\$thisdir/$objdir\"
2872"
2873 fi
2874
2875 $ECHO "\
2876
2877 if test -f \"\$progdir/\$program\"; then"
2878
2879 # Export our shlibpath_var if we have one.
2880 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
2881 $ECHO "\
2882 # Add our own library path to $shlibpath_var
2883 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
2884
2885 # Some systems cannot cope with colon-terminated $shlibpath_var
2886 # The second colon is a workaround for a bug in BeOS R4 sed
2887 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
2888
2889 export $shlibpath_var
2890"
2891 fi
2892
2893 # fixup the dll searchpath if we need to.
2894 if test -n "$dllsearchpath"; then
2895 $ECHO "\
2896 # Add the dll search path components to the executable PATH
2897 PATH=$dllsearchpath:\$PATH
2898"
2899 fi
2900
2901 $ECHO "\
2902 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2903 # Run the actual program with our arguments.
2904"
2905 case $host in
2906 # Backslashes separate directories on plain windows
vapier6acb2cf2009-01-28 04:46:28 +00002907 *-*-mingw | *-*-os2* | *-cegcc*)
mlcreech636a9952008-05-05 22:52:56 +00002908 $ECHO "\
2909 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
2910"
2911 ;;
2912
2913 *)
2914 $ECHO "\
2915 exec \"\$progdir/\$program\" \${1+\"\$@\"}
2916"
2917 ;;
2918 esac
2919 $ECHO "\
2920 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
2921 exit 1
2922 fi
2923 else
2924 # The program doesn't exist.
2925 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
2926 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
2927 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
2928 exit 1
2929 fi
2930fi\
2931"
2932}
vapier6acb2cf2009-01-28 04:46:28 +00002933# end: func_emit_wrapper_part2
2934
2935
2936# func_emit_wrapper [arg=no]
2937#
2938# Emit a libtool wrapper script on stdout.
2939# Don't directly open a file because we may want to
2940# incorporate the script contents within a cygwin/mingw
2941# wrapper executable. Must ONLY be called from within
2942# func_mode_link because it depends on a number of variables
2943# set therein.
2944#
2945# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
2946# variable will take. If 'yes', then the emitted script
2947# will assume that the directory in which it is stored is
2948# the $objdir directory. This is a cygwin/mingw-specific
2949# behavior.
2950func_emit_wrapper ()
2951{
2952 func_emit_wrapper_arg1=no
2953 if test -n "$1" ; then
2954 func_emit_wrapper_arg1=$1
2955 fi
2956
2957 # split this up so that func_emit_cwrapperexe_src
2958 # can call each part independently.
2959 func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
2960 func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
2961}
2962
2963
2964# func_to_host_path arg
2965#
2966# Convert paths to host format when used with build tools.
2967# Intended for use with "native" mingw (where libtool itself
2968# is running under the msys shell), or in the following cross-
2969# build environments:
2970# $build $host
2971# mingw (msys) mingw [e.g. native]
2972# cygwin mingw
2973# *nix + wine mingw
2974# where wine is equipped with the `winepath' executable.
2975# In the native mingw case, the (msys) shell automatically
2976# converts paths for any non-msys applications it launches,
2977# but that facility isn't available from inside the cwrapper.
2978# Similar accommodations are necessary for $host mingw and
2979# $build cygwin. Calling this function does no harm for other
2980# $host/$build combinations not listed above.
2981#
2982# ARG is the path (on $build) that should be converted to
2983# the proper representation for $host. The result is stored
2984# in $func_to_host_path_result.
2985func_to_host_path ()
2986{
2987 func_to_host_path_result="$1"
2988 if test -n "$1" ; then
2989 case $host in
2990 *mingw* )
2991 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
2992 case $build in
2993 *mingw* ) # actually, msys
2994 # awkward: cmd appends spaces to result
2995 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
2996 func_to_host_path_tmp1=`( cmd //c echo "$1" |\
2997 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
2998 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
2999 $SED -e "$lt_sed_naive_backslashify"`
3000 ;;
3001 *cygwin* )
3002 func_to_host_path_tmp1=`cygpath -w "$1"`
3003 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3004 $SED -e "$lt_sed_naive_backslashify"`
3005 ;;
3006 * )
3007 # Unfortunately, winepath does not exit with a non-zero
3008 # error code, so we are forced to check the contents of
3009 # stdout. On the other hand, if the command is not
3010 # found, the shell will set an exit code of 127 and print
3011 # *an error message* to stdout. So we must check for both
3012 # error code of zero AND non-empty stdout, which explains
3013 # the odd construction:
3014 func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
3015 if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
3016 func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
3017 $SED -e "$lt_sed_naive_backslashify"`
3018 else
3019 # Allow warning below.
3020 func_to_host_path_result=""
3021 fi
3022 ;;
3023 esac
3024 if test -z "$func_to_host_path_result" ; then
3025 func_error "Could not determine host path corresponding to"
3026 func_error " '$1'"
3027 func_error "Continuing, but uninstalled executables may not work."
3028 # Fallback:
3029 func_to_host_path_result="$1"
3030 fi
3031 ;;
3032 esac
3033 fi
3034}
3035# end: func_to_host_path
3036
3037# func_to_host_pathlist arg
3038#
3039# Convert pathlists to host format when used with build tools.
3040# See func_to_host_path(), above. This function supports the
3041# following $build/$host combinations (but does no harm for
3042# combinations not listed here):
3043# $build $host
3044# mingw (msys) mingw [e.g. native]
3045# cygwin mingw
3046# *nix + wine mingw
3047#
3048# Path separators are also converted from $build format to
3049# $host format. If ARG begins or ends with a path separator
3050# character, it is preserved (but converted to $host format)
3051# on output.
3052#
3053# ARG is a pathlist (on $build) that should be converted to
3054# the proper representation on $host. The result is stored
3055# in $func_to_host_pathlist_result.
3056func_to_host_pathlist ()
3057{
3058 func_to_host_pathlist_result="$1"
3059 if test -n "$1" ; then
3060 case $host in
3061 *mingw* )
3062 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
3063 # Remove leading and trailing path separator characters from
3064 # ARG. msys behavior is inconsistent here, cygpath turns them
3065 # into '.;' and ';.', and winepath ignores them completely.
3066 func_to_host_pathlist_tmp2="$1"
3067 # Once set for this call, this variable should not be
3068 # reassigned. It is used in tha fallback case.
3069 func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
3070 $SED -e 's|^:*||' -e 's|:*$||'`
3071 case $build in
3072 *mingw* ) # Actually, msys.
3073 # Awkward: cmd appends spaces to result.
3074 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
3075 func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
3076 $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
3077 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3078 $SED -e "$lt_sed_naive_backslashify"`
3079 ;;
3080 *cygwin* )
3081 func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
3082 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
3083 $SED -e "$lt_sed_naive_backslashify"`
3084 ;;
3085 * )
3086 # unfortunately, winepath doesn't convert pathlists
3087 func_to_host_pathlist_result=""
3088 func_to_host_pathlist_oldIFS=$IFS
3089 IFS=:
3090 for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
3091 IFS=$func_to_host_pathlist_oldIFS
3092 if test -n "$func_to_host_pathlist_f" ; then
3093 func_to_host_path "$func_to_host_pathlist_f"
3094 if test -n "$func_to_host_path_result" ; then
3095 if test -z "$func_to_host_pathlist_result" ; then
3096 func_to_host_pathlist_result="$func_to_host_path_result"
3097 else
3098 func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
3099 fi
3100 fi
3101 fi
3102 IFS=:
3103 done
3104 IFS=$func_to_host_pathlist_oldIFS
3105 ;;
3106 esac
3107 if test -z "$func_to_host_pathlist_result" ; then
3108 func_error "Could not determine the host path(s) corresponding to"
3109 func_error " '$1'"
3110 func_error "Continuing, but uninstalled executables may not work."
3111 # Fallback. This may break if $1 contains DOS-style drive
3112 # specifications. The fix is not to complicate the expression
3113 # below, but for the user to provide a working wine installation
3114 # with winepath so that path translation in the cross-to-mingw
3115 # case works properly.
3116 lt_replace_pathsep_nix_to_dos="s|:|;|g"
3117 func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
3118 $SED -e "$lt_replace_pathsep_nix_to_dos"`
3119 fi
3120 # Now, add the leading and trailing path separators back
3121 case "$1" in
3122 :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
3123 ;;
3124 esac
3125 case "$1" in
3126 *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
3127 ;;
3128 esac
3129 ;;
3130 esac
3131 fi
3132}
3133# end: func_to_host_pathlist
mlcreech636a9952008-05-05 22:52:56 +00003134
3135# func_emit_cwrapperexe_src
3136# emit the source code for a wrapper executable on stdout
3137# Must ONLY be called from within func_mode_link because
3138# it depends on a number of variable set therein.
3139func_emit_cwrapperexe_src ()
3140{
3141 cat <<EOF
3142
3143/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
3144 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
3145
3146 The $output program cannot be directly executed until all the libtool
3147 libraries that it depends on are installed.
3148
3149 This wrapper executable should never be moved out of the build directory.
3150 If it is, it will not operate correctly.
3151
3152 Currently, it simply execs the wrapper *script* "$SHELL $output",
3153 but could eventually absorb all of the scripts functionality and
3154 exec $objdir/$outputname directly.
3155*/
3156EOF
3157 cat <<"EOF"
3158#include <stdio.h>
3159#include <stdlib.h>
3160#ifdef _MSC_VER
3161# include <direct.h>
3162# include <process.h>
3163# include <io.h>
3164# define setmode _setmode
3165#else
3166# include <unistd.h>
3167# include <stdint.h>
3168# ifdef __CYGWIN__
3169# include <io.h>
vapier6acb2cf2009-01-28 04:46:28 +00003170# define HAVE_SETENV
3171# ifdef __STRICT_ANSI__
3172char *realpath (const char *, char *);
3173int putenv (char *);
3174int setenv (const char *, const char *, int);
3175# endif
mlcreech636a9952008-05-05 22:52:56 +00003176# endif
3177#endif
3178#include <malloc.h>
3179#include <stdarg.h>
3180#include <assert.h>
3181#include <string.h>
3182#include <ctype.h>
3183#include <errno.h>
3184#include <fcntl.h>
3185#include <sys/stat.h>
3186
3187#if defined(PATH_MAX)
3188# define LT_PATHMAX PATH_MAX
3189#elif defined(MAXPATHLEN)
3190# define LT_PATHMAX MAXPATHLEN
3191#else
3192# define LT_PATHMAX 1024
3193#endif
3194
3195#ifndef S_IXOTH
3196# define S_IXOTH 0
3197#endif
3198#ifndef S_IXGRP
3199# define S_IXGRP 0
3200#endif
3201
3202#ifdef _MSC_VER
3203# define S_IXUSR _S_IEXEC
3204# define stat _stat
3205# ifndef _INTPTR_T_DEFINED
3206# define intptr_t int
3207# endif
3208#endif
3209
3210#ifndef DIR_SEPARATOR
3211# define DIR_SEPARATOR '/'
3212# define PATH_SEPARATOR ':'
3213#endif
3214
3215#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
3216 defined (__OS2__)
3217# define HAVE_DOS_BASED_FILE_SYSTEM
3218# define FOPEN_WB "wb"
3219# ifndef DIR_SEPARATOR_2
3220# define DIR_SEPARATOR_2 '\\'
3221# endif
3222# ifndef PATH_SEPARATOR_2
3223# define PATH_SEPARATOR_2 ';'
3224# endif
3225#endif
3226
3227#ifndef DIR_SEPARATOR_2
3228# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
3229#else /* DIR_SEPARATOR_2 */
3230# define IS_DIR_SEPARATOR(ch) \
3231 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
3232#endif /* DIR_SEPARATOR_2 */
3233
3234#ifndef PATH_SEPARATOR_2
3235# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
3236#else /* PATH_SEPARATOR_2 */
3237# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
3238#endif /* PATH_SEPARATOR_2 */
3239
3240#ifdef __CYGWIN__
3241# define FOPEN_WB "wb"
3242#endif
3243
3244#ifndef FOPEN_WB
3245# define FOPEN_WB "w"
3246#endif
3247#ifndef _O_BINARY
3248# define _O_BINARY 0
3249#endif
3250
3251#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
3252#define XFREE(stale) do { \
3253 if (stale) { free ((void *) stale); stale = 0; } \
3254} while (0)
3255
3256#undef LTWRAPPER_DEBUGPRINTF
3257#if defined DEBUGWRAPPER
3258# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
3259static void
3260ltwrapper_debugprintf (const char *fmt, ...)
3261{
3262 va_list args;
3263 va_start (args, fmt);
3264 (void) vfprintf (stderr, fmt, args);
3265 va_end (args);
3266}
3267#else
3268# define LTWRAPPER_DEBUGPRINTF(args)
3269#endif
3270
3271const char *program_name = NULL;
3272
3273void *xmalloc (size_t num);
3274char *xstrdup (const char *string);
3275const char *base_name (const char *name);
3276char *find_executable (const char *wrapper);
3277char *chase_symlinks (const char *pathspec);
3278int make_executable (const char *path);
3279int check_executable (const char *path);
3280char *strendzap (char *str, const char *pat);
3281void lt_fatal (const char *message, ...);
vapier6acb2cf2009-01-28 04:46:28 +00003282void lt_setenv (const char *name, const char *value);
3283char *lt_extend_str (const char *orig_value, const char *add, int to_end);
3284void lt_opt_process_env_set (const char *arg);
3285void lt_opt_process_env_prepend (const char *arg);
3286void lt_opt_process_env_append (const char *arg);
3287int lt_split_name_value (const char *arg, char** name, char** value);
3288void lt_update_exe_path (const char *name, const char *value);
3289void lt_update_lib_path (const char *name, const char *value);
mlcreech636a9952008-05-05 22:52:56 +00003290
vapier6acb2cf2009-01-28 04:46:28 +00003291static const char *script_text_part1 =
mlcreech636a9952008-05-05 22:52:56 +00003292EOF
3293
vapier6acb2cf2009-01-28 04:46:28 +00003294 func_emit_wrapper_part1 yes |
3295 $SED -e 's/\([\\"]\)/\\\1/g' \
3296 -e 's/^/ "/' -e 's/$/\\n"/'
3297 echo ";"
3298 cat <<EOF
3299
3300static const char *script_text_part2 =
3301EOF
3302 func_emit_wrapper_part2 yes |
mlcreech636a9952008-05-05 22:52:56 +00003303 $SED -e 's/\([\\"]\)/\\\1/g' \
3304 -e 's/^/ "/' -e 's/$/\\n"/'
3305 echo ";"
3306
3307 cat <<EOF
3308const char * MAGIC_EXE = "$magic_exe";
vapier6acb2cf2009-01-28 04:46:28 +00003309const char * LIB_PATH_VARNAME = "$shlibpath_var";
3310EOF
3311
3312 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3313 func_to_host_pathlist "$temp_rpath"
3314 cat <<EOF
3315const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
3316EOF
3317 else
3318 cat <<"EOF"
3319const char * LIB_PATH_VALUE = "";
3320EOF
3321 fi
3322
3323 if test -n "$dllsearchpath"; then
3324 func_to_host_pathlist "$dllsearchpath:"
3325 cat <<EOF
3326const char * EXE_PATH_VARNAME = "PATH";
3327const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
3328EOF
3329 else
3330 cat <<"EOF"
3331const char * EXE_PATH_VARNAME = "";
3332const char * EXE_PATH_VALUE = "";
3333EOF
3334 fi
3335
3336 if test "$fast_install" = yes; then
3337 cat <<EOF
3338const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
3339EOF
3340 else
3341 cat <<EOF
3342const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
3343EOF
3344 fi
3345
3346
3347 cat <<"EOF"
3348
3349#define LTWRAPPER_OPTION_PREFIX "--lt-"
3350#define LTWRAPPER_OPTION_PREFIX_LENGTH 5
3351
3352static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
3353static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
3354
3355static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
3356
3357static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
3358static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
3359 /* argument is putenv-style "foo=bar", value of foo is set to bar */
3360
3361static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
3362static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
3363 /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
3364
3365static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
3366static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
3367 /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
mlcreech636a9952008-05-05 22:52:56 +00003368
3369int
3370main (int argc, char *argv[])
3371{
3372 char **newargz;
vapier6acb2cf2009-01-28 04:46:28 +00003373 int newargc;
mlcreech636a9952008-05-05 22:52:56 +00003374 char *tmp_pathspec;
3375 char *actual_cwrapper_path;
vapier6acb2cf2009-01-28 04:46:28 +00003376 char *actual_cwrapper_name;
3377 char *target_name;
3378 char *lt_argv_zero;
mlcreech636a9952008-05-05 22:52:56 +00003379 intptr_t rval = 127;
mlcreech636a9952008-05-05 22:52:56 +00003380
mlcreech636a9952008-05-05 22:52:56 +00003381 int i;
3382
3383 program_name = (char *) xstrdup (base_name (argv[0]));
3384 LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
3385 LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
3386
3387 /* very simple arg parsing; don't want to rely on getopt */
3388 for (i = 1; i < argc; i++)
3389 {
3390 if (strcmp (argv[i], dumpscript_opt) == 0)
3391 {
3392EOF
3393 case "$host" in
3394 *mingw* | *cygwin* )
3395 # make stdout use "unix" line endings
3396 echo " setmode(1,_O_BINARY);"
3397 ;;
3398 esac
3399
vapier6acb2cf2009-01-28 04:46:28 +00003400 cat <<"EOF"
3401 printf ("%s", script_text_part1);
3402 printf ("%s", script_text_part2);
mlcreech636a9952008-05-05 22:52:56 +00003403 return 0;
3404 }
3405 }
3406
vapier6acb2cf2009-01-28 04:46:28 +00003407 newargz = XMALLOC (char *, argc + 1);
mlcreech636a9952008-05-05 22:52:56 +00003408 tmp_pathspec = find_executable (argv[0]);
3409 if (tmp_pathspec == NULL)
3410 lt_fatal ("Couldn't find %s", argv[0]);
3411 LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
3412 tmp_pathspec));
3413
3414 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
3415 LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
3416 actual_cwrapper_path));
3417 XFREE (tmp_pathspec);
3418
vapier6acb2cf2009-01-28 04:46:28 +00003419 actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
3420 strendzap (actual_cwrapper_path, actual_cwrapper_name);
mlcreech636a9952008-05-05 22:52:56 +00003421
vapier6acb2cf2009-01-28 04:46:28 +00003422 /* wrapper name transforms */
3423 strendzap (actual_cwrapper_name, ".exe");
3424 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
3425 XFREE (actual_cwrapper_name);
3426 actual_cwrapper_name = tmp_pathspec;
mlcreech636a9952008-05-05 22:52:56 +00003427 tmp_pathspec = 0;
vapier6acb2cf2009-01-28 04:46:28 +00003428
3429 /* target_name transforms -- use actual target program name; might have lt- prefix */
3430 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
3431 strendzap (target_name, ".exe");
3432 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
3433 XFREE (target_name);
3434 target_name = tmp_pathspec;
3435 tmp_pathspec = 0;
3436
3437 LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
3438 target_name));
mlcreech636a9952008-05-05 22:52:56 +00003439EOF
3440
3441 cat <<EOF
vapier6acb2cf2009-01-28 04:46:28 +00003442 newargz[0] =
mlcreech636a9952008-05-05 22:52:56 +00003443 XMALLOC (char, (strlen (actual_cwrapper_path) +
vapier6acb2cf2009-01-28 04:46:28 +00003444 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
3445 strcpy (newargz[0], actual_cwrapper_path);
3446 strcat (newargz[0], "$objdir");
3447 strcat (newargz[0], "/");
mlcreech636a9952008-05-05 22:52:56 +00003448EOF
3449
vapier6acb2cf2009-01-28 04:46:28 +00003450 cat <<"EOF"
3451 /* stop here, and copy so we don't have to do this twice */
3452 tmp_pathspec = xstrdup (newargz[0]);
3453
3454 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
3455 strcat (newargz[0], actual_cwrapper_name);
3456
3457 /* DO want the lt- prefix here if it exists, so use target_name */
3458 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
3459 XFREE (tmp_pathspec);
3460 tmp_pathspec = NULL;
3461EOF
mlcreech636a9952008-05-05 22:52:56 +00003462
3463 case $host_os in
3464 mingw*)
3465 cat <<"EOF"
3466 {
3467 char* p;
vapier6acb2cf2009-01-28 04:46:28 +00003468 while ((p = strchr (newargz[0], '\\')) != NULL)
3469 {
3470 *p = '/';
3471 }
3472 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
mlcreech636a9952008-05-05 22:52:56 +00003473 {
3474 *p = '/';
3475 }
3476 }
3477EOF
3478 ;;
3479 esac
3480
3481 cat <<"EOF"
vapier6acb2cf2009-01-28 04:46:28 +00003482 XFREE (target_name);
mlcreech636a9952008-05-05 22:52:56 +00003483 XFREE (actual_cwrapper_path);
vapier6acb2cf2009-01-28 04:46:28 +00003484 XFREE (actual_cwrapper_name);
mlcreech636a9952008-05-05 22:52:56 +00003485
vapier6acb2cf2009-01-28 04:46:28 +00003486 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
3487 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
3488 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
3489 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
mlcreech636a9952008-05-05 22:52:56 +00003490
vapier6acb2cf2009-01-28 04:46:28 +00003491 newargc=0;
mlcreech636a9952008-05-05 22:52:56 +00003492 for (i = 1; i < argc; i++)
mlcreech636a9952008-05-05 22:52:56 +00003493 {
vapier6acb2cf2009-01-28 04:46:28 +00003494 if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
3495 {
3496 if (argv[i][env_set_opt_len] == '=')
3497 {
3498 const char *p = argv[i] + env_set_opt_len + 1;
3499 lt_opt_process_env_set (p);
3500 }
3501 else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
3502 {
3503 lt_opt_process_env_set (argv[++i]); /* don't copy */
3504 }
3505 else
3506 lt_fatal ("%s missing required argument", env_set_opt);
3507 continue;
3508 }
3509 if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
3510 {
3511 if (argv[i][env_prepend_opt_len] == '=')
3512 {
3513 const char *p = argv[i] + env_prepend_opt_len + 1;
3514 lt_opt_process_env_prepend (p);
3515 }
3516 else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
3517 {
3518 lt_opt_process_env_prepend (argv[++i]); /* don't copy */
3519 }
3520 else
3521 lt_fatal ("%s missing required argument", env_prepend_opt);
3522 continue;
3523 }
3524 if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
3525 {
3526 if (argv[i][env_append_opt_len] == '=')
3527 {
3528 const char *p = argv[i] + env_append_opt_len + 1;
3529 lt_opt_process_env_append (p);
3530 }
3531 else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
3532 {
3533 lt_opt_process_env_append (argv[++i]); /* don't copy */
3534 }
3535 else
3536 lt_fatal ("%s missing required argument", env_append_opt);
3537 continue;
3538 }
3539 if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
3540 {
3541 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
3542 namespace, but it is not one of the ones we know about and
3543 have already dealt with, above (inluding dump-script), then
3544 report an error. Otherwise, targets might begin to believe
3545 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
3546 namespace. The first time any user complains about this, we'll
3547 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
3548 or a configure.ac-settable value.
3549 */
3550 lt_fatal ("Unrecognized option in %s namespace: '%s'",
3551 ltwrapper_option_prefix, argv[i]);
3552 }
3553 /* otherwise ... */
3554 newargz[++newargc] = xstrdup (argv[i]);
3555 }
3556 newargz[++newargc] = NULL;
3557
3558 LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
3559 for (i = 0; i < newargc; i++)
3560 {
3561 LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
mlcreech636a9952008-05-05 22:52:56 +00003562 }
3563
3564EOF
3565
3566 case $host_os in
3567 mingw*)
vapier6acb2cf2009-01-28 04:46:28 +00003568 cat <<"EOF"
mlcreech636a9952008-05-05 22:52:56 +00003569 /* execv doesn't actually work on mingw as expected on unix */
vapier6acb2cf2009-01-28 04:46:28 +00003570 rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
mlcreech636a9952008-05-05 22:52:56 +00003571 if (rval == -1)
3572 {
3573 /* failed to start process */
vapier6acb2cf2009-01-28 04:46:28 +00003574 LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
mlcreech636a9952008-05-05 22:52:56 +00003575 return 127;
3576 }
3577 return rval;
mlcreech636a9952008-05-05 22:52:56 +00003578EOF
3579 ;;
3580 *)
vapier6acb2cf2009-01-28 04:46:28 +00003581 cat <<"EOF"
3582 execv (lt_argv_zero, newargz);
mlcreech636a9952008-05-05 22:52:56 +00003583 return rval; /* =127, but avoids unused variable warning */
mlcreech636a9952008-05-05 22:52:56 +00003584EOF
3585 ;;
3586 esac
3587
3588 cat <<"EOF"
vapier6acb2cf2009-01-28 04:46:28 +00003589}
mlcreech636a9952008-05-05 22:52:56 +00003590
3591void *
3592xmalloc (size_t num)
3593{
3594 void *p = (void *) malloc (num);
3595 if (!p)
3596 lt_fatal ("Memory exhausted");
3597
3598 return p;
3599}
3600
3601char *
3602xstrdup (const char *string)
3603{
3604 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
3605 string) : NULL;
3606}
3607
3608const char *
3609base_name (const char *name)
3610{
3611 const char *base;
3612
3613#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3614 /* Skip over the disk name in MSDOS pathnames. */
3615 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
3616 name += 2;
3617#endif
3618
3619 for (base = name; *name; name++)
3620 if (IS_DIR_SEPARATOR (*name))
3621 base = name + 1;
3622 return base;
3623}
3624
3625int
3626check_executable (const char *path)
3627{
3628 struct stat st;
3629
3630 LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
3631 path ? (*path ? path : "EMPTY!") : "NULL!"));
3632 if ((!path) || (!*path))
3633 return 0;
3634
3635 if ((stat (path, &st) >= 0)
3636 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
3637 return 1;
3638 else
3639 return 0;
3640}
3641
3642int
3643make_executable (const char *path)
3644{
3645 int rval = 0;
3646 struct stat st;
3647
3648 LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
3649 path ? (*path ? path : "EMPTY!") : "NULL!"));
3650 if ((!path) || (!*path))
3651 return 0;
3652
3653 if (stat (path, &st) >= 0)
3654 {
3655 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
3656 }
3657 return rval;
3658}
3659
3660/* Searches for the full path of the wrapper. Returns
3661 newly allocated full path name if found, NULL otherwise
3662 Does not chase symlinks, even on platforms that support them.
3663*/
3664char *
3665find_executable (const char *wrapper)
3666{
3667 int has_slash = 0;
3668 const char *p;
3669 const char *p_next;
3670 /* static buffer for getcwd */
3671 char tmp[LT_PATHMAX + 1];
3672 int tmp_len;
3673 char *concat_name;
3674
3675 LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
3676 wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
3677
3678 if ((wrapper == NULL) || (*wrapper == '\0'))
3679 return NULL;
3680
3681 /* Absolute path? */
3682#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3683 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
3684 {
3685 concat_name = xstrdup (wrapper);
3686 if (check_executable (concat_name))
3687 return concat_name;
3688 XFREE (concat_name);
3689 }
3690 else
3691 {
3692#endif
3693 if (IS_DIR_SEPARATOR (wrapper[0]))
3694 {
3695 concat_name = xstrdup (wrapper);
3696 if (check_executable (concat_name))
3697 return concat_name;
3698 XFREE (concat_name);
3699 }
3700#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
3701 }
3702#endif
3703
3704 for (p = wrapper; *p; p++)
3705 if (*p == '/')
3706 {
3707 has_slash = 1;
3708 break;
3709 }
3710 if (!has_slash)
3711 {
3712 /* no slashes; search PATH */
3713 const char *path = getenv ("PATH");
3714 if (path != NULL)
3715 {
3716 for (p = path; *p; p = p_next)
3717 {
3718 const char *q;
3719 size_t p_len;
3720 for (q = p; *q; q++)
3721 if (IS_PATH_SEPARATOR (*q))
3722 break;
3723 p_len = q - p;
3724 p_next = (*q == '\0' ? q : q + 1);
3725 if (p_len == 0)
3726 {
3727 /* empty path: current directory */
3728 if (getcwd (tmp, LT_PATHMAX) == NULL)
3729 lt_fatal ("getcwd failed");
3730 tmp_len = strlen (tmp);
3731 concat_name =
3732 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3733 memcpy (concat_name, tmp, tmp_len);
3734 concat_name[tmp_len] = '/';
3735 strcpy (concat_name + tmp_len + 1, wrapper);
3736 }
3737 else
3738 {
3739 concat_name =
3740 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
3741 memcpy (concat_name, p, p_len);
3742 concat_name[p_len] = '/';
3743 strcpy (concat_name + p_len + 1, wrapper);
3744 }
3745 if (check_executable (concat_name))
3746 return concat_name;
3747 XFREE (concat_name);
3748 }
3749 }
3750 /* not found in PATH; assume curdir */
3751 }
3752 /* Relative path | not found in path: prepend cwd */
3753 if (getcwd (tmp, LT_PATHMAX) == NULL)
3754 lt_fatal ("getcwd failed");
3755 tmp_len = strlen (tmp);
3756 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
3757 memcpy (concat_name, tmp, tmp_len);
3758 concat_name[tmp_len] = '/';
3759 strcpy (concat_name + tmp_len + 1, wrapper);
3760
3761 if (check_executable (concat_name))
3762 return concat_name;
3763 XFREE (concat_name);
3764 return NULL;
3765}
3766
3767char *
3768chase_symlinks (const char *pathspec)
3769{
3770#ifndef S_ISLNK
3771 return xstrdup (pathspec);
3772#else
3773 char buf[LT_PATHMAX];
3774 struct stat s;
3775 char *tmp_pathspec = xstrdup (pathspec);
3776 char *p;
3777 int has_symlinks = 0;
3778 while (strlen (tmp_pathspec) && !has_symlinks)
3779 {
3780 LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
3781 tmp_pathspec));
3782 if (lstat (tmp_pathspec, &s) == 0)
3783 {
3784 if (S_ISLNK (s.st_mode) != 0)
3785 {
3786 has_symlinks = 1;
3787 break;
3788 }
3789
3790 /* search backwards for last DIR_SEPARATOR */
3791 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
3792 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3793 p--;
3794 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
3795 {
3796 /* no more DIR_SEPARATORS left */
3797 break;
3798 }
3799 *p = '\0';
3800 }
3801 else
3802 {
3803 char *errstr = strerror (errno);
3804 lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
3805 }
3806 }
3807 XFREE (tmp_pathspec);
3808
3809 if (!has_symlinks)
3810 {
3811 return xstrdup (pathspec);
3812 }
3813
3814 tmp_pathspec = realpath (pathspec, buf);
3815 if (tmp_pathspec == 0)
3816 {
3817 lt_fatal ("Could not follow symlinks for %s", pathspec);
3818 }
3819 return xstrdup (tmp_pathspec);
3820#endif
3821}
3822
3823char *
3824strendzap (char *str, const char *pat)
3825{
3826 size_t len, patlen;
3827
3828 assert (str != NULL);
3829 assert (pat != NULL);
3830
3831 len = strlen (str);
3832 patlen = strlen (pat);
3833
3834 if (patlen <= len)
3835 {
3836 str += len - patlen;
3837 if (strcmp (str, pat) == 0)
3838 *str = '\0';
3839 }
3840 return str;
3841}
3842
3843static void
3844lt_error_core (int exit_status, const char *mode,
3845 const char *message, va_list ap)
3846{
3847 fprintf (stderr, "%s: %s: ", program_name, mode);
3848 vfprintf (stderr, message, ap);
3849 fprintf (stderr, ".\n");
3850
3851 if (exit_status >= 0)
3852 exit (exit_status);
3853}
3854
3855void
3856lt_fatal (const char *message, ...)
3857{
3858 va_list ap;
3859 va_start (ap, message);
3860 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
3861 va_end (ap);
3862}
vapier6acb2cf2009-01-28 04:46:28 +00003863
3864void
3865lt_setenv (const char *name, const char *value)
3866{
3867 LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
3868 (name ? name : "<NULL>"),
3869 (value ? value : "<NULL>")));
3870 {
3871#ifdef HAVE_SETENV
3872 /* always make a copy, for consistency with !HAVE_SETENV */
3873 char *str = xstrdup (value);
3874 setenv (name, str, 1);
3875#else
3876 int len = strlen (name) + 1 + strlen (value) + 1;
3877 char *str = XMALLOC (char, len);
3878 sprintf (str, "%s=%s", name, value);
3879 if (putenv (str) != EXIT_SUCCESS)
3880 {
3881 XFREE (str);
3882 }
3883#endif
3884 }
3885}
3886
3887char *
3888lt_extend_str (const char *orig_value, const char *add, int to_end)
3889{
3890 char *new_value;
3891 if (orig_value && *orig_value)
3892 {
3893 int orig_value_len = strlen (orig_value);
3894 int add_len = strlen (add);
3895 new_value = XMALLOC (char, add_len + orig_value_len + 1);
3896 if (to_end)
3897 {
3898 strcpy (new_value, orig_value);
3899 strcpy (new_value + orig_value_len, add);
3900 }
3901 else
3902 {
3903 strcpy (new_value, add);
3904 strcpy (new_value + add_len, orig_value);
3905 }
3906 }
3907 else
3908 {
3909 new_value = xstrdup (add);
3910 }
3911 return new_value;
3912}
3913
3914int
3915lt_split_name_value (const char *arg, char** name, char** value)
3916{
3917 const char *p;
3918 int len;
3919 if (!arg || !*arg)
3920 return 1;
3921
3922 p = strchr (arg, (int)'=');
3923
3924 if (!p)
3925 return 1;
3926
3927 *value = xstrdup (++p);
3928
3929 len = strlen (arg) - strlen (*value);
3930 *name = XMALLOC (char, len);
3931 strncpy (*name, arg, len-1);
3932 (*name)[len - 1] = '\0';
3933
3934 return 0;
3935}
3936
3937void
3938lt_opt_process_env_set (const char *arg)
3939{
3940 char *name = NULL;
3941 char *value = NULL;
3942
3943 if (lt_split_name_value (arg, &name, &value) != 0)
3944 {
3945 XFREE (name);
3946 XFREE (value);
3947 lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
3948 }
3949
3950 lt_setenv (name, value);
3951 XFREE (name);
3952 XFREE (value);
3953}
3954
3955void
3956lt_opt_process_env_prepend (const char *arg)
3957{
3958 char *name = NULL;
3959 char *value = NULL;
3960 char *new_value = NULL;
3961
3962 if (lt_split_name_value (arg, &name, &value) != 0)
3963 {
3964 XFREE (name);
3965 XFREE (value);
3966 lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
3967 }
3968
3969 new_value = lt_extend_str (getenv (name), value, 0);
3970 lt_setenv (name, new_value);
3971 XFREE (new_value);
3972 XFREE (name);
3973 XFREE (value);
3974}
3975
3976void
3977lt_opt_process_env_append (const char *arg)
3978{
3979 char *name = NULL;
3980 char *value = NULL;
3981 char *new_value = NULL;
3982
3983 if (lt_split_name_value (arg, &name, &value) != 0)
3984 {
3985 XFREE (name);
3986 XFREE (value);
3987 lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
3988 }
3989
3990 new_value = lt_extend_str (getenv (name), value, 1);
3991 lt_setenv (name, new_value);
3992 XFREE (new_value);
3993 XFREE (name);
3994 XFREE (value);
3995}
3996
3997void
3998lt_update_exe_path (const char *name, const char *value)
3999{
4000 LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
4001 (name ? name : "<NULL>"),
4002 (value ? value : "<NULL>")));
4003
4004 if (name && *name && value && *value)
4005 {
4006 char *new_value = lt_extend_str (getenv (name), value, 0);
4007 /* some systems can't cope with a ':'-terminated path #' */
4008 int len = strlen (new_value);
4009 while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
4010 {
4011 new_value[len-1] = '\0';
4012 }
4013 lt_setenv (name, new_value);
4014 XFREE (new_value);
4015 }
4016}
4017
4018void
4019lt_update_lib_path (const char *name, const char *value)
4020{
4021 LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
4022 (name ? name : "<NULL>"),
4023 (value ? value : "<NULL>")));
4024
4025 if (name && *name && value && *value)
4026 {
4027 char *new_value = lt_extend_str (getenv (name), value, 0);
4028 lt_setenv (name, new_value);
4029 XFREE (new_value);
4030 }
4031}
4032
4033
mlcreech636a9952008-05-05 22:52:56 +00004034EOF
4035}
4036# end: func_emit_cwrapperexe_src
4037
4038# func_mode_link arg...
4039func_mode_link ()
4040{
4041 $opt_debug
drh71eb93e2001-09-28 01:34:43 +00004042 case $host in
vapier6acb2cf2009-01-28 04:46:28 +00004043 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
drh71eb93e2001-09-28 01:34:43 +00004044 # It is impossible to link a dll without this setting, and
4045 # we shouldn't force the makefile maintainer to figure out
4046 # which system we are compiling for in order to pass an extra
a.rottmann964dbb12004-02-26 19:47:42 +00004047 # flag for every libtool invocation.
drh71eb93e2001-09-28 01:34:43 +00004048 # allow_undefined=no
4049
4050 # FIXME: Unfortunately, there are problems with the above when trying
4051 # to make a dll which has undefined symbols, in which case not
4052 # even a static library is built. For now, we need to specify
4053 # -no-undefined on the libtool link line when we can be certain
4054 # that all symbols are satisfied, otherwise we get a static library.
4055 allow_undefined=yes
4056 ;;
4057 *)
4058 allow_undefined=yes
4059 ;;
4060 esac
mlcreech636a9952008-05-05 22:52:56 +00004061 libtool_args=$nonopt
a.rottmann964dbb12004-02-26 19:47:42 +00004062 base_compile="$nonopt $@"
mlcreech636a9952008-05-05 22:52:56 +00004063 compile_command=$nonopt
4064 finalize_command=$nonopt
drh71eb93e2001-09-28 01:34:43 +00004065
4066 compile_rpath=
4067 finalize_rpath=
4068 compile_shlibpath=
4069 finalize_shlibpath=
4070 convenience=
4071 old_convenience=
4072 deplibs=
4073 old_deplibs=
4074 compiler_flags=
4075 linker_flags=
4076 dllsearchpath=
4077 lib_search_path=`pwd`
a.rottmann62507b62003-03-24 09:40:34 +00004078 inst_prefix_dir=
mlcreech636a9952008-05-05 22:52:56 +00004079 new_inherited_linker_flags=
drh71eb93e2001-09-28 01:34:43 +00004080
4081 avoid_version=no
4082 dlfiles=
4083 dlprefiles=
4084 dlself=no
4085 export_dynamic=no
4086 export_symbols=
4087 export_symbols_regex=
4088 generated=
4089 libobjs=
4090 ltlibs=
4091 module=no
4092 no_install=no
4093 objs=
a.rottmann964dbb12004-02-26 19:47:42 +00004094 non_pic_objects=
4095 precious_files_regex=
drh71eb93e2001-09-28 01:34:43 +00004096 prefer_static_libs=no
4097 preload=no
4098 prev=
4099 prevarg=
4100 release=
4101 rpath=
4102 xrpath=
4103 perm_rpath=
4104 temp_rpath=
4105 thread_safe=no
4106 vinfo=
a.rottmann964dbb12004-02-26 19:47:42 +00004107 vinfo_number=no
mlcreech636a9952008-05-05 22:52:56 +00004108 weak_libs=
4109 single_module="${wl}-single_module"
vapier7f19c022007-02-17 14:46:31 +00004110 func_infer_tag $base_compile
drh71eb93e2001-09-28 01:34:43 +00004111
4112 # We need to know -static, to get the right output filenames.
4113 for arg
4114 do
4115 case $arg in
mlcreech636a9952008-05-05 22:52:56 +00004116 -shared)
4117 test "$build_libtool_libs" != yes && \
4118 func_fatal_configuration "can not build a shared library"
4119 build_old_libs=no
4120 break
4121 ;;
4122 -all-static | -static | -static-libtool-libs)
4123 case $arg in
4124 -all-static)
drh71eb93e2001-09-28 01:34:43 +00004125 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
mlcreech636a9952008-05-05 22:52:56 +00004126 func_warning "complete static linking is impossible in this configuration"
drh71eb93e2001-09-28 01:34:43 +00004127 fi
4128 if test -n "$link_static_flag"; then
4129 dlopen_self=$dlopen_self_static
4130 fi
vapier7f19c022007-02-17 14:46:31 +00004131 prefer_static_libs=yes
mlcreech636a9952008-05-05 22:52:56 +00004132 ;;
4133 -static)
drh71eb93e2001-09-28 01:34:43 +00004134 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4135 dlopen_self=$dlopen_self_static
4136 fi
vapier7f19c022007-02-17 14:46:31 +00004137 prefer_static_libs=built
mlcreech636a9952008-05-05 22:52:56 +00004138 ;;
4139 -static-libtool-libs)
4140 if test -z "$pic_flag" && test -n "$link_static_flag"; then
4141 dlopen_self=$dlopen_self_static
4142 fi
4143 prefer_static_libs=yes
4144 ;;
4145 esac
drh71eb93e2001-09-28 01:34:43 +00004146 build_libtool_libs=no
4147 build_old_libs=yes
drh71eb93e2001-09-28 01:34:43 +00004148 break
4149 ;;
4150 esac
4151 done
4152
4153 # See if our shared archives depend on static archives.
4154 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
4155
4156 # Go through the arguments, transforming them on the way.
a.rottmann964dbb12004-02-26 19:47:42 +00004157 while test "$#" -gt 0; do
drh71eb93e2001-09-28 01:34:43 +00004158 arg="$1"
drh71eb93e2001-09-28 01:34:43 +00004159 shift
mlcreech636a9952008-05-05 22:52:56 +00004160 func_quote_for_eval "$arg"
4161 qarg=$func_quote_for_eval_unquoted_result
4162 func_append libtool_args " $func_quote_for_eval_result"
drh71eb93e2001-09-28 01:34:43 +00004163
4164 # If the previous option needs an argument, assign it.
4165 if test -n "$prev"; then
4166 case $prev in
4167 output)
mlcreech636a9952008-05-05 22:52:56 +00004168 func_append compile_command " @OUTPUT@"
4169 func_append finalize_command " @OUTPUT@"
drh71eb93e2001-09-28 01:34:43 +00004170 ;;
4171 esac
4172
4173 case $prev in
4174 dlfiles|dlprefiles)
4175 if test "$preload" = no; then
4176 # Add the symbol object into the linking commands.
mlcreech636a9952008-05-05 22:52:56 +00004177 func_append compile_command " @SYMFILE@"
4178 func_append finalize_command " @SYMFILE@"
drh71eb93e2001-09-28 01:34:43 +00004179 preload=yes
4180 fi
4181 case $arg in
4182 *.la | *.lo) ;; # We handle these cases below.
4183 force)
4184 if test "$dlself" = no; then
4185 dlself=needless
4186 export_dynamic=yes
4187 fi
4188 prev=
4189 continue
4190 ;;
4191 self)
4192 if test "$prev" = dlprefiles; then
4193 dlself=yes
4194 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
4195 dlself=yes
4196 else
4197 dlself=needless
4198 export_dynamic=yes
4199 fi
4200 prev=
4201 continue
4202 ;;
4203 *)
4204 if test "$prev" = dlfiles; then
4205 dlfiles="$dlfiles $arg"
4206 else
4207 dlprefiles="$dlprefiles $arg"
4208 fi
4209 prev=
4210 continue
4211 ;;
4212 esac
4213 ;;
4214 expsyms)
4215 export_symbols="$arg"
mlcreech636a9952008-05-05 22:52:56 +00004216 test -f "$arg" \
4217 || func_fatal_error "symbol file \`$arg' does not exist"
drh71eb93e2001-09-28 01:34:43 +00004218 prev=
4219 continue
4220 ;;
4221 expsyms_regex)
4222 export_symbols_regex="$arg"
4223 prev=
4224 continue
4225 ;;
mlcreech636a9952008-05-05 22:52:56 +00004226 framework)
4227 case $host in
4228 *-*-darwin*)
4229 case "$deplibs " in
4230 *" $qarg.ltframework "*) ;;
4231 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
4232 ;;
4233 esac
4234 ;;
4235 esac
4236 prev=
4237 continue
4238 ;;
a.rottmann62507b62003-03-24 09:40:34 +00004239 inst_prefix)
4240 inst_prefix_dir="$arg"
drh71eb93e2001-09-28 01:34:43 +00004241 prev=
4242 continue
4243 ;;
a.rottmann964dbb12004-02-26 19:47:42 +00004244 objectlist)
4245 if test -f "$arg"; then
4246 save_arg=$arg
4247 moreargs=
mlcreech636a9952008-05-05 22:52:56 +00004248 for fil in `cat "$save_arg"`
a.rottmann964dbb12004-02-26 19:47:42 +00004249 do
4250# moreargs="$moreargs $fil"
4251 arg=$fil
4252 # A libtool-controlled object.
4253
4254 # Check to see that this really is a libtool object.
mlcreech636a9952008-05-05 22:52:56 +00004255 if func_lalib_unsafe_p "$arg"; then
a.rottmann964dbb12004-02-26 19:47:42 +00004256 pic_object=
4257 non_pic_object=
4258
4259 # Read the .lo file
mlcreech636a9952008-05-05 22:52:56 +00004260 func_source "$arg"
a.rottmann964dbb12004-02-26 19:47:42 +00004261
mlcreech636a9952008-05-05 22:52:56 +00004262 if test -z "$pic_object" ||
a.rottmann964dbb12004-02-26 19:47:42 +00004263 test -z "$non_pic_object" ||
mlcreech636a9952008-05-05 22:52:56 +00004264 test "$pic_object" = none &&
a.rottmann964dbb12004-02-26 19:47:42 +00004265 test "$non_pic_object" = none; then
mlcreech636a9952008-05-05 22:52:56 +00004266 func_fatal_error "cannot find name of object for \`$arg'"
a.rottmann964dbb12004-02-26 19:47:42 +00004267 fi
4268
4269 # Extract subdirectory from the argument.
mlcreech636a9952008-05-05 22:52:56 +00004270 func_dirname "$arg" "/" ""
4271 xdir="$func_dirname_result"
a.rottmann964dbb12004-02-26 19:47:42 +00004272
4273 if test "$pic_object" != none; then
4274 # Prepend the subdirectory the object is found in.
4275 pic_object="$xdir$pic_object"
4276
4277 if test "$prev" = dlfiles; then
4278 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4279 dlfiles="$dlfiles $pic_object"
4280 prev=
4281 continue
4282 else
4283 # If libtool objects are unsupported, then we need to preload.
4284 prev=dlprefiles
4285 fi
4286 fi
4287
4288 # CHECK ME: I think I busted this. -Ossama
4289 if test "$prev" = dlprefiles; then
4290 # Preload the old-style object.
4291 dlprefiles="$dlprefiles $pic_object"
4292 prev=
4293 fi
4294
4295 # A PIC object.
mlcreech636a9952008-05-05 22:52:56 +00004296 func_append libobjs " $pic_object"
a.rottmann964dbb12004-02-26 19:47:42 +00004297 arg="$pic_object"
4298 fi
4299
4300 # Non-PIC object.
4301 if test "$non_pic_object" != none; then
4302 # Prepend the subdirectory the object is found in.
4303 non_pic_object="$xdir$non_pic_object"
4304
4305 # A standard non-PIC object
mlcreech636a9952008-05-05 22:52:56 +00004306 func_append non_pic_objects " $non_pic_object"
a.rottmann964dbb12004-02-26 19:47:42 +00004307 if test -z "$pic_object" || test "$pic_object" = none ; then
4308 arg="$non_pic_object"
4309 fi
vapier7f19c022007-02-17 14:46:31 +00004310 else
4311 # If the PIC object exists, use it instead.
4312 # $xdir was prepended to $pic_object above.
4313 non_pic_object="$pic_object"
mlcreech636a9952008-05-05 22:52:56 +00004314 func_append non_pic_objects " $non_pic_object"
a.rottmann964dbb12004-02-26 19:47:42 +00004315 fi
4316 else
4317 # Only an error if not doing a dry-run.
mlcreech636a9952008-05-05 22:52:56 +00004318 if $opt_dry_run; then
a.rottmann964dbb12004-02-26 19:47:42 +00004319 # Extract subdirectory from the argument.
mlcreech636a9952008-05-05 22:52:56 +00004320 func_dirname "$arg" "/" ""
4321 xdir="$func_dirname_result"
a.rottmann964dbb12004-02-26 19:47:42 +00004322
mlcreech636a9952008-05-05 22:52:56 +00004323 func_lo2o "$arg"
4324 pic_object=$xdir$objdir/$func_lo2o_result
4325 non_pic_object=$xdir$func_lo2o_result
4326 func_append libobjs " $pic_object"
4327 func_append non_pic_objects " $non_pic_object"
4328 else
4329 func_fatal_error "\`$arg' is not a valid libtool object"
a.rottmann964dbb12004-02-26 19:47:42 +00004330 fi
4331 fi
4332 done
4333 else
mlcreech636a9952008-05-05 22:52:56 +00004334 func_fatal_error "link input file \`$arg' does not exist"
a.rottmann964dbb12004-02-26 19:47:42 +00004335 fi
4336 arg=$save_arg
4337 prev=
4338 continue
4339 ;;
mlcreech636a9952008-05-05 22:52:56 +00004340 precious_regex)
4341 precious_files_regex="$arg"
4342 prev=
4343 continue
4344 ;;
4345 release)
4346 release="-$arg"
4347 prev=
4348 continue
4349 ;;
drh71eb93e2001-09-28 01:34:43 +00004350 rpath | xrpath)
4351 # We need an absolute path.
4352 case $arg in
4353 [\\/]* | [A-Za-z]:[\\/]*) ;;
4354 *)
mlcreech636a9952008-05-05 22:52:56 +00004355 func_fatal_error "only absolute run-paths are allowed"
drh71eb93e2001-09-28 01:34:43 +00004356 ;;
4357 esac
4358 if test "$prev" = rpath; then
4359 case "$rpath " in
4360 *" $arg "*) ;;
4361 *) rpath="$rpath $arg" ;;
4362 esac
4363 else
4364 case "$xrpath " in
4365 *" $arg "*) ;;
4366 *) xrpath="$xrpath $arg" ;;
4367 esac
4368 fi
4369 prev=
4370 continue
4371 ;;
mlcreech636a9952008-05-05 22:52:56 +00004372 shrext)
4373 shrext_cmds="$arg"
drh71eb93e2001-09-28 01:34:43 +00004374 prev=
drh71eb93e2001-09-28 01:34:43 +00004375 continue
4376 ;;
mlcreech636a9952008-05-05 22:52:56 +00004377 weak)
4378 weak_libs="$weak_libs $arg"
drh71eb93e2001-09-28 01:34:43 +00004379 prev=
drh71eb93e2001-09-28 01:34:43 +00004380 continue
4381 ;;
a.rottmann964dbb12004-02-26 19:47:42 +00004382 xcclinker)
4383 linker_flags="$linker_flags $qarg"
4384 compiler_flags="$compiler_flags $qarg"
4385 prev=
mlcreech636a9952008-05-05 22:52:56 +00004386 func_append compile_command " $qarg"
4387 func_append finalize_command " $qarg"
a.rottmann964dbb12004-02-26 19:47:42 +00004388 continue
4389 ;;
mlcreech636a9952008-05-05 22:52:56 +00004390 xcompiler)
4391 compiler_flags="$compiler_flags $qarg"
vapier7f19c022007-02-17 14:46:31 +00004392 prev=
mlcreech636a9952008-05-05 22:52:56 +00004393 func_append compile_command " $qarg"
4394 func_append finalize_command " $qarg"
vapier7f19c022007-02-17 14:46:31 +00004395 continue
4396 ;;
mlcreech636a9952008-05-05 22:52:56 +00004397 xlinker)
4398 linker_flags="$linker_flags $qarg"
4399 compiler_flags="$compiler_flags $wl$qarg"
vapier7f19c022007-02-17 14:46:31 +00004400 prev=
mlcreech636a9952008-05-05 22:52:56 +00004401 func_append compile_command " $wl$qarg"
4402 func_append finalize_command " $wl$qarg"
vapier7f19c022007-02-17 14:46:31 +00004403 continue
4404 ;;
drh71eb93e2001-09-28 01:34:43 +00004405 *)
4406 eval "$prev=\"\$arg\""
4407 prev=
4408 continue
4409 ;;
4410 esac
a.rottmann964dbb12004-02-26 19:47:42 +00004411 fi # test -n "$prev"
drh71eb93e2001-09-28 01:34:43 +00004412
4413 prevarg="$arg"
4414
4415 case $arg in
4416 -all-static)
4417 if test -n "$link_static_flag"; then
mlcreech636a9952008-05-05 22:52:56 +00004418 # See comment for -static flag below, for more details.
4419 func_append compile_command " $link_static_flag"
4420 func_append finalize_command " $link_static_flag"
drh71eb93e2001-09-28 01:34:43 +00004421 fi
4422 continue
4423 ;;
4424
4425 -allow-undefined)
4426 # FIXME: remove this flag sometime in the future.
mlcreech636a9952008-05-05 22:52:56 +00004427 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
drh71eb93e2001-09-28 01:34:43 +00004428 ;;
4429
4430 -avoid-version)
4431 avoid_version=yes
4432 continue
4433 ;;
4434
4435 -dlopen)
4436 prev=dlfiles
4437 continue
4438 ;;
4439
4440 -dlpreopen)
4441 prev=dlprefiles
4442 continue
4443 ;;
4444
4445 -export-dynamic)
4446 export_dynamic=yes
4447 continue
4448 ;;
4449
4450 -export-symbols | -export-symbols-regex)
4451 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
mlcreech636a9952008-05-05 22:52:56 +00004452 func_fatal_error "more than one -exported-symbols argument is not allowed"
drh71eb93e2001-09-28 01:34:43 +00004453 fi
4454 if test "X$arg" = "X-export-symbols"; then
4455 prev=expsyms
4456 else
4457 prev=expsyms_regex
4458 fi
4459 continue
4460 ;;
4461
mlcreech636a9952008-05-05 22:52:56 +00004462 -framework)
4463 prev=framework
vapier7f19c022007-02-17 14:46:31 +00004464 continue
4465 ;;
4466
a.rottmann62507b62003-03-24 09:40:34 +00004467 -inst-prefix-dir)
a.rottmann964dbb12004-02-26 19:47:42 +00004468 prev=inst_prefix
4469 continue
4470 ;;
a.rottmann62507b62003-03-24 09:40:34 +00004471
drh71eb93e2001-09-28 01:34:43 +00004472 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
4473 # so, if we see these flags be careful not to treat them like -L
4474 -L[A-Z][A-Z]*:*)
4475 case $with_gcc/$host in
a.rottmann964dbb12004-02-26 19:47:42 +00004476 no/*-*-irix* | /*-*-irix*)
mlcreech636a9952008-05-05 22:52:56 +00004477 func_append compile_command " $arg"
4478 func_append finalize_command " $arg"
drh71eb93e2001-09-28 01:34:43 +00004479 ;;
4480 esac
4481 continue
4482 ;;
4483
4484 -L*)
mlcreech636a9952008-05-05 22:52:56 +00004485 func_stripname '-L' '' "$arg"
4486 dir=$func_stripname_result
vapier6acb2cf2009-01-28 04:46:28 +00004487 if test -z "$dir"; then
4488 if test "$#" -gt 0; then
4489 func_fatal_error "require no space between \`-L' and \`$1'"
4490 else
4491 func_fatal_error "need path for \`-L' option"
4492 fi
4493 fi
drh71eb93e2001-09-28 01:34:43 +00004494 # We need an absolute path.
4495 case $dir in
4496 [\\/]* | [A-Za-z]:[\\/]*) ;;
4497 *)
4498 absdir=`cd "$dir" && pwd`
mlcreech636a9952008-05-05 22:52:56 +00004499 test -z "$absdir" && \
4500 func_fatal_error "cannot determine absolute directory name of \`$dir'"
drh71eb93e2001-09-28 01:34:43 +00004501 dir="$absdir"
4502 ;;
4503 esac
4504 case "$deplibs " in
4505 *" -L$dir "*) ;;
4506 *)
4507 deplibs="$deplibs -L$dir"
4508 lib_search_path="$lib_search_path $dir"
4509 ;;
4510 esac
4511 case $host in
vapier6acb2cf2009-01-28 04:46:28 +00004512 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
mlcreech636a9952008-05-05 22:52:56 +00004513 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
drh71eb93e2001-09-28 01:34:43 +00004514 case :$dllsearchpath: in
4515 *":$dir:"*) ;;
vapier6acb2cf2009-01-28 04:46:28 +00004516 ::) dllsearchpath=$dir;;
drh71eb93e2001-09-28 01:34:43 +00004517 *) dllsearchpath="$dllsearchpath:$dir";;
4518 esac
vapier7f19c022007-02-17 14:46:31 +00004519 case :$dllsearchpath: in
4520 *":$testbindir:"*) ;;
vapier6acb2cf2009-01-28 04:46:28 +00004521 ::) dllsearchpath=$testbindir;;
vapier7f19c022007-02-17 14:46:31 +00004522 *) dllsearchpath="$dllsearchpath:$testbindir";;
4523 esac
drh71eb93e2001-09-28 01:34:43 +00004524 ;;
4525 esac
4526 continue
4527 ;;
4528
4529 -l*)
4530 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
4531 case $host in
vapier6acb2cf2009-01-28 04:46:28 +00004532 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
drh71eb93e2001-09-28 01:34:43 +00004533 # These systems don't actually have a C or math library (as such)
4534 continue
4535 ;;
vapier7f19c022007-02-17 14:46:31 +00004536 *-*-os2*)
drh71eb93e2001-09-28 01:34:43 +00004537 # These systems don't actually have a C library (as such)
4538 test "X$arg" = "X-lc" && continue
4539 ;;
vapier7f19c022007-02-17 14:46:31 +00004540 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
a.rottmann62507b62003-03-24 09:40:34 +00004541 # Do not include libc due to us having libc/libc_r.
4542 test "X$arg" = "X-lc" && continue
4543 ;;
a.rottmann964dbb12004-02-26 19:47:42 +00004544 *-*-rhapsody* | *-*-darwin1.[012])
4545 # Rhapsody C and math libraries are in the System framework
mlcreech636a9952008-05-05 22:52:56 +00004546 deplibs="$deplibs System.ltframework"
drh71eb93e2001-09-28 01:34:43 +00004547 continue
vapier7f19c022007-02-17 14:46:31 +00004548 ;;
4549 *-*-sco3.2v5* | *-*-sco5v6*)
4550 # Causes problems with __ctype
4551 test "X$arg" = "X-lc" && continue
4552 ;;
4553 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
4554 # Compiler inserts libc in the correct place for threads to work
4555 test "X$arg" = "X-lc" && continue
4556 ;;
drh71eb93e2001-09-28 01:34:43 +00004557 esac
a.rottmann964dbb12004-02-26 19:47:42 +00004558 elif test "X$arg" = "X-lc_r"; then
4559 case $host in
vapier7f19c022007-02-17 14:46:31 +00004560 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
a.rottmann964dbb12004-02-26 19:47:42 +00004561 # Do not include libc_r directly, use -pthread flag.
4562 continue
4563 ;;
4564 esac
drh71eb93e2001-09-28 01:34:43 +00004565 fi
drh71eb93e2001-09-28 01:34:43 +00004566 deplibs="$deplibs $arg"
4567 continue
4568 ;;
4569
4570 -module)
4571 module=yes
4572 continue
4573 ;;
4574
mlcreech636a9952008-05-05 22:52:56 +00004575 # Tru64 UNIX uses -model [arg] to determine the layout of C++
4576 # classes, name mangling, and exception handling.
4577 # Darwin uses the -arch flag to determine output architecture.
4578 -model|-arch|-isysroot)
4579 compiler_flags="$compiler_flags $arg"
4580 func_append compile_command " $arg"
4581 func_append finalize_command " $arg"
4582 prev=xcompiler
4583 continue
4584 ;;
vapier7f19c022007-02-17 14:46:31 +00004585
mlcreech636a9952008-05-05 22:52:56 +00004586 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
4587 compiler_flags="$compiler_flags $arg"
4588 func_append compile_command " $arg"
4589 func_append finalize_command " $arg"
4590 case "$new_inherited_linker_flags " in
4591 *" $arg "*) ;;
4592 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
a.rottmann964dbb12004-02-26 19:47:42 +00004593 esac
mlcreech636a9952008-05-05 22:52:56 +00004594 continue
4595 ;;
a.rottmann964dbb12004-02-26 19:47:42 +00004596
mlcreech636a9952008-05-05 22:52:56 +00004597 -multi_module)
4598 single_module="${wl}-multi_module"
a.rottmann964dbb12004-02-26 19:47:42 +00004599 continue
4600 ;;
4601
drh71eb93e2001-09-28 01:34:43 +00004602 -no-fast-install)
4603 fast_install=no
4604 continue
4605 ;;
4606
4607 -no-install)
4608 case $host in
vapier6acb2cf2009-01-28 04:46:28 +00004609 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
drh71eb93e2001-09-28 01:34:43 +00004610 # The PATH hackery in wrapper scripts is required on Windows
mlcreech636a9952008-05-05 22:52:56 +00004611 # and Darwin in order for the loader to find any dlls it needs.
4612 func_warning "\`-no-install' is ignored for $host"
4613 func_warning "assuming \`-no-fast-install' instead"
drh71eb93e2001-09-28 01:34:43 +00004614 fast_install=no
4615 ;;
4616 *) no_install=yes ;;
4617 esac
4618 continue
4619 ;;
4620
4621 -no-undefined)
4622 allow_undefined=no
4623 continue
4624 ;;
4625
a.rottmann964dbb12004-02-26 19:47:42 +00004626 -objectlist)
4627 prev=objectlist
4628 continue
4629 ;;
4630
drh71eb93e2001-09-28 01:34:43 +00004631 -o) prev=output ;;
4632
a.rottmann964dbb12004-02-26 19:47:42 +00004633 -precious-files-regex)
4634 prev=precious_regex
4635 continue
4636 ;;
4637
drh71eb93e2001-09-28 01:34:43 +00004638 -release)
4639 prev=release
4640 continue
4641 ;;
4642
4643 -rpath)
4644 prev=rpath
4645 continue
4646 ;;
4647
4648 -R)
4649 prev=xrpath
4650 continue
4651 ;;
4652
4653 -R*)
mlcreech636a9952008-05-05 22:52:56 +00004654 func_stripname '-R' '' "$arg"
4655 dir=$func_stripname_result
drh71eb93e2001-09-28 01:34:43 +00004656 # We need an absolute path.
4657 case $dir in
4658 [\\/]* | [A-Za-z]:[\\/]*) ;;
4659 *)
mlcreech636a9952008-05-05 22:52:56 +00004660 func_fatal_error "only absolute run-paths are allowed"
drh71eb93e2001-09-28 01:34:43 +00004661 ;;
4662 esac
4663 case "$xrpath " in
4664 *" $dir "*) ;;
4665 *) xrpath="$xrpath $dir" ;;
4666 esac
4667 continue
4668 ;;
4669
mlcreech636a9952008-05-05 22:52:56 +00004670 -shared)
4671 # The effects of -shared are defined in a previous loop.
4672 continue
4673 ;;
4674
4675 -shrext)
4676 prev=shrext
4677 continue
4678 ;;
4679
4680 -static | -static-libtool-libs)
drh71eb93e2001-09-28 01:34:43 +00004681 # The effects of -static are defined in a previous loop.
4682 # We used to do the same as -all-static on platforms that
4683 # didn't have a PIC flag, but the assumption that the effects
4684 # would be equivalent was wrong. It would break on at least
4685 # Digital Unix and AIX.
4686 continue
4687 ;;
4688
4689 -thread-safe)
4690 thread_safe=yes
4691 continue
4692 ;;
4693
4694 -version-info)
4695 prev=vinfo
4696 continue
4697 ;;
mlcreech636a9952008-05-05 22:52:56 +00004698
a.rottmann964dbb12004-02-26 19:47:42 +00004699 -version-number)
4700 prev=vinfo
4701 vinfo_number=yes
4702 continue
4703 ;;
drh71eb93e2001-09-28 01:34:43 +00004704
mlcreech636a9952008-05-05 22:52:56 +00004705 -weak)
4706 prev=weak
4707 continue
4708 ;;
4709
drh71eb93e2001-09-28 01:34:43 +00004710 -Wc,*)
mlcreech636a9952008-05-05 22:52:56 +00004711 func_stripname '-Wc,' '' "$arg"
4712 args=$func_stripname_result
drh71eb93e2001-09-28 01:34:43 +00004713 arg=
a.rottmann62507b62003-03-24 09:40:34 +00004714 save_ifs="$IFS"; IFS=','
drh71eb93e2001-09-28 01:34:43 +00004715 for flag in $args; do
4716 IFS="$save_ifs"
mlcreech636a9952008-05-05 22:52:56 +00004717 func_quote_for_eval "$flag"
4718 arg="$arg $wl$func_quote_for_eval_result"
4719 compiler_flags="$compiler_flags $func_quote_for_eval_result"
drh71eb93e2001-09-28 01:34:43 +00004720 done
4721 IFS="$save_ifs"
mlcreech636a9952008-05-05 22:52:56 +00004722 func_stripname ' ' '' "$arg"
4723 arg=$func_stripname_result
drh71eb93e2001-09-28 01:34:43 +00004724 ;;
4725
4726 -Wl,*)
mlcreech636a9952008-05-05 22:52:56 +00004727 func_stripname '-Wl,' '' "$arg"
4728 args=$func_stripname_result
drh71eb93e2001-09-28 01:34:43 +00004729 arg=
a.rottmann62507b62003-03-24 09:40:34 +00004730 save_ifs="$IFS"; IFS=','
drh71eb93e2001-09-28 01:34:43 +00004731 for flag in $args; do
4732 IFS="$save_ifs"
mlcreech636a9952008-05-05 22:52:56 +00004733 func_quote_for_eval "$flag"
4734 arg="$arg $wl$func_quote_for_eval_result"
4735 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
4736 linker_flags="$linker_flags $func_quote_for_eval_result"
drh71eb93e2001-09-28 01:34:43 +00004737 done
4738 IFS="$save_ifs"
mlcreech636a9952008-05-05 22:52:56 +00004739 func_stripname ' ' '' "$arg"
4740 arg=$func_stripname_result
drh71eb93e2001-09-28 01:34:43 +00004741 ;;
4742
4743 -Xcompiler)
4744 prev=xcompiler
4745 continue
4746 ;;
4747
4748 -Xlinker)
4749 prev=xlinker
4750 continue
4751 ;;
4752
a.rottmann964dbb12004-02-26 19:47:42 +00004753 -XCClinker)
4754 prev=xcclinker
4755 continue
4756 ;;
4757
mlcreech636a9952008-05-05 22:52:56 +00004758 # -msg_* for osf cc
4759 -msg_*)
4760 func_quote_for_eval "$arg"
4761 arg="$func_quote_for_eval_result"
4762 ;;
4763
4764 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
4765 # -r[0-9][0-9]* specifies the processor on the SGI compiler
4766 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
4767 # +DA*, +DD* enable 64-bit mode on the HP compiler
4768 # -q* pass through compiler args for the IBM compiler
4769 # -m*, -t[45]*, -txscale* pass through architecture-specific
4770 # compiler args for GCC
4771 # -F/path gives path to uninstalled frameworks, gcc on darwin
4772 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
4773 # @file GCC response files
4774 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
4775 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
4776 func_quote_for_eval "$arg"
4777 arg="$func_quote_for_eval_result"
4778 func_append compile_command " $arg"
4779 func_append finalize_command " $arg"
4780 compiler_flags="$compiler_flags $arg"
4781 continue
4782 ;;
4783
drh71eb93e2001-09-28 01:34:43 +00004784 # Some other compiler flag.
4785 -* | +*)
mlcreech636a9952008-05-05 22:52:56 +00004786 func_quote_for_eval "$arg"
4787 arg="$func_quote_for_eval_result"
drh71eb93e2001-09-28 01:34:43 +00004788 ;;
4789
a.rottmann964dbb12004-02-26 19:47:42 +00004790 *.$objext)
4791 # A standard object.
4792 objs="$objs $arg"
4793 ;;
drh71eb93e2001-09-28 01:34:43 +00004794
a.rottmann964dbb12004-02-26 19:47:42 +00004795 *.lo)
4796 # A libtool-controlled object.
4797
4798 # Check to see that this really is a libtool object.
mlcreech636a9952008-05-05 22:52:56 +00004799 if func_lalib_unsafe_p "$arg"; then
a.rottmann964dbb12004-02-26 19:47:42 +00004800 pic_object=
4801 non_pic_object=
4802
4803 # Read the .lo file
mlcreech636a9952008-05-05 22:52:56 +00004804 func_source "$arg"
a.rottmann964dbb12004-02-26 19:47:42 +00004805
mlcreech636a9952008-05-05 22:52:56 +00004806 if test -z "$pic_object" ||
a.rottmann964dbb12004-02-26 19:47:42 +00004807 test -z "$non_pic_object" ||
mlcreech636a9952008-05-05 22:52:56 +00004808 test "$pic_object" = none &&
a.rottmann964dbb12004-02-26 19:47:42 +00004809 test "$non_pic_object" = none; then
mlcreech636a9952008-05-05 22:52:56 +00004810 func_fatal_error "cannot find name of object for \`$arg'"
a.rottmann964dbb12004-02-26 19:47:42 +00004811 fi
4812
4813 # Extract subdirectory from the argument.
mlcreech636a9952008-05-05 22:52:56 +00004814 func_dirname "$arg" "/" ""
4815 xdir="$func_dirname_result"
a.rottmann964dbb12004-02-26 19:47:42 +00004816
4817 if test "$pic_object" != none; then
4818 # Prepend the subdirectory the object is found in.
4819 pic_object="$xdir$pic_object"
4820
4821 if test "$prev" = dlfiles; then
4822 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
4823 dlfiles="$dlfiles $pic_object"
4824 prev=
4825 continue
4826 else
4827 # If libtool objects are unsupported, then we need to preload.
4828 prev=dlprefiles
4829 fi
4830 fi
4831
4832 # CHECK ME: I think I busted this. -Ossama
4833 if test "$prev" = dlprefiles; then
4834 # Preload the old-style object.
4835 dlprefiles="$dlprefiles $pic_object"
4836 prev=
4837 fi
4838
4839 # A PIC object.
mlcreech636a9952008-05-05 22:52:56 +00004840 func_append libobjs " $pic_object"
a.rottmann964dbb12004-02-26 19:47:42 +00004841 arg="$pic_object"
4842 fi
4843
4844 # Non-PIC object.
4845 if test "$non_pic_object" != none; then
4846 # Prepend the subdirectory the object is found in.
4847 non_pic_object="$xdir$non_pic_object"
4848
4849 # A standard non-PIC object
mlcreech636a9952008-05-05 22:52:56 +00004850 func_append non_pic_objects " $non_pic_object"
a.rottmann964dbb12004-02-26 19:47:42 +00004851 if test -z "$pic_object" || test "$pic_object" = none ; then
4852 arg="$non_pic_object"
4853 fi
vapier7f19c022007-02-17 14:46:31 +00004854 else
4855 # If the PIC object exists, use it instead.
4856 # $xdir was prepended to $pic_object above.
4857 non_pic_object="$pic_object"
mlcreech636a9952008-05-05 22:52:56 +00004858 func_append non_pic_objects " $non_pic_object"
a.rottmann964dbb12004-02-26 19:47:42 +00004859 fi
4860 else
4861 # Only an error if not doing a dry-run.
mlcreech636a9952008-05-05 22:52:56 +00004862 if $opt_dry_run; then
a.rottmann964dbb12004-02-26 19:47:42 +00004863 # Extract subdirectory from the argument.
mlcreech636a9952008-05-05 22:52:56 +00004864 func_dirname "$arg" "/" ""
4865 xdir="$func_dirname_result"
a.rottmann964dbb12004-02-26 19:47:42 +00004866
mlcreech636a9952008-05-05 22:52:56 +00004867 func_lo2o "$arg"
4868 pic_object=$xdir$objdir/$func_lo2o_result
4869 non_pic_object=$xdir$func_lo2o_result
4870 func_append libobjs " $pic_object"
4871 func_append non_pic_objects " $non_pic_object"
4872 else
4873 func_fatal_error "\`$arg' is not a valid libtool object"
a.rottmann964dbb12004-02-26 19:47:42 +00004874 fi
drh71eb93e2001-09-28 01:34:43 +00004875 fi
4876 ;;
4877
4878 *.$libext)
4879 # An archive.
4880 deplibs="$deplibs $arg"
4881 old_deplibs="$old_deplibs $arg"
4882 continue
4883 ;;
4884
4885 *.la)
4886 # A libtool-controlled library.
4887
4888 if test "$prev" = dlfiles; then
4889 # This library was specified with -dlopen.
4890 dlfiles="$dlfiles $arg"
4891 prev=
4892 elif test "$prev" = dlprefiles; then
4893 # The library was specified with -dlpreopen.
4894 dlprefiles="$dlprefiles $arg"
4895 prev=
4896 else
4897 deplibs="$deplibs $arg"
4898 fi
4899 continue
4900 ;;
4901
4902 # Some other compiler argument.
4903 *)
4904 # Unknown arguments in both finalize_command and compile_command need
4905 # to be aesthetically quoted because they are evaled later.
mlcreech636a9952008-05-05 22:52:56 +00004906 func_quote_for_eval "$arg"
4907 arg="$func_quote_for_eval_result"
drh71eb93e2001-09-28 01:34:43 +00004908 ;;
4909 esac # arg
4910
4911 # Now actually substitute the argument into the commands.
4912 if test -n "$arg"; then
mlcreech636a9952008-05-05 22:52:56 +00004913 func_append compile_command " $arg"
4914 func_append finalize_command " $arg"
drh71eb93e2001-09-28 01:34:43 +00004915 fi
4916 done # argument parsing loop
4917
mlcreech636a9952008-05-05 22:52:56 +00004918 test -n "$prev" && \
4919 func_fatal_help "the \`$prevarg' option requires an argument"
drh71eb93e2001-09-28 01:34:43 +00004920
drh71eb93e2001-09-28 01:34:43 +00004921 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
4922 eval arg=\"$export_dynamic_flag_spec\"
mlcreech636a9952008-05-05 22:52:56 +00004923 func_append compile_command " $arg"
4924 func_append finalize_command " $arg"
drh71eb93e2001-09-28 01:34:43 +00004925 fi
4926
a.rottmann964dbb12004-02-26 19:47:42 +00004927 oldlibs=
drh71eb93e2001-09-28 01:34:43 +00004928 # calculate the name of the file, without its directory
mlcreech636a9952008-05-05 22:52:56 +00004929 func_basename "$output"
4930 outputname="$func_basename_result"
drh71eb93e2001-09-28 01:34:43 +00004931 libobjs_save="$libobjs"
4932
4933 if test -n "$shlibpath_var"; then
4934 # get the directories listed in $shlibpath_var
mlcreech636a9952008-05-05 22:52:56 +00004935 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
drh71eb93e2001-09-28 01:34:43 +00004936 else
4937 shlib_search_path=
4938 fi
4939 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
4940 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
4941
mlcreech636a9952008-05-05 22:52:56 +00004942 func_dirname "$output" "/" ""
4943 output_objdir="$func_dirname_result$objdir"
drh71eb93e2001-09-28 01:34:43 +00004944 # Create the object directory.
mlcreech636a9952008-05-05 22:52:56 +00004945 func_mkdir_p "$output_objdir"
drh71eb93e2001-09-28 01:34:43 +00004946
4947 # Determine the type of output
4948 case $output in
4949 "")
mlcreech636a9952008-05-05 22:52:56 +00004950 func_fatal_help "you must specify an output file"
drh71eb93e2001-09-28 01:34:43 +00004951 ;;
4952 *.$libext) linkmode=oldlib ;;
4953 *.lo | *.$objext) linkmode=obj ;;
4954 *.la) linkmode=lib ;;
4955 *) linkmode=prog ;; # Anything else should be a program.
4956 esac
4957
4958 specialdeplibs=
a.rottmann964dbb12004-02-26 19:47:42 +00004959
drh71eb93e2001-09-28 01:34:43 +00004960 libs=
4961 # Find all interdependent deplibs by searching for libraries
4962 # that are linked more than once (e.g. -la -lb -la)
4963 for deplib in $deplibs; do
mlcreech636a9952008-05-05 22:52:56 +00004964 if $opt_duplicate_deps ; then
a.rottmann62507b62003-03-24 09:40:34 +00004965 case "$libs " in
4966 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4967 esac
4968 fi
drh71eb93e2001-09-28 01:34:43 +00004969 libs="$libs $deplib"
4970 done
a.rottmann964dbb12004-02-26 19:47:42 +00004971
4972 if test "$linkmode" = lib; then
4973 libs="$predeps $libs $compiler_lib_search_path $postdeps"
4974
4975 # Compute libraries that are listed more than once in $predeps
4976 # $postdeps and mark them as special (i.e., whose duplicates are
4977 # not to be eliminated).
4978 pre_post_deps=
mlcreech636a9952008-05-05 22:52:56 +00004979 if $opt_duplicate_compiler_generated_deps; then
a.rottmann964dbb12004-02-26 19:47:42 +00004980 for pre_post_dep in $predeps $postdeps; do
4981 case "$pre_post_deps " in
4982 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
4983 esac
4984 pre_post_deps="$pre_post_deps $pre_post_dep"
4985 done
4986 fi
4987 pre_post_deps=
4988 fi
4989
drh71eb93e2001-09-28 01:34:43 +00004990 deplibs=
4991 newdependency_libs=
4992 newlib_search_path=
4993 need_relink=no # whether we're linking any uninstalled libtool libraries
4994 notinst_deplibs= # not-installed libtool libraries
mlcreech636a9952008-05-05 22:52:56 +00004995 notinst_path= # paths that contain not-installed libtool libraries
4996
drh71eb93e2001-09-28 01:34:43 +00004997 case $linkmode in
4998 lib)
mlcreech636a9952008-05-05 22:52:56 +00004999 passes="conv dlpreopen link"
drh71eb93e2001-09-28 01:34:43 +00005000 for file in $dlfiles $dlprefiles; do
5001 case $file in
5002 *.la) ;;
5003 *)
mlcreech636a9952008-05-05 22:52:56 +00005004 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
drh71eb93e2001-09-28 01:34:43 +00005005 ;;
5006 esac
5007 done
5008 ;;
5009 prog)
5010 compile_deplibs=
5011 finalize_deplibs=
5012 alldeplibs=no
5013 newdlfiles=
5014 newdlprefiles=
5015 passes="conv scan dlopen dlpreopen link"
5016 ;;
5017 *) passes="conv"
5018 ;;
5019 esac
mlcreech636a9952008-05-05 22:52:56 +00005020
drh71eb93e2001-09-28 01:34:43 +00005021 for pass in $passes; do
mlcreech636a9952008-05-05 22:52:56 +00005022 # The preopen pass in lib mode reverses $deplibs; put it back here
5023 # so that -L comes before libs that need it for instance...
5024 if test "$linkmode,$pass" = "lib,link"; then
5025 ## FIXME: Find the place where the list is rebuilt in the wrong
5026 ## order, and fix it there properly
5027 tmp_deplibs=
5028 for deplib in $deplibs; do
5029 tmp_deplibs="$deplib $tmp_deplibs"
5030 done
5031 deplibs="$tmp_deplibs"
5032 fi
5033
a.rottmann964dbb12004-02-26 19:47:42 +00005034 if test "$linkmode,$pass" = "lib,link" ||
5035 test "$linkmode,$pass" = "prog,scan"; then
5036 libs="$deplibs"
5037 deplibs=
5038 fi
5039 if test "$linkmode" = prog; then
drh71eb93e2001-09-28 01:34:43 +00005040 case $pass in
a.rottmann964dbb12004-02-26 19:47:42 +00005041 dlopen) libs="$dlfiles" ;;
drh71eb93e2001-09-28 01:34:43 +00005042 dlpreopen) libs="$dlprefiles" ;;
5043 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
5044 esac
5045 fi
mlcreech636a9952008-05-05 22:52:56 +00005046 if test "$linkmode,$pass" = "lib,dlpreopen"; then
5047 # Collect and forward deplibs of preopened libtool libs
5048 for lib in $dlprefiles; do
5049 # Ignore non-libtool-libs
5050 dependency_libs=
5051 case $lib in
5052 *.la) func_source "$lib" ;;
5053 esac
5054
5055 # Collect preopened libtool deplibs, except any this library
5056 # has declared as weak libs
5057 for deplib in $dependency_libs; do
5058 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
5059 case " $weak_libs " in
5060 *" $deplib_base "*) ;;
5061 *) deplibs="$deplibs $deplib" ;;
5062 esac
5063 done
5064 done
5065 libs="$dlprefiles"
5066 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005067 if test "$pass" = dlopen; then
5068 # Collect dlpreopened libraries
5069 save_deplibs="$deplibs"
5070 deplibs=
5071 fi
mlcreech636a9952008-05-05 22:52:56 +00005072
drh71eb93e2001-09-28 01:34:43 +00005073 for deplib in $libs; do
5074 lib=
5075 found=no
5076 case $deplib in
mlcreech636a9952008-05-05 22:52:56 +00005077 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
a.rottmann964dbb12004-02-26 19:47:42 +00005078 if test "$linkmode,$pass" = "prog,link"; then
5079 compile_deplibs="$deplib $compile_deplibs"
5080 finalize_deplibs="$deplib $finalize_deplibs"
5081 else
vapier7f19c022007-02-17 14:46:31 +00005082 compiler_flags="$compiler_flags $deplib"
mlcreech636a9952008-05-05 22:52:56 +00005083 if test "$linkmode" = lib ; then
5084 case "$new_inherited_linker_flags " in
5085 *" $deplib "*) ;;
5086 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5087 esac
5088 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005089 fi
5090 continue
5091 ;;
drh71eb93e2001-09-28 01:34:43 +00005092 -l*)
a.rottmann964dbb12004-02-26 19:47:42 +00005093 if test "$linkmode" != lib && test "$linkmode" != prog; then
mlcreech636a9952008-05-05 22:52:56 +00005094 func_warning "\`-l' is ignored for archives/objects"
drh71eb93e2001-09-28 01:34:43 +00005095 continue
5096 fi
mlcreech636a9952008-05-05 22:52:56 +00005097 func_stripname '-l' '' "$deplib"
5098 name=$func_stripname_result
5099 if test "$linkmode" = lib; then
5100 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
5101 else
5102 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
5103 fi
5104 for searchdir in $searchdirs; do
vapier7f19c022007-02-17 14:46:31 +00005105 for search_ext in .la $std_shrext .so .a; do
a.rottmann964dbb12004-02-26 19:47:42 +00005106 # Search the libtool library
5107 lib="$searchdir/lib${name}${search_ext}"
5108 if test -f "$lib"; then
5109 if test "$search_ext" = ".la"; then
5110 found=yes
5111 else
5112 found=no
5113 fi
5114 break 2
5115 fi
5116 done
drh71eb93e2001-09-28 01:34:43 +00005117 done
5118 if test "$found" != yes; then
5119 # deplib doesn't seem to be a libtool library
5120 if test "$linkmode,$pass" = "prog,link"; then
5121 compile_deplibs="$deplib $compile_deplibs"
5122 finalize_deplibs="$deplib $finalize_deplibs"
5123 else
5124 deplibs="$deplib $deplibs"
a.rottmann964dbb12004-02-26 19:47:42 +00005125 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
drh71eb93e2001-09-28 01:34:43 +00005126 fi
5127 continue
a.rottmann964dbb12004-02-26 19:47:42 +00005128 else # deplib is a libtool library
5129 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
5130 # We need to do some special things here, and not later.
5131 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5132 case " $predeps $postdeps " in
5133 *" $deplib "*)
mlcreech636a9952008-05-05 22:52:56 +00005134 if func_lalib_p "$lib"; then
a.rottmann964dbb12004-02-26 19:47:42 +00005135 library_names=
5136 old_library=
mlcreech636a9952008-05-05 22:52:56 +00005137 func_source "$lib"
a.rottmann964dbb12004-02-26 19:47:42 +00005138 for l in $old_library $library_names; do
5139 ll="$l"
5140 done
5141 if test "X$ll" = "X$old_library" ; then # only static version available
5142 found=no
mlcreech636a9952008-05-05 22:52:56 +00005143 func_dirname "$lib" "" "."
5144 ladir="$func_dirname_result"
a.rottmann964dbb12004-02-26 19:47:42 +00005145 lib=$ladir/$old_library
5146 if test "$linkmode,$pass" = "prog,link"; then
5147 compile_deplibs="$deplib $compile_deplibs"
5148 finalize_deplibs="$deplib $finalize_deplibs"
5149 else
5150 deplibs="$deplib $deplibs"
5151 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
5152 fi
5153 continue
5154 fi
5155 fi
mlcreech636a9952008-05-05 22:52:56 +00005156 ;;
a.rottmann964dbb12004-02-26 19:47:42 +00005157 *) ;;
5158 esac
5159 fi
drh71eb93e2001-09-28 01:34:43 +00005160 fi
5161 ;; # -l
mlcreech636a9952008-05-05 22:52:56 +00005162 *.ltframework)
5163 if test "$linkmode,$pass" = "prog,link"; then
5164 compile_deplibs="$deplib $compile_deplibs"
5165 finalize_deplibs="$deplib $finalize_deplibs"
5166 else
5167 deplibs="$deplib $deplibs"
5168 if test "$linkmode" = lib ; then
5169 case "$new_inherited_linker_flags " in
5170 *" $deplib "*) ;;
5171 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
5172 esac
5173 fi
5174 fi
5175 continue
5176 ;;
drh71eb93e2001-09-28 01:34:43 +00005177 -L*)
5178 case $linkmode in
5179 lib)
5180 deplibs="$deplib $deplibs"
a.rottmann964dbb12004-02-26 19:47:42 +00005181 test "$pass" = conv && continue
drh71eb93e2001-09-28 01:34:43 +00005182 newdependency_libs="$deplib $newdependency_libs"
mlcreech636a9952008-05-05 22:52:56 +00005183 func_stripname '-L' '' "$deplib"
5184 newlib_search_path="$newlib_search_path $func_stripname_result"
drh71eb93e2001-09-28 01:34:43 +00005185 ;;
5186 prog)
a.rottmann964dbb12004-02-26 19:47:42 +00005187 if test "$pass" = conv; then
drh71eb93e2001-09-28 01:34:43 +00005188 deplibs="$deplib $deplibs"
5189 continue
5190 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005191 if test "$pass" = scan; then
drh71eb93e2001-09-28 01:34:43 +00005192 deplibs="$deplib $deplibs"
drh71eb93e2001-09-28 01:34:43 +00005193 else
5194 compile_deplibs="$deplib $compile_deplibs"
5195 finalize_deplibs="$deplib $finalize_deplibs"
5196 fi
mlcreech636a9952008-05-05 22:52:56 +00005197 func_stripname '-L' '' "$deplib"
5198 newlib_search_path="$newlib_search_path $func_stripname_result"
drh71eb93e2001-09-28 01:34:43 +00005199 ;;
5200 *)
mlcreech636a9952008-05-05 22:52:56 +00005201 func_warning "\`-L' is ignored for archives/objects"
drh71eb93e2001-09-28 01:34:43 +00005202 ;;
5203 esac # linkmode
5204 continue
5205 ;; # -L
5206 -R*)
a.rottmann964dbb12004-02-26 19:47:42 +00005207 if test "$pass" = link; then
mlcreech636a9952008-05-05 22:52:56 +00005208 func_stripname '-R' '' "$deplib"
5209 dir=$func_stripname_result
drh71eb93e2001-09-28 01:34:43 +00005210 # Make sure the xrpath contains only unique directories.
5211 case "$xrpath " in
5212 *" $dir "*) ;;
5213 *) xrpath="$xrpath $dir" ;;
5214 esac
5215 fi
5216 deplibs="$deplib $deplibs"
5217 continue
5218 ;;
5219 *.la) lib="$deplib" ;;
5220 *.$libext)
a.rottmann964dbb12004-02-26 19:47:42 +00005221 if test "$pass" = conv; then
drh71eb93e2001-09-28 01:34:43 +00005222 deplibs="$deplib $deplibs"
5223 continue
5224 fi
5225 case $linkmode in
5226 lib)
mlcreech636a9952008-05-05 22:52:56 +00005227 # Linking convenience modules into shared libraries is allowed,
5228 # but linking other static libraries is non-portable.
5229 case " $dlpreconveniencelibs " in
5230 *" $deplib "*) ;;
5231 *)
5232 valid_a_lib=no
5233 case $deplibs_check_method in
5234 match_pattern*)
5235 set dummy $deplibs_check_method; shift
5236 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5237 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
vapier7f19c022007-02-17 14:46:31 +00005238 | $EGREP "$match_pattern_regex" > /dev/null; then
mlcreech636a9952008-05-05 22:52:56 +00005239 valid_a_lib=yes
5240 fi
5241 ;;
5242 pass_all)
vapier7f19c022007-02-17 14:46:31 +00005243 valid_a_lib=yes
vapier7f19c022007-02-17 14:46:31 +00005244 ;;
mlcreech636a9952008-05-05 22:52:56 +00005245 esac
5246 if test "$valid_a_lib" != yes; then
5247 $ECHO
5248 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
5249 $ECHO "*** I have the capability to make that library automatically link in when"
5250 $ECHO "*** you link to this library. But I can only do this if you have a"
5251 $ECHO "*** shared version of the library, which you do not appear to have"
5252 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
5253 $ECHO "*** that it is just a static archive that I should not use here."
5254 else
5255 $ECHO
5256 $ECHO "*** Warning: Linking the shared library $output against the"
5257 $ECHO "*** static library $deplib is not portable!"
5258 deplibs="$deplib $deplibs"
5259 fi
5260 ;;
5261 esac
drh71eb93e2001-09-28 01:34:43 +00005262 continue
5263 ;;
5264 prog)
a.rottmann964dbb12004-02-26 19:47:42 +00005265 if test "$pass" != link; then
drh71eb93e2001-09-28 01:34:43 +00005266 deplibs="$deplib $deplibs"
5267 else
5268 compile_deplibs="$deplib $compile_deplibs"
5269 finalize_deplibs="$deplib $finalize_deplibs"
5270 fi
5271 continue
5272 ;;
5273 esac # linkmode
5274 ;; # *.$libext
5275 *.lo | *.$objext)
a.rottmann964dbb12004-02-26 19:47:42 +00005276 if test "$pass" = conv; then
5277 deplibs="$deplib $deplibs"
5278 elif test "$linkmode" = prog; then
5279 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
5280 # If there is no dlopen support or we're linking statically,
5281 # we need to preload.
5282 newdlprefiles="$newdlprefiles $deplib"
5283 compile_deplibs="$deplib $compile_deplibs"
5284 finalize_deplibs="$deplib $finalize_deplibs"
5285 else
5286 newdlfiles="$newdlfiles $deplib"
5287 fi
drh71eb93e2001-09-28 01:34:43 +00005288 fi
5289 continue
5290 ;;
5291 %DEPLIBS%)
5292 alldeplibs=yes
5293 continue
5294 ;;
5295 esac # case $deplib
mlcreech636a9952008-05-05 22:52:56 +00005296
a.rottmann964dbb12004-02-26 19:47:42 +00005297 if test "$found" = yes || test -f "$lib"; then :
drh71eb93e2001-09-28 01:34:43 +00005298 else
mlcreech636a9952008-05-05 22:52:56 +00005299 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
drh71eb93e2001-09-28 01:34:43 +00005300 fi
5301
5302 # Check to see that this really is a libtool archive.
mlcreech636a9952008-05-05 22:52:56 +00005303 func_lalib_unsafe_p "$lib" \
5304 || func_fatal_error "\`$lib' is not a valid libtool archive"
drh71eb93e2001-09-28 01:34:43 +00005305
mlcreech636a9952008-05-05 22:52:56 +00005306 func_dirname "$lib" "" "."
5307 ladir="$func_dirname_result"
drh71eb93e2001-09-28 01:34:43 +00005308
5309 dlname=
5310 dlopen=
5311 dlpreopen=
5312 libdir=
5313 library_names=
5314 old_library=
mlcreech636a9952008-05-05 22:52:56 +00005315 inherited_linker_flags=
drh71eb93e2001-09-28 01:34:43 +00005316 # If the library was installed with an old release of libtool,
a.rottmann964dbb12004-02-26 19:47:42 +00005317 # it will not redefine variables installed, or shouldnotlink
drh71eb93e2001-09-28 01:34:43 +00005318 installed=yes
a.rottmann964dbb12004-02-26 19:47:42 +00005319 shouldnotlink=no
vapier7f19c022007-02-17 14:46:31 +00005320 avoidtemprpath=
5321
drh71eb93e2001-09-28 01:34:43 +00005322
5323 # Read the .la file
mlcreech636a9952008-05-05 22:52:56 +00005324 func_source "$lib"
drh71eb93e2001-09-28 01:34:43 +00005325
mlcreech636a9952008-05-05 22:52:56 +00005326 # Convert "-framework foo" to "foo.ltframework"
5327 if test -n "$inherited_linker_flags"; then
5328 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
5329 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
5330 case " $new_inherited_linker_flags " in
5331 *" $tmp_inherited_linker_flag "*) ;;
5332 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
5333 esac
5334 done
5335 fi
5336 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
drh71eb93e2001-09-28 01:34:43 +00005337 if test "$linkmode,$pass" = "lib,link" ||
5338 test "$linkmode,$pass" = "prog,scan" ||
a.rottmann964dbb12004-02-26 19:47:42 +00005339 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
drh71eb93e2001-09-28 01:34:43 +00005340 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
5341 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
5342 fi
5343
a.rottmann964dbb12004-02-26 19:47:42 +00005344 if test "$pass" = conv; then
drh71eb93e2001-09-28 01:34:43 +00005345 # Only check for convenience libraries
5346 deplibs="$lib $deplibs"
5347 if test -z "$libdir"; then
5348 if test -z "$old_library"; then
mlcreech636a9952008-05-05 22:52:56 +00005349 func_fatal_error "cannot find name of link library for \`$lib'"
drh71eb93e2001-09-28 01:34:43 +00005350 fi
5351 # It is a libtool convenience library, so add in its objects.
5352 convenience="$convenience $ladir/$objdir/$old_library"
5353 old_convenience="$old_convenience $ladir/$objdir/$old_library"
a.rottmann964dbb12004-02-26 19:47:42 +00005354 elif test "$linkmode" != prog && test "$linkmode" != lib; then
mlcreech636a9952008-05-05 22:52:56 +00005355 func_fatal_error "\`$lib' is not a convenience library"
drh71eb93e2001-09-28 01:34:43 +00005356 fi
mlcreech636a9952008-05-05 22:52:56 +00005357 tmp_libs=
5358 for deplib in $dependency_libs; do
5359 deplibs="$deplib $deplibs"
5360 if $opt_duplicate_deps ; then
5361 case "$tmp_libs " in
5362 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5363 esac
5364 fi
5365 tmp_libs="$tmp_libs $deplib"
5366 done
drh71eb93e2001-09-28 01:34:43 +00005367 continue
5368 fi # $pass = conv
5369
vapier7f19c022007-02-17 14:46:31 +00005370
drh71eb93e2001-09-28 01:34:43 +00005371 # Get the name of the library we link against.
5372 linklib=
5373 for l in $old_library $library_names; do
5374 linklib="$l"
5375 done
5376 if test -z "$linklib"; then
mlcreech636a9952008-05-05 22:52:56 +00005377 func_fatal_error "cannot find name of link library for \`$lib'"
drh71eb93e2001-09-28 01:34:43 +00005378 fi
5379
5380 # This library was specified with -dlopen.
a.rottmann964dbb12004-02-26 19:47:42 +00005381 if test "$pass" = dlopen; then
drh71eb93e2001-09-28 01:34:43 +00005382 if test -z "$libdir"; then
mlcreech636a9952008-05-05 22:52:56 +00005383 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
drh71eb93e2001-09-28 01:34:43 +00005384 fi
vapier7f19c022007-02-17 14:46:31 +00005385 if test -z "$dlname" ||
5386 test "$dlopen_support" != yes ||
5387 test "$build_libtool_libs" = no; then
drh71eb93e2001-09-28 01:34:43 +00005388 # If there is no dlname, no dlopen support or we're linking
a.rottmann964dbb12004-02-26 19:47:42 +00005389 # statically, we need to preload. We also need to preload any
5390 # dependent libraries so libltdl's deplib preloader doesn't
5391 # bomb out in the load deplibs phase.
5392 dlprefiles="$dlprefiles $lib $dependency_libs"
drh71eb93e2001-09-28 01:34:43 +00005393 else
5394 newdlfiles="$newdlfiles $lib"
5395 fi
5396 continue
5397 fi # $pass = dlopen
5398
5399 # We need an absolute path.
5400 case $ladir in
5401 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
5402 *)
5403 abs_ladir=`cd "$ladir" && pwd`
5404 if test -z "$abs_ladir"; then
mlcreech636a9952008-05-05 22:52:56 +00005405 func_warning "cannot determine absolute directory name of \`$ladir'"
5406 func_warning "passing it literally to the linker, although it might fail"
drh71eb93e2001-09-28 01:34:43 +00005407 abs_ladir="$ladir"
5408 fi
5409 ;;
5410 esac
mlcreech636a9952008-05-05 22:52:56 +00005411 func_basename "$lib"
5412 laname="$func_basename_result"
drh71eb93e2001-09-28 01:34:43 +00005413
5414 # Find the relevant object directory and library name.
5415 if test "X$installed" = Xyes; then
5416 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
mlcreech636a9952008-05-05 22:52:56 +00005417 func_warning "library \`$lib' was moved."
drh71eb93e2001-09-28 01:34:43 +00005418 dir="$ladir"
5419 absdir="$abs_ladir"
5420 libdir="$abs_ladir"
5421 else
5422 dir="$libdir"
5423 absdir="$libdir"
5424 fi
vapier7f19c022007-02-17 14:46:31 +00005425 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
drh71eb93e2001-09-28 01:34:43 +00005426 else
vapier7f19c022007-02-17 14:46:31 +00005427 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
5428 dir="$ladir"
5429 absdir="$abs_ladir"
5430 # Remove this search path later
5431 notinst_path="$notinst_path $abs_ladir"
5432 else
5433 dir="$ladir/$objdir"
5434 absdir="$abs_ladir/$objdir"
5435 # Remove this search path later
5436 notinst_path="$notinst_path $abs_ladir"
5437 fi
drh71eb93e2001-09-28 01:34:43 +00005438 fi # $installed = yes
mlcreech636a9952008-05-05 22:52:56 +00005439 func_stripname 'lib' '.la' "$laname"
5440 name=$func_stripname_result
drh71eb93e2001-09-28 01:34:43 +00005441
5442 # This library was specified with -dlpreopen.
a.rottmann964dbb12004-02-26 19:47:42 +00005443 if test "$pass" = dlpreopen; then
mlcreech636a9952008-05-05 22:52:56 +00005444 if test -z "$libdir" && test "$linkmode" = prog; then
5445 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
drh71eb93e2001-09-28 01:34:43 +00005446 fi
5447 # Prefer using a static library (so that no silly _DYNAMIC symbols
5448 # are required to link).
5449 if test -n "$old_library"; then
5450 newdlprefiles="$newdlprefiles $dir/$old_library"
mlcreech636a9952008-05-05 22:52:56 +00005451 # Keep a list of preopened convenience libraries to check
5452 # that they are being used correctly in the link pass.
5453 test -z "$libdir" && \
5454 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
drh71eb93e2001-09-28 01:34:43 +00005455 # Otherwise, use the dlname, so that lt_dlopen finds it.
5456 elif test -n "$dlname"; then
5457 newdlprefiles="$newdlprefiles $dir/$dlname"
5458 else
5459 newdlprefiles="$newdlprefiles $dir/$linklib"
5460 fi
5461 fi # $pass = dlpreopen
5462
5463 if test -z "$libdir"; then
5464 # Link the convenience library
a.rottmann964dbb12004-02-26 19:47:42 +00005465 if test "$linkmode" = lib; then
drh71eb93e2001-09-28 01:34:43 +00005466 deplibs="$dir/$old_library $deplibs"
5467 elif test "$linkmode,$pass" = "prog,link"; then
5468 compile_deplibs="$dir/$old_library $compile_deplibs"
5469 finalize_deplibs="$dir/$old_library $finalize_deplibs"
5470 else
a.rottmann964dbb12004-02-26 19:47:42 +00005471 deplibs="$lib $deplibs" # used for prog,scan pass
drh71eb93e2001-09-28 01:34:43 +00005472 fi
5473 continue
5474 fi
5475
vapier7f19c022007-02-17 14:46:31 +00005476
a.rottmann964dbb12004-02-26 19:47:42 +00005477 if test "$linkmode" = prog && test "$pass" != link; then
drh71eb93e2001-09-28 01:34:43 +00005478 newlib_search_path="$newlib_search_path $ladir"
5479 deplibs="$lib $deplibs"
5480
5481 linkalldeplibs=no
5482 if test "$link_all_deplibs" != no || test -z "$library_names" ||
5483 test "$build_libtool_libs" = no; then
5484 linkalldeplibs=yes
5485 fi
5486
5487 tmp_libs=
5488 for deplib in $dependency_libs; do
5489 case $deplib in
mlcreech636a9952008-05-05 22:52:56 +00005490 -L*) func_stripname '-L' '' "$deplib"
5491 newlib_search_path="$newlib_search_path $func_stripname_result"
5492 ;;
drh71eb93e2001-09-28 01:34:43 +00005493 esac
5494 # Need to link against all dependency_libs?
a.rottmann964dbb12004-02-26 19:47:42 +00005495 if test "$linkalldeplibs" = yes; then
drh71eb93e2001-09-28 01:34:43 +00005496 deplibs="$deplib $deplibs"
5497 else
5498 # Need to hardcode shared library paths
5499 # or/and link against static libraries
5500 newdependency_libs="$deplib $newdependency_libs"
5501 fi
mlcreech636a9952008-05-05 22:52:56 +00005502 if $opt_duplicate_deps ; then
a.rottmann62507b62003-03-24 09:40:34 +00005503 case "$tmp_libs " in
5504 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5505 esac
5506 fi
drh71eb93e2001-09-28 01:34:43 +00005507 tmp_libs="$tmp_libs $deplib"
5508 done # for deplib
5509 continue
5510 fi # $linkmode = prog...
5511
a.rottmann964dbb12004-02-26 19:47:42 +00005512 if test "$linkmode,$pass" = "prog,link"; then
5513 if test -n "$library_names" &&
mlcreech636a9952008-05-05 22:52:56 +00005514 { { test "$prefer_static_libs" = no ||
5515 test "$prefer_static_libs,$installed" = "built,yes"; } ||
5516 test -z "$old_library"; }; then
a.rottmann964dbb12004-02-26 19:47:42 +00005517 # We need to hardcode the library path
vapier7f19c022007-02-17 14:46:31 +00005518 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
a.rottmann964dbb12004-02-26 19:47:42 +00005519 # Make sure the rpath contains only unique directories.
mlcreech636a9952008-05-05 22:52:56 +00005520 case "$temp_rpath:" in
5521 *"$absdir:"*) ;;
5522 *) temp_rpath="$temp_rpath$absdir:" ;;
a.rottmann964dbb12004-02-26 19:47:42 +00005523 esac
5524 fi
drh71eb93e2001-09-28 01:34:43 +00005525
5526 # Hardcode the library path.
5527 # Skip directories that are in the system default run-time
5528 # search path.
5529 case " $sys_lib_dlsearch_path " in
5530 *" $absdir "*) ;;
5531 *)
5532 case "$compile_rpath " in
5533 *" $absdir "*) ;;
5534 *) compile_rpath="$compile_rpath $absdir"
5535 esac
5536 ;;
5537 esac
5538 case " $sys_lib_dlsearch_path " in
5539 *" $libdir "*) ;;
5540 *)
5541 case "$finalize_rpath " in
5542 *" $libdir "*) ;;
5543 *) finalize_rpath="$finalize_rpath $libdir"
5544 esac
5545 ;;
5546 esac
5547 fi # $linkmode,$pass = prog,link...
5548
5549 if test "$alldeplibs" = yes &&
5550 { test "$deplibs_check_method" = pass_all ||
5551 { test "$build_libtool_libs" = yes &&
5552 test -n "$library_names"; }; }; then
5553 # We only need to search for static libraries
5554 continue
5555 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005556 fi
a.rottmann62507b62003-03-24 09:40:34 +00005557
a.rottmann964dbb12004-02-26 19:47:42 +00005558 link_static=no # Whether the deplib will be linked statically
vapier7f19c022007-02-17 14:46:31 +00005559 use_static_libs=$prefer_static_libs
mlcreech636a9952008-05-05 22:52:56 +00005560 if test "$use_static_libs" = built && test "$installed" = yes; then
vapier7f19c022007-02-17 14:46:31 +00005561 use_static_libs=no
5562 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005563 if test -n "$library_names" &&
vapier7f19c022007-02-17 14:46:31 +00005564 { test "$use_static_libs" = no || test -z "$old_library"; }; then
mlcreech636a9952008-05-05 22:52:56 +00005565 case $host in
vapier6acb2cf2009-01-28 04:46:28 +00005566 *cygwin* | *mingw* | *cegcc*)
mlcreech636a9952008-05-05 22:52:56 +00005567 # No point in relinking DLLs because paths are not encoded
5568 notinst_deplibs="$notinst_deplibs $lib"
5569 need_relink=no
5570 ;;
5571 *)
5572 if test "$installed" = no; then
5573 notinst_deplibs="$notinst_deplibs $lib"
5574 need_relink=yes
5575 fi
5576 ;;
5577 esac
a.rottmann964dbb12004-02-26 19:47:42 +00005578 # This is a shared library
vapier7f19c022007-02-17 14:46:31 +00005579
mlcreech636a9952008-05-05 22:52:56 +00005580 # Warn about portability, can't link against -module's on some
5581 # systems (darwin). Don't bleat about dlopened modules though!
5582 dlopenmodule=""
5583 for dlpremoduletest in $dlprefiles; do
5584 if test "X$dlpremoduletest" = "X$lib"; then
5585 dlopenmodule="$dlpremoduletest"
5586 break
a.rottmann964dbb12004-02-26 19:47:42 +00005587 fi
mlcreech636a9952008-05-05 22:52:56 +00005588 done
5589 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
5590 $ECHO
5591 if test "$linkmode" = prog; then
5592 $ECHO "*** Warning: Linking the executable $output against the loadable module"
5593 else
5594 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
5595 fi
5596 $ECHO "*** $linklib is not portable!"
vapier7f19c022007-02-17 14:46:31 +00005597 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005598 if test "$linkmode" = lib &&
5599 test "$hardcode_into_libs" = yes; then
5600 # Hardcode the library path.
5601 # Skip directories that are in the system default run-time
5602 # search path.
5603 case " $sys_lib_dlsearch_path " in
5604 *" $absdir "*) ;;
5605 *)
5606 case "$compile_rpath " in
5607 *" $absdir "*) ;;
5608 *) compile_rpath="$compile_rpath $absdir"
5609 esac
5610 ;;
5611 esac
5612 case " $sys_lib_dlsearch_path " in
5613 *" $libdir "*) ;;
5614 *)
5615 case "$finalize_rpath " in
5616 *" $libdir "*) ;;
5617 *) finalize_rpath="$finalize_rpath $libdir"
5618 esac
5619 ;;
5620 esac
5621 fi
drh71eb93e2001-09-28 01:34:43 +00005622
5623 if test -n "$old_archive_from_expsyms_cmds"; then
5624 # figure out the soname
5625 set dummy $library_names
mlcreech636a9952008-05-05 22:52:56 +00005626 shift
5627 realname="$1"
5628 shift
5629 libname=`eval "\\$ECHO \"$libname_spec\""`
drh71eb93e2001-09-28 01:34:43 +00005630 # use dlname if we got it. it's perfectly good, no?
5631 if test -n "$dlname"; then
5632 soname="$dlname"
5633 elif test -n "$soname_spec"; then
5634 # bleh windows
5635 case $host in
vapier6acb2cf2009-01-28 04:46:28 +00005636 *cygwin* | mingw* | *cegcc*)
mlcreech636a9952008-05-05 22:52:56 +00005637 func_arith $current - $age
5638 major=$func_arith_result
drh71eb93e2001-09-28 01:34:43 +00005639 versuffix="-$major"
5640 ;;
5641 esac
5642 eval soname=\"$soname_spec\"
5643 else
5644 soname="$realname"
5645 fi
5646
5647 # Make a new name for the extract_expsyms_cmds to use
5648 soroot="$soname"
mlcreech636a9952008-05-05 22:52:56 +00005649 func_basename "$soroot"
5650 soname="$func_basename_result"
5651 func_stripname 'lib' '.dll' "$soname"
5652 newlib=libimp-$func_stripname_result.a
drh71eb93e2001-09-28 01:34:43 +00005653
5654 # If the library has no export list, then create one now
5655 if test -f "$output_objdir/$soname-def"; then :
5656 else
mlcreech636a9952008-05-05 22:52:56 +00005657 func_verbose "extracting exported symbol list from \`$soname'"
5658 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
drh71eb93e2001-09-28 01:34:43 +00005659 fi
5660
5661 # Create $newlib
5662 if test -f "$output_objdir/$newlib"; then :; else
mlcreech636a9952008-05-05 22:52:56 +00005663 func_verbose "generating import library for \`$soname'"
5664 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
drh71eb93e2001-09-28 01:34:43 +00005665 fi
5666 # make sure the library variables are pointing to the new library
5667 dir=$output_objdir
5668 linklib=$newlib
a.rottmann964dbb12004-02-26 19:47:42 +00005669 fi # test -n "$old_archive_from_expsyms_cmds"
drh71eb93e2001-09-28 01:34:43 +00005670
a.rottmann964dbb12004-02-26 19:47:42 +00005671 if test "$linkmode" = prog || test "$mode" != relink; then
drh71eb93e2001-09-28 01:34:43 +00005672 add_shlibpath=
5673 add_dir=
5674 add=
5675 lib_linked=yes
5676 case $hardcode_action in
5677 immediate | unsupported)
5678 if test "$hardcode_direct" = no; then
5679 add="$dir/$linklib"
a.rottmann964dbb12004-02-26 19:47:42 +00005680 case $host in
vapier7f19c022007-02-17 14:46:31 +00005681 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
5682 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
5683 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
5684 *-*-unixware7*) add_dir="-L$dir" ;;
a.rottmann964dbb12004-02-26 19:47:42 +00005685 *-*-darwin* )
mlcreech636a9952008-05-05 22:52:56 +00005686 # if the lib is a (non-dlopened) module then we can not
5687 # link against it, someone is ignoring the earlier warnings
vapier7f19c022007-02-17 14:46:31 +00005688 if /usr/bin/file -L $add 2> /dev/null |
mlcreech636a9952008-05-05 22:52:56 +00005689 $GREP ": [^:]* bundle" >/dev/null ; then
5690 if test "X$dlopenmodule" != "X$lib"; then
5691 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
5692 if test -z "$old_library" ; then
5693 $ECHO
5694 $ECHO "*** And there doesn't seem to be a static archive available"
5695 $ECHO "*** The link will probably fail, sorry"
5696 else
5697 add="$dir/$old_library"
5698 fi
5699 elif test -n "$old_library"; then
5700 add="$dir/$old_library"
vapier7f19c022007-02-17 14:46:31 +00005701 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005702 fi
5703 esac
drh71eb93e2001-09-28 01:34:43 +00005704 elif test "$hardcode_minus_L" = no; then
5705 case $host in
5706 *-*-sunos*) add_shlibpath="$dir" ;;
5707 esac
5708 add_dir="-L$dir"
5709 add="-l$name"
5710 elif test "$hardcode_shlibpath_var" = no; then
5711 add_shlibpath="$dir"
5712 add="-l$name"
5713 else
5714 lib_linked=no
5715 fi
5716 ;;
5717 relink)
mlcreech636a9952008-05-05 22:52:56 +00005718 if test "$hardcode_direct" = yes &&
5719 test "$hardcode_direct_absolute" = no; then
drh71eb93e2001-09-28 01:34:43 +00005720 add="$dir/$linklib"
5721 elif test "$hardcode_minus_L" = yes; then
5722 add_dir="-L$dir"
a.rottmann62507b62003-03-24 09:40:34 +00005723 # Try looking first in the location we're being installed to.
5724 if test -n "$inst_prefix_dir"; then
vapier7f19c022007-02-17 14:46:31 +00005725 case $libdir in
a.rottmann964dbb12004-02-26 19:47:42 +00005726 [\\/]*)
5727 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5728 ;;
a.rottmann62507b62003-03-24 09:40:34 +00005729 esac
5730 fi
drh71eb93e2001-09-28 01:34:43 +00005731 add="-l$name"
5732 elif test "$hardcode_shlibpath_var" = yes; then
5733 add_shlibpath="$dir"
5734 add="-l$name"
5735 else
5736 lib_linked=no
5737 fi
5738 ;;
5739 *) lib_linked=no ;;
5740 esac
5741
5742 if test "$lib_linked" != yes; then
mlcreech636a9952008-05-05 22:52:56 +00005743 func_fatal_configuration "unsupported hardcode properties"
drh71eb93e2001-09-28 01:34:43 +00005744 fi
5745
5746 if test -n "$add_shlibpath"; then
5747 case :$compile_shlibpath: in
5748 *":$add_shlibpath:"*) ;;
5749 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
5750 esac
5751 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005752 if test "$linkmode" = prog; then
drh71eb93e2001-09-28 01:34:43 +00005753 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
5754 test -n "$add" && compile_deplibs="$add $compile_deplibs"
5755 else
5756 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5757 test -n "$add" && deplibs="$add $deplibs"
mlcreech636a9952008-05-05 22:52:56 +00005758 if test "$hardcode_direct" != yes &&
5759 test "$hardcode_minus_L" != yes &&
drh71eb93e2001-09-28 01:34:43 +00005760 test "$hardcode_shlibpath_var" = yes; then
5761 case :$finalize_shlibpath: in
5762 *":$libdir:"*) ;;
5763 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5764 esac
5765 fi
5766 fi
5767 fi
5768
a.rottmann964dbb12004-02-26 19:47:42 +00005769 if test "$linkmode" = prog || test "$mode" = relink; then
drh71eb93e2001-09-28 01:34:43 +00005770 add_shlibpath=
5771 add_dir=
5772 add=
5773 # Finalize command for both is simple: just hardcode it.
mlcreech636a9952008-05-05 22:52:56 +00005774 if test "$hardcode_direct" = yes &&
5775 test "$hardcode_direct_absolute" = no; then
drh71eb93e2001-09-28 01:34:43 +00005776 add="$libdir/$linklib"
5777 elif test "$hardcode_minus_L" = yes; then
5778 add_dir="-L$libdir"
5779 add="-l$name"
5780 elif test "$hardcode_shlibpath_var" = yes; then
5781 case :$finalize_shlibpath: in
5782 *":$libdir:"*) ;;
5783 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
5784 esac
5785 add="-l$name"
a.rottmann964dbb12004-02-26 19:47:42 +00005786 elif test "$hardcode_automatic" = yes; then
vapier7f19c022007-02-17 14:46:31 +00005787 if test -n "$inst_prefix_dir" &&
5788 test -f "$inst_prefix_dir$libdir/$linklib" ; then
mlcreech636a9952008-05-05 22:52:56 +00005789 add="$inst_prefix_dir$libdir/$linklib"
a.rottmann964dbb12004-02-26 19:47:42 +00005790 else
mlcreech636a9952008-05-05 22:52:56 +00005791 add="$libdir/$linklib"
a.rottmann964dbb12004-02-26 19:47:42 +00005792 fi
drh71eb93e2001-09-28 01:34:43 +00005793 else
5794 # We cannot seem to hardcode it, guess we'll fake it.
5795 add_dir="-L$libdir"
a.rottmann62507b62003-03-24 09:40:34 +00005796 # Try looking first in the location we're being installed to.
5797 if test -n "$inst_prefix_dir"; then
vapier7f19c022007-02-17 14:46:31 +00005798 case $libdir in
a.rottmann964dbb12004-02-26 19:47:42 +00005799 [\\/]*)
5800 add_dir="$add_dir -L$inst_prefix_dir$libdir"
5801 ;;
a.rottmann62507b62003-03-24 09:40:34 +00005802 esac
5803 fi
drh71eb93e2001-09-28 01:34:43 +00005804 add="-l$name"
5805 fi
5806
a.rottmann964dbb12004-02-26 19:47:42 +00005807 if test "$linkmode" = prog; then
drh71eb93e2001-09-28 01:34:43 +00005808 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
5809 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
5810 else
5811 test -n "$add_dir" && deplibs="$add_dir $deplibs"
5812 test -n "$add" && deplibs="$add $deplibs"
5813 fi
5814 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005815 elif test "$linkmode" = prog; then
drh71eb93e2001-09-28 01:34:43 +00005816 # Here we assume that one of hardcode_direct or hardcode_minus_L
5817 # is not unsupported. This is valid on all known static and
5818 # shared platforms.
5819 if test "$hardcode_direct" != unsupported; then
5820 test -n "$old_library" && linklib="$old_library"
5821 compile_deplibs="$dir/$linklib $compile_deplibs"
5822 finalize_deplibs="$dir/$linklib $finalize_deplibs"
5823 else
5824 compile_deplibs="-l$name -L$dir $compile_deplibs"
5825 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
5826 fi
5827 elif test "$build_libtool_libs" = yes; then
5828 # Not a shared library
5829 if test "$deplibs_check_method" != pass_all; then
5830 # We're trying link a shared library against a static one
5831 # but the system doesn't support it.
5832
5833 # Just print a warning and add the library to dependency_libs so
5834 # that the program can be linked against the static library.
mlcreech636a9952008-05-05 22:52:56 +00005835 $ECHO
5836 $ECHO "*** Warning: This system can not link to static lib archive $lib."
5837 $ECHO "*** I have the capability to make that library automatically link in when"
5838 $ECHO "*** you link to this library. But I can only do this if you have a"
5839 $ECHO "*** shared version of the library, which you do not appear to have."
drh71eb93e2001-09-28 01:34:43 +00005840 if test "$module" = yes; then
mlcreech636a9952008-05-05 22:52:56 +00005841 $ECHO "*** But as you try to build a module library, libtool will still create "
5842 $ECHO "*** a static module, that should work as long as the dlopening application"
5843 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
drh71eb93e2001-09-28 01:34:43 +00005844 if test -z "$global_symbol_pipe"; then
mlcreech636a9952008-05-05 22:52:56 +00005845 $ECHO
5846 $ECHO "*** However, this would only work if libtool was able to extract symbol"
5847 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5848 $ECHO "*** not find such a program. So, this module is probably useless."
5849 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
drh71eb93e2001-09-28 01:34:43 +00005850 fi
5851 if test "$build_old_libs" = no; then
a.rottmann62507b62003-03-24 09:40:34 +00005852 build_libtool_libs=module
5853 build_old_libs=yes
drh71eb93e2001-09-28 01:34:43 +00005854 else
a.rottmann62507b62003-03-24 09:40:34 +00005855 build_libtool_libs=no
drh71eb93e2001-09-28 01:34:43 +00005856 fi
5857 fi
5858 else
drh71eb93e2001-09-28 01:34:43 +00005859 deplibs="$dir/$old_library $deplibs"
5860 link_static=yes
5861 fi
5862 fi # link shared/static library?
5863
a.rottmann964dbb12004-02-26 19:47:42 +00005864 if test "$linkmode" = lib; then
drh71eb93e2001-09-28 01:34:43 +00005865 if test -n "$dependency_libs" &&
vapier7f19c022007-02-17 14:46:31 +00005866 { test "$hardcode_into_libs" != yes ||
5867 test "$build_old_libs" = yes ||
a.rottmann964dbb12004-02-26 19:47:42 +00005868 test "$link_static" = yes; }; then
drh71eb93e2001-09-28 01:34:43 +00005869 # Extract -R from dependency_libs
5870 temp_deplibs=
5871 for libdir in $dependency_libs; do
5872 case $libdir in
mlcreech636a9952008-05-05 22:52:56 +00005873 -R*) func_stripname '-R' '' "$libdir"
5874 temp_xrpath=$func_stripname_result
drh71eb93e2001-09-28 01:34:43 +00005875 case " $xrpath " in
5876 *" $temp_xrpath "*) ;;
5877 *) xrpath="$xrpath $temp_xrpath";;
5878 esac;;
5879 *) temp_deplibs="$temp_deplibs $libdir";;
5880 esac
5881 done
5882 dependency_libs="$temp_deplibs"
5883 fi
5884
5885 newlib_search_path="$newlib_search_path $absdir"
5886 # Link against this library
5887 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
5888 # ... and its dependency_libs
5889 tmp_libs=
5890 for deplib in $dependency_libs; do
5891 newdependency_libs="$deplib $newdependency_libs"
mlcreech636a9952008-05-05 22:52:56 +00005892 if $opt_duplicate_deps ; then
a.rottmann62507b62003-03-24 09:40:34 +00005893 case "$tmp_libs " in
5894 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
5895 esac
5896 fi
drh71eb93e2001-09-28 01:34:43 +00005897 tmp_libs="$tmp_libs $deplib"
5898 done
5899
a.rottmann964dbb12004-02-26 19:47:42 +00005900 if test "$link_all_deplibs" != no; then
drh71eb93e2001-09-28 01:34:43 +00005901 # Add the search paths of all dependency libraries
5902 for deplib in $dependency_libs; do
5903 case $deplib in
5904 -L*) path="$deplib" ;;
5905 *.la)
mlcreech636a9952008-05-05 22:52:56 +00005906 func_dirname "$deplib" "" "."
5907 dir="$func_dirname_result"
drh71eb93e2001-09-28 01:34:43 +00005908 # We need an absolute path.
5909 case $dir in
5910 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
5911 *)
5912 absdir=`cd "$dir" && pwd`
5913 if test -z "$absdir"; then
mlcreech636a9952008-05-05 22:52:56 +00005914 func_warning "cannot determine absolute directory name of \`$dir'"
drh71eb93e2001-09-28 01:34:43 +00005915 absdir="$dir"
5916 fi
5917 ;;
5918 esac
mlcreech636a9952008-05-05 22:52:56 +00005919 if $GREP "^installed=no" $deplib > /dev/null; then
a.rottmann964dbb12004-02-26 19:47:42 +00005920 case $host in
5921 *-*-darwin*)
mlcreech636a9952008-05-05 22:52:56 +00005922 depdepl=
a.rottmann964dbb12004-02-26 19:47:42 +00005923 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
5924 if test -n "$deplibrary_names" ; then
5925 for tmp in $deplibrary_names ; do
5926 depdepl=$tmp
5927 done
mlcreech636a9952008-05-05 22:52:56 +00005928 if test -f "$absdir/$objdir/$depdepl" ; then
5929 depdepl="$absdir/$objdir/$depdepl"
5930 darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5931 if test -z "$darwin_install_name"; then
5932 darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
5933 fi
5934 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
5935 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
5936 path=
vapier7f19c022007-02-17 14:46:31 +00005937 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005938 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005939 ;;
5940 *)
mlcreech636a9952008-05-05 22:52:56 +00005941 path="-L$absdir/$objdir"
vapier7f19c022007-02-17 14:46:31 +00005942 ;;
5943 esac
mlcreech636a9952008-05-05 22:52:56 +00005944 else
5945 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5946 test -z "$libdir" && \
5947 func_fatal_error "\`$deplib' is not a valid libtool archive"
5948 test "$absdir" != "$libdir" && \
5949 func_warning "\`$deplib' seems to be moved"
5950
5951 path="-L$absdir"
5952 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005953 ;;
drh71eb93e2001-09-28 01:34:43 +00005954 esac
5955 case " $deplibs " in
5956 *" $path "*) ;;
vapier7f19c022007-02-17 14:46:31 +00005957 *) deplibs="$path $deplibs" ;;
5958 esac
drh71eb93e2001-09-28 01:34:43 +00005959 done
5960 fi # link_all_deplibs != no
5961 fi # linkmode = lib
5962 done # for deplib in $libs
mlcreech636a9952008-05-05 22:52:56 +00005963 if test "$pass" = link; then
5964 if test "$linkmode" = "prog"; then
5965 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
5966 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
5967 else
5968 compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5969 fi
5970 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005971 dependency_libs="$newdependency_libs"
5972 if test "$pass" = dlpreopen; then
drh71eb93e2001-09-28 01:34:43 +00005973 # Link the dlpreopened libraries before other libraries
5974 for deplib in $save_deplibs; do
5975 deplibs="$deplib $deplibs"
5976 done
5977 fi
a.rottmann964dbb12004-02-26 19:47:42 +00005978 if test "$pass" != dlopen; then
5979 if test "$pass" != conv; then
drh71eb93e2001-09-28 01:34:43 +00005980 # Make sure lib_search_path contains only unique directories.
5981 lib_search_path=
5982 for dir in $newlib_search_path; do
5983 case "$lib_search_path " in
5984 *" $dir "*) ;;
5985 *) lib_search_path="$lib_search_path $dir" ;;
5986 esac
5987 done
5988 newlib_search_path=
5989 fi
5990
5991 if test "$linkmode,$pass" != "prog,link"; then
5992 vars="deplibs"
5993 else
5994 vars="compile_deplibs finalize_deplibs"
5995 fi
5996 for var in $vars dependency_libs; do
5997 # Add libraries to $var in reverse order
5998 eval tmp_libs=\"\$$var\"
5999 new_libs=
6000 for deplib in $tmp_libs; do
a.rottmann964dbb12004-02-26 19:47:42 +00006001 # FIXME: Pedantically, this is the right thing to do, so
6002 # that some nasty dependency loop isn't accidentally
6003 # broken:
6004 #new_libs="$deplib $new_libs"
6005 # Pragmatically, this seems to cause very few problems in
6006 # practice:
drh71eb93e2001-09-28 01:34:43 +00006007 case $deplib in
a.rottmann62507b62003-03-24 09:40:34 +00006008 -L*) new_libs="$deplib $new_libs" ;;
a.rottmann964dbb12004-02-26 19:47:42 +00006009 -R*) ;;
a.rottmann62507b62003-03-24 09:40:34 +00006010 *)
a.rottmann964dbb12004-02-26 19:47:42 +00006011 # And here is the reason: when a library appears more
6012 # than once as an explicit dependence of a library, or
6013 # is implicitly linked in more than once by the
6014 # compiler, it is considered special, and multiple
6015 # occurrences thereof are not removed. Compare this
6016 # with having the same library being listed as a
6017 # dependency of multiple other libraries: in this case,
6018 # we know (pedantically, we assume) the library does not
6019 # need to be listed more than once, so we keep only the
6020 # last copy. This is not always right, but it is rare
6021 # enough that we require users that really mean to play
6022 # such unportable linking tricks to link the library
6023 # using -Wl,-lname, so that libtool does not consider it
6024 # for duplicate removal.
a.rottmann62507b62003-03-24 09:40:34 +00006025 case " $specialdeplibs " in
6026 *" $deplib "*) new_libs="$deplib $new_libs" ;;
6027 *)
6028 case " $new_libs " in
6029 *" $deplib "*) ;;
6030 *) new_libs="$deplib $new_libs" ;;
6031 esac
6032 ;;
6033 esac
6034 ;;
6035 esac
drh71eb93e2001-09-28 01:34:43 +00006036 done
6037 tmp_libs=
6038 for deplib in $new_libs; do
6039 case $deplib in
6040 -L*)
6041 case " $tmp_libs " in
6042 *" $deplib "*) ;;
6043 *) tmp_libs="$tmp_libs $deplib" ;;
6044 esac
6045 ;;
6046 *) tmp_libs="$tmp_libs $deplib" ;;
6047 esac
6048 done
6049 eval $var=\"$tmp_libs\"
6050 done # for var
6051 fi
vapier7f19c022007-02-17 14:46:31 +00006052 # Last step: remove runtime libs from dependency_libs
6053 # (they stay in deplibs)
a.rottmann964dbb12004-02-26 19:47:42 +00006054 tmp_libs=
6055 for i in $dependency_libs ; do
6056 case " $predeps $postdeps $compiler_lib_search_path " in
6057 *" $i "*)
6058 i=""
6059 ;;
6060 esac
6061 if test -n "$i" ; then
6062 tmp_libs="$tmp_libs $i"
6063 fi
6064 done
6065 dependency_libs=$tmp_libs
drh71eb93e2001-09-28 01:34:43 +00006066 done # for pass
a.rottmann964dbb12004-02-26 19:47:42 +00006067 if test "$linkmode" = prog; then
drh71eb93e2001-09-28 01:34:43 +00006068 dlfiles="$newdlfiles"
mlcreech636a9952008-05-05 22:52:56 +00006069 fi
6070 if test "$linkmode" = prog || test "$linkmode" = lib; then
drh71eb93e2001-09-28 01:34:43 +00006071 dlprefiles="$newdlprefiles"
6072 fi
6073
6074 case $linkmode in
6075 oldlib)
drh71eb93e2001-09-28 01:34:43 +00006076 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
mlcreech636a9952008-05-05 22:52:56 +00006077 func_warning "\`-dlopen' is ignored for archives"
drh71eb93e2001-09-28 01:34:43 +00006078 fi
6079
mlcreech636a9952008-05-05 22:52:56 +00006080 case " $deplibs" in
6081 *\ -l* | *\ -L*)
6082 func_warning "\`-l' and \`-L' are ignored for archives" ;;
6083 esac
drh71eb93e2001-09-28 01:34:43 +00006084
mlcreech636a9952008-05-05 22:52:56 +00006085 test -n "$rpath" && \
6086 func_warning "\`-rpath' is ignored for archives"
drh71eb93e2001-09-28 01:34:43 +00006087
mlcreech636a9952008-05-05 22:52:56 +00006088 test -n "$xrpath" && \
6089 func_warning "\`-R' is ignored for archives"
drh71eb93e2001-09-28 01:34:43 +00006090
mlcreech636a9952008-05-05 22:52:56 +00006091 test -n "$vinfo" && \
6092 func_warning "\`-version-info/-version-number' is ignored for archives"
drh71eb93e2001-09-28 01:34:43 +00006093
mlcreech636a9952008-05-05 22:52:56 +00006094 test -n "$release" && \
6095 func_warning "\`-release' is ignored for archives"
6096
6097 test -n "$export_symbols$export_symbols_regex" && \
6098 func_warning "\`-export-symbols' is ignored for archives"
drh71eb93e2001-09-28 01:34:43 +00006099
6100 # Now set the variables for building old libraries.
6101 build_libtool_libs=no
6102 oldlibs="$output"
6103 objs="$objs$old_deplibs"
6104 ;;
6105
6106 lib)
6107 # Make sure we only generate libraries of the form `libNAME.la'.
6108 case $outputname in
6109 lib*)
mlcreech636a9952008-05-05 22:52:56 +00006110 func_stripname 'lib' '.la' "$outputname"
6111 name=$func_stripname_result
vapier7f19c022007-02-17 14:46:31 +00006112 eval shared_ext=\"$shrext_cmds\"
drh71eb93e2001-09-28 01:34:43 +00006113 eval libname=\"$libname_spec\"
6114 ;;
6115 *)
mlcreech636a9952008-05-05 22:52:56 +00006116 test "$module" = no && \
6117 func_fatal_help "libtool library \`$output' must begin with \`lib'"
6118
drh71eb93e2001-09-28 01:34:43 +00006119 if test "$need_lib_prefix" != no; then
6120 # Add the "lib" prefix for modules if required
mlcreech636a9952008-05-05 22:52:56 +00006121 func_stripname '' '.la' "$outputname"
6122 name=$func_stripname_result
vapier7f19c022007-02-17 14:46:31 +00006123 eval shared_ext=\"$shrext_cmds\"
drh71eb93e2001-09-28 01:34:43 +00006124 eval libname=\"$libname_spec\"
6125 else
mlcreech636a9952008-05-05 22:52:56 +00006126 func_stripname '' '.la' "$outputname"
6127 libname=$func_stripname_result
drh71eb93e2001-09-28 01:34:43 +00006128 fi
6129 ;;
6130 esac
6131
6132 if test -n "$objs"; then
6133 if test "$deplibs_check_method" != pass_all; then
mlcreech636a9952008-05-05 22:52:56 +00006134 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
drh71eb93e2001-09-28 01:34:43 +00006135 else
mlcreech636a9952008-05-05 22:52:56 +00006136 $ECHO
6137 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
6138 $ECHO "*** objects $objs is not portable!"
drh71eb93e2001-09-28 01:34:43 +00006139 libobjs="$libobjs $objs"
6140 fi
6141 fi
6142
mlcreech636a9952008-05-05 22:52:56 +00006143 test "$dlself" != no && \
6144 func_warning "\`-dlopen self' is ignored for libtool libraries"
drh71eb93e2001-09-28 01:34:43 +00006145
6146 set dummy $rpath
mlcreech636a9952008-05-05 22:52:56 +00006147 shift
6148 test "$#" -gt 1 && \
6149 func_warning "ignoring multiple \`-rpath's for a libtool library"
6150
6151 install_libdir="$1"
drh71eb93e2001-09-28 01:34:43 +00006152
6153 oldlibs=
6154 if test -z "$rpath"; then
6155 if test "$build_libtool_libs" = yes; then
6156 # Building a libtool convenience library.
a.rottmann964dbb12004-02-26 19:47:42 +00006157 # Some compilers have problems with a `.al' extension so
6158 # convenience libraries should have the same extension an
6159 # archive normally would.
drh71eb93e2001-09-28 01:34:43 +00006160 oldlibs="$output_objdir/$libname.$libext $oldlibs"
6161 build_libtool_libs=convenience
6162 build_old_libs=yes
6163 fi
6164
mlcreech636a9952008-05-05 22:52:56 +00006165 test -n "$vinfo" && \
6166 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
drh71eb93e2001-09-28 01:34:43 +00006167
mlcreech636a9952008-05-05 22:52:56 +00006168 test -n "$release" && \
6169 func_warning "\`-release' is ignored for convenience libraries"
drh71eb93e2001-09-28 01:34:43 +00006170 else
6171
6172 # Parse the version information argument.
a.rottmann62507b62003-03-24 09:40:34 +00006173 save_ifs="$IFS"; IFS=':'
drh71eb93e2001-09-28 01:34:43 +00006174 set dummy $vinfo 0 0 0
mlcreech636a9952008-05-05 22:52:56 +00006175 shift
drh71eb93e2001-09-28 01:34:43 +00006176 IFS="$save_ifs"
6177
mlcreech636a9952008-05-05 22:52:56 +00006178 test -n "$7" && \
6179 func_fatal_help "too many parameters to \`-version-info'"
drh71eb93e2001-09-28 01:34:43 +00006180
a.rottmann964dbb12004-02-26 19:47:42 +00006181 # convert absolute version numbers to libtool ages
6182 # this retains compatibility with .la files and attempts
6183 # to make the code below a bit more comprehensible
vapier7f19c022007-02-17 14:46:31 +00006184
a.rottmann964dbb12004-02-26 19:47:42 +00006185 case $vinfo_number in
6186 yes)
mlcreech636a9952008-05-05 22:52:56 +00006187 number_major="$1"
6188 number_minor="$2"
6189 number_revision="$3"
a.rottmann964dbb12004-02-26 19:47:42 +00006190 #
6191 # There are really only two kinds -- those that
6192 # use the current revision as the major version
6193 # and those that subtract age and use age as
6194 # a minor version. But, then there is irix
6195 # which has an extra 1 added just for fun
6196 #
6197 case $version_type in
mlcreech636a9952008-05-05 22:52:56 +00006198 darwin|linux|osf|windows|none)
6199 func_arith $number_major + $number_minor
6200 current=$func_arith_result
a.rottmann964dbb12004-02-26 19:47:42 +00006201 age="$number_minor"
6202 revision="$number_revision"
6203 ;;
6204 freebsd-aout|freebsd-elf|sunos)
6205 current="$number_major"
6206 revision="$number_minor"
6207 age="0"
6208 ;;
6209 irix|nonstopux)
mlcreech636a9952008-05-05 22:52:56 +00006210 func_arith $number_major + $number_minor
6211 current=$func_arith_result
a.rottmann964dbb12004-02-26 19:47:42 +00006212 age="$number_minor"
6213 revision="$number_minor"
mlcreech636a9952008-05-05 22:52:56 +00006214 lt_irix_increment=no
a.rottmann964dbb12004-02-26 19:47:42 +00006215 ;;
6216 esac
6217 ;;
6218 no)
mlcreech636a9952008-05-05 22:52:56 +00006219 current="$1"
6220 revision="$2"
6221 age="$3"
a.rottmann964dbb12004-02-26 19:47:42 +00006222 ;;
6223 esac
drh71eb93e2001-09-28 01:34:43 +00006224
6225 # Check that each of the things are valid numbers.
6226 case $current in
vapier7f19c022007-02-17 14:46:31 +00006227 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]) ;;
drh71eb93e2001-09-28 01:34:43 +00006228 *)
mlcreech636a9952008-05-05 22:52:56 +00006229 func_error "CURRENT \`$current' must be a nonnegative integer"
6230 func_fatal_error "\`$vinfo' is not valid version information"
drh71eb93e2001-09-28 01:34:43 +00006231 ;;
6232 esac
6233
6234 case $revision in
vapier7f19c022007-02-17 14:46:31 +00006235 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]) ;;
drh71eb93e2001-09-28 01:34:43 +00006236 *)
mlcreech636a9952008-05-05 22:52:56 +00006237 func_error "REVISION \`$revision' must be a nonnegative integer"
6238 func_fatal_error "\`$vinfo' is not valid version information"
drh71eb93e2001-09-28 01:34:43 +00006239 ;;
6240 esac
6241
6242 case $age in
vapier7f19c022007-02-17 14:46:31 +00006243 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]) ;;
drh71eb93e2001-09-28 01:34:43 +00006244 *)
mlcreech636a9952008-05-05 22:52:56 +00006245 func_error "AGE \`$age' must be a nonnegative integer"
6246 func_fatal_error "\`$vinfo' is not valid version information"
drh71eb93e2001-09-28 01:34:43 +00006247 ;;
6248 esac
6249
a.rottmann964dbb12004-02-26 19:47:42 +00006250 if test "$age" -gt "$current"; then
mlcreech636a9952008-05-05 22:52:56 +00006251 func_error "AGE \`$age' is greater than the current interface number \`$current'"
6252 func_fatal_error "\`$vinfo' is not valid version information"
drh71eb93e2001-09-28 01:34:43 +00006253 fi
6254
6255 # Calculate the version variables.
6256 major=
6257 versuffix=
6258 verstring=
6259 case $version_type in
6260 none) ;;
6261
6262 darwin)
6263 # Like Linux, but with the current version available in
6264 # verstring for coding it into the library header
mlcreech636a9952008-05-05 22:52:56 +00006265 func_arith $current - $age
6266 major=.$func_arith_result
drh71eb93e2001-09-28 01:34:43 +00006267 versuffix="$major.$age.$revision"
6268 # Darwin ld doesn't like 0 for these options...
mlcreech636a9952008-05-05 22:52:56 +00006269 func_arith $current + 1
6270 minor_current=$func_arith_result
6271 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
6272 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
drh71eb93e2001-09-28 01:34:43 +00006273 ;;
6274
6275 freebsd-aout)
6276 major=".$current"
6277 versuffix=".$current.$revision";
6278 ;;
6279
6280 freebsd-elf)
6281 major=".$current"
mlcreech636a9952008-05-05 22:52:56 +00006282 versuffix=".$current"
drh71eb93e2001-09-28 01:34:43 +00006283 ;;
6284
a.rottmann62507b62003-03-24 09:40:34 +00006285 irix | nonstopux)
mlcreech636a9952008-05-05 22:52:56 +00006286 if test "X$lt_irix_increment" = "Xno"; then
6287 func_arith $current - $age
6288 else
6289 func_arith $current - $age + 1
6290 fi
6291 major=$func_arith_result
a.rottmann62507b62003-03-24 09:40:34 +00006292
6293 case $version_type in
6294 nonstopux) verstring_prefix=nonstopux ;;
6295 *) verstring_prefix=sgi ;;
6296 esac
6297 verstring="$verstring_prefix$major.$revision"
drh71eb93e2001-09-28 01:34:43 +00006298
6299 # Add in all the interfaces that we are compatible with.
6300 loop=$revision
a.rottmann964dbb12004-02-26 19:47:42 +00006301 while test "$loop" -ne 0; do
mlcreech636a9952008-05-05 22:52:56 +00006302 func_arith $revision - $loop
6303 iface=$func_arith_result
6304 func_arith $loop - 1
6305 loop=$func_arith_result
a.rottmann62507b62003-03-24 09:40:34 +00006306 verstring="$verstring_prefix$major.$iface:$verstring"
drh71eb93e2001-09-28 01:34:43 +00006307 done
6308
6309 # Before this point, $major must not contain `.'.
6310 major=.$major
6311 versuffix="$major.$revision"
6312 ;;
6313
6314 linux)
mlcreech636a9952008-05-05 22:52:56 +00006315 func_arith $current - $age
6316 major=.$func_arith_result
drh71eb93e2001-09-28 01:34:43 +00006317 versuffix="$major.$age.$revision"
6318 ;;
6319
6320 osf)
mlcreech636a9952008-05-05 22:52:56 +00006321 func_arith $current - $age
6322 major=.$func_arith_result
drh71eb93e2001-09-28 01:34:43 +00006323 versuffix=".$current.$age.$revision"
6324 verstring="$current.$age.$revision"
6325
6326 # Add in all the interfaces that we are compatible with.
6327 loop=$age
a.rottmann964dbb12004-02-26 19:47:42 +00006328 while test "$loop" -ne 0; do
mlcreech636a9952008-05-05 22:52:56 +00006329 func_arith $current - $loop
6330 iface=$func_arith_result
6331 func_arith $loop - 1
6332 loop=$func_arith_result
drh71eb93e2001-09-28 01:34:43 +00006333 verstring="$verstring:${iface}.0"
6334 done
6335
6336 # Make executables depend on our current version.
6337 verstring="$verstring:${current}.0"
6338 ;;
6339
mlcreech636a9952008-05-05 22:52:56 +00006340 qnx)
6341 major=".$current"
6342 versuffix=".$current"
6343 ;;
6344
drh71eb93e2001-09-28 01:34:43 +00006345 sunos)
6346 major=".$current"
6347 versuffix=".$current.$revision"
6348 ;;
6349
6350 windows)
6351 # Use '-' rather than '.', since we only want one
6352 # extension on DOS 8.3 filesystems.
mlcreech636a9952008-05-05 22:52:56 +00006353 func_arith $current - $age
6354 major=$func_arith_result
drh71eb93e2001-09-28 01:34:43 +00006355 versuffix="-$major"
6356 ;;
6357
6358 *)
mlcreech636a9952008-05-05 22:52:56 +00006359 func_fatal_configuration "unknown library version type \`$version_type'"
drh71eb93e2001-09-28 01:34:43 +00006360 ;;
6361 esac
6362
6363 # Clear the version info if we defaulted, and they specified a release.
6364 if test -z "$vinfo" && test -n "$release"; then
6365 major=
a.rottmann62507b62003-03-24 09:40:34 +00006366 case $version_type in
6367 darwin)
6368 # we can't check for "0.0" in archive_cmds due to quoting
6369 # problems, so we reset it completely
a.rottmann964dbb12004-02-26 19:47:42 +00006370 verstring=
a.rottmann62507b62003-03-24 09:40:34 +00006371 ;;
6372 *)
6373 verstring="0.0"
6374 ;;
6375 esac
drh71eb93e2001-09-28 01:34:43 +00006376 if test "$need_version" = no; then
6377 versuffix=
6378 else
6379 versuffix=".0.0"
6380 fi
6381 fi
6382
6383 # Remove version info from name if versioning should be avoided
6384 if test "$avoid_version" = yes && test "$need_version" = no; then
6385 major=
6386 versuffix=
6387 verstring=""
6388 fi
6389
6390 # Check to see if the archive will have undefined symbols.
6391 if test "$allow_undefined" = yes; then
6392 if test "$allow_undefined_flag" = unsupported; then
mlcreech636a9952008-05-05 22:52:56 +00006393 func_warning "undefined symbols not allowed in $host shared libraries"
drh71eb93e2001-09-28 01:34:43 +00006394 build_libtool_libs=no
6395 build_old_libs=yes
6396 fi
6397 else
6398 # Don't allow undefined symbols.
6399 allow_undefined_flag="$no_undefined_flag"
6400 fi
mlcreech636a9952008-05-05 22:52:56 +00006401
drh71eb93e2001-09-28 01:34:43 +00006402 fi
6403
mlcreech636a9952008-05-05 22:52:56 +00006404 func_generate_dlsyms "$libname" "$libname" "yes"
6405 libobjs="$libobjs $symfileobj"
6406 test "X$libobjs" = "X " && libobjs=
6407
drh71eb93e2001-09-28 01:34:43 +00006408 if test "$mode" != relink; then
a.rottmann964dbb12004-02-26 19:47:42 +00006409 # Remove our outputs, but don't remove object files since they
6410 # may have been created when compiling PIC objects.
6411 removelist=
mlcreech636a9952008-05-05 22:52:56 +00006412 tempremovelist=`$ECHO "$output_objdir/*"`
a.rottmann964dbb12004-02-26 19:47:42 +00006413 for p in $tempremovelist; do
6414 case $p in
vapier6acb2cf2009-01-28 04:46:28 +00006415 *.$objext | *.gcno)
a.rottmann964dbb12004-02-26 19:47:42 +00006416 ;;
6417 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
vapier7f19c022007-02-17 14:46:31 +00006418 if test "X$precious_files_regex" != "X"; then
mlcreech636a9952008-05-05 22:52:56 +00006419 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
6420 then
vapier7f19c022007-02-17 14:46:31 +00006421 continue
6422 fi
a.rottmann964dbb12004-02-26 19:47:42 +00006423 fi
6424 removelist="$removelist $p"
6425 ;;
6426 *) ;;
6427 esac
6428 done
mlcreech636a9952008-05-05 22:52:56 +00006429 test -n "$removelist" && \
6430 func_show_eval "${RM}r \$removelist"
drh71eb93e2001-09-28 01:34:43 +00006431 fi
6432
6433 # Now set the variables for building old libraries.
6434 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
6435 oldlibs="$oldlibs $output_objdir/$libname.$libext"
6436
6437 # Transform .lo files to .o files.
mlcreech636a9952008-05-05 22:52:56 +00006438 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
drh71eb93e2001-09-28 01:34:43 +00006439 fi
6440
6441 # Eliminate all temporary directories.
mlcreech636a9952008-05-05 22:52:56 +00006442 #for path in $notinst_path; do
6443 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
6444 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
6445 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
6446 #done
drh71eb93e2001-09-28 01:34:43 +00006447
6448 if test -n "$xrpath"; then
6449 # If the user specified any rpath flags, then add them.
6450 temp_xrpath=
6451 for libdir in $xrpath; do
6452 temp_xrpath="$temp_xrpath -R$libdir"
6453 case "$finalize_rpath " in
6454 *" $libdir "*) ;;
6455 *) finalize_rpath="$finalize_rpath $libdir" ;;
6456 esac
6457 done
a.rottmann964dbb12004-02-26 19:47:42 +00006458 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
drh71eb93e2001-09-28 01:34:43 +00006459 dependency_libs="$temp_xrpath $dependency_libs"
6460 fi
6461 fi
6462
6463 # Make sure dlfiles contains only unique files that won't be dlpreopened
6464 old_dlfiles="$dlfiles"
6465 dlfiles=
6466 for lib in $old_dlfiles; do
6467 case " $dlprefiles $dlfiles " in
6468 *" $lib "*) ;;
6469 *) dlfiles="$dlfiles $lib" ;;
6470 esac
6471 done
6472
6473 # Make sure dlprefiles contains only unique files
6474 old_dlprefiles="$dlprefiles"
6475 dlprefiles=
6476 for lib in $old_dlprefiles; do
6477 case "$dlprefiles " in
6478 *" $lib "*) ;;
6479 *) dlprefiles="$dlprefiles $lib" ;;
6480 esac
6481 done
6482
6483 if test "$build_libtool_libs" = yes; then
6484 if test -n "$rpath"; then
6485 case $host in
vapier6acb2cf2009-01-28 04:46:28 +00006486 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
drh71eb93e2001-09-28 01:34:43 +00006487 # these systems don't actually have a c library (as such)!
6488 ;;
6489 *-*-rhapsody* | *-*-darwin1.[012])
6490 # Rhapsody C library is in the System framework
mlcreech636a9952008-05-05 22:52:56 +00006491 deplibs="$deplibs System.ltframework"
drh71eb93e2001-09-28 01:34:43 +00006492 ;;
6493 *-*-netbsd*)
6494 # Don't link with libc until the a.out ld.so is fixed.
6495 ;;
vapier7f19c022007-02-17 14:46:31 +00006496 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
a.rottmann62507b62003-03-24 09:40:34 +00006497 # Do not include libc due to us having libc/libc_r.
vapier7f19c022007-02-17 14:46:31 +00006498 ;;
6499 *-*-sco3.2v5* | *-*-sco5v6*)
6500 # Causes problems with __ctype
6501 ;;
6502 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
6503 # Compiler inserts libc in the correct place for threads to work
a.rottmann62507b62003-03-24 09:40:34 +00006504 ;;
mlcreech636a9952008-05-05 22:52:56 +00006505 *)
drh71eb93e2001-09-28 01:34:43 +00006506 # Add libc to deplibs on all other systems if necessary.
a.rottmann964dbb12004-02-26 19:47:42 +00006507 if test "$build_libtool_need_lc" = "yes"; then
drh71eb93e2001-09-28 01:34:43 +00006508 deplibs="$deplibs -lc"
6509 fi
6510 ;;
6511 esac
6512 fi
6513
6514 # Transform deplibs into only deplibs that can be linked in shared.
6515 name_save=$name
6516 libname_save=$libname
6517 release_save=$release
6518 versuffix_save=$versuffix
6519 major_save=$major
6520 # I'm not sure if I'm treating the release correctly. I think
6521 # release should show up in the -l (ie -lgmp5) so we don't want to
6522 # add it in twice. Is that correct?
6523 release=""
6524 versuffix=""
6525 major=""
6526 newdeplibs=
6527 droppeddeps=no
6528 case $deplibs_check_method in
6529 pass_all)
6530 # Don't check for shared/static. Everything works.
6531 # This might be a little naive. We might want to check
6532 # whether the library exists or not. But this is on
6533 # osf3 & osf4 and I'm not really sure... Just
a.rottmann964dbb12004-02-26 19:47:42 +00006534 # implementing what was already the behavior.
drh71eb93e2001-09-28 01:34:43 +00006535 newdeplibs=$deplibs
6536 ;;
6537 test_compile)
6538 # This code stresses the "libraries are programs" paradigm to its
6539 # limits. Maybe even breaks it. We compile a program, linking it
6540 # against the deplibs as a proxy for the library. Then we can check
6541 # whether they linked in statically or dynamically with ldd.
mlcreech636a9952008-05-05 22:52:56 +00006542 $opt_dry_run || $RM conftest.c
drh71eb93e2001-09-28 01:34:43 +00006543 cat > conftest.c <<EOF
6544 int main() { return 0; }
6545EOF
mlcreech636a9952008-05-05 22:52:56 +00006546 $opt_dry_run || $RM conftest
6547 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
drh71eb93e2001-09-28 01:34:43 +00006548 ldd_output=`ldd conftest`
6549 for i in $deplibs; do
mlcreech636a9952008-05-05 22:52:56 +00006550 case $i in
6551 -l*)
6552 func_stripname -l '' "$i"
6553 name=$func_stripname_result
a.rottmann964dbb12004-02-26 19:47:42 +00006554 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6555 case " $predeps $postdeps " in
6556 *" $i "*)
6557 newdeplibs="$newdeplibs $i"
6558 i=""
6559 ;;
6560 esac
mlcreech636a9952008-05-05 22:52:56 +00006561 fi
a.rottmann964dbb12004-02-26 19:47:42 +00006562 if test -n "$i" ; then
mlcreech636a9952008-05-05 22:52:56 +00006563 libname=`eval "\\$ECHO \"$libname_spec\""`
6564 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6565 set dummy $deplib_matches; shift
6566 deplib_match=$1
drh71eb93e2001-09-28 01:34:43 +00006567 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6568 newdeplibs="$newdeplibs $i"
6569 else
6570 droppeddeps=yes
mlcreech636a9952008-05-05 22:52:56 +00006571 $ECHO
6572 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6573 $ECHO "*** I have the capability to make that library automatically link in when"
6574 $ECHO "*** you link to this library. But I can only do this if you have a"
6575 $ECHO "*** shared version of the library, which I believe you do not have"
6576 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
6577 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
a.rottmann964dbb12004-02-26 19:47:42 +00006578 fi
6579 fi
mlcreech636a9952008-05-05 22:52:56 +00006580 ;;
6581 *)
a.rottmann964dbb12004-02-26 19:47:42 +00006582 newdeplibs="$newdeplibs $i"
mlcreech636a9952008-05-05 22:52:56 +00006583 ;;
6584 esac
a.rottmann964dbb12004-02-26 19:47:42 +00006585 done
6586 else
6587 # Error occurred in the first compile. Let's try to salvage
6588 # the situation: Compile a separate program for each library.
6589 for i in $deplibs; do
mlcreech636a9952008-05-05 22:52:56 +00006590 case $i in
6591 -l*)
6592 func_stripname -l '' "$i"
6593 name=$func_stripname_result
6594 $opt_dry_run || $RM conftest
6595 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
a.rottmann964dbb12004-02-26 19:47:42 +00006596 ldd_output=`ldd conftest`
6597 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6598 case " $predeps $postdeps " in
6599 *" $i "*)
6600 newdeplibs="$newdeplibs $i"
6601 i=""
6602 ;;
6603 esac
6604 fi
6605 if test -n "$i" ; then
mlcreech636a9952008-05-05 22:52:56 +00006606 libname=`eval "\\$ECHO \"$libname_spec\""`
6607 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
6608 set dummy $deplib_matches; shift
6609 deplib_match=$1
a.rottmann964dbb12004-02-26 19:47:42 +00006610 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
6611 newdeplibs="$newdeplibs $i"
6612 else
6613 droppeddeps=yes
mlcreech636a9952008-05-05 22:52:56 +00006614 $ECHO
6615 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
6616 $ECHO "*** I have the capability to make that library automatically link in when"
6617 $ECHO "*** you link to this library. But I can only do this if you have a"
6618 $ECHO "*** shared version of the library, which you do not appear to have"
6619 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
6620 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
a.rottmann964dbb12004-02-26 19:47:42 +00006621 fi
drh71eb93e2001-09-28 01:34:43 +00006622 fi
6623 else
6624 droppeddeps=yes
mlcreech636a9952008-05-05 22:52:56 +00006625 $ECHO
6626 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
6627 $ECHO "*** make it link in! You will probably need to install it or some"
6628 $ECHO "*** library that it depends on before this library will be fully"
6629 $ECHO "*** functional. Installing it before continuing would be even better."
drh71eb93e2001-09-28 01:34:43 +00006630 fi
mlcreech636a9952008-05-05 22:52:56 +00006631 ;;
6632 *)
drh71eb93e2001-09-28 01:34:43 +00006633 newdeplibs="$newdeplibs $i"
mlcreech636a9952008-05-05 22:52:56 +00006634 ;;
6635 esac
drh71eb93e2001-09-28 01:34:43 +00006636 done
6637 fi
6638 ;;
6639 file_magic*)
mlcreech636a9952008-05-05 22:52:56 +00006640 set dummy $deplibs_check_method; shift
6641 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
drh71eb93e2001-09-28 01:34:43 +00006642 for a_deplib in $deplibs; do
mlcreech636a9952008-05-05 22:52:56 +00006643 case $a_deplib in
6644 -l*)
6645 func_stripname -l '' "$a_deplib"
6646 name=$func_stripname_result
a.rottmann964dbb12004-02-26 19:47:42 +00006647 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6648 case " $predeps $postdeps " in
6649 *" $a_deplib "*)
6650 newdeplibs="$newdeplibs $a_deplib"
6651 a_deplib=""
6652 ;;
6653 esac
6654 fi
6655 if test -n "$a_deplib" ; then
mlcreech636a9952008-05-05 22:52:56 +00006656 libname=`eval "\\$ECHO \"$libname_spec\""`
a.rottmann964dbb12004-02-26 19:47:42 +00006657 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6658 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6659 for potent_lib in $potential_libs; do
drh71eb93e2001-09-28 01:34:43 +00006660 # Follow soft links.
mlcreech636a9952008-05-05 22:52:56 +00006661 if ls -lLd "$potent_lib" 2>/dev/null |
6662 $GREP " -> " >/dev/null; then
drh71eb93e2001-09-28 01:34:43 +00006663 continue
6664 fi
6665 # The statement above tries to avoid entering an
6666 # endless loop below, in case of cyclic links.
6667 # We might still enter an endless loop, since a link
6668 # loop can be closed while we follow links,
6669 # but so what?
6670 potlib="$potent_lib"
6671 while test -h "$potlib" 2>/dev/null; do
a.rottmann62507b62003-03-24 09:40:34 +00006672 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
drh71eb93e2001-09-28 01:34:43 +00006673 case $potliblink in
6674 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
mlcreech636a9952008-05-05 22:52:56 +00006675 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
drh71eb93e2001-09-28 01:34:43 +00006676 esac
6677 done
mlcreech636a9952008-05-05 22:52:56 +00006678 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
6679 $SED -e 10q |
6680 $EGREP "$file_magic_regex" > /dev/null; then
drh71eb93e2001-09-28 01:34:43 +00006681 newdeplibs="$newdeplibs $a_deplib"
6682 a_deplib=""
6683 break 2
6684 fi
a.rottmann964dbb12004-02-26 19:47:42 +00006685 done
6686 done
6687 fi
drh71eb93e2001-09-28 01:34:43 +00006688 if test -n "$a_deplib" ; then
6689 droppeddeps=yes
mlcreech636a9952008-05-05 22:52:56 +00006690 $ECHO
6691 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6692 $ECHO "*** I have the capability to make that library automatically link in when"
6693 $ECHO "*** you link to this library. But I can only do this if you have a"
6694 $ECHO "*** shared version of the library, which you do not appear to have"
6695 $ECHO "*** because I did check the linker path looking for a file starting"
a.rottmann62507b62003-03-24 09:40:34 +00006696 if test -z "$potlib" ; then
mlcreech636a9952008-05-05 22:52:56 +00006697 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
a.rottmann62507b62003-03-24 09:40:34 +00006698 else
mlcreech636a9952008-05-05 22:52:56 +00006699 $ECHO "*** with $libname and none of the candidates passed a file format test"
6700 $ECHO "*** using a file magic. Last file checked: $potlib"
a.rottmann62507b62003-03-24 09:40:34 +00006701 fi
drh71eb93e2001-09-28 01:34:43 +00006702 fi
mlcreech636a9952008-05-05 22:52:56 +00006703 ;;
6704 *)
drh71eb93e2001-09-28 01:34:43 +00006705 # Add a -L argument.
6706 newdeplibs="$newdeplibs $a_deplib"
mlcreech636a9952008-05-05 22:52:56 +00006707 ;;
6708 esac
drh71eb93e2001-09-28 01:34:43 +00006709 done # Gone through all deplibs.
6710 ;;
6711 match_pattern*)
mlcreech636a9952008-05-05 22:52:56 +00006712 set dummy $deplibs_check_method; shift
6713 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
drh71eb93e2001-09-28 01:34:43 +00006714 for a_deplib in $deplibs; do
mlcreech636a9952008-05-05 22:52:56 +00006715 case $a_deplib in
6716 -l*)
6717 func_stripname -l '' "$a_deplib"
6718 name=$func_stripname_result
a.rottmann964dbb12004-02-26 19:47:42 +00006719 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6720 case " $predeps $postdeps " in
6721 *" $a_deplib "*)
6722 newdeplibs="$newdeplibs $a_deplib"
6723 a_deplib=""
6724 ;;
6725 esac
6726 fi
6727 if test -n "$a_deplib" ; then
mlcreech636a9952008-05-05 22:52:56 +00006728 libname=`eval "\\$ECHO \"$libname_spec\""`
a.rottmann964dbb12004-02-26 19:47:42 +00006729 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
6730 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
6731 for potent_lib in $potential_libs; do
6732 potlib="$potent_lib" # see symlink-check above in file_magic test
mlcreech636a9952008-05-05 22:52:56 +00006733 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
6734 $EGREP "$match_pattern_regex" > /dev/null; then
a.rottmann964dbb12004-02-26 19:47:42 +00006735 newdeplibs="$newdeplibs $a_deplib"
6736 a_deplib=""
6737 break 2
6738 fi
6739 done
drh71eb93e2001-09-28 01:34:43 +00006740 done
a.rottmann964dbb12004-02-26 19:47:42 +00006741 fi
drh71eb93e2001-09-28 01:34:43 +00006742 if test -n "$a_deplib" ; then
6743 droppeddeps=yes
mlcreech636a9952008-05-05 22:52:56 +00006744 $ECHO
6745 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
6746 $ECHO "*** I have the capability to make that library automatically link in when"
6747 $ECHO "*** you link to this library. But I can only do this if you have a"
6748 $ECHO "*** shared version of the library, which you do not appear to have"
6749 $ECHO "*** because I did check the linker path looking for a file starting"
a.rottmann62507b62003-03-24 09:40:34 +00006750 if test -z "$potlib" ; then
mlcreech636a9952008-05-05 22:52:56 +00006751 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
a.rottmann62507b62003-03-24 09:40:34 +00006752 else
mlcreech636a9952008-05-05 22:52:56 +00006753 $ECHO "*** with $libname and none of the candidates passed a file format test"
6754 $ECHO "*** using a regex pattern. Last file checked: $potlib"
a.rottmann62507b62003-03-24 09:40:34 +00006755 fi
drh71eb93e2001-09-28 01:34:43 +00006756 fi
mlcreech636a9952008-05-05 22:52:56 +00006757 ;;
6758 *)
drh71eb93e2001-09-28 01:34:43 +00006759 # Add a -L argument.
6760 newdeplibs="$newdeplibs $a_deplib"
mlcreech636a9952008-05-05 22:52:56 +00006761 ;;
6762 esac
drh71eb93e2001-09-28 01:34:43 +00006763 done # Gone through all deplibs.
6764 ;;
6765 none | unknown | *)
6766 newdeplibs=""
mlcreech636a9952008-05-05 22:52:56 +00006767 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
6768 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
a.rottmann964dbb12004-02-26 19:47:42 +00006769 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
6770 for i in $predeps $postdeps ; do
6771 # can't use Xsed below, because $i might contain '/'
mlcreech636a9952008-05-05 22:52:56 +00006772 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
a.rottmann964dbb12004-02-26 19:47:42 +00006773 done
6774 fi
mlcreech636a9952008-05-05 22:52:56 +00006775 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
6776 $GREP . >/dev/null; then
6777 $ECHO
drh71eb93e2001-09-28 01:34:43 +00006778 if test "X$deplibs_check_method" = "Xnone"; then
mlcreech636a9952008-05-05 22:52:56 +00006779 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
drh71eb93e2001-09-28 01:34:43 +00006780 else
mlcreech636a9952008-05-05 22:52:56 +00006781 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
drh71eb93e2001-09-28 01:34:43 +00006782 fi
mlcreech636a9952008-05-05 22:52:56 +00006783 $ECHO "*** All declared inter-library dependencies are being dropped."
drh71eb93e2001-09-28 01:34:43 +00006784 droppeddeps=yes
6785 fi
6786 ;;
6787 esac
6788 versuffix=$versuffix_save
6789 major=$major_save
6790 release=$release_save
6791 libname=$libname_save
6792 name=$name_save
6793
6794 case $host in
6795 *-*-rhapsody* | *-*-darwin1.[012])
mlcreech636a9952008-05-05 22:52:56 +00006796 # On Rhapsody replace the C library with the System framework
6797 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
drh71eb93e2001-09-28 01:34:43 +00006798 ;;
6799 esac
6800
6801 if test "$droppeddeps" = yes; then
6802 if test "$module" = yes; then
mlcreech636a9952008-05-05 22:52:56 +00006803 $ECHO
6804 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
6805 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
6806 $ECHO "*** a static module, that should work as long as the dlopening"
6807 $ECHO "*** application is linked with the -dlopen flag."
drh71eb93e2001-09-28 01:34:43 +00006808 if test -z "$global_symbol_pipe"; then
mlcreech636a9952008-05-05 22:52:56 +00006809 $ECHO
6810 $ECHO "*** However, this would only work if libtool was able to extract symbol"
6811 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
6812 $ECHO "*** not find such a program. So, this module is probably useless."
6813 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
drh71eb93e2001-09-28 01:34:43 +00006814 fi
6815 if test "$build_old_libs" = no; then
6816 oldlibs="$output_objdir/$libname.$libext"
6817 build_libtool_libs=module
6818 build_old_libs=yes
6819 else
6820 build_libtool_libs=no
6821 fi
6822 else
mlcreech636a9952008-05-05 22:52:56 +00006823 $ECHO "*** The inter-library dependencies that have been dropped here will be"
6824 $ECHO "*** automatically added whenever a program is linked with this library"
6825 $ECHO "*** or is declared to -dlopen it."
drh71eb93e2001-09-28 01:34:43 +00006826
a.rottmann964dbb12004-02-26 19:47:42 +00006827 if test "$allow_undefined" = no; then
mlcreech636a9952008-05-05 22:52:56 +00006828 $ECHO
6829 $ECHO "*** Since this library must not contain undefined symbols,"
6830 $ECHO "*** because either the platform does not support them or"
6831 $ECHO "*** it was explicitly requested with -no-undefined,"
6832 $ECHO "*** libtool will only create a static version of it."
drh71eb93e2001-09-28 01:34:43 +00006833 if test "$build_old_libs" = no; then
6834 oldlibs="$output_objdir/$libname.$libext"
6835 build_libtool_libs=module
6836 build_old_libs=yes
6837 else
6838 build_libtool_libs=no
6839 fi
6840 fi
6841 fi
6842 fi
6843 # Done checking deplibs!
6844 deplibs=$newdeplibs
6845 fi
mlcreech636a9952008-05-05 22:52:56 +00006846 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
6847 case $host in
6848 *-*-darwin*)
6849 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6850 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6851 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6852 ;;
6853 esac
vapier7f19c022007-02-17 14:46:31 +00006854
6855 # move library search paths that coincide with paths to not yet
6856 # installed libraries to the beginning of the library search list
6857 new_libs=
6858 for path in $notinst_path; do
6859 case " $new_libs " in
6860 *" -L$path/$objdir "*) ;;
6861 *)
6862 case " $deplibs " in
6863 *" -L$path/$objdir "*)
6864 new_libs="$new_libs -L$path/$objdir" ;;
6865 esac
6866 ;;
6867 esac
6868 done
6869 for deplib in $deplibs; do
6870 case $deplib in
6871 -L*)
6872 case " $new_libs " in
6873 *" $deplib "*) ;;
6874 *) new_libs="$new_libs $deplib" ;;
6875 esac
6876 ;;
6877 *) new_libs="$new_libs $deplib" ;;
6878 esac
6879 done
6880 deplibs="$new_libs"
6881
drh71eb93e2001-09-28 01:34:43 +00006882 # All the library-specific variables (install_libdir is set above).
6883 library_names=
6884 old_library=
6885 dlname=
6886
6887 # Test again, we may have decided not to build it any more
6888 if test "$build_libtool_libs" = yes; then
a.rottmann964dbb12004-02-26 19:47:42 +00006889 if test "$hardcode_into_libs" = yes; then
drh71eb93e2001-09-28 01:34:43 +00006890 # Hardcode the library paths
6891 hardcode_libdirs=
6892 dep_rpath=
6893 rpath="$finalize_rpath"
6894 test "$mode" != relink && rpath="$compile_rpath$rpath"
6895 for libdir in $rpath; do
6896 if test -n "$hardcode_libdir_flag_spec"; then
6897 if test -n "$hardcode_libdir_separator"; then
6898 if test -z "$hardcode_libdirs"; then
6899 hardcode_libdirs="$libdir"
6900 else
6901 # Just accumulate the unique libdirs.
6902 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6903 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6904 ;;
6905 *)
6906 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6907 ;;
6908 esac
6909 fi
6910 else
6911 eval flag=\"$hardcode_libdir_flag_spec\"
6912 dep_rpath="$dep_rpath $flag"
6913 fi
6914 elif test -n "$runpath_var"; then
6915 case "$perm_rpath " in
6916 *" $libdir "*) ;;
6917 *) perm_rpath="$perm_rpath $libdir" ;;
6918 esac
6919 fi
6920 done
6921 # Substitute the hardcoded libdirs into the rpath.
6922 if test -n "$hardcode_libdir_separator" &&
6923 test -n "$hardcode_libdirs"; then
6924 libdir="$hardcode_libdirs"
a.rottmann964dbb12004-02-26 19:47:42 +00006925 if test -n "$hardcode_libdir_flag_spec_ld"; then
6926 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
6927 else
6928 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
6929 fi
drh71eb93e2001-09-28 01:34:43 +00006930 fi
6931 if test -n "$runpath_var" && test -n "$perm_rpath"; then
6932 # We should set the runpath_var.
6933 rpath=
6934 for dir in $perm_rpath; do
6935 rpath="$rpath$dir:"
6936 done
6937 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
6938 fi
6939 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
6940 fi
6941
6942 shlibpath="$finalize_shlibpath"
6943 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
6944 if test -n "$shlibpath"; then
6945 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
6946 fi
6947
6948 # Get the real and link names of the library.
vapier7f19c022007-02-17 14:46:31 +00006949 eval shared_ext=\"$shrext_cmds\"
drh71eb93e2001-09-28 01:34:43 +00006950 eval library_names=\"$library_names_spec\"
6951 set dummy $library_names
mlcreech636a9952008-05-05 22:52:56 +00006952 shift
6953 realname="$1"
6954 shift
drh71eb93e2001-09-28 01:34:43 +00006955
6956 if test -n "$soname_spec"; then
6957 eval soname=\"$soname_spec\"
6958 else
6959 soname="$realname"
6960 fi
a.rottmann964dbb12004-02-26 19:47:42 +00006961 if test -z "$dlname"; then
6962 dlname=$soname
6963 fi
drh71eb93e2001-09-28 01:34:43 +00006964
6965 lib="$output_objdir/$realname"
vapier7f19c022007-02-17 14:46:31 +00006966 linknames=
drh71eb93e2001-09-28 01:34:43 +00006967 for link
6968 do
6969 linknames="$linknames $link"
6970 done
6971
6972 # Use standard objects if they are pic
mlcreech636a9952008-05-05 22:52:56 +00006973 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6974 test "X$libobjs" = "X " && libobjs=
6975
6976 delfiles=
6977 if test -n "$export_symbols" && test -n "$include_expsyms"; then
6978 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
6979 export_symbols="$output_objdir/$libname.uexp"
6980 delfiles="$delfiles $export_symbols"
6981 fi
6982
6983 orig_export_symbols=
6984 case $host_os in
vapier6acb2cf2009-01-28 04:46:28 +00006985 cygwin* | mingw* | cegcc*)
mlcreech636a9952008-05-05 22:52:56 +00006986 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
6987 # exporting using user supplied symfile
6988 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
6989 # and it's NOT already a .def file. Must figure out
6990 # which of the given symbols are data symbols and tag
6991 # them as such. So, trigger use of export_symbols_cmds.
6992 # export_symbols gets reassigned inside the "prepare
6993 # the list of exported symbols" if statement, so the
6994 # include_expsyms logic still works.
6995 orig_export_symbols="$export_symbols"
6996 export_symbols=
6997 always_export_symbols=yes
6998 fi
6999 fi
7000 ;;
7001 esac
drh71eb93e2001-09-28 01:34:43 +00007002
7003 # Prepare the list of exported symbols
7004 if test -z "$export_symbols"; then
7005 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
mlcreech636a9952008-05-05 22:52:56 +00007006 func_verbose "generating symbol list for \`$libname.la'"
drh71eb93e2001-09-28 01:34:43 +00007007 export_symbols="$output_objdir/$libname.exp"
mlcreech636a9952008-05-05 22:52:56 +00007008 $opt_dry_run || $RM $export_symbols
a.rottmann964dbb12004-02-26 19:47:42 +00007009 cmds=$export_symbols_cmds
a.rottmann62507b62003-03-24 09:40:34 +00007010 save_ifs="$IFS"; IFS='~'
drh71eb93e2001-09-28 01:34:43 +00007011 for cmd in $cmds; do
7012 IFS="$save_ifs"
a.rottmann964dbb12004-02-26 19:47:42 +00007013 eval cmd=\"$cmd\"
mlcreech636a9952008-05-05 22:52:56 +00007014 func_len " $cmd"
7015 len=$func_len_result
7016 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
7017 func_show_eval "$cmd" 'exit $?'
7018 skipped_export=false
a.rottmann964dbb12004-02-26 19:47:42 +00007019 else
mlcreech636a9952008-05-05 22:52:56 +00007020 # The command line is too long to execute in one step.
7021 func_verbose "using reloadable object file for export list..."
7022 skipped_export=:
vapier7f19c022007-02-17 14:46:31 +00007023 # Break out early, otherwise skipped_export may be
7024 # set to false by a later but shorter cmd.
7025 break
a.rottmann964dbb12004-02-26 19:47:42 +00007026 fi
drh71eb93e2001-09-28 01:34:43 +00007027 done
7028 IFS="$save_ifs"
mlcreech636a9952008-05-05 22:52:56 +00007029 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
7030 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7031 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
drh71eb93e2001-09-28 01:34:43 +00007032 fi
7033 fi
7034 fi
7035
7036 if test -n "$export_symbols" && test -n "$include_expsyms"; then
mlcreech636a9952008-05-05 22:52:56 +00007037 tmp_export_symbols="$export_symbols"
7038 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7039 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7040 fi
7041
7042 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
7043 # The given exports_symbols file has to be filtered, so filter it.
7044 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7045 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7046 # 's' commands which not all seds can handle. GNU sed should be fine
7047 # though. Also, the filter scales superlinearly with the number of
7048 # global variables. join(1) would be nice here, but unfortunately
7049 # isn't a blessed tool.
7050 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7051 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7052 export_symbols=$output_objdir/$libname.def
7053 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
drh71eb93e2001-09-28 01:34:43 +00007054 fi
7055
a.rottmann964dbb12004-02-26 19:47:42 +00007056 tmp_deplibs=
7057 for test_deplib in $deplibs; do
mlcreech636a9952008-05-05 22:52:56 +00007058 case " $convenience " in
7059 *" $test_deplib "*) ;;
7060 *)
7061 tmp_deplibs="$tmp_deplibs $test_deplib"
7062 ;;
7063 esac
a.rottmann964dbb12004-02-26 19:47:42 +00007064 done
vapier7f19c022007-02-17 14:46:31 +00007065 deplibs="$tmp_deplibs"
a.rottmann964dbb12004-02-26 19:47:42 +00007066
drh71eb93e2001-09-28 01:34:43 +00007067 if test -n "$convenience"; then
mlcreech636a9952008-05-05 22:52:56 +00007068 if test -n "$whole_archive_flag_spec" &&
7069 test "$compiler_needs_object" = yes &&
7070 test -z "$libobjs"; then
7071 # extract the archives, so we have objects to list.
7072 # TODO: could optimize this to just extract one archive.
7073 whole_archive_flag_spec=
7074 fi
drh71eb93e2001-09-28 01:34:43 +00007075 if test -n "$whole_archive_flag_spec"; then
a.rottmann964dbb12004-02-26 19:47:42 +00007076 save_libobjs=$libobjs
drh71eb93e2001-09-28 01:34:43 +00007077 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
mlcreech636a9952008-05-05 22:52:56 +00007078 test "X$libobjs" = "X " && libobjs=
drh71eb93e2001-09-28 01:34:43 +00007079 else
7080 gentop="$output_objdir/${outputname}x"
drh71eb93e2001-09-28 01:34:43 +00007081 generated="$generated $gentop"
7082
vapier7f19c022007-02-17 14:46:31 +00007083 func_extract_archives $gentop $convenience
7084 libobjs="$libobjs $func_extract_archives_result"
mlcreech636a9952008-05-05 22:52:56 +00007085 test "X$libobjs" = "X " && libobjs=
drh71eb93e2001-09-28 01:34:43 +00007086 fi
7087 fi
mlcreech636a9952008-05-05 22:52:56 +00007088
drh71eb93e2001-09-28 01:34:43 +00007089 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
7090 eval flag=\"$thread_safe_flag_spec\"
7091 linker_flags="$linker_flags $flag"
7092 fi
7093
7094 # Make a backup of the uninstalled library when relinking
7095 if test "$mode" = relink; then
mlcreech636a9952008-05-05 22:52:56 +00007096 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
drh71eb93e2001-09-28 01:34:43 +00007097 fi
7098
7099 # Do each of the archive commands.
a.rottmann964dbb12004-02-26 19:47:42 +00007100 if test "$module" = yes && test -n "$module_cmds" ; then
7101 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7102 eval test_cmds=\"$module_expsym_cmds\"
7103 cmds=$module_expsym_cmds
7104 else
7105 eval test_cmds=\"$module_cmds\"
7106 cmds=$module_cmds
7107 fi
drh71eb93e2001-09-28 01:34:43 +00007108 else
mlcreech636a9952008-05-05 22:52:56 +00007109 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7110 eval test_cmds=\"$archive_expsym_cmds\"
7111 cmds=$archive_expsym_cmds
7112 else
7113 eval test_cmds=\"$archive_cmds\"
7114 cmds=$archive_cmds
a.rottmann964dbb12004-02-26 19:47:42 +00007115 fi
7116 fi
7117
vapier7f19c022007-02-17 14:46:31 +00007118 if test "X$skipped_export" != "X:" &&
mlcreech636a9952008-05-05 22:52:56 +00007119 func_len " $test_cmds" &&
7120 len=$func_len_result &&
7121 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
a.rottmann964dbb12004-02-26 19:47:42 +00007122 :
7123 else
mlcreech636a9952008-05-05 22:52:56 +00007124 # The command line is too long to link in one step, link piecewise
7125 # or, if using GNU ld and skipped_export is not :, use a linker
7126 # script.
a.rottmann964dbb12004-02-26 19:47:42 +00007127
7128 # Save the value of $output and $libobjs because we want to
7129 # use them later. If we have whole_archive_flag_spec, we
7130 # want to use save_libobjs as it was before
7131 # whole_archive_flag_spec was expanded, because we can't
7132 # assume the linker understands whole_archive_flag_spec.
7133 # This may have to be revisited, in case too many
7134 # convenience libraries get linked in and end up exceeding
7135 # the spec.
7136 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
7137 save_libobjs=$libobjs
7138 fi
7139 save_output=$output
mlcreech636a9952008-05-05 22:52:56 +00007140 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
a.rottmann964dbb12004-02-26 19:47:42 +00007141
7142 # Clear the reloadable object creation command queue and
7143 # initialize k to one.
7144 test_cmds=
7145 concat_cmds=
7146 objlist=
a.rottmann964dbb12004-02-26 19:47:42 +00007147 last_robj=
7148 k=1
mlcreech636a9952008-05-05 22:52:56 +00007149
7150 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
7151 output=${output_objdir}/${output_la}.lnkscript
7152 func_verbose "creating GNU ld script: $output"
7153 $ECHO 'INPUT (' > $output
7154 for obj in $save_libobjs
7155 do
7156 $ECHO "$obj" >> $output
7157 done
7158 $ECHO ')' >> $output
7159 delfiles="$delfiles $output"
7160 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
7161 output=${output_objdir}/${output_la}.lnk
7162 func_verbose "creating linker input file list: $output"
7163 : > $output
7164 set x $save_libobjs
7165 shift
7166 firstobj=
7167 if test "$compiler_needs_object" = yes; then
7168 firstobj="$1 "
7169 shift
a.rottmann964dbb12004-02-26 19:47:42 +00007170 fi
mlcreech636a9952008-05-05 22:52:56 +00007171 for obj
7172 do
7173 $ECHO "$obj" >> $output
7174 done
7175 delfiles="$delfiles $output"
7176 output=$firstobj\"$file_list_spec$output\"
7177 else
7178 if test -n "$save_libobjs"; then
7179 func_verbose "creating reloadable object files..."
7180 output=$output_objdir/$output_la-${k}.$objext
7181 eval test_cmds=\"$reload_cmds\"
7182 func_len " $test_cmds"
7183 len0=$func_len_result
7184 len=$len0
a.rottmann964dbb12004-02-26 19:47:42 +00007185
mlcreech636a9952008-05-05 22:52:56 +00007186 # Loop over the list of objects to be linked.
7187 for obj in $save_libobjs
7188 do
7189 func_len " $obj"
7190 func_arith $len + $func_len_result
7191 len=$func_arith_result
7192 if test "X$objlist" = X ||
7193 test "$len" -lt "$max_cmd_len"; then
7194 func_append objlist " $obj"
7195 else
7196 # The command $test_cmds is almost too long, add a
7197 # command to the queue.
7198 if test "$k" -eq 1 ; then
7199 # The first file doesn't have a previous command to add.
7200 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
7201 else
7202 # All subsequent reloadable object files will link in
7203 # the last one created.
7204 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
7205 fi
7206 last_robj=$output_objdir/$output_la-${k}.$objext
7207 func_arith $k + 1
7208 k=$func_arith_result
7209 output=$output_objdir/$output_la-${k}.$objext
7210 objlist=$obj
7211 func_len " $last_robj"
7212 func_arith $len0 + $func_len_result
7213 len=$func_arith_result
7214 fi
7215 done
7216 # Handle the remaining objects by creating one last
7217 # reloadable object file. All subsequent reloadable object
7218 # files will link in the last one created.
7219 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7220 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
7221 if test -n "$last_robj"; then
7222 eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
7223 fi
7224 delfiles="$delfiles $output"
a.rottmann964dbb12004-02-26 19:47:42 +00007225
mlcreech636a9952008-05-05 22:52:56 +00007226 else
7227 output=
7228 fi
a.rottmann964dbb12004-02-26 19:47:42 +00007229
mlcreech636a9952008-05-05 22:52:56 +00007230 if ${skipped_export-false}; then
7231 func_verbose "generating symbol list for \`$libname.la'"
7232 export_symbols="$output_objdir/$libname.exp"
7233 $opt_dry_run || $RM $export_symbols
7234 libobjs=$output
7235 # Append the command to create the export file.
7236 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
7237 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
7238 if test -n "$last_robj"; then
7239 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
7240 fi
7241 fi
a.rottmann964dbb12004-02-26 19:47:42 +00007242
mlcreech636a9952008-05-05 22:52:56 +00007243 test -n "$save_libobjs" &&
7244 func_verbose "creating a temporary reloadable object file: $output"
7245
7246 # Loop through the commands generated above and execute them.
7247 save_ifs="$IFS"; IFS='~'
7248 for cmd in $concat_cmds; do
7249 IFS="$save_ifs"
7250 $opt_silent || {
7251 func_quote_for_expand "$cmd"
7252 eval "func_echo $func_quote_for_expand_result"
7253 }
7254 $opt_dry_run || eval "$cmd" || {
7255 lt_exit=$?
7256
7257 # Restore the uninstalled library and exit
7258 if test "$mode" = relink; then
7259 ( cd "$output_objdir" && \
7260 $RM "${realname}T" && \
7261 $MV "${realname}U" "$realname" )
7262 fi
7263
7264 exit $lt_exit
7265 }
7266 done
a.rottmann964dbb12004-02-26 19:47:42 +00007267 IFS="$save_ifs"
mlcreech636a9952008-05-05 22:52:56 +00007268
7269 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
7270 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
7271 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
7272 fi
7273 fi
7274
7275 if ${skipped_export-false}; then
7276 if test -n "$export_symbols" && test -n "$include_expsyms"; then
7277 tmp_export_symbols="$export_symbols"
7278 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
7279 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
7280 fi
7281
7282 if test -n "$orig_export_symbols"; then
7283 # The given exports_symbols file has to be filtered, so filter it.
7284 func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
7285 # FIXME: $output_objdir/$libname.filter potentially contains lots of
7286 # 's' commands which not all seds can handle. GNU sed should be fine
7287 # though. Also, the filter scales superlinearly with the number of
7288 # global variables. join(1) would be nice here, but unfortunately
7289 # isn't a blessed tool.
7290 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
7291 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
7292 export_symbols=$output_objdir/$libname.def
7293 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
7294 fi
7295 fi
a.rottmann964dbb12004-02-26 19:47:42 +00007296
7297 libobjs=$output
7298 # Restore the value of output.
7299 output=$save_output
7300
7301 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
7302 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
mlcreech636a9952008-05-05 22:52:56 +00007303 test "X$libobjs" = "X " && libobjs=
a.rottmann964dbb12004-02-26 19:47:42 +00007304 fi
7305 # Expand the library linking commands again to reset the
7306 # value of $libobjs for piecewise linking.
7307
7308 # Do each of the archive commands.
7309 if test "$module" = yes && test -n "$module_cmds" ; then
7310 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
7311 cmds=$module_expsym_cmds
7312 else
7313 cmds=$module_cmds
7314 fi
7315 else
mlcreech636a9952008-05-05 22:52:56 +00007316 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
7317 cmds=$archive_expsym_cmds
7318 else
7319 cmds=$archive_cmds
a.rottmann964dbb12004-02-26 19:47:42 +00007320 fi
7321 fi
drh71eb93e2001-09-28 01:34:43 +00007322 fi
mlcreech636a9952008-05-05 22:52:56 +00007323
7324 if test -n "$delfiles"; then
7325 # Append the command to remove temporary files to $cmds.
7326 eval cmds=\"\$cmds~\$RM $delfiles\"
7327 fi
7328
7329 # Add any objects from preloaded convenience libraries
7330 if test -n "$dlprefiles"; then
7331 gentop="$output_objdir/${outputname}x"
7332 generated="$generated $gentop"
7333
7334 func_extract_archives $gentop $dlprefiles
7335 libobjs="$libobjs $func_extract_archives_result"
7336 test "X$libobjs" = "X " && libobjs=
7337 fi
7338
a.rottmann62507b62003-03-24 09:40:34 +00007339 save_ifs="$IFS"; IFS='~'
7340 for cmd in $cmds; do
7341 IFS="$save_ifs"
a.rottmann964dbb12004-02-26 19:47:42 +00007342 eval cmd=\"$cmd\"
mlcreech636a9952008-05-05 22:52:56 +00007343 $opt_silent || {
7344 func_quote_for_expand "$cmd"
7345 eval "func_echo $func_quote_for_expand_result"
7346 }
7347 $opt_dry_run || eval "$cmd" || {
vapier7f19c022007-02-17 14:46:31 +00007348 lt_exit=$?
7349
7350 # Restore the uninstalled library and exit
7351 if test "$mode" = relink; then
mlcreech636a9952008-05-05 22:52:56 +00007352 ( cd "$output_objdir" && \
7353 $RM "${realname}T" && \
7354 $MV "${realname}U" "$realname" )
vapier7f19c022007-02-17 14:46:31 +00007355 fi
7356
7357 exit $lt_exit
7358 }
a.rottmann62507b62003-03-24 09:40:34 +00007359 done
7360 IFS="$save_ifs"
drh71eb93e2001-09-28 01:34:43 +00007361
7362 # Restore the uninstalled library and exit
7363 if test "$mode" = relink; then
mlcreech636a9952008-05-05 22:52:56 +00007364 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
vapier7f19c022007-02-17 14:46:31 +00007365
7366 if test -n "$convenience"; then
7367 if test -z "$whole_archive_flag_spec"; then
mlcreech636a9952008-05-05 22:52:56 +00007368 func_show_eval '${RM}r "$gentop"'
vapier7f19c022007-02-17 14:46:31 +00007369 fi
7370 fi
7371
7372 exit $EXIT_SUCCESS
drh71eb93e2001-09-28 01:34:43 +00007373 fi
7374
7375 # Create links to the real library.
7376 for linkname in $linknames; do
7377 if test "$realname" != "$linkname"; then
mlcreech636a9952008-05-05 22:52:56 +00007378 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
drh71eb93e2001-09-28 01:34:43 +00007379 fi
7380 done
7381
7382 # If -module or -export-dynamic was specified, set the dlname.
7383 if test "$module" = yes || test "$export_dynamic" = yes; then
7384 # On all known operating systems, these are identical.
7385 dlname="$soname"
7386 fi
7387 fi
7388 ;;
7389
7390 obj)
drh71eb93e2001-09-28 01:34:43 +00007391 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
mlcreech636a9952008-05-05 22:52:56 +00007392 func_warning "\`-dlopen' is ignored for objects"
drh71eb93e2001-09-28 01:34:43 +00007393 fi
7394
mlcreech636a9952008-05-05 22:52:56 +00007395 case " $deplibs" in
7396 *\ -l* | *\ -L*)
7397 func_warning "\`-l' and \`-L' are ignored for objects" ;;
7398 esac
drh71eb93e2001-09-28 01:34:43 +00007399
mlcreech636a9952008-05-05 22:52:56 +00007400 test -n "$rpath" && \
7401 func_warning "\`-rpath' is ignored for objects"
drh71eb93e2001-09-28 01:34:43 +00007402
mlcreech636a9952008-05-05 22:52:56 +00007403 test -n "$xrpath" && \
7404 func_warning "\`-R' is ignored for objects"
drh71eb93e2001-09-28 01:34:43 +00007405
mlcreech636a9952008-05-05 22:52:56 +00007406 test -n "$vinfo" && \
7407 func_warning "\`-version-info' is ignored for objects"
7408
7409 test -n "$release" && \
7410 func_warning "\`-release' is ignored for objects"
drh71eb93e2001-09-28 01:34:43 +00007411
7412 case $output in
7413 *.lo)
mlcreech636a9952008-05-05 22:52:56 +00007414 test -n "$objs$old_deplibs" && \
7415 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
7416
7417 libobj=$output
7418 func_lo2o "$libobj"
7419 obj=$func_lo2o_result
drh71eb93e2001-09-28 01:34:43 +00007420 ;;
7421 *)
7422 libobj=
7423 obj="$output"
7424 ;;
7425 esac
7426
7427 # Delete the old objects.
mlcreech636a9952008-05-05 22:52:56 +00007428 $opt_dry_run || $RM $obj $libobj
drh71eb93e2001-09-28 01:34:43 +00007429
7430 # Objects from convenience libraries. This assumes
7431 # single-version convenience libraries. Whenever we create
7432 # different ones for PIC/non-PIC, this we'll have to duplicate
7433 # the extraction.
7434 reload_conv_objs=
7435 gentop=
7436 # reload_cmds runs $LD directly, so let us get rid of
mlcreech636a9952008-05-05 22:52:56 +00007437 # -Wl from whole_archive_flag_spec and hope we can get by with
7438 # turning comma into space..
drh71eb93e2001-09-28 01:34:43 +00007439 wl=
7440
7441 if test -n "$convenience"; then
7442 if test -n "$whole_archive_flag_spec"; then
mlcreech636a9952008-05-05 22:52:56 +00007443 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
7444 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
drh71eb93e2001-09-28 01:34:43 +00007445 else
7446 gentop="$output_objdir/${obj}x"
drh71eb93e2001-09-28 01:34:43 +00007447 generated="$generated $gentop"
7448
vapier7f19c022007-02-17 14:46:31 +00007449 func_extract_archives $gentop $convenience
7450 reload_conv_objs="$reload_objs $func_extract_archives_result"
drh71eb93e2001-09-28 01:34:43 +00007451 fi
7452 fi
7453
7454 # Create the old-style object.
mlcreech636a9952008-05-05 22:52:56 +00007455 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
drh71eb93e2001-09-28 01:34:43 +00007456
7457 output="$obj"
mlcreech636a9952008-05-05 22:52:56 +00007458 func_execute_cmds "$reload_cmds" 'exit $?'
drh71eb93e2001-09-28 01:34:43 +00007459
7460 # Exit if we aren't doing a library object file.
7461 if test -z "$libobj"; then
7462 if test -n "$gentop"; then
mlcreech636a9952008-05-05 22:52:56 +00007463 func_show_eval '${RM}r "$gentop"'
drh71eb93e2001-09-28 01:34:43 +00007464 fi
7465
vapier7f19c022007-02-17 14:46:31 +00007466 exit $EXIT_SUCCESS
drh71eb93e2001-09-28 01:34:43 +00007467 fi
7468
7469 if test "$build_libtool_libs" != yes; then
7470 if test -n "$gentop"; then
mlcreech636a9952008-05-05 22:52:56 +00007471 func_show_eval '${RM}r "$gentop"'
drh71eb93e2001-09-28 01:34:43 +00007472 fi
7473
7474 # Create an invalid libtool object if no PIC, so that we don't
7475 # accidentally link it into a program.
a.rottmann964dbb12004-02-26 19:47:42 +00007476 # $show "echo timestamp > $libobj"
mlcreech636a9952008-05-05 22:52:56 +00007477 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
vapier7f19c022007-02-17 14:46:31 +00007478 exit $EXIT_SUCCESS
drh71eb93e2001-09-28 01:34:43 +00007479 fi
7480
7481 if test -n "$pic_flag" || test "$pic_mode" != default; then
7482 # Only do commands if we really have different PIC objects.
7483 reload_objs="$libobjs $reload_conv_objs"
7484 output="$libobj"
mlcreech636a9952008-05-05 22:52:56 +00007485 func_execute_cmds "$reload_cmds" 'exit $?'
drh71eb93e2001-09-28 01:34:43 +00007486 fi
7487
7488 if test -n "$gentop"; then
mlcreech636a9952008-05-05 22:52:56 +00007489 func_show_eval '${RM}r "$gentop"'
drh71eb93e2001-09-28 01:34:43 +00007490 fi
7491
vapier7f19c022007-02-17 14:46:31 +00007492 exit $EXIT_SUCCESS
drh71eb93e2001-09-28 01:34:43 +00007493 ;;
7494
7495 prog)
7496 case $host in
mlcreech636a9952008-05-05 22:52:56 +00007497 *cygwin*) func_stripname '' '.exe' "$output"
7498 output=$func_stripname_result.exe;;
drh71eb93e2001-09-28 01:34:43 +00007499 esac
mlcreech636a9952008-05-05 22:52:56 +00007500 test -n "$vinfo" && \
7501 func_warning "\`-version-info' is ignored for programs"
drh71eb93e2001-09-28 01:34:43 +00007502
mlcreech636a9952008-05-05 22:52:56 +00007503 test -n "$release" && \
7504 func_warning "\`-release' is ignored for programs"
drh71eb93e2001-09-28 01:34:43 +00007505
mlcreech636a9952008-05-05 22:52:56 +00007506 test "$preload" = yes \
7507 && test "$dlopen_support" = unknown \
7508 && test "$dlopen_self" = unknown \
7509 && test "$dlopen_self_static" = unknown && \
7510 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
drh71eb93e2001-09-28 01:34:43 +00007511
7512 case $host in
7513 *-*-rhapsody* | *-*-darwin1.[012])
7514 # On Rhapsody replace the C library is the System framework
mlcreech636a9952008-05-05 22:52:56 +00007515 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
7516 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
drh71eb93e2001-09-28 01:34:43 +00007517 ;;
7518 esac
7519
a.rottmann964dbb12004-02-26 19:47:42 +00007520 case $host in
mlcreech636a9952008-05-05 22:52:56 +00007521 *-*-darwin*)
7522 # Don't allow lazy linking, it breaks C++ global constructors
7523 # But is supposedly fixed on 10.4 or later (yay!).
7524 if test "$tagname" = CXX ; then
7525 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
7526 10.[0123])
7527 compile_command="$compile_command ${wl}-bind_at_load"
7528 finalize_command="$finalize_command ${wl}-bind_at_load"
7529 ;;
7530 esac
7531 fi
7532 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
7533 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7534 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
7535 ;;
a.rottmann964dbb12004-02-26 19:47:42 +00007536 esac
7537
vapier7f19c022007-02-17 14:46:31 +00007538
7539 # move library search paths that coincide with paths to not yet
7540 # installed libraries to the beginning of the library search list
7541 new_libs=
7542 for path in $notinst_path; do
7543 case " $new_libs " in
7544 *" -L$path/$objdir "*) ;;
7545 *)
7546 case " $compile_deplibs " in
7547 *" -L$path/$objdir "*)
7548 new_libs="$new_libs -L$path/$objdir" ;;
7549 esac
7550 ;;
7551 esac
7552 done
7553 for deplib in $compile_deplibs; do
7554 case $deplib in
7555 -L*)
7556 case " $new_libs " in
7557 *" $deplib "*) ;;
7558 *) new_libs="$new_libs $deplib" ;;
7559 esac
7560 ;;
7561 *) new_libs="$new_libs $deplib" ;;
7562 esac
7563 done
7564 compile_deplibs="$new_libs"
7565
7566
drh71eb93e2001-09-28 01:34:43 +00007567 compile_command="$compile_command $compile_deplibs"
7568 finalize_command="$finalize_command $finalize_deplibs"
7569
7570 if test -n "$rpath$xrpath"; then
7571 # If the user specified any rpath flags, then add them.
7572 for libdir in $rpath $xrpath; do
7573 # This is the magic to use -rpath.
7574 case "$finalize_rpath " in
7575 *" $libdir "*) ;;
7576 *) finalize_rpath="$finalize_rpath $libdir" ;;
7577 esac
7578 done
7579 fi
7580
7581 # Now hardcode the library paths
7582 rpath=
7583 hardcode_libdirs=
7584 for libdir in $compile_rpath $finalize_rpath; do
7585 if test -n "$hardcode_libdir_flag_spec"; then
7586 if test -n "$hardcode_libdir_separator"; then
7587 if test -z "$hardcode_libdirs"; then
7588 hardcode_libdirs="$libdir"
7589 else
7590 # Just accumulate the unique libdirs.
7591 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7592 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7593 ;;
7594 *)
7595 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7596 ;;
7597 esac
7598 fi
7599 else
7600 eval flag=\"$hardcode_libdir_flag_spec\"
7601 rpath="$rpath $flag"
7602 fi
7603 elif test -n "$runpath_var"; then
7604 case "$perm_rpath " in
7605 *" $libdir "*) ;;
7606 *) perm_rpath="$perm_rpath $libdir" ;;
7607 esac
7608 fi
7609 case $host in
vapier6acb2cf2009-01-28 04:46:28 +00007610 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
mlcreech636a9952008-05-05 22:52:56 +00007611 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
drh71eb93e2001-09-28 01:34:43 +00007612 case :$dllsearchpath: in
7613 *":$libdir:"*) ;;
vapier6acb2cf2009-01-28 04:46:28 +00007614 ::) dllsearchpath=$libdir;;
drh71eb93e2001-09-28 01:34:43 +00007615 *) dllsearchpath="$dllsearchpath:$libdir";;
7616 esac
vapier7f19c022007-02-17 14:46:31 +00007617 case :$dllsearchpath: in
7618 *":$testbindir:"*) ;;
vapier6acb2cf2009-01-28 04:46:28 +00007619 ::) dllsearchpath=$testbindir;;
vapier7f19c022007-02-17 14:46:31 +00007620 *) dllsearchpath="$dllsearchpath:$testbindir";;
7621 esac
drh71eb93e2001-09-28 01:34:43 +00007622 ;;
7623 esac
7624 done
7625 # Substitute the hardcoded libdirs into the rpath.
7626 if test -n "$hardcode_libdir_separator" &&
7627 test -n "$hardcode_libdirs"; then
7628 libdir="$hardcode_libdirs"
7629 eval rpath=\" $hardcode_libdir_flag_spec\"
7630 fi
7631 compile_rpath="$rpath"
7632
7633 rpath=
7634 hardcode_libdirs=
7635 for libdir in $finalize_rpath; do
7636 if test -n "$hardcode_libdir_flag_spec"; then
7637 if test -n "$hardcode_libdir_separator"; then
7638 if test -z "$hardcode_libdirs"; then
7639 hardcode_libdirs="$libdir"
7640 else
7641 # Just accumulate the unique libdirs.
7642 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
7643 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
7644 ;;
7645 *)
7646 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
7647 ;;
7648 esac
7649 fi
7650 else
7651 eval flag=\"$hardcode_libdir_flag_spec\"
7652 rpath="$rpath $flag"
7653 fi
7654 elif test -n "$runpath_var"; then
7655 case "$finalize_perm_rpath " in
7656 *" $libdir "*) ;;
7657 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
7658 esac
7659 fi
7660 done
7661 # Substitute the hardcoded libdirs into the rpath.
7662 if test -n "$hardcode_libdir_separator" &&
7663 test -n "$hardcode_libdirs"; then
7664 libdir="$hardcode_libdirs"
7665 eval rpath=\" $hardcode_libdir_flag_spec\"
7666 fi
7667 finalize_rpath="$rpath"
7668
7669 if test -n "$libobjs" && test "$build_old_libs" = yes; then
7670 # Transform all the library objects into standard objects.
mlcreech636a9952008-05-05 22:52:56 +00007671 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
7672 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
drh71eb93e2001-09-28 01:34:43 +00007673 fi
7674
mlcreech636a9952008-05-05 22:52:56 +00007675 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
7676
7677 # template prelinking step
7678 if test -n "$prelink_cmds"; then
7679 func_execute_cmds "$prelink_cmds" 'exit $?'
drh71eb93e2001-09-28 01:34:43 +00007680 fi
7681
mlcreech636a9952008-05-05 22:52:56 +00007682 wrappers_required=yes
7683 case $host in
7684 *cygwin* | *mingw* )
7685 if test "$build_libtool_libs" != yes; then
7686 wrappers_required=no
7687 fi
7688 ;;
vapier6acb2cf2009-01-28 04:46:28 +00007689 *cegcc)
7690 # Disable wrappers for cegcc, we are cross compiling anyway.
7691 wrappers_required=no
7692 ;;
mlcreech636a9952008-05-05 22:52:56 +00007693 *)
7694 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
7695 wrappers_required=no
7696 fi
7697 ;;
7698 esac
7699 if test "$wrappers_required" = no; then
drh71eb93e2001-09-28 01:34:43 +00007700 # Replace the output file specification.
mlcreech636a9952008-05-05 22:52:56 +00007701 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
drh71eb93e2001-09-28 01:34:43 +00007702 link_command="$compile_command$compile_rpath"
7703
7704 # We have no uninstalled library dependencies, so finalize right now.
mlcreech636a9952008-05-05 22:52:56 +00007705 exit_status=0
7706 func_show_eval "$link_command" 'exit_status=$?'
drh71eb93e2001-09-28 01:34:43 +00007707
7708 # Delete the generated files.
mlcreech636a9952008-05-05 22:52:56 +00007709 if test -f "$output_objdir/${outputname}S.${objext}"; then
7710 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
drh71eb93e2001-09-28 01:34:43 +00007711 fi
7712
vapier7f19c022007-02-17 14:46:31 +00007713 exit $exit_status
drh71eb93e2001-09-28 01:34:43 +00007714 fi
7715
drh71eb93e2001-09-28 01:34:43 +00007716 if test -n "$compile_shlibpath$finalize_shlibpath"; then
7717 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
7718 fi
7719 if test -n "$finalize_shlibpath"; then
7720 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
7721 fi
7722
7723 compile_var=
7724 finalize_var=
7725 if test -n "$runpath_var"; then
7726 if test -n "$perm_rpath"; then
7727 # We should set the runpath_var.
7728 rpath=
7729 for dir in $perm_rpath; do
7730 rpath="$rpath$dir:"
7731 done
7732 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
7733 fi
7734 if test -n "$finalize_perm_rpath"; then
7735 # We should set the runpath_var.
7736 rpath=
7737 for dir in $finalize_perm_rpath; do
7738 rpath="$rpath$dir:"
7739 done
7740 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
7741 fi
7742 fi
7743
7744 if test "$no_install" = yes; then
7745 # We don't need to create a wrapper script.
7746 link_command="$compile_var$compile_command$compile_rpath"
7747 # Replace the output file specification.
mlcreech636a9952008-05-05 22:52:56 +00007748 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
drh71eb93e2001-09-28 01:34:43 +00007749 # Delete the old output file.
mlcreech636a9952008-05-05 22:52:56 +00007750 $opt_dry_run || $RM $output
drh71eb93e2001-09-28 01:34:43 +00007751 # Link the executable and exit
mlcreech636a9952008-05-05 22:52:56 +00007752 func_show_eval "$link_command" 'exit $?'
vapier7f19c022007-02-17 14:46:31 +00007753 exit $EXIT_SUCCESS
drh71eb93e2001-09-28 01:34:43 +00007754 fi
7755
7756 if test "$hardcode_action" = relink; then
7757 # Fast installation is not supported
7758 link_command="$compile_var$compile_command$compile_rpath"
7759 relink_command="$finalize_var$finalize_command$finalize_rpath"
7760
mlcreech636a9952008-05-05 22:52:56 +00007761 func_warning "this platform does not like uninstalled shared libraries"
7762 func_warning "\`$output' will be relinked during installation"
drh71eb93e2001-09-28 01:34:43 +00007763 else
7764 if test "$fast_install" != no; then
7765 link_command="$finalize_var$compile_command$finalize_rpath"
7766 if test "$fast_install" = yes; then
mlcreech636a9952008-05-05 22:52:56 +00007767 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
drh71eb93e2001-09-28 01:34:43 +00007768 else
7769 # fast_install is set to needless
7770 relink_command=
7771 fi
7772 else
7773 link_command="$compile_var$compile_command$compile_rpath"
7774 relink_command="$finalize_var$finalize_command$finalize_rpath"
7775 fi
7776 fi
7777
7778 # Replace the output file specification.
mlcreech636a9952008-05-05 22:52:56 +00007779 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
drh71eb93e2001-09-28 01:34:43 +00007780
7781 # Delete the old output files.
mlcreech636a9952008-05-05 22:52:56 +00007782 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
drh71eb93e2001-09-28 01:34:43 +00007783
mlcreech636a9952008-05-05 22:52:56 +00007784 func_show_eval "$link_command" 'exit $?'
drh71eb93e2001-09-28 01:34:43 +00007785
7786 # Now create the wrapper script.
mlcreech636a9952008-05-05 22:52:56 +00007787 func_verbose "creating $output"
drh71eb93e2001-09-28 01:34:43 +00007788
7789 # Quote the relink command for shipping.
7790 if test -n "$relink_command"; then
7791 # Preserve any variables that may affect compiler behavior
7792 for var in $variables_saved_for_relink; do
7793 if eval test -z \"\${$var+set}\"; then
mlcreech636a9952008-05-05 22:52:56 +00007794 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
drh71eb93e2001-09-28 01:34:43 +00007795 elif eval var_value=\$$var; test -z "$var_value"; then
7796 relink_command="$var=; export $var; $relink_command"
7797 else
mlcreech636a9952008-05-05 22:52:56 +00007798 func_quote_for_eval "$var_value"
7799 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
drh71eb93e2001-09-28 01:34:43 +00007800 fi
7801 done
a.rottmann62507b62003-03-24 09:40:34 +00007802 relink_command="(cd `pwd`; $relink_command)"
mlcreech636a9952008-05-05 22:52:56 +00007803 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
drh71eb93e2001-09-28 01:34:43 +00007804 fi
7805
mlcreech636a9952008-05-05 22:52:56 +00007806 # Quote $ECHO for shipping.
7807 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
vapier7f19c022007-02-17 14:46:31 +00007808 case $progpath in
7809 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
7810 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
drh71eb93e2001-09-28 01:34:43 +00007811 esac
mlcreech636a9952008-05-05 22:52:56 +00007812 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
drh71eb93e2001-09-28 01:34:43 +00007813 else
mlcreech636a9952008-05-05 22:52:56 +00007814 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
drh71eb93e2001-09-28 01:34:43 +00007815 fi
7816
mlcreech636a9952008-05-05 22:52:56 +00007817 # Only actually do things if not in dry run mode.
7818 $opt_dry_run || {
drh71eb93e2001-09-28 01:34:43 +00007819 # win32 will think the script is a binary if it has
7820 # a .exe suffix, so we strip it off here.
7821 case $output in
mlcreech636a9952008-05-05 22:52:56 +00007822 *.exe) func_stripname '' '.exe' "$output"
7823 output=$func_stripname_result ;;
drh71eb93e2001-09-28 01:34:43 +00007824 esac
7825 # test for cygwin because mv fails w/o .exe extensions
7826 case $host in
a.rottmann964dbb12004-02-26 19:47:42 +00007827 *cygwin*)
7828 exeext=.exe
mlcreech636a9952008-05-05 22:52:56 +00007829 func_stripname '' '.exe' "$outputname"
7830 outputname=$func_stripname_result ;;
drh71eb93e2001-09-28 01:34:43 +00007831 *) exeext= ;;
7832 esac
a.rottmann964dbb12004-02-26 19:47:42 +00007833 case $host in
7834 *cygwin* | *mingw* )
mlcreech636a9952008-05-05 22:52:56 +00007835 func_dirname_and_basename "$output" "" "."
7836 output_name=$func_basename_result
7837 output_path=$func_dirname_result
7838 cwrappersource="$output_path/$objdir/lt-$output_name.c"
7839 cwrapper="$output_path/$output_name.exe"
7840 $RM $cwrappersource $cwrapper
7841 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
a.rottmann964dbb12004-02-26 19:47:42 +00007842
mlcreech636a9952008-05-05 22:52:56 +00007843 func_emit_cwrapperexe_src > $cwrappersource
a.rottmann964dbb12004-02-26 19:47:42 +00007844
vapier6acb2cf2009-01-28 04:46:28 +00007845 # The wrapper executable is built using the $host compiler,
7846 # because it contains $host paths and files. If cross-
7847 # compiling, it, like the target executable, must be
7848 # executed on the $host or under an emulation environment.
mlcreech636a9952008-05-05 22:52:56 +00007849 $opt_dry_run || {
7850 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
7851 $STRIP $cwrapper
7852 }
a.rottmann964dbb12004-02-26 19:47:42 +00007853
mlcreech636a9952008-05-05 22:52:56 +00007854 # Now, create the wrapper script for func_source use:
7855 func_ltwrapper_scriptname $cwrapper
7856 $RM $func_ltwrapper_scriptname_result
7857 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
7858 $opt_dry_run || {
7859 # note: this script will not be executed, so do not chmod.
7860 if test "x$build" = "x$host" ; then
7861 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
7862 else
7863 func_emit_wrapper no > $func_ltwrapper_scriptname_result
7864 fi
7865 }
drh71eb93e2001-09-28 01:34:43 +00007866 ;;
mlcreech636a9952008-05-05 22:52:56 +00007867 * )
7868 $RM $output
7869 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
drh71eb93e2001-09-28 01:34:43 +00007870
mlcreech636a9952008-05-05 22:52:56 +00007871 func_emit_wrapper no > $output
7872 chmod +x $output
drh71eb93e2001-09-28 01:34:43 +00007873 ;;
7874 esac
mlcreech636a9952008-05-05 22:52:56 +00007875 }
vapier7f19c022007-02-17 14:46:31 +00007876 exit $EXIT_SUCCESS
drh71eb93e2001-09-28 01:34:43 +00007877 ;;
7878 esac
7879
7880 # See if we need to build an old-fashioned archive.
7881 for oldlib in $oldlibs; do
7882
7883 if test "$build_libtool_libs" = convenience; then
mlcreech636a9952008-05-05 22:52:56 +00007884 oldobjs="$libobjs_save $symfileobj"
drh71eb93e2001-09-28 01:34:43 +00007885 addlibs="$convenience"
7886 build_libtool_libs=no
7887 else
7888 if test "$build_libtool_libs" = module; then
7889 oldobjs="$libobjs_save"
7890 build_libtool_libs=no
7891 else
a.rottmann964dbb12004-02-26 19:47:42 +00007892 oldobjs="$old_deplibs $non_pic_objects"
mlcreech636a9952008-05-05 22:52:56 +00007893 if test "$preload" = yes && test -f "$symfileobj"; then
7894 oldobjs="$oldobjs $symfileobj"
7895 fi
drh71eb93e2001-09-28 01:34:43 +00007896 fi
7897 addlibs="$old_convenience"
7898 fi
7899
7900 if test -n "$addlibs"; then
7901 gentop="$output_objdir/${outputname}x"
drh71eb93e2001-09-28 01:34:43 +00007902 generated="$generated $gentop"
7903
vapier7f19c022007-02-17 14:46:31 +00007904 func_extract_archives $gentop $addlibs
7905 oldobjs="$oldobjs $func_extract_archives_result"
drh71eb93e2001-09-28 01:34:43 +00007906 fi
7907
7908 # Do each command in the archive commands.
7909 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
mlcreech636a9952008-05-05 22:52:56 +00007910 cmds=$old_archive_from_new_cmds
drh71eb93e2001-09-28 01:34:43 +00007911 else
mlcreech636a9952008-05-05 22:52:56 +00007912
7913 # Add any objects from preloaded convenience libraries
7914 if test -n "$dlprefiles"; then
7915 gentop="$output_objdir/${outputname}x"
7916 generated="$generated $gentop"
7917
7918 func_extract_archives $gentop $dlprefiles
7919 oldobjs="$oldobjs $func_extract_archives_result"
7920 fi
7921
vapier7f19c022007-02-17 14:46:31 +00007922 # POSIX demands no paths to be encoded in archives. We have
7923 # to avoid creating archives with duplicate basenames if we
7924 # might have to extract them afterwards, e.g., when creating a
7925 # static archive out of a convenience library, or when linking
7926 # the entirety of a libtool archive into another (currently
7927 # not supported by libtool).
7928 if (for obj in $oldobjs
7929 do
mlcreech636a9952008-05-05 22:52:56 +00007930 func_basename "$obj"
7931 $ECHO "$func_basename_result"
vapier7f19c022007-02-17 14:46:31 +00007932 done | sort | sort -uc >/dev/null 2>&1); then
7933 :
7934 else
mlcreech636a9952008-05-05 22:52:56 +00007935 $ECHO "copying selected object files to avoid basename conflicts..."
7936 gentop="$output_objdir/${outputname}x"
7937 generated="$generated $gentop"
7938 func_mkdir_p "$gentop"
vapier7f19c022007-02-17 14:46:31 +00007939 save_oldobjs=$oldobjs
7940 oldobjs=
7941 counter=1
7942 for obj in $save_oldobjs
7943 do
mlcreech636a9952008-05-05 22:52:56 +00007944 func_basename "$obj"
7945 objbase="$func_basename_result"
vapier7f19c022007-02-17 14:46:31 +00007946 case " $oldobjs " in
7947 " ") oldobjs=$obj ;;
7948 *[\ /]"$objbase "*)
7949 while :; do
7950 # Make sure we don't pick an alternate name that also
7951 # overlaps.
7952 newobj=lt$counter-$objbase
mlcreech636a9952008-05-05 22:52:56 +00007953 func_arith $counter + 1
7954 counter=$func_arith_result
vapier7f19c022007-02-17 14:46:31 +00007955 case " $oldobjs " in
7956 *[\ /]"$newobj "*) ;;
7957 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
7958 esac
7959 done
mlcreech636a9952008-05-05 22:52:56 +00007960 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
vapier7f19c022007-02-17 14:46:31 +00007961 oldobjs="$oldobjs $gentop/$newobj"
7962 ;;
7963 *) oldobjs="$oldobjs $obj" ;;
7964 esac
7965 done
7966 fi
a.rottmann62507b62003-03-24 09:40:34 +00007967 eval cmds=\"$old_archive_cmds\"
a.rottmann964dbb12004-02-26 19:47:42 +00007968
mlcreech636a9952008-05-05 22:52:56 +00007969 func_len " $cmds"
7970 len=$func_len_result
7971 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
a.rottmann964dbb12004-02-26 19:47:42 +00007972 cmds=$old_archive_cmds
7973 else
7974 # the command line is too long to link in one step, link in parts
mlcreech636a9952008-05-05 22:52:56 +00007975 func_verbose "using piecewise archive linking..."
a.rottmann964dbb12004-02-26 19:47:42 +00007976 save_RANLIB=$RANLIB
7977 RANLIB=:
7978 objlist=
7979 concat_cmds=
7980 save_oldobjs=$oldobjs
mlcreech636a9952008-05-05 22:52:56 +00007981 oldobjs=
a.rottmann964dbb12004-02-26 19:47:42 +00007982 # Is there a better way of finding the last object in the list?
7983 for obj in $save_oldobjs
7984 do
7985 last_oldobj=$obj
vapier7f19c022007-02-17 14:46:31 +00007986 done
mlcreech636a9952008-05-05 22:52:56 +00007987 eval test_cmds=\"$old_archive_cmds\"
7988 func_len " $test_cmds"
7989 len0=$func_len_result
7990 len=$len0
a.rottmann964dbb12004-02-26 19:47:42 +00007991 for obj in $save_oldobjs
7992 do
mlcreech636a9952008-05-05 22:52:56 +00007993 func_len " $obj"
7994 func_arith $len + $func_len_result
7995 len=$func_arith_result
7996 func_append objlist " $obj"
7997 if test "$len" -lt "$max_cmd_len"; then
a.rottmann964dbb12004-02-26 19:47:42 +00007998 :
7999 else
8000 # the above command should be used before it gets too long
8001 oldobjs=$objlist
8002 if test "$obj" = "$last_oldobj" ; then
mlcreech636a9952008-05-05 22:52:56 +00008003 RANLIB=$save_RANLIB
vapier7f19c022007-02-17 14:46:31 +00008004 fi
a.rottmann964dbb12004-02-26 19:47:42 +00008005 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
8006 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
8007 objlist=
mlcreech636a9952008-05-05 22:52:56 +00008008 len=$len0
a.rottmann964dbb12004-02-26 19:47:42 +00008009 fi
8010 done
8011 RANLIB=$save_RANLIB
8012 oldobjs=$objlist
8013 if test "X$oldobjs" = "X" ; then
8014 eval cmds=\"\$concat_cmds\"
8015 else
8016 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
8017 fi
8018 fi
drh71eb93e2001-09-28 01:34:43 +00008019 fi
mlcreech636a9952008-05-05 22:52:56 +00008020 func_execute_cmds "$cmds" 'exit $?'
drh71eb93e2001-09-28 01:34:43 +00008021 done
8022
mlcreech636a9952008-05-05 22:52:56 +00008023 test -n "$generated" && \
8024 func_show_eval "${RM}r$generated"
drh71eb93e2001-09-28 01:34:43 +00008025
8026 # Now create the libtool archive.
8027 case $output in
8028 *.la)
8029 old_library=
8030 test "$build_old_libs" = yes && old_library="$libname.$libext"
mlcreech636a9952008-05-05 22:52:56 +00008031 func_verbose "creating $output"
drh71eb93e2001-09-28 01:34:43 +00008032
8033 # Preserve any variables that may affect compiler behavior
8034 for var in $variables_saved_for_relink; do
8035 if eval test -z \"\${$var+set}\"; then
mlcreech636a9952008-05-05 22:52:56 +00008036 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
drh71eb93e2001-09-28 01:34:43 +00008037 elif eval var_value=\$$var; test -z "$var_value"; then
8038 relink_command="$var=; export $var; $relink_command"
8039 else
mlcreech636a9952008-05-05 22:52:56 +00008040 func_quote_for_eval "$var_value"
8041 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
drh71eb93e2001-09-28 01:34:43 +00008042 fi
8043 done
8044 # Quote the link command for shipping.
vapier7f19c022007-02-17 14:46:31 +00008045 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
mlcreech636a9952008-05-05 22:52:56 +00008046 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
a.rottmann964dbb12004-02-26 19:47:42 +00008047 if test "$hardcode_automatic" = yes ; then
vapier7f19c022007-02-17 14:46:31 +00008048 relink_command=
8049 fi
8050
drh71eb93e2001-09-28 01:34:43 +00008051 # Only create the output if not a dry run.
mlcreech636a9952008-05-05 22:52:56 +00008052 $opt_dry_run || {
drh71eb93e2001-09-28 01:34:43 +00008053 for installed in no yes; do
8054 if test "$installed" = yes; then
8055 if test -z "$install_libdir"; then
8056 break
8057 fi
8058 output="$output_objdir/$outputname"i
8059 # Replace all uninstalled libtool libraries with the installed ones
8060 newdependency_libs=
8061 for deplib in $dependency_libs; do
8062 case $deplib in
8063 *.la)
mlcreech636a9952008-05-05 22:52:56 +00008064 func_basename "$deplib"
8065 name="$func_basename_result"
a.rottmann62507b62003-03-24 09:40:34 +00008066 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
mlcreech636a9952008-05-05 22:52:56 +00008067 test -z "$libdir" && \
8068 func_fatal_error "\`$deplib' is not a valid libtool archive"
8069 if test "x$EGREP" = x ; then
vapier7f19c022007-02-17 14:46:31 +00008070 EGREP=egrep
8071 fi
8072 # We do not want portage's install root ($D) present. Check only for
8073 # this if the .la is being installed.
8074 if test "$installed" = yes && test "$D"; then
8075 eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
8076 else
8077 mynewdependency_lib="$libdir/$name"
8078 fi
8079 # Do not add duplicates
8080 if test "$mynewdependency_lib"; then
8081 my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
8082 if test -z "$my_little_ninja_foo_1"; then
8083 newdependency_libs="$newdependency_libs $mynewdependency_lib"
8084 fi
8085 fi
drh71eb93e2001-09-28 01:34:43 +00008086 ;;
vapier7f19c022007-02-17 14:46:31 +00008087 *)
8088 if test "$installed" = yes; then
8089 # Rather use S=WORKDIR if our version of portage supports it.
8090 # This is because some ebuild (gcc) do not use $S as buildroot.
8091 if test "$PWORKDIR"; then
8092 S="$PWORKDIR"
8093 fi
8094 # We do not want portage's build root ($S) present.
8095 my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
8096 # We do not want portage's install root ($D) present.
8097 my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
8098 if test -n "$my_little_ninja_foo_2" && test "$S"; then
8099 mynewdependency_lib=""
8100 elif test -n "$my_little_ninja_foo_3" && test "$D"; then
8101 eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
8102 else
8103 mynewdependency_lib="$deplib"
8104 fi
8105 else
8106 mynewdependency_lib="$deplib"
8107 fi
8108 # Do not add duplicates
8109 if test "$mynewdependency_lib"; then
8110 my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
8111 if test -z "$my_little_ninja_foo_4"; then
8112 newdependency_libs="$newdependency_libs $mynewdependency_lib"
8113 fi
8114 fi
8115 ;;
drh71eb93e2001-09-28 01:34:43 +00008116 esac
8117 done
8118 dependency_libs="$newdependency_libs"
8119 newdlfiles=
mlcreech636a9952008-05-05 22:52:56 +00008120
drh71eb93e2001-09-28 01:34:43 +00008121 for lib in $dlfiles; do
mlcreech636a9952008-05-05 22:52:56 +00008122 case $lib in
8123 *.la)
8124 func_basename "$lib"
8125 name="$func_basename_result"
8126 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8127 test -z "$libdir" && \
8128 func_fatal_error "\`$lib' is not a valid libtool archive"
8129 newdlfiles="$newdlfiles $libdir/$name"
8130 ;;
8131 *) newdlfiles="$newdlfiles $lib" ;;
8132 esac
drh71eb93e2001-09-28 01:34:43 +00008133 done
8134 dlfiles="$newdlfiles"
8135 newdlprefiles=
8136 for lib in $dlprefiles; do
mlcreech636a9952008-05-05 22:52:56 +00008137 case $lib in
8138 *.la)
8139 # Only pass preopened files to the pseudo-archive (for
8140 # eventual linking with the app. that links it) if we
8141 # didn't already link the preopened objects directly into
8142 # the library:
8143 func_basename "$lib"
8144 name="$func_basename_result"
8145 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
8146 test -z "$libdir" && \
8147 func_fatal_error "\`$lib' is not a valid libtool archive"
8148 newdlprefiles="$newdlprefiles $libdir/$name"
8149 ;;
8150 esac
drh71eb93e2001-09-28 01:34:43 +00008151 done
8152 dlprefiles="$newdlprefiles"
a.rottmann964dbb12004-02-26 19:47:42 +00008153 else
8154 newdlfiles=
8155 for lib in $dlfiles; do
vapier7f19c022007-02-17 14:46:31 +00008156 case $lib in
a.rottmann964dbb12004-02-26 19:47:42 +00008157 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8158 *) abs=`pwd`"/$lib" ;;
8159 esac
8160 newdlfiles="$newdlfiles $abs"
8161 done
8162 dlfiles="$newdlfiles"
8163 newdlprefiles=
8164 for lib in $dlprefiles; do
vapier7f19c022007-02-17 14:46:31 +00008165 case $lib in
a.rottmann964dbb12004-02-26 19:47:42 +00008166 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
8167 *) abs=`pwd`"/$lib" ;;
8168 esac
8169 newdlprefiles="$newdlprefiles $abs"
8170 done
8171 dlprefiles="$newdlprefiles"
drh71eb93e2001-09-28 01:34:43 +00008172 fi
mlcreech636a9952008-05-05 22:52:56 +00008173 $RM $output
drh71eb93e2001-09-28 01:34:43 +00008174 # place dlname in correct position for cygwin
8175 tdlname=$dlname
8176 case $host,$output,$installed,$module,$dlname in
vapier6acb2cf2009-01-28 04:46:28 +00008177 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
drh71eb93e2001-09-28 01:34:43 +00008178 esac
vapier7f19c022007-02-17 14:46:31 +00008179 # Do not add duplicates
8180 if test "$installed" = yes && test "$D"; then
8181 install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
8182 fi
mlcreech636a9952008-05-05 22:52:56 +00008183 $ECHO > $output "\
drh71eb93e2001-09-28 01:34:43 +00008184# $outputname - a libtool library file
mlcreech636a9952008-05-05 22:52:56 +00008185# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
drh71eb93e2001-09-28 01:34:43 +00008186#
8187# Please DO NOT delete this file!
8188# It is necessary for linking the library.
8189
8190# The name that we can dlopen(3).
8191dlname='$tdlname'
8192
8193# Names of this library.
8194library_names='$library_names'
8195
8196# The name of the static archive.
8197old_library='$old_library'
8198
mlcreech636a9952008-05-05 22:52:56 +00008199# Linker flags that can not go in dependency_libs.
8200inherited_linker_flags='$new_inherited_linker_flags'
8201
drh71eb93e2001-09-28 01:34:43 +00008202# Libraries that this one depends upon.
8203dependency_libs='$dependency_libs'
8204
mlcreech636a9952008-05-05 22:52:56 +00008205# Names of additional weak libraries provided by this library
8206weak_library_names='$weak_libs'
8207
drh71eb93e2001-09-28 01:34:43 +00008208# Version information for $libname.
8209current=$current
8210age=$age
8211revision=$revision
8212
8213# Is this an already installed library?
8214installed=$installed
8215
a.rottmann964dbb12004-02-26 19:47:42 +00008216# Should we warn about portability when linking against -modules?
8217shouldnotlink=$module
8218
drh71eb93e2001-09-28 01:34:43 +00008219# Files to dlopen/dlpreopen
8220dlopen='$dlfiles'
8221dlpreopen='$dlprefiles'
8222
8223# Directory that this library needs to be installed in:
8224libdir='$install_libdir'"
a.rottmann964dbb12004-02-26 19:47:42 +00008225 if test "$installed" = no && test "$need_relink" = yes; then
mlcreech636a9952008-05-05 22:52:56 +00008226 $ECHO >> $output "\
drh71eb93e2001-09-28 01:34:43 +00008227relink_command=\"$relink_command\""
8228 fi
8229 done
mlcreech636a9952008-05-05 22:52:56 +00008230 }
drh71eb93e2001-09-28 01:34:43 +00008231
8232 # Do a symbolic link so that the libtool archive can be found in
8233 # LD_LIBRARY_PATH before the program is installed.
mlcreech636a9952008-05-05 22:52:56 +00008234 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
drh71eb93e2001-09-28 01:34:43 +00008235 ;;
8236 esac
vapier7f19c022007-02-17 14:46:31 +00008237 exit $EXIT_SUCCESS
mlcreech636a9952008-05-05 22:52:56 +00008238}
drh71eb93e2001-09-28 01:34:43 +00008239
mlcreech636a9952008-05-05 22:52:56 +00008240{ test "$mode" = link || test "$mode" = relink; } &&
8241 func_mode_link ${1+"$@"}
drh71eb93e2001-09-28 01:34:43 +00008242
drh71eb93e2001-09-28 01:34:43 +00008243
mlcreech636a9952008-05-05 22:52:56 +00008244# func_mode_uninstall arg...
8245func_mode_uninstall ()
8246{
8247 $opt_debug
8248 RM="$nonopt"
drh71eb93e2001-09-28 01:34:43 +00008249 files=
8250 rmforce=
8251 exit_status=0
8252
8253 # This variable tells wrapper scripts just to set variables rather
8254 # than running their programs.
8255 libtool_install_magic="$magic"
8256
8257 for arg
8258 do
8259 case $arg in
mlcreech636a9952008-05-05 22:52:56 +00008260 -f) RM="$RM $arg"; rmforce=yes ;;
8261 -*) RM="$RM $arg" ;;
drh71eb93e2001-09-28 01:34:43 +00008262 *) files="$files $arg" ;;
8263 esac
8264 done
8265
mlcreech636a9952008-05-05 22:52:56 +00008266 test -z "$RM" && \
8267 func_fatal_help "you must specify an RM program"
drh71eb93e2001-09-28 01:34:43 +00008268
8269 rmdirs=
8270
a.rottmann964dbb12004-02-26 19:47:42 +00008271 origobjdir="$objdir"
drh71eb93e2001-09-28 01:34:43 +00008272 for file in $files; do
mlcreech636a9952008-05-05 22:52:56 +00008273 func_dirname "$file" "" "."
8274 dir="$func_dirname_result"
8275 if test "X$dir" = X.; then
a.rottmann964dbb12004-02-26 19:47:42 +00008276 objdir="$origobjdir"
drh71eb93e2001-09-28 01:34:43 +00008277 else
a.rottmann964dbb12004-02-26 19:47:42 +00008278 objdir="$dir/$origobjdir"
drh71eb93e2001-09-28 01:34:43 +00008279 fi
mlcreech636a9952008-05-05 22:52:56 +00008280 func_basename "$file"
8281 name="$func_basename_result"
a.rottmann964dbb12004-02-26 19:47:42 +00008282 test "$mode" = uninstall && objdir="$dir"
drh71eb93e2001-09-28 01:34:43 +00008283
8284 # Remember objdir for removal later, being careful to avoid duplicates
a.rottmann964dbb12004-02-26 19:47:42 +00008285 if test "$mode" = clean; then
drh71eb93e2001-09-28 01:34:43 +00008286 case " $rmdirs " in
8287 *" $objdir "*) ;;
8288 *) rmdirs="$rmdirs $objdir" ;;
8289 esac
8290 fi
8291
8292 # Don't error if the file doesn't exist and rm -f was used.
mlcreech636a9952008-05-05 22:52:56 +00008293 if { test -L "$file"; } >/dev/null 2>&1 ||
8294 { test -h "$file"; } >/dev/null 2>&1 ||
8295 test -f "$file"; then
a.rottmann62507b62003-03-24 09:40:34 +00008296 :
drh71eb93e2001-09-28 01:34:43 +00008297 elif test -d "$file"; then
a.rottmann62507b62003-03-24 09:40:34 +00008298 exit_status=1
drh71eb93e2001-09-28 01:34:43 +00008299 continue
8300 elif test "$rmforce" = yes; then
a.rottmann62507b62003-03-24 09:40:34 +00008301 continue
drh71eb93e2001-09-28 01:34:43 +00008302 fi
8303
8304 rmfiles="$file"
8305
8306 case $name in
8307 *.la)
8308 # Possibly a libtool archive, so verify it.
mlcreech636a9952008-05-05 22:52:56 +00008309 if func_lalib_p "$file"; then
8310 func_source $dir/$name
drh71eb93e2001-09-28 01:34:43 +00008311
8312 # Delete the libtool libraries and symlinks.
8313 for n in $library_names; do
8314 rmfiles="$rmfiles $objdir/$n"
8315 done
8316 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
drh71eb93e2001-09-28 01:34:43 +00008317
vapier7f19c022007-02-17 14:46:31 +00008318 case "$mode" in
8319 clean)
8320 case " $library_names " in
8321 # " " in the beginning catches empty $dlname
8322 *" $dlname "*) ;;
8323 *) rmfiles="$rmfiles $objdir/$dlname" ;;
8324 esac
mlcreech636a9952008-05-05 22:52:56 +00008325 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
vapier7f19c022007-02-17 14:46:31 +00008326 ;;
8327 uninstall)
drh71eb93e2001-09-28 01:34:43 +00008328 if test -n "$library_names"; then
8329 # Do each command in the postuninstall commands.
mlcreech636a9952008-05-05 22:52:56 +00008330 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
drh71eb93e2001-09-28 01:34:43 +00008331 fi
8332
8333 if test -n "$old_library"; then
8334 # Do each command in the old_postuninstall commands.
mlcreech636a9952008-05-05 22:52:56 +00008335 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
drh71eb93e2001-09-28 01:34:43 +00008336 fi
8337 # FIXME: should reinstall the best remaining shared library.
vapier7f19c022007-02-17 14:46:31 +00008338 ;;
8339 esac
drh71eb93e2001-09-28 01:34:43 +00008340 fi
8341 ;;
8342
8343 *.lo)
a.rottmann964dbb12004-02-26 19:47:42 +00008344 # Possibly a libtool object, so verify it.
mlcreech636a9952008-05-05 22:52:56 +00008345 if func_lalib_p "$file"; then
a.rottmann964dbb12004-02-26 19:47:42 +00008346
8347 # Read the .lo file
mlcreech636a9952008-05-05 22:52:56 +00008348 func_source $dir/$name
a.rottmann964dbb12004-02-26 19:47:42 +00008349
8350 # Add PIC object to the list of files to remove.
mlcreech636a9952008-05-05 22:52:56 +00008351 if test -n "$pic_object" &&
8352 test "$pic_object" != none; then
a.rottmann964dbb12004-02-26 19:47:42 +00008353 rmfiles="$rmfiles $dir/$pic_object"
8354 fi
8355
8356 # Add non-PIC object to the list of files to remove.
mlcreech636a9952008-05-05 22:52:56 +00008357 if test -n "$non_pic_object" &&
8358 test "$non_pic_object" != none; then
a.rottmann964dbb12004-02-26 19:47:42 +00008359 rmfiles="$rmfiles $dir/$non_pic_object"
8360 fi
drh71eb93e2001-09-28 01:34:43 +00008361 fi
8362 ;;
8363
8364 *)
a.rottmann964dbb12004-02-26 19:47:42 +00008365 if test "$mode" = clean ; then
8366 noexename=$name
8367 case $file in
vapier7f19c022007-02-17 14:46:31 +00008368 *.exe)
mlcreech636a9952008-05-05 22:52:56 +00008369 func_stripname '' '.exe' "$file"
8370 file=$func_stripname_result
8371 func_stripname '' '.exe' "$name"
8372 noexename=$func_stripname_result
a.rottmann964dbb12004-02-26 19:47:42 +00008373 # $file with .exe has already been added to rmfiles,
8374 # add $file without .exe
8375 rmfiles="$rmfiles $file"
8376 ;;
8377 esac
8378 # Do a test to see if this is a libtool program.
mlcreech636a9952008-05-05 22:52:56 +00008379 if func_ltwrapper_p "$file"; then
8380 if func_ltwrapper_executable_p "$file"; then
8381 func_ltwrapper_scriptname "$file"
8382 relink_command=
8383 func_source $func_ltwrapper_scriptname_result
8384 rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
8385 else
8386 relink_command=
8387 func_source $dir/$noexename
8388 fi
drh71eb93e2001-09-28 01:34:43 +00008389
a.rottmann964dbb12004-02-26 19:47:42 +00008390 # note $name still contains .exe if it was in $file originally
8391 # as does the version of $file that was added into $rmfiles
8392 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
8393 if test "$fast_install" = yes && test -n "$relink_command"; then
8394 rmfiles="$rmfiles $objdir/lt-$name"
8395 fi
8396 if test "X$noexename" != "X$name" ; then
8397 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
8398 fi
drh71eb93e2001-09-28 01:34:43 +00008399 fi
8400 fi
8401 ;;
8402 esac
mlcreech636a9952008-05-05 22:52:56 +00008403 func_show_eval "$RM $rmfiles" 'exit_status=1'
drh71eb93e2001-09-28 01:34:43 +00008404 done
a.rottmann964dbb12004-02-26 19:47:42 +00008405 objdir="$origobjdir"
drh71eb93e2001-09-28 01:34:43 +00008406
8407 # Try to remove the ${objdir}s in the directories where we deleted files
8408 for dir in $rmdirs; do
8409 if test -d "$dir"; then
mlcreech636a9952008-05-05 22:52:56 +00008410 func_show_eval "rmdir $dir >/dev/null 2>&1"
drh71eb93e2001-09-28 01:34:43 +00008411 fi
8412 done
8413
8414 exit $exit_status
mlcreech636a9952008-05-05 22:52:56 +00008415}
drh71eb93e2001-09-28 01:34:43 +00008416
mlcreech636a9952008-05-05 22:52:56 +00008417{ test "$mode" = uninstall || test "$mode" = clean; } &&
8418 func_mode_uninstall ${1+"$@"}
drh71eb93e2001-09-28 01:34:43 +00008419
mlcreech636a9952008-05-05 22:52:56 +00008420test -z "$mode" && {
8421 help="$generic_help"
8422 func_fatal_help "you must specify a MODE"
8423}
8424
8425test -z "$exec_cmd" && \
8426 func_fatal_help "invalid operation mode \`$mode'"
drh71eb93e2001-09-28 01:34:43 +00008427
8428if test -n "$exec_cmd"; then
mlcreech636a9952008-05-05 22:52:56 +00008429 eval exec "$exec_cmd"
vapier7f19c022007-02-17 14:46:31 +00008430 exit $EXIT_FAILURE
drh71eb93e2001-09-28 01:34:43 +00008431fi
8432
mlcreech636a9952008-05-05 22:52:56 +00008433exit $exit_status
drh71eb93e2001-09-28 01:34:43 +00008434
drh71eb93e2001-09-28 01:34:43 +00008435
a.rottmann964dbb12004-02-26 19:47:42 +00008436# The TAGs below are defined such that we never get into a situation
8437# in which we disable both kinds of libraries. Given conflicting
8438# choices, we go for a static library, that is the most portable,
8439# since we can't tell whether shared libraries were disabled because
8440# the user asked for that or because the platform doesn't support
8441# them. This is particularly important on AIX, because we don't
8442# support having both static and shared libraries enabled at the same
8443# time on that platform, so we default to a shared-only configuration.
8444# If a disable-shared tag is given, we'll fallback to a static-only
8445# configuration. But we'll never go from static-only to shared-only.
8446
8447# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
mlcreech636a9952008-05-05 22:52:56 +00008448build_libtool_libs=no
8449build_old_libs=yes
a.rottmann964dbb12004-02-26 19:47:42 +00008450# ### END LIBTOOL TAG CONFIG: disable-shared
8451
8452# ### BEGIN LIBTOOL TAG CONFIG: disable-static
mlcreech636a9952008-05-05 22:52:56 +00008453build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
a.rottmann964dbb12004-02-26 19:47:42 +00008454# ### END LIBTOOL TAG CONFIG: disable-static
8455
drh71eb93e2001-09-28 01:34:43 +00008456# Local Variables:
8457# mode:shell-script
8458# sh-indentation:2
8459# End:
mlcreech636a9952008-05-05 22:52:56 +00008460# vi:sw=2
8461